@capgo/cli 8.0.0-alpha.3 → 8.0.0-alpha.5

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 CHANGED
@@ -1,80 +1,80 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var eA=Object.create;var Bs=Object.defineProperty;var tA=Object.getOwnPropertyDescriptor;var rA=Object.getOwnPropertyNames;var nA=Object.getPrototypeOf,oA=Object.prototype.hasOwnProperty;var tt=(t,e)=>()=>(t&&(e=t(t=0)),e);var x=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),qr=(t,e)=>{for(var r in e)Bs(t,r,{get:e[r],enumerable:!0})},rD=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of rA(e))!oA.call(t,o)&&o!==r&&Bs(t,o,{get:()=>e[o],enumerable:!(n=tA(e,o))||n.enumerable});return t};var ge=(t,e,r)=>(r=t!=null?eA(nA(t)):{},rD(e||!t||!t.__esModule?Bs(r,"default",{value:t,enumerable:!0}):r,t)),re=t=>rD(Bs({},"__esModule",{value:!0}),t);var ca=x(of=>{var js=class extends Error{constructor(e,r,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=r,this.exitCode=e,this.nestedError=void 0}},nf=class extends js{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};of.CommanderError=js;of.InvalidArgumentError=nf});var Ns=x(sf=>{var{InvalidArgumentError:iA}=ca(),af=class{constructor(e,r){switch(this.description=r||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}default(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new iA(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function aA(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}sf.Argument=af;sf.humanReadableArgName=aA});var lf=x(cf=>{var{humanReadableArgName:sA}=Ns(),uf=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let r=e.commands.filter(o=>!o._hidden),n=e._getHelpCommand();return n&&!n._hidden&&r.push(n),this.sortSubcommands&&r.sort((o,i)=>o.name().localeCompare(i.name())),r}compareOptions(e,r){let n=o=>o.short?o.short.replace(/^-/,""):o.long.replace(/^--/,"");return n(e).localeCompare(n(r))}visibleOptions(e){let r=e.options.filter(o=>!o.hidden),n=e._getHelpOption();if(n&&!n.hidden){let o=n.short&&e._findOption(n.short),i=n.long&&e._findOption(n.long);!o&&!i?r.push(n):n.long&&!i?r.push(e.createOption(n.long,n.description)):n.short&&!o&&r.push(e.createOption(n.short,n.description))}return this.sortOptions&&r.sort(this.compareOptions),r}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let r=[];for(let n=e.parent;n;n=n.parent){let o=n.options.filter(i=>!i.hidden);r.push(...o)}return this.sortOptions&&r.sort(this.compareOptions),r}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(r=>{r.description=r.description||e._argsDescription[r.name()]||""}),e.registeredArguments.find(r=>r.description)?e.registeredArguments:[]}subcommandTerm(e){let r=e.registeredArguments.map(n=>sA(n)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,r){return r.visibleCommands(e).reduce((n,o)=>Math.max(n,this.displayWidth(r.styleSubcommandTerm(r.subcommandTerm(o)))),0)}longestOptionTermLength(e,r){return r.visibleOptions(e).reduce((n,o)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(o)))),0)}longestGlobalOptionTermLength(e,r){return r.visibleGlobalOptions(e).reduce((n,o)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(o)))),0)}longestArgumentTermLength(e,r){return r.visibleArguments(e).reduce((n,o)=>Math.max(n,this.displayWidth(r.styleArgumentTerm(r.argumentTerm(o)))),0)}commandUsage(e){let r=e._name;e._aliases[0]&&(r=r+"|"+e._aliases[0]);let n="";for(let o=e.parent;o;o=o.parent)n=o.name()+" "+n;return n+r+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&r.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&r.push(`env: ${e.envVar}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,r,n){return r.length===0?[]:[n.styleTitle(e),...r,""]}groupItems(e,r,n){let o=new Map;return e.forEach(i=>{let a=n(i);o.has(a)||o.set(a,[])}),r.forEach(i=>{let a=n(i);o.has(a)||o.set(a,[]),o.get(a).push(i)}),o}formatHelp(e,r){let n=r.padWidth(e,r),o=r.helpWidth??80;function i(f,d){return r.formatItem(f,n,d,r)}let a=[`${r.styleTitle("Usage:")} ${r.styleUsage(r.commandUsage(e))}`,""],s=r.commandDescription(e);s.length>0&&(a=a.concat([r.boxWrap(r.styleCommandDescription(s),o),""]));let u=r.visibleArguments(e).map(f=>i(r.styleArgumentTerm(r.argumentTerm(f)),r.styleArgumentDescription(r.argumentDescription(f))));if(a=a.concat(this.formatItemList("Arguments:",u,r)),this.groupItems(e.options,r.visibleOptions(e),f=>f.helpGroupHeading??"Options:").forEach((f,d)=>{let h=f.map(m=>i(r.styleOptionTerm(r.optionTerm(m)),r.styleOptionDescription(r.optionDescription(m))));a=a.concat(this.formatItemList(d,h,r))}),r.showGlobalOptions){let f=r.visibleGlobalOptions(e).map(d=>i(r.styleOptionTerm(r.optionTerm(d)),r.styleOptionDescription(r.optionDescription(d))));a=a.concat(this.formatItemList("Global Options:",f,r))}return this.groupItems(e.commands,r.visibleCommands(e),f=>f.helpGroup()||"Commands:").forEach((f,d)=>{let h=f.map(m=>i(r.styleSubcommandTerm(r.subcommandTerm(m)),r.styleSubcommandDescription(r.subcommandDescription(m))));a=a.concat(this.formatItemList(d,h,r))}),a.join(`
3
- `)}displayWidth(e){return nD(e).length}styleTitle(e){return e}styleUsage(e){return e.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r==="[command]"?this.styleSubcommandText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleCommandText(r)).join(" ")}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleSubcommandText(r)).join(" ")}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,r){return Math.max(r.longestOptionTermLength(e,r),r.longestGlobalOptionTermLength(e,r),r.longestSubcommandTermLength(e,r),r.longestArgumentTermLength(e,r))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,r,n,o){let a=" ".repeat(2);if(!n)return a+e;let s=e.padEnd(r+e.length-o.displayWidth(e)),u=2,l=(this.helpWidth??80)-r-u-2,f;return l<this.minWidthToWrap||o.preformatted(n)?f=n:f=o.boxWrap(n,l).replace(/\n/g,`
4
- `+" ".repeat(r+u)),a+s+" ".repeat(u)+f.replace(/\n/g,`
5
- ${a}`)}boxWrap(e,r){if(r<this.minWidthToWrap)return e;let n=e.split(/\r\n|\n/),o=/[\s]*[^\s]+/g,i=[];return n.forEach(a=>{let s=a.match(o);if(s===null){i.push("");return}let u=[s.shift()],c=this.displayWidth(u[0]);s.forEach(l=>{let f=this.displayWidth(l);if(c+f<=r){u.push(l),c+=f;return}i.push(u.join(""));let d=l.trimStart();u=[d],c=this.displayWidth(d)}),i.push(u.join(""))}),i.join(`
6
- `)}};function nD(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}cf.Help=uf;cf.stripColor=nD});var hf=x(df=>{var{InvalidArgumentError:uA}=ca(),ff=class{constructor(e,r){this.flags=e,this.description=r||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=cA(e);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let r=e;return typeof e=="string"&&(r={[e]:!0}),this.implied=Object.assign(this.implied||{},r),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new uA(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?oD(this.name().replace(/^no-/,"")):oD(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},pf=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(r=>{r.negate?this.negativeOptions.set(r.attributeName(),r):this.positiveOptions.set(r.attributeName(),r)}),this.negativeOptions.forEach((r,n)=>{this.positiveOptions.has(n)&&this.dualOptions.add(n)})}valueFromOption(e,r){let n=r.attributeName();if(!this.dualOptions.has(n))return!0;let o=this.negativeOptions.get(n).presetArg,i=o!==void 0?o:!1;return r.negate===(i===e)}};function oD(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function cA(t){let e,r,n=/^-[^-]$/,o=/^--[^-]/,i=t.split(/[ |,]+/).concat("guard");if(n.test(i[0])&&(e=i.shift()),o.test(i[0])&&(r=i.shift()),!e&&n.test(i[0])&&(e=i.shift()),!e&&o.test(i[0])&&(e=r,r=i.shift()),i[0].startsWith("-")){let a=i[0],s=`option creation failed due to '${a}' in option flags '${t}'`;throw/^-[^-][^-]/.test(a)?new Error(`${s}
2
+ "use strict";var oA=Object.create;var Ls=Object.defineProperty;var iA=Object.getOwnPropertyDescriptor;var aA=Object.getOwnPropertyNames;var sA=Object.getPrototypeOf,uA=Object.prototype.hasOwnProperty;var tt=(t,e)=>()=>(t&&(e=t(t=0)),e);var x=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),qr=(t,e)=>{for(var r in e)Ls(t,r,{get:e[r],enumerable:!0})},iD=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of aA(e))!uA.call(t,o)&&o!==r&&Ls(t,o,{get:()=>e[o],enumerable:!(n=iA(e,o))||n.enumerable});return t};var me=(t,e,r)=>(r=t!=null?oA(sA(t)):{},iD(e||!t||!t.__esModule?Ls(r,"default",{value:t,enumerable:!0}):r,t)),ne=t=>iD(Ls({},"__esModule",{value:!0}),t);var pa=x(uf=>{var Us=class extends Error{constructor(e,r,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=r,this.exitCode=e,this.nestedError=void 0}},sf=class extends Us{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};uf.CommanderError=Us;uf.InvalidArgumentError=sf});var Ms=x(lf=>{var{InvalidArgumentError:cA}=pa(),cf=class{constructor(e,r){switch(this.description=r||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}default(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new cA(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function lA(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}lf.Argument=cf;lf.humanReadableArgName=lA});var df=x(pf=>{var{humanReadableArgName:fA}=Ms(),ff=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let r=e.commands.filter(o=>!o._hidden),n=e._getHelpCommand();return n&&!n._hidden&&r.push(n),this.sortSubcommands&&r.sort((o,i)=>o.name().localeCompare(i.name())),r}compareOptions(e,r){let n=o=>o.short?o.short.replace(/^-/,""):o.long.replace(/^--/,"");return n(e).localeCompare(n(r))}visibleOptions(e){let r=e.options.filter(o=>!o.hidden),n=e._getHelpOption();if(n&&!n.hidden){let o=n.short&&e._findOption(n.short),i=n.long&&e._findOption(n.long);!o&&!i?r.push(n):n.long&&!i?r.push(e.createOption(n.long,n.description)):n.short&&!o&&r.push(e.createOption(n.short,n.description))}return this.sortOptions&&r.sort(this.compareOptions),r}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let r=[];for(let n=e.parent;n;n=n.parent){let o=n.options.filter(i=>!i.hidden);r.push(...o)}return this.sortOptions&&r.sort(this.compareOptions),r}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(r=>{r.description=r.description||e._argsDescription[r.name()]||""}),e.registeredArguments.find(r=>r.description)?e.registeredArguments:[]}subcommandTerm(e){let r=e.registeredArguments.map(n=>fA(n)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,r){return r.visibleCommands(e).reduce((n,o)=>Math.max(n,this.displayWidth(r.styleSubcommandTerm(r.subcommandTerm(o)))),0)}longestOptionTermLength(e,r){return r.visibleOptions(e).reduce((n,o)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(o)))),0)}longestGlobalOptionTermLength(e,r){return r.visibleGlobalOptions(e).reduce((n,o)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(o)))),0)}longestArgumentTermLength(e,r){return r.visibleArguments(e).reduce((n,o)=>Math.max(n,this.displayWidth(r.styleArgumentTerm(r.argumentTerm(o)))),0)}commandUsage(e){let r=e._name;e._aliases[0]&&(r=r+"|"+e._aliases[0]);let n="";for(let o=e.parent;o;o=o.parent)n=o.name()+" "+n;return n+r+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&r.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&r.push(`env: ${e.envVar}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,r,n){return r.length===0?[]:[n.styleTitle(e),...r,""]}groupItems(e,r,n){let o=new Map;return e.forEach(i=>{let a=n(i);o.has(a)||o.set(a,[])}),r.forEach(i=>{let a=n(i);o.has(a)||o.set(a,[]),o.get(a).push(i)}),o}formatHelp(e,r){let n=r.padWidth(e,r),o=r.helpWidth??80;function i(p,d){return r.formatItem(p,n,d,r)}let a=[`${r.styleTitle("Usage:")} ${r.styleUsage(r.commandUsage(e))}`,""],s=r.commandDescription(e);s.length>0&&(a=a.concat([r.boxWrap(r.styleCommandDescription(s),o),""]));let u=r.visibleArguments(e).map(p=>i(r.styleArgumentTerm(r.argumentTerm(p)),r.styleArgumentDescription(r.argumentDescription(p))));if(a=a.concat(this.formatItemList("Arguments:",u,r)),this.groupItems(e.options,r.visibleOptions(e),p=>p.helpGroupHeading??"Options:").forEach((p,d)=>{let h=p.map(m=>i(r.styleOptionTerm(r.optionTerm(m)),r.styleOptionDescription(r.optionDescription(m))));a=a.concat(this.formatItemList(d,h,r))}),r.showGlobalOptions){let p=r.visibleGlobalOptions(e).map(d=>i(r.styleOptionTerm(r.optionTerm(d)),r.styleOptionDescription(r.optionDescription(d))));a=a.concat(this.formatItemList("Global Options:",p,r))}return this.groupItems(e.commands,r.visibleCommands(e),p=>p.helpGroup()||"Commands:").forEach((p,d)=>{let h=p.map(m=>i(r.styleSubcommandTerm(r.subcommandTerm(m)),r.styleSubcommandDescription(r.subcommandDescription(m))));a=a.concat(this.formatItemList(d,h,r))}),a.join(`
3
+ `)}displayWidth(e){return aD(e).length}styleTitle(e){return e}styleUsage(e){return e.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r==="[command]"?this.styleSubcommandText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleCommandText(r)).join(" ")}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleSubcommandText(r)).join(" ")}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,r){return Math.max(r.longestOptionTermLength(e,r),r.longestGlobalOptionTermLength(e,r),r.longestSubcommandTermLength(e,r),r.longestArgumentTermLength(e,r))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,r,n,o){let a=" ".repeat(2);if(!n)return a+e;let s=e.padEnd(r+e.length-o.displayWidth(e)),u=2,l=(this.helpWidth??80)-r-u-2,p;return l<this.minWidthToWrap||o.preformatted(n)?p=n:p=o.boxWrap(n,l).replace(/\n/g,`
4
+ `+" ".repeat(r+u)),a+s+" ".repeat(u)+p.replace(/\n/g,`
5
+ ${a}`)}boxWrap(e,r){if(r<this.minWidthToWrap)return e;let n=e.split(/\r\n|\n/),o=/[\s]*[^\s]+/g,i=[];return n.forEach(a=>{let s=a.match(o);if(s===null){i.push("");return}let u=[s.shift()],c=this.displayWidth(u[0]);s.forEach(l=>{let p=this.displayWidth(l);if(c+p<=r){u.push(l),c+=p;return}i.push(u.join(""));let d=l.trimStart();u=[d],c=this.displayWidth(d)}),i.push(u.join(""))}),i.join(`
6
+ `)}};function aD(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}pf.Help=ff;pf.stripColor=aD});var Df=x(gf=>{var{InvalidArgumentError:pA}=pa(),hf=class{constructor(e,r){this.flags=e,this.description=r||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=dA(e);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let r=e;return typeof e=="string"&&(r={[e]:!0}),this.implied=Object.assign(this.implied||{},r),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new pA(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?sD(this.name().replace(/^no-/,"")):sD(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},mf=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(r=>{r.negate?this.negativeOptions.set(r.attributeName(),r):this.positiveOptions.set(r.attributeName(),r)}),this.negativeOptions.forEach((r,n)=>{this.positiveOptions.has(n)&&this.dualOptions.add(n)})}valueFromOption(e,r){let n=r.attributeName();if(!this.dualOptions.has(n))return!0;let o=this.negativeOptions.get(n).presetArg,i=o!==void 0?o:!1;return r.negate===(i===e)}};function sD(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function dA(t){let e,r,n=/^-[^-]$/,o=/^--[^-]/,i=t.split(/[ |,]+/).concat("guard");if(n.test(i[0])&&(e=i.shift()),o.test(i[0])&&(r=i.shift()),!e&&n.test(i[0])&&(e=i.shift()),!e&&o.test(i[0])&&(e=r,r=i.shift()),i[0].startsWith("-")){let a=i[0],s=`option creation failed due to '${a}' in option flags '${t}'`;throw/^-[^-][^-]/.test(a)?new Error(`${s}
7
7
  - a short flag is a single dash and a single character
8
8
  - either use a single dash and a single character (for a short flag)
9
9
  - or use a double dash for a long option (and can have two, like '--ws, --workspace')`):n.test(a)?new Error(`${s}
10
10
  - too many short flags`):o.test(a)?new Error(`${s}
11
11
  - too many long flags`):new Error(`${s}
12
- - unrecognised flag format`)}if(e===void 0&&r===void 0)throw new Error(`option creation failed due to no flags found in '${t}'.`);return{shortFlag:e,longFlag:r}}df.Option=ff;df.DualOptions=pf});var aD=x(iD=>{function lA(t,e){if(Math.abs(t.length-e.length)>3)return Math.max(t.length,e.length);let r=[];for(let n=0;n<=t.length;n++)r[n]=[n];for(let n=0;n<=e.length;n++)r[0][n]=n;for(let n=1;n<=e.length;n++)for(let o=1;o<=t.length;o++){let i=1;t[o-1]===e[n-1]?i=0:i=1,r[o][n]=Math.min(r[o-1][n]+1,r[o][n-1]+1,r[o-1][n-1]+i),o>1&&n>1&&t[o-1]===e[n-2]&&t[o-2]===e[n-1]&&(r[o][n]=Math.min(r[o][n],r[o-2][n-2]+1))}return r[t.length][e.length]}function fA(t,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let r=t.startsWith("--");r&&(t=t.slice(2),e=e.map(a=>a.slice(2)));let n=[],o=3,i=.4;return e.forEach(a=>{if(a.length<=1)return;let s=lA(t,a),u=Math.max(t.length,a.length);(u-s)/u>i&&(s<o?(o=s,n=[a]):s===o&&n.push(a))}),n.sort((a,s)=>a.localeCompare(s)),r&&(n=n.map(a=>`--${a}`)),n.length>1?`
12
+ - unrecognised flag format`)}if(e===void 0&&r===void 0)throw new Error(`option creation failed due to no flags found in '${t}'.`);return{shortFlag:e,longFlag:r}}gf.Option=hf;gf.DualOptions=mf});var cD=x(uD=>{function hA(t,e){if(Math.abs(t.length-e.length)>3)return Math.max(t.length,e.length);let r=[];for(let n=0;n<=t.length;n++)r[n]=[n];for(let n=0;n<=e.length;n++)r[0][n]=n;for(let n=1;n<=e.length;n++)for(let o=1;o<=t.length;o++){let i=1;t[o-1]===e[n-1]?i=0:i=1,r[o][n]=Math.min(r[o-1][n]+1,r[o][n-1]+1,r[o-1][n-1]+i),o>1&&n>1&&t[o-1]===e[n-2]&&t[o-2]===e[n-1]&&(r[o][n]=Math.min(r[o][n],r[o-2][n-2]+1))}return r[t.length][e.length]}function mA(t,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let r=t.startsWith("--");r&&(t=t.slice(2),e=e.map(a=>a.slice(2)));let n=[],o=3,i=.4;return e.forEach(a=>{if(a.length<=1)return;let s=hA(t,a),u=Math.max(t.length,a.length);(u-s)/u>i&&(s<o?(o=s,n=[a]):s===o&&n.push(a))}),n.sort((a,s)=>a.localeCompare(s)),r&&(n=n.map(a=>`--${a}`)),n.length>1?`
13
13
  (Did you mean one of ${n.join(", ")}?)`:n.length===1?`
14
- (Did you mean ${n[0]}?)`:""}iD.suggestSimilar=fA});var lD=x(bf=>{var pA=require("node:events").EventEmitter,mf=require("node:child_process"),Hr=require("node:path"),Ls=require("node:fs"),ve=require("node:process"),{Argument:dA,humanReadableArgName:hA}=Ns(),{CommanderError:gf}=ca(),{Help:mA,stripColor:gA}=lf(),{Option:sD,DualOptions:DA}=hf(),{suggestSimilar:uD}=aD(),Df=class t extends pA{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:r=>ve.stdout.write(r),writeErr:r=>ve.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>ve.stdout.isTTY?ve.stdout.columns:void 0,getErrHelpWidth:()=>ve.stderr.isTTY?ve.stderr.columns:void 0,getOutHasColors:()=>yf()??(ve.stdout.isTTY&&ve.stdout.hasColors?.()),getErrHasColors:()=>yf()??(ve.stderr.isTTY&&ve.stderr.hasColors?.()),stripColor:r=>gA(r)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let r=this;r;r=r.parent)e.push(r);return e}command(e,r,n){let o=r,i=n;typeof o=="object"&&o!==null&&(i=o,o=null),i=i||{};let[,a,s]=e.match(/([^ ]+) *(.*)/),u=this.createCommand(a);return o&&(u.description(o),u._executableHandler=!0),i.isDefault&&(this._defaultCommandName=u._name),u._hidden=!!(i.noHelp||i.hidden),u._executableFile=i.executableFile||null,s&&u.arguments(s),this._registerCommand(u),u.parent=this,u.copyInheritedSettings(this),o?this:u}createCommand(e){return new t(e)}createHelp(){return Object.assign(new mA,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...e},this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,r){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name
15
- - specify the name in Command constructor or using .name()`);return r=r||{},r.isDefault&&(this._defaultCommandName=e._name),(r.noHelp||r.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,r){return new dA(e,r)}argument(e,r,n,o){let i=this.createArgument(e,r);return typeof n=="function"?i.default(o).argParser(n):i.default(n),this.addArgument(i),this}arguments(e){return e.trim().split(/ +/).forEach(r=>{this.argument(r)}),this}addArgument(e){let r=this.registeredArguments.slice(-1)[0];if(r?.variadic)throw new Error(`only the last argument can be variadic '${r.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,r){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,e&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let n=e??"help [command]",[,o,i]=n.match(/([^ ]+) *(.*)/),a=r??"display help for command",s=this.createCommand(o);return s.helpOption(!1),i&&s.arguments(i),a&&s.description(a),this._addImplicitHelpCommand=!0,this._helpCommand=s,(e||r)&&this._initCommandGroup(s),this}addHelpCommand(e,r){return typeof e!="object"?(this.helpCommand(e,r),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this._initCommandGroup(e),this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,r){let n=["preSubcommand","preAction","postAction"];if(!n.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
16
- Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(r):this._lifeCycleHooks[e]=[r],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=r=>{if(r.code!=="commander.executeSubCommandAsync")throw r},this}_exit(e,r,n){this._exitCallback&&this._exitCallback(new gf(e,r,n)),ve.exit(e)}action(e){let r=n=>{let o=this.registeredArguments.length,i=n.slice(0,o);return this._storeOptionsAsProperties?i[o]=this:i[o]=this.opts(),i.push(this),e.apply(this,i)};return this._actionHandler=r,this}createOption(e,r){return new sD(e,r)}_callParseArg(e,r,n,o){try{return e.parseArg(r,n)}catch(i){if(i.code==="commander.invalidArgument"){let a=`${o} ${i.message}`;this.error(a,{exitCode:i.exitCode,code:i.code})}throw i}}_registerOption(e){let r=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(r){let n=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}'
17
- - already used by option '${r.flags}'`)}this._initOptionGroup(e),this.options.push(e)}_registerCommand(e){let r=o=>[o.name()].concat(o.aliases()),n=r(e).find(o=>this._findCommand(o));if(n){let o=r(this._findCommand(n)).join("|"),i=r(e).join("|");throw new Error(`cannot add command '${i}' as already have command '${o}'`)}this._initCommandGroup(e),this.commands.push(e)}addOption(e){this._registerOption(e);let r=e.name(),n=e.attributeName();if(e.negate){let i=e.long.replace(/^--no-/,"--");this._findOption(i)||this.setOptionValueWithSource(n,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,"default");let o=(i,a,s)=>{i==null&&e.presetArg!==void 0&&(i=e.presetArg);let u=this.getOptionValue(n);i!==null&&e.parseArg?i=this._callParseArg(e,i,u,a):i!==null&&e.variadic&&(i=e._collectValue(i,u)),i==null&&(e.negate?i=!1:e.isBoolean()||e.optional?i=!0:i=""),this.setOptionValueWithSource(n,i,s)};return this.on("option:"+r,i=>{let a=`error: option '${e.flags}' argument '${i}' is invalid.`;o(i,a,"cli")}),e.envVar&&this.on("optionEnv:"+r,i=>{let a=`error: option '${e.flags}' value '${i}' from env '${e.envVar}' is invalid.`;o(i,a,"env")}),this}_optionEx(e,r,n,o,i){if(typeof r=="object"&&r instanceof sD)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let a=this.createOption(r,n);if(a.makeOptionMandatory(!!e.mandatory),typeof o=="function")a.default(i).argParser(o);else if(o instanceof RegExp){let s=o;o=(u,c)=>{let l=s.exec(u);return l?l[0]:c},a.default(i).argParser(o)}else a.default(o);return this.addOption(a)}option(e,r,n,o){return this._optionEx({},e,r,n,o)}requiredOption(e,r,n,o){return this._optionEx({mandatory:!0},e,r,n,o)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,r){return this.setOptionValueWithSource(e,r,void 0)}setOptionValueWithSource(e,r,n){return this._storeOptionsAsProperties?this[e]=r:this._optionValues[e]=r,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let r;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(r=n.getOptionValueSource(e))}),r}_prepareUserArgs(e,r){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(r=r||{},e===void 0&&r.from===void 0){ve.versions?.electron&&(r.from="electron");let o=ve.execArgv??[];(o.includes("-e")||o.includes("--eval")||o.includes("-p")||o.includes("--print"))&&(r.from="eval")}e===void 0&&(e=ve.argv),this.rawArgs=e.slice();let n;switch(r.from){case void 0:case"node":this._scriptPath=e[1],n=e.slice(2);break;case"electron":ve.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case"user":n=e.slice(0);break;case"eval":n=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${r.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(e,r){this._prepareForParse();let n=this._prepareUserArgs(e,r);return this._parseCommand([],n),this}async parseAsync(e,r){this._prepareForParse();let n=this._prepareUserArgs(e,r);return await this._parseCommand([],n),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
18
- - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(e,r,n){if(Ls.existsSync(e))return;let o=r?`searched for local subcommand relative to directory '${r}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",i=`'${e}' does not exist
14
+ (Did you mean ${n[0]}?)`:""}uD.suggestSimilar=mA});var dD=x(Cf=>{var gA=require("node:events").EventEmitter,yf=require("node:child_process"),Hr=require("node:path"),qs=require("node:fs"),we=require("node:process"),{Argument:DA,humanReadableArgName:yA}=Ms(),{CommanderError:bf}=pa(),{Help:bA,stripColor:wA}=df(),{Option:lD,DualOptions:vA}=Df(),{suggestSimilar:fD}=cD(),wf=class t extends gA{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:r=>we.stdout.write(r),writeErr:r=>we.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>we.stdout.isTTY?we.stdout.columns:void 0,getErrHelpWidth:()=>we.stderr.isTTY?we.stderr.columns:void 0,getOutHasColors:()=>vf()??(we.stdout.isTTY&&we.stdout.hasColors?.()),getErrHasColors:()=>vf()??(we.stderr.isTTY&&we.stderr.hasColors?.()),stripColor:r=>wA(r)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let r=this;r;r=r.parent)e.push(r);return e}command(e,r,n){let o=r,i=n;typeof o=="object"&&o!==null&&(i=o,o=null),i=i||{};let[,a,s]=e.match(/([^ ]+) *(.*)/),u=this.createCommand(a);return o&&(u.description(o),u._executableHandler=!0),i.isDefault&&(this._defaultCommandName=u._name),u._hidden=!!(i.noHelp||i.hidden),u._executableFile=i.executableFile||null,s&&u.arguments(s),this._registerCommand(u),u.parent=this,u.copyInheritedSettings(this),o?this:u}createCommand(e){return new t(e)}createHelp(){return Object.assign(new bA,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...e},this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,r){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name
15
+ - specify the name in Command constructor or using .name()`);return r=r||{},r.isDefault&&(this._defaultCommandName=e._name),(r.noHelp||r.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,r){return new DA(e,r)}argument(e,r,n,o){let i=this.createArgument(e,r);return typeof n=="function"?i.default(o).argParser(n):i.default(n),this.addArgument(i),this}arguments(e){return e.trim().split(/ +/).forEach(r=>{this.argument(r)}),this}addArgument(e){let r=this.registeredArguments.slice(-1)[0];if(r?.variadic)throw new Error(`only the last argument can be variadic '${r.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,r){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,e&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let n=e??"help [command]",[,o,i]=n.match(/([^ ]+) *(.*)/),a=r??"display help for command",s=this.createCommand(o);return s.helpOption(!1),i&&s.arguments(i),a&&s.description(a),this._addImplicitHelpCommand=!0,this._helpCommand=s,(e||r)&&this._initCommandGroup(s),this}addHelpCommand(e,r){return typeof e!="object"?(this.helpCommand(e,r),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this._initCommandGroup(e),this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,r){let n=["preSubcommand","preAction","postAction"];if(!n.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
16
+ Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(r):this._lifeCycleHooks[e]=[r],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=r=>{if(r.code!=="commander.executeSubCommandAsync")throw r},this}_exit(e,r,n){this._exitCallback&&this._exitCallback(new bf(e,r,n)),we.exit(e)}action(e){let r=n=>{let o=this.registeredArguments.length,i=n.slice(0,o);return this._storeOptionsAsProperties?i[o]=this:i[o]=this.opts(),i.push(this),e.apply(this,i)};return this._actionHandler=r,this}createOption(e,r){return new lD(e,r)}_callParseArg(e,r,n,o){try{return e.parseArg(r,n)}catch(i){if(i.code==="commander.invalidArgument"){let a=`${o} ${i.message}`;this.error(a,{exitCode:i.exitCode,code:i.code})}throw i}}_registerOption(e){let r=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(r){let n=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}'
17
+ - already used by option '${r.flags}'`)}this._initOptionGroup(e),this.options.push(e)}_registerCommand(e){let r=o=>[o.name()].concat(o.aliases()),n=r(e).find(o=>this._findCommand(o));if(n){let o=r(this._findCommand(n)).join("|"),i=r(e).join("|");throw new Error(`cannot add command '${i}' as already have command '${o}'`)}this._initCommandGroup(e),this.commands.push(e)}addOption(e){this._registerOption(e);let r=e.name(),n=e.attributeName();if(e.negate){let i=e.long.replace(/^--no-/,"--");this._findOption(i)||this.setOptionValueWithSource(n,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,"default");let o=(i,a,s)=>{i==null&&e.presetArg!==void 0&&(i=e.presetArg);let u=this.getOptionValue(n);i!==null&&e.parseArg?i=this._callParseArg(e,i,u,a):i!==null&&e.variadic&&(i=e._collectValue(i,u)),i==null&&(e.negate?i=!1:e.isBoolean()||e.optional?i=!0:i=""),this.setOptionValueWithSource(n,i,s)};return this.on("option:"+r,i=>{let a=`error: option '${e.flags}' argument '${i}' is invalid.`;o(i,a,"cli")}),e.envVar&&this.on("optionEnv:"+r,i=>{let a=`error: option '${e.flags}' value '${i}' from env '${e.envVar}' is invalid.`;o(i,a,"env")}),this}_optionEx(e,r,n,o,i){if(typeof r=="object"&&r instanceof lD)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let a=this.createOption(r,n);if(a.makeOptionMandatory(!!e.mandatory),typeof o=="function")a.default(i).argParser(o);else if(o instanceof RegExp){let s=o;o=(u,c)=>{let l=s.exec(u);return l?l[0]:c},a.default(i).argParser(o)}else a.default(o);return this.addOption(a)}option(e,r,n,o){return this._optionEx({},e,r,n,o)}requiredOption(e,r,n,o){return this._optionEx({mandatory:!0},e,r,n,o)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,r){return this.setOptionValueWithSource(e,r,void 0)}setOptionValueWithSource(e,r,n){return this._storeOptionsAsProperties?this[e]=r:this._optionValues[e]=r,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let r;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(r=n.getOptionValueSource(e))}),r}_prepareUserArgs(e,r){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(r=r||{},e===void 0&&r.from===void 0){we.versions?.electron&&(r.from="electron");let o=we.execArgv??[];(o.includes("-e")||o.includes("--eval")||o.includes("-p")||o.includes("--print"))&&(r.from="eval")}e===void 0&&(e=we.argv),this.rawArgs=e.slice();let n;switch(r.from){case void 0:case"node":this._scriptPath=e[1],n=e.slice(2);break;case"electron":we.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case"user":n=e.slice(0);break;case"eval":n=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${r.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(e,r){this._prepareForParse();let n=this._prepareUserArgs(e,r);return this._parseCommand([],n),this}async parseAsync(e,r){this._prepareForParse();let n=this._prepareUserArgs(e,r);return await this._parseCommand([],n),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
18
+ - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(e,r,n){if(qs.existsSync(e))return;let o=r?`searched for local subcommand relative to directory '${r}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",i=`'${e}' does not exist
19
19
  - if '${n}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
20
20
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
21
- - ${o}`;throw new Error(i)}_executeSubCommand(e,r){r=r.slice();let n=!1,o=[".js",".ts",".tsx",".mjs",".cjs"];function i(l,f){let d=Hr.resolve(l,f);if(Ls.existsSync(d))return d;if(o.includes(Hr.extname(f)))return;let h=o.find(m=>Ls.existsSync(`${d}${m}`));if(h)return`${d}${h}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let a=e._executableFile||`${this._name}-${e._name}`,s=this._executableDir||"";if(this._scriptPath){let l;try{l=Ls.realpathSync(this._scriptPath)}catch{l=this._scriptPath}s=Hr.resolve(Hr.dirname(l),s)}if(s){let l=i(s,a);if(!l&&!e._executableFile&&this._scriptPath){let f=Hr.basename(this._scriptPath,Hr.extname(this._scriptPath));f!==this._name&&(l=i(s,`${f}-${e._name}`))}a=l||a}n=o.includes(Hr.extname(a));let u;ve.platform!=="win32"?n?(r.unshift(a),r=cD(ve.execArgv).concat(r),u=mf.spawn(ve.argv[0],r,{stdio:"inherit"})):u=mf.spawn(a,r,{stdio:"inherit"}):(this._checkForMissingExecutable(a,s,e._name),r.unshift(a),r=cD(ve.execArgv).concat(r),u=mf.spawn(ve.execPath,r,{stdio:"inherit"})),u.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(f=>{ve.on(f,()=>{u.killed===!1&&u.exitCode===null&&u.kill(f)})});let c=this._exitCallback;u.on("close",l=>{l=l??1,c?c(new gf(l,"commander.executeSubCommandAsync","(close)")):ve.exit(l)}),u.on("error",l=>{if(l.code==="ENOENT")this._checkForMissingExecutable(a,s,e._name);else if(l.code==="EACCES")throw new Error(`'${a}' not executable`);if(!c)ve.exit(1);else{let f=new gf(1,"commander.executeSubCommandAsync","(error)");f.nestedError=l,c(f)}}),this.runningCommand=u}_dispatchSubcommand(e,r,n){let o=this._findCommand(e);o||this.help({error:!0}),o._prepareForParse();let i;return i=this._chainOrCallSubCommandHook(i,o,"preSubcommand"),i=this._chainOrCall(i,()=>{if(o._executableHandler)this._executeSubCommand(o,r.concat(n));else return o._parseCommand(r,n)}),i}_dispatchHelpCommand(e){e||this.help();let r=this._findCommand(e);return r&&!r._executableHandler&&r.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,r)=>{e.required&&this.args[r]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(n,o,i)=>{let a=o;if(o!==null&&n.parseArg){let s=`error: command-argument value '${o}' is invalid for argument '${n.name()}'.`;a=this._callParseArg(n,o,i,s)}return a};this._checkNumberOfArguments();let r=[];this.registeredArguments.forEach((n,o)=>{let i=n.defaultValue;n.variadic?o<this.args.length?(i=this.args.slice(o),n.parseArg&&(i=i.reduce((a,s)=>e(n,s,a),n.defaultValue))):i===void 0&&(i=[]):o<this.args.length&&(i=this.args[o],n.parseArg&&(i=e(n,i,n.defaultValue))),r[o]=i}),this.processedArgs=r}_chainOrCall(e,r){return e?.then&&typeof e.then=="function"?e.then(()=>r()):r()}_chainOrCallHooks(e,r){let n=e,o=[];return this._getCommandAndAncestors().reverse().filter(i=>i._lifeCycleHooks[r]!==void 0).forEach(i=>{i._lifeCycleHooks[r].forEach(a=>{o.push({hookedCommand:i,callback:a})})}),r==="postAction"&&o.reverse(),o.forEach(i=>{n=this._chainOrCall(n,()=>i.callback(i.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,r,n){let o=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(i=>{o=this._chainOrCall(o,()=>i(this,r))}),o}_parseCommand(e,r){let n=this.parseOptions(r);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),r=n.unknown,this.args=e.concat(r),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),r);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(r),this._dispatchSubcommand(this._defaultCommandName,e,r);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},i=`command:${this.name()}`;if(this._actionHandler){o(),this._processArguments();let a;return a=this._chainOrCallHooks(a,"preAction"),a=this._chainOrCall(a,()=>this._actionHandler(this.processedArgs)),this.parent&&(a=this._chainOrCall(a,()=>{this.parent.emit(i,e,r)})),a=this._chainOrCallHooks(a,"postAction"),a}if(this.parent?.listenerCount(i))o(),this._processArguments(),this.parent.emit(i,e,r);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,r);this.listenerCount("command:*")?this.emit("command:*",e,r):this.commands.length?this.unknownCommand():(o(),this._processArguments())}else this.commands.length?(o(),this.help({error:!0})):(o(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(r=>r._name===e||r._aliases.includes(e))}_findOption(e){return this.options.find(r=>r.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(r=>{r.mandatory&&e.getOptionValue(r.attributeName())===void 0&&e.missingMandatoryOptionValue(r)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(n=>{let o=n.attributeName();return this.getOptionValue(o)===void 0?!1:this.getOptionValueSource(o)!=="default"});e.filter(n=>n.conflictsWith.length>0).forEach(n=>{let o=e.find(i=>n.conflictsWith.includes(i.attributeName()));o&&this._conflictingOption(n,o)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let r=[],n=[],o=r;function i(l){return l.length>1&&l[0]==="-"}let a=l=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(l)?!this._getCommandAndAncestors().some(f=>f.options.map(d=>d.short).some(d=>/^-\d$/.test(d))):!1,s=null,u=null,c=0;for(;c<e.length||u;){let l=u??e[c++];if(u=null,l==="--"){o===n&&o.push(l),o.push(...e.slice(c));break}if(s&&(!i(l)||a(l))){this.emit(`option:${s.name()}`,l);continue}if(s=null,i(l)){let f=this._findOption(l);if(f){if(f.required){let d=e[c++];d===void 0&&this.optionMissingArgument(f),this.emit(`option:${f.name()}`,d)}else if(f.optional){let d=null;c<e.length&&(!i(e[c])||a(e[c]))&&(d=e[c++]),this.emit(`option:${f.name()}`,d)}else this.emit(`option:${f.name()}`);s=f.variadic?f:null;continue}}if(l.length>2&&l[0]==="-"&&l[1]!=="-"){let f=this._findOption(`-${l[1]}`);if(f){f.required||f.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${f.name()}`,l.slice(2)):(this.emit(`option:${f.name()}`),u=`-${l.slice(2)}`);continue}}if(/^--[^=]+=/.test(l)){let f=l.indexOf("="),d=this._findOption(l.slice(0,f));if(d&&(d.required||d.optional)){this.emit(`option:${d.name()}`,l.slice(f+1));continue}}if(o===r&&i(l)&&!(this.commands.length===0&&a(l))&&(o=n),(this._enablePositionalOptions||this._passThroughOptions)&&r.length===0&&n.length===0){if(this._findCommand(l)){r.push(l),n.push(...e.slice(c));break}else if(this._getHelpCommand()&&l===this._getHelpCommand().name()){r.push(l,...e.slice(c));break}else if(this._defaultCommandName){n.push(l,...e.slice(c));break}}if(this._passThroughOptions){o.push(l,...e.slice(c));break}o.push(l)}return{operands:r,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},r=this.options.length;for(let n=0;n<r;n++){let o=this.options[n].attributeName();e[o]=o===this._versionOptionName?this._version:this[o]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,r)=>Object.assign(e,r.opts()),{})}error(e,r){this._outputConfiguration.outputError(`${e}
21
+ - ${o}`;throw new Error(i)}_executeSubCommand(e,r){r=r.slice();let n=!1,o=[".js",".ts",".tsx",".mjs",".cjs"];function i(l,p){let d=Hr.resolve(l,p);if(qs.existsSync(d))return d;if(o.includes(Hr.extname(p)))return;let h=o.find(m=>qs.existsSync(`${d}${m}`));if(h)return`${d}${h}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let a=e._executableFile||`${this._name}-${e._name}`,s=this._executableDir||"";if(this._scriptPath){let l;try{l=qs.realpathSync(this._scriptPath)}catch{l=this._scriptPath}s=Hr.resolve(Hr.dirname(l),s)}if(s){let l=i(s,a);if(!l&&!e._executableFile&&this._scriptPath){let p=Hr.basename(this._scriptPath,Hr.extname(this._scriptPath));p!==this._name&&(l=i(s,`${p}-${e._name}`))}a=l||a}n=o.includes(Hr.extname(a));let u;we.platform!=="win32"?n?(r.unshift(a),r=pD(we.execArgv).concat(r),u=yf.spawn(we.argv[0],r,{stdio:"inherit"})):u=yf.spawn(a,r,{stdio:"inherit"}):(this._checkForMissingExecutable(a,s,e._name),r.unshift(a),r=pD(we.execArgv).concat(r),u=yf.spawn(we.execPath,r,{stdio:"inherit"})),u.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(p=>{we.on(p,()=>{u.killed===!1&&u.exitCode===null&&u.kill(p)})});let c=this._exitCallback;u.on("close",l=>{l=l??1,c?c(new bf(l,"commander.executeSubCommandAsync","(close)")):we.exit(l)}),u.on("error",l=>{if(l.code==="ENOENT")this._checkForMissingExecutable(a,s,e._name);else if(l.code==="EACCES")throw new Error(`'${a}' not executable`);if(!c)we.exit(1);else{let p=new bf(1,"commander.executeSubCommandAsync","(error)");p.nestedError=l,c(p)}}),this.runningCommand=u}_dispatchSubcommand(e,r,n){let o=this._findCommand(e);o||this.help({error:!0}),o._prepareForParse();let i;return i=this._chainOrCallSubCommandHook(i,o,"preSubcommand"),i=this._chainOrCall(i,()=>{if(o._executableHandler)this._executeSubCommand(o,r.concat(n));else return o._parseCommand(r,n)}),i}_dispatchHelpCommand(e){e||this.help();let r=this._findCommand(e);return r&&!r._executableHandler&&r.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,r)=>{e.required&&this.args[r]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(n,o,i)=>{let a=o;if(o!==null&&n.parseArg){let s=`error: command-argument value '${o}' is invalid for argument '${n.name()}'.`;a=this._callParseArg(n,o,i,s)}return a};this._checkNumberOfArguments();let r=[];this.registeredArguments.forEach((n,o)=>{let i=n.defaultValue;n.variadic?o<this.args.length?(i=this.args.slice(o),n.parseArg&&(i=i.reduce((a,s)=>e(n,s,a),n.defaultValue))):i===void 0&&(i=[]):o<this.args.length&&(i=this.args[o],n.parseArg&&(i=e(n,i,n.defaultValue))),r[o]=i}),this.processedArgs=r}_chainOrCall(e,r){return e?.then&&typeof e.then=="function"?e.then(()=>r()):r()}_chainOrCallHooks(e,r){let n=e,o=[];return this._getCommandAndAncestors().reverse().filter(i=>i._lifeCycleHooks[r]!==void 0).forEach(i=>{i._lifeCycleHooks[r].forEach(a=>{o.push({hookedCommand:i,callback:a})})}),r==="postAction"&&o.reverse(),o.forEach(i=>{n=this._chainOrCall(n,()=>i.callback(i.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,r,n){let o=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(i=>{o=this._chainOrCall(o,()=>i(this,r))}),o}_parseCommand(e,r){let n=this.parseOptions(r);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),r=n.unknown,this.args=e.concat(r),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),r);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(r),this._dispatchSubcommand(this._defaultCommandName,e,r);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},i=`command:${this.name()}`;if(this._actionHandler){o(),this._processArguments();let a;return a=this._chainOrCallHooks(a,"preAction"),a=this._chainOrCall(a,()=>this._actionHandler(this.processedArgs)),this.parent&&(a=this._chainOrCall(a,()=>{this.parent.emit(i,e,r)})),a=this._chainOrCallHooks(a,"postAction"),a}if(this.parent?.listenerCount(i))o(),this._processArguments(),this.parent.emit(i,e,r);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,r);this.listenerCount("command:*")?this.emit("command:*",e,r):this.commands.length?this.unknownCommand():(o(),this._processArguments())}else this.commands.length?(o(),this.help({error:!0})):(o(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(r=>r._name===e||r._aliases.includes(e))}_findOption(e){return this.options.find(r=>r.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(r=>{r.mandatory&&e.getOptionValue(r.attributeName())===void 0&&e.missingMandatoryOptionValue(r)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(n=>{let o=n.attributeName();return this.getOptionValue(o)===void 0?!1:this.getOptionValueSource(o)!=="default"});e.filter(n=>n.conflictsWith.length>0).forEach(n=>{let o=e.find(i=>n.conflictsWith.includes(i.attributeName()));o&&this._conflictingOption(n,o)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let r=[],n=[],o=r;function i(l){return l.length>1&&l[0]==="-"}let a=l=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(l)?!this._getCommandAndAncestors().some(p=>p.options.map(d=>d.short).some(d=>/^-\d$/.test(d))):!1,s=null,u=null,c=0;for(;c<e.length||u;){let l=u??e[c++];if(u=null,l==="--"){o===n&&o.push(l),o.push(...e.slice(c));break}if(s&&(!i(l)||a(l))){this.emit(`option:${s.name()}`,l);continue}if(s=null,i(l)){let p=this._findOption(l);if(p){if(p.required){let d=e[c++];d===void 0&&this.optionMissingArgument(p),this.emit(`option:${p.name()}`,d)}else if(p.optional){let d=null;c<e.length&&(!i(e[c])||a(e[c]))&&(d=e[c++]),this.emit(`option:${p.name()}`,d)}else this.emit(`option:${p.name()}`);s=p.variadic?p:null;continue}}if(l.length>2&&l[0]==="-"&&l[1]!=="-"){let p=this._findOption(`-${l[1]}`);if(p){p.required||p.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${p.name()}`,l.slice(2)):(this.emit(`option:${p.name()}`),u=`-${l.slice(2)}`);continue}}if(/^--[^=]+=/.test(l)){let p=l.indexOf("="),d=this._findOption(l.slice(0,p));if(d&&(d.required||d.optional)){this.emit(`option:${d.name()}`,l.slice(p+1));continue}}if(o===r&&i(l)&&!(this.commands.length===0&&a(l))&&(o=n),(this._enablePositionalOptions||this._passThroughOptions)&&r.length===0&&n.length===0){if(this._findCommand(l)){r.push(l),n.push(...e.slice(c));break}else if(this._getHelpCommand()&&l===this._getHelpCommand().name()){r.push(l,...e.slice(c));break}else if(this._defaultCommandName){n.push(l,...e.slice(c));break}}if(this._passThroughOptions){o.push(l,...e.slice(c));break}o.push(l)}return{operands:r,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},r=this.options.length;for(let n=0;n<r;n++){let o=this.options[n].attributeName();e[o]=o===this._versionOptionName?this._version:this[o]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,r)=>Object.assign(e,r.opts()),{})}error(e,r){this._outputConfiguration.outputError(`${e}
22
22
  `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
23
23
  `):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
24
- `),this.outputHelp({error:!0}));let n=r||{},o=n.exitCode||1,i=n.code||"commander.error";this._exit(o,i,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in ve.env){let r=e.attributeName();(this.getOptionValue(r)===void 0||["default","config","env"].includes(this.getOptionValueSource(r)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,ve.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new DA(this.options),r=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&r(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(o=>!r(o)).forEach(o=>{this.setOptionValueWithSource(o,n.implied[o],"implied")})})}missingArgument(e){let r=`error: missing required argument '${e}'`;this.error(r,{code:"commander.missingArgument"})}optionMissingArgument(e){let r=`error: option '${e.flags}' argument missing`;this.error(r,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let r=`error: required option '${e.flags}' not specified`;this.error(r,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,r){let n=a=>{let s=a.attributeName(),u=this.getOptionValue(s),c=this.options.find(f=>f.negate&&s===f.attributeName()),l=this.options.find(f=>!f.negate&&s===f.attributeName());return c&&(c.presetArg===void 0&&u===!1||c.presetArg!==void 0&&u===c.presetArg)?c:l||a},o=a=>{let s=n(a),u=s.attributeName();return this.getOptionValueSource(u)==="env"?`environment variable '${s.envVar}'`:`option '${s.flags}'`},i=`error: ${o(e)} cannot be used with ${o(r)}`;this.error(i,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let r="";if(e.startsWith("--")&&this._showSuggestionAfterError){let o=[],i=this;do{let a=i.createHelp().visibleOptions(i).filter(s=>s.long).map(s=>s.long);o=o.concat(a),i=i.parent}while(i&&!i._enablePositionalOptions);r=uD(e,o)}let n=`error: unknown option '${e}'${r}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let r=this.registeredArguments.length,n=r===1?"":"s",i=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${r} argument${n} but got ${e.length}.`;this.error(i,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],r="";if(this._showSuggestionAfterError){let o=[];this.createHelp().visibleCommands(this).forEach(i=>{o.push(i.name()),i.alias()&&o.push(i.alias())}),r=uD(e,o)}let n=`error: unknown command '${e}'${r}`;this.error(n,{code:"commander.unknownCommand"})}version(e,r,n){if(e===void 0)return this._version;this._version=e,r=r||"-V, --version",n=n||"output the version number";let o=this.createOption(r,n);return this._versionOptionName=o.attributeName(),this._registerOption(o),this.on("option:"+o.name(),()=>{this._outputConfiguration.writeOut(`${e}
25
- `),this._exit(0,"commander.version",e)}),this}description(e,r){return e===void 0&&r===void 0?this._description:(this._description=e,r&&(this._argsDescription=r),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let r=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(r=this.commands[this.commands.length-1]),e===r._name)throw new Error("Command alias can't be the same as its name");let n=this.parent?._findCommand(e);if(n){let o=[n.name()].concat(n.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${o}'`)}return r._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(r=>this.alias(r)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let r=this.registeredArguments.map(n=>hA(n));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?r:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=Hr.basename(e,Hr.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let r=this.createHelp(),n=this._getOutputContext(e);r.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let o=r.formatHelp(this,r);return n.hasColors?o:this._outputConfiguration.stripColor(o)}_getOutputContext(e){e=e||{};let r=!!e.error,n,o,i;return r?(n=s=>this._outputConfiguration.writeErr(s),o=this._outputConfiguration.getErrHasColors(),i=this._outputConfiguration.getErrHelpWidth()):(n=s=>this._outputConfiguration.writeOut(s),o=this._outputConfiguration.getOutHasColors(),i=this._outputConfiguration.getOutHelpWidth()),{error:r,write:s=>(o||(s=this._outputConfiguration.stripColor(s)),n(s)),hasColors:o,helpWidth:i}}outputHelp(e){let r;typeof e=="function"&&(r=e,e=void 0);let n=this._getOutputContext(e),o={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(a=>a.emit("beforeAllHelp",o)),this.emit("beforeHelp",o);let i=this.helpInformation({error:n.error});if(r&&(i=r(i),typeof i!="string"&&!Buffer.isBuffer(i)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(i),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",o),this._getCommandAndAncestors().forEach(a=>a.emit("afterAllHelp",o))}helpOption(e,r){return typeof e=="boolean"?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??"-h, --help",r??"display help for command"),(e||r)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let r=Number(ve.exitCode??0);r===0&&e&&typeof e!="function"&&e.error&&(r=1),this._exit(r,"commander.help","(outputHelp)")}addHelpText(e,r){let n=["beforeAll","before","after","afterAll"];if(!n.includes(e))throw new Error(`Unexpected value for position to addHelpText.
24
+ `),this.outputHelp({error:!0}));let n=r||{},o=n.exitCode||1,i=n.code||"commander.error";this._exit(o,i,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in we.env){let r=e.attributeName();(this.getOptionValue(r)===void 0||["default","config","env"].includes(this.getOptionValueSource(r)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,we.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new vA(this.options),r=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&r(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(o=>!r(o)).forEach(o=>{this.setOptionValueWithSource(o,n.implied[o],"implied")})})}missingArgument(e){let r=`error: missing required argument '${e}'`;this.error(r,{code:"commander.missingArgument"})}optionMissingArgument(e){let r=`error: option '${e.flags}' argument missing`;this.error(r,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let r=`error: required option '${e.flags}' not specified`;this.error(r,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,r){let n=a=>{let s=a.attributeName(),u=this.getOptionValue(s),c=this.options.find(p=>p.negate&&s===p.attributeName()),l=this.options.find(p=>!p.negate&&s===p.attributeName());return c&&(c.presetArg===void 0&&u===!1||c.presetArg!==void 0&&u===c.presetArg)?c:l||a},o=a=>{let s=n(a),u=s.attributeName();return this.getOptionValueSource(u)==="env"?`environment variable '${s.envVar}'`:`option '${s.flags}'`},i=`error: ${o(e)} cannot be used with ${o(r)}`;this.error(i,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let r="";if(e.startsWith("--")&&this._showSuggestionAfterError){let o=[],i=this;do{let a=i.createHelp().visibleOptions(i).filter(s=>s.long).map(s=>s.long);o=o.concat(a),i=i.parent}while(i&&!i._enablePositionalOptions);r=fD(e,o)}let n=`error: unknown option '${e}'${r}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let r=this.registeredArguments.length,n=r===1?"":"s",i=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${r} argument${n} but got ${e.length}.`;this.error(i,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],r="";if(this._showSuggestionAfterError){let o=[];this.createHelp().visibleCommands(this).forEach(i=>{o.push(i.name()),i.alias()&&o.push(i.alias())}),r=fD(e,o)}let n=`error: unknown command '${e}'${r}`;this.error(n,{code:"commander.unknownCommand"})}version(e,r,n){if(e===void 0)return this._version;this._version=e,r=r||"-V, --version",n=n||"output the version number";let o=this.createOption(r,n);return this._versionOptionName=o.attributeName(),this._registerOption(o),this.on("option:"+o.name(),()=>{this._outputConfiguration.writeOut(`${e}
25
+ `),this._exit(0,"commander.version",e)}),this}description(e,r){return e===void 0&&r===void 0?this._description:(this._description=e,r&&(this._argsDescription=r),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let r=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(r=this.commands[this.commands.length-1]),e===r._name)throw new Error("Command alias can't be the same as its name");let n=this.parent?._findCommand(e);if(n){let o=[n.name()].concat(n.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${o}'`)}return r._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(r=>this.alias(r)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let r=this.registeredArguments.map(n=>yA(n));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?r:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=Hr.basename(e,Hr.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let r=this.createHelp(),n=this._getOutputContext(e);r.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let o=r.formatHelp(this,r);return n.hasColors?o:this._outputConfiguration.stripColor(o)}_getOutputContext(e){e=e||{};let r=!!e.error,n,o,i;return r?(n=s=>this._outputConfiguration.writeErr(s),o=this._outputConfiguration.getErrHasColors(),i=this._outputConfiguration.getErrHelpWidth()):(n=s=>this._outputConfiguration.writeOut(s),o=this._outputConfiguration.getOutHasColors(),i=this._outputConfiguration.getOutHelpWidth()),{error:r,write:s=>(o||(s=this._outputConfiguration.stripColor(s)),n(s)),hasColors:o,helpWidth:i}}outputHelp(e){let r;typeof e=="function"&&(r=e,e=void 0);let n=this._getOutputContext(e),o={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(a=>a.emit("beforeAllHelp",o)),this.emit("beforeHelp",o);let i=this.helpInformation({error:n.error});if(r&&(i=r(i),typeof i!="string"&&!Buffer.isBuffer(i)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(i),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",o),this._getCommandAndAncestors().forEach(a=>a.emit("afterAllHelp",o))}helpOption(e,r){return typeof e=="boolean"?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??"-h, --help",r??"display help for command"),(e||r)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let r=Number(we.exitCode??0);r===0&&e&&typeof e!="function"&&e.error&&(r=1),this._exit(r,"commander.help","(outputHelp)")}addHelpText(e,r){let n=["beforeAll","before","after","afterAll"];if(!n.includes(e))throw new Error(`Unexpected value for position to addHelpText.
26
26
  Expecting one of '${n.join("', '")}'`);let o=`${e}Help`;return this.on(o,i=>{let a;typeof r=="function"?a=r({error:i.error,command:i.command}):a=r,a&&i.write(`${a}
27
- `)}),this}_outputHelpIfRequested(e){let r=this._getHelpOption();r&&e.find(o=>r.is(o))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function cD(t){return t.map(e=>{if(!e.startsWith("--inspect"))return e;let r,n="127.0.0.1",o="9229",i;return(i=e.match(/^(--inspect(-brk)?)$/))!==null?r=i[1]:(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(r=i[1],/^\d+$/.test(i[3])?o=i[3]:n=i[3]):(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(r=i[1],n=i[3],o=i[4]),r&&o!=="0"?`${r}=${n}:${parseInt(o)+1}`:e})}function yf(){if(ve.env.NO_COLOR||ve.env.FORCE_COLOR==="0"||ve.env.FORCE_COLOR==="false")return!1;if(ve.env.FORCE_COLOR||ve.env.CLICOLOR_FORCE!==void 0)return!0}bf.Command=Df;bf.useColor=yf});var hD=x(Xt=>{var{Argument:fD}=Ns(),{Command:vf}=lD(),{CommanderError:yA,InvalidArgumentError:pD}=ca(),{Help:bA}=lf(),{Option:dD}=hf();Xt.program=new vf;Xt.createCommand=t=>new vf(t);Xt.createOption=(t,e)=>new dD(t,e);Xt.createArgument=(t,e)=>new fD(t,e);Xt.Command=vf;Xt.Option=dD;Xt.Argument=fD;Xt.Help=bA;Xt.CommanderError=yA;Xt.InvalidArgumentError=pD;Xt.InvalidOptionArgumentError=pD});var Cf=x((D7,gD)=>{"use strict";var wf={to(t,e){return e?`\x1B[${e+1};${t+1}H`:`\x1B[${t+1}G`},move(t,e){let r="";return t<0?r+=`\x1B[${-t}D`:t>0&&(r+=`\x1B[${t}C`),e<0?r+=`\x1B[${-e}A`:e>0&&(r+=`\x1B[${e}B`),r},up:(t=1)=>`\x1B[${t}A`,down:(t=1)=>`\x1B[${t}B`,forward:(t=1)=>`\x1B[${t}C`,backward:(t=1)=>`\x1B[${t}D`,nextLine:(t=1)=>"\x1B[E".repeat(t),prevLine:(t=1)=>"\x1B[F".repeat(t),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},wA={up:(t=1)=>"\x1B[S".repeat(t),down:(t=1)=>"\x1B[T".repeat(t)},CA={screen:"\x1B[2J",up:(t=1)=>"\x1B[1J".repeat(t),down:(t=1)=>"\x1B[J".repeat(t),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(t){let e="";for(let r=0;r<t;r++)e+=this.line+(r<t-1?wf.up():"");return t&&(e+=wf.left),e}};gD.exports={cursor:wf,scroll:wA,erase:CA,beep:"\x07"}});var _f=x((y7,Ef)=>{var Ms=process||{},DD=Ms.argv||[],Us=Ms.env||{},EA=!(Us.NO_COLOR||DD.includes("--no-color"))&&(!!Us.FORCE_COLOR||DD.includes("--color")||Ms.platform==="win32"||(Ms.stdout||{}).isTTY&&Us.TERM!=="dumb"||!!Us.CI),_A=(t,e,r=t)=>n=>{let o=""+n,i=o.indexOf(e,t.length);return~i?t+xA(o,e,r,i)+e:t+o+e},xA=(t,e,r,n)=>{let o="",i=0;do o+=t.substring(i,n)+r,i=n+e.length,n=t.indexOf(e,i);while(~n);return o+t.substring(i)},yD=(t=EA)=>{let e=t?_A:()=>String;return{isColorSupported:t,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};Ef.exports=yD();Ef.exports.createColors=yD});var Js=x(Rt=>{"use strict";Object.defineProperty(Rt,"__esModule",{value:!0});Rt.isNXMonorepo=Rt.isMonorepo=Rt.findPackageRelativePathInMonorepo=Rt.findPackagePath=Rt.findNXMonorepoRoot=Rt.findMonorepoRoot=void 0;var pa=require("node:fs"),fn=require("node:path");function Ys(t){let e=(0,fn.join)(t,"package.json"),r=(0,fn.join)(t,"pnpm-workspace.yaml");if((0,pa.existsSync)(r)||(0,pa.existsSync)(e)&&JSON.parse((0,pa.readFileSync)(e,"utf-8")).workspaces)return t;let n=(0,fn.dirname)(t);if(n===t)throw new Error("Monorepo root not found");return Ys(n)}Rt.findMonorepoRoot=Ys;function jf(t){let e=(0,fn.join)(t,"nx.json");if((0,pa.existsSync)(e))return t;let r=(0,fn.dirname)(t);if(r===t)throw new Error("Monorepo root not found");return jf(r)}Rt.findNXMonorepoRoot=jf;function Nf(t,e,r){let n=(0,fn.join)(e,"node_modules",t);if((0,pa.existsSync)(n))return n;if(e===r)return null;let o=(0,fn.dirname)(e);return Nf(t,o,r)}Rt.findPackagePath=Nf;function nO(t,e){let r=Ys(e),n=Nf(t,e,r);return n?(0,fn.relative)(e,n):null}Rt.findPackageRelativePathInMonorepo=nO;function oO(t){try{return Ys(t),!0}catch{return!1}}Rt.isMonorepo=oO;function iO(t){try{return jf(t),!0}catch{return!1}}Rt.isNXMonorepo=iO});var le={};qr(le,{__addDisposableResource:()=>vy,__assign:()=>nu,__asyncDelegator:()=>py,__asyncGenerator:()=>fy,__asyncValues:()=>dy,__await:()=>Lo,__awaiter:()=>iy,__classPrivateFieldGet:()=>Dy,__classPrivateFieldIn:()=>by,__classPrivateFieldSet:()=>yy,__createBinding:()=>iu,__decorate:()=>ZD,__disposeResources:()=>wy,__esDecorate:()=>ey,__exportStar:()=>sy,__extends:()=>JD,__generator:()=>ay,__importDefault:()=>gy,__importStar:()=>my,__makeTemplateObject:()=>hy,__metadata:()=>oy,__param:()=>QD,__propKey:()=>ry,__read:()=>Wf,__rest:()=>XD,__rewriteRelativeImportExtension:()=>Cy,__runInitializers:()=>ty,__setFunctionName:()=>ny,__spread:()=>uy,__spreadArray:()=>ly,__spreadArrays:()=>cy,__values:()=>ou,default:()=>OO});function JD(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");zf(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function XD(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]]);return r}function ZD(t,e,r,n){var o=arguments.length,i=o<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(i=(o<3?a(i):o>3?a(e,r,i):a(e,r))||i);return o>3&&i&&Object.defineProperty(e,r,i),i}function QD(t,e){return function(r,n){e(r,n,t)}}function ey(t,e,r,n,o,i){function a(C){if(C!==void 0&&typeof C!="function")throw new TypeError("Function expected");return C}for(var s=n.kind,u=s==="getter"?"get":s==="setter"?"set":"value",c=!e&&t?n.static?t:t.prototype:null,l=e||(c?Object.getOwnPropertyDescriptor(c,n.name):{}),f,d=!1,h=r.length-1;h>=0;h--){var m={};for(var b in n)m[b]=b==="access"?{}:n[b];for(var b in n.access)m.access[b]=n.access[b];m.addInitializer=function(C){if(d)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(C||null))};var D=(0,r[h])(s==="accessor"?{get:l.get,set:l.set}:l[u],m);if(s==="accessor"){if(D===void 0)continue;if(D===null||typeof D!="object")throw new TypeError("Object expected");(f=a(D.get))&&(l.get=f),(f=a(D.set))&&(l.set=f),(f=a(D.init))&&o.unshift(f)}else(f=a(D))&&(s==="field"?o.unshift(f):l[u]=f)}c&&Object.defineProperty(c,n.name,l),d=!0}function ty(t,e,r){for(var n=arguments.length>2,o=0;o<e.length;o++)r=n?e[o].call(t,r):e[o].call(t);return n?r:void 0}function ry(t){return typeof t=="symbol"?t:"".concat(t)}function ny(t,e,r){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})}function oy(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function iy(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(l){try{c(n.next(l))}catch(f){a(f)}}function u(l){try{c(n.throw(l))}catch(f){a(f)}}function c(l){l.done?i(l.value):o(l.value).then(s,u)}c((n=n.apply(t,e||[])).next())})}function ay(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(c){return function(l){return u([c,l])}}function u(c){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(r=0)),r;)try{if(n=1,o&&(i=c[0]&2?o.return:c[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,c[1])).done)return i;switch(o=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,o=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=e.call(t,r)}catch(l){c=[6,l],o=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function sy(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&iu(e,t,r)}function ou(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Wf(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),o,i=[],a;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i}function uy(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Wf(arguments[e]));return t}function cy(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),o=0,e=0;e<r;e++)for(var i=arguments[e],a=0,s=i.length;a<s;a++,o++)n[o]=i[a];return n}function ly(t,e,r){if(r||arguments.length===2)for(var n=0,o=e.length,i;n<o;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}function Lo(t){return this instanceof Lo?(this.v=t,this):new Lo(t)}function fy(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(h){return function(m){return Promise.resolve(m).then(h,f)}}function s(h,m){n[h]&&(o[h]=function(b){return new Promise(function(D,C){i.push([h,b,D,C])>1||u(h,b)})},m&&(o[h]=m(o[h])))}function u(h,m){try{c(n[h](m))}catch(b){d(i[0][3],b)}}function c(h){h.value instanceof Lo?Promise.resolve(h.value.v).then(l,f):d(i[0][2],h)}function l(h){u("next",h)}function f(h){u("throw",h)}function d(h,m){h(m),i.shift(),i.length&&u(i[0][0],i[0][1])}}function py(t){var e,r;return e={},n("next"),n("throw",function(o){throw o}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(o,i){e[o]=t[o]?function(a){return(r=!r)?{value:Lo(t[o](a)),done:!1}:i?i(a):a}:i}}function dy(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof ou=="function"?ou(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(a){return new Promise(function(s,u){a=t[i](a),o(s,u,a.done,a.value)})}}function o(i,a,s,u){Promise.resolve(u).then(function(c){i({value:c,done:s})},a)}}function hy(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function my(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=Gf(t),n=0;n<r.length;n++)r[n]!=="default"&&iu(e,t,r[n]);return FO(e,t),e}function gy(t){return t&&t.__esModule?t:{default:t}}function Dy(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}function yy(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r}function by(t,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?e===t:t.has(e)}function vy(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var n,o;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=e[Symbol.asyncDispose]}if(n===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=e[Symbol.dispose],r&&(o=n)}if(typeof n!="function")throw new TypeError("Object not disposable.");o&&(n=function(){try{o.call(this)}catch(i){return Promise.reject(i)}}),t.stack.push({value:e,dispose:n,async:r})}else r&&t.stack.push({async:!0});return e}function wy(t){function e(i){t.error=t.hasError?new AO(i,t.error,"An error was suppressed during disposal."):i,t.hasError=!0}var r,n=0;function o(){for(;r=t.stack.pop();)try{if(!r.async&&n===1)return n=0,t.stack.push(r),Promise.resolve().then(o);if(r.dispose){var i=r.dispose.call(r.value);if(r.async)return n|=2,Promise.resolve(i).then(o,function(a){return e(a),o()})}else n|=1}catch(a){e(a)}if(n===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return o()}function Cy(t,e){return typeof t=="string"&&/^\.\.?\//.test(t)?t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(r,n,o,i,a){return n?e?".jsx":".js":o&&(!i||!a)?r:o+i+"."+a.toLowerCase()+"js"}):t}var zf,nu,iu,FO,Gf,AO,OO,fe=tt(()=>{zf=function(t,e){return zf=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])},zf(t,e)};nu=function(){return nu=Object.assign||function(e){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},nu.apply(this,arguments)};iu=Object.create?(function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]});FO=Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e},Gf=function(t){return Gf=Object.getOwnPropertyNames||function(e){var r=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[r.length]=n);return r},Gf(t)};AO=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};OO={__extends:JD,__assign:nu,__rest:XD,__decorate:ZD,__param:QD,__esDecorate:ey,__runInitializers:ty,__propKey:ry,__setFunctionName:ny,__metadata:oy,__awaiter:iy,__generator:ay,__createBinding:iu,__exportStar:sy,__values:ou,__read:Wf,__spread:uy,__spreadArrays:cy,__spreadArray:ly,__await:Lo,__asyncGenerator:fy,__asyncDelegator:py,__asyncValues:dy,__makeTemplateObject:hy,__importStar:my,__importDefault:gy,__classPrivateFieldGet:Dy,__classPrivateFieldSet:yy,__classPrivateFieldIn:by,__addDisposableResource:vy,__disposeResources:wy,__rewriteRelativeImportExtension:Cy}});var Ey=x(au=>{"use strict";Object.defineProperty(au,"__esModule",{value:!0});au.resolveFetch=void 0;var kO=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);au.resolveFetch=kO});var Xf=x(Qt=>{"use strict";Object.defineProperty(Qt,"__esModule",{value:!0});Qt.FunctionRegion=Qt.FunctionsHttpError=Qt.FunctionsRelayError=Qt.FunctionsFetchError=Qt.FunctionsError=void 0;var Uo=class extends Error{constructor(e,r="FunctionsError",n){super(e),this.name=r,this.context=n}};Qt.FunctionsError=Uo;var Kf=class extends Uo{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}};Qt.FunctionsFetchError=Kf;var Yf=class extends Uo{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}};Qt.FunctionsRelayError=Yf;var Jf=class extends Uo{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}};Qt.FunctionsHttpError=Jf;var _y;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(_y||(Qt.FunctionRegion=_y={}))});var xy=x(su=>{"use strict";Object.defineProperty(su,"__esModule",{value:!0});su.FunctionsClient=void 0;var $O=(fe(),re(le)),PO=Ey(),Hn=Xf(),Zf=class{constructor(e,{headers:r={},customFetch:n,region:o=Hn.FunctionRegion.Any}={}){this.url=e,this.headers=r,this.region=o,this.fetch=(0,PO.resolveFetch)(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return $O.__awaiter(this,arguments,void 0,function*(r,n={}){var o;try{let{headers:i,method:a,body:s,signal:u}=n,c={},{region:l}=n;l||(l=this.region);let f=new URL(`${this.url}/${r}`);l&&l!=="any"&&(c["x-region"]=l,f.searchParams.set("forceFunctionRegion",l));let d;s&&(i&&!Object.prototype.hasOwnProperty.call(i,"Content-Type")||!i)?typeof Blob<"u"&&s instanceof Blob||s instanceof ArrayBuffer?(c["Content-Type"]="application/octet-stream",d=s):typeof s=="string"?(c["Content-Type"]="text/plain",d=s):typeof FormData<"u"&&s instanceof FormData?d=s:(c["Content-Type"]="application/json",d=JSON.stringify(s)):d=s;let h=yield this.fetch(f.toString(),{method:a||"POST",headers:Object.assign(Object.assign(Object.assign({},c),this.headers),i),body:d,signal:u}).catch(C=>{throw C.name==="AbortError"?C:new Hn.FunctionsFetchError(C)}),m=h.headers.get("x-relay-error");if(m&&m==="true")throw new Hn.FunctionsRelayError(h);if(!h.ok)throw new Hn.FunctionsHttpError(h);let b=((o=h.headers.get("Content-Type"))!==null&&o!==void 0?o:"text/plain").split(";")[0].trim(),D;return b==="application/json"?D=yield h.json():b==="application/octet-stream"||b==="application/pdf"?D=yield h.blob():b==="text/event-stream"?D=h:b==="multipart/form-data"?D=yield h.formData():D=yield h.text(),{data:D,error:null,response:h}}catch(i){return i instanceof Error&&i.name==="AbortError"?{data:null,error:new Hn.FunctionsFetchError(i)}:{data:null,error:i,response:i instanceof Hn.FunctionsHttpError||i instanceof Hn.FunctionsRelayError?i.context:void 0}}})}};su.FunctionsClient=Zf});var Qf=x(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.FunctionRegion=Bt.FunctionsRelayError=Bt.FunctionsHttpError=Bt.FunctionsFetchError=Bt.FunctionsError=Bt.FunctionsClient=void 0;var TO=xy();Object.defineProperty(Bt,"FunctionsClient",{enumerable:!0,get:function(){return TO.FunctionsClient}});var Da=Xf();Object.defineProperty(Bt,"FunctionsError",{enumerable:!0,get:function(){return Da.FunctionsError}});Object.defineProperty(Bt,"FunctionsFetchError",{enumerable:!0,get:function(){return Da.FunctionsFetchError}});Object.defineProperty(Bt,"FunctionsHttpError",{enumerable:!0,get:function(){return Da.FunctionsHttpError}});Object.defineProperty(Bt,"FunctionsRelayError",{enumerable:!0,get:function(){return Da.FunctionsRelayError}});Object.defineProperty(Bt,"FunctionRegion",{enumerable:!0,get:function(){return Da.FunctionRegion}})});var rp=x(tp=>{"use strict";Object.defineProperty(tp,"__esModule",{value:!0});var ep=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}};tp.default=ep});var ip=x(op=>{"use strict";Object.defineProperty(op,"__esModule",{value:!0});var IO=(fe(),re(le)),RO=IO.__importDefault(rp()),np=class{constructor(e){var r,n;this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=(r=e.shouldThrowOnError)!==null&&r!==void 0?r:!1,this.signal=e.signal,this.isMaybeSingle=(n=e.isMaybeSingle)!==null&&n!==void 0?n:!1,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,r){return this.headers=new Headers(this.headers),this.headers.set(e,r),this}then(e,r){this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");let n=this.fetch,o=n(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async i=>{var a,s,u,c;let l=null,f=null,d=null,h=i.status,m=i.statusText;if(i.ok){if(this.method!=="HEAD"){let E=await i.text();E===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&(!((a=this.headers.get("Accept"))===null||a===void 0)&&a.includes("application/vnd.pgrst.plan+text"))?f=E:f=JSON.parse(E))}let D=(s=this.headers.get("Prefer"))===null||s===void 0?void 0:s.match(/count=(exact|planned|estimated)/),C=(u=i.headers.get("content-range"))===null||u===void 0?void 0:u.split("/");D&&C&&C.length>1&&(d=parseInt(C[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(f)&&(f.length>1?(l={code:"PGRST116",details:`Results contain ${f.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},f=null,d=null,h=406,m="Not Acceptable"):f.length===1?f=f[0]:f=null)}else{let D=await i.text();try{l=JSON.parse(D),Array.isArray(l)&&i.status===404&&(f=[],l=null,h=200,m="OK")}catch{i.status===404&&D===""?(h=204,m="No Content"):l={message:D}}if(l&&this.isMaybeSingle&&(!((c=l?.details)===null||c===void 0)&&c.includes("0 rows"))&&(l=null,h=200,m="OK"),l&&this.shouldThrowOnError)throw new RO.default(l)}return{error:l,data:f,count:d,status:h,statusText:m}});return this.shouldThrowOnError||(o=o.catch(i=>{var a,s,u;return{error:{message:`${(a=i?.name)!==null&&a!==void 0?a:"FetchError"}: ${i?.message}`,details:`${(s=i?.stack)!==null&&s!==void 0?s:""}`,hint:"",code:`${(u=i?.code)!==null&&u!==void 0?u:""}`},data:null,count:null,status:0,statusText:""}})),o.then(e,r)}returns(){return this}overrideTypes(){return this}};op.default=np});var up=x(sp=>{"use strict";Object.defineProperty(sp,"__esModule",{value:!0});var BO=(fe(),re(le)),jO=BO.__importDefault(ip()),ap=class extends jO.default{select(e){let r=!1,n=(e??"*").split("").map(o=>/\s/.test(o)&&!r?"":(o==='"'&&(r=!r),o)).join("");return this.url.searchParams.set("select",n),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:r=!0,nullsFirst:n,foreignTable:o,referencedTable:i=o}={}){let a=i?`${i}.order`:"order",s=this.url.searchParams.get(a);return this.url.searchParams.set(a,`${s?`${s},`:""}${e}.${r?"asc":"desc"}${n===void 0?"":n?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:r,referencedTable:n=r}={}){let o=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(o,`${e}`),this}range(e,r,{foreignTable:n,referencedTable:o=n}={}){let i=typeof o>"u"?"offset":`${o}.offset`,a=typeof o>"u"?"limit":`${o}.limit`;return this.url.searchParams.set(i,`${e}`),this.url.searchParams.set(a,`${r-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:e=!1,verbose:r=!1,settings:n=!1,buffers:o=!1,wal:i=!1,format:a="text"}={}){var s;let u=[e?"analyze":null,r?"verbose":null,n?"settings":null,o?"buffers":null,i?"wal":null].filter(Boolean).join("|"),c=(s=this.headers.get("Accept"))!==null&&s!==void 0?s:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${a}; for="${c}"; options=${u};`),a==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};sp.default=ap});var uu=x(lp=>{"use strict";Object.defineProperty(lp,"__esModule",{value:!0});var NO=(fe(),re(le)),LO=NO.__importDefault(up()),UO=new RegExp("[,()]"),cp=class extends LO.default{eq(e,r){return this.url.searchParams.append(e,`eq.${r}`),this}neq(e,r){return this.url.searchParams.append(e,`neq.${r}`),this}gt(e,r){return this.url.searchParams.append(e,`gt.${r}`),this}gte(e,r){return this.url.searchParams.append(e,`gte.${r}`),this}lt(e,r){return this.url.searchParams.append(e,`lt.${r}`),this}lte(e,r){return this.url.searchParams.append(e,`lte.${r}`),this}like(e,r){return this.url.searchParams.append(e,`like.${r}`),this}likeAllOf(e,r){return this.url.searchParams.append(e,`like(all).{${r.join(",")}}`),this}likeAnyOf(e,r){return this.url.searchParams.append(e,`like(any).{${r.join(",")}}`),this}ilike(e,r){return this.url.searchParams.append(e,`ilike.${r}`),this}ilikeAllOf(e,r){return this.url.searchParams.append(e,`ilike(all).{${r.join(",")}}`),this}ilikeAnyOf(e,r){return this.url.searchParams.append(e,`ilike(any).{${r.join(",")}}`),this}is(e,r){return this.url.searchParams.append(e,`is.${r}`),this}in(e,r){let n=Array.from(new Set(r)).map(o=>typeof o=="string"&&UO.test(o)?`"${o}"`:`${o}`).join(",");return this.url.searchParams.append(e,`in.(${n})`),this}contains(e,r){return typeof r=="string"?this.url.searchParams.append(e,`cs.${r}`):Array.isArray(r)?this.url.searchParams.append(e,`cs.{${r.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(r)}`),this}containedBy(e,r){return typeof r=="string"?this.url.searchParams.append(e,`cd.${r}`):Array.isArray(r)?this.url.searchParams.append(e,`cd.{${r.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(r)}`),this}rangeGt(e,r){return this.url.searchParams.append(e,`sr.${r}`),this}rangeGte(e,r){return this.url.searchParams.append(e,`nxl.${r}`),this}rangeLt(e,r){return this.url.searchParams.append(e,`sl.${r}`),this}rangeLte(e,r){return this.url.searchParams.append(e,`nxr.${r}`),this}rangeAdjacent(e,r){return this.url.searchParams.append(e,`adj.${r}`),this}overlaps(e,r){return typeof r=="string"?this.url.searchParams.append(e,`ov.${r}`):this.url.searchParams.append(e,`ov.{${r.join(",")}}`),this}textSearch(e,r,{config:n,type:o}={}){let i="";o==="plain"?i="pl":o==="phrase"?i="ph":o==="websearch"&&(i="w");let a=n===void 0?"":`(${n})`;return this.url.searchParams.append(e,`${i}fts${a}.${r}`),this}match(e){return Object.entries(e).forEach(([r,n])=>{this.url.searchParams.append(r,`eq.${n}`)}),this}not(e,r,n){return this.url.searchParams.append(e,`not.${r}.${n}`),this}or(e,{foreignTable:r,referencedTable:n=r}={}){let o=n?`${n}.or`:"or";return this.url.searchParams.append(o,`(${e})`),this}filter(e,r,n){return this.url.searchParams.append(e,`${r}.${n}`),this}};lp.default=cp});var dp=x(pp=>{"use strict";Object.defineProperty(pp,"__esModule",{value:!0});var MO=(fe(),re(le)),ya=MO.__importDefault(uu()),fp=class{constructor(e,{headers:r={},schema:n,fetch:o}){this.url=e,this.headers=new Headers(r),this.schema=n,this.fetch=o}select(e,r){let{head:n=!1,count:o}=r??{},i=n?"HEAD":"GET",a=!1,s=(e??"*").split("").map(u=>/\s/.test(u)&&!a?"":(u==='"'&&(a=!a),u)).join("");return this.url.searchParams.set("select",s),o&&this.headers.append("Prefer",`count=${o}`),new ya.default({method:i,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(e,{count:r,defaultToNull:n=!0}={}){var o;let i="POST";if(r&&this.headers.append("Prefer",`count=${r}`),n||this.headers.append("Prefer","missing=default"),Array.isArray(e)){let a=e.reduce((s,u)=>s.concat(Object.keys(u)),[]);if(a.length>0){let s=[...new Set(a)].map(u=>`"${u}"`);this.url.searchParams.set("columns",s.join(","))}}return new ya.default({method:i,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}upsert(e,{onConflict:r,ignoreDuplicates:n=!1,count:o,defaultToNull:i=!0}={}){var a;let s="POST";if(this.headers.append("Prefer",`resolution=${n?"ignore":"merge"}-duplicates`),r!==void 0&&this.url.searchParams.set("on_conflict",r),o&&this.headers.append("Prefer",`count=${o}`),i||this.headers.append("Prefer","missing=default"),Array.isArray(e)){let u=e.reduce((c,l)=>c.concat(Object.keys(l)),[]);if(u.length>0){let c=[...new Set(u)].map(l=>`"${l}"`);this.url.searchParams.set("columns",c.join(","))}}return new ya.default({method:s,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}update(e,{count:r}={}){var n;let o="PATCH";return r&&this.headers.append("Prefer",`count=${r}`),new ya.default({method:o,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch})}delete({count:e}={}){var r;let n="DELETE";return e&&this.headers.append("Prefer",`count=${e}`),new ya.default({method:n,url:this.url,headers:this.headers,schema:this.schema,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}};pp.default=fp});var Fy=x(mp=>{"use strict";Object.defineProperty(mp,"__esModule",{value:!0});var Sy=(fe(),re(le)),qO=Sy.__importDefault(dp()),HO=Sy.__importDefault(uu()),hp=class t{constructor(e,{headers:r={},schema:n,fetch:o}={}){this.url=e,this.headers=new Headers(r),this.schemaName=n,this.fetch=o}from(e){let r=new URL(`${this.url}/${e}`);return new qO.default(r,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new t(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,r={},{head:n=!1,get:o=!1,count:i}={}){var a;let s,u=new URL(`${this.url}/rpc/${e}`),c;n||o?(s=n?"HEAD":"GET",Object.entries(r).filter(([f,d])=>d!==void 0).map(([f,d])=>[f,Array.isArray(d)?`{${d.join(",")}}`:`${d}`]).forEach(([f,d])=>{u.searchParams.append(f,d)})):(s="POST",c=r);let l=new Headers(this.headers);return i&&l.set("Prefer",`count=${i}`),new HO.default({method:s,url:u,headers:l,schema:this.schemaName,body:c,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}};mp.default=hp});var gp=x(Ft=>{"use strict";Object.defineProperty(Ft,"__esModule",{value:!0});Ft.PostgrestError=Ft.PostgrestBuilder=Ft.PostgrestTransformBuilder=Ft.PostgrestFilterBuilder=Ft.PostgrestQueryBuilder=Ft.PostgrestClient=void 0;var Mo=(fe(),re(le)),Ay=Mo.__importDefault(Fy());Ft.PostgrestClient=Ay.default;var Oy=Mo.__importDefault(dp());Ft.PostgrestQueryBuilder=Oy.default;var ky=Mo.__importDefault(uu());Ft.PostgrestFilterBuilder=ky.default;var $y=Mo.__importDefault(up());Ft.PostgrestTransformBuilder=$y.default;var Py=Mo.__importDefault(ip());Ft.PostgrestBuilder=Py.default;var Ty=Mo.__importDefault(rp());Ft.PostgrestError=Ty.default;Ft.default={PostgrestClient:Ay.default,PostgrestQueryBuilder:Oy.default,PostgrestFilterBuilder:ky.default,PostgrestTransformBuilder:$y.default,PostgrestBuilder:Py.default,PostgrestError:Ty.default}});var yp={};qr(yp,{RealtimeClient:()=>Dp});var Dp,bp=tt(()=>{Dp=class{constructor(){}connect(){}disconnect(){}}});var hn=x(zr=>{"use strict";Object.defineProperty(zr,"__esModule",{value:!0});zr.StorageUnknownError=zr.StorageApiError=zr.StorageError=void 0;zr.isStorageError=VO;var ba=class extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}};zr.StorageError=ba;function VO(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var vp=class extends ba{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}}};zr.StorageApiError=vp;var wp=class extends ba{constructor(e,r){super(e),this.name="StorageUnknownError",this.originalError=r}};zr.StorageUnknownError=wp});var va=x(er=>{"use strict";Object.defineProperty(er,"__esModule",{value:!0});er.isPlainObject=er.recursiveToCamel=er.resolveResponse=er.resolveFetch=void 0;var zO=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);er.resolveFetch=zO;var GO=()=>Response;er.resolveResponse=GO;var WO=t=>{if(Array.isArray(t))return t.map(r=>(0,er.recursiveToCamel)(r));if(typeof t=="function"||t!==Object(t))return t;let e={};return Object.entries(t).forEach(([r,n])=>{let o=r.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));e[o]=(0,er.recursiveToCamel)(n)}),e};er.recursiveToCamel=WO;var KO=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)};er.isPlainObject=KO});var cu=x(zn=>{"use strict";Object.defineProperty(zn,"__esModule",{value:!0});zn.get=XO;zn.post=ZO;zn.put=QO;zn.head=ek;zn.remove=tk;var Vn=(fe(),re(le)),Cp=hn(),Iy=va(),Ep=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)},YO=(t,e,r)=>Vn.__awaiter(void 0,void 0,void 0,function*(){let n=yield(0,Iy.resolveResponse)();t instanceof n&&!r?.noResolveJson?t.json().then(o=>{let i=t.status||500,a=o?.statusCode||i+"";e(new Cp.StorageApiError(Ep(o),i,a))}).catch(o=>{e(new Cp.StorageUnknownError(Ep(o),o))}):e(new Cp.StorageUnknownError(Ep(t),t))}),JO=(t,e,r,n)=>{let o={method:t,headers:e?.headers||{}};return t==="GET"||!n?o:((0,Iy.isPlainObject)(n)?(o.headers=Object.assign({"Content-Type":"application/json"},e?.headers),o.body=JSON.stringify(n)):o.body=n,e?.duplex&&(o.duplex=e.duplex),Object.assign(Object.assign({},o),r))};function wa(t,e,r,n,o,i){return Vn.__awaiter(this,void 0,void 0,function*(){return new Promise((a,s)=>{t(r,JO(e,n,o,i)).then(u=>{if(!u.ok)throw u;return n?.noResolveJson?u:u.json()}).then(u=>a(u)).catch(u=>YO(u,s,n))})})}function XO(t,e,r,n){return Vn.__awaiter(this,void 0,void 0,function*(){return wa(t,"GET",e,r,n)})}function ZO(t,e,r,n,o){return Vn.__awaiter(this,void 0,void 0,function*(){return wa(t,"POST",e,n,o,r)})}function QO(t,e,r,n,o){return Vn.__awaiter(this,void 0,void 0,function*(){return wa(t,"PUT",e,n,o,r)})}function ek(t,e,r,n){return Vn.__awaiter(this,void 0,void 0,function*(){return wa(t,"HEAD",e,Object.assign(Object.assign({},r),{noResolveJson:!0}),n)})}function tk(t,e,r,n,o){return Vn.__awaiter(this,void 0,void 0,function*(){return wa(t,"DELETE",e,n,o,r)})}});var Ry=x(xp=>{"use strict";Object.defineProperty(xp,"__esModule",{value:!0});var rk=(fe(),re(le)),nk=hn(),_p=class{constructor(e,r){this.downloadFn=e,this.shouldThrowOnError=r}then(e,r){return this.execute().then(e,r)}execute(){return rk.__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,nk.isStorageError)(e))return{data:null,error:e};throw e}})}};xp.default=_p});var Ny=x(Fp=>{"use strict";var By;Object.defineProperty(Fp,"__esModule",{value:!0});var jy=(fe(),re(le)),ok=hn(),ik=jy.__importDefault(Ry()),Sp=class{constructor(e,r){this.downloadFn=e,this.shouldThrowOnError=r,this[By]="BlobDownloadBuilder",this.promise=null}asStream(){return new ik.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 jy.__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,ok.isStorageError)(e))return{data:null,error:e};throw e}})}};By=Symbol.toStringTag;Fp.default=Sp});var My=x(Op=>{"use strict";Object.defineProperty(Op,"__esModule",{value:!0});var At=(fe(),re(le)),jt=hn(),Nt=cu(),Ly=va(),ak=At.__importDefault(Ny()),sk={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Uy={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1},Ap=class{constructor(e,r={},n,o){this.shouldThrowOnError=!1,this.url=e,this.headers=r,this.bucketId=n,this.fetch=(0,Ly.resolveFetch)(o)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(e,r,n,o){return At.__awaiter(this,void 0,void 0,function*(){try{let i,a=Object.assign(Object.assign({},Uy),o),s=Object.assign(Object.assign({},this.headers),e==="POST"&&{"x-upsert":String(a.upsert)}),u=a.metadata;typeof Blob<"u"&&n instanceof Blob?(i=new FormData,i.append("cacheControl",a.cacheControl),u&&i.append("metadata",this.encodeMetadata(u)),i.append("",n)):typeof FormData<"u"&&n instanceof FormData?(i=n,i.has("cacheControl")||i.append("cacheControl",a.cacheControl),u&&!i.has("metadata")&&i.append("metadata",this.encodeMetadata(u))):(i=n,s["cache-control"]=`max-age=${a.cacheControl}`,s["content-type"]=a.contentType,u&&(s["x-metadata"]=this.toBase64(this.encodeMetadata(u))),(typeof ReadableStream<"u"&&i instanceof ReadableStream||i&&typeof i=="object"&&"pipe"in i&&typeof i.pipe=="function")&&!a.duplex&&(a.duplex="half")),o?.headers&&(s=Object.assign(Object.assign({},s),o.headers));let c=this._removeEmptyFolders(r),l=this._getFinalPath(c),f=yield(e=="PUT"?Nt.put:Nt.post)(this.fetch,`${this.url}/object/${l}`,i,Object.assign({headers:s},a?.duplex?{duplex:a.duplex}:{}));return{data:{path:c,id:f.Id,fullPath:f.Key},error:null}}catch(i){if(this.shouldThrowOnError)throw i;if((0,jt.isStorageError)(i))return{data:null,error:i};throw i}})}upload(e,r,n){return At.__awaiter(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,r,n)})}uploadToSignedUrl(e,r,n,o){return At.__awaiter(this,void 0,void 0,function*(){let i=this._removeEmptyFolders(e),a=this._getFinalPath(i),s=new URL(this.url+`/object/upload/sign/${a}`);s.searchParams.set("token",r);try{let u,c=Object.assign({upsert:Uy.upsert},o),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 f=yield(0,Nt.put)(this.fetch,s.toString(),u,{headers:l});return{data:{path:i,fullPath:f.Key},error:null}}catch(u){if(this.shouldThrowOnError)throw u;if((0,jt.isStorageError)(u))return{data:null,error:u};throw u}})}createSignedUploadUrl(e,r){return At.__awaiter(this,void 0,void 0,function*(){try{let n=this._getFinalPath(e),o=Object.assign({},this.headers);r?.upsert&&(o["x-upsert"]="true");let i=yield(0,Nt.post)(this.fetch,`${this.url}/object/upload/sign/${n}`,{},{headers:o}),a=new URL(this.url+i.url),s=a.searchParams.get("token");if(!s)throw new jt.StorageError("No token returned by API");return{data:{signedUrl:a.toString(),path:e,token:s},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,jt.isStorageError)(n))return{data:null,error:n};throw n}})}update(e,r,n){return At.__awaiter(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,r,n)})}move(e,r,n){return At.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Nt.post)(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:r,destinationBucket:n?.destinationBucket},{headers:this.headers}),error:null}}catch(o){if(this.shouldThrowOnError)throw o;if((0,jt.isStorageError)(o))return{data:null,error:o};throw o}})}copy(e,r,n){return At.__awaiter(this,void 0,void 0,function*(){try{return{data:{path:(yield(0,Nt.post)(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:r,destinationBucket:n?.destinationBucket},{headers:this.headers})).Key},error:null}}catch(o){if(this.shouldThrowOnError)throw o;if((0,jt.isStorageError)(o))return{data:null,error:o};throw o}})}createSignedUrl(e,r,n){return At.__awaiter(this,void 0,void 0,function*(){try{let o=this._getFinalPath(e),i=yield(0,Nt.post)(this.fetch,`${this.url}/object/sign/${o}`,Object.assign({expiresIn:r},n?.transform?{transform:n.transform}:{}),{headers:this.headers}),a=n?.download?`&download=${n.download===!0?"":n.download}`:"";return i={signedUrl:encodeURI(`${this.url}${i.signedURL}${a}`)},{data:i,error:null}}catch(o){if(this.shouldThrowOnError)throw o;if((0,jt.isStorageError)(o))return{data:null,error:o};throw o}})}createSignedUrls(e,r,n){return At.__awaiter(this,void 0,void 0,function*(){try{let o=yield(0,Nt.post)(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:r,paths:e},{headers:this.headers}),i=n?.download?`&download=${n.download===!0?"":n.download}`:"";return{data:o.map(a=>Object.assign(Object.assign({},a),{signedUrl:a.signedURL?encodeURI(`${this.url}${a.signedURL}${i}`):null})),error:null}}catch(o){if(this.shouldThrowOnError)throw o;if((0,jt.isStorageError)(o))return{data:null,error:o};throw o}})}download(e,r){let o=typeof r?.transform<"u"?"render/image/authenticated":"object",i=this.transformOptsToQueryString(r?.transform||{}),a=i?`?${i}`:"",s=this._getFinalPath(e),u=()=>(0,Nt.get)(this.fetch,`${this.url}/${o}/${s}${a}`,{headers:this.headers,noResolveJson:!0});return new ak.default(u,this.shouldThrowOnError)}info(e){return At.__awaiter(this,void 0,void 0,function*(){let r=this._getFinalPath(e);try{let n=yield(0,Nt.get)(this.fetch,`${this.url}/object/info/${r}`,{headers:this.headers});return{data:(0,Ly.recursiveToCamel)(n),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,jt.isStorageError)(n))return{data:null,error:n};throw n}})}exists(e){return At.__awaiter(this,void 0,void 0,function*(){let r=this._getFinalPath(e);try{return yield(0,Nt.head)(this.fetch,`${this.url}/object/${r}`,{headers:this.headers}),{data:!0,error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,jt.isStorageError)(n)&&n instanceof jt.StorageUnknownError){let o=n.originalError;if([400,404].includes(o?.status))return{data:!1,error:n}}throw n}})}getPublicUrl(e,r){let n=this._getFinalPath(e),o=[],i=r?.download?`download=${r.download===!0?"":r.download}`:"";i!==""&&o.push(i);let s=typeof r?.transform<"u"?"render/image":"object",u=this.transformOptsToQueryString(r?.transform||{});u!==""&&o.push(u);let c=o.join("&");return c!==""&&(c=`?${c}`),{data:{publicUrl:encodeURI(`${this.url}/${s}/public/${n}${c}`)}}}remove(e){return At.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Nt.remove)(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,jt.isStorageError)(r))return{data:null,error:r};throw r}})}list(e,r,n){return At.__awaiter(this,void 0,void 0,function*(){try{let o=Object.assign(Object.assign(Object.assign({},sk),r),{prefix:e||""});return{data:yield(0,Nt.post)(this.fetch,`${this.url}/object/list/${this.bucketId}`,o,{headers:this.headers},n),error:null}}catch(o){if(this.shouldThrowOnError)throw o;if((0,jt.isStorageError)(o))return{data:null,error:o};throw o}})}listV2(e,r){return At.__awaiter(this,void 0,void 0,function*(){try{let n=Object.assign({},e);return{data:yield(0,Nt.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,jt.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("&")}};Op.default=Ap});var kp=x(lu=>{"use strict";Object.defineProperty(lu,"__esModule",{value:!0});lu.version=void 0;lu.version="2.79.0"});var $p=x(fu=>{"use strict";Object.defineProperty(fu,"__esModule",{value:!0});fu.DEFAULT_HEADERS=void 0;var uk=kp();fu.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${uk.version}`}});var qy=x(Tp=>{"use strict";Object.defineProperty(Tp,"__esModule",{value:!0});var qo=(fe(),re(le)),ck=$p(),Ho=hn(),Vo=cu(),lk=va(),Pp=class{constructor(e,r={},n,o){this.shouldThrowOnError=!1;let i=new URL(e);o?.useNewHostname&&/supabase\.(co|in|red)$/.test(i.hostname)&&!i.hostname.includes("storage.supabase.")&&(i.hostname=i.hostname.replace("supabase.","storage.supabase.")),this.url=i.href.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},ck.DEFAULT_HEADERS),r),this.fetch=(0,lk.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(e){return qo.__awaiter(this,void 0,void 0,function*(){try{let r=this.listBucketOptionsToQueryString(e);return{data:yield(0,Vo.get)(this.fetch,`${this.url}/bucket${r}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ho.isStorageError)(r))return{data:null,error:r};throw r}})}getBucket(e){return qo.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Vo.get)(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ho.isStorageError)(r))return{data:null,error:r};throw r}})}createBucket(e){return qo.__awaiter(this,arguments,void 0,function*(r,n={public:!1}){try{return{data:yield(0,Vo.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(o){if(this.shouldThrowOnError)throw o;if((0,Ho.isStorageError)(o))return{data:null,error:o};throw o}})}updateBucket(e,r){return qo.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Vo.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,Ho.isStorageError)(n))return{data:null,error:n};throw n}})}emptyBucket(e){return qo.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Vo.post)(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ho.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return qo.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Vo.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ho.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():""}};Tp.default=Pp});var Lp=x(Np=>{"use strict";Object.defineProperty(Np,"__esModule",{value:!0});var Ip=(fe(),re(le)),fk=$p(),Rp=hn(),Bp=cu(),pk=va(),jp=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},fk.DEFAULT_HEADERS),r),this.fetch=(0,pk.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return Ip.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Bp.post)(this.fetch,`${this.url}/bucket`,{name:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Rp.isStorageError)(r))return{data:null,error:r};throw r}})}listBuckets(e){return Ip.__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(),o=n?`${this.url}/bucket?${n}`:`${this.url}/bucket`;return{data:yield(0,Bp.get)(this.fetch,o,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Rp.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return Ip.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Bp.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Rp.isStorageError)(r))return{data:null,error:r};throw r}})}};Np.default=jp});var du=x(pu=>{"use strict";Object.defineProperty(pu,"__esModule",{value:!0});pu.DEFAULT_HEADERS=void 0;var dk=kp();pu.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${dk.version}`,"Content-Type":"application/json"}});var zo=x(vr=>{"use strict";Object.defineProperty(vr,"__esModule",{value:!0});vr.StorageVectorsErrorCode=vr.StorageVectorsUnknownError=vr.StorageVectorsApiError=vr.StorageVectorsError=void 0;vr.isStorageVectorsError=hk;var Ca=class extends Error{constructor(e){super(e),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};vr.StorageVectorsError=Ca;function hk(t){return typeof t=="object"&&t!==null&&"__isStorageVectorsError"in t}var Up=class extends Ca{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}}};vr.StorageVectorsApiError=Up;var Mp=class extends Ca{constructor(e,r){super(e),this.name="StorageVectorsUnknownError",this.originalError=r}};vr.StorageVectorsUnknownError=Mp;var Hy;(function(t){t.InternalError="InternalError",t.S3VectorConflictException="S3VectorConflictException",t.S3VectorNotFoundException="S3VectorNotFoundException",t.S3VectorBucketNotEmpty="S3VectorBucketNotEmpty",t.S3VectorMaxBucketsExceeded="S3VectorMaxBucketsExceeded",t.S3VectorMaxIndexesExceeded="S3VectorMaxIndexesExceeded"})(Hy||(vr.StorageVectorsErrorCode=Hy={}))});var Go=x(tr=>{"use strict";Object.defineProperty(tr,"__esModule",{value:!0});tr.validateVectorDimension=tr.normalizeToFloat32=tr.isPlainObject=tr.resolveResponse=tr.resolveFetch=void 0;var mk=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);tr.resolveFetch=mk;var gk=()=>Response;tr.resolveResponse=gk;var Dk=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)};tr.isPlainObject=Dk;var yk=t=>Array.from(new Float32Array(t));tr.normalizeToFloat32=yk;var bk=(t,e)=>{if(e!==void 0&&t.float32.length!==e)throw new Error(`Vector dimension mismatch: expected ${e}, got ${t.float32.length}`)};tr.validateVectorDimension=bk});var gu=x(Ko=>{"use strict";Object.defineProperty(Ko,"__esModule",{value:!0});Ko.get=Ek;Ko.post=_k;Ko.put=xk;Ko.remove=Sk;var Wo=(fe(),re(le)),hu=zo(),vk=Go(),Vy=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),wk=(t,e,r)=>Wo.__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 o=t.status||500,i=t;if(typeof i.json=="function")i.json().then(a=>{let s=a?.statusCode||a?.code||o+"";e(new hu.StorageVectorsApiError(Vy(a),o,s))}).catch(()=>{let a=o+"",s=i.statusText||`HTTP ${o} error`;e(new hu.StorageVectorsApiError(s,o,a))});else{let a=o+"",s=i.statusText||`HTTP ${o} error`;e(new hu.StorageVectorsApiError(s,o,a))}}else e(new hu.StorageVectorsUnknownError(Vy(t),t))}),Ck=(t,e,r,n)=>{let o={method:t,headers:e?.headers||{}};return t==="GET"||!n?o:((0,vk.isPlainObject)(n)?(o.headers=Object.assign({"Content-Type":"application/json"},e?.headers),o.body=JSON.stringify(n)):o.body=n,Object.assign(Object.assign({},o),r))};function mu(t,e,r,n,o,i){return Wo.__awaiter(this,void 0,void 0,function*(){return new Promise((a,s)=>{t(r,Ck(e,n,o,i)).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=>a(u)).catch(u=>wk(u,s,n))})})}function Ek(t,e,r,n){return Wo.__awaiter(this,void 0,void 0,function*(){return mu(t,"GET",e,r,n)})}function _k(t,e,r,n,o){return Wo.__awaiter(this,void 0,void 0,function*(){return mu(t,"POST",e,n,o,r)})}function xk(t,e,r,n,o){return Wo.__awaiter(this,void 0,void 0,function*(){return mu(t,"PUT",e,n,o,r)})}function Sk(t,e,r,n,o){return Wo.__awaiter(this,void 0,void 0,function*(){return mu(t,"DELETE",e,n,o,r)})}});var Vp=x(Hp=>{"use strict";Object.defineProperty(Hp,"__esModule",{value:!0});var Du=(fe(),re(le)),Fk=du(),yu=zo(),bu=gu(),Ak=Go(),qp=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Fk.DEFAULT_HEADERS),r),this.fetch=(0,Ak.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createIndex(e){return Du.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,bu.post)(this.fetch,`${this.url}/CreateIndex`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,yu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getIndex(e,r){return Du.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,bu.post)(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:e,indexName:r},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,yu.isStorageVectorsError)(n))return{data:null,error:n};throw n}})}listIndexes(e){return Du.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,bu.post)(this.fetch,`${this.url}/ListIndexes`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,yu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteIndex(e,r){return Du.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,bu.post)(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:e,indexName:r},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,yu.isStorageVectorsError)(n))return{data:null,error:n};throw n}})}};Hp.default=qp});var Wp=x(Gp=>{"use strict";Object.defineProperty(Gp,"__esModule",{value:!0});var Ea=(fe(),re(le)),Ok=du(),_a=zo(),xa=gu(),kk=Go(),zp=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Ok.DEFAULT_HEADERS),r),this.fetch=(0,kk.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}putVectors(e){return Ea.__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,xa.post)(this.fetch,`${this.url}/PutVectors`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,_a.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getVectors(e){return Ea.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,xa.post)(this.fetch,`${this.url}/GetVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,_a.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}listVectors(e){return Ea.__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,xa.post)(this.fetch,`${this.url}/ListVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,_a.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}queryVectors(e){return Ea.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,xa.post)(this.fetch,`${this.url}/QueryVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,_a.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteVectors(e){return Ea.__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,xa.post)(this.fetch,`${this.url}/DeleteVectors`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,_a.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}};Gp.default=zp});var Jp=x(Yp=>{"use strict";Object.defineProperty(Yp,"__esModule",{value:!0});var vu=(fe(),re(le)),$k=du(),wu=zo(),Cu=gu(),Pk=Go(),Kp=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},$k.DEFAULT_HEADERS),r),this.fetch=(0,Pk.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return vu.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Cu.post)(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,wu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getBucket(e){return vu.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Cu.post)(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,wu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}listBuckets(){return vu.__awaiter(this,arguments,void 0,function*(e={}){try{return{data:yield(0,Cu.post)(this.fetch,`${this.url}/ListVectorBuckets`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,wu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return vu.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Cu.post)(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,wu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}};Yp.default=Kp});var zy=x(mn=>{"use strict";Object.defineProperty(mn,"__esModule",{value:!0});mn.VectorIndexScope=mn.VectorBucketScope=mn.StorageVectorsClient=void 0;var rr=(fe(),re(le)),Tk=rr.__importDefault(Vp()),Ik=rr.__importDefault(Wp()),Rk=rr.__importDefault(Jp()),Xp=class extends Rk.default{constructor(e,r={}){super(e,r.headers||{},r.fetch)}from(e){return new Eu(this.url,this.headers,e,this.fetch)}};mn.StorageVectorsClient=Xp;var Eu=class extends Tk.default{constructor(e,r,n,o){super(e,r,o),this.vectorBucketName=n}createIndex(e){let r=Object.create(null,{createIndex:{get:()=>super.createIndex}});return rr.__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 rr.__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 rr.__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 rr.__awaiter(this,void 0,void 0,function*(){return r.deleteIndex.call(this,this.vectorBucketName,e)})}index(e){return new _u(this.url,this.headers,this.vectorBucketName,e,this.fetch)}};mn.VectorBucketScope=Eu;var _u=class extends Ik.default{constructor(e,r,n,o,i){super(e,r,i),this.vectorBucketName=n,this.indexName=o}putVectors(e){let r=Object.create(null,{putVectors:{get:()=>super.putVectors}});return rr.__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 rr.__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 rr.__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 rr.__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 rr.__awaiter(this,void 0,void 0,function*(){return r.deleteVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}};mn.VectorIndexScope=_u});var ed=x(pe=>{"use strict";Object.defineProperty(pe,"__esModule",{value:!0});pe.validateVectorDimension=pe.normalizeToFloat32=pe.isPlainObject=pe.resolveResponse=pe.resolveFetch=pe.isStorageVectorsError=pe.StorageVectorsErrorCode=pe.StorageVectorsUnknownError=pe.StorageVectorsApiError=pe.StorageVectorsError=pe.VectorDataApi=pe.VectorIndexApi=pe.VectorBucketApi=pe.VectorIndexScope=pe.VectorBucketScope=pe.StorageVectorsClient=void 0;var Zp=(fe(),re(le)),Qp=zy();Object.defineProperty(pe,"StorageVectorsClient",{enumerable:!0,get:function(){return Qp.StorageVectorsClient}});Object.defineProperty(pe,"VectorBucketScope",{enumerable:!0,get:function(){return Qp.VectorBucketScope}});Object.defineProperty(pe,"VectorIndexScope",{enumerable:!0,get:function(){return Qp.VectorIndexScope}});var Bk=Jp();Object.defineProperty(pe,"VectorBucketApi",{enumerable:!0,get:function(){return Zp.__importDefault(Bk).default}});var jk=Vp();Object.defineProperty(pe,"VectorIndexApi",{enumerable:!0,get:function(){return Zp.__importDefault(jk).default}});var Nk=Wp();Object.defineProperty(pe,"VectorDataApi",{enumerable:!0,get:function(){return Zp.__importDefault(Nk).default}});var Sa=zo();Object.defineProperty(pe,"StorageVectorsError",{enumerable:!0,get:function(){return Sa.StorageVectorsError}});Object.defineProperty(pe,"StorageVectorsApiError",{enumerable:!0,get:function(){return Sa.StorageVectorsApiError}});Object.defineProperty(pe,"StorageVectorsUnknownError",{enumerable:!0,get:function(){return Sa.StorageVectorsUnknownError}});Object.defineProperty(pe,"StorageVectorsErrorCode",{enumerable:!0,get:function(){return Sa.StorageVectorsErrorCode}});Object.defineProperty(pe,"isStorageVectorsError",{enumerable:!0,get:function(){return Sa.isStorageVectorsError}});var Fa=Go();Object.defineProperty(pe,"resolveFetch",{enumerable:!0,get:function(){return Fa.resolveFetch}});Object.defineProperty(pe,"resolveResponse",{enumerable:!0,get:function(){return Fa.resolveResponse}});Object.defineProperty(pe,"isPlainObject",{enumerable:!0,get:function(){return Fa.isPlainObject}});Object.defineProperty(pe,"normalizeToFloat32",{enumerable:!0,get:function(){return Fa.normalizeToFloat32}});Object.defineProperty(pe,"validateVectorDimension",{enumerable:!0,get:function(){return Fa.validateVectorDimension}})});var Gy=x(xu=>{"use strict";Object.defineProperty(xu,"__esModule",{value:!0});xu.StorageClient=void 0;var rd=(fe(),re(le)),Lk=rd.__importDefault(My()),Uk=rd.__importDefault(qy()),Mk=rd.__importDefault(Lp()),qk=ed(),td=class extends Uk.default{constructor(e,r={},n,o){super(e,r,n,o)}from(e){return new Lk.default(this.url,this.headers,e,this.fetch)}get vectors(){return new qk.StorageVectorsClient(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new Mk.default(this.url+"/iceberg",this.headers,this.fetch)}};xu.StorageClient=td});var Ky=x(Wy=>{"use strict";Object.defineProperty(Wy,"__esModule",{value:!0})});var Yy=x(Gr=>{"use strict";Object.defineProperty(Gr,"__esModule",{value:!0});Gr.StorageAnalyticsApi=Gr.StorageClient=void 0;var Su=(fe(),re(le)),Hk=Gy();Object.defineProperty(Gr,"StorageClient",{enumerable:!0,get:function(){return Hk.StorageClient}});var Vk=Lp();Object.defineProperty(Gr,"StorageAnalyticsApi",{enumerable:!0,get:function(){return Su.__importDefault(Vk).default}});Su.__exportStar(Ky(),Gr);Su.__exportStar(hn(),Gr);Su.__exportStar(ed(),Gr)});var Jy=x(Fu=>{"use strict";Object.defineProperty(Fu,"__esModule",{value:!0});Fu.version=void 0;Fu.version="2.79.0"});var Xy=x(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.DEFAULT_REALTIME_OPTIONS=Gt.DEFAULT_AUTH_OPTIONS=Gt.DEFAULT_DB_OPTIONS=Gt.DEFAULT_GLOBAL_OPTIONS=Gt.DEFAULT_HEADERS=void 0;var zk=Jy(),Aa="";typeof Deno<"u"?Aa="deno":typeof document<"u"?Aa="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Aa="react-native":Aa="node";Gt.DEFAULT_HEADERS={"X-Client-Info":`supabase-js-${Aa}/${zk.version}`};Gt.DEFAULT_GLOBAL_OPTIONS={headers:Gt.DEFAULT_HEADERS};Gt.DEFAULT_DB_OPTIONS={schema:"public"};Gt.DEFAULT_AUTH_OPTIONS={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"};Gt.DEFAULT_REALTIME_OPTIONS={}});var Zy=x(Sr=>{"use strict";Object.defineProperty(Sr,"__esModule",{value:!0});Sr.fetchWithAuth=Sr.resolveHeadersConstructor=Sr.resolveFetch=void 0;var Gk=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);Sr.resolveFetch=Gk;var Wk=()=>Headers;Sr.resolveHeadersConstructor=Wk;var Kk=(t,e,r)=>{let n=(0,Sr.resolveFetch)(r),o=(0,Sr.resolveHeadersConstructor)();return async(i,a)=>{var s;let u=(s=await e())!==null&&s!==void 0?s:t,c=new o(a?.headers);return c.has("apikey")||c.set("apikey",t),c.has("Authorization")||c.set("Authorization",`Bearer ${u}`),n(i,Object.assign(Object.assign({},a),{headers:c}))}};Sr.fetchWithAuth=Kk});var e0=x(gn=>{"use strict";Object.defineProperty(gn,"__esModule",{value:!0});gn.isBrowser=void 0;gn.uuid=Yk;gn.ensureTrailingSlash=Qy;gn.applySettingDefaults=Xk;gn.validateSupabaseUrl=Zk;function Yk(){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 Qy(t){return t.endsWith("/")?t:t+"/"}var Jk=()=>typeof window<"u";gn.isBrowser=Jk;function Xk(t,e){var r,n;let{db:o,auth:i,realtime:a,global:s}=t,{db:u,auth:c,realtime:l,global:f}=e,d={db:Object.assign(Object.assign({},u),o),auth:Object.assign(Object.assign({},c),i),realtime:Object.assign(Object.assign({},l),a),storage:{},global:Object.assign(Object.assign(Object.assign({},f),s),{headers:Object.assign(Object.assign({},(r=f?.headers)!==null&&r!==void 0?r:{}),(n=s?.headers)!==null&&n!==void 0?n:{})}),accessToken:async()=>""};return t.accessToken?d.accessToken=t.accessToken:delete d.accessToken,d}function Zk(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(Qy(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}});var md={};qr(md,{AuthAdminApi:()=>od,AuthApiError:()=>id,AuthClient:()=>nd,AuthError:()=>wr,AuthImplicitGrantRedirectError:()=>ld,AuthInvalidCredentialsError:()=>cd,AuthInvalidTokenResponseError:()=>ud,AuthPKCEGrantCodeExchangeError:()=>fd,AuthRetryableError:()=>ad,AuthSessionMissingError:()=>sd,AuthWeakPasswordError:()=>pd,GoTrueAdminApi:()=>Ou,GoTrueClient:()=>Au,NavigatorLockAcquireTimeoutError:()=>dd,isAuthApiError:()=>n3,isAuthError:()=>r3,isAuthRetryableError:()=>o3,isAuthSessionMissingError:()=>i3,isAuthWeakPasswordError:()=>a3,lockInternals:()=>t3,navigatorLock:()=>Qk,processLock:()=>e3});var hd,t0,Au,Ou,nd,od,wr,id,ad,sd,ud,cd,ld,fd,pd,Qk,e3,dd,t3,r3,n3,o3,i3,a3,gd=tt(()=>{hd=()=>Promise.resolve({data:{session:null,user:null},error:null}),t0={get:(t,e)=>{if(e==="constructor")return t.constructor;if(!(e==="then"||e==="catch"||e==="finally")&&typeof e!="symbol")return e==="getSession"?()=>Promise.resolve({data:{session:null,user:null},error:null}):e==="onAuthStateChange"?()=>({data:{subscription:{unsubscribe:()=>{}}},error:null}):hd}},Au=class{constructor(e){return this.options=e,new Proxy(this,t0)}},Ou=class{constructor(e){return this.options=e,new Proxy(this,t0)}},nd=class extends Au{},od=class extends Ou{},wr=class extends Error{},id=class extends wr{},ad=class extends wr{},sd=class extends wr{},ud=class extends wr{},cd=class extends wr{},ld=class extends wr{},fd=class extends wr{},pd=class extends wr{},Qk=hd,e3=hd,dd=class extends Error{},t3={},r3=()=>!1,n3=()=>!1,o3=()=>!1,i3=()=>!1,a3=()=>!1});var r0=x(ku=>{"use strict";Object.defineProperty(ku,"__esModule",{value:!0});ku.SupabaseAuthClient=void 0;var s3=(gd(),re(md)),Dd=class extends s3.AuthClient{constructor(e){super(e)}};ku.SupabaseAuthClient=Dd});var vd=x(bd=>{"use strict";Object.defineProperty(bd,"__esModule",{value:!0});var u3=Qf(),c3=gp(),l3=(bp(),re(yp)),f3=Yy(),$u=Xy(),p3=Zy(),n0=e0(),d3=r0(),yd=class{constructor(e,r,n){var o,i,a;this.supabaseUrl=e,this.supabaseKey=r;let s=(0,n0.validateSupabaseUrl)(e);if(!r)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",s),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",s),this.storageUrl=new URL("storage/v1",s),this.functionsUrl=new URL("functions/v1",s);let u=`sb-${s.hostname.split(".")[0]}-auth-token`,c={db:$u.DEFAULT_DB_OPTIONS,realtime:$u.DEFAULT_REALTIME_OPTIONS,auth:Object.assign(Object.assign({},$u.DEFAULT_AUTH_OPTIONS),{storageKey:u}),global:$u.DEFAULT_GLOBAL_OPTIONS},l=(0,n0.applySettingDefaults)(n??{},c);this.storageKey=(o=l.auth.storageKey)!==null&&o!==void 0?o:"",this.headers=(i=l.global.headers)!==null&&i!==void 0?i:{},l.accessToken?(this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(f,d)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(d)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((a=l.auth)!==null&&a!==void 0?a:{},this.headers,l.global.fetch),this.fetch=(0,p3.fetchWithAuth)(r,this._getAccessToken.bind(this),l.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},l.realtime)),this.rest=new c3.PostgrestClient(new URL("rest/v1",s).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch}),this.storage=new f3.StorageClient(this.storageUrl.href,this.headers,this.fetch,n?.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new u3.FunctionsClient(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,r={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,r,n)}channel(e,r={config:{}}){return this.realtime.channel(e,r)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e,r;if(this.accessToken)return await this.accessToken();let{data:n}=await this.auth.getSession();return(r=(e=n.session)===null||e===void 0?void 0:e.access_token)!==null&&r!==void 0?r:this.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:r,detectSessionInUrl:n,storage:o,userStorage:i,storageKey:a,flowType:s,lock:u,debug:c,throwOnError:l},f,d){let h={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new d3.SupabaseAuthClient({url:this.authUrl.href,headers:Object.assign(Object.assign({},h),f),storageKey:a,autoRefreshToken:e,persistSession:r,detectSessionInUrl:n,storage:o,userStorage:i,flowType:s,lock:u,debug:c,throwOnError:l,fetch:d,hasCustomAuthorizationHeader:Object.keys(this.headers).some(m=>m.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new l3.RealtimeClient(this.realtimeUrl.href,Object.assign(Object.assign({},e),{params:Object.assign({apikey:this.supabaseKey},e?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((r,n)=>{this._handleTokenChanged(r,"CLIENT",n?.access_token)})}_handleTokenChanged(e,r,n){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==n?(this.changedAccessToken=n,this.realtime.setAuth(n)):e==="SIGNED_OUT"&&(this.realtime.setAuth(),r=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};bd.default=yd});var a0=x(Pe=>{"use strict";var h3=Pe&&Pe.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),o0=Pe&&Pe.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&h3(e,t,r)},i0=Pe&&Pe.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Pe,"__esModule",{value:!0});Pe.createClient=Pe.SupabaseClient=Pe.FunctionRegion=Pe.FunctionsError=Pe.FunctionsRelayError=Pe.FunctionsFetchError=Pe.FunctionsHttpError=Pe.PostgrestError=void 0;var m3=i0(vd());o0((gd(),re(md)),Pe);var g3=gp();Object.defineProperty(Pe,"PostgrestError",{enumerable:!0,get:function(){return g3.PostgrestError}});var Oa=Qf();Object.defineProperty(Pe,"FunctionsHttpError",{enumerable:!0,get:function(){return Oa.FunctionsHttpError}});Object.defineProperty(Pe,"FunctionsFetchError",{enumerable:!0,get:function(){return Oa.FunctionsFetchError}});Object.defineProperty(Pe,"FunctionsRelayError",{enumerable:!0,get:function(){return Oa.FunctionsRelayError}});Object.defineProperty(Pe,"FunctionsError",{enumerable:!0,get:function(){return Oa.FunctionsError}});Object.defineProperty(Pe,"FunctionRegion",{enumerable:!0,get:function(){return Oa.FunctionRegion}});o0((bp(),re(yp)),Pe);var D3=vd();Object.defineProperty(Pe,"SupabaseClient",{enumerable:!0,get:function(){return i0(D3).default}});var y3=(t,e,r)=>new m3.default(t,e,r);Pe.createClient=y3;function b3(){if(typeof window<"u"||typeof process>"u")return!1;let t=process.version;if(t==null)return!1;let e=t.match(/^v(\d+)\./);return e?parseInt(e[1],10)<=18:!1}b3()&&console.warn("\u26A0\uFE0F Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217")});var wd=x((pV,s0)=>{s0.exports={LOCHDR:30,LOCSIG:67324752,LOCVER:4,LOCFLG:6,LOCHOW:8,LOCTIM:10,LOCCRC:14,LOCSIZ:18,LOCLEN:22,LOCNAM:26,LOCEXT:28,EXTSIG:134695760,EXTHDR:16,EXTCRC:4,EXTSIZ:8,EXTLEN:12,CENHDR:46,CENSIG:33639248,CENVEM:4,CENVER:6,CENFLG:8,CENHOW:10,CENTIM:12,CENCRC:16,CENSIZ:20,CENLEN:24,CENNAM:28,CENEXT:30,CENCOM:32,CENDSK:34,CENATT:36,CENATX:38,CENOFF:42,ENDHDR:22,ENDSIG:101010256,ENDSUB:8,ENDTOT:10,ENDSIZ:12,ENDOFF:16,ENDCOM:20,END64HDR:20,END64SIG:117853008,END64START:4,END64OFF:8,END64NUMDISKS:16,ZIP64SIG:101075792,ZIP64HDR:56,ZIP64LEAD:12,ZIP64SIZE:4,ZIP64VEM:12,ZIP64VER:14,ZIP64DSK:16,ZIP64DSKDIR:20,ZIP64SUB:24,ZIP64TOT:32,ZIP64SIZB:40,ZIP64OFF:48,ZIP64EXTRA:56,STORED:0,SHRUNK:1,REDUCED1:2,REDUCED2:3,REDUCED3:4,REDUCED4:5,IMPLODED:6,DEFLATED:8,ENHANCED_DEFLATED:9,PKWARE:10,BZIP2:12,LZMA:14,IBM_TERSE:18,IBM_LZ77:19,AES_ENCRYPT:99,FLG_ENC:1,FLG_COMP1:2,FLG_COMP2:4,FLG_DESC:8,FLG_ENH:16,FLG_PATCH:32,FLG_STR:64,FLG_EFS:2048,FLG_MSK:4096,FILE:2,BUFFER:1,NONE:0,EF_ID:0,EF_SIZE:2,ID_ZIP64:1,ID_AVINFO:7,ID_PFS:8,ID_OS2:9,ID_NTFS:10,ID_OPENVMS:12,ID_UNIX:13,ID_FORK:14,ID_PATCH:15,ID_X509_PKCS7:20,ID_X509_CERTID_F:21,ID_X509_CERTID_C:22,ID_STRONGENC:23,ID_RECORD_MGT:24,ID_X509_PKCS7_RL:25,ID_IBM1:101,ID_IBM2:102,ID_POSZIP:18064,EF_ZIP64_OR_32:4294967295,EF_ZIP64_OR_16:65535,EF_ZIP64_SUNCOMP:0,EF_ZIP64_SCOMP:8,EF_ZIP64_RHO:16,EF_ZIP64_DSN:24}});var Pu=x(c0=>{var u0={INVALID_LOC:"Invalid LOC header (bad signature)",INVALID_CEN:"Invalid CEN header (bad signature)",INVALID_END:"Invalid END header (bad signature)",DESCRIPTOR_NOT_EXIST:"No descriptor present",DESCRIPTOR_UNKNOWN:"Unknown descriptor format",DESCRIPTOR_FAULTY:"Descriptor data is malformed",NO_DATA:"Nothing to decompress",BAD_CRC:"CRC32 checksum failed {0}",FILE_IN_THE_WAY:"There is a file in the way: {0}",UNKNOWN_METHOD:"Invalid/unsupported compression method",AVAIL_DATA:"inflate::Available inflate data did not terminate",INVALID_DISTANCE:"inflate::Invalid literal/length or distance code in fixed or dynamic block",TO_MANY_CODES:"inflate::Dynamic block code description: too many length or distance codes",INVALID_REPEAT_LEN:"inflate::Dynamic block code description: repeat more than specified lengths",INVALID_REPEAT_FIRST:"inflate::Dynamic block code description: repeat lengths with no first length",INCOMPLETE_CODES:"inflate::Dynamic block code description: code lengths codes incomplete",INVALID_DYN_DISTANCE:"inflate::Dynamic block code description: invalid distance code lengths",INVALID_CODES_LEN:"inflate::Dynamic block code description: invalid literal/length code lengths",INVALID_STORE_BLOCK:"inflate::Stored block length did not match one's complement",INVALID_BLOCK_TYPE:"inflate::Invalid block type (type == 3)",CANT_EXTRACT_FILE:"Could not extract the file",CANT_OVERRIDE:"Target file already exists",DISK_ENTRY_TOO_LARGE:"Number of disk entries is too large",NO_ZIP:"No zip file was loaded",NO_ENTRY:"Entry doesn't exist",DIRECTORY_CONTENT_ERROR:"A directory cannot have content",FILE_NOT_FOUND:'File not found: "{0}"',NOT_IMPLEMENTED:"Not implemented",INVALID_FILENAME:"Invalid filename",INVALID_FORMAT:"Invalid or unsupported zip format. No END header found",INVALID_PASS_PARAM:"Incompatible password parameter",WRONG_PASSWORD:"Wrong Password",COMMENT_TOO_LONG:"Comment is too long",EXTRA_FIELD_PARSE_ERROR:"Extra field parsing error"};function v3(t){return function(...e){return e.length&&(t=t.replace(/\{(\d)\}/g,(r,n)=>e[n]||"")),new Error("ADM-ZIP: "+t)}}for(let t of Object.keys(u0))c0[t]=v3(u0[t])});var h0=x((hV,d0)=>{var w3=require("fs"),rt=require("path"),l0=wd(),C3=Pu(),E3=typeof process=="object"&&process.platform==="win32",f0=t=>typeof t=="object"&&t!==null,p0=new Uint32Array(256).map((t,e)=>{for(let r=0;r<8;r++)(e&1)!==0?e=3988292384^e>>>1:e>>>=1;return e>>>0});function ze(t){this.sep=rt.sep,this.fs=w3,f0(t)&&f0(t.fs)&&typeof t.fs.statSync=="function"&&(this.fs=t.fs)}d0.exports=ze;ze.prototype.makeDir=function(t){let e=this;function r(n){let o=n.split(e.sep)[0];n.split(e.sep).forEach(function(i){if(!(!i||i.substr(-1,1)===":")){o+=e.sep+i;var a;try{a=e.fs.statSync(o)}catch{e.fs.mkdirSync(o)}if(a&&a.isFile())throw C3.FILE_IN_THE_WAY(`"${o}"`)}})}r(t)};ze.prototype.writeFileTo=function(t,e,r,n){let o=this;if(o.fs.existsSync(t)){if(!r)return!1;var i=o.fs.statSync(t);if(i.isDirectory())return!1}var a=rt.dirname(t);o.fs.existsSync(a)||o.makeDir(a);var s;try{s=o.fs.openSync(t,"w",438)}catch{o.fs.chmodSync(t,438),s=o.fs.openSync(t,"w",438)}if(s)try{o.fs.writeSync(s,e,0,e.length,0)}finally{o.fs.closeSync(s)}return o.fs.chmodSync(t,n||438),!0};ze.prototype.writeFileToAsync=function(t,e,r,n,o){typeof n=="function"&&(o=n,n=void 0);let i=this;i.fs.exists(t,function(a){if(a&&!r)return o(!1);i.fs.stat(t,function(s,u){if(a&&u.isDirectory())return o(!1);var c=rt.dirname(t);i.fs.exists(c,function(l){l||i.makeDir(c),i.fs.open(t,"w",438,function(f,d){f?i.fs.chmod(t,438,function(){i.fs.open(t,"w",438,function(h,m){i.fs.write(m,e,0,e.length,0,function(){i.fs.close(m,function(){i.fs.chmod(t,n||438,function(){o(!0)})})})})}):d?i.fs.write(d,e,0,e.length,0,function(){i.fs.close(d,function(){i.fs.chmod(t,n||438,function(){o(!0)})})}):i.fs.chmod(t,n||438,function(){o(!0)})})})})})};ze.prototype.findFiles=function(t){let e=this;function r(n,o,i){typeof o=="boolean"&&(i=o,o=void 0);let a=[];return e.fs.readdirSync(n).forEach(function(s){let u=rt.join(n,s),c=e.fs.statSync(u);(!o||o.test(u))&&a.push(rt.normalize(u)+(c.isDirectory()?e.sep:"")),c.isDirectory()&&i&&(a=a.concat(r(u,o,i)))}),a}return r(t,void 0,!0)};ze.prototype.findFilesAsync=function(t,e){let r=this,n=[];r.fs.readdir(t,function(o,i){if(o)return e(o);let a=i.length;if(!a)return e(null,n);i.forEach(function(s){s=rt.join(t,s),r.fs.stat(s,function(u,c){if(u)return e(u);c&&(n.push(rt.normalize(s)+(c.isDirectory()?r.sep:"")),c.isDirectory()?r.findFilesAsync(s,function(l,f){if(l)return e(l);n=n.concat(f),--a||e(null,n)}):--a||e(null,n))})})})};ze.prototype.getAttributes=function(){};ze.prototype.setAttributes=function(){};ze.crc32update=function(t,e){return p0[(t^e)&255]^t>>>8};ze.crc32=function(t){typeof t=="string"&&(t=Buffer.from(t,"utf8"));let e=t.length,r=-1;for(let n=0;n<e;)r=ze.crc32update(r,t[n++]);return~r>>>0};ze.methodToString=function(t){switch(t){case l0.STORED:return"STORED ("+t+")";case l0.DEFLATED:return"DEFLATED ("+t+")";default:return"UNSUPPORTED ("+t+")"}};ze.canonical=function(t){if(!t)return"";let e=rt.posix.normalize("/"+t.split("\\").join("/"));return rt.join(".",e)};ze.zipnamefix=function(t){if(!t)return"";let e=rt.posix.normalize("/"+t.split("\\").join("/"));return rt.posix.join(".",e)};ze.findLast=function(t,e){if(!Array.isArray(t))throw new TypeError("arr is not array");let r=t.length>>>0;for(let n=r-1;n>=0;n--)if(e(t[n],n,t))return t[n]};ze.sanitize=function(t,e){t=rt.resolve(rt.normalize(t));for(var r=e.split("/"),n=0,o=r.length;n<o;n++){var i=rt.normalize(rt.join(t,r.slice(n,o).join(rt.sep)));if(i.indexOf(t)===0)return i}return rt.normalize(rt.join(t,rt.basename(e)))};ze.toBuffer=function(e,r){return Buffer.isBuffer(e)?e:e instanceof Uint8Array?Buffer.from(e):typeof e=="string"?r(e):Buffer.alloc(0)};ze.readBigUInt64LE=function(t,e){var r=Buffer.from(t.slice(e,e+8));return r.swap64(),parseInt(`0x${r.toString("hex")}`)};ze.fromDOS2Date=function(t){return new Date((t>>25&127)+1980,Math.max((t>>21&15)-1,0),Math.max(t>>16&31,1),t>>11&31,t>>5&63,(t&31)<<1)};ze.fromDate2DOS=function(t){let e=0,r=0;return t.getFullYear()>1979&&(e=(t.getFullYear()-1980&127)<<9|t.getMonth()+1<<5|t.getDate(),r=t.getHours()<<11|t.getMinutes()<<5|t.getSeconds()>>1),e<<16|r};ze.isWin=E3;ze.crcTable=p0});var g0=x((mV,m0)=>{var _3=require("path");m0.exports=function(t,{fs:e}){var r=t||"",n=i(),o=null;function i(){return{directory:!1,readonly:!1,hidden:!1,executable:!1,mtime:0,atime:0}}return r&&e.existsSync(r)?(o=e.statSync(r),n.directory=o.isDirectory(),n.mtime=o.mtime,n.atime=o.atime,n.executable=(73&o.mode)!==0,n.readonly=(128&o.mode)===0,n.hidden=_3.basename(r)[0]==="."):console.warn("Invalid path: "+r),{get directory(){return n.directory},get readOnly(){return n.readonly},get hidden(){return n.hidden},get mtime(){return n.mtime},get atime(){return n.atime},get executable(){return n.executable},decodeAttributes:function(){},encodeAttributes:function(){},toJSON:function(){return{path:r,isDirectory:n.directory,isReadOnly:n.readonly,isHidden:n.hidden,isExecutable:n.executable,mTime:n.mtime,aTime:n.atime}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var y0=x((gV,D0)=>{D0.exports={efs:!0,encode:t=>Buffer.from(t,"utf8"),decode:t=>t.toString("utf8")}});var Jo=x((DV,Yo)=>{Yo.exports=h0();Yo.exports.Constants=wd();Yo.exports.Errors=Pu();Yo.exports.FileAttr=g0();Yo.exports.decoder=y0()});var v0=x((yV,b0)=>{var Dn=Jo(),W=Dn.Constants;b0.exports=function(){var t=20,e=10,r=0,n=0,o=0,i=0,a=0,s=0,u=0,c=0,l=0,f=0,d=0,h=0,m=0;t|=Dn.isWin?2560:768,r|=W.FLG_EFS;let b={extraLen:0},D=g=>Math.max(0,g)>>>0,C=g=>Math.max(0,g)&65535,E=g=>Math.max(0,g)&255;return o=Dn.fromDate2DOS(new Date),{get made(){return t},set made(g){t=g},get version(){return e},set version(g){e=g},get flags(){return r},set flags(g){r=g},get flags_efs(){return(r&W.FLG_EFS)>0},set flags_efs(g){g?r|=W.FLG_EFS:r&=~W.FLG_EFS},get flags_desc(){return(r&W.FLG_DESC)>0},set flags_desc(g){g?r|=W.FLG_DESC:r&=~W.FLG_DESC},get method(){return n},set method(g){switch(g){case W.STORED:this.version=10;case W.DEFLATED:default:this.version=20}n=g},get time(){return Dn.fromDOS2Date(this.timeval)},set time(g){this.timeval=Dn.fromDate2DOS(g)},get timeval(){return o},set timeval(g){o=D(g)},get timeHighByte(){return E(o>>>8)},get crc(){return i},set crc(g){i=D(g)},get compressedSize(){return a},set compressedSize(g){a=D(g)},get size(){return s},set size(g){s=D(g)},get fileNameLength(){return u},set fileNameLength(g){u=g},get extraLength(){return c},set extraLength(g){c=g},get extraLocalLength(){return b.extraLen},set extraLocalLength(g){b.extraLen=g},get commentLength(){return l},set commentLength(g){l=g},get diskNumStart(){return f},set diskNumStart(g){f=D(g)},get inAttr(){return d},set inAttr(g){d=D(g)},get attr(){return h},set attr(g){h=D(g)},get fileAttr(){return(h||0)>>16&4095},get offset(){return m},set offset(g){m=D(g)},get encrypted(){return(r&W.FLG_ENC)===W.FLG_ENC},get centralHeaderSize(){return W.CENHDR+u+c+l},get realDataOffset(){return m+W.LOCHDR+b.fnameLen+b.extraLen},get localHeader(){return b},loadLocalHeaderFromBinary:function(g){var _=g.slice(m,m+W.LOCHDR);if(_.readUInt32LE(0)!==W.LOCSIG)throw Dn.Errors.INVALID_LOC();b.version=_.readUInt16LE(W.LOCVER),b.flags=_.readUInt16LE(W.LOCFLG),b.method=_.readUInt16LE(W.LOCHOW),b.time=_.readUInt32LE(W.LOCTIM),b.crc=_.readUInt32LE(W.LOCCRC),b.compressedSize=_.readUInt32LE(W.LOCSIZ),b.size=_.readUInt32LE(W.LOCLEN),b.fnameLen=_.readUInt16LE(W.LOCNAM),b.extraLen=_.readUInt16LE(W.LOCEXT);let S=m+W.LOCHDR+b.fnameLen,I=S+b.extraLen;return g.slice(S,I)},loadFromBinary:function(g){if(g.length!==W.CENHDR||g.readUInt32LE(0)!==W.CENSIG)throw Dn.Errors.INVALID_CEN();t=g.readUInt16LE(W.CENVEM),e=g.readUInt16LE(W.CENVER),r=g.readUInt16LE(W.CENFLG),n=g.readUInt16LE(W.CENHOW),o=g.readUInt32LE(W.CENTIM),i=g.readUInt32LE(W.CENCRC),a=g.readUInt32LE(W.CENSIZ),s=g.readUInt32LE(W.CENLEN),u=g.readUInt16LE(W.CENNAM),c=g.readUInt16LE(W.CENEXT),l=g.readUInt16LE(W.CENCOM),f=g.readUInt16LE(W.CENDSK),d=g.readUInt16LE(W.CENATT),h=g.readUInt32LE(W.CENATX),m=g.readUInt32LE(W.CENOFF)},localHeaderToBinary:function(){var g=Buffer.alloc(W.LOCHDR);return g.writeUInt32LE(W.LOCSIG,0),g.writeUInt16LE(e,W.LOCVER),g.writeUInt16LE(r,W.LOCFLG),g.writeUInt16LE(n,W.LOCHOW),g.writeUInt32LE(o,W.LOCTIM),g.writeUInt32LE(i,W.LOCCRC),g.writeUInt32LE(a,W.LOCSIZ),g.writeUInt32LE(s,W.LOCLEN),g.writeUInt16LE(u,W.LOCNAM),g.writeUInt16LE(b.extraLen,W.LOCEXT),g},centralHeaderToBinary:function(){var g=Buffer.alloc(W.CENHDR+u+c+l);return g.writeUInt32LE(W.CENSIG,0),g.writeUInt16LE(t,W.CENVEM),g.writeUInt16LE(e,W.CENVER),g.writeUInt16LE(r,W.CENFLG),g.writeUInt16LE(n,W.CENHOW),g.writeUInt32LE(o,W.CENTIM),g.writeUInt32LE(i,W.CENCRC),g.writeUInt32LE(a,W.CENSIZ),g.writeUInt32LE(s,W.CENLEN),g.writeUInt16LE(u,W.CENNAM),g.writeUInt16LE(c,W.CENEXT),g.writeUInt16LE(l,W.CENCOM),g.writeUInt16LE(f,W.CENDSK),g.writeUInt16LE(d,W.CENATT),g.writeUInt32LE(h,W.CENATX),g.writeUInt32LE(m,W.CENOFF),g},toJSON:function(){let g=function(_){return _+" bytes"};return{made:t,version:e,flags:r,method:Dn.methodToString(n),time:this.time,crc:"0x"+i.toString(16).toUpperCase(),compressedSize:g(a),size:g(s),fileNameLength:g(u),extraLength:g(c),commentLength:g(l),diskNumStart:f,inAttr:d,attr:h,offset:m,centralHeaderSize:g(W.CENHDR+u+c+l)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var C0=x((bV,w0)=>{var Xo=Jo(),Me=Xo.Constants;w0.exports=function(){var t=0,e=0,r=0,n=0,o=0;return{get diskEntries(){return t},set diskEntries(i){t=e=i},get totalEntries(){return e},set totalEntries(i){e=t=i},get size(){return r},set size(i){r=i},get offset(){return n},set offset(i){n=i},get commentLength(){return o},set commentLength(i){o=i},get mainHeaderSize(){return Me.ENDHDR+o},loadFromBinary:function(i){if((i.length!==Me.ENDHDR||i.readUInt32LE(0)!==Me.ENDSIG)&&(i.length<Me.ZIP64HDR||i.readUInt32LE(0)!==Me.ZIP64SIG))throw Xo.Errors.INVALID_END();i.readUInt32LE(0)===Me.ENDSIG?(t=i.readUInt16LE(Me.ENDSUB),e=i.readUInt16LE(Me.ENDTOT),r=i.readUInt32LE(Me.ENDSIZ),n=i.readUInt32LE(Me.ENDOFF),o=i.readUInt16LE(Me.ENDCOM)):(t=Xo.readBigUInt64LE(i,Me.ZIP64SUB),e=Xo.readBigUInt64LE(i,Me.ZIP64TOT),r=Xo.readBigUInt64LE(i,Me.ZIP64SIZE),n=Xo.readBigUInt64LE(i,Me.ZIP64OFF),o=0)},toBinary:function(){var i=Buffer.alloc(Me.ENDHDR+o);return i.writeUInt32LE(Me.ENDSIG,0),i.writeUInt32LE(0,4),i.writeUInt16LE(t,Me.ENDSUB),i.writeUInt16LE(e,Me.ENDTOT),i.writeUInt32LE(r,Me.ENDSIZ),i.writeUInt32LE(n,Me.ENDOFF),i.writeUInt16LE(o,Me.ENDCOM),i.fill(" ",Me.ENDHDR),i},toJSON:function(){let i=function(a,s){let u=a.toString(16).toUpperCase();for(;u.length<s;)u="0"+u;return"0x"+u};return{diskEntries:t,totalEntries:e,size:r+" bytes",offset:i(n,4),commentLength:o}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var Ed=x(Cd=>{Cd.EntryHeader=v0();Cd.MainHeader=C0()});var _0=x((wV,E0)=>{E0.exports=function(t){var e=require("zlib"),r={chunkSize:(parseInt(t.length/1024)+1)*1024};return{deflate:function(){return e.deflateRawSync(t,r)},deflateAsync:function(n){var o=e.createDeflateRaw(r),i=[],a=0;o.on("data",function(s){i.push(s),a+=s.length}),o.on("end",function(){var s=Buffer.alloc(a),u=0;s.fill(0);for(var c=0;c<i.length;c++){var l=i[c];l.copy(s,u),u+=l.length}n&&n(s)}),o.end(t)}}}});var S0=x((CV,x0)=>{var x3=+(process.versions?process.versions.node:"").split(".")[0]||0;x0.exports=function(t,e){var r=require("zlib");let n=x3>=15&&e>0?{maxOutputLength:e}:{};return{inflate:function(){return r.inflateRawSync(t,n)},inflateAsync:function(o){var i=r.createInflateRaw(n),a=[],s=0;i.on("data",function(u){a.push(u),s+=u.length}),i.on("end",function(){var u=Buffer.alloc(s),c=0;u.fill(0);for(var l=0;l<a.length;l++){var f=a[l];f.copy(u,c),c+=f.length}o&&o(u)}),i.end(t)}}}});var $0=x((EV,k0)=>{"use strict";var{randomFillSync:F0}=require("crypto"),S3=Pu(),F3=new Uint32Array(256).map((t,e)=>{for(let r=0;r<8;r++)(e&1)!==0?e=e>>>1^3988292384:e>>>=1;return e>>>0}),O0=(t,e)=>Math.imul(t,e)>>>0,A0=(t,e)=>F3[(t^e)&255]^t>>>8,ka=()=>typeof F0=="function"?F0(Buffer.alloc(12)):ka.node();ka.node=()=>{let t=Buffer.alloc(12),e=t.length;for(let r=0;r<e;r++)t[r]=Math.random()*256&255;return t};var Tu={genSalt:ka};function Iu(t){let e=Buffer.isBuffer(t)?t:Buffer.from(t);this.keys=new Uint32Array([305419896,591751049,878082192]);for(let r=0;r<e.length;r++)this.updateKeys(e[r])}Iu.prototype.updateKeys=function(t){let e=this.keys;return e[0]=A0(e[0],t),e[1]+=e[0]&255,e[1]=O0(e[1],134775813)+1,e[2]=A0(e[2],e[1]>>>24),t};Iu.prototype.next=function(){let t=(this.keys[2]|2)>>>0;return O0(t,t^1)>>8&255};function A3(t){let e=new Iu(t);return function(r){let n=Buffer.alloc(r.length),o=0;for(let i of r)n[o++]=e.updateKeys(i^e.next());return n}}function O3(t){let e=new Iu(t);return function(r,n,o=0){n||(n=Buffer.alloc(r.length));for(let i of r){let a=e.next();n[o++]=i^a,e.updateKeys(i)}return n}}function k3(t,e,r){if(!t||!Buffer.isBuffer(t)||t.length<12)return Buffer.alloc(0);let n=A3(r),o=n(t.slice(0,12)),i=(e.flags&8)===8?e.timeHighByte:e.crc>>>24;if(o[11]!==i)throw S3.WRONG_PASSWORD();return n(t.slice(12))}function $3(t){Buffer.isBuffer(t)&&t.length>=12?Tu.genSalt=function(){return t.slice(0,12)}:t==="node"?Tu.genSalt=ka.node:Tu.genSalt=ka}function P3(t,e,r,n=!1){t==null&&(t=Buffer.alloc(0)),Buffer.isBuffer(t)||(t=Buffer.from(t.toString()));let o=O3(r),i=Tu.genSalt();i[11]=e.crc>>>24&255,n&&(i[10]=e.crc>>>16&255);let a=Buffer.alloc(t.length+12);return o(i,a),o(t,a,12)}k0.exports={decrypt:k3,encrypt:P3,_salter:$3}});var P0=x(Ru=>{Ru.Deflater=_0();Ru.Inflater=S0();Ru.ZipCrypto=$0()});var xd=x((xV,T0)=>{var xe=Jo(),T3=Ed(),Ge=xe.Constants,_d=P0();T0.exports=function(t,e){var r=new T3.EntryHeader,n=Buffer.alloc(0),o=Buffer.alloc(0),i=!1,a=null,s=Buffer.alloc(0),u=Buffer.alloc(0),c=!0;let l=t,f=typeof l.decoder=="object"?l.decoder:xe.decoder;c=f.hasOwnProperty("efs")?f.efs:!1;function d(){return!e||!(e instanceof Uint8Array)?Buffer.alloc(0):(u=r.loadLocalHeaderFromBinary(e),e.slice(r.realDataOffset,r.realDataOffset+r.compressedSize))}function h(g){if(r.flags_desc){let _={},S=r.realDataOffset+r.compressedSize;if(e.readUInt32LE(S)==Ge.LOCSIG||e.readUInt32LE(S)==Ge.CENSIG)throw xe.Errors.DESCRIPTOR_NOT_EXIST();if(e.readUInt32LE(S)==Ge.EXTSIG)_.crc=e.readUInt32LE(S+Ge.EXTCRC),_.compressedSize=e.readUInt32LE(S+Ge.EXTSIZ),_.size=e.readUInt32LE(S+Ge.EXTLEN);else if(e.readUInt16LE(S+12)===19280)_.crc=e.readUInt32LE(S+Ge.EXTCRC-4),_.compressedSize=e.readUInt32LE(S+Ge.EXTSIZ-4),_.size=e.readUInt32LE(S+Ge.EXTLEN-4);else throw xe.Errors.DESCRIPTOR_UNKNOWN();if(_.compressedSize!==r.compressedSize||_.size!==r.size||_.crc!==r.crc)throw xe.Errors.DESCRIPTOR_FAULTY();if(xe.crc32(g)!==_.crc)return!1}else if(xe.crc32(g)!==r.localHeader.crc)return!1;return!0}function m(g,_,S){if(typeof _>"u"&&typeof g=="string"&&(S=g,g=void 0),i)return g&&_&&_(Buffer.alloc(0),xe.Errors.DIRECTORY_CONTENT_ERROR()),Buffer.alloc(0);var I=d();if(I.length===0)return g&&_&&_(I),I;if(r.encrypted){if(typeof S!="string"&&!Buffer.isBuffer(S))throw xe.Errors.INVALID_PASS_PARAM();I=_d.ZipCrypto.decrypt(I,r,S)}var O=Buffer.alloc(r.size);switch(r.method){case xe.Constants.STORED:if(I.copy(O),h(O))return g&&_&&_(O),O;throw g&&_&&_(O,xe.Errors.BAD_CRC()),xe.Errors.BAD_CRC();case xe.Constants.DEFLATED:var B=new _d.Inflater(I,r.size);if(g)B.inflateAsync(function(R){R.copy(R,0),_&&(h(R)?_(R):_(R,xe.Errors.BAD_CRC()))});else{if(B.inflate(O).copy(O,0),!h(O))throw xe.Errors.BAD_CRC(`"${f.decode(n)}"`);return O}break;default:throw g&&_&&_(Buffer.alloc(0),xe.Errors.UNKNOWN_METHOD()),xe.Errors.UNKNOWN_METHOD()}}function b(g,_){if((!a||!a.length)&&Buffer.isBuffer(e))return g&&_&&_(d()),d();if(a.length&&!i){var S;switch(r.method){case xe.Constants.STORED:return r.compressedSize=r.size,S=Buffer.alloc(a.length),a.copy(S),g&&_&&_(S),S;default:case xe.Constants.DEFLATED:var I=new _d.Deflater(a);if(g)I.deflateAsync(function(B){S=Buffer.alloc(B.length),r.compressedSize=B.length,B.copy(S),_&&_(S)});else{var O=I.deflate();return r.compressedSize=O.length,O}I=null;break}}else if(g&&_)_(Buffer.alloc(0));else return Buffer.alloc(0)}function D(g,_){return(g.readUInt32LE(_+4)<<4)+g.readUInt32LE(_)}function C(g){try{for(var _=0,S,I,O;_+4<g.length;)S=g.readUInt16LE(_),_+=2,I=g.readUInt16LE(_),_+=2,O=g.slice(_,_+I),_+=I,Ge.ID_ZIP64===S&&E(O)}catch{throw xe.Errors.EXTRA_FIELD_PARSE_ERROR()}}function E(g){var _,S,I,O;g.length>=Ge.EF_ZIP64_SCOMP&&(_=D(g,Ge.EF_ZIP64_SUNCOMP),r.size===Ge.EF_ZIP64_OR_32&&(r.size=_)),g.length>=Ge.EF_ZIP64_RHO&&(S=D(g,Ge.EF_ZIP64_SCOMP),r.compressedSize===Ge.EF_ZIP64_OR_32&&(r.compressedSize=S)),g.length>=Ge.EF_ZIP64_DSN&&(I=D(g,Ge.EF_ZIP64_RHO),r.offset===Ge.EF_ZIP64_OR_32&&(r.offset=I)),g.length>=Ge.EF_ZIP64_DSN+4&&(O=g.readUInt32LE(Ge.EF_ZIP64_DSN),r.diskNumStart===Ge.EF_ZIP64_OR_16&&(r.diskNumStart=O))}return{get entryName(){return f.decode(n)},get rawEntryName(){return n},set entryName(g){n=xe.toBuffer(g,f.encode);var _=n[n.length-1];i=_===47||_===92,r.fileNameLength=n.length},get efs(){return typeof c=="function"?c(this.entryName):c},get extra(){return s},set extra(g){s=g,r.extraLength=g.length,C(g)},get comment(){return f.decode(o)},set comment(g){if(o=xe.toBuffer(g,f.encode),r.commentLength=o.length,o.length>65535)throw xe.Errors.COMMENT_TOO_LONG()},get name(){var g=f.decode(n);return i?g.substr(g.length-1).split("/").pop():g.split("/").pop()},get isDirectory(){return i},getCompressedData:function(){return b(!1,null)},getCompressedDataAsync:function(g){b(!0,g)},setData:function(g){a=xe.toBuffer(g,xe.decoder.encode),!i&&a.length?(r.size=a.length,r.method=xe.Constants.DEFLATED,r.crc=xe.crc32(g),r.changed=!0):r.method=xe.Constants.STORED},getData:function(g){return r.changed?a:m(!1,null,g)},getDataAsync:function(g,_){r.changed?g(a):m(!0,g,_)},set attr(g){r.attr=g},get attr(){return r.attr},set header(g){r.loadFromBinary(g)},get header(){return r},packCentralHeader:function(){r.flags_efs=this.efs,r.extraLength=s.length;var g=r.centralHeaderToBinary(),_=xe.Constants.CENHDR;return n.copy(g,_),_+=n.length,s.copy(g,_),_+=r.extraLength,o.copy(g,_),g},packLocalHeader:function(){let g=0;r.flags_efs=this.efs,r.extraLocalLength=u.length;let _=r.localHeaderToBinary(),S=Buffer.alloc(_.length+n.length+r.extraLocalLength);return _.copy(S,g),g+=_.length,n.copy(S,g),g+=n.length,u.copy(S,g),g+=u.length,S},toJSON:function(){let g=function(_){return"<"+(_&&_.length+" bytes buffer"||"null")+">"};return{entryName:this.entryName,name:this.name,comment:this.comment,isDirectory:this.isDirectory,header:r.toJSON(),compressedData:g(e),data:g(a)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var B0=x((SV,R0)=>{var I0=xd(),I3=Ed(),dt=Jo();R0.exports=function(t,e){var r=[],n={},o=Buffer.alloc(0),i=new I3.MainHeader,a=!1,s=null;let u=new Set,c=e,{noSort:l,decoder:f}=c;t?m(c.readEntries):a=!0;function d(){let D=new Set;for(let C of Object.keys(n)){let E=C.split("/");if(E.pop(),!!E.length)for(let g=0;g<E.length;g++){let _=E.slice(0,g+1).join("/")+"/";D.add(_)}}for(let C of D)if(!(C in n)){let E=new I0(c);E.entryName=C,E.attr=16,E.temporary=!0,r.push(E),n[E.entryName]=E,u.add(E)}}function h(){if(a=!0,n={},i.diskEntries>(t.length-i.offset)/dt.Constants.CENHDR)throw dt.Errors.DISK_ENTRY_TOO_LARGE();r=new Array(i.diskEntries);for(var D=i.offset,C=0;C<r.length;C++){var E=D,g=new I0(c,t);g.header=t.slice(E,E+=dt.Constants.CENHDR),g.entryName=t.slice(E,E+=g.header.fileNameLength),g.header.extraLength&&(g.extra=t.slice(E,E+=g.header.extraLength)),g.header.commentLength&&(g.comment=t.slice(E,E+g.header.commentLength)),D+=g.header.centralHeaderSize,r[C]=g,n[g.entryName]=g}u.clear(),d()}function m(D){var C=t.length-dt.Constants.ENDHDR,E=Math.max(0,C-65535),g=E,_=t.length,S=-1,I=0;for((typeof c.trailingSpace=="boolean"?c.trailingSpace:!1)&&(E=0),C;C>=g;C--)if(t[C]===80){if(t.readUInt32LE(C)===dt.Constants.ENDSIG){S=C,I=C,_=C+dt.Constants.ENDHDR,g=C-dt.Constants.END64HDR;continue}if(t.readUInt32LE(C)===dt.Constants.END64SIG){g=E;continue}if(t.readUInt32LE(C)===dt.Constants.ZIP64SIG){S=C,_=C+dt.readBigUInt64LE(t,C+dt.Constants.ZIP64SIZE)+dt.Constants.ZIP64LEAD;break}}if(S==-1)throw dt.Errors.INVALID_FORMAT();i.loadFromBinary(t.slice(S,_)),i.commentLength&&(o=t.slice(I+dt.Constants.ENDHDR)),D&&h()}function b(){r.length>1&&!l&&r.sort((D,C)=>D.entryName.toLowerCase().localeCompare(C.entryName.toLowerCase()))}return{get entries(){return a||h(),r.filter(D=>!u.has(D))},get comment(){return f.decode(o)},set comment(D){o=dt.toBuffer(D,f.encode),i.commentLength=o.length},getEntryCount:function(){return a?r.length:i.diskEntries},forEach:function(D){this.entries.forEach(D)},getEntry:function(D){return a||h(),n[D]||null},setEntry:function(D){a||h(),r.push(D),n[D.entryName]=D,i.totalEntries=r.length},deleteFile:function(D,C=!0){a||h();let E=n[D];this.getEntryChildren(E,C).map(_=>_.entryName).forEach(this.deleteEntry)},deleteEntry:function(D){a||h();let C=n[D],E=r.indexOf(C);E>=0&&(r.splice(E,1),delete n[D],i.totalEntries=r.length)},getEntryChildren:function(D,C=!0){if(a||h(),typeof D=="object")if(D.isDirectory&&C){let E=[],g=D.entryName;for(let _ of r)_.entryName.startsWith(g)&&E.push(_);return E}else return[D];return[]},getChildCount:function(D){if(D&&D.isDirectory){let C=this.getEntryChildren(D);return C.includes(D)?C.length-1:C.length}return 0},compressToBuffer:function(){a||h(),b();let D=[],C=[],E=0,g=0;i.size=0,i.offset=0;let _=0;for(let O of this.entries){let B=O.getCompressedData();O.header.offset=g;let R=O.packLocalHeader(),N=R.length+B.length;g+=N,D.push(R),D.push(B);let A=O.packCentralHeader();C.push(A),i.size+=A.length,E+=N+A.length,_++}E+=i.mainHeaderSize,i.offset=g,i.totalEntries=_,g=0;let S=Buffer.alloc(E);for(let O of D)O.copy(S,g),g+=O.length;for(let O of C)O.copy(S,g),g+=O.length;let I=i.toBinary();return o&&o.copy(I,dt.Constants.ENDHDR),I.copy(S,g),t=S,a=!1,S},toAsyncBuffer:function(D,C,E,g){try{a||h(),b();let _=[],S=[],I=0,O=0,B=0;i.size=0,i.offset=0;let R=function(N){if(N.length>0){let A=N.shift(),L=A.entryName+A.extra.toString();E&&E(L),A.getCompressedDataAsync(function(q){g&&g(L),A.header.offset=O;let Q=A.packLocalHeader(),$=Q.length+q.length;O+=$,_.push(Q),_.push(q);let y=A.packCentralHeader();S.push(y),i.size+=y.length,I+=$+y.length,B++,R(N)})}else{I+=i.mainHeaderSize,i.offset=O,i.totalEntries=B,O=0;let A=Buffer.alloc(I);_.forEach(function(q){q.copy(A,O),O+=q.length}),S.forEach(function(q){q.copy(A,O),O+=q.length});let L=i.toBinary();o&&o.copy(L,dt.Constants.ENDHDR),L.copy(A,O),t=A,a=!1,D(A)}};R(Array.from(this.entries))}catch(_){C(_)}}}}});var L0=x((FV,N0)=>{var qe=Jo(),We=require("path"),R3=xd(),B3=B0(),Gn=(...t)=>qe.findLast(t,e=>typeof e=="boolean"),j0=(...t)=>qe.findLast(t,e=>typeof e=="string"),j3=(...t)=>qe.findLast(t,e=>typeof e=="function"),N3={noSort:!1,readEntries:!1,method:qe.Constants.NONE,fs:null};N0.exports=function(t,e){let r=null,n=Object.assign(Object.create(null),N3);t&&typeof t=="object"&&(t instanceof Uint8Array||(Object.assign(n,t),t=n.input?n.input:void 0,n.input&&delete n.input),Buffer.isBuffer(t)&&(r=t,n.method=qe.Constants.BUFFER,t=void 0)),Object.assign(n,e);let o=new qe(n);if((typeof n.decoder!="object"||typeof n.decoder.encode!="function"||typeof n.decoder.decode!="function")&&(n.decoder=qe.decoder),t&&typeof t=="string")if(o.fs.existsSync(t))n.method=qe.Constants.FILE,n.filename=t,r=o.fs.readFileSync(t);else throw qe.Errors.INVALID_FILENAME();let i=new B3(r,n),{canonical:a,sanitize:s,zipnamefix:u}=qe;function c(h){if(h&&i){var m;if(typeof h=="string"&&(m=i.getEntry(We.posix.normalize(h))),typeof h=="object"&&typeof h.entryName<"u"&&typeof h.header<"u"&&(m=i.getEntry(h.entryName)),m)return m}return null}function l(h){let{join:m,normalize:b,sep:D}=We.posix;return m(".",b(D+h.split("\\").join(D)+D))}function f(h){return h instanceof RegExp?(function(m){return function(b){return m.test(b)}})(h):typeof h!="function"?()=>!0:h}let d=(h,m)=>{let b=m.slice(-1);return b=b===o.sep?o.sep:"",We.relative(h,m)+b};return{readFile:function(h,m){var b=c(h);return b&&b.getData(m)||null},childCount:function(h){let m=c(h);if(m)return i.getChildCount(m)},readFileAsync:function(h,m){var b=c(h);b?b.getDataAsync(m):m(null,"getEntry failed for:"+h)},readAsText:function(h,m){var b=c(h);if(b){var D=b.getData();if(D&&D.length)return D.toString(m||"utf8")}return""},readAsTextAsync:function(h,m,b){var D=c(h);D?D.getDataAsync(function(C,E){if(E){m(C,E);return}C&&C.length?m(C.toString(b||"utf8")):m("")}):m("")},deleteFile:function(h,m=!0){var b=c(h);b&&i.deleteFile(b.entryName,m)},deleteEntry:function(h){var m=c(h);m&&i.deleteEntry(m.entryName)},addZipComment:function(h){i.comment=h},getZipComment:function(){return i.comment||""},addZipEntryComment:function(h,m){var b=c(h);b&&(b.comment=m)},getZipEntryComment:function(h){var m=c(h);return m&&m.comment||""},updateFile:function(h,m){var b=c(h);b&&b.setData(m)},addLocalFile:function(h,m,b,D){if(o.fs.existsSync(h)){m=m?l(m):"";let C=We.win32.basename(We.win32.normalize(h));m+=b||C;let E=o.fs.statSync(h),g=E.isFile()?o.fs.readFileSync(h):Buffer.alloc(0);E.isDirectory()&&(m+=o.sep),this.addFile(m,g,D,E)}else throw qe.Errors.FILE_NOT_FOUND(h)},addLocalFileAsync:function(h,m){h=typeof h=="object"?h:{localPath:h};let b=We.resolve(h.localPath),{comment:D}=h,{zipPath:C,zipName:E}=h,g=this;o.fs.stat(b,function(_,S){if(_)return m(_,!1);C=C?l(C):"";let I=We.win32.basename(We.win32.normalize(b));if(C+=E||I,S.isFile())o.fs.readFile(b,function(O,B){return O?m(O,!1):(g.addFile(C,B,D,S),setImmediate(m,void 0,!0))});else if(S.isDirectory())return C+=o.sep,g.addFile(C,Buffer.alloc(0),D,S),setImmediate(m,void 0,!0)})},addLocalFolder:function(h,m,b){if(b=f(b),m=m?l(m):"",h=We.normalize(h),o.fs.existsSync(h)){let D=o.findFiles(h),C=this;if(D.length)for(let E of D){let g=We.join(m,d(h,E));b(g)&&C.addLocalFile(E,We.dirname(g))}}else throw qe.Errors.FILE_NOT_FOUND(h)},addLocalFolderAsync:function(h,m,b,D){D=f(D),b=b?l(b):"",h=We.normalize(h);var C=this;o.fs.open(h,"r",function(E){if(E&&E.code==="ENOENT")m(void 0,qe.Errors.FILE_NOT_FOUND(h));else if(E)m(void 0,E);else{var g=o.findFiles(h),_=-1,S=function(){if(_+=1,_<g.length){var I=g[_],O=d(h,I).split("\\").join("/");O=O.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),D(O)?o.fs.stat(I,function(B,R){B&&m(void 0,B),R.isFile()?o.fs.readFile(I,function(N,A){N?m(void 0,N):(C.addFile(b+O,A,"",R),S())}):(C.addFile(b+O+"/",Buffer.alloc(0),"",R),S())}):process.nextTick(()=>{S()})}else m(!0,void 0)};S()}})},addLocalFolderAsync2:function(h,m){let b=this;h=typeof h=="object"?h:{localPath:h},localPath=We.resolve(l(h.localPath));let{zipPath:D,filter:C,namefix:E}=h;C instanceof RegExp?C=(function(S){return function(I){return S.test(I)}})(C):typeof C!="function"&&(C=function(){return!0}),D=D?l(D):"",E=="latin1"&&(E=S=>S.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,"")),typeof E!="function"&&(E=S=>S);let g=S=>We.join(D,E(d(localPath,S))),_=S=>We.win32.basename(We.win32.normalize(E(S)));o.fs.open(localPath,"r",function(S){S&&S.code==="ENOENT"?m(void 0,qe.Errors.FILE_NOT_FOUND(localPath)):S?m(void 0,S):o.findFilesAsync(localPath,function(I,O){if(I)return m(I);O=O.filter(B=>C(g(B))),O.length||m(void 0,!1),setImmediate(O.reverse().reduce(function(B,R){return function(N,A){if(N||A===!1)return setImmediate(B,N,!1);b.addLocalFileAsync({localPath:R,zipPath:We.dirname(g(R)),zipName:_(R)},B)}},m))})})},addLocalFolderPromise:function(h,m){return new Promise((b,D)=>{this.addLocalFolderAsync2(Object.assign({localPath:h},m),(C,E)=>{C&&D(C),E&&b(this)})})},addFile:function(h,m,b,D){h=u(h);let C=c(h),E=C!=null;E||(C=new R3(n),C.entryName=h),C.comment=b||"";let g=typeof D=="object"&&D instanceof o.fs.Stats;g&&(C.header.time=D.mtime);var _=C.isDirectory?16:0;let S=C.isDirectory?16384:32768;return g?S|=4095&D.mode:typeof D=="number"?S|=4095&D:S|=C.isDirectory?493:420,_=(_|S<<16)>>>0,C.attr=_,C.setData(m),E||i.setEntry(C),C},getEntries:function(h){return i.password=h,i?i.entries:[]},getEntry:function(h){return c(h)},getEntryCount:function(){return i.getEntryCount()},forEach:function(h){return i.forEach(h)},extractEntryTo:function(h,m,b,D,C,E){D=Gn(!1,D),C=Gn(!1,C),b=Gn(!0,b),E=j0(C,E);var g=c(h);if(!g)throw qe.Errors.NO_ENTRY();var _=a(g.entryName),S=s(m,E&&!g.isDirectory?E:b?_:We.basename(_));if(g.isDirectory){var I=i.getEntryChildren(g);return I.forEach(function(R){if(R.isDirectory)return;var N=R.getData();if(!N)throw qe.Errors.CANT_EXTRACT_FILE();var A=a(R.entryName),L=s(m,b?A:We.basename(A));let q=C?R.header.fileAttr:void 0;o.writeFileTo(L,N,D,q)}),!0}var O=g.getData(i.password);if(!O)throw qe.Errors.CANT_EXTRACT_FILE();if(o.fs.existsSync(S)&&!D)throw qe.Errors.CANT_OVERRIDE();let B=C?h.header.fileAttr:void 0;return o.writeFileTo(S,O,D,B),!0},test:function(h){if(!i)return!1;for(var m in i.entries)try{if(m.isDirectory)continue;var b=i.entries[m].getData(h);if(!b)return!1}catch{return!1}return!0},extractAllTo:function(h,m,b,D){if(b=Gn(!1,b),D=j0(b,D),m=Gn(!1,m),!i)throw qe.Errors.NO_ZIP();i.entries.forEach(function(C){var E=s(h,a(C.entryName));if(C.isDirectory){o.makeDir(E);return}var g=C.getData(D);if(!g)throw qe.Errors.CANT_EXTRACT_FILE();let _=b?C.header.fileAttr:void 0;o.writeFileTo(E,g,m,_);try{o.fs.utimesSync(E,C.header.time,C.header.time)}catch{throw qe.Errors.CANT_EXTRACT_FILE()}})},extractAllToAsync:function(h,m,b,D){if(D=j3(m,b,D),b=Gn(!1,b),m=Gn(!1,m),!D)return new Promise((S,I)=>{this.extractAllToAsync(h,m,b,function(O){O?I(O):S(this)})});if(!i){D(qe.Errors.NO_ZIP());return}h=We.resolve(h);let C=S=>s(h,We.normalize(a(S.entryName))),E=(S,I)=>new Error(S+': "'+I+'"'),g=[],_=[];i.entries.forEach(S=>{S.isDirectory?g.push(S):_.push(S)});for(let S of g){let I=C(S),O=b?S.header.fileAttr:void 0;try{o.makeDir(I),O&&o.fs.chmodSync(I,O),o.fs.utimesSync(I,S.header.time,S.header.time)}catch{D(E("Unable to create folder",I))}}_.reverse().reduce(function(S,I){return function(O){if(O)S(O);else{let B=We.normalize(a(I.entryName)),R=s(h,B);I.getDataAsync(function(N,A){if(A)S(A);else if(!N)S(qe.Errors.CANT_EXTRACT_FILE());else{let L=b?I.header.fileAttr:void 0;o.writeFileToAsync(R,N,m,L,function(q){q||S(E("Unable to write file",R)),o.fs.utimes(R,I.header.time,I.header.time,function(Q){Q?S(E("Unable to set times",R)):S()})})}})}}},D)()},writeZip:function(h,m){if(arguments.length===1&&typeof h=="function"&&(m=h,h=""),!h&&n.filename&&(h=n.filename),!!h){var b=i.compressToBuffer();if(b){var D=o.writeFileTo(h,b,!0);typeof m=="function"&&m(D?null:new Error("failed"),"")}}},writeZipPromise:function(h,m){let{overwrite:b,perm:D}=Object.assign({overwrite:!0},m);return new Promise((C,E)=>{!h&&n.filename&&(h=n.filename),h||E("ADM-ZIP: ZIP File Name Missing"),this.toBufferPromise().then(g=>{let _=S=>S?C(S):E("ADM-ZIP: Wasn't able to write zip file");o.writeFileToAsync(h,g,b,D,_)},E)})},toBufferPromise:function(){return new Promise((h,m)=>{i.toAsyncBuffer(h,m)})},toBuffer:function(h,m,b,D){return typeof h=="function"?(i.toAsyncBuffer(h,m,b,D),null):i.compressToBuffer()}}}});var H0=x((AV,q0)=>{var M0={};q0.exports=M0;var U0={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],grey:[90,39],brightRed:[91,39],brightGreen:[92,39],brightYellow:[93,39],brightBlue:[94,39],brightMagenta:[95,39],brightCyan:[96,39],brightWhite:[97,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgGray:[100,49],bgGrey:[100,49],bgBrightRed:[101,49],bgBrightGreen:[102,49],bgBrightYellow:[103,49],bgBrightBlue:[104,49],bgBrightMagenta:[105,49],bgBrightCyan:[106,49],bgBrightWhite:[107,49],blackBG:[40,49],redBG:[41,49],greenBG:[42,49],yellowBG:[43,49],blueBG:[44,49],magentaBG:[45,49],cyanBG:[46,49],whiteBG:[47,49]};Object.keys(U0).forEach(function(t){var e=U0[t],r=M0[t]=[];r.open="\x1B["+e[0]+"m",r.close="\x1B["+e[1]+"m"})});var z0=x((OV,V0)=>{"use strict";V0.exports=function(t,e){e=e||process.argv;var r=e.indexOf("--"),n=/^-{1,2}/.test(t)?"":"--",o=e.indexOf(n+t);return o!==-1&&(r===-1?!0:o<r)}});var W0=x((kV,G0)=>{"use strict";var L3=require("os"),Cr=z0(),Ot=process.env,Zo=void 0;Cr("no-color")||Cr("no-colors")||Cr("color=false")?Zo=!1:(Cr("color")||Cr("colors")||Cr("color=true")||Cr("color=always"))&&(Zo=!0);"FORCE_COLOR"in Ot&&(Zo=Ot.FORCE_COLOR.length===0||parseInt(Ot.FORCE_COLOR,10)!==0);function U3(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function M3(t){if(Zo===!1)return 0;if(Cr("color=16m")||Cr("color=full")||Cr("color=truecolor"))return 3;if(Cr("color=256"))return 2;if(t&&!t.isTTY&&Zo!==!0)return 0;var e=Zo?1:0;if(process.platform==="win32"){var r=L3.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in Ot)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(o){return o in Ot})||Ot.CI_NAME==="codeship"?1:e;if("TEAMCITY_VERSION"in Ot)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Ot.TEAMCITY_VERSION)?1:0;if("TERM_PROGRAM"in Ot){var n=parseInt((Ot.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Ot.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Ot.TERM)?2:/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(Ot.TERM)||"COLORTERM"in Ot?1:(Ot.TERM==="dumb",e)}function Sd(t){var e=M3(t);return U3(e)}G0.exports={supportsColor:Sd,stdout:Sd(process.stdout),stderr:Sd(process.stderr)}});var Y0=x(($V,K0)=>{K0.exports=function(e,r){var n="";e=e||"Run the trap, drop the bass",e=e.split("");var o={a:["@","\u0104","\u023A","\u0245","\u0394","\u039B","\u0414"],b:["\xDF","\u0181","\u0243","\u026E","\u03B2","\u0E3F"],c:["\xA9","\u023B","\u03FE"],d:["\xD0","\u018A","\u0500","\u0501","\u0502","\u0503"],e:["\xCB","\u0115","\u018E","\u0258","\u03A3","\u03BE","\u04BC","\u0A6C"],f:["\u04FA"],g:["\u0262"],h:["\u0126","\u0195","\u04A2","\u04BA","\u04C7","\u050A"],i:["\u0F0F"],j:["\u0134"],k:["\u0138","\u04A0","\u04C3","\u051E"],l:["\u0139"],m:["\u028D","\u04CD","\u04CE","\u0520","\u0521","\u0D69"],n:["\xD1","\u014B","\u019D","\u0376","\u03A0","\u048A"],o:["\xD8","\xF5","\xF8","\u01FE","\u0298","\u047A","\u05DD","\u06DD","\u0E4F"],p:["\u01F7","\u048E"],q:["\u09CD"],r:["\xAE","\u01A6","\u0210","\u024C","\u0280","\u042F"],s:["\xA7","\u03DE","\u03DF","\u03E8"],t:["\u0141","\u0166","\u0373"],u:["\u01B1","\u054D"],v:["\u05D8"],w:["\u0428","\u0460","\u047C","\u0D70"],x:["\u04B2","\u04FE","\u04FC","\u04FD"],y:["\xA5","\u04B0","\u04CB"],z:["\u01B5","\u0240"]};return e.forEach(function(i){i=i.toLowerCase();var a=o[i]||[" "],s=Math.floor(Math.random()*a.length);typeof o[i]<"u"?n+=o[i][s]:n+=i}),n}});var X0=x((PV,J0)=>{J0.exports=function(e,r){e=e||" he is here ";var n={up:["\u030D","\u030E","\u0304","\u0305","\u033F","\u0311","\u0306","\u0310","\u0352","\u0357","\u0351","\u0307","\u0308","\u030A","\u0342","\u0313","\u0308","\u034A","\u034B","\u034C","\u0303","\u0302","\u030C","\u0350","\u0300","\u0301","\u030B","\u030F","\u0312","\u0313","\u0314","\u033D","\u0309","\u0363","\u0364","\u0365","\u0366","\u0367","\u0368","\u0369","\u036A","\u036B","\u036C","\u036D","\u036E","\u036F","\u033E","\u035B","\u0346","\u031A"],down:["\u0316","\u0317","\u0318","\u0319","\u031C","\u031D","\u031E","\u031F","\u0320","\u0324","\u0325","\u0326","\u0329","\u032A","\u032B","\u032C","\u032D","\u032E","\u032F","\u0330","\u0331","\u0332","\u0333","\u0339","\u033A","\u033B","\u033C","\u0345","\u0347","\u0348","\u0349","\u034D","\u034E","\u0353","\u0354","\u0355","\u0356","\u0359","\u035A","\u0323"],mid:["\u0315","\u031B","\u0300","\u0301","\u0358","\u0321","\u0322","\u0327","\u0328","\u0334","\u0335","\u0336","\u035C","\u035D","\u035E","\u035F","\u0360","\u0362","\u0338","\u0337","\u0361"," \u0489"]},o=[].concat(n.up,n.down,n.mid);function i(u){var c=Math.floor(Math.random()*u);return c}function a(u){var c=!1;return o.filter(function(l){c=l===u}),c}function s(u,c){var l="",f,d;c=c||{},c.up=typeof c.up<"u"?c.up:!0,c.mid=typeof c.mid<"u"?c.mid:!0,c.down=typeof c.down<"u"?c.down:!0,c.size=typeof c.size<"u"?c.size:"maxi",u=u.split("");for(d in u)if(!a(d)){switch(l=l+u[d],f={up:0,down:0,mid:0},c.size){case"mini":f.up=i(8),f.mid=i(2),f.down=i(8);break;case"maxi":f.up=i(16)+3,f.mid=i(4)+1,f.down=i(64)+3;break;default:f.up=i(8)+1,f.mid=i(6)/2,f.down=i(8)+1;break}var h=["up","mid","down"];for(var m in h)for(var b=h[m],D=0;D<=f[b];D++)c[b]&&(l=l+n[b][i(n[b].length)])}return l}return s(e,r)}});var Q0=x((TV,Z0)=>{Z0.exports=function(t){return function(e,r,n){if(e===" ")return e;switch(r%3){case 0:return t.red(e);case 1:return t.white(e);case 2:return t.blue(e)}}}});var tb=x((IV,eb)=>{eb.exports=function(t){return function(e,r,n){return r%2===0?e:t.inverse(e)}}});var nb=x((RV,rb)=>{rb.exports=function(t){var e=["red","yellow","green","blue","magenta"];return function(r,n,o){return r===" "?r:t[e[n++%e.length]](r)}}});var ib=x((BV,ob)=>{ob.exports=function(t){var e=["underline","inverse","grey","yellow","red","green","blue","white","cyan","magenta","brightYellow","brightRed","brightGreen","brightBlue","brightWhite","brightCyan","brightMagenta"];return function(r,n,o){return r===" "?r:t[e[Math.round(Math.random()*(e.length-2))]](r)}}});var fb=x((NV,lb)=>{var ce={};lb.exports=ce;ce.themes={};var q3=require("util"),Wn=ce.styles=H0(),sb=Object.defineProperties,H3=new RegExp(/[\r\n]+/g);ce.supportsColor=W0().supportsColor;typeof ce.enabled>"u"&&(ce.enabled=ce.supportsColor()!==!1);ce.enable=function(){ce.enabled=!0};ce.disable=function(){ce.enabled=!1};ce.stripColors=ce.strip=function(t){return(""+t).replace(/\x1B\[\d+m/g,"")};var jV=ce.stylize=function(e,r){if(!ce.enabled)return e+"";var n=Wn[r];return!n&&r in ce?ce[r](e):n.open+e+n.close},V3=/[|\\{}()[\]^$+*?.]/g,z3=function(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(V3,"\\$&")};function ub(t){var e=function r(){return W3.apply(r,arguments)};return e._styles=t,e.__proto__=G3,e}var cb=(function(){var t={};return Wn.grey=Wn.gray,Object.keys(Wn).forEach(function(e){Wn[e].closeRe=new RegExp(z3(Wn[e].close),"g"),t[e]={get:function(){return ub(this._styles.concat(e))}}}),t})(),G3=sb(function(){},cb);function W3(){var t=Array.prototype.slice.call(arguments),e=t.map(function(a){return a!=null&&a.constructor===String?a:q3.inspect(a)}).join(" ");if(!ce.enabled||!e)return e;for(var r=e.indexOf(`
28
- `)!=-1,n=this._styles,o=n.length;o--;){var i=Wn[n[o]];e=i.open+e.replace(i.closeRe,i.open)+i.close,r&&(e=e.replace(H3,function(a){return i.close+a+i.open}))}return e}ce.setTheme=function(t){if(typeof t=="string"){console.log("colors.setTheme now only accepts an object, not a string. If you are trying to set a theme from a file, it is now your (the caller's) responsibility to require the file. The old syntax looked like colors.setTheme(__dirname + '/../themes/generic-logging.js'); The new syntax looks like colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));");return}for(var e in t)(function(r){ce[r]=function(n){if(typeof t[r]=="object"){var o=n;for(var i in t[r])o=ce[t[r][i]](o);return o}return ce[t[r]](n)}})(e)};function K3(){var t={};return Object.keys(cb).forEach(function(e){t[e]={get:function(){return ub([e])}}}),t}var Y3=function(e,r){var n=r.split("");return n=n.map(e),n.join("")};ce.trap=Y0();ce.zalgo=X0();ce.maps={};ce.maps.america=Q0()(ce);ce.maps.zebra=tb()(ce);ce.maps.rainbow=nb()(ce);ce.maps.random=ib()(ce);for(ab in ce.maps)(function(t){ce[t]=function(e){return Y3(ce.maps[t],e)}})(ab);var ab;sb(ce,K3())});var db=x((LV,pb)=>{var J3=fb();pb.exports=J3});var hb=x(Fd=>{"use strict";Fd.indent=function(e){return new Array(e+1).join(" ")};Fd.getMaxIndexLength=function(t){var e=0;return Object.getOwnPropertyNames(t).forEach(function(r){t[r]!==void 0&&(e=Math.max(e,r.length))}),e}});var mb=x((MV,X3)=>{X3.exports={author:"Rafael de Oleza <rafeca@gmail.com> (https://github.com/rafeca)",name:"prettyjson",description:"Package for formatting JSON data in a coloured YAML-style, perfect for CLI output",version:"1.2.5",homepage:"http://rafeca.com/prettyjson",keywords:["json","cli","formatting","colors"],repository:{type:"git",url:"https://github.com/rafeca/prettyjson.git"},bugs:{url:"https://github.com/rafeca/prettyjson/issues"},main:"./lib/prettyjson",files:["bin/prettyjson","lib/*.js"],license:"MIT",scripts:{test:"npm run jshint && mocha --reporter spec",testwin:"node ./node_modules/mocha/bin/mocha --reporter spec",jshint:"jshint lib/*.js test/*.js",coverage:"istanbul cover _mocha --report lcovonly -- -R spec",coveralls:"npm run coverage && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage",changelog:"git log $(git describe --tags --abbrev=0)..HEAD --pretty='* %s' --first-parent"},bin:{prettyjson:"./bin/prettyjson"},dependencies:{colors:"1.4.0",minimist:"^1.2.0"},devDependencies:{coveralls:"^2.11.15",istanbul:"^0.4.5",jshint:"^2.9.4",mocha:"^3.1.2","mocha-lcov-reporter":"^1.2.0",should:"^11.1.1"}}});var gb=x($a=>{"use strict";var Fr=db(),yn=hb(),Z3=/[^\w\s\n\r\v\t\.,]/i;$a.version=mb().version;var Ad=function(t,e){return t!==void 0||e.renderUndefined},Bu=function(t,e,r){return!!(typeof t=="boolean"||typeof t=="number"||typeof t=="function"||t===null||t===void 0||t instanceof Date||typeof t=="string"&&t.indexOf(`
29
- `)===-1||r.inlineArrays&&!e&&Array.isArray(t)&&Bu(t[0],!0,r))},Q3=function(t,e){if(e.noColor)return t;if(typeof t=="string")return e.stringColor?Fr[e.stringColor](t):t;var r=t+"";return t===!0?Fr.green(r):t===!1?Fr.red(r):t==null?Fr.grey(r):typeof t=="number"?t>=0?Fr[e.positiveNumberColor](r):Fr[e.negativeNumberColor](r):typeof t=="function"?"function() {}":Array.isArray(t)?t.join(", "):r},Od=function(t,e){return t.multilineStringColor===null||t.noColor?e:Fr[t.multilineStringColor](e)},e$=function(t,e,r){var n=t.split(`
30
- `);return n=n.map(function(o){return yn.indent(e)+Od(r,o)}),n.join(`
31
- `)},Qo=function(t,e,r){if(typeof t=="string"&&t.match(Z3)&&e.escape&&(t=JSON.stringify(t)),!Ad(t,e))return[];if(Bu(t,!1,e))return[yn.indent(r)+Q3(t,e)];if(typeof t=="string")return[yn.indent(r)+Od(e,'"""'),e$(t,r+e.defaultIndentation,e),yn.indent(r)+Od(e,'"""')];if(Array.isArray(t)){if(t.length===0)return[yn.indent(r)+e.emptyArrayMsg];var n=[];return t.forEach(function(s){if(Ad(s,e)){var u="- ";e.noColor||(u=Fr[e.dashColor](u)),u=yn.indent(r)+u,Bu(s,!1,e)?(u+=Qo(s,e,0)[0],n.push(u)):(n.push(u),n.push.apply(n,Qo(s,e,r+e.defaultIndentation)))}}),n}if(t instanceof Error)return Qo({message:t.message,stack:t.stack.split(`
32
- `)},e,r);var o=e.noAlign?0:yn.getMaxIndexLength(t),i,a=[];return Object.getOwnPropertyNames(t).forEach(function(s){if(Ad(t[s],e))if(i=s+": ",e.noColor||(i=Fr[e.keysColor](i)),i=yn.indent(r)+i,Bu(t[s],!1,e)){var u=e.noAlign?0:o-s.length;i+=Qo(t[s],e,u)[0],a.push(i)}else a.push(i),a.push.apply(a,Qo(t[s],e,r+e.defaultIndentation))}),a};$a.render=function(e,r,n){return n=n||0,r=r||{},r.emptyArrayMsg=r.emptyArrayMsg||"(empty array)",r.keysColor=r.keysColor||"green",r.dashColor=r.dashColor||"green",r.numberColor=r.numberColor||"blue",r.positiveNumberColor=r.positiveNumberColor||r.numberColor,r.negativeNumberColor=r.negativeNumberColor||r.numberColor,r.defaultIndentation=r.defaultIndentation||2,r.noColor=!!r.noColor,r.noAlign=!!r.noAlign,r.escape=!!r.escape,r.renderUndefined=!!r.renderUndefined,r.stringColor=r.stringColor||null,r.multilineStringColor=r.multilineStringColor||null,Qo(e,r,n).join(`
33
- `)};$a.renderString=function(e,r,n){var o="",i;if(typeof e!="string"||e==="")return"";if(e[0]!=="{"&&e[0]!=="["){var a;e.indexOf("{")===-1?a=e.indexOf("["):e.indexOf("[")===-1||e.indexOf("{")<e.indexOf("[")?a=e.indexOf("{"):a=e.indexOf("["),o+=e.substr(0,a)+`
34
- `,e=e.substr(a)}try{i=JSON.parse(e)}catch{return Fr.red("Error:")+" Not valid JSON!"}return o+=$a.render(i,r,n),o}});var Pd=x(ju=>{"use strict";Object.defineProperty(ju,"__esModule",{value:!0});ju.default=void 0;function ei(t){"@babel/helpers - typeof";return ei=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ei(t)}function Db(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,r$(n.key),n)}}function t$(t,e,r){return e&&Db(t.prototype,e),r&&Db(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function r$(t){var e=n$(t,"string");return ei(e)=="symbol"?e:e+""}function n$(t,e){if(ei(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ei(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function o$(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i$(t,e,r){return e=Ta(e),a$(t,$d()?Reflect.construct(e,r||[],Ta(t).constructor):e.apply(t,r))}function a$(t,e){if(e&&(ei(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return s$(t)}function s$(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function u$(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Pa(t,e)}function kd(t){var e=typeof Map=="function"?new Map:void 0;return kd=function(n){if(n===null||!l$(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(n))return e.get(n);e.set(n,o)}function o(){return c$(n,arguments,Ta(this).constructor)}return o.prototype=Object.create(n.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),Pa(o,n)},kd(t)}function c$(t,e,r){if($d())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var o=new(t.bind.apply(t,n));return r&&Pa(o,r.prototype),o}function $d(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return($d=function(){return!!t})()}function l$(t){try{return Function.toString.call(t).indexOf("[native code]")!==-1}catch{return typeof t=="function"}}function Pa(t,e){return Pa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Pa(t,e)}function Ta(t){return Ta=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Ta(t)}var f$=(function(t){function e(r){var n,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;if(o$(this,e),n=i$(this,e,[r]),n.originalRequest=i,n.originalResponse=a,n.causingError=o,o!=null&&(r+=", caused by ".concat(o.toString())),i!=null){var s=i.getHeader("X-Request-ID")||"n/a",u=i.getMethod(),c=i.getURL(),l=a?a.getStatus():"n/a",f=a?a.getBody()||"":"n/a";r+=", originated from request (method: ".concat(u,", url: ").concat(c,", response code: ").concat(l,", response text: ").concat(f,", request id: ").concat(s,")")}return n.message=r,n}return u$(e,t),t$(e)})(kd(Error)),HV=ju.default=f$});var Td=x(Nu=>{"use strict";Object.defineProperty(Nu,"__esModule",{value:!0});Nu.enableDebugLog=p$;Nu.log=d$;var yb=!1;function p$(){yb=!0}function d$(t){yb&&console.log(t)}});var vb=x(Lu=>{"use strict";Object.defineProperty(Lu,"__esModule",{value:!0});Lu.default=void 0;function Ia(t){"@babel/helpers - typeof";return Ia=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ia(t)}function h$(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function bb(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,g$(n.key),n)}}function m$(t,e,r){return e&&bb(t.prototype,e),r&&bb(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function g$(t){var e=D$(t,"string");return Ia(e)=="symbol"?e:e+""}function D$(t,e){if(Ia(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Ia(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var GV=Lu.default=(function(){function t(){h$(this,t)}return m$(t,[{key:"listAllUploads",value:function(){return Promise.resolve([])}},{key:"findUploadsByFingerprint",value:function(r){return Promise.resolve([])}},{key:"removeUpload",value:function(r){return Promise.resolve()}},{key:"addUpload",value:function(r,n){return Promise.resolve(null)}}])})()});var wb=x((Id,Rd)=>{(function(t,e){typeof Id=="object"&&typeof Rd<"u"?Rd.exports=e():typeof define=="function"&&define.amd?define(e):(function(){var r=t.Base64,n=e();n.noConflict=function(){return t.Base64=r,n},t.Meteor&&(Base64=n),t.Base64=n})()})(typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:Id,function(){"use strict";var t="3.7.8",e=t,r=typeof Buffer=="function",n=typeof TextDecoder=="function"?new TextDecoder:void 0,o=typeof TextEncoder=="function"?new TextEncoder:void 0,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=Array.prototype.slice.call(i),s=(function(P){var j={};return P.forEach(function(ee,V){return j[ee]=V}),j})(a),u=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,c=String.fromCharCode.bind(String),l=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):function(P){return new Uint8Array(Array.prototype.slice.call(P,0))},f=function(P){return P.replace(/=/g,"").replace(/[+\/]/g,function(j){return j=="+"?"-":"_"})},d=function(P){return P.replace(/[^A-Za-z0-9\+\/]/g,"")},h=function(P){for(var j,ee,V,se,hr="",z=P.length%3,Ee=0;Ee<P.length;){if((ee=P.charCodeAt(Ee++))>255||(V=P.charCodeAt(Ee++))>255||(se=P.charCodeAt(Ee++))>255)throw new TypeError("invalid character found");j=ee<<16|V<<8|se,hr+=a[j>>18&63]+a[j>>12&63]+a[j>>6&63]+a[j&63]}return z?hr.slice(0,z-3)+"===".substring(z):hr},m=typeof btoa=="function"?function(P){return btoa(P)}:r?function(P){return Buffer.from(P,"binary").toString("base64")}:h,b=r?function(P){return Buffer.from(P).toString("base64")}:function(P){for(var j=4096,ee=[],V=0,se=P.length;V<se;V+=j)ee.push(c.apply(null,P.subarray(V,V+j)));return m(ee.join(""))},D=function(P,j){return j===void 0&&(j=!1),j?f(b(P)):b(P)},C=function(P){if(P.length<2){var j=P.charCodeAt(0);return j<128?P:j<2048?c(192|j>>>6)+c(128|j&63):c(224|j>>>12&15)+c(128|j>>>6&63)+c(128|j&63)}else{var j=65536+(P.charCodeAt(0)-55296)*1024+(P.charCodeAt(1)-56320);return c(240|j>>>18&7)+c(128|j>>>12&63)+c(128|j>>>6&63)+c(128|j&63)}},E=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,g=function(P){return P.replace(E,C)},_=r?function(P){return Buffer.from(P,"utf8").toString("base64")}:o?function(P){return b(o.encode(P))}:function(P){return m(g(P))},S=function(P,j){return j===void 0&&(j=!1),j?f(_(P)):_(P)},I=function(P){return S(P,!0)},O=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,B=function(P){switch(P.length){case 4:var j=(7&P.charCodeAt(0))<<18|(63&P.charCodeAt(1))<<12|(63&P.charCodeAt(2))<<6|63&P.charCodeAt(3),ee=j-65536;return c((ee>>>10)+55296)+c((ee&1023)+56320);case 3:return c((15&P.charCodeAt(0))<<12|(63&P.charCodeAt(1))<<6|63&P.charCodeAt(2));default:return c((31&P.charCodeAt(0))<<6|63&P.charCodeAt(1))}},R=function(P){return P.replace(O,B)},N=function(P){if(P=P.replace(/\s+/g,""),!u.test(P))throw new TypeError("malformed base64.");P+="==".slice(2-(P.length&3));for(var j,ee,V,se=[],hr=0;hr<P.length;)j=s[P.charAt(hr++)]<<18|s[P.charAt(hr++)]<<12|(ee=s[P.charAt(hr++)])<<6|(V=s[P.charAt(hr++)]),ee===64?se.push(c(j>>16&255)):V===64?se.push(c(j>>16&255,j>>8&255)):se.push(c(j>>16&255,j>>8&255,j&255));return se.join("")},A=typeof atob=="function"?function(P){return atob(d(P))}:r?function(P){return Buffer.from(P,"base64").toString("binary")}:N,L=r?function(P){return l(Buffer.from(P,"base64"))}:function(P){return l(A(P).split("").map(function(j){return j.charCodeAt(0)}))},q=function(P){return L($(P))},Q=r?function(P){return Buffer.from(P,"base64").toString("utf8")}:n?function(P){return n.decode(L(P))}:function(P){return R(A(P))},$=function(P){return d(P.replace(/[-_]/g,function(j){return j=="-"?"+":"/"}))},y=function(P){return Q($(P))},v=function(P){if(typeof P!="string")return!1;var j=P.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(j)||!/[^\s0-9a-zA-Z\-_]/.test(j)},w=function(P){return{value:P,enumerable:!1,writable:!0,configurable:!0}},F=function(){var P=function(j,ee){return Object.defineProperty(String.prototype,j,w(ee))};P("fromBase64",function(){return y(this)}),P("toBase64",function(j){return S(this,j)}),P("toBase64URI",function(){return S(this,!0)}),P("toBase64URL",function(){return S(this,!0)}),P("toUint8Array",function(){return q(this)})},T=function(){var P=function(j,ee){return Object.defineProperty(Uint8Array.prototype,j,w(ee))};P("toBase64",function(j){return D(this,j)}),P("toBase64URI",function(){return D(this,!0)}),P("toBase64URL",function(){return D(this,!0)})},k=function(){F(),T()},M={version:t,VERSION:e,atob:A,atobPolyfill:N,btoa:m,btoaPolyfill:h,fromBase64:y,toBase64:S,encode:S,encodeURI:I,encodeURL:I,utob:g,btou:R,decode:y,isValid:v,fromUint8Array:D,toUint8Array:q,extendString:F,extendUint8Array:T,extendBuiltins:k};return M.Base64={},Object.keys(M).forEach(function(P){return M.Base64[P]=M[P]}),M})});var Eb=x((KV,Cb)=>{"use strict";Cb.exports=function(e,r){if(r=r.split(":")[0],e=+e,!e)return!1;switch(r){case"http":case"ws":return e!==80;case"https":case"wss":return e!==443;case"ftp":return e!==21;case"gopher":return e!==70;case"file":return!1}return e!==0}});var Sb=x(Bd=>{"use strict";var y$=Object.prototype.hasOwnProperty,b$;function _b(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch{return null}}function xb(t){try{return encodeURIComponent(t)}catch{return null}}function v$(t){for(var e=/([^=?#&]+)=?([^&]*)/g,r={},n;n=e.exec(t);){var o=_b(n[1]),i=_b(n[2]);o===null||i===null||o in r||(r[o]=i)}return r}function w$(t,e){e=e||"";var r=[],n,o;typeof e!="string"&&(e="?");for(o in t)if(y$.call(t,o)){if(n=t[o],!n&&(n===null||n===b$||isNaN(n))&&(n=""),o=xb(o),n=xb(n),o===null||n===null)continue;r.push(o+"="+n)}return r.length?e+r.join("&"):""}Bd.stringify=w$;Bd.parse=v$});var Ib=x((JV,Tb)=>{"use strict";var Ab=Eb(),Uu=Sb(),C$=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,Ob=/[\n\r\t]/g,E$=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,kb=/:\d+$/,_$=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,x$=/^[a-zA-Z]:/;function Nd(t){return(t||"").toString().replace(C$,"")}var jd=[["#","hash"],["?","query"],function(e,r){return Ar(r.protocol)?e.replace(/\\/g,"/"):e},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],Fb={hash:1,query:1};function $b(t){var e;typeof window<"u"?e=window:typeof global<"u"?e=global:typeof self<"u"?e=self:e={};var r=e.location||{};t=t||r;var n={},o=typeof t,i;if(t.protocol==="blob:")n=new Or(unescape(t.pathname),{});else if(o==="string"){n=new Or(t,{});for(i in Fb)delete n[i]}else if(o==="object"){for(i in t)i in Fb||(n[i]=t[i]);n.slashes===void 0&&(n.slashes=E$.test(t.href))}return n}function Ar(t){return t==="file:"||t==="ftp:"||t==="http:"||t==="https:"||t==="ws:"||t==="wss:"}function Pb(t,e){t=Nd(t),t=t.replace(Ob,""),e=e||{};var r=_$.exec(t),n=r[1]?r[1].toLowerCase():"",o=!!r[2],i=!!r[3],a=0,s;return o?i?(s=r[2]+r[3]+r[4],a=r[2].length+r[3].length):(s=r[2]+r[4],a=r[2].length):i?(s=r[3]+r[4],a=r[3].length):s=r[4],n==="file:"?a>=2&&(s=s.slice(2)):Ar(n)?s=r[4]:n?o&&(s=s.slice(2)):a>=2&&Ar(e.protocol)&&(s=r[4]),{protocol:n,slashes:o||Ar(n),slashesCount:a,rest:s}}function S$(t,e){if(t==="")return e;for(var r=(e||"/").split("/").slice(0,-1).concat(t.split("/")),n=r.length,o=r[n-1],i=!1,a=0;n--;)r[n]==="."?r.splice(n,1):r[n]===".."?(r.splice(n,1),a++):a&&(n===0&&(i=!0),r.splice(n,1),a--);return i&&r.unshift(""),(o==="."||o==="..")&&r.push(""),r.join("/")}function Or(t,e,r){if(t=Nd(t),t=t.replace(Ob,""),!(this instanceof Or))return new Or(t,e,r);var n,o,i,a,s,u,c=jd.slice(),l=typeof e,f=this,d=0;for(l!=="object"&&l!=="string"&&(r=e,e=null),r&&typeof r!="function"&&(r=Uu.parse),e=$b(e),o=Pb(t||"",e),n=!o.protocol&&!o.slashes,f.slashes=o.slashes||n&&e.slashes,f.protocol=o.protocol||e.protocol||"",t=o.rest,(o.protocol==="file:"&&(o.slashesCount!==2||x$.test(t))||!o.slashes&&(o.protocol||o.slashesCount<2||!Ar(f.protocol)))&&(c[3]=[/(.*)/,"pathname"]);d<c.length;d++){if(a=c[d],typeof a=="function"){t=a(t,f);continue}i=a[0],u=a[1],i!==i?f[u]=t:typeof i=="string"?(s=i==="@"?t.lastIndexOf(i):t.indexOf(i),~s&&(typeof a[2]=="number"?(f[u]=t.slice(0,s),t=t.slice(s+a[2])):(f[u]=t.slice(s),t=t.slice(0,s)))):(s=i.exec(t))&&(f[u]=s[1],t=t.slice(0,s.index)),f[u]=f[u]||n&&a[3]&&e[u]||"",a[4]&&(f[u]=f[u].toLowerCase())}r&&(f.query=r(f.query)),n&&e.slashes&&f.pathname.charAt(0)!=="/"&&(f.pathname!==""||e.pathname!=="")&&(f.pathname=S$(f.pathname,e.pathname)),f.pathname.charAt(0)!=="/"&&Ar(f.protocol)&&(f.pathname="/"+f.pathname),Ab(f.port,f.protocol)||(f.host=f.hostname,f.port=""),f.username=f.password="",f.auth&&(s=f.auth.indexOf(":"),~s?(f.username=f.auth.slice(0,s),f.username=encodeURIComponent(decodeURIComponent(f.username)),f.password=f.auth.slice(s+1),f.password=encodeURIComponent(decodeURIComponent(f.password))):f.username=encodeURIComponent(decodeURIComponent(f.auth)),f.auth=f.password?f.username+":"+f.password:f.username),f.origin=f.protocol!=="file:"&&Ar(f.protocol)&&f.host?f.protocol+"//"+f.host:"null",f.href=f.toString()}function F$(t,e,r){var n=this;switch(t){case"query":typeof e=="string"&&e.length&&(e=(r||Uu.parse)(e)),n[t]=e;break;case"port":n[t]=e,Ab(e,n.protocol)?e&&(n.host=n.hostname+":"+e):(n.host=n.hostname,n[t]="");break;case"hostname":n[t]=e,n.port&&(e+=":"+n.port),n.host=e;break;case"host":n[t]=e,kb.test(e)?(e=e.split(":"),n.port=e.pop(),n.hostname=e.join(":")):(n.hostname=e,n.port="");break;case"protocol":n.protocol=e.toLowerCase(),n.slashes=!r;break;case"pathname":case"hash":if(e){var o=t==="pathname"?"/":"#";n[t]=e.charAt(0)!==o?o+e:e}else n[t]=e;break;case"username":case"password":n[t]=encodeURIComponent(e);break;case"auth":var i=e.indexOf(":");~i?(n.username=e.slice(0,i),n.username=encodeURIComponent(decodeURIComponent(n.username)),n.password=e.slice(i+1),n.password=encodeURIComponent(decodeURIComponent(n.password))):n.username=encodeURIComponent(decodeURIComponent(e))}for(var a=0;a<jd.length;a++){var s=jd[a];s[4]&&(n[s[1]]=n[s[1]].toLowerCase())}return n.auth=n.password?n.username+":"+n.password:n.username,n.origin=n.protocol!=="file:"&&Ar(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function A$(t){(!t||typeof t!="function")&&(t=Uu.stringify);var e,r=this,n=r.host,o=r.protocol;o&&o.charAt(o.length-1)!==":"&&(o+=":");var i=o+(r.protocol&&r.slashes||Ar(r.protocol)?"//":"");return r.username?(i+=r.username,r.password&&(i+=":"+r.password),i+="@"):r.password?(i+=":"+r.password,i+="@"):r.protocol!=="file:"&&Ar(r.protocol)&&!n&&r.pathname!=="/"&&(i+="@"),(n[n.length-1]===":"||kb.test(r.hostname)&&!r.port)&&(n+=":"),i+=n+r.pathname,e=typeof r.query=="object"?t(r.query):r.query,e&&(i+=e.charAt(0)!=="?"?"?"+e:e),r.hash&&(i+=r.hash),i}Or.prototype={set:F$,toString:A$};Or.extractProtocol=Pb;Or.location=$b;Or.trimLeft=Nd;Or.qs=Uu;Tb.exports=Or});var Rb=x(Ld=>{"use strict";Object.defineProperty(Ld,"__esModule",{value:!0});Ld.default=O$;function O$(){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)})}});var Jb=x(Vu=>{"use strict";Object.defineProperty(Vu,"__esModule",{value:!0});Vu.default=void 0;var k$=wb(),$$=qd(Ib()),Mu=qd(Pd()),Kn=Td(),P$=qd(Rb());function qd(t){return t&&t.__esModule?t:{default:t}}function Ud(){"use strict";Ud=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(y,v,w){y[v]=w.value},i=typeof Symbol=="function"?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(y,v,w){return Object.defineProperty(y,v,{value:w,enumerable:!0,configurable:!0,writable:!0}),y[v]}try{c({},"")}catch{c=function(w,F,T){return w[F]=T}}function l(y,v,w,F){var T=v&&v.prototype instanceof C?v:C,k=Object.create(T.prototype),M=new Q(F||[]);return o(k,"_invoke",{value:N(y,w,M)}),k}function f(y,v,w){try{return{type:"normal",arg:y.call(v,w)}}catch(F){return{type:"throw",arg:F}}}e.wrap=l;var d="suspendedStart",h="suspendedYield",m="executing",b="completed",D={};function C(){}function E(){}function g(){}var _={};c(_,a,function(){return this});var S=Object.getPrototypeOf,I=S&&S(S($([])));I&&I!==r&&n.call(I,a)&&(_=I);var O=g.prototype=C.prototype=Object.create(_);function B(y){["next","throw","return"].forEach(function(v){c(y,v,function(w){return this._invoke(v,w)})})}function R(y,v){function w(T,k,M,P){var j=f(y[T],y,k);if(j.type!=="throw"){var ee=j.arg,V=ee.value;return V&&Yn(V)=="object"&&n.call(V,"__await")?v.resolve(V.__await).then(function(se){w("next",se,M,P)},function(se){w("throw",se,M,P)}):v.resolve(V).then(function(se){ee.value=se,M(ee)},function(se){return w("throw",se,M,P)})}P(j.arg)}var F;o(this,"_invoke",{value:function(k,M){function P(){return new v(function(j,ee){w(k,M,j,ee)})}return F=F?F.then(P,P):P()}})}function N(y,v,w){var F=d;return function(T,k){if(F===m)throw Error("Generator is already running");if(F===b){if(T==="throw")throw k;return{value:t,done:!0}}for(w.method=T,w.arg=k;;){var M=w.delegate;if(M){var P=A(M,w);if(P){if(P===D)continue;return P}}if(w.method==="next")w.sent=w._sent=w.arg;else if(w.method==="throw"){if(F===d)throw F=b,w.arg;w.dispatchException(w.arg)}else w.method==="return"&&w.abrupt("return",w.arg);F=m;var j=f(y,v,w);if(j.type==="normal"){if(F=w.done?b:h,j.arg===D)continue;return{value:j.arg,done:w.done}}j.type==="throw"&&(F=b,w.method="throw",w.arg=j.arg)}}}function A(y,v){var w=v.method,F=y.iterator[w];if(F===t)return v.delegate=null,w==="throw"&&y.iterator.return&&(v.method="return",v.arg=t,A(y,v),v.method==="throw")||w!=="return"&&(v.method="throw",v.arg=new TypeError("The iterator does not provide a '"+w+"' method")),D;var T=f(F,y.iterator,v.arg);if(T.type==="throw")return v.method="throw",v.arg=T.arg,v.delegate=null,D;var k=T.arg;return k?k.done?(v[y.resultName]=k.value,v.next=y.nextLoc,v.method!=="return"&&(v.method="next",v.arg=t),v.delegate=null,D):k:(v.method="throw",v.arg=new TypeError("iterator result is not an object"),v.delegate=null,D)}function L(y){var v={tryLoc:y[0]};1 in y&&(v.catchLoc=y[1]),2 in y&&(v.finallyLoc=y[2],v.afterLoc=y[3]),this.tryEntries.push(v)}function q(y){var v=y.completion||{};v.type="normal",delete v.arg,y.completion=v}function Q(y){this.tryEntries=[{tryLoc:"root"}],y.forEach(L,this),this.reset(!0)}function $(y){if(y||y===""){var v=y[a];if(v)return v.call(y);if(typeof y.next=="function")return y;if(!isNaN(y.length)){var w=-1,F=function T(){for(;++w<y.length;)if(n.call(y,w))return T.value=y[w],T.done=!1,T;return T.value=t,T.done=!0,T};return F.next=F}}throw new TypeError(Yn(y)+" is not iterable")}return E.prototype=g,o(O,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:E,configurable:!0}),E.displayName=c(g,u,"GeneratorFunction"),e.isGeneratorFunction=function(y){var v=typeof y=="function"&&y.constructor;return!!v&&(v===E||(v.displayName||v.name)==="GeneratorFunction")},e.mark=function(y){return Object.setPrototypeOf?Object.setPrototypeOf(y,g):(y.__proto__=g,c(y,u,"GeneratorFunction")),y.prototype=Object.create(O),y},e.awrap=function(y){return{__await:y}},B(R.prototype),c(R.prototype,s,function(){return this}),e.AsyncIterator=R,e.async=function(y,v,w,F,T){T===void 0&&(T=Promise);var k=new R(l(y,v,w,F),T);return e.isGeneratorFunction(v)?k:k.next().then(function(M){return M.done?M.value:k.next()})},B(O),c(O,u,"Generator"),c(O,a,function(){return this}),c(O,"toString",function(){return"[object Generator]"}),e.keys=function(y){var v=Object(y),w=[];for(var F in v)w.push(F);return w.reverse(),function T(){for(;w.length;){var k=w.pop();if(k in v)return T.value=k,T.done=!1,T}return T.done=!0,T}},e.values=$,Q.prototype={constructor:Q,reset:function(v){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(q),!v)for(var w in this)w.charAt(0)==="t"&&n.call(this,w)&&!isNaN(+w.slice(1))&&(this[w]=t)},stop:function(){this.done=!0;var v=this.tryEntries[0].completion;if(v.type==="throw")throw v.arg;return this.rval},dispatchException:function(v){if(this.done)throw v;var w=this;function F(ee,V){return M.type="throw",M.arg=v,w.next=ee,V&&(w.method="next",w.arg=t),!!V}for(var T=this.tryEntries.length-1;T>=0;--T){var k=this.tryEntries[T],M=k.completion;if(k.tryLoc==="root")return F("end");if(k.tryLoc<=this.prev){var P=n.call(k,"catchLoc"),j=n.call(k,"finallyLoc");if(P&&j){if(this.prev<k.catchLoc)return F(k.catchLoc,!0);if(this.prev<k.finallyLoc)return F(k.finallyLoc)}else if(P){if(this.prev<k.catchLoc)return F(k.catchLoc,!0)}else{if(!j)throw Error("try statement without catch or finally");if(this.prev<k.finallyLoc)return F(k.finallyLoc)}}}},abrupt:function(v,w){for(var F=this.tryEntries.length-1;F>=0;--F){var T=this.tryEntries[F];if(T.tryLoc<=this.prev&&n.call(T,"finallyLoc")&&this.prev<T.finallyLoc){var k=T;break}}k&&(v==="break"||v==="continue")&&k.tryLoc<=w&&w<=k.finallyLoc&&(k=null);var M=k?k.completion:{};return M.type=v,M.arg=w,k?(this.method="next",this.next=k.finallyLoc,D):this.complete(M)},complete:function(v,w){if(v.type==="throw")throw v.arg;return v.type==="break"||v.type==="continue"?this.next=v.arg:v.type==="return"?(this.rval=this.arg=v.arg,this.method="return",this.next="end"):v.type==="normal"&&w&&(this.next=w),D},finish:function(v){for(var w=this.tryEntries.length-1;w>=0;--w){var F=this.tryEntries[w];if(F.finallyLoc===v)return this.complete(F.completion,F.afterLoc),q(F),D}},catch:function(v){for(var w=this.tryEntries.length-1;w>=0;--w){var F=this.tryEntries[w];if(F.tryLoc===v){var T=F.completion;if(T.type==="throw"){var k=T.arg;q(F)}return k}}throw Error("illegal catch attempt")},delegateYield:function(v,w,F){return this.delegate={iterator:$(v),resultName:w,nextLoc:F},this.method==="next"&&(this.arg=t),D}},e}function Bb(t,e,r,n,o,i,a){try{var s=t[i](a),u=s.value}catch(c){r(c);return}s.done?e(u):Promise.resolve(u).then(n,o)}function T$(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(u){Bb(i,n,o,a,s,"next",u)}function s(u){Bb(i,n,o,a,s,"throw",u)}a(void 0)})}}function zb(t,e){return B$(t)||R$(t,e)||Gb(t,e)||I$()}function I$(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
35
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function R$(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,o,i,a,s=[],u=!0,c=!1;try{if(i=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(s.push(n.value),s.length!==e);u=!0);}catch(l){c=!0,o=l}finally{try{if(!u&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}function B$(t){if(Array.isArray(t))return t}function Yn(t){"@babel/helpers - typeof";return Yn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Yn(t)}function j$(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Gb(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(c){throw c},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
36
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,a=!1,s;return{s:function(){r=r.call(t)},n:function(){var c=r.next();return i=c.done,c},e:function(c){a=!0,s=c},f:function(){try{!i&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function Gb(t,e){if(t){if(typeof t=="string")return jb(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return jb(t,e)}}function jb(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Nb(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r.push.apply(r,n)}return r}function ti(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Nb(Object(r),!0).forEach(function(n){N$(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Nb(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function N$(t,e,r){return e=Wb(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function L$(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Lb(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Wb(n.key),n)}}function U$(t,e,r){return e&&Lb(t.prototype,e),r&&Lb(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Wb(t){var e=M$(t,"string");return Yn(e)=="symbol"?e:e+""}function M$(t,e){if(Yn(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Yn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var qu="tus-v1",Hu="ietf-draft-03",Ra="ietf-draft-05",q$={endpoint:null,uploadUrl:null,metadata:{},metadataForPartialUploads:{},fingerprint:null,uploadSize:null,onProgress:null,onChunkComplete:null,onSuccess:null,onError:null,onUploadUrlAvailable:null,overridePatchMethod:!1,headers:{},addRequestId:!1,onBeforeRequest:null,onAfterResponse:null,onShouldRetry:Yb,chunkSize:Number.POSITIVE_INFINITY,retryDelays:[0,1e3,3e3,5e3],parallelUploads:1,parallelUploadBoundaries:null,storeFingerprintForResuming:!0,removeFingerprintOnSuccess:!1,uploadLengthDeferred:!1,uploadDataDuringCreation:!1,urlStorage:null,fileReader:null,httpStack:null,protocol:qu},Kb=(function(){function t(e,r){L$(this,t),"resume"in r&&console.log("tus: The `resume` option has been removed in tus-js-client v2. Please use the URL storage API instead."),this.options=r,this.options.chunkSize=Number(this.options.chunkSize),this._urlStorage=this.options.urlStorage,this.file=e,this.url=null,this._req=null,this._fingerprint=null,this._urlStorageKey=null,this._offset=null,this._aborted=!1,this._size=null,this._source=null,this._retryAttempt=0,this._retryTimeout=null,this._offsetBeforeRetry=0,this._parallelUploads=null,this._parallelUploadUrls=null}return U$(t,[{key:"findPreviousUploads",value:function(){var r=this;return this.options.fingerprint(this.file,this.options).then(function(n){return r._urlStorage.findUploadsByFingerprint(n)})}},{key:"resumeFromPreviousUpload",value:function(r){this.url=r.uploadUrl||null,this._parallelUploadUrls=r.parallelUploadUrls||null,this._urlStorageKey=r.urlStorageKey}},{key:"start",value:function(){var r=this,n=this.file;if(!n){this._emitError(new Error("tus: no file or stream to upload provided"));return}if(![qu,Hu,Ra].includes(this.options.protocol)){this._emitError(new Error("tus: unsupported protocol ".concat(this.options.protocol)));return}if(!this.options.endpoint&&!this.options.uploadUrl&&!this.url){this._emitError(new Error("tus: neither an endpoint or an upload URL is provided"));return}var o=this.options.retryDelays;if(o!=null&&Object.prototype.toString.call(o)!=="[object Array]"){this._emitError(new Error("tus: the `retryDelays` option must either be an array or null"));return}if(this.options.parallelUploads>1)for(var i=0,a=["uploadUrl","uploadSize","uploadLengthDeferred"];i<a.length;i++){var s=a[i];if(this.options[s]){this._emitError(new Error("tus: cannot use the ".concat(s," option when parallelUploads is enabled")));return}}if(this.options.parallelUploadBoundaries){if(this.options.parallelUploads<=1){this._emitError(new Error("tus: cannot use the `parallelUploadBoundaries` option when `parallelUploads` is disabled"));return}if(this.options.parallelUploads!==this.options.parallelUploadBoundaries.length){this._emitError(new Error("tus: the `parallelUploadBoundaries` must have the same length as the value of `parallelUploads`"));return}}this.options.fingerprint(n,this.options).then(function(u){return u==null?(0,Kn.log)("No fingerprint was calculated meaning that the upload cannot be stored in the URL storage."):(0,Kn.log)("Calculated fingerprint: ".concat(u)),r._fingerprint=u,r._source?r._source:r.options.fileReader.openFile(n,r.options.chunkSize)}).then(function(u){if(r._source=u,r.options.uploadLengthDeferred)r._size=null;else if(r.options.uploadSize!=null){if(r._size=Number(r.options.uploadSize),Number.isNaN(r._size)){r._emitError(new Error("tus: cannot convert `uploadSize` option into a number"));return}}else if(r._size=r._source.size,r._size==null){r._emitError(new Error("tus: cannot automatically derive upload's size from input. Specify it manually using the `uploadSize` option or use the `uploadLengthDeferred` option"));return}r.options.parallelUploads>1||r._parallelUploadUrls!=null?r._startParallelUpload():r._startSingleUpload()}).catch(function(u){r._emitError(u)})}},{key:"_startParallelUpload",value:function(){var r,n=this,o=this._size,i=0;this._parallelUploads=[];var a=this._parallelUploadUrls!=null?this._parallelUploadUrls.length:this.options.parallelUploads,s=(r=this.options.parallelUploadBoundaries)!==null&&r!==void 0?r:V$(this._source.size,a);this._parallelUploadUrls&&s.forEach(function(l,f){l.uploadUrl=n._parallelUploadUrls[f]||null}),this._parallelUploadUrls=new Array(s.length);var u=s.map(function(l,f){var d=0;return n._source.slice(l.start,l.end).then(function(h){var m=h.value;return new Promise(function(b,D){var C=ti(ti({},n.options),{},{uploadUrl:l.uploadUrl||null,storeFingerprintForResuming:!1,removeFingerprintOnSuccess:!1,parallelUploads:1,parallelUploadBoundaries:null,metadata:n.options.metadataForPartialUploads,headers:ti(ti({},n.options.headers),{},{"Upload-Concat":"partial"}),onSuccess:b,onError:D,onProgress:function(_){i=i-d+_,d=_,n._emitProgress(i,o)},onUploadUrlAvailable:function(){n._parallelUploadUrls[f]=E.url,n._parallelUploadUrls.filter(function(_){return!!_}).length===s.length&&n._saveUploadInUrlStorage()}}),E=new t(m,C);E.start(),n._parallelUploads.push(E)})})}),c;Promise.all(u).then(function(){c=n._openRequest("POST",n.options.endpoint),c.setHeader("Upload-Concat","final;".concat(n._parallelUploadUrls.join(" ")));var l=Ub(n.options.metadata);return l!==""&&c.setHeader("Upload-Metadata",l),n._sendRequest(c,null)}).then(function(l){if(!ri(l.getStatus(),200)){n._emitHttpError(c,l,"tus: unexpected response while creating upload");return}var f=l.getHeader("Location");if(f==null){n._emitHttpError(c,l,"tus: invalid or missing Location header");return}n.url=Vb(n.options.endpoint,f),(0,Kn.log)("Created upload at ".concat(n.url)),n._emitSuccess(l)}).catch(function(l){n._emitError(l)})}},{key:"_startSingleUpload",value:function(){if(this._aborted=!1,this.url!=null){(0,Kn.log)("Resuming upload from previous URL: ".concat(this.url)),this._resumeUpload();return}if(this.options.uploadUrl!=null){(0,Kn.log)("Resuming upload from provided URL: ".concat(this.options.uploadUrl)),this.url=this.options.uploadUrl,this._resumeUpload();return}(0,Kn.log)("Creating a new upload"),this._createUpload()}},{key:"abort",value:function(r){var n=this;if(this._parallelUploads!=null){var o=j$(this._parallelUploads),i;try{for(o.s();!(i=o.n()).done;){var a=i.value;a.abort(r)}}catch(s){o.e(s)}finally{o.f()}}return this._req!==null&&this._req.abort(),this._aborted=!0,this._retryTimeout!=null&&(clearTimeout(this._retryTimeout),this._retryTimeout=null),!r||this.url==null?Promise.resolve():t.terminate(this.url,this.options).then(function(){return n._removeFromUrlStorage()})}},{key:"_emitHttpError",value:function(r,n,o,i){this._emitError(new Mu.default(o,i,r,n))}},{key:"_emitError",value:function(r){var n=this;if(!this._aborted){if(this.options.retryDelays!=null){var o=this._offset!=null&&this._offset>this._offsetBeforeRetry;if(o&&(this._retryAttempt=0),Hb(r,this._retryAttempt,this.options)){var i=this.options.retryDelays[this._retryAttempt++];this._offsetBeforeRetry=this._offset,this._retryTimeout=setTimeout(function(){n.start()},i);return}}if(typeof this.options.onError=="function")this.options.onError(r);else throw r}}},{key:"_emitSuccess",value:function(r){this.options.removeFingerprintOnSuccess&&this._removeFromUrlStorage(),typeof this.options.onSuccess=="function"&&this.options.onSuccess({lastResponse:r})}},{key:"_emitProgress",value:function(r,n){typeof this.options.onProgress=="function"&&this.options.onProgress(r,n)}},{key:"_emitChunkComplete",value:function(r,n,o){typeof this.options.onChunkComplete=="function"&&this.options.onChunkComplete(r,n,o)}},{key:"_createUpload",value:function(){var r=this;if(!this.options.endpoint){this._emitError(new Error("tus: unable to create upload because no endpoint is provided"));return}var n=this._openRequest("POST",this.options.endpoint);this.options.uploadLengthDeferred?n.setHeader("Upload-Defer-Length","1"):n.setHeader("Upload-Length","".concat(this._size));var o=Ub(this.options.metadata);o!==""&&n.setHeader("Upload-Metadata",o);var i;this.options.uploadDataDuringCreation&&!this.options.uploadLengthDeferred?(this._offset=0,i=this._addChunkToRequest(n)):((this.options.protocol===Hu||this.options.protocol===Ra)&&n.setHeader("Upload-Complete","?0"),i=this._sendRequest(n,null)),i.then(function(a){if(!ri(a.getStatus(),200)){r._emitHttpError(n,a,"tus: unexpected response while creating upload");return}var s=a.getHeader("Location");if(s==null){r._emitHttpError(n,a,"tus: invalid or missing Location header");return}if(r.url=Vb(r.options.endpoint,s),(0,Kn.log)("Created upload at ".concat(r.url)),typeof r.options.onUploadUrlAvailable=="function"&&r.options.onUploadUrlAvailable(),r._size===0){r._emitSuccess(a),r._source.close();return}r._saveUploadInUrlStorage().then(function(){r.options.uploadDataDuringCreation?r._handleUploadResponse(n,a):(r._offset=0,r._performUpload())})}).catch(function(a){r._emitHttpError(n,null,"tus: failed to create upload",a)})}},{key:"_resumeUpload",value:function(){var r=this,n=this._openRequest("HEAD",this.url),o=this._sendRequest(n,null);o.then(function(i){var a=i.getStatus();if(!ri(a,200)){if(a===423){r._emitHttpError(n,i,"tus: upload is currently locked; retry later");return}if(ri(a,400)&&r._removeFromUrlStorage(),!r.options.endpoint){r._emitHttpError(n,i,"tus: unable to resume upload (new upload cannot be created without an endpoint)");return}r.url=null,r._createUpload();return}var s=Number.parseInt(i.getHeader("Upload-Offset"),10);if(Number.isNaN(s)){r._emitHttpError(n,i,"tus: invalid or missing offset value");return}var u=Number.parseInt(i.getHeader("Upload-Length"),10);if(Number.isNaN(u)&&!r.options.uploadLengthDeferred&&r.options.protocol===qu){r._emitHttpError(n,i,"tus: invalid or missing length value");return}typeof r.options.onUploadUrlAvailable=="function"&&r.options.onUploadUrlAvailable(),r._saveUploadInUrlStorage().then(function(){if(s===u){r._emitProgress(u,u),r._emitSuccess(i);return}r._offset=s,r._performUpload()})}).catch(function(i){r._emitHttpError(n,null,"tus: failed to resume upload",i)})}},{key:"_performUpload",value:function(){var r=this;if(!this._aborted){var n;this.options.overridePatchMethod?(n=this._openRequest("POST",this.url),n.setHeader("X-HTTP-Method-Override","PATCH")):n=this._openRequest("PATCH",this.url),n.setHeader("Upload-Offset","".concat(this._offset));var o=this._addChunkToRequest(n);o.then(function(i){if(!ri(i.getStatus(),200)){r._emitHttpError(n,i,"tus: unexpected response while uploading chunk");return}r._handleUploadResponse(n,i)}).catch(function(i){r._aborted||r._emitHttpError(n,null,"tus: failed to upload chunk at offset ".concat(r._offset),i)})}}},{key:"_addChunkToRequest",value:function(r){var n=this,o=this._offset,i=this._offset+this.options.chunkSize;return r.setProgressHandler(function(a){n._emitProgress(o+a,n._size)}),this.options.protocol===qu?r.setHeader("Content-Type","application/offset+octet-stream"):this.options.protocol===Ra&&r.setHeader("Content-Type","application/partial-upload"),(i===Number.POSITIVE_INFINITY||i>this._size)&&!this.options.uploadLengthDeferred&&(i=this._size),this._source.slice(o,i).then(function(a){var s=a.value,u=a.done,c=s!=null&&s.size?s.size:0;n.options.uploadLengthDeferred&&u&&(n._size=n._offset+c,r.setHeader("Upload-Length","".concat(n._size)));var l=n._offset+c;return!n.options.uploadLengthDeferred&&u&&l!==n._size?Promise.reject(new Error("upload was configured with a size of ".concat(n._size," bytes, but the source is done after ").concat(l," bytes"))):s===null?n._sendRequest(r):((n.options.protocol===Hu||n.options.protocol===Ra)&&r.setHeader("Upload-Complete",u?"?1":"?0"),n._emitProgress(n._offset,n._size),n._sendRequest(r,s))})}},{key:"_handleUploadResponse",value:function(r,n){var o=Number.parseInt(n.getHeader("Upload-Offset"),10);if(Number.isNaN(o)){this._emitHttpError(r,n,"tus: invalid or missing offset value");return}if(this._emitProgress(o,this._size),this._emitChunkComplete(o-this._offset,o,this._size),this._offset=o,o===this._size){this._emitSuccess(n),this._source.close();return}this._performUpload()}},{key:"_openRequest",value:function(r,n){var o=Mb(r,n,this.options);return this._req=o,o}},{key:"_removeFromUrlStorage",value:function(){var r=this;this._urlStorageKey&&(this._urlStorage.removeUpload(this._urlStorageKey).catch(function(n){r._emitError(n)}),this._urlStorageKey=null)}},{key:"_saveUploadInUrlStorage",value:function(){var r=this;if(!this.options.storeFingerprintForResuming||!this._fingerprint||this._urlStorageKey!==null)return Promise.resolve();var n={size:this._size,metadata:this.options.metadata,creationTime:new Date().toString()};return this._parallelUploads?n.parallelUploadUrls=this._parallelUploadUrls:n.uploadUrl=this.url,this._urlStorage.addUpload(this._fingerprint,n).then(function(o){r._urlStorageKey=o})}},{key:"_sendRequest",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return qb(r,n,this.options)}}],[{key:"terminate",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=Mb("DELETE",r,n);return qb(o,null,n).then(function(i){if(i.getStatus()!==204)throw new Mu.default("tus: unexpected response while terminating upload",null,o,i)}).catch(function(i){if(i instanceof Mu.default||(i=new Mu.default("tus: failed to terminate upload",i,o,null)),!Hb(i,0,n))throw i;var a=n.retryDelays[0],s=n.retryDelays.slice(1),u=ti(ti({},n),{},{retryDelays:s});return new Promise(function(c){return setTimeout(c,a)}).then(function(){return t.terminate(r,u)})})}}])})();function Ub(t){return Object.entries(t).map(function(e){var r=zb(e,2),n=r[0],o=r[1];return"".concat(n," ").concat(k$.Base64.encode(String(o)))}).join(",")}function ri(t,e){return t>=e&&t<e+100}function Mb(t,e,r){var n=r.httpStack.createRequest(t,e);r.protocol===Hu?n.setHeader("Upload-Draft-Interop-Version","5"):r.protocol===Ra?n.setHeader("Upload-Draft-Interop-Version","6"):n.setHeader("Tus-Resumable","1.0.0");for(var o=r.headers||{},i=0,a=Object.entries(o);i<a.length;i++){var s=zb(a[i],2),u=s[0],c=s[1];n.setHeader(u,c)}if(r.addRequestId){var l=(0,P$.default)();n.setHeader("X-Request-ID",l)}return n}function qb(t,e,r){return Md.apply(this,arguments)}function Md(){return Md=T$(Ud().mark(function t(e,r,n){var o;return Ud().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(typeof n.onBeforeRequest!="function"){a.next=3;break}return a.next=3,n.onBeforeRequest(e);case 3:return a.next=5,e.send(r);case 5:if(o=a.sent,typeof n.onAfterResponse!="function"){a.next=9;break}return a.next=9,n.onAfterResponse(e,o);case 9:return a.abrupt("return",o);case 10:case"end":return a.stop()}},t)})),Md.apply(this,arguments)}function H$(){var t=!0;return typeof navigator<"u"&&navigator.onLine===!1&&(t=!1),t}function Hb(t,e,r){return r.retryDelays==null||e>=r.retryDelays.length||t.originalRequest==null?!1:r&&typeof r.onShouldRetry=="function"?r.onShouldRetry(t,e,r):Yb(t)}function Yb(t){var e=t.originalResponse?t.originalResponse.getStatus():0;return(!ri(e,400)||e===409||e===423)&&H$()}function Vb(t,e){return new $$.default(e,t).toString()}function V$(t,e){for(var r=Math.floor(t/e),n=[],o=0;o<e;o++)n.push({start:r*o,end:r*(o+1)});return n[e-1].end=t,n}Kb.defaultOptions=q$;var ZV=Vu.default=Kb});var Zb=x((ez,Xb)=>{"use strict";var kr=t=>t!==null&&typeof t=="object"&&typeof t.pipe=="function";kr.writable=t=>kr(t)&&t.writable!==!1&&typeof t._write=="function"&&typeof t._writableState=="object";kr.readable=t=>kr(t)&&t.readable!==!1&&typeof t._read=="function"&&typeof t._readableState=="object";kr.duplex=t=>kr.writable(t)&&kr.readable(t);kr.transform=t=>kr.duplex(t)&&typeof t._transform=="function";Xb.exports=kr});var ev=x(zu=>{"use strict";Object.defineProperty(zu,"__esModule",{value:!0});zu.default=void 0;function Ba(t){"@babel/helpers - typeof";return Ba=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ba(t)}function z$(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Qb(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,W$(n.key),n)}}function G$(t,e,r){return e&&Qb(t.prototype,e),r&&Qb(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function W$(t){var e=K$(t,"string");return Ba(e)=="symbol"?e:e+""}function K$(t,e){if(Ba(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Ba(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var tz=zu.default=(function(){function t(e){z$(this,t),this._buffer=e,this.size=e.length}return G$(t,[{key:"slice",value:function(r,n){var o=this._buffer.slice(r,n);o.size=o.length;var i=n>=this.size;return Promise.resolve({value:o,done:i})}},{key:"close",value:function(){}}])})()});var ov=x(zd=>{"use strict";Object.defineProperty(zd,"__esModule",{value:!0});zd.default=eP;var nv=require("fs");function Jn(t){"@babel/helpers - typeof";return Jn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Jn(t)}function Hd(){"use strict";Hd=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(y,v,w){y[v]=w.value},i=typeof Symbol=="function"?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(y,v,w){return Object.defineProperty(y,v,{value:w,enumerable:!0,configurable:!0,writable:!0}),y[v]}try{c({},"")}catch{c=function(w,F,T){return w[F]=T}}function l(y,v,w,F){var T=v&&v.prototype instanceof C?v:C,k=Object.create(T.prototype),M=new Q(F||[]);return o(k,"_invoke",{value:N(y,w,M)}),k}function f(y,v,w){try{return{type:"normal",arg:y.call(v,w)}}catch(F){return{type:"throw",arg:F}}}e.wrap=l;var d="suspendedStart",h="suspendedYield",m="executing",b="completed",D={};function C(){}function E(){}function g(){}var _={};c(_,a,function(){return this});var S=Object.getPrototypeOf,I=S&&S(S($([])));I&&I!==r&&n.call(I,a)&&(_=I);var O=g.prototype=C.prototype=Object.create(_);function B(y){["next","throw","return"].forEach(function(v){c(y,v,function(w){return this._invoke(v,w)})})}function R(y,v){function w(T,k,M,P){var j=f(y[T],y,k);if(j.type!=="throw"){var ee=j.arg,V=ee.value;return V&&Jn(V)=="object"&&n.call(V,"__await")?v.resolve(V.__await).then(function(se){w("next",se,M,P)},function(se){w("throw",se,M,P)}):v.resolve(V).then(function(se){ee.value=se,M(ee)},function(se){return w("throw",se,M,P)})}P(j.arg)}var F;o(this,"_invoke",{value:function(k,M){function P(){return new v(function(j,ee){w(k,M,j,ee)})}return F=F?F.then(P,P):P()}})}function N(y,v,w){var F=d;return function(T,k){if(F===m)throw Error("Generator is already running");if(F===b){if(T==="throw")throw k;return{value:t,done:!0}}for(w.method=T,w.arg=k;;){var M=w.delegate;if(M){var P=A(M,w);if(P){if(P===D)continue;return P}}if(w.method==="next")w.sent=w._sent=w.arg;else if(w.method==="throw"){if(F===d)throw F=b,w.arg;w.dispatchException(w.arg)}else w.method==="return"&&w.abrupt("return",w.arg);F=m;var j=f(y,v,w);if(j.type==="normal"){if(F=w.done?b:h,j.arg===D)continue;return{value:j.arg,done:w.done}}j.type==="throw"&&(F=b,w.method="throw",w.arg=j.arg)}}}function A(y,v){var w=v.method,F=y.iterator[w];if(F===t)return v.delegate=null,w==="throw"&&y.iterator.return&&(v.method="return",v.arg=t,A(y,v),v.method==="throw")||w!=="return"&&(v.method="throw",v.arg=new TypeError("The iterator does not provide a '"+w+"' method")),D;var T=f(F,y.iterator,v.arg);if(T.type==="throw")return v.method="throw",v.arg=T.arg,v.delegate=null,D;var k=T.arg;return k?k.done?(v[y.resultName]=k.value,v.next=y.nextLoc,v.method!=="return"&&(v.method="next",v.arg=t),v.delegate=null,D):k:(v.method="throw",v.arg=new TypeError("iterator result is not an object"),v.delegate=null,D)}function L(y){var v={tryLoc:y[0]};1 in y&&(v.catchLoc=y[1]),2 in y&&(v.finallyLoc=y[2],v.afterLoc=y[3]),this.tryEntries.push(v)}function q(y){var v=y.completion||{};v.type="normal",delete v.arg,y.completion=v}function Q(y){this.tryEntries=[{tryLoc:"root"}],y.forEach(L,this),this.reset(!0)}function $(y){if(y||y===""){var v=y[a];if(v)return v.call(y);if(typeof y.next=="function")return y;if(!isNaN(y.length)){var w=-1,F=function T(){for(;++w<y.length;)if(n.call(y,w))return T.value=y[w],T.done=!1,T;return T.value=t,T.done=!0,T};return F.next=F}}throw new TypeError(Jn(y)+" is not iterable")}return E.prototype=g,o(O,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:E,configurable:!0}),E.displayName=c(g,u,"GeneratorFunction"),e.isGeneratorFunction=function(y){var v=typeof y=="function"&&y.constructor;return!!v&&(v===E||(v.displayName||v.name)==="GeneratorFunction")},e.mark=function(y){return Object.setPrototypeOf?Object.setPrototypeOf(y,g):(y.__proto__=g,c(y,u,"GeneratorFunction")),y.prototype=Object.create(O),y},e.awrap=function(y){return{__await:y}},B(R.prototype),c(R.prototype,s,function(){return this}),e.AsyncIterator=R,e.async=function(y,v,w,F,T){T===void 0&&(T=Promise);var k=new R(l(y,v,w,F),T);return e.isGeneratorFunction(v)?k:k.next().then(function(M){return M.done?M.value:k.next()})},B(O),c(O,u,"Generator"),c(O,a,function(){return this}),c(O,"toString",function(){return"[object Generator]"}),e.keys=function(y){var v=Object(y),w=[];for(var F in v)w.push(F);return w.reverse(),function T(){for(;w.length;){var k=w.pop();if(k in v)return T.value=k,T.done=!1,T}return T.done=!0,T}},e.values=$,Q.prototype={constructor:Q,reset:function(v){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(q),!v)for(var w in this)w.charAt(0)==="t"&&n.call(this,w)&&!isNaN(+w.slice(1))&&(this[w]=t)},stop:function(){this.done=!0;var v=this.tryEntries[0].completion;if(v.type==="throw")throw v.arg;return this.rval},dispatchException:function(v){if(this.done)throw v;var w=this;function F(ee,V){return M.type="throw",M.arg=v,w.next=ee,V&&(w.method="next",w.arg=t),!!V}for(var T=this.tryEntries.length-1;T>=0;--T){var k=this.tryEntries[T],M=k.completion;if(k.tryLoc==="root")return F("end");if(k.tryLoc<=this.prev){var P=n.call(k,"catchLoc"),j=n.call(k,"finallyLoc");if(P&&j){if(this.prev<k.catchLoc)return F(k.catchLoc,!0);if(this.prev<k.finallyLoc)return F(k.finallyLoc)}else if(P){if(this.prev<k.catchLoc)return F(k.catchLoc,!0)}else{if(!j)throw Error("try statement without catch or finally");if(this.prev<k.finallyLoc)return F(k.finallyLoc)}}}},abrupt:function(v,w){for(var F=this.tryEntries.length-1;F>=0;--F){var T=this.tryEntries[F];if(T.tryLoc<=this.prev&&n.call(T,"finallyLoc")&&this.prev<T.finallyLoc){var k=T;break}}k&&(v==="break"||v==="continue")&&k.tryLoc<=w&&w<=k.finallyLoc&&(k=null);var M=k?k.completion:{};return M.type=v,M.arg=w,k?(this.method="next",this.next=k.finallyLoc,D):this.complete(M)},complete:function(v,w){if(v.type==="throw")throw v.arg;return v.type==="break"||v.type==="continue"?this.next=v.arg:v.type==="return"?(this.rval=this.arg=v.arg,this.method="return",this.next="end"):v.type==="normal"&&w&&(this.next=w),D},finish:function(v){for(var w=this.tryEntries.length-1;w>=0;--w){var F=this.tryEntries[w];if(F.finallyLoc===v)return this.complete(F.completion,F.afterLoc),q(F),D}},catch:function(v){for(var w=this.tryEntries.length-1;w>=0;--w){var F=this.tryEntries[w];if(F.tryLoc===v){var T=F.completion;if(T.type==="throw"){var k=T.arg;q(F)}return k}}throw Error("illegal catch attempt")},delegateYield:function(v,w,F){return this.delegate={iterator:$(v),resultName:w,nextLoc:F},this.method==="next"&&(this.arg=t),D}},e}function Y$(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function tv(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,X$(n.key),n)}}function J$(t,e,r){return e&&tv(t.prototype,e),r&&tv(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function X$(t){var e=Z$(t,"string");return Jn(e)=="symbol"?e:e+""}function Z$(t,e){if(Jn(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Jn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function rv(t,e,r,n,o,i,a){try{var s=t[i](a),u=s.value}catch(c){r(c);return}s.done?e(u):Promise.resolve(u).then(n,o)}function Q$(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(u){rv(i,n,o,a,s,"next",u)}function s(u){rv(i,n,o,a,s,"throw",u)}a(void 0)})}}function eP(t){return Vd.apply(this,arguments)}function Vd(){return Vd=Q$(Hd().mark(function t(e){var r,n,o,i,a,s,u;return Hd().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return n=e.path.toString(),l.next=3,nv.promises.stat(n);case 3:return o=l.sent,i=o.size,a=(r=e.start)!==null&&r!==void 0?r:0,s=Number.isFinite(e.end)?e.end+1:i,u=s-a,l.abrupt("return",new tP(e,n,u));case 9:case"end":return l.stop()}},t)})),Vd.apply(this,arguments)}var tP=(function(){function t(e,r,n){Y$(this,t),this._stream=e,this._path=r,this.size=n}return J$(t,[{key:"slice",value:function(r,n){var o,i=(o=this._stream.start)!==null&&o!==void 0?o:0,a=(0,nv.createReadStream)(this._path,{start:i+r,end:i+n-1,autoClose:!0});a.size=Math.min(n-r,this.size);var s=a.size>=this.size;return Promise.resolve({value:a,done:s})}},{key:"close",value:function(){this._stream.destroy()}}])})()});var Wd=x(Gu=>{"use strict";Object.defineProperty(Gu,"__esModule",{value:!0});Gu.default=void 0;function Xn(t){"@babel/helpers - typeof";return Xn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Xn(t)}function ja(){"use strict";ja=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(y,v,w){y[v]=w.value},i=typeof Symbol=="function"?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(y,v,w){return Object.defineProperty(y,v,{value:w,enumerable:!0,configurable:!0,writable:!0}),y[v]}try{c({},"")}catch{c=function(w,F,T){return w[F]=T}}function l(y,v,w,F){var T=v&&v.prototype instanceof C?v:C,k=Object.create(T.prototype),M=new Q(F||[]);return o(k,"_invoke",{value:N(y,w,M)}),k}function f(y,v,w){try{return{type:"normal",arg:y.call(v,w)}}catch(F){return{type:"throw",arg:F}}}e.wrap=l;var d="suspendedStart",h="suspendedYield",m="executing",b="completed",D={};function C(){}function E(){}function g(){}var _={};c(_,a,function(){return this});var S=Object.getPrototypeOf,I=S&&S(S($([])));I&&I!==r&&n.call(I,a)&&(_=I);var O=g.prototype=C.prototype=Object.create(_);function B(y){["next","throw","return"].forEach(function(v){c(y,v,function(w){return this._invoke(v,w)})})}function R(y,v){function w(T,k,M,P){var j=f(y[T],y,k);if(j.type!=="throw"){var ee=j.arg,V=ee.value;return V&&Xn(V)=="object"&&n.call(V,"__await")?v.resolve(V.__await).then(function(se){w("next",se,M,P)},function(se){w("throw",se,M,P)}):v.resolve(V).then(function(se){ee.value=se,M(ee)},function(se){return w("throw",se,M,P)})}P(j.arg)}var F;o(this,"_invoke",{value:function(k,M){function P(){return new v(function(j,ee){w(k,M,j,ee)})}return F=F?F.then(P,P):P()}})}function N(y,v,w){var F=d;return function(T,k){if(F===m)throw Error("Generator is already running");if(F===b){if(T==="throw")throw k;return{value:t,done:!0}}for(w.method=T,w.arg=k;;){var M=w.delegate;if(M){var P=A(M,w);if(P){if(P===D)continue;return P}}if(w.method==="next")w.sent=w._sent=w.arg;else if(w.method==="throw"){if(F===d)throw F=b,w.arg;w.dispatchException(w.arg)}else w.method==="return"&&w.abrupt("return",w.arg);F=m;var j=f(y,v,w);if(j.type==="normal"){if(F=w.done?b:h,j.arg===D)continue;return{value:j.arg,done:w.done}}j.type==="throw"&&(F=b,w.method="throw",w.arg=j.arg)}}}function A(y,v){var w=v.method,F=y.iterator[w];if(F===t)return v.delegate=null,w==="throw"&&y.iterator.return&&(v.method="return",v.arg=t,A(y,v),v.method==="throw")||w!=="return"&&(v.method="throw",v.arg=new TypeError("The iterator does not provide a '"+w+"' method")),D;var T=f(F,y.iterator,v.arg);if(T.type==="throw")return v.method="throw",v.arg=T.arg,v.delegate=null,D;var k=T.arg;return k?k.done?(v[y.resultName]=k.value,v.next=y.nextLoc,v.method!=="return"&&(v.method="next",v.arg=t),v.delegate=null,D):k:(v.method="throw",v.arg=new TypeError("iterator result is not an object"),v.delegate=null,D)}function L(y){var v={tryLoc:y[0]};1 in y&&(v.catchLoc=y[1]),2 in y&&(v.finallyLoc=y[2],v.afterLoc=y[3]),this.tryEntries.push(v)}function q(y){var v=y.completion||{};v.type="normal",delete v.arg,y.completion=v}function Q(y){this.tryEntries=[{tryLoc:"root"}],y.forEach(L,this),this.reset(!0)}function $(y){if(y||y===""){var v=y[a];if(v)return v.call(y);if(typeof y.next=="function")return y;if(!isNaN(y.length)){var w=-1,F=function T(){for(;++w<y.length;)if(n.call(y,w))return T.value=y[w],T.done=!1,T;return T.value=t,T.done=!0,T};return F.next=F}}throw new TypeError(Xn(y)+" is not iterable")}return E.prototype=g,o(O,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:E,configurable:!0}),E.displayName=c(g,u,"GeneratorFunction"),e.isGeneratorFunction=function(y){var v=typeof y=="function"&&y.constructor;return!!v&&(v===E||(v.displayName||v.name)==="GeneratorFunction")},e.mark=function(y){return Object.setPrototypeOf?Object.setPrototypeOf(y,g):(y.__proto__=g,c(y,u,"GeneratorFunction")),y.prototype=Object.create(O),y},e.awrap=function(y){return{__await:y}},B(R.prototype),c(R.prototype,s,function(){return this}),e.AsyncIterator=R,e.async=function(y,v,w,F,T){T===void 0&&(T=Promise);var k=new R(l(y,v,w,F),T);return e.isGeneratorFunction(v)?k:k.next().then(function(M){return M.done?M.value:k.next()})},B(O),c(O,u,"Generator"),c(O,a,function(){return this}),c(O,"toString",function(){return"[object Generator]"}),e.keys=function(y){var v=Object(y),w=[];for(var F in v)w.push(F);return w.reverse(),function T(){for(;w.length;){var k=w.pop();if(k in v)return T.value=k,T.done=!1,T}return T.done=!0,T}},e.values=$,Q.prototype={constructor:Q,reset:function(v){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(q),!v)for(var w in this)w.charAt(0)==="t"&&n.call(this,w)&&!isNaN(+w.slice(1))&&(this[w]=t)},stop:function(){this.done=!0;var v=this.tryEntries[0].completion;if(v.type==="throw")throw v.arg;return this.rval},dispatchException:function(v){if(this.done)throw v;var w=this;function F(ee,V){return M.type="throw",M.arg=v,w.next=ee,V&&(w.method="next",w.arg=t),!!V}for(var T=this.tryEntries.length-1;T>=0;--T){var k=this.tryEntries[T],M=k.completion;if(k.tryLoc==="root")return F("end");if(k.tryLoc<=this.prev){var P=n.call(k,"catchLoc"),j=n.call(k,"finallyLoc");if(P&&j){if(this.prev<k.catchLoc)return F(k.catchLoc,!0);if(this.prev<k.finallyLoc)return F(k.finallyLoc)}else if(P){if(this.prev<k.catchLoc)return F(k.catchLoc,!0)}else{if(!j)throw Error("try statement without catch or finally");if(this.prev<k.finallyLoc)return F(k.finallyLoc)}}}},abrupt:function(v,w){for(var F=this.tryEntries.length-1;F>=0;--F){var T=this.tryEntries[F];if(T.tryLoc<=this.prev&&n.call(T,"finallyLoc")&&this.prev<T.finallyLoc){var k=T;break}}k&&(v==="break"||v==="continue")&&k.tryLoc<=w&&w<=k.finallyLoc&&(k=null);var M=k?k.completion:{};return M.type=v,M.arg=w,k?(this.method="next",this.next=k.finallyLoc,D):this.complete(M)},complete:function(v,w){if(v.type==="throw")throw v.arg;return v.type==="break"||v.type==="continue"?this.next=v.arg:v.type==="return"?(this.rval=this.arg=v.arg,this.method="return",this.next="end"):v.type==="normal"&&w&&(this.next=w),D},finish:function(v){for(var w=this.tryEntries.length-1;w>=0;--w){var F=this.tryEntries[w];if(F.finallyLoc===v)return this.complete(F.completion,F.afterLoc),q(F),D}},catch:function(v){for(var w=this.tryEntries.length-1;w>=0;--w){var F=this.tryEntries[w];if(F.tryLoc===v){var T=F.completion;if(T.type==="throw"){var k=T.arg;q(F)}return k}}throw Error("illegal catch attempt")},delegateYield:function(v,w,F){return this.delegate={iterator:$(v),resultName:w,nextLoc:F},this.method==="next"&&(this.arg=t),D}},e}function rP(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function iv(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,oP(n.key),n)}}function nP(t,e,r){return e&&iv(t.prototype,e),r&&iv(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function oP(t){var e=iP(t,"string");return Xn(e)=="symbol"?e:e+""}function iP(t,e){if(Xn(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Xn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function av(t,e,r,n,o,i,a){try{var s=t[i](a),u=s.value}catch(c){r(c);return}s.done?e(u):Promise.resolve(u).then(n,o)}function sv(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(u){av(i,n,o,a,s,"next",u)}function s(u){av(i,n,o,a,s,"throw",u)}a(void 0)})}}function aP(t,e){return Gd.apply(this,arguments)}function Gd(){return Gd=sv(ja().mark(function t(e,r){return ja().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.abrupt("return",new Promise(function(i,a){var s=function(l){e.off("readable",u),a(l)},u=function c(){var l=e.read(r);l!==null&&(e.off("error",s),e.off("readable",c),i(l))};e.once("error",s),e.on("readable",u)}));case 1:case"end":return o.stop()}},t)})),Gd.apply(this,arguments)}var oz=Gu.default=(function(){function t(e){var r=this;rP(this,t),this._stream=e,this.size=null,this._buf=Buffer.alloc(0),this._bufPos=0,this._ended=!1,this._error=null,e.pause(),e.on("end",function(){r._ended=!0}),e.on("error",function(n){r._error=n})}return nP(t,[{key:"slice",value:(function(){var e=sv(ja().mark(function n(o,i){var a,s,u,c,l;return ja().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:if(!(o<this._bufPos)){d.next=2;break}throw new Error("cannot slice from position which we already seeked away");case 2:if(!(o>this._bufPos+this._buf.length)){d.next=4;break}throw new Error("slice start is outside of buffer (currently not implemented)");case 4:if(!this._error){d.next=6;break}throw this._error;case 6:if(o<this._bufPos+this._buf.length?(s=o-this._bufPos,u=Math.min(this._buf.length,i-this._bufPos),a=this._buf.slice(s,u)):a=Buffer.alloc(0),!this._ended){d.next=10;break}return a.size=a.length,d.abrupt("return",{value:a,done:!0});case 10:if(c=i-o,!(c>a.length)){d.next=16;break}return d.next=14,aP(this._stream,c-a.length);case 14:l=d.sent,a=Buffer.concat([a,l]);case 16:return this._buf=a,this._bufPos=o,a.size=a.length,d.abrupt("return",{value:a,done:this._ended});case 20:case"end":return d.stop()}},n,this)}));function r(n,o){return e.apply(this,arguments)}return r})()},{key:"close",value:function(){this._stream.destroy()}}])})()});var cv=x(Ku=>{"use strict";Object.defineProperty(Ku,"__esModule",{value:!0});Ku.default=void 0;var sP=require("fs"),uP=Wu(Zb()),cP=Wu(ev()),lP=Wu(ov()),fP=Wu(Wd());function Wu(t){return t&&t.__esModule?t:{default:t}}function Na(t){"@babel/helpers - typeof";return Na=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Na(t)}function pP(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function uv(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,hP(n.key),n)}}function dP(t,e,r){return e&&uv(t.prototype,e),r&&uv(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function hP(t){var e=mP(t,"string");return Na(e)=="symbol"?e:e+""}function mP(t,e){if(Na(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Na(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var az=Ku.default=(function(){function t(){pP(this,t)}return dP(t,[{key:"openFile",value:function(r,n){return Buffer.isBuffer(r)?Promise.resolve(new cP.default(r)):r instanceof sP.ReadStream&&r.path!=null?(0,lP.default)(r):uP.default.readable(r)?(n=Number(n),Number.isFinite(n)?Promise.resolve(new fP.default(r)):Promise.reject(new Error("cannot create source for stream without a finite value for the `chunkSize` option; specify a chunkSize to control the memory consumption"))):Promise.reject(new Error("source object may only be an instance of Buffer or Readable in this environment"))}}])})()});var dv=x(Kd=>{"use strict";Object.defineProperty(Kd,"__esModule",{value:!0});Kd.default=yP;var gP=require("crypto"),lv=pv(require("fs")),DP=pv(require("path"));function fv(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(fv=function(n){return n?r:e})(t)}function pv(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=fv(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if(i!=="default"&&{}.hasOwnProperty.call(t,i)){var a=o?Object.getOwnPropertyDescriptor(t,i):null;a&&(a.get||a.set)?Object.defineProperty(n,i,a):n[i]=t[i]}return n.default=t,r&&r.set(t,n),n}function yP(t,e){if(Buffer.isBuffer(t)){var r=65536,n=t.slice(0,Math.min(r,t.length)),o=(0,gP.createHash)("md5").update(n).digest("hex"),i=["node-buffer",o,t.length,e.endpoint].join("-");return Promise.resolve(i)}return t instanceof lv.ReadStream&&t.path!=null?new Promise(function(a,s){var u=DP.resolve(t.path);lv.stat(t.path,function(c,l){if(c){s(c);return}var f=["node-file",u,l.size,l.mtime.getTime(),e.endpoint].join("-");a(f)})}):Promise.resolve(null)}});var yv=x((cz,Dv)=>{var gv="Expected a function",hv=NaN,bP="[object Symbol]",vP=/^\s+|\s+$/g,wP=/^[-+]0x[0-9a-f]+$/i,CP=/^0b[01]+$/i,EP=/^0o[0-7]+$/i,_P=parseInt,xP=typeof global=="object"&&global&&global.Object===Object&&global,SP=typeof self=="object"&&self&&self.Object===Object&&self,FP=xP||SP||Function("return this")(),AP=Object.prototype,OP=AP.toString,kP=Math.max,$P=Math.min,Yd=function(){return FP.Date.now()};function PP(t,e,r){var n,o,i,a,s,u,c=0,l=!1,f=!1,d=!0;if(typeof t!="function")throw new TypeError(gv);e=mv(e)||0,Yu(r)&&(l=!!r.leading,f="maxWait"in r,i=f?kP(mv(r.maxWait)||0,e):i,d="trailing"in r?!!r.trailing:d);function h(I){var O=n,B=o;return n=o=void 0,c=I,a=t.apply(B,O),a}function m(I){return c=I,s=setTimeout(C,e),l?h(I):a}function b(I){var O=I-u,B=I-c,R=e-O;return f?$P(R,i-B):R}function D(I){var O=I-u,B=I-c;return u===void 0||O>=e||O<0||f&&B>=i}function C(){var I=Yd();if(D(I))return E(I);s=setTimeout(C,b(I))}function E(I){return s=void 0,d&&n?h(I):(n=o=void 0,a)}function g(){s!==void 0&&clearTimeout(s),c=0,n=u=o=s=void 0}function _(){return s===void 0?a:E(Yd())}function S(){var I=Yd(),O=D(I);if(n=arguments,o=this,u=I,O){if(s===void 0)return m(u);if(f)return s=setTimeout(C,e),h(u)}return s===void 0&&(s=setTimeout(C,e)),a}return S.cancel=g,S.flush=_,S}function TP(t,e,r){var n=!0,o=!0;if(typeof t!="function")throw new TypeError(gv);return Yu(r)&&(n="leading"in r?!!r.leading:n,o="trailing"in r?!!r.trailing:o),PP(t,e,{leading:n,maxWait:e,trailing:o})}function Yu(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function IP(t){return!!t&&typeof t=="object"}function RP(t){return typeof t=="symbol"||IP(t)&&OP.call(t)==bP}function mv(t){if(typeof t=="number")return t;if(RP(t))return hv;if(Yu(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Yu(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(vP,"");var r=CP.test(t);return r||EP.test(t)?_P(t.slice(2),r?2:8):wP.test(t)?hv:+t}Dv.exports=TP});var Fv=x(Qu=>{"use strict";Object.defineProperty(Qu,"__esModule",{value:!0});Qu.default=void 0;var BP=_v(require("http")),jP=_v(require("https")),wv=require("stream"),NP=require("url"),Cv=LP(yv());function LP(t){return t&&t.__esModule?t:{default:t}}function Ev(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(Ev=function(n){return n?r:e})(t)}function _v(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=Ev(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if(i!=="default"&&{}.hasOwnProperty.call(t,i)){var a=o?Object.getOwnPropertyDescriptor(t,i):null;a&&(a.get||a.set)?Object.defineProperty(n,i,a):n[i]=t[i]}return n.default=t,r&&r.set(t,n),n}function UP(t,e,r){return e=Ju(e),MP(t,xv()?Reflect.construct(e,r||[],Ju(t).constructor):e.apply(t,r))}function MP(t,e){if(e&&(ni(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return qP(t)}function qP(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function xv(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(xv=function(){return!!t})()}function Ju(t){return Ju=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Ju(t)}function HP(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Jd(t,e)}function Jd(t,e){return Jd=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Jd(t,e)}function bv(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r.push.apply(r,n)}return r}function La(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?bv(Object(r),!0).forEach(function(n){VP(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):bv(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function VP(t,e,r){return e=Sv(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ni(t){"@babel/helpers - typeof";return ni=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ni(t)}function Xu(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function vv(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Sv(n.key),n)}}function Zu(t,e,r){return e&&vv(t.prototype,e),r&&vv(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Sv(t){var e=zP(t,"string");return ni(e)=="symbol"?e:e+""}function zP(t,e){if(ni(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ni(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var lz=Qu.default=(function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Xu(this,t),this._requestOptions=e}return Zu(t,[{key:"createRequest",value:function(r,n){return new GP(r,n,this._requestOptions)}},{key:"getName",value:function(){return"NodeHttpStack"}}])})(),GP=(function(){function t(e,r,n){Xu(this,t),this._method=e,this._url=r,this._headers={},this._request=null,this._progressHandler=function(){},this._requestOptions=n||{}}return Zu(t,[{key:"getMethod",value:function(){return this._method}},{key:"getURL",value:function(){return this._url}},{key:"setHeader",value:function(r,n){this._headers[r]=n}},{key:"getHeader",value:function(r){return this._headers[r]}},{key:"setProgressHandler",value:function(r){this._progressHandler=r}},{key:"send",value:function(){var r=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return new Promise(function(o,i){var a=La(La(La({},(0,NP.parse)(r._url)),r._requestOptions),{},{method:r._method,headers:La(La({},r._requestOptions.headers||{}),r._headers)});n!=null&&n.size&&(a.headers["Content-Length"]=n.size);var s=a.protocol==="https:"?jP:BP;r._request=s.request(a);var u=r._request;u.on("response",function(c){var l=[];c.on("data",function(f){l.push(f)}),c.on("end",function(){var f=Buffer.concat(l).toString("utf8");o(new WP(c,f))})}),u.on("error",function(c){i(c)}),n instanceof wv.Readable?n.pipe(new KP(r._progressHandler)).pipe(u):n instanceof Uint8Array?YP(u,n,r._progressHandler):u.end(n)})}},{key:"abort",value:function(){return this._request!==null&&this._request.abort(),Promise.resolve()}},{key:"getUnderlyingObject",value:function(){return this._request}}])})(),WP=(function(){function t(e,r){Xu(this,t),this._response=e,this._body=r}return Zu(t,[{key:"getStatus",value:function(){return this._response.statusCode}},{key:"getHeader",value:function(r){return this._response.headers[r.toLowerCase()]}},{key:"getBody",value:function(){return this._body}},{key:"getUnderlyingObject",value:function(){return this._response}}])})(),KP=(function(t){function e(r){var n;return Xu(this,e),n=UP(this,e),n._onprogress=(0,Cv.default)(r,100,{leading:!0,trailing:!1}),n._position=0,n}return HP(e,t),Zu(e,[{key:"_transform",value:function(n,o,i){this._position+=n.length,this._onprogress(this._position),i(null,n)}}])})(wv.Transform),YP=function(e,r,n){n=(0,Cv.default)(n,100,{leading:!0,trailing:!1});var o=0;function i(){var a=Math.min(e.writableHighWaterMark,r.length-o),s=r.subarray(o,o+a);o+=s.length;var u=e.write(s);u?o<r.length?i():e.end():(e.once("drain",i),n(o))}i()}});var Av=x(Xd=>{"use strict";Xd.expectReceive=function(t,e,r){var n;r.root(t,e,r),n=this.message,t.hasOwnProperty("expected")&&(n+=" Expected "+t.expected+"."),t.hasOwnProperty("received")&&(n+=" Received: "+t.received+"."),this.message=n};Xd.root=function(t,e,r){var n=this,o,i={stackLength:Error.stackTraceLimit,rootOnly:!0},a="",s=Error.stackTraceLimit,u;function c(){u[0]=n.toString(),n.stack=u.join(`
27
+ `)}),this}_outputHelpIfRequested(e){let r=this._getHelpOption();r&&e.find(o=>r.is(o))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function pD(t){return t.map(e=>{if(!e.startsWith("--inspect"))return e;let r,n="127.0.0.1",o="9229",i;return(i=e.match(/^(--inspect(-brk)?)$/))!==null?r=i[1]:(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(r=i[1],/^\d+$/.test(i[3])?o=i[3]:n=i[3]):(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(r=i[1],n=i[3],o=i[4]),r&&o!=="0"?`${r}=${n}:${parseInt(o)+1}`:e})}function vf(){if(we.env.NO_COLOR||we.env.FORCE_COLOR==="0"||we.env.FORCE_COLOR==="false")return!1;if(we.env.FORCE_COLOR||we.env.CLICOLOR_FORCE!==void 0)return!0}Cf.Command=wf;Cf.useColor=vf});var DD=x(Xt=>{var{Argument:hD}=Ms(),{Command:Ef}=dD(),{CommanderError:CA,InvalidArgumentError:mD}=pa(),{Help:EA}=df(),{Option:gD}=Df();Xt.program=new Ef;Xt.createCommand=t=>new Ef(t);Xt.createOption=(t,e)=>new gD(t,e);Xt.createArgument=(t,e)=>new hD(t,e);Xt.Command=Ef;Xt.Option=gD;Xt.Argument=hD;Xt.Help=EA;Xt.CommanderError=CA;Xt.InvalidArgumentError=mD;Xt.InvalidOptionArgumentError=mD});var xf=x((x7,bD)=>{"use strict";var _f={to(t,e){return e?`\x1B[${e+1};${t+1}H`:`\x1B[${t+1}G`},move(t,e){let r="";return t<0?r+=`\x1B[${-t}D`:t>0&&(r+=`\x1B[${t}C`),e<0?r+=`\x1B[${-e}A`:e>0&&(r+=`\x1B[${e}B`),r},up:(t=1)=>`\x1B[${t}A`,down:(t=1)=>`\x1B[${t}B`,forward:(t=1)=>`\x1B[${t}C`,backward:(t=1)=>`\x1B[${t}D`,nextLine:(t=1)=>"\x1B[E".repeat(t),prevLine:(t=1)=>"\x1B[F".repeat(t),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},xA={up:(t=1)=>"\x1B[S".repeat(t),down:(t=1)=>"\x1B[T".repeat(t)},SA={screen:"\x1B[2J",up:(t=1)=>"\x1B[1J".repeat(t),down:(t=1)=>"\x1B[J".repeat(t),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(t){let e="";for(let r=0;r<t;r++)e+=this.line+(r<t-1?_f.up():"");return t&&(e+=_f.left),e}};bD.exports={cursor:_f,scroll:xA,erase:SA,beep:"\x07"}});var Ff=x((S7,Sf)=>{var Vs=process||{},wD=Vs.argv||[],Hs=Vs.env||{},FA=!(Hs.NO_COLOR||wD.includes("--no-color"))&&(!!Hs.FORCE_COLOR||wD.includes("--color")||Vs.platform==="win32"||(Vs.stdout||{}).isTTY&&Hs.TERM!=="dumb"||!!Hs.CI),AA=(t,e,r=t)=>n=>{let o=""+n,i=o.indexOf(e,t.length);return~i?t+OA(o,e,r,i)+e:t+o+e},OA=(t,e,r,n)=>{let o="",i=0;do o+=t.substring(i,n)+r,i=n+e.length,n=t.indexOf(e,i);while(~n);return o+t.substring(i)},vD=(t=FA)=>{let e=t?AA:()=>String;return{isColorSupported:t,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};Sf.exports=vD();Sf.exports.createColors=vD});var Qs=x(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.isNXMonorepo=Tt.isMonorepo=Tt.findPackageRelativePathInMonorepo=Tt.findPackagePath=Tt.findNXMonorepoRoot=Tt.findMonorepoRoot=void 0;var ma=require("node:fs"),pn=require("node:path");function Zs(t){let e=(0,pn.join)(t,"package.json"),r=(0,pn.join)(t,"pnpm-workspace.yaml");if((0,ma.existsSync)(r)||(0,ma.existsSync)(e)&&JSON.parse((0,ma.readFileSync)(e,"utf-8")).workspaces)return t;let n=(0,pn.dirname)(t);if(n===t)throw new Error("Monorepo root not found");return Zs(n)}Tt.findMonorepoRoot=Zs;function Uf(t){let e=(0,pn.join)(t,"nx.json");if((0,ma.existsSync)(e))return t;let r=(0,pn.dirname)(t);if(r===t)throw new Error("Monorepo root not found");return Uf(r)}Tt.findNXMonorepoRoot=Uf;function Mf(t,e,r){let n=(0,pn.join)(e,"node_modules",t);if((0,ma.existsSync)(n))return n;if(e===r)return null;let o=(0,pn.dirname)(e);return Mf(t,o,r)}Tt.findPackagePath=Mf;function sO(t,e){let r=Zs(e),n=Mf(t,e,r);return n?(0,pn.relative)(e,n):null}Tt.findPackageRelativePathInMonorepo=sO;function uO(t){try{return Zs(t),!0}catch{return!1}}Tt.isMonorepo=uO;function cO(t){try{return Uf(t),!0}catch{return!1}}Tt.isNXMonorepo=cO});var le={};qr(le,{__addDisposableResource:()=>Ey,__assign:()=>au,__asyncDelegator:()=>my,__asyncGenerator:()=>hy,__asyncValues:()=>gy,__await:()=>qo,__awaiter:()=>uy,__classPrivateFieldGet:()=>wy,__classPrivateFieldIn:()=>Cy,__classPrivateFieldSet:()=>vy,__createBinding:()=>uu,__decorate:()=>ty,__disposeResources:()=>_y,__esDecorate:()=>ny,__exportStar:()=>ly,__extends:()=>QD,__generator:()=>cy,__importDefault:()=>by,__importStar:()=>yy,__makeTemplateObject:()=>Dy,__metadata:()=>sy,__param:()=>ry,__propKey:()=>iy,__read:()=>Jf,__rest:()=>ey,__rewriteRelativeImportExtension:()=>xy,__runInitializers:()=>oy,__setFunctionName:()=>ay,__spread:()=>fy,__spreadArray:()=>dy,__spreadArrays:()=>py,__values:()=>su,default:()=>TO});function QD(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Kf(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function ey(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]]);return r}function ty(t,e,r,n){var o=arguments.length,i=o<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(i=(o<3?a(i):o>3?a(e,r,i):a(e,r))||i);return o>3&&i&&Object.defineProperty(e,r,i),i}function ry(t,e){return function(r,n){e(r,n,t)}}function ny(t,e,r,n,o,i){function a(C){if(C!==void 0&&typeof C!="function")throw new TypeError("Function expected");return C}for(var s=n.kind,u=s==="getter"?"get":s==="setter"?"set":"value",c=!e&&t?n.static?t:t.prototype:null,l=e||(c?Object.getOwnPropertyDescriptor(c,n.name):{}),p,d=!1,h=r.length-1;h>=0;h--){var m={};for(var b in n)m[b]=b==="access"?{}:n[b];for(var b in n.access)m.access[b]=n.access[b];m.addInitializer=function(C){if(d)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(C||null))};var D=(0,r[h])(s==="accessor"?{get:l.get,set:l.set}:l[u],m);if(s==="accessor"){if(D===void 0)continue;if(D===null||typeof D!="object")throw new TypeError("Object expected");(p=a(D.get))&&(l.get=p),(p=a(D.set))&&(l.set=p),(p=a(D.init))&&o.unshift(p)}else(p=a(D))&&(s==="field"?o.unshift(p):l[u]=p)}c&&Object.defineProperty(c,n.name,l),d=!0}function oy(t,e,r){for(var n=arguments.length>2,o=0;o<e.length;o++)r=n?e[o].call(t,r):e[o].call(t);return n?r:void 0}function iy(t){return typeof t=="symbol"?t:"".concat(t)}function ay(t,e,r){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})}function sy(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function uy(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(l){try{c(n.next(l))}catch(p){a(p)}}function u(l){try{c(n.throw(l))}catch(p){a(p)}}function c(l){l.done?i(l.value):o(l.value).then(s,u)}c((n=n.apply(t,e||[])).next())})}function cy(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(c){return function(l){return u([c,l])}}function u(c){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(r=0)),r;)try{if(n=1,o&&(i=c[0]&2?o.return:c[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,c[1])).done)return i;switch(o=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,o=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=e.call(t,r)}catch(l){c=[6,l],o=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function ly(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&uu(e,t,r)}function su(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Jf(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),o,i=[],a;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i}function fy(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Jf(arguments[e]));return t}function py(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),o=0,e=0;e<r;e++)for(var i=arguments[e],a=0,s=i.length;a<s;a++,o++)n[o]=i[a];return n}function dy(t,e,r){if(r||arguments.length===2)for(var n=0,o=e.length,i;n<o;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}function qo(t){return this instanceof qo?(this.v=t,this):new qo(t)}function hy(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(h){return function(m){return Promise.resolve(m).then(h,p)}}function s(h,m){n[h]&&(o[h]=function(b){return new Promise(function(D,C){i.push([h,b,D,C])>1||u(h,b)})},m&&(o[h]=m(o[h])))}function u(h,m){try{c(n[h](m))}catch(b){d(i[0][3],b)}}function c(h){h.value instanceof qo?Promise.resolve(h.value.v).then(l,p):d(i[0][2],h)}function l(h){u("next",h)}function p(h){u("throw",h)}function d(h,m){h(m),i.shift(),i.length&&u(i[0][0],i[0][1])}}function my(t){var e,r;return e={},n("next"),n("throw",function(o){throw o}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(o,i){e[o]=t[o]?function(a){return(r=!r)?{value:qo(t[o](a)),done:!1}:i?i(a):a}:i}}function gy(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof su=="function"?su(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(a){return new Promise(function(s,u){a=t[i](a),o(s,u,a.done,a.value)})}}function o(i,a,s,u){Promise.resolve(u).then(function(c){i({value:c,done:s})},a)}}function Dy(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function yy(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=Yf(t),n=0;n<r.length;n++)r[n]!=="default"&&uu(e,t,r[n]);return $O(e,t),e}function by(t){return t&&t.__esModule?t:{default:t}}function wy(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}function vy(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r}function Cy(t,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?e===t:t.has(e)}function Ey(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var n,o;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=e[Symbol.asyncDispose]}if(n===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=e[Symbol.dispose],r&&(o=n)}if(typeof n!="function")throw new TypeError("Object not disposable.");o&&(n=function(){try{o.call(this)}catch(i){return Promise.reject(i)}}),t.stack.push({value:e,dispose:n,async:r})}else r&&t.stack.push({async:!0});return e}function _y(t){function e(i){t.error=t.hasError?new PO(i,t.error,"An error was suppressed during disposal."):i,t.hasError=!0}var r,n=0;function o(){for(;r=t.stack.pop();)try{if(!r.async&&n===1)return n=0,t.stack.push(r),Promise.resolve().then(o);if(r.dispose){var i=r.dispose.call(r.value);if(r.async)return n|=2,Promise.resolve(i).then(o,function(a){return e(a),o()})}else n|=1}catch(a){e(a)}if(n===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return o()}function xy(t,e){return typeof t=="string"&&/^\.\.?\//.test(t)?t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(r,n,o,i,a){return n?e?".jsx":".js":o&&(!i||!a)?r:o+i+"."+a.toLowerCase()+"js"}):t}var Kf,au,uu,$O,Yf,PO,TO,fe=tt(()=>{Kf=function(t,e){return Kf=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])},Kf(t,e)};au=function(){return au=Object.assign||function(e){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},au.apply(this,arguments)};uu=Object.create?(function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]});$O=Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e},Yf=function(t){return Yf=Object.getOwnPropertyNames||function(e){var r=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[r.length]=n);return r},Yf(t)};PO=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};TO={__extends:QD,__assign:au,__rest:ey,__decorate:ty,__param:ry,__esDecorate:ny,__runInitializers:oy,__propKey:iy,__setFunctionName:ay,__metadata:sy,__awaiter:uy,__generator:cy,__createBinding:uu,__exportStar:ly,__values:su,__read:Jf,__spread:fy,__spreadArrays:py,__spreadArray:dy,__await:qo,__asyncGenerator:hy,__asyncDelegator:my,__asyncValues:gy,__makeTemplateObject:Dy,__importStar:yy,__importDefault:by,__classPrivateFieldGet:wy,__classPrivateFieldSet:vy,__classPrivateFieldIn:Cy,__addDisposableResource:Ey,__disposeResources:_y,__rewriteRelativeImportExtension:xy}});var Sy=x(cu=>{"use strict";Object.defineProperty(cu,"__esModule",{value:!0});cu.resolveFetch=void 0;var IO=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);cu.resolveFetch=IO});var ep=x(Qt=>{"use strict";Object.defineProperty(Qt,"__esModule",{value:!0});Qt.FunctionRegion=Qt.FunctionsHttpError=Qt.FunctionsRelayError=Qt.FunctionsFetchError=Qt.FunctionsError=void 0;var Ho=class extends Error{constructor(e,r="FunctionsError",n){super(e),this.name=r,this.context=n}};Qt.FunctionsError=Ho;var Xf=class extends Ho{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}};Qt.FunctionsFetchError=Xf;var Zf=class extends Ho{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}};Qt.FunctionsRelayError=Zf;var Qf=class extends Ho{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}};Qt.FunctionsHttpError=Qf;var Fy;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(Fy||(Qt.FunctionRegion=Fy={}))});var Ay=x(lu=>{"use strict";Object.defineProperty(lu,"__esModule",{value:!0});lu.FunctionsClient=void 0;var RO=(fe(),ne(le)),BO=Sy(),Vn=ep(),tp=class{constructor(e,{headers:r={},customFetch:n,region:o=Vn.FunctionRegion.Any}={}){this.url=e,this.headers=r,this.region=o,this.fetch=(0,BO.resolveFetch)(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return RO.__awaiter(this,arguments,void 0,function*(r,n={}){var o;try{let{headers:i,method:a,body:s,signal:u}=n,c={},{region:l}=n;l||(l=this.region);let p=new URL(`${this.url}/${r}`);l&&l!=="any"&&(c["x-region"]=l,p.searchParams.set("forceFunctionRegion",l));let d;s&&(i&&!Object.prototype.hasOwnProperty.call(i,"Content-Type")||!i)?typeof Blob<"u"&&s instanceof Blob||s instanceof ArrayBuffer?(c["Content-Type"]="application/octet-stream",d=s):typeof s=="string"?(c["Content-Type"]="text/plain",d=s):typeof FormData<"u"&&s instanceof FormData?d=s:(c["Content-Type"]="application/json",d=JSON.stringify(s)):d=s;let h=yield this.fetch(p.toString(),{method:a||"POST",headers:Object.assign(Object.assign(Object.assign({},c),this.headers),i),body:d,signal:u}).catch(C=>{throw C.name==="AbortError"?C:new Vn.FunctionsFetchError(C)}),m=h.headers.get("x-relay-error");if(m&&m==="true")throw new Vn.FunctionsRelayError(h);if(!h.ok)throw new Vn.FunctionsHttpError(h);let b=((o=h.headers.get("Content-Type"))!==null&&o!==void 0?o:"text/plain").split(";")[0].trim(),D;return b==="application/json"?D=yield h.json():b==="application/octet-stream"||b==="application/pdf"?D=yield h.blob():b==="text/event-stream"?D=h:b==="multipart/form-data"?D=yield h.formData():D=yield h.text(),{data:D,error:null,response:h}}catch(i){return i instanceof Error&&i.name==="AbortError"?{data:null,error:new Vn.FunctionsFetchError(i)}:{data:null,error:i,response:i instanceof Vn.FunctionsHttpError||i instanceof Vn.FunctionsRelayError?i.context:void 0}}})}};lu.FunctionsClient=tp});var rp=x(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.FunctionRegion=It.FunctionsRelayError=It.FunctionsHttpError=It.FunctionsFetchError=It.FunctionsError=It.FunctionsClient=void 0;var jO=Ay();Object.defineProperty(It,"FunctionsClient",{enumerable:!0,get:function(){return jO.FunctionsClient}});var wa=ep();Object.defineProperty(It,"FunctionsError",{enumerable:!0,get:function(){return wa.FunctionsError}});Object.defineProperty(It,"FunctionsFetchError",{enumerable:!0,get:function(){return wa.FunctionsFetchError}});Object.defineProperty(It,"FunctionsHttpError",{enumerable:!0,get:function(){return wa.FunctionsHttpError}});Object.defineProperty(It,"FunctionsRelayError",{enumerable:!0,get:function(){return wa.FunctionsRelayError}});Object.defineProperty(It,"FunctionRegion",{enumerable:!0,get:function(){return wa.FunctionRegion}})});var ip=x(op=>{"use strict";Object.defineProperty(op,"__esModule",{value:!0});var np=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}};op.default=np});var up=x(sp=>{"use strict";Object.defineProperty(sp,"__esModule",{value:!0});var NO=(fe(),ne(le)),LO=NO.__importDefault(ip()),ap=class{constructor(e){var r,n;this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=(r=e.shouldThrowOnError)!==null&&r!==void 0?r:!1,this.signal=e.signal,this.isMaybeSingle=(n=e.isMaybeSingle)!==null&&n!==void 0?n:!1,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,r){return this.headers=new Headers(this.headers),this.headers.set(e,r),this}then(e,r){this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");let n=this.fetch,o=n(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async i=>{var a,s,u,c;let l=null,p=null,d=null,h=i.status,m=i.statusText;if(i.ok){if(this.method!=="HEAD"){let E=await i.text();E===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&(!((a=this.headers.get("Accept"))===null||a===void 0)&&a.includes("application/vnd.pgrst.plan+text"))?p=E:p=JSON.parse(E))}let D=(s=this.headers.get("Prefer"))===null||s===void 0?void 0:s.match(/count=(exact|planned|estimated)/),C=(u=i.headers.get("content-range"))===null||u===void 0?void 0:u.split("/");D&&C&&C.length>1&&(d=parseInt(C[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(p)&&(p.length>1?(l={code:"PGRST116",details:`Results contain ${p.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},p=null,d=null,h=406,m="Not Acceptable"):p.length===1?p=p[0]:p=null)}else{let D=await i.text();try{l=JSON.parse(D),Array.isArray(l)&&i.status===404&&(p=[],l=null,h=200,m="OK")}catch{i.status===404&&D===""?(h=204,m="No Content"):l={message:D}}if(l&&this.isMaybeSingle&&(!((c=l?.details)===null||c===void 0)&&c.includes("0 rows"))&&(l=null,h=200,m="OK"),l&&this.shouldThrowOnError)throw new LO.default(l)}return{error:l,data:p,count:d,status:h,statusText:m}});return this.shouldThrowOnError||(o=o.catch(i=>{var a,s,u;return{error:{message:`${(a=i?.name)!==null&&a!==void 0?a:"FetchError"}: ${i?.message}`,details:`${(s=i?.stack)!==null&&s!==void 0?s:""}`,hint:"",code:`${(u=i?.code)!==null&&u!==void 0?u:""}`},data:null,count:null,status:0,statusText:""}})),o.then(e,r)}returns(){return this}overrideTypes(){return this}};sp.default=ap});var fp=x(lp=>{"use strict";Object.defineProperty(lp,"__esModule",{value:!0});var UO=(fe(),ne(le)),MO=UO.__importDefault(up()),cp=class extends MO.default{select(e){let r=!1,n=(e??"*").split("").map(o=>/\s/.test(o)&&!r?"":(o==='"'&&(r=!r),o)).join("");return this.url.searchParams.set("select",n),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:r=!0,nullsFirst:n,foreignTable:o,referencedTable:i=o}={}){let a=i?`${i}.order`:"order",s=this.url.searchParams.get(a);return this.url.searchParams.set(a,`${s?`${s},`:""}${e}.${r?"asc":"desc"}${n===void 0?"":n?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:r,referencedTable:n=r}={}){let o=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(o,`${e}`),this}range(e,r,{foreignTable:n,referencedTable:o=n}={}){let i=typeof o>"u"?"offset":`${o}.offset`,a=typeof o>"u"?"limit":`${o}.limit`;return this.url.searchParams.set(i,`${e}`),this.url.searchParams.set(a,`${r-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:e=!1,verbose:r=!1,settings:n=!1,buffers:o=!1,wal:i=!1,format:a="text"}={}){var s;let u=[e?"analyze":null,r?"verbose":null,n?"settings":null,o?"buffers":null,i?"wal":null].filter(Boolean).join("|"),c=(s=this.headers.get("Accept"))!==null&&s!==void 0?s:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${a}; for="${c}"; options=${u};`),a==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};lp.default=cp});var fu=x(dp=>{"use strict";Object.defineProperty(dp,"__esModule",{value:!0});var qO=(fe(),ne(le)),HO=qO.__importDefault(fp()),VO=new RegExp("[,()]"),pp=class extends HO.default{eq(e,r){return this.url.searchParams.append(e,`eq.${r}`),this}neq(e,r){return this.url.searchParams.append(e,`neq.${r}`),this}gt(e,r){return this.url.searchParams.append(e,`gt.${r}`),this}gte(e,r){return this.url.searchParams.append(e,`gte.${r}`),this}lt(e,r){return this.url.searchParams.append(e,`lt.${r}`),this}lte(e,r){return this.url.searchParams.append(e,`lte.${r}`),this}like(e,r){return this.url.searchParams.append(e,`like.${r}`),this}likeAllOf(e,r){return this.url.searchParams.append(e,`like(all).{${r.join(",")}}`),this}likeAnyOf(e,r){return this.url.searchParams.append(e,`like(any).{${r.join(",")}}`),this}ilike(e,r){return this.url.searchParams.append(e,`ilike.${r}`),this}ilikeAllOf(e,r){return this.url.searchParams.append(e,`ilike(all).{${r.join(",")}}`),this}ilikeAnyOf(e,r){return this.url.searchParams.append(e,`ilike(any).{${r.join(",")}}`),this}is(e,r){return this.url.searchParams.append(e,`is.${r}`),this}in(e,r){let n=Array.from(new Set(r)).map(o=>typeof o=="string"&&VO.test(o)?`"${o}"`:`${o}`).join(",");return this.url.searchParams.append(e,`in.(${n})`),this}contains(e,r){return typeof r=="string"?this.url.searchParams.append(e,`cs.${r}`):Array.isArray(r)?this.url.searchParams.append(e,`cs.{${r.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(r)}`),this}containedBy(e,r){return typeof r=="string"?this.url.searchParams.append(e,`cd.${r}`):Array.isArray(r)?this.url.searchParams.append(e,`cd.{${r.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(r)}`),this}rangeGt(e,r){return this.url.searchParams.append(e,`sr.${r}`),this}rangeGte(e,r){return this.url.searchParams.append(e,`nxl.${r}`),this}rangeLt(e,r){return this.url.searchParams.append(e,`sl.${r}`),this}rangeLte(e,r){return this.url.searchParams.append(e,`nxr.${r}`),this}rangeAdjacent(e,r){return this.url.searchParams.append(e,`adj.${r}`),this}overlaps(e,r){return typeof r=="string"?this.url.searchParams.append(e,`ov.${r}`):this.url.searchParams.append(e,`ov.{${r.join(",")}}`),this}textSearch(e,r,{config:n,type:o}={}){let i="";o==="plain"?i="pl":o==="phrase"?i="ph":o==="websearch"&&(i="w");let a=n===void 0?"":`(${n})`;return this.url.searchParams.append(e,`${i}fts${a}.${r}`),this}match(e){return Object.entries(e).forEach(([r,n])=>{this.url.searchParams.append(r,`eq.${n}`)}),this}not(e,r,n){return this.url.searchParams.append(e,`not.${r}.${n}`),this}or(e,{foreignTable:r,referencedTable:n=r}={}){let o=n?`${n}.or`:"or";return this.url.searchParams.append(o,`(${e})`),this}filter(e,r,n){return this.url.searchParams.append(e,`${r}.${n}`),this}};dp.default=pp});var gp=x(mp=>{"use strict";Object.defineProperty(mp,"__esModule",{value:!0});var zO=(fe(),ne(le)),va=zO.__importDefault(fu()),hp=class{constructor(e,{headers:r={},schema:n,fetch:o}){this.url=e,this.headers=new Headers(r),this.schema=n,this.fetch=o}select(e,r){let{head:n=!1,count:o}=r??{},i=n?"HEAD":"GET",a=!1,s=(e??"*").split("").map(u=>/\s/.test(u)&&!a?"":(u==='"'&&(a=!a),u)).join("");return this.url.searchParams.set("select",s),o&&this.headers.append("Prefer",`count=${o}`),new va.default({method:i,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(e,{count:r,defaultToNull:n=!0}={}){var o;let i="POST";if(r&&this.headers.append("Prefer",`count=${r}`),n||this.headers.append("Prefer","missing=default"),Array.isArray(e)){let a=e.reduce((s,u)=>s.concat(Object.keys(u)),[]);if(a.length>0){let s=[...new Set(a)].map(u=>`"${u}"`);this.url.searchParams.set("columns",s.join(","))}}return new va.default({method:i,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}upsert(e,{onConflict:r,ignoreDuplicates:n=!1,count:o,defaultToNull:i=!0}={}){var a;let s="POST";if(this.headers.append("Prefer",`resolution=${n?"ignore":"merge"}-duplicates`),r!==void 0&&this.url.searchParams.set("on_conflict",r),o&&this.headers.append("Prefer",`count=${o}`),i||this.headers.append("Prefer","missing=default"),Array.isArray(e)){let u=e.reduce((c,l)=>c.concat(Object.keys(l)),[]);if(u.length>0){let c=[...new Set(u)].map(l=>`"${l}"`);this.url.searchParams.set("columns",c.join(","))}}return new va.default({method:s,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}update(e,{count:r}={}){var n;let o="PATCH";return r&&this.headers.append("Prefer",`count=${r}`),new va.default({method:o,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch})}delete({count:e}={}){var r;let n="DELETE";return e&&this.headers.append("Prefer",`count=${e}`),new va.default({method:n,url:this.url,headers:this.headers,schema:this.schema,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}};mp.default=hp});var ky=x(yp=>{"use strict";Object.defineProperty(yp,"__esModule",{value:!0});var Oy=(fe(),ne(le)),GO=Oy.__importDefault(gp()),WO=Oy.__importDefault(fu()),Dp=class t{constructor(e,{headers:r={},schema:n,fetch:o}={}){this.url=e,this.headers=new Headers(r),this.schemaName=n,this.fetch=o}from(e){let r=new URL(`${this.url}/${e}`);return new GO.default(r,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new t(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,r={},{head:n=!1,get:o=!1,count:i}={}){var a;let s,u=new URL(`${this.url}/rpc/${e}`),c;n||o?(s=n?"HEAD":"GET",Object.entries(r).filter(([p,d])=>d!==void 0).map(([p,d])=>[p,Array.isArray(d)?`{${d.join(",")}}`:`${d}`]).forEach(([p,d])=>{u.searchParams.append(p,d)})):(s="POST",c=r);let l=new Headers(this.headers);return i&&l.set("Prefer",`count=${i}`),new WO.default({method:s,url:u,headers:l,schema:this.schemaName,body:c,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}};yp.default=Dp});var bp=x(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.PostgrestError=xt.PostgrestBuilder=xt.PostgrestTransformBuilder=xt.PostgrestFilterBuilder=xt.PostgrestQueryBuilder=xt.PostgrestClient=void 0;var Vo=(fe(),ne(le)),$y=Vo.__importDefault(ky());xt.PostgrestClient=$y.default;var Py=Vo.__importDefault(gp());xt.PostgrestQueryBuilder=Py.default;var Ty=Vo.__importDefault(fu());xt.PostgrestFilterBuilder=Ty.default;var Iy=Vo.__importDefault(fp());xt.PostgrestTransformBuilder=Iy.default;var Ry=Vo.__importDefault(up());xt.PostgrestBuilder=Ry.default;var By=Vo.__importDefault(ip());xt.PostgrestError=By.default;xt.default={PostgrestClient:$y.default,PostgrestQueryBuilder:Py.default,PostgrestFilterBuilder:Ty.default,PostgrestTransformBuilder:Iy.default,PostgrestBuilder:Ry.default,PostgrestError:By.default}});var vp={};qr(vp,{RealtimeClient:()=>wp});var wp,Cp=tt(()=>{wp=class{constructor(){}connect(){}disconnect(){}}});var mn=x(zr=>{"use strict";Object.defineProperty(zr,"__esModule",{value:!0});zr.StorageUnknownError=zr.StorageApiError=zr.StorageError=void 0;zr.isStorageError=KO;var Ca=class extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}};zr.StorageError=Ca;function KO(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var Ep=class extends Ca{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}}};zr.StorageApiError=Ep;var _p=class extends Ca{constructor(e,r){super(e),this.name="StorageUnknownError",this.originalError=r}};zr.StorageUnknownError=_p});var Ea=x(er=>{"use strict";Object.defineProperty(er,"__esModule",{value:!0});er.isPlainObject=er.recursiveToCamel=er.resolveResponse=er.resolveFetch=void 0;var YO=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);er.resolveFetch=YO;var JO=()=>Response;er.resolveResponse=JO;var XO=t=>{if(Array.isArray(t))return t.map(r=>(0,er.recursiveToCamel)(r));if(typeof t=="function"||t!==Object(t))return t;let e={};return Object.entries(t).forEach(([r,n])=>{let o=r.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));e[o]=(0,er.recursiveToCamel)(n)}),e};er.recursiveToCamel=XO;var ZO=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)};er.isPlainObject=ZO});var pu=x(Gn=>{"use strict";Object.defineProperty(Gn,"__esModule",{value:!0});Gn.get=tk;Gn.post=rk;Gn.put=nk;Gn.head=ok;Gn.remove=ik;var zn=(fe(),ne(le)),xp=mn(),jy=Ea(),Sp=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)},QO=(t,e,r)=>zn.__awaiter(void 0,void 0,void 0,function*(){let n=yield(0,jy.resolveResponse)();t instanceof n&&!r?.noResolveJson?t.json().then(o=>{let i=t.status||500,a=o?.statusCode||i+"";e(new xp.StorageApiError(Sp(o),i,a))}).catch(o=>{e(new xp.StorageUnknownError(Sp(o),o))}):e(new xp.StorageUnknownError(Sp(t),t))}),ek=(t,e,r,n)=>{let o={method:t,headers:e?.headers||{}};return t==="GET"||!n?o:((0,jy.isPlainObject)(n)?(o.headers=Object.assign({"Content-Type":"application/json"},e?.headers),o.body=JSON.stringify(n)):o.body=n,e?.duplex&&(o.duplex=e.duplex),Object.assign(Object.assign({},o),r))};function _a(t,e,r,n,o,i){return zn.__awaiter(this,void 0,void 0,function*(){return new Promise((a,s)=>{t(r,ek(e,n,o,i)).then(u=>{if(!u.ok)throw u;return n?.noResolveJson?u:u.json()}).then(u=>a(u)).catch(u=>QO(u,s,n))})})}function tk(t,e,r,n){return zn.__awaiter(this,void 0,void 0,function*(){return _a(t,"GET",e,r,n)})}function rk(t,e,r,n,o){return zn.__awaiter(this,void 0,void 0,function*(){return _a(t,"POST",e,n,o,r)})}function nk(t,e,r,n,o){return zn.__awaiter(this,void 0,void 0,function*(){return _a(t,"PUT",e,n,o,r)})}function ok(t,e,r,n){return zn.__awaiter(this,void 0,void 0,function*(){return _a(t,"HEAD",e,Object.assign(Object.assign({},r),{noResolveJson:!0}),n)})}function ik(t,e,r,n,o){return zn.__awaiter(this,void 0,void 0,function*(){return _a(t,"DELETE",e,n,o,r)})}});var Ny=x(Ap=>{"use strict";Object.defineProperty(Ap,"__esModule",{value:!0});var ak=(fe(),ne(le)),sk=mn(),Fp=class{constructor(e,r){this.downloadFn=e,this.shouldThrowOnError=r}then(e,r){return this.execute().then(e,r)}execute(){return ak.__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,sk.isStorageError)(e))return{data:null,error:e};throw e}})}};Ap.default=Fp});var My=x(kp=>{"use strict";var Ly;Object.defineProperty(kp,"__esModule",{value:!0});var Uy=(fe(),ne(le)),uk=mn(),ck=Uy.__importDefault(Ny()),Op=class{constructor(e,r){this.downloadFn=e,this.shouldThrowOnError=r,this[Ly]="BlobDownloadBuilder",this.promise=null}asStream(){return new ck.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 Uy.__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,uk.isStorageError)(e))return{data:null,error:e};throw e}})}};Ly=Symbol.toStringTag;kp.default=Op});var Vy=x(Pp=>{"use strict";Object.defineProperty(Pp,"__esModule",{value:!0});var St=(fe(),ne(le)),Rt=mn(),Bt=pu(),qy=Ea(),lk=St.__importDefault(My()),fk={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Hy={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1},$p=class{constructor(e,r={},n,o){this.shouldThrowOnError=!1,this.url=e,this.headers=r,this.bucketId=n,this.fetch=(0,qy.resolveFetch)(o)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(e,r,n,o){return St.__awaiter(this,void 0,void 0,function*(){try{let i,a=Object.assign(Object.assign({},Hy),o),s=Object.assign(Object.assign({},this.headers),e==="POST"&&{"x-upsert":String(a.upsert)}),u=a.metadata;typeof Blob<"u"&&n instanceof Blob?(i=new FormData,i.append("cacheControl",a.cacheControl),u&&i.append("metadata",this.encodeMetadata(u)),i.append("",n)):typeof FormData<"u"&&n instanceof FormData?(i=n,i.has("cacheControl")||i.append("cacheControl",a.cacheControl),u&&!i.has("metadata")&&i.append("metadata",this.encodeMetadata(u))):(i=n,s["cache-control"]=`max-age=${a.cacheControl}`,s["content-type"]=a.contentType,u&&(s["x-metadata"]=this.toBase64(this.encodeMetadata(u))),(typeof ReadableStream<"u"&&i instanceof ReadableStream||i&&typeof i=="object"&&"pipe"in i&&typeof i.pipe=="function")&&!a.duplex&&(a.duplex="half")),o?.headers&&(s=Object.assign(Object.assign({},s),o.headers));let c=this._removeEmptyFolders(r),l=this._getFinalPath(c),p=yield(e=="PUT"?Bt.put:Bt.post)(this.fetch,`${this.url}/object/${l}`,i,Object.assign({headers:s},a?.duplex?{duplex:a.duplex}:{}));return{data:{path:c,id:p.Id,fullPath:p.Key},error:null}}catch(i){if(this.shouldThrowOnError)throw i;if((0,Rt.isStorageError)(i))return{data:null,error:i};throw i}})}upload(e,r,n){return St.__awaiter(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,r,n)})}uploadToSignedUrl(e,r,n,o){return St.__awaiter(this,void 0,void 0,function*(){let i=this._removeEmptyFolders(e),a=this._getFinalPath(i),s=new URL(this.url+`/object/upload/sign/${a}`);s.searchParams.set("token",r);try{let u,c=Object.assign({upsert:Hy.upsert},o),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 p=yield(0,Bt.put)(this.fetch,s.toString(),u,{headers:l});return{data:{path:i,fullPath:p.Key},error:null}}catch(u){if(this.shouldThrowOnError)throw u;if((0,Rt.isStorageError)(u))return{data:null,error:u};throw u}})}createSignedUploadUrl(e,r){return St.__awaiter(this,void 0,void 0,function*(){try{let n=this._getFinalPath(e),o=Object.assign({},this.headers);r?.upsert&&(o["x-upsert"]="true");let i=yield(0,Bt.post)(this.fetch,`${this.url}/object/upload/sign/${n}`,{},{headers:o}),a=new URL(this.url+i.url),s=a.searchParams.get("token");if(!s)throw new Rt.StorageError("No token returned by API");return{data:{signedUrl:a.toString(),path:e,token:s},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Rt.isStorageError)(n))return{data:null,error:n};throw n}})}update(e,r,n){return St.__awaiter(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,r,n)})}move(e,r,n){return St.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Bt.post)(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:r,destinationBucket:n?.destinationBucket},{headers:this.headers}),error:null}}catch(o){if(this.shouldThrowOnError)throw o;if((0,Rt.isStorageError)(o))return{data:null,error:o};throw o}})}copy(e,r,n){return St.__awaiter(this,void 0,void 0,function*(){try{return{data:{path:(yield(0,Bt.post)(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:r,destinationBucket:n?.destinationBucket},{headers:this.headers})).Key},error:null}}catch(o){if(this.shouldThrowOnError)throw o;if((0,Rt.isStorageError)(o))return{data:null,error:o};throw o}})}createSignedUrl(e,r,n){return St.__awaiter(this,void 0,void 0,function*(){try{let o=this._getFinalPath(e),i=yield(0,Bt.post)(this.fetch,`${this.url}/object/sign/${o}`,Object.assign({expiresIn:r},n?.transform?{transform:n.transform}:{}),{headers:this.headers}),a=n?.download?`&download=${n.download===!0?"":n.download}`:"";return i={signedUrl:encodeURI(`${this.url}${i.signedURL}${a}`)},{data:i,error:null}}catch(o){if(this.shouldThrowOnError)throw o;if((0,Rt.isStorageError)(o))return{data:null,error:o};throw o}})}createSignedUrls(e,r,n){return St.__awaiter(this,void 0,void 0,function*(){try{let o=yield(0,Bt.post)(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:r,paths:e},{headers:this.headers}),i=n?.download?`&download=${n.download===!0?"":n.download}`:"";return{data:o.map(a=>Object.assign(Object.assign({},a),{signedUrl:a.signedURL?encodeURI(`${this.url}${a.signedURL}${i}`):null})),error:null}}catch(o){if(this.shouldThrowOnError)throw o;if((0,Rt.isStorageError)(o))return{data:null,error:o};throw o}})}download(e,r){let o=typeof r?.transform<"u"?"render/image/authenticated":"object",i=this.transformOptsToQueryString(r?.transform||{}),a=i?`?${i}`:"",s=this._getFinalPath(e),u=()=>(0,Bt.get)(this.fetch,`${this.url}/${o}/${s}${a}`,{headers:this.headers,noResolveJson:!0});return new lk.default(u,this.shouldThrowOnError)}info(e){return St.__awaiter(this,void 0,void 0,function*(){let r=this._getFinalPath(e);try{let n=yield(0,Bt.get)(this.fetch,`${this.url}/object/info/${r}`,{headers:this.headers});return{data:(0,qy.recursiveToCamel)(n),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Rt.isStorageError)(n))return{data:null,error:n};throw n}})}exists(e){return St.__awaiter(this,void 0,void 0,function*(){let r=this._getFinalPath(e);try{return yield(0,Bt.head)(this.fetch,`${this.url}/object/${r}`,{headers:this.headers}),{data:!0,error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Rt.isStorageError)(n)&&n instanceof Rt.StorageUnknownError){let o=n.originalError;if([400,404].includes(o?.status))return{data:!1,error:n}}throw n}})}getPublicUrl(e,r){let n=this._getFinalPath(e),o=[],i=r?.download?`download=${r.download===!0?"":r.download}`:"";i!==""&&o.push(i);let s=typeof r?.transform<"u"?"render/image":"object",u=this.transformOptsToQueryString(r?.transform||{});u!==""&&o.push(u);let c=o.join("&");return c!==""&&(c=`?${c}`),{data:{publicUrl:encodeURI(`${this.url}/${s}/public/${n}${c}`)}}}remove(e){return St.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Bt.remove)(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Rt.isStorageError)(r))return{data:null,error:r};throw r}})}list(e,r,n){return St.__awaiter(this,void 0,void 0,function*(){try{let o=Object.assign(Object.assign(Object.assign({},fk),r),{prefix:e||""});return{data:yield(0,Bt.post)(this.fetch,`${this.url}/object/list/${this.bucketId}`,o,{headers:this.headers},n),error:null}}catch(o){if(this.shouldThrowOnError)throw o;if((0,Rt.isStorageError)(o))return{data:null,error:o};throw o}})}listV2(e,r){return St.__awaiter(this,void 0,void 0,function*(){try{let n=Object.assign({},e);return{data:yield(0,Bt.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,Rt.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("&")}};Pp.default=$p});var Tp=x(du=>{"use strict";Object.defineProperty(du,"__esModule",{value:!0});du.version=void 0;du.version="2.79.0"});var Ip=x(hu=>{"use strict";Object.defineProperty(hu,"__esModule",{value:!0});hu.DEFAULT_HEADERS=void 0;var pk=Tp();hu.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${pk.version}`}});var zy=x(Bp=>{"use strict";Object.defineProperty(Bp,"__esModule",{value:!0});var zo=(fe(),ne(le)),dk=Ip(),Go=mn(),Wo=pu(),hk=Ea(),Rp=class{constructor(e,r={},n,o){this.shouldThrowOnError=!1;let i=new URL(e);o?.useNewHostname&&/supabase\.(co|in|red)$/.test(i.hostname)&&!i.hostname.includes("storage.supabase.")&&(i.hostname=i.hostname.replace("supabase.","storage.supabase.")),this.url=i.href.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},dk.DEFAULT_HEADERS),r),this.fetch=(0,hk.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(e){return zo.__awaiter(this,void 0,void 0,function*(){try{let r=this.listBucketOptionsToQueryString(e);return{data:yield(0,Wo.get)(this.fetch,`${this.url}/bucket${r}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Go.isStorageError)(r))return{data:null,error:r};throw r}})}getBucket(e){return zo.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Wo.get)(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Go.isStorageError)(r))return{data:null,error:r};throw r}})}createBucket(e){return zo.__awaiter(this,arguments,void 0,function*(r,n={public:!1}){try{return{data:yield(0,Wo.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(o){if(this.shouldThrowOnError)throw o;if((0,Go.isStorageError)(o))return{data:null,error:o};throw o}})}updateBucket(e,r){return zo.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Wo.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,Go.isStorageError)(n))return{data:null,error:n};throw n}})}emptyBucket(e){return zo.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Wo.post)(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Go.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return zo.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Wo.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Go.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():""}};Bp.default=Rp});var qp=x(Mp=>{"use strict";Object.defineProperty(Mp,"__esModule",{value:!0});var jp=(fe(),ne(le)),mk=Ip(),Np=mn(),Lp=pu(),gk=Ea(),Up=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},mk.DEFAULT_HEADERS),r),this.fetch=(0,gk.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return jp.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Lp.post)(this.fetch,`${this.url}/bucket`,{name:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Np.isStorageError)(r))return{data:null,error:r};throw r}})}listBuckets(e){return jp.__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(),o=n?`${this.url}/bucket?${n}`:`${this.url}/bucket`;return{data:yield(0,Lp.get)(this.fetch,o,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Np.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return jp.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Lp.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Np.isStorageError)(r))return{data:null,error:r};throw r}})}};Mp.default=Up});var gu=x(mu=>{"use strict";Object.defineProperty(mu,"__esModule",{value:!0});mu.DEFAULT_HEADERS=void 0;var Dk=Tp();mu.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${Dk.version}`,"Content-Type":"application/json"}});var Ko=x(br=>{"use strict";Object.defineProperty(br,"__esModule",{value:!0});br.StorageVectorsErrorCode=br.StorageVectorsUnknownError=br.StorageVectorsApiError=br.StorageVectorsError=void 0;br.isStorageVectorsError=yk;var xa=class extends Error{constructor(e){super(e),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};br.StorageVectorsError=xa;function yk(t){return typeof t=="object"&&t!==null&&"__isStorageVectorsError"in t}var Hp=class extends xa{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}}};br.StorageVectorsApiError=Hp;var Vp=class extends xa{constructor(e,r){super(e),this.name="StorageVectorsUnknownError",this.originalError=r}};br.StorageVectorsUnknownError=Vp;var Gy;(function(t){t.InternalError="InternalError",t.S3VectorConflictException="S3VectorConflictException",t.S3VectorNotFoundException="S3VectorNotFoundException",t.S3VectorBucketNotEmpty="S3VectorBucketNotEmpty",t.S3VectorMaxBucketsExceeded="S3VectorMaxBucketsExceeded",t.S3VectorMaxIndexesExceeded="S3VectorMaxIndexesExceeded"})(Gy||(br.StorageVectorsErrorCode=Gy={}))});var Yo=x(tr=>{"use strict";Object.defineProperty(tr,"__esModule",{value:!0});tr.validateVectorDimension=tr.normalizeToFloat32=tr.isPlainObject=tr.resolveResponse=tr.resolveFetch=void 0;var bk=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);tr.resolveFetch=bk;var wk=()=>Response;tr.resolveResponse=wk;var vk=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)};tr.isPlainObject=vk;var Ck=t=>Array.from(new Float32Array(t));tr.normalizeToFloat32=Ck;var Ek=(t,e)=>{if(e!==void 0&&t.float32.length!==e)throw new Error(`Vector dimension mismatch: expected ${e}, got ${t.float32.length}`)};tr.validateVectorDimension=Ek});var bu=x(Xo=>{"use strict";Object.defineProperty(Xo,"__esModule",{value:!0});Xo.get=Fk;Xo.post=Ak;Xo.put=Ok;Xo.remove=kk;var Jo=(fe(),ne(le)),Du=Ko(),_k=Yo(),Wy=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),xk=(t,e,r)=>Jo.__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 o=t.status||500,i=t;if(typeof i.json=="function")i.json().then(a=>{let s=a?.statusCode||a?.code||o+"";e(new Du.StorageVectorsApiError(Wy(a),o,s))}).catch(()=>{let a=o+"",s=i.statusText||`HTTP ${o} error`;e(new Du.StorageVectorsApiError(s,o,a))});else{let a=o+"",s=i.statusText||`HTTP ${o} error`;e(new Du.StorageVectorsApiError(s,o,a))}}else e(new Du.StorageVectorsUnknownError(Wy(t),t))}),Sk=(t,e,r,n)=>{let o={method:t,headers:e?.headers||{}};return t==="GET"||!n?o:((0,_k.isPlainObject)(n)?(o.headers=Object.assign({"Content-Type":"application/json"},e?.headers),o.body=JSON.stringify(n)):o.body=n,Object.assign(Object.assign({},o),r))};function yu(t,e,r,n,o,i){return Jo.__awaiter(this,void 0,void 0,function*(){return new Promise((a,s)=>{t(r,Sk(e,n,o,i)).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=>a(u)).catch(u=>xk(u,s,n))})})}function Fk(t,e,r,n){return Jo.__awaiter(this,void 0,void 0,function*(){return yu(t,"GET",e,r,n)})}function Ak(t,e,r,n,o){return Jo.__awaiter(this,void 0,void 0,function*(){return yu(t,"POST",e,n,o,r)})}function Ok(t,e,r,n,o){return Jo.__awaiter(this,void 0,void 0,function*(){return yu(t,"PUT",e,n,o,r)})}function kk(t,e,r,n,o){return Jo.__awaiter(this,void 0,void 0,function*(){return yu(t,"DELETE",e,n,o,r)})}});var Wp=x(Gp=>{"use strict";Object.defineProperty(Gp,"__esModule",{value:!0});var wu=(fe(),ne(le)),$k=gu(),vu=Ko(),Cu=bu(),Pk=Yo(),zp=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},$k.DEFAULT_HEADERS),r),this.fetch=(0,Pk.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createIndex(e){return wu.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Cu.post)(this.fetch,`${this.url}/CreateIndex`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,vu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getIndex(e,r){return wu.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Cu.post)(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:e,indexName:r},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,vu.isStorageVectorsError)(n))return{data:null,error:n};throw n}})}listIndexes(e){return wu.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Cu.post)(this.fetch,`${this.url}/ListIndexes`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,vu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteIndex(e,r){return wu.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Cu.post)(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:e,indexName:r},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,vu.isStorageVectorsError)(n))return{data:null,error:n};throw n}})}};Gp.default=zp});var Jp=x(Yp=>{"use strict";Object.defineProperty(Yp,"__esModule",{value:!0});var Sa=(fe(),ne(le)),Tk=gu(),Fa=Ko(),Aa=bu(),Ik=Yo(),Kp=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Tk.DEFAULT_HEADERS),r),this.fetch=(0,Ik.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}putVectors(e){return Sa.__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,Aa.post)(this.fetch,`${this.url}/PutVectors`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Fa.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getVectors(e){return Sa.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Aa.post)(this.fetch,`${this.url}/GetVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Fa.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}listVectors(e){return Sa.__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,Aa.post)(this.fetch,`${this.url}/ListVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Fa.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}queryVectors(e){return Sa.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Aa.post)(this.fetch,`${this.url}/QueryVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Fa.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteVectors(e){return Sa.__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,Aa.post)(this.fetch,`${this.url}/DeleteVectors`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Fa.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}};Yp.default=Kp});var Qp=x(Zp=>{"use strict";Object.defineProperty(Zp,"__esModule",{value:!0});var Eu=(fe(),ne(le)),Rk=gu(),_u=Ko(),xu=bu(),Bk=Yo(),Xp=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Rk.DEFAULT_HEADERS),r),this.fetch=(0,Bk.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return Eu.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,xu.post)(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,_u.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getBucket(e){return Eu.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,xu.post)(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,_u.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}listBuckets(){return Eu.__awaiter(this,arguments,void 0,function*(e={}){try{return{data:yield(0,xu.post)(this.fetch,`${this.url}/ListVectorBuckets`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,_u.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return Eu.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,xu.post)(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,_u.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}};Zp.default=Xp});var Ky=x(gn=>{"use strict";Object.defineProperty(gn,"__esModule",{value:!0});gn.VectorIndexScope=gn.VectorBucketScope=gn.StorageVectorsClient=void 0;var rr=(fe(),ne(le)),jk=rr.__importDefault(Wp()),Nk=rr.__importDefault(Jp()),Lk=rr.__importDefault(Qp()),ed=class extends Lk.default{constructor(e,r={}){super(e,r.headers||{},r.fetch)}from(e){return new Su(this.url,this.headers,e,this.fetch)}};gn.StorageVectorsClient=ed;var Su=class extends jk.default{constructor(e,r,n,o){super(e,r,o),this.vectorBucketName=n}createIndex(e){let r=Object.create(null,{createIndex:{get:()=>super.createIndex}});return rr.__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 rr.__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 rr.__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 rr.__awaiter(this,void 0,void 0,function*(){return r.deleteIndex.call(this,this.vectorBucketName,e)})}index(e){return new Fu(this.url,this.headers,this.vectorBucketName,e,this.fetch)}};gn.VectorBucketScope=Su;var Fu=class extends Nk.default{constructor(e,r,n,o,i){super(e,r,i),this.vectorBucketName=n,this.indexName=o}putVectors(e){let r=Object.create(null,{putVectors:{get:()=>super.putVectors}});return rr.__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 rr.__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 rr.__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 rr.__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 rr.__awaiter(this,void 0,void 0,function*(){return r.deleteVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}};gn.VectorIndexScope=Fu});var nd=x(pe=>{"use strict";Object.defineProperty(pe,"__esModule",{value:!0});pe.validateVectorDimension=pe.normalizeToFloat32=pe.isPlainObject=pe.resolveResponse=pe.resolveFetch=pe.isStorageVectorsError=pe.StorageVectorsErrorCode=pe.StorageVectorsUnknownError=pe.StorageVectorsApiError=pe.StorageVectorsError=pe.VectorDataApi=pe.VectorIndexApi=pe.VectorBucketApi=pe.VectorIndexScope=pe.VectorBucketScope=pe.StorageVectorsClient=void 0;var td=(fe(),ne(le)),rd=Ky();Object.defineProperty(pe,"StorageVectorsClient",{enumerable:!0,get:function(){return rd.StorageVectorsClient}});Object.defineProperty(pe,"VectorBucketScope",{enumerable:!0,get:function(){return rd.VectorBucketScope}});Object.defineProperty(pe,"VectorIndexScope",{enumerable:!0,get:function(){return rd.VectorIndexScope}});var Uk=Qp();Object.defineProperty(pe,"VectorBucketApi",{enumerable:!0,get:function(){return td.__importDefault(Uk).default}});var Mk=Wp();Object.defineProperty(pe,"VectorIndexApi",{enumerable:!0,get:function(){return td.__importDefault(Mk).default}});var qk=Jp();Object.defineProperty(pe,"VectorDataApi",{enumerable:!0,get:function(){return td.__importDefault(qk).default}});var Oa=Ko();Object.defineProperty(pe,"StorageVectorsError",{enumerable:!0,get:function(){return Oa.StorageVectorsError}});Object.defineProperty(pe,"StorageVectorsApiError",{enumerable:!0,get:function(){return Oa.StorageVectorsApiError}});Object.defineProperty(pe,"StorageVectorsUnknownError",{enumerable:!0,get:function(){return Oa.StorageVectorsUnknownError}});Object.defineProperty(pe,"StorageVectorsErrorCode",{enumerable:!0,get:function(){return Oa.StorageVectorsErrorCode}});Object.defineProperty(pe,"isStorageVectorsError",{enumerable:!0,get:function(){return Oa.isStorageVectorsError}});var ka=Yo();Object.defineProperty(pe,"resolveFetch",{enumerable:!0,get:function(){return ka.resolveFetch}});Object.defineProperty(pe,"resolveResponse",{enumerable:!0,get:function(){return ka.resolveResponse}});Object.defineProperty(pe,"isPlainObject",{enumerable:!0,get:function(){return ka.isPlainObject}});Object.defineProperty(pe,"normalizeToFloat32",{enumerable:!0,get:function(){return ka.normalizeToFloat32}});Object.defineProperty(pe,"validateVectorDimension",{enumerable:!0,get:function(){return ka.validateVectorDimension}})});var Yy=x(Au=>{"use strict";Object.defineProperty(Au,"__esModule",{value:!0});Au.StorageClient=void 0;var id=(fe(),ne(le)),Hk=id.__importDefault(Vy()),Vk=id.__importDefault(zy()),zk=id.__importDefault(qp()),Gk=nd(),od=class extends Vk.default{constructor(e,r={},n,o){super(e,r,n,o)}from(e){return new Hk.default(this.url,this.headers,e,this.fetch)}get vectors(){return new Gk.StorageVectorsClient(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new zk.default(this.url+"/iceberg",this.headers,this.fetch)}};Au.StorageClient=od});var Xy=x(Jy=>{"use strict";Object.defineProperty(Jy,"__esModule",{value:!0})});var Zy=x(Gr=>{"use strict";Object.defineProperty(Gr,"__esModule",{value:!0});Gr.StorageAnalyticsApi=Gr.StorageClient=void 0;var Ou=(fe(),ne(le)),Wk=Yy();Object.defineProperty(Gr,"StorageClient",{enumerable:!0,get:function(){return Wk.StorageClient}});var Kk=qp();Object.defineProperty(Gr,"StorageAnalyticsApi",{enumerable:!0,get:function(){return Ou.__importDefault(Kk).default}});Ou.__exportStar(Xy(),Gr);Ou.__exportStar(mn(),Gr);Ou.__exportStar(nd(),Gr)});var Qy=x(ku=>{"use strict";Object.defineProperty(ku,"__esModule",{value:!0});ku.version=void 0;ku.version="2.79.0"});var e0=x(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.DEFAULT_REALTIME_OPTIONS=Vt.DEFAULT_AUTH_OPTIONS=Vt.DEFAULT_DB_OPTIONS=Vt.DEFAULT_GLOBAL_OPTIONS=Vt.DEFAULT_HEADERS=void 0;var Yk=Qy(),$a="";typeof Deno<"u"?$a="deno":typeof document<"u"?$a="web":typeof navigator<"u"&&navigator.product==="ReactNative"?$a="react-native":$a="node";Vt.DEFAULT_HEADERS={"X-Client-Info":`supabase-js-${$a}/${Yk.version}`};Vt.DEFAULT_GLOBAL_OPTIONS={headers:Vt.DEFAULT_HEADERS};Vt.DEFAULT_DB_OPTIONS={schema:"public"};Vt.DEFAULT_AUTH_OPTIONS={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"};Vt.DEFAULT_REALTIME_OPTIONS={}});var t0=x(xr=>{"use strict";Object.defineProperty(xr,"__esModule",{value:!0});xr.fetchWithAuth=xr.resolveHeadersConstructor=xr.resolveFetch=void 0;var Jk=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);xr.resolveFetch=Jk;var Xk=()=>Headers;xr.resolveHeadersConstructor=Xk;var Zk=(t,e,r)=>{let n=(0,xr.resolveFetch)(r),o=(0,xr.resolveHeadersConstructor)();return async(i,a)=>{var s;let u=(s=await e())!==null&&s!==void 0?s:t,c=new o(a?.headers);return c.has("apikey")||c.set("apikey",t),c.has("Authorization")||c.set("Authorization",`Bearer ${u}`),n(i,Object.assign(Object.assign({},a),{headers:c}))}};xr.fetchWithAuth=Zk});var n0=x(Dn=>{"use strict";Object.defineProperty(Dn,"__esModule",{value:!0});Dn.isBrowser=void 0;Dn.uuid=Qk;Dn.ensureTrailingSlash=r0;Dn.applySettingDefaults=t3;Dn.validateSupabaseUrl=r3;function Qk(){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 r0(t){return t.endsWith("/")?t:t+"/"}var e3=()=>typeof window<"u";Dn.isBrowser=e3;function t3(t,e){var r,n;let{db:o,auth:i,realtime:a,global:s}=t,{db:u,auth:c,realtime:l,global:p}=e,d={db:Object.assign(Object.assign({},u),o),auth:Object.assign(Object.assign({},c),i),realtime:Object.assign(Object.assign({},l),a),storage:{},global:Object.assign(Object.assign(Object.assign({},p),s),{headers:Object.assign(Object.assign({},(r=p?.headers)!==null&&r!==void 0?r:{}),(n=s?.headers)!==null&&n!==void 0?n:{})}),accessToken:async()=>""};return t.accessToken?d.accessToken=t.accessToken:delete d.accessToken,d}function r3(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(r0(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}});var yd={};qr(yd,{AuthAdminApi:()=>sd,AuthApiError:()=>ud,AuthClient:()=>ad,AuthError:()=>wr,AuthImplicitGrantRedirectError:()=>dd,AuthInvalidCredentialsError:()=>pd,AuthInvalidTokenResponseError:()=>fd,AuthPKCEGrantCodeExchangeError:()=>hd,AuthRetryableError:()=>cd,AuthSessionMissingError:()=>ld,AuthWeakPasswordError:()=>md,GoTrueAdminApi:()=>Pu,GoTrueClient:()=>$u,NavigatorLockAcquireTimeoutError:()=>gd,isAuthApiError:()=>s3,isAuthError:()=>a3,isAuthRetryableError:()=>u3,isAuthSessionMissingError:()=>c3,isAuthWeakPasswordError:()=>l3,lockInternals:()=>i3,navigatorLock:()=>n3,processLock:()=>o3});var Dd,o0,$u,Pu,ad,sd,wr,ud,cd,ld,fd,pd,dd,hd,md,n3,o3,gd,i3,a3,s3,u3,c3,l3,bd=tt(()=>{Dd=()=>Promise.resolve({data:{session:null,user:null},error:null}),o0={get:(t,e)=>{if(e==="constructor")return t.constructor;if(!(e==="then"||e==="catch"||e==="finally")&&typeof e!="symbol")return e==="getSession"?()=>Promise.resolve({data:{session:null,user:null},error:null}):e==="onAuthStateChange"?()=>({data:{subscription:{unsubscribe:()=>{}}},error:null}):Dd}},$u=class{constructor(e){return this.options=e,new Proxy(this,o0)}},Pu=class{constructor(e){return this.options=e,new Proxy(this,o0)}},ad=class extends $u{},sd=class extends Pu{},wr=class extends Error{},ud=class extends wr{},cd=class extends wr{},ld=class extends wr{},fd=class extends wr{},pd=class extends wr{},dd=class extends wr{},hd=class extends wr{},md=class extends wr{},n3=Dd,o3=Dd,gd=class extends Error{},i3={},a3=()=>!1,s3=()=>!1,u3=()=>!1,c3=()=>!1,l3=()=>!1});var i0=x(Tu=>{"use strict";Object.defineProperty(Tu,"__esModule",{value:!0});Tu.SupabaseAuthClient=void 0;var f3=(bd(),ne(yd)),wd=class extends f3.AuthClient{constructor(e){super(e)}};Tu.SupabaseAuthClient=wd});var Ed=x(Cd=>{"use strict";Object.defineProperty(Cd,"__esModule",{value:!0});var p3=rp(),d3=bp(),h3=(Cp(),ne(vp)),m3=Zy(),Iu=e0(),g3=t0(),a0=n0(),D3=i0(),vd=class{constructor(e,r,n){var o,i,a;this.supabaseUrl=e,this.supabaseKey=r;let s=(0,a0.validateSupabaseUrl)(e);if(!r)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",s),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",s),this.storageUrl=new URL("storage/v1",s),this.functionsUrl=new URL("functions/v1",s);let u=`sb-${s.hostname.split(".")[0]}-auth-token`,c={db:Iu.DEFAULT_DB_OPTIONS,realtime:Iu.DEFAULT_REALTIME_OPTIONS,auth:Object.assign(Object.assign({},Iu.DEFAULT_AUTH_OPTIONS),{storageKey:u}),global:Iu.DEFAULT_GLOBAL_OPTIONS},l=(0,a0.applySettingDefaults)(n??{},c);this.storageKey=(o=l.auth.storageKey)!==null&&o!==void 0?o:"",this.headers=(i=l.global.headers)!==null&&i!==void 0?i:{},l.accessToken?(this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(p,d)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(d)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((a=l.auth)!==null&&a!==void 0?a:{},this.headers,l.global.fetch),this.fetch=(0,g3.fetchWithAuth)(r,this._getAccessToken.bind(this),l.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},l.realtime)),this.rest=new d3.PostgrestClient(new URL("rest/v1",s).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch}),this.storage=new m3.StorageClient(this.storageUrl.href,this.headers,this.fetch,n?.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new p3.FunctionsClient(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,r={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,r,n)}channel(e,r={config:{}}){return this.realtime.channel(e,r)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e,r;if(this.accessToken)return await this.accessToken();let{data:n}=await this.auth.getSession();return(r=(e=n.session)===null||e===void 0?void 0:e.access_token)!==null&&r!==void 0?r:this.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:r,detectSessionInUrl:n,storage:o,userStorage:i,storageKey:a,flowType:s,lock:u,debug:c,throwOnError:l},p,d){let h={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new D3.SupabaseAuthClient({url:this.authUrl.href,headers:Object.assign(Object.assign({},h),p),storageKey:a,autoRefreshToken:e,persistSession:r,detectSessionInUrl:n,storage:o,userStorage:i,flowType:s,lock:u,debug:c,throwOnError:l,fetch:d,hasCustomAuthorizationHeader:Object.keys(this.headers).some(m=>m.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new h3.RealtimeClient(this.realtimeUrl.href,Object.assign(Object.assign({},e),{params:Object.assign({apikey:this.supabaseKey},e?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((r,n)=>{this._handleTokenChanged(r,"CLIENT",n?.access_token)})}_handleTokenChanged(e,r,n){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==n?(this.changedAccessToken=n,this.realtime.setAuth(n)):e==="SIGNED_OUT"&&(this.realtime.setAuth(),r=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};Cd.default=vd});var c0=x(Ie=>{"use strict";var y3=Ie&&Ie.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),s0=Ie&&Ie.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&y3(e,t,r)},u0=Ie&&Ie.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ie,"__esModule",{value:!0});Ie.createClient=Ie.SupabaseClient=Ie.FunctionRegion=Ie.FunctionsError=Ie.FunctionsRelayError=Ie.FunctionsFetchError=Ie.FunctionsHttpError=Ie.PostgrestError=void 0;var b3=u0(Ed());s0((bd(),ne(yd)),Ie);var w3=bp();Object.defineProperty(Ie,"PostgrestError",{enumerable:!0,get:function(){return w3.PostgrestError}});var Pa=rp();Object.defineProperty(Ie,"FunctionsHttpError",{enumerable:!0,get:function(){return Pa.FunctionsHttpError}});Object.defineProperty(Ie,"FunctionsFetchError",{enumerable:!0,get:function(){return Pa.FunctionsFetchError}});Object.defineProperty(Ie,"FunctionsRelayError",{enumerable:!0,get:function(){return Pa.FunctionsRelayError}});Object.defineProperty(Ie,"FunctionsError",{enumerable:!0,get:function(){return Pa.FunctionsError}});Object.defineProperty(Ie,"FunctionRegion",{enumerable:!0,get:function(){return Pa.FunctionRegion}});s0((Cp(),ne(vp)),Ie);var v3=Ed();Object.defineProperty(Ie,"SupabaseClient",{enumerable:!0,get:function(){return u0(v3).default}});var C3=(t,e,r)=>new b3.default(t,e,r);Ie.createClient=C3;function E3(){if(typeof window<"u"||typeof process>"u")return!1;let t=process.version;if(t==null)return!1;let e=t.match(/^v(\d+)\./);return e?parseInt(e[1],10)<=18:!1}E3()&&console.warn("\u26A0\uFE0F Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217")});var _d=x((wV,l0)=>{l0.exports={LOCHDR:30,LOCSIG:67324752,LOCVER:4,LOCFLG:6,LOCHOW:8,LOCTIM:10,LOCCRC:14,LOCSIZ:18,LOCLEN:22,LOCNAM:26,LOCEXT:28,EXTSIG:134695760,EXTHDR:16,EXTCRC:4,EXTSIZ:8,EXTLEN:12,CENHDR:46,CENSIG:33639248,CENVEM:4,CENVER:6,CENFLG:8,CENHOW:10,CENTIM:12,CENCRC:16,CENSIZ:20,CENLEN:24,CENNAM:28,CENEXT:30,CENCOM:32,CENDSK:34,CENATT:36,CENATX:38,CENOFF:42,ENDHDR:22,ENDSIG:101010256,ENDSUB:8,ENDTOT:10,ENDSIZ:12,ENDOFF:16,ENDCOM:20,END64HDR:20,END64SIG:117853008,END64START:4,END64OFF:8,END64NUMDISKS:16,ZIP64SIG:101075792,ZIP64HDR:56,ZIP64LEAD:12,ZIP64SIZE:4,ZIP64VEM:12,ZIP64VER:14,ZIP64DSK:16,ZIP64DSKDIR:20,ZIP64SUB:24,ZIP64TOT:32,ZIP64SIZB:40,ZIP64OFF:48,ZIP64EXTRA:56,STORED:0,SHRUNK:1,REDUCED1:2,REDUCED2:3,REDUCED3:4,REDUCED4:5,IMPLODED:6,DEFLATED:8,ENHANCED_DEFLATED:9,PKWARE:10,BZIP2:12,LZMA:14,IBM_TERSE:18,IBM_LZ77:19,AES_ENCRYPT:99,FLG_ENC:1,FLG_COMP1:2,FLG_COMP2:4,FLG_DESC:8,FLG_ENH:16,FLG_PATCH:32,FLG_STR:64,FLG_EFS:2048,FLG_MSK:4096,FILE:2,BUFFER:1,NONE:0,EF_ID:0,EF_SIZE:2,ID_ZIP64:1,ID_AVINFO:7,ID_PFS:8,ID_OS2:9,ID_NTFS:10,ID_OPENVMS:12,ID_UNIX:13,ID_FORK:14,ID_PATCH:15,ID_X509_PKCS7:20,ID_X509_CERTID_F:21,ID_X509_CERTID_C:22,ID_STRONGENC:23,ID_RECORD_MGT:24,ID_X509_PKCS7_RL:25,ID_IBM1:101,ID_IBM2:102,ID_POSZIP:18064,EF_ZIP64_OR_32:4294967295,EF_ZIP64_OR_16:65535,EF_ZIP64_SUNCOMP:0,EF_ZIP64_SCOMP:8,EF_ZIP64_RHO:16,EF_ZIP64_DSN:24}});var Ru=x(p0=>{var f0={INVALID_LOC:"Invalid LOC header (bad signature)",INVALID_CEN:"Invalid CEN header (bad signature)",INVALID_END:"Invalid END header (bad signature)",DESCRIPTOR_NOT_EXIST:"No descriptor present",DESCRIPTOR_UNKNOWN:"Unknown descriptor format",DESCRIPTOR_FAULTY:"Descriptor data is malformed",NO_DATA:"Nothing to decompress",BAD_CRC:"CRC32 checksum failed {0}",FILE_IN_THE_WAY:"There is a file in the way: {0}",UNKNOWN_METHOD:"Invalid/unsupported compression method",AVAIL_DATA:"inflate::Available inflate data did not terminate",INVALID_DISTANCE:"inflate::Invalid literal/length or distance code in fixed or dynamic block",TO_MANY_CODES:"inflate::Dynamic block code description: too many length or distance codes",INVALID_REPEAT_LEN:"inflate::Dynamic block code description: repeat more than specified lengths",INVALID_REPEAT_FIRST:"inflate::Dynamic block code description: repeat lengths with no first length",INCOMPLETE_CODES:"inflate::Dynamic block code description: code lengths codes incomplete",INVALID_DYN_DISTANCE:"inflate::Dynamic block code description: invalid distance code lengths",INVALID_CODES_LEN:"inflate::Dynamic block code description: invalid literal/length code lengths",INVALID_STORE_BLOCK:"inflate::Stored block length did not match one's complement",INVALID_BLOCK_TYPE:"inflate::Invalid block type (type == 3)",CANT_EXTRACT_FILE:"Could not extract the file",CANT_OVERRIDE:"Target file already exists",DISK_ENTRY_TOO_LARGE:"Number of disk entries is too large",NO_ZIP:"No zip file was loaded",NO_ENTRY:"Entry doesn't exist",DIRECTORY_CONTENT_ERROR:"A directory cannot have content",FILE_NOT_FOUND:'File not found: "{0}"',NOT_IMPLEMENTED:"Not implemented",INVALID_FILENAME:"Invalid filename",INVALID_FORMAT:"Invalid or unsupported zip format. No END header found",INVALID_PASS_PARAM:"Incompatible password parameter",WRONG_PASSWORD:"Wrong Password",COMMENT_TOO_LONG:"Comment is too long",EXTRA_FIELD_PARSE_ERROR:"Extra field parsing error"};function _3(t){return function(...e){return e.length&&(t=t.replace(/\{(\d)\}/g,(r,n)=>e[n]||"")),new Error("ADM-ZIP: "+t)}}for(let t of Object.keys(f0))p0[t]=_3(f0[t])});var D0=x((CV,g0)=>{var x3=require("fs"),rt=require("path"),d0=_d(),S3=Ru(),F3=typeof process=="object"&&process.platform==="win32",h0=t=>typeof t=="object"&&t!==null,m0=new Uint32Array(256).map((t,e)=>{for(let r=0;r<8;r++)(e&1)!==0?e=3988292384^e>>>1:e>>>=1;return e>>>0});function We(t){this.sep=rt.sep,this.fs=x3,h0(t)&&h0(t.fs)&&typeof t.fs.statSync=="function"&&(this.fs=t.fs)}g0.exports=We;We.prototype.makeDir=function(t){let e=this;function r(n){let o=n.split(e.sep)[0];n.split(e.sep).forEach(function(i){if(!(!i||i.substr(-1,1)===":")){o+=e.sep+i;var a;try{a=e.fs.statSync(o)}catch{e.fs.mkdirSync(o)}if(a&&a.isFile())throw S3.FILE_IN_THE_WAY(`"${o}"`)}})}r(t)};We.prototype.writeFileTo=function(t,e,r,n){let o=this;if(o.fs.existsSync(t)){if(!r)return!1;var i=o.fs.statSync(t);if(i.isDirectory())return!1}var a=rt.dirname(t);o.fs.existsSync(a)||o.makeDir(a);var s;try{s=o.fs.openSync(t,"w",438)}catch{o.fs.chmodSync(t,438),s=o.fs.openSync(t,"w",438)}if(s)try{o.fs.writeSync(s,e,0,e.length,0)}finally{o.fs.closeSync(s)}return o.fs.chmodSync(t,n||438),!0};We.prototype.writeFileToAsync=function(t,e,r,n,o){typeof n=="function"&&(o=n,n=void 0);let i=this;i.fs.exists(t,function(a){if(a&&!r)return o(!1);i.fs.stat(t,function(s,u){if(a&&u.isDirectory())return o(!1);var c=rt.dirname(t);i.fs.exists(c,function(l){l||i.makeDir(c),i.fs.open(t,"w",438,function(p,d){p?i.fs.chmod(t,438,function(){i.fs.open(t,"w",438,function(h,m){i.fs.write(m,e,0,e.length,0,function(){i.fs.close(m,function(){i.fs.chmod(t,n||438,function(){o(!0)})})})})}):d?i.fs.write(d,e,0,e.length,0,function(){i.fs.close(d,function(){i.fs.chmod(t,n||438,function(){o(!0)})})}):i.fs.chmod(t,n||438,function(){o(!0)})})})})})};We.prototype.findFiles=function(t){let e=this;function r(n,o,i){typeof o=="boolean"&&(i=o,o=void 0);let a=[];return e.fs.readdirSync(n).forEach(function(s){let u=rt.join(n,s),c=e.fs.statSync(u);(!o||o.test(u))&&a.push(rt.normalize(u)+(c.isDirectory()?e.sep:"")),c.isDirectory()&&i&&(a=a.concat(r(u,o,i)))}),a}return r(t,void 0,!0)};We.prototype.findFilesAsync=function(t,e){let r=this,n=[];r.fs.readdir(t,function(o,i){if(o)return e(o);let a=i.length;if(!a)return e(null,n);i.forEach(function(s){s=rt.join(t,s),r.fs.stat(s,function(u,c){if(u)return e(u);c&&(n.push(rt.normalize(s)+(c.isDirectory()?r.sep:"")),c.isDirectory()?r.findFilesAsync(s,function(l,p){if(l)return e(l);n=n.concat(p),--a||e(null,n)}):--a||e(null,n))})})})};We.prototype.getAttributes=function(){};We.prototype.setAttributes=function(){};We.crc32update=function(t,e){return m0[(t^e)&255]^t>>>8};We.crc32=function(t){typeof t=="string"&&(t=Buffer.from(t,"utf8"));let e=t.length,r=-1;for(let n=0;n<e;)r=We.crc32update(r,t[n++]);return~r>>>0};We.methodToString=function(t){switch(t){case d0.STORED:return"STORED ("+t+")";case d0.DEFLATED:return"DEFLATED ("+t+")";default:return"UNSUPPORTED ("+t+")"}};We.canonical=function(t){if(!t)return"";let e=rt.posix.normalize("/"+t.split("\\").join("/"));return rt.join(".",e)};We.zipnamefix=function(t){if(!t)return"";let e=rt.posix.normalize("/"+t.split("\\").join("/"));return rt.posix.join(".",e)};We.findLast=function(t,e){if(!Array.isArray(t))throw new TypeError("arr is not array");let r=t.length>>>0;for(let n=r-1;n>=0;n--)if(e(t[n],n,t))return t[n]};We.sanitize=function(t,e){t=rt.resolve(rt.normalize(t));for(var r=e.split("/"),n=0,o=r.length;n<o;n++){var i=rt.normalize(rt.join(t,r.slice(n,o).join(rt.sep)));if(i.indexOf(t)===0)return i}return rt.normalize(rt.join(t,rt.basename(e)))};We.toBuffer=function(e,r){return Buffer.isBuffer(e)?e:e instanceof Uint8Array?Buffer.from(e):typeof e=="string"?r(e):Buffer.alloc(0)};We.readBigUInt64LE=function(t,e){var r=Buffer.from(t.slice(e,e+8));return r.swap64(),parseInt(`0x${r.toString("hex")}`)};We.fromDOS2Date=function(t){return new Date((t>>25&127)+1980,Math.max((t>>21&15)-1,0),Math.max(t>>16&31,1),t>>11&31,t>>5&63,(t&31)<<1)};We.fromDate2DOS=function(t){let e=0,r=0;return t.getFullYear()>1979&&(e=(t.getFullYear()-1980&127)<<9|t.getMonth()+1<<5|t.getDate(),r=t.getHours()<<11|t.getMinutes()<<5|t.getSeconds()>>1),e<<16|r};We.isWin=F3;We.crcTable=m0});var b0=x((EV,y0)=>{var A3=require("path");y0.exports=function(t,{fs:e}){var r=t||"",n=i(),o=null;function i(){return{directory:!1,readonly:!1,hidden:!1,executable:!1,mtime:0,atime:0}}return r&&e.existsSync(r)?(o=e.statSync(r),n.directory=o.isDirectory(),n.mtime=o.mtime,n.atime=o.atime,n.executable=(73&o.mode)!==0,n.readonly=(128&o.mode)===0,n.hidden=A3.basename(r)[0]==="."):console.warn("Invalid path: "+r),{get directory(){return n.directory},get readOnly(){return n.readonly},get hidden(){return n.hidden},get mtime(){return n.mtime},get atime(){return n.atime},get executable(){return n.executable},decodeAttributes:function(){},encodeAttributes:function(){},toJSON:function(){return{path:r,isDirectory:n.directory,isReadOnly:n.readonly,isHidden:n.hidden,isExecutable:n.executable,mTime:n.mtime,aTime:n.atime}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var v0=x((_V,w0)=>{w0.exports={efs:!0,encode:t=>Buffer.from(t,"utf8"),decode:t=>t.toString("utf8")}});var Qo=x((xV,Zo)=>{Zo.exports=D0();Zo.exports.Constants=_d();Zo.exports.Errors=Ru();Zo.exports.FileAttr=b0();Zo.exports.decoder=v0()});var E0=x((SV,C0)=>{var yn=Qo(),K=yn.Constants;C0.exports=function(){var t=20,e=10,r=0,n=0,o=0,i=0,a=0,s=0,u=0,c=0,l=0,p=0,d=0,h=0,m=0;t|=yn.isWin?2560:768,r|=K.FLG_EFS;let b={extraLen:0},D=g=>Math.max(0,g)>>>0,C=g=>Math.max(0,g)&65535,E=g=>Math.max(0,g)&255;return o=yn.fromDate2DOS(new Date),{get made(){return t},set made(g){t=g},get version(){return e},set version(g){e=g},get flags(){return r},set flags(g){r=g},get flags_efs(){return(r&K.FLG_EFS)>0},set flags_efs(g){g?r|=K.FLG_EFS:r&=~K.FLG_EFS},get flags_desc(){return(r&K.FLG_DESC)>0},set flags_desc(g){g?r|=K.FLG_DESC:r&=~K.FLG_DESC},get method(){return n},set method(g){switch(g){case K.STORED:this.version=10;case K.DEFLATED:default:this.version=20}n=g},get time(){return yn.fromDOS2Date(this.timeval)},set time(g){this.timeval=yn.fromDate2DOS(g)},get timeval(){return o},set timeval(g){o=D(g)},get timeHighByte(){return E(o>>>8)},get crc(){return i},set crc(g){i=D(g)},get compressedSize(){return a},set compressedSize(g){a=D(g)},get size(){return s},set size(g){s=D(g)},get fileNameLength(){return u},set fileNameLength(g){u=g},get extraLength(){return c},set extraLength(g){c=g},get extraLocalLength(){return b.extraLen},set extraLocalLength(g){b.extraLen=g},get commentLength(){return l},set commentLength(g){l=g},get diskNumStart(){return p},set diskNumStart(g){p=D(g)},get inAttr(){return d},set inAttr(g){d=D(g)},get attr(){return h},set attr(g){h=D(g)},get fileAttr(){return(h||0)>>16&4095},get offset(){return m},set offset(g){m=D(g)},get encrypted(){return(r&K.FLG_ENC)===K.FLG_ENC},get centralHeaderSize(){return K.CENHDR+u+c+l},get realDataOffset(){return m+K.LOCHDR+b.fnameLen+b.extraLen},get localHeader(){return b},loadLocalHeaderFromBinary:function(g){var _=g.slice(m,m+K.LOCHDR);if(_.readUInt32LE(0)!==K.LOCSIG)throw yn.Errors.INVALID_LOC();b.version=_.readUInt16LE(K.LOCVER),b.flags=_.readUInt16LE(K.LOCFLG),b.method=_.readUInt16LE(K.LOCHOW),b.time=_.readUInt32LE(K.LOCTIM),b.crc=_.readUInt32LE(K.LOCCRC),b.compressedSize=_.readUInt32LE(K.LOCSIZ),b.size=_.readUInt32LE(K.LOCLEN),b.fnameLen=_.readUInt16LE(K.LOCNAM),b.extraLen=_.readUInt16LE(K.LOCEXT);let S=m+K.LOCHDR+b.fnameLen,$=S+b.extraLen;return g.slice(S,$)},loadFromBinary:function(g){if(g.length!==K.CENHDR||g.readUInt32LE(0)!==K.CENSIG)throw yn.Errors.INVALID_CEN();t=g.readUInt16LE(K.CENVEM),e=g.readUInt16LE(K.CENVER),r=g.readUInt16LE(K.CENFLG),n=g.readUInt16LE(K.CENHOW),o=g.readUInt32LE(K.CENTIM),i=g.readUInt32LE(K.CENCRC),a=g.readUInt32LE(K.CENSIZ),s=g.readUInt32LE(K.CENLEN),u=g.readUInt16LE(K.CENNAM),c=g.readUInt16LE(K.CENEXT),l=g.readUInt16LE(K.CENCOM),p=g.readUInt16LE(K.CENDSK),d=g.readUInt16LE(K.CENATT),h=g.readUInt32LE(K.CENATX),m=g.readUInt32LE(K.CENOFF)},localHeaderToBinary:function(){var g=Buffer.alloc(K.LOCHDR);return g.writeUInt32LE(K.LOCSIG,0),g.writeUInt16LE(e,K.LOCVER),g.writeUInt16LE(r,K.LOCFLG),g.writeUInt16LE(n,K.LOCHOW),g.writeUInt32LE(o,K.LOCTIM),g.writeUInt32LE(i,K.LOCCRC),g.writeUInt32LE(a,K.LOCSIZ),g.writeUInt32LE(s,K.LOCLEN),g.writeUInt16LE(u,K.LOCNAM),g.writeUInt16LE(b.extraLen,K.LOCEXT),g},centralHeaderToBinary:function(){var g=Buffer.alloc(K.CENHDR+u+c+l);return g.writeUInt32LE(K.CENSIG,0),g.writeUInt16LE(t,K.CENVEM),g.writeUInt16LE(e,K.CENVER),g.writeUInt16LE(r,K.CENFLG),g.writeUInt16LE(n,K.CENHOW),g.writeUInt32LE(o,K.CENTIM),g.writeUInt32LE(i,K.CENCRC),g.writeUInt32LE(a,K.CENSIZ),g.writeUInt32LE(s,K.CENLEN),g.writeUInt16LE(u,K.CENNAM),g.writeUInt16LE(c,K.CENEXT),g.writeUInt16LE(l,K.CENCOM),g.writeUInt16LE(p,K.CENDSK),g.writeUInt16LE(d,K.CENATT),g.writeUInt32LE(h,K.CENATX),g.writeUInt32LE(m,K.CENOFF),g},toJSON:function(){let g=function(_){return _+" bytes"};return{made:t,version:e,flags:r,method:yn.methodToString(n),time:this.time,crc:"0x"+i.toString(16).toUpperCase(),compressedSize:g(a),size:g(s),fileNameLength:g(u),extraLength:g(c),commentLength:g(l),diskNumStart:p,inAttr:d,attr:h,offset:m,centralHeaderSize:g(K.CENHDR+u+c+l)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var x0=x((FV,_0)=>{var ei=Qo(),He=ei.Constants;_0.exports=function(){var t=0,e=0,r=0,n=0,o=0;return{get diskEntries(){return t},set diskEntries(i){t=e=i},get totalEntries(){return e},set totalEntries(i){e=t=i},get size(){return r},set size(i){r=i},get offset(){return n},set offset(i){n=i},get commentLength(){return o},set commentLength(i){o=i},get mainHeaderSize(){return He.ENDHDR+o},loadFromBinary:function(i){if((i.length!==He.ENDHDR||i.readUInt32LE(0)!==He.ENDSIG)&&(i.length<He.ZIP64HDR||i.readUInt32LE(0)!==He.ZIP64SIG))throw ei.Errors.INVALID_END();i.readUInt32LE(0)===He.ENDSIG?(t=i.readUInt16LE(He.ENDSUB),e=i.readUInt16LE(He.ENDTOT),r=i.readUInt32LE(He.ENDSIZ),n=i.readUInt32LE(He.ENDOFF),o=i.readUInt16LE(He.ENDCOM)):(t=ei.readBigUInt64LE(i,He.ZIP64SUB),e=ei.readBigUInt64LE(i,He.ZIP64TOT),r=ei.readBigUInt64LE(i,He.ZIP64SIZE),n=ei.readBigUInt64LE(i,He.ZIP64OFF),o=0)},toBinary:function(){var i=Buffer.alloc(He.ENDHDR+o);return i.writeUInt32LE(He.ENDSIG,0),i.writeUInt32LE(0,4),i.writeUInt16LE(t,He.ENDSUB),i.writeUInt16LE(e,He.ENDTOT),i.writeUInt32LE(r,He.ENDSIZ),i.writeUInt32LE(n,He.ENDOFF),i.writeUInt16LE(o,He.ENDCOM),i.fill(" ",He.ENDHDR),i},toJSON:function(){let i=function(a,s){let u=a.toString(16).toUpperCase();for(;u.length<s;)u="0"+u;return"0x"+u};return{diskEntries:t,totalEntries:e,size:r+" bytes",offset:i(n,4),commentLength:o}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var Sd=x(xd=>{xd.EntryHeader=E0();xd.MainHeader=x0()});var F0=x((OV,S0)=>{S0.exports=function(t){var e=require("zlib"),r={chunkSize:(parseInt(t.length/1024)+1)*1024};return{deflate:function(){return e.deflateRawSync(t,r)},deflateAsync:function(n){var o=e.createDeflateRaw(r),i=[],a=0;o.on("data",function(s){i.push(s),a+=s.length}),o.on("end",function(){var s=Buffer.alloc(a),u=0;s.fill(0);for(var c=0;c<i.length;c++){var l=i[c];l.copy(s,u),u+=l.length}n&&n(s)}),o.end(t)}}}});var O0=x((kV,A0)=>{var O3=+(process.versions?process.versions.node:"").split(".")[0]||0;A0.exports=function(t,e){var r=require("zlib");let n=O3>=15&&e>0?{maxOutputLength:e}:{};return{inflate:function(){return r.inflateRawSync(t,n)},inflateAsync:function(o){var i=r.createInflateRaw(n),a=[],s=0;i.on("data",function(u){a.push(u),s+=u.length}),i.on("end",function(){var u=Buffer.alloc(s),c=0;u.fill(0);for(var l=0;l<a.length;l++){var p=a[l];p.copy(u,c),c+=p.length}o&&o(u)}),i.end(t)}}}});var I0=x(($V,T0)=>{"use strict";var{randomFillSync:k0}=require("crypto"),k3=Ru(),$3=new Uint32Array(256).map((t,e)=>{for(let r=0;r<8;r++)(e&1)!==0?e=e>>>1^3988292384:e>>>=1;return e>>>0}),P0=(t,e)=>Math.imul(t,e)>>>0,$0=(t,e)=>$3[(t^e)&255]^t>>>8,Ta=()=>typeof k0=="function"?k0(Buffer.alloc(12)):Ta.node();Ta.node=()=>{let t=Buffer.alloc(12),e=t.length;for(let r=0;r<e;r++)t[r]=Math.random()*256&255;return t};var Bu={genSalt:Ta};function ju(t){let e=Buffer.isBuffer(t)?t:Buffer.from(t);this.keys=new Uint32Array([305419896,591751049,878082192]);for(let r=0;r<e.length;r++)this.updateKeys(e[r])}ju.prototype.updateKeys=function(t){let e=this.keys;return e[0]=$0(e[0],t),e[1]+=e[0]&255,e[1]=P0(e[1],134775813)+1,e[2]=$0(e[2],e[1]>>>24),t};ju.prototype.next=function(){let t=(this.keys[2]|2)>>>0;return P0(t,t^1)>>8&255};function P3(t){let e=new ju(t);return function(r){let n=Buffer.alloc(r.length),o=0;for(let i of r)n[o++]=e.updateKeys(i^e.next());return n}}function T3(t){let e=new ju(t);return function(r,n,o=0){n||(n=Buffer.alloc(r.length));for(let i of r){let a=e.next();n[o++]=i^a,e.updateKeys(i)}return n}}function I3(t,e,r){if(!t||!Buffer.isBuffer(t)||t.length<12)return Buffer.alloc(0);let n=P3(r),o=n(t.slice(0,12)),i=(e.flags&8)===8?e.timeHighByte:e.crc>>>24;if(o[11]!==i)throw k3.WRONG_PASSWORD();return n(t.slice(12))}function R3(t){Buffer.isBuffer(t)&&t.length>=12?Bu.genSalt=function(){return t.slice(0,12)}:t==="node"?Bu.genSalt=Ta.node:Bu.genSalt=Ta}function B3(t,e,r,n=!1){t==null&&(t=Buffer.alloc(0)),Buffer.isBuffer(t)||(t=Buffer.from(t.toString()));let o=T3(r),i=Bu.genSalt();i[11]=e.crc>>>24&255,n&&(i[10]=e.crc>>>16&255);let a=Buffer.alloc(t.length+12);return o(i,a),o(t,a,12)}T0.exports={decrypt:I3,encrypt:B3,_salter:R3}});var R0=x(Nu=>{Nu.Deflater=F0();Nu.Inflater=O0();Nu.ZipCrypto=I0()});var Ad=x((TV,B0)=>{var xe=Qo(),j3=Sd(),Ke=xe.Constants,Fd=R0();B0.exports=function(t,e){var r=new j3.EntryHeader,n=Buffer.alloc(0),o=Buffer.alloc(0),i=!1,a=null,s=Buffer.alloc(0),u=Buffer.alloc(0),c=!0;let l=t,p=typeof l.decoder=="object"?l.decoder:xe.decoder;c=p.hasOwnProperty("efs")?p.efs:!1;function d(){return!e||!(e instanceof Uint8Array)?Buffer.alloc(0):(u=r.loadLocalHeaderFromBinary(e),e.slice(r.realDataOffset,r.realDataOffset+r.compressedSize))}function h(g){if(r.flags_desc){let _={},S=r.realDataOffset+r.compressedSize;if(e.readUInt32LE(S)==Ke.LOCSIG||e.readUInt32LE(S)==Ke.CENSIG)throw xe.Errors.DESCRIPTOR_NOT_EXIST();if(e.readUInt32LE(S)==Ke.EXTSIG)_.crc=e.readUInt32LE(S+Ke.EXTCRC),_.compressedSize=e.readUInt32LE(S+Ke.EXTSIZ),_.size=e.readUInt32LE(S+Ke.EXTLEN);else if(e.readUInt16LE(S+12)===19280)_.crc=e.readUInt32LE(S+Ke.EXTCRC-4),_.compressedSize=e.readUInt32LE(S+Ke.EXTSIZ-4),_.size=e.readUInt32LE(S+Ke.EXTLEN-4);else throw xe.Errors.DESCRIPTOR_UNKNOWN();if(_.compressedSize!==r.compressedSize||_.size!==r.size||_.crc!==r.crc)throw xe.Errors.DESCRIPTOR_FAULTY();if(xe.crc32(g)!==_.crc)return!1}else if(xe.crc32(g)!==r.localHeader.crc)return!1;return!0}function m(g,_,S){if(typeof _>"u"&&typeof g=="string"&&(S=g,g=void 0),i)return g&&_&&_(Buffer.alloc(0),xe.Errors.DIRECTORY_CONTENT_ERROR()),Buffer.alloc(0);var $=d();if($.length===0)return g&&_&&_($),$;if(r.encrypted){if(typeof S!="string"&&!Buffer.isBuffer(S))throw xe.Errors.INVALID_PASS_PARAM();$=Fd.ZipCrypto.decrypt($,r,S)}var k=Buffer.alloc(r.size);switch(r.method){case xe.Constants.STORED:if($.copy(k),h(k))return g&&_&&_(k),k;throw g&&_&&_(k,xe.Errors.BAD_CRC()),xe.Errors.BAD_CRC();case xe.Constants.DEFLATED:var B=new Fd.Inflater($,r.size);if(g)B.inflateAsync(function(R){R.copy(R,0),_&&(h(R)?_(R):_(R,xe.Errors.BAD_CRC()))});else{if(B.inflate(k).copy(k,0),!h(k))throw xe.Errors.BAD_CRC(`"${p.decode(n)}"`);return k}break;default:throw g&&_&&_(Buffer.alloc(0),xe.Errors.UNKNOWN_METHOD()),xe.Errors.UNKNOWN_METHOD()}}function b(g,_){if((!a||!a.length)&&Buffer.isBuffer(e))return g&&_&&_(d()),d();if(a.length&&!i){var S;switch(r.method){case xe.Constants.STORED:return r.compressedSize=r.size,S=Buffer.alloc(a.length),a.copy(S),g&&_&&_(S),S;default:case xe.Constants.DEFLATED:var $=new Fd.Deflater(a);if(g)$.deflateAsync(function(B){S=Buffer.alloc(B.length),r.compressedSize=B.length,B.copy(S),_&&_(S)});else{var k=$.deflate();return r.compressedSize=k.length,k}$=null;break}}else if(g&&_)_(Buffer.alloc(0));else return Buffer.alloc(0)}function D(g,_){return(g.readUInt32LE(_+4)<<4)+g.readUInt32LE(_)}function C(g){try{for(var _=0,S,$,k;_+4<g.length;)S=g.readUInt16LE(_),_+=2,$=g.readUInt16LE(_),_+=2,k=g.slice(_,_+$),_+=$,Ke.ID_ZIP64===S&&E(k)}catch{throw xe.Errors.EXTRA_FIELD_PARSE_ERROR()}}function E(g){var _,S,$,k;g.length>=Ke.EF_ZIP64_SCOMP&&(_=D(g,Ke.EF_ZIP64_SUNCOMP),r.size===Ke.EF_ZIP64_OR_32&&(r.size=_)),g.length>=Ke.EF_ZIP64_RHO&&(S=D(g,Ke.EF_ZIP64_SCOMP),r.compressedSize===Ke.EF_ZIP64_OR_32&&(r.compressedSize=S)),g.length>=Ke.EF_ZIP64_DSN&&($=D(g,Ke.EF_ZIP64_RHO),r.offset===Ke.EF_ZIP64_OR_32&&(r.offset=$)),g.length>=Ke.EF_ZIP64_DSN+4&&(k=g.readUInt32LE(Ke.EF_ZIP64_DSN),r.diskNumStart===Ke.EF_ZIP64_OR_16&&(r.diskNumStart=k))}return{get entryName(){return p.decode(n)},get rawEntryName(){return n},set entryName(g){n=xe.toBuffer(g,p.encode);var _=n[n.length-1];i=_===47||_===92,r.fileNameLength=n.length},get efs(){return typeof c=="function"?c(this.entryName):c},get extra(){return s},set extra(g){s=g,r.extraLength=g.length,C(g)},get comment(){return p.decode(o)},set comment(g){if(o=xe.toBuffer(g,p.encode),r.commentLength=o.length,o.length>65535)throw xe.Errors.COMMENT_TOO_LONG()},get name(){var g=p.decode(n);return i?g.substr(g.length-1).split("/").pop():g.split("/").pop()},get isDirectory(){return i},getCompressedData:function(){return b(!1,null)},getCompressedDataAsync:function(g){b(!0,g)},setData:function(g){a=xe.toBuffer(g,xe.decoder.encode),!i&&a.length?(r.size=a.length,r.method=xe.Constants.DEFLATED,r.crc=xe.crc32(g),r.changed=!0):r.method=xe.Constants.STORED},getData:function(g){return r.changed?a:m(!1,null,g)},getDataAsync:function(g,_){r.changed?g(a):m(!0,g,_)},set attr(g){r.attr=g},get attr(){return r.attr},set header(g){r.loadFromBinary(g)},get header(){return r},packCentralHeader:function(){r.flags_efs=this.efs,r.extraLength=s.length;var g=r.centralHeaderToBinary(),_=xe.Constants.CENHDR;return n.copy(g,_),_+=n.length,s.copy(g,_),_+=r.extraLength,o.copy(g,_),g},packLocalHeader:function(){let g=0;r.flags_efs=this.efs,r.extraLocalLength=u.length;let _=r.localHeaderToBinary(),S=Buffer.alloc(_.length+n.length+r.extraLocalLength);return _.copy(S,g),g+=_.length,n.copy(S,g),g+=n.length,u.copy(S,g),g+=u.length,S},toJSON:function(){let g=function(_){return"<"+(_&&_.length+" bytes buffer"||"null")+">"};return{entryName:this.entryName,name:this.name,comment:this.comment,isDirectory:this.isDirectory,header:r.toJSON(),compressedData:g(e),data:g(a)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var L0=x((IV,N0)=>{var j0=Ad(),N3=Sd(),pt=Qo();N0.exports=function(t,e){var r=[],n={},o=Buffer.alloc(0),i=new N3.MainHeader,a=!1,s=null;let u=new Set,c=e,{noSort:l,decoder:p}=c;t?m(c.readEntries):a=!0;function d(){let D=new Set;for(let C of Object.keys(n)){let E=C.split("/");if(E.pop(),!!E.length)for(let g=0;g<E.length;g++){let _=E.slice(0,g+1).join("/")+"/";D.add(_)}}for(let C of D)if(!(C in n)){let E=new j0(c);E.entryName=C,E.attr=16,E.temporary=!0,r.push(E),n[E.entryName]=E,u.add(E)}}function h(){if(a=!0,n={},i.diskEntries>(t.length-i.offset)/pt.Constants.CENHDR)throw pt.Errors.DISK_ENTRY_TOO_LARGE();r=new Array(i.diskEntries);for(var D=i.offset,C=0;C<r.length;C++){var E=D,g=new j0(c,t);g.header=t.slice(E,E+=pt.Constants.CENHDR),g.entryName=t.slice(E,E+=g.header.fileNameLength),g.header.extraLength&&(g.extra=t.slice(E,E+=g.header.extraLength)),g.header.commentLength&&(g.comment=t.slice(E,E+g.header.commentLength)),D+=g.header.centralHeaderSize,r[C]=g,n[g.entryName]=g}u.clear(),d()}function m(D){var C=t.length-pt.Constants.ENDHDR,E=Math.max(0,C-65535),g=E,_=t.length,S=-1,$=0;for((typeof c.trailingSpace=="boolean"?c.trailingSpace:!1)&&(E=0),C;C>=g;C--)if(t[C]===80){if(t.readUInt32LE(C)===pt.Constants.ENDSIG){S=C,$=C,_=C+pt.Constants.ENDHDR,g=C-pt.Constants.END64HDR;continue}if(t.readUInt32LE(C)===pt.Constants.END64SIG){g=E;continue}if(t.readUInt32LE(C)===pt.Constants.ZIP64SIG){S=C,_=C+pt.readBigUInt64LE(t,C+pt.Constants.ZIP64SIZE)+pt.Constants.ZIP64LEAD;break}}if(S==-1)throw pt.Errors.INVALID_FORMAT();i.loadFromBinary(t.slice(S,_)),i.commentLength&&(o=t.slice($+pt.Constants.ENDHDR)),D&&h()}function b(){r.length>1&&!l&&r.sort((D,C)=>D.entryName.toLowerCase().localeCompare(C.entryName.toLowerCase()))}return{get entries(){return a||h(),r.filter(D=>!u.has(D))},get comment(){return p.decode(o)},set comment(D){o=pt.toBuffer(D,p.encode),i.commentLength=o.length},getEntryCount:function(){return a?r.length:i.diskEntries},forEach:function(D){this.entries.forEach(D)},getEntry:function(D){return a||h(),n[D]||null},setEntry:function(D){a||h(),r.push(D),n[D.entryName]=D,i.totalEntries=r.length},deleteFile:function(D,C=!0){a||h();let E=n[D];this.getEntryChildren(E,C).map(_=>_.entryName).forEach(this.deleteEntry)},deleteEntry:function(D){a||h();let C=n[D],E=r.indexOf(C);E>=0&&(r.splice(E,1),delete n[D],i.totalEntries=r.length)},getEntryChildren:function(D,C=!0){if(a||h(),typeof D=="object")if(D.isDirectory&&C){let E=[],g=D.entryName;for(let _ of r)_.entryName.startsWith(g)&&E.push(_);return E}else return[D];return[]},getChildCount:function(D){if(D&&D.isDirectory){let C=this.getEntryChildren(D);return C.includes(D)?C.length-1:C.length}return 0},compressToBuffer:function(){a||h(),b();let D=[],C=[],E=0,g=0;i.size=0,i.offset=0;let _=0;for(let k of this.entries){let B=k.getCompressedData();k.header.offset=g;let R=k.packLocalHeader(),N=R.length+B.length;g+=N,D.push(R),D.push(B);let A=k.packCentralHeader();C.push(A),i.size+=A.length,E+=N+A.length,_++}E+=i.mainHeaderSize,i.offset=g,i.totalEntries=_,g=0;let S=Buffer.alloc(E);for(let k of D)k.copy(S,g),g+=k.length;for(let k of C)k.copy(S,g),g+=k.length;let $=i.toBinary();return o&&o.copy($,pt.Constants.ENDHDR),$.copy(S,g),t=S,a=!1,S},toAsyncBuffer:function(D,C,E,g){try{a||h(),b();let _=[],S=[],$=0,k=0,B=0;i.size=0,i.offset=0;let R=function(N){if(N.length>0){let A=N.shift(),U=A.entryName+A.extra.toString();E&&E(U),A.getCompressedDataAsync(function(M){g&&g(U),A.header.offset=k;let Q=A.packLocalHeader(),P=Q.length+M.length;k+=P,_.push(Q),_.push(M);let y=A.packCentralHeader();S.push(y),i.size+=y.length,$+=P+y.length,B++,R(N)})}else{$+=i.mainHeaderSize,i.offset=k,i.totalEntries=B,k=0;let A=Buffer.alloc($);_.forEach(function(M){M.copy(A,k),k+=M.length}),S.forEach(function(M){M.copy(A,k),k+=M.length});let U=i.toBinary();o&&o.copy(U,pt.Constants.ENDHDR),U.copy(A,k),t=A,a=!1,D(A)}};R(Array.from(this.entries))}catch(_){C(_)}}}}});var q0=x((RV,M0)=>{var Ve=Qo(),Ye=require("path"),L3=Ad(),U3=L0(),Wn=(...t)=>Ve.findLast(t,e=>typeof e=="boolean"),U0=(...t)=>Ve.findLast(t,e=>typeof e=="string"),M3=(...t)=>Ve.findLast(t,e=>typeof e=="function"),q3={noSort:!1,readEntries:!1,method:Ve.Constants.NONE,fs:null};M0.exports=function(t,e){let r=null,n=Object.assign(Object.create(null),q3);t&&typeof t=="object"&&(t instanceof Uint8Array||(Object.assign(n,t),t=n.input?n.input:void 0,n.input&&delete n.input),Buffer.isBuffer(t)&&(r=t,n.method=Ve.Constants.BUFFER,t=void 0)),Object.assign(n,e);let o=new Ve(n);if((typeof n.decoder!="object"||typeof n.decoder.encode!="function"||typeof n.decoder.decode!="function")&&(n.decoder=Ve.decoder),t&&typeof t=="string")if(o.fs.existsSync(t))n.method=Ve.Constants.FILE,n.filename=t,r=o.fs.readFileSync(t);else throw Ve.Errors.INVALID_FILENAME();let i=new U3(r,n),{canonical:a,sanitize:s,zipnamefix:u}=Ve;function c(h){if(h&&i){var m;if(typeof h=="string"&&(m=i.getEntry(Ye.posix.normalize(h))),typeof h=="object"&&typeof h.entryName<"u"&&typeof h.header<"u"&&(m=i.getEntry(h.entryName)),m)return m}return null}function l(h){let{join:m,normalize:b,sep:D}=Ye.posix;return m(".",b(D+h.split("\\").join(D)+D))}function p(h){return h instanceof RegExp?(function(m){return function(b){return m.test(b)}})(h):typeof h!="function"?()=>!0:h}let d=(h,m)=>{let b=m.slice(-1);return b=b===o.sep?o.sep:"",Ye.relative(h,m)+b};return{readFile:function(h,m){var b=c(h);return b&&b.getData(m)||null},childCount:function(h){let m=c(h);if(m)return i.getChildCount(m)},readFileAsync:function(h,m){var b=c(h);b?b.getDataAsync(m):m(null,"getEntry failed for:"+h)},readAsText:function(h,m){var b=c(h);if(b){var D=b.getData();if(D&&D.length)return D.toString(m||"utf8")}return""},readAsTextAsync:function(h,m,b){var D=c(h);D?D.getDataAsync(function(C,E){if(E){m(C,E);return}C&&C.length?m(C.toString(b||"utf8")):m("")}):m("")},deleteFile:function(h,m=!0){var b=c(h);b&&i.deleteFile(b.entryName,m)},deleteEntry:function(h){var m=c(h);m&&i.deleteEntry(m.entryName)},addZipComment:function(h){i.comment=h},getZipComment:function(){return i.comment||""},addZipEntryComment:function(h,m){var b=c(h);b&&(b.comment=m)},getZipEntryComment:function(h){var m=c(h);return m&&m.comment||""},updateFile:function(h,m){var b=c(h);b&&b.setData(m)},addLocalFile:function(h,m,b,D){if(o.fs.existsSync(h)){m=m?l(m):"";let C=Ye.win32.basename(Ye.win32.normalize(h));m+=b||C;let E=o.fs.statSync(h),g=E.isFile()?o.fs.readFileSync(h):Buffer.alloc(0);E.isDirectory()&&(m+=o.sep),this.addFile(m,g,D,E)}else throw Ve.Errors.FILE_NOT_FOUND(h)},addLocalFileAsync:function(h,m){h=typeof h=="object"?h:{localPath:h};let b=Ye.resolve(h.localPath),{comment:D}=h,{zipPath:C,zipName:E}=h,g=this;o.fs.stat(b,function(_,S){if(_)return m(_,!1);C=C?l(C):"";let $=Ye.win32.basename(Ye.win32.normalize(b));if(C+=E||$,S.isFile())o.fs.readFile(b,function(k,B){return k?m(k,!1):(g.addFile(C,B,D,S),setImmediate(m,void 0,!0))});else if(S.isDirectory())return C+=o.sep,g.addFile(C,Buffer.alloc(0),D,S),setImmediate(m,void 0,!0)})},addLocalFolder:function(h,m,b){if(b=p(b),m=m?l(m):"",h=Ye.normalize(h),o.fs.existsSync(h)){let D=o.findFiles(h),C=this;if(D.length)for(let E of D){let g=Ye.join(m,d(h,E));b(g)&&C.addLocalFile(E,Ye.dirname(g))}}else throw Ve.Errors.FILE_NOT_FOUND(h)},addLocalFolderAsync:function(h,m,b,D){D=p(D),b=b?l(b):"",h=Ye.normalize(h);var C=this;o.fs.open(h,"r",function(E){if(E&&E.code==="ENOENT")m(void 0,Ve.Errors.FILE_NOT_FOUND(h));else if(E)m(void 0,E);else{var g=o.findFiles(h),_=-1,S=function(){if(_+=1,_<g.length){var $=g[_],k=d(h,$).split("\\").join("/");k=k.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),D(k)?o.fs.stat($,function(B,R){B&&m(void 0,B),R.isFile()?o.fs.readFile($,function(N,A){N?m(void 0,N):(C.addFile(b+k,A,"",R),S())}):(C.addFile(b+k+"/",Buffer.alloc(0),"",R),S())}):process.nextTick(()=>{S()})}else m(!0,void 0)};S()}})},addLocalFolderAsync2:function(h,m){let b=this;h=typeof h=="object"?h:{localPath:h},localPath=Ye.resolve(l(h.localPath));let{zipPath:D,filter:C,namefix:E}=h;C instanceof RegExp?C=(function(S){return function($){return S.test($)}})(C):typeof C!="function"&&(C=function(){return!0}),D=D?l(D):"",E=="latin1"&&(E=S=>S.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,"")),typeof E!="function"&&(E=S=>S);let g=S=>Ye.join(D,E(d(localPath,S))),_=S=>Ye.win32.basename(Ye.win32.normalize(E(S)));o.fs.open(localPath,"r",function(S){S&&S.code==="ENOENT"?m(void 0,Ve.Errors.FILE_NOT_FOUND(localPath)):S?m(void 0,S):o.findFilesAsync(localPath,function($,k){if($)return m($);k=k.filter(B=>C(g(B))),k.length||m(void 0,!1),setImmediate(k.reverse().reduce(function(B,R){return function(N,A){if(N||A===!1)return setImmediate(B,N,!1);b.addLocalFileAsync({localPath:R,zipPath:Ye.dirname(g(R)),zipName:_(R)},B)}},m))})})},addLocalFolderPromise:function(h,m){return new Promise((b,D)=>{this.addLocalFolderAsync2(Object.assign({localPath:h},m),(C,E)=>{C&&D(C),E&&b(this)})})},addFile:function(h,m,b,D){h=u(h);let C=c(h),E=C!=null;E||(C=new L3(n),C.entryName=h),C.comment=b||"";let g=typeof D=="object"&&D instanceof o.fs.Stats;g&&(C.header.time=D.mtime);var _=C.isDirectory?16:0;let S=C.isDirectory?16384:32768;return g?S|=4095&D.mode:typeof D=="number"?S|=4095&D:S|=C.isDirectory?493:420,_=(_|S<<16)>>>0,C.attr=_,C.setData(m),E||i.setEntry(C),C},getEntries:function(h){return i.password=h,i?i.entries:[]},getEntry:function(h){return c(h)},getEntryCount:function(){return i.getEntryCount()},forEach:function(h){return i.forEach(h)},extractEntryTo:function(h,m,b,D,C,E){D=Wn(!1,D),C=Wn(!1,C),b=Wn(!0,b),E=U0(C,E);var g=c(h);if(!g)throw Ve.Errors.NO_ENTRY();var _=a(g.entryName),S=s(m,E&&!g.isDirectory?E:b?_:Ye.basename(_));if(g.isDirectory){var $=i.getEntryChildren(g);return $.forEach(function(R){if(R.isDirectory)return;var N=R.getData();if(!N)throw Ve.Errors.CANT_EXTRACT_FILE();var A=a(R.entryName),U=s(m,b?A:Ye.basename(A));let M=C?R.header.fileAttr:void 0;o.writeFileTo(U,N,D,M)}),!0}var k=g.getData(i.password);if(!k)throw Ve.Errors.CANT_EXTRACT_FILE();if(o.fs.existsSync(S)&&!D)throw Ve.Errors.CANT_OVERRIDE();let B=C?h.header.fileAttr:void 0;return o.writeFileTo(S,k,D,B),!0},test:function(h){if(!i)return!1;for(var m in i.entries)try{if(m.isDirectory)continue;var b=i.entries[m].getData(h);if(!b)return!1}catch{return!1}return!0},extractAllTo:function(h,m,b,D){if(b=Wn(!1,b),D=U0(b,D),m=Wn(!1,m),!i)throw Ve.Errors.NO_ZIP();i.entries.forEach(function(C){var E=s(h,a(C.entryName));if(C.isDirectory){o.makeDir(E);return}var g=C.getData(D);if(!g)throw Ve.Errors.CANT_EXTRACT_FILE();let _=b?C.header.fileAttr:void 0;o.writeFileTo(E,g,m,_);try{o.fs.utimesSync(E,C.header.time,C.header.time)}catch{throw Ve.Errors.CANT_EXTRACT_FILE()}})},extractAllToAsync:function(h,m,b,D){if(D=M3(m,b,D),b=Wn(!1,b),m=Wn(!1,m),!D)return new Promise((S,$)=>{this.extractAllToAsync(h,m,b,function(k){k?$(k):S(this)})});if(!i){D(Ve.Errors.NO_ZIP());return}h=Ye.resolve(h);let C=S=>s(h,Ye.normalize(a(S.entryName))),E=(S,$)=>new Error(S+': "'+$+'"'),g=[],_=[];i.entries.forEach(S=>{S.isDirectory?g.push(S):_.push(S)});for(let S of g){let $=C(S),k=b?S.header.fileAttr:void 0;try{o.makeDir($),k&&o.fs.chmodSync($,k),o.fs.utimesSync($,S.header.time,S.header.time)}catch{D(E("Unable to create folder",$))}}_.reverse().reduce(function(S,$){return function(k){if(k)S(k);else{let B=Ye.normalize(a($.entryName)),R=s(h,B);$.getDataAsync(function(N,A){if(A)S(A);else if(!N)S(Ve.Errors.CANT_EXTRACT_FILE());else{let U=b?$.header.fileAttr:void 0;o.writeFileToAsync(R,N,m,U,function(M){M||S(E("Unable to write file",R)),o.fs.utimes(R,$.header.time,$.header.time,function(Q){Q?S(E("Unable to set times",R)):S()})})}})}}},D)()},writeZip:function(h,m){if(arguments.length===1&&typeof h=="function"&&(m=h,h=""),!h&&n.filename&&(h=n.filename),!!h){var b=i.compressToBuffer();if(b){var D=o.writeFileTo(h,b,!0);typeof m=="function"&&m(D?null:new Error("failed"),"")}}},writeZipPromise:function(h,m){let{overwrite:b,perm:D}=Object.assign({overwrite:!0},m);return new Promise((C,E)=>{!h&&n.filename&&(h=n.filename),h||E("ADM-ZIP: ZIP File Name Missing"),this.toBufferPromise().then(g=>{let _=S=>S?C(S):E("ADM-ZIP: Wasn't able to write zip file");o.writeFileToAsync(h,g,b,D,_)},E)})},toBufferPromise:function(){return new Promise((h,m)=>{i.toAsyncBuffer(h,m)})},toBuffer:function(h,m,b,D){return typeof h=="function"?(i.toAsyncBuffer(h,m,b,D),null):i.compressToBuffer()}}}});var G0=x((BV,z0)=>{var V0={};z0.exports=V0;var H0={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],grey:[90,39],brightRed:[91,39],brightGreen:[92,39],brightYellow:[93,39],brightBlue:[94,39],brightMagenta:[95,39],brightCyan:[96,39],brightWhite:[97,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgGray:[100,49],bgGrey:[100,49],bgBrightRed:[101,49],bgBrightGreen:[102,49],bgBrightYellow:[103,49],bgBrightBlue:[104,49],bgBrightMagenta:[105,49],bgBrightCyan:[106,49],bgBrightWhite:[107,49],blackBG:[40,49],redBG:[41,49],greenBG:[42,49],yellowBG:[43,49],blueBG:[44,49],magentaBG:[45,49],cyanBG:[46,49],whiteBG:[47,49]};Object.keys(H0).forEach(function(t){var e=H0[t],r=V0[t]=[];r.open="\x1B["+e[0]+"m",r.close="\x1B["+e[1]+"m"})});var K0=x((jV,W0)=>{"use strict";W0.exports=function(t,e){e=e||process.argv;var r=e.indexOf("--"),n=/^-{1,2}/.test(t)?"":"--",o=e.indexOf(n+t);return o!==-1&&(r===-1?!0:o<r)}});var J0=x((NV,Y0)=>{"use strict";var H3=require("os"),vr=K0(),Ft=process.env,ti=void 0;vr("no-color")||vr("no-colors")||vr("color=false")?ti=!1:(vr("color")||vr("colors")||vr("color=true")||vr("color=always"))&&(ti=!0);"FORCE_COLOR"in Ft&&(ti=Ft.FORCE_COLOR.length===0||parseInt(Ft.FORCE_COLOR,10)!==0);function V3(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function z3(t){if(ti===!1)return 0;if(vr("color=16m")||vr("color=full")||vr("color=truecolor"))return 3;if(vr("color=256"))return 2;if(t&&!t.isTTY&&ti!==!0)return 0;var e=ti?1:0;if(process.platform==="win32"){var r=H3.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in Ft)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(o){return o in Ft})||Ft.CI_NAME==="codeship"?1:e;if("TEAMCITY_VERSION"in Ft)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Ft.TEAMCITY_VERSION)?1:0;if("TERM_PROGRAM"in Ft){var n=parseInt((Ft.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Ft.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Ft.TERM)?2:/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(Ft.TERM)||"COLORTERM"in Ft?1:(Ft.TERM==="dumb",e)}function Od(t){var e=z3(t);return V3(e)}Y0.exports={supportsColor:Od,stdout:Od(process.stdout),stderr:Od(process.stderr)}});var Z0=x((LV,X0)=>{X0.exports=function(e,r){var n="";e=e||"Run the trap, drop the bass",e=e.split("");var o={a:["@","\u0104","\u023A","\u0245","\u0394","\u039B","\u0414"],b:["\xDF","\u0181","\u0243","\u026E","\u03B2","\u0E3F"],c:["\xA9","\u023B","\u03FE"],d:["\xD0","\u018A","\u0500","\u0501","\u0502","\u0503"],e:["\xCB","\u0115","\u018E","\u0258","\u03A3","\u03BE","\u04BC","\u0A6C"],f:["\u04FA"],g:["\u0262"],h:["\u0126","\u0195","\u04A2","\u04BA","\u04C7","\u050A"],i:["\u0F0F"],j:["\u0134"],k:["\u0138","\u04A0","\u04C3","\u051E"],l:["\u0139"],m:["\u028D","\u04CD","\u04CE","\u0520","\u0521","\u0D69"],n:["\xD1","\u014B","\u019D","\u0376","\u03A0","\u048A"],o:["\xD8","\xF5","\xF8","\u01FE","\u0298","\u047A","\u05DD","\u06DD","\u0E4F"],p:["\u01F7","\u048E"],q:["\u09CD"],r:["\xAE","\u01A6","\u0210","\u024C","\u0280","\u042F"],s:["\xA7","\u03DE","\u03DF","\u03E8"],t:["\u0141","\u0166","\u0373"],u:["\u01B1","\u054D"],v:["\u05D8"],w:["\u0428","\u0460","\u047C","\u0D70"],x:["\u04B2","\u04FE","\u04FC","\u04FD"],y:["\xA5","\u04B0","\u04CB"],z:["\u01B5","\u0240"]};return e.forEach(function(i){i=i.toLowerCase();var a=o[i]||[" "],s=Math.floor(Math.random()*a.length);typeof o[i]<"u"?n+=o[i][s]:n+=i}),n}});var eb=x((UV,Q0)=>{Q0.exports=function(e,r){e=e||" he is here ";var n={up:["\u030D","\u030E","\u0304","\u0305","\u033F","\u0311","\u0306","\u0310","\u0352","\u0357","\u0351","\u0307","\u0308","\u030A","\u0342","\u0313","\u0308","\u034A","\u034B","\u034C","\u0303","\u0302","\u030C","\u0350","\u0300","\u0301","\u030B","\u030F","\u0312","\u0313","\u0314","\u033D","\u0309","\u0363","\u0364","\u0365","\u0366","\u0367","\u0368","\u0369","\u036A","\u036B","\u036C","\u036D","\u036E","\u036F","\u033E","\u035B","\u0346","\u031A"],down:["\u0316","\u0317","\u0318","\u0319","\u031C","\u031D","\u031E","\u031F","\u0320","\u0324","\u0325","\u0326","\u0329","\u032A","\u032B","\u032C","\u032D","\u032E","\u032F","\u0330","\u0331","\u0332","\u0333","\u0339","\u033A","\u033B","\u033C","\u0345","\u0347","\u0348","\u0349","\u034D","\u034E","\u0353","\u0354","\u0355","\u0356","\u0359","\u035A","\u0323"],mid:["\u0315","\u031B","\u0300","\u0301","\u0358","\u0321","\u0322","\u0327","\u0328","\u0334","\u0335","\u0336","\u035C","\u035D","\u035E","\u035F","\u0360","\u0362","\u0338","\u0337","\u0361"," \u0489"]},o=[].concat(n.up,n.down,n.mid);function i(u){var c=Math.floor(Math.random()*u);return c}function a(u){var c=!1;return o.filter(function(l){c=l===u}),c}function s(u,c){var l="",p,d;c=c||{},c.up=typeof c.up<"u"?c.up:!0,c.mid=typeof c.mid<"u"?c.mid:!0,c.down=typeof c.down<"u"?c.down:!0,c.size=typeof c.size<"u"?c.size:"maxi",u=u.split("");for(d in u)if(!a(d)){switch(l=l+u[d],p={up:0,down:0,mid:0},c.size){case"mini":p.up=i(8),p.mid=i(2),p.down=i(8);break;case"maxi":p.up=i(16)+3,p.mid=i(4)+1,p.down=i(64)+3;break;default:p.up=i(8)+1,p.mid=i(6)/2,p.down=i(8)+1;break}var h=["up","mid","down"];for(var m in h)for(var b=h[m],D=0;D<=p[b];D++)c[b]&&(l=l+n[b][i(n[b].length)])}return l}return s(e,r)}});var rb=x((MV,tb)=>{tb.exports=function(t){return function(e,r,n){if(e===" ")return e;switch(r%3){case 0:return t.red(e);case 1:return t.white(e);case 2:return t.blue(e)}}}});var ob=x((qV,nb)=>{nb.exports=function(t){return function(e,r,n){return r%2===0?e:t.inverse(e)}}});var ab=x((HV,ib)=>{ib.exports=function(t){var e=["red","yellow","green","blue","magenta"];return function(r,n,o){return r===" "?r:t[e[n++%e.length]](r)}}});var ub=x((VV,sb)=>{sb.exports=function(t){var e=["underline","inverse","grey","yellow","red","green","blue","white","cyan","magenta","brightYellow","brightRed","brightGreen","brightBlue","brightWhite","brightCyan","brightMagenta"];return function(r,n,o){return r===" "?r:t[e[Math.round(Math.random()*(e.length-2))]](r)}}});var hb=x((GV,db)=>{var ce={};db.exports=ce;ce.themes={};var G3=require("util"),Kn=ce.styles=G0(),lb=Object.defineProperties,W3=new RegExp(/[\r\n]+/g);ce.supportsColor=J0().supportsColor;typeof ce.enabled>"u"&&(ce.enabled=ce.supportsColor()!==!1);ce.enable=function(){ce.enabled=!0};ce.disable=function(){ce.enabled=!1};ce.stripColors=ce.strip=function(t){return(""+t).replace(/\x1B\[\d+m/g,"")};var zV=ce.stylize=function(e,r){if(!ce.enabled)return e+"";var n=Kn[r];return!n&&r in ce?ce[r](e):n.open+e+n.close},K3=/[|\\{}()[\]^$+*?.]/g,Y3=function(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(K3,"\\$&")};function fb(t){var e=function r(){return X3.apply(r,arguments)};return e._styles=t,e.__proto__=J3,e}var pb=(function(){var t={};return Kn.grey=Kn.gray,Object.keys(Kn).forEach(function(e){Kn[e].closeRe=new RegExp(Y3(Kn[e].close),"g"),t[e]={get:function(){return fb(this._styles.concat(e))}}}),t})(),J3=lb(function(){},pb);function X3(){var t=Array.prototype.slice.call(arguments),e=t.map(function(a){return a!=null&&a.constructor===String?a:G3.inspect(a)}).join(" ");if(!ce.enabled||!e)return e;for(var r=e.indexOf(`
28
+ `)!=-1,n=this._styles,o=n.length;o--;){var i=Kn[n[o]];e=i.open+e.replace(i.closeRe,i.open)+i.close,r&&(e=e.replace(W3,function(a){return i.close+a+i.open}))}return e}ce.setTheme=function(t){if(typeof t=="string"){console.log("colors.setTheme now only accepts an object, not a string. If you are trying to set a theme from a file, it is now your (the caller's) responsibility to require the file. The old syntax looked like colors.setTheme(__dirname + '/../themes/generic-logging.js'); The new syntax looks like colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));");return}for(var e in t)(function(r){ce[r]=function(n){if(typeof t[r]=="object"){var o=n;for(var i in t[r])o=ce[t[r][i]](o);return o}return ce[t[r]](n)}})(e)};function Z3(){var t={};return Object.keys(pb).forEach(function(e){t[e]={get:function(){return fb([e])}}}),t}var Q3=function(e,r){var n=r.split("");return n=n.map(e),n.join("")};ce.trap=Z0();ce.zalgo=eb();ce.maps={};ce.maps.america=rb()(ce);ce.maps.zebra=ob()(ce);ce.maps.rainbow=ab()(ce);ce.maps.random=ub()(ce);for(cb in ce.maps)(function(t){ce[t]=function(e){return Q3(ce.maps[t],e)}})(cb);var cb;lb(ce,Z3())});var gb=x((WV,mb)=>{var e$=hb();mb.exports=e$});var Db=x(kd=>{"use strict";kd.indent=function(e){return new Array(e+1).join(" ")};kd.getMaxIndexLength=function(t){var e=0;return Object.getOwnPropertyNames(t).forEach(function(r){t[r]!==void 0&&(e=Math.max(e,r.length))}),e}});var yb=x((YV,t$)=>{t$.exports={author:"Rafael de Oleza <rafeca@gmail.com> (https://github.com/rafeca)",name:"prettyjson",description:"Package for formatting JSON data in a coloured YAML-style, perfect for CLI output",version:"1.2.5",homepage:"http://rafeca.com/prettyjson",keywords:["json","cli","formatting","colors"],repository:{type:"git",url:"https://github.com/rafeca/prettyjson.git"},bugs:{url:"https://github.com/rafeca/prettyjson/issues"},main:"./lib/prettyjson",files:["bin/prettyjson","lib/*.js"],license:"MIT",scripts:{test:"npm run jshint && mocha --reporter spec",testwin:"node ./node_modules/mocha/bin/mocha --reporter spec",jshint:"jshint lib/*.js test/*.js",coverage:"istanbul cover _mocha --report lcovonly -- -R spec",coveralls:"npm run coverage && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage",changelog:"git log $(git describe --tags --abbrev=0)..HEAD --pretty='* %s' --first-parent"},bin:{prettyjson:"./bin/prettyjson"},dependencies:{colors:"1.4.0",minimist:"^1.2.0"},devDependencies:{coveralls:"^2.11.15",istanbul:"^0.4.5",jshint:"^2.9.4",mocha:"^3.1.2","mocha-lcov-reporter":"^1.2.0",should:"^11.1.1"}}});var bb=x(Ia=>{"use strict";var Sr=gb(),bn=Db(),r$=/[^\w\s\n\r\v\t\.,]/i;Ia.version=yb().version;var $d=function(t,e){return t!==void 0||e.renderUndefined},Lu=function(t,e,r){return!!(typeof t=="boolean"||typeof t=="number"||typeof t=="function"||t===null||t===void 0||t instanceof Date||typeof t=="string"&&t.indexOf(`
29
+ `)===-1||r.inlineArrays&&!e&&Array.isArray(t)&&Lu(t[0],!0,r))},n$=function(t,e){if(e.noColor)return t;if(typeof t=="string")return e.stringColor?Sr[e.stringColor](t):t;var r=t+"";return t===!0?Sr.green(r):t===!1?Sr.red(r):t==null?Sr.grey(r):typeof t=="number"?t>=0?Sr[e.positiveNumberColor](r):Sr[e.negativeNumberColor](r):typeof t=="function"?"function() {}":Array.isArray(t)?t.join(", "):r},Pd=function(t,e){return t.multilineStringColor===null||t.noColor?e:Sr[t.multilineStringColor](e)},o$=function(t,e,r){var n=t.split(`
30
+ `);return n=n.map(function(o){return bn.indent(e)+Pd(r,o)}),n.join(`
31
+ `)},ri=function(t,e,r){if(typeof t=="string"&&t.match(r$)&&e.escape&&(t=JSON.stringify(t)),!$d(t,e))return[];if(Lu(t,!1,e))return[bn.indent(r)+n$(t,e)];if(typeof t=="string")return[bn.indent(r)+Pd(e,'"""'),o$(t,r+e.defaultIndentation,e),bn.indent(r)+Pd(e,'"""')];if(Array.isArray(t)){if(t.length===0)return[bn.indent(r)+e.emptyArrayMsg];var n=[];return t.forEach(function(s){if($d(s,e)){var u="- ";e.noColor||(u=Sr[e.dashColor](u)),u=bn.indent(r)+u,Lu(s,!1,e)?(u+=ri(s,e,0)[0],n.push(u)):(n.push(u),n.push.apply(n,ri(s,e,r+e.defaultIndentation)))}}),n}if(t instanceof Error)return ri({message:t.message,stack:t.stack.split(`
32
+ `)},e,r);var o=e.noAlign?0:bn.getMaxIndexLength(t),i,a=[];return Object.getOwnPropertyNames(t).forEach(function(s){if($d(t[s],e))if(i=s+": ",e.noColor||(i=Sr[e.keysColor](i)),i=bn.indent(r)+i,Lu(t[s],!1,e)){var u=e.noAlign?0:o-s.length;i+=ri(t[s],e,u)[0],a.push(i)}else a.push(i),a.push.apply(a,ri(t[s],e,r+e.defaultIndentation))}),a};Ia.render=function(e,r,n){return n=n||0,r=r||{},r.emptyArrayMsg=r.emptyArrayMsg||"(empty array)",r.keysColor=r.keysColor||"green",r.dashColor=r.dashColor||"green",r.numberColor=r.numberColor||"blue",r.positiveNumberColor=r.positiveNumberColor||r.numberColor,r.negativeNumberColor=r.negativeNumberColor||r.numberColor,r.defaultIndentation=r.defaultIndentation||2,r.noColor=!!r.noColor,r.noAlign=!!r.noAlign,r.escape=!!r.escape,r.renderUndefined=!!r.renderUndefined,r.stringColor=r.stringColor||null,r.multilineStringColor=r.multilineStringColor||null,ri(e,r,n).join(`
33
+ `)};Ia.renderString=function(e,r,n){var o="",i;if(typeof e!="string"||e==="")return"";if(e[0]!=="{"&&e[0]!=="["){var a;e.indexOf("{")===-1?a=e.indexOf("["):e.indexOf("[")===-1||e.indexOf("{")<e.indexOf("[")?a=e.indexOf("{"):a=e.indexOf("["),o+=e.substr(0,a)+`
34
+ `,e=e.substr(a)}try{i=JSON.parse(e)}catch{return Sr.red("Error:")+" Not valid JSON!"}return o+=Ia.render(i,r,n),o}});var Rd=x(Uu=>{"use strict";Object.defineProperty(Uu,"__esModule",{value:!0});Uu.default=void 0;function ni(t){"@babel/helpers - typeof";return ni=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ni(t)}function wb(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,a$(n.key),n)}}function i$(t,e,r){return e&&wb(t.prototype,e),r&&wb(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function a$(t){var e=s$(t,"string");return ni(e)=="symbol"?e:e+""}function s$(t,e){if(ni(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ni(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function u$(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function c$(t,e,r){return e=Ba(e),l$(t,Id()?Reflect.construct(e,r||[],Ba(t).constructor):e.apply(t,r))}function l$(t,e){if(e&&(ni(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return f$(t)}function f$(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function p$(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ra(t,e)}function Td(t){var e=typeof Map=="function"?new Map:void 0;return Td=function(n){if(n===null||!h$(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(n))return e.get(n);e.set(n,o)}function o(){return d$(n,arguments,Ba(this).constructor)}return o.prototype=Object.create(n.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),Ra(o,n)},Td(t)}function d$(t,e,r){if(Id())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var o=new(t.bind.apply(t,n));return r&&Ra(o,r.prototype),o}function Id(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Id=function(){return!!t})()}function h$(t){try{return Function.toString.call(t).indexOf("[native code]")!==-1}catch{return typeof t=="function"}}function Ra(t,e){return Ra=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Ra(t,e)}function Ba(t){return Ba=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Ba(t)}var m$=(function(t){function e(r){var n,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;if(u$(this,e),n=c$(this,e,[r]),n.originalRequest=i,n.originalResponse=a,n.causingError=o,o!=null&&(r+=", caused by ".concat(o.toString())),i!=null){var s=i.getHeader("X-Request-ID")||"n/a",u=i.getMethod(),c=i.getURL(),l=a?a.getStatus():"n/a",p=a?a.getBody()||"":"n/a";r+=", originated from request (method: ".concat(u,", url: ").concat(c,", response code: ").concat(l,", response text: ").concat(p,", request id: ").concat(s,")")}return n.message=r,n}return p$(e,t),i$(e)})(Td(Error)),XV=Uu.default=m$});var Bd=x(Mu=>{"use strict";Object.defineProperty(Mu,"__esModule",{value:!0});Mu.enableDebugLog=g$;Mu.log=D$;var vb=!1;function g$(){vb=!0}function D$(t){vb&&console.log(t)}});var Eb=x(qu=>{"use strict";Object.defineProperty(qu,"__esModule",{value:!0});qu.default=void 0;function ja(t){"@babel/helpers - typeof";return ja=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ja(t)}function y$(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Cb(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,w$(n.key),n)}}function b$(t,e,r){return e&&Cb(t.prototype,e),r&&Cb(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function w$(t){var e=v$(t,"string");return ja(e)=="symbol"?e:e+""}function v$(t,e){if(ja(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ja(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var ez=qu.default=(function(){function t(){y$(this,t)}return b$(t,[{key:"listAllUploads",value:function(){return Promise.resolve([])}},{key:"findUploadsByFingerprint",value:function(r){return Promise.resolve([])}},{key:"removeUpload",value:function(r){return Promise.resolve()}},{key:"addUpload",value:function(r,n){return Promise.resolve(null)}}])})()});var _b=x((jd,Nd)=>{(function(t,e){typeof jd=="object"&&typeof Nd<"u"?Nd.exports=e():typeof define=="function"&&define.amd?define(e):(function(){var r=t.Base64,n=e();n.noConflict=function(){return t.Base64=r,n},t.Meteor&&(Base64=n),t.Base64=n})()})(typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:jd,function(){"use strict";var t="3.7.8",e=t,r=typeof Buffer=="function",n=typeof TextDecoder=="function"?new TextDecoder:void 0,o=typeof TextEncoder=="function"?new TextEncoder:void 0,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=Array.prototype.slice.call(i),s=(function(T){var j={};return T.forEach(function(ee,V){return j[ee]=V}),j})(a),u=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,c=String.fromCharCode.bind(String),l=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):function(T){return new Uint8Array(Array.prototype.slice.call(T,0))},p=function(T){return T.replace(/=/g,"").replace(/[+\/]/g,function(j){return j=="+"?"-":"_"})},d=function(T){return T.replace(/[^A-Za-z0-9\+\/]/g,"")},h=function(T){for(var j,ee,V,se,dr="",G=T.length%3,Ee=0;Ee<T.length;){if((ee=T.charCodeAt(Ee++))>255||(V=T.charCodeAt(Ee++))>255||(se=T.charCodeAt(Ee++))>255)throw new TypeError("invalid character found");j=ee<<16|V<<8|se,dr+=a[j>>18&63]+a[j>>12&63]+a[j>>6&63]+a[j&63]}return G?dr.slice(0,G-3)+"===".substring(G):dr},m=typeof btoa=="function"?function(T){return btoa(T)}:r?function(T){return Buffer.from(T,"binary").toString("base64")}:h,b=r?function(T){return Buffer.from(T).toString("base64")}:function(T){for(var j=4096,ee=[],V=0,se=T.length;V<se;V+=j)ee.push(c.apply(null,T.subarray(V,V+j)));return m(ee.join(""))},D=function(T,j){return j===void 0&&(j=!1),j?p(b(T)):b(T)},C=function(T){if(T.length<2){var j=T.charCodeAt(0);return j<128?T:j<2048?c(192|j>>>6)+c(128|j&63):c(224|j>>>12&15)+c(128|j>>>6&63)+c(128|j&63)}else{var j=65536+(T.charCodeAt(0)-55296)*1024+(T.charCodeAt(1)-56320);return c(240|j>>>18&7)+c(128|j>>>12&63)+c(128|j>>>6&63)+c(128|j&63)}},E=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,g=function(T){return T.replace(E,C)},_=r?function(T){return Buffer.from(T,"utf8").toString("base64")}:o?function(T){return b(o.encode(T))}:function(T){return m(g(T))},S=function(T,j){return j===void 0&&(j=!1),j?p(_(T)):_(T)},$=function(T){return S(T,!0)},k=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,B=function(T){switch(T.length){case 4:var j=(7&T.charCodeAt(0))<<18|(63&T.charCodeAt(1))<<12|(63&T.charCodeAt(2))<<6|63&T.charCodeAt(3),ee=j-65536;return c((ee>>>10)+55296)+c((ee&1023)+56320);case 3:return c((15&T.charCodeAt(0))<<12|(63&T.charCodeAt(1))<<6|63&T.charCodeAt(2));default:return c((31&T.charCodeAt(0))<<6|63&T.charCodeAt(1))}},R=function(T){return T.replace(k,B)},N=function(T){if(T=T.replace(/\s+/g,""),!u.test(T))throw new TypeError("malformed base64.");T+="==".slice(2-(T.length&3));for(var j,ee,V,se=[],dr=0;dr<T.length;)j=s[T.charAt(dr++)]<<18|s[T.charAt(dr++)]<<12|(ee=s[T.charAt(dr++)])<<6|(V=s[T.charAt(dr++)]),ee===64?se.push(c(j>>16&255)):V===64?se.push(c(j>>16&255,j>>8&255)):se.push(c(j>>16&255,j>>8&255,j&255));return se.join("")},A=typeof atob=="function"?function(T){return atob(d(T))}:r?function(T){return Buffer.from(T,"base64").toString("binary")}:N,U=r?function(T){return l(Buffer.from(T,"base64"))}:function(T){return l(A(T).split("").map(function(j){return j.charCodeAt(0)}))},M=function(T){return U(P(T))},Q=r?function(T){return Buffer.from(T,"base64").toString("utf8")}:n?function(T){return n.decode(U(T))}:function(T){return R(A(T))},P=function(T){return d(T.replace(/[-_]/g,function(j){return j=="-"?"+":"/"}))},y=function(T){return Q(P(T))},w=function(T){if(typeof T!="string")return!1;var j=T.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(j)||!/[^\s0-9a-zA-Z\-_]/.test(j)},v=function(T){return{value:T,enumerable:!1,writable:!0,configurable:!0}},F=function(){var T=function(j,ee){return Object.defineProperty(String.prototype,j,v(ee))};T("fromBase64",function(){return y(this)}),T("toBase64",function(j){return S(this,j)}),T("toBase64URI",function(){return S(this,!0)}),T("toBase64URL",function(){return S(this,!0)}),T("toUint8Array",function(){return M(this)})},I=function(){var T=function(j,ee){return Object.defineProperty(Uint8Array.prototype,j,v(ee))};T("toBase64",function(j){return D(this,j)}),T("toBase64URI",function(){return D(this,!0)}),T("toBase64URL",function(){return D(this,!0)})},O=function(){F(),I()},q={version:t,VERSION:e,atob:A,atobPolyfill:N,btoa:m,btoaPolyfill:h,fromBase64:y,toBase64:S,encode:S,encodeURI:$,encodeURL:$,utob:g,btou:R,decode:y,isValid:w,fromUint8Array:D,toUint8Array:M,extendString:F,extendUint8Array:I,extendBuiltins:O};return q.Base64={},Object.keys(q).forEach(function(T){return q.Base64[T]=q[T]}),q})});var Sb=x((rz,xb)=>{"use strict";xb.exports=function(e,r){if(r=r.split(":")[0],e=+e,!e)return!1;switch(r){case"http":case"ws":return e!==80;case"https":case"wss":return e!==443;case"ftp":return e!==21;case"gopher":return e!==70;case"file":return!1}return e!==0}});var Ob=x(Ld=>{"use strict";var C$=Object.prototype.hasOwnProperty,E$;function Fb(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch{return null}}function Ab(t){try{return encodeURIComponent(t)}catch{return null}}function _$(t){for(var e=/([^=?#&]+)=?([^&]*)/g,r={},n;n=e.exec(t);){var o=Fb(n[1]),i=Fb(n[2]);o===null||i===null||o in r||(r[o]=i)}return r}function x$(t,e){e=e||"";var r=[],n,o;typeof e!="string"&&(e="?");for(o in t)if(C$.call(t,o)){if(n=t[o],!n&&(n===null||n===E$||isNaN(n))&&(n=""),o=Ab(o),n=Ab(n),o===null||n===null)continue;r.push(o+"="+n)}return r.length?e+r.join("&"):""}Ld.stringify=x$;Ld.parse=_$});var jb=x((oz,Bb)=>{"use strict";var $b=Sb(),Hu=Ob(),S$=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,Pb=/[\n\r\t]/g,F$=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,Tb=/:\d+$/,A$=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,O$=/^[a-zA-Z]:/;function Md(t){return(t||"").toString().replace(S$,"")}var Ud=[["#","hash"],["?","query"],function(e,r){return Fr(r.protocol)?e.replace(/\\/g,"/"):e},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],kb={hash:1,query:1};function Ib(t){var e;typeof window<"u"?e=window:typeof global<"u"?e=global:typeof self<"u"?e=self:e={};var r=e.location||{};t=t||r;var n={},o=typeof t,i;if(t.protocol==="blob:")n=new Ar(unescape(t.pathname),{});else if(o==="string"){n=new Ar(t,{});for(i in kb)delete n[i]}else if(o==="object"){for(i in t)i in kb||(n[i]=t[i]);n.slashes===void 0&&(n.slashes=F$.test(t.href))}return n}function Fr(t){return t==="file:"||t==="ftp:"||t==="http:"||t==="https:"||t==="ws:"||t==="wss:"}function Rb(t,e){t=Md(t),t=t.replace(Pb,""),e=e||{};var r=A$.exec(t),n=r[1]?r[1].toLowerCase():"",o=!!r[2],i=!!r[3],a=0,s;return o?i?(s=r[2]+r[3]+r[4],a=r[2].length+r[3].length):(s=r[2]+r[4],a=r[2].length):i?(s=r[3]+r[4],a=r[3].length):s=r[4],n==="file:"?a>=2&&(s=s.slice(2)):Fr(n)?s=r[4]:n?o&&(s=s.slice(2)):a>=2&&Fr(e.protocol)&&(s=r[4]),{protocol:n,slashes:o||Fr(n),slashesCount:a,rest:s}}function k$(t,e){if(t==="")return e;for(var r=(e||"/").split("/").slice(0,-1).concat(t.split("/")),n=r.length,o=r[n-1],i=!1,a=0;n--;)r[n]==="."?r.splice(n,1):r[n]===".."?(r.splice(n,1),a++):a&&(n===0&&(i=!0),r.splice(n,1),a--);return i&&r.unshift(""),(o==="."||o==="..")&&r.push(""),r.join("/")}function Ar(t,e,r){if(t=Md(t),t=t.replace(Pb,""),!(this instanceof Ar))return new Ar(t,e,r);var n,o,i,a,s,u,c=Ud.slice(),l=typeof e,p=this,d=0;for(l!=="object"&&l!=="string"&&(r=e,e=null),r&&typeof r!="function"&&(r=Hu.parse),e=Ib(e),o=Rb(t||"",e),n=!o.protocol&&!o.slashes,p.slashes=o.slashes||n&&e.slashes,p.protocol=o.protocol||e.protocol||"",t=o.rest,(o.protocol==="file:"&&(o.slashesCount!==2||O$.test(t))||!o.slashes&&(o.protocol||o.slashesCount<2||!Fr(p.protocol)))&&(c[3]=[/(.*)/,"pathname"]);d<c.length;d++){if(a=c[d],typeof a=="function"){t=a(t,p);continue}i=a[0],u=a[1],i!==i?p[u]=t:typeof i=="string"?(s=i==="@"?t.lastIndexOf(i):t.indexOf(i),~s&&(typeof a[2]=="number"?(p[u]=t.slice(0,s),t=t.slice(s+a[2])):(p[u]=t.slice(s),t=t.slice(0,s)))):(s=i.exec(t))&&(p[u]=s[1],t=t.slice(0,s.index)),p[u]=p[u]||n&&a[3]&&e[u]||"",a[4]&&(p[u]=p[u].toLowerCase())}r&&(p.query=r(p.query)),n&&e.slashes&&p.pathname.charAt(0)!=="/"&&(p.pathname!==""||e.pathname!=="")&&(p.pathname=k$(p.pathname,e.pathname)),p.pathname.charAt(0)!=="/"&&Fr(p.protocol)&&(p.pathname="/"+p.pathname),$b(p.port,p.protocol)||(p.host=p.hostname,p.port=""),p.username=p.password="",p.auth&&(s=p.auth.indexOf(":"),~s?(p.username=p.auth.slice(0,s),p.username=encodeURIComponent(decodeURIComponent(p.username)),p.password=p.auth.slice(s+1),p.password=encodeURIComponent(decodeURIComponent(p.password))):p.username=encodeURIComponent(decodeURIComponent(p.auth)),p.auth=p.password?p.username+":"+p.password:p.username),p.origin=p.protocol!=="file:"&&Fr(p.protocol)&&p.host?p.protocol+"//"+p.host:"null",p.href=p.toString()}function $$(t,e,r){var n=this;switch(t){case"query":typeof e=="string"&&e.length&&(e=(r||Hu.parse)(e)),n[t]=e;break;case"port":n[t]=e,$b(e,n.protocol)?e&&(n.host=n.hostname+":"+e):(n.host=n.hostname,n[t]="");break;case"hostname":n[t]=e,n.port&&(e+=":"+n.port),n.host=e;break;case"host":n[t]=e,Tb.test(e)?(e=e.split(":"),n.port=e.pop(),n.hostname=e.join(":")):(n.hostname=e,n.port="");break;case"protocol":n.protocol=e.toLowerCase(),n.slashes=!r;break;case"pathname":case"hash":if(e){var o=t==="pathname"?"/":"#";n[t]=e.charAt(0)!==o?o+e:e}else n[t]=e;break;case"username":case"password":n[t]=encodeURIComponent(e);break;case"auth":var i=e.indexOf(":");~i?(n.username=e.slice(0,i),n.username=encodeURIComponent(decodeURIComponent(n.username)),n.password=e.slice(i+1),n.password=encodeURIComponent(decodeURIComponent(n.password))):n.username=encodeURIComponent(decodeURIComponent(e))}for(var a=0;a<Ud.length;a++){var s=Ud[a];s[4]&&(n[s[1]]=n[s[1]].toLowerCase())}return n.auth=n.password?n.username+":"+n.password:n.username,n.origin=n.protocol!=="file:"&&Fr(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function P$(t){(!t||typeof t!="function")&&(t=Hu.stringify);var e,r=this,n=r.host,o=r.protocol;o&&o.charAt(o.length-1)!==":"&&(o+=":");var i=o+(r.protocol&&r.slashes||Fr(r.protocol)?"//":"");return r.username?(i+=r.username,r.password&&(i+=":"+r.password),i+="@"):r.password?(i+=":"+r.password,i+="@"):r.protocol!=="file:"&&Fr(r.protocol)&&!n&&r.pathname!=="/"&&(i+="@"),(n[n.length-1]===":"||Tb.test(r.hostname)&&!r.port)&&(n+=":"),i+=n+r.pathname,e=typeof r.query=="object"?t(r.query):r.query,e&&(i+=e.charAt(0)!=="?"?"?"+e:e),r.hash&&(i+=r.hash),i}Ar.prototype={set:$$,toString:P$};Ar.extractProtocol=Rb;Ar.location=Ib;Ar.trimLeft=Md;Ar.qs=Hu;Bb.exports=Ar});var Nb=x(qd=>{"use strict";Object.defineProperty(qd,"__esModule",{value:!0});qd.default=T$;function T$(){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)})}});var Qb=x(Wu=>{"use strict";Object.defineProperty(Wu,"__esModule",{value:!0});Wu.default=void 0;var I$=_b(),R$=zd(jb()),Vu=zd(Rd()),Yn=Bd(),B$=zd(Nb());function zd(t){return t&&t.__esModule?t:{default:t}}function Hd(){"use strict";Hd=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(y,w,v){y[w]=v.value},i=typeof Symbol=="function"?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(y,w,v){return Object.defineProperty(y,w,{value:v,enumerable:!0,configurable:!0,writable:!0}),y[w]}try{c({},"")}catch{c=function(v,F,I){return v[F]=I}}function l(y,w,v,F){var I=w&&w.prototype instanceof C?w:C,O=Object.create(I.prototype),q=new Q(F||[]);return o(O,"_invoke",{value:N(y,v,q)}),O}function p(y,w,v){try{return{type:"normal",arg:y.call(w,v)}}catch(F){return{type:"throw",arg:F}}}e.wrap=l;var d="suspendedStart",h="suspendedYield",m="executing",b="completed",D={};function C(){}function E(){}function g(){}var _={};c(_,a,function(){return this});var S=Object.getPrototypeOf,$=S&&S(S(P([])));$&&$!==r&&n.call($,a)&&(_=$);var k=g.prototype=C.prototype=Object.create(_);function B(y){["next","throw","return"].forEach(function(w){c(y,w,function(v){return this._invoke(w,v)})})}function R(y,w){function v(I,O,q,T){var j=p(y[I],y,O);if(j.type!=="throw"){var ee=j.arg,V=ee.value;return V&&Jn(V)=="object"&&n.call(V,"__await")?w.resolve(V.__await).then(function(se){v("next",se,q,T)},function(se){v("throw",se,q,T)}):w.resolve(V).then(function(se){ee.value=se,q(ee)},function(se){return v("throw",se,q,T)})}T(j.arg)}var F;o(this,"_invoke",{value:function(O,q){function T(){return new w(function(j,ee){v(O,q,j,ee)})}return F=F?F.then(T,T):T()}})}function N(y,w,v){var F=d;return function(I,O){if(F===m)throw Error("Generator is already running");if(F===b){if(I==="throw")throw O;return{value:t,done:!0}}for(v.method=I,v.arg=O;;){var q=v.delegate;if(q){var T=A(q,v);if(T){if(T===D)continue;return T}}if(v.method==="next")v.sent=v._sent=v.arg;else if(v.method==="throw"){if(F===d)throw F=b,v.arg;v.dispatchException(v.arg)}else v.method==="return"&&v.abrupt("return",v.arg);F=m;var j=p(y,w,v);if(j.type==="normal"){if(F=v.done?b:h,j.arg===D)continue;return{value:j.arg,done:v.done}}j.type==="throw"&&(F=b,v.method="throw",v.arg=j.arg)}}}function A(y,w){var v=w.method,F=y.iterator[v];if(F===t)return w.delegate=null,v==="throw"&&y.iterator.return&&(w.method="return",w.arg=t,A(y,w),w.method==="throw")||v!=="return"&&(w.method="throw",w.arg=new TypeError("The iterator does not provide a '"+v+"' method")),D;var I=p(F,y.iterator,w.arg);if(I.type==="throw")return w.method="throw",w.arg=I.arg,w.delegate=null,D;var O=I.arg;return O?O.done?(w[y.resultName]=O.value,w.next=y.nextLoc,w.method!=="return"&&(w.method="next",w.arg=t),w.delegate=null,D):O:(w.method="throw",w.arg=new TypeError("iterator result is not an object"),w.delegate=null,D)}function U(y){var w={tryLoc:y[0]};1 in y&&(w.catchLoc=y[1]),2 in y&&(w.finallyLoc=y[2],w.afterLoc=y[3]),this.tryEntries.push(w)}function M(y){var w=y.completion||{};w.type="normal",delete w.arg,y.completion=w}function Q(y){this.tryEntries=[{tryLoc:"root"}],y.forEach(U,this),this.reset(!0)}function P(y){if(y||y===""){var w=y[a];if(w)return w.call(y);if(typeof y.next=="function")return y;if(!isNaN(y.length)){var v=-1,F=function I(){for(;++v<y.length;)if(n.call(y,v))return I.value=y[v],I.done=!1,I;return I.value=t,I.done=!0,I};return F.next=F}}throw new TypeError(Jn(y)+" is not iterable")}return E.prototype=g,o(k,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:E,configurable:!0}),E.displayName=c(g,u,"GeneratorFunction"),e.isGeneratorFunction=function(y){var w=typeof y=="function"&&y.constructor;return!!w&&(w===E||(w.displayName||w.name)==="GeneratorFunction")},e.mark=function(y){return Object.setPrototypeOf?Object.setPrototypeOf(y,g):(y.__proto__=g,c(y,u,"GeneratorFunction")),y.prototype=Object.create(k),y},e.awrap=function(y){return{__await:y}},B(R.prototype),c(R.prototype,s,function(){return this}),e.AsyncIterator=R,e.async=function(y,w,v,F,I){I===void 0&&(I=Promise);var O=new R(l(y,w,v,F),I);return e.isGeneratorFunction(w)?O:O.next().then(function(q){return q.done?q.value:O.next()})},B(k),c(k,u,"Generator"),c(k,a,function(){return this}),c(k,"toString",function(){return"[object Generator]"}),e.keys=function(y){var w=Object(y),v=[];for(var F in w)v.push(F);return v.reverse(),function I(){for(;v.length;){var O=v.pop();if(O in w)return I.value=O,I.done=!1,I}return I.done=!0,I}},e.values=P,Q.prototype={constructor:Q,reset:function(w){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(M),!w)for(var v in this)v.charAt(0)==="t"&&n.call(this,v)&&!isNaN(+v.slice(1))&&(this[v]=t)},stop:function(){this.done=!0;var w=this.tryEntries[0].completion;if(w.type==="throw")throw w.arg;return this.rval},dispatchException:function(w){if(this.done)throw w;var v=this;function F(ee,V){return q.type="throw",q.arg=w,v.next=ee,V&&(v.method="next",v.arg=t),!!V}for(var I=this.tryEntries.length-1;I>=0;--I){var O=this.tryEntries[I],q=O.completion;if(O.tryLoc==="root")return F("end");if(O.tryLoc<=this.prev){var T=n.call(O,"catchLoc"),j=n.call(O,"finallyLoc");if(T&&j){if(this.prev<O.catchLoc)return F(O.catchLoc,!0);if(this.prev<O.finallyLoc)return F(O.finallyLoc)}else if(T){if(this.prev<O.catchLoc)return F(O.catchLoc,!0)}else{if(!j)throw Error("try statement without catch or finally");if(this.prev<O.finallyLoc)return F(O.finallyLoc)}}}},abrupt:function(w,v){for(var F=this.tryEntries.length-1;F>=0;--F){var I=this.tryEntries[F];if(I.tryLoc<=this.prev&&n.call(I,"finallyLoc")&&this.prev<I.finallyLoc){var O=I;break}}O&&(w==="break"||w==="continue")&&O.tryLoc<=v&&v<=O.finallyLoc&&(O=null);var q=O?O.completion:{};return q.type=w,q.arg=v,O?(this.method="next",this.next=O.finallyLoc,D):this.complete(q)},complete:function(w,v){if(w.type==="throw")throw w.arg;return w.type==="break"||w.type==="continue"?this.next=w.arg:w.type==="return"?(this.rval=this.arg=w.arg,this.method="return",this.next="end"):w.type==="normal"&&v&&(this.next=v),D},finish:function(w){for(var v=this.tryEntries.length-1;v>=0;--v){var F=this.tryEntries[v];if(F.finallyLoc===w)return this.complete(F.completion,F.afterLoc),M(F),D}},catch:function(w){for(var v=this.tryEntries.length-1;v>=0;--v){var F=this.tryEntries[v];if(F.tryLoc===w){var I=F.completion;if(I.type==="throw"){var O=I.arg;M(F)}return O}}throw Error("illegal catch attempt")},delegateYield:function(w,v,F){return this.delegate={iterator:P(w),resultName:v,nextLoc:F},this.method==="next"&&(this.arg=t),D}},e}function Lb(t,e,r,n,o,i,a){try{var s=t[i](a),u=s.value}catch(c){r(c);return}s.done?e(u):Promise.resolve(u).then(n,o)}function j$(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(u){Lb(i,n,o,a,s,"next",u)}function s(u){Lb(i,n,o,a,s,"throw",u)}a(void 0)})}}function Kb(t,e){return U$(t)||L$(t,e)||Yb(t,e)||N$()}function N$(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
35
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function L$(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,o,i,a,s=[],u=!0,c=!1;try{if(i=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(s.push(n.value),s.length!==e);u=!0);}catch(l){c=!0,o=l}finally{try{if(!u&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}function U$(t){if(Array.isArray(t))return t}function Jn(t){"@babel/helpers - typeof";return Jn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Jn(t)}function M$(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Yb(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(c){throw c},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
36
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,a=!1,s;return{s:function(){r=r.call(t)},n:function(){var c=r.next();return i=c.done,c},e:function(c){a=!0,s=c},f:function(){try{!i&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function Yb(t,e){if(t){if(typeof t=="string")return Ub(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ub(t,e)}}function Ub(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Mb(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r.push.apply(r,n)}return r}function oi(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Mb(Object(r),!0).forEach(function(n){q$(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Mb(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function q$(t,e,r){return e=Jb(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function H$(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function qb(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Jb(n.key),n)}}function V$(t,e,r){return e&&qb(t.prototype,e),r&&qb(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Jb(t){var e=z$(t,"string");return Jn(e)=="symbol"?e:e+""}function z$(t,e){if(Jn(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Jn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var zu="tus-v1",Gu="ietf-draft-03",Na="ietf-draft-05",G$={endpoint:null,uploadUrl:null,metadata:{},metadataForPartialUploads:{},fingerprint:null,uploadSize:null,onProgress:null,onChunkComplete:null,onSuccess:null,onError:null,onUploadUrlAvailable:null,overridePatchMethod:!1,headers:{},addRequestId:!1,onBeforeRequest:null,onAfterResponse:null,onShouldRetry:Zb,chunkSize:Number.POSITIVE_INFINITY,retryDelays:[0,1e3,3e3,5e3],parallelUploads:1,parallelUploadBoundaries:null,storeFingerprintForResuming:!0,removeFingerprintOnSuccess:!1,uploadLengthDeferred:!1,uploadDataDuringCreation:!1,urlStorage:null,fileReader:null,httpStack:null,protocol:zu},Xb=(function(){function t(e,r){H$(this,t),"resume"in r&&console.log("tus: The `resume` option has been removed in tus-js-client v2. Please use the URL storage API instead."),this.options=r,this.options.chunkSize=Number(this.options.chunkSize),this._urlStorage=this.options.urlStorage,this.file=e,this.url=null,this._req=null,this._fingerprint=null,this._urlStorageKey=null,this._offset=null,this._aborted=!1,this._size=null,this._source=null,this._retryAttempt=0,this._retryTimeout=null,this._offsetBeforeRetry=0,this._parallelUploads=null,this._parallelUploadUrls=null}return V$(t,[{key:"findPreviousUploads",value:function(){var r=this;return this.options.fingerprint(this.file,this.options).then(function(n){return r._urlStorage.findUploadsByFingerprint(n)})}},{key:"resumeFromPreviousUpload",value:function(r){this.url=r.uploadUrl||null,this._parallelUploadUrls=r.parallelUploadUrls||null,this._urlStorageKey=r.urlStorageKey}},{key:"start",value:function(){var r=this,n=this.file;if(!n){this._emitError(new Error("tus: no file or stream to upload provided"));return}if(![zu,Gu,Na].includes(this.options.protocol)){this._emitError(new Error("tus: unsupported protocol ".concat(this.options.protocol)));return}if(!this.options.endpoint&&!this.options.uploadUrl&&!this.url){this._emitError(new Error("tus: neither an endpoint or an upload URL is provided"));return}var o=this.options.retryDelays;if(o!=null&&Object.prototype.toString.call(o)!=="[object Array]"){this._emitError(new Error("tus: the `retryDelays` option must either be an array or null"));return}if(this.options.parallelUploads>1)for(var i=0,a=["uploadUrl","uploadSize","uploadLengthDeferred"];i<a.length;i++){var s=a[i];if(this.options[s]){this._emitError(new Error("tus: cannot use the ".concat(s," option when parallelUploads is enabled")));return}}if(this.options.parallelUploadBoundaries){if(this.options.parallelUploads<=1){this._emitError(new Error("tus: cannot use the `parallelUploadBoundaries` option when `parallelUploads` is disabled"));return}if(this.options.parallelUploads!==this.options.parallelUploadBoundaries.length){this._emitError(new Error("tus: the `parallelUploadBoundaries` must have the same length as the value of `parallelUploads`"));return}}this.options.fingerprint(n,this.options).then(function(u){return u==null?(0,Yn.log)("No fingerprint was calculated meaning that the upload cannot be stored in the URL storage."):(0,Yn.log)("Calculated fingerprint: ".concat(u)),r._fingerprint=u,r._source?r._source:r.options.fileReader.openFile(n,r.options.chunkSize)}).then(function(u){if(r._source=u,r.options.uploadLengthDeferred)r._size=null;else if(r.options.uploadSize!=null){if(r._size=Number(r.options.uploadSize),Number.isNaN(r._size)){r._emitError(new Error("tus: cannot convert `uploadSize` option into a number"));return}}else if(r._size=r._source.size,r._size==null){r._emitError(new Error("tus: cannot automatically derive upload's size from input. Specify it manually using the `uploadSize` option or use the `uploadLengthDeferred` option"));return}r.options.parallelUploads>1||r._parallelUploadUrls!=null?r._startParallelUpload():r._startSingleUpload()}).catch(function(u){r._emitError(u)})}},{key:"_startParallelUpload",value:function(){var r,n=this,o=this._size,i=0;this._parallelUploads=[];var a=this._parallelUploadUrls!=null?this._parallelUploadUrls.length:this.options.parallelUploads,s=(r=this.options.parallelUploadBoundaries)!==null&&r!==void 0?r:K$(this._source.size,a);this._parallelUploadUrls&&s.forEach(function(l,p){l.uploadUrl=n._parallelUploadUrls[p]||null}),this._parallelUploadUrls=new Array(s.length);var u=s.map(function(l,p){var d=0;return n._source.slice(l.start,l.end).then(function(h){var m=h.value;return new Promise(function(b,D){var C=oi(oi({},n.options),{},{uploadUrl:l.uploadUrl||null,storeFingerprintForResuming:!1,removeFingerprintOnSuccess:!1,parallelUploads:1,parallelUploadBoundaries:null,metadata:n.options.metadataForPartialUploads,headers:oi(oi({},n.options.headers),{},{"Upload-Concat":"partial"}),onSuccess:b,onError:D,onProgress:function(_){i=i-d+_,d=_,n._emitProgress(i,o)},onUploadUrlAvailable:function(){n._parallelUploadUrls[p]=E.url,n._parallelUploadUrls.filter(function(_){return!!_}).length===s.length&&n._saveUploadInUrlStorage()}}),E=new t(m,C);E.start(),n._parallelUploads.push(E)})})}),c;Promise.all(u).then(function(){c=n._openRequest("POST",n.options.endpoint),c.setHeader("Upload-Concat","final;".concat(n._parallelUploadUrls.join(" ")));var l=Hb(n.options.metadata);return l!==""&&c.setHeader("Upload-Metadata",l),n._sendRequest(c,null)}).then(function(l){if(!ii(l.getStatus(),200)){n._emitHttpError(c,l,"tus: unexpected response while creating upload");return}var p=l.getHeader("Location");if(p==null){n._emitHttpError(c,l,"tus: invalid or missing Location header");return}n.url=Wb(n.options.endpoint,p),(0,Yn.log)("Created upload at ".concat(n.url)),n._emitSuccess(l)}).catch(function(l){n._emitError(l)})}},{key:"_startSingleUpload",value:function(){if(this._aborted=!1,this.url!=null){(0,Yn.log)("Resuming upload from previous URL: ".concat(this.url)),this._resumeUpload();return}if(this.options.uploadUrl!=null){(0,Yn.log)("Resuming upload from provided URL: ".concat(this.options.uploadUrl)),this.url=this.options.uploadUrl,this._resumeUpload();return}(0,Yn.log)("Creating a new upload"),this._createUpload()}},{key:"abort",value:function(r){var n=this;if(this._parallelUploads!=null){var o=M$(this._parallelUploads),i;try{for(o.s();!(i=o.n()).done;){var a=i.value;a.abort(r)}}catch(s){o.e(s)}finally{o.f()}}return this._req!==null&&this._req.abort(),this._aborted=!0,this._retryTimeout!=null&&(clearTimeout(this._retryTimeout),this._retryTimeout=null),!r||this.url==null?Promise.resolve():t.terminate(this.url,this.options).then(function(){return n._removeFromUrlStorage()})}},{key:"_emitHttpError",value:function(r,n,o,i){this._emitError(new Vu.default(o,i,r,n))}},{key:"_emitError",value:function(r){var n=this;if(!this._aborted){if(this.options.retryDelays!=null){var o=this._offset!=null&&this._offset>this._offsetBeforeRetry;if(o&&(this._retryAttempt=0),Gb(r,this._retryAttempt,this.options)){var i=this.options.retryDelays[this._retryAttempt++];this._offsetBeforeRetry=this._offset,this._retryTimeout=setTimeout(function(){n.start()},i);return}}if(typeof this.options.onError=="function")this.options.onError(r);else throw r}}},{key:"_emitSuccess",value:function(r){this.options.removeFingerprintOnSuccess&&this._removeFromUrlStorage(),typeof this.options.onSuccess=="function"&&this.options.onSuccess({lastResponse:r})}},{key:"_emitProgress",value:function(r,n){typeof this.options.onProgress=="function"&&this.options.onProgress(r,n)}},{key:"_emitChunkComplete",value:function(r,n,o){typeof this.options.onChunkComplete=="function"&&this.options.onChunkComplete(r,n,o)}},{key:"_createUpload",value:function(){var r=this;if(!this.options.endpoint){this._emitError(new Error("tus: unable to create upload because no endpoint is provided"));return}var n=this._openRequest("POST",this.options.endpoint);this.options.uploadLengthDeferred?n.setHeader("Upload-Defer-Length","1"):n.setHeader("Upload-Length","".concat(this._size));var o=Hb(this.options.metadata);o!==""&&n.setHeader("Upload-Metadata",o);var i;this.options.uploadDataDuringCreation&&!this.options.uploadLengthDeferred?(this._offset=0,i=this._addChunkToRequest(n)):((this.options.protocol===Gu||this.options.protocol===Na)&&n.setHeader("Upload-Complete","?0"),i=this._sendRequest(n,null)),i.then(function(a){if(!ii(a.getStatus(),200)){r._emitHttpError(n,a,"tus: unexpected response while creating upload");return}var s=a.getHeader("Location");if(s==null){r._emitHttpError(n,a,"tus: invalid or missing Location header");return}if(r.url=Wb(r.options.endpoint,s),(0,Yn.log)("Created upload at ".concat(r.url)),typeof r.options.onUploadUrlAvailable=="function"&&r.options.onUploadUrlAvailable(),r._size===0){r._emitSuccess(a),r._source.close();return}r._saveUploadInUrlStorage().then(function(){r.options.uploadDataDuringCreation?r._handleUploadResponse(n,a):(r._offset=0,r._performUpload())})}).catch(function(a){r._emitHttpError(n,null,"tus: failed to create upload",a)})}},{key:"_resumeUpload",value:function(){var r=this,n=this._openRequest("HEAD",this.url),o=this._sendRequest(n,null);o.then(function(i){var a=i.getStatus();if(!ii(a,200)){if(a===423){r._emitHttpError(n,i,"tus: upload is currently locked; retry later");return}if(ii(a,400)&&r._removeFromUrlStorage(),!r.options.endpoint){r._emitHttpError(n,i,"tus: unable to resume upload (new upload cannot be created without an endpoint)");return}r.url=null,r._createUpload();return}var s=Number.parseInt(i.getHeader("Upload-Offset"),10);if(Number.isNaN(s)){r._emitHttpError(n,i,"tus: invalid or missing offset value");return}var u=Number.parseInt(i.getHeader("Upload-Length"),10);if(Number.isNaN(u)&&!r.options.uploadLengthDeferred&&r.options.protocol===zu){r._emitHttpError(n,i,"tus: invalid or missing length value");return}typeof r.options.onUploadUrlAvailable=="function"&&r.options.onUploadUrlAvailable(),r._saveUploadInUrlStorage().then(function(){if(s===u){r._emitProgress(u,u),r._emitSuccess(i);return}r._offset=s,r._performUpload()})}).catch(function(i){r._emitHttpError(n,null,"tus: failed to resume upload",i)})}},{key:"_performUpload",value:function(){var r=this;if(!this._aborted){var n;this.options.overridePatchMethod?(n=this._openRequest("POST",this.url),n.setHeader("X-HTTP-Method-Override","PATCH")):n=this._openRequest("PATCH",this.url),n.setHeader("Upload-Offset","".concat(this._offset));var o=this._addChunkToRequest(n);o.then(function(i){if(!ii(i.getStatus(),200)){r._emitHttpError(n,i,"tus: unexpected response while uploading chunk");return}r._handleUploadResponse(n,i)}).catch(function(i){r._aborted||r._emitHttpError(n,null,"tus: failed to upload chunk at offset ".concat(r._offset),i)})}}},{key:"_addChunkToRequest",value:function(r){var n=this,o=this._offset,i=this._offset+this.options.chunkSize;return r.setProgressHandler(function(a){n._emitProgress(o+a,n._size)}),this.options.protocol===zu?r.setHeader("Content-Type","application/offset+octet-stream"):this.options.protocol===Na&&r.setHeader("Content-Type","application/partial-upload"),(i===Number.POSITIVE_INFINITY||i>this._size)&&!this.options.uploadLengthDeferred&&(i=this._size),this._source.slice(o,i).then(function(a){var s=a.value,u=a.done,c=s!=null&&s.size?s.size:0;n.options.uploadLengthDeferred&&u&&(n._size=n._offset+c,r.setHeader("Upload-Length","".concat(n._size)));var l=n._offset+c;return!n.options.uploadLengthDeferred&&u&&l!==n._size?Promise.reject(new Error("upload was configured with a size of ".concat(n._size," bytes, but the source is done after ").concat(l," bytes"))):s===null?n._sendRequest(r):((n.options.protocol===Gu||n.options.protocol===Na)&&r.setHeader("Upload-Complete",u?"?1":"?0"),n._emitProgress(n._offset,n._size),n._sendRequest(r,s))})}},{key:"_handleUploadResponse",value:function(r,n){var o=Number.parseInt(n.getHeader("Upload-Offset"),10);if(Number.isNaN(o)){this._emitHttpError(r,n,"tus: invalid or missing offset value");return}if(this._emitProgress(o,this._size),this._emitChunkComplete(o-this._offset,o,this._size),this._offset=o,o===this._size){this._emitSuccess(n),this._source.close();return}this._performUpload()}},{key:"_openRequest",value:function(r,n){var o=Vb(r,n,this.options);return this._req=o,o}},{key:"_removeFromUrlStorage",value:function(){var r=this;this._urlStorageKey&&(this._urlStorage.removeUpload(this._urlStorageKey).catch(function(n){r._emitError(n)}),this._urlStorageKey=null)}},{key:"_saveUploadInUrlStorage",value:function(){var r=this;if(!this.options.storeFingerprintForResuming||!this._fingerprint||this._urlStorageKey!==null)return Promise.resolve();var n={size:this._size,metadata:this.options.metadata,creationTime:new Date().toString()};return this._parallelUploads?n.parallelUploadUrls=this._parallelUploadUrls:n.uploadUrl=this.url,this._urlStorage.addUpload(this._fingerprint,n).then(function(o){r._urlStorageKey=o})}},{key:"_sendRequest",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return zb(r,n,this.options)}}],[{key:"terminate",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=Vb("DELETE",r,n);return zb(o,null,n).then(function(i){if(i.getStatus()!==204)throw new Vu.default("tus: unexpected response while terminating upload",null,o,i)}).catch(function(i){if(i instanceof Vu.default||(i=new Vu.default("tus: failed to terminate upload",i,o,null)),!Gb(i,0,n))throw i;var a=n.retryDelays[0],s=n.retryDelays.slice(1),u=oi(oi({},n),{},{retryDelays:s});return new Promise(function(c){return setTimeout(c,a)}).then(function(){return t.terminate(r,u)})})}}])})();function Hb(t){return Object.entries(t).map(function(e){var r=Kb(e,2),n=r[0],o=r[1];return"".concat(n," ").concat(I$.Base64.encode(String(o)))}).join(",")}function ii(t,e){return t>=e&&t<e+100}function Vb(t,e,r){var n=r.httpStack.createRequest(t,e);r.protocol===Gu?n.setHeader("Upload-Draft-Interop-Version","5"):r.protocol===Na?n.setHeader("Upload-Draft-Interop-Version","6"):n.setHeader("Tus-Resumable","1.0.0");for(var o=r.headers||{},i=0,a=Object.entries(o);i<a.length;i++){var s=Kb(a[i],2),u=s[0],c=s[1];n.setHeader(u,c)}if(r.addRequestId){var l=(0,B$.default)();n.setHeader("X-Request-ID",l)}return n}function zb(t,e,r){return Vd.apply(this,arguments)}function Vd(){return Vd=j$(Hd().mark(function t(e,r,n){var o;return Hd().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(typeof n.onBeforeRequest!="function"){a.next=3;break}return a.next=3,n.onBeforeRequest(e);case 3:return a.next=5,e.send(r);case 5:if(o=a.sent,typeof n.onAfterResponse!="function"){a.next=9;break}return a.next=9,n.onAfterResponse(e,o);case 9:return a.abrupt("return",o);case 10:case"end":return a.stop()}},t)})),Vd.apply(this,arguments)}function W$(){var t=!0;return typeof navigator<"u"&&navigator.onLine===!1&&(t=!1),t}function Gb(t,e,r){return r.retryDelays==null||e>=r.retryDelays.length||t.originalRequest==null?!1:r&&typeof r.onShouldRetry=="function"?r.onShouldRetry(t,e,r):Zb(t)}function Zb(t){var e=t.originalResponse?t.originalResponse.getStatus():0;return(!ii(e,400)||e===409||e===423)&&W$()}function Wb(t,e){return new R$.default(e,t).toString()}function K$(t,e){for(var r=Math.floor(t/e),n=[],o=0;o<e;o++)n.push({start:r*o,end:r*(o+1)});return n[e-1].end=t,n}Xb.defaultOptions=G$;var az=Wu.default=Xb});var tw=x((uz,ew)=>{"use strict";var Or=t=>t!==null&&typeof t=="object"&&typeof t.pipe=="function";Or.writable=t=>Or(t)&&t.writable!==!1&&typeof t._write=="function"&&typeof t._writableState=="object";Or.readable=t=>Or(t)&&t.readable!==!1&&typeof t._read=="function"&&typeof t._readableState=="object";Or.duplex=t=>Or.writable(t)&&Or.readable(t);Or.transform=t=>Or.duplex(t)&&typeof t._transform=="function";ew.exports=Or});var nw=x(Ku=>{"use strict";Object.defineProperty(Ku,"__esModule",{value:!0});Ku.default=void 0;function La(t){"@babel/helpers - typeof";return La=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},La(t)}function Y$(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function rw(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,X$(n.key),n)}}function J$(t,e,r){return e&&rw(t.prototype,e),r&&rw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function X$(t){var e=Z$(t,"string");return La(e)=="symbol"?e:e+""}function Z$(t,e){if(La(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(La(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var cz=Ku.default=(function(){function t(e){Y$(this,t),this._buffer=e,this.size=e.length}return J$(t,[{key:"slice",value:function(r,n){var o=this._buffer.slice(r,n);o.size=o.length;var i=n>=this.size;return Promise.resolve({value:o,done:i})}},{key:"close",value:function(){}}])})()});var sw=x(Kd=>{"use strict";Object.defineProperty(Kd,"__esModule",{value:!0});Kd.default=oP;var aw=require("fs");function Xn(t){"@babel/helpers - typeof";return Xn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Xn(t)}function Gd(){"use strict";Gd=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(y,w,v){y[w]=v.value},i=typeof Symbol=="function"?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(y,w,v){return Object.defineProperty(y,w,{value:v,enumerable:!0,configurable:!0,writable:!0}),y[w]}try{c({},"")}catch{c=function(v,F,I){return v[F]=I}}function l(y,w,v,F){var I=w&&w.prototype instanceof C?w:C,O=Object.create(I.prototype),q=new Q(F||[]);return o(O,"_invoke",{value:N(y,v,q)}),O}function p(y,w,v){try{return{type:"normal",arg:y.call(w,v)}}catch(F){return{type:"throw",arg:F}}}e.wrap=l;var d="suspendedStart",h="suspendedYield",m="executing",b="completed",D={};function C(){}function E(){}function g(){}var _={};c(_,a,function(){return this});var S=Object.getPrototypeOf,$=S&&S(S(P([])));$&&$!==r&&n.call($,a)&&(_=$);var k=g.prototype=C.prototype=Object.create(_);function B(y){["next","throw","return"].forEach(function(w){c(y,w,function(v){return this._invoke(w,v)})})}function R(y,w){function v(I,O,q,T){var j=p(y[I],y,O);if(j.type!=="throw"){var ee=j.arg,V=ee.value;return V&&Xn(V)=="object"&&n.call(V,"__await")?w.resolve(V.__await).then(function(se){v("next",se,q,T)},function(se){v("throw",se,q,T)}):w.resolve(V).then(function(se){ee.value=se,q(ee)},function(se){return v("throw",se,q,T)})}T(j.arg)}var F;o(this,"_invoke",{value:function(O,q){function T(){return new w(function(j,ee){v(O,q,j,ee)})}return F=F?F.then(T,T):T()}})}function N(y,w,v){var F=d;return function(I,O){if(F===m)throw Error("Generator is already running");if(F===b){if(I==="throw")throw O;return{value:t,done:!0}}for(v.method=I,v.arg=O;;){var q=v.delegate;if(q){var T=A(q,v);if(T){if(T===D)continue;return T}}if(v.method==="next")v.sent=v._sent=v.arg;else if(v.method==="throw"){if(F===d)throw F=b,v.arg;v.dispatchException(v.arg)}else v.method==="return"&&v.abrupt("return",v.arg);F=m;var j=p(y,w,v);if(j.type==="normal"){if(F=v.done?b:h,j.arg===D)continue;return{value:j.arg,done:v.done}}j.type==="throw"&&(F=b,v.method="throw",v.arg=j.arg)}}}function A(y,w){var v=w.method,F=y.iterator[v];if(F===t)return w.delegate=null,v==="throw"&&y.iterator.return&&(w.method="return",w.arg=t,A(y,w),w.method==="throw")||v!=="return"&&(w.method="throw",w.arg=new TypeError("The iterator does not provide a '"+v+"' method")),D;var I=p(F,y.iterator,w.arg);if(I.type==="throw")return w.method="throw",w.arg=I.arg,w.delegate=null,D;var O=I.arg;return O?O.done?(w[y.resultName]=O.value,w.next=y.nextLoc,w.method!=="return"&&(w.method="next",w.arg=t),w.delegate=null,D):O:(w.method="throw",w.arg=new TypeError("iterator result is not an object"),w.delegate=null,D)}function U(y){var w={tryLoc:y[0]};1 in y&&(w.catchLoc=y[1]),2 in y&&(w.finallyLoc=y[2],w.afterLoc=y[3]),this.tryEntries.push(w)}function M(y){var w=y.completion||{};w.type="normal",delete w.arg,y.completion=w}function Q(y){this.tryEntries=[{tryLoc:"root"}],y.forEach(U,this),this.reset(!0)}function P(y){if(y||y===""){var w=y[a];if(w)return w.call(y);if(typeof y.next=="function")return y;if(!isNaN(y.length)){var v=-1,F=function I(){for(;++v<y.length;)if(n.call(y,v))return I.value=y[v],I.done=!1,I;return I.value=t,I.done=!0,I};return F.next=F}}throw new TypeError(Xn(y)+" is not iterable")}return E.prototype=g,o(k,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:E,configurable:!0}),E.displayName=c(g,u,"GeneratorFunction"),e.isGeneratorFunction=function(y){var w=typeof y=="function"&&y.constructor;return!!w&&(w===E||(w.displayName||w.name)==="GeneratorFunction")},e.mark=function(y){return Object.setPrototypeOf?Object.setPrototypeOf(y,g):(y.__proto__=g,c(y,u,"GeneratorFunction")),y.prototype=Object.create(k),y},e.awrap=function(y){return{__await:y}},B(R.prototype),c(R.prototype,s,function(){return this}),e.AsyncIterator=R,e.async=function(y,w,v,F,I){I===void 0&&(I=Promise);var O=new R(l(y,w,v,F),I);return e.isGeneratorFunction(w)?O:O.next().then(function(q){return q.done?q.value:O.next()})},B(k),c(k,u,"Generator"),c(k,a,function(){return this}),c(k,"toString",function(){return"[object Generator]"}),e.keys=function(y){var w=Object(y),v=[];for(var F in w)v.push(F);return v.reverse(),function I(){for(;v.length;){var O=v.pop();if(O in w)return I.value=O,I.done=!1,I}return I.done=!0,I}},e.values=P,Q.prototype={constructor:Q,reset:function(w){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(M),!w)for(var v in this)v.charAt(0)==="t"&&n.call(this,v)&&!isNaN(+v.slice(1))&&(this[v]=t)},stop:function(){this.done=!0;var w=this.tryEntries[0].completion;if(w.type==="throw")throw w.arg;return this.rval},dispatchException:function(w){if(this.done)throw w;var v=this;function F(ee,V){return q.type="throw",q.arg=w,v.next=ee,V&&(v.method="next",v.arg=t),!!V}for(var I=this.tryEntries.length-1;I>=0;--I){var O=this.tryEntries[I],q=O.completion;if(O.tryLoc==="root")return F("end");if(O.tryLoc<=this.prev){var T=n.call(O,"catchLoc"),j=n.call(O,"finallyLoc");if(T&&j){if(this.prev<O.catchLoc)return F(O.catchLoc,!0);if(this.prev<O.finallyLoc)return F(O.finallyLoc)}else if(T){if(this.prev<O.catchLoc)return F(O.catchLoc,!0)}else{if(!j)throw Error("try statement without catch or finally");if(this.prev<O.finallyLoc)return F(O.finallyLoc)}}}},abrupt:function(w,v){for(var F=this.tryEntries.length-1;F>=0;--F){var I=this.tryEntries[F];if(I.tryLoc<=this.prev&&n.call(I,"finallyLoc")&&this.prev<I.finallyLoc){var O=I;break}}O&&(w==="break"||w==="continue")&&O.tryLoc<=v&&v<=O.finallyLoc&&(O=null);var q=O?O.completion:{};return q.type=w,q.arg=v,O?(this.method="next",this.next=O.finallyLoc,D):this.complete(q)},complete:function(w,v){if(w.type==="throw")throw w.arg;return w.type==="break"||w.type==="continue"?this.next=w.arg:w.type==="return"?(this.rval=this.arg=w.arg,this.method="return",this.next="end"):w.type==="normal"&&v&&(this.next=v),D},finish:function(w){for(var v=this.tryEntries.length-1;v>=0;--v){var F=this.tryEntries[v];if(F.finallyLoc===w)return this.complete(F.completion,F.afterLoc),M(F),D}},catch:function(w){for(var v=this.tryEntries.length-1;v>=0;--v){var F=this.tryEntries[v];if(F.tryLoc===w){var I=F.completion;if(I.type==="throw"){var O=I.arg;M(F)}return O}}throw Error("illegal catch attempt")},delegateYield:function(w,v,F){return this.delegate={iterator:P(w),resultName:v,nextLoc:F},this.method==="next"&&(this.arg=t),D}},e}function Q$(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ow(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,tP(n.key),n)}}function eP(t,e,r){return e&&ow(t.prototype,e),r&&ow(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function tP(t){var e=rP(t,"string");return Xn(e)=="symbol"?e:e+""}function rP(t,e){if(Xn(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Xn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function iw(t,e,r,n,o,i,a){try{var s=t[i](a),u=s.value}catch(c){r(c);return}s.done?e(u):Promise.resolve(u).then(n,o)}function nP(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(u){iw(i,n,o,a,s,"next",u)}function s(u){iw(i,n,o,a,s,"throw",u)}a(void 0)})}}function oP(t){return Wd.apply(this,arguments)}function Wd(){return Wd=nP(Gd().mark(function t(e){var r,n,o,i,a,s,u;return Gd().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return n=e.path.toString(),l.next=3,aw.promises.stat(n);case 3:return o=l.sent,i=o.size,a=(r=e.start)!==null&&r!==void 0?r:0,s=Number.isFinite(e.end)?e.end+1:i,u=s-a,l.abrupt("return",new iP(e,n,u));case 9:case"end":return l.stop()}},t)})),Wd.apply(this,arguments)}var iP=(function(){function t(e,r,n){Q$(this,t),this._stream=e,this._path=r,this.size=n}return eP(t,[{key:"slice",value:function(r,n){var o,i=(o=this._stream.start)!==null&&o!==void 0?o:0,a=(0,aw.createReadStream)(this._path,{start:i+r,end:i+n-1,autoClose:!0});a.size=Math.min(n-r,this.size);var s=a.size>=this.size;return Promise.resolve({value:a,done:s})}},{key:"close",value:function(){this._stream.destroy()}}])})()});var Jd=x(Yu=>{"use strict";Object.defineProperty(Yu,"__esModule",{value:!0});Yu.default=void 0;function Zn(t){"@babel/helpers - typeof";return Zn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Zn(t)}function Ua(){"use strict";Ua=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(y,w,v){y[w]=v.value},i=typeof Symbol=="function"?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(y,w,v){return Object.defineProperty(y,w,{value:v,enumerable:!0,configurable:!0,writable:!0}),y[w]}try{c({},"")}catch{c=function(v,F,I){return v[F]=I}}function l(y,w,v,F){var I=w&&w.prototype instanceof C?w:C,O=Object.create(I.prototype),q=new Q(F||[]);return o(O,"_invoke",{value:N(y,v,q)}),O}function p(y,w,v){try{return{type:"normal",arg:y.call(w,v)}}catch(F){return{type:"throw",arg:F}}}e.wrap=l;var d="suspendedStart",h="suspendedYield",m="executing",b="completed",D={};function C(){}function E(){}function g(){}var _={};c(_,a,function(){return this});var S=Object.getPrototypeOf,$=S&&S(S(P([])));$&&$!==r&&n.call($,a)&&(_=$);var k=g.prototype=C.prototype=Object.create(_);function B(y){["next","throw","return"].forEach(function(w){c(y,w,function(v){return this._invoke(w,v)})})}function R(y,w){function v(I,O,q,T){var j=p(y[I],y,O);if(j.type!=="throw"){var ee=j.arg,V=ee.value;return V&&Zn(V)=="object"&&n.call(V,"__await")?w.resolve(V.__await).then(function(se){v("next",se,q,T)},function(se){v("throw",se,q,T)}):w.resolve(V).then(function(se){ee.value=se,q(ee)},function(se){return v("throw",se,q,T)})}T(j.arg)}var F;o(this,"_invoke",{value:function(O,q){function T(){return new w(function(j,ee){v(O,q,j,ee)})}return F=F?F.then(T,T):T()}})}function N(y,w,v){var F=d;return function(I,O){if(F===m)throw Error("Generator is already running");if(F===b){if(I==="throw")throw O;return{value:t,done:!0}}for(v.method=I,v.arg=O;;){var q=v.delegate;if(q){var T=A(q,v);if(T){if(T===D)continue;return T}}if(v.method==="next")v.sent=v._sent=v.arg;else if(v.method==="throw"){if(F===d)throw F=b,v.arg;v.dispatchException(v.arg)}else v.method==="return"&&v.abrupt("return",v.arg);F=m;var j=p(y,w,v);if(j.type==="normal"){if(F=v.done?b:h,j.arg===D)continue;return{value:j.arg,done:v.done}}j.type==="throw"&&(F=b,v.method="throw",v.arg=j.arg)}}}function A(y,w){var v=w.method,F=y.iterator[v];if(F===t)return w.delegate=null,v==="throw"&&y.iterator.return&&(w.method="return",w.arg=t,A(y,w),w.method==="throw")||v!=="return"&&(w.method="throw",w.arg=new TypeError("The iterator does not provide a '"+v+"' method")),D;var I=p(F,y.iterator,w.arg);if(I.type==="throw")return w.method="throw",w.arg=I.arg,w.delegate=null,D;var O=I.arg;return O?O.done?(w[y.resultName]=O.value,w.next=y.nextLoc,w.method!=="return"&&(w.method="next",w.arg=t),w.delegate=null,D):O:(w.method="throw",w.arg=new TypeError("iterator result is not an object"),w.delegate=null,D)}function U(y){var w={tryLoc:y[0]};1 in y&&(w.catchLoc=y[1]),2 in y&&(w.finallyLoc=y[2],w.afterLoc=y[3]),this.tryEntries.push(w)}function M(y){var w=y.completion||{};w.type="normal",delete w.arg,y.completion=w}function Q(y){this.tryEntries=[{tryLoc:"root"}],y.forEach(U,this),this.reset(!0)}function P(y){if(y||y===""){var w=y[a];if(w)return w.call(y);if(typeof y.next=="function")return y;if(!isNaN(y.length)){var v=-1,F=function I(){for(;++v<y.length;)if(n.call(y,v))return I.value=y[v],I.done=!1,I;return I.value=t,I.done=!0,I};return F.next=F}}throw new TypeError(Zn(y)+" is not iterable")}return E.prototype=g,o(k,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:E,configurable:!0}),E.displayName=c(g,u,"GeneratorFunction"),e.isGeneratorFunction=function(y){var w=typeof y=="function"&&y.constructor;return!!w&&(w===E||(w.displayName||w.name)==="GeneratorFunction")},e.mark=function(y){return Object.setPrototypeOf?Object.setPrototypeOf(y,g):(y.__proto__=g,c(y,u,"GeneratorFunction")),y.prototype=Object.create(k),y},e.awrap=function(y){return{__await:y}},B(R.prototype),c(R.prototype,s,function(){return this}),e.AsyncIterator=R,e.async=function(y,w,v,F,I){I===void 0&&(I=Promise);var O=new R(l(y,w,v,F),I);return e.isGeneratorFunction(w)?O:O.next().then(function(q){return q.done?q.value:O.next()})},B(k),c(k,u,"Generator"),c(k,a,function(){return this}),c(k,"toString",function(){return"[object Generator]"}),e.keys=function(y){var w=Object(y),v=[];for(var F in w)v.push(F);return v.reverse(),function I(){for(;v.length;){var O=v.pop();if(O in w)return I.value=O,I.done=!1,I}return I.done=!0,I}},e.values=P,Q.prototype={constructor:Q,reset:function(w){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(M),!w)for(var v in this)v.charAt(0)==="t"&&n.call(this,v)&&!isNaN(+v.slice(1))&&(this[v]=t)},stop:function(){this.done=!0;var w=this.tryEntries[0].completion;if(w.type==="throw")throw w.arg;return this.rval},dispatchException:function(w){if(this.done)throw w;var v=this;function F(ee,V){return q.type="throw",q.arg=w,v.next=ee,V&&(v.method="next",v.arg=t),!!V}for(var I=this.tryEntries.length-1;I>=0;--I){var O=this.tryEntries[I],q=O.completion;if(O.tryLoc==="root")return F("end");if(O.tryLoc<=this.prev){var T=n.call(O,"catchLoc"),j=n.call(O,"finallyLoc");if(T&&j){if(this.prev<O.catchLoc)return F(O.catchLoc,!0);if(this.prev<O.finallyLoc)return F(O.finallyLoc)}else if(T){if(this.prev<O.catchLoc)return F(O.catchLoc,!0)}else{if(!j)throw Error("try statement without catch or finally");if(this.prev<O.finallyLoc)return F(O.finallyLoc)}}}},abrupt:function(w,v){for(var F=this.tryEntries.length-1;F>=0;--F){var I=this.tryEntries[F];if(I.tryLoc<=this.prev&&n.call(I,"finallyLoc")&&this.prev<I.finallyLoc){var O=I;break}}O&&(w==="break"||w==="continue")&&O.tryLoc<=v&&v<=O.finallyLoc&&(O=null);var q=O?O.completion:{};return q.type=w,q.arg=v,O?(this.method="next",this.next=O.finallyLoc,D):this.complete(q)},complete:function(w,v){if(w.type==="throw")throw w.arg;return w.type==="break"||w.type==="continue"?this.next=w.arg:w.type==="return"?(this.rval=this.arg=w.arg,this.method="return",this.next="end"):w.type==="normal"&&v&&(this.next=v),D},finish:function(w){for(var v=this.tryEntries.length-1;v>=0;--v){var F=this.tryEntries[v];if(F.finallyLoc===w)return this.complete(F.completion,F.afterLoc),M(F),D}},catch:function(w){for(var v=this.tryEntries.length-1;v>=0;--v){var F=this.tryEntries[v];if(F.tryLoc===w){var I=F.completion;if(I.type==="throw"){var O=I.arg;M(F)}return O}}throw Error("illegal catch attempt")},delegateYield:function(w,v,F){return this.delegate={iterator:P(w),resultName:v,nextLoc:F},this.method==="next"&&(this.arg=t),D}},e}function aP(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function uw(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,uP(n.key),n)}}function sP(t,e,r){return e&&uw(t.prototype,e),r&&uw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function uP(t){var e=cP(t,"string");return Zn(e)=="symbol"?e:e+""}function cP(t,e){if(Zn(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Zn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function cw(t,e,r,n,o,i,a){try{var s=t[i](a),u=s.value}catch(c){r(c);return}s.done?e(u):Promise.resolve(u).then(n,o)}function lw(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(u){cw(i,n,o,a,s,"next",u)}function s(u){cw(i,n,o,a,s,"throw",u)}a(void 0)})}}function lP(t,e){return Yd.apply(this,arguments)}function Yd(){return Yd=lw(Ua().mark(function t(e,r){return Ua().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.abrupt("return",new Promise(function(i,a){var s=function(l){e.off("readable",u),a(l)},u=function c(){var l=e.read(r);l!==null&&(e.off("error",s),e.off("readable",c),i(l))};e.once("error",s),e.on("readable",u)}));case 1:case"end":return o.stop()}},t)})),Yd.apply(this,arguments)}var pz=Yu.default=(function(){function t(e){var r=this;aP(this,t),this._stream=e,this.size=null,this._buf=Buffer.alloc(0),this._bufPos=0,this._ended=!1,this._error=null,e.pause(),e.on("end",function(){r._ended=!0}),e.on("error",function(n){r._error=n})}return sP(t,[{key:"slice",value:(function(){var e=lw(Ua().mark(function n(o,i){var a,s,u,c,l;return Ua().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:if(!(o<this._bufPos)){d.next=2;break}throw new Error("cannot slice from position which we already seeked away");case 2:if(!(o>this._bufPos+this._buf.length)){d.next=4;break}throw new Error("slice start is outside of buffer (currently not implemented)");case 4:if(!this._error){d.next=6;break}throw this._error;case 6:if(o<this._bufPos+this._buf.length?(s=o-this._bufPos,u=Math.min(this._buf.length,i-this._bufPos),a=this._buf.slice(s,u)):a=Buffer.alloc(0),!this._ended){d.next=10;break}return a.size=a.length,d.abrupt("return",{value:a,done:!0});case 10:if(c=i-o,!(c>a.length)){d.next=16;break}return d.next=14,lP(this._stream,c-a.length);case 14:l=d.sent,a=Buffer.concat([a,l]);case 16:return this._buf=a,this._bufPos=o,a.size=a.length,d.abrupt("return",{value:a,done:this._ended});case 20:case"end":return d.stop()}},n,this)}));function r(n,o){return e.apply(this,arguments)}return r})()},{key:"close",value:function(){this._stream.destroy()}}])})()});var pw=x(Xu=>{"use strict";Object.defineProperty(Xu,"__esModule",{value:!0});Xu.default=void 0;var fP=require("fs"),pP=Ju(tw()),dP=Ju(nw()),hP=Ju(sw()),mP=Ju(Jd());function Ju(t){return t&&t.__esModule?t:{default:t}}function Ma(t){"@babel/helpers - typeof";return Ma=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ma(t)}function gP(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function fw(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,yP(n.key),n)}}function DP(t,e,r){return e&&fw(t.prototype,e),r&&fw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function yP(t){var e=bP(t,"string");return Ma(e)=="symbol"?e:e+""}function bP(t,e){if(Ma(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Ma(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var hz=Xu.default=(function(){function t(){gP(this,t)}return DP(t,[{key:"openFile",value:function(r,n){return Buffer.isBuffer(r)?Promise.resolve(new dP.default(r)):r instanceof fP.ReadStream&&r.path!=null?(0,hP.default)(r):pP.default.readable(r)?(n=Number(n),Number.isFinite(n)?Promise.resolve(new mP.default(r)):Promise.reject(new Error("cannot create source for stream without a finite value for the `chunkSize` option; specify a chunkSize to control the memory consumption"))):Promise.reject(new Error("source object may only be an instance of Buffer or Readable in this environment"))}}])})()});var gw=x(Xd=>{"use strict";Object.defineProperty(Xd,"__esModule",{value:!0});Xd.default=CP;var wP=require("crypto"),dw=mw(require("fs")),vP=mw(require("path"));function hw(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(hw=function(n){return n?r:e})(t)}function mw(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=hw(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if(i!=="default"&&{}.hasOwnProperty.call(t,i)){var a=o?Object.getOwnPropertyDescriptor(t,i):null;a&&(a.get||a.set)?Object.defineProperty(n,i,a):n[i]=t[i]}return n.default=t,r&&r.set(t,n),n}function CP(t,e){if(Buffer.isBuffer(t)){var r=65536,n=t.slice(0,Math.min(r,t.length)),o=(0,wP.createHash)("md5").update(n).digest("hex"),i=["node-buffer",o,t.length,e.endpoint].join("-");return Promise.resolve(i)}return t instanceof dw.ReadStream&&t.path!=null?new Promise(function(a,s){var u=vP.resolve(t.path);dw.stat(t.path,function(c,l){if(c){s(c);return}var p=["node-file",u,l.size,l.mtime.getTime(),e.endpoint].join("-");a(p)})}):Promise.resolve(null)}});var vw=x((Dz,ww)=>{var bw="Expected a function",Dw=NaN,EP="[object Symbol]",_P=/^\s+|\s+$/g,xP=/^[-+]0x[0-9a-f]+$/i,SP=/^0b[01]+$/i,FP=/^0o[0-7]+$/i,AP=parseInt,OP=typeof global=="object"&&global&&global.Object===Object&&global,kP=typeof self=="object"&&self&&self.Object===Object&&self,$P=OP||kP||Function("return this")(),PP=Object.prototype,TP=PP.toString,IP=Math.max,RP=Math.min,Zd=function(){return $P.Date.now()};function BP(t,e,r){var n,o,i,a,s,u,c=0,l=!1,p=!1,d=!0;if(typeof t!="function")throw new TypeError(bw);e=yw(e)||0,Zu(r)&&(l=!!r.leading,p="maxWait"in r,i=p?IP(yw(r.maxWait)||0,e):i,d="trailing"in r?!!r.trailing:d);function h($){var k=n,B=o;return n=o=void 0,c=$,a=t.apply(B,k),a}function m($){return c=$,s=setTimeout(C,e),l?h($):a}function b($){var k=$-u,B=$-c,R=e-k;return p?RP(R,i-B):R}function D($){var k=$-u,B=$-c;return u===void 0||k>=e||k<0||p&&B>=i}function C(){var $=Zd();if(D($))return E($);s=setTimeout(C,b($))}function E($){return s=void 0,d&&n?h($):(n=o=void 0,a)}function g(){s!==void 0&&clearTimeout(s),c=0,n=u=o=s=void 0}function _(){return s===void 0?a:E(Zd())}function S(){var $=Zd(),k=D($);if(n=arguments,o=this,u=$,k){if(s===void 0)return m(u);if(p)return s=setTimeout(C,e),h(u)}return s===void 0&&(s=setTimeout(C,e)),a}return S.cancel=g,S.flush=_,S}function jP(t,e,r){var n=!0,o=!0;if(typeof t!="function")throw new TypeError(bw);return Zu(r)&&(n="leading"in r?!!r.leading:n,o="trailing"in r?!!r.trailing:o),BP(t,e,{leading:n,maxWait:e,trailing:o})}function Zu(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function NP(t){return!!t&&typeof t=="object"}function LP(t){return typeof t=="symbol"||NP(t)&&TP.call(t)==EP}function yw(t){if(typeof t=="number")return t;if(LP(t))return Dw;if(Zu(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Zu(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(_P,"");var r=SP.test(t);return r||FP.test(t)?AP(t.slice(2),r?2:8):xP.test(t)?Dw:+t}ww.exports=jP});var kw=x(rc=>{"use strict";Object.defineProperty(rc,"__esModule",{value:!0});rc.default=void 0;var UP=Fw(require("http")),MP=Fw(require("https")),_w=require("stream"),qP=require("url"),xw=HP(vw());function HP(t){return t&&t.__esModule?t:{default:t}}function Sw(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(Sw=function(n){return n?r:e})(t)}function Fw(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=Sw(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if(i!=="default"&&{}.hasOwnProperty.call(t,i)){var a=o?Object.getOwnPropertyDescriptor(t,i):null;a&&(a.get||a.set)?Object.defineProperty(n,i,a):n[i]=t[i]}return n.default=t,r&&r.set(t,n),n}function VP(t,e,r){return e=Qu(e),zP(t,Aw()?Reflect.construct(e,r||[],Qu(t).constructor):e.apply(t,r))}function zP(t,e){if(e&&(ai(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return GP(t)}function GP(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Aw(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Aw=function(){return!!t})()}function Qu(t){return Qu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Qu(t)}function WP(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Qd(t,e)}function Qd(t,e){return Qd=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Qd(t,e)}function Cw(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r.push.apply(r,n)}return r}function qa(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Cw(Object(r),!0).forEach(function(n){KP(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Cw(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function KP(t,e,r){return e=Ow(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ai(t){"@babel/helpers - typeof";return ai=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ai(t)}function ec(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ew(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Ow(n.key),n)}}function tc(t,e,r){return e&&Ew(t.prototype,e),r&&Ew(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ow(t){var e=YP(t,"string");return ai(e)=="symbol"?e:e+""}function YP(t,e){if(ai(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ai(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var yz=rc.default=(function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ec(this,t),this._requestOptions=e}return tc(t,[{key:"createRequest",value:function(r,n){return new JP(r,n,this._requestOptions)}},{key:"getName",value:function(){return"NodeHttpStack"}}])})(),JP=(function(){function t(e,r,n){ec(this,t),this._method=e,this._url=r,this._headers={},this._request=null,this._progressHandler=function(){},this._requestOptions=n||{}}return tc(t,[{key:"getMethod",value:function(){return this._method}},{key:"getURL",value:function(){return this._url}},{key:"setHeader",value:function(r,n){this._headers[r]=n}},{key:"getHeader",value:function(r){return this._headers[r]}},{key:"setProgressHandler",value:function(r){this._progressHandler=r}},{key:"send",value:function(){var r=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return new Promise(function(o,i){var a=qa(qa(qa({},(0,qP.parse)(r._url)),r._requestOptions),{},{method:r._method,headers:qa(qa({},r._requestOptions.headers||{}),r._headers)});n!=null&&n.size&&(a.headers["Content-Length"]=n.size);var s=a.protocol==="https:"?MP:UP;r._request=s.request(a);var u=r._request;u.on("response",function(c){var l=[];c.on("data",function(p){l.push(p)}),c.on("end",function(){var p=Buffer.concat(l).toString("utf8");o(new XP(c,p))})}),u.on("error",function(c){i(c)}),n instanceof _w.Readable?n.pipe(new ZP(r._progressHandler)).pipe(u):n instanceof Uint8Array?QP(u,n,r._progressHandler):u.end(n)})}},{key:"abort",value:function(){return this._request!==null&&this._request.abort(),Promise.resolve()}},{key:"getUnderlyingObject",value:function(){return this._request}}])})(),XP=(function(){function t(e,r){ec(this,t),this._response=e,this._body=r}return tc(t,[{key:"getStatus",value:function(){return this._response.statusCode}},{key:"getHeader",value:function(r){return this._response.headers[r.toLowerCase()]}},{key:"getBody",value:function(){return this._body}},{key:"getUnderlyingObject",value:function(){return this._response}}])})(),ZP=(function(t){function e(r){var n;return ec(this,e),n=VP(this,e),n._onprogress=(0,xw.default)(r,100,{leading:!0,trailing:!1}),n._position=0,n}return WP(e,t),tc(e,[{key:"_transform",value:function(n,o,i){this._position+=n.length,this._onprogress(this._position),i(null,n)}}])})(_w.Transform),QP=function(e,r,n){n=(0,xw.default)(n,100,{leading:!0,trailing:!1});var o=0;function i(){var a=Math.min(e.writableHighWaterMark,r.length-o),s=r.subarray(o,o+a);o+=s.length;var u=e.write(s);u?o<r.length?i():e.end():(e.once("drain",i),n(o))}i()}});var $w=x(eh=>{"use strict";eh.expectReceive=function(t,e,r){var n;r.root(t,e,r),n=this.message,t.hasOwnProperty("expected")&&(n+=" Expected "+t.expected+"."),t.hasOwnProperty("received")&&(n+=" Received: "+t.received+"."),this.message=n};eh.root=function(t,e,r){var n=this,o,i={stackLength:Error.stackTraceLimit,rootOnly:!0},a="",s=Error.stackTraceLimit,u;function c(){u[0]=n.toString(),n.stack=u.join(`
37
37
  `)}(!e||typeof e!="object")&&(e={}),e.hasOwnProperty("stackLength")&&typeof e.stackLength=="number"&&!isNaN(e.stackLength)&&e.stackLength>=0&&(i.stackLength=e.stackLength),e.hasOwnProperty("rootOnly")||(i.rootOnly=e.rootOnly),(!i.rootOnly||this.CustomError.parent===Error)&&(Object.keys(t).forEach(function(l){switch(l){case"code":o=t.code||void 0;break;case"message":a=t.message||"";break;default:n[l]=t[l]}}),Error.stackTraceLimit=i.stackLength+2,u=new Error().stack.split(`
38
38
  `),u.splice(0,3),u.unshift(""),Error.stackTraceLimit=s,this.stack=u.join(`
39
- `),Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,get:function(){return o},set:function(l){o=l,c()}}),Object.defineProperty(this,"message",{configurable:!0,enumerable:!0,get:function(){return a},set:function(l){a=l,c()}}),c())}});var $v=x((dz,kv)=>{"use strict";kv.exports=Zn;Zn.factory=Av();var eh=Zn("CustomError");eh.order=Zn(eh,{message:"Arguments out of order.",code:"EOARG"});function Zn(t,e,r,n){var o,i;return e=ec(arguments,1,Error,Ov,[Zd,tc]),r=ec(arguments,2,{},Zd,[tc]),n=ec(arguments,3,Qd,tc,[]),t=ec(arguments,0,e===Error?"Error":e.prototype.CustomError.name,JP,[Ov,Zd,tc]),i=e===Error,i&&n===Qd&&(n=Zn.factory.root),o=function(a,s){var u,c,l,f,d,h;if(!(this instanceof o))return new o(a,s);for(delete this.constructor.name,Object.defineProperty(this.constructor,"name",{enumerable:!1,configurable:!0,value:t,writable:!1}),typeof a=="string"&&(a={message:a}),a||(a={}),c=this.CustomError.chain.slice(0).reverse().map(function(m){return m.properties}),c.push(a),c.unshift({}),h=Object.assign.apply(Object,c),u=this,l={},Object.keys(Zn.factory).forEach(function(m){l[m]=function(b,D){Zn.factory[m].call(u,b,D,l)}}),f=this.CustomError.chain.length-1;f>=0;f--)d=this.CustomError.chain[f],d.factory!==Qd&&d.factory.call(this,h,s,l)},o.prototype=Object.create(e.prototype),o.prototype.constructor=o,o.prototype.name=t,o.prototype.CustomError={chain:i?[]:e.prototype.CustomError.chain.slice(0),factory:n,name:t,parent:e,properties:r},o.prototype.CustomError.chain.unshift(o.prototype.CustomError),o.prototype.toString=function(){var a=this.CustomError.chain[this.CustomError.chain.length-1].name;return this.code&&(a+=" "+this.code),this.message&&(a+=": "+this.message),a},o}function ec(t,e,r,n,o){var i=-1,a=-1,s,u,c=e<t.length?e:t.length,l;for(s=0;s<=c;s++){if(l=t[s],i===-1)for(u=0;u<o.length;u++)o[u](l)&&(i=s);a===-1&&n(l)&&(a=s)}if(a!==-1&&i!==-1&&i<a)throw new eh.order;return a!==-1?t[a]:r}function tc(t){return typeof t=="function"&&t!==Error&&!t.prototype.CustomError}function JP(t){return typeof t=="string"}function Ov(t){return typeof t=="function"&&(t===Error||t.prototype.CustomError)}function Zd(t){return t&&typeof t=="object"}function Qd(){}});var Tv=x((hz,Pv)=>{Pv.exports=$v()});var Nv=x((Qn,oi)=>{var XP=1/0,ZP="[object Symbol]",Ua={function:!0,object:!0},QP=Ua[typeof Qn]&&Qn&&!Qn.nodeType?Qn:void 0,eT=Ua[typeof oi]&&oi&&!oi.nodeType?oi:void 0,tT=rc(QP&&eT&&typeof global=="object"&&global),rT=rc(Ua[typeof self]&&self),Iv=rc(Ua[typeof window]&&window),th=rc(Ua[typeof Qn]&&Qn),nT=tT||Iv!==(th&&th.window)&&Iv||rT||th||Function("return this")();function rc(t){return t&&t.Object===Object?t:null}var oT=Object.prototype,iT=oT.toString,Rv=nT.Symbol,Bv=Rv?Rv.prototype:void 0,jv=Bv?Bv.toString:void 0;function aT(t){if(typeof t=="string")return t;if(uT(t))return jv?jv.call(t):"";var e=t+"";return e=="0"&&1/t==-XP?"-0":e}function sT(t){return!!t&&typeof t=="object"}function uT(t){return typeof t=="symbol"||sT(t)&&iT.call(t)==ZP}oi.exports=aT});var zv=x((eo,ii)=>{var cT=Nv(),lT="Expected a function",Uv="__lodash_hash_undefined__",fT="[object Function]",pT="[object GeneratorFunction]",dT=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g,hT=/[\\^$.*+?()[\]{}|]/g,mT=/\\(\\)?/g,gT=/^\[object .+?Constructor\]$/,qa={function:!0,object:!0},DT=qa[typeof eo]&&eo&&!eo.nodeType?eo:void 0,yT=qa[typeof ii]&&ii&&!ii.nodeType?ii:void 0,bT=nc(DT&&yT&&typeof global=="object"&&global),vT=nc(qa[typeof self]&&self),Lv=nc(qa[typeof window]&&window),rh=nc(qa[typeof eo]&&eo),wT=bT||Lv!==(rh&&rh.window)&&Lv||vT||rh||Function("return this")();function nc(t){return t&&t.Object===Object?t:null}function CT(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}var ET=Array.prototype,Mv=Object.prototype,qv=Function.prototype.toString,nh=Mv.hasOwnProperty,_T=Mv.toString,xT=RegExp("^"+qv.call(nh).replace(hT,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ST=ET.splice,FT=Hv(wT,"Map"),Ma=Hv(Object,"create");function to(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function AT(){this.__data__=Ma?Ma(null):{}}function OT(t){return this.has(t)&&delete this.__data__[t]}function kT(t){var e=this.__data__;if(Ma){var r=e[t];return r===Uv?void 0:r}return nh.call(e,t)?e[t]:void 0}function $T(t){var e=this.__data__;return Ma?e[t]!==void 0:nh.call(e,t)}function PT(t,e){var r=this.__data__;return r[t]=Ma&&e===void 0?Uv:e,this}to.prototype.clear=AT;to.prototype.delete=OT;to.prototype.get=kT;to.prototype.has=$T;to.prototype.set=PT;function ai(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function TT(){this.__data__=[]}function IT(t){var e=this.__data__,r=oc(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():ST.call(e,r,1),!0}function RT(t){var e=this.__data__,r=oc(e,t);return r<0?void 0:e[r][1]}function BT(t){return oc(this.__data__,t)>-1}function jT(t,e){var r=this.__data__,n=oc(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}ai.prototype.clear=TT;ai.prototype.delete=IT;ai.prototype.get=RT;ai.prototype.has=BT;ai.prototype.set=jT;function ro(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function NT(){this.__data__={hash:new to,map:new(FT||ai),string:new to}}function LT(t){return ic(this,t).delete(t)}function UT(t){return ic(this,t).get(t)}function MT(t){return ic(this,t).has(t)}function qT(t,e){return ic(this,t).set(t,e),this}ro.prototype.clear=NT;ro.prototype.delete=LT;ro.prototype.get=UT;ro.prototype.has=MT;ro.prototype.set=qT;function oc(t,e){for(var r=t.length;r--;)if(GT(t[r][0],e))return r;return-1}function ic(t,e){var r=t.__data__;return HT(e)?r[typeof e=="string"?"string":"hash"]:r.map}function Hv(t,e){var r=t[e];return KT(r)?r:void 0}function HT(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var VT=oh(function(t){var e=[];return YT(t).replace(dT,function(r,n,o,i){e.push(o?i.replace(mT,"$1"):n||r)}),e});function zT(t){if(t!=null){try{return qv.call(t)}catch{}try{return t+""}catch{}}return""}function oh(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(lT);var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var a=t.apply(this,n);return r.cache=i.set(o,a),a};return r.cache=new(oh.Cache||ro),r}oh.Cache=ro;function GT(t,e){return t===e||t!==t&&e!==e}function WT(t){var e=Vv(t)?_T.call(t):"";return e==fT||e==pT}function Vv(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function KT(t){if(!Vv(t))return!1;var e=WT(t)||CT(t)?xT:gT;return e.test(zT(t))}function YT(t){return t==null?"":cT(t)}ii.exports=VT});var ww=x((no,ui)=>{var JT=zv(),XT=200,mh="__lodash_hash_undefined__",lc=1,ci=2,ZT=1/0,Xv=9007199254740991,ac="[object Arguments]",sh="[object Array]",Zv="[object Boolean]",Qv="[object Date]",ew="[object Error]",tw="[object Function]",QT="[object GeneratorFunction]",Ha="[object Map]",rw="[object Number]",si="[object Object]",Gv="[object Promise]",nw="[object RegExp]",Va="[object Set]",gh="[object String]",ow="[object Symbol]",uh="[object WeakMap]",iw="[object ArrayBuffer]",sc="[object DataView]",e6="[object Float32Array]",t6="[object Float64Array]",r6="[object Int8Array]",n6="[object Int16Array]",o6="[object Int32Array]",i6="[object Uint8Array]",a6="[object Uint8ClampedArray]",s6="[object Uint16Array]",u6="[object Uint32Array]",c6=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,l6=/^\w*$/,f6=/[\\^$.*+?()[\]{}|]/g,p6=/^\[object .+?Constructor\]$/,d6=/^(?:0|[1-9]\d*)$/,Ie={};Ie[e6]=Ie[t6]=Ie[r6]=Ie[n6]=Ie[o6]=Ie[i6]=Ie[a6]=Ie[s6]=Ie[u6]=!0;Ie[ac]=Ie[sh]=Ie[iw]=Ie[Zv]=Ie[sc]=Ie[Qv]=Ie[ew]=Ie[tw]=Ie[Ha]=Ie[rw]=Ie[si]=Ie[nw]=Ie[Va]=Ie[gh]=Ie[uh]=!1;var Ga={function:!0,object:!0},h6=Ga[typeof no]&&no&&!no.nodeType?no:void 0,m6=Ga[typeof ui]&&ui&&!ui.nodeType?ui:void 0,g6=fc(h6&&m6&&typeof global=="object"&&global),D6=fc(Ga[typeof self]&&self),Wv=fc(Ga[typeof window]&&window),ih=fc(Ga[typeof no]&&no),ao=g6||Wv!==(ih&&ih.window)&&Wv||D6||ih||Function("return this")();function y6(t,e){for(var r=-1,n=t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}function b6(t,e){for(var r=-1,n=t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}function v6(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function w6(t,e){return y6(e,function(r){return[r,t[r]]})}function fc(t){return t&&t.Object===Object?t:null}function ch(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function aw(t){var e=-1,r=Array(t.size);return t.forEach(function(n,o){r[++e]=[o,n]}),r}function C6(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}function E6(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=[n,n]}),r}var _6=Array.prototype,pc=Object.prototype,sw=Function.prototype.toString,oo=pc.hasOwnProperty,so=pc.toString,x6=RegExp("^"+sw.call(oo).replace(f6,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Kv=ao.Symbol,Yv=ao.Uint8Array,S6=pc.propertyIsEnumerable,F6=_6.splice,A6=Object.getPrototypeOf,O6=Object.keys,lh=li(ao,"DataView"),uc=li(ao,"Map"),fh=li(ao,"Promise"),ph=li(ao,"Set"),dh=li(ao,"WeakMap"),za=li(Object,"create"),k6=co(lh),$6=co(uc),P6=co(fh),T6=co(ph),I6=co(dh),Jv=Kv?Kv.prototype:void 0,ah=Jv?Jv.valueOf:void 0;function io(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function R6(){this.__data__=za?za(null):{}}function B6(t){return this.has(t)&&delete this.__data__[t]}function j6(t){var e=this.__data__;if(za){var r=e[t];return r===mh?void 0:r}return oo.call(e,t)?e[t]:void 0}function N6(t){var e=this.__data__;return za?e[t]!==void 0:oo.call(e,t)}function L6(t,e){var r=this.__data__;return r[t]=za&&e===void 0?mh:e,this}io.prototype.clear=R6;io.prototype.delete=B6;io.prototype.get=j6;io.prototype.has=N6;io.prototype.set=L6;function Yr(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function U6(){this.__data__=[]}function M6(t){var e=this.__data__,r=dc(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():F6.call(e,r,1),!0}function q6(t){var e=this.__data__,r=dc(e,t);return r<0?void 0:e[r][1]}function H6(t){return dc(this.__data__,t)>-1}function V6(t,e){var r=this.__data__,n=dc(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}Yr.prototype.clear=U6;Yr.prototype.delete=M6;Yr.prototype.get=q6;Yr.prototype.has=H6;Yr.prototype.set=V6;function uo(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function z6(){this.__data__={hash:new io,map:new(uc||Yr),string:new io}}function G6(t){return hc(this,t).delete(t)}function W6(t){return hc(this,t).get(t)}function K6(t){return hc(this,t).has(t)}function Y6(t,e){return hc(this,t).set(t,e),this}uo.prototype.clear=z6;uo.prototype.delete=G6;uo.prototype.get=W6;uo.prototype.has=K6;uo.prototype.set=Y6;function cc(t){var e=-1,r=t?t.length:0;for(this.__data__=new uo;++e<r;)this.add(t[e])}function J6(t){return this.__data__.set(t,mh),this}function X6(t){return this.__data__.has(t)}cc.prototype.add=cc.prototype.push=J6;cc.prototype.has=X6;function Kr(t){this.__data__=new Yr(t)}function Z6(){this.__data__=new Yr}function Q6(t){return this.__data__.delete(t)}function eI(t){return this.__data__.get(t)}function tI(t){return this.__data__.has(t)}function rI(t,e){var r=this.__data__;return r instanceof Yr&&r.__data__.length==XT&&(r=this.__data__=new uo(r.__data__)),r.set(t,e),this}Kr.prototype.clear=Z6;Kr.prototype.delete=Q6;Kr.prototype.get=eI;Kr.prototype.has=tI;Kr.prototype.set=rI;function dc(t,e){for(var r=t.length;r--;)if(wI(t[r][0],e))return r;return-1}function uw(t,e){e=mc(e,t)?[e]:fw(e);for(var r=0,n=e.length;t!=null&&r<n;)t=t[gc(e[r++])];return r&&r==n?t:void 0}function cw(t,e){return oo.call(t,e)||typeof t=="object"&&e in t&&gI(t)===null}function nI(t,e){return e in Object(t)}function Dh(t,e,r,n,o){return t===e?!0:t==null||e==null||!yc(t)&&!Wa(e)?t!==t&&e!==e:oI(t,e,Dh,r,n,o)}function oI(t,e,r,n,o,i){var a=bn(t),s=bn(e),u=sh,c=sh;a||(u=Wr(t),u=u==ac?si:u),s||(c=Wr(e),c=c==ac?si:c);var l=u==si&&!ch(t),f=c==si&&!ch(e),d=u==c;if(d&&!l)return i||(i=new Kr),a||_I(t)?pw(t,e,r,n,o,i):pI(t,e,u,r,n,o,i);if(!(o&ci)){var h=l&&oo.call(t,"__wrapped__"),m=f&&oo.call(e,"__wrapped__");if(h||m){var b=h?t.value():t,D=m?e.value():e;return i||(i=new Kr),r(b,D,n,o,i)}}return d?(i||(i=new Kr),dI(t,e,r,n,o,i)):!1}function iI(t,e,r,n){var o=r.length,i=o,a=!n;if(t==null)return!i;for(t=Object(t);o--;){var s=r[o];if(a&&s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++o<i;){s=r[o];var u=s[0],c=t[u],l=s[1];if(a&&s[2]){if(c===void 0&&!(u in t))return!1}else{var f=new Kr;if(n)var d=n(c,l,u,t,e,f);if(!(d===void 0?Dh(l,c,n,lc|ci,f):d))return!1}}return!0}function aI(t){return typeof t=="function"?t:t==null?AI:typeof t=="object"?bn(t)?cI(t[0],t[1]):uI(t):OI(t)}function sI(t){return O6(Object(t))}function uI(t){var e=mI(t);return e.length==1&&e[0][2]?mw(e[0][0],e[0][1]):function(r){return r===t||iI(r,t,e)}}function cI(t,e){return mc(t)&&hw(e)?mw(gc(t),e):function(r){var n=xI(r,t);return n===void 0&&n===e?SI(r,t):Dh(e,n,void 0,lc|ci)}}function lw(t){return function(e){return e?.[t]}}function lI(t){return function(e){return uw(e,t)}}function fw(t){return bn(t)?t:JT(t)}function fI(t){return function(e){var r=Wr(e);return r==Ha?aw(e):r==Va?E6(e):w6(e,t(e))}}function pw(t,e,r,n,o,i){var a=o&ci,s=t.length,u=e.length;if(s!=u&&!(a&&u>s))return!1;var c=i.get(t);if(c)return c==e;var l=-1,f=!0,d=o&lc?new cc:void 0;for(i.set(t,e);++l<s;){var h=t[l],m=e[l];if(n)var b=a?n(m,h,l,e,t,i):n(h,m,l,t,e,i);if(b!==void 0){if(b)continue;f=!1;break}if(d){if(!b6(e,function(D,C){if(!d.has(C)&&(h===D||r(h,D,n,o,i)))return d.add(C)})){f=!1;break}}else if(!(h===m||r(h,m,n,o,i))){f=!1;break}}return i.delete(t),f}function pI(t,e,r,n,o,i,a){switch(r){case sc:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case iw:return!(t.byteLength!=e.byteLength||!n(new Yv(t),new Yv(e)));case Zv:case Qv:return+t==+e;case ew:return t.name==e.name&&t.message==e.message;case rw:return t!=+t?e!=+e:t==+e;case nw:case gh:return t==e+"";case Ha:var s=aw;case Va:var u=i&ci;if(s||(s=C6),t.size!=e.size&&!u)return!1;var c=a.get(t);return c?c==e:(i|=lc,a.set(t,e),pw(s(t),s(e),n,o,i,a));case ow:if(ah)return ah.call(t)==ah.call(e)}return!1}function dI(t,e,r,n,o,i){var a=o&ci,s=hh(t),u=s.length,c=hh(e),l=c.length;if(u!=l&&!a)return!1;for(var f=u;f--;){var d=s[f];if(!(a?d in e:cw(e,d)))return!1}var h=i.get(t);if(h)return h==e;var m=!0;i.set(t,e);for(var b=a;++f<u;){d=s[f];var D=t[d],C=e[d];if(n)var E=a?n(C,D,d,e,t,i):n(D,C,d,t,e,i);if(!(E===void 0?D===C||r(D,C,n,o,i):E)){m=!1;break}b||(b=d=="constructor")}if(m&&!b){var g=t.constructor,_=e.constructor;g!=_&&"constructor"in t&&"constructor"in e&&!(typeof g=="function"&&g instanceof g&&typeof _=="function"&&_ instanceof _)&&(m=!1)}return i.delete(t),m}var hI=lw("length");function hc(t,e){var r=t.__data__;return bI(e)?r[typeof e=="string"?"string":"hash"]:r.map}function mI(t){for(var e=FI(t),r=e.length;r--;)e[r][2]=hw(e[r][1]);return e}function li(t,e){var r=t[e];return EI(r)?r:void 0}function gI(t){return A6(Object(t))}function Wr(t){return so.call(t)}(lh&&Wr(new lh(new ArrayBuffer(1)))!=sc||uc&&Wr(new uc)!=Ha||fh&&Wr(fh.resolve())!=Gv||ph&&Wr(new ph)!=Va||dh&&Wr(new dh)!=uh)&&(Wr=function(t){var e=so.call(t),r=e==si?t.constructor:void 0,n=r?co(r):void 0;if(n)switch(n){case k6:return sc;case $6:return Ha;case P6:return Gv;case T6:return Va;case I6:return uh}return e});function DI(t,e,r){e=mc(e,t)?[e]:fw(e);for(var n,o=-1,a=e.length;++o<a;){var i=gc(e[o]);if(!(n=t!=null&&r(t,i)))break;t=t[i]}if(n)return n;var a=t?t.length:0;return!!a&&Dc(a)&&dw(i,a)&&(bn(t)||bw(t)||gw(t))}function yI(t){var e=t?t.length:void 0;return Dc(e)&&(bn(t)||bw(t)||gw(t))?v6(e,String):null}function dw(t,e){return e=e??Xv,!!e&&(typeof t=="number"||d6.test(t))&&t>-1&&t%1==0&&t<e}function mc(t,e){if(bn(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||vw(t)?!0:l6.test(t)||!c6.test(t)||e!=null&&t in Object(e)}function bI(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function vI(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||pc;return t===r}function hw(t){return t===t&&!yc(t)}function mw(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}function gc(t){if(typeof t=="string"||vw(t))return t;var e=t+"";return e=="0"&&1/t==-ZT?"-0":e}function co(t){if(t!=null){try{return sw.call(t)}catch{}try{return t+""}catch{}}return""}function wI(t,e){return t===e||t!==t&&e!==e}function gw(t){return CI(t)&&oo.call(t,"callee")&&(!S6.call(t,"callee")||so.call(t)==ac)}var bn=Array.isArray;function Dw(t){return t!=null&&Dc(hI(t))&&!yw(t)}function CI(t){return Wa(t)&&Dw(t)}function yw(t){var e=yc(t)?so.call(t):"";return e==tw||e==QT}function Dc(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Xv}function yc(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function Wa(t){return!!t&&typeof t=="object"}function EI(t){if(!yc(t))return!1;var e=yw(t)||ch(t)?x6:p6;return e.test(co(t))}function bw(t){return typeof t=="string"||!bn(t)&&Wa(t)&&so.call(t)==gh}function vw(t){return typeof t=="symbol"||Wa(t)&&so.call(t)==ow}function _I(t){return Wa(t)&&Dc(t.length)&&!!Ie[so.call(t)]}function xI(t,e,r){var n=t==null?void 0:uw(t,e);return n===void 0?r:n}function SI(t,e){return t!=null&&DI(t,e,nI)}function hh(t){var e=vI(t);if(!(e||Dw(t)))return sI(t);var r=yI(t),n=!!r,o=r||[],i=o.length;for(var a in t)cw(t,a)&&!(n&&(a=="length"||dw(a,i)))&&!(e&&a=="constructor")&&o.push(a);return o}var FI=fI(hh);function AI(t){return t}function OI(t){return mc(t)?lw(gc(t)):lI(t)}ui.exports=aI});var Sw=x((lo,fi)=>{var kI=1/0,$I="[object Function]",PI="[object GeneratorFunction]",TI=/[\\^$.*+?()[\]{}|]/g,II=/^\[object .+?Constructor\]$/,Ka={function:!0,object:!0},RI=Ka[typeof lo]&&lo&&!lo.nodeType?lo:void 0,BI=Ka[typeof fi]&&fi&&!fi.nodeType?fi:void 0,jI=bc(RI&&BI&&typeof global=="object"&&global),NI=bc(Ka[typeof self]&&self),Cw=bc(Ka[typeof window]&&window),yh=bc(Ka[typeof lo]&&lo),LI=jI||Cw!==(yh&&yh.window)&&Cw||NI||yh||Function("return this")();function bc(t){return t&&t.Object===Object?t:null}function UI(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function MI(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var Ew=Object.prototype,_w=Function.prototype.toString,qI=Ew.hasOwnProperty,HI=Ew.toString,VI=RegExp("^"+_w.call(qI).replace(TI,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),bh=GI(LI,"Set"),zI=bh&&1/MI(new bh([,-0]))[1]==kI?function(t){return new bh(t)}:JI;function GI(t,e){var r=t[e];return YI(r)?r:void 0}function WI(t){if(t!=null){try{return _w.call(t)}catch{}try{return t+""}catch{}}return""}function KI(t){var e=xw(t)?HI.call(t):"";return e==$I||e==PI}function xw(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function YI(t){if(!xw(t))return!1;var e=KI(t)||UI(t)?VI:II;return e.test(WI(t))}function JI(){}fi.exports=zI});var Aw=x((fo,pi)=>{var Ya={function:!0,object:!0},XI=Ya[typeof fo]&&fo&&!fo.nodeType?fo:void 0,ZI=Ya[typeof pi]&&pi&&!pi.nodeType?pi:void 0,QI=vc(XI&&ZI&&typeof global=="object"&&global),e8=vc(Ya[typeof self]&&self),Fw=vc(Ya[typeof window]&&window),vh=vc(Ya[typeof fo]&&fo),t8=QI||Fw!==(vh&&vh.window)&&Fw||e8||vh||Function("return this")();function vc(t){return t&&t.Object===Object?t:null}pi.exports=t8});var Iw=x((mz,Tw)=>{var r8=Sw(),n8=Aw(),o8=200,wh="__lodash_hash_undefined__",i8="[object Function]",a8="[object GeneratorFunction]",s8=/[\\^$.*+?()[\]{}|]/g,u8=/^\[object .+?Constructor\]$/;function c8(t,e){return!!t.length&&f8(t,e,0)>-1}function l8(t,e,r){for(var n=-1,o=t.length;++n<o;)if(r(e,t[n]))return!0;return!1}function f8(t,e,r){if(e!==e)return d8(t,r);for(var n=r-1,o=t.length;++n<o;)if(t[n]===e)return n;return-1}function p8(t,e){return t.has(e)}function d8(t,e,r){for(var n=t.length,o=e+(r?0:-1);r?o--:++o<n;){var i=t[o];if(i!==i)return o}return-1}function h8(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function m8(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var g8=Array.prototype,Ow=Object.prototype,kw=Function.prototype.toString,Ch=Ow.hasOwnProperty,D8=Ow.toString,y8=RegExp("^"+kw.call(Ch).replace(s8,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),b8=g8.splice,v8=$w(n8,"Map"),Ja=$w(Object,"create");function po(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function w8(){this.__data__=Ja?Ja(null):{}}function C8(t){return this.has(t)&&delete this.__data__[t]}function E8(t){var e=this.__data__;if(Ja){var r=e[t];return r===wh?void 0:r}return Ch.call(e,t)?e[t]:void 0}function _8(t){var e=this.__data__;return Ja?e[t]!==void 0:Ch.call(e,t)}function x8(t,e){var r=this.__data__;return r[t]=Ja&&e===void 0?wh:e,this}po.prototype.clear=w8;po.prototype.delete=C8;po.prototype.get=E8;po.prototype.has=_8;po.prototype.set=x8;function di(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function S8(){this.__data__=[]}function F8(t){var e=this.__data__,r=Cc(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():b8.call(e,r,1),!0}function A8(t){var e=this.__data__,r=Cc(e,t);return r<0?void 0:e[r][1]}function O8(t){return Cc(this.__data__,t)>-1}function k8(t,e){var r=this.__data__,n=Cc(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}di.prototype.clear=S8;di.prototype.delete=F8;di.prototype.get=A8;di.prototype.has=O8;di.prototype.set=k8;function hi(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function $8(){this.__data__={hash:new po,map:new(v8||di),string:new po}}function P8(t){return Ec(this,t).delete(t)}function T8(t){return Ec(this,t).get(t)}function I8(t){return Ec(this,t).has(t)}function R8(t,e){return Ec(this,t).set(t,e),this}hi.prototype.clear=$8;hi.prototype.delete=P8;hi.prototype.get=T8;hi.prototype.has=I8;hi.prototype.set=R8;function wc(t){var e=-1,r=t?t.length:0;for(this.__data__=new hi;++e<r;)this.add(t[e])}function B8(t){return this.__data__.set(t,wh),this}function j8(t){return this.__data__.has(t)}wc.prototype.add=wc.prototype.push=B8;wc.prototype.has=j8;function Cc(t,e){for(var r=t.length;r--;)if(M8(t[r][0],e))return r;return-1}function N8(t,e,r){var n=-1,o=c8,i=t.length,a=!0,s=[],u=s;if(r)a=!1,o=l8;else if(i>=o8){var c=e?null:r8(t);if(c)return m8(c);a=!1,o=p8,u=new wc}else u=e?[]:s;e:for(;++n<i;){var l=t[n],f=e?e(l):l;if(l=r||l!==0?l:0,a&&f===f){for(var d=u.length;d--;)if(u[d]===f)continue e;e&&u.push(f),s.push(l)}else o(u,f,r)||(u!==s&&u.push(f),s.push(l))}return s}function Ec(t,e){var r=t.__data__;return L8(e)?r[typeof e=="string"?"string":"hash"]:r.map}function $w(t,e){var r=t[e];return H8(r)?r:void 0}function L8(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function U8(t){if(t!=null){try{return kw.call(t)}catch{}try{return t+""}catch{}}return""}function M8(t,e){return t===e||t!==t&&e!==e}function q8(t){var e=Pw(t)?D8.call(t):"";return e==i8||e==a8}function Pw(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function H8(t){if(!Pw(t))return!1;var e=q8(t)||h8(t)?y8:u8;return e.test(U8(t))}Tw.exports=N8});var Bw=x((gz,Rw)=>{var V8=ww(),z8=Iw();function G8(t,e){return t&&t.length?z8(t,V8(e)):[]}Rw.exports=G8});var Nw=x((Dz,jw)=>{"use strict";var W8=Tv(),K8=Bw(),Y8=W8("MultiError");jw.exports=Eh;function Eh(t){if(!(this instanceof Eh))return new Eh(t);if(t=Array.isArray(t)?t:[t],t=K8(t,function(r){return r.stack}),t.length===1)return t[0];var e=new Y8({message:t.map(function(r){return r.message}).join("; "),errors:t.reduce(function(r,n){return r.concat(n.errors||n)},[])});return e.__defineGetter__("stack",function(){return t.map(function(r){return r.stack}).join(`
39
+ `),Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,get:function(){return o},set:function(l){o=l,c()}}),Object.defineProperty(this,"message",{configurable:!0,enumerable:!0,get:function(){return a},set:function(l){a=l,c()}}),c())}});var Iw=x((vz,Tw)=>{"use strict";Tw.exports=Qn;Qn.factory=$w();var nh=Qn("CustomError");nh.order=Qn(nh,{message:"Arguments out of order.",code:"EOARG"});function Qn(t,e,r,n){var o,i;return e=nc(arguments,1,Error,Pw,[th,oc]),r=nc(arguments,2,{},th,[oc]),n=nc(arguments,3,rh,oc,[]),t=nc(arguments,0,e===Error?"Error":e.prototype.CustomError.name,eT,[Pw,th,oc]),i=e===Error,i&&n===rh&&(n=Qn.factory.root),o=function(a,s){var u,c,l,p,d,h;if(!(this instanceof o))return new o(a,s);for(delete this.constructor.name,Object.defineProperty(this.constructor,"name",{enumerable:!1,configurable:!0,value:t,writable:!1}),typeof a=="string"&&(a={message:a}),a||(a={}),c=this.CustomError.chain.slice(0).reverse().map(function(m){return m.properties}),c.push(a),c.unshift({}),h=Object.assign.apply(Object,c),u=this,l={},Object.keys(Qn.factory).forEach(function(m){l[m]=function(b,D){Qn.factory[m].call(u,b,D,l)}}),p=this.CustomError.chain.length-1;p>=0;p--)d=this.CustomError.chain[p],d.factory!==rh&&d.factory.call(this,h,s,l)},o.prototype=Object.create(e.prototype),o.prototype.constructor=o,o.prototype.name=t,o.prototype.CustomError={chain:i?[]:e.prototype.CustomError.chain.slice(0),factory:n,name:t,parent:e,properties:r},o.prototype.CustomError.chain.unshift(o.prototype.CustomError),o.prototype.toString=function(){var a=this.CustomError.chain[this.CustomError.chain.length-1].name;return this.code&&(a+=" "+this.code),this.message&&(a+=": "+this.message),a},o}function nc(t,e,r,n,o){var i=-1,a=-1,s,u,c=e<t.length?e:t.length,l;for(s=0;s<=c;s++){if(l=t[s],i===-1)for(u=0;u<o.length;u++)o[u](l)&&(i=s);a===-1&&n(l)&&(a=s)}if(a!==-1&&i!==-1&&i<a)throw new nh.order;return a!==-1?t[a]:r}function oc(t){return typeof t=="function"&&t!==Error&&!t.prototype.CustomError}function eT(t){return typeof t=="string"}function Pw(t){return typeof t=="function"&&(t===Error||t.prototype.CustomError)}function th(t){return t&&typeof t=="object"}function rh(){}});var Bw=x((Cz,Rw)=>{Rw.exports=Iw()});var Mw=x((eo,si)=>{var tT=1/0,rT="[object Symbol]",Ha={function:!0,object:!0},nT=Ha[typeof eo]&&eo&&!eo.nodeType?eo:void 0,oT=Ha[typeof si]&&si&&!si.nodeType?si:void 0,iT=ic(nT&&oT&&typeof global=="object"&&global),aT=ic(Ha[typeof self]&&self),jw=ic(Ha[typeof window]&&window),oh=ic(Ha[typeof eo]&&eo),sT=iT||jw!==(oh&&oh.window)&&jw||aT||oh||Function("return this")();function ic(t){return t&&t.Object===Object?t:null}var uT=Object.prototype,cT=uT.toString,Nw=sT.Symbol,Lw=Nw?Nw.prototype:void 0,Uw=Lw?Lw.toString:void 0;function lT(t){if(typeof t=="string")return t;if(pT(t))return Uw?Uw.call(t):"";var e=t+"";return e=="0"&&1/t==-tT?"-0":e}function fT(t){return!!t&&typeof t=="object"}function pT(t){return typeof t=="symbol"||fT(t)&&cT.call(t)==rT}si.exports=lT});var Kw=x((to,ui)=>{var dT=Mw(),hT="Expected a function",Hw="__lodash_hash_undefined__",mT="[object Function]",gT="[object GeneratorFunction]",DT=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g,yT=/[\\^$.*+?()[\]{}|]/g,bT=/\\(\\)?/g,wT=/^\[object .+?Constructor\]$/,za={function:!0,object:!0},vT=za[typeof to]&&to&&!to.nodeType?to:void 0,CT=za[typeof ui]&&ui&&!ui.nodeType?ui:void 0,ET=ac(vT&&CT&&typeof global=="object"&&global),_T=ac(za[typeof self]&&self),qw=ac(za[typeof window]&&window),ih=ac(za[typeof to]&&to),xT=ET||qw!==(ih&&ih.window)&&qw||_T||ih||Function("return this")();function ac(t){return t&&t.Object===Object?t:null}function ST(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}var FT=Array.prototype,Vw=Object.prototype,zw=Function.prototype.toString,ah=Vw.hasOwnProperty,AT=Vw.toString,OT=RegExp("^"+zw.call(ah).replace(yT,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),kT=FT.splice,$T=Gw(xT,"Map"),Va=Gw(Object,"create");function ro(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function PT(){this.__data__=Va?Va(null):{}}function TT(t){return this.has(t)&&delete this.__data__[t]}function IT(t){var e=this.__data__;if(Va){var r=e[t];return r===Hw?void 0:r}return ah.call(e,t)?e[t]:void 0}function RT(t){var e=this.__data__;return Va?e[t]!==void 0:ah.call(e,t)}function BT(t,e){var r=this.__data__;return r[t]=Va&&e===void 0?Hw:e,this}ro.prototype.clear=PT;ro.prototype.delete=TT;ro.prototype.get=IT;ro.prototype.has=RT;ro.prototype.set=BT;function ci(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function jT(){this.__data__=[]}function NT(t){var e=this.__data__,r=sc(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():kT.call(e,r,1),!0}function LT(t){var e=this.__data__,r=sc(e,t);return r<0?void 0:e[r][1]}function UT(t){return sc(this.__data__,t)>-1}function MT(t,e){var r=this.__data__,n=sc(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}ci.prototype.clear=jT;ci.prototype.delete=NT;ci.prototype.get=LT;ci.prototype.has=UT;ci.prototype.set=MT;function no(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function qT(){this.__data__={hash:new ro,map:new($T||ci),string:new ro}}function HT(t){return uc(this,t).delete(t)}function VT(t){return uc(this,t).get(t)}function zT(t){return uc(this,t).has(t)}function GT(t,e){return uc(this,t).set(t,e),this}no.prototype.clear=qT;no.prototype.delete=HT;no.prototype.get=VT;no.prototype.has=zT;no.prototype.set=GT;function sc(t,e){for(var r=t.length;r--;)if(JT(t[r][0],e))return r;return-1}function uc(t,e){var r=t.__data__;return WT(e)?r[typeof e=="string"?"string":"hash"]:r.map}function Gw(t,e){var r=t[e];return ZT(r)?r:void 0}function WT(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var KT=sh(function(t){var e=[];return QT(t).replace(DT,function(r,n,o,i){e.push(o?i.replace(bT,"$1"):n||r)}),e});function YT(t){if(t!=null){try{return zw.call(t)}catch{}try{return t+""}catch{}}return""}function sh(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(hT);var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var a=t.apply(this,n);return r.cache=i.set(o,a),a};return r.cache=new(sh.Cache||no),r}sh.Cache=no;function JT(t,e){return t===e||t!==t&&e!==e}function XT(t){var e=Ww(t)?AT.call(t):"";return e==mT||e==gT}function Ww(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function ZT(t){if(!Ww(t))return!1;var e=XT(t)||ST(t)?OT:wT;return e.test(YT(t))}function QT(t){return t==null?"":dT(t)}ui.exports=KT});var _v=x((oo,fi)=>{var e6=Kw(),t6=200,yh="__lodash_hash_undefined__",dc=1,pi=2,r6=1/0,ev=9007199254740991,cc="[object Arguments]",lh="[object Array]",tv="[object Boolean]",rv="[object Date]",nv="[object Error]",ov="[object Function]",n6="[object GeneratorFunction]",Ga="[object Map]",iv="[object Number]",li="[object Object]",Yw="[object Promise]",av="[object RegExp]",Wa="[object Set]",bh="[object String]",sv="[object Symbol]",fh="[object WeakMap]",uv="[object ArrayBuffer]",lc="[object DataView]",o6="[object Float32Array]",i6="[object Float64Array]",a6="[object Int8Array]",s6="[object Int16Array]",u6="[object Int32Array]",c6="[object Uint8Array]",l6="[object Uint8ClampedArray]",f6="[object Uint16Array]",p6="[object Uint32Array]",d6=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,h6=/^\w*$/,m6=/[\\^$.*+?()[\]{}|]/g,g6=/^\[object .+?Constructor\]$/,D6=/^(?:0|[1-9]\d*)$/,Be={};Be[o6]=Be[i6]=Be[a6]=Be[s6]=Be[u6]=Be[c6]=Be[l6]=Be[f6]=Be[p6]=!0;Be[cc]=Be[lh]=Be[uv]=Be[tv]=Be[lc]=Be[rv]=Be[nv]=Be[ov]=Be[Ga]=Be[iv]=Be[li]=Be[av]=Be[Wa]=Be[bh]=Be[fh]=!1;var Ya={function:!0,object:!0},y6=Ya[typeof oo]&&oo&&!oo.nodeType?oo:void 0,b6=Ya[typeof fi]&&fi&&!fi.nodeType?fi:void 0,w6=hc(y6&&b6&&typeof global=="object"&&global),v6=hc(Ya[typeof self]&&self),Jw=hc(Ya[typeof window]&&window),uh=hc(Ya[typeof oo]&&oo),so=w6||Jw!==(uh&&uh.window)&&Jw||v6||uh||Function("return this")();function C6(t,e){for(var r=-1,n=t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}function E6(t,e){for(var r=-1,n=t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}function _6(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function x6(t,e){return C6(e,function(r){return[r,t[r]]})}function hc(t){return t&&t.Object===Object?t:null}function ph(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function cv(t){var e=-1,r=Array(t.size);return t.forEach(function(n,o){r[++e]=[o,n]}),r}function S6(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}function F6(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=[n,n]}),r}var A6=Array.prototype,mc=Object.prototype,lv=Function.prototype.toString,io=mc.hasOwnProperty,uo=mc.toString,O6=RegExp("^"+lv.call(io).replace(m6,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Xw=so.Symbol,Zw=so.Uint8Array,k6=mc.propertyIsEnumerable,$6=A6.splice,P6=Object.getPrototypeOf,T6=Object.keys,dh=di(so,"DataView"),fc=di(so,"Map"),hh=di(so,"Promise"),mh=di(so,"Set"),gh=di(so,"WeakMap"),Ka=di(Object,"create"),I6=lo(dh),R6=lo(fc),B6=lo(hh),j6=lo(mh),N6=lo(gh),Qw=Xw?Xw.prototype:void 0,ch=Qw?Qw.valueOf:void 0;function ao(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function L6(){this.__data__=Ka?Ka(null):{}}function U6(t){return this.has(t)&&delete this.__data__[t]}function M6(t){var e=this.__data__;if(Ka){var r=e[t];return r===yh?void 0:r}return io.call(e,t)?e[t]:void 0}function q6(t){var e=this.__data__;return Ka?e[t]!==void 0:io.call(e,t)}function H6(t,e){var r=this.__data__;return r[t]=Ka&&e===void 0?yh:e,this}ao.prototype.clear=L6;ao.prototype.delete=U6;ao.prototype.get=M6;ao.prototype.has=q6;ao.prototype.set=H6;function Yr(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function V6(){this.__data__=[]}function z6(t){var e=this.__data__,r=gc(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():$6.call(e,r,1),!0}function G6(t){var e=this.__data__,r=gc(e,t);return r<0?void 0:e[r][1]}function W6(t){return gc(this.__data__,t)>-1}function K6(t,e){var r=this.__data__,n=gc(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}Yr.prototype.clear=V6;Yr.prototype.delete=z6;Yr.prototype.get=G6;Yr.prototype.has=W6;Yr.prototype.set=K6;function co(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Y6(){this.__data__={hash:new ao,map:new(fc||Yr),string:new ao}}function J6(t){return Dc(this,t).delete(t)}function X6(t){return Dc(this,t).get(t)}function Z6(t){return Dc(this,t).has(t)}function Q6(t,e){return Dc(this,t).set(t,e),this}co.prototype.clear=Y6;co.prototype.delete=J6;co.prototype.get=X6;co.prototype.has=Z6;co.prototype.set=Q6;function pc(t){var e=-1,r=t?t.length:0;for(this.__data__=new co;++e<r;)this.add(t[e])}function eI(t){return this.__data__.set(t,yh),this}function tI(t){return this.__data__.has(t)}pc.prototype.add=pc.prototype.push=eI;pc.prototype.has=tI;function Kr(t){this.__data__=new Yr(t)}function rI(){this.__data__=new Yr}function nI(t){return this.__data__.delete(t)}function oI(t){return this.__data__.get(t)}function iI(t){return this.__data__.has(t)}function aI(t,e){var r=this.__data__;return r instanceof Yr&&r.__data__.length==t6&&(r=this.__data__=new co(r.__data__)),r.set(t,e),this}Kr.prototype.clear=rI;Kr.prototype.delete=nI;Kr.prototype.get=oI;Kr.prototype.has=iI;Kr.prototype.set=aI;function gc(t,e){for(var r=t.length;r--;)if(xI(t[r][0],e))return r;return-1}function fv(t,e){e=yc(e,t)?[e]:hv(e);for(var r=0,n=e.length;t!=null&&r<n;)t=t[bc(e[r++])];return r&&r==n?t:void 0}function pv(t,e){return io.call(t,e)||typeof t=="object"&&e in t&&wI(t)===null}function sI(t,e){return e in Object(t)}function wh(t,e,r,n,o){return t===e?!0:t==null||e==null||!vc(t)&&!Ja(e)?t!==t&&e!==e:uI(t,e,wh,r,n,o)}function uI(t,e,r,n,o,i){var a=wn(t),s=wn(e),u=lh,c=lh;a||(u=Wr(t),u=u==cc?li:u),s||(c=Wr(e),c=c==cc?li:c);var l=u==li&&!ph(t),p=c==li&&!ph(e),d=u==c;if(d&&!l)return i||(i=new Kr),a||AI(t)?mv(t,e,r,n,o,i):gI(t,e,u,r,n,o,i);if(!(o&pi)){var h=l&&io.call(t,"__wrapped__"),m=p&&io.call(e,"__wrapped__");if(h||m){var b=h?t.value():t,D=m?e.value():e;return i||(i=new Kr),r(b,D,n,o,i)}}return d?(i||(i=new Kr),DI(t,e,r,n,o,i)):!1}function cI(t,e,r,n){var o=r.length,i=o,a=!n;if(t==null)return!i;for(t=Object(t);o--;){var s=r[o];if(a&&s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++o<i;){s=r[o];var u=s[0],c=t[u],l=s[1];if(a&&s[2]){if(c===void 0&&!(u in t))return!1}else{var p=new Kr;if(n)var d=n(c,l,u,t,e,p);if(!(d===void 0?wh(l,c,n,dc|pi,p):d))return!1}}return!0}function lI(t){return typeof t=="function"?t:t==null?PI:typeof t=="object"?wn(t)?dI(t[0],t[1]):pI(t):TI(t)}function fI(t){return T6(Object(t))}function pI(t){var e=bI(t);return e.length==1&&e[0][2]?yv(e[0][0],e[0][1]):function(r){return r===t||cI(r,t,e)}}function dI(t,e){return yc(t)&&Dv(e)?yv(bc(t),e):function(r){var n=OI(r,t);return n===void 0&&n===e?kI(r,t):wh(e,n,void 0,dc|pi)}}function dv(t){return function(e){return e?.[t]}}function hI(t){return function(e){return fv(e,t)}}function hv(t){return wn(t)?t:e6(t)}function mI(t){return function(e){var r=Wr(e);return r==Ga?cv(e):r==Wa?F6(e):x6(e,t(e))}}function mv(t,e,r,n,o,i){var a=o&pi,s=t.length,u=e.length;if(s!=u&&!(a&&u>s))return!1;var c=i.get(t);if(c)return c==e;var l=-1,p=!0,d=o&dc?new pc:void 0;for(i.set(t,e);++l<s;){var h=t[l],m=e[l];if(n)var b=a?n(m,h,l,e,t,i):n(h,m,l,t,e,i);if(b!==void 0){if(b)continue;p=!1;break}if(d){if(!E6(e,function(D,C){if(!d.has(C)&&(h===D||r(h,D,n,o,i)))return d.add(C)})){p=!1;break}}else if(!(h===m||r(h,m,n,o,i))){p=!1;break}}return i.delete(t),p}function gI(t,e,r,n,o,i,a){switch(r){case lc:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case uv:return!(t.byteLength!=e.byteLength||!n(new Zw(t),new Zw(e)));case tv:case rv:return+t==+e;case nv:return t.name==e.name&&t.message==e.message;case iv:return t!=+t?e!=+e:t==+e;case av:case bh:return t==e+"";case Ga:var s=cv;case Wa:var u=i&pi;if(s||(s=S6),t.size!=e.size&&!u)return!1;var c=a.get(t);return c?c==e:(i|=dc,a.set(t,e),mv(s(t),s(e),n,o,i,a));case sv:if(ch)return ch.call(t)==ch.call(e)}return!1}function DI(t,e,r,n,o,i){var a=o&pi,s=Dh(t),u=s.length,c=Dh(e),l=c.length;if(u!=l&&!a)return!1;for(var p=u;p--;){var d=s[p];if(!(a?d in e:pv(e,d)))return!1}var h=i.get(t);if(h)return h==e;var m=!0;i.set(t,e);for(var b=a;++p<u;){d=s[p];var D=t[d],C=e[d];if(n)var E=a?n(C,D,d,e,t,i):n(D,C,d,t,e,i);if(!(E===void 0?D===C||r(D,C,n,o,i):E)){m=!1;break}b||(b=d=="constructor")}if(m&&!b){var g=t.constructor,_=e.constructor;g!=_&&"constructor"in t&&"constructor"in e&&!(typeof g=="function"&&g instanceof g&&typeof _=="function"&&_ instanceof _)&&(m=!1)}return i.delete(t),m}var yI=dv("length");function Dc(t,e){var r=t.__data__;return EI(e)?r[typeof e=="string"?"string":"hash"]:r.map}function bI(t){for(var e=$I(t),r=e.length;r--;)e[r][2]=Dv(e[r][1]);return e}function di(t,e){var r=t[e];return FI(r)?r:void 0}function wI(t){return P6(Object(t))}function Wr(t){return uo.call(t)}(dh&&Wr(new dh(new ArrayBuffer(1)))!=lc||fc&&Wr(new fc)!=Ga||hh&&Wr(hh.resolve())!=Yw||mh&&Wr(new mh)!=Wa||gh&&Wr(new gh)!=fh)&&(Wr=function(t){var e=uo.call(t),r=e==li?t.constructor:void 0,n=r?lo(r):void 0;if(n)switch(n){case I6:return lc;case R6:return Ga;case B6:return Yw;case j6:return Wa;case N6:return fh}return e});function vI(t,e,r){e=yc(e,t)?[e]:hv(e);for(var n,o=-1,a=e.length;++o<a;){var i=bc(e[o]);if(!(n=t!=null&&r(t,i)))break;t=t[i]}if(n)return n;var a=t?t.length:0;return!!a&&wc(a)&&gv(i,a)&&(wn(t)||Cv(t)||bv(t))}function CI(t){var e=t?t.length:void 0;return wc(e)&&(wn(t)||Cv(t)||bv(t))?_6(e,String):null}function gv(t,e){return e=e??ev,!!e&&(typeof t=="number"||D6.test(t))&&t>-1&&t%1==0&&t<e}function yc(t,e){if(wn(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||Ev(t)?!0:h6.test(t)||!d6.test(t)||e!=null&&t in Object(e)}function EI(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function _I(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||mc;return t===r}function Dv(t){return t===t&&!vc(t)}function yv(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}function bc(t){if(typeof t=="string"||Ev(t))return t;var e=t+"";return e=="0"&&1/t==-r6?"-0":e}function lo(t){if(t!=null){try{return lv.call(t)}catch{}try{return t+""}catch{}}return""}function xI(t,e){return t===e||t!==t&&e!==e}function bv(t){return SI(t)&&io.call(t,"callee")&&(!k6.call(t,"callee")||uo.call(t)==cc)}var wn=Array.isArray;function wv(t){return t!=null&&wc(yI(t))&&!vv(t)}function SI(t){return Ja(t)&&wv(t)}function vv(t){var e=vc(t)?uo.call(t):"";return e==ov||e==n6}function wc(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=ev}function vc(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function Ja(t){return!!t&&typeof t=="object"}function FI(t){if(!vc(t))return!1;var e=vv(t)||ph(t)?O6:g6;return e.test(lo(t))}function Cv(t){return typeof t=="string"||!wn(t)&&Ja(t)&&uo.call(t)==bh}function Ev(t){return typeof t=="symbol"||Ja(t)&&uo.call(t)==sv}function AI(t){return Ja(t)&&wc(t.length)&&!!Be[uo.call(t)]}function OI(t,e,r){var n=t==null?void 0:fv(t,e);return n===void 0?r:n}function kI(t,e){return t!=null&&vI(t,e,sI)}function Dh(t){var e=_I(t);if(!(e||wv(t)))return fI(t);var r=CI(t),n=!!r,o=r||[],i=o.length;for(var a in t)pv(t,a)&&!(n&&(a=="length"||gv(a,i)))&&!(e&&a=="constructor")&&o.push(a);return o}var $I=mI(Dh);function PI(t){return t}function TI(t){return yc(t)?dv(bc(t)):hI(t)}fi.exports=lI});var Ov=x((fo,hi)=>{var II=1/0,RI="[object Function]",BI="[object GeneratorFunction]",jI=/[\\^$.*+?()[\]{}|]/g,NI=/^\[object .+?Constructor\]$/,Xa={function:!0,object:!0},LI=Xa[typeof fo]&&fo&&!fo.nodeType?fo:void 0,UI=Xa[typeof hi]&&hi&&!hi.nodeType?hi:void 0,MI=Cc(LI&&UI&&typeof global=="object"&&global),qI=Cc(Xa[typeof self]&&self),xv=Cc(Xa[typeof window]&&window),vh=Cc(Xa[typeof fo]&&fo),HI=MI||xv!==(vh&&vh.window)&&xv||qI||vh||Function("return this")();function Cc(t){return t&&t.Object===Object?t:null}function VI(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function zI(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var Sv=Object.prototype,Fv=Function.prototype.toString,GI=Sv.hasOwnProperty,WI=Sv.toString,KI=RegExp("^"+Fv.call(GI).replace(jI,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ch=JI(HI,"Set"),YI=Ch&&1/zI(new Ch([,-0]))[1]==II?function(t){return new Ch(t)}:eR;function JI(t,e){var r=t[e];return QI(r)?r:void 0}function XI(t){if(t!=null){try{return Fv.call(t)}catch{}try{return t+""}catch{}}return""}function ZI(t){var e=Av(t)?WI.call(t):"";return e==RI||e==BI}function Av(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function QI(t){if(!Av(t))return!1;var e=ZI(t)||VI(t)?KI:NI;return e.test(XI(t))}function eR(){}hi.exports=YI});var $v=x((po,mi)=>{var Za={function:!0,object:!0},tR=Za[typeof po]&&po&&!po.nodeType?po:void 0,rR=Za[typeof mi]&&mi&&!mi.nodeType?mi:void 0,nR=Ec(tR&&rR&&typeof global=="object"&&global),oR=Ec(Za[typeof self]&&self),kv=Ec(Za[typeof window]&&window),Eh=Ec(Za[typeof po]&&po),iR=nR||kv!==(Eh&&Eh.window)&&kv||oR||Eh||Function("return this")();function Ec(t){return t&&t.Object===Object?t:null}mi.exports=iR});var jv=x((Ez,Bv)=>{var aR=Ov(),sR=$v(),uR=200,_h="__lodash_hash_undefined__",cR="[object Function]",lR="[object GeneratorFunction]",fR=/[\\^$.*+?()[\]{}|]/g,pR=/^\[object .+?Constructor\]$/;function dR(t,e){return!!t.length&&mR(t,e,0)>-1}function hR(t,e,r){for(var n=-1,o=t.length;++n<o;)if(r(e,t[n]))return!0;return!1}function mR(t,e,r){if(e!==e)return DR(t,r);for(var n=r-1,o=t.length;++n<o;)if(t[n]===e)return n;return-1}function gR(t,e){return t.has(e)}function DR(t,e,r){for(var n=t.length,o=e+(r?0:-1);r?o--:++o<n;){var i=t[o];if(i!==i)return o}return-1}function yR(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function bR(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var wR=Array.prototype,Pv=Object.prototype,Tv=Function.prototype.toString,xh=Pv.hasOwnProperty,vR=Pv.toString,CR=RegExp("^"+Tv.call(xh).replace(fR,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ER=wR.splice,_R=Iv(sR,"Map"),Qa=Iv(Object,"create");function ho(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function xR(){this.__data__=Qa?Qa(null):{}}function SR(t){return this.has(t)&&delete this.__data__[t]}function FR(t){var e=this.__data__;if(Qa){var r=e[t];return r===_h?void 0:r}return xh.call(e,t)?e[t]:void 0}function AR(t){var e=this.__data__;return Qa?e[t]!==void 0:xh.call(e,t)}function OR(t,e){var r=this.__data__;return r[t]=Qa&&e===void 0?_h:e,this}ho.prototype.clear=xR;ho.prototype.delete=SR;ho.prototype.get=FR;ho.prototype.has=AR;ho.prototype.set=OR;function gi(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function kR(){this.__data__=[]}function $R(t){var e=this.__data__,r=xc(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():ER.call(e,r,1),!0}function PR(t){var e=this.__data__,r=xc(e,t);return r<0?void 0:e[r][1]}function TR(t){return xc(this.__data__,t)>-1}function IR(t,e){var r=this.__data__,n=xc(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}gi.prototype.clear=kR;gi.prototype.delete=$R;gi.prototype.get=PR;gi.prototype.has=TR;gi.prototype.set=IR;function Di(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function RR(){this.__data__={hash:new ho,map:new(_R||gi),string:new ho}}function BR(t){return Sc(this,t).delete(t)}function jR(t){return Sc(this,t).get(t)}function NR(t){return Sc(this,t).has(t)}function LR(t,e){return Sc(this,t).set(t,e),this}Di.prototype.clear=RR;Di.prototype.delete=BR;Di.prototype.get=jR;Di.prototype.has=NR;Di.prototype.set=LR;function _c(t){var e=-1,r=t?t.length:0;for(this.__data__=new Di;++e<r;)this.add(t[e])}function UR(t){return this.__data__.set(t,_h),this}function MR(t){return this.__data__.has(t)}_c.prototype.add=_c.prototype.push=UR;_c.prototype.has=MR;function xc(t,e){for(var r=t.length;r--;)if(zR(t[r][0],e))return r;return-1}function qR(t,e,r){var n=-1,o=dR,i=t.length,a=!0,s=[],u=s;if(r)a=!1,o=hR;else if(i>=uR){var c=e?null:aR(t);if(c)return bR(c);a=!1,o=gR,u=new _c}else u=e?[]:s;e:for(;++n<i;){var l=t[n],p=e?e(l):l;if(l=r||l!==0?l:0,a&&p===p){for(var d=u.length;d--;)if(u[d]===p)continue e;e&&u.push(p),s.push(l)}else o(u,p,r)||(u!==s&&u.push(p),s.push(l))}return s}function Sc(t,e){var r=t.__data__;return HR(e)?r[typeof e=="string"?"string":"hash"]:r.map}function Iv(t,e){var r=t[e];return WR(r)?r:void 0}function HR(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function VR(t){if(t!=null){try{return Tv.call(t)}catch{}try{return t+""}catch{}}return""}function zR(t,e){return t===e||t!==t&&e!==e}function GR(t){var e=Rv(t)?vR.call(t):"";return e==cR||e==lR}function Rv(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function WR(t){if(!Rv(t))return!1;var e=GR(t)||yR(t)?CR:pR;return e.test(VR(t))}Bv.exports=qR});var Lv=x((_z,Nv)=>{var KR=_v(),YR=jv();function JR(t,e){return t&&t.length?YR(t,KR(e)):[]}Nv.exports=JR});var Mv=x((xz,Uv)=>{"use strict";var XR=Bw(),ZR=Lv(),QR=XR("MultiError");Uv.exports=Sh;function Sh(t){if(!(this instanceof Sh))return new Sh(t);if(t=Array.isArray(t)?t:[t],t=ZR(t,function(r){return r.stack}),t.length===1)return t[0];var e=new QR({message:t.map(function(r){return r.message}).join("; "),errors:t.reduce(function(r,n){return r.concat(n.errors||n)},[])});return e.__defineGetter__("stack",function(){return t.map(function(r){return r.stack}).join(`
40
40
 
41
41
  `)}),e.__defineSetter__("stack",function(r){return[r].concat(e.stack).join(`
42
42
 
43
- `)}),e}});var Uw=x((yz,Lw)=>{var vn=require("constants"),J8=process.cwd,_c=null,X8=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return _c||(_c=J8.call(process)),_c};try{process.cwd()}catch{}typeof process.chdir=="function"&&(_h=process.chdir,process.chdir=function(t){_c=null,_h.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,_h));var _h;Lw.exports=Z8;function Z8(t){vn.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&e(t),t.lutimes||r(t),t.chown=i(t.chown),t.fchown=i(t.fchown),t.lchown=i(t.lchown),t.chmod=n(t.chmod),t.fchmod=n(t.fchmod),t.lchmod=n(t.lchmod),t.chownSync=a(t.chownSync),t.fchownSync=a(t.fchownSync),t.lchownSync=a(t.lchownSync),t.chmodSync=o(t.chmodSync),t.fchmodSync=o(t.fchmodSync),t.lchmodSync=o(t.lchmodSync),t.stat=s(t.stat),t.fstat=s(t.fstat),t.lstat=s(t.lstat),t.statSync=u(t.statSync),t.fstatSync=u(t.fstatSync),t.lstatSync=u(t.lstatSync),t.chmod&&!t.lchmod&&(t.lchmod=function(l,f,d){d&&process.nextTick(d)},t.lchmodSync=function(){}),t.chown&&!t.lchown&&(t.lchown=function(l,f,d,h){h&&process.nextTick(h)},t.lchownSync=function(){}),X8==="win32"&&(t.rename=typeof t.rename!="function"?t.rename:(function(l){function f(d,h,m){var b=Date.now(),D=0;l(d,h,function C(E){if(E&&(E.code==="EACCES"||E.code==="EPERM"||E.code==="EBUSY")&&Date.now()-b<6e4){setTimeout(function(){t.stat(h,function(g,_){g&&g.code==="ENOENT"?l(d,h,C):m(E)})},D),D<100&&(D+=10);return}m&&m(E)})}return Object.setPrototypeOf&&Object.setPrototypeOf(f,l),f})(t.rename)),t.read=typeof t.read!="function"?t.read:(function(l){function f(d,h,m,b,D,C){var E;if(C&&typeof C=="function"){var g=0;E=function(_,S,I){if(_&&_.code==="EAGAIN"&&g<10)return g++,l.call(t,d,h,m,b,D,E);C.apply(this,arguments)}}return l.call(t,d,h,m,b,D,E)}return Object.setPrototypeOf&&Object.setPrototypeOf(f,l),f})(t.read),t.readSync=typeof t.readSync!="function"?t.readSync:(function(l){return function(f,d,h,m,b){for(var D=0;;)try{return l.call(t,f,d,h,m,b)}catch(C){if(C.code==="EAGAIN"&&D<10){D++;continue}throw C}}})(t.readSync);function e(l){l.lchmod=function(f,d,h){l.open(f,vn.O_WRONLY|vn.O_SYMLINK,d,function(m,b){if(m){h&&h(m);return}l.fchmod(b,d,function(D){l.close(b,function(C){h&&h(D||C)})})})},l.lchmodSync=function(f,d){var h=l.openSync(f,vn.O_WRONLY|vn.O_SYMLINK,d),m=!0,b;try{b=l.fchmodSync(h,d),m=!1}finally{if(m)try{l.closeSync(h)}catch{}else l.closeSync(h)}return b}}function r(l){vn.hasOwnProperty("O_SYMLINK")&&l.futimes?(l.lutimes=function(f,d,h,m){l.open(f,vn.O_SYMLINK,function(b,D){if(b){m&&m(b);return}l.futimes(D,d,h,function(C){l.close(D,function(E){m&&m(C||E)})})})},l.lutimesSync=function(f,d,h){var m=l.openSync(f,vn.O_SYMLINK),b,D=!0;try{b=l.futimesSync(m,d,h),D=!1}finally{if(D)try{l.closeSync(m)}catch{}else l.closeSync(m)}return b}):l.futimes&&(l.lutimes=function(f,d,h,m){m&&process.nextTick(m)},l.lutimesSync=function(){})}function n(l){return l&&function(f,d,h){return l.call(t,f,d,function(m){c(m)&&(m=null),h&&h.apply(this,arguments)})}}function o(l){return l&&function(f,d){try{return l.call(t,f,d)}catch(h){if(!c(h))throw h}}}function i(l){return l&&function(f,d,h,m){return l.call(t,f,d,h,function(b){c(b)&&(b=null),m&&m.apply(this,arguments)})}}function a(l){return l&&function(f,d,h){try{return l.call(t,f,d,h)}catch(m){if(!c(m))throw m}}}function s(l){return l&&function(f,d,h){typeof d=="function"&&(h=d,d=null);function m(b,D){D&&(D.uid<0&&(D.uid+=4294967296),D.gid<0&&(D.gid+=4294967296)),h&&h.apply(this,arguments)}return d?l.call(t,f,d,m):l.call(t,f,m)}}function u(l){return l&&function(f,d){var h=d?l.call(t,f,d):l.call(t,f);return h&&(h.uid<0&&(h.uid+=4294967296),h.gid<0&&(h.gid+=4294967296)),h}}function c(l){if(!l||l.code==="ENOSYS")return!0;var f=!process.getuid||process.getuid()!==0;return!!(f&&(l.code==="EINVAL"||l.code==="EPERM"))}}});var Hw=x((bz,qw)=>{var Mw=require("stream").Stream;qw.exports=Q8;function Q8(t){return{ReadStream:e,WriteStream:r};function e(n,o){if(!(this instanceof e))return new e(n,o);Mw.call(this);var i=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,o=o||{};for(var a=Object.keys(o),s=0,u=a.length;s<u;s++){var c=a[s];this[c]=o[c]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){i._read()});return}t.open(this.path,this.flags,this.mode,function(l,f){if(l){i.emit("error",l),i.readable=!1;return}i.fd=f,i.emit("open",f),i._read()})}function r(n,o){if(!(this instanceof r))return new r(n,o);Mw.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,o=o||{};for(var i=Object.keys(o),a=0,s=i.length;a<s;a++){var u=i[a];this[u]=o[u]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=t.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}});var zw=x((vz,Vw)=>{"use strict";Vw.exports=tR;var eR=Object.getPrototypeOf||function(t){return t.__proto__};function tR(t){if(t===null||typeof t!="object")return t;if(t instanceof Object)var e={__proto__:eR(t)};else var e=Object.create(null);return Object.getOwnPropertyNames(t).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}});var wn=x((wz,Fh)=>{var He=require("fs"),rR=Uw(),nR=Hw(),oR=zw(),xc=require("util"),ht,Fc;typeof Symbol=="function"&&typeof Symbol.for=="function"?(ht=Symbol.for("graceful-fs.queue"),Fc=Symbol.for("graceful-fs.previous")):(ht="___graceful-fs.queue",Fc="___graceful-fs.previous");function iR(){}function Kw(t,e){Object.defineProperty(t,ht,{get:function(){return e}})}var ho=iR;xc.debuglog?ho=xc.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(ho=function(){var t=xc.format.apply(xc,arguments);t="GFS4: "+t.split(/\n/).join(`
44
- GFS4: `),console.error(t)});He[ht]||(Gw=global[ht]||[],Kw(He,Gw),He.close=(function(t){function e(r,n){return t.call(He,r,function(o){o||Ww(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(e,Fc,{value:t}),e})(He.close),He.closeSync=(function(t){function e(r){t.apply(He,arguments),Ww()}return Object.defineProperty(e,Fc,{value:t}),e})(He.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){ho(He[ht]),require("assert").equal(He[ht].length,0)}));var Gw;global[ht]||Kw(global,He[ht]);Fh.exports=xh(oR(He));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!He.__patched&&(Fh.exports=xh(He),He.__patched=!0);function xh(t){rR(t),t.gracefulify=xh,t.createReadStream=S,t.createWriteStream=I;var e=t.readFile;t.readFile=r;function r(R,N,A){return typeof N=="function"&&(A=N,N=null),L(R,N,A);function L(q,Q,$,y){return e(q,Q,function(v){v&&(v.code==="EMFILE"||v.code==="ENFILE")?mi([L,[q,Q,$],v,y||Date.now(),Date.now()]):typeof $=="function"&&$.apply(this,arguments)})}}var n=t.writeFile;t.writeFile=o;function o(R,N,A,L){return typeof A=="function"&&(L=A,A=null),q(R,N,A,L);function q(Q,$,y,v,w){return n(Q,$,y,function(F){F&&(F.code==="EMFILE"||F.code==="ENFILE")?mi([q,[Q,$,y,v],F,w||Date.now(),Date.now()]):typeof v=="function"&&v.apply(this,arguments)})}}var i=t.appendFile;i&&(t.appendFile=a);function a(R,N,A,L){return typeof A=="function"&&(L=A,A=null),q(R,N,A,L);function q(Q,$,y,v,w){return i(Q,$,y,function(F){F&&(F.code==="EMFILE"||F.code==="ENFILE")?mi([q,[Q,$,y,v],F,w||Date.now(),Date.now()]):typeof v=="function"&&v.apply(this,arguments)})}}var s=t.copyFile;s&&(t.copyFile=u);function u(R,N,A,L){return typeof A=="function"&&(L=A,A=0),q(R,N,A,L);function q(Q,$,y,v,w){return s(Q,$,y,function(F){F&&(F.code==="EMFILE"||F.code==="ENFILE")?mi([q,[Q,$,y,v],F,w||Date.now(),Date.now()]):typeof v=="function"&&v.apply(this,arguments)})}}var c=t.readdir;t.readdir=f;var l=/^v[0-5]\./;function f(R,N,A){typeof N=="function"&&(A=N,N=null);var L=l.test(process.version)?function($,y,v,w){return c($,q($,y,v,w))}:function($,y,v,w){return c($,y,q($,y,v,w))};return L(R,N,A);function q(Q,$,y,v){return function(w,F){w&&(w.code==="EMFILE"||w.code==="ENFILE")?mi([L,[Q,$,y],w,v||Date.now(),Date.now()]):(F&&F.sort&&F.sort(),typeof y=="function"&&y.call(this,w,F))}}}if(process.version.substr(0,4)==="v0.8"){var d=nR(t);C=d.ReadStream,g=d.WriteStream}var h=t.ReadStream;h&&(C.prototype=Object.create(h.prototype),C.prototype.open=E);var m=t.WriteStream;m&&(g.prototype=Object.create(m.prototype),g.prototype.open=_),Object.defineProperty(t,"ReadStream",{get:function(){return C},set:function(R){C=R},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WriteStream",{get:function(){return g},set:function(R){g=R},enumerable:!0,configurable:!0});var b=C;Object.defineProperty(t,"FileReadStream",{get:function(){return b},set:function(R){b=R},enumerable:!0,configurable:!0});var D=g;Object.defineProperty(t,"FileWriteStream",{get:function(){return D},set:function(R){D=R},enumerable:!0,configurable:!0});function C(R,N){return this instanceof C?(h.apply(this,arguments),this):C.apply(Object.create(C.prototype),arguments)}function E(){var R=this;B(R.path,R.flags,R.mode,function(N,A){N?(R.autoClose&&R.destroy(),R.emit("error",N)):(R.fd=A,R.emit("open",A),R.read())})}function g(R,N){return this instanceof g?(m.apply(this,arguments),this):g.apply(Object.create(g.prototype),arguments)}function _(){var R=this;B(R.path,R.flags,R.mode,function(N,A){N?(R.destroy(),R.emit("error",N)):(R.fd=A,R.emit("open",A))})}function S(R,N){return new t.ReadStream(R,N)}function I(R,N){return new t.WriteStream(R,N)}var O=t.open;t.open=B;function B(R,N,A,L){return typeof A=="function"&&(L=A,A=null),q(R,N,A,L);function q(Q,$,y,v,w){return O(Q,$,y,function(F,T){F&&(F.code==="EMFILE"||F.code==="ENFILE")?mi([q,[Q,$,y,v],F,w||Date.now(),Date.now()]):typeof v=="function"&&v.apply(this,arguments)})}}return t}function mi(t){ho("ENQUEUE",t[0].name,t[1]),He[ht].push(t),Sh()}var Sc;function Ww(){for(var t=Date.now(),e=0;e<He[ht].length;++e)He[ht][e].length>2&&(He[ht][e][3]=t,He[ht][e][4]=t);Sh()}function Sh(){if(clearTimeout(Sc),Sc=void 0,He[ht].length!==0){var t=He[ht].shift(),e=t[0],r=t[1],n=t[2],o=t[3],i=t[4];if(o===void 0)ho("RETRY",e.name,r),e.apply(null,r);else if(Date.now()-o>=6e4){ho("TIMEOUT",e.name,r);var a=r.pop();typeof a=="function"&&a.call(null,n)}else{var s=Date.now()-i,u=Math.max(i-o,1),c=Math.min(u*1.2,100);s>=c?(ho("RETRY",e.name,r),e.apply(null,r.concat([o]))):He[ht].push(t)}Sc===void 0&&(Sc=setTimeout(Sh,0))}}});var Jw=x((Cz,Yw)=>{function nr(t,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}Yw.exports=nr;nr.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};nr.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};nr.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=new Date().getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var r=this._timeouts.shift();if(r===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),r=this._timeouts.shift();else return!1;var n=this,o=setTimeout(function(){n._attempts++,n._operationTimeoutCb&&(n._timeout=setTimeout(function(){n._operationTimeoutCb(n._attempts)},n._operationTimeout),n._options.unref&&n._timeout.unref()),n._fn(n._attempts)},r);return this._options.unref&&o.unref(),!0};nr.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){r._operationTimeoutCb()},r._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};nr.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};nr.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};nr.prototype.start=nr.prototype.try;nr.prototype.errors=function(){return this._errors};nr.prototype.attempts=function(){return this._attempts};nr.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},e=null,r=0,n=0;n<this._errors.length;n++){var o=this._errors[n],i=o.message,a=(t[i]||0)+1;t[i]=a,a>=r&&(e=o,r=a)}return e}});var Xw=x(mo=>{var aR=Jw();mo.operation=function(t){var e=mo.timeouts(t);return new aR(e,{forever:t&&t.forever,unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};mo.timeouts=function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var r in t)e[r]=t[r];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var n=[],o=0;o<e.retries;o++)n.push(this.createTimeout(o,e));return t&&t.forever&&!n.length&&n.push(this.createTimeout(o,e)),n.sort(function(i,a){return i-a}),n};mo.createTimeout=function(t,e){var r=e.randomize?Math.random()+1:1,n=Math.round(r*e.minTimeout*Math.pow(e.factor,t));return n=Math.min(n,e.maxTimeout),n};mo.wrap=function(t,e,r){if(e instanceof Array&&(r=e,e=null),!r){r=[];for(var n in t)typeof t[n]=="function"&&r.push(n)}for(var o=0;o<r.length;o++){var i=r[o],a=t[i];t[i]=function(u){var c=mo.operation(e),l=Array.prototype.slice.call(arguments,1),f=l.pop();l.push(function(d){c.retry(d)||(d&&(arguments[0]=c.mainError()),f.apply(this,arguments))}),c.attempt(function(){u.apply(t,l)})}.bind(t,a),t[i].options=e}}});var Qw=x((_z,Zw)=>{Zw.exports=Xw()});var eC=x((xz,Ac)=>{Ac.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&Ac.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Ac.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var kh=x((Sz,yi)=>{var je=global.process,go=function(t){return t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function"};go(je)?(tC=require("assert"),gi=eC(),rC=/^win/i.test(je.platform),Xa=require("events"),typeof Xa!="function"&&(Xa=Xa.EventEmitter),je.__signal_exit_emitter__?nt=je.__signal_exit_emitter__:(nt=je.__signal_exit_emitter__=new Xa,nt.count=0,nt.emitted={}),nt.infinite||(nt.setMaxListeners(1/0),nt.infinite=!0),yi.exports=function(t,e){if(!go(global.process))return function(){};tC.equal(typeof t,"function","a callback must be provided for exit handler"),Di===!1&&Ah();var r="exit";e&&e.alwaysLast&&(r="afterexit");var n=function(){nt.removeListener(r,t),nt.listeners("exit").length===0&&nt.listeners("afterexit").length===0&&Oc()};return nt.on(r,t),n},Oc=function(){!Di||!go(global.process)||(Di=!1,gi.forEach(function(e){try{je.removeListener(e,kc[e])}catch{}}),je.emit=$c,je.reallyExit=Oh,nt.count-=1)},yi.exports.unload=Oc,Do=function(e,r,n){nt.emitted[e]||(nt.emitted[e]=!0,nt.emit(e,r,n))},kc={},gi.forEach(function(t){kc[t]=function(){if(go(global.process)){var r=je.listeners(t);r.length===nt.count&&(Oc(),Do("exit",null,t),Do("afterexit",null,t),rC&&t==="SIGHUP"&&(t="SIGINT"),je.kill(je.pid,t))}}}),yi.exports.signals=function(){return gi},Di=!1,Ah=function(){Di||!go(global.process)||(Di=!0,nt.count+=1,gi=gi.filter(function(e){try{return je.on(e,kc[e]),!0}catch{return!1}}),je.emit=oC,je.reallyExit=nC)},yi.exports.load=Ah,Oh=je.reallyExit,nC=function(e){go(global.process)&&(je.exitCode=e||0,Do("exit",je.exitCode,null),Do("afterexit",je.exitCode,null),Oh.call(je,je.exitCode))},$c=je.emit,oC=function(e,r){if(e==="exit"&&go(global.process)){r!==void 0&&(je.exitCode=r);var n=$c.apply(this,arguments);return Do("exit",je.exitCode,null),Do("afterexit",je.exitCode,null),n}else return $c.apply(this,arguments)}):yi.exports=function(){return function(){}};var tC,gi,rC,Xa,nt,Oc,Do,kc,Di,Ah,Oh,nC,$c,oC});var aC=x((Fz,$h)=>{"use strict";var iC=Symbol();function sR(t,e,r){let n=e[iC];if(n)return e.stat(t,(i,a)=>{if(i)return r(i);r(null,a.mtime,n)});let o=new Date(Math.ceil(Date.now()/1e3)*1e3+5);e.utimes(t,o,o,i=>{if(i)return r(i);e.stat(t,(a,s)=>{if(a)return r(a);let u=s.mtime.getTime()%1e3===0?"s":"ms";Object.defineProperty(e,iC,{value:u}),r(null,s.mtime,u)})})}function uR(t){let e=Date.now();return t==="s"&&(e=Math.ceil(e/1e3)*1e3),new Date(e)}$h.exports.probe=sR;$h.exports.getMtime=uR});var fC=x((Az,Qa)=>{"use strict";var cR=require("path"),Ih=wn(),lR=Qw(),fR=kh(),sC=aC(),Jr={};function Za(t,e){return e.lockfilePath||`${t}.lock`}function Rh(t,e,r){if(!e.realpath)return r(null,cR.resolve(t));e.fs.realpath(t,r)}function Th(t,e,r){let n=Za(t,e);e.fs.mkdir(n,o=>{if(!o)return sC.probe(n,e.fs,(i,a,s)=>{if(i)return e.fs.rmdir(n,()=>{}),r(i);r(null,a,s)});if(o.code!=="EEXIST")return r(o);if(e.stale<=0)return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:t}));e.fs.stat(n,(i,a)=>{if(i)return i.code==="ENOENT"?Th(t,{...e,stale:0},r):r(i);if(!uC(a,e))return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:t}));cC(t,e,s=>{if(s)return r(s);Th(t,{...e,stale:0},r)})})})}function uC(t,e){return t.mtime.getTime()<Date.now()-e.stale}function cC(t,e,r){e.fs.rmdir(Za(t,e),n=>{if(n&&n.code!=="ENOENT")return r(n);r()})}function Pc(t,e){let r=Jr[t];r.updateTimeout||(r.updateDelay=r.updateDelay||e.update,r.updateTimeout=setTimeout(()=>{r.updateTimeout=null,e.fs.stat(r.lockfilePath,(n,o)=>{let i=r.lastUpdate+e.stale<Date.now();if(n)return n.code==="ENOENT"||i?Ph(t,r,Object.assign(n,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,Pc(t,e));if(!(r.mtime.getTime()===o.mtime.getTime()))return Ph(t,r,Object.assign(new Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let s=sC.getMtime(r.mtimePrecision);e.fs.utimes(r.lockfilePath,s,s,u=>{let c=r.lastUpdate+e.stale<Date.now();if(!r.released){if(u)return u.code==="ENOENT"||c?Ph(t,r,Object.assign(u,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,Pc(t,e));r.mtime=s,r.lastUpdate=Date.now(),r.updateDelay=null,Pc(t,e)}})})},r.updateDelay),r.updateTimeout.unref&&r.updateTimeout.unref())}function Ph(t,e,r){e.released=!0,e.updateTimeout&&clearTimeout(e.updateTimeout),Jr[t]===e&&delete Jr[t],e.options.onCompromised(r)}function pR(t,e,r){e={stale:1e4,update:null,realpath:!0,retries:0,fs:Ih,onCompromised:n=>{throw n},...e},e.retries=e.retries||0,e.retries=typeof e.retries=="number"?{retries:e.retries}:e.retries,e.stale=Math.max(e.stale||0,2e3),e.update=e.update==null?e.stale/2:e.update||0,e.update=Math.max(Math.min(e.update,e.stale/2),1e3),Rh(t,e,(n,o)=>{if(n)return r(n);let i=lR.operation(e.retries);i.attempt(()=>{Th(o,e,(a,s,u)=>{if(i.retry(a))return;if(a)return r(i.mainError());let c=Jr[o]={lockfilePath:Za(o,e),mtime:s,mtimePrecision:u,options:e,lastUpdate:Date.now()};Pc(o,e),r(null,l=>{if(c.released)return l&&l(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));lC(o,{...e,realpath:!1},l)})})})})}function lC(t,e,r){e={fs:Ih,realpath:!0,...e},Rh(t,e,(n,o)=>{if(n)return r(n);let i=Jr[o];if(!i)return r(Object.assign(new Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));i.updateTimeout&&clearTimeout(i.updateTimeout),i.released=!0,delete Jr[o],cC(o,e,r)})}function dR(t,e,r){e={stale:1e4,realpath:!0,fs:Ih,...e},e.stale=Math.max(e.stale||0,2e3),Rh(t,e,(n,o)=>{if(n)return r(n);e.fs.stat(Za(o,e),(i,a)=>i?i.code==="ENOENT"?r(null,!1):r(i):r(null,!uC(a,e)))})}function hR(){return Jr}fR(()=>{for(let t in Jr){let e=Jr[t].options;try{e.fs.rmdirSync(Za(t,e))}catch{}}});Qa.exports.lock=pR;Qa.exports.unlock=lC;Qa.exports.check=dR;Qa.exports.getLocks=hR});var dC=x((Oz,pC)=>{"use strict";var mR=wn();function gR(t){let e=["mkdir","realpath","stat","rmdir","utimes"],r={...t};return e.forEach(n=>{r[n]=(...o)=>{let i=o.pop(),a;try{a=t[`${n}Sync`](...o)}catch(s){return i(s)}i(null,a)}}),r}function DR(t){return(...e)=>new Promise((r,n)=>{e.push((o,i)=>{o?n(o):r(i)}),t(...e)})}function yR(t){return(...e)=>{let r,n;if(e.push((o,i)=>{r=o,n=i}),t(...e),r)throw r;return n}}function bR(t){if(t={...t},t.fs=gR(t.fs||mR),typeof t.retries=="number"&&t.retries>0||t.retries&&typeof t.retries.retries=="number"&&t.retries.retries>0)throw Object.assign(new Error("Cannot use retries with the sync api"),{code:"ESYNC"});return t}pC.exports={toPromise:DR,toSync:yR,toSyncOptions:bR}});var mC=x((kz,Cn)=>{"use strict";var bi=fC(),{toPromise:Tc,toSync:Ic,toSyncOptions:Bh}=dC();async function hC(t,e){let r=await Tc(bi.lock)(t,e);return Tc(r)}function vR(t,e){let r=Ic(bi.lock)(t,Bh(e));return Ic(r)}function wR(t,e){return Tc(bi.unlock)(t,e)}function CR(t,e){return Ic(bi.unlock)(t,Bh(e))}function ER(t,e){return Tc(bi.check)(t,e)}function _R(t,e){return Ic(bi.check)(t,Bh(e))}Cn.exports=hC;Cn.exports.lock=hC;Cn.exports.unlock=wR;Cn.exports.lockSync=vR;Cn.exports.unlockSync=CR;Cn.exports.check=ER;Cn.exports.checkSync=_R});var vC=x(vi=>{"use strict";Object.defineProperty(vi,"__esModule",{value:!0});vi.canStoreURLs=vi.FileUrlStorage=void 0;var gC=require("fs"),xR=FR(Nw()),DC=SR(mC());function bC(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(bC=function(n){return n?r:e})(t)}function SR(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=bC(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if(i!=="default"&&{}.hasOwnProperty.call(t,i)){var a=o?Object.getOwnPropertyDescriptor(t,i):null;a&&(a.get||a.set)?Object.defineProperty(n,i,a):n[i]=t[i]}return n.default=t,r&&r.set(t,n),n}function FR(t){return t&&t.__esModule?t:{default:t}}function es(t){"@babel/helpers - typeof";return es=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},es(t)}function AR(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function yC(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,kR(n.key),n)}}function OR(t,e,r){return e&&yC(t.prototype,e),r&&yC(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function kR(t){var e=$R(t,"string");return es(e)=="symbol"?e:e+""}function $R(t,e){if(es(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(es(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var $z=vi.canStoreURLs=!0,Pz=vi.FileUrlStorage=(function(){function t(e){AR(this,t),this.path=e}return OR(t,[{key:"findAllUploads",value:function(){var r=this;return new Promise(function(n,o){r._getItems("tus::",function(i,a){i?o(i):n(a)})})}},{key:"findUploadsByFingerprint",value:function(r){var n=this;return new Promise(function(o,i){n._getItems("tus::".concat(r),function(a,s){a?i(a):o(s)})})}},{key:"removeUpload",value:function(r){var n=this;return new Promise(function(o,i){n._removeItem(r,function(a){a?i(a):o()})})}},{key:"addUpload",value:function(r,n){var o=this,i=Math.round(Math.random()*1e12),a="tus::".concat(r,"::").concat(i);return new Promise(function(s,u){o._setItem(a,n,function(c){c?u(c):s(a)})})}},{key:"_setItem",value:function(r,n,o){var i=this;DC.lock(this.path,this._lockfileOptions()).then(function(a){o=i._releaseAndCb(a,o),i._getData(function(s,u){if(s){o(s);return}u[r]=n,i._writeData(u,function(c){return o(c)})})}).catch(o)}},{key:"_getItems",value:function(r,n){this._getData(function(o,i){if(o){n(o);return}var a=Object.keys(i).filter(function(s){return s.startsWith(r)}).map(function(s){var u=i[s];return u.urlStorageKey=s,u});n(null,a)})}},{key:"_removeItem",value:function(r,n){var o=this;DC.lock(this.path,this._lockfileOptions()).then(function(i){n=o._releaseAndCb(i,n),o._getData(function(a,s){if(a){n(a);return}delete s[r],o._writeData(s,function(u){return n(u)})})}).catch(n)}},{key:"_lockfileOptions",value:function(){return{realpath:!1,retries:{retries:5,minTimeout:20}}}},{key:"_releaseAndCb",value:function(r,n){return function(o){if(o){r().then(function(){return n(o)}).catch(function(i){return n((0,xR.default)([o,i]))});return}r().then(n).catch(n)}}},{key:"_writeData",value:function(r,n){var o={encoding:"utf8",mode:432,flag:"w"};(0,gC.writeFile)(this.path,JSON.stringify(r),o,function(i){return n(i)})}},{key:"_getData",value:function(r){(0,gC.readFile)(this.path,"utf8",function(n,o){if(n){n.code==="ENOENT"?r(null,{}):r(n);return}try{o=o.trim().length?JSON.parse(o):{}}catch(i){r(i);return}r(null,o)})}}])})()});var Lh=x(Lt=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:!0});Object.defineProperty(Lt,"DefaultHttpStack",{enumerable:!0,get:function(){return _C.default}});Object.defineProperty(Lt,"DetailedError",{enumerable:!0,get:function(){return PR.default}});Object.defineProperty(Lt,"FileUrlStorage",{enumerable:!0,get:function(){return xC.FileUrlStorage}});Object.defineProperty(Lt,"StreamSource",{enumerable:!0,get:function(){return jR.default}});Lt.Upload=void 0;Object.defineProperty(Lt,"canStoreURLs",{enumerable:!0,get:function(){return xC.canStoreURLs}});Lt.defaultOptions=void 0;Object.defineProperty(Lt,"enableDebugLog",{enumerable:!0,get:function(){return TR.enableDebugLog}});Lt.isSupported=void 0;var PR=yo(Pd()),TR=Td(),IR=yo(vb()),jh=yo(Jb()),RR=yo(cv()),BR=yo(dv()),_C=yo(Fv()),jR=yo(Wd()),xC=vC();function yo(t){return t&&t.__esModule?t:{default:t}}function Ci(t){"@babel/helpers - typeof";return Ci=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ci(t)}function NR(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function wC(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,FC(n.key),n)}}function LR(t,e,r){return e&&wC(t.prototype,e),r&&wC(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function UR(t,e,r){return e=Rc(e),MR(t,SC()?Reflect.construct(e,r||[],Rc(t).constructor):e.apply(t,r))}function MR(t,e){if(e&&(Ci(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return qR(t)}function qR(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function SC(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(SC=function(){return!!t})()}function Rc(t){return Rc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Rc(t)}function HR(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Nh(t,e)}function Nh(t,e){return Nh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Nh(t,e)}function CC(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r.push.apply(r,n)}return r}function wi(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?CC(Object(r),!0).forEach(function(n){VR(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):CC(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function VR(t,e,r){return e=FC(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function FC(t){var e=zR(t,"string");return Ci(e)=="symbol"?e:e+""}function zR(t,e){if(Ci(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Ci(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var EC=Lt.defaultOptions=wi(wi({},jh.default.defaultOptions),{},{httpStack:new _C.default,fileReader:new RR.default,urlStorage:new IR.default,fingerprint:BR.default}),Iz=Lt.Upload=(function(t){function e(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return NR(this,e),n=wi(wi({},EC),n),UR(this,e,[r,n])}return HR(e,t),LR(e,null,[{key:"terminate",value:function(n){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return o=wi(wi({},EC),o),jh.default.terminate(n,o)}}])})(jh.default),Rz=Lt.isSupported=!0});var PC=x((Xz,$C)=>{var Ei=1e3,_i=Ei*60,xi=_i*60,bo=xi*24,eB=bo*7,tB=bo*365.25;$C.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return rB(t);if(r==="number"&&isFinite(t))return e.long?oB(t):nB(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function rB(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*tB;case"weeks":case"week":case"w":return r*eB;case"days":case"day":case"d":return r*bo;case"hours":case"hour":case"hrs":case"hr":case"h":return r*xi;case"minutes":case"minute":case"mins":case"min":case"m":return r*_i;case"seconds":case"second":case"secs":case"sec":case"s":return r*Ei;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function nB(t){var e=Math.abs(t);return e>=bo?Math.round(t/bo)+"d":e>=xi?Math.round(t/xi)+"h":e>=_i?Math.round(t/_i)+"m":e>=Ei?Math.round(t/Ei)+"s":t+"ms"}function oB(t){var e=Math.abs(t);return e>=bo?jc(t,e,bo,"day"):e>=xi?jc(t,e,xi,"hour"):e>=_i?jc(t,e,_i,"minute"):e>=Ei?jc(t,e,Ei,"second"):t+" ms"}function jc(t,e,r,n){var o=e>=r*1.5;return Math.round(t/r)+" "+n+(o?"s":"")}});var qh=x((Zz,TC)=>{function iB(t){r.debug=r,r.default=r,r.coerce=u,r.disable=a,r.enable=o,r.enabled=s,r.humanize=PC(),r.destroy=c,Object.keys(t).forEach(l=>{r[l]=t[l]}),r.names=[],r.skips=[],r.formatters={};function e(l){let f=0;for(let d=0;d<l.length;d++)f=(f<<5)-f+l.charCodeAt(d),f|=0;return r.colors[Math.abs(f)%r.colors.length]}r.selectColor=e;function r(l){let f,d=null,h,m;function b(...D){if(!b.enabled)return;let C=b,E=Number(new Date),g=E-(f||E);C.diff=g,C.prev=f,C.curr=E,f=E,D[0]=r.coerce(D[0]),typeof D[0]!="string"&&D.unshift("%O");let _=0;D[0]=D[0].replace(/%([a-zA-Z%])/g,(I,O)=>{if(I==="%%")return"%";_++;let B=r.formatters[O];if(typeof B=="function"){let R=D[_];I=B.call(C,R),D.splice(_,1),_--}return I}),r.formatArgs.call(C,D),(C.log||r.log).apply(C,D)}return b.namespace=l,b.useColors=r.useColors(),b.color=r.selectColor(l),b.extend=n,b.destroy=r.destroy,Object.defineProperty(b,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(h!==r.namespaces&&(h=r.namespaces,m=r.enabled(l)),m),set:D=>{d=D}}),typeof r.init=="function"&&r.init(b),b}function n(l,f){let d=r(this.namespace+(typeof f>"u"?":":f)+l);return d.log=this.log,d}function o(l){r.save(l),r.namespaces=l,r.names=[],r.skips=[];let f=(typeof l=="string"?l:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let d of f)d[0]==="-"?r.skips.push(d.slice(1)):r.names.push(d)}function i(l,f){let d=0,h=0,m=-1,b=0;for(;d<l.length;)if(h<f.length&&(f[h]===l[d]||f[h]==="*"))f[h]==="*"?(m=h,b=d,h++):(d++,h++);else if(m!==-1)h=m+1,b++,d=b;else return!1;for(;h<f.length&&f[h]==="*";)h++;return h===f.length}function a(){let l=[...r.names,...r.skips.map(f=>"-"+f)].join(",");return r.enable(""),l}function s(l){for(let f of r.skips)if(i(l,f))return!1;for(let f of r.names)if(i(l,f))return!0;return!1}function u(l){return l instanceof Error?l.stack||l.message:l}function c(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}TC.exports=iB});var IC=x((Ut,Nc)=>{Ut.formatArgs=sB;Ut.save=uB;Ut.load=cB;Ut.useColors=aB;Ut.storage=lB();Ut.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();Ut.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function aB(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function sB(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+Nc.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,n=0;t[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(r++,o==="%c"&&(n=r))}),t.splice(n,0,e)}Ut.log=console.debug||console.log||(()=>{});function uB(t){try{t?Ut.storage.setItem("debug",t):Ut.storage.removeItem("debug")}catch{}}function cB(){let t;try{t=Ut.storage.getItem("debug")||Ut.storage.getItem("DEBUG")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function lB(){try{return localStorage}catch{}}Nc.exports=qh()(Ut);var{formatters:fB}=Nc.exports;fB.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var BC=x((Qz,RC)=>{"use strict";RC.exports=(t,e=process.argv)=>{let r=t.startsWith("-")?"":t.length===1?"-":"--",n=e.indexOf(r+t),o=e.indexOf("--");return n!==-1&&(o===-1||n<o)}});var LC=x((eG,NC)=>{"use strict";var pB=require("os"),jC=require("tty"),sr=BC(),{env:it}=process,En;sr("no-color")||sr("no-colors")||sr("color=false")||sr("color=never")?En=0:(sr("color")||sr("colors")||sr("color=true")||sr("color=always"))&&(En=1);"FORCE_COLOR"in it&&(it.FORCE_COLOR==="true"?En=1:it.FORCE_COLOR==="false"?En=0:En=it.FORCE_COLOR.length===0?1:Math.min(parseInt(it.FORCE_COLOR,10),3));function Hh(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function Vh(t,e){if(En===0)return 0;if(sr("color=16m")||sr("color=full")||sr("color=truecolor"))return 3;if(sr("color=256"))return 2;if(t&&!e&&En===void 0)return 0;let r=En||0;if(it.TERM==="dumb")return r;if(process.platform==="win32"){let n=pB.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in it)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in it)||it.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in it)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(it.TEAMCITY_VERSION)?1:0;if(it.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in it){let n=parseInt((it.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(it.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(it.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(it.TERM)||"COLORTERM"in it?1:r}function dB(t){let e=Vh(t,t&&t.isTTY);return Hh(e)}NC.exports={supportsColor:dB,stdout:Hh(Vh(!0,jC.isatty(1))),stderr:Hh(Vh(!0,jC.isatty(2)))}});var MC=x((at,Uc)=>{var hB=require("tty"),Lc=require("util");at.init=wB;at.log=yB;at.formatArgs=gB;at.save=bB;at.load=vB;at.useColors=mB;at.destroy=Lc.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");at.colors=[6,2,3,4,5,1];try{let t=LC();t&&(t.stderr||t).level>=2&&(at.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}at.inspectOpts=Object.keys(process.env).filter(t=>/^debug_/i.test(t)).reduce((t,e)=>{let r=e.substring(6).toLowerCase().replace(/_([a-z])/g,(o,i)=>i.toUpperCase()),n=process.env[e];return/^(yes|on|true|enabled)$/i.test(n)?n=!0:/^(no|off|false|disabled)$/i.test(n)?n=!1:n==="null"?n=null:n=Number(n),t[r]=n,t},{});function mB(){return"colors"in at.inspectOpts?!!at.inspectOpts.colors:hB.isatty(process.stderr.fd)}function gB(t){let{namespace:e,useColors:r}=this;if(r){let n=this.color,o="\x1B[3"+(n<8?n:"8;5;"+n),i=` ${o};1m${e} \x1B[0m`;t[0]=i+t[0].split(`
43
+ `)}),e}});var Hv=x((Sz,qv)=>{var vn=require("constants"),e8=process.cwd,Fc=null,t8=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return Fc||(Fc=e8.call(process)),Fc};try{process.cwd()}catch{}typeof process.chdir=="function"&&(Fh=process.chdir,process.chdir=function(t){Fc=null,Fh.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,Fh));var Fh;qv.exports=r8;function r8(t){vn.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&e(t),t.lutimes||r(t),t.chown=i(t.chown),t.fchown=i(t.fchown),t.lchown=i(t.lchown),t.chmod=n(t.chmod),t.fchmod=n(t.fchmod),t.lchmod=n(t.lchmod),t.chownSync=a(t.chownSync),t.fchownSync=a(t.fchownSync),t.lchownSync=a(t.lchownSync),t.chmodSync=o(t.chmodSync),t.fchmodSync=o(t.fchmodSync),t.lchmodSync=o(t.lchmodSync),t.stat=s(t.stat),t.fstat=s(t.fstat),t.lstat=s(t.lstat),t.statSync=u(t.statSync),t.fstatSync=u(t.fstatSync),t.lstatSync=u(t.lstatSync),t.chmod&&!t.lchmod&&(t.lchmod=function(l,p,d){d&&process.nextTick(d)},t.lchmodSync=function(){}),t.chown&&!t.lchown&&(t.lchown=function(l,p,d,h){h&&process.nextTick(h)},t.lchownSync=function(){}),t8==="win32"&&(t.rename=typeof t.rename!="function"?t.rename:(function(l){function p(d,h,m){var b=Date.now(),D=0;l(d,h,function C(E){if(E&&(E.code==="EACCES"||E.code==="EPERM"||E.code==="EBUSY")&&Date.now()-b<6e4){setTimeout(function(){t.stat(h,function(g,_){g&&g.code==="ENOENT"?l(d,h,C):m(E)})},D),D<100&&(D+=10);return}m&&m(E)})}return Object.setPrototypeOf&&Object.setPrototypeOf(p,l),p})(t.rename)),t.read=typeof t.read!="function"?t.read:(function(l){function p(d,h,m,b,D,C){var E;if(C&&typeof C=="function"){var g=0;E=function(_,S,$){if(_&&_.code==="EAGAIN"&&g<10)return g++,l.call(t,d,h,m,b,D,E);C.apply(this,arguments)}}return l.call(t,d,h,m,b,D,E)}return Object.setPrototypeOf&&Object.setPrototypeOf(p,l),p})(t.read),t.readSync=typeof t.readSync!="function"?t.readSync:(function(l){return function(p,d,h,m,b){for(var D=0;;)try{return l.call(t,p,d,h,m,b)}catch(C){if(C.code==="EAGAIN"&&D<10){D++;continue}throw C}}})(t.readSync);function e(l){l.lchmod=function(p,d,h){l.open(p,vn.O_WRONLY|vn.O_SYMLINK,d,function(m,b){if(m){h&&h(m);return}l.fchmod(b,d,function(D){l.close(b,function(C){h&&h(D||C)})})})},l.lchmodSync=function(p,d){var h=l.openSync(p,vn.O_WRONLY|vn.O_SYMLINK,d),m=!0,b;try{b=l.fchmodSync(h,d),m=!1}finally{if(m)try{l.closeSync(h)}catch{}else l.closeSync(h)}return b}}function r(l){vn.hasOwnProperty("O_SYMLINK")&&l.futimes?(l.lutimes=function(p,d,h,m){l.open(p,vn.O_SYMLINK,function(b,D){if(b){m&&m(b);return}l.futimes(D,d,h,function(C){l.close(D,function(E){m&&m(C||E)})})})},l.lutimesSync=function(p,d,h){var m=l.openSync(p,vn.O_SYMLINK),b,D=!0;try{b=l.futimesSync(m,d,h),D=!1}finally{if(D)try{l.closeSync(m)}catch{}else l.closeSync(m)}return b}):l.futimes&&(l.lutimes=function(p,d,h,m){m&&process.nextTick(m)},l.lutimesSync=function(){})}function n(l){return l&&function(p,d,h){return l.call(t,p,d,function(m){c(m)&&(m=null),h&&h.apply(this,arguments)})}}function o(l){return l&&function(p,d){try{return l.call(t,p,d)}catch(h){if(!c(h))throw h}}}function i(l){return l&&function(p,d,h,m){return l.call(t,p,d,h,function(b){c(b)&&(b=null),m&&m.apply(this,arguments)})}}function a(l){return l&&function(p,d,h){try{return l.call(t,p,d,h)}catch(m){if(!c(m))throw m}}}function s(l){return l&&function(p,d,h){typeof d=="function"&&(h=d,d=null);function m(b,D){D&&(D.uid<0&&(D.uid+=4294967296),D.gid<0&&(D.gid+=4294967296)),h&&h.apply(this,arguments)}return d?l.call(t,p,d,m):l.call(t,p,m)}}function u(l){return l&&function(p,d){var h=d?l.call(t,p,d):l.call(t,p);return h&&(h.uid<0&&(h.uid+=4294967296),h.gid<0&&(h.gid+=4294967296)),h}}function c(l){if(!l||l.code==="ENOSYS")return!0;var p=!process.getuid||process.getuid()!==0;return!!(p&&(l.code==="EINVAL"||l.code==="EPERM"))}}});var Gv=x((Fz,zv)=>{var Vv=require("stream").Stream;zv.exports=n8;function n8(t){return{ReadStream:e,WriteStream:r};function e(n,o){if(!(this instanceof e))return new e(n,o);Vv.call(this);var i=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,o=o||{};for(var a=Object.keys(o),s=0,u=a.length;s<u;s++){var c=a[s];this[c]=o[c]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){i._read()});return}t.open(this.path,this.flags,this.mode,function(l,p){if(l){i.emit("error",l),i.readable=!1;return}i.fd=p,i.emit("open",p),i._read()})}function r(n,o){if(!(this instanceof r))return new r(n,o);Vv.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,o=o||{};for(var i=Object.keys(o),a=0,s=i.length;a<s;a++){var u=i[a];this[u]=o[u]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=t.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}});var Kv=x((Az,Wv)=>{"use strict";Wv.exports=i8;var o8=Object.getPrototypeOf||function(t){return t.__proto__};function i8(t){if(t===null||typeof t!="object")return t;if(t instanceof Object)var e={__proto__:o8(t)};else var e=Object.create(null);return Object.getOwnPropertyNames(t).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}});var Cn=x((Oz,kh)=>{var ze=require("fs"),a8=Hv(),s8=Gv(),u8=Kv(),Ac=require("util"),dt,kc;typeof Symbol=="function"&&typeof Symbol.for=="function"?(dt=Symbol.for("graceful-fs.queue"),kc=Symbol.for("graceful-fs.previous")):(dt="___graceful-fs.queue",kc="___graceful-fs.previous");function c8(){}function Xv(t,e){Object.defineProperty(t,dt,{get:function(){return e}})}var mo=c8;Ac.debuglog?mo=Ac.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(mo=function(){var t=Ac.format.apply(Ac,arguments);t="GFS4: "+t.split(/\n/).join(`
44
+ GFS4: `),console.error(t)});ze[dt]||(Yv=global[dt]||[],Xv(ze,Yv),ze.close=(function(t){function e(r,n){return t.call(ze,r,function(o){o||Jv(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(e,kc,{value:t}),e})(ze.close),ze.closeSync=(function(t){function e(r){t.apply(ze,arguments),Jv()}return Object.defineProperty(e,kc,{value:t}),e})(ze.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){mo(ze[dt]),require("assert").equal(ze[dt].length,0)}));var Yv;global[dt]||Xv(global,ze[dt]);kh.exports=Ah(u8(ze));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!ze.__patched&&(kh.exports=Ah(ze),ze.__patched=!0);function Ah(t){a8(t),t.gracefulify=Ah,t.createReadStream=S,t.createWriteStream=$;var e=t.readFile;t.readFile=r;function r(R,N,A){return typeof N=="function"&&(A=N,N=null),U(R,N,A);function U(M,Q,P,y){return e(M,Q,function(w){w&&(w.code==="EMFILE"||w.code==="ENFILE")?yi([U,[M,Q,P],w,y||Date.now(),Date.now()]):typeof P=="function"&&P.apply(this,arguments)})}}var n=t.writeFile;t.writeFile=o;function o(R,N,A,U){return typeof A=="function"&&(U=A,A=null),M(R,N,A,U);function M(Q,P,y,w,v){return n(Q,P,y,function(F){F&&(F.code==="EMFILE"||F.code==="ENFILE")?yi([M,[Q,P,y,w],F,v||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}var i=t.appendFile;i&&(t.appendFile=a);function a(R,N,A,U){return typeof A=="function"&&(U=A,A=null),M(R,N,A,U);function M(Q,P,y,w,v){return i(Q,P,y,function(F){F&&(F.code==="EMFILE"||F.code==="ENFILE")?yi([M,[Q,P,y,w],F,v||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}var s=t.copyFile;s&&(t.copyFile=u);function u(R,N,A,U){return typeof A=="function"&&(U=A,A=0),M(R,N,A,U);function M(Q,P,y,w,v){return s(Q,P,y,function(F){F&&(F.code==="EMFILE"||F.code==="ENFILE")?yi([M,[Q,P,y,w],F,v||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}var c=t.readdir;t.readdir=p;var l=/^v[0-5]\./;function p(R,N,A){typeof N=="function"&&(A=N,N=null);var U=l.test(process.version)?function(P,y,w,v){return c(P,M(P,y,w,v))}:function(P,y,w,v){return c(P,y,M(P,y,w,v))};return U(R,N,A);function M(Q,P,y,w){return function(v,F){v&&(v.code==="EMFILE"||v.code==="ENFILE")?yi([U,[Q,P,y],v,w||Date.now(),Date.now()]):(F&&F.sort&&F.sort(),typeof y=="function"&&y.call(this,v,F))}}}if(process.version.substr(0,4)==="v0.8"){var d=s8(t);C=d.ReadStream,g=d.WriteStream}var h=t.ReadStream;h&&(C.prototype=Object.create(h.prototype),C.prototype.open=E);var m=t.WriteStream;m&&(g.prototype=Object.create(m.prototype),g.prototype.open=_),Object.defineProperty(t,"ReadStream",{get:function(){return C},set:function(R){C=R},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WriteStream",{get:function(){return g},set:function(R){g=R},enumerable:!0,configurable:!0});var b=C;Object.defineProperty(t,"FileReadStream",{get:function(){return b},set:function(R){b=R},enumerable:!0,configurable:!0});var D=g;Object.defineProperty(t,"FileWriteStream",{get:function(){return D},set:function(R){D=R},enumerable:!0,configurable:!0});function C(R,N){return this instanceof C?(h.apply(this,arguments),this):C.apply(Object.create(C.prototype),arguments)}function E(){var R=this;B(R.path,R.flags,R.mode,function(N,A){N?(R.autoClose&&R.destroy(),R.emit("error",N)):(R.fd=A,R.emit("open",A),R.read())})}function g(R,N){return this instanceof g?(m.apply(this,arguments),this):g.apply(Object.create(g.prototype),arguments)}function _(){var R=this;B(R.path,R.flags,R.mode,function(N,A){N?(R.destroy(),R.emit("error",N)):(R.fd=A,R.emit("open",A))})}function S(R,N){return new t.ReadStream(R,N)}function $(R,N){return new t.WriteStream(R,N)}var k=t.open;t.open=B;function B(R,N,A,U){return typeof A=="function"&&(U=A,A=null),M(R,N,A,U);function M(Q,P,y,w,v){return k(Q,P,y,function(F,I){F&&(F.code==="EMFILE"||F.code==="ENFILE")?yi([M,[Q,P,y,w],F,v||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}return t}function yi(t){mo("ENQUEUE",t[0].name,t[1]),ze[dt].push(t),Oh()}var Oc;function Jv(){for(var t=Date.now(),e=0;e<ze[dt].length;++e)ze[dt][e].length>2&&(ze[dt][e][3]=t,ze[dt][e][4]=t);Oh()}function Oh(){if(clearTimeout(Oc),Oc=void 0,ze[dt].length!==0){var t=ze[dt].shift(),e=t[0],r=t[1],n=t[2],o=t[3],i=t[4];if(o===void 0)mo("RETRY",e.name,r),e.apply(null,r);else if(Date.now()-o>=6e4){mo("TIMEOUT",e.name,r);var a=r.pop();typeof a=="function"&&a.call(null,n)}else{var s=Date.now()-i,u=Math.max(i-o,1),c=Math.min(u*1.2,100);s>=c?(mo("RETRY",e.name,r),e.apply(null,r.concat([o]))):ze[dt].push(t)}Oc===void 0&&(Oc=setTimeout(Oh,0))}}});var Qv=x((kz,Zv)=>{function nr(t,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}Zv.exports=nr;nr.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};nr.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};nr.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=new Date().getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var r=this._timeouts.shift();if(r===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),r=this._timeouts.shift();else return!1;var n=this,o=setTimeout(function(){n._attempts++,n._operationTimeoutCb&&(n._timeout=setTimeout(function(){n._operationTimeoutCb(n._attempts)},n._operationTimeout),n._options.unref&&n._timeout.unref()),n._fn(n._attempts)},r);return this._options.unref&&o.unref(),!0};nr.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){r._operationTimeoutCb()},r._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};nr.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};nr.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};nr.prototype.start=nr.prototype.try;nr.prototype.errors=function(){return this._errors};nr.prototype.attempts=function(){return this._attempts};nr.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},e=null,r=0,n=0;n<this._errors.length;n++){var o=this._errors[n],i=o.message,a=(t[i]||0)+1;t[i]=a,a>=r&&(e=o,r=a)}return e}});var eC=x(go=>{var l8=Qv();go.operation=function(t){var e=go.timeouts(t);return new l8(e,{forever:t&&t.forever,unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};go.timeouts=function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var r in t)e[r]=t[r];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var n=[],o=0;o<e.retries;o++)n.push(this.createTimeout(o,e));return t&&t.forever&&!n.length&&n.push(this.createTimeout(o,e)),n.sort(function(i,a){return i-a}),n};go.createTimeout=function(t,e){var r=e.randomize?Math.random()+1:1,n=Math.round(r*e.minTimeout*Math.pow(e.factor,t));return n=Math.min(n,e.maxTimeout),n};go.wrap=function(t,e,r){if(e instanceof Array&&(r=e,e=null),!r){r=[];for(var n in t)typeof t[n]=="function"&&r.push(n)}for(var o=0;o<r.length;o++){var i=r[o],a=t[i];t[i]=function(u){var c=go.operation(e),l=Array.prototype.slice.call(arguments,1),p=l.pop();l.push(function(d){c.retry(d)||(d&&(arguments[0]=c.mainError()),p.apply(this,arguments))}),c.attempt(function(){u.apply(t,l)})}.bind(t,a),t[i].options=e}}});var rC=x((Pz,tC)=>{tC.exports=eC()});var nC=x((Tz,$c)=>{$c.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&$c.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&$c.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var Th=x((Iz,vi)=>{var Le=global.process,Do=function(t){return t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function"};Do(Le)?(oC=require("assert"),bi=nC(),iC=/^win/i.test(Le.platform),es=require("events"),typeof es!="function"&&(es=es.EventEmitter),Le.__signal_exit_emitter__?ot=Le.__signal_exit_emitter__:(ot=Le.__signal_exit_emitter__=new es,ot.count=0,ot.emitted={}),ot.infinite||(ot.setMaxListeners(1/0),ot.infinite=!0),vi.exports=function(t,e){if(!Do(global.process))return function(){};oC.equal(typeof t,"function","a callback must be provided for exit handler"),wi===!1&&$h();var r="exit";e&&e.alwaysLast&&(r="afterexit");var n=function(){ot.removeListener(r,t),ot.listeners("exit").length===0&&ot.listeners("afterexit").length===0&&Pc()};return ot.on(r,t),n},Pc=function(){!wi||!Do(global.process)||(wi=!1,bi.forEach(function(e){try{Le.removeListener(e,Tc[e])}catch{}}),Le.emit=Ic,Le.reallyExit=Ph,ot.count-=1)},vi.exports.unload=Pc,yo=function(e,r,n){ot.emitted[e]||(ot.emitted[e]=!0,ot.emit(e,r,n))},Tc={},bi.forEach(function(t){Tc[t]=function(){if(Do(global.process)){var r=Le.listeners(t);r.length===ot.count&&(Pc(),yo("exit",null,t),yo("afterexit",null,t),iC&&t==="SIGHUP"&&(t="SIGINT"),Le.kill(Le.pid,t))}}}),vi.exports.signals=function(){return bi},wi=!1,$h=function(){wi||!Do(global.process)||(wi=!0,ot.count+=1,bi=bi.filter(function(e){try{return Le.on(e,Tc[e]),!0}catch{return!1}}),Le.emit=sC,Le.reallyExit=aC)},vi.exports.load=$h,Ph=Le.reallyExit,aC=function(e){Do(global.process)&&(Le.exitCode=e||0,yo("exit",Le.exitCode,null),yo("afterexit",Le.exitCode,null),Ph.call(Le,Le.exitCode))},Ic=Le.emit,sC=function(e,r){if(e==="exit"&&Do(global.process)){r!==void 0&&(Le.exitCode=r);var n=Ic.apply(this,arguments);return yo("exit",Le.exitCode,null),yo("afterexit",Le.exitCode,null),n}else return Ic.apply(this,arguments)}):vi.exports=function(){return function(){}};var oC,bi,iC,es,ot,Pc,yo,Tc,wi,$h,Ph,aC,Ic,sC});var cC=x((Rz,Ih)=>{"use strict";var uC=Symbol();function f8(t,e,r){let n=e[uC];if(n)return e.stat(t,(i,a)=>{if(i)return r(i);r(null,a.mtime,n)});let o=new Date(Math.ceil(Date.now()/1e3)*1e3+5);e.utimes(t,o,o,i=>{if(i)return r(i);e.stat(t,(a,s)=>{if(a)return r(a);let u=s.mtime.getTime()%1e3===0?"s":"ms";Object.defineProperty(e,uC,{value:u}),r(null,s.mtime,u)})})}function p8(t){let e=Date.now();return t==="s"&&(e=Math.ceil(e/1e3)*1e3),new Date(e)}Ih.exports.probe=f8;Ih.exports.getMtime=p8});var hC=x((Bz,rs)=>{"use strict";var d8=require("path"),jh=Cn(),h8=rC(),m8=Th(),lC=cC(),Jr={};function ts(t,e){return e.lockfilePath||`${t}.lock`}function Nh(t,e,r){if(!e.realpath)return r(null,d8.resolve(t));e.fs.realpath(t,r)}function Bh(t,e,r){let n=ts(t,e);e.fs.mkdir(n,o=>{if(!o)return lC.probe(n,e.fs,(i,a,s)=>{if(i)return e.fs.rmdir(n,()=>{}),r(i);r(null,a,s)});if(o.code!=="EEXIST")return r(o);if(e.stale<=0)return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:t}));e.fs.stat(n,(i,a)=>{if(i)return i.code==="ENOENT"?Bh(t,{...e,stale:0},r):r(i);if(!fC(a,e))return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:t}));pC(t,e,s=>{if(s)return r(s);Bh(t,{...e,stale:0},r)})})})}function fC(t,e){return t.mtime.getTime()<Date.now()-e.stale}function pC(t,e,r){e.fs.rmdir(ts(t,e),n=>{if(n&&n.code!=="ENOENT")return r(n);r()})}function Rc(t,e){let r=Jr[t];r.updateTimeout||(r.updateDelay=r.updateDelay||e.update,r.updateTimeout=setTimeout(()=>{r.updateTimeout=null,e.fs.stat(r.lockfilePath,(n,o)=>{let i=r.lastUpdate+e.stale<Date.now();if(n)return n.code==="ENOENT"||i?Rh(t,r,Object.assign(n,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,Rc(t,e));if(!(r.mtime.getTime()===o.mtime.getTime()))return Rh(t,r,Object.assign(new Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let s=lC.getMtime(r.mtimePrecision);e.fs.utimes(r.lockfilePath,s,s,u=>{let c=r.lastUpdate+e.stale<Date.now();if(!r.released){if(u)return u.code==="ENOENT"||c?Rh(t,r,Object.assign(u,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,Rc(t,e));r.mtime=s,r.lastUpdate=Date.now(),r.updateDelay=null,Rc(t,e)}})})},r.updateDelay),r.updateTimeout.unref&&r.updateTimeout.unref())}function Rh(t,e,r){e.released=!0,e.updateTimeout&&clearTimeout(e.updateTimeout),Jr[t]===e&&delete Jr[t],e.options.onCompromised(r)}function g8(t,e,r){e={stale:1e4,update:null,realpath:!0,retries:0,fs:jh,onCompromised:n=>{throw n},...e},e.retries=e.retries||0,e.retries=typeof e.retries=="number"?{retries:e.retries}:e.retries,e.stale=Math.max(e.stale||0,2e3),e.update=e.update==null?e.stale/2:e.update||0,e.update=Math.max(Math.min(e.update,e.stale/2),1e3),Nh(t,e,(n,o)=>{if(n)return r(n);let i=h8.operation(e.retries);i.attempt(()=>{Bh(o,e,(a,s,u)=>{if(i.retry(a))return;if(a)return r(i.mainError());let c=Jr[o]={lockfilePath:ts(o,e),mtime:s,mtimePrecision:u,options:e,lastUpdate:Date.now()};Rc(o,e),r(null,l=>{if(c.released)return l&&l(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));dC(o,{...e,realpath:!1},l)})})})})}function dC(t,e,r){e={fs:jh,realpath:!0,...e},Nh(t,e,(n,o)=>{if(n)return r(n);let i=Jr[o];if(!i)return r(Object.assign(new Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));i.updateTimeout&&clearTimeout(i.updateTimeout),i.released=!0,delete Jr[o],pC(o,e,r)})}function D8(t,e,r){e={stale:1e4,realpath:!0,fs:jh,...e},e.stale=Math.max(e.stale||0,2e3),Nh(t,e,(n,o)=>{if(n)return r(n);e.fs.stat(ts(o,e),(i,a)=>i?i.code==="ENOENT"?r(null,!1):r(i):r(null,!fC(a,e)))})}function y8(){return Jr}m8(()=>{for(let t in Jr){let e=Jr[t].options;try{e.fs.rmdirSync(ts(t,e))}catch{}}});rs.exports.lock=g8;rs.exports.unlock=dC;rs.exports.check=D8;rs.exports.getLocks=y8});var gC=x((jz,mC)=>{"use strict";var b8=Cn();function w8(t){let e=["mkdir","realpath","stat","rmdir","utimes"],r={...t};return e.forEach(n=>{r[n]=(...o)=>{let i=o.pop(),a;try{a=t[`${n}Sync`](...o)}catch(s){return i(s)}i(null,a)}}),r}function v8(t){return(...e)=>new Promise((r,n)=>{e.push((o,i)=>{o?n(o):r(i)}),t(...e)})}function C8(t){return(...e)=>{let r,n;if(e.push((o,i)=>{r=o,n=i}),t(...e),r)throw r;return n}}function E8(t){if(t={...t},t.fs=w8(t.fs||b8),typeof t.retries=="number"&&t.retries>0||t.retries&&typeof t.retries.retries=="number"&&t.retries.retries>0)throw Object.assign(new Error("Cannot use retries with the sync api"),{code:"ESYNC"});return t}mC.exports={toPromise:v8,toSync:C8,toSyncOptions:E8}});var yC=x((Nz,En)=>{"use strict";var Ci=hC(),{toPromise:Bc,toSync:jc,toSyncOptions:Lh}=gC();async function DC(t,e){let r=await Bc(Ci.lock)(t,e);return Bc(r)}function _8(t,e){let r=jc(Ci.lock)(t,Lh(e));return jc(r)}function x8(t,e){return Bc(Ci.unlock)(t,e)}function S8(t,e){return jc(Ci.unlock)(t,Lh(e))}function F8(t,e){return Bc(Ci.check)(t,e)}function A8(t,e){return jc(Ci.check)(t,Lh(e))}En.exports=DC;En.exports.lock=DC;En.exports.unlock=x8;En.exports.lockSync=_8;En.exports.unlockSync=S8;En.exports.check=F8;En.exports.checkSync=A8});var EC=x(Ei=>{"use strict";Object.defineProperty(Ei,"__esModule",{value:!0});Ei.canStoreURLs=Ei.FileUrlStorage=void 0;var bC=require("fs"),O8=$8(Mv()),wC=k8(yC());function CC(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(CC=function(n){return n?r:e})(t)}function k8(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=CC(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if(i!=="default"&&{}.hasOwnProperty.call(t,i)){var a=o?Object.getOwnPropertyDescriptor(t,i):null;a&&(a.get||a.set)?Object.defineProperty(n,i,a):n[i]=t[i]}return n.default=t,r&&r.set(t,n),n}function $8(t){return t&&t.__esModule?t:{default:t}}function ns(t){"@babel/helpers - typeof";return ns=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ns(t)}function P8(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function vC(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,I8(n.key),n)}}function T8(t,e,r){return e&&vC(t.prototype,e),r&&vC(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function I8(t){var e=R8(t,"string");return ns(e)=="symbol"?e:e+""}function R8(t,e){if(ns(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ns(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Lz=Ei.canStoreURLs=!0,Uz=Ei.FileUrlStorage=(function(){function t(e){P8(this,t),this.path=e}return T8(t,[{key:"findAllUploads",value:function(){var r=this;return new Promise(function(n,o){r._getItems("tus::",function(i,a){i?o(i):n(a)})})}},{key:"findUploadsByFingerprint",value:function(r){var n=this;return new Promise(function(o,i){n._getItems("tus::".concat(r),function(a,s){a?i(a):o(s)})})}},{key:"removeUpload",value:function(r){var n=this;return new Promise(function(o,i){n._removeItem(r,function(a){a?i(a):o()})})}},{key:"addUpload",value:function(r,n){var o=this,i=Math.round(Math.random()*1e12),a="tus::".concat(r,"::").concat(i);return new Promise(function(s,u){o._setItem(a,n,function(c){c?u(c):s(a)})})}},{key:"_setItem",value:function(r,n,o){var i=this;wC.lock(this.path,this._lockfileOptions()).then(function(a){o=i._releaseAndCb(a,o),i._getData(function(s,u){if(s){o(s);return}u[r]=n,i._writeData(u,function(c){return o(c)})})}).catch(o)}},{key:"_getItems",value:function(r,n){this._getData(function(o,i){if(o){n(o);return}var a=Object.keys(i).filter(function(s){return s.startsWith(r)}).map(function(s){var u=i[s];return u.urlStorageKey=s,u});n(null,a)})}},{key:"_removeItem",value:function(r,n){var o=this;wC.lock(this.path,this._lockfileOptions()).then(function(i){n=o._releaseAndCb(i,n),o._getData(function(a,s){if(a){n(a);return}delete s[r],o._writeData(s,function(u){return n(u)})})}).catch(n)}},{key:"_lockfileOptions",value:function(){return{realpath:!1,retries:{retries:5,minTimeout:20}}}},{key:"_releaseAndCb",value:function(r,n){return function(o){if(o){r().then(function(){return n(o)}).catch(function(i){return n((0,O8.default)([o,i]))});return}r().then(n).catch(n)}}},{key:"_writeData",value:function(r,n){var o={encoding:"utf8",mode:432,flag:"w"};(0,bC.writeFile)(this.path,JSON.stringify(r),o,function(i){return n(i)})}},{key:"_getData",value:function(r){(0,bC.readFile)(this.path,"utf8",function(n,o){if(n){n.code==="ENOENT"?r(null,{}):r(n);return}try{o=o.trim().length?JSON.parse(o):{}}catch(i){r(i);return}r(null,o)})}}])})()});var qh=x(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});Object.defineProperty(jt,"DefaultHttpStack",{enumerable:!0,get:function(){return FC.default}});Object.defineProperty(jt,"DetailedError",{enumerable:!0,get:function(){return B8.default}});Object.defineProperty(jt,"FileUrlStorage",{enumerable:!0,get:function(){return AC.FileUrlStorage}});Object.defineProperty(jt,"StreamSource",{enumerable:!0,get:function(){return M8.default}});jt.Upload=void 0;Object.defineProperty(jt,"canStoreURLs",{enumerable:!0,get:function(){return AC.canStoreURLs}});jt.defaultOptions=void 0;Object.defineProperty(jt,"enableDebugLog",{enumerable:!0,get:function(){return j8.enableDebugLog}});jt.isSupported=void 0;var B8=bo(Rd()),j8=Bd(),N8=bo(Eb()),Uh=bo(Qb()),L8=bo(pw()),U8=bo(gw()),FC=bo(kw()),M8=bo(Jd()),AC=EC();function bo(t){return t&&t.__esModule?t:{default:t}}function xi(t){"@babel/helpers - typeof";return xi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},xi(t)}function q8(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _C(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,kC(n.key),n)}}function H8(t,e,r){return e&&_C(t.prototype,e),r&&_C(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function V8(t,e,r){return e=Nc(e),z8(t,OC()?Reflect.construct(e,r||[],Nc(t).constructor):e.apply(t,r))}function z8(t,e){if(e&&(xi(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return G8(t)}function G8(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function OC(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(OC=function(){return!!t})()}function Nc(t){return Nc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Nc(t)}function W8(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Mh(t,e)}function Mh(t,e){return Mh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Mh(t,e)}function xC(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r.push.apply(r,n)}return r}function _i(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?xC(Object(r),!0).forEach(function(n){K8(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):xC(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function K8(t,e,r){return e=kC(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function kC(t){var e=Y8(t,"string");return xi(e)=="symbol"?e:e+""}function Y8(t,e){if(xi(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(xi(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var SC=jt.defaultOptions=_i(_i({},Uh.default.defaultOptions),{},{httpStack:new FC.default,fileReader:new L8.default,urlStorage:new N8.default,fingerprint:U8.default}),qz=jt.Upload=(function(t){function e(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return q8(this,e),n=_i(_i({},SC),n),V8(this,e,[r,n])}return W8(e,t),H8(e,null,[{key:"terminate",value:function(n){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return o=_i(_i({},SC),o),Uh.default.terminate(n,o)}}])})(Uh.default),Hz=jt.isSupported=!0});var RC=x((iG,IC)=>{var Si=1e3,Fi=Si*60,Ai=Fi*60,wo=Ai*24,oB=wo*7,iB=wo*365.25;IC.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return aB(t);if(r==="number"&&isFinite(t))return e.long?uB(t):sB(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function aB(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*iB;case"weeks":case"week":case"w":return r*oB;case"days":case"day":case"d":return r*wo;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Ai;case"minutes":case"minute":case"mins":case"min":case"m":return r*Fi;case"seconds":case"second":case"secs":case"sec":case"s":return r*Si;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function sB(t){var e=Math.abs(t);return e>=wo?Math.round(t/wo)+"d":e>=Ai?Math.round(t/Ai)+"h":e>=Fi?Math.round(t/Fi)+"m":e>=Si?Math.round(t/Si)+"s":t+"ms"}function uB(t){var e=Math.abs(t);return e>=wo?Uc(t,e,wo,"day"):e>=Ai?Uc(t,e,Ai,"hour"):e>=Fi?Uc(t,e,Fi,"minute"):e>=Si?Uc(t,e,Si,"second"):t+" ms"}function Uc(t,e,r,n){var o=e>=r*1.5;return Math.round(t/r)+" "+n+(o?"s":"")}});var zh=x((aG,BC)=>{function cB(t){r.debug=r,r.default=r,r.coerce=u,r.disable=a,r.enable=o,r.enabled=s,r.humanize=RC(),r.destroy=c,Object.keys(t).forEach(l=>{r[l]=t[l]}),r.names=[],r.skips=[],r.formatters={};function e(l){let p=0;for(let d=0;d<l.length;d++)p=(p<<5)-p+l.charCodeAt(d),p|=0;return r.colors[Math.abs(p)%r.colors.length]}r.selectColor=e;function r(l){let p,d=null,h,m;function b(...D){if(!b.enabled)return;let C=b,E=Number(new Date),g=E-(p||E);C.diff=g,C.prev=p,C.curr=E,p=E,D[0]=r.coerce(D[0]),typeof D[0]!="string"&&D.unshift("%O");let _=0;D[0]=D[0].replace(/%([a-zA-Z%])/g,($,k)=>{if($==="%%")return"%";_++;let B=r.formatters[k];if(typeof B=="function"){let R=D[_];$=B.call(C,R),D.splice(_,1),_--}return $}),r.formatArgs.call(C,D),(C.log||r.log).apply(C,D)}return b.namespace=l,b.useColors=r.useColors(),b.color=r.selectColor(l),b.extend=n,b.destroy=r.destroy,Object.defineProperty(b,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(h!==r.namespaces&&(h=r.namespaces,m=r.enabled(l)),m),set:D=>{d=D}}),typeof r.init=="function"&&r.init(b),b}function n(l,p){let d=r(this.namespace+(typeof p>"u"?":":p)+l);return d.log=this.log,d}function o(l){r.save(l),r.namespaces=l,r.names=[],r.skips=[];let p=(typeof l=="string"?l:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let d of p)d[0]==="-"?r.skips.push(d.slice(1)):r.names.push(d)}function i(l,p){let d=0,h=0,m=-1,b=0;for(;d<l.length;)if(h<p.length&&(p[h]===l[d]||p[h]==="*"))p[h]==="*"?(m=h,b=d,h++):(d++,h++);else if(m!==-1)h=m+1,b++,d=b;else return!1;for(;h<p.length&&p[h]==="*";)h++;return h===p.length}function a(){let l=[...r.names,...r.skips.map(p=>"-"+p)].join(",");return r.enable(""),l}function s(l){for(let p of r.skips)if(i(l,p))return!1;for(let p of r.names)if(i(l,p))return!0;return!1}function u(l){return l instanceof Error?l.stack||l.message:l}function c(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}BC.exports=cB});var jC=x((Nt,Mc)=>{Nt.formatArgs=fB;Nt.save=pB;Nt.load=dB;Nt.useColors=lB;Nt.storage=hB();Nt.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();Nt.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function lB(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function fB(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+Mc.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,n=0;t[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(r++,o==="%c"&&(n=r))}),t.splice(n,0,e)}Nt.log=console.debug||console.log||(()=>{});function pB(t){try{t?Nt.storage.setItem("debug",t):Nt.storage.removeItem("debug")}catch{}}function dB(){let t;try{t=Nt.storage.getItem("debug")||Nt.storage.getItem("DEBUG")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function hB(){try{return localStorage}catch{}}Mc.exports=zh()(Nt);var{formatters:mB}=Mc.exports;mB.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var LC=x((sG,NC)=>{"use strict";NC.exports=(t,e=process.argv)=>{let r=t.startsWith("-")?"":t.length===1?"-":"--",n=e.indexOf(r+t),o=e.indexOf("--");return n!==-1&&(o===-1||n<o)}});var qC=x((uG,MC)=>{"use strict";var gB=require("os"),UC=require("tty"),sr=LC(),{env:at}=process,_n;sr("no-color")||sr("no-colors")||sr("color=false")||sr("color=never")?_n=0:(sr("color")||sr("colors")||sr("color=true")||sr("color=always"))&&(_n=1);"FORCE_COLOR"in at&&(at.FORCE_COLOR==="true"?_n=1:at.FORCE_COLOR==="false"?_n=0:_n=at.FORCE_COLOR.length===0?1:Math.min(parseInt(at.FORCE_COLOR,10),3));function Gh(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function Wh(t,e){if(_n===0)return 0;if(sr("color=16m")||sr("color=full")||sr("color=truecolor"))return 3;if(sr("color=256"))return 2;if(t&&!e&&_n===void 0)return 0;let r=_n||0;if(at.TERM==="dumb")return r;if(process.platform==="win32"){let n=gB.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in at)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in at)||at.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in at)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(at.TEAMCITY_VERSION)?1:0;if(at.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in at){let n=parseInt((at.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(at.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(at.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(at.TERM)||"COLORTERM"in at?1:r}function DB(t){let e=Wh(t,t&&t.isTTY);return Gh(e)}MC.exports={supportsColor:DB,stdout:Gh(Wh(!0,UC.isatty(1))),stderr:Gh(Wh(!0,UC.isatty(2)))}});var VC=x((st,Hc)=>{var yB=require("tty"),qc=require("util");st.init=xB;st.log=CB;st.formatArgs=wB;st.save=EB;st.load=_B;st.useColors=bB;st.destroy=qc.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");st.colors=[6,2,3,4,5,1];try{let t=qC();t&&(t.stderr||t).level>=2&&(st.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}st.inspectOpts=Object.keys(process.env).filter(t=>/^debug_/i.test(t)).reduce((t,e)=>{let r=e.substring(6).toLowerCase().replace(/_([a-z])/g,(o,i)=>i.toUpperCase()),n=process.env[e];return/^(yes|on|true|enabled)$/i.test(n)?n=!0:/^(no|off|false|disabled)$/i.test(n)?n=!1:n==="null"?n=null:n=Number(n),t[r]=n,t},{});function bB(){return"colors"in st.inspectOpts?!!st.inspectOpts.colors:yB.isatty(process.stderr.fd)}function wB(t){let{namespace:e,useColors:r}=this;if(r){let n=this.color,o="\x1B[3"+(n<8?n:"8;5;"+n),i=` ${o};1m${e} \x1B[0m`;t[0]=i+t[0].split(`
45
45
  `).join(`
46
- `+i),t.push(o+"m+"+Uc.exports.humanize(this.diff)+"\x1B[0m")}else t[0]=DB()+e+" "+t[0]}function DB(){return at.inspectOpts.hideDate?"":new Date().toISOString()+" "}function yB(...t){return process.stderr.write(Lc.formatWithOptions(at.inspectOpts,...t)+`
47
- `)}function bB(t){t?process.env.DEBUG=t:delete process.env.DEBUG}function vB(){return process.env.DEBUG}function wB(t){t.inspectOpts={};let e=Object.keys(at.inspectOpts);for(let r=0;r<e.length;r++)t.inspectOpts[e[r]]=at.inspectOpts[e[r]]}Uc.exports=qh()(at);var{formatters:UC}=Uc.exports;UC.o=function(t){return this.inspectOpts.colors=this.useColors,Lc.inspect(t,this.inspectOpts).split(`
48
- `).map(e=>e.trim()).join(" ")};UC.O=function(t){return this.inspectOpts.colors=this.useColors,Lc.inspect(t,this.inspectOpts)}});var Gh=x((tG,zh)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?zh.exports=IC():zh.exports=MC()});var st=x(Wh=>{"use strict";Wh.fromCallback=function(t){return Object.defineProperty(function(...e){if(typeof e[e.length-1]=="function")t.apply(this,e);else return new Promise((r,n)=>{e.push((o,i)=>o!=null?n(o):r(i)),t.apply(this,e)})},"name",{value:t.name})};Wh.fromPromise=function(t){return Object.defineProperty(function(...e){let r=e[e.length-1];if(typeof r!="function")return t.apply(this,e);e.pop(),t.apply(this,e).then(n=>r(null,n),r)},"name",{value:t.name})}});var $t=x(Zr=>{"use strict";var qC=st().fromCallback,kt=wn(),CB=["access","appendFile","chmod","chown","close","copyFile","cp","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","glob","lchmod","lchown","lutimes","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","statfs","symlink","truncate","unlink","utimes","writeFile"].filter(t=>typeof kt[t]=="function");Object.assign(Zr,kt);CB.forEach(t=>{Zr[t]=qC(kt[t])});Zr.exists=function(t,e){return typeof e=="function"?kt.exists(t,e):new Promise(r=>kt.exists(t,r))};Zr.read=function(t,e,r,n,o,i){return typeof i=="function"?kt.read(t,e,r,n,o,i):new Promise((a,s)=>{kt.read(t,e,r,n,o,(u,c,l)=>{if(u)return s(u);a({bytesRead:c,buffer:l})})})};Zr.write=function(t,e,...r){return typeof r[r.length-1]=="function"?kt.write(t,e,...r):new Promise((n,o)=>{kt.write(t,e,...r,(i,a,s)=>{if(i)return o(i);n({bytesWritten:a,buffer:s})})})};Zr.readv=function(t,e,...r){return typeof r[r.length-1]=="function"?kt.readv(t,e,...r):new Promise((n,o)=>{kt.readv(t,e,...r,(i,a,s)=>{if(i)return o(i);n({bytesRead:a,buffers:s})})})};Zr.writev=function(t,e,...r){return typeof r[r.length-1]=="function"?kt.writev(t,e,...r):new Promise((n,o)=>{kt.writev(t,e,...r,(i,a,s)=>{if(i)return o(i);n({bytesWritten:a,buffers:s})})})};typeof kt.realpath.native=="function"?Zr.realpath.native=qC(kt.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")});var VC=x((oG,HC)=>{"use strict";var EB=require("path");HC.exports.checkPath=function(e){if(process.platform==="win32"&&/[<>:"|?*]/.test(e.replace(EB.parse(e).root,""))){let n=new Error(`Path contains invalid characters: ${e}`);throw n.code="EINVAL",n}}});var KC=x((iG,Kh)=>{"use strict";var zC=$t(),{checkPath:GC}=VC(),WC=t=>{let e={mode:511};return typeof t=="number"?t:{...e,...t}.mode};Kh.exports.makeDir=async(t,e)=>(GC(t),zC.mkdir(t,{mode:WC(e),recursive:!0}));Kh.exports.makeDirSync=(t,e)=>(GC(t),zC.mkdirSync(t,{mode:WC(e),recursive:!0}))});var Er=x((aG,YC)=>{"use strict";var _B=st().fromPromise,{makeDir:xB,makeDirSync:Yh}=KC(),Jh=_B(xB);YC.exports={mkdirs:Jh,mkdirsSync:Yh,mkdirp:Jh,mkdirpSync:Yh,ensureDir:Jh,ensureDirSync:Yh}});var _n=x((sG,XC)=>{"use strict";var SB=st().fromPromise,JC=$t();function FB(t){return JC.access(t).then(()=>!0).catch(()=>!1)}XC.exports={pathExists:SB(FB),pathExistsSync:JC.existsSync}});var Xh=x((uG,ZC)=>{"use strict";var Si=$t(),AB=st().fromPromise;async function OB(t,e,r){let n=await Si.open(t,"r+"),o=null;try{await Si.futimes(n,e,r)}finally{try{await Si.close(n)}catch(i){o=i}}if(o)throw o}function kB(t,e,r){let n=Si.openSync(t,"r+");return Si.futimesSync(n,e,r),Si.closeSync(n)}ZC.exports={utimesMillis:AB(OB),utimesMillisSync:kB}});var vo=x((cG,rE)=>{"use strict";var Fi=$t(),ut=require("path"),QC=st().fromPromise;function $B(t,e,r){let n=r.dereference?o=>Fi.stat(o,{bigint:!0}):o=>Fi.lstat(o,{bigint:!0});return Promise.all([n(t),n(e).catch(o=>{if(o.code==="ENOENT")return null;throw o})]).then(([o,i])=>({srcStat:o,destStat:i}))}function PB(t,e,r){let n,o=r.dereference?a=>Fi.statSync(a,{bigint:!0}):a=>Fi.lstatSync(a,{bigint:!0}),i=o(t);try{n=o(e)}catch(a){if(a.code==="ENOENT")return{srcStat:i,destStat:null};throw a}return{srcStat:i,destStat:n}}async function TB(t,e,r,n){let{srcStat:o,destStat:i}=await $B(t,e,n);if(i){if(ts(o,i)){let a=ut.basename(t),s=ut.basename(e);if(r==="move"&&a!==s&&a.toLowerCase()===s.toLowerCase())return{srcStat:o,destStat:i,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(o.isDirectory()&&!i.isDirectory())throw new Error(`Cannot overwrite non-directory '${e}' with directory '${t}'.`);if(!o.isDirectory()&&i.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${t}'.`)}if(o.isDirectory()&&Zh(t,e))throw new Error(Mc(t,e,r));return{srcStat:o,destStat:i}}function IB(t,e,r,n){let{srcStat:o,destStat:i}=PB(t,e,n);if(i){if(ts(o,i)){let a=ut.basename(t),s=ut.basename(e);if(r==="move"&&a!==s&&a.toLowerCase()===s.toLowerCase())return{srcStat:o,destStat:i,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(o.isDirectory()&&!i.isDirectory())throw new Error(`Cannot overwrite non-directory '${e}' with directory '${t}'.`);if(!o.isDirectory()&&i.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${t}'.`)}if(o.isDirectory()&&Zh(t,e))throw new Error(Mc(t,e,r));return{srcStat:o,destStat:i}}async function eE(t,e,r,n){let o=ut.resolve(ut.dirname(t)),i=ut.resolve(ut.dirname(r));if(i===o||i===ut.parse(i).root)return;let a;try{a=await Fi.stat(i,{bigint:!0})}catch(s){if(s.code==="ENOENT")return;throw s}if(ts(e,a))throw new Error(Mc(t,r,n));return eE(t,e,i,n)}function tE(t,e,r,n){let o=ut.resolve(ut.dirname(t)),i=ut.resolve(ut.dirname(r));if(i===o||i===ut.parse(i).root)return;let a;try{a=Fi.statSync(i,{bigint:!0})}catch(s){if(s.code==="ENOENT")return;throw s}if(ts(e,a))throw new Error(Mc(t,r,n));return tE(t,e,i,n)}function ts(t,e){return e.ino!==void 0&&e.dev!==void 0&&e.ino===t.ino&&e.dev===t.dev}function Zh(t,e){let r=ut.resolve(t).split(ut.sep).filter(o=>o),n=ut.resolve(e).split(ut.sep).filter(o=>o);return r.every((o,i)=>n[i]===o)}function Mc(t,e,r){return`Cannot ${r} '${t}' to a subdirectory of itself, '${e}'.`}rE.exports={checkPaths:QC(TB),checkPathsSync:IB,checkParentPaths:QC(eE),checkParentPathsSync:tE,isSrcSubdir:Zh,areIdentical:ts}});var oE=x((lG,nE)=>{"use strict";async function RB(t,e){let r=[];for await(let n of t)r.push(e(n).then(()=>null,o=>o??new Error("unknown error")));await Promise.all(r.map(n=>n.then(o=>{if(o!==null)throw o})))}nE.exports={asyncIteratorConcurrentProcess:RB}});var cE=x((fG,uE)=>{"use strict";var yt=$t(),rs=require("path"),{mkdirs:BB}=Er(),{pathExists:jB}=_n(),{utimesMillis:NB}=Xh(),ns=vo(),{asyncIteratorConcurrentProcess:LB}=oE();async function UB(t,e,r={}){typeof r=="function"&&(r={filter:r}),r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
46
+ `+i),t.push(o+"m+"+Hc.exports.humanize(this.diff)+"\x1B[0m")}else t[0]=vB()+e+" "+t[0]}function vB(){return st.inspectOpts.hideDate?"":new Date().toISOString()+" "}function CB(...t){return process.stderr.write(qc.formatWithOptions(st.inspectOpts,...t)+`
47
+ `)}function EB(t){t?process.env.DEBUG=t:delete process.env.DEBUG}function _B(){return process.env.DEBUG}function xB(t){t.inspectOpts={};let e=Object.keys(st.inspectOpts);for(let r=0;r<e.length;r++)t.inspectOpts[e[r]]=st.inspectOpts[e[r]]}Hc.exports=zh()(st);var{formatters:HC}=Hc.exports;HC.o=function(t){return this.inspectOpts.colors=this.useColors,qc.inspect(t,this.inspectOpts).split(`
48
+ `).map(e=>e.trim()).join(" ")};HC.O=function(t){return this.inspectOpts.colors=this.useColors,qc.inspect(t,this.inspectOpts)}});var Yh=x((cG,Kh)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?Kh.exports=jC():Kh.exports=VC()});var ut=x(Jh=>{"use strict";Jh.fromCallback=function(t){return Object.defineProperty(function(...e){if(typeof e[e.length-1]=="function")t.apply(this,e);else return new Promise((r,n)=>{e.push((o,i)=>o!=null?n(o):r(i)),t.apply(this,e)})},"name",{value:t.name})};Jh.fromPromise=function(t){return Object.defineProperty(function(...e){let r=e[e.length-1];if(typeof r!="function")return t.apply(this,e);e.pop(),t.apply(this,e).then(n=>r(null,n),r)},"name",{value:t.name})}});var Ot=x(Zr=>{"use strict";var zC=ut().fromCallback,At=Cn(),SB=["access","appendFile","chmod","chown","close","copyFile","cp","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","glob","lchmod","lchown","lutimes","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","statfs","symlink","truncate","unlink","utimes","writeFile"].filter(t=>typeof At[t]=="function");Object.assign(Zr,At);SB.forEach(t=>{Zr[t]=zC(At[t])});Zr.exists=function(t,e){return typeof e=="function"?At.exists(t,e):new Promise(r=>At.exists(t,r))};Zr.read=function(t,e,r,n,o,i){return typeof i=="function"?At.read(t,e,r,n,o,i):new Promise((a,s)=>{At.read(t,e,r,n,o,(u,c,l)=>{if(u)return s(u);a({bytesRead:c,buffer:l})})})};Zr.write=function(t,e,...r){return typeof r[r.length-1]=="function"?At.write(t,e,...r):new Promise((n,o)=>{At.write(t,e,...r,(i,a,s)=>{if(i)return o(i);n({bytesWritten:a,buffer:s})})})};Zr.readv=function(t,e,...r){return typeof r[r.length-1]=="function"?At.readv(t,e,...r):new Promise((n,o)=>{At.readv(t,e,...r,(i,a,s)=>{if(i)return o(i);n({bytesRead:a,buffers:s})})})};Zr.writev=function(t,e,...r){return typeof r[r.length-1]=="function"?At.writev(t,e,...r):new Promise((n,o)=>{At.writev(t,e,...r,(i,a,s)=>{if(i)return o(i);n({bytesWritten:a,buffers:s})})})};typeof At.realpath.native=="function"?Zr.realpath.native=zC(At.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")});var WC=x((pG,GC)=>{"use strict";var FB=require("path");GC.exports.checkPath=function(e){if(process.platform==="win32"&&/[<>:"|?*]/.test(e.replace(FB.parse(e).root,""))){let n=new Error(`Path contains invalid characters: ${e}`);throw n.code="EINVAL",n}}});var XC=x((dG,Xh)=>{"use strict";var KC=Ot(),{checkPath:YC}=WC(),JC=t=>{let e={mode:511};return typeof t=="number"?t:{...e,...t}.mode};Xh.exports.makeDir=async(t,e)=>(YC(t),KC.mkdir(t,{mode:JC(e),recursive:!0}));Xh.exports.makeDirSync=(t,e)=>(YC(t),KC.mkdirSync(t,{mode:JC(e),recursive:!0}))});var Cr=x((hG,ZC)=>{"use strict";var AB=ut().fromPromise,{makeDir:OB,makeDirSync:Zh}=XC(),Qh=AB(OB);ZC.exports={mkdirs:Qh,mkdirsSync:Zh,mkdirp:Qh,mkdirpSync:Zh,ensureDir:Qh,ensureDirSync:Zh}});var xn=x((mG,eE)=>{"use strict";var kB=ut().fromPromise,QC=Ot();function $B(t){return QC.access(t).then(()=>!0).catch(()=>!1)}eE.exports={pathExists:kB($B),pathExistsSync:QC.existsSync}});var em=x((gG,tE)=>{"use strict";var Oi=Ot(),PB=ut().fromPromise;async function TB(t,e,r){let n=await Oi.open(t,"r+"),o=null;try{await Oi.futimes(n,e,r)}finally{try{await Oi.close(n)}catch(i){o=i}}if(o)throw o}function IB(t,e,r){let n=Oi.openSync(t,"r+");return Oi.futimesSync(n,e,r),Oi.closeSync(n)}tE.exports={utimesMillis:PB(TB),utimesMillisSync:IB}});var vo=x((DG,iE)=>{"use strict";var ki=Ot(),ct=require("path"),rE=ut().fromPromise;function RB(t,e,r){let n=r.dereference?o=>ki.stat(o,{bigint:!0}):o=>ki.lstat(o,{bigint:!0});return Promise.all([n(t),n(e).catch(o=>{if(o.code==="ENOENT")return null;throw o})]).then(([o,i])=>({srcStat:o,destStat:i}))}function BB(t,e,r){let n,o=r.dereference?a=>ki.statSync(a,{bigint:!0}):a=>ki.lstatSync(a,{bigint:!0}),i=o(t);try{n=o(e)}catch(a){if(a.code==="ENOENT")return{srcStat:i,destStat:null};throw a}return{srcStat:i,destStat:n}}async function jB(t,e,r,n){let{srcStat:o,destStat:i}=await RB(t,e,n);if(i){if(os(o,i)){let a=ct.basename(t),s=ct.basename(e);if(r==="move"&&a!==s&&a.toLowerCase()===s.toLowerCase())return{srcStat:o,destStat:i,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(o.isDirectory()&&!i.isDirectory())throw new Error(`Cannot overwrite non-directory '${e}' with directory '${t}'.`);if(!o.isDirectory()&&i.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${t}'.`)}if(o.isDirectory()&&tm(t,e))throw new Error(Vc(t,e,r));return{srcStat:o,destStat:i}}function NB(t,e,r,n){let{srcStat:o,destStat:i}=BB(t,e,n);if(i){if(os(o,i)){let a=ct.basename(t),s=ct.basename(e);if(r==="move"&&a!==s&&a.toLowerCase()===s.toLowerCase())return{srcStat:o,destStat:i,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(o.isDirectory()&&!i.isDirectory())throw new Error(`Cannot overwrite non-directory '${e}' with directory '${t}'.`);if(!o.isDirectory()&&i.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${t}'.`)}if(o.isDirectory()&&tm(t,e))throw new Error(Vc(t,e,r));return{srcStat:o,destStat:i}}async function nE(t,e,r,n){let o=ct.resolve(ct.dirname(t)),i=ct.resolve(ct.dirname(r));if(i===o||i===ct.parse(i).root)return;let a;try{a=await ki.stat(i,{bigint:!0})}catch(s){if(s.code==="ENOENT")return;throw s}if(os(e,a))throw new Error(Vc(t,r,n));return nE(t,e,i,n)}function oE(t,e,r,n){let o=ct.resolve(ct.dirname(t)),i=ct.resolve(ct.dirname(r));if(i===o||i===ct.parse(i).root)return;let a;try{a=ki.statSync(i,{bigint:!0})}catch(s){if(s.code==="ENOENT")return;throw s}if(os(e,a))throw new Error(Vc(t,r,n));return oE(t,e,i,n)}function os(t,e){return e.ino!==void 0&&e.dev!==void 0&&e.ino===t.ino&&e.dev===t.dev}function tm(t,e){let r=ct.resolve(t).split(ct.sep).filter(o=>o),n=ct.resolve(e).split(ct.sep).filter(o=>o);return r.every((o,i)=>n[i]===o)}function Vc(t,e,r){return`Cannot ${r} '${t}' to a subdirectory of itself, '${e}'.`}iE.exports={checkPaths:rE(jB),checkPathsSync:NB,checkParentPaths:rE(nE),checkParentPathsSync:oE,isSrcSubdir:tm,areIdentical:os}});var sE=x((yG,aE)=>{"use strict";async function LB(t,e){let r=[];for await(let n of t)r.push(e(n).then(()=>null,o=>o??new Error("unknown error")));await Promise.all(r.map(n=>n.then(o=>{if(o!==null)throw o})))}aE.exports={asyncIteratorConcurrentProcess:LB}});var pE=x((bG,fE)=>{"use strict";var Dt=Ot(),is=require("path"),{mkdirs:UB}=Cr(),{pathExists:MB}=xn(),{utimesMillis:qB}=em(),as=vo(),{asyncIteratorConcurrentProcess:HB}=sE();async function VB(t,e,r={}){typeof r=="function"&&(r={filter:r}),r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
49
49
 
50
- see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0001");let{srcStat:n,destStat:o}=await ns.checkPaths(t,e,"copy",r);if(await ns.checkParentPaths(t,n,e,"copy"),!await aE(t,e,r))return;let a=rs.dirname(e);await jB(a)||await BB(a),await sE(o,t,e,r)}async function aE(t,e,r){return r.filter?r.filter(t,e):!0}async function sE(t,e,r,n){let i=await(n.dereference?yt.stat:yt.lstat)(e);if(i.isDirectory())return VB(i,t,e,r,n);if(i.isFile()||i.isCharacterDevice()||i.isBlockDevice())return MB(i,t,e,r,n);if(i.isSymbolicLink())return zB(t,e,r,n);throw i.isSocket()?new Error(`Cannot copy a socket file: ${e}`):i.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${e}`):new Error(`Unknown file: ${e}`)}async function MB(t,e,r,n,o){if(!e)return iE(t,r,n,o);if(o.overwrite)return await yt.unlink(n),iE(t,r,n,o);if(o.errorOnExist)throw new Error(`'${n}' already exists`)}async function iE(t,e,r,n){if(await yt.copyFile(e,r),n.preserveTimestamps){qB(t.mode)&&await HB(r,t.mode);let o=await yt.stat(e);await NB(r,o.atime,o.mtime)}return yt.chmod(r,t.mode)}function qB(t){return(t&128)===0}function HB(t,e){return yt.chmod(t,e|128)}async function VB(t,e,r,n,o){e||await yt.mkdir(n),await LB(await yt.opendir(r),async i=>{let a=rs.join(r,i.name),s=rs.join(n,i.name);if(await aE(a,s,o)){let{destStat:c}=await ns.checkPaths(a,s,"copy",o);await sE(c,a,s,o)}}),e||await yt.chmod(n,t.mode)}async function zB(t,e,r,n){let o=await yt.readlink(e);if(n.dereference&&(o=rs.resolve(process.cwd(),o)),!t)return yt.symlink(o,r);let i=null;try{i=await yt.readlink(r)}catch(a){if(a.code==="EINVAL"||a.code==="UNKNOWN")return yt.symlink(o,r);throw a}if(n.dereference&&(i=rs.resolve(process.cwd(),i)),ns.isSrcSubdir(o,i))throw new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`);if(ns.isSrcSubdir(i,o))throw new Error(`Cannot overwrite '${i}' with '${o}'.`);return await yt.unlink(r),yt.symlink(o,r)}uE.exports=UB});var hE=x((pG,dE)=>{"use strict";var Pt=wn(),os=require("path"),GB=Er().mkdirsSync,WB=Xh().utimesMillisSync,is=vo();function KB(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;
50
+ see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0001");let{srcStat:n,destStat:o}=await as.checkPaths(t,e,"copy",r);if(await as.checkParentPaths(t,n,e,"copy"),!await cE(t,e,r))return;let a=is.dirname(e);await MB(a)||await UB(a),await lE(o,t,e,r)}async function cE(t,e,r){return r.filter?r.filter(t,e):!0}async function lE(t,e,r,n){let i=await(n.dereference?Dt.stat:Dt.lstat)(e);if(i.isDirectory())return KB(i,t,e,r,n);if(i.isFile()||i.isCharacterDevice()||i.isBlockDevice())return zB(i,t,e,r,n);if(i.isSymbolicLink())return YB(t,e,r,n);throw i.isSocket()?new Error(`Cannot copy a socket file: ${e}`):i.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${e}`):new Error(`Unknown file: ${e}`)}async function zB(t,e,r,n,o){if(!e)return uE(t,r,n,o);if(o.overwrite)return await Dt.unlink(n),uE(t,r,n,o);if(o.errorOnExist)throw new Error(`'${n}' already exists`)}async function uE(t,e,r,n){if(await Dt.copyFile(e,r),n.preserveTimestamps){GB(t.mode)&&await WB(r,t.mode);let o=await Dt.stat(e);await qB(r,o.atime,o.mtime)}return Dt.chmod(r,t.mode)}function GB(t){return(t&128)===0}function WB(t,e){return Dt.chmod(t,e|128)}async function KB(t,e,r,n,o){e||await Dt.mkdir(n),await HB(await Dt.opendir(r),async i=>{let a=is.join(r,i.name),s=is.join(n,i.name);if(await cE(a,s,o)){let{destStat:c}=await as.checkPaths(a,s,"copy",o);await lE(c,a,s,o)}}),e||await Dt.chmod(n,t.mode)}async function YB(t,e,r,n){let o=await Dt.readlink(e);if(n.dereference&&(o=is.resolve(process.cwd(),o)),!t)return Dt.symlink(o,r);let i=null;try{i=await Dt.readlink(r)}catch(a){if(a.code==="EINVAL"||a.code==="UNKNOWN")return Dt.symlink(o,r);throw a}if(n.dereference&&(i=is.resolve(process.cwd(),i)),as.isSrcSubdir(o,i))throw new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`);if(as.isSrcSubdir(i,o))throw new Error(`Cannot overwrite '${i}' with '${o}'.`);return await Dt.unlink(r),Dt.symlink(o,r)}fE.exports=VB});var DE=x((wG,gE)=>{"use strict";var kt=Cn(),ss=require("path"),JB=Cr().mkdirsSync,XB=em().utimesMillisSync,us=vo();function ZB(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;
51
51
 
52
- see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0002");let{srcStat:n,destStat:o}=is.checkPathsSync(t,e,"copy",r);if(is.checkParentPathsSync(t,n,e,"copy"),r.filter&&!r.filter(t,e))return;let i=os.dirname(e);return Pt.existsSync(i)||GB(i),lE(o,t,e,r)}function lE(t,e,r,n){let i=(n.dereference?Pt.statSync:Pt.lstatSync)(e);if(i.isDirectory())return tj(i,t,e,r,n);if(i.isFile()||i.isCharacterDevice()||i.isBlockDevice())return YB(i,t,e,r,n);if(i.isSymbolicLink())return oj(t,e,r,n);throw i.isSocket()?new Error(`Cannot copy a socket file: ${e}`):i.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${e}`):new Error(`Unknown file: ${e}`)}function YB(t,e,r,n,o){return e?JB(t,r,n,o):fE(t,r,n,o)}function JB(t,e,r,n){if(n.overwrite)return Pt.unlinkSync(r),fE(t,e,r,n);if(n.errorOnExist)throw new Error(`'${r}' already exists`)}function fE(t,e,r,n){return Pt.copyFileSync(e,r),n.preserveTimestamps&&XB(t.mode,e,r),Qh(r,t.mode)}function XB(t,e,r){return ZB(t)&&QB(r,t),ej(e,r)}function ZB(t){return(t&128)===0}function QB(t,e){return Qh(t,e|128)}function Qh(t,e){return Pt.chmodSync(t,e)}function ej(t,e){let r=Pt.statSync(t);return WB(e,r.atime,r.mtime)}function tj(t,e,r,n,o){return e?pE(r,n,o):rj(t.mode,r,n,o)}function rj(t,e,r,n){return Pt.mkdirSync(r),pE(e,r,n),Qh(r,t)}function pE(t,e,r){let n=Pt.opendirSync(t);try{let o;for(;(o=n.readSync())!==null;)nj(o.name,t,e,r)}finally{n.closeSync()}}function nj(t,e,r,n){let o=os.join(e,t),i=os.join(r,t);if(n.filter&&!n.filter(o,i))return;let{destStat:a}=is.checkPathsSync(o,i,"copy",n);return lE(a,o,i,n)}function oj(t,e,r,n){let o=Pt.readlinkSync(e);if(n.dereference&&(o=os.resolve(process.cwd(),o)),t){let i;try{i=Pt.readlinkSync(r)}catch(a){if(a.code==="EINVAL"||a.code==="UNKNOWN")return Pt.symlinkSync(o,r);throw a}if(n.dereference&&(i=os.resolve(process.cwd(),i)),is.isSrcSubdir(o,i))throw new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`);if(is.isSrcSubdir(i,o))throw new Error(`Cannot overwrite '${i}' with '${o}'.`);return ij(o,r)}else return Pt.symlinkSync(o,r)}function ij(t,e){return Pt.unlinkSync(e),Pt.symlinkSync(t,e)}dE.exports=KB});var qc=x((dG,mE)=>{"use strict";var aj=st().fromPromise;mE.exports={copy:aj(cE()),copySync:hE()}});var as=x((hG,DE)=>{"use strict";var gE=wn(),sj=st().fromCallback;function uj(t,e){gE.rm(t,{recursive:!0,force:!0},e)}function cj(t){gE.rmSync(t,{recursive:!0,force:!0})}DE.exports={remove:sj(uj),removeSync:cj}});var xE=x((mG,_E)=>{"use strict";var lj=st().fromPromise,vE=$t(),wE=require("path"),CE=Er(),EE=as(),yE=lj(async function(e){let r;try{r=await vE.readdir(e)}catch{return CE.mkdirs(e)}return Promise.all(r.map(n=>EE.remove(wE.join(e,n))))});function bE(t){let e;try{e=vE.readdirSync(t)}catch{return CE.mkdirsSync(t)}e.forEach(r=>{r=wE.join(t,r),EE.removeSync(r)})}_E.exports={emptyDirSync:bE,emptydirSync:bE,emptyDir:yE,emptydir:yE}});var OE=x((gG,AE)=>{"use strict";var fj=st().fromPromise,SE=require("path"),Qr=$t(),FE=Er();async function pj(t){let e;try{e=await Qr.stat(t)}catch{}if(e&&e.isFile())return;let r=SE.dirname(t),n=null;try{n=await Qr.stat(r)}catch(o){if(o.code==="ENOENT"){await FE.mkdirs(r),await Qr.writeFile(t,"");return}else throw o}n.isDirectory()?await Qr.writeFile(t,""):await Qr.readdir(r)}function dj(t){let e;try{e=Qr.statSync(t)}catch{}if(e&&e.isFile())return;let r=SE.dirname(t);try{Qr.statSync(r).isDirectory()||Qr.readdirSync(r)}catch(n){if(n&&n.code==="ENOENT")FE.mkdirsSync(r);else throw n}Qr.writeFileSync(t,"")}AE.exports={createFile:fj(pj),createFileSync:dj}});var IE=x((DG,TE)=>{"use strict";var hj=st().fromPromise,kE=require("path"),xn=$t(),$E=Er(),{pathExists:mj}=_n(),{areIdentical:PE}=vo();async function gj(t,e){let r;try{r=await xn.lstat(e)}catch{}let n;try{n=await xn.lstat(t)}catch(a){throw a.message=a.message.replace("lstat","ensureLink"),a}if(r&&PE(n,r))return;let o=kE.dirname(e);await mj(o)||await $E.mkdirs(o),await xn.link(t,e)}function Dj(t,e){let r;try{r=xn.lstatSync(e)}catch{}try{let i=xn.lstatSync(t);if(r&&PE(i,r))return}catch(i){throw i.message=i.message.replace("lstat","ensureLink"),i}let n=kE.dirname(e);return xn.existsSync(n)||$E.mkdirsSync(n),xn.linkSync(t,e)}TE.exports={createLink:hj(gj),createLinkSync:Dj}});var BE=x((yG,RE)=>{"use strict";var Sn=require("path"),ss=$t(),{pathExists:yj}=_n(),bj=st().fromPromise;async function vj(t,e){if(Sn.isAbsolute(t)){try{await ss.lstat(t)}catch(i){throw i.message=i.message.replace("lstat","ensureSymlink"),i}return{toCwd:t,toDst:t}}let r=Sn.dirname(e),n=Sn.join(r,t);if(await yj(n))return{toCwd:n,toDst:t};try{await ss.lstat(t)}catch(i){throw i.message=i.message.replace("lstat","ensureSymlink"),i}return{toCwd:t,toDst:Sn.relative(r,t)}}function wj(t,e){if(Sn.isAbsolute(t)){if(!ss.existsSync(t))throw new Error("absolute srcpath does not exist");return{toCwd:t,toDst:t}}let r=Sn.dirname(e),n=Sn.join(r,t);if(ss.existsSync(n))return{toCwd:n,toDst:t};if(!ss.existsSync(t))throw new Error("relative srcpath does not exist");return{toCwd:t,toDst:Sn.relative(r,t)}}RE.exports={symlinkPaths:bj(vj),symlinkPathsSync:wj}});var LE=x((bG,NE)=>{"use strict";var jE=$t(),Cj=st().fromPromise;async function Ej(t,e){if(e)return e;let r;try{r=await jE.lstat(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}function _j(t,e){if(e)return e;let r;try{r=jE.lstatSync(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}NE.exports={symlinkType:Cj(Ej),symlinkTypeSync:_j}});var HE=x((vG,qE)=>{"use strict";var xj=st().fromPromise,UE=require("path"),$r=$t(),{mkdirs:Sj,mkdirsSync:Fj}=Er(),{symlinkPaths:Aj,symlinkPathsSync:Oj}=BE(),{symlinkType:kj,symlinkTypeSync:$j}=LE(),{pathExists:Pj}=_n(),{areIdentical:ME}=vo();async function Tj(t,e,r){let n;try{n=await $r.lstat(e)}catch{}if(n&&n.isSymbolicLink()){let[s,u]=await Promise.all([$r.stat(t),$r.stat(e)]);if(ME(s,u))return}let o=await Aj(t,e);t=o.toDst;let i=await kj(o.toCwd,r),a=UE.dirname(e);return await Pj(a)||await Sj(a),$r.symlink(t,e,i)}function Ij(t,e,r){let n;try{n=$r.lstatSync(e)}catch{}if(n&&n.isSymbolicLink()){let s=$r.statSync(t),u=$r.statSync(e);if(ME(s,u))return}let o=Oj(t,e);t=o.toDst,r=$j(o.toCwd,r);let i=UE.dirname(e);return $r.existsSync(i)||Fj(i),$r.symlinkSync(t,e,r)}qE.exports={createSymlink:xj(Tj),createSymlinkSync:Ij}});var XE=x((wG,JE)=>{"use strict";var{createFile:VE,createFileSync:zE}=OE(),{createLink:GE,createLinkSync:WE}=IE(),{createSymlink:KE,createSymlinkSync:YE}=HE();JE.exports={createFile:VE,createFileSync:zE,ensureFile:VE,ensureFileSync:zE,createLink:GE,createLinkSync:WE,ensureLink:GE,ensureLinkSync:WE,createSymlink:KE,createSymlinkSync:YE,ensureSymlink:KE,ensureSymlinkSync:YE}});var Hc=x((CG,ZE)=>{function Rj(t,{EOL:e=`
53
- `,finalEOL:r=!0,replacer:n=null,spaces:o}={}){let i=r?e:"";return JSON.stringify(t,n,o).replace(/\n/g,e)+i}function Bj(t){return Buffer.isBuffer(t)&&(t=t.toString("utf8")),t.replace(/^\uFEFF/,"")}ZE.exports={stringify:Rj,stripBom:Bj}});var r_=x((EG,t_)=>{var Ai;try{Ai=wn()}catch{Ai=require("fs")}var Vc=st(),{stringify:QE,stripBom:e_}=Hc();async function jj(t,e={}){typeof e=="string"&&(e={encoding:e});let r=e.fs||Ai,n="throws"in e?e.throws:!0,o=await Vc.fromCallback(r.readFile)(t,e);o=e_(o);let i;try{i=JSON.parse(o,e?e.reviver:null)}catch(a){if(n)throw a.message=`${t}: ${a.message}`,a;return null}return i}var Nj=Vc.fromPromise(jj);function Lj(t,e={}){typeof e=="string"&&(e={encoding:e});let r=e.fs||Ai,n="throws"in e?e.throws:!0;try{let o=r.readFileSync(t,e);return o=e_(o),JSON.parse(o,e.reviver)}catch(o){if(n)throw o.message=`${t}: ${o.message}`,o;return null}}async function Uj(t,e,r={}){let n=r.fs||Ai,o=QE(e,r);await Vc.fromCallback(n.writeFile)(t,o,r)}var Mj=Vc.fromPromise(Uj);function qj(t,e,r={}){let n=r.fs||Ai,o=QE(e,r);return n.writeFileSync(t,o,r)}t_.exports={readFile:Nj,readFileSync:Lj,writeFile:Mj,writeFileSync:qj}});var o_=x((_G,n_)=>{"use strict";var zc=r_();n_.exports={readJson:zc.readFile,readJsonSync:zc.readFileSync,writeJson:zc.writeFile,writeJsonSync:zc.writeFileSync}});var Gc=x((xG,s_)=>{"use strict";var Hj=st().fromPromise,em=$t(),i_=require("path"),a_=Er(),Vj=_n().pathExists;async function zj(t,e,r="utf-8"){let n=i_.dirname(t);return await Vj(n)||await a_.mkdirs(n),em.writeFile(t,e,r)}function Gj(t,...e){let r=i_.dirname(t);em.existsSync(r)||a_.mkdirsSync(r),em.writeFileSync(t,...e)}s_.exports={outputFile:Hj(zj),outputFileSync:Gj}});var c_=x((SG,u_)=>{"use strict";var{stringify:Wj}=Hc(),{outputFile:Kj}=Gc();async function Yj(t,e,r={}){let n=Wj(e,r);await Kj(t,n,r)}u_.exports=Yj});var f_=x((FG,l_)=>{"use strict";var{stringify:Jj}=Hc(),{outputFileSync:Xj}=Gc();function Zj(t,e,r){let n=Jj(e,r);Xj(t,n,r)}l_.exports=Zj});var d_=x((AG,p_)=>{"use strict";var Qj=st().fromPromise,Tt=o_();Tt.outputJson=Qj(c_());Tt.outputJsonSync=f_();Tt.outputJSON=Tt.outputJson;Tt.outputJSONSync=Tt.outputJsonSync;Tt.writeJSON=Tt.writeJson;Tt.writeJSONSync=Tt.writeJsonSync;Tt.readJSON=Tt.readJson;Tt.readJSONSync=Tt.readJsonSync;p_.exports=Tt});var y_=x((OG,D_)=>{"use strict";var eN=$t(),h_=require("path"),{copy:tN}=qc(),{remove:g_}=as(),{mkdirp:rN}=Er(),{pathExists:nN}=_n(),m_=vo();async function oN(t,e,r={}){let n=r.overwrite||r.clobber||!1,{srcStat:o,isChangingCase:i=!1}=await m_.checkPaths(t,e,"move",r);await m_.checkParentPaths(t,o,e,"move");let a=h_.dirname(e);return h_.parse(a).root!==a&&await rN(a),iN(t,e,n,i)}async function iN(t,e,r,n){if(!n){if(r)await g_(e);else if(await nN(e))throw new Error("dest already exists.")}try{await eN.rename(t,e)}catch(o){if(o.code!=="EXDEV")throw o;await aN(t,e,r)}}async function aN(t,e,r){return await tN(t,e,{overwrite:r,errorOnExist:!0,preserveTimestamps:!0}),g_(t)}D_.exports=oN});var E_=x((kG,C_)=>{"use strict";var v_=wn(),rm=require("path"),sN=qc().copySync,w_=as().removeSync,uN=Er().mkdirpSync,b_=vo();function cN(t,e,r){r=r||{};let n=r.overwrite||r.clobber||!1,{srcStat:o,isChangingCase:i=!1}=b_.checkPathsSync(t,e,"move",r);return b_.checkParentPathsSync(t,o,e,"move"),lN(e)||uN(rm.dirname(e)),fN(t,e,n,i)}function lN(t){let e=rm.dirname(t);return rm.parse(e).root===e}function fN(t,e,r,n){if(n)return tm(t,e,r);if(r)return w_(e),tm(t,e,r);if(v_.existsSync(e))throw new Error("dest already exists.");return tm(t,e,r)}function tm(t,e,r){try{v_.renameSync(t,e)}catch(n){if(n.code!=="EXDEV")throw n;return pN(t,e,r)}}function pN(t,e,r){return sN(t,e,{overwrite:r,errorOnExist:!0,preserveTimestamps:!0}),w_(t)}C_.exports=cN});var x_=x(($G,__)=>{"use strict";var dN=st().fromPromise;__.exports={move:dN(y_()),moveSync:E_()}});var Oi=x((PG,S_)=>{"use strict";S_.exports={...$t(),...qc(),...xE(),...XE(),...d_(),...Er(),...x_(),...Gc(),..._n(),...as()}});var T_=x((TG,P_)=>{"use strict";var nm,A_,O_,k_,$_=!0;typeof process<"u"&&({FORCE_COLOR:nm,NODE_DISABLE_COLORS:A_,NO_COLOR:O_,TERM:k_}=process.env||{},$_=process.stdout&&process.stdout.isTTY);var Se={enabled:!A_&&O_==null&&k_!=="dumb"&&(nm!=null&&nm!=="0"||$_),reset:Te(0,0),bold:Te(1,22),dim:Te(2,22),italic:Te(3,23),underline:Te(4,24),inverse:Te(7,27),hidden:Te(8,28),strikethrough:Te(9,29),black:Te(30,39),red:Te(31,39),green:Te(32,39),yellow:Te(33,39),blue:Te(34,39),magenta:Te(35,39),cyan:Te(36,39),white:Te(37,39),gray:Te(90,39),grey:Te(90,39),bgBlack:Te(40,49),bgRed:Te(41,49),bgGreen:Te(42,49),bgYellow:Te(43,49),bgBlue:Te(44,49),bgMagenta:Te(45,49),bgCyan:Te(46,49),bgWhite:Te(47,49)};function F_(t,e){let r=0,n,o="",i="";for(;r<t.length;r++)n=t[r],o+=n.open,i+=n.close,~e.indexOf(n.close)&&(e=e.replace(n.rgx,n.close+n.open));return o+e+i}function hN(t,e){let r={has:t,keys:e};return r.reset=Se.reset.bind(r),r.bold=Se.bold.bind(r),r.dim=Se.dim.bind(r),r.italic=Se.italic.bind(r),r.underline=Se.underline.bind(r),r.inverse=Se.inverse.bind(r),r.hidden=Se.hidden.bind(r),r.strikethrough=Se.strikethrough.bind(r),r.black=Se.black.bind(r),r.red=Se.red.bind(r),r.green=Se.green.bind(r),r.yellow=Se.yellow.bind(r),r.blue=Se.blue.bind(r),r.magenta=Se.magenta.bind(r),r.cyan=Se.cyan.bind(r),r.white=Se.white.bind(r),r.gray=Se.gray.bind(r),r.grey=Se.grey.bind(r),r.bgBlack=Se.bgBlack.bind(r),r.bgRed=Se.bgRed.bind(r),r.bgGreen=Se.bgGreen.bind(r),r.bgYellow=Se.bgYellow.bind(r),r.bgBlue=Se.bgBlue.bind(r),r.bgMagenta=Se.bgMagenta.bind(r),r.bgCyan=Se.bgCyan.bind(r),r.bgWhite=Se.bgWhite.bind(r),r}function Te(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:Se.enabled?F_(this.keys,n+""):n+""):n===void 0?hN([t],[r]):Se.enabled?F_([r],n+""):n+""}}P_.exports=Se});var ki=x(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.ancillary=Xe.failure=Xe.success=Xe.input=Xe.weak=Xe.strong=void 0;var mN=(fe(),re(le)),Pr=mN.__importDefault(T_());Xe.strong=Pr.default.bold;Xe.weak=Pr.default.dim;Xe.input=Pr.default.cyan;Xe.success=Pr.default.green;Xe.failure=Pr.default.red;Xe.ancillary=Pr.default.cyan;var gN={strong:Xe.strong,weak:Xe.weak,input:Xe.input,success:Xe.success,failure:Xe.failure,ancillary:Xe.ancillary,log:{DEBUG:Pr.default.magenta,INFO:Pr.default.cyan,WARN:Pr.default.yellow,ERROR:Pr.default.red}};Xe.default=gN});var om=x(Wc=>{"use strict";Object.defineProperty(Wc,"__esModule",{value:!0});Wc.EscapeCode=void 0;var _r="\x1B[",ct=class{};Wc.EscapeCode=ct;ct.cursorLeft=()=>`${_r}G`;ct.cursorUp=(t=1)=>`${_r}${t}A`;ct.cursorDown=(t=1)=>`${_r}${t}B`;ct.cursorForward=(t=1)=>`${_r}${t}C`;ct.cursorBackward=(t=1)=>`${_r}${t}D`;ct.cursorHide=()=>`${_r}?25l`;ct.cursorShow=()=>`${_r}?25h`;ct.eraseLine=()=>`${_r}2K`;ct.eraseLines=t=>{let e="";for(let r=0;r<t;r++)e+=ct.eraseLine(),r<t-1&&(e+=ct.cursorUp());return`${e}${ct.cursorLeft()}`};ct.eraseUp=()=>`${_r}1J`;ct.eraseDown=()=>`${_r}J`;ct.eraseScreen=()=>`${_r}2J`});var R_=x(Kc=>{"use strict";Object.defineProperty(Kc,"__esModule",{value:!0});Kc.Cursor=void 0;var DN=(fe(),re(le)),yN=DN.__importDefault(kh()),I_=om(),$i=class t{static show(){t.stream.isTTY&&(t._isVisible=!0,t.stream.write(I_.EscapeCode.cursorShow()))}static hide(){t.stream.isTTY&&(t._listenerAttached||((0,yN.default)(()=>{t.show()}),t._listenerAttached=!0),t._isVisible=!1,t.stream.write(I_.EscapeCode.cursorHide()))}static toggle(){t._isVisible?t.hide():t.show()}};Kc.Cursor=$i;$i.stream=process.stderr;$i._isVisible=!0;$i._listenerAttached=!1});var am=x((jG,im)=>{"use strict";var B_=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);im.exports=B_;im.exports.default=B_});var L_=x((NG,N_)=>{"use strict";var j_="[\uD800-\uDBFF][\uDC00-\uDFFF]",bN=t=>t&&t.exact?new RegExp(`^${j_}$`):new RegExp(j_,"g");N_.exports=bN});var M_=x((LG,U_)=>{"use strict";U_.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 sm=x((UG,H_)=>{var us=M_(),q_={};for(let t of Object.keys(us))q_[us[t]]=t;var X={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"]}};H_.exports=X;for(let t of Object.keys(X)){if(!("channels"in X[t]))throw new Error("missing channels property: "+t);if(!("labels"in X[t]))throw new Error("missing channel labels property: "+t);if(X[t].labels.length!==X[t].channels)throw new Error("channel and label counts mismatch: "+t);let{channels:e,labels:r}=X[t];delete X[t].channels,delete X[t].labels,Object.defineProperty(X[t],"channels",{value:e}),Object.defineProperty(X[t],"labels",{value:r})}X.rgb.hsl=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255,o=Math.min(e,r,n),i=Math.max(e,r,n),a=i-o,s,u;i===o?s=0:e===i?s=(r-n)/a:r===i?s=2+(n-e)/a:n===i&&(s=4+(e-r)/a),s=Math.min(s*60,360),s<0&&(s+=360);let c=(o+i)/2;return i===o?u=0:c<=.5?u=a/(i+o):u=a/(2-i-o),[s,u*100,c*100]};X.rgb.hsv=function(t){let e,r,n,o,i,a=t[0]/255,s=t[1]/255,u=t[2]/255,c=Math.max(a,s,u),l=c-Math.min(a,s,u),f=function(d){return(c-d)/6/l+1/2};return l===0?(o=0,i=0):(i=l/c,e=f(a),r=f(s),n=f(u),a===c?o=n-r:s===c?o=1/3+e-n:u===c&&(o=2/3+r-e),o<0?o+=1:o>1&&(o-=1)),[o*360,i*100,c*100]};X.rgb.hwb=function(t){let e=t[0],r=t[1],n=t[2],o=X.rgb.hsl(t)[0],i=1/255*Math.min(e,Math.min(r,n));return n=1-1/255*Math.max(e,Math.max(r,n)),[o,i*100,n*100]};X.rgb.cmyk=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255,o=Math.min(1-e,1-r,1-n),i=(1-e-o)/(1-o)||0,a=(1-r-o)/(1-o)||0,s=(1-n-o)/(1-o)||0;return[i*100,a*100,s*100,o*100]};function vN(t,e){return(t[0]-e[0])**2+(t[1]-e[1])**2+(t[2]-e[2])**2}X.rgb.keyword=function(t){let e=q_[t];if(e)return e;let r=1/0,n;for(let o of Object.keys(us)){let i=us[o],a=vN(t,i);a<r&&(r=a,n=o)}return n};X.keyword.rgb=function(t){return us[t]};X.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 o=e*.4124+r*.3576+n*.1805,i=e*.2126+r*.7152+n*.0722,a=e*.0193+r*.1192+n*.9505;return[o*100,i*100,a*100]};X.rgb.lab=function(t){let e=X.rgb.xyz(t),r=e[0],n=e[1],o=e[2];r/=95.047,n/=100,o/=108.883,r=r>.008856?r**(1/3):7.787*r+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,o=o>.008856?o**(1/3):7.787*o+16/116;let i=116*n-16,a=500*(r-n),s=200*(n-o);return[i,a,s]};X.hsl.rgb=function(t){let e=t[0]/360,r=t[1]/100,n=t[2]/100,o,i,a;if(r===0)return a=n*255,[a,a,a];n<.5?o=n*(1+r):o=n+r-n*r;let s=2*n-o,u=[0,0,0];for(let c=0;c<3;c++)i=e+1/3*-(c-1),i<0&&i++,i>1&&i--,6*i<1?a=s+(o-s)*6*i:2*i<1?a=o:3*i<2?a=s+(o-s)*(2/3-i)*6:a=s,u[c]=a*255;return u};X.hsl.hsv=function(t){let e=t[0],r=t[1]/100,n=t[2]/100,o=r,i=Math.max(n,.01);n*=2,r*=n<=1?n:2-n,o*=i<=1?i:2-i;let a=(n+r)/2,s=n===0?2*o/(i+o):2*r/(n+r);return[e,s*100,a*100]};X.hsv.rgb=function(t){let e=t[0]/60,r=t[1]/100,n=t[2]/100,o=Math.floor(e)%6,i=e-Math.floor(e),a=255*n*(1-r),s=255*n*(1-r*i),u=255*n*(1-r*(1-i));switch(n*=255,o){case 0:return[n,u,a];case 1:return[s,n,a];case 2:return[a,n,u];case 3:return[a,s,n];case 4:return[u,a,n];case 5:return[n,a,s]}};X.hsv.hsl=function(t){let e=t[0],r=t[1]/100,n=t[2]/100,o=Math.max(n,.01),i,a;a=(2-r)*n;let s=(2-r)*o;return i=r*o,i/=s<=1?s:2-s,i=i||0,a/=2,[e,i*100,a*100]};X.hwb.rgb=function(t){let e=t[0]/360,r=t[1]/100,n=t[2]/100,o=r+n,i;o>1&&(r/=o,n/=o);let a=Math.floor(6*e),s=1-n;i=6*e-a,(a&1)!==0&&(i=1-i);let u=r+i*(s-r),c,l,f;switch(a){default:case 6:case 0:c=s,l=u,f=r;break;case 1:c=u,l=s,f=r;break;case 2:c=r,l=s,f=u;break;case 3:c=r,l=u,f=s;break;case 4:c=u,l=r,f=s;break;case 5:c=s,l=r,f=u;break}return[c*255,l*255,f*255]};X.cmyk.rgb=function(t){let e=t[0]/100,r=t[1]/100,n=t[2]/100,o=t[3]/100,i=1-Math.min(1,e*(1-o)+o),a=1-Math.min(1,r*(1-o)+o),s=1-Math.min(1,n*(1-o)+o);return[i*255,a*255,s*255]};X.xyz.rgb=function(t){let e=t[0]/100,r=t[1]/100,n=t[2]/100,o,i,a;return o=e*3.2406+r*-1.5372+n*-.4986,i=e*-.9689+r*1.8758+n*.0415,a=e*.0557+r*-.204+n*1.057,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,i=i>.0031308?1.055*i**(1/2.4)-.055:i*12.92,a=a>.0031308?1.055*a**(1/2.4)-.055:a*12.92,o=Math.min(Math.max(0,o),1),i=Math.min(Math.max(0,i),1),a=Math.min(Math.max(0,a),1),[o*255,i*255,a*255]};X.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 o=116*r-16,i=500*(e-r),a=200*(r-n);return[o,i,a]};X.lab.xyz=function(t){let e=t[0],r=t[1],n=t[2],o,i,a;i=(e+16)/116,o=r/500+i,a=i-n/200;let s=i**3,u=o**3,c=a**3;return i=s>.008856?s:(i-16/116)/7.787,o=u>.008856?u:(o-16/116)/7.787,a=c>.008856?c:(a-16/116)/7.787,o*=95.047,i*=100,a*=108.883,[o,i,a]};X.lab.lch=function(t){let e=t[0],r=t[1],n=t[2],o;o=Math.atan2(n,r)*360/2/Math.PI,o<0&&(o+=360);let a=Math.sqrt(r*r+n*n);return[e,a,o]};X.lch.lab=function(t){let e=t[0],r=t[1],o=t[2]/360*2*Math.PI,i=r*Math.cos(o),a=r*Math.sin(o);return[e,i,a]};X.rgb.ansi16=function(t,e=null){let[r,n,o]=t,i=e===null?X.rgb.hsv(t)[2]:e;if(i=Math.round(i/50),i===0)return 30;let a=30+(Math.round(o/255)<<2|Math.round(n/255)<<1|Math.round(r/255));return i===2&&(a+=60),a};X.hsv.ansi16=function(t){return X.rgb.ansi16(X.hsv.rgb(t),t[2])};X.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)};X.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,o=(e>>1&1)*r*255,i=(e>>2&1)*r*255;return[n,o,i]};X.ansi256.rgb=function(t){if(t>=232){let i=(t-232)*10+8;return[i,i,i]}t-=16;let e,r=Math.floor(t/36)/5*255,n=Math.floor((e=t%36)/6)/5*255,o=e%6/5*255;return[r,n,o]};X.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};X.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(s=>s+s).join(""));let n=parseInt(r,16),o=n>>16&255,i=n>>8&255,a=n&255;return[o,i,a]};X.rgb.hcg=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255,o=Math.max(Math.max(e,r),n),i=Math.min(Math.min(e,r),n),a=o-i,s,u;return a<1?s=i/(1-a):s=0,a<=0?u=0:o===e?u=(r-n)/a%6:o===r?u=2+(n-e)/a:u=4+(e-r)/a,u/=6,u%=1,[u*360,a*100,s*100]};X.hsl.hcg=function(t){let e=t[1]/100,r=t[2]/100,n=r<.5?2*e*r:2*e*(1-r),o=0;return n<1&&(o=(r-.5*n)/(1-n)),[t[0],n*100,o*100]};X.hsv.hcg=function(t){let e=t[1]/100,r=t[2]/100,n=e*r,o=0;return n<1&&(o=(r-n)/(1-n)),[t[0],n*100,o*100]};X.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 o=[0,0,0],i=e%1*6,a=i%1,s=1-a,u=0;switch(Math.floor(i)){case 0:o[0]=1,o[1]=a,o[2]=0;break;case 1:o[0]=s,o[1]=1,o[2]=0;break;case 2:o[0]=0,o[1]=1,o[2]=a;break;case 3:o[0]=0,o[1]=s,o[2]=1;break;case 4:o[0]=a,o[1]=0,o[2]=1;break;default:o[0]=1,o[1]=0,o[2]=s}return u=(1-r)*n,[(r*o[0]+u)*255,(r*o[1]+u)*255,(r*o[2]+u)*255]};X.hcg.hsv=function(t){let e=t[1]/100,r=t[2]/100,n=e+r*(1-e),o=0;return n>0&&(o=e/n),[t[0],o*100,n*100]};X.hcg.hsl=function(t){let e=t[1]/100,n=t[2]/100*(1-e)+.5*e,o=0;return n>0&&n<.5?o=e/(2*n):n>=.5&&n<1&&(o=e/(2*(1-n))),[t[0],o*100,n*100]};X.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]};X.hwb.hcg=function(t){let e=t[1]/100,n=1-t[2]/100,o=n-e,i=0;return o<1&&(i=(n-o)/(1-o)),[t[0],o*100,i*100]};X.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]};X.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]};X.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]};X.gray.hsl=function(t){return[0,0,t[0]]};X.gray.hsv=X.gray.hsl;X.gray.hwb=function(t){return[0,100,t[0]]};X.gray.cmyk=function(t){return[0,0,0,t[0]]};X.gray.lab=function(t){return[t[0],0,0]};X.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};X.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]}});var z_=x((MG,V_)=>{var Yc=sm();function wN(){let t={},e=Object.keys(Yc);for(let r=e.length,n=0;n<r;n++)t[e[n]]={distance:-1,parent:null};return t}function CN(t){let e=wN(),r=[t];for(e[t].distance=0;r.length;){let n=r.pop(),o=Object.keys(Yc[n]);for(let i=o.length,a=0;a<i;a++){let s=o[a],u=e[s];u.distance===-1&&(u.distance=e[n].distance+1,u.parent=n,r.unshift(s))}}return e}function EN(t,e){return function(r){return e(t(r))}}function _N(t,e){let r=[e[t].parent,t],n=Yc[e[t].parent][t],o=e[t].parent;for(;e[o].parent;)r.unshift(e[o].parent),n=EN(Yc[e[o].parent][o],n),o=e[o].parent;return n.conversion=r,n}V_.exports=function(t){let e=CN(t),r={},n=Object.keys(e);for(let o=n.length,i=0;i<o;i++){let a=n[i];e[a].parent!==null&&(r[a]=_N(a,e))}return r}});var W_=x((qG,G_)=>{var um=sm(),xN=z_(),Pi={},SN=Object.keys(um);function FN(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 AN(t){let e=function(...r){let n=r[0];if(n==null)return n;n.length>1&&(r=n);let o=t(r);if(typeof o=="object")for(let i=o.length,a=0;a<i;a++)o[a]=Math.round(o[a]);return o};return"conversion"in t&&(e.conversion=t.conversion),e}SN.forEach(t=>{Pi[t]={},Object.defineProperty(Pi[t],"channels",{value:um[t].channels}),Object.defineProperty(Pi[t],"labels",{value:um[t].labels});let e=xN(t);Object.keys(e).forEach(n=>{let o=e[n];Pi[t][n]=AN(o),Pi[t][n].raw=FN(o)})});G_.exports=Pi});var lm=x((HG,Z_)=>{"use strict";var K_=(t,e)=>(...r)=>`\x1B[${t(...r)+e}m`,Y_=(t,e)=>(...r)=>{let n=t(...r);return`\x1B[${38+e};5;${n}m`},J_=(t,e)=>(...r)=>{let n=t(...r);return`\x1B[${38+e};2;${n[0]};${n[1]};${n[2]}m`},Jc=t=>t,X_=(t,e,r)=>[t,e,r],Ti=(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})},cm,Ii=(t,e,r,n)=>{cm===void 0&&(cm=W_());let o=n?10:0,i={};for(let[a,s]of Object.entries(cm)){let u=a==="ansi16"?"ansi":a;a===e?i[u]=t(r,o):typeof s=="object"&&(i[u]=t(s[e],o))}return i};function ON(){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[o,i]of Object.entries(n))e[o]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},n[o]=e[o],t.set(i[0],i[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",Ti(e.color,"ansi",()=>Ii(K_,"ansi16",Jc,!1)),Ti(e.color,"ansi256",()=>Ii(Y_,"ansi256",Jc,!1)),Ti(e.color,"ansi16m",()=>Ii(J_,"rgb",X_,!1)),Ti(e.bgColor,"ansi",()=>Ii(K_,"ansi16",Jc,!0)),Ti(e.bgColor,"ansi256",()=>Ii(Y_,"ansi256",Jc,!0)),Ti(e.bgColor,"ansi16m",()=>Ii(J_,"rgb",X_,!0)),e}Object.defineProperty(Z_,"exports",{enumerable:!0,get:ON})});var nx=x((VG,rx)=>{"use strict";var kN=am(),$N=L_(),Q_=lm(),tx=["\x1B","\x9B"],Xc=t=>`${tx[0]}[${t}m`,ex=(t,e,r)=>{let n=[];t=[...t];for(let o of t){let i=o;o.includes(";")&&(o=o.split(";")[0][0]+"0");let a=Q_.codes.get(Number.parseInt(o,10));if(a){let s=t.indexOf(a.toString());s===-1?n.push(Xc(e?a:i)):t.splice(s,1)}else if(e){n.push(Xc(0));break}else n.push(Xc(i))}if(e&&(n=n.filter((o,i)=>n.indexOf(o)===i),r!==void 0)){let o=Xc(Q_.codes.get(Number.parseInt(r,10)));n=n.reduce((i,a)=>a===o?[a,...i]:[...i,a],[])}return n.join("")};rx.exports=(t,e,r)=>{let n=[...t],o=[],i=typeof r=="number"?r:n.length,a=!1,s,u=0,c="";for(let[l,f]of n.entries()){let d=!1;if(tx.includes(f)){let h=/\d[^m]*/.exec(t.slice(l,l+18));s=h&&h.length>0?h[0]:void 0,u<i&&(a=!0,s!==void 0&&o.push(s))}else a&&f==="m"&&(a=!1,d=!0);if(!a&&!d&&u++,!$N({exact:!0}).test(f)&&kN(f.codePointAt())&&(u++,typeof r!="number"&&i++),u>e&&u<=i)c+=f;else if(u===e&&!a&&s!==void 0)c=ex(o);else if(u>=i){c+=ex(o,!0,s);break}}return c}});var ix=x((zG,ox)=>{"use strict";ox.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 Zc=x((GG,ax)=>{"use strict";var PN=ix();ax.exports=t=>typeof t=="string"?t.replace(PN(),""):t});var ux=x((WG,sx)=>{"use strict";sx.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 pm=x((KG,fm)=>{"use strict";var TN=Zc(),IN=am(),RN=ux(),cx=t=>{if(typeof t!="string"||t.length===0||(t=TN(t),t.length===0))return 0;t=t.replace(RN()," ");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+=IN(n)?2:1)}return e};fm.exports=cx;fm.exports.default=cx});var mx=x((YG,hx)=>{"use strict";var cs=pm(),BN=Zc(),jN=lm(),Qc=new Set(["\x1B","\x9B"]),NN=39,hm="\x07",px="[",LN="]",dx="m",mm=`${LN}8;;`,lx=t=>`${Qc.values().next().value}${px}${t}${dx}`,fx=t=>`${Qc.values().next().value}${mm}${t}${hm}`,UN=t=>t.split(" ").map(e=>cs(e)),dm=(t,e,r)=>{let n=[...e],o=!1,i=!1,a=cs(BN(t[t.length-1]));for(let[s,u]of n.entries()){let c=cs(u);if(a+c<=r?t[t.length-1]+=u:(t.push(u),a=0),Qc.has(u)&&(o=!0,i=n.slice(s+1).join("").startsWith(mm)),o){i?u===hm&&(o=!1,i=!1):u===dx&&(o=!1);continue}a+=c,a===r&&s<n.length-1&&(t.push(""),a=0)}!a&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},MN=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(cs(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},qN=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",o,i,a=UN(t),s=[""];for(let[c,l]of t.split(" ").entries()){r.trim!==!1&&(s[s.length-1]=s[s.length-1].trimStart());let f=cs(s[s.length-1]);if(c!==0&&(f>=e&&(r.wordWrap===!1||r.trim===!1)&&(s.push(""),f=0),(f>0||r.trim===!1)&&(s[s.length-1]+=" ",f++)),r.hard&&a[c]>e){let d=e-f,h=1+Math.floor((a[c]-d-1)/e);Math.floor((a[c]-1)/e)<h&&s.push(""),dm(s,l,e);continue}if(f+a[c]>e&&f>0&&a[c]>0){if(r.wordWrap===!1&&f<e){dm(s,l,e);continue}s.push("")}if(f+a[c]>e&&r.wordWrap===!1){dm(s,l,e);continue}s[s.length-1]+=l}r.trim!==!1&&(s=s.map(MN));let u=[...s.join(`
54
- `)];for(let[c,l]of u.entries()){if(n+=l,Qc.has(l)){let{groups:d}=new RegExp(`(?:\\${px}(?<code>\\d+)m|\\${mm}(?<uri>.*)${hm})`).exec(u.slice(c).join(""))||{groups:{}};if(d.code!==void 0){let h=Number.parseFloat(d.code);o=h===NN?void 0:h}else d.uri!==void 0&&(i=d.uri.length===0?void 0:d.uri)}let f=jN.codes.get(Number(o));u[c+1]===`
55
- `?(i&&(n+=fx("")),o&&f&&(n+=lx(f))):l===`
56
- `&&(o&&f&&(n+=lx(o)),i&&(n+=fx(i)))}return n};hx.exports=(t,e,r)=>String(t).normalize().replace(/\r\n/g,`
52
+ see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0002");let{srcStat:n,destStat:o}=us.checkPathsSync(t,e,"copy",r);if(us.checkParentPathsSync(t,n,e,"copy"),r.filter&&!r.filter(t,e))return;let i=ss.dirname(e);return kt.existsSync(i)||JB(i),dE(o,t,e,r)}function dE(t,e,r,n){let i=(n.dereference?kt.statSync:kt.lstatSync)(e);if(i.isDirectory())return ij(i,t,e,r,n);if(i.isFile()||i.isCharacterDevice()||i.isBlockDevice())return QB(i,t,e,r,n);if(i.isSymbolicLink())return uj(t,e,r,n);throw i.isSocket()?new Error(`Cannot copy a socket file: ${e}`):i.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${e}`):new Error(`Unknown file: ${e}`)}function QB(t,e,r,n,o){return e?ej(t,r,n,o):hE(t,r,n,o)}function ej(t,e,r,n){if(n.overwrite)return kt.unlinkSync(r),hE(t,e,r,n);if(n.errorOnExist)throw new Error(`'${r}' already exists`)}function hE(t,e,r,n){return kt.copyFileSync(e,r),n.preserveTimestamps&&tj(t.mode,e,r),rm(r,t.mode)}function tj(t,e,r){return rj(t)&&nj(r,t),oj(e,r)}function rj(t){return(t&128)===0}function nj(t,e){return rm(t,e|128)}function rm(t,e){return kt.chmodSync(t,e)}function oj(t,e){let r=kt.statSync(t);return XB(e,r.atime,r.mtime)}function ij(t,e,r,n,o){return e?mE(r,n,o):aj(t.mode,r,n,o)}function aj(t,e,r,n){return kt.mkdirSync(r),mE(e,r,n),rm(r,t)}function mE(t,e,r){let n=kt.opendirSync(t);try{let o;for(;(o=n.readSync())!==null;)sj(o.name,t,e,r)}finally{n.closeSync()}}function sj(t,e,r,n){let o=ss.join(e,t),i=ss.join(r,t);if(n.filter&&!n.filter(o,i))return;let{destStat:a}=us.checkPathsSync(o,i,"copy",n);return dE(a,o,i,n)}function uj(t,e,r,n){let o=kt.readlinkSync(e);if(n.dereference&&(o=ss.resolve(process.cwd(),o)),t){let i;try{i=kt.readlinkSync(r)}catch(a){if(a.code==="EINVAL"||a.code==="UNKNOWN")return kt.symlinkSync(o,r);throw a}if(n.dereference&&(i=ss.resolve(process.cwd(),i)),us.isSrcSubdir(o,i))throw new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`);if(us.isSrcSubdir(i,o))throw new Error(`Cannot overwrite '${i}' with '${o}'.`);return cj(o,r)}else return kt.symlinkSync(o,r)}function cj(t,e){return kt.unlinkSync(e),kt.symlinkSync(t,e)}gE.exports=ZB});var zc=x((vG,yE)=>{"use strict";var lj=ut().fromPromise;yE.exports={copy:lj(pE()),copySync:DE()}});var cs=x((CG,wE)=>{"use strict";var bE=Cn(),fj=ut().fromCallback;function pj(t,e){bE.rm(t,{recursive:!0,force:!0},e)}function dj(t){bE.rmSync(t,{recursive:!0,force:!0})}wE.exports={remove:fj(pj),removeSync:dj}});var AE=x((EG,FE)=>{"use strict";var hj=ut().fromPromise,EE=Ot(),_E=require("path"),xE=Cr(),SE=cs(),vE=hj(async function(e){let r;try{r=await EE.readdir(e)}catch{return xE.mkdirs(e)}return Promise.all(r.map(n=>SE.remove(_E.join(e,n))))});function CE(t){let e;try{e=EE.readdirSync(t)}catch{return xE.mkdirsSync(t)}e.forEach(r=>{r=_E.join(t,r),SE.removeSync(r)})}FE.exports={emptyDirSync:CE,emptydirSync:CE,emptyDir:vE,emptydir:vE}});var PE=x((_G,$E)=>{"use strict";var mj=ut().fromPromise,OE=require("path"),Qr=Ot(),kE=Cr();async function gj(t){let e;try{e=await Qr.stat(t)}catch{}if(e&&e.isFile())return;let r=OE.dirname(t),n=null;try{n=await Qr.stat(r)}catch(o){if(o.code==="ENOENT"){await kE.mkdirs(r),await Qr.writeFile(t,"");return}else throw o}n.isDirectory()?await Qr.writeFile(t,""):await Qr.readdir(r)}function Dj(t){let e;try{e=Qr.statSync(t)}catch{}if(e&&e.isFile())return;let r=OE.dirname(t);try{Qr.statSync(r).isDirectory()||Qr.readdirSync(r)}catch(n){if(n&&n.code==="ENOENT")kE.mkdirsSync(r);else throw n}Qr.writeFileSync(t,"")}$E.exports={createFile:mj(gj),createFileSync:Dj}});var jE=x((xG,BE)=>{"use strict";var yj=ut().fromPromise,TE=require("path"),Sn=Ot(),IE=Cr(),{pathExists:bj}=xn(),{areIdentical:RE}=vo();async function wj(t,e){let r;try{r=await Sn.lstat(e)}catch{}let n;try{n=await Sn.lstat(t)}catch(a){throw a.message=a.message.replace("lstat","ensureLink"),a}if(r&&RE(n,r))return;let o=TE.dirname(e);await bj(o)||await IE.mkdirs(o),await Sn.link(t,e)}function vj(t,e){let r;try{r=Sn.lstatSync(e)}catch{}try{let i=Sn.lstatSync(t);if(r&&RE(i,r))return}catch(i){throw i.message=i.message.replace("lstat","ensureLink"),i}let n=TE.dirname(e);return Sn.existsSync(n)||IE.mkdirsSync(n),Sn.linkSync(t,e)}BE.exports={createLink:yj(wj),createLinkSync:vj}});var LE=x((SG,NE)=>{"use strict";var Fn=require("path"),ls=Ot(),{pathExists:Cj}=xn(),Ej=ut().fromPromise;async function _j(t,e){if(Fn.isAbsolute(t)){try{await ls.lstat(t)}catch(i){throw i.message=i.message.replace("lstat","ensureSymlink"),i}return{toCwd:t,toDst:t}}let r=Fn.dirname(e),n=Fn.join(r,t);if(await Cj(n))return{toCwd:n,toDst:t};try{await ls.lstat(t)}catch(i){throw i.message=i.message.replace("lstat","ensureSymlink"),i}return{toCwd:t,toDst:Fn.relative(r,t)}}function xj(t,e){if(Fn.isAbsolute(t)){if(!ls.existsSync(t))throw new Error("absolute srcpath does not exist");return{toCwd:t,toDst:t}}let r=Fn.dirname(e),n=Fn.join(r,t);if(ls.existsSync(n))return{toCwd:n,toDst:t};if(!ls.existsSync(t))throw new Error("relative srcpath does not exist");return{toCwd:t,toDst:Fn.relative(r,t)}}NE.exports={symlinkPaths:Ej(_j),symlinkPathsSync:xj}});var qE=x((FG,ME)=>{"use strict";var UE=Ot(),Sj=ut().fromPromise;async function Fj(t,e){if(e)return e;let r;try{r=await UE.lstat(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}function Aj(t,e){if(e)return e;let r;try{r=UE.lstatSync(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}ME.exports={symlinkType:Sj(Fj),symlinkTypeSync:Aj}});var GE=x((AG,zE)=>{"use strict";var Oj=ut().fromPromise,HE=require("path"),kr=Ot(),{mkdirs:kj,mkdirsSync:$j}=Cr(),{symlinkPaths:Pj,symlinkPathsSync:Tj}=LE(),{symlinkType:Ij,symlinkTypeSync:Rj}=qE(),{pathExists:Bj}=xn(),{areIdentical:VE}=vo();async function jj(t,e,r){let n;try{n=await kr.lstat(e)}catch{}if(n&&n.isSymbolicLink()){let[s,u]=await Promise.all([kr.stat(t),kr.stat(e)]);if(VE(s,u))return}let o=await Pj(t,e);t=o.toDst;let i=await Ij(o.toCwd,r),a=HE.dirname(e);return await Bj(a)||await kj(a),kr.symlink(t,e,i)}function Nj(t,e,r){let n;try{n=kr.lstatSync(e)}catch{}if(n&&n.isSymbolicLink()){let s=kr.statSync(t),u=kr.statSync(e);if(VE(s,u))return}let o=Tj(t,e);t=o.toDst,r=Rj(o.toCwd,r);let i=HE.dirname(e);return kr.existsSync(i)||$j(i),kr.symlinkSync(t,e,r)}zE.exports={createSymlink:Oj(jj),createSymlinkSync:Nj}});var e_=x((OG,QE)=>{"use strict";var{createFile:WE,createFileSync:KE}=PE(),{createLink:YE,createLinkSync:JE}=jE(),{createSymlink:XE,createSymlinkSync:ZE}=GE();QE.exports={createFile:WE,createFileSync:KE,ensureFile:WE,ensureFileSync:KE,createLink:YE,createLinkSync:JE,ensureLink:YE,ensureLinkSync:JE,createSymlink:XE,createSymlinkSync:ZE,ensureSymlink:XE,ensureSymlinkSync:ZE}});var Gc=x((kG,t_)=>{function Lj(t,{EOL:e=`
53
+ `,finalEOL:r=!0,replacer:n=null,spaces:o}={}){let i=r?e:"";return JSON.stringify(t,n,o).replace(/\n/g,e)+i}function Uj(t){return Buffer.isBuffer(t)&&(t=t.toString("utf8")),t.replace(/^\uFEFF/,"")}t_.exports={stringify:Lj,stripBom:Uj}});var i_=x(($G,o_)=>{var $i;try{$i=Cn()}catch{$i=require("fs")}var Wc=ut(),{stringify:r_,stripBom:n_}=Gc();async function Mj(t,e={}){typeof e=="string"&&(e={encoding:e});let r=e.fs||$i,n="throws"in e?e.throws:!0,o=await Wc.fromCallback(r.readFile)(t,e);o=n_(o);let i;try{i=JSON.parse(o,e?e.reviver:null)}catch(a){if(n)throw a.message=`${t}: ${a.message}`,a;return null}return i}var qj=Wc.fromPromise(Mj);function Hj(t,e={}){typeof e=="string"&&(e={encoding:e});let r=e.fs||$i,n="throws"in e?e.throws:!0;try{let o=r.readFileSync(t,e);return o=n_(o),JSON.parse(o,e.reviver)}catch(o){if(n)throw o.message=`${t}: ${o.message}`,o;return null}}async function Vj(t,e,r={}){let n=r.fs||$i,o=r_(e,r);await Wc.fromCallback(n.writeFile)(t,o,r)}var zj=Wc.fromPromise(Vj);function Gj(t,e,r={}){let n=r.fs||$i,o=r_(e,r);return n.writeFileSync(t,o,r)}o_.exports={readFile:qj,readFileSync:Hj,writeFile:zj,writeFileSync:Gj}});var s_=x((PG,a_)=>{"use strict";var Kc=i_();a_.exports={readJson:Kc.readFile,readJsonSync:Kc.readFileSync,writeJson:Kc.writeFile,writeJsonSync:Kc.writeFileSync}});var Yc=x((TG,l_)=>{"use strict";var Wj=ut().fromPromise,nm=Ot(),u_=require("path"),c_=Cr(),Kj=xn().pathExists;async function Yj(t,e,r="utf-8"){let n=u_.dirname(t);return await Kj(n)||await c_.mkdirs(n),nm.writeFile(t,e,r)}function Jj(t,...e){let r=u_.dirname(t);nm.existsSync(r)||c_.mkdirsSync(r),nm.writeFileSync(t,...e)}l_.exports={outputFile:Wj(Yj),outputFileSync:Jj}});var p_=x((IG,f_)=>{"use strict";var{stringify:Xj}=Gc(),{outputFile:Zj}=Yc();async function Qj(t,e,r={}){let n=Xj(e,r);await Zj(t,n,r)}f_.exports=Qj});var h_=x((RG,d_)=>{"use strict";var{stringify:eN}=Gc(),{outputFileSync:tN}=Yc();function rN(t,e,r){let n=eN(e,r);tN(t,n,r)}d_.exports=rN});var g_=x((BG,m_)=>{"use strict";var nN=ut().fromPromise,$t=s_();$t.outputJson=nN(p_());$t.outputJsonSync=h_();$t.outputJSON=$t.outputJson;$t.outputJSONSync=$t.outputJsonSync;$t.writeJSON=$t.writeJson;$t.writeJSONSync=$t.writeJsonSync;$t.readJSON=$t.readJson;$t.readJSONSync=$t.readJsonSync;m_.exports=$t});var v_=x((jG,w_)=>{"use strict";var oN=Ot(),D_=require("path"),{copy:iN}=zc(),{remove:b_}=cs(),{mkdirp:aN}=Cr(),{pathExists:sN}=xn(),y_=vo();async function uN(t,e,r={}){let n=r.overwrite||r.clobber||!1,{srcStat:o,isChangingCase:i=!1}=await y_.checkPaths(t,e,"move",r);await y_.checkParentPaths(t,o,e,"move");let a=D_.dirname(e);return D_.parse(a).root!==a&&await aN(a),cN(t,e,n,i)}async function cN(t,e,r,n){if(!n){if(r)await b_(e);else if(await sN(e))throw new Error("dest already exists.")}try{await oN.rename(t,e)}catch(o){if(o.code!=="EXDEV")throw o;await lN(t,e,r)}}async function lN(t,e,r){return await iN(t,e,{overwrite:r,errorOnExist:!0,preserveTimestamps:!0}),b_(t)}w_.exports=uN});var S_=x((NG,x_)=>{"use strict";var E_=Cn(),im=require("path"),fN=zc().copySync,__=cs().removeSync,pN=Cr().mkdirpSync,C_=vo();function dN(t,e,r){r=r||{};let n=r.overwrite||r.clobber||!1,{srcStat:o,isChangingCase:i=!1}=C_.checkPathsSync(t,e,"move",r);return C_.checkParentPathsSync(t,o,e,"move"),hN(e)||pN(im.dirname(e)),mN(t,e,n,i)}function hN(t){let e=im.dirname(t);return im.parse(e).root===e}function mN(t,e,r,n){if(n)return om(t,e,r);if(r)return __(e),om(t,e,r);if(E_.existsSync(e))throw new Error("dest already exists.");return om(t,e,r)}function om(t,e,r){try{E_.renameSync(t,e)}catch(n){if(n.code!=="EXDEV")throw n;return gN(t,e,r)}}function gN(t,e,r){return fN(t,e,{overwrite:r,errorOnExist:!0,preserveTimestamps:!0}),__(t)}x_.exports=dN});var A_=x((LG,F_)=>{"use strict";var DN=ut().fromPromise;F_.exports={move:DN(v_()),moveSync:S_()}});var Pi=x((UG,O_)=>{"use strict";O_.exports={...Ot(),...zc(),...AE(),...e_(),...g_(),...Cr(),...A_(),...Yc(),...xn(),...cs()}});var B_=x((MG,R_)=>{"use strict";var am,$_,P_,T_,I_=!0;typeof process<"u"&&({FORCE_COLOR:am,NODE_DISABLE_COLORS:$_,NO_COLOR:P_,TERM:T_}=process.env||{},I_=process.stdout&&process.stdout.isTTY);var Se={enabled:!$_&&P_==null&&T_!=="dumb"&&(am!=null&&am!=="0"||I_),reset:Re(0,0),bold:Re(1,22),dim:Re(2,22),italic:Re(3,23),underline:Re(4,24),inverse:Re(7,27),hidden:Re(8,28),strikethrough:Re(9,29),black:Re(30,39),red:Re(31,39),green:Re(32,39),yellow:Re(33,39),blue:Re(34,39),magenta:Re(35,39),cyan:Re(36,39),white:Re(37,39),gray:Re(90,39),grey:Re(90,39),bgBlack:Re(40,49),bgRed:Re(41,49),bgGreen:Re(42,49),bgYellow:Re(43,49),bgBlue:Re(44,49),bgMagenta:Re(45,49),bgCyan:Re(46,49),bgWhite:Re(47,49)};function k_(t,e){let r=0,n,o="",i="";for(;r<t.length;r++)n=t[r],o+=n.open,i+=n.close,~e.indexOf(n.close)&&(e=e.replace(n.rgx,n.close+n.open));return o+e+i}function yN(t,e){let r={has:t,keys:e};return r.reset=Se.reset.bind(r),r.bold=Se.bold.bind(r),r.dim=Se.dim.bind(r),r.italic=Se.italic.bind(r),r.underline=Se.underline.bind(r),r.inverse=Se.inverse.bind(r),r.hidden=Se.hidden.bind(r),r.strikethrough=Se.strikethrough.bind(r),r.black=Se.black.bind(r),r.red=Se.red.bind(r),r.green=Se.green.bind(r),r.yellow=Se.yellow.bind(r),r.blue=Se.blue.bind(r),r.magenta=Se.magenta.bind(r),r.cyan=Se.cyan.bind(r),r.white=Se.white.bind(r),r.gray=Se.gray.bind(r),r.grey=Se.grey.bind(r),r.bgBlack=Se.bgBlack.bind(r),r.bgRed=Se.bgRed.bind(r),r.bgGreen=Se.bgGreen.bind(r),r.bgYellow=Se.bgYellow.bind(r),r.bgBlue=Se.bgBlue.bind(r),r.bgMagenta=Se.bgMagenta.bind(r),r.bgCyan=Se.bgCyan.bind(r),r.bgWhite=Se.bgWhite.bind(r),r}function Re(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:Se.enabled?k_(this.keys,n+""):n+""):n===void 0?yN([t],[r]):Se.enabled?k_([r],n+""):n+""}}R_.exports=Se});var Ti=x(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.ancillary=Xe.failure=Xe.success=Xe.input=Xe.weak=Xe.strong=void 0;var bN=(fe(),ne(le)),$r=bN.__importDefault(B_());Xe.strong=$r.default.bold;Xe.weak=$r.default.dim;Xe.input=$r.default.cyan;Xe.success=$r.default.green;Xe.failure=$r.default.red;Xe.ancillary=$r.default.cyan;var wN={strong:Xe.strong,weak:Xe.weak,input:Xe.input,success:Xe.success,failure:Xe.failure,ancillary:Xe.ancillary,log:{DEBUG:$r.default.magenta,INFO:$r.default.cyan,WARN:$r.default.yellow,ERROR:$r.default.red}};Xe.default=wN});var sm=x(Jc=>{"use strict";Object.defineProperty(Jc,"__esModule",{value:!0});Jc.EscapeCode=void 0;var Er="\x1B[",lt=class{};Jc.EscapeCode=lt;lt.cursorLeft=()=>`${Er}G`;lt.cursorUp=(t=1)=>`${Er}${t}A`;lt.cursorDown=(t=1)=>`${Er}${t}B`;lt.cursorForward=(t=1)=>`${Er}${t}C`;lt.cursorBackward=(t=1)=>`${Er}${t}D`;lt.cursorHide=()=>`${Er}?25l`;lt.cursorShow=()=>`${Er}?25h`;lt.eraseLine=()=>`${Er}2K`;lt.eraseLines=t=>{let e="";for(let r=0;r<t;r++)e+=lt.eraseLine(),r<t-1&&(e+=lt.cursorUp());return`${e}${lt.cursorLeft()}`};lt.eraseUp=()=>`${Er}1J`;lt.eraseDown=()=>`${Er}J`;lt.eraseScreen=()=>`${Er}2J`});var N_=x(Xc=>{"use strict";Object.defineProperty(Xc,"__esModule",{value:!0});Xc.Cursor=void 0;var vN=(fe(),ne(le)),CN=vN.__importDefault(Th()),j_=sm(),Ii=class t{static show(){t.stream.isTTY&&(t._isVisible=!0,t.stream.write(j_.EscapeCode.cursorShow()))}static hide(){t.stream.isTTY&&(t._listenerAttached||((0,CN.default)(()=>{t.show()}),t._listenerAttached=!0),t._isVisible=!1,t.stream.write(j_.EscapeCode.cursorHide()))}static toggle(){t._isVisible?t.hide():t.show()}};Xc.Cursor=Ii;Ii.stream=process.stderr;Ii._isVisible=!0;Ii._listenerAttached=!1});var cm=x((zG,um)=>{"use strict";var L_=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);um.exports=L_;um.exports.default=L_});var q_=x((GG,M_)=>{"use strict";var U_="[\uD800-\uDBFF][\uDC00-\uDFFF]",EN=t=>t&&t.exact?new RegExp(`^${U_}$`):new RegExp(U_,"g");M_.exports=EN});var V_=x((WG,H_)=>{"use strict";H_.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 lm=x((KG,G_)=>{var fs=V_(),z_={};for(let t of Object.keys(fs))z_[fs[t]]=t;var X={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"]}};G_.exports=X;for(let t of Object.keys(X)){if(!("channels"in X[t]))throw new Error("missing channels property: "+t);if(!("labels"in X[t]))throw new Error("missing channel labels property: "+t);if(X[t].labels.length!==X[t].channels)throw new Error("channel and label counts mismatch: "+t);let{channels:e,labels:r}=X[t];delete X[t].channels,delete X[t].labels,Object.defineProperty(X[t],"channels",{value:e}),Object.defineProperty(X[t],"labels",{value:r})}X.rgb.hsl=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255,o=Math.min(e,r,n),i=Math.max(e,r,n),a=i-o,s,u;i===o?s=0:e===i?s=(r-n)/a:r===i?s=2+(n-e)/a:n===i&&(s=4+(e-r)/a),s=Math.min(s*60,360),s<0&&(s+=360);let c=(o+i)/2;return i===o?u=0:c<=.5?u=a/(i+o):u=a/(2-i-o),[s,u*100,c*100]};X.rgb.hsv=function(t){let e,r,n,o,i,a=t[0]/255,s=t[1]/255,u=t[2]/255,c=Math.max(a,s,u),l=c-Math.min(a,s,u),p=function(d){return(c-d)/6/l+1/2};return l===0?(o=0,i=0):(i=l/c,e=p(a),r=p(s),n=p(u),a===c?o=n-r:s===c?o=1/3+e-n:u===c&&(o=2/3+r-e),o<0?o+=1:o>1&&(o-=1)),[o*360,i*100,c*100]};X.rgb.hwb=function(t){let e=t[0],r=t[1],n=t[2],o=X.rgb.hsl(t)[0],i=1/255*Math.min(e,Math.min(r,n));return n=1-1/255*Math.max(e,Math.max(r,n)),[o,i*100,n*100]};X.rgb.cmyk=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255,o=Math.min(1-e,1-r,1-n),i=(1-e-o)/(1-o)||0,a=(1-r-o)/(1-o)||0,s=(1-n-o)/(1-o)||0;return[i*100,a*100,s*100,o*100]};function _N(t,e){return(t[0]-e[0])**2+(t[1]-e[1])**2+(t[2]-e[2])**2}X.rgb.keyword=function(t){let e=z_[t];if(e)return e;let r=1/0,n;for(let o of Object.keys(fs)){let i=fs[o],a=_N(t,i);a<r&&(r=a,n=o)}return n};X.keyword.rgb=function(t){return fs[t]};X.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 o=e*.4124+r*.3576+n*.1805,i=e*.2126+r*.7152+n*.0722,a=e*.0193+r*.1192+n*.9505;return[o*100,i*100,a*100]};X.rgb.lab=function(t){let e=X.rgb.xyz(t),r=e[0],n=e[1],o=e[2];r/=95.047,n/=100,o/=108.883,r=r>.008856?r**(1/3):7.787*r+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,o=o>.008856?o**(1/3):7.787*o+16/116;let i=116*n-16,a=500*(r-n),s=200*(n-o);return[i,a,s]};X.hsl.rgb=function(t){let e=t[0]/360,r=t[1]/100,n=t[2]/100,o,i,a;if(r===0)return a=n*255,[a,a,a];n<.5?o=n*(1+r):o=n+r-n*r;let s=2*n-o,u=[0,0,0];for(let c=0;c<3;c++)i=e+1/3*-(c-1),i<0&&i++,i>1&&i--,6*i<1?a=s+(o-s)*6*i:2*i<1?a=o:3*i<2?a=s+(o-s)*(2/3-i)*6:a=s,u[c]=a*255;return u};X.hsl.hsv=function(t){let e=t[0],r=t[1]/100,n=t[2]/100,o=r,i=Math.max(n,.01);n*=2,r*=n<=1?n:2-n,o*=i<=1?i:2-i;let a=(n+r)/2,s=n===0?2*o/(i+o):2*r/(n+r);return[e,s*100,a*100]};X.hsv.rgb=function(t){let e=t[0]/60,r=t[1]/100,n=t[2]/100,o=Math.floor(e)%6,i=e-Math.floor(e),a=255*n*(1-r),s=255*n*(1-r*i),u=255*n*(1-r*(1-i));switch(n*=255,o){case 0:return[n,u,a];case 1:return[s,n,a];case 2:return[a,n,u];case 3:return[a,s,n];case 4:return[u,a,n];case 5:return[n,a,s]}};X.hsv.hsl=function(t){let e=t[0],r=t[1]/100,n=t[2]/100,o=Math.max(n,.01),i,a;a=(2-r)*n;let s=(2-r)*o;return i=r*o,i/=s<=1?s:2-s,i=i||0,a/=2,[e,i*100,a*100]};X.hwb.rgb=function(t){let e=t[0]/360,r=t[1]/100,n=t[2]/100,o=r+n,i;o>1&&(r/=o,n/=o);let a=Math.floor(6*e),s=1-n;i=6*e-a,(a&1)!==0&&(i=1-i);let u=r+i*(s-r),c,l,p;switch(a){default:case 6:case 0:c=s,l=u,p=r;break;case 1:c=u,l=s,p=r;break;case 2:c=r,l=s,p=u;break;case 3:c=r,l=u,p=s;break;case 4:c=u,l=r,p=s;break;case 5:c=s,l=r,p=u;break}return[c*255,l*255,p*255]};X.cmyk.rgb=function(t){let e=t[0]/100,r=t[1]/100,n=t[2]/100,o=t[3]/100,i=1-Math.min(1,e*(1-o)+o),a=1-Math.min(1,r*(1-o)+o),s=1-Math.min(1,n*(1-o)+o);return[i*255,a*255,s*255]};X.xyz.rgb=function(t){let e=t[0]/100,r=t[1]/100,n=t[2]/100,o,i,a;return o=e*3.2406+r*-1.5372+n*-.4986,i=e*-.9689+r*1.8758+n*.0415,a=e*.0557+r*-.204+n*1.057,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,i=i>.0031308?1.055*i**(1/2.4)-.055:i*12.92,a=a>.0031308?1.055*a**(1/2.4)-.055:a*12.92,o=Math.min(Math.max(0,o),1),i=Math.min(Math.max(0,i),1),a=Math.min(Math.max(0,a),1),[o*255,i*255,a*255]};X.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 o=116*r-16,i=500*(e-r),a=200*(r-n);return[o,i,a]};X.lab.xyz=function(t){let e=t[0],r=t[1],n=t[2],o,i,a;i=(e+16)/116,o=r/500+i,a=i-n/200;let s=i**3,u=o**3,c=a**3;return i=s>.008856?s:(i-16/116)/7.787,o=u>.008856?u:(o-16/116)/7.787,a=c>.008856?c:(a-16/116)/7.787,o*=95.047,i*=100,a*=108.883,[o,i,a]};X.lab.lch=function(t){let e=t[0],r=t[1],n=t[2],o;o=Math.atan2(n,r)*360/2/Math.PI,o<0&&(o+=360);let a=Math.sqrt(r*r+n*n);return[e,a,o]};X.lch.lab=function(t){let e=t[0],r=t[1],o=t[2]/360*2*Math.PI,i=r*Math.cos(o),a=r*Math.sin(o);return[e,i,a]};X.rgb.ansi16=function(t,e=null){let[r,n,o]=t,i=e===null?X.rgb.hsv(t)[2]:e;if(i=Math.round(i/50),i===0)return 30;let a=30+(Math.round(o/255)<<2|Math.round(n/255)<<1|Math.round(r/255));return i===2&&(a+=60),a};X.hsv.ansi16=function(t){return X.rgb.ansi16(X.hsv.rgb(t),t[2])};X.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)};X.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,o=(e>>1&1)*r*255,i=(e>>2&1)*r*255;return[n,o,i]};X.ansi256.rgb=function(t){if(t>=232){let i=(t-232)*10+8;return[i,i,i]}t-=16;let e,r=Math.floor(t/36)/5*255,n=Math.floor((e=t%36)/6)/5*255,o=e%6/5*255;return[r,n,o]};X.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};X.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(s=>s+s).join(""));let n=parseInt(r,16),o=n>>16&255,i=n>>8&255,a=n&255;return[o,i,a]};X.rgb.hcg=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255,o=Math.max(Math.max(e,r),n),i=Math.min(Math.min(e,r),n),a=o-i,s,u;return a<1?s=i/(1-a):s=0,a<=0?u=0:o===e?u=(r-n)/a%6:o===r?u=2+(n-e)/a:u=4+(e-r)/a,u/=6,u%=1,[u*360,a*100,s*100]};X.hsl.hcg=function(t){let e=t[1]/100,r=t[2]/100,n=r<.5?2*e*r:2*e*(1-r),o=0;return n<1&&(o=(r-.5*n)/(1-n)),[t[0],n*100,o*100]};X.hsv.hcg=function(t){let e=t[1]/100,r=t[2]/100,n=e*r,o=0;return n<1&&(o=(r-n)/(1-n)),[t[0],n*100,o*100]};X.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 o=[0,0,0],i=e%1*6,a=i%1,s=1-a,u=0;switch(Math.floor(i)){case 0:o[0]=1,o[1]=a,o[2]=0;break;case 1:o[0]=s,o[1]=1,o[2]=0;break;case 2:o[0]=0,o[1]=1,o[2]=a;break;case 3:o[0]=0,o[1]=s,o[2]=1;break;case 4:o[0]=a,o[1]=0,o[2]=1;break;default:o[0]=1,o[1]=0,o[2]=s}return u=(1-r)*n,[(r*o[0]+u)*255,(r*o[1]+u)*255,(r*o[2]+u)*255]};X.hcg.hsv=function(t){let e=t[1]/100,r=t[2]/100,n=e+r*(1-e),o=0;return n>0&&(o=e/n),[t[0],o*100,n*100]};X.hcg.hsl=function(t){let e=t[1]/100,n=t[2]/100*(1-e)+.5*e,o=0;return n>0&&n<.5?o=e/(2*n):n>=.5&&n<1&&(o=e/(2*(1-n))),[t[0],o*100,n*100]};X.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]};X.hwb.hcg=function(t){let e=t[1]/100,n=1-t[2]/100,o=n-e,i=0;return o<1&&(i=(n-o)/(1-o)),[t[0],o*100,i*100]};X.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]};X.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]};X.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]};X.gray.hsl=function(t){return[0,0,t[0]]};X.gray.hsv=X.gray.hsl;X.gray.hwb=function(t){return[0,100,t[0]]};X.gray.cmyk=function(t){return[0,0,0,t[0]]};X.gray.lab=function(t){return[t[0],0,0]};X.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};X.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]}});var K_=x((YG,W_)=>{var Zc=lm();function xN(){let t={},e=Object.keys(Zc);for(let r=e.length,n=0;n<r;n++)t[e[n]]={distance:-1,parent:null};return t}function SN(t){let e=xN(),r=[t];for(e[t].distance=0;r.length;){let n=r.pop(),o=Object.keys(Zc[n]);for(let i=o.length,a=0;a<i;a++){let s=o[a],u=e[s];u.distance===-1&&(u.distance=e[n].distance+1,u.parent=n,r.unshift(s))}}return e}function FN(t,e){return function(r){return e(t(r))}}function AN(t,e){let r=[e[t].parent,t],n=Zc[e[t].parent][t],o=e[t].parent;for(;e[o].parent;)r.unshift(e[o].parent),n=FN(Zc[e[o].parent][o],n),o=e[o].parent;return n.conversion=r,n}W_.exports=function(t){let e=SN(t),r={},n=Object.keys(e);for(let o=n.length,i=0;i<o;i++){let a=n[i];e[a].parent!==null&&(r[a]=AN(a,e))}return r}});var J_=x((JG,Y_)=>{var fm=lm(),ON=K_(),Ri={},kN=Object.keys(fm);function $N(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 PN(t){let e=function(...r){let n=r[0];if(n==null)return n;n.length>1&&(r=n);let o=t(r);if(typeof o=="object")for(let i=o.length,a=0;a<i;a++)o[a]=Math.round(o[a]);return o};return"conversion"in t&&(e.conversion=t.conversion),e}kN.forEach(t=>{Ri[t]={},Object.defineProperty(Ri[t],"channels",{value:fm[t].channels}),Object.defineProperty(Ri[t],"labels",{value:fm[t].labels});let e=ON(t);Object.keys(e).forEach(n=>{let o=e[n];Ri[t][n]=PN(o),Ri[t][n].raw=$N(o)})});Y_.exports=Ri});var dm=x((XG,tx)=>{"use strict";var X_=(t,e)=>(...r)=>`\x1B[${t(...r)+e}m`,Z_=(t,e)=>(...r)=>{let n=t(...r);return`\x1B[${38+e};5;${n}m`},Q_=(t,e)=>(...r)=>{let n=t(...r);return`\x1B[${38+e};2;${n[0]};${n[1]};${n[2]}m`},Qc=t=>t,ex=(t,e,r)=>[t,e,r],Bi=(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})},pm,ji=(t,e,r,n)=>{pm===void 0&&(pm=J_());let o=n?10:0,i={};for(let[a,s]of Object.entries(pm)){let u=a==="ansi16"?"ansi":a;a===e?i[u]=t(r,o):typeof s=="object"&&(i[u]=t(s[e],o))}return i};function TN(){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[o,i]of Object.entries(n))e[o]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},n[o]=e[o],t.set(i[0],i[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",Bi(e.color,"ansi",()=>ji(X_,"ansi16",Qc,!1)),Bi(e.color,"ansi256",()=>ji(Z_,"ansi256",Qc,!1)),Bi(e.color,"ansi16m",()=>ji(Q_,"rgb",ex,!1)),Bi(e.bgColor,"ansi",()=>ji(X_,"ansi16",Qc,!0)),Bi(e.bgColor,"ansi256",()=>ji(Z_,"ansi256",Qc,!0)),Bi(e.bgColor,"ansi16m",()=>ji(Q_,"rgb",ex,!0)),e}Object.defineProperty(tx,"exports",{enumerable:!0,get:TN})});var ax=x((ZG,ix)=>{"use strict";var IN=cm(),RN=q_(),rx=dm(),ox=["\x1B","\x9B"],el=t=>`${ox[0]}[${t}m`,nx=(t,e,r)=>{let n=[];t=[...t];for(let o of t){let i=o;o.includes(";")&&(o=o.split(";")[0][0]+"0");let a=rx.codes.get(Number.parseInt(o,10));if(a){let s=t.indexOf(a.toString());s===-1?n.push(el(e?a:i)):t.splice(s,1)}else if(e){n.push(el(0));break}else n.push(el(i))}if(e&&(n=n.filter((o,i)=>n.indexOf(o)===i),r!==void 0)){let o=el(rx.codes.get(Number.parseInt(r,10)));n=n.reduce((i,a)=>a===o?[a,...i]:[...i,a],[])}return n.join("")};ix.exports=(t,e,r)=>{let n=[...t],o=[],i=typeof r=="number"?r:n.length,a=!1,s,u=0,c="";for(let[l,p]of n.entries()){let d=!1;if(ox.includes(p)){let h=/\d[^m]*/.exec(t.slice(l,l+18));s=h&&h.length>0?h[0]:void 0,u<i&&(a=!0,s!==void 0&&o.push(s))}else a&&p==="m"&&(a=!1,d=!0);if(!a&&!d&&u++,!RN({exact:!0}).test(p)&&IN(p.codePointAt())&&(u++,typeof r!="number"&&i++),u>e&&u<=i)c+=p;else if(u===e&&!a&&s!==void 0)c=nx(o);else if(u>=i){c+=nx(o,!0,s);break}}return c}});var ux=x((QG,sx)=>{"use strict";sx.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 tl=x((eW,cx)=>{"use strict";var BN=ux();cx.exports=t=>typeof t=="string"?t.replace(BN(),""):t});var fx=x((tW,lx)=>{"use strict";lx.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 mm=x((rW,hm)=>{"use strict";var jN=tl(),NN=cm(),LN=fx(),px=t=>{if(typeof t!="string"||t.length===0||(t=jN(t),t.length===0))return 0;t=t.replace(LN()," ");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+=NN(n)?2:1)}return e};hm.exports=px;hm.exports.default=px});var yx=x((nW,Dx)=>{"use strict";var ps=mm(),UN=tl(),MN=dm(),rl=new Set(["\x1B","\x9B"]),qN=39,Dm="\x07",mx="[",HN="]",gx="m",ym=`${HN}8;;`,dx=t=>`${rl.values().next().value}${mx}${t}${gx}`,hx=t=>`${rl.values().next().value}${ym}${t}${Dm}`,VN=t=>t.split(" ").map(e=>ps(e)),gm=(t,e,r)=>{let n=[...e],o=!1,i=!1,a=ps(UN(t[t.length-1]));for(let[s,u]of n.entries()){let c=ps(u);if(a+c<=r?t[t.length-1]+=u:(t.push(u),a=0),rl.has(u)&&(o=!0,i=n.slice(s+1).join("").startsWith(ym)),o){i?u===Dm&&(o=!1,i=!1):u===gx&&(o=!1);continue}a+=c,a===r&&s<n.length-1&&(t.push(""),a=0)}!a&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},zN=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(ps(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},GN=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",o,i,a=VN(t),s=[""];for(let[c,l]of t.split(" ").entries()){r.trim!==!1&&(s[s.length-1]=s[s.length-1].trimStart());let p=ps(s[s.length-1]);if(c!==0&&(p>=e&&(r.wordWrap===!1||r.trim===!1)&&(s.push(""),p=0),(p>0||r.trim===!1)&&(s[s.length-1]+=" ",p++)),r.hard&&a[c]>e){let d=e-p,h=1+Math.floor((a[c]-d-1)/e);Math.floor((a[c]-1)/e)<h&&s.push(""),gm(s,l,e);continue}if(p+a[c]>e&&p>0&&a[c]>0){if(r.wordWrap===!1&&p<e){gm(s,l,e);continue}s.push("")}if(p+a[c]>e&&r.wordWrap===!1){gm(s,l,e);continue}s[s.length-1]+=l}r.trim!==!1&&(s=s.map(zN));let u=[...s.join(`
54
+ `)];for(let[c,l]of u.entries()){if(n+=l,rl.has(l)){let{groups:d}=new RegExp(`(?:\\${mx}(?<code>\\d+)m|\\${ym}(?<uri>.*)${Dm})`).exec(u.slice(c).join(""))||{groups:{}};if(d.code!==void 0){let h=Number.parseFloat(d.code);o=h===qN?void 0:h}else d.uri!==void 0&&(i=d.uri.length===0?void 0:d.uri)}let p=MN.codes.get(Number(o));u[c+1]===`
55
+ `?(i&&(n+=hx("")),o&&p&&(n+=dx(p))):l===`
56
+ `&&(o&&p&&(n+=dx(o)),i&&(n+=hx(i)))}return n};Dx.exports=(t,e,r)=>String(t).normalize().replace(/\r\n/g,`
57
57
  `).split(`
58
- `).map(n=>qN(n,e,r)).join(`
59
- `)});var yx=x((JG,Dx)=>{"use strict";var HN=require("os"),gx=HN.homedir();Dx.exports=t=>{if(typeof t!="string")throw new TypeError(`Expected a string, got ${typeof t}`);return gx?t.replace(/^~(?=$|\/|\\)/,gx):t}});var _x=x(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.columnar=Ve.generateFillSpaceStringList=Ve.expandPath=Ve.prettyPath=Ve.wordWrap=Ve.indent=Ve.TTY_WIDTH=Ve.stripAnsi=Ve.stringWidth=Ve.sliceAnsi=void 0;var bx=(fe(),re(le)),VN=bx.__importStar(require("os")),en=bx.__importStar(require("path")),vx=nx();Ve.sliceAnsi=vx;var el=pm();Ve.stringWidth=el;var zN=Zc();Ve.stripAnsi=zN;var GN=mx(),WN=yx(),KN=80,YN=120;Ve.TTY_WIDTH=process.stdout.columns?Math.max(KN,Math.min(process.stdout.columns,YN)):1/0;function wx(t=4){return" ".repeat(t)}Ve.indent=wx;function JN(t,{width:e=Ve.TTY_WIDTH,indentation:r=0,append:n=""}){return GN(t,e-r-n.length,{trim:!0}).split(`
58
+ `).map(n=>GN(n,e,r)).join(`
59
+ `)});var vx=x((oW,wx)=>{"use strict";var WN=require("os"),bx=WN.homedir();wx.exports=t=>{if(typeof t!="string")throw new TypeError(`Expected a string, got ${typeof t}`);return bx?t.replace(/^~(?=$|\/|\\)/,bx):t}});var Fx=x(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:!0});Ge.columnar=Ge.generateFillSpaceStringList=Ge.expandPath=Ge.prettyPath=Ge.wordWrap=Ge.indent=Ge.TTY_WIDTH=Ge.stripAnsi=Ge.stringWidth=Ge.sliceAnsi=void 0;var Cx=(fe(),ne(le)),KN=Cx.__importStar(require("os")),en=Cx.__importStar(require("path")),Ex=ax();Ge.sliceAnsi=Ex;var nl=mm();Ge.stringWidth=nl;var YN=tl();Ge.stripAnsi=YN;var JN=yx(),XN=vx(),ZN=80,QN=120;Ge.TTY_WIDTH=process.stdout.columns?Math.max(ZN,Math.min(process.stdout.columns,QN)):1/0;function _x(t=4){return" ".repeat(t)}Ge.indent=_x;function eL(t,{width:e=Ge.TTY_WIDTH,indentation:r=0,append:n=""}){return JN(t,e-r-n.length,{trim:!0}).split(`
60
60
  `).join(`${n}
61
- ${wx(r)}`)}Ve.wordWrap=JN;function XN(t){t=Cx(t);let e=process.cwd(),r=en.dirname(t),n=VN.homedir(),o=Math.abs(r.split(en.sep).length-e.split(en.sep).length);if(e===r)return"."+en.sep+en.basename(t);if(r.startsWith(e))return"."+en.sep+t.substring(e.length+1);if(o<=2){let i=en.relative(e,t);return i||"."}else{if(t===n)return"~";if(t.indexOf(n)===0)return"~"+en.sep+t.substring(n.length+1)}return t}Ve.prettyPath=XN;function Cx(t){return en.resolve(WN(t))}Ve.expandPath=Cx;function Ex(t,e=1,r=" "){e<2&&(e=2);let n=Math.max(...t.map(a=>el(a))),o=n>e?n+1:e,i=r.repeat(o);return t.map(a=>vx(i,0,o-el(a)))}Ve.generateFillSpaceStringList=Ex;function ZN(t,{hsep:e="-",vsep:r="|",headers:n}){let o=!!n;if(!t[0])return"";let i=n?n.length:t[0].length,a=n?n.map(l=>[l]):t[0].map(()=>[]);for(let l of t){let f=0,d=l.map(h=>{let m=h.split(`
62
- `);return f=Math.max(f,m.length),m});for(let h in l)a[h]&&a[h].push(...d[h],...Array(f-d[h].length).fill(""))}let s=a.map((l,f)=>{if(f<i-1){let d=Ex(l);return l.map((h,m)=>`${h}${d[m]}${r===""?"":`${r} `}`)}else return l}),u=0,c=s.reduce((l,f)=>l.map((d,h)=>{let m=l[h]+f[h];return u=Math.max(u,el(m)),m}));return o&&e!==""&&c.splice(1,0,e.repeat(u)),c.join(`
63
- `)}Ve.columnar=ZN});var xx=x(ur=>{"use strict";Object.defineProperty(ur,"__esModule",{value:!0});ur.TERMINAL_INFO=ur.CI_ENVIRONMENT_VARIABLES_DETECTED=ur.CI_ENVIRONMENT_VARIABLES=void 0;var QN=(fe(),re(le)),eL=Gh(),tL=QN.__importStar(require("os")),rL=(0,eL.debug)("ionic:utils-terminal:info");ur.CI_ENVIRONMENT_VARIABLES=["CI","BUILD_ID","BUILD_NUMBER","BITBUCKET_COMMIT","CODEBUILD_BUILD_ARN","GITHUB_ACTIONS"];ur.CI_ENVIRONMENT_VARIABLES_DETECTED=ur.CI_ENVIRONMENT_VARIABLES.filter(t=>!!process.env[t]);function nL(){let{shell:t}=tL.userInfo();return t||(process.env.SHELL?process.env.SHELL:process.platform==="darwin"?"/bin/bash":process.platform==="win32"?process.env.COMSPEC?process.env.COMSPEC:"cmd.exe":"/bin/sh")}ur.CI_ENVIRONMENT_VARIABLES_DETECTED.length>0&&rL(`Environment variables for CI detected: ${ur.CI_ENVIRONMENT_VARIABLES_DETECTED.join(", ")}`);ur.TERMINAL_INFO=Object.freeze({ci:ur.CI_ENVIRONMENT_VARIABLES_DETECTED.length>0,shell:nL(),tty:!!(process.stdin.isTTY&&process.stdout.isTTY&&process.stderr.isTTY),windows:process.platform==="win32"||!!(process.env.OSTYPE&&/^(msys|cygwin)$/.test(process.env.OSTYPE)||process.env.MSYSTEM&&/^MINGW(32|64)$/.test(process.env.MSYSTEM))})});var gm=x(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});var tl=(fe(),re(le));tl.__exportStar(om(),Ri);tl.__exportStar(R_(),Ri);tl.__exportStar(_x(),Ri);tl.__exportStar(xx(),Ri)});var nl=x(Tr=>{"use strict";Object.defineProperty(Tr,"__esModule",{value:!0});Tr.isFatal=Tr.fatal=Tr.FatalException=Tr.BaseException=void 0;var rl=class extends Error{constructor(e,r){super(e),this.message=e,this.code=r}};Tr.BaseException=rl;var ls=class extends rl{constructor(e,r=1){super(e,"FATAL"),this.message=e,this.exitCode=r}};Tr.FatalException=ls;function oL(t){throw new ls(t)}Tr.fatal=oL;function iL(t){return t&&t instanceof ls}Tr.isFatal=iL});var bm={};qr(bm,{LOGGER_LEVELS:()=>dL,Logger:()=>ym,NO_COLORS:()=>Sx,StreamOutputStrategy:()=>ol,TTYOutputStrategy:()=>Dm,TTY_WIDTH:()=>aL,createDefaultLogger:()=>pL,indent:()=>sL,sliceAnsi:()=>uL,stringWidth:()=>cL,stripAnsi:()=>lL,wordWrap:()=>fL});var aL,sL,uL,cL,lL,fL,pL,Sx,ol,Dm,ym,dL,vm=tt(()=>{aL=80,sL=t=>t,uL=t=>t,cL=t=>t.length,lL=t=>t,fL=t=>t,pL=()=>({info:console.log,warn:console.warn,error:console.error,debug:console.debug}),Sx={},ol=class{constructor(){this.colors=Sx,this.stream=process.stdout}},Dm=class extends ol{constructor(e){super(),this.options=e}},ym=class{constructor(){}info(){}warn(){}error(){}debug(){}},dL={DEBUG:"DEBUG",INFO:"INFO",WARN:"WARN",ERROR:"ERROR"}});var Ax=x(wo=>{"use strict";Object.defineProperty(wo,"__esModule",{value:!0});wo.isInteractive=wo.checkInteractive=void 0;var hL=(fe(),re(le)),Fx=gm(),mL=hL.__importDefault(ki()),gL=fs(),DL=(...t)=>(0,wo.isInteractive)()?!0:t.length?t.filter(e=>!e).length?(gL.logger.error(`Non-interactive shell detected.
64
- Run the command with ${mL.default.input("--help")} to see a list of arguments that must be provided.`),!1):!0:!1;wo.checkInteractive=DL;var yL=()=>Fx.TERMINAL_INFO.tty&&!Fx.TERMINAL_INFO.ci;wo.isInteractive=yL});var il={};qr(il,{default:()=>Ox});function Ox(){throw new Error("Prompts are not supported in this CLI build")}var al=tt(()=>{});var fs=x(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.logSuccess=Mt.logPrompt=Mt.logger=Mt.output=void 0;var wm=(fe(),re(le)),Co=(vm(),re(bm)),Eo=wm.__importDefault(ki()),bL=Ax(),kx={colors:Eo.default,stream:process.argv.includes("--json")?process.stderr:process.stdout};Mt.output=(0,bL.isInteractive)()?new Co.TTYOutputStrategy(kx):new Co.StreamOutputStrategy(kx);Mt.logger=(0,Co.createDefaultLogger)({output:Mt.output,formatterOptions:{titleize:!1,tags:new Map([[Co.LOGGER_LEVELS.DEBUG,Eo.default.log.DEBUG("[debug]")],[Co.LOGGER_LEVELS.INFO,Eo.default.log.INFO("[info]")],[Co.LOGGER_LEVELS.WARN,Eo.default.log.WARN("[warn]")],[Co.LOGGER_LEVELS.ERROR,Eo.default.log.ERROR("[error]")]])}});async function vL(t,e){let{wordWrap:r}=await Promise.resolve().then(()=>wm.__importStar((vm(),re(bm)))),{prompt:n}=await Promise.resolve().then(()=>wm.__importStar((al(),re(il))));return Mt.logger.log({msg:`${Eo.default.input("[?]")} ${r(t,{indentation:4})}`,logger:Mt.logger,format:!1}),n(e,{onCancel:()=>process.exit(1)})}Mt.logPrompt=vL;function wL(t){Mt.logger.msg(`${Eo.default.success("[success]")} ${t}`)}Mt.logSuccess=wL});var sl=x(Bi=>{"use strict";Object.defineProperty(Bi,"__esModule",{value:!0});Bi.resolveNode=Bi.requireTS=void 0;var CL=require("fs"),EL=Oi(),_L=require("path"),xL=(t,e)=>{let r=(0,_L.resolve)(e);delete require.cache[r],require.extensions[".ts"]=(o,i)=>{var a;let s=(0,EL.readFileSync)(i,"utf8");i.endsWith(".ts")?s=t.transpileModule(s,{fileName:i,compilerOptions:{module:t.ModuleKind.CommonJS,moduleResolution:t.ModuleResolutionKind.NodeJs,esModuleInterop:!0,strict:!0,target:t.ScriptTarget.ES2017},reportDiagnostics:!0}).outputText:s=s.replace(/export\s+\w+\s+(\w+)/gm,"exports.$1"),(a=o._compile)===null||a===void 0||a.call(o,s,i)};let n=require(r);return delete require.extensions[".ts"],n};Bi.requireTS=xL;function SL(t,...e){try{return require.resolve(e.join("/"),{paths:[t]})}catch{let n=[t,"node_modules",...e].join("/");return(0,CL.existsSync)(n)?n:null}}Bi.resolveNode=SL});var $x={};qr($x,{default:()=>FL});var FL,Px=tt(()=>{FL={}});var Tx=x(Ir=>{"use strict";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.buildXmlElement=Ir.writeXML=Ir.parseXML=Ir.readXML=void 0;var AL=(fe(),re(le)),OL=Oi(),ps=AL.__importDefault((Px(),re($x)));async function kL(t){var e;try{let r=await(0,OL.readFile)(t,{encoding:"utf-8"});try{return await ps.default.parseStringPromise(r)}catch(n){throw`Error parsing: ${t}, ${(e=n.stack)!==null&&e!==void 0?e:n}`}}catch{throw`Unable to read: ${t}`}}Ir.readXML=kL;function $L(t,e){let r=e!==void 0?new ps.default.Parser({...e}):new ps.default.Parser,n;return r.parseString(t,(o,i)=>{o||(n=i)}),n}Ir.parseXML=$L;async function PL(t){return new Promise(e=>{let n=new ps.default.Builder({headless:!0,explicitRoot:!1,rootName:"deleteme"}).buildObject(t);n=n.replace("<deleteme>","").replace("</deleteme>",""),e(n)})}Ir.writeXML=PL;function TL(t,e){return new ps.default.Builder({headless:!0,explicitRoot:!1,rootName:e}).buildObject(t)}Ir.buildXmlElement=TL});var Nx=x(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.getAllElements=Fe.getFilePath=Fe.getAssets=Fe.getJSModules=Fe.getPluginType=Fe.getPlatformElement=Fe.getPluginPlatform=Fe.printPlugins=Fe.fixName=Fe.getDependencies=Fe.resolvePlugin=Fe.getPlugins=Fe.getIncludedPluginPackages=void 0;var IL=(fe(),re(le)),RL=Oi(),Cm=require("path"),ji=IL.__importDefault(ki()),BL=nl(),jL=fs(),Ix=sl(),NL=Tx();function Rx(t,e){var r,n,o,i;let{extConfig:a}=t.app;switch(e){case"android":return(n=(r=a.android)===null||r===void 0?void 0:r.includePlugins)!==null&&n!==void 0?n:a.includePlugins;case"ios":return(i=(o=a.ios)===null||o===void 0?void 0:o.includePlugins)!==null&&i!==void 0?i:a.includePlugins}}Fe.getIncludedPluginPackages=Rx;async function LL(t,e){var r;let n=(r=Rx(t,e))!==null&&r!==void 0?r:jx(t);return(await Promise.all(n.map(async i=>Bx(t,i)))).filter(i=>!!i)}Fe.getPlugins=LL;async function Bx(t,e){try{let r=(0,Ix.resolveNode)(t.app.rootDir,e,"package.json");r||(0,BL.fatal)(`Unable to find ${ji.default.strong(`node_modules/${e}`)}.
65
- Are you sure ${ji.default.strong(e)} is installed?`);let n=(0,Cm.dirname)(r),o=await(0,RL.readJSON)(r);if(!o)return null;if(o.capacitor)return{id:e,name:Em(e),version:o.version,rootPath:n,repository:o.repository,manifest:o.capacitor};let i=(0,Cm.join)(n,"plugin.xml"),a=await(0,NL.readXML)(i);return{id:e,name:Em(e),version:o.version,rootPath:n,repository:o.repository,xml:a.plugin}}catch{}return null}Fe.resolvePlugin=Bx;function jx(t){var e,r;return[...Object.keys((e=t.app.package.dependencies)!==null&&e!==void 0?e:{}),...Object.keys((r=t.app.package.devDependencies)!==null&&r!==void 0?r:{})]}Fe.getDependencies=jx;function Em(t){return t=t.replace(/\//g,"_").replace(/-/g,"_").replace(/@/g,"").replace(/_\w/g,e=>e[1].toUpperCase()),t.charAt(0).toUpperCase()+t.slice(1)}Fe.fixName=Em;function UL(t,e,r="capacitor"){if(t.length===0)return;let n,o=t.length===1?"":"s";switch(r){case"cordova":n=`Found ${t.length} Cordova plugin${o} for ${ji.default.strong(e)}:
66
- `;break;case"incompatible":n=`Found ${t.length} incompatible Cordova plugin${o} for ${ji.default.strong(e)}, skipped install:
67
- `;break;case"capacitor":n=`Found ${t.length} Capacitor plugin${o} for ${ji.default.strong(e)}:
68
- `;break}n+=t.map(i=>`${i.id}${ji.default.weak(`@${i.version}`)}`).join(`
69
- `),jL.logger.info(n)}Fe.printPlugins=UL;function _m(t,e){return t.xml.platform?t.xml.platform.filter(function(o){return o.$.name===e})[0]:[]}Fe.getPluginPlatform=_m;function ML(t,e,r){let n=_m(t,e);if(n){let o=n[r];if(o)return o}return[]}Fe.getPlatformElement=ML;function qL(t,e){var r,n,o,i;switch(e){case"ios":return(n=(r=t.ios)===null||r===void 0?void 0:r.type)!==null&&n!==void 0?n:0;case"android":return(i=(o=t.android)===null||o===void 0?void 0:o.type)!==null&&i!==void 0?i:0}return 0}Fe.getPluginType=qL;function HL(t,e){return xm(t,e,"js-module")}Fe.getJSModules=HL;function VL(t,e){return xm(t,e,"asset")}Fe.getAssets=VL;function zL(t,e,r){if(r.startsWith("node_modules")){let n=r.split("/").slice(1);n[0].startsWith("@")&&(n=[n[0]+"/"+n[1],...n.slice(2)]);let o=(0,Ix.resolveNode)(t.app.rootDir,...n);if(!o)throw new Error(`Can't resolve module ${n[0]}`);return o}return(0,Cm.join)(e.rootPath,r)}Fe.getFilePath=zL;function xm(t,e,r){let n=[];t.xml[r]&&(n=n.concat(t.xml[r]));let o=_m(t,e);return o?.[r]&&(n=n.concat(o[r])),n}Fe.getAllElements=xm});var Lx={};qr(Lx,{default:()=>GL});var GL,Ux=tt(()=>{GL={}});var ul=x(Fn=>{"use strict";Object.defineProperty(Fn,"__esModule",{value:!0});Fn.isInstalled=Fn.getCommandOutput=Fn.runCommand=void 0;var Sm=(Ux(),re(Lx));async function Mx(t,e,r={}){let n=new Sm.Subprocess(t,e,r);try{return await n.output()}catch(o){throw o instanceof Sm.SubprocessError?o.output?o.output:o.cause?`${o.message} ${o.cause.toString()}`:o.code?o.code:"Unknown error":o}}Fn.runCommand=Mx;async function WL(t,e,r={}){try{return(await Mx(t,e,r)).trim()}catch{return null}}Fn.getCommandOutput=WL;async function KL(t){try{await(0,Sm.which)(t)}catch{return!1}return!0}Fn.isInstalled=KL});var qx={};qr(qx,{Comparator:()=>C4,Range:()=>v4,SemVer:()=>w4,clean:()=>ZL,coerce:()=>b4,compare:()=>n4,diff:()=>YL,eq:()=>s4,gt:()=>i4,gte:()=>c4,gtr:()=>g4,inc:()=>QL,intersects:()=>y4,lt:()=>a4,lte:()=>l4,ltr:()=>D4,major:()=>e4,maxSatisfying:()=>p4,minSatisfying:()=>d4,minor:()=>t4,neq:()=>u4,outside:()=>m4,parse:()=>JL,patch:()=>r4,rcompare:()=>o4,satisfies:()=>f4,valid:()=>XL,validRange:()=>h4});var YL,JL,XL,ZL,QL,e4,t4,r4,n4,o4,i4,a4,s4,u4,c4,l4,f4,p4,d4,h4,m4,g4,D4,y4,b4,v4,w4,C4,Hx=tt(()=>{YL=()=>null,JL=()=>null,XL=()=>null,ZL=()=>null,QL=()=>null,e4=()=>null,t4=()=>null,r4=()=>null,n4=()=>0,o4=()=>0,i4=()=>!1,a4=()=>!1,s4=()=>!1,u4=()=>!0,c4=()=>!1,l4=()=>!1,f4=()=>!1,p4=()=>null,d4=()=>null,h4=()=>null,m4=()=>!1,g4=()=>!1,D4=()=>!1,y4=()=>!1,b4=()=>null,v4=class{},w4=class{},C4=class{}});var t1=x(Y=>{"use strict";Object.defineProperty(Y,"__esModule",{value:!0});Y.parseApkNameFromFlavor=Y.checkJDKMajorVersion=Y.resolvePlatform=Y.checkPlatformVersions=Y.getAddedPlatforms=Y.getPlatformTargetName=Y.promptForPlatformTarget=Y.promptForPlatform=Y.isValidEnterprisePlatform=Y.getKnownEnterprisePlatforms=Y.isValidCommunityPlatform=Y.getKnownCommunityPlatforms=Y.isValidPlatform=Y.getKnownPlatforms=Y.selectPlatforms=Y.getProjectPlatformDirectory=Y.getCLIVersion=Y.getCoreVersion=Y.getCapacitorPackageVersion=Y.requireCapacitorPackage=Y.getCapacitorPackage=Y.runTask=Y.runPlatformHook=Y.runHooks=Y.wait=Y.checkAppName=Y.checkAppId=Y.checkAppDir=Y.checkAppConfig=Y.checkCapacitorPlatform=Y.checkPackage=Y.checkWebDir=Y.check=void 0;var hs=(fe(),re(le)),Vx=gm(),An=Oi(),_o=require("path"),Ae=hs.__importDefault(ki()),Ni=nl(),Gx=fs(),E4=Nx(),zx=Js(),ds=sl(),_4=ul();async function x4(t){let r=(await Promise.all(t.map(n=>n()))).filter(n=>n!=null);if(r.length>0)throw r.join(`
70
- `)}Y.check=x4;async function S4(t){var e;return!((e=t.app.extConfig.server)===null||e===void 0)&&e.url?null:["",".","..","../","./"].includes(t.app.webDir)?`"${t.app.webDir}" is not a valid value for webDir`:await(0,An.pathExists)(t.app.webDirAbs)?await(0,An.pathExists)((0,_o.join)(t.app.webDirAbs,"index.html"))?null:`The web assets directory (${Ae.default.strong((0,Vx.prettyPath)(t.app.webDirAbs))}) must contain an ${Ae.default.strong("index.html")} file.
71
- It will be the entry point for the web portion of the Capacitor app.`:`Could not find the web assets directory: ${Ae.default.strong((0,Vx.prettyPath)(t.app.webDirAbs))}.
72
- Please create it and make sure it has an ${Ae.default.strong("index.html")} file. You can change the path of this directory in ${Ae.default.strong(t.app.extConfigName)} (${Ae.default.input("webDir")} option). You may need to compile the web assets for your app (typically ${Ae.default.input("npm run build")}). More info: ${Ae.default.strong("https://capacitorjs.com/docs/basics/workflow#sync-your-project")}`}Y.checkWebDir=S4;async function F4(){return await(0,An.pathExists)("package.json")||await(0,An.pathExists)("project.json")?null:`The Capacitor CLI needs to run at the root of an npm package or in a valid NX monorepo.
61
+ ${_x(r)}`)}Ge.wordWrap=eL;function tL(t){t=xx(t);let e=process.cwd(),r=en.dirname(t),n=KN.homedir(),o=Math.abs(r.split(en.sep).length-e.split(en.sep).length);if(e===r)return"."+en.sep+en.basename(t);if(r.startsWith(e))return"."+en.sep+t.substring(e.length+1);if(o<=2){let i=en.relative(e,t);return i||"."}else{if(t===n)return"~";if(t.indexOf(n)===0)return"~"+en.sep+t.substring(n.length+1)}return t}Ge.prettyPath=tL;function xx(t){return en.resolve(XN(t))}Ge.expandPath=xx;function Sx(t,e=1,r=" "){e<2&&(e=2);let n=Math.max(...t.map(a=>nl(a))),o=n>e?n+1:e,i=r.repeat(o);return t.map(a=>Ex(i,0,o-nl(a)))}Ge.generateFillSpaceStringList=Sx;function rL(t,{hsep:e="-",vsep:r="|",headers:n}){let o=!!n;if(!t[0])return"";let i=n?n.length:t[0].length,a=n?n.map(l=>[l]):t[0].map(()=>[]);for(let l of t){let p=0,d=l.map(h=>{let m=h.split(`
62
+ `);return p=Math.max(p,m.length),m});for(let h in l)a[h]&&a[h].push(...d[h],...Array(p-d[h].length).fill(""))}let s=a.map((l,p)=>{if(p<i-1){let d=Sx(l);return l.map((h,m)=>`${h}${d[m]}${r===""?"":`${r} `}`)}else return l}),u=0,c=s.reduce((l,p)=>l.map((d,h)=>{let m=l[h]+p[h];return u=Math.max(u,nl(m)),m}));return o&&e!==""&&c.splice(1,0,e.repeat(u)),c.join(`
63
+ `)}Ge.columnar=rL});var Ax=x(ur=>{"use strict";Object.defineProperty(ur,"__esModule",{value:!0});ur.TERMINAL_INFO=ur.CI_ENVIRONMENT_VARIABLES_DETECTED=ur.CI_ENVIRONMENT_VARIABLES=void 0;var nL=(fe(),ne(le)),oL=Yh(),iL=nL.__importStar(require("os")),aL=(0,oL.debug)("ionic:utils-terminal:info");ur.CI_ENVIRONMENT_VARIABLES=["CI","BUILD_ID","BUILD_NUMBER","BITBUCKET_COMMIT","CODEBUILD_BUILD_ARN","GITHUB_ACTIONS"];ur.CI_ENVIRONMENT_VARIABLES_DETECTED=ur.CI_ENVIRONMENT_VARIABLES.filter(t=>!!process.env[t]);function sL(){let{shell:t}=iL.userInfo();return t||(process.env.SHELL?process.env.SHELL:process.platform==="darwin"?"/bin/bash":process.platform==="win32"?process.env.COMSPEC?process.env.COMSPEC:"cmd.exe":"/bin/sh")}ur.CI_ENVIRONMENT_VARIABLES_DETECTED.length>0&&aL(`Environment variables for CI detected: ${ur.CI_ENVIRONMENT_VARIABLES_DETECTED.join(", ")}`);ur.TERMINAL_INFO=Object.freeze({ci:ur.CI_ENVIRONMENT_VARIABLES_DETECTED.length>0,shell:sL(),tty:!!(process.stdin.isTTY&&process.stdout.isTTY&&process.stderr.isTTY),windows:process.platform==="win32"||!!(process.env.OSTYPE&&/^(msys|cygwin)$/.test(process.env.OSTYPE)||process.env.MSYSTEM&&/^MINGW(32|64)$/.test(process.env.MSYSTEM))})});var bm=x(Ni=>{"use strict";Object.defineProperty(Ni,"__esModule",{value:!0});var ol=(fe(),ne(le));ol.__exportStar(sm(),Ni);ol.__exportStar(N_(),Ni);ol.__exportStar(Fx(),Ni);ol.__exportStar(Ax(),Ni)});var al=x(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});Pr.isFatal=Pr.fatal=Pr.FatalException=Pr.BaseException=void 0;var il=class extends Error{constructor(e,r){super(e),this.message=e,this.code=r}};Pr.BaseException=il;var ds=class extends il{constructor(e,r=1){super(e,"FATAL"),this.message=e,this.exitCode=r}};Pr.FatalException=ds;function uL(t){throw new ds(t)}Pr.fatal=uL;function cL(t){return t&&t instanceof ds}Pr.isFatal=cL});var Cm={};qr(Cm,{LOGGER_LEVELS:()=>DL,Logger:()=>vm,NO_COLORS:()=>Ox,StreamOutputStrategy:()=>sl,TTYOutputStrategy:()=>wm,TTY_WIDTH:()=>lL,createDefaultLogger:()=>gL,indent:()=>fL,sliceAnsi:()=>pL,stringWidth:()=>dL,stripAnsi:()=>hL,wordWrap:()=>mL});var lL,fL,pL,dL,hL,mL,gL,Ox,sl,wm,vm,DL,Em=tt(()=>{lL=80,fL=t=>t,pL=t=>t,dL=t=>t.length,hL=t=>t,mL=t=>t,gL=()=>({info:console.log,warn:console.warn,error:console.error,debug:console.debug}),Ox={},sl=class{constructor(){this.colors=Ox,this.stream=process.stdout}},wm=class extends sl{constructor(e){super(),this.options=e}},vm=class{constructor(){}info(){}warn(){}error(){}debug(){}},DL={DEBUG:"DEBUG",INFO:"INFO",WARN:"WARN",ERROR:"ERROR"}});var $x=x(Co=>{"use strict";Object.defineProperty(Co,"__esModule",{value:!0});Co.isInteractive=Co.checkInteractive=void 0;var yL=(fe(),ne(le)),kx=bm(),bL=yL.__importDefault(Ti()),wL=hs(),vL=(...t)=>(0,Co.isInteractive)()?!0:t.length?t.filter(e=>!e).length?(wL.logger.error(`Non-interactive shell detected.
64
+ Run the command with ${bL.default.input("--help")} to see a list of arguments that must be provided.`),!1):!0:!1;Co.checkInteractive=vL;var CL=()=>kx.TERMINAL_INFO.tty&&!kx.TERMINAL_INFO.ci;Co.isInteractive=CL});var ul={};qr(ul,{default:()=>Px});function Px(){throw new Error("Prompts are not supported in this CLI build")}var cl=tt(()=>{});var hs=x(Lt=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:!0});Lt.logSuccess=Lt.logPrompt=Lt.logger=Lt.output=void 0;var _m=(fe(),ne(le)),Eo=(Em(),ne(Cm)),_o=_m.__importDefault(Ti()),EL=$x(),Tx={colors:_o.default,stream:process.argv.includes("--json")?process.stderr:process.stdout};Lt.output=(0,EL.isInteractive)()?new Eo.TTYOutputStrategy(Tx):new Eo.StreamOutputStrategy(Tx);Lt.logger=(0,Eo.createDefaultLogger)({output:Lt.output,formatterOptions:{titleize:!1,tags:new Map([[Eo.LOGGER_LEVELS.DEBUG,_o.default.log.DEBUG("[debug]")],[Eo.LOGGER_LEVELS.INFO,_o.default.log.INFO("[info]")],[Eo.LOGGER_LEVELS.WARN,_o.default.log.WARN("[warn]")],[Eo.LOGGER_LEVELS.ERROR,_o.default.log.ERROR("[error]")]])}});async function _L(t,e){let{wordWrap:r}=await Promise.resolve().then(()=>_m.__importStar((Em(),ne(Cm)))),{prompt:n}=await Promise.resolve().then(()=>_m.__importStar((cl(),ne(ul))));return Lt.logger.log({msg:`${_o.default.input("[?]")} ${r(t,{indentation:4})}`,logger:Lt.logger,format:!1}),n(e,{onCancel:()=>process.exit(1)})}Lt.logPrompt=_L;function xL(t){Lt.logger.msg(`${_o.default.success("[success]")} ${t}`)}Lt.logSuccess=xL});var ll=x(Li=>{"use strict";Object.defineProperty(Li,"__esModule",{value:!0});Li.resolveNode=Li.requireTS=void 0;var SL=require("fs"),FL=Pi(),AL=require("path"),OL=(t,e)=>{let r=(0,AL.resolve)(e);delete require.cache[r],require.extensions[".ts"]=(o,i)=>{var a;let s=(0,FL.readFileSync)(i,"utf8");i.endsWith(".ts")?s=t.transpileModule(s,{fileName:i,compilerOptions:{module:t.ModuleKind.CommonJS,moduleResolution:t.ModuleResolutionKind.NodeJs,esModuleInterop:!0,strict:!0,target:t.ScriptTarget.ES2017},reportDiagnostics:!0}).outputText:s=s.replace(/export\s+\w+\s+(\w+)/gm,"exports.$1"),(a=o._compile)===null||a===void 0||a.call(o,s,i)};let n=require(r);return delete require.extensions[".ts"],n};Li.requireTS=OL;function kL(t,...e){try{return require.resolve(e.join("/"),{paths:[t]})}catch{let n=[t,"node_modules",...e].join("/");return(0,SL.existsSync)(n)?n:null}}Li.resolveNode=kL});var Ix={};qr(Ix,{default:()=>$L});var $L,Rx=tt(()=>{$L={}});var Bx=x(Tr=>{"use strict";Object.defineProperty(Tr,"__esModule",{value:!0});Tr.buildXmlElement=Tr.writeXML=Tr.parseXML=Tr.readXML=void 0;var PL=(fe(),ne(le)),TL=Pi(),ms=PL.__importDefault((Rx(),ne(Ix)));async function IL(t){var e;try{let r=await(0,TL.readFile)(t,{encoding:"utf-8"});try{return await ms.default.parseStringPromise(r)}catch(n){throw`Error parsing: ${t}, ${(e=n.stack)!==null&&e!==void 0?e:n}`}}catch{throw`Unable to read: ${t}`}}Tr.readXML=IL;function RL(t,e){let r=e!==void 0?new ms.default.Parser({...e}):new ms.default.Parser,n;return r.parseString(t,(o,i)=>{o||(n=i)}),n}Tr.parseXML=RL;async function BL(t){return new Promise(e=>{let n=new ms.default.Builder({headless:!0,explicitRoot:!1,rootName:"deleteme"}).buildObject(t);n=n.replace("<deleteme>","").replace("</deleteme>",""),e(n)})}Tr.writeXML=BL;function jL(t,e){return new ms.default.Builder({headless:!0,explicitRoot:!1,rootName:e}).buildObject(t)}Tr.buildXmlElement=jL});var Mx=x(Ae=>{"use strict";Object.defineProperty(Ae,"__esModule",{value:!0});Ae.getAllElements=Ae.getFilePath=Ae.getAssets=Ae.getJSModules=Ae.getPluginType=Ae.getPlatformElement=Ae.getPluginPlatform=Ae.printPlugins=Ae.fixName=Ae.getDependencies=Ae.resolvePlugin=Ae.getPlugins=Ae.getIncludedPluginPackages=void 0;var NL=(fe(),ne(le)),LL=Pi(),xm=require("path"),Ui=NL.__importDefault(Ti()),UL=al(),ML=hs(),jx=ll(),qL=Bx();function Nx(t,e){var r,n,o,i;let{extConfig:a}=t.app;switch(e){case"android":return(n=(r=a.android)===null||r===void 0?void 0:r.includePlugins)!==null&&n!==void 0?n:a.includePlugins;case"ios":return(i=(o=a.ios)===null||o===void 0?void 0:o.includePlugins)!==null&&i!==void 0?i:a.includePlugins}}Ae.getIncludedPluginPackages=Nx;async function HL(t,e){var r;let n=(r=Nx(t,e))!==null&&r!==void 0?r:Ux(t);return(await Promise.all(n.map(async i=>Lx(t,i)))).filter(i=>!!i)}Ae.getPlugins=HL;async function Lx(t,e){try{let r=(0,jx.resolveNode)(t.app.rootDir,e,"package.json");r||(0,UL.fatal)(`Unable to find ${Ui.default.strong(`node_modules/${e}`)}.
65
+ Are you sure ${Ui.default.strong(e)} is installed?`);let n=(0,xm.dirname)(r),o=await(0,LL.readJSON)(r);if(!o)return null;if(o.capacitor)return{id:e,name:Sm(e),version:o.version,rootPath:n,repository:o.repository,manifest:o.capacitor};let i=(0,xm.join)(n,"plugin.xml"),a=await(0,qL.readXML)(i);return{id:e,name:Sm(e),version:o.version,rootPath:n,repository:o.repository,xml:a.plugin}}catch{}return null}Ae.resolvePlugin=Lx;function Ux(t){var e,r;return[...Object.keys((e=t.app.package.dependencies)!==null&&e!==void 0?e:{}),...Object.keys((r=t.app.package.devDependencies)!==null&&r!==void 0?r:{})]}Ae.getDependencies=Ux;function Sm(t){return t=t.replace(/\//g,"_").replace(/-/g,"_").replace(/@/g,"").replace(/_\w/g,e=>e[1].toUpperCase()),t.charAt(0).toUpperCase()+t.slice(1)}Ae.fixName=Sm;function VL(t,e,r="capacitor"){if(t.length===0)return;let n,o=t.length===1?"":"s";switch(r){case"cordova":n=`Found ${t.length} Cordova plugin${o} for ${Ui.default.strong(e)}:
66
+ `;break;case"incompatible":n=`Found ${t.length} incompatible Cordova plugin${o} for ${Ui.default.strong(e)}, skipped install:
67
+ `;break;case"capacitor":n=`Found ${t.length} Capacitor plugin${o} for ${Ui.default.strong(e)}:
68
+ `;break}n+=t.map(i=>`${i.id}${Ui.default.weak(`@${i.version}`)}`).join(`
69
+ `),ML.logger.info(n)}Ae.printPlugins=VL;function Fm(t,e){return t.xml.platform?t.xml.platform.filter(function(o){return o.$.name===e})[0]:[]}Ae.getPluginPlatform=Fm;function zL(t,e,r){let n=Fm(t,e);if(n){let o=n[r];if(o)return o}return[]}Ae.getPlatformElement=zL;function GL(t,e){var r,n,o,i;switch(e){case"ios":return(n=(r=t.ios)===null||r===void 0?void 0:r.type)!==null&&n!==void 0?n:0;case"android":return(i=(o=t.android)===null||o===void 0?void 0:o.type)!==null&&i!==void 0?i:0}return 0}Ae.getPluginType=GL;function WL(t,e){return Am(t,e,"js-module")}Ae.getJSModules=WL;function KL(t,e){return Am(t,e,"asset")}Ae.getAssets=KL;function YL(t,e,r){if(r.startsWith("node_modules")){let n=r.split("/").slice(1);n[0].startsWith("@")&&(n=[n[0]+"/"+n[1],...n.slice(2)]);let o=(0,jx.resolveNode)(t.app.rootDir,...n);if(!o)throw new Error(`Can't resolve module ${n[0]}`);return o}return(0,xm.join)(e.rootPath,r)}Ae.getFilePath=YL;function Am(t,e,r){let n=[];t.xml[r]&&(n=n.concat(t.xml[r]));let o=Fm(t,e);return o?.[r]&&(n=n.concat(o[r])),n}Ae.getAllElements=Am});var qx={};qr(qx,{default:()=>JL});var JL,Hx=tt(()=>{JL={}});var fl=x(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.isInstalled=An.getCommandOutput=An.runCommand=void 0;var Om=(Hx(),ne(qx));async function Vx(t,e,r={}){let n=new Om.Subprocess(t,e,r);try{return await n.output()}catch(o){throw o instanceof Om.SubprocessError?o.output?o.output:o.cause?`${o.message} ${o.cause.toString()}`:o.code?o.code:"Unknown error":o}}An.runCommand=Vx;async function XL(t,e,r={}){try{return(await Vx(t,e,r)).trim()}catch{return null}}An.getCommandOutput=XL;async function ZL(t){try{await(0,Om.which)(t)}catch{return!1}return!0}An.isInstalled=ZL});var zx={};qr(zx,{Comparator:()=>S4,Range:()=>_4,SemVer:()=>x4,clean:()=>r4,coerce:()=>E4,compare:()=>s4,diff:()=>QL,eq:()=>f4,gt:()=>c4,gte:()=>d4,gtr:()=>w4,inc:()=>n4,intersects:()=>C4,lt:()=>l4,lte:()=>h4,ltr:()=>v4,major:()=>o4,maxSatisfying:()=>g4,minSatisfying:()=>D4,minor:()=>i4,neq:()=>p4,outside:()=>b4,parse:()=>e4,patch:()=>a4,rcompare:()=>u4,satisfies:()=>m4,valid:()=>t4,validRange:()=>y4});var QL,e4,t4,r4,n4,o4,i4,a4,s4,u4,c4,l4,f4,p4,d4,h4,m4,g4,D4,y4,b4,w4,v4,C4,E4,_4,x4,S4,Gx=tt(()=>{QL=()=>null,e4=()=>null,t4=()=>null,r4=()=>null,n4=()=>null,o4=()=>null,i4=()=>null,a4=()=>null,s4=()=>0,u4=()=>0,c4=()=>!1,l4=()=>!1,f4=()=>!1,p4=()=>!0,d4=()=>!1,h4=()=>!1,m4=()=>!1,g4=()=>null,D4=()=>null,y4=()=>null,b4=()=>!1,w4=()=>!1,v4=()=>!1,C4=()=>!1,E4=()=>null,_4=class{},x4=class{},S4=class{}});var o1=x(Y=>{"use strict";Object.defineProperty(Y,"__esModule",{value:!0});Y.parseApkNameFromFlavor=Y.checkJDKMajorVersion=Y.resolvePlatform=Y.checkPlatformVersions=Y.getAddedPlatforms=Y.getPlatformTargetName=Y.promptForPlatformTarget=Y.promptForPlatform=Y.isValidEnterprisePlatform=Y.getKnownEnterprisePlatforms=Y.isValidCommunityPlatform=Y.getKnownCommunityPlatforms=Y.isValidPlatform=Y.getKnownPlatforms=Y.selectPlatforms=Y.getProjectPlatformDirectory=Y.getCLIVersion=Y.getCoreVersion=Y.getCapacitorPackageVersion=Y.requireCapacitorPackage=Y.getCapacitorPackage=Y.runTask=Y.runPlatformHook=Y.runHooks=Y.wait=Y.checkAppName=Y.checkAppId=Y.checkAppDir=Y.checkAppConfig=Y.checkCapacitorPlatform=Y.checkPackage=Y.checkWebDir=Y.check=void 0;var Ds=(fe(),ne(le)),Wx=bm(),On=Pi(),xo=require("path"),Oe=Ds.__importDefault(Ti()),Mi=al(),Yx=hs(),F4=Mx(),Kx=Qs(),gs=ll(),A4=fl();async function O4(t){let r=(await Promise.all(t.map(n=>n()))).filter(n=>n!=null);if(r.length>0)throw r.join(`
70
+ `)}Y.check=O4;async function k4(t){var e;return!((e=t.app.extConfig.server)===null||e===void 0)&&e.url?null:["",".","..","../","./"].includes(t.app.webDir)?`"${t.app.webDir}" is not a valid value for webDir`:await(0,On.pathExists)(t.app.webDirAbs)?await(0,On.pathExists)((0,xo.join)(t.app.webDirAbs,"index.html"))?null:`The web assets directory (${Oe.default.strong((0,Wx.prettyPath)(t.app.webDirAbs))}) must contain an ${Oe.default.strong("index.html")} file.
71
+ It will be the entry point for the web portion of the Capacitor app.`:`Could not find the web assets directory: ${Oe.default.strong((0,Wx.prettyPath)(t.app.webDirAbs))}.
72
+ Please create it and make sure it has an ${Oe.default.strong("index.html")} file. You can change the path of this directory in ${Oe.default.strong(t.app.extConfigName)} (${Oe.default.input("webDir")} option). You may need to compile the web assets for your app (typically ${Oe.default.input("npm run build")}). More info: ${Oe.default.strong("https://capacitorjs.com/docs/basics/workflow#sync-your-project")}`}Y.checkWebDir=k4;async function $4(){return await(0,On.pathExists)("package.json")||await(0,On.pathExists)("project.json")?null:`The Capacitor CLI needs to run at the root of an npm package or in a valid NX monorepo.
73
73
  Make sure you have a package.json or project.json file in the directory where you run the Capacitor CLI.
74
- More info: ${Ae.default.strong("https://docs.npmjs.com/cli/init")}`}Y.checkPackage=F4;async function A4(t,e){return await Am(t,e)?null:`Could not find the ${Ae.default.input(e)} platform.
75
- You must install it in your project first, e.g. w/ ${Ae.default.input(`npm install @capacitor/${e}`)}`}Y.checkCapacitorPlatform=A4;async function O4(t){if(!t.app.appId)return`Missing ${Ae.default.input("appId")} for new platform.
76
- Please add it in ${t.app.extConfigName} or run ${Ae.default.input("npx cap init")}.`;if(!t.app.appName)return`Missing ${Ae.default.input("appName")} for new platform.
77
- Please add it in ${t.app.extConfigName} or run ${Ae.default.input("npx cap init")}.`;let e=await Wx(t,t.app.appId);if(e)return e;let r=await Kx(t,t.app.appName);return r||null}Y.checkAppConfig=O4;async function k4(t,e){return/^\S*$/.test(e)?null:"Your app directory should not contain spaces"}Y.checkAppDir=k4;async function Wx(t,e){return e?/^[a-zA-Z][\w]*(?:\.[a-zA-Z][\w]*)+$/.test(e.toLowerCase())?null:`
74
+ More info: ${Oe.default.strong("https://docs.npmjs.com/cli/init")}`}Y.checkPackage=$4;async function P4(t,e){return await $m(t,e)?null:`Could not find the ${Oe.default.input(e)} platform.
75
+ You must install it in your project first, e.g. w/ ${Oe.default.input(`npm install @capacitor/${e}`)}`}Y.checkCapacitorPlatform=P4;async function T4(t){if(!t.app.appId)return`Missing ${Oe.default.input("appId")} for new platform.
76
+ Please add it in ${t.app.extConfigName} or run ${Oe.default.input("npx cap init")}.`;if(!t.app.appName)return`Missing ${Oe.default.input("appName")} for new platform.
77
+ Please add it in ${t.app.extConfigName} or run ${Oe.default.input("npx cap init")}.`;let e=await Jx(t,t.app.appId);if(e)return e;let r=await Xx(t,t.app.appName);return r||null}Y.checkAppConfig=T4;async function I4(t,e){return/^\S*$/.test(e)?null:"Your app directory should not contain spaces"}Y.checkAppDir=I4;async function Jx(t,e){return e?/^[a-zA-Z][\w]*(?:\.[a-zA-Z][\w]*)+$/.test(e.toLowerCase())?null:`
78
78
  Invalid App ID "${e}". Your App ID must meet the following requirements to be valid on both iOS and Android:
79
79
  - Must be in Java package form with no dashes (ex: com.example.app)
80
80
  - It must have at least two segments (one or more dots).
@@ -82,94 +82,96 @@ Please add it in ${t.app.extConfigName} or run ${Ae.default.input("npx cap init"
82
82
  - All characters must be alphanumeric or an underscore [a-zA-Z][a-zA-Z0-9]+.
83
83
 
84
84
  If you would like to skip validation, run "cap init" with the "--skip-appid-validation" flag.
85
- `:"Invalid App ID. App ID is required and cannot be blank."}Y.checkAppId=Wx;async function Kx(t,e){return e?.length?null:"Must provide an app name. For example: 'Spacebook'"}Y.checkAppName=Kx;async function $4(t){return new Promise(e=>setTimeout(e,t))}Y.wait=$4;async function P4(t,e,r,n){await Fm(t,e,r,n);let o=await(0,E4.getPlugins)(t,e);for(let i of o)await Fm(t,e,i.rootPath,n)}Y.runHooks=P4;async function Fm(t,e,r,n){var o;let{spawn:i}=await Promise.resolve().then(()=>hs.__importStar(require("child_process"))),a;(0,zx.isNXMonorepo)(r)?a=await(0,An.readJSON)((0,_o.join)((0,zx.findNXMonorepoRoot)(r),"package.json")):a=await(0,An.readJSON)((0,_o.join)(r,"package.json"));let s=(o=a.scripts)===null||o===void 0?void 0:o[n];if(s)return new Promise((u,c)=>{let l=i(s,{stdio:"inherit",shell:!0,cwd:r,env:{INIT_CWD:r,CAPACITOR_ROOT_DIR:t.app.rootDir,CAPACITOR_WEB_DIR:t.app.webDirAbs,CAPACITOR_CONFIG:JSON.stringify(t.app.extConfig),CAPACITOR_PLATFORM_NAME:e,...process.env}});l.on("close",f=>{f===0?u():c(new Error(`${n} hook on ${e} failed with error code: ${f} while running command: ${s}`))}),l.on("error",f=>{c(f)})})}Y.runPlatformHook=Fm;async function T4(t,e){let r=Gx.output.createTaskChain();r.next(t);try{let n=await e();return r.end(),n}catch(n){throw r.fail(),n}}Y.runTask=T4;async function Am(t,e){let r=(0,ds.resolveNode)(t.app.rootDir,`@capacitor/${e}`,"package.json");return r?(0,An.readJSON)(r):null}Y.getCapacitorPackage=Am;async function Yx(t,e){let r=await Am(t,e);return r||(0,Ni.fatal)(`Unable to find node_modules/@capacitor/${e}.
86
- Are you sure ${Ae.default.strong(`@capacitor/${e}`)} is installed?`),r}Y.requireCapacitorPackage=Yx;async function ll(t,e){return(await Yx(t,e)).version}Y.getCapacitorPackageVersion=ll;async function Jx(t){return ll(t,"core")}Y.getCoreVersion=Jx;async function I4(t){return ll(t,"cli")}Y.getCLIVersion=I4;function R4(t,e){switch(e){case"android":return t.android.platformDirAbs;case"ios":return t.ios.platformDirAbs;case"web":return t.web.platformDirAbs}return null}async function cl(t,e){let r=R4(t,e);return r&&await(0,An.pathExists)(r)?r:null}Y.getProjectPlatformDirectory=cl;async function B4(t,e){if(e){let r=e.toLowerCase().trim();return await km(r)?await cl(t,r)||(r==="web"&&(0,Ni.fatal)(`Could not find the web platform directory.
87
- Make sure ${Ae.default.strong(t.app.webDir)} exists.`),(0,Ni.fatal)(`${Ae.default.strong(r)} platform has not been added yet.
88
- See the docs for adding the ${Ae.default.strong(r)} platform: ${Ae.default.strong(`https://capacitorjs.com/docs/${r}#adding-the-${r}-platform`)}`)):(0,Ni.fatal)(`Invalid platform: ${Ae.default.input(r)}`),[r]}return e1(t)}Y.selectPlatforms=B4;async function Om(){return["web","android","ios"]}Y.getKnownPlatforms=Om;async function km(t){return(await Om()).includes(t)}Y.isValidPlatform=km;async function Xx(){return["electron"]}Y.getKnownCommunityPlatforms=Xx;async function j4(t){return(await Xx()).includes(t)}Y.isValidCommunityPlatform=j4;async function Zx(){return["windows"]}Y.getKnownEnterprisePlatforms=Zx;async function N4(t){return(await Zx()).includes(t)}Y.isValidEnterprisePlatform=N4;async function L4(t,e,r){let{prompt:n}=await Promise.resolve().then(()=>hs.__importStar((al(),re(il))));if(!r)return(await n([{type:"select",name:"mode",message:e,choices:t.map(a=>({title:a,value:a}))}],{onCancel:()=>process.exit(1)})).mode.toLowerCase().trim();let o=r.toLowerCase().trim();if(!await km(o)){let i=await Om();(0,Ni.fatal)(`Invalid platform: ${Ae.default.input(o)}.
89
- Valid platforms include: ${i.join(", ")}`)}return o}Y.promptForPlatform=L4;async function U4(t,e){let{prompt:r}=await Promise.resolve().then(()=>hs.__importStar((al(),re(il)))),n=t.filter(a=>a.id!==void 0);if(!e)return n.length===1?n[0]:(await r([{type:"select",name:"target",message:"Please choose a target device:",choices:n.map(s=>({title:`${Qx(s)} (${s.id})`,value:s}))}],{onCancel:()=>process.exit(1)})).target;let o=e.trim(),i=t.find(a=>a.id===o);return i||(0,Ni.fatal)(`Invalid target ID: ${Ae.default.input(o)}.
90
- Valid targets are: ${t.map(a=>a.id).join(", ")}`),i}Y.promptForPlatformTarget=U4;function Qx(t){var e,r,n;return`${(n=(r=(e=t.name)!==null&&e!==void 0?e:t.model)!==null&&r!==void 0?r:t.id)!==null&&n!==void 0?n:"?"}${t.virtual?` (${t.platform==="ios"?"simulator":"emulator"})`:""}`}Y.getPlatformTargetName=Qx;async function e1(t){let e=[];return await cl(t,t.android.name)&&e.push(t.android.name),await cl(t,t.ios.name)&&e.push(t.ios.name),e.push(t.web.name),e}Y.getAddedPlatforms=e1;async function M4(t,e){let r=await Promise.resolve().then(()=>hs.__importStar((Hx(),re(qx)))),n=await Jx(t),o=await ll(t,e);(r.diff(n,o)==="minor"||r.diff(n,o)==="major")&&Gx.logger.warn(`${Ae.default.strong("@capacitor/core")}${Ae.default.weak(`@${n}`)} version doesn't match ${Ae.default.strong(`@capacitor/${e}`)}${Ae.default.weak(`@${o}`)} version.
91
- Consider updating to a matching version, e.g. w/ ${Ae.default.input(`npm install @capacitor/core@${o}`)}`)}Y.checkPlatformVersions=M4;function q4(t,e){if(e[0]!=="@"){let n=(0,ds.resolveNode)(t.app.rootDir,`@capacitor/${e}`,"package.json");if(n)return(0,_o.dirname)(n);let o=(0,ds.resolveNode)(t.app.rootDir,`@capacitor-community/${e}`,"package.json");if(o)return(0,_o.dirname)(o);let i=(0,ds.resolveNode)(t.app.rootDir,`@ionic-enterprise/capacitor-${e}`,"package.json");if(i)return(0,_o.dirname)(i)}let r=(0,ds.resolveNode)(t.app.rootDir,e,"package.json");return r?(0,_o.dirname)(r):null}Y.resolvePlatform=q4;async function H4(){try{let t=await(0,_4.runCommand)("java",["--version"]),r=RegExp(/([0-9]+)\.?([0-9]*)\.?([0-9]*)/).exec(t);if(r===null)return-1;let n=parseInt(r[1]),o=parseInt(r[2]);return typeof n=="number"&&n!=1?n:typeof o=="number"&&n==1&&o<9?o:-1}catch{return-1}}Y.checkJDKMajorVersion=H4;function V4(t){let e=t.replace(/([A-Z])/g,"$1").toLowerCase();return`app-${e?`${e}-`:""}debug.apk`}Y.parseApkNameFromFlavor=V4});var r1=x(fl=>{"use strict";Object.defineProperty(fl,"__esModule",{value:!0});fl.tryFn=void 0;var z4=async(t,...e)=>{try{return await t(...e)}catch{}return null};fl.tryFn=z4});var n1=x(pl=>{"use strict";Object.defineProperty(pl,"__esModule",{value:!0});pl.formatJSObject=void 0;var G4=(fe(),re(le)),W4=G4.__importDefault(require("util"));function K4(t){try{t=JSON.parse(JSON.stringify(t))}catch(e){throw new Error(`Cannot parse object as JSON: ${e.stack?e.stack:e}`)}return W4.default.inspect(t,{compact:!1,breakLength:1/0,depth:1/0,maxArrayLength:1/0,maxStringLength:1/0})}pl.formatJSObject=K4});var o1=x(On=>{"use strict";Object.defineProperty(On,"__esModule",{value:!0});On.lazy=On.LazyPromise=On.allSerial=void 0;function Y4(t){return t.reduce((e,r)=>e.then(n=>r().then(o=>n.concat(o))),Promise.resolve([]))}On.allSerial=Y4;var dl=class extends Promise{constructor(e){super(()=>{}),this._executor=e}then(e,r){return this._promise=this._promise||new Promise(this._executor),this._promise.then(e,r)}catch(e){return this._promise=this._promise||new Promise(this._executor),this._promise.catch(e)}};On.LazyPromise=dl;function J4(t){return new dl(async(e,r)=>{try{e(await t())}catch(n){r(n)}})}On.lazy=J4});var u1=x(lt=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.writeConfig=lt.loadConfig=lt.CONFIG_FILE_NAME_JSON=lt.CONFIG_FILE_NAME_JS=lt.CONFIG_FILE_NAME_TS=void 0;var Pm=(fe(),re(le)),X4=Pm.__importDefault(Gh()),qt=Oi(),ae=require("path"),xo=Pm.__importDefault(ki()),Z4=t1(),hl=nl(),Q4=fs(),$m=r1(),e5=n1(),i1=Js(),a1=sl(),Li=o1(),t5=ul(),s1=(0,X4.default)("capacitor:config");lt.CONFIG_FILE_NAME_TS="capacitor.config.ts";lt.CONFIG_FILE_NAME_JS="capacitor.config.js";lt.CONFIG_FILE_NAME_JSON="capacitor.config.json";async function r5(){var t,e,r,n;let o=process.cwd(),i=(0,ae.dirname)(__dirname),a=await a5(o),s=await(async()=>{var h,m;if((0,i1.isNXMonorepo)(o)){let b=(0,i1.findNXMonorepoRoot)(o),D=await(0,$m.tryFn)(qt.readJSON,(0,ae.resolve)(b,"package.json")),C=(h=D?.devDependencies)!==null&&h!==void 0?h:{},E=(m=D?.dependencies)!==null&&m!==void 0?m:{};return{devDependencies:C,dependencies:E}}return{}})(),u=(t=a.extConfig.appId)!==null&&t!==void 0?t:"",c=(e=a.extConfig.appName)!==null&&e!==void 0?e:"",l=(r=a.extConfig.webDir)!==null&&r!==void 0?r:"www",f=await s5(i),d={android:await u5(o,a.extConfig,f),ios:await c5(o,a.extConfig),web:await l5(o,l),cli:f,app:{rootDir:o,appId:u,appName:c,webDir:l,webDirAbs:(0,ae.resolve)(o,l),package:(n=await(0,$m.tryFn)(qt.readJSON,(0,ae.resolve)(o,"package.json")))!==null&&n!==void 0?n:{name:c,version:"1.0.0",...s},...a}};return s1("config: %O",d),d}lt.loadConfig=r5;async function n5(t,e){switch((0,ae.extname)(e)){case".json":{await(0,qt.writeJSON)(e,t,{spaces:2});break}case".ts":{await(0,qt.writeFile)(e,g5(t));break}}}lt.writeConfig=n5;async function o5(t,e,r){var n;try{let o=(0,a1.resolveNode)(t,"typescript");o||(0,hl.fatal)(`Could not find installation of TypeScript.
92
- To use ${xo.default.strong(e)} files, you must install TypeScript in your project, e.g. w/ ${xo.default.input("npm install -D typescript")}`);let i=require(o),a=(0,a1.requireTS)(i,r),s=a.default?await a.default:a;return{extConfigType:"ts",extConfigName:e,extConfigFilePath:r,extConfig:s}}catch(o){throw(0,hl.isFatal)(o)||(0,hl.fatal)(`Parsing ${xo.default.strong(e)} failed.
85
+ `:"Invalid App ID. App ID is required and cannot be blank."}Y.checkAppId=Jx;async function Xx(t,e){return e?.length?null:"Must provide an app name. For example: 'Spacebook'"}Y.checkAppName=Xx;async function R4(t){return new Promise(e=>setTimeout(e,t))}Y.wait=R4;async function B4(t,e,r,n){await km(t,e,r,n);let o=await(0,F4.getPlugins)(t,e);for(let i of o)await km(t,e,i.rootPath,n)}Y.runHooks=B4;async function km(t,e,r,n){var o;let{spawn:i}=await Promise.resolve().then(()=>Ds.__importStar(require("child_process"))),a;(0,Kx.isNXMonorepo)(r)?a=await(0,On.readJSON)((0,xo.join)((0,Kx.findNXMonorepoRoot)(r),"package.json")):a=await(0,On.readJSON)((0,xo.join)(r,"package.json"));let s=(o=a.scripts)===null||o===void 0?void 0:o[n];if(s)return new Promise((u,c)=>{let l=i(s,{stdio:"inherit",shell:!0,cwd:r,env:{INIT_CWD:r,CAPACITOR_ROOT_DIR:t.app.rootDir,CAPACITOR_WEB_DIR:t.app.webDirAbs,CAPACITOR_CONFIG:JSON.stringify(t.app.extConfig),CAPACITOR_PLATFORM_NAME:e,...process.env}});l.on("close",p=>{p===0?u():c(new Error(`${n} hook on ${e} failed with error code: ${p} while running command: ${s}`))}),l.on("error",p=>{c(p)})})}Y.runPlatformHook=km;async function j4(t,e){let r=Yx.output.createTaskChain();r.next(t);try{let n=await e();return r.end(),n}catch(n){throw r.fail(),n}}Y.runTask=j4;async function $m(t,e){let r=(0,gs.resolveNode)(t.app.rootDir,`@capacitor/${e}`,"package.json");return r?(0,On.readJSON)(r):null}Y.getCapacitorPackage=$m;async function Zx(t,e){let r=await $m(t,e);return r||(0,Mi.fatal)(`Unable to find node_modules/@capacitor/${e}.
86
+ Are you sure ${Oe.default.strong(`@capacitor/${e}`)} is installed?`),r}Y.requireCapacitorPackage=Zx;async function dl(t,e){return(await Zx(t,e)).version}Y.getCapacitorPackageVersion=dl;async function Qx(t){return dl(t,"core")}Y.getCoreVersion=Qx;async function N4(t){return dl(t,"cli")}Y.getCLIVersion=N4;function L4(t,e){switch(e){case"android":return t.android.platformDirAbs;case"ios":return t.ios.platformDirAbs;case"web":return t.web.platformDirAbs}return null}async function pl(t,e){let r=L4(t,e);return r&&await(0,On.pathExists)(r)?r:null}Y.getProjectPlatformDirectory=pl;async function U4(t,e){if(e){let r=e.toLowerCase().trim();return await Tm(r)?await pl(t,r)||(r==="web"&&(0,Mi.fatal)(`Could not find the web platform directory.
87
+ Make sure ${Oe.default.strong(t.app.webDir)} exists.`),(0,Mi.fatal)(`${Oe.default.strong(r)} platform has not been added yet.
88
+ See the docs for adding the ${Oe.default.strong(r)} platform: ${Oe.default.strong(`https://capacitorjs.com/docs/${r}#adding-the-${r}-platform`)}`)):(0,Mi.fatal)(`Invalid platform: ${Oe.default.input(r)}`),[r]}return n1(t)}Y.selectPlatforms=U4;async function Pm(){return["web","android","ios"]}Y.getKnownPlatforms=Pm;async function Tm(t){return(await Pm()).includes(t)}Y.isValidPlatform=Tm;async function e1(){return["electron"]}Y.getKnownCommunityPlatforms=e1;async function M4(t){return(await e1()).includes(t)}Y.isValidCommunityPlatform=M4;async function t1(){return["windows"]}Y.getKnownEnterprisePlatforms=t1;async function q4(t){return(await t1()).includes(t)}Y.isValidEnterprisePlatform=q4;async function H4(t,e,r){let{prompt:n}=await Promise.resolve().then(()=>Ds.__importStar((cl(),ne(ul))));if(!r)return(await n([{type:"select",name:"mode",message:e,choices:t.map(a=>({title:a,value:a}))}],{onCancel:()=>process.exit(1)})).mode.toLowerCase().trim();let o=r.toLowerCase().trim();if(!await Tm(o)){let i=await Pm();(0,Mi.fatal)(`Invalid platform: ${Oe.default.input(o)}.
89
+ Valid platforms include: ${i.join(", ")}`)}return o}Y.promptForPlatform=H4;async function V4(t,e){let{prompt:r}=await Promise.resolve().then(()=>Ds.__importStar((cl(),ne(ul)))),n=t.filter(a=>a.id!==void 0);if(!e)return n.length===1?n[0]:(await r([{type:"select",name:"target",message:"Please choose a target device:",choices:n.map(s=>({title:`${r1(s)} (${s.id})`,value:s}))}],{onCancel:()=>process.exit(1)})).target;let o=e.trim(),i=t.find(a=>a.id===o);return i||(0,Mi.fatal)(`Invalid target ID: ${Oe.default.input(o)}.
90
+ Valid targets are: ${t.map(a=>a.id).join(", ")}`),i}Y.promptForPlatformTarget=V4;function r1(t){var e,r,n;return`${(n=(r=(e=t.name)!==null&&e!==void 0?e:t.model)!==null&&r!==void 0?r:t.id)!==null&&n!==void 0?n:"?"}${t.virtual?` (${t.platform==="ios"?"simulator":"emulator"})`:""}`}Y.getPlatformTargetName=r1;async function n1(t){let e=[];return await pl(t,t.android.name)&&e.push(t.android.name),await pl(t,t.ios.name)&&e.push(t.ios.name),e.push(t.web.name),e}Y.getAddedPlatforms=n1;async function z4(t,e){let r=await Promise.resolve().then(()=>Ds.__importStar((Gx(),ne(zx)))),n=await Qx(t),o=await dl(t,e);(r.diff(n,o)==="minor"||r.diff(n,o)==="major")&&Yx.logger.warn(`${Oe.default.strong("@capacitor/core")}${Oe.default.weak(`@${n}`)} version doesn't match ${Oe.default.strong(`@capacitor/${e}`)}${Oe.default.weak(`@${o}`)} version.
91
+ Consider updating to a matching version, e.g. w/ ${Oe.default.input(`npm install @capacitor/core@${o}`)}`)}Y.checkPlatformVersions=z4;function G4(t,e){if(e[0]!=="@"){let n=(0,gs.resolveNode)(t.app.rootDir,`@capacitor/${e}`,"package.json");if(n)return(0,xo.dirname)(n);let o=(0,gs.resolveNode)(t.app.rootDir,`@capacitor-community/${e}`,"package.json");if(o)return(0,xo.dirname)(o);let i=(0,gs.resolveNode)(t.app.rootDir,`@ionic-enterprise/capacitor-${e}`,"package.json");if(i)return(0,xo.dirname)(i)}let r=(0,gs.resolveNode)(t.app.rootDir,e,"package.json");return r?(0,xo.dirname)(r):null}Y.resolvePlatform=G4;async function W4(){try{let t=await(0,A4.runCommand)("java",["--version"]),r=RegExp(/([0-9]+)\.?([0-9]*)\.?([0-9]*)/).exec(t);if(r===null)return-1;let n=parseInt(r[1]),o=parseInt(r[2]);return typeof n=="number"&&n!=1?n:typeof o=="number"&&n==1&&o<9?o:-1}catch{return-1}}Y.checkJDKMajorVersion=W4;function K4(t){let e=t.replace(/([A-Z])/g,"$1").toLowerCase();return`app-${e?`${e}-`:""}debug.apk`}Y.parseApkNameFromFlavor=K4});var i1=x(hl=>{"use strict";Object.defineProperty(hl,"__esModule",{value:!0});hl.tryFn=void 0;var Y4=async(t,...e)=>{try{return await t(...e)}catch{}return null};hl.tryFn=Y4});var a1=x(ml=>{"use strict";Object.defineProperty(ml,"__esModule",{value:!0});ml.formatJSObject=void 0;var J4=(fe(),ne(le)),X4=J4.__importDefault(require("util"));function Z4(t){try{t=JSON.parse(JSON.stringify(t))}catch(e){throw new Error(`Cannot parse object as JSON: ${e.stack?e.stack:e}`)}return X4.default.inspect(t,{compact:!1,breakLength:1/0,depth:1/0,maxArrayLength:1/0,maxStringLength:1/0})}ml.formatJSObject=Z4});var s1=x(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.lazy=kn.LazyPromise=kn.allSerial=void 0;function Q4(t){return t.reduce((e,r)=>e.then(n=>r().then(o=>n.concat(o))),Promise.resolve([]))}kn.allSerial=Q4;var gl=class extends Promise{constructor(e){super(()=>{}),this._executor=e}then(e,r){return this._promise=this._promise||new Promise(this._executor),this._promise.then(e,r)}catch(e){return this._promise=this._promise||new Promise(this._executor),this._promise.catch(e)}};kn.LazyPromise=gl;function e5(t){return new gl(async(e,r)=>{try{e(await t())}catch(n){r(n)}})}kn.lazy=e5});var f1=x(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.writeConfig=ft.loadConfig=ft.CONFIG_FILE_NAME_JSON=ft.CONFIG_FILE_NAME_JS=ft.CONFIG_FILE_NAME_TS=void 0;var Rm=(fe(),ne(le)),t5=Rm.__importDefault(Yh()),Ut=Pi(),ae=require("path"),So=Rm.__importDefault(Ti()),r5=o1(),Dl=al(),n5=hs(),Im=i1(),o5=a1(),u1=Qs(),c1=ll(),qi=s1(),i5=fl(),l1=(0,t5.default)("capacitor:config");ft.CONFIG_FILE_NAME_TS="capacitor.config.ts";ft.CONFIG_FILE_NAME_JS="capacitor.config.js";ft.CONFIG_FILE_NAME_JSON="capacitor.config.json";async function a5(){var t,e,r,n;let o=process.cwd(),i=(0,ae.dirname)(__dirname),a=await l5(o),s=await(async()=>{var h,m;if((0,u1.isNXMonorepo)(o)){let b=(0,u1.findNXMonorepoRoot)(o),D=await(0,Im.tryFn)(Ut.readJSON,(0,ae.resolve)(b,"package.json")),C=(h=D?.devDependencies)!==null&&h!==void 0?h:{},E=(m=D?.dependencies)!==null&&m!==void 0?m:{};return{devDependencies:C,dependencies:E}}return{}})(),u=(t=a.extConfig.appId)!==null&&t!==void 0?t:"",c=(e=a.extConfig.appName)!==null&&e!==void 0?e:"",l=(r=a.extConfig.webDir)!==null&&r!==void 0?r:"www",p=await f5(i),d={android:await p5(o,a.extConfig,p),ios:await d5(o,a.extConfig),web:await h5(o,l),cli:p,app:{rootDir:o,appId:u,appName:c,webDir:l,webDirAbs:(0,ae.resolve)(o,l),package:(n=await(0,Im.tryFn)(Ut.readJSON,(0,ae.resolve)(o,"package.json")))!==null&&n!==void 0?n:{name:c,version:"1.0.0",...s},...a}};return l1("config: %O",d),d}ft.loadConfig=a5;async function s5(t,e){switch((0,ae.extname)(e)){case".json":{await(0,Ut.writeJSON)(e,t,{spaces:2});break}case".ts":{await(0,Ut.writeFile)(e,w5(t));break}}}ft.writeConfig=s5;async function u5(t,e,r){var n;try{let o=(0,c1.resolveNode)(t,"typescript");o||(0,Dl.fatal)(`Could not find installation of TypeScript.
92
+ To use ${So.default.strong(e)} files, you must install TypeScript in your project, e.g. w/ ${So.default.input("npm install -D typescript")}`);let i=require(o),a=(0,c1.requireTS)(i,r),s=a.default?await a.default:a;return{extConfigType:"ts",extConfigName:e,extConfigFilePath:r,extConfig:s}}catch(o){throw(0,Dl.isFatal)(o)||(0,Dl.fatal)(`Parsing ${So.default.strong(e)} failed.
93
93
 
94
- ${(n=o.stack)!==null&&n!==void 0?n:o}`),o}}async function i5(t,e,r){var n;try{return{extConfigType:"js",extConfigName:e,extConfigFilePath:r,extConfig:await require(r)}}catch(o){(0,hl.fatal)(`Parsing ${xo.default.strong(e)} failed.
94
+ ${(n=o.stack)!==null&&n!==void 0?n:o}`),o}}async function c5(t,e,r){var n;try{return{extConfigType:"js",extConfigName:e,extConfigFilePath:r,extConfig:await require(r)}}catch(o){(0,Dl.fatal)(`Parsing ${So.default.strong(e)} failed.
95
95
 
96
- ${(n=o.stack)!==null&&n!==void 0?n:o}`)}}async function a5(t){var e;let r=(0,ae.resolve)(t,lt.CONFIG_FILE_NAME_TS);if(await(0,qt.pathExists)(r))return o5(t,lt.CONFIG_FILE_NAME_TS,r);let n=(0,ae.resolve)(t,lt.CONFIG_FILE_NAME_JS);if(await(0,qt.pathExists)(n))return i5(t,lt.CONFIG_FILE_NAME_JS,n);let o=(0,ae.resolve)(t,lt.CONFIG_FILE_NAME_JSON);return{extConfigType:"json",extConfigName:lt.CONFIG_FILE_NAME_JSON,extConfigFilePath:o,extConfig:(e=await(0,$m.tryFn)(qt.readJSON,o))!==null&&e!==void 0?e:{}}}async function s5(t){let e="assets",r=(0,ae.join)(t,e),n="ios-pods-template.tar.gz",o="capacitor-cordova-ios-plugins.tar.gz",i="android-template.tar.gz",a="capacitor-cordova-android-plugins.tar.gz";return{rootDir:t,assetsDir:e,assetsDirAbs:r,assets:{ios:{platformTemplateArchive:n,platformTemplateArchiveAbs:(0,ae.resolve)(r,n),cordovaPluginsTemplateArchive:o,cordovaPluginsTemplateArchiveAbs:(0,ae.resolve)(r,o)},android:{platformTemplateArchive:i,platformTemplateArchiveAbs:(0,ae.resolve)(r,i),cordovaPluginsTemplateArchive:a,cordovaPluginsTemplateArchiveAbs:(0,ae.resolve)(r,a)}},package:await(0,qt.readJSON)((0,ae.resolve)(t,"package.json")),os:f5(process.platform)}}async function u5(t,e,r){var n,o,i,a,s,u,c,l,f,d,h,m,b,D,C,E,g;let _="android",S=(o=(n=e.android)===null||n===void 0?void 0:n.path)!==null&&o!==void 0?o:"android",I=(0,ae.resolve)(t,S),O="app",B=`${O}/src`,R=`${B}/main`,N=`${R}/assets`,A=`${N}/public`,L=`${R}/res`,q=`${O}/build/outputs/apk/`,Q=((i=e.android)===null||i===void 0?void 0:i.flavor)||"";!((a=e.android)===null||a===void 0)&&a.flavor&&(q=`${q}/${(s=e.android)===null||s===void 0?void 0:s.flavor}`);let $=(0,Z4.parseApkNameFromFlavor)(Q),y=`${q}/debug`,v="capacitor-cordova-android-plugins",w=(0,Li.lazy)(()=>h5(r.os)),F={keystorePath:(c=(u=e.android)===null||u===void 0?void 0:u.buildOptions)===null||c===void 0?void 0:c.keystorePath,keystorePassword:(f=(l=e.android)===null||l===void 0?void 0:l.buildOptions)===null||f===void 0?void 0:f.keystorePassword,keystoreAlias:(h=(d=e.android)===null||d===void 0?void 0:d.buildOptions)===null||h===void 0?void 0:h.keystoreAlias,keystoreAliasPassword:(b=(m=e.android)===null||m===void 0?void 0:m.buildOptions)===null||b===void 0?void 0:b.keystoreAliasPassword,signingType:(C=(D=e.android)===null||D===void 0?void 0:D.buildOptions)===null||C===void 0?void 0:C.signingType,releaseType:(g=(E=e.android)===null||E===void 0?void 0:E.buildOptions)===null||g===void 0?void 0:g.releaseType};return{name:_,minVersion:"23",studioPath:w,platformDir:S,platformDirAbs:I,cordovaPluginsDir:v,cordovaPluginsDirAbs:(0,ae.resolve)(I,v),appDir:O,appDirAbs:(0,ae.resolve)(I,O),srcDir:B,srcDirAbs:(0,ae.resolve)(I,B),srcMainDir:R,srcMainDirAbs:(0,ae.resolve)(I,R),assetsDir:N,assetsDirAbs:(0,ae.resolve)(I,N),webDir:A,webDirAbs:(0,ae.resolve)(I,A),resDir:L,resDirAbs:(0,ae.resolve)(I,L),apkName:$,buildOutputDir:y,buildOutputDirAbs:(0,ae.resolve)(I,y),flavor:Q,buildOptions:F}}async function c5(t,e){var r,n,o,i,a,s,u,c,l,f,d,h;let b=(n=(r=e.ios)===null||r===void 0?void 0:r.path)!==null&&n!==void 0?n:"ios",D=(0,ae.resolve)(t,b),C=(i=(o=e.ios)===null||o===void 0?void 0:o.scheme)!==null&&i!==void 0?i:"App",E="App",g=(0,ae.resolve)(D,E),_=`${E}/App`,S=(0,ae.resolve)(D,_),I=`${E}/App.xcodeproj`,O=(0,ae.resolve)(D,I),B=(0,Li.lazy)(()=>p5(g)),R=(0,Li.lazy)(()=>m5(t,D,g)),N=(0,Li.lazy)(()=>d5(g,S,O)),A="capacitor-cordova-ios-plugins",L={exportMethod:(s=(a=e.ios)===null||a===void 0?void 0:a.buildOptions)===null||s===void 0?void 0:s.exportMethod,xcodeSigningStyle:(c=(u=e.ios)===null||u===void 0?void 0:u.buildOptions)===null||c===void 0?void 0:c.signingStyle,signingCertificate:(f=(l=e.ios)===null||l===void 0?void 0:l.buildOptions)===null||f===void 0?void 0:f.signingCertificate,provisioningProfile:(h=(d=e.ios)===null||d===void 0?void 0:d.buildOptions)===null||h===void 0?void 0:h.provisioningProfile};return{name:"ios",minVersion:"14.0",platformDir:b,platformDirAbs:D,scheme:C,cordovaPluginsDir:A,cordovaPluginsDirAbs:(0,ae.resolve)(D,A),nativeProjectDir:E,nativeProjectDirAbs:g,nativeTargetDir:_,nativeTargetDirAbs:S,nativeXcodeProjDir:I,nativeXcodeProjDirAbs:O,nativeXcodeWorkspaceDir:(0,Li.lazy)(async()=>(0,ae.relative)(D,await B)),nativeXcodeWorkspaceDirAbs:B,webDir:(0,Li.lazy)(async()=>(0,ae.relative)(D,await N)),webDirAbs:N,podPath:R,buildOptions:L}}async function l5(t,e){let r=e,n=(0,ae.resolve)(t,r);return{name:"web",platformDir:r,platformDirAbs:n}}function f5(t){switch(t){case"darwin":return"mac";case"win32":return"windows";case"linux":return"linux"}return"unknown"}async function p5(t){return(0,ae.resolve)(t,"App.xcworkspace")}async function d5(t,e,r){let n=/path\s=\spublic[\s\S]+?sourceTree\s=\s([^;]+)/,o=(0,ae.resolve)(r,"project.pbxproj");try{let a=(await(0,qt.readFile)(o,{encoding:"utf8"})).match(n);if(a&&a[1]==="SOURCE_ROOT")return Q4.logger.warn(`Using the iOS project root for the ${xo.default.strong("public")} directory is deprecated.
97
- Please follow the Upgrade Guide to move ${xo.default.strong("public")} inside the iOS target directory: ${xo.default.strong("https://capacitorjs.com/docs/updating/3-0#move-public-into-the-ios-target-directory")}`),(0,ae.resolve)(t,"public")}catch{}return(0,ae.resolve)(e,"public")}async function h5(t){if(process.env.CAPACITOR_ANDROID_STUDIO_PATH)return process.env.CAPACITOR_ANDROID_STUDIO_PATH;switch(t){case"mac":return"/Applications/Android Studio.app";case"windows":{let{runCommand:e}=await Promise.resolve().then(()=>Pm.__importStar(ul())),r="C:\\Program Files\\Android\\Android Studio\\bin\\studio64.exe";try{if(!await(0,qt.pathExists)(r)){let n=await e("REG",["QUERY","HKEY_LOCAL_MACHINE\\SOFTWARE\\Android Studio","/v","Path"]);n=n.replace(/(\r\n|\n|\r)/gm,"");let o=n.indexOf("REG_SZ");o>0&&(r=n.substring(o+6).trim()+"\\bin\\studio64.exe")}}catch(n){s1("Error checking registry for Android Studio path: %O",n);break}return r}case"linux":return"/usr/local/android-studio/bin/studio.sh"}return""}async function m5(t,e,r){if(process.env.CAPACITOR_COCOAPODS_PATH)return process.env.CAPACITOR_COCOAPODS_PATH;let n="";if(await(0,qt.pathExists)((0,ae.resolve)(t,"Gemfile"))?n=(0,ae.resolve)(t,"Gemfile"):await(0,qt.pathExists)((0,ae.resolve)(e,"Gemfile"))?n=(0,ae.resolve)(e,"Gemfile"):await(0,qt.pathExists)((0,ae.resolve)(r,"Gemfile"))&&(n=(0,ae.resolve)(r,"Gemfile")),!(n!=""))try{let i=await(0,t5.getCommandOutput)("git",["rev-parse","--show-toplevel"],{cwd:t});i!=null&&(n=(0,ae.resolve)(i,"Gemfile"))}catch{}try{let i=(await(0,qt.readFile)(n)).toString();return i&&new RegExp(/gem\s+['"]cocoapods/).test(i)?"bundle exec pod":"pod"}catch{return"pod"}}function g5(t){return`import type { CapacitorConfig } from '@capacitor/cli';
96
+ ${(n=o.stack)!==null&&n!==void 0?n:o}`)}}async function l5(t){var e;let r=(0,ae.resolve)(t,ft.CONFIG_FILE_NAME_TS);if(await(0,Ut.pathExists)(r))return u5(t,ft.CONFIG_FILE_NAME_TS,r);let n=(0,ae.resolve)(t,ft.CONFIG_FILE_NAME_JS);if(await(0,Ut.pathExists)(n))return c5(t,ft.CONFIG_FILE_NAME_JS,n);let o=(0,ae.resolve)(t,ft.CONFIG_FILE_NAME_JSON);return{extConfigType:"json",extConfigName:ft.CONFIG_FILE_NAME_JSON,extConfigFilePath:o,extConfig:(e=await(0,Im.tryFn)(Ut.readJSON,o))!==null&&e!==void 0?e:{}}}async function f5(t){let e="assets",r=(0,ae.join)(t,e),n="ios-pods-template.tar.gz",o="capacitor-cordova-ios-plugins.tar.gz",i="android-template.tar.gz",a="capacitor-cordova-android-plugins.tar.gz";return{rootDir:t,assetsDir:e,assetsDirAbs:r,assets:{ios:{platformTemplateArchive:n,platformTemplateArchiveAbs:(0,ae.resolve)(r,n),cordovaPluginsTemplateArchive:o,cordovaPluginsTemplateArchiveAbs:(0,ae.resolve)(r,o)},android:{platformTemplateArchive:i,platformTemplateArchiveAbs:(0,ae.resolve)(r,i),cordovaPluginsTemplateArchive:a,cordovaPluginsTemplateArchiveAbs:(0,ae.resolve)(r,a)}},package:await(0,Ut.readJSON)((0,ae.resolve)(t,"package.json")),os:m5(process.platform)}}async function p5(t,e,r){var n,o,i,a,s,u,c,l,p,d,h,m,b,D,C,E,g;let _="android",S=(o=(n=e.android)===null||n===void 0?void 0:n.path)!==null&&o!==void 0?o:"android",$=(0,ae.resolve)(t,S),k="app",B=`${k}/src`,R=`${B}/main`,N=`${R}/assets`,A=`${N}/public`,U=`${R}/res`,M=`${k}/build/outputs/apk/`,Q=((i=e.android)===null||i===void 0?void 0:i.flavor)||"";!((a=e.android)===null||a===void 0)&&a.flavor&&(M=`${M}/${(s=e.android)===null||s===void 0?void 0:s.flavor}`);let P=(0,r5.parseApkNameFromFlavor)(Q),y=`${M}/debug`,w="capacitor-cordova-android-plugins",v=(0,qi.lazy)(()=>y5(r.os)),F={keystorePath:(c=(u=e.android)===null||u===void 0?void 0:u.buildOptions)===null||c===void 0?void 0:c.keystorePath,keystorePassword:(p=(l=e.android)===null||l===void 0?void 0:l.buildOptions)===null||p===void 0?void 0:p.keystorePassword,keystoreAlias:(h=(d=e.android)===null||d===void 0?void 0:d.buildOptions)===null||h===void 0?void 0:h.keystoreAlias,keystoreAliasPassword:(b=(m=e.android)===null||m===void 0?void 0:m.buildOptions)===null||b===void 0?void 0:b.keystoreAliasPassword,signingType:(C=(D=e.android)===null||D===void 0?void 0:D.buildOptions)===null||C===void 0?void 0:C.signingType,releaseType:(g=(E=e.android)===null||E===void 0?void 0:E.buildOptions)===null||g===void 0?void 0:g.releaseType};return{name:_,minVersion:"23",studioPath:v,platformDir:S,platformDirAbs:$,cordovaPluginsDir:w,cordovaPluginsDirAbs:(0,ae.resolve)($,w),appDir:k,appDirAbs:(0,ae.resolve)($,k),srcDir:B,srcDirAbs:(0,ae.resolve)($,B),srcMainDir:R,srcMainDirAbs:(0,ae.resolve)($,R),assetsDir:N,assetsDirAbs:(0,ae.resolve)($,N),webDir:A,webDirAbs:(0,ae.resolve)($,A),resDir:U,resDirAbs:(0,ae.resolve)($,U),apkName:P,buildOutputDir:y,buildOutputDirAbs:(0,ae.resolve)($,y),flavor:Q,buildOptions:F}}async function d5(t,e){var r,n,o,i,a,s,u,c,l,p,d,h;let b=(n=(r=e.ios)===null||r===void 0?void 0:r.path)!==null&&n!==void 0?n:"ios",D=(0,ae.resolve)(t,b),C=(i=(o=e.ios)===null||o===void 0?void 0:o.scheme)!==null&&i!==void 0?i:"App",E="App",g=(0,ae.resolve)(D,E),_=`${E}/App`,S=(0,ae.resolve)(D,_),$=`${E}/App.xcodeproj`,k=(0,ae.resolve)(D,$),B=(0,qi.lazy)(()=>g5(g)),R=(0,qi.lazy)(()=>b5(t,D,g)),N=(0,qi.lazy)(()=>D5(g,S,k)),A="capacitor-cordova-ios-plugins",U={exportMethod:(s=(a=e.ios)===null||a===void 0?void 0:a.buildOptions)===null||s===void 0?void 0:s.exportMethod,xcodeSigningStyle:(c=(u=e.ios)===null||u===void 0?void 0:u.buildOptions)===null||c===void 0?void 0:c.signingStyle,signingCertificate:(p=(l=e.ios)===null||l===void 0?void 0:l.buildOptions)===null||p===void 0?void 0:p.signingCertificate,provisioningProfile:(h=(d=e.ios)===null||d===void 0?void 0:d.buildOptions)===null||h===void 0?void 0:h.provisioningProfile};return{name:"ios",minVersion:"14.0",platformDir:b,platformDirAbs:D,scheme:C,cordovaPluginsDir:A,cordovaPluginsDirAbs:(0,ae.resolve)(D,A),nativeProjectDir:E,nativeProjectDirAbs:g,nativeTargetDir:_,nativeTargetDirAbs:S,nativeXcodeProjDir:$,nativeXcodeProjDirAbs:k,nativeXcodeWorkspaceDir:(0,qi.lazy)(async()=>(0,ae.relative)(D,await B)),nativeXcodeWorkspaceDirAbs:B,webDir:(0,qi.lazy)(async()=>(0,ae.relative)(D,await N)),webDirAbs:N,podPath:R,buildOptions:U}}async function h5(t,e){let r=e,n=(0,ae.resolve)(t,r);return{name:"web",platformDir:r,platformDirAbs:n}}function m5(t){switch(t){case"darwin":return"mac";case"win32":return"windows";case"linux":return"linux"}return"unknown"}async function g5(t){return(0,ae.resolve)(t,"App.xcworkspace")}async function D5(t,e,r){let n=/path\s=\spublic[\s\S]+?sourceTree\s=\s([^;]+)/,o=(0,ae.resolve)(r,"project.pbxproj");try{let a=(await(0,Ut.readFile)(o,{encoding:"utf8"})).match(n);if(a&&a[1]==="SOURCE_ROOT")return n5.logger.warn(`Using the iOS project root for the ${So.default.strong("public")} directory is deprecated.
97
+ Please follow the Upgrade Guide to move ${So.default.strong("public")} inside the iOS target directory: ${So.default.strong("https://capacitorjs.com/docs/updating/3-0#move-public-into-the-ios-target-directory")}`),(0,ae.resolve)(t,"public")}catch{}return(0,ae.resolve)(e,"public")}async function y5(t){if(process.env.CAPACITOR_ANDROID_STUDIO_PATH)return process.env.CAPACITOR_ANDROID_STUDIO_PATH;switch(t){case"mac":return"/Applications/Android Studio.app";case"windows":{let{runCommand:e}=await Promise.resolve().then(()=>Rm.__importStar(fl())),r="C:\\Program Files\\Android\\Android Studio\\bin\\studio64.exe";try{if(!await(0,Ut.pathExists)(r)){let n=await e("REG",["QUERY","HKEY_LOCAL_MACHINE\\SOFTWARE\\Android Studio","/v","Path"]);n=n.replace(/(\r\n|\n|\r)/gm,"");let o=n.indexOf("REG_SZ");o>0&&(r=n.substring(o+6).trim()+"\\bin\\studio64.exe")}}catch(n){l1("Error checking registry for Android Studio path: %O",n);break}return r}case"linux":return"/usr/local/android-studio/bin/studio.sh"}return""}async function b5(t,e,r){if(process.env.CAPACITOR_COCOAPODS_PATH)return process.env.CAPACITOR_COCOAPODS_PATH;let n="";if(await(0,Ut.pathExists)((0,ae.resolve)(t,"Gemfile"))?n=(0,ae.resolve)(t,"Gemfile"):await(0,Ut.pathExists)((0,ae.resolve)(e,"Gemfile"))?n=(0,ae.resolve)(e,"Gemfile"):await(0,Ut.pathExists)((0,ae.resolve)(r,"Gemfile"))&&(n=(0,ae.resolve)(r,"Gemfile")),!(n!=""))try{let i=await(0,i5.getCommandOutput)("git",["rev-parse","--show-toplevel"],{cwd:t});i!=null&&(n=(0,ae.resolve)(i,"Gemfile"))}catch{}try{let i=(await(0,Ut.readFile)(n)).toString();return i&&new RegExp(/gem\s+['"]cocoapods/).test(i)?"bundle exec pod":"pod"}catch{return"pod"}}function w5(t){return`import type { CapacitorConfig } from '@capacitor/cli';
98
98
 
99
- const config: CapacitorConfig = ${(0,e5.formatJSObject)(t)};
99
+ const config: CapacitorConfig = ${(0,o5.formatJSObject)(t)};
100
100
 
101
101
  export default config;
102
- `}});function D5(){try{return Rm.default.statSync("/.dockerenv"),!0}catch{return!1}}function y5(){try{return Rm.default.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function Bm(){return Im===void 0&&(Im=D5()||y5()),Im}var Rm,Im,l1=tt(()=>{Rm=ge(require("node:fs"),1)});function Mi(){return jm===void 0&&(jm=b5()||Bm()),jm}var f1,jm,b5,Nm=tt(()=>{f1=ge(require("node:fs"),1);l1();b5=()=>{try{return f1.default.statSync("/run/.containerenv"),!0}catch{return!1}}});var Lm,d1,h1,p1,kn,Um=tt(()=>{Lm=ge(require("node:process"),1),d1=ge(require("node:os"),1),h1=ge(require("node:fs"),1);Nm();p1=()=>{if(Lm.default.platform!=="linux")return!1;if(d1.default.release().toLowerCase().includes("microsoft"))return!Mi();try{return h1.default.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!Mi():!1}catch{return!1}},kn=Lm.default.env.__IS_WSL_TEST__?p1:p1()});var Mm,gs,v5,w5,qm,m1=tt(()=>{Mm=ge(require("node:process"),1),gs=ge(require("node:fs/promises"),1);Um();Um();v5=(()=>{let t="/mnt/",e;return async function(){if(e)return e;let r="/etc/wsl.conf",n=!1;try{await gs.default.access(r,gs.constants.F_OK),n=!0}catch{}if(!n)return t;let o=await gs.default.readFile(r,{encoding:"utf8"}),i=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(o);return i?(e=i.groups.mountPoint.trim(),e=e.endsWith("/")?e:`${e}/`,e):t}})(),w5=async()=>`${await v5()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,qm=async()=>kn?w5():`${Mm.default.env.SYSTEMROOT||Mm.default.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`});function $n(t,e,r){let n=o=>Object.defineProperty(t,e,{value:o,enumerable:!0,writable:!0});return Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get(){let o=r();return n(o),o},set(o){n(o)}}),t}var g1=tt(()=>{});async function Hm(){if(y1.default.platform!=="darwin")throw new Error("macOS only");let{stdout:t}=await C5("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]);return/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(t)?.groups.id??"com.apple.Safari"}var D1,y1,b1,C5,v1=tt(()=>{D1=require("node:util"),y1=ge(require("node:process"),1),b1=require("node:child_process"),C5=(0,D1.promisify)(b1.execFile)});async function E1(t,{humanReadableOutput:e=!0,signal:r}={}){if(w1.default.platform!=="darwin")throw new Error("macOS only");let n=e?[]:["-ss"],o={};r&&(o.signal=r);let{stdout:i}=await E5("osascript",["-e",t,n],o);return i.trim()}var w1,C1,Vm,E5,_1=tt(()=>{w1=ge(require("node:process"),1),C1=require("node:util"),Vm=require("node:child_process"),E5=(0,C1.promisify)(Vm.execFile)});async function zm(t){return E1(`tell application "Finder" to set app_path to application file id "${t}" as string
103
- tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}var x1=tt(()=>{_1()});async function Gm(t=_5){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 ml(`Cannot find Windows browser in stdout: ${JSON.stringify(e)}`);let{id:n}=r.groups,o=x5[n];if(!o)throw new ml(`Unknown browser ID: ${n}`);return o}var S1,F1,_5,x5,ml,A1=tt(()=>{S1=require("node:util"),F1=require("node:child_process"),_5=(0,S1.promisify)(F1.execFile),x5={AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},MSEdgeDHTML:{name:"Edge",id:"com.microsoft.edge"},MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"}},ml=class extends Error{}});async function Wm(){if(gl.default.platform==="darwin"){let t=await Hm();return{name:await zm(t),id:t}}if(gl.default.platform==="linux"){let{stdout:t}=await S5("xdg-mime",["query","default","x-scheme-handler/http"]),e=t.trim();return{name:F5(e.replace(/.desktop$/,"").replace("-"," ")),id:e}}if(gl.default.platform==="win32")return Gm();throw new Error("Only macOS, Linux, and Windows are supported")}var O1,gl,k1,S5,F5,$1=tt(()=>{O1=require("node:util"),gl=ge(require("node:process"),1),k1=require("node:child_process");v1();x1();A1();S5=(0,O1.promisify)(k1.execFile),F5=t=>t.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase())});var Qm={};qr(Qm,{apps:()=>Pn,default:()=>P5,openApp:()=>$5});async function O5(){let t=await qm(),e=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,r=Jm.Buffer.from(e,"utf16le").toString("base64"),{stdout:n}=await A5(t,["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand",r],{encoding:"utf8"}),o=n.trim(),i={ChromeHTML:"com.google.chrome",BraveHTML:"com.brave.Browser",MSEdgeHTM:"com.microsoft.edge",FirefoxURL:"org.mozilla.firefox"};return i[o]?{id:i[o]}:{}}function R1(t){if(typeof t=="string"||Array.isArray(t))return t;let{[T1]:e}=t;if(!e)throw new Error(`${T1} is not supported`);return e}function yl({[qi]:t},{wsl:e}){if(e&&kn)return R1(e);if(!t)throw new Error(`${qi} is not supported`);return R1(t)}var Ym,Jm,Xm,B1,j1,Zm,Dl,T5,A5,Km,P1,qi,T1,I1,Ds,k5,$5,Pn,P5,eg=tt(()=>{Ym=ge(require("node:process"),1),Jm=require("node:buffer"),Xm=ge(require("node:path"),1),B1=require("node:url"),j1=require("node:util"),Zm=ge(require("node:child_process"),1),Dl=ge(require("node:fs/promises"),1);m1();g1();$1();Nm();T5={},A5=(0,j1.promisify)(Zm.default.execFile),Km=Xm.default.dirname((0,B1.fileURLToPath)(T5.url)),P1=Xm.default.join(Km,"xdg-open"),{platform:qi,arch:T1}=Ym.default;I1=async(t,e)=>{let r;for(let n of t)try{return await e(n)}catch(o){r=o}throw r},Ds=async t=>{if(t={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...t},Array.isArray(t.app))return I1(t.app,s=>Ds({...t,app:s}));let{name:e,arguments:r=[]}=t.app??{};if(r=[...r],Array.isArray(e))return I1(e,s=>Ds({...t,app:{name:s,arguments:r}}));if(e==="browser"||e==="browserPrivate"){let s={"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"},u={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},c=kn?await O5():await Wm();if(c.id in s){let l=s[c.id];return e==="browserPrivate"&&r.push(u[l]),Ds({...t,app:{name:Pn[l],arguments:r}})}throw new Error(`${c.name} is not supported as a default browser`)}let n,o=[],i={};if(qi==="darwin")n="open",t.wait&&o.push("--wait-apps"),t.background&&o.push("--background"),t.newInstance&&o.push("--new"),e&&o.push("-a",e);else if(qi==="win32"||kn&&!Mi()&&!e){n=await qm(),o.push("-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"),kn||(i.windowsVerbatimArguments=!0);let s=["Start"];t.wait&&s.push("-Wait"),e?(s.push(`"\`"${e}\`""`),t.target&&r.push(t.target)):t.target&&s.push(`"${t.target}"`),r.length>0&&(r=r.map(u=>`"\`"${u}\`""`),s.push("-ArgumentList",r.join(","))),t.target=Jm.Buffer.from(s.join(" "),"utf16le").toString("base64")}else{if(e)n=e;else{let s=!Km||Km==="/",u=!1;try{await Dl.default.access(P1,Dl.constants.X_OK),u=!0}catch{}n=Ym.default.versions.electron??(qi==="android"||s||!u)?"xdg-open":P1}r.length>0&&o.push(...r),t.wait||(i.stdio="ignore",i.detached=!0)}qi==="darwin"&&r.length>0&&o.push("--args",...r),t.target&&o.push(t.target);let a=Zm.default.spawn(n,o,i);return t.wait?new Promise((s,u)=>{a.once("error",u),a.once("close",c=>{if(!t.allowNonzeroExitCode&&c>0){u(new Error(`Exited with code ${c}`));return}s(a)})}):(a.unref(),a)},k5=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a `target`");return Ds({...e,target:t})},$5=(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 Ds({...e,app:{name:t,arguments:r}})};Pn={};$n(Pn,"chrome",()=>yl({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium"]},{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"]}}));$n(Pn,"brave",()=>yl({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"]}}));$n(Pn,"firefox",()=>yl({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));$n(Pn,"edge",()=>yl({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));$n(Pn,"browser",()=>"browser");$n(Pn,"browserPrivate",()=>"browserPrivate");P5=k5});var Ml=x(fr=>{"use strict";fr.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;fr.find=(t,e)=>t.nodes.find(r=>r.type===e);fr.exceedsLimit=(t,e,r=1,n)=>n===!1||!fr.isInteger(t)||!fr.isInteger(e)?!1:(Number(e)-Number(t))/Number(r)>=n;fr.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)};fr.encloseBrace=t=>t.type!=="brace"?!1:t.commas>>0+t.ranges>>0===0?(t.invalid=!0,!0):!1;fr.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;fr.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;fr.reduce=t=>t.reduce((e,r)=>(r.type==="text"&&e.push(r.value),r.type==="range"&&(r.type="text"),e),[]);fr.flatten=(...t)=>{let e=[],r=n=>{for(let o=0;o<n.length;o++){let i=n[o];if(Array.isArray(i)){r(i);continue}i!==void 0&&e.push(i)}return e};return r(t),e}});var ql=x((kY,J2)=>{"use strict";var Y2=Ml();J2.exports=(t,e={})=>{let r=(n,o={})=>{let i=e.escapeInvalid&&Y2.isInvalidBrace(o),a=n.invalid===!0&&e.escapeInvalid===!0,s="";if(n.value)return(i||a)&&Y2.isOpenOrClose(n)?"\\"+n.value:n.value;if(n.value)return n.value;if(n.nodes)for(let u of n.nodes)s+=r(u);return s};return r(t)}});var Z2=x(($Y,X2)=>{"use strict";X2.exports=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}});var sS=x((PY,aS)=>{"use strict";var Q2=Z2(),Po=(t,e,r)=>{if(Q2(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(Q2(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 o=String(n.relaxZeros),i=String(n.shorthand),a=String(n.capture),s=String(n.wrap),u=t+":"+e+"="+o+i+a+s;if(Po.cache.hasOwnProperty(u))return Po.cache[u].result;let c=Math.min(t,e),l=Math.max(t,e);if(Math.abs(c-l)===1){let b=t+"|"+e;return n.capture?`(${b})`:n.wrap===!1?b:`(?:${b})`}let f=iS(t)||iS(e),d={min:t,max:e,a:c,b:l},h=[],m=[];if(f&&(d.isPadded=f,d.maxLen=String(d.max).length),c<0){let b=l<0?Math.abs(l):1;m=eS(b,Math.abs(c),d,n),c=d.a=0}return l>=0&&(h=eS(c,l,d,n)),d.negatives=m,d.positives=h,d.result=vU(m,h,n),n.capture===!0?d.result=`(${d.result})`:n.wrap!==!1&&h.length+m.length>1&&(d.result=`(?:${d.result})`),Po.cache[u]=d,d.result};function vU(t,e,r){let n=Cg(t,e,"-",!1,r)||[],o=Cg(e,t,"",!1,r)||[],i=Cg(t,e,"-?",!0,r)||[];return n.concat(i).concat(o).join("|")}function wU(t,e){let r=1,n=1,o=rS(t,r),i=new Set([e]);for(;t<=o&&o<=e;)i.add(o),r+=1,o=rS(t,r);for(o=nS(e+1,n)-1;t<o&&o<=e;)i.add(o),n+=1,o=nS(e+1,n)-1;return i=[...i],i.sort(_U),i}function CU(t,e,r){if(t===e)return{pattern:t,count:[],digits:0};let n=EU(t,e),o=n.length,i="",a=0;for(let s=0;s<o;s++){let[u,c]=n[s];u===c?i+=u:u!=="0"||c!=="9"?i+=xU(u,c,r):a++}return a&&(i+=r.shorthand===!0?"\\d":"[0-9]"),{pattern:i,count:[a],digits:o}}function eS(t,e,r,n){let o=wU(t,e),i=[],a=t,s;for(let u=0;u<o.length;u++){let c=o[u],l=CU(String(a),String(c),n),f="";if(!r.isPadded&&s&&s.pattern===l.pattern){s.count.length>1&&s.count.pop(),s.count.push(l.count[0]),s.string=s.pattern+oS(s.count),a=c+1;continue}r.isPadded&&(f=SU(c,r,n)),l.string=f+l.pattern+oS(l.count),i.push(l),a=c+1,s=l}return i}function Cg(t,e,r,n,o){let i=[];for(let a of t){let{string:s}=a;!n&&!tS(e,"string",s)&&i.push(r+s),n&&tS(e,"string",s)&&i.push(r+s)}return i}function EU(t,e){let r=[];for(let n=0;n<t.length;n++)r.push([t[n],e[n]]);return r}function _U(t,e){return t>e?1:e>t?-1:0}function tS(t,e,r){return t.some(n=>n[e]===r)}function rS(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function nS(t,e){return t-t%Math.pow(10,e)}function oS(t){let[e=0,r=""]=t;return r||e>1?`{${e+(r?","+r:"")}}`:""}function xU(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function iS(t){return/^-?(0+)\d/.test(t)}function SU(t,e,r){if(!e.isPadded)return t;let n=Math.abs(e.maxLen-String(t).length),o=r.relaxZeros!==!1;switch(n){case 0:return"";case 1:return o?"0?":"0";case 2:return o?"0{0,2}":"00";default:return o?`0{0,${n}}`:`0{${n}}`}}Po.cache={};Po.clearCache=()=>Po.cache={};aS.exports=Po});var xg=x((TY,hS)=>{"use strict";var FU=require("util"),cS=sS(),uS=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),AU=t=>e=>t===!0?Number(e):String(e),Eg=t=>typeof t=="number"||typeof t=="string"&&t!=="",Fs=t=>Number.isInteger(+t),_g=t=>{let e=`${t}`,r=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++r]==="0";);return r>0},OU=(t,e,r)=>typeof t=="string"||typeof e=="string"?!0:r.stringify===!0,kU=(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},Vl=(t,e)=>{let r=t[0]==="-"?"-":"";for(r&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return r?"-"+t:t},$U=(t,e,r)=>{t.negatives.sort((s,u)=>s<u?-1:s>u?1:0),t.positives.sort((s,u)=>s<u?-1:s>u?1:0);let n=e.capture?"":"?:",o="",i="",a;return t.positives.length&&(o=t.positives.map(s=>Vl(String(s),r)).join("|")),t.negatives.length&&(i=`-(${n}${t.negatives.map(s=>Vl(String(s),r)).join("|")})`),o&&i?a=`${o}|${i}`:a=o||i,e.wrap?`(${n}${a})`:a},lS=(t,e,r,n)=>{if(r)return cS(t,e,{wrap:!1,...n});let o=String.fromCharCode(t);if(t===e)return o;let i=String.fromCharCode(e);return`[${o}-${i}]`},fS=(t,e,r)=>{if(Array.isArray(t)){let n=r.wrap===!0,o=r.capture?"":"?:";return n?`(${o}${t.join("|")})`:t.join("|")}return cS(t,e,r)},pS=(...t)=>new RangeError("Invalid range arguments: "+FU.inspect(...t)),dS=(t,e,r)=>{if(r.strictRanges===!0)throw pS([t,e]);return[]},PU=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return[]},TU=(t,e,r=1,n={})=>{let o=Number(t),i=Number(e);if(!Number.isInteger(o)||!Number.isInteger(i)){if(n.strictRanges===!0)throw pS([t,e]);return[]}o===0&&(o=0),i===0&&(i=0);let a=o>i,s=String(t),u=String(e),c=String(r);r=Math.max(Math.abs(r),1);let l=_g(s)||_g(u)||_g(c),f=l?Math.max(s.length,u.length,c.length):0,d=l===!1&&OU(t,e,n)===!1,h=n.transform||AU(d);if(n.toRegex&&r===1)return lS(Vl(t,f),Vl(e,f),!0,n);let m={negatives:[],positives:[]},b=E=>m[E<0?"negatives":"positives"].push(Math.abs(E)),D=[],C=0;for(;a?o>=i:o<=i;)n.toRegex===!0&&r>1?b(o):D.push(kU(h(o,C),f,d)),o=a?o-r:o+r,C++;return n.toRegex===!0?r>1?$U(m,n,f):fS(D,null,{wrap:!1,...n}):D},IU=(t,e,r=1,n={})=>{if(!Fs(t)&&t.length>1||!Fs(e)&&e.length>1)return dS(t,e,n);let o=n.transform||(d=>String.fromCharCode(d)),i=`${t}`.charCodeAt(0),a=`${e}`.charCodeAt(0),s=i>a,u=Math.min(i,a),c=Math.max(i,a);if(n.toRegex&&r===1)return lS(u,c,!1,n);let l=[],f=0;for(;s?i>=a:i<=a;)l.push(o(i,f)),i=s?i-r:i+r,f++;return n.toRegex===!0?fS(l,null,{wrap:!1,options:n}):l},Hl=(t,e,r,n={})=>{if(e==null&&Eg(t))return[t];if(!Eg(t)||!Eg(e))return dS(t,e,n);if(typeof r=="function")return Hl(t,e,1,{transform:r});if(uS(r))return Hl(t,e,0,r);let o={...n};return o.capture===!0&&(o.wrap=!0),r=r||o.step||1,Fs(r)?Fs(t)&&Fs(e)?TU(t,e,r,o):IU(t,e,Math.max(Math.abs(r),1),o):r!=null&&!uS(r)?PU(r,o):Hl(t,e,1,r)};hS.exports=Hl});var DS=x((IY,gS)=>{"use strict";var RU=xg(),mS=Ml(),BU=(t,e={})=>{let r=(n,o={})=>{let i=mS.isInvalidBrace(o),a=n.invalid===!0&&e.escapeInvalid===!0,s=i===!0||a===!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 s?u+n.value:"(";if(n.type==="close")return s?u+n.value:")";if(n.type==="comma")return n.prev.type==="comma"?"":s?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let l=mS.reduce(n.nodes),f=RU(...l,{...e,wrap:!1,toRegex:!0,strictZeros:!0});if(f.length!==0)return l.length>1&&f.length>1?`(${f})`:f}if(n.nodes)for(let l of n.nodes)c+=r(l,n);return c};return r(t)};gS.exports=BU});var vS=x((RY,bS)=>{"use strict";var jU=xg(),yS=ql(),ra=Ml(),To=(t="",e="",r=!1)=>{let n=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return r?ra.flatten(e).map(o=>`{${o}}`):e;for(let o of t)if(Array.isArray(o))for(let i of o)n.push(To(i,e,r));else for(let i of e)r===!0&&typeof i=="string"&&(i=`{${i}}`),n.push(Array.isArray(i)?To(o,i,r):o+i);return ra.flatten(n)},NU=(t,e={})=>{let r=e.rangeLimit===void 0?1e3:e.rangeLimit,n=(o,i={})=>{o.queue=[];let a=i,s=i.queue;for(;a.type!=="brace"&&a.type!=="root"&&a.parent;)a=a.parent,s=a.queue;if(o.invalid||o.dollar){s.push(To(s.pop(),yS(o,e)));return}if(o.type==="brace"&&o.invalid!==!0&&o.nodes.length===2){s.push(To(s.pop(),["{}"]));return}if(o.nodes&&o.ranges>0){let f=ra.reduce(o.nodes);if(ra.exceedsLimit(...f,e.step,r))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let d=jU(...f,e);d.length===0&&(d=yS(o,e)),s.push(To(s.pop(),d)),o.nodes=[];return}let u=ra.encloseBrace(o),c=o.queue,l=o;for(;l.type!=="brace"&&l.type!=="root"&&l.parent;)l=l.parent,c=l.queue;for(let f=0;f<o.nodes.length;f++){let d=o.nodes[f];if(d.type==="comma"&&o.type==="brace"){f===1&&c.push(""),c.push("");continue}if(d.type==="close"){s.push(To(s.pop(),c,u));continue}if(d.value&&d.type!=="open"){c.push(To(c.pop(),d.value));continue}d.nodes&&n(d,o)}return c};return ra.flatten(n(t))};bS.exports=NU});var CS=x((BY,wS)=>{"use strict";wS.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:`
104
- `,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 FS=x((jY,SS)=>{"use strict";var LU=ql(),{MAX_LENGTH:ES,CHAR_BACKSLASH:Sg,CHAR_BACKTICK:UU,CHAR_COMMA:MU,CHAR_DOT:qU,CHAR_LEFT_PARENTHESES:HU,CHAR_RIGHT_PARENTHESES:VU,CHAR_LEFT_CURLY_BRACE:zU,CHAR_RIGHT_CURLY_BRACE:GU,CHAR_LEFT_SQUARE_BRACKET:_S,CHAR_RIGHT_SQUARE_BRACKET:xS,CHAR_DOUBLE_QUOTE:WU,CHAR_SINGLE_QUOTE:KU,CHAR_NO_BREAK_SPACE:YU,CHAR_ZERO_WIDTH_NOBREAK_SPACE:JU}=CS(),XU=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let r=e||{},n=typeof r.maxLength=="number"?Math.min(ES,r.maxLength):ES;if(t.length>n)throw new SyntaxError(`Input length (${t.length}), exceeds max characters (${n})`);let o={type:"root",input:t,nodes:[]},i=[o],a=o,s=o,u=0,c=t.length,l=0,f=0,d,h=()=>t[l++],m=b=>{if(b.type==="text"&&s.type==="dot"&&(s.type="text"),s&&s.type==="text"&&b.type==="text"){s.value+=b.value;return}return a.nodes.push(b),b.parent=a,b.prev=s,s=b,b};for(m({type:"bos"});l<c;)if(a=i[i.length-1],d=h(),!(d===JU||d===YU)){if(d===Sg){m({type:"text",value:(e.keepEscaping?d:"")+h()});continue}if(d===xS){m({type:"text",value:"\\"+d});continue}if(d===_S){u++;let b;for(;l<c&&(b=h());){if(d+=b,b===_S){u++;continue}if(b===Sg){d+=h();continue}if(b===xS&&(u--,u===0))break}m({type:"text",value:d});continue}if(d===HU){a=m({type:"paren",nodes:[]}),i.push(a),m({type:"text",value:d});continue}if(d===VU){if(a.type!=="paren"){m({type:"text",value:d});continue}a=i.pop(),m({type:"text",value:d}),a=i[i.length-1];continue}if(d===WU||d===KU||d===UU){let b=d,D;for(e.keepQuotes!==!0&&(d="");l<c&&(D=h());){if(D===Sg){d+=D+h();continue}if(D===b){e.keepQuotes===!0&&(d+=D);break}d+=D}m({type:"text",value:d});continue}if(d===zU){f++;let D={type:"brace",open:!0,close:!1,dollar:s.value&&s.value.slice(-1)==="$"||a.dollar===!0,depth:f,commas:0,ranges:0,nodes:[]};a=m(D),i.push(a),m({type:"open",value:d});continue}if(d===GU){if(a.type!=="brace"){m({type:"text",value:d});continue}let b="close";a=i.pop(),a.close=!0,m({type:b,value:d}),f--,a=i[i.length-1];continue}if(d===MU&&f>0){if(a.ranges>0){a.ranges=0;let b=a.nodes.shift();a.nodes=[b,{type:"text",value:LU(a)}]}m({type:"comma",value:d}),a.commas++;continue}if(d===qU&&f>0&&a.commas===0){let b=a.nodes;if(f===0||b.length===0){m({type:"text",value:d});continue}if(s.type==="dot"){if(a.range=[],s.value+=d,s.type="range",a.nodes.length!==3&&a.nodes.length!==5){a.invalid=!0,a.ranges=0,s.type="text";continue}a.ranges++,a.args=[];continue}if(s.type==="range"){b.pop();let D=b[b.length-1];D.value+=s.value+d,s=D,a.ranges--;continue}m({type:"dot",value:d});continue}m({type:"text",value:d})}do if(a=i.pop(),a.type!=="root"){a.nodes.forEach(C=>{C.nodes||(C.type==="open"&&(C.isOpen=!0),C.type==="close"&&(C.isClose=!0),C.nodes||(C.type="text"),C.invalid=!0)});let b=i[i.length-1],D=b.nodes.indexOf(a);b.nodes.splice(D,1,...a.nodes)}while(i.length>0);return m({type:"eos"}),o};SS.exports=XU});var kS=x((NY,OS)=>{"use strict";var AS=ql(),ZU=DS(),QU=vS(),eM=FS(),Kt=(t,e={})=>{let r=[];if(Array.isArray(t))for(let n of t){let o=Kt.create(n,e);Array.isArray(o)?r.push(...o):r.push(o)}else r=[].concat(Kt.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(r=[...new Set(r)]),r};Kt.parse=(t,e={})=>eM(t,e);Kt.stringify=(t,e={})=>AS(typeof t=="string"?Kt.parse(t,e):t,e);Kt.compile=(t,e={})=>(typeof t=="string"&&(t=Kt.parse(t,e)),ZU(t,e));Kt.expand=(t,e={})=>{typeof t=="string"&&(t=Kt.parse(t,e));let r=QU(t,e);return e.noempty===!0&&(r=r.filter(Boolean)),e.nodupes===!0&&(r=[...new Set(r)]),r};Kt.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?Kt.compile(t,e):Kt.expand(t,e);OS.exports=Kt});var As=x((LY,RS)=>{"use strict";var tM=require("path"),Nr="\\\\/",$S=`[^${Nr}]`,sn="\\.",rM="\\+",nM="\\?",zl="\\/",oM="(?=.)",PS="[^/]",Fg=`(?:${zl}|$)`,TS=`(?:^|${zl})`,Ag=`${sn}{1,2}${Fg}`,iM=`(?!${sn})`,aM=`(?!${TS}${Ag})`,sM=`(?!${sn}{0,1}${Fg})`,uM=`(?!${Ag})`,cM=`[^.${zl}]`,lM=`${PS}*?`,IS={DOT_LITERAL:sn,PLUS_LITERAL:rM,QMARK_LITERAL:nM,SLASH_LITERAL:zl,ONE_CHAR:oM,QMARK:PS,END_ANCHOR:Fg,DOTS_SLASH:Ag,NO_DOT:iM,NO_DOTS:aM,NO_DOT_SLASH:sM,NO_DOTS_SLASH:uM,QMARK_NO_DOT:cM,STAR:lM,START_ANCHOR:TS},fM={...IS,SLASH_LITERAL:`[${Nr}]`,QMARK:$S,STAR:`${$S}*?`,DOTS_SLASH:`${sn}{1,2}(?:[${Nr}]|$)`,NO_DOT:`(?!${sn})`,NO_DOTS:`(?!(?:^|[${Nr}])${sn}{1,2}(?:[${Nr}]|$))`,NO_DOT_SLASH:`(?!${sn}{0,1}(?:[${Nr}]|$))`,NO_DOTS_SLASH:`(?!${sn}{1,2}(?:[${Nr}]|$))`,QMARK_NO_DOT:`[^.${Nr}]`,START_ANCHOR:`(?:^|[${Nr}])`,END_ANCHOR:`(?:[${Nr}]|$)`},pM={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"};RS.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:pM,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:tM.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?fM:IS}}});var Os=x(Ht=>{"use strict";var dM=require("path"),hM=process.platform==="win32",{REGEX_BACKSLASH:mM,REGEX_REMOVE_BACKSLASH:gM,REGEX_SPECIAL_CHARS:DM,REGEX_SPECIAL_CHARS_GLOBAL:yM}=As();Ht.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Ht.hasRegexChars=t=>DM.test(t);Ht.isRegexChar=t=>t.length===1&&Ht.hasRegexChars(t);Ht.escapeRegex=t=>t.replace(yM,"\\$1");Ht.toPosixSlashes=t=>t.replace(mM,"/");Ht.removeBackslashes=t=>t.replace(gM,e=>e==="\\"?"":e);Ht.supportsLookbehinds=()=>{let t=process.version.slice(1).split(".").map(Number);return t.length===3&&t[0]>=9||t[0]===8&&t[1]>=10};Ht.isWindows=t=>t&&typeof t.windows=="boolean"?t.windows:hM===!0||dM.sep==="\\";Ht.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Ht.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Ht.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Ht.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",o=r.contains?"":"$",i=`${n}(?:${t})${o}`;return e.negated===!0&&(i=`(?:^(?!${i}).*$)`),i}});var HS=x((MY,qS)=>{"use strict";var BS=Os(),{CHAR_ASTERISK:Og,CHAR_AT:bM,CHAR_BACKWARD_SLASH:ks,CHAR_COMMA:vM,CHAR_DOT:kg,CHAR_EXCLAMATION_MARK:$g,CHAR_FORWARD_SLASH:MS,CHAR_LEFT_CURLY_BRACE:Pg,CHAR_LEFT_PARENTHESES:Tg,CHAR_LEFT_SQUARE_BRACKET:wM,CHAR_PLUS:CM,CHAR_QUESTION_MARK:jS,CHAR_RIGHT_CURLY_BRACE:EM,CHAR_RIGHT_PARENTHESES:NS,CHAR_RIGHT_SQUARE_BRACKET:_M}=As(),LS=t=>t===MS||t===ks,US=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},xM=(t,e)=>{let r=e||{},n=t.length-1,o=r.parts===!0||r.scanToEnd===!0,i=[],a=[],s=[],u=t,c=-1,l=0,f=0,d=!1,h=!1,m=!1,b=!1,D=!1,C=!1,E=!1,g=!1,_=!1,S=!1,I=0,O,B,R={value:"",depth:0,isGlob:!1},N=()=>c>=n,A=()=>u.charCodeAt(c+1),L=()=>(O=B,u.charCodeAt(++c));for(;c<n;){B=L();let v;if(B===ks){E=R.backslashes=!0,B=L(),B===Pg&&(C=!0);continue}if(C===!0||B===Pg){for(I++;N()!==!0&&(B=L());){if(B===ks){E=R.backslashes=!0,L();continue}if(B===Pg){I++;continue}if(C!==!0&&B===kg&&(B=L())===kg){if(d=R.isBrace=!0,m=R.isGlob=!0,S=!0,o===!0)continue;break}if(C!==!0&&B===vM){if(d=R.isBrace=!0,m=R.isGlob=!0,S=!0,o===!0)continue;break}if(B===EM&&(I--,I===0)){C=!1,d=R.isBrace=!0,S=!0;break}}if(o===!0)continue;break}if(B===MS){if(i.push(c),a.push(R),R={value:"",depth:0,isGlob:!1},S===!0)continue;if(O===kg&&c===l+1){l+=2;continue}f=c+1;continue}if(r.noext!==!0&&(B===CM||B===bM||B===Og||B===jS||B===$g)===!0&&A()===Tg){if(m=R.isGlob=!0,b=R.isExtglob=!0,S=!0,B===$g&&c===l&&(_=!0),o===!0){for(;N()!==!0&&(B=L());){if(B===ks){E=R.backslashes=!0,B=L();continue}if(B===NS){m=R.isGlob=!0,S=!0;break}}continue}break}if(B===Og){if(O===Og&&(D=R.isGlobstar=!0),m=R.isGlob=!0,S=!0,o===!0)continue;break}if(B===jS){if(m=R.isGlob=!0,S=!0,o===!0)continue;break}if(B===wM){for(;N()!==!0&&(v=L());){if(v===ks){E=R.backslashes=!0,L();continue}if(v===_M){h=R.isBracket=!0,m=R.isGlob=!0,S=!0;break}}if(o===!0)continue;break}if(r.nonegate!==!0&&B===$g&&c===l){g=R.negated=!0,l++;continue}if(r.noparen!==!0&&B===Tg){if(m=R.isGlob=!0,o===!0){for(;N()!==!0&&(B=L());){if(B===Tg){E=R.backslashes=!0,B=L();continue}if(B===NS){S=!0;break}}continue}break}if(m===!0){if(S=!0,o===!0)continue;break}}r.noext===!0&&(b=!1,m=!1);let q=u,Q="",$="";l>0&&(Q=u.slice(0,l),u=u.slice(l),f-=l),q&&m===!0&&f>0?(q=u.slice(0,f),$=u.slice(f)):m===!0?(q="",$=u):q=u,q&&q!==""&&q!=="/"&&q!==u&&LS(q.charCodeAt(q.length-1))&&(q=q.slice(0,-1)),r.unescape===!0&&($&&($=BS.removeBackslashes($)),q&&E===!0&&(q=BS.removeBackslashes(q)));let y={prefix:Q,input:t,start:l,base:q,glob:$,isBrace:d,isBracket:h,isGlob:m,isExtglob:b,isGlobstar:D,negated:g,negatedExtglob:_};if(r.tokens===!0&&(y.maxDepth=0,LS(B)||a.push(R),y.tokens=a),r.parts===!0||r.tokens===!0){let v;for(let w=0;w<i.length;w++){let F=v?v+1:l,T=i[w],k=t.slice(F,T);r.tokens&&(w===0&&l!==0?(a[w].isPrefix=!0,a[w].value=Q):a[w].value=k,US(a[w]),y.maxDepth+=a[w].depth),(w!==0||k!=="")&&s.push(k),v=T}if(v&&v+1<t.length){let w=t.slice(v+1);s.push(w),r.tokens&&(a[a.length-1].value=w,US(a[a.length-1]),y.maxDepth+=a[a.length-1].depth)}y.slashes=i,y.parts=s}return y};qS.exports=xM});var GS=x((qY,zS)=>{"use strict";var Gl=As(),Yt=Os(),{MAX_LENGTH:Wl,POSIX_REGEX_SOURCE:SM,REGEX_NON_SPECIAL_CHARS:FM,REGEX_SPECIAL_CHARS_BACKREF:AM,REPLACEMENTS:VS}=Gl,OM=(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(o=>Yt.escapeRegex(o)).join("..")}return r},na=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,Ig=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=VS[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(Wl,r.maxLength):Wl,o=t.length;if(o>n)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${n}`);let i={type:"bos",value:"",output:r.prepend||""},a=[i],s=r.capture?"":"?:",u=Yt.isWindows(e),c=Gl.globChars(u),l=Gl.extglobChars(c),{DOT_LITERAL:f,PLUS_LITERAL:d,SLASH_LITERAL:h,ONE_CHAR:m,DOTS_SLASH:b,NO_DOT:D,NO_DOT_SLASH:C,NO_DOTS_SLASH:E,QMARK:g,QMARK_NO_DOT:_,STAR:S,START_ANCHOR:I}=c,O=z=>`(${s}(?:(?!${I}${z.dot?b:f}).)*?)`,B=r.dot?"":D,R=r.dot?g:_,N=r.bash===!0?O(r):S;r.capture&&(N=`(${N})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let A={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:a};t=Yt.removePrefix(t,A),o=t.length;let L=[],q=[],Q=[],$=i,y,v=()=>A.index===o-1,w=A.peek=(z=1)=>t[A.index+z],F=A.advance=()=>t[++A.index]||"",T=()=>t.slice(A.index+1),k=(z="",Ee=0)=>{A.consumed+=z,A.index+=Ee},M=z=>{A.output+=z.output!=null?z.output:z.value,k(z.value)},P=()=>{let z=1;for(;w()==="!"&&(w(2)!=="("||w(3)==="?");)F(),A.start++,z++;return z%2===0?!1:(A.negated=!0,A.start++,!0)},j=z=>{A[z]++,Q.push(z)},ee=z=>{A[z]--,Q.pop()},V=z=>{if($.type==="globstar"){let Ee=A.braces>0&&(z.type==="comma"||z.type==="brace"),H=z.extglob===!0||L.length&&(z.type==="pipe"||z.type==="paren");z.type!=="slash"&&z.type!=="paren"&&!Ee&&!H&&(A.output=A.output.slice(0,-$.output.length),$.type="star",$.value="*",$.output=N,A.output+=$.output)}if(L.length&&z.type!=="paren"&&(L[L.length-1].inner+=z.value),(z.value||z.output)&&M(z),$&&$.type==="text"&&z.type==="text"){$.value+=z.value,$.output=($.output||"")+z.value;return}z.prev=$,a.push(z),$=z},se=(z,Ee)=>{let H={...l[Ee],conditions:1,inner:""};H.prev=$,H.parens=A.parens,H.output=A.output;let ue=(r.capture?"(":"")+H.open;j("parens"),V({type:z,value:Ee,output:A.output?"":m}),V({type:"paren",extglob:!0,value:F(),output:ue}),L.push(H)},hr=z=>{let Ee=z.close+(r.capture?")":""),H;if(z.type==="negate"){let ue=N;if(z.inner&&z.inner.length>1&&z.inner.includes("/")&&(ue=O(r)),(ue!==N||v()||/^\)+$/.test(T()))&&(Ee=z.close=`)$))${ue}`),z.inner.includes("*")&&(H=T())&&/^\.[^\\/.]+$/.test(H)){let Le=Ig(H,{...e,fastpaths:!1}).output;Ee=z.close=`)${Le})${ue})`}z.prev.type==="bos"&&(A.negatedExtglob=!0)}V({type:"paren",extglob:!0,value:y,output:Ee}),ee("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let z=!1,Ee=t.replace(AM,(H,ue,Le,Et,et,rf)=>Et==="\\"?(z=!0,H):Et==="?"?ue?ue+Et+(et?g.repeat(et.length):""):rf===0?R+(et?g.repeat(et.length):""):g.repeat(Le.length):Et==="."?f.repeat(Le.length):Et==="*"?ue?ue+Et+(et?N:""):N:ue?H:`\\${H}`);return z===!0&&(r.unescape===!0?Ee=Ee.replace(/\\/g,""):Ee=Ee.replace(/\\+/g,H=>H.length%2===0?"\\\\":H?"\\":"")),Ee===t&&r.contains===!0?(A.output=t,A):(A.output=Yt.wrapOutput(Ee,A,e),A)}for(;!v();){if(y=F(),y==="\0")continue;if(y==="\\"){let H=w();if(H==="/"&&r.bash!==!0||H==="."||H===";")continue;if(!H){y+="\\",V({type:"text",value:y});continue}let ue=/^\\+/.exec(T()),Le=0;if(ue&&ue[0].length>2&&(Le=ue[0].length,A.index+=Le,Le%2!==0&&(y+="\\")),r.unescape===!0?y=F():y+=F(),A.brackets===0){V({type:"text",value:y});continue}}if(A.brackets>0&&(y!=="]"||$.value==="["||$.value==="[^")){if(r.posix!==!1&&y===":"){let H=$.value.slice(1);if(H.includes("[")&&($.posix=!0,H.includes(":"))){let ue=$.value.lastIndexOf("["),Le=$.value.slice(0,ue),Et=$.value.slice(ue+2),et=SM[Et];if(et){$.value=Le+et,A.backtrack=!0,F(),!i.output&&a.indexOf($)===1&&(i.output=m);continue}}}(y==="["&&w()!==":"||y==="-"&&w()==="]")&&(y=`\\${y}`),y==="]"&&($.value==="["||$.value==="[^")&&(y=`\\${y}`),r.posix===!0&&y==="!"&&$.value==="["&&(y="^"),$.value+=y,M({value:y});continue}if(A.quotes===1&&y!=='"'){y=Yt.escapeRegex(y),$.value+=y,M({value:y});continue}if(y==='"'){A.quotes=A.quotes===1?0:1,r.keepQuotes===!0&&V({type:"text",value:y});continue}if(y==="("){j("parens"),V({type:"paren",value:y});continue}if(y===")"){if(A.parens===0&&r.strictBrackets===!0)throw new SyntaxError(na("opening","("));let H=L[L.length-1];if(H&&A.parens===H.parens+1){hr(L.pop());continue}V({type:"paren",value:y,output:A.parens?")":"\\)"}),ee("parens");continue}if(y==="["){if(r.nobracket===!0||!T().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(na("closing","]"));y=`\\${y}`}else j("brackets");V({type:"bracket",value:y});continue}if(y==="]"){if(r.nobracket===!0||$&&$.type==="bracket"&&$.value.length===1){V({type:"text",value:y,output:`\\${y}`});continue}if(A.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(na("opening","["));V({type:"text",value:y,output:`\\${y}`});continue}ee("brackets");let H=$.value.slice(1);if($.posix!==!0&&H[0]==="^"&&!H.includes("/")&&(y=`/${y}`),$.value+=y,M({value:y}),r.literalBrackets===!1||Yt.hasRegexChars(H))continue;let ue=Yt.escapeRegex($.value);if(A.output=A.output.slice(0,-$.value.length),r.literalBrackets===!0){A.output+=ue,$.value=ue;continue}$.value=`(${s}${ue}|${$.value})`,A.output+=$.value;continue}if(y==="{"&&r.nobrace!==!0){j("braces");let H={type:"brace",value:y,output:"(",outputIndex:A.output.length,tokensIndex:A.tokens.length};q.push(H),V(H);continue}if(y==="}"){let H=q[q.length-1];if(r.nobrace===!0||!H){V({type:"text",value:y,output:y});continue}let ue=")";if(H.dots===!0){let Le=a.slice(),Et=[];for(let et=Le.length-1;et>=0&&(a.pop(),Le[et].type!=="brace");et--)Le[et].type!=="dots"&&Et.unshift(Le[et].value);ue=OM(Et,r),A.backtrack=!0}if(H.comma!==!0&&H.dots!==!0){let Le=A.output.slice(0,H.outputIndex),Et=A.tokens.slice(H.tokensIndex);H.value=H.output="\\{",y=ue="\\}",A.output=Le;for(let et of Et)A.output+=et.output||et.value}V({type:"brace",value:y,output:ue}),ee("braces"),q.pop();continue}if(y==="|"){L.length>0&&L[L.length-1].conditions++,V({type:"text",value:y});continue}if(y===","){let H=y,ue=q[q.length-1];ue&&Q[Q.length-1]==="braces"&&(ue.comma=!0,H="|"),V({type:"comma",value:y,output:H});continue}if(y==="/"){if($.type==="dot"&&A.index===A.start+1){A.start=A.index+1,A.consumed="",A.output="",a.pop(),$=i;continue}V({type:"slash",value:y,output:h});continue}if(y==="."){if(A.braces>0&&$.type==="dot"){$.value==="."&&($.output=f);let H=q[q.length-1];$.type="dots",$.output+=y,$.value+=y,H.dots=!0;continue}if(A.braces+A.parens===0&&$.type!=="bos"&&$.type!=="slash"){V({type:"text",value:y,output:f});continue}V({type:"dot",value:y,output:f});continue}if(y==="?"){if(!($&&$.value==="(")&&r.noextglob!==!0&&w()==="("&&w(2)!=="?"){se("qmark",y);continue}if($&&$.type==="paren"){let ue=w(),Le=y;if(ue==="<"&&!Yt.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");($.value==="("&&!/[!=<:]/.test(ue)||ue==="<"&&!/<([!=]|\w+>)/.test(T()))&&(Le=`\\${y}`),V({type:"text",value:y,output:Le});continue}if(r.dot!==!0&&($.type==="slash"||$.type==="bos")){V({type:"qmark",value:y,output:_});continue}V({type:"qmark",value:y,output:g});continue}if(y==="!"){if(r.noextglob!==!0&&w()==="("&&(w(2)!=="?"||!/[!=<:]/.test(w(3)))){se("negate",y);continue}if(r.nonegate!==!0&&A.index===0){P();continue}}if(y==="+"){if(r.noextglob!==!0&&w()==="("&&w(2)!=="?"){se("plus",y);continue}if($&&$.value==="("||r.regex===!1){V({type:"plus",value:y,output:d});continue}if($&&($.type==="bracket"||$.type==="paren"||$.type==="brace")||A.parens>0){V({type:"plus",value:y});continue}V({type:"plus",value:d});continue}if(y==="@"){if(r.noextglob!==!0&&w()==="("&&w(2)!=="?"){V({type:"at",extglob:!0,value:y,output:""});continue}V({type:"text",value:y});continue}if(y!=="*"){(y==="$"||y==="^")&&(y=`\\${y}`);let H=FM.exec(T());H&&(y+=H[0],A.index+=H[0].length),V({type:"text",value:y});continue}if($&&($.type==="globstar"||$.star===!0)){$.type="star",$.star=!0,$.value+=y,$.output=N,A.backtrack=!0,A.globstar=!0,k(y);continue}let z=T();if(r.noextglob!==!0&&/^\([^?]/.test(z)){se("star",y);continue}if($.type==="star"){if(r.noglobstar===!0){k(y);continue}let H=$.prev,ue=H.prev,Le=H.type==="slash"||H.type==="bos",Et=ue&&(ue.type==="star"||ue.type==="globstar");if(r.bash===!0&&(!Le||z[0]&&z[0]!=="/")){V({type:"star",value:y,output:""});continue}let et=A.braces>0&&(H.type==="comma"||H.type==="brace"),rf=L.length&&(H.type==="pipe"||H.type==="paren");if(!Le&&H.type!=="paren"&&!et&&!rf){V({type:"star",value:y,output:""});continue}for(;z.slice(0,3)==="/**";){let Rs=t[A.index+4];if(Rs&&Rs!=="/")break;z=z.slice(3),k("/**",3)}if(H.type==="bos"&&v()){$.type="globstar",$.value+=y,$.output=O(r),A.output=$.output,A.globstar=!0,k(y);continue}if(H.type==="slash"&&H.prev.type!=="bos"&&!Et&&v()){A.output=A.output.slice(0,-(H.output+$.output).length),H.output=`(?:${H.output}`,$.type="globstar",$.output=O(r)+(r.strictSlashes?")":"|$)"),$.value+=y,A.globstar=!0,A.output+=H.output+$.output,k(y);continue}if(H.type==="slash"&&H.prev.type!=="bos"&&z[0]==="/"){let Rs=z[1]!==void 0?"|$":"";A.output=A.output.slice(0,-(H.output+$.output).length),H.output=`(?:${H.output}`,$.type="globstar",$.output=`${O(r)}${h}|${h}${Rs})`,$.value+=y,A.output+=H.output+$.output,A.globstar=!0,k(y+F()),V({type:"slash",value:"/",output:""});continue}if(H.type==="bos"&&z[0]==="/"){$.type="globstar",$.value+=y,$.output=`(?:^|${h}|${O(r)}${h})`,A.output=$.output,A.globstar=!0,k(y+F()),V({type:"slash",value:"/",output:""});continue}A.output=A.output.slice(0,-$.output.length),$.type="globstar",$.output=O(r),$.value+=y,A.output+=$.output,A.globstar=!0,k(y);continue}let Ee={type:"star",value:y,output:N};if(r.bash===!0){Ee.output=".*?",($.type==="bos"||$.type==="slash")&&(Ee.output=B+Ee.output),V(Ee);continue}if($&&($.type==="bracket"||$.type==="paren")&&r.regex===!0){Ee.output=y,V(Ee);continue}(A.index===A.start||$.type==="slash"||$.type==="dot")&&($.type==="dot"?(A.output+=C,$.output+=C):r.dot===!0?(A.output+=E,$.output+=E):(A.output+=B,$.output+=B),w()!=="*"&&(A.output+=m,$.output+=m)),V(Ee)}for(;A.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(na("closing","]"));A.output=Yt.escapeLast(A.output,"["),ee("brackets")}for(;A.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(na("closing",")"));A.output=Yt.escapeLast(A.output,"("),ee("parens")}for(;A.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(na("closing","}"));A.output=Yt.escapeLast(A.output,"{"),ee("braces")}if(r.strictSlashes!==!0&&($.type==="star"||$.type==="bracket")&&V({type:"maybe_slash",value:"",output:`${h}?`}),A.backtrack===!0){A.output="";for(let z of A.tokens)A.output+=z.output!=null?z.output:z.value,z.suffix&&(A.output+=z.suffix)}return A};Ig.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(Wl,r.maxLength):Wl,o=t.length;if(o>n)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${n}`);t=VS[t]||t;let i=Yt.isWindows(e),{DOT_LITERAL:a,SLASH_LITERAL:s,ONE_CHAR:u,DOTS_SLASH:c,NO_DOT:l,NO_DOTS:f,NO_DOTS_SLASH:d,STAR:h,START_ANCHOR:m}=Gl.globChars(i),b=r.dot?f:l,D=r.dot?d:l,C=r.capture?"":"?:",E={negated:!1,prefix:""},g=r.bash===!0?".*?":h;r.capture&&(g=`(${g})`);let _=B=>B.noglobstar===!0?g:`(${C}(?:(?!${m}${B.dot?c:a}).)*?)`,S=B=>{switch(B){case"*":return`${b}${u}${g}`;case".*":return`${a}${u}${g}`;case"*.*":return`${b}${g}${a}${u}${g}`;case"*/*":return`${b}${g}${s}${u}${D}${g}`;case"**":return b+_(r);case"**/*":return`(?:${b}${_(r)}${s})?${D}${u}${g}`;case"**/*.*":return`(?:${b}${_(r)}${s})?${D}${g}${a}${u}${g}`;case"**/.*":return`(?:${b}${_(r)}${s})?${a}${u}${g}`;default:{let R=/^(.*?)\.(\w+)$/.exec(B);if(!R)return;let N=S(R[1]);return N?N+a+R[2]:void 0}}},I=Yt.removePrefix(t,E),O=S(I);return O&&r.strictSlashes!==!0&&(O+=`${s}?`),O};zS.exports=Ig});var KS=x((HY,WS)=>{"use strict";var kM=require("path"),$M=HS(),Rg=GS(),Bg=Os(),PM=As(),TM=t=>t&&typeof t=="object"&&!Array.isArray(t),Ze=(t,e,r=!1)=>{if(Array.isArray(t)){let l=t.map(d=>Ze(d,e,r));return d=>{for(let h of l){let m=h(d);if(m)return m}return!1}}let n=TM(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let o=e||{},i=Bg.isWindows(e),a=n?Ze.compileRe(t,e):Ze.makeRe(t,e,!1,!0),s=a.state;delete a.state;let u=()=>!1;if(o.ignore){let l={...e,ignore:null,onMatch:null,onResult:null};u=Ze(o.ignore,l,r)}let c=(l,f=!1)=>{let{isMatch:d,match:h,output:m}=Ze.test(l,a,e,{glob:t,posix:i}),b={glob:t,state:s,regex:a,posix:i,input:l,output:m,match:h,isMatch:d};return typeof o.onResult=="function"&&o.onResult(b),d===!1?(b.isMatch=!1,f?b:!1):u(l)?(typeof o.onIgnore=="function"&&o.onIgnore(b),b.isMatch=!1,f?b:!1):(typeof o.onMatch=="function"&&o.onMatch(b),f?b:!0)};return r&&(c.state=s),c};Ze.test=(t,e,r,{glob:n,posix:o}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let i=r||{},a=i.format||(o?Bg.toPosixSlashes:null),s=t===n,u=s&&a?a(t):t;return s===!1&&(u=a?a(t):t,s=u===n),(s===!1||i.capture===!0)&&(i.matchBase===!0||i.basename===!0?s=Ze.matchBase(t,e,r,o):s=e.exec(u)),{isMatch:!!s,match:s,output:u}};Ze.matchBase=(t,e,r,n=Bg.isWindows(r))=>(e instanceof RegExp?e:Ze.makeRe(e,r)).test(kM.basename(t));Ze.isMatch=(t,e,r)=>Ze(e,r)(t);Ze.parse=(t,e)=>Array.isArray(t)?t.map(r=>Ze.parse(r,e)):Rg(t,{...e,fastpaths:!1});Ze.scan=(t,e)=>$M(t,e);Ze.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let o=e||{},i=o.contains?"":"^",a=o.contains?"":"$",s=`${i}(?:${t.output})${a}`;t&&t.negated===!0&&(s=`^(?!${s}).*$`);let u=Ze.toRegex(s,e);return n===!0&&(u.state=t),u};Ze.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let o={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(o.output=Rg.fastpaths(t,e)),o.output||(o=Rg(t,e)),Ze.compileRe(o,e,r,n)};Ze.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/$^/}};Ze.constants=PM;WS.exports=Ze});var JS=x((VY,YS)=>{"use strict";YS.exports=KS()});var rF=x((zY,tF)=>{"use strict";var ZS=require("util"),QS=kS(),Lr=JS(),jg=Os(),XS=t=>t===""||t==="./",eF=t=>{let e=t.indexOf("{");return e>-1&&t.indexOf("}",e)>-1},Re=(t,e,r)=>{e=[].concat(e),t=[].concat(t);let n=new Set,o=new Set,i=new Set,a=0,s=l=>{i.add(l.output),r&&r.onResult&&r.onResult(l)};for(let l=0;l<e.length;l++){let f=Lr(String(e[l]),{...r,onResult:s},!0),d=f.state.negated||f.state.negatedExtglob;d&&a++;for(let h of t){let m=f(h,!0);(d?!m.isMatch:m.isMatch)&&(d?n.add(m.output):(n.delete(m.output),o.add(m.output)))}}let c=(a===e.length?[...i]:[...o]).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};Re.match=Re;Re.matcher=(t,e)=>Lr(t,e);Re.isMatch=(t,e,r)=>Lr(e,r)(t);Re.any=Re.isMatch;Re.not=(t,e,r={})=>{e=[].concat(e).map(String);let n=new Set,o=[],i=s=>{r.onResult&&r.onResult(s),o.push(s.output)},a=new Set(Re(t,e,{...r,onResult:i}));for(let s of o)a.has(s)||n.add(s);return[...n]};Re.contains=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${ZS.inspect(t)}"`);if(Array.isArray(e))return e.some(n=>Re.contains(t,n,r));if(typeof e=="string"){if(XS(t)||XS(e))return!1;if(t.includes(e)||t.startsWith("./")&&t.slice(2).includes(e))return!0}return Re.isMatch(t,e,{...r,contains:!0})};Re.matchKeys=(t,e,r)=>{if(!jg.isObject(t))throw new TypeError("Expected the first argument to be an object");let n=Re(Object.keys(t),e,r),o={};for(let i of n)o[i]=t[i];return o};Re.some=(t,e,r)=>{let n=[].concat(t);for(let o of[].concat(e)){let i=Lr(String(o),r);if(n.some(a=>i(a)))return!0}return!1};Re.every=(t,e,r)=>{let n=[].concat(t);for(let o of[].concat(e)){let i=Lr(String(o),r);if(!n.every(a=>i(a)))return!1}return!0};Re.all=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${ZS.inspect(t)}"`);return[].concat(e).every(n=>Lr(n,r)(t))};Re.capture=(t,e,r)=>{let n=jg.isWindows(r),i=Lr.makeRe(String(t),{...r,capture:!0}).exec(n?jg.toPosixSlashes(e):e);if(i)return i.slice(1).map(a=>a===void 0?"":a)};Re.makeRe=(...t)=>Lr.makeRe(...t);Re.scan=(...t)=>Lr.scan(...t);Re.parse=(t,e)=>{let r=[];for(let n of[].concat(t||[]))for(let o of QS(String(n),e))r.push(Lr.parse(o,e));return r};Re.braces=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return e&&e.nobrace===!0||!eF(t)?[t]:QS(t,e)};Re.braceExpand=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return Re.braces(t,{...e,expand:!0})};Re.hasBraces=eF;tF.exports=Re});var HF=x((HJ,un)=>{var Oe=require("fs"),Xl=require("os"),gt=require("path"),SF=require("crypto"),Mr={fs:Oe.constants,os:Xl.constants},FF="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",$F=/XXXXXX/,a9=3,PF=(Mr.O_CREAT||Mr.fs.O_CREAT)|(Mr.O_EXCL||Mr.fs.O_EXCL)|(Mr.O_RDWR||Mr.fs.O_RDWR),s9=Xl.platform()==="win32",u9=Mr.EBADF||Mr.os.errno.EBADF,c9=Mr.ENOENT||Mr.os.errno.ENOENT,TF=448,IF=384,l9="exit",ia=[],RF=Oe.rmdirSync.bind(Oe),BF=!1;function f9(t,e){return Oe.rm(t,{recursive:!0},e)}function jF(t){return Oe.rmSync(t,{recursive:!0})}function zg(t,e){let r=aa(t,e),n=r[0],o=r[1];w9(n,function(i,a){if(i)return o(i);let s=a.tries;(function u(){try{let c=LF(a);Oe.stat(c,function(l){if(!l)return s-- >0?u():o(new Error("Could not get a unique tmp filename, max tries reached "+c));o(null,c)})}catch(c){o(c)}})()})}function Gg(t){let e=aa(t),r=e[0],n=C9(r),o=n.tries;do{let i=LF(n);try{Oe.statSync(i)}catch{return i}}while(o-- >0);throw new Error("Could not get a unique tmp filename, max tries reached")}function p9(t,e){let r=aa(t,e),n=r[0],o=r[1];zg(n,function(a,s){if(a)return o(a);Oe.open(s,PF,n.mode||IF,function(c,l){if(c)return o(c);if(n.discardDescriptor)return Oe.close(l,function(d){return o(d,s,void 0,Hg(s,-1,n,!1))});{let f=n.discardDescriptor||n.detachDescriptor;o(null,s,l,Hg(s,f?-1:l,n,!1))}})})}function d9(t){let e=aa(t),r=e[0],n=r.discardDescriptor||r.detachDescriptor,o=Gg(r),i=Oe.openSync(o,PF,r.mode||IF);return r.discardDescriptor&&(Oe.closeSync(i),i=void 0),{name:o,fd:i,removeCallback:Hg(o,n?-1:i,r,!0)}}function h9(t,e){let r=aa(t,e),n=r[0],o=r[1];zg(n,function(a,s){if(a)return o(a);Oe.mkdir(s,n.mode||TF,function(c){if(c)return o(c);o(null,s,NF(s,n,!1))})})}function m9(t){let e=aa(t),r=e[0],n=Gg(r);return Oe.mkdirSync(n,r.mode||TF),{name:n,removeCallback:NF(n,r,!0)}}function g9(t,e){let r=function(n){if(n&&!Vg(n))return e(n);e()};0<=t[0]?Oe.close(t[0],function(){Oe.unlink(t[1],r)}):Oe.unlink(t[1],r)}function D9(t){let e=null;try{0<=t[0]&&Oe.closeSync(t[0])}catch(r){if(!E9(r)&&!Vg(r))throw r}finally{try{Oe.unlinkSync(t[1])}catch(r){Vg(r)||(e=r)}}if(e!==null)throw e}function Hg(t,e,r,n){let o=Jl(D9,[e,t],n),i=Jl(g9,[e,t],n,o);return r.keep||ia.unshift(o),n?o:i}function NF(t,e,r){let n=e.unsafeCleanup?f9:Oe.rmdir.bind(Oe),o=e.unsafeCleanup?jF:RF,i=Jl(o,t,r),a=Jl(n,t,r,i);return e.keep||ia.unshift(i),r?i:a}function Jl(t,e,r,n){let o=!1;return function i(a){if(!o){let s=n||i,u=ia.indexOf(s);return u>=0&&ia.splice(u,1),o=!0,r||t===RF||t===jF?t(e):t(e,a||function(){})}}}function y9(){if(BF)for(;ia.length;)try{ia[0]()}catch{}}function AF(t){let e=[],r=null;try{r=SF.randomBytes(t)}catch{r=SF.pseudoRandomBytes(t)}for(let n=0;n<t;n++)e.push(FF[r[n]%FF.length]);return e.join("")}function Jt(t){return typeof t>"u"}function aa(t,e){if(typeof t=="function")return[{},t];if(Jt(t))return[{},e];let r={};for(let n of Object.getOwnPropertyNames(t))r[n]=t[n];return[r,e]}function b9(t,e,r){let n=gt.isAbsolute(t)?t:gt.join(e,t);Oe.stat(n,function(o){o?Oe.realpath(gt.dirname(n),function(i,a){if(i)return r(i);r(null,gt.join(a,gt.basename(n)))}):Oe.realpath(n,r)})}function v9(t,e){let r=gt.isAbsolute(t)?t:gt.join(e,t);try{return Oe.statSync(r),Oe.realpathSync(r)}catch{let o=Oe.realpathSync(gt.dirname(r));return gt.join(o,gt.basename(r))}}function LF(t){let e=t.tmpdir;if(!Jt(t.name))return gt.join(e,t.dir,t.name);if(!Jt(t.template))return gt.join(e,t.dir,t.template).replace($F,AF(6));let r=[t.prefix?t.prefix:"tmp","-",process.pid,"-",AF(12),t.postfix?"-"+t.postfix:""].join("");return gt.join(e,t.dir,r)}function UF(t){if(!Jt(t.name)){let e=t.name;if(gt.isAbsolute(e))throw new Error(`name option must not contain an absolute path, found "${e}".`);let r=gt.basename(e);if(r===".."||r==="."||r!==e)throw new Error(`name option must not contain a path, found "${e}".`)}if(!Jt(t.template)&&!t.template.match($F))throw new Error(`Invalid template, found "${t.template}".`);if(!Jt(t.tries)&&isNaN(t.tries)||t.tries<0)throw new Error(`Invalid tries, found "${t.tries}".`);t.tries=Jt(t.name)?t.tries||a9:1,t.keep=!!t.keep,t.detachDescriptor=!!t.detachDescriptor,t.discardDescriptor=!!t.discardDescriptor,t.unsafeCleanup=!!t.unsafeCleanup,t.prefix=Jt(t.prefix)?"":t.prefix,t.postfix=Jt(t.postfix)?"":t.postfix}function OF(t,e,r,n){if(Jt(e))return n(null);b9(e,r,function(o,i){if(o)return n(o);let a=gt.relative(r,i);if(!i.startsWith(r))return n(new Error(`${t} option must be relative to "${r}", found "${a}".`));n(null,a)})}function kF(t,e,r){if(Jt(e))return;let n=v9(e,r),o=gt.relative(r,n);if(!n.startsWith(r))throw new Error(`${t} option must be relative to "${r}", found "${o}".`);return o}function w9(t,e){x9(t,function(r,n){if(r)return e(r);t.tmpdir=n;try{UF(t,n)}catch(o){return e(o)}OF("dir",t.dir,n,function(o,i){if(o)return e(o);t.dir=Jt(i)?"":i,OF("template",t.template,n,function(a,s){if(a)return e(a);t.template=s,e(null,t)})})})}function C9(t){let e=t.tmpdir=qF(t);UF(t,e);let r=kF("dir",t.dir,e);return t.dir=Jt(r)?"":r,t.template=kF("template",t.template,e),t}function E9(t){return MF(t,-u9,"EBADF")}function Vg(t){return MF(t,-c9,"ENOENT")}function MF(t,e,r){return s9?t.code===r:t.code===r&&t.errno===e}function _9(){BF=!0}function x9(t,e){return Oe.realpath(t&&t.tmpdir||Xl.tmpdir(),e)}function qF(t){return Oe.realpathSync(t&&t.tmpdir||Xl.tmpdir())}process.addListener(l9,y9);Object.defineProperty(un.exports,"tmpdir",{enumerable:!0,configurable:!1,get:function(){return qF()}});un.exports.dir=h9;un.exports.dirSync=m9;un.exports.file=p9;un.exports.fileSync=d9;un.exports.tmpName=zg;un.exports.tmpNameSync=Gg;un.exports.setGracefulCleanup=_9});var ef=require("node:process");var mD=ge(hD(),1),{program:pt,createCommand:i7,createArgument:a7,createOption:s7,CommanderError:u7,InvalidArgumentError:c7,InvalidOptionArgumentError:l7,Command:f7,Argument:p7,Option:d7,Help:h7}=mD.default;var mr={name:"@capgo/cli",version:"8.0.0-alpha.3",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",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:"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"},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.25.11",eslint:"^9.38.0","git-format-staged":"3.1.1",husky:"^9.1.7","is-wsl":"^3.1.0",open:"^10.1.2",prettyjson:"^1.2.5",tmp:"^0.2.5","tus-js-client":"^4.3.1",typescript:"^5.9.3"}};var Xi=require("node:fs");var Dt=ge(Cf(),1),Ro=require("node:process"),ln=ge(require("node:readline"),1),Ff=ge(require("node:readline"),1),SD=require("node:stream"),FD=ge(_f(),1);function SA({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 FA=SA();function AD(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(FA,"")}function OD(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var kD={exports:{}};(function(t){var e={};t.exports=e,e.eastAsianWidth=function(n){var o=n.charCodeAt(0),i=n.length==2?n.charCodeAt(1):0,a=o;return 55296<=o&&o<=56319&&56320<=i&&i<=57343&&(o&=1023,i&=1023,a=o<<10|i,a+=65536),a==12288||65281<=a&&a<=65376||65504<=a&&a<=65510?"F":a==8361||65377<=a&&a<=65470||65474<=a&&a<=65479||65482<=a&&a<=65487||65490<=a&&a<=65495||65498<=a&&a<=65500||65512<=a&&a<=65518?"H":4352<=a&&a<=4447||4515<=a&&a<=4519||4602<=a&&a<=4607||9001<=a&&a<=9002||11904<=a&&a<=11929||11931<=a&&a<=12019||12032<=a&&a<=12245||12272<=a&&a<=12283||12289<=a&&a<=12350||12353<=a&&a<=12438||12441<=a&&a<=12543||12549<=a&&a<=12589||12593<=a&&a<=12686||12688<=a&&a<=12730||12736<=a&&a<=12771||12784<=a&&a<=12830||12832<=a&&a<=12871||12880<=a&&a<=13054||13056<=a&&a<=19903||19968<=a&&a<=42124||42128<=a&&a<=42182||43360<=a&&a<=43388||44032<=a&&a<=55203||55216<=a&&a<=55238||55243<=a&&a<=55291||63744<=a&&a<=64255||65040<=a&&a<=65049||65072<=a&&a<=65106||65108<=a&&a<=65126||65128<=a&&a<=65131||110592<=a&&a<=110593||127488<=a&&a<=127490||127504<=a&&a<=127546||127552<=a&&a<=127560||127568<=a&&a<=127569||131072<=a&&a<=194367||177984<=a&&a<=196605||196608<=a&&a<=262141?"W":32<=a&&a<=126||162<=a&&a<=163||165<=a&&a<=166||a==172||a==175||10214<=a&&a<=10221||10629<=a&&a<=10630?"Na":a==161||a==164||167<=a&&a<=168||a==170||173<=a&&a<=174||176<=a&&a<=180||182<=a&&a<=186||188<=a&&a<=191||a==198||a==208||215<=a&&a<=216||222<=a&&a<=225||a==230||232<=a&&a<=234||236<=a&&a<=237||a==240||242<=a&&a<=243||247<=a&&a<=250||a==252||a==254||a==257||a==273||a==275||a==283||294<=a&&a<=295||a==299||305<=a&&a<=307||a==312||319<=a&&a<=322||a==324||328<=a&&a<=331||a==333||338<=a&&a<=339||358<=a&&a<=359||a==363||a==462||a==464||a==466||a==468||a==470||a==472||a==474||a==476||a==593||a==609||a==708||a==711||713<=a&&a<=715||a==717||a==720||728<=a&&a<=731||a==733||a==735||768<=a&&a<=879||913<=a&&a<=929||931<=a&&a<=937||945<=a&&a<=961||963<=a&&a<=969||a==1025||1040<=a&&a<=1103||a==1105||a==8208||8211<=a&&a<=8214||8216<=a&&a<=8217||8220<=a&&a<=8221||8224<=a&&a<=8226||8228<=a&&a<=8231||a==8240||8242<=a&&a<=8243||a==8245||a==8251||a==8254||a==8308||a==8319||8321<=a&&a<=8324||a==8364||a==8451||a==8453||a==8457||a==8467||a==8470||8481<=a&&a<=8482||a==8486||a==8491||8531<=a&&a<=8532||8539<=a&&a<=8542||8544<=a&&a<=8555||8560<=a&&a<=8569||a==8585||8592<=a&&a<=8601||8632<=a&&a<=8633||a==8658||a==8660||a==8679||a==8704||8706<=a&&a<=8707||8711<=a&&a<=8712||a==8715||a==8719||a==8721||a==8725||a==8730||8733<=a&&a<=8736||a==8739||a==8741||8743<=a&&a<=8748||a==8750||8756<=a&&a<=8759||8764<=a&&a<=8765||a==8776||a==8780||a==8786||8800<=a&&a<=8801||8804<=a&&a<=8807||8810<=a&&a<=8811||8814<=a&&a<=8815||8834<=a&&a<=8835||8838<=a&&a<=8839||a==8853||a==8857||a==8869||a==8895||a==8978||9312<=a&&a<=9449||9451<=a&&a<=9547||9552<=a&&a<=9587||9600<=a&&a<=9615||9618<=a&&a<=9621||9632<=a&&a<=9633||9635<=a&&a<=9641||9650<=a&&a<=9651||9654<=a&&a<=9655||9660<=a&&a<=9661||9664<=a&&a<=9665||9670<=a&&a<=9672||a==9675||9678<=a&&a<=9681||9698<=a&&a<=9701||a==9711||9733<=a&&a<=9734||a==9737||9742<=a&&a<=9743||9748<=a&&a<=9749||a==9756||a==9758||a==9792||a==9794||9824<=a&&a<=9825||9827<=a&&a<=9829||9831<=a&&a<=9834||9836<=a&&a<=9837||a==9839||9886<=a&&a<=9887||9918<=a&&a<=9919||9924<=a&&a<=9933||9935<=a&&a<=9953||a==9955||9960<=a&&a<=9983||a==10045||a==10071||10102<=a&&a<=10111||11093<=a&&a<=11097||12872<=a&&a<=12879||57344<=a&&a<=63743||65024<=a&&a<=65039||a==65533||127232<=a&&a<=127242||127248<=a&&a<=127277||127280<=a&&a<=127337||127344<=a&&a<=127386||917760<=a&&a<=917999||983040<=a&&a<=1048573||1048576<=a&&a<=1114109?"A":"N"},e.characterLength=function(n){var o=this.eastAsianWidth(n);return o=="F"||o=="W"||o=="A"?2:1};function r(n){return n.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}e.length=function(n){for(var o=r(n),i=0,a=0;a<o.length;a++)i=i+this.characterLength(o[a]);return i},e.slice=function(n,o,i){textLen=e.length(n),o=o||0,i=i||1,o<0&&(o=textLen+o),i<0&&(i=textLen+i);for(var a="",s=0,u=r(n),c=0;c<u.length;c++){var l=u[c],f=e.length(l);if(s>=o-(f==2?1:0))if(s+f<=i)a+=l;else break;s+=f}return a}})(kD);var AA=kD.exports,OA=OD(AA),kA=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},$A=OD(kA);function la(t,e={}){if(typeof t!="string"||t.length===0||(e={ambiguousIsNarrow:!0,...e},t=AD(t),t.length===0))return 0;t=t.replace($A()," ");let r=e.ambiguousIsNarrow?1:2,n=0;for(let o of t){let i=o.codePointAt(0);if(!(i<=31||i>=127&&i<=159||i>=768&&i<=879))switch(OA.eastAsianWidth(o)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}var xf=10,bD=(t=0)=>e=>`\x1B[${e+t}m`,vD=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,wD=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`,Be={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(Be.modifier);var PA=Object.keys(Be.color),TA=Object.keys(Be.bgColor);[...PA,...TA];function IA(){let t=new Map;for(let[e,r]of Object.entries(Be)){for(let[n,o]of Object.entries(r))Be[n]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},r[n]=Be[n],t.set(o[0],o[1]);Object.defineProperty(Be,e,{value:r,enumerable:!1})}return Object.defineProperty(Be,"codes",{value:t,enumerable:!1}),Be.color.close="\x1B[39m",Be.bgColor.close="\x1B[49m",Be.color.ansi=bD(),Be.color.ansi256=vD(),Be.color.ansi16m=wD(),Be.bgColor.ansi=bD(xf),Be.bgColor.ansi256=vD(xf),Be.bgColor.ansi16m=wD(xf),Object.defineProperties(Be,{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(i=>i+i).join(""));let o=Number.parseInt(n,16);return[o>>16&255,o>>8&255,o&255]},enumerable:!1},hexToAnsi256:{value:e=>Be.rgbToAnsi256(...Be.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value:e=>{if(e<8)return 30+e;if(e<16)return 90+(e-8);let r,n,o;if(e>=232)r=((e-232)*10+8)/255,n=r,o=r;else{e-=16;let s=e%36;r=Math.floor(e/36)/5,n=Math.floor(s/6)/5,o=s%6/5}let i=Math.max(r,n,o)*2;if(i===0)return 30;let a=30+(Math.round(o)<<2|Math.round(n)<<1|Math.round(r));return i===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(e,r,n)=>Be.ansi256ToAnsi(Be.rgbToAnsi256(e,r,n)),enumerable:!1},hexToAnsi:{value:e=>Be.ansi256ToAnsi(Be.hexToAnsi256(e)),enumerable:!1}}),Be}var RA=IA(),Ws=new Set(["\x1B","\x9B"]),BA=39,Of="\x07",$D="[",jA="]",PD="m",kf=`${jA}8;;`,CD=t=>`${Ws.values().next().value}${$D}${t}${PD}`,ED=t=>`${Ws.values().next().value}${kf}${t}${Of}`,NA=t=>t.split(" ").map(e=>la(e)),Sf=(t,e,r)=>{let n=[...e],o=!1,i=!1,a=la(AD(t[t.length-1]));for(let[s,u]of n.entries()){let c=la(u);if(a+c<=r?t[t.length-1]+=u:(t.push(u),a=0),Ws.has(u)&&(o=!0,i=n.slice(s+1).join("").startsWith(kf)),o){i?u===Of&&(o=!1,i=!1):u===PD&&(o=!1);continue}a+=c,a===r&&s<n.length-1&&(t.push(""),a=0)}!a&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},LA=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(la(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},UA=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",o,i,a=NA(t),s=[""];for(let[c,l]of t.split(" ").entries()){r.trim!==!1&&(s[s.length-1]=s[s.length-1].trimStart());let f=la(s[s.length-1]);if(c!==0&&(f>=e&&(r.wordWrap===!1||r.trim===!1)&&(s.push(""),f=0),(f>0||r.trim===!1)&&(s[s.length-1]+=" ",f++)),r.hard&&a[c]>e){let d=e-f,h=1+Math.floor((a[c]-d-1)/e);Math.floor((a[c]-1)/e)<h&&s.push(""),Sf(s,l,e);continue}if(f+a[c]>e&&f>0&&a[c]>0){if(r.wordWrap===!1&&f<e){Sf(s,l,e);continue}s.push("")}if(f+a[c]>e&&r.wordWrap===!1){Sf(s,l,e);continue}s[s.length-1]+=l}r.trim!==!1&&(s=s.map(c=>LA(c)));let u=[...s.join(`
105
- `)];for(let[c,l]of u.entries()){if(n+=l,Ws.has(l)){let{groups:d}=new RegExp(`(?:\\${$D}(?<code>\\d+)m|\\${kf}(?<uri>.*)${Of})`).exec(u.slice(c).join(""))||{groups:{}};if(d.code!==void 0){let h=Number.parseFloat(d.code);o=h===BA?void 0:h}else d.uri!==void 0&&(i=d.uri.length===0?void 0:d.uri)}let f=RA.codes.get(Number(o));u[c+1]===`
106
- `?(i&&(n+=ED("")),o&&f&&(n+=CD(f))):l===`
107
- `&&(o&&f&&(n+=CD(o)),i&&(n+=ED(i)))}return n};function _D(t,e,r){return String(t).normalize().replace(/\r\n/g,`
102
+ `}});function v5(){try{return Nm.default.statSync("/.dockerenv"),!0}catch{return!1}}function C5(){try{return Nm.default.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function Lm(){return jm===void 0&&(jm=v5()||C5()),jm}var Nm,jm,d1=tt(()=>{Nm=me(require("node:fs"),1)});function Vi(){return Um===void 0&&(Um=E5()||Lm()),Um}var h1,Um,E5,Mm=tt(()=>{h1=me(require("node:fs"),1);d1();E5=()=>{try{return h1.default.statSync("/run/.containerenv"),!0}catch{return!1}}});var qm,g1,D1,m1,$n,Hm=tt(()=>{qm=me(require("node:process"),1),g1=me(require("node:os"),1),D1=me(require("node:fs"),1);Mm();m1=()=>{if(qm.default.platform!=="linux")return!1;if(g1.default.release().toLowerCase().includes("microsoft"))return!Vi();try{return D1.default.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!Vi():!1}catch{return!1}},$n=qm.default.env.__IS_WSL_TEST__?m1:m1()});var Vm,bs,_5,x5,zm,y1=tt(()=>{Vm=me(require("node:process"),1),bs=me(require("node:fs/promises"),1);Hm();Hm();_5=(()=>{let t="/mnt/",e;return async function(){if(e)return e;let r="/etc/wsl.conf",n=!1;try{await bs.default.access(r,bs.constants.F_OK),n=!0}catch{}if(!n)return t;let o=await bs.default.readFile(r,{encoding:"utf8"}),i=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(o);return i?(e=i.groups.mountPoint.trim(),e=e.endsWith("/")?e:`${e}/`,e):t}})(),x5=async()=>`${await _5()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,zm=async()=>$n?x5():`${Vm.default.env.SYSTEMROOT||Vm.default.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`});function Pn(t,e,r){let n=o=>Object.defineProperty(t,e,{value:o,enumerable:!0,writable:!0});return Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get(){let o=r();return n(o),o},set(o){n(o)}}),t}var b1=tt(()=>{});async function Gm(){if(v1.default.platform!=="darwin")throw new Error("macOS only");let{stdout:t}=await S5("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]);return/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(t)?.groups.id??"com.apple.Safari"}var w1,v1,C1,S5,E1=tt(()=>{w1=require("node:util"),v1=me(require("node:process"),1),C1=require("node:child_process"),S5=(0,w1.promisify)(C1.execFile)});async function S1(t,{humanReadableOutput:e=!0,signal:r}={}){if(_1.default.platform!=="darwin")throw new Error("macOS only");let n=e?[]:["-ss"],o={};r&&(o.signal=r);let{stdout:i}=await F5("osascript",["-e",t,n],o);return i.trim()}var _1,x1,Wm,F5,F1=tt(()=>{_1=me(require("node:process"),1),x1=require("node:util"),Wm=require("node:child_process"),F5=(0,x1.promisify)(Wm.execFile)});async function Km(t){return S1(`tell application "Finder" to set app_path to application file id "${t}" as string
103
+ tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}var A1=tt(()=>{F1()});async function Ym(t=A5){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 yl(`Cannot find Windows browser in stdout: ${JSON.stringify(e)}`);let{id:n}=r.groups,o=O5[n];if(!o)throw new yl(`Unknown browser ID: ${n}`);return o}var O1,k1,A5,O5,yl,$1=tt(()=>{O1=require("node:util"),k1=require("node:child_process"),A5=(0,O1.promisify)(k1.execFile),O5={AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},MSEdgeDHTML:{name:"Edge",id:"com.microsoft.edge"},MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"}},yl=class extends Error{}});async function Jm(){if(bl.default.platform==="darwin"){let t=await Gm();return{name:await Km(t),id:t}}if(bl.default.platform==="linux"){let{stdout:t}=await k5("xdg-mime",["query","default","x-scheme-handler/http"]),e=t.trim();return{name:$5(e.replace(/.desktop$/,"").replace("-"," ")),id:e}}if(bl.default.platform==="win32")return Ym();throw new Error("Only macOS, Linux, and Windows are supported")}var P1,bl,T1,k5,$5,I1=tt(()=>{P1=require("node:util"),bl=me(require("node:process"),1),T1=require("node:child_process");E1();A1();$1();k5=(0,P1.promisify)(T1.execFile),$5=t=>t.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase())});var rg={};qr(rg,{apps:()=>Tn,default:()=>B5,openApp:()=>R5});async function T5(){let t=await zm(),e=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,r=Qm.Buffer.from(e,"utf16le").toString("base64"),{stdout:n}=await P5(t,["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand",r],{encoding:"utf8"}),o=n.trim(),i={ChromeHTML:"com.google.chrome",BraveHTML:"com.brave.Browser",MSEdgeHTM:"com.microsoft.edge",FirefoxURL:"org.mozilla.firefox"};return i[o]?{id:i[o]}:{}}function N1(t){if(typeof t=="string"||Array.isArray(t))return t;let{[B1]:e}=t;if(!e)throw new Error(`${B1} is not supported`);return e}function vl({[zi]:t},{wsl:e}){if(e&&$n)return N1(e);if(!t)throw new Error(`${zi} is not supported`);return N1(t)}var Zm,Qm,eg,L1,U1,tg,wl,j5,P5,Xm,R1,zi,B1,j1,ws,I5,R5,Tn,B5,ng=tt(()=>{Zm=me(require("node:process"),1),Qm=require("node:buffer"),eg=me(require("node:path"),1),L1=require("node:url"),U1=require("node:util"),tg=me(require("node:child_process"),1),wl=me(require("node:fs/promises"),1);y1();b1();I1();Mm();j5={},P5=(0,U1.promisify)(tg.default.execFile),Xm=eg.default.dirname((0,L1.fileURLToPath)(j5.url)),R1=eg.default.join(Xm,"xdg-open"),{platform:zi,arch:B1}=Zm.default;j1=async(t,e)=>{let r;for(let n of t)try{return await e(n)}catch(o){r=o}throw r},ws=async t=>{if(t={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...t},Array.isArray(t.app))return j1(t.app,s=>ws({...t,app:s}));let{name:e,arguments:r=[]}=t.app??{};if(r=[...r],Array.isArray(e))return j1(e,s=>ws({...t,app:{name:s,arguments:r}}));if(e==="browser"||e==="browserPrivate"){let s={"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"},u={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},c=$n?await T5():await Jm();if(c.id in s){let l=s[c.id];return e==="browserPrivate"&&r.push(u[l]),ws({...t,app:{name:Tn[l],arguments:r}})}throw new Error(`${c.name} is not supported as a default browser`)}let n,o=[],i={};if(zi==="darwin")n="open",t.wait&&o.push("--wait-apps"),t.background&&o.push("--background"),t.newInstance&&o.push("--new"),e&&o.push("-a",e);else if(zi==="win32"||$n&&!Vi()&&!e){n=await zm(),o.push("-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"),$n||(i.windowsVerbatimArguments=!0);let s=["Start"];t.wait&&s.push("-Wait"),e?(s.push(`"\`"${e}\`""`),t.target&&r.push(t.target)):t.target&&s.push(`"${t.target}"`),r.length>0&&(r=r.map(u=>`"\`"${u}\`""`),s.push("-ArgumentList",r.join(","))),t.target=Qm.Buffer.from(s.join(" "),"utf16le").toString("base64")}else{if(e)n=e;else{let s=!Xm||Xm==="/",u=!1;try{await wl.default.access(R1,wl.constants.X_OK),u=!0}catch{}n=Zm.default.versions.electron??(zi==="android"||s||!u)?"xdg-open":R1}r.length>0&&o.push(...r),t.wait||(i.stdio="ignore",i.detached=!0)}zi==="darwin"&&r.length>0&&o.push("--args",...r),t.target&&o.push(t.target);let a=tg.default.spawn(n,o,i);return t.wait?new Promise((s,u)=>{a.once("error",u),a.once("close",c=>{if(!t.allowNonzeroExitCode&&c>0){u(new Error(`Exited with code ${c}`));return}s(a)})}):(a.unref(),a)},I5=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a `target`");return ws({...e,target:t})},R5=(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 ws({...e,app:{name:t,arguments:r}})};Tn={};Pn(Tn,"chrome",()=>vl({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium"]},{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"]}}));Pn(Tn,"brave",()=>vl({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"]}}));Pn(Tn,"firefox",()=>vl({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));Pn(Tn,"edge",()=>vl({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));Pn(Tn,"browser",()=>"browser");Pn(Tn,"browserPrivate",()=>"browserPrivate");B5=I5});var Vl=x(lr=>{"use strict";lr.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;lr.find=(t,e)=>t.nodes.find(r=>r.type===e);lr.exceedsLimit=(t,e,r=1,n)=>n===!1||!lr.isInteger(t)||!lr.isInteger(e)?!1:(Number(e)-Number(t))/Number(r)>=n;lr.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)};lr.encloseBrace=t=>t.type!=="brace"?!1:t.commas>>0+t.ranges>>0===0?(t.invalid=!0,!0):!1;lr.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;lr.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;lr.reduce=t=>t.reduce((e,r)=>(r.type==="text"&&e.push(r.value),r.type==="range"&&(r.type="text"),e),[]);lr.flatten=(...t)=>{let e=[],r=n=>{for(let o=0;o<n.length;o++){let i=n[o];if(Array.isArray(i)){r(i);continue}i!==void 0&&e.push(i)}return e};return r(t),e}});var zl=x((MY,r2)=>{"use strict";var t2=Vl();r2.exports=(t,e={})=>{let r=(n,o={})=>{let i=e.escapeInvalid&&t2.isInvalidBrace(o),a=n.invalid===!0&&e.escapeInvalid===!0,s="";if(n.value)return(i||a)&&t2.isOpenOrClose(n)?"\\"+n.value:n.value;if(n.value)return n.value;if(n.nodes)for(let u of n.nodes)s+=r(u);return s};return r(t)}});var o2=x((qY,n2)=>{"use strict";n2.exports=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}});var d2=x((HY,p2)=>{"use strict";var i2=o2(),Io=(t,e,r)=>{if(i2(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(i2(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 o=String(n.relaxZeros),i=String(n.shorthand),a=String(n.capture),s=String(n.wrap),u=t+":"+e+"="+o+i+a+s;if(Io.cache.hasOwnProperty(u))return Io.cache[u].result;let c=Math.min(t,e),l=Math.max(t,e);if(Math.abs(c-l)===1){let b=t+"|"+e;return n.capture?`(${b})`:n.wrap===!1?b:`(?:${b})`}let p=f2(t)||f2(e),d={min:t,max:e,a:c,b:l},h=[],m=[];if(p&&(d.isPadded=p,d.maxLen=String(d.max).length),c<0){let b=l<0?Math.abs(l):1;m=a2(b,Math.abs(c),d,n),c=d.a=0}return l>=0&&(h=a2(c,l,d,n)),d.negatives=m,d.positives=h,d.result=AU(m,h,n),n.capture===!0?d.result=`(${d.result})`:n.wrap!==!1&&h.length+m.length>1&&(d.result=`(?:${d.result})`),Io.cache[u]=d,d.result};function AU(t,e,r){let n=Sg(t,e,"-",!1,r)||[],o=Sg(e,t,"",!1,r)||[],i=Sg(t,e,"-?",!0,r)||[];return n.concat(i).concat(o).join("|")}function OU(t,e){let r=1,n=1,o=u2(t,r),i=new Set([e]);for(;t<=o&&o<=e;)i.add(o),r+=1,o=u2(t,r);for(o=c2(e+1,n)-1;t<o&&o<=e;)i.add(o),n+=1,o=c2(e+1,n)-1;return i=[...i],i.sort(PU),i}function kU(t,e,r){if(t===e)return{pattern:t,count:[],digits:0};let n=$U(t,e),o=n.length,i="",a=0;for(let s=0;s<o;s++){let[u,c]=n[s];u===c?i+=u:u!=="0"||c!=="9"?i+=TU(u,c,r):a++}return a&&(i+=r.shorthand===!0?"\\d":"[0-9]"),{pattern:i,count:[a],digits:o}}function a2(t,e,r,n){let o=OU(t,e),i=[],a=t,s;for(let u=0;u<o.length;u++){let c=o[u],l=kU(String(a),String(c),n),p="";if(!r.isPadded&&s&&s.pattern===l.pattern){s.count.length>1&&s.count.pop(),s.count.push(l.count[0]),s.string=s.pattern+l2(s.count),a=c+1;continue}r.isPadded&&(p=IU(c,r,n)),l.string=p+l.pattern+l2(l.count),i.push(l),a=c+1,s=l}return i}function Sg(t,e,r,n,o){let i=[];for(let a of t){let{string:s}=a;!n&&!s2(e,"string",s)&&i.push(r+s),n&&s2(e,"string",s)&&i.push(r+s)}return i}function $U(t,e){let r=[];for(let n=0;n<t.length;n++)r.push([t[n],e[n]]);return r}function PU(t,e){return t>e?1:e>t?-1:0}function s2(t,e,r){return t.some(n=>n[e]===r)}function u2(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function c2(t,e){return t-t%Math.pow(10,e)}function l2(t){let[e=0,r=""]=t;return r||e>1?`{${e+(r?","+r:"")}}`:""}function TU(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function f2(t){return/^-?(0+)\d/.test(t)}function IU(t,e,r){if(!e.isPadded)return t;let n=Math.abs(e.maxLen-String(t).length),o=r.relaxZeros!==!1;switch(n){case 0:return"";case 1:return o?"0?":"0";case 2:return o?"0{0,2}":"00";default:return o?`0{0,${n}}`:`0{${n}}`}}Io.cache={};Io.clearCache=()=>Io.cache={};p2.exports=Io});var Og=x((VY,w2)=>{"use strict";var RU=require("util"),m2=d2(),h2=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),BU=t=>e=>t===!0?Number(e):String(e),Fg=t=>typeof t=="number"||typeof t=="string"&&t!=="",ks=t=>Number.isInteger(+t),Ag=t=>{let e=`${t}`,r=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++r]==="0";);return r>0},jU=(t,e,r)=>typeof t=="string"||typeof e=="string"?!0:r.stringify===!0,NU=(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},Wl=(t,e)=>{let r=t[0]==="-"?"-":"";for(r&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return r?"-"+t:t},LU=(t,e,r)=>{t.negatives.sort((s,u)=>s<u?-1:s>u?1:0),t.positives.sort((s,u)=>s<u?-1:s>u?1:0);let n=e.capture?"":"?:",o="",i="",a;return t.positives.length&&(o=t.positives.map(s=>Wl(String(s),r)).join("|")),t.negatives.length&&(i=`-(${n}${t.negatives.map(s=>Wl(String(s),r)).join("|")})`),o&&i?a=`${o}|${i}`:a=o||i,e.wrap?`(${n}${a})`:a},g2=(t,e,r,n)=>{if(r)return m2(t,e,{wrap:!1,...n});let o=String.fromCharCode(t);if(t===e)return o;let i=String.fromCharCode(e);return`[${o}-${i}]`},D2=(t,e,r)=>{if(Array.isArray(t)){let n=r.wrap===!0,o=r.capture?"":"?:";return n?`(${o}${t.join("|")})`:t.join("|")}return m2(t,e,r)},y2=(...t)=>new RangeError("Invalid range arguments: "+RU.inspect(...t)),b2=(t,e,r)=>{if(r.strictRanges===!0)throw y2([t,e]);return[]},UU=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return[]},MU=(t,e,r=1,n={})=>{let o=Number(t),i=Number(e);if(!Number.isInteger(o)||!Number.isInteger(i)){if(n.strictRanges===!0)throw y2([t,e]);return[]}o===0&&(o=0),i===0&&(i=0);let a=o>i,s=String(t),u=String(e),c=String(r);r=Math.max(Math.abs(r),1);let l=Ag(s)||Ag(u)||Ag(c),p=l?Math.max(s.length,u.length,c.length):0,d=l===!1&&jU(t,e,n)===!1,h=n.transform||BU(d);if(n.toRegex&&r===1)return g2(Wl(t,p),Wl(e,p),!0,n);let m={negatives:[],positives:[]},b=E=>m[E<0?"negatives":"positives"].push(Math.abs(E)),D=[],C=0;for(;a?o>=i:o<=i;)n.toRegex===!0&&r>1?b(o):D.push(NU(h(o,C),p,d)),o=a?o-r:o+r,C++;return n.toRegex===!0?r>1?LU(m,n,p):D2(D,null,{wrap:!1,...n}):D},qU=(t,e,r=1,n={})=>{if(!ks(t)&&t.length>1||!ks(e)&&e.length>1)return b2(t,e,n);let o=n.transform||(d=>String.fromCharCode(d)),i=`${t}`.charCodeAt(0),a=`${e}`.charCodeAt(0),s=i>a,u=Math.min(i,a),c=Math.max(i,a);if(n.toRegex&&r===1)return g2(u,c,!1,n);let l=[],p=0;for(;s?i>=a:i<=a;)l.push(o(i,p)),i=s?i-r:i+r,p++;return n.toRegex===!0?D2(l,null,{wrap:!1,options:n}):l},Gl=(t,e,r,n={})=>{if(e==null&&Fg(t))return[t];if(!Fg(t)||!Fg(e))return b2(t,e,n);if(typeof r=="function")return Gl(t,e,1,{transform:r});if(h2(r))return Gl(t,e,0,r);let o={...n};return o.capture===!0&&(o.wrap=!0),r=r||o.step||1,ks(r)?ks(t)&&ks(e)?MU(t,e,r,o):qU(t,e,Math.max(Math.abs(r),1),o):r!=null&&!h2(r)?UU(r,o):Gl(t,e,1,r)};w2.exports=Gl});var E2=x((zY,C2)=>{"use strict";var HU=Og(),v2=Vl(),VU=(t,e={})=>{let r=(n,o={})=>{let i=v2.isInvalidBrace(o),a=n.invalid===!0&&e.escapeInvalid===!0,s=i===!0||a===!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 s?u+n.value:"(";if(n.type==="close")return s?u+n.value:")";if(n.type==="comma")return n.prev.type==="comma"?"":s?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let l=v2.reduce(n.nodes),p=HU(...l,{...e,wrap:!1,toRegex:!0,strictZeros:!0});if(p.length!==0)return l.length>1&&p.length>1?`(${p})`:p}if(n.nodes)for(let l of n.nodes)c+=r(l,n);return c};return r(t)};C2.exports=VU});var S2=x((GY,x2)=>{"use strict";var zU=Og(),_2=zl(),ia=Vl(),Ro=(t="",e="",r=!1)=>{let n=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return r?ia.flatten(e).map(o=>`{${o}}`):e;for(let o of t)if(Array.isArray(o))for(let i of o)n.push(Ro(i,e,r));else for(let i of e)r===!0&&typeof i=="string"&&(i=`{${i}}`),n.push(Array.isArray(i)?Ro(o,i,r):o+i);return ia.flatten(n)},GU=(t,e={})=>{let r=e.rangeLimit===void 0?1e3:e.rangeLimit,n=(o,i={})=>{o.queue=[];let a=i,s=i.queue;for(;a.type!=="brace"&&a.type!=="root"&&a.parent;)a=a.parent,s=a.queue;if(o.invalid||o.dollar){s.push(Ro(s.pop(),_2(o,e)));return}if(o.type==="brace"&&o.invalid!==!0&&o.nodes.length===2){s.push(Ro(s.pop(),["{}"]));return}if(o.nodes&&o.ranges>0){let p=ia.reduce(o.nodes);if(ia.exceedsLimit(...p,e.step,r))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let d=zU(...p,e);d.length===0&&(d=_2(o,e)),s.push(Ro(s.pop(),d)),o.nodes=[];return}let u=ia.encloseBrace(o),c=o.queue,l=o;for(;l.type!=="brace"&&l.type!=="root"&&l.parent;)l=l.parent,c=l.queue;for(let p=0;p<o.nodes.length;p++){let d=o.nodes[p];if(d.type==="comma"&&o.type==="brace"){p===1&&c.push(""),c.push("");continue}if(d.type==="close"){s.push(Ro(s.pop(),c,u));continue}if(d.value&&d.type!=="open"){c.push(Ro(c.pop(),d.value));continue}d.nodes&&n(d,o)}return c};return ia.flatten(n(t))};x2.exports=GU});var A2=x((WY,F2)=>{"use strict";F2.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:`
104
+ `,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 T2=x((KY,P2)=>{"use strict";var WU=zl(),{MAX_LENGTH:O2,CHAR_BACKSLASH:kg,CHAR_BACKTICK:KU,CHAR_COMMA:YU,CHAR_DOT:JU,CHAR_LEFT_PARENTHESES:XU,CHAR_RIGHT_PARENTHESES:ZU,CHAR_LEFT_CURLY_BRACE:QU,CHAR_RIGHT_CURLY_BRACE:eM,CHAR_LEFT_SQUARE_BRACKET:k2,CHAR_RIGHT_SQUARE_BRACKET:$2,CHAR_DOUBLE_QUOTE:tM,CHAR_SINGLE_QUOTE:rM,CHAR_NO_BREAK_SPACE:nM,CHAR_ZERO_WIDTH_NOBREAK_SPACE:oM}=A2(),iM=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let r=e||{},n=typeof r.maxLength=="number"?Math.min(O2,r.maxLength):O2;if(t.length>n)throw new SyntaxError(`Input length (${t.length}), exceeds max characters (${n})`);let o={type:"root",input:t,nodes:[]},i=[o],a=o,s=o,u=0,c=t.length,l=0,p=0,d,h=()=>t[l++],m=b=>{if(b.type==="text"&&s.type==="dot"&&(s.type="text"),s&&s.type==="text"&&b.type==="text"){s.value+=b.value;return}return a.nodes.push(b),b.parent=a,b.prev=s,s=b,b};for(m({type:"bos"});l<c;)if(a=i[i.length-1],d=h(),!(d===oM||d===nM)){if(d===kg){m({type:"text",value:(e.keepEscaping?d:"")+h()});continue}if(d===$2){m({type:"text",value:"\\"+d});continue}if(d===k2){u++;let b;for(;l<c&&(b=h());){if(d+=b,b===k2){u++;continue}if(b===kg){d+=h();continue}if(b===$2&&(u--,u===0))break}m({type:"text",value:d});continue}if(d===XU){a=m({type:"paren",nodes:[]}),i.push(a),m({type:"text",value:d});continue}if(d===ZU){if(a.type!=="paren"){m({type:"text",value:d});continue}a=i.pop(),m({type:"text",value:d}),a=i[i.length-1];continue}if(d===tM||d===rM||d===KU){let b=d,D;for(e.keepQuotes!==!0&&(d="");l<c&&(D=h());){if(D===kg){d+=D+h();continue}if(D===b){e.keepQuotes===!0&&(d+=D);break}d+=D}m({type:"text",value:d});continue}if(d===QU){p++;let D={type:"brace",open:!0,close:!1,dollar:s.value&&s.value.slice(-1)==="$"||a.dollar===!0,depth:p,commas:0,ranges:0,nodes:[]};a=m(D),i.push(a),m({type:"open",value:d});continue}if(d===eM){if(a.type!=="brace"){m({type:"text",value:d});continue}let b="close";a=i.pop(),a.close=!0,m({type:b,value:d}),p--,a=i[i.length-1];continue}if(d===YU&&p>0){if(a.ranges>0){a.ranges=0;let b=a.nodes.shift();a.nodes=[b,{type:"text",value:WU(a)}]}m({type:"comma",value:d}),a.commas++;continue}if(d===JU&&p>0&&a.commas===0){let b=a.nodes;if(p===0||b.length===0){m({type:"text",value:d});continue}if(s.type==="dot"){if(a.range=[],s.value+=d,s.type="range",a.nodes.length!==3&&a.nodes.length!==5){a.invalid=!0,a.ranges=0,s.type="text";continue}a.ranges++,a.args=[];continue}if(s.type==="range"){b.pop();let D=b[b.length-1];D.value+=s.value+d,s=D,a.ranges--;continue}m({type:"dot",value:d});continue}m({type:"text",value:d})}do if(a=i.pop(),a.type!=="root"){a.nodes.forEach(C=>{C.nodes||(C.type==="open"&&(C.isOpen=!0),C.type==="close"&&(C.isClose=!0),C.nodes||(C.type="text"),C.invalid=!0)});let b=i[i.length-1],D=b.nodes.indexOf(a);b.nodes.splice(D,1,...a.nodes)}while(i.length>0);return m({type:"eos"}),o};P2.exports=iM});var B2=x((YY,R2)=>{"use strict";var I2=zl(),aM=E2(),sM=S2(),uM=T2(),Kt=(t,e={})=>{let r=[];if(Array.isArray(t))for(let n of t){let o=Kt.create(n,e);Array.isArray(o)?r.push(...o):r.push(o)}else r=[].concat(Kt.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(r=[...new Set(r)]),r};Kt.parse=(t,e={})=>uM(t,e);Kt.stringify=(t,e={})=>I2(typeof t=="string"?Kt.parse(t,e):t,e);Kt.compile=(t,e={})=>(typeof t=="string"&&(t=Kt.parse(t,e)),aM(t,e));Kt.expand=(t,e={})=>{typeof t=="string"&&(t=Kt.parse(t,e));let r=sM(t,e);return e.noempty===!0&&(r=r.filter(Boolean)),e.nodupes===!0&&(r=[...new Set(r)]),r};Kt.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?Kt.compile(t,e):Kt.expand(t,e);R2.exports=Kt});var $s=x((JY,M2)=>{"use strict";var cM=require("path"),Nr="\\\\/",j2=`[^${Nr}]`,un="\\.",lM="\\+",fM="\\?",Kl="\\/",pM="(?=.)",N2="[^/]",$g=`(?:${Kl}|$)`,L2=`(?:^|${Kl})`,Pg=`${un}{1,2}${$g}`,dM=`(?!${un})`,hM=`(?!${L2}${Pg})`,mM=`(?!${un}{0,1}${$g})`,gM=`(?!${Pg})`,DM=`[^.${Kl}]`,yM=`${N2}*?`,U2={DOT_LITERAL:un,PLUS_LITERAL:lM,QMARK_LITERAL:fM,SLASH_LITERAL:Kl,ONE_CHAR:pM,QMARK:N2,END_ANCHOR:$g,DOTS_SLASH:Pg,NO_DOT:dM,NO_DOTS:hM,NO_DOT_SLASH:mM,NO_DOTS_SLASH:gM,QMARK_NO_DOT:DM,STAR:yM,START_ANCHOR:L2},bM={...U2,SLASH_LITERAL:`[${Nr}]`,QMARK:j2,STAR:`${j2}*?`,DOTS_SLASH:`${un}{1,2}(?:[${Nr}]|$)`,NO_DOT:`(?!${un})`,NO_DOTS:`(?!(?:^|[${Nr}])${un}{1,2}(?:[${Nr}]|$))`,NO_DOT_SLASH:`(?!${un}{0,1}(?:[${Nr}]|$))`,NO_DOTS_SLASH:`(?!${un}{1,2}(?:[${Nr}]|$))`,QMARK_NO_DOT:`[^.${Nr}]`,START_ANCHOR:`(?:^|[${Nr}])`,END_ANCHOR:`(?:[${Nr}]|$)`},wM={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"};M2.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:wM,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:cM.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?bM:U2}}});var Ps=x(Mt=>{"use strict";var vM=require("path"),CM=process.platform==="win32",{REGEX_BACKSLASH:EM,REGEX_REMOVE_BACKSLASH:_M,REGEX_SPECIAL_CHARS:xM,REGEX_SPECIAL_CHARS_GLOBAL:SM}=$s();Mt.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Mt.hasRegexChars=t=>xM.test(t);Mt.isRegexChar=t=>t.length===1&&Mt.hasRegexChars(t);Mt.escapeRegex=t=>t.replace(SM,"\\$1");Mt.toPosixSlashes=t=>t.replace(EM,"/");Mt.removeBackslashes=t=>t.replace(_M,e=>e==="\\"?"":e);Mt.supportsLookbehinds=()=>{let t=process.version.slice(1).split(".").map(Number);return t.length===3&&t[0]>=9||t[0]===8&&t[1]>=10};Mt.isWindows=t=>t&&typeof t.windows=="boolean"?t.windows:CM===!0||vM.sep==="\\";Mt.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Mt.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Mt.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Mt.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",o=r.contains?"":"$",i=`${n}(?:${t})${o}`;return e.negated===!0&&(i=`(?:^(?!${i}).*$)`),i}});var Y2=x((ZY,K2)=>{"use strict";var q2=Ps(),{CHAR_ASTERISK:Tg,CHAR_AT:FM,CHAR_BACKWARD_SLASH:Ts,CHAR_COMMA:AM,CHAR_DOT:Ig,CHAR_EXCLAMATION_MARK:Rg,CHAR_FORWARD_SLASH:W2,CHAR_LEFT_CURLY_BRACE:Bg,CHAR_LEFT_PARENTHESES:jg,CHAR_LEFT_SQUARE_BRACKET:OM,CHAR_PLUS:kM,CHAR_QUESTION_MARK:H2,CHAR_RIGHT_CURLY_BRACE:$M,CHAR_RIGHT_PARENTHESES:V2,CHAR_RIGHT_SQUARE_BRACKET:PM}=$s(),z2=t=>t===W2||t===Ts,G2=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},TM=(t,e)=>{let r=e||{},n=t.length-1,o=r.parts===!0||r.scanToEnd===!0,i=[],a=[],s=[],u=t,c=-1,l=0,p=0,d=!1,h=!1,m=!1,b=!1,D=!1,C=!1,E=!1,g=!1,_=!1,S=!1,$=0,k,B,R={value:"",depth:0,isGlob:!1},N=()=>c>=n,A=()=>u.charCodeAt(c+1),U=()=>(k=B,u.charCodeAt(++c));for(;c<n;){B=U();let w;if(B===Ts){E=R.backslashes=!0,B=U(),B===Bg&&(C=!0);continue}if(C===!0||B===Bg){for($++;N()!==!0&&(B=U());){if(B===Ts){E=R.backslashes=!0,U();continue}if(B===Bg){$++;continue}if(C!==!0&&B===Ig&&(B=U())===Ig){if(d=R.isBrace=!0,m=R.isGlob=!0,S=!0,o===!0)continue;break}if(C!==!0&&B===AM){if(d=R.isBrace=!0,m=R.isGlob=!0,S=!0,o===!0)continue;break}if(B===$M&&($--,$===0)){C=!1,d=R.isBrace=!0,S=!0;break}}if(o===!0)continue;break}if(B===W2){if(i.push(c),a.push(R),R={value:"",depth:0,isGlob:!1},S===!0)continue;if(k===Ig&&c===l+1){l+=2;continue}p=c+1;continue}if(r.noext!==!0&&(B===kM||B===FM||B===Tg||B===H2||B===Rg)===!0&&A()===jg){if(m=R.isGlob=!0,b=R.isExtglob=!0,S=!0,B===Rg&&c===l&&(_=!0),o===!0){for(;N()!==!0&&(B=U());){if(B===Ts){E=R.backslashes=!0,B=U();continue}if(B===V2){m=R.isGlob=!0,S=!0;break}}continue}break}if(B===Tg){if(k===Tg&&(D=R.isGlobstar=!0),m=R.isGlob=!0,S=!0,o===!0)continue;break}if(B===H2){if(m=R.isGlob=!0,S=!0,o===!0)continue;break}if(B===OM){for(;N()!==!0&&(w=U());){if(w===Ts){E=R.backslashes=!0,U();continue}if(w===PM){h=R.isBracket=!0,m=R.isGlob=!0,S=!0;break}}if(o===!0)continue;break}if(r.nonegate!==!0&&B===Rg&&c===l){g=R.negated=!0,l++;continue}if(r.noparen!==!0&&B===jg){if(m=R.isGlob=!0,o===!0){for(;N()!==!0&&(B=U());){if(B===jg){E=R.backslashes=!0,B=U();continue}if(B===V2){S=!0;break}}continue}break}if(m===!0){if(S=!0,o===!0)continue;break}}r.noext===!0&&(b=!1,m=!1);let M=u,Q="",P="";l>0&&(Q=u.slice(0,l),u=u.slice(l),p-=l),M&&m===!0&&p>0?(M=u.slice(0,p),P=u.slice(p)):m===!0?(M="",P=u):M=u,M&&M!==""&&M!=="/"&&M!==u&&z2(M.charCodeAt(M.length-1))&&(M=M.slice(0,-1)),r.unescape===!0&&(P&&(P=q2.removeBackslashes(P)),M&&E===!0&&(M=q2.removeBackslashes(M)));let y={prefix:Q,input:t,start:l,base:M,glob:P,isBrace:d,isBracket:h,isGlob:m,isExtglob:b,isGlobstar:D,negated:g,negatedExtglob:_};if(r.tokens===!0&&(y.maxDepth=0,z2(B)||a.push(R),y.tokens=a),r.parts===!0||r.tokens===!0){let w;for(let v=0;v<i.length;v++){let F=w?w+1:l,I=i[v],O=t.slice(F,I);r.tokens&&(v===0&&l!==0?(a[v].isPrefix=!0,a[v].value=Q):a[v].value=O,G2(a[v]),y.maxDepth+=a[v].depth),(v!==0||O!=="")&&s.push(O),w=I}if(w&&w+1<t.length){let v=t.slice(w+1);s.push(v),r.tokens&&(a[a.length-1].value=v,G2(a[a.length-1]),y.maxDepth+=a[a.length-1].depth)}y.slashes=i,y.parts=s}return y};K2.exports=TM});var Z2=x((QY,X2)=>{"use strict";var Yl=$s(),Yt=Ps(),{MAX_LENGTH:Jl,POSIX_REGEX_SOURCE:IM,REGEX_NON_SPECIAL_CHARS:RM,REGEX_SPECIAL_CHARS_BACKREF:BM,REPLACEMENTS:J2}=Yl,jM=(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(o=>Yt.escapeRegex(o)).join("..")}return r},aa=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,Ng=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=J2[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(Jl,r.maxLength):Jl,o=t.length;if(o>n)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${n}`);let i={type:"bos",value:"",output:r.prepend||""},a=[i],s=r.capture?"":"?:",u=Yt.isWindows(e),c=Yl.globChars(u),l=Yl.extglobChars(c),{DOT_LITERAL:p,PLUS_LITERAL:d,SLASH_LITERAL:h,ONE_CHAR:m,DOTS_SLASH:b,NO_DOT:D,NO_DOT_SLASH:C,NO_DOTS_SLASH:E,QMARK:g,QMARK_NO_DOT:_,STAR:S,START_ANCHOR:$}=c,k=G=>`(${s}(?:(?!${$}${G.dot?b:p}).)*?)`,B=r.dot?"":D,R=r.dot?g:_,N=r.bash===!0?k(r):S;r.capture&&(N=`(${N})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let A={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:a};t=Yt.removePrefix(t,A),o=t.length;let U=[],M=[],Q=[],P=i,y,w=()=>A.index===o-1,v=A.peek=(G=1)=>t[A.index+G],F=A.advance=()=>t[++A.index]||"",I=()=>t.slice(A.index+1),O=(G="",Ee=0)=>{A.consumed+=G,A.index+=Ee},q=G=>{A.output+=G.output!=null?G.output:G.value,O(G.value)},T=()=>{let G=1;for(;v()==="!"&&(v(2)!=="("||v(3)==="?");)F(),A.start++,G++;return G%2===0?!1:(A.negated=!0,A.start++,!0)},j=G=>{A[G]++,Q.push(G)},ee=G=>{A[G]--,Q.pop()},V=G=>{if(P.type==="globstar"){let Ee=A.braces>0&&(G.type==="comma"||G.type==="brace"),H=G.extglob===!0||U.length&&(G.type==="pipe"||G.type==="paren");G.type!=="slash"&&G.type!=="paren"&&!Ee&&!H&&(A.output=A.output.slice(0,-P.output.length),P.type="star",P.value="*",P.output=N,A.output+=P.output)}if(U.length&&G.type!=="paren"&&(U[U.length-1].inner+=G.value),(G.value||G.output)&&q(G),P&&P.type==="text"&&G.type==="text"){P.value+=G.value,P.output=(P.output||"")+G.value;return}G.prev=P,a.push(G),P=G},se=(G,Ee)=>{let H={...l[Ee],conditions:1,inner:""};H.prev=P,H.parens=A.parens,H.output=A.output;let ue=(r.capture?"(":"")+H.open;j("parens"),V({type:G,value:Ee,output:A.output?"":m}),V({type:"paren",extglob:!0,value:F(),output:ue}),U.push(H)},dr=G=>{let Ee=G.close+(r.capture?")":""),H;if(G.type==="negate"){let ue=N;if(G.inner&&G.inner.length>1&&G.inner.includes("/")&&(ue=k(r)),(ue!==N||w()||/^\)+$/.test(I()))&&(Ee=G.close=`)$))${ue}`),G.inner.includes("*")&&(H=I())&&/^\.[^\\/.]+$/.test(H)){let Me=Ng(H,{...e,fastpaths:!1}).output;Ee=G.close=`)${Me})${ue})`}G.prev.type==="bos"&&(A.negatedExtglob=!0)}V({type:"paren",extglob:!0,value:y,output:Ee}),ee("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let G=!1,Ee=t.replace(BM,(H,ue,Me,vt,et,af)=>vt==="\\"?(G=!0,H):vt==="?"?ue?ue+vt+(et?g.repeat(et.length):""):af===0?R+(et?g.repeat(et.length):""):g.repeat(Me.length):vt==="."?p.repeat(Me.length):vt==="*"?ue?ue+vt+(et?N:""):N:ue?H:`\\${H}`);return G===!0&&(r.unescape===!0?Ee=Ee.replace(/\\/g,""):Ee=Ee.replace(/\\+/g,H=>H.length%2===0?"\\\\":H?"\\":"")),Ee===t&&r.contains===!0?(A.output=t,A):(A.output=Yt.wrapOutput(Ee,A,e),A)}for(;!w();){if(y=F(),y==="\0")continue;if(y==="\\"){let H=v();if(H==="/"&&r.bash!==!0||H==="."||H===";")continue;if(!H){y+="\\",V({type:"text",value:y});continue}let ue=/^\\+/.exec(I()),Me=0;if(ue&&ue[0].length>2&&(Me=ue[0].length,A.index+=Me,Me%2!==0&&(y+="\\")),r.unescape===!0?y=F():y+=F(),A.brackets===0){V({type:"text",value:y});continue}}if(A.brackets>0&&(y!=="]"||P.value==="["||P.value==="[^")){if(r.posix!==!1&&y===":"){let H=P.value.slice(1);if(H.includes("[")&&(P.posix=!0,H.includes(":"))){let ue=P.value.lastIndexOf("["),Me=P.value.slice(0,ue),vt=P.value.slice(ue+2),et=IM[vt];if(et){P.value=Me+et,A.backtrack=!0,F(),!i.output&&a.indexOf(P)===1&&(i.output=m);continue}}}(y==="["&&v()!==":"||y==="-"&&v()==="]")&&(y=`\\${y}`),y==="]"&&(P.value==="["||P.value==="[^")&&(y=`\\${y}`),r.posix===!0&&y==="!"&&P.value==="["&&(y="^"),P.value+=y,q({value:y});continue}if(A.quotes===1&&y!=='"'){y=Yt.escapeRegex(y),P.value+=y,q({value:y});continue}if(y==='"'){A.quotes=A.quotes===1?0:1,r.keepQuotes===!0&&V({type:"text",value:y});continue}if(y==="("){j("parens"),V({type:"paren",value:y});continue}if(y===")"){if(A.parens===0&&r.strictBrackets===!0)throw new SyntaxError(aa("opening","("));let H=U[U.length-1];if(H&&A.parens===H.parens+1){dr(U.pop());continue}V({type:"paren",value:y,output:A.parens?")":"\\)"}),ee("parens");continue}if(y==="["){if(r.nobracket===!0||!I().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(aa("closing","]"));y=`\\${y}`}else j("brackets");V({type:"bracket",value:y});continue}if(y==="]"){if(r.nobracket===!0||P&&P.type==="bracket"&&P.value.length===1){V({type:"text",value:y,output:`\\${y}`});continue}if(A.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(aa("opening","["));V({type:"text",value:y,output:`\\${y}`});continue}ee("brackets");let H=P.value.slice(1);if(P.posix!==!0&&H[0]==="^"&&!H.includes("/")&&(y=`/${y}`),P.value+=y,q({value:y}),r.literalBrackets===!1||Yt.hasRegexChars(H))continue;let ue=Yt.escapeRegex(P.value);if(A.output=A.output.slice(0,-P.value.length),r.literalBrackets===!0){A.output+=ue,P.value=ue;continue}P.value=`(${s}${ue}|${P.value})`,A.output+=P.value;continue}if(y==="{"&&r.nobrace!==!0){j("braces");let H={type:"brace",value:y,output:"(",outputIndex:A.output.length,tokensIndex:A.tokens.length};M.push(H),V(H);continue}if(y==="}"){let H=M[M.length-1];if(r.nobrace===!0||!H){V({type:"text",value:y,output:y});continue}let ue=")";if(H.dots===!0){let Me=a.slice(),vt=[];for(let et=Me.length-1;et>=0&&(a.pop(),Me[et].type!=="brace");et--)Me[et].type!=="dots"&&vt.unshift(Me[et].value);ue=jM(vt,r),A.backtrack=!0}if(H.comma!==!0&&H.dots!==!0){let Me=A.output.slice(0,H.outputIndex),vt=A.tokens.slice(H.tokensIndex);H.value=H.output="\\{",y=ue="\\}",A.output=Me;for(let et of vt)A.output+=et.output||et.value}V({type:"brace",value:y,output:ue}),ee("braces"),M.pop();continue}if(y==="|"){U.length>0&&U[U.length-1].conditions++,V({type:"text",value:y});continue}if(y===","){let H=y,ue=M[M.length-1];ue&&Q[Q.length-1]==="braces"&&(ue.comma=!0,H="|"),V({type:"comma",value:y,output:H});continue}if(y==="/"){if(P.type==="dot"&&A.index===A.start+1){A.start=A.index+1,A.consumed="",A.output="",a.pop(),P=i;continue}V({type:"slash",value:y,output:h});continue}if(y==="."){if(A.braces>0&&P.type==="dot"){P.value==="."&&(P.output=p);let H=M[M.length-1];P.type="dots",P.output+=y,P.value+=y,H.dots=!0;continue}if(A.braces+A.parens===0&&P.type!=="bos"&&P.type!=="slash"){V({type:"text",value:y,output:p});continue}V({type:"dot",value:y,output:p});continue}if(y==="?"){if(!(P&&P.value==="(")&&r.noextglob!==!0&&v()==="("&&v(2)!=="?"){se("qmark",y);continue}if(P&&P.type==="paren"){let ue=v(),Me=y;if(ue==="<"&&!Yt.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(P.value==="("&&!/[!=<:]/.test(ue)||ue==="<"&&!/<([!=]|\w+>)/.test(I()))&&(Me=`\\${y}`),V({type:"text",value:y,output:Me});continue}if(r.dot!==!0&&(P.type==="slash"||P.type==="bos")){V({type:"qmark",value:y,output:_});continue}V({type:"qmark",value:y,output:g});continue}if(y==="!"){if(r.noextglob!==!0&&v()==="("&&(v(2)!=="?"||!/[!=<:]/.test(v(3)))){se("negate",y);continue}if(r.nonegate!==!0&&A.index===0){T();continue}}if(y==="+"){if(r.noextglob!==!0&&v()==="("&&v(2)!=="?"){se("plus",y);continue}if(P&&P.value==="("||r.regex===!1){V({type:"plus",value:y,output:d});continue}if(P&&(P.type==="bracket"||P.type==="paren"||P.type==="brace")||A.parens>0){V({type:"plus",value:y});continue}V({type:"plus",value:d});continue}if(y==="@"){if(r.noextglob!==!0&&v()==="("&&v(2)!=="?"){V({type:"at",extglob:!0,value:y,output:""});continue}V({type:"text",value:y});continue}if(y!=="*"){(y==="$"||y==="^")&&(y=`\\${y}`);let H=RM.exec(I());H&&(y+=H[0],A.index+=H[0].length),V({type:"text",value:y});continue}if(P&&(P.type==="globstar"||P.star===!0)){P.type="star",P.star=!0,P.value+=y,P.output=N,A.backtrack=!0,A.globstar=!0,O(y);continue}let G=I();if(r.noextglob!==!0&&/^\([^?]/.test(G)){se("star",y);continue}if(P.type==="star"){if(r.noglobstar===!0){O(y);continue}let H=P.prev,ue=H.prev,Me=H.type==="slash"||H.type==="bos",vt=ue&&(ue.type==="star"||ue.type==="globstar");if(r.bash===!0&&(!Me||G[0]&&G[0]!=="/")){V({type:"star",value:y,output:""});continue}let et=A.braces>0&&(H.type==="comma"||H.type==="brace"),af=U.length&&(H.type==="pipe"||H.type==="paren");if(!Me&&H.type!=="paren"&&!et&&!af){V({type:"star",value:y,output:""});continue}for(;G.slice(0,3)==="/**";){let Ns=t[A.index+4];if(Ns&&Ns!=="/")break;G=G.slice(3),O("/**",3)}if(H.type==="bos"&&w()){P.type="globstar",P.value+=y,P.output=k(r),A.output=P.output,A.globstar=!0,O(y);continue}if(H.type==="slash"&&H.prev.type!=="bos"&&!vt&&w()){A.output=A.output.slice(0,-(H.output+P.output).length),H.output=`(?:${H.output}`,P.type="globstar",P.output=k(r)+(r.strictSlashes?")":"|$)"),P.value+=y,A.globstar=!0,A.output+=H.output+P.output,O(y);continue}if(H.type==="slash"&&H.prev.type!=="bos"&&G[0]==="/"){let Ns=G[1]!==void 0?"|$":"";A.output=A.output.slice(0,-(H.output+P.output).length),H.output=`(?:${H.output}`,P.type="globstar",P.output=`${k(r)}${h}|${h}${Ns})`,P.value+=y,A.output+=H.output+P.output,A.globstar=!0,O(y+F()),V({type:"slash",value:"/",output:""});continue}if(H.type==="bos"&&G[0]==="/"){P.type="globstar",P.value+=y,P.output=`(?:^|${h}|${k(r)}${h})`,A.output=P.output,A.globstar=!0,O(y+F()),V({type:"slash",value:"/",output:""});continue}A.output=A.output.slice(0,-P.output.length),P.type="globstar",P.output=k(r),P.value+=y,A.output+=P.output,A.globstar=!0,O(y);continue}let Ee={type:"star",value:y,output:N};if(r.bash===!0){Ee.output=".*?",(P.type==="bos"||P.type==="slash")&&(Ee.output=B+Ee.output),V(Ee);continue}if(P&&(P.type==="bracket"||P.type==="paren")&&r.regex===!0){Ee.output=y,V(Ee);continue}(A.index===A.start||P.type==="slash"||P.type==="dot")&&(P.type==="dot"?(A.output+=C,P.output+=C):r.dot===!0?(A.output+=E,P.output+=E):(A.output+=B,P.output+=B),v()!=="*"&&(A.output+=m,P.output+=m)),V(Ee)}for(;A.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(aa("closing","]"));A.output=Yt.escapeLast(A.output,"["),ee("brackets")}for(;A.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(aa("closing",")"));A.output=Yt.escapeLast(A.output,"("),ee("parens")}for(;A.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(aa("closing","}"));A.output=Yt.escapeLast(A.output,"{"),ee("braces")}if(r.strictSlashes!==!0&&(P.type==="star"||P.type==="bracket")&&V({type:"maybe_slash",value:"",output:`${h}?`}),A.backtrack===!0){A.output="";for(let G of A.tokens)A.output+=G.output!=null?G.output:G.value,G.suffix&&(A.output+=G.suffix)}return A};Ng.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(Jl,r.maxLength):Jl,o=t.length;if(o>n)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${n}`);t=J2[t]||t;let i=Yt.isWindows(e),{DOT_LITERAL:a,SLASH_LITERAL:s,ONE_CHAR:u,DOTS_SLASH:c,NO_DOT:l,NO_DOTS:p,NO_DOTS_SLASH:d,STAR:h,START_ANCHOR:m}=Yl.globChars(i),b=r.dot?p:l,D=r.dot?d:l,C=r.capture?"":"?:",E={negated:!1,prefix:""},g=r.bash===!0?".*?":h;r.capture&&(g=`(${g})`);let _=B=>B.noglobstar===!0?g:`(${C}(?:(?!${m}${B.dot?c:a}).)*?)`,S=B=>{switch(B){case"*":return`${b}${u}${g}`;case".*":return`${a}${u}${g}`;case"*.*":return`${b}${g}${a}${u}${g}`;case"*/*":return`${b}${g}${s}${u}${D}${g}`;case"**":return b+_(r);case"**/*":return`(?:${b}${_(r)}${s})?${D}${u}${g}`;case"**/*.*":return`(?:${b}${_(r)}${s})?${D}${g}${a}${u}${g}`;case"**/.*":return`(?:${b}${_(r)}${s})?${a}${u}${g}`;default:{let R=/^(.*?)\.(\w+)$/.exec(B);if(!R)return;let N=S(R[1]);return N?N+a+R[2]:void 0}}},$=Yt.removePrefix(t,E),k=S($);return k&&r.strictSlashes!==!0&&(k+=`${s}?`),k};X2.exports=Ng});var eF=x((eJ,Q2)=>{"use strict";var NM=require("path"),LM=Y2(),Lg=Z2(),Ug=Ps(),UM=$s(),MM=t=>t&&typeof t=="object"&&!Array.isArray(t),Ze=(t,e,r=!1)=>{if(Array.isArray(t)){let l=t.map(d=>Ze(d,e,r));return d=>{for(let h of l){let m=h(d);if(m)return m}return!1}}let n=MM(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let o=e||{},i=Ug.isWindows(e),a=n?Ze.compileRe(t,e):Ze.makeRe(t,e,!1,!0),s=a.state;delete a.state;let u=()=>!1;if(o.ignore){let l={...e,ignore:null,onMatch:null,onResult:null};u=Ze(o.ignore,l,r)}let c=(l,p=!1)=>{let{isMatch:d,match:h,output:m}=Ze.test(l,a,e,{glob:t,posix:i}),b={glob:t,state:s,regex:a,posix:i,input:l,output:m,match:h,isMatch:d};return typeof o.onResult=="function"&&o.onResult(b),d===!1?(b.isMatch=!1,p?b:!1):u(l)?(typeof o.onIgnore=="function"&&o.onIgnore(b),b.isMatch=!1,p?b:!1):(typeof o.onMatch=="function"&&o.onMatch(b),p?b:!0)};return r&&(c.state=s),c};Ze.test=(t,e,r,{glob:n,posix:o}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let i=r||{},a=i.format||(o?Ug.toPosixSlashes:null),s=t===n,u=s&&a?a(t):t;return s===!1&&(u=a?a(t):t,s=u===n),(s===!1||i.capture===!0)&&(i.matchBase===!0||i.basename===!0?s=Ze.matchBase(t,e,r,o):s=e.exec(u)),{isMatch:!!s,match:s,output:u}};Ze.matchBase=(t,e,r,n=Ug.isWindows(r))=>(e instanceof RegExp?e:Ze.makeRe(e,r)).test(NM.basename(t));Ze.isMatch=(t,e,r)=>Ze(e,r)(t);Ze.parse=(t,e)=>Array.isArray(t)?t.map(r=>Ze.parse(r,e)):Lg(t,{...e,fastpaths:!1});Ze.scan=(t,e)=>LM(t,e);Ze.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let o=e||{},i=o.contains?"":"^",a=o.contains?"":"$",s=`${i}(?:${t.output})${a}`;t&&t.negated===!0&&(s=`^(?!${s}).*$`);let u=Ze.toRegex(s,e);return n===!0&&(u.state=t),u};Ze.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let o={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(o.output=Lg.fastpaths(t,e)),o.output||(o=Lg(t,e)),Ze.compileRe(o,e,r,n)};Ze.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/$^/}};Ze.constants=UM;Q2.exports=Ze});var rF=x((tJ,tF)=>{"use strict";tF.exports=eF()});var uF=x((rJ,sF)=>{"use strict";var oF=require("util"),iF=B2(),Lr=rF(),Mg=Ps(),nF=t=>t===""||t==="./",aF=t=>{let e=t.indexOf("{");return e>-1&&t.indexOf("}",e)>-1},je=(t,e,r)=>{e=[].concat(e),t=[].concat(t);let n=new Set,o=new Set,i=new Set,a=0,s=l=>{i.add(l.output),r&&r.onResult&&r.onResult(l)};for(let l=0;l<e.length;l++){let p=Lr(String(e[l]),{...r,onResult:s},!0),d=p.state.negated||p.state.negatedExtglob;d&&a++;for(let h of t){let m=p(h,!0);(d?!m.isMatch:m.isMatch)&&(d?n.add(m.output):(n.delete(m.output),o.add(m.output)))}}let c=(a===e.length?[...i]:[...o]).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};je.match=je;je.matcher=(t,e)=>Lr(t,e);je.isMatch=(t,e,r)=>Lr(e,r)(t);je.any=je.isMatch;je.not=(t,e,r={})=>{e=[].concat(e).map(String);let n=new Set,o=[],i=s=>{r.onResult&&r.onResult(s),o.push(s.output)},a=new Set(je(t,e,{...r,onResult:i}));for(let s of o)a.has(s)||n.add(s);return[...n]};je.contains=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${oF.inspect(t)}"`);if(Array.isArray(e))return e.some(n=>je.contains(t,n,r));if(typeof e=="string"){if(nF(t)||nF(e))return!1;if(t.includes(e)||t.startsWith("./")&&t.slice(2).includes(e))return!0}return je.isMatch(t,e,{...r,contains:!0})};je.matchKeys=(t,e,r)=>{if(!Mg.isObject(t))throw new TypeError("Expected the first argument to be an object");let n=je(Object.keys(t),e,r),o={};for(let i of n)o[i]=t[i];return o};je.some=(t,e,r)=>{let n=[].concat(t);for(let o of[].concat(e)){let i=Lr(String(o),r);if(n.some(a=>i(a)))return!0}return!1};je.every=(t,e,r)=>{let n=[].concat(t);for(let o of[].concat(e)){let i=Lr(String(o),r);if(!n.every(a=>i(a)))return!1}return!0};je.all=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${oF.inspect(t)}"`);return[].concat(e).every(n=>Lr(n,r)(t))};je.capture=(t,e,r)=>{let n=Mg.isWindows(r),i=Lr.makeRe(String(t),{...r,capture:!0}).exec(n?Mg.toPosixSlashes(e):e);if(i)return i.slice(1).map(a=>a===void 0?"":a)};je.makeRe=(...t)=>Lr.makeRe(...t);je.scan=(...t)=>Lr.scan(...t);je.parse=(t,e)=>{let r=[];for(let n of[].concat(t||[]))for(let o of iF(String(n),e))r.push(Lr.parse(o,e));return r};je.braces=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return e&&e.nobrace===!0||!aF(t)?[t]:iF(t,e)};je.braceExpand=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return je.braces(t,{...e,expand:!0})};je.hasBraces=aF;sF.exports=je});var WF=x((eX,cn)=>{var $e=require("fs"),ef=require("os"),mt=require("path"),kF=require("crypto"),Mr={fs:$e.constants,os:ef.constants},$F="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",RF=/XXXXXX/,h9=3,BF=(Mr.O_CREAT||Mr.fs.O_CREAT)|(Mr.O_EXCL||Mr.fs.O_EXCL)|(Mr.O_RDWR||Mr.fs.O_RDWR),m9=ef.platform()==="win32",g9=Mr.EBADF||Mr.os.errno.EBADF,D9=Mr.ENOENT||Mr.os.errno.ENOENT,jF=448,NF=384,y9="exit",ua=[],LF=$e.rmdirSync.bind($e),UF=!1;function b9(t,e){return $e.rm(t,{recursive:!0},e)}function MF(t){return $e.rmSync(t,{recursive:!0})}function Kg(t,e){let r=ca(t,e),n=r[0],o=r[1];O9(n,function(i,a){if(i)return o(i);let s=a.tries;(function u(){try{let c=HF(a);$e.stat(c,function(l){if(!l)return s-- >0?u():o(new Error("Could not get a unique tmp filename, max tries reached "+c));o(null,c)})}catch(c){o(c)}})()})}function Yg(t){let e=ca(t),r=e[0],n=k9(r),o=n.tries;do{let i=HF(n);try{$e.statSync(i)}catch{return i}}while(o-- >0);throw new Error("Could not get a unique tmp filename, max tries reached")}function w9(t,e){let r=ca(t,e),n=r[0],o=r[1];Kg(n,function(a,s){if(a)return o(a);$e.open(s,BF,n.mode||NF,function(c,l){if(c)return o(c);if(n.discardDescriptor)return $e.close(l,function(d){return o(d,s,void 0,Gg(s,-1,n,!1))});{let p=n.discardDescriptor||n.detachDescriptor;o(null,s,l,Gg(s,p?-1:l,n,!1))}})})}function v9(t){let e=ca(t),r=e[0],n=r.discardDescriptor||r.detachDescriptor,o=Yg(r),i=$e.openSync(o,BF,r.mode||NF);return r.discardDescriptor&&($e.closeSync(i),i=void 0),{name:o,fd:i,removeCallback:Gg(o,n?-1:i,r,!0)}}function C9(t,e){let r=ca(t,e),n=r[0],o=r[1];Kg(n,function(a,s){if(a)return o(a);$e.mkdir(s,n.mode||jF,function(c){if(c)return o(c);o(null,s,qF(s,n,!1))})})}function E9(t){let e=ca(t),r=e[0],n=Yg(r);return $e.mkdirSync(n,r.mode||jF),{name:n,removeCallback:qF(n,r,!0)}}function _9(t,e){let r=function(n){if(n&&!Wg(n))return e(n);e()};0<=t[0]?$e.close(t[0],function(){$e.unlink(t[1],r)}):$e.unlink(t[1],r)}function x9(t){let e=null;try{0<=t[0]&&$e.closeSync(t[0])}catch(r){if(!$9(r)&&!Wg(r))throw r}finally{try{$e.unlinkSync(t[1])}catch(r){Wg(r)||(e=r)}}if(e!==null)throw e}function Gg(t,e,r,n){let o=Ql(x9,[e,t],n),i=Ql(_9,[e,t],n,o);return r.keep||ua.unshift(o),n?o:i}function qF(t,e,r){let n=e.unsafeCleanup?b9:$e.rmdir.bind($e),o=e.unsafeCleanup?MF:LF,i=Ql(o,t,r),a=Ql(n,t,r,i);return e.keep||ua.unshift(i),r?i:a}function Ql(t,e,r,n){let o=!1;return function i(a){if(!o){let s=n||i,u=ua.indexOf(s);return u>=0&&ua.splice(u,1),o=!0,r||t===LF||t===MF?t(e):t(e,a||function(){})}}}function S9(){if(UF)for(;ua.length;)try{ua[0]()}catch{}}function PF(t){let e=[],r=null;try{r=kF.randomBytes(t)}catch{r=kF.pseudoRandomBytes(t)}for(let n=0;n<t;n++)e.push($F[r[n]%$F.length]);return e.join("")}function Jt(t){return typeof t>"u"}function ca(t,e){if(typeof t=="function")return[{},t];if(Jt(t))return[{},e];let r={};for(let n of Object.getOwnPropertyNames(t))r[n]=t[n];return[r,e]}function F9(t,e,r){let n=mt.isAbsolute(t)?t:mt.join(e,t);$e.stat(n,function(o){o?$e.realpath(mt.dirname(n),function(i,a){if(i)return r(i);r(null,mt.join(a,mt.basename(n)))}):$e.realpath(n,r)})}function A9(t,e){let r=mt.isAbsolute(t)?t:mt.join(e,t);try{return $e.statSync(r),$e.realpathSync(r)}catch{let o=$e.realpathSync(mt.dirname(r));return mt.join(o,mt.basename(r))}}function HF(t){let e=t.tmpdir;if(!Jt(t.name))return mt.join(e,t.dir,t.name);if(!Jt(t.template))return mt.join(e,t.dir,t.template).replace(RF,PF(6));let r=[t.prefix?t.prefix:"tmp","-",process.pid,"-",PF(12),t.postfix?"-"+t.postfix:""].join("");return mt.join(e,t.dir,r)}function VF(t){if(!Jt(t.name)){let e=t.name;if(mt.isAbsolute(e))throw new Error(`name option must not contain an absolute path, found "${e}".`);let r=mt.basename(e);if(r===".."||r==="."||r!==e)throw new Error(`name option must not contain a path, found "${e}".`)}if(!Jt(t.template)&&!t.template.match(RF))throw new Error(`Invalid template, found "${t.template}".`);if(!Jt(t.tries)&&isNaN(t.tries)||t.tries<0)throw new Error(`Invalid tries, found "${t.tries}".`);t.tries=Jt(t.name)?t.tries||h9:1,t.keep=!!t.keep,t.detachDescriptor=!!t.detachDescriptor,t.discardDescriptor=!!t.discardDescriptor,t.unsafeCleanup=!!t.unsafeCleanup,t.prefix=Jt(t.prefix)?"":t.prefix,t.postfix=Jt(t.postfix)?"":t.postfix}function TF(t,e,r,n){if(Jt(e))return n(null);F9(e,r,function(o,i){if(o)return n(o);let a=mt.relative(r,i);if(!i.startsWith(r))return n(new Error(`${t} option must be relative to "${r}", found "${a}".`));n(null,a)})}function IF(t,e,r){if(Jt(e))return;let n=A9(e,r),o=mt.relative(r,n);if(!n.startsWith(r))throw new Error(`${t} option must be relative to "${r}", found "${o}".`);return o}function O9(t,e){T9(t,function(r,n){if(r)return e(r);t.tmpdir=n;try{VF(t,n)}catch(o){return e(o)}TF("dir",t.dir,n,function(o,i){if(o)return e(o);t.dir=Jt(i)?"":i,TF("template",t.template,n,function(a,s){if(a)return e(a);t.template=s,e(null,t)})})})}function k9(t){let e=t.tmpdir=GF(t);VF(t,e);let r=IF("dir",t.dir,e);return t.dir=Jt(r)?"":r,t.template=IF("template",t.template,e),t}function $9(t){return zF(t,-g9,"EBADF")}function Wg(t){return zF(t,-D9,"ENOENT")}function zF(t,e,r){return m9?t.code===r:t.code===r&&t.errno===e}function P9(){UF=!0}function T9(t,e){return $e.realpath(t&&t.tmpdir||ef.tmpdir(),e)}function GF(t){return $e.realpathSync(t&&t.tmpdir||ef.tmpdir())}process.addListener(y9,S9);Object.defineProperty(cn.exports,"tmpdir",{enumerable:!0,configurable:!1,get:function(){return GF()}});cn.exports.dir=C9;cn.exports.dirSync=E9;cn.exports.file=w9;cn.exports.fileSync=v9;cn.exports.tmpName=Kg;cn.exports.tmpNameSync=Yg;cn.exports.setGracefulCleanup=P9});var nf=require("node:process");var yD=me(DD(),1),{program:nt,createCommand:d7,createArgument:h7,createOption:m7,CommanderError:g7,InvalidArgumentError:D7,InvalidOptionArgumentError:y7,Command:b7,Argument:w7,Option:v7,Help:C7}=yD.default;var hr={name:"@capgo/cli",version:"8.0.0-alpha.5",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:"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"},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.25.11",eslint:"^9.38.0","git-format-staged":"3.1.1",husky:"^9.1.7","is-wsl":"^3.1.0",open:"^10.1.2",prettyjson:"^1.2.5",tmp:"^0.2.5","tus-js-client":"^4.3.1",typescript:"^5.9.3"}};var ea=require("node:fs");var gt=me(xf(),1),No=require("node:process"),fn=me(require("node:readline"),1),kf=me(require("node:readline"),1),OD=require("node:stream"),kD=me(Ff(),1);function kA({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 $A=kA();function $D(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace($A,"")}function PD(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var TD={exports:{}};(function(t){var e={};t.exports=e,e.eastAsianWidth=function(n){var o=n.charCodeAt(0),i=n.length==2?n.charCodeAt(1):0,a=o;return 55296<=o&&o<=56319&&56320<=i&&i<=57343&&(o&=1023,i&=1023,a=o<<10|i,a+=65536),a==12288||65281<=a&&a<=65376||65504<=a&&a<=65510?"F":a==8361||65377<=a&&a<=65470||65474<=a&&a<=65479||65482<=a&&a<=65487||65490<=a&&a<=65495||65498<=a&&a<=65500||65512<=a&&a<=65518?"H":4352<=a&&a<=4447||4515<=a&&a<=4519||4602<=a&&a<=4607||9001<=a&&a<=9002||11904<=a&&a<=11929||11931<=a&&a<=12019||12032<=a&&a<=12245||12272<=a&&a<=12283||12289<=a&&a<=12350||12353<=a&&a<=12438||12441<=a&&a<=12543||12549<=a&&a<=12589||12593<=a&&a<=12686||12688<=a&&a<=12730||12736<=a&&a<=12771||12784<=a&&a<=12830||12832<=a&&a<=12871||12880<=a&&a<=13054||13056<=a&&a<=19903||19968<=a&&a<=42124||42128<=a&&a<=42182||43360<=a&&a<=43388||44032<=a&&a<=55203||55216<=a&&a<=55238||55243<=a&&a<=55291||63744<=a&&a<=64255||65040<=a&&a<=65049||65072<=a&&a<=65106||65108<=a&&a<=65126||65128<=a&&a<=65131||110592<=a&&a<=110593||127488<=a&&a<=127490||127504<=a&&a<=127546||127552<=a&&a<=127560||127568<=a&&a<=127569||131072<=a&&a<=194367||177984<=a&&a<=196605||196608<=a&&a<=262141?"W":32<=a&&a<=126||162<=a&&a<=163||165<=a&&a<=166||a==172||a==175||10214<=a&&a<=10221||10629<=a&&a<=10630?"Na":a==161||a==164||167<=a&&a<=168||a==170||173<=a&&a<=174||176<=a&&a<=180||182<=a&&a<=186||188<=a&&a<=191||a==198||a==208||215<=a&&a<=216||222<=a&&a<=225||a==230||232<=a&&a<=234||236<=a&&a<=237||a==240||242<=a&&a<=243||247<=a&&a<=250||a==252||a==254||a==257||a==273||a==275||a==283||294<=a&&a<=295||a==299||305<=a&&a<=307||a==312||319<=a&&a<=322||a==324||328<=a&&a<=331||a==333||338<=a&&a<=339||358<=a&&a<=359||a==363||a==462||a==464||a==466||a==468||a==470||a==472||a==474||a==476||a==593||a==609||a==708||a==711||713<=a&&a<=715||a==717||a==720||728<=a&&a<=731||a==733||a==735||768<=a&&a<=879||913<=a&&a<=929||931<=a&&a<=937||945<=a&&a<=961||963<=a&&a<=969||a==1025||1040<=a&&a<=1103||a==1105||a==8208||8211<=a&&a<=8214||8216<=a&&a<=8217||8220<=a&&a<=8221||8224<=a&&a<=8226||8228<=a&&a<=8231||a==8240||8242<=a&&a<=8243||a==8245||a==8251||a==8254||a==8308||a==8319||8321<=a&&a<=8324||a==8364||a==8451||a==8453||a==8457||a==8467||a==8470||8481<=a&&a<=8482||a==8486||a==8491||8531<=a&&a<=8532||8539<=a&&a<=8542||8544<=a&&a<=8555||8560<=a&&a<=8569||a==8585||8592<=a&&a<=8601||8632<=a&&a<=8633||a==8658||a==8660||a==8679||a==8704||8706<=a&&a<=8707||8711<=a&&a<=8712||a==8715||a==8719||a==8721||a==8725||a==8730||8733<=a&&a<=8736||a==8739||a==8741||8743<=a&&a<=8748||a==8750||8756<=a&&a<=8759||8764<=a&&a<=8765||a==8776||a==8780||a==8786||8800<=a&&a<=8801||8804<=a&&a<=8807||8810<=a&&a<=8811||8814<=a&&a<=8815||8834<=a&&a<=8835||8838<=a&&a<=8839||a==8853||a==8857||a==8869||a==8895||a==8978||9312<=a&&a<=9449||9451<=a&&a<=9547||9552<=a&&a<=9587||9600<=a&&a<=9615||9618<=a&&a<=9621||9632<=a&&a<=9633||9635<=a&&a<=9641||9650<=a&&a<=9651||9654<=a&&a<=9655||9660<=a&&a<=9661||9664<=a&&a<=9665||9670<=a&&a<=9672||a==9675||9678<=a&&a<=9681||9698<=a&&a<=9701||a==9711||9733<=a&&a<=9734||a==9737||9742<=a&&a<=9743||9748<=a&&a<=9749||a==9756||a==9758||a==9792||a==9794||9824<=a&&a<=9825||9827<=a&&a<=9829||9831<=a&&a<=9834||9836<=a&&a<=9837||a==9839||9886<=a&&a<=9887||9918<=a&&a<=9919||9924<=a&&a<=9933||9935<=a&&a<=9953||a==9955||9960<=a&&a<=9983||a==10045||a==10071||10102<=a&&a<=10111||11093<=a&&a<=11097||12872<=a&&a<=12879||57344<=a&&a<=63743||65024<=a&&a<=65039||a==65533||127232<=a&&a<=127242||127248<=a&&a<=127277||127280<=a&&a<=127337||127344<=a&&a<=127386||917760<=a&&a<=917999||983040<=a&&a<=1048573||1048576<=a&&a<=1114109?"A":"N"},e.characterLength=function(n){var o=this.eastAsianWidth(n);return o=="F"||o=="W"||o=="A"?2:1};function r(n){return n.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}e.length=function(n){for(var o=r(n),i=0,a=0;a<o.length;a++)i=i+this.characterLength(o[a]);return i},e.slice=function(n,o,i){textLen=e.length(n),o=o||0,i=i||1,o<0&&(o=textLen+o),i<0&&(i=textLen+i);for(var a="",s=0,u=r(n),c=0;c<u.length;c++){var l=u[c],p=e.length(l);if(s>=o-(p==2?1:0))if(s+p<=i)a+=l;else break;s+=p}return a}})(TD);var PA=TD.exports,TA=PD(PA),IA=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},RA=PD(IA);function da(t,e={}){if(typeof t!="string"||t.length===0||(e={ambiguousIsNarrow:!0,...e},t=$D(t),t.length===0))return 0;t=t.replace(RA()," ");let r=e.ambiguousIsNarrow?1:2,n=0;for(let o of t){let i=o.codePointAt(0);if(!(i<=31||i>=127&&i<=159||i>=768&&i<=879))switch(TA.eastAsianWidth(o)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}var Af=10,CD=(t=0)=>e=>`\x1B[${e+t}m`,ED=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,_D=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`,Ne={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(Ne.modifier);var BA=Object.keys(Ne.color),jA=Object.keys(Ne.bgColor);[...BA,...jA];function NA(){let t=new Map;for(let[e,r]of Object.entries(Ne)){for(let[n,o]of Object.entries(r))Ne[n]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},r[n]=Ne[n],t.set(o[0],o[1]);Object.defineProperty(Ne,e,{value:r,enumerable:!1})}return Object.defineProperty(Ne,"codes",{value:t,enumerable:!1}),Ne.color.close="\x1B[39m",Ne.bgColor.close="\x1B[49m",Ne.color.ansi=CD(),Ne.color.ansi256=ED(),Ne.color.ansi16m=_D(),Ne.bgColor.ansi=CD(Af),Ne.bgColor.ansi256=ED(Af),Ne.bgColor.ansi16m=_D(Af),Object.defineProperties(Ne,{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(i=>i+i).join(""));let o=Number.parseInt(n,16);return[o>>16&255,o>>8&255,o&255]},enumerable:!1},hexToAnsi256:{value:e=>Ne.rgbToAnsi256(...Ne.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value:e=>{if(e<8)return 30+e;if(e<16)return 90+(e-8);let r,n,o;if(e>=232)r=((e-232)*10+8)/255,n=r,o=r;else{e-=16;let s=e%36;r=Math.floor(e/36)/5,n=Math.floor(s/6)/5,o=s%6/5}let i=Math.max(r,n,o)*2;if(i===0)return 30;let a=30+(Math.round(o)<<2|Math.round(n)<<1|Math.round(r));return i===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(e,r,n)=>Ne.ansi256ToAnsi(Ne.rgbToAnsi256(e,r,n)),enumerable:!1},hexToAnsi:{value:e=>Ne.ansi256ToAnsi(Ne.hexToAnsi256(e)),enumerable:!1}}),Ne}var LA=NA(),Js=new Set(["\x1B","\x9B"]),UA=39,Pf="\x07",ID="[",MA="]",RD="m",Tf=`${MA}8;;`,xD=t=>`${Js.values().next().value}${ID}${t}${RD}`,SD=t=>`${Js.values().next().value}${Tf}${t}${Pf}`,qA=t=>t.split(" ").map(e=>da(e)),Of=(t,e,r)=>{let n=[...e],o=!1,i=!1,a=da($D(t[t.length-1]));for(let[s,u]of n.entries()){let c=da(u);if(a+c<=r?t[t.length-1]+=u:(t.push(u),a=0),Js.has(u)&&(o=!0,i=n.slice(s+1).join("").startsWith(Tf)),o){i?u===Pf&&(o=!1,i=!1):u===RD&&(o=!1);continue}a+=c,a===r&&s<n.length-1&&(t.push(""),a=0)}!a&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},HA=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(da(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},VA=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",o,i,a=qA(t),s=[""];for(let[c,l]of t.split(" ").entries()){r.trim!==!1&&(s[s.length-1]=s[s.length-1].trimStart());let p=da(s[s.length-1]);if(c!==0&&(p>=e&&(r.wordWrap===!1||r.trim===!1)&&(s.push(""),p=0),(p>0||r.trim===!1)&&(s[s.length-1]+=" ",p++)),r.hard&&a[c]>e){let d=e-p,h=1+Math.floor((a[c]-d-1)/e);Math.floor((a[c]-1)/e)<h&&s.push(""),Of(s,l,e);continue}if(p+a[c]>e&&p>0&&a[c]>0){if(r.wordWrap===!1&&p<e){Of(s,l,e);continue}s.push("")}if(p+a[c]>e&&r.wordWrap===!1){Of(s,l,e);continue}s[s.length-1]+=l}r.trim!==!1&&(s=s.map(c=>HA(c)));let u=[...s.join(`
105
+ `)];for(let[c,l]of u.entries()){if(n+=l,Js.has(l)){let{groups:d}=new RegExp(`(?:\\${ID}(?<code>\\d+)m|\\${Tf}(?<uri>.*)${Pf})`).exec(u.slice(c).join(""))||{groups:{}};if(d.code!==void 0){let h=Number.parseFloat(d.code);o=h===UA?void 0:h}else d.uri!==void 0&&(i=d.uri.length===0?void 0:d.uri)}let p=LA.codes.get(Number(o));u[c+1]===`
106
+ `?(i&&(n+=SD("")),o&&p&&(n+=xD(p))):l===`
107
+ `&&(o&&p&&(n+=xD(o)),i&&(n+=SD(i)))}return n};function FD(t,e,r){return String(t).normalize().replace(/\r\n/g,`
108
108
  `).split(`
109
- `).map(n=>UA(n,e,r)).join(`
110
- `)}var MA=["up","down","left","right","space","enter","cancel"],Hs={actions:new Set(MA),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]])};function $f(t,e){if(typeof t=="string")return Hs.aliases.get(t)===e;for(let r of t)if(r!==void 0&&$f(r,e))return!0;return!1}function qA(t,e){if(t===e)return;let r=t.split(`
109
+ `).map(n=>VA(n,e,r)).join(`
110
+ `)}var zA=["up","down","left","right","space","enter","cancel"],Gs={actions:new Set(zA),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]])};function If(t,e){if(typeof t=="string")return Gs.aliases.get(t)===e;for(let r of t)if(r!==void 0&&If(r,e))return!0;return!1}function GA(t,e){if(t===e)return;let r=t.split(`
111
111
  `),n=e.split(`
112
- `),o=[];for(let i=0;i<Math.max(r.length,n.length);i++)r[i]!==n[i]&&o.push(i);return o}var HA=globalThis.process.platform.startsWith("win"),Af=Symbol("clack:cancel");function De(t){return t===Af}function qs(t,e){let r=t;r.isTTY&&r.setRawMode(e)}function TD({input:t=Ro.stdin,output:e=Ro.stdout,overwrite:r=!0,hideCursor:n=!0}={}){let o=ln.createInterface({input:t,output:e,prompt:"",tabSize:1});ln.emitKeypressEvents(t,o),t.isTTY&&t.setRawMode(!0);let i=(a,{name:s,sequence:u})=>{let c=String(a);if($f([c,s,u],"cancel")){n&&e.write(Dt.cursor.show),process.exit(0);return}if(!r)return;ln.moveCursor(e,s==="return"?0:-1,s==="return"?-1:0,()=>{ln.clearLine(e,1,()=>{t.once("keypress",i)})})};return n&&e.write(Dt.cursor.hide),t.once("keypress",i),()=>{t.off("keypress",i),n&&e.write(Dt.cursor.show),t.isTTY&&!HA&&t.setRawMode(!1),o.terminal=!1,o.close()}}var VA=Object.defineProperty,zA=(t,e,r)=>e in t?VA(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,zt=(t,e,r)=>(zA(t,typeof e!="symbol"?e+"":e,r),r),fa=class{constructor(e,r=!0){zt(this,"input"),zt(this,"output"),zt(this,"_abortSignal"),zt(this,"rl"),zt(this,"opts"),zt(this,"_render"),zt(this,"_track",!1),zt(this,"_prevFrame",""),zt(this,"_subscribers",new Map),zt(this,"_cursor",0),zt(this,"state","initial"),zt(this,"error",""),zt(this,"value");let{input:n=Ro.stdin,output:o=Ro.stdout,render:i,signal:a,...s}=e;this.opts=s,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=i.bind(this),this._track=r,this._abortSignal=a,this.input=n,this.output=o}unsubscribe(){this._subscribers.clear()}setSubscriber(e,r){let n=this._subscribers.get(e)??[];n.push(r),this._subscribers.set(e,n)}on(e,r){this.setSubscriber(e,{cb:r})}once(e,r){this.setSubscriber(e,{cb:r,once:!0})}emit(e,...r){let n=this._subscribers.get(e)??[],o=[];for(let i of n)i.cb(...r),i.once&&o.push(()=>n.splice(n.indexOf(i),1));for(let i of o)i()}prompt(){return new Promise((e,r)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),e(Af);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let n=new SD.Writable;n._write=(o,i,a)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,""),this._cursor=this.rl?.cursor??0,this.emit("value",this.value)),a()},this.input.pipe(n),this.rl=Ff.default.createInterface({input:this.input,output:n,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),Ff.default.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),qs(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(Dt.cursor.show),this.output.off("resize",this.render),qs(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(Dt.cursor.show),this.output.off("resize",this.render),qs(this.input,!1),e(Af)})})}onKeypress(e,r){if(this.state==="error"&&(this.state="active"),r?.name&&(!this._track&&Hs.aliases.has(r.name)&&this.emit("cursor",Hs.aliases.get(r.name)),Hs.actions.has(r.name)&&this.emit("cursor",r.name)),e&&(e.toLowerCase()==="y"||e.toLowerCase()==="n")&&this.emit("confirm",e.toLowerCase()==="y"),e===" "&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),e&&this.emit("key",e.toLowerCase()),r?.name==="return"){if(this.opts.validate){let n=this.opts.validate(this.value);n&&(this.error=n instanceof Error?n.message:n,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}$f([e,r?.name,r?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
113
- `),qs(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=_D(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
114
- `).length-1;this.output.write(Dt.cursor.move(-999,e*-1))}render(){let e=_D(this._render(this)??"",process.stdout.columns,{hard:!0});if(e!==this._prevFrame){if(this.state==="initial")this.output.write(Dt.cursor.hide);else{let r=qA(this._prevFrame,e);if(this.restoreCursor(),r&&r?.length===1){let n=r[0];this.output.write(Dt.cursor.move(0,n)),this.output.write(Dt.erase.lines(1));let o=e.split(`
115
- `);this.output.write(o[n]),this._prevFrame=e,this.output.write(Dt.cursor.move(0,o.length-n-1));return}if(r&&r?.length>1){let n=r[0];this.output.write(Dt.cursor.move(0,n)),this.output.write(Dt.erase.down());let o=e.split(`
112
+ `),o=[];for(let i=0;i<Math.max(r.length,n.length);i++)r[i]!==n[i]&&o.push(i);return o}var WA=globalThis.process.platform.startsWith("win"),$f=Symbol("clack:cancel");function De(t){return t===$f}function zs(t,e){let r=t;r.isTTY&&r.setRawMode(e)}function BD({input:t=No.stdin,output:e=No.stdout,overwrite:r=!0,hideCursor:n=!0}={}){let o=fn.createInterface({input:t,output:e,prompt:"",tabSize:1});fn.emitKeypressEvents(t,o),t.isTTY&&t.setRawMode(!0);let i=(a,{name:s,sequence:u})=>{let c=String(a);if(If([c,s,u],"cancel")){n&&e.write(gt.cursor.show),process.exit(0);return}if(!r)return;fn.moveCursor(e,s==="return"?0:-1,s==="return"?-1:0,()=>{fn.clearLine(e,1,()=>{t.once("keypress",i)})})};return n&&e.write(gt.cursor.hide),t.once("keypress",i),()=>{t.off("keypress",i),n&&e.write(gt.cursor.show),t.isTTY&&!WA&&t.setRawMode(!1),o.terminal=!1,o.close()}}var KA=Object.defineProperty,YA=(t,e,r)=>e in t?KA(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ht=(t,e,r)=>(YA(t,typeof e!="symbol"?e+"":e,r),r),ha=class{constructor(e,r=!0){Ht(this,"input"),Ht(this,"output"),Ht(this,"_abortSignal"),Ht(this,"rl"),Ht(this,"opts"),Ht(this,"_render"),Ht(this,"_track",!1),Ht(this,"_prevFrame",""),Ht(this,"_subscribers",new Map),Ht(this,"_cursor",0),Ht(this,"state","initial"),Ht(this,"error",""),Ht(this,"value");let{input:n=No.stdin,output:o=No.stdout,render:i,signal:a,...s}=e;this.opts=s,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=i.bind(this),this._track=r,this._abortSignal=a,this.input=n,this.output=o}unsubscribe(){this._subscribers.clear()}setSubscriber(e,r){let n=this._subscribers.get(e)??[];n.push(r),this._subscribers.set(e,n)}on(e,r){this.setSubscriber(e,{cb:r})}once(e,r){this.setSubscriber(e,{cb:r,once:!0})}emit(e,...r){let n=this._subscribers.get(e)??[],o=[];for(let i of n)i.cb(...r),i.once&&o.push(()=>n.splice(n.indexOf(i),1));for(let i of o)i()}prompt(){return new Promise((e,r)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),e($f);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let n=new OD.Writable;n._write=(o,i,a)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,""),this._cursor=this.rl?.cursor??0,this.emit("value",this.value)),a()},this.input.pipe(n),this.rl=kf.default.createInterface({input:this.input,output:n,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),kf.default.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),zs(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(gt.cursor.show),this.output.off("resize",this.render),zs(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(gt.cursor.show),this.output.off("resize",this.render),zs(this.input,!1),e($f)})})}onKeypress(e,r){if(this.state==="error"&&(this.state="active"),r?.name&&(!this._track&&Gs.aliases.has(r.name)&&this.emit("cursor",Gs.aliases.get(r.name)),Gs.actions.has(r.name)&&this.emit("cursor",r.name)),e&&(e.toLowerCase()==="y"||e.toLowerCase()==="n")&&this.emit("confirm",e.toLowerCase()==="y"),e===" "&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),e&&this.emit("key",e.toLowerCase()),r?.name==="return"){if(this.opts.validate){let n=this.opts.validate(this.value);n&&(this.error=n instanceof Error?n.message:n,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}If([e,r?.name,r?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
113
+ `),zs(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=FD(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
114
+ `).length-1;this.output.write(gt.cursor.move(-999,e*-1))}render(){let e=FD(this._render(this)??"",process.stdout.columns,{hard:!0});if(e!==this._prevFrame){if(this.state==="initial")this.output.write(gt.cursor.hide);else{let r=GA(this._prevFrame,e);if(this.restoreCursor(),r&&r?.length===1){let n=r[0];this.output.write(gt.cursor.move(0,n)),this.output.write(gt.erase.lines(1));let o=e.split(`
115
+ `);this.output.write(o[n]),this._prevFrame=e,this.output.write(gt.cursor.move(0,o.length-n-1));return}if(r&&r?.length>1){let n=r[0];this.output.write(gt.cursor.move(0,n)),this.output.write(gt.erase.down());let o=e.split(`
116
116
  `).slice(n);this.output.write(o.join(`
117
- `)),this._prevFrame=e;return}this.output.write(Dt.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}},Vs=class extends fa{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(e){super(e,!1),this.value=!!e.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",r=>{this.output.write(Dt.cursor.move(0,-1)),this.value=r,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};var GA;GA=new WeakMap;var WA=Object.defineProperty,KA=(t,e,r)=>e in t?WA(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xD=(t,e,r)=>(KA(t,typeof e!="symbol"?e+"":e,r),r),zs=class extends fa{constructor(e){super(e,!1),xD(this,"options"),xD(this,"cursor",0),this.options=e.options,this.cursor=this.options.findIndex(({value:r})=>r===e.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",r=>{switch(r){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}};var Gs=class extends fa{get valueWithCursor(){if(this.state==="submit")return this.value;if(this.cursor>=this.value.length)return`${this.value}\u2588`;let e=this.value.slice(0,this.cursor),[r,...n]=this.value.slice(this.cursor);return`${e}${FD.default.inverse(r)}${n.join("")}`}get cursor(){return this._cursor}constructor(e){super(e),this.on("finalize",()=>{this.value||(this.value=e.defaultValue)})}};var Zt=ge(require("node:process"),1),G=ge(_f(),1),Ks=ge(Cf(),1);function YA(){return Zt.default.platform!=="win32"?Zt.default.env.TERM!=="linux":!!Zt.default.env.CI||!!Zt.default.env.WT_SESSION||!!Zt.default.env.TERMINUS_SUBLIME||Zt.default.env.ConEmuTask==="{cmd::Cmder}"||Zt.default.env.TERM_PROGRAM==="Terminus-Sublime"||Zt.default.env.TERM_PROGRAM==="vscode"||Zt.default.env.TERM==="xterm-256color"||Zt.default.env.TERM==="alacritty"||Zt.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var Pf=YA(),Je=(t,e)=>Pf?t:e,JA=Je("\u25C6","*"),ID=Je("\u25A0","x"),RD=Je("\u25B2","x"),Rf=Je("\u25C7","o"),XA=Je("\u250C","T"),Ue=Je("\u2502","|"),Bo=Je("\u2514","\u2014"),Tf=Je("\u25CF",">"),If=Je("\u25CB"," "),S7=Je("\u25FB","[\u2022]"),F7=Je("\u25FC","[+]"),A7=Je("\u25FB","[ ]"),O7=Je("\u25AA","\u2022"),k7=Je("\u2500","-"),$7=Je("\u256E","+"),P7=Je("\u251C","+"),T7=Je("\u256F","+"),ZA=Je("\u25CF","\u2022"),QA=Je("\u25C6","*"),eO=Je("\u25B2","!"),tO=Je("\u25A0","x"),Bf=t=>{switch(t){case"initial":case"active":return G.default.cyan(JA);case"cancel":return G.default.red(ID);case"error":return G.default.yellow(RD);case"submit":return G.default.green(Rf)}},rO=t=>{let{cursor:e,options:r,style:n}=t,o=t.maxItems??Number.POSITIVE_INFINITY,i=Math.max(process.stdout.rows-4,0),a=Math.min(i,Math.max(o,5)),s=0;e>=s+a-3?s=Math.max(Math.min(e-a+3,r.length-a),0):e<s+2&&(s=Math.max(e-2,0));let u=a<r.length&&s>0,c=a<r.length&&s+a<r.length;return r.slice(s,s+a).map((l,f,d)=>{let h=f===0&&u,m=f===d.length-1&&c;return h||m?G.default.dim("..."):n(l,f+s===e)})},gr=t=>new Gs({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,render(){let e=`${G.default.gray(Ue)}
118
- ${Bf(this.state)} ${t.message}
119
- `,r=t.placeholder?G.default.inverse(t.placeholder[0])+G.default.dim(t.placeholder.slice(1)):G.default.inverse(G.default.hidden("_")),n=this.value?this.valueWithCursor:r;switch(this.state){case"error":return`${e.trim()}
120
- ${G.default.yellow(Ue)} ${n}
121
- ${G.default.yellow(Bo)} ${G.default.yellow(this.error)}
122
- `;case"submit":return`${e}${G.default.gray(Ue)} ${G.default.dim(this.value||t.placeholder)}`;case"cancel":return`${e}${G.default.gray(Ue)} ${G.default.strikethrough(G.default.dim(this.value??""))}${this.value?.trim()?`
123
- ${G.default.gray(Ue)}`:""}`;default:return`${e}${G.default.cyan(Ue)} ${n}
124
- ${G.default.cyan(Bo)}
125
- `}}}).prompt();var ye=t=>{let e=t.active??"Yes",r=t.inactive??"No";return new Vs({active:e,inactive:r,initialValue:t.initialValue??!0,render(){let n=`${G.default.gray(Ue)}
126
- ${Bf(this.state)} ${t.message}
127
- `,o=this.value?e:r;switch(this.state){case"submit":return`${n}${G.default.gray(Ue)} ${G.default.dim(o)}`;case"cancel":return`${n}${G.default.gray(Ue)} ${G.default.strikethrough(G.default.dim(o))}
128
- ${G.default.gray(Ue)}`;default:return`${n}${G.default.cyan(Ue)} ${this.value?`${G.default.green(Tf)} ${e}`:`${G.default.dim(If)} ${G.default.dim(e)}`} ${G.default.dim("/")} ${this.value?`${G.default.dim(If)} ${G.default.dim(r)}`:`${G.default.green(Tf)} ${r}`}
129
- ${G.default.cyan(Bo)}
130
- `}}}).prompt()},Dr=t=>{let e=(r,n)=>{let o=r.label??String(r.value);switch(n){case"selected":return`${G.default.dim(o)}`;case"active":return`${G.default.green(Tf)} ${o} ${r.hint?G.default.dim(`(${r.hint})`):""}`;case"cancelled":return`${G.default.strikethrough(G.default.dim(o))}`;default:return`${G.default.dim(If)} ${G.default.dim(o)}`}};return new zs({options:t.options,initialValue:t.initialValue,render(){let r=`${G.default.gray(Ue)}
131
- ${Bf(this.state)} ${t.message}
132
- `;switch(this.state){case"submit":return`${r}${G.default.gray(Ue)} ${e(this.options[this.cursor],"selected")}`;case"cancel":return`${r}${G.default.gray(Ue)} ${e(this.options[this.cursor],"cancelled")}
133
- ${G.default.gray(Ue)}`;default:return`${r}${G.default.cyan(Ue)} ${rO({cursor:this.cursor,options:this.options,maxItems:t.maxItems,style:(n,o)=>e(n,o?"active":"inactive")}).join(`
134
- ${G.default.cyan(Ue)} `)}
135
- ${G.default.cyan(Bo)}
136
- `}}}).prompt()};var Mn=(t="")=>{process.stdout.write(`${G.default.gray(Bo)} ${G.default.red(t)}
137
-
138
- `)},Z=(t="")=>{process.stdout.write(`${G.default.gray(XA)} ${t}
139
- `)},J=(t="")=>{process.stdout.write(`${G.default.gray(Ue)}
140
- ${G.default.gray(Bo)} ${t}
141
-
142
- `)},p={message:(t="",{symbol:e=G.default.gray(Ue)}={})=>{let r=[`${G.default.gray(Ue)}`];if(t){let[n,...o]=t.split(`
143
- `);r.push(`${e} ${n}`,...o.map(i=>`${G.default.gray(Ue)} ${i}`))}process.stdout.write(`${r.join(`
117
+ `)),this._prevFrame=e;return}this.output.write(gt.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}},Ws=class extends ha{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(e){super(e,!1),this.value=!!e.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",r=>{this.output.write(gt.cursor.move(0,-1)),this.value=r,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};var JA;JA=new WeakMap;var XA=Object.defineProperty,ZA=(t,e,r)=>e in t?XA(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,AD=(t,e,r)=>(ZA(t,typeof e!="symbol"?e+"":e,r),r),Ks=class extends ha{constructor(e){super(e,!1),AD(this,"options"),AD(this,"cursor",0),this.options=e.options,this.cursor=this.options.findIndex(({value:r})=>r===e.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",r=>{switch(r){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}};var Ys=class extends ha{get valueWithCursor(){if(this.state==="submit")return this.value;if(this.cursor>=this.value.length)return`${this.value}\u2588`;let e=this.value.slice(0,this.cursor),[r,...n]=this.value.slice(this.cursor);return`${e}${kD.default.inverse(r)}${n.join("")}`}get cursor(){return this._cursor}constructor(e){super(e),this.on("finalize",()=>{this.value||(this.value=e.defaultValue)})}};var Zt=me(require("node:process"),1),W=me(Ff(),1),Xs=me(xf(),1);function QA(){return Zt.default.platform!=="win32"?Zt.default.env.TERM!=="linux":!!Zt.default.env.CI||!!Zt.default.env.WT_SESSION||!!Zt.default.env.TERMINUS_SUBLIME||Zt.default.env.ConEmuTask==="{cmd::Cmder}"||Zt.default.env.TERM_PROGRAM==="Terminus-Sublime"||Zt.default.env.TERM_PROGRAM==="vscode"||Zt.default.env.TERM==="xterm-256color"||Zt.default.env.TERM==="alacritty"||Zt.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var Rf=QA(),Je=(t,e)=>Rf?t:e,eO=Je("\u25C6","*"),jD=Je("\u25A0","x"),ND=Je("\u25B2","x"),Nf=Je("\u25C7","o"),tO=Je("\u250C","T"),qe=Je("\u2502","|"),Lo=Je("\u2514","\u2014"),Bf=Je("\u25CF",">"),jf=Je("\u25CB"," "),I7=Je("\u25FB","[\u2022]"),R7=Je("\u25FC","[+]"),B7=Je("\u25FB","[ ]"),j7=Je("\u25AA","\u2022"),N7=Je("\u2500","-"),L7=Je("\u256E","+"),U7=Je("\u251C","+"),M7=Je("\u256F","+"),rO=Je("\u25CF","\u2022"),nO=Je("\u25C6","*"),oO=Je("\u25B2","!"),iO=Je("\u25A0","x"),Lf=t=>{switch(t){case"initial":case"active":return W.default.cyan(eO);case"cancel":return W.default.red(jD);case"error":return W.default.yellow(ND);case"submit":return W.default.green(Nf)}},aO=t=>{let{cursor:e,options:r,style:n}=t,o=t.maxItems??Number.POSITIVE_INFINITY,i=Math.max(process.stdout.rows-4,0),a=Math.min(i,Math.max(o,5)),s=0;e>=s+a-3?s=Math.max(Math.min(e-a+3,r.length-a),0):e<s+2&&(s=Math.max(e-2,0));let u=a<r.length&&s>0,c=a<r.length&&s+a<r.length;return r.slice(s,s+a).map((l,p,d)=>{let h=p===0&&u,m=p===d.length-1&&c;return h||m?W.default.dim("..."):n(l,p+s===e)})},mr=t=>new Ys({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,render(){let e=`${W.default.gray(qe)}
118
+ ${Lf(this.state)} ${t.message}
119
+ `,r=t.placeholder?W.default.inverse(t.placeholder[0])+W.default.dim(t.placeholder.slice(1)):W.default.inverse(W.default.hidden("_")),n=this.value?this.valueWithCursor:r;switch(this.state){case"error":return`${e.trim()}
120
+ ${W.default.yellow(qe)} ${n}
121
+ ${W.default.yellow(Lo)} ${W.default.yellow(this.error)}
122
+ `;case"submit":return`${e}${W.default.gray(qe)} ${W.default.dim(this.value||t.placeholder)}`;case"cancel":return`${e}${W.default.gray(qe)} ${W.default.strikethrough(W.default.dim(this.value??""))}${this.value?.trim()?`
123
+ ${W.default.gray(qe)}`:""}`;default:return`${e}${W.default.cyan(qe)} ${n}
124
+ ${W.default.cyan(Lo)}
125
+ `}}}).prompt();var ye=t=>{let e=t.active??"Yes",r=t.inactive??"No";return new Ws({active:e,inactive:r,initialValue:t.initialValue??!0,render(){let n=`${W.default.gray(qe)}
126
+ ${Lf(this.state)} ${t.message}
127
+ `,o=this.value?e:r;switch(this.state){case"submit":return`${n}${W.default.gray(qe)} ${W.default.dim(o)}`;case"cancel":return`${n}${W.default.gray(qe)} ${W.default.strikethrough(W.default.dim(o))}
128
+ ${W.default.gray(qe)}`;default:return`${n}${W.default.cyan(qe)} ${this.value?`${W.default.green(Bf)} ${e}`:`${W.default.dim(jf)} ${W.default.dim(e)}`} ${W.default.dim("/")} ${this.value?`${W.default.dim(jf)} ${W.default.dim(r)}`:`${W.default.green(Bf)} ${r}`}
129
+ ${W.default.cyan(Lo)}
130
+ `}}}).prompt()},gr=t=>{let e=(r,n)=>{let o=r.label??String(r.value);switch(n){case"selected":return`${W.default.dim(o)}`;case"active":return`${W.default.green(Bf)} ${o} ${r.hint?W.default.dim(`(${r.hint})`):""}`;case"cancelled":return`${W.default.strikethrough(W.default.dim(o))}`;default:return`${W.default.dim(jf)} ${W.default.dim(o)}`}};return new Ks({options:t.options,initialValue:t.initialValue,render(){let r=`${W.default.gray(qe)}
131
+ ${Lf(this.state)} ${t.message}
132
+ `;switch(this.state){case"submit":return`${r}${W.default.gray(qe)} ${e(this.options[this.cursor],"selected")}`;case"cancel":return`${r}${W.default.gray(qe)} ${e(this.options[this.cursor],"cancelled")}
133
+ ${W.default.gray(qe)}`;default:return`${r}${W.default.cyan(qe)} ${aO({cursor:this.cursor,options:this.options,maxItems:t.maxItems,style:(n,o)=>e(n,o?"active":"inactive")}).join(`
134
+ ${W.default.cyan(qe)} `)}
135
+ ${W.default.cyan(Lo)}
136
+ `}}}).prompt()};var qn=(t="")=>{process.stdout.write(`${W.default.gray(Lo)} ${W.default.red(t)}
137
+
138
+ `)},Z=(t="")=>{process.stdout.write(`${W.default.gray(tO)} ${t}
139
+ `)},J=(t="")=>{process.stdout.write(`${W.default.gray(qe)}
140
+ ${W.default.gray(Lo)} ${t}
141
+
142
+ `)},f={message:(t="",{symbol:e=W.default.gray(qe)}={})=>{let r=[`${W.default.gray(qe)}`];if(t){let[n,...o]=t.split(`
143
+ `);r.push(`${e} ${n}`,...o.map(i=>`${W.default.gray(qe)} ${i}`))}process.stdout.write(`${r.join(`
144
144
  `)}
145
- `)},info:t=>{p.message(t,{symbol:G.default.blue(ZA)})},success:t=>{p.message(t,{symbol:G.default.green(QA)})},step:t=>{p.message(t,{symbol:G.default.green(Rf)})},warn:t=>{p.message(t,{symbol:G.default.yellow(eO)})},warning:t=>{p.warn(t)},error:t=>{p.message(t,{symbol:G.default.red(tO)})}},I7=`${G.default.gray(Ue)} `;var we=({indicator:t="dots"}={})=>{let e=Pf?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],r=Pf?80:120,n=process.env.CI==="true",o,i,a=!1,s="",u,c=performance.now(),l=_=>{let S=_>1?"Something went wrong":"Canceled";a&&g(S,_)},f=()=>l(2),d=()=>l(1),h=()=>{process.on("uncaughtExceptionMonitor",f),process.on("unhandledRejection",f),process.on("SIGINT",d),process.on("SIGTERM",d),process.on("exit",l)},m=()=>{process.removeListener("uncaughtExceptionMonitor",f),process.removeListener("unhandledRejection",f),process.removeListener("SIGINT",d),process.removeListener("SIGTERM",d),process.removeListener("exit",l)},b=()=>{if(u===void 0)return;n&&process.stdout.write(`
145
+ `)},info:t=>{f.message(t,{symbol:W.default.blue(rO)})},success:t=>{f.message(t,{symbol:W.default.green(nO)})},step:t=>{f.message(t,{symbol:W.default.green(Nf)})},warn:t=>{f.message(t,{symbol:W.default.yellow(oO)})},warning:t=>{f.warn(t)},error:t=>{f.message(t,{symbol:W.default.red(iO)})}},q7=`${W.default.gray(qe)} `;var ve=({indicator:t="dots"}={})=>{let e=Rf?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],r=Rf?80:120,n=process.env.CI==="true",o,i,a=!1,s="",u,c=performance.now(),l=_=>{let S=_>1?"Something went wrong":"Canceled";a&&g(S,_)},p=()=>l(2),d=()=>l(1),h=()=>{process.on("uncaughtExceptionMonitor",p),process.on("unhandledRejection",p),process.on("SIGINT",d),process.on("SIGTERM",d),process.on("exit",l)},m=()=>{process.removeListener("uncaughtExceptionMonitor",p),process.removeListener("unhandledRejection",p),process.removeListener("SIGINT",d),process.removeListener("SIGTERM",d),process.removeListener("exit",l)},b=()=>{if(u===void 0)return;n&&process.stdout.write(`
146
146
  `);let _=u.split(`
147
- `);process.stdout.write(Ks.cursor.move(-999,_.length-1)),process.stdout.write(Ks.erase.down(_.length))},D=_=>_.replace(/\.+$/,""),C=_=>{let S=(performance.now()-_)/1e3,I=Math.floor(S/60),O=Math.floor(S%60);return I>0?`[${I}m ${O}s]`:`[${O}s]`},E=(_="")=>{a=!0,o=TD(),s=D(_),c=performance.now(),process.stdout.write(`${G.default.gray(Ue)}
148
- `);let S=0,I=0;h(),i=setInterval(()=>{if(n&&s===u)return;b(),u=s;let O=G.default.magenta(e[S]);if(n)process.stdout.write(`${O} ${s}...`);else if(t==="timer")process.stdout.write(`${O} ${s} ${C(c)}`);else{let B=".".repeat(Math.floor(I)).slice(0,3);process.stdout.write(`${O} ${s}${B}`)}S=S+1<e.length?S+1:0,I=I<e.length?I+.125:0},r)},g=(_="",S=0)=>{a=!1,clearInterval(i),b();let I=S===0?G.default.green(Rf):S===1?G.default.red(ID):G.default.red(RD);s=D(_??s),t==="timer"?process.stdout.write(`${I} ${s} ${C(c)}
149
- `):process.stdout.write(`${I} ${s}
150
- `),m(),o()};return{start:E,stop:g,message:(_="")=>{s=D(_??s)}}};var V1=require("node:child_process"),Ye=require("node:fs"),vl=require("node:os"),Ke=ge(require("node:path")),cr=require("node:process"),Rr=ge(Js());var _t=require("fs"),da=(t=".",e="unknown")=>{let r=`${t}/bun.lockb`,n=`${t}/bun.lock`,o=`${t}/pnpm-lock.yaml`,i=`${t}/shrinkwrap.yaml`,a=`${t}/yarn.lock`,s=`${t}/package-lock.json`,u=`${t}/npm-shrinkwrap.json`;return(0,_t.existsSync)(r)||(0,_t.existsSync)(n)?"bun":(0,_t.existsSync)(o)||(0,_t.existsSync)(i)?"pnpm":(0,_t.existsSync)(a)?"yarn":(0,_t.existsSync)(s)||(0,_t.existsSync)(u)?"npm":e},Xs=(t=da(),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"}},BD=(t=".",e="npx")=>{let r=`${t}/bun.lockb`,n=`${t}/bun.lock`,o=`${t}/pnpm-lock.yaml`,i=`${t}/shrinkwrap.yaml`,a=`${t}/yarn.lock`,s=`${t}/package-lock.json`,u=`${t}/npm-shrinkwrap.json`;return(0,_t.existsSync)(r)||(0,_t.existsSync)(n)?"bunx":(0,_t.existsSync)(o)||(0,_t.existsSync)(i)?"pnpm exec":(0,_t.existsSync)(a)?"yarn dlx":(0,_t.existsSync)(s)||(0,_t.existsSync)(u)?"npx":e};function Zs(t,e){if(isNaN(t)||isNaN(e))throw new Error("Cannot compare against non-numbers");return t===e?0:t<e?-1:1}function LD(t=[],e=[]){return t.length&&!e.length?-1:!t.length&&e.length?1:0}function Uf(t=[],e=[]){let r=Math.max(t.length,e.length);for(let n=0;n<r;n++){let o=t[n],i=e[n];if(o===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(o===void 0)return-1;if(typeof o=="string"&&typeof i=="number")return 1;if(typeof o=="number"&&typeof i=="string"||o<i)return-1;if(o>i)return 1}return 0}var jo="0|[1-9]\\d*",aO="\\d*[a-zA-Z-][a-zA-Z0-9-]*",sO=`(?<major>${jo})\\.(?<minor>${jo})\\.(?<patch>${jo})`,jD=`(?:${jo}|${aO})`,UD=`(?:-(?<prerelease>${jD}(?:\\.${jD})*))`,ND="[0-9A-Za-z-]+",MD=`(?:\\+(?<buildmetadata>${ND}(?:\\.${ND})*))`,qD=`v?${sO}${UD}?${MD}?`,HD=new RegExp(`^${qD}$`),VD="(?:<|>)?=?",uO="x|X|\\*",Lf=`${jo}|${uO}`,Qs=`[v=\\s]*(?<major>${Lf})(?:\\.(?<minor>${Lf})(?:\\.(?<patch>${Lf})${UD}?${MD}?)?)?`,zD=new RegExp(`^(?<operator>~>?|\\^|${VD})\\s*${Qs}$`),GD=new RegExp(`^(?<operator>${VD})\\s*(${qD})$|^$`);function Mf(t){return typeof t=="number"&&!Number.isNaN(t)&&(!Number.isFinite(t)||0<=t&&t<=Number.MAX_SAFE_INTEGER)}var qf=256;var cO=new RegExp(`^${jo}$`);function xt(t){return t.split(".").filter(Boolean).map(e=>{if(cO.test(e)){let r=Number(e);if(Mf(r))return r}return e})}function yr(t){return t.split(".").filter(Boolean)}function pn(t,e){let r=Number(t);if(!Mf(r))throw new TypeError(e);return r}function Vr(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 St(t,e){return t===e?0:Zs(t.major,e.major)||Zs(t.minor,e.minor)||Zs(t.patch,e.patch)||LD(t.prerelease,e.prerelease)||Uf(t.prerelease,e.prerelease)}function Hf(t){return t.toFixed(0)}function br(t){let e=Hf(t.major),r=Hf(t.minor),n=Hf(t.patch),o=t.prerelease?.join(".")??"",i=t.build?.join(".")??"";return[[`${e}.${r}.${n}`,o].filter(u=>u).join("-"),i].filter(u=>u).join("+")}function lO(t,e){if(Vr(e))return!0;let r=St(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 eu(t,e){for(let r of e)if(!lO(t,r))return!1;if(t.prerelease&&t.prerelease.length>0){for(let r of e){if(Vr(r))continue;let{major:n,minor:o,patch:i,prerelease:a}=r;if(a&&a.length>0&&t.major===n&&t.minor===o&&t.patch===i)return!0}return!1}return!0}function ha(t,e){return e.some(r=>eu(t,r))}function fO(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 ma(t=[],e){let r=fO(t);if(!e)return r;let n=xt(e);if(n.every(o=>typeof o=="string")){if(n.every((o,i)=>o===r[i])&&typeof r[n.length]=="number")return r;n=[...n,0]}return n}function ga(t,e,r={}){let n=r.build!==void 0?yr(r.build):t.build??[];switch(e){case"premajor":return{major:t.major+1,minor:0,patch:0,prerelease:ma(t.prerelease,r.prerelease),build:n};case"preminor":return{major:t.major,minor:t.minor+1,patch:0,prerelease:ma(t.prerelease,r.prerelease),build:n};case"prepatch":return{major:t.major,minor:t.minor,patch:t.patch+1,prerelease:ma(t.prerelease,r.prerelease),build:n};case"prerelease":{let i=(t.prerelease??[]).length===0?t.patch+1:t.patch;return{major:t.major,minor:t.minor,patch:i,prerelease:ma(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 i=(t.prerelease??[]).length===0||t.patch!==0?t.minor+1:t.minor;return{major:t.major,minor:i,patch:0,prerelease:[],build:n}}case"patch":{let i=(t.prerelease??[]).length===0?t.patch+1:t.patch;return{major:t.major,minor:t.minor,patch:i,prerelease:[],build:n}}case"pre":return{major:t.major,minor:t.minor,patch:t.patch,prerelease:ma(t.prerelease,r.prerelease),build:n};default:throw new TypeError(`Cannot increment version: invalid argument ${e}`)}}var tu={major:Number.NaN,minor:Number.NaN,patch:Number.NaN,prerelease:[],build:[]},No={operator:void 0,...tu};function Vf(t,e){return St(t,e)>0}function qn(t,e){return St(t,e)<0}function pO(t){let r=t.match(GD)?.groups;if(!r)return null;let{operator:n,prerelease:o,buildmetadata:i}=r,a=r.major?{major:pn(r.major,`Cannot parse comparator ${t}: invalid major version`),minor:pn(r.minor,`Cannot parse comparator ${t}: invalid minor version`),patch:pn(r.patch,`Cannot parse comparator ${t}: invalid patch version`),prerelease:o?xt(o):[],build:i?yr(i):[]}:tu;return{operator:n||void 0,...a}}function $e(t){return!t||t.toLowerCase()==="x"||t==="*"}function dO(t){if(!$e(t.major))return $e(t.minor)?{operator:">=",major:+t.major,minor:0,patch:0,prerelease:[],build:[]}:$e(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?xt(t.prerelease):[],build:[]}}function hO(t){if(!$e(t.major))return $e(t.minor)?{operator:"<",major:+t.major+1,minor:0,patch:0,prerelease:[],build:[]}:$e(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:xt(t.prerelease),build:[]}:{operator:"<=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:[],build:[]}}function mO(t){let e=t.match(new RegExp(`^${Qs}`)),r=e?.groups;if(!r)return null;let n=e[0].length,o=t.slice(n).match(/^\s+-\s+/);if(!o)return null;let i=o[0].length,s=t.slice(n+i).match(new RegExp(`^${Qs}\\s*$`))?.groups;if(!s)return null;let u=dO(r),c=hO(s);return[u,c].filter(Boolean)}function gO(t){let e=$e(t.major),r=$e(t.minor),n=$e(t.patch),o=+t.major,i=+t.minor,a=+t.patch;if(e)return[No];if(r)return[{operator:">=",major:o,minor:0,patch:0},{operator:"<",major:o+1,minor:0,patch:0}];if(n)return o===0?[{operator:">=",major:o,minor:i,patch:0},{operator:"<",major:o,minor:i+1,patch:0}]:[{operator:">=",major:o,minor:i,patch:0},{operator:"<",major:o+1,minor:0,patch:0}];let s=xt(t.prerelease??"");return o===0?i===0?[{operator:">=",major:o,minor:i,patch:a,prerelease:s},{operator:"<",major:o,minor:i,patch:a+1}]:[{operator:">=",major:o,minor:i,patch:a,prerelease:s},{operator:"<",major:o,minor:i+1,patch:0}]:[{operator:">=",major:o,minor:i,patch:a,prerelease:s},{operator:"<",major:o+1,minor:0,patch:0}]}function DO(t){let e=$e(t.major),r=$e(t.minor),n=$e(t.patch),o=+t.major,i=+t.minor,a=+t.patch;if(e)return[No];if(r)return[{operator:">=",major:o,minor:0,patch:0},{operator:"<",major:o+1,minor:0,patch:0}];if(n)return[{operator:">=",major:o,minor:i,patch:0},{operator:"<",major:o,minor:i+1,patch:0}];let s=xt(t.prerelease??"");return[{operator:">=",major:o,minor:i,patch:a,prerelease:s},{operator:"<",major:o,minor:i+1,patch:0}]}function yO(t){let e=$e(t.major),r=$e(t.minor),n=$e(t.patch),o=+t.major,i=+t.minor,a=+t.patch;if(e)return[{operator:"<",major:0,minor:0,patch:0}];if(r)return n?[{operator:"<",major:o,minor:0,patch:0}]:[{operator:"<",major:o,minor:0,patch:0}];if(n)return[{operator:"<",major:o,minor:i,patch:0}];let s=xt(t.prerelease??""),u=yr(t.build??"");return[{operator:"<",major:o,minor:i,patch:a,prerelease:s,build:u}]}function bO(t){let e=$e(t.minor),r=$e(t.patch),n=+t.major,o=+t.minor,i=+t.patch;if(e)return r?[{operator:"<",major:n+1,minor:0,patch:0}]:[{operator:"<",major:n,minor:o+1,patch:0}];if(r)return[{operator:"<",major:n,minor:o+1,patch:0}];let a=xt(t.prerelease??""),s=yr(t.build??"");return[{operator:"<=",major:n,minor:o,patch:i,prerelease:a,build:s}]}function vO(t){let e=$e(t.major),r=$e(t.minor),n=$e(t.patch),o=+t.major,i=+t.minor,a=+t.patch;if(e)return[{operator:"<",major:0,minor:0,patch:0}];if(r)return[{operator:">=",major:o+1,minor:0,patch:0}];if(n)return[{operator:">=",major:o,minor:i+1,patch:0}];let s=xt(t.prerelease??""),u=yr(t.build??"");return[{operator:">",major:o,minor:i,patch:a,prerelease:s,build:u}]}function wO(t){let e=$e(t.major),r=$e(t.minor),n=$e(t.patch),o=+t.major,i=+t.minor,a=+t.patch;if(e)return[No];if(r)return n?[{operator:">=",major:o,minor:0,patch:0}]:[{operator:">=",major:o,minor:0,patch:0}];if(n)return[{operator:">=",major:o,minor:i,patch:0}];let s=xt(t.prerelease??""),u=yr(t.build??"");return[{operator:">=",major:o,minor:i,patch:a,prerelease:s,build:u}]}function CO(t){let e=$e(t.major),r=$e(t.minor),n=$e(t.patch),o=+t.major,i=+t.minor,a=+t.patch;if(e)return[No];if(r)return[{operator:">=",major:o,minor:0,patch:0},{operator:"<",major:o+1,minor:0,patch:0}];if(n)return[{operator:">=",major:o,minor:i,patch:0},{operator:"<",major:o,minor:i+1,patch:0}];let s=xt(t.prerelease??""),u=yr(t.build??"");return[{operator:void 0,major:o,minor:i,patch:a,prerelease:s,build:u}]}function EO(t){let e=t.match(zD)?.groups;if(!e)return pO(t);switch(e.operator){case"^":return gO(e);case"~":case"~>":return DO(e);case"<":return yO(e);case"<=":return bO(e);case">":return vO(e);case">=":return wO(e);case"=":case"":return CO(e);default:throw new Error(`Cannot parse version range: '${e.operator}' is not a valid operator`)}}function _O(t){return t.split(/\s+/).flatMap(EO)}function ru(t){let e=t.replaceAll(/(?<=<|>|=|~|\^)(\s+)/g,"").split(/\s*\|\|\s*/).map(r=>mO(r)||_O(r));if(e.some(r=>r.includes(null)))throw new TypeError(`Cannot parse version range: range "${t}" is invalid`);return e}function _e(t){if(typeof t!="string")throw new TypeError(`Cannot parse version as version must be a string: received ${typeof t}`);if(t.length>qf)throw new TypeError(`Cannot parse version as version length is too long: length is ${t.length}, max length is ${qf}`);t=t.trim();let e=t.match(HD)?.groups;if(!e)throw new TypeError(`Cannot parse version: ${t}`);let r=pn(e.major,`Cannot parse version ${t}: invalid major version`),n=pn(e.minor,`Cannot parse version ${t}: invalid minor version`),o=pn(e.patch,`Cannot parse version ${t}: invalid patch version`),i=e.prerelease?xt(e.prerelease):[],a=e.buildmetadata?yr(e.buildmetadata):[];return{major:r,minor:n,patch:o,prerelease:i,build:a}}function WD(t,e){let r=t.operator,n=e.operator;if(r===void 0)return Vr(t)?!0:ha(t,[[e]]);if(n===void 0)return Vr(e)?!0:ha(e,[[t]]);let o=St(t,e);return(r===">="||r===">")&&(n===">="||n===">")||(r==="<="||r==="<")&&(n==="<="||n==="<")||o===0&&((r===">="||r==="<=")&&(n===">="||n==="<="))||o===-1&&(r===">="||r===">")&&(n==="<="||n==="<")||o===1&&(r==="<="||r==="<")&&(n===">="||n===">")}function xO(t){return t.every(e=>e.some(r=>SO(r)))}function SO(t){for(let e=0;e<t.length-1;e++){let r=t[e];for(let n of t.slice(e+1))if(!WD(r,n))return!1}return!0}function KD(t,e){return xO([t,e])&&t.some(r=>e.some(n=>r.every(o=>n.every(i=>WD(o,i)))))}function YD(t){try{return _e(t),!0}catch{return!1}}function dn(t,e){return St(t,e)>=0}var Vi=ge(a0()),rg=ge(L0()),z1=ge(gb()),wl=ge(Lh());function AC(t,e){let n=["normal","bold","dim","italic","underline","strikethrough"].indexOf(t),o="\x1B[";return o+n+"m"+e+o+"0m"}var ot=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 o=0;o<r.length;o++){let i=this.cast(n[o]).length;i>r[o]&&(r[o]=i)}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 o=this.cast(e),i=n?AC("bold",o):o,a=r-o.length,s=this.theme.row[1];switch(typeof e){case"number":return s.repeat(a)+i;case"string":return i+s.repeat(a);case"boolean":case"object":return s.repeat(Math.ceil(a/2))+AC("italic",o)+s.repeat(Math.floor(a/2));default:return s.repeat(a)}}renderRow(e,r=!1){let n=this.theme.row,o=this.columnWidth();return n[0]+e.map((i,a)=>this.renderCell(i,o[a],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(o=>this.renderRow(o)),r||n?this.renderLine(e.bot):""].filter(o=>o.length>0).join(`
151
- `)}};async function Bc(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 de(){let t=await Bc("@capgo/cli")??"",e=t?.split(".")[0];t!==mr.version&&p.warning(`\u{1F6A8} You are using @capgo/cli@${mr.version} it's not the latest version.
152
- Please use @capgo/cli@${t}" or @capgo/cli@${e} to keep up to date with the latest features and bug fixes.`)}function GR(t){return new Promise(e=>{setTimeout(e,t)})}function WR(t){return new Date(t||"").toLocaleTimeString()}async function or(t,e,r,n,o,i="\u2705"){await be(r,{channel:t,event:n,icon:i,user_id:e,...o?{tags:{"app-id":o}}:{},notify:!1})}async function KR(t,e,r,n){if(De(e))throw await or(t,r,n,"canceled",void 0,"\u{1F937}"),new Error("Command cancelled")}async function YR(t,e,r){try{let n=await ir(),o=r?{...e,rangeStart:r}:{...e},i=await fetch(`${n.hostApi}/private/stats`,{method:"POST",headers:{"Content-Type":"application/json",capgkey:t},body:JSON.stringify(o)});if(!i.ok)throw new Error(`HTTP error! status: ${i.status}`);let a=await i.json();if(a?.length>0)return a}catch(n){console.error("Cannot get devices",n),p.error(`Cannot get stats ${U(n)}`)}return[]}function JR(t){let e={get:{summary:()=>"Update request by device. Waiting for download\u2026",level:"info",snag:"done"},delete:{summary:()=>"Bundle deleted on device",level:"info"},set:{summary:()=>"Bundle set on device \u2764\uFE0F",level:"info",snag:"set",stop:!0},NoChannelOrOverride:{summary:()=>"No default channel/override; create it in channel settings",level:"error"},needPlanUpgrade:{summary:({baseUrl:r})=>`Out of quota. Upgrade plan: ${r}/dashboard/settings/plans`,level:"error"},missingBundle:{summary:()=>"Requested bundle not found on server",level:"error"},noNew:{summary:()=>"Device already has latest available version",level:"info"},disablePlatformIos:{summary:()=>"iOS platform disabled in channel",level:"error"},disablePlatformAndroid:{summary:()=>"Android platform disabled in channel",level:"error"},disableAutoUpdate:{summary:()=>"Automatic updates disabled in channel",level:"error"},disableAutoUpdateToMajor:{summary:()=>"Auto-update to major versions disabled",level:"error"},disableAutoUpdateToMinor:{summary:()=>"Auto-update to minor versions disabled",level:"error"},disableAutoUpdateToPatch:{summary:()=>"Auto-update to patch versions disabled",level:"error"},disableAutoUpdateUnderNative:{summary:()=>"Channel update version is lower than device native",level:"error"},disableDevBuild:{summary:()=>"Dev build updates disabled in channel",level:"error"},disableEmulator:{summary:()=>"Emulator updates disabled in channel",level:"error"},cannotGetBundle:{summary:()=>"Cannot retrieve bundle from channel",level:"error"},cannotUpdateViaPrivateChannel:{summary:()=>"No access to private channel",level:"error"},channelMisconfigured:{summary:()=>"Channel configuration invalid or incomplete",level:"error"},disableAutoUpdateMetadata:{summary:()=>"Auto-update on metadata disabled",level:"error"},set_fail:{summary:()=>"Bundle set failed. Possibly corrupted",level:"error"},reset:{summary:()=>"Device reset to builtin bundle",level:"warn"},update_fail:{summary:()=>"Installed bundle failed to call notifyAppReady",level:"error"},checksum_fail:{summary:()=>"Downloaded bundle checksum validation failed",level:"error"},windows_path_fail:{summary:()=>"Bundle contains illegal Windows-style paths",level:"error"},canonical_path_fail:{summary:()=>"Bundle contains non-canonical paths",level:"error"},directory_path_fail:{summary:()=>"Bundle ZIP contains invalid directory paths",level:"error"},unzip_fail:{summary:()=>"Failed to unzip bundle on device",level:"error"},low_mem_fail:{summary:()=>"Download failed due to low device memory",level:"error"},app_moved_to_background:{summary:()=>"App moved to background",level:"info"},app_moved_to_foreground:{summary:()=>"App moved to foreground",level:"info"},decrypt_fail:{summary:()=>"Failed to decrypt downloaded bundle",level:"error"},getChannel:{summary:()=>"Queried current channel on device",level:"info"},setChannel:{summary:()=>"Channel set on device",level:"info"},InvalidIp:{summary:()=>"Device appears in Google datacenter; blocking recent updates (<4h)",level:"warn"},uninstall:{summary:()=>"App uninstalled or Capgo data cleared on device",level:"warn"}};if(t.action.startsWith("download_")){let r=t.action.split("_")[1];return r==="complete"?{summary:()=>"Download complete; relaunch app to apply",level:"info",snag:"downloaded"}:r==="fail"?{summary:()=>"Download failed on device",level:"error"}:{summary:()=>`Downloading ${r}%`,level:"info"}}return e[t.action]||null}async function XR(t,e,r,n,o,i){let a=JR(t);if(!a)return{};a.snag&&await or(e,r,n,a.snag);let s=WR(t.created_at),u=t.action,c=t.version_id?`(version #${t.version_id})`:"",l=t.version?` (version ${t.version})`:c,f=`${a.summary({data:t,baseAppUrl:o,baseUrl:i})}${l}`;return{row:[s,t.device_id,u,f],stop:a.stop}}async function Uh(t,e,r,n,o){let i=!0,a=await ir(),s=`${a.hostWeb}/app/p/${r}`;await or(t,n,e,"Use waitlog",r);let u={appId:r,devicesId:o?[o]:void 0,order:[{key:"created_at",sortable:"desc"}],rangeStart:new Date().toISOString()},c=null,l=new Set,f=we(),d=`${a.host}/docs/plugins/updater/debugging/#sent-from-the-backend`;for(f.start(`Waiting for logs (Expect delay of 30 sec) more info: ${d}`);i;){await GR(5e3);let h=await YR(e,u,c);if(h.length>0){let m=h.reduce((E,g)=>{let _=new Date(g.created_at).getTime();return Math.max(E,_)},c?new Date(c).getTime():0);m>0&&(c=new Date(m).toISOString());let b=h.filter(E=>{let g=`${E.app_id}|${E.device_id}|${E.action}|${E.version_id}|${E.created_at}`;return l.has(g)?!1:(l.add(g),!0)}).sort((E,g)=>new Date(E.created_at).getTime()-new Date(g.created_at).getTime()),D=new ot;D.headers=["Time","Device","Key","Message"],D.theme=ot.roundTheme,D.rows=[];let C=!1;for(let E of b){let{row:g,stop:_}=await XR(E,t,n,e,s,a.hostWeb);g&&D.rows.push(g),_&&(C=!0)}if(D.rows.length&&(f.stop(""),p.info(D.toString()),f.start(`Waiting for logs (Expect delay of 30 sec) more info: ${d}`)),C){i=!1;break}}}return f.stop("Stop watching logs"),Promise.resolve()}async function OC(t,e){Z("Debug Live update in Capgo"),await de(),e.apikey=e.apikey||ie();let r=await te();t=he(t,r?.config);let n=e.device;if(!e.apikey)throw p.error("Missing API key, you need to provide an API key to delete your app"),new Error("Missing API key");if(!t)throw p.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let o=await ne(e.apikey,e.supaHost,e.supaAnon),i=await ar(o,t),a=await ye({message:"Automatic check if update working in device ?"});await KR("debug",a,i,e.apikey),a?(p.info(`Wait logs sent to Capgo from ${t} device, Please background your app and open it again \u{1F4AA}`),await Uh("debug",e.apikey,t,i,n),J("Done \u2705")):J("Canceled \u274C")}var Mh=require("node:buffer"),kC=require("node:crypto"),ZR=(()=>{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 QR(t){let e=4294967295;for(let r=0;r<t.length;r++){let n=t[r];e=ZR[(e^n)&255]^e>>>8}return e=e^4294967295,(e>>>0).toString(16).padStart(8,"0")}async function Xr(t,e="sha256"){let r=Mh.Buffer.isBuffer(t)?t:Mh.Buffer.from(t);if(e==="crc32")return QR(r);let n=(0,kC.createHash)(e);return n.update(r),n.digest("hex")}var ms=ge(u1());async function c1(){let t=await(0,ms.loadConfig)();return{config:t.app.extConfig,path:t.app.extConfigFilePath}}async function Tm(t,e,r=!1){let n=await(0,ms.loadConfig)(),{extConfig:o}=n.app;o&&(o.plugins||(o.plugins={extConfig:{},[t]:{}}),o.plugins[t]||(o.plugins[t]={}),r?o=e.config:o.plugins[t]=e.config.plugins?.[t],(0,ms.writeConfig)(o,n.app.extConfigFilePath))}async function Ui(t,e=!1){await Tm("CapacitorUpdater",t,e)}var zi=".capgo_key",Wt=".capgo_key_v2",Cl=`${zi}.pub`,tn=`${Wt}.pub`,N1="https://capgo.app",L1="https://files.capgo.app",U1="https://api.capgo.app",M1="https://console.capgo.app",ng=12e4,I5=1024*1024*20,R5=1024*1024*1024,B5=1024*1024*99,bt="package.json",Gi=/^(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,U=t=>t?`
153
- ${z1.default.render(t)}`:"";function bl(t){return new Promise(e=>{setTimeout(e,t)})}function G1(t){return(0,Rr.isMonorepo)(t)||(0,Rr.isNXMonorepo)(t)}function vt(t){return(0,Rr.isMonorepo)(t)?(0,Rr.findMonorepoRoot)(t):(0,Rr.isNXMonorepo)(t)?(0,Rr.findNXMonorepoRoot)(t):t}function W1(t=vt((0,cr.cwd)()),e=void 0){let r=e?.split(",")[0];if(r&&!(0,Ye.existsSync)(r)){let o=`Package.json at ${r} does not exist`;throw p.error(o),new Error(o)}let n=(0,Ye.readFileSync)(r??(0,Ke.join)(t,bt));return JSON.parse(n)}function og(t=vt((0,cr.cwd)()),e=void 0){return W1(t,e).scripts}function xr(t=vt((0,cr.cwd)()),e=void 0){return W1(t,e).version??""}function q1(t){let e=t.replace("^","").replace("~","");if(YD(e))try{let r=_e(e);return br(r)}catch{return e}return e}async function ft(t=vt((0,cr.cwd)()),e=void 0){let r=e?.split(",");if(r??=[(0,Ke.join)(t,bt)],r){for(let o of r)if(!(0,Ye.existsSync)(o)){let i=`Package.json at ${o} does not exist`;throw p.error(i),new Error(i)}}let n=new Map;for(let o of r){let i=(0,Ye.readFileSync)(o),a=JSON.parse(i);for(let s in a.dependencies)n.set(s,q1(a.dependencies[s]));for(let s in a.devDependencies)n.set(s,q1(a.devDependencies[s]))}return n}async function te(){try{let t=await c1();if(!t){let e="No capacitor config file found, run `cap init` first";throw p.error(e),new Error(e)}return t}catch(t){let e=`No capacitor config file found, run \`cap init\` first ${U(t)}`;throw p.error(e),new Error(e)}}async function ig(t,e){let r=await te();return r?.config&&(r.config.plugins??={},r.config.plugins.extConfig??={},r.config.plugins[t]??={},r.config.plugins[t]={...r.config.plugins[t],...e},await Tm(t,r)),r}async function bs(t){return ig("CapacitorUpdater",t)}async function ir(){try{let t=await te(),e={host:t?.config?.plugins?.CapacitorUpdater?.localHost||N1,hostWeb:t?.config?.plugins?.CapacitorUpdater?.localWebHost||M1,hostFilesApi:t?.config?.plugins?.CapacitorUpdater?.localApiFiles||L1,hostApi:t?.config?.plugins?.CapacitorUpdater?.localApi||U1};return t?.config?.plugins?.CapacitorUpdater?.localSupa&&t?.config?.plugins?.CapacitorUpdater?.localSupaAnon&&(p.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:N1,hostWeb:M1,hostFilesApi:L1,hostApi:U1}}}var j5=/([A-Za-z0-9]+)\.(java|swift|kt|scala)$/;async function El(){let t=await ir();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 p.info(`Local config ${U(t)}`),t}}async function K1(){let t=await ir();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:R5,maxChunkSize:B5,alertUploadSize:I5}}}async function ne(t,e,r){let n=await El();if(e&&r&&(p.info("Using custom supabase instance from provided options"),n.supaHost=e,n.supaKey=r),!n.supaHost||!n.supaKey)throw p.error("Cannot connect to server please try again later"),new Error("Cannot connect to server please try again later");return(0,Vi.createClient)(n.supaHost,n.supaKey,{auth:{persistSession:!1},global:{headers:{capgkey:t}}})}async function N5(t,e,r){let{data:n}=await t.rpc("is_allowed_capgkey",{apikey:e,keymode:r}).single();if(!n){p.error("Invalid API key or insufficient permissions.");let i=`Your key should be: ${r.map((a,s)=>r.length===1?`"${a}"`:s===r.length-1?`or "${a}"`:`"${a}", `).join("")} mode.`;throw p.error(i),new Error("Invalid API key or insufficient permissions.")}}async function Y1(t,e){let{data:r}=await t.rpc("is_paying_org",{orgid:e}).single();return r||!1}async function J1(t,e){let{data:r}=await t.rpc("is_trial_org",{orgid:e}).single();return r||0}async function L5(t,e){let{data:r}=await t.rpc("is_allowed_action_org",{orgid:e}).single();return!!r}async function U5(t,e,r){let{data:n}=await t.rpc("is_allowed_action",{apikey:r,appid:e}).single();return!!n}var wt=(a=>(a[a.none=0]="none",a[a.read=1]="read",a[a.upload=2]="upload",a[a.write=3]="write",a[a.admin=4]="admin",a[a.super_admin=5]="super_admin",a))(wt||{}),Wi=(t,e)=>t>=e;async function X1(t,e,r){let{data:n,error:o}=await t.rpc("get_org_perm_for_apikey",{apikey:e,app_id:r}).single();if(o)throw p.error("Cannot get permissions for organization!"),console.error(o),new Error("Cannot get permissions for organization");if(n.includes("perm")){let s=null;switch(n){case"perm_none":{s=0;break}case"perm_read":{s=1;break}case"perm_upload":{s=2;break}case"perm_write":{s=3;break}case"perm_admin":{s=4;break}case"perm_owner":{s=5;break}default:throw n.includes("invite")?(p.info("Please accept/deny the organization invitation before trying to access the app"),new Error("Organization invitation pending")):(p.error(`Invalid output when fetching organization permission. Response: ${n}`),new Error(`Invalid output when fetching organization permission. Response: ${n}`))}return{okay:!0,data:s}}let a=null;switch(n){case"INVALID_APIKEY":{a="INVALID_APIKEY";break}case"NO_APP":{a="NO_APP";break}case"NO_ORG":{a="NO_ORG";break}default:throw p.error(`Invalid error when fetching organization permission. Response: ${n}`),new Error(`Invalid error when fetching organization permission. Response: ${n}`)}return{okay:!1,error:a}}async function Z1(t,e,r){let{data:n,error:o}=await t.rpc("get_organization_cli_warnings",{orgid:e,cli_version:r});if(o){p.error(`Cannot get cli warnings: ${U(o)}`);return}if(n.length>0){p.warn(`Found ${n.length} cli warnings for your organization.`);let i=null;for(let a of n){if(typeof a!="object"||typeof a.message!="string"||typeof a.fatal!="boolean"){p.error(`Invalid cli warning: ${a}`);continue}let s=a;s.fatal?(p.error(`${s.message.replaceAll("\\n",`
154
- `)}`),i=new Error(s.message)):p.warn(`${s.message.replaceAll("\\n",`
155
- `)}`)}if(i)throw p.error("Please fix the warnings and try again."),i;p.info("End of cli warnings.")}}async function Q1(t,e,r,n,o=!0){let i=await El();if(!await(n?U5(t,n,r):L5(t,e)))throw p.error(`You need to upgrade your plan to continue to use capgo.
147
+ `);process.stdout.write(Xs.cursor.move(-999,_.length-1)),process.stdout.write(Xs.erase.down(_.length))},D=_=>_.replace(/\.+$/,""),C=_=>{let S=(performance.now()-_)/1e3,$=Math.floor(S/60),k=Math.floor(S%60);return $>0?`[${$}m ${k}s]`:`[${k}s]`},E=(_="")=>{a=!0,o=BD(),s=D(_),c=performance.now(),process.stdout.write(`${W.default.gray(qe)}
148
+ `);let S=0,$=0;h(),i=setInterval(()=>{if(n&&s===u)return;b(),u=s;let k=W.default.magenta(e[S]);if(n)process.stdout.write(`${k} ${s}...`);else if(t==="timer")process.stdout.write(`${k} ${s} ${C(c)}`);else{let B=".".repeat(Math.floor($)).slice(0,3);process.stdout.write(`${k} ${s}${B}`)}S=S+1<e.length?S+1:0,$=$<e.length?$+.125:0},r)},g=(_="",S=0)=>{a=!1,clearInterval(i),b();let $=S===0?W.default.green(Nf):S===1?W.default.red(jD):W.default.red(ND);s=D(_??s),t==="timer"?process.stdout.write(`${$} ${s} ${C(c)}
149
+ `):process.stdout.write(`${$} ${s}
150
+ `),m(),o()};return{start:E,stop:g,message:(_="")=>{s=D(_??s)}}};var W1=require("node:child_process"),ke=require("node:fs"),El=require("node:os"),Fe=me(require("node:path")),zt=require("node:process"),Ir=me(Qs());var Ct=require("fs"),ga=(t=".",e="unknown")=>{let r=`${t}/bun.lockb`,n=`${t}/bun.lock`,o=`${t}/pnpm-lock.yaml`,i=`${t}/shrinkwrap.yaml`,a=`${t}/yarn.lock`,s=`${t}/package-lock.json`,u=`${t}/npm-shrinkwrap.json`;return(0,Ct.existsSync)(r)||(0,Ct.existsSync)(n)?"bun":(0,Ct.existsSync)(o)||(0,Ct.existsSync)(i)?"pnpm":(0,Ct.existsSync)(a)?"yarn":(0,Ct.existsSync)(s)||(0,Ct.existsSync)(u)?"npm":e},eu=(t=ga(),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"}},LD=(t=".",e="npx")=>{let r=`${t}/bun.lockb`,n=`${t}/bun.lock`,o=`${t}/pnpm-lock.yaml`,i=`${t}/shrinkwrap.yaml`,a=`${t}/yarn.lock`,s=`${t}/package-lock.json`,u=`${t}/npm-shrinkwrap.json`;return(0,Ct.existsSync)(r)||(0,Ct.existsSync)(n)?"bunx":(0,Ct.existsSync)(o)||(0,Ct.existsSync)(i)?"pnpm exec":(0,Ct.existsSync)(a)?"yarn dlx":(0,Ct.existsSync)(s)||(0,Ct.existsSync)(u)?"npx":e};function tu(t,e){if(isNaN(t)||isNaN(e))throw new Error("Cannot compare against non-numbers");return t===e?0:t<e?-1:1}function qD(t=[],e=[]){return t.length&&!e.length?-1:!t.length&&e.length?1:0}function Hf(t=[],e=[]){let r=Math.max(t.length,e.length);for(let n=0;n<r;n++){let o=t[n],i=e[n];if(o===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(o===void 0)return-1;if(typeof o=="string"&&typeof i=="number")return 1;if(typeof o=="number"&&typeof i=="string"||o<i)return-1;if(o>i)return 1}return 0}var Uo="0|[1-9]\\d*",lO="\\d*[a-zA-Z-][a-zA-Z0-9-]*",fO=`(?<major>${Uo})\\.(?<minor>${Uo})\\.(?<patch>${Uo})`,UD=`(?:${Uo}|${lO})`,HD=`(?:-(?<prerelease>${UD}(?:\\.${UD})*))`,MD="[0-9A-Za-z-]+",VD=`(?:\\+(?<buildmetadata>${MD}(?:\\.${MD})*))`,zD=`v?${fO}${HD}?${VD}?`,GD=new RegExp(`^${zD}$`),WD="(?:<|>)?=?",pO="x|X|\\*",qf=`${Uo}|${pO}`,ru=`[v=\\s]*(?<major>${qf})(?:\\.(?<minor>${qf})(?:\\.(?<patch>${qf})${HD}?${VD}?)?)?`,KD=new RegExp(`^(?<operator>~>?|\\^|${WD})\\s*${ru}$`),YD=new RegExp(`^(?<operator>${WD})\\s*(${zD})$|^$`);function Vf(t){return typeof t=="number"&&!Number.isNaN(t)&&(!Number.isFinite(t)||0<=t&&t<=Number.MAX_SAFE_INTEGER)}var zf=256;var dO=new RegExp(`^${Uo}$`);function Et(t){return t.split(".").filter(Boolean).map(e=>{if(dO.test(e)){let r=Number(e);if(Vf(r))return r}return e})}function Dr(t){return t.split(".").filter(Boolean)}function dn(t,e){let r=Number(t);if(!Vf(r))throw new TypeError(e);return r}function Vr(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 _t(t,e){return t===e?0:tu(t.major,e.major)||tu(t.minor,e.minor)||tu(t.patch,e.patch)||qD(t.prerelease,e.prerelease)||Hf(t.prerelease,e.prerelease)}function Gf(t){return t.toFixed(0)}function yr(t){let e=Gf(t.major),r=Gf(t.minor),n=Gf(t.patch),o=t.prerelease?.join(".")??"",i=t.build?.join(".")??"";return[[`${e}.${r}.${n}`,o].filter(u=>u).join("-"),i].filter(u=>u).join("+")}function hO(t,e){if(Vr(e))return!0;let r=_t(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 nu(t,e){for(let r of e)if(!hO(t,r))return!1;if(t.prerelease&&t.prerelease.length>0){for(let r of e){if(Vr(r))continue;let{major:n,minor:o,patch:i,prerelease:a}=r;if(a&&a.length>0&&t.major===n&&t.minor===o&&t.patch===i)return!0}return!1}return!0}function Da(t,e){return e.some(r=>nu(t,r))}function mO(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 ya(t=[],e){let r=mO(t);if(!e)return r;let n=Et(e);if(n.every(o=>typeof o=="string")){if(n.every((o,i)=>o===r[i])&&typeof r[n.length]=="number")return r;n=[...n,0]}return n}function ba(t,e,r={}){let n=r.build!==void 0?Dr(r.build):t.build??[];switch(e){case"premajor":return{major:t.major+1,minor:0,patch:0,prerelease:ya(t.prerelease,r.prerelease),build:n};case"preminor":return{major:t.major,minor:t.minor+1,patch:0,prerelease:ya(t.prerelease,r.prerelease),build:n};case"prepatch":return{major:t.major,minor:t.minor,patch:t.patch+1,prerelease:ya(t.prerelease,r.prerelease),build:n};case"prerelease":{let i=(t.prerelease??[]).length===0?t.patch+1:t.patch;return{major:t.major,minor:t.minor,patch:i,prerelease:ya(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 i=(t.prerelease??[]).length===0||t.patch!==0?t.minor+1:t.minor;return{major:t.major,minor:i,patch:0,prerelease:[],build:n}}case"patch":{let i=(t.prerelease??[]).length===0?t.patch+1:t.patch;return{major:t.major,minor:t.minor,patch:i,prerelease:[],build:n}}case"pre":return{major:t.major,minor:t.minor,patch:t.patch,prerelease:ya(t.prerelease,r.prerelease),build:n};default:throw new TypeError(`Cannot increment version: invalid argument ${e}`)}}var ou={major:Number.NaN,minor:Number.NaN,patch:Number.NaN,prerelease:[],build:[]},Mo={operator:void 0,...ou};function Wf(t,e){return _t(t,e)>0}function Hn(t,e){return _t(t,e)<0}function gO(t){let r=t.match(YD)?.groups;if(!r)return null;let{operator:n,prerelease:o,buildmetadata:i}=r,a=r.major?{major:dn(r.major,`Cannot parse comparator ${t}: invalid major version`),minor:dn(r.minor,`Cannot parse comparator ${t}: invalid minor version`),patch:dn(r.patch,`Cannot parse comparator ${t}: invalid patch version`),prerelease:o?Et(o):[],build:i?Dr(i):[]}:ou;return{operator:n||void 0,...a}}function Te(t){return!t||t.toLowerCase()==="x"||t==="*"}function DO(t){if(!Te(t.major))return Te(t.minor)?{operator:">=",major:+t.major,minor:0,patch:0,prerelease:[],build:[]}:Te(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?Et(t.prerelease):[],build:[]}}function yO(t){if(!Te(t.major))return Te(t.minor)?{operator:"<",major:+t.major+1,minor:0,patch:0,prerelease:[],build:[]}:Te(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:Et(t.prerelease),build:[]}:{operator:"<=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:[],build:[]}}function bO(t){let e=t.match(new RegExp(`^${ru}`)),r=e?.groups;if(!r)return null;let n=e[0].length,o=t.slice(n).match(/^\s+-\s+/);if(!o)return null;let i=o[0].length,s=t.slice(n+i).match(new RegExp(`^${ru}\\s*$`))?.groups;if(!s)return null;let u=DO(r),c=yO(s);return[u,c].filter(Boolean)}function wO(t){let e=Te(t.major),r=Te(t.minor),n=Te(t.patch),o=+t.major,i=+t.minor,a=+t.patch;if(e)return[Mo];if(r)return[{operator:">=",major:o,minor:0,patch:0},{operator:"<",major:o+1,minor:0,patch:0}];if(n)return o===0?[{operator:">=",major:o,minor:i,patch:0},{operator:"<",major:o,minor:i+1,patch:0}]:[{operator:">=",major:o,minor:i,patch:0},{operator:"<",major:o+1,minor:0,patch:0}];let s=Et(t.prerelease??"");return o===0?i===0?[{operator:">=",major:o,minor:i,patch:a,prerelease:s},{operator:"<",major:o,minor:i,patch:a+1}]:[{operator:">=",major:o,minor:i,patch:a,prerelease:s},{operator:"<",major:o,minor:i+1,patch:0}]:[{operator:">=",major:o,minor:i,patch:a,prerelease:s},{operator:"<",major:o+1,minor:0,patch:0}]}function vO(t){let e=Te(t.major),r=Te(t.minor),n=Te(t.patch),o=+t.major,i=+t.minor,a=+t.patch;if(e)return[Mo];if(r)return[{operator:">=",major:o,minor:0,patch:0},{operator:"<",major:o+1,minor:0,patch:0}];if(n)return[{operator:">=",major:o,minor:i,patch:0},{operator:"<",major:o,minor:i+1,patch:0}];let s=Et(t.prerelease??"");return[{operator:">=",major:o,minor:i,patch:a,prerelease:s},{operator:"<",major:o,minor:i+1,patch:0}]}function CO(t){let e=Te(t.major),r=Te(t.minor),n=Te(t.patch),o=+t.major,i=+t.minor,a=+t.patch;if(e)return[{operator:"<",major:0,minor:0,patch:0}];if(r)return n?[{operator:"<",major:o,minor:0,patch:0}]:[{operator:"<",major:o,minor:0,patch:0}];if(n)return[{operator:"<",major:o,minor:i,patch:0}];let s=Et(t.prerelease??""),u=Dr(t.build??"");return[{operator:"<",major:o,minor:i,patch:a,prerelease:s,build:u}]}function EO(t){let e=Te(t.minor),r=Te(t.patch),n=+t.major,o=+t.minor,i=+t.patch;if(e)return r?[{operator:"<",major:n+1,minor:0,patch:0}]:[{operator:"<",major:n,minor:o+1,patch:0}];if(r)return[{operator:"<",major:n,minor:o+1,patch:0}];let a=Et(t.prerelease??""),s=Dr(t.build??"");return[{operator:"<=",major:n,minor:o,patch:i,prerelease:a,build:s}]}function _O(t){let e=Te(t.major),r=Te(t.minor),n=Te(t.patch),o=+t.major,i=+t.minor,a=+t.patch;if(e)return[{operator:"<",major:0,minor:0,patch:0}];if(r)return[{operator:">=",major:o+1,minor:0,patch:0}];if(n)return[{operator:">=",major:o,minor:i+1,patch:0}];let s=Et(t.prerelease??""),u=Dr(t.build??"");return[{operator:">",major:o,minor:i,patch:a,prerelease:s,build:u}]}function xO(t){let e=Te(t.major),r=Te(t.minor),n=Te(t.patch),o=+t.major,i=+t.minor,a=+t.patch;if(e)return[Mo];if(r)return n?[{operator:">=",major:o,minor:0,patch:0}]:[{operator:">=",major:o,minor:0,patch:0}];if(n)return[{operator:">=",major:o,minor:i,patch:0}];let s=Et(t.prerelease??""),u=Dr(t.build??"");return[{operator:">=",major:o,minor:i,patch:a,prerelease:s,build:u}]}function SO(t){let e=Te(t.major),r=Te(t.minor),n=Te(t.patch),o=+t.major,i=+t.minor,a=+t.patch;if(e)return[Mo];if(r)return[{operator:">=",major:o,minor:0,patch:0},{operator:"<",major:o+1,minor:0,patch:0}];if(n)return[{operator:">=",major:o,minor:i,patch:0},{operator:"<",major:o,minor:i+1,patch:0}];let s=Et(t.prerelease??""),u=Dr(t.build??"");return[{operator:void 0,major:o,minor:i,patch:a,prerelease:s,build:u}]}function FO(t){let e=t.match(KD)?.groups;if(!e)return gO(t);switch(e.operator){case"^":return wO(e);case"~":case"~>":return vO(e);case"<":return CO(e);case"<=":return EO(e);case">":return _O(e);case">=":return xO(e);case"=":case"":return SO(e);default:throw new Error(`Cannot parse version range: '${e.operator}' is not a valid operator`)}}function AO(t){return t.split(/\s+/).flatMap(FO)}function iu(t){let e=t.replaceAll(/(?<=<|>|=|~|\^)(\s+)/g,"").split(/\s*\|\|\s*/).map(r=>bO(r)||AO(r));if(e.some(r=>r.includes(null)))throw new TypeError(`Cannot parse version range: range "${t}" is invalid`);return e}function _e(t){if(typeof t!="string")throw new TypeError(`Cannot parse version as version must be a string: received ${typeof t}`);if(t.length>zf)throw new TypeError(`Cannot parse version as version length is too long: length is ${t.length}, max length is ${zf}`);t=t.trim();let e=t.match(GD)?.groups;if(!e)throw new TypeError(`Cannot parse version: ${t}`);let r=dn(e.major,`Cannot parse version ${t}: invalid major version`),n=dn(e.minor,`Cannot parse version ${t}: invalid minor version`),o=dn(e.patch,`Cannot parse version ${t}: invalid patch version`),i=e.prerelease?Et(e.prerelease):[],a=e.buildmetadata?Dr(e.buildmetadata):[];return{major:r,minor:n,patch:o,prerelease:i,build:a}}function JD(t,e){let r=t.operator,n=e.operator;if(r===void 0)return Vr(t)?!0:Da(t,[[e]]);if(n===void 0)return Vr(e)?!0:Da(e,[[t]]);let o=_t(t,e);return(r===">="||r===">")&&(n===">="||n===">")||(r==="<="||r==="<")&&(n==="<="||n==="<")||o===0&&((r===">="||r==="<=")&&(n===">="||n==="<="))||o===-1&&(r===">="||r===">")&&(n==="<="||n==="<")||o===1&&(r==="<="||r==="<")&&(n===">="||n===">")}function OO(t){return t.every(e=>e.some(r=>kO(r)))}function kO(t){for(let e=0;e<t.length-1;e++){let r=t[e];for(let n of t.slice(e+1))if(!JD(r,n))return!1}return!0}function XD(t,e){return OO([t,e])&&t.some(r=>e.some(n=>r.every(o=>n.every(i=>JD(o,i)))))}function ZD(t){try{return _e(t),!0}catch{return!1}}function hn(t,e){return _t(t,e)>=0}var Wi=me(c0()),ig=me(q0()),K1=me(bb()),_l=me(qh());function $C(t,e){let n=["normal","bold","dim","italic","underline","strikethrough"].indexOf(t),o="\x1B[";return o+n+"m"+e+o+"0m"}var it=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 o=0;o<r.length;o++){let i=this.cast(n[o]).length;i>r[o]&&(r[o]=i)}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 o=this.cast(e),i=n?$C("bold",o):o,a=r-o.length,s=this.theme.row[1];switch(typeof e){case"number":return s.repeat(a)+i;case"string":return i+s.repeat(a);case"boolean":case"object":return s.repeat(Math.ceil(a/2))+$C("italic",o)+s.repeat(Math.floor(a/2));default:return s.repeat(a)}}renderRow(e,r=!1){let n=this.theme.row,o=this.columnWidth();return n[0]+e.map((i,a)=>this.renderCell(i,o[a],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(o=>this.renderRow(o)),r||n?this.renderLine(e.bot):""].filter(o=>o.length>0).join(`
151
+ `)}};async function Lc(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 de(){let t=await Lc("@capgo/cli")??"",e=t?.split(".")[0];t!==hr.version&&f.warning(`\u{1F6A8} You are using @capgo/cli@${hr.version} it's not the latest version.
152
+ Please use @capgo/cli@${t}" or @capgo/cli@${e} to keep up to date with the latest features and bug fixes.`)}function J8(t){return new Promise(e=>{setTimeout(e,t)})}function X8(t){return new Date(t||"").toLocaleTimeString()}async function or(t,e,r,n,o,i="\u2705"){await be(r,{channel:t,event:n,icon:i,user_id:e,...o?{tags:{"app-id":o}}:{},notify:!1})}async function Z8(t,e,r,n){if(De(e))throw await or(t,r,n,"canceled",void 0,"\u{1F937}"),new Error("Command cancelled")}async function Q8(t,e,r){try{let n=await ir(),o=r?{...e,rangeStart:r}:{...e},i=await fetch(`${n.hostApi}/private/stats`,{method:"POST",headers:{"Content-Type":"application/json",capgkey:t},body:JSON.stringify(o)});if(!i.ok)throw new Error(`HTTP error! status: ${i.status}`);let a=await i.json();if(a?.length>0)return a}catch(n){console.error("Cannot get devices",n),f.error(`Cannot get stats ${L(n)}`)}return[]}function eB(t){let e={get:{summary:()=>"Update request by device. Waiting for download\u2026",level:"info",snag:"done"},delete:{summary:()=>"Bundle deleted on device",level:"info"},set:{summary:()=>"Bundle set on device \u2764\uFE0F",level:"info",snag:"set",stop:!0},NoChannelOrOverride:{summary:()=>"No default channel/override; create it in channel settings",level:"error"},needPlanUpgrade:{summary:({baseUrl:r})=>`Out of quota. Upgrade plan: ${r}/dashboard/settings/plans`,level:"error"},missingBundle:{summary:()=>"Requested bundle not found on server",level:"error"},noNew:{summary:()=>"Device already has latest available version",level:"info"},disablePlatformIos:{summary:()=>"iOS platform disabled in channel",level:"error"},disablePlatformAndroid:{summary:()=>"Android platform disabled in channel",level:"error"},disableAutoUpdate:{summary:()=>"Automatic updates disabled in channel",level:"error"},disableAutoUpdateToMajor:{summary:()=>"Auto-update to major versions disabled",level:"error"},disableAutoUpdateToMinor:{summary:()=>"Auto-update to minor versions disabled",level:"error"},disableAutoUpdateToPatch:{summary:()=>"Auto-update to patch versions disabled",level:"error"},disableAutoUpdateUnderNative:{summary:()=>"Channel update version is lower than device native",level:"error"},disableDevBuild:{summary:()=>"Dev build updates disabled in channel",level:"error"},disableEmulator:{summary:()=>"Emulator updates disabled in channel",level:"error"},cannotGetBundle:{summary:()=>"Cannot retrieve bundle from channel",level:"error"},cannotUpdateViaPrivateChannel:{summary:()=>"No access to private channel",level:"error"},channelMisconfigured:{summary:()=>"Channel configuration invalid or incomplete",level:"error"},disableAutoUpdateMetadata:{summary:()=>"Auto-update on metadata disabled",level:"error"},set_fail:{summary:()=>"Bundle set failed. Possibly corrupted",level:"error"},reset:{summary:()=>"Device reset to builtin bundle",level:"warn"},update_fail:{summary:()=>"Installed bundle failed to call notifyAppReady",level:"error"},checksum_fail:{summary:()=>"Downloaded bundle checksum validation failed",level:"error"},windows_path_fail:{summary:()=>"Bundle contains illegal Windows-style paths",level:"error"},canonical_path_fail:{summary:()=>"Bundle contains non-canonical paths",level:"error"},directory_path_fail:{summary:()=>"Bundle ZIP contains invalid directory paths",level:"error"},unzip_fail:{summary:()=>"Failed to unzip bundle on device",level:"error"},low_mem_fail:{summary:()=>"Download failed due to low device memory",level:"error"},app_moved_to_background:{summary:()=>"App moved to background",level:"info"},app_moved_to_foreground:{summary:()=>"App moved to foreground",level:"info"},decrypt_fail:{summary:()=>"Failed to decrypt downloaded bundle",level:"error"},getChannel:{summary:()=>"Queried current channel on device",level:"info"},setChannel:{summary:()=>"Channel set on device",level:"info"},InvalidIp:{summary:()=>"Device appears in Google datacenter; blocking recent updates (<4h)",level:"warn"},uninstall:{summary:()=>"App uninstalled or Capgo data cleared on device",level:"warn"}};if(t.action.startsWith("download_")){let r=t.action.split("_")[1];return r==="complete"?{summary:()=>"Download complete; relaunch app to apply",level:"info",snag:"downloaded"}:r==="fail"?{summary:()=>"Download failed on device",level:"error"}:{summary:()=>`Downloading ${r}%`,level:"info"}}return e[t.action]||null}async function tB(t,e,r,n,o,i){let a=eB(t);if(!a)return{};a.snag&&await or(e,r,n,a.snag);let s=X8(t.created_at),u=t.action,c=t.version_id?`(version #${t.version_id})`:"",l=t.version?` (version ${t.version})`:c,p=`${a.summary({data:t,baseAppUrl:o,baseUrl:i})}${l}`;return{row:[s,t.device_id,u,p],stop:a.stop}}async function Hh(t,e,r,n,o){let i=!0,a=await ir(),s=`${a.hostWeb}/app/p/${r}`;await or(t,n,e,"Use waitlog",r);let u={appId:r,devicesId:o?[o]:void 0,order:[{key:"created_at",sortable:"desc"}],rangeStart:new Date().toISOString()},c=null,l=new Set,p=ve(),d=`${a.host}/docs/plugins/updater/debugging/#sent-from-the-backend`;for(p.start(`Waiting for logs (Expect delay of 30 sec) more info: ${d}`);i;){await J8(5e3);let h=await Q8(e,u,c);if(h.length>0){let m=h.reduce((E,g)=>{let _=new Date(g.created_at).getTime();return Math.max(E,_)},c?new Date(c).getTime():0);m>0&&(c=new Date(m).toISOString());let b=h.filter(E=>{let g=`${E.app_id}|${E.device_id}|${E.action}|${E.version_id}|${E.created_at}`;return l.has(g)?!1:(l.add(g),!0)}).sort((E,g)=>new Date(E.created_at).getTime()-new Date(g.created_at).getTime()),D=new it;D.headers=["Time","Device","Key","Message"],D.theme=it.roundTheme,D.rows=[];let C=!1;for(let E of b){let{row:g,stop:_}=await tB(E,t,n,e,s,a.hostWeb);g&&D.rows.push(g),_&&(C=!0)}if(D.rows.length&&(p.stop(""),f.info(D.toString()),p.start(`Waiting for logs (Expect delay of 30 sec) more info: ${d}`)),C){i=!1;break}}}return p.stop("Stop watching logs"),Promise.resolve()}async function PC(t,e){Z("Debug Live update in Capgo"),await de(),e.apikey=e.apikey||ie();let r=await te();t=he(t,r?.config);let n=e.device;if(!e.apikey)throw f.error("Missing API key, you need to provide an API key to delete your app"),new Error("Missing API key");if(!t)throw f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let o=await re(e.apikey,e.supaHost,e.supaAnon),i=await ar(o,t),a=await ye({message:"Automatic check if update working in device ?"});await Z8("debug",a,i,e.apikey),a?(f.info(`Wait logs sent to Capgo from ${t} device, Please background your app and open it again \u{1F4AA}`),await Hh("debug",e.apikey,t,i,n),J("Done \u2705")):J("Canceled \u274C")}var Vh=require("node:buffer"),TC=require("node:crypto"),rB=(()=>{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 nB(t){let e=4294967295;for(let r=0;r<t.length;r++){let n=t[r];e=rB[(e^n)&255]^e>>>8}return e=e^4294967295,(e>>>0).toString(16).padStart(8,"0")}async function Xr(t,e="sha256"){let r=Vh.Buffer.isBuffer(t)?t:Vh.Buffer.from(t);if(e==="crc32")return nB(r);let n=(0,TC.createHash)(e);return n.update(r),n.digest("hex")}var ys=me(f1());async function p1(){let t=await(0,ys.loadConfig)();return{config:t.app.extConfig,path:t.app.extConfigFilePath}}async function Bm(t,e,r=!1){let n=await(0,ys.loadConfig)(),{extConfig:o}=n.app;o&&(o.plugins||(o.plugins={extConfig:{},[t]:{}}),o.plugins[t]||(o.plugins[t]={}),r?o=e.config:o.plugins[t]=e.config.plugins?.[t],(0,ys.writeConfig)(o,n.app.extConfigFilePath))}async function Hi(t,e=!1){await Bm("CapacitorUpdater",t,e)}var Ki=".capgo_key",Wt=".capgo_key_v2",xl=`${Ki}.pub`,tn=`${Wt}.pub`,M1="https://capgo.app",q1="https://files.capgo.app",H1="https://api.capgo.app",V1="https://console.capgo.app",ag=12e4,N5=1024*1024*20,L5=1024*1024*1024,U5=1024*1024*99,Rr="package.json",Yi=/^(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,L=t=>t?`
153
+ ${K1.default.render(t)}`:"";function Cl(t){return new Promise(e=>{setTimeout(e,t)})}function Y1(t){return(0,Ir.isMonorepo)(t)||(0,Ir.isNXMonorepo)(t)}function yt(t){return(0,Ir.isMonorepo)(t)?(0,Ir.findMonorepoRoot)(t):(0,Ir.isNXMonorepo)(t)?(0,Ir.findNXMonorepoRoot)(t):t}function J1(t=yt((0,zt.cwd)()),e=void 0){let r=e?.split(",")[0];if(r&&!(0,ke.existsSync)(r)){let o=`Package.json at ${r} does not exist`;throw f.error(o),new Error(o)}let n=(0,ke.readFileSync)(r??(0,Fe.join)(t,Rr));return JSON.parse(n)}function sg(t=yt((0,zt.cwd)()),e=void 0){return J1(t,e).scripts}function _r(t=yt((0,zt.cwd)()),e=void 0){return J1(t,e).version??""}function z1(t){let e=t.replace("^","").replace("~","");if(ZD(e))try{let r=_e(e);return yr(r)}catch{return e}return e}async function rn(t,e=(0,zt.cwd)(),r){if(t!=="@capgo/capacitor-updater")return null;if(r)try{let a=(await Gt(e,r)).get(t);if(a)return a}catch{}let n=null,o=(0,Fe.join)(e,"ios","App","Podfile");if((0,ke.existsSync)(o))try{let a=(0,ke.readFileSync)(o,"utf-8").match(/pod\s+['"]CapgoCapacitorUpdater['"],\s*:path\s*=>\s*['"]([^'"]+)['"]/);a?.[1]&&(n=(0,Fe.resolve)((0,Fe.join)(e,"ios","App",a[1])))}catch{}if(!n){let i=(0,Fe.join)(e,"android","capacitor.settings.gradle");if((0,ke.existsSync)(i))try{let s=(0,ke.readFileSync)(i,"utf-8").match(/project\(':capgo-capacitor-updater'\)\.projectDir\s*=\s*new\s+File\(['"]([^'"]+)['"]/);s?.[1]&&(n=(0,Fe.resolve)((0,Fe.join)(e,"android",s[1])).replace(/\/android$/,""))}catch{}}if(n){let i=(0,Fe.join)(n,Rr);if((0,ke.existsSync)(i))try{let a=JSON.parse((0,ke.readFileSync)(i,"utf-8"));if(a.version)return a.version}catch{}}try{let a=(await Gt(e)).get(t);if(a)return a}catch{}return null}async function Gt(t=yt((0,zt.cwd)()),e=void 0){let r=e?.split(",");if(r??=[(0,Fe.join)(t,Rr)],r){for(let o of r)if(!(0,ke.existsSync)(o)){let i=`Package.json at ${o} does not exist`;throw f.error(i),new Error(i)}}let n=new Map;for(let o of r){let i=(0,ke.readFileSync)(o),a=JSON.parse(i);for(let s in a.dependencies)n.set(s,z1(a.dependencies[s]));for(let s in a.devDependencies)n.set(s,z1(a.devDependencies[s]))}return n}async function te(){try{let t=await p1();if(!t){let e="No capacitor config file found, run `cap init` first";throw f.error(e),new Error(e)}return t}catch(t){let e=`No capacitor config file found, run \`cap init\` first ${L(t)}`;throw f.error(e),new Error(e)}}async function ug(t,e){let r=await te();return r?.config&&(r.config.plugins??={},r.config.plugins.extConfig??={},r.config.plugins[t]??={},r.config.plugins[t]={...r.config.plugins[t],...e},await Bm(t,r)),r}async function Cs(t){return ug("CapacitorUpdater",t)}async function ir(){try{let t=await te(),e={host:t?.config?.plugins?.CapacitorUpdater?.localHost||M1,hostWeb:t?.config?.plugins?.CapacitorUpdater?.localWebHost||V1,hostFilesApi:t?.config?.plugins?.CapacitorUpdater?.localApiFiles||q1,hostApi:t?.config?.plugins?.CapacitorUpdater?.localApi||H1};return t?.config?.plugins?.CapacitorUpdater?.localSupa&&t?.config?.plugins?.CapacitorUpdater?.localSupaAnon&&(f.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:M1,hostWeb:V1,hostFilesApi:q1,hostApi:H1}}}var M5=/([A-Za-z0-9]+)\.(java|swift|kt|scala)$/;async function Sl(){let t=await ir();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 f.info(`Local config ${L(t)}`),t}}async function X1(){let t=await ir();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:L5,maxChunkSize:U5,alertUploadSize:N5}}}async function re(t,e,r){let n=await Sl();if(e&&r&&(f.info("Using custom supabase instance from provided options"),n.supaHost=e,n.supaKey=r),!n.supaHost||!n.supaKey)throw f.error("Cannot connect to server please try again later"),new Error("Cannot connect to server please try again later");return(0,Wi.createClient)(n.supaHost,n.supaKey,{auth:{persistSession:!1},global:{headers:{capgkey:t}}})}async function q5(t,e,r){let{data:n}=await t.rpc("is_allowed_capgkey",{apikey:e,keymode:r}).single();if(!n){f.error("Invalid API key or insufficient permissions.");let i=`Your key should be: ${r.map((a,s)=>r.length===1?`"${a}"`:s===r.length-1?`or "${a}"`:`"${a}", `).join("")} mode.`;throw f.error(i),new Error("Invalid API key or insufficient permissions.")}}async function Z1(t,e){let{data:r}=await t.rpc("is_paying_org",{orgid:e}).single();return r||!1}async function Q1(t,e){let{data:r}=await t.rpc("is_trial_org",{orgid:e}).single();return r||0}async function H5(t,e){let{data:r}=await t.rpc("is_allowed_action_org",{orgid:e}).single();return!!r}async function V5(t,e,r){let{data:n}=await t.rpc("is_allowed_action",{apikey:r,appid:e}).single();return!!n}var bt=(a=>(a[a.none=0]="none",a[a.read=1]="read",a[a.upload=2]="upload",a[a.write=3]="write",a[a.admin=4]="admin",a[a.super_admin=5]="super_admin",a))(bt||{}),Ji=(t,e)=>t>=e;async function eS(t,e,r){let{data:n,error:o}=await t.rpc("get_org_perm_for_apikey",{apikey:e,app_id:r}).single();if(o)throw f.error("Cannot get permissions for organization!"),console.error(o),new Error("Cannot get permissions for organization");if(n.includes("perm")){let s=null;switch(n){case"perm_none":{s=0;break}case"perm_read":{s=1;break}case"perm_upload":{s=2;break}case"perm_write":{s=3;break}case"perm_admin":{s=4;break}case"perm_owner":{s=5;break}default:throw n.includes("invite")?(f.info("Please accept/deny the organization invitation before trying to access the app"),new Error("Organization invitation pending")):(f.error(`Invalid output when fetching organization permission. Response: ${n}`),new Error(`Invalid output when fetching organization permission. Response: ${n}`))}return{okay:!0,data:s}}let a=null;switch(n){case"INVALID_APIKEY":{a="INVALID_APIKEY";break}case"NO_APP":{a="NO_APP";break}case"NO_ORG":{a="NO_ORG";break}default:throw f.error(`Invalid error when fetching organization permission. Response: ${n}`),new Error(`Invalid error when fetching organization permission. Response: ${n}`)}return{okay:!1,error:a}}async function tS(t,e,r){let{data:n,error:o}=await t.rpc("get_organization_cli_warnings",{orgid:e,cli_version:r});if(o){f.error(`Cannot get cli warnings: ${L(o)}`);return}if(n.length>0){f.warn(`Found ${n.length} cli warnings for your organization.`);let i=null;for(let a of n){if(typeof a!="object"||typeof a.message!="string"||typeof a.fatal!="boolean"){f.error(`Invalid cli warning: ${a}`);continue}let s=a;s.fatal?(f.error(`${s.message.replaceAll("\\n",`
154
+ `)}`),i=new Error(s.message)):f.warn(`${s.message.replaceAll("\\n",`
155
+ `)}`)}if(i)throw f.error("Please fix the warnings and try again."),i;f.info("End of cli warnings.")}}async function rS(t,e,r,n,o=!0){let i=await Sl();if(!await(n?V5(t,n,r):H5(t,e)))throw f.error(`You need to upgrade your plan to continue to use capgo.
156
156
  Upgrade here: ${i.hostWeb}/dashboard/settings/plans
157
- `),bl(100),Promise.resolve().then(()=>(eg(),Qm)).then(c=>{c.default(`${i.hostWeb}/dashboard/settings/plans`)}),bl(500),new Error("Plan upgrade required");let[s,u]=await Promise.all([J1(t,e),Y1(t,e)]);s>0&&o&&!u&&p.warn(`WARNING !!
157
+ `),Cl(100),Promise.resolve().then(()=>(ng(),rg)).then(c=>{c.default(`${i.hostWeb}/dashboard/settings/plans`)}),Cl(500),new Error("Plan upgrade required");let[s,u]=await Promise.all([Q1(t,e),Z1(t,e)]);s>0&&o&&!u&&f.warn(`WARNING !!
158
158
  Trial expires in ${s} days, upgrade here: ${i.hostWeb}/dashboard/settings/plans
159
- `)}async function e2(t,e,r,n,o=!0){let i=await El(),{data:a}=await t.rpc("is_allowed_action_org_action",{orgid:e,actions:["storage"]});if(!a)throw p.error(`You need to upgrade your plan to continue to use capgo.
159
+ `)}async function nS(t,e,r,n,o=!0){let i=await Sl(),{data:a}=await t.rpc("is_allowed_action_org_action",{orgid:e,actions:["storage"]});if(!a)throw f.error(`You need to upgrade your plan to continue to use capgo.
160
160
  Upgrade here: ${i.hostWeb}/dashboard/settings/plans
161
- `),bl(100),Promise.resolve().then(()=>(eg(),Qm)).then(c=>{c.default(`${i.hostWeb}/dashboard/settings/plans`)}),bl(500),new Error("Plan upgrade required for upload");let[s,u]=await Promise.all([J1(t,e),Y1(t,e)]);s>0&&o&&!u&&p.warn(`WARNING !!
161
+ `),Cl(100),Promise.resolve().then(()=>(ng(),rg)).then(c=>{c.default(`${i.hostWeb}/dashboard/settings/plans`)}),Cl(500),new Error("Plan upgrade required for upload");let[s,u]=await Promise.all([Q1(t,e),Z1(t,e)]);s>0&&o&&!u&&f.warn(`WARNING !!
162
162
  Trial expires in ${s} days, upgrade here: ${i.hostWeb}/dashboard/settings/plans
163
- `)}function ie(t=!1){let e=cr.env.CAPGO_TOKEN?.trim();if(e)return t||p.info("Use CAPGO_TOKEN environment variable"),e;let r=(0,vl.homedir)(),n,o=`${r}/.capgo`;if((0,Ye.existsSync)(o)&&(t||p.info(`Use global API key ${o}`),n=(0,Ye.readFileSync)(o,"utf8").trim()),o=".capgo",!n&&(0,Ye.existsSync)(o)&&(t||p.info(`Use local API key ${o}`),n=(0,Ye.readFileSync)(o,"utf8").trim()),!n){let i=`Cannot find API key in local folder or global, please login first with ${Qe().runner} @capacitor/cli login`;throw p.error(i),new Error(i)}return n}async function*ag(t){let e=await(0,Ye.readdirSync)(t,{withFileTypes:!0});for(let r of e){let n=(0,Ke.resolve)(t,r.name);r.isDirectory()&&!r.name.startsWith(".")&&!r.name.startsWith("node_modules")&&!r.name.startsWith("dist")?yield*ag(n):yield n}}function Ki(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 _l(){let t=(0,cr.cwd)(),e=!1,r=(0,Ke.resolve)(t,"tsconfig.json");(0,Ye.existsSync)(r)&&(e=!0);for await(let n of ag(t)){if(n.includes("angular.json"))return p.info("Found angular project"),e?"angular-ts":"angular-js";if(n.includes("nuxt.config.js")||n.includes("nuxt.config.ts"))return p.info("Found nuxtjs project"),e?"nuxtjs-ts":"nuxtjs-js";if(n.includes("next.config.js")||n.includes("next.config.mjs"))return p.info("Found nextjs project"),e?"nextjs-ts":"nextjs-js";if(n.includes("svelte.config.js"))return p.info("Found sveltekit project"),e?"sveltekit-ts":"sveltekit-js";if(n.includes("rolluconfig.js"))return p.info("Found svelte project"),e?"svelte-ts":"svelte-js";if(n.includes("vue.config.js"))return p.info("Found vue project"),e?"vue-ts":"vue-js";if(n.includes(bt)){let o=(0,Ke.dirname)(n),i=await ft(o);if(i){if(i.get("react"))return p.info("Found react project test"),e?"react-ts":"react-js";if(i.get("vue"))return p.info("Found vue project"),e?"vue-ts":"vue-js"}}}return"unknown"}function t2(t,e){return t==="angular-js"||t==="angular-ts"?e?"src/main.ts":"src/main.js":t==="nextjs-js"||t==="nextjs-ts"?e?"src/app/layout.tsx":"src/app/layout.js":t==="svelte-js"||t==="svelte-ts"||t==="vue-js"||t==="vue-ts"?e?"src/main.ts":"src/main.js":t==="react-js"||t==="react-ts"?e?"src/index.tsx":"src/index.js":null}async function sg(t){if(t==="angular")return p.info("Angular project detected"),"build";if(t==="nuxtjs")return p.info("Nuxtjs project detected"),"generate";if(t==="nextjs"){if(p.info("Nextjs project detected"),p.warn("Please make sure you have configured static export in your next.config.js: https://nextjs.org/docs/pages/building-your-application/deploying/static-exports"),p.warn("Please make sure you have the output: 'export' and distDir: 'dist' in your next.config.js"),!await ye({message:"Do you want to continue?"})){let r="Build command selection aborted by user";throw p.error(r),new Error(r)}return"build"}if(t==="sveltekit"){if(p.info("Sveltekit project detected"),p.warn("Please make sure you have the adapter-static installed: https://kit.svelte.dev/docs/adapter-static"),p.warn("Please make sure you have the pages: 'dist' and assets: 'dest', in your svelte.config.js adapter"),!await ye({message:"Do you want to continue?"})){let r="Build command selection aborted by user";throw p.error(r),new Error(r)}return"build"}return"build"}async function r2(){let t=/(main|index)\.(ts|tsx|js|jsx)$/,e="",r=(0,cr.cwd)(),n=r.split("/").length;for await(let o of ag(r))if(o.split("/").length-n<=2&&t.test(o)){e=o,p.info(`Found main file here ${o}`);break}return e}async function ug(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 n2(t,e,r){let n={app_id:e,name:r,version:0};try{let i=await t.functions.invoke("files/upload_link",{body:JSON.stringify(n)});if(i.error){if(i.error instanceof Vi.FunctionsHttpError){let a=await i.error.context.json();p.error(`Upload URL error: ${a.status||JSON.stringify(a)}`)}else p.error(`Cannot get upload url: ${i.error.message}`);return""}return i.data.url}catch(o){p.error(`Cannot get upload url ${U(o)}`)}return""}async function*o2(t){let e=(0,Ye.readdirSync)(t,{withFileTypes:!0});for(let r of e){let n=(0,Ke.join)(t,r.name);r.isDirectory()?yield*o2(n):yield n}}async function i2(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 o2(t)){if(r.some(s=>n.includes(s))){p.info(`Ignoring file ${n}, please ensure you have only required files in your dist folder`);continue}let o=(0,Ye.readFileSync)(n);if(o.length===0){p.info(`Ignoring empty file ${n}, please ensure you have only required files in your dist folder`);continue}let i=await Xr(o,"sha256"),a=(0,Ke.relative)(t,n);a.startsWith("/")&&(a=a.substring(1)),e.push({file:a,hash:i})}return e}async function xl(t){return(0,vl.platform)()==="win32"?q5(t):M5(t)}function M5(t){let e=new rg.default;return e.addLocalFolder(t),e.toBuffer()}async function q5(t){p.info("Zipping file windows mode");let e=new rg.default,r=(n,o)=>{let i=(0,Ye.readdirSync)(n);for(let a of i){let s=(0,Ke.join)(n,a),u=(0,Ye.statSync)(s);if(u.isFile()){let c=(0,Ye.readFileSync)(s);e.addFile((0,Ke.join)(o,a).split(Ke.sep).join("/"),c)}else u.isDirectory()&&r(s,(0,Ke.join)(o,a))}};return r(t,""),e.toBuffer()}async function a2(t,e,r,n,o,i,a,s){return new Promise((u,c)=>{be(t,{channel:"app",event:"App TUS upload",icon:"\u23EB",user_id:r,tags:{"app-id":n},notify:!1}),new wl.Upload(e,{endpoint:`${a.hostFilesApi}/files/upload/attachments/`,chunkSize:s,metadataForPartialUploads:{filename:`orgs/${r}/apps/${n}/${o}.zip`,filetype:"application/gzip"},metadata:{filename:`orgs/${r}/apps/${n}/${o}.zip`,filetype:"application/zip"},headers:{Authorization:t},onError(f){if(p.error(`Error uploading bundle: ${f.message}`),f instanceof wl.DetailedError){let d=f.originalResponse?.getBody(),h=JSON.parse(d||'{"error": "unknown error"}');c(h.status||h.error||h.message||"unknown error")}else c(f.message||f.toString()||"unknown error")},onProgress(f,d){let h=(f/d*100).toFixed(2);i.message(`Uploaded ${h}%`)},async onSuccess(){await be(t,{channel:"app",event:"App TUS done",icon:"\u23EB",user_id:r,tags:{"app-id":n},notify:!1}).catch(),u(!0)}}).start()})}async function s2(t,e,r){let n={app_id:e,name:r};try{let i=await t.functions.invoke("private/delete_failed_version",{body:JSON.stringify(n),method:"DELETE"});if(i.error){if(i.error instanceof Vi.FunctionsHttpError){let a=await i.error.context.json();p.error(`Cannot delete failed version: ${a.status||JSON.stringify(a)}`)}else p.error(`Cannot delete failed version: ${i.error.message}`);return}return i.data?.status}catch(o){if(o instanceof Vi.FunctionsHttpError){let i=await o.context.json();p.error(`Cannot delete failed version: ${i.message||JSON.stringify(i)}`)}else p.error(`Cannot delete failed version: ${U(o)}`)}}async function Sl(t,e){if(!e.app_id||!e.name||!e.created_by)return p.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 be(t,e,r){try{r&&p.info(`Get remove config: for ${e.event}`);let n=await El();r&&p.info(`Sending LogSnag event: ${JSON.stringify(e)}`);let o=new AbortController,i=setTimeout(()=>o.abort(),1e4);try{let a=await fetch(`${n.hostApi}/private/events`,{method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json",capgkey:t},signal:o.signal});if(clearTimeout(i),!a.ok)throw new Error(`HTTP error! status: ${a.status}`);let s=await a.json();s.error&&p.error(`Failed to send LogSnag event: ${s.error}`)}finally{clearTimeout(i)}}catch(n){r&&(p.error("Failed to send Stats event details:"),p.error(U(n)))}}async function Yi(t,e){let{error:r,data:n}=await t.rpc("get_orgs_v6");if(r)throw p.error("Cannot get the list of organizations - exiting"),p.error(`Error ${JSON.stringify(r)}`),new Error("Cannot get the list of organizations");let o=n.filter(u=>!!e.find(c=>c===u.role));if(n.length===0)throw p.error("Could not get organization please create an organization first"),new Error("No organizations available");if(o.length===0)throw p.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 i=o.length>1?await Dr({message:"Please pick the organization that you want to insert to",options:o.map(u=>({value:u.gid,label:u.name}))}):o[0].gid;if(De(i))throw p.error("Canceled organization selection, exiting"),new Error("Organization selection cancelled");let a=i,s=n.find(u=>u.gid===a);return p.info(`Using the organization "${s.name}" as the app owner`),s}async function oe(t,e,r=["all"]){await N5(t,e,r);let{data:n,error:o}=await t.rpc("get_user_id",{apikey:e}).single(),i=(n||"").toString();if(!i||o)throw p.error("Cannot auth user with apikey"),new Error("Cannot authenticate user with provided API key");return i}async function ar(t,e){let{data:r,error:n}=await t.from("apps").select("owner_org").eq("app_id",e).single();if(!r||n)throw p.error(`Cannot get organization id for app id ${e}`),U(n),new Error(`Cannot get organization id for app id ${e}`);return r.owner_org}function Ji(t){return new Date(t||"").toLocaleString()}var H1=!1,Hi="npm",ys="install",tg="npx";function Qe(){if(H1)return{pm:Hi,command:ys,installCommand:`${Hi} ${ys}`,runner:tg};let t=vt((0,cr.cwd)());return Hi=da(t,"npm"),ys=Xs(Hi),H1=!0,tg=BD(t),{pm:Hi,command:ys,installCommand:`${Hi} ${ys}`,runner:tg}}function u2(t){return(0,Ye.readdirSync)(t,{withFileTypes:!0}).flatMap(n=>{let o=(0,Ke.join)(t,n.name);return n.isDirectory()?u2(o):o.split(`node_modules${Ke.sep}`)[1]||o})}async function cg(t,e){let r=e?e.split(","):[],n;try{n=await ft("",t)}catch(l){throw p.error("Invalid package.json, JSON parsing failed"),console.error("json parse error: ",l),l instanceof Error?l:new Error("Invalid package.json")}let o=t?.split(",")[0],i=o?Ke.default.resolve(o).replace(bt,""):vt((0,cr.cwd)());if(!n)throw p.error("Missing dependencies section in package.json"),new Error("Missing dependencies section in package.json");for(let[l,f]of Object.entries(n))if(typeof f!="string")throw p.error(`Invalid dependency ${l}: ${f}, expected string, got ${typeof f}`),new Error(`Invalid dependency ${l}: expected string version`);let a=r.length===0?[(0,Ke.join)((0,cr.cwd)(),"node_modules")]:r;if(!a.some(l=>(0,Ye.existsSync)(l))){let l=da(i,"npm"),f=Xs(l);throw p.error(`Missing node_modules folder at ${a.join(", ")}, please run ${l} ${f}`),new Error("Missing node_modules folder")}let u=!1,c=await Promise.all(Array.from(n.entries()).map(async([l,f])=>{let d=!1,h=!1;for(let m of a){let b=(0,Ke.join)(m,l);if((0,Ye.existsSync)(b)){d=!0;try{if(u2(b).some(C=>j5.test(C))){h=!0;break}}catch(D){throw p.error(`Error reading node_modules files for ${l} package in ${m}`),console.error(D),D instanceof Error?D:new Error(`Error reading node_modules files for ${l}`)}}}if(!d){u=!0;let m=da(i,"npm"),b=Xs(m);return p.error(`Missing dependency ${l}, please run ${m} ${b}`),{name:l,version:f}}return{name:l,version:f,native:h}})).catch(()=>[]);if(u||c.find(l=>l.native===void 0))throw p.error("Missing dependencies or invalid dependencies"),p.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 H5(t,e,r){let{data:n,error:o}=await t.from("channels").select("version(checksum)").eq("name",r).eq("app_id",e).single(),i=n;return o||i===null||!i.version||!i.version.checksum?null:i.version.checksum}function V5(t){if(!t)throw p.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 p.error(`Invalid remote native package data: ${r}, expected object, got ${typeof r}`),new Error("Invalid remote native package data");let{name:n,version:o}=r;if(!n||typeof n!="string")throw p.error(`Invalid remote native package name: ${n}, expected string, got ${typeof n}`),new Error("Invalid remote native package name");if(!o||typeof o!="string")throw p.error(`Invalid remote native package version: ${o}, expected string, got ${typeof o}`),new Error("Invalid remote native package version")}return new Map(t.map(r=>[r.name,r]))}async function c2(t,e,r){let{data:n,error:o}=await t.from("channels").select(`version (
163
+ `)}function ie(t=!1){let e=zt.env.CAPGO_TOKEN?.trim();if(e)return t||f.info("Use CAPGO_TOKEN environment variable"),e;let r=(0,El.homedir)(),n,o=`${r}/.capgo`;if((0,ke.existsSync)(o)&&(t||f.info(`Use global API key ${o}`),n=(0,ke.readFileSync)(o,"utf8").trim()),o=".capgo",!n&&(0,ke.existsSync)(o)&&(t||f.info(`Use local API key ${o}`),n=(0,ke.readFileSync)(o,"utf8").trim()),!n){let i=`Cannot find API key in local folder or global, please login first with ${Qe().runner} @capacitor/cli login`;throw f.error(i),new Error(i)}return n}async function*cg(t){let e=await(0,ke.readdirSync)(t,{withFileTypes:!0});for(let r of e){let n=(0,Fe.resolve)(t,r.name);r.isDirectory()&&!r.name.startsWith(".")&&!r.name.startsWith("node_modules")&&!r.name.startsWith("dist")?yield*cg(n):yield n}}function Xi(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 Fl(){let t=(0,zt.cwd)(),e=!1,r=(0,Fe.resolve)(t,"tsconfig.json");(0,ke.existsSync)(r)&&(e=!0);for await(let n of cg(t)){if(n.includes("angular.json"))return f.info("Found angular project"),e?"angular-ts":"angular-js";if(n.includes("nuxt.config.js")||n.includes("nuxt.config.ts"))return f.info("Found nuxtjs project"),e?"nuxtjs-ts":"nuxtjs-js";if(n.includes("next.config.js")||n.includes("next.config.mjs"))return f.info("Found nextjs project"),e?"nextjs-ts":"nextjs-js";if(n.includes("svelte.config.js"))return f.info("Found sveltekit project"),e?"sveltekit-ts":"sveltekit-js";if(n.includes("rolluconfig.js"))return f.info("Found svelte project"),e?"svelte-ts":"svelte-js";if(n.includes("vue.config.js"))return f.info("Found vue project"),e?"vue-ts":"vue-js";if(n.includes(Rr)){let o=(0,Fe.dirname)(n),i=await Gt(o);if(i){if(i.get("react"))return f.info("Found react project test"),e?"react-ts":"react-js";if(i.get("vue"))return f.info("Found vue project"),e?"vue-ts":"vue-js"}}}return"unknown"}function oS(t,e){return t==="angular-js"||t==="angular-ts"?e?"src/main.ts":"src/main.js":t==="nextjs-js"||t==="nextjs-ts"?e?"src/app/layout.tsx":"src/app/layout.js":t==="svelte-js"||t==="svelte-ts"||t==="vue-js"||t==="vue-ts"?e?"src/main.ts":"src/main.js":t==="react-js"||t==="react-ts"?e?"src/index.tsx":"src/index.js":null}async function lg(t){if(t==="angular")return f.info("Angular project detected"),"build";if(t==="nuxtjs")return f.info("Nuxtjs project detected"),"generate";if(t==="nextjs"){if(f.info("Nextjs project detected"),f.warn("Please make sure you have configured static export in your next.config.js: https://nextjs.org/docs/pages/building-your-application/deploying/static-exports"),f.warn("Please make sure you have the output: 'export' and distDir: 'dist' in your next.config.js"),!await ye({message:"Do you want to continue?"})){let r="Build command selection aborted by user";throw f.error(r),new Error(r)}return"build"}if(t==="sveltekit"){if(f.info("Sveltekit project detected"),f.warn("Please make sure you have the adapter-static installed: https://kit.svelte.dev/docs/adapter-static"),f.warn("Please make sure you have the pages: 'dist' and assets: 'dest', in your svelte.config.js adapter"),!await ye({message:"Do you want to continue?"})){let r="Build command selection aborted by user";throw f.error(r),new Error(r)}return"build"}return"build"}async function iS(){let t=/(main|index)\.(ts|tsx|js|jsx)$/,e="",r=(0,zt.cwd)(),n=r.split("/").length;for await(let o of cg(r))if(o.split("/").length-n<=2&&t.test(o)){e=o,f.info(`Found main file here ${o}`);break}return e}async function fg(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 aS(t,e,r){let n={app_id:e,name:r,version:0};try{let i=await t.functions.invoke("files/upload_link",{body:JSON.stringify(n)});if(i.error){if(i.error instanceof Wi.FunctionsHttpError){let a=await i.error.context.json();f.error(`Upload URL error: ${a.status||JSON.stringify(a)}`)}else f.error(`Cannot get upload url: ${i.error.message}`);return""}return i.data.url}catch(o){f.error(`Cannot get upload url ${L(o)}`)}return""}async function*sS(t){let e=(0,ke.readdirSync)(t,{withFileTypes:!0});for(let r of e){let n=(0,Fe.join)(t,r.name);r.isDirectory()?yield*sS(n):yield n}}async function uS(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 sS(t)){if(r.some(s=>n.includes(s))){f.info(`Ignoring file ${n}, please ensure you have only required files in your dist folder`);continue}let o=(0,ke.readFileSync)(n);if(o.length===0){f.info(`Ignoring empty file ${n}, please ensure you have only required files in your dist folder`);continue}let i=await Xr(o,"sha256"),a=(0,Fe.relative)(t,n);a.startsWith("/")&&(a=a.substring(1)),e.push({file:a,hash:i})}return e}async function Al(t){return(0,El.platform)()==="win32"?G5(t):z5(t)}function z5(t){let e=new ig.default;return e.addLocalFolder(t),e.toBuffer()}async function G5(t){f.info("Zipping file windows mode");let e=new ig.default,r=(n,o)=>{let i=(0,ke.readdirSync)(n);for(let a of i){let s=(0,Fe.join)(n,a),u=(0,ke.statSync)(s);if(u.isFile()){let c=(0,ke.readFileSync)(s);e.addFile((0,Fe.join)(o,a).split(Fe.sep).join("/"),c)}else u.isDirectory()&&r(s,(0,Fe.join)(o,a))}};return r(t,""),e.toBuffer()}async function cS(t,e,r,n,o,i,a,s){return new Promise((u,c)=>{be(t,{channel:"app",event:"App TUS upload",icon:"\u23EB",user_id:r,tags:{"app-id":n},notify:!1}),new _l.Upload(e,{endpoint:`${a.hostFilesApi}/files/upload/attachments/`,chunkSize:s,metadataForPartialUploads:{filename:`orgs/${r}/apps/${n}/${o}.zip`,filetype:"application/gzip"},metadata:{filename:`orgs/${r}/apps/${n}/${o}.zip`,filetype:"application/zip"},headers:{Authorization:t},onError(p){if(f.error(`Error uploading bundle: ${p.message}`),p instanceof _l.DetailedError){let d=p.originalResponse?.getBody(),h=JSON.parse(d||'{"error": "unknown error"}');c(h.status||h.error||h.message||"unknown error")}else c(p.message||p.toString()||"unknown error")},onProgress(p,d){let h=(p/d*100).toFixed(2);i.message(`Uploaded ${h}%`)},async onSuccess(){await be(t,{channel:"app",event:"App TUS done",icon:"\u23EB",user_id:r,tags:{"app-id":n},notify:!1}).catch(),u(!0)}}).start()})}async function lS(t,e,r){let n={app_id:e,name:r};try{let i=await t.functions.invoke("private/delete_failed_version",{body:JSON.stringify(n),method:"DELETE"});if(i.error){if(i.error instanceof Wi.FunctionsHttpError){let a=await i.error.context.json();f.error(`Cannot delete failed version: ${a.status||JSON.stringify(a)}`)}else f.error(`Cannot delete failed version: ${i.error.message}`);return}return i.data?.status}catch(o){if(o instanceof Wi.FunctionsHttpError){let i=await o.context.json();f.error(`Cannot delete failed version: ${i.message||JSON.stringify(i)}`)}else f.error(`Cannot delete failed version: ${L(o)}`)}}async function Ol(t,e){if(!e.app_id||!e.name||!e.created_by)return f.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 be(t,e,r){try{r&&f.info(`Get remove config: for ${e.event}`);let n=await Sl();r&&f.info(`Sending LogSnag event: ${JSON.stringify(e)}`);let o=new AbortController,i=setTimeout(()=>o.abort(),1e4);try{let a=await fetch(`${n.hostApi}/private/events`,{method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json",capgkey:t},signal:o.signal});if(clearTimeout(i),!a.ok)throw new Error(`HTTP error! status: ${a.status}`);let s=await a.json();s.error&&f.error(`Failed to send LogSnag event: ${s.error}`)}finally{clearTimeout(i)}}catch(n){r&&(f.error("Failed to send Stats event details:"),f.error(L(n)))}}async function Zi(t,e){let{error:r,data:n}=await t.rpc("get_orgs_v6");if(r)throw f.error("Cannot get the list of organizations - exiting"),f.error(`Error ${JSON.stringify(r)}`),new Error("Cannot get the list of organizations");let o=n.filter(u=>!!e.find(c=>c===u.role));if(n.length===0)throw f.error("Could not get organization please create an organization first"),new Error("No organizations available");if(o.length===0)throw f.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 i=o.length>1?await gr({message:"Please pick the organization that you want to insert to",options:o.map(u=>({value:u.gid,label:u.name}))}):o[0].gid;if(De(i))throw f.error("Canceled organization selection, exiting"),new Error("Organization selection cancelled");let a=i,s=n.find(u=>u.gid===a);return f.info(`Using the organization "${s.name}" as the app owner`),s}async function oe(t,e,r=["all"]){await q5(t,e,r);let{data:n,error:o}=await t.rpc("get_user_id",{apikey:e}).single(),i=(n||"").toString();if(!i||o)throw f.error("Cannot auth user with apikey"),new Error("Cannot authenticate user with provided API key");return i}async function ar(t,e){let{data:r,error:n}=await t.from("apps").select("owner_org").eq("app_id",e).single();if(!r||n)throw f.error(`Cannot get organization id for app id ${e}`),L(n),new Error(`Cannot get organization id for app id ${e}`);return r.owner_org}function Qi(t){return new Date(t||"").toLocaleString()}var G1=!1,Gi="npm",vs="install",og="npx";function Qe(){if(G1)return{pm:Gi,command:vs,installCommand:`${Gi} ${vs}`,runner:og};let t=yt((0,zt.cwd)());return Gi=ga(t,"npm"),vs=eu(Gi),G1=!0,og=LD(t),{pm:Gi,command:vs,installCommand:`${Gi} ${vs}`,runner:og}}function fS(t){return(0,ke.readdirSync)(t,{withFileTypes:!0}).flatMap(n=>{let o=(0,Fe.join)(t,n.name);return n.isDirectory()?fS(o):o.split(`node_modules${Fe.sep}`)[1]||o})}async function pg(t,e){let r=e?e.split(","):[],n;try{n=await Gt("",t)}catch(l){throw f.error("Invalid package.json, JSON parsing failed"),console.error("json parse error: ",l),l instanceof Error?l:new Error("Invalid package.json")}let o=t?.split(",")[0],i=o?Fe.default.resolve(o).replace(Rr,""):yt((0,zt.cwd)());if(!n)throw f.error("Missing dependencies section in package.json"),new Error("Missing dependencies section in package.json");for(let[l,p]of Object.entries(n))if(typeof p!="string")throw f.error(`Invalid dependency ${l}: ${p}, expected string, got ${typeof p}`),new Error(`Invalid dependency ${l}: expected string version`);let a=r.length===0?[(0,Fe.join)((0,zt.cwd)(),"node_modules")]:r;if(!a.some(l=>(0,ke.existsSync)(l))){let l=ga(i,"npm"),p=eu(l);throw f.error(`Missing node_modules folder at ${a.join(", ")}, please run ${l} ${p}`),new Error("Missing node_modules folder")}let u=!1,c=await Promise.all(Array.from(n.entries()).map(async([l,p])=>{let d=!1,h=!1;for(let m of a){let b=(0,Fe.join)(m,l);if((0,ke.existsSync)(b)){d=!0;try{if(fS(b).some(C=>M5.test(C))){h=!0;break}}catch(D){throw f.error(`Error reading node_modules files for ${l} package in ${m}`),console.error(D),D instanceof Error?D:new Error(`Error reading node_modules files for ${l}`)}}}if(!d){u=!0;let m=ga(i,"npm"),b=eu(m);return f.error(`Missing dependency ${l}, please run ${m} ${b}`),{name:l,version:p}}return{name:l,version:p,native:h}})).catch(()=>[]);if(u||c.find(l=>l.native===void 0))throw f.error("Missing dependencies or invalid dependencies"),f.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 W5(t,e,r){let{data:n,error:o}=await t.from("channels").select("version(checksum)").eq("name",r).eq("app_id",e).single(),i=n;return o||i===null||!i.version||!i.version.checksum?null:i.version.checksum}function K5(t){if(!t)throw f.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 f.error(`Invalid remote native package data: ${r}, expected object, got ${typeof r}`),new Error("Invalid remote native package data");let{name:n,version:o}=r;if(!n||typeof n!="string")throw f.error(`Invalid remote native package name: ${n}, expected string, got ${typeof n}`),new Error("Invalid remote native package name");if(!o||typeof o!="string")throw f.error(`Invalid remote native package version: ${o}, expected string, got ${typeof o}`),new Error("Invalid remote native package version")}return new Map(t.map(r=>[r.name,r]))}async function pS(t,e,r){let{data:n,error:o}=await t.from("channels").select(`version (
164
164
  native_packages
165
- )`).eq("name",r).eq("app_id",e).single();if(o)throw p.error(`Error fetching native packages: ${o.message}`),new Error(`Error fetching native packages: ${o.message}`);return V5(n.version.native_packages??[])}async function l2(t,e,r,n){let o=we();o.start(`Checking bundle checksum compatibility with channel ${r}`);let i=await H5(t,e,r);if(!i){o.stop(`No checksum found for channel ${r}, the bundle will be uploaded`);return}if(i&&i===n)throw p.error(`Cannot upload the same bundle content.
165
+ )`).eq("name",r).eq("app_id",e).single();if(o)throw f.error(`Error fetching native packages: ${o.message}`),new Error(`Error fetching native packages: ${o.message}`);return K5(n.version.native_packages??[])}async function dS(t,e,r,n){let o=ve();o.start(`Checking bundle checksum compatibility with channel ${r}`);let i=await W5(t,e,r);if(!i){o.stop(`No checksum found for channel ${r}, the bundle will be uploaded`);return}if(i&&i===n)throw f.error(`Cannot upload the same bundle content.
166
166
  Current bundle checksum matches remote bundle for channel ${r}
167
167
  Did you build your app before uploading?
168
- PS: You can ignore this check with "--ignore-checksum-check"`),new Error("Cannot upload the same bundle content");o.stop(`Checksum compatible with ${r} channel`)}function he(t,e){return t||e?.plugins?.CapacitorUpdater?.appId||e?.appId}function So(t){if(!t.localVersion)return!0;if(!t.remoteVersion)return!1;try{let e=ru(t.localVersion),r=ru(t.remoteVersion);return KD(e,r)}catch{return!1}}async function Fl(t,e,r,n,o){let i=await cg(n,o),a=await c2(t,e,r),s=i.filter(c=>!!c.native).map(c=>{let l=a.get(c.name);return l?{name:c.name,localVersion:c.version,remoteVersion:l.version}:{name:c.name,localVersion:c.version,remoteVersion:void 0}}),u=[...a].filter(([c])=>i.find(l=>l.name===c)===void 0).map(([c,l])=>({name:c,localVersion:void 0,remoteVersion:l.version}));return s.push(...u),{finalCompatibility:s,localDependencies:i}}async function lg(t,e,r,n){let o=await c2(t,e,r),i=n.map(s=>{let u=o.get(s.name);return u?{name:s.name,localVersion:s.version,remoteVersion:u.version}:{name:s.name,localVersion:s.version,remoteVersion:void 0}}),a=[...o].filter(([s])=>n.find(u=>u.name===s)===void 0).map(([s,u])=>({name:s,localVersion:void 0,remoteVersion:u.version}));return i.push(...a),{finalCompatibility:i,localDependencies:n}}async function Al(t,e,r){let n=await ye({message:"Would you like to sync your project with Capacitor now? This is recommended to ensure encrypted updates work properly."});if(De(n))throw t&&e&&r&&await or("onboarding-v2",e,r,"canceled","\u{1F937}"),p.error("Canceled Capacitor sync"),new Error("Capacitor sync cancelled");if(n){let o=Qe(),i=we();i.start("Running the command...");try{await new Promise((a,s)=>{let u=(0,V1.spawn)(o.runner,["cap","sync"],{stdio:"pipe"});u.on("close",c=>{c===0?a():s(new Error(`Command failed with exit code ${c}`))}),u.on("error",c=>{s(c)})}),i.stop("Capacitor sync completed \u2705")}catch(a){i.stop("Error"),p.error(`Failed to run Capacitor sync: ${a}`),p.warn(`Please run "${o.runner} cap sync" manually to ensure encrypted updates work properly`)}}else{let o=Qe();p.warn("\u26A0\uFE0F Important: If you upload encrypted bundles without syncing, updates will fail!"),p.info(`Remember to run "${o.runner} cap sync" before uploading encrypted bundles`)}}async function f2(t,e){let{data:r}=await t.rpc("exist_app_v2",{appid:e}).single();return!!r}async function Ne(t,e,r,n,o=!1){let i=Qe(),a=await X1(t,e,r);if(!a.okay)switch(a.error){case"INVALID_APIKEY":{let c="Invalid apikey, such apikey does not exists!";throw o||p.error(c),new Error(c)}case"NO_APP":{let c=`App ${r} does not exist, run first \`${i.runner} @capgo/cli app add ${r}\` to create it`;throw o||p.error(c),new Error(c)}case"NO_ORG":{let c="Could not find organization, please contact support to resolve this!";throw o||p.error(c),new Error(c)}}let s=a.data;if(n>s){let c=`Insuficcent permissions for app ${r}. Current permission: ${wt[a.data]}, required for this action: ${wt[n]}.`;throw o||p.error(c),new Error(c)}return a.data}var lr="assets/icon.png";var z5=/^[a-z0-9]+(\.[\w-]+)+$/i;function G5(t,e,r){if(!e.apikey)throw r||p.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||p.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(t.includes("--"))throw r||p.error('The app id includes illegal symbols. You cannot use "--" in the app id'),new Error("App id includes illegal symbols");if(!z5.test(t))throw r||(p.error(`Invalid app ID format: "${t}"`),p.info("App ID must be in reverse domain notation (e.g., com.example.app)"),p.info("Valid format: lowercase letters, numbers, dots, hyphens, and underscores"),p.info("Examples: com.mycompany.myapp, io.capgo.app, com.example.my-app")),new Error("Invalid app ID format")}async function W5(t,e,r){if(await f2(t,e))throw e==="io.ionic.starter"?(r||p.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||p.error(`App ${e} already exist`),new Error(`App ${e} already exists`))}async function fg(t,e,r,n=!1){n||Z("Adding"),await de(),e.apikey=e.apikey||ie();let o=await te(),i=he(t,o?.config);G5(i,e,n);let a=await ne(e.apikey,e.supaHost,e.supaAnon),s=await oe(a,e.apikey,["write","all"]);await W5(a,i,n),r||(r=await Yi(a,["admin","super_admin"]));let u=r.gid,{name:c,icon:l}=e;if(c=c||o.config?.appName||"Unknown",l=l||"resources/icon.png",!l||!c)throw n||p.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||p.info(`Adding ${i} to Capgo`);let f=null,d=null;l&&(0,Xi.existsSync)(l)?(f=(0,Xi.readFileSync)(l),d=Ki(l)||"image/png",n||p.warn(`Found app icon ${l}`)):(0,Xi.existsSync)(lr)?(f=(0,Xi.readFileSync)(lr),d=Ki(lr)||"image/png",n||p.warn(`Found app icon ${lr}`)):n||p.warn(`Cannot find app icon in any of the following locations: ${l}, ${lr}`);let h="icon",m="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(f&&d){let{error:D}=await a.storage.from(`images/org/${u}/${i}`).upload(h,f,{contentType:d});if(D)throw n||console.error(D),n||p.error(`Could not add app ${U(D)}`),new Error(`Could not add app ${U(D)}`);let{data:C}=await a.storage.from(`images/org/${u}/${i}`).getPublicUrl(h);m=C?.publicUrl||m}let{error:b}=await a.from("apps").insert({icon_url:m,owner_org:u,user_id:s,name:c,app_id:i});if(b)throw n||p.error(`Could not add app ${U(b)}`),new Error(`Could not add app ${U(b)}`);return n||(p.success(`App ${i} added to Capgo. You can upload a bundle now`),J("Done \u2705")),{appId:i,organizationUid:u,userId:s,name:c,signedURL:m}}async function p2(t,e){await fg(t,e,void 0)}async function K5(t,e,r=!1,n=!1){r||Z("Deleting"),e.apikey=e.apikey||ie();let o=await te(),i=he(t,o?.config);if(!e.apikey)throw r||p.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!i)throw r||p.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let a=await ne(e.apikey,e.supaHost,e.supaAnon),s=await oe(a,e.apikey,["write","all"]);await Ne(a,e.apikey,i,5,r);let{data:u,error:c}=await a.from("apps").select("owner_org ( created_by, id )").eq("app_id",i).single(),l=u;if(!n&&!c&&(l?.owner_org.created_by??"")!==s){if(r)throw new Error("Cannot delete app: you are not the organization owner");{p.warn("Deleting the app is not recommended for users that are not the organization owner"),p.warn("You are invited as a super_admin but your are not the owner"),p.warn("It's strongly recommended that you do not continue!");let b=await Dr({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(De(b)||b==="no")throw p.error("Canceled deleting the app, exiting"),new Error("App deletion cancelled")}}else c&&!r&&p.warn(`Cannot get the app owner ${U(c)}`);let{error:f}=await a.storage.from("images").remove([`org/${l?.owner_org.id}/${i}/icon`]);f&&!r&&p.error("Could not delete app logo");let{error:d}=await a.storage.from(`apps/${i}/${s}`).remove(["versions"]);d&&!r&&p.error("Could not delete app version");let{error:h}=await a.from("apps").delete().eq("app_id",i);if(h)throw r||p.error("Could not delete app"),new Error(`Could not delete app: ${U(h)}`);let m=await ar(a,i);return await be(e.apikey,{channel:"app",event:"App Deleted",icon:"\u{1F5D1}\uFE0F",user_id:m,tags:{"app-id":i},notify:!1}).catch(()=>{}),r||(p.success("App deleted in Capgo"),J("Done \u2705")),!0}async function d2(t,e){return K5(t,e,!1,!1)}var Ol=require("node:os"),m2=require("node:process");async function h2(t){let e={},r=Object.keys(t);return(await Promise.all(r.map(o=>Bc(o)))).forEach((o,i)=>{o&&(e[r[i]]=o)}),e}async function Y5(){let t=await ft(),e={"@capgo/cli":mr.version};for(let[r,n]of t)(r.startsWith("@capgo/")||r.startsWith("@capawesome/")||r.startsWith("capacitor"))&&(e[r]=n);return e}async function J5(t,e=!1){e||p.warn(" \u{1F48A} Capgo Doctor \u{1F48A}");let r=await te(),n=xr("",t.packageJson),o=r?.config?.plugins?.CapacitorUpdater?.version||n,i=r?.config?.appName||"",a=he("",r?.config),s=r?.config?.webDir||"";e||(p.info(` App Name: ${i}`),p.info(` App ID: ${a}`),p.info(` App Version: ${o}`),p.info(` Web Dir: ${s}`),p.info(` OS: ${(0,Ol.platform)()} ${(0,Ol.version)()}`),p.info(` Node: ${m2.version}`),p.info(" Installed Dependencies:"));let u=await Y5();if(Object.keys(u).length===0)throw e||p.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))p.info(` ${l}: ${u[l]}`);let c={};if(e)c=await h2(u);else{let l=we();l.start("Running: Loading latest dependencies"),c=await h2(u),l.stop("Latest Dependencies:");for(let f of Object.keys(c))p.info(` ${f}: ${c[f]}`)}if(JSON.stringify(u)!==JSON.stringify(c))throw e||p.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||p.success("\x1B[32m\u2705 All dependencies are up to date\x1B[0m"),{appName:i,appId:a,appVersion:o,webDir:s,installedDependencies:u,latestDependencies:c}}async function g2(t){return J5(t)}function X5(t){let e=new ot;e.headers=["Name","id","Created"],e.rows=[];for(let r of t.toReversed())e.rows.push([r.name??"",r.app_id,Ji(r.created_at)]);p.success("Apps"),p.success(e.toString())}async function Z5(t,e){let{data:r,error:n}=await t.from("apps").select().order("created_at",{ascending:!1});if(n)throw e||p.error("Apps not found"),new Error("Apps not found");return r??[]}async function Q5(t,e=!1){e||Z("List apps in Capgo"),await de(),t.apikey=t.apikey||ie();let r=await ne(t.apikey,t.supaHost,t.supaAnon);await oe(r,t.apikey,["write","all","read","upload"]),e||p.info("Getting active bundle in Capgo");let n=await Z5(r,e);if(!n.length)throw e||p.error("No apps found"),new Error("No apps found");return e||(p.info(`Active app in Capgo: ${n.length}`),X5(n),J("Done \u2705")),n}async function D2(t){return Q5(t,!1)}var y2=require("node:crypto"),Zi=require("node:fs");async function eU(t,e,r=!1){r||Z("Set app"),e.apikey=e.apikey||ie();let n=await te();if(t=he(t,n?.config),!e.apikey)throw r||p.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||p.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let o=await ne(e.apikey,e.supaHost,e.supaAnon),a=(await Yi(o,["admin","super_admin"])).gid,s=await oe(o,e.apikey,["write","all"]);await Ne(o,e.apikey,t,4,r);let{name:u,icon:c,retention:l}=e;if(l&&Number.isNaN(Number(l)))throw r||p.error("retention value must be a number"),new Error("Retention value must be a number");if(l&&l<0)throw r||p.error("retention value cannot be less than 0"),new Error("Retention value cannot be less than 0");if(l&&l>=63113904)throw r||p.error("retention value cannot be greater than 63113904 seconds (2 years)"),new Error("Retention value cannot be greater than 63113904 seconds (2 years)");let f,d,h=`icon_${(0,y2.randomUUID)()}`,m="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(c&&(0,Zi.existsSync)(c)?(f=(0,Zi.readFileSync)(c),d=Ki(c)||"image/png",r||p.warn(`Found app icon ${c}`)):(0,Zi.existsSync)(lr)?(f=(0,Zi.readFileSync)(lr),d=Ki(lr)||"image/png",r||p.warn(`Found app icon ${lr}`)):r||p.warn(`Cannot find app icon in any of the following locations: ${c}, ${lr}`),f&&d){let{error:D}=await o.storage.from(`images/org/${a}/${t}`).upload(h,f,{contentType:d});if(D)throw r||p.error(`Could not set app ${U(D)}`),new Error(`Could not set app: ${U(D)}`);let{data:C}=await o.storage.from(`images/org/${a}/${t}`).getPublicUrl(h);m=C?.publicUrl||m}let{error:b}=await o.from("apps").update({icon_url:m,name:u,retention:l?l*24*60*60:void 0}).eq("app_id",t).eq("user_id",s);if(b)throw r||p.error(`Could not set app ${U(b)}`),new Error(`Could not set app: ${U(b)}`);return r||J("Done \u2705"),!0}async function b2(t,e){return eU(t,e)}async function tU(t,e,r=!1){if(r||Z("Set a specific setting in capacitor config"),e.bool&&e.string)throw r||p.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||p.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||p.error("Invalid bool"),new Error("Invalid bool value; expected true or false");try{let n=await te(),o=n.config,i=t.split(".");if(i.length===0)throw r||p.error("Invalid path"),new Error("Invalid config path");for(let s of i.slice(0,-1))Object.prototype.hasOwnProperty.call(o,s)||(o[s]={}),o=o[s];let a=e.bool?e.bool==="true":e.string;o[i.at(-1)]=a,await Ui(n,!0),r||p.success(`Set "${t}" to "${a}"`)}catch(n){throw r||p.error(`Cannot set config in capacitor settings ${U(n)}`),new Error(`Cannot set capacitor config: ${U(n)}`)}r||J("Done \u2705")}async function v2(t,e){return tU(t,e)}async function w2(t,e,r,n={}){let{silent:o=!1,autoUnlink:i=!1}=n,{data:a,error:s}=await t.from("channels").select().eq("app_id",e).eq("version",r.id);if(s)throw o||p.error(`Cannot check Version ${e}@${r.name}: ${U(s)}`),new Error(`Cannot check version ${e}@${r.name}: ${U(s)}`);if(!a?.length)return;if(o)throw new Error(`Version ${e}@${r.name} is used in ${a.length} channel(s)`);Z(`\u274C Version ${e}@${r.name} is used in ${a.length} channel${a.length>1?"s":""}`);let u=i;if(i||(u=await ye({message:"unlink it?"})===!0),!u)throw p.error("Unlink it first"),new Error(`Version ${e}@${r.name} is still linked to channel(s)`);for(let c of a){let l=we();l.start(`Unlinking channel ${c.name}`);let f=await pg(t,e,{silent:o});if(!f)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:f.id}).eq("id",c.id);if(d)throw l.stop(`Cannot update channel ${c.name} ${U(d)}`),new Error(`Cannot update channel ${c.name}: ${U(d)}`);l.stop(`\u2705 Channel ${c.name} unlinked`)}J(`Version unlinked from ${a.length} channel${a.length>1?"s":""}`)}async function pg(t,e,r={}){let{silent:n=!1}=r,o=[3e3,7e3],i;for(let a=0;a<=2;a++){let{data:s,error:u}=await t.from("app_versions").select("id").eq("app_id",e).eq("name","unknown").single();if(!u)return s;i=u,a<2&&await new Promise(c=>setTimeout(c,o[a]))}throw n||p.error(`Cannot call findUnknownVersion as it returned an error.
169
- ${U(i)}`),new Error(`Cannot retrieve unknown version for app ${e}: ${U(i)}`)}function C2(t,e){return t.from("channels").insert(e).select().single()}function E2(t,e,r,n){return t.from("channels").delete().eq("name",e).eq("app_id",r).single()}function _2(t,e,r){return t.from("channels").select().eq("app_id",e).eq("name",r).single()}function x2(t,e,r){return t.from("channel_devices").delete().eq("app_id",e).eq("channel_id",r)}function S2(t,e,r){return t.from("channels").select(`
168
+ PS: You can ignore this check with "--ignore-checksum-check"`),new Error("Cannot upload the same bundle content");o.stop(`Checksum compatible with ${r} channel`)}function he(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=iu(t.localVersion),r=iu(t.remoteVersion);return XD(e,r)}catch{return!1}}async function kl(t,e,r,n,o){let i=await pg(n,o),a=await pS(t,e,r),s=i.filter(c=>!!c.native).map(c=>{let l=a.get(c.name);return l?{name:c.name,localVersion:c.version,remoteVersion:l.version}:{name:c.name,localVersion:c.version,remoteVersion:void 0}}),u=[...a].filter(([c])=>i.find(l=>l.name===c)===void 0).map(([c,l])=>({name:c,localVersion:void 0,remoteVersion:l.version}));return s.push(...u),{finalCompatibility:s,localDependencies:i}}async function dg(t,e,r,n){let o=await pS(t,e,r),i=n.map(s=>{let u=o.get(s.name);return u?{name:s.name,localVersion:s.version,remoteVersion:u.version}:{name:s.name,localVersion:s.version,remoteVersion:void 0}}),a=[...o].filter(([s])=>n.find(u=>u.name===s)===void 0).map(([s,u])=>({name:s,localVersion:void 0,remoteVersion:u.version}));return i.push(...a),{finalCompatibility:i,localDependencies:n}}async function $l(t,e,r){let n=await ye({message:"Would you like to sync your project with Capacitor now? This is recommended to ensure encrypted updates work properly."});if(De(n))throw t&&e&&r&&await or("onboarding-v2",e,r,"canceled","\u{1F937}"),f.error("Canceled Capacitor sync"),new Error("Capacitor sync cancelled");if(n){let o=Qe(),i=ve();i.start("Running the command...");try{await new Promise((a,s)=>{let u=(0,W1.spawn)(o.runner,["cap","sync"],{stdio:"pipe"});u.on("close",c=>{c===0?a():s(new Error(`Command failed with exit code ${c}`))}),u.on("error",c=>{s(c)})}),i.stop("Capacitor sync completed \u2705")}catch(a){i.stop("Error"),f.error(`Failed to run Capacitor sync: ${a}`),f.warn(`Please run "${o.runner} cap sync" manually to ensure encrypted updates work properly`)}}else{let o=Qe();f.warn("\u26A0\uFE0F Important: If you upload encrypted bundles without syncing, updates will fail!"),f.info(`Remember to run "${o.runner} cap sync" before uploading encrypted bundles`)}}async function hS(t,e){let{data:r}=await t.rpc("exist_app_v2",{appid:e}).single();return!!r}async function Ue(t,e,r,n,o=!1){let i=Qe(),a=await eS(t,e,r);if(!a.okay)switch(a.error){case"INVALID_APIKEY":{let c="Invalid apikey, such apikey does not exists!";throw o||f.error(c),new Error(c)}case"NO_APP":{let c=`App ${r} does not exist, run first \`${i.runner} @capgo/cli app add ${r}\` to create it`;throw o||f.error(c),new Error(c)}case"NO_ORG":{let c="Could not find organization, please contact support to resolve this!";throw o||f.error(c),new Error(c)}}let s=a.data;if(n>s){let c=`Insuficcent permissions for app ${r}. Current permission: ${bt[a.data]}, required for this action: ${bt[n]}.`;throw o||f.error(c),new Error(c)}return a.data}var cr="assets/icon.png";var Y5=/^[a-z0-9]+(\.[\w-]+)+$/i;function J5(t,e,r){if(!e.apikey)throw r||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(t.includes("--"))throw r||f.error('The app id includes illegal symbols. You cannot use "--" in the app id'),new Error("App id includes illegal symbols");if(!Y5.test(t))throw r||(f.error(`Invalid app ID format: "${t}"`),f.info("App ID must be in reverse domain notation (e.g., com.example.app)"),f.info("Valid format: lowercase letters, numbers, dots, hyphens, and underscores"),f.info("Examples: com.mycompany.myapp, io.capgo.app, com.example.my-app")),new Error("Invalid app ID format")}async function X5(t,e,r){if(await hS(t,e))throw e==="io.ionic.starter"?(r||f.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||f.error(`App ${e} already exist`),new Error(`App ${e} already exists`))}async function hg(t,e,r,n=!1){n||Z("Adding"),await de(),e.apikey=e.apikey||ie();let o=await te(),i=he(t,o?.config);J5(i,e,n);let a=await re(e.apikey,e.supaHost,e.supaAnon),s=await oe(a,e.apikey,["write","all"]);await X5(a,i,n),r||(r=await Zi(a,["admin","super_admin"]));let u=r.gid,{name:c,icon:l}=e;if(c=c||o.config?.appName||"Unknown",l=l||"resources/icon.png",!l||!c)throw n||f.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||f.info(`Adding ${i} to Capgo`);let p=null,d=null;l&&(0,ea.existsSync)(l)?(p=(0,ea.readFileSync)(l),d=Xi(l)||"image/png",n||f.warn(`Found app icon ${l}`)):(0,ea.existsSync)(cr)?(p=(0,ea.readFileSync)(cr),d=Xi(cr)||"image/png",n||f.warn(`Found app icon ${cr}`)):n||f.warn(`Cannot find app icon in any of the following locations: ${l}, ${cr}`);let h="icon",m="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(p&&d){let{error:D}=await a.storage.from(`images/org/${u}/${i}`).upload(h,p,{contentType:d});if(D)throw n||console.error(D),n||f.error(`Could not add app ${L(D)}`),new Error(`Could not add app ${L(D)}`);let{data:C}=await a.storage.from(`images/org/${u}/${i}`).getPublicUrl(h);m=C?.publicUrl||m}let{error:b}=await a.from("apps").insert({icon_url:m,owner_org:u,user_id:s,name:c,app_id:i});if(b)throw n||f.error(`Could not add app ${L(b)}`),new Error(`Could not add app ${L(b)}`);return n||(f.success(`App ${i} added to Capgo. You can upload a bundle now`),J("Done \u2705")),{appId:i,organizationUid:u,userId:s,name:c,signedURL:m}}async function mS(t,e){await hg(t,e,void 0)}async function Z5(t,e,r=!1,n=!1){r||Z("Deleting"),e.apikey=e.apikey||ie();let o=await te(),i=he(t,o?.config);if(!e.apikey)throw r||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!i)throw r||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let a=await re(e.apikey,e.supaHost,e.supaAnon),s=await oe(a,e.apikey,["write","all"]);await Ue(a,e.apikey,i,5,r);let{data:u,error:c}=await a.from("apps").select("owner_org ( created_by, id )").eq("app_id",i).single(),l=u;if(!n&&!c&&(l?.owner_org.created_by??"")!==s){if(r)throw new Error("Cannot delete app: you are not the organization owner");{f.warn("Deleting the app is not recommended for users that are not the organization owner"),f.warn("You are invited as a super_admin but your are not the owner"),f.warn("It's strongly recommended that you do not continue!");let b=await gr({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(De(b)||b==="no")throw f.error("Canceled deleting the app, exiting"),new Error("App deletion cancelled")}}else c&&!r&&f.warn(`Cannot get the app owner ${L(c)}`);let{error:p}=await a.storage.from("images").remove([`org/${l?.owner_org.id}/${i}/icon`]);p&&!r&&f.error("Could not delete app logo");let{error:d}=await a.storage.from(`apps/${i}/${s}`).remove(["versions"]);d&&!r&&f.error("Could not delete app version");let{error:h}=await a.from("apps").delete().eq("app_id",i);if(h)throw r||f.error("Could not delete app"),new Error(`Could not delete app: ${L(h)}`);let m=await ar(a,i);return await be(e.apikey,{channel:"app",event:"App Deleted",icon:"\u{1F5D1}\uFE0F",user_id:m,tags:{"app-id":i},notify:!1}).catch(()=>{}),r||(f.success("App deleted in Capgo"),J("Done \u2705")),!0}async function gS(t,e){return Z5(t,e,!1,!1)}var Pl=require("node:os"),yS=require("node:process");async function DS(t){let e={},r=Object.keys(t);return(await Promise.all(r.map(o=>Lc(o)))).forEach((o,i)=>{o&&(e[r[i]]=o)}),e}async function Q5(){let t=await Gt(),e={"@capgo/cli":hr.version};for(let[r,n]of t)(r.startsWith("@capgo/")||r.startsWith("@capawesome/")||r.startsWith("capacitor"))&&(e[r]=n);return e}async function eU(t,e=!1){e||f.warn(" \u{1F48A} Capgo Doctor \u{1F48A}");let r=await te(),n=_r("",t.packageJson),o=r?.config?.plugins?.CapacitorUpdater?.version||n,i=r?.config?.appName||"",a=he("",r?.config),s=r?.config?.webDir||"";e||(f.info(` App Name: ${i}`),f.info(` App ID: ${a}`),f.info(` App Version: ${o}`),f.info(` Web Dir: ${s}`),f.info(` OS: ${(0,Pl.platform)()} ${(0,Pl.version)()}`),f.info(` Node: ${yS.version}`),f.info(" Installed Dependencies:"));let u=await Q5();if(Object.keys(u).length===0)throw e||f.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))f.info(` ${l}: ${u[l]}`);let c={};if(e)c=await DS(u);else{let l=ve();l.start("Running: Loading latest dependencies"),c=await DS(u),l.stop("Latest Dependencies:");for(let p of Object.keys(c))f.info(` ${p}: ${c[p]}`)}if(JSON.stringify(u)!==JSON.stringify(c))throw e||f.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||f.success("\x1B[32m\u2705 All dependencies are up to date\x1B[0m"),{appName:i,appId:a,appVersion:o,webDir:s,installedDependencies:u,latestDependencies:c}}async function bS(t){return eU(t)}function tU(t){let e=new it;e.headers=["Name","id","Created"],e.rows=[];for(let r of t.toReversed())e.rows.push([r.name??"",r.app_id,Qi(r.created_at)]);f.success("Apps"),f.success(e.toString())}async function rU(t,e){let{data:r,error:n}=await t.from("apps").select().order("created_at",{ascending:!1});if(n)throw e||f.error("Apps not found"),new Error("Apps not found");return r??[]}async function nU(t,e=!1){e||Z("List apps in Capgo"),await de(),t.apikey=t.apikey||ie();let r=await re(t.apikey,t.supaHost,t.supaAnon);await oe(r,t.apikey,["write","all","read","upload"]),e||f.info("Getting active bundle in Capgo");let n=await rU(r,e);if(!n.length)throw e||f.error("No apps found"),new Error("No apps found");return e||(f.info(`Active app in Capgo: ${n.length}`),tU(n),J("Done \u2705")),n}async function wS(t){return nU(t,!1)}var vS=require("node:crypto"),ta=require("node:fs");async function oU(t,e,r=!1){r||Z("Set app"),e.apikey=e.apikey||ie();let n=await te();if(t=he(t,n?.config),!e.apikey)throw r||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let o=await re(e.apikey,e.supaHost,e.supaAnon),a=(await Zi(o,["admin","super_admin"])).gid,s=await oe(o,e.apikey,["write","all"]);await Ue(o,e.apikey,t,4,r);let{name:u,icon:c,retention:l}=e;if(l&&Number.isNaN(Number(l)))throw r||f.error("retention value must be a number"),new Error("Retention value must be a number");if(l&&l<0)throw r||f.error("retention value cannot be less than 0"),new Error("Retention value cannot be less than 0");if(l&&l>=63113904)throw r||f.error("retention value cannot be greater than 63113904 seconds (2 years)"),new Error("Retention value cannot be greater than 63113904 seconds (2 years)");let p,d,h=`icon_${(0,vS.randomUUID)()}`,m="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(c&&(0,ta.existsSync)(c)?(p=(0,ta.readFileSync)(c),d=Xi(c)||"image/png",r||f.warn(`Found app icon ${c}`)):(0,ta.existsSync)(cr)?(p=(0,ta.readFileSync)(cr),d=Xi(cr)||"image/png",r||f.warn(`Found app icon ${cr}`)):r||f.warn(`Cannot find app icon in any of the following locations: ${c}, ${cr}`),p&&d){let{error:D}=await o.storage.from(`images/org/${a}/${t}`).upload(h,p,{contentType:d});if(D)throw r||f.error(`Could not set app ${L(D)}`),new Error(`Could not set app: ${L(D)}`);let{data:C}=await o.storage.from(`images/org/${a}/${t}`).getPublicUrl(h);m=C?.publicUrl||m}let{error:b}=await o.from("apps").update({icon_url:m,name:u,retention:l?l*24*60*60:void 0}).eq("app_id",t).eq("user_id",s);if(b)throw r||f.error(`Could not set app ${L(b)}`),new Error(`Could not set app: ${L(b)}`);return r||J("Done \u2705"),!0}async function CS(t,e){return oU(t,e)}async function iU(t,e,r=!1){if(r||Z("Set a specific setting in capacitor config"),e.bool&&e.string)throw r||f.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||f.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||f.error("Invalid bool"),new Error("Invalid bool value; expected true or false");try{let n=await te(),o=n.config,i=t.split(".");if(i.length===0)throw r||f.error("Invalid path"),new Error("Invalid config path");for(let s of i.slice(0,-1))Object.prototype.hasOwnProperty.call(o,s)||(o[s]={}),o=o[s];let a=e.bool?e.bool==="true":e.string;o[i.at(-1)]=a,await Hi(n,!0),r||f.success(`Set "${t}" to "${a}"`)}catch(n){throw r||f.error(`Cannot set config in capacitor settings ${L(n)}`),new Error(`Cannot set capacitor config: ${L(n)}`)}r||J("Done \u2705")}async function ES(t,e){return iU(t,e)}var _S=require("node:child_process"),In=require("node:fs/promises"),xS=require("node:os"),Ao=require("node:path"),mg=me(require("node:process"));async function aU(t,e,r,n,o){if(!o)try{let i=await fetch(`${t}/build/logs/${e}?app_id=${encodeURIComponent(r)}`,{headers:{authorization:n}});if(!i.ok){f.warn("Could not stream logs, continuing...");return}let a=i.body?.getReader();if(!a)return;let s=new TextDecoder;for(;;){let{done:u,value:c}=await a.read();if(u)break;let p=s.decode(c,{stream:!0}).split(`
169
+ `);for(let d of p)if(d.startsWith("data: ")){let h=d.slice(6);h.trim()&&f.error(h)}}}catch(i){o||f.warn(`Log streaming interrupted${i instanceof Error?`: ${i.message}`:""}`)}}async function sU(t,e,r,n,o,i){let s=0;for(;s<120;)try{let u=await fetch(`${t}/build/status?job_id=${encodeURIComponent(e)}&app_id=${encodeURIComponent(r)}&platform=${n}`,{headers:{authorization:o}});if(!u.ok){i||f.warn(`Status check failed: ${u.status}`),await new Promise(l=>setTimeout(l,5e3)),s++;continue}let c=await u.json();if(c.status==="succeeded"||c.status==="failed")return c.status;await new Promise(l=>setTimeout(l,5e3)),s++}catch(u){i||f.warn(`Status check error: ${u}`),await new Promise(c=>setTimeout(c,5e3)),s++}return i||f.warn("Build status polling timed out"),"timeout"}async function uU(t,e){return new Promise((r,n)=>{let i=(0,_S.spawn)("zip",["-rq",e,"."],{cwd:t,stdio:"inherit"});i.on("error",a=>{a.code==="ENOENT"?n(new Error("zip command not found. Please install zip utility.")):n(a)}),i.on("close",a=>{a===0?r():n(new Error(`zip process exited with code ${a}`))})})}async function cU(t,e,r=!1){try{e.apikey=e.apikey||ie(r);let n=await te();if(t=t||n?.config.appId,!t)throw new Error("Missing argument, you need to provide a appId, or be in a capacitor project");let o=(0,Ao.resolve)(e.path||mg.default.cwd()),i=await re(e.apikey,e.supaHost,e.supaAnon);await oe(i,e.apikey,["write","all"]),r||(f.info(`Requesting native build for ${t}`),f.info(`Platform: ${e.lane}`),f.info(`Project: ${o}`));let a={app_id:t,platform:e.lane};e.credentials&&(a.credentials=e.credentials),r||f.info("Requesting build from Capgo...");let s=e.supaHost||"https://api.capgo.app",u=await fetch(`${s}/build/request`,{method:"POST",headers:{"Content-Type":"application/json",authorization:e.apikey},body:JSON.stringify(a)});if(!u.ok){let d=await u.text();throw new Error(`Failed to request build: ${u.status} - ${d}`)}let c=await u.json();r||(f.success(`Build job created: ${c.job_id}`),f.info(`Status: ${c.status}`));let l=(0,Ao.join)((0,xS.tmpdir)(),`capgo-build-${Date.now()}`);await(0,In.mkdir)(l,{recursive:!0});let p=(0,Ao.join)(l,`${(0,Ao.basename)(o)}.zip`);try{r||f.info(`Zipping project from ${o}...`),await uU(o,p);let d=await(0,In.stat)(p),h=(d.size/1024/1024).toFixed(2);r||f.success(`Created zip: ${p} (${h} MB)`),r||f.info("Uploading to builder...");let m=await(0,In.readFile)(p),b=await fetch(c.upload_url,{method:"PUT",headers:{"Content-Type":"application/zip","Content-Length":String(d.size)},body:m});if(!b.ok){let g=await b.text();throw new Error(`Upload failed: ${b.status} - ${g}`)}r||f.success("Upload complete!"),r||f.info("Starting build job...");let D=await fetch(`${s}/build/start/${c.job_id}`,{method:"POST",headers:{"Content-Type":"application/json",authorization:e.apikey},body:JSON.stringify({app_id:t})});if(!D.ok){let g=await D.text();throw new Error(`Failed to start build: ${D.status} - ${g}`)}let C=await D.json();r||(f.success("Build started successfully!"),f.info(`Job ID: ${c.job_id}`),f.info(`Streaming build logs...
170
+ `)),await aU(s,c.job_id,t,e.apikey,r);let E=await sU(s,c.job_id,t,e.lane,e.apikey,r);return r||(E==="succeeded"?f.success("Build completed successfully!"):E==="failed"?f.error("Build failed"):f.warn(`Build finished with status: ${E}`)),{success:E==="succeeded",jobId:c.job_id,uploadUrl:c.upload_url,status:E||C.status||c.status}}finally{await(0,In.rm)(l,{recursive:!0,force:!0})}}catch(n){let o=n instanceof Error?n.message:String(n);return r||f.error(o),{success:!1,error:o}}}async function SS(t,e){(await cU(t,e,!1)).success||mg.default.exit(1)}async function FS(t,e,r,n={}){let{silent:o=!1,autoUnlink:i=!1}=n,{data:a,error:s}=await t.from("channels").select().eq("app_id",e).eq("version",r.id);if(s)throw o||f.error(`Cannot check Version ${e}@${r.name}: ${L(s)}`),new Error(`Cannot check version ${e}@${r.name}: ${L(s)}`);if(!a?.length)return;if(o)throw new Error(`Version ${e}@${r.name} is used in ${a.length} channel(s)`);Z(`\u274C Version ${e}@${r.name} is used in ${a.length} channel${a.length>1?"s":""}`);let u=i;if(i||(u=await ye({message:"unlink it?"})===!0),!u)throw f.error("Unlink it first"),new Error(`Version ${e}@${r.name} is still linked to channel(s)`);for(let c of a){let l=ve();l.start(`Unlinking channel ${c.name}`);let p=await gg(t,e,{silent:o});if(!p)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:p.id}).eq("id",c.id);if(d)throw l.stop(`Cannot update channel ${c.name} ${L(d)}`),new Error(`Cannot update channel ${c.name}: ${L(d)}`);l.stop(`\u2705 Channel ${c.name} unlinked`)}J(`Version unlinked from ${a.length} channel${a.length>1?"s":""}`)}async function gg(t,e,r={}){let{silent:n=!1}=r,o=[3e3,7e3],i;for(let a=0;a<=2;a++){let{data:s,error:u}=await t.from("app_versions").select("id").eq("app_id",e).eq("name","unknown").single();if(!u)return s;i=u,a<2&&await new Promise(c=>setTimeout(c,o[a]))}throw n||f.error(`Cannot call findUnknownVersion as it returned an error.
171
+ ${L(i)}`),new Error(`Cannot retrieve unknown version for app ${e}: ${L(i)}`)}function AS(t,e){return t.from("channels").insert(e).select().single()}function OS(t,e,r,n){return t.from("channels").delete().eq("name",e).eq("app_id",r).single()}function kS(t,e,r){return t.from("channels").select().eq("app_id",e).eq("name",r).single()}function $S(t,e,r){return t.from("channel_devices").delete().eq("app_id",e).eq("channel_id",r)}function PS(t,e,r){return t.from("channels").select(`
170
172
  id,
171
173
  version (id, name)
172
- `).eq("app_id",e).eq("name",r).single().throwOnError().then(({data:n})=>n?.version)}function F2(t,e=!1){if(e)return;let r=new ot;r.theme=ot.roundTheme,r.headers=["Name","Version","Public","iOS","Android","Auto Update","Native Auto Update","Device Self Set","Progressive Deploy","Secondary Version","Secondary Version Percentage","AB Testing","AB Testing Version","AB Testing Percentage","Emulator","Dev"],r.rows=[];for(let n of t.toReversed())r.rows.push([n.name,n.version?.name,n.public?"\u2705":"\u274C",n.ios?"\u2705":"\u274C",n.android?"\u2705":"\u274C",n.disable_auto_update,n.disable_auto_update_under_native?"\u274C":"\u2705",n.allow_device_self_set?"\u2705":"\u274C",n.allow_emulator?"\u2705":"\u274C",n.allow_dev?"\u2705":"\u274C"]);p.success("Channels"),p.success(r.toString())}async function A2(t,e,r=!1){let{data:n,error:o}=await t.from("channels").select(`
174
+ `).eq("app_id",e).eq("name",r).single().throwOnError().then(({data:n})=>n?.version)}function TS(t,e=!1){if(e)return;let r=new it;r.theme=it.roundTheme,r.headers=["Name","Version","Public","iOS","Android","Auto Update","Native Auto Update","Device Self Set","Progressive Deploy","Secondary Version","Secondary Version Percentage","AB Testing","AB Testing Version","AB Testing Percentage","Emulator","Dev"],r.rows=[];for(let n of t.toReversed())r.rows.push([n.name,n.version?.name,n.public?"\u2705":"\u274C",n.ios?"\u2705":"\u274C",n.android?"\u2705":"\u274C",n.disable_auto_update,n.disable_auto_update_under_native?"\u274C":"\u2705",n.allow_device_self_set?"\u2705":"\u274C",n.allow_emulator?"\u2705":"\u274C",n.allow_dev?"\u2705":"\u274C"]);f.success("Channels"),f.success(r.toString())}async function IS(t,e,r=!1){let{data:n,error:o}=await t.from("channels").select(`
173
175
  id,
174
176
  name,
175
177
  public,
@@ -184,29 +186,28 @@ ${U(i)}`),new Error(`Cannot retrieve unknown version for app ${e}: ${U(i)}`)}fun
184
186
  created_by,
185
187
  app_id,
186
188
  version (id, name)
187
- `).eq("app_id",e).order("created_at",{ascending:!1});if(o)throw r||p.error(`App ${e} not found in database`),new Error(`App ${e} not found in database: ${U(o)}`);return n}async function dg(t,e,r,n={}){let{silent:o=!1}=n,{error:i}=await t.from("app_versions").update({deleted:!0}).eq("app_id",e).eq("deleted",!1).eq("name",r);if(i){let a=`App version ${e}@${r} not found in database`;throw o||p.error(a),new Error(`${a}: ${U(i)}`)}}async function kl(t,e,r,n={}){let{silent:o=!1,autoUnlink:i=!1}=n,a=await rU(t,e,r,{silent:o});await w2(t,e,a,{silent:o,autoUnlink:i}),await dg(t,e,r,{silent:o})}function $l(t,e=!1){if(e)return;if(!t.length)throw new Error("No bundle found");let r=new ot;r.theme=ot.roundTheme,r.headers=["Version","Created","Keep"],r.rows=[];for(let n of t.toReversed())r.rows.push([n.name,Ji(n.created_at),n.keep??""]);p.success("Bundles"),p.success(r.toString())}async function Pl(t,e,r={}){let{silent:n=!1}=r,{data:o,error:i}=await t.from("app_versions").select().eq("app_id",e).eq("deleted",!1).order("created_at",{ascending:!1});if(i){let a=`App ${e} not found in database`;throw n||p.error(a),new Error(`${a}: ${U(i)}`)}return o??[]}async function O2(t,e,r={}){let{silent:n=!1}=r,{data:o,error:i}=await t.from("channels").select("version").eq("app_id",e);if(i){let a=`App ${e} not found in database`;throw n||p.error(a),new Error(`${a}: ${U(i)}`)}return(o??[]).map(a=>a.version)}async function rU(t,e,r,n={}){let{silent:o=!1}=n,{data:i,error:a}=await t.from("app_versions").select().eq("app_id",e).eq("name",r).eq("deleted",!1).single();if(!i||a){let s=`App version ${e}@${r} doesn't exist`;throw o||p.error(s),new Error(`${s}${a?`: ${U(a)}`:""}`)}return i}async function nU(t,e,r,n){for await(let o of t)n||p.warn(`Removing ${o.name} created on ${Ji(o.created_at)}`),await kl(e,r,o.name)}function oU(t,e,r){let n=[];for(let o of t??[]){let i=_e(o.name);Vf(i,e)&&qn(i,r)&&n.push(o)}return n}async function iU(t,e,r=!1){r||Z("Cleanup versions in Capgo"),await de(),e.apikey=e.apikey||ie();let{bundle:n,keep:o=4}=e,i=e.force||!1,a=e.ignoreChannel||!1,s=await te();if(t=he(t,s?.config),!e.apikey)throw r||p.error("Missing API key, you need to provide an API key to delete your app"),new Error("Missing API key");if(!t)throw r||p.error("Missing argument, you need to provide a appid, or be in a capacitor project"),new Error("Missing appId");let u=await ne(e.apikey,e.supaHost,e.supaAnon);await oe(u,e.apikey,["write","all"]),await Ne(u,e.apikey,t,3,r),r||p.info("Querying all available versions in Capgo");let c=await Pl(u,t),l=await O2(u,t);if(r||p.info(`Total active versions in Capgo: ${c?.length??0}`),!c?.length)throw r||p.error("No versions found, aborting cleanup"),new Error("No versions found");if(n){let h=_e(n),m=ga(h,"major");r||p.info(`Querying available versions in Capgo between ${br(h)} and ${br(m)}`),c=oU(c,h,m),r||p.info(`Active versions in Capgo between ${br(h)} and ${br(m)}: ${c?.length??0}`)}let f=[],d=0;for(let h of c){let m=l.find(b=>b===h.id);d<o||m&&!a?(h.keep=m?"\u2705 (Linked to channel)":"\u2705",d+=1):(h.keep="\u274C",f.push(h))}if(!f.length)return r||p.warn("Nothing to be removed, aborting removal..."),{removed:0,kept:d};if(r||$l(c),!i){if(r)throw new Error("Cleanup requires force=true in SDK mode to prevent accidental deletions");{let h=await ye({message:"Do you want to continue removing the versions specified?"});if(De(h)||!h)throw p.warn("Not confirmed, aborting removal..."),new Error("Cleanup cancelled by user")}}return r||p.success("You have confirmed removal, removing versions now"),await nU(f,u,t,r),r||J("Done \u2705"),{removed:f.length,kept:d}}async function k2(t,e){return iU(t,e)}async function aU(t,e,r=!1){r||Z("Check compatibility");let n={...e,apikey:e.apikey||ie()},o=await te(),i=he(t,o?.config),a=n.channel;if(!a)throw r||p.error("Missing argument, you need to provide a channel"),new Error("Missing channel");if(!n.apikey)throw r||p.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!i)throw r||p.error("Missing argument, you need to provide an appId, or be in a capacitor project"),new Error("Missing appId");let s=await ne(n.apikey,n.supaHost,n.supaAnon);await oe(s,n.apikey,["write","all","read","upload"]),await Ne(s,n.apikey,i,1,r);let u=await Fl(s,i,a,n.packageJson,n.nodeModules);if(!r){let c=new ot;c.headers=["Package","Local version","Remote version","Compatible"],c.theme=ot.roundTheme,c.rows=[];let l=n.text?"Yes":"\u2705",f=n.text?"No":"\u274C";for(let d of u.finalCompatibility){let{name:h,localVersion:m,remoteVersion:b}=d,D=So(d)?l:f;c.rows.push([h,m,b,D])}p.success("Compatibility"),p.success(c.toString())}return{finalCompatibility:u.finalCompatibility}}async function $2(t,e){try{await aU(t,e,!1)}catch(r){throw p.error(`Error checking compatibility ${U(r)}`),r}}var nn=require("node:fs");var Tn=require("node:buffer"),mt=require("node:crypto"),P2="aes-128-cbc",rn="base64",Tl=mt.constants.RSA_PKCS1_PADDING;function Il(t){let e=(0,mt.randomBytes)(16),r=(0,mt.randomBytes)(16),n=e.toString(rn),o=(0,mt.privateEncrypt)({key:t,padding:Tl},r).toString(rn);return{sessionKey:r,ivSessionKey:`${n}:${o}`}}function Qi(t,e,r){let[n]=r.split(":"),o=Tn.Buffer.from(n,rn),i=(0,mt.createCipheriv)(P2,e,o);return i.setAutoPadding(!0),Tn.Buffer.concat([i.update(t),i.final()])}function T2(t,e,r){let[n,o]=e.split(":"),i=(0,mt.publicDecrypt)({key:r,padding:Tl},Tn.Buffer.from(o,rn)),a=Tn.Buffer.from(n,rn),s=(0,mt.createDecipheriv)(P2,i,a);return s.setAutoPadding(!0),Tn.Buffer.concat([s.update(t),s.final()])}function ea(t,e){return(0,mt.privateEncrypt)({key:e,padding:Tl},Tn.Buffer.from(t,rn)).toString(rn)}function I2(t="pem",e=2048){let{publicKey:r,privateKey:n}=(0,mt.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 R2(t,e){return(0,mt.publicDecrypt)({key:e,padding:Tl},Tn.Buffer.from(t,rn)).toString(rn)}function sU(t,e){let r=t.key||tn,n=e.config.plugins?.CapacitorUpdater?.publicKey;return(0,nn.existsSync)(r)?n=(0,nn.readFileSync)(r,"utf8"):!n&&t.keyData&&(n=t.keyData),{publicKey:n,fallbackKeyPath:r}}async function uU(t,e,r,n=!1){n||Z("Decrypt zip file");try{if(await de(),!(0,nn.existsSync)(t)){let f=`Zip not found at the path ${t}`;throw n||p.error(f),new Error(f)}let o=await te();if(!r.key&&!(0,nn.existsSync)(tn)&&!o.config.plugins?.CapacitorUpdater?.privateKey){let f=`Private Key not found at the path ${tn} or in ${o.path}`;throw n||p.error(f),new Error(f)}let{publicKey:i,fallbackKeyPath:a}=sU(r,o);if(!i){let f=`Cannot find public key ${a} or as keyData option or in ${o.path}`;throw n||p.error(f),new Error(f)}let s=(0,nn.readFileSync)(t),u=T2(s,e,r.keyData??i),c=`${t}_decrypted.zip`;(0,nn.writeFileSync)(c,u),n||p.info(`Decrypted zip file at ${c}`);let l;if(r.checksum){let f=await Xr(u,"sha256"),d=R2(r.checksum,r.keyData??i);if(l=f===d,!l){let h=`Checksum does not match ${f} !== ${d}`;throw n||p.error(h),new Error(h)}n||p.info("Checksum matches")}return n||J("\u2705 done"),{outputPath:c,checksumMatches:l}}catch(o){throw n||p.error(`Error decrypting zip file ${U(o)}`),o instanceof Error?o:new Error(String(o))}}async function B2(t,e,r){await uU(t,e,r,!1)}async function cU(t,e,r,n=!1){n||Z("Delete bundle"),r.apikey=r.apikey||ie();let o=await te();if(e=he(e,o?.config),!r.apikey)throw n||p.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||p.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||p.error("Missing argument, you need to provide a bundleId, or be in a capacitor project"),new Error("Missing bundleId");let i=await ne(r.apikey,r.supaHost,r.supaAnon);return await oe(i,r.apikey,["write","all"]),await Ne(i,r.apikey,e,3,n),n||(p.info(`Deleting bundle ${e}@${t} from Capgo`),p.info("Keep in mind that you will not be able to reuse this bundle version, it's gone forever")),await kl(i,e,t),n||(p.success(`Bundle ${e}@${t} deleted in Capgo`),J("Done")),!0}async function j2(t,e,r){return cU(t,e,r)}var on=require("node:fs");function vs(t){console.error(U(t))}async function lU(t,e,r,n=!1){let{json:o}=r,i=!o&&!n;i&&(Z("Encryption"),await de());try{let a=await te(),s=!!a.config.plugins?.CapacitorUpdater?.privateKey,u=!!a.config.plugins?.CapacitorUpdater?.publicKey;if(s&&i&&p.warning("There is still a privateKey in the config"),!(0,on.existsSync)(t)){let C=`Zip not found at the path ${t}`;throw n||(o?vs({error:"zip_not_found"}):p.error(`Error: ${C}`)),new Error(C)}if(!u)throw n||(o?vs({error:"missing_public_key"}):p.warning("Warning: Missing Public Key in config")),new Error("Missing public key in config");let c=r.key||Wt,l=r.keyData||"";if(!(0,on.existsSync)(c)&&!l)throw n||(o?vs({error:"missing_key"}):(p.warning(`Cannot find a private key at ${c} or as a keyData option`),p.error("Error: Missing key"))),new Error("Missing private key");if((0,on.existsSync)(c)&&(l=(0,on.readFileSync)(c,"utf8")),l&&!l.startsWith("-----BEGIN RSA PRIVATE KEY-----"))throw n||(o?vs({error:"invalid_private_key"}):p.error("The private key provided is not a valid RSA Private key")),new Error("Invalid private key format");let f=(0,on.readFileSync)(t),{sessionKey:d,ivSessionKey:h}=Il(l),m=Qi(f,d,h),b=ea(e,l),D=`${t}_encrypted.zip`;return(0,on.writeFileSync)(D,m),n||(o?console.log(JSON.stringify({checksum:b,filename:D,ivSessionKey:h},null,2)):(p.success(`Encoded Checksum: ${b}`),p.success(`ivSessionKey: ${h}`),p.success(`Encrypted zip saved at ${D}`),J("Done \u2705"))),{checksum:b,filename:D,ivSessionKey:h}}catch(a){throw n||(r.json?vs(a):p.error(`Error encrypting zip file ${U(a)}`)),a instanceof Error?a:new Error(String(a))}}async function N2(t,e,r){await lU(t,e,r,!1)}async function L2(t,e,r=!1){r||Z("List bundles"),await de(),e.apikey=e.apikey||ie();let n=await te();if(t=he(t,n?.config),!e.apikey)throw r||p.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||p.error("Missing argument, you need to provide a appid, or be in a capacitor project"),new Error("Missing appId");let o=await ne(e.apikey,e.supaHost,e.supaAnon);await oe(o,e.apikey,["write","all","read","upload"]),await Ne(o,e.apikey,t,1,r),r||p.info(`Querying available versions of: ${t} in Capgo`);let i=await Pl(o,t);return r||(p.info(`Active versions in Capgo: ${i?.length??0}`),$l(i),J("Done \u2705")),i}var dF=require("node:crypto"),Io=require("node:fs"),Ng=require("node:path/posix"),Lg=require("node:process");var Rl=class extends TransformStream{outChunkSize;constructor(e){let r=new Uint8Array(e),n=0;super({transform(o,i){let a=0;for(;a<o.length;){let s=e-n,u=Math.min(s,o.length-a);r.set(o.subarray(a,a+u),n),a+=u,n+=u,n===e&&(i.enqueue(r),r=new Uint8Array(e),n=0)}},flush(o){n>0&&o.enqueue(r.subarray(0,n))}}),this.outChunkSize=e}};function In(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 h=i();if(!h)return d;d.attributes[h.name]=h.value}return u(/\?>\s*/),d}function n(){let f=u(/^<([\w-:.]+)\s*/);if(!f)return;let d={name:f[1],attributes:{},children:[]};for(;!(c()||l(">")||l("?>")||l("/>"));){let m=i();if(!m)return d;d.attributes[m.name]=m.value}if(u(/^\s*\/>\s*/))return d;u(/\??>\s*/),d.content=o();let h;for(;h=n();)d.children.push(h);return u(/^<\/[\w-:.]+>\s*/),d}function o(){let f=u(/^([^<]*)/);return f?s(f[1]):""}function i(){let f=u(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(f)return{name:f[1],value:s(a(f[2]))}}function a(f){return f.replace(/^['"]|['"]$/g,"")}function s(f){return f.replaceAll("&lt;","<").replaceAll("&gt;",">").replaceAll("&amp;","&")}function u(f){let d=t.match(f);if(d)return t=t.slice(d[0].length),d}function c(){return t.length===0}function l(f){return t.startsWith(f)}}var Br=class extends Error{};var Ct=class extends Br{},ws=class extends Br{},Bl=class extends Br{bucketName;constructor(e){super(`Invalid bucket name: ${e}`),this.bucketName=e}},jr=class extends Br{objectName;constructor(e){super(`Invalid object name: ${e}`),this.objectName=e}},Rn=class extends Br{constructor(){super("accessKey is required")}},ta=class extends Br{constructor(){super("secretKey is required")}},Cs=class extends Br{constructor(){super("expirySeconds cannot be less than 1 second or more than 7 days")}},an=class extends Br{statusCode;code;key;bucketName;resource;region;constructor(e,r,n,o={}){super(n),this.statusCode=e,this.code=r,this.key=o.key,this.bucketName=o.bucketName,this.resource=o.resource,this.region=o.region}};async function U2(t){try{let r=In(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",o=r.children.find(c=>c.name==="Message")?.content??"The error message could not be determined.",i=r.children.find(c=>c.name==="Key")?.content,a=r.children.find(c=>c.name==="BucketName")?.content,s=r.children.find(c=>c.name==="Resource")?.content,u=r.children.find(c=>c.name==="Region")?.content;return new an(t.status,n,o,{key:i,bucketName:a,resource:s,region:u})}catch{return new an(t.status,"UnrecognizedError",`Error: Unexpected response code ${t.status} ${t.statusText}. Unable to parse response as XML.`)}}function M2(t){return typeof t!="number"||isNaN(t)?!1:t>=1&&t<=65535}function q2(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 Bn(t){return!(!fU(t)||t.length===0)}function fU(t){return!(typeof t!="string"||t.length>1024)}function Es(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}function Fo(t=""){let e={'"':"","&quot;":"","&#34;":"","&QUOT;":"","&#x00022":""};return t.replace(/^("|&quot;|&#34;)|("|&quot;|&#34;)$/g,r=>e[r])}function mg(t){return t.get("x-amz-version-id")??null}function Ao(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 gg(t){return Ao(t).slice(0,8)}function Dg(t,e){return`${gg(e)}/${t}/s3/aws4_request`}async function jl(t){return t instanceof Uint8Array||(t=new TextEncoder().encode(t)),Es(new Uint8Array(await crypto.subtle.digest("SHA-256",t)))}var pU=["x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5"],Nl=class extends WritableStream{getResult;constructor({client:e,bucketName:r,objectName:n,partSize:o,metadata:i}){let a,s=1,u,c=[],l,f=[];super({start(){},async write(d,h){let b=s++;try{if(b==1&&d.length<o){let E=await e.makeRequest({method:"PUT",headers:new Headers({...i,"Content-Length":String(d.length)}),bucketName:r,objectName:n,payload:d});a={etag:Fo(E.headers.get("etag")??void 0),versionId:mg(E.headers)};return}b===1&&(u=(await dU({client:e,bucketName:r,objectName:n,metadata:i})).uploadId);let D={"Content-Length":String(d.length)};for(let E of pU){let g=i[E];g&&(D[E]=g)}let C=e.makeRequest({method:"PUT",query:{partNumber:b.toString(),uploadId:u},headers:new Headers(D),bucketName:r,objectName:n,payload:d}).then(E=>{let g=E.headers.get("etag")??"";return g&&(g=g.replace(/^"/,"").replace(/"$/,"")),c.push({part:b,etag:g}),E});f.push(C.catch(E=>{l||(l=E)}))}catch(D){throw D}},async close(){if(!a)if(u){if(await Promise.all(f),l)throw l;c.sort((d,h)=>d.part>h.part?1:-1),a=await hU({client:e,bucketName:r,objectName:n,uploadId:u,etags:c})}else throw new Error("Stream was closed without uploading any data.")}}),this.getResult=()=>{if(a===void 0)throw new Error("Result is not ready. await the stream first.");return a}}};async function dU(t){let e="POST",r=new Headers(t.metadata),i=await(await t.client.makeRequest({method:e,bucketName:t.bucketName,objectName:t.objectName,query:"uploads",headers:r,returnBody:!0})).text(),a=In(i).root;if(!a||a.name!=="InitiateMultipartUploadResult")throw new Error(`Unexpected response: ${i}`);let s=a.children.find(u=>u.name==="UploadId")?.content;if(!s)throw new Error(`Unable to get UploadId from response: ${i}`);return{uploadId:s}}async function hU({client:t,bucketName:e,objectName:r,uploadId:n,etags:o}){let i=`
189
+ `).eq("app_id",e).order("created_at",{ascending:!1});if(o)throw r||f.error(`App ${e} not found in database`),new Error(`App ${e} not found in database: ${L(o)}`);return n}async function Dg(t,e,r,n={}){let{silent:o=!1}=n,{error:i}=await t.from("app_versions").update({deleted:!0}).eq("app_id",e).eq("deleted",!1).eq("name",r);if(i){let a=`App version ${e}@${r} not found in database`;throw o||f.error(a),new Error(`${a}: ${L(i)}`)}}async function Tl(t,e,r,n={}){let{silent:o=!1,autoUnlink:i=!1}=n,a=await lU(t,e,r,{silent:o});await FS(t,e,a,{silent:o,autoUnlink:i}),await Dg(t,e,r,{silent:o})}function Il(t,e=!1){if(e)return;if(!t.length)throw new Error("No bundle found");let r=new it;r.theme=it.roundTheme,r.headers=["Version","Created","Keep"],r.rows=[];for(let n of t.toReversed())r.rows.push([n.name,Qi(n.created_at),n.keep??""]);f.success("Bundles"),f.success(r.toString())}async function Rl(t,e,r={}){let{silent:n=!1}=r,{data:o,error:i}=await t.from("app_versions").select().eq("app_id",e).eq("deleted",!1).order("created_at",{ascending:!1});if(i){let a=`App ${e} not found in database`;throw n||f.error(a),new Error(`${a}: ${L(i)}`)}return o??[]}async function RS(t,e,r={}){let{silent:n=!1}=r,{data:o,error:i}=await t.from("channels").select("version").eq("app_id",e);if(i){let a=`App ${e} not found in database`;throw n||f.error(a),new Error(`${a}: ${L(i)}`)}return(o??[]).map(a=>a.version)}async function lU(t,e,r,n={}){let{silent:o=!1}=n,{data:i,error:a}=await t.from("app_versions").select().eq("app_id",e).eq("name",r).eq("deleted",!1).single();if(!i||a){let s=`App version ${e}@${r} doesn't exist`;throw o||f.error(s),new Error(`${s}${a?`: ${L(a)}`:""}`)}return i}async function fU(t,e,r,n){for await(let o of t)n||f.warn(`Removing ${o.name} created on ${Qi(o.created_at)}`),await Tl(e,r,o.name)}function pU(t,e,r){let n=[];for(let o of t??[]){let i=_e(o.name);Wf(i,e)&&Hn(i,r)&&n.push(o)}return n}async function dU(t,e,r=!1){r||Z("Cleanup versions in Capgo"),await de(),e.apikey=e.apikey||ie();let{bundle:n,keep:o=4}=e,i=e.force||!1,a=e.ignoreChannel||!1,s=await te();if(t=he(t,s?.config),!e.apikey)throw r||f.error("Missing API key, you need to provide an API key to delete your app"),new Error("Missing API key");if(!t)throw r||f.error("Missing argument, you need to provide a appid, or be in a capacitor project"),new Error("Missing appId");let u=await re(e.apikey,e.supaHost,e.supaAnon);await oe(u,e.apikey,["write","all"]),await Ue(u,e.apikey,t,3,r),r||f.info("Querying all available versions in Capgo");let c=await Rl(u,t),l=await RS(u,t);if(r||f.info(`Total active versions in Capgo: ${c?.length??0}`),!c?.length)throw r||f.error("No versions found, aborting cleanup"),new Error("No versions found");if(n){let h=_e(n),m=ba(h,"major");r||f.info(`Querying available versions in Capgo between ${yr(h)} and ${yr(m)}`),c=pU(c,h,m),r||f.info(`Active versions in Capgo between ${yr(h)} and ${yr(m)}: ${c?.length??0}`)}let p=[],d=0;for(let h of c){let m=l.find(b=>b===h.id);d<o||m&&!a?(h.keep=m?"\u2705 (Linked to channel)":"\u2705",d+=1):(h.keep="\u274C",p.push(h))}if(!p.length)return r||f.warn("Nothing to be removed, aborting removal..."),{removed:0,kept:d};if(r||Il(c),!i){if(r)throw new Error("Cleanup requires force=true in SDK mode to prevent accidental deletions");{let h=await ye({message:"Do you want to continue removing the versions specified?"});if(De(h)||!h)throw f.warn("Not confirmed, aborting removal..."),new Error("Cleanup cancelled by user")}}return r||f.success("You have confirmed removal, removing versions now"),await fU(p,u,t,r),r||J("Done \u2705"),{removed:p.length,kept:d}}async function BS(t,e){return dU(t,e)}async function hU(t,e,r=!1){r||Z("Check compatibility");let n={...e,apikey:e.apikey||ie()},o=await te(),i=he(t,o?.config),a=n.channel;if(!a)throw r||f.error("Missing argument, you need to provide a channel"),new Error("Missing channel");if(!n.apikey)throw r||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!i)throw r||f.error("Missing argument, you need to provide an appId, or be in a capacitor project"),new Error("Missing appId");let s=await re(n.apikey,n.supaHost,n.supaAnon);await oe(s,n.apikey,["write","all","read","upload"]),await Ue(s,n.apikey,i,1,r);let u=await kl(s,i,a,n.packageJson,n.nodeModules);if(!r){let c=new it;c.headers=["Package","Local version","Remote version","Compatible"],c.theme=it.roundTheme,c.rows=[];let l=n.text?"Yes":"\u2705",p=n.text?"No":"\u274C";for(let d of u.finalCompatibility){let{name:h,localVersion:m,remoteVersion:b}=d,D=Fo(d)?l:p;c.rows.push([h,m,b,D])}f.success("Compatibility"),f.success(c.toString())}return{finalCompatibility:u.finalCompatibility}}async function jS(t,e){try{await hU(t,e,!1)}catch(r){throw f.error(`Error checking compatibility ${L(r)}`),r}}var on=require("node:fs");var Rn=require("node:buffer"),ht=require("node:crypto"),NS="aes-128-cbc",nn="base64",Bl=ht.constants.RSA_PKCS1_PADDING;function jl(t){let e=(0,ht.randomBytes)(16),r=(0,ht.randomBytes)(16),n=e.toString(nn),o=(0,ht.privateEncrypt)({key:t,padding:Bl},r).toString(nn);return{sessionKey:r,ivSessionKey:`${n}:${o}`}}function ra(t,e,r){let[n]=r.split(":"),o=Rn.Buffer.from(n,nn),i=(0,ht.createCipheriv)(NS,e,o);return i.setAutoPadding(!0),Rn.Buffer.concat([i.update(t),i.final()])}function LS(t,e,r){let[n,o]=e.split(":"),i=(0,ht.publicDecrypt)({key:r,padding:Bl},Rn.Buffer.from(o,nn)),a=Rn.Buffer.from(n,nn),s=(0,ht.createDecipheriv)(NS,i,a);return s.setAutoPadding(!0),Rn.Buffer.concat([s.update(t),s.final()])}function na(t,e){return(0,ht.privateEncrypt)({key:e,padding:Bl},Rn.Buffer.from(t,nn)).toString(nn)}function US(t="pem",e=2048){let{publicKey:r,privateKey:n}=(0,ht.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 MS(t,e){return(0,ht.publicDecrypt)({key:e,padding:Bl},Rn.Buffer.from(t,nn)).toString(nn)}function mU(t,e){let r=t.key||tn,n=e.config.plugins?.CapacitorUpdater?.publicKey;return(0,on.existsSync)(r)?n=(0,on.readFileSync)(r,"utf8"):!n&&t.keyData&&(n=t.keyData),{publicKey:n,fallbackKeyPath:r}}async function gU(t,e,r,n=!1){n||Z("Decrypt zip file");try{if(await de(),!(0,on.existsSync)(t)){let p=`Zip not found at the path ${t}`;throw n||f.error(p),new Error(p)}let o=await te();if(!r.key&&!(0,on.existsSync)(tn)&&!o.config.plugins?.CapacitorUpdater?.privateKey){let p=`Private Key not found at the path ${tn} or in ${o.path}`;throw n||f.error(p),new Error(p)}let{publicKey:i,fallbackKeyPath:a}=mU(r,o);if(!i){let p=`Cannot find public key ${a} or as keyData option or in ${o.path}`;throw n||f.error(p),new Error(p)}let s=(0,on.readFileSync)(t),u=LS(s,e,r.keyData??i),c=`${t}_decrypted.zip`;(0,on.writeFileSync)(c,u),n||f.info(`Decrypted zip file at ${c}`);let l;if(r.checksum){let p=await Xr(u,"sha256"),d=MS(r.checksum,r.keyData??i);if(l=p===d,!l){let h=`Checksum does not match ${p} !== ${d}`;throw n||f.error(h),new Error(h)}n||f.info("Checksum matches")}return n||J("\u2705 done"),{outputPath:c,checksumMatches:l}}catch(o){throw n||f.error(`Error decrypting zip file ${L(o)}`),o instanceof Error?o:new Error(String(o))}}async function qS(t,e,r){await gU(t,e,r,!1)}async function DU(t,e,r,n=!1){n||Z("Delete bundle"),r.apikey=r.apikey||ie();let o=await te();if(e=he(e,o?.config),!r.apikey)throw n||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||f.error("Missing argument, you need to provide a bundleId, or be in a capacitor project"),new Error("Missing bundleId");let i=await re(r.apikey,r.supaHost,r.supaAnon);return await oe(i,r.apikey,["write","all"]),await Ue(i,r.apikey,e,3,n),n||(f.info(`Deleting bundle ${e}@${t} from Capgo`),f.info("Keep in mind that you will not be able to reuse this bundle version, it's gone forever")),await Tl(i,e,t),n||(f.success(`Bundle ${e}@${t} deleted in Capgo`),J("Done")),!0}async function HS(t,e,r){return DU(t,e,r)}var an=require("node:fs");function Es(t){console.error(L(t))}async function yU(t,e,r,n=!1){let{json:o}=r,i=!o&&!n;i&&(Z("Encryption"),await de());try{let a=await te(),s=!!a.config.plugins?.CapacitorUpdater?.privateKey,u=!!a.config.plugins?.CapacitorUpdater?.publicKey;if(s&&i&&f.warning("There is still a privateKey in the config"),!(0,an.existsSync)(t)){let C=`Zip not found at the path ${t}`;throw n||(o?Es({error:"zip_not_found"}):f.error(`Error: ${C}`)),new Error(C)}if(!u)throw n||(o?Es({error:"missing_public_key"}):f.warning("Warning: Missing Public Key in config")),new Error("Missing public key in config");let c=r.key||Wt,l=r.keyData||"";if(!(0,an.existsSync)(c)&&!l)throw n||(o?Es({error:"missing_key"}):(f.warning(`Cannot find a private key at ${c} or as a keyData option`),f.error("Error: Missing key"))),new Error("Missing private key");if((0,an.existsSync)(c)&&(l=(0,an.readFileSync)(c,"utf8")),l&&!l.startsWith("-----BEGIN RSA PRIVATE KEY-----"))throw n||(o?Es({error:"invalid_private_key"}):f.error("The private key provided is not a valid RSA Private key")),new Error("Invalid private key format");let p=(0,an.readFileSync)(t),{sessionKey:d,ivSessionKey:h}=jl(l),m=ra(p,d,h),b=na(e,l),D=`${t}_encrypted.zip`;return(0,an.writeFileSync)(D,m),n||(o?console.log(JSON.stringify({checksum:b,filename:D,ivSessionKey:h},null,2)):(f.success(`Encoded Checksum: ${b}`),f.success(`ivSessionKey: ${h}`),f.success(`Encrypted zip saved at ${D}`),J("Done \u2705"))),{checksum:b,filename:D,ivSessionKey:h}}catch(a){throw n||(r.json?Es(a):f.error(`Error encrypting zip file ${L(a)}`)),a instanceof Error?a:new Error(String(a))}}async function VS(t,e,r){await yU(t,e,r,!1)}async function zS(t,e,r=!1){r||Z("List bundles"),await de(),e.apikey=e.apikey||ie();let n=await te();if(t=he(t,n?.config),!e.apikey)throw r||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||f.error("Missing argument, you need to provide a appid, or be in a capacitor project"),new Error("Missing appId");let o=await re(e.apikey,e.supaHost,e.supaAnon);await oe(o,e.apikey,["write","all","read","upload"]),await Ue(o,e.apikey,t,1,r),r||f.info(`Querying available versions of: ${t} in Capgo`);let i=await Rl(o,t);return r||(f.info(`Active versions in Capgo: ${i?.length??0}`),Il(i),J("Done \u2705")),i}var yF=require("node:crypto"),jo=require("node:fs"),qg=require("node:process");var Nl=class extends TransformStream{outChunkSize;constructor(e){let r=new Uint8Array(e),n=0;super({transform(o,i){let a=0;for(;a<o.length;){let s=e-n,u=Math.min(s,o.length-a);r.set(o.subarray(a,a+u),n),a+=u,n+=u,n===e&&(i.enqueue(r),r=new Uint8Array(e),n=0)}},flush(o){n>0&&o.enqueue(r.subarray(0,n))}}),this.outChunkSize=e}};function Bn(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 h=i();if(!h)return d;d.attributes[h.name]=h.value}return u(/\?>\s*/),d}function n(){let p=u(/^<([\w-:.]+)\s*/);if(!p)return;let d={name:p[1],attributes:{},children:[]};for(;!(c()||l(">")||l("?>")||l("/>"));){let m=i();if(!m)return d;d.attributes[m.name]=m.value}if(u(/^\s*\/>\s*/))return d;u(/\??>\s*/),d.content=o();let h;for(;h=n();)d.children.push(h);return u(/^<\/[\w-:.]+>\s*/),d}function o(){let p=u(/^([^<]*)/);return p?s(p[1]):""}function i(){let p=u(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(p)return{name:p[1],value:s(a(p[2]))}}function a(p){return p.replace(/^['"]|['"]$/g,"")}function s(p){return p.replaceAll("&lt;","<").replaceAll("&gt;",">").replaceAll("&amp;","&")}function u(p){let d=t.match(p);if(d)return t=t.slice(d[0].length),d}function c(){return t.length===0}function l(p){return t.startsWith(p)}}var Br=class extends Error{};var wt=class extends Br{},_s=class extends Br{},Ll=class extends Br{bucketName;constructor(e){super(`Invalid bucket name: ${e}`),this.bucketName=e}},jr=class extends Br{objectName;constructor(e){super(`Invalid object name: ${e}`),this.objectName=e}},jn=class extends Br{constructor(){super("accessKey is required")}},oa=class extends Br{constructor(){super("secretKey is required")}},xs=class extends Br{constructor(){super("expirySeconds cannot be less than 1 second or more than 7 days")}},sn=class extends Br{statusCode;code;key;bucketName;resource;region;constructor(e,r,n,o={}){super(n),this.statusCode=e,this.code=r,this.key=o.key,this.bucketName=o.bucketName,this.resource=o.resource,this.region=o.region}};async function GS(t){try{let r=Bn(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",o=r.children.find(c=>c.name==="Message")?.content??"The error message could not be determined.",i=r.children.find(c=>c.name==="Key")?.content,a=r.children.find(c=>c.name==="BucketName")?.content,s=r.children.find(c=>c.name==="Resource")?.content,u=r.children.find(c=>c.name==="Region")?.content;return new sn(t.status,n,o,{key:i,bucketName:a,resource:s,region:u})}catch{return new sn(t.status,"UnrecognizedError",`Error: Unexpected response code ${t.status} ${t.statusText}. Unable to parse response as XML.`)}}function WS(t){return typeof t!="number"||isNaN(t)?!1:t>=1&&t<=65535}function KS(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 Nn(t){return!(!bU(t)||t.length===0)}function bU(t){return!(typeof t!="string"||t.length>1024)}function Ss(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}function Oo(t=""){let e={'"':"","&quot;":"","&#34;":"","&QUOT;":"","&#x00022":""};return t.replace(/^("|&quot;|&#34;)|("|&quot;|&#34;)$/g,r=>e[r])}function bg(t){return t.get("x-amz-version-id")??null}function ko(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 wg(t){return ko(t).slice(0,8)}function vg(t,e){return`${wg(e)}/${t}/s3/aws4_request`}async function Ul(t){return t instanceof Uint8Array||(t=new TextEncoder().encode(t)),Ss(new Uint8Array(await crypto.subtle.digest("SHA-256",t)))}var wU=["x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5"],Ml=class extends WritableStream{getResult;constructor({client:e,bucketName:r,objectName:n,partSize:o,metadata:i}){let a,s=1,u,c=[],l,p=[];super({start(){},async write(d,h){let b=s++;try{if(b==1&&d.length<o){let E=await e.makeRequest({method:"PUT",headers:new Headers({...i,"Content-Length":String(d.length)}),bucketName:r,objectName:n,payload:d});a={etag:Oo(E.headers.get("etag")??void 0),versionId:bg(E.headers)};return}b===1&&(u=(await vU({client:e,bucketName:r,objectName:n,metadata:i})).uploadId);let D={"Content-Length":String(d.length)};for(let E of wU){let g=i[E];g&&(D[E]=g)}let C=e.makeRequest({method:"PUT",query:{partNumber:b.toString(),uploadId:u},headers:new Headers(D),bucketName:r,objectName:n,payload:d}).then(E=>{let g=E.headers.get("etag")??"";return g&&(g=g.replace(/^"/,"").replace(/"$/,"")),c.push({part:b,etag:g}),E});p.push(C.catch(E=>{l||(l=E)}))}catch(D){throw D}},async close(){if(!a)if(u){if(await Promise.all(p),l)throw l;c.sort((d,h)=>d.part>h.part?1:-1),a=await CU({client:e,bucketName:r,objectName:n,uploadId:u,etags:c})}else throw new Error("Stream was closed without uploading any data.")}}),this.getResult=()=>{if(a===void 0)throw new Error("Result is not ready. await the stream first.");return a}}};async function vU(t){let e="POST",r=new Headers(t.metadata),i=await(await t.client.makeRequest({method:e,bucketName:t.bucketName,objectName:t.objectName,query:"uploads",headers:r,returnBody:!0})).text(),a=Bn(i).root;if(!a||a.name!=="InitiateMultipartUploadResult")throw new Error(`Unexpected response: ${i}`);let s=a.children.find(u=>u.name==="UploadId")?.content;if(!s)throw new Error(`Unable to get UploadId from response: ${i}`);return{uploadId:s}}async function CU({client:t,bucketName:e,objectName:r,uploadId:n,etags:o}){let i=`
188
190
  <CompleteMultipartUpload xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
189
- ${o.map(f=>` <Part><PartNumber>${f.part}</PartNumber><ETag>${f.etag}</ETag></Part>`).join(`
191
+ ${o.map(p=>` <Part><PartNumber>${p.part}</PartNumber><ETag>${p.etag}</ETag></Part>`).join(`
190
192
  `)}
191
193
  </CompleteMultipartUpload>
192
- `,a=await t.makeRequest({method:"POST",bucketName:e,objectName:r,query:`uploadId=${encodeURIComponent(n)}`,payload:new TextEncoder().encode(i),returnBody:!0}),s=await a.text(),u=In(s).root;if(!u||u.name!=="CompleteMultipartUploadResult")throw new Error(`Unexpected response: ${s}`);let c=u.children.find(f=>f.name==="ETag")?.content;if(!c)throw new Error(`Unable to get ETag from response: ${s}`);let l=mg(a.headers);return{etag:Fo(c),versionId:l}}var _s="AWS4-HMAC-SHA256";async function H2(t){if(!t.accessKey)throw new Rn;if(!t.secretKey)throw new ta;let e=t.headers.get("x-amz-content-sha256");if(e===null)throw new Error("Internal S3 client error - expected x-amz-content-sha256 header, but it's missing.");let r=z2(t.headers),n=G2(t.method,t.path,t.headers,r,e),o=await W2(n,t.date,t.region),i=await bg(t.date,t.region,t.secretKey),a=vg(t.accessKey,t.region,t.date),s=Es(await ko(i,o)).toLowerCase();return`${_s} Credential=${a}, SignedHeaders=${r.join(";").toLowerCase()}, Signature=${s}`}async function V2(t){if(!t.accessKey)throw new Rn;if(!t.secretKey)throw new ta;if(t.expirySeconds<1||t.expirySeconds>604800)throw new Cs;if(!t.headers.has("Host"))throw new Error("Internal error: host header missing");let e=t.path.split("?")[0],r=t.path.split("?")[1],n=Ao(t.date),o=z2(t.headers),i=vg(t.accessKey,t.region,t.date),a="UNSIGNED-PAYLOAD",s=new URLSearchParams(r);s.set("X-Amz-Algorithm",_s),s.set("X-Amz-Credential",i),s.set("X-Amz-Date",n),s.set("X-Amz-Expires",t.expirySeconds.toString()),s.set("X-Amz-SignedHeaders",o.join(";").toLowerCase()),t.sessionToken&&s.set("X-Amz-Security-Token",t.sessionToken);let u=s.toString().replace("+","%20"),c=e+"?"+u,l=e.split("/").map(D=>encodeURIComponent(D)).join("/"),f=G2(t.method,c,t.headers,o,a),d=await W2(f,t.date,t.region),h=await bg(t.date,t.region,t.secretKey),m=Es(await ko(h,d)).toLowerCase();return`${t.protocol}//${t.headers.get("Host")}${l}?${u}&X-Amz-Signature=${m}`}function z2(t){let e=["authorization","content-length","content-type","user-agent"],r=[];for(let n of t.keys())e.includes(n.toLowerCase())||r.push(n);return r.sort(),r}var Oo={A:65,Z:90,a:97,z:122,0:48,9:57,"/":47},mU="-._~".split("").map(t=>t.charCodeAt(0));function yg(t,e=!1){let r=new TextEncoder().encode(t),n="";for(let o of r)o>=Oo.A&&o<=Oo.Z||o>=Oo.a&&o<=Oo.z||o>=Oo[0]&&o<=Oo[9]||mU.includes(o)||o==Oo["/"]&&e?n+=String.fromCharCode(o):n+="%"+o.toString(16).padStart(2,"0").toUpperCase();return n}function G2(t,e,r,n,o){let i=n.reduce((u,c)=>{let l=`${r.get(c)}`.replace(/ +/g," ");return u.push(`${c.toLowerCase()}:${l}`),u},[]),a=e.split("?")[0],s=e.split("?")[1];return s?s=s.split("&").map(u=>{let[c,l]=u.split("=",2);return yg(decodeURIComponent(c))+"="+yg(decodeURIComponent(l||""))}).sort().join("&"):s="",[t.toUpperCase(),yg(a,!0),s,i.join(`
194
+ `,a=await t.makeRequest({method:"POST",bucketName:e,objectName:r,query:`uploadId=${encodeURIComponent(n)}`,payload:new TextEncoder().encode(i),returnBody:!0}),s=await a.text(),u=Bn(s).root;if(!u||u.name!=="CompleteMultipartUploadResult")throw new Error(`Unexpected response: ${s}`);let c=u.children.find(p=>p.name==="ETag")?.content;if(!c)throw new Error(`Unable to get ETag from response: ${s}`);let l=bg(a.headers);return{etag:Oo(c),versionId:l}}var Fs="AWS4-HMAC-SHA256";async function YS(t){if(!t.accessKey)throw new jn;if(!t.secretKey)throw new oa;let e=t.headers.get("x-amz-content-sha256");if(e===null)throw new Error("Internal S3 client error - expected x-amz-content-sha256 header, but it's missing.");let r=XS(t.headers),n=ZS(t.method,t.path,t.headers,r,e),o=await QS(n,t.date,t.region),i=await Eg(t.date,t.region,t.secretKey),a=_g(t.accessKey,t.region,t.date),s=Ss(await Po(i,o)).toLowerCase();return`${Fs} Credential=${a}, SignedHeaders=${r.join(";").toLowerCase()}, Signature=${s}`}async function JS(t){if(!t.accessKey)throw new jn;if(!t.secretKey)throw new oa;if(t.expirySeconds<1||t.expirySeconds>604800)throw new xs;if(!t.headers.has("Host"))throw new Error("Internal error: host header missing");let e=t.path.split("?")[0],r=t.path.split("?")[1],n=ko(t.date),o=XS(t.headers),i=_g(t.accessKey,t.region,t.date),a="UNSIGNED-PAYLOAD",s=new URLSearchParams(r);s.set("X-Amz-Algorithm",Fs),s.set("X-Amz-Credential",i),s.set("X-Amz-Date",n),s.set("X-Amz-Expires",t.expirySeconds.toString()),s.set("X-Amz-SignedHeaders",o.join(";").toLowerCase()),t.sessionToken&&s.set("X-Amz-Security-Token",t.sessionToken);let u=s.toString().replace("+","%20"),c=e+"?"+u,l=e.split("/").map(D=>encodeURIComponent(D)).join("/"),p=ZS(t.method,c,t.headers,o,a),d=await QS(p,t.date,t.region),h=await Eg(t.date,t.region,t.secretKey),m=Ss(await Po(h,d)).toLowerCase();return`${t.protocol}//${t.headers.get("Host")}${l}?${u}&X-Amz-Signature=${m}`}function XS(t){let e=["authorization","content-length","content-type","user-agent"],r=[];for(let n of t.keys())e.includes(n.toLowerCase())||r.push(n);return r.sort(),r}var $o={A:65,Z:90,a:97,z:122,0:48,9:57,"/":47},EU="-._~".split("").map(t=>t.charCodeAt(0));function Cg(t,e=!1){let r=new TextEncoder().encode(t),n="";for(let o of r)o>=$o.A&&o<=$o.Z||o>=$o.a&&o<=$o.z||o>=$o[0]&&o<=$o[9]||EU.includes(o)||o==$o["/"]&&e?n+=String.fromCharCode(o):n+="%"+o.toString(16).padStart(2,"0").toUpperCase();return n}function ZS(t,e,r,n,o){let i=n.reduce((u,c)=>{let l=`${r.get(c)}`.replace(/ +/g," ");return u.push(`${c.toLowerCase()}:${l}`),u},[]),a=e.split("?")[0],s=e.split("?")[1];return s?s=s.split("&").map(u=>{let[c,l]=u.split("=",2);return Cg(decodeURIComponent(c))+"="+Cg(decodeURIComponent(l||""))}).sort().join("&"):s="",[t.toUpperCase(),Cg(a,!0),s,i.join(`
193
195
  `)+`
194
196
  `,n.join(";").toLowerCase(),o].join(`
195
- `)}async function W2(t,e,r){let n=await jl(t),o=Dg(r,e);return[_s,Ao(e),o,n].join(`
196
- `)}async function bg(t,e,r){let n=gg(t),o=await ko("AWS4"+r,n),i=await ko(o,e),a=await ko(i,"s3");return await ko(a,"aws4_request")}function vg(t,e,r){return`${t}/${Dg(e,r)}`}async function ko(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"]),o=await crypto.subtle.sign("HMAC",n,e instanceof Uint8Array?e:r.encode(e));return new Uint8Array(o)}async function K2(t){if(!t.accessKey)throw new Rn;if(!t.secretKey)throw new ta;if(t.expirySeconds<1||t.expirySeconds>604800)throw new Cs;let e=new Date(t.date);e.setSeconds(e.getSeconds()+t.expirySeconds);let r=vg(t.accessKey,t.region,t.date),n=Ao(t.date),o={"X-Amz-Algorithm":_s,"X-Amz-Credential":r,"X-Amz-Date":n,key:t.objectKey,...t.fields},i=[{bucket:t.bucket},{key:t.objectKey},{"X-Amz-Algorithm":_s},{"X-Amz-Credential":r},{"X-Amz-Date":n}];t.conditions&&i.push(...t.conditions);for(let[h,m]of Object.entries(t.fields||{}))["key","X-Amz-Algorithm","X-Amz-Credential","X-Amz-Date"].includes(h)||i.push({[h]:m});let a={expiration:e.toISOString(),conditions:i},s=new TextEncoder().encode(JSON.stringify(a)),u=btoa(String.fromCharCode(...s));o.policy=u;let c=u,l=await bg(t.date,t.region,t.secretKey),f=Es(await ko(l,c)).toLowerCase();return o["X-Amz-Signature"]=f,{url:`${t.protocol}//${t.host}/${t.bucket}`,fields:o}}var gU=["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"],DU=5*1024*1024,yU=5*1024*1024*1024,wg=5*1024*1024*1024*1024,xs=class{host;port;protocol;accessKey;#e;sessionToken;defaultBucket;region;userAgent="s3-lite-client";pathStyle;pathPrefix;constructor({endPoint:e,useSSL:r,port:n,pathPrefix:o,...i}){if(/^https?:\/\//i.test(e)){if(r!==void 0||n!==void 0||o!==void 0)throw new Ct("useSSL/port/pathPrefix cannot be specified if endPoint is a URL.");try{let s=new URL(e);e=s.hostname,r=s.protocol==="https:",n=s.port?parseInt(s.port,10):r?443:80,s.pathname&&s.pathname!=="/"&&(o=s.pathname.endsWith("/")?s.pathname.slice(0,-1):s.pathname)}catch{throw new ws(`Invalid endPoint URL: ${e}`)}}if(typeof e!="string"||e.length===0)throw new ws(`Invalid endPoint: ${e}`);if(r===void 0&&(r=!0),n!==void 0&&!M2(n))throw new Ct(`Invalid port: ${n}`);if(i.accessKey&&!i.secretKey)throw new Ct("If specifying access key, secret key must also be provided.");if(i.accessKey&&i.accessKey.startsWith("ASIA")&&!i.sessionToken)throw new Ct("If specifying temporary access key, session token must also be provided.");let a=r?443:80;if(this.port=n??a,this.host=e.toLowerCase()+(this.port!==a?`:${this.port}`:""),this.protocol=r?"https:":"http:",this.accessKey=i.accessKey,this.#e=i.secretKey??"",this.sessionToken=i.sessionToken,this.pathStyle=i.pathStyle??!0,this.pathPrefix=o??"",this.defaultBucket=i.bucket,this.region=i.region,this.pathPrefix){if(!this.pathStyle)throw new Ct("pathPrefix is incompatible with pathStyle=false");if(!this.pathPrefix.startsWith("/"))throw new Ct("pathPrefix should start with /");if(this.pathPrefix.endsWith("/"))throw new Ct("pathPrefix should not end with /")}}getBucketName(e){let r=e?.bucketName??this.defaultBucket;if(r===void 0||!q2(r))throw new Bl(r??"");return r}buildRequestOptions(e){let r=this.getBucketName(e),n=this.pathStyle?this.host:`${r}.${this.host}`,o=e.headers??new Headers;o.set("host",n);let i=typeof e.query=="object"?new URLSearchParams(e.query).toString().replace("+","%20"):e.query,a=this.pathStyle?`${this.pathPrefix}/${r}/${e.objectName}`:`/${e.objectName}`,s=i?`?${i}`:"",u=a+s,c=a.split("/").map(l=>encodeURIComponent(l)).join("/")+s;return{headers:o,host:n,path:u,encodedPath:c}}async makeRequest({method:e,payload:r,...n}){let o=new Date,{headers:i,host:a,path:s,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)),i.set("Content-Length",String(r.length));else if(r)throw new Error(`Unexpected payload on ${e} request.`);let l=await jl(r??new Uint8Array);i.set("x-amz-date",Ao(o)),i.set("x-amz-content-sha256",l),this.accessKey&&(this.sessionToken&&i.set("x-amz-security-token",this.sessionToken),i.set("authorization",await H2({headers:i,method:e,path:s,accessKey:this.accessKey,secretKey:this.#e,region:this.region,date:o})));let f=`${this.protocol}//${a}${u}`,d=await fetch(f,{method:e,headers:i,body:r});if(d.status!==c)throw d.status>=400?await U2(d):d.status===301?new an(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 an(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(!Bn(e))throw new jr(e);let o=r.versionId?{versionId:r.versionId}:{},i=new Headers;r.governanceBypass&&i.set("X-Amz-Bypass-Governance-Retention","true"),await this.makeRequest({method:"DELETE",bucketName:n,objectName:e,headers:i,query:o,statusCode:204})}async exists(e,r){try{return await this.statObject(e,r),!0}catch(n){if(n instanceof an&&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,...o}){let i=this.getBucketName(o);if(!Bn(e))throw new jr(e);let a=new Headers(Object.entries(o.metadata??{})),s=200;if(r||n){let c="";r?c=`bytes=${+r}-`:(c="bytes=0-",r=0),n&&(c+=`${+n+r-1}`),a.set("Range",c),s=206}let u={...o.responseParams,...o.versionId?{versionId:o.versionId}:{}};return await this.makeRequest({method:"GET",bucketName:i,objectName:e,headers:a,query:u,statusCode:s,returnBody:!0})}getPresignedUrl(e,r,n={}){if(!this.accessKey)throw new Rn;if(!Bn(r))throw new jr(r);let{headers:o,path:i}=this.buildRequestOptions({objectName:r,bucketName:n.bucketName,query:n.parameters}),a=n.requestDate??new Date,s=n.expirySeconds??1440*60*7;return V2({protocol:this.protocol,headers:o,method:e,path:i,accessKey:this.accessKey,secretKey:this.#e,sessionToken:this.sessionToken,region:this.region,date:a,expirySeconds:s})}presignedGetObject(e,r={}){let{versionId:n,responseParams:o,...i}=r,a={...o,...n?{versionId:n}:{}};return this.getPresignedUrl("GET",e,{parameters:a,...i})}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="",o=e.pageSize??1e3;if(o<1||o>1e3)throw new Ct("pageSize must be between 1 and 1,000.");let i=0;for(;;){let a=e.maxResults?Math.min(o,e.maxResults-i):o;if(a===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(a),...n?{"continuation-token":n}:{}},returnBody:!0})).text(),c=In(u).root;if(!c||c.name!=="ListBucketResult")throw new Error(`Unexpected response: ${u}`);let l=c.children.filter(h=>h.name==="CommonPrefixes").flatMap(h=>h.children),f=[];for(let h of l)f.push({type:"CommonPrefix",prefix:h.content??""}),i++;for(let h of c.children.filter(m=>m.name==="Contents"))f.push({type:"Object",key:h.children.find(m=>m.name==="Key")?.content??"",etag:Fo(h.children.find(m=>m.name==="ETag")?.content??""),size:parseInt(h.children.find(m=>m.name==="Size")?.content??"",10),lastModified:new Date(h.children.find(m=>m.name==="LastModified")?.content??"invalid")}),i++;f.sort((h,m)=>{let b=h.type==="Object"?h.key:h.prefix,D=m.type==="Object"?m.key:m.prefix;return b>D?1:b<D?-1:0});for(let h of f)yield h;if(c.children.find(h=>h.name==="IsTruncated")?.content==="true"){let h=c.children.find(m=>m.name==="NextContinuationToken")?.content;if(!h)throw new Error("Unexpectedly missing continuation token, but server said there are more results.");n=h}else return}}async putObject(e,r,n){let o=this.getBucketName(n);if(!Bn(e))throw new jr(e);let i,a;if(typeof r=="string"){let l=new TextEncoder().encode(r);typeof ReadableStream.from<"u"?a=ReadableStream.from([l]):a=new ReadableStream({start(f){f.enqueue(l),f.close()}}),i=l.length}else if(r instanceof Uint8Array)typeof ReadableStream.from<"u"?a=ReadableStream.from([r]):a=new ReadableStream({start(l){l.enqueue(r),l.close()}}),i=r.byteLength;else if(r instanceof ReadableStream)a=r;else throw new Ct("Invalid stream/data type provided.");if(n?.size!==void 0){if(i!==void 0&&n?.size!==i)throw new Ct(`size was specified (${n.size}) but doesn't match auto-detected size (${i}).`);if(typeof n.size!="number"||n.size<0||isNaN(n.size))throw new Ct(`invalid size specified: ${n.size}`);i=n.size}let s=n?.partSize??this.calculatePartSize(i);if(s<DU)throw new Ct("Part size should be greater than 5MB");if(s>yU)throw new Ct("Part size should be less than 6MB");let u=new Rl(s),c=new Nl({client:this,bucketName:o,objectName:e,partSize:s,metadata:n?.metadata??{}});return await a.pipeThrough(u).pipeTo(c),c.getResult()}calculatePartSize(e){if(e===void 0&&(e=wg),e>wg)throw new TypeError(`size should not be more than ${wg}`);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(!Bn(e))throw new jr(e);let o={};r?.versionId&&(o.versionId=r.versionId);let i=await this.makeRequest({method:"HEAD",bucketName:n,objectName:e,query:o,headers:new Headers(r?.headers)}),a={};for(let s of gU)i.headers.has(s)&&(a[s]=i.headers.get(s));return i.headers.forEach((s,u)=>{u.startsWith("x-amz-meta-")&&(a[u]=i.headers.get(u))}),{type:"Object",key:e,size:parseInt(i.headers.get("content-length")??"",10),metadata:a,lastModified:new Date(i.headers.get("Last-Modified")??"error: missing last modified"),versionId:i.headers.get("x-amz-version-id")||null,etag:Fo(i.headers.get("ETag")??"")}}async copyObject(e,r,n){let o=this.getBucketName(n),i=e.sourceBucketName??o;if(!Bn(r))throw new jr(r);let a=`${i}/${e.sourceKey}`;e.sourceVersionId&&(a+=`?versionId=${e.sourceVersionId}`);let s=new Headers(n?.metadata);n?.metadata!==void 0&&s.set("x-amz-metadata-directive","REPLACE"),s.set("x-amz-copy-source",a);let u=await this.makeRequest({method:"PUT",bucketName:o,objectName:r,headers:s,returnBody:!0}),c=await u.text(),l=In(c).root;if(!l||l.name!=="CopyObjectResult")throw new Error(`Unexpected response: ${c}`);let f=l.children.find(h=>h.name==="ETag")?.content??"",d=l.children.find(h=>h.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:Fo(f),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 an&&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(!Bn(e))throw new jr(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 o=r.requestDate||new Date,i=r.expirySeconds??3600;return K2({protocol:this.protocol,host:this.host,bucket:n,objectKey:e,accessKey:this.accessKey||"",secretKey:this.#e||"",region:this.region,date:o,expirySeconds:i,conditions:r.conditions,fields:r.fields})}};var $o=require("node:fs"),Ll=require("node:path");function bU(t,e){return(0,$o.readFileSync)(t,"utf8").includes(e)}function Ss(t,e){let r=(0,$o.readdirSync)(t);for(let n of r){let o=(0,Ll.join)(t,n),i=(0,$o.statSync)(o);if(i.isDirectory()){if(Ss(o,e))return!0}else if(i.isFile()&&(0,Ll.extname)(o)===".js"&&bU(o,e))return!0}return!1}function Ul(t){return(0,$o.readdirSync)(t).indexOf("index.html")>-1}var oa=require("node:fs"),nF=require("node:os"),jn=require("node:path"),oF=require("node:process"),Kl=require("node:stream/consumers"),iF=require("node:zlib");var aF=ge(rF()),sF=ge(Lh());async function IM(t,e){try{return(await fetch(`${t.hostFilesApi}/files/read/attachments/${encodeURIComponent(e)}`,{method:"HEAD"})).ok}catch{return!1}}var uF=8192,cF="6.25.0",lF="7.0.35";async function RM(t){let e=(0,jn.join)(vt((0,oF.cwd)()),bt),n=(await ft(void 0,t.packageJson||e)).get("@capgo/capacitor-updater"),o;try{o=n?_e(n):void 0}catch{o=void 0}if(!n||!o)return{version:null,supportsBrotliV2:!1};let i=o.major===6&&dn(o,_e(cF)),a=o.major>=7&&dn(o,_e(lF)),s=i||a;return{version:`${o.major}.${o.minor}.${o.patch}`,supportsBrotliV2:s}}function BM(t,e){if(!e)return!1;let r=e.split(",").map(n=>n.trim()).filter(n=>!!n);return r.length===0?!1:aF.isMatch(t,r)}async function jM(t,e,r){let o=(0,oa.statSync)(t).size,i=await(0,Kl.buffer)((0,oa.createReadStream)(t));if(o===0)return{buffer:i,useBrotli:!1};if(BM(e,r.noBrotliPatterns))return{buffer:i,useBrotli:!1};if(o<uF)return{buffer:i,useBrotli:!1};try{let a=await(0,Kl.buffer)((0,oa.createReadStream)(t).pipe((0,iF.createBrotliCompress)({})));return a.length>=o-10?(p.info(`Brotli not effective for ${e} (${o} bytes), using original file`),{buffer:i,useBrotli:!1}):{buffer:a,useBrotli:!0}}catch(a){return p.warn(`Brotli compression failed for ${t}: ${a}, using original file`),{buffer:i,useBrotli:!1}}}async function fF(t,e,r,n,o,i){let a=we();a.start(o!=="v2"?"Generating the update manifest":"Generating the update manifest with v2 encryption");let s=await i2(t);if(o==="v2")for(let u of s)u.hash=ea(u.hash,i);return a.stop("Manifest generated successfully"),await be(e,{channel:"partial-update",event:"Generate manifest",icon:"\u{1F4C2}",user_id:r,tags:{"app-id":n},notify:!1}),s}function NM(t){return(0,nF.platform)()!=="win32"?t:jn.win32.normalize(t).split(jn.win32.sep).join(jn.posix.sep)}function LM(t){let e=t.split("/").map(r=>encodeURIComponent(r)).join("/");return t.includes(" ")&&p.warn(`File "${t}" contains spaces in its name.`),e}async function pF(t,e,r,n,o,i,a){let s=we();s.start("Preparing partial update with TUS protocol");let u=performance.now(),c=await ir(),l=!!(a.partial||a.delta||a.partialOnly||a.deltaOnly),{version:f,supportsBrotliV2:d}=await RM(a);if(d)a.disableBrotli?p.info("Brotli compression disabled by user request"):(s.message(`Using .br extension for compatible files (updater ${f})`),a.noBrotliPatterns&&p.info(`Files matching patterns (${a.noBrotliPatterns}) will be excluded from brotli compression`),p.info(`Files smaller than ${uF} bytes will be excluded from brotli compression (Brotli RFC minimum)`));else throw new Error(`Your project is using an older version of @capgo/capacitor-updater (${f||"unknown"}). To use Delta updates, please upgrade to version ${cF} (v6) or ${lF} (v7) or higher.`);let h=e.filter(C=>C.file.includes(" "));if(h.length>0)throw new Error(`Files with spaces in their names (${h.map(C=>C.file).join(", ")}). Please rename the files.`);let m=0,b=e.length,D=0;try{let C=e.map(async S=>{let I=(0,jn.join)(r,S.file),O=NM(S.file),B,R=!1;if(a.disableBrotli)B=await(0,Kl.buffer)((0,oa.createReadStream)(I)),R=!1;else{let Q=await jM(I,O,a);B=Q.buffer,R=Q.useBrotli}let N=B;i&&(N=Qi(B,i.sessionKey,i.ivSessionKey));let A=O;R&&(A=`${O}.br`,D++);let L=LM(A),q=`orgs/${o}/apps/${n}/delta/${S.hash}_${L}`;return await IM(c,q)?(m++,Promise.resolve({file_name:L,s3_path:q,file_hash:S.hash})):new Promise((Q,$)=>{let y=0,v=3,w=()=>{new sF.Upload(N,{endpoint:`${c.hostFilesApi}/files/upload/attachments/`,chunkSize:a.tusChunkSize,retryDelays:[0,1e3,3e3,5e3],removeFingerprintOnSuccess:!0,metadata:{filename:q},headers:{Authorization:t},onError:async T=>{let k=T.toString();if(k.includes("offset")||k.includes("409")||k.includes("conflict"))if(y++,y<=v){p.warn(`Offset mismatch for ${O}, retrying (attempt ${y}/${v})...`),await new Promise(M=>setTimeout(M,1e3*y)),w();return}else p.error(`Failed to upload ${O} after ${v} retries due to offset errors`),p.info("This may happen if the upload expired or there was a network issue. The file will be skipped.");else p.error(`Failed to upload ${O}: ${k}`);$(T)},onProgress(){let T=(m/b*100).toFixed(2);s.message(`Uploading partial update: ${T}%`)},onSuccess(){m++,Q({file_name:L,s3_path:q,file_hash:S.hash})}}).start()};w()})}),E=await Promise.all(C),_=((performance.now()-u)/1e3).toFixed(2);return s.stop(`Partial update uploaded successfully \u{1F4AA} in (${_} seconds)`),D>0&&p.info(`${D} of ${b} files were compressed with brotli and use .br extension`),await be(t,{channel:"app",event:`App Partial TUS done${D>0?" with .br extension":""}`,icon:"\u23EB",user_id:o,tags:{"app-id":n},notify:!1}),await be(t,{channel:"performance",event:"Partial upload performance",icon:"\u{1F684}",user_id:o,tags:{"app-id":n,time:_},notify:!1}),E}catch(C){let g=((performance.now()-u)/1e3).toFixed(2);if(s.stop(`Failed to upload Partial bundle (after ${g} seconds)`),l)throw p.error(`Error uploading partial update: ${C}`),p.error("Delta/partial upload was explicitly requested but failed. Upload aborted."),C;return p.info(`Error uploading partial update: ${C}, This is not a critical error, the bundle has been uploaded without the partial files`),null}}function me(t){throw p.error(t),new Error(t)}async function UM(t,e){let r=xr("",e.packageJson),n=e.bundle||t?.plugins?.CapacitorUpdater?.version||r||`0.0.1-beta.${(0,dF.randomUUID)().split("-")[0]}`;return Gi.test(n)||me(`Your bundle name ${n}, is not valid it should follow semver convention : https://semver.org/`),n}function MM(t){let e=t.apikey||ie();return e||me("Missing API key, you need to provide an API key to upload your bundle"),e}function qM(t,e,r){let n=he(t,r),o=e.path||r?.webDir;return n||me("Missing argument, you need to provide a appid or be in a capacitor project"),o||me("Missing argument, you need to provide a path (--path), or be in a capacitor project"),(0,Io.existsSync)(o)||me(`Path ${o} does not exist, build your app first, or provide a valid path`),{appid:n,path:o}}function HM(t,e){let r=t.codeCheck;(typeof r>"u"||r)&&(Ss(e,"notifyAppReady")||me(`notifyAppReady() is missing in the build folder of your app. see: https://capgo.app/docs/plugin/api/#notifyappready
197
- If you are sure your app has this code, you can use the --no-code-check option`),Ul(e)||me(`index.html is missing in the root folder of ${e}`))}async function VM(t,e,r,n,o,i){let a=r.ignoreMetadataCheck,s=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",o).single(),f=!!c&&c.disable_auto_update==="version_number",d,h;if(!l&&c&&c.version&&c.version.native_packages&&!a){let D=we();D.start(`Checking bundle compatibility with channel ${n}`);let{finalCompatibility:C,localDependencies:E}=await Fl(t,o,n,r.packageJson,r.nodeModules);if(h=C,d=E,h.find(g=>!So(g)))D.stop(`Bundle NOT compatible with ${n} channel`),p.warn(`You can check compatibility with "${e.runner} @capgo/cli bundle compatibility"`),s&&(u=i,p.info(`Auto set min-update-version to ${u}`));else if(s)try{let{min_update_version:g}=c.version;(!g||!Gi.test(g))&&me("Invalid remote min update version, skipping auto setting compatibility"),u=g,D.stop(`Auto set min-update-version to ${u}`)}catch{me(`Cannot auto set compatibility, invalid data ${c}`)}else D.stop(`Bundle compatible with ${n} channel`)}else a||(p.warn(`Channel ${n} is new or it's your first upload with compatibility check, it will be ignored this time`),d=await cg(r.packageJson,r.nodeModules),s&&(u=i,p.info(`Auto set min-update-version to ${u}`)));f&&!u&&!a&&me("You need to provide a min-update-version to upload a bundle to this channel"),u&&(Gi.test(u)||me(`Your minimal version update ${u}, is not valid it should follow semver convention : https://semver.org/`));let m=d?new Map(d.filter(D=>!!D.native&&D.native!==void 0).map(D=>[D.name,D])):new Map;return{nativePackages:m.size>0||!r.ignoreMetadataCheck?Array.from(m,([D,C])=>({name:D,version:C.version})):void 0,minUpdateVersion:u}}async function zM(t,e,r){let{data:n,error:o}=await t.rpc("is_trial_org",{orgid:e}).single();(n&&n>0||o)&&(p.warn(`WARNING !!
198
- Trial expires in ${n} days`),p.warn(`Upgrade here: ${r.hostWeb}/dashboard/settings/plans?oid=${e}`))}async function GM(t,e,r,n=!1){let{data:o,error:i}=await t.rpc("exist_app_versions",{appid:e,name_version:r}).single();if(o||i){if(n)return p.warn(`Version ${r} already exists - exiting gracefully due to --silent-fail option`),J("Bundle version already exists - exiting gracefully \u{1F389}"),!0;me(`Version ${r} already exists ${U(i)}`)}return!1}async function WM(t,e,r,n,o,i,a){let s,u,c="",l=null,f="none",d="",h=e.keyV2,m=e.key===!1;l=await xl(t);let b=we();b.start("Calculating checksum");let D=(0,Ng.join)(vt((0,Lg.cwd)()),bt),E=(await ft(void 0,e.packageJson||D)).get("@capgo/capacitor-updater"),g=!1,_;try{_=E?_e(E):void 0}catch{_=void 0}if(E?_?g=dn(_,_e("6.25.0")):(E==="link:@capgo/capacitor-updater"||E==="file:.."||E==="file:../")&&(p.warn("Using local @capgo/capacitor-updater. Assuming latest version for checksum calculation."),g=!0):me("Cannot find @capgo/capacitor-updater in ./package.json, provide the package.json path with --package-json it's required for v7 CLI to work"),(h||e.keyDataV2||(0,Io.existsSync)(Wt))&&!m||g?c=await Xr(l,"sha256"):c=await Xr(l,"crc32"),b.stop(`Checksum ${g?"SHA256":"CRC32"}: ${c}`),m)p.info("Encryption ignored");else if((h||(0,Io.existsSync)(Wt)||e.keyDataV2)&&!e.oldEncryption){let O=typeof h=="string"?h:Wt,B=e.keyDataV2||"";!B&&!(0,Io.existsSync)(O)&&me(`Cannot find private key ${O}`),await be(r,{channel:"app",event:"App encryption v2",icon:"\u{1F511}",user_id:n,tags:{"app-id":o},notify:!1},e.verbose),B||(B=(0,Io.readFileSync)(O).toString()),p.info("Encrypting your bundle with V2");let{sessionKey:R,ivSessionKey:N}=Il(B),A=Qi(l,R,N);c=ea(c,B),s=N,u=R,f="v2",d=B,e.displayIvSession&&p.info(`Your Iv Session key is ${s},
197
+ `)}async function QS(t,e,r){let n=await Ul(t),o=vg(r,e);return[Fs,ko(e),o,n].join(`
198
+ `)}async function Eg(t,e,r){let n=wg(t),o=await Po("AWS4"+r,n),i=await Po(o,e),a=await Po(i,"s3");return await Po(a,"aws4_request")}function _g(t,e,r){return`${t}/${vg(e,r)}`}async function Po(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"]),o=await crypto.subtle.sign("HMAC",n,e instanceof Uint8Array?e:r.encode(e));return new Uint8Array(o)}async function e2(t){if(!t.accessKey)throw new jn;if(!t.secretKey)throw new oa;if(t.expirySeconds<1||t.expirySeconds>604800)throw new xs;let e=new Date(t.date);e.setSeconds(e.getSeconds()+t.expirySeconds);let r=_g(t.accessKey,t.region,t.date),n=ko(t.date),o={"X-Amz-Algorithm":Fs,"X-Amz-Credential":r,"X-Amz-Date":n,key:t.objectKey,...t.fields},i=[{bucket:t.bucket},{key:t.objectKey},{"X-Amz-Algorithm":Fs},{"X-Amz-Credential":r},{"X-Amz-Date":n}];t.conditions&&i.push(...t.conditions);for(let[h,m]of Object.entries(t.fields||{}))["key","X-Amz-Algorithm","X-Amz-Credential","X-Amz-Date"].includes(h)||i.push({[h]:m});let a={expiration:e.toISOString(),conditions:i},s=new TextEncoder().encode(JSON.stringify(a)),u=btoa(String.fromCharCode(...s));o.policy=u;let c=u,l=await Eg(t.date,t.region,t.secretKey),p=Ss(await Po(l,c)).toLowerCase();return o["X-Amz-Signature"]=p,{url:`${t.protocol}//${t.host}/${t.bucket}`,fields:o}}var _U=["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"],xU=5*1024*1024,SU=5*1024*1024*1024,xg=5*1024*1024*1024*1024,As=class{host;port;protocol;accessKey;#e;sessionToken;defaultBucket;region;userAgent="s3-lite-client";pathStyle;pathPrefix;constructor({endPoint:e,useSSL:r,port:n,pathPrefix:o,...i}){if(/^https?:\/\//i.test(e)){if(r!==void 0||n!==void 0||o!==void 0)throw new wt("useSSL/port/pathPrefix cannot be specified if endPoint is a URL.");try{let s=new URL(e);e=s.hostname,r=s.protocol==="https:",n=s.port?parseInt(s.port,10):r?443:80,s.pathname&&s.pathname!=="/"&&(o=s.pathname.endsWith("/")?s.pathname.slice(0,-1):s.pathname)}catch{throw new _s(`Invalid endPoint URL: ${e}`)}}if(typeof e!="string"||e.length===0)throw new _s(`Invalid endPoint: ${e}`);if(r===void 0&&(r=!0),n!==void 0&&!WS(n))throw new wt(`Invalid port: ${n}`);if(i.accessKey&&!i.secretKey)throw new wt("If specifying access key, secret key must also be provided.");if(i.accessKey&&i.accessKey.startsWith("ASIA")&&!i.sessionToken)throw new wt("If specifying temporary access key, session token must also be provided.");let a=r?443:80;if(this.port=n??a,this.host=e.toLowerCase()+(this.port!==a?`:${this.port}`:""),this.protocol=r?"https:":"http:",this.accessKey=i.accessKey,this.#e=i.secretKey??"",this.sessionToken=i.sessionToken,this.pathStyle=i.pathStyle??!0,this.pathPrefix=o??"",this.defaultBucket=i.bucket,this.region=i.region,this.pathPrefix){if(!this.pathStyle)throw new wt("pathPrefix is incompatible with pathStyle=false");if(!this.pathPrefix.startsWith("/"))throw new wt("pathPrefix should start with /");if(this.pathPrefix.endsWith("/"))throw new wt("pathPrefix should not end with /")}}getBucketName(e){let r=e?.bucketName??this.defaultBucket;if(r===void 0||!KS(r))throw new Ll(r??"");return r}buildRequestOptions(e){let r=this.getBucketName(e),n=this.pathStyle?this.host:`${r}.${this.host}`,o=e.headers??new Headers;o.set("host",n);let i=typeof e.query=="object"?new URLSearchParams(e.query).toString().replace("+","%20"):e.query,a=this.pathStyle?`${this.pathPrefix}/${r}/${e.objectName}`:`/${e.objectName}`,s=i?`?${i}`:"",u=a+s,c=a.split("/").map(l=>encodeURIComponent(l)).join("/")+s;return{headers:o,host:n,path:u,encodedPath:c}}async makeRequest({method:e,payload:r,...n}){let o=new Date,{headers:i,host:a,path:s,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)),i.set("Content-Length",String(r.length));else if(r)throw new Error(`Unexpected payload on ${e} request.`);let l=await Ul(r??new Uint8Array);i.set("x-amz-date",ko(o)),i.set("x-amz-content-sha256",l),this.accessKey&&(this.sessionToken&&i.set("x-amz-security-token",this.sessionToken),i.set("authorization",await YS({headers:i,method:e,path:s,accessKey:this.accessKey,secretKey:this.#e,region:this.region,date:o})));let p=`${this.protocol}//${a}${u}`,d=await fetch(p,{method:e,headers:i,body:r});if(d.status!==c)throw d.status>=400?await GS(d):d.status===301?new sn(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 sn(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(!Nn(e))throw new jr(e);let o=r.versionId?{versionId:r.versionId}:{},i=new Headers;r.governanceBypass&&i.set("X-Amz-Bypass-Governance-Retention","true"),await this.makeRequest({method:"DELETE",bucketName:n,objectName:e,headers:i,query:o,statusCode:204})}async exists(e,r){try{return await this.statObject(e,r),!0}catch(n){if(n instanceof sn&&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,...o}){let i=this.getBucketName(o);if(!Nn(e))throw new jr(e);let a=new Headers(Object.entries(o.metadata??{})),s=200;if(r||n){let c="";r?c=`bytes=${+r}-`:(c="bytes=0-",r=0),n&&(c+=`${+n+r-1}`),a.set("Range",c),s=206}let u={...o.responseParams,...o.versionId?{versionId:o.versionId}:{}};return await this.makeRequest({method:"GET",bucketName:i,objectName:e,headers:a,query:u,statusCode:s,returnBody:!0})}getPresignedUrl(e,r,n={}){if(!this.accessKey)throw new jn;if(!Nn(r))throw new jr(r);let{headers:o,path:i}=this.buildRequestOptions({objectName:r,bucketName:n.bucketName,query:n.parameters}),a=n.requestDate??new Date,s=n.expirySeconds??1440*60*7;return JS({protocol:this.protocol,headers:o,method:e,path:i,accessKey:this.accessKey,secretKey:this.#e,sessionToken:this.sessionToken,region:this.region,date:a,expirySeconds:s})}presignedGetObject(e,r={}){let{versionId:n,responseParams:o,...i}=r,a={...o,...n?{versionId:n}:{}};return this.getPresignedUrl("GET",e,{parameters:a,...i})}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="",o=e.pageSize??1e3;if(o<1||o>1e3)throw new wt("pageSize must be between 1 and 1,000.");let i=0;for(;;){let a=e.maxResults?Math.min(o,e.maxResults-i):o;if(a===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(a),...n?{"continuation-token":n}:{}},returnBody:!0})).text(),c=Bn(u).root;if(!c||c.name!=="ListBucketResult")throw new Error(`Unexpected response: ${u}`);let l=c.children.filter(h=>h.name==="CommonPrefixes").flatMap(h=>h.children),p=[];for(let h of l)p.push({type:"CommonPrefix",prefix:h.content??""}),i++;for(let h of c.children.filter(m=>m.name==="Contents"))p.push({type:"Object",key:h.children.find(m=>m.name==="Key")?.content??"",etag:Oo(h.children.find(m=>m.name==="ETag")?.content??""),size:parseInt(h.children.find(m=>m.name==="Size")?.content??"",10),lastModified:new Date(h.children.find(m=>m.name==="LastModified")?.content??"invalid")}),i++;p.sort((h,m)=>{let b=h.type==="Object"?h.key:h.prefix,D=m.type==="Object"?m.key:m.prefix;return b>D?1:b<D?-1:0});for(let h of p)yield h;if(c.children.find(h=>h.name==="IsTruncated")?.content==="true"){let h=c.children.find(m=>m.name==="NextContinuationToken")?.content;if(!h)throw new Error("Unexpectedly missing continuation token, but server said there are more results.");n=h}else return}}async putObject(e,r,n){let o=this.getBucketName(n);if(!Nn(e))throw new jr(e);let i,a;if(typeof r=="string"){let l=new TextEncoder().encode(r);typeof ReadableStream.from<"u"?a=ReadableStream.from([l]):a=new ReadableStream({start(p){p.enqueue(l),p.close()}}),i=l.length}else if(r instanceof Uint8Array)typeof ReadableStream.from<"u"?a=ReadableStream.from([r]):a=new ReadableStream({start(l){l.enqueue(r),l.close()}}),i=r.byteLength;else if(r instanceof ReadableStream)a=r;else throw new wt("Invalid stream/data type provided.");if(n?.size!==void 0){if(i!==void 0&&n?.size!==i)throw new wt(`size was specified (${n.size}) but doesn't match auto-detected size (${i}).`);if(typeof n.size!="number"||n.size<0||isNaN(n.size))throw new wt(`invalid size specified: ${n.size}`);i=n.size}let s=n?.partSize??this.calculatePartSize(i);if(s<xU)throw new wt("Part size should be greater than 5MB");if(s>SU)throw new wt("Part size should be less than 6MB");let u=new Nl(s),c=new Ml({client:this,bucketName:o,objectName:e,partSize:s,metadata:n?.metadata??{}});return await a.pipeThrough(u).pipeTo(c),c.getResult()}calculatePartSize(e){if(e===void 0&&(e=xg),e>xg)throw new TypeError(`size should not be more than ${xg}`);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(!Nn(e))throw new jr(e);let o={};r?.versionId&&(o.versionId=r.versionId);let i=await this.makeRequest({method:"HEAD",bucketName:n,objectName:e,query:o,headers:new Headers(r?.headers)}),a={};for(let s of _U)i.headers.has(s)&&(a[s]=i.headers.get(s));return i.headers.forEach((s,u)=>{u.startsWith("x-amz-meta-")&&(a[u]=i.headers.get(u))}),{type:"Object",key:e,size:parseInt(i.headers.get("content-length")??"",10),metadata:a,lastModified:new Date(i.headers.get("Last-Modified")??"error: missing last modified"),versionId:i.headers.get("x-amz-version-id")||null,etag:Oo(i.headers.get("ETag")??"")}}async copyObject(e,r,n){let o=this.getBucketName(n),i=e.sourceBucketName??o;if(!Nn(r))throw new jr(r);let a=`${i}/${e.sourceKey}`;e.sourceVersionId&&(a+=`?versionId=${e.sourceVersionId}`);let s=new Headers(n?.metadata);n?.metadata!==void 0&&s.set("x-amz-metadata-directive","REPLACE"),s.set("x-amz-copy-source",a);let u=await this.makeRequest({method:"PUT",bucketName:o,objectName:r,headers:s,returnBody:!0}),c=await u.text(),l=Bn(c).root;if(!l||l.name!=="CopyObjectResult")throw new Error(`Unexpected response: ${c}`);let p=l.children.find(h=>h.name==="ETag")?.content??"",d=l.children.find(h=>h.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:Oo(p),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 sn&&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(!Nn(e))throw new jr(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 o=r.requestDate||new Date,i=r.expirySeconds??3600;return e2({protocol:this.protocol,host:this.host,bucket:n,objectKey:e,accessKey:this.accessKey||"",secretKey:this.#e||"",region:this.region,date:o,expirySeconds:i,conditions:r.conditions,fields:r.fields})}};var To=require("node:fs"),ql=require("node:path");function FU(t,e){return(0,To.readFileSync)(t,"utf8").includes(e)}function Os(t,e){let r=(0,To.readdirSync)(t);for(let n of r){let o=(0,ql.join)(t,n),i=(0,To.statSync)(o);if(i.isDirectory()){if(Os(o,e))return!0}else if(i.isFile()&&(0,ql.extname)(o)===".js"&&FU(o,e))return!0}return!1}function Hl(t){return(0,To.readdirSync)(t).indexOf("index.html")>-1}var sa=require("node:fs"),cF=require("node:os"),Bo=require("node:path"),lF=require("node:process"),Xl=require("node:stream/consumers"),fF=require("node:zlib");var pF=me(uF()),dF=me(qh());async function qM(t,e){try{return(await fetch(`${t.hostFilesApi}/files/read/attachments/${encodeURIComponent(e)}`,{method:"HEAD"})).ok}catch{return!1}}var HM=8192,hF="6.25.0",mF="7.0.35";async function VM(t){let e=yt((0,lF.cwd)()),r=await rn("@capgo/capacitor-updater",e,t.packageJson),n;try{n=r?_e(r):void 0}catch{n=void 0}if(!r||!n)return{version:null,supportsBrotliV2:!1};let o=n.major===6&&hn(n,_e(hF)),i=n.major>=7&&hn(n,_e(mF)),a=o||i;return{version:`${n.major}.${n.minor}.${n.patch}`,supportsBrotliV2:a}}function zM(t,e){if(!e)return!1;let r=e.split(",").map(n=>n.trim()).filter(n=>!!n);return r.length===0?!1:pF.isMatch(t,r)}async function GM(t,e,r){let o=(0,sa.statSync)(t).size,i=await(0,Xl.buffer)((0,sa.createReadStream)(t));if(o===0)return{buffer:i,useBrotli:!1};if(zM(e,r.noBrotliPatterns))return{buffer:i,useBrotli:!1};if(o<HM)return{buffer:i,useBrotli:!1};try{let a=await(0,Xl.buffer)((0,sa.createReadStream)(t).pipe((0,fF.createBrotliCompress)({})));return a.length>=o-10?{buffer:i,useBrotli:!1}:{buffer:a,useBrotli:!0}}catch(a){return f.warn(`Brotli compression failed for ${t}: ${a}, using original file`),{buffer:i,useBrotli:!1}}}async function gF(t,e,r,n,o,i){let a=ve();a.start(o!=="v2"?"Generating the update manifest":"Generating the update manifest with v2 encryption");let s=await uS(t);if(o==="v2")for(let u of s)u.hash=na(u.hash,i);return a.stop("Manifest generated successfully"),await be(e,{channel:"partial-update",event:"Generate manifest",icon:"\u{1F4C2}",user_id:r,tags:{"app-id":n},notify:!1}),s}function WM(t){return(0,cF.platform)()!=="win32"?t:Bo.win32.normalize(t).split(Bo.win32.sep).join(Bo.posix.sep)}function KM(t){let e=t.split("/").map(r=>encodeURIComponent(r)).join("/");return t.includes(" ")&&f.warn(`File "${t}" contains spaces in its name.`),e}async function DF(t,e,r,n,o,i,a){let s=ve();s.start("Preparing partial update with TUS protocol");let u=performance.now(),c=await ir(),l=!!(a.partial||a.delta||a.partialOnly||a.deltaOnly),{version:p,supportsBrotliV2:d}=await VM(a);if(d)a.disableBrotli?f.info("Brotli compression disabled by user request"):a.noBrotliPatterns&&f.info(`Files matching patterns (${a.noBrotliPatterns}) will be excluded from brotli compression`);else throw new Error(`Your project is using an older version of @capgo/capacitor-updater (${p||"unknown"}). To use Delta updates, please upgrade to version ${hF} (v6) or ${mF} (v7) or higher.`);let h=e.filter(C=>C.file.includes(" "));if(h.length>0)throw new Error(`Files with spaces in their names (${h.map(C=>C.file).join(", ")}). Please rename the files.`);let m=0,b=e.length,D=0;try{s.message(`Uploading ${b} files using TUS protocol`);let C=async $=>{let k=(0,Bo.join)(r,$.file),B=WM($.file),R,N=!1;if(a.disableBrotli)R=await(0,Xl.buffer)((0,sa.createReadStream)(k)),N=!1;else{let P=await GM(k,B,a);R=P.buffer,N=P.useBrotli}let A=R;i&&(A=ra(R,i.sessionKey,i.ivSessionKey));let U=B;N&&(U=`${B}.br`,D++);let M=KM(U),Q=`orgs/${o}/apps/${n}/delta/${$.hash}_${M}`;return await qM(c,Q)?(m++,Promise.resolve({file_name:M,s3_path:Q,file_hash:$.hash})):new Promise((P,y)=>{s.message(`Prepare upload partial file: ${B}`),new dF.Upload(A,{endpoint:`${c.hostFilesApi}/files/upload/attachments/`,chunkSize:a.tusChunkSize,retryDelays:[0,1e3,3e3,5e3,1e4],removeFingerprintOnSuccess:!0,metadata:{filename:Q},headers:{Authorization:t},onError:v=>{let F=v.toString(),I;try{let q=F.match(/response text: (\{.*?\})/);q&&q[1]&&(I=JSON.parse(q[1]).moreInfo?.requestId)}catch{}let O=I?` [requestId: ${I}]`:"";f.error(`Failed to upload ${B}: ${F}${O}`),y(v)},onProgress(){let v=(m/b*100).toFixed(2);s.message(`Uploading partial update: ${v}%`)},onSuccess(){m++,P({file_name:M,s3_path:Q,file_hash:$.hash})}}).start()})},E=500,g=[];for(let $=0;$<e.length;$+=E){let k=e.slice($,$+E),B=Math.floor($/E)+1,R=Math.ceil(e.length/E);R>1&&s.message(`Processing batch ${B}/${R} (${k.length} files)`);let N=await Promise.all(k.map(A=>C(A)));g.push(...N)}let S=((performance.now()-u)/1e3).toFixed(2);return s.stop(`Partial update uploaded successfully \u{1F4AA} in (${S} seconds)`),D>0&&f.info(`${D} of ${b} files were compressed with brotli and use .br extension`),await be(t,{channel:"app",event:`App Partial TUS done${D>0?" with .br extension":""}`,icon:"\u23EB",user_id:o,tags:{"app-id":n},notify:!1}),await be(t,{channel:"performance",event:"Partial upload performance",icon:"\u{1F684}",user_id:o,tags:{"app-id":n,time:S},notify:!1}),g}catch(C){let g=((performance.now()-u)/1e3).toFixed(2);if(s.stop(`Failed to upload Partial bundle (after ${g} seconds)`),l)throw f.error(`Error uploading partial update: ${C}`),f.error("Delta/partial upload was explicitly requested but failed. Upload aborted."),C;return f.info(`Error uploading partial update: ${C}, This is not a critical error, the bundle has been uploaded without the partial files`),null}}function ge(t){throw f.error(t),new Error(t)}async function YM(t,e){let r=_r("",e.packageJson),n=e.bundle||t?.plugins?.CapacitorUpdater?.version||r||`0.0.1-beta.${(0,yF.randomUUID)().split("-")[0]}`;return Yi.test(n)||ge(`Your bundle name ${n}, is not valid it should follow semver convention : https://semver.org/`),n}function JM(t){let e=t.apikey||ie();return e||ge("Missing API key, you need to provide an API key to upload your bundle"),e}function XM(t,e,r){let n=he(t,r),o=e.path||r?.webDir;return n||ge("Missing argument, you need to provide a appid or be in a capacitor project"),o||ge("Missing argument, you need to provide a path (--path), or be in a capacitor project"),(0,jo.existsSync)(o)||ge(`Path ${o} does not exist, build your app first, or provide a valid path`),{appid:n,path:o}}function ZM(t,e){let r=t.codeCheck;(typeof r>"u"||r)&&(Os(e,"notifyAppReady")||ge(`notifyAppReady() is missing in the build folder of your app. see: https://capgo.app/docs/plugin/api/#notifyappready
199
+ If you are sure your app has this code, you can use the --no-code-check option`),Hl(e)||ge(`index.html is missing in the root folder of ${e}`))}async function QM(t,e,r,n,o,i){let a=r.ignoreMetadataCheck,s=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",o).single(),p=!!c&&c.disable_auto_update==="version_number",d,h;if(!l&&c&&c.version&&c.version.native_packages&&!a){let D=ve();D.start(`Checking bundle compatibility with channel ${n}`);let{finalCompatibility:C,localDependencies:E}=await kl(t,o,n,r.packageJson,r.nodeModules);if(h=C,d=E,h.find(g=>!Fo(g)))D.stop(`Bundle NOT compatible with ${n} channel`),f.warn(`You can check compatibility with "${e.runner} @capgo/cli bundle compatibility"`),s&&(u=i,f.info(`Auto set min-update-version to ${u}`));else if(s)try{let{min_update_version:g}=c.version;(!g||!Yi.test(g))&&ge("Invalid remote min update version, skipping auto setting compatibility"),u=g,D.stop(`Auto set min-update-version to ${u}`)}catch{ge(`Cannot auto set compatibility, invalid data ${c}`)}else D.stop(`Bundle compatible with ${n} channel`)}else a||(f.warn(`Channel ${n} is new or it's your first upload with compatibility check, it will be ignored this time`),d=await pg(r.packageJson,r.nodeModules),s&&(u=i,f.info(`Auto set min-update-version to ${u}`)));p&&!u&&!a&&ge("You need to provide a min-update-version to upload a bundle to this channel"),u&&(Yi.test(u)||ge(`Your minimal version update ${u}, is not valid it should follow semver convention : https://semver.org/`));let m=d?new Map(d.filter(D=>!!D.native&&D.native!==void 0).map(D=>[D.name,D])):new Map;return{nativePackages:m.size>0||!r.ignoreMetadataCheck?Array.from(m,([D,C])=>({name:D,version:C.version})):void 0,minUpdateVersion:u}}async function e9(t,e,r,n=!1){let{data:o,error:i}=await t.rpc("exist_app_versions",{appid:e,name_version:r}).single();if(o||i){if(n)return f.warn(`Version ${r} already exists - exiting gracefully due to --silent-fail option`),J("Bundle version already exists - exiting gracefully \u{1F389}"),!0;ge(`Version ${r} already exists ${L(i)}`)}return!1}async function t9(t,e,r,n,o,i,a){let s,u,c="",l=null,p="none",d="",h=e.keyV2,m=e.key===!1,b=ve();b.start(`Zipping bundle from ${t}`),l=await Al(t),b.message("Calculating checksum");let D=yt((0,qg.cwd)()),C=await rn("@capgo/capacitor-updater",D,e.packageJson),E=!1,g;try{g=C?_e(C):void 0}catch{g=void 0}if(C?g?E=hn(g,_e("6.25.0")):(C==="link:@capgo/capacitor-updater"||C==="file:.."||C==="file:../")&&(f.warn("Using local @capgo/capacitor-updater. Assuming latest version for checksum calculation."),E=!0):ge("Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager"),(h||e.keyDataV2||(0,jo.existsSync)(Wt))&&!m||E?c=await Xr(l,"sha256"):c=await Xr(l,"crc32"),b.stop(`Checksum ${E?"SHA256":"CRC32"}: ${c}`),m)f.info("Encryption ignored");else if((h||(0,jo.existsSync)(Wt)||e.keyDataV2)&&!e.oldEncryption){let $=typeof h=="string"?h:Wt,k=e.keyDataV2||"";!k&&!(0,jo.existsSync)($)&&ge(`Cannot find private key ${$}`),await be(r,{channel:"app",event:"App encryption v2",icon:"\u{1F511}",user_id:n,tags:{"app-id":o},notify:!1},e.verbose),k||(k=(0,jo.readFileSync)($).toString()),f.info("Encrypting your bundle with V2");let{sessionKey:B,ivSessionKey:R}=jl(k),N=ra(l,B,R);c=na(c,k),s=R,u=B,p="v2",d=k,e.displayIvSession&&f.info(`Your Iv Session key is ${s},
199
200
  keep it safe, you will need it to decrypt your bundle.
200
201
  It will be also visible in your dashboard
201
- `),l=A}let S=Math.floor((l?.byteLength??0)/1024/1024),I=Math.floor(i/1024/1024);return l?.byteLength>i?me(`The bundle size is ${S} Mb, this is greater than the maximum upload length ${I} Mb, please reduce the size of your bundle`):l?.byteLength>a?(p.warn(`WARNING !!
202
- The bundle size is ${S} Mb, this may take a while to download for users
203
- `),p.info(`Learn how to optimize your assets https://capgo.app/blog/optimise-your-images-for-updates/
204
- `),e.verbose&&(p.info("[Verbose] Bundle size details:"),p.info(` - Actual size: ${S} MB (${l?.byteLength} bytes)`),p.info(` - Alert threshold: ${Math.floor(a/1024/1024)} MB`),p.info(` - Maximum allowed: ${I} MB`),p.info("[Verbose] Sending 'App Too Large' event to analytics...")),await be(r,{channel:"app-error",event:"App Too Large",icon:"\u{1F69B}",user_id:n,tags:{"app-id":o},notify:!1},e.verbose),e.verbose&&p.info("[Verbose] Event sent successfully")):e.verbose&&p.info(`[Verbose] Bundle size OK: ${S} MB (under ${Math.floor(a/1024/1024)} MB alert threshold)`),e.verbose&&p.info("[Verbose] Bundle preparation complete, returning bundle data"),{zipped:l,ivSessionKey:s,sessionKey:u,checksum:c,encryptionMethod:f,finalKeyData:d}}async function KM(t,e,r,n,o,i,a,s){let u=we();u.start("Uploading Bundle");let c=performance.now(),l=!1;if(a.verbose&&(p.info("[Verbose] uploadBundleToCapgoCloud called:"),p.info(` - Bundle size: ${Math.floor(i.byteLength/1024)} KB`),p.info(` - App ID: ${r}`),p.info(` - Bundle version: ${n}`),p.info(` - Chunk size: ${Math.floor(s/1024/1024)} MB`)),a.dryUpload){u.stop(`Dry run, bundle not uploaded
205
- Bundle uploaded \u{1F4AA} in 0 seconds`),a.verbose&&p.info("[Verbose] Dry upload mode - skipping actual upload");return}try{let h=await ir();if(a.verbose&&p.info("[Verbose] Local config retrieved for upload"),a.multipart!==void 0&&a.multipart||a.tus!==void 0&&a.tus){a.multipart?p.info("Uploading bundle with multipart is deprecated, we upload with TUS instead"):p.info("Uploading bundle with TUS protocol"),a.verbose&&(p.info("[Verbose] Starting TUS resumable upload..."),p.info(` - Host: ${h.hostWeb}`),p.info(` - Chunk size: ${Math.floor(s/1024/1024)} MB`)),await a2(t,i,o,r,n,u,h,s),l=!0,a.verbose&&p.info("[Verbose] TUS upload completed, updating database with R2 path...");let m=`orgs/${o}/apps/${r}/${n}.zip`,{error:b}=await e.from("app_versions").update({r2_path:m}).eq("name",n).eq("app_id",r);if(b)return p.error(`Cannot finish TUS upload ${U(b)}`),a.verbose&&p.info(`[Verbose] Database update failed: ${U(b)}`),Promise.reject(new Error("Cannot finish TUS upload"));a.verbose&&p.info(`[Verbose] Database updated with R2 path: ${m}`)}else{a.verbose&&p.info("[Verbose] Using standard upload (non-TUS), getting presigned URL...");let m=await n2(e,r,n);if(!m)return p.error("Cannot get upload url"),a.verbose&&p.info("[Verbose] Failed to retrieve presigned upload URL from database"),Promise.reject(new Error("Cannot get upload url"));a.verbose&&(p.info("[Verbose] Presigned URL obtained, uploading via HTTP PUT..."),p.info(` - Timeout: ${a.timeout||ng}ms`),p.info(" - Retry attempts: 5"),p.info(" - Content-Type: application/zip"));let b=new AbortController,D=setTimeout(()=>b.abort(),a.timeout||ng);try{let C=await fetch(m,{method:"PUT",body:i,headers:{"Content-Type":"application/zip"},signal:b.signal});if(!C.ok)throw new Error(`HTTP error! status: ${C.status}`)}finally{clearTimeout(D)}a.verbose&&p.info("[Verbose] HTTP PUT upload completed successfully")}}catch(h){let b=((performance.now()-c)/1e3).toFixed(2);if(u.stop(`Failed to upload bundle ( after ${b} seconds)`),a.verbose&&(p.info(`[Verbose] Upload failed after ${b} seconds`),p.info(`[Verbose] Error type: ${h instanceof Error?"Error":typeof h}`)),h instanceof Error&&h.message.includes("HTTP error"))try{let D=h.message.match(/status: (\d+)/),C=D?D[1]:"unknown";p.error(`Upload failed with status ${C}: ${h.message}`)}catch{p.error(`Upload failed: ${h.message}`)}else a.verbose&&p.info(`[Verbose] Non-HTTP error: ${U(h)}`),a.tus?p.error(`Cannot upload bundle please contact support if the issue persists ${U(h)}`):p.error(`Cannot upload bundle ( try again with --tus option) ${U(h)}`);throw a.verbose&&p.info("[Verbose] Cleaning up failed version from database..."),await s2(e,r,n),a.verbose&&p.info("[Verbose] Failed version cleaned up"),h instanceof Error?h:new Error(String(h))}let d=((performance.now()-c)/1e3).toFixed(2);u.stop(`Bundle uploaded \u{1F4AA} in (${d} seconds)`),a.verbose&&(p.info("[Verbose] Upload successful:"),p.info(` - Upload time: ${d} seconds`),p.info(` - Upload method: ${l?"TUS (resumable)":"Standard HTTP PUT"}`),p.info(` - Bundle size: ${Math.floor(i.byteLength/1024)} KB`),p.info("[Verbose] Sending performance event...")),await be(t,{channel:"performance",event:l?"TUS upload zip performance":"Upload zip performance",icon:"\u{1F684}",user_id:o,tags:{"app-id":r,time:d},notify:!1},a.verbose),a.verbose&&p.info("[Verbose] Performance event sent successfully")}async function YM(t,e,r){let{data:n,error:o}=await t.from("channels").select("version ( id, name, deleted )").eq("app_id",e).eq("name",r);if(o){p.error(`Cannot delete linked bundle on upload ${U(o)}`);return}if(n.length===0){p.warn("No linked bundle found in the channel you are trying to upload to");return}let i=n[0].version;if(i.deleted){p.warn("The linked bundle is already deleted");return}let{error:a}=await t.from("app_versions").update({deleted:!0}).eq("id",i.id);if(a){p.error(`Cannot delete linked bundle on upload ${U(a)}`);return}p.info("Linked bundle deleted")}async function JM(t,e,r,n,o,i,a,s,u,c){let{data:l}=await t.rpc("get_app_versions",{apikey:e,name_version:n,appid:s}).single();l||me("Cannot get version id, cannot set channel");let{data:f}=await t.rpc("is_allowed_capgkey",{apikey:e,keymode:["write","all"]}).single();if(f){let{error:d,data:h}=await Sl(t,{name:o,app_id:s,created_by:i,version:l,owner_org:a,...c?{allow_device_self_set:!0}:{}});d&&me(`Cannot set channel, the upload key is not allowed to do that, use the "all" for this. ${U(d)}`);let m=`${u.hostWeb}/app/p/${s}/channel/${h.id}`;h?.public?p.info("Your update is now available in your public channel \u{1F389}"):h?.id&&p.info(`Link device to this bundle to try it: ${m}`),r&&p.info(`Bundle url: ${m}`)}else p.warn("The upload key is not allowed to set the version in the channel")}async function XM(t,e,r){let{error:n,data:o}=await e.from("apps").select("default_upload_channel").eq("app_id",t).single();return n?(p.warn("Cannot find default upload channel"),p.info(`You can set it here: ${r}/app/p/${t}/settings`),null):o.default_upload_channel}async function Ug(t,e,r=!1){r||Z(`Uploading with CLI version ${mr.version}`);let n,o=Qe();await de();let{s3Region:i,s3Apikey:a,s3Apisecret:s,s3BucketName:u,s3Endpoint:c,s3Port:l,s3SSL:f}=e;e.verbose&&(p.info("[Verbose] Starting upload process with options:"),p.info(` - API key: ${e.apikey?"provided":"from saved key"}`),p.info(` - Path: ${e.path||"from capacitor config"}`),p.info(` - Channel: ${e.channel||"from default upload channel"}`),p.info(` - Bundle: ${e.bundle||"auto-detected"}`),p.info(` - External: ${e.external||"false"}`),p.info(` - Encryption: ${e.keyV2||e.keyDataV2?"v2":e.key===!1?"disabled":"auto"}`),p.info(` - Upload method: ${e.tus?"TUS":e.zip?"ZIP":"auto"}`),p.info(` - Delta updates: ${e.delta||e.partial?"enabled":"disabled"}`));let d=MM(e);e.verbose&&p.info("[Verbose] API key retrieved successfully");let h=await te();e.verbose&&p.info("[Verbose] Capacitor config loaded successfully");let m=await K1();e.verbose&&(p.info("[Verbose] Remote file config retrieved:"),p.info(` - Max upload length: ${Math.floor(m.maxUploadLength/1024/1024)} MB`),p.info(` - Alert upload size: ${Math.floor(m.alertUploadSize/1024/1024)} MB`),p.info(` - TUS upload: ${m.TUSUpload?"enabled":"disabled"}`),p.info(` - TUS upload forced: ${m.TUSUploadForced?"yes":"no"}`),p.info(` - Partial upload: ${m.partialUpload?"enabled":"disabled"}`),p.info(` - Max chunk size: ${Math.floor(m.maxChunkSize/1024/1024)} MB`));let{appid:b,path:D}=qM(t,e,h.config);e.verbose&&p.info(`[Verbose] App ID: ${b}, Build path: ${D}`);let C=await UM(h.config,e);e.verbose&&p.info(`[Verbose] Bundle version: ${C}`);let E=e.external?"external":"r2-direct",g="none";e.autoSetBundle&&(await bs({version:C}),e.verbose&&p.info("[Verbose] Auto-set bundle version in capacitor.config.json")),HM(e,D),e.verbose&&p.info("[Verbose] Code check passed (notifyAppReady found and index.html present)"),p.info(`Upload ${b}@${C} started from path "${D}" to Capgo cloud`);let _=await ir();e.verbose&&p.info(`[Verbose] Local config loaded: host=${_.hostWeb}`),e.supaHost&&e.supaAnon&&(p.info("Using custom supabase instance from provided options"),_.supaHost=e.supaHost,_.supaKey=e.supaAnon,e.verbose&&p.info(`[Verbose] Custom Supabase host: ${e.supaHost}`));let S=await ne(d,e.supaHost,e.supaAnon);e.verbose&&p.info("[Verbose] Supabase client created successfully");let I=await oe(S,d,["write","all","upload"]);e.verbose&&p.info(`[Verbose] User verified successfully, user_id: ${I}`);let O=e.channel||await XM(b,S,_.hostWeb)||"dev";e.verbose&&p.info(`[Verbose] Target channel: ${O}`);let B=await ar(S,b);e.verbose&&p.info(`[Verbose] Organization ID: ${B}`),await Z1(S,B,mr.version),e.verbose&&p.info("[Verbose] Remote CLI messages checked"),await e2(S,B,d,b,!0),e.verbose&&p.info("[Verbose] Plan validation passed"),await zM(S,B,_),e.verbose&&p.info("[Verbose] Trial check completed"),e.verbose&&p.info(`[Verbose] Checking compatibility with channel ${O}...`);let{nativePackages:R,minUpdateVersion:N}=await VM(S,o,e,O,b,C);e.verbose&&(p.info("[Verbose] Compatibility check completed:"),p.info(` - Native packages: ${R?R.length:0}`),p.info(` - Min update version: ${N||"none"}`)),e.verbose&&p.info(`[Verbose] Checking if version ${C} already exists...`);let A=await GM(S,b,C,e.versionExistsOk);if(e.verbose&&p.info(`[Verbose] Version exists check: ${A?"yes (skipping)":"no (continuing)"}`),A)return{success:!0,skipped:!0,reason:"VERSION_EXISTS",bundle:C,checksum:null,encryptionMethod:g,storageProvider:E};e.external&&!e.external.startsWith("https://")&&me(`External link should should start with "https://" current is "${e.external}"`),e.deleteLinkedBundleOnUpload&&(p.warn("Deleting linked bundle on upload is destructive, it will delete the currently linked bundle in the channel you are trying to upload to."),p.warn("Please make sure you want to do this, if you are not sure, please do not use this option."));let L={name:C,app_id:b,session_key:void 0,external_url:e.external,storage_provider:E,min_update_version:N,native_packages:R,owner_org:B,user_id:I,checksum:void 0,link:e.link||null,comment:e.comment||null},q=null,Q="";if(e.external)e.verbose&&p.info(`[Verbose] Using external URL: ${e.external}`),await be(d,{channel:"app",event:"App external",icon:"\u{1F4E4}",user_id:B,tags:{"app-id":b},notify:!1},e.verbose),L.session_key=e.ivSessionKey,L.checksum=e.encryptedChecksum,e.verbose&&(p.info("[Verbose] External bundle configured:"),p.info(` - URL: ${e.external}`),p.info(` - IV Session Key: ${e.ivSessionKey?"provided":"none"}`),p.info(` - Encrypted Checksum: ${e.encryptedChecksum?"provided":"none"}`));else{e.verbose&&p.info(`[Verbose] Preparing bundle file from path: ${D}`);let{zipped:F,ivSessionKey:T,checksum:k,sessionKey:M,encryptionMethod:P,finalKeyData:j}=await WM(D,e,d,B,b,m.maxUploadLength,m.alertUploadSize);L.session_key=T,L.checksum=k,n=M,q=F,g=P,Q=j,e.verbose&&(p.info("[Verbose] Bundle prepared:"),p.info(` - Size: ${Math.floor((F?.byteLength??0)/1024)} KB`),p.info(` - Checksum: ${k}`),p.info(` - Encryption: ${P}`),p.info(` - IV Session Key: ${T?"present":"none"}`)),e.ignoreChecksumCheck||(e.verbose&&p.info("[Verbose] Checking for duplicate checksum..."),await l2(S,b,O,k),e.verbose&&p.info("[Verbose] Checksum is unique"))}if(e.zip?(e.tus=!1,e.verbose&&p.info("[Verbose] Upload method: ZIP (explicitly set via --zip)")):!m.TUSUpload||e.external?(e.tus=!1,e.verbose&&p.info("[Verbose] Upload method: Standard (TUS not available or external URL)")):(e.tus=e.tus||m.TUSUploadForced,e.verbose&&p.info(`[Verbose] Upload method: ${e.tus?"TUS (resumable)":"Standard"}`)),!m.partialUpload||e.external?(e.delta=!1,e.verbose&&e.external&&p.info("[Verbose] Delta updates disabled (not available with external URLs)")):(e.delta=e.delta||e.partial||e.deltaOnly||e.partialOnly||m.partialUploadForced,e.verbose&&p.info(`[Verbose] Delta updates: ${e.delta?"enabled":"disabled"}`)),e.encryptPartial&&g==="v1"&&me("You cannot encrypt the partial update if you are not using the v2 encryption method"),e.delta&&g==="v2"&&!e.encryptPartial){let F=(0,Ng.join)(vt((0,Lg.cwd)()),bt),k=(await ft(void 0,e.packageJson||F)).get("@capgo/capacitor-updater"),M;try{M=k?_e(k):void 0}catch{M=void 0}k&&M&&dn(M,_e("6.14.4"))&&(p.info(`Auto-enabling partial update encryption for updater version ${M} (> 6.14.4)`),e.verbose&&p.info("[Verbose] Partial encryption auto-enabled for updater >= 6.14.4"),e.encryptPartial=!0)}e.verbose&&e.delta&&p.info("[Verbose] Preparing delta/partial update manifest...");let $=e.delta?await fF(D,d,B,b,e.encryptPartial?g:"none",Q):[];e.verbose&&e.delta&&p.info(`[Verbose] Delta manifest prepared with ${$.length} files`),e.verbose&&p.info("[Verbose] Creating version record in database...");let{error:y}=await ug(S,L);if(y&&me(`Cannot add bundle ${U(y)}`),e.verbose&&p.info("[Verbose] Version record created successfully"),e.tusChunkSize&&e.tusChunkSize>m.maxChunkSize?(p.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&&p.info(`[Verbose] TUS chunk size: ${Math.floor(e.tusChunkSize/1024/1024)} MB`),q&&(u||c||i||a||s||l||f)){(!u||!c||!i||!a||!s||!l)&&me("Missing argument, for S3 upload you need to provide a bucket name, endpoint, region, port, API key, and API secret"),p.info("Uploading to S3"),e.verbose&&(p.info("[Verbose] S3 configuration:"),p.info(` - Endpoint: ${c}`),p.info(` - Region: ${i}`),p.info(` - Bucket: ${u}`),p.info(` - Port: ${l}`),p.info(` - SSL: ${f?"enabled":"disabled"}`));let F=f?`https://${c}`:`http://${c}`,T=new xs({endPoint:c,region:i,port:l,pathStyle:!0,bucket:u,accessKey:a,secretKey:s}),k=`${b}-${C}`,M=encodeURIComponent(k);e.verbose&&p.info(`[Verbose] Uploading to S3 as: ${k}`),await T.putObject(k,Uint8Array.from(q)),L.external_url=`${F}/${M}`,L.storage_provider="external",e.verbose&&p.info(`[Verbose] S3 upload complete, external URL: ${L.external_url}`)}else if(q){!e.partialOnly&&!e.deltaOnly?(e.verbose&&p.info("[Verbose] Starting full bundle upload to Capgo Cloud..."),await KM(d,S,b,C,B,q,e,e.tusChunkSize)):e.verbose&&p.info("[Verbose] Skipping full bundle upload (delta-only mode)");let F=null;try{e.dryUpload&&(e.delta=!1,e.verbose&&p.info("[Verbose] Dry upload mode: skipping delta upload"));let k=L.session_key&&e.encryptPartial&&n?{sessionKey:n,ivSessionKey:L.session_key}:void 0;e.verbose&&e.delta&&(p.info("[Verbose] Starting delta/partial file upload..."),p.info(` - Manifest entries: ${$.length}`),p.info(` - Encryption: ${k?"enabled":"disabled"}`)),F=e.delta?await pF(d,$,D,b,B,k,e):null,e.verbose&&F&&p.info(`[Verbose] Delta upload complete with ${F.length} files`)}catch(k){if(!!(e.partial||e.delta||e.partialOnly||e.deltaOnly))throw k;p.info(`Failed to upload partial files to capgo cloud. Error: ${U(k)}. This is not a critical error, the bundle has been uploaded without the partial files`),e.verbose&&p.info(`[Verbose] Delta upload error details: ${U(k)}`)}L.storage_provider="r2",L.manifest=F,e.verbose&&p.info("[Verbose] Updating version record with storage provider and manifest...");let{error:T}=await ug(S,L);T&&me(`Cannot update bundle ${U(T)}`),e.verbose&&p.info("[Verbose] Version record updated successfully")}e.verbose&&p.info("[Verbose] Checking app permissions...");let v=await Ne(S,d,b,2);e.verbose&&(p.info("[Verbose] Permissions:"),p.info(` - Upload: ${Wi(v,2)?"yes":"no"}`),p.info(` - Write: ${Wi(v,3)?"yes":"no"}`),p.info(` - Admin: ${Wi(v,4)?"yes":"no"}`)),e.deleteLinkedBundleOnUpload&&Wi(v,3)?(e.verbose&&p.info(`[Verbose] Deleting linked bundle in channel ${O}...`),await YM(S,b,O)):e.deleteLinkedBundleOnUpload&&p.warn("Cannot delete linked bundle on upload as a upload organization member"),Wi(v,3)?(e.verbose&&p.info(`[Verbose] Setting bundle ${C} to channel ${O}...`),await JM(S,d,!!e.bundleUrl,C,O,I,B,b,_,e.selfAssign),e.verbose&&p.info("[Verbose] Channel updated successfully")):p.warn("Cannot set channel as a upload organization member"),e.verbose&&p.info("[Verbose] Sending upload event..."),await be(d,{channel:"app",event:"App Uploaded",icon:"\u23EB",user_id:B,tags:{"app-id":b},notify:!1},e.verbose);let w={success:!0,bundle:C,checksum:L.checksum??null,encryptionMethod:g,sessionKey:n?n.toString("base64"):void 0,ivSessionKey:typeof L.session_key=="string"?L.session_key:void 0,storageProvider:L.storage_provider};return e.verbose&&(p.info("[Verbose] Upload completed successfully:"),p.info(` - Bundle: ${w.bundle}`),p.info(` - Checksum: ${w.checksum}`),p.info(` - Encryption: ${w.encryptionMethod}`),p.info(` - Storage: ${w.storageProvider}`)),r&&!w.skipped&&J("Time to share your update to the world \u{1F30D}"),w}function ZM(t){t.ivSessionKey&&!t.external&&me("You need to provide an external url if you want to use the --iv-session-key option"),t.encryptedChecksum&&!t.external&&me("You need to provide an external url if you want to use the --encrypted-checksum option"),(t.partial||t.delta||t.partialOnly||t.deltaOnly)&&t.external&&me("You cannot use the --partial/--delta/--partial-only/--delta-only option with an external url"),t.tus&&t.external&&me("You cannot use the --tus option with an external url"),t.dryUpload&&t.external&&me("You cannot use the --dry-upload option with an external url"),t.multipart&&t.external&&me("You cannot use the --multipart option with an external url"),t.external&&(t.keyV2||t.keyDataV2)&&me("You cannot set a key if you are uploading to an external url"),t.keyV2&&t.keyDataV2&&me("You cannot set both key-v2 and key-data-v2"),t.external&&(t.s3Region||t.s3Apikey||t.s3Apisecret||t.s3Endpoint||t.s3BucketName||t.s3Port||t.s3SSL)&&me("You cannot set S3 options if you are uploading to an external url, it's automatically handled"),t.encryptedChecksum&&!t.external&&me("You cannot set the --encrypted-checksum option if you are not uploading to an external url"),t.minUpdateVersion&&t.autoMinUpdateVersion&&me("You cannot set both min-update-version and auto-min-update-version, use only one of them")}async function hF(t,e){try{ZM(e),await Ug(t,e)}catch(r){throw p.error(`uploadBundle failed: ${U(r)}`),r instanceof Error?r:new Error(String(r))}}var mF=require("node:crypto"),Yl=require("node:fs"),gF=require("node:path"),DF=require("node:process");var QM=20;function e9(t){console.log(JSON.stringify(t,null,2))}function $s(t){console.error(U(t))}async function t9(t,e,r=!1){let{json:n}=e,{bundle:o,path:i}=e,a=!n&&!r;try{a&&await de();let s=await te(),u=he(t,s?.config),c=(0,mF.randomUUID)().split("-")[0],l=xr("",e.packageJson);if(o=o||l||`0.0.1-beta.${c}`,a&&Z(`Zipping ${u}@${o}`),o&&!Gi.test(o)){let O=`Your bundle name ${o}, is not valid it should follow semver convention : https://semver.org/`;throw r||(n?$s({error:"invalid_semver"}):p.error(O)),new Error("Invalid bundle version format")}if(i=i||s?.config?.webDir,!u||!o||!i){let O="Missing argument, you need to provide a appId and a bundle and a path, or be in a capacitor project";throw r||(n?$s({error:"missing_argument"}):p.error(O)),new Error(O)}if(a&&p.info(`Started from path "${i}"`),typeof e.codeCheck>"u"?!0:e.codeCheck){if(!Ss(i,"notifyAppReady"))throw r||(n?$s({error:"notifyAppReady_not_in_source_code"}):p.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(!Ul(i))throw r||(n?$s({error:"index_html_not_found"}):p.error(`index.html is missing in the root folder of ${i}`)),new Error("index.html is missing in root folder")}let d=await xl(i);a&&p.info(`Zipped ${d.byteLength} bytes`);let h=a?we():null;h&&h.start("Calculating checksum");let m=(0,gF.join)(vt((0,DF.cwd)()),bt),D=(await ft(void 0,e.packageJson||m)).get("@capgo/capacitor-updater");if(!D){let O="Cannot find @capgo/capacitor-updater in ./package.json, provide the package.json path with --package-json it's required for v7 CLI to work";throw r||p.warn(O),new Error(O)}let C=!1,E;try{E=D?_e(D):void 0}catch{E=void 0}if(E){let O=E.major===6&&dn(E,_e("6.25.0")),B=E.major>=7;C=O||B}else D==="link:@capgo/capacitor-updater"&&(r||p.warn("Using local @capgo/capacitor-updater. Assuming v7"),C=!0);let g=await Xr(d,e.keyV2||(0,Yl.existsSync)(Wt)||C?"sha256":"crc32");h&&h.stop(`Checksum ${C?"SHA256":"CRC32"}: ${g}`);let _=Math.floor(d.byteLength/1024/1024);_>QM&&a&&(p.warn(`WARNING !!
202
+ `),l=N}let _=Math.floor((l?.byteLength??0)/1024/1024),S=Math.floor(i/1024/1024);return l?.byteLength>i?ge(`The bundle size is ${_} Mb, this is greater than the maximum upload length ${S} Mb, please reduce the size of your bundle`):l?.byteLength>a?(f.warn(`WARNING !!
206
203
  The bundle size is ${_} Mb, this may take a while to download for users
207
- `),p.warn(`Learn how to optimize your assets https://capgo.app/blog/optimise-your-images-for-updates/
208
- `));let S=a?we():null,I=e.name||`${u}_${o}.zip`;return S&&S.start(`Saving to ${I}`),(0,Yl.writeFileSync)(I,d),S&&S.stop(`Saved to ${I}`),a&&J("Done \u2705"),!r&&n&&e9({bundle:o,filename:I,checksum:g}),{bundle:o,filename:I,checksum:g}}catch(s){throw r||(n?$s(s):p.error(U(s))),s instanceof Error?s:new Error(String(s))}}async function yF(t,e){await t9(t,e,!1)}async function Mg(t,e,r,n=!1){n||Z("Create channel"),r.apikey=r.apikey||ie();let o=await te().catch(()=>{});if(e=he(e,o?.config),!r.apikey)throw n||p.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||p.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let i=await ne(r.apikey,r.supaHost,r.supaAnon);await oe(i,r.apikey,["write","all"]),await Ne(i,r.apikey,e,4,n),n||p.info(`Creating channel ${e}#${t} to Capgo`);let a=await pg(i,e);if(!a)throw n||p.error("Cannot find default version for channel creation, please contact Capgo support \u{1F928}"),new Error("Cannot find default version for channel creation");let s=await ar(i,e),u=await oe(i,r.apikey,["write","all"]),c=await C2(i,{name:t,app_id:e,version:a.id,created_by:u,owner_org:s,allow_device_self_set:r.selfAssign??!1,public:r.default??!1});if(c.error)throw n||p.error(`Cannot create Channel \u{1F640}
209
- ${U(c.error)}`),new Error(`Cannot create channel: ${U(c.error)}`);return await be(r.apikey,{channel:"channel",event:"Create channel",icon:"\u2705",user_id:s,tags:{"app-id":e,channel:t},notify:!1}).catch(()=>{}),n||(p.success("Channel created \u2705"),J("Done \u2705")),c.data??!0}async function bF(t,e,r){await Mg(t,e,r,!1)}async function r9(t,e,r,n=!1){let{quiet:o}=r;!o&&!n&&Z("List current bundle"),r.apikey=r.apikey||ie(o);let i=await te();if(e=he(e,i?.config),!r.apikey)throw n||p.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||p.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let a=await ne(r.apikey,r.supaHost,r.supaAnon);if(await oe(a,r.apikey,["write","all","read"]),await Ne(a,r.apikey,e,1,n),!t)throw n||p.error("Please provide a channel to get the bundle from."),new Error("Channel name missing");let{data:s,error:u}=await a.from("channels").select("version ( name )").eq("name",t).eq("app_id",e).limit(1);if(u||!s?.length)throw n||p.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}=s[0];if(!c)throw n||p.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||(o?p.info(c.name):p.info(`Current bundle for channel ${t} is ${c.name}`)),c.name}async function vF(t,e,r){return r9(t,e,r)}async function n9(t,e,r,n=!1){n||Z("Delete channel"),r.apikey=r.apikey||ie();let o=await te();if(e=he(e,o?.config),!r.apikey)throw n||p.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||p.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let i=await ne(r.apikey,r.supaHost,r.supaAnon),a=await oe(i,r.apikey,["all"]);if(await Ne(i,r.apikey,e,4,n),r.deleteBundle&&!n&&p.info(`Deleting bundle ${e}#${t} from Capgo`),r.deleteBundle){let d=await S2(i,e,t);d?.name&&!n&&p.info(`Deleting bundle ${d.name} from Capgo`),d?.name&&await dg(i,e,d.name)}let{data:s,error:u}=await _2(i,e,t);if(u||!s){if(n||p.error(`Channel ${t} not found`),r.successIfNotFound)return n||p.success(`Channel ${t} not found and successIfNotFound is true`),!0;throw new Error(`Channel ${t} not found`)}let{error:c}=await x2(i,e,s.id);if(c)throw n||p.error(`Cannot delete channel devices: ${U(c)}`),new Error(`Cannot delete channel devices: ${U(c)}`);n||p.info(`Deleting channel ${e}#${t} from Capgo`);let l=await E2(i,t,e,a);if(l.error)throw n||p.error(`Cannot delete Channel \u{1F640} ${U(l.error)}`),new Error(`Cannot delete channel: ${U(l.error)}`);let f=await ar(i,e);return await be(r.apikey,{channel:"channel",event:"Delete channel",icon:"\u2705",user_id:f,tags:{"app-id":e,channel:t},notify:!1}).catch(()=>{}),n||(p.success("Channel deleted"),J("Done \u2705")),!0}async function wF(t,e,r){return n9(t,e,r,!1)}async function o9(t,e,r=!1){r||Z("List channels"),e.apikey=e.apikey||ie();let n=await te();if(t=he(t,n?.config),!e.apikey)throw r||p.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||p.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let o=await ne(e.apikey,e.supaHost,e.supaAnon),i=await oe(o,e.apikey,["write","all","read","upload"]);await Ne(o,e.apikey,t,1,r),r||p.info("Querying available channels in Capgo");let a=await A2(o,t);return r||(p.info(`Active channels in Capgo: ${a?.length??0}`),F2(a)),await be(e.apikey,{channel:"channel",event:"List channel",icon:"\u2705",user_id:i,tags:{"app-id":t},notify:!1}).catch(()=>{}),r||J("Done \u2705"),a}async function CF(t,e){return o9(t,e,!1)}var EF=["major","minor","metadata","patch","none"];async function i9(t,e,r,n=!1){n||Z("Set channel"),r.apikey=r.apikey||ie();let o=await te();if(e=he(e,o?.config),!r.apikey)throw n||p.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||p.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||p.error("Missing argument, you need to provide a channel"),new Error("Missing channel id");let i=await ne(r.apikey,r.supaHost,r.supaAnon),a=await oe(i,r.apikey,["write","all"]);await Ne(i,r.apikey,e,4,n);let s=await ar(i,e),{bundle:u,state:c,downgrade:l,latest:f,latestRemote:d,ios:h,android:m,selfAssign:b,disableAutoUpdate:D,dev:C,emulator:E}=r;if(f&&u)throw n||p.error("Cannot set latest and bundle at the same time"),new Error("Cannot set both latest and bundle simultaneously");if(d&&u)throw n||p.error("Cannot set latest remote and bundle at the same time"),new Error("Cannot set both latest remote and bundle simultaneously");if(d&&f)throw n||p.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&&f==null&&d==null&&l==null&&h==null&&m==null&&b==null&&C==null&&E==null&&D==null)throw n||p.error("Missing argument, you need to provide a option to set"),new Error("No channel option provided");await Q1(i,s,r.apikey,e);let g={created_by:a,app_id:e,name:t,owner_org:s,version:void 0},{error:_}=await i.from("channels").select().eq("app_id",e).eq("name",t).single();if(_)throw n||p.error(`Cannot find channel ${t}`),new Error(`Cannot find channel ${t}`);let S=f?o?.config?.plugins?.CapacitorUpdater?.version||xr("",r.packageJson):u;if(S!=null){let{data:O,error:B}=await i.from("app_versions").select().eq("app_id",e).eq("name",S).eq("user_id",a).eq("deleted",!1).single();if(B||!O)throw n||p.error(`Cannot find version ${S}`),new Error(`Cannot find version ${S}`);if(!r.ignoreMetadataCheck){let{finalCompatibility:R,localDependencies:N}=await lg(i,e,t,O.native_packages??[]),A=Qe();if(N.length>0&&R.some(L=>!So(L)))throw n||(p.warn(`Bundle NOT compatible with ${t} channel`),p.warn(`You can check compatibility with "${A.runner} @capgo/cli bundle compatibility"`)),new Error(`Bundle is not compatible with ${t} channel`);n||(N.length===0&&R.length>0?p.info(`Ignoring check compatibility with ${t} channel because the bundle does not contain any native packages`):p.info(`Bundle is compatible with ${t} channel`))}n||p.info(`Set ${e} channel: ${t} to @${S}`),g.version=O.id}if(d){let{data:O,error:B}=await i.from("app_versions").select().eq("app_id",e).eq("user_id",a).eq("deleted",!1).order("created_at",{ascending:!1}).single();if(B||!O)throw n||p.error("Cannot find latest remote version"),new Error("Cannot find latest remote version");if(!r.ignoreMetadataCheck){let{finalCompatibility:R}=await lg(i,e,t,O.native_packages??[]),N=Qe();if(R.some(A=>!So(A)))throw n||(p.warn(`Bundle NOT compatible with ${t} channel`),p.warn(`You can check compatibility with "${N.runner} @capgo/cli bundle compatibility"`)),new Error(`Latest remote bundle is not compatible with ${t} channel`)}n||p.info(`Set ${e} channel: ${t} to @${O.name}`),g.version=O.id}if(c!=null){if(c!=="normal"&&c!=="default")throw n||p.error(`State ${c} is not known. The possible values are: normal, default.`),new Error(`Unknown state ${c}. Expected normal or default`);n||p.info(`Set ${e} channel: ${t} to ${c}`),g.public=c==="default"}if(l!=null&&(n||p.info(`Set ${e} channel: ${t} to ${l?"allow":"disallow"} downgrade`),g.disable_auto_update_under_native=!l),h!=null&&(n||p.info(`Set ${e} channel: ${t} to ${h?"allow":"disallow"} ios update`),g.ios=!!h),m!=null&&(n||p.info(`Set ${e} channel: ${t} to ${m?"allow":"disallow"} android update`),g.android=!!m),b!=null&&(n||p.info(`Set ${e} channel: ${t} to ${b?"allow":"disallow"} self assign to this channel`),g.allow_device_self_set=!!b),C!=null&&(n||p.info(`Set ${e} channel: ${t} to ${C?"allow":"disallow"} dev devices`),g.allow_dev=!!C),E!=null&&(n||p.info(`Set ${e} channel: ${t} to ${E?"allow":"disallow"} emulator devices`),g.allow_emulator=!!E),D!=null){let O=D.toLowerCase();if(!EF.includes(O))throw n||p.error(`Channel strategy ${O} is not known. The possible values are: ${EF.join(", ")}.`),new Error(`Unknown channel strategy ${O}`);O==="metadata"&&(O="version_number"),g.disable_auto_update=O,n||p.info(`Set ${e} channel: ${t} to ${O} disable update strategy to this channel`)}let{error:I}=await Sl(i,g);if(I)throw n||p.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 be(r.apikey,{channel:"channel",event:"Set channel",icon:"\u2705",user_id:s,tags:{"app-id":e},notify:!1}).catch(()=>{}),n||J("Done \u2705"),!0}async function _F(t,e,r){return i9(t,e,r,!1)}var Ur=require("node:fs");function qg(t){let e="\u{1F539}";return t.includes("upload")?e="\u2B06\uFE0F":t.includes("delete")?e="\u{1F5D1}\uFE0F":t.includes("list")?e="\u{1F4CB}":t.includes("add")?e="\u2795":t.includes("set")?e="\u2699\uFE0F":t.includes("create")?e="\u{1F528}":t.includes("encrypt")?e="\u{1F512}":t.includes("decrypt")?e="\u{1F513}":t.includes("debug")?e="\u{1F41E}":t.includes("doctor")?e="\u{1F468}\u200D\u2695\uFE0F":t.includes("login")?e="\u{1F511}":t.includes("init")?e="\u{1F680}":t.includes("compatibility")?e="\u{1F9EA}":t.includes("cleanup")?e="\u{1F9F9}":t.includes("currentBundle")?e="\u{1F4E6}":t.includes("setting")?e="\u2699\uFE0F":t==="app"?e="\u{1F4F1}":t==="bundle"?e="\u{1F4E6}":t==="channel"?e="\u{1F4E2}":t==="key"?e="\u{1F510}":t==="account"&&(e="\u{1F464}"),e}function xF(t="./README.md",e){let r=pt.commands.map(o=>{let i=o,a=i._actionHandler!==null&&i._actionHandler!==void 0,u=o.commands&&o.commands.length>0&&!a;return{name:o.name(),alias:o.alias()||"",description:o.description(),options:o.options.map(c=>({flags:c.flags,description:c.description||""})),subcommands:o.commands?o.commands.map(c=>{let l=c,f=l._actionHandler!==null&&l._actionHandler!==void 0;return{name:c.name(),alias:c.alias()||"",description:c.description(),options:c.options.map(d=>({flags:d.flags,description:d.description||""})),subcommands:[],hasAction:f,isCommandGroup:!1}}):[],hasAction:a,isCommandGroup:u}}),n=(o,i=!1,a,s=!1)=>{let u=o.name,c=u.charAt(0).toUpperCase()+u.slice(1),l;i?l=a?`${a}-${u}`:u:l=s?"options":u;let f=i?"###":"##",d="",h=qg(u);s&&!i||(d+=`${f} <a id="${l}"></a> ${h} **${c}**
204
+ `),f.info(`Learn how to optimize your assets https://capgo.app/blog/optimise-your-images-for-updates/
205
+ `),e.verbose&&(f.info("[Verbose] Bundle size details:"),f.info(` - Actual size: ${_} MB (${l?.byteLength} bytes)`),f.info(` - Alert threshold: ${Math.floor(a/1024/1024)} MB`),f.info(` - Maximum allowed: ${S} MB`),f.info("[Verbose] Sending 'App Too Large' event to analytics...")),await be(r,{channel:"app-error",event:"App Too Large",icon:"\u{1F69B}",user_id:n,tags:{"app-id":o},notify:!1},e.verbose),e.verbose&&f.info("[Verbose] Event sent successfully")):e.verbose&&f.info(`[Verbose] Bundle size OK: ${_} MB (under ${Math.floor(a/1024/1024)} MB alert threshold)`),e.verbose&&f.info("[Verbose] Bundle preparation complete, returning bundle data"),{zipped:l,ivSessionKey:s,sessionKey:u,checksum:c,encryptionMethod:p,finalKeyData:d}}async function r9(t,e,r,n,o,i,a,s){let u=ve();u.start("Uploading Bundle");let c=performance.now(),l=!1;if(a.verbose&&(f.info("[Verbose] uploadBundleToCapgoCloud called:"),f.info(` - Bundle size: ${Math.floor(i.byteLength/1024)} KB`),f.info(` - App ID: ${r}`),f.info(` - Bundle version: ${n}`),f.info(` - Chunk size: ${Math.floor(s/1024/1024)} MB`)),a.dryUpload){u.stop(`Dry run, bundle not uploaded
206
+ Bundle uploaded \u{1F4AA} in 0 seconds`),a.verbose&&f.info("[Verbose] Dry upload mode - skipping actual upload");return}try{let h=await ir();if(a.verbose&&f.info("[Verbose] Local config retrieved for upload"),a.multipart!==void 0&&a.multipart||a.tus!==void 0&&a.tus){a.multipart?f.info("Uploading bundle with multipart is deprecated, we upload with TUS instead"):f.info("Uploading bundle with TUS protocol"),a.verbose&&(f.info("[Verbose] Starting TUS resumable upload..."),f.info(` - Host: ${h.hostWeb}`),f.info(` - Chunk size: ${Math.floor(s/1024/1024)} MB`)),await cS(t,i,o,r,n,u,h,s),l=!0,a.verbose&&f.info("[Verbose] TUS upload completed, updating database with R2 path...");let m=`orgs/${o}/apps/${r}/${n}.zip`,{error:b}=await e.from("app_versions").update({r2_path:m}).eq("name",n).eq("app_id",r);if(b)return f.error(`Cannot finish TUS upload ${L(b)}`),a.verbose&&f.info(`[Verbose] Database update failed: ${L(b)}`),Promise.reject(new Error("Cannot finish TUS upload"));a.verbose&&f.info(`[Verbose] Database updated with R2 path: ${m}`)}else{a.verbose&&f.info("[Verbose] Using standard upload (non-TUS), getting presigned URL...");let m=await aS(e,r,n);if(!m)return f.error("Cannot get upload url"),a.verbose&&f.info("[Verbose] Failed to retrieve presigned upload URL from database"),Promise.reject(new Error("Cannot get upload url"));a.verbose&&(f.info("[Verbose] Presigned URL obtained, uploading via HTTP PUT..."),f.info(` - Timeout: ${a.timeout||ag}ms`),f.info(" - Retry attempts: 5"),f.info(" - Content-Type: application/zip"));let b=new AbortController,D=setTimeout(()=>b.abort(),a.timeout||ag);try{let C=await fetch(m,{method:"PUT",body:i,headers:{"Content-Type":"application/zip"},signal:b.signal});if(!C.ok)throw new Error(`HTTP error! status: ${C.status}`)}finally{clearTimeout(D)}a.verbose&&f.info("[Verbose] HTTP PUT upload completed successfully")}}catch(h){let b=((performance.now()-c)/1e3).toFixed(2);if(u.stop(`Failed to upload bundle ( after ${b} seconds)`),a.verbose&&(f.info(`[Verbose] Upload failed after ${b} seconds`),f.info(`[Verbose] Error type: ${h instanceof Error?"Error":typeof h}`)),h instanceof Error&&h.message.includes("HTTP error"))try{let D=h.message.match(/status: (\d+)/),C=D?D[1]:"unknown";f.error(`Upload failed with status ${C}: ${h.message}`)}catch{f.error(`Upload failed: ${h.message}`)}else a.verbose&&f.info(`[Verbose] Non-HTTP error: ${L(h)}`),a.tus?f.error(`Cannot upload bundle please contact support if the issue persists ${L(h)}`):f.error(`Cannot upload bundle ( try again with --tus option) ${L(h)}`);throw a.verbose&&f.info("[Verbose] Cleaning up failed version from database..."),await lS(e,r,n),a.verbose&&f.info("[Verbose] Failed version cleaned up"),h instanceof Error?h:new Error(String(h))}let d=((performance.now()-c)/1e3).toFixed(2);u.stop(`Bundle uploaded \u{1F4AA} in (${d} seconds)`),a.verbose&&(f.info("[Verbose] Upload successful:"),f.info(` - Upload time: ${d} seconds`),f.info(` - Upload method: ${l?"TUS (resumable)":"Standard HTTP PUT"}`),f.info(` - Bundle size: ${Math.floor(i.byteLength/1024)} KB`),f.info("[Verbose] Sending performance event...")),await be(t,{channel:"performance",event:l?"TUS upload zip performance":"Upload zip performance",icon:"\u{1F684}",user_id:o,tags:{"app-id":r,time:d},notify:!1},a.verbose),a.verbose&&f.info("[Verbose] Performance event sent successfully")}async function n9(t,e,r){let{data:n,error:o}=await t.from("channels").select("version ( id, name, deleted )").eq("app_id",e).eq("name",r);if(o){f.error(`Cannot delete linked bundle on upload ${L(o)}`);return}if(n.length===0){f.warn("No linked bundle found in the channel you are trying to upload to");return}let i=n[0].version;if(i.deleted){f.warn("The linked bundle is already deleted");return}let{error:a}=await t.from("app_versions").update({deleted:!0}).eq("id",i.id);if(a){f.error(`Cannot delete linked bundle on upload ${L(a)}`);return}f.info("Linked bundle deleted")}async function o9(t,e,r,n,o,i,a,s,u,c){let{data:l}=await t.rpc("get_app_versions",{apikey:e,name_version:n,appid:s}).single();l||ge("Cannot get version id, cannot set channel");let{data:p}=await t.rpc("is_allowed_capgkey",{apikey:e,keymode:["write","all"]}).single();if(p){let{error:d,data:h}=await Ol(t,{name:o,app_id:s,created_by:i,version:l,owner_org:a,...c?{allow_device_self_set:!0}:{}});d&&ge(`Cannot set channel, the upload key is not allowed to do that, use the "all" for this. ${L(d)}`);let m=`${u.hostWeb}/app/p/${s}/channel/${h.id}`;h?.public?f.info("Your update is now available in your public channel \u{1F389}"):h?.id&&f.info(`Link device to this bundle to try it: ${m}`),r&&f.info(`Bundle url: ${m}`)}else f.warn("The upload key is not allowed to set the version in the channel")}async function i9(t,e,r){let{error:n,data:o}=await e.from("apps").select("default_upload_channel").eq("app_id",t).single();return n?(f.warn("Cannot find default upload channel"),f.info(`You can set it here: ${r}/app/p/${t}/settings`),null):o.default_upload_channel}async function Hg(t,e,r=!1){r||Z(`Uploading with CLI version ${hr.version}`);let n,o=Qe();await de();let{s3Region:i,s3Apikey:a,s3Apisecret:s,s3BucketName:u,s3Endpoint:c,s3Port:l,s3SSL:p}=e;e.verbose&&(f.info("[Verbose] Starting upload process with options:"),f.info(` - API key: ${e.apikey?"provided":"from saved key"}`),f.info(` - Path: ${e.path||"from capacitor config"}`),f.info(` - Channel: ${e.channel||"from default upload channel"}`),f.info(` - Bundle: ${e.bundle||"auto-detected"}`),f.info(` - External: ${e.external||"false"}`),f.info(` - Encryption: ${e.keyV2||e.keyDataV2?"v2":e.key===!1?"disabled":"auto"}`),f.info(` - Upload method: ${e.tus?"TUS":e.zip?"ZIP":"auto"}`),f.info(` - Delta updates: ${e.delta||e.partial?"enabled":"disabled"}`));let d=JM(e);e.verbose&&f.info("[Verbose] API key retrieved successfully");let h=await te();e.verbose&&f.info("[Verbose] Capacitor config loaded successfully");let m=await X1();e.verbose&&(f.info("[Verbose] Remote file config retrieved:"),f.info(` - Max upload length: ${Math.floor(m.maxUploadLength/1024/1024)} MB`),f.info(` - Alert upload size: ${Math.floor(m.alertUploadSize/1024/1024)} MB`),f.info(` - TUS upload: ${m.TUSUpload?"enabled":"disabled"}`),f.info(` - TUS upload forced: ${m.TUSUploadForced?"yes":"no"}`),f.info(` - Partial upload: ${m.partialUpload?"enabled":"disabled"}`),f.info(` - Max chunk size: ${Math.floor(m.maxChunkSize/1024/1024)} MB`));let{appid:b,path:D}=XM(t,e,h.config);e.verbose&&f.info(`[Verbose] App ID: ${b}, Build path: ${D}`);let C=await YM(h.config,e);e.verbose&&f.info(`[Verbose] Bundle version: ${C}`);let E=e.external?"external":"r2-direct",g="none";e.autoSetBundle&&(await Cs({version:C}),e.verbose&&f.info("[Verbose] Auto-set bundle version in capacitor.config.json")),ZM(e,D),e.verbose&&f.info("[Verbose] Code check passed (notifyAppReady found and index.html present)"),f.info(`Upload ${b}@${C} started from path "${D}" to Capgo cloud`);let _=await ir();e.verbose&&f.info(`[Verbose] Local config loaded: host=${_.hostWeb}`),e.supaHost&&e.supaAnon&&(f.info("Using custom supabase instance from provided options"),_.supaHost=e.supaHost,_.supaKey=e.supaAnon,e.verbose&&f.info(`[Verbose] Custom Supabase host: ${e.supaHost}`));let S=await re(d,e.supaHost,e.supaAnon);e.verbose&&f.info("[Verbose] Supabase client created successfully");let $=await oe(S,d,["write","all","upload"]);e.verbose&&f.info(`[Verbose] User verified successfully, user_id: ${$}`);let k=e.channel||await i9(b,S,_.hostWeb)||"dev";e.verbose&&f.info(`[Verbose] Target channel: ${k}`);let B=await ar(S,b);e.verbose&&f.info(`[Verbose] Organization ID: ${B}`),await tS(S,B,hr.version),e.verbose&&f.info("[Verbose] Remote CLI messages checked"),await nS(S,B,d,b,!0),e.verbose&&f.info("[Verbose] Plan validation passed"),e.verbose&&f.info("[Verbose] Trial check completed"),e.verbose&&f.info(`[Verbose] Checking compatibility with channel ${k}...`);let{nativePackages:R,minUpdateVersion:N}=await QM(S,o,e,k,b,C);e.verbose&&(f.info("[Verbose] Compatibility check completed:"),f.info(` - Native packages: ${R?R.length:0}`),f.info(` - Min update version: ${N||"none"}`)),e.verbose&&f.info(`[Verbose] Checking if version ${C} already exists...`);let A=await e9(S,b,C,e.versionExistsOk);if(e.verbose&&f.info(`[Verbose] Version exists check: ${A?"yes (skipping)":"no (continuing)"}`),A)return{success:!0,skipped:!0,reason:"VERSION_EXISTS",bundle:C,checksum:null,encryptionMethod:g,storageProvider:E};e.external&&!e.external.startsWith("https://")&&ge(`External link should should start with "https://" current is "${e.external}"`),e.deleteLinkedBundleOnUpload&&(f.warn("Deleting linked bundle on upload is destructive, it will delete the currently linked bundle in the channel you are trying to upload to."),f.warn("Please make sure you want to do this, if you are not sure, please do not use this option."));let U={name:C,app_id:b,session_key:void 0,external_url:e.external,storage_provider:E,min_update_version:N,native_packages:R,owner_org:B,user_id:$,checksum:void 0,link:e.link||null,comment:e.comment||null},M=null,Q="";if(e.external)e.verbose&&f.info(`[Verbose] Using external URL: ${e.external}`),await be(d,{channel:"app",event:"App external",icon:"\u{1F4E4}",user_id:B,tags:{"app-id":b},notify:!1},e.verbose),U.session_key=e.ivSessionKey,U.checksum=e.encryptedChecksum,e.verbose&&(f.info("[Verbose] External bundle configured:"),f.info(` - URL: ${e.external}`),f.info(` - IV Session Key: ${e.ivSessionKey?"provided":"none"}`),f.info(` - Encrypted Checksum: ${e.encryptedChecksum?"provided":"none"}`));else{e.verbose&&f.info(`[Verbose] Preparing bundle file from path: ${D}`);let{zipped:F,ivSessionKey:I,checksum:O,sessionKey:q,encryptionMethod:T,finalKeyData:j}=await t9(D,e,d,B,b,m.maxUploadLength,m.alertUploadSize);U.session_key=I,U.checksum=O,n=q,M=F,g=T,Q=j,e.verbose&&(f.info("[Verbose] Bundle prepared:"),f.info(` - Size: ${Math.floor((F?.byteLength??0)/1024)} KB`),f.info(` - Checksum: ${O}`),f.info(` - Encryption: ${T}`),f.info(` - IV Session Key: ${I?"present":"none"}`)),e.ignoreChecksumCheck||(e.verbose&&f.info("[Verbose] Checking for duplicate checksum..."),await dS(S,b,k,O),e.verbose&&f.info("[Verbose] Checksum is unique"))}if(e.zip?(e.tus=!1,e.verbose&&f.info("[Verbose] Upload method: ZIP (explicitly set via --zip)")):!m.TUSUpload||e.external?(e.tus=!1,e.verbose&&f.info("[Verbose] Upload method: Standard (TUS not available or external URL)")):(e.tus=e.tus||m.TUSUploadForced,e.verbose&&f.info(`[Verbose] Upload method: ${e.tus?"TUS (resumable)":"Standard"}`)),!m.partialUpload||e.external?(e.delta=!1,e.verbose&&e.external&&f.info("[Verbose] Delta updates disabled (not available with external URLs)")):(e.delta=e.delta||e.partial||e.deltaOnly||e.partialOnly||m.partialUploadForced,e.verbose&&f.info(`[Verbose] Delta updates: ${e.delta?"enabled":"disabled"}`)),e.encryptPartial&&g==="v1"&&ge("You cannot encrypt the partial update if you are not using the v2 encryption method"),e.delta&&g==="v2"&&!e.encryptPartial){let F=yt((0,qg.cwd)()),I=await rn("@capgo/capacitor-updater",F,e.packageJson),O;try{O=I?_e(I):void 0}catch{O=void 0}I&&O&&hn(O,_e("6.14.4"))&&(f.info(`Auto-enabling partial update encryption for updater version ${O} (> 6.14.4)`),e.verbose&&f.info("[Verbose] Partial encryption auto-enabled for updater >= 6.14.4"),e.encryptPartial=!0)}e.verbose&&e.delta&&f.info("[Verbose] Preparing delta/partial update manifest...");let P=e.delta?await gF(D,d,B,b,e.encryptPartial?g:"none",Q):[];e.verbose&&e.delta&&f.info(`[Verbose] Delta manifest prepared with ${P.length} files`),e.verbose&&f.info("[Verbose] Creating version record in database...");let{error:y}=await fg(S,U);if(y&&ge(`Cannot add bundle ${L(y)}`),e.verbose&&f.info("[Verbose] Version record created successfully"),e.tusChunkSize&&e.tusChunkSize>m.maxChunkSize?(f.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&&f.info(`[Verbose] TUS chunk size: ${Math.floor(e.tusChunkSize/1024/1024)} MB`),M&&(u||c||i||a||s||l||p)){(!u||!c||!i||!a||!s||!l)&&ge("Missing argument, for S3 upload you need to provide a bucket name, endpoint, region, port, API key, and API secret"),f.info("Uploading to S3"),e.verbose&&(f.info("[Verbose] S3 configuration:"),f.info(` - Endpoint: ${c}`),f.info(` - Region: ${i}`),f.info(` - Bucket: ${u}`),f.info(` - Port: ${l}`),f.info(` - SSL: ${p?"enabled":"disabled"}`));let F=p?`https://${c}`:`http://${c}`,I=new As({endPoint:c,region:i,port:l,pathStyle:!0,bucket:u,accessKey:a,secretKey:s}),O=`${b}-${C}`,q=encodeURIComponent(O);e.verbose&&f.info(`[Verbose] Uploading to S3 as: ${O}`),await I.putObject(O,Uint8Array.from(M)),U.external_url=`${F}/${q}`,U.storage_provider="external",e.verbose&&f.info(`[Verbose] S3 upload complete, external URL: ${U.external_url}`)}else if(M){!e.partialOnly&&!e.deltaOnly?(e.verbose&&f.info("[Verbose] Starting full bundle upload to Capgo Cloud..."),await r9(d,S,b,C,B,M,e,e.tusChunkSize)):e.verbose&&f.info("[Verbose] Skipping full bundle upload (delta-only mode)");let F=null;try{e.dryUpload&&(e.delta=!1,e.verbose&&f.info("[Verbose] Dry upload mode: skipping delta upload"));let O=U.session_key&&e.encryptPartial&&n?{sessionKey:n,ivSessionKey:U.session_key}:void 0;e.verbose&&e.delta&&(f.info("[Verbose] Starting delta/partial file upload..."),f.info(` - Manifest entries: ${P.length}`),f.info(` - Encryption: ${O?"enabled":"disabled"}`)),F=e.delta?await DF(d,P,D,b,B,O,e):null,e.verbose&&F&&f.info(`[Verbose] Delta upload complete with ${F.length} files`)}catch(O){if(!!(e.partial||e.delta||e.partialOnly||e.deltaOnly))throw O;f.info(`Failed to upload partial files to capgo cloud. Error: ${L(O)}. This is not a critical error, the bundle has been uploaded without the partial files`),e.verbose&&f.info(`[Verbose] Delta upload error details: ${L(O)}`)}U.storage_provider="r2",U.manifest=F,e.verbose&&f.info("[Verbose] Updating version record with storage provider and manifest...");let{error:I}=await fg(S,U);I&&ge(`Cannot update bundle ${L(I)}`),e.verbose&&f.info("[Verbose] Version record updated successfully")}e.verbose&&f.info("[Verbose] Checking app permissions...");let w=await Ue(S,d,b,2);e.verbose&&(f.info("[Verbose] Permissions:"),f.info(` - Upload: ${Ji(w,2)?"yes":"no"}`),f.info(` - Write: ${Ji(w,3)?"yes":"no"}`),f.info(` - Admin: ${Ji(w,4)?"yes":"no"}`)),e.deleteLinkedBundleOnUpload&&Ji(w,3)?(e.verbose&&f.info(`[Verbose] Deleting linked bundle in channel ${k}...`),await n9(S,b,k)):e.deleteLinkedBundleOnUpload&&f.warn("Cannot delete linked bundle on upload as a upload organization member"),Ji(w,3)?(e.verbose&&f.info(`[Verbose] Setting bundle ${C} to channel ${k}...`),await o9(S,d,!!e.bundleUrl,C,k,$,B,b,_,e.selfAssign),e.verbose&&f.info("[Verbose] Channel updated successfully")):f.warn("Cannot set channel as a upload organization member"),e.verbose&&f.info("[Verbose] Sending upload event..."),await be(d,{channel:"app",event:"App Uploaded",icon:"\u23EB",user_id:B,tags:{"app-id":b},notify:!1},e.verbose);let v={success:!0,bundle:C,checksum:U.checksum??null,encryptionMethod:g,sessionKey:n?n.toString("base64"):void 0,ivSessionKey:typeof U.session_key=="string"?U.session_key:void 0,storageProvider:U.storage_provider};return e.verbose&&(f.info("[Verbose] Upload completed successfully:"),f.info(` - Bundle: ${v.bundle}`),f.info(` - Checksum: ${v.checksum}`),f.info(` - Encryption: ${v.encryptionMethod}`),f.info(` - Storage: ${v.storageProvider}`)),r&&!v.skipped&&J("Time to share your update to the world \u{1F30D}"),v}function a9(t){t.ivSessionKey&&!t.external&&ge("You need to provide an external url if you want to use the --iv-session-key option"),t.encryptedChecksum&&!t.external&&ge("You need to provide an external url if you want to use the --encrypted-checksum option"),(t.partial||t.delta||t.partialOnly||t.deltaOnly)&&t.external&&ge("You cannot use the --partial/--delta/--partial-only/--delta-only option with an external url"),t.tus&&t.external&&ge("You cannot use the --tus option with an external url"),t.dryUpload&&t.external&&ge("You cannot use the --dry-upload option with an external url"),t.multipart&&t.external&&ge("You cannot use the --multipart option with an external url"),t.external&&(t.keyV2||t.keyDataV2)&&ge("You cannot set a key if you are uploading to an external url"),t.keyV2&&t.keyDataV2&&ge("You cannot set both key-v2 and key-data-v2"),t.external&&(t.s3Region||t.s3Apikey||t.s3Apisecret||t.s3Endpoint||t.s3BucketName||t.s3Port||t.s3SSL)&&ge("You cannot set S3 options if you are uploading to an external url, it's automatically handled"),t.encryptedChecksum&&!t.external&&ge("You cannot set the --encrypted-checksum option if you are not uploading to an external url"),t.minUpdateVersion&&t.autoMinUpdateVersion&&ge("You cannot set both min-update-version and auto-min-update-version, use only one of them")}async function bF(t,e){try{a9(e),await Hg(t,e)}catch(r){throw f.error(`uploadBundle failed: ${L(r)}`),r instanceof Error?r:new Error(String(r))}}var wF=require("node:crypto"),Zl=require("node:fs"),vF=require("node:process");var s9=20;function u9(t){console.log(JSON.stringify(t,null,2))}function Is(t){console.error(L(t))}async function c9(t,e,r=!1){let{json:n}=e,{bundle:o,path:i}=e,a=!n&&!r;try{a&&await de();let s=await te(),u=he(t,s?.config),c=(0,wF.randomUUID)().split("-")[0],l=_r("",e.packageJson);if(o=o||l||`0.0.1-beta.${c}`,a&&Z(`Zipping ${u}@${o}`),o&&!Yi.test(o)){let $=`Your bundle name ${o}, is not valid it should follow semver convention : https://semver.org/`;throw r||(n?Is({error:"invalid_semver"}):f.error($)),new Error("Invalid bundle version format")}if(i=i||s?.config?.webDir,!u||!o||!i){let $="Missing argument, you need to provide a appId and a bundle and a path, or be in a capacitor project";throw r||(n?Is({error:"missing_argument"}):f.error($)),new Error($)}if(a&&f.info(`Started from path "${i}"`),typeof e.codeCheck>"u"?!0:e.codeCheck){if(!Os(i,"notifyAppReady"))throw r||(n?Is({error:"notifyAppReady_not_in_source_code"}):f.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(!Hl(i))throw r||(n?Is({error:"index_html_not_found"}):f.error(`index.html is missing in the root folder of ${i}`)),new Error("index.html is missing in root folder")}let d=await Al(i);a&&f.info(`Zipped ${d.byteLength} bytes`);let h=a?ve():null;h&&h.start("Calculating checksum");let m=yt((0,vF.cwd)()),b=await rn("@capgo/capacitor-updater",m,e.packageJson);if(!b){let $="Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager";throw r||f.warn($),new Error($)}let D=!1,C;try{C=b?_e(b):void 0}catch{C=void 0}if(C){let $=C.major===6&&hn(C,_e("6.25.0")),k=C.major>=7;D=$||k}else b==="link:@capgo/capacitor-updater"&&(r||f.warn("Using local @capgo/capacitor-updater. Assuming v7"),D=!0);let E=await Xr(d,e.keyV2||(0,Zl.existsSync)(Wt)||D?"sha256":"crc32");h&&h.stop(`Checksum ${D?"SHA256":"CRC32"}: ${E}`);let g=Math.floor(d.byteLength/1024/1024);g>s9&&a&&(f.warn(`WARNING !!
207
+ The bundle size is ${g} Mb, this may take a while to download for users
208
+ `),f.warn(`Learn how to optimize your assets https://capgo.app/blog/optimise-your-images-for-updates/
209
+ `));let _=a?ve():null,S=e.name||`${u}_${o}.zip`;return _&&_.start(`Saving to ${S}`),(0,Zl.writeFileSync)(S,d),_&&_.stop(`Saved to ${S}`),a&&J("Done \u2705"),!r&&n&&u9({bundle:o,filename:S,checksum:E}),{bundle:o,filename:S,checksum:E}}catch(s){throw r||(n?Is(s):f.error(L(s))),s instanceof Error?s:new Error(String(s))}}async function CF(t,e){await c9(t,e,!1)}async function Vg(t,e,r,n=!1){n||Z("Create channel"),r.apikey=r.apikey||ie();let o=await te().catch(()=>{});if(e=he(e,o?.config),!r.apikey)throw n||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let i=await re(r.apikey,r.supaHost,r.supaAnon);await oe(i,r.apikey,["write","all"]),await Ue(i,r.apikey,e,4,n),n||f.info(`Creating channel ${e}#${t} to Capgo`);let a=await gg(i,e);if(!a)throw n||f.error("Cannot find default version for channel creation, please contact Capgo support \u{1F928}"),new Error("Cannot find default version for channel creation");let s=await ar(i,e),u=await oe(i,r.apikey,["write","all"]),c=await AS(i,{name:t,app_id:e,version:a.id,created_by:u,owner_org:s,allow_device_self_set:r.selfAssign??!1,public:r.default??!1});if(c.error)throw n||f.error(`Cannot create Channel \u{1F640}
210
+ ${L(c.error)}`),new Error(`Cannot create channel: ${L(c.error)}`);return await be(r.apikey,{channel:"channel",event:"Create channel",icon:"\u2705",user_id:s,tags:{"app-id":e,channel:t},notify:!1}).catch(()=>{}),n||(f.success("Channel created \u2705"),J("Done \u2705")),c.data??!0}async function EF(t,e,r){await Vg(t,e,r,!1)}async function l9(t,e,r,n=!1){let{quiet:o}=r;!o&&!n&&Z("List current bundle"),r.apikey=r.apikey||ie(o);let i=await te();if(e=he(e,i?.config),!r.apikey)throw n||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let a=await re(r.apikey,r.supaHost,r.supaAnon);if(await oe(a,r.apikey,["write","all","read"]),await Ue(a,r.apikey,e,1,n),!t)throw n||f.error("Please provide a channel to get the bundle from."),new Error("Channel name missing");let{data:s,error:u}=await a.from("channels").select("version ( name )").eq("name",t).eq("app_id",e).limit(1);if(u||!s?.length)throw n||f.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}=s[0];if(!c)throw n||f.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||(o?f.info(c.name):f.info(`Current bundle for channel ${t} is ${c.name}`)),c.name}async function _F(t,e,r){return l9(t,e,r)}async function f9(t,e,r,n=!1){n||Z("Delete channel"),r.apikey=r.apikey||ie();let o=await te();if(e=he(e,o?.config),!r.apikey)throw n||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let i=await re(r.apikey,r.supaHost,r.supaAnon),a=await oe(i,r.apikey,["all"]);if(await Ue(i,r.apikey,e,4,n),r.deleteBundle&&!n&&f.info(`Deleting bundle ${e}#${t} from Capgo`),r.deleteBundle){let d=await PS(i,e,t);d?.name&&!n&&f.info(`Deleting bundle ${d.name} from Capgo`),d?.name&&await Dg(i,e,d.name)}let{data:s,error:u}=await kS(i,e,t);if(u||!s){if(n||f.error(`Channel ${t} not found`),r.successIfNotFound)return n||f.success(`Channel ${t} not found and successIfNotFound is true`),!0;throw new Error(`Channel ${t} not found`)}let{error:c}=await $S(i,e,s.id);if(c)throw n||f.error(`Cannot delete channel devices: ${L(c)}`),new Error(`Cannot delete channel devices: ${L(c)}`);n||f.info(`Deleting channel ${e}#${t} from Capgo`);let l=await OS(i,t,e,a);if(l.error)throw n||f.error(`Cannot delete Channel \u{1F640} ${L(l.error)}`),new Error(`Cannot delete channel: ${L(l.error)}`);let p=await ar(i,e);return await be(r.apikey,{channel:"channel",event:"Delete channel",icon:"\u2705",user_id:p,tags:{"app-id":e,channel:t},notify:!1}).catch(()=>{}),n||(f.success("Channel deleted"),J("Done \u2705")),!0}async function xF(t,e,r){return f9(t,e,r,!1)}async function p9(t,e,r=!1){r||Z("List channels"),e.apikey=e.apikey||ie();let n=await te();if(t=he(t,n?.config),!e.apikey)throw r||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let o=await re(e.apikey,e.supaHost,e.supaAnon),i=await oe(o,e.apikey,["write","all","read","upload"]);await Ue(o,e.apikey,t,1,r),r||f.info("Querying available channels in Capgo");let a=await IS(o,t);return r||(f.info(`Active channels in Capgo: ${a?.length??0}`),TS(a)),await be(e.apikey,{channel:"channel",event:"List channel",icon:"\u2705",user_id:i,tags:{"app-id":t},notify:!1}).catch(()=>{}),r||J("Done \u2705"),a}async function SF(t,e){return p9(t,e,!1)}var FF=["major","minor","metadata","patch","none"];async function d9(t,e,r,n=!1){n||Z("Set channel"),r.apikey=r.apikey||ie();let o=await te();if(e=he(e,o?.config),!r.apikey)throw n||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||f.error("Missing argument, you need to provide a channel"),new Error("Missing channel id");let i=await re(r.apikey,r.supaHost,r.supaAnon),a=await oe(i,r.apikey,["write","all"]);await Ue(i,r.apikey,e,4,n);let s=await ar(i,e),{bundle:u,state:c,downgrade:l,latest:p,latestRemote:d,ios:h,android:m,selfAssign:b,disableAutoUpdate:D,dev:C,emulator:E}=r;if(p&&u)throw n||f.error("Cannot set latest and bundle at the same time"),new Error("Cannot set both latest and bundle simultaneously");if(d&&u)throw n||f.error("Cannot set latest remote and bundle at the same time"),new Error("Cannot set both latest remote and bundle simultaneously");if(d&&p)throw n||f.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&&p==null&&d==null&&l==null&&h==null&&m==null&&b==null&&C==null&&E==null&&D==null)throw n||f.error("Missing argument, you need to provide a option to set"),new Error("No channel option provided");await rS(i,s,r.apikey,e);let g={created_by:a,app_id:e,name:t,owner_org:s,version:void 0},{error:_}=await i.from("channels").select().eq("app_id",e).eq("name",t).single();if(_)throw n||f.error(`Cannot find channel ${t}`),new Error(`Cannot find channel ${t}`);let S=p?o?.config?.plugins?.CapacitorUpdater?.version||_r("",r.packageJson):u;if(S!=null){let{data:k,error:B}=await i.from("app_versions").select().eq("app_id",e).eq("name",S).eq("user_id",a).eq("deleted",!1).single();if(B||!k)throw n||f.error(`Cannot find version ${S}`),new Error(`Cannot find version ${S}`);if(!r.ignoreMetadataCheck){let{finalCompatibility:R,localDependencies:N}=await dg(i,e,t,k.native_packages??[]),A=Qe();if(N.length>0&&R.some(U=>!Fo(U)))throw n||(f.warn(`Bundle NOT compatible with ${t} channel`),f.warn(`You can check compatibility with "${A.runner} @capgo/cli bundle compatibility"`)),new Error(`Bundle is not compatible with ${t} channel`);n||(N.length===0&&R.length>0?f.info(`Ignoring check compatibility with ${t} channel because the bundle does not contain any native packages`):f.info(`Bundle is compatible with ${t} channel`))}n||f.info(`Set ${e} channel: ${t} to @${S}`),g.version=k.id}if(d){let{data:k,error:B}=await i.from("app_versions").select().eq("app_id",e).eq("user_id",a).eq("deleted",!1).order("created_at",{ascending:!1}).single();if(B||!k)throw n||f.error("Cannot find latest remote version"),new Error("Cannot find latest remote version");if(!r.ignoreMetadataCheck){let{finalCompatibility:R}=await dg(i,e,t,k.native_packages??[]),N=Qe();if(R.some(A=>!Fo(A)))throw n||(f.warn(`Bundle NOT compatible with ${t} channel`),f.warn(`You can check compatibility with "${N.runner} @capgo/cli bundle compatibility"`)),new Error(`Latest remote bundle is not compatible with ${t} channel`)}n||f.info(`Set ${e} channel: ${t} to @${k.name}`),g.version=k.id}if(c!=null){if(c!=="normal"&&c!=="default")throw n||f.error(`State ${c} is not known. The possible values are: normal, default.`),new Error(`Unknown state ${c}. Expected normal or default`);n||f.info(`Set ${e} channel: ${t} to ${c}`),g.public=c==="default"}if(l!=null&&(n||f.info(`Set ${e} channel: ${t} to ${l?"allow":"disallow"} downgrade`),g.disable_auto_update_under_native=!l),h!=null&&(n||f.info(`Set ${e} channel: ${t} to ${h?"allow":"disallow"} ios update`),g.ios=!!h),m!=null&&(n||f.info(`Set ${e} channel: ${t} to ${m?"allow":"disallow"} android update`),g.android=!!m),b!=null&&(n||f.info(`Set ${e} channel: ${t} to ${b?"allow":"disallow"} self assign to this channel`),g.allow_device_self_set=!!b),C!=null&&(n||f.info(`Set ${e} channel: ${t} to ${C?"allow":"disallow"} dev devices`),g.allow_dev=!!C),E!=null&&(n||f.info(`Set ${e} channel: ${t} to ${E?"allow":"disallow"} emulator devices`),g.allow_emulator=!!E),D!=null){let k=D.toLowerCase();if(!FF.includes(k))throw n||f.error(`Channel strategy ${k} is not known. The possible values are: ${FF.join(", ")}.`),new Error(`Unknown channel strategy ${k}`);k==="metadata"&&(k="version_number"),g.disable_auto_update=k,n||f.info(`Set ${e} channel: ${t} to ${k} disable update strategy to this channel`)}let{error:$}=await Ol(i,g);if($)throw n||f.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 be(r.apikey,{channel:"channel",event:"Set channel",icon:"\u2705",user_id:s,tags:{"app-id":e},notify:!1}).catch(()=>{}),n||J("Done \u2705"),!0}async function AF(t,e,r){return d9(t,e,r,!1)}var Ur=require("node:fs");function zg(t){let e="\u{1F539}";return t.includes("upload")?e="\u2B06\uFE0F":t.includes("delete")?e="\u{1F5D1}\uFE0F":t.includes("list")?e="\u{1F4CB}":t.includes("add")?e="\u2795":t.includes("set")?e="\u2699\uFE0F":t.includes("create")?e="\u{1F528}":t.includes("encrypt")?e="\u{1F512}":t.includes("decrypt")?e="\u{1F513}":t.includes("debug")?e="\u{1F41E}":t.includes("doctor")?e="\u{1F468}\u200D\u2695\uFE0F":t.includes("login")?e="\u{1F511}":t.includes("init")?e="\u{1F680}":t.includes("compatibility")?e="\u{1F9EA}":t.includes("cleanup")?e="\u{1F9F9}":t.includes("currentBundle")?e="\u{1F4E6}":t.includes("setting")?e="\u2699\uFE0F":t==="app"?e="\u{1F4F1}":t==="bundle"?e="\u{1F4E6}":t==="channel"?e="\u{1F4E2}":t==="key"?e="\u{1F510}":t==="account"&&(e="\u{1F464}"),e}function OF(t="./README.md",e){let r=nt.commands.map(o=>{let i=o,a=i._actionHandler!==null&&i._actionHandler!==void 0,u=o.commands&&o.commands.length>0&&!a;return{name:o.name(),alias:o.alias()||"",description:o.description(),options:o.options.map(c=>({flags:c.flags,description:c.description||""})),subcommands:o.commands?o.commands.map(c=>{let l=c,p=l._actionHandler!==null&&l._actionHandler!==void 0;return{name:c.name(),alias:c.alias()||"",description:c.description(),options:c.options.map(d=>({flags:d.flags,description:d.description||""})),subcommands:[],hasAction:p,isCommandGroup:!1}}):[],hasAction:a,isCommandGroup:u}}),n=(o,i=!1,a,s=!1)=>{let u=o.name,c=u.charAt(0).toUpperCase()+u.slice(1),l;i?l=a?`${a}-${u}`:u:l=s?"options":u;let p=i?"###":"##",d="",h=zg(u);s&&!i||(d+=`${p} <a id="${l}"></a> ${h} **${c}**
210
211
 
211
212
  `),o.alias&&(d+=`**Alias:** \`${o.alias}\`
212
213
 
@@ -230,7 +231,7 @@ ${U(c.error)}`),new Error(`Cannot create channel: ${U(c.error)}`);return await b
230
231
  `;for(let C of o.options){let E=C.flags.split(" ")[0],g=C.flags.split(" ").length>1?"string":"boolean";d+=`| **${E}** | <code>${g}</code> | ${C.description} |
231
232
  `}d+=`
232
233
  `}return d};if(e){(0,Ur.existsSync)(e)||(0,Ur.mkdirSync)(e,{recursive:!0});for(let o of r){if(o.name==="generate-docs")return;let a=`---
233
- title: ${qg(o.name)} ${o.name}
234
+ title: ${zg(o.name)} ${o.name}
234
235
  description: ${o.description.split(`
235
236
  `)[0]}
236
237
  sidebar_label: ${o.name}
@@ -241,40 +242,40 @@ sidebar:
241
242
  `,s=o.description.split(`
242
243
  `)[0];a+=`${s}
243
244
 
244
- `;let u="";if(o.subcommands.length===0)u=n(o,!1,o.name,!0);else for(let c of o.subcommands)u+=n(c,!0,o.name);a+=u;try{(0,Ur.writeFileSync)(`${e}/${o.name}.mdx`,a,"utf8"),p.success(`Generated documentation file for ${o.name} command in ${e}/${o.name}.mdx`)}catch(c){console.error(`Error generating file for ${o.name}:`,c)}}p.success(`Documentation files generated in ${e}/`)}else{let o=`## \u{1F4D1} Capgo CLI Commands
245
+ `;let u="";if(o.subcommands.length===0)u=n(o,!1,o.name,!0);else for(let c of o.subcommands)u+=n(c,!0,o.name);a+=u;try{(0,Ur.writeFileSync)(`${e}/${o.name}.mdx`,a,"utf8"),f.success(`Generated documentation file for ${o.name} command in ${e}/${o.name}.mdx`)}catch(c){console.error(`Error generating file for ${o.name}:`,c)}}f.success(`Documentation files generated in ${e}/`)}else{let o=`## \u{1F4D1} Capgo CLI Commands
245
246
 
246
247
  `;o+=`## \u{1F4CB} Table of Contents
247
248
 
248
- `;for(let l of r){if(l.name==="generate-docs")continue;let f=qg(l.name);if(o+=`- ${f} [${l.name.charAt(0).toUpperCase()+l.name.slice(1)}](#${l.name})
249
+ `;for(let l of r){if(l.name==="generate-docs")continue;let p=zg(l.name);if(o+=`- ${p} [${l.name.charAt(0).toUpperCase()+l.name.slice(1)}](#${l.name})
249
250
  `,l.subcommands.length>0)for(let d of l.subcommands)o+=` - [${d.name.charAt(0).toUpperCase()+d.name.slice(1)}](#${l.name}-${d.name})
250
251
  `}o+=`
251
252
  `;for(let l of r)if(l.name!=="generate-docs"){if(o+=n(l,!1,void 0,!1),l.subcommands.length>0){l.isCommandGroup||(o+=`#### ${l.name.toUpperCase()} Subcommands:
252
253
 
253
- `);for(let f of l.subcommands)o+=n(f,!0,l.name)}o+=`
254
- `}let i="<!-- AUTO-GENERATED-DOCS-START -->",a="<!-- AUTO-GENERATED-DOCS-END -->",s="";try{s=(0,Ur.readFileSync)(t,"utf8")}catch{s=""}let u=s.indexOf(i),c=s.indexOf(a,u);if(u!==-1&&c!==-1){let l=s.substring(0,u+i.length),f=s.substring(c),d=`${l}
254
+ `);for(let p of l.subcommands)o+=n(p,!0,l.name)}o+=`
255
+ `}let i="<!-- AUTO-GENERATED-DOCS-START -->",a="<!-- AUTO-GENERATED-DOCS-END -->",s="";try{s=(0,Ur.readFileSync)(t,"utf8")}catch{s=""}let u=s.indexOf(i),c=s.indexOf(a,u);if(u!==-1&&c!==-1){let l=s.substring(0,u+i.length),p=s.substring(c),d=`${l}
255
256
  ${o}
256
- ${f}`;(0,Ur.writeFileSync)(t,d,"utf8"),p.success(`Documentation updated in ${t}`)}else(0,Ur.writeFileSync)(t,o,"utf8"),p.success(`Documentation written to ${t}`)}}var sa=require("node:child_process"),ke=require("node:fs"),Nn=require("node:path"),Ce=require("node:process");var Ql=ge(HF());var It=require("node:fs");function VF(t){return t.plugins??={},t.plugins.extConfig??={},t.plugins.CapacitorUpdater??={},t.plugins.CapacitorUpdater}async function S9(t,e=!1){e||Z("Save keys \u{1F511}");let r=await te(),n=t.key||tn,o=t.keyData||"";if(!(0,It.existsSync)(n)&&!o)throw e||p.error(`Cannot find a public key at ${n} or as keyData option or in ${r.path}`),new Error("Missing public key");if((0,It.existsSync)(n)&&(o=(0,It.readFileSync)(n,"utf8")),!o.startsWith("-----BEGIN RSA PUBLIC KEY-----"))throw e||p.error("The public key provided is not a valid RSA Public key"),new Error("Invalid RSA public key");if(r?.config){let i=VF(r.config);i.privateKey&&(delete i.privateKey,e||p.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await ye({message:"Do you want to setup encryption with the new channel in order to support old apps and facilitate the migration?"}))&&(i.defaultChannel="encryption_v2")),i.publicKey=o,await Ui(r)}return e||(p.success(`Public key saved into ${r.path} file in local directory`),p.success("Your app will decode the zip archive with this key")),!0}async function F9(t,e=!1){e||Z("Deleting old private key \u{1F5D1}\uFE0F");let r=await te(),n=r?.config?.plugins?.CapacitorUpdater;if(n?.privateKey){if(delete n.privateKey,await Ui(r),(0,It.existsSync)(zi))try{(0,It.unlinkSync)(zi),e||p.success(`Old private key file deleted: ${zi}`)}catch(o){e||p.error(`Failed to delete old private key file: ${zi} (${String(o)})`)}if((0,It.existsSync)(Cl))try{(0,It.unlinkSync)(Cl),e||p.success(`Old public key file deleted: ${Cl}`)}catch(o){e||p.error(`Failed to delete old public key file: ${tn} (${String(o)})`)}return e||(p.success(`Old private key deleted from ${r.path} file`),J("Done \u2705")),!0}return e||p.info("No old private key found in config file"),!1}async function zF(t){await de(),await S9(t,!1)}async function Wg(t,e=!1){e||Z("Create keys \u{1F511}");let{publicKey:r,privateKey:n}=I2();if((0,It.existsSync)(tn)&&!t.force)throw e||p.error("Public Key already exists, use --force to overwrite"),new Error("Public key already exists");if((0,It.writeFileSync)(tn,r),(0,It.existsSync)(Wt)&&!t.force)throw e||p.error("Private Key already exists, use --force to overwrite"),new Error("Private key already exists");(0,It.writeFileSync)(Wt,n);let o=await te();if(o){let i=VF(o.config);i.privateKey&&(delete i.privateKey,e||p.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await ye({message:"Do you want to setup encryption with the new channel in order to support old apps and facilitate the migration?"}))&&(i.defaultChannel="encryption_v2")),i.publicKey=r,await Ui(o)}if(!e){p.success("Your RSA key has been generated"),p.success(`Private key saved in ${Wt}`),p.success("This key will be used to encrypt your bundle before sending it to Capgo"),p.success("Keep it safe"),p.success("Then make it unreadable by Capgo and unmodifiable by anyone"),p.success(`Public key saved in ${o.path}`),p.success("Your app will be the only one having it"),p.success("Only your users can decrypt your update"),p.success("Only you can send them an update");try{await Al(),J("Done \u2705")}catch(i){if(i instanceof Error&&i.message==="Capacitor sync cancelled")return!0;throw i}}return!0}async function GF(t){await de(),await Wg(t,!1)}async function WF(t){await de(),await F9(t,!1)}var cn=require("node:fs"),Kg=require("node:os");function KF(){let t=(0,Kg.homedir)();return(0,cn.existsSync)(`${t}/.capgo`)||(0,cn.existsSync)(".capgo")}async function Yg(t,e,r=!1){if(r||Z("Login to Capgo"),!t)throw r||p.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");await de();let{local:n}=e;if(n){if(!(0,cn.existsSync)(".git"))throw r||p.error("To use local you should be in a git repository"),new Error("Not in a git repository");(0,cn.writeFileSync)(".capgo",`${t}
257
- `),(0,cn.appendFileSync)(".gitignore",`.capgo
258
- `)}else{let a=(0,Kg.homedir)();(0,cn.writeFileSync)(`${a}/.capgo`,`${t}
259
- `)}let o=await ne(t,e.supaHost,e.supaAnon),i=await oe(o,t,["write","all","upload"]);await be(t,{channel:"user-login",event:"User CLI login",icon:"\u2705",user_id:i,notify:!1}).catch(),r||(p.success(`login saved into .capgo file in ${n?"local":"home"} directory`),J("Done \u2705"))}async function YF(t,e){await Yg(t,e,!1)}var JF="import { CapacitorUpdater } from '@capgo/capacitor-updater'",Zl="CapacitorUpdater.notifyAppReady()",A9=/import.*from.*/g,Ps="production",Jg={stdio:"pipe"},Ts,Ln;function XF(){Ts??=(0,ke.readdirSync)(Ql.default.tmpdir).map(t=>({name:t,full:`${Ql.default.tmpdir}/${t}`})).find(t=>t.name.startsWith("capgocli"))?.full??Ql.default.fileSync({prefix:"capgocli"}).name}function pr(t,e){try{XF(),(0,ke.writeFileSync)(Ts,JSON.stringify(e?{step_done:t,pathToPackageJson:e}:{step_done:t,pathToPackageJson:Ln})),e&&(Ln=e)}catch(r){p.error(`Cannot mark step as done in the CLI, error:
260
- ${r}`),p.warn("Onboarding will continue but please report it to the capgo team!")}}async function O9(t,e){try{XF();let r=(0,ke.readFileSync)(Ts,"utf-8");if(!r||r.length===0)return;let{step_done:n,pathToPackageJson:o}=JSON.parse(r);p.info(`You have already got to the step ${n}/10 in the previous session`);let i=await ye({message:"Would you like to continue from where you left off?"});return await Vt(i,t,e),i?(o&&(Ln=o),n):void 0}catch(r){p.error(`Cannot read which steps have been completed, error:
261
- ${r}`),p.warn("Onboarding will continue but please report it to the capgo team!");return}}function k9(){if(Ts)try{(0,ke.rmSync)(Ts)}catch(t){p.error(`Cannot delete the tmp steps file.
262
- Error: ${t}`)}}async function Vt(t,e,r){De(t)&&(await or("onboarding-v2",e,r,"canceled","\u{1F937}"),(0,Ce.exit)())}async function dr(t,e,r,n){return or("onboarding-v2",t,e,`onboarding-step-${r}`,n)}async function $9(t,e,r,n){let o=Qe(),i=await ye({message:`Add ${r} in Capgo?`});if(await Vt(i,t.gid,e),i){let a=we();a.start(`Running: ${o.runner} @capgo/cli@latest app add ${r}`),await fg(r,n,t,!0)?a.stop("App add Done \u2705"):a.stop("App already add \u2705")}else p.info(`If you change your mind, run it for yourself with: "${o.runner} @capgo/cli@latest app add ${r}"`);await dr(t.gid,e,"add-app",r)}async function P9(t,e,r){let n=Qe(),o=await ye({message:`Create default channel ${Ps} for ${r} in Capgo?`});if(await Vt(o,t,e),o){let i=we();i.start(`Running: ${n.runner} @capgo/cli@latest channel add ${Ps} ${r} --default`),await Mg(Ps,r,{default:!0,apikey:e},!0)?i.stop("Channel add Done \u2705"):i.stop("Channel already added \u2705")}else p.info(`If you change your mind, run it for yourself with: "${n.runner} @capgo/cli@latest channel add ${Ps} ${r} --default"`);await dr(t,e,"add-channel",r)}async function T9(t){let e=(0,Nn.join)(vt((0,Ce.cwd)()),bt),r=Ln?await ft(void 0,Ln):await ft(void 0,e);if(r.size===0||!r.has("@capacitor/core")){p.warn("No adequate dependencies found");let n=await ye({message:"Would you like to select the package.json file manually?"});if(De(n)&&(Mn("Operation cancelled."),(0,Ce.exit)(1)),n){let o=await ye({message:"Would you like to use a tree selector to choose the package.json file?"});if(De(o)&&(Mn("Operation cancelled."),(0,Ce.exit)(1)),o){let a=(0,Ce.cwd)(),s=bt;for(;;){let u=(0,ke.readdirSync)(a).map(c=>({value:c,label:c}));if(u.push({value:"..",label:".."}),s=await Dr({message:"Select package.json file:",options:u}),De(s)&&(Mn("Operation cancelled."),(0,Ce.exit)(1)),!(0,ke.statSync)((0,Nn.join)(a,s)).isDirectory()&&s!==bt){p.error("Selected a file that is not a package.json file");continue}if(a=(0,Nn.join)(a,s),s===bt)break}return await pr(t,a),{dependencies:await ft(void 0,a),path:a}}let i=await gr({message:"Enter path to node_modules folder:"});return De(i)&&(Mn("Operation cancelled."),(0,Ce.exit)(1)),(0,ke.existsSync)(i)||(p.error(`Path ${i} does not exist`),(0,Ce.exit)(1)),{dependencies:await ft(void 0,i),path:i}}}return await pr(t,e),{dependencies:await ft(void 0,e),path:e}}var I9="https://capacitorjs.com/docs/updating/6-0",R9="https://capacitorjs.com/docs/updating/7-0";async function B9(t,e,r){let n=Qe(),o="1.0.0",i=!1,a=await ye({message:`Automatic Install "@capgo/capacitor-updater" dependency in ${r}?`});if(await Vt(a,t,e),a){let s=we(),u="latest",{dependencies:c,path:l}=await T9(3);s.start("Checking if @capgo/capacitor-updater is installed"),c.has("@capacitor/core")||(s.stop("Error"),p.warn("Cannot find @capacitor/core in package.json"),J("Bye \u{1F44B}"),(0,Ce.exit)());let f=c.get("@capacitor/core");if(f||(s.stop("Error"),p.warn("Cannot find @capacitor/core in package.json, please run `capgo init` in a capacitor project"),J("Bye \u{1F44B}"),(0,Ce.exit)()),f==="latest"?(s.stop(`@capacitor/core version is ${f}, make sure to use a proper version, using Latest as value is not recommended and will lead to unexpected behavior`),J("Bye \u{1F44B}"),(0,Ce.exit)()):qn(_e(f),_e("6.0.0"))?(s.stop("Error"),p.warn(`@capacitor/core version is ${f}, Capgo only support 2 last Capacitor versions, please update to Capacitor v6 minimum: ${I9}`),J("Bye \u{1F44B}"),(0,Ce.exit)()):qn(_e(f),_e("7.0.0"))&&(s.stop(`@capacitor/core version is ${f}, update to Capacitor v7 minimum: ${R9} to support latest Mobile OS versions`),u="^6.0.0"),n.pm==="unknown"&&(s.stop("Error"),p.warn("Cannot recognize package manager, please run `capgo init` in a capacitor project with npm, pnpm, bun or yarn"),J("Bye \u{1F44B}"),(0,Ce.exit)()),c.get("@capgo/capacitor-updater"))s.stop("Capgo already installed \u2705");else{await(0,sa.execSync)(`${n.installCommand} --force @capgo/capacitor-updater@${u}`,{...Jg,cwd:l.replace("/package.json","")}),s.stop("Install Done \u2705"),o=xr(void 0,l)||"1.0.0";let d=!1;u==="latest"&&(d=await ye({message:`Do you want to set instant updates in ${r}? Read more about it here: https://capgo.app/docs/live-updates/update-behavior/#applying-updates-immediately`}),await Vt(d,t,e)),s.start("Updating config file"),i=!!d;let h=d?{directUpdate:"always",autoSplashscreen:!0}:{};d&&await ig("SplashScreen",{launchAutoHide:!1}),await bs({version:o,appId:r,autoUpdate:!0,...h}),s.stop("Config file updated \u2705")}}else p.info(`If you change your mind, run it for yourself with: "${n.installCommand} @capgo/capacitor-updater@latest"`);return await dr(t,e,"add-updater",r),{pkgVersion:o,delta:i}}async function j9(t,e,r){let n=await ye({message:`Automatic Add "${Zl}" code and import in ${r}?`});if(await Vt(n,t,e),n){let o=we();o.start("Adding @capacitor-updater to your main file");let i=await _l();if(i==="nuxtjs-js"||i==="nuxtjs-ts"){let a=(0,Nn.join)("plugins");(0,ke.existsSync)(a)||(0,ke.mkdirSync)(a,{recursive:!0});let s;i==="nuxtjs-ts"?s=(0,Nn.join)(a,"capacitorUpdater.client.ts"):s=(0,Nn.join)(a,"capacitorUpdater.client.js");let u=`
257
+ ${p}`;(0,Ur.writeFileSync)(t,d,"utf8"),f.success(`Documentation updated in ${t}`)}else(0,Ur.writeFileSync)(t,o,"utf8"),f.success(`Documentation written to ${t}`)}}var la=require("node:child_process"),Pe=require("node:fs"),Ln=require("node:path"),Ce=require("node:process");var rf=me(WF());var Pt=require("node:fs");function KF(t){return t.plugins??={},t.plugins.extConfig??={},t.plugins.CapacitorUpdater??={},t.plugins.CapacitorUpdater}async function I9(t,e=!1){e||Z("Save keys \u{1F511}");let r=await te(),n=t.key||tn,o=t.keyData||"";if(!(0,Pt.existsSync)(n)&&!o)throw e||f.error(`Cannot find a public key at ${n} or as keyData option or in ${r.path}`),new Error("Missing public key");if((0,Pt.existsSync)(n)&&(o=(0,Pt.readFileSync)(n,"utf8")),!o.startsWith("-----BEGIN RSA PUBLIC KEY-----"))throw e||f.error("The public key provided is not a valid RSA Public key"),new Error("Invalid RSA public key");if(r?.config){let i=KF(r.config);i.privateKey&&(delete i.privateKey,e||f.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await ye({message:"Do you want to setup encryption with the new channel in order to support old apps and facilitate the migration?"}))&&(i.defaultChannel="encryption_v2")),i.publicKey=o,await Hi(r)}return e||(f.success(`Public key saved into ${r.path} file in local directory`),f.success("Your app will decode the zip archive with this key")),!0}async function R9(t,e=!1){e||Z("Deleting old private key \u{1F5D1}\uFE0F");let r=await te(),n=r?.config?.plugins?.CapacitorUpdater;if(n?.privateKey){if(delete n.privateKey,await Hi(r),(0,Pt.existsSync)(Ki))try{(0,Pt.unlinkSync)(Ki),e||f.success(`Old private key file deleted: ${Ki}`)}catch(o){e||f.error(`Failed to delete old private key file: ${Ki} (${String(o)})`)}if((0,Pt.existsSync)(xl))try{(0,Pt.unlinkSync)(xl),e||f.success(`Old public key file deleted: ${xl}`)}catch(o){e||f.error(`Failed to delete old public key file: ${tn} (${String(o)})`)}return e||(f.success(`Old private key deleted from ${r.path} file`),J("Done \u2705")),!0}return e||f.info("No old private key found in config file"),!1}async function YF(t){await de(),await I9(t,!1)}async function Jg(t,e=!1){e||Z("Create keys \u{1F511}");let{publicKey:r,privateKey:n}=US();if((0,Pt.existsSync)(tn)&&!t.force)throw e||f.error("Public Key already exists, use --force to overwrite"),new Error("Public key already exists");if((0,Pt.writeFileSync)(tn,r),(0,Pt.existsSync)(Wt)&&!t.force)throw e||f.error("Private Key already exists, use --force to overwrite"),new Error("Private key already exists");(0,Pt.writeFileSync)(Wt,n);let o=await te();if(o){let i=KF(o.config);i.privateKey&&(delete i.privateKey,e||f.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await ye({message:"Do you want to setup encryption with the new channel in order to support old apps and facilitate the migration?"}))&&(i.defaultChannel="encryption_v2")),i.publicKey=r,await Hi(o)}if(!e){f.success("Your RSA key has been generated"),f.success(`Private key saved in ${Wt}`),f.success("This key will be used to encrypt your bundle before sending it to Capgo"),f.success("Keep it safe"),f.success("Then make it unreadable by Capgo and unmodifiable by anyone"),f.success(`Public key saved in ${o.path}`),f.success("Your app will be the only one having it"),f.success("Only your users can decrypt your update"),f.success("Only you can send them an update");try{await $l(),J("Done \u2705")}catch(i){if(i instanceof Error&&i.message==="Capacitor sync cancelled")return!0;throw i}}return!0}async function JF(t){await de(),await Jg(t,!1)}async function XF(t){await de(),await R9(t,!1)}var ln=require("node:fs"),Xg=require("node:os");function ZF(){let t=(0,Xg.homedir)();return(0,ln.existsSync)(`${t}/.capgo`)||(0,ln.existsSync)(".capgo")}async function Zg(t,e,r=!1){if(r||Z("Login to Capgo"),!t)throw r||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");await de();let{local:n}=e;if(n){if(!(0,ln.existsSync)(".git"))throw r||f.error("To use local you should be in a git repository"),new Error("Not in a git repository");(0,ln.writeFileSync)(".capgo",`${t}
258
+ `),(0,ln.appendFileSync)(".gitignore",`.capgo
259
+ `)}else{let a=(0,Xg.homedir)();(0,ln.writeFileSync)(`${a}/.capgo`,`${t}
260
+ `)}let o=await re(t,e.supaHost,e.supaAnon),i=await oe(o,t,["write","all","upload"]);await be(t,{channel:"user-login",event:"User CLI login",icon:"\u2705",user_id:i,notify:!1}).catch(),r||(f.success(`login saved into .capgo file in ${n?"local":"home"} directory`),J("Done \u2705"))}async function QF(t,e){await Zg(t,e,!1)}var eA="import { CapacitorUpdater } from '@capgo/capacitor-updater'",tf="CapacitorUpdater.notifyAppReady()",B9=/import.*from.*/g,Rs="production",Qg={stdio:"pipe"},Bs,Un;function tA(){Bs??=(0,Pe.readdirSync)(rf.default.tmpdir).map(t=>({name:t,full:`${rf.default.tmpdir}/${t}`})).find(t=>t.name.startsWith("capgocli"))?.full??rf.default.fileSync({prefix:"capgocli"}).name}function fr(t,e){try{tA(),(0,Pe.writeFileSync)(Bs,JSON.stringify(e?{step_done:t,pathToPackageJson:e}:{step_done:t,pathToPackageJson:Un})),e&&(Un=e)}catch(r){f.error(`Cannot mark step as done in the CLI, error:
261
+ ${r}`),f.warn("Onboarding will continue but please report it to the capgo team!")}}async function j9(t,e){try{tA();let r=(0,Pe.readFileSync)(Bs,"utf-8");if(!r||r.length===0)return;let{step_done:n,pathToPackageJson:o}=JSON.parse(r);f.info(`You have already got to the step ${n}/10 in the previous session`);let i=await ye({message:"Would you like to continue from where you left off?"});return await qt(i,t,e),i?(o&&(Un=o),n):void 0}catch(r){f.error(`Cannot read which steps have been completed, error:
262
+ ${r}`),f.warn("Onboarding will continue but please report it to the capgo team!");return}}function N9(){if(Bs)try{(0,Pe.rmSync)(Bs)}catch(t){f.error(`Cannot delete the tmp steps file.
263
+ Error: ${t}`)}}async function qt(t,e,r){De(t)&&(await or("onboarding-v2",e,r,"canceled","\u{1F937}"),(0,Ce.exit)())}async function pr(t,e,r,n){return or("onboarding-v2",t,e,`onboarding-step-${r}`,n)}async function L9(t,e,r,n){let o=Qe(),i=await ye({message:`Add ${r} in Capgo?`});if(await qt(i,t.gid,e),i){let a=ve();a.start(`Running: ${o.runner} @capgo/cli@latest app add ${r}`),await hg(r,n,t,!0)?a.stop("App add Done \u2705"):a.stop("App already add \u2705")}else f.info(`If you change your mind, run it for yourself with: "${o.runner} @capgo/cli@latest app add ${r}"`);await pr(t.gid,e,"add-app",r)}async function U9(t,e,r){let n=Qe(),o=await ye({message:`Create default channel ${Rs} for ${r} in Capgo?`});if(await qt(o,t,e),o){let i=ve();i.start(`Running: ${n.runner} @capgo/cli@latest channel add ${Rs} ${r} --default`),await Vg(Rs,r,{default:!0,apikey:e},!0)?i.stop("Channel add Done \u2705"):i.stop("Channel already added \u2705")}else f.info(`If you change your mind, run it for yourself with: "${n.runner} @capgo/cli@latest channel add ${Rs} ${r} --default"`);await pr(t,e,"add-channel",r)}async function M9(t){let e=(0,Ln.join)(yt((0,Ce.cwd)()),Rr),r=Un?await Gt(void 0,Un):await Gt(void 0,e);if(r.size===0||!r.has("@capacitor/core")){f.warn("No adequate dependencies found");let n=await ye({message:"Would you like to select the package.json file manually?"});if(De(n)&&(qn("Operation cancelled."),(0,Ce.exit)(1)),n){let o=await ye({message:"Would you like to use a tree selector to choose the package.json file?"});if(De(o)&&(qn("Operation cancelled."),(0,Ce.exit)(1)),o){let a=(0,Ce.cwd)(),s=Rr;for(;;){let u=(0,Pe.readdirSync)(a).map(c=>({value:c,label:c}));if(u.push({value:"..",label:".."}),s=await gr({message:"Select package.json file:",options:u}),De(s)&&(qn("Operation cancelled."),(0,Ce.exit)(1)),!(0,Pe.statSync)((0,Ln.join)(a,s)).isDirectory()&&s!==Rr){f.error("Selected a file that is not a package.json file");continue}if(a=(0,Ln.join)(a,s),s===Rr)break}return await fr(t,a),{dependencies:await Gt(void 0,a),path:a}}let i=await mr({message:"Enter path to node_modules folder:"});return De(i)&&(qn("Operation cancelled."),(0,Ce.exit)(1)),(0,Pe.existsSync)(i)||(f.error(`Path ${i} does not exist`),(0,Ce.exit)(1)),{dependencies:await Gt(void 0,i),path:i}}}return await fr(t,e),{dependencies:await Gt(void 0,e),path:e}}var q9="https://capacitorjs.com/docs/updating/6-0",H9="https://capacitorjs.com/docs/updating/7-0";async function V9(t,e,r){let n=Qe(),o="1.0.0",i=!1,a=await ye({message:`Automatic Install "@capgo/capacitor-updater" dependency in ${r}?`});if(await qt(a,t,e),a){let s=ve(),u="latest",{dependencies:c,path:l}=await M9(3);s.start("Checking if @capgo/capacitor-updater is installed"),c.has("@capacitor/core")||(s.stop("Error"),f.warn("Cannot find @capacitor/core in package.json"),J("Bye \u{1F44B}"),(0,Ce.exit)());let p=c.get("@capacitor/core");if(p||(s.stop("Error"),f.warn("Cannot find @capacitor/core in package.json, please run `capgo init` in a capacitor project"),J("Bye \u{1F44B}"),(0,Ce.exit)()),p==="latest"?(s.stop(`@capacitor/core version is ${p}, make sure to use a proper version, using Latest as value is not recommended and will lead to unexpected behavior`),J("Bye \u{1F44B}"),(0,Ce.exit)()):Hn(_e(p),_e("6.0.0"))?(s.stop("Error"),f.warn(`@capacitor/core version is ${p}, Capgo only support 2 last Capacitor versions, please update to Capacitor v6 minimum: ${q9}`),J("Bye \u{1F44B}"),(0,Ce.exit)()):Hn(_e(p),_e("7.0.0"))&&(s.stop(`@capacitor/core version is ${p}, update to Capacitor v7 minimum: ${H9} to support latest Mobile OS versions`),u="^6.0.0"),n.pm==="unknown"&&(s.stop("Error"),f.warn("Cannot recognize package manager, please run `capgo init` in a capacitor project with npm, pnpm, bun or yarn"),J("Bye \u{1F44B}"),(0,Ce.exit)()),await rn("@capgo/capacitor-updater",l.replace("/package.json",""),l))s.stop("Capgo already installed \u2705");else{await(0,la.execSync)(`${n.installCommand} --force @capgo/capacitor-updater@${u}`,{...Qg,cwd:l.replace("/package.json","")}),s.stop("Install Done \u2705"),o=_r(void 0,l)||"1.0.0";let h=!1;u==="latest"&&(h=await ye({message:`Do you want to set instant updates in ${r}? Read more about it here: https://capgo.app/docs/live-updates/update-behavior/#applying-updates-immediately`}),await qt(h,t,e)),s.start("Updating config file"),i=!!h;let m=h?{directUpdate:"always",autoSplashscreen:!0}:{};h&&await ug("SplashScreen",{launchAutoHide:!1}),await Cs({version:o,appId:r,autoUpdate:!0,...m}),s.stop("Config file updated \u2705")}}else f.info(`If you change your mind, run it for yourself with: "${n.installCommand} @capgo/capacitor-updater@latest"`);return await pr(t,e,"add-updater",r),{pkgVersion:o,delta:i}}async function z9(t,e,r){let n=await ye({message:`Automatic Add "${tf}" code and import in ${r}?`});if(await qt(n,t,e),n){let o=ve();o.start("Adding @capacitor-updater to your main file");let i=await Fl();if(i==="nuxtjs-js"||i==="nuxtjs-ts"){let a=(0,Ln.join)("plugins");(0,Pe.existsSync)(a)||(0,Pe.mkdirSync)(a,{recursive:!0});let s;i==="nuxtjs-ts"?s=(0,Ln.join)(a,"capacitorUpdater.client.ts"):s=(0,Ln.join)(a,"capacitorUpdater.client.js");let u=`
263
264
  import { CapacitorUpdater } from '@capgo/capacitor-updater'
264
265
 
265
266
  export default defineNuxtPlugin(() => {
266
267
  CapacitorUpdater.notifyAppReady()
267
268
  })
268
- `;(0,ke.existsSync)(s)?(0,ke.readFileSync)(s,"utf8").includes("CapacitorUpdater.notifyAppReady()")?(o.stop("Code already added to capacitorUpdater.client.ts file inside plugins directory \u2705"),p.info("Plugins directory and capacitorUpdater.client.ts file already exist with required code")):((0,ke.writeFileSync)(s,u,"utf8"),o.stop("Code added to capacitorUpdater.client.ts file inside plugins directory \u2705"),p.info("Updated capacitorUpdater.client.ts file with required code")):((0,ke.writeFileSync)(s,u,"utf8"),o.stop("Code added to capacitorUpdater.client.ts file inside plugins directory \u2705"),p.info("Created plugins directory and capacitorUpdater.client.ts file"))}else{let a;if(i==="unknown")a=await r2();else{let f=i.endsWith("-ts");a=await t2(i,f)}if(!a||!(0,ke.existsSync)(a)){o.stop("Cannot find main file to install Updater plugin");let f=await gr({message:"Provide the correct relative path to your main file (JS or TS):",validate:d=>{if(!(0,ke.existsSync)(d))return"File does not exist. Please provide a valid path."}});De(f)&&(Mn("Operation cancelled."),(0,Ce.exit)(1)),a=f}let u=(0,ke.readFileSync)(a,"utf8").toString(),l=u.match(A9)?.pop();if(l||(o.stop("Error"),p.warn("Cannot find import line in main file, use manual installation: https://capgo.app/docs/getting-started/add-an-app/"),J("Bye \u{1F44B}"),(0,Ce.exit)()),u.includes(Zl))o.stop(`Code already added to ${a} \u2705`);else{let f=u.replace(l,`${l}
269
- ${JF};
269
+ `;(0,Pe.existsSync)(s)?(0,Pe.readFileSync)(s,"utf8").includes("CapacitorUpdater.notifyAppReady()")?(o.stop("Code already added to capacitorUpdater.client.ts file inside plugins directory \u2705"),f.info("Plugins directory and capacitorUpdater.client.ts file already exist with required code")):((0,Pe.writeFileSync)(s,u,"utf8"),o.stop("Code added to capacitorUpdater.client.ts file inside plugins directory \u2705"),f.info("Updated capacitorUpdater.client.ts file with required code")):((0,Pe.writeFileSync)(s,u,"utf8"),o.stop("Code added to capacitorUpdater.client.ts file inside plugins directory \u2705"),f.info("Created plugins directory and capacitorUpdater.client.ts file"))}else{let a;if(i==="unknown")a=await iS();else{let p=i.endsWith("-ts");a=await oS(i,p)}if(!a||!(0,Pe.existsSync)(a)){o.stop("Cannot find main file to install Updater plugin");let p=await mr({message:"Provide the correct relative path to your main file (JS or TS):",validate:d=>{if(!(0,Pe.existsSync)(d))return"File does not exist. Please provide a valid path."}});De(p)&&(qn("Operation cancelled."),(0,Ce.exit)(1)),a=p}let u=(0,Pe.readFileSync)(a,"utf8").toString(),l=u.match(B9)?.pop();if(l||(o.stop("Error"),f.warn("Cannot find import line in main file, use manual installation: https://capgo.app/docs/getting-started/add-an-app/"),J("Bye \u{1F44B}"),(0,Ce.exit)()),u.includes(tf))o.stop(`Code already added to ${a} \u2705`);else{let p=u.replace(l,`${l}
270
+ ${eA};
270
271
 
271
- ${Zl};
272
- `);(0,ke.writeFileSync)(a,f,"utf8"),o.stop(`Code added to ${a} \u2705`)}}await dr(t,e,"add-code",r)}else p.info(`Add to your main file the following code:
272
+ ${tf};
273
+ `);(0,Pe.writeFileSync)(a,p,"utf8"),o.stop(`Code added to ${a} \u2705`)}}await pr(t,e,"add-code",r)}else f.info(`Add to your main file the following code:
273
274
 
274
- ${JF};
275
+ ${eA};
275
276
 
276
- ${Zl};
277
- `)}async function N9(t,e,r){let o=(await ft()).get("@capacitor/core");o||p.warn("Cannot find @capacitor/core in package.json. It is likely that you are using a monorepo. Please NOTE that encryption is not supported in Capacitor V5.");let i=Qe(),a=await ye({message:`Automatic configure end-to-end encryption in ${r} updates?`});if(await Vt(a,t,e),a){if(o==="latest"){p.error(`@capacitor/core version is ${o}, make sure to use a proper version, using Latest as value is not recommended and will lead to unexpected behavior`);return}if(o&&qn(_e(o),_e("6.0.0"))){p.warn("Encryption is not supported in Capacitor V5.");return}let s=we();s.start(`Running: ${i.runner} @capgo/cli@latest key create`),await Wg({force:!0},!1)?s.stop("key created \u{1F511}"):(s.stop("Error"),p.warn("Cannot create key \u274C"),J("Bye \u{1F44B}"),(0,Ce.exit)(1));try{await Al(!0,t,e),or("onboarding-v2",t,e,"Use encryption v2",r)}catch(c){if(!(c instanceof Error&&c.message==="Capacitor sync cancelled"))throw c}}await dr(t,e,"add-encryption",r)}async function L9(t,e,r){let n=Qe(),o=await ye({message:`Automatic build ${r} with "${n.pm} run build" ?`});if(await Vt(o,t,e),o){let i=we();i.start("Checking project type");let a=await _l(),s=await sg(a);i.message(`Running: ${n.pm} run ${s} && ${n.runner} cap sync`),og()[s]||(i.stop("Error"),p.warn(`Cannot find ${s} script in package.json, please add it and run \`capgo init\` again`),J("Bye \u{1F44B}"),(0,Ce.exit)()),(0,sa.execSync)(`${n.pm} run ${s} && ${n.runner} cap sync`,Jg),i.stop("Build & Sync Done \u2705")}else p.info(`Build yourself with command: ${n.pm} run build && ${n.runner} cap sync`);await dr(t,e,"build-project",r)}async function U9(t,e,r){let n=Qe(),o=await ye({message:`Run ${r} in device now to test the initial version?`});if(await Vt(o,t,e),o){let i=await Dr({message:"Pick a platform to run your app",options:[{value:"ios",label:"IOS"},{value:"android",label:"Android"}]});De(i)&&(J("Bye \u{1F44B}"),(0,Ce.exit)());let a=i,s=we();s.start(`Running: ${n.runner} cap run ${a}`),await(0,sa.spawnSync)(n.runner,["cap","run",a],{stdio:"inherit"}),s.stop("App started \u2705"),p.info(`\u{1F4F1} Your app should now be running on your ${a} device with Capgo integrated`),p.info("\u{1F504} This is your baseline version - we'll create an update next")}else p.info(`If you change your mind, run it for yourself with: ${n.runner} cap run <ios|android>`);await dr(t,e,"run-device",r)}async function M9(t,e,r,n){p.info("\u{1F3AF} Now let's test Capgo by making a visible change and deploying an update!");let o=await Dr({message:"How would you like to test the update?",options:[{value:"auto",label:"Auto: Let Capgo CLI make a visible change for you"},{value:"manual",label:"Manual: I'll make changes myself"}]});if(De(o)&&(await or("onboarding-v2",t,e,"canceled","\u{1F937}"),(0,Ce.exit)()),o==="auto"){let l=we();l.start("Making automatic changes to test Capgo updates");let f=!1,d=["src/index.html","public/index.html","index.html","src/App.vue","src/app/app.component.html","src/app/home/home.page.html","src/main.css","src/style.css","public/style.css"];for(let h of d)if((0,ke.existsSync)(h)&&!f)try{let m=(0,ke.readFileSync)(h,"utf8"),b=m;if(h.endsWith(".html")?m.includes("<body>")&&!m.includes("capgo-test-banner")&&(b=m.replace("<body>",`<body>
277
+ ${tf};
278
+ `)}async function G9(t,e,r){let o=(await Gt()).get("@capacitor/core");o||f.warn("Cannot find @capacitor/core in package.json. It is likely that you are using a monorepo. Please NOTE that encryption is not supported in Capacitor V5.");let i=Qe(),a=await ye({message:`Automatic configure end-to-end encryption in ${r} updates?`});if(await qt(a,t,e),a){if(o==="latest"){f.error(`@capacitor/core version is ${o}, make sure to use a proper version, using Latest as value is not recommended and will lead to unexpected behavior`);return}if(o&&Hn(_e(o),_e("6.0.0"))){f.warn("Encryption is not supported in Capacitor V5.");return}let s=ve();s.start(`Running: ${i.runner} @capgo/cli@latest key create`),await Jg({force:!0},!1)?s.stop("key created \u{1F511}"):(s.stop("Error"),f.warn("Cannot create key \u274C"),J("Bye \u{1F44B}"),(0,Ce.exit)(1));try{await $l(!0,t,e),or("onboarding-v2",t,e,"Use encryption v2",r)}catch(c){if(!(c instanceof Error&&c.message==="Capacitor sync cancelled"))throw c}}await pr(t,e,"add-encryption",r)}async function W9(t,e,r){let n=Qe(),o=await ye({message:`Automatic build ${r} with "${n.pm} run build" ?`});if(await qt(o,t,e),o){let i=ve();i.start("Checking project type");let a=await Fl(),s=await lg(a);i.message(`Running: ${n.pm} run ${s} && ${n.runner} cap sync`),sg()[s]||(i.stop("Error"),f.warn(`Cannot find ${s} script in package.json, please add it and run \`capgo init\` again`),J("Bye \u{1F44B}"),(0,Ce.exit)()),(0,la.execSync)(`${n.pm} run ${s} && ${n.runner} cap sync`,Qg),i.stop("Build & Sync Done \u2705")}else f.info(`Build yourself with command: ${n.pm} run build && ${n.runner} cap sync`);await pr(t,e,"build-project",r)}async function K9(t,e,r){let n=Qe(),o=await ye({message:`Run ${r} in device now to test the initial version?`});if(await qt(o,t,e),o){let i=await gr({message:"Pick a platform to run your app",options:[{value:"ios",label:"IOS"},{value:"android",label:"Android"}]});De(i)&&(J("Bye \u{1F44B}"),(0,Ce.exit)());let a=i,s=ve();s.start(`Running: ${n.runner} cap run ${a}`),await(0,la.spawnSync)(n.runner,["cap","run",a],{stdio:"inherit"}),s.stop("App started \u2705"),f.info(`\u{1F4F1} Your app should now be running on your ${a} device with Capgo integrated`),f.info("\u{1F504} This is your baseline version - we'll create an update next")}else f.info(`If you change your mind, run it for yourself with: ${n.runner} cap run <ios|android>`);await pr(t,e,"run-device",r)}async function Y9(t,e,r,n){f.info("\u{1F3AF} Now let's test Capgo by making a visible change and deploying an update!");let o=await gr({message:"How would you like to test the update?",options:[{value:"auto",label:"Auto: Let Capgo CLI make a visible change for you"},{value:"manual",label:"Manual: I'll make changes myself"}]});if(De(o)&&(await or("onboarding-v2",t,e,"canceled","\u{1F937}"),(0,Ce.exit)()),o==="auto"){let l=ve();l.start("Making automatic changes to test Capgo updates");let p=!1,d=["src/index.html","public/index.html","index.html","src/App.vue","src/app/app.component.html","src/app/home/home.page.html","src/main.css","src/style.css","public/style.css"];for(let h of d)if((0,Pe.existsSync)(h)&&!p)try{let m=(0,Pe.readFileSync)(h,"utf8"),b=m;if(h.endsWith(".html")?m.includes("<body>")&&!m.includes("capgo-test-banner")&&(b=m.replace("<body>",`<body>
278
279
  <div id="capgo-test-banner" style="background: linear-gradient(90deg, #4CAF50, #2196F3); color: white; padding: 15px; text-align: center; font-weight: bold; position: fixed; top: env(safe-area-inset-top, 0); left: env(safe-area-inset-left, 0); right: env(safe-area-inset-right, 0); z-index: 9999; box-shadow: 0 2px 10px rgba(0,0,0,0.1); padding-top: calc(15px + env(safe-area-inset-top, 0));">
279
280
  \u{1F680} Capgo Update Test - This banner shows the update worked!
280
281
  </div>
@@ -289,106 +290,113 @@ body {
289
290
  /* capgo-test-background */
290
291
  }
291
292
 
292
- ${m}`)),b!==m){(0,ke.writeFileSync)(h,b,"utf8"),l.stop(`\u2705 Made test changes to ${h}`),p.info("\u{1F4DD} Added visible test modification to verify the update works"),f=!0;break}}catch{}if(!f){l.stop("\u26A0\uFE0F Could not automatically modify files"),p.warn("Please make a visible change manually (like editing a text or color)");let h=await ye({message:"Continue after making your changes?"});await Vt(h,t,e)}}else{p.info("\u270B Please make a visible change to your app now (example: change a text, color, or add an element)"),p.info("\u{1F4A1} This change will help you see that Capgo updates work correctly");let l=await ye({message:"Have you made your changes and ready to continue?"});await Vt(l,t,e)}let i="1.0.1";try{let l=_e(n);i=br(ga(l,"patch"))}catch{i="1.0.1"}let a=await Dr({message:"How do you want to handle the version for this update?",options:[{value:"auto",label:`Auto: Bump patch version (${n} \u2192 ${i})`},{value:"manual",label:"Manual: I'll provide the version number"}]});De(a)&&(await or("onboarding-v2",t,e,"canceled","\u{1F937}"),(0,Ce.exit)());let s=n;if(a==="auto")try{let l=_e(n);s=br(ga(l,"patch")),p.info(`\u{1F522} Auto-bumped version from ${n} to ${s}`)}catch{s="1.0.1",p.warn(`Could not parse version ${n}, using fallback ${s}`)}else{let l=await gr({message:`Current version is ${n}. Enter new version:`,validate:f=>{if(!f.match(/^\d+\.\d+\.\d+/))return"Please enter a valid version (x.y.z)"}});De(l)&&(await or("onboarding-v2",t,e,"canceled","\u{1F937}"),(0,Ce.exit)()),s=l}let u=Qe(),c=await ye({message:`Build ${r} with changes before uploading? If you need to build yourself please do it now in other terminal, and then select no`});if(await Vt(c,t,e),c){let l=we();l.start("Checking project type");let f=await _l(),d=await sg(f);l.message(`Running: ${u.pm} run ${d} && ${u.runner} cap sync`),og()[d]||(l.stop("Error"),p.warn(`Cannot find ${d} script in package.json, please add it and run \`capgo init\` again`),J("Bye \u{1F44B}"),(0,Ce.exit)()),(0,sa.execSync)(`${u.pm} run ${d} && ${u.runner} cap sync`,Jg),l.stop("\u2705 Build with changes completed"),p.info("\u{1F4E6} Your modifications have been built and synced")}else p.info(`Build yourself with command: ${u.pm} run build && ${u.runner} cap sync`);return await dr(t,e,"add-code-change",r),s}async function q9(t,e,r,n,o){let i=Qe(),a=await ye({message:`Upload the updated ${r} bundle (v${n}) to Capgo?`});if(await Vt(a,t,e),a){let s=we(),u;s.start(`Running: ${i.runner} @capgo/cli@latest bundle upload ${o?"--delta-only":""}`);let c=G1((0,Ce.cwd)());Ln&&c&&(p.warn("You are most likely using a monorepo, please provide the path to your package.json file AND node_modules path folder when uploading your bundle"),p.warn(`Example: ${i.runner} @capgo/cli@latest bundle upload --package-json ./packages/my-app/package.json --node-modules ./packages/my-app/node_modules ${o?"--delta-only":""}`),u=(0,Nn.join)(vt((0,Ce.cwd)()),"node_modules"),p.warn(`Guessed node modules path at: ${u}`),(0,ke.existsSync)(u)||(p.error("Node modules path does not exist, upload skipped"),J("Bye \u{1F44B}"),(0,Ce.exit)(1))),(await Ug(r,{channel:Ps,apikey:e,packageJson:c?Ln:void 0,nodeModules:c?u:void 0,deltaOnly:o,bundle:n},!1))?.success?(s.stop(`\u2705 Update v${n} uploaded successfully!`),p.info("\u{1F389} Your updated bundle is now available on Capgo")):(s.stop("Error"),p.warn("Upload failed \u274C"),J("Bye \u{1F44B}"),(0,Ce.exit)())}else p.info(`Upload yourself with command: ${i.runner} @capgo/cli@latest bundle upload`);await dr(t,e,"upload",r)}async function H9(t,e,r,n,o){p.info("\u{1F9EA} Time to test the Capgo update system!"),p.info("\u{1F4F1} Go to your device where the app is running"),o?(p.info("\u{1F504} IMPORTANT: Background your app (swipe up/press home button) and then reopen it"),p.info("\u23F1\uFE0F The update should be downloaded and applied automatically")):(p.info("\u{1F4F1} With standard updates, you will need to:"),p.info(" 1. Background the app (swipe up/press home button) to start download"),p.info(" 2. Wait a few seconds for download to complete"),p.info(" 3. Background and foreground again to see the update")),p.info("\u{1F440} You should see your changes appear in the app!");let i=await ye({message:"Monitor Capgo logs to verify the update worked?"});await Vt(i,t,e),i?(p.info(`\u{1F4CA} Watching logs from ${r}...`),p.info("\u{1F504} Please background and reopen your app now to trigger the update"),await Uh("onboarding-v2",e,r,e,t)):p.info(`\u{1F4CA} Check logs manually at ${n}/app/p/${r}/logs to verify the update`),await dr(t,e,"test-update",r)}async function ZF(t,e,r){let n=Qe();Z("Capgo onboarding \u{1F6EB}"),await de();let o=!r.supaAnon||!r.supaHost?await te():await bs({statsUrl:`${r.supaHost}/functions/v1/stats`,channelUrl:`${r.supaHost}/functions/v1/channel_self`,updateUrl:`${r.supaHost}/functions/v1/updates`,localApiFiles:`${r.supaHost}/functions/v1`,localS3:!0,localSupa:r.supaHost,localSupaAnon:r.supaAnon}),i=await ir();e=he(e,o?.config),r.apikey=t||ie(),e===void 0&&(e=await gr({message:"Enter your appId:"}),De(e)&&(Mn("Operation cancelled."),(0,Ce.exit)(1)));let a=we();(!KF()||t)&&(a.start(`Running: ${n.runner} @capgo/cli@latest login ***`),await Yg(r.apikey,r,!1),a.stop("Login Done \u2705"));let s=await ne(r.apikey,r.supaHost,r.supaAnon);await oe(s,r.apikey,["upload","all","read","write"]);let u=await Yi(s,["admin","super_admin"]),c=u.gid,l=await O9(c,r.apikey)??0,f=xr(void 0,Ln)||"1.0.0",d=!1,h=f;try{if(l<1&&await dr(c,r.apikey,"add-app",e),l<2&&(await $9(u,r.apikey,e,r),pr(2)),l<3&&(await P9(c,r.apikey,e),pr(3)),l<4){let m=await B9(c,r.apikey,e);f=m.pkgVersion,h=f,d=m.delta,pr(4)}l<5&&(await j9(c,r.apikey,e),pr(5)),l<6&&(await N9(c,r.apikey,e),pr(6)),l<7&&(await L9(c,r.apikey,e),pr(7)),l<8&&(await U9(c,r.apikey,e),pr(8)),l<9&&(h=await M9(c,r.apikey,e,f),pr(9)),l<10&&(await q9(c,r.apikey,e,h,d),pr(10)),l<11&&(await H9(c,r.apikey,e,i.hostWeb,d),pr(11)),await dr(c,r.apikey,"done",e),k9()}catch(m){console.error(m),p.error(`Error during onboarding.
293
+ ${m}`)),b!==m){(0,Pe.writeFileSync)(h,b,"utf8"),l.stop(`\u2705 Made test changes to ${h}`),f.info("\u{1F4DD} Added visible test modification to verify the update works"),p=!0;break}}catch{}if(!p){l.stop("\u26A0\uFE0F Could not automatically modify files"),f.warn("Please make a visible change manually (like editing a text or color)");let h=await ye({message:"Continue after making your changes?"});await qt(h,t,e)}}else{f.info("\u270B Please make a visible change to your app now (example: change a text, color, or add an element)"),f.info("\u{1F4A1} This change will help you see that Capgo updates work correctly");let l=await ye({message:"Have you made your changes and ready to continue?"});await qt(l,t,e)}let i="1.0.1";try{let l=_e(n);i=yr(ba(l,"patch"))}catch{i="1.0.1"}let a=await gr({message:"How do you want to handle the version for this update?",options:[{value:"auto",label:`Auto: Bump patch version (${n} \u2192 ${i})`},{value:"manual",label:"Manual: I'll provide the version number"}]});De(a)&&(await or("onboarding-v2",t,e,"canceled","\u{1F937}"),(0,Ce.exit)());let s=n;if(a==="auto")try{let l=_e(n);s=yr(ba(l,"patch")),f.info(`\u{1F522} Auto-bumped version from ${n} to ${s}`)}catch{s="1.0.1",f.warn(`Could not parse version ${n}, using fallback ${s}`)}else{let l=await mr({message:`Current version is ${n}. Enter new version:`,validate:p=>{if(!p.match(/^\d+\.\d+\.\d+/))return"Please enter a valid version (x.y.z)"}});De(l)&&(await or("onboarding-v2",t,e,"canceled","\u{1F937}"),(0,Ce.exit)()),s=l}let u=Qe(),c=await ye({message:`Build ${r} with changes before uploading? If you need to build yourself please do it now in other terminal, and then select no`});if(await qt(c,t,e),c){let l=ve();l.start("Checking project type");let p=await Fl(),d=await lg(p);l.message(`Running: ${u.pm} run ${d} && ${u.runner} cap sync`),sg()[d]||(l.stop("Error"),f.warn(`Cannot find ${d} script in package.json, please add it and run \`capgo init\` again`),J("Bye \u{1F44B}"),(0,Ce.exit)()),(0,la.execSync)(`${u.pm} run ${d} && ${u.runner} cap sync`,Qg),l.stop("\u2705 Build with changes completed"),f.info("\u{1F4E6} Your modifications have been built and synced")}else f.info(`Build yourself with command: ${u.pm} run build && ${u.runner} cap sync`);return await pr(t,e,"add-code-change",r),s}async function J9(t,e,r,n,o){let i=Qe(),a=await ye({message:`Upload the updated ${r} bundle (v${n}) to Capgo?`});if(await qt(a,t,e),a){let s=ve(),u;s.start(`Running: ${i.runner} @capgo/cli@latest bundle upload ${o?"--delta-only":""}`);let c=Y1((0,Ce.cwd)());Un&&c&&(f.warn("You are most likely using a monorepo, please provide the path to your package.json file AND node_modules path folder when uploading your bundle"),f.warn(`Example: ${i.runner} @capgo/cli@latest bundle upload --package-json ./packages/my-app/package.json --node-modules ./packages/my-app/node_modules ${o?"--delta-only":""}`),u=(0,Ln.join)(yt((0,Ce.cwd)()),"node_modules"),f.warn(`Guessed node modules path at: ${u}`),(0,Pe.existsSync)(u)||(f.error("Node modules path does not exist, upload skipped"),J("Bye \u{1F44B}"),(0,Ce.exit)(1))),(await Hg(r,{channel:Rs,apikey:e,packageJson:c?Un:void 0,nodeModules:c?u:void 0,deltaOnly:o,bundle:n},!1))?.success?(s.stop(`\u2705 Update v${n} uploaded successfully!`),f.info("\u{1F389} Your updated bundle is now available on Capgo")):(s.stop("Error"),f.warn("Upload failed \u274C"),J("Bye \u{1F44B}"),(0,Ce.exit)())}else f.info(`Upload yourself with command: ${i.runner} @capgo/cli@latest bundle upload`);await pr(t,e,"upload",r)}async function X9(t,e,r,n,o){f.info("\u{1F9EA} Time to test the Capgo update system!"),f.info("\u{1F4F1} Go to your device where the app is running"),o?(f.info("\u{1F504} IMPORTANT: Background your app (swipe up/press home button) and then reopen it"),f.info("\u23F1\uFE0F The update should be downloaded and applied automatically")):(f.info("\u{1F4F1} With standard updates, you will need to:"),f.info(" 1. Background the app (swipe up/press home button) to start download"),f.info(" 2. Wait a few seconds for download to complete"),f.info(" 3. Background and foreground again to see the update")),f.info("\u{1F440} You should see your changes appear in the app!");let i=await ye({message:"Monitor Capgo logs to verify the update worked?"});await qt(i,t,e),i?(f.info(`\u{1F4CA} Watching logs from ${r}...`),f.info("\u{1F504} Please background and reopen your app now to trigger the update"),await Hh("onboarding-v2",e,r,e,t)):f.info(`\u{1F4CA} Check logs manually at ${n}/app/p/${r}/logs to verify the update`),await pr(t,e,"test-update",r)}async function rA(t,e,r){let n=Qe();Z("Capgo onboarding \u{1F6EB}"),await de();let o=!r.supaAnon||!r.supaHost?await te():await Cs({statsUrl:`${r.supaHost}/functions/v1/stats`,channelUrl:`${r.supaHost}/functions/v1/channel_self`,updateUrl:`${r.supaHost}/functions/v1/updates`,localApiFiles:`${r.supaHost}/functions/v1`,localS3:!0,localSupa:r.supaHost,localSupaAnon:r.supaAnon}),i=await ir();e=he(e,o?.config),r.apikey=t||ie(),e===void 0&&(e=await mr({message:"Enter your appId:"}),De(e)&&(qn("Operation cancelled."),(0,Ce.exit)(1)));let a=ve();(!ZF()||t)&&(a.start(`Running: ${n.runner} @capgo/cli@latest login ***`),await Zg(r.apikey,r,!1),a.stop("Login Done \u2705"));let s=await re(r.apikey,r.supaHost,r.supaAnon);await oe(s,r.apikey,["upload","all","read","write"]);let u=await Zi(s,["admin","super_admin"]),c=u.gid,l=await j9(c,r.apikey)??0,p=_r(void 0,Un)||"1.0.0",d=!1,h=p;try{if(l<1&&await pr(c,r.apikey,"add-app",e),l<2&&(await L9(u,r.apikey,e,r),fr(2)),l<3&&(await U9(c,r.apikey,e),fr(3)),l<4){let m=await V9(c,r.apikey,e);p=m.pkgVersion,h=p,d=m.delta,fr(4)}l<5&&(await z9(c,r.apikey,e),fr(5)),l<6&&(await G9(c,r.apikey,e),fr(6)),l<7&&(await W9(c,r.apikey,e),fr(7)),l<8&&(await K9(c,r.apikey,e),fr(8)),l<9&&(h=await Y9(c,r.apikey,e,p),fr(9)),l<10&&(await J9(c,r.apikey,e,h,d),fr(10)),l<11&&(await X9(c,r.apikey,e,i.hostWeb,d),fr(11)),await pr(c,r.apikey,"done",e),N9()}catch(m){console.error(m),f.error(`Error during onboarding.
293
294
  if the error persists please contact support@capgo.app
294
- Or use manual installation: https://capgo.app/docs/getting-started/add-an-app/`),(0,Ce.exit)(1)}p.info("Welcome onboard \u2708\uFE0F!"),p.info("Your Capgo update system is setup"),p.info(`Next time use \`${n.runner} @capgo/cli@latest bundle upload\` to only upload your bundle`),p.info(`If you have any issue try to use the debug command \`${n.runner} @capgo/cli@latest app debug\``),J("Bye \u{1F44B}"),(0,Ce.exit)()}async function V9(t,e=!1){e||Z("Adding organization"),await de();let r={...t,apikey:t.apikey||ie()};if(!r.apikey)throw e||p.error("Missing API key, you need to provide an API key to add an organization"),new Error("Missing API key");let n=await ne(r.apikey,r.supaHost,r.supaAnon),o=await oe(n,r.apikey,["write","all"]),{name:i,email:a}=r;if(!e&&!i){let c=await gr({message:"Organization name:",placeholder:"My Organization"});if(De(c))throw p.error("Canceled adding organization"),new Error("Organization creation cancelled");i=c}if(!e&&!a){let c=await gr({message:"Management email:",placeholder:"admin@example.com"});if(De(c))throw p.error("Canceled adding organization"),new Error("Organization creation cancelled");a=c}if(!i||!a)throw e||p.error("Missing arguments, you need to provide an organization name and management email"),new Error("Missing organization name or management email");e||p.info(`Adding organization "${i}" to Capgo`);let{data:s,error:u}=await n.from("orgs").insert({name:i,management_email:a,created_by:o}).select().single();if(u)throw e||p.error(`Could not add organization ${U(u)}`),new Error(`Could not add organization: ${U(u)}`);return await be(r.apikey,{channel:"organization",event:"Organization Created",icon:"\u{1F3E2}",user_id:s.id,tags:{"org-name":i},notify:!1}).catch(()=>{}),e||(p.success(`Organization "${i}" added to Capgo`),J("Done \u2705")),s}async function Xg(t){await V9(t,!1)}async function z9(t,e,r=!1){r||Z("Deleting organization"),await de();let n={...e,apikey:e.apikey||ie()};if(!n.apikey)throw r||p.error("Missing API key, you need to provide an API key to delete an organization"),new Error("Missing API key");if(!t)throw r||p.error("Missing argument, you need to provide an organization ID"),new Error("Missing organization id");let o=await ne(n.apikey,n.supaHost,n.supaAnon),i=await oe(o,n.apikey,["write","all"]),{data:a,error:s}=await o.from("orgs").select("created_by, name").eq("id",t).single();if(s||!a)throw r||p.error(`Cannot get organization details ${U(s)}`),new Error(`Cannot get organization details: ${U(s)}`);if(a.created_by!==i){if(r)throw new Error("Deleting an organization is restricted to the organization owner");p.warn("Deleting an organization is restricted to the organization owner"),p.warn("You are not the owner of this organization"),p.warn("It's strongly recommended that you do not continue!");let c=await Dr({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(De(c)||c==="no")throw p.error("Canceled deleting the organization"),new Error("Organization deletion cancelled")}if(!r&&!n.autoConfirm){let c=await ye({message:`Are you sure you want to delete organization "${a.name}"? This action cannot be undone.`});if(De(c)||!c)throw p.error("Canceled deleting the organization"),new Error("Organization deletion cancelled")}r||p.info(`Deleting organization "${a.name}"`);let{error:u}=await o.from("orgs").delete().eq("id",t);if(u)throw r||p.error(`Could not delete organization ${U(u)}`),new Error(`Could not delete organization: ${U(u)}`);return await be(n.apikey,{channel:"organization",event:"Organization Deleted",icon:"\u{1F5D1}\uFE0F",user_id:t,tags:{"org-name":a.name},notify:!1}).catch(()=>{}),r||(p.success(`Organization "${a.name}" deleted from Capgo`),J("Done \u2705")),!0}async function Zg(t,e){await z9(t,e,!1)}function G9(t,e){if(e)return;if(!t.length){p.error("No organizations found");return}let r=new ot;r.headers=["Name","ID","Role","Apps"],r.rows=[];for(let n of t.toReversed())r.rows.push([n.name??"Unknown",n.gid,n.role,n.app_count?.toString()||"0"]);p.success("Organizations"),p.success(r.toString())}async function W9(t,e=!1){e||Z("List organizations"),await de();let r={...t,apikey:t.apikey||ie()};if(!r.apikey)throw e||p.error("Missing API key, you need to provide an API key to list organizations"),new Error("Missing API key");let n=await ne(r.apikey,r.supaHost,r.supaAnon);await oe(n,r.apikey,["read","write","all"]),e||p.info("Getting organizations from Capgo");let{error:o,data:i}=await n.rpc("get_orgs_v6");if(o)throw e||p.error(`Cannot get organizations ${U(o)}`),new Error(`Cannot get organizations: ${U(o)}`);let a=i||[];return e||(p.info(`Organizations found: ${a.length}`),G9(a,e),J("Done \u2705")),a}async function Qg(t){await W9(t,!1)}async function K9(t,e,r=!1){r||Z("Updating organization"),await de();let n={...e,apikey:e.apikey||ie()};if(!n.apikey)throw r||p.error("Missing API key, you need to provide an API key to update an organization"),new Error("Missing API key");if(!t)throw r||p.error("Missing argument, you need to provide an organization ID"),new Error("Missing organization id");let o=await ne(n.apikey,n.supaHost,n.supaAnon);await oe(o,n.apikey,["write","all"]);let{data:i,error:a}=await o.from("orgs").select("name, management_email, created_by").eq("id",t).single();if(a||!i)throw r||p.error(`Cannot get organization details ${U(a)}`),new Error(`Cannot get organization details: ${U(a)}`);let{name:s,email:u}=n;if(!r&&!s){let l=await gr({message:"New organization name:",placeholder:i.name||"My Organization"});if(De(l))throw p.error("Canceled updating organization"),new Error("Organization update cancelled");s=l}if(!r&&!u){let l=await gr({message:"Management email:",placeholder:i.management_email||"admin@example.com"});if(De(l))throw p.error("Canceled updating organization"),new Error("Organization update cancelled");u=l}if(!s||!u)throw r||p.error("Missing arguments, you need to provide an organization name and management email"),new Error("Missing organization name or management email");r||p.info(`Updating organization "${t}"`);let{error:c}=await o.from("orgs").update({name:s,management_email:u}).eq("id",t);if(c)throw r||p.error(`Could not update organization ${U(c)}`),new Error(`Could not update organization: ${U(c)}`);return await be(n.apikey,{channel:"organization",event:"Organization Updated",icon:"\u270F\uFE0F",user_id:t,tags:{"org-name":s},notify:!1}).catch(()=>{}),r||(p.success("Organization updated"),J("Done \u2705")),{orgId:t,name:s,email:u}}async function eD(t,e){await K9(t,e,!1)}async function Y9(t,e=!1){e||Z("Getting user id");let r={...t,apikey:t.apikey||ie()};if(!r.apikey)throw e||p.error("Missing API key, you need to provide an API key to fetch the user id"),new Error("Missing API key");try{let n=await ne(r.apikey,r.supaHost,r.supaAnon),o=await oe(n,r.apikey,["read","all","write"]);return e||J(`Done \u2705: ${o}`),o}catch(n){throw e||p.error(`Error getting user id ${U(n)}`),n instanceof Error?n:new Error(String(n))}}async function QF(t){await Y9(t,!1)}var K={apikey:"API key to link to your account",supaHost:"Custom Supabase host URL (for self-hosting or Capgo development)",supaAnon:"Custom Supabase anon key (for self-hosting)",packageJson:"Paths to package.json files for monorepos (comma-separated)",nodeModules:"Paths to node_modules directories for monorepos (comma-separated)",verbose:"Enable verbose output"};pt.name(mr.name).description("\u{1F4E6} Manage packages and bundle versions in Capgo Cloud").version(mr.version,"-v, --version","output the current version");pt.command("init [apikey] [appId]").alias("i").description(`\u{1F680} Initialize a new app in Capgo Cloud with step-by-step guidance.
295
+ Or use manual installation: https://capgo.app/docs/getting-started/add-an-app/`),(0,Ce.exit)(1)}f.info("Welcome onboard \u2708\uFE0F!"),f.info("Your Capgo update system is setup"),f.info(`Next time use \`${n.runner} @capgo/cli@latest bundle upload\` to only upload your bundle`),f.info(`If you have any issue try to use the debug command \`${n.runner} @capgo/cli@latest app debug\``),J("Bye \u{1F44B}"),(0,Ce.exit)()}async function Z9(t,e=!1){e||Z("Adding organization"),await de();let r={...t,apikey:t.apikey||ie()};if(!r.apikey)throw e||f.error("Missing API key, you need to provide an API key to add an organization"),new Error("Missing API key");let n=await re(r.apikey,r.supaHost,r.supaAnon),o=await oe(n,r.apikey,["write","all"]),{name:i,email:a}=r;if(!e&&!i){let c=await mr({message:"Organization name:",placeholder:"My Organization"});if(De(c))throw f.error("Canceled adding organization"),new Error("Organization creation cancelled");i=c}if(!e&&!a){let c=await mr({message:"Management email:",placeholder:"admin@example.com"});if(De(c))throw f.error("Canceled adding organization"),new Error("Organization creation cancelled");a=c}if(!i||!a)throw e||f.error("Missing arguments, you need to provide an organization name and management email"),new Error("Missing organization name or management email");e||f.info(`Adding organization "${i}" to Capgo`);let{data:s,error:u}=await n.from("orgs").insert({name:i,management_email:a,created_by:o}).select().single();if(u)throw e||f.error(`Could not add organization ${L(u)}`),new Error(`Could not add organization: ${L(u)}`);return await be(r.apikey,{channel:"organization",event:"Organization Created",icon:"\u{1F3E2}",user_id:s.id,tags:{"org-name":i},notify:!1}).catch(()=>{}),e||(f.success(`Organization "${i}" added to Capgo`),J("Done \u2705")),s}async function eD(t){await Z9(t,!1)}async function Q9(t,e,r=!1){r||Z("Deleting organization"),await de();let n={...e,apikey:e.apikey||ie()};if(!n.apikey)throw r||f.error("Missing API key, you need to provide an API key to delete an organization"),new Error("Missing API key");if(!t)throw r||f.error("Missing argument, you need to provide an organization ID"),new Error("Missing organization id");let o=await re(n.apikey,n.supaHost,n.supaAnon),i=await oe(o,n.apikey,["write","all"]),{data:a,error:s}=await o.from("orgs").select("created_by, name").eq("id",t).single();if(s||!a)throw r||f.error(`Cannot get organization details ${L(s)}`),new Error(`Cannot get organization details: ${L(s)}`);if(a.created_by!==i){if(r)throw new Error("Deleting an organization is restricted to the organization owner");f.warn("Deleting an organization is restricted to the organization owner"),f.warn("You are not the owner of this organization"),f.warn("It's strongly recommended that you do not continue!");let c=await gr({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(De(c)||c==="no")throw f.error("Canceled deleting the organization"),new Error("Organization deletion cancelled")}if(!r&&!n.autoConfirm){let c=await ye({message:`Are you sure you want to delete organization "${a.name}"? This action cannot be undone.`});if(De(c)||!c)throw f.error("Canceled deleting the organization"),new Error("Organization deletion cancelled")}r||f.info(`Deleting organization "${a.name}"`);let{error:u}=await o.from("orgs").delete().eq("id",t);if(u)throw r||f.error(`Could not delete organization ${L(u)}`),new Error(`Could not delete organization: ${L(u)}`);return await be(n.apikey,{channel:"organization",event:"Organization Deleted",icon:"\u{1F5D1}\uFE0F",user_id:t,tags:{"org-name":a.name},notify:!1}).catch(()=>{}),r||(f.success(`Organization "${a.name}" deleted from Capgo`),J("Done \u2705")),!0}async function tD(t,e){await Q9(t,e,!1)}function e7(t,e){if(e)return;if(!t.length){f.error("No organizations found");return}let r=new it;r.headers=["Name","ID","Role","Apps"],r.rows=[];for(let n of t.toReversed())r.rows.push([n.name??"Unknown",n.gid,n.role,n.app_count?.toString()||"0"]);f.success("Organizations"),f.success(r.toString())}async function t7(t,e=!1){e||Z("List organizations"),await de();let r={...t,apikey:t.apikey||ie()};if(!r.apikey)throw e||f.error("Missing API key, you need to provide an API key to list organizations"),new Error("Missing API key");let n=await re(r.apikey,r.supaHost,r.supaAnon);await oe(n,r.apikey,["read","write","all"]),e||f.info("Getting organizations from Capgo");let{error:o,data:i}=await n.rpc("get_orgs_v6");if(o)throw e||f.error(`Cannot get organizations ${L(o)}`),new Error(`Cannot get organizations: ${L(o)}`);let a=i||[];return e||(f.info(`Organizations found: ${a.length}`),e7(a,e),J("Done \u2705")),a}async function rD(t){await t7(t,!1)}async function r7(t,e,r=!1){r||Z("Updating organization"),await de();let n={...e,apikey:e.apikey||ie()};if(!n.apikey)throw r||f.error("Missing API key, you need to provide an API key to update an organization"),new Error("Missing API key");if(!t)throw r||f.error("Missing argument, you need to provide an organization ID"),new Error("Missing organization id");let o=await re(n.apikey,n.supaHost,n.supaAnon);await oe(o,n.apikey,["write","all"]);let{data:i,error:a}=await o.from("orgs").select("name, management_email, created_by").eq("id",t).single();if(a||!i)throw r||f.error(`Cannot get organization details ${L(a)}`),new Error(`Cannot get organization details: ${L(a)}`);let{name:s,email:u}=n;if(!r&&!s){let l=await mr({message:"New organization name:",placeholder:i.name||"My Organization"});if(De(l))throw f.error("Canceled updating organization"),new Error("Organization update cancelled");s=l}if(!r&&!u){let l=await mr({message:"Management email:",placeholder:i.management_email||"admin@example.com"});if(De(l))throw f.error("Canceled updating organization"),new Error("Organization update cancelled");u=l}if(!s||!u)throw r||f.error("Missing arguments, you need to provide an organization name and management email"),new Error("Missing organization name or management email");r||f.info(`Updating organization "${t}"`);let{error:c}=await o.from("orgs").update({name:s,management_email:u}).eq("id",t);if(c)throw r||f.error(`Could not update organization ${L(c)}`),new Error(`Could not update organization: ${L(c)}`);return await be(n.apikey,{channel:"organization",event:"Organization Updated",icon:"\u270F\uFE0F",user_id:t,tags:{"org-name":s},notify:!1}).catch(()=>{}),r||(f.success("Organization updated"),J("Done \u2705")),{orgId:t,name:s,email:u}}async function nD(t,e){await r7(t,e,!1)}async function n7(t,e=!1){e||Z("Getting user id");let r={...t,apikey:t.apikey||ie()};if(!r.apikey)throw e||f.error("Missing API key, you need to provide an API key to fetch the user id"),new Error("Missing API key");try{let n=await re(r.apikey,r.supaHost,r.supaAnon),o=await oe(n,r.apikey,["read","all","write"]);return e||J(`Done \u2705: ${o}`),o}catch(n){throw e||f.error(`Error getting user id ${L(n)}`),n instanceof Error?n:new Error(String(n))}}async function nA(t){await n7(t,!1)}var z={apikey:"API key to link to your account",supaHost:"Custom Supabase host URL (for self-hosting or Capgo development)",supaAnon:"Custom Supabase anon key (for self-hosting)",packageJson:"Paths to package.json files for monorepos (comma-separated)",nodeModules:"Paths to node_modules directories for monorepos (comma-separated)",verbose:"Enable verbose output"};nt.name(hr.name).description("\u{1F4E6} Manage packages and bundle versions in Capgo Cloud").version(hr.version,"-v, --version","output the current version");nt.command("init [apikey] [appId]").alias("i").description(`\u{1F680} Initialize a new app in Capgo Cloud with step-by-step guidance.
295
296
 
296
297
  This includes adding code for updates, building, uploading your app, and verifying update functionality.
297
298
 
298
- Example: npx @capgo/cli@latest init YOUR_API_KEY com.example.app`).action(ZF).option("-n, --name <name>","App name for display in Capgo Cloud").option("-i, --icon <icon>","App icon path for display in Capgo Cloud").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);pt.command("doctor").description(`\u{1F468}\u200D\u2695\uFE0F Check if your Capgo app installation is up-to-date and gather information useful for bug reports.
299
+ Example: npx @capgo/cli@latest init YOUR_API_KEY com.example.app`).action(rA).option("-n, --name <name>","App name for display in Capgo Cloud").option("-i, --icon <icon>","App icon path for display in Capgo Cloud").option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);nt.command("doctor").description(`\u{1F468}\u200D\u2695\uFE0F Check if your Capgo app installation is up-to-date and gather information useful for bug reports.
299
300
 
300
301
  This command helps diagnose issues with your setup.
301
302
 
302
- Example: npx @capgo/cli@latest doctor`).option("--package-json <packageJson>",K.packageJson).action(async(...t)=>{let e=t.at(-1);await g2(e)});pt.command("login [apikey]").alias("l").description(`\u{1F511} Save your Capgo API key to your machine or local folder for easier access to Capgo Cloud services.
303
+ Example: npx @capgo/cli@latest doctor`).option("--package-json <packageJson>",z.packageJson).action(async(...t)=>{let e=t.at(-1);await bS(e)});nt.command("login [apikey]").alias("l").description(`\u{1F511} Save your Capgo API key to your machine or local folder for easier access to Capgo Cloud services.
303
304
 
304
305
  Use --apikey=******** in any command to override it.
305
306
 
306
- Example: npx @capgo/cli@latest login YOUR_API_KEY`).action(YF).option("--local","Only save in local folder, git ignored for security.").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);var Un=pt.command("bundle").description("\u{1F4E6} Manage app bundles for deployment in Capgo Cloud, including upload, compatibility checks, and encryption.");Un.command("upload [appId]").alias("u").description(`\u2B06\uFE0F Upload a new app bundle to Capgo Cloud for distribution.
307
+ Example: npx @capgo/cli@latest login YOUR_API_KEY`).action(QF).option("--local","Only save in local folder, git ignored for security.").option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);var Mn=nt.command("bundle").description("\u{1F4E6} Manage app bundles for deployment in Capgo Cloud, including upload, compatibility checks, and encryption.");Mn.command("upload [appId]").alias("u").description(`\u2B06\uFE0F Upload a new app bundle to Capgo Cloud for distribution.
307
308
 
308
309
  Version must be > 0.0.0 and unique. Deleted versions cannot be reused for security.
309
310
 
310
311
  External option: Store only a URL link (useful for apps >200MB or privacy requirements).
311
312
  Capgo never inspects external content. Add encryption for trustless security.
312
313
 
313
- Example: npx @capgo/cli@latest bundle upload com.example.app --path ./dist --channel production`).action(hF).option("-a, --apikey <apikey>",K.apikey).option("-p, --path <path>","Path of the folder to upload, if not provided it will use the webDir set in capacitor.config").option("-c, --channel <channel>","Channel to link to").option("-e, --external <url>","Link to external URL instead of upload to Capgo Cloud").option("--iv-session-key <key>","Set the IV and session key for bundle URL external").option("--s3-region <region>","Region for your S3 bucket").option("--s3-apikey <apikey>","API key for your S3 endpoint").option("--s3-apisecret <apisecret>","API secret for your S3 endpoint").option("--s3-endpoint <s3Endpoint>","URL of S3 endpoint").option("--s3-bucket-name <bucketName>","Name for your AWS S3 bucket").option("--s3-port <port>","Port for your S3 endpoint").option("--no-s3-ssl","Disable SSL for S3 upload").option("--key-v2 <key>","Custom path for private signing key (v2 system)").option("--key-data-v2 <keyDataV2>","Private signing key (v2 system)").option("--bundle-url","Prints bundle URL into stdout").option("--no-key","Ignore signing key and send clear update").option("--no-code-check","Ignore checking if notifyAppReady() is called in source code and index present in root folder").option("--display-iv-session","Show in the console the IV and session key used to encrypt the update").option("-b, --bundle <bundle>","Bundle version number of the bundle to upload").option("--link <link>","Link to external resource (e.g. GitHub release)").option("--comment <comment>","Comment about this version, could be a release note, a commit hash, a commit message, etc.").option("--min-update-version <minUpdateVersion>","Minimal version required to update to this version. Used only if the disable auto update is set to metadata in channel").option("--auto-min-update-version","Set the min update version based on native packages").option("--ignore-metadata-check","Ignores the metadata (node_modules) check when uploading").option("--ignore-checksum-check","Ignores the checksum check when uploading").option("--timeout <timeout>","Timeout for the upload process in seconds").option("--multipart","[DEPRECATED] Use --tus instead. Uses multipart protocol for S3 uploads").option("--zip","Upload the bundle using zip to Capgo cloud (legacy)").option("--tus","Upload the bundle using TUS to Capgo cloud").option("--tus-chunk-size <tusChunkSize>","Chunk size in bytes for TUS resumable uploads (default: auto)").option("--partial","[DEPRECATED] Use --delta instead. Upload incremental updates").option("--partial-only","[DEPRECATED] Use --delta-only instead. Upload only incremental updates, skip full bundle").option("--delta","Upload incremental/differential updates to reduce bandwidth").option("--delta-only","Upload only delta updates without full bundle (useful for large apps)").option("--encrypted-checksum <encryptedChecksum>","An encrypted checksum (signature). Used only when uploading an external bundle.").option("--auto-set-bundle","Set the bundle in capacitor.config.json").option("--dry-upload","Dry upload the bundle process, mean it will not upload the files but add the row in database (Used by Capgo for internal testing)").option("--package-json <packageJson>",K.packageJson).option("--node-modules <nodeModules>",K.nodeModules).option("--encrypt-partial","Encrypt delta update files (auto-enabled for updater > 6.14.4)").option("--delete-linked-bundle-on-upload","Locates the currently linked bundle in the channel you are trying to upload to, and deletes it").option("--no-brotli-patterns <patterns>",'Files to exclude from Brotli compression (comma-separated globs, e.g., "*.jpg,*.png")').option("--disable-brotli","Completely disable brotli compression even if updater version supports it").option("--version-exists-ok","Exit successfully if bundle version already exists, useful for CI/CD workflows with monorepos").option("--self-assign","Allow devices to auto-join this channel (updates channel setting)").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon).option("--verbose",K.verbose);Un.command("compatibility [appId]").description(`\u{1F9EA} Check compatibility of a bundle with a specific channel in Capgo Cloud to ensure updates are safe.
314
+ Example: npx @capgo/cli@latest bundle upload com.example.app --path ./dist --channel production`).action(bF).option("-a, --apikey <apikey>",z.apikey).option("-p, --path <path>","Path of the folder to upload, if not provided it will use the webDir set in capacitor.config").option("-c, --channel <channel>","Channel to link to").option("-e, --external <url>","Link to external URL instead of upload to Capgo Cloud").option("--iv-session-key <key>","Set the IV and session key for bundle URL external").option("--s3-region <region>","Region for your S3 bucket").option("--s3-apikey <apikey>","API key for your S3 endpoint").option("--s3-apisecret <apisecret>","API secret for your S3 endpoint").option("--s3-endpoint <s3Endpoint>","URL of S3 endpoint").option("--s3-bucket-name <bucketName>","Name for your AWS S3 bucket").option("--s3-port <port>","Port for your S3 endpoint").option("--no-s3-ssl","Disable SSL for S3 upload").option("--key-v2 <key>","Custom path for private signing key (v2 system)").option("--key-data-v2 <keyDataV2>","Private signing key (v2 system)").option("--bundle-url","Prints bundle URL into stdout").option("--no-key","Ignore signing key and send clear update").option("--no-code-check","Ignore checking if notifyAppReady() is called in source code and index present in root folder").option("--display-iv-session","Show in the console the IV and session key used to encrypt the update").option("-b, --bundle <bundle>","Bundle version number of the bundle to upload").option("--link <link>","Link to external resource (e.g. GitHub release)").option("--comment <comment>","Comment about this version, could be a release note, a commit hash, a commit message, etc.").option("--min-update-version <minUpdateVersion>","Minimal version required to update to this version. Used only if the disable auto update is set to metadata in channel").option("--auto-min-update-version","Set the min update version based on native packages").option("--ignore-metadata-check","Ignores the metadata (node_modules) check when uploading").option("--ignore-checksum-check","Ignores the checksum check when uploading").option("--timeout <timeout>","Timeout for the upload process in seconds").option("--multipart","[DEPRECATED] Use --tus instead. Uses multipart protocol for S3 uploads").option("--zip","Upload the bundle using zip to Capgo cloud (legacy)").option("--tus","Upload the bundle using TUS to Capgo cloud").option("--tus-chunk-size <tusChunkSize>","Chunk size in bytes for TUS resumable uploads (default: auto)").option("--partial","[DEPRECATED] Use --delta instead. Upload incremental updates").option("--partial-only","[DEPRECATED] Use --delta-only instead. Upload only incremental updates, skip full bundle").option("--delta","Upload incremental/differential updates to reduce bandwidth").option("--delta-only","Upload only delta updates without full bundle (useful for large apps)").option("--encrypted-checksum <encryptedChecksum>","An encrypted checksum (signature). Used only when uploading an external bundle.").option("--auto-set-bundle","Set the bundle in capacitor.config.json").option("--dry-upload","Dry upload the bundle process, mean it will not upload the files but add the row in database (Used by Capgo for internal testing)").option("--package-json <packageJson>",z.packageJson).option("--node-modules <nodeModules>",z.nodeModules).option("--encrypt-partial","Encrypt delta update files (auto-enabled for updater > 6.14.4)").option("--delete-linked-bundle-on-upload","Locates the currently linked bundle in the channel you are trying to upload to, and deletes it").option("--no-brotli-patterns <patterns>",'Files to exclude from Brotli compression (comma-separated globs, e.g., "*.jpg,*.png")').option("--disable-brotli","Completely disable brotli compression even if updater version supports it").option("--version-exists-ok","Exit successfully if bundle version already exists, useful for CI/CD workflows with monorepos").option("--self-assign","Allow devices to auto-join this channel (updates channel setting)").option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon).option("--verbose",z.verbose);Mn.command("compatibility [appId]").description(`\u{1F9EA} Check compatibility of a bundle with a specific channel in Capgo Cloud to ensure updates are safe.
314
315
 
315
- Example: npx @capgo/cli@latest bundle compatibility com.example.app --channel production`).action($2).option("-a, --apikey <apikey>",K.apikey).option("-c, --channel <channel>","Channel to check the compatibility with").option("--text","Output text instead of emojis").option("--package-json <packageJson>",K.packageJson).option("--node-modules <nodeModules>",K.nodeModules).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);Un.command("delete [bundleId] [appId]").alias("d").description(`\u{1F5D1}\uFE0F Delete a specific bundle from Capgo Cloud, optionally targeting a single version.
316
+ Example: npx @capgo/cli@latest bundle compatibility com.example.app --channel production`).action(jS).option("-a, --apikey <apikey>",z.apikey).option("-c, --channel <channel>","Channel to check the compatibility with").option("--text","Output text instead of emojis").option("--package-json <packageJson>",z.packageJson).option("--node-modules <nodeModules>",z.nodeModules).option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);Mn.command("delete [bundleId] [appId]").alias("d").description(`\u{1F5D1}\uFE0F Delete a specific bundle from Capgo Cloud, optionally targeting a single version.
316
317
 
317
- Example: npx @capgo/cli@latest bundle delete BUNDLE_ID com.example.app`).action(async(t,e,r)=>{await j2(t,e,r)}).option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);Un.command("list [appId]").alias("l").description(`\u{1F4CB} List all bundles uploaded for an app in Capgo Cloud.
318
+ Example: npx @capgo/cli@latest bundle delete BUNDLE_ID com.example.app`).action(async(t,e,r)=>{await HS(t,e,r)}).option("-a, --apikey <apikey>",z.apikey).option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);Mn.command("list [appId]").alias("l").description(`\u{1F4CB} List all bundles uploaded for an app in Capgo Cloud.
318
319
 
319
- Example: npx @capgo/cli@latest bundle list com.example.app`).action(async(t,e)=>{await L2(t,e)}).option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);Un.command("cleanup [appId]").alias("c").description(`\u{1F9F9} Delete old bundles in Capgo Cloud, keeping specified number of recent versions.
320
+ Example: npx @capgo/cli@latest bundle list com.example.app`).action(async(t,e)=>{await zS(t,e)}).option("-a, --apikey <apikey>",z.apikey).option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);Mn.command("cleanup [appId]").alias("c").description(`\u{1F9F9} Delete old bundles in Capgo Cloud, keeping specified number of recent versions.
320
321
 
321
322
  Bundles linked to channels are preserved unless --ignore-channel is used.
322
323
 
323
- Example: npx @capgo/cli@latest bundle cleanup com.example.app --bundle=1.0 --keep=3`).action(async(t,e)=>{await k2(t,e)}).option("-b, --bundle <bundle>","Bundle version number of the app to delete").option("-a, --apikey <apikey>",K.apikey).option("-k, --keep <keep>","Number of versions to keep").option("-f, --force","Force removal").option("--ignore-channel","Delete bundles even if linked to channels (WARNING: deletes channels too)").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);Un.command("encrypt [zipPath] [checksum]").description(`\u{1F512} Encrypt a zip bundle for secure external storage.
324
+ Example: npx @capgo/cli@latest bundle cleanup com.example.app --bundle=1.0 --keep=3`).action(async(t,e)=>{await BS(t,e)}).option("-b, --bundle <bundle>","Bundle version number of the app to delete").option("-a, --apikey <apikey>",z.apikey).option("-k, --keep <keep>","Number of versions to keep").option("-f, --force","Force removal").option("--ignore-channel","Delete bundles even if linked to channels (WARNING: deletes channels too)").option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);Mn.command("encrypt [zipPath] [checksum]").description(`\u{1F512} Encrypt a zip bundle for secure external storage.
324
325
 
325
326
  Returns ivSessionKey for upload/decryption. Get checksum using 'bundle zip --json'.
326
327
 
327
- Example: npx @capgo/cli@latest bundle encrypt ./myapp.zip CHECKSUM`).action(N2).option("--key <key>","Custom path for private signing key").option("--key-data <keyData>","Private signing key").option("-j, --json","Output in JSON");Un.command("decrypt [zipPath] [checksum]").description(`\u{1F513} Decrypt an encrypted bundle (mainly for testing).
328
+ Example: npx @capgo/cli@latest bundle encrypt ./myapp.zip CHECKSUM`).action(VS).option("--key <key>","Custom path for private signing key").option("--key-data <keyData>","Private signing key").option("-j, --json","Output in JSON");Mn.command("decrypt [zipPath] [checksum]").description(`\u{1F513} Decrypt an encrypted bundle (mainly for testing).
328
329
 
329
330
  Prints base64 session key for verification.
330
331
 
331
- Example: npx @capgo/cli@latest bundle decrypt ./myapp_encrypted.zip CHECKSUM`).action(B2).option("--key <key>","Custom path for private signing key").option("--key-data <keyData>","Private signing key").option("--checksum <checksum>","Checksum of the bundle, to verify the integrity of the bundle");Un.command("zip [appId]").description(`\u{1F5DC}\uFE0F Create a zip file of your app bundle.
332
+ Example: npx @capgo/cli@latest bundle decrypt ./myapp_encrypted.zip CHECKSUM`).action(qS).option("--key <key>","Custom path for private signing key").option("--key-data <keyData>","Private signing key").option("--checksum <checksum>","Checksum of the bundle, to verify the integrity of the bundle");Mn.command("zip [appId]").description(`\u{1F5DC}\uFE0F Create a zip file of your app bundle.
332
333
 
333
334
  Returns checksum for use with encryption. Use --json for machine-readable output.
334
335
 
335
- Example: npx @capgo/cli@latest bundle zip com.example.app --path ./dist`).action(yF).option("-p, --path <path>","Path of the folder to upload, if not provided it will use the webDir set in capacitor.config").option("-b, --bundle <bundle>","Bundle version number to name the zip file").option("-n, --name <name>","Name of the zip file").option("-j, --json","Output in JSON").option("--no-code-check","Ignore checking if notifyAppReady() is called in source code and index present in root folder").option("--key-v2","Use encryption v2").option("--package-json <packageJson>",K.packageJson);var ua=pt.command("app").description("\u{1F4F1} Manage your Capgo app settings and configurations in Capgo Cloud.");ua.command("add [appId]").alias("a").description(`\u2795 Add a new app to Capgo Cloud with a unique app ID in the format com.test.app.
336
+ Example: npx @capgo/cli@latest bundle zip com.example.app --path ./dist`).action(CF).option("-p, --path <path>","Path of the folder to upload, if not provided it will use the webDir set in capacitor.config").option("-b, --bundle <bundle>","Bundle version number to name the zip file").option("-n, --name <name>","Name of the zip file").option("-j, --json","Output in JSON").option("--no-code-check","Ignore checking if notifyAppReady() is called in source code and index present in root folder").option("--key-v2","Use encryption v2").option("--package-json <packageJson>",z.packageJson);var fa=nt.command("app").description("\u{1F4F1} Manage your Capgo app settings and configurations in Capgo Cloud.");fa.command("add [appId]").alias("a").description(`\u2795 Add a new app to Capgo Cloud with a unique app ID in the format com.test.app.
336
337
 
337
338
  All options can be guessed from config if not provided.
338
339
 
339
- Example: npx @capgo/cli@latest app add com.example.app --name "My App" --icon ./icon.png`).action(p2).option("-n, --name <name>","App name for display in Capgo Cloud").option("-i, --icon <icon>","App icon path for display in Capgo Cloud").option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);ua.command("delete [appId]").description(`\u{1F5D1}\uFE0F Delete an app from Capgo Cloud, optionally specifying a version to delete only that bundle.
340
+ Example: npx @capgo/cli@latest app add com.example.app --name "My App" --icon ./icon.png`).action(mS).option("-n, --name <name>","App name for display in Capgo Cloud").option("-i, --icon <icon>","App icon path for display in Capgo Cloud").option("-a, --apikey <apikey>",z.apikey).option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);fa.command("delete [appId]").description(`\u{1F5D1}\uFE0F Delete an app from Capgo Cloud, optionally specifying a version to delete only that bundle.
340
341
 
341
- Example: npx @capgo/cli@latest app delete com.example.app`).action(async(t,e)=>{await d2(t,e)}).option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);ua.command("list").alias("l").description(`\u{1F4CB} List all apps registered under your account in Capgo Cloud.
342
+ Example: npx @capgo/cli@latest app delete com.example.app`).action(async(t,e)=>{await gS(t,e)}).option("-a, --apikey <apikey>",z.apikey).option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);fa.command("list").alias("l").description(`\u{1F4CB} List all apps registered under your account in Capgo Cloud.
342
343
 
343
- Example: npx @capgo/cli@latest app list`).action(async t=>{await D2(t)}).option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);ua.command("debug [appId]").action(OC).description(`\u{1F41E} Listen for live update events in Capgo Cloud to debug your app.
344
+ Example: npx @capgo/cli@latest app list`).action(async t=>{await wS(t)}).option("-a, --apikey <apikey>",z.apikey).option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);fa.command("debug [appId]").action(PC).description(`\u{1F41E} Listen for live update events in Capgo Cloud to debug your app.
344
345
 
345
346
  Optionally target a specific device for detailed diagnostics.
346
347
 
347
- Example: npx @capgo/cli@latest app debug com.example.app --device DEVICE_ID`).option("-a, --apikey <apikey>",K.apikey).option("-d, --device <device>","The specific device ID to debug").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);ua.command("setting [path]").description(`\u2699\uFE0F Modify Capacitor configuration programmatically.
348
+ Example: npx @capgo/cli@latest app debug com.example.app --device DEVICE_ID`).option("-a, --apikey <apikey>",z.apikey).option("-d, --device <device>","The specific device ID to debug").option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);fa.command("setting [path]").description(`\u2699\uFE0F Modify Capacitor configuration programmatically.
348
349
 
349
350
  Specify setting path (e.g., plugins.CapacitorUpdater.defaultChannel) with --string or --bool.
350
351
 
351
- Example: npx @capgo/cli@latest app setting plugins.CapacitorUpdater.defaultChannel --string "Production"`).option("--bool <bool>","A value for the setting to modify as a boolean, ex: --bool true").option("--string <string>",'A value for the setting to modify as a string, ex: --string "Production"').action(v2);ua.command("set [appId]").alias("s").description(`\u2699\uFE0F Update settings for an existing app in Capgo Cloud, such as name, icon, or retention period for bundles.
352
+ Example: npx @capgo/cli@latest app setting plugins.CapacitorUpdater.defaultChannel --string "Production"`).option("--bool <bool>","A value for the setting to modify as a boolean, ex: --bool true").option("--string <string>",'A value for the setting to modify as a string, ex: --string "Production"').action(ES);fa.command("set [appId]").alias("s").description(`\u2699\uFE0F Update settings for an existing app in Capgo Cloud, such as name, icon, or retention period for bundles.
352
353
 
353
354
  Retention of 0 means infinite storage.
354
355
 
355
- Example: npx @capgo/cli@latest app set com.example.app --name "Updated App" --retention 30`).action(async(t,e)=>{await b2(t,e)}).option("-n, --name <name>","App name for display in Capgo Cloud").option("-i, --icon <icon>","App icon path for display in Capgo Cloud").option("-a, --apikey <apikey>",K.apikey).option("-r, --retention <retention>","Days to keep old bundles (0 = infinite, default: 0)").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);var Is=pt.command("channel").description("\u{1F4E2} Manage distribution channels for app updates in Capgo Cloud, controlling how updates are delivered to devices.");Is.command("add [channelId] [appId]").alias("a").description(`\u2795 Create a new channel for app distribution in Capgo Cloud to manage update delivery.
356
+ Example: npx @capgo/cli@latest app set com.example.app --name "Updated App" --retention 30`).action(async(t,e)=>{await CS(t,e)}).option("-n, --name <name>","App name for display in Capgo Cloud").option("-i, --icon <icon>","App icon path for display in Capgo Cloud").option("-a, --apikey <apikey>",z.apikey).option("-r, --retention <retention>","Days to keep old bundles (0 = infinite, default: 0)").option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);var js=nt.command("channel").description("\u{1F4E2} Manage distribution channels for app updates in Capgo Cloud, controlling how updates are delivered to devices.");js.command("add [channelId] [appId]").alias("a").description(`\u2795 Create a new channel for app distribution in Capgo Cloud to manage update delivery.
356
357
 
357
- Example: npx @capgo/cli@latest channel add production com.example.app --default`).action(bF).option("-d, --default","Set the channel as default").option("--self-assign","Allow device to self-assign to this channel").option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);Is.command("delete [channelId] [appId]").alias("d").description(`\u{1F5D1}\uFE0F Delete a channel from Capgo Cloud, optionally removing associated bundles to free up resources.
358
+ Example: npx @capgo/cli@latest channel add production com.example.app --default`).action(EF).option("-d, --default","Set the channel as default").option("--self-assign","Allow device to self-assign to this channel").option("-a, --apikey <apikey>",z.apikey).option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);js.command("delete [channelId] [appId]").alias("d").description(`\u{1F5D1}\uFE0F Delete a channel from Capgo Cloud, optionally removing associated bundles to free up resources.
358
359
 
359
- Example: npx @capgo/cli@latest channel delete production com.example.app`).action(async(t,e,r)=>{await wF(t,e,r)}).option("-a, --apikey <apikey>",K.apikey).option("--delete-bundle","Delete the bundle associated with the channel").option("--success-if-not-found","Success if the channel is not found").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);Is.command("list [appId]").alias("l").description(`\u{1F4CB} List all channels configured for an app in Capgo Cloud to review distribution settings.
360
+ Example: npx @capgo/cli@latest channel delete production com.example.app`).action(async(t,e,r)=>{await xF(t,e,r)}).option("-a, --apikey <apikey>",z.apikey).option("--delete-bundle","Delete the bundle associated with the channel").option("--success-if-not-found","Success if the channel is not found").option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);js.command("list [appId]").alias("l").description(`\u{1F4CB} List all channels configured for an app in Capgo Cloud to review distribution settings.
360
361
 
361
- Example: npx @capgo/cli@latest channel list com.example.app`).action(async(t,e)=>{await CF(t,e)}).option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);Is.command("currentBundle [channel] [appId]").description(`\u{1F4E6} Get the current bundle linked to a specific channel in Capgo Cloud for update tracking.
362
+ Example: npx @capgo/cli@latest channel list com.example.app`).action(async(t,e)=>{await SF(t,e)}).option("-a, --apikey <apikey>",z.apikey).option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);js.command("currentBundle [channel] [appId]").description(`\u{1F4E6} Get the current bundle linked to a specific channel in Capgo Cloud for update tracking.
362
363
 
363
- Example: npx @capgo/cli@latest channel currentBundle production com.example.app`).action(async(t,e,r)=>{await vF(t,e,r)}).option("-c, --channel <channel>","Channel to get the current bundle from").option("-a, --apikey <apikey>",K.apikey).option("--quiet","Only print the bundle version").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);Is.command("set [channelId] [appId]").alias("s").description(`\u2699\uFE0F Configure settings for a channel, such as linking a bundle, setting update strategies (major, minor, metadata, patch, none), or device targeting (iOS, Android, dev, emulator).
364
+ Example: npx @capgo/cli@latest channel currentBundle production com.example.app`).action(async(t,e,r)=>{await _F(t,e,r)}).option("-c, --channel <channel>","Channel to get the current bundle from").option("-a, --apikey <apikey>",z.apikey).option("--quiet","Only print the bundle version").option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);js.command("set [channelId] [appId]").alias("s").description(`\u2699\uFE0F Configure settings for a channel, such as linking a bundle, setting update strategies (major, minor, metadata, patch, none), or device targeting (iOS, Android, dev, emulator).
364
365
 
365
366
  One channel must be default.
366
367
 
367
- Example: npx @capgo/cli@latest channel set production com.example.app --bundle 1.0.0 --state default`).action(async(t,e,r)=>{await _F(t,e,r)}).option("-a, --apikey <apikey>",K.apikey).option("-b, --bundle <bundle>","Bundle version number of the file to set").option("-s, --state <state>","Set the state of the channel, default or normal").option("--latest-remote","Get the latest bundle uploaded in capgo cloud and set it to the channel").option("--latest","Get the latest version key in the package.json to set it to the channel").option("--downgrade","Allow to downgrade to version under native one").option("--no-downgrade","Disable downgrade to version under native one").option("--ios","Allow sending update to iOS devices").option("--no-ios","Disable sending update to iOS devices").option("--android","Allow sending update to Android devices").option("--no-android","Disable sending update to Android devices").option("--self-assign","Allow device to self-assign to this channel").option("--no-self-assign","Disable devices to self-assign to this channel").option("--disable-auto-update <disableAutoUpdate>","Block updates by type: major, minor, metadata, patch, or none (allows all)").option("--dev","Allow sending update to development devices").option("--no-dev","Disable sending update to development devices").option("--emulator","Allow sending update to emulator devices").option("--no-emulator","Disable sending update to emulator devices").option("--package-json <packageJson>",K.packageJson).option("--ignore-metadata-check","Ignore checking node_modules compatibility if present in the bundle").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);var tD=pt.command("key").description("\u{1F510} Manage encryption keys for secure bundle distribution in Capgo Cloud, supporting end-to-end encryption with RSA and AES combination.");tD.command("save").description(`\u{1F4BE} Save the public key in the Capacitor config, useful for CI environments.
368
+ Example: npx @capgo/cli@latest channel set production com.example.app --bundle 1.0.0 --state default`).action(async(t,e,r)=>{await AF(t,e,r)}).option("-a, --apikey <apikey>",z.apikey).option("-b, --bundle <bundle>","Bundle version number of the file to set").option("-s, --state <state>","Set the state of the channel, default or normal").option("--latest-remote","Get the latest bundle uploaded in capgo cloud and set it to the channel").option("--latest","Get the latest version key in the package.json to set it to the channel").option("--downgrade","Allow to downgrade to version under native one").option("--no-downgrade","Disable downgrade to version under native one").option("--ios","Allow sending update to iOS devices").option("--no-ios","Disable sending update to iOS devices").option("--android","Allow sending update to Android devices").option("--no-android","Disable sending update to Android devices").option("--self-assign","Allow device to self-assign to this channel").option("--no-self-assign","Disable devices to self-assign to this channel").option("--disable-auto-update <disableAutoUpdate>","Block updates by type: major, minor, metadata, patch, or none (allows all)").option("--dev","Allow sending update to development devices").option("--no-dev","Disable sending update to development devices").option("--emulator","Allow sending update to emulator devices").option("--no-emulator","Disable sending update to emulator devices").option("--package-json <packageJson>",z.packageJson).option("--ignore-metadata-check","Ignore checking node_modules compatibility if present in the bundle").option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);var oD=nt.command("key").description("\u{1F510} Manage encryption keys for secure bundle distribution in Capgo Cloud, supporting end-to-end encryption with RSA and AES combination.");oD.command("save").description(`\u{1F4BE} Save the public key in the Capacitor config, useful for CI environments.
368
369
 
369
370
  Recommended not to commit the key for security.
370
371
 
371
- Example: npx @capgo/cli@latest key save --key ./path/to/key.pub`).action(zF).option("-f, --force","Force generate a new one").option("--key <key>","Key path to save in Capacitor config").option("--key-data <keyData>","Key data to save in Capacitor config");tD.command("create").description(`\u{1F528} Create RSA key pair for end-to-end encryption.
372
+ Example: npx @capgo/cli@latest key save --key ./path/to/key.pub`).action(YF).option("-f, --force","Force generate a new one").option("--key <key>","Key path to save in Capacitor config").option("--key-data <keyData>","Key data to save in Capacitor config");oD.command("create").description(`\u{1F528} Create RSA key pair for end-to-end encryption.
372
373
 
373
374
  Creates .capgo_key_v2 (private) and .capgo_key_v2.pub (public) in project root.
374
375
  Public key is saved to capacitor.config for mobile app decryption.
375
376
  NEVER commit the private key - store it securely!
376
377
 
377
- Example: npx @capgo/cli@latest key create`).action(GF).option("-f, --force","Force generate a new one");tD.command("delete_old").description(`\u{1F9F9} Delete the old encryption key from the Capacitor config to ensure only the current key is used.
378
+ Example: npx @capgo/cli@latest key create`).action(JF).option("-f, --force","Force generate a new one");oD.command("delete_old").description(`\u{1F9F9} Delete the old encryption key from the Capacitor config to ensure only the current key is used.
378
379
 
379
- Example: npx @capgo/cli@latest key delete_old`).action(WF);var J9=pt.command("account").description("\u{1F464} Manage your Capgo account details and retrieve information for support or collaboration.");J9.command("id").description(`\u{1FAAA} Retrieve your account ID, safe to share for collaboration or support purposes in Discord or other platforms.
380
+ Example: npx @capgo/cli@latest key delete_old`).action(XF);var o7=nt.command("account").description("\u{1F464} Manage your Capgo account details and retrieve information for support or collaboration.");o7.command("id").description(`\u{1FAAA} Retrieve your account ID, safe to share for collaboration or support purposes in Discord or other platforms.
380
381
 
381
- Example: npx @capgo/cli@latest account id`).action(QF).option("-a, --apikey <apikey>",K.apikey);var tf=pt.command("organisation").description("\u{1F3E2} Manage your organizations in Capgo Cloud for team collaboration and app management.");tf.command("list").alias("l").description(`\u{1F4CB} List all organizations you have access to in Capgo Cloud.
382
+ Example: npx @capgo/cli@latest account id`).action(nA).option("-a, --apikey <apikey>",z.apikey);var of=nt.command("organisation").description("\u{1F3E2} Manage your organizations in Capgo Cloud for team collaboration and app management.");of.command("list").alias("l").description(`\u{1F4CB} List all organizations you have access to in Capgo Cloud.
382
383
 
383
- Example: npx @capgo/cli@latest organisation list`).action(Qg).option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);tf.command("add").alias("a").description(`\u2795 Create a new organization in Capgo Cloud for team collaboration.
384
+ Example: npx @capgo/cli@latest organisation list`).action(rD).option("-a, --apikey <apikey>",z.apikey).option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);of.command("add").alias("a").description(`\u2795 Create a new organization in Capgo Cloud for team collaboration.
384
385
 
385
- Example: npx @capgo/cli@latest organisation add --name "My Company" --email admin@mycompany.com`).action(Xg).option("-n, --name <name>","Organization name").option("-e, --email <email>","Management email for the organization").option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);tf.command("set [orgId]").alias("s").description(`\u2699\uFE0F Update organization settings such as name and management email.
386
+ Example: npx @capgo/cli@latest organisation add --name "My Company" --email admin@mycompany.com`).action(eD).option("-n, --name <name>","Organization name").option("-e, --email <email>","Management email for the organization").option("-a, --apikey <apikey>",z.apikey).option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);of.command("set [orgId]").alias("s").description(`\u2699\uFE0F Update organization settings such as name and management email.
386
387
 
387
- Example: npx @capgo/cli@latest organisation set ORG_ID --name "Updated Company Name"`).action(eD).option("-n, --name <name>","Organization name").option("-e, --email <email>","Management email for the organization").option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);tf.command("delete [orgId]").alias("d").description(`\u{1F5D1}\uFE0F Delete an organization from Capgo Cloud. This action cannot be undone.
388
+ Example: npx @capgo/cli@latest organisation set ORG_ID --name "Updated Company Name"`).action(nD).option("-n, --name <name>","Organization name").option("-e, --email <email>","Management email for the organization").option("-a, --apikey <apikey>",z.apikey).option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);of.command("delete [orgId]").alias("d").description(`\u{1F5D1}\uFE0F Delete an organization from Capgo Cloud. This action cannot be undone.
388
389
 
389
390
  Only organization owners can delete organizations.
390
391
 
391
- Example: npx @capgo/cli@latest organisation delete ORG_ID`).action(Zg).option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);pt.command("generate-docs [filePath]").description("Generate Markdown documentation for CLI commands - either for README or individual files").option("--folder <folderPath>","Generate individual markdown files for each command in the specified folder (instead of updating README)").action((t,e)=>{xF(t,e.folder)});pt.exitOverride();pt.configureOutput({writeErr:t=>{}});pt.parseAsync().catch(t=>{if(typeof t=="object"&&t!==null&&"code"in t){let e=t;(e.code==="commander.version"||e.code==="commander.helpDisplayed")&&(0,ef.exit)(0),e.message&&console.error(e.message);let r=e.exitCode??1;(0,ef.exit)(r)}console.error(`Error: ${U(t)}`),(0,ef.exit)(1)});
392
+ Example: npx @capgo/cli@latest organisation delete ORG_ID`).action(tD).option("-a, --apikey <apikey>",z.apikey).option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);nt.command("build [appId]").description(`\u{1F3D7}\uFE0F Request a native iOS/Android build from Capgo Cloud.
393
+
394
+ \u26A0\uFE0F This feature is currently in PRIVATE BETA and cannot be used by anyone at this time.
395
+
396
+ This command will zip your project directory and upload it to Capgo for building.
397
+ The build will be processed in the cloud and artifacts will be available when complete.
398
+
399
+ Example: npx @capgo/cli@latest build com.example.app --platform ios --path .`).action(SS).option("--path <path>","Path to the project directory to build (default: current directory)").option("--platform <platform>","Target platform: ios, android, or both (default: both)").option("--build-mode <buildMode>","Build mode: debug or release (default: release)").option("--build-config <buildConfig>","Additional build configuration as JSON string").option("-a, --apikey <apikey>",z.apikey).option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);nt.command("generate-docs [filePath]").description("Generate Markdown documentation for CLI commands - either for README or individual files").option("--folder <folderPath>","Generate individual markdown files for each command in the specified folder (instead of updating README)").action((t,e)=>{OF(t,e.folder)});nt.exitOverride();nt.configureOutput({writeErr:t=>{}});nt.parseAsync().catch(t=>{if(typeof t=="object"&&t!==null&&"code"in t){let e=t;(e.code==="commander.version"||e.code==="commander.helpDisplayed")&&(0,nf.exit)(0),e.message&&console.error(e.message);let r=e.exitCode??1;(0,nf.exit)(r)}console.error(`Error: ${L(t)}`),(0,nf.exit)(1)});
392
400
  /*! Bundled license information:
393
401
 
394
402
  tus-js-client/lib.es5/upload.js: