@capgo/cli 7.54.0 → 7.56.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,83 +1,83 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var i2=Object.create;var eu=Object.defineProperty;var a2=Object.getOwnPropertyDescriptor;var s2=Object.getOwnPropertyNames;var u2=Object.getPrototypeOf,c2=Object.prototype.hasOwnProperty;var Ze=(t,e)=>()=>(t&&(e=t(t=0)),e);var x=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Jr=(t,e)=>{for(var r in e)eu(t,r,{get:e[r],enumerable:!0})},Py=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of s2(e))!c2.call(t,o)&&o!==r&&eu(t,o,{get:()=>e[o],enumerable:!(n=a2(e,o))||n.enumerable});return t};var fe=(t,e,r)=>(r=t!=null?i2(u2(t)):{},Py(e||!t||!t.__esModule?eu(r,"default",{value:t,enumerable:!0}):r,t)),ie=t=>Py(eu({},"__esModule",{value:!0}),t);var Ea=x($f=>{var tu=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}},Pf=class extends tu{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};$f.CommanderError=tu;$f.InvalidArgumentError=Pf});var ru=x(Tf=>{var{InvalidArgumentError:l2}=Ea(),If=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 l2(`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 f2(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}Tf.Argument=If;Tf.humanReadableArgName=f2});var Nf=x(Bf=>{var{humanReadableArgName:d2}=ru(),Rf=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=>d2(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(d,p){return r.formatItem(d,n,p,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(d=>i(r.styleArgumentTerm(r.argumentTerm(d)),r.styleArgumentDescription(r.argumentDescription(d))));if(a=a.concat(this.formatItemList("Arguments:",u,r)),this.groupItems(e.options,r.visibleOptions(e),d=>d.helpGroupHeading??"Options:").forEach((d,p)=>{let h=d.map(m=>i(r.styleOptionTerm(r.optionTerm(m)),r.styleOptionDescription(r.optionDescription(m))));a=a.concat(this.formatItemList(p,h,r))}),r.showGlobalOptions){let d=r.visibleGlobalOptions(e).map(p=>i(r.styleOptionTerm(r.optionTerm(p)),r.styleOptionDescription(r.optionDescription(p))));a=a.concat(this.formatItemList("Global Options:",d,r))}return this.groupItems(e.commands,r.visibleCommands(e),d=>d.helpGroup()||"Commands:").forEach((d,p)=>{let h=d.map(m=>i(r.styleSubcommandTerm(r.subcommandTerm(m)),r.styleSubcommandDescription(r.subcommandDescription(m))));a=a.concat(this.formatItemList(p,h,r))}),a.join(`
3
- `)}displayWidth(e){return $y(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,f=(this.helpWidth??80)-r-u-2,d;return f<this.minWidthToWrap||o.preformatted(n)?d=n:d=o.boxWrap(n,f).replace(/\n/g,`
2
+ "use strict";var l2=Object.create;var ou=Object.defineProperty;var f2=Object.getOwnPropertyDescriptor;var d2=Object.getOwnPropertyNames;var p2=Object.getPrototypeOf,h2=Object.prototype.hasOwnProperty;var Qe=(t,e)=>()=>(t&&(e=t(t=0)),e);var x=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),en=(t,e)=>{for(var r in e)ou(t,r,{get:e[r],enumerable:!0})},By=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of d2(e))!h2.call(t,o)&&o!==r&&ou(t,o,{get:()=>e[o],enumerable:!(n=f2(e,o))||n.enumerable});return t};var pe=(t,e,r)=>(r=t!=null?l2(p2(t)):{},By(e||!t||!t.__esModule?ou(r,"default",{value:t,enumerable:!0}):r,t)),ie=t=>By(ou({},"__esModule",{value:!0}),t);var _a=x(Nf=>{var iu=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}},Bf=class extends iu{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Nf.CommanderError=iu;Nf.InvalidArgumentError=Bf});var au=x(jf=>{var{InvalidArgumentError:m2}=_a(),Lf=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 m2(`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 g2(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}jf.Argument=Lf;jf.humanReadableArgName=g2});var qf=x(Mf=>{var{humanReadableArgName:y2}=au(),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=>y2(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(d,p){return r.formatItem(d,n,p,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(d=>i(r.styleArgumentTerm(r.argumentTerm(d)),r.styleArgumentDescription(r.argumentDescription(d))));if(a=a.concat(this.formatItemList("Arguments:",u,r)),this.groupItems(e.options,r.visibleOptions(e),d=>d.helpGroupHeading??"Options:").forEach((d,p)=>{let h=d.map(m=>i(r.styleOptionTerm(r.optionTerm(m)),r.styleOptionDescription(r.optionDescription(m))));a=a.concat(this.formatItemList(p,h,r))}),r.showGlobalOptions){let d=r.visibleGlobalOptions(e).map(p=>i(r.styleOptionTerm(r.optionTerm(p)),r.styleOptionDescription(r.optionDescription(p))));a=a.concat(this.formatItemList("Global Options:",d,r))}return this.groupItems(e.commands,r.visibleCommands(e),d=>d.helpGroup()||"Commands:").forEach((d,p)=>{let h=d.map(m=>i(r.styleSubcommandTerm(r.subcommandTerm(m)),r.styleSubcommandDescription(r.subcommandDescription(m))));a=a.concat(this.formatItemList(p,h,r))}),a.join(`
3
+ `)}displayWidth(e){return Ny(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,f=(this.helpWidth??80)-r-u-2,d;return f<this.minWidthToWrap||o.preformatted(n)?d=n:d=o.boxWrap(n,f).replace(/\n/g,`
4
4
  `+" ".repeat(r+u)),a+s+" ".repeat(u)+d.replace(/\n/g,`
5
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(f=>{let d=this.displayWidth(f);if(c+d<=r){u.push(f),c+=d;return}i.push(u.join(""));let p=f.trimStart();u=[p],c=this.displayWidth(p)}),i.push(u.join(""))}),i.join(`
6
- `)}};function $y(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}Bf.Help=Rf;Bf.stripColor=$y});var Mf=x(Uf=>{var{InvalidArgumentError:p2}=Ea(),Lf=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=h2(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 p2(`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?Iy(this.name().replace(/^no-/,"")):Iy(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}},jf=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 Iy(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function h2(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}
6
+ `)}};function Ny(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}Mf.Help=Uf;Mf.stripColor=Ny});var Kf=x(zf=>{var{InvalidArgumentError:D2}=_a(),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=b2(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 D2(`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?Ly(this.name().replace(/^no-/,"")):Ly(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}},Vf=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 Ly(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function b2(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}}Uf.Option=Lf;Uf.DualOptions=jf});var Ry=x(Ty=>{function m2(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 g2(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=m2(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}}zf.Option=Hf;zf.DualOptions=Vf});var Uy=x(jy=>{function w2(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 v2(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=w2(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]}?)`:""}Ty.suggestSimilar=g2});var jy=x(Kf=>{var y2=require("node:events").EventEmitter,qf=require("node:child_process"),Xr=require("node:path"),nu=require("node:fs"),xe=require("node:process"),{Argument:D2,humanReadableArgName:b2}=ru(),{CommanderError:Hf}=Ea(),{Help:w2,stripColor:v2}=Nf(),{Option:By,DualOptions:C2}=Mf(),{suggestSimilar:Ny}=Ry(),Vf=class t extends y2{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=>xe.stdout.write(r),writeErr:r=>xe.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>xe.stdout.isTTY?xe.stdout.columns:void 0,getErrHelpWidth:()=>xe.stderr.isTTY?xe.stderr.columns:void 0,getOutHasColors:()=>zf()??(xe.stdout.isTTY&&xe.stdout.hasColors?.()),getErrHasColors:()=>zf()??(xe.stderr.isTTY&&xe.stderr.hasColors?.()),stripColor:r=>v2(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 w2,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 D2(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 Hf(e,r,n)),xe.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 By(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 By)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 f=s.exec(u);return f?f[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){xe.versions?.electron&&(r.from="electron");let o=xe.execArgv??[];(o.includes("-e")||o.includes("--eval")||o.includes("-p")||o.includes("--print"))&&(r.from="eval")}e===void 0&&(e=xe.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":xe.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(nu.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]}?)`:""}jy.suggestSimilar=v2});var Vy=x(Xf=>{var C2=require("node:events").EventEmitter,Gf=require("node:child_process"),tn=require("node:path"),su=require("node:fs"),Ae=require("node:process"),{Argument:E2,humanReadableArgName:_2}=au(),{CommanderError:Wf}=_a(),{Help:S2,stripColor:x2}=qf(),{Option:My,DualOptions:A2}=Kf(),{suggestSimilar:qy}=Uy(),Yf=class t extends C2{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=>Ae.stdout.write(r),writeErr:r=>Ae.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>Ae.stdout.isTTY?Ae.stdout.columns:void 0,getErrHelpWidth:()=>Ae.stderr.isTTY?Ae.stderr.columns:void 0,getOutHasColors:()=>Jf()??(Ae.stdout.isTTY&&Ae.stdout.hasColors?.()),getErrHasColors:()=>Jf()??(Ae.stderr.isTTY&&Ae.stderr.hasColors?.()),stripColor:r=>x2(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 S2,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 E2(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 Wf(e,r,n)),Ae.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 My(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 My)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 f=s.exec(u);return f?f[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){Ae.versions?.electron&&(r.from="electron");let o=Ae.execArgv??[];(o.includes("-e")||o.includes("--eval")||o.includes("-p")||o.includes("--print"))&&(r.from="eval")}e===void 0&&(e=Ae.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":Ae.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(su.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(f,d){let p=Xr.resolve(f,d);if(nu.existsSync(p))return p;if(o.includes(Xr.extname(d)))return;let h=o.find(m=>nu.existsSync(`${p}${m}`));if(h)return`${p}${h}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let a=e._executableFile||`${this._name}-${e._name}`,s=this._executableDir||"";if(this._scriptPath){let f;try{f=nu.realpathSync(this._scriptPath)}catch{f=this._scriptPath}s=Xr.resolve(Xr.dirname(f),s)}if(s){let f=i(s,a);if(!f&&!e._executableFile&&this._scriptPath){let d=Xr.basename(this._scriptPath,Xr.extname(this._scriptPath));d!==this._name&&(f=i(s,`${d}-${e._name}`))}a=f||a}n=o.includes(Xr.extname(a));let u;xe.platform!=="win32"?n?(r.unshift(a),r=Ly(xe.execArgv).concat(r),u=qf.spawn(xe.argv[0],r,{stdio:"inherit"})):u=qf.spawn(a,r,{stdio:"inherit"}):(this._checkForMissingExecutable(a,s,e._name),r.unshift(a),r=Ly(xe.execArgv).concat(r),u=qf.spawn(xe.execPath,r,{stdio:"inherit"})),u.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{xe.on(d,()=>{u.killed===!1&&u.exitCode===null&&u.kill(d)})});let c=this._exitCallback;u.on("close",f=>{f=f??1,c?c(new Hf(f,"commander.executeSubCommandAsync","(close)")):xe.exit(f)}),u.on("error",f=>{if(f.code==="ENOENT")this._checkForMissingExecutable(a,s,e._name);else if(f.code==="EACCES")throw new Error(`'${a}' not executable`);if(!c)xe.exit(1);else{let d=new Hf(1,"commander.executeSubCommandAsync","(error)");d.nestedError=f,c(d)}}),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(f){return f.length>1&&f[0]==="-"}let a=f=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(f)?!this._getCommandAndAncestors().some(d=>d.options.map(p=>p.short).some(p=>/^-\d$/.test(p))):!1,s=null,u=null,c=0;for(;c<e.length||u;){let f=u??e[c++];if(u=null,f==="--"){o===n&&o.push(f),o.push(...e.slice(c));break}if(s&&(!i(f)||a(f))){this.emit(`option:${s.name()}`,f);continue}if(s=null,i(f)){let d=this._findOption(f);if(d){if(d.required){let p=e[c++];p===void 0&&this.optionMissingArgument(d),this.emit(`option:${d.name()}`,p)}else if(d.optional){let p=null;c<e.length&&(!i(e[c])||a(e[c]))&&(p=e[c++]),this.emit(`option:${d.name()}`,p)}else this.emit(`option:${d.name()}`);s=d.variadic?d:null;continue}}if(f.length>2&&f[0]==="-"&&f[1]!=="-"){let d=this._findOption(`-${f[1]}`);if(d){d.required||d.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${d.name()}`,f.slice(2)):(this.emit(`option:${d.name()}`),u=`-${f.slice(2)}`);continue}}if(/^--[^=]+=/.test(f)){let d=f.indexOf("="),p=this._findOption(f.slice(0,d));if(p&&(p.required||p.optional)){this.emit(`option:${p.name()}`,f.slice(d+1));continue}}if(o===r&&i(f)&&!(this.commands.length===0&&a(f))&&(o=n),(this._enablePositionalOptions||this._passThroughOptions)&&r.length===0&&n.length===0){if(this._findCommand(f)){r.push(f),n.push(...e.slice(c));break}else if(this._getHelpCommand()&&f===this._getHelpCommand().name()){r.push(f,...e.slice(c));break}else if(this._defaultCommandName){n.push(f,...e.slice(c));break}}if(this._passThroughOptions){o.push(f,...e.slice(c));break}o.push(f)}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(f,d){let p=tn.resolve(f,d);if(su.existsSync(p))return p;if(o.includes(tn.extname(d)))return;let h=o.find(m=>su.existsSync(`${p}${m}`));if(h)return`${p}${h}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let a=e._executableFile||`${this._name}-${e._name}`,s=this._executableDir||"";if(this._scriptPath){let f;try{f=su.realpathSync(this._scriptPath)}catch{f=this._scriptPath}s=tn.resolve(tn.dirname(f),s)}if(s){let f=i(s,a);if(!f&&!e._executableFile&&this._scriptPath){let d=tn.basename(this._scriptPath,tn.extname(this._scriptPath));d!==this._name&&(f=i(s,`${d}-${e._name}`))}a=f||a}n=o.includes(tn.extname(a));let u;Ae.platform!=="win32"?n?(r.unshift(a),r=Hy(Ae.execArgv).concat(r),u=Gf.spawn(Ae.argv[0],r,{stdio:"inherit"})):u=Gf.spawn(a,r,{stdio:"inherit"}):(this._checkForMissingExecutable(a,s,e._name),r.unshift(a),r=Hy(Ae.execArgv).concat(r),u=Gf.spawn(Ae.execPath,r,{stdio:"inherit"})),u.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{Ae.on(d,()=>{u.killed===!1&&u.exitCode===null&&u.kill(d)})});let c=this._exitCallback;u.on("close",f=>{f=f??1,c?c(new Wf(f,"commander.executeSubCommandAsync","(close)")):Ae.exit(f)}),u.on("error",f=>{if(f.code==="ENOENT")this._checkForMissingExecutable(a,s,e._name);else if(f.code==="EACCES")throw new Error(`'${a}' not executable`);if(!c)Ae.exit(1);else{let d=new Wf(1,"commander.executeSubCommandAsync","(error)");d.nestedError=f,c(d)}}),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(f){return f.length>1&&f[0]==="-"}let a=f=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(f)?!this._getCommandAndAncestors().some(d=>d.options.map(p=>p.short).some(p=>/^-\d$/.test(p))):!1,s=null,u=null,c=0;for(;c<e.length||u;){let f=u??e[c++];if(u=null,f==="--"){o===n&&o.push(f),o.push(...e.slice(c));break}if(s&&(!i(f)||a(f))){this.emit(`option:${s.name()}`,f);continue}if(s=null,i(f)){let d=this._findOption(f);if(d){if(d.required){let p=e[c++];p===void 0&&this.optionMissingArgument(d),this.emit(`option:${d.name()}`,p)}else if(d.optional){let p=null;c<e.length&&(!i(e[c])||a(e[c]))&&(p=e[c++]),this.emit(`option:${d.name()}`,p)}else this.emit(`option:${d.name()}`);s=d.variadic?d:null;continue}}if(f.length>2&&f[0]==="-"&&f[1]!=="-"){let d=this._findOption(`-${f[1]}`);if(d){d.required||d.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${d.name()}`,f.slice(2)):(this.emit(`option:${d.name()}`),u=`-${f.slice(2)}`);continue}}if(/^--[^=]+=/.test(f)){let d=f.indexOf("="),p=this._findOption(f.slice(0,d));if(p&&(p.required||p.optional)){this.emit(`option:${p.name()}`,f.slice(d+1));continue}}if(o===r&&i(f)&&!(this.commands.length===0&&a(f))&&(o=n),(this._enablePositionalOptions||this._passThroughOptions)&&r.length===0&&n.length===0){if(this._findCommand(f)){r.push(f),n.push(...e.slice(c));break}else if(this._getHelpCommand()&&f===this._getHelpCommand().name()){r.push(f,...e.slice(c));break}else if(this._defaultCommandName){n.push(f,...e.slice(c));break}}if(this._passThroughOptions){o.push(f,...e.slice(c));break}o.push(f)}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 xe.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()}`,xe.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new C2(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(d=>d.negate&&s===d.attributeName()),f=this.options.find(d=>!d.negate&&s===d.attributeName());return c&&(c.presetArg===void 0&&u===!1||c.presetArg!==void 0&&u===c.presetArg)?c:f||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=Ny(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=Ny(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=>b2(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=Xr.basename(e,Xr.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(xe.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 Ae.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()}`,Ae.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new A2(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(d=>d.negate&&s===d.attributeName()),f=this.options.find(d=>!d.negate&&s===d.attributeName());return c&&(c.presetArg===void 0&&u===!1||c.presetArg!==void 0&&u===c.presetArg)?c:f||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=qy(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=qy(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=>_2(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=tn.basename(e,tn.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(Ae.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 Ly(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 zf(){if(xe.env.NO_COLOR||xe.env.FORCE_COLOR==="0"||xe.env.FORCE_COLOR==="false")return!1;if(xe.env.FORCE_COLOR||xe.env.CLICOLOR_FORCE!==void 0)return!0}Kf.Command=Vf;Kf.useColor=zf});var Hy=x(ur=>{var{Argument:Uy}=ru(),{Command:Gf}=jy(),{CommanderError:E2,InvalidArgumentError:My}=Ea(),{Help:_2}=Nf(),{Option:qy}=Mf();ur.program=new Gf;ur.createCommand=t=>new Gf(t);ur.createOption=(t,e)=>new qy(t,e);ur.createArgument=(t,e)=>new Uy(t,e);ur.Command=Gf;ur.Option=qy;ur.Argument=Uy;ur.Help=_2;ur.CommanderError=E2;ur.InvalidArgumentError=My;ur.InvalidOptionArgumentError=My});var Yf=x(($q,zy)=>{"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"},x2={up:(t=1)=>"\x1B[S".repeat(t),down:(t=1)=>"\x1B[T".repeat(t)},A2={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}};zy.exports={cursor:Wf,scroll:x2,erase:A2,beep:"\x07"}});var Xf=x((Iq,Jf)=>{var iu=process||{},Ky=iu.argv||[],ou=iu.env||{},O2=!(ou.NO_COLOR||Ky.includes("--no-color"))&&(!!ou.FORCE_COLOR||Ky.includes("--color")||iu.platform==="win32"||(iu.stdout||{}).isTTY&&ou.TERM!=="dumb"||!!ou.CI),F2=(t,e,r=t)=>n=>{let o=""+n,i=o.indexOf(e,t.length);return~i?t+k2(o,e,r,i)+e:t+o+e},k2=(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)},Gy=(t=O2)=>{let e=t?F2:()=>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")}};Jf.exports=Gy();Jf.exports.createColors=Gy});var hu=x(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.isNXMonorepo=Mt.isMonorepo=Mt.findPackageRelativePathInMonorepo=Mt.findPackagePath=Mt.findNXMonorepoRoot=Mt.findMonorepoRoot=void 0;var xa=require("node:fs"),Cn=require("node:path");function pu(t){let e=(0,Cn.join)(t,"package.json"),r=(0,Cn.join)(t,"pnpm-workspace.yaml");if((0,xa.existsSync)(r)||(0,xa.existsSync)(e)&&JSON.parse((0,xa.readFileSync)(e,"utf-8")).workspaces)return t;let n=(0,Cn.dirname)(t);if(n===t)throw new Error("Monorepo root not found");return pu(n)}Mt.findMonorepoRoot=pu;function ld(t){let e=(0,Cn.join)(t,"nx.json");if((0,xa.existsSync)(e))return t;let r=(0,Cn.dirname)(t);if(r===t)throw new Error("Monorepo root not found");return ld(r)}Mt.findNXMonorepoRoot=ld;function fd(t,e,r){let n=(0,Cn.join)(e,"node_modules",t);if((0,xa.existsSync)(n))return n;if(e===r)return null;let o=(0,Cn.dirname)(e);return fd(t,o,r)}Mt.findPackagePath=fd;function uk(t,e){let r=pu(e),n=fd(t,e,r);return n?(0,Cn.relative)(e,n):null}Mt.findPackageRelativePathInMonorepo=uk;function ck(t){try{return pu(t),!0}catch{return!1}}Mt.isMonorepo=ck;function lk(t){try{return ld(t),!0}catch{return!1}}Mt.isNXMonorepo=lk});var we={};Jr(we,{__addDisposableResource:()=>JD,__assign:()=>vu,__asyncDelegator:()=>qD,__asyncGenerator:()=>MD,__asyncValues:()=>HD,__await:()=>Xo,__awaiter:()=>RD,__classPrivateFieldGet:()=>GD,__classPrivateFieldIn:()=>YD,__classPrivateFieldSet:()=>WD,__createBinding:()=>Eu,__decorate:()=>OD,__disposeResources:()=>XD,__esDecorate:()=>kD,__exportStar:()=>ND,__extends:()=>xD,__generator:()=>BD,__importDefault:()=>KD,__importStar:()=>zD,__makeTemplateObject:()=>VD,__metadata:()=>TD,__param:()=>FD,__propKey:()=>$D,__read:()=>wd,__rest:()=>AD,__rewriteRelativeImportExtension:()=>ZD,__runInitializers:()=>PD,__setFunctionName:()=>ID,__spread:()=>LD,__spreadArray:()=>UD,__spreadArrays:()=>jD,__values:()=>Cu,default:()=>Tk});function xD(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Dd(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function AD(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 OD(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 FD(t,e){return function(r,n){e(r,n,t)}}function kD(t,e,r,n,o,i){function a(v){if(v!==void 0&&typeof v!="function")throw new TypeError("Function expected");return v}for(var s=n.kind,u=s==="getter"?"get":s==="setter"?"set":"value",c=!e&&t?n.static?t:t.prototype:null,f=e||(c?Object.getOwnPropertyDescriptor(c,n.name):{}),d,p=!1,h=r.length-1;h>=0;h--){var m={};for(var y in n)m[y]=y==="access"?{}:n[y];for(var y in n.access)m.access[y]=n.access[y];m.addInitializer=function(v){if(p)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(v||null))};var D=(0,r[h])(s==="accessor"?{get:f.get,set:f.set}:f[u],m);if(s==="accessor"){if(D===void 0)continue;if(D===null||typeof D!="object")throw new TypeError("Object expected");(d=a(D.get))&&(f.get=d),(d=a(D.set))&&(f.set=d),(d=a(D.init))&&o.unshift(d)}else(d=a(D))&&(s==="field"?o.unshift(d):f[u]=d)}c&&Object.defineProperty(c,n.name,f),p=!0}function PD(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 $D(t){return typeof t=="symbol"?t:"".concat(t)}function ID(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 TD(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function RD(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(f){try{c(n.next(f))}catch(d){a(d)}}function u(f){try{c(n.throw(f))}catch(d){a(d)}}function c(f){f.done?i(f.value):o(f.value).then(s,u)}c((n=n.apply(t,e||[])).next())})}function BD(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(f){return u([c,f])}}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(f){c=[6,f],o=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function ND(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Eu(e,t,r)}function Cu(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 wd(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 LD(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(wd(arguments[e]));return t}function jD(){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 UD(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 Xo(t){return this instanceof Xo?(this.v=t,this):new Xo(t)}function MD(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,d)}}function s(h,m){n[h]&&(o[h]=function(y){return new Promise(function(D,v){i.push([h,y,D,v])>1||u(h,y)})},m&&(o[h]=m(o[h])))}function u(h,m){try{c(n[h](m))}catch(y){p(i[0][3],y)}}function c(h){h.value instanceof Xo?Promise.resolve(h.value.v).then(f,d):p(i[0][2],h)}function f(h){u("next",h)}function d(h){u("throw",h)}function p(h,m){h(m),i.shift(),i.length&&u(i[0][0],i[0][1])}}function qD(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:Xo(t[o](a)),done:!1}:i?i(a):a}:i}}function HD(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 Cu=="function"?Cu(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 VD(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function zD(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=bd(t),n=0;n<r.length;n++)r[n]!=="default"&&Eu(e,t,r[n]);return $k(e,t),e}function KD(t){return t&&t.__esModule?t:{default:t}}function GD(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 WD(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 YD(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 JD(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 XD(t){function e(i){t.error=t.hasError?new Ik(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 ZD(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 Dd,vu,Eu,$k,bd,Ik,Tk,ve=Ze(()=>{Dd=function(t,e){return Dd=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])},Dd(t,e)};vu=function(){return vu=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},vu.apply(this,arguments)};Eu=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]});$k=Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e},bd=function(t){return bd=Object.getOwnPropertyNames||function(e){var r=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[r.length]=n);return r},bd(t)};Ik=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};Tk={__extends:xD,__assign:vu,__rest:AD,__decorate:OD,__param:FD,__esDecorate:kD,__runInitializers:PD,__propKey:$D,__setFunctionName:ID,__metadata:TD,__awaiter:RD,__generator:BD,__createBinding:Eu,__exportStar:ND,__values:Cu,__read:wd,__spread:LD,__spreadArrays:jD,__spreadArray:UD,__await:Xo,__asyncGenerator:MD,__asyncDelegator:qD,__asyncValues:HD,__makeTemplateObject:VD,__importStar:zD,__importDefault:KD,__classPrivateFieldGet:GD,__classPrivateFieldSet:WD,__classPrivateFieldIn:YD,__addDisposableResource:JD,__disposeResources:XD,__rewriteRelativeImportExtension:ZD}});var QD=x(_u=>{"use strict";Object.defineProperty(_u,"__esModule",{value:!0});_u.resolveFetch=void 0;var Rk=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);_u.resolveFetch=Rk});var _d=x(lr=>{"use strict";Object.defineProperty(lr,"__esModule",{value:!0});lr.FunctionRegion=lr.FunctionsHttpError=lr.FunctionsRelayError=lr.FunctionsFetchError=lr.FunctionsError=void 0;var Zo=class extends Error{constructor(e,r="FunctionsError",n){super(e),this.name=r,this.context=n}};lr.FunctionsError=Zo;var vd=class extends Zo{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}};lr.FunctionsFetchError=vd;var Cd=class extends Zo{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}};lr.FunctionsRelayError=Cd;var Ed=class extends Zo{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}};lr.FunctionsHttpError=Ed;var e0;(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"})(e0||(lr.FunctionRegion=e0={}))});var t0=x(Su=>{"use strict";Object.defineProperty(Su,"__esModule",{value:!0});Su.FunctionsClient=void 0;var Bk=(ve(),ie(we)),Nk=QD(),Qo=_d(),Sd=class{constructor(e,{headers:r={},customFetch:n,region:o=Qo.FunctionRegion.Any}={}){this.url=e,this.headers=r,this.region=o,this.fetch=(0,Nk.resolveFetch)(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return Bk.__awaiter(this,arguments,void 0,function*(r,n={}){var o;let i,a;try{let{headers:s,method:u,body:c,signal:f,timeout:d}=n,p={},{region:h}=n;h||(h=this.region);let m=new URL(`${this.url}/${r}`);h&&h!=="any"&&(p["x-region"]=h,m.searchParams.set("forceFunctionRegion",h));let y;c&&(s&&!Object.prototype.hasOwnProperty.call(s,"Content-Type")||!s)?typeof Blob<"u"&&c instanceof Blob||c instanceof ArrayBuffer?(p["Content-Type"]="application/octet-stream",y=c):typeof c=="string"?(p["Content-Type"]="text/plain",y=c):typeof FormData<"u"&&c instanceof FormData?y=c:(p["Content-Type"]="application/json",y=JSON.stringify(c)):y=c;let D=f;d&&(a=new AbortController,i=setTimeout(()=>a.abort(),d),f?(D=a.signal,f.addEventListener("abort",()=>a.abort())):D=a.signal);let v=yield this.fetch(m.toString(),{method:u||"POST",headers:Object.assign(Object.assign(Object.assign({},p),this.headers),s),body:y,signal:D}).catch(S=>{throw new Qo.FunctionsFetchError(S)}),E=v.headers.get("x-relay-error");if(E&&E==="true")throw new Qo.FunctionsRelayError(v);if(!v.ok)throw new Qo.FunctionsHttpError(v);let g=((o=v.headers.get("Content-Type"))!==null&&o!==void 0?o:"text/plain").split(";")[0].trim(),_;return g==="application/json"?_=yield v.json():g==="application/octet-stream"||g==="application/pdf"?_=yield v.blob():g==="text/event-stream"?_=v:g==="multipart/form-data"?_=yield v.formData():_=yield v.text(),{data:_,error:null,response:v}}catch(s){return{data:null,error:s,response:s instanceof Qo.FunctionsHttpError||s instanceof Qo.FunctionsRelayError?s.context:void 0}}finally{i&&clearTimeout(i)}})}};Su.FunctionsClient=Sd});var xd=x(Ht=>{"use strict";Object.defineProperty(Ht,"__esModule",{value:!0});Ht.FunctionRegion=Ht.FunctionsRelayError=Ht.FunctionsHttpError=Ht.FunctionsFetchError=Ht.FunctionsError=Ht.FunctionsClient=void 0;var Lk=t0();Object.defineProperty(Ht,"FunctionsClient",{enumerable:!0,get:function(){return Lk.FunctionsClient}});var ka=_d();Object.defineProperty(Ht,"FunctionsError",{enumerable:!0,get:function(){return ka.FunctionsError}});Object.defineProperty(Ht,"FunctionsFetchError",{enumerable:!0,get:function(){return ka.FunctionsFetchError}});Object.defineProperty(Ht,"FunctionsHttpError",{enumerable:!0,get:function(){return ka.FunctionsHttpError}});Object.defineProperty(Ht,"FunctionsRelayError",{enumerable:!0,get:function(){return ka.FunctionsRelayError}});Object.defineProperty(Ht,"FunctionRegion",{enumerable:!0,get:function(){return ka.FunctionRegion}})});var Fd=x(Od=>{"use strict";Object.defineProperty(Od,"__esModule",{value:!0});var Ad=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}};Od.default=Ad});var $d=x(Pd=>{"use strict";Object.defineProperty(Pd,"__esModule",{value:!0});var jk=(ve(),ie(we)),Uk=jk.__importDefault(Fd()),kd=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 f=null,d=null,p=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"))?d=E:d=JSON.parse(E))}let D=(s=this.headers.get("Prefer"))===null||s===void 0?void 0:s.match(/count=(exact|planned|estimated)/),v=(u=i.headers.get("content-range"))===null||u===void 0?void 0:u.split("/");D&&v&&v.length>1&&(p=parseInt(v[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(d)&&(d.length>1?(f={code:"PGRST116",details:`Results contain ${d.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},d=null,p=null,h=406,m="Not Acceptable"):d.length===1?d=d[0]:d=null)}else{let D=await i.text();try{f=JSON.parse(D),Array.isArray(f)&&i.status===404&&(d=[],f=null,h=200,m="OK")}catch{i.status===404&&D===""?(h=204,m="No Content"):f={message:D}}if(f&&this.isMaybeSingle&&(!((c=f?.details)===null||c===void 0)&&c.includes("0 rows"))&&(f=null,h=200,m="OK"),f&&this.shouldThrowOnError)throw new Uk.default(f)}return{error:f,data:d,count:p,status:h,statusText:m}});return this.shouldThrowOnError||(o=o.catch(i=>{var a,s,u,c,f,d;let p="",h=i?.cause;if(h){let m=(a=h?.message)!==null&&a!==void 0?a:"",y=(s=h?.code)!==null&&s!==void 0?s:"";p=`${(u=i?.name)!==null&&u!==void 0?u:"FetchError"}: ${i?.message}`,p+=`
27
+ `)}),this}_outputHelpIfRequested(e){let r=this._getHelpOption();r&&e.find(o=>r.is(o))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function Hy(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 Jf(){if(Ae.env.NO_COLOR||Ae.env.FORCE_COLOR==="0"||Ae.env.FORCE_COLOR==="false")return!1;if(Ae.env.FORCE_COLOR||Ae.env.CLICOLOR_FORCE!==void 0)return!0}Xf.Command=Yf;Xf.useColor=Jf});var Wy=x(lr=>{var{Argument:zy}=au(),{Command:Zf}=Vy(),{CommanderError:O2,InvalidArgumentError:Ky}=_a(),{Help:F2}=qf(),{Option:Gy}=Kf();lr.program=new Zf;lr.createCommand=t=>new Zf(t);lr.createOption=(t,e)=>new Gy(t,e);lr.createArgument=(t,e)=>new zy(t,e);lr.Command=Zf;lr.Option=Gy;lr.Argument=zy;lr.Help=F2;lr.CommanderError=O2;lr.InvalidArgumentError=Ky;lr.InvalidOptionArgumentError=Ky});var ed=x((Lq,Jy)=>{"use strict";var Qf={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"},k2={up:(t=1)=>"\x1B[S".repeat(t),down:(t=1)=>"\x1B[T".repeat(t)},$2={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?Qf.up():"");return t&&(e+=Qf.left),e}};Jy.exports={cursor:Qf,scroll:k2,erase:$2,beep:"\x07"}});var rd=x((jq,td)=>{var cu=process||{},Xy=cu.argv||[],uu=cu.env||{},I2=!(uu.NO_COLOR||Xy.includes("--no-color"))&&(!!uu.FORCE_COLOR||Xy.includes("--color")||cu.platform==="win32"||(cu.stdout||{}).isTTY&&uu.TERM!=="dumb"||!!uu.CI),T2=(t,e,r=t)=>n=>{let o=""+n,i=o.indexOf(e,t.length);return~i?t+R2(o,e,r,i)+e:t+o+e},R2=(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)},Zy=(t=I2)=>{let e=t?T2:()=>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")}};td.exports=Zy();td.exports.createColors=Zy});var Du=x(qt=>{"use strict";Object.defineProperty(qt,"__esModule",{value:!0});qt.isNXMonorepo=qt.isMonorepo=qt.findPackageRelativePathInMonorepo=qt.findPackagePath=qt.findNXMonorepoRoot=qt.findMonorepoRoot=void 0;var Aa=require("node:fs"),Sn=require("node:path");function yu(t){let e=(0,Sn.join)(t,"package.json"),r=(0,Sn.join)(t,"pnpm-workspace.yaml");if((0,Aa.existsSync)(r)||(0,Aa.existsSync)(e)&&JSON.parse((0,Aa.readFileSync)(e,"utf-8")).workspaces)return t;let n=(0,Sn.dirname)(t);if(n===t)throw new Error("Monorepo root not found");return yu(n)}qt.findMonorepoRoot=yu;function md(t){let e=(0,Sn.join)(t,"nx.json");if((0,Aa.existsSync)(e))return t;let r=(0,Sn.dirname)(t);if(r===t)throw new Error("Monorepo root not found");return md(r)}qt.findNXMonorepoRoot=md;function gd(t,e,r){let n=(0,Sn.join)(e,"node_modules",t);if((0,Aa.existsSync)(n))return n;if(e===r)return null;let o=(0,Sn.dirname)(e);return gd(t,o,r)}qt.findPackagePath=gd;function pP(t,e){let r=yu(e),n=gd(t,e,r);return n?(0,Sn.relative)(e,n):null}qt.findPackageRelativePathInMonorepo=pP;function hP(t){try{return yu(t),!0}catch{return!1}}qt.isMonorepo=hP;function mP(t){try{return md(t),!0}catch{return!1}}qt.isNXMonorepo=mP});var we={};en(we,{__addDisposableResource:()=>t0,__assign:()=>Su,__asyncDelegator:()=>GD,__asyncGenerator:()=>KD,__asyncValues:()=>WD,__await:()=>Xo,__awaiter:()=>UD,__classPrivateFieldGet:()=>ZD,__classPrivateFieldIn:()=>e0,__classPrivateFieldSet:()=>QD,__createBinding:()=>Au,__decorate:()=>ID,__disposeResources:()=>r0,__esDecorate:()=>RD,__exportStar:()=>qD,__extends:()=>kD,__generator:()=>MD,__importDefault:()=>XD,__importStar:()=>JD,__makeTemplateObject:()=>YD,__metadata:()=>jD,__param:()=>TD,__propKey:()=>ND,__read:()=>Sd,__rest:()=>$D,__rewriteRelativeImportExtension:()=>n0,__runInitializers:()=>BD,__setFunctionName:()=>LD,__spread:()=>HD,__spreadArray:()=>zD,__spreadArrays:()=>VD,__values:()=>xu,default:()=>jP});function kD(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Ed(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function $D(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 ID(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 TD(t,e){return function(r,n){e(r,n,t)}}function RD(t,e,r,n,o,i){function a(v){if(v!==void 0&&typeof v!="function")throw new TypeError("Function expected");return v}for(var s=n.kind,u=s==="getter"?"get":s==="setter"?"set":"value",c=!e&&t?n.static?t:t.prototype:null,f=e||(c?Object.getOwnPropertyDescriptor(c,n.name):{}),d,p=!1,h=r.length-1;h>=0;h--){var m={};for(var y in n)m[y]=y==="access"?{}:n[y];for(var y in n.access)m.access[y]=n.access[y];m.addInitializer=function(v){if(p)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(v||null))};var D=(0,r[h])(s==="accessor"?{get:f.get,set:f.set}:f[u],m);if(s==="accessor"){if(D===void 0)continue;if(D===null||typeof D!="object")throw new TypeError("Object expected");(d=a(D.get))&&(f.get=d),(d=a(D.set))&&(f.set=d),(d=a(D.init))&&o.unshift(d)}else(d=a(D))&&(s==="field"?o.unshift(d):f[u]=d)}c&&Object.defineProperty(c,n.name,f),p=!0}function BD(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 ND(t){return typeof t=="symbol"?t:"".concat(t)}function LD(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 jD(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function UD(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(f){try{c(n.next(f))}catch(d){a(d)}}function u(f){try{c(n.throw(f))}catch(d){a(d)}}function c(f){f.done?i(f.value):o(f.value).then(s,u)}c((n=n.apply(t,e||[])).next())})}function MD(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(f){return u([c,f])}}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(f){c=[6,f],o=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function qD(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Au(e,t,r)}function xu(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 Sd(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 HD(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Sd(arguments[e]));return t}function VD(){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 zD(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 Xo(t){return this instanceof Xo?(this.v=t,this):new Xo(t)}function KD(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,d)}}function s(h,m){n[h]&&(o[h]=function(y){return new Promise(function(D,v){i.push([h,y,D,v])>1||u(h,y)})},m&&(o[h]=m(o[h])))}function u(h,m){try{c(n[h](m))}catch(y){p(i[0][3],y)}}function c(h){h.value instanceof Xo?Promise.resolve(h.value.v).then(f,d):p(i[0][2],h)}function f(h){u("next",h)}function d(h){u("throw",h)}function p(h,m){h(m),i.shift(),i.length&&u(i[0][0],i[0][1])}}function GD(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:Xo(t[o](a)),done:!1}:i?i(a):a}:i}}function WD(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 xu=="function"?xu(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 YD(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function JD(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=_d(t),n=0;n<r.length;n++)r[n]!=="default"&&Au(e,t,r[n]);return NP(e,t),e}function XD(t){return t&&t.__esModule?t:{default:t}}function ZD(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 QD(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 e0(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 t0(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 r0(t){function e(i){t.error=t.hasError?new LP(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 n0(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 Ed,Su,Au,NP,_d,LP,jP,ve=Qe(()=>{Ed=function(t,e){return Ed=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])},Ed(t,e)};Su=function(){return Su=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},Su.apply(this,arguments)};Au=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]});NP=Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e},_d=function(t){return _d=Object.getOwnPropertyNames||function(e){var r=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[r.length]=n);return r},_d(t)};LP=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};jP={__extends:kD,__assign:Su,__rest:$D,__decorate:ID,__param:TD,__esDecorate:RD,__runInitializers:BD,__propKey:ND,__setFunctionName:LD,__metadata:jD,__awaiter:UD,__generator:MD,__createBinding:Au,__exportStar:qD,__values:xu,__read:Sd,__spread:HD,__spreadArrays:VD,__spreadArray:zD,__await:Xo,__asyncGenerator:KD,__asyncDelegator:GD,__asyncValues:WD,__makeTemplateObject:YD,__importStar:JD,__importDefault:XD,__classPrivateFieldGet:ZD,__classPrivateFieldSet:QD,__classPrivateFieldIn:e0,__addDisposableResource:t0,__disposeResources:r0,__rewriteRelativeImportExtension:n0}});var o0=x(Ou=>{"use strict";Object.defineProperty(Ou,"__esModule",{value:!0});Ou.resolveFetch=void 0;var UP=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);Ou.resolveFetch=UP});var Fd=x(dr=>{"use strict";Object.defineProperty(dr,"__esModule",{value:!0});dr.FunctionRegion=dr.FunctionsHttpError=dr.FunctionsRelayError=dr.FunctionsFetchError=dr.FunctionsError=void 0;var Zo=class extends Error{constructor(e,r="FunctionsError",n){super(e),this.name=r,this.context=n}};dr.FunctionsError=Zo;var xd=class extends Zo{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}};dr.FunctionsFetchError=xd;var Ad=class extends Zo{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}};dr.FunctionsRelayError=Ad;var Od=class extends Zo{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}};dr.FunctionsHttpError=Od;var i0;(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"})(i0||(dr.FunctionRegion=i0={}))});var a0=x(Fu=>{"use strict";Object.defineProperty(Fu,"__esModule",{value:!0});Fu.FunctionsClient=void 0;var MP=(ve(),ie(we)),qP=o0(),Qo=Fd(),Pd=class{constructor(e,{headers:r={},customFetch:n,region:o=Qo.FunctionRegion.Any}={}){this.url=e,this.headers=r,this.region=o,this.fetch=(0,qP.resolveFetch)(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return MP.__awaiter(this,arguments,void 0,function*(r,n={}){var o;let i,a;try{let{headers:s,method:u,body:c,signal:f,timeout:d}=n,p={},{region:h}=n;h||(h=this.region);let m=new URL(`${this.url}/${r}`);h&&h!=="any"&&(p["x-region"]=h,m.searchParams.set("forceFunctionRegion",h));let y;c&&(s&&!Object.prototype.hasOwnProperty.call(s,"Content-Type")||!s)?typeof Blob<"u"&&c instanceof Blob||c instanceof ArrayBuffer?(p["Content-Type"]="application/octet-stream",y=c):typeof c=="string"?(p["Content-Type"]="text/plain",y=c):typeof FormData<"u"&&c instanceof FormData?y=c:(p["Content-Type"]="application/json",y=JSON.stringify(c)):y=c;let D=f;d&&(a=new AbortController,i=setTimeout(()=>a.abort(),d),f?(D=a.signal,f.addEventListener("abort",()=>a.abort())):D=a.signal);let v=yield this.fetch(m.toString(),{method:u||"POST",headers:Object.assign(Object.assign(Object.assign({},p),this.headers),s),body:y,signal:D}).catch(S=>{throw new Qo.FunctionsFetchError(S)}),E=v.headers.get("x-relay-error");if(E&&E==="true")throw new Qo.FunctionsRelayError(v);if(!v.ok)throw new Qo.FunctionsHttpError(v);let g=((o=v.headers.get("Content-Type"))!==null&&o!==void 0?o:"text/plain").split(";")[0].trim(),_;return g==="application/json"?_=yield v.json():g==="application/octet-stream"||g==="application/pdf"?_=yield v.blob():g==="text/event-stream"?_=v:g==="multipart/form-data"?_=yield v.formData():_=yield v.text(),{data:_,error:null,response:v}}catch(s){return{data:null,error:s,response:s instanceof Qo.FunctionsHttpError||s instanceof Qo.FunctionsRelayError?s.context:void 0}}finally{i&&clearTimeout(i)}})}};Fu.FunctionsClient=Pd});var kd=x(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.FunctionRegion=Vt.FunctionsRelayError=Vt.FunctionsHttpError=Vt.FunctionsFetchError=Vt.FunctionsError=Vt.FunctionsClient=void 0;var HP=a0();Object.defineProperty(Vt,"FunctionsClient",{enumerable:!0,get:function(){return HP.FunctionsClient}});var ka=Fd();Object.defineProperty(Vt,"FunctionsError",{enumerable:!0,get:function(){return ka.FunctionsError}});Object.defineProperty(Vt,"FunctionsFetchError",{enumerable:!0,get:function(){return ka.FunctionsFetchError}});Object.defineProperty(Vt,"FunctionsHttpError",{enumerable:!0,get:function(){return ka.FunctionsHttpError}});Object.defineProperty(Vt,"FunctionsRelayError",{enumerable:!0,get:function(){return ka.FunctionsRelayError}});Object.defineProperty(Vt,"FunctionRegion",{enumerable:!0,get:function(){return ka.FunctionRegion}})});var Td=x(Id=>{"use strict";Object.defineProperty(Id,"__esModule",{value:!0});var $d=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}};Id.default=$d});var Nd=x(Bd=>{"use strict";Object.defineProperty(Bd,"__esModule",{value:!0});var VP=(ve(),ie(we)),zP=VP.__importDefault(Td()),Rd=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 f=null,d=null,p=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"))?d=E:d=JSON.parse(E))}let D=(s=this.headers.get("Prefer"))===null||s===void 0?void 0:s.match(/count=(exact|planned|estimated)/),v=(u=i.headers.get("content-range"))===null||u===void 0?void 0:u.split("/");D&&v&&v.length>1&&(p=parseInt(v[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(d)&&(d.length>1?(f={code:"PGRST116",details:`Results contain ${d.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},d=null,p=null,h=406,m="Not Acceptable"):d.length===1?d=d[0]:d=null)}else{let D=await i.text();try{f=JSON.parse(D),Array.isArray(f)&&i.status===404&&(d=[],f=null,h=200,m="OK")}catch{i.status===404&&D===""?(h=204,m="No Content"):f={message:D}}if(f&&this.isMaybeSingle&&(!((c=f?.details)===null||c===void 0)&&c.includes("0 rows"))&&(f=null,h=200,m="OK"),f&&this.shouldThrowOnError)throw new zP.default(f)}return{error:f,data:d,count:p,status:h,statusText:m}});return this.shouldThrowOnError||(o=o.catch(i=>{var a,s,u,c,f,d;let p="",h=i?.cause;if(h){let m=(a=h?.message)!==null&&a!==void 0?a:"",y=(s=h?.code)!==null&&s!==void 0?s:"";p=`${(u=i?.name)!==null&&u!==void 0?u:"FetchError"}: ${i?.message}`,p+=`
28
28
 
29
29
  Caused by: ${(c=h?.name)!==null&&c!==void 0?c:"Error"}: ${m}`,y&&(p+=` (${y})`),h?.stack&&(p+=`
30
- ${h.stack}`)}else p=(f=i?.stack)!==null&&f!==void 0?f:"";return{error:{message:`${(d=i?.name)!==null&&d!==void 0?d:"FetchError"}: ${i?.message}`,details:p,hint:"",code:""},data:null,count:null,status:0,statusText:""}})),o.then(e,r)}returns(){return this}overrideTypes(){return this}};Pd.default=kd});var Rd=x(Td=>{"use strict";Object.defineProperty(Td,"__esModule",{value:!0});var Mk=(ve(),ie(we)),qk=Mk.__importDefault($d()),Id=class extends qk.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}};Td.default=Id});var xu=x(Nd=>{"use strict";Object.defineProperty(Nd,"__esModule",{value:!0});var Hk=(ve(),ie(we)),Vk=Hk.__importDefault(Rd()),zk=new RegExp("[,()]"),Bd=class extends Vk.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}regexMatch(e,r){return this.url.searchParams.append(e,`match.${r}`),this}regexIMatch(e,r){return this.url.searchParams.append(e,`imatch.${r}`),this}is(e,r){return this.url.searchParams.append(e,`is.${r}`),this}isDistinct(e,r){return this.url.searchParams.append(e,`isdistinct.${r}`),this}in(e,r){let n=Array.from(new Set(r)).map(o=>typeof o=="string"&&zk.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}};Nd.default=Bd});var Ud=x(jd=>{"use strict";Object.defineProperty(jd,"__esModule",{value:!0});var Kk=(ve(),ie(we)),Pa=Kk.__importDefault(xu()),Ld=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 Pa.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 Pa.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,f)=>c.concat(Object.keys(f)),[]);if(u.length>0){let c=[...new Set(u)].map(f=>`"${f}"`);this.url.searchParams.set("columns",c.join(","))}}return new Pa.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 Pa.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 Pa.default({method:n,url:this.url,headers:this.headers,schema:this.schema,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}};jd.default=Ld});var n0=x(qd=>{"use strict";Object.defineProperty(qd,"__esModule",{value:!0});var r0=(ve(),ie(we)),Gk=r0.__importDefault(Ud()),Wk=r0.__importDefault(xu()),Md=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){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");let r=new URL(`${this.url}/${e}`);return new Gk.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(([d,p])=>p!==void 0).map(([d,p])=>[d,Array.isArray(p)?`{${p.join(",")}}`:`${p}`]).forEach(([d,p])=>{u.searchParams.append(d,p)})):(s="POST",c=r);let f=new Headers(this.headers);return i&&f.set("Prefer",`count=${i}`),new Wk.default({method:s,url:u,headers:f,schema:this.schemaName,body:c,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}};qd.default=Md});var Hd=x(Pt=>{"use strict";Object.defineProperty(Pt,"__esModule",{value:!0});Pt.PostgrestError=Pt.PostgrestBuilder=Pt.PostgrestTransformBuilder=Pt.PostgrestFilterBuilder=Pt.PostgrestQueryBuilder=Pt.PostgrestClient=void 0;var ei=(ve(),ie(we)),o0=ei.__importDefault(n0());Pt.PostgrestClient=o0.default;var i0=ei.__importDefault(Ud());Pt.PostgrestQueryBuilder=i0.default;var a0=ei.__importDefault(xu());Pt.PostgrestFilterBuilder=a0.default;var s0=ei.__importDefault(Rd());Pt.PostgrestTransformBuilder=s0.default;var u0=ei.__importDefault($d());Pt.PostgrestBuilder=u0.default;var c0=ei.__importDefault(Fd());Pt.PostgrestError=c0.default;Pt.default={PostgrestClient:o0.default,PostgrestQueryBuilder:i0.default,PostgrestFilterBuilder:a0.default,PostgrestTransformBuilder:s0.default,PostgrestBuilder:u0.default,PostgrestError:c0.default}});var zd={};Jr(zd,{RealtimeClient:()=>Vd});var Vd,Kd=Ze(()=>{Vd=class{constructor(){}connect(){}disconnect(){}}});var Sn=x(Qr=>{"use strict";Object.defineProperty(Qr,"__esModule",{value:!0});Qr.StorageUnknownError=Qr.StorageApiError=Qr.StorageError=void 0;Qr.isStorageError=Yk;var $a=class extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}};Qr.StorageError=$a;function Yk(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var Gd=class extends $a{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}}};Qr.StorageApiError=Gd;var Wd=class extends $a{constructor(e,r){super(e),this.name="StorageUnknownError",this.originalError=r}};Qr.StorageUnknownError=Wd});var Ia=x(fr=>{"use strict";Object.defineProperty(fr,"__esModule",{value:!0});fr.isPlainObject=fr.recursiveToCamel=fr.resolveResponse=fr.resolveFetch=void 0;var Jk=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);fr.resolveFetch=Jk;var Xk=()=>Response;fr.resolveResponse=Xk;var Zk=t=>{if(Array.isArray(t))return t.map(r=>(0,fr.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,fr.recursiveToCamel)(n)}),e};fr.recursiveToCamel=Zk;var Qk=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)};fr.isPlainObject=Qk});var Au=x(Jn=>{"use strict";Object.defineProperty(Jn,"__esModule",{value:!0});Jn.get=rP;Jn.post=nP;Jn.put=oP;Jn.head=iP;Jn.remove=aP;var Yn=(ve(),ie(we)),Yd=Sn(),l0=Ia(),Jd=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)},eP=(t,e,r)=>Yn.__awaiter(void 0,void 0,void 0,function*(){let n=yield(0,l0.resolveResponse)();t instanceof n&&!r?.noResolveJson?t.json().then(o=>{let i=t.status||500,a=o?.statusCode||i+"";e(new Yd.StorageApiError(Jd(o),i,a))}).catch(o=>{e(new Yd.StorageUnknownError(Jd(o),o))}):e(new Yd.StorageUnknownError(Jd(t),t))}),tP=(t,e,r,n)=>{let o={method:t,headers:e?.headers||{}};return t==="GET"||!n?o:((0,l0.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 Ta(t,e,r,n,o,i){return Yn.__awaiter(this,void 0,void 0,function*(){return new Promise((a,s)=>{t(r,tP(e,n,o,i)).then(u=>{if(!u.ok)throw u;return n?.noResolveJson?u:u.json()}).then(u=>a(u)).catch(u=>eP(u,s,n))})})}function rP(t,e,r,n){return Yn.__awaiter(this,void 0,void 0,function*(){return Ta(t,"GET",e,r,n)})}function nP(t,e,r,n,o){return Yn.__awaiter(this,void 0,void 0,function*(){return Ta(t,"POST",e,n,o,r)})}function oP(t,e,r,n,o){return Yn.__awaiter(this,void 0,void 0,function*(){return Ta(t,"PUT",e,n,o,r)})}function iP(t,e,r,n){return Yn.__awaiter(this,void 0,void 0,function*(){return Ta(t,"HEAD",e,Object.assign(Object.assign({},r),{noResolveJson:!0}),n)})}function aP(t,e,r,n,o){return Yn.__awaiter(this,void 0,void 0,function*(){return Ta(t,"DELETE",e,n,o,r)})}});var f0=x(Zd=>{"use strict";Object.defineProperty(Zd,"__esModule",{value:!0});var sP=(ve(),ie(we)),uP=Sn(),Xd=class{constructor(e,r){this.downloadFn=e,this.shouldThrowOnError=r}then(e,r){return this.execute().then(e,r)}execute(){return sP.__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,uP.isStorageError)(e))return{data:null,error:e};throw e}})}};Zd.default=Xd});var h0=x(ep=>{"use strict";var d0;Object.defineProperty(ep,"__esModule",{value:!0});var p0=(ve(),ie(we)),cP=Sn(),lP=p0.__importDefault(f0()),Qd=class{constructor(e,r){this.downloadFn=e,this.shouldThrowOnError=r,this[d0]="BlobDownloadBuilder",this.promise=null}asStream(){return new lP.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 p0.__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,cP.isStorageError)(e))return{data:null,error:e};throw e}})}};d0=Symbol.toStringTag;ep.default=Qd});var y0=x(rp=>{"use strict";Object.defineProperty(rp,"__esModule",{value:!0});var $t=(ve(),ie(we)),Vt=Sn(),zt=Au(),m0=Ia(),fP=$t.__importDefault(h0()),dP={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},g0={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1},tp=class{constructor(e,r={},n,o){this.shouldThrowOnError=!1,this.url=e,this.headers=r,this.bucketId=n,this.fetch=(0,m0.resolveFetch)(o)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(e,r,n,o){return $t.__awaiter(this,void 0,void 0,function*(){try{let i,a=Object.assign(Object.assign({},g0),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),f=this._getFinalPath(c),d=yield(e=="PUT"?zt.put:zt.post)(this.fetch,`${this.url}/object/${f}`,i,Object.assign({headers:s},a?.duplex?{duplex:a.duplex}:{}));return{data:{path:c,id:d.Id,fullPath:d.Key},error:null}}catch(i){if(this.shouldThrowOnError)throw i;if((0,Vt.isStorageError)(i))return{data:null,error:i};throw i}})}upload(e,r,n){return $t.__awaiter(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,r,n)})}uploadToSignedUrl(e,r,n,o){return $t.__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:g0.upsert},o),f=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,f["cache-control"]=`max-age=${c.cacheControl}`,f["content-type"]=c.contentType);let d=yield(0,zt.put)(this.fetch,s.toString(),u,{headers:f});return{data:{path:i,fullPath:d.Key},error:null}}catch(u){if(this.shouldThrowOnError)throw u;if((0,Vt.isStorageError)(u))return{data:null,error:u};throw u}})}createSignedUploadUrl(e,r){return $t.__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,zt.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 Vt.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,Vt.isStorageError)(n))return{data:null,error:n};throw n}})}update(e,r,n){return $t.__awaiter(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,r,n)})}move(e,r,n){return $t.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,zt.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,Vt.isStorageError)(o))return{data:null,error:o};throw o}})}copy(e,r,n){return $t.__awaiter(this,void 0,void 0,function*(){try{return{data:{path:(yield(0,zt.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,Vt.isStorageError)(o))return{data:null,error:o};throw o}})}createSignedUrl(e,r,n){return $t.__awaiter(this,void 0,void 0,function*(){try{let o=this._getFinalPath(e),i=yield(0,zt.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,Vt.isStorageError)(o))return{data:null,error:o};throw o}})}createSignedUrls(e,r,n){return $t.__awaiter(this,void 0,void 0,function*(){try{let o=yield(0,zt.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,Vt.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,zt.get)(this.fetch,`${this.url}/${o}/${s}${a}`,{headers:this.headers,noResolveJson:!0});return new fP.default(u,this.shouldThrowOnError)}info(e){return $t.__awaiter(this,void 0,void 0,function*(){let r=this._getFinalPath(e);try{let n=yield(0,zt.get)(this.fetch,`${this.url}/object/info/${r}`,{headers:this.headers});return{data:(0,m0.recursiveToCamel)(n),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Vt.isStorageError)(n))return{data:null,error:n};throw n}})}exists(e){return $t.__awaiter(this,void 0,void 0,function*(){let r=this._getFinalPath(e);try{return yield(0,zt.head)(this.fetch,`${this.url}/object/${r}`,{headers:this.headers}),{data:!0,error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Vt.isStorageError)(n)&&n instanceof Vt.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 $t.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,zt.remove)(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Vt.isStorageError)(r))return{data:null,error:r};throw r}})}list(e,r,n){return $t.__awaiter(this,void 0,void 0,function*(){try{let o=Object.assign(Object.assign(Object.assign({},dP),r),{prefix:e||""});return{data:yield(0,zt.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,Vt.isStorageError)(o))return{data:null,error:o};throw o}})}listV2(e,r){return $t.__awaiter(this,void 0,void 0,function*(){try{let n=Object.assign({},e);return{data:yield(0,zt.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,Vt.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("&")}};rp.default=tp});var np=x(Ou=>{"use strict";Object.defineProperty(Ou,"__esModule",{value:!0});Ou.version=void 0;Ou.version="2.84.0"});var op=x(Fu=>{"use strict";Object.defineProperty(Fu,"__esModule",{value:!0});Fu.DEFAULT_HEADERS=void 0;var pP=np();Fu.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${pP.version}`}});var D0=x(ap=>{"use strict";Object.defineProperty(ap,"__esModule",{value:!0});var ti=(ve(),ie(we)),hP=op(),ri=Sn(),ni=Au(),mP=Ia(),ip=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({},hP.DEFAULT_HEADERS),r),this.fetch=(0,mP.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(e){return ti.__awaiter(this,void 0,void 0,function*(){try{let r=this.listBucketOptionsToQueryString(e);return{data:yield(0,ni.get)(this.fetch,`${this.url}/bucket${r}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ri.isStorageError)(r))return{data:null,error:r};throw r}})}getBucket(e){return ti.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ni.get)(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ri.isStorageError)(r))return{data:null,error:r};throw r}})}createBucket(e){return ti.__awaiter(this,arguments,void 0,function*(r,n={public:!1}){try{return{data:yield(0,ni.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,ri.isStorageError)(o))return{data:null,error:o};throw o}})}updateBucket(e,r){return ti.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ni.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,ri.isStorageError)(n))return{data:null,error:n};throw n}})}emptyBucket(e){return ti.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ni.post)(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ri.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return ti.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ni.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ri.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():""}};ap.default=ip});var dp=x(fp=>{"use strict";Object.defineProperty(fp,"__esModule",{value:!0});var sp=(ve(),ie(we)),gP=op(),up=Sn(),cp=Au(),yP=Ia(),lp=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},gP.DEFAULT_HEADERS),r),this.fetch=(0,yP.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return sp.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,cp.post)(this.fetch,`${this.url}/bucket`,{name:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,up.isStorageError)(r))return{data:null,error:r};throw r}})}listBuckets(e){return sp.__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,cp.get)(this.fetch,o,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,up.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return sp.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,cp.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,up.isStorageError)(r))return{data:null,error:r};throw r}})}};fp.default=lp});var Pu=x(ku=>{"use strict";Object.defineProperty(ku,"__esModule",{value:!0});ku.DEFAULT_HEADERS=void 0;var DP=np();ku.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${DP.version}`,"Content-Type":"application/json"}});var oi=x(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.StorageVectorsErrorCode=_r.StorageVectorsUnknownError=_r.StorageVectorsApiError=_r.StorageVectorsError=void 0;_r.isStorageVectorsError=bP;var Ra=class extends Error{constructor(e){super(e),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};_r.StorageVectorsError=Ra;function bP(t){return typeof t=="object"&&t!==null&&"__isStorageVectorsError"in t}var pp=class extends Ra{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}}};_r.StorageVectorsApiError=pp;var hp=class extends Ra{constructor(e,r){super(e),this.name="StorageVectorsUnknownError",this.originalError=r}};_r.StorageVectorsUnknownError=hp;var b0;(function(t){t.InternalError="InternalError",t.S3VectorConflictException="S3VectorConflictException",t.S3VectorNotFoundException="S3VectorNotFoundException",t.S3VectorBucketNotEmpty="S3VectorBucketNotEmpty",t.S3VectorMaxBucketsExceeded="S3VectorMaxBucketsExceeded",t.S3VectorMaxIndexesExceeded="S3VectorMaxIndexesExceeded"})(b0||(_r.StorageVectorsErrorCode=b0={}))});var ii=x(dr=>{"use strict";Object.defineProperty(dr,"__esModule",{value:!0});dr.validateVectorDimension=dr.normalizeToFloat32=dr.isPlainObject=dr.resolveResponse=dr.resolveFetch=void 0;var wP=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);dr.resolveFetch=wP;var vP=()=>Response;dr.resolveResponse=vP;var CP=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)};dr.isPlainObject=CP;var EP=t=>Array.from(new Float32Array(t));dr.normalizeToFloat32=EP;var _P=(t,e)=>{if(e!==void 0&&t.float32.length!==e)throw new Error(`Vector dimension mismatch: expected ${e}, got ${t.float32.length}`)};dr.validateVectorDimension=_P});var Tu=x(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:!0});si.get=OP;si.post=FP;si.put=kP;si.remove=PP;var ai=(ve(),ie(we)),$u=oi(),SP=ii(),w0=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),xP=(t,e,r)=>ai.__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 $u.StorageVectorsApiError(w0(a),o,s))}).catch(()=>{let a=o+"",s=i.statusText||`HTTP ${o} error`;e(new $u.StorageVectorsApiError(s,o,a))});else{let a=o+"",s=i.statusText||`HTTP ${o} error`;e(new $u.StorageVectorsApiError(s,o,a))}}else e(new $u.StorageVectorsUnknownError(w0(t),t))}),AP=(t,e,r,n)=>{let o={method:t,headers:e?.headers||{}};return t==="GET"||!n?o:((0,SP.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 Iu(t,e,r,n,o,i){return ai.__awaiter(this,void 0,void 0,function*(){return new Promise((a,s)=>{t(r,AP(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=>xP(u,s,n))})})}function OP(t,e,r,n){return ai.__awaiter(this,void 0,void 0,function*(){return Iu(t,"GET",e,r,n)})}function FP(t,e,r,n,o){return ai.__awaiter(this,void 0,void 0,function*(){return Iu(t,"POST",e,n,o,r)})}function kP(t,e,r,n,o){return ai.__awaiter(this,void 0,void 0,function*(){return Iu(t,"PUT",e,n,o,r)})}function PP(t,e,r,n,o){return ai.__awaiter(this,void 0,void 0,function*(){return Iu(t,"DELETE",e,n,o,r)})}});var yp=x(gp=>{"use strict";Object.defineProperty(gp,"__esModule",{value:!0});var Ru=(ve(),ie(we)),$P=Pu(),Bu=oi(),Nu=Tu(),IP=ii(),mp=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},$P.DEFAULT_HEADERS),r),this.fetch=(0,IP.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createIndex(e){return Ru.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Nu.post)(this.fetch,`${this.url}/CreateIndex`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Bu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getIndex(e,r){return Ru.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Nu.post)(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:e,indexName:r},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Bu.isStorageVectorsError)(n))return{data:null,error:n};throw n}})}listIndexes(e){return Ru.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Nu.post)(this.fetch,`${this.url}/ListIndexes`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Bu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteIndex(e,r){return Ru.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Nu.post)(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:e,indexName:r},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Bu.isStorageVectorsError)(n))return{data:null,error:n};throw n}})}};gp.default=mp});var wp=x(bp=>{"use strict";Object.defineProperty(bp,"__esModule",{value:!0});var Ba=(ve(),ie(we)),TP=Pu(),Na=oi(),La=Tu(),RP=ii(),Dp=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},TP.DEFAULT_HEADERS),r),this.fetch=(0,RP.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}putVectors(e){return Ba.__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,La.post)(this.fetch,`${this.url}/PutVectors`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Na.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getVectors(e){return Ba.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,La.post)(this.fetch,`${this.url}/GetVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Na.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}listVectors(e){return Ba.__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,La.post)(this.fetch,`${this.url}/ListVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Na.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}queryVectors(e){return Ba.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,La.post)(this.fetch,`${this.url}/QueryVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Na.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteVectors(e){return Ba.__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,La.post)(this.fetch,`${this.url}/DeleteVectors`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Na.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}};bp.default=Dp});var Ep=x(Cp=>{"use strict";Object.defineProperty(Cp,"__esModule",{value:!0});var Lu=(ve(),ie(we)),BP=Pu(),ju=oi(),Uu=Tu(),NP=ii(),vp=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},BP.DEFAULT_HEADERS),r),this.fetch=(0,NP.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return Lu.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Uu.post)(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ju.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getBucket(e){return Lu.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Uu.post)(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ju.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}listBuckets(){return Lu.__awaiter(this,arguments,void 0,function*(e={}){try{return{data:yield(0,Uu.post)(this.fetch,`${this.url}/ListVectorBuckets`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ju.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return Lu.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Uu.post)(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ju.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}};Cp.default=vp});var v0=x(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});xn.VectorIndexScope=xn.VectorBucketScope=xn.StorageVectorsClient=void 0;var pr=(ve(),ie(we)),LP=pr.__importDefault(yp()),jP=pr.__importDefault(wp()),UP=pr.__importDefault(Ep()),_p=class extends UP.default{constructor(e,r={}){super(e,r.headers||{},r.fetch)}from(e){return new Mu(this.url,this.headers,e,this.fetch)}};xn.StorageVectorsClient=_p;var Mu=class extends LP.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 pr.__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 pr.__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 pr.__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 pr.__awaiter(this,void 0,void 0,function*(){return r.deleteIndex.call(this,this.vectorBucketName,e)})}index(e){return new qu(this.url,this.headers,this.vectorBucketName,e,this.fetch)}};xn.VectorBucketScope=Mu;var qu=class extends jP.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 pr.__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 pr.__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 pr.__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 pr.__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 pr.__awaiter(this,void 0,void 0,function*(){return r.deleteVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}};xn.VectorIndexScope=qu});var Ap=x(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.validateVectorDimension=Ce.normalizeToFloat32=Ce.isPlainObject=Ce.resolveResponse=Ce.resolveFetch=Ce.isStorageVectorsError=Ce.StorageVectorsErrorCode=Ce.StorageVectorsUnknownError=Ce.StorageVectorsApiError=Ce.StorageVectorsError=Ce.VectorDataApi=Ce.VectorIndexApi=Ce.VectorBucketApi=Ce.VectorIndexScope=Ce.VectorBucketScope=Ce.StorageVectorsClient=void 0;var Sp=(ve(),ie(we)),xp=v0();Object.defineProperty(Ce,"StorageVectorsClient",{enumerable:!0,get:function(){return xp.StorageVectorsClient}});Object.defineProperty(Ce,"VectorBucketScope",{enumerable:!0,get:function(){return xp.VectorBucketScope}});Object.defineProperty(Ce,"VectorIndexScope",{enumerable:!0,get:function(){return xp.VectorIndexScope}});var MP=Ep();Object.defineProperty(Ce,"VectorBucketApi",{enumerable:!0,get:function(){return Sp.__importDefault(MP).default}});var qP=yp();Object.defineProperty(Ce,"VectorIndexApi",{enumerable:!0,get:function(){return Sp.__importDefault(qP).default}});var HP=wp();Object.defineProperty(Ce,"VectorDataApi",{enumerable:!0,get:function(){return Sp.__importDefault(HP).default}});var ja=oi();Object.defineProperty(Ce,"StorageVectorsError",{enumerable:!0,get:function(){return ja.StorageVectorsError}});Object.defineProperty(Ce,"StorageVectorsApiError",{enumerable:!0,get:function(){return ja.StorageVectorsApiError}});Object.defineProperty(Ce,"StorageVectorsUnknownError",{enumerable:!0,get:function(){return ja.StorageVectorsUnknownError}});Object.defineProperty(Ce,"StorageVectorsErrorCode",{enumerable:!0,get:function(){return ja.StorageVectorsErrorCode}});Object.defineProperty(Ce,"isStorageVectorsError",{enumerable:!0,get:function(){return ja.isStorageVectorsError}});var Ua=ii();Object.defineProperty(Ce,"resolveFetch",{enumerable:!0,get:function(){return Ua.resolveFetch}});Object.defineProperty(Ce,"resolveResponse",{enumerable:!0,get:function(){return Ua.resolveResponse}});Object.defineProperty(Ce,"isPlainObject",{enumerable:!0,get:function(){return Ua.isPlainObject}});Object.defineProperty(Ce,"normalizeToFloat32",{enumerable:!0,get:function(){return Ua.normalizeToFloat32}});Object.defineProperty(Ce,"validateVectorDimension",{enumerable:!0,get:function(){return Ua.validateVectorDimension}})});var C0=x(Hu=>{"use strict";Object.defineProperty(Hu,"__esModule",{value:!0});Hu.StorageClient=void 0;var Fp=(ve(),ie(we)),VP=Fp.__importDefault(y0()),zP=Fp.__importDefault(D0()),KP=Fp.__importDefault(dp()),GP=Ap(),Op=class extends zP.default{constructor(e,r={},n,o){super(e,r,n,o)}from(e){return new VP.default(this.url,this.headers,e,this.fetch)}get vectors(){return new GP.StorageVectorsClient(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new KP.default(this.url+"/iceberg",this.headers,this.fetch)}};Hu.StorageClient=Op});var _0=x(E0=>{"use strict";Object.defineProperty(E0,"__esModule",{value:!0})});var S0=x(en=>{"use strict";Object.defineProperty(en,"__esModule",{value:!0});en.StorageAnalyticsClient=en.StorageClient=void 0;var Vu=(ve(),ie(we)),WP=C0();Object.defineProperty(en,"StorageClient",{enumerable:!0,get:function(){return WP.StorageClient}});var YP=dp();Object.defineProperty(en,"StorageAnalyticsClient",{enumerable:!0,get:function(){return Vu.__importDefault(YP).default}});Vu.__exportStar(_0(),en);Vu.__exportStar(Sn(),en);Vu.__exportStar(Ap(),en)});var x0=x(zu=>{"use strict";Object.defineProperty(zu,"__esModule",{value:!0});zu.version=void 0;zu.version="2.84.0"});var A0=x(er=>{"use strict";Object.defineProperty(er,"__esModule",{value:!0});er.DEFAULT_REALTIME_OPTIONS=er.DEFAULT_AUTH_OPTIONS=er.DEFAULT_DB_OPTIONS=er.DEFAULT_GLOBAL_OPTIONS=er.DEFAULT_HEADERS=void 0;var JP=x0(),Ma="";typeof Deno<"u"?Ma="deno":typeof document<"u"?Ma="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Ma="react-native":Ma="node";er.DEFAULT_HEADERS={"X-Client-Info":`supabase-js-${Ma}/${JP.version}`};er.DEFAULT_GLOBAL_OPTIONS={headers:er.DEFAULT_HEADERS};er.DEFAULT_DB_OPTIONS={schema:"public"};er.DEFAULT_AUTH_OPTIONS={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"};er.DEFAULT_REALTIME_OPTIONS={}});var O0=x(Ir=>{"use strict";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.fetchWithAuth=Ir.resolveHeadersConstructor=Ir.resolveFetch=void 0;var XP=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);Ir.resolveFetch=XP;var ZP=()=>Headers;Ir.resolveHeadersConstructor=ZP;var QP=(t,e,r)=>{let n=(0,Ir.resolveFetch)(r),o=(0,Ir.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}))}};Ir.fetchWithAuth=QP});var k0=x(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.isBrowser=void 0;An.uuid=e$;An.ensureTrailingSlash=F0;An.applySettingDefaults=r$;An.validateSupabaseUrl=n$;function e$(){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 F0(t){return t.endsWith("/")?t:t+"/"}var t$=()=>typeof window<"u";An.isBrowser=t$;function r$(t,e){var r,n;let{db:o,auth:i,realtime:a,global:s}=t,{db:u,auth:c,realtime:f,global:d}=e,p={db:Object.assign(Object.assign({},u),o),auth:Object.assign(Object.assign({},c),i),realtime:Object.assign(Object.assign({},f),a),storage:{},global:Object.assign(Object.assign(Object.assign({},d),s),{headers:Object.assign(Object.assign({},(r=d?.headers)!==null&&r!==void 0?r:{}),(n=s?.headers)!==null&&n!==void 0?n:{})}),accessToken:async()=>""};return t.accessToken?p.accessToken=t.accessToken:delete p.accessToken,p}function n$(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(F0(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}});var qp={};Jr(qp,{AuthAdminApi:()=>Pp,AuthApiError:()=>$p,AuthClient:()=>kp,AuthError:()=>Sr,AuthImplicitGrantRedirectError:()=>Np,AuthInvalidCredentialsError:()=>Bp,AuthInvalidTokenResponseError:()=>Rp,AuthPKCEGrantCodeExchangeError:()=>Lp,AuthRetryableError:()=>Ip,AuthSessionMissingError:()=>Tp,AuthWeakPasswordError:()=>jp,GoTrueAdminApi:()=>Gu,GoTrueClient:()=>Ku,NavigatorLockAcquireTimeoutError:()=>Up,isAuthApiError:()=>u$,isAuthError:()=>s$,isAuthRetryableError:()=>c$,isAuthSessionMissingError:()=>l$,isAuthWeakPasswordError:()=>f$,lockInternals:()=>a$,navigatorLock:()=>o$,processLock:()=>i$});var Mp,P0,Ku,Gu,kp,Pp,Sr,$p,Ip,Tp,Rp,Bp,Np,Lp,jp,o$,i$,Up,a$,s$,u$,c$,l$,f$,Hp=Ze(()=>{Mp=()=>Promise.resolve({data:{session:null,user:null},error:null}),P0={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}):Mp}},Ku=class{constructor(e){return this.options=e,new Proxy(this,P0)}},Gu=class{constructor(e){return this.options=e,new Proxy(this,P0)}},kp=class extends Ku{},Pp=class extends Gu{},Sr=class extends Error{},$p=class extends Sr{},Ip=class extends Sr{},Tp=class extends Sr{},Rp=class extends Sr{},Bp=class extends Sr{},Np=class extends Sr{},Lp=class extends Sr{},jp=class extends Sr{},o$=Mp,i$=Mp,Up=class extends Error{},a$={},s$=()=>!1,u$=()=>!1,c$=()=>!1,l$=()=>!1,f$=()=>!1});var $0=x(Wu=>{"use strict";Object.defineProperty(Wu,"__esModule",{value:!0});Wu.SupabaseAuthClient=void 0;var d$=(Hp(),ie(qp)),Vp=class extends d$.AuthClient{constructor(e){super(e)}};Wu.SupabaseAuthClient=Vp});var Gp=x(Kp=>{"use strict";Object.defineProperty(Kp,"__esModule",{value:!0});var p$=xd(),h$=Hd(),m$=(Kd(),ie(zd)),g$=S0(),Yu=A0(),y$=O0(),I0=k0(),D$=$0(),zp=class{constructor(e,r,n){var o,i,a;this.supabaseUrl=e,this.supabaseKey=r;let s=(0,I0.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:Yu.DEFAULT_DB_OPTIONS,realtime:Yu.DEFAULT_REALTIME_OPTIONS,auth:Object.assign(Object.assign({},Yu.DEFAULT_AUTH_OPTIONS),{storageKey:u}),global:Yu.DEFAULT_GLOBAL_OPTIONS},f=(0,I0.applySettingDefaults)(n??{},c);this.storageKey=(o=f.auth.storageKey)!==null&&o!==void 0?o:"",this.headers=(i=f.global.headers)!==null&&i!==void 0?i:{},f.accessToken?(this.accessToken=f.accessToken,this.auth=new Proxy({},{get:(d,p)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(p)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((a=f.auth)!==null&&a!==void 0?a:{},this.headers,f.global.fetch),this.fetch=(0,y$.fetchWithAuth)(r,this._getAccessToken.bind(this),f.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},f.realtime)),this.accessToken&&this.accessToken().then(d=>this.realtime.setAuth(d)).catch(d=>console.warn("Failed to set initial Realtime auth token:",d)),this.rest=new h$.PostgrestClient(new URL("rest/v1",s).href,{headers:this.headers,schema:f.db.schema,fetch:this.fetch}),this.storage=new g$.StorageClient(this.storageUrl.href,this.headers,this.fetch,n?.storage),f.accessToken||this._listenForAuthEvents()}get functions(){return new p$.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:f},d,p){let h={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new D$.SupabaseAuthClient({url:this.authUrl.href,headers:Object.assign(Object.assign({},h),d),storageKey:a,autoRefreshToken:e,persistSession:r,detectSessionInUrl:n,storage:o,userStorage:i,flowType:s,lock:u,debug:c,throwOnError:f,fetch:p,hasCustomAuthorizationHeader:Object.keys(this.headers).some(m=>m.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new m$.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)}};Kp.default=zp});var B0=x(Re=>{"use strict";var b$=Re&&Re.__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]})),T0=Re&&Re.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&b$(e,t,r)},R0=Re&&Re.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Re,"__esModule",{value:!0});Re.createClient=Re.SupabaseClient=Re.FunctionRegion=Re.FunctionsError=Re.FunctionsRelayError=Re.FunctionsFetchError=Re.FunctionsHttpError=Re.PostgrestError=void 0;var w$=R0(Gp());T0((Hp(),ie(qp)),Re);var v$=Hd();Object.defineProperty(Re,"PostgrestError",{enumerable:!0,get:function(){return v$.PostgrestError}});var qa=xd();Object.defineProperty(Re,"FunctionsHttpError",{enumerable:!0,get:function(){return qa.FunctionsHttpError}});Object.defineProperty(Re,"FunctionsFetchError",{enumerable:!0,get:function(){return qa.FunctionsFetchError}});Object.defineProperty(Re,"FunctionsRelayError",{enumerable:!0,get:function(){return qa.FunctionsRelayError}});Object.defineProperty(Re,"FunctionsError",{enumerable:!0,get:function(){return qa.FunctionsError}});Object.defineProperty(Re,"FunctionRegion",{enumerable:!0,get:function(){return qa.FunctionRegion}});T0((Kd(),ie(zd)),Re);var C$=Gp();Object.defineProperty(Re,"SupabaseClient",{enumerable:!0,get:function(){return R0(C$).default}});var E$=(t,e,r)=>new w$.default(t,e,r);Re.createClient=E$;function _$(){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}_$()&&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 Wp=x((Az,N0)=>{N0.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 Ju=x(j0=>{var L0={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 S$(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(L0))j0[t]=S$(L0[t])});var V0=x((Fz,H0)=>{var x$=require("fs"),ot=require("path"),U0=Wp(),A$=Ju(),O$=typeof process=="object"&&process.platform==="win32",M0=t=>typeof t=="object"&&t!==null,q0=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=ot.sep,this.fs=x$,M0(t)&&M0(t.fs)&&typeof t.fs.statSync=="function"&&(this.fs=t.fs)}H0.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 A$.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=ot.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=ot.dirname(t);i.fs.exists(c,function(f){f||i.makeDir(c),i.fs.open(t,"w",438,function(d,p){d?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)})})})})}):p?i.fs.write(p,e,0,e.length,0,function(){i.fs.close(p,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=ot.join(n,s),c=e.fs.statSync(u);(!o||o.test(u))&&a.push(ot.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=ot.join(t,s),r.fs.stat(s,function(u,c){if(u)return e(u);c&&(n.push(ot.normalize(s)+(c.isDirectory()?r.sep:"")),c.isDirectory()?r.findFilesAsync(s,function(f,d){if(f)return e(f);n=n.concat(d),--a||e(null,n)}):--a||e(null,n))})})})};We.prototype.getAttributes=function(){};We.prototype.setAttributes=function(){};We.crc32update=function(t,e){return q0[(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 U0.STORED:return"STORED ("+t+")";case U0.DEFLATED:return"DEFLATED ("+t+")";default:return"UNSUPPORTED ("+t+")"}};We.canonical=function(t){if(!t)return"";let e=ot.posix.normalize("/"+t.split("\\").join("/"));return ot.join(".",e)};We.zipnamefix=function(t){if(!t)return"";let e=ot.posix.normalize("/"+t.split("\\").join("/"));return ot.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=ot.resolve(ot.normalize(t));for(var r=e.split("/"),n=0,o=r.length;n<o;n++){var i=ot.normalize(ot.join(t,r.slice(n,o).join(ot.sep)));if(i.indexOf(t)===0)return i}return ot.normalize(ot.join(t,ot.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=O$;We.crcTable=q0});var K0=x((kz,z0)=>{var F$=require("path");z0.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=F$.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 W0=x((Pz,G0)=>{G0.exports={efs:!0,encode:t=>Buffer.from(t,"utf8"),decode:t=>t.toString("utf8")}});var ci=x(($z,ui)=>{ui.exports=V0();ui.exports.Constants=Wp();ui.exports.Errors=Ju();ui.exports.FileAttr=K0();ui.exports.decoder=W0()});var J0=x((Iz,Y0)=>{var On=ci(),Y=On.Constants;Y0.exports=function(){var t=20,e=10,r=0,n=0,o=0,i=0,a=0,s=0,u=0,c=0,f=0,d=0,p=0,h=0,m=0;t|=On.isWin?2560:768,r|=Y.FLG_EFS;let y={extraLen:0},D=g=>Math.max(0,g)>>>0,v=g=>Math.max(0,g)&65535,E=g=>Math.max(0,g)&255;return o=On.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&Y.FLG_EFS)>0},set flags_efs(g){g?r|=Y.FLG_EFS:r&=~Y.FLG_EFS},get flags_desc(){return(r&Y.FLG_DESC)>0},set flags_desc(g){g?r|=Y.FLG_DESC:r&=~Y.FLG_DESC},get method(){return n},set method(g){switch(g){case Y.STORED:this.version=10;case Y.DEFLATED:default:this.version=20}n=g},get time(){return On.fromDOS2Date(this.timeval)},set time(g){this.timeval=On.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 y.extraLen},set extraLocalLength(g){y.extraLen=g},get commentLength(){return f},set commentLength(g){f=g},get diskNumStart(){return d},set diskNumStart(g){d=D(g)},get inAttr(){return p},set inAttr(g){p=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&Y.FLG_ENC)===Y.FLG_ENC},get centralHeaderSize(){return Y.CENHDR+u+c+f},get realDataOffset(){return m+Y.LOCHDR+y.fnameLen+y.extraLen},get localHeader(){return y},loadLocalHeaderFromBinary:function(g){var _=g.slice(m,m+Y.LOCHDR);if(_.readUInt32LE(0)!==Y.LOCSIG)throw On.Errors.INVALID_LOC();y.version=_.readUInt16LE(Y.LOCVER),y.flags=_.readUInt16LE(Y.LOCFLG),y.method=_.readUInt16LE(Y.LOCHOW),y.time=_.readUInt32LE(Y.LOCTIM),y.crc=_.readUInt32LE(Y.LOCCRC),y.compressedSize=_.readUInt32LE(Y.LOCSIZ),y.size=_.readUInt32LE(Y.LOCLEN),y.fnameLen=_.readUInt16LE(Y.LOCNAM),y.extraLen=_.readUInt16LE(Y.LOCEXT);let S=m+Y.LOCHDR+y.fnameLen,P=S+y.extraLen;return g.slice(S,P)},loadFromBinary:function(g){if(g.length!==Y.CENHDR||g.readUInt32LE(0)!==Y.CENSIG)throw On.Errors.INVALID_CEN();t=g.readUInt16LE(Y.CENVEM),e=g.readUInt16LE(Y.CENVER),r=g.readUInt16LE(Y.CENFLG),n=g.readUInt16LE(Y.CENHOW),o=g.readUInt32LE(Y.CENTIM),i=g.readUInt32LE(Y.CENCRC),a=g.readUInt32LE(Y.CENSIZ),s=g.readUInt32LE(Y.CENLEN),u=g.readUInt16LE(Y.CENNAM),c=g.readUInt16LE(Y.CENEXT),f=g.readUInt16LE(Y.CENCOM),d=g.readUInt16LE(Y.CENDSK),p=g.readUInt16LE(Y.CENATT),h=g.readUInt32LE(Y.CENATX),m=g.readUInt32LE(Y.CENOFF)},localHeaderToBinary:function(){var g=Buffer.alloc(Y.LOCHDR);return g.writeUInt32LE(Y.LOCSIG,0),g.writeUInt16LE(e,Y.LOCVER),g.writeUInt16LE(r,Y.LOCFLG),g.writeUInt16LE(n,Y.LOCHOW),g.writeUInt32LE(o,Y.LOCTIM),g.writeUInt32LE(i,Y.LOCCRC),g.writeUInt32LE(a,Y.LOCSIZ),g.writeUInt32LE(s,Y.LOCLEN),g.writeUInt16LE(u,Y.LOCNAM),g.writeUInt16LE(y.extraLen,Y.LOCEXT),g},centralHeaderToBinary:function(){var g=Buffer.alloc(Y.CENHDR+u+c+f);return g.writeUInt32LE(Y.CENSIG,0),g.writeUInt16LE(t,Y.CENVEM),g.writeUInt16LE(e,Y.CENVER),g.writeUInt16LE(r,Y.CENFLG),g.writeUInt16LE(n,Y.CENHOW),g.writeUInt32LE(o,Y.CENTIM),g.writeUInt32LE(i,Y.CENCRC),g.writeUInt32LE(a,Y.CENSIZ),g.writeUInt32LE(s,Y.CENLEN),g.writeUInt16LE(u,Y.CENNAM),g.writeUInt16LE(c,Y.CENEXT),g.writeUInt16LE(f,Y.CENCOM),g.writeUInt16LE(d,Y.CENDSK),g.writeUInt16LE(p,Y.CENATT),g.writeUInt32LE(h,Y.CENATX),g.writeUInt32LE(m,Y.CENOFF),g},toJSON:function(){let g=function(_){return _+" bytes"};return{made:t,version:e,flags:r,method:On.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(f),diskNumStart:d,inAttr:p,attr:h,offset:m,centralHeaderSize:g(Y.CENHDR+u+c+f)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var Z0=x((Tz,X0)=>{var li=ci(),Ve=li.Constants;X0.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 Ve.ENDHDR+o},loadFromBinary:function(i){if((i.length!==Ve.ENDHDR||i.readUInt32LE(0)!==Ve.ENDSIG)&&(i.length<Ve.ZIP64HDR||i.readUInt32LE(0)!==Ve.ZIP64SIG))throw li.Errors.INVALID_END();i.readUInt32LE(0)===Ve.ENDSIG?(t=i.readUInt16LE(Ve.ENDSUB),e=i.readUInt16LE(Ve.ENDTOT),r=i.readUInt32LE(Ve.ENDSIZ),n=i.readUInt32LE(Ve.ENDOFF),o=i.readUInt16LE(Ve.ENDCOM)):(t=li.readBigUInt64LE(i,Ve.ZIP64SUB),e=li.readBigUInt64LE(i,Ve.ZIP64TOT),r=li.readBigUInt64LE(i,Ve.ZIP64SIZE),n=li.readBigUInt64LE(i,Ve.ZIP64OFF),o=0)},toBinary:function(){var i=Buffer.alloc(Ve.ENDHDR+o);return i.writeUInt32LE(Ve.ENDSIG,0),i.writeUInt32LE(0,4),i.writeUInt16LE(t,Ve.ENDSUB),i.writeUInt16LE(e,Ve.ENDTOT),i.writeUInt32LE(r,Ve.ENDSIZ),i.writeUInt32LE(n,Ve.ENDOFF),i.writeUInt16LE(o,Ve.ENDCOM),i.fill(" ",Ve.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 Jp=x(Yp=>{Yp.EntryHeader=J0();Yp.MainHeader=Z0()});var eb=x((Bz,Q0)=>{Q0.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 f=i[c];f.copy(s,u),u+=f.length}n&&n(s)}),o.end(t)}}}});var rb=x((Nz,tb)=>{var k$=+(process.versions?process.versions.node:"").split(".")[0]||0;tb.exports=function(t,e){var r=require("zlib");let n=k$>=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 f=0;f<a.length;f++){var d=a[f];d.copy(u,c),c+=d.length}o&&o(u)}),i.end(t)}}}});var sb=x((Lz,ab)=>{"use strict";var{randomFillSync:nb}=require("crypto"),P$=Ju(),$$=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}),ib=(t,e)=>Math.imul(t,e)>>>0,ob=(t,e)=>$$[(t^e)&255]^t>>>8,Ha=()=>typeof nb=="function"?nb(Buffer.alloc(12)):Ha.node();Ha.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 Xu={genSalt:Ha};function Zu(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])}Zu.prototype.updateKeys=function(t){let e=this.keys;return e[0]=ob(e[0],t),e[1]+=e[0]&255,e[1]=ib(e[1],134775813)+1,e[2]=ob(e[2],e[1]>>>24),t};Zu.prototype.next=function(){let t=(this.keys[2]|2)>>>0;return ib(t,t^1)>>8&255};function I$(t){let e=new Zu(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 T$(t){let e=new Zu(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 R$(t,e,r){if(!t||!Buffer.isBuffer(t)||t.length<12)return Buffer.alloc(0);let n=I$(r),o=n(t.slice(0,12)),i=(e.flags&8)===8?e.timeHighByte:e.crc>>>24;if(o[11]!==i)throw P$.WRONG_PASSWORD();return n(t.slice(12))}function B$(t){Buffer.isBuffer(t)&&t.length>=12?Xu.genSalt=function(){return t.slice(0,12)}:t==="node"?Xu.genSalt=Ha.node:Xu.genSalt=Ha}function N$(t,e,r,n=!1){t==null&&(t=Buffer.alloc(0)),Buffer.isBuffer(t)||(t=Buffer.from(t.toString()));let o=T$(r),i=Xu.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)}ab.exports={decrypt:R$,encrypt:N$,_salter:B$}});var ub=x(Qu=>{Qu.Deflater=eb();Qu.Inflater=rb();Qu.ZipCrypto=sb()});var Zp=x((Uz,cb)=>{var Oe=ci(),L$=Jp(),Ye=Oe.Constants,Xp=ub();cb.exports=function(t,e){var r=new L$.EntryHeader,n=Buffer.alloc(0),o=Buffer.alloc(0),i=!1,a=null,s=Buffer.alloc(0),u=Buffer.alloc(0),c=!0;let f=t,d=typeof f.decoder=="object"?f.decoder:Oe.decoder;c=d.hasOwnProperty("efs")?d.efs:!1;function p(){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)==Ye.LOCSIG||e.readUInt32LE(S)==Ye.CENSIG)throw Oe.Errors.DESCRIPTOR_NOT_EXIST();if(e.readUInt32LE(S)==Ye.EXTSIG)_.crc=e.readUInt32LE(S+Ye.EXTCRC),_.compressedSize=e.readUInt32LE(S+Ye.EXTSIZ),_.size=e.readUInt32LE(S+Ye.EXTLEN);else if(e.readUInt16LE(S+12)===19280)_.crc=e.readUInt32LE(S+Ye.EXTCRC-4),_.compressedSize=e.readUInt32LE(S+Ye.EXTSIZ-4),_.size=e.readUInt32LE(S+Ye.EXTLEN-4);else throw Oe.Errors.DESCRIPTOR_UNKNOWN();if(_.compressedSize!==r.compressedSize||_.size!==r.size||_.crc!==r.crc)throw Oe.Errors.DESCRIPTOR_FAULTY();if(Oe.crc32(g)!==_.crc)return!1}else if(Oe.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),Oe.Errors.DIRECTORY_CONTENT_ERROR()),Buffer.alloc(0);var P=p();if(P.length===0)return g&&_&&_(P),P;if(r.encrypted){if(typeof S!="string"&&!Buffer.isBuffer(S))throw Oe.Errors.INVALID_PASS_PARAM();P=Xp.ZipCrypto.decrypt(P,r,S)}var F=Buffer.alloc(r.size);switch(r.method){case Oe.Constants.STORED:if(P.copy(F),h(F))return g&&_&&_(F),F;throw g&&_&&_(F,Oe.Errors.BAD_CRC()),Oe.Errors.BAD_CRC();case Oe.Constants.DEFLATED:var B=new Xp.Inflater(P,r.size);if(g)B.inflateAsync(function(T){T.copy(T,0),_&&(h(T)?_(T):_(T,Oe.Errors.BAD_CRC()))});else{if(B.inflate(F).copy(F,0),!h(F))throw Oe.Errors.BAD_CRC(`"${d.decode(n)}"`);return F}break;default:throw g&&_&&_(Buffer.alloc(0),Oe.Errors.UNKNOWN_METHOD()),Oe.Errors.UNKNOWN_METHOD()}}function y(g,_){if((!a||!a.length)&&Buffer.isBuffer(e))return g&&_&&_(p()),p();if(a.length&&!i){var S;switch(r.method){case Oe.Constants.STORED:return r.compressedSize=r.size,S=Buffer.alloc(a.length),a.copy(S),g&&_&&_(S),S;default:case Oe.Constants.DEFLATED:var P=new Xp.Deflater(a);if(g)P.deflateAsync(function(B){S=Buffer.alloc(B.length),r.compressedSize=B.length,B.copy(S),_&&_(S)});else{var F=P.deflate();return r.compressedSize=F.length,F}P=null;break}}else if(g&&_)_(Buffer.alloc(0));else return Buffer.alloc(0)}function D(g,_){return(g.readUInt32LE(_+4)<<4)+g.readUInt32LE(_)}function v(g){try{for(var _=0,S,P,F;_+4<g.length;)S=g.readUInt16LE(_),_+=2,P=g.readUInt16LE(_),_+=2,F=g.slice(_,_+P),_+=P,Ye.ID_ZIP64===S&&E(F)}catch{throw Oe.Errors.EXTRA_FIELD_PARSE_ERROR()}}function E(g){var _,S,P,F;g.length>=Ye.EF_ZIP64_SCOMP&&(_=D(g,Ye.EF_ZIP64_SUNCOMP),r.size===Ye.EF_ZIP64_OR_32&&(r.size=_)),g.length>=Ye.EF_ZIP64_RHO&&(S=D(g,Ye.EF_ZIP64_SCOMP),r.compressedSize===Ye.EF_ZIP64_OR_32&&(r.compressedSize=S)),g.length>=Ye.EF_ZIP64_DSN&&(P=D(g,Ye.EF_ZIP64_RHO),r.offset===Ye.EF_ZIP64_OR_32&&(r.offset=P)),g.length>=Ye.EF_ZIP64_DSN+4&&(F=g.readUInt32LE(Ye.EF_ZIP64_DSN),r.diskNumStart===Ye.EF_ZIP64_OR_16&&(r.diskNumStart=F))}return{get entryName(){return d.decode(n)},get rawEntryName(){return n},set entryName(g){n=Oe.toBuffer(g,d.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,v(g)},get comment(){return d.decode(o)},set comment(g){if(o=Oe.toBuffer(g,d.encode),r.commentLength=o.length,o.length>65535)throw Oe.Errors.COMMENT_TOO_LONG()},get name(){var g=d.decode(n);return i?g.substr(g.length-1).split("/").pop():g.split("/").pop()},get isDirectory(){return i},getCompressedData:function(){return y(!1,null)},getCompressedDataAsync:function(g){y(!0,g)},setData:function(g){a=Oe.toBuffer(g,Oe.decoder.encode),!i&&a.length?(r.size=a.length,r.method=Oe.Constants.DEFLATED,r.crc=Oe.crc32(g),r.changed=!0):r.method=Oe.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(),_=Oe.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 db=x((Mz,fb)=>{var lb=Zp(),j$=Jp(),gt=ci();fb.exports=function(t,e){var r=[],n={},o=Buffer.alloc(0),i=new j$.MainHeader,a=!1,s=null;let u=new Set,c=e,{noSort:f,decoder:d}=c;t?m(c.readEntries):a=!0;function p(){let D=new Set;for(let v of Object.keys(n)){let E=v.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 v of D)if(!(v in n)){let E=new lb(c);E.entryName=v,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)/gt.Constants.CENHDR)throw gt.Errors.DISK_ENTRY_TOO_LARGE();r=new Array(i.diskEntries);for(var D=i.offset,v=0;v<r.length;v++){var E=D,g=new lb(c,t);g.header=t.slice(E,E+=gt.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[v]=g,n[g.entryName]=g}u.clear(),p()}function m(D){var v=t.length-gt.Constants.ENDHDR,E=Math.max(0,v-65535),g=E,_=t.length,S=-1,P=0;for(typeof c.trailingSpace=="boolean"&&c.trailingSpace&&(E=0),v;v>=g;v--)if(t[v]===80){if(t.readUInt32LE(v)===gt.Constants.ENDSIG){S=v,P=v,_=v+gt.Constants.ENDHDR,g=v-gt.Constants.END64HDR;continue}if(t.readUInt32LE(v)===gt.Constants.END64SIG){g=E;continue}if(t.readUInt32LE(v)===gt.Constants.ZIP64SIG){S=v,_=v+gt.readBigUInt64LE(t,v+gt.Constants.ZIP64SIZE)+gt.Constants.ZIP64LEAD;break}}if(S==-1)throw gt.Errors.INVALID_FORMAT();i.loadFromBinary(t.slice(S,_)),i.commentLength&&(o=t.slice(P+gt.Constants.ENDHDR)),D&&h()}function y(){r.length>1&&!f&&r.sort((D,v)=>D.entryName.toLowerCase().localeCompare(v.entryName.toLowerCase()))}return{get entries(){return a||h(),r.filter(D=>!u.has(D))},get comment(){return d.decode(o)},set comment(D){o=gt.toBuffer(D,d.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,v=!0){a||h();let E=n[D];this.getEntryChildren(E,v).map(_=>_.entryName).forEach(this.deleteEntry)},deleteEntry:function(D){a||h();let v=n[D],E=r.indexOf(v);E>=0&&(r.splice(E,1),delete n[D],i.totalEntries=r.length)},getEntryChildren:function(D,v=!0){if(a||h(),typeof D=="object")if(D.isDirectory&&v){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 v=this.getEntryChildren(D);return v.includes(D)?v.length-1:v.length}return 0},compressToBuffer:function(){a||h(),y();let D=[],v=[],E=0,g=0;i.size=0,i.offset=0;let _=0;for(let F of this.entries){let B=F.getCompressedData();F.header.offset=g;let T=F.packLocalHeader(),j=T.length+B.length;g+=j,D.push(T),D.push(B);let A=F.packCentralHeader();v.push(A),i.size+=A.length,E+=j+A.length,_++}E+=i.mainHeaderSize,i.offset=g,i.totalEntries=_,g=0;let S=Buffer.alloc(E);for(let F of D)F.copy(S,g),g+=F.length;for(let F of v)F.copy(S,g),g+=F.length;let P=i.toBinary();return o&&o.copy(P,gt.Constants.ENDHDR),P.copy(S,g),t=S,a=!1,S},toAsyncBuffer:function(D,v,E,g){try{a||h(),y();let _=[],S=[],P=0,F=0,B=0;i.size=0,i.offset=0;let T=function(j){if(j.length>0){let A=j.shift(),M=A.entryName+A.extra.toString();E&&E(M),A.getCompressedDataAsync(function(L){g&&g(M),A.header.offset=F;let X=A.packLocalHeader(),k=X.length+L.length;F+=k,_.push(X),_.push(L);let b=A.packCentralHeader();S.push(b),i.size+=b.length,P+=k+b.length,B++,T(j)})}else{P+=i.mainHeaderSize,i.offset=F,i.totalEntries=B,F=0;let A=Buffer.alloc(P);_.forEach(function(L){L.copy(A,F),F+=L.length}),S.forEach(function(L){L.copy(A,F),F+=L.length});let M=i.toBinary();o&&o.copy(M,gt.Constants.ENDHDR),M.copy(A,F),t=A,a=!1,D(A)}};T(Array.from(this.entries))}catch(_){v(_)}}}}});var Qp=x((qz,hb)=>{var ze=ci(),Je=require("path"),U$=Zp(),M$=db(),Xn=(...t)=>ze.findLast(t,e=>typeof e=="boolean"),pb=(...t)=>ze.findLast(t,e=>typeof e=="string"),q$=(...t)=>ze.findLast(t,e=>typeof e=="function"),H$={noSort:!1,readEntries:!1,method:ze.Constants.NONE,fs:null};hb.exports=function(t,e){let r=null,n=Object.assign(Object.create(null),H$);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=ze.Constants.BUFFER,t=void 0)),Object.assign(n,e);let o=new ze(n);if((typeof n.decoder!="object"||typeof n.decoder.encode!="function"||typeof n.decoder.decode!="function")&&(n.decoder=ze.decoder),t&&typeof t=="string")if(o.fs.existsSync(t))n.method=ze.Constants.FILE,n.filename=t,r=o.fs.readFileSync(t);else throw ze.Errors.INVALID_FILENAME();let i=new M$(r,n),{canonical:a,sanitize:s,zipnamefix:u}=ze;function c(h){if(h&&i){var m;if(typeof h=="string"&&(m=i.getEntry(Je.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 f(h){let{join:m,normalize:y,sep:D}=Je.posix;return m(".",y(D+h.split("\\").join(D)+D))}function d(h){return h instanceof RegExp?(function(m){return function(y){return m.test(y)}})(h):typeof h!="function"?()=>!0:h}let p=(h,m)=>{let y=m.slice(-1);return y=y===o.sep?o.sep:"",Je.relative(h,m)+y};return{readFile:function(h,m){var y=c(h);return y&&y.getData(m)||null},childCount:function(h){let m=c(h);if(m)return i.getChildCount(m)},readFileAsync:function(h,m){var y=c(h);y?y.getDataAsync(m):m(null,"getEntry failed for:"+h)},readAsText:function(h,m){var y=c(h);if(y){var D=y.getData();if(D&&D.length)return D.toString(m||"utf8")}return""},readAsTextAsync:function(h,m,y){var D=c(h);D?D.getDataAsync(function(v,E){if(E){m(v,E);return}v&&v.length?m(v.toString(y||"utf8")):m("")}):m("")},deleteFile:function(h,m=!0){var y=c(h);y&&i.deleteFile(y.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 y=c(h);y&&(y.comment=m)},getZipEntryComment:function(h){var m=c(h);return m&&m.comment||""},updateFile:function(h,m){var y=c(h);y&&y.setData(m)},addLocalFile:function(h,m,y,D){if(o.fs.existsSync(h)){m=m?f(m):"";let v=Je.win32.basename(Je.win32.normalize(h));m+=y||v;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 ze.Errors.FILE_NOT_FOUND(h)},addLocalFileAsync:function(h,m){h=typeof h=="object"?h:{localPath:h};let y=Je.resolve(h.localPath),{comment:D}=h,{zipPath:v,zipName:E}=h,g=this;o.fs.stat(y,function(_,S){if(_)return m(_,!1);v=v?f(v):"";let P=Je.win32.basename(Je.win32.normalize(y));if(v+=E||P,S.isFile())o.fs.readFile(y,function(F,B){return F?m(F,!1):(g.addFile(v,B,D,S),setImmediate(m,void 0,!0))});else if(S.isDirectory())return v+=o.sep,g.addFile(v,Buffer.alloc(0),D,S),setImmediate(m,void 0,!0)})},addLocalFolder:function(h,m,y){if(y=d(y),m=m?f(m):"",h=Je.normalize(h),o.fs.existsSync(h)){let D=o.findFiles(h),v=this;if(D.length)for(let E of D){let g=Je.join(m,p(h,E));y(g)&&v.addLocalFile(E,Je.dirname(g))}}else throw ze.Errors.FILE_NOT_FOUND(h)},addLocalFolderAsync:function(h,m,y,D){D=d(D),y=y?f(y):"",h=Je.normalize(h);var v=this;o.fs.open(h,"r",function(E){if(E&&E.code==="ENOENT")m(void 0,ze.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 P=g[_],F=p(h,P).split("\\").join("/");F=F.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),D(F)?o.fs.stat(P,function(B,T){B&&m(void 0,B),T.isFile()?o.fs.readFile(P,function(j,A){j?m(void 0,j):(v.addFile(y+F,A,"",T),S())}):(v.addFile(y+F+"/",Buffer.alloc(0),"",T),S())}):process.nextTick(()=>{S()})}else m(!0,void 0)};S()}})},addLocalFolderAsync2:function(h,m){let y=this;h=typeof h=="object"?h:{localPath:h},localPath=Je.resolve(f(h.localPath));let{zipPath:D,filter:v,namefix:E}=h;v instanceof RegExp?v=(function(S){return function(P){return S.test(P)}})(v):typeof v!="function"&&(v=function(){return!0}),D=D?f(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=>Je.join(D,E(p(localPath,S))),_=S=>Je.win32.basename(Je.win32.normalize(E(S)));o.fs.open(localPath,"r",function(S){S&&S.code==="ENOENT"?m(void 0,ze.Errors.FILE_NOT_FOUND(localPath)):S?m(void 0,S):o.findFilesAsync(localPath,function(P,F){if(P)return m(P);F=F.filter(B=>v(g(B))),F.length||m(void 0,!1),setImmediate(F.reverse().reduce(function(B,T){return function(j,A){if(j||A===!1)return setImmediate(B,j,!1);y.addLocalFileAsync({localPath:T,zipPath:Je.dirname(g(T)),zipName:_(T)},B)}},m))})})},addLocalFolderPromise:function(h,m){return new Promise((y,D)=>{this.addLocalFolderAsync2(Object.assign({localPath:h},m),(v,E)=>{v&&D(v),E&&y(this)})})},addFile:function(h,m,y,D){h=u(h);let v=c(h),E=v!=null;E||(v=new U$(n),v.entryName=h),v.comment=y||"";let g=typeof D=="object"&&D instanceof o.fs.Stats;g&&(v.header.time=D.mtime);var _=v.isDirectory?16:0;let S=v.isDirectory?16384:32768;return g?S|=4095&D.mode:typeof D=="number"?S|=4095&D:S|=v.isDirectory?493:420,_=(_|S<<16)>>>0,v.attr=_,v.setData(m),E||i.setEntry(v),v},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,y,D,v,E){D=Xn(!1,D),v=Xn(!1,v),y=Xn(!0,y),E=pb(v,E);var g=c(h);if(!g)throw ze.Errors.NO_ENTRY();var _=a(g.entryName),S=s(m,E&&!g.isDirectory?E:y?_:Je.basename(_));if(g.isDirectory){var P=i.getEntryChildren(g);return P.forEach(function(T){if(T.isDirectory)return;var j=T.getData();if(!j)throw ze.Errors.CANT_EXTRACT_FILE();var A=a(T.entryName),M=s(m,y?A:Je.basename(A));let L=v?T.header.fileAttr:void 0;o.writeFileTo(M,j,D,L)}),!0}var F=g.getData(i.password);if(!F)throw ze.Errors.CANT_EXTRACT_FILE();if(o.fs.existsSync(S)&&!D)throw ze.Errors.CANT_OVERRIDE();let B=v?h.header.fileAttr:void 0;return o.writeFileTo(S,F,D,B),!0},test:function(h){if(!i)return!1;for(var m in i.entries)try{if(m.isDirectory)continue;var y=i.entries[m].getData(h);if(!y)return!1}catch{return!1}return!0},extractAllTo:function(h,m,y,D){if(y=Xn(!1,y),D=pb(y,D),m=Xn(!1,m),!i)throw ze.Errors.NO_ZIP();i.entries.forEach(function(v){var E=s(h,a(v.entryName));if(v.isDirectory){o.makeDir(E);return}var g=v.getData(D);if(!g)throw ze.Errors.CANT_EXTRACT_FILE();let _=y?v.header.fileAttr:void 0;o.writeFileTo(E,g,m,_);try{o.fs.utimesSync(E,v.header.time,v.header.time)}catch{throw ze.Errors.CANT_EXTRACT_FILE()}})},extractAllToAsync:function(h,m,y,D){if(D=q$(m,y,D),y=Xn(!1,y),m=Xn(!1,m),!D)return new Promise((S,P)=>{this.extractAllToAsync(h,m,y,function(F){F?P(F):S(this)})});if(!i){D(ze.Errors.NO_ZIP());return}h=Je.resolve(h);let v=S=>s(h,Je.normalize(a(S.entryName))),E=(S,P)=>new Error(S+': "'+P+'"'),g=[],_=[];i.entries.forEach(S=>{S.isDirectory?g.push(S):_.push(S)});for(let S of g){let P=v(S),F=y?S.header.fileAttr:void 0;try{o.makeDir(P),F&&o.fs.chmodSync(P,F),o.fs.utimesSync(P,S.header.time,S.header.time)}catch{D(E("Unable to create folder",P))}}_.reverse().reduce(function(S,P){return function(F){if(F)S(F);else{let B=Je.normalize(a(P.entryName)),T=s(h,B);P.getDataAsync(function(j,A){if(A)S(A);else if(!j)S(ze.Errors.CANT_EXTRACT_FILE());else{let M=y?P.header.fileAttr:void 0;o.writeFileToAsync(T,j,m,M,function(L){L||S(E("Unable to write file",T)),o.fs.utimes(T,P.header.time,P.header.time,function(X){X?S(E("Unable to set times",T)):S()})})}})}}},D)()},writeZip:function(h,m){if(arguments.length===1&&typeof h=="function"&&(m=h,h=""),!h&&n.filename&&(h=n.filename),!!h){var y=i.compressToBuffer();if(y){var D=o.writeFileTo(h,y,!0);typeof m=="function"&&m(D?null:new Error("failed"),"")}}},writeZipPromise:function(h,m){let{overwrite:y,perm:D}=Object.assign({overwrite:!0},m);return new Promise((v,E)=>{!h&&n.filename&&(h=n.filename),h||E("ADM-ZIP: ZIP File Name Missing"),this.toBufferPromise().then(g=>{let _=S=>S?v(S):E("ADM-ZIP: Wasn't able to write zip file");o.writeFileToAsync(h,g,y,D,_)},E)})},toBufferPromise:function(){return new Promise((h,m)=>{i.toAsyncBuffer(h,m)})},toBuffer:function(h,m,y,D){return typeof h=="function"?(i.toAsyncBuffer(h,m,y,D),null):i.compressToBuffer()}}}});var Db=x((Hz,yb)=>{var gb={};yb.exports=gb;var mb={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(mb).forEach(function(t){var e=mb[t],r=gb[t]=[];r.open="\x1B["+e[0]+"m",r.close="\x1B["+e[1]+"m"})});var wb=x((Vz,bb)=>{"use strict";bb.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 Cb=x((zz,vb)=>{"use strict";var V$=require("os"),xr=wb(),It=process.env,fi=void 0;xr("no-color")||xr("no-colors")||xr("color=false")?fi=!1:(xr("color")||xr("colors")||xr("color=true")||xr("color=always"))&&(fi=!0);"FORCE_COLOR"in It&&(fi=It.FORCE_COLOR.length===0||parseInt(It.FORCE_COLOR,10)!==0);function z$(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function K$(t){if(fi===!1)return 0;if(xr("color=16m")||xr("color=full")||xr("color=truecolor"))return 3;if(xr("color=256"))return 2;if(t&&!t.isTTY&&fi!==!0)return 0;var e=fi?1:0;if(process.platform==="win32"){var r=V$.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 It)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(o){return o in It})||It.CI_NAME==="codeship"?1:e;if("TEAMCITY_VERSION"in It)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(It.TEAMCITY_VERSION)?1:0;if("TERM_PROGRAM"in It){var n=parseInt((It.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(It.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(It.TERM)?2:/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(It.TERM)||"COLORTERM"in It?1:(It.TERM==="dumb",e)}function eh(t){var e=K$(t);return z$(e)}vb.exports={supportsColor:eh,stdout:eh(process.stdout),stderr:eh(process.stderr)}});var _b=x((Kz,Eb)=>{Eb.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 xb=x((Gz,Sb)=>{Sb.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(f){c=f===u}),c}function s(u,c){var f="",d,p;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(p in u)if(!a(p)){switch(f=f+u[p],d={up:0,down:0,mid:0},c.size){case"mini":d.up=i(8),d.mid=i(2),d.down=i(8);break;case"maxi":d.up=i(16)+3,d.mid=i(4)+1,d.down=i(64)+3;break;default:d.up=i(8)+1,d.mid=i(6)/2,d.down=i(8)+1;break}var h=["up","mid","down"];for(var m in h)for(var y=h[m],D=0;D<=d[y];D++)c[y]&&(f=f+n[y][i(n[y].length)])}return f}return s(e,r)}});var Ob=x((Wz,Ab)=>{Ab.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 kb=x((Yz,Fb)=>{Fb.exports=function(t){return function(e,r,n){return r%2===0?e:t.inverse(e)}}});var $b=x((Jz,Pb)=>{Pb.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 Tb=x((Xz,Ib)=>{Ib.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 Ub=x((Qz,jb)=>{var he={};jb.exports=he;he.themes={};var G$=require("util"),Zn=he.styles=Db(),Bb=Object.defineProperties,W$=new RegExp(/[\r\n]+/g);he.supportsColor=Cb().supportsColor;typeof he.enabled>"u"&&(he.enabled=he.supportsColor()!==!1);he.enable=function(){he.enabled=!0};he.disable=function(){he.enabled=!1};he.stripColors=he.strip=function(t){return(""+t).replace(/\x1B\[\d+m/g,"")};var Zz=he.stylize=function(e,r){if(!he.enabled)return e+"";var n=Zn[r];return!n&&r in he?he[r](e):n.open+e+n.close},Y$=/[|\\{}()[\]^$+*?.]/g,J$=function(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(Y$,"\\$&")};function Nb(t){var e=function r(){return Z$.apply(r,arguments)};return e._styles=t,e.__proto__=X$,e}var Lb=(function(){var t={};return Zn.grey=Zn.gray,Object.keys(Zn).forEach(function(e){Zn[e].closeRe=new RegExp(J$(Zn[e].close),"g"),t[e]={get:function(){return Nb(this._styles.concat(e))}}}),t})(),X$=Bb(function(){},Lb);function Z$(){var t=Array.prototype.slice.call(arguments),e=t.map(function(a){return a!=null&&a.constructor===String?a:G$.inspect(a)}).join(" ");if(!he.enabled||!e)return e;for(var r=e.indexOf(`
31
- `)!=-1,n=this._styles,o=n.length;o--;){var i=Zn[n[o]];e=i.open+e.replace(i.closeRe,i.open)+i.close,r&&(e=e.replace(W$,function(a){return i.close+a+i.open}))}return e}he.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){he[r]=function(n){if(typeof t[r]=="object"){var o=n;for(var i in t[r])o=he[t[r][i]](o);return o}return he[t[r]](n)}})(e)};function Q$(){var t={};return Object.keys(Lb).forEach(function(e){t[e]={get:function(){return Nb([e])}}}),t}var e3=function(e,r){var n=r.split("");return n=n.map(e),n.join("")};he.trap=_b();he.zalgo=xb();he.maps={};he.maps.america=Ob()(he);he.maps.zebra=kb()(he);he.maps.rainbow=$b()(he);he.maps.random=Tb()(he);for(Rb in he.maps)(function(t){he[t]=function(e){return e3(he.maps[t],e)}})(Rb);var Rb;Bb(he,Q$())});var qb=x((eK,Mb)=>{var t3=Ub();Mb.exports=t3});var Hb=x(th=>{"use strict";th.indent=function(e){return new Array(e+1).join(" ")};th.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 Vb=x((rK,r3)=>{r3.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 zb=x(Va=>{"use strict";var Tr=qb(),Fn=Hb(),n3=/[^\w\s\n\r\v\t\.,]/i;Va.version=Vb().version;var rh=function(t,e){return t!==void 0||e.renderUndefined},ec=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(`
32
- `)===-1||r.inlineArrays&&!e&&Array.isArray(t)&&ec(t[0],!0,r))},o3=function(t,e){if(e.noColor)return t;if(typeof t=="string")return e.stringColor?Tr[e.stringColor](t):t;var r=t+"";return t===!0?Tr.green(r):t===!1?Tr.red(r):t==null?Tr.grey(r):typeof t=="number"?t>=0?Tr[e.positiveNumberColor](r):Tr[e.negativeNumberColor](r):typeof t=="function"?"function() {}":Array.isArray(t)?t.join(", "):r},nh=function(t,e){return t.multilineStringColor===null||t.noColor?e:Tr[t.multilineStringColor](e)},i3=function(t,e,r){var n=t.split(`
33
- `);return n=n.map(function(o){return Fn.indent(e)+nh(r,o)}),n.join(`
34
- `)},di=function(t,e,r){if(typeof t=="string"&&t.match(n3)&&e.escape&&(t=JSON.stringify(t)),!rh(t,e))return[];if(ec(t,!1,e))return[Fn.indent(r)+o3(t,e)];if(typeof t=="string")return[Fn.indent(r)+nh(e,'"""'),i3(t,r+e.defaultIndentation,e),Fn.indent(r)+nh(e,'"""')];if(Array.isArray(t)){if(t.length===0)return[Fn.indent(r)+e.emptyArrayMsg];var n=[];return t.forEach(function(s){if(rh(s,e)){var u="- ";e.noColor||(u=Tr[e.dashColor](u)),u=Fn.indent(r)+u,ec(s,!1,e)?(u+=di(s,e,0)[0],n.push(u)):(n.push(u),n.push.apply(n,di(s,e,r+e.defaultIndentation)))}}),n}if(t instanceof Error)return di({message:t.message,stack:t.stack.split(`
35
- `)},e,r);var o=e.noAlign?0:Fn.getMaxIndexLength(t),i,a=[];return Object.getOwnPropertyNames(t).forEach(function(s){if(rh(t[s],e))if(i=s+": ",e.noColor||(i=Tr[e.keysColor](i)),i=Fn.indent(r)+i,ec(t[s],!1,e)){var u=e.noAlign?0:o-s.length;i+=di(t[s],e,u)[0],a.push(i)}else a.push(i),a.push.apply(a,di(t[s],e,r+e.defaultIndentation))}),a};Va.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,di(e,r,n).join(`
36
- `)};Va.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)+`
37
- `,e=e.substr(a)}try{i=JSON.parse(e)}catch{return Tr.red("Error:")+" Not valid JSON!"}return o+=Va.render(i,r,n),o}});var ah=x(tc=>{"use strict";Object.defineProperty(tc,"__esModule",{value:!0});tc.default=void 0;function pi(t){"@babel/helpers - typeof";return pi=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},pi(t)}function Kb(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,s3(n.key),n)}}function a3(t,e,r){return e&&Kb(t.prototype,e),r&&Kb(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function s3(t){var e=u3(t,"string");return pi(e)=="symbol"?e:e+""}function u3(t,e){if(pi(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(pi(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function c3(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l3(t,e,r){return e=Ka(e),f3(t,ih()?Reflect.construct(e,r||[],Ka(t).constructor):e.apply(t,r))}function f3(t,e){if(e&&(pi(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return d3(t)}function d3(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function p3(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&&za(t,e)}function oh(t){var e=typeof Map=="function"?new Map:void 0;return oh=function(n){if(n===null||!m3(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 h3(n,arguments,Ka(this).constructor)}return o.prototype=Object.create(n.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),za(o,n)},oh(t)}function h3(t,e,r){if(ih())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var o=new(t.bind.apply(t,n));return r&&za(o,r.prototype),o}function ih(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ih=function(){return!!t})()}function m3(t){try{return Function.toString.call(t).indexOf("[native code]")!==-1}catch{return typeof t=="function"}}function za(t,e){return za=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},za(t,e)}function Ka(t){return Ka=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Ka(t)}var g3=(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(c3(this,e),n=l3(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(),f=a?a.getStatus():"n/a",d=a?a.getBody()||"":"n/a";r+=", originated from request (method: ".concat(u,", url: ").concat(c,", response code: ").concat(f,", response text: ").concat(d,", request id: ").concat(s,")")}return n.message=r,n}return p3(e,t),a3(e)})(oh(Error)),oK=tc.default=g3});var sh=x(rc=>{"use strict";Object.defineProperty(rc,"__esModule",{value:!0});rc.enableDebugLog=y3;rc.log=D3;var Gb=!1;function y3(){Gb=!0}function D3(t){Gb&&console.log(t)}});var Yb=x(nc=>{"use strict";Object.defineProperty(nc,"__esModule",{value:!0});nc.default=void 0;function Ga(t){"@babel/helpers - typeof";return Ga=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},Ga(t)}function b3(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}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,v3(n.key),n)}}function w3(t,e,r){return e&&Wb(t.prototype,e),r&&Wb(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function v3(t){var e=C3(t,"string");return Ga(e)=="symbol"?e:e+""}function C3(t,e){if(Ga(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Ga(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var sK=nc.default=(function(){function t(){b3(this,t)}return w3(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 Jb=x((uh,ch)=>{(function(t,e){typeof uh=="object"&&typeof ch<"u"?ch.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:uh,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(I){var N={};return I.forEach(function(Z,U){return N[Z]=U}),N})(a),u=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,c=String.fromCharCode.bind(String),f=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):function(I){return new Uint8Array(Array.prototype.slice.call(I,0))},d=function(I){return I.replace(/=/g,"").replace(/[+\/]/g,function(N){return N=="+"?"-":"_"})},p=function(I){return I.replace(/[^A-Za-z0-9\+\/]/g,"")},h=function(I){for(var N,Z,U,oe,Xt="",z=I.length%3,Se=0;Se<I.length;){if((Z=I.charCodeAt(Se++))>255||(U=I.charCodeAt(Se++))>255||(oe=I.charCodeAt(Se++))>255)throw new TypeError("invalid character found");N=Z<<16|U<<8|oe,Xt+=a[N>>18&63]+a[N>>12&63]+a[N>>6&63]+a[N&63]}return z?Xt.slice(0,z-3)+"===".substring(z):Xt},m=typeof btoa=="function"?function(I){return btoa(I)}:r?function(I){return Buffer.from(I,"binary").toString("base64")}:h,y=r?function(I){return Buffer.from(I).toString("base64")}:function(I){for(var N=4096,Z=[],U=0,oe=I.length;U<oe;U+=N)Z.push(c.apply(null,I.subarray(U,U+N)));return m(Z.join(""))},D=function(I,N){return N===void 0&&(N=!1),N?d(y(I)):y(I)},v=function(I){if(I.length<2){var N=I.charCodeAt(0);return N<128?I:N<2048?c(192|N>>>6)+c(128|N&63):c(224|N>>>12&15)+c(128|N>>>6&63)+c(128|N&63)}else{var N=65536+(I.charCodeAt(0)-55296)*1024+(I.charCodeAt(1)-56320);return c(240|N>>>18&7)+c(128|N>>>12&63)+c(128|N>>>6&63)+c(128|N&63)}},E=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,g=function(I){return I.replace(E,v)},_=r?function(I){return Buffer.from(I,"utf8").toString("base64")}:o?function(I){return y(o.encode(I))}:function(I){return m(g(I))},S=function(I,N){return N===void 0&&(N=!1),N?d(_(I)):_(I)},P=function(I){return S(I,!0)},F=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,B=function(I){switch(I.length){case 4:var N=(7&I.charCodeAt(0))<<18|(63&I.charCodeAt(1))<<12|(63&I.charCodeAt(2))<<6|63&I.charCodeAt(3),Z=N-65536;return c((Z>>>10)+55296)+c((Z&1023)+56320);case 3:return c((15&I.charCodeAt(0))<<12|(63&I.charCodeAt(1))<<6|63&I.charCodeAt(2));default:return c((31&I.charCodeAt(0))<<6|63&I.charCodeAt(1))}},T=function(I){return I.replace(F,B)},j=function(I){if(I=I.replace(/\s+/g,""),!u.test(I))throw new TypeError("malformed base64.");I+="==".slice(2-(I.length&3));for(var N,Z,U,oe=[],Xt=0;Xt<I.length;)N=s[I.charAt(Xt++)]<<18|s[I.charAt(Xt++)]<<12|(Z=s[I.charAt(Xt++)])<<6|(U=s[I.charAt(Xt++)]),Z===64?oe.push(c(N>>16&255)):U===64?oe.push(c(N>>16&255,N>>8&255)):oe.push(c(N>>16&255,N>>8&255,N&255));return oe.join("")},A=typeof atob=="function"?function(I){return atob(p(I))}:r?function(I){return Buffer.from(I,"base64").toString("binary")}:j,M=r?function(I){return f(Buffer.from(I,"base64"))}:function(I){return f(A(I).split("").map(function(N){return N.charCodeAt(0)}))},L=function(I){return M(k(I))},X=r?function(I){return Buffer.from(I,"base64").toString("utf8")}:n?function(I){return n.decode(M(I))}:function(I){return T(A(I))},k=function(I){return p(I.replace(/[-_]/g,function(N){return N=="-"?"+":"/"}))},b=function(I){return X(k(I))},w=function(I){if(typeof I!="string")return!1;var N=I.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(N)||!/[^\s0-9a-zA-Z\-_]/.test(N)},C=function(I){return{value:I,enumerable:!1,writable:!0,configurable:!0}},O=function(){var I=function(N,Z){return Object.defineProperty(String.prototype,N,C(Z))};I("fromBase64",function(){return b(this)}),I("toBase64",function(N){return S(this,N)}),I("toBase64URI",function(){return S(this,!0)}),I("toBase64URL",function(){return S(this,!0)}),I("toUint8Array",function(){return L(this)})},R=function(){var I=function(N,Z){return Object.defineProperty(Uint8Array.prototype,N,C(Z))};I("toBase64",function(N){return D(this,N)}),I("toBase64URI",function(){return D(this,!0)}),I("toBase64URL",function(){return D(this,!0)})},$=function(){O(),R()},H={version:t,VERSION:e,atob:A,atobPolyfill:j,btoa:m,btoaPolyfill:h,fromBase64:b,toBase64:S,encode:S,encodeURI:P,encodeURL:P,utob:g,btou:T,decode:b,isValid:w,fromUint8Array:D,toUint8Array:L,extendString:O,extendUint8Array:R,extendBuiltins:$};return H.Base64={},Object.keys(H).forEach(function(I){return H.Base64[I]=H[I]}),H})});var Zb=x((cK,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 tw=x(lh=>{"use strict";var E3=Object.prototype.hasOwnProperty,_3;function Qb(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch{return null}}function ew(t){try{return encodeURIComponent(t)}catch{return null}}function S3(t){for(var e=/([^=?#&]+)=?([^&]*)/g,r={},n;n=e.exec(t);){var o=Qb(n[1]),i=Qb(n[2]);o===null||i===null||o in r||(r[o]=i)}return r}function x3(t,e){e=e||"";var r=[],n,o;typeof e!="string"&&(e="?");for(o in t)if(E3.call(t,o)){if(n=t[o],!n&&(n===null||n===_3||isNaN(n))&&(n=""),o=ew(o),n=ew(n),o===null||n===null)continue;r.push(o+"="+n)}return r.length?e+r.join("&"):""}lh.stringify=x3;lh.parse=S3});var cw=x((fK,uw)=>{"use strict";var nw=Zb(),oc=tw(),A3=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,ow=/[\n\r\t]/g,O3=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,iw=/:\d+$/,F3=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,k3=/^[a-zA-Z]:/;function dh(t){return(t||"").toString().replace(A3,"")}var fh=[["#","hash"],["?","query"],function(e,r){return Rr(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]],rw={hash:1,query:1};function aw(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 Br(unescape(t.pathname),{});else if(o==="string"){n=new Br(t,{});for(i in rw)delete n[i]}else if(o==="object"){for(i in t)i in rw||(n[i]=t[i]);n.slashes===void 0&&(n.slashes=O3.test(t.href))}return n}function Rr(t){return t==="file:"||t==="ftp:"||t==="http:"||t==="https:"||t==="ws:"||t==="wss:"}function sw(t,e){t=dh(t),t=t.replace(ow,""),e=e||{};var r=F3.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)):Rr(n)?s=r[4]:n?o&&(s=s.slice(2)):a>=2&&Rr(e.protocol)&&(s=r[4]),{protocol:n,slashes:o||Rr(n),slashesCount:a,rest:s}}function P3(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 Br(t,e,r){if(t=dh(t),t=t.replace(ow,""),!(this instanceof Br))return new Br(t,e,r);var n,o,i,a,s,u,c=fh.slice(),f=typeof e,d=this,p=0;for(f!=="object"&&f!=="string"&&(r=e,e=null),r&&typeof r!="function"&&(r=oc.parse),e=aw(e),o=sw(t||"",e),n=!o.protocol&&!o.slashes,d.slashes=o.slashes||n&&e.slashes,d.protocol=o.protocol||e.protocol||"",t=o.rest,(o.protocol==="file:"&&(o.slashesCount!==2||k3.test(t))||!o.slashes&&(o.protocol||o.slashesCount<2||!Rr(d.protocol)))&&(c[3]=[/(.*)/,"pathname"]);p<c.length;p++){if(a=c[p],typeof a=="function"){t=a(t,d);continue}i=a[0],u=a[1],i!==i?d[u]=t:typeof i=="string"?(s=i==="@"?t.lastIndexOf(i):t.indexOf(i),~s&&(typeof a[2]=="number"?(d[u]=t.slice(0,s),t=t.slice(s+a[2])):(d[u]=t.slice(s),t=t.slice(0,s)))):(s=i.exec(t))&&(d[u]=s[1],t=t.slice(0,s.index)),d[u]=d[u]||n&&a[3]&&e[u]||"",a[4]&&(d[u]=d[u].toLowerCase())}r&&(d.query=r(d.query)),n&&e.slashes&&d.pathname.charAt(0)!=="/"&&(d.pathname!==""||e.pathname!=="")&&(d.pathname=P3(d.pathname,e.pathname)),d.pathname.charAt(0)!=="/"&&Rr(d.protocol)&&(d.pathname="/"+d.pathname),nw(d.port,d.protocol)||(d.host=d.hostname,d.port=""),d.username=d.password="",d.auth&&(s=d.auth.indexOf(":"),~s?(d.username=d.auth.slice(0,s),d.username=encodeURIComponent(decodeURIComponent(d.username)),d.password=d.auth.slice(s+1),d.password=encodeURIComponent(decodeURIComponent(d.password))):d.username=encodeURIComponent(decodeURIComponent(d.auth)),d.auth=d.password?d.username+":"+d.password:d.username),d.origin=d.protocol!=="file:"&&Rr(d.protocol)&&d.host?d.protocol+"//"+d.host:"null",d.href=d.toString()}function $3(t,e,r){var n=this;switch(t){case"query":typeof e=="string"&&e.length&&(e=(r||oc.parse)(e)),n[t]=e;break;case"port":n[t]=e,nw(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,iw.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<fh.length;a++){var s=fh[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:"&&Rr(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function I3(t){(!t||typeof t!="function")&&(t=oc.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||Rr(r.protocol)?"//":"");return r.username?(i+=r.username,r.password&&(i+=":"+r.password),i+="@"):r.password?(i+=":"+r.password,i+="@"):r.protocol!=="file:"&&Rr(r.protocol)&&!n&&r.pathname!=="/"&&(i+="@"),(n[n.length-1]===":"||iw.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}Br.prototype={set:$3,toString:I3};Br.extractProtocol=sw;Br.location=aw;Br.trimLeft=dh;Br.qs=oc;uw.exports=Br});var lw=x(ph=>{"use strict";Object.defineProperty(ph,"__esModule",{value:!0});ph.default=T3;function T3(){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 Sw=x(uc=>{"use strict";Object.defineProperty(uc,"__esModule",{value:!0});uc.default=void 0;var R3=Jb(),B3=gh(cw()),ic=gh(ah()),Qn=sh(),N3=gh(lw());function gh(t){return t&&t.__esModule?t:{default:t}}function hh(){"use strict";hh=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(b,w,C){b[w]=C.value},i=typeof Symbol=="function"?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(b,w,C){return Object.defineProperty(b,w,{value:C,enumerable:!0,configurable:!0,writable:!0}),b[w]}try{c({},"")}catch{c=function(C,O,R){return C[O]=R}}function f(b,w,C,O){var R=w&&w.prototype instanceof v?w:v,$=Object.create(R.prototype),H=new X(O||[]);return o($,"_invoke",{value:j(b,C,H)}),$}function d(b,w,C){try{return{type:"normal",arg:b.call(w,C)}}catch(O){return{type:"throw",arg:O}}}e.wrap=f;var p="suspendedStart",h="suspendedYield",m="executing",y="completed",D={};function v(){}function E(){}function g(){}var _={};c(_,a,function(){return this});var S=Object.getPrototypeOf,P=S&&S(S(k([])));P&&P!==r&&n.call(P,a)&&(_=P);var F=g.prototype=v.prototype=Object.create(_);function B(b){["next","throw","return"].forEach(function(w){c(b,w,function(C){return this._invoke(w,C)})})}function T(b,w){function C(R,$,H,I){var N=d(b[R],b,$);if(N.type!=="throw"){var Z=N.arg,U=Z.value;return U&&eo(U)=="object"&&n.call(U,"__await")?w.resolve(U.__await).then(function(oe){C("next",oe,H,I)},function(oe){C("throw",oe,H,I)}):w.resolve(U).then(function(oe){Z.value=oe,H(Z)},function(oe){return C("throw",oe,H,I)})}I(N.arg)}var O;o(this,"_invoke",{value:function($,H){function I(){return new w(function(N,Z){C($,H,N,Z)})}return O=O?O.then(I,I):I()}})}function j(b,w,C){var O=p;return function(R,$){if(O===m)throw Error("Generator is already running");if(O===y){if(R==="throw")throw $;return{value:t,done:!0}}for(C.method=R,C.arg=$;;){var H=C.delegate;if(H){var I=A(H,C);if(I){if(I===D)continue;return I}}if(C.method==="next")C.sent=C._sent=C.arg;else if(C.method==="throw"){if(O===p)throw O=y,C.arg;C.dispatchException(C.arg)}else C.method==="return"&&C.abrupt("return",C.arg);O=m;var N=d(b,w,C);if(N.type==="normal"){if(O=C.done?y:h,N.arg===D)continue;return{value:N.arg,done:C.done}}N.type==="throw"&&(O=y,C.method="throw",C.arg=N.arg)}}}function A(b,w){var C=w.method,O=b.iterator[C];if(O===t)return w.delegate=null,C==="throw"&&b.iterator.return&&(w.method="return",w.arg=t,A(b,w),w.method==="throw")||C!=="return"&&(w.method="throw",w.arg=new TypeError("The iterator does not provide a '"+C+"' method")),D;var R=d(O,b.iterator,w.arg);if(R.type==="throw")return w.method="throw",w.arg=R.arg,w.delegate=null,D;var $=R.arg;return $?$.done?(w[b.resultName]=$.value,w.next=b.nextLoc,w.method!=="return"&&(w.method="next",w.arg=t),w.delegate=null,D):$:(w.method="throw",w.arg=new TypeError("iterator result is not an object"),w.delegate=null,D)}function M(b){var w={tryLoc:b[0]};1 in b&&(w.catchLoc=b[1]),2 in b&&(w.finallyLoc=b[2],w.afterLoc=b[3]),this.tryEntries.push(w)}function L(b){var w=b.completion||{};w.type="normal",delete w.arg,b.completion=w}function X(b){this.tryEntries=[{tryLoc:"root"}],b.forEach(M,this),this.reset(!0)}function k(b){if(b||b===""){var w=b[a];if(w)return w.call(b);if(typeof b.next=="function")return b;if(!isNaN(b.length)){var C=-1,O=function R(){for(;++C<b.length;)if(n.call(b,C))return R.value=b[C],R.done=!1,R;return R.value=t,R.done=!0,R};return O.next=O}}throw new TypeError(eo(b)+" is not iterable")}return E.prototype=g,o(F,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:E,configurable:!0}),E.displayName=c(g,u,"GeneratorFunction"),e.isGeneratorFunction=function(b){var w=typeof b=="function"&&b.constructor;return!!w&&(w===E||(w.displayName||w.name)==="GeneratorFunction")},e.mark=function(b){return Object.setPrototypeOf?Object.setPrototypeOf(b,g):(b.__proto__=g,c(b,u,"GeneratorFunction")),b.prototype=Object.create(F),b},e.awrap=function(b){return{__await:b}},B(T.prototype),c(T.prototype,s,function(){return this}),e.AsyncIterator=T,e.async=function(b,w,C,O,R){R===void 0&&(R=Promise);var $=new T(f(b,w,C,O),R);return e.isGeneratorFunction(w)?$:$.next().then(function(H){return H.done?H.value:$.next()})},B(F),c(F,u,"Generator"),c(F,a,function(){return this}),c(F,"toString",function(){return"[object Generator]"}),e.keys=function(b){var w=Object(b),C=[];for(var O in w)C.push(O);return C.reverse(),function R(){for(;C.length;){var $=C.pop();if($ in w)return R.value=$,R.done=!1,R}return R.done=!0,R}},e.values=k,X.prototype={constructor:X,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(L),!w)for(var C in this)C.charAt(0)==="t"&&n.call(this,C)&&!isNaN(+C.slice(1))&&(this[C]=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 C=this;function O(Z,U){return H.type="throw",H.arg=w,C.next=Z,U&&(C.method="next",C.arg=t),!!U}for(var R=this.tryEntries.length-1;R>=0;--R){var $=this.tryEntries[R],H=$.completion;if($.tryLoc==="root")return O("end");if($.tryLoc<=this.prev){var I=n.call($,"catchLoc"),N=n.call($,"finallyLoc");if(I&&N){if(this.prev<$.catchLoc)return O($.catchLoc,!0);if(this.prev<$.finallyLoc)return O($.finallyLoc)}else if(I){if(this.prev<$.catchLoc)return O($.catchLoc,!0)}else{if(!N)throw Error("try statement without catch or finally");if(this.prev<$.finallyLoc)return O($.finallyLoc)}}}},abrupt:function(w,C){for(var O=this.tryEntries.length-1;O>=0;--O){var R=this.tryEntries[O];if(R.tryLoc<=this.prev&&n.call(R,"finallyLoc")&&this.prev<R.finallyLoc){var $=R;break}}$&&(w==="break"||w==="continue")&&$.tryLoc<=C&&C<=$.finallyLoc&&($=null);var H=$?$.completion:{};return H.type=w,H.arg=C,$?(this.method="next",this.next=$.finallyLoc,D):this.complete(H)},complete:function(w,C){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"&&C&&(this.next=C),D},finish:function(w){for(var C=this.tryEntries.length-1;C>=0;--C){var O=this.tryEntries[C];if(O.finallyLoc===w)return this.complete(O.completion,O.afterLoc),L(O),D}},catch:function(w){for(var C=this.tryEntries.length-1;C>=0;--C){var O=this.tryEntries[C];if(O.tryLoc===w){var R=O.completion;if(R.type==="throw"){var $=R.arg;L(O)}return $}}throw Error("illegal catch attempt")},delegateYield:function(w,C,O){return this.delegate={iterator:k(w),resultName:C,nextLoc:O},this.method==="next"&&(this.arg=t),D}},e}function fw(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 L3(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(u){fw(i,n,o,a,s,"next",u)}function s(u){fw(i,n,o,a,s,"throw",u)}a(void 0)})}}function ww(t,e){return M3(t)||U3(t,e)||vw(t,e)||j3()}function j3(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
38
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function U3(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(f){c=!0,o=f}finally{try{if(!u&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}function M3(t){if(Array.isArray(t))return t}function eo(t){"@babel/helpers - typeof";return eo=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},eo(t)}function q3(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=vw(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.
39
- 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 vw(t,e){if(t){if(typeof t=="string")return dw(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 dw(t,e)}}function dw(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 pw(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 hi(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?pw(Object(r),!0).forEach(function(n){H3(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):pw(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function H3(t,e,r){return e=Cw(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function V3(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function hw(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,Cw(n.key),n)}}function z3(t,e,r){return e&&hw(t.prototype,e),r&&hw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Cw(t){var e=K3(t,"string");return eo(e)=="symbol"?e:e+""}function K3(t,e){if(eo(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(eo(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var ac="tus-v1",sc="ietf-draft-03",Wa="ietf-draft-05",G3={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:_w,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:ac},Ew=(function(){function t(e,r){V3(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 z3(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(![ac,sc,Wa].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,Qn.log)("No fingerprint was calculated meaning that the upload cannot be stored in the URL storage."):(0,Qn.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:Y3(this._source.size,a);this._parallelUploadUrls&&s.forEach(function(f,d){f.uploadUrl=n._parallelUploadUrls[d]||null}),this._parallelUploadUrls=new Array(s.length);var u=s.map(function(f,d){var p=0;return n._source.slice(f.start,f.end).then(function(h){var m=h.value;return new Promise(function(y,D){var v=hi(hi({},n.options),{},{uploadUrl:f.uploadUrl||null,storeFingerprintForResuming:!1,removeFingerprintOnSuccess:!1,parallelUploads:1,parallelUploadBoundaries:null,metadata:n.options.metadataForPartialUploads,headers:hi(hi({},n.options.headers),{},{"Upload-Concat":"partial"}),onSuccess:y,onError:D,onProgress:function(_){i=i-p+_,p=_,n._emitProgress(i,o)},onUploadUrlAvailable:function(){n._parallelUploadUrls[d]=E.url,n._parallelUploadUrls.filter(function(_){return!!_}).length===s.length&&n._saveUploadInUrlStorage()}}),E=new t(m,v);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 f=mw(n.options.metadata);return f!==""&&c.setHeader("Upload-Metadata",f),n._sendRequest(c,null)}).then(function(f){if(!mi(f.getStatus(),200)){n._emitHttpError(c,f,"tus: unexpected response while creating upload");return}var d=f.getHeader("Location");if(d==null){n._emitHttpError(c,f,"tus: invalid or missing Location header");return}n.url=bw(n.options.endpoint,d),(0,Qn.log)("Created upload at ".concat(n.url)),n._emitSuccess(f)}).catch(function(f){n._emitError(f)})}},{key:"_startSingleUpload",value:function(){if(this._aborted=!1,this.url!=null){(0,Qn.log)("Resuming upload from previous URL: ".concat(this.url)),this._resumeUpload();return}if(this.options.uploadUrl!=null){(0,Qn.log)("Resuming upload from provided URL: ".concat(this.options.uploadUrl)),this.url=this.options.uploadUrl,this._resumeUpload();return}(0,Qn.log)("Creating a new upload"),this._createUpload()}},{key:"abort",value:function(r){var n=this;if(this._parallelUploads!=null){var o=q3(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 ic.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),Dw(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=mw(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===sc||this.options.protocol===Wa)&&n.setHeader("Upload-Complete","?0"),i=this._sendRequest(n,null)),i.then(function(a){if(!mi(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=bw(r.options.endpoint,s),(0,Qn.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(!mi(a,200)){if(a===423){r._emitHttpError(n,i,"tus: upload is currently locked; retry later");return}if(mi(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===ac){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(!mi(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===ac?r.setHeader("Content-Type","application/offset+octet-stream"):this.options.protocol===Wa&&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 f=n._offset+c;return!n.options.uploadLengthDeferred&&u&&f!==n._size?Promise.reject(new Error("upload was configured with a size of ".concat(n._size," bytes, but the source is done after ").concat(f," bytes"))):s===null?n._sendRequest(r):((n.options.protocol===sc||n.options.protocol===Wa)&&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=gw(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 yw(r,n,this.options)}}],[{key:"terminate",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=gw("DELETE",r,n);return yw(o,null,n).then(function(i){if(i.getStatus()!==204)throw new ic.default("tus: unexpected response while terminating upload",null,o,i)}).catch(function(i){if(i instanceof ic.default||(i=new ic.default("tus: failed to terminate upload",i,o,null)),!Dw(i,0,n))throw i;var a=n.retryDelays[0],s=n.retryDelays.slice(1),u=hi(hi({},n),{},{retryDelays:s});return new Promise(function(c){return setTimeout(c,a)}).then(function(){return t.terminate(r,u)})})}}])})();function mw(t){return Object.entries(t).map(function(e){var r=ww(e,2),n=r[0],o=r[1];return"".concat(n," ").concat(R3.Base64.encode(String(o)))}).join(",")}function mi(t,e){return t>=e&&t<e+100}function gw(t,e,r){var n=r.httpStack.createRequest(t,e);r.protocol===sc?n.setHeader("Upload-Draft-Interop-Version","5"):r.protocol===Wa?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=ww(a[i],2),u=s[0],c=s[1];n.setHeader(u,c)}if(r.addRequestId){var f=(0,N3.default)();n.setHeader("X-Request-ID",f)}return n}function yw(t,e,r){return mh.apply(this,arguments)}function mh(){return mh=L3(hh().mark(function t(e,r,n){var o;return hh().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)})),mh.apply(this,arguments)}function W3(){var t=!0;return typeof navigator<"u"&&navigator.onLine===!1&&(t=!1),t}function Dw(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):_w(t)}function _w(t){var e=t.originalResponse?t.originalResponse.getStatus():0;return(!mi(e,400)||e===409||e===423)&&W3()}function bw(t,e){return new B3.default(e,t).toString()}function Y3(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}Ew.defaultOptions=G3;var pK=uc.default=Ew});var Aw=x((mK,xw)=>{"use strict";var Nr=t=>t!==null&&typeof t=="object"&&typeof t.pipe=="function";Nr.writable=t=>Nr(t)&&t.writable!==!1&&typeof t._write=="function"&&typeof t._writableState=="object";Nr.readable=t=>Nr(t)&&t.readable!==!1&&typeof t._read=="function"&&typeof t._readableState=="object";Nr.duplex=t=>Nr.writable(t)&&Nr.readable(t);Nr.transform=t=>Nr.duplex(t)&&typeof t._transform=="function";xw.exports=Nr});var Fw=x(cc=>{"use strict";Object.defineProperty(cc,"__esModule",{value:!0});cc.default=void 0;function Ya(t){"@babel/helpers - typeof";return Ya=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ya(t)}function J3(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,Z3(n.key),n)}}function X3(t,e,r){return e&&Ow(t.prototype,e),r&&Ow(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Z3(t){var e=Q3(t,"string");return Ya(e)=="symbol"?e:e+""}function Q3(t,e){if(Ya(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Ya(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var gK=cc.default=(function(){function t(e){J3(this,t),this._buffer=e,this.size=e.length}return X3(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 Iw=x(bh=>{"use strict";Object.defineProperty(bh,"__esModule",{value:!0});bh.default=iI;var $w=require("fs");function to(t){"@babel/helpers - typeof";return to=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},to(t)}function yh(){"use strict";yh=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(b,w,C){b[w]=C.value},i=typeof Symbol=="function"?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(b,w,C){return Object.defineProperty(b,w,{value:C,enumerable:!0,configurable:!0,writable:!0}),b[w]}try{c({},"")}catch{c=function(C,O,R){return C[O]=R}}function f(b,w,C,O){var R=w&&w.prototype instanceof v?w:v,$=Object.create(R.prototype),H=new X(O||[]);return o($,"_invoke",{value:j(b,C,H)}),$}function d(b,w,C){try{return{type:"normal",arg:b.call(w,C)}}catch(O){return{type:"throw",arg:O}}}e.wrap=f;var p="suspendedStart",h="suspendedYield",m="executing",y="completed",D={};function v(){}function E(){}function g(){}var _={};c(_,a,function(){return this});var S=Object.getPrototypeOf,P=S&&S(S(k([])));P&&P!==r&&n.call(P,a)&&(_=P);var F=g.prototype=v.prototype=Object.create(_);function B(b){["next","throw","return"].forEach(function(w){c(b,w,function(C){return this._invoke(w,C)})})}function T(b,w){function C(R,$,H,I){var N=d(b[R],b,$);if(N.type!=="throw"){var Z=N.arg,U=Z.value;return U&&to(U)=="object"&&n.call(U,"__await")?w.resolve(U.__await).then(function(oe){C("next",oe,H,I)},function(oe){C("throw",oe,H,I)}):w.resolve(U).then(function(oe){Z.value=oe,H(Z)},function(oe){return C("throw",oe,H,I)})}I(N.arg)}var O;o(this,"_invoke",{value:function($,H){function I(){return new w(function(N,Z){C($,H,N,Z)})}return O=O?O.then(I,I):I()}})}function j(b,w,C){var O=p;return function(R,$){if(O===m)throw Error("Generator is already running");if(O===y){if(R==="throw")throw $;return{value:t,done:!0}}for(C.method=R,C.arg=$;;){var H=C.delegate;if(H){var I=A(H,C);if(I){if(I===D)continue;return I}}if(C.method==="next")C.sent=C._sent=C.arg;else if(C.method==="throw"){if(O===p)throw O=y,C.arg;C.dispatchException(C.arg)}else C.method==="return"&&C.abrupt("return",C.arg);O=m;var N=d(b,w,C);if(N.type==="normal"){if(O=C.done?y:h,N.arg===D)continue;return{value:N.arg,done:C.done}}N.type==="throw"&&(O=y,C.method="throw",C.arg=N.arg)}}}function A(b,w){var C=w.method,O=b.iterator[C];if(O===t)return w.delegate=null,C==="throw"&&b.iterator.return&&(w.method="return",w.arg=t,A(b,w),w.method==="throw")||C!=="return"&&(w.method="throw",w.arg=new TypeError("The iterator does not provide a '"+C+"' method")),D;var R=d(O,b.iterator,w.arg);if(R.type==="throw")return w.method="throw",w.arg=R.arg,w.delegate=null,D;var $=R.arg;return $?$.done?(w[b.resultName]=$.value,w.next=b.nextLoc,w.method!=="return"&&(w.method="next",w.arg=t),w.delegate=null,D):$:(w.method="throw",w.arg=new TypeError("iterator result is not an object"),w.delegate=null,D)}function M(b){var w={tryLoc:b[0]};1 in b&&(w.catchLoc=b[1]),2 in b&&(w.finallyLoc=b[2],w.afterLoc=b[3]),this.tryEntries.push(w)}function L(b){var w=b.completion||{};w.type="normal",delete w.arg,b.completion=w}function X(b){this.tryEntries=[{tryLoc:"root"}],b.forEach(M,this),this.reset(!0)}function k(b){if(b||b===""){var w=b[a];if(w)return w.call(b);if(typeof b.next=="function")return b;if(!isNaN(b.length)){var C=-1,O=function R(){for(;++C<b.length;)if(n.call(b,C))return R.value=b[C],R.done=!1,R;return R.value=t,R.done=!0,R};return O.next=O}}throw new TypeError(to(b)+" is not iterable")}return E.prototype=g,o(F,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:E,configurable:!0}),E.displayName=c(g,u,"GeneratorFunction"),e.isGeneratorFunction=function(b){var w=typeof b=="function"&&b.constructor;return!!w&&(w===E||(w.displayName||w.name)==="GeneratorFunction")},e.mark=function(b){return Object.setPrototypeOf?Object.setPrototypeOf(b,g):(b.__proto__=g,c(b,u,"GeneratorFunction")),b.prototype=Object.create(F),b},e.awrap=function(b){return{__await:b}},B(T.prototype),c(T.prototype,s,function(){return this}),e.AsyncIterator=T,e.async=function(b,w,C,O,R){R===void 0&&(R=Promise);var $=new T(f(b,w,C,O),R);return e.isGeneratorFunction(w)?$:$.next().then(function(H){return H.done?H.value:$.next()})},B(F),c(F,u,"Generator"),c(F,a,function(){return this}),c(F,"toString",function(){return"[object Generator]"}),e.keys=function(b){var w=Object(b),C=[];for(var O in w)C.push(O);return C.reverse(),function R(){for(;C.length;){var $=C.pop();if($ in w)return R.value=$,R.done=!1,R}return R.done=!0,R}},e.values=k,X.prototype={constructor:X,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(L),!w)for(var C in this)C.charAt(0)==="t"&&n.call(this,C)&&!isNaN(+C.slice(1))&&(this[C]=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 C=this;function O(Z,U){return H.type="throw",H.arg=w,C.next=Z,U&&(C.method="next",C.arg=t),!!U}for(var R=this.tryEntries.length-1;R>=0;--R){var $=this.tryEntries[R],H=$.completion;if($.tryLoc==="root")return O("end");if($.tryLoc<=this.prev){var I=n.call($,"catchLoc"),N=n.call($,"finallyLoc");if(I&&N){if(this.prev<$.catchLoc)return O($.catchLoc,!0);if(this.prev<$.finallyLoc)return O($.finallyLoc)}else if(I){if(this.prev<$.catchLoc)return O($.catchLoc,!0)}else{if(!N)throw Error("try statement without catch or finally");if(this.prev<$.finallyLoc)return O($.finallyLoc)}}}},abrupt:function(w,C){for(var O=this.tryEntries.length-1;O>=0;--O){var R=this.tryEntries[O];if(R.tryLoc<=this.prev&&n.call(R,"finallyLoc")&&this.prev<R.finallyLoc){var $=R;break}}$&&(w==="break"||w==="continue")&&$.tryLoc<=C&&C<=$.finallyLoc&&($=null);var H=$?$.completion:{};return H.type=w,H.arg=C,$?(this.method="next",this.next=$.finallyLoc,D):this.complete(H)},complete:function(w,C){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"&&C&&(this.next=C),D},finish:function(w){for(var C=this.tryEntries.length-1;C>=0;--C){var O=this.tryEntries[C];if(O.finallyLoc===w)return this.complete(O.completion,O.afterLoc),L(O),D}},catch:function(w){for(var C=this.tryEntries.length-1;C>=0;--C){var O=this.tryEntries[C];if(O.tryLoc===w){var R=O.completion;if(R.type==="throw"){var $=R.arg;L(O)}return $}}throw Error("illegal catch attempt")},delegateYield:function(w,C,O){return this.delegate={iterator:k(w),resultName:C,nextLoc:O},this.method==="next"&&(this.arg=t),D}},e}function eI(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function kw(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,rI(n.key),n)}}function tI(t,e,r){return e&&kw(t.prototype,e),r&&kw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function rI(t){var e=nI(t,"string");return to(e)=="symbol"?e:e+""}function nI(t,e){if(to(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(to(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Pw(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 oI(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(u){Pw(i,n,o,a,s,"next",u)}function s(u){Pw(i,n,o,a,s,"throw",u)}a(void 0)})}}function iI(t){return Dh.apply(this,arguments)}function Dh(){return Dh=oI(yh().mark(function t(e){var r,n,o,i,a,s,u;return yh().wrap(function(f){for(;;)switch(f.prev=f.next){case 0:return n=e.path.toString(),f.next=3,$w.promises.stat(n);case 3:return o=f.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,f.abrupt("return",new aI(e,n,u));case 9:case"end":return f.stop()}},t)})),Dh.apply(this,arguments)}var aI=(function(){function t(e,r,n){eI(this,t),this._stream=e,this._path=r,this.size=n}return tI(t,[{key:"slice",value:function(r,n){var o,i=(o=this._stream.start)!==null&&o!==void 0?o:0,a=(0,$w.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 vh=x(lc=>{"use strict";Object.defineProperty(lc,"__esModule",{value:!0});lc.default=void 0;function ro(t){"@babel/helpers - typeof";return ro=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},ro(t)}function Ja(){"use strict";Ja=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(b,w,C){b[w]=C.value},i=typeof Symbol=="function"?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(b,w,C){return Object.defineProperty(b,w,{value:C,enumerable:!0,configurable:!0,writable:!0}),b[w]}try{c({},"")}catch{c=function(C,O,R){return C[O]=R}}function f(b,w,C,O){var R=w&&w.prototype instanceof v?w:v,$=Object.create(R.prototype),H=new X(O||[]);return o($,"_invoke",{value:j(b,C,H)}),$}function d(b,w,C){try{return{type:"normal",arg:b.call(w,C)}}catch(O){return{type:"throw",arg:O}}}e.wrap=f;var p="suspendedStart",h="suspendedYield",m="executing",y="completed",D={};function v(){}function E(){}function g(){}var _={};c(_,a,function(){return this});var S=Object.getPrototypeOf,P=S&&S(S(k([])));P&&P!==r&&n.call(P,a)&&(_=P);var F=g.prototype=v.prototype=Object.create(_);function B(b){["next","throw","return"].forEach(function(w){c(b,w,function(C){return this._invoke(w,C)})})}function T(b,w){function C(R,$,H,I){var N=d(b[R],b,$);if(N.type!=="throw"){var Z=N.arg,U=Z.value;return U&&ro(U)=="object"&&n.call(U,"__await")?w.resolve(U.__await).then(function(oe){C("next",oe,H,I)},function(oe){C("throw",oe,H,I)}):w.resolve(U).then(function(oe){Z.value=oe,H(Z)},function(oe){return C("throw",oe,H,I)})}I(N.arg)}var O;o(this,"_invoke",{value:function($,H){function I(){return new w(function(N,Z){C($,H,N,Z)})}return O=O?O.then(I,I):I()}})}function j(b,w,C){var O=p;return function(R,$){if(O===m)throw Error("Generator is already running");if(O===y){if(R==="throw")throw $;return{value:t,done:!0}}for(C.method=R,C.arg=$;;){var H=C.delegate;if(H){var I=A(H,C);if(I){if(I===D)continue;return I}}if(C.method==="next")C.sent=C._sent=C.arg;else if(C.method==="throw"){if(O===p)throw O=y,C.arg;C.dispatchException(C.arg)}else C.method==="return"&&C.abrupt("return",C.arg);O=m;var N=d(b,w,C);if(N.type==="normal"){if(O=C.done?y:h,N.arg===D)continue;return{value:N.arg,done:C.done}}N.type==="throw"&&(O=y,C.method="throw",C.arg=N.arg)}}}function A(b,w){var C=w.method,O=b.iterator[C];if(O===t)return w.delegate=null,C==="throw"&&b.iterator.return&&(w.method="return",w.arg=t,A(b,w),w.method==="throw")||C!=="return"&&(w.method="throw",w.arg=new TypeError("The iterator does not provide a '"+C+"' method")),D;var R=d(O,b.iterator,w.arg);if(R.type==="throw")return w.method="throw",w.arg=R.arg,w.delegate=null,D;var $=R.arg;return $?$.done?(w[b.resultName]=$.value,w.next=b.nextLoc,w.method!=="return"&&(w.method="next",w.arg=t),w.delegate=null,D):$:(w.method="throw",w.arg=new TypeError("iterator result is not an object"),w.delegate=null,D)}function M(b){var w={tryLoc:b[0]};1 in b&&(w.catchLoc=b[1]),2 in b&&(w.finallyLoc=b[2],w.afterLoc=b[3]),this.tryEntries.push(w)}function L(b){var w=b.completion||{};w.type="normal",delete w.arg,b.completion=w}function X(b){this.tryEntries=[{tryLoc:"root"}],b.forEach(M,this),this.reset(!0)}function k(b){if(b||b===""){var w=b[a];if(w)return w.call(b);if(typeof b.next=="function")return b;if(!isNaN(b.length)){var C=-1,O=function R(){for(;++C<b.length;)if(n.call(b,C))return R.value=b[C],R.done=!1,R;return R.value=t,R.done=!0,R};return O.next=O}}throw new TypeError(ro(b)+" is not iterable")}return E.prototype=g,o(F,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:E,configurable:!0}),E.displayName=c(g,u,"GeneratorFunction"),e.isGeneratorFunction=function(b){var w=typeof b=="function"&&b.constructor;return!!w&&(w===E||(w.displayName||w.name)==="GeneratorFunction")},e.mark=function(b){return Object.setPrototypeOf?Object.setPrototypeOf(b,g):(b.__proto__=g,c(b,u,"GeneratorFunction")),b.prototype=Object.create(F),b},e.awrap=function(b){return{__await:b}},B(T.prototype),c(T.prototype,s,function(){return this}),e.AsyncIterator=T,e.async=function(b,w,C,O,R){R===void 0&&(R=Promise);var $=new T(f(b,w,C,O),R);return e.isGeneratorFunction(w)?$:$.next().then(function(H){return H.done?H.value:$.next()})},B(F),c(F,u,"Generator"),c(F,a,function(){return this}),c(F,"toString",function(){return"[object Generator]"}),e.keys=function(b){var w=Object(b),C=[];for(var O in w)C.push(O);return C.reverse(),function R(){for(;C.length;){var $=C.pop();if($ in w)return R.value=$,R.done=!1,R}return R.done=!0,R}},e.values=k,X.prototype={constructor:X,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(L),!w)for(var C in this)C.charAt(0)==="t"&&n.call(this,C)&&!isNaN(+C.slice(1))&&(this[C]=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 C=this;function O(Z,U){return H.type="throw",H.arg=w,C.next=Z,U&&(C.method="next",C.arg=t),!!U}for(var R=this.tryEntries.length-1;R>=0;--R){var $=this.tryEntries[R],H=$.completion;if($.tryLoc==="root")return O("end");if($.tryLoc<=this.prev){var I=n.call($,"catchLoc"),N=n.call($,"finallyLoc");if(I&&N){if(this.prev<$.catchLoc)return O($.catchLoc,!0);if(this.prev<$.finallyLoc)return O($.finallyLoc)}else if(I){if(this.prev<$.catchLoc)return O($.catchLoc,!0)}else{if(!N)throw Error("try statement without catch or finally");if(this.prev<$.finallyLoc)return O($.finallyLoc)}}}},abrupt:function(w,C){for(var O=this.tryEntries.length-1;O>=0;--O){var R=this.tryEntries[O];if(R.tryLoc<=this.prev&&n.call(R,"finallyLoc")&&this.prev<R.finallyLoc){var $=R;break}}$&&(w==="break"||w==="continue")&&$.tryLoc<=C&&C<=$.finallyLoc&&($=null);var H=$?$.completion:{};return H.type=w,H.arg=C,$?(this.method="next",this.next=$.finallyLoc,D):this.complete(H)},complete:function(w,C){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"&&C&&(this.next=C),D},finish:function(w){for(var C=this.tryEntries.length-1;C>=0;--C){var O=this.tryEntries[C];if(O.finallyLoc===w)return this.complete(O.completion,O.afterLoc),L(O),D}},catch:function(w){for(var C=this.tryEntries.length-1;C>=0;--C){var O=this.tryEntries[C];if(O.tryLoc===w){var R=O.completion;if(R.type==="throw"){var $=R.arg;L(O)}return $}}throw Error("illegal catch attempt")},delegateYield:function(w,C,O){return this.delegate={iterator:k(w),resultName:C,nextLoc:O},this.method==="next"&&(this.arg=t),D}},e}function sI(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Tw(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,cI(n.key),n)}}function uI(t,e,r){return e&&Tw(t.prototype,e),r&&Tw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function cI(t){var e=lI(t,"string");return ro(e)=="symbol"?e:e+""}function lI(t,e){if(ro(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ro(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Rw(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 Bw(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(u){Rw(i,n,o,a,s,"next",u)}function s(u){Rw(i,n,o,a,s,"throw",u)}a(void 0)})}}function fI(t,e){return wh.apply(this,arguments)}function wh(){return wh=Bw(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(f){e.off("readable",u),a(f)},u=function c(){var f=e.read(r);f!==null&&(e.off("error",s),e.off("readable",c),i(f))};e.once("error",s),e.on("readable",u)}));case 1:case"end":return o.stop()}},t)})),wh.apply(this,arguments)}var bK=lc.default=(function(){function t(e){var r=this;sI(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 uI(t,[{key:"slice",value:(function(){var e=Bw(Ja().mark(function n(o,i){var a,s,u,c,f;return Ja().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:if(!(o<this._bufPos)){p.next=2;break}throw new Error("cannot slice from position which we already seeked away");case 2:if(!(o>this._bufPos+this._buf.length)){p.next=4;break}throw new Error("slice start is outside of buffer (currently not implemented)");case 4:if(!this._error){p.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){p.next=10;break}return a.size=a.length,p.abrupt("return",{value:a,done:!0});case 10:if(c=i-o,!(c>a.length)){p.next=16;break}return p.next=14,fI(this._stream,c-a.length);case 14:f=p.sent,a=Buffer.concat([a,f]);case 16:return this._buf=a,this._bufPos=o,a.size=a.length,p.abrupt("return",{value:a,done:this._ended});case 20:case"end":return p.stop()}},n,this)}));function r(n,o){return e.apply(this,arguments)}return r})()},{key:"close",value:function(){this._stream.destroy()}}])})()});var Lw=x(dc=>{"use strict";Object.defineProperty(dc,"__esModule",{value:!0});dc.default=void 0;var dI=require("fs"),pI=fc(Aw()),hI=fc(Fw()),mI=fc(Iw()),gI=fc(vh());function fc(t){return t&&t.__esModule?t:{default:t}}function Xa(t){"@babel/helpers - typeof";return Xa=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},Xa(t)}function yI(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Nw(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,bI(n.key),n)}}function DI(t,e,r){return e&&Nw(t.prototype,e),r&&Nw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function bI(t){var e=wI(t,"string");return Xa(e)=="symbol"?e:e+""}function wI(t,e){if(Xa(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Xa(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var vK=dc.default=(function(){function t(){yI(this,t)}return DI(t,[{key:"openFile",value:function(r,n){return Buffer.isBuffer(r)?Promise.resolve(new hI.default(r)):r instanceof dI.ReadStream&&r.path!=null?(0,mI.default)(r):pI.default.readable(r)?(n=Number(n),Number.isFinite(n)?Promise.resolve(new gI.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 qw=x(Ch=>{"use strict";Object.defineProperty(Ch,"__esModule",{value:!0});Ch.default=EI;var vI=require("crypto"),jw=Mw(require("fs")),CI=Mw(require("path"));function Uw(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(Uw=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=Uw(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 EI(t,e){if(Buffer.isBuffer(t)){var r=65536,n=t.slice(0,Math.min(r,t.length)),o=(0,vI.createHash)("md5").update(n).digest("hex"),i=["node-buffer",o,t.length,e.endpoint].join("-");return Promise.resolve(i)}return t instanceof jw.ReadStream&&t.path!=null?new Promise(function(a,s){var u=CI.resolve(t.path);jw.stat(t.path,function(c,f){if(c){s(c);return}var d=["node-file",u,f.size,f.mtime.getTime(),e.endpoint].join("-");a(d)})}):Promise.resolve(null)}});var Gw=x((_K,Kw)=>{var zw="Expected a function",Hw=NaN,_I="[object Symbol]",SI=/^\s+|\s+$/g,xI=/^[-+]0x[0-9a-f]+$/i,AI=/^0b[01]+$/i,OI=/^0o[0-7]+$/i,FI=parseInt,kI=typeof global=="object"&&global&&global.Object===Object&&global,PI=typeof self=="object"&&self&&self.Object===Object&&self,$I=kI||PI||Function("return this")(),II=Object.prototype,TI=II.toString,RI=Math.max,BI=Math.min,Eh=function(){return $I.Date.now()};function NI(t,e,r){var n,o,i,a,s,u,c=0,f=!1,d=!1,p=!0;if(typeof t!="function")throw new TypeError(zw);e=Vw(e)||0,pc(r)&&(f=!!r.leading,d="maxWait"in r,i=d?RI(Vw(r.maxWait)||0,e):i,p="trailing"in r?!!r.trailing:p);function h(P){var F=n,B=o;return n=o=void 0,c=P,a=t.apply(B,F),a}function m(P){return c=P,s=setTimeout(v,e),f?h(P):a}function y(P){var F=P-u,B=P-c,T=e-F;return d?BI(T,i-B):T}function D(P){var F=P-u,B=P-c;return u===void 0||F>=e||F<0||d&&B>=i}function v(){var P=Eh();if(D(P))return E(P);s=setTimeout(v,y(P))}function E(P){return s=void 0,p&&n?h(P):(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(Eh())}function S(){var P=Eh(),F=D(P);if(n=arguments,o=this,u=P,F){if(s===void 0)return m(u);if(d)return s=setTimeout(v,e),h(u)}return s===void 0&&(s=setTimeout(v,e)),a}return S.cancel=g,S.flush=_,S}function LI(t,e,r){var n=!0,o=!0;if(typeof t!="function")throw new TypeError(zw);return pc(r)&&(n="leading"in r?!!r.leading:n,o="trailing"in r?!!r.trailing:o),NI(t,e,{leading:n,maxWait:e,trailing:o})}function pc(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function jI(t){return!!t&&typeof t=="object"}function UI(t){return typeof t=="symbol"||jI(t)&&TI.call(t)==_I}function Vw(t){if(typeof t=="number")return t;if(UI(t))return Hw;if(pc(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=pc(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(SI,"");var r=AI.test(t);return r||OI.test(t)?FI(t.slice(2),r?2:8):xI.test(t)?Hw:+t}Kw.exports=LI});var rv=x(yc=>{"use strict";Object.defineProperty(yc,"__esModule",{value:!0});yc.default=void 0;var MI=Qw(require("http")),qI=Qw(require("https")),Jw=require("stream"),HI=require("url"),Xw=VI(Gw());function VI(t){return t&&t.__esModule?t:{default:t}}function Zw(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(Zw=function(n){return n?r:e})(t)}function Qw(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=Zw(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 zI(t,e,r){return e=hc(e),KI(t,ev()?Reflect.construct(e,r||[],hc(t).constructor):e.apply(t,r))}function KI(t,e){if(e&&(gi(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return GI(t)}function GI(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ev(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ev=function(){return!!t})()}function hc(t){return hc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},hc(t)}function WI(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&&_h(t,e)}function _h(t,e){return _h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},_h(t,e)}function Ww(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 Za(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Ww(Object(r),!0).forEach(function(n){YI(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ww(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function YI(t,e,r){return e=tv(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function gi(t){"@babel/helpers - typeof";return gi=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},gi(t)}function mc(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Yw(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,tv(n.key),n)}}function gc(t,e,r){return e&&Yw(t.prototype,e),r&&Yw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function tv(t){var e=JI(t,"string");return gi(e)=="symbol"?e:e+""}function JI(t,e){if(gi(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(gi(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var SK=yc.default=(function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};mc(this,t),this._requestOptions=e}return gc(t,[{key:"createRequest",value:function(r,n){return new XI(r,n,this._requestOptions)}},{key:"getName",value:function(){return"NodeHttpStack"}}])})(),XI=(function(){function t(e,r,n){mc(this,t),this._method=e,this._url=r,this._headers={},this._request=null,this._progressHandler=function(){},this._requestOptions=n||{}}return gc(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=Za(Za(Za({},(0,HI.parse)(r._url)),r._requestOptions),{},{method:r._method,headers:Za(Za({},r._requestOptions.headers||{}),r._headers)});n!=null&&n.size&&(a.headers["Content-Length"]=n.size);var s=a.protocol==="https:"?qI:MI;r._request=s.request(a);var u=r._request;u.on("response",function(c){var f=[];c.on("data",function(d){f.push(d)}),c.on("end",function(){var d=Buffer.concat(f).toString("utf8");o(new ZI(c,d))})}),u.on("error",function(c){i(c)}),n instanceof Jw.Readable?n.pipe(new QI(r._progressHandler)).pipe(u):n instanceof Uint8Array?eT(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}}])})(),ZI=(function(){function t(e,r){mc(this,t),this._response=e,this._body=r}return gc(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}}])})(),QI=(function(t){function e(r){var n;return mc(this,e),n=zI(this,e),n._onprogress=(0,Xw.default)(r,100,{leading:!0,trailing:!1}),n._position=0,n}return WI(e,t),gc(e,[{key:"_transform",value:function(n,o,i){this._position+=n.length,this._onprogress(this._position),i(null,n)}}])})(Jw.Transform),eT=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 nv=x(Sh=>{"use strict";Sh.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};Sh.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(`
30
+ ${h.stack}`)}else p=(f=i?.stack)!==null&&f!==void 0?f:"";return{error:{message:`${(d=i?.name)!==null&&d!==void 0?d:"FetchError"}: ${i?.message}`,details:p,hint:"",code:""},data:null,count:null,status:0,statusText:""}})),o.then(e,r)}returns(){return this}overrideTypes(){return this}};Bd.default=Rd});var Ud=x(jd=>{"use strict";Object.defineProperty(jd,"__esModule",{value:!0});var KP=(ve(),ie(we)),GP=KP.__importDefault(Nd()),Ld=class extends GP.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}};jd.default=Ld});var Pu=x(qd=>{"use strict";Object.defineProperty(qd,"__esModule",{value:!0});var WP=(ve(),ie(we)),YP=WP.__importDefault(Ud()),JP=new RegExp("[,()]"),Md=class extends YP.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}regexMatch(e,r){return this.url.searchParams.append(e,`match.${r}`),this}regexIMatch(e,r){return this.url.searchParams.append(e,`imatch.${r}`),this}is(e,r){return this.url.searchParams.append(e,`is.${r}`),this}isDistinct(e,r){return this.url.searchParams.append(e,`isdistinct.${r}`),this}in(e,r){let n=Array.from(new Set(r)).map(o=>typeof o=="string"&&JP.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}};qd.default=Md});var zd=x(Vd=>{"use strict";Object.defineProperty(Vd,"__esModule",{value:!0});var XP=(ve(),ie(we)),$a=XP.__importDefault(Pu()),Hd=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 $a.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 $a.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,f)=>c.concat(Object.keys(f)),[]);if(u.length>0){let c=[...new Set(u)].map(f=>`"${f}"`);this.url.searchParams.set("columns",c.join(","))}}return new $a.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 $a.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 $a.default({method:n,url:this.url,headers:this.headers,schema:this.schema,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}};Vd.default=Hd});var u0=x(Gd=>{"use strict";Object.defineProperty(Gd,"__esModule",{value:!0});var s0=(ve(),ie(we)),ZP=s0.__importDefault(zd()),QP=s0.__importDefault(Pu()),Kd=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){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");let r=new URL(`${this.url}/${e}`);return new ZP.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(([d,p])=>p!==void 0).map(([d,p])=>[d,Array.isArray(p)?`{${p.join(",")}}`:`${p}`]).forEach(([d,p])=>{u.searchParams.append(d,p)})):(s="POST",c=r);let f=new Headers(this.headers);return i&&f.set("Prefer",`count=${i}`),new QP.default({method:s,url:u,headers:f,schema:this.schemaName,body:c,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}};Gd.default=Kd});var Wd=x($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.PostgrestError=$t.PostgrestBuilder=$t.PostgrestTransformBuilder=$t.PostgrestFilterBuilder=$t.PostgrestQueryBuilder=$t.PostgrestClient=void 0;var ei=(ve(),ie(we)),c0=ei.__importDefault(u0());$t.PostgrestClient=c0.default;var l0=ei.__importDefault(zd());$t.PostgrestQueryBuilder=l0.default;var f0=ei.__importDefault(Pu());$t.PostgrestFilterBuilder=f0.default;var d0=ei.__importDefault(Ud());$t.PostgrestTransformBuilder=d0.default;var p0=ei.__importDefault(Nd());$t.PostgrestBuilder=p0.default;var h0=ei.__importDefault(Td());$t.PostgrestError=h0.default;$t.default={PostgrestClient:c0.default,PostgrestQueryBuilder:l0.default,PostgrestFilterBuilder:f0.default,PostgrestTransformBuilder:d0.default,PostgrestBuilder:p0.default,PostgrestError:h0.default}});var Jd={};en(Jd,{RealtimeClient:()=>Yd});var Yd,Xd=Qe(()=>{Yd=class{constructor(){}connect(){}disconnect(){}}});var On=x(nn=>{"use strict";Object.defineProperty(nn,"__esModule",{value:!0});nn.StorageUnknownError=nn.StorageApiError=nn.StorageError=void 0;nn.isStorageError=ek;var Ia=class extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}};nn.StorageError=Ia;function ek(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var Zd=class extends Ia{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}}};nn.StorageApiError=Zd;var Qd=class extends Ia{constructor(e,r){super(e),this.name="StorageUnknownError",this.originalError=r}};nn.StorageUnknownError=Qd});var Ta=x(pr=>{"use strict";Object.defineProperty(pr,"__esModule",{value:!0});pr.isPlainObject=pr.recursiveToCamel=pr.resolveResponse=pr.resolveFetch=void 0;var tk=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);pr.resolveFetch=tk;var rk=()=>Response;pr.resolveResponse=rk;var nk=t=>{if(Array.isArray(t))return t.map(r=>(0,pr.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,pr.recursiveToCamel)(n)}),e};pr.recursiveToCamel=nk;var ok=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)};pr.isPlainObject=ok});var ku=x(Zn=>{"use strict";Object.defineProperty(Zn,"__esModule",{value:!0});Zn.get=sk;Zn.post=uk;Zn.put=ck;Zn.head=lk;Zn.remove=fk;var Xn=(ve(),ie(we)),ep=On(),m0=Ta(),tp=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)},ik=(t,e,r)=>Xn.__awaiter(void 0,void 0,void 0,function*(){let n=yield(0,m0.resolveResponse)();t instanceof n&&!r?.noResolveJson?t.json().then(o=>{let i=t.status||500,a=o?.statusCode||i+"";e(new ep.StorageApiError(tp(o),i,a))}).catch(o=>{e(new ep.StorageUnknownError(tp(o),o))}):e(new ep.StorageUnknownError(tp(t),t))}),ak=(t,e,r,n)=>{let o={method:t,headers:e?.headers||{}};return t==="GET"||!n?o:((0,m0.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 Ra(t,e,r,n,o,i){return Xn.__awaiter(this,void 0,void 0,function*(){return new Promise((a,s)=>{t(r,ak(e,n,o,i)).then(u=>{if(!u.ok)throw u;return n?.noResolveJson?u:u.json()}).then(u=>a(u)).catch(u=>ik(u,s,n))})})}function sk(t,e,r,n){return Xn.__awaiter(this,void 0,void 0,function*(){return Ra(t,"GET",e,r,n)})}function uk(t,e,r,n,o){return Xn.__awaiter(this,void 0,void 0,function*(){return Ra(t,"POST",e,n,o,r)})}function ck(t,e,r,n,o){return Xn.__awaiter(this,void 0,void 0,function*(){return Ra(t,"PUT",e,n,o,r)})}function lk(t,e,r,n){return Xn.__awaiter(this,void 0,void 0,function*(){return Ra(t,"HEAD",e,Object.assign(Object.assign({},r),{noResolveJson:!0}),n)})}function fk(t,e,r,n,o){return Xn.__awaiter(this,void 0,void 0,function*(){return Ra(t,"DELETE",e,n,o,r)})}});var g0=x(np=>{"use strict";Object.defineProperty(np,"__esModule",{value:!0});var dk=(ve(),ie(we)),pk=On(),rp=class{constructor(e,r){this.downloadFn=e,this.shouldThrowOnError=r}then(e,r){return this.execute().then(e,r)}execute(){return dk.__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,pk.isStorageError)(e))return{data:null,error:e};throw e}})}};np.default=rp});var b0=x(ip=>{"use strict";var y0;Object.defineProperty(ip,"__esModule",{value:!0});var D0=(ve(),ie(we)),hk=On(),mk=D0.__importDefault(g0()),op=class{constructor(e,r){this.downloadFn=e,this.shouldThrowOnError=r,this[y0]="BlobDownloadBuilder",this.promise=null}asStream(){return new mk.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 D0.__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,hk.isStorageError)(e))return{data:null,error:e};throw e}})}};y0=Symbol.toStringTag;ip.default=op});var C0=x(sp=>{"use strict";Object.defineProperty(sp,"__esModule",{value:!0});var It=(ve(),ie(we)),zt=On(),Kt=ku(),w0=Ta(),gk=It.__importDefault(b0()),yk={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},v0={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,w0.resolveFetch)(o)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(e,r,n,o){return It.__awaiter(this,void 0,void 0,function*(){try{let i,a=Object.assign(Object.assign({},v0),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),f=this._getFinalPath(c),d=yield(e=="PUT"?Kt.put:Kt.post)(this.fetch,`${this.url}/object/${f}`,i,Object.assign({headers:s},a?.duplex?{duplex:a.duplex}:{}));return{data:{path:c,id:d.Id,fullPath:d.Key},error:null}}catch(i){if(this.shouldThrowOnError)throw i;if((0,zt.isStorageError)(i))return{data:null,error:i};throw i}})}upload(e,r,n){return It.__awaiter(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,r,n)})}uploadToSignedUrl(e,r,n,o){return It.__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:v0.upsert},o),f=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,f["cache-control"]=`max-age=${c.cacheControl}`,f["content-type"]=c.contentType);let d=yield(0,Kt.put)(this.fetch,s.toString(),u,{headers:f});return{data:{path:i,fullPath:d.Key},error:null}}catch(u){if(this.shouldThrowOnError)throw u;if((0,zt.isStorageError)(u))return{data:null,error:u};throw u}})}createSignedUploadUrl(e,r){return It.__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,Kt.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 zt.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,zt.isStorageError)(n))return{data:null,error:n};throw n}})}update(e,r,n){return It.__awaiter(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,r,n)})}move(e,r,n){return It.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Kt.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,zt.isStorageError)(o))return{data:null,error:o};throw o}})}copy(e,r,n){return It.__awaiter(this,void 0,void 0,function*(){try{return{data:{path:(yield(0,Kt.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,zt.isStorageError)(o))return{data:null,error:o};throw o}})}createSignedUrl(e,r,n){return It.__awaiter(this,void 0,void 0,function*(){try{let o=this._getFinalPath(e),i=yield(0,Kt.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,zt.isStorageError)(o))return{data:null,error:o};throw o}})}createSignedUrls(e,r,n){return It.__awaiter(this,void 0,void 0,function*(){try{let o=yield(0,Kt.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,zt.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,Kt.get)(this.fetch,`${this.url}/${o}/${s}${a}`,{headers:this.headers,noResolveJson:!0});return new gk.default(u,this.shouldThrowOnError)}info(e){return It.__awaiter(this,void 0,void 0,function*(){let r=this._getFinalPath(e);try{let n=yield(0,Kt.get)(this.fetch,`${this.url}/object/info/${r}`,{headers:this.headers});return{data:(0,w0.recursiveToCamel)(n),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,zt.isStorageError)(n))return{data:null,error:n};throw n}})}exists(e){return It.__awaiter(this,void 0,void 0,function*(){let r=this._getFinalPath(e);try{return yield(0,Kt.head)(this.fetch,`${this.url}/object/${r}`,{headers:this.headers}),{data:!0,error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,zt.isStorageError)(n)&&n instanceof zt.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 It.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Kt.remove)(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,zt.isStorageError)(r))return{data:null,error:r};throw r}})}list(e,r,n){return It.__awaiter(this,void 0,void 0,function*(){try{let o=Object.assign(Object.assign(Object.assign({},yk),r),{prefix:e||""});return{data:yield(0,Kt.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,zt.isStorageError)(o))return{data:null,error:o};throw o}})}listV2(e,r){return It.__awaiter(this,void 0,void 0,function*(){try{let n=Object.assign({},e);return{data:yield(0,Kt.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,zt.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("&")}};sp.default=ap});var up=x($u=>{"use strict";Object.defineProperty($u,"__esModule",{value:!0});$u.version=void 0;$u.version="2.84.0"});var cp=x(Iu=>{"use strict";Object.defineProperty(Iu,"__esModule",{value:!0});Iu.DEFAULT_HEADERS=void 0;var Dk=up();Iu.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${Dk.version}`}});var E0=x(fp=>{"use strict";Object.defineProperty(fp,"__esModule",{value:!0});var ti=(ve(),ie(we)),bk=cp(),ri=On(),ni=ku(),wk=Ta(),lp=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({},bk.DEFAULT_HEADERS),r),this.fetch=(0,wk.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(e){return ti.__awaiter(this,void 0,void 0,function*(){try{let r=this.listBucketOptionsToQueryString(e);return{data:yield(0,ni.get)(this.fetch,`${this.url}/bucket${r}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ri.isStorageError)(r))return{data:null,error:r};throw r}})}getBucket(e){return ti.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ni.get)(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ri.isStorageError)(r))return{data:null,error:r};throw r}})}createBucket(e){return ti.__awaiter(this,arguments,void 0,function*(r,n={public:!1}){try{return{data:yield(0,ni.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,ri.isStorageError)(o))return{data:null,error:o};throw o}})}updateBucket(e,r){return ti.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ni.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,ri.isStorageError)(n))return{data:null,error:n};throw n}})}emptyBucket(e){return ti.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ni.post)(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ri.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return ti.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ni.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ri.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():""}};fp.default=lp});var yp=x(gp=>{"use strict";Object.defineProperty(gp,"__esModule",{value:!0});var dp=(ve(),ie(we)),vk=cp(),pp=On(),hp=ku(),Ck=Ta(),mp=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},vk.DEFAULT_HEADERS),r),this.fetch=(0,Ck.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return dp.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,hp.post)(this.fetch,`${this.url}/bucket`,{name:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,pp.isStorageError)(r))return{data:null,error:r};throw r}})}listBuckets(e){return dp.__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,hp.get)(this.fetch,o,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,pp.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return dp.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,hp.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,pp.isStorageError)(r))return{data:null,error:r};throw r}})}};gp.default=mp});var Ru=x(Tu=>{"use strict";Object.defineProperty(Tu,"__esModule",{value:!0});Tu.DEFAULT_HEADERS=void 0;var Ek=up();Tu.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${Ek.version}`,"Content-Type":"application/json"}});var oi=x(Or=>{"use strict";Object.defineProperty(Or,"__esModule",{value:!0});Or.StorageVectorsErrorCode=Or.StorageVectorsUnknownError=Or.StorageVectorsApiError=Or.StorageVectorsError=void 0;Or.isStorageVectorsError=_k;var Ba=class extends Error{constructor(e){super(e),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};Or.StorageVectorsError=Ba;function _k(t){return typeof t=="object"&&t!==null&&"__isStorageVectorsError"in t}var Dp=class extends Ba{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}}};Or.StorageVectorsApiError=Dp;var bp=class extends Ba{constructor(e,r){super(e),this.name="StorageVectorsUnknownError",this.originalError=r}};Or.StorageVectorsUnknownError=bp;var _0;(function(t){t.InternalError="InternalError",t.S3VectorConflictException="S3VectorConflictException",t.S3VectorNotFoundException="S3VectorNotFoundException",t.S3VectorBucketNotEmpty="S3VectorBucketNotEmpty",t.S3VectorMaxBucketsExceeded="S3VectorMaxBucketsExceeded",t.S3VectorMaxIndexesExceeded="S3VectorMaxIndexesExceeded"})(_0||(Or.StorageVectorsErrorCode=_0={}))});var ii=x(hr=>{"use strict";Object.defineProperty(hr,"__esModule",{value:!0});hr.validateVectorDimension=hr.normalizeToFloat32=hr.isPlainObject=hr.resolveResponse=hr.resolveFetch=void 0;var Sk=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);hr.resolveFetch=Sk;var xk=()=>Response;hr.resolveResponse=xk;var Ak=t=>{if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)};hr.isPlainObject=Ak;var Ok=t=>Array.from(new Float32Array(t));hr.normalizeToFloat32=Ok;var Fk=(t,e)=>{if(e!==void 0&&t.float32.length!==e)throw new Error(`Vector dimension mismatch: expected ${e}, got ${t.float32.length}`)};hr.validateVectorDimension=Fk});var Lu=x(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:!0});si.get=Ik;si.post=Tk;si.put=Rk;si.remove=Bk;var ai=(ve(),ie(we)),Bu=oi(),Pk=ii(),S0=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),kk=(t,e,r)=>ai.__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 Bu.StorageVectorsApiError(S0(a),o,s))}).catch(()=>{let a=o+"",s=i.statusText||`HTTP ${o} error`;e(new Bu.StorageVectorsApiError(s,o,a))});else{let a=o+"",s=i.statusText||`HTTP ${o} error`;e(new Bu.StorageVectorsApiError(s,o,a))}}else e(new Bu.StorageVectorsUnknownError(S0(t),t))}),$k=(t,e,r,n)=>{let o={method:t,headers:e?.headers||{}};return t==="GET"||!n?o:((0,Pk.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 Nu(t,e,r,n,o,i){return ai.__awaiter(this,void 0,void 0,function*(){return new Promise((a,s)=>{t(r,$k(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=>kk(u,s,n))})})}function Ik(t,e,r,n){return ai.__awaiter(this,void 0,void 0,function*(){return Nu(t,"GET",e,r,n)})}function Tk(t,e,r,n,o){return ai.__awaiter(this,void 0,void 0,function*(){return Nu(t,"POST",e,n,o,r)})}function Rk(t,e,r,n,o){return ai.__awaiter(this,void 0,void 0,function*(){return Nu(t,"PUT",e,n,o,r)})}function Bk(t,e,r,n,o){return ai.__awaiter(this,void 0,void 0,function*(){return Nu(t,"DELETE",e,n,o,r)})}});var Cp=x(vp=>{"use strict";Object.defineProperty(vp,"__esModule",{value:!0});var ju=(ve(),ie(we)),Nk=Ru(),Uu=oi(),Mu=Lu(),Lk=ii(),wp=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Nk.DEFAULT_HEADERS),r),this.fetch=(0,Lk.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createIndex(e){return ju.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Mu.post)(this.fetch,`${this.url}/CreateIndex`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Uu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getIndex(e,r){return ju.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Mu.post)(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:e,indexName:r},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Uu.isStorageVectorsError)(n))return{data:null,error:n};throw n}})}listIndexes(e){return ju.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Mu.post)(this.fetch,`${this.url}/ListIndexes`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Uu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteIndex(e,r){return ju.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Mu.post)(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:e,indexName:r},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Uu.isStorageVectorsError)(n))return{data:null,error:n};throw n}})}};vp.default=wp});var Sp=x(_p=>{"use strict";Object.defineProperty(_p,"__esModule",{value:!0});var Na=(ve(),ie(we)),jk=Ru(),La=oi(),ja=Lu(),Uk=ii(),Ep=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},jk.DEFAULT_HEADERS),r),this.fetch=(0,Uk.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}putVectors(e){return Na.__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,ja.post)(this.fetch,`${this.url}/PutVectors`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,La.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getVectors(e){return Na.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ja.post)(this.fetch,`${this.url}/GetVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,La.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}listVectors(e){return Na.__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,ja.post)(this.fetch,`${this.url}/ListVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,La.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}queryVectors(e){return Na.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ja.post)(this.fetch,`${this.url}/QueryVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,La.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteVectors(e){return Na.__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,ja.post)(this.fetch,`${this.url}/DeleteVectors`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,La.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}};_p.default=Ep});var Op=x(Ap=>{"use strict";Object.defineProperty(Ap,"__esModule",{value:!0});var qu=(ve(),ie(we)),Mk=Ru(),Hu=oi(),Vu=Lu(),qk=ii(),xp=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,qk.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return qu.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Vu.post)(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Hu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getBucket(e){return qu.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Vu.post)(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Hu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}listBuckets(){return qu.__awaiter(this,arguments,void 0,function*(e={}){try{return{data:yield(0,Vu.post)(this.fetch,`${this.url}/ListVectorBuckets`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Hu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return qu.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Vu.post)(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Hu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}};Ap.default=xp});var x0=x(Fn=>{"use strict";Object.defineProperty(Fn,"__esModule",{value:!0});Fn.VectorIndexScope=Fn.VectorBucketScope=Fn.StorageVectorsClient=void 0;var mr=(ve(),ie(we)),Hk=mr.__importDefault(Cp()),Vk=mr.__importDefault(Sp()),zk=mr.__importDefault(Op()),Fp=class extends zk.default{constructor(e,r={}){super(e,r.headers||{},r.fetch)}from(e){return new zu(this.url,this.headers,e,this.fetch)}};Fn.StorageVectorsClient=Fp;var zu=class extends Hk.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 mr.__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 mr.__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 mr.__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 mr.__awaiter(this,void 0,void 0,function*(){return r.deleteIndex.call(this,this.vectorBucketName,e)})}index(e){return new Ku(this.url,this.headers,this.vectorBucketName,e,this.fetch)}};Fn.VectorBucketScope=zu;var Ku=class extends Vk.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 mr.__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 mr.__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 mr.__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 mr.__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 mr.__awaiter(this,void 0,void 0,function*(){return r.deleteVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}};Fn.VectorIndexScope=Ku});var $p=x(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.validateVectorDimension=Ce.normalizeToFloat32=Ce.isPlainObject=Ce.resolveResponse=Ce.resolveFetch=Ce.isStorageVectorsError=Ce.StorageVectorsErrorCode=Ce.StorageVectorsUnknownError=Ce.StorageVectorsApiError=Ce.StorageVectorsError=Ce.VectorDataApi=Ce.VectorIndexApi=Ce.VectorBucketApi=Ce.VectorIndexScope=Ce.VectorBucketScope=Ce.StorageVectorsClient=void 0;var Pp=(ve(),ie(we)),kp=x0();Object.defineProperty(Ce,"StorageVectorsClient",{enumerable:!0,get:function(){return kp.StorageVectorsClient}});Object.defineProperty(Ce,"VectorBucketScope",{enumerable:!0,get:function(){return kp.VectorBucketScope}});Object.defineProperty(Ce,"VectorIndexScope",{enumerable:!0,get:function(){return kp.VectorIndexScope}});var Kk=Op();Object.defineProperty(Ce,"VectorBucketApi",{enumerable:!0,get:function(){return Pp.__importDefault(Kk).default}});var Gk=Cp();Object.defineProperty(Ce,"VectorIndexApi",{enumerable:!0,get:function(){return Pp.__importDefault(Gk).default}});var Wk=Sp();Object.defineProperty(Ce,"VectorDataApi",{enumerable:!0,get:function(){return Pp.__importDefault(Wk).default}});var Ua=oi();Object.defineProperty(Ce,"StorageVectorsError",{enumerable:!0,get:function(){return Ua.StorageVectorsError}});Object.defineProperty(Ce,"StorageVectorsApiError",{enumerable:!0,get:function(){return Ua.StorageVectorsApiError}});Object.defineProperty(Ce,"StorageVectorsUnknownError",{enumerable:!0,get:function(){return Ua.StorageVectorsUnknownError}});Object.defineProperty(Ce,"StorageVectorsErrorCode",{enumerable:!0,get:function(){return Ua.StorageVectorsErrorCode}});Object.defineProperty(Ce,"isStorageVectorsError",{enumerable:!0,get:function(){return Ua.isStorageVectorsError}});var Ma=ii();Object.defineProperty(Ce,"resolveFetch",{enumerable:!0,get:function(){return Ma.resolveFetch}});Object.defineProperty(Ce,"resolveResponse",{enumerable:!0,get:function(){return Ma.resolveResponse}});Object.defineProperty(Ce,"isPlainObject",{enumerable:!0,get:function(){return Ma.isPlainObject}});Object.defineProperty(Ce,"normalizeToFloat32",{enumerable:!0,get:function(){return Ma.normalizeToFloat32}});Object.defineProperty(Ce,"validateVectorDimension",{enumerable:!0,get:function(){return Ma.validateVectorDimension}})});var A0=x(Gu=>{"use strict";Object.defineProperty(Gu,"__esModule",{value:!0});Gu.StorageClient=void 0;var Tp=(ve(),ie(we)),Yk=Tp.__importDefault(C0()),Jk=Tp.__importDefault(E0()),Xk=Tp.__importDefault(yp()),Zk=$p(),Ip=class extends Jk.default{constructor(e,r={},n,o){super(e,r,n,o)}from(e){return new Yk.default(this.url,this.headers,e,this.fetch)}get vectors(){return new Zk.StorageVectorsClient(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new Xk.default(this.url+"/iceberg",this.headers,this.fetch)}};Gu.StorageClient=Ip});var F0=x(O0=>{"use strict";Object.defineProperty(O0,"__esModule",{value:!0})});var P0=x(on=>{"use strict";Object.defineProperty(on,"__esModule",{value:!0});on.StorageAnalyticsClient=on.StorageClient=void 0;var Wu=(ve(),ie(we)),Qk=A0();Object.defineProperty(on,"StorageClient",{enumerable:!0,get:function(){return Qk.StorageClient}});var e$=yp();Object.defineProperty(on,"StorageAnalyticsClient",{enumerable:!0,get:function(){return Wu.__importDefault(e$).default}});Wu.__exportStar(F0(),on);Wu.__exportStar(On(),on);Wu.__exportStar($p(),on)});var k0=x(Yu=>{"use strict";Object.defineProperty(Yu,"__esModule",{value:!0});Yu.version=void 0;Yu.version="2.84.0"});var $0=x(tr=>{"use strict";Object.defineProperty(tr,"__esModule",{value:!0});tr.DEFAULT_REALTIME_OPTIONS=tr.DEFAULT_AUTH_OPTIONS=tr.DEFAULT_DB_OPTIONS=tr.DEFAULT_GLOBAL_OPTIONS=tr.DEFAULT_HEADERS=void 0;var t$=k0(),qa="";typeof Deno<"u"?qa="deno":typeof document<"u"?qa="web":typeof navigator<"u"&&navigator.product==="ReactNative"?qa="react-native":qa="node";tr.DEFAULT_HEADERS={"X-Client-Info":`supabase-js-${qa}/${t$.version}`};tr.DEFAULT_GLOBAL_OPTIONS={headers:tr.DEFAULT_HEADERS};tr.DEFAULT_DB_OPTIONS={schema:"public"};tr.DEFAULT_AUTH_OPTIONS={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"};tr.DEFAULT_REALTIME_OPTIONS={}});var I0=x(Br=>{"use strict";Object.defineProperty(Br,"__esModule",{value:!0});Br.fetchWithAuth=Br.resolveHeadersConstructor=Br.resolveFetch=void 0;var r$=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);Br.resolveFetch=r$;var n$=()=>Headers;Br.resolveHeadersConstructor=n$;var o$=(t,e,r)=>{let n=(0,Br.resolveFetch)(r),o=(0,Br.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}))}};Br.fetchWithAuth=o$});var R0=x(Pn=>{"use strict";Object.defineProperty(Pn,"__esModule",{value:!0});Pn.isBrowser=void 0;Pn.uuid=i$;Pn.ensureTrailingSlash=T0;Pn.applySettingDefaults=s$;Pn.validateSupabaseUrl=u$;function i$(){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 T0(t){return t.endsWith("/")?t:t+"/"}var a$=()=>typeof window<"u";Pn.isBrowser=a$;function s$(t,e){var r,n;let{db:o,auth:i,realtime:a,global:s}=t,{db:u,auth:c,realtime:f,global:d}=e,p={db:Object.assign(Object.assign({},u),o),auth:Object.assign(Object.assign({},c),i),realtime:Object.assign(Object.assign({},f),a),storage:{},global:Object.assign(Object.assign(Object.assign({},d),s),{headers:Object.assign(Object.assign({},(r=d?.headers)!==null&&r!==void 0?r:{}),(n=s?.headers)!==null&&n!==void 0?n:{})}),accessToken:async()=>""};return t.accessToken?p.accessToken=t.accessToken:delete p.accessToken,p}function u$(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(T0(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}});var Gp={};en(Gp,{AuthAdminApi:()=>Bp,AuthApiError:()=>Np,AuthClient:()=>Rp,AuthError:()=>Fr,AuthImplicitGrantRedirectError:()=>qp,AuthInvalidCredentialsError:()=>Mp,AuthInvalidTokenResponseError:()=>Up,AuthPKCEGrantCodeExchangeError:()=>Hp,AuthRetryableError:()=>Lp,AuthSessionMissingError:()=>jp,AuthWeakPasswordError:()=>Vp,GoTrueAdminApi:()=>Xu,GoTrueClient:()=>Ju,NavigatorLockAcquireTimeoutError:()=>zp,isAuthApiError:()=>p$,isAuthError:()=>d$,isAuthRetryableError:()=>h$,isAuthSessionMissingError:()=>m$,isAuthWeakPasswordError:()=>g$,lockInternals:()=>f$,navigatorLock:()=>c$,processLock:()=>l$});var Kp,B0,Ju,Xu,Rp,Bp,Fr,Np,Lp,jp,Up,Mp,qp,Hp,Vp,c$,l$,zp,f$,d$,p$,h$,m$,g$,Wp=Qe(()=>{Kp=()=>Promise.resolve({data:{session:null,user:null},error:null}),B0={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}):Kp}},Ju=class{constructor(e){return this.options=e,new Proxy(this,B0)}},Xu=class{constructor(e){return this.options=e,new Proxy(this,B0)}},Rp=class extends Ju{},Bp=class extends Xu{},Fr=class extends Error{},Np=class extends Fr{},Lp=class extends Fr{},jp=class extends Fr{},Up=class extends Fr{},Mp=class extends Fr{},qp=class extends Fr{},Hp=class extends Fr{},Vp=class extends Fr{},c$=Kp,l$=Kp,zp=class extends Error{},f$={},d$=()=>!1,p$=()=>!1,h$=()=>!1,m$=()=>!1,g$=()=>!1});var N0=x(Zu=>{"use strict";Object.defineProperty(Zu,"__esModule",{value:!0});Zu.SupabaseAuthClient=void 0;var y$=(Wp(),ie(Gp)),Yp=class extends y$.AuthClient{constructor(e){super(e)}};Zu.SupabaseAuthClient=Yp});var Zp=x(Xp=>{"use strict";Object.defineProperty(Xp,"__esModule",{value:!0});var D$=kd(),b$=Wd(),w$=(Xd(),ie(Jd)),v$=P0(),Qu=$0(),C$=I0(),L0=R0(),E$=N0(),Jp=class{constructor(e,r,n){var o,i,a;this.supabaseUrl=e,this.supabaseKey=r;let s=(0,L0.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:Qu.DEFAULT_DB_OPTIONS,realtime:Qu.DEFAULT_REALTIME_OPTIONS,auth:Object.assign(Object.assign({},Qu.DEFAULT_AUTH_OPTIONS),{storageKey:u}),global:Qu.DEFAULT_GLOBAL_OPTIONS},f=(0,L0.applySettingDefaults)(n??{},c);this.storageKey=(o=f.auth.storageKey)!==null&&o!==void 0?o:"",this.headers=(i=f.global.headers)!==null&&i!==void 0?i:{},f.accessToken?(this.accessToken=f.accessToken,this.auth=new Proxy({},{get:(d,p)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(p)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((a=f.auth)!==null&&a!==void 0?a:{},this.headers,f.global.fetch),this.fetch=(0,C$.fetchWithAuth)(r,this._getAccessToken.bind(this),f.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},f.realtime)),this.accessToken&&this.accessToken().then(d=>this.realtime.setAuth(d)).catch(d=>console.warn("Failed to set initial Realtime auth token:",d)),this.rest=new b$.PostgrestClient(new URL("rest/v1",s).href,{headers:this.headers,schema:f.db.schema,fetch:this.fetch}),this.storage=new v$.StorageClient(this.storageUrl.href,this.headers,this.fetch,n?.storage),f.accessToken||this._listenForAuthEvents()}get functions(){return new D$.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:f},d,p){let h={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new E$.SupabaseAuthClient({url:this.authUrl.href,headers:Object.assign(Object.assign({},h),d),storageKey:a,autoRefreshToken:e,persistSession:r,detectSessionInUrl:n,storage:o,userStorage:i,flowType:s,lock:u,debug:c,throwOnError:f,fetch:p,hasCustomAuthorizationHeader:Object.keys(this.headers).some(m=>m.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new w$.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)}};Xp.default=Jp});var M0=x(Re=>{"use strict";var _$=Re&&Re.__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]})),j0=Re&&Re.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&_$(e,t,r)},U0=Re&&Re.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Re,"__esModule",{value:!0});Re.createClient=Re.SupabaseClient=Re.FunctionRegion=Re.FunctionsError=Re.FunctionsRelayError=Re.FunctionsFetchError=Re.FunctionsHttpError=Re.PostgrestError=void 0;var S$=U0(Zp());j0((Wp(),ie(Gp)),Re);var x$=Wd();Object.defineProperty(Re,"PostgrestError",{enumerable:!0,get:function(){return x$.PostgrestError}});var Ha=kd();Object.defineProperty(Re,"FunctionsHttpError",{enumerable:!0,get:function(){return Ha.FunctionsHttpError}});Object.defineProperty(Re,"FunctionsFetchError",{enumerable:!0,get:function(){return Ha.FunctionsFetchError}});Object.defineProperty(Re,"FunctionsRelayError",{enumerable:!0,get:function(){return Ha.FunctionsRelayError}});Object.defineProperty(Re,"FunctionsError",{enumerable:!0,get:function(){return Ha.FunctionsError}});Object.defineProperty(Re,"FunctionRegion",{enumerable:!0,get:function(){return Ha.FunctionRegion}});j0((Xd(),ie(Jd)),Re);var A$=Zp();Object.defineProperty(Re,"SupabaseClient",{enumerable:!0,get:function(){return U0(A$).default}});var O$=(t,e,r)=>new S$.default(t,e,r);Re.createClient=O$;function F$(){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}F$()&&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 Qp=x((Iz,q0)=>{q0.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 ec=x(V0=>{var H0={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 P$(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(H0))V0[t]=P$(H0[t])});var Y0=x((Rz,W0)=>{var k$=require("fs"),it=require("path"),z0=Qp(),$$=ec(),I$=typeof process=="object"&&process.platform==="win32",K0=t=>typeof t=="object"&&t!==null,G0=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 Ye(t){this.sep=it.sep,this.fs=k$,K0(t)&&K0(t.fs)&&typeof t.fs.statSync=="function"&&(this.fs=t.fs)}W0.exports=Ye;Ye.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 $$.FILE_IN_THE_WAY(`"${o}"`)}})}r(t)};Ye.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=it.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};Ye.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=it.dirname(t);i.fs.exists(c,function(f){f||i.makeDir(c),i.fs.open(t,"w",438,function(d,p){d?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)})})})})}):p?i.fs.write(p,e,0,e.length,0,function(){i.fs.close(p,function(){i.fs.chmod(t,n||438,function(){o(!0)})})}):i.fs.chmod(t,n||438,function(){o(!0)})})})})})};Ye.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=it.join(n,s),c=e.fs.statSync(u);(!o||o.test(u))&&a.push(it.normalize(u)+(c.isDirectory()?e.sep:"")),c.isDirectory()&&i&&(a=a.concat(r(u,o,i)))}),a}return r(t,void 0,!0)};Ye.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=it.join(t,s),r.fs.stat(s,function(u,c){if(u)return e(u);c&&(n.push(it.normalize(s)+(c.isDirectory()?r.sep:"")),c.isDirectory()?r.findFilesAsync(s,function(f,d){if(f)return e(f);n=n.concat(d),--a||e(null,n)}):--a||e(null,n))})})})};Ye.prototype.getAttributes=function(){};Ye.prototype.setAttributes=function(){};Ye.crc32update=function(t,e){return G0[(t^e)&255]^t>>>8};Ye.crc32=function(t){typeof t=="string"&&(t=Buffer.from(t,"utf8"));let e=t.length,r=-1;for(let n=0;n<e;)r=Ye.crc32update(r,t[n++]);return~r>>>0};Ye.methodToString=function(t){switch(t){case z0.STORED:return"STORED ("+t+")";case z0.DEFLATED:return"DEFLATED ("+t+")";default:return"UNSUPPORTED ("+t+")"}};Ye.canonical=function(t){if(!t)return"";let e=it.posix.normalize("/"+t.split("\\").join("/"));return it.join(".",e)};Ye.zipnamefix=function(t){if(!t)return"";let e=it.posix.normalize("/"+t.split("\\").join("/"));return it.posix.join(".",e)};Ye.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]};Ye.sanitize=function(t,e){t=it.resolve(it.normalize(t));for(var r=e.split("/"),n=0,o=r.length;n<o;n++){var i=it.normalize(it.join(t,r.slice(n,o).join(it.sep)));if(i.indexOf(t)===0)return i}return it.normalize(it.join(t,it.basename(e)))};Ye.toBuffer=function(e,r){return Buffer.isBuffer(e)?e:e instanceof Uint8Array?Buffer.from(e):typeof e=="string"?r(e):Buffer.alloc(0)};Ye.readBigUInt64LE=function(t,e){var r=Buffer.from(t.slice(e,e+8));return r.swap64(),parseInt(`0x${r.toString("hex")}`)};Ye.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)};Ye.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};Ye.isWin=I$;Ye.crcTable=G0});var X0=x((Bz,J0)=>{var T$=require("path");J0.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=T$.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 Q0=x((Nz,Z0)=>{Z0.exports={efs:!0,encode:t=>Buffer.from(t,"utf8"),decode:t=>t.toString("utf8")}});var ci=x((Lz,ui)=>{ui.exports=Y0();ui.exports.Constants=Qp();ui.exports.Errors=ec();ui.exports.FileAttr=X0();ui.exports.decoder=Q0()});var tb=x((jz,eb)=>{var kn=ci(),Y=kn.Constants;eb.exports=function(){var t=20,e=10,r=0,n=0,o=0,i=0,a=0,s=0,u=0,c=0,f=0,d=0,p=0,h=0,m=0;t|=kn.isWin?2560:768,r|=Y.FLG_EFS;let y={extraLen:0},D=g=>Math.max(0,g)>>>0,v=g=>Math.max(0,g)&65535,E=g=>Math.max(0,g)&255;return o=kn.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&Y.FLG_EFS)>0},set flags_efs(g){g?r|=Y.FLG_EFS:r&=~Y.FLG_EFS},get flags_desc(){return(r&Y.FLG_DESC)>0},set flags_desc(g){g?r|=Y.FLG_DESC:r&=~Y.FLG_DESC},get method(){return n},set method(g){switch(g){case Y.STORED:this.version=10;case Y.DEFLATED:default:this.version=20}n=g},get time(){return kn.fromDOS2Date(this.timeval)},set time(g){this.timeval=kn.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 y.extraLen},set extraLocalLength(g){y.extraLen=g},get commentLength(){return f},set commentLength(g){f=g},get diskNumStart(){return d},set diskNumStart(g){d=D(g)},get inAttr(){return p},set inAttr(g){p=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&Y.FLG_ENC)===Y.FLG_ENC},get centralHeaderSize(){return Y.CENHDR+u+c+f},get realDataOffset(){return m+Y.LOCHDR+y.fnameLen+y.extraLen},get localHeader(){return y},loadLocalHeaderFromBinary:function(g){var _=g.slice(m,m+Y.LOCHDR);if(_.readUInt32LE(0)!==Y.LOCSIG)throw kn.Errors.INVALID_LOC();y.version=_.readUInt16LE(Y.LOCVER),y.flags=_.readUInt16LE(Y.LOCFLG),y.method=_.readUInt16LE(Y.LOCHOW),y.time=_.readUInt32LE(Y.LOCTIM),y.crc=_.readUInt32LE(Y.LOCCRC),y.compressedSize=_.readUInt32LE(Y.LOCSIZ),y.size=_.readUInt32LE(Y.LOCLEN),y.fnameLen=_.readUInt16LE(Y.LOCNAM),y.extraLen=_.readUInt16LE(Y.LOCEXT);let S=m+Y.LOCHDR+y.fnameLen,k=S+y.extraLen;return g.slice(S,k)},loadFromBinary:function(g){if(g.length!==Y.CENHDR||g.readUInt32LE(0)!==Y.CENSIG)throw kn.Errors.INVALID_CEN();t=g.readUInt16LE(Y.CENVEM),e=g.readUInt16LE(Y.CENVER),r=g.readUInt16LE(Y.CENFLG),n=g.readUInt16LE(Y.CENHOW),o=g.readUInt32LE(Y.CENTIM),i=g.readUInt32LE(Y.CENCRC),a=g.readUInt32LE(Y.CENSIZ),s=g.readUInt32LE(Y.CENLEN),u=g.readUInt16LE(Y.CENNAM),c=g.readUInt16LE(Y.CENEXT),f=g.readUInt16LE(Y.CENCOM),d=g.readUInt16LE(Y.CENDSK),p=g.readUInt16LE(Y.CENATT),h=g.readUInt32LE(Y.CENATX),m=g.readUInt32LE(Y.CENOFF)},localHeaderToBinary:function(){var g=Buffer.alloc(Y.LOCHDR);return g.writeUInt32LE(Y.LOCSIG,0),g.writeUInt16LE(e,Y.LOCVER),g.writeUInt16LE(r,Y.LOCFLG),g.writeUInt16LE(n,Y.LOCHOW),g.writeUInt32LE(o,Y.LOCTIM),g.writeUInt32LE(i,Y.LOCCRC),g.writeUInt32LE(a,Y.LOCSIZ),g.writeUInt32LE(s,Y.LOCLEN),g.writeUInt16LE(u,Y.LOCNAM),g.writeUInt16LE(y.extraLen,Y.LOCEXT),g},centralHeaderToBinary:function(){var g=Buffer.alloc(Y.CENHDR+u+c+f);return g.writeUInt32LE(Y.CENSIG,0),g.writeUInt16LE(t,Y.CENVEM),g.writeUInt16LE(e,Y.CENVER),g.writeUInt16LE(r,Y.CENFLG),g.writeUInt16LE(n,Y.CENHOW),g.writeUInt32LE(o,Y.CENTIM),g.writeUInt32LE(i,Y.CENCRC),g.writeUInt32LE(a,Y.CENSIZ),g.writeUInt32LE(s,Y.CENLEN),g.writeUInt16LE(u,Y.CENNAM),g.writeUInt16LE(c,Y.CENEXT),g.writeUInt16LE(f,Y.CENCOM),g.writeUInt16LE(d,Y.CENDSK),g.writeUInt16LE(p,Y.CENATT),g.writeUInt32LE(h,Y.CENATX),g.writeUInt32LE(m,Y.CENOFF),g},toJSON:function(){let g=function(_){return _+" bytes"};return{made:t,version:e,flags:r,method:kn.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(f),diskNumStart:d,inAttr:p,attr:h,offset:m,centralHeaderSize:g(Y.CENHDR+u+c+f)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var nb=x((Uz,rb)=>{var li=ci(),ze=li.Constants;rb.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 ze.ENDHDR+o},loadFromBinary:function(i){if((i.length!==ze.ENDHDR||i.readUInt32LE(0)!==ze.ENDSIG)&&(i.length<ze.ZIP64HDR||i.readUInt32LE(0)!==ze.ZIP64SIG))throw li.Errors.INVALID_END();i.readUInt32LE(0)===ze.ENDSIG?(t=i.readUInt16LE(ze.ENDSUB),e=i.readUInt16LE(ze.ENDTOT),r=i.readUInt32LE(ze.ENDSIZ),n=i.readUInt32LE(ze.ENDOFF),o=i.readUInt16LE(ze.ENDCOM)):(t=li.readBigUInt64LE(i,ze.ZIP64SUB),e=li.readBigUInt64LE(i,ze.ZIP64TOT),r=li.readBigUInt64LE(i,ze.ZIP64SIZE),n=li.readBigUInt64LE(i,ze.ZIP64OFF),o=0)},toBinary:function(){var i=Buffer.alloc(ze.ENDHDR+o);return i.writeUInt32LE(ze.ENDSIG,0),i.writeUInt32LE(0,4),i.writeUInt16LE(t,ze.ENDSUB),i.writeUInt16LE(e,ze.ENDTOT),i.writeUInt32LE(r,ze.ENDSIZ),i.writeUInt32LE(n,ze.ENDOFF),i.writeUInt16LE(o,ze.ENDCOM),i.fill(" ",ze.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 th=x(eh=>{eh.EntryHeader=tb();eh.MainHeader=nb()});var ib=x((qz,ob)=>{ob.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 f=i[c];f.copy(s,u),u+=f.length}n&&n(s)}),o.end(t)}}}});var sb=x((Hz,ab)=>{var R$=+(process.versions?process.versions.node:"").split(".")[0]||0;ab.exports=function(t,e){var r=require("zlib");let n=R$>=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 f=0;f<a.length;f++){var d=a[f];d.copy(u,c),c+=d.length}o&&o(u)}),i.end(t)}}}});var db=x((Vz,fb)=>{"use strict";var{randomFillSync:ub}=require("crypto"),B$=ec(),N$=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}),lb=(t,e)=>Math.imul(t,e)>>>0,cb=(t,e)=>N$[(t^e)&255]^t>>>8,Va=()=>typeof ub=="function"?ub(Buffer.alloc(12)):Va.node();Va.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 tc={genSalt:Va};function rc(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])}rc.prototype.updateKeys=function(t){let e=this.keys;return e[0]=cb(e[0],t),e[1]+=e[0]&255,e[1]=lb(e[1],134775813)+1,e[2]=cb(e[2],e[1]>>>24),t};rc.prototype.next=function(){let t=(this.keys[2]|2)>>>0;return lb(t,t^1)>>8&255};function L$(t){let e=new rc(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 j$(t){let e=new rc(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 U$(t,e,r){if(!t||!Buffer.isBuffer(t)||t.length<12)return Buffer.alloc(0);let n=L$(r),o=n(t.slice(0,12)),i=(e.flags&8)===8?e.timeHighByte:e.crc>>>24;if(o[11]!==i)throw B$.WRONG_PASSWORD();return n(t.slice(12))}function M$(t){Buffer.isBuffer(t)&&t.length>=12?tc.genSalt=function(){return t.slice(0,12)}:t==="node"?tc.genSalt=Va.node:tc.genSalt=Va}function q$(t,e,r,n=!1){t==null&&(t=Buffer.alloc(0)),Buffer.isBuffer(t)||(t=Buffer.from(t.toString()));let o=j$(r),i=tc.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)}fb.exports={decrypt:U$,encrypt:q$,_salter:M$}});var pb=x(nc=>{nc.Deflater=ib();nc.Inflater=sb();nc.ZipCrypto=db()});var nh=x((Kz,hb)=>{var Fe=ci(),H$=th(),Je=Fe.Constants,rh=pb();hb.exports=function(t,e){var r=new H$.EntryHeader,n=Buffer.alloc(0),o=Buffer.alloc(0),i=!1,a=null,s=Buffer.alloc(0),u=Buffer.alloc(0),c=!0;let f=t,d=typeof f.decoder=="object"?f.decoder:Fe.decoder;c=d.hasOwnProperty("efs")?d.efs:!1;function p(){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)==Je.LOCSIG||e.readUInt32LE(S)==Je.CENSIG)throw Fe.Errors.DESCRIPTOR_NOT_EXIST();if(e.readUInt32LE(S)==Je.EXTSIG)_.crc=e.readUInt32LE(S+Je.EXTCRC),_.compressedSize=e.readUInt32LE(S+Je.EXTSIZ),_.size=e.readUInt32LE(S+Je.EXTLEN);else if(e.readUInt16LE(S+12)===19280)_.crc=e.readUInt32LE(S+Je.EXTCRC-4),_.compressedSize=e.readUInt32LE(S+Je.EXTSIZ-4),_.size=e.readUInt32LE(S+Je.EXTLEN-4);else throw Fe.Errors.DESCRIPTOR_UNKNOWN();if(_.compressedSize!==r.compressedSize||_.size!==r.size||_.crc!==r.crc)throw Fe.Errors.DESCRIPTOR_FAULTY();if(Fe.crc32(g)!==_.crc)return!1}else if(Fe.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),Fe.Errors.DIRECTORY_CONTENT_ERROR()),Buffer.alloc(0);var k=p();if(k.length===0)return g&&_&&_(k),k;if(r.encrypted){if(typeof S!="string"&&!Buffer.isBuffer(S))throw Fe.Errors.INVALID_PASS_PARAM();k=rh.ZipCrypto.decrypt(k,r,S)}var F=Buffer.alloc(r.size);switch(r.method){case Fe.Constants.STORED:if(k.copy(F),h(F))return g&&_&&_(F),F;throw g&&_&&_(F,Fe.Errors.BAD_CRC()),Fe.Errors.BAD_CRC();case Fe.Constants.DEFLATED:var B=new rh.Inflater(k,r.size);if(g)B.inflateAsync(function(T){T.copy(T,0),_&&(h(T)?_(T):_(T,Fe.Errors.BAD_CRC()))});else{if(B.inflate(F).copy(F,0),!h(F))throw Fe.Errors.BAD_CRC(`"${d.decode(n)}"`);return F}break;default:throw g&&_&&_(Buffer.alloc(0),Fe.Errors.UNKNOWN_METHOD()),Fe.Errors.UNKNOWN_METHOD()}}function y(g,_){if((!a||!a.length)&&Buffer.isBuffer(e))return g&&_&&_(p()),p();if(a.length&&!i){var S;switch(r.method){case Fe.Constants.STORED:return r.compressedSize=r.size,S=Buffer.alloc(a.length),a.copy(S),g&&_&&_(S),S;default:case Fe.Constants.DEFLATED:var k=new rh.Deflater(a);if(g)k.deflateAsync(function(B){S=Buffer.alloc(B.length),r.compressedSize=B.length,B.copy(S),_&&_(S)});else{var F=k.deflate();return r.compressedSize=F.length,F}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 v(g){try{for(var _=0,S,k,F;_+4<g.length;)S=g.readUInt16LE(_),_+=2,k=g.readUInt16LE(_),_+=2,F=g.slice(_,_+k),_+=k,Je.ID_ZIP64===S&&E(F)}catch{throw Fe.Errors.EXTRA_FIELD_PARSE_ERROR()}}function E(g){var _,S,k,F;g.length>=Je.EF_ZIP64_SCOMP&&(_=D(g,Je.EF_ZIP64_SUNCOMP),r.size===Je.EF_ZIP64_OR_32&&(r.size=_)),g.length>=Je.EF_ZIP64_RHO&&(S=D(g,Je.EF_ZIP64_SCOMP),r.compressedSize===Je.EF_ZIP64_OR_32&&(r.compressedSize=S)),g.length>=Je.EF_ZIP64_DSN&&(k=D(g,Je.EF_ZIP64_RHO),r.offset===Je.EF_ZIP64_OR_32&&(r.offset=k)),g.length>=Je.EF_ZIP64_DSN+4&&(F=g.readUInt32LE(Je.EF_ZIP64_DSN),r.diskNumStart===Je.EF_ZIP64_OR_16&&(r.diskNumStart=F))}return{get entryName(){return d.decode(n)},get rawEntryName(){return n},set entryName(g){n=Fe.toBuffer(g,d.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,v(g)},get comment(){return d.decode(o)},set comment(g){if(o=Fe.toBuffer(g,d.encode),r.commentLength=o.length,o.length>65535)throw Fe.Errors.COMMENT_TOO_LONG()},get name(){var g=d.decode(n);return i?g.substr(g.length-1).split("/").pop():g.split("/").pop()},get isDirectory(){return i},getCompressedData:function(){return y(!1,null)},getCompressedDataAsync:function(g){y(!0,g)},setData:function(g){a=Fe.toBuffer(g,Fe.decoder.encode),!i&&a.length?(r.size=a.length,r.method=Fe.Constants.DEFLATED,r.crc=Fe.crc32(g),r.changed=!0):r.method=Fe.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(),_=Fe.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 yb=x((Gz,gb)=>{var mb=nh(),V$=th(),yt=ci();gb.exports=function(t,e){var r=[],n={},o=Buffer.alloc(0),i=new V$.MainHeader,a=!1,s=null;let u=new Set,c=e,{noSort:f,decoder:d}=c;t?m(c.readEntries):a=!0;function p(){let D=new Set;for(let v of Object.keys(n)){let E=v.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 v of D)if(!(v in n)){let E=new mb(c);E.entryName=v,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)/yt.Constants.CENHDR)throw yt.Errors.DISK_ENTRY_TOO_LARGE();r=new Array(i.diskEntries);for(var D=i.offset,v=0;v<r.length;v++){var E=D,g=new mb(c,t);g.header=t.slice(E,E+=yt.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[v]=g,n[g.entryName]=g}u.clear(),p()}function m(D){var v=t.length-yt.Constants.ENDHDR,E=Math.max(0,v-65535),g=E,_=t.length,S=-1,k=0;for(typeof c.trailingSpace=="boolean"&&c.trailingSpace&&(E=0),v;v>=g;v--)if(t[v]===80){if(t.readUInt32LE(v)===yt.Constants.ENDSIG){S=v,k=v,_=v+yt.Constants.ENDHDR,g=v-yt.Constants.END64HDR;continue}if(t.readUInt32LE(v)===yt.Constants.END64SIG){g=E;continue}if(t.readUInt32LE(v)===yt.Constants.ZIP64SIG){S=v,_=v+yt.readBigUInt64LE(t,v+yt.Constants.ZIP64SIZE)+yt.Constants.ZIP64LEAD;break}}if(S==-1)throw yt.Errors.INVALID_FORMAT();i.loadFromBinary(t.slice(S,_)),i.commentLength&&(o=t.slice(k+yt.Constants.ENDHDR)),D&&h()}function y(){r.length>1&&!f&&r.sort((D,v)=>D.entryName.toLowerCase().localeCompare(v.entryName.toLowerCase()))}return{get entries(){return a||h(),r.filter(D=>!u.has(D))},get comment(){return d.decode(o)},set comment(D){o=yt.toBuffer(D,d.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,v=!0){a||h();let E=n[D];this.getEntryChildren(E,v).map(_=>_.entryName).forEach(this.deleteEntry)},deleteEntry:function(D){a||h();let v=n[D],E=r.indexOf(v);E>=0&&(r.splice(E,1),delete n[D],i.totalEntries=r.length)},getEntryChildren:function(D,v=!0){if(a||h(),typeof D=="object")if(D.isDirectory&&v){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 v=this.getEntryChildren(D);return v.includes(D)?v.length-1:v.length}return 0},compressToBuffer:function(){a||h(),y();let D=[],v=[],E=0,g=0;i.size=0,i.offset=0;let _=0;for(let F of this.entries){let B=F.getCompressedData();F.header.offset=g;let T=F.packLocalHeader(),j=T.length+B.length;g+=j,D.push(T),D.push(B);let A=F.packCentralHeader();v.push(A),i.size+=A.length,E+=j+A.length,_++}E+=i.mainHeaderSize,i.offset=g,i.totalEntries=_,g=0;let S=Buffer.alloc(E);for(let F of D)F.copy(S,g),g+=F.length;for(let F of v)F.copy(S,g),g+=F.length;let k=i.toBinary();return o&&o.copy(k,yt.Constants.ENDHDR),k.copy(S,g),t=S,a=!1,S},toAsyncBuffer:function(D,v,E,g){try{a||h(),y();let _=[],S=[],k=0,F=0,B=0;i.size=0,i.offset=0;let T=function(j){if(j.length>0){let A=j.shift(),M=A.entryName+A.extra.toString();E&&E(M),A.getCompressedDataAsync(function(L){g&&g(M),A.header.offset=F;let X=A.packLocalHeader(),P=X.length+L.length;F+=P,_.push(X),_.push(L);let b=A.packCentralHeader();S.push(b),i.size+=b.length,k+=P+b.length,B++,T(j)})}else{k+=i.mainHeaderSize,i.offset=F,i.totalEntries=B,F=0;let A=Buffer.alloc(k);_.forEach(function(L){L.copy(A,F),F+=L.length}),S.forEach(function(L){L.copy(A,F),F+=L.length});let M=i.toBinary();o&&o.copy(M,yt.Constants.ENDHDR),M.copy(A,F),t=A,a=!1,D(A)}};T(Array.from(this.entries))}catch(_){v(_)}}}}});var oh=x((Wz,bb)=>{var Ke=ci(),Xe=require("path"),z$=nh(),K$=yb(),Qn=(...t)=>Ke.findLast(t,e=>typeof e=="boolean"),Db=(...t)=>Ke.findLast(t,e=>typeof e=="string"),G$=(...t)=>Ke.findLast(t,e=>typeof e=="function"),W$={noSort:!1,readEntries:!1,method:Ke.Constants.NONE,fs:null};bb.exports=function(t,e){let r=null,n=Object.assign(Object.create(null),W$);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=Ke.Constants.BUFFER,t=void 0)),Object.assign(n,e);let o=new Ke(n);if((typeof n.decoder!="object"||typeof n.decoder.encode!="function"||typeof n.decoder.decode!="function")&&(n.decoder=Ke.decoder),t&&typeof t=="string")if(o.fs.existsSync(t))n.method=Ke.Constants.FILE,n.filename=t,r=o.fs.readFileSync(t);else throw Ke.Errors.INVALID_FILENAME();let i=new K$(r,n),{canonical:a,sanitize:s,zipnamefix:u}=Ke;function c(h){if(h&&i){var m;if(typeof h=="string"&&(m=i.getEntry(Xe.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 f(h){let{join:m,normalize:y,sep:D}=Xe.posix;return m(".",y(D+h.split("\\").join(D)+D))}function d(h){return h instanceof RegExp?(function(m){return function(y){return m.test(y)}})(h):typeof h!="function"?()=>!0:h}let p=(h,m)=>{let y=m.slice(-1);return y=y===o.sep?o.sep:"",Xe.relative(h,m)+y};return{readFile:function(h,m){var y=c(h);return y&&y.getData(m)||null},childCount:function(h){let m=c(h);if(m)return i.getChildCount(m)},readFileAsync:function(h,m){var y=c(h);y?y.getDataAsync(m):m(null,"getEntry failed for:"+h)},readAsText:function(h,m){var y=c(h);if(y){var D=y.getData();if(D&&D.length)return D.toString(m||"utf8")}return""},readAsTextAsync:function(h,m,y){var D=c(h);D?D.getDataAsync(function(v,E){if(E){m(v,E);return}v&&v.length?m(v.toString(y||"utf8")):m("")}):m("")},deleteFile:function(h,m=!0){var y=c(h);y&&i.deleteFile(y.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 y=c(h);y&&(y.comment=m)},getZipEntryComment:function(h){var m=c(h);return m&&m.comment||""},updateFile:function(h,m){var y=c(h);y&&y.setData(m)},addLocalFile:function(h,m,y,D){if(o.fs.existsSync(h)){m=m?f(m):"";let v=Xe.win32.basename(Xe.win32.normalize(h));m+=y||v;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 Ke.Errors.FILE_NOT_FOUND(h)},addLocalFileAsync:function(h,m){h=typeof h=="object"?h:{localPath:h};let y=Xe.resolve(h.localPath),{comment:D}=h,{zipPath:v,zipName:E}=h,g=this;o.fs.stat(y,function(_,S){if(_)return m(_,!1);v=v?f(v):"";let k=Xe.win32.basename(Xe.win32.normalize(y));if(v+=E||k,S.isFile())o.fs.readFile(y,function(F,B){return F?m(F,!1):(g.addFile(v,B,D,S),setImmediate(m,void 0,!0))});else if(S.isDirectory())return v+=o.sep,g.addFile(v,Buffer.alloc(0),D,S),setImmediate(m,void 0,!0)})},addLocalFolder:function(h,m,y){if(y=d(y),m=m?f(m):"",h=Xe.normalize(h),o.fs.existsSync(h)){let D=o.findFiles(h),v=this;if(D.length)for(let E of D){let g=Xe.join(m,p(h,E));y(g)&&v.addLocalFile(E,Xe.dirname(g))}}else throw Ke.Errors.FILE_NOT_FOUND(h)},addLocalFolderAsync:function(h,m,y,D){D=d(D),y=y?f(y):"",h=Xe.normalize(h);var v=this;o.fs.open(h,"r",function(E){if(E&&E.code==="ENOENT")m(void 0,Ke.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 k=g[_],F=p(h,k).split("\\").join("/");F=F.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),D(F)?o.fs.stat(k,function(B,T){B&&m(void 0,B),T.isFile()?o.fs.readFile(k,function(j,A){j?m(void 0,j):(v.addFile(y+F,A,"",T),S())}):(v.addFile(y+F+"/",Buffer.alloc(0),"",T),S())}):process.nextTick(()=>{S()})}else m(!0,void 0)};S()}})},addLocalFolderAsync2:function(h,m){let y=this;h=typeof h=="object"?h:{localPath:h},localPath=Xe.resolve(f(h.localPath));let{zipPath:D,filter:v,namefix:E}=h;v instanceof RegExp?v=(function(S){return function(k){return S.test(k)}})(v):typeof v!="function"&&(v=function(){return!0}),D=D?f(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=>Xe.join(D,E(p(localPath,S))),_=S=>Xe.win32.basename(Xe.win32.normalize(E(S)));o.fs.open(localPath,"r",function(S){S&&S.code==="ENOENT"?m(void 0,Ke.Errors.FILE_NOT_FOUND(localPath)):S?m(void 0,S):o.findFilesAsync(localPath,function(k,F){if(k)return m(k);F=F.filter(B=>v(g(B))),F.length||m(void 0,!1),setImmediate(F.reverse().reduce(function(B,T){return function(j,A){if(j||A===!1)return setImmediate(B,j,!1);y.addLocalFileAsync({localPath:T,zipPath:Xe.dirname(g(T)),zipName:_(T)},B)}},m))})})},addLocalFolderPromise:function(h,m){return new Promise((y,D)=>{this.addLocalFolderAsync2(Object.assign({localPath:h},m),(v,E)=>{v&&D(v),E&&y(this)})})},addFile:function(h,m,y,D){h=u(h);let v=c(h),E=v!=null;E||(v=new z$(n),v.entryName=h),v.comment=y||"";let g=typeof D=="object"&&D instanceof o.fs.Stats;g&&(v.header.time=D.mtime);var _=v.isDirectory?16:0;let S=v.isDirectory?16384:32768;return g?S|=4095&D.mode:typeof D=="number"?S|=4095&D:S|=v.isDirectory?493:420,_=(_|S<<16)>>>0,v.attr=_,v.setData(m),E||i.setEntry(v),v},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,y,D,v,E){D=Qn(!1,D),v=Qn(!1,v),y=Qn(!0,y),E=Db(v,E);var g=c(h);if(!g)throw Ke.Errors.NO_ENTRY();var _=a(g.entryName),S=s(m,E&&!g.isDirectory?E:y?_:Xe.basename(_));if(g.isDirectory){var k=i.getEntryChildren(g);return k.forEach(function(T){if(T.isDirectory)return;var j=T.getData();if(!j)throw Ke.Errors.CANT_EXTRACT_FILE();var A=a(T.entryName),M=s(m,y?A:Xe.basename(A));let L=v?T.header.fileAttr:void 0;o.writeFileTo(M,j,D,L)}),!0}var F=g.getData(i.password);if(!F)throw Ke.Errors.CANT_EXTRACT_FILE();if(o.fs.existsSync(S)&&!D)throw Ke.Errors.CANT_OVERRIDE();let B=v?h.header.fileAttr:void 0;return o.writeFileTo(S,F,D,B),!0},test:function(h){if(!i)return!1;for(var m in i.entries)try{if(m.isDirectory)continue;var y=i.entries[m].getData(h);if(!y)return!1}catch{return!1}return!0},extractAllTo:function(h,m,y,D){if(y=Qn(!1,y),D=Db(y,D),m=Qn(!1,m),!i)throw Ke.Errors.NO_ZIP();i.entries.forEach(function(v){var E=s(h,a(v.entryName));if(v.isDirectory){o.makeDir(E);return}var g=v.getData(D);if(!g)throw Ke.Errors.CANT_EXTRACT_FILE();let _=y?v.header.fileAttr:void 0;o.writeFileTo(E,g,m,_);try{o.fs.utimesSync(E,v.header.time,v.header.time)}catch{throw Ke.Errors.CANT_EXTRACT_FILE()}})},extractAllToAsync:function(h,m,y,D){if(D=G$(m,y,D),y=Qn(!1,y),m=Qn(!1,m),!D)return new Promise((S,k)=>{this.extractAllToAsync(h,m,y,function(F){F?k(F):S(this)})});if(!i){D(Ke.Errors.NO_ZIP());return}h=Xe.resolve(h);let v=S=>s(h,Xe.normalize(a(S.entryName))),E=(S,k)=>new Error(S+': "'+k+'"'),g=[],_=[];i.entries.forEach(S=>{S.isDirectory?g.push(S):_.push(S)});for(let S of g){let k=v(S),F=y?S.header.fileAttr:void 0;try{o.makeDir(k),F&&o.fs.chmodSync(k,F),o.fs.utimesSync(k,S.header.time,S.header.time)}catch{D(E("Unable to create folder",k))}}_.reverse().reduce(function(S,k){return function(F){if(F)S(F);else{let B=Xe.normalize(a(k.entryName)),T=s(h,B);k.getDataAsync(function(j,A){if(A)S(A);else if(!j)S(Ke.Errors.CANT_EXTRACT_FILE());else{let M=y?k.header.fileAttr:void 0;o.writeFileToAsync(T,j,m,M,function(L){L||S(E("Unable to write file",T)),o.fs.utimes(T,k.header.time,k.header.time,function(X){X?S(E("Unable to set times",T)):S()})})}})}}},D)()},writeZip:function(h,m){if(arguments.length===1&&typeof h=="function"&&(m=h,h=""),!h&&n.filename&&(h=n.filename),!!h){var y=i.compressToBuffer();if(y){var D=o.writeFileTo(h,y,!0);typeof m=="function"&&m(D?null:new Error("failed"),"")}}},writeZipPromise:function(h,m){let{overwrite:y,perm:D}=Object.assign({overwrite:!0},m);return new Promise((v,E)=>{!h&&n.filename&&(h=n.filename),h||E("ADM-ZIP: ZIP File Name Missing"),this.toBufferPromise().then(g=>{let _=S=>S?v(S):E("ADM-ZIP: Wasn't able to write zip file");o.writeFileToAsync(h,g,y,D,_)},E)})},toBufferPromise:function(){return new Promise((h,m)=>{i.toAsyncBuffer(h,m)})},toBuffer:function(h,m,y,D){return typeof h=="function"?(i.toAsyncBuffer(h,m,y,D),null):i.compressToBuffer()}}}});var Eb=x((Yz,Cb)=>{var vb={};Cb.exports=vb;var wb={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(wb).forEach(function(t){var e=wb[t],r=vb[t]=[];r.open="\x1B["+e[0]+"m",r.close="\x1B["+e[1]+"m"})});var Sb=x((Jz,_b)=>{"use strict";_b.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 Ab=x((Xz,xb)=>{"use strict";var Y$=require("os"),Pr=Sb(),Tt=process.env,fi=void 0;Pr("no-color")||Pr("no-colors")||Pr("color=false")?fi=!1:(Pr("color")||Pr("colors")||Pr("color=true")||Pr("color=always"))&&(fi=!0);"FORCE_COLOR"in Tt&&(fi=Tt.FORCE_COLOR.length===0||parseInt(Tt.FORCE_COLOR,10)!==0);function J$(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function X$(t){if(fi===!1)return 0;if(Pr("color=16m")||Pr("color=full")||Pr("color=truecolor"))return 3;if(Pr("color=256"))return 2;if(t&&!t.isTTY&&fi!==!0)return 0;var e=fi?1:0;if(process.platform==="win32"){var r=Y$.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 Tt)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(o){return o in Tt})||Tt.CI_NAME==="codeship"?1:e;if("TEAMCITY_VERSION"in Tt)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Tt.TEAMCITY_VERSION)?1:0;if("TERM_PROGRAM"in Tt){var n=parseInt((Tt.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Tt.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Tt.TERM)?2:/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(Tt.TERM)||"COLORTERM"in Tt?1:(Tt.TERM==="dumb",e)}function ih(t){var e=X$(t);return J$(e)}xb.exports={supportsColor:ih,stdout:ih(process.stdout),stderr:ih(process.stderr)}});var Fb=x((Zz,Ob)=>{Ob.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 kb=x((Qz,Pb)=>{Pb.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(f){c=f===u}),c}function s(u,c){var f="",d,p;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(p in u)if(!a(p)){switch(f=f+u[p],d={up:0,down:0,mid:0},c.size){case"mini":d.up=i(8),d.mid=i(2),d.down=i(8);break;case"maxi":d.up=i(16)+3,d.mid=i(4)+1,d.down=i(64)+3;break;default:d.up=i(8)+1,d.mid=i(6)/2,d.down=i(8)+1;break}var h=["up","mid","down"];for(var m in h)for(var y=h[m],D=0;D<=d[y];D++)c[y]&&(f=f+n[y][i(n[y].length)])}return f}return s(e,r)}});var Ib=x((eK,$b)=>{$b.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 Rb=x((tK,Tb)=>{Tb.exports=function(t){return function(e,r,n){return r%2===0?e:t.inverse(e)}}});var Nb=x((rK,Bb)=>{Bb.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 jb=x((nK,Lb)=>{Lb.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 zb=x((iK,Vb)=>{var he={};Vb.exports=he;he.themes={};var Z$=require("util"),eo=he.styles=Eb(),Mb=Object.defineProperties,Q$=new RegExp(/[\r\n]+/g);he.supportsColor=Ab().supportsColor;typeof he.enabled>"u"&&(he.enabled=he.supportsColor()!==!1);he.enable=function(){he.enabled=!0};he.disable=function(){he.enabled=!1};he.stripColors=he.strip=function(t){return(""+t).replace(/\x1B\[\d+m/g,"")};var oK=he.stylize=function(e,r){if(!he.enabled)return e+"";var n=eo[r];return!n&&r in he?he[r](e):n.open+e+n.close},e3=/[|\\{}()[\]^$+*?.]/g,t3=function(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(e3,"\\$&")};function qb(t){var e=function r(){return n3.apply(r,arguments)};return e._styles=t,e.__proto__=r3,e}var Hb=(function(){var t={};return eo.grey=eo.gray,Object.keys(eo).forEach(function(e){eo[e].closeRe=new RegExp(t3(eo[e].close),"g"),t[e]={get:function(){return qb(this._styles.concat(e))}}}),t})(),r3=Mb(function(){},Hb);function n3(){var t=Array.prototype.slice.call(arguments),e=t.map(function(a){return a!=null&&a.constructor===String?a:Z$.inspect(a)}).join(" ");if(!he.enabled||!e)return e;for(var r=e.indexOf(`
31
+ `)!=-1,n=this._styles,o=n.length;o--;){var i=eo[n[o]];e=i.open+e.replace(i.closeRe,i.open)+i.close,r&&(e=e.replace(Q$,function(a){return i.close+a+i.open}))}return e}he.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){he[r]=function(n){if(typeof t[r]=="object"){var o=n;for(var i in t[r])o=he[t[r][i]](o);return o}return he[t[r]](n)}})(e)};function o3(){var t={};return Object.keys(Hb).forEach(function(e){t[e]={get:function(){return qb([e])}}}),t}var i3=function(e,r){var n=r.split("");return n=n.map(e),n.join("")};he.trap=Fb();he.zalgo=kb();he.maps={};he.maps.america=Ib()(he);he.maps.zebra=Rb()(he);he.maps.rainbow=Nb()(he);he.maps.random=jb()(he);for(Ub in he.maps)(function(t){he[t]=function(e){return i3(he.maps[t],e)}})(Ub);var Ub;Mb(he,o3())});var Gb=x((aK,Kb)=>{var a3=zb();Kb.exports=a3});var Wb=x(ah=>{"use strict";ah.indent=function(e){return new Array(e+1).join(" ")};ah.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((uK,s3)=>{s3.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 Jb=x(za=>{"use strict";var Nr=Gb(),$n=Wb(),u3=/[^\w\s\n\r\v\t\.,]/i;za.version=Yb().version;var sh=function(t,e){return t!==void 0||e.renderUndefined},oc=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(`
32
+ `)===-1||r.inlineArrays&&!e&&Array.isArray(t)&&oc(t[0],!0,r))},c3=function(t,e){if(e.noColor)return t;if(typeof t=="string")return e.stringColor?Nr[e.stringColor](t):t;var r=t+"";return t===!0?Nr.green(r):t===!1?Nr.red(r):t==null?Nr.grey(r):typeof t=="number"?t>=0?Nr[e.positiveNumberColor](r):Nr[e.negativeNumberColor](r):typeof t=="function"?"function() {}":Array.isArray(t)?t.join(", "):r},uh=function(t,e){return t.multilineStringColor===null||t.noColor?e:Nr[t.multilineStringColor](e)},l3=function(t,e,r){var n=t.split(`
33
+ `);return n=n.map(function(o){return $n.indent(e)+uh(r,o)}),n.join(`
34
+ `)},di=function(t,e,r){if(typeof t=="string"&&t.match(u3)&&e.escape&&(t=JSON.stringify(t)),!sh(t,e))return[];if(oc(t,!1,e))return[$n.indent(r)+c3(t,e)];if(typeof t=="string")return[$n.indent(r)+uh(e,'"""'),l3(t,r+e.defaultIndentation,e),$n.indent(r)+uh(e,'"""')];if(Array.isArray(t)){if(t.length===0)return[$n.indent(r)+e.emptyArrayMsg];var n=[];return t.forEach(function(s){if(sh(s,e)){var u="- ";e.noColor||(u=Nr[e.dashColor](u)),u=$n.indent(r)+u,oc(s,!1,e)?(u+=di(s,e,0)[0],n.push(u)):(n.push(u),n.push.apply(n,di(s,e,r+e.defaultIndentation)))}}),n}if(t instanceof Error)return di({message:t.message,stack:t.stack.split(`
35
+ `)},e,r);var o=e.noAlign?0:$n.getMaxIndexLength(t),i,a=[];return Object.getOwnPropertyNames(t).forEach(function(s){if(sh(t[s],e))if(i=s+": ",e.noColor||(i=Nr[e.keysColor](i)),i=$n.indent(r)+i,oc(t[s],!1,e)){var u=e.noAlign?0:o-s.length;i+=di(t[s],e,u)[0],a.push(i)}else a.push(i),a.push.apply(a,di(t[s],e,r+e.defaultIndentation))}),a};za.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,di(e,r,n).join(`
36
+ `)};za.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)+`
37
+ `,e=e.substr(a)}try{i=JSON.parse(e)}catch{return Nr.red("Error:")+" Not valid JSON!"}return o+=za.render(i,r,n),o}});var fh=x(ic=>{"use strict";Object.defineProperty(ic,"__esModule",{value:!0});ic.default=void 0;function pi(t){"@babel/helpers - typeof";return pi=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},pi(t)}function Xb(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,d3(n.key),n)}}function f3(t,e,r){return e&&Xb(t.prototype,e),r&&Xb(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function d3(t){var e=p3(t,"string");return pi(e)=="symbol"?e:e+""}function p3(t,e){if(pi(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(pi(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function h3(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function m3(t,e,r){return e=Ga(e),g3(t,lh()?Reflect.construct(e,r||[],Ga(t).constructor):e.apply(t,r))}function g3(t,e){if(e&&(pi(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return y3(t)}function y3(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function D3(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&&Ka(t,e)}function ch(t){var e=typeof Map=="function"?new Map:void 0;return ch=function(n){if(n===null||!w3(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 b3(n,arguments,Ga(this).constructor)}return o.prototype=Object.create(n.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),Ka(o,n)},ch(t)}function b3(t,e,r){if(lh())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var o=new(t.bind.apply(t,n));return r&&Ka(o,r.prototype),o}function lh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(lh=function(){return!!t})()}function w3(t){try{return Function.toString.call(t).indexOf("[native code]")!==-1}catch{return typeof t=="function"}}function Ka(t,e){return Ka=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Ka(t,e)}function Ga(t){return Ga=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Ga(t)}var v3=(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(h3(this,e),n=m3(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(),f=a?a.getStatus():"n/a",d=a?a.getBody()||"":"n/a";r+=", originated from request (method: ".concat(u,", url: ").concat(c,", response code: ").concat(f,", response text: ").concat(d,", request id: ").concat(s,")")}return n.message=r,n}return D3(e,t),f3(e)})(ch(Error)),lK=ic.default=v3});var dh=x(ac=>{"use strict";Object.defineProperty(ac,"__esModule",{value:!0});ac.enableDebugLog=C3;ac.log=E3;var Zb=!1;function C3(){Zb=!0}function E3(t){Zb&&console.log(t)}});var ew=x(sc=>{"use strict";Object.defineProperty(sc,"__esModule",{value:!0});sc.default=void 0;function Wa(t){"@babel/helpers - typeof";return Wa=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},Wa(t)}function _3(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,x3(n.key),n)}}function S3(t,e,r){return e&&Qb(t.prototype,e),r&&Qb(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function x3(t){var e=A3(t,"string");return Wa(e)=="symbol"?e:e+""}function A3(t,e){if(Wa(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Wa(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var pK=sc.default=(function(){function t(){_3(this,t)}return S3(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 tw=x((ph,hh)=>{(function(t,e){typeof ph=="object"&&typeof hh<"u"?hh.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:ph,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(I){var N={};return I.forEach(function(Z,U){return N[Z]=U}),N})(a),u=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,c=String.fromCharCode.bind(String),f=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):function(I){return new Uint8Array(Array.prototype.slice.call(I,0))},d=function(I){return I.replace(/=/g,"").replace(/[+\/]/g,function(N){return N=="+"?"-":"_"})},p=function(I){return I.replace(/[^A-Za-z0-9\+\/]/g,"")},h=function(I){for(var N,Z,U,oe,Zt="",z=I.length%3,Se=0;Se<I.length;){if((Z=I.charCodeAt(Se++))>255||(U=I.charCodeAt(Se++))>255||(oe=I.charCodeAt(Se++))>255)throw new TypeError("invalid character found");N=Z<<16|U<<8|oe,Zt+=a[N>>18&63]+a[N>>12&63]+a[N>>6&63]+a[N&63]}return z?Zt.slice(0,z-3)+"===".substring(z):Zt},m=typeof btoa=="function"?function(I){return btoa(I)}:r?function(I){return Buffer.from(I,"binary").toString("base64")}:h,y=r?function(I){return Buffer.from(I).toString("base64")}:function(I){for(var N=4096,Z=[],U=0,oe=I.length;U<oe;U+=N)Z.push(c.apply(null,I.subarray(U,U+N)));return m(Z.join(""))},D=function(I,N){return N===void 0&&(N=!1),N?d(y(I)):y(I)},v=function(I){if(I.length<2){var N=I.charCodeAt(0);return N<128?I:N<2048?c(192|N>>>6)+c(128|N&63):c(224|N>>>12&15)+c(128|N>>>6&63)+c(128|N&63)}else{var N=65536+(I.charCodeAt(0)-55296)*1024+(I.charCodeAt(1)-56320);return c(240|N>>>18&7)+c(128|N>>>12&63)+c(128|N>>>6&63)+c(128|N&63)}},E=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,g=function(I){return I.replace(E,v)},_=r?function(I){return Buffer.from(I,"utf8").toString("base64")}:o?function(I){return y(o.encode(I))}:function(I){return m(g(I))},S=function(I,N){return N===void 0&&(N=!1),N?d(_(I)):_(I)},k=function(I){return S(I,!0)},F=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,B=function(I){switch(I.length){case 4:var N=(7&I.charCodeAt(0))<<18|(63&I.charCodeAt(1))<<12|(63&I.charCodeAt(2))<<6|63&I.charCodeAt(3),Z=N-65536;return c((Z>>>10)+55296)+c((Z&1023)+56320);case 3:return c((15&I.charCodeAt(0))<<12|(63&I.charCodeAt(1))<<6|63&I.charCodeAt(2));default:return c((31&I.charCodeAt(0))<<6|63&I.charCodeAt(1))}},T=function(I){return I.replace(F,B)},j=function(I){if(I=I.replace(/\s+/g,""),!u.test(I))throw new TypeError("malformed base64.");I+="==".slice(2-(I.length&3));for(var N,Z,U,oe=[],Zt=0;Zt<I.length;)N=s[I.charAt(Zt++)]<<18|s[I.charAt(Zt++)]<<12|(Z=s[I.charAt(Zt++)])<<6|(U=s[I.charAt(Zt++)]),Z===64?oe.push(c(N>>16&255)):U===64?oe.push(c(N>>16&255,N>>8&255)):oe.push(c(N>>16&255,N>>8&255,N&255));return oe.join("")},A=typeof atob=="function"?function(I){return atob(p(I))}:r?function(I){return Buffer.from(I,"base64").toString("binary")}:j,M=r?function(I){return f(Buffer.from(I,"base64"))}:function(I){return f(A(I).split("").map(function(N){return N.charCodeAt(0)}))},L=function(I){return M(P(I))},X=r?function(I){return Buffer.from(I,"base64").toString("utf8")}:n?function(I){return n.decode(M(I))}:function(I){return T(A(I))},P=function(I){return p(I.replace(/[-_]/g,function(N){return N=="-"?"+":"/"}))},b=function(I){return X(P(I))},w=function(I){if(typeof I!="string")return!1;var N=I.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(N)||!/[^\s0-9a-zA-Z\-_]/.test(N)},C=function(I){return{value:I,enumerable:!1,writable:!0,configurable:!0}},O=function(){var I=function(N,Z){return Object.defineProperty(String.prototype,N,C(Z))};I("fromBase64",function(){return b(this)}),I("toBase64",function(N){return S(this,N)}),I("toBase64URI",function(){return S(this,!0)}),I("toBase64URL",function(){return S(this,!0)}),I("toUint8Array",function(){return L(this)})},R=function(){var I=function(N,Z){return Object.defineProperty(Uint8Array.prototype,N,C(Z))};I("toBase64",function(N){return D(this,N)}),I("toBase64URI",function(){return D(this,!0)}),I("toBase64URL",function(){return D(this,!0)})},$=function(){O(),R()},H={version:t,VERSION:e,atob:A,atobPolyfill:j,btoa:m,btoaPolyfill:h,fromBase64:b,toBase64:S,encode:S,encodeURI:k,encodeURL:k,utob:g,btou:T,decode:b,isValid:w,fromUint8Array:D,toUint8Array:L,extendString:O,extendUint8Array:R,extendBuiltins:$};return H.Base64={},Object.keys(H).forEach(function(I){return H.Base64[I]=H[I]}),H})});var nw=x((mK,rw)=>{"use strict";rw.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 aw=x(mh=>{"use strict";var O3=Object.prototype.hasOwnProperty,F3;function ow(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch{return null}}function iw(t){try{return encodeURIComponent(t)}catch{return null}}function P3(t){for(var e=/([^=?#&]+)=?([^&]*)/g,r={},n;n=e.exec(t);){var o=ow(n[1]),i=ow(n[2]);o===null||i===null||o in r||(r[o]=i)}return r}function k3(t,e){e=e||"";var r=[],n,o;typeof e!="string"&&(e="?");for(o in t)if(O3.call(t,o)){if(n=t[o],!n&&(n===null||n===F3||isNaN(n))&&(n=""),o=iw(o),n=iw(n),o===null||n===null)continue;r.push(o+"="+n)}return r.length?e+r.join("&"):""}mh.stringify=k3;mh.parse=P3});var hw=x((yK,pw)=>{"use strict";var uw=nw(),uc=aw(),$3=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,cw=/[\n\r\t]/g,I3=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,lw=/:\d+$/,T3=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,R3=/^[a-zA-Z]:/;function yh(t){return(t||"").toString().replace($3,"")}var gh=[["#","hash"],["?","query"],function(e,r){return Lr(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]],sw={hash:1,query:1};function fw(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 jr(unescape(t.pathname),{});else if(o==="string"){n=new jr(t,{});for(i in sw)delete n[i]}else if(o==="object"){for(i in t)i in sw||(n[i]=t[i]);n.slashes===void 0&&(n.slashes=I3.test(t.href))}return n}function Lr(t){return t==="file:"||t==="ftp:"||t==="http:"||t==="https:"||t==="ws:"||t==="wss:"}function dw(t,e){t=yh(t),t=t.replace(cw,""),e=e||{};var r=T3.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)):Lr(n)?s=r[4]:n?o&&(s=s.slice(2)):a>=2&&Lr(e.protocol)&&(s=r[4]),{protocol:n,slashes:o||Lr(n),slashesCount:a,rest:s}}function B3(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 jr(t,e,r){if(t=yh(t),t=t.replace(cw,""),!(this instanceof jr))return new jr(t,e,r);var n,o,i,a,s,u,c=gh.slice(),f=typeof e,d=this,p=0;for(f!=="object"&&f!=="string"&&(r=e,e=null),r&&typeof r!="function"&&(r=uc.parse),e=fw(e),o=dw(t||"",e),n=!o.protocol&&!o.slashes,d.slashes=o.slashes||n&&e.slashes,d.protocol=o.protocol||e.protocol||"",t=o.rest,(o.protocol==="file:"&&(o.slashesCount!==2||R3.test(t))||!o.slashes&&(o.protocol||o.slashesCount<2||!Lr(d.protocol)))&&(c[3]=[/(.*)/,"pathname"]);p<c.length;p++){if(a=c[p],typeof a=="function"){t=a(t,d);continue}i=a[0],u=a[1],i!==i?d[u]=t:typeof i=="string"?(s=i==="@"?t.lastIndexOf(i):t.indexOf(i),~s&&(typeof a[2]=="number"?(d[u]=t.slice(0,s),t=t.slice(s+a[2])):(d[u]=t.slice(s),t=t.slice(0,s)))):(s=i.exec(t))&&(d[u]=s[1],t=t.slice(0,s.index)),d[u]=d[u]||n&&a[3]&&e[u]||"",a[4]&&(d[u]=d[u].toLowerCase())}r&&(d.query=r(d.query)),n&&e.slashes&&d.pathname.charAt(0)!=="/"&&(d.pathname!==""||e.pathname!=="")&&(d.pathname=B3(d.pathname,e.pathname)),d.pathname.charAt(0)!=="/"&&Lr(d.protocol)&&(d.pathname="/"+d.pathname),uw(d.port,d.protocol)||(d.host=d.hostname,d.port=""),d.username=d.password="",d.auth&&(s=d.auth.indexOf(":"),~s?(d.username=d.auth.slice(0,s),d.username=encodeURIComponent(decodeURIComponent(d.username)),d.password=d.auth.slice(s+1),d.password=encodeURIComponent(decodeURIComponent(d.password))):d.username=encodeURIComponent(decodeURIComponent(d.auth)),d.auth=d.password?d.username+":"+d.password:d.username),d.origin=d.protocol!=="file:"&&Lr(d.protocol)&&d.host?d.protocol+"//"+d.host:"null",d.href=d.toString()}function N3(t,e,r){var n=this;switch(t){case"query":typeof e=="string"&&e.length&&(e=(r||uc.parse)(e)),n[t]=e;break;case"port":n[t]=e,uw(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,lw.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<gh.length;a++){var s=gh[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:"&&Lr(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function L3(t){(!t||typeof t!="function")&&(t=uc.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||Lr(r.protocol)?"//":"");return r.username?(i+=r.username,r.password&&(i+=":"+r.password),i+="@"):r.password?(i+=":"+r.password,i+="@"):r.protocol!=="file:"&&Lr(r.protocol)&&!n&&r.pathname!=="/"&&(i+="@"),(n[n.length-1]===":"||lw.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}jr.prototype={set:N3,toString:L3};jr.extractProtocol=dw;jr.location=fw;jr.trimLeft=yh;jr.qs=uc;pw.exports=jr});var mw=x(Dh=>{"use strict";Object.defineProperty(Dh,"__esModule",{value:!0});Dh.default=j3;function j3(){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 Pw=x(dc=>{"use strict";Object.defineProperty(dc,"__esModule",{value:!0});dc.default=void 0;var U3=tw(),M3=vh(hw()),cc=vh(fh()),to=dh(),q3=vh(mw());function vh(t){return t&&t.__esModule?t:{default:t}}function bh(){"use strict";bh=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(b,w,C){b[w]=C.value},i=typeof Symbol=="function"?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(b,w,C){return Object.defineProperty(b,w,{value:C,enumerable:!0,configurable:!0,writable:!0}),b[w]}try{c({},"")}catch{c=function(C,O,R){return C[O]=R}}function f(b,w,C,O){var R=w&&w.prototype instanceof v?w:v,$=Object.create(R.prototype),H=new X(O||[]);return o($,"_invoke",{value:j(b,C,H)}),$}function d(b,w,C){try{return{type:"normal",arg:b.call(w,C)}}catch(O){return{type:"throw",arg:O}}}e.wrap=f;var p="suspendedStart",h="suspendedYield",m="executing",y="completed",D={};function v(){}function E(){}function g(){}var _={};c(_,a,function(){return this});var S=Object.getPrototypeOf,k=S&&S(S(P([])));k&&k!==r&&n.call(k,a)&&(_=k);var F=g.prototype=v.prototype=Object.create(_);function B(b){["next","throw","return"].forEach(function(w){c(b,w,function(C){return this._invoke(w,C)})})}function T(b,w){function C(R,$,H,I){var N=d(b[R],b,$);if(N.type!=="throw"){var Z=N.arg,U=Z.value;return U&&ro(U)=="object"&&n.call(U,"__await")?w.resolve(U.__await).then(function(oe){C("next",oe,H,I)},function(oe){C("throw",oe,H,I)}):w.resolve(U).then(function(oe){Z.value=oe,H(Z)},function(oe){return C("throw",oe,H,I)})}I(N.arg)}var O;o(this,"_invoke",{value:function($,H){function I(){return new w(function(N,Z){C($,H,N,Z)})}return O=O?O.then(I,I):I()}})}function j(b,w,C){var O=p;return function(R,$){if(O===m)throw Error("Generator is already running");if(O===y){if(R==="throw")throw $;return{value:t,done:!0}}for(C.method=R,C.arg=$;;){var H=C.delegate;if(H){var I=A(H,C);if(I){if(I===D)continue;return I}}if(C.method==="next")C.sent=C._sent=C.arg;else if(C.method==="throw"){if(O===p)throw O=y,C.arg;C.dispatchException(C.arg)}else C.method==="return"&&C.abrupt("return",C.arg);O=m;var N=d(b,w,C);if(N.type==="normal"){if(O=C.done?y:h,N.arg===D)continue;return{value:N.arg,done:C.done}}N.type==="throw"&&(O=y,C.method="throw",C.arg=N.arg)}}}function A(b,w){var C=w.method,O=b.iterator[C];if(O===t)return w.delegate=null,C==="throw"&&b.iterator.return&&(w.method="return",w.arg=t,A(b,w),w.method==="throw")||C!=="return"&&(w.method="throw",w.arg=new TypeError("The iterator does not provide a '"+C+"' method")),D;var R=d(O,b.iterator,w.arg);if(R.type==="throw")return w.method="throw",w.arg=R.arg,w.delegate=null,D;var $=R.arg;return $?$.done?(w[b.resultName]=$.value,w.next=b.nextLoc,w.method!=="return"&&(w.method="next",w.arg=t),w.delegate=null,D):$:(w.method="throw",w.arg=new TypeError("iterator result is not an object"),w.delegate=null,D)}function M(b){var w={tryLoc:b[0]};1 in b&&(w.catchLoc=b[1]),2 in b&&(w.finallyLoc=b[2],w.afterLoc=b[3]),this.tryEntries.push(w)}function L(b){var w=b.completion||{};w.type="normal",delete w.arg,b.completion=w}function X(b){this.tryEntries=[{tryLoc:"root"}],b.forEach(M,this),this.reset(!0)}function P(b){if(b||b===""){var w=b[a];if(w)return w.call(b);if(typeof b.next=="function")return b;if(!isNaN(b.length)){var C=-1,O=function R(){for(;++C<b.length;)if(n.call(b,C))return R.value=b[C],R.done=!1,R;return R.value=t,R.done=!0,R};return O.next=O}}throw new TypeError(ro(b)+" is not iterable")}return E.prototype=g,o(F,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:E,configurable:!0}),E.displayName=c(g,u,"GeneratorFunction"),e.isGeneratorFunction=function(b){var w=typeof b=="function"&&b.constructor;return!!w&&(w===E||(w.displayName||w.name)==="GeneratorFunction")},e.mark=function(b){return Object.setPrototypeOf?Object.setPrototypeOf(b,g):(b.__proto__=g,c(b,u,"GeneratorFunction")),b.prototype=Object.create(F),b},e.awrap=function(b){return{__await:b}},B(T.prototype),c(T.prototype,s,function(){return this}),e.AsyncIterator=T,e.async=function(b,w,C,O,R){R===void 0&&(R=Promise);var $=new T(f(b,w,C,O),R);return e.isGeneratorFunction(w)?$:$.next().then(function(H){return H.done?H.value:$.next()})},B(F),c(F,u,"Generator"),c(F,a,function(){return this}),c(F,"toString",function(){return"[object Generator]"}),e.keys=function(b){var w=Object(b),C=[];for(var O in w)C.push(O);return C.reverse(),function R(){for(;C.length;){var $=C.pop();if($ in w)return R.value=$,R.done=!1,R}return R.done=!0,R}},e.values=P,X.prototype={constructor:X,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(L),!w)for(var C in this)C.charAt(0)==="t"&&n.call(this,C)&&!isNaN(+C.slice(1))&&(this[C]=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 C=this;function O(Z,U){return H.type="throw",H.arg=w,C.next=Z,U&&(C.method="next",C.arg=t),!!U}for(var R=this.tryEntries.length-1;R>=0;--R){var $=this.tryEntries[R],H=$.completion;if($.tryLoc==="root")return O("end");if($.tryLoc<=this.prev){var I=n.call($,"catchLoc"),N=n.call($,"finallyLoc");if(I&&N){if(this.prev<$.catchLoc)return O($.catchLoc,!0);if(this.prev<$.finallyLoc)return O($.finallyLoc)}else if(I){if(this.prev<$.catchLoc)return O($.catchLoc,!0)}else{if(!N)throw Error("try statement without catch or finally");if(this.prev<$.finallyLoc)return O($.finallyLoc)}}}},abrupt:function(w,C){for(var O=this.tryEntries.length-1;O>=0;--O){var R=this.tryEntries[O];if(R.tryLoc<=this.prev&&n.call(R,"finallyLoc")&&this.prev<R.finallyLoc){var $=R;break}}$&&(w==="break"||w==="continue")&&$.tryLoc<=C&&C<=$.finallyLoc&&($=null);var H=$?$.completion:{};return H.type=w,H.arg=C,$?(this.method="next",this.next=$.finallyLoc,D):this.complete(H)},complete:function(w,C){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"&&C&&(this.next=C),D},finish:function(w){for(var C=this.tryEntries.length-1;C>=0;--C){var O=this.tryEntries[C];if(O.finallyLoc===w)return this.complete(O.completion,O.afterLoc),L(O),D}},catch:function(w){for(var C=this.tryEntries.length-1;C>=0;--C){var O=this.tryEntries[C];if(O.tryLoc===w){var R=O.completion;if(R.type==="throw"){var $=R.arg;L(O)}return $}}throw Error("illegal catch attempt")},delegateYield:function(w,C,O){return this.delegate={iterator:P(w),resultName:C,nextLoc:O},this.method==="next"&&(this.arg=t),D}},e}function gw(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 H3(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(u){gw(i,n,o,a,s,"next",u)}function s(u){gw(i,n,o,a,s,"throw",u)}a(void 0)})}}function Sw(t,e){return K3(t)||z3(t,e)||xw(t,e)||V3()}function V3(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
38
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function z3(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(f){c=!0,o=f}finally{try{if(!u&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}function K3(t){if(Array.isArray(t))return t}function ro(t){"@babel/helpers - typeof";return ro=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},ro(t)}function G3(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=xw(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.
39
+ 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 xw(t,e){if(t){if(typeof t=="string")return yw(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 yw(t,e)}}function yw(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 Dw(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 hi(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Dw(Object(r),!0).forEach(function(n){W3(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Dw(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function W3(t,e,r){return e=Aw(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Y3(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function bw(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,Aw(n.key),n)}}function J3(t,e,r){return e&&bw(t.prototype,e),r&&bw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Aw(t){var e=X3(t,"string");return ro(e)=="symbol"?e:e+""}function X3(t,e){if(ro(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ro(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var lc="tus-v1",fc="ietf-draft-03",Ya="ietf-draft-05",Z3={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:Fw,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:lc},Ow=(function(){function t(e,r){Y3(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 J3(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(![lc,fc,Ya].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,to.log)("No fingerprint was calculated meaning that the upload cannot be stored in the URL storage."):(0,to.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:eI(this._source.size,a);this._parallelUploadUrls&&s.forEach(function(f,d){f.uploadUrl=n._parallelUploadUrls[d]||null}),this._parallelUploadUrls=new Array(s.length);var u=s.map(function(f,d){var p=0;return n._source.slice(f.start,f.end).then(function(h){var m=h.value;return new Promise(function(y,D){var v=hi(hi({},n.options),{},{uploadUrl:f.uploadUrl||null,storeFingerprintForResuming:!1,removeFingerprintOnSuccess:!1,parallelUploads:1,parallelUploadBoundaries:null,metadata:n.options.metadataForPartialUploads,headers:hi(hi({},n.options.headers),{},{"Upload-Concat":"partial"}),onSuccess:y,onError:D,onProgress:function(_){i=i-p+_,p=_,n._emitProgress(i,o)},onUploadUrlAvailable:function(){n._parallelUploadUrls[d]=E.url,n._parallelUploadUrls.filter(function(_){return!!_}).length===s.length&&n._saveUploadInUrlStorage()}}),E=new t(m,v);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 f=ww(n.options.metadata);return f!==""&&c.setHeader("Upload-Metadata",f),n._sendRequest(c,null)}).then(function(f){if(!mi(f.getStatus(),200)){n._emitHttpError(c,f,"tus: unexpected response while creating upload");return}var d=f.getHeader("Location");if(d==null){n._emitHttpError(c,f,"tus: invalid or missing Location header");return}n.url=_w(n.options.endpoint,d),(0,to.log)("Created upload at ".concat(n.url)),n._emitSuccess(f)}).catch(function(f){n._emitError(f)})}},{key:"_startSingleUpload",value:function(){if(this._aborted=!1,this.url!=null){(0,to.log)("Resuming upload from previous URL: ".concat(this.url)),this._resumeUpload();return}if(this.options.uploadUrl!=null){(0,to.log)("Resuming upload from provided URL: ".concat(this.options.uploadUrl)),this.url=this.options.uploadUrl,this._resumeUpload();return}(0,to.log)("Creating a new upload"),this._createUpload()}},{key:"abort",value:function(r){var n=this;if(this._parallelUploads!=null){var o=G3(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 cc.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),Ew(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=ww(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===fc||this.options.protocol===Ya)&&n.setHeader("Upload-Complete","?0"),i=this._sendRequest(n,null)),i.then(function(a){if(!mi(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=_w(r.options.endpoint,s),(0,to.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(!mi(a,200)){if(a===423){r._emitHttpError(n,i,"tus: upload is currently locked; retry later");return}if(mi(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===lc){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(!mi(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===lc?r.setHeader("Content-Type","application/offset+octet-stream"):this.options.protocol===Ya&&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 f=n._offset+c;return!n.options.uploadLengthDeferred&&u&&f!==n._size?Promise.reject(new Error("upload was configured with a size of ".concat(n._size," bytes, but the source is done after ").concat(f," bytes"))):s===null?n._sendRequest(r):((n.options.protocol===fc||n.options.protocol===Ya)&&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=vw(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 Cw(r,n,this.options)}}],[{key:"terminate",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=vw("DELETE",r,n);return Cw(o,null,n).then(function(i){if(i.getStatus()!==204)throw new cc.default("tus: unexpected response while terminating upload",null,o,i)}).catch(function(i){if(i instanceof cc.default||(i=new cc.default("tus: failed to terminate upload",i,o,null)),!Ew(i,0,n))throw i;var a=n.retryDelays[0],s=n.retryDelays.slice(1),u=hi(hi({},n),{},{retryDelays:s});return new Promise(function(c){return setTimeout(c,a)}).then(function(){return t.terminate(r,u)})})}}])})();function ww(t){return Object.entries(t).map(function(e){var r=Sw(e,2),n=r[0],o=r[1];return"".concat(n," ").concat(U3.Base64.encode(String(o)))}).join(",")}function mi(t,e){return t>=e&&t<e+100}function vw(t,e,r){var n=r.httpStack.createRequest(t,e);r.protocol===fc?n.setHeader("Upload-Draft-Interop-Version","5"):r.protocol===Ya?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=Sw(a[i],2),u=s[0],c=s[1];n.setHeader(u,c)}if(r.addRequestId){var f=(0,q3.default)();n.setHeader("X-Request-ID",f)}return n}function Cw(t,e,r){return wh.apply(this,arguments)}function wh(){return wh=H3(bh().mark(function t(e,r,n){var o;return bh().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)})),wh.apply(this,arguments)}function Q3(){var t=!0;return typeof navigator<"u"&&navigator.onLine===!1&&(t=!1),t}function Ew(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):Fw(t)}function Fw(t){var e=t.originalResponse?t.originalResponse.getStatus():0;return(!mi(e,400)||e===409||e===423)&&Q3()}function _w(t,e){return new M3.default(e,t).toString()}function eI(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}Ow.defaultOptions=Z3;var bK=dc.default=Ow});var $w=x((vK,kw)=>{"use strict";var Ur=t=>t!==null&&typeof t=="object"&&typeof t.pipe=="function";Ur.writable=t=>Ur(t)&&t.writable!==!1&&typeof t._write=="function"&&typeof t._writableState=="object";Ur.readable=t=>Ur(t)&&t.readable!==!1&&typeof t._read=="function"&&typeof t._readableState=="object";Ur.duplex=t=>Ur.writable(t)&&Ur.readable(t);Ur.transform=t=>Ur.duplex(t)&&typeof t._transform=="function";kw.exports=Ur});var Tw=x(pc=>{"use strict";Object.defineProperty(pc,"__esModule",{value:!0});pc.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 tI(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Iw(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,nI(n.key),n)}}function rI(t,e,r){return e&&Iw(t.prototype,e),r&&Iw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function nI(t){var e=oI(t,"string");return Ja(e)=="symbol"?e:e+""}function oI(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 CK=pc.default=(function(){function t(e){tI(this,t),this._buffer=e,this.size=e.length}return rI(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 Lw=x(_h=>{"use strict";Object.defineProperty(_h,"__esModule",{value:!0});_h.default=lI;var Nw=require("fs");function no(t){"@babel/helpers - typeof";return no=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},no(t)}function Ch(){"use strict";Ch=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(b,w,C){b[w]=C.value},i=typeof Symbol=="function"?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(b,w,C){return Object.defineProperty(b,w,{value:C,enumerable:!0,configurable:!0,writable:!0}),b[w]}try{c({},"")}catch{c=function(C,O,R){return C[O]=R}}function f(b,w,C,O){var R=w&&w.prototype instanceof v?w:v,$=Object.create(R.prototype),H=new X(O||[]);return o($,"_invoke",{value:j(b,C,H)}),$}function d(b,w,C){try{return{type:"normal",arg:b.call(w,C)}}catch(O){return{type:"throw",arg:O}}}e.wrap=f;var p="suspendedStart",h="suspendedYield",m="executing",y="completed",D={};function v(){}function E(){}function g(){}var _={};c(_,a,function(){return this});var S=Object.getPrototypeOf,k=S&&S(S(P([])));k&&k!==r&&n.call(k,a)&&(_=k);var F=g.prototype=v.prototype=Object.create(_);function B(b){["next","throw","return"].forEach(function(w){c(b,w,function(C){return this._invoke(w,C)})})}function T(b,w){function C(R,$,H,I){var N=d(b[R],b,$);if(N.type!=="throw"){var Z=N.arg,U=Z.value;return U&&no(U)=="object"&&n.call(U,"__await")?w.resolve(U.__await).then(function(oe){C("next",oe,H,I)},function(oe){C("throw",oe,H,I)}):w.resolve(U).then(function(oe){Z.value=oe,H(Z)},function(oe){return C("throw",oe,H,I)})}I(N.arg)}var O;o(this,"_invoke",{value:function($,H){function I(){return new w(function(N,Z){C($,H,N,Z)})}return O=O?O.then(I,I):I()}})}function j(b,w,C){var O=p;return function(R,$){if(O===m)throw Error("Generator is already running");if(O===y){if(R==="throw")throw $;return{value:t,done:!0}}for(C.method=R,C.arg=$;;){var H=C.delegate;if(H){var I=A(H,C);if(I){if(I===D)continue;return I}}if(C.method==="next")C.sent=C._sent=C.arg;else if(C.method==="throw"){if(O===p)throw O=y,C.arg;C.dispatchException(C.arg)}else C.method==="return"&&C.abrupt("return",C.arg);O=m;var N=d(b,w,C);if(N.type==="normal"){if(O=C.done?y:h,N.arg===D)continue;return{value:N.arg,done:C.done}}N.type==="throw"&&(O=y,C.method="throw",C.arg=N.arg)}}}function A(b,w){var C=w.method,O=b.iterator[C];if(O===t)return w.delegate=null,C==="throw"&&b.iterator.return&&(w.method="return",w.arg=t,A(b,w),w.method==="throw")||C!=="return"&&(w.method="throw",w.arg=new TypeError("The iterator does not provide a '"+C+"' method")),D;var R=d(O,b.iterator,w.arg);if(R.type==="throw")return w.method="throw",w.arg=R.arg,w.delegate=null,D;var $=R.arg;return $?$.done?(w[b.resultName]=$.value,w.next=b.nextLoc,w.method!=="return"&&(w.method="next",w.arg=t),w.delegate=null,D):$:(w.method="throw",w.arg=new TypeError("iterator result is not an object"),w.delegate=null,D)}function M(b){var w={tryLoc:b[0]};1 in b&&(w.catchLoc=b[1]),2 in b&&(w.finallyLoc=b[2],w.afterLoc=b[3]),this.tryEntries.push(w)}function L(b){var w=b.completion||{};w.type="normal",delete w.arg,b.completion=w}function X(b){this.tryEntries=[{tryLoc:"root"}],b.forEach(M,this),this.reset(!0)}function P(b){if(b||b===""){var w=b[a];if(w)return w.call(b);if(typeof b.next=="function")return b;if(!isNaN(b.length)){var C=-1,O=function R(){for(;++C<b.length;)if(n.call(b,C))return R.value=b[C],R.done=!1,R;return R.value=t,R.done=!0,R};return O.next=O}}throw new TypeError(no(b)+" is not iterable")}return E.prototype=g,o(F,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:E,configurable:!0}),E.displayName=c(g,u,"GeneratorFunction"),e.isGeneratorFunction=function(b){var w=typeof b=="function"&&b.constructor;return!!w&&(w===E||(w.displayName||w.name)==="GeneratorFunction")},e.mark=function(b){return Object.setPrototypeOf?Object.setPrototypeOf(b,g):(b.__proto__=g,c(b,u,"GeneratorFunction")),b.prototype=Object.create(F),b},e.awrap=function(b){return{__await:b}},B(T.prototype),c(T.prototype,s,function(){return this}),e.AsyncIterator=T,e.async=function(b,w,C,O,R){R===void 0&&(R=Promise);var $=new T(f(b,w,C,O),R);return e.isGeneratorFunction(w)?$:$.next().then(function(H){return H.done?H.value:$.next()})},B(F),c(F,u,"Generator"),c(F,a,function(){return this}),c(F,"toString",function(){return"[object Generator]"}),e.keys=function(b){var w=Object(b),C=[];for(var O in w)C.push(O);return C.reverse(),function R(){for(;C.length;){var $=C.pop();if($ in w)return R.value=$,R.done=!1,R}return R.done=!0,R}},e.values=P,X.prototype={constructor:X,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(L),!w)for(var C in this)C.charAt(0)==="t"&&n.call(this,C)&&!isNaN(+C.slice(1))&&(this[C]=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 C=this;function O(Z,U){return H.type="throw",H.arg=w,C.next=Z,U&&(C.method="next",C.arg=t),!!U}for(var R=this.tryEntries.length-1;R>=0;--R){var $=this.tryEntries[R],H=$.completion;if($.tryLoc==="root")return O("end");if($.tryLoc<=this.prev){var I=n.call($,"catchLoc"),N=n.call($,"finallyLoc");if(I&&N){if(this.prev<$.catchLoc)return O($.catchLoc,!0);if(this.prev<$.finallyLoc)return O($.finallyLoc)}else if(I){if(this.prev<$.catchLoc)return O($.catchLoc,!0)}else{if(!N)throw Error("try statement without catch or finally");if(this.prev<$.finallyLoc)return O($.finallyLoc)}}}},abrupt:function(w,C){for(var O=this.tryEntries.length-1;O>=0;--O){var R=this.tryEntries[O];if(R.tryLoc<=this.prev&&n.call(R,"finallyLoc")&&this.prev<R.finallyLoc){var $=R;break}}$&&(w==="break"||w==="continue")&&$.tryLoc<=C&&C<=$.finallyLoc&&($=null);var H=$?$.completion:{};return H.type=w,H.arg=C,$?(this.method="next",this.next=$.finallyLoc,D):this.complete(H)},complete:function(w,C){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"&&C&&(this.next=C),D},finish:function(w){for(var C=this.tryEntries.length-1;C>=0;--C){var O=this.tryEntries[C];if(O.finallyLoc===w)return this.complete(O.completion,O.afterLoc),L(O),D}},catch:function(w){for(var C=this.tryEntries.length-1;C>=0;--C){var O=this.tryEntries[C];if(O.tryLoc===w){var R=O.completion;if(R.type==="throw"){var $=R.arg;L(O)}return $}}throw Error("illegal catch attempt")},delegateYield:function(w,C,O){return this.delegate={iterator:P(w),resultName:C,nextLoc:O},this.method==="next"&&(this.arg=t),D}},e}function iI(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,sI(n.key),n)}}function aI(t,e,r){return e&&Rw(t.prototype,e),r&&Rw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function sI(t){var e=uI(t,"string");return no(e)=="symbol"?e:e+""}function uI(t,e){if(no(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(no(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Bw(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 cI(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(u){Bw(i,n,o,a,s,"next",u)}function s(u){Bw(i,n,o,a,s,"throw",u)}a(void 0)})}}function lI(t){return Eh.apply(this,arguments)}function Eh(){return Eh=cI(Ch().mark(function t(e){var r,n,o,i,a,s,u;return Ch().wrap(function(f){for(;;)switch(f.prev=f.next){case 0:return n=e.path.toString(),f.next=3,Nw.promises.stat(n);case 3:return o=f.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,f.abrupt("return",new fI(e,n,u));case 9:case"end":return f.stop()}},t)})),Eh.apply(this,arguments)}var fI=(function(){function t(e,r,n){iI(this,t),this._stream=e,this._path=r,this.size=n}return aI(t,[{key:"slice",value:function(r,n){var o,i=(o=this._stream.start)!==null&&o!==void 0?o:0,a=(0,Nw.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 xh=x(hc=>{"use strict";Object.defineProperty(hc,"__esModule",{value:!0});hc.default=void 0;function oo(t){"@babel/helpers - typeof";return oo=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},oo(t)}function Xa(){"use strict";Xa=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(b,w,C){b[w]=C.value},i=typeof Symbol=="function"?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(b,w,C){return Object.defineProperty(b,w,{value:C,enumerable:!0,configurable:!0,writable:!0}),b[w]}try{c({},"")}catch{c=function(C,O,R){return C[O]=R}}function f(b,w,C,O){var R=w&&w.prototype instanceof v?w:v,$=Object.create(R.prototype),H=new X(O||[]);return o($,"_invoke",{value:j(b,C,H)}),$}function d(b,w,C){try{return{type:"normal",arg:b.call(w,C)}}catch(O){return{type:"throw",arg:O}}}e.wrap=f;var p="suspendedStart",h="suspendedYield",m="executing",y="completed",D={};function v(){}function E(){}function g(){}var _={};c(_,a,function(){return this});var S=Object.getPrototypeOf,k=S&&S(S(P([])));k&&k!==r&&n.call(k,a)&&(_=k);var F=g.prototype=v.prototype=Object.create(_);function B(b){["next","throw","return"].forEach(function(w){c(b,w,function(C){return this._invoke(w,C)})})}function T(b,w){function C(R,$,H,I){var N=d(b[R],b,$);if(N.type!=="throw"){var Z=N.arg,U=Z.value;return U&&oo(U)=="object"&&n.call(U,"__await")?w.resolve(U.__await).then(function(oe){C("next",oe,H,I)},function(oe){C("throw",oe,H,I)}):w.resolve(U).then(function(oe){Z.value=oe,H(Z)},function(oe){return C("throw",oe,H,I)})}I(N.arg)}var O;o(this,"_invoke",{value:function($,H){function I(){return new w(function(N,Z){C($,H,N,Z)})}return O=O?O.then(I,I):I()}})}function j(b,w,C){var O=p;return function(R,$){if(O===m)throw Error("Generator is already running");if(O===y){if(R==="throw")throw $;return{value:t,done:!0}}for(C.method=R,C.arg=$;;){var H=C.delegate;if(H){var I=A(H,C);if(I){if(I===D)continue;return I}}if(C.method==="next")C.sent=C._sent=C.arg;else if(C.method==="throw"){if(O===p)throw O=y,C.arg;C.dispatchException(C.arg)}else C.method==="return"&&C.abrupt("return",C.arg);O=m;var N=d(b,w,C);if(N.type==="normal"){if(O=C.done?y:h,N.arg===D)continue;return{value:N.arg,done:C.done}}N.type==="throw"&&(O=y,C.method="throw",C.arg=N.arg)}}}function A(b,w){var C=w.method,O=b.iterator[C];if(O===t)return w.delegate=null,C==="throw"&&b.iterator.return&&(w.method="return",w.arg=t,A(b,w),w.method==="throw")||C!=="return"&&(w.method="throw",w.arg=new TypeError("The iterator does not provide a '"+C+"' method")),D;var R=d(O,b.iterator,w.arg);if(R.type==="throw")return w.method="throw",w.arg=R.arg,w.delegate=null,D;var $=R.arg;return $?$.done?(w[b.resultName]=$.value,w.next=b.nextLoc,w.method!=="return"&&(w.method="next",w.arg=t),w.delegate=null,D):$:(w.method="throw",w.arg=new TypeError("iterator result is not an object"),w.delegate=null,D)}function M(b){var w={tryLoc:b[0]};1 in b&&(w.catchLoc=b[1]),2 in b&&(w.finallyLoc=b[2],w.afterLoc=b[3]),this.tryEntries.push(w)}function L(b){var w=b.completion||{};w.type="normal",delete w.arg,b.completion=w}function X(b){this.tryEntries=[{tryLoc:"root"}],b.forEach(M,this),this.reset(!0)}function P(b){if(b||b===""){var w=b[a];if(w)return w.call(b);if(typeof b.next=="function")return b;if(!isNaN(b.length)){var C=-1,O=function R(){for(;++C<b.length;)if(n.call(b,C))return R.value=b[C],R.done=!1,R;return R.value=t,R.done=!0,R};return O.next=O}}throw new TypeError(oo(b)+" is not iterable")}return E.prototype=g,o(F,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:E,configurable:!0}),E.displayName=c(g,u,"GeneratorFunction"),e.isGeneratorFunction=function(b){var w=typeof b=="function"&&b.constructor;return!!w&&(w===E||(w.displayName||w.name)==="GeneratorFunction")},e.mark=function(b){return Object.setPrototypeOf?Object.setPrototypeOf(b,g):(b.__proto__=g,c(b,u,"GeneratorFunction")),b.prototype=Object.create(F),b},e.awrap=function(b){return{__await:b}},B(T.prototype),c(T.prototype,s,function(){return this}),e.AsyncIterator=T,e.async=function(b,w,C,O,R){R===void 0&&(R=Promise);var $=new T(f(b,w,C,O),R);return e.isGeneratorFunction(w)?$:$.next().then(function(H){return H.done?H.value:$.next()})},B(F),c(F,u,"Generator"),c(F,a,function(){return this}),c(F,"toString",function(){return"[object Generator]"}),e.keys=function(b){var w=Object(b),C=[];for(var O in w)C.push(O);return C.reverse(),function R(){for(;C.length;){var $=C.pop();if($ in w)return R.value=$,R.done=!1,R}return R.done=!0,R}},e.values=P,X.prototype={constructor:X,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(L),!w)for(var C in this)C.charAt(0)==="t"&&n.call(this,C)&&!isNaN(+C.slice(1))&&(this[C]=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 C=this;function O(Z,U){return H.type="throw",H.arg=w,C.next=Z,U&&(C.method="next",C.arg=t),!!U}for(var R=this.tryEntries.length-1;R>=0;--R){var $=this.tryEntries[R],H=$.completion;if($.tryLoc==="root")return O("end");if($.tryLoc<=this.prev){var I=n.call($,"catchLoc"),N=n.call($,"finallyLoc");if(I&&N){if(this.prev<$.catchLoc)return O($.catchLoc,!0);if(this.prev<$.finallyLoc)return O($.finallyLoc)}else if(I){if(this.prev<$.catchLoc)return O($.catchLoc,!0)}else{if(!N)throw Error("try statement without catch or finally");if(this.prev<$.finallyLoc)return O($.finallyLoc)}}}},abrupt:function(w,C){for(var O=this.tryEntries.length-1;O>=0;--O){var R=this.tryEntries[O];if(R.tryLoc<=this.prev&&n.call(R,"finallyLoc")&&this.prev<R.finallyLoc){var $=R;break}}$&&(w==="break"||w==="continue")&&$.tryLoc<=C&&C<=$.finallyLoc&&($=null);var H=$?$.completion:{};return H.type=w,H.arg=C,$?(this.method="next",this.next=$.finallyLoc,D):this.complete(H)},complete:function(w,C){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"&&C&&(this.next=C),D},finish:function(w){for(var C=this.tryEntries.length-1;C>=0;--C){var O=this.tryEntries[C];if(O.finallyLoc===w)return this.complete(O.completion,O.afterLoc),L(O),D}},catch:function(w){for(var C=this.tryEntries.length-1;C>=0;--C){var O=this.tryEntries[C];if(O.tryLoc===w){var R=O.completion;if(R.type==="throw"){var $=R.arg;L(O)}return $}}throw Error("illegal catch attempt")},delegateYield:function(w,C,O){return this.delegate={iterator:P(w),resultName:C,nextLoc:O},this.method==="next"&&(this.arg=t),D}},e}function dI(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function jw(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,hI(n.key),n)}}function pI(t,e,r){return e&&jw(t.prototype,e),r&&jw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function hI(t){var e=mI(t,"string");return oo(e)=="symbol"?e:e+""}function mI(t,e){if(oo(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(oo(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Uw(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 Mw(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(u){Uw(i,n,o,a,s,"next",u)}function s(u){Uw(i,n,o,a,s,"throw",u)}a(void 0)})}}function gI(t,e){return Sh.apply(this,arguments)}function Sh(){return Sh=Mw(Xa().mark(function t(e,r){return Xa().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.abrupt("return",new Promise(function(i,a){var s=function(f){e.off("readable",u),a(f)},u=function c(){var f=e.read(r);f!==null&&(e.off("error",s),e.off("readable",c),i(f))};e.once("error",s),e.on("readable",u)}));case 1:case"end":return o.stop()}},t)})),Sh.apply(this,arguments)}var SK=hc.default=(function(){function t(e){var r=this;dI(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 pI(t,[{key:"slice",value:(function(){var e=Mw(Xa().mark(function n(o,i){var a,s,u,c,f;return Xa().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:if(!(o<this._bufPos)){p.next=2;break}throw new Error("cannot slice from position which we already seeked away");case 2:if(!(o>this._bufPos+this._buf.length)){p.next=4;break}throw new Error("slice start is outside of buffer (currently not implemented)");case 4:if(!this._error){p.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){p.next=10;break}return a.size=a.length,p.abrupt("return",{value:a,done:!0});case 10:if(c=i-o,!(c>a.length)){p.next=16;break}return p.next=14,gI(this._stream,c-a.length);case 14:f=p.sent,a=Buffer.concat([a,f]);case 16:return this._buf=a,this._bufPos=o,a.size=a.length,p.abrupt("return",{value:a,done:this._ended});case 20:case"end":return p.stop()}},n,this)}));function r(n,o){return e.apply(this,arguments)}return r})()},{key:"close",value:function(){this._stream.destroy()}}])})()});var Hw=x(gc=>{"use strict";Object.defineProperty(gc,"__esModule",{value:!0});gc.default=void 0;var yI=require("fs"),DI=mc($w()),bI=mc(Tw()),wI=mc(Lw()),vI=mc(xh());function mc(t){return t&&t.__esModule?t:{default:t}}function Za(t){"@babel/helpers - typeof";return Za=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},Za(t)}function CI(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function qw(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,_I(n.key),n)}}function EI(t,e,r){return e&&qw(t.prototype,e),r&&qw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function _I(t){var e=SI(t,"string");return Za(e)=="symbol"?e:e+""}function SI(t,e){if(Za(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Za(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var AK=gc.default=(function(){function t(){CI(this,t)}return EI(t,[{key:"openFile",value:function(r,n){return Buffer.isBuffer(r)?Promise.resolve(new bI.default(r)):r instanceof yI.ReadStream&&r.path!=null?(0,wI.default)(r):DI.default.readable(r)?(n=Number(n),Number.isFinite(n)?Promise.resolve(new vI.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(Ah=>{"use strict";Object.defineProperty(Ah,"__esModule",{value:!0});Ah.default=OI;var xI=require("crypto"),Vw=Kw(require("fs")),AI=Kw(require("path"));function zw(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(zw=function(n){return n?r:e})(t)}function Kw(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=zw(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 OI(t,e){if(Buffer.isBuffer(t)){var r=65536,n=t.slice(0,Math.min(r,t.length)),o=(0,xI.createHash)("md5").update(n).digest("hex"),i=["node-buffer",o,t.length,e.endpoint].join("-");return Promise.resolve(i)}return t instanceof Vw.ReadStream&&t.path!=null?new Promise(function(a,s){var u=AI.resolve(t.path);Vw.stat(t.path,function(c,f){if(c){s(c);return}var d=["node-file",u,f.size,f.mtime.getTime(),e.endpoint].join("-");a(d)})}):Promise.resolve(null)}});var Zw=x((PK,Xw)=>{var Jw="Expected a function",Ww=NaN,FI="[object Symbol]",PI=/^\s+|\s+$/g,kI=/^[-+]0x[0-9a-f]+$/i,$I=/^0b[01]+$/i,II=/^0o[0-7]+$/i,TI=parseInt,RI=typeof global=="object"&&global&&global.Object===Object&&global,BI=typeof self=="object"&&self&&self.Object===Object&&self,NI=RI||BI||Function("return this")(),LI=Object.prototype,jI=LI.toString,UI=Math.max,MI=Math.min,Oh=function(){return NI.Date.now()};function qI(t,e,r){var n,o,i,a,s,u,c=0,f=!1,d=!1,p=!0;if(typeof t!="function")throw new TypeError(Jw);e=Yw(e)||0,yc(r)&&(f=!!r.leading,d="maxWait"in r,i=d?UI(Yw(r.maxWait)||0,e):i,p="trailing"in r?!!r.trailing:p);function h(k){var F=n,B=o;return n=o=void 0,c=k,a=t.apply(B,F),a}function m(k){return c=k,s=setTimeout(v,e),f?h(k):a}function y(k){var F=k-u,B=k-c,T=e-F;return d?MI(T,i-B):T}function D(k){var F=k-u,B=k-c;return u===void 0||F>=e||F<0||d&&B>=i}function v(){var k=Oh();if(D(k))return E(k);s=setTimeout(v,y(k))}function E(k){return s=void 0,p&&n?h(k):(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(Oh())}function S(){var k=Oh(),F=D(k);if(n=arguments,o=this,u=k,F){if(s===void 0)return m(u);if(d)return s=setTimeout(v,e),h(u)}return s===void 0&&(s=setTimeout(v,e)),a}return S.cancel=g,S.flush=_,S}function HI(t,e,r){var n=!0,o=!0;if(typeof t!="function")throw new TypeError(Jw);return yc(r)&&(n="leading"in r?!!r.leading:n,o="trailing"in r?!!r.trailing:o),qI(t,e,{leading:n,maxWait:e,trailing:o})}function yc(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function VI(t){return!!t&&typeof t=="object"}function zI(t){return typeof t=="symbol"||VI(t)&&jI.call(t)==FI}function Yw(t){if(typeof t=="number")return t;if(zI(t))return Ww;if(yc(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=yc(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(PI,"");var r=$I.test(t);return r||II.test(t)?TI(t.slice(2),r?2:8):kI.test(t)?Ww:+t}Xw.exports=HI});var sv=x(vc=>{"use strict";Object.defineProperty(vc,"__esModule",{value:!0});vc.default=void 0;var KI=ov(require("http")),GI=ov(require("https")),tv=require("stream"),WI=require("url"),rv=YI(Zw());function YI(t){return t&&t.__esModule?t:{default:t}}function nv(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(nv=function(n){return n?r:e})(t)}function ov(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=nv(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 JI(t,e,r){return e=Dc(e),XI(t,iv()?Reflect.construct(e,r||[],Dc(t).constructor):e.apply(t,r))}function XI(t,e){if(e&&(gi(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ZI(t)}function ZI(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function iv(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(iv=function(){return!!t})()}function Dc(t){return Dc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Dc(t)}function QI(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&&Fh(t,e)}function Fh(t,e){return Fh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Fh(t,e)}function Qw(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?Qw(Object(r),!0).forEach(function(n){eT(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Qw(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function eT(t,e,r){return e=av(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function gi(t){"@babel/helpers - typeof";return gi=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},gi(t)}function bc(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ev(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,av(n.key),n)}}function wc(t,e,r){return e&&ev(t.prototype,e),r&&ev(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function av(t){var e=tT(t,"string");return gi(e)=="symbol"?e:e+""}function tT(t,e){if(gi(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(gi(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var kK=vc.default=(function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};bc(this,t),this._requestOptions=e}return wc(t,[{key:"createRequest",value:function(r,n){return new rT(r,n,this._requestOptions)}},{key:"getName",value:function(){return"NodeHttpStack"}}])})(),rT=(function(){function t(e,r,n){bc(this,t),this._method=e,this._url=r,this._headers={},this._request=null,this._progressHandler=function(){},this._requestOptions=n||{}}return wc(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,WI.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:"?GI:KI;r._request=s.request(a);var u=r._request;u.on("response",function(c){var f=[];c.on("data",function(d){f.push(d)}),c.on("end",function(){var d=Buffer.concat(f).toString("utf8");o(new nT(c,d))})}),u.on("error",function(c){i(c)}),n instanceof tv.Readable?n.pipe(new oT(r._progressHandler)).pipe(u):n instanceof Uint8Array?iT(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}}])})(),nT=(function(){function t(e,r){bc(this,t),this._response=e,this._body=r}return wc(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}}])})(),oT=(function(t){function e(r){var n;return bc(this,e),n=JI(this,e),n._onprogress=(0,rv.default)(r,100,{leading:!0,trailing:!1}),n._position=0,n}return QI(e,t),wc(e,[{key:"_transform",value:function(n,o,i){this._position+=n.length,this._onprogress(this._position),i(null,n)}}])})(tv.Transform),iT=function(e,r,n){n=(0,rv.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 uv=x(Ph=>{"use strict";Ph.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};Ph.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(`
40
40
  `)}(!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(f){switch(f){case"code":o=t.code||void 0;break;case"message":a=t.message||"";break;default:n[f]=t[f]}}),Error.stackTraceLimit=i.stackLength+2,u=new Error().stack.split(`
41
41
  `),u.splice(0,3),u.unshift(""),Error.stackTraceLimit=s,this.stack=u.join(`
42
- `),Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,get:function(){return o},set:function(f){o=f,c()}}),Object.defineProperty(this,"message",{configurable:!0,enumerable:!0,get:function(){return a},set:function(f){a=f,c()}}),c())}});var av=x((OK,iv)=>{"use strict";iv.exports=no;no.factory=nv();var Oh=no("CustomError");Oh.order=no(Oh,{message:"Arguments out of order.",code:"EOARG"});function no(t,e,r,n){var o,i;return e=Dc(arguments,1,Error,ov,[xh,bc]),r=Dc(arguments,2,{},xh,[bc]),n=Dc(arguments,3,Ah,bc,[]),t=Dc(arguments,0,e===Error?"Error":e.prototype.CustomError.name,tT,[ov,xh,bc]),i=e===Error,i&&n===Ah&&(n=no.factory.root),o=function(a,s){var u,c,f,d,p,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,f={},Object.keys(no.factory).forEach(function(m){f[m]=function(y,D){no.factory[m].call(u,y,D,f)}}),d=this.CustomError.chain.length-1;d>=0;d--)p=this.CustomError.chain[d],p.factory!==Ah&&p.factory.call(this,h,s,f)},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 Dc(t,e,r,n,o){var i=-1,a=-1,s,u,c=e<t.length?e:t.length,f;for(s=0;s<=c;s++){if(f=t[s],i===-1)for(u=0;u<o.length;u++)o[u](f)&&(i=s);a===-1&&n(f)&&(a=s)}if(a!==-1&&i!==-1&&i<a)throw new Oh.order;return a!==-1?t[a]:r}function bc(t){return typeof t=="function"&&t!==Error&&!t.prototype.CustomError}function tT(t){return typeof t=="string"}function ov(t){return typeof t=="function"&&(t===Error||t.prototype.CustomError)}function xh(t){return t&&typeof t=="object"}function Ah(){}});var uv=x((FK,sv)=>{sv.exports=av()});var pv=x((oo,yi)=>{var rT=1/0,nT="[object Symbol]",Qa={function:!0,object:!0},oT=Qa[typeof oo]&&oo&&!oo.nodeType?oo:void 0,iT=Qa[typeof yi]&&yi&&!yi.nodeType?yi:void 0,aT=wc(oT&&iT&&typeof global=="object"&&global),sT=wc(Qa[typeof self]&&self),cv=wc(Qa[typeof window]&&window),Fh=wc(Qa[typeof oo]&&oo),uT=aT||cv!==(Fh&&Fh.window)&&cv||sT||Fh||Function("return this")();function wc(t){return t&&t.Object===Object?t:null}var cT=Object.prototype,lT=cT.toString,lv=uT.Symbol,fv=lv?lv.prototype:void 0,dv=fv?fv.toString:void 0;function fT(t){if(typeof t=="string")return t;if(pT(t))return dv?dv.call(t):"";var e=t+"";return e=="0"&&1/t==-rT?"-0":e}function dT(t){return!!t&&typeof t=="object"}function pT(t){return typeof t=="symbol"||dT(t)&&lT.call(t)==nT}yi.exports=fT});var wv=x((io,Di)=>{var hT=pv(),mT="Expected a function",mv="__lodash_hash_undefined__",gT="[object Function]",yT="[object GeneratorFunction]",DT=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g,bT=/[\\^$.*+?()[\]{}|]/g,wT=/\\(\\)?/g,vT=/^\[object .+?Constructor\]$/,ts={function:!0,object:!0},CT=ts[typeof io]&&io&&!io.nodeType?io:void 0,ET=ts[typeof Di]&&Di&&!Di.nodeType?Di:void 0,_T=vc(CT&&ET&&typeof global=="object"&&global),ST=vc(ts[typeof self]&&self),hv=vc(ts[typeof window]&&window),kh=vc(ts[typeof io]&&io),xT=_T||hv!==(kh&&kh.window)&&hv||ST||kh||Function("return this")();function vc(t){return t&&t.Object===Object?t:null}function AT(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}var OT=Array.prototype,gv=Object.prototype,yv=Function.prototype.toString,Ph=gv.hasOwnProperty,FT=gv.toString,kT=RegExp("^"+yv.call(Ph).replace(bT,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),PT=OT.splice,$T=Dv(xT,"Map"),es=Dv(Object,"create");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 IT(){this.__data__=es?es(null):{}}function TT(t){return this.has(t)&&delete this.__data__[t]}function RT(t){var e=this.__data__;if(es){var r=e[t];return r===mv?void 0:r}return Ph.call(e,t)?e[t]:void 0}function BT(t){var e=this.__data__;return es?e[t]!==void 0:Ph.call(e,t)}function NT(t,e){var r=this.__data__;return r[t]=es&&e===void 0?mv:e,this}ao.prototype.clear=IT;ao.prototype.delete=TT;ao.prototype.get=RT;ao.prototype.has=BT;ao.prototype.set=NT;function bi(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 LT(){this.__data__=[]}function jT(t){var e=this.__data__,r=Cc(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():PT.call(e,r,1),!0}function UT(t){var e=this.__data__,r=Cc(e,t);return r<0?void 0:e[r][1]}function MT(t){return Cc(this.__data__,t)>-1}function qT(t,e){var r=this.__data__,n=Cc(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}bi.prototype.clear=LT;bi.prototype.delete=jT;bi.prototype.get=UT;bi.prototype.has=MT;bi.prototype.set=qT;function so(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 HT(){this.__data__={hash:new ao,map:new($T||bi),string:new ao}}function VT(t){return Ec(this,t).delete(t)}function zT(t){return Ec(this,t).get(t)}function KT(t){return Ec(this,t).has(t)}function GT(t,e){return Ec(this,t).set(t,e),this}so.prototype.clear=HT;so.prototype.delete=VT;so.prototype.get=zT;so.prototype.has=KT;so.prototype.set=GT;function Cc(t,e){for(var r=t.length;r--;)if(XT(t[r][0],e))return r;return-1}function Ec(t,e){var r=t.__data__;return WT(e)?r[typeof e=="string"?"string":"hash"]:r.map}function Dv(t,e){var r=t[e];return QT(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 YT=$h(function(t){var e=[];return eR(t).replace(DT,function(r,n,o,i){e.push(o?i.replace(wT,"$1"):n||r)}),e});function JT(t){if(t!=null){try{return yv.call(t)}catch{}try{return t+""}catch{}}return""}function $h(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(mT);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($h.Cache||so),r}$h.Cache=so;function XT(t,e){return t===e||t!==t&&e!==e}function ZT(t){var e=bv(t)?FT.call(t):"";return e==gT||e==yT}function bv(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function QT(t){if(!bv(t))return!1;var e=ZT(t)||AT(t)?kT:vT;return e.test(JT(t))}function eR(t){return t==null?"":hT(t)}Di.exports=YT});var Jv=x((uo,vi)=>{var tR=wv(),rR=200,Hh="__lodash_hash_undefined__",Oc=1,Ci=2,nR=1/0,xv=9007199254740991,_c="[object Arguments]",Rh="[object Array]",Av="[object Boolean]",Ov="[object Date]",Fv="[object Error]",kv="[object Function]",oR="[object GeneratorFunction]",rs="[object Map]",Pv="[object Number]",wi="[object Object]",vv="[object Promise]",$v="[object RegExp]",ns="[object Set]",Vh="[object String]",Iv="[object Symbol]",Bh="[object WeakMap]",Tv="[object ArrayBuffer]",Sc="[object DataView]",iR="[object Float32Array]",aR="[object Float64Array]",sR="[object Int8Array]",uR="[object Int16Array]",cR="[object Int32Array]",lR="[object Uint8Array]",fR="[object Uint8ClampedArray]",dR="[object Uint16Array]",pR="[object Uint32Array]",hR=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,mR=/^\w*$/,gR=/[\\^$.*+?()[\]{}|]/g,yR=/^\[object .+?Constructor\]$/,DR=/^(?:0|[1-9]\d*)$/,Ne={};Ne[iR]=Ne[aR]=Ne[sR]=Ne[uR]=Ne[cR]=Ne[lR]=Ne[fR]=Ne[dR]=Ne[pR]=!0;Ne[_c]=Ne[Rh]=Ne[Tv]=Ne[Av]=Ne[Sc]=Ne[Ov]=Ne[Fv]=Ne[kv]=Ne[rs]=Ne[Pv]=Ne[wi]=Ne[$v]=Ne[ns]=Ne[Vh]=Ne[Bh]=!1;var is={function:!0,object:!0},bR=is[typeof uo]&&uo&&!uo.nodeType?uo:void 0,wR=is[typeof vi]&&vi&&!vi.nodeType?vi:void 0,vR=Fc(bR&&wR&&typeof global=="object"&&global),CR=Fc(is[typeof self]&&self),Cv=Fc(is[typeof window]&&window),Ih=Fc(is[typeof uo]&&uo),fo=vR||Cv!==(Ih&&Ih.window)&&Cv||CR||Ih||Function("return this")();function ER(t,e){for(var r=-1,n=t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}function _R(t,e){for(var r=-1,n=t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}function SR(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function xR(t,e){return ER(e,function(r){return[r,t[r]]})}function Fc(t){return t&&t.Object===Object?t:null}function Nh(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function Rv(t){var e=-1,r=Array(t.size);return t.forEach(function(n,o){r[++e]=[o,n]}),r}function AR(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}function OR(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=[n,n]}),r}var FR=Array.prototype,kc=Object.prototype,Bv=Function.prototype.toString,co=kc.hasOwnProperty,po=kc.toString,kR=RegExp("^"+Bv.call(co).replace(gR,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ev=fo.Symbol,_v=fo.Uint8Array,PR=kc.propertyIsEnumerable,$R=FR.splice,IR=Object.getPrototypeOf,TR=Object.keys,Lh=Ei(fo,"DataView"),xc=Ei(fo,"Map"),jh=Ei(fo,"Promise"),Uh=Ei(fo,"Set"),Mh=Ei(fo,"WeakMap"),os=Ei(Object,"create"),RR=mo(Lh),BR=mo(xc),NR=mo(jh),LR=mo(Uh),jR=mo(Mh),Sv=Ev?Ev.prototype:void 0,Th=Sv?Sv.valueOf:void 0;function lo(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 UR(){this.__data__=os?os(null):{}}function MR(t){return this.has(t)&&delete this.__data__[t]}function qR(t){var e=this.__data__;if(os){var r=e[t];return r===Hh?void 0:r}return co.call(e,t)?e[t]:void 0}function HR(t){var e=this.__data__;return os?e[t]!==void 0:co.call(e,t)}function VR(t,e){var r=this.__data__;return r[t]=os&&e===void 0?Hh:e,this}lo.prototype.clear=UR;lo.prototype.delete=MR;lo.prototype.get=qR;lo.prototype.has=HR;lo.prototype.set=VR;function nn(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 zR(){this.__data__=[]}function KR(t){var e=this.__data__,r=Pc(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():$R.call(e,r,1),!0}function GR(t){var e=this.__data__,r=Pc(e,t);return r<0?void 0:e[r][1]}function WR(t){return Pc(this.__data__,t)>-1}function YR(t,e){var r=this.__data__,n=Pc(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}nn.prototype.clear=zR;nn.prototype.delete=KR;nn.prototype.get=GR;nn.prototype.has=WR;nn.prototype.set=YR;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 JR(){this.__data__={hash:new lo,map:new(xc||nn),string:new lo}}function XR(t){return $c(this,t).delete(t)}function ZR(t){return $c(this,t).get(t)}function QR(t){return $c(this,t).has(t)}function eB(t,e){return $c(this,t).set(t,e),this}ho.prototype.clear=JR;ho.prototype.delete=XR;ho.prototype.get=ZR;ho.prototype.has=QR;ho.prototype.set=eB;function Ac(t){var e=-1,r=t?t.length:0;for(this.__data__=new ho;++e<r;)this.add(t[e])}function tB(t){return this.__data__.set(t,Hh),this}function rB(t){return this.__data__.has(t)}Ac.prototype.add=Ac.prototype.push=tB;Ac.prototype.has=rB;function rn(t){this.__data__=new nn(t)}function nB(){this.__data__=new nn}function oB(t){return this.__data__.delete(t)}function iB(t){return this.__data__.get(t)}function aB(t){return this.__data__.has(t)}function sB(t,e){var r=this.__data__;return r instanceof nn&&r.__data__.length==rR&&(r=this.__data__=new ho(r.__data__)),r.set(t,e),this}rn.prototype.clear=nB;rn.prototype.delete=oB;rn.prototype.get=iB;rn.prototype.has=aB;rn.prototype.set=sB;function Pc(t,e){for(var r=t.length;r--;)if(xB(t[r][0],e))return r;return-1}function Nv(t,e){e=Ic(e,t)?[e]:Uv(e);for(var r=0,n=e.length;t!=null&&r<n;)t=t[Tc(e[r++])];return r&&r==n?t:void 0}function Lv(t,e){return co.call(t,e)||typeof t=="object"&&e in t&&vB(t)===null}function uB(t,e){return e in Object(t)}function zh(t,e,r,n,o){return t===e?!0:t==null||e==null||!Bc(t)&&!as(e)?t!==t&&e!==e:cB(t,e,zh,r,n,o)}function cB(t,e,r,n,o,i){var a=kn(t),s=kn(e),u=Rh,c=Rh;a||(u=tn(t),u=u==_c?wi:u),s||(c=tn(e),c=c==_c?wi:c);var f=u==wi&&!Nh(t),d=c==wi&&!Nh(e),p=u==c;if(p&&!f)return i||(i=new rn),a||FB(t)?Mv(t,e,r,n,o,i):yB(t,e,u,r,n,o,i);if(!(o&Ci)){var h=f&&co.call(t,"__wrapped__"),m=d&&co.call(e,"__wrapped__");if(h||m){var y=h?t.value():t,D=m?e.value():e;return i||(i=new rn),r(y,D,n,o,i)}}return p?(i||(i=new rn),DB(t,e,r,n,o,i)):!1}function lB(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],f=s[1];if(a&&s[2]){if(c===void 0&&!(u in t))return!1}else{var d=new rn;if(n)var p=n(c,f,u,t,e,d);if(!(p===void 0?zh(f,c,n,Oc|Ci,d):p))return!1}}return!0}function fB(t){return typeof t=="function"?t:t==null?IB:typeof t=="object"?kn(t)?hB(t[0],t[1]):pB(t):TB(t)}function dB(t){return TR(Object(t))}function pB(t){var e=wB(t);return e.length==1&&e[0][2]?Vv(e[0][0],e[0][1]):function(r){return r===t||lB(r,t,e)}}function hB(t,e){return Ic(t)&&Hv(e)?Vv(Tc(t),e):function(r){var n=kB(r,t);return n===void 0&&n===e?PB(r,t):zh(e,n,void 0,Oc|Ci)}}function jv(t){return function(e){return e?.[t]}}function mB(t){return function(e){return Nv(e,t)}}function Uv(t){return kn(t)?t:tR(t)}function gB(t){return function(e){var r=tn(e);return r==rs?Rv(e):r==ns?OR(e):xR(e,t(e))}}function Mv(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 f=-1,d=!0,p=o&Oc?new Ac:void 0;for(i.set(t,e);++f<s;){var h=t[f],m=e[f];if(n)var y=a?n(m,h,f,e,t,i):n(h,m,f,t,e,i);if(y!==void 0){if(y)continue;d=!1;break}if(p){if(!_R(e,function(D,v){if(!p.has(v)&&(h===D||r(h,D,n,o,i)))return p.add(v)})){d=!1;break}}else if(!(h===m||r(h,m,n,o,i))){d=!1;break}}return i.delete(t),d}function yB(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 Tv:return!(t.byteLength!=e.byteLength||!n(new _v(t),new _v(e)));case Av:case Ov:return+t==+e;case Fv:return t.name==e.name&&t.message==e.message;case Pv:return t!=+t?e!=+e:t==+e;case $v:case Vh:return t==e+"";case rs:var s=Rv;case ns:var u=i&Ci;if(s||(s=AR),t.size!=e.size&&!u)return!1;var c=a.get(t);return c?c==e:(i|=Oc,a.set(t,e),Mv(s(t),s(e),n,o,i,a));case Iv:if(Th)return Th.call(t)==Th.call(e)}return!1}function DB(t,e,r,n,o,i){var a=o&Ci,s=qh(t),u=s.length,c=qh(e),f=c.length;if(u!=f&&!a)return!1;for(var d=u;d--;){var p=s[d];if(!(a?p in e:Lv(e,p)))return!1}var h=i.get(t);if(h)return h==e;var m=!0;i.set(t,e);for(var y=a;++d<u;){p=s[d];var D=t[p],v=e[p];if(n)var E=a?n(v,D,p,e,t,i):n(D,v,p,t,e,i);if(!(E===void 0?D===v||r(D,v,n,o,i):E)){m=!1;break}y||(y=p=="constructor")}if(m&&!y){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 bB=jv("length");function $c(t,e){var r=t.__data__;return _B(e)?r[typeof e=="string"?"string":"hash"]:r.map}function wB(t){for(var e=$B(t),r=e.length;r--;)e[r][2]=Hv(e[r][1]);return e}function Ei(t,e){var r=t[e];return OB(r)?r:void 0}function vB(t){return IR(Object(t))}function tn(t){return po.call(t)}(Lh&&tn(new Lh(new ArrayBuffer(1)))!=Sc||xc&&tn(new xc)!=rs||jh&&tn(jh.resolve())!=vv||Uh&&tn(new Uh)!=ns||Mh&&tn(new Mh)!=Bh)&&(tn=function(t){var e=po.call(t),r=e==wi?t.constructor:void 0,n=r?mo(r):void 0;if(n)switch(n){case RR:return Sc;case BR:return rs;case NR:return vv;case LR:return ns;case jR:return Bh}return e});function CB(t,e,r){e=Ic(e,t)?[e]:Uv(e);for(var n,o=-1,a=e.length;++o<a;){var i=Tc(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&&Rc(a)&&qv(i,a)&&(kn(t)||Wv(t)||zv(t))}function EB(t){var e=t?t.length:void 0;return Rc(e)&&(kn(t)||Wv(t)||zv(t))?SR(e,String):null}function qv(t,e){return e=e??xv,!!e&&(typeof t=="number"||DR.test(t))&&t>-1&&t%1==0&&t<e}function Ic(t,e){if(kn(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||Yv(t)?!0:mR.test(t)||!hR.test(t)||e!=null&&t in Object(e)}function _B(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function SB(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||kc;return t===r}function Hv(t){return t===t&&!Bc(t)}function Vv(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}function Tc(t){if(typeof t=="string"||Yv(t))return t;var e=t+"";return e=="0"&&1/t==-nR?"-0":e}function mo(t){if(t!=null){try{return Bv.call(t)}catch{}try{return t+""}catch{}}return""}function xB(t,e){return t===e||t!==t&&e!==e}function zv(t){return AB(t)&&co.call(t,"callee")&&(!PR.call(t,"callee")||po.call(t)==_c)}var kn=Array.isArray;function Kv(t){return t!=null&&Rc(bB(t))&&!Gv(t)}function AB(t){return as(t)&&Kv(t)}function Gv(t){var e=Bc(t)?po.call(t):"";return e==kv||e==oR}function Rc(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=xv}function Bc(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function as(t){return!!t&&typeof t=="object"}function OB(t){if(!Bc(t))return!1;var e=Gv(t)||Nh(t)?kR:yR;return e.test(mo(t))}function Wv(t){return typeof t=="string"||!kn(t)&&as(t)&&po.call(t)==Vh}function Yv(t){return typeof t=="symbol"||as(t)&&po.call(t)==Iv}function FB(t){return as(t)&&Rc(t.length)&&!!Ne[po.call(t)]}function kB(t,e,r){var n=t==null?void 0:Nv(t,e);return n===void 0?r:n}function PB(t,e){return t!=null&&CB(t,e,uB)}function qh(t){var e=SB(t);if(!(e||Kv(t)))return dB(t);var r=EB(t),n=!!r,o=r||[],i=o.length;for(var a in t)Lv(t,a)&&!(n&&(a=="length"||qv(a,i)))&&!(e&&a=="constructor")&&o.push(a);return o}var $B=gB(qh);function IB(t){return t}function TB(t){return Ic(t)?jv(Tc(t)):mB(t)}vi.exports=fB});var tC=x((go,_i)=>{var RB=1/0,BB="[object Function]",NB="[object GeneratorFunction]",LB=/[\\^$.*+?()[\]{}|]/g,jB=/^\[object .+?Constructor\]$/,ss={function:!0,object:!0},UB=ss[typeof go]&&go&&!go.nodeType?go:void 0,MB=ss[typeof _i]&&_i&&!_i.nodeType?_i:void 0,qB=Nc(UB&&MB&&typeof global=="object"&&global),HB=Nc(ss[typeof self]&&self),Xv=Nc(ss[typeof window]&&window),Kh=Nc(ss[typeof go]&&go),VB=qB||Xv!==(Kh&&Kh.window)&&Xv||HB||Kh||Function("return this")();function Nc(t){return t&&t.Object===Object?t:null}function zB(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function KB(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var Zv=Object.prototype,Qv=Function.prototype.toString,GB=Zv.hasOwnProperty,WB=Zv.toString,YB=RegExp("^"+Qv.call(GB).replace(LB,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Gh=XB(VB,"Set"),JB=Gh&&1/KB(new Gh([,-0]))[1]==RB?function(t){return new Gh(t)}:t6;function XB(t,e){var r=t[e];return e6(r)?r:void 0}function ZB(t){if(t!=null){try{return Qv.call(t)}catch{}try{return t+""}catch{}}return""}function QB(t){var e=eC(t)?WB.call(t):"";return e==BB||e==NB}function eC(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function e6(t){if(!eC(t))return!1;var e=QB(t)||zB(t)?YB:jB;return e.test(ZB(t))}function t6(){}_i.exports=JB});var nC=x((yo,Si)=>{var us={function:!0,object:!0},r6=us[typeof yo]&&yo&&!yo.nodeType?yo:void 0,n6=us[typeof Si]&&Si&&!Si.nodeType?Si:void 0,o6=Lc(r6&&n6&&typeof global=="object"&&global),i6=Lc(us[typeof self]&&self),rC=Lc(us[typeof window]&&window),Wh=Lc(us[typeof yo]&&yo),a6=o6||rC!==(Wh&&Wh.window)&&rC||i6||Wh||Function("return this")();function Lc(t){return t&&t.Object===Object?t:null}Si.exports=a6});var cC=x((kK,uC)=>{var s6=tC(),u6=nC(),c6=200,Yh="__lodash_hash_undefined__",l6="[object Function]",f6="[object GeneratorFunction]",d6=/[\\^$.*+?()[\]{}|]/g,p6=/^\[object .+?Constructor\]$/;function h6(t,e){return!!t.length&&g6(t,e,0)>-1}function m6(t,e,r){for(var n=-1,o=t.length;++n<o;)if(r(e,t[n]))return!0;return!1}function g6(t,e,r){if(e!==e)return D6(t,r);for(var n=r-1,o=t.length;++n<o;)if(t[n]===e)return n;return-1}function y6(t,e){return t.has(e)}function D6(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 b6(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function w6(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var v6=Array.prototype,oC=Object.prototype,iC=Function.prototype.toString,Jh=oC.hasOwnProperty,C6=oC.toString,E6=RegExp("^"+iC.call(Jh).replace(d6,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),_6=v6.splice,S6=aC(u6,"Map"),cs=aC(Object,"create");function Do(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 x6(){this.__data__=cs?cs(null):{}}function A6(t){return this.has(t)&&delete this.__data__[t]}function O6(t){var e=this.__data__;if(cs){var r=e[t];return r===Yh?void 0:r}return Jh.call(e,t)?e[t]:void 0}function F6(t){var e=this.__data__;return cs?e[t]!==void 0:Jh.call(e,t)}function k6(t,e){var r=this.__data__;return r[t]=cs&&e===void 0?Yh:e,this}Do.prototype.clear=x6;Do.prototype.delete=A6;Do.prototype.get=O6;Do.prototype.has=F6;Do.prototype.set=k6;function xi(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 P6(){this.__data__=[]}function $6(t){var e=this.__data__,r=Uc(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():_6.call(e,r,1),!0}function I6(t){var e=this.__data__,r=Uc(e,t);return r<0?void 0:e[r][1]}function T6(t){return Uc(this.__data__,t)>-1}function R6(t,e){var r=this.__data__,n=Uc(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}xi.prototype.clear=P6;xi.prototype.delete=$6;xi.prototype.get=I6;xi.prototype.has=T6;xi.prototype.set=R6;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 B6(){this.__data__={hash:new Do,map:new(S6||xi),string:new Do}}function N6(t){return Mc(this,t).delete(t)}function L6(t){return Mc(this,t).get(t)}function j6(t){return Mc(this,t).has(t)}function U6(t,e){return Mc(this,t).set(t,e),this}Ai.prototype.clear=B6;Ai.prototype.delete=N6;Ai.prototype.get=L6;Ai.prototype.has=j6;Ai.prototype.set=U6;function jc(t){var e=-1,r=t?t.length:0;for(this.__data__=new Ai;++e<r;)this.add(t[e])}function M6(t){return this.__data__.set(t,Yh),this}function q6(t){return this.__data__.has(t)}jc.prototype.add=jc.prototype.push=M6;jc.prototype.has=q6;function Uc(t,e){for(var r=t.length;r--;)if(K6(t[r][0],e))return r;return-1}function H6(t,e,r){var n=-1,o=h6,i=t.length,a=!0,s=[],u=s;if(r)a=!1,o=m6;else if(i>=c6){var c=e?null:s6(t);if(c)return w6(c);a=!1,o=y6,u=new jc}else u=e?[]:s;e:for(;++n<i;){var f=t[n],d=e?e(f):f;if(f=r||f!==0?f:0,a&&d===d){for(var p=u.length;p--;)if(u[p]===d)continue e;e&&u.push(d),s.push(f)}else o(u,d,r)||(u!==s&&u.push(d),s.push(f))}return s}function Mc(t,e){var r=t.__data__;return V6(e)?r[typeof e=="string"?"string":"hash"]:r.map}function aC(t,e){var r=t[e];return W6(r)?r:void 0}function V6(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function z6(t){if(t!=null){try{return iC.call(t)}catch{}try{return t+""}catch{}}return""}function K6(t,e){return t===e||t!==t&&e!==e}function G6(t){var e=sC(t)?C6.call(t):"";return e==l6||e==f6}function sC(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function W6(t){if(!sC(t))return!1;var e=G6(t)||b6(t)?E6:p6;return e.test(z6(t))}uC.exports=H6});var fC=x((PK,lC)=>{var Y6=Jv(),J6=cC();function X6(t,e){return t&&t.length?J6(t,Y6(e)):[]}lC.exports=X6});var pC=x(($K,dC)=>{"use strict";var Z6=uv(),Q6=fC(),e8=Z6("MultiError");dC.exports=Xh;function Xh(t){if(!(this instanceof Xh))return new Xh(t);if(t=Array.isArray(t)?t:[t],t=Q6(t,function(r){return r.stack}),t.length===1)return t[0];var e=new e8({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(`
42
+ `),Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,get:function(){return o},set:function(f){o=f,c()}}),Object.defineProperty(this,"message",{configurable:!0,enumerable:!0,get:function(){return a},set:function(f){a=f,c()}}),c())}});var fv=x((TK,lv)=>{"use strict";lv.exports=io;io.factory=uv();var Ih=io("CustomError");Ih.order=io(Ih,{message:"Arguments out of order.",code:"EOARG"});function io(t,e,r,n){var o,i;return e=Cc(arguments,1,Error,cv,[kh,Ec]),r=Cc(arguments,2,{},kh,[Ec]),n=Cc(arguments,3,$h,Ec,[]),t=Cc(arguments,0,e===Error?"Error":e.prototype.CustomError.name,aT,[cv,kh,Ec]),i=e===Error,i&&n===$h&&(n=io.factory.root),o=function(a,s){var u,c,f,d,p,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,f={},Object.keys(io.factory).forEach(function(m){f[m]=function(y,D){io.factory[m].call(u,y,D,f)}}),d=this.CustomError.chain.length-1;d>=0;d--)p=this.CustomError.chain[d],p.factory!==$h&&p.factory.call(this,h,s,f)},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 Cc(t,e,r,n,o){var i=-1,a=-1,s,u,c=e<t.length?e:t.length,f;for(s=0;s<=c;s++){if(f=t[s],i===-1)for(u=0;u<o.length;u++)o[u](f)&&(i=s);a===-1&&n(f)&&(a=s)}if(a!==-1&&i!==-1&&i<a)throw new Ih.order;return a!==-1?t[a]:r}function Ec(t){return typeof t=="function"&&t!==Error&&!t.prototype.CustomError}function aT(t){return typeof t=="string"}function cv(t){return typeof t=="function"&&(t===Error||t.prototype.CustomError)}function kh(t){return t&&typeof t=="object"}function $h(){}});var pv=x((RK,dv)=>{dv.exports=fv()});var Dv=x((ao,yi)=>{var sT=1/0,uT="[object Symbol]",es={function:!0,object:!0},cT=es[typeof ao]&&ao&&!ao.nodeType?ao:void 0,lT=es[typeof yi]&&yi&&!yi.nodeType?yi:void 0,fT=_c(cT&&lT&&typeof global=="object"&&global),dT=_c(es[typeof self]&&self),hv=_c(es[typeof window]&&window),Th=_c(es[typeof ao]&&ao),pT=fT||hv!==(Th&&Th.window)&&hv||dT||Th||Function("return this")();function _c(t){return t&&t.Object===Object?t:null}var hT=Object.prototype,mT=hT.toString,mv=pT.Symbol,gv=mv?mv.prototype:void 0,yv=gv?gv.toString:void 0;function gT(t){if(typeof t=="string")return t;if(DT(t))return yv?yv.call(t):"";var e=t+"";return e=="0"&&1/t==-sT?"-0":e}function yT(t){return!!t&&typeof t=="object"}function DT(t){return typeof t=="symbol"||yT(t)&&mT.call(t)==uT}yi.exports=gT});var Sv=x((so,Di)=>{var bT=Dv(),wT="Expected a function",wv="__lodash_hash_undefined__",vT="[object Function]",CT="[object GeneratorFunction]",ET=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g,_T=/[\\^$.*+?()[\]{}|]/g,ST=/\\(\\)?/g,xT=/^\[object .+?Constructor\]$/,rs={function:!0,object:!0},AT=rs[typeof so]&&so&&!so.nodeType?so:void 0,OT=rs[typeof Di]&&Di&&!Di.nodeType?Di:void 0,FT=Sc(AT&&OT&&typeof global=="object"&&global),PT=Sc(rs[typeof self]&&self),bv=Sc(rs[typeof window]&&window),Rh=Sc(rs[typeof so]&&so),kT=FT||bv!==(Rh&&Rh.window)&&bv||PT||Rh||Function("return this")();function Sc(t){return t&&t.Object===Object?t:null}function $T(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}var IT=Array.prototype,vv=Object.prototype,Cv=Function.prototype.toString,Bh=vv.hasOwnProperty,TT=vv.toString,RT=RegExp("^"+Cv.call(Bh).replace(_T,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),BT=IT.splice,NT=Ev(kT,"Map"),ts=Ev(Object,"create");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 LT(){this.__data__=ts?ts(null):{}}function jT(t){return this.has(t)&&delete this.__data__[t]}function UT(t){var e=this.__data__;if(ts){var r=e[t];return r===wv?void 0:r}return Bh.call(e,t)?e[t]:void 0}function MT(t){var e=this.__data__;return ts?e[t]!==void 0:Bh.call(e,t)}function qT(t,e){var r=this.__data__;return r[t]=ts&&e===void 0?wv:e,this}uo.prototype.clear=LT;uo.prototype.delete=jT;uo.prototype.get=UT;uo.prototype.has=MT;uo.prototype.set=qT;function bi(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 HT(){this.__data__=[]}function VT(t){var e=this.__data__,r=xc(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():BT.call(e,r,1),!0}function zT(t){var e=this.__data__,r=xc(e,t);return r<0?void 0:e[r][1]}function KT(t){return xc(this.__data__,t)>-1}function GT(t,e){var r=this.__data__,n=xc(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}bi.prototype.clear=HT;bi.prototype.delete=VT;bi.prototype.get=zT;bi.prototype.has=KT;bi.prototype.set=GT;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 WT(){this.__data__={hash:new uo,map:new(NT||bi),string:new uo}}function YT(t){return Ac(this,t).delete(t)}function JT(t){return Ac(this,t).get(t)}function XT(t){return Ac(this,t).has(t)}function ZT(t,e){return Ac(this,t).set(t,e),this}co.prototype.clear=WT;co.prototype.delete=YT;co.prototype.get=JT;co.prototype.has=XT;co.prototype.set=ZT;function xc(t,e){for(var r=t.length;r--;)if(rR(t[r][0],e))return r;return-1}function Ac(t,e){var r=t.__data__;return QT(e)?r[typeof e=="string"?"string":"hash"]:r.map}function Ev(t,e){var r=t[e];return oR(r)?r:void 0}function QT(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var eR=Nh(function(t){var e=[];return iR(t).replace(ET,function(r,n,o,i){e.push(o?i.replace(ST,"$1"):n||r)}),e});function tR(t){if(t!=null){try{return Cv.call(t)}catch{}try{return t+""}catch{}}return""}function Nh(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(wT);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(Nh.Cache||co),r}Nh.Cache=co;function rR(t,e){return t===e||t!==t&&e!==e}function nR(t){var e=_v(t)?TT.call(t):"";return e==vT||e==CT}function _v(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function oR(t){if(!_v(t))return!1;var e=nR(t)||$T(t)?RT:xT;return e.test(tR(t))}function iR(t){return t==null?"":bT(t)}Di.exports=eR});var tC=x((lo,vi)=>{var aR=Sv(),sR=200,Wh="__lodash_hash_undefined__",$c=1,Ci=2,uR=1/0,kv=9007199254740991,Oc="[object Arguments]",Uh="[object Array]",$v="[object Boolean]",Iv="[object Date]",Tv="[object Error]",Rv="[object Function]",cR="[object GeneratorFunction]",ns="[object Map]",Bv="[object Number]",wi="[object Object]",xv="[object Promise]",Nv="[object RegExp]",os="[object Set]",Yh="[object String]",Lv="[object Symbol]",Mh="[object WeakMap]",jv="[object ArrayBuffer]",Fc="[object DataView]",lR="[object Float32Array]",fR="[object Float64Array]",dR="[object Int8Array]",pR="[object Int16Array]",hR="[object Int32Array]",mR="[object Uint8Array]",gR="[object Uint8ClampedArray]",yR="[object Uint16Array]",DR="[object Uint32Array]",bR=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,wR=/^\w*$/,vR=/[\\^$.*+?()[\]{}|]/g,CR=/^\[object .+?Constructor\]$/,ER=/^(?:0|[1-9]\d*)$/,Ne={};Ne[lR]=Ne[fR]=Ne[dR]=Ne[pR]=Ne[hR]=Ne[mR]=Ne[gR]=Ne[yR]=Ne[DR]=!0;Ne[Oc]=Ne[Uh]=Ne[jv]=Ne[$v]=Ne[Fc]=Ne[Iv]=Ne[Tv]=Ne[Rv]=Ne[ns]=Ne[Bv]=Ne[wi]=Ne[Nv]=Ne[os]=Ne[Yh]=Ne[Mh]=!1;var as={function:!0,object:!0},_R=as[typeof lo]&&lo&&!lo.nodeType?lo:void 0,SR=as[typeof vi]&&vi&&!vi.nodeType?vi:void 0,xR=Ic(_R&&SR&&typeof global=="object"&&global),AR=Ic(as[typeof self]&&self),Av=Ic(as[typeof window]&&window),Lh=Ic(as[typeof lo]&&lo),ho=xR||Av!==(Lh&&Lh.window)&&Av||AR||Lh||Function("return this")();function OR(t,e){for(var r=-1,n=t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}function FR(t,e){for(var r=-1,n=t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}function PR(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function kR(t,e){return OR(e,function(r){return[r,t[r]]})}function Ic(t){return t&&t.Object===Object?t:null}function qh(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function Uv(t){var e=-1,r=Array(t.size);return t.forEach(function(n,o){r[++e]=[o,n]}),r}function $R(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}function IR(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=[n,n]}),r}var TR=Array.prototype,Tc=Object.prototype,Mv=Function.prototype.toString,fo=Tc.hasOwnProperty,mo=Tc.toString,RR=RegExp("^"+Mv.call(fo).replace(vR,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ov=ho.Symbol,Fv=ho.Uint8Array,BR=Tc.propertyIsEnumerable,NR=TR.splice,LR=Object.getPrototypeOf,jR=Object.keys,Hh=Ei(ho,"DataView"),Pc=Ei(ho,"Map"),Vh=Ei(ho,"Promise"),zh=Ei(ho,"Set"),Kh=Ei(ho,"WeakMap"),is=Ei(Object,"create"),UR=yo(Hh),MR=yo(Pc),qR=yo(Vh),HR=yo(zh),VR=yo(Kh),Pv=Ov?Ov.prototype:void 0,jh=Pv?Pv.valueOf:void 0;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 zR(){this.__data__=is?is(null):{}}function KR(t){return this.has(t)&&delete this.__data__[t]}function GR(t){var e=this.__data__;if(is){var r=e[t];return r===Wh?void 0:r}return fo.call(e,t)?e[t]:void 0}function WR(t){var e=this.__data__;return is?e[t]!==void 0:fo.call(e,t)}function YR(t,e){var r=this.__data__;return r[t]=is&&e===void 0?Wh:e,this}po.prototype.clear=zR;po.prototype.delete=KR;po.prototype.get=GR;po.prototype.has=WR;po.prototype.set=YR;function un(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 JR(){this.__data__=[]}function XR(t){var e=this.__data__,r=Rc(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():NR.call(e,r,1),!0}function ZR(t){var e=this.__data__,r=Rc(e,t);return r<0?void 0:e[r][1]}function QR(t){return Rc(this.__data__,t)>-1}function eB(t,e){var r=this.__data__,n=Rc(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}un.prototype.clear=JR;un.prototype.delete=XR;un.prototype.get=ZR;un.prototype.has=QR;un.prototype.set=eB;function go(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 tB(){this.__data__={hash:new po,map:new(Pc||un),string:new po}}function rB(t){return Bc(this,t).delete(t)}function nB(t){return Bc(this,t).get(t)}function oB(t){return Bc(this,t).has(t)}function iB(t,e){return Bc(this,t).set(t,e),this}go.prototype.clear=tB;go.prototype.delete=rB;go.prototype.get=nB;go.prototype.has=oB;go.prototype.set=iB;function kc(t){var e=-1,r=t?t.length:0;for(this.__data__=new go;++e<r;)this.add(t[e])}function aB(t){return this.__data__.set(t,Wh),this}function sB(t){return this.__data__.has(t)}kc.prototype.add=kc.prototype.push=aB;kc.prototype.has=sB;function sn(t){this.__data__=new un(t)}function uB(){this.__data__=new un}function cB(t){return this.__data__.delete(t)}function lB(t){return this.__data__.get(t)}function fB(t){return this.__data__.has(t)}function dB(t,e){var r=this.__data__;return r instanceof un&&r.__data__.length==sR&&(r=this.__data__=new go(r.__data__)),r.set(t,e),this}sn.prototype.clear=uB;sn.prototype.delete=cB;sn.prototype.get=lB;sn.prototype.has=fB;sn.prototype.set=dB;function Rc(t,e){for(var r=t.length;r--;)if(kB(t[r][0],e))return r;return-1}function qv(t,e){e=Nc(e,t)?[e]:zv(e);for(var r=0,n=e.length;t!=null&&r<n;)t=t[Lc(e[r++])];return r&&r==n?t:void 0}function Hv(t,e){return fo.call(t,e)||typeof t=="object"&&e in t&&xB(t)===null}function pB(t,e){return e in Object(t)}function Jh(t,e,r,n,o){return t===e?!0:t==null||e==null||!Uc(t)&&!ss(e)?t!==t&&e!==e:hB(t,e,Jh,r,n,o)}function hB(t,e,r,n,o,i){var a=In(t),s=In(e),u=Uh,c=Uh;a||(u=an(t),u=u==Oc?wi:u),s||(c=an(e),c=c==Oc?wi:c);var f=u==wi&&!qh(t),d=c==wi&&!qh(e),p=u==c;if(p&&!f)return i||(i=new sn),a||TB(t)?Kv(t,e,r,n,o,i):CB(t,e,u,r,n,o,i);if(!(o&Ci)){var h=f&&fo.call(t,"__wrapped__"),m=d&&fo.call(e,"__wrapped__");if(h||m){var y=h?t.value():t,D=m?e.value():e;return i||(i=new sn),r(y,D,n,o,i)}}return p?(i||(i=new sn),EB(t,e,r,n,o,i)):!1}function mB(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],f=s[1];if(a&&s[2]){if(c===void 0&&!(u in t))return!1}else{var d=new sn;if(n)var p=n(c,f,u,t,e,d);if(!(p===void 0?Jh(f,c,n,$c|Ci,d):p))return!1}}return!0}function gB(t){return typeof t=="function"?t:t==null?LB:typeof t=="object"?In(t)?bB(t[0],t[1]):DB(t):jB(t)}function yB(t){return jR(Object(t))}function DB(t){var e=SB(t);return e.length==1&&e[0][2]?Yv(e[0][0],e[0][1]):function(r){return r===t||mB(r,t,e)}}function bB(t,e){return Nc(t)&&Wv(e)?Yv(Lc(t),e):function(r){var n=RB(r,t);return n===void 0&&n===e?BB(r,t):Jh(e,n,void 0,$c|Ci)}}function Vv(t){return function(e){return e?.[t]}}function wB(t){return function(e){return qv(e,t)}}function zv(t){return In(t)?t:aR(t)}function vB(t){return function(e){var r=an(e);return r==ns?Uv(e):r==os?IR(e):kR(e,t(e))}}function Kv(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 f=-1,d=!0,p=o&$c?new kc:void 0;for(i.set(t,e);++f<s;){var h=t[f],m=e[f];if(n)var y=a?n(m,h,f,e,t,i):n(h,m,f,t,e,i);if(y!==void 0){if(y)continue;d=!1;break}if(p){if(!FR(e,function(D,v){if(!p.has(v)&&(h===D||r(h,D,n,o,i)))return p.add(v)})){d=!1;break}}else if(!(h===m||r(h,m,n,o,i))){d=!1;break}}return i.delete(t),d}function CB(t,e,r,n,o,i,a){switch(r){case Fc:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case jv:return!(t.byteLength!=e.byteLength||!n(new Fv(t),new Fv(e)));case $v:case Iv:return+t==+e;case Tv:return t.name==e.name&&t.message==e.message;case Bv:return t!=+t?e!=+e:t==+e;case Nv:case Yh:return t==e+"";case ns:var s=Uv;case os:var u=i&Ci;if(s||(s=$R),t.size!=e.size&&!u)return!1;var c=a.get(t);return c?c==e:(i|=$c,a.set(t,e),Kv(s(t),s(e),n,o,i,a));case Lv:if(jh)return jh.call(t)==jh.call(e)}return!1}function EB(t,e,r,n,o,i){var a=o&Ci,s=Gh(t),u=s.length,c=Gh(e),f=c.length;if(u!=f&&!a)return!1;for(var d=u;d--;){var p=s[d];if(!(a?p in e:Hv(e,p)))return!1}var h=i.get(t);if(h)return h==e;var m=!0;i.set(t,e);for(var y=a;++d<u;){p=s[d];var D=t[p],v=e[p];if(n)var E=a?n(v,D,p,e,t,i):n(D,v,p,t,e,i);if(!(E===void 0?D===v||r(D,v,n,o,i):E)){m=!1;break}y||(y=p=="constructor")}if(m&&!y){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 _B=Vv("length");function Bc(t,e){var r=t.__data__;return FB(e)?r[typeof e=="string"?"string":"hash"]:r.map}function SB(t){for(var e=NB(t),r=e.length;r--;)e[r][2]=Wv(e[r][1]);return e}function Ei(t,e){var r=t[e];return IB(r)?r:void 0}function xB(t){return LR(Object(t))}function an(t){return mo.call(t)}(Hh&&an(new Hh(new ArrayBuffer(1)))!=Fc||Pc&&an(new Pc)!=ns||Vh&&an(Vh.resolve())!=xv||zh&&an(new zh)!=os||Kh&&an(new Kh)!=Mh)&&(an=function(t){var e=mo.call(t),r=e==wi?t.constructor:void 0,n=r?yo(r):void 0;if(n)switch(n){case UR:return Fc;case MR:return ns;case qR:return xv;case HR:return os;case VR:return Mh}return e});function AB(t,e,r){e=Nc(e,t)?[e]:zv(e);for(var n,o=-1,a=e.length;++o<a;){var i=Lc(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&&jc(a)&&Gv(i,a)&&(In(t)||Qv(t)||Jv(t))}function OB(t){var e=t?t.length:void 0;return jc(e)&&(In(t)||Qv(t)||Jv(t))?PR(e,String):null}function Gv(t,e){return e=e??kv,!!e&&(typeof t=="number"||ER.test(t))&&t>-1&&t%1==0&&t<e}function Nc(t,e){if(In(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||eC(t)?!0:wR.test(t)||!bR.test(t)||e!=null&&t in Object(e)}function FB(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function PB(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Tc;return t===r}function Wv(t){return t===t&&!Uc(t)}function Yv(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}function Lc(t){if(typeof t=="string"||eC(t))return t;var e=t+"";return e=="0"&&1/t==-uR?"-0":e}function yo(t){if(t!=null){try{return Mv.call(t)}catch{}try{return t+""}catch{}}return""}function kB(t,e){return t===e||t!==t&&e!==e}function Jv(t){return $B(t)&&fo.call(t,"callee")&&(!BR.call(t,"callee")||mo.call(t)==Oc)}var In=Array.isArray;function Xv(t){return t!=null&&jc(_B(t))&&!Zv(t)}function $B(t){return ss(t)&&Xv(t)}function Zv(t){var e=Uc(t)?mo.call(t):"";return e==Rv||e==cR}function jc(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=kv}function Uc(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function ss(t){return!!t&&typeof t=="object"}function IB(t){if(!Uc(t))return!1;var e=Zv(t)||qh(t)?RR:CR;return e.test(yo(t))}function Qv(t){return typeof t=="string"||!In(t)&&ss(t)&&mo.call(t)==Yh}function eC(t){return typeof t=="symbol"||ss(t)&&mo.call(t)==Lv}function TB(t){return ss(t)&&jc(t.length)&&!!Ne[mo.call(t)]}function RB(t,e,r){var n=t==null?void 0:qv(t,e);return n===void 0?r:n}function BB(t,e){return t!=null&&AB(t,e,pB)}function Gh(t){var e=PB(t);if(!(e||Xv(t)))return yB(t);var r=OB(t),n=!!r,o=r||[],i=o.length;for(var a in t)Hv(t,a)&&!(n&&(a=="length"||Gv(a,i)))&&!(e&&a=="constructor")&&o.push(a);return o}var NB=vB(Gh);function LB(t){return t}function jB(t){return Nc(t)?Vv(Lc(t)):wB(t)}vi.exports=gB});var aC=x((Do,_i)=>{var UB=1/0,MB="[object Function]",qB="[object GeneratorFunction]",HB=/[\\^$.*+?()[\]{}|]/g,VB=/^\[object .+?Constructor\]$/,us={function:!0,object:!0},zB=us[typeof Do]&&Do&&!Do.nodeType?Do:void 0,KB=us[typeof _i]&&_i&&!_i.nodeType?_i:void 0,GB=Mc(zB&&KB&&typeof global=="object"&&global),WB=Mc(us[typeof self]&&self),rC=Mc(us[typeof window]&&window),Xh=Mc(us[typeof Do]&&Do),YB=GB||rC!==(Xh&&Xh.window)&&rC||WB||Xh||Function("return this")();function Mc(t){return t&&t.Object===Object?t:null}function JB(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function XB(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var nC=Object.prototype,oC=Function.prototype.toString,ZB=nC.hasOwnProperty,QB=nC.toString,e6=RegExp("^"+oC.call(ZB).replace(HB,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Zh=r6(YB,"Set"),t6=Zh&&1/XB(new Zh([,-0]))[1]==UB?function(t){return new Zh(t)}:a6;function r6(t,e){var r=t[e];return i6(r)?r:void 0}function n6(t){if(t!=null){try{return oC.call(t)}catch{}try{return t+""}catch{}}return""}function o6(t){var e=iC(t)?QB.call(t):"";return e==MB||e==qB}function iC(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function i6(t){if(!iC(t))return!1;var e=o6(t)||JB(t)?e6:VB;return e.test(n6(t))}function a6(){}_i.exports=t6});var uC=x((bo,Si)=>{var cs={function:!0,object:!0},s6=cs[typeof bo]&&bo&&!bo.nodeType?bo:void 0,u6=cs[typeof Si]&&Si&&!Si.nodeType?Si:void 0,c6=qc(s6&&u6&&typeof global=="object"&&global),l6=qc(cs[typeof self]&&self),sC=qc(cs[typeof window]&&window),Qh=qc(cs[typeof bo]&&bo),f6=c6||sC!==(Qh&&Qh.window)&&sC||l6||Qh||Function("return this")();function qc(t){return t&&t.Object===Object?t:null}Si.exports=f6});var hC=x((BK,pC)=>{var d6=aC(),p6=uC(),h6=200,em="__lodash_hash_undefined__",m6="[object Function]",g6="[object GeneratorFunction]",y6=/[\\^$.*+?()[\]{}|]/g,D6=/^\[object .+?Constructor\]$/;function b6(t,e){return!!t.length&&v6(t,e,0)>-1}function w6(t,e,r){for(var n=-1,o=t.length;++n<o;)if(r(e,t[n]))return!0;return!1}function v6(t,e,r){if(e!==e)return E6(t,r);for(var n=r-1,o=t.length;++n<o;)if(t[n]===e)return n;return-1}function C6(t,e){return t.has(e)}function E6(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 _6(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function S6(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var x6=Array.prototype,cC=Object.prototype,lC=Function.prototype.toString,tm=cC.hasOwnProperty,A6=cC.toString,O6=RegExp("^"+lC.call(tm).replace(y6,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),F6=x6.splice,P6=fC(p6,"Map"),ls=fC(Object,"create");function wo(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 k6(){this.__data__=ls?ls(null):{}}function $6(t){return this.has(t)&&delete this.__data__[t]}function I6(t){var e=this.__data__;if(ls){var r=e[t];return r===em?void 0:r}return tm.call(e,t)?e[t]:void 0}function T6(t){var e=this.__data__;return ls?e[t]!==void 0:tm.call(e,t)}function R6(t,e){var r=this.__data__;return r[t]=ls&&e===void 0?em:e,this}wo.prototype.clear=k6;wo.prototype.delete=$6;wo.prototype.get=I6;wo.prototype.has=T6;wo.prototype.set=R6;function xi(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 B6(){this.__data__=[]}function N6(t){var e=this.__data__,r=Vc(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():F6.call(e,r,1),!0}function L6(t){var e=this.__data__,r=Vc(e,t);return r<0?void 0:e[r][1]}function j6(t){return Vc(this.__data__,t)>-1}function U6(t,e){var r=this.__data__,n=Vc(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}xi.prototype.clear=B6;xi.prototype.delete=N6;xi.prototype.get=L6;xi.prototype.has=j6;xi.prototype.set=U6;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 M6(){this.__data__={hash:new wo,map:new(P6||xi),string:new wo}}function q6(t){return zc(this,t).delete(t)}function H6(t){return zc(this,t).get(t)}function V6(t){return zc(this,t).has(t)}function z6(t,e){return zc(this,t).set(t,e),this}Ai.prototype.clear=M6;Ai.prototype.delete=q6;Ai.prototype.get=H6;Ai.prototype.has=V6;Ai.prototype.set=z6;function Hc(t){var e=-1,r=t?t.length:0;for(this.__data__=new Ai;++e<r;)this.add(t[e])}function K6(t){return this.__data__.set(t,em),this}function G6(t){return this.__data__.has(t)}Hc.prototype.add=Hc.prototype.push=K6;Hc.prototype.has=G6;function Vc(t,e){for(var r=t.length;r--;)if(X6(t[r][0],e))return r;return-1}function W6(t,e,r){var n=-1,o=b6,i=t.length,a=!0,s=[],u=s;if(r)a=!1,o=w6;else if(i>=h6){var c=e?null:d6(t);if(c)return S6(c);a=!1,o=C6,u=new Hc}else u=e?[]:s;e:for(;++n<i;){var f=t[n],d=e?e(f):f;if(f=r||f!==0?f:0,a&&d===d){for(var p=u.length;p--;)if(u[p]===d)continue e;e&&u.push(d),s.push(f)}else o(u,d,r)||(u!==s&&u.push(d),s.push(f))}return s}function zc(t,e){var r=t.__data__;return Y6(e)?r[typeof e=="string"?"string":"hash"]:r.map}function fC(t,e){var r=t[e];return Q6(r)?r:void 0}function Y6(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function J6(t){if(t!=null){try{return lC.call(t)}catch{}try{return t+""}catch{}}return""}function X6(t,e){return t===e||t!==t&&e!==e}function Z6(t){var e=dC(t)?A6.call(t):"";return e==m6||e==g6}function dC(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function Q6(t){if(!dC(t))return!1;var e=Z6(t)||_6(t)?O6:D6;return e.test(J6(t))}pC.exports=W6});var gC=x((NK,mC)=>{var e8=tC(),t8=hC();function r8(t,e){return t&&t.length?t8(t,e8(e)):[]}mC.exports=r8});var DC=x((LK,yC)=>{"use strict";var n8=pv(),o8=gC(),i8=n8("MultiError");yC.exports=rm;function rm(t){if(!(this instanceof rm))return new rm(t);if(t=Array.isArray(t)?t:[t],t=o8(t,function(r){return r.stack}),t.length===1)return t[0];var e=new i8({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(`
43
43
 
44
44
  `)}),e.__defineSetter__("stack",function(r){return[r].concat(e.stack).join(`
45
45
 
46
- `)}),e}});var mC=x((IK,hC)=>{var Pn=require("constants"),t8=process.cwd,qc=null,r8=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return qc||(qc=t8.call(process)),qc};try{process.cwd()}catch{}typeof process.chdir=="function"&&(Zh=process.chdir,process.chdir=function(t){qc=null,Zh.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,Zh));var Zh;hC.exports=n8;function n8(t){Pn.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(f,d,p){p&&process.nextTick(p)},t.lchmodSync=function(){}),t.chown&&!t.lchown&&(t.lchown=function(f,d,p,h){h&&process.nextTick(h)},t.lchownSync=function(){}),r8==="win32"&&(t.rename=typeof t.rename!="function"?t.rename:(function(f){function d(p,h,m){var y=Date.now(),D=0;f(p,h,function v(E){if(E&&(E.code==="EACCES"||E.code==="EPERM"||E.code==="EBUSY")&&Date.now()-y<6e4){setTimeout(function(){t.stat(h,function(g,_){g&&g.code==="ENOENT"?f(p,h,v):m(E)})},D),D<100&&(D+=10);return}m&&m(E)})}return Object.setPrototypeOf&&Object.setPrototypeOf(d,f),d})(t.rename)),t.read=typeof t.read!="function"?t.read:(function(f){function d(p,h,m,y,D,v){var E;if(v&&typeof v=="function"){var g=0;E=function(_,S,P){if(_&&_.code==="EAGAIN"&&g<10)return g++,f.call(t,p,h,m,y,D,E);v.apply(this,arguments)}}return f.call(t,p,h,m,y,D,E)}return Object.setPrototypeOf&&Object.setPrototypeOf(d,f),d})(t.read),t.readSync=typeof t.readSync!="function"?t.readSync:(function(f){return function(d,p,h,m,y){for(var D=0;;)try{return f.call(t,d,p,h,m,y)}catch(v){if(v.code==="EAGAIN"&&D<10){D++;continue}throw v}}})(t.readSync);function e(f){f.lchmod=function(d,p,h){f.open(d,Pn.O_WRONLY|Pn.O_SYMLINK,p,function(m,y){if(m){h&&h(m);return}f.fchmod(y,p,function(D){f.close(y,function(v){h&&h(D||v)})})})},f.lchmodSync=function(d,p){var h=f.openSync(d,Pn.O_WRONLY|Pn.O_SYMLINK,p),m=!0,y;try{y=f.fchmodSync(h,p),m=!1}finally{if(m)try{f.closeSync(h)}catch{}else f.closeSync(h)}return y}}function r(f){Pn.hasOwnProperty("O_SYMLINK")&&f.futimes?(f.lutimes=function(d,p,h,m){f.open(d,Pn.O_SYMLINK,function(y,D){if(y){m&&m(y);return}f.futimes(D,p,h,function(v){f.close(D,function(E){m&&m(v||E)})})})},f.lutimesSync=function(d,p,h){var m=f.openSync(d,Pn.O_SYMLINK),y,D=!0;try{y=f.futimesSync(m,p,h),D=!1}finally{if(D)try{f.closeSync(m)}catch{}else f.closeSync(m)}return y}):f.futimes&&(f.lutimes=function(d,p,h,m){m&&process.nextTick(m)},f.lutimesSync=function(){})}function n(f){return f&&function(d,p,h){return f.call(t,d,p,function(m){c(m)&&(m=null),h&&h.apply(this,arguments)})}}function o(f){return f&&function(d,p){try{return f.call(t,d,p)}catch(h){if(!c(h))throw h}}}function i(f){return f&&function(d,p,h,m){return f.call(t,d,p,h,function(y){c(y)&&(y=null),m&&m.apply(this,arguments)})}}function a(f){return f&&function(d,p,h){try{return f.call(t,d,p,h)}catch(m){if(!c(m))throw m}}}function s(f){return f&&function(d,p,h){typeof p=="function"&&(h=p,p=null);function m(y,D){D&&(D.uid<0&&(D.uid+=4294967296),D.gid<0&&(D.gid+=4294967296)),h&&h.apply(this,arguments)}return p?f.call(t,d,p,m):f.call(t,d,m)}}function u(f){return f&&function(d,p){var h=p?f.call(t,d,p):f.call(t,d);return h&&(h.uid<0&&(h.uid+=4294967296),h.gid<0&&(h.gid+=4294967296)),h}}function c(f){if(!f||f.code==="ENOSYS")return!0;var d=!process.getuid||process.getuid()!==0;return!!(d&&(f.code==="EINVAL"||f.code==="EPERM"))}}});var DC=x((TK,yC)=>{var gC=require("stream").Stream;yC.exports=o8;function o8(t){return{ReadStream:e,WriteStream:r};function e(n,o){if(!(this instanceof e))return new e(n,o);gC.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(f,d){if(f){i.emit("error",f),i.readable=!1;return}i.fd=d,i.emit("open",d),i._read()})}function r(n,o){if(!(this instanceof r))return new r(n,o);gC.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 wC=x((RK,bC)=>{"use strict";bC.exports=a8;var i8=Object.getPrototypeOf||function(t){return t.__proto__};function a8(t){if(t===null||typeof t!="object")return t;if(t instanceof Object)var e={__proto__:i8(t)};else var e=Object.create(null);return Object.getOwnPropertyNames(t).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}});var $n=x((BK,tm)=>{var Ke=require("fs"),s8=mC(),u8=DC(),c8=wC(),Hc=require("util"),yt,zc;typeof Symbol=="function"&&typeof Symbol.for=="function"?(yt=Symbol.for("graceful-fs.queue"),zc=Symbol.for("graceful-fs.previous")):(yt="___graceful-fs.queue",zc="___graceful-fs.previous");function l8(){}function EC(t,e){Object.defineProperty(t,yt,{get:function(){return e}})}var bo=l8;Hc.debuglog?bo=Hc.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(bo=function(){var t=Hc.format.apply(Hc,arguments);t="GFS4: "+t.split(/\n/).join(`
47
- GFS4: `),console.error(t)});Ke[yt]||(vC=global[yt]||[],EC(Ke,vC),Ke.close=(function(t){function e(r,n){return t.call(Ke,r,function(o){o||CC(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(e,zc,{value:t}),e})(Ke.close),Ke.closeSync=(function(t){function e(r){t.apply(Ke,arguments),CC()}return Object.defineProperty(e,zc,{value:t}),e})(Ke.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){bo(Ke[yt]),require("assert").equal(Ke[yt].length,0)}));var vC;global[yt]||EC(global,Ke[yt]);tm.exports=Qh(c8(Ke));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!Ke.__patched&&(tm.exports=Qh(Ke),Ke.__patched=!0);function Qh(t){s8(t),t.gracefulify=Qh,t.createReadStream=S,t.createWriteStream=P;var e=t.readFile;t.readFile=r;function r(T,j,A){return typeof j=="function"&&(A=j,j=null),M(T,j,A);function M(L,X,k,b){return e(L,X,function(w){w&&(w.code==="EMFILE"||w.code==="ENFILE")?Oi([M,[L,X,k],w,b||Date.now(),Date.now()]):typeof k=="function"&&k.apply(this,arguments)})}}var n=t.writeFile;t.writeFile=o;function o(T,j,A,M){return typeof A=="function"&&(M=A,A=null),L(T,j,A,M);function L(X,k,b,w,C){return n(X,k,b,function(O){O&&(O.code==="EMFILE"||O.code==="ENFILE")?Oi([L,[X,k,b,w],O,C||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}var i=t.appendFile;i&&(t.appendFile=a);function a(T,j,A,M){return typeof A=="function"&&(M=A,A=null),L(T,j,A,M);function L(X,k,b,w,C){return i(X,k,b,function(O){O&&(O.code==="EMFILE"||O.code==="ENFILE")?Oi([L,[X,k,b,w],O,C||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}var s=t.copyFile;s&&(t.copyFile=u);function u(T,j,A,M){return typeof A=="function"&&(M=A,A=0),L(T,j,A,M);function L(X,k,b,w,C){return s(X,k,b,function(O){O&&(O.code==="EMFILE"||O.code==="ENFILE")?Oi([L,[X,k,b,w],O,C||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}var c=t.readdir;t.readdir=d;var f=/^v[0-5]\./;function d(T,j,A){typeof j=="function"&&(A=j,j=null);var M=f.test(process.version)?function(k,b,w,C){return c(k,L(k,b,w,C))}:function(k,b,w,C){return c(k,b,L(k,b,w,C))};return M(T,j,A);function L(X,k,b,w){return function(C,O){C&&(C.code==="EMFILE"||C.code==="ENFILE")?Oi([M,[X,k,b],C,w||Date.now(),Date.now()]):(O&&O.sort&&O.sort(),typeof b=="function"&&b.call(this,C,O))}}}if(process.version.substr(0,4)==="v0.8"){var p=u8(t);v=p.ReadStream,g=p.WriteStream}var h=t.ReadStream;h&&(v.prototype=Object.create(h.prototype),v.prototype.open=E);var m=t.WriteStream;m&&(g.prototype=Object.create(m.prototype),g.prototype.open=_),Object.defineProperty(t,"ReadStream",{get:function(){return v},set:function(T){v=T},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WriteStream",{get:function(){return g},set:function(T){g=T},enumerable:!0,configurable:!0});var y=v;Object.defineProperty(t,"FileReadStream",{get:function(){return y},set:function(T){y=T},enumerable:!0,configurable:!0});var D=g;Object.defineProperty(t,"FileWriteStream",{get:function(){return D},set:function(T){D=T},enumerable:!0,configurable:!0});function v(T,j){return this instanceof v?(h.apply(this,arguments),this):v.apply(Object.create(v.prototype),arguments)}function E(){var T=this;B(T.path,T.flags,T.mode,function(j,A){j?(T.autoClose&&T.destroy(),T.emit("error",j)):(T.fd=A,T.emit("open",A),T.read())})}function g(T,j){return this instanceof g?(m.apply(this,arguments),this):g.apply(Object.create(g.prototype),arguments)}function _(){var T=this;B(T.path,T.flags,T.mode,function(j,A){j?(T.destroy(),T.emit("error",j)):(T.fd=A,T.emit("open",A))})}function S(T,j){return new t.ReadStream(T,j)}function P(T,j){return new t.WriteStream(T,j)}var F=t.open;t.open=B;function B(T,j,A,M){return typeof A=="function"&&(M=A,A=null),L(T,j,A,M);function L(X,k,b,w,C){return F(X,k,b,function(O,R){O&&(O.code==="EMFILE"||O.code==="ENFILE")?Oi([L,[X,k,b,w],O,C||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}return t}function Oi(t){bo("ENQUEUE",t[0].name,t[1]),Ke[yt].push(t),em()}var Vc;function CC(){for(var t=Date.now(),e=0;e<Ke[yt].length;++e)Ke[yt][e].length>2&&(Ke[yt][e][3]=t,Ke[yt][e][4]=t);em()}function em(){if(clearTimeout(Vc),Vc=void 0,Ke[yt].length!==0){var t=Ke[yt].shift(),e=t[0],r=t[1],n=t[2],o=t[3],i=t[4];if(o===void 0)bo("RETRY",e.name,r),e.apply(null,r);else if(Date.now()-o>=6e4){bo("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?(bo("RETRY",e.name,r),e.apply(null,r.concat([o]))):Ke[yt].push(t)}Vc===void 0&&(Vc=setTimeout(em,0))}}});var SC=x((NK,_C)=>{function hr(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))}_C.exports=hr;hr.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};hr.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};hr.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};hr.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)};hr.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};hr.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};hr.prototype.start=hr.prototype.try;hr.prototype.errors=function(){return this._errors};hr.prototype.attempts=function(){return this._attempts};hr.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 xC=x(wo=>{var f8=SC();wo.operation=function(t){var e=wo.timeouts(t);return new f8(e,{forever:t&&t.forever,unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};wo.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};wo.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};wo.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=wo.operation(e),f=Array.prototype.slice.call(arguments,1),d=f.pop();f.push(function(p){c.retry(p)||(p&&(arguments[0]=c.mainError()),d.apply(this,arguments))}),c.attempt(function(){u.apply(t,f)})}.bind(t,a),t[i].options=e}}});var OC=x((jK,AC)=>{AC.exports=xC()});var FC=x((UK,Kc)=>{Kc.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&Kc.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Kc.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var om=x((MK,Pi)=>{var Ue=global.process,vo=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"};vo(Ue)?(kC=require("assert"),Fi=FC(),PC=/^win/i.test(Ue.platform),ls=require("events"),typeof ls!="function"&&(ls=ls.EventEmitter),Ue.__signal_exit_emitter__?at=Ue.__signal_exit_emitter__:(at=Ue.__signal_exit_emitter__=new ls,at.count=0,at.emitted={}),at.infinite||(at.setMaxListeners(1/0),at.infinite=!0),Pi.exports=function(t,e){if(!vo(global.process))return function(){};kC.equal(typeof t,"function","a callback must be provided for exit handler"),ki===!1&&rm();var r="exit";e&&e.alwaysLast&&(r="afterexit");var n=function(){at.removeListener(r,t),at.listeners("exit").length===0&&at.listeners("afterexit").length===0&&Gc()};return at.on(r,t),n},Gc=function(){!ki||!vo(global.process)||(ki=!1,Fi.forEach(function(e){try{Ue.removeListener(e,Wc[e])}catch{}}),Ue.emit=Yc,Ue.reallyExit=nm,at.count-=1)},Pi.exports.unload=Gc,Co=function(e,r,n){at.emitted[e]||(at.emitted[e]=!0,at.emit(e,r,n))},Wc={},Fi.forEach(function(t){Wc[t]=function(){if(vo(global.process)){var r=Ue.listeners(t);r.length===at.count&&(Gc(),Co("exit",null,t),Co("afterexit",null,t),PC&&t==="SIGHUP"&&(t="SIGINT"),Ue.kill(Ue.pid,t))}}}),Pi.exports.signals=function(){return Fi},ki=!1,rm=function(){ki||!vo(global.process)||(ki=!0,at.count+=1,Fi=Fi.filter(function(e){try{return Ue.on(e,Wc[e]),!0}catch{return!1}}),Ue.emit=IC,Ue.reallyExit=$C)},Pi.exports.load=rm,nm=Ue.reallyExit,$C=function(e){vo(global.process)&&(Ue.exitCode=e||0,Co("exit",Ue.exitCode,null),Co("afterexit",Ue.exitCode,null),nm.call(Ue,Ue.exitCode))},Yc=Ue.emit,IC=function(e,r){if(e==="exit"&&vo(global.process)){r!==void 0&&(Ue.exitCode=r);var n=Yc.apply(this,arguments);return Co("exit",Ue.exitCode,null),Co("afterexit",Ue.exitCode,null),n}else return Yc.apply(this,arguments)}):Pi.exports=function(){return function(){}};var kC,Fi,PC,ls,at,Gc,Co,Wc,ki,rm,nm,$C,Yc,IC});var RC=x((qK,im)=>{"use strict";var TC=Symbol();function d8(t,e,r){let n=e[TC];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,TC,{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)}im.exports.probe=d8;im.exports.getMtime=p8});var UC=x((HK,ds)=>{"use strict";var h8=require("path"),um=$n(),m8=OC(),g8=om(),BC=RC(),on={};function fs(t,e){return e.lockfilePath||`${t}.lock`}function cm(t,e,r){if(!e.realpath)return r(null,h8.resolve(t));e.fs.realpath(t,r)}function sm(t,e,r){let n=fs(t,e);e.fs.mkdir(n,o=>{if(!o)return BC.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"?sm(t,{...e,stale:0},r):r(i);if(!NC(a,e))return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:t}));LC(t,e,s=>{if(s)return r(s);sm(t,{...e,stale:0},r)})})})}function NC(t,e){return t.mtime.getTime()<Date.now()-e.stale}function LC(t,e,r){e.fs.rmdir(fs(t,e),n=>{if(n&&n.code!=="ENOENT")return r(n);r()})}function Jc(t,e){let r=on[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?am(t,r,Object.assign(n,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,Jc(t,e));if(!(r.mtime.getTime()===o.mtime.getTime()))return am(t,r,Object.assign(new Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let s=BC.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?am(t,r,Object.assign(u,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,Jc(t,e));r.mtime=s,r.lastUpdate=Date.now(),r.updateDelay=null,Jc(t,e)}})})},r.updateDelay),r.updateTimeout.unref&&r.updateTimeout.unref())}function am(t,e,r){e.released=!0,e.updateTimeout&&clearTimeout(e.updateTimeout),on[t]===e&&delete on[t],e.options.onCompromised(r)}function y8(t,e,r){e={stale:1e4,update:null,realpath:!0,retries:0,fs:um,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),cm(t,e,(n,o)=>{if(n)return r(n);let i=m8.operation(e.retries);i.attempt(()=>{sm(o,e,(a,s,u)=>{if(i.retry(a))return;if(a)return r(i.mainError());let c=on[o]={lockfilePath:fs(o,e),mtime:s,mtimePrecision:u,options:e,lastUpdate:Date.now()};Jc(o,e),r(null,f=>{if(c.released)return f&&f(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));jC(o,{...e,realpath:!1},f)})})})})}function jC(t,e,r){e={fs:um,realpath:!0,...e},cm(t,e,(n,o)=>{if(n)return r(n);let i=on[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 on[o],LC(o,e,r)})}function D8(t,e,r){e={stale:1e4,realpath:!0,fs:um,...e},e.stale=Math.max(e.stale||0,2e3),cm(t,e,(n,o)=>{if(n)return r(n);e.fs.stat(fs(o,e),(i,a)=>i?i.code==="ENOENT"?r(null,!1):r(i):r(null,!NC(a,e)))})}function b8(){return on}g8(()=>{for(let t in on){let e=on[t].options;try{e.fs.rmdirSync(fs(t,e))}catch{}}});ds.exports.lock=y8;ds.exports.unlock=jC;ds.exports.check=D8;ds.exports.getLocks=b8});var qC=x((VK,MC)=>{"use strict";var w8=$n();function v8(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 C8(t){return(...e)=>new Promise((r,n)=>{e.push((o,i)=>{o?n(o):r(i)}),t(...e)})}function E8(t){return(...e)=>{let r,n;if(e.push((o,i)=>{r=o,n=i}),t(...e),r)throw r;return n}}function _8(t){if(t={...t},t.fs=v8(t.fs||w8),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:C8,toSync:E8,toSyncOptions:_8}});var VC=x((zK,In)=>{"use strict";var $i=UC(),{toPromise:Xc,toSync:Zc,toSyncOptions:lm}=qC();async function HC(t,e){let r=await Xc($i.lock)(t,e);return Xc(r)}function S8(t,e){let r=Zc($i.lock)(t,lm(e));return Zc(r)}function x8(t,e){return Xc($i.unlock)(t,e)}function A8(t,e){return Zc($i.unlock)(t,lm(e))}function O8(t,e){return Xc($i.check)(t,e)}function F8(t,e){return Zc($i.check)(t,lm(e))}In.exports=HC;In.exports.lock=HC;In.exports.unlock=x8;In.exports.lockSync=S8;In.exports.unlockSync=A8;In.exports.check=O8;In.exports.checkSync=F8});var YC=x(Ii=>{"use strict";Object.defineProperty(Ii,"__esModule",{value:!0});Ii.canStoreURLs=Ii.FileUrlStorage=void 0;var zC=require("fs"),k8=$8(pC()),KC=P8(VC());function WC(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(WC=function(n){return n?r:e})(t)}function P8(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=WC(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 ps(t){"@babel/helpers - typeof";return ps=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},ps(t)}function I8(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function GC(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,R8(n.key),n)}}function T8(t,e,r){return e&&GC(t.prototype,e),r&&GC(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function R8(t){var e=B8(t,"string");return ps(e)=="symbol"?e:e+""}function B8(t,e){if(ps(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ps(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var KK=Ii.canStoreURLs=!0,GK=Ii.FileUrlStorage=(function(){function t(e){I8(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;KC.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;KC.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,k8.default)([o,i]))});return}r().then(n).catch(n)}}},{key:"_writeData",value:function(r,n){var o={encoding:"utf8",mode:432,flag:"w"};(0,zC.writeFile)(this.path,JSON.stringify(r),o,function(i){return n(i)})}},{key:"_getData",value:function(r){(0,zC.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 el=x(Kt=>{"use strict";Object.defineProperty(Kt,"__esModule",{value:!0});Object.defineProperty(Kt,"DefaultHttpStack",{enumerable:!0,get:function(){return QC.default}});Object.defineProperty(Kt,"DetailedError",{enumerable:!0,get:function(){return N8.default}});Object.defineProperty(Kt,"FileUrlStorage",{enumerable:!0,get:function(){return eE.FileUrlStorage}});Object.defineProperty(Kt,"StreamSource",{enumerable:!0,get:function(){return q8.default}});Kt.Upload=void 0;Object.defineProperty(Kt,"canStoreURLs",{enumerable:!0,get:function(){return eE.canStoreURLs}});Kt.defaultOptions=void 0;Object.defineProperty(Kt,"enableDebugLog",{enumerable:!0,get:function(){return L8.enableDebugLog}});Kt.isSupported=void 0;var N8=Eo(ah()),L8=sh(),j8=Eo(Yb()),fm=Eo(Sw()),U8=Eo(Lw()),M8=Eo(qw()),QC=Eo(rv()),q8=Eo(vh()),eE=YC();function Eo(t){return t&&t.__esModule?t:{default:t}}function Ri(t){"@babel/helpers - typeof";return Ri=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},Ri(t)}function H8(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function JC(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,rE(n.key),n)}}function V8(t,e,r){return e&&JC(t.prototype,e),r&&JC(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function z8(t,e,r){return e=Qc(e),K8(t,tE()?Reflect.construct(e,r||[],Qc(t).constructor):e.apply(t,r))}function K8(t,e){if(e&&(Ri(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 tE(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(tE=function(){return!!t})()}function Qc(t){return Qc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Qc(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&&dm(t,e)}function dm(t,e){return dm=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},dm(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 Ti(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){Y8(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 Y8(t,e,r){return e=rE(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function rE(t){var e=J8(t,"string");return Ri(e)=="symbol"?e:e+""}function J8(t,e){if(Ri(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Ri(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var ZC=Kt.defaultOptions=Ti(Ti({},fm.default.defaultOptions),{},{httpStack:new QC.default,fileReader:new U8.default,urlStorage:new j8.default,fingerprint:M8.default}),YK=Kt.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 H8(this,e),n=Ti(Ti({},ZC),n),z8(this,e,[r,n])}return W8(e,t),V8(e,null,[{key:"terminate",value:function(n){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return o=Ti(Ti({},ZC),o),fm.default.terminate(n,o)}}])})(fm.default),JK=Kt.isSupported=!0});var sE=x((dG,aE)=>{var Bi=1e3,Ni=Bi*60,Li=Ni*60,_o=Li*24,iN=_o*7,aN=_o*365.25;aE.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return sN(t);if(r==="number"&&isFinite(t))return e.long?cN(t):uN(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function sN(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*aN;case"weeks":case"week":case"w":return r*iN;case"days":case"day":case"d":return r*_o;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Li;case"minutes":case"minute":case"mins":case"min":case"m":return r*Ni;case"seconds":case"second":case"secs":case"sec":case"s":return r*Bi;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function uN(t){var e=Math.abs(t);return e>=_o?Math.round(t/_o)+"d":e>=Li?Math.round(t/Li)+"h":e>=Ni?Math.round(t/Ni)+"m":e>=Bi?Math.round(t/Bi)+"s":t+"ms"}function cN(t){var e=Math.abs(t);return e>=_o?rl(t,e,_o,"day"):e>=Li?rl(t,e,Li,"hour"):e>=Ni?rl(t,e,Ni,"minute"):e>=Bi?rl(t,e,Bi,"second"):t+" ms"}function rl(t,e,r,n){var o=e>=r*1.5;return Math.round(t/r)+" "+n+(o?"s":"")}});var mm=x((pG,uE)=>{function lN(t){r.debug=r,r.default=r,r.coerce=u,r.disable=a,r.enable=o,r.enabled=s,r.humanize=sE(),r.destroy=c,Object.keys(t).forEach(f=>{r[f]=t[f]}),r.names=[],r.skips=[],r.formatters={};function e(f){let d=0;for(let p=0;p<f.length;p++)d=(d<<5)-d+f.charCodeAt(p),d|=0;return r.colors[Math.abs(d)%r.colors.length]}r.selectColor=e;function r(f){let d,p=null,h,m;function y(...D){if(!y.enabled)return;let v=y,E=Number(new Date),g=E-(d||E);v.diff=g,v.prev=d,v.curr=E,d=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,(P,F)=>{if(P==="%%")return"%";_++;let B=r.formatters[F];if(typeof B=="function"){let T=D[_];P=B.call(v,T),D.splice(_,1),_--}return P}),r.formatArgs.call(v,D),(v.log||r.log).apply(v,D)}return y.namespace=f,y.useColors=r.useColors(),y.color=r.selectColor(f),y.extend=n,y.destroy=r.destroy,Object.defineProperty(y,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(h!==r.namespaces&&(h=r.namespaces,m=r.enabled(f)),m),set:D=>{p=D}}),typeof r.init=="function"&&r.init(y),y}function n(f,d){let p=r(this.namespace+(typeof d>"u"?":":d)+f);return p.log=this.log,p}function o(f){r.save(f),r.namespaces=f,r.names=[],r.skips=[];let d=(typeof f=="string"?f:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let p of d)p[0]==="-"?r.skips.push(p.slice(1)):r.names.push(p)}function i(f,d){let p=0,h=0,m=-1,y=0;for(;p<f.length;)if(h<d.length&&(d[h]===f[p]||d[h]==="*"))d[h]==="*"?(m=h,y=p,h++):(p++,h++);else if(m!==-1)h=m+1,y++,p=y;else return!1;for(;h<d.length&&d[h]==="*";)h++;return h===d.length}function a(){let f=[...r.names,...r.skips.map(d=>"-"+d)].join(",");return r.enable(""),f}function s(f){for(let d of r.skips)if(i(f,d))return!1;for(let d of r.names)if(i(f,d))return!0;return!1}function u(f){return f instanceof Error?f.stack||f.message:f}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}uE.exports=lN});var cE=x((Gt,nl)=>{Gt.formatArgs=dN;Gt.save=pN;Gt.load=hN;Gt.useColors=fN;Gt.storage=mN();Gt.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`."))}})();Gt.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 fN(){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 dN(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+nl.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)}Gt.log=console.debug||console.log||(()=>{});function pN(t){try{t?Gt.storage.setItem("debug",t):Gt.storage.removeItem("debug")}catch{}}function hN(){let t;try{t=Gt.storage.getItem("debug")||Gt.storage.getItem("DEBUG")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function mN(){try{return localStorage}catch{}}nl.exports=mm()(Gt);var{formatters:gN}=nl.exports;gN.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var fE=x((hG,lE)=>{"use strict";lE.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 hE=x((mG,pE)=>{"use strict";var yN=require("os"),dE=require("tty"),gr=fE(),{env:ut}=process,Tn;gr("no-color")||gr("no-colors")||gr("color=false")||gr("color=never")?Tn=0:(gr("color")||gr("colors")||gr("color=true")||gr("color=always"))&&(Tn=1);"FORCE_COLOR"in ut&&(ut.FORCE_COLOR==="true"?Tn=1:ut.FORCE_COLOR==="false"?Tn=0:Tn=ut.FORCE_COLOR.length===0?1:Math.min(parseInt(ut.FORCE_COLOR,10),3));function gm(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function ym(t,e){if(Tn===0)return 0;if(gr("color=16m")||gr("color=full")||gr("color=truecolor"))return 3;if(gr("color=256"))return 2;if(t&&!e&&Tn===void 0)return 0;let r=Tn||0;if(ut.TERM==="dumb")return r;if(process.platform==="win32"){let n=yN.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in ut)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in ut)||ut.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in ut)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(ut.TEAMCITY_VERSION)?1:0;if(ut.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in ut){let n=parseInt((ut.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(ut.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(ut.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(ut.TERM)||"COLORTERM"in ut?1:r}function DN(t){let e=ym(t,t&&t.isTTY);return gm(e)}pE.exports={supportsColor:DN,stdout:gm(ym(!0,dE.isatty(1))),stderr:gm(ym(!0,dE.isatty(2)))}});var gE=x((ct,il)=>{var bN=require("tty"),ol=require("util");ct.init=xN;ct.log=EN;ct.formatArgs=vN;ct.save=_N;ct.load=SN;ct.useColors=wN;ct.destroy=ol.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");ct.colors=[6,2,3,4,5,1];try{let t=hE();t&&(t.stderr||t).level>=2&&(ct.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{}ct.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 wN(){return"colors"in ct.inspectOpts?!!ct.inspectOpts.colors:bN.isatty(process.stderr.fd)}function vN(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(`
46
+ `)}),e}});var wC=x((jK,bC)=>{var Tn=require("constants"),a8=process.cwd,Kc=null,s8=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return Kc||(Kc=a8.call(process)),Kc};try{process.cwd()}catch{}typeof process.chdir=="function"&&(nm=process.chdir,process.chdir=function(t){Kc=null,nm.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,nm));var nm;bC.exports=u8;function u8(t){Tn.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(f,d,p){p&&process.nextTick(p)},t.lchmodSync=function(){}),t.chown&&!t.lchown&&(t.lchown=function(f,d,p,h){h&&process.nextTick(h)},t.lchownSync=function(){}),s8==="win32"&&(t.rename=typeof t.rename!="function"?t.rename:(function(f){function d(p,h,m){var y=Date.now(),D=0;f(p,h,function v(E){if(E&&(E.code==="EACCES"||E.code==="EPERM"||E.code==="EBUSY")&&Date.now()-y<6e4){setTimeout(function(){t.stat(h,function(g,_){g&&g.code==="ENOENT"?f(p,h,v):m(E)})},D),D<100&&(D+=10);return}m&&m(E)})}return Object.setPrototypeOf&&Object.setPrototypeOf(d,f),d})(t.rename)),t.read=typeof t.read!="function"?t.read:(function(f){function d(p,h,m,y,D,v){var E;if(v&&typeof v=="function"){var g=0;E=function(_,S,k){if(_&&_.code==="EAGAIN"&&g<10)return g++,f.call(t,p,h,m,y,D,E);v.apply(this,arguments)}}return f.call(t,p,h,m,y,D,E)}return Object.setPrototypeOf&&Object.setPrototypeOf(d,f),d})(t.read),t.readSync=typeof t.readSync!="function"?t.readSync:(function(f){return function(d,p,h,m,y){for(var D=0;;)try{return f.call(t,d,p,h,m,y)}catch(v){if(v.code==="EAGAIN"&&D<10){D++;continue}throw v}}})(t.readSync);function e(f){f.lchmod=function(d,p,h){f.open(d,Tn.O_WRONLY|Tn.O_SYMLINK,p,function(m,y){if(m){h&&h(m);return}f.fchmod(y,p,function(D){f.close(y,function(v){h&&h(D||v)})})})},f.lchmodSync=function(d,p){var h=f.openSync(d,Tn.O_WRONLY|Tn.O_SYMLINK,p),m=!0,y;try{y=f.fchmodSync(h,p),m=!1}finally{if(m)try{f.closeSync(h)}catch{}else f.closeSync(h)}return y}}function r(f){Tn.hasOwnProperty("O_SYMLINK")&&f.futimes?(f.lutimes=function(d,p,h,m){f.open(d,Tn.O_SYMLINK,function(y,D){if(y){m&&m(y);return}f.futimes(D,p,h,function(v){f.close(D,function(E){m&&m(v||E)})})})},f.lutimesSync=function(d,p,h){var m=f.openSync(d,Tn.O_SYMLINK),y,D=!0;try{y=f.futimesSync(m,p,h),D=!1}finally{if(D)try{f.closeSync(m)}catch{}else f.closeSync(m)}return y}):f.futimes&&(f.lutimes=function(d,p,h,m){m&&process.nextTick(m)},f.lutimesSync=function(){})}function n(f){return f&&function(d,p,h){return f.call(t,d,p,function(m){c(m)&&(m=null),h&&h.apply(this,arguments)})}}function o(f){return f&&function(d,p){try{return f.call(t,d,p)}catch(h){if(!c(h))throw h}}}function i(f){return f&&function(d,p,h,m){return f.call(t,d,p,h,function(y){c(y)&&(y=null),m&&m.apply(this,arguments)})}}function a(f){return f&&function(d,p,h){try{return f.call(t,d,p,h)}catch(m){if(!c(m))throw m}}}function s(f){return f&&function(d,p,h){typeof p=="function"&&(h=p,p=null);function m(y,D){D&&(D.uid<0&&(D.uid+=4294967296),D.gid<0&&(D.gid+=4294967296)),h&&h.apply(this,arguments)}return p?f.call(t,d,p,m):f.call(t,d,m)}}function u(f){return f&&function(d,p){var h=p?f.call(t,d,p):f.call(t,d);return h&&(h.uid<0&&(h.uid+=4294967296),h.gid<0&&(h.gid+=4294967296)),h}}function c(f){if(!f||f.code==="ENOSYS")return!0;var d=!process.getuid||process.getuid()!==0;return!!(d&&(f.code==="EINVAL"||f.code==="EPERM"))}}});var EC=x((UK,CC)=>{var vC=require("stream").Stream;CC.exports=c8;function c8(t){return{ReadStream:e,WriteStream:r};function e(n,o){if(!(this instanceof e))return new e(n,o);vC.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(f,d){if(f){i.emit("error",f),i.readable=!1;return}i.fd=d,i.emit("open",d),i._read()})}function r(n,o){if(!(this instanceof r))return new r(n,o);vC.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 SC=x((MK,_C)=>{"use strict";_C.exports=f8;var l8=Object.getPrototypeOf||function(t){return t.__proto__};function f8(t){if(t===null||typeof t!="object")return t;if(t instanceof Object)var e={__proto__:l8(t)};else var e=Object.create(null);return Object.getOwnPropertyNames(t).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}});var Rn=x((qK,am)=>{var Ge=require("fs"),d8=wC(),p8=EC(),h8=SC(),Gc=require("util"),Dt,Yc;typeof Symbol=="function"&&typeof Symbol.for=="function"?(Dt=Symbol.for("graceful-fs.queue"),Yc=Symbol.for("graceful-fs.previous")):(Dt="___graceful-fs.queue",Yc="___graceful-fs.previous");function m8(){}function OC(t,e){Object.defineProperty(t,Dt,{get:function(){return e}})}var vo=m8;Gc.debuglog?vo=Gc.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(vo=function(){var t=Gc.format.apply(Gc,arguments);t="GFS4: "+t.split(/\n/).join(`
47
+ GFS4: `),console.error(t)});Ge[Dt]||(xC=global[Dt]||[],OC(Ge,xC),Ge.close=(function(t){function e(r,n){return t.call(Ge,r,function(o){o||AC(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(e,Yc,{value:t}),e})(Ge.close),Ge.closeSync=(function(t){function e(r){t.apply(Ge,arguments),AC()}return Object.defineProperty(e,Yc,{value:t}),e})(Ge.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){vo(Ge[Dt]),require("assert").equal(Ge[Dt].length,0)}));var xC;global[Dt]||OC(global,Ge[Dt]);am.exports=om(h8(Ge));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!Ge.__patched&&(am.exports=om(Ge),Ge.__patched=!0);function om(t){d8(t),t.gracefulify=om,t.createReadStream=S,t.createWriteStream=k;var e=t.readFile;t.readFile=r;function r(T,j,A){return typeof j=="function"&&(A=j,j=null),M(T,j,A);function M(L,X,P,b){return e(L,X,function(w){w&&(w.code==="EMFILE"||w.code==="ENFILE")?Oi([M,[L,X,P],w,b||Date.now(),Date.now()]):typeof P=="function"&&P.apply(this,arguments)})}}var n=t.writeFile;t.writeFile=o;function o(T,j,A,M){return typeof A=="function"&&(M=A,A=null),L(T,j,A,M);function L(X,P,b,w,C){return n(X,P,b,function(O){O&&(O.code==="EMFILE"||O.code==="ENFILE")?Oi([L,[X,P,b,w],O,C||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}var i=t.appendFile;i&&(t.appendFile=a);function a(T,j,A,M){return typeof A=="function"&&(M=A,A=null),L(T,j,A,M);function L(X,P,b,w,C){return i(X,P,b,function(O){O&&(O.code==="EMFILE"||O.code==="ENFILE")?Oi([L,[X,P,b,w],O,C||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}var s=t.copyFile;s&&(t.copyFile=u);function u(T,j,A,M){return typeof A=="function"&&(M=A,A=0),L(T,j,A,M);function L(X,P,b,w,C){return s(X,P,b,function(O){O&&(O.code==="EMFILE"||O.code==="ENFILE")?Oi([L,[X,P,b,w],O,C||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}var c=t.readdir;t.readdir=d;var f=/^v[0-5]\./;function d(T,j,A){typeof j=="function"&&(A=j,j=null);var M=f.test(process.version)?function(P,b,w,C){return c(P,L(P,b,w,C))}:function(P,b,w,C){return c(P,b,L(P,b,w,C))};return M(T,j,A);function L(X,P,b,w){return function(C,O){C&&(C.code==="EMFILE"||C.code==="ENFILE")?Oi([M,[X,P,b],C,w||Date.now(),Date.now()]):(O&&O.sort&&O.sort(),typeof b=="function"&&b.call(this,C,O))}}}if(process.version.substr(0,4)==="v0.8"){var p=p8(t);v=p.ReadStream,g=p.WriteStream}var h=t.ReadStream;h&&(v.prototype=Object.create(h.prototype),v.prototype.open=E);var m=t.WriteStream;m&&(g.prototype=Object.create(m.prototype),g.prototype.open=_),Object.defineProperty(t,"ReadStream",{get:function(){return v},set:function(T){v=T},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WriteStream",{get:function(){return g},set:function(T){g=T},enumerable:!0,configurable:!0});var y=v;Object.defineProperty(t,"FileReadStream",{get:function(){return y},set:function(T){y=T},enumerable:!0,configurable:!0});var D=g;Object.defineProperty(t,"FileWriteStream",{get:function(){return D},set:function(T){D=T},enumerable:!0,configurable:!0});function v(T,j){return this instanceof v?(h.apply(this,arguments),this):v.apply(Object.create(v.prototype),arguments)}function E(){var T=this;B(T.path,T.flags,T.mode,function(j,A){j?(T.autoClose&&T.destroy(),T.emit("error",j)):(T.fd=A,T.emit("open",A),T.read())})}function g(T,j){return this instanceof g?(m.apply(this,arguments),this):g.apply(Object.create(g.prototype),arguments)}function _(){var T=this;B(T.path,T.flags,T.mode,function(j,A){j?(T.destroy(),T.emit("error",j)):(T.fd=A,T.emit("open",A))})}function S(T,j){return new t.ReadStream(T,j)}function k(T,j){return new t.WriteStream(T,j)}var F=t.open;t.open=B;function B(T,j,A,M){return typeof A=="function"&&(M=A,A=null),L(T,j,A,M);function L(X,P,b,w,C){return F(X,P,b,function(O,R){O&&(O.code==="EMFILE"||O.code==="ENFILE")?Oi([L,[X,P,b,w],O,C||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}return t}function Oi(t){vo("ENQUEUE",t[0].name,t[1]),Ge[Dt].push(t),im()}var Wc;function AC(){for(var t=Date.now(),e=0;e<Ge[Dt].length;++e)Ge[Dt][e].length>2&&(Ge[Dt][e][3]=t,Ge[Dt][e][4]=t);im()}function im(){if(clearTimeout(Wc),Wc=void 0,Ge[Dt].length!==0){var t=Ge[Dt].shift(),e=t[0],r=t[1],n=t[2],o=t[3],i=t[4];if(o===void 0)vo("RETRY",e.name,r),e.apply(null,r);else if(Date.now()-o>=6e4){vo("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?(vo("RETRY",e.name,r),e.apply(null,r.concat([o]))):Ge[Dt].push(t)}Wc===void 0&&(Wc=setTimeout(im,0))}}});var PC=x((HK,FC)=>{function gr(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))}FC.exports=gr;gr.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};gr.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};gr.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};gr.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)};gr.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};gr.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};gr.prototype.start=gr.prototype.try;gr.prototype.errors=function(){return this._errors};gr.prototype.attempts=function(){return this._attempts};gr.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 kC=x(Co=>{var g8=PC();Co.operation=function(t){var e=Co.timeouts(t);return new g8(e,{forever:t&&t.forever,unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};Co.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};Co.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};Co.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=Co.operation(e),f=Array.prototype.slice.call(arguments,1),d=f.pop();f.push(function(p){c.retry(p)||(p&&(arguments[0]=c.mainError()),d.apply(this,arguments))}),c.attempt(function(){u.apply(t,f)})}.bind(t,a),t[i].options=e}}});var IC=x((zK,$C)=>{$C.exports=kC()});var TC=x((KK,Jc)=>{Jc.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&Jc.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Jc.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var cm=x((GK,ki)=>{var Ue=global.process,Eo=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"};Eo(Ue)?(RC=require("assert"),Fi=TC(),BC=/^win/i.test(Ue.platform),fs=require("events"),typeof fs!="function"&&(fs=fs.EventEmitter),Ue.__signal_exit_emitter__?st=Ue.__signal_exit_emitter__:(st=Ue.__signal_exit_emitter__=new fs,st.count=0,st.emitted={}),st.infinite||(st.setMaxListeners(1/0),st.infinite=!0),ki.exports=function(t,e){if(!Eo(global.process))return function(){};RC.equal(typeof t,"function","a callback must be provided for exit handler"),Pi===!1&&sm();var r="exit";e&&e.alwaysLast&&(r="afterexit");var n=function(){st.removeListener(r,t),st.listeners("exit").length===0&&st.listeners("afterexit").length===0&&Xc()};return st.on(r,t),n},Xc=function(){!Pi||!Eo(global.process)||(Pi=!1,Fi.forEach(function(e){try{Ue.removeListener(e,Zc[e])}catch{}}),Ue.emit=Qc,Ue.reallyExit=um,st.count-=1)},ki.exports.unload=Xc,_o=function(e,r,n){st.emitted[e]||(st.emitted[e]=!0,st.emit(e,r,n))},Zc={},Fi.forEach(function(t){Zc[t]=function(){if(Eo(global.process)){var r=Ue.listeners(t);r.length===st.count&&(Xc(),_o("exit",null,t),_o("afterexit",null,t),BC&&t==="SIGHUP"&&(t="SIGINT"),Ue.kill(Ue.pid,t))}}}),ki.exports.signals=function(){return Fi},Pi=!1,sm=function(){Pi||!Eo(global.process)||(Pi=!0,st.count+=1,Fi=Fi.filter(function(e){try{return Ue.on(e,Zc[e]),!0}catch{return!1}}),Ue.emit=LC,Ue.reallyExit=NC)},ki.exports.load=sm,um=Ue.reallyExit,NC=function(e){Eo(global.process)&&(Ue.exitCode=e||0,_o("exit",Ue.exitCode,null),_o("afterexit",Ue.exitCode,null),um.call(Ue,Ue.exitCode))},Qc=Ue.emit,LC=function(e,r){if(e==="exit"&&Eo(global.process)){r!==void 0&&(Ue.exitCode=r);var n=Qc.apply(this,arguments);return _o("exit",Ue.exitCode,null),_o("afterexit",Ue.exitCode,null),n}else return Qc.apply(this,arguments)}):ki.exports=function(){return function(){}};var RC,Fi,BC,fs,st,Xc,_o,Zc,Pi,sm,um,NC,Qc,LC});var UC=x((WK,lm)=>{"use strict";var jC=Symbol();function y8(t,e,r){let n=e[jC];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,jC,{value:u}),r(null,s.mtime,u)})})}function D8(t){let e=Date.now();return t==="s"&&(e=Math.ceil(e/1e3)*1e3),new Date(e)}lm.exports.probe=y8;lm.exports.getMtime=D8});var zC=x((YK,ps)=>{"use strict";var b8=require("path"),pm=Rn(),w8=IC(),v8=cm(),MC=UC(),cn={};function ds(t,e){return e.lockfilePath||`${t}.lock`}function hm(t,e,r){if(!e.realpath)return r(null,b8.resolve(t));e.fs.realpath(t,r)}function dm(t,e,r){let n=ds(t,e);e.fs.mkdir(n,o=>{if(!o)return MC.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"?dm(t,{...e,stale:0},r):r(i);if(!qC(a,e))return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:t}));HC(t,e,s=>{if(s)return r(s);dm(t,{...e,stale:0},r)})})})}function qC(t,e){return t.mtime.getTime()<Date.now()-e.stale}function HC(t,e,r){e.fs.rmdir(ds(t,e),n=>{if(n&&n.code!=="ENOENT")return r(n);r()})}function el(t,e){let r=cn[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?fm(t,r,Object.assign(n,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,el(t,e));if(!(r.mtime.getTime()===o.mtime.getTime()))return fm(t,r,Object.assign(new Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let s=MC.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?fm(t,r,Object.assign(u,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,el(t,e));r.mtime=s,r.lastUpdate=Date.now(),r.updateDelay=null,el(t,e)}})})},r.updateDelay),r.updateTimeout.unref&&r.updateTimeout.unref())}function fm(t,e,r){e.released=!0,e.updateTimeout&&clearTimeout(e.updateTimeout),cn[t]===e&&delete cn[t],e.options.onCompromised(r)}function C8(t,e,r){e={stale:1e4,update:null,realpath:!0,retries:0,fs:pm,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),hm(t,e,(n,o)=>{if(n)return r(n);let i=w8.operation(e.retries);i.attempt(()=>{dm(o,e,(a,s,u)=>{if(i.retry(a))return;if(a)return r(i.mainError());let c=cn[o]={lockfilePath:ds(o,e),mtime:s,mtimePrecision:u,options:e,lastUpdate:Date.now()};el(o,e),r(null,f=>{if(c.released)return f&&f(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));VC(o,{...e,realpath:!1},f)})})})})}function VC(t,e,r){e={fs:pm,realpath:!0,...e},hm(t,e,(n,o)=>{if(n)return r(n);let i=cn[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 cn[o],HC(o,e,r)})}function E8(t,e,r){e={stale:1e4,realpath:!0,fs:pm,...e},e.stale=Math.max(e.stale||0,2e3),hm(t,e,(n,o)=>{if(n)return r(n);e.fs.stat(ds(o,e),(i,a)=>i?i.code==="ENOENT"?r(null,!1):r(i):r(null,!qC(a,e)))})}function _8(){return cn}v8(()=>{for(let t in cn){let e=cn[t].options;try{e.fs.rmdirSync(ds(t,e))}catch{}}});ps.exports.lock=C8;ps.exports.unlock=VC;ps.exports.check=E8;ps.exports.getLocks=_8});var GC=x((JK,KC)=>{"use strict";var S8=Rn();function x8(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 A8(t){return(...e)=>new Promise((r,n)=>{e.push((o,i)=>{o?n(o):r(i)}),t(...e)})}function O8(t){return(...e)=>{let r,n;if(e.push((o,i)=>{r=o,n=i}),t(...e),r)throw r;return n}}function F8(t){if(t={...t},t.fs=x8(t.fs||S8),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}KC.exports={toPromise:A8,toSync:O8,toSyncOptions:F8}});var YC=x((XK,Bn)=>{"use strict";var $i=zC(),{toPromise:tl,toSync:rl,toSyncOptions:mm}=GC();async function WC(t,e){let r=await tl($i.lock)(t,e);return tl(r)}function P8(t,e){let r=rl($i.lock)(t,mm(e));return rl(r)}function k8(t,e){return tl($i.unlock)(t,e)}function $8(t,e){return rl($i.unlock)(t,mm(e))}function I8(t,e){return tl($i.check)(t,e)}function T8(t,e){return rl($i.check)(t,mm(e))}Bn.exports=WC;Bn.exports.lock=WC;Bn.exports.unlock=k8;Bn.exports.lockSync=P8;Bn.exports.unlockSync=$8;Bn.exports.check=I8;Bn.exports.checkSync=T8});var eE=x(Ii=>{"use strict";Object.defineProperty(Ii,"__esModule",{value:!0});Ii.canStoreURLs=Ii.FileUrlStorage=void 0;var JC=require("fs"),R8=N8(DC()),XC=B8(YC());function QC(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(QC=function(n){return n?r:e})(t)}function B8(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=QC(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 N8(t){return t&&t.__esModule?t:{default:t}}function hs(t){"@babel/helpers - typeof";return hs=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},hs(t)}function L8(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ZC(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,U8(n.key),n)}}function j8(t,e,r){return e&&ZC(t.prototype,e),r&&ZC(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function U8(t){var e=M8(t,"string");return hs(e)=="symbol"?e:e+""}function M8(t,e){if(hs(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(hs(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var ZK=Ii.canStoreURLs=!0,QK=Ii.FileUrlStorage=(function(){function t(e){L8(this,t),this.path=e}return j8(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;XC.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;XC.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,R8.default)([o,i]))});return}r().then(n).catch(n)}}},{key:"_writeData",value:function(r,n){var o={encoding:"utf8",mode:432,flag:"w"};(0,JC.writeFile)(this.path,JSON.stringify(r),o,function(i){return n(i)})}},{key:"_getData",value:function(r){(0,JC.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 ol=x(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Object.defineProperty(Gt,"DefaultHttpStack",{enumerable:!0,get:function(){return oE.default}});Object.defineProperty(Gt,"DetailedError",{enumerable:!0,get:function(){return q8.default}});Object.defineProperty(Gt,"FileUrlStorage",{enumerable:!0,get:function(){return iE.FileUrlStorage}});Object.defineProperty(Gt,"StreamSource",{enumerable:!0,get:function(){return G8.default}});Gt.Upload=void 0;Object.defineProperty(Gt,"canStoreURLs",{enumerable:!0,get:function(){return iE.canStoreURLs}});Gt.defaultOptions=void 0;Object.defineProperty(Gt,"enableDebugLog",{enumerable:!0,get:function(){return H8.enableDebugLog}});Gt.isSupported=void 0;var q8=So(fh()),H8=dh(),V8=So(ew()),gm=So(Pw()),z8=So(Hw()),K8=So(Gw()),oE=So(sv()),G8=So(xh()),iE=eE();function So(t){return t&&t.__esModule?t:{default:t}}function Ri(t){"@babel/helpers - typeof";return Ri=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},Ri(t)}function W8(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function tE(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,sE(n.key),n)}}function Y8(t,e,r){return e&&tE(t.prototype,e),r&&tE(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function J8(t,e,r){return e=nl(e),X8(t,aE()?Reflect.construct(e,r||[],nl(t).constructor):e.apply(t,r))}function X8(t,e){if(e&&(Ri(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Z8(t)}function Z8(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function aE(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(aE=function(){return!!t})()}function nl(t){return nl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},nl(t)}function Q8(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&&ym(t,e)}function ym(t,e){return ym=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},ym(t,e)}function rE(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?rE(Object(r),!0).forEach(function(n){eN(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):rE(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function eN(t,e,r){return e=sE(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function sE(t){var e=tN(t,"string");return Ri(e)=="symbol"?e:e+""}function tN(t,e){if(Ri(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Ri(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var nE=Gt.defaultOptions=Ti(Ti({},gm.default.defaultOptions),{},{httpStack:new oE.default,fileReader:new z8.default,urlStorage:new V8.default,fingerprint:K8.default}),tG=Gt.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 W8(this,e),n=Ti(Ti({},nE),n),J8(this,e,[r,n])}return Q8(e,t),Y8(e,null,[{key:"terminate",value:function(n){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return o=Ti(Ti({},nE),o),gm.default.terminate(n,o)}}])})(gm.default),rG=Gt.isSupported=!0});var dE=x((DG,fE)=>{var Bi=1e3,Ni=Bi*60,Li=Ni*60,xo=Li*24,lN=xo*7,fN=xo*365.25;fE.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return dN(t);if(r==="number"&&isFinite(t))return e.long?hN(t):pN(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function dN(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*fN;case"weeks":case"week":case"w":return r*lN;case"days":case"day":case"d":return r*xo;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Li;case"minutes":case"minute":case"mins":case"min":case"m":return r*Ni;case"seconds":case"second":case"secs":case"sec":case"s":return r*Bi;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function pN(t){var e=Math.abs(t);return e>=xo?Math.round(t/xo)+"d":e>=Li?Math.round(t/Li)+"h":e>=Ni?Math.round(t/Ni)+"m":e>=Bi?Math.round(t/Bi)+"s":t+"ms"}function hN(t){var e=Math.abs(t);return e>=xo?al(t,e,xo,"day"):e>=Li?al(t,e,Li,"hour"):e>=Ni?al(t,e,Ni,"minute"):e>=Bi?al(t,e,Bi,"second"):t+" ms"}function al(t,e,r,n){var o=e>=r*1.5;return Math.round(t/r)+" "+n+(o?"s":"")}});var wm=x((bG,pE)=>{function mN(t){r.debug=r,r.default=r,r.coerce=u,r.disable=a,r.enable=o,r.enabled=s,r.humanize=dE(),r.destroy=c,Object.keys(t).forEach(f=>{r[f]=t[f]}),r.names=[],r.skips=[],r.formatters={};function e(f){let d=0;for(let p=0;p<f.length;p++)d=(d<<5)-d+f.charCodeAt(p),d|=0;return r.colors[Math.abs(d)%r.colors.length]}r.selectColor=e;function r(f){let d,p=null,h,m;function y(...D){if(!y.enabled)return;let v=y,E=Number(new Date),g=E-(d||E);v.diff=g,v.prev=d,v.curr=E,d=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,F)=>{if(k==="%%")return"%";_++;let B=r.formatters[F];if(typeof B=="function"){let T=D[_];k=B.call(v,T),D.splice(_,1),_--}return k}),r.formatArgs.call(v,D),(v.log||r.log).apply(v,D)}return y.namespace=f,y.useColors=r.useColors(),y.color=r.selectColor(f),y.extend=n,y.destroy=r.destroy,Object.defineProperty(y,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(h!==r.namespaces&&(h=r.namespaces,m=r.enabled(f)),m),set:D=>{p=D}}),typeof r.init=="function"&&r.init(y),y}function n(f,d){let p=r(this.namespace+(typeof d>"u"?":":d)+f);return p.log=this.log,p}function o(f){r.save(f),r.namespaces=f,r.names=[],r.skips=[];let d=(typeof f=="string"?f:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let p of d)p[0]==="-"?r.skips.push(p.slice(1)):r.names.push(p)}function i(f,d){let p=0,h=0,m=-1,y=0;for(;p<f.length;)if(h<d.length&&(d[h]===f[p]||d[h]==="*"))d[h]==="*"?(m=h,y=p,h++):(p++,h++);else if(m!==-1)h=m+1,y++,p=y;else return!1;for(;h<d.length&&d[h]==="*";)h++;return h===d.length}function a(){let f=[...r.names,...r.skips.map(d=>"-"+d)].join(",");return r.enable(""),f}function s(f){for(let d of r.skips)if(i(f,d))return!1;for(let d of r.names)if(i(f,d))return!0;return!1}function u(f){return f instanceof Error?f.stack||f.message:f}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}pE.exports=mN});var hE=x((Wt,sl)=>{Wt.formatArgs=yN;Wt.save=DN;Wt.load=bN;Wt.useColors=gN;Wt.storage=wN();Wt.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`."))}})();Wt.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 gN(){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 yN(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+sl.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)}Wt.log=console.debug||console.log||(()=>{});function DN(t){try{t?Wt.storage.setItem("debug",t):Wt.storage.removeItem("debug")}catch{}}function bN(){let t;try{t=Wt.storage.getItem("debug")||Wt.storage.getItem("DEBUG")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function wN(){try{return localStorage}catch{}}sl.exports=wm()(Wt);var{formatters:vN}=sl.exports;vN.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var gE=x((wG,mE)=>{"use strict";mE.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 bE=x((vG,DE)=>{"use strict";var CN=require("os"),yE=require("tty"),Dr=gE(),{env:ct}=process,Nn;Dr("no-color")||Dr("no-colors")||Dr("color=false")||Dr("color=never")?Nn=0:(Dr("color")||Dr("colors")||Dr("color=true")||Dr("color=always"))&&(Nn=1);"FORCE_COLOR"in ct&&(ct.FORCE_COLOR==="true"?Nn=1:ct.FORCE_COLOR==="false"?Nn=0:Nn=ct.FORCE_COLOR.length===0?1:Math.min(parseInt(ct.FORCE_COLOR,10),3));function vm(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function Cm(t,e){if(Nn===0)return 0;if(Dr("color=16m")||Dr("color=full")||Dr("color=truecolor"))return 3;if(Dr("color=256"))return 2;if(t&&!e&&Nn===void 0)return 0;let r=Nn||0;if(ct.TERM==="dumb")return r;if(process.platform==="win32"){let n=CN.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in ct)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in ct)||ct.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in ct)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(ct.TEAMCITY_VERSION)?1:0;if(ct.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in ct){let n=parseInt((ct.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(ct.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(ct.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(ct.TERM)||"COLORTERM"in ct?1:r}function EN(t){let e=Cm(t,t&&t.isTTY);return vm(e)}DE.exports={supportsColor:EN,stdout:vm(Cm(!0,yE.isatty(1))),stderr:vm(Cm(!0,yE.isatty(2)))}});var vE=x((lt,cl)=>{var _N=require("tty"),ul=require("util");lt.init=kN;lt.log=ON;lt.formatArgs=xN;lt.save=FN;lt.load=PN;lt.useColors=SN;lt.destroy=ul.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");lt.colors=[6,2,3,4,5,1];try{let t=bE();t&&(t.stderr||t).level>=2&&(lt.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{}lt.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 SN(){return"colors"in lt.inspectOpts?!!lt.inspectOpts.colors:_N.isatty(process.stderr.fd)}function xN(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(`
48
48
  `).join(`
49
- `+i),t.push(o+"m+"+il.exports.humanize(this.diff)+"\x1B[0m")}else t[0]=CN()+e+" "+t[0]}function CN(){return ct.inspectOpts.hideDate?"":new Date().toISOString()+" "}function EN(...t){return process.stderr.write(ol.formatWithOptions(ct.inspectOpts,...t)+`
50
- `)}function _N(t){t?process.env.DEBUG=t:delete process.env.DEBUG}function SN(){return process.env.DEBUG}function xN(t){t.inspectOpts={};let e=Object.keys(ct.inspectOpts);for(let r=0;r<e.length;r++)t.inspectOpts[e[r]]=ct.inspectOpts[e[r]]}il.exports=mm()(ct);var{formatters:mE}=il.exports;mE.o=function(t){return this.inspectOpts.colors=this.useColors,ol.inspect(t,this.inspectOpts).split(`
51
- `).map(e=>e.trim()).join(" ")};mE.O=function(t){return this.inspectOpts.colors=this.useColors,ol.inspect(t,this.inspectOpts)}});var bm=x((gG,Dm)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?Dm.exports=cE():Dm.exports=gE()});var lt=x(wm=>{"use strict";wm.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})};wm.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 Rt=x(sn=>{"use strict";var yE=lt().fromCallback,Tt=$n(),AN=["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 Tt[t]=="function");Object.assign(sn,Tt);AN.forEach(t=>{sn[t]=yE(Tt[t])});sn.exists=function(t,e){return typeof e=="function"?Tt.exists(t,e):new Promise(r=>Tt.exists(t,r))};sn.read=function(t,e,r,n,o,i){return typeof i=="function"?Tt.read(t,e,r,n,o,i):new Promise((a,s)=>{Tt.read(t,e,r,n,o,(u,c,f)=>{if(u)return s(u);a({bytesRead:c,buffer:f})})})};sn.write=function(t,e,...r){return typeof r[r.length-1]=="function"?Tt.write(t,e,...r):new Promise((n,o)=>{Tt.write(t,e,...r,(i,a,s)=>{if(i)return o(i);n({bytesWritten:a,buffer:s})})})};sn.readv=function(t,e,...r){return typeof r[r.length-1]=="function"?Tt.readv(t,e,...r):new Promise((n,o)=>{Tt.readv(t,e,...r,(i,a,s)=>{if(i)return o(i);n({bytesRead:a,buffers:s})})})};sn.writev=function(t,e,...r){return typeof r[r.length-1]=="function"?Tt.writev(t,e,...r):new Promise((n,o)=>{Tt.writev(t,e,...r,(i,a,s)=>{if(i)return o(i);n({bytesWritten:a,buffers:s})})})};typeof Tt.realpath.native=="function"?sn.realpath.native=yE(Tt.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")});var bE=x((bG,DE)=>{"use strict";var ON=require("path");DE.exports.checkPath=function(e){if(process.platform==="win32"&&/[<>:"|?*]/.test(e.replace(ON.parse(e).root,""))){let n=new Error(`Path contains invalid characters: ${e}`);throw n.code="EINVAL",n}}});var EE=x((wG,vm)=>{"use strict";var wE=Rt(),{checkPath:vE}=bE(),CE=t=>{let e={mode:511};return typeof t=="number"?t:{...e,...t}.mode};vm.exports.makeDir=async(t,e)=>(vE(t),wE.mkdir(t,{mode:CE(e),recursive:!0}));vm.exports.makeDirSync=(t,e)=>(vE(t),wE.mkdirSync(t,{mode:CE(e),recursive:!0}))});var Ar=x((vG,_E)=>{"use strict";var FN=lt().fromPromise,{makeDir:kN,makeDirSync:Cm}=EE(),Em=FN(kN);_E.exports={mkdirs:Em,mkdirsSync:Cm,mkdirp:Em,mkdirpSync:Cm,ensureDir:Em,ensureDirSync:Cm}});var Rn=x((CG,xE)=>{"use strict";var PN=lt().fromPromise,SE=Rt();function $N(t){return SE.access(t).then(()=>!0).catch(()=>!1)}xE.exports={pathExists:PN($N),pathExistsSync:SE.existsSync}});var _m=x((EG,AE)=>{"use strict";var ji=Rt(),IN=lt().fromPromise;async function TN(t,e,r){let n=await ji.open(t,"r+"),o=null;try{await ji.futimes(n,e,r)}finally{try{await ji.close(n)}catch(i){o=i}}if(o)throw o}function RN(t,e,r){let n=ji.openSync(t,"r+");return ji.futimesSync(n,e,r),ji.closeSync(n)}AE.exports={utimesMillis:IN(TN),utimesMillisSync:RN}});var So=x((_G,PE)=>{"use strict";var Ui=Rt(),ft=require("path"),OE=lt().fromPromise;function BN(t,e,r){let n=r.dereference?o=>Ui.stat(o,{bigint:!0}):o=>Ui.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 NN(t,e,r){let n,o=r.dereference?a=>Ui.statSync(a,{bigint:!0}):a=>Ui.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 LN(t,e,r,n){let{srcStat:o,destStat:i}=await BN(t,e,n);if(i){if(hs(o,i)){let a=ft.basename(t),s=ft.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()&&Sm(t,e))throw new Error(al(t,e,r));return{srcStat:o,destStat:i}}function jN(t,e,r,n){let{srcStat:o,destStat:i}=NN(t,e,n);if(i){if(hs(o,i)){let a=ft.basename(t),s=ft.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()&&Sm(t,e))throw new Error(al(t,e,r));return{srcStat:o,destStat:i}}async function FE(t,e,r,n){let o=ft.resolve(ft.dirname(t)),i=ft.resolve(ft.dirname(r));if(i===o||i===ft.parse(i).root)return;let a;try{a=await Ui.stat(i,{bigint:!0})}catch(s){if(s.code==="ENOENT")return;throw s}if(hs(e,a))throw new Error(al(t,r,n));return FE(t,e,i,n)}function kE(t,e,r,n){let o=ft.resolve(ft.dirname(t)),i=ft.resolve(ft.dirname(r));if(i===o||i===ft.parse(i).root)return;let a;try{a=Ui.statSync(i,{bigint:!0})}catch(s){if(s.code==="ENOENT")return;throw s}if(hs(e,a))throw new Error(al(t,r,n));return kE(t,e,i,n)}function hs(t,e){return e.ino!==void 0&&e.dev!==void 0&&e.ino===t.ino&&e.dev===t.dev}function Sm(t,e){let r=ft.resolve(t).split(ft.sep).filter(o=>o),n=ft.resolve(e).split(ft.sep).filter(o=>o);return r.every((o,i)=>n[i]===o)}function al(t,e,r){return`Cannot ${r} '${t}' to a subdirectory of itself, '${e}'.`}PE.exports={checkPaths:OE(LN),checkPathsSync:jN,checkParentPaths:OE(FE),checkParentPathsSync:kE,isSrcSubdir:Sm,areIdentical:hs}});var IE=x((SG,$E)=>{"use strict";async function UN(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})))}$E.exports={asyncIteratorConcurrentProcess:UN}});var LE=x((xG,NE)=>{"use strict";var Et=Rt(),ms=require("path"),{mkdirs:MN}=Ar(),{pathExists:qN}=Rn(),{utimesMillis:HN}=_m(),gs=So(),{asyncIteratorConcurrentProcess:VN}=IE();async function zN(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
+ `+i),t.push(o+"m+"+cl.exports.humanize(this.diff)+"\x1B[0m")}else t[0]=AN()+e+" "+t[0]}function AN(){return lt.inspectOpts.hideDate?"":new Date().toISOString()+" "}function ON(...t){return process.stderr.write(ul.formatWithOptions(lt.inspectOpts,...t)+`
50
+ `)}function FN(t){t?process.env.DEBUG=t:delete process.env.DEBUG}function PN(){return process.env.DEBUG}function kN(t){t.inspectOpts={};let e=Object.keys(lt.inspectOpts);for(let r=0;r<e.length;r++)t.inspectOpts[e[r]]=lt.inspectOpts[e[r]]}cl.exports=wm()(lt);var{formatters:wE}=cl.exports;wE.o=function(t){return this.inspectOpts.colors=this.useColors,ul.inspect(t,this.inspectOpts).split(`
51
+ `).map(e=>e.trim()).join(" ")};wE.O=function(t){return this.inspectOpts.colors=this.useColors,ul.inspect(t,this.inspectOpts)}});var _m=x((CG,Em)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?Em.exports=hE():Em.exports=vE()});var ft=x(Sm=>{"use strict";Sm.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})};Sm.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 Bt=x(fn=>{"use strict";var CE=ft().fromCallback,Rt=Rn(),$N=["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 Rt[t]=="function");Object.assign(fn,Rt);$N.forEach(t=>{fn[t]=CE(Rt[t])});fn.exists=function(t,e){return typeof e=="function"?Rt.exists(t,e):new Promise(r=>Rt.exists(t,r))};fn.read=function(t,e,r,n,o,i){return typeof i=="function"?Rt.read(t,e,r,n,o,i):new Promise((a,s)=>{Rt.read(t,e,r,n,o,(u,c,f)=>{if(u)return s(u);a({bytesRead:c,buffer:f})})})};fn.write=function(t,e,...r){return typeof r[r.length-1]=="function"?Rt.write(t,e,...r):new Promise((n,o)=>{Rt.write(t,e,...r,(i,a,s)=>{if(i)return o(i);n({bytesWritten:a,buffer:s})})})};fn.readv=function(t,e,...r){return typeof r[r.length-1]=="function"?Rt.readv(t,e,...r):new Promise((n,o)=>{Rt.readv(t,e,...r,(i,a,s)=>{if(i)return o(i);n({bytesRead:a,buffers:s})})})};fn.writev=function(t,e,...r){return typeof r[r.length-1]=="function"?Rt.writev(t,e,...r):new Promise((n,o)=>{Rt.writev(t,e,...r,(i,a,s)=>{if(i)return o(i);n({bytesWritten:a,buffers:s})})})};typeof Rt.realpath.native=="function"?fn.realpath.native=CE(Rt.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")});var _E=x((SG,EE)=>{"use strict";var IN=require("path");EE.exports.checkPath=function(e){if(process.platform==="win32"&&/[<>:"|?*]/.test(e.replace(IN.parse(e).root,""))){let n=new Error(`Path contains invalid characters: ${e}`);throw n.code="EINVAL",n}}});var OE=x((xG,xm)=>{"use strict";var SE=Bt(),{checkPath:xE}=_E(),AE=t=>{let e={mode:511};return typeof t=="number"?t:{...e,...t}.mode};xm.exports.makeDir=async(t,e)=>(xE(t),SE.mkdir(t,{mode:AE(e),recursive:!0}));xm.exports.makeDirSync=(t,e)=>(xE(t),SE.mkdirSync(t,{mode:AE(e),recursive:!0}))});var kr=x((AG,FE)=>{"use strict";var TN=ft().fromPromise,{makeDir:RN,makeDirSync:Am}=OE(),Om=TN(RN);FE.exports={mkdirs:Om,mkdirsSync:Am,mkdirp:Om,mkdirpSync:Am,ensureDir:Om,ensureDirSync:Am}});var Ln=x((OG,kE)=>{"use strict";var BN=ft().fromPromise,PE=Bt();function NN(t){return PE.access(t).then(()=>!0).catch(()=>!1)}kE.exports={pathExists:BN(NN),pathExistsSync:PE.existsSync}});var Fm=x((FG,$E)=>{"use strict";var ji=Bt(),LN=ft().fromPromise;async function jN(t,e,r){let n=await ji.open(t,"r+"),o=null;try{await ji.futimes(n,e,r)}finally{try{await ji.close(n)}catch(i){o=i}}if(o)throw o}function UN(t,e,r){let n=ji.openSync(t,"r+");return ji.futimesSync(n,e,r),ji.closeSync(n)}$E.exports={utimesMillis:LN(jN),utimesMillisSync:UN}});var Ao=x((PG,BE)=>{"use strict";var Ui=Bt(),dt=require("path"),IE=ft().fromPromise;function MN(t,e,r){let n=r.dereference?o=>Ui.stat(o,{bigint:!0}):o=>Ui.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 qN(t,e,r){let n,o=r.dereference?a=>Ui.statSync(a,{bigint:!0}):a=>Ui.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 HN(t,e,r,n){let{srcStat:o,destStat:i}=await MN(t,e,n);if(i){if(ms(o,i)){let a=dt.basename(t),s=dt.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()&&Pm(t,e))throw new Error(ll(t,e,r));return{srcStat:o,destStat:i}}function VN(t,e,r,n){let{srcStat:o,destStat:i}=qN(t,e,n);if(i){if(ms(o,i)){let a=dt.basename(t),s=dt.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()&&Pm(t,e))throw new Error(ll(t,e,r));return{srcStat:o,destStat:i}}async function TE(t,e,r,n){let o=dt.resolve(dt.dirname(t)),i=dt.resolve(dt.dirname(r));if(i===o||i===dt.parse(i).root)return;let a;try{a=await Ui.stat(i,{bigint:!0})}catch(s){if(s.code==="ENOENT")return;throw s}if(ms(e,a))throw new Error(ll(t,r,n));return TE(t,e,i,n)}function RE(t,e,r,n){let o=dt.resolve(dt.dirname(t)),i=dt.resolve(dt.dirname(r));if(i===o||i===dt.parse(i).root)return;let a;try{a=Ui.statSync(i,{bigint:!0})}catch(s){if(s.code==="ENOENT")return;throw s}if(ms(e,a))throw new Error(ll(t,r,n));return RE(t,e,i,n)}function ms(t,e){return e.ino!==void 0&&e.dev!==void 0&&e.ino===t.ino&&e.dev===t.dev}function Pm(t,e){let r=dt.resolve(t).split(dt.sep).filter(o=>o),n=dt.resolve(e).split(dt.sep).filter(o=>o);return r.every((o,i)=>n[i]===o)}function ll(t,e,r){return`Cannot ${r} '${t}' to a subdirectory of itself, '${e}'.`}BE.exports={checkPaths:IE(HN),checkPathsSync:VN,checkParentPaths:IE(TE),checkParentPathsSync:RE,isSrcSubdir:Pm,areIdentical:ms}});var LE=x((kG,NE)=>{"use strict";async function zN(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:zN}});var HE=x(($G,qE)=>{"use strict";var _t=Bt(),gs=require("path"),{mkdirs:KN}=kr(),{pathExists:GN}=Ln(),{utimesMillis:WN}=Fm(),ys=Ao(),{asyncIteratorConcurrentProcess:YN}=LE();async function JN(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;
52
52
 
53
- see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0001");let{srcStat:n,destStat:o}=await gs.checkPaths(t,e,"copy",r);if(await gs.checkParentPaths(t,n,e,"copy"),!await RE(t,e,r))return;let a=ms.dirname(e);await qN(a)||await MN(a),await BE(o,t,e,r)}async function RE(t,e,r){return r.filter?r.filter(t,e):!0}async function BE(t,e,r,n){let i=await(n.dereference?Et.stat:Et.lstat)(e);if(i.isDirectory())return YN(i,t,e,r,n);if(i.isFile()||i.isCharacterDevice()||i.isBlockDevice())return KN(i,t,e,r,n);if(i.isSymbolicLink())return JN(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 KN(t,e,r,n,o){if(!e)return TE(t,r,n,o);if(o.overwrite)return await Et.unlink(n),TE(t,r,n,o);if(o.errorOnExist)throw new Error(`'${n}' already exists`)}async function TE(t,e,r,n){if(await Et.copyFile(e,r),n.preserveTimestamps){GN(t.mode)&&await WN(r,t.mode);let o=await Et.stat(e);await HN(r,o.atime,o.mtime)}return Et.chmod(r,t.mode)}function GN(t){return(t&128)===0}function WN(t,e){return Et.chmod(t,e|128)}async function YN(t,e,r,n,o){e||await Et.mkdir(n),await VN(await Et.opendir(r),async i=>{let a=ms.join(r,i.name),s=ms.join(n,i.name);if(await RE(a,s,o)){let{destStat:c}=await gs.checkPaths(a,s,"copy",o);await BE(c,a,s,o)}}),e||await Et.chmod(n,t.mode)}async function JN(t,e,r,n){let o=await Et.readlink(e);if(n.dereference&&(o=ms.resolve(process.cwd(),o)),!t)return Et.symlink(o,r);let i=null;try{i=await Et.readlink(r)}catch(a){if(a.code==="EINVAL"||a.code==="UNKNOWN")return Et.symlink(o,r);throw a}if(n.dereference&&(i=ms.resolve(process.cwd(),i)),gs.isSrcSubdir(o,i))throw new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`);if(gs.isSrcSubdir(i,o))throw new Error(`Cannot overwrite '${i}' with '${o}'.`);return await Et.unlink(r),Et.symlink(o,r)}NE.exports=zN});var HE=x((AG,qE)=>{"use strict";var Bt=$n(),ys=require("path"),XN=Ar().mkdirsSync,ZN=_m().utimesMillisSync,Ds=So();function QN(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;
53
+ see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0001");let{srcStat:n,destStat:o}=await ys.checkPaths(t,e,"copy",r);if(await ys.checkParentPaths(t,n,e,"copy"),!await UE(t,e,r))return;let a=gs.dirname(e);await GN(a)||await KN(a),await ME(o,t,e,r)}async function UE(t,e,r){return r.filter?r.filter(t,e):!0}async function ME(t,e,r,n){let i=await(n.dereference?_t.stat:_t.lstat)(e);if(i.isDirectory())return eL(i,t,e,r,n);if(i.isFile()||i.isCharacterDevice()||i.isBlockDevice())return XN(i,t,e,r,n);if(i.isSymbolicLink())return tL(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 XN(t,e,r,n,o){if(!e)return jE(t,r,n,o);if(o.overwrite)return await _t.unlink(n),jE(t,r,n,o);if(o.errorOnExist)throw new Error(`'${n}' already exists`)}async function jE(t,e,r,n){if(await _t.copyFile(e,r),n.preserveTimestamps){ZN(t.mode)&&await QN(r,t.mode);let o=await _t.stat(e);await WN(r,o.atime,o.mtime)}return _t.chmod(r,t.mode)}function ZN(t){return(t&128)===0}function QN(t,e){return _t.chmod(t,e|128)}async function eL(t,e,r,n,o){e||await _t.mkdir(n),await YN(await _t.opendir(r),async i=>{let a=gs.join(r,i.name),s=gs.join(n,i.name);if(await UE(a,s,o)){let{destStat:c}=await ys.checkPaths(a,s,"copy",o);await ME(c,a,s,o)}}),e||await _t.chmod(n,t.mode)}async function tL(t,e,r,n){let o=await _t.readlink(e);if(n.dereference&&(o=gs.resolve(process.cwd(),o)),!t)return _t.symlink(o,r);let i=null;try{i=await _t.readlink(r)}catch(a){if(a.code==="EINVAL"||a.code==="UNKNOWN")return _t.symlink(o,r);throw a}if(n.dereference&&(i=gs.resolve(process.cwd(),i)),ys.isSrcSubdir(o,i))throw new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`);if(ys.isSrcSubdir(i,o))throw new Error(`Cannot overwrite '${i}' with '${o}'.`);return await _t.unlink(r),_t.symlink(o,r)}qE.exports=JN});var WE=x((IG,GE)=>{"use strict";var Nt=Rn(),Ds=require("path"),rL=kr().mkdirsSync,nL=Fm().utimesMillisSync,bs=Ao();function oL(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;
54
54
 
55
- see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0002");let{srcStat:n,destStat:o}=Ds.checkPathsSync(t,e,"copy",r);if(Ds.checkParentPathsSync(t,n,e,"copy"),r.filter&&!r.filter(t,e))return;let i=ys.dirname(e);return Bt.existsSync(i)||XN(i),jE(o,t,e,r)}function jE(t,e,r,n){let i=(n.dereference?Bt.statSync:Bt.lstatSync)(e);if(i.isDirectory())return aL(i,t,e,r,n);if(i.isFile()||i.isCharacterDevice()||i.isBlockDevice())return eL(i,t,e,r,n);if(i.isSymbolicLink())return cL(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 eL(t,e,r,n,o){return e?tL(t,r,n,o):UE(t,r,n,o)}function tL(t,e,r,n){if(n.overwrite)return Bt.unlinkSync(r),UE(t,e,r,n);if(n.errorOnExist)throw new Error(`'${r}' already exists`)}function UE(t,e,r,n){return Bt.copyFileSync(e,r),n.preserveTimestamps&&rL(t.mode,e,r),xm(r,t.mode)}function rL(t,e,r){return nL(t)&&oL(r,t),iL(e,r)}function nL(t){return(t&128)===0}function oL(t,e){return xm(t,e|128)}function xm(t,e){return Bt.chmodSync(t,e)}function iL(t,e){let r=Bt.statSync(t);return ZN(e,r.atime,r.mtime)}function aL(t,e,r,n,o){return e?ME(r,n,o):sL(t.mode,r,n,o)}function sL(t,e,r,n){return Bt.mkdirSync(r),ME(e,r,n),xm(r,t)}function ME(t,e,r){let n=Bt.opendirSync(t);try{let o;for(;(o=n.readSync())!==null;)uL(o.name,t,e,r)}finally{n.closeSync()}}function uL(t,e,r,n){let o=ys.join(e,t),i=ys.join(r,t);if(n.filter&&!n.filter(o,i))return;let{destStat:a}=Ds.checkPathsSync(o,i,"copy",n);return jE(a,o,i,n)}function cL(t,e,r,n){let o=Bt.readlinkSync(e);if(n.dereference&&(o=ys.resolve(process.cwd(),o)),t){let i;try{i=Bt.readlinkSync(r)}catch(a){if(a.code==="EINVAL"||a.code==="UNKNOWN")return Bt.symlinkSync(o,r);throw a}if(n.dereference&&(i=ys.resolve(process.cwd(),i)),Ds.isSrcSubdir(o,i))throw new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`);if(Ds.isSrcSubdir(i,o))throw new Error(`Cannot overwrite '${i}' with '${o}'.`);return lL(o,r)}else return Bt.symlinkSync(o,r)}function lL(t,e){return Bt.unlinkSync(e),Bt.symlinkSync(t,e)}qE.exports=QN});var sl=x((OG,VE)=>{"use strict";var fL=lt().fromPromise;VE.exports={copy:fL(LE()),copySync:HE()}});var bs=x((FG,KE)=>{"use strict";var zE=$n(),dL=lt().fromCallback;function pL(t,e){zE.rm(t,{recursive:!0,force:!0},e)}function hL(t){zE.rmSync(t,{recursive:!0,force:!0})}KE.exports={remove:dL(pL),removeSync:hL}});var e_=x((kG,QE)=>{"use strict";var mL=lt().fromPromise,YE=Rt(),JE=require("path"),XE=Ar(),ZE=bs(),GE=mL(async function(e){let r;try{r=await YE.readdir(e)}catch{return XE.mkdirs(e)}return Promise.all(r.map(n=>ZE.remove(JE.join(e,n))))});function WE(t){let e;try{e=YE.readdirSync(t)}catch{return XE.mkdirsSync(t)}e.forEach(r=>{r=JE.join(t,r),ZE.removeSync(r)})}QE.exports={emptyDirSync:WE,emptydirSync:WE,emptyDir:GE,emptydir:GE}});var o_=x((PG,n_)=>{"use strict";var gL=lt().fromPromise,t_=require("path"),un=Rt(),r_=Ar();async function yL(t){let e;try{e=await un.stat(t)}catch{}if(e&&e.isFile())return;let r=t_.dirname(t),n=null;try{n=await un.stat(r)}catch(o){if(o.code==="ENOENT"){await r_.mkdirs(r),await un.writeFile(t,"");return}else throw o}n.isDirectory()?await un.writeFile(t,""):await un.readdir(r)}function DL(t){let e;try{e=un.statSync(t)}catch{}if(e&&e.isFile())return;let r=t_.dirname(t);try{un.statSync(r).isDirectory()||un.readdirSync(r)}catch(n){if(n&&n.code==="ENOENT")r_.mkdirsSync(r);else throw n}un.writeFileSync(t,"")}n_.exports={createFile:gL(yL),createFileSync:DL}});var c_=x(($G,u_)=>{"use strict";var bL=lt().fromPromise,i_=require("path"),Bn=Rt(),a_=Ar(),{pathExists:wL}=Rn(),{areIdentical:s_}=So();async function vL(t,e){let r;try{r=await Bn.lstat(e)}catch{}let n;try{n=await Bn.lstat(t)}catch(a){throw a.message=a.message.replace("lstat","ensureLink"),a}if(r&&s_(n,r))return;let o=i_.dirname(e);await wL(o)||await a_.mkdirs(o),await Bn.link(t,e)}function CL(t,e){let r;try{r=Bn.lstatSync(e)}catch{}try{let i=Bn.lstatSync(t);if(r&&s_(i,r))return}catch(i){throw i.message=i.message.replace("lstat","ensureLink"),i}let n=i_.dirname(e);return Bn.existsSync(n)||a_.mkdirsSync(n),Bn.linkSync(t,e)}u_.exports={createLink:bL(vL),createLinkSync:CL}});var f_=x((IG,l_)=>{"use strict";var Nn=require("path"),ws=Rt(),{pathExists:EL}=Rn(),_L=lt().fromPromise;async function SL(t,e){if(Nn.isAbsolute(t)){try{await ws.lstat(t)}catch(i){throw i.message=i.message.replace("lstat","ensureSymlink"),i}return{toCwd:t,toDst:t}}let r=Nn.dirname(e),n=Nn.join(r,t);if(await EL(n))return{toCwd:n,toDst:t};try{await ws.lstat(t)}catch(i){throw i.message=i.message.replace("lstat","ensureSymlink"),i}return{toCwd:t,toDst:Nn.relative(r,t)}}function xL(t,e){if(Nn.isAbsolute(t)){if(!ws.existsSync(t))throw new Error("absolute srcpath does not exist");return{toCwd:t,toDst:t}}let r=Nn.dirname(e),n=Nn.join(r,t);if(ws.existsSync(n))return{toCwd:n,toDst:t};if(!ws.existsSync(t))throw new Error("relative srcpath does not exist");return{toCwd:t,toDst:Nn.relative(r,t)}}l_.exports={symlinkPaths:_L(SL),symlinkPathsSync:xL}});var h_=x((TG,p_)=>{"use strict";var d_=Rt(),AL=lt().fromPromise;async function OL(t,e){if(e)return e;let r;try{r=await d_.lstat(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}function FL(t,e){if(e)return e;let r;try{r=d_.lstatSync(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}p_.exports={symlinkType:AL(OL),symlinkTypeSync:FL}});var D_=x((RG,y_)=>{"use strict";var kL=lt().fromPromise,m_=require("path"),Lr=Rt(),{mkdirs:PL,mkdirsSync:$L}=Ar(),{symlinkPaths:IL,symlinkPathsSync:TL}=f_(),{symlinkType:RL,symlinkTypeSync:BL}=h_(),{pathExists:NL}=Rn(),{areIdentical:g_}=So();async function LL(t,e,r){let n;try{n=await Lr.lstat(e)}catch{}if(n&&n.isSymbolicLink()){let[s,u]=await Promise.all([Lr.stat(t),Lr.stat(e)]);if(g_(s,u))return}let o=await IL(t,e);t=o.toDst;let i=await RL(o.toCwd,r),a=m_.dirname(e);return await NL(a)||await PL(a),Lr.symlink(t,e,i)}function jL(t,e,r){let n;try{n=Lr.lstatSync(e)}catch{}if(n&&n.isSymbolicLink()){let s=Lr.statSync(t),u=Lr.statSync(e);if(g_(s,u))return}let o=TL(t,e);t=o.toDst,r=BL(o.toCwd,r);let i=m_.dirname(e);return Lr.existsSync(i)||$L(i),Lr.symlinkSync(t,e,r)}y_.exports={createSymlink:kL(LL),createSymlinkSync:jL}});var x_=x((BG,S_)=>{"use strict";var{createFile:b_,createFileSync:w_}=o_(),{createLink:v_,createLinkSync:C_}=c_(),{createSymlink:E_,createSymlinkSync:__}=D_();S_.exports={createFile:b_,createFileSync:w_,ensureFile:b_,ensureFileSync:w_,createLink:v_,createLinkSync:C_,ensureLink:v_,ensureLinkSync:C_,createSymlink:E_,createSymlinkSync:__,ensureSymlink:E_,ensureSymlinkSync:__}});var ul=x((NG,A_)=>{function UL(t,{EOL:e=`
56
- `,finalEOL:r=!0,replacer:n=null,spaces:o}={}){let i=r?e:"";return JSON.stringify(t,n,o).replace(/\n/g,e)+i}function ML(t){return Buffer.isBuffer(t)&&(t=t.toString("utf8")),t.replace(/^\uFEFF/,"")}A_.exports={stringify:UL,stripBom:ML}});var P_=x((LG,k_)=>{var Mi;try{Mi=$n()}catch{Mi=require("fs")}var cl=lt(),{stringify:O_,stripBom:F_}=ul();async function qL(t,e={}){typeof e=="string"&&(e={encoding:e});let r=e.fs||Mi,n="throws"in e?e.throws:!0,o=await cl.fromCallback(r.readFile)(t,e);o=F_(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 HL=cl.fromPromise(qL);function VL(t,e={}){typeof e=="string"&&(e={encoding:e});let r=e.fs||Mi,n="throws"in e?e.throws:!0;try{let o=r.readFileSync(t,e);return o=F_(o),JSON.parse(o,e.reviver)}catch(o){if(n)throw o.message=`${t}: ${o.message}`,o;return null}}async function zL(t,e,r={}){let n=r.fs||Mi,o=O_(e,r);await cl.fromCallback(n.writeFile)(t,o,r)}var KL=cl.fromPromise(zL);function GL(t,e,r={}){let n=r.fs||Mi,o=O_(e,r);return n.writeFileSync(t,o,r)}k_.exports={readFile:HL,readFileSync:VL,writeFile:KL,writeFileSync:GL}});var I_=x((jG,$_)=>{"use strict";var ll=P_();$_.exports={readJson:ll.readFile,readJsonSync:ll.readFileSync,writeJson:ll.writeFile,writeJsonSync:ll.writeFileSync}});var fl=x((UG,B_)=>{"use strict";var WL=lt().fromPromise,Am=Rt(),T_=require("path"),R_=Ar(),YL=Rn().pathExists;async function JL(t,e,r="utf-8"){let n=T_.dirname(t);return await YL(n)||await R_.mkdirs(n),Am.writeFile(t,e,r)}function XL(t,...e){let r=T_.dirname(t);Am.existsSync(r)||R_.mkdirsSync(r),Am.writeFileSync(t,...e)}B_.exports={outputFile:WL(JL),outputFileSync:XL}});var L_=x((MG,N_)=>{"use strict";var{stringify:ZL}=ul(),{outputFile:QL}=fl();async function ej(t,e,r={}){let n=ZL(e,r);await QL(t,n,r)}N_.exports=ej});var U_=x((qG,j_)=>{"use strict";var{stringify:tj}=ul(),{outputFileSync:rj}=fl();function nj(t,e,r){let n=tj(e,r);rj(t,n,r)}j_.exports=nj});var q_=x((HG,M_)=>{"use strict";var oj=lt().fromPromise,Nt=I_();Nt.outputJson=oj(L_());Nt.outputJsonSync=U_();Nt.outputJSON=Nt.outputJson;Nt.outputJSONSync=Nt.outputJsonSync;Nt.writeJSON=Nt.writeJson;Nt.writeJSONSync=Nt.writeJsonSync;Nt.readJSON=Nt.readJson;Nt.readJSONSync=Nt.readJsonSync;M_.exports=Nt});var G_=x((VG,K_)=>{"use strict";var ij=Rt(),H_=require("path"),{copy:aj}=sl(),{remove:z_}=bs(),{mkdirp:sj}=Ar(),{pathExists:uj}=Rn(),V_=So();async function cj(t,e,r={}){let n=r.overwrite||r.clobber||!1,{srcStat:o,isChangingCase:i=!1}=await V_.checkPaths(t,e,"move",r);await V_.checkParentPaths(t,o,e,"move");let a=H_.dirname(e);return H_.parse(a).root!==a&&await sj(a),lj(t,e,n,i)}async function lj(t,e,r,n){if(!n){if(r)await z_(e);else if(await uj(e))throw new Error("dest already exists.")}try{await ij.rename(t,e)}catch(o){if(o.code!=="EXDEV")throw o;await fj(t,e,r)}}async function fj(t,e,r){return await aj(t,e,{overwrite:r,errorOnExist:!0,preserveTimestamps:!0}),z_(t)}K_.exports=cj});var Z_=x((zG,X_)=>{"use strict";var Y_=$n(),Fm=require("path"),dj=sl().copySync,J_=bs().removeSync,pj=Ar().mkdirpSync,W_=So();function hj(t,e,r){r=r||{};let n=r.overwrite||r.clobber||!1,{srcStat:o,isChangingCase:i=!1}=W_.checkPathsSync(t,e,"move",r);return W_.checkParentPathsSync(t,o,e,"move"),mj(e)||pj(Fm.dirname(e)),gj(t,e,n,i)}function mj(t){let e=Fm.dirname(t);return Fm.parse(e).root===e}function gj(t,e,r,n){if(n)return Om(t,e,r);if(r)return J_(e),Om(t,e,r);if(Y_.existsSync(e))throw new Error("dest already exists.");return Om(t,e,r)}function Om(t,e,r){try{Y_.renameSync(t,e)}catch(n){if(n.code!=="EXDEV")throw n;return yj(t,e,r)}}function yj(t,e,r){return dj(t,e,{overwrite:r,errorOnExist:!0,preserveTimestamps:!0}),J_(t)}X_.exports=hj});var eS=x((KG,Q_)=>{"use strict";var Dj=lt().fromPromise;Q_.exports={move:Dj(G_()),moveSync:Z_()}});var qi=x((GG,tS)=>{"use strict";tS.exports={...Rt(),...sl(),...e_(),...x_(),...q_(),...Ar(),...eS(),...fl(),...Rn(),...bs()}});var uS=x((WG,sS)=>{"use strict";var km,nS,oS,iS,aS=!0;typeof process<"u"&&({FORCE_COLOR:km,NODE_DISABLE_COLORS:nS,NO_COLOR:oS,TERM:iS}=process.env||{},aS=process.stdout&&process.stdout.isTTY);var Fe={enabled:!nS&&oS==null&&iS!=="dumb"&&(km!=null&&km!=="0"||aS),reset:Be(0,0),bold:Be(1,22),dim:Be(2,22),italic:Be(3,23),underline:Be(4,24),inverse:Be(7,27),hidden:Be(8,28),strikethrough:Be(9,29),black:Be(30,39),red:Be(31,39),green:Be(32,39),yellow:Be(33,39),blue:Be(34,39),magenta:Be(35,39),cyan:Be(36,39),white:Be(37,39),gray:Be(90,39),grey:Be(90,39),bgBlack:Be(40,49),bgRed:Be(41,49),bgGreen:Be(42,49),bgYellow:Be(43,49),bgBlue:Be(44,49),bgMagenta:Be(45,49),bgCyan:Be(46,49),bgWhite:Be(47,49)};function rS(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 bj(t,e){let r={has:t,keys:e};return r.reset=Fe.reset.bind(r),r.bold=Fe.bold.bind(r),r.dim=Fe.dim.bind(r),r.italic=Fe.italic.bind(r),r.underline=Fe.underline.bind(r),r.inverse=Fe.inverse.bind(r),r.hidden=Fe.hidden.bind(r),r.strikethrough=Fe.strikethrough.bind(r),r.black=Fe.black.bind(r),r.red=Fe.red.bind(r),r.green=Fe.green.bind(r),r.yellow=Fe.yellow.bind(r),r.blue=Fe.blue.bind(r),r.magenta=Fe.magenta.bind(r),r.cyan=Fe.cyan.bind(r),r.white=Fe.white.bind(r),r.gray=Fe.gray.bind(r),r.grey=Fe.grey.bind(r),r.bgBlack=Fe.bgBlack.bind(r),r.bgRed=Fe.bgRed.bind(r),r.bgGreen=Fe.bgGreen.bind(r),r.bgYellow=Fe.bgYellow.bind(r),r.bgBlue=Fe.bgBlue.bind(r),r.bgMagenta=Fe.bgMagenta.bind(r),r.bgCyan=Fe.bgCyan.bind(r),r.bgWhite=Fe.bgWhite.bind(r),r}function Be(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:Fe.enabled?rS(this.keys,n+""):n+""):n===void 0?bj([t],[r]):Fe.enabled?rS([r],n+""):n+""}}sS.exports=Fe});var Hi=x(et=>{"use strict";Object.defineProperty(et,"__esModule",{value:!0});et.ancillary=et.failure=et.success=et.input=et.weak=et.strong=void 0;var wj=(ve(),ie(we)),jr=wj.__importDefault(uS());et.strong=jr.default.bold;et.weak=jr.default.dim;et.input=jr.default.cyan;et.success=jr.default.green;et.failure=jr.default.red;et.ancillary=jr.default.cyan;var vj={strong:et.strong,weak:et.weak,input:et.input,success:et.success,failure:et.failure,ancillary:et.ancillary,log:{DEBUG:jr.default.magenta,INFO:jr.default.cyan,WARN:jr.default.yellow,ERROR:jr.default.red}};et.default=vj});var Pm=x(dl=>{"use strict";Object.defineProperty(dl,"__esModule",{value:!0});dl.EscapeCode=void 0;var Or="\x1B[",dt=class{};dl.EscapeCode=dt;dt.cursorLeft=()=>`${Or}G`;dt.cursorUp=(t=1)=>`${Or}${t}A`;dt.cursorDown=(t=1)=>`${Or}${t}B`;dt.cursorForward=(t=1)=>`${Or}${t}C`;dt.cursorBackward=(t=1)=>`${Or}${t}D`;dt.cursorHide=()=>`${Or}?25l`;dt.cursorShow=()=>`${Or}?25h`;dt.eraseLine=()=>`${Or}2K`;dt.eraseLines=t=>{let e="";for(let r=0;r<t;r++)e+=dt.eraseLine(),r<t-1&&(e+=dt.cursorUp());return`${e}${dt.cursorLeft()}`};dt.eraseUp=()=>`${Or}1J`;dt.eraseDown=()=>`${Or}J`;dt.eraseScreen=()=>`${Or}2J`});var lS=x(pl=>{"use strict";Object.defineProperty(pl,"__esModule",{value:!0});pl.Cursor=void 0;var Cj=(ve(),ie(we)),Ej=Cj.__importDefault(om()),cS=Pm(),Vi=class t{static show(){t.stream.isTTY&&(t._isVisible=!0,t.stream.write(cS.EscapeCode.cursorShow()))}static hide(){t.stream.isTTY&&(t._listenerAttached||((0,Ej.default)(()=>{t.show()}),t._listenerAttached=!0),t._isVisible=!1,t.stream.write(cS.EscapeCode.cursorHide()))}static toggle(){t._isVisible?t.hide():t.show()}};pl.Cursor=Vi;Vi.stream=process.stderr;Vi._isVisible=!0;Vi._listenerAttached=!1});var Im=x((ZG,$m)=>{"use strict";var fS=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);$m.exports=fS;$m.exports.default=fS});var hS=x((QG,pS)=>{"use strict";var dS="[\uD800-\uDBFF][\uDC00-\uDFFF]",_j=t=>t&&t.exact?new RegExp(`^${dS}$`):new RegExp(dS,"g");pS.exports=_j});var gS=x((eW,mS)=>{"use strict";mS.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 Tm=x((tW,DS)=>{var vs=gS(),yS={};for(let t of Object.keys(vs))yS[vs[t]]=t;var Q={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"]}};DS.exports=Q;for(let t of Object.keys(Q)){if(!("channels"in Q[t]))throw new Error("missing channels property: "+t);if(!("labels"in Q[t]))throw new Error("missing channel labels property: "+t);if(Q[t].labels.length!==Q[t].channels)throw new Error("channel and label counts mismatch: "+t);let{channels:e,labels:r}=Q[t];delete Q[t].channels,delete Q[t].labels,Object.defineProperty(Q[t],"channels",{value:e}),Object.defineProperty(Q[t],"labels",{value:r})}Q.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]};Q.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),f=c-Math.min(a,s,u),d=function(p){return(c-p)/6/f+1/2};return f===0?(o=0,i=0):(i=f/c,e=d(a),r=d(s),n=d(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]};Q.rgb.hwb=function(t){let e=t[0],r=t[1],n=t[2],o=Q.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]};Q.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 Sj(t,e){return(t[0]-e[0])**2+(t[1]-e[1])**2+(t[2]-e[2])**2}Q.rgb.keyword=function(t){let e=yS[t];if(e)return e;let r=1/0,n;for(let o of Object.keys(vs)){let i=vs[o],a=Sj(t,i);a<r&&(r=a,n=o)}return n};Q.keyword.rgb=function(t){return vs[t]};Q.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]};Q.rgb.lab=function(t){let e=Q.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]};Q.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};Q.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]};Q.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]}};Q.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]};Q.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,f,d;switch(a){default:case 6:case 0:c=s,f=u,d=r;break;case 1:c=u,f=s,d=r;break;case 2:c=r,f=s,d=u;break;case 3:c=r,f=u,d=s;break;case 4:c=u,f=r,d=s;break;case 5:c=s,f=r,d=u;break}return[c*255,f*255,d*255]};Q.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]};Q.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]};Q.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]};Q.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]};Q.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]};Q.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]};Q.rgb.ansi16=function(t,e=null){let[r,n,o]=t,i=e===null?Q.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};Q.hsv.ansi16=function(t){return Q.rgb.ansi16(Q.hsv.rgb(t),t[2])};Q.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)};Q.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]};Q.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]};Q.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};Q.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]};Q.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]};Q.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]};Q.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]};Q.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]};Q.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]};Q.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]};Q.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]};Q.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]};Q.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]};Q.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]};Q.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]};Q.gray.hsl=function(t){return[0,0,t[0]]};Q.gray.hsv=Q.gray.hsl;Q.gray.hwb=function(t){return[0,100,t[0]]};Q.gray.cmyk=function(t){return[0,0,0,t[0]]};Q.gray.lab=function(t){return[t[0],0,0]};Q.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};Q.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]}});var wS=x((rW,bS)=>{var hl=Tm();function xj(){let t={},e=Object.keys(hl);for(let r=e.length,n=0;n<r;n++)t[e[n]]={distance:-1,parent:null};return t}function Aj(t){let e=xj(),r=[t];for(e[t].distance=0;r.length;){let n=r.pop(),o=Object.keys(hl[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 Oj(t,e){return function(r){return e(t(r))}}function Fj(t,e){let r=[e[t].parent,t],n=hl[e[t].parent][t],o=e[t].parent;for(;e[o].parent;)r.unshift(e[o].parent),n=Oj(hl[e[o].parent][o],n),o=e[o].parent;return n.conversion=r,n}bS.exports=function(t){let e=Aj(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]=Fj(a,e))}return r}});var CS=x((nW,vS)=>{var Rm=Tm(),kj=wS(),zi={},Pj=Object.keys(Rm);function $j(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 Ij(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}Pj.forEach(t=>{zi[t]={},Object.defineProperty(zi[t],"channels",{value:Rm[t].channels}),Object.defineProperty(zi[t],"labels",{value:Rm[t].labels});let e=kj(t);Object.keys(e).forEach(n=>{let o=e[n];zi[t][n]=Ij(o),zi[t][n].raw=$j(o)})});vS.exports=zi});var Nm=x((oW,AS)=>{"use strict";var ES=(t,e)=>(...r)=>`\x1B[${t(...r)+e}m`,_S=(t,e)=>(...r)=>{let n=t(...r);return`\x1B[${38+e};5;${n}m`},SS=(t,e)=>(...r)=>{let n=t(...r);return`\x1B[${38+e};2;${n[0]};${n[1]};${n[2]}m`},ml=t=>t,xS=(t,e,r)=>[t,e,r],Ki=(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})},Bm,Gi=(t,e,r,n)=>{Bm===void 0&&(Bm=CS());let o=n?10:0,i={};for(let[a,s]of Object.entries(Bm)){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 Tj(){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",Ki(e.color,"ansi",()=>Gi(ES,"ansi16",ml,!1)),Ki(e.color,"ansi256",()=>Gi(_S,"ansi256",ml,!1)),Ki(e.color,"ansi16m",()=>Gi(SS,"rgb",xS,!1)),Ki(e.bgColor,"ansi",()=>Gi(ES,"ansi16",ml,!0)),Ki(e.bgColor,"ansi256",()=>Gi(_S,"ansi256",ml,!0)),Ki(e.bgColor,"ansi16m",()=>Gi(SS,"rgb",xS,!0)),e}Object.defineProperty(AS,"exports",{enumerable:!0,get:Tj})});var $S=x((iW,PS)=>{"use strict";var Rj=Im(),Bj=hS(),OS=Nm(),kS=["\x1B","\x9B"],gl=t=>`${kS[0]}[${t}m`,FS=(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=OS.codes.get(Number.parseInt(o,10));if(a){let s=t.indexOf(a.toString());s===-1?n.push(gl(e?a:i)):t.splice(s,1)}else if(e){n.push(gl(0));break}else n.push(gl(i))}if(e&&(n=n.filter((o,i)=>n.indexOf(o)===i),r!==void 0)){let o=gl(OS.codes.get(Number.parseInt(r,10)));n=n.reduce((i,a)=>a===o?[a,...i]:[...i,a],[])}return n.join("")};PS.exports=(t,e,r)=>{let n=[...t],o=[],i=typeof r=="number"?r:n.length,a=!1,s,u=0,c="";for(let[f,d]of n.entries()){let p=!1;if(kS.includes(d)){let h=/\d[^m]*/.exec(t.slice(f,f+18));s=h&&h.length>0?h[0]:void 0,u<i&&(a=!0,s!==void 0&&o.push(s))}else a&&d==="m"&&(a=!1,p=!0);if(!a&&!p&&u++,!Bj({exact:!0}).test(d)&&Rj(d.codePointAt())&&(u++,typeof r!="number"&&i++),u>e&&u<=i)c+=d;else if(u===e&&!a&&s!==void 0)c=FS(o);else if(u>=i){c+=FS(o,!0,s);break}}return c}});var TS=x((aW,IS)=>{"use strict";IS.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 yl=x((sW,RS)=>{"use strict";var Nj=TS();RS.exports=t=>typeof t=="string"?t.replace(Nj(),""):t});var NS=x((uW,BS)=>{"use strict";BS.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 jm=x((cW,Lm)=>{"use strict";var Lj=yl(),jj=Im(),Uj=NS(),LS=t=>{if(typeof t!="string"||t.length===0||(t=Lj(t),t.length===0))return 0;t=t.replace(Uj()," ");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+=jj(n)?2:1)}return e};Lm.exports=LS;Lm.exports.default=LS});var VS=x((lW,HS)=>{"use strict";var Cs=jm(),Mj=yl(),qj=Nm(),Dl=new Set(["\x1B","\x9B"]),Hj=39,Mm="\x07",MS="[",Vj="]",qS="m",qm=`${Vj}8;;`,jS=t=>`${Dl.values().next().value}${MS}${t}${qS}`,US=t=>`${Dl.values().next().value}${qm}${t}${Mm}`,zj=t=>t.split(" ").map(e=>Cs(e)),Um=(t,e,r)=>{let n=[...e],o=!1,i=!1,a=Cs(Mj(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),Dl.has(u)&&(o=!0,i=n.slice(s+1).join("").startsWith(qm)),o){i?u===Mm&&(o=!1,i=!1):u===qS&&(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())},Kj=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("")},Gj=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",o,i,a=zj(t),s=[""];for(let[c,f]of t.split(" ").entries()){r.trim!==!1&&(s[s.length-1]=s[s.length-1].trimStart());let d=Cs(s[s.length-1]);if(c!==0&&(d>=e&&(r.wordWrap===!1||r.trim===!1)&&(s.push(""),d=0),(d>0||r.trim===!1)&&(s[s.length-1]+=" ",d++)),r.hard&&a[c]>e){let p=e-d,h=1+Math.floor((a[c]-p-1)/e);Math.floor((a[c]-1)/e)<h&&s.push(""),Um(s,f,e);continue}if(d+a[c]>e&&d>0&&a[c]>0){if(r.wordWrap===!1&&d<e){Um(s,f,e);continue}s.push("")}if(d+a[c]>e&&r.wordWrap===!1){Um(s,f,e);continue}s[s.length-1]+=f}r.trim!==!1&&(s=s.map(Kj));let u=[...s.join(`
57
- `)];for(let[c,f]of u.entries()){if(n+=f,Dl.has(f)){let{groups:p}=new RegExp(`(?:\\${MS}(?<code>\\d+)m|\\${qm}(?<uri>.*)${Mm})`).exec(u.slice(c).join(""))||{groups:{}};if(p.code!==void 0){let h=Number.parseFloat(p.code);o=h===Hj?void 0:h}else p.uri!==void 0&&(i=p.uri.length===0?void 0:p.uri)}let d=qj.codes.get(Number(o));u[c+1]===`
58
- `?(i&&(n+=US("")),o&&d&&(n+=jS(d))):f===`
59
- `&&(o&&d&&(n+=jS(o)),i&&(n+=US(i)))}return n};HS.exports=(t,e,r)=>String(t).normalize().replace(/\r\n/g,`
55
+ see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0002");let{srcStat:n,destStat:o}=bs.checkPathsSync(t,e,"copy",r);if(bs.checkParentPathsSync(t,n,e,"copy"),r.filter&&!r.filter(t,e))return;let i=Ds.dirname(e);return Nt.existsSync(i)||rL(i),VE(o,t,e,r)}function VE(t,e,r,n){let i=(n.dereference?Nt.statSync:Nt.lstatSync)(e);if(i.isDirectory())return fL(i,t,e,r,n);if(i.isFile()||i.isCharacterDevice()||i.isBlockDevice())return iL(i,t,e,r,n);if(i.isSymbolicLink())return hL(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 iL(t,e,r,n,o){return e?aL(t,r,n,o):zE(t,r,n,o)}function aL(t,e,r,n){if(n.overwrite)return Nt.unlinkSync(r),zE(t,e,r,n);if(n.errorOnExist)throw new Error(`'${r}' already exists`)}function zE(t,e,r,n){return Nt.copyFileSync(e,r),n.preserveTimestamps&&sL(t.mode,e,r),km(r,t.mode)}function sL(t,e,r){return uL(t)&&cL(r,t),lL(e,r)}function uL(t){return(t&128)===0}function cL(t,e){return km(t,e|128)}function km(t,e){return Nt.chmodSync(t,e)}function lL(t,e){let r=Nt.statSync(t);return nL(e,r.atime,r.mtime)}function fL(t,e,r,n,o){return e?KE(r,n,o):dL(t.mode,r,n,o)}function dL(t,e,r,n){return Nt.mkdirSync(r),KE(e,r,n),km(r,t)}function KE(t,e,r){let n=Nt.opendirSync(t);try{let o;for(;(o=n.readSync())!==null;)pL(o.name,t,e,r)}finally{n.closeSync()}}function pL(t,e,r,n){let o=Ds.join(e,t),i=Ds.join(r,t);if(n.filter&&!n.filter(o,i))return;let{destStat:a}=bs.checkPathsSync(o,i,"copy",n);return VE(a,o,i,n)}function hL(t,e,r,n){let o=Nt.readlinkSync(e);if(n.dereference&&(o=Ds.resolve(process.cwd(),o)),t){let i;try{i=Nt.readlinkSync(r)}catch(a){if(a.code==="EINVAL"||a.code==="UNKNOWN")return Nt.symlinkSync(o,r);throw a}if(n.dereference&&(i=Ds.resolve(process.cwd(),i)),bs.isSrcSubdir(o,i))throw new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`);if(bs.isSrcSubdir(i,o))throw new Error(`Cannot overwrite '${i}' with '${o}'.`);return mL(o,r)}else return Nt.symlinkSync(o,r)}function mL(t,e){return Nt.unlinkSync(e),Nt.symlinkSync(t,e)}GE.exports=oL});var fl=x((TG,YE)=>{"use strict";var gL=ft().fromPromise;YE.exports={copy:gL(HE()),copySync:WE()}});var ws=x((RG,XE)=>{"use strict";var JE=Rn(),yL=ft().fromCallback;function DL(t,e){JE.rm(t,{recursive:!0,force:!0},e)}function bL(t){JE.rmSync(t,{recursive:!0,force:!0})}XE.exports={remove:yL(DL),removeSync:bL}});var i_=x((BG,o_)=>{"use strict";var wL=ft().fromPromise,e_=Bt(),t_=require("path"),r_=kr(),n_=ws(),ZE=wL(async function(e){let r;try{r=await e_.readdir(e)}catch{return r_.mkdirs(e)}return Promise.all(r.map(n=>n_.remove(t_.join(e,n))))});function QE(t){let e;try{e=e_.readdirSync(t)}catch{return r_.mkdirsSync(t)}e.forEach(r=>{r=t_.join(t,r),n_.removeSync(r)})}o_.exports={emptyDirSync:QE,emptydirSync:QE,emptyDir:ZE,emptydir:ZE}});var c_=x((NG,u_)=>{"use strict";var vL=ft().fromPromise,a_=require("path"),dn=Bt(),s_=kr();async function CL(t){let e;try{e=await dn.stat(t)}catch{}if(e&&e.isFile())return;let r=a_.dirname(t),n=null;try{n=await dn.stat(r)}catch(o){if(o.code==="ENOENT"){await s_.mkdirs(r),await dn.writeFile(t,"");return}else throw o}n.isDirectory()?await dn.writeFile(t,""):await dn.readdir(r)}function EL(t){let e;try{e=dn.statSync(t)}catch{}if(e&&e.isFile())return;let r=a_.dirname(t);try{dn.statSync(r).isDirectory()||dn.readdirSync(r)}catch(n){if(n&&n.code==="ENOENT")s_.mkdirsSync(r);else throw n}dn.writeFileSync(t,"")}u_.exports={createFile:vL(CL),createFileSync:EL}});var h_=x((LG,p_)=>{"use strict";var _L=ft().fromPromise,l_=require("path"),jn=Bt(),f_=kr(),{pathExists:SL}=Ln(),{areIdentical:d_}=Ao();async function xL(t,e){let r;try{r=await jn.lstat(e)}catch{}let n;try{n=await jn.lstat(t)}catch(a){throw a.message=a.message.replace("lstat","ensureLink"),a}if(r&&d_(n,r))return;let o=l_.dirname(e);await SL(o)||await f_.mkdirs(o),await jn.link(t,e)}function AL(t,e){let r;try{r=jn.lstatSync(e)}catch{}try{let i=jn.lstatSync(t);if(r&&d_(i,r))return}catch(i){throw i.message=i.message.replace("lstat","ensureLink"),i}let n=l_.dirname(e);return jn.existsSync(n)||f_.mkdirsSync(n),jn.linkSync(t,e)}p_.exports={createLink:_L(xL),createLinkSync:AL}});var g_=x((jG,m_)=>{"use strict";var Un=require("path"),vs=Bt(),{pathExists:OL}=Ln(),FL=ft().fromPromise;async function PL(t,e){if(Un.isAbsolute(t)){try{await vs.lstat(t)}catch(i){throw i.message=i.message.replace("lstat","ensureSymlink"),i}return{toCwd:t,toDst:t}}let r=Un.dirname(e),n=Un.join(r,t);if(await OL(n))return{toCwd:n,toDst:t};try{await vs.lstat(t)}catch(i){throw i.message=i.message.replace("lstat","ensureSymlink"),i}return{toCwd:t,toDst:Un.relative(r,t)}}function kL(t,e){if(Un.isAbsolute(t)){if(!vs.existsSync(t))throw new Error("absolute srcpath does not exist");return{toCwd:t,toDst:t}}let r=Un.dirname(e),n=Un.join(r,t);if(vs.existsSync(n))return{toCwd:n,toDst:t};if(!vs.existsSync(t))throw new Error("relative srcpath does not exist");return{toCwd:t,toDst:Un.relative(r,t)}}m_.exports={symlinkPaths:FL(PL),symlinkPathsSync:kL}});var b_=x((UG,D_)=>{"use strict";var y_=Bt(),$L=ft().fromPromise;async function IL(t,e){if(e)return e;let r;try{r=await y_.lstat(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}function TL(t,e){if(e)return e;let r;try{r=y_.lstatSync(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}D_.exports={symlinkType:$L(IL),symlinkTypeSync:TL}});var E_=x((MG,C_)=>{"use strict";var RL=ft().fromPromise,w_=require("path"),Mr=Bt(),{mkdirs:BL,mkdirsSync:NL}=kr(),{symlinkPaths:LL,symlinkPathsSync:jL}=g_(),{symlinkType:UL,symlinkTypeSync:ML}=b_(),{pathExists:qL}=Ln(),{areIdentical:v_}=Ao();async function HL(t,e,r){let n;try{n=await Mr.lstat(e)}catch{}if(n&&n.isSymbolicLink()){let[s,u]=await Promise.all([Mr.stat(t),Mr.stat(e)]);if(v_(s,u))return}let o=await LL(t,e);t=o.toDst;let i=await UL(o.toCwd,r),a=w_.dirname(e);return await qL(a)||await BL(a),Mr.symlink(t,e,i)}function VL(t,e,r){let n;try{n=Mr.lstatSync(e)}catch{}if(n&&n.isSymbolicLink()){let s=Mr.statSync(t),u=Mr.statSync(e);if(v_(s,u))return}let o=jL(t,e);t=o.toDst,r=ML(o.toCwd,r);let i=w_.dirname(e);return Mr.existsSync(i)||NL(i),Mr.symlinkSync(t,e,r)}C_.exports={createSymlink:RL(HL),createSymlinkSync:VL}});var k_=x((qG,P_)=>{"use strict";var{createFile:__,createFileSync:S_}=c_(),{createLink:x_,createLinkSync:A_}=h_(),{createSymlink:O_,createSymlinkSync:F_}=E_();P_.exports={createFile:__,createFileSync:S_,ensureFile:__,ensureFileSync:S_,createLink:x_,createLinkSync:A_,ensureLink:x_,ensureLinkSync:A_,createSymlink:O_,createSymlinkSync:F_,ensureSymlink:O_,ensureSymlinkSync:F_}});var dl=x((HG,$_)=>{function zL(t,{EOL:e=`
56
+ `,finalEOL:r=!0,replacer:n=null,spaces:o}={}){let i=r?e:"";return JSON.stringify(t,n,o).replace(/\n/g,e)+i}function KL(t){return Buffer.isBuffer(t)&&(t=t.toString("utf8")),t.replace(/^\uFEFF/,"")}$_.exports={stringify:zL,stripBom:KL}});var B_=x((VG,R_)=>{var Mi;try{Mi=Rn()}catch{Mi=require("fs")}var pl=ft(),{stringify:I_,stripBom:T_}=dl();async function GL(t,e={}){typeof e=="string"&&(e={encoding:e});let r=e.fs||Mi,n="throws"in e?e.throws:!0,o=await pl.fromCallback(r.readFile)(t,e);o=T_(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 WL=pl.fromPromise(GL);function YL(t,e={}){typeof e=="string"&&(e={encoding:e});let r=e.fs||Mi,n="throws"in e?e.throws:!0;try{let o=r.readFileSync(t,e);return o=T_(o),JSON.parse(o,e.reviver)}catch(o){if(n)throw o.message=`${t}: ${o.message}`,o;return null}}async function JL(t,e,r={}){let n=r.fs||Mi,o=I_(e,r);await pl.fromCallback(n.writeFile)(t,o,r)}var XL=pl.fromPromise(JL);function ZL(t,e,r={}){let n=r.fs||Mi,o=I_(e,r);return n.writeFileSync(t,o,r)}R_.exports={readFile:WL,readFileSync:YL,writeFile:XL,writeFileSync:ZL}});var L_=x((zG,N_)=>{"use strict";var hl=B_();N_.exports={readJson:hl.readFile,readJsonSync:hl.readFileSync,writeJson:hl.writeFile,writeJsonSync:hl.writeFileSync}});var ml=x((KG,M_)=>{"use strict";var QL=ft().fromPromise,$m=Bt(),j_=require("path"),U_=kr(),ej=Ln().pathExists;async function tj(t,e,r="utf-8"){let n=j_.dirname(t);return await ej(n)||await U_.mkdirs(n),$m.writeFile(t,e,r)}function rj(t,...e){let r=j_.dirname(t);$m.existsSync(r)||U_.mkdirsSync(r),$m.writeFileSync(t,...e)}M_.exports={outputFile:QL(tj),outputFileSync:rj}});var H_=x((GG,q_)=>{"use strict";var{stringify:nj}=dl(),{outputFile:oj}=ml();async function ij(t,e,r={}){let n=nj(e,r);await oj(t,n,r)}q_.exports=ij});var z_=x((WG,V_)=>{"use strict";var{stringify:aj}=dl(),{outputFileSync:sj}=ml();function uj(t,e,r){let n=aj(e,r);sj(t,n,r)}V_.exports=uj});var G_=x((YG,K_)=>{"use strict";var cj=ft().fromPromise,Lt=L_();Lt.outputJson=cj(H_());Lt.outputJsonSync=z_();Lt.outputJSON=Lt.outputJson;Lt.outputJSONSync=Lt.outputJsonSync;Lt.writeJSON=Lt.writeJson;Lt.writeJSONSync=Lt.writeJsonSync;Lt.readJSON=Lt.readJson;Lt.readJSONSync=Lt.readJsonSync;K_.exports=Lt});var Z_=x((JG,X_)=>{"use strict";var lj=Bt(),W_=require("path"),{copy:fj}=fl(),{remove:J_}=ws(),{mkdirp:dj}=kr(),{pathExists:pj}=Ln(),Y_=Ao();async function hj(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=W_.dirname(e);return W_.parse(a).root!==a&&await dj(a),mj(t,e,n,i)}async function mj(t,e,r,n){if(!n){if(r)await J_(e);else if(await pj(e))throw new Error("dest already exists.")}try{await lj.rename(t,e)}catch(o){if(o.code!=="EXDEV")throw o;await gj(t,e,r)}}async function gj(t,e,r){return await fj(t,e,{overwrite:r,errorOnExist:!0,preserveTimestamps:!0}),J_(t)}X_.exports=hj});var nS=x((XG,rS)=>{"use strict";var eS=Rn(),Tm=require("path"),yj=fl().copySync,tS=ws().removeSync,Dj=kr().mkdirpSync,Q_=Ao();function bj(t,e,r){r=r||{};let n=r.overwrite||r.clobber||!1,{srcStat:o,isChangingCase:i=!1}=Q_.checkPathsSync(t,e,"move",r);return Q_.checkParentPathsSync(t,o,e,"move"),wj(e)||Dj(Tm.dirname(e)),vj(t,e,n,i)}function wj(t){let e=Tm.dirname(t);return Tm.parse(e).root===e}function vj(t,e,r,n){if(n)return Im(t,e,r);if(r)return tS(e),Im(t,e,r);if(eS.existsSync(e))throw new Error("dest already exists.");return Im(t,e,r)}function Im(t,e,r){try{eS.renameSync(t,e)}catch(n){if(n.code!=="EXDEV")throw n;return Cj(t,e,r)}}function Cj(t,e,r){return yj(t,e,{overwrite:r,errorOnExist:!0,preserveTimestamps:!0}),tS(t)}rS.exports=bj});var iS=x((ZG,oS)=>{"use strict";var Ej=ft().fromPromise;oS.exports={move:Ej(Z_()),moveSync:nS()}});var qi=x((QG,aS)=>{"use strict";aS.exports={...Bt(),...fl(),...i_(),...k_(),...G_(),...kr(),...iS(),...ml(),...Ln(),...ws()}});var pS=x((eW,dS)=>{"use strict";var Rm,uS,cS,lS,fS=!0;typeof process<"u"&&({FORCE_COLOR:Rm,NODE_DISABLE_COLORS:uS,NO_COLOR:cS,TERM:lS}=process.env||{},fS=process.stdout&&process.stdout.isTTY);var Pe={enabled:!uS&&cS==null&&lS!=="dumb"&&(Rm!=null&&Rm!=="0"||fS),reset:Be(0,0),bold:Be(1,22),dim:Be(2,22),italic:Be(3,23),underline:Be(4,24),inverse:Be(7,27),hidden:Be(8,28),strikethrough:Be(9,29),black:Be(30,39),red:Be(31,39),green:Be(32,39),yellow:Be(33,39),blue:Be(34,39),magenta:Be(35,39),cyan:Be(36,39),white:Be(37,39),gray:Be(90,39),grey:Be(90,39),bgBlack:Be(40,49),bgRed:Be(41,49),bgGreen:Be(42,49),bgYellow:Be(43,49),bgBlue:Be(44,49),bgMagenta:Be(45,49),bgCyan:Be(46,49),bgWhite:Be(47,49)};function sS(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 _j(t,e){let r={has:t,keys:e};return r.reset=Pe.reset.bind(r),r.bold=Pe.bold.bind(r),r.dim=Pe.dim.bind(r),r.italic=Pe.italic.bind(r),r.underline=Pe.underline.bind(r),r.inverse=Pe.inverse.bind(r),r.hidden=Pe.hidden.bind(r),r.strikethrough=Pe.strikethrough.bind(r),r.black=Pe.black.bind(r),r.red=Pe.red.bind(r),r.green=Pe.green.bind(r),r.yellow=Pe.yellow.bind(r),r.blue=Pe.blue.bind(r),r.magenta=Pe.magenta.bind(r),r.cyan=Pe.cyan.bind(r),r.white=Pe.white.bind(r),r.gray=Pe.gray.bind(r),r.grey=Pe.grey.bind(r),r.bgBlack=Pe.bgBlack.bind(r),r.bgRed=Pe.bgRed.bind(r),r.bgGreen=Pe.bgGreen.bind(r),r.bgYellow=Pe.bgYellow.bind(r),r.bgBlue=Pe.bgBlue.bind(r),r.bgMagenta=Pe.bgMagenta.bind(r),r.bgCyan=Pe.bgCyan.bind(r),r.bgWhite=Pe.bgWhite.bind(r),r}function Be(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:Pe.enabled?sS(this.keys,n+""):n+""):n===void 0?_j([t],[r]):Pe.enabled?sS([r],n+""):n+""}}dS.exports=Pe});var Hi=x(tt=>{"use strict";Object.defineProperty(tt,"__esModule",{value:!0});tt.ancillary=tt.failure=tt.success=tt.input=tt.weak=tt.strong=void 0;var Sj=(ve(),ie(we)),qr=Sj.__importDefault(pS());tt.strong=qr.default.bold;tt.weak=qr.default.dim;tt.input=qr.default.cyan;tt.success=qr.default.green;tt.failure=qr.default.red;tt.ancillary=qr.default.cyan;var xj={strong:tt.strong,weak:tt.weak,input:tt.input,success:tt.success,failure:tt.failure,ancillary:tt.ancillary,log:{DEBUG:qr.default.magenta,INFO:qr.default.cyan,WARN:qr.default.yellow,ERROR:qr.default.red}};tt.default=xj});var Bm=x(gl=>{"use strict";Object.defineProperty(gl,"__esModule",{value:!0});gl.EscapeCode=void 0;var $r="\x1B[",pt=class{};gl.EscapeCode=pt;pt.cursorLeft=()=>`${$r}G`;pt.cursorUp=(t=1)=>`${$r}${t}A`;pt.cursorDown=(t=1)=>`${$r}${t}B`;pt.cursorForward=(t=1)=>`${$r}${t}C`;pt.cursorBackward=(t=1)=>`${$r}${t}D`;pt.cursorHide=()=>`${$r}?25l`;pt.cursorShow=()=>`${$r}?25h`;pt.eraseLine=()=>`${$r}2K`;pt.eraseLines=t=>{let e="";for(let r=0;r<t;r++)e+=pt.eraseLine(),r<t-1&&(e+=pt.cursorUp());return`${e}${pt.cursorLeft()}`};pt.eraseUp=()=>`${$r}1J`;pt.eraseDown=()=>`${$r}J`;pt.eraseScreen=()=>`${$r}2J`});var mS=x(yl=>{"use strict";Object.defineProperty(yl,"__esModule",{value:!0});yl.Cursor=void 0;var Aj=(ve(),ie(we)),Oj=Aj.__importDefault(cm()),hS=Bm(),Vi=class t{static show(){t.stream.isTTY&&(t._isVisible=!0,t.stream.write(hS.EscapeCode.cursorShow()))}static hide(){t.stream.isTTY&&(t._listenerAttached||((0,Oj.default)(()=>{t.show()}),t._listenerAttached=!0),t._isVisible=!1,t.stream.write(hS.EscapeCode.cursorHide()))}static toggle(){t._isVisible?t.hide():t.show()}};yl.Cursor=Vi;Vi.stream=process.stderr;Vi._isVisible=!0;Vi._listenerAttached=!1});var Lm=x((oW,Nm)=>{"use strict";var gS=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);Nm.exports=gS;Nm.exports.default=gS});var bS=x((iW,DS)=>{"use strict";var yS="[\uD800-\uDBFF][\uDC00-\uDFFF]",Fj=t=>t&&t.exact?new RegExp(`^${yS}$`):new RegExp(yS,"g");DS.exports=Fj});var vS=x((aW,wS)=>{"use strict";wS.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 jm=x((sW,ES)=>{var Cs=vS(),CS={};for(let t of Object.keys(Cs))CS[Cs[t]]=t;var Q={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"]}};ES.exports=Q;for(let t of Object.keys(Q)){if(!("channels"in Q[t]))throw new Error("missing channels property: "+t);if(!("labels"in Q[t]))throw new Error("missing channel labels property: "+t);if(Q[t].labels.length!==Q[t].channels)throw new Error("channel and label counts mismatch: "+t);let{channels:e,labels:r}=Q[t];delete Q[t].channels,delete Q[t].labels,Object.defineProperty(Q[t],"channels",{value:e}),Object.defineProperty(Q[t],"labels",{value:r})}Q.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]};Q.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),f=c-Math.min(a,s,u),d=function(p){return(c-p)/6/f+1/2};return f===0?(o=0,i=0):(i=f/c,e=d(a),r=d(s),n=d(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]};Q.rgb.hwb=function(t){let e=t[0],r=t[1],n=t[2],o=Q.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]};Q.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 Pj(t,e){return(t[0]-e[0])**2+(t[1]-e[1])**2+(t[2]-e[2])**2}Q.rgb.keyword=function(t){let e=CS[t];if(e)return e;let r=1/0,n;for(let o of Object.keys(Cs)){let i=Cs[o],a=Pj(t,i);a<r&&(r=a,n=o)}return n};Q.keyword.rgb=function(t){return Cs[t]};Q.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]};Q.rgb.lab=function(t){let e=Q.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]};Q.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};Q.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]};Q.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]}};Q.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]};Q.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,f,d;switch(a){default:case 6:case 0:c=s,f=u,d=r;break;case 1:c=u,f=s,d=r;break;case 2:c=r,f=s,d=u;break;case 3:c=r,f=u,d=s;break;case 4:c=u,f=r,d=s;break;case 5:c=s,f=r,d=u;break}return[c*255,f*255,d*255]};Q.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]};Q.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]};Q.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]};Q.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]};Q.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]};Q.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]};Q.rgb.ansi16=function(t,e=null){let[r,n,o]=t,i=e===null?Q.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};Q.hsv.ansi16=function(t){return Q.rgb.ansi16(Q.hsv.rgb(t),t[2])};Q.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)};Q.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]};Q.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]};Q.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};Q.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]};Q.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]};Q.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]};Q.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]};Q.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]};Q.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]};Q.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]};Q.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]};Q.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]};Q.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]};Q.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]};Q.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]};Q.gray.hsl=function(t){return[0,0,t[0]]};Q.gray.hsv=Q.gray.hsl;Q.gray.hwb=function(t){return[0,100,t[0]]};Q.gray.cmyk=function(t){return[0,0,0,t[0]]};Q.gray.lab=function(t){return[t[0],0,0]};Q.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};Q.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]}});var SS=x((uW,_S)=>{var Dl=jm();function kj(){let t={},e=Object.keys(Dl);for(let r=e.length,n=0;n<r;n++)t[e[n]]={distance:-1,parent:null};return t}function $j(t){let e=kj(),r=[t];for(e[t].distance=0;r.length;){let n=r.pop(),o=Object.keys(Dl[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 Ij(t,e){return function(r){return e(t(r))}}function Tj(t,e){let r=[e[t].parent,t],n=Dl[e[t].parent][t],o=e[t].parent;for(;e[o].parent;)r.unshift(e[o].parent),n=Ij(Dl[e[o].parent][o],n),o=e[o].parent;return n.conversion=r,n}_S.exports=function(t){let e=$j(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]=Tj(a,e))}return r}});var AS=x((cW,xS)=>{var Um=jm(),Rj=SS(),zi={},Bj=Object.keys(Um);function Nj(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 Lj(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}Bj.forEach(t=>{zi[t]={},Object.defineProperty(zi[t],"channels",{value:Um[t].channels}),Object.defineProperty(zi[t],"labels",{value:Um[t].labels});let e=Rj(t);Object.keys(e).forEach(n=>{let o=e[n];zi[t][n]=Lj(o),zi[t][n].raw=Nj(o)})});xS.exports=zi});var qm=x((lW,$S)=>{"use strict";var OS=(t,e)=>(...r)=>`\x1B[${t(...r)+e}m`,FS=(t,e)=>(...r)=>{let n=t(...r);return`\x1B[${38+e};5;${n}m`},PS=(t,e)=>(...r)=>{let n=t(...r);return`\x1B[${38+e};2;${n[0]};${n[1]};${n[2]}m`},bl=t=>t,kS=(t,e,r)=>[t,e,r],Ki=(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})},Mm,Gi=(t,e,r,n)=>{Mm===void 0&&(Mm=AS());let o=n?10:0,i={};for(let[a,s]of Object.entries(Mm)){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 jj(){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",Ki(e.color,"ansi",()=>Gi(OS,"ansi16",bl,!1)),Ki(e.color,"ansi256",()=>Gi(FS,"ansi256",bl,!1)),Ki(e.color,"ansi16m",()=>Gi(PS,"rgb",kS,!1)),Ki(e.bgColor,"ansi",()=>Gi(OS,"ansi16",bl,!0)),Ki(e.bgColor,"ansi256",()=>Gi(FS,"ansi256",bl,!0)),Ki(e.bgColor,"ansi16m",()=>Gi(PS,"rgb",kS,!0)),e}Object.defineProperty($S,"exports",{enumerable:!0,get:jj})});var NS=x((fW,BS)=>{"use strict";var Uj=Lm(),Mj=bS(),IS=qm(),RS=["\x1B","\x9B"],wl=t=>`${RS[0]}[${t}m`,TS=(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=IS.codes.get(Number.parseInt(o,10));if(a){let s=t.indexOf(a.toString());s===-1?n.push(wl(e?a:i)):t.splice(s,1)}else if(e){n.push(wl(0));break}else n.push(wl(i))}if(e&&(n=n.filter((o,i)=>n.indexOf(o)===i),r!==void 0)){let o=wl(IS.codes.get(Number.parseInt(r,10)));n=n.reduce((i,a)=>a===o?[a,...i]:[...i,a],[])}return n.join("")};BS.exports=(t,e,r)=>{let n=[...t],o=[],i=typeof r=="number"?r:n.length,a=!1,s,u=0,c="";for(let[f,d]of n.entries()){let p=!1;if(RS.includes(d)){let h=/\d[^m]*/.exec(t.slice(f,f+18));s=h&&h.length>0?h[0]:void 0,u<i&&(a=!0,s!==void 0&&o.push(s))}else a&&d==="m"&&(a=!1,p=!0);if(!a&&!p&&u++,!Mj({exact:!0}).test(d)&&Uj(d.codePointAt())&&(u++,typeof r!="number"&&i++),u>e&&u<=i)c+=d;else if(u===e&&!a&&s!==void 0)c=TS(o);else if(u>=i){c+=TS(o,!0,s);break}}return c}});var jS=x((dW,LS)=>{"use strict";LS.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 vl=x((pW,US)=>{"use strict";var qj=jS();US.exports=t=>typeof t=="string"?t.replace(qj(),""):t});var qS=x((hW,MS)=>{"use strict";MS.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 Vm=x((mW,Hm)=>{"use strict";var Hj=vl(),Vj=Lm(),zj=qS(),HS=t=>{if(typeof t!="string"||t.length===0||(t=Hj(t),t.length===0))return 0;t=t.replace(zj()," ");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+=Vj(n)?2:1)}return e};Hm.exports=HS;Hm.exports.default=HS});var YS=x((gW,WS)=>{"use strict";var Es=Vm(),Kj=vl(),Gj=qm(),Cl=new Set(["\x1B","\x9B"]),Wj=39,Km="\x07",KS="[",Yj="]",GS="m",Gm=`${Yj}8;;`,VS=t=>`${Cl.values().next().value}${KS}${t}${GS}`,zS=t=>`${Cl.values().next().value}${Gm}${t}${Km}`,Jj=t=>t.split(" ").map(e=>Es(e)),zm=(t,e,r)=>{let n=[...e],o=!1,i=!1,a=Es(Kj(t[t.length-1]));for(let[s,u]of n.entries()){let c=Es(u);if(a+c<=r?t[t.length-1]+=u:(t.push(u),a=0),Cl.has(u)&&(o=!0,i=n.slice(s+1).join("").startsWith(Gm)),o){i?u===Km&&(o=!1,i=!1):u===GS&&(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())},Xj=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(Es(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},Zj=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",o,i,a=Jj(t),s=[""];for(let[c,f]of t.split(" ").entries()){r.trim!==!1&&(s[s.length-1]=s[s.length-1].trimStart());let d=Es(s[s.length-1]);if(c!==0&&(d>=e&&(r.wordWrap===!1||r.trim===!1)&&(s.push(""),d=0),(d>0||r.trim===!1)&&(s[s.length-1]+=" ",d++)),r.hard&&a[c]>e){let p=e-d,h=1+Math.floor((a[c]-p-1)/e);Math.floor((a[c]-1)/e)<h&&s.push(""),zm(s,f,e);continue}if(d+a[c]>e&&d>0&&a[c]>0){if(r.wordWrap===!1&&d<e){zm(s,f,e);continue}s.push("")}if(d+a[c]>e&&r.wordWrap===!1){zm(s,f,e);continue}s[s.length-1]+=f}r.trim!==!1&&(s=s.map(Xj));let u=[...s.join(`
57
+ `)];for(let[c,f]of u.entries()){if(n+=f,Cl.has(f)){let{groups:p}=new RegExp(`(?:\\${KS}(?<code>\\d+)m|\\${Gm}(?<uri>.*)${Km})`).exec(u.slice(c).join(""))||{groups:{}};if(p.code!==void 0){let h=Number.parseFloat(p.code);o=h===Wj?void 0:h}else p.uri!==void 0&&(i=p.uri.length===0?void 0:p.uri)}let d=Gj.codes.get(Number(o));u[c+1]===`
58
+ `?(i&&(n+=zS("")),o&&d&&(n+=VS(d))):f===`
59
+ `&&(o&&d&&(n+=VS(o)),i&&(n+=zS(i)))}return n};WS.exports=(t,e,r)=>String(t).normalize().replace(/\r\n/g,`
60
60
  `).split(`
61
- `).map(n=>Gj(n,e,r)).join(`
62
- `)});var GS=x((fW,KS)=>{"use strict";var Wj=require("os"),zS=Wj.homedir();KS.exports=t=>{if(typeof t!="string")throw new TypeError(`Expected a string, got ${typeof t}`);return zS?t.replace(/^~(?=$|\/|\\)/,zS):t}});var QS=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 WS=(ve(),ie(we)),Yj=WS.__importStar(require("os")),cn=WS.__importStar(require("path")),YS=$S();Ge.sliceAnsi=YS;var bl=jm();Ge.stringWidth=bl;var Jj=yl();Ge.stripAnsi=Jj;var Xj=VS(),Zj=GS(),Qj=80,e4=120;Ge.TTY_WIDTH=process.stdout.columns?Math.max(Qj,Math.min(process.stdout.columns,e4)):1/0;function JS(t=4){return" ".repeat(t)}Ge.indent=JS;function t4(t,{width:e=Ge.TTY_WIDTH,indentation:r=0,append:n=""}){return Xj(t,e-r-n.length,{trim:!0}).split(`
61
+ `).map(n=>Zj(n,e,r)).join(`
62
+ `)});var ZS=x((yW,XS)=>{"use strict";var Qj=require("os"),JS=Qj.homedir();XS.exports=t=>{if(typeof t!="string")throw new TypeError(`Expected a string, got ${typeof t}`);return JS?t.replace(/^~(?=$|\/|\\)/,JS):t}});var ox=x(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.columnar=We.generateFillSpaceStringList=We.expandPath=We.prettyPath=We.wordWrap=We.indent=We.TTY_WIDTH=We.stripAnsi=We.stringWidth=We.sliceAnsi=void 0;var QS=(ve(),ie(we)),eU=QS.__importStar(require("os")),pn=QS.__importStar(require("path")),ex=NS();We.sliceAnsi=ex;var El=Vm();We.stringWidth=El;var tU=vl();We.stripAnsi=tU;var rU=YS(),nU=ZS(),oU=80,iU=120;We.TTY_WIDTH=process.stdout.columns?Math.max(oU,Math.min(process.stdout.columns,iU)):1/0;function tx(t=4){return" ".repeat(t)}We.indent=tx;function aU(t,{width:e=We.TTY_WIDTH,indentation:r=0,append:n=""}){return rU(t,e-r-n.length,{trim:!0}).split(`
63
63
  `).join(`${n}
64
- ${JS(r)}`)}Ge.wordWrap=t4;function r4(t){t=XS(t);let e=process.cwd(),r=cn.dirname(t),n=Yj.homedir(),o=Math.abs(r.split(cn.sep).length-e.split(cn.sep).length);if(e===r)return"."+cn.sep+cn.basename(t);if(r.startsWith(e))return"."+cn.sep+t.substring(e.length+1);if(o<=2){let i=cn.relative(e,t);return i||"."}else{if(t===n)return"~";if(t.indexOf(n)===0)return"~"+cn.sep+t.substring(n.length+1)}return t}Ge.prettyPath=r4;function XS(t){return cn.resolve(Zj(t))}Ge.expandPath=XS;function ZS(t,e=1,r=" "){e<2&&(e=2);let n=Math.max(...t.map(a=>bl(a))),o=n>e?n+1:e,i=r.repeat(o);return t.map(a=>YS(i,0,o-bl(a)))}Ge.generateFillSpaceStringList=ZS;function n4(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(f=>[f]):t[0].map(()=>[]);for(let f of t){let d=0,p=f.map(h=>{let m=h.split(`
65
- `);return d=Math.max(d,m.length),m});for(let h in f)a[h]&&a[h].push(...p[h],...Array(d-p[h].length).fill(""))}let s=a.map((f,d)=>{if(d<i-1){let p=ZS(f);return f.map((h,m)=>`${h}${p[m]}${r===""?"":`${r} `}`)}else return f}),u=0,c=s.reduce((f,d)=>f.map((p,h)=>{let m=f[h]+d[h];return u=Math.max(u,bl(m)),m}));return o&&e!==""&&c.splice(1,0,e.repeat(u)),c.join(`
66
- `)}Ge.columnar=n4});var ex=x(yr=>{"use strict";Object.defineProperty(yr,"__esModule",{value:!0});yr.TERMINAL_INFO=yr.CI_ENVIRONMENT_VARIABLES_DETECTED=yr.CI_ENVIRONMENT_VARIABLES=void 0;var o4=(ve(),ie(we)),i4=bm(),a4=o4.__importStar(require("os")),s4=(0,i4.debug)("ionic:utils-terminal:info");yr.CI_ENVIRONMENT_VARIABLES=["CI","BUILD_ID","BUILD_NUMBER","BITBUCKET_COMMIT","CODEBUILD_BUILD_ARN","GITHUB_ACTIONS"];yr.CI_ENVIRONMENT_VARIABLES_DETECTED=yr.CI_ENVIRONMENT_VARIABLES.filter(t=>!!process.env[t]);function u4(){let{shell:t}=a4.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")}yr.CI_ENVIRONMENT_VARIABLES_DETECTED.length>0&&s4(`Environment variables for CI detected: ${yr.CI_ENVIRONMENT_VARIABLES_DETECTED.join(", ")}`);yr.TERMINAL_INFO=Object.freeze({ci:yr.CI_ENVIRONMENT_VARIABLES_DETECTED.length>0,shell:u4(),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 Hm=x(Wi=>{"use strict";Object.defineProperty(Wi,"__esModule",{value:!0});var wl=(ve(),ie(we));wl.__exportStar(Pm(),Wi);wl.__exportStar(lS(),Wi);wl.__exportStar(QS(),Wi);wl.__exportStar(ex(),Wi)});var Cl=x(Ur=>{"use strict";Object.defineProperty(Ur,"__esModule",{value:!0});Ur.isFatal=Ur.fatal=Ur.FatalException=Ur.BaseException=void 0;var vl=class extends Error{constructor(e,r){super(e),this.message=e,this.code=r}};Ur.BaseException=vl;var Es=class extends vl{constructor(e,r=1){super(e,"FATAL"),this.message=e,this.exitCode=r}};Ur.FatalException=Es;function c4(t){throw new Es(t)}Ur.fatal=c4;function l4(t){return t&&t instanceof Es}Ur.isFatal=l4});var Km={};Jr(Km,{LOGGER_LEVELS:()=>D4,Logger:()=>zm,NO_COLORS:()=>tx,StreamOutputStrategy:()=>El,TTYOutputStrategy:()=>Vm,TTY_WIDTH:()=>f4,createDefaultLogger:()=>y4,indent:()=>d4,sliceAnsi:()=>p4,stringWidth:()=>h4,stripAnsi:()=>m4,wordWrap:()=>g4});var f4,d4,p4,h4,m4,g4,y4,tx,El,Vm,zm,D4,Gm=Ze(()=>{f4=80,d4=t=>t,p4=t=>t,h4=t=>t.length,m4=t=>t,g4=t=>t,y4=()=>({info:console.log,warn:console.warn,error:console.error,debug:console.debug}),tx={},El=class{constructor(){this.colors=tx,this.stream=process.stdout}},Vm=class extends El{constructor(e){super(),this.options=e}},zm=class{constructor(){}info(){}warn(){}error(){}debug(){}},D4={DEBUG:"DEBUG",INFO:"INFO",WARN:"WARN",ERROR:"ERROR"}});var nx=x(xo=>{"use strict";Object.defineProperty(xo,"__esModule",{value:!0});xo.isInteractive=xo.checkInteractive=void 0;var b4=(ve(),ie(we)),rx=Hm(),w4=b4.__importDefault(Hi()),v4=_s(),C4=(...t)=>(0,xo.isInteractive)()?!0:t.length?t.filter(e=>!e).length?(v4.logger.error(`Non-interactive shell detected.
67
- Run the command with ${w4.default.input("--help")} to see a list of arguments that must be provided.`),!1):!0:!1;xo.checkInteractive=C4;var E4=()=>rx.TERMINAL_INFO.tty&&!rx.TERMINAL_INFO.ci;xo.isInteractive=E4});var _l={};Jr(_l,{default:()=>ox});function ox(){throw new Error("Prompts are not supported in this CLI build")}var Sl=Ze(()=>{});var _s=x(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.logSuccess=Wt.logPrompt=Wt.logger=Wt.output=void 0;var Wm=(ve(),ie(we)),Ao=(Gm(),ie(Km)),Oo=Wm.__importDefault(Hi()),_4=nx(),ix={colors:Oo.default,stream:process.argv.includes("--json")?process.stderr:process.stdout};Wt.output=(0,_4.isInteractive)()?new Ao.TTYOutputStrategy(ix):new Ao.StreamOutputStrategy(ix);Wt.logger=(0,Ao.createDefaultLogger)({output:Wt.output,formatterOptions:{titleize:!1,tags:new Map([[Ao.LOGGER_LEVELS.DEBUG,Oo.default.log.DEBUG("[debug]")],[Ao.LOGGER_LEVELS.INFO,Oo.default.log.INFO("[info]")],[Ao.LOGGER_LEVELS.WARN,Oo.default.log.WARN("[warn]")],[Ao.LOGGER_LEVELS.ERROR,Oo.default.log.ERROR("[error]")]])}});async function S4(t,e){let{wordWrap:r}=await Promise.resolve().then(()=>Wm.__importStar((Gm(),ie(Km)))),{prompt:n}=await Promise.resolve().then(()=>Wm.__importStar((Sl(),ie(_l))));return Wt.logger.log({msg:`${Oo.default.input("[?]")} ${r(t,{indentation:4})}`,logger:Wt.logger,format:!1}),n(e,{onCancel:()=>process.exit(1)})}Wt.logPrompt=S4;function x4(t){Wt.logger.msg(`${Oo.default.success("[success]")} ${t}`)}Wt.logSuccess=x4});var xl=x(Yi=>{"use strict";Object.defineProperty(Yi,"__esModule",{value:!0});Yi.resolveNode=Yi.requireTS=void 0;var A4=require("fs"),O4=qi(),F4=require("path"),k4=(t,e)=>{let r=(0,F4.resolve)(e);delete require.cache[r],require.extensions[".ts"]=(o,i)=>{var a;let s=(0,O4.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};Yi.requireTS=k4;function P4(t,...e){try{return require.resolve(e.join("/"),{paths:[t]})}catch{let n=[t,"node_modules",...e].join("/");return(0,A4.existsSync)(n)?n:null}}Yi.resolveNode=P4});var ax={};Jr(ax,{default:()=>$4});var $4,sx=Ze(()=>{$4={}});var ux=x(Mr=>{"use strict";Object.defineProperty(Mr,"__esModule",{value:!0});Mr.buildXmlElement=Mr.writeXML=Mr.parseXML=Mr.readXML=void 0;var I4=(ve(),ie(we)),T4=qi(),Ss=I4.__importDefault((sx(),ie(ax)));async function R4(t){var e;try{let r=await(0,T4.readFile)(t,{encoding:"utf-8"});try{return await Ss.default.parseStringPromise(r)}catch(n){throw`Error parsing: ${t}, ${(e=n.stack)!==null&&e!==void 0?e:n}`}}catch{throw`Unable to read: ${t}`}}Mr.readXML=R4;function B4(t,e){let r=e!==void 0?new Ss.default.Parser({...e}):new Ss.default.Parser,n;return r.parseString(t,(o,i)=>{o||(n=i)}),n}Mr.parseXML=B4;async function N4(t){return new Promise(e=>{let n=new Ss.default.Builder({headless:!0,explicitRoot:!1,rootName:"deleteme"}).buildObject(t);n=n.replace("<deleteme>","").replace("</deleteme>",""),e(n)})}Mr.writeXML=N4;function L4(t,e){return new Ss.default.Builder({headless:!0,explicitRoot:!1,rootName:e}).buildObject(t)}Mr.buildXmlElement=L4});var px=x(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.getAllElements=Pe.getFilePath=Pe.getAssets=Pe.getJSModules=Pe.getPluginType=Pe.getPlatformElement=Pe.getPluginPlatform=Pe.printPlugins=Pe.fixName=Pe.getDependencies=Pe.resolvePlugin=Pe.getPlugins=Pe.getIncludedPluginPackages=void 0;var j4=(ve(),ie(we)),U4=qi(),Ym=require("path"),Ji=j4.__importDefault(Hi()),M4=Cl(),q4=_s(),cx=xl(),H4=ux();function lx(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}}Pe.getIncludedPluginPackages=lx;async function V4(t,e){var r;let n=(r=lx(t,e))!==null&&r!==void 0?r:dx(t);return(await Promise.all(n.map(async i=>fx(t,i)))).filter(i=>!!i)}Pe.getPlugins=V4;async function fx(t,e){try{let r=(0,cx.resolveNode)(t.app.rootDir,e,"package.json");r||(0,M4.fatal)(`Unable to find ${Ji.default.strong(`node_modules/${e}`)}.
68
- Are you sure ${Ji.default.strong(e)} is installed?`);let n=(0,Ym.dirname)(r),o=await(0,U4.readJSON)(r);if(!o)return null;if(o.capacitor)return{id:e,name:Jm(e),version:o.version,rootPath:n,repository:o.repository,manifest:o.capacitor};let i=(0,Ym.join)(n,"plugin.xml"),a=await(0,H4.readXML)(i);return{id:e,name:Jm(e),version:o.version,rootPath:n,repository:o.repository,xml:a.plugin}}catch{}return null}Pe.resolvePlugin=fx;function dx(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:{})]}Pe.getDependencies=dx;function Jm(t){return t=t.replace(/\//g,"_").replace(/-/g,"_").replace(/@/g,"").replace(/_\w/g,e=>e[1].toUpperCase()),t.charAt(0).toUpperCase()+t.slice(1)}Pe.fixName=Jm;function z4(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)}:
64
+ ${tx(r)}`)}We.wordWrap=aU;function sU(t){t=rx(t);let e=process.cwd(),r=pn.dirname(t),n=eU.homedir(),o=Math.abs(r.split(pn.sep).length-e.split(pn.sep).length);if(e===r)return"."+pn.sep+pn.basename(t);if(r.startsWith(e))return"."+pn.sep+t.substring(e.length+1);if(o<=2){let i=pn.relative(e,t);return i||"."}else{if(t===n)return"~";if(t.indexOf(n)===0)return"~"+pn.sep+t.substring(n.length+1)}return t}We.prettyPath=sU;function rx(t){return pn.resolve(nU(t))}We.expandPath=rx;function nx(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=>ex(i,0,o-El(a)))}We.generateFillSpaceStringList=nx;function uU(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(f=>[f]):t[0].map(()=>[]);for(let f of t){let d=0,p=f.map(h=>{let m=h.split(`
65
+ `);return d=Math.max(d,m.length),m});for(let h in f)a[h]&&a[h].push(...p[h],...Array(d-p[h].length).fill(""))}let s=a.map((f,d)=>{if(d<i-1){let p=nx(f);return f.map((h,m)=>`${h}${p[m]}${r===""?"":`${r} `}`)}else return f}),u=0,c=s.reduce((f,d)=>f.map((p,h)=>{let m=f[h]+d[h];return u=Math.max(u,El(m)),m}));return o&&e!==""&&c.splice(1,0,e.repeat(u)),c.join(`
66
+ `)}We.columnar=uU});var ix=x(br=>{"use strict";Object.defineProperty(br,"__esModule",{value:!0});br.TERMINAL_INFO=br.CI_ENVIRONMENT_VARIABLES_DETECTED=br.CI_ENVIRONMENT_VARIABLES=void 0;var cU=(ve(),ie(we)),lU=_m(),fU=cU.__importStar(require("os")),dU=(0,lU.debug)("ionic:utils-terminal:info");br.CI_ENVIRONMENT_VARIABLES=["CI","BUILD_ID","BUILD_NUMBER","BITBUCKET_COMMIT","CODEBUILD_BUILD_ARN","GITHUB_ACTIONS"];br.CI_ENVIRONMENT_VARIABLES_DETECTED=br.CI_ENVIRONMENT_VARIABLES.filter(t=>!!process.env[t]);function pU(){let{shell:t}=fU.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")}br.CI_ENVIRONMENT_VARIABLES_DETECTED.length>0&&dU(`Environment variables for CI detected: ${br.CI_ENVIRONMENT_VARIABLES_DETECTED.join(", ")}`);br.TERMINAL_INFO=Object.freeze({ci:br.CI_ENVIRONMENT_VARIABLES_DETECTED.length>0,shell:pU(),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 Wm=x(Wi=>{"use strict";Object.defineProperty(Wi,"__esModule",{value:!0});var _l=(ve(),ie(we));_l.__exportStar(Bm(),Wi);_l.__exportStar(mS(),Wi);_l.__exportStar(ox(),Wi);_l.__exportStar(ix(),Wi)});var xl=x(Hr=>{"use strict";Object.defineProperty(Hr,"__esModule",{value:!0});Hr.isFatal=Hr.fatal=Hr.FatalException=Hr.BaseException=void 0;var Sl=class extends Error{constructor(e,r){super(e),this.message=e,this.code=r}};Hr.BaseException=Sl;var _s=class extends Sl{constructor(e,r=1){super(e,"FATAL"),this.message=e,this.exitCode=r}};Hr.FatalException=_s;function hU(t){throw new _s(t)}Hr.fatal=hU;function mU(t){return t&&t instanceof _s}Hr.isFatal=mU});var Xm={};en(Xm,{LOGGER_LEVELS:()=>EU,Logger:()=>Jm,NO_COLORS:()=>ax,StreamOutputStrategy:()=>Al,TTYOutputStrategy:()=>Ym,TTY_WIDTH:()=>gU,createDefaultLogger:()=>CU,indent:()=>yU,sliceAnsi:()=>DU,stringWidth:()=>bU,stripAnsi:()=>wU,wordWrap:()=>vU});var gU,yU,DU,bU,wU,vU,CU,ax,Al,Ym,Jm,EU,Zm=Qe(()=>{gU=80,yU=t=>t,DU=t=>t,bU=t=>t.length,wU=t=>t,vU=t=>t,CU=()=>({info:console.log,warn:console.warn,error:console.error,debug:console.debug}),ax={},Al=class{constructor(){this.colors=ax,this.stream=process.stdout}},Ym=class extends Al{constructor(e){super(),this.options=e}},Jm=class{constructor(){}info(){}warn(){}error(){}debug(){}},EU={DEBUG:"DEBUG",INFO:"INFO",WARN:"WARN",ERROR:"ERROR"}});var ux=x(Oo=>{"use strict";Object.defineProperty(Oo,"__esModule",{value:!0});Oo.isInteractive=Oo.checkInteractive=void 0;var _U=(ve(),ie(we)),sx=Wm(),SU=_U.__importDefault(Hi()),xU=Ss(),AU=(...t)=>(0,Oo.isInteractive)()?!0:t.length?t.filter(e=>!e).length?(xU.logger.error(`Non-interactive shell detected.
67
+ Run the command with ${SU.default.input("--help")} to see a list of arguments that must be provided.`),!1):!0:!1;Oo.checkInteractive=AU;var OU=()=>sx.TERMINAL_INFO.tty&&!sx.TERMINAL_INFO.ci;Oo.isInteractive=OU});var Ol={};en(Ol,{default:()=>cx});function cx(){throw new Error("Prompts are not supported in this CLI build")}var Fl=Qe(()=>{});var Ss=x(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.logSuccess=Yt.logPrompt=Yt.logger=Yt.output=void 0;var Qm=(ve(),ie(we)),Fo=(Zm(),ie(Xm)),Po=Qm.__importDefault(Hi()),FU=ux(),lx={colors:Po.default,stream:process.argv.includes("--json")?process.stderr:process.stdout};Yt.output=(0,FU.isInteractive)()?new Fo.TTYOutputStrategy(lx):new Fo.StreamOutputStrategy(lx);Yt.logger=(0,Fo.createDefaultLogger)({output:Yt.output,formatterOptions:{titleize:!1,tags:new Map([[Fo.LOGGER_LEVELS.DEBUG,Po.default.log.DEBUG("[debug]")],[Fo.LOGGER_LEVELS.INFO,Po.default.log.INFO("[info]")],[Fo.LOGGER_LEVELS.WARN,Po.default.log.WARN("[warn]")],[Fo.LOGGER_LEVELS.ERROR,Po.default.log.ERROR("[error]")]])}});async function PU(t,e){let{wordWrap:r}=await Promise.resolve().then(()=>Qm.__importStar((Zm(),ie(Xm)))),{prompt:n}=await Promise.resolve().then(()=>Qm.__importStar((Fl(),ie(Ol))));return Yt.logger.log({msg:`${Po.default.input("[?]")} ${r(t,{indentation:4})}`,logger:Yt.logger,format:!1}),n(e,{onCancel:()=>process.exit(1)})}Yt.logPrompt=PU;function kU(t){Yt.logger.msg(`${Po.default.success("[success]")} ${t}`)}Yt.logSuccess=kU});var Pl=x(Yi=>{"use strict";Object.defineProperty(Yi,"__esModule",{value:!0});Yi.resolveNode=Yi.requireTS=void 0;var $U=require("fs"),IU=qi(),TU=require("path"),RU=(t,e)=>{let r=(0,TU.resolve)(e);delete require.cache[r],require.extensions[".ts"]=(o,i)=>{var a;let s=(0,IU.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};Yi.requireTS=RU;function BU(t,...e){try{return require.resolve(e.join("/"),{paths:[t]})}catch{let n=[t,"node_modules",...e].join("/");return(0,$U.existsSync)(n)?n:null}}Yi.resolveNode=BU});var fx={};en(fx,{default:()=>NU});var NU,dx=Qe(()=>{NU={}});var px=x(Vr=>{"use strict";Object.defineProperty(Vr,"__esModule",{value:!0});Vr.buildXmlElement=Vr.writeXML=Vr.parseXML=Vr.readXML=void 0;var LU=(ve(),ie(we)),jU=qi(),xs=LU.__importDefault((dx(),ie(fx)));async function UU(t){var e;try{let r=await(0,jU.readFile)(t,{encoding:"utf-8"});try{return await xs.default.parseStringPromise(r)}catch(n){throw`Error parsing: ${t}, ${(e=n.stack)!==null&&e!==void 0?e:n}`}}catch{throw`Unable to read: ${t}`}}Vr.readXML=UU;function MU(t,e){let r=e!==void 0?new xs.default.Parser({...e}):new xs.default.Parser,n;return r.parseString(t,(o,i)=>{o||(n=i)}),n}Vr.parseXML=MU;async function qU(t){return new Promise(e=>{let n=new xs.default.Builder({headless:!0,explicitRoot:!1,rootName:"deleteme"}).buildObject(t);n=n.replace("<deleteme>","").replace("</deleteme>",""),e(n)})}Vr.writeXML=qU;function HU(t,e){return new xs.default.Builder({headless:!0,explicitRoot:!1,rootName:e}).buildObject(t)}Vr.buildXmlElement=HU});var Dx=x(ke=>{"use strict";Object.defineProperty(ke,"__esModule",{value:!0});ke.getAllElements=ke.getFilePath=ke.getAssets=ke.getJSModules=ke.getPluginType=ke.getPlatformElement=ke.getPluginPlatform=ke.printPlugins=ke.fixName=ke.getDependencies=ke.resolvePlugin=ke.getPlugins=ke.getIncludedPluginPackages=void 0;var VU=(ve(),ie(we)),zU=qi(),eg=require("path"),Ji=VU.__importDefault(Hi()),KU=xl(),GU=Ss(),hx=Pl(),WU=px();function mx(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}}ke.getIncludedPluginPackages=mx;async function YU(t,e){var r;let n=(r=mx(t,e))!==null&&r!==void 0?r:yx(t);return(await Promise.all(n.map(async i=>gx(t,i)))).filter(i=>!!i)}ke.getPlugins=YU;async function gx(t,e){try{let r=(0,hx.resolveNode)(t.app.rootDir,e,"package.json");r||(0,KU.fatal)(`Unable to find ${Ji.default.strong(`node_modules/${e}`)}.
68
+ Are you sure ${Ji.default.strong(e)} is installed?`);let n=(0,eg.dirname)(r),o=await(0,zU.readJSON)(r);if(!o)return null;if(o.capacitor)return{id:e,name:tg(e),version:o.version,rootPath:n,repository:o.repository,manifest:o.capacitor};let i=(0,eg.join)(n,"plugin.xml"),a=await(0,WU.readXML)(i);return{id:e,name:tg(e),version:o.version,rootPath:n,repository:o.repository,xml:a.plugin}}catch{}return null}ke.resolvePlugin=gx;function yx(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:{})]}ke.getDependencies=yx;function tg(t){return t=t.replace(/\//g,"_").replace(/-/g,"_").replace(/@/g,"").replace(/_\w/g,e=>e[1].toUpperCase()),t.charAt(0).toUpperCase()+t.slice(1)}ke.fixName=tg;function JU(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)}:
69
69
  `;break;case"incompatible":n=`Found ${t.length} incompatible Cordova plugin${o} for ${Ji.default.strong(e)}, skipped install:
70
70
  `;break;case"capacitor":n=`Found ${t.length} Capacitor plugin${o} for ${Ji.default.strong(e)}:
71
71
  `;break}n+=t.map(i=>`${i.id}${Ji.default.weak(`@${i.version}`)}`).join(`
72
- `),q4.logger.info(n)}Pe.printPlugins=z4;function Xm(t,e){return t.xml.platform?t.xml.platform.filter(function(o){return o.$.name===e})[0]:[]}Pe.getPluginPlatform=Xm;function K4(t,e,r){let n=Xm(t,e);if(n){let o=n[r];if(o)return o}return[]}Pe.getPlatformElement=K4;function G4(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}Pe.getPluginType=G4;function W4(t,e){return Zm(t,e,"js-module")}Pe.getJSModules=W4;function Y4(t,e){return Zm(t,e,"asset")}Pe.getAssets=Y4;function J4(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,cx.resolveNode)(t.app.rootDir,...n);if(!o)throw new Error(`Can't resolve module ${n[0]}`);return o}return(0,Ym.join)(e.rootPath,r)}Pe.getFilePath=J4;function Zm(t,e,r){let n=[];t.xml[r]&&(n=n.concat(t.xml[r]));let o=Xm(t,e);return o?.[r]&&(n=n.concat(o[r])),n}Pe.getAllElements=Zm});var hx={};Jr(hx,{default:()=>X4});var X4,mx=Ze(()=>{X4={}});var Al=x(Ln=>{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});Ln.isInstalled=Ln.getCommandOutput=Ln.runCommand=void 0;var Qm=(mx(),ie(hx));async function gx(t,e,r={}){let n=new Qm.Subprocess(t,e,r);try{return await n.output()}catch(o){throw o instanceof Qm.SubprocessError?o.output?o.output:o.cause?`${o.message} ${o.cause.toString()}`:o.code?o.code:"Unknown error":o}}Ln.runCommand=gx;async function Z4(t,e,r={}){try{return(await gx(t,e,r)).trim()}catch{return null}}Ln.getCommandOutput=Z4;async function Q4(t){try{await(0,Qm.which)(t)}catch{return!1}return!0}Ln.isInstalled=Q4});var yx={};Jr(yx,{Comparator:()=>AU,Range:()=>SU,SemVer:()=>xU,clean:()=>nU,coerce:()=>_U,compare:()=>uU,diff:()=>eU,eq:()=>dU,gt:()=>lU,gte:()=>hU,gtr:()=>vU,inc:()=>oU,intersects:()=>EU,lt:()=>fU,lte:()=>mU,ltr:()=>CU,major:()=>iU,maxSatisfying:()=>yU,minSatisfying:()=>DU,minor:()=>aU,neq:()=>pU,outside:()=>wU,parse:()=>tU,patch:()=>sU,rcompare:()=>cU,satisfies:()=>gU,valid:()=>rU,validRange:()=>bU});var eU,tU,rU,nU,oU,iU,aU,sU,uU,cU,lU,fU,dU,pU,hU,mU,gU,yU,DU,bU,wU,vU,CU,EU,_U,SU,xU,AU,Dx=Ze(()=>{eU=()=>null,tU=()=>null,rU=()=>null,nU=()=>null,oU=()=>null,iU=()=>null,aU=()=>null,sU=()=>null,uU=()=>0,cU=()=>0,lU=()=>!1,fU=()=>!1,dU=()=>!1,pU=()=>!0,hU=()=>!1,mU=()=>!1,gU=()=>!1,yU=()=>null,DU=()=>null,bU=()=>null,wU=()=>!1,vU=()=>!1,CU=()=>!1,EU=()=>!1,_U=()=>null,SU=class{},xU=class{},AU=class{}});var kx=x(J=>{"use strict";Object.defineProperty(J,"__esModule",{value:!0});J.parseApkNameFromFlavor=J.checkJDKMajorVersion=J.resolvePlatform=J.checkPlatformVersions=J.getAddedPlatforms=J.getPlatformTargetName=J.promptForPlatformTarget=J.promptForPlatform=J.isValidEnterprisePlatform=J.getKnownEnterprisePlatforms=J.isValidCommunityPlatform=J.getKnownCommunityPlatforms=J.isValidPlatform=J.getKnownPlatforms=J.selectPlatforms=J.getProjectPlatformDirectory=J.getCLIVersion=J.getCoreVersion=J.getCapacitorPackageVersion=J.requireCapacitorPackage=J.getCapacitorPackage=J.runTask=J.runPlatformHook=J.runHooks=J.wait=J.checkAppName=J.checkAppId=J.checkAppDir=J.checkAppConfig=J.checkCapacitorPlatform=J.checkPackage=J.checkWebDir=J.check=void 0;var As=(ve(),ie(we)),bx=Hm(),jn=qi(),Fo=require("path"),$e=As.__importDefault(Hi()),Xi=Cl(),vx=_s(),OU=px(),wx=hu(),xs=xl(),FU=Al();async function kU(t){let r=(await Promise.all(t.map(n=>n()))).filter(n=>n!=null);if(r.length>0)throw r.join(`
73
- `)}J.check=kU;async function PU(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,jn.pathExists)(t.app.webDirAbs)?await(0,jn.pathExists)((0,Fo.join)(t.app.webDirAbs,"index.html"))?null:`The web assets directory (${$e.default.strong((0,bx.prettyPath)(t.app.webDirAbs))}) must contain an ${$e.default.strong("index.html")} file.
74
- It will be the entry point for the web portion of the Capacitor app.`:`Could not find the web assets directory: ${$e.default.strong((0,bx.prettyPath)(t.app.webDirAbs))}.
75
- Please create it and make sure it has an ${$e.default.strong("index.html")} file. You can change the path of this directory in ${$e.default.strong(t.app.extConfigName)} (${$e.default.input("webDir")} option). You may need to compile the web assets for your app (typically ${$e.default.input("npm run build")}). More info: ${$e.default.strong("https://capacitorjs.com/docs/basics/workflow#sync-your-project")}`}J.checkWebDir=PU;async function $U(){return await(0,jn.pathExists)("package.json")||await(0,jn.pathExists)("project.json")?null:`The Capacitor CLI needs to run at the root of an npm package or in a valid NX monorepo.
72
+ `),GU.logger.info(n)}ke.printPlugins=JU;function rg(t,e){return t.xml.platform?t.xml.platform.filter(function(o){return o.$.name===e})[0]:[]}ke.getPluginPlatform=rg;function XU(t,e,r){let n=rg(t,e);if(n){let o=n[r];if(o)return o}return[]}ke.getPlatformElement=XU;function ZU(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}ke.getPluginType=ZU;function QU(t,e){return ng(t,e,"js-module")}ke.getJSModules=QU;function e4(t,e){return ng(t,e,"asset")}ke.getAssets=e4;function t4(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,hx.resolveNode)(t.app.rootDir,...n);if(!o)throw new Error(`Can't resolve module ${n[0]}`);return o}return(0,eg.join)(e.rootPath,r)}ke.getFilePath=t4;function ng(t,e,r){let n=[];t.xml[r]&&(n=n.concat(t.xml[r]));let o=rg(t,e);return o?.[r]&&(n=n.concat(o[r])),n}ke.getAllElements=ng});var bx={};en(bx,{default:()=>r4});var r4,wx=Qe(()=>{r4={}});var kl=x(Mn=>{"use strict";Object.defineProperty(Mn,"__esModule",{value:!0});Mn.isInstalled=Mn.getCommandOutput=Mn.runCommand=void 0;var og=(wx(),ie(bx));async function vx(t,e,r={}){let n=new og.Subprocess(t,e,r);try{return await n.output()}catch(o){throw o instanceof og.SubprocessError?o.output?o.output:o.cause?`${o.message} ${o.cause.toString()}`:o.code?o.code:"Unknown error":o}}Mn.runCommand=vx;async function n4(t,e,r={}){try{return(await vx(t,e,r)).trim()}catch{return null}}Mn.getCommandOutput=n4;async function o4(t){try{await(0,og.which)(t)}catch{return!1}return!0}Mn.isInstalled=o4});var Cx={};en(Cx,{Comparator:()=>$4,Range:()=>P4,SemVer:()=>k4,clean:()=>u4,coerce:()=>F4,compare:()=>p4,diff:()=>i4,eq:()=>y4,gt:()=>m4,gte:()=>b4,gtr:()=>x4,inc:()=>c4,intersects:()=>O4,lt:()=>g4,lte:()=>w4,ltr:()=>A4,major:()=>l4,maxSatisfying:()=>C4,minSatisfying:()=>E4,minor:()=>f4,neq:()=>D4,outside:()=>S4,parse:()=>a4,patch:()=>d4,rcompare:()=>h4,satisfies:()=>v4,valid:()=>s4,validRange:()=>_4});var i4,a4,s4,u4,c4,l4,f4,d4,p4,h4,m4,g4,y4,D4,b4,w4,v4,C4,E4,_4,S4,x4,A4,O4,F4,P4,k4,$4,Ex=Qe(()=>{i4=()=>null,a4=()=>null,s4=()=>null,u4=()=>null,c4=()=>null,l4=()=>null,f4=()=>null,d4=()=>null,p4=()=>0,h4=()=>0,m4=()=>!1,g4=()=>!1,y4=()=>!1,D4=()=>!0,b4=()=>!1,w4=()=>!1,v4=()=>!1,C4=()=>null,E4=()=>null,_4=()=>null,S4=()=>!1,x4=()=>!1,A4=()=>!1,O4=()=>!1,F4=()=>null,P4=class{},k4=class{},$4=class{}});var Rx=x(J=>{"use strict";Object.defineProperty(J,"__esModule",{value:!0});J.parseApkNameFromFlavor=J.checkJDKMajorVersion=J.resolvePlatform=J.checkPlatformVersions=J.getAddedPlatforms=J.getPlatformTargetName=J.promptForPlatformTarget=J.promptForPlatform=J.isValidEnterprisePlatform=J.getKnownEnterprisePlatforms=J.isValidCommunityPlatform=J.getKnownCommunityPlatforms=J.isValidPlatform=J.getKnownPlatforms=J.selectPlatforms=J.getProjectPlatformDirectory=J.getCLIVersion=J.getCoreVersion=J.getCapacitorPackageVersion=J.requireCapacitorPackage=J.getCapacitorPackage=J.runTask=J.runPlatformHook=J.runHooks=J.wait=J.checkAppName=J.checkAppId=J.checkAppDir=J.checkAppConfig=J.checkCapacitorPlatform=J.checkPackage=J.checkWebDir=J.check=void 0;var Os=(ve(),ie(we)),_x=Wm(),qn=qi(),ko=require("path"),$e=Os.__importDefault(Hi()),Xi=xl(),xx=Ss(),I4=Dx(),Sx=Du(),As=Pl(),T4=kl();async function R4(t){let r=(await Promise.all(t.map(n=>n()))).filter(n=>n!=null);if(r.length>0)throw r.join(`
73
+ `)}J.check=R4;async function B4(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,qn.pathExists)(t.app.webDirAbs)?await(0,qn.pathExists)((0,ko.join)(t.app.webDirAbs,"index.html"))?null:`The web assets directory (${$e.default.strong((0,_x.prettyPath)(t.app.webDirAbs))}) must contain an ${$e.default.strong("index.html")} file.
74
+ It will be the entry point for the web portion of the Capacitor app.`:`Could not find the web assets directory: ${$e.default.strong((0,_x.prettyPath)(t.app.webDirAbs))}.
75
+ Please create it and make sure it has an ${$e.default.strong("index.html")} file. You can change the path of this directory in ${$e.default.strong(t.app.extConfigName)} (${$e.default.input("webDir")} option). You may need to compile the web assets for your app (typically ${$e.default.input("npm run build")}). More info: ${$e.default.strong("https://capacitorjs.com/docs/basics/workflow#sync-your-project")}`}J.checkWebDir=B4;async function N4(){return await(0,qn.pathExists)("package.json")||await(0,qn.pathExists)("project.json")?null:`The Capacitor CLI needs to run at the root of an npm package or in a valid NX monorepo.
76
76
  Make sure you have a package.json or project.json file in the directory where you run the Capacitor CLI.
77
- More info: ${$e.default.strong("https://docs.npmjs.com/cli/init")}`}J.checkPackage=$U;async function IU(t,e){return await tg(t,e)?null:`Could not find the ${$e.default.input(e)} platform.
78
- You must install it in your project first, e.g. w/ ${$e.default.input(`npm install @capacitor/${e}`)}`}J.checkCapacitorPlatform=IU;async function TU(t){if(!t.app.appId)return`Missing ${$e.default.input("appId")} for new platform.
77
+ More info: ${$e.default.strong("https://docs.npmjs.com/cli/init")}`}J.checkPackage=N4;async function L4(t,e){return await ag(t,e)?null:`Could not find the ${$e.default.input(e)} platform.
78
+ You must install it in your project first, e.g. w/ ${$e.default.input(`npm install @capacitor/${e}`)}`}J.checkCapacitorPlatform=L4;async function j4(t){if(!t.app.appId)return`Missing ${$e.default.input("appId")} for new platform.
79
79
  Please add it in ${t.app.extConfigName} or run ${$e.default.input("npx cap init")}.`;if(!t.app.appName)return`Missing ${$e.default.input("appName")} for new platform.
80
- Please add it in ${t.app.extConfigName} or run ${$e.default.input("npx cap init")}.`;let e=await Cx(t,t.app.appId);if(e)return e;let r=await Ex(t,t.app.appName);return r||null}J.checkAppConfig=TU;async function RU(t,e){return/^\S*$/.test(e)?null:"Your app directory should not contain spaces"}J.checkAppDir=RU;async function Cx(t,e){return e?/^[a-zA-Z][\w]*(?:\.[a-zA-Z][\w]*)+$/.test(e.toLowerCase())?null:`
80
+ Please add it in ${t.app.extConfigName} or run ${$e.default.input("npx cap init")}.`;let e=await Ax(t,t.app.appId);if(e)return e;let r=await Ox(t,t.app.appName);return r||null}J.checkAppConfig=j4;async function U4(t,e){return/^\S*$/.test(e)?null:"Your app directory should not contain spaces"}J.checkAppDir=U4;async function Ax(t,e){return e?/^[a-zA-Z][\w]*(?:\.[a-zA-Z][\w]*)+$/.test(e.toLowerCase())?null:`
81
81
  Invalid App ID "${e}". Your App ID must meet the following requirements to be valid on both iOS and Android:
82
82
  - Must be in Java package form with no dashes (ex: com.example.app)
83
83
  - It must have at least two segments (one or more dots).
@@ -85,111 +85,113 @@ Please add it in ${t.app.extConfigName} or run ${$e.default.input("npx cap init"
85
85
  - All characters must be alphanumeric or an underscore [a-zA-Z][a-zA-Z0-9]+.
86
86
 
87
87
  If you would like to skip validation, run "cap init" with the "--skip-appid-validation" flag.
88
- `:"Invalid App ID. App ID is required and cannot be blank."}J.checkAppId=Cx;async function Ex(t,e){return e?.length?null:"Must provide an app name. For example: 'Spacebook'"}J.checkAppName=Ex;async function BU(t){return new Promise(e=>setTimeout(e,t))}J.wait=BU;async function NU(t,e,r,n){await eg(t,e,r,n);let o=await(0,OU.getPlugins)(t,e);for(let i of o)await eg(t,e,i.rootPath,n)}J.runHooks=NU;async function eg(t,e,r,n){var o;let{spawn:i}=await Promise.resolve().then(()=>As.__importStar(require("child_process"))),a;(0,wx.isNXMonorepo)(r)?a=await(0,jn.readJSON)((0,Fo.join)((0,wx.findNXMonorepoRoot)(r),"package.json")):a=await(0,jn.readJSON)((0,Fo.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 f=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}});f.on("close",d=>{d===0?u():c(new Error(`${n} hook on ${e} failed with error code: ${d} while running command: ${s}`))}),f.on("error",d=>{c(d)})})}J.runPlatformHook=eg;async function LU(t,e){let r=vx.output.createTaskChain();r.next(t);try{let n=await e();return r.end(),n}catch(n){throw r.fail(),n}}J.runTask=LU;async function tg(t,e){let r=(0,xs.resolveNode)(t.app.rootDir,`@capacitor/${e}`,"package.json");return r?(0,jn.readJSON)(r):null}J.getCapacitorPackage=tg;async function _x(t,e){let r=await tg(t,e);return r||(0,Xi.fatal)(`Unable to find node_modules/@capacitor/${e}.
89
- Are you sure ${$e.default.strong(`@capacitor/${e}`)} is installed?`),r}J.requireCapacitorPackage=_x;async function Fl(t,e){return(await _x(t,e)).version}J.getCapacitorPackageVersion=Fl;async function Sx(t){return Fl(t,"core")}J.getCoreVersion=Sx;async function jU(t){return Fl(t,"cli")}J.getCLIVersion=jU;function UU(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 Ol(t,e){let r=UU(t,e);return r&&await(0,jn.pathExists)(r)?r:null}J.getProjectPlatformDirectory=Ol;async function MU(t,e){if(e){let r=e.toLowerCase().trim();return await ng(r)?await Ol(t,r)||(r==="web"&&(0,Xi.fatal)(`Could not find the web platform directory.
88
+ `:"Invalid App ID. App ID is required and cannot be blank."}J.checkAppId=Ax;async function Ox(t,e){return e?.length?null:"Must provide an app name. For example: 'Spacebook'"}J.checkAppName=Ox;async function M4(t){return new Promise(e=>setTimeout(e,t))}J.wait=M4;async function q4(t,e,r,n){await ig(t,e,r,n);let o=await(0,I4.getPlugins)(t,e);for(let i of o)await ig(t,e,i.rootPath,n)}J.runHooks=q4;async function ig(t,e,r,n){var o;let{spawn:i}=await Promise.resolve().then(()=>Os.__importStar(require("child_process"))),a;(0,Sx.isNXMonorepo)(r)?a=await(0,qn.readJSON)((0,ko.join)((0,Sx.findNXMonorepoRoot)(r),"package.json")):a=await(0,qn.readJSON)((0,ko.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 f=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}});f.on("close",d=>{d===0?u():c(new Error(`${n} hook on ${e} failed with error code: ${d} while running command: ${s}`))}),f.on("error",d=>{c(d)})})}J.runPlatformHook=ig;async function H4(t,e){let r=xx.output.createTaskChain();r.next(t);try{let n=await e();return r.end(),n}catch(n){throw r.fail(),n}}J.runTask=H4;async function ag(t,e){let r=(0,As.resolveNode)(t.app.rootDir,`@capacitor/${e}`,"package.json");return r?(0,qn.readJSON)(r):null}J.getCapacitorPackage=ag;async function Fx(t,e){let r=await ag(t,e);return r||(0,Xi.fatal)(`Unable to find node_modules/@capacitor/${e}.
89
+ Are you sure ${$e.default.strong(`@capacitor/${e}`)} is installed?`),r}J.requireCapacitorPackage=Fx;async function Il(t,e){return(await Fx(t,e)).version}J.getCapacitorPackageVersion=Il;async function Px(t){return Il(t,"core")}J.getCoreVersion=Px;async function V4(t){return Il(t,"cli")}J.getCLIVersion=V4;function z4(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 $l(t,e){let r=z4(t,e);return r&&await(0,qn.pathExists)(r)?r:null}J.getProjectPlatformDirectory=$l;async function K4(t,e){if(e){let r=e.toLowerCase().trim();return await ug(r)?await $l(t,r)||(r==="web"&&(0,Xi.fatal)(`Could not find the web platform directory.
90
90
  Make sure ${$e.default.strong(t.app.webDir)} exists.`),(0,Xi.fatal)(`${$e.default.strong(r)} platform has not been added yet.
91
- See the docs for adding the ${$e.default.strong(r)} platform: ${$e.default.strong(`https://capacitorjs.com/docs/${r}#adding-the-${r}-platform`)}`)):(0,Xi.fatal)(`Invalid platform: ${$e.default.input(r)}`),[r]}return Fx(t)}J.selectPlatforms=MU;async function rg(){return["web","android","ios"]}J.getKnownPlatforms=rg;async function ng(t){return(await rg()).includes(t)}J.isValidPlatform=ng;async function xx(){return["electron"]}J.getKnownCommunityPlatforms=xx;async function qU(t){return(await xx()).includes(t)}J.isValidCommunityPlatform=qU;async function Ax(){return["windows"]}J.getKnownEnterprisePlatforms=Ax;async function HU(t){return(await Ax()).includes(t)}J.isValidEnterprisePlatform=HU;async function VU(t,e,r){let{prompt:n}=await Promise.resolve().then(()=>As.__importStar((Sl(),ie(_l))));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 ng(o)){let i=await rg();(0,Xi.fatal)(`Invalid platform: ${$e.default.input(o)}.
92
- Valid platforms include: ${i.join(", ")}`)}return o}J.promptForPlatform=VU;async function zU(t,e){let{prompt:r}=await Promise.resolve().then(()=>As.__importStar((Sl(),ie(_l)))),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:`${Ox(s)} (${s.id})`,value:s}))}],{onCancel:()=>process.exit(1)})).target;let o=e.trim(),i=t.find(a=>a.id===o);return i||(0,Xi.fatal)(`Invalid target ID: ${$e.default.input(o)}.
93
- Valid targets are: ${t.map(a=>a.id).join(", ")}`),i}J.promptForPlatformTarget=zU;function Ox(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"})`:""}`}J.getPlatformTargetName=Ox;async function Fx(t){let e=[];return await Ol(t,t.android.name)&&e.push(t.android.name),await Ol(t,t.ios.name)&&e.push(t.ios.name),e.push(t.web.name),e}J.getAddedPlatforms=Fx;async function KU(t,e){let r=await Promise.resolve().then(()=>As.__importStar((Dx(),ie(yx)))),n=await Sx(t),o=await Fl(t,e);(r.diff(n,o)==="minor"||r.diff(n,o)==="major")&&vx.logger.warn(`${$e.default.strong("@capacitor/core")}${$e.default.weak(`@${n}`)} version doesn't match ${$e.default.strong(`@capacitor/${e}`)}${$e.default.weak(`@${o}`)} version.
94
- Consider updating to a matching version, e.g. w/ ${$e.default.input(`npm install @capacitor/core@${o}`)}`)}J.checkPlatformVersions=KU;function GU(t,e){if(e[0]!=="@"){let n=(0,xs.resolveNode)(t.app.rootDir,`@capacitor/${e}`,"package.json");if(n)return(0,Fo.dirname)(n);let o=(0,xs.resolveNode)(t.app.rootDir,`@capacitor-community/${e}`,"package.json");if(o)return(0,Fo.dirname)(o);let i=(0,xs.resolveNode)(t.app.rootDir,`@ionic-enterprise/capacitor-${e}`,"package.json");if(i)return(0,Fo.dirname)(i)}let r=(0,xs.resolveNode)(t.app.rootDir,e,"package.json");return r?(0,Fo.dirname)(r):null}J.resolvePlatform=GU;async function WU(){try{let t=await(0,FU.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}}J.checkJDKMajorVersion=WU;function YU(t){let e=t.replace(/([A-Z])/g,"$1").toLowerCase();return`app-${e?`${e}-`:""}debug.apk`}J.parseApkNameFromFlavor=YU});var Px=x(kl=>{"use strict";Object.defineProperty(kl,"__esModule",{value:!0});kl.tryFn=void 0;var JU=async(t,...e)=>{try{return await t(...e)}catch{}return null};kl.tryFn=JU});var $x=x(Pl=>{"use strict";Object.defineProperty(Pl,"__esModule",{value:!0});Pl.formatJSObject=void 0;var XU=(ve(),ie(we)),ZU=XU.__importDefault(require("util"));function QU(t){try{t=JSON.parse(JSON.stringify(t))}catch(e){throw new Error(`Cannot parse object as JSON: ${e.stack?e.stack:e}`)}return ZU.default.inspect(t,{compact:!1,breakLength:1/0,depth:1/0,maxArrayLength:1/0,maxStringLength:1/0})}Pl.formatJSObject=QU});var Ix=x(Un=>{"use strict";Object.defineProperty(Un,"__esModule",{value:!0});Un.lazy=Un.LazyPromise=Un.allSerial=void 0;function e5(t){return t.reduce((e,r)=>e.then(n=>r().then(o=>n.concat(o))),Promise.resolve([]))}Un.allSerial=e5;var $l=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)}};Un.LazyPromise=$l;function t5(t){return new $l(async(e,r)=>{try{e(await t())}catch(n){r(n)}})}Un.lazy=t5});var Nx=x(pt=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});pt.writeConfig=pt.loadConfig=pt.CONFIG_FILE_NAME_JSON=pt.CONFIG_FILE_NAME_JS=pt.CONFIG_FILE_NAME_TS=void 0;var ig=(ve(),ie(we)),r5=ig.__importDefault(bm()),Yt=qi(),ce=require("path"),ko=ig.__importDefault(Hi()),n5=kx(),Il=Cl(),o5=_s(),og=Px(),i5=$x(),Tx=hu(),Rx=xl(),Zi=Ix(),a5=Al(),Bx=(0,r5.default)("capacitor:config");pt.CONFIG_FILE_NAME_TS="capacitor.config.ts";pt.CONFIG_FILE_NAME_JS="capacitor.config.js";pt.CONFIG_FILE_NAME_JSON="capacitor.config.json";async function s5(){var t,e,r,n;let o=process.cwd(),i=(0,ce.dirname)(__dirname),a=await f5(o),s=await(async()=>{var h,m;if((0,Tx.isNXMonorepo)(o)){let y=(0,Tx.findNXMonorepoRoot)(o),D=await(0,og.tryFn)(Yt.readJSON,(0,ce.resolve)(y,"package.json")),v=(h=D?.devDependencies)!==null&&h!==void 0?h:{},E=(m=D?.dependencies)!==null&&m!==void 0?m:{};return{devDependencies:v,dependencies:E}}return{}})(),u=(t=a.extConfig.appId)!==null&&t!==void 0?t:"",c=(e=a.extConfig.appName)!==null&&e!==void 0?e:"",f=(r=a.extConfig.webDir)!==null&&r!==void 0?r:"www",d=await d5(i),p={android:await p5(o,a.extConfig,d),ios:await h5(o,a.extConfig),web:await m5(o,f),cli:d,app:{rootDir:o,appId:u,appName:c,webDir:f,webDirAbs:(0,ce.resolve)(o,f),package:(n=await(0,og.tryFn)(Yt.readJSON,(0,ce.resolve)(o,"package.json")))!==null&&n!==void 0?n:{name:c,version:"1.0.0",...s},...a}};return Bx("config: %O",p),p}pt.loadConfig=s5;async function u5(t,e){switch((0,ce.extname)(e)){case".json":{await(0,Yt.writeJSON)(e,t,{spaces:2});break}case".ts":{await(0,Yt.writeFile)(e,v5(t));break}}}pt.writeConfig=u5;async function c5(t,e,r){var n;try{let o=(0,Rx.resolveNode)(t,"typescript");o||(0,Il.fatal)(`Could not find installation of TypeScript.
95
- To use ${ko.default.strong(e)} files, you must install TypeScript in your project, e.g. w/ ${ko.default.input("npm install -D typescript")}`);let i=require(o),a=(0,Rx.requireTS)(i,r),s=a.default?await a.default:a;return{extConfigType:"ts",extConfigName:e,extConfigFilePath:r,extConfig:s}}catch(o){throw(0,Il.isFatal)(o)||(0,Il.fatal)(`Parsing ${ko.default.strong(e)} failed.
91
+ See the docs for adding the ${$e.default.strong(r)} platform: ${$e.default.strong(`https://capacitorjs.com/docs/${r}#adding-the-${r}-platform`)}`)):(0,Xi.fatal)(`Invalid platform: ${$e.default.input(r)}`),[r]}return Tx(t)}J.selectPlatforms=K4;async function sg(){return["web","android","ios"]}J.getKnownPlatforms=sg;async function ug(t){return(await sg()).includes(t)}J.isValidPlatform=ug;async function kx(){return["electron"]}J.getKnownCommunityPlatforms=kx;async function G4(t){return(await kx()).includes(t)}J.isValidCommunityPlatform=G4;async function $x(){return["windows"]}J.getKnownEnterprisePlatforms=$x;async function W4(t){return(await $x()).includes(t)}J.isValidEnterprisePlatform=W4;async function Y4(t,e,r){let{prompt:n}=await Promise.resolve().then(()=>Os.__importStar((Fl(),ie(Ol))));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 ug(o)){let i=await sg();(0,Xi.fatal)(`Invalid platform: ${$e.default.input(o)}.
92
+ Valid platforms include: ${i.join(", ")}`)}return o}J.promptForPlatform=Y4;async function J4(t,e){let{prompt:r}=await Promise.resolve().then(()=>Os.__importStar((Fl(),ie(Ol)))),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:`${Ix(s)} (${s.id})`,value:s}))}],{onCancel:()=>process.exit(1)})).target;let o=e.trim(),i=t.find(a=>a.id===o);return i||(0,Xi.fatal)(`Invalid target ID: ${$e.default.input(o)}.
93
+ Valid targets are: ${t.map(a=>a.id).join(", ")}`),i}J.promptForPlatformTarget=J4;function Ix(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"})`:""}`}J.getPlatformTargetName=Ix;async function Tx(t){let e=[];return await $l(t,t.android.name)&&e.push(t.android.name),await $l(t,t.ios.name)&&e.push(t.ios.name),e.push(t.web.name),e}J.getAddedPlatforms=Tx;async function X4(t,e){let r=await Promise.resolve().then(()=>Os.__importStar((Ex(),ie(Cx)))),n=await Px(t),o=await Il(t,e);(r.diff(n,o)==="minor"||r.diff(n,o)==="major")&&xx.logger.warn(`${$e.default.strong("@capacitor/core")}${$e.default.weak(`@${n}`)} version doesn't match ${$e.default.strong(`@capacitor/${e}`)}${$e.default.weak(`@${o}`)} version.
94
+ Consider updating to a matching version, e.g. w/ ${$e.default.input(`npm install @capacitor/core@${o}`)}`)}J.checkPlatformVersions=X4;function Z4(t,e){if(e[0]!=="@"){let n=(0,As.resolveNode)(t.app.rootDir,`@capacitor/${e}`,"package.json");if(n)return(0,ko.dirname)(n);let o=(0,As.resolveNode)(t.app.rootDir,`@capacitor-community/${e}`,"package.json");if(o)return(0,ko.dirname)(o);let i=(0,As.resolveNode)(t.app.rootDir,`@ionic-enterprise/capacitor-${e}`,"package.json");if(i)return(0,ko.dirname)(i)}let r=(0,As.resolveNode)(t.app.rootDir,e,"package.json");return r?(0,ko.dirname)(r):null}J.resolvePlatform=Z4;async function Q4(){try{let t=await(0,T4.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}}J.checkJDKMajorVersion=Q4;function eM(t){let e=t.replace(/([A-Z])/g,"$1").toLowerCase();return`app-${e?`${e}-`:""}debug.apk`}J.parseApkNameFromFlavor=eM});var Bx=x(Tl=>{"use strict";Object.defineProperty(Tl,"__esModule",{value:!0});Tl.tryFn=void 0;var tM=async(t,...e)=>{try{return await t(...e)}catch{}return null};Tl.tryFn=tM});var Nx=x(Rl=>{"use strict";Object.defineProperty(Rl,"__esModule",{value:!0});Rl.formatJSObject=void 0;var rM=(ve(),ie(we)),nM=rM.__importDefault(require("util"));function oM(t){try{t=JSON.parse(JSON.stringify(t))}catch(e){throw new Error(`Cannot parse object as JSON: ${e.stack?e.stack:e}`)}return nM.default.inspect(t,{compact:!1,breakLength:1/0,depth:1/0,maxArrayLength:1/0,maxStringLength:1/0})}Rl.formatJSObject=oM});var Lx=x(Hn=>{"use strict";Object.defineProperty(Hn,"__esModule",{value:!0});Hn.lazy=Hn.LazyPromise=Hn.allSerial=void 0;function iM(t){return t.reduce((e,r)=>e.then(n=>r().then(o=>n.concat(o))),Promise.resolve([]))}Hn.allSerial=iM;var Bl=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)}};Hn.LazyPromise=Bl;function aM(t){return new Bl(async(e,r)=>{try{e(await t())}catch(n){r(n)}})}Hn.lazy=aM});var qx=x(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.writeConfig=ht.loadConfig=ht.CONFIG_FILE_NAME_JSON=ht.CONFIG_FILE_NAME_JS=ht.CONFIG_FILE_NAME_TS=void 0;var lg=(ve(),ie(we)),sM=lg.__importDefault(_m()),Jt=qi(),ce=require("path"),$o=lg.__importDefault(Hi()),uM=Rx(),Nl=xl(),cM=Ss(),cg=Bx(),lM=Nx(),jx=Du(),Ux=Pl(),Zi=Lx(),fM=kl(),Mx=(0,sM.default)("capacitor:config");ht.CONFIG_FILE_NAME_TS="capacitor.config.ts";ht.CONFIG_FILE_NAME_JS="capacitor.config.js";ht.CONFIG_FILE_NAME_JSON="capacitor.config.json";async function dM(){var t,e,r,n;let o=process.cwd(),i=(0,ce.dirname)(__dirname),a=await gM(o),s=await(async()=>{var h,m;if((0,jx.isNXMonorepo)(o)){let y=(0,jx.findNXMonorepoRoot)(o),D=await(0,cg.tryFn)(Jt.readJSON,(0,ce.resolve)(y,"package.json")),v=(h=D?.devDependencies)!==null&&h!==void 0?h:{},E=(m=D?.dependencies)!==null&&m!==void 0?m:{};return{devDependencies:v,dependencies:E}}return{}})(),u=(t=a.extConfig.appId)!==null&&t!==void 0?t:"",c=(e=a.extConfig.appName)!==null&&e!==void 0?e:"",f=(r=a.extConfig.webDir)!==null&&r!==void 0?r:"www",d=await yM(i),p={android:await DM(o,a.extConfig,d),ios:await bM(o,a.extConfig),web:await wM(o,f),cli:d,app:{rootDir:o,appId:u,appName:c,webDir:f,webDirAbs:(0,ce.resolve)(o,f),package:(n=await(0,cg.tryFn)(Jt.readJSON,(0,ce.resolve)(o,"package.json")))!==null&&n!==void 0?n:{name:c,version:"1.0.0",...s},...a}};return Mx("config: %O",p),p}ht.loadConfig=dM;async function pM(t,e){switch((0,ce.extname)(e)){case".json":{await(0,Jt.writeJSON)(e,t,{spaces:2});break}case".ts":{await(0,Jt.writeFile)(e,xM(t));break}}}ht.writeConfig=pM;async function hM(t,e,r){var n;try{let o=(0,Ux.resolveNode)(t,"typescript");o||(0,Nl.fatal)(`Could not find installation of TypeScript.
95
+ To use ${$o.default.strong(e)} files, you must install TypeScript in your project, e.g. w/ ${$o.default.input("npm install -D typescript")}`);let i=require(o),a=(0,Ux.requireTS)(i,r),s=a.default?await a.default:a;return{extConfigType:"ts",extConfigName:e,extConfigFilePath:r,extConfig:s}}catch(o){throw(0,Nl.isFatal)(o)||(0,Nl.fatal)(`Parsing ${$o.default.strong(e)} failed.
96
96
 
97
- ${(n=o.stack)!==null&&n!==void 0?n:o}`),o}}async function l5(t,e,r){var n;try{return{extConfigType:"js",extConfigName:e,extConfigFilePath:r,extConfig:await require(r)}}catch(o){(0,Il.fatal)(`Parsing ${ko.default.strong(e)} failed.
97
+ ${(n=o.stack)!==null&&n!==void 0?n:o}`),o}}async function mM(t,e,r){var n;try{return{extConfigType:"js",extConfigName:e,extConfigFilePath:r,extConfig:await require(r)}}catch(o){(0,Nl.fatal)(`Parsing ${$o.default.strong(e)} failed.
98
98
 
99
- ${(n=o.stack)!==null&&n!==void 0?n:o}`)}}async function f5(t){var e;let r=(0,ce.resolve)(t,pt.CONFIG_FILE_NAME_TS);if(await(0,Yt.pathExists)(r))return c5(t,pt.CONFIG_FILE_NAME_TS,r);let n=(0,ce.resolve)(t,pt.CONFIG_FILE_NAME_JS);if(await(0,Yt.pathExists)(n))return l5(t,pt.CONFIG_FILE_NAME_JS,n);let o=(0,ce.resolve)(t,pt.CONFIG_FILE_NAME_JSON);return{extConfigType:"json",extConfigName:pt.CONFIG_FILE_NAME_JSON,extConfigFilePath:o,extConfig:(e=await(0,og.tryFn)(Yt.readJSON,o))!==null&&e!==void 0?e:{}}}async function d5(t){let e="assets",r=(0,ce.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,ce.resolve)(r,n),cordovaPluginsTemplateArchive:o,cordovaPluginsTemplateArchiveAbs:(0,ce.resolve)(r,o)},android:{platformTemplateArchive:i,platformTemplateArchiveAbs:(0,ce.resolve)(r,i),cordovaPluginsTemplateArchive:a,cordovaPluginsTemplateArchiveAbs:(0,ce.resolve)(r,a)}},package:await(0,Yt.readJSON)((0,ce.resolve)(t,"package.json")),os:g5(process.platform)}}async function p5(t,e,r){var n,o,i,a,s,u,c,f,d,p,h,m,y,D,v,E,g;let _="android",S=(o=(n=e.android)===null||n===void 0?void 0:n.path)!==null&&o!==void 0?o:"android",P=(0,ce.resolve)(t,S),F="app",B=`${F}/src`,T=`${B}/main`,j=`${T}/assets`,A=`${j}/public`,M=`${T}/res`,L=`${F}/build/outputs/apk/`,X=((i=e.android)===null||i===void 0?void 0:i.flavor)||"";!((a=e.android)===null||a===void 0)&&a.flavor&&(L=`${L}/${(s=e.android)===null||s===void 0?void 0:s.flavor}`);let k=(0,n5.parseApkNameFromFlavor)(X),b=`${L}/debug`,w="capacitor-cordova-android-plugins",C=(0,Zi.lazy)(()=>b5(r.os)),O={keystorePath:(c=(u=e.android)===null||u===void 0?void 0:u.buildOptions)===null||c===void 0?void 0:c.keystorePath,keystorePassword:(d=(f=e.android)===null||f===void 0?void 0:f.buildOptions)===null||d===void 0?void 0:d.keystorePassword,keystoreAlias:(h=(p=e.android)===null||p===void 0?void 0:p.buildOptions)===null||h===void 0?void 0:h.keystoreAlias,keystoreAliasPassword:(y=(m=e.android)===null||m===void 0?void 0:m.buildOptions)===null||y===void 0?void 0:y.keystoreAliasPassword,signingType:(v=(D=e.android)===null||D===void 0?void 0:D.buildOptions)===null||v===void 0?void 0:v.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:C,platformDir:S,platformDirAbs:P,cordovaPluginsDir:w,cordovaPluginsDirAbs:(0,ce.resolve)(P,w),appDir:F,appDirAbs:(0,ce.resolve)(P,F),srcDir:B,srcDirAbs:(0,ce.resolve)(P,B),srcMainDir:T,srcMainDirAbs:(0,ce.resolve)(P,T),assetsDir:j,assetsDirAbs:(0,ce.resolve)(P,j),webDir:A,webDirAbs:(0,ce.resolve)(P,A),resDir:M,resDirAbs:(0,ce.resolve)(P,M),apkName:k,buildOutputDir:b,buildOutputDirAbs:(0,ce.resolve)(P,b),flavor:X,buildOptions:O}}async function h5(t,e){var r,n,o,i,a,s,u,c,f,d,p,h;let y=(n=(r=e.ios)===null||r===void 0?void 0:r.path)!==null&&n!==void 0?n:"ios",D=(0,ce.resolve)(t,y),v=(i=(o=e.ios)===null||o===void 0?void 0:o.scheme)!==null&&i!==void 0?i:"App",E="App",g=(0,ce.resolve)(D,E),_=`${E}/App`,S=(0,ce.resolve)(D,_),P=`${E}/App.xcodeproj`,F=(0,ce.resolve)(D,P),B=(0,Zi.lazy)(()=>y5(g)),T=(0,Zi.lazy)(()=>w5(t,D,g)),j=(0,Zi.lazy)(()=>D5(g,S,F)),A="capacitor-cordova-ios-plugins",M={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:(d=(f=e.ios)===null||f===void 0?void 0:f.buildOptions)===null||d===void 0?void 0:d.signingCertificate,provisioningProfile:(h=(p=e.ios)===null||p===void 0?void 0:p.buildOptions)===null||h===void 0?void 0:h.provisioningProfile};return{name:"ios",minVersion:"14.0",platformDir:y,platformDirAbs:D,scheme:v,cordovaPluginsDir:A,cordovaPluginsDirAbs:(0,ce.resolve)(D,A),nativeProjectDir:E,nativeProjectDirAbs:g,nativeTargetDir:_,nativeTargetDirAbs:S,nativeXcodeProjDir:P,nativeXcodeProjDirAbs:F,nativeXcodeWorkspaceDir:(0,Zi.lazy)(async()=>(0,ce.relative)(D,await B)),nativeXcodeWorkspaceDirAbs:B,webDir:(0,Zi.lazy)(async()=>(0,ce.relative)(D,await j)),webDirAbs:j,podPath:T,buildOptions:M}}async function m5(t,e){let r=e,n=(0,ce.resolve)(t,r);return{name:"web",platformDir:r,platformDirAbs:n}}function g5(t){switch(t){case"darwin":return"mac";case"win32":return"windows";case"linux":return"linux"}return"unknown"}async function y5(t){return(0,ce.resolve)(t,"App.xcworkspace")}async function D5(t,e,r){let n=/path\s=\spublic[\s\S]+?sourceTree\s=\s([^;]+)/,o=(0,ce.resolve)(r,"project.pbxproj");try{let a=(await(0,Yt.readFile)(o,{encoding:"utf8"})).match(n);if(a&&a[1]==="SOURCE_ROOT")return o5.logger.warn(`Using the iOS project root for the ${ko.default.strong("public")} directory is deprecated.
100
- Please follow the Upgrade Guide to move ${ko.default.strong("public")} inside the iOS target directory: ${ko.default.strong("https://capacitorjs.com/docs/updating/3-0#move-public-into-the-ios-target-directory")}`),(0,ce.resolve)(t,"public")}catch{}return(0,ce.resolve)(e,"public")}async function b5(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(()=>ig.__importStar(Al())),r="C:\\Program Files\\Android\\Android Studio\\bin\\studio64.exe";try{if(!await(0,Yt.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){Bx("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 w5(t,e,r){if(process.env.CAPACITOR_COCOAPODS_PATH)return process.env.CAPACITOR_COCOAPODS_PATH;let n="";if(await(0,Yt.pathExists)((0,ce.resolve)(t,"Gemfile"))?n=(0,ce.resolve)(t,"Gemfile"):await(0,Yt.pathExists)((0,ce.resolve)(e,"Gemfile"))?n=(0,ce.resolve)(e,"Gemfile"):await(0,Yt.pathExists)((0,ce.resolve)(r,"Gemfile"))&&(n=(0,ce.resolve)(r,"Gemfile")),!(n!=""))try{let i=await(0,a5.getCommandOutput)("git",["rev-parse","--show-toplevel"],{cwd:t});i!=null&&(n=(0,ce.resolve)(i,"Gemfile"))}catch{}try{let i=(await(0,Yt.readFile)(n)).toString();return i&&new RegExp(/gem\s+['"]cocoapods/).test(i)?"bundle exec pod":"pod"}catch{return"pod"}}function v5(t){return`import type { CapacitorConfig } from '@capacitor/cli';
99
+ ${(n=o.stack)!==null&&n!==void 0?n:o}`)}}async function gM(t){var e;let r=(0,ce.resolve)(t,ht.CONFIG_FILE_NAME_TS);if(await(0,Jt.pathExists)(r))return hM(t,ht.CONFIG_FILE_NAME_TS,r);let n=(0,ce.resolve)(t,ht.CONFIG_FILE_NAME_JS);if(await(0,Jt.pathExists)(n))return mM(t,ht.CONFIG_FILE_NAME_JS,n);let o=(0,ce.resolve)(t,ht.CONFIG_FILE_NAME_JSON);return{extConfigType:"json",extConfigName:ht.CONFIG_FILE_NAME_JSON,extConfigFilePath:o,extConfig:(e=await(0,cg.tryFn)(Jt.readJSON,o))!==null&&e!==void 0?e:{}}}async function yM(t){let e="assets",r=(0,ce.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,ce.resolve)(r,n),cordovaPluginsTemplateArchive:o,cordovaPluginsTemplateArchiveAbs:(0,ce.resolve)(r,o)},android:{platformTemplateArchive:i,platformTemplateArchiveAbs:(0,ce.resolve)(r,i),cordovaPluginsTemplateArchive:a,cordovaPluginsTemplateArchiveAbs:(0,ce.resolve)(r,a)}},package:await(0,Jt.readJSON)((0,ce.resolve)(t,"package.json")),os:vM(process.platform)}}async function DM(t,e,r){var n,o,i,a,s,u,c,f,d,p,h,m,y,D,v,E,g;let _="android",S=(o=(n=e.android)===null||n===void 0?void 0:n.path)!==null&&o!==void 0?o:"android",k=(0,ce.resolve)(t,S),F="app",B=`${F}/src`,T=`${B}/main`,j=`${T}/assets`,A=`${j}/public`,M=`${T}/res`,L=`${F}/build/outputs/apk/`,X=((i=e.android)===null||i===void 0?void 0:i.flavor)||"";!((a=e.android)===null||a===void 0)&&a.flavor&&(L=`${L}/${(s=e.android)===null||s===void 0?void 0:s.flavor}`);let P=(0,uM.parseApkNameFromFlavor)(X),b=`${L}/debug`,w="capacitor-cordova-android-plugins",C=(0,Zi.lazy)(()=>_M(r.os)),O={keystorePath:(c=(u=e.android)===null||u===void 0?void 0:u.buildOptions)===null||c===void 0?void 0:c.keystorePath,keystorePassword:(d=(f=e.android)===null||f===void 0?void 0:f.buildOptions)===null||d===void 0?void 0:d.keystorePassword,keystoreAlias:(h=(p=e.android)===null||p===void 0?void 0:p.buildOptions)===null||h===void 0?void 0:h.keystoreAlias,keystoreAliasPassword:(y=(m=e.android)===null||m===void 0?void 0:m.buildOptions)===null||y===void 0?void 0:y.keystoreAliasPassword,signingType:(v=(D=e.android)===null||D===void 0?void 0:D.buildOptions)===null||v===void 0?void 0:v.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:C,platformDir:S,platformDirAbs:k,cordovaPluginsDir:w,cordovaPluginsDirAbs:(0,ce.resolve)(k,w),appDir:F,appDirAbs:(0,ce.resolve)(k,F),srcDir:B,srcDirAbs:(0,ce.resolve)(k,B),srcMainDir:T,srcMainDirAbs:(0,ce.resolve)(k,T),assetsDir:j,assetsDirAbs:(0,ce.resolve)(k,j),webDir:A,webDirAbs:(0,ce.resolve)(k,A),resDir:M,resDirAbs:(0,ce.resolve)(k,M),apkName:P,buildOutputDir:b,buildOutputDirAbs:(0,ce.resolve)(k,b),flavor:X,buildOptions:O}}async function bM(t,e){var r,n,o,i,a,s,u,c,f,d,p,h;let y=(n=(r=e.ios)===null||r===void 0?void 0:r.path)!==null&&n!==void 0?n:"ios",D=(0,ce.resolve)(t,y),v=(i=(o=e.ios)===null||o===void 0?void 0:o.scheme)!==null&&i!==void 0?i:"App",E="App",g=(0,ce.resolve)(D,E),_=`${E}/App`,S=(0,ce.resolve)(D,_),k=`${E}/App.xcodeproj`,F=(0,ce.resolve)(D,k),B=(0,Zi.lazy)(()=>CM(g)),T=(0,Zi.lazy)(()=>SM(t,D,g)),j=(0,Zi.lazy)(()=>EM(g,S,F)),A="capacitor-cordova-ios-plugins",M={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:(d=(f=e.ios)===null||f===void 0?void 0:f.buildOptions)===null||d===void 0?void 0:d.signingCertificate,provisioningProfile:(h=(p=e.ios)===null||p===void 0?void 0:p.buildOptions)===null||h===void 0?void 0:h.provisioningProfile};return{name:"ios",minVersion:"14.0",platformDir:y,platformDirAbs:D,scheme:v,cordovaPluginsDir:A,cordovaPluginsDirAbs:(0,ce.resolve)(D,A),nativeProjectDir:E,nativeProjectDirAbs:g,nativeTargetDir:_,nativeTargetDirAbs:S,nativeXcodeProjDir:k,nativeXcodeProjDirAbs:F,nativeXcodeWorkspaceDir:(0,Zi.lazy)(async()=>(0,ce.relative)(D,await B)),nativeXcodeWorkspaceDirAbs:B,webDir:(0,Zi.lazy)(async()=>(0,ce.relative)(D,await j)),webDirAbs:j,podPath:T,buildOptions:M}}async function wM(t,e){let r=e,n=(0,ce.resolve)(t,r);return{name:"web",platformDir:r,platformDirAbs:n}}function vM(t){switch(t){case"darwin":return"mac";case"win32":return"windows";case"linux":return"linux"}return"unknown"}async function CM(t){return(0,ce.resolve)(t,"App.xcworkspace")}async function EM(t,e,r){let n=/path\s=\spublic[\s\S]+?sourceTree\s=\s([^;]+)/,o=(0,ce.resolve)(r,"project.pbxproj");try{let a=(await(0,Jt.readFile)(o,{encoding:"utf8"})).match(n);if(a&&a[1]==="SOURCE_ROOT")return cM.logger.warn(`Using the iOS project root for the ${$o.default.strong("public")} directory is deprecated.
100
+ Please follow the Upgrade Guide to move ${$o.default.strong("public")} inside the iOS target directory: ${$o.default.strong("https://capacitorjs.com/docs/updating/3-0#move-public-into-the-ios-target-directory")}`),(0,ce.resolve)(t,"public")}catch{}return(0,ce.resolve)(e,"public")}async function _M(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(()=>lg.__importStar(kl())),r="C:\\Program Files\\Android\\Android Studio\\bin\\studio64.exe";try{if(!await(0,Jt.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){Mx("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 SM(t,e,r){if(process.env.CAPACITOR_COCOAPODS_PATH)return process.env.CAPACITOR_COCOAPODS_PATH;let n="";if(await(0,Jt.pathExists)((0,ce.resolve)(t,"Gemfile"))?n=(0,ce.resolve)(t,"Gemfile"):await(0,Jt.pathExists)((0,ce.resolve)(e,"Gemfile"))?n=(0,ce.resolve)(e,"Gemfile"):await(0,Jt.pathExists)((0,ce.resolve)(r,"Gemfile"))&&(n=(0,ce.resolve)(r,"Gemfile")),!(n!=""))try{let i=await(0,fM.getCommandOutput)("git",["rev-parse","--show-toplevel"],{cwd:t});i!=null&&(n=(0,ce.resolve)(i,"Gemfile"))}catch{}try{let i=(await(0,Jt.readFile)(n)).toString();return i&&new RegExp(/gem\s+['"]cocoapods/).test(i)?"bundle exec pod":"pod"}catch{return"pod"}}function xM(t){return`import type { CapacitorConfig } from '@capacitor/cli';
101
101
 
102
- const config: CapacitorConfig = ${(0,i5.formatJSObject)(t)};
102
+ const config: CapacitorConfig = ${(0,lM.formatJSObject)(t)};
103
103
 
104
104
  export default config;
105
- `}});function C5(){try{return ug.default.statSync("/.dockerenv"),!0}catch{return!1}}function E5(){try{return ug.default.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function cg(){return sg===void 0&&(sg=C5()||E5()),sg}var ug,sg,jx=Ze(()=>{ug=fe(require("node:fs"),1)});function ea(){return lg===void 0&&(lg=_5()||cg()),lg}var Ux,lg,_5,fg=Ze(()=>{Ux=fe(require("node:fs"),1);jx();_5=()=>{try{return Ux.default.statSync("/run/.containerenv"),!0}catch{return!1}}});var dg,qx,Hx,Mx,ln,pg=Ze(()=>{dg=fe(require("node:process"),1),qx=fe(require("node:os"),1),Hx=fe(require("node:fs"),1);fg();Mx=()=>{if(dg.default.platform!=="linux")return!1;if(qx.default.release().toLowerCase().includes("microsoft"))return!ea();try{return Hx.default.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!ea():!1}catch{return!1}},ln=dg.default.env.__IS_WSL_TEST__?Mx:Mx()});var hg,Vx,zx,Kx,S5,mg,tr,gg=Ze(()=>{hg=fe(require("node:process"),1),Vx=require("node:buffer"),zx=require("node:util"),Kx=fe(require("node:child_process"),1),S5=(0,zx.promisify)(Kx.default.execFile),mg=()=>`${hg.default.env.SYSTEMROOT||hg.default.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`,tr=async(t,e={})=>{let{powerShellPath:r,...n}=e,o=tr.encodeCommand(t);return S5(r??mg(),[...tr.argumentsPrefix,o],{encoding:"utf8",...n})};tr.argumentsPrefix=["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"];tr.encodeCommand=t=>Vx.Buffer.from(t,"utf16le").toString("base64");tr.escapeArgument=t=>`'${String(t).replaceAll("'","''")}'`});var Wx,Yx,Po,x5,A5,O5,Tl,Gx,Jx,Xx,Zx,Qx=Ze(()=>{Wx=require("node:util"),Yx=fe(require("node:child_process"),1),Po=fe(require("node:fs/promises"),1);pg();gg();pg();x5=(0,Wx.promisify)(Yx.default.execFile),A5=(()=>{let t="/mnt/",e;return async function(){if(e)return e;let r="/etc/wsl.conf",n=!1;try{await Po.default.access(r,Po.constants.F_OK),n=!0}catch{}if(!n)return t;let o=await Po.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}})(),O5=async()=>`${await A5()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,Tl=ln?O5:mg,Jx=async()=>(Gx??=(async()=>{try{let t=await Tl();return await Po.default.access(t,Po.constants.X_OK),!0}catch{return!1}})(),Gx),Xx=async()=>{let t=await Tl(),e=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,{stdout:r}=await tr(e,{powerShellPath:t});return r.trim()},Zx=async t=>{if(/^[a-z]+:\/\//i.test(t))return t;try{let{stdout:e}=await x5("wslpath",["-aw",t],{encoding:"utf8"});return e.trim()}catch{return t}}});function $o(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 eA=Ze(()=>{});async function yg(){if(rA.default.platform!=="darwin")throw new Error("macOS only");let{stdout:t}=await F5("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]),r=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(t)?.groups.id??"com.apple.Safari";return r==="com.apple.safari"?"com.apple.Safari":r}var tA,rA,nA,F5,oA=Ze(()=>{tA=require("node:util"),rA=fe(require("node:process"),1),nA=require("node:child_process"),F5=(0,tA.promisify)(nA.execFile)});async function sA(t,{humanReadableOutput:e=!0,signal:r}={}){if(iA.default.platform!=="darwin")throw new Error("macOS only");let n=e?[]:["-ss"],o={};r&&(o.signal=r);let{stdout:i}=await k5("osascript",["-e",t,n],o);return i.trim()}var iA,aA,Dg,k5,uA=Ze(()=>{iA=fe(require("node:process"),1),aA=require("node:util"),Dg=require("node:child_process"),k5=(0,aA.promisify)(Dg.execFile)});async function bg(t){return sA(`tell application "Finder" to set app_path to application file id "${t}" as string
106
- tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}var cA=Ze(()=>{uA()});async function vg(t=P5){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 Rl(`Cannot find Windows browser in stdout: ${JSON.stringify(e)}`);let{id:n}=r.groups,o=dA[n];if(!o)throw new Rl(`Unknown browser ID: ${n}`);return o}var lA,fA,P5,dA,wg,Rl,Cg=Ze(()=>{lA=require("node:util"),fA=require("node:child_process"),P5=(0,lA.promisify)(fA.execFile),dA={MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},MSEdgeBHTML:{name:"Edge Beta",id:"com.microsoft.edge.beta"},MSEdgeDHTML:{name:"Edge Dev",id:"com.microsoft.edge.dev"},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},ChromeBHTML:{name:"Chrome Beta",id:"com.google.chrome.beta"},ChromeDHTML:{name:"Chrome Dev",id:"com.google.chrome.dev"},ChromiumHTM:{name:"Chromium",id:"org.chromium.Chromium"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveDHTML:{name:"Brave Dev",id:"com.brave.Browser.dev"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},OperaStable:{name:"Opera",id:"com.operasoftware.Opera"},VivaldiHTM:{name:"Vivaldi",id:"com.vivaldi.Vivaldi"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"}},wg=new Map(Object.entries(dA)),Rl=class extends Error{}});async function Eg(){if(Bl.default.platform==="darwin"){let t=await yg();return{name:await bg(t),id:t}}if(Bl.default.platform==="linux"){let{stdout:t}=await $5("xdg-mime",["query","default","x-scheme-handler/http"]),e=t.trim();return{name:I5(e.replace(/.desktop$/,"").replace("-"," ")),id:e}}if(Bl.default.platform==="win32")return vg();throw new Error("Only macOS, Linux, and Windows are supported")}var pA,Bl,hA,$5,I5,mA=Ze(()=>{pA=require("node:util"),Bl=fe(require("node:process"),1),hA=require("node:child_process");oA();cA();Cg();Cg();$5=(0,pA.promisify)(hA.execFile),I5=t=>t.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase())});var Nl,T5,gA,yA=Ze(()=>{Nl=fe(require("node:process"),1),T5=!!(Nl.default.env.SSH_CONNECTION||Nl.default.env.SSH_CLIENT||Nl.default.env.SSH_TTY),gA=T5});var Ag={};Jr(Ag,{apps:()=>Io,default:()=>N5,openApp:()=>B5});function vA(t){if(typeof t=="string"||Array.isArray(t))return t;let{[bA]:e}=t;if(!e)throw new Error(`${bA} is not supported`);return e}function ks({[ta]:t},{wsl:e}={}){if(e&&ln)return vA(e);if(!t)throw new Error(`${ta} is not supported`);return vA(t)}var Sg,xg,EA,_A,jl,CA,Ll,_g,DA,ta,bA,wA,Fs,R5,B5,Io,N5,Og=Ze(()=>{Sg=fe(require("node:process"),1),xg=fe(require("node:path"),1),EA=require("node:url"),_A=fe(require("node:child_process"),1),jl=fe(require("node:fs/promises"),1);Qx();gg();eA();mA();fg();yA();CA={},Ll=Symbol("fallbackAttempt"),_g=CA.url?xg.default.dirname((0,EA.fileURLToPath)(CA.url)):"",DA=xg.default.join(_g,"xdg-open"),{platform:ta,arch:bA}=Sg.default,wA=async(t,e)=>{if(t.length===0)return;let r=[];for(let n of t)try{return await e(n)}catch(o){r.push(o)}throw new AggregateError(r,"Failed to open in all supported apps")},Fs=async t=>{t={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...t};let e=t[Ll]===!0;if(delete t[Ll],Array.isArray(t.app))return wA(t.app,c=>Fs({...t,app:c,[Ll]:!0}));let{name:r,arguments:n=[]}=t.app??{};if(n=[...n],Array.isArray(r))return wA(r,c=>Fs({...t,app:{name:c,arguments:n},[Ll]:!0}));if(r==="browser"||r==="browserPrivate"){let c={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge","com.apple.safari":"safari"},f={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},d;if(ln){let p=await Xx();d=wg.get(p)??{}}else d=await Eg();if(d.id in c){let p=c[d.id.toLowerCase()];if(r==="browserPrivate"){if(p==="safari")throw new Error("Safari doesn't support opening in private mode via command line");n.push(f[p])}return Fs({...t,app:{name:Io[p],arguments:n}})}throw new Error(`${d.name} is not supported as a default browser`)}let o,i=[],a={},s=!1;if(ln&&!ea()&&!gA&&!r&&(s=await Jx()),ta==="darwin")o="open",t.wait&&i.push("--wait-apps"),t.background&&i.push("--background"),t.newInstance&&i.push("--new"),r&&i.push("-a",r);else if(ta==="win32"||s){o=await Tl(),i.push(...tr.argumentsPrefix),ln||(a.windowsVerbatimArguments=!0),ln&&t.target&&(t.target=await Zx(t.target));let c=["$ProgressPreference = 'SilentlyContinue';","Start"];t.wait&&c.push("-Wait"),r?(c.push(tr.escapeArgument(r)),t.target&&n.push(t.target)):t.target&&c.push(tr.escapeArgument(t.target)),n.length>0&&(n=n.map(f=>tr.escapeArgument(f)),c.push("-ArgumentList",n.join(","))),t.target=tr.encodeCommand(c.join(" ")),t.wait||(a.stdio="ignore")}else{if(r)o=r;else{let c=!_g||_g==="/",f=!1;try{await jl.default.access(DA,jl.constants.X_OK),f=!0}catch{}o=Sg.default.versions.electron??(ta==="android"||c||!f)?"xdg-open":DA}n.length>0&&i.push(...n),t.wait||(a.stdio="ignore",a.detached=!0)}ta==="darwin"&&n.length>0&&i.push("--args",...n),t.target&&i.push(t.target);let u=_A.default.spawn(o,i,a);return t.wait?new Promise((c,f)=>{u.once("error",f),u.once("close",d=>{if(!t.allowNonzeroExitCode&&d!==0){f(new Error(`Exited with code ${d}`));return}c(u)})}):e?new Promise((c,f)=>{u.once("error",f),u.once("spawn",()=>{u.once("close",d=>{if(u.off("error",f),d!==0){f(new Error(`Exited with code ${d}`));return}u.unref(),c(u)})})}):(u.unref(),new Promise((c,f)=>{u.once("error",f),u.once("spawn",()=>{u.off("error",f),c(u)})}))},R5=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a `target`");return Fs({...e,target:t})},B5=(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 Fs({...e,app:{name:t,arguments:r}})};Io={browser:"browser",browserPrivate:"browserPrivate"};$o(Io,"chrome",()=>ks({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium","chromium-browser"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));$o(Io,"brave",()=>ks({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"]}}));$o(Io,"firefox",()=>ks({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));$o(Io,"edge",()=>ks({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));$o(Io,"safari",()=>ks({darwin:"Safari"}));N5=R5});var pf=x(vr=>{"use strict";vr.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;vr.find=(t,e)=>t.nodes.find(r=>r.type===e);vr.exceedsLimit=(t,e,r=1,n)=>n===!1||!vr.isInteger(t)||!vr.isInteger(e)?!1:(Number(e)-Number(t))/Number(r)>=n;vr.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)};vr.encloseBrace=t=>t.type!=="brace"?!1:t.commas>>0+t.ranges>>0===0?(t.invalid=!0,!0):!1;vr.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;vr.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;vr.reduce=t=>t.reduce((e,r)=>(r.type==="text"&&e.push(r.value),r.type==="range"&&(r.type="text"),e),[]);vr.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 hf=x((cX,oO)=>{"use strict";var nO=pf();oO.exports=(t,e={})=>{let r=(n,o={})=>{let i=e.escapeInvalid&&nO.isInvalidBrace(o),a=n.invalid===!0&&e.escapeInvalid===!0,s="";if(n.value)return(i||a)&&nO.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 aO=x((lX,iO)=>{"use strict";iO.exports=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}});var mO=x((fX,hO)=>{"use strict";var sO=aO(),Ho=(t,e,r)=>{if(sO(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(sO(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(Ho.cache.hasOwnProperty(u))return Ho.cache[u].result;let c=Math.min(t,e),f=Math.max(t,e);if(Math.abs(c-f)===1){let y=t+"|"+e;return n.capture?`(${y})`:n.wrap===!1?y:`(?:${y})`}let d=pO(t)||pO(e),p={min:t,max:e,a:c,b:f},h=[],m=[];if(d&&(p.isPadded=d,p.maxLen=String(p.max).length),c<0){let y=f<0?Math.abs(f):1;m=uO(y,Math.abs(c),p,n),c=p.a=0}return f>=0&&(h=uO(c,f,p,n)),p.negatives=m,p.positives=h,p.result=PM(m,h,n),n.capture===!0?p.result=`(${p.result})`:n.wrap!==!1&&h.length+m.length>1&&(p.result=`(?:${p.result})`),Ho.cache[u]=p,p.result};function PM(t,e,r){let n=Zg(t,e,"-",!1,r)||[],o=Zg(e,t,"",!1,r)||[],i=Zg(t,e,"-?",!0,r)||[];return n.concat(i).concat(o).join("|")}function $M(t,e){let r=1,n=1,o=lO(t,r),i=new Set([e]);for(;t<=o&&o<=e;)i.add(o),r+=1,o=lO(t,r);for(o=fO(e+1,n)-1;t<o&&o<=e;)i.add(o),n+=1,o=fO(e+1,n)-1;return i=[...i],i.sort(RM),i}function IM(t,e,r){if(t===e)return{pattern:t,count:[],digits:0};let n=TM(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+=BM(u,c,r):a++}return a&&(i+=r.shorthand===!0?"\\d":"[0-9]"),{pattern:i,count:[a],digits:o}}function uO(t,e,r,n){let o=$M(t,e),i=[],a=t,s;for(let u=0;u<o.length;u++){let c=o[u],f=IM(String(a),String(c),n),d="";if(!r.isPadded&&s&&s.pattern===f.pattern){s.count.length>1&&s.count.pop(),s.count.push(f.count[0]),s.string=s.pattern+dO(s.count),a=c+1;continue}r.isPadded&&(d=NM(c,r,n)),f.string=d+f.pattern+dO(f.count),i.push(f),a=c+1,s=f}return i}function Zg(t,e,r,n,o){let i=[];for(let a of t){let{string:s}=a;!n&&!cO(e,"string",s)&&i.push(r+s),n&&cO(e,"string",s)&&i.push(r+s)}return i}function TM(t,e){let r=[];for(let n=0;n<t.length;n++)r.push([t[n],e[n]]);return r}function RM(t,e){return t>e?1:e>t?-1:0}function cO(t,e,r){return t.some(n=>n[e]===r)}function lO(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function fO(t,e){return t-t%Math.pow(10,e)}function dO(t){let[e=0,r=""]=t;return r||e>1?`{${e+(r?","+r:"")}}`:""}function BM(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function pO(t){return/^-?(0+)\d/.test(t)}function NM(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}}`}}Ho.cache={};Ho.clearCache=()=>Ho.cache={};hO.exports=Ho});var ty=x((dX,CO)=>{"use strict";var LM=require("util"),yO=mO(),gO=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),jM=t=>e=>t===!0?Number(e):String(e),Qg=t=>typeof t=="number"||typeof t=="string"&&t!=="",Vs=t=>Number.isInteger(+t),ey=t=>{let e=`${t}`,r=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++r]==="0";);return r>0},UM=(t,e,r)=>typeof t=="string"||typeof e=="string"?!0:r.stringify===!0,MM=(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},gf=(t,e)=>{let r=t[0]==="-"?"-":"";for(r&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return r?"-"+t:t},qM=(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=>gf(String(s),r)).join("|")),t.negatives.length&&(i=`-(${n}${t.negatives.map(s=>gf(String(s),r)).join("|")})`),o&&i?a=`${o}|${i}`:a=o||i,e.wrap?`(${n}${a})`:a},DO=(t,e,r,n)=>{if(r)return yO(t,e,{wrap:!1,...n});let o=String.fromCharCode(t);if(t===e)return o;let i=String.fromCharCode(e);return`[${o}-${i}]`},bO=(t,e,r)=>{if(Array.isArray(t)){let n=r.wrap===!0,o=r.capture?"":"?:";return n?`(${o}${t.join("|")})`:t.join("|")}return yO(t,e,r)},wO=(...t)=>new RangeError("Invalid range arguments: "+LM.inspect(...t)),vO=(t,e,r)=>{if(r.strictRanges===!0)throw wO([t,e]);return[]},HM=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return[]},VM=(t,e,r=1,n={})=>{let o=Number(t),i=Number(e);if(!Number.isInteger(o)||!Number.isInteger(i)){if(n.strictRanges===!0)throw wO([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 f=ey(s)||ey(u)||ey(c),d=f?Math.max(s.length,u.length,c.length):0,p=f===!1&&UM(t,e,n)===!1,h=n.transform||jM(p);if(n.toRegex&&r===1)return DO(gf(t,d),gf(e,d),!0,n);let m={negatives:[],positives:[]},y=E=>m[E<0?"negatives":"positives"].push(Math.abs(E)),D=[],v=0;for(;a?o>=i:o<=i;)n.toRegex===!0&&r>1?y(o):D.push(MM(h(o,v),d,p)),o=a?o-r:o+r,v++;return n.toRegex===!0?r>1?qM(m,n,d):bO(D,null,{wrap:!1,...n}):D},zM=(t,e,r=1,n={})=>{if(!Vs(t)&&t.length>1||!Vs(e)&&e.length>1)return vO(t,e,n);let o=n.transform||(p=>String.fromCharCode(p)),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 DO(u,c,!1,n);let f=[],d=0;for(;s?i>=a:i<=a;)f.push(o(i,d)),i=s?i-r:i+r,d++;return n.toRegex===!0?bO(f,null,{wrap:!1,options:n}):f},mf=(t,e,r,n={})=>{if(e==null&&Qg(t))return[t];if(!Qg(t)||!Qg(e))return vO(t,e,n);if(typeof r=="function")return mf(t,e,1,{transform:r});if(gO(r))return mf(t,e,0,r);let o={...n};return o.capture===!0&&(o.wrap=!0),r=r||o.step||1,Vs(r)?Vs(t)&&Vs(e)?VM(t,e,r,o):zM(t,e,Math.max(Math.abs(r),1),o):r!=null&&!gO(r)?HM(r,o):mf(t,e,1,r)};CO.exports=mf});var SO=x((pX,_O)=>{"use strict";var KM=ty(),EO=pf(),GM=(t,e={})=>{let r=(n,o={})=>{let i=EO.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 f=EO.reduce(n.nodes),d=KM(...f,{...e,wrap:!1,toRegex:!0,strictZeros:!0});if(d.length!==0)return f.length>1&&d.length>1?`(${d})`:d}if(n.nodes)for(let f of n.nodes)c+=r(f,n);return c};return r(t)};_O.exports=GM});var OO=x((hX,AO)=>{"use strict";var WM=ty(),xO=hf(),ga=pf(),Vo=(t="",e="",r=!1)=>{let n=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return r?ga.flatten(e).map(o=>`{${o}}`):e;for(let o of t)if(Array.isArray(o))for(let i of o)n.push(Vo(i,e,r));else for(let i of e)r===!0&&typeof i=="string"&&(i=`{${i}}`),n.push(Array.isArray(i)?Vo(o,i,r):o+i);return ga.flatten(n)},YM=(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(Vo(s.pop(),xO(o,e)));return}if(o.type==="brace"&&o.invalid!==!0&&o.nodes.length===2){s.push(Vo(s.pop(),["{}"]));return}if(o.nodes&&o.ranges>0){let d=ga.reduce(o.nodes);if(ga.exceedsLimit(...d,e.step,r))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let p=WM(...d,e);p.length===0&&(p=xO(o,e)),s.push(Vo(s.pop(),p)),o.nodes=[];return}let u=ga.encloseBrace(o),c=o.queue,f=o;for(;f.type!=="brace"&&f.type!=="root"&&f.parent;)f=f.parent,c=f.queue;for(let d=0;d<o.nodes.length;d++){let p=o.nodes[d];if(p.type==="comma"&&o.type==="brace"){d===1&&c.push(""),c.push("");continue}if(p.type==="close"){s.push(Vo(s.pop(),c,u));continue}if(p.value&&p.type!=="open"){c.push(Vo(c.pop(),p.value));continue}p.nodes&&n(p,o)}return c};return ga.flatten(n(t))};AO.exports=YM});var kO=x((mX,FO)=>{"use strict";FO.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:`
107
- `,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 RO=x((gX,TO)=>{"use strict";var JM=hf(),{MAX_LENGTH:PO,CHAR_BACKSLASH:ry,CHAR_BACKTICK:XM,CHAR_COMMA:ZM,CHAR_DOT:QM,CHAR_LEFT_PARENTHESES:e9,CHAR_RIGHT_PARENTHESES:t9,CHAR_LEFT_CURLY_BRACE:r9,CHAR_RIGHT_CURLY_BRACE:n9,CHAR_LEFT_SQUARE_BRACKET:$O,CHAR_RIGHT_SQUARE_BRACKET:IO,CHAR_DOUBLE_QUOTE:o9,CHAR_SINGLE_QUOTE:i9,CHAR_NO_BREAK_SPACE:a9,CHAR_ZERO_WIDTH_NOBREAK_SPACE:s9}=kO(),u9=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let r=e||{},n=typeof r.maxLength=="number"?Math.min(PO,r.maxLength):PO;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,f=0,d=0,p,h=()=>t[f++],m=y=>{if(y.type==="text"&&s.type==="dot"&&(s.type="text"),s&&s.type==="text"&&y.type==="text"){s.value+=y.value;return}return a.nodes.push(y),y.parent=a,y.prev=s,s=y,y};for(m({type:"bos"});f<c;)if(a=i[i.length-1],p=h(),!(p===s9||p===a9)){if(p===ry){m({type:"text",value:(e.keepEscaping?p:"")+h()});continue}if(p===IO){m({type:"text",value:"\\"+p});continue}if(p===$O){u++;let y;for(;f<c&&(y=h());){if(p+=y,y===$O){u++;continue}if(y===ry){p+=h();continue}if(y===IO&&(u--,u===0))break}m({type:"text",value:p});continue}if(p===e9){a=m({type:"paren",nodes:[]}),i.push(a),m({type:"text",value:p});continue}if(p===t9){if(a.type!=="paren"){m({type:"text",value:p});continue}a=i.pop(),m({type:"text",value:p}),a=i[i.length-1];continue}if(p===o9||p===i9||p===XM){let y=p,D;for(e.keepQuotes!==!0&&(p="");f<c&&(D=h());){if(D===ry){p+=D+h();continue}if(D===y){e.keepQuotes===!0&&(p+=D);break}p+=D}m({type:"text",value:p});continue}if(p===r9){d++;let D={type:"brace",open:!0,close:!1,dollar:s.value&&s.value.slice(-1)==="$"||a.dollar===!0,depth:d,commas:0,ranges:0,nodes:[]};a=m(D),i.push(a),m({type:"open",value:p});continue}if(p===n9){if(a.type!=="brace"){m({type:"text",value:p});continue}let y="close";a=i.pop(),a.close=!0,m({type:y,value:p}),d--,a=i[i.length-1];continue}if(p===ZM&&d>0){if(a.ranges>0){a.ranges=0;let y=a.nodes.shift();a.nodes=[y,{type:"text",value:JM(a)}]}m({type:"comma",value:p}),a.commas++;continue}if(p===QM&&d>0&&a.commas===0){let y=a.nodes;if(d===0||y.length===0){m({type:"text",value:p});continue}if(s.type==="dot"){if(a.range=[],s.value+=p,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"){y.pop();let D=y[y.length-1];D.value+=s.value+p,s=D,a.ranges--;continue}m({type:"dot",value:p});continue}m({type:"text",value:p})}do if(a=i.pop(),a.type!=="root"){a.nodes.forEach(v=>{v.nodes||(v.type==="open"&&(v.isOpen=!0),v.type==="close"&&(v.isClose=!0),v.nodes||(v.type="text"),v.invalid=!0)});let y=i[i.length-1],D=y.nodes.indexOf(a);y.nodes.splice(D,1,...a.nodes)}while(i.length>0);return m({type:"eos"}),o};TO.exports=u9});var LO=x((yX,NO)=>{"use strict";var BO=hf(),c9=SO(),l9=OO(),f9=RO(),ir=(t,e={})=>{let r=[];if(Array.isArray(t))for(let n of t){let o=ir.create(n,e);Array.isArray(o)?r.push(...o):r.push(o)}else r=[].concat(ir.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(r=[...new Set(r)]),r};ir.parse=(t,e={})=>f9(t,e);ir.stringify=(t,e={})=>BO(typeof t=="string"?ir.parse(t,e):t,e);ir.compile=(t,e={})=>(typeof t=="string"&&(t=ir.parse(t,e)),c9(t,e));ir.expand=(t,e={})=>{typeof t=="string"&&(t=ir.parse(t,e));let r=l9(t,e);return e.noempty===!0&&(r=r.filter(Boolean)),e.nodupes===!0&&(r=[...new Set(r)]),r};ir.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?ir.compile(t,e):ir.expand(t,e);NO.exports=ir});var zs=x((DX,HO)=>{"use strict";var d9=require("path"),Kr="\\\\/",jO=`[^${Kr}]`,Dn="\\.",p9="\\+",h9="\\?",yf="\\/",m9="(?=.)",UO="[^/]",ny=`(?:${yf}|$)`,MO=`(?:^|${yf})`,oy=`${Dn}{1,2}${ny}`,g9=`(?!${Dn})`,y9=`(?!${MO}${oy})`,D9=`(?!${Dn}{0,1}${ny})`,b9=`(?!${oy})`,w9=`[^.${yf}]`,v9=`${UO}*?`,qO={DOT_LITERAL:Dn,PLUS_LITERAL:p9,QMARK_LITERAL:h9,SLASH_LITERAL:yf,ONE_CHAR:m9,QMARK:UO,END_ANCHOR:ny,DOTS_SLASH:oy,NO_DOT:g9,NO_DOTS:y9,NO_DOT_SLASH:D9,NO_DOTS_SLASH:b9,QMARK_NO_DOT:w9,STAR:v9,START_ANCHOR:MO},C9={...qO,SLASH_LITERAL:`[${Kr}]`,QMARK:jO,STAR:`${jO}*?`,DOTS_SLASH:`${Dn}{1,2}(?:[${Kr}]|$)`,NO_DOT:`(?!${Dn})`,NO_DOTS:`(?!(?:^|[${Kr}])${Dn}{1,2}(?:[${Kr}]|$))`,NO_DOT_SLASH:`(?!${Dn}{0,1}(?:[${Kr}]|$))`,NO_DOTS_SLASH:`(?!${Dn}{1,2}(?:[${Kr}]|$))`,QMARK_NO_DOT:`[^.${Kr}]`,START_ANCHOR:`(?:^|[${Kr}])`,END_ANCHOR:`(?:[${Kr}]|$)`},E9={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"};HO.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:E9,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:d9.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?C9:qO}}});var Ks=x(Jt=>{"use strict";var _9=require("path"),S9=process.platform==="win32",{REGEX_BACKSLASH:x9,REGEX_REMOVE_BACKSLASH:A9,REGEX_SPECIAL_CHARS:O9,REGEX_SPECIAL_CHARS_GLOBAL:F9}=zs();Jt.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Jt.hasRegexChars=t=>O9.test(t);Jt.isRegexChar=t=>t.length===1&&Jt.hasRegexChars(t);Jt.escapeRegex=t=>t.replace(F9,"\\$1");Jt.toPosixSlashes=t=>t.replace(x9,"/");Jt.removeBackslashes=t=>t.replace(A9,e=>e==="\\"?"":e);Jt.supportsLookbehinds=()=>{let t=process.version.slice(1).split(".").map(Number);return t.length===3&&t[0]>=9||t[0]===8&&t[1]>=10};Jt.isWindows=t=>t&&typeof t.windows=="boolean"?t.windows:S9===!0||_9.sep==="\\";Jt.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Jt.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Jt.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Jt.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",o=r.contains?"":"$",i=`${n}(?:${t})${o}`;return e.negated===!0&&(i=`(?:^(?!${i}).*$)`),i}});var XO=x((wX,JO)=>{"use strict";var VO=Ks(),{CHAR_ASTERISK:iy,CHAR_AT:k9,CHAR_BACKWARD_SLASH:Gs,CHAR_COMMA:P9,CHAR_DOT:ay,CHAR_EXCLAMATION_MARK:sy,CHAR_FORWARD_SLASH:YO,CHAR_LEFT_CURLY_BRACE:uy,CHAR_LEFT_PARENTHESES:cy,CHAR_LEFT_SQUARE_BRACKET:$9,CHAR_PLUS:I9,CHAR_QUESTION_MARK:zO,CHAR_RIGHT_CURLY_BRACE:T9,CHAR_RIGHT_PARENTHESES:KO,CHAR_RIGHT_SQUARE_BRACKET:R9}=zs(),GO=t=>t===YO||t===Gs,WO=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},B9=(t,e)=>{let r=e||{},n=t.length-1,o=r.parts===!0||r.scanToEnd===!0,i=[],a=[],s=[],u=t,c=-1,f=0,d=0,p=!1,h=!1,m=!1,y=!1,D=!1,v=!1,E=!1,g=!1,_=!1,S=!1,P=0,F,B,T={value:"",depth:0,isGlob:!1},j=()=>c>=n,A=()=>u.charCodeAt(c+1),M=()=>(F=B,u.charCodeAt(++c));for(;c<n;){B=M();let w;if(B===Gs){E=T.backslashes=!0,B=M(),B===uy&&(v=!0);continue}if(v===!0||B===uy){for(P++;j()!==!0&&(B=M());){if(B===Gs){E=T.backslashes=!0,M();continue}if(B===uy){P++;continue}if(v!==!0&&B===ay&&(B=M())===ay){if(p=T.isBrace=!0,m=T.isGlob=!0,S=!0,o===!0)continue;break}if(v!==!0&&B===P9){if(p=T.isBrace=!0,m=T.isGlob=!0,S=!0,o===!0)continue;break}if(B===T9&&(P--,P===0)){v=!1,p=T.isBrace=!0,S=!0;break}}if(o===!0)continue;break}if(B===YO){if(i.push(c),a.push(T),T={value:"",depth:0,isGlob:!1},S===!0)continue;if(F===ay&&c===f+1){f+=2;continue}d=c+1;continue}if(r.noext!==!0&&(B===I9||B===k9||B===iy||B===zO||B===sy)===!0&&A()===cy){if(m=T.isGlob=!0,y=T.isExtglob=!0,S=!0,B===sy&&c===f&&(_=!0),o===!0){for(;j()!==!0&&(B=M());){if(B===Gs){E=T.backslashes=!0,B=M();continue}if(B===KO){m=T.isGlob=!0,S=!0;break}}continue}break}if(B===iy){if(F===iy&&(D=T.isGlobstar=!0),m=T.isGlob=!0,S=!0,o===!0)continue;break}if(B===zO){if(m=T.isGlob=!0,S=!0,o===!0)continue;break}if(B===$9){for(;j()!==!0&&(w=M());){if(w===Gs){E=T.backslashes=!0,M();continue}if(w===R9){h=T.isBracket=!0,m=T.isGlob=!0,S=!0;break}}if(o===!0)continue;break}if(r.nonegate!==!0&&B===sy&&c===f){g=T.negated=!0,f++;continue}if(r.noparen!==!0&&B===cy){if(m=T.isGlob=!0,o===!0){for(;j()!==!0&&(B=M());){if(B===cy){E=T.backslashes=!0,B=M();continue}if(B===KO){S=!0;break}}continue}break}if(m===!0){if(S=!0,o===!0)continue;break}}r.noext===!0&&(y=!1,m=!1);let L=u,X="",k="";f>0&&(X=u.slice(0,f),u=u.slice(f),d-=f),L&&m===!0&&d>0?(L=u.slice(0,d),k=u.slice(d)):m===!0?(L="",k=u):L=u,L&&L!==""&&L!=="/"&&L!==u&&GO(L.charCodeAt(L.length-1))&&(L=L.slice(0,-1)),r.unescape===!0&&(k&&(k=VO.removeBackslashes(k)),L&&E===!0&&(L=VO.removeBackslashes(L)));let b={prefix:X,input:t,start:f,base:L,glob:k,isBrace:p,isBracket:h,isGlob:m,isExtglob:y,isGlobstar:D,negated:g,negatedExtglob:_};if(r.tokens===!0&&(b.maxDepth=0,GO(B)||a.push(T),b.tokens=a),r.parts===!0||r.tokens===!0){let w;for(let C=0;C<i.length;C++){let O=w?w+1:f,R=i[C],$=t.slice(O,R);r.tokens&&(C===0&&f!==0?(a[C].isPrefix=!0,a[C].value=X):a[C].value=$,WO(a[C]),b.maxDepth+=a[C].depth),(C!==0||$!=="")&&s.push($),w=R}if(w&&w+1<t.length){let C=t.slice(w+1);s.push(C),r.tokens&&(a[a.length-1].value=C,WO(a[a.length-1]),b.maxDepth+=a[a.length-1].depth)}b.slashes=i,b.parts=s}return b};JO.exports=B9});var eF=x((vX,QO)=>{"use strict";var Df=zs(),ar=Ks(),{MAX_LENGTH:bf,POSIX_REGEX_SOURCE:N9,REGEX_NON_SPECIAL_CHARS:L9,REGEX_SPECIAL_CHARS_BACKREF:j9,REPLACEMENTS:ZO}=Df,U9=(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=>ar.escapeRegex(o)).join("..")}return r},ya=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,ly=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=ZO[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(bf,r.maxLength):bf,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=ar.isWindows(e),c=Df.globChars(u),f=Df.extglobChars(c),{DOT_LITERAL:d,PLUS_LITERAL:p,SLASH_LITERAL:h,ONE_CHAR:m,DOTS_SLASH:y,NO_DOT:D,NO_DOT_SLASH:v,NO_DOTS_SLASH:E,QMARK:g,QMARK_NO_DOT:_,STAR:S,START_ANCHOR:P}=c,F=z=>`(${s}(?:(?!${P}${z.dot?y:d}).)*?)`,B=r.dot?"":D,T=r.dot?g:_,j=r.bash===!0?F(r):S;r.capture&&(j=`(${j})`),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=ar.removePrefix(t,A),o=t.length;let M=[],L=[],X=[],k=i,b,w=()=>A.index===o-1,C=A.peek=(z=1)=>t[A.index+z],O=A.advance=()=>t[++A.index]||"",R=()=>t.slice(A.index+1),$=(z="",Se=0)=>{A.consumed+=z,A.index+=Se},H=z=>{A.output+=z.output!=null?z.output:z.value,$(z.value)},I=()=>{let z=1;for(;C()==="!"&&(C(2)!=="("||C(3)==="?");)O(),A.start++,z++;return z%2===0?!1:(A.negated=!0,A.start++,!0)},N=z=>{A[z]++,X.push(z)},Z=z=>{A[z]--,X.pop()},U=z=>{if(k.type==="globstar"){let Se=A.braces>0&&(z.type==="comma"||z.type==="brace"),V=z.extglob===!0||M.length&&(z.type==="pipe"||z.type==="paren");z.type!=="slash"&&z.type!=="paren"&&!Se&&!V&&(A.output=A.output.slice(0,-k.output.length),k.type="star",k.value="*",k.output=j,A.output+=k.output)}if(M.length&&z.type!=="paren"&&(M[M.length-1].inner+=z.value),(z.value||z.output)&&H(z),k&&k.type==="text"&&z.type==="text"){k.value+=z.value,k.output=(k.output||"")+z.value;return}z.prev=k,a.push(z),k=z},oe=(z,Se)=>{let V={...f[Se],conditions:1,inner:""};V.prev=k,V.parens=A.parens,V.output=A.output;let de=(r.capture?"(":"")+V.open;N("parens"),U({type:z,value:Se,output:A.output?"":m}),U({type:"paren",extglob:!0,value:O(),output:de}),M.push(V)},Xt=z=>{let Se=z.close+(r.capture?")":""),V;if(z.type==="negate"){let de=j;if(z.inner&&z.inner.length>1&&z.inner.includes("/")&&(de=F(r)),(de!==j||w()||/^\)+$/.test(R()))&&(Se=z.close=`)$))${de}`),z.inner.includes("*")&&(V=R())&&/^\.[^\\/.]+$/.test(V)){let qe=ly(V,{...e,fastpaths:!1}).output;Se=z.close=`)${qe})${de})`}z.prev.type==="bos"&&(A.negatedExtglob=!0)}U({type:"paren",extglob:!0,value:b,output:Se}),Z("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let z=!1,Se=t.replace(j9,(V,de,qe,At,nt,kf)=>At==="\\"?(z=!0,V):At==="?"?de?de+At+(nt?g.repeat(nt.length):""):kf===0?T+(nt?g.repeat(nt.length):""):g.repeat(qe.length):At==="."?d.repeat(qe.length):At==="*"?de?de+At+(nt?j:""):j:de?V:`\\${V}`);return z===!0&&(r.unescape===!0?Se=Se.replace(/\\/g,""):Se=Se.replace(/\\+/g,V=>V.length%2===0?"\\\\":V?"\\":"")),Se===t&&r.contains===!0?(A.output=t,A):(A.output=ar.wrapOutput(Se,A,e),A)}for(;!w();){if(b=O(),b==="\0")continue;if(b==="\\"){let V=C();if(V==="/"&&r.bash!==!0||V==="."||V===";")continue;if(!V){b+="\\",U({type:"text",value:b});continue}let de=/^\\+/.exec(R()),qe=0;if(de&&de[0].length>2&&(qe=de[0].length,A.index+=qe,qe%2!==0&&(b+="\\")),r.unescape===!0?b=O():b+=O(),A.brackets===0){U({type:"text",value:b});continue}}if(A.brackets>0&&(b!=="]"||k.value==="["||k.value==="[^")){if(r.posix!==!1&&b===":"){let V=k.value.slice(1);if(V.includes("[")&&(k.posix=!0,V.includes(":"))){let de=k.value.lastIndexOf("["),qe=k.value.slice(0,de),At=k.value.slice(de+2),nt=N9[At];if(nt){k.value=qe+nt,A.backtrack=!0,O(),!i.output&&a.indexOf(k)===1&&(i.output=m);continue}}}(b==="["&&C()!==":"||b==="-"&&C()==="]")&&(b=`\\${b}`),b==="]"&&(k.value==="["||k.value==="[^")&&(b=`\\${b}`),r.posix===!0&&b==="!"&&k.value==="["&&(b="^"),k.value+=b,H({value:b});continue}if(A.quotes===1&&b!=='"'){b=ar.escapeRegex(b),k.value+=b,H({value:b});continue}if(b==='"'){A.quotes=A.quotes===1?0:1,r.keepQuotes===!0&&U({type:"text",value:b});continue}if(b==="("){N("parens"),U({type:"paren",value:b});continue}if(b===")"){if(A.parens===0&&r.strictBrackets===!0)throw new SyntaxError(ya("opening","("));let V=M[M.length-1];if(V&&A.parens===V.parens+1){Xt(M.pop());continue}U({type:"paren",value:b,output:A.parens?")":"\\)"}),Z("parens");continue}if(b==="["){if(r.nobracket===!0||!R().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(ya("closing","]"));b=`\\${b}`}else N("brackets");U({type:"bracket",value:b});continue}if(b==="]"){if(r.nobracket===!0||k&&k.type==="bracket"&&k.value.length===1){U({type:"text",value:b,output:`\\${b}`});continue}if(A.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(ya("opening","["));U({type:"text",value:b,output:`\\${b}`});continue}Z("brackets");let V=k.value.slice(1);if(k.posix!==!0&&V[0]==="^"&&!V.includes("/")&&(b=`/${b}`),k.value+=b,H({value:b}),r.literalBrackets===!1||ar.hasRegexChars(V))continue;let de=ar.escapeRegex(k.value);if(A.output=A.output.slice(0,-k.value.length),r.literalBrackets===!0){A.output+=de,k.value=de;continue}k.value=`(${s}${de}|${k.value})`,A.output+=k.value;continue}if(b==="{"&&r.nobrace!==!0){N("braces");let V={type:"brace",value:b,output:"(",outputIndex:A.output.length,tokensIndex:A.tokens.length};L.push(V),U(V);continue}if(b==="}"){let V=L[L.length-1];if(r.nobrace===!0||!V){U({type:"text",value:b,output:b});continue}let de=")";if(V.dots===!0){let qe=a.slice(),At=[];for(let nt=qe.length-1;nt>=0&&(a.pop(),qe[nt].type!=="brace");nt--)qe[nt].type!=="dots"&&At.unshift(qe[nt].value);de=U9(At,r),A.backtrack=!0}if(V.comma!==!0&&V.dots!==!0){let qe=A.output.slice(0,V.outputIndex),At=A.tokens.slice(V.tokensIndex);V.value=V.output="\\{",b=de="\\}",A.output=qe;for(let nt of At)A.output+=nt.output||nt.value}U({type:"brace",value:b,output:de}),Z("braces"),L.pop();continue}if(b==="|"){M.length>0&&M[M.length-1].conditions++,U({type:"text",value:b});continue}if(b===","){let V=b,de=L[L.length-1];de&&X[X.length-1]==="braces"&&(de.comma=!0,V="|"),U({type:"comma",value:b,output:V});continue}if(b==="/"){if(k.type==="dot"&&A.index===A.start+1){A.start=A.index+1,A.consumed="",A.output="",a.pop(),k=i;continue}U({type:"slash",value:b,output:h});continue}if(b==="."){if(A.braces>0&&k.type==="dot"){k.value==="."&&(k.output=d);let V=L[L.length-1];k.type="dots",k.output+=b,k.value+=b,V.dots=!0;continue}if(A.braces+A.parens===0&&k.type!=="bos"&&k.type!=="slash"){U({type:"text",value:b,output:d});continue}U({type:"dot",value:b,output:d});continue}if(b==="?"){if(!(k&&k.value==="(")&&r.noextglob!==!0&&C()==="("&&C(2)!=="?"){oe("qmark",b);continue}if(k&&k.type==="paren"){let de=C(),qe=b;if(de==="<"&&!ar.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(k.value==="("&&!/[!=<:]/.test(de)||de==="<"&&!/<([!=]|\w+>)/.test(R()))&&(qe=`\\${b}`),U({type:"text",value:b,output:qe});continue}if(r.dot!==!0&&(k.type==="slash"||k.type==="bos")){U({type:"qmark",value:b,output:_});continue}U({type:"qmark",value:b,output:g});continue}if(b==="!"){if(r.noextglob!==!0&&C()==="("&&(C(2)!=="?"||!/[!=<:]/.test(C(3)))){oe("negate",b);continue}if(r.nonegate!==!0&&A.index===0){I();continue}}if(b==="+"){if(r.noextglob!==!0&&C()==="("&&C(2)!=="?"){oe("plus",b);continue}if(k&&k.value==="("||r.regex===!1){U({type:"plus",value:b,output:p});continue}if(k&&(k.type==="bracket"||k.type==="paren"||k.type==="brace")||A.parens>0){U({type:"plus",value:b});continue}U({type:"plus",value:p});continue}if(b==="@"){if(r.noextglob!==!0&&C()==="("&&C(2)!=="?"){U({type:"at",extglob:!0,value:b,output:""});continue}U({type:"text",value:b});continue}if(b!=="*"){(b==="$"||b==="^")&&(b=`\\${b}`);let V=L9.exec(R());V&&(b+=V[0],A.index+=V[0].length),U({type:"text",value:b});continue}if(k&&(k.type==="globstar"||k.star===!0)){k.type="star",k.star=!0,k.value+=b,k.output=j,A.backtrack=!0,A.globstar=!0,$(b);continue}let z=R();if(r.noextglob!==!0&&/^\([^?]/.test(z)){oe("star",b);continue}if(k.type==="star"){if(r.noglobstar===!0){$(b);continue}let V=k.prev,de=V.prev,qe=V.type==="slash"||V.type==="bos",At=de&&(de.type==="star"||de.type==="globstar");if(r.bash===!0&&(!qe||z[0]&&z[0]!=="/")){U({type:"star",value:b,output:""});continue}let nt=A.braces>0&&(V.type==="comma"||V.type==="brace"),kf=M.length&&(V.type==="pipe"||V.type==="paren");if(!qe&&V.type!=="paren"&&!nt&&!kf){U({type:"star",value:b,output:""});continue}for(;z.slice(0,3)==="/**";){let Qs=t[A.index+4];if(Qs&&Qs!=="/")break;z=z.slice(3),$("/**",3)}if(V.type==="bos"&&w()){k.type="globstar",k.value+=b,k.output=F(r),A.output=k.output,A.globstar=!0,$(b);continue}if(V.type==="slash"&&V.prev.type!=="bos"&&!At&&w()){A.output=A.output.slice(0,-(V.output+k.output).length),V.output=`(?:${V.output}`,k.type="globstar",k.output=F(r)+(r.strictSlashes?")":"|$)"),k.value+=b,A.globstar=!0,A.output+=V.output+k.output,$(b);continue}if(V.type==="slash"&&V.prev.type!=="bos"&&z[0]==="/"){let Qs=z[1]!==void 0?"|$":"";A.output=A.output.slice(0,-(V.output+k.output).length),V.output=`(?:${V.output}`,k.type="globstar",k.output=`${F(r)}${h}|${h}${Qs})`,k.value+=b,A.output+=V.output+k.output,A.globstar=!0,$(b+O()),U({type:"slash",value:"/",output:""});continue}if(V.type==="bos"&&z[0]==="/"){k.type="globstar",k.value+=b,k.output=`(?:^|${h}|${F(r)}${h})`,A.output=k.output,A.globstar=!0,$(b+O()),U({type:"slash",value:"/",output:""});continue}A.output=A.output.slice(0,-k.output.length),k.type="globstar",k.output=F(r),k.value+=b,A.output+=k.output,A.globstar=!0,$(b);continue}let Se={type:"star",value:b,output:j};if(r.bash===!0){Se.output=".*?",(k.type==="bos"||k.type==="slash")&&(Se.output=B+Se.output),U(Se);continue}if(k&&(k.type==="bracket"||k.type==="paren")&&r.regex===!0){Se.output=b,U(Se);continue}(A.index===A.start||k.type==="slash"||k.type==="dot")&&(k.type==="dot"?(A.output+=v,k.output+=v):r.dot===!0?(A.output+=E,k.output+=E):(A.output+=B,k.output+=B),C()!=="*"&&(A.output+=m,k.output+=m)),U(Se)}for(;A.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(ya("closing","]"));A.output=ar.escapeLast(A.output,"["),Z("brackets")}for(;A.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(ya("closing",")"));A.output=ar.escapeLast(A.output,"("),Z("parens")}for(;A.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(ya("closing","}"));A.output=ar.escapeLast(A.output,"{"),Z("braces")}if(r.strictSlashes!==!0&&(k.type==="star"||k.type==="bracket")&&U({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};ly.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(bf,r.maxLength):bf,o=t.length;if(o>n)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${n}`);t=ZO[t]||t;let i=ar.isWindows(e),{DOT_LITERAL:a,SLASH_LITERAL:s,ONE_CHAR:u,DOTS_SLASH:c,NO_DOT:f,NO_DOTS:d,NO_DOTS_SLASH:p,STAR:h,START_ANCHOR:m}=Df.globChars(i),y=r.dot?d:f,D=r.dot?p:f,v=r.capture?"":"?:",E={negated:!1,prefix:""},g=r.bash===!0?".*?":h;r.capture&&(g=`(${g})`);let _=B=>B.noglobstar===!0?g:`(${v}(?:(?!${m}${B.dot?c:a}).)*?)`,S=B=>{switch(B){case"*":return`${y}${u}${g}`;case".*":return`${a}${u}${g}`;case"*.*":return`${y}${g}${a}${u}${g}`;case"*/*":return`${y}${g}${s}${u}${D}${g}`;case"**":return y+_(r);case"**/*":return`(?:${y}${_(r)}${s})?${D}${u}${g}`;case"**/*.*":return`(?:${y}${_(r)}${s})?${D}${g}${a}${u}${g}`;case"**/.*":return`(?:${y}${_(r)}${s})?${a}${u}${g}`;default:{let T=/^(.*?)\.(\w+)$/.exec(B);if(!T)return;let j=S(T[1]);return j?j+a+T[2]:void 0}}},P=ar.removePrefix(t,E),F=S(P);return F&&r.strictSlashes!==!0&&(F+=`${s}?`),F};QO.exports=ly});var rF=x((CX,tF)=>{"use strict";var M9=require("path"),q9=XO(),fy=eF(),dy=Ks(),H9=zs(),V9=t=>t&&typeof t=="object"&&!Array.isArray(t),tt=(t,e,r=!1)=>{if(Array.isArray(t)){let f=t.map(p=>tt(p,e,r));return p=>{for(let h of f){let m=h(p);if(m)return m}return!1}}let n=V9(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=dy.isWindows(e),a=n?tt.compileRe(t,e):tt.makeRe(t,e,!1,!0),s=a.state;delete a.state;let u=()=>!1;if(o.ignore){let f={...e,ignore:null,onMatch:null,onResult:null};u=tt(o.ignore,f,r)}let c=(f,d=!1)=>{let{isMatch:p,match:h,output:m}=tt.test(f,a,e,{glob:t,posix:i}),y={glob:t,state:s,regex:a,posix:i,input:f,output:m,match:h,isMatch:p};return typeof o.onResult=="function"&&o.onResult(y),p===!1?(y.isMatch=!1,d?y:!1):u(f)?(typeof o.onIgnore=="function"&&o.onIgnore(y),y.isMatch=!1,d?y:!1):(typeof o.onMatch=="function"&&o.onMatch(y),d?y:!0)};return r&&(c.state=s),c};tt.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?dy.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=tt.matchBase(t,e,r,o):s=e.exec(u)),{isMatch:!!s,match:s,output:u}};tt.matchBase=(t,e,r,n=dy.isWindows(r))=>(e instanceof RegExp?e:tt.makeRe(e,r)).test(M9.basename(t));tt.isMatch=(t,e,r)=>tt(e,r)(t);tt.parse=(t,e)=>Array.isArray(t)?t.map(r=>tt.parse(r,e)):fy(t,{...e,fastpaths:!1});tt.scan=(t,e)=>q9(t,e);tt.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=tt.toRegex(s,e);return n===!0&&(u.state=t),u};tt.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=fy.fastpaths(t,e)),o.output||(o=fy(t,e)),tt.compileRe(o,e,r,n)};tt.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/$^/}};tt.constants=H9;tF.exports=tt});var oF=x((EX,nF)=>{"use strict";nF.exports=rF()});var lF=x((_X,cF)=>{"use strict";var aF=require("util"),sF=LO(),Gr=oF(),py=Ks(),iF=t=>t===""||t==="./",uF=t=>{let e=t.indexOf("{");return e>-1&&t.indexOf("}",e)>-1},Le=(t,e,r)=>{e=[].concat(e),t=[].concat(t);let n=new Set,o=new Set,i=new Set,a=0,s=f=>{i.add(f.output),r&&r.onResult&&r.onResult(f)};for(let f=0;f<e.length;f++){let d=Gr(String(e[f]),{...r,onResult:s},!0),p=d.state.negated||d.state.negatedExtglob;p&&a++;for(let h of t){let m=d(h,!0);(p?!m.isMatch:m.isMatch)&&(p?n.add(m.output):(n.delete(m.output),o.add(m.output)))}}let c=(a===e.length?[...i]:[...o]).filter(f=>!n.has(f));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(f=>f.replace(/\\/g,"")):e}return c};Le.match=Le;Le.matcher=(t,e)=>Gr(t,e);Le.isMatch=(t,e,r)=>Gr(e,r)(t);Le.any=Le.isMatch;Le.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(Le(t,e,{...r,onResult:i}));for(let s of o)a.has(s)||n.add(s);return[...n]};Le.contains=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${aF.inspect(t)}"`);if(Array.isArray(e))return e.some(n=>Le.contains(t,n,r));if(typeof e=="string"){if(iF(t)||iF(e))return!1;if(t.includes(e)||t.startsWith("./")&&t.slice(2).includes(e))return!0}return Le.isMatch(t,e,{...r,contains:!0})};Le.matchKeys=(t,e,r)=>{if(!py.isObject(t))throw new TypeError("Expected the first argument to be an object");let n=Le(Object.keys(t),e,r),o={};for(let i of n)o[i]=t[i];return o};Le.some=(t,e,r)=>{let n=[].concat(t);for(let o of[].concat(e)){let i=Gr(String(o),r);if(n.some(a=>i(a)))return!0}return!1};Le.every=(t,e,r)=>{let n=[].concat(t);for(let o of[].concat(e)){let i=Gr(String(o),r);if(!n.every(a=>i(a)))return!1}return!0};Le.all=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${aF.inspect(t)}"`);return[].concat(e).every(n=>Gr(n,r)(t))};Le.capture=(t,e,r)=>{let n=py.isWindows(r),i=Gr.makeRe(String(t),{...r,capture:!0}).exec(n?py.toPosixSlashes(e):e);if(i)return i.slice(1).map(a=>a===void 0?"":a)};Le.makeRe=(...t)=>Gr.makeRe(...t);Le.scan=(...t)=>Gr.scan(...t);Le.parse=(t,e)=>{let r=[];for(let n of[].concat(t||[]))for(let o of sF(String(n),e))r.push(Gr.parse(o,e));return r};Le.braces=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return e&&e.nobrace===!0||!uF(t)?[t]:sF(t,e)};Le.braceExpand=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return Le.braces(t,{...e,expand:!0})};Le.hasBraces=uF;cF.exports=Le});var WF=x((_Z,bn)=>{var Ie=require("fs"),xf=require("os"),bt=require("path"),PF=require("crypto"),Yr={fs:Ie.constants,os:xf.constants},$F="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",BF=/XXXXXX/,y7=3,NF=(Yr.O_CREAT||Yr.fs.O_CREAT)|(Yr.O_EXCL||Yr.fs.O_EXCL)|(Yr.O_RDWR||Yr.fs.O_RDWR),D7=xf.platform()==="win32",b7=Yr.EBADF||Yr.os.errno.EBADF,w7=Yr.ENOENT||Yr.os.errno.ENOENT,LF=448,jF=384,v7="exit",ba=[],UF=Ie.rmdirSync.bind(Ie),MF=!1;function C7(t,e){return Ie.rm(t,{recursive:!0},e)}function qF(t){return Ie.rmSync(t,{recursive:!0})}function Dy(t,e){let r=wa(t,e),n=r[0],o=r[1];$7(n,function(i,a){if(i)return o(i);let s=a.tries;(function u(){try{let c=VF(a);Ie.stat(c,function(f){if(!f)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 by(t){let e=wa(t),r=e[0],n=I7(r),o=n.tries;do{let i=VF(n);try{Ie.statSync(i)}catch{return i}}while(o-- >0);throw new Error("Could not get a unique tmp filename, max tries reached")}function E7(t,e){let r=wa(t,e),n=r[0],o=r[1];Dy(n,function(a,s){if(a)return o(a);Ie.open(s,NF,n.mode||jF,function(c,f){if(c)return o(c);if(n.discardDescriptor)return Ie.close(f,function(p){return o(p,s,void 0,gy(s,-1,n,!1))});{let d=n.discardDescriptor||n.detachDescriptor;o(null,s,f,gy(s,d?-1:f,n,!1))}})})}function _7(t){let e=wa(t),r=e[0],n=r.discardDescriptor||r.detachDescriptor,o=by(r),i=Ie.openSync(o,NF,r.mode||jF);return r.discardDescriptor&&(Ie.closeSync(i),i=void 0),{name:o,fd:i,removeCallback:gy(o,n?-1:i,r,!0)}}function S7(t,e){let r=wa(t,e),n=r[0],o=r[1];Dy(n,function(a,s){if(a)return o(a);Ie.mkdir(s,n.mode||LF,function(c){if(c)return o(c);o(null,s,HF(s,n,!1))})})}function x7(t){let e=wa(t),r=e[0],n=by(r);return Ie.mkdirSync(n,r.mode||LF),{name:n,removeCallback:HF(n,r,!0)}}function A7(t,e){let r=function(n){if(n&&!yy(n))return e(n);e()};0<=t[0]?Ie.close(t[0],function(){Ie.unlink(t[1],r)}):Ie.unlink(t[1],r)}function O7(t){let e=null;try{0<=t[0]&&Ie.closeSync(t[0])}catch(r){if(!T7(r)&&!yy(r))throw r}finally{try{Ie.unlinkSync(t[1])}catch(r){yy(r)||(e=r)}}if(e!==null)throw e}function gy(t,e,r,n){let o=Sf(O7,[e,t],n),i=Sf(A7,[e,t],n,o);return r.keep||ba.unshift(o),n?o:i}function HF(t,e,r){let n=e.unsafeCleanup?C7:Ie.rmdir.bind(Ie),o=e.unsafeCleanup?qF:UF,i=Sf(o,t,r),a=Sf(n,t,r,i);return e.keep||ba.unshift(i),r?i:a}function Sf(t,e,r,n){let o=!1;return function i(a){if(!o){let s=n||i,u=ba.indexOf(s);return u>=0&&ba.splice(u,1),o=!0,r||t===UF||t===qF?t(e):t(e,a||function(){})}}}function F7(){if(MF)for(;ba.length;)try{ba[0]()}catch{}}function IF(t){let e=[],r=null;try{r=PF.randomBytes(t)}catch{r=PF.pseudoRandomBytes(t)}for(let n=0;n<t;n++)e.push($F[r[n]%$F.length]);return e.join("")}function sr(t){return typeof t>"u"}function wa(t,e){if(typeof t=="function")return[{},t];if(sr(t))return[{},e];let r={};for(let n of Object.getOwnPropertyNames(t))r[n]=t[n];return[r,e]}function k7(t,e,r){let n=bt.isAbsolute(t)?t:bt.join(e,t);Ie.stat(n,function(o){o?Ie.realpath(bt.dirname(n),function(i,a){if(i)return r(i);r(null,bt.join(a,bt.basename(n)))}):Ie.realpath(n,r)})}function P7(t,e){let r=bt.isAbsolute(t)?t:bt.join(e,t);try{return Ie.statSync(r),Ie.realpathSync(r)}catch{let o=Ie.realpathSync(bt.dirname(r));return bt.join(o,bt.basename(r))}}function VF(t){let e=t.tmpdir;if(!sr(t.name))return bt.join(e,t.dir,t.name);if(!sr(t.template))return bt.join(e,t.dir,t.template).replace(BF,IF(6));let r=[t.prefix?t.prefix:"tmp","-",process.pid,"-",IF(12),t.postfix?"-"+t.postfix:""].join("");return bt.join(e,t.dir,r)}function zF(t){if(!sr(t.name)){let e=t.name;if(bt.isAbsolute(e))throw new Error(`name option must not contain an absolute path, found "${e}".`);let r=bt.basename(e);if(r===".."||r==="."||r!==e)throw new Error(`name option must not contain a path, found "${e}".`)}if(!sr(t.template)&&!t.template.match(BF))throw new Error(`Invalid template, found "${t.template}".`);if(!sr(t.tries)&&isNaN(t.tries)||t.tries<0)throw new Error(`Invalid tries, found "${t.tries}".`);t.tries=sr(t.name)?t.tries||y7:1,t.keep=!!t.keep,t.detachDescriptor=!!t.detachDescriptor,t.discardDescriptor=!!t.discardDescriptor,t.unsafeCleanup=!!t.unsafeCleanup,t.prefix=sr(t.prefix)?"":t.prefix,t.postfix=sr(t.postfix)?"":t.postfix}function TF(t,e,r,n){if(sr(e))return n(null);k7(e,r,function(o,i){if(o)return n(o);let a=bt.relative(r,i);if(!i.startsWith(r))return n(new Error(`${t} option must be relative to "${r}", found "${a}".`));n(null,a)})}function RF(t,e,r){if(sr(e))return;let n=P7(e,r),o=bt.relative(r,n);if(!n.startsWith(r))throw new Error(`${t} option must be relative to "${r}", found "${o}".`);return o}function $7(t,e){B7(t,function(r,n){if(r)return e(r);t.tmpdir=n;try{zF(t,n)}catch(o){return e(o)}TF("dir",t.dir,n,function(o,i){if(o)return e(o);t.dir=sr(i)?"":i,TF("template",t.template,n,function(a,s){if(a)return e(a);t.template=s,e(null,t)})})})}function I7(t){let e=t.tmpdir=GF(t);zF(t,e);let r=RF("dir",t.dir,e);return t.dir=sr(r)?"":r,t.template=RF("template",t.template,e),t}function T7(t){return KF(t,-b7,"EBADF")}function yy(t){return KF(t,-w7,"ENOENT")}function KF(t,e,r){return D7?t.code===r:t.code===r&&t.errno===e}function R7(){MF=!0}function B7(t,e){return Ie.realpath(t&&t.tmpdir||xf.tmpdir(),e)}function GF(t){return Ie.realpathSync(t&&t.tmpdir||xf.tmpdir())}process.addListener(v7,F7);Object.defineProperty(bn.exports,"tmpdir",{enumerable:!0,configurable:!1,get:function(){return GF()}});bn.exports.dir=S7;bn.exports.dirSync=x7;bn.exports.file=E7;bn.exports.fileSync=_7;bn.exports.tmpName=Dy;bn.exports.tmpNameSync=by;bn.exports.setGracefulCleanup=R7});var Of=require("node:process");var Vy=fe(Hy(),1),{program:it,createCommand:wq,createArgument:vq,createOption:Cq,CommanderError:Eq,InvalidArgumentError:_q,InvalidOptionArgumentError:Sq,Command:xq,Argument:Aq,Option:Oq,Help:Fq}=Vy.default;var Cr={name:"@capgo/cli",version:"7.54.0",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/CLI#readme",repository:{type:"git",url:"git+https://github.com/Cap-go/CLI.git"},bugs:{url:"https://github.com/Cap-go/CLI/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli","sdk"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js",require:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && node build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"npx --yes supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsc --noEmit",lint:'eslint "src/**/*.ts" --fix',"check-posix-paths":"node test/check-posix-paths.js","generate-docs":"node dist/index.js generate-docs README.md","test:bundle":"bun test/test-bundle.mjs","test:functional":"bun test/test-functional.mjs","test:semver":"bun test/test-semver-validation.mjs","test:version-edge-cases":"bun test/test-version-validation.mjs","test:regex":"bun test/test-regex-validation.mjs","test:upload":"bun test/test-upload-validation.mjs","test:credentials":"bun test/test-credentials.mjs","test:credentials-validation":"bun test/test-credentials-validation.mjs","test:version-detection":"node test/test-get-installed-version.mjs","test:version-detection:setup":"./test/fixtures/setup-test-projects.sh",test:"bun run test:bundle && bun run test:functional && bun run test:semver && bun run test:version-edge-cases && bun run test:regex && bun run test:upload && bun run test:credentials && bun run test:credentials-validation && bun run test:version-detection"},devDependencies:{"@antfu/eslint-config":"^6.1.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.4","@capacitor/cli":"^7.4.4","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^0.11.0","@sauber/table":"npm:@jsr/sauber__table","@std/semver":"npm:@jsr/std__semver@1.0.6","@supabase/supabase-js":"^2.79.0","@types/adm-zip":"^0.5.7","@types/node":"^24.9.1","@types/prettyjson":"^0.0.33","@types/tmp":"^0.2.6","@vercel/ncc":"^0.38.4","adm-zip":"^0.5.16","ci-info":"^4.3.1",commander:"^14.0.2",esbuild:"^0.27.0",eslint:"^9.38.0","git-format-staged":"3.1.1",husky:"^9.1.7","is-wsl":"^3.1.0",open:"^11.0.0",prettyjson:"^1.2.5",tmp:"^0.2.5","tus-js-client":"^4.3.1",typescript:"^5.9.3"}};var la=require("node:fs");var wt=fe(Yf(),1),Go=require("node:process"),vn=fe(require("node:readline"),1),ed=fe(require("node:readline"),1),tD=require("node:stream"),rD=fe(Xf(),1);function P2({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 $2=P2();function nD(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace($2,"")}function oD(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var iD={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 f=u[c],d=e.length(f);if(s>=o-(d==2?1:0))if(s+d<=i)a+=f;else break;s+=d}return a}})(iD);var I2=iD.exports,T2=oD(I2),R2=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},B2=oD(R2);function _a(t,e={}){if(typeof t!="string"||t.length===0||(e={ambiguousIsNarrow:!0,...e},t=nD(t),t.length===0))return 0;t=t.replace(B2()," ");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(T2.eastAsianWidth(o)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}var Zf=10,Wy=(t=0)=>e=>`\x1B[${e+t}m`,Yy=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,Jy=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`,je={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(je.modifier);var N2=Object.keys(je.color),L2=Object.keys(je.bgColor);[...N2,...L2];function j2(){let t=new Map;for(let[e,r]of Object.entries(je)){for(let[n,o]of Object.entries(r))je[n]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},r[n]=je[n],t.set(o[0],o[1]);Object.defineProperty(je,e,{value:r,enumerable:!1})}return Object.defineProperty(je,"codes",{value:t,enumerable:!1}),je.color.close="\x1B[39m",je.bgColor.close="\x1B[49m",je.color.ansi=Wy(),je.color.ansi256=Yy(),je.color.ansi16m=Jy(),je.bgColor.ansi=Wy(Zf),je.bgColor.ansi256=Yy(Zf),je.bgColor.ansi16m=Jy(Zf),Object.defineProperties(je,{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=>je.rgbToAnsi256(...je.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)=>je.ansi256ToAnsi(je.rgbToAnsi256(e,r,n)),enumerable:!1},hexToAnsi:{value:e=>je.ansi256ToAnsi(je.hexToAnsi256(e)),enumerable:!1}}),je}var U2=j2(),fu=new Set(["\x1B","\x9B"]),M2=39,rd="\x07",aD="[",q2="]",sD="m",nd=`${q2}8;;`,Xy=t=>`${fu.values().next().value}${aD}${t}${sD}`,Zy=t=>`${fu.values().next().value}${nd}${t}${rd}`,H2=t=>t.split(" ").map(e=>_a(e)),Qf=(t,e,r)=>{let n=[...e],o=!1,i=!1,a=_a(nD(t[t.length-1]));for(let[s,u]of n.entries()){let c=_a(u);if(a+c<=r?t[t.length-1]+=u:(t.push(u),a=0),fu.has(u)&&(o=!0,i=n.slice(s+1).join("").startsWith(nd)),o){i?u===rd&&(o=!1,i=!1):u===sD&&(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())},V2=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(_a(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},z2=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",o,i,a=H2(t),s=[""];for(let[c,f]of t.split(" ").entries()){r.trim!==!1&&(s[s.length-1]=s[s.length-1].trimStart());let d=_a(s[s.length-1]);if(c!==0&&(d>=e&&(r.wordWrap===!1||r.trim===!1)&&(s.push(""),d=0),(d>0||r.trim===!1)&&(s[s.length-1]+=" ",d++)),r.hard&&a[c]>e){let p=e-d,h=1+Math.floor((a[c]-p-1)/e);Math.floor((a[c]-1)/e)<h&&s.push(""),Qf(s,f,e);continue}if(d+a[c]>e&&d>0&&a[c]>0){if(r.wordWrap===!1&&d<e){Qf(s,f,e);continue}s.push("")}if(d+a[c]>e&&r.wordWrap===!1){Qf(s,f,e);continue}s[s.length-1]+=f}r.trim!==!1&&(s=s.map(c=>V2(c)));let u=[...s.join(`
108
- `)];for(let[c,f]of u.entries()){if(n+=f,fu.has(f)){let{groups:p}=new RegExp(`(?:\\${aD}(?<code>\\d+)m|\\${nd}(?<uri>.*)${rd})`).exec(u.slice(c).join(""))||{groups:{}};if(p.code!==void 0){let h=Number.parseFloat(p.code);o=h===M2?void 0:h}else p.uri!==void 0&&(i=p.uri.length===0?void 0:p.uri)}let d=U2.codes.get(Number(o));u[c+1]===`
109
- `?(i&&(n+=Zy("")),o&&d&&(n+=Xy(d))):f===`
110
- `&&(o&&d&&(n+=Xy(o)),i&&(n+=Zy(i)))}return n};function Qy(t,e,r){return String(t).normalize().replace(/\r\n/g,`
105
+ `}});function AM(){try{return pg.default.statSync("/.dockerenv"),!0}catch{return!1}}function OM(){try{return pg.default.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function hg(){return dg===void 0&&(dg=AM()||OM()),dg}var pg,dg,Vx=Qe(()=>{pg=pe(require("node:fs"),1)});function ea(){return mg===void 0&&(mg=FM()||hg()),mg}var zx,mg,FM,gg=Qe(()=>{zx=pe(require("node:fs"),1);Vx();FM=()=>{try{return zx.default.statSync("/run/.containerenv"),!0}catch{return!1}}});var yg,Gx,Wx,Kx,hn,Dg=Qe(()=>{yg=pe(require("node:process"),1),Gx=pe(require("node:os"),1),Wx=pe(require("node:fs"),1);gg();Kx=()=>{if(yg.default.platform!=="linux")return!1;if(Gx.default.release().toLowerCase().includes("microsoft"))return!ea();try{return Wx.default.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!ea():!1}catch{return!1}},hn=yg.default.env.__IS_WSL_TEST__?Kx:Kx()});var bg,Yx,Jx,Xx,PM,wg,rr,vg=Qe(()=>{bg=pe(require("node:process"),1),Yx=require("node:buffer"),Jx=require("node:util"),Xx=pe(require("node:child_process"),1),PM=(0,Jx.promisify)(Xx.default.execFile),wg=()=>`${bg.default.env.SYSTEMROOT||bg.default.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`,rr=async(t,e={})=>{let{powerShellPath:r,...n}=e,o=rr.encodeCommand(t);return PM(r??wg(),[...rr.argumentsPrefix,o],{encoding:"utf8",...n})};rr.argumentsPrefix=["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"];rr.encodeCommand=t=>Yx.Buffer.from(t,"utf16le").toString("base64");rr.escapeArgument=t=>`'${String(t).replaceAll("'","''")}'`});var Qx,eA,Io,kM,$M,IM,Ll,Zx,tA,rA,nA,oA=Qe(()=>{Qx=require("node:util"),eA=pe(require("node:child_process"),1),Io=pe(require("node:fs/promises"),1);Dg();vg();Dg();kM=(0,Qx.promisify)(eA.default.execFile),$M=(()=>{let t="/mnt/",e;return async function(){if(e)return e;let r="/etc/wsl.conf",n=!1;try{await Io.default.access(r,Io.constants.F_OK),n=!0}catch{}if(!n)return t;let o=await Io.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}})(),IM=async()=>`${await $M()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,Ll=hn?IM:wg,tA=async()=>(Zx??=(async()=>{try{let t=await Ll();return await Io.default.access(t,Io.constants.X_OK),!0}catch{return!1}})(),Zx),rA=async()=>{let t=await Ll(),e=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,{stdout:r}=await rr(e,{powerShellPath:t});return r.trim()},nA=async t=>{if(/^[a-z]+:\/\//i.test(t))return t;try{let{stdout:e}=await kM("wslpath",["-aw",t],{encoding:"utf8"});return e.trim()}catch{return t}}});function To(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 iA=Qe(()=>{});async function Cg(){if(sA.default.platform!=="darwin")throw new Error("macOS only");let{stdout:t}=await TM("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]),r=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(t)?.groups.id??"com.apple.Safari";return r==="com.apple.safari"?"com.apple.Safari":r}var aA,sA,uA,TM,cA=Qe(()=>{aA=require("node:util"),sA=pe(require("node:process"),1),uA=require("node:child_process"),TM=(0,aA.promisify)(uA.execFile)});async function dA(t,{humanReadableOutput:e=!0,signal:r}={}){if(lA.default.platform!=="darwin")throw new Error("macOS only");let n=e?[]:["-ss"],o={};r&&(o.signal=r);let{stdout:i}=await RM("osascript",["-e",t,n],o);return i.trim()}var lA,fA,Eg,RM,pA=Qe(()=>{lA=pe(require("node:process"),1),fA=require("node:util"),Eg=require("node:child_process"),RM=(0,fA.promisify)(Eg.execFile)});async function _g(t){return dA(`tell application "Finder" to set app_path to application file id "${t}" as string
106
+ tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}var hA=Qe(()=>{pA()});async function xg(t=BM){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 jl(`Cannot find Windows browser in stdout: ${JSON.stringify(e)}`);let{id:n}=r.groups,o=yA[n];if(!o)throw new jl(`Unknown browser ID: ${n}`);return o}var mA,gA,BM,yA,Sg,jl,Ag=Qe(()=>{mA=require("node:util"),gA=require("node:child_process"),BM=(0,mA.promisify)(gA.execFile),yA={MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},MSEdgeBHTML:{name:"Edge Beta",id:"com.microsoft.edge.beta"},MSEdgeDHTML:{name:"Edge Dev",id:"com.microsoft.edge.dev"},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},ChromeBHTML:{name:"Chrome Beta",id:"com.google.chrome.beta"},ChromeDHTML:{name:"Chrome Dev",id:"com.google.chrome.dev"},ChromiumHTM:{name:"Chromium",id:"org.chromium.Chromium"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveDHTML:{name:"Brave Dev",id:"com.brave.Browser.dev"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},OperaStable:{name:"Opera",id:"com.operasoftware.Opera"},VivaldiHTM:{name:"Vivaldi",id:"com.vivaldi.Vivaldi"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"}},Sg=new Map(Object.entries(yA)),jl=class extends Error{}});async function Og(){if(Ul.default.platform==="darwin"){let t=await Cg();return{name:await _g(t),id:t}}if(Ul.default.platform==="linux"){let{stdout:t}=await NM("xdg-mime",["query","default","x-scheme-handler/http"]),e=t.trim();return{name:LM(e.replace(/.desktop$/,"").replace("-"," ")),id:e}}if(Ul.default.platform==="win32")return xg();throw new Error("Only macOS, Linux, and Windows are supported")}var DA,Ul,bA,NM,LM,wA=Qe(()=>{DA=require("node:util"),Ul=pe(require("node:process"),1),bA=require("node:child_process");cA();hA();Ag();Ag();NM=(0,DA.promisify)(bA.execFile),LM=t=>t.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase())});var Ml,jM,vA,CA=Qe(()=>{Ml=pe(require("node:process"),1),jM=!!(Ml.default.env.SSH_CONNECTION||Ml.default.env.SSH_CLIENT||Ml.default.env.SSH_TTY),vA=jM});var $g={};en($g,{apps:()=>Ro,default:()=>qM,openApp:()=>MM});function xA(t){if(typeof t=="string"||Array.isArray(t))return t;let{[_A]:e}=t;if(!e)throw new Error(`${_A} is not supported`);return e}function ks({[ta]:t},{wsl:e}={}){if(e&&hn)return xA(e);if(!t)throw new Error(`${ta} is not supported`);return xA(t)}var Pg,kg,OA,FA,Hl,AA,ql,Fg,EA,ta,_A,SA,Ps,UM,MM,Ro,qM,Ig=Qe(()=>{Pg=pe(require("node:process"),1),kg=pe(require("node:path"),1),OA=require("node:url"),FA=pe(require("node:child_process"),1),Hl=pe(require("node:fs/promises"),1);oA();vg();iA();wA();gg();CA();AA={},ql=Symbol("fallbackAttempt"),Fg=AA.url?kg.default.dirname((0,OA.fileURLToPath)(AA.url)):"",EA=kg.default.join(Fg,"xdg-open"),{platform:ta,arch:_A}=Pg.default,SA=async(t,e)=>{if(t.length===0)return;let r=[];for(let n of t)try{return await e(n)}catch(o){r.push(o)}throw new AggregateError(r,"Failed to open in all supported apps")},Ps=async t=>{t={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...t};let e=t[ql]===!0;if(delete t[ql],Array.isArray(t.app))return SA(t.app,c=>Ps({...t,app:c,[ql]:!0}));let{name:r,arguments:n=[]}=t.app??{};if(n=[...n],Array.isArray(r))return SA(r,c=>Ps({...t,app:{name:c,arguments:n},[ql]:!0}));if(r==="browser"||r==="browserPrivate"){let c={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge","com.apple.safari":"safari"},f={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},d;if(hn){let p=await rA();d=Sg.get(p)??{}}else d=await Og();if(d.id in c){let p=c[d.id.toLowerCase()];if(r==="browserPrivate"){if(p==="safari")throw new Error("Safari doesn't support opening in private mode via command line");n.push(f[p])}return Ps({...t,app:{name:Ro[p],arguments:n}})}throw new Error(`${d.name} is not supported as a default browser`)}let o,i=[],a={},s=!1;if(hn&&!ea()&&!vA&&!r&&(s=await tA()),ta==="darwin")o="open",t.wait&&i.push("--wait-apps"),t.background&&i.push("--background"),t.newInstance&&i.push("--new"),r&&i.push("-a",r);else if(ta==="win32"||s){o=await Ll(),i.push(...rr.argumentsPrefix),hn||(a.windowsVerbatimArguments=!0),hn&&t.target&&(t.target=await nA(t.target));let c=["$ProgressPreference = 'SilentlyContinue';","Start"];t.wait&&c.push("-Wait"),r?(c.push(rr.escapeArgument(r)),t.target&&n.push(t.target)):t.target&&c.push(rr.escapeArgument(t.target)),n.length>0&&(n=n.map(f=>rr.escapeArgument(f)),c.push("-ArgumentList",n.join(","))),t.target=rr.encodeCommand(c.join(" ")),t.wait||(a.stdio="ignore")}else{if(r)o=r;else{let c=!Fg||Fg==="/",f=!1;try{await Hl.default.access(EA,Hl.constants.X_OK),f=!0}catch{}o=Pg.default.versions.electron??(ta==="android"||c||!f)?"xdg-open":EA}n.length>0&&i.push(...n),t.wait||(a.stdio="ignore",a.detached=!0)}ta==="darwin"&&n.length>0&&i.push("--args",...n),t.target&&i.push(t.target);let u=FA.default.spawn(o,i,a);return t.wait?new Promise((c,f)=>{u.once("error",f),u.once("close",d=>{if(!t.allowNonzeroExitCode&&d!==0){f(new Error(`Exited with code ${d}`));return}c(u)})}):e?new Promise((c,f)=>{u.once("error",f),u.once("spawn",()=>{u.once("close",d=>{if(u.off("error",f),d!==0){f(new Error(`Exited with code ${d}`));return}u.unref(),c(u)})})}):(u.unref(),new Promise((c,f)=>{u.once("error",f),u.once("spawn",()=>{u.off("error",f),c(u)})}))},UM=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a `target`");return Ps({...e,target:t})},MM=(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 Ps({...e,app:{name:t,arguments:r}})};Ro={browser:"browser",browserPrivate:"browserPrivate"};To(Ro,"chrome",()=>ks({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium","chromium-browser"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));To(Ro,"brave",()=>ks({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"]}}));To(Ro,"firefox",()=>ks({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));To(Ro,"edge",()=>ks({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));To(Ro,"safari",()=>ks({darwin:"Safari"}));qM=UM});var yf=x(Sr=>{"use strict";Sr.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;Sr.find=(t,e)=>t.nodes.find(r=>r.type===e);Sr.exceedsLimit=(t,e,r=1,n)=>n===!1||!Sr.isInteger(t)||!Sr.isInteger(e)?!1:(Number(e)-Number(t))/Number(r)>=n;Sr.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)};Sr.encloseBrace=t=>t.type!=="brace"?!1:t.commas>>0+t.ranges>>0===0?(t.invalid=!0,!0):!1;Sr.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;Sr.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;Sr.reduce=t=>t.reduce((e,r)=>(r.type==="text"&&e.push(r.value),r.type==="range"&&(r.type="text"),e),[]);Sr.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 Df=x((mX,c1)=>{"use strict";var u1=yf();c1.exports=(t,e={})=>{let r=(n,o={})=>{let i=e.escapeInvalid&&u1.isInvalidBrace(o),a=n.invalid===!0&&e.escapeInvalid===!0,s="";if(n.value)return(i||a)&&u1.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 f1=x((gX,l1)=>{"use strict";l1.exports=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}});var w1=x((yX,b1)=>{"use strict";var d1=f1(),Ho=(t,e,r)=>{if(d1(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(d1(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(Ho.cache.hasOwnProperty(u))return Ho.cache[u].result;let c=Math.min(t,e),f=Math.max(t,e);if(Math.abs(c-f)===1){let y=t+"|"+e;return n.capture?`(${y})`:n.wrap===!1?y:`(?:${y})`}let d=D1(t)||D1(e),p={min:t,max:e,a:c,b:f},h=[],m=[];if(d&&(p.isPadded=d,p.maxLen=String(p.max).length),c<0){let y=f<0?Math.abs(f):1;m=p1(y,Math.abs(c),p,n),c=p.a=0}return f>=0&&(h=p1(c,f,p,n)),p.negatives=m,p.positives=h,p.result=N5(m,h,n),n.capture===!0?p.result=`(${p.result})`:n.wrap!==!1&&h.length+m.length>1&&(p.result=`(?:${p.result})`),Ho.cache[u]=p,p.result};function N5(t,e,r){let n=oy(t,e,"-",!1,r)||[],o=oy(e,t,"",!1,r)||[],i=oy(t,e,"-?",!0,r)||[];return n.concat(i).concat(o).join("|")}function L5(t,e){let r=1,n=1,o=m1(t,r),i=new Set([e]);for(;t<=o&&o<=e;)i.add(o),r+=1,o=m1(t,r);for(o=g1(e+1,n)-1;t<o&&o<=e;)i.add(o),n+=1,o=g1(e+1,n)-1;return i=[...i],i.sort(M5),i}function j5(t,e,r){if(t===e)return{pattern:t,count:[],digits:0};let n=U5(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+=q5(u,c,r):a++}return a&&(i+=r.shorthand===!0?"\\d":"[0-9]"),{pattern:i,count:[a],digits:o}}function p1(t,e,r,n){let o=L5(t,e),i=[],a=t,s;for(let u=0;u<o.length;u++){let c=o[u],f=j5(String(a),String(c),n),d="";if(!r.isPadded&&s&&s.pattern===f.pattern){s.count.length>1&&s.count.pop(),s.count.push(f.count[0]),s.string=s.pattern+y1(s.count),a=c+1;continue}r.isPadded&&(d=H5(c,r,n)),f.string=d+f.pattern+y1(f.count),i.push(f),a=c+1,s=f}return i}function oy(t,e,r,n,o){let i=[];for(let a of t){let{string:s}=a;!n&&!h1(e,"string",s)&&i.push(r+s),n&&h1(e,"string",s)&&i.push(r+s)}return i}function U5(t,e){let r=[];for(let n=0;n<t.length;n++)r.push([t[n],e[n]]);return r}function M5(t,e){return t>e?1:e>t?-1:0}function h1(t,e,r){return t.some(n=>n[e]===r)}function m1(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function g1(t,e){return t-t%Math.pow(10,e)}function y1(t){let[e=0,r=""]=t;return r||e>1?`{${e+(r?","+r:"")}}`:""}function q5(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function D1(t){return/^-?(0+)\d/.test(t)}function H5(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}}`}}Ho.cache={};Ho.clearCache=()=>Ho.cache={};b1.exports=Ho});var sy=x((DX,A1)=>{"use strict";var V5=require("util"),C1=w1(),v1=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),z5=t=>e=>t===!0?Number(e):String(e),iy=t=>typeof t=="number"||typeof t=="string"&&t!=="",Ws=t=>Number.isInteger(+t),ay=t=>{let e=`${t}`,r=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++r]==="0";);return r>0},K5=(t,e,r)=>typeof t=="string"||typeof e=="string"?!0:r.stringify===!0,G5=(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},wf=(t,e)=>{let r=t[0]==="-"?"-":"";for(r&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return r?"-"+t:t},W5=(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=>wf(String(s),r)).join("|")),t.negatives.length&&(i=`-(${n}${t.negatives.map(s=>wf(String(s),r)).join("|")})`),o&&i?a=`${o}|${i}`:a=o||i,e.wrap?`(${n}${a})`:a},E1=(t,e,r,n)=>{if(r)return C1(t,e,{wrap:!1,...n});let o=String.fromCharCode(t);if(t===e)return o;let i=String.fromCharCode(e);return`[${o}-${i}]`},_1=(t,e,r)=>{if(Array.isArray(t)){let n=r.wrap===!0,o=r.capture?"":"?:";return n?`(${o}${t.join("|")})`:t.join("|")}return C1(t,e,r)},S1=(...t)=>new RangeError("Invalid range arguments: "+V5.inspect(...t)),x1=(t,e,r)=>{if(r.strictRanges===!0)throw S1([t,e]);return[]},Y5=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return[]},J5=(t,e,r=1,n={})=>{let o=Number(t),i=Number(e);if(!Number.isInteger(o)||!Number.isInteger(i)){if(n.strictRanges===!0)throw S1([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 f=ay(s)||ay(u)||ay(c),d=f?Math.max(s.length,u.length,c.length):0,p=f===!1&&K5(t,e,n)===!1,h=n.transform||z5(p);if(n.toRegex&&r===1)return E1(wf(t,d),wf(e,d),!0,n);let m={negatives:[],positives:[]},y=E=>m[E<0?"negatives":"positives"].push(Math.abs(E)),D=[],v=0;for(;a?o>=i:o<=i;)n.toRegex===!0&&r>1?y(o):D.push(G5(h(o,v),d,p)),o=a?o-r:o+r,v++;return n.toRegex===!0?r>1?W5(m,n,d):_1(D,null,{wrap:!1,...n}):D},X5=(t,e,r=1,n={})=>{if(!Ws(t)&&t.length>1||!Ws(e)&&e.length>1)return x1(t,e,n);let o=n.transform||(p=>String.fromCharCode(p)),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 E1(u,c,!1,n);let f=[],d=0;for(;s?i>=a:i<=a;)f.push(o(i,d)),i=s?i-r:i+r,d++;return n.toRegex===!0?_1(f,null,{wrap:!1,options:n}):f},bf=(t,e,r,n={})=>{if(e==null&&iy(t))return[t];if(!iy(t)||!iy(e))return x1(t,e,n);if(typeof r=="function")return bf(t,e,1,{transform:r});if(v1(r))return bf(t,e,0,r);let o={...n};return o.capture===!0&&(o.wrap=!0),r=r||o.step||1,Ws(r)?Ws(t)&&Ws(e)?J5(t,e,r,o):X5(t,e,Math.max(Math.abs(r),1),o):r!=null&&!v1(r)?Y5(r,o):bf(t,e,1,r)};A1.exports=bf});var P1=x((bX,F1)=>{"use strict";var Z5=sy(),O1=yf(),Q5=(t,e={})=>{let r=(n,o={})=>{let i=O1.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 f=O1.reduce(n.nodes),d=Z5(...f,{...e,wrap:!1,toRegex:!0,strictZeros:!0});if(d.length!==0)return f.length>1&&d.length>1?`(${d})`:d}if(n.nodes)for(let f of n.nodes)c+=r(f,n);return c};return r(t)};F1.exports=Q5});var I1=x((wX,$1)=>{"use strict";var e9=sy(),k1=Df(),ya=yf(),Vo=(t="",e="",r=!1)=>{let n=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return r?ya.flatten(e).map(o=>`{${o}}`):e;for(let o of t)if(Array.isArray(o))for(let i of o)n.push(Vo(i,e,r));else for(let i of e)r===!0&&typeof i=="string"&&(i=`{${i}}`),n.push(Array.isArray(i)?Vo(o,i,r):o+i);return ya.flatten(n)},t9=(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(Vo(s.pop(),k1(o,e)));return}if(o.type==="brace"&&o.invalid!==!0&&o.nodes.length===2){s.push(Vo(s.pop(),["{}"]));return}if(o.nodes&&o.ranges>0){let d=ya.reduce(o.nodes);if(ya.exceedsLimit(...d,e.step,r))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let p=e9(...d,e);p.length===0&&(p=k1(o,e)),s.push(Vo(s.pop(),p)),o.nodes=[];return}let u=ya.encloseBrace(o),c=o.queue,f=o;for(;f.type!=="brace"&&f.type!=="root"&&f.parent;)f=f.parent,c=f.queue;for(let d=0;d<o.nodes.length;d++){let p=o.nodes[d];if(p.type==="comma"&&o.type==="brace"){d===1&&c.push(""),c.push("");continue}if(p.type==="close"){s.push(Vo(s.pop(),c,u));continue}if(p.value&&p.type!=="open"){c.push(Vo(c.pop(),p.value));continue}p.nodes&&n(p,o)}return c};return ya.flatten(n(t))};$1.exports=t9});var R1=x((vX,T1)=>{"use strict";T1.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:`
107
+ `,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 U1=x((CX,j1)=>{"use strict";var r9=Df(),{MAX_LENGTH:B1,CHAR_BACKSLASH:uy,CHAR_BACKTICK:n9,CHAR_COMMA:o9,CHAR_DOT:i9,CHAR_LEFT_PARENTHESES:a9,CHAR_RIGHT_PARENTHESES:s9,CHAR_LEFT_CURLY_BRACE:u9,CHAR_RIGHT_CURLY_BRACE:c9,CHAR_LEFT_SQUARE_BRACKET:N1,CHAR_RIGHT_SQUARE_BRACKET:L1,CHAR_DOUBLE_QUOTE:l9,CHAR_SINGLE_QUOTE:f9,CHAR_NO_BREAK_SPACE:d9,CHAR_ZERO_WIDTH_NOBREAK_SPACE:p9}=R1(),h9=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let r=e||{},n=typeof r.maxLength=="number"?Math.min(B1,r.maxLength):B1;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,f=0,d=0,p,h=()=>t[f++],m=y=>{if(y.type==="text"&&s.type==="dot"&&(s.type="text"),s&&s.type==="text"&&y.type==="text"){s.value+=y.value;return}return a.nodes.push(y),y.parent=a,y.prev=s,s=y,y};for(m({type:"bos"});f<c;)if(a=i[i.length-1],p=h(),!(p===p9||p===d9)){if(p===uy){m({type:"text",value:(e.keepEscaping?p:"")+h()});continue}if(p===L1){m({type:"text",value:"\\"+p});continue}if(p===N1){u++;let y;for(;f<c&&(y=h());){if(p+=y,y===N1){u++;continue}if(y===uy){p+=h();continue}if(y===L1&&(u--,u===0))break}m({type:"text",value:p});continue}if(p===a9){a=m({type:"paren",nodes:[]}),i.push(a),m({type:"text",value:p});continue}if(p===s9){if(a.type!=="paren"){m({type:"text",value:p});continue}a=i.pop(),m({type:"text",value:p}),a=i[i.length-1];continue}if(p===l9||p===f9||p===n9){let y=p,D;for(e.keepQuotes!==!0&&(p="");f<c&&(D=h());){if(D===uy){p+=D+h();continue}if(D===y){e.keepQuotes===!0&&(p+=D);break}p+=D}m({type:"text",value:p});continue}if(p===u9){d++;let D={type:"brace",open:!0,close:!1,dollar:s.value&&s.value.slice(-1)==="$"||a.dollar===!0,depth:d,commas:0,ranges:0,nodes:[]};a=m(D),i.push(a),m({type:"open",value:p});continue}if(p===c9){if(a.type!=="brace"){m({type:"text",value:p});continue}let y="close";a=i.pop(),a.close=!0,m({type:y,value:p}),d--,a=i[i.length-1];continue}if(p===o9&&d>0){if(a.ranges>0){a.ranges=0;let y=a.nodes.shift();a.nodes=[y,{type:"text",value:r9(a)}]}m({type:"comma",value:p}),a.commas++;continue}if(p===i9&&d>0&&a.commas===0){let y=a.nodes;if(d===0||y.length===0){m({type:"text",value:p});continue}if(s.type==="dot"){if(a.range=[],s.value+=p,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"){y.pop();let D=y[y.length-1];D.value+=s.value+p,s=D,a.ranges--;continue}m({type:"dot",value:p});continue}m({type:"text",value:p})}do if(a=i.pop(),a.type!=="root"){a.nodes.forEach(v=>{v.nodes||(v.type==="open"&&(v.isOpen=!0),v.type==="close"&&(v.isClose=!0),v.nodes||(v.type="text"),v.invalid=!0)});let y=i[i.length-1],D=y.nodes.indexOf(a);y.nodes.splice(D,1,...a.nodes)}while(i.length>0);return m({type:"eos"}),o};j1.exports=h9});var H1=x((EX,q1)=>{"use strict";var M1=Df(),m9=P1(),g9=I1(),y9=U1(),sr=(t,e={})=>{let r=[];if(Array.isArray(t))for(let n of t){let o=sr.create(n,e);Array.isArray(o)?r.push(...o):r.push(o)}else r=[].concat(sr.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(r=[...new Set(r)]),r};sr.parse=(t,e={})=>y9(t,e);sr.stringify=(t,e={})=>M1(typeof t=="string"?sr.parse(t,e):t,e);sr.compile=(t,e={})=>(typeof t=="string"&&(t=sr.parse(t,e)),m9(t,e));sr.expand=(t,e={})=>{typeof t=="string"&&(t=sr.parse(t,e));let r=g9(t,e);return e.noempty===!0&&(r=r.filter(Boolean)),e.nodupes===!0&&(r=[...new Set(r)]),r};sr.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?sr.compile(t,e):sr.expand(t,e);q1.exports=sr});var Ys=x((_X,W1)=>{"use strict";var D9=require("path"),Jr="\\\\/",V1=`[^${Jr}]`,vn="\\.",b9="\\+",w9="\\?",vf="\\/",v9="(?=.)",z1="[^/]",cy=`(?:${vf}|$)`,K1=`(?:^|${vf})`,ly=`${vn}{1,2}${cy}`,C9=`(?!${vn})`,E9=`(?!${K1}${ly})`,_9=`(?!${vn}{0,1}${cy})`,S9=`(?!${ly})`,x9=`[^.${vf}]`,A9=`${z1}*?`,G1={DOT_LITERAL:vn,PLUS_LITERAL:b9,QMARK_LITERAL:w9,SLASH_LITERAL:vf,ONE_CHAR:v9,QMARK:z1,END_ANCHOR:cy,DOTS_SLASH:ly,NO_DOT:C9,NO_DOTS:E9,NO_DOT_SLASH:_9,NO_DOTS_SLASH:S9,QMARK_NO_DOT:x9,STAR:A9,START_ANCHOR:K1},O9={...G1,SLASH_LITERAL:`[${Jr}]`,QMARK:V1,STAR:`${V1}*?`,DOTS_SLASH:`${vn}{1,2}(?:[${Jr}]|$)`,NO_DOT:`(?!${vn})`,NO_DOTS:`(?!(?:^|[${Jr}])${vn}{1,2}(?:[${Jr}]|$))`,NO_DOT_SLASH:`(?!${vn}{0,1}(?:[${Jr}]|$))`,NO_DOTS_SLASH:`(?!${vn}{1,2}(?:[${Jr}]|$))`,QMARK_NO_DOT:`[^.${Jr}]`,START_ANCHOR:`(?:^|[${Jr}])`,END_ANCHOR:`(?:[${Jr}]|$)`},F9={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"};W1.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:F9,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:D9.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?O9:G1}}});var Js=x(Xt=>{"use strict";var P9=require("path"),k9=process.platform==="win32",{REGEX_BACKSLASH:$9,REGEX_REMOVE_BACKSLASH:I9,REGEX_SPECIAL_CHARS:T9,REGEX_SPECIAL_CHARS_GLOBAL:R9}=Ys();Xt.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Xt.hasRegexChars=t=>T9.test(t);Xt.isRegexChar=t=>t.length===1&&Xt.hasRegexChars(t);Xt.escapeRegex=t=>t.replace(R9,"\\$1");Xt.toPosixSlashes=t=>t.replace($9,"/");Xt.removeBackslashes=t=>t.replace(I9,e=>e==="\\"?"":e);Xt.supportsLookbehinds=()=>{let t=process.version.slice(1).split(".").map(Number);return t.length===3&&t[0]>=9||t[0]===8&&t[1]>=10};Xt.isWindows=t=>t&&typeof t.windows=="boolean"?t.windows:k9===!0||P9.sep==="\\";Xt.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Xt.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Xt.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Xt.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",o=r.contains?"":"$",i=`${n}(?:${t})${o}`;return e.negated===!0&&(i=`(?:^(?!${i}).*$)`),i}});var rF=x((xX,tF)=>{"use strict";var Y1=Js(),{CHAR_ASTERISK:fy,CHAR_AT:B9,CHAR_BACKWARD_SLASH:Xs,CHAR_COMMA:N9,CHAR_DOT:dy,CHAR_EXCLAMATION_MARK:py,CHAR_FORWARD_SLASH:eF,CHAR_LEFT_CURLY_BRACE:hy,CHAR_LEFT_PARENTHESES:my,CHAR_LEFT_SQUARE_BRACKET:L9,CHAR_PLUS:j9,CHAR_QUESTION_MARK:J1,CHAR_RIGHT_CURLY_BRACE:U9,CHAR_RIGHT_PARENTHESES:X1,CHAR_RIGHT_SQUARE_BRACKET:M9}=Ys(),Z1=t=>t===eF||t===Xs,Q1=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},q9=(t,e)=>{let r=e||{},n=t.length-1,o=r.parts===!0||r.scanToEnd===!0,i=[],a=[],s=[],u=t,c=-1,f=0,d=0,p=!1,h=!1,m=!1,y=!1,D=!1,v=!1,E=!1,g=!1,_=!1,S=!1,k=0,F,B,T={value:"",depth:0,isGlob:!1},j=()=>c>=n,A=()=>u.charCodeAt(c+1),M=()=>(F=B,u.charCodeAt(++c));for(;c<n;){B=M();let w;if(B===Xs){E=T.backslashes=!0,B=M(),B===hy&&(v=!0);continue}if(v===!0||B===hy){for(k++;j()!==!0&&(B=M());){if(B===Xs){E=T.backslashes=!0,M();continue}if(B===hy){k++;continue}if(v!==!0&&B===dy&&(B=M())===dy){if(p=T.isBrace=!0,m=T.isGlob=!0,S=!0,o===!0)continue;break}if(v!==!0&&B===N9){if(p=T.isBrace=!0,m=T.isGlob=!0,S=!0,o===!0)continue;break}if(B===U9&&(k--,k===0)){v=!1,p=T.isBrace=!0,S=!0;break}}if(o===!0)continue;break}if(B===eF){if(i.push(c),a.push(T),T={value:"",depth:0,isGlob:!1},S===!0)continue;if(F===dy&&c===f+1){f+=2;continue}d=c+1;continue}if(r.noext!==!0&&(B===j9||B===B9||B===fy||B===J1||B===py)===!0&&A()===my){if(m=T.isGlob=!0,y=T.isExtglob=!0,S=!0,B===py&&c===f&&(_=!0),o===!0){for(;j()!==!0&&(B=M());){if(B===Xs){E=T.backslashes=!0,B=M();continue}if(B===X1){m=T.isGlob=!0,S=!0;break}}continue}break}if(B===fy){if(F===fy&&(D=T.isGlobstar=!0),m=T.isGlob=!0,S=!0,o===!0)continue;break}if(B===J1){if(m=T.isGlob=!0,S=!0,o===!0)continue;break}if(B===L9){for(;j()!==!0&&(w=M());){if(w===Xs){E=T.backslashes=!0,M();continue}if(w===M9){h=T.isBracket=!0,m=T.isGlob=!0,S=!0;break}}if(o===!0)continue;break}if(r.nonegate!==!0&&B===py&&c===f){g=T.negated=!0,f++;continue}if(r.noparen!==!0&&B===my){if(m=T.isGlob=!0,o===!0){for(;j()!==!0&&(B=M());){if(B===my){E=T.backslashes=!0,B=M();continue}if(B===X1){S=!0;break}}continue}break}if(m===!0){if(S=!0,o===!0)continue;break}}r.noext===!0&&(y=!1,m=!1);let L=u,X="",P="";f>0&&(X=u.slice(0,f),u=u.slice(f),d-=f),L&&m===!0&&d>0?(L=u.slice(0,d),P=u.slice(d)):m===!0?(L="",P=u):L=u,L&&L!==""&&L!=="/"&&L!==u&&Z1(L.charCodeAt(L.length-1))&&(L=L.slice(0,-1)),r.unescape===!0&&(P&&(P=Y1.removeBackslashes(P)),L&&E===!0&&(L=Y1.removeBackslashes(L)));let b={prefix:X,input:t,start:f,base:L,glob:P,isBrace:p,isBracket:h,isGlob:m,isExtglob:y,isGlobstar:D,negated:g,negatedExtglob:_};if(r.tokens===!0&&(b.maxDepth=0,Z1(B)||a.push(T),b.tokens=a),r.parts===!0||r.tokens===!0){let w;for(let C=0;C<i.length;C++){let O=w?w+1:f,R=i[C],$=t.slice(O,R);r.tokens&&(C===0&&f!==0?(a[C].isPrefix=!0,a[C].value=X):a[C].value=$,Q1(a[C]),b.maxDepth+=a[C].depth),(C!==0||$!=="")&&s.push($),w=R}if(w&&w+1<t.length){let C=t.slice(w+1);s.push(C),r.tokens&&(a[a.length-1].value=C,Q1(a[a.length-1]),b.maxDepth+=a[a.length-1].depth)}b.slashes=i,b.parts=s}return b};tF.exports=q9});var iF=x((AX,oF)=>{"use strict";var Cf=Ys(),ur=Js(),{MAX_LENGTH:Ef,POSIX_REGEX_SOURCE:H9,REGEX_NON_SPECIAL_CHARS:V9,REGEX_SPECIAL_CHARS_BACKREF:z9,REPLACEMENTS:nF}=Cf,K9=(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=>ur.escapeRegex(o)).join("..")}return r},Da=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,gy=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=nF[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(Ef,r.maxLength):Ef,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=ur.isWindows(e),c=Cf.globChars(u),f=Cf.extglobChars(c),{DOT_LITERAL:d,PLUS_LITERAL:p,SLASH_LITERAL:h,ONE_CHAR:m,DOTS_SLASH:y,NO_DOT:D,NO_DOT_SLASH:v,NO_DOTS_SLASH:E,QMARK:g,QMARK_NO_DOT:_,STAR:S,START_ANCHOR:k}=c,F=z=>`(${s}(?:(?!${k}${z.dot?y:d}).)*?)`,B=r.dot?"":D,T=r.dot?g:_,j=r.bash===!0?F(r):S;r.capture&&(j=`(${j})`),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=ur.removePrefix(t,A),o=t.length;let M=[],L=[],X=[],P=i,b,w=()=>A.index===o-1,C=A.peek=(z=1)=>t[A.index+z],O=A.advance=()=>t[++A.index]||"",R=()=>t.slice(A.index+1),$=(z="",Se=0)=>{A.consumed+=z,A.index+=Se},H=z=>{A.output+=z.output!=null?z.output:z.value,$(z.value)},I=()=>{let z=1;for(;C()==="!"&&(C(2)!=="("||C(3)==="?");)O(),A.start++,z++;return z%2===0?!1:(A.negated=!0,A.start++,!0)},N=z=>{A[z]++,X.push(z)},Z=z=>{A[z]--,X.pop()},U=z=>{if(P.type==="globstar"){let Se=A.braces>0&&(z.type==="comma"||z.type==="brace"),V=z.extglob===!0||M.length&&(z.type==="pipe"||z.type==="paren");z.type!=="slash"&&z.type!=="paren"&&!Se&&!V&&(A.output=A.output.slice(0,-P.output.length),P.type="star",P.value="*",P.output=j,A.output+=P.output)}if(M.length&&z.type!=="paren"&&(M[M.length-1].inner+=z.value),(z.value||z.output)&&H(z),P&&P.type==="text"&&z.type==="text"){P.value+=z.value,P.output=(P.output||"")+z.value;return}z.prev=P,a.push(z),P=z},oe=(z,Se)=>{let V={...f[Se],conditions:1,inner:""};V.prev=P,V.parens=A.parens,V.output=A.output;let de=(r.capture?"(":"")+V.open;N("parens"),U({type:z,value:Se,output:A.output?"":m}),U({type:"paren",extglob:!0,value:O(),output:de}),M.push(V)},Zt=z=>{let Se=z.close+(r.capture?")":""),V;if(z.type==="negate"){let de=j;if(z.inner&&z.inner.length>1&&z.inner.includes("/")&&(de=F(r)),(de!==j||w()||/^\)+$/.test(R()))&&(Se=z.close=`)$))${de}`),z.inner.includes("*")&&(V=R())&&/^\.[^\\/.]+$/.test(V)){let He=gy(V,{...e,fastpaths:!1}).output;Se=z.close=`)${He})${de})`}z.prev.type==="bos"&&(A.negatedExtglob=!0)}U({type:"paren",extglob:!0,value:b,output:Se}),Z("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let z=!1,Se=t.replace(z9,(V,de,He,Ot,ot,Rf)=>Ot==="\\"?(z=!0,V):Ot==="?"?de?de+Ot+(ot?g.repeat(ot.length):""):Rf===0?T+(ot?g.repeat(ot.length):""):g.repeat(He.length):Ot==="."?d.repeat(He.length):Ot==="*"?de?de+Ot+(ot?j:""):j:de?V:`\\${V}`);return z===!0&&(r.unescape===!0?Se=Se.replace(/\\/g,""):Se=Se.replace(/\\+/g,V=>V.length%2===0?"\\\\":V?"\\":"")),Se===t&&r.contains===!0?(A.output=t,A):(A.output=ur.wrapOutput(Se,A,e),A)}for(;!w();){if(b=O(),b==="\0")continue;if(b==="\\"){let V=C();if(V==="/"&&r.bash!==!0||V==="."||V===";")continue;if(!V){b+="\\",U({type:"text",value:b});continue}let de=/^\\+/.exec(R()),He=0;if(de&&de[0].length>2&&(He=de[0].length,A.index+=He,He%2!==0&&(b+="\\")),r.unescape===!0?b=O():b+=O(),A.brackets===0){U({type:"text",value:b});continue}}if(A.brackets>0&&(b!=="]"||P.value==="["||P.value==="[^")){if(r.posix!==!1&&b===":"){let V=P.value.slice(1);if(V.includes("[")&&(P.posix=!0,V.includes(":"))){let de=P.value.lastIndexOf("["),He=P.value.slice(0,de),Ot=P.value.slice(de+2),ot=H9[Ot];if(ot){P.value=He+ot,A.backtrack=!0,O(),!i.output&&a.indexOf(P)===1&&(i.output=m);continue}}}(b==="["&&C()!==":"||b==="-"&&C()==="]")&&(b=`\\${b}`),b==="]"&&(P.value==="["||P.value==="[^")&&(b=`\\${b}`),r.posix===!0&&b==="!"&&P.value==="["&&(b="^"),P.value+=b,H({value:b});continue}if(A.quotes===1&&b!=='"'){b=ur.escapeRegex(b),P.value+=b,H({value:b});continue}if(b==='"'){A.quotes=A.quotes===1?0:1,r.keepQuotes===!0&&U({type:"text",value:b});continue}if(b==="("){N("parens"),U({type:"paren",value:b});continue}if(b===")"){if(A.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Da("opening","("));let V=M[M.length-1];if(V&&A.parens===V.parens+1){Zt(M.pop());continue}U({type:"paren",value:b,output:A.parens?")":"\\)"}),Z("parens");continue}if(b==="["){if(r.nobracket===!0||!R().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Da("closing","]"));b=`\\${b}`}else N("brackets");U({type:"bracket",value:b});continue}if(b==="]"){if(r.nobracket===!0||P&&P.type==="bracket"&&P.value.length===1){U({type:"text",value:b,output:`\\${b}`});continue}if(A.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Da("opening","["));U({type:"text",value:b,output:`\\${b}`});continue}Z("brackets");let V=P.value.slice(1);if(P.posix!==!0&&V[0]==="^"&&!V.includes("/")&&(b=`/${b}`),P.value+=b,H({value:b}),r.literalBrackets===!1||ur.hasRegexChars(V))continue;let de=ur.escapeRegex(P.value);if(A.output=A.output.slice(0,-P.value.length),r.literalBrackets===!0){A.output+=de,P.value=de;continue}P.value=`(${s}${de}|${P.value})`,A.output+=P.value;continue}if(b==="{"&&r.nobrace!==!0){N("braces");let V={type:"brace",value:b,output:"(",outputIndex:A.output.length,tokensIndex:A.tokens.length};L.push(V),U(V);continue}if(b==="}"){let V=L[L.length-1];if(r.nobrace===!0||!V){U({type:"text",value:b,output:b});continue}let de=")";if(V.dots===!0){let He=a.slice(),Ot=[];for(let ot=He.length-1;ot>=0&&(a.pop(),He[ot].type!=="brace");ot--)He[ot].type!=="dots"&&Ot.unshift(He[ot].value);de=K9(Ot,r),A.backtrack=!0}if(V.comma!==!0&&V.dots!==!0){let He=A.output.slice(0,V.outputIndex),Ot=A.tokens.slice(V.tokensIndex);V.value=V.output="\\{",b=de="\\}",A.output=He;for(let ot of Ot)A.output+=ot.output||ot.value}U({type:"brace",value:b,output:de}),Z("braces"),L.pop();continue}if(b==="|"){M.length>0&&M[M.length-1].conditions++,U({type:"text",value:b});continue}if(b===","){let V=b,de=L[L.length-1];de&&X[X.length-1]==="braces"&&(de.comma=!0,V="|"),U({type:"comma",value:b,output:V});continue}if(b==="/"){if(P.type==="dot"&&A.index===A.start+1){A.start=A.index+1,A.consumed="",A.output="",a.pop(),P=i;continue}U({type:"slash",value:b,output:h});continue}if(b==="."){if(A.braces>0&&P.type==="dot"){P.value==="."&&(P.output=d);let V=L[L.length-1];P.type="dots",P.output+=b,P.value+=b,V.dots=!0;continue}if(A.braces+A.parens===0&&P.type!=="bos"&&P.type!=="slash"){U({type:"text",value:b,output:d});continue}U({type:"dot",value:b,output:d});continue}if(b==="?"){if(!(P&&P.value==="(")&&r.noextglob!==!0&&C()==="("&&C(2)!=="?"){oe("qmark",b);continue}if(P&&P.type==="paren"){let de=C(),He=b;if(de==="<"&&!ur.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(P.value==="("&&!/[!=<:]/.test(de)||de==="<"&&!/<([!=]|\w+>)/.test(R()))&&(He=`\\${b}`),U({type:"text",value:b,output:He});continue}if(r.dot!==!0&&(P.type==="slash"||P.type==="bos")){U({type:"qmark",value:b,output:_});continue}U({type:"qmark",value:b,output:g});continue}if(b==="!"){if(r.noextglob!==!0&&C()==="("&&(C(2)!=="?"||!/[!=<:]/.test(C(3)))){oe("negate",b);continue}if(r.nonegate!==!0&&A.index===0){I();continue}}if(b==="+"){if(r.noextglob!==!0&&C()==="("&&C(2)!=="?"){oe("plus",b);continue}if(P&&P.value==="("||r.regex===!1){U({type:"plus",value:b,output:p});continue}if(P&&(P.type==="bracket"||P.type==="paren"||P.type==="brace")||A.parens>0){U({type:"plus",value:b});continue}U({type:"plus",value:p});continue}if(b==="@"){if(r.noextglob!==!0&&C()==="("&&C(2)!=="?"){U({type:"at",extglob:!0,value:b,output:""});continue}U({type:"text",value:b});continue}if(b!=="*"){(b==="$"||b==="^")&&(b=`\\${b}`);let V=V9.exec(R());V&&(b+=V[0],A.index+=V[0].length),U({type:"text",value:b});continue}if(P&&(P.type==="globstar"||P.star===!0)){P.type="star",P.star=!0,P.value+=b,P.output=j,A.backtrack=!0,A.globstar=!0,$(b);continue}let z=R();if(r.noextglob!==!0&&/^\([^?]/.test(z)){oe("star",b);continue}if(P.type==="star"){if(r.noglobstar===!0){$(b);continue}let V=P.prev,de=V.prev,He=V.type==="slash"||V.type==="bos",Ot=de&&(de.type==="star"||de.type==="globstar");if(r.bash===!0&&(!He||z[0]&&z[0]!=="/")){U({type:"star",value:b,output:""});continue}let ot=A.braces>0&&(V.type==="comma"||V.type==="brace"),Rf=M.length&&(V.type==="pipe"||V.type==="paren");if(!He&&V.type!=="paren"&&!ot&&!Rf){U({type:"star",value:b,output:""});continue}for(;z.slice(0,3)==="/**";){let nu=t[A.index+4];if(nu&&nu!=="/")break;z=z.slice(3),$("/**",3)}if(V.type==="bos"&&w()){P.type="globstar",P.value+=b,P.output=F(r),A.output=P.output,A.globstar=!0,$(b);continue}if(V.type==="slash"&&V.prev.type!=="bos"&&!Ot&&w()){A.output=A.output.slice(0,-(V.output+P.output).length),V.output=`(?:${V.output}`,P.type="globstar",P.output=F(r)+(r.strictSlashes?")":"|$)"),P.value+=b,A.globstar=!0,A.output+=V.output+P.output,$(b);continue}if(V.type==="slash"&&V.prev.type!=="bos"&&z[0]==="/"){let nu=z[1]!==void 0?"|$":"";A.output=A.output.slice(0,-(V.output+P.output).length),V.output=`(?:${V.output}`,P.type="globstar",P.output=`${F(r)}${h}|${h}${nu})`,P.value+=b,A.output+=V.output+P.output,A.globstar=!0,$(b+O()),U({type:"slash",value:"/",output:""});continue}if(V.type==="bos"&&z[0]==="/"){P.type="globstar",P.value+=b,P.output=`(?:^|${h}|${F(r)}${h})`,A.output=P.output,A.globstar=!0,$(b+O()),U({type:"slash",value:"/",output:""});continue}A.output=A.output.slice(0,-P.output.length),P.type="globstar",P.output=F(r),P.value+=b,A.output+=P.output,A.globstar=!0,$(b);continue}let Se={type:"star",value:b,output:j};if(r.bash===!0){Se.output=".*?",(P.type==="bos"||P.type==="slash")&&(Se.output=B+Se.output),U(Se);continue}if(P&&(P.type==="bracket"||P.type==="paren")&&r.regex===!0){Se.output=b,U(Se);continue}(A.index===A.start||P.type==="slash"||P.type==="dot")&&(P.type==="dot"?(A.output+=v,P.output+=v):r.dot===!0?(A.output+=E,P.output+=E):(A.output+=B,P.output+=B),C()!=="*"&&(A.output+=m,P.output+=m)),U(Se)}for(;A.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Da("closing","]"));A.output=ur.escapeLast(A.output,"["),Z("brackets")}for(;A.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Da("closing",")"));A.output=ur.escapeLast(A.output,"("),Z("parens")}for(;A.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Da("closing","}"));A.output=ur.escapeLast(A.output,"{"),Z("braces")}if(r.strictSlashes!==!0&&(P.type==="star"||P.type==="bracket")&&U({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};gy.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(Ef,r.maxLength):Ef,o=t.length;if(o>n)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${n}`);t=nF[t]||t;let i=ur.isWindows(e),{DOT_LITERAL:a,SLASH_LITERAL:s,ONE_CHAR:u,DOTS_SLASH:c,NO_DOT:f,NO_DOTS:d,NO_DOTS_SLASH:p,STAR:h,START_ANCHOR:m}=Cf.globChars(i),y=r.dot?d:f,D=r.dot?p:f,v=r.capture?"":"?:",E={negated:!1,prefix:""},g=r.bash===!0?".*?":h;r.capture&&(g=`(${g})`);let _=B=>B.noglobstar===!0?g:`(${v}(?:(?!${m}${B.dot?c:a}).)*?)`,S=B=>{switch(B){case"*":return`${y}${u}${g}`;case".*":return`${a}${u}${g}`;case"*.*":return`${y}${g}${a}${u}${g}`;case"*/*":return`${y}${g}${s}${u}${D}${g}`;case"**":return y+_(r);case"**/*":return`(?:${y}${_(r)}${s})?${D}${u}${g}`;case"**/*.*":return`(?:${y}${_(r)}${s})?${D}${g}${a}${u}${g}`;case"**/.*":return`(?:${y}${_(r)}${s})?${a}${u}${g}`;default:{let T=/^(.*?)\.(\w+)$/.exec(B);if(!T)return;let j=S(T[1]);return j?j+a+T[2]:void 0}}},k=ur.removePrefix(t,E),F=S(k);return F&&r.strictSlashes!==!0&&(F+=`${s}?`),F};oF.exports=gy});var sF=x((OX,aF)=>{"use strict";var G9=require("path"),W9=rF(),yy=iF(),Dy=Js(),Y9=Ys(),J9=t=>t&&typeof t=="object"&&!Array.isArray(t),rt=(t,e,r=!1)=>{if(Array.isArray(t)){let f=t.map(p=>rt(p,e,r));return p=>{for(let h of f){let m=h(p);if(m)return m}return!1}}let n=J9(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=Dy.isWindows(e),a=n?rt.compileRe(t,e):rt.makeRe(t,e,!1,!0),s=a.state;delete a.state;let u=()=>!1;if(o.ignore){let f={...e,ignore:null,onMatch:null,onResult:null};u=rt(o.ignore,f,r)}let c=(f,d=!1)=>{let{isMatch:p,match:h,output:m}=rt.test(f,a,e,{glob:t,posix:i}),y={glob:t,state:s,regex:a,posix:i,input:f,output:m,match:h,isMatch:p};return typeof o.onResult=="function"&&o.onResult(y),p===!1?(y.isMatch=!1,d?y:!1):u(f)?(typeof o.onIgnore=="function"&&o.onIgnore(y),y.isMatch=!1,d?y:!1):(typeof o.onMatch=="function"&&o.onMatch(y),d?y:!0)};return r&&(c.state=s),c};rt.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?Dy.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=rt.matchBase(t,e,r,o):s=e.exec(u)),{isMatch:!!s,match:s,output:u}};rt.matchBase=(t,e,r,n=Dy.isWindows(r))=>(e instanceof RegExp?e:rt.makeRe(e,r)).test(G9.basename(t));rt.isMatch=(t,e,r)=>rt(e,r)(t);rt.parse=(t,e)=>Array.isArray(t)?t.map(r=>rt.parse(r,e)):yy(t,{...e,fastpaths:!1});rt.scan=(t,e)=>W9(t,e);rt.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=rt.toRegex(s,e);return n===!0&&(u.state=t),u};rt.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=yy.fastpaths(t,e)),o.output||(o=yy(t,e)),rt.compileRe(o,e,r,n)};rt.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/$^/}};rt.constants=Y9;aF.exports=rt});var cF=x((FX,uF)=>{"use strict";uF.exports=sF()});var mF=x((PX,hF)=>{"use strict";var fF=require("util"),dF=H1(),Xr=cF(),by=Js(),lF=t=>t===""||t==="./",pF=t=>{let e=t.indexOf("{");return e>-1&&t.indexOf("}",e)>-1},Le=(t,e,r)=>{e=[].concat(e),t=[].concat(t);let n=new Set,o=new Set,i=new Set,a=0,s=f=>{i.add(f.output),r&&r.onResult&&r.onResult(f)};for(let f=0;f<e.length;f++){let d=Xr(String(e[f]),{...r,onResult:s},!0),p=d.state.negated||d.state.negatedExtglob;p&&a++;for(let h of t){let m=d(h,!0);(p?!m.isMatch:m.isMatch)&&(p?n.add(m.output):(n.delete(m.output),o.add(m.output)))}}let c=(a===e.length?[...i]:[...o]).filter(f=>!n.has(f));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(f=>f.replace(/\\/g,"")):e}return c};Le.match=Le;Le.matcher=(t,e)=>Xr(t,e);Le.isMatch=(t,e,r)=>Xr(e,r)(t);Le.any=Le.isMatch;Le.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(Le(t,e,{...r,onResult:i}));for(let s of o)a.has(s)||n.add(s);return[...n]};Le.contains=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${fF.inspect(t)}"`);if(Array.isArray(e))return e.some(n=>Le.contains(t,n,r));if(typeof e=="string"){if(lF(t)||lF(e))return!1;if(t.includes(e)||t.startsWith("./")&&t.slice(2).includes(e))return!0}return Le.isMatch(t,e,{...r,contains:!0})};Le.matchKeys=(t,e,r)=>{if(!by.isObject(t))throw new TypeError("Expected the first argument to be an object");let n=Le(Object.keys(t),e,r),o={};for(let i of n)o[i]=t[i];return o};Le.some=(t,e,r)=>{let n=[].concat(t);for(let o of[].concat(e)){let i=Xr(String(o),r);if(n.some(a=>i(a)))return!0}return!1};Le.every=(t,e,r)=>{let n=[].concat(t);for(let o of[].concat(e)){let i=Xr(String(o),r);if(!n.every(a=>i(a)))return!1}return!0};Le.all=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${fF.inspect(t)}"`);return[].concat(e).every(n=>Xr(n,r)(t))};Le.capture=(t,e,r)=>{let n=by.isWindows(r),i=Xr.makeRe(String(t),{...r,capture:!0}).exec(n?by.toPosixSlashes(e):e);if(i)return i.slice(1).map(a=>a===void 0?"":a)};Le.makeRe=(...t)=>Xr.makeRe(...t);Le.scan=(...t)=>Xr.scan(...t);Le.parse=(t,e)=>{let r=[];for(let n of[].concat(t||[]))for(let o of dF(String(n),e))r.push(Xr.parse(o,e));return r};Le.braces=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return e&&e.nobrace===!0||!pF(t)?[t]:dF(t,e)};Le.braceExpand=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return Le.braces(t,{...e,expand:!0})};Le.hasBraces=pF;hF.exports=Le});var QF=x((PZ,Cn)=>{var Ie=require("fs"),Pf=require("os"),wt=require("path"),BF=require("crypto"),Qr={fs:Ie.constants,os:Pf.constants},NF="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",MF=/XXXXXX/,E7=3,qF=(Qr.O_CREAT||Qr.fs.O_CREAT)|(Qr.O_EXCL||Qr.fs.O_EXCL)|(Qr.O_RDWR||Qr.fs.O_RDWR),_7=Pf.platform()==="win32",S7=Qr.EBADF||Qr.os.errno.EBADF,x7=Qr.ENOENT||Qr.os.errno.ENOENT,HF=448,VF=384,A7="exit",wa=[],zF=Ie.rmdirSync.bind(Ie),KF=!1;function O7(t,e){return Ie.rm(t,{recursive:!0},e)}function GF(t){return Ie.rmSync(t,{recursive:!0})}function _y(t,e){let r=va(t,e),n=r[0],o=r[1];L7(n,function(i,a){if(i)return o(i);let s=a.tries;(function u(){try{let c=YF(a);Ie.stat(c,function(f){if(!f)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 Sy(t){let e=va(t),r=e[0],n=j7(r),o=n.tries;do{let i=YF(n);try{Ie.statSync(i)}catch{return i}}while(o-- >0);throw new Error("Could not get a unique tmp filename, max tries reached")}function F7(t,e){let r=va(t,e),n=r[0],o=r[1];_y(n,function(a,s){if(a)return o(a);Ie.open(s,qF,n.mode||VF,function(c,f){if(c)return o(c);if(n.discardDescriptor)return Ie.close(f,function(p){return o(p,s,void 0,Cy(s,-1,n,!1))});{let d=n.discardDescriptor||n.detachDescriptor;o(null,s,f,Cy(s,d?-1:f,n,!1))}})})}function P7(t){let e=va(t),r=e[0],n=r.discardDescriptor||r.detachDescriptor,o=Sy(r),i=Ie.openSync(o,qF,r.mode||VF);return r.discardDescriptor&&(Ie.closeSync(i),i=void 0),{name:o,fd:i,removeCallback:Cy(o,n?-1:i,r,!0)}}function k7(t,e){let r=va(t,e),n=r[0],o=r[1];_y(n,function(a,s){if(a)return o(a);Ie.mkdir(s,n.mode||HF,function(c){if(c)return o(c);o(null,s,WF(s,n,!1))})})}function $7(t){let e=va(t),r=e[0],n=Sy(r);return Ie.mkdirSync(n,r.mode||HF),{name:n,removeCallback:WF(n,r,!0)}}function I7(t,e){let r=function(n){if(n&&!Ey(n))return e(n);e()};0<=t[0]?Ie.close(t[0],function(){Ie.unlink(t[1],r)}):Ie.unlink(t[1],r)}function T7(t){let e=null;try{0<=t[0]&&Ie.closeSync(t[0])}catch(r){if(!U7(r)&&!Ey(r))throw r}finally{try{Ie.unlinkSync(t[1])}catch(r){Ey(r)||(e=r)}}if(e!==null)throw e}function Cy(t,e,r,n){let o=Ff(T7,[e,t],n),i=Ff(I7,[e,t],n,o);return r.keep||wa.unshift(o),n?o:i}function WF(t,e,r){let n=e.unsafeCleanup?O7:Ie.rmdir.bind(Ie),o=e.unsafeCleanup?GF:zF,i=Ff(o,t,r),a=Ff(n,t,r,i);return e.keep||wa.unshift(i),r?i:a}function Ff(t,e,r,n){let o=!1;return function i(a){if(!o){let s=n||i,u=wa.indexOf(s);return u>=0&&wa.splice(u,1),o=!0,r||t===zF||t===GF?t(e):t(e,a||function(){})}}}function R7(){if(KF)for(;wa.length;)try{wa[0]()}catch{}}function LF(t){let e=[],r=null;try{r=BF.randomBytes(t)}catch{r=BF.pseudoRandomBytes(t)}for(let n=0;n<t;n++)e.push(NF[r[n]%NF.length]);return e.join("")}function cr(t){return typeof t>"u"}function va(t,e){if(typeof t=="function")return[{},t];if(cr(t))return[{},e];let r={};for(let n of Object.getOwnPropertyNames(t))r[n]=t[n];return[r,e]}function B7(t,e,r){let n=wt.isAbsolute(t)?t:wt.join(e,t);Ie.stat(n,function(o){o?Ie.realpath(wt.dirname(n),function(i,a){if(i)return r(i);r(null,wt.join(a,wt.basename(n)))}):Ie.realpath(n,r)})}function N7(t,e){let r=wt.isAbsolute(t)?t:wt.join(e,t);try{return Ie.statSync(r),Ie.realpathSync(r)}catch{let o=Ie.realpathSync(wt.dirname(r));return wt.join(o,wt.basename(r))}}function YF(t){let e=t.tmpdir;if(!cr(t.name))return wt.join(e,t.dir,t.name);if(!cr(t.template))return wt.join(e,t.dir,t.template).replace(MF,LF(6));let r=[t.prefix?t.prefix:"tmp","-",process.pid,"-",LF(12),t.postfix?"-"+t.postfix:""].join("");return wt.join(e,t.dir,r)}function JF(t){if(!cr(t.name)){let e=t.name;if(wt.isAbsolute(e))throw new Error(`name option must not contain an absolute path, found "${e}".`);let r=wt.basename(e);if(r===".."||r==="."||r!==e)throw new Error(`name option must not contain a path, found "${e}".`)}if(!cr(t.template)&&!t.template.match(MF))throw new Error(`Invalid template, found "${t.template}".`);if(!cr(t.tries)&&isNaN(t.tries)||t.tries<0)throw new Error(`Invalid tries, found "${t.tries}".`);t.tries=cr(t.name)?t.tries||E7:1,t.keep=!!t.keep,t.detachDescriptor=!!t.detachDescriptor,t.discardDescriptor=!!t.discardDescriptor,t.unsafeCleanup=!!t.unsafeCleanup,t.prefix=cr(t.prefix)?"":t.prefix,t.postfix=cr(t.postfix)?"":t.postfix}function jF(t,e,r,n){if(cr(e))return n(null);B7(e,r,function(o,i){if(o)return n(o);let a=wt.relative(r,i);if(!i.startsWith(r))return n(new Error(`${t} option must be relative to "${r}", found "${a}".`));n(null,a)})}function UF(t,e,r){if(cr(e))return;let n=N7(e,r),o=wt.relative(r,n);if(!n.startsWith(r))throw new Error(`${t} option must be relative to "${r}", found "${o}".`);return o}function L7(t,e){q7(t,function(r,n){if(r)return e(r);t.tmpdir=n;try{JF(t,n)}catch(o){return e(o)}jF("dir",t.dir,n,function(o,i){if(o)return e(o);t.dir=cr(i)?"":i,jF("template",t.template,n,function(a,s){if(a)return e(a);t.template=s,e(null,t)})})})}function j7(t){let e=t.tmpdir=ZF(t);JF(t,e);let r=UF("dir",t.dir,e);return t.dir=cr(r)?"":r,t.template=UF("template",t.template,e),t}function U7(t){return XF(t,-S7,"EBADF")}function Ey(t){return XF(t,-x7,"ENOENT")}function XF(t,e,r){return _7?t.code===r:t.code===r&&t.errno===e}function M7(){KF=!0}function q7(t,e){return Ie.realpath(t&&t.tmpdir||Pf.tmpdir(),e)}function ZF(t){return Ie.realpathSync(t&&t.tmpdir||Pf.tmpdir())}process.addListener(A7,R7);Object.defineProperty(Cn.exports,"tmpdir",{enumerable:!0,configurable:!1,get:function(){return ZF()}});Cn.exports.dir=k7;Cn.exports.dirSync=$7;Cn.exports.file=F7;Cn.exports.fileSync=P7;Cn.exports.tmpName=_y;Cn.exports.tmpNameSync=Sy;Cn.exports.setGracefulCleanup=M7});var $f=require("node:process");var Yy=pe(Wy(),1),{program:at,createCommand:xq,createArgument:Aq,createOption:Oq,CommanderError:Fq,InvalidArgumentError:Pq,InvalidOptionArgumentError:kq,Command:$q,Argument:Iq,Option:Tq,Help:Rq}=Yy.default;var xr={name:"@capgo/cli",version:"7.56.0",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/CLI#readme",repository:{type:"git",url:"git+https://github.com/Cap-go/CLI.git"},bugs:{url:"https://github.com/Cap-go/CLI/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli","sdk"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js",require:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && node build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"npx --yes supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsc --noEmit",lint:'eslint "src/**/*.ts" --fix',"check-posix-paths":"node test/check-posix-paths.js","generate-docs":"node dist/index.js generate-docs README.md","test:bundle":"bun test/test-bundle.mjs","test:functional":"bun test/test-functional.mjs","test:semver":"bun test/test-semver-validation.mjs","test:version-edge-cases":"bun test/test-version-validation.mjs","test:regex":"bun test/test-regex-validation.mjs","test:upload":"bun test/test-upload-validation.mjs","test:credentials":"bun test/test-credentials.mjs","test:credentials-validation":"bun test/test-credentials-validation.mjs","test:version-detection":"node test/test-get-installed-version.mjs","test:version-detection:setup":"./test/fixtures/setup-test-projects.sh",test:"bun run test:bundle && bun run test:functional && bun run test:semver && bun run test:version-edge-cases && bun run test:regex && bun run test:upload && bun run test:credentials && bun run test:credentials-validation && bun run test:version-detection"},devDependencies:{"@antfu/eslint-config":"^6.1.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.4","@capacitor/cli":"^7.4.4","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^0.11.0","@sauber/table":"npm:@jsr/sauber__table","@std/semver":"npm:@jsr/std__semver@1.0.6","@supabase/supabase-js":"^2.79.0","@types/adm-zip":"^0.5.7","@types/node":"^24.9.1","@types/prettyjson":"^0.0.33","@types/tmp":"^0.2.6","@vercel/ncc":"^0.38.4","adm-zip":"^0.5.16","ci-info":"^4.3.1",commander:"^14.0.2",esbuild:"^0.27.0",eslint:"^9.38.0","git-format-staged":"3.1.1",husky:"^9.1.7","is-wsl":"^3.1.0",open:"^11.0.0",prettyjson:"^1.2.5",tmp:"^0.2.5","tus-js-client":"^4.3.1",typescript:"^5.9.3"}};var la=require("node:fs");var vt=pe(ed(),1),Go=require("node:process"),_n=pe(require("node:readline"),1),id=pe(require("node:readline"),1),aD=require("node:stream"),sD=pe(rd(),1);function B2({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 N2=B2();function uD(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(N2,"")}function cD(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var lD={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 f=u[c],d=e.length(f);if(s>=o-(d==2?1:0))if(s+d<=i)a+=f;else break;s+=d}return a}})(lD);var L2=lD.exports,j2=cD(L2),U2=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},M2=cD(U2);function Sa(t,e={}){if(typeof t!="string"||t.length===0||(e={ambiguousIsNarrow:!0,...e},t=uD(t),t.length===0))return 0;t=t.replace(M2()," ");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(j2.eastAsianWidth(o)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}var nd=10,Qy=(t=0)=>e=>`\x1B[${e+t}m`,eD=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,tD=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`,je={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(je.modifier);var q2=Object.keys(je.color),H2=Object.keys(je.bgColor);[...q2,...H2];function V2(){let t=new Map;for(let[e,r]of Object.entries(je)){for(let[n,o]of Object.entries(r))je[n]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},r[n]=je[n],t.set(o[0],o[1]);Object.defineProperty(je,e,{value:r,enumerable:!1})}return Object.defineProperty(je,"codes",{value:t,enumerable:!1}),je.color.close="\x1B[39m",je.bgColor.close="\x1B[49m",je.color.ansi=Qy(),je.color.ansi256=eD(),je.color.ansi16m=tD(),je.bgColor.ansi=Qy(nd),je.bgColor.ansi256=eD(nd),je.bgColor.ansi16m=tD(nd),Object.defineProperties(je,{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=>je.rgbToAnsi256(...je.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)=>je.ansi256ToAnsi(je.rgbToAnsi256(e,r,n)),enumerable:!1},hexToAnsi:{value:e=>je.ansi256ToAnsi(je.hexToAnsi256(e)),enumerable:!1}}),je}var z2=V2(),mu=new Set(["\x1B","\x9B"]),K2=39,sd="\x07",fD="[",G2="]",dD="m",ud=`${G2}8;;`,rD=t=>`${mu.values().next().value}${fD}${t}${dD}`,nD=t=>`${mu.values().next().value}${ud}${t}${sd}`,W2=t=>t.split(" ").map(e=>Sa(e)),od=(t,e,r)=>{let n=[...e],o=!1,i=!1,a=Sa(uD(t[t.length-1]));for(let[s,u]of n.entries()){let c=Sa(u);if(a+c<=r?t[t.length-1]+=u:(t.push(u),a=0),mu.has(u)&&(o=!0,i=n.slice(s+1).join("").startsWith(ud)),o){i?u===sd&&(o=!1,i=!1):u===dD&&(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())},Y2=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(Sa(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},J2=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",o,i,a=W2(t),s=[""];for(let[c,f]of t.split(" ").entries()){r.trim!==!1&&(s[s.length-1]=s[s.length-1].trimStart());let d=Sa(s[s.length-1]);if(c!==0&&(d>=e&&(r.wordWrap===!1||r.trim===!1)&&(s.push(""),d=0),(d>0||r.trim===!1)&&(s[s.length-1]+=" ",d++)),r.hard&&a[c]>e){let p=e-d,h=1+Math.floor((a[c]-p-1)/e);Math.floor((a[c]-1)/e)<h&&s.push(""),od(s,f,e);continue}if(d+a[c]>e&&d>0&&a[c]>0){if(r.wordWrap===!1&&d<e){od(s,f,e);continue}s.push("")}if(d+a[c]>e&&r.wordWrap===!1){od(s,f,e);continue}s[s.length-1]+=f}r.trim!==!1&&(s=s.map(c=>Y2(c)));let u=[...s.join(`
108
+ `)];for(let[c,f]of u.entries()){if(n+=f,mu.has(f)){let{groups:p}=new RegExp(`(?:\\${fD}(?<code>\\d+)m|\\${ud}(?<uri>.*)${sd})`).exec(u.slice(c).join(""))||{groups:{}};if(p.code!==void 0){let h=Number.parseFloat(p.code);o=h===K2?void 0:h}else p.uri!==void 0&&(i=p.uri.length===0?void 0:p.uri)}let d=z2.codes.get(Number(o));u[c+1]===`
109
+ `?(i&&(n+=nD("")),o&&d&&(n+=rD(d))):f===`
110
+ `&&(o&&d&&(n+=rD(o)),i&&(n+=nD(i)))}return n};function oD(t,e,r){return String(t).normalize().replace(/\r\n/g,`
111
111
  `).split(`
112
- `).map(n=>z2(n,e,r)).join(`
113
- `)}var K2=["up","down","left","right","space","enter","cancel"],su={actions:new Set(K2),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]])};function od(t,e){if(typeof t=="string")return su.aliases.get(t)===e;for(let r of t)if(r!==void 0&&od(r,e))return!0;return!1}function G2(t,e){if(t===e)return;let r=t.split(`
112
+ `).map(n=>J2(n,e,r)).join(`
113
+ `)}var X2=["up","down","left","right","space","enter","cancel"],fu={actions:new Set(X2),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]])};function cd(t,e){if(typeof t=="string")return fu.aliases.get(t)===e;for(let r of t)if(r!==void 0&&cd(r,e))return!0;return!1}function Z2(t,e){if(t===e)return;let r=t.split(`
114
114
  `),n=e.split(`
115
- `),o=[];for(let i=0;i<Math.max(r.length,n.length);i++)r[i]!==n[i]&&o.push(i);return o}var W2=globalThis.process.platform.startsWith("win"),td=Symbol("clack:cancel");function le(t){return t===td}function au(t,e){let r=t;r.isTTY&&r.setRawMode(e)}function uD({input:t=Go.stdin,output:e=Go.stdout,overwrite:r=!0,hideCursor:n=!0}={}){let o=vn.createInterface({input:t,output:e,prompt:"",tabSize:1});vn.emitKeypressEvents(t,o),t.isTTY&&t.setRawMode(!0);let i=(a,{name:s,sequence:u})=>{let c=String(a);if(od([c,s,u],"cancel")){n&&e.write(wt.cursor.show),process.exit(0);return}if(!r)return;vn.moveCursor(e,s==="return"?0:-1,s==="return"?-1:0,()=>{vn.clearLine(e,1,()=>{t.once("keypress",i)})})};return n&&e.write(wt.cursor.hide),t.once("keypress",i),()=>{t.off("keypress",i),n&&e.write(wt.cursor.show),t.isTTY&&!W2&&t.setRawMode(!1),o.terminal=!1,o.close()}}var Y2=Object.defineProperty,J2=(t,e,r)=>e in t?Y2(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Zt=(t,e,r)=>(J2(t,typeof e!="symbol"?e+"":e,r),r),Sa=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=Go.stdin,output:o=Go.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(td);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let n=new tD.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=ed.default.createInterface({input:this.input,output:n,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),ed.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),au(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(wt.cursor.show),this.output.off("resize",this.render),au(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(wt.cursor.show),this.output.off("resize",this.render),au(this.input,!1),e(td)})})}onKeypress(e,r){if(this.state==="error"&&(this.state="active"),r?.name&&(!this._track&&su.aliases.has(r.name)&&this.emit("cursor",su.aliases.get(r.name)),su.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")}od([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(`
116
- `),au(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=Qy(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
117
- `).length-1;this.output.write(wt.cursor.move(-999,e*-1))}render(){let e=Qy(this._render(this)??"",process.stdout.columns,{hard:!0});if(e!==this._prevFrame){if(this.state==="initial")this.output.write(wt.cursor.hide);else{let r=G2(this._prevFrame,e);if(this.restoreCursor(),r&&r?.length===1){let n=r[0];this.output.write(wt.cursor.move(0,n)),this.output.write(wt.erase.lines(1));let o=e.split(`
118
- `);this.output.write(o[n]),this._prevFrame=e,this.output.write(wt.cursor.move(0,o.length-n-1));return}if(r&&r?.length>1){let n=r[0];this.output.write(wt.cursor.move(0,n)),this.output.write(wt.erase.down());let o=e.split(`
115
+ `),o=[];for(let i=0;i<Math.max(r.length,n.length);i++)r[i]!==n[i]&&o.push(i);return o}var Q2=globalThis.process.platform.startsWith("win"),ad=Symbol("clack:cancel");function le(t){return t===ad}function lu(t,e){let r=t;r.isTTY&&r.setRawMode(e)}function pD({input:t=Go.stdin,output:e=Go.stdout,overwrite:r=!0,hideCursor:n=!0}={}){let o=_n.createInterface({input:t,output:e,prompt:"",tabSize:1});_n.emitKeypressEvents(t,o),t.isTTY&&t.setRawMode(!0);let i=(a,{name:s,sequence:u})=>{let c=String(a);if(cd([c,s,u],"cancel")){n&&e.write(vt.cursor.show),process.exit(0);return}if(!r)return;_n.moveCursor(e,s==="return"?0:-1,s==="return"?-1:0,()=>{_n.clearLine(e,1,()=>{t.once("keypress",i)})})};return n&&e.write(vt.cursor.hide),t.once("keypress",i),()=>{t.off("keypress",i),n&&e.write(vt.cursor.show),t.isTTY&&!Q2&&t.setRawMode(!1),o.terminal=!1,o.close()}}var eP=Object.defineProperty,tP=(t,e,r)=>e in t?eP(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Qt=(t,e,r)=>(tP(t,typeof e!="symbol"?e+"":e,r),r),xa=class{constructor(e,r=!0){Qt(this,"input"),Qt(this,"output"),Qt(this,"_abortSignal"),Qt(this,"rl"),Qt(this,"opts"),Qt(this,"_render"),Qt(this,"_track",!1),Qt(this,"_prevFrame",""),Qt(this,"_subscribers",new Map),Qt(this,"_cursor",0),Qt(this,"state","initial"),Qt(this,"error",""),Qt(this,"value");let{input:n=Go.stdin,output:o=Go.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(ad);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let n=new aD.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=id.default.createInterface({input:this.input,output:n,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),id.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),lu(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(vt.cursor.show),this.output.off("resize",this.render),lu(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(vt.cursor.show),this.output.off("resize",this.render),lu(this.input,!1),e(ad)})})}onKeypress(e,r){if(this.state==="error"&&(this.state="active"),r?.name&&(!this._track&&fu.aliases.has(r.name)&&this.emit("cursor",fu.aliases.get(r.name)),fu.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")}cd([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(`
116
+ `),lu(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=oD(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
117
+ `).length-1;this.output.write(vt.cursor.move(-999,e*-1))}render(){let e=oD(this._render(this)??"",process.stdout.columns,{hard:!0});if(e!==this._prevFrame){if(this.state==="initial")this.output.write(vt.cursor.hide);else{let r=Z2(this._prevFrame,e);if(this.restoreCursor(),r&&r?.length===1){let n=r[0];this.output.write(vt.cursor.move(0,n)),this.output.write(vt.erase.lines(1));let o=e.split(`
118
+ `);this.output.write(o[n]),this._prevFrame=e,this.output.write(vt.cursor.move(0,o.length-n-1));return}if(r&&r?.length>1){let n=r[0];this.output.write(vt.cursor.move(0,n)),this.output.write(vt.erase.down());let o=e.split(`
119
119
  `).slice(n);this.output.write(o.join(`
120
- `)),this._prevFrame=e;return}this.output.write(wt.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}},uu=class extends Sa{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(wt.cursor.move(0,-1)),this.value=r,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};var X2;X2=new WeakMap;var Z2=Object.defineProperty,Q2=(t,e,r)=>e in t?Z2(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,eD=(t,e,r)=>(Q2(t,typeof e!="symbol"?e+"":e,r),r),cu=class extends Sa{constructor(e){super(e,!1),eD(this,"options"),eD(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 lu=class extends Sa{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}${rD.default.inverse(r)}${n.join("")}`}get cursor(){return this._cursor}constructor(e){super(e),this.on("finalize",()=>{this.value||(this.value=e.defaultValue)})}};var cr=fe(require("node:process"),1),W=fe(Xf(),1),du=fe(Yf(),1);function ek(){return cr.default.platform!=="win32"?cr.default.env.TERM!=="linux":!!cr.default.env.CI||!!cr.default.env.WT_SESSION||!!cr.default.env.TERMINUS_SUBLIME||cr.default.env.ConEmuTask==="{cmd::Cmder}"||cr.default.env.TERM_PROGRAM==="Terminus-Sublime"||cr.default.env.TERM_PROGRAM==="vscode"||cr.default.env.TERM==="xterm-256color"||cr.default.env.TERM==="alacritty"||cr.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var id=ek(),Qe=(t,e)=>id?t:e,tk=Qe("\u25C6","*"),cD=Qe("\u25A0","x"),lD=Qe("\u25B2","x"),ud=Qe("\u25C7","o"),rk=Qe("\u250C","T"),He=Qe("\u2502","|"),Wo=Qe("\u2514","\u2014"),ad=Qe("\u25CF",">"),sd=Qe("\u25CB"," "),Mq=Qe("\u25FB","[\u2022]"),qq=Qe("\u25FC","[+]"),Hq=Qe("\u25FB","[ ]"),Vq=Qe("\u25AA","\u2022"),zq=Qe("\u2500","-"),Kq=Qe("\u256E","+"),Gq=Qe("\u251C","+"),Wq=Qe("\u256F","+"),nk=Qe("\u25CF","\u2022"),ok=Qe("\u25C6","*"),ik=Qe("\u25B2","!"),ak=Qe("\u25A0","x"),cd=t=>{switch(t){case"initial":case"active":return W.default.cyan(tk);case"cancel":return W.default.red(cD);case"error":return W.default.yellow(lD);case"submit":return W.default.green(ud)}},sk=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((f,d,p)=>{let h=d===0&&u,m=d===p.length-1&&c;return h||m?W.default.dim("..."):n(f,d+s===e)})},Ut=t=>new lu({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,render(){let e=`${W.default.gray(He)}
121
- ${cd(this.state)} ${t.message}
120
+ `)),this._prevFrame=e;return}this.output.write(vt.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}},du=class extends xa{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(vt.cursor.move(0,-1)),this.value=r,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};var rP;rP=new WeakMap;var nP=Object.defineProperty,oP=(t,e,r)=>e in t?nP(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,iD=(t,e,r)=>(oP(t,typeof e!="symbol"?e+"":e,r),r),pu=class extends xa{constructor(e){super(e,!1),iD(this,"options"),iD(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 hu=class extends xa{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}${sD.default.inverse(r)}${n.join("")}`}get cursor(){return this._cursor}constructor(e){super(e),this.on("finalize",()=>{this.value||(this.value=e.defaultValue)})}};var fr=pe(require("node:process"),1),W=pe(rd(),1),gu=pe(ed(),1);function iP(){return fr.default.platform!=="win32"?fr.default.env.TERM!=="linux":!!fr.default.env.CI||!!fr.default.env.WT_SESSION||!!fr.default.env.TERMINUS_SUBLIME||fr.default.env.ConEmuTask==="{cmd::Cmder}"||fr.default.env.TERM_PROGRAM==="Terminus-Sublime"||fr.default.env.TERM_PROGRAM==="vscode"||fr.default.env.TERM==="xterm-256color"||fr.default.env.TERM==="alacritty"||fr.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var ld=iP(),et=(t,e)=>ld?t:e,aP=et("\u25C6","*"),hD=et("\u25A0","x"),mD=et("\u25B2","x"),pd=et("\u25C7","o"),sP=et("\u250C","T"),Ve=et("\u2502","|"),Wo=et("\u2514","\u2014"),fd=et("\u25CF",">"),dd=et("\u25CB"," "),Gq=et("\u25FB","[\u2022]"),Wq=et("\u25FC","[+]"),Yq=et("\u25FB","[ ]"),Jq=et("\u25AA","\u2022"),Xq=et("\u2500","-"),Zq=et("\u256E","+"),Qq=et("\u251C","+"),eH=et("\u256F","+"),uP=et("\u25CF","\u2022"),cP=et("\u25C6","*"),lP=et("\u25B2","!"),fP=et("\u25A0","x"),hd=t=>{switch(t){case"initial":case"active":return W.default.cyan(aP);case"cancel":return W.default.red(hD);case"error":return W.default.yellow(mD);case"submit":return W.default.green(pd)}},dP=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((f,d,p)=>{let h=d===0&&u,m=d===p.length-1&&c;return h||m?W.default.dim("..."):n(f,d+s===e)})},Mt=t=>new hu({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,render(){let e=`${W.default.gray(Ve)}
121
+ ${hd(this.state)} ${t.message}
122
122
  `,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()}
123
- ${W.default.yellow(He)} ${n}
123
+ ${W.default.yellow(Ve)} ${n}
124
124
  ${W.default.yellow(Wo)} ${W.default.yellow(this.error)}
125
- `;case"submit":return`${e}${W.default.gray(He)} ${W.default.dim(this.value||t.placeholder)}`;case"cancel":return`${e}${W.default.gray(He)} ${W.default.strikethrough(W.default.dim(this.value??""))}${this.value?.trim()?`
126
- ${W.default.gray(He)}`:""}`;default:return`${e}${W.default.cyan(He)} ${n}
125
+ `;case"submit":return`${e}${W.default.gray(Ve)} ${W.default.dim(this.value||t.placeholder)}`;case"cancel":return`${e}${W.default.gray(Ve)} ${W.default.strikethrough(W.default.dim(this.value??""))}${this.value?.trim()?`
126
+ ${W.default.gray(Ve)}`:""}`;default:return`${e}${W.default.cyan(Ve)} ${n}
127
127
  ${W.default.cyan(Wo)}
128
- `}}}).prompt();var ue=t=>{let e=t.active??"Yes",r=t.inactive??"No";return new uu({active:e,inactive:r,initialValue:t.initialValue??!0,render(){let n=`${W.default.gray(He)}
129
- ${cd(this.state)} ${t.message}
130
- `,o=this.value?e:r;switch(this.state){case"submit":return`${n}${W.default.gray(He)} ${W.default.dim(o)}`;case"cancel":return`${n}${W.default.gray(He)} ${W.default.strikethrough(W.default.dim(o))}
131
- ${W.default.gray(He)}`;default:return`${n}${W.default.cyan(He)} ${this.value?`${W.default.green(ad)} ${e}`:`${W.default.dim(sd)} ${W.default.dim(e)}`} ${W.default.dim("/")} ${this.value?`${W.default.dim(sd)} ${W.default.dim(r)}`:`${W.default.green(ad)} ${r}`}
128
+ `}}}).prompt();var ue=t=>{let e=t.active??"Yes",r=t.inactive??"No";return new du({active:e,inactive:r,initialValue:t.initialValue??!0,render(){let n=`${W.default.gray(Ve)}
129
+ ${hd(this.state)} ${t.message}
130
+ `,o=this.value?e:r;switch(this.state){case"submit":return`${n}${W.default.gray(Ve)} ${W.default.dim(o)}`;case"cancel":return`${n}${W.default.gray(Ve)} ${W.default.strikethrough(W.default.dim(o))}
131
+ ${W.default.gray(Ve)}`;default:return`${n}${W.default.cyan(Ve)} ${this.value?`${W.default.green(fd)} ${e}`:`${W.default.dim(dd)} ${W.default.dim(e)}`} ${W.default.dim("/")} ${this.value?`${W.default.dim(dd)} ${W.default.dim(r)}`:`${W.default.green(fd)} ${r}`}
132
132
  ${W.default.cyan(Wo)}
133
- `}}}).prompt()},mt=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(ad)} ${o} ${r.hint?W.default.dim(`(${r.hint})`):""}`;case"cancelled":return`${W.default.strikethrough(W.default.dim(o))}`;default:return`${W.default.dim(sd)} ${W.default.dim(o)}`}};return new cu({options:t.options,initialValue:t.initialValue,render(){let r=`${W.default.gray(He)}
134
- ${cd(this.state)} ${t.message}
135
- `;switch(this.state){case"submit":return`${r}${W.default.gray(He)} ${e(this.options[this.cursor],"selected")}`;case"cancel":return`${r}${W.default.gray(He)} ${e(this.options[this.cursor],"cancelled")}
136
- ${W.default.gray(He)}`;default:return`${r}${W.default.cyan(He)} ${sk({cursor:this.cursor,options:this.options,maxItems:t.maxItems,style:(n,o)=>e(n,o?"active":"inactive")}).join(`
137
- ${W.default.cyan(He)} `)}
133
+ `}}}).prompt()},gt=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(fd)} ${o} ${r.hint?W.default.dim(`(${r.hint})`):""}`;case"cancelled":return`${W.default.strikethrough(W.default.dim(o))}`;default:return`${W.default.dim(dd)} ${W.default.dim(o)}`}};return new pu({options:t.options,initialValue:t.initialValue,render(){let r=`${W.default.gray(Ve)}
134
+ ${hd(this.state)} ${t.message}
135
+ `;switch(this.state){case"submit":return`${r}${W.default.gray(Ve)} ${e(this.options[this.cursor],"selected")}`;case"cancel":return`${r}${W.default.gray(Ve)} ${e(this.options[this.cursor],"cancelled")}
136
+ ${W.default.gray(Ve)}`;default:return`${r}${W.default.cyan(Ve)} ${dP({cursor:this.cursor,options:this.options,maxItems:t.maxItems,style:(n,o)=>e(n,o?"active":"inactive")}).join(`
137
+ ${W.default.cyan(Ve)} `)}
138
138
  ${W.default.cyan(Wo)}
139
- `}}}).prompt()};var Wn=(t="")=>{process.stdout.write(`${W.default.gray(Wo)} ${W.default.red(t)}
139
+ `}}}).prompt()};var Jn=(t="")=>{process.stdout.write(`${W.default.gray(Wo)} ${W.default.red(t)}
140
140
 
141
- `)},ee=(t="")=>{process.stdout.write(`${W.default.gray(rk)} ${t}
142
- `)},K=(t="")=>{process.stdout.write(`${W.default.gray(He)}
141
+ `)},ee=(t="")=>{process.stdout.write(`${W.default.gray(sP)} ${t}
142
+ `)},K=(t="")=>{process.stdout.write(`${W.default.gray(Ve)}
143
143
  ${W.default.gray(Wo)} ${t}
144
144
 
145
- `)},l={message:(t="",{symbol:e=W.default.gray(He)}={})=>{let r=[`${W.default.gray(He)}`];if(t){let[n,...o]=t.split(`
146
- `);r.push(`${e} ${n}`,...o.map(i=>`${W.default.gray(He)} ${i}`))}process.stdout.write(`${r.join(`
145
+ `)},l={message:(t="",{symbol:e=W.default.gray(Ve)}={})=>{let r=[`${W.default.gray(Ve)}`];if(t){let[n,...o]=t.split(`
146
+ `);r.push(`${e} ${n}`,...o.map(i=>`${W.default.gray(Ve)} ${i}`))}process.stdout.write(`${r.join(`
147
147
  `)}
148
- `)},info:t=>{l.message(t,{symbol:W.default.blue(nk)})},success:t=>{l.message(t,{symbol:W.default.green(ok)})},step:t=>{l.message(t,{symbol:W.default.green(ud)})},warn:t=>{l.message(t,{symbol:W.default.yellow(ik)})},warning:t=>{l.warn(t)},error:t=>{l.message(t,{symbol:W.default.red(ak)})}},Yq=`${W.default.gray(He)} `;var be=({indicator:t="dots"}={})=>{let e=id?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],r=id?80:120,n=process.env.CI==="true",o,i,a=!1,s="",u,c=performance.now(),f=_=>{let S=_>1?"Something went wrong":"Canceled";a&&g(S,_)},d=()=>f(2),p=()=>f(1),h=()=>{process.on("uncaughtExceptionMonitor",d),process.on("unhandledRejection",d),process.on("SIGINT",p),process.on("SIGTERM",p),process.on("exit",f)},m=()=>{process.removeListener("uncaughtExceptionMonitor",d),process.removeListener("unhandledRejection",d),process.removeListener("SIGINT",p),process.removeListener("SIGTERM",p),process.removeListener("exit",f)},y=()=>{if(u===void 0)return;n&&process.stdout.write(`
148
+ `)},info:t=>{l.message(t,{symbol:W.default.blue(uP)})},success:t=>{l.message(t,{symbol:W.default.green(cP)})},step:t=>{l.message(t,{symbol:W.default.green(pd)})},warn:t=>{l.message(t,{symbol:W.default.yellow(lP)})},warning:t=>{l.warn(t)},error:t=>{l.message(t,{symbol:W.default.red(fP)})}},tH=`${W.default.gray(Ve)} `;var be=({indicator:t="dots"}={})=>{let e=ld?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],r=ld?80:120,n=process.env.CI==="true",o,i,a=!1,s="",u,c=performance.now(),f=_=>{let S=_>1?"Something went wrong":"Canceled";a&&g(S,_)},d=()=>f(2),p=()=>f(1),h=()=>{process.on("uncaughtExceptionMonitor",d),process.on("unhandledRejection",d),process.on("SIGINT",p),process.on("SIGTERM",p),process.on("exit",f)},m=()=>{process.removeListener("uncaughtExceptionMonitor",d),process.removeListener("unhandledRejection",d),process.removeListener("SIGINT",p),process.removeListener("SIGTERM",p),process.removeListener("exit",f)},y=()=>{if(u===void 0)return;n&&process.stdout.write(`
149
149
  `);let _=u.split(`
150
- `);process.stdout.write(du.cursor.move(-999,_.length-1)),process.stdout.write(du.erase.down(_.length))},D=_=>_.replace(/\.+$/,""),v=_=>{let S=(performance.now()-_)/1e3,P=Math.floor(S/60),F=Math.floor(S%60);return P>0?`[${P}m ${F}s]`:`[${F}s]`},E=(_="")=>{a=!0,o=uD(),s=D(_),c=performance.now(),process.stdout.write(`${W.default.gray(He)}
151
- `);let S=0,P=0;h(),i=setInterval(()=>{if(n&&s===u)return;y(),u=s;let F=W.default.magenta(e[S]);if(n)process.stdout.write(`${F} ${s}...`);else if(t==="timer")process.stdout.write(`${F} ${s} ${v(c)}`);else{let B=".".repeat(Math.floor(P)).slice(0,3);process.stdout.write(`${F} ${s}${B}`)}S=S+1<e.length?S+1:0,P=P<e.length?P+.125:0},r)},g=(_="",S=0)=>{a=!1,clearInterval(i),y();let P=S===0?W.default.green(ud):S===1?W.default.red(cD):W.default.red(lD);s=D(_??s),t==="timer"?process.stdout.write(`${P} ${s} ${v(c)}
152
- `):process.stdout.write(`${P} ${s}
153
- `),m(),o()};return{start:E,stop:g,message:(_="")=>{s=D(_??s)}}};var PA=require("node:child_process"),_e=require("node:fs"),Ml=require("node:os"),ye=fe(require("node:path")),rr=require("node:process"),qr=fe(hu());var Ot=require("fs"),Aa=(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,Ot.existsSync)(r)||(0,Ot.existsSync)(n)?"bun":(0,Ot.existsSync)(o)||(0,Ot.existsSync)(i)?"pnpm":(0,Ot.existsSync)(a)?"yarn":(0,Ot.existsSync)(s)||(0,Ot.existsSync)(u)?"npm":e},mu=(t=Aa(),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"}},fD=(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,Ot.existsSync)(r)||(0,Ot.existsSync)(n)?"bunx":(0,Ot.existsSync)(o)||(0,Ot.existsSync)(i)?"pnpm exec":(0,Ot.existsSync)(a)?"yarn dlx":(0,Ot.existsSync)(s)||(0,Ot.existsSync)(u)?"npx":e};function gu(t,e){if(isNaN(t)||isNaN(e))throw new Error("Cannot compare against non-numbers");return t===e?0:t<e?-1:1}function hD(t=[],e=[]){return t.length&&!e.length?-1:!t.length&&e.length?1:0}function pd(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 Yo="0|[1-9]\\d*",fk="\\d*[a-zA-Z-][a-zA-Z0-9-]*",dk=`(?<major>${Yo})\\.(?<minor>${Yo})\\.(?<patch>${Yo})`,dD=`(?:${Yo}|${fk})`,mD=`(?:-(?<prerelease>${dD}(?:\\.${dD})*))`,pD="[0-9A-Za-z-]+",gD=`(?:\\+(?<buildmetadata>${pD}(?:\\.${pD})*))`,yD=`v?${dk}${mD}?${gD}?`,DD=new RegExp(`^${yD}$`),bD="(?:<|>)?=?",pk="x|X|\\*",dd=`${Yo}|${pk}`,yu=`[v=\\s]*(?<major>${dd})(?:\\.(?<minor>${dd})(?:\\.(?<patch>${dd})${mD}?${gD}?)?)?`,wD=new RegExp(`^(?<operator>~>?|\\^|${bD})\\s*${yu}$`),vD=new RegExp(`^(?<operator>${bD})\\s*(${yD})$|^$`);function hd(t){return typeof t=="number"&&!Number.isNaN(t)&&(!Number.isFinite(t)||0<=t&&t<=Number.MAX_SAFE_INTEGER)}var md=256;var hk=new RegExp(`^${Yo}$`);function Ft(t){return t.split(".").filter(Boolean).map(e=>{if(hk.test(e)){let r=Number(e);if(hd(r))return r}return e})}function Er(t){return t.split(".").filter(Boolean)}function En(t,e){let r=Number(t);if(!hd(r))throw new TypeError(e);return r}function Zr(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 kt(t,e){return t===e?0:gu(t.major,e.major)||gu(t.minor,e.minor)||gu(t.patch,e.patch)||hD(t.prerelease,e.prerelease)||pd(t.prerelease,e.prerelease)}function gd(t){return t.toFixed(0)}function qt(t){let e=gd(t.major),r=gd(t.minor),n=gd(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 mk(t,e){if(Zr(e))return!0;let r=kt(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 Du(t,e){for(let r of e)if(!mk(t,r))return!1;if(t.prerelease&&t.prerelease.length>0){for(let r of e){if(Zr(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 Oa(t,e){return e.some(r=>Du(t,r))}function gk(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 Fa(t=[],e){let r=gk(t);if(!e)return r;let n=Ft(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 _n(t,e,r={}){let n=r.build!==void 0?Er(r.build):t.build??[];switch(e){case"premajor":return{major:t.major+1,minor:0,patch:0,prerelease:Fa(t.prerelease,r.prerelease),build:n};case"preminor":return{major:t.major,minor:t.minor+1,patch:0,prerelease:Fa(t.prerelease,r.prerelease),build:n};case"prepatch":return{major:t.major,minor:t.minor,patch:t.patch+1,prerelease:Fa(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:Fa(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:Fa(t.prerelease,r.prerelease),build:n};default:throw new TypeError(`Cannot increment version: invalid argument ${e}`)}}var bu={major:Number.NaN,minor:Number.NaN,patch:Number.NaN,prerelease:[],build:[]},Jo={operator:void 0,...bu};function yd(t,e){return kt(t,e)>0}function Qt(t,e){return kt(t,e)<0}function yk(t){let r=t.match(vD)?.groups;if(!r)return null;let{operator:n,prerelease:o,buildmetadata:i}=r,a=r.major?{major:En(r.major,`Cannot parse comparator ${t}: invalid major version`),minor:En(r.minor,`Cannot parse comparator ${t}: invalid minor version`),patch:En(r.patch,`Cannot parse comparator ${t}: invalid patch version`),prerelease:o?Ft(o):[],build:i?Er(i):[]}:bu;return{operator:n||void 0,...a}}function Te(t){return!t||t.toLowerCase()==="x"||t==="*"}function Dk(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?Ft(t.prerelease):[],build:[]}}function bk(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:Ft(t.prerelease),build:[]}:{operator:"<=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:[],build:[]}}function wk(t){let e=t.match(new RegExp(`^${yu}`)),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(`^${yu}\\s*$`))?.groups;if(!s)return null;let u=Dk(r),c=bk(s);return[u,c].filter(Boolean)}function vk(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[Jo];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=Ft(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 Ck(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[Jo];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=Ft(t.prerelease??"");return[{operator:">=",major:o,minor:i,patch:a,prerelease:s},{operator:"<",major:o,minor:i+1,patch:0}]}function Ek(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=Ft(t.prerelease??""),u=Er(t.build??"");return[{operator:"<",major:o,minor:i,patch:a,prerelease:s,build:u}]}function _k(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=Ft(t.prerelease??""),s=Er(t.build??"");return[{operator:"<=",major:n,minor:o,patch:i,prerelease:a,build:s}]}function Sk(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=Ft(t.prerelease??""),u=Er(t.build??"");return[{operator:">",major:o,minor:i,patch:a,prerelease:s,build:u}]}function xk(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[Jo];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=Ft(t.prerelease??""),u=Er(t.build??"");return[{operator:">=",major:o,minor:i,patch:a,prerelease:s,build:u}]}function Ak(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[Jo];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=Ft(t.prerelease??""),u=Er(t.build??"");return[{operator:void 0,major:o,minor:i,patch:a,prerelease:s,build:u}]}function Ok(t){let e=t.match(wD)?.groups;if(!e)return yk(t);switch(e.operator){case"^":return vk(e);case"~":case"~>":return Ck(e);case"<":return Ek(e);case"<=":return _k(e);case">":return Sk(e);case">=":return xk(e);case"=":case"":return Ak(e);default:throw new Error(`Cannot parse version range: '${e.operator}' is not a valid operator`)}}function Fk(t){return t.split(/\s+/).flatMap(Ok)}function wu(t){let e=t.replaceAll(/(?<=<|>|=|~|\^)(\s+)/g,"").split(/\s*\|\|\s*/).map(r=>wk(r)||Fk(r));if(e.some(r=>r.includes(null)))throw new TypeError(`Cannot parse version range: range "${t}" is invalid`);return e}function ge(t){if(typeof t!="string")throw new TypeError(`Cannot parse version as version must be a string: received ${typeof t}`);if(t.length>md)throw new TypeError(`Cannot parse version as version length is too long: length is ${t.length}, max length is ${md}`);t=t.trim();let e=t.match(DD)?.groups;if(!e)throw new TypeError(`Cannot parse version: ${t}`);let r=En(e.major,`Cannot parse version ${t}: invalid major version`),n=En(e.minor,`Cannot parse version ${t}: invalid minor version`),o=En(e.patch,`Cannot parse version ${t}: invalid patch version`),i=e.prerelease?Ft(e.prerelease):[],a=e.buildmetadata?Er(e.buildmetadata):[];return{major:r,minor:n,patch:o,prerelease:i,build:a}}function CD(t,e){let r=t.operator,n=e.operator;if(r===void 0)return Zr(t)?!0:Oa(t,[[e]]);if(n===void 0)return Zr(e)?!0:Oa(e,[[t]]);let o=kt(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 kk(t){return t.every(e=>e.some(r=>Pk(r)))}function Pk(t){for(let e=0;e<t.length-1;e++){let r=t[e];for(let n of t.slice(e+1))if(!CD(r,n))return!1}return!0}function ED(t,e){return kk([t,e])&&t.some(r=>e.some(n=>r.every(o=>n.every(i=>CD(o,i)))))}function _D(t){try{return ge(t),!0}catch{return!1}}function SD(t,e){return kt(t,e)>=0}var na=fe(B0()),kg=fe(Qp()),$A=fe(zb()),ql=fe(el());function nE(t,e){let n=["normal","bold","dim","italic","underline","strikethrough"].indexOf(t),o="\x1B[";return o+n+"m"+e+o+"0m"}var st=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?nE("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))+nE("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(`
154
- `)}};async function tl(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 Ee(){let t=await tl("@capgo/cli")??"",e=t?.split(".")[0];t!==Cr.version&&l.warning(`\u{1F6A8} You are using @capgo/cli@${Cr.version} it's not the latest version.
155
- Please use @capgo/cli@${t}" or @capgo/cli@${e} to keep up to date with the latest features and bug fixes.`)}function X8(t){return new Promise(e=>{setTimeout(e,t)})}function Z8(t){return new Date(t||"").toLocaleTimeString()}async function vt(t,e,r,n,o,i="\u2705"){await me(r,{channel:t,event:n,icon:i,user_id:e,...o?{tags:{"app-id":o}}:{},notify:!1})}async function Q8(t,e,r,n){if(le(e))throw await vt(t,r,n,"canceled",void 0,"\u{1F937}"),new Error("Command cancelled")}async function eN(t,e,r){try{let n=await mr(),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),l.error(`Cannot get stats ${q(n)}`)}return[]}function tN(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}/settings/organization/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 rN(t,e,r,n,o,i){let a=tN(t);if(!a)return{};a.snag&&await vt(e,r,n,a.snag);let s=Z8(t.created_at),u=t.action,c=t.version_id?`(version #${t.version_id})`:"",f=t.version?` (version ${t.version})`:c,d=`${a.summary({data:t,baseAppUrl:o,baseUrl:i})}${f}`;return{row:[s,t.device_id,u,d],stop:a.stop}}async function pm(t,e,r,n,o){let i=!0,a=await mr(),s=`${a.hostWeb}/app/${r}`;await vt(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,f=new Set,d=be(),p=`${a.host}/docs/plugins/updater/debugging/#sent-from-the-backend`;for(d.start(`Waiting for logs (Expect delay of 30 sec) more info: ${p}`);i;){await X8(5e3);let h=await eN(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 y=h.filter(E=>{let g=`${E.app_id}|${E.device_id}|${E.action}|${E.version_id}|${E.created_at}`;return f.has(g)?!1:(f.add(g),!0)}).sort((E,g)=>new Date(E.created_at).getTime()-new Date(g.created_at).getTime()),D=new st;D.headers=["Time","Device","Key","Message"],D.theme=st.roundTheme,D.rows=[];let v=!1;for(let E of y){let{row:g,stop:_}=await rN(E,t,n,e,s,a.hostWeb);g&&D.rows.push(g),_&&(v=!0)}if(D.rows.length&&(d.stop(""),l.info(D.toString()),d.start(`Waiting for logs (Expect delay of 30 sec) more info: ${p}`)),v){i=!1;break}}}return d.stop("Stop watching logs"),Promise.resolve()}async function oE(t,e){ee("Debug Live update in Capgo"),await Ee(),e.apikey=e.apikey||ne();let r=await te();t=pe(t,r?.config);let n=e.device;if(!e.apikey)throw l.error("Missing API key, you need to provide an API key to delete your app"),new Error("Missing API key");if(!t)throw l.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 Ct(o,t),a=await ue({message:"Automatic check if update working in device ?"});await Q8("debug",a,i,e.apikey),a?(l.info(`Wait logs sent to Capgo from ${t} device, Please background your app and open it again \u{1F4AA}`),await pm("debug",e.apikey,t,i,n),K("Done \u2705")):K("Canceled \u274C")}var hm=require("node:buffer"),iE=require("node:crypto"),nN=(()=>{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 oN(t){let e=4294967295;for(let r=0;r<t.length;r++){let n=t[r];e=nN[(e^n)&255]^e>>>8}return e=e^4294967295,(e>>>0).toString(16).padStart(8,"0")}async function an(t,e="sha256"){let r=hm.Buffer.isBuffer(t)?t:hm.Buffer.from(t);if(e==="crc32")return oN(r);let n=(0,iE.createHash)(e);return n.update(r),n.digest("hex")}var Os=fe(Nx());async function Lx(){let t=await(0,Os.loadConfig)();return{config:t.app.extConfig,path:t.app.extConfigFilePath}}async function ag(t,e,r=!1){let n=await(0,Os.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,Os.writeConfig)(o,n.app.extConfigFilePath))}async function Qi(t,e=!1){await ag("CapacitorUpdater",t,e)}var oa=".capgo_key",nr=".capgo_key_v2",Hl=`${oa}.pub`,fn=`${nr}.pub`,SA="https://capgo.app",xA="https://files.capgo.app",AA="https://api.capgo.app",OA="https://console.capgo.app",Pg=12e4,L5=1024*1024*20,j5=1024*1024*1024,U5=1024*1024*99,Dr="package.json",ia=/^(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,q=t=>t?`
156
- ${$A.default.render(t)}`:"";function Ul(t){return new Promise(e=>{setTimeout(e,t)})}function IA(t){return(0,qr.isMonorepo)(t)||(0,qr.isNXMonorepo)(t)}function Dt(t){return(0,qr.isMonorepo)(t)?(0,qr.findMonorepoRoot)(t):(0,qr.isNXMonorepo)(t)?(0,qr.findNXMonorepoRoot)(t):t}function TA(t=Dt((0,rr.cwd)()),e=void 0){let r=e?.split(",")[0];if(r&&!(0,_e.existsSync)(r)){let o=`Package.json at ${r} does not exist`;throw l.error(o),new Error(o)}let n=(0,_e.readFileSync)(r??(0,ye.join)(t,Dr));return JSON.parse(n)}function $g(t=Dt((0,rr.cwd)()),e=void 0){return TA(t,e).scripts}function Fr(t=Dt((0,rr.cwd)()),e=void 0){return TA(t,e).version??""}function FA(t){let e=t.replace("^","").replace("~","");if(_D(e))try{let r=ge(e);return qt(r)}catch{return e}return e}async function Hr(t,e=(0,rr.cwd)(),r){if(t!=="@capgo/capacitor-updater")return null;let n=r?(0,ye.dirname)(r):e;try{let u=`${t}/package.json`,{createRequire:c}=await import("node:module"),d=c((0,ye.join)(n,"package.json")).resolve(u),p=JSON.parse((0,_e.readFileSync)(d,"utf-8"));if(p.version)return p.version}catch{}let o=n,i=ye.default.parse(o).root;for(;o!==i;){let u=(0,ye.join)(o,"node_modules",t,Dr);if((0,_e.existsSync)(u))try{let f=JSON.parse((0,_e.readFileSync)(u,"utf-8"));if(f.version)return f.version}catch{}let c=(0,ye.dirname)(o);if(c===o)break;o=c}let a=null,s=(0,ye.join)(e,"ios","App","Podfile");if((0,_e.existsSync)(s))try{let c=(0,_e.readFileSync)(s,"utf-8").match(/pod\s+['"]CapgoCapacitorUpdater['"],\s*:path\s*=>\s*['"]([^'"]+)['"]/);c?.[1]&&(a=(0,ye.resolve)((0,ye.join)(e,"ios","App",c[1])))}catch{}if(!a){let u=(0,ye.join)(e,"android","capacitor.settings.gradle");if((0,_e.existsSync)(u))try{let f=(0,_e.readFileSync)(u,"utf-8").match(/project\(':capgo-capacitor-updater'\)\.projectDir\s*=\s*new\s+File\(['"]([^'"]+)['"]/);f?.[1]&&(a=(0,ye.resolve)((0,ye.join)(e,"android",f[1])).replace(/\/android$/,""))}catch{}}if(a){let u=(0,ye.join)(a,Dr);if((0,_e.existsSync)(u))try{let c=JSON.parse((0,_e.readFileSync)(u,"utf-8"));if(c.version)return c.version}catch{}}try{let c=(await br(e)).get(t);if(c)return c}catch{}return null}async function br(t=Dt((0,rr.cwd)()),e=void 0){let r=e?.split(",");if(r??=[(0,ye.join)(t,Dr)],r){for(let o of r)if(!(0,_e.existsSync)(o)){let i=`Package.json at ${o} does not exist`;throw l.error(i),new Error(i)}}let n=new Map;for(let o of r){let i=(0,_e.readFileSync)(o),a=JSON.parse(i);for(let s in a.dependencies)n.set(s,FA(a.dependencies[s]));for(let s in a.devDependencies)n.set(s,FA(a.devDependencies[s]))}return n}async function te(){try{let t=await Lx();if(!t){let e="No capacitor config file found, run `cap init` first";throw l.error(e),new Error(e)}return t}catch(t){let e=`No capacitor config file found, run \`cap init\` first ${q(t)}`;throw l.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 ag(t,r)),r}async function $s(t){return Ig("CapacitorUpdater",t)}async function mr(){try{let t=await te(),e={host:t?.config?.plugins?.CapacitorUpdater?.localHost||SA,hostWeb:t?.config?.plugins?.CapacitorUpdater?.localWebHost||OA,hostFilesApi:t?.config?.plugins?.CapacitorUpdater?.localApiFiles||xA,hostApi:t?.config?.plugins?.CapacitorUpdater?.localApi||AA};return t?.config?.plugins?.CapacitorUpdater?.localSupa&&t?.config?.plugins?.CapacitorUpdater?.localSupaAnon&&(l.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:SA,hostWeb:OA,hostFilesApi:xA,hostApi:AA}}}var M5=/([A-Za-z0-9]+)\.(java|swift|kt|scala)$/;async function Vl(){let t=await mr();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 l.info(`Local config ${q(t)}`),t}}async function RA(){let t=await mr();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:j5,maxChunkSize:U5,alertUploadSize:L5}}}async function re(t,e,r){let n=await Vl();if(e&&r&&(l.info("Using custom supabase instance from provided options"),n.supaHost=e,n.supaKey=r),!n.supaHost||!n.supaKey)throw l.error("Cannot connect to server please try again later"),new Error("Cannot connect to server please try again later");return(0,na.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){l.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 l.error(i),new Error("Invalid API key or insufficient permissions.")}}async function BA(t,e){let{data:r}=await t.rpc("is_paying_org",{orgid:e}).single();return r||!1}async function NA(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 _t=(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))(_t||{}),aa=(t,e)=>t>=e;async function LA(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 l.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")?(l.info("Please accept/deny the organization invitation before trying to access the app"),new Error("Organization invitation pending")):(l.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 l.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 jA(t,e,r){let{data:n,error:o}=await t.rpc("get_organization_cli_warnings",{orgid:e,cli_version:r});if(o){l.error(`Cannot get cli warnings: ${q(o)}`);return}if(n.length>0){l.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"){l.error(`Invalid cli warning: ${a}`);continue}let s=a;s.fatal?(l.error(`${s.message.replaceAll("\\n",`
150
+ `);process.stdout.write(gu.cursor.move(-999,_.length-1)),process.stdout.write(gu.erase.down(_.length))},D=_=>_.replace(/\.+$/,""),v=_=>{let S=(performance.now()-_)/1e3,k=Math.floor(S/60),F=Math.floor(S%60);return k>0?`[${k}m ${F}s]`:`[${F}s]`},E=(_="")=>{a=!0,o=pD(),s=D(_),c=performance.now(),process.stdout.write(`${W.default.gray(Ve)}
151
+ `);let S=0,k=0;h(),i=setInterval(()=>{if(n&&s===u)return;y(),u=s;let F=W.default.magenta(e[S]);if(n)process.stdout.write(`${F} ${s}...`);else if(t==="timer")process.stdout.write(`${F} ${s} ${v(c)}`);else{let B=".".repeat(Math.floor(k)).slice(0,3);process.stdout.write(`${F} ${s}${B}`)}S=S+1<e.length?S+1:0,k=k<e.length?k+.125:0},r)},g=(_="",S=0)=>{a=!1,clearInterval(i),y();let k=S===0?W.default.green(pd):S===1?W.default.red(hD):W.default.red(mD);s=D(_??s),t==="timer"?process.stdout.write(`${k} ${s} ${v(c)}
152
+ `):process.stdout.write(`${k} ${s}
153
+ `),m(),o()};return{start:E,stop:g,message:(_="")=>{s=D(_??s)}}};var BA=require("node:child_process"),_e=require("node:fs"),zl=require("node:os"),ye=pe(require("node:path")),nr=require("node:process"),zr=pe(Du());var Ft=require("fs"),Oa=(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,Ft.existsSync)(r)||(0,Ft.existsSync)(n)?"bun":(0,Ft.existsSync)(o)||(0,Ft.existsSync)(i)?"pnpm":(0,Ft.existsSync)(a)?"yarn":(0,Ft.existsSync)(s)||(0,Ft.existsSync)(u)?"npm":e},bu=(t=Oa(),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"}},gD=(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,Ft.existsSync)(r)||(0,Ft.existsSync)(n)?"bunx":(0,Ft.existsSync)(o)||(0,Ft.existsSync)(i)?"pnpm exec":(0,Ft.existsSync)(a)?"yarn dlx":(0,Ft.existsSync)(s)||(0,Ft.existsSync)(u)?"npx":e};function wu(t,e){if(isNaN(t)||isNaN(e))throw new Error("Cannot compare against non-numbers");return t===e?0:t<e?-1:1}function bD(t=[],e=[]){return t.length&&!e.length?-1:!t.length&&e.length?1:0}function Dd(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 Yo="0|[1-9]\\d*",gP="\\d*[a-zA-Z-][a-zA-Z0-9-]*",yP=`(?<major>${Yo})\\.(?<minor>${Yo})\\.(?<patch>${Yo})`,yD=`(?:${Yo}|${gP})`,wD=`(?:-(?<prerelease>${yD}(?:\\.${yD})*))`,DD="[0-9A-Za-z-]+",vD=`(?:\\+(?<buildmetadata>${DD}(?:\\.${DD})*))`,CD=`v?${yP}${wD}?${vD}?`,ED=new RegExp(`^${CD}$`),_D="(?:<|>)?=?",DP="x|X|\\*",yd=`${Yo}|${DP}`,vu=`[v=\\s]*(?<major>${yd})(?:\\.(?<minor>${yd})(?:\\.(?<patch>${yd})${wD}?${vD}?)?)?`,SD=new RegExp(`^(?<operator>~>?|\\^|${_D})\\s*${vu}$`),xD=new RegExp(`^(?<operator>${_D})\\s*(${CD})$|^$`);function bd(t){return typeof t=="number"&&!Number.isNaN(t)&&(!Number.isFinite(t)||0<=t&&t<=Number.MAX_SAFE_INTEGER)}var wd=256;var bP=new RegExp(`^${Yo}$`);function Pt(t){return t.split(".").filter(Boolean).map(e=>{if(bP.test(e)){let r=Number(e);if(bd(r))return r}return e})}function Ar(t){return t.split(".").filter(Boolean)}function xn(t,e){let r=Number(t);if(!bd(r))throw new TypeError(e);return r}function rn(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 kt(t,e){return t===e?0:wu(t.major,e.major)||wu(t.minor,e.minor)||wu(t.patch,e.patch)||bD(t.prerelease,e.prerelease)||Dd(t.prerelease,e.prerelease)}function vd(t){return t.toFixed(0)}function Ht(t){let e=vd(t.major),r=vd(t.minor),n=vd(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 wP(t,e){if(rn(e))return!0;let r=kt(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 Cu(t,e){for(let r of e)if(!wP(t,r))return!1;if(t.prerelease&&t.prerelease.length>0){for(let r of e){if(rn(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 Fa(t,e){return e.some(r=>Cu(t,r))}function vP(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 Pa(t=[],e){let r=vP(t);if(!e)return r;let n=Pt(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 An(t,e,r={}){let n=r.build!==void 0?Ar(r.build):t.build??[];switch(e){case"premajor":return{major:t.major+1,minor:0,patch:0,prerelease:Pa(t.prerelease,r.prerelease),build:n};case"preminor":return{major:t.major,minor:t.minor+1,patch:0,prerelease:Pa(t.prerelease,r.prerelease),build:n};case"prepatch":return{major:t.major,minor:t.minor,patch:t.patch+1,prerelease:Pa(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:Pa(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:Pa(t.prerelease,r.prerelease),build:n};default:throw new TypeError(`Cannot increment version: invalid argument ${e}`)}}var Eu={major:Number.NaN,minor:Number.NaN,patch:Number.NaN,prerelease:[],build:[]},Jo={operator:void 0,...Eu};function Cd(t,e){return kt(t,e)>0}function er(t,e){return kt(t,e)<0}function CP(t){let r=t.match(xD)?.groups;if(!r)return null;let{operator:n,prerelease:o,buildmetadata:i}=r,a=r.major?{major:xn(r.major,`Cannot parse comparator ${t}: invalid major version`),minor:xn(r.minor,`Cannot parse comparator ${t}: invalid minor version`),patch:xn(r.patch,`Cannot parse comparator ${t}: invalid patch version`),prerelease:o?Pt(o):[],build:i?Ar(i):[]}:Eu;return{operator:n||void 0,...a}}function Te(t){return!t||t.toLowerCase()==="x"||t==="*"}function EP(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?Pt(t.prerelease):[],build:[]}}function _P(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:Pt(t.prerelease),build:[]}:{operator:"<=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:[],build:[]}}function SP(t){let e=t.match(new RegExp(`^${vu}`)),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(`^${vu}\\s*$`))?.groups;if(!s)return null;let u=EP(r),c=_P(s);return[u,c].filter(Boolean)}function xP(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[Jo];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=Pt(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 AP(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[Jo];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=Pt(t.prerelease??"");return[{operator:">=",major:o,minor:i,patch:a,prerelease:s},{operator:"<",major:o,minor:i+1,patch:0}]}function OP(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=Pt(t.prerelease??""),u=Ar(t.build??"");return[{operator:"<",major:o,minor:i,patch:a,prerelease:s,build:u}]}function FP(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=Pt(t.prerelease??""),s=Ar(t.build??"");return[{operator:"<=",major:n,minor:o,patch:i,prerelease:a,build:s}]}function PP(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=Pt(t.prerelease??""),u=Ar(t.build??"");return[{operator:">",major:o,minor:i,patch:a,prerelease:s,build:u}]}function kP(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[Jo];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=Pt(t.prerelease??""),u=Ar(t.build??"");return[{operator:">=",major:o,minor:i,patch:a,prerelease:s,build:u}]}function $P(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[Jo];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=Pt(t.prerelease??""),u=Ar(t.build??"");return[{operator:void 0,major:o,minor:i,patch:a,prerelease:s,build:u}]}function IP(t){let e=t.match(SD)?.groups;if(!e)return CP(t);switch(e.operator){case"^":return xP(e);case"~":case"~>":return AP(e);case"<":return OP(e);case"<=":return FP(e);case">":return PP(e);case">=":return kP(e);case"=":case"":return $P(e);default:throw new Error(`Cannot parse version range: '${e.operator}' is not a valid operator`)}}function TP(t){return t.split(/\s+/).flatMap(IP)}function _u(t){let e=t.replaceAll(/(?<=<|>|=|~|\^)(\s+)/g,"").split(/\s*\|\|\s*/).map(r=>SP(r)||TP(r));if(e.some(r=>r.includes(null)))throw new TypeError(`Cannot parse version range: range "${t}" is invalid`);return e}function ge(t){if(typeof t!="string")throw new TypeError(`Cannot parse version as version must be a string: received ${typeof t}`);if(t.length>wd)throw new TypeError(`Cannot parse version as version length is too long: length is ${t.length}, max length is ${wd}`);t=t.trim();let e=t.match(ED)?.groups;if(!e)throw new TypeError(`Cannot parse version: ${t}`);let r=xn(e.major,`Cannot parse version ${t}: invalid major version`),n=xn(e.minor,`Cannot parse version ${t}: invalid minor version`),o=xn(e.patch,`Cannot parse version ${t}: invalid patch version`),i=e.prerelease?Pt(e.prerelease):[],a=e.buildmetadata?Ar(e.buildmetadata):[];return{major:r,minor:n,patch:o,prerelease:i,build:a}}function AD(t,e){let r=t.operator,n=e.operator;if(r===void 0)return rn(t)?!0:Fa(t,[[e]]);if(n===void 0)return rn(e)?!0:Fa(e,[[t]]);let o=kt(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 RP(t){return t.every(e=>e.some(r=>BP(r)))}function BP(t){for(let e=0;e<t.length-1;e++){let r=t[e];for(let n of t.slice(e+1))if(!AD(r,n))return!1}return!0}function OD(t,e){return RP([t,e])&&t.some(r=>e.some(n=>r.every(o=>n.every(i=>AD(o,i)))))}function FD(t){try{return ge(t),!0}catch{return!1}}function PD(t,e){return kt(t,e)>=0}var na=pe(M0()),Rg=pe(oh()),NA=pe(Jb()),Kl=pe(ol());function uE(t,e){let n=["normal","bold","dim","italic","underline","strikethrough"].indexOf(t),o="\x1B[";return o+n+"m"+e+o+"0m"}var ut=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?uE("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))+uE("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(`
154
+ `)}};async function il(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 Ee(){let t=await il("@capgo/cli")??"",e=t?.split(".")[0];t!==xr.version&&l.warning(`\u{1F6A8} You are using @capgo/cli@${xr.version} it's not the latest version.
155
+ Please use @capgo/cli@${t}" or @capgo/cli@${e} to keep up to date with the latest features and bug fixes.`)}function rN(t){return new Promise(e=>{setTimeout(e,t)})}function nN(t){return new Date(t||"").toLocaleTimeString()}async function Ct(t,e,r,n,o,i="\u2705"){await me(r,{channel:t,event:n,icon:i,user_id:e,...o?{tags:{"app-id":o}}:{},notify:!1})}async function oN(t,e,r,n){if(le(e))throw await Ct(t,r,n,"canceled",void 0,"\u{1F937}"),new Error("Command cancelled")}async function iN(t,e,r){try{let n=await yr(),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),l.error(`Cannot get stats ${q(n)}`)}return[]}function aN(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}/settings/organization/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 sN(t,e,r,n,o,i){let a=aN(t);if(!a)return{};a.snag&&await Ct(e,r,n,a.snag);let s=nN(t.created_at),u=t.action,c=t.version_id?`(version #${t.version_id})`:"",f=t.version?` (version ${t.version})`:c,d=`${a.summary({data:t,baseAppUrl:o,baseUrl:i})}${f}`;return{row:[s,t.device_id,u,d],stop:a.stop}}async function Dm(t,e,r,n,o){let i=!0,a=await yr(),s=`${a.hostWeb}/app/${r}`;await Ct(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,f=new Set,d=be(),p=`${a.host}/docs/plugins/updater/debugging/#sent-from-the-backend`;for(d.start(`Waiting for logs (Expect delay of 30 sec) more info: ${p}`);i;){await rN(5e3);let h=await iN(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 y=h.filter(E=>{let g=`${E.app_id}|${E.device_id}|${E.action}|${E.version_id}|${E.created_at}`;return f.has(g)?!1:(f.add(g),!0)}).sort((E,g)=>new Date(E.created_at).getTime()-new Date(g.created_at).getTime()),D=new ut;D.headers=["Time","Device","Key","Message"],D.theme=ut.roundTheme,D.rows=[];let v=!1;for(let E of y){let{row:g,stop:_}=await sN(E,t,n,e,s,a.hostWeb);g&&D.rows.push(g),_&&(v=!0)}if(D.rows.length&&(d.stop(""),l.info(D.toString()),d.start(`Waiting for logs (Expect delay of 30 sec) more info: ${p}`)),v){i=!1;break}}}return d.stop("Stop watching logs"),Promise.resolve()}async function cE(t,e){ee("Debug Live update in Capgo"),await Ee(),e.apikey=e.apikey||ne();let r=await te();t=fe(t,r?.config);let n=e.device;if(!e.apikey)throw l.error("Missing API key, you need to provide an API key to delete your app"),new Error("Missing API key");if(!t)throw l.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 Et(o,t),a=await ue({message:"Automatic check if update working in device ?"});await oN("debug",a,i,e.apikey),a?(l.info(`Wait logs sent to Capgo from ${t} device, Please background your app and open it again \u{1F4AA}`),await Dm("debug",e.apikey,t,i,n),K("Done \u2705")):K("Canceled \u274C")}var bm=require("node:buffer"),lE=require("node:crypto"),uN=(()=>{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 cN(t){let e=4294967295;for(let r=0;r<t.length;r++){let n=t[r];e=uN[(e^n)&255]^e>>>8}return e=e^4294967295,(e>>>0).toString(16).padStart(8,"0")}async function ln(t,e="sha256"){let r=bm.Buffer.isBuffer(t)?t:bm.Buffer.from(t);if(e==="crc32")return cN(r);let n=(0,lE.createHash)(e);return n.update(r),n.digest("hex")}var Fs=pe(qx());async function Hx(){let t=await(0,Fs.loadConfig)();return{config:t.app.extConfig,path:t.app.extConfigFilePath}}async function fg(t,e,r=!1){let n=await(0,Fs.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,Fs.writeConfig)(o,n.app.extConfigFilePath))}async function Qi(t,e=!1){await fg("CapacitorUpdater",t,e)}var oa=".capgo_key",or=".capgo_key_v2",Gl=`${oa}.pub`,mn=`${or}.pub`,PA="https://capgo.app",kA="https://files.capgo.app",$A="https://api.capgo.app",IA="https://console.capgo.app",Bg=12e4,HM=1024*1024*20,VM=1024*1024*1024,zM=1024*1024*99,wr="package.json",ia=/^(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,q=t=>t?`
156
+ ${NA.default.render(t)}`:"";function Vl(t){return new Promise(e=>{setTimeout(e,t)})}function LA(t){return(0,zr.isMonorepo)(t)||(0,zr.isNXMonorepo)(t)}function bt(t){return(0,zr.isMonorepo)(t)?(0,zr.findMonorepoRoot)(t):(0,zr.isNXMonorepo)(t)?(0,zr.findNXMonorepoRoot)(t):t}function jA(t=bt((0,nr.cwd)()),e=void 0){let r=e?.split(",")[0];if(r&&!(0,_e.existsSync)(r)){let o=`Package.json at ${r} does not exist`;throw l.error(o),new Error(o)}let n=(0,_e.readFileSync)(r??(0,ye.join)(t,wr));return JSON.parse(n)}function Ng(t=bt((0,nr.cwd)()),e=void 0){return jA(t,e).scripts}function Ir(t=bt((0,nr.cwd)()),e=void 0){return jA(t,e).version??""}function TA(t){let e=t.replace("^","").replace("~","");if(FD(e))try{let r=ge(e);return Ht(r)}catch{return e}return e}async function Kr(t,e=(0,nr.cwd)(),r){if(t!=="@capgo/capacitor-updater")return null;let n=r?(0,ye.dirname)(r):e;try{let u=`${t}/package.json`,{createRequire:c}=await import("node:module"),d=c((0,ye.join)(n,"package.json")).resolve(u),p=JSON.parse((0,_e.readFileSync)(d,"utf-8"));if(p.version)return p.version}catch{}let o=n,i=ye.default.parse(o).root;for(;o!==i;){let u=(0,ye.join)(o,"node_modules",t,wr);if((0,_e.existsSync)(u))try{let f=JSON.parse((0,_e.readFileSync)(u,"utf-8"));if(f.version)return f.version}catch{}let c=(0,ye.dirname)(o);if(c===o)break;o=c}let a=null,s=(0,ye.join)(e,"ios","App","Podfile");if((0,_e.existsSync)(s))try{let c=(0,_e.readFileSync)(s,"utf-8").match(/pod\s+['"]CapgoCapacitorUpdater['"],\s*:path\s*=>\s*['"]([^'"]+)['"]/);c?.[1]&&(a=(0,ye.resolve)((0,ye.join)(e,"ios","App",c[1])))}catch{}if(!a){let u=(0,ye.join)(e,"android","capacitor.settings.gradle");if((0,_e.existsSync)(u))try{let f=(0,_e.readFileSync)(u,"utf-8").match(/project\(':capgo-capacitor-updater'\)\.projectDir\s*=\s*new\s+File\(['"]([^'"]+)['"]/);f?.[1]&&(a=(0,ye.resolve)((0,ye.join)(e,"android",f[1])).replace(/\/android$/,""))}catch{}}if(a){let u=(0,ye.join)(a,wr);if((0,_e.existsSync)(u))try{let c=JSON.parse((0,_e.readFileSync)(u,"utf-8"));if(c.version)return c.version}catch{}}try{let c=(await vr(e)).get(t);if(c)return c}catch{}return null}async function vr(t=bt((0,nr.cwd)()),e=void 0){let r=e?.split(",");if(r??=[(0,ye.join)(t,wr)],r){for(let o of r)if(!(0,_e.existsSync)(o)){let i=`Package.json at ${o} does not exist`;throw l.error(i),new Error(i)}}let n=new Map;for(let o of r){let i=(0,_e.readFileSync)(o),a=JSON.parse(i);for(let s in a.dependencies)n.set(s,TA(a.dependencies[s]));for(let s in a.devDependencies)n.set(s,TA(a.devDependencies[s]))}return n}async function te(){try{let t=await Hx();if(!t){let e="No capacitor config file found, run `cap init` first";throw l.error(e),new Error(e)}return t}catch(t){let e=`No capacitor config file found, run \`cap init\` first ${q(t)}`;throw l.error(e),new Error(e)}}async function Lg(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 fg(t,r)),r}async function Is(t){return Lg("CapacitorUpdater",t)}async function yr(){try{let t=await te(),e={host:t?.config?.plugins?.CapacitorUpdater?.localHost||PA,hostWeb:t?.config?.plugins?.CapacitorUpdater?.localWebHost||IA,hostFilesApi:t?.config?.plugins?.CapacitorUpdater?.localApiFiles||kA,hostApi:t?.config?.plugins?.CapacitorUpdater?.localApi||$A};return t?.config?.plugins?.CapacitorUpdater?.localSupa&&t?.config?.plugins?.CapacitorUpdater?.localSupaAnon&&(l.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:PA,hostWeb:IA,hostFilesApi:kA,hostApi:$A}}}var KM=/([A-Za-z0-9]+)\.(java|swift|kt|scala)$/;async function Wl(){let t=await yr();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 l.info(`Local config ${q(t)}`),t}}async function UA(){let t=await yr();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:VM,maxChunkSize:zM,alertUploadSize:HM}}}async function re(t,e,r){let n=await Wl();if(e&&r&&(l.info("Using custom supabase instance from provided options"),n.supaHost=e,n.supaKey=r),!n.supaHost||!n.supaKey)throw l.error("Cannot connect to server please try again later"),new Error("Cannot connect to server please try again later");return(0,na.createClient)(n.supaHost,n.supaKey,{auth:{persistSession:!1},global:{headers:{capgkey:t}}})}async function GM(t,e,r){let{data:n}=await t.rpc("is_allowed_capgkey",{apikey:e,keymode:r}).single();if(!n){l.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 l.error(i),new Error("Invalid API key or insufficient permissions.")}}async function MA(t,e){let{data:r}=await t.rpc("is_paying_org",{orgid:e}).single();return r||!1}async function qA(t,e){let{data:r}=await t.rpc("is_trial_org",{orgid:e}).single();return r||0}async function WM(t,e){let{data:r}=await t.rpc("is_allowed_action_org",{orgid:e}).single();return!!r}async function YM(t,e,r){let{data:n}=await t.rpc("is_allowed_action",{apikey:r,appid:e}).single();return!!n}var St=(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))(St||{}),aa=(t,e)=>t>=e;async function HA(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 l.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")?(l.info("Please accept/deny the organization invitation before trying to access the app"),new Error("Organization invitation pending")):(l.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 l.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 VA(t,e,r){let{data:n,error:o}=await t.rpc("get_organization_cli_warnings",{orgid:e,cli_version:r});if(o){l.error(`Cannot get cli warnings: ${q(o)}`);return}if(n.length>0){l.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"){l.error(`Invalid cli warning: ${a}`);continue}let s=a;s.fatal?(l.error(`${s.message.replaceAll("\\n",`
157
157
  `)}`),i=new Error(s.message)):l.warn(`${s.message.replaceAll("\\n",`
158
- `)}`)}if(i)throw l.error("Please fix the warnings and try again."),i;l.info("End of cli warnings.")}}async function UA(t,e,r,n,o=!0){let i=await Vl();if(!await(n?V5(t,n,r):H5(t,e)))throw l.error(`You need to upgrade your plan to continue to use capgo.
158
+ `)}`)}if(i)throw l.error("Please fix the warnings and try again."),i;l.info("End of cli warnings.")}}async function zA(t,e,r,n,o=!0){let i=await Wl();if(!await(n?YM(t,n,r):WM(t,e)))throw l.error(`You need to upgrade your plan to continue to use capgo.
159
159
  Upgrade here: ${i.hostWeb}/settings/organization/plans
160
- `),Ul(100),Promise.resolve().then(()=>(Og(),Ag)).then(c=>{c.default(`${i.hostWeb}/settings/organization/plans`)}),Ul(500),new Error("Plan upgrade required");let[s,u]=await Promise.all([NA(t,e),BA(t,e)]);s>0&&o&&!u&&l.warn(`WARNING !!
160
+ `),Vl(100),Promise.resolve().then(()=>(Ig(),$g)).then(c=>{c.default(`${i.hostWeb}/settings/organization/plans`)}),Vl(500),new Error("Plan upgrade required");let[s,u]=await Promise.all([qA(t,e),MA(t,e)]);s>0&&o&&!u&&l.warn(`WARNING !!
161
161
  Trial expires in ${s} days, upgrade here: ${i.hostWeb}/settings/organization/plans
162
- `)}async function MA(t,e,r,n,o=!0){let i=await Vl(),{data:a}=await t.rpc("is_allowed_action_org_action",{orgid:e,actions:["storage"]});if(!a)throw l.error(`You need to upgrade your plan to continue to use capgo.
162
+ `)}async function KA(t,e,r,n,o=!0){let i=await Wl(),{data:a}=await t.rpc("is_allowed_action_org_action",{orgid:e,actions:["storage"]});if(!a)throw l.error(`You need to upgrade your plan to continue to use capgo.
163
163
  Upgrade here: ${i.hostWeb}/settings/organization/plans
164
- `),Ul(100),Promise.resolve().then(()=>(Og(),Ag)).then(c=>{c.default(`${i.hostWeb}/settings/organization/plans`)}),Ul(500),new Error("Plan upgrade required for upload");let[s,u]=await Promise.all([NA(t,e),BA(t,e)]);s>0&&o&&!u&&l.warn(`WARNING !!
164
+ `),Vl(100),Promise.resolve().then(()=>(Ig(),$g)).then(c=>{c.default(`${i.hostWeb}/settings/organization/plans`)}),Vl(500),new Error("Plan upgrade required for upload");let[s,u]=await Promise.all([qA(t,e),MA(t,e)]);s>0&&o&&!u&&l.warn(`WARNING !!
165
165
  Trial expires in ${s} days, upgrade here: ${i.hostWeb}/settings/organization/plans
166
- `)}function ne(t=!1){let e=rr.env.CAPGO_TOKEN?.trim();if(e)return t||l.info("Use CAPGO_TOKEN environment variable"),e;let r=(0,Ml.homedir)(),n,o=`${r}/.capgo`;if((0,_e.existsSync)(o)&&(t||l.info(`Use global API key ${o}`),n=(0,_e.readFileSync)(o,"utf8").trim()),o=".capgo",!n&&(0,_e.existsSync)(o)&&(t||l.info(`Use local API key ${o}`),n=(0,_e.readFileSync)(o,"utf8").trim()),!n){let i=`Cannot find API key in local folder or global, please login first with ${rt().runner} @capgo/cli login`;throw l.error(i),new Error(i)}return n}async function*Tg(t){let e=await(0,_e.readdirSync)(t,{withFileTypes:!0});for(let r of e){let n=(0,ye.resolve)(t,r.name);r.isDirectory()&&!r.name.startsWith(".")&&!r.name.startsWith("node_modules")&&!r.name.startsWith("dist")?yield*Tg(n):yield n}}function sa(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 zl(){let t=(0,rr.cwd)(),e=!1,r=(0,ye.resolve)(t,"tsconfig.json");(0,_e.existsSync)(r)&&(e=!0);for await(let n of Tg(t)){if(n.includes("angular.json"))return l.info("Found angular project"),e?"angular-ts":"angular-js";if(n.includes("nuxt.config.js")||n.includes("nuxt.config.ts"))return l.info("Found nuxtjs project"),e?"nuxtjs-ts":"nuxtjs-js";if(n.includes("next.config.js")||n.includes("next.config.mjs"))return l.info("Found nextjs project"),e?"nextjs-ts":"nextjs-js";if(n.includes("svelte.config.js"))return l.info("Found sveltekit project"),e?"sveltekit-ts":"sveltekit-js";if(n.includes("rolluconfig.js"))return l.info("Found svelte project"),e?"svelte-ts":"svelte-js";if(n.includes("vue.config.js"))return l.info("Found vue project"),e?"vue-ts":"vue-js";if(n.includes(Dr)){let o=(0,ye.dirname)(n),i=await br(o);if(i){if(i.get("react"))return l.info("Found react project test"),e?"react-ts":"react-js";if(i.get("vue"))return l.info("Found vue project"),e?"vue-ts":"vue-js"}}}return"unknown"}function qA(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 Rg(t){if(t==="angular")return l.info("Angular project detected"),"build";if(t==="nuxtjs")return l.info("Nuxtjs project detected"),"generate";if(t==="nextjs"){if(l.info("Nextjs project detected"),l.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"),l.warn("Please make sure you have the output: 'export' and distDir: 'dist' in your next.config.js"),!await ue({message:"Do you want to continue?"})){let r="Build command selection aborted by user";throw l.error(r),new Error(r)}return"build"}if(t==="sveltekit"){if(l.info("Sveltekit project detected"),l.warn("Please make sure you have the adapter-static installed: https://kit.svelte.dev/docs/adapter-static"),l.warn("Please make sure you have the pages: 'dist' and assets: 'dest', in your svelte.config.js adapter"),!await ue({message:"Do you want to continue?"})){let r="Build command selection aborted by user";throw l.error(r),new Error(r)}return"build"}return"build"}async function HA(){let t=/(main|index)\.(ts|tsx|js|jsx)$/,e="",r=(0,rr.cwd)(),n=r.split("/").length;for await(let o of Tg(r))if(o.split("/").length-n<=2&&t.test(o)){e=o,l.info(`Found main file here ${o}`);break}return e}async function Bg(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 VA(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 na.FunctionsHttpError){let a=await i.error.context.json();l.error(`Upload URL error: ${a.status||JSON.stringify(a)}`)}else l.error(`Cannot get upload url: ${i.error.message}`);return""}return i.data.url}catch(o){l.error(`Cannot get upload url ${q(o)}`)}return""}async function*zA(t){let e=(0,_e.readdirSync)(t,{withFileTypes:!0});for(let r of e){let n=(0,ye.join)(t,r.name);r.isDirectory()?yield*zA(n):yield n}}var KA="5.10.0",GA="6.25.0",Is="7.0.30";function Mn(t,e="5.10.0",r="6.25.0",n="7.25.0"){return!!(t.major===5&&Qt(t,ge(e))||t.major===6&&Qt(t,ge(r))||t.major===7&&Qt(t,ge(n)))}async function WA(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 zA(t)){if(r.some(s=>n.includes(s))){l.info(`Ignoring file ${n}, please ensure you have only required files in your dist folder`);continue}let o=(0,_e.readFileSync)(n);if(o.length===0){l.info(`Ignoring empty file ${n}, please ensure you have only required files in your dist folder`);continue}let i=await an(o,"sha256"),a=(0,ye.relative)(t,n);a.startsWith("/")&&(a=a.substring(1)),e.push({file:a,hash:i})}return e}async function Kl(t){return(0,Ml.platform)()==="win32"?K5(t):z5(t)}function z5(t){let e=new kg.default;return e.addLocalFolder(t),e.toBuffer()}async function K5(t){l.info("Zipping file windows mode");let e=new kg.default,r=(n,o)=>{let i=(0,_e.readdirSync)(n);for(let a of i){let s=(0,ye.join)(n,a),u=(0,_e.statSync)(s);if(u.isFile()){let c=(0,_e.readFileSync)(s);e.addFile((0,ye.join)(o,a).split(ye.sep).join("/"),c)}else u.isDirectory()&&r(s,(0,ye.join)(o,a))}};return r(t,""),e.toBuffer()}async function YA(t,e,r,n,o,i,a,s){return new Promise((u,c)=>{me(t,{channel:"app",event:"App TUS upload",icon:"\u23EB",user_id:r,tags:{"app-id":n},notify:!1}),new ql.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(d){if(l.error(`Error uploading bundle: ${d.message}`),d instanceof ql.DetailedError){let p=d.originalResponse?.getBody(),h=JSON.parse(p||'{"error": "unknown error"}');c(h.status||h.error||h.message||"unknown error")}else c(d.message||d.toString()||"unknown error")},onProgress(d,p){let h=(d/p*100).toFixed(2);i.message(`Uploaded ${h}%`)},async onSuccess(){await me(t,{channel:"app",event:"App TUS done",icon:"\u23EB",user_id:r,tags:{"app-id":n},notify:!1}).catch(),u(!0)}}).start()})}async function JA(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 na.FunctionsHttpError){let a=await i.error.context.json();l.error(`Cannot delete failed version: ${a.status||JSON.stringify(a)}`)}else l.error(`Cannot delete failed version: ${i.error.message}`);return}return i.data?.status}catch(o){if(o instanceof na.FunctionsHttpError){let i=await o.context.json();l.error(`Cannot delete failed version: ${i.message||JSON.stringify(i)}`)}else l.error(`Cannot delete failed version: ${q(o)}`)}}async function Gl(t,e){if(!e.app_id||!e.name||!e.created_by)return l.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 me(t,e,r){try{r&&l.info(`Get remove config: for ${e.event}`);let n=await Vl();r&&l.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&&l.error(`Failed to send LogSnag event: ${s.error}`)}finally{clearTimeout(i)}}catch(n){r&&(l.error("Failed to send Stats event details:"),l.error(q(n)))}}async function ua(t,e){let{error:r,data:n}=await t.rpc("get_orgs_v6");if(r)throw l.error("Cannot get the list of organizations - exiting"),l.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 l.error("Could not get organization please create an organization first"),new Error("No organizations available");if(o.length===0)throw l.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 mt({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(le(i))throw l.error("Canceled organization selection, exiting"),new Error("Organization selection cancelled");let a=i,s=n.find(u=>u.gid===a);return l.info(`Using the organization "${s.name}" as the app owner`),s}async function ae(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 l.error("Cannot auth user with apikey"),new Error("Cannot authenticate user with provided API key");return i}async function Ct(t,e){let{data:r,error:n}=await t.from("apps").select("owner_org").eq("app_id",e).single();if(!r||n)throw l.error(`Cannot get organization id for app id ${e}`),q(n),new Error(`Cannot get organization id for app id ${e}`);return r.owner_org}function ca(t){return new Date(t||"").toLocaleString()}var kA=!1,ra="npm",Ps="install",Fg="npx";function rt(){if(kA)return{pm:ra,command:Ps,installCommand:`${ra} ${Ps}`,runner:Fg};let t=Dt((0,rr.cwd)());return ra=Aa(t,"npm"),Ps=mu(ra),kA=!0,Fg=fD(t),{pm:ra,command:Ps,installCommand:`${ra} ${Ps}`,runner:Fg}}function XA(t){return(0,_e.readdirSync)(t,{withFileTypes:!0}).flatMap(n=>{let o=(0,ye.join)(t,n.name);return n.isDirectory()?XA(o):o.split(`node_modules${ye.sep}`)[1]||o})}async function Ng(t,e){let r=e?e.split(","):[],n;try{n=await br("",t)}catch(f){throw l.error("Invalid package.json, JSON parsing failed"),console.error("json parse error: ",f),f instanceof Error?f:new Error("Invalid package.json")}let o=t?.split(",")[0],i=o?ye.default.resolve(o).replace(Dr,""):Dt((0,rr.cwd)());if(!n)throw l.error("Missing dependencies section in package.json"),new Error("Missing dependencies section in package.json");for(let[f,d]of Object.entries(n))if(typeof d!="string")throw l.error(`Invalid dependency ${f}: ${d}, expected string, got ${typeof d}`),new Error(`Invalid dependency ${f}: expected string version`);let a=r.length===0?[(0,ye.join)((0,rr.cwd)(),"node_modules")]:r;if(!a.some(f=>(0,_e.existsSync)(f))){let f=Aa(i,"npm"),d=mu(f);throw l.error(`Missing node_modules folder at ${a.join(", ")}, please run ${f} ${d}`),new Error("Missing node_modules folder")}let u=!1,c=await Promise.all(Array.from(n.entries()).map(async([f,d])=>{let p=!1,h=!1,m=d;for(let y of a){let D=(0,ye.join)(y,f);if((0,_e.existsSync)(D)){p=!0;try{let v=(0,ye.join)(D,Dr);if((0,_e.existsSync)(v)){let E=JSON.parse((0,_e.readFileSync)(v,"utf-8"));E.version&&(m=E.version)}}catch{}try{if(XA(D).some(E=>M5.test(E))){h=!0;break}}catch(v){throw l.error(`Error reading node_modules files for ${f} package in ${y}`),console.error(v),v instanceof Error?v:new Error(`Error reading node_modules files for ${f}`)}}}if(!p){u=!0;let y=Aa(i,"npm"),D=mu(y);return l.error(`Missing dependency ${f}, please run ${y} ${D}`),{name:f,version:d}}return{name:f,version:m,native:h}})).catch(()=>[]);if(u||c.find(f=>f.native===void 0))throw l.error("Missing dependencies or invalid dependencies"),l.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 G5(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 W5(t){if(!t)throw l.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 l.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 l.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 l.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 ZA(t,e,r){let{data:n,error:o}=await t.from("channels").select(`version (
166
+ `)}function ne(t=!1){let e=nr.env.CAPGO_TOKEN?.trim();if(e)return t||l.info("Use CAPGO_TOKEN environment variable"),e;let r=(0,zl.homedir)(),n,o=`${r}/.capgo`;if((0,_e.existsSync)(o)&&(t||l.info(`Use global API key ${o}`),n=(0,_e.readFileSync)(o,"utf8").trim()),o=".capgo",!n&&(0,_e.existsSync)(o)&&(t||l.info(`Use local API key ${o}`),n=(0,_e.readFileSync)(o,"utf8").trim()),!n){let i=`Cannot find API key in local folder or global, please login first with ${nt().runner} @capgo/cli login`;throw l.error(i),new Error(i)}return n}async function*jg(t){let e=await(0,_e.readdirSync)(t,{withFileTypes:!0});for(let r of e){let n=(0,ye.resolve)(t,r.name);r.isDirectory()&&!r.name.startsWith(".")&&!r.name.startsWith("node_modules")&&!r.name.startsWith("dist")?yield*jg(n):yield n}}function sa(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 Yl(){let t=(0,nr.cwd)(),e=!1,r=(0,ye.resolve)(t,"tsconfig.json");(0,_e.existsSync)(r)&&(e=!0);for await(let n of jg(t)){if(n.includes("angular.json"))return l.info("Found angular project"),e?"angular-ts":"angular-js";if(n.includes("nuxt.config.js")||n.includes("nuxt.config.ts"))return l.info("Found nuxtjs project"),e?"nuxtjs-ts":"nuxtjs-js";if(n.includes("next.config.js")||n.includes("next.config.mjs"))return l.info("Found nextjs project"),e?"nextjs-ts":"nextjs-js";if(n.includes("svelte.config.js"))return l.info("Found sveltekit project"),e?"sveltekit-ts":"sveltekit-js";if(n.includes("rolluconfig.js"))return l.info("Found svelte project"),e?"svelte-ts":"svelte-js";if(n.includes("vue.config.js"))return l.info("Found vue project"),e?"vue-ts":"vue-js";if(n.includes(wr)){let o=(0,ye.dirname)(n),i=await vr(o);if(i){if(i.get("react"))return l.info("Found react project test"),e?"react-ts":"react-js";if(i.get("vue"))return l.info("Found vue project"),e?"vue-ts":"vue-js"}}}return"unknown"}function GA(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 Ug(t){if(t==="angular")return l.info("Angular project detected"),"build";if(t==="nuxtjs")return l.info("Nuxtjs project detected"),"generate";if(t==="nextjs"){if(l.info("Nextjs project detected"),l.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"),l.warn("Please make sure you have the output: 'export' and distDir: 'dist' in your next.config.js"),!await ue({message:"Do you want to continue?"})){let r="Build command selection aborted by user";throw l.error(r),new Error(r)}return"build"}if(t==="sveltekit"){if(l.info("Sveltekit project detected"),l.warn("Please make sure you have the adapter-static installed: https://kit.svelte.dev/docs/adapter-static"),l.warn("Please make sure you have the pages: 'dist' and assets: 'dest', in your svelte.config.js adapter"),!await ue({message:"Do you want to continue?"})){let r="Build command selection aborted by user";throw l.error(r),new Error(r)}return"build"}return"build"}async function WA(){let t=/(main|index)\.(ts|tsx|js|jsx)$/,e="",r=(0,nr.cwd)(),n=r.split("/").length;for await(let o of jg(r))if(o.split("/").length-n<=2&&t.test(o)){e=o,l.info(`Found main file here ${o}`);break}return e}async function Mg(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 YA(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 na.FunctionsHttpError){let a=await i.error.context.json();l.error(`Upload URL error: ${a.status||JSON.stringify(a)}`)}else l.error(`Cannot get upload url: ${i.error.message}`);return""}return i.data.url}catch(o){l.error(`Cannot get upload url ${q(o)}`)}return""}async function*JA(t){let e=(0,_e.readdirSync)(t,{withFileTypes:!0});for(let r of e){let n=(0,ye.join)(t,r.name);r.isDirectory()?yield*JA(n):yield n}}var XA="5.10.0",ZA="6.25.0",Ts="7.0.30";function Vn(t,e="5.10.0",r="6.25.0",n="7.25.0"){return!!(t.major===5&&er(t,ge(e))||t.major===6&&er(t,ge(r))||t.major===7&&er(t,ge(n)))}async function QA(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 JA(t)){if(r.some(s=>n.includes(s))){l.info(`Ignoring file ${n}, please ensure you have only required files in your dist folder`);continue}let o=(0,_e.readFileSync)(n);if(o.length===0){l.info(`Ignoring empty file ${n}, please ensure you have only required files in your dist folder`);continue}let i=await ln(o,"sha256"),a=(0,ye.relative)(t,n);a.startsWith("/")&&(a=a.substring(1)),e.push({file:a,hash:i})}return e}async function Jl(t){return(0,zl.platform)()==="win32"?XM(t):JM(t)}function JM(t){let e=new Rg.default;return e.addLocalFolder(t),e.toBuffer()}async function XM(t){l.info("Zipping file windows mode");let e=new Rg.default,r=(n,o)=>{let i=(0,_e.readdirSync)(n);for(let a of i){let s=(0,ye.join)(n,a),u=(0,_e.statSync)(s);if(u.isFile()){let c=(0,_e.readFileSync)(s);e.addFile((0,ye.join)(o,a).split(ye.sep).join("/"),c)}else u.isDirectory()&&r(s,(0,ye.join)(o,a))}};return r(t,""),e.toBuffer()}async function eO(t,e,r,n,o,i,a,s){return new Promise((u,c)=>{me(t,{channel:"app",event:"App TUS upload",icon:"\u23EB",user_id:r,tags:{"app-id":n},notify:!1}),new Kl.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(d){if(l.error(`Error uploading bundle: ${d.message}`),d instanceof Kl.DetailedError){let p=d.originalResponse?.getBody(),h=JSON.parse(p||'{"error": "unknown error"}');c(h.status||h.error||h.message||"unknown error")}else c(d.message||d.toString()||"unknown error")},onProgress(d,p){let h=(d/p*100).toFixed(2);i.message(`Uploaded ${h}%`)},async onSuccess(){await me(t,{channel:"app",event:"App TUS done",icon:"\u23EB",user_id:r,tags:{"app-id":n},notify:!1}).catch(),u(!0)}}).start()})}async function tO(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 na.FunctionsHttpError){let a=await i.error.context.json();l.error(`Cannot delete failed version: ${a.status||JSON.stringify(a)}`)}else l.error(`Cannot delete failed version: ${i.error.message}`);return}return i.data?.status}catch(o){if(o instanceof na.FunctionsHttpError){let i=await o.context.json();l.error(`Cannot delete failed version: ${i.message||JSON.stringify(i)}`)}else l.error(`Cannot delete failed version: ${q(o)}`)}}async function Xl(t,e){if(!e.app_id||!e.name||!e.created_by)return l.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 me(t,e,r){try{r&&l.info(`Get remove config: for ${e.event}`);let n=await Wl();r&&l.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&&l.error(`Failed to send LogSnag event: ${s.error}`)}finally{clearTimeout(i)}}catch(n){r&&(l.error("Failed to send Stats event details:"),l.error(q(n)))}}async function ua(t,e){let{error:r,data:n}=await t.rpc("get_orgs_v6");if(r)throw l.error("Cannot get the list of organizations - exiting"),l.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 l.error("Could not get organization please create an organization first"),new Error("No organizations available");if(o.length===0)throw l.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 gt({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(le(i))throw l.error("Canceled organization selection, exiting"),new Error("Organization selection cancelled");let a=i,s=n.find(u=>u.gid===a);return l.info(`Using the organization "${s.name}" as the app owner`),s}async function ae(t,e,r=["all"]){await GM(t,e,r);let{data:n,error:o}=await t.rpc("get_user_id",{apikey:e}).single(),i=(n||"").toString();if(!i||o)throw l.error("Cannot auth user with apikey"),new Error("Cannot authenticate user with provided API key");return i}async function Et(t,e){let{data:r,error:n}=await t.from("apps").select("owner_org").eq("app_id",e).single();if(!r||n)throw l.error(`Cannot get organization id for app id ${e}`),q(n),new Error(`Cannot get organization id for app id ${e}`);return r.owner_org}function ca(t){return new Date(t||"").toLocaleString()}var RA=!1,ra="npm",$s="install",Tg="npx";function nt(){if(RA)return{pm:ra,command:$s,installCommand:`${ra} ${$s}`,runner:Tg};let t=bt((0,nr.cwd)());return ra=Oa(t,"npm"),$s=bu(ra),RA=!0,Tg=gD(t),{pm:ra,command:$s,installCommand:`${ra} ${$s}`,runner:Tg}}function rO(t){return(0,_e.readdirSync)(t,{withFileTypes:!0}).flatMap(n=>{let o=(0,ye.join)(t,n.name);return n.isDirectory()?rO(o):o.split(`node_modules${ye.sep}`)[1]||o})}async function qg(t,e){let r=e?e.split(","):[],n;try{n=await vr("",t)}catch(f){throw l.error("Invalid package.json, JSON parsing failed"),console.error("json parse error: ",f),f instanceof Error?f:new Error("Invalid package.json")}let o=t?.split(",")[0],i=o?ye.default.resolve(o).replace(wr,""):bt((0,nr.cwd)());if(!n)throw l.error("Missing dependencies section in package.json"),new Error("Missing dependencies section in package.json");for(let[f,d]of Object.entries(n))if(typeof d!="string")throw l.error(`Invalid dependency ${f}: ${d}, expected string, got ${typeof d}`),new Error(`Invalid dependency ${f}: expected string version`);let a=r.length===0?[(0,ye.join)((0,nr.cwd)(),"node_modules")]:r;if(!a.some(f=>(0,_e.existsSync)(f))){let f=Oa(i,"npm"),d=bu(f);throw l.error(`Missing node_modules folder at ${a.join(", ")}, please run ${f} ${d}`),new Error("Missing node_modules folder")}let u=!1,c=await Promise.all(Array.from(n.entries()).map(async([f,d])=>{let p=!1,h=!1,m=d;for(let y of a){let D=(0,ye.join)(y,f);if((0,_e.existsSync)(D)){p=!0;try{let v=(0,ye.join)(D,wr);if((0,_e.existsSync)(v)){let E=JSON.parse((0,_e.readFileSync)(v,"utf-8"));E.version&&(m=E.version)}}catch{}try{if(rO(D).some(E=>KM.test(E))){h=!0;break}}catch(v){throw l.error(`Error reading node_modules files for ${f} package in ${y}`),console.error(v),v instanceof Error?v:new Error(`Error reading node_modules files for ${f}`)}}}if(!p){u=!0;let y=Oa(i,"npm"),D=bu(y);return l.error(`Missing dependency ${f}, please run ${y} ${D}`),{name:f,version:d}}return{name:f,version:m,native:h}})).catch(()=>[]);if(u||c.find(f=>f.native===void 0))throw l.error("Missing dependencies or invalid dependencies"),l.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 ZM(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 QM(t){if(!t)throw l.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 l.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 l.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 l.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 nO(t,e,r){let{data:n,error:o}=await t.from("channels").select(`version (
167
167
  native_packages
168
- )`).eq("name",r).eq("app_id",e).single();if(o)throw l.error(`Error fetching native packages: ${o.message}`),new Error(`Error fetching native packages: ${o.message}`);return W5(n.version.native_packages??[])}async function QA(t,e,r,n){let o=be();o.start(`Checking bundle checksum compatibility with channel ${r}`);let i=await G5(t,e,r);if(!i){o.stop(`No checksum found for channel ${r}, the bundle will be uploaded`);return}if(i&&i===n)throw o.stop("Checksum check failed"),l.error(`Cannot upload the same bundle content.
168
+ )`).eq("name",r).eq("app_id",e).single();if(o)throw l.error(`Error fetching native packages: ${o.message}`),new Error(`Error fetching native packages: ${o.message}`);return QM(n.version.native_packages??[])}async function oO(t,e,r,n){let o=be();o.start(`Checking bundle checksum compatibility with channel ${r}`);let i=await ZM(t,e,r);if(!i){o.stop(`No checksum found for channel ${r}, the bundle will be uploaded`);return}if(i&&i===n)throw o.stop("Checksum check failed"),l.error(`Cannot upload the same bundle content.
169
169
  Current bundle checksum matches remote bundle for channel ${r}
170
170
  Did you build your app before uploading?
171
- 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 pe(t,e){return t||e?.plugins?.CapacitorUpdater?.appId||e?.appId}function To(t){if(!t.localVersion)return!0;if(!t.remoteVersion)return!1;try{let e=wu(t.localVersion),r=wu(t.remoteVersion);return ED(e,r)}catch{return!1}}async function Wl(t,e,r,n,o){let i=await Ng(n,o),a=await ZA(t,e,r),s=i.filter(c=>!!c.native).map(c=>{let f=a.get(c.name);return f?{name:c.name,localVersion:c.version,remoteVersion:f.version}:{name:c.name,localVersion:c.version,remoteVersion:void 0}}),u=[...a].filter(([c])=>i.find(f=>f.name===c)===void 0).map(([c,f])=>({name:c,localVersion:void 0,remoteVersion:f.version}));return s.push(...u),{finalCompatibility:s,localDependencies:i}}async function Lg(t,e,r,n){let o=await ZA(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 Yl(t,e,r){let n=await ue({message:"Would you like to sync your project with Capacitor now? This is recommended to ensure encrypted updates work properly."});if(le(n))throw t&&e&&r&&await vt("onboarding-v2",e,r,"canceled","\u{1F937}"),l.error("Canceled Capacitor sync"),new Error("Capacitor sync cancelled");if(n){let o=rt(),i=be();i.start("Running the command...");try{await new Promise((a,s)=>{let u=(0,PA.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"),l.error(`Failed to run Capacitor sync: ${a}`),l.warn(`Please run "${o.runner} cap sync" manually to ensure encrypted updates work properly`)}}else{let o=rt();l.warn("\u26A0\uFE0F Important: If you upload encrypted bundles without syncing, updates will fail!"),l.info(`Remember to run "${o.runner} cap sync" before uploading encrypted bundles`)}}async function e1(t,e){let{data:r}=await t.rpc("exist_app_v2",{appid:e}).single();return!!r}async function Me(t,e,r,n,o=!1){let i=rt(),a=await LA(t,e,r);if(!a.okay)switch(a.error){case"INVALID_APIKEY":{let c="Invalid apikey, such apikey does not exists!";throw o||l.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||l.error(c),new Error(c)}case"NO_ORG":{let c="Could not find organization, please contact support to resolve this!";throw o||l.error(c),new Error(c)}}let s=a.data;if(n>s){let c=`Insuficcent permissions for app ${r}. Current permission: ${_t[a.data]}, required for this action: ${_t[n]}.`;throw o||l.error(c),new Error(c)}return a.data}var wr="assets/icon.png";var Y5=/^[a-z0-9]+(\.[\w-]+)+$/i;function J5(t,e,r){if(!e.apikey)throw r||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||l.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(t.includes("--"))throw r||l.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||(l.error(`Invalid app ID format: "${t}"`),l.info("App ID must be in reverse domain notation (e.g., com.example.app)"),l.info("Valid format: lowercase letters, numbers, dots, hyphens, and underscores"),l.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 e1(t,e))throw e==="io.ionic.starter"?(r||l.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||l.error(`App ${e} already exist`),new Error(`App ${e} already exists`))}async function jg(t,e,r,n=!1){n||ee("Adding"),await Ee(),e.apikey=e.apikey||ne();let o=await te(),i=pe(t,o?.config);J5(i,e,n);let a=await re(e.apikey,e.supaHost,e.supaAnon),s=await ae(a,e.apikey,["write","all"]);await X5(a,i,n),r||(r=await ua(a,["admin","super_admin"]));let u=r.gid,{name:c,icon:f}=e;if(c=c||o.config?.appName||"Unknown",f=f||"resources/icon.png",!f||!c)throw n||l.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||l.info(`Adding ${i} to Capgo`);let d=null,p=null;f&&(0,la.existsSync)(f)?(d=(0,la.readFileSync)(f),p=sa(f)||"image/png",n||l.warn(`Found app icon ${f}`)):(0,la.existsSync)(wr)?(d=(0,la.readFileSync)(wr),p=sa(wr)||"image/png",n||l.warn(`Found app icon ${wr}`)):n||l.warn(`Cannot find app icon in any of the following locations: ${f}, ${wr}`);let h="icon",m="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(d&&p){let{error:D}=await a.storage.from(`images/org/${u}/${i}`).upload(h,d,{contentType:p});if(D)throw n||console.error(D),n||l.error(`Could not add app ${q(D)}`),new Error(`Could not add app ${q(D)}`);let{data:v}=await a.storage.from(`images/org/${u}/${i}`).getPublicUrl(h);m=v?.publicUrl||m}let{error:y}=await a.from("apps").insert({icon_url:m,owner_org:u,user_id:s,name:c,app_id:i});if(y)throw n||l.error(`Could not add app ${q(y)}`),new Error(`Could not add app ${q(y)}`);return n||(l.success(`App ${i} added to Capgo. You can upload a bundle now`),K("Done \u2705")),{appId:i,organizationUid:u,userId:s,name:c,signedURL:m}}async function t1(t,e){await jg(t,e,void 0)}async function Z5(t,e,r=!1,n=!1){r||ee("Deleting"),e.apikey=e.apikey||ne();let o=await te(),i=pe(t,o?.config);if(!e.apikey)throw r||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!i)throw r||l.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 ae(a,e.apikey,["write","all"]);await Me(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(),f=u;if(!n&&!c&&(f?.owner_org.created_by??"")!==s){if(r)throw new Error("Cannot delete app: you are not the organization owner");{l.warn("Deleting the app is not recommended for users that are not the organization owner"),l.warn("You are invited as a super_admin but your are not the owner"),l.warn("It's strongly recommended that you do not continue!");let y=await mt({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(le(y)||y==="no")throw l.error("Canceled deleting the app, exiting"),new Error("App deletion cancelled")}}else c&&!r&&l.warn(`Cannot get the app owner ${q(c)}`);let{error:d}=await a.storage.from("images").remove([`org/${f?.owner_org.id}/${i}/icon`]);d&&!r&&l.error("Could not delete app logo");let{error:p}=await a.storage.from(`apps/${i}/${s}`).remove(["versions"]);p&&!r&&l.error("Could not delete app version");let{error:h}=await a.from("apps").delete().eq("app_id",i);if(h)throw r||l.error("Could not delete app"),new Error(`Could not delete app: ${q(h)}`);let m=await Ct(a,i);return await me(e.apikey,{channel:"app",event:"App Deleted",icon:"\u{1F5D1}\uFE0F",user_id:m,tags:{"app-id":i},notify:!1}).catch(()=>{}),r||(l.success("App deleted in Capgo"),K("Done \u2705")),!0}async function r1(t,e){return Z5(t,e,!1,!1)}var Jl=require("node:os"),o1=require("node:process");async function n1(t){let e={},r=Object.keys(t);return(await Promise.all(r.map(o=>tl(o)))).forEach((o,i)=>{o&&(e[r[i]]=o)}),e}async function Q5(){let t=await br(),e={"@capgo/cli":Cr.version};for(let[r,n]of t)(r.startsWith("@capgo/")||r.startsWith("@capawesome/")||r.startsWith("capacitor"))&&(e[r]=n);return e}async function eM(t,e=!1){e||l.warn(" \u{1F48A} Capgo Doctor \u{1F48A}");let r=await te(),n=Fr("",t.packageJson),o=r?.config?.plugins?.CapacitorUpdater?.version||n,i=r?.config?.appName||"",a=pe("",r?.config),s=r?.config?.webDir||"";e||(l.info(` App Name: ${i}`),l.info(` App ID: ${a}`),l.info(` App Version: ${o}`),l.info(` Web Dir: ${s}`),l.info(` OS: ${(0,Jl.platform)()} ${(0,Jl.version)()}`),l.info(` Node: ${o1.version}`),l.info(" Installed Dependencies:"));let u=await Q5();if(Object.keys(u).length===0)throw e||l.warning("\x1B[31m%s\x1B[0m \u{1F6A8} No dependencies found"),new Error("No dependencies found");if(!e)for(let f of Object.keys(u))l.info(` ${f}: ${u[f]}`);let c={};if(e)c=await n1(u);else{let f=be();f.start("Running: Loading latest dependencies"),c=await n1(u),f.stop("Latest Dependencies:");for(let d of Object.keys(c))l.info(` ${d}: ${c[d]}`)}if(JSON.stringify(u)!==JSON.stringify(c))throw e||l.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||l.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 i1(t){return eM(t)}function tM(t){let e=new st;e.headers=["Name","id","Created"],e.rows=[];for(let r of t.toReversed())e.rows.push([r.name??"",r.app_id,ca(r.created_at)]);l.success("Apps"),l.success(e.toString())}async function rM(t,e){let{data:r,error:n}=await t.from("apps").select().order("created_at",{ascending:!1});if(n)throw e||l.error("Apps not found"),new Error("Apps not found");return r??[]}async function nM(t,e=!1){e||ee("List apps in Capgo"),await Ee(),t.apikey=t.apikey||ne();let r=await re(t.apikey,t.supaHost,t.supaAnon);await ae(r,t.apikey,["write","all","read","upload"]),e||l.info("Getting active bundle in Capgo");let n=await rM(r,e);if(!n.length)throw e||l.error("No apps found"),new Error("No apps found");return e||(l.info(`Active app in Capgo: ${n.length}`),tM(n),K("Done \u2705")),n}async function a1(t){return nM(t,!1)}var s1=require("node:crypto"),fa=require("node:fs");async function oM(t,e,r=!1){r||ee("Set app"),e.apikey=e.apikey||ne();let n=await te();if(t=pe(t,n?.config),!e.apikey)throw r||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||l.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 ua(o,["admin","super_admin"])).gid,s=await ae(o,e.apikey,["write","all"]);await Me(o,e.apikey,t,4,r);let{name:u,icon:c,retention:f,exposeMetadata:d}=e;if(f&&Number.isNaN(Number(f)))throw r||l.error("retention value must be a number"),new Error("Retention value must be a number");if(f&&f<0)throw r||l.error("retention value cannot be less than 0"),new Error("Retention value cannot be less than 0");if(f&&f>=63113904)throw r||l.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,h,m=`icon_${(0,s1.randomUUID)()}`,y="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(c&&(0,fa.existsSync)(c)?(p=(0,fa.readFileSync)(c),h=sa(c)||"image/png",r||l.warn(`Found app icon ${c}`)):(0,fa.existsSync)(wr)?(p=(0,fa.readFileSync)(wr),h=sa(wr)||"image/png",r||l.warn(`Found app icon ${wr}`)):r||l.warn(`Cannot find app icon in any of the following locations: ${c}, ${wr}`),p&&h){let{error:v}=await o.storage.from(`images/org/${a}/${t}`).upload(m,p,{contentType:h});if(v)throw r||l.error(`Could not set app ${q(v)}`),new Error(`Could not set app: ${q(v)}`);let{data:E}=await o.storage.from(`images/org/${a}/${t}`).getPublicUrl(m);y=E?.publicUrl||y}let{error:D}=await o.from("apps").update({icon_url:y,name:u,retention:f?f*24*60*60:void 0,expose_metadata:d}).eq("app_id",t).eq("user_id",s);if(D)throw r||l.error(`Could not set app ${q(D)}`),new Error(`Could not set app: ${q(D)}`);return r||K("Done \u2705"),!0}async function u1(t,e){return oM(t,e)}async function iM(t,e,r=!1){if(r||ee("Set a specific setting in capacitor config"),e.bool&&e.string)throw r||l.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||l.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||l.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||l.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 Qi(n,!0),r||l.success(`Set "${t}" to "${a}"`)}catch(n){throw r||l.error(`Cannot set config in capacitor settings ${q(n)}`),new Error(`Cannot set capacitor config: ${q(n)}`)}r||K("Done \u2705")}async function c1(t,e){return iM(t,e)}var Bo=require("node:fs"),No=require("node:path"),or=fe(require("node:process"));var Ro=require("node:fs/promises"),l1=require("node:os"),Ug=require("node:path"),ke=require("node:process"),f1=(0,Ug.join)((0,l1.homedir)(),".capgo-credentials"),d1=(0,Ug.join)(f1,"credentials.json");async function da(t){return(await(0,Ro.readFile)(t)).toString("base64")}async function Zl(){try{let t=await(0,Ro.readFile)(d1,"utf-8");return JSON.parse(t)}catch{return{}}}async function Ts(t){let e=await Zl();if(!t){let r=Object.keys(e);return r.length===0?null:e[r[0]]||null}return e[t]||null}async function Xl(t){await(0,Ro.mkdir)(f1,{recursive:!0}),await(0,Ro.writeFile)(d1,JSON.stringify(t,null,2),"utf-8")}function aM(){let t={};return ke.env.BUILD_CERTIFICATE_BASE64&&(t.BUILD_CERTIFICATE_BASE64=ke.env.BUILD_CERTIFICATE_BASE64),ke.env.BUILD_PROVISION_PROFILE_BASE64&&(t.BUILD_PROVISION_PROFILE_BASE64=ke.env.BUILD_PROVISION_PROFILE_BASE64),ke.env.BUILD_PROVISION_PROFILE_BASE64_PROD&&(t.BUILD_PROVISION_PROFILE_BASE64_PROD=ke.env.BUILD_PROVISION_PROFILE_BASE64_PROD),ke.env.P12_PASSWORD&&(t.P12_PASSWORD=ke.env.P12_PASSWORD),ke.env.APPLE_KEY_ID&&(t.APPLE_KEY_ID=ke.env.APPLE_KEY_ID),ke.env.APPLE_ISSUER_ID&&(t.APPLE_ISSUER_ID=ke.env.APPLE_ISSUER_ID),ke.env.APPLE_KEY_CONTENT&&(t.APPLE_KEY_CONTENT=ke.env.APPLE_KEY_CONTENT),ke.env.APPLE_PROFILE_NAME&&(t.APPLE_PROFILE_NAME=ke.env.APPLE_PROFILE_NAME),ke.env.APP_STORE_CONNECT_TEAM_ID&&(t.APP_STORE_CONNECT_TEAM_ID=ke.env.APP_STORE_CONNECT_TEAM_ID),ke.env.ANDROID_KEYSTORE_FILE&&(t.ANDROID_KEYSTORE_FILE=ke.env.ANDROID_KEYSTORE_FILE),ke.env.KEYSTORE_KEY_ALIAS&&(t.KEYSTORE_KEY_ALIAS=ke.env.KEYSTORE_KEY_ALIAS),ke.env.KEYSTORE_KEY_PASSWORD&&(t.KEYSTORE_KEY_PASSWORD=ke.env.KEYSTORE_KEY_PASSWORD),ke.env.KEYSTORE_STORE_PASSWORD&&(t.KEYSTORE_STORE_PASSWORD=ke.env.KEYSTORE_STORE_PASSWORD),ke.env.PLAY_CONFIG_JSON&&(t.PLAY_CONFIG_JSON=ke.env.PLAY_CONFIG_JSON),t}async function p1(t,e,r){let n=await Ts(t),o=aM(),i={...n?.[e]||{}};if(Object.assign(i,o),r&&Object.assign(i,r),e==="android"){let a=!!i.KEYSTORE_KEY_PASSWORD,s=!!i.KEYSTORE_STORE_PASSWORD;a&&!s?i.KEYSTORE_STORE_PASSWORD=i.KEYSTORE_KEY_PASSWORD:!a&&s&&(i.KEYSTORE_KEY_PASSWORD=i.KEYSTORE_STORE_PASSWORD)}return Object.keys(i).length>0?i:void 0}async function h1(t,e,r={}){let n={...r};return t==="ios"?(e.BUILD_CERTIFICATE_FILE&&(n.BUILD_CERTIFICATE_BASE64=await da(e.BUILD_CERTIFICATE_FILE)),e.BUILD_PROVISION_PROFILE_FILE&&(n.BUILD_PROVISION_PROFILE_BASE64=await da(e.BUILD_PROVISION_PROFILE_FILE)),e.BUILD_PROVISION_PROFILE_FILE_PROD&&(n.BUILD_PROVISION_PROFILE_BASE64_PROD=await da(e.BUILD_PROVISION_PROFILE_FILE_PROD)),e.APPLE_KEY_FILE&&(n.APPLE_KEY_CONTENT=await da(e.APPLE_KEY_FILE))):t==="android"&&(e.ANDROID_KEYSTORE_PATH&&(n.ANDROID_KEYSTORE_FILE=await da(e.ANDROID_KEYSTORE_PATH)),e.PLAY_CONFIG_JSON_PATH&&(n.PLAY_CONFIG_JSON=await da(e.PLAY_CONFIG_JSON_PATH))),n}async function m1(t,e,r){let n=await Zl(),o=n[t]||{};o[e]={...o[e],...r},n[t]=o,await Xl(n)}async function Ql(t,e){let r=await Zl();if(!t){await Xl({});return}if(!e){delete r[t],await Xl(r);return}let n=r[t]||{};delete n[e],Object.keys(n).length===0?delete r[t]:r[t]=n,await Xl(r)}async function g1(t,e){return(await Ts(t))?.[e]||null}async function Mg(){let t=await Zl();return Object.keys(t)}async function y1(t){try{t.platform||(l.error("Platform is required. Use --platform ios or --platform android"),or.default.exit(1));let e=await te(),r=pe(t.appId,e?.config);r||(l.error("\u274C App ID is required."),l.error(""),l.error("Either:"),l.error(" 1. Run this command from a Capacitor project directory, OR"),l.error(" 2. Provide --appId explicitly: --appId com.example.app"),l.error(""),or.default.exit(1));let n=t.platform;l.info(`
172
- \u{1F512} SECURITY NOTICE:`),l.info(" - Credentials saved to ~/.capgo-credentials/credentials.json (local only)"),l.info(" - When building, credentials are sent to Capgo servers"),l.info(" - Credentials are NEVER stored on Capgo servers"),l.info(" - Auto-deleted after build (max 24 hours)"),l.info(` - Builds sent directly to app stores - Capgo keeps nothing
173
- `);let o={},i={};if(n==="ios"){if(t.certificate){let u=(0,No.resolve)(t.certificate);(0,Bo.existsSync)(u)||(l.error(`Certificate file not found: ${u}`),or.default.exit(1)),i.BUILD_CERTIFICATE_FILE=u,l.info(`\u2713 Certificate file: ${u}`)}if(t.provisioningProfile){let u=(0,No.resolve)(t.provisioningProfile);(0,Bo.existsSync)(u)||(l.error(`Provisioning profile not found: ${u}`),or.default.exit(1)),i.BUILD_PROVISION_PROFILE_FILE=u,l.info(`\u2713 Provisioning profile: ${u}`)}if(t.provisioningProfileProd){let u=(0,No.resolve)(t.provisioningProfileProd);(0,Bo.existsSync)(u)||(l.error(`Production provisioning profile not found: ${u}`),or.default.exit(1)),i.BUILD_PROVISION_PROFILE_FILE_PROD=u,l.info(`\u2713 Production provisioning profile: ${u}`)}if(t.appleKey){let u=(0,No.resolve)(t.appleKey);(0,Bo.existsSync)(u)||(l.error(`Apple key file not found: ${u}`),or.default.exit(1)),i.APPLE_KEY_FILE=u,l.info(`\u2713 Apple key file: ${u}`)}t.p12Password?o.P12_PASSWORD=t.p12Password:i.BUILD_CERTIFICATE_FILE&&(l.warn("\u26A0\uFE0F No P12 password provided - assuming certificate has no password"),l.warn(' If your certificate requires a password, add --p12-password "your-password"')),t.appleKeyId&&(o.APPLE_KEY_ID=t.appleKeyId),t.appleIssuerId&&(o.APPLE_ISSUER_ID=t.appleIssuerId),t.appleProfileName&&(o.APPLE_PROFILE_NAME=t.appleProfileName),t.appleTeamId&&(o.APP_STORE_CONNECT_TEAM_ID=t.appleTeamId)}else if(n==="android"){if(t.keystore){let f=(0,No.resolve)(t.keystore);(0,Bo.existsSync)(f)||(l.error(`Keystore file not found: ${f}`),or.default.exit(1)),i.ANDROID_KEYSTORE_PATH=f,l.info(`\u2713 Keystore file: ${f}`)}if(t.playConfig){let f=(0,No.resolve)(t.playConfig);(0,Bo.existsSync)(f)||(l.error(`Play config file not found: ${f}`),or.default.exit(1)),i.PLAY_CONFIG_JSON_PATH=f,l.info(`\u2713 Play Store config: ${f}`)}t.keystoreAlias&&(o.KEYSTORE_KEY_ALIAS=t.keystoreAlias);let u=!!t.keystoreKeyPassword,c=!!t.keystoreStorePassword;u&&!c?(o.KEYSTORE_KEY_PASSWORD=t.keystoreKeyPassword,o.KEYSTORE_STORE_PASSWORD=t.keystoreKeyPassword):!u&&c?(o.KEYSTORE_KEY_PASSWORD=t.keystoreStorePassword,o.KEYSTORE_STORE_PASSWORD=t.keystoreStorePassword):u&&c&&(o.KEYSTORE_KEY_PASSWORD=t.keystoreKeyPassword,o.KEYSTORE_STORE_PASSWORD=t.keystoreStorePassword)}let a=await h1(n,i,o),s=[];if(n==="ios"?(a.BUILD_CERTIFICATE_BASE64||s.push("--certificate <path> (P12 certificate file)"),a.BUILD_PROVISION_PROFILE_BASE64||s.push("--provisioning-profile <path> (Provisioning profile file)"),a.APPLE_KEY_ID||s.push("--apple-key-id <id> (App Store Connect API Key ID)"),a.APPLE_ISSUER_ID||s.push("--apple-issuer-id <id> (App Store Connect Issuer ID)"),a.APPLE_KEY_CONTENT||s.push("--apple-key <path> (App Store Connect API Key file)"),a.APP_STORE_CONNECT_TEAM_ID||s.push("--apple-team-id <id> (App Store Connect Team ID)"),a.APPLE_PROFILE_NAME||s.push("--apple-profile-name <name> (Provisioning profile name)")):n==="android"&&(a.ANDROID_KEYSTORE_FILE||s.push("--keystore <path> (Keystore file)"),a.KEYSTORE_KEY_ALIAS||s.push("--keystore-alias <alias> (Keystore alias)"),!a.KEYSTORE_KEY_PASSWORD&&!a.KEYSTORE_STORE_PASSWORD&&s.push("--keystore-key-password <password> OR --keystore-store-password <password> (At least one password required, will be used for both)"),a.PLAY_CONFIG_JSON||s.push("--play-config <path> (Google Play service account JSON - required for uploading to Play Store)")),s.length>0){l.error(`\u274C Missing required credentials for ${n.toUpperCase()}:`),l.error("");for(let u of s)l.error(` \u2022 ${u}`);l.error(""),l.error("Example:"),n==="ios"?(l.error(" npx @capgo/cli build credentials save --platform ios \\"),l.error(" --certificate ./cert.p12 \\"),l.error(' --p12-password "your-password" \\ # Optional if cert has no password'),l.error(" --provisioning-profile ./profile.mobileprovision \\"),l.error(" --apple-key ./AuthKey_XXXXXXXXXX.p8 \\"),l.error(' --apple-key-id "XXXXXXXXXX" \\'),l.error(' --apple-issuer-id "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \\'),l.error(' --apple-team-id "XXXXXXXXXX" \\'),l.error(' --apple-profile-name "match AppStore com.example.app"')):(l.error(" npx @capgo/cli build credentials save --platform android \\"),l.error(" --keystore ./release.keystore \\"),l.error(' --keystore-alias "my-key-alias" \\'),l.error(' --keystore-key-password "password" \\'),l.error(" --play-config ./play-store-service-account.json"),l.error(""),l.error(" Note: If both key and store passwords are the same, you only need to provide one."),l.error(" If they differ, provide both --keystore-key-password and --keystore-store-password."),l.error(" The --play-config is required for uploading to Google Play Store.")),l.error(""),or.default.exit(1)}await m1(r,n,a);try{let u=ne(!0);if(u){let c=await re(u),f=await Ct(c,r);await me(u,{channel:"credentials",event:"Credentials saved",icon:"\u{1F510}",user_id:f,tags:{"app-id":r,platform:n},notify:!1}).catch()}}catch{}l.success(`
174
- \u2705 ${n.toUpperCase()} credentials saved successfully for ${r}!`),l.info(" Location: ~/.capgo-credentials/credentials.json"),l.info(` Use: npx @capgo/cli build ${r} --platform ${n}
175
- `)}catch(e){l.error(`Failed to save credentials: ${e instanceof Error?e.message:String(e)}`),or.default.exit(1)}}async function D1(t){try{let e=await Mg();if(e.length===0){l.info("No saved credentials found."),l.info("Use: npx @capgo/cli build credentials save --platform <ios|android>");return}l.info(`
171
+ 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 fe(t,e){return t||e?.plugins?.CapacitorUpdater?.appId||e?.appId}function Bo(t){if(!t.localVersion)return!0;if(!t.remoteVersion)return!1;try{let e=_u(t.localVersion),r=_u(t.remoteVersion);return OD(e,r)}catch{return!1}}async function Zl(t,e,r,n,o){let i=await qg(n,o),a=await nO(t,e,r),s=i.filter(c=>!!c.native).map(c=>{let f=a.get(c.name);return f?{name:c.name,localVersion:c.version,remoteVersion:f.version}:{name:c.name,localVersion:c.version,remoteVersion:void 0}}),u=[...a].filter(([c])=>i.find(f=>f.name===c)===void 0).map(([c,f])=>({name:c,localVersion:void 0,remoteVersion:f.version}));return s.push(...u),{finalCompatibility:s,localDependencies:i}}async function Hg(t,e,r,n){let o=await nO(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 Ql(t,e,r){let n=await ue({message:"Would you like to sync your project with Capacitor now? This is recommended to ensure encrypted updates work properly."});if(le(n))throw t&&e&&r&&await Ct("onboarding-v2",e,r,"canceled","\u{1F937}"),l.error("Canceled Capacitor sync"),new Error("Capacitor sync cancelled");if(n){let o=nt(),i=be();i.start("Running the command...");try{await new Promise((a,s)=>{let u=(0,BA.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"),l.error(`Failed to run Capacitor sync: ${a}`),l.warn(`Please run "${o.runner} cap sync" manually to ensure encrypted updates work properly`)}}else{let o=nt();l.warn("\u26A0\uFE0F Important: If you upload encrypted bundles without syncing, updates will fail!"),l.info(`Remember to run "${o.runner} cap sync" before uploading encrypted bundles`)}}async function iO(t,e){let{data:r}=await t.rpc("exist_app_v2",{appid:e}).single();return!!r}async function Me(t,e,r,n,o=!1){let i=nt(),a=await HA(t,e,r);if(!a.okay)switch(a.error){case"INVALID_APIKEY":{let c="Invalid apikey, such apikey does not exists!";throw o||l.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||l.error(c),new Error(c)}case"NO_ORG":{let c="Could not find organization, please contact support to resolve this!";throw o||l.error(c),new Error(c)}}let s=a.data;if(n>s){let c=`Insuficcent permissions for app ${r}. Current permission: ${St[a.data]}, required for this action: ${St[n]}.`;throw o||l.error(c),new Error(c)}return a.data}var Cr="assets/icon.png";var e5=/^[a-z0-9]+(\.[\w-]+)+$/i;function t5(t,e,r){if(!e.apikey)throw r||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||l.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(t.includes("--"))throw r||l.error('The app id includes illegal symbols. You cannot use "--" in the app id'),new Error("App id includes illegal symbols");if(!e5.test(t))throw r||(l.error(`Invalid app ID format: "${t}"`),l.info("App ID must be in reverse domain notation (e.g., com.example.app)"),l.info("Valid format: lowercase letters, numbers, dots, hyphens, and underscores"),l.info("Examples: com.mycompany.myapp, io.capgo.app, com.example.my-app")),new Error("Invalid app ID format")}async function r5(t,e,r){if(await iO(t,e))throw e==="io.ionic.starter"?(r||l.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||l.error(`App ${e} already exist`),new Error(`App ${e} already exists`))}async function Vg(t,e,r,n=!1){n||ee("Adding"),await Ee(),e.apikey=e.apikey||ne();let o=await te(),i=fe(t,o?.config);t5(i,e,n);let a=await re(e.apikey,e.supaHost,e.supaAnon),s=await ae(a,e.apikey,["write","all"]);await r5(a,i,n),r||(r=await ua(a,["admin","super_admin"]));let u=r.gid,{name:c,icon:f}=e;if(c=c||o.config?.appName||"Unknown",f=f||"resources/icon.png",!f||!c)throw n||l.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||l.info(`Adding ${i} to Capgo`);let d=null,p=null;f&&(0,la.existsSync)(f)?(d=(0,la.readFileSync)(f),p=sa(f)||"image/png",n||l.warn(`Found app icon ${f}`)):(0,la.existsSync)(Cr)?(d=(0,la.readFileSync)(Cr),p=sa(Cr)||"image/png",n||l.warn(`Found app icon ${Cr}`)):n||l.warn(`Cannot find app icon in any of the following locations: ${f}, ${Cr}`);let h="icon",m="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(d&&p){let{error:D}=await a.storage.from(`images/org/${u}/${i}`).upload(h,d,{contentType:p});if(D)throw n||console.error(D),n||l.error(`Could not add app ${q(D)}`),new Error(`Could not add app ${q(D)}`);let{data:v}=await a.storage.from(`images/org/${u}/${i}`).getPublicUrl(h);m=v?.publicUrl||m}let{error:y}=await a.from("apps").insert({icon_url:m,owner_org:u,user_id:s,name:c,app_id:i});if(y)throw n||l.error(`Could not add app ${q(y)}`),new Error(`Could not add app ${q(y)}`);return n||(l.success(`App ${i} added to Capgo. You can upload a bundle now`),K("Done \u2705")),{appId:i,organizationUid:u,userId:s,name:c,signedURL:m}}async function aO(t,e){await Vg(t,e,void 0)}async function n5(t,e,r=!1,n=!1){r||ee("Deleting"),e.apikey=e.apikey||ne();let o=await te(),i=fe(t,o?.config);if(!e.apikey)throw r||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!i)throw r||l.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 ae(a,e.apikey,["write","all"]);await Me(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(),f=u;if(!n&&!c&&(f?.owner_org.created_by??"")!==s){if(r)throw new Error("Cannot delete app: you are not the organization owner");{l.warn("Deleting the app is not recommended for users that are not the organization owner"),l.warn("You are invited as a super_admin but your are not the owner"),l.warn("It's strongly recommended that you do not continue!");let y=await gt({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(le(y)||y==="no")throw l.error("Canceled deleting the app, exiting"),new Error("App deletion cancelled")}}else c&&!r&&l.warn(`Cannot get the app owner ${q(c)}`);let{error:d}=await a.storage.from("images").remove([`org/${f?.owner_org.id}/${i}/icon`]);d&&!r&&l.error("Could not delete app logo");let{error:p}=await a.storage.from(`apps/${i}/${s}`).remove(["versions"]);p&&!r&&l.error("Could not delete app version");let{error:h}=await a.from("apps").delete().eq("app_id",i);if(h)throw r||l.error("Could not delete app"),new Error(`Could not delete app: ${q(h)}`);let m=await Et(a,i);return await me(e.apikey,{channel:"app",event:"App Deleted",icon:"\u{1F5D1}\uFE0F",user_id:m,tags:{"app-id":i},notify:!1}).catch(()=>{}),r||(l.success("App deleted in Capgo"),K("Done \u2705")),!0}async function sO(t,e){return n5(t,e,!1,!1)}var ef=require("node:os"),cO=require("node:process");async function uO(t){let e={},r=Object.keys(t);return(await Promise.all(r.map(o=>il(o)))).forEach((o,i)=>{o&&(e[r[i]]=o)}),e}async function o5(){let t=await vr(),e={"@capgo/cli":xr.version};for(let[r,n]of t)(r.startsWith("@capgo/")||r.startsWith("@capawesome/")||r.startsWith("capacitor"))&&(e[r]=n);return e}async function i5(t,e=!1){e||l.warn(" \u{1F48A} Capgo Doctor \u{1F48A}");let r=await te(),n=Ir("",t.packageJson),o=r?.config?.plugins?.CapacitorUpdater?.version||n,i=r?.config?.appName||"",a=fe("",r?.config),s=r?.config?.webDir||"";e||(l.info(` App Name: ${i}`),l.info(` App ID: ${a}`),l.info(` App Version: ${o}`),l.info(` Web Dir: ${s}`),l.info(` OS: ${(0,ef.platform)()} ${(0,ef.version)()}`),l.info(` Node: ${cO.version}`),l.info(" Installed Dependencies:"));let u=await o5();if(Object.keys(u).length===0)throw e||l.warning("\x1B[31m%s\x1B[0m \u{1F6A8} No dependencies found"),new Error("No dependencies found");if(!e)for(let f of Object.keys(u))l.info(` ${f}: ${u[f]}`);let c={};if(e)c=await uO(u);else{let f=be();f.start("Running: Loading latest dependencies"),c=await uO(u),f.stop("Latest Dependencies:");for(let d of Object.keys(c))l.info(` ${d}: ${c[d]}`)}if(JSON.stringify(u)!==JSON.stringify(c))throw e||l.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||l.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 lO(t){return i5(t)}function a5(t){let e=new ut;e.headers=["Name","id","Created"],e.rows=[];for(let r of t.toReversed())e.rows.push([r.name??"",r.app_id,ca(r.created_at)]);l.success("Apps"),l.success(e.toString())}async function s5(t,e){let{data:r,error:n}=await t.from("apps").select().order("created_at",{ascending:!1});if(n)throw e||l.error("Apps not found"),new Error("Apps not found");return r??[]}async function u5(t,e=!1){e||ee("List apps in Capgo"),await Ee(),t.apikey=t.apikey||ne();let r=await re(t.apikey,t.supaHost,t.supaAnon);await ae(r,t.apikey,["write","all","read","upload"]),e||l.info("Getting active bundle in Capgo");let n=await s5(r,e);if(!n.length)throw e||l.error("No apps found"),new Error("No apps found");return e||(l.info(`Active app in Capgo: ${n.length}`),a5(n),K("Done \u2705")),n}async function fO(t){return u5(t,!1)}var dO=require("node:crypto"),fa=require("node:fs");async function c5(t,e,r=!1){r||ee("Set app"),e.apikey=e.apikey||ne();let n=await te();if(t=fe(t,n?.config),!e.apikey)throw r||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||l.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 ua(o,["admin","super_admin"])).gid,s=await ae(o,e.apikey,["write","all"]);await Me(o,e.apikey,t,4,r);let{name:u,icon:c,retention:f,exposeMetadata:d}=e;if(f&&Number.isNaN(Number(f)))throw r||l.error("retention value must be a number"),new Error("Retention value must be a number");if(f&&f<0)throw r||l.error("retention value cannot be less than 0"),new Error("Retention value cannot be less than 0");if(f&&f>=63113904)throw r||l.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,h,m=`icon_${(0,dO.randomUUID)()}`,y="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(c&&(0,fa.existsSync)(c)?(p=(0,fa.readFileSync)(c),h=sa(c)||"image/png",r||l.warn(`Found app icon ${c}`)):(0,fa.existsSync)(Cr)?(p=(0,fa.readFileSync)(Cr),h=sa(Cr)||"image/png",r||l.warn(`Found app icon ${Cr}`)):r||l.warn(`Cannot find app icon in any of the following locations: ${c}, ${Cr}`),p&&h){let{error:v}=await o.storage.from(`images/org/${a}/${t}`).upload(m,p,{contentType:h});if(v)throw r||l.error(`Could not set app ${q(v)}`),new Error(`Could not set app: ${q(v)}`);let{data:E}=await o.storage.from(`images/org/${a}/${t}`).getPublicUrl(m);y=E?.publicUrl||y}let{error:D}=await o.from("apps").update({icon_url:y,name:u,retention:f?f*24*60*60:void 0,expose_metadata:d}).eq("app_id",t).eq("user_id",s);if(D)throw r||l.error(`Could not set app ${q(D)}`),new Error(`Could not set app: ${q(D)}`);return r||K("Done \u2705"),!0}async function pO(t,e){return c5(t,e)}async function l5(t,e,r=!1){if(r||ee("Set a specific setting in capacitor config"),e.bool&&e.string)throw r||l.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||l.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||l.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||l.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 Qi(n,!0),r||l.success(`Set "${t}" to "${a}"`)}catch(n){throw r||l.error(`Cannot set config in capacitor settings ${q(n)}`),new Error(`Cannot set capacitor config: ${q(n)}`)}r||K("Done \u2705")}async function hO(t,e){return l5(t,e)}var ir=require("node:fs"),ar=require("node:path"),qe=require("node:process");var No=require("node:fs/promises"),mO=require("node:os"),Rs=require("node:path"),xe=require("node:process"),gO=(0,Rs.join)((0,mO.homedir)(),".capgo-credentials"),yO=(0,Rs.join)(gO,"credentials.json"),DO=".capgo-credentials.json";function bO(t){return t?(0,Rs.join)((0,xe.cwd)(),DO):yO}function f5(t){return t?null:gO}async function da(t){return(await(0,No.readFile)(t)).toString("base64")}async function pa(t){try{let e=bO(t),r=await(0,No.readFile)(e,"utf-8");return JSON.parse(r)}catch{return{}}}async function Bs(t,e){if(e!==void 0){let o=await pa(e);if(!t){let i=Object.keys(o);return i.length===0?null:o[i[0]]||null}return o[t]||null}let r=await pa(!0),n=await pa(!1);if(!t){let o=Object.keys(r);if(o.length>0)return r[o[0]]||null;let i=Object.keys(n);return i.length===0?null:n[i[0]]||null}return r[t]||n[t]||null}async function tf(t,e){let r=bO(e),n=f5(e);n&&await(0,No.mkdir)(n,{recursive:!0}),await(0,No.writeFile)(r,JSON.stringify(t,null,2),"utf-8")}function d5(){let t={};return xe.env.BUILD_CERTIFICATE_BASE64&&(t.BUILD_CERTIFICATE_BASE64=xe.env.BUILD_CERTIFICATE_BASE64),xe.env.BUILD_PROVISION_PROFILE_BASE64&&(t.BUILD_PROVISION_PROFILE_BASE64=xe.env.BUILD_PROVISION_PROFILE_BASE64),xe.env.BUILD_PROVISION_PROFILE_BASE64_PROD&&(t.BUILD_PROVISION_PROFILE_BASE64_PROD=xe.env.BUILD_PROVISION_PROFILE_BASE64_PROD),xe.env.P12_PASSWORD&&(t.P12_PASSWORD=xe.env.P12_PASSWORD),xe.env.APPLE_KEY_ID&&(t.APPLE_KEY_ID=xe.env.APPLE_KEY_ID),xe.env.APPLE_ISSUER_ID&&(t.APPLE_ISSUER_ID=xe.env.APPLE_ISSUER_ID),xe.env.APPLE_KEY_CONTENT&&(t.APPLE_KEY_CONTENT=xe.env.APPLE_KEY_CONTENT),xe.env.APPLE_PROFILE_NAME&&(t.APPLE_PROFILE_NAME=xe.env.APPLE_PROFILE_NAME),xe.env.APP_STORE_CONNECT_TEAM_ID&&(t.APP_STORE_CONNECT_TEAM_ID=xe.env.APP_STORE_CONNECT_TEAM_ID),xe.env.ANDROID_KEYSTORE_FILE&&(t.ANDROID_KEYSTORE_FILE=xe.env.ANDROID_KEYSTORE_FILE),xe.env.KEYSTORE_KEY_ALIAS&&(t.KEYSTORE_KEY_ALIAS=xe.env.KEYSTORE_KEY_ALIAS),xe.env.KEYSTORE_KEY_PASSWORD&&(t.KEYSTORE_KEY_PASSWORD=xe.env.KEYSTORE_KEY_PASSWORD),xe.env.KEYSTORE_STORE_PASSWORD&&(t.KEYSTORE_STORE_PASSWORD=xe.env.KEYSTORE_STORE_PASSWORD),xe.env.PLAY_CONFIG_JSON&&(t.PLAY_CONFIG_JSON=xe.env.PLAY_CONFIG_JSON),t}async function wO(t,e,r){let n=await Bs(t),o=d5(),i={...n?.[e]||{}};if(Object.assign(i,o),r&&Object.assign(i,r),e==="android"){let a=!!i.KEYSTORE_KEY_PASSWORD,s=!!i.KEYSTORE_STORE_PASSWORD;a&&!s?i.KEYSTORE_STORE_PASSWORD=i.KEYSTORE_KEY_PASSWORD:!a&&s&&(i.KEYSTORE_KEY_PASSWORD=i.KEYSTORE_STORE_PASSWORD)}return Object.keys(i).length>0?i:void 0}async function zg(t,e,r={}){let n={...r};return t==="ios"?(e.BUILD_CERTIFICATE_FILE&&(n.BUILD_CERTIFICATE_BASE64=await da(e.BUILD_CERTIFICATE_FILE)),e.BUILD_PROVISION_PROFILE_FILE&&(n.BUILD_PROVISION_PROFILE_BASE64=await da(e.BUILD_PROVISION_PROFILE_FILE)),e.BUILD_PROVISION_PROFILE_FILE_PROD&&(n.BUILD_PROVISION_PROFILE_BASE64_PROD=await da(e.BUILD_PROVISION_PROFILE_FILE_PROD)),e.APPLE_KEY_FILE&&(n.APPLE_KEY_CONTENT=await da(e.APPLE_KEY_FILE))):t==="android"&&(e.ANDROID_KEYSTORE_PATH&&(n.ANDROID_KEYSTORE_FILE=await da(e.ANDROID_KEYSTORE_PATH)),e.PLAY_CONFIG_JSON_PATH&&(n.PLAY_CONFIG_JSON=await da(e.PLAY_CONFIG_JSON_PATH))),n}async function Kg(t,e,r,n){let o=await pa(n),i=o[t]||{};i[e]={...i[e],...r},o[t]=i,await tf(o,n)}async function rf(t,e,r){let n=await pa(r);if(!t){await tf({},r);return}if(!e){delete n[t],await tf(n,r);return}let o=n[t]||{};delete o[e],Object.keys(o).length===0?delete n[t]:n[t]=o,await tf(n,r)}async function Gg(t,e,r){return(await Bs(t,r))?.[e]||null}async function nf(t){let e=await pa(t);return Object.keys(e)}function Ns(){return(0,Rs.join)((0,xe.cwd)(),DO)}function Ls(){return yO}async function vO(t){try{t.platform||(l.error("Platform is required. Use --platform ios or --platform android"),(0,qe.exit)(1));let e=await te(),r=fe(t.appId,e?.config);r||(l.error("\u274C App ID is required."),l.error(""),l.error("Either:"),l.error(" 1. Run this command from a Capacitor project directory, OR"),l.error(" 2. Provide --appId explicitly: --appId com.example.app"),l.error(""),(0,qe.exit)(1));let n=t.platform;l.info(`
172
+ \u{1F512} SECURITY NOTICE:`),l.info(" - Credentials saved to ~/.capgo-credentials/credentials.json (local only)"),l.info(" - When building, credentials are sent to Capgo servers"),l.info(" - Credentials are NEVER stored on Capgo servers"),l.info(" - Auto-deleted after build"),l.info(` - Builds sent directly to app stores - Capgo keeps nothing
173
+ `);let o={},i={};if(n==="ios"){if(t.certificate){let c=(0,ar.resolve)(t.certificate);(0,ir.existsSync)(c)||(l.error(`Certificate file not found: ${c}`),(0,qe.exit)(1)),i.BUILD_CERTIFICATE_FILE=c,l.info(`\u2713 Certificate file: ${c}`)}if(t.provisioningProfile){let c=(0,ar.resolve)(t.provisioningProfile);(0,ir.existsSync)(c)||(l.error(`Provisioning profile not found: ${c}`),(0,qe.exit)(1)),i.BUILD_PROVISION_PROFILE_FILE=c,l.info(`\u2713 Provisioning profile: ${c}`)}if(t.provisioningProfileProd){let c=(0,ar.resolve)(t.provisioningProfileProd);(0,ir.existsSync)(c)||(l.error(`Production provisioning profile not found: ${c}`),(0,qe.exit)(1)),i.BUILD_PROVISION_PROFILE_FILE_PROD=c,l.info(`\u2713 Production provisioning profile: ${c}`)}if(t.appleKey){let c=(0,ar.resolve)(t.appleKey);(0,ir.existsSync)(c)||(l.error(`Apple key file not found: ${c}`),(0,qe.exit)(1)),i.APPLE_KEY_FILE=c,l.info(`\u2713 Apple key file: ${c}`)}t.p12Password?o.P12_PASSWORD=t.p12Password:i.BUILD_CERTIFICATE_FILE&&(l.warn("\u26A0\uFE0F No P12 password provided - assuming certificate has no password"),l.warn(' If your certificate requires a password, add --p12-password "your-password"')),t.appleKeyId&&(o.APPLE_KEY_ID=t.appleKeyId),t.appleIssuerId&&(o.APPLE_ISSUER_ID=t.appleIssuerId),t.appleProfileName&&(o.APPLE_PROFILE_NAME=t.appleProfileName),t.appleTeamId&&(o.APP_STORE_CONNECT_TEAM_ID=t.appleTeamId)}else if(n==="android"){if(t.keystore){let d=(0,ar.resolve)(t.keystore);(0,ir.existsSync)(d)||(l.error(`Keystore file not found: ${d}`),(0,qe.exit)(1)),i.ANDROID_KEYSTORE_PATH=d,l.info(`\u2713 Keystore file: ${d}`)}if(t.playConfig){let d=(0,ar.resolve)(t.playConfig);(0,ir.existsSync)(d)||(l.error(`Play config file not found: ${d}`),(0,qe.exit)(1)),i.PLAY_CONFIG_JSON_PATH=d,l.info(`\u2713 Play Store config: ${d}`)}t.keystoreAlias&&(o.KEYSTORE_KEY_ALIAS=t.keystoreAlias);let c=!!t.keystoreKeyPassword,f=!!t.keystoreStorePassword;c&&!f?(o.KEYSTORE_KEY_PASSWORD=t.keystoreKeyPassword,o.KEYSTORE_STORE_PASSWORD=t.keystoreKeyPassword):!c&&f?(o.KEYSTORE_KEY_PASSWORD=t.keystoreStorePassword,o.KEYSTORE_STORE_PASSWORD=t.keystoreStorePassword):c&&f&&(o.KEYSTORE_KEY_PASSWORD=t.keystoreKeyPassword,o.KEYSTORE_STORE_PASSWORD=t.keystoreStorePassword)}let a=await zg(n,i,o),s=[];if(n==="ios"?(a.BUILD_CERTIFICATE_BASE64||s.push("--certificate <path> (P12 certificate file)"),a.BUILD_PROVISION_PROFILE_BASE64||s.push("--provisioning-profile <path> (Provisioning profile file)"),a.APPLE_KEY_ID||s.push("--apple-key-id <id> (App Store Connect API Key ID)"),a.APPLE_ISSUER_ID||s.push("--apple-issuer-id <id> (App Store Connect Issuer ID)"),a.APPLE_KEY_CONTENT||s.push("--apple-key <path> (App Store Connect API Key file)"),a.APP_STORE_CONNECT_TEAM_ID||s.push("--apple-team-id <id> (App Store Connect Team ID)"),a.APPLE_PROFILE_NAME||s.push("--apple-profile-name <name> (Provisioning profile name)")):n==="android"&&(a.ANDROID_KEYSTORE_FILE||s.push("--keystore <path> (Keystore file)"),a.KEYSTORE_KEY_ALIAS||s.push("--keystore-alias <alias> (Keystore alias)"),!a.KEYSTORE_KEY_PASSWORD&&!a.KEYSTORE_STORE_PASSWORD&&s.push("--keystore-key-password <password> OR --keystore-store-password <password> (At least one password required, will be used for both)"),a.PLAY_CONFIG_JSON||s.push("--play-config <path> (Google Play service account JSON - required for uploading to Play Store)")),s.length>0){l.error(`\u274C Missing required credentials for ${n.toUpperCase()}:`),l.error("");for(let c of s)l.error(` \u2022 ${c}`);l.error(""),l.error("Example:"),n==="ios"?(l.error(" npx @capgo/cli build credentials save --platform ios \\"),l.error(" --certificate ./cert.p12 \\"),l.error(' --p12-password "your-password" \\ # Optional if cert has no password'),l.error(" --provisioning-profile ./profile.mobileprovision \\"),l.error(" --apple-key ./AuthKey_XXXXXXXXXX.p8 \\"),l.error(' --apple-key-id "XXXXXXXXXX" \\'),l.error(' --apple-issuer-id "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \\'),l.error(' --apple-team-id "XXXXXXXXXX" \\'),l.error(' --apple-profile-name "match AppStore com.example.app"')):(l.error(" npx @capgo/cli build credentials save --platform android \\"),l.error(" --keystore ./release.keystore \\"),l.error(' --keystore-alias "my-key-alias" \\'),l.error(' --keystore-key-password "password" \\'),l.error(" --play-config ./play-store-service-account.json"),l.error(""),l.error(" Note: If both key and store passwords are the same, you only need to provide one."),l.error(" If they differ, provide both --keystore-key-password and --keystore-store-password."),l.error(" The --play-config is required for uploading to Google Play Store.")),l.error(""),(0,qe.exit)(1)}await Kg(r,n,a,t.local);try{let c=ne(!0);if(c){let f=await re(c),d=await Et(f,r);await me(c,{channel:"credentials",event:"Credentials saved",icon:"\u{1F510}",user_id:d,tags:{"app-id":r,platform:n,storage:t.local?"local":"global"},notify:!1}).catch()}}catch{}let u=t.local?Ns():Ls();l.success(`
174
+ \u2705 ${n.toUpperCase()} credentials saved successfully for ${r}!`),l.info(` Location: ${u}`),l.info(` Use: npx @capgo/cli build ${r} --platform ${n}
175
+ `)}catch(e){l.error(`Failed to save credentials: ${e instanceof Error?e.message:String(e)}`),(0,qe.exit)(1)}}async function CO(t){try{let e=t?.local?await nf(!0):[],r=t?.local?[]:await nf(!1),n=[...new Set([...e,...r])];if(n.length===0){l.info("No saved credentials found."),l.info("Use: npx @capgo/cli build credentials save --platform <ios|android>");return}l.info(`
176
176
  \u{1F4CB} Saved Build Credentials:
177
- `);let r=await te(),n=t?.appId||pe(void 0,r?.config),o=n?[n]:e;for(let i of o){let a=await Ts(i);if(a){if(l.info(`
178
- \u{1F539} App: ${i}`),a.ios){l.info(" iOS Credentials:");let s=a.ios;s.BUILD_CERTIFICATE_BASE64&&l.info(" \u2713 Certificate (base64)"),s.BUILD_PROVISION_PROFILE_BASE64&&l.info(" \u2713 Provisioning Profile (base64)"),s.BUILD_PROVISION_PROFILE_BASE64_PROD&&l.info(" \u2713 Production Provisioning Profile (base64)"),s.APPLE_KEY_CONTENT&&l.info(" \u2713 Apple Key Content (base64)"),s.P12_PASSWORD&&l.info(" \u2713 P12 Password: ********"),s.APPLE_KEY_ID&&l.info(` \u2713 Apple Key ID: ${s.APPLE_KEY_ID}`),s.APPLE_ISSUER_ID&&l.info(` \u2713 Apple Issuer ID: ${s.APPLE_ISSUER_ID}`),s.APP_STORE_CONNECT_TEAM_ID&&l.info(` \u2713 Team ID: ${s.APP_STORE_CONNECT_TEAM_ID}`)}if(a.android){l.info(" Android Credentials:");let s=a.android;s.ANDROID_KEYSTORE_FILE&&l.info(" \u2713 Keystore (base64)"),s.PLAY_CONFIG_JSON&&l.info(" \u2713 Play Store Config (base64)"),s.KEYSTORE_KEY_ALIAS&&l.info(` \u2713 Keystore Alias: ${s.KEYSTORE_KEY_ALIAS}`),s.KEYSTORE_KEY_PASSWORD&&l.info(" \u2713 Key Password: ********"),s.KEYSTORE_STORE_PASSWORD&&l.info(" \u2713 Store Password: ********")}}}l.info(`
179
- Location: ~/.capgo-credentials/credentials.json`),l.info(`
180
- \u{1F512} These credentials are stored locally on your machine only.`),l.info(" When building, they are sent to Capgo but NEVER stored there."),l.info(" They are auto-deleted after build completion (max 24 hours)."),l.info(` Builds sent directly to app stores - Capgo keeps nothing.
181
- `)}catch(e){l.error(`Failed to list credentials: ${e instanceof Error?e.message:String(e)}`),or.default.exit(1)}}async function b1(t){try{let e=await te(),r=t.appId||pe(void 0,e?.config);if(r&&t.platform){if(!await g1(r,t.platform)){l.info(`No ${t.platform.toUpperCase()} credentials found for ${r}.`);return}await Ql(r,t.platform),l.success(`\u2705 ${t.platform.toUpperCase()} credentials cleared for ${r}!`)}else if(r){let n=await Ts(r);if(!n||!n.ios&&!n.android){l.info(`No credentials found for ${r}.`);return}await Ql(r),l.success(`\u2705 All credentials cleared for ${r}!`)}else{if((await Mg()).length===0){l.info("No saved credentials found.");return}await Ql(),l.success("\u2705 All credentials cleared for all apps!")}l.info(` Location: ~/.capgo-credentials/credentials.json
182
- `)}catch(e){l.error(`Failed to clear credentials: ${e instanceof Error?e.message:String(e)}`),or.default.exit(1)}}var dn=require("node:fs"),kr=require("node:fs/promises"),v1=require("node:os"),Pr=require("node:path"),qn=fe(require("node:process"));var C1=fe(Qp()),ef=fe(el());async function sM(t,e,r,n,o){try{o||l.warn(`
183
- \u26A0\uFE0F Cancelling build...`);let i=await fetch(`${t}/build/cancel/${e}`,{method:"POST",headers:{"Content-Type":"application/json",authorization:n},body:JSON.stringify({app_id:r})});if(!i.ok){let s=await i.text();o||l.warn(`Could not cancel build: ${s}`);return}let a=await i.json();o||l.info(`Build cancelled (status: ${a.status})`)}catch(i){o||l.warn(`Failed to cancel build: ${i instanceof Error?i.message:String(i)}`)}}async function uM(t,e,r,n,o){if(o)return null;let i=be(),a=null;try{let s=await fetch(`${t}/build/logs/${e}?app_id=${encodeURIComponent(r)}`,{headers:{authorization:n}});if(!s.ok)return l.warn("Could not stream logs, continuing..."),null;let u=s.body?.getReader();if(!u)return null;i.start("Waiting for build logs...");let c=new TextDecoder,f="",d=p=>{if(!p.trim())return;let h=p.match(/^(?:Build|Job already) (succeeded|failed|expired|released|cancelled)$/i);if(h){a=h[1].toLowerCase();return}a||(i.stop(p,0),i.start("Building..."))};for(;;){let{done:p,value:h}=await u.read();if(p)break;f+=c.decode(h,{stream:!0});let m=f.split(`
184
- `);f=m.pop()||"";for(let y of m)if(y.startsWith("data: ")){let D=y.slice(6);d(D)}}if(f.startsWith("data: ")){let p=f.slice(6);d(p)}return i.stop(),a}catch(s){return i.stop("Log streaming ended"),o||l.warn(`Log streaming interrupted${s instanceof Error?`: ${s.message}`:""}`),null}}async function cM(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||l.warn(`Status check failed: ${u.status}`),await new Promise(f=>setTimeout(f,5e3)),s++;continue}let c=await u.json();if(c.status==="succeeded"||c.status==="failed")return c.status;await new Promise(f=>setTimeout(f,5e3)),s++}catch(u){i||l.warn(`Status check error: ${u}`),await new Promise(c=>setTimeout(c,5e3)),s++}return i||l.warn("Build status polling timed out"),"timeout"}async function lM(t,e){let r=new Set;if(e==="ios"){let n=(0,Pr.join)(t,"ios/App/Podfile");if((0,dn.existsSync)(n)){let i=(await(0,kr.readFile)(n,"utf-8")).matchAll(/pod\s+['"][^'"]+['"],\s*:path\s*=>\s*['"]\.\.\/\.\.\/node_modules\/([^'"]+)['"]/g);for(let a of i){let s=a[1];r.add(`node_modules/${s}/Package.swift`),r.add(`node_modules/${s}/*.podspec`),r.add(`node_modules/${s}/ios/`)}}}else if(e==="android"){let n=(0,Pr.join)(t,"android/capacitor.settings.gradle");if((0,dn.existsSync)(n)){let i=(await(0,kr.readFile)(n,"utf-8")).matchAll(/new\s+File\s*\(\s*['"]\.\.\/node_modules\/([^'"]+)['"]\s*\)/g);for(let a of i){let u=a[1].replace(/\/android$/,"");r.add(`node_modules/${u}/android/`)}}}return r}function w1(t,e,r){let n=t.replace(/\\/g,"/");if(n.startsWith(`${e}/`)||n==="package.json"||n==="package-lock.json"||n.startsWith("capacitor.config.")||n.startsWith("resources/")||e==="ios"&&n.startsWith("node_modules/@capacitor/ios/")||e==="android"&&n.startsWith("node_modules/@capacitor/android/"))return!0;for(let o of r)if(n.startsWith(o))return!0;return!1}function Rs(t,e,r,n,o){let i=(0,dn.readdirSync)(e);for(let a of i){let s=(0,Pr.join)(e,a),u=r?`${r}/${a}`:a,c=(0,dn.statSync)(s);if(c.isDirectory()){if(a===".git"||a==="dist"||a==="build"||a===".angular"||a===".vite")continue;if(a===n){Rs(t,s,u,n,o);continue}if(a==="node_modules"){Rs(t,s,u,n,o);continue}if(a==="resources"){Rs(t,s,u,n,o);continue}let f=u.replace(/\\/g,"/");(w1(u,n,o)||Array.from(o).some(p=>p.startsWith(`${f}/`)))&&Rs(t,s,u,n,o)}else if(c.isFile()){if(a===".DS_Store"||a.endsWith(".log"))continue;w1(u,n,o)&&t.addLocalFile(s,r||void 0)}}}async function fM(t,e,r){let n=await lM(t,r),o=new C1.default;Rs(o,t,"",r,n),await(0,kr.writeFile)(e,o.toBuffer())}async function dM(t,e,r=!1){let n=Date.now(),o=e.verbose??!1;try{e.apikey=e.apikey||ne(r);let i=await te();if(t=t||i?.config.appId,!t)throw new Error("Missing argument, you need to provide a appId, or be in a capacitor project");if(!e.platform)throw new Error("Missing required argument: --platform <ios|android>");if(e.platform!=="ios"&&e.platform!=="android")throw new Error(`Invalid platform "${e.platform}". Must be "ios" or "android"`);let a=(0,Pr.resolve)(e.path||qn.default.cwd()),s=e.supaHost||"https://api.capgo.app",u=await re(e.apikey,e.supaHost,e.supaAnon);await ae(u,e.apikey,["write","all"]);let c=await Ct(u,t);r||(l.info(`Requesting native build for ${t}`),l.info(`Platform: ${e.platform}`),l.info(`Project: ${a}`),l.info(`
177
+ `);let o=await te(),i=t?.appId||fe(void 0,o?.config),a=i?[i]:n;for(let s of a){let u=await Bs(s,t?.local);if(!u)continue;let f=e.includes(s)?" (local)":" (global)";if(l.info(`
178
+ \u{1F539} App: ${s}${f}`),u.ios){l.info(" iOS Credentials:");let d=u.ios;d.BUILD_CERTIFICATE_BASE64&&l.info(" \u2713 Certificate (base64)"),d.BUILD_PROVISION_PROFILE_BASE64&&l.info(" \u2713 Provisioning Profile (base64)"),d.BUILD_PROVISION_PROFILE_BASE64_PROD&&l.info(" \u2713 Production Provisioning Profile (base64)"),d.APPLE_KEY_CONTENT&&l.info(" \u2713 Apple Key Content (base64)"),d.P12_PASSWORD&&l.info(" \u2713 P12 Password: ********"),d.APPLE_KEY_ID&&l.info(` \u2713 Apple Key ID: ${d.APPLE_KEY_ID}`),d.APPLE_ISSUER_ID&&l.info(` \u2713 Apple Issuer ID: ${d.APPLE_ISSUER_ID}`),d.APP_STORE_CONNECT_TEAM_ID&&l.info(` \u2713 Team ID: ${d.APP_STORE_CONNECT_TEAM_ID}`)}if(u.android){l.info(" Android Credentials:");let d=u.android;d.ANDROID_KEYSTORE_FILE&&l.info(" \u2713 Keystore (base64)"),d.PLAY_CONFIG_JSON&&l.info(" \u2713 Play Store Config (base64)"),d.KEYSTORE_KEY_ALIAS&&l.info(` \u2713 Keystore Alias: ${d.KEYSTORE_KEY_ALIAS}`),d.KEYSTORE_KEY_PASSWORD&&l.info(" \u2713 Key Password: ********"),d.KEYSTORE_STORE_PASSWORD&&l.info(" \u2713 Store Password: ********")}}l.info(`
179
+ Global: ${Ls()}`),l.info(`Local: ${Ns()}`),l.info(`
180
+ \u{1F512} These credentials are stored locally on your machine only.`),l.info(` When building, they are sent to Capgo but NEVER stored there.
181
+ `)}catch(e){l.error(`Failed to list credentials: ${e instanceof Error?e.message:String(e)}`),(0,qe.exit)(1)}}async function EO(t){try{let e=await te(),r=t.appId||fe(void 0,e?.config),n=t.local?Ns():Ls();if(r&&t.platform){if(!await Gg(r,t.platform,t.local)){l.info(`No ${t.platform.toUpperCase()} credentials found for ${r}.`);return}await rf(r,t.platform,t.local),l.success(`\u2705 ${t.platform.toUpperCase()} credentials cleared for ${r}!`)}else if(r){let o=await Bs(r,t.local);if(!o||!o.ios&&!o.android){l.info(`No credentials found for ${r}.`);return}await rf(r,void 0,t.local),l.success(`\u2705 All credentials cleared for ${r}!`)}else{if((await nf(t.local)).length===0){l.info("No saved credentials found.");return}await rf(void 0,void 0,t.local),l.success("\u2705 All credentials cleared!")}l.info(` Location: ${n}
182
+ `)}catch(e){l.error(`Failed to clear credentials: ${e instanceof Error?e.message:String(e)}`),(0,qe.exit)(1)}}async function _O(t){try{let e=!!(t.certificate||t.provisioningProfile||t.provisioningProfileProd||t.p12Password||t.appleKey||t.appleKeyId||t.appleIssuerId||t.appleProfileName||t.appleTeamId),r=!!(t.keystore||t.keystoreAlias||t.keystoreKeyPassword||t.keystoreStorePassword||t.playConfig),n=t.platform;n||(e&&!r?n="ios":r&&!e?n="android":e&&r?(l.error("Cannot mix iOS and Android options. Please use --platform to specify which platform."),(0,qe.exit)(1)):(l.error("No credentials provided to update."),l.error(""),l.error("Usage: npx @capgo/cli build credentials update [options]"),l.error(""),l.error("iOS options: --certificate, --provisioning-profile, --apple-key, etc."),l.error("Android options: --keystore, --keystore-alias, --play-config, etc."),(0,qe.exit)(1)));let o=await te(),i=fe(t.appId,o?.config);i||(l.error("\u274C App ID is required."),l.error(""),l.error("Either:"),l.error(" 1. Run this command from a Capacitor project directory, OR"),l.error(" 2. Provide --appId explicitly: --appId com.example.app"),(0,qe.exit)(1)),await Gg(i,n,t.local)||(l.error(`\u274C No existing ${n.toUpperCase()} credentials found for ${i}.`),l.error(""),l.error('Use "build credentials save" to create credentials first.'),(0,qe.exit)(1));let s={},u={};if(n==="ios"){if(t.certificate){let d=(0,ar.resolve)(t.certificate);(0,ir.existsSync)(d)||(l.error(`Certificate file not found: ${d}`),(0,qe.exit)(1)),u.BUILD_CERTIFICATE_FILE=d,l.info(`\u2713 Updating certificate: ${d}`)}if(t.provisioningProfile){let d=(0,ar.resolve)(t.provisioningProfile);(0,ir.existsSync)(d)||(l.error(`Provisioning profile not found: ${d}`),(0,qe.exit)(1)),u.BUILD_PROVISION_PROFILE_FILE=d,l.info(`\u2713 Updating provisioning profile: ${d}`)}if(t.provisioningProfileProd){let d=(0,ar.resolve)(t.provisioningProfileProd);(0,ir.existsSync)(d)||(l.error(`Production provisioning profile not found: ${d}`),(0,qe.exit)(1)),u.BUILD_PROVISION_PROFILE_FILE_PROD=d,l.info(`\u2713 Updating production provisioning profile: ${d}`)}if(t.appleKey){let d=(0,ar.resolve)(t.appleKey);(0,ir.existsSync)(d)||(l.error(`Apple key file not found: ${d}`),(0,qe.exit)(1)),u.APPLE_KEY_FILE=d,l.info(`\u2713 Updating Apple key file: ${d}`)}t.p12Password&&(s.P12_PASSWORD=t.p12Password,l.info("\u2713 Updating P12 password")),t.appleKeyId&&(s.APPLE_KEY_ID=t.appleKeyId,l.info(`\u2713 Updating Apple Key ID: ${t.appleKeyId}`)),t.appleIssuerId&&(s.APPLE_ISSUER_ID=t.appleIssuerId,l.info(`\u2713 Updating Apple Issuer ID: ${t.appleIssuerId}`)),t.appleProfileName&&(s.APPLE_PROFILE_NAME=t.appleProfileName,l.info(`\u2713 Updating Apple Profile Name: ${t.appleProfileName}`)),t.appleTeamId&&(s.APP_STORE_CONNECT_TEAM_ID=t.appleTeamId,l.info(`\u2713 Updating Apple Team ID: ${t.appleTeamId}`))}else if(n==="android"){if(t.keystore){let d=(0,ar.resolve)(t.keystore);(0,ir.existsSync)(d)||(l.error(`Keystore file not found: ${d}`),(0,qe.exit)(1)),u.ANDROID_KEYSTORE_PATH=d,l.info(`\u2713 Updating keystore: ${d}`)}if(t.playConfig){let d=(0,ar.resolve)(t.playConfig);(0,ir.existsSync)(d)||(l.error(`Play config file not found: ${d}`),(0,qe.exit)(1)),u.PLAY_CONFIG_JSON_PATH=d,l.info(`\u2713 Updating Play Store config: ${d}`)}t.keystoreAlias&&(s.KEYSTORE_KEY_ALIAS=t.keystoreAlias,l.info(`\u2713 Updating keystore alias: ${t.keystoreAlias}`)),t.keystoreKeyPassword&&(s.KEYSTORE_KEY_PASSWORD=t.keystoreKeyPassword,l.info("\u2713 Updating keystore key password")),t.keystoreStorePassword&&(s.KEYSTORE_STORE_PASSWORD=t.keystoreStorePassword,l.info("\u2713 Updating keystore store password"))}let c=await zg(n,u,s);await Kg(i,n,c,t.local);let f=t.local?Ns():Ls();l.success(`
183
+ \u2705 ${n.toUpperCase()} credentials updated for ${i}!`),l.info(` Location: ${f}
184
+ `)}catch(e){l.error(`Failed to update credentials: ${e instanceof Error?e.message:String(e)}`),(0,qe.exit)(1)}}var Gr=require("node:fs"),Er=require("node:fs/promises"),xO=require("node:os"),_r=require("node:path"),Tr=require("node:process");var AO=pe(oh()),of=pe(ol());async function p5(t,e,r,n,o){try{o||l.warn(`
185
+ \u26A0\uFE0F Cancelling build...`);let i=await fetch(`${t}/build/cancel/${e}`,{method:"POST",headers:{"Content-Type":"application/json",authorization:n},body:JSON.stringify({app_id:r})});if(!i.ok){let s=await i.text();o||l.warn(`Could not cancel build: ${s}`);return}let a=await i.json();o||l.info(`Build cancelled (status: ${a.status})`)}catch(i){o||l.warn(`Failed to cancel build: ${i instanceof Error?i.message:String(i)}`)}}async function h5(t,e,r,n,o){if(o)return null;let i=be(),a=null;try{let s=await fetch(`${t}/build/logs/${e}?app_id=${encodeURIComponent(r)}`,{headers:{authorization:n}});if(!s.ok)return l.warn("Could not stream logs, continuing..."),null;let u=s.body?.getReader();if(!u)return null;i.start("Waiting for build logs...");let c=new TextDecoder,f="",d=p=>{if(!p.trim())return;let h=p.match(/^(?:Build|Job already) (succeeded|failed|expired|released|cancelled)$/i);if(h){a=h[1].toLowerCase();return}a||(i.stop(p,0),i.start("Building..."))};for(;;){let{done:p,value:h}=await u.read();if(p)break;f+=c.decode(h,{stream:!0});let m=f.split(`
186
+ `);f=m.pop()||"";for(let y of m)if(y.startsWith("data: ")){let D=y.slice(6);d(D)}}if(f.startsWith("data: ")){let p=f.slice(6);d(p)}return i.stop(),a}catch(s){return i.stop("Log streaming ended"),o||l.warn(`Log streaming interrupted${s instanceof Error?`: ${s.message}`:""}`),null}}async function m5(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||l.warn(`Status check failed: ${u.status}`),await new Promise(f=>setTimeout(f,5e3)),s++;continue}let c=await u.json();if(c.status==="succeeded"||c.status==="failed")return c.status;await new Promise(f=>setTimeout(f,5e3)),s++}catch(u){i||l.warn(`Status check error: ${u}`),await new Promise(c=>setTimeout(c,5e3)),s++}return i||l.warn("Build status polling timed out"),"timeout"}async function g5(t,e){let r=new Set,n=!1;if(e==="ios"){let o=(0,_r.join)(t,"ios/App/CapApp-SPM/Package.swift");if((0,Gr.existsSync)(o)){n=!0;let a=(await(0,Er.readFile)(o,"utf-8")).matchAll(/\.package\s*\([^)]*path:\s*["'](?:\.\.\/)*node_modules\/([^"']+)["']\s*\)/g);for(let s of a)r.add(s[1])}else{let i=(0,_r.join)(t,"ios/App/Podfile");if((0,Gr.existsSync)(i)){let s=(await(0,Er.readFile)(i,"utf-8")).matchAll(/pod\s+['"][^'"]+['"],\s*:path\s*=>\s*['"]\.\.\/\.\.\/node_modules\/([^'"]+)['"]/g);for(let u of s)r.add(u[1])}}}else if(e==="android"){let o=(0,_r.join)(t,"android/capacitor.settings.gradle");if((0,Gr.existsSync)(o)){let a=(await(0,Er.readFile)(o,"utf-8")).matchAll(/new\s+File\s*\(\s*['"]\.\.\/node_modules\/([^'"]+)['"]\s*\)/g);for(let s of a){let c=s[1].replace(/\/android$/,"");r.add(c)}}}return{packages:r,usesSPM:n}}function SO(t,e,r){let n=t.replace(/\\/g,"/");if(n.startsWith(`${e}/`)||n==="package.json"||n==="package-lock.json"||n.startsWith("capacitor.config.")||n.startsWith("resources/")||e==="ios"&&n.startsWith("node_modules/@capacitor/ios/")||e==="android"&&n.startsWith("node_modules/@capacitor/android/"))return!0;for(let o of r.packages){let i=`node_modules/${o}/`;if(e==="android"){if(n.startsWith(`${i}android/`))return!0}else if(e==="ios"){if(n.startsWith(`${i}ios/`))return!0;if(r.usesSPM){if(n===`${i}Package.swift`)return!0}else if(n.startsWith(i)&&n.endsWith(".podspec"))return!0}}return!1}function js(t,e,r,n,o){let i=(0,Gr.readdirSync)(e);for(let a of i){let s=(0,_r.join)(e,a),u=r?`${r}/${a}`:a,c=(0,Gr.statSync)(s);if(c.isDirectory()){if(a===".git"||a==="dist"||a==="build"||a===".angular"||a===".vite")continue;if(a===n){js(t,s,u,n,o);continue}if(a==="node_modules"){js(t,s,u,n,o);continue}if(a==="resources"){js(t,s,u,n,o);continue}let f=u.replace(/\\/g,"/");(SO(u,n,o)||Array.from(o.packages).some(p=>`node_modules/${p}/`.startsWith(`${f}/`)||f.startsWith(`node_modules/${p}`)))&&js(t,s,u,n,o)}else if(c.isFile()){if(a===".DS_Store"||a.endsWith(".log"))continue;SO(u,n,o)&&t.addLocalFile(s,r||void 0)}}}async function y5(t,e,r){let n=await g5(t,r),o=new AO.default;js(o,t,"",r,n),await(0,Er.writeFile)(e,o.toBuffer())}async function D5(t,e,r=!1){let n=Date.now(),o=e.verbose??!1;try{e.apikey=e.apikey||ne(r);let i=await te();if(t=t||i?.config.appId,!t)throw new Error("Missing argument, you need to provide a appId, or be in a capacitor project");if(!e.platform)throw new Error("Missing required argument: --platform <ios|android>");if(e.platform!=="ios"&&e.platform!=="android")throw new Error(`Invalid platform "${e.platform}". Must be "ios" or "android"`);let a=(0,_r.resolve)(e.path||(0,Tr.cwd)()),s=e.supaHost||"https://api.capgo.app",u=await re(e.apikey,e.supaHost,e.supaAnon);await ae(u,e.apikey,["write","all"]);let c=await Et(u,t);r||(l.info(`Requesting native build for ${t}`),l.info(`Platform: ${e.platform}`),l.info(`Project: ${a}`),l.info(`
185
187
  \u{1F512} Security: Credentials are never stored on Capgo servers`),l.info(" They are used only during build and deleted after (max 24h)"),l.info(` Builds sent directly to app stores - Capgo keeps nothing
186
- `)),o&&l.info(`API host: ${s}`);let f={};e.buildCertificateBase64&&(f.BUILD_CERTIFICATE_BASE64=e.buildCertificateBase64),e.buildProvisionProfileBase64&&(f.BUILD_PROVISION_PROFILE_BASE64=e.buildProvisionProfileBase64),e.buildProvisionProfileBase64Prod&&(f.BUILD_PROVISION_PROFILE_BASE64_PROD=e.buildProvisionProfileBase64Prod),e.p12Password&&(f.P12_PASSWORD=e.p12Password),e.appleKeyId&&(f.APPLE_KEY_ID=e.appleKeyId),e.appleIssuerId&&(f.APPLE_ISSUER_ID=e.appleIssuerId),e.appleKeyContent&&(f.APPLE_KEY_CONTENT=e.appleKeyContent),e.appleProfileName&&(f.APPLE_PROFILE_NAME=e.appleProfileName),e.appStoreConnectTeamId&&(f.APP_STORE_CONNECT_TEAM_ID=e.appStoreConnectTeamId),e.androidKeystoreFile&&(f.ANDROID_KEYSTORE_FILE=e.androidKeystoreFile),e.keystoreKeyAlias&&(f.KEYSTORE_KEY_ALIAS=e.keystoreKeyAlias);let d=!!e.keystoreKeyPassword,p=!!e.keystoreStorePassword;d&&!p?(f.KEYSTORE_KEY_PASSWORD=e.keystoreKeyPassword,f.KEYSTORE_STORE_PASSWORD=e.keystoreKeyPassword):!d&&p?(f.KEYSTORE_KEY_PASSWORD=e.keystoreStorePassword,f.KEYSTORE_STORE_PASSWORD=e.keystoreStorePassword):d&&p&&(f.KEYSTORE_KEY_PASSWORD=e.keystoreKeyPassword,f.KEYSTORE_STORE_PASSWORD=e.keystoreStorePassword),e.playConfigJson&&(f.PLAY_CONFIG_JSON=e.playConfigJson);let h=await p1(t,e.platform,Object.keys(f).length>0?f:void 0),m={app_id:t,platform:e.platform};if(!h)throw r||(l.error("\u274C No credentials found for this app and platform"),l.error(""),l.error("You must provide credentials via:"),l.error(" 1. CLI arguments (--apple-key-id, --p12-password, etc.)"),l.error(" 2. Environment variables (APPLE_KEY_ID, P12_PASSWORD, etc.)"),l.error(" 3. Saved credentials file:"),l.error(` npx @capgo/cli build credentials save --appId ${t} --platform ${e.platform}`),l.error(""),l.error("Documentation:"),l.error(" https://capgo.app/docs/cli/cloud-build/credentials/")),new Error("No credentials found. Please provide credentials before building.");let y=[];if(e.platform==="ios"?(h.BUILD_CERTIFICATE_BASE64||y.push("BUILD_CERTIFICATE_BASE64 (or --build-certificate-base64)"),!h.P12_PASSWORD&&!r&&(l.warn("\u26A0\uFE0F P12_PASSWORD not provided - assuming certificate has no password"),l.warn(" If your certificate requires a password, provide it with --p12-password")),h.BUILD_PROVISION_PROFILE_BASE64||y.push("BUILD_PROVISION_PROFILE_BASE64 (or --build-provision-profile-base64)"),h.APPLE_KEY_ID||y.push("APPLE_KEY_ID (or --apple-key-id)"),h.APPLE_ISSUER_ID||y.push("APPLE_ISSUER_ID (or --apple-issuer-id)"),h.APPLE_KEY_CONTENT||y.push("APPLE_KEY_CONTENT (or --apple-key-content)"),h.APP_STORE_CONNECT_TEAM_ID||y.push("APP_STORE_CONNECT_TEAM_ID (or --apple-team-id)")):e.platform==="android"&&(h.ANDROID_KEYSTORE_FILE||y.push("ANDROID_KEYSTORE_FILE (or --android-keystore-file)"),h.KEYSTORE_KEY_ALIAS||y.push("KEYSTORE_KEY_ALIAS (or --keystore-key-alias)"),!h.KEYSTORE_KEY_PASSWORD&&!h.KEYSTORE_STORE_PASSWORD&&y.push("KEYSTORE_KEY_PASSWORD or KEYSTORE_STORE_PASSWORD (at least one password required)"),!h.PLAY_CONFIG_JSON&&!r&&l.warn("\u26A0\uFE0F PLAY_CONFIG_JSON not provided - build will succeed but cannot auto-upload to Play Store")),y.length>0){if(!r){l.error(`\u274C Missing required credentials for ${e.platform}:`),l.error("");for(let _ of y)l.error(` \u2022 ${_}`);l.error(""),l.error("Provide credentials via:"),l.error(' 1. CLI arguments: npx @capgo/cli build request --platform ios --apple-id "..." --p12-password "..."'),l.error(' 2. Environment variables: export APPLE_ID="..." P12_PASSWORD="..."'),l.error(" 3. Saved credentials: npx @capgo/cli build credentials save --platform ios ..."),l.error(""),l.error("Documentation:"),l.error(` https://capgo.app/docs/cli/cloud-build/${e.platform}/`)}throw new Error(`Missing required credentials for ${e.platform}: ${y.join(", ")}`)}if(m.credentials=h,r||l.info("\u2713 Using credentials (merged from CLI args, env vars, and saved file)"),o){let _=Object.keys(h).filter(S=>h[S]);l.info(`Credentials provided: ${_.join(", ")}`)}r||l.info("Requesting build from Capgo...");let D=await fetch(`${s}/build/request`,{method:"POST",headers:{"Content-Type":"application/json",authorization:e.apikey},body:JSON.stringify(m)});if(!D.ok){let _=await D.text();throw new Error(`Failed to request build: ${D.status} - ${_}`)}let v=await D.json();r||(l.success(`Build job created: ${v.job_id}`),l.info(`Status: ${v.status}`)),o&&(l.info(`Upload URL: ${v.upload_url}`),l.info(`Upload expires: ${v.upload_expires_at}`)),await me(e.apikey,{channel:"native-builder",event:"Build requested",icon:"\u{1F3D7}\uFE0F",user_id:c,tags:{"app-id":t,platform:e.platform},notify:!1}).catch();let E=(0,Pr.join)((0,v1.tmpdir)(),`capgo-build-${Date.now()}`);await(0,kr.mkdir)(E,{recursive:!0});let g=(0,Pr.join)(E,`${(0,Pr.basename)(a)}.zip`);try{r||l.info(`Zipping ${e.platform} project from ${a}...`),await fM(a,g,e.platform);let S=((await(0,kr.stat)(g)).size/1024/1024).toFixed(2);r||l.success(`Created zip: ${g} (${S} MB)`),r||l.info("Uploading to builder..."),o&&(l.info(`Upload endpoint: ${v.upload_url}`),l.info(`File size: ${S} MB`),l.info(`Job ID: ${v.job_id}`));let P=(0,dn.readFileSync)(g),F=be();r||F.start("Uploading bundle"),await new Promise((X,k)=>{let b=new ef.Upload(P,{endpoint:v.upload_url,chunkSize:5242880,metadata:{filename:(0,Pr.basename)(g),filetype:"application/zip"},headers:{authorization:e.apikey},onBeforeRequest(w){if(o){l.info(`[TUS] ${w.getMethod()} ${w.getURL()}`);let C=w.getHeader("authorization");l.info(`[TUS] Authorization header present: ${!!C}`)}},onAfterResponse(w,C){if(o){l.info(`[TUS] Response status: ${C.getStatus()}`);let O=C.getHeader("upload-offset"),R=C.getHeader("tus-resumable");l.info(`[TUS] Upload-Offset: ${O}, Tus-Resumable: ${R}`)}},onError(w){if(r||(F.stop("Upload failed"),l.error(`Upload error: ${w.message}`)),w instanceof ef.DetailedError){let C=w.originalResponse?.getBody(),O=w.originalResponse?.getStatus(),R=w.originalRequest?.getURL();o&&(l.error(`[TUS] Request URL: ${R}`),l.error(`[TUS] Response status: ${O}`),l.error(`[TUS] Response body: ${C}`));let $="Unknown error";try{let H=JSON.parse(C||'{"error": "unknown error"}');$=H.status||H.error||H.message||"unknown error"}catch{$=C||w.message}k(new Error(`TUS upload failed: ${$}`))}else k(new Error(`TUS upload failed: ${w.message||w.toString()}`))},onProgress(w,C){let O=(w/C*100).toFixed(2);r||F.message(`Uploading ${O}%`)},onSuccess(){r||F.stop("Upload complete!"),o&&l.success("TUS upload completed successfully"),X()}});o&&l.info("[TUS] Starting upload..."),b.start()}),r||l.info("Starting build job...");let B=await fetch(`${s}/build/start/${v.job_id}`,{method:"POST",headers:{"Content-Type":"application/json",authorization:e.apikey},body:JSON.stringify({app_id:t})});if(!B.ok){let X=await B.text();throw new Error(`Failed to start build: ${B.status} - ${X}`)}let T=await B.json();r||(l.success("Build started!"),l.info(`Streaming build logs...
188
+ `)),o&&l.info(`API host: ${s}`);let f={};e.buildCertificateBase64&&(f.BUILD_CERTIFICATE_BASE64=e.buildCertificateBase64),e.buildProvisionProfileBase64&&(f.BUILD_PROVISION_PROFILE_BASE64=e.buildProvisionProfileBase64),e.buildProvisionProfileBase64Prod&&(f.BUILD_PROVISION_PROFILE_BASE64_PROD=e.buildProvisionProfileBase64Prod),e.p12Password&&(f.P12_PASSWORD=e.p12Password),e.appleKeyId&&(f.APPLE_KEY_ID=e.appleKeyId),e.appleIssuerId&&(f.APPLE_ISSUER_ID=e.appleIssuerId),e.appleKeyContent&&(f.APPLE_KEY_CONTENT=e.appleKeyContent),e.appleProfileName&&(f.APPLE_PROFILE_NAME=e.appleProfileName),e.appStoreConnectTeamId&&(f.APP_STORE_CONNECT_TEAM_ID=e.appStoreConnectTeamId),e.androidKeystoreFile&&(f.ANDROID_KEYSTORE_FILE=e.androidKeystoreFile),e.keystoreKeyAlias&&(f.KEYSTORE_KEY_ALIAS=e.keystoreKeyAlias);let d=!!e.keystoreKeyPassword,p=!!e.keystoreStorePassword;d&&!p?(f.KEYSTORE_KEY_PASSWORD=e.keystoreKeyPassword,f.KEYSTORE_STORE_PASSWORD=e.keystoreKeyPassword):!d&&p?(f.KEYSTORE_KEY_PASSWORD=e.keystoreStorePassword,f.KEYSTORE_STORE_PASSWORD=e.keystoreStorePassword):d&&p&&(f.KEYSTORE_KEY_PASSWORD=e.keystoreKeyPassword,f.KEYSTORE_STORE_PASSWORD=e.keystoreStorePassword),e.playConfigJson&&(f.PLAY_CONFIG_JSON=e.playConfigJson);let h=await wO(t,e.platform,Object.keys(f).length>0?f:void 0),m={app_id:t,platform:e.platform};if(!h)throw r||(l.error("\u274C No credentials found for this app and platform"),l.error(""),l.error("You must provide credentials via:"),l.error(" 1. CLI arguments (--apple-key-id, --p12-password, etc.)"),l.error(" 2. Environment variables (APPLE_KEY_ID, P12_PASSWORD, etc.)"),l.error(" 3. Saved credentials file:"),l.error(` npx @capgo/cli build credentials save --appId ${t} --platform ${e.platform}`),l.error(""),l.error("Documentation:"),l.error(" https://capgo.app/docs/cli/cloud-build/credentials/")),new Error("No credentials found. Please provide credentials before building.");let y=[];if(e.platform==="ios"?(h.BUILD_CERTIFICATE_BASE64||y.push("BUILD_CERTIFICATE_BASE64 (or --build-certificate-base64)"),!h.P12_PASSWORD&&!r&&(l.warn("\u26A0\uFE0F P12_PASSWORD not provided - assuming certificate has no password"),l.warn(" If your certificate requires a password, provide it with --p12-password")),h.BUILD_PROVISION_PROFILE_BASE64||y.push("BUILD_PROVISION_PROFILE_BASE64 (or --build-provision-profile-base64)"),h.APPLE_KEY_ID||y.push("APPLE_KEY_ID (or --apple-key-id)"),h.APPLE_ISSUER_ID||y.push("APPLE_ISSUER_ID (or --apple-issuer-id)"),h.APPLE_KEY_CONTENT||y.push("APPLE_KEY_CONTENT (or --apple-key-content)"),h.APP_STORE_CONNECT_TEAM_ID||y.push("APP_STORE_CONNECT_TEAM_ID (or --apple-team-id)")):e.platform==="android"&&(h.ANDROID_KEYSTORE_FILE||y.push("ANDROID_KEYSTORE_FILE (or --android-keystore-file)"),h.KEYSTORE_KEY_ALIAS||y.push("KEYSTORE_KEY_ALIAS (or --keystore-key-alias)"),!h.KEYSTORE_KEY_PASSWORD&&!h.KEYSTORE_STORE_PASSWORD&&y.push("KEYSTORE_KEY_PASSWORD or KEYSTORE_STORE_PASSWORD (at least one password required)"),!h.PLAY_CONFIG_JSON&&!r&&l.warn("\u26A0\uFE0F PLAY_CONFIG_JSON not provided - build will succeed but cannot auto-upload to Play Store")),y.length>0){if(!r){l.error(`\u274C Missing required credentials for ${e.platform}:`),l.error("");for(let _ of y)l.error(` \u2022 ${_}`);l.error(""),l.error("Provide credentials via:"),l.error(' 1. CLI arguments: npx @capgo/cli build request --platform ios --apple-id "..." --p12-password "..."'),l.error(' 2. Environment variables: export APPLE_ID="..." P12_PASSWORD="..."'),l.error(" 3. Saved credentials: npx @capgo/cli build credentials save --platform ios ..."),l.error(""),l.error("Documentation:"),l.error(` https://capgo.app/docs/cli/cloud-build/${e.platform}/`)}throw new Error(`Missing required credentials for ${e.platform}: ${y.join(", ")}`)}if(m.credentials=h,r||l.info("\u2713 Using credentials (merged from CLI args, env vars, and saved file)"),o){let _=Object.keys(h).filter(S=>h[S]);l.info(`Credentials provided: ${_.join(", ")}`)}r||l.info("Requesting build from Capgo...");let D=await fetch(`${s}/build/request`,{method:"POST",headers:{"Content-Type":"application/json",authorization:e.apikey},body:JSON.stringify(m)});if(!D.ok){let _=await D.text();throw new Error(`Failed to request build: ${D.status} - ${_}`)}let v=await D.json();r||(l.success(`Build job created: ${v.job_id}`),l.info(`Status: ${v.status}`)),o&&(l.info(`Upload URL: ${v.upload_url}`),l.info(`Upload expires: ${v.upload_expires_at}`)),await me(e.apikey,{channel:"native-builder",event:"Build requested",icon:"\u{1F3D7}\uFE0F",user_id:c,tags:{"app-id":t,platform:e.platform},notify:!1}).catch();let E=(0,_r.join)((0,xO.tmpdir)(),`capgo-build-${Date.now()}`);await(0,Er.mkdir)(E,{recursive:!0});let g=(0,_r.join)(E,`${(0,_r.basename)(a)}.zip`);try{r||l.info(`Zipping ${e.platform} project from ${a}...`),await y5(a,g,e.platform);let S=((await(0,Er.stat)(g)).size/1024/1024).toFixed(2);r||l.success(`Created zip: ${g} (${S} MB)`),r||l.info("Uploading to builder..."),o&&(l.info(`Upload endpoint: ${v.upload_url}`),l.info(`File size: ${S} MB`),l.info(`Job ID: ${v.job_id}`));let k=(0,Gr.readFileSync)(g),F=be();r||F.start("Uploading bundle"),await new Promise((X,P)=>{let b=new of.Upload(k,{endpoint:v.upload_url,chunkSize:5242880,metadata:{filename:(0,_r.basename)(g),filetype:"application/zip"},headers:{authorization:e.apikey},onBeforeRequest(w){if(o){l.info(`[TUS] ${w.getMethod()} ${w.getURL()}`);let C=w.getHeader("authorization");l.info(`[TUS] Authorization header present: ${!!C}`)}},onAfterResponse(w,C){if(o){l.info(`[TUS] Response status: ${C.getStatus()}`);let O=C.getHeader("upload-offset"),R=C.getHeader("tus-resumable");l.info(`[TUS] Upload-Offset: ${O}, Tus-Resumable: ${R}`)}},onError(w){if(r||(F.stop("Upload failed"),l.error(`Upload error: ${w.message}`)),w instanceof of.DetailedError){let C=w.originalResponse?.getBody(),O=w.originalResponse?.getStatus(),R=w.originalRequest?.getURL();o&&(l.error(`[TUS] Request URL: ${R}`),l.error(`[TUS] Response status: ${O}`),l.error(`[TUS] Response body: ${C}`));let $="Unknown error";try{let H=JSON.parse(C||'{"error": "unknown error"}');$=H.status||H.error||H.message||"unknown error"}catch{$=C||w.message}P(new Error(`TUS upload failed: ${$}`))}else P(new Error(`TUS upload failed: ${w.message||w.toString()}`))},onProgress(w,C){let O=(w/C*100).toFixed(2);r||F.message(`Uploading ${O}%`)},onSuccess(){r||F.stop("Upload complete!"),o&&l.success("TUS upload completed successfully"),X()}});o&&l.info("[TUS] Starting upload..."),b.start()}),r||l.info("Starting build job...");let B=await fetch(`${s}/build/start/${v.job_id}`,{method:"POST",headers:{"Content-Type":"application/json",authorization:e.apikey},body:JSON.stringify({app_id:t})});if(!B.ok){let X=await B.text();throw new Error(`Failed to start build: ${B.status} - ${X}`)}let T=await B.json();r||(l.success("Build started!"),l.info(`Streaming build logs...
187
189
  `),l.info(`Press Ctrl+C to cancel the build
188
- `));let j=!1,A=async()=>{j||(j=!0,await sM(s,v.job_id,t,e.apikey,r),qn.default.exit(130))};qn.default.on("SIGINT",A),qn.default.on("SIGTERM",A);let M;try{let X=await uM(s,v.job_id,t,e.apikey,r);X?M=X:M=await cM(s,v.job_id,t,e.platform,e.apikey,r)}finally{qn.default.off("SIGINT",A),qn.default.off("SIGTERM",A)}r||(M==="succeeded"?l.success("Build completed successfully!"):M==="failed"?l.error("Build failed"):l.warn(`Build finished with status: ${M}`));let L=((Date.now()-n)/1e3).toFixed(2);return await me(e.apikey,{channel:"native-builder",event:M==="succeeded"?"Build succeeded":"Build failed",icon:M==="succeeded"?"\u2705":"\u274C",user_id:c,tags:{"app-id":t,platform:e.platform,status:M||"unknown",time:L},notify:!1}).catch(),{success:M==="succeeded",jobId:v.job_id,uploadUrl:v.upload_url,status:M||T.status||v.status}}finally{await(0,kr.rm)(E,{recursive:!0,force:!0})}}catch(i){let a=i instanceof Error?i.message:String(i);return r||l.error(a),{success:!1,error:a}}}async function E1(t,e){(await dM(t,e,!1)).success||qn.default.exit(1)}async function _1(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||l.error(`Cannot check Version ${e}@${r.name}: ${q(s)}`),new Error(`Cannot check version ${e}@${r.name}: ${q(s)}`);if(!a?.length)return;if(o)throw new Error(`Version ${e}@${r.name} is used in ${a.length} channel(s)`);ee(`\u274C Version ${e}@${r.name} is used in ${a.length} channel${a.length>1?"s":""}`);let u=i;if(i||(u=await ue({message:"unlink it?"})===!0),!u)throw l.error("Unlink it first"),new Error(`Version ${e}@${r.name} is still linked to channel(s)`);for(let c of a){let f=be();f.start(`Unlinking channel ${c.name}`);let d=await qg(t,e,{silent:o});if(!d)throw f.stop(`Cannot find unknown version for ${e}`),new Error(`Cannot find unknown version for ${e}`);let{error:p}=await t.from("channels").update({version:d.id}).eq("id",c.id);if(p)throw f.stop(`Cannot update channel ${c.name} ${q(p)}`),new Error(`Cannot update channel ${c.name}: ${q(p)}`);f.stop(`\u2705 Channel ${c.name} unlinked`)}K(`Version unlinked from ${a.length} channel${a.length>1?"s":""}`)}async function qg(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||l.error(`Cannot call findUnknownVersion as it returned an error.
189
- ${q(i)}`),new Error(`Cannot retrieve unknown version for app ${e}: ${q(i)}`)}function S1(t,e){return t.from("channels").insert(e).select().single()}function x1(t,e,r,n){return t.from("channels").delete().eq("name",e).eq("app_id",r).single()}function A1(t,e,r){return t.from("channels").select().eq("app_id",e).eq("name",r).single()}function O1(t,e,r){return t.from("channel_devices").delete().eq("app_id",e).eq("channel_id",r)}function F1(t,e,r){return t.from("channels").select(`
190
+ `));let j=!1,A=async()=>{j||(j=!0,await p5(s,v.job_id,t,e.apikey,r),(0,Tr.exit)(130))};(0,Tr.on)("SIGINT",A),(0,Tr.on)("SIGTERM",A);let M;try{let X=await h5(s,v.job_id,t,e.apikey,r);X?M=X:M=await m5(s,v.job_id,t,e.platform,e.apikey,r)}finally{(0,Tr.off)("SIGINT",A),(0,Tr.off)("SIGTERM",A)}r||(M==="succeeded"?l.success("Build completed successfully!"):M==="failed"?l.error("Build failed"):l.warn(`Build finished with status: ${M}`));let L=((Date.now()-n)/1e3).toFixed(2);return await me(e.apikey,{channel:"native-builder",event:M==="succeeded"?"Build succeeded":"Build failed",icon:M==="succeeded"?"\u2705":"\u274C",user_id:c,tags:{"app-id":t,platform:e.platform,status:M||"unknown",time:L},notify:!1}).catch(),{success:M==="succeeded",jobId:v.job_id,uploadUrl:v.upload_url,status:M||T.status||v.status}}finally{await(0,Er.rm)(E,{recursive:!0,force:!0})}}catch(i){let a=i instanceof Error?i.message:String(i);return r||l.error(a),{success:!1,error:a}}}async function OO(t,e){(await D5(t,e,!1)).success||(0,Tr.exit)(1)}async function FO(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||l.error(`Cannot check Version ${e}@${r.name}: ${q(s)}`),new Error(`Cannot check version ${e}@${r.name}: ${q(s)}`);if(!a?.length)return;if(o)throw new Error(`Version ${e}@${r.name} is used in ${a.length} channel(s)`);ee(`\u274C Version ${e}@${r.name} is used in ${a.length} channel${a.length>1?"s":""}`);let u=i;if(i||(u=await ue({message:"unlink it?"})===!0),!u)throw l.error("Unlink it first"),new Error(`Version ${e}@${r.name} is still linked to channel(s)`);for(let c of a){let f=be();f.start(`Unlinking channel ${c.name}`);let d=await Wg(t,e,{silent:o});if(!d)throw f.stop(`Cannot find unknown version for ${e}`),new Error(`Cannot find unknown version for ${e}`);let{error:p}=await t.from("channels").update({version:d.id}).eq("id",c.id);if(p)throw f.stop(`Cannot update channel ${c.name} ${q(p)}`),new Error(`Cannot update channel ${c.name}: ${q(p)}`);f.stop(`\u2705 Channel ${c.name} unlinked`)}K(`Version unlinked from ${a.length} channel${a.length>1?"s":""}`)}async function Wg(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||l.error(`Cannot call findUnknownVersion as it returned an error.
191
+ ${q(i)}`),new Error(`Cannot retrieve unknown version for app ${e}: ${q(i)}`)}function PO(t,e){return t.from("channels").insert(e).select().single()}function kO(t,e,r,n){return t.from("channels").delete().eq("name",e).eq("app_id",r).single()}function $O(t,e,r){return t.from("channels").select().eq("app_id",e).eq("name",r).single()}function IO(t,e,r){return t.from("channel_devices").delete().eq("app_id",e).eq("channel_id",r)}function TO(t,e,r){return t.from("channels").select(`
190
192
  id,
191
193
  version (id, name)
192
- `).eq("app_id",e).eq("name",r).single().throwOnError().then(({data:n})=>n?.version)}function k1(t,e=!1){if(e)return;let r=new st;r.theme=st.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"]);l.success("Channels"),l.success(r.toString())}async function P1(t,e,r=!1){let{data:n,error:o}=await t.from("channels").select(`
194
+ `).eq("app_id",e).eq("name",r).single().throwOnError().then(({data:n})=>n?.version)}function RO(t,e=!1){if(e)return;let r=new ut;r.theme=ut.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"]);l.success("Channels"),l.success(r.toString())}async function BO(t,e,r=!1){let{data:n,error:o}=await t.from("channels").select(`
193
195
  id,
194
196
  name,
195
197
  public,
@@ -204,28 +206,28 @@ ${q(i)}`),new Error(`Cannot retrieve unknown version for app ${e}: ${q(i)}`)}fun
204
206
  created_by,
205
207
  app_id,
206
208
  version (id, name)
207
- `).eq("app_id",e).order("created_at",{ascending:!1});if(o)throw r||l.error(`App ${e} not found in database`),new Error(`App ${e} not found in database: ${q(o)}`);return n}async function Hg(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||l.error(a),new Error(`${a}: ${q(i)}`)}}async function tf(t,e,r,n={}){let{silent:o=!1,autoUnlink:i=!1}=n,a=await pM(t,e,r,{silent:o});await _1(t,e,a,{silent:o,autoUnlink:i}),await Hg(t,e,r,{silent:o})}function rf(t,e=!1){if(e)return;if(!t.length)throw new Error("No bundle found");let r=new st;r.theme=st.roundTheme,r.headers=["Version","Created","Keep"],r.rows=[];for(let n of t.toReversed())r.rows.push([n.name,ca(n.created_at),n.keep??""]);l.success("Bundles"),l.success(r.toString())}async function nf(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||l.error(a),new Error(`${a}: ${q(i)}`)}return o??[]}async function $1(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||l.error(a),new Error(`${a}: ${q(i)}`)}return(o??[]).map(a=>a.version)}async function pM(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||l.error(s),new Error(`${s}${a?`: ${q(a)}`:""}`)}return i}async function hM(t,e,r,n){for await(let o of t)n||l.warn(`Removing ${o.name} created on ${ca(o.created_at)}`),await tf(e,r,o.name)}function mM(t,e,r){let n=[];for(let o of t??[]){let i=ge(o.name);yd(i,e)&&Qt(i,r)&&n.push(o)}return n}async function gM(t,e,r=!1){r||ee("Cleanup versions in Capgo"),await Ee(),e.apikey=e.apikey||ne();let{bundle:n,keep:o=4}=e,i=e.force||!1,a=e.ignoreChannel||!1,s=await te();if(t=pe(t,s?.config),!e.apikey)throw r||l.error("Missing API key, you need to provide an API key to delete your app"),new Error("Missing API key");if(!t)throw r||l.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 ae(u,e.apikey,["write","all"]),await Me(u,e.apikey,t,3,r),r||l.info("Querying all available versions in Capgo");let c=await nf(u,t),f=await $1(u,t);if(r||l.info(`Total active versions in Capgo: ${c?.length??0}`),!c?.length)throw r||l.error("No versions found, aborting cleanup"),new Error("No versions found");if(n){let h=ge(n),m=_n(h,"major");r||l.info(`Querying available versions in Capgo between ${qt(h)} and ${qt(m)}`),c=mM(c,h,m),r||l.info(`Active versions in Capgo between ${qt(h)} and ${qt(m)}: ${c?.length??0}`)}let d=[],p=0;for(let h of c){let m=f.find(y=>y===h.id);p<o||m&&!a?(h.keep=m?"\u2705 (Linked to channel)":"\u2705",p+=1):(h.keep="\u274C",d.push(h))}if(!d.length)return r||l.warn("Nothing to be removed, aborting removal..."),{removed:0,kept:p};if(r||rf(c),!i){if(r)throw new Error("Cleanup requires force=true in SDK mode to prevent accidental deletions");{let h=await ue({message:"Do you want to continue removing the versions specified?"});if(le(h)||!h)throw l.warn("Not confirmed, aborting removal..."),new Error("Cleanup cancelled by user")}}return r||l.success("You have confirmed removal, removing versions now"),await hM(d,u,t,r),r||K("Done \u2705"),{removed:d.length,kept:p}}async function I1(t,e){return gM(t,e)}async function yM(t,e,r=!1){r||ee("Check compatibility");let n={...e,apikey:e.apikey||ne()},o=await te(),i=pe(t,o?.config),a=n.channel;if(!a)throw r||l.error("Missing argument, you need to provide a channel"),new Error("Missing channel");if(!n.apikey)throw r||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!i)throw r||l.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 ae(s,n.apikey,["write","all","read","upload"]),await Me(s,n.apikey,i,1,r);let u=await Wl(s,i,a,n.packageJson,n.nodeModules);if(!r){let c=new st;c.headers=["Package","Local version","Remote version","Compatible"],c.theme=st.roundTheme,c.rows=[];let f=n.text?"Yes":"\u2705",d=n.text?"No":"\u274C";for(let p of u.finalCompatibility){let{name:h,localVersion:m,remoteVersion:y}=p,D=To(p)?f:d;c.rows.push([h,m,y,D])}l.success("Compatibility"),l.success(c.toString())}return{finalCompatibility:u.finalCompatibility}}async function T1(t,e){try{await yM(t,e,!1)}catch(r){throw l.error(`Error checking compatibility ${q(r)}`),r}}var mn=require("node:fs");var pn=require("node:buffer"),ht=require("node:crypto"),B1="aes-128-cbc",hn="base64",R1="hex",Bs=ht.constants.RSA_PKCS1_PADDING;function of(t){let e=(0,ht.randomBytes)(16),r=(0,ht.randomBytes)(16),n=e.toString(hn),o=(0,ht.privateEncrypt)({key:t,padding:Bs},r).toString(hn);return{sessionKey:r,ivSessionKey:`${n}:${o}`}}function pa(t,e,r){let[n]=r.split(":"),o=pn.Buffer.from(n,hn),i=(0,ht.createCipheriv)(B1,e,o);return i.setAutoPadding(!0),pn.Buffer.concat([i.update(t),i.final()])}function N1(t,e,r){let[n,o]=e.split(":"),i=(0,ht.publicDecrypt)({key:r,padding:Bs},pn.Buffer.from(o,hn)),a=pn.Buffer.from(n,hn),s=(0,ht.createDecipheriv)(B1,i,a);return s.setAutoPadding(!0),pn.Buffer.concat([s.update(t),s.final()])}function ha(t,e){return(0,ht.privateEncrypt)({key:e,padding:Bs},pn.Buffer.from(t,hn)).toString(hn)}function af(t,e){return(0,ht.privateEncrypt)({key:e,padding:Bs},pn.Buffer.from(t,R1)).toString(R1)}function L1(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 j1(t,e){return(0,ht.publicDecrypt)({key:e,padding:Bs},pn.Buffer.from(t,hn)).toString(hn)}function U1(t){return t?t.replace(/-----BEGIN RSA PUBLIC KEY-----/g,"").replace(/-----END RSA PUBLIC KEY-----/g,"").replace(/\n/g,"").replace(/\r/g,"").replace(/ /g,"").substring(0,4):""}function DM(t,e){let r=t.key||fn,n=e.config.plugins?.CapacitorUpdater?.publicKey;return(0,mn.existsSync)(r)?n=(0,mn.readFileSync)(r,"utf8"):!n&&t.keyData&&(n=t.keyData),{publicKey:n,fallbackKeyPath:r}}async function bM(t,e,r,n=!1){n||ee("Decrypt zip file");try{if(await Ee(),!(0,mn.existsSync)(t)){let d=`Zip not found at the path ${t}`;throw n||l.error(d),new Error(d)}let o=await te();if(!r.key&&!(0,mn.existsSync)(fn)&&!o.config.plugins?.CapacitorUpdater?.publicKey){let d=`Public Key not found at the path ${fn} or in ${o.path}`;throw n||l.error(d),new Error(d)}let{publicKey:i,fallbackKeyPath:a}=DM(r,o);if(!i){let d=`Cannot find public key ${a} or as keyData option or in ${o.path}`;throw n||l.error(d),new Error(d)}let s=(0,mn.readFileSync)(t),u=N1(s,e,r.keyData??i),c=`${t}_decrypted.zip`;(0,mn.writeFileSync)(c,u),n||l.info(`Decrypted zip file at ${c}`);let f;if(r.checksum){let d=await an(u,"sha256"),p=j1(r.checksum,r.keyData??i);if(f=d===p,!f){let h=`Checksum does not match ${d} !== ${p}`;throw n||l.error(h),new Error(h)}n||l.info("Checksum matches")}return n||K("\u2705 done"),{outputPath:c,checksumMatches:f}}catch(o){throw n||l.error(`Error decrypting zip file ${q(o)}`),o instanceof Error?o:new Error(String(o))}}async function M1(t,e,r){await bM(t,e,r,!1)}async function wM(t,e,r,n=!1){n||ee("Delete bundle"),r.apikey=r.apikey||ne();let o=await te();if(e=pe(e,o?.config),!r.apikey)throw n||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||l.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||l.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 ae(i,r.apikey,["write","all"]),await Me(i,r.apikey,e,3,n),n||(l.info(`Deleting bundle ${e}@${t} from Capgo`),l.info("Keep in mind that you will not be able to reuse this bundle version, it's gone forever")),await tf(i,e,t),n||(l.success(`Bundle ${e}@${t} deleted in Capgo`),K("Done")),!0}async function q1(t,e,r){return wM(t,e,r)}var gn=require("node:fs");function Ns(t){console.error(q(t))}async function vM(t,e,r,n=!1){let{json:o}=r,i=!o&&!n;i&&(ee("Encryption"),await Ee());try{let a=await te(),s=!!a.config.plugins?.CapacitorUpdater?.privateKey,u=!!a.config.plugins?.CapacitorUpdater?.publicKey;if(s&&i&&l.warning("There is still a privateKey in the config"),!(0,gn.existsSync)(t)){let v=`Zip not found at the path ${t}`;throw n||(o?Ns({error:"zip_not_found"}):l.error(`Error: ${v}`)),new Error(v)}if(!u)throw n||(o?Ns({error:"missing_public_key"}):l.warning("Warning: Missing Public Key in config")),new Error("Missing public key in config");let c=r.key||nr,f=r.keyData||"";if(!(0,gn.existsSync)(c)&&!f)throw n||(o?Ns({error:"missing_key"}):(l.warning(`Cannot find a private key at ${c} or as a keyData option`),l.error("Error: Missing key"))),new Error("Missing private key");if((0,gn.existsSync)(c)&&(f=(0,gn.readFileSync)(c,"utf8")),f&&!f.startsWith("-----BEGIN RSA PRIVATE KEY-----"))throw n||(o?Ns({error:"invalid_private_key"}):l.error("The private key provided is not a valid RSA Private key")),new Error("Invalid private key format");let d=(0,gn.readFileSync)(t),{sessionKey:p,ivSessionKey:h}=of(f),m=pa(d,p,h),y=ha(e,f),D=`${t}_encrypted.zip`;return(0,gn.writeFileSync)(D,m),n||(o?console.log(JSON.stringify({checksum:y,filename:D,ivSessionKey:h},null,2)):(l.success(`Encoded Checksum: ${y}`),l.success(`ivSessionKey: ${h}`),l.success(`Encrypted zip saved at ${D}`),K("Done \u2705"))),{checksum:y,filename:D,ivSessionKey:h}}catch(a){throw n||(r.json?Ns(a):l.error(`Error encrypting zip file ${q(a)}`)),a instanceof Error?a:new Error(String(a))}}async function H1(t,e,r){await vM(t,e,r,!1)}async function V1(t,e,r=!1){r||ee("List bundles"),await Ee(),e.apikey=e.apikey||ne();let n=await te();if(t=pe(t,n?.config),!e.apikey)throw r||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||l.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 ae(o,e.apikey,["write","all","read","upload"]),await Me(o,e.apikey,t,1,r),r||l.info(`Querying available versions of: ${t} in Capgo`);let i=await nf(o,t);return r||(l.info(`Active versions in Capgo: ${i?.length??0}`),rf(i),K("Done \u2705")),i}var wF=require("node:crypto"),Ko=require("node:fs"),vf=require("node:process");var sf=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 Hn(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 p={attributes:{}};for(;!(c()||f("?>"));){let h=i();if(!h)return p;p.attributes[h.name]=h.value}return u(/\?>\s*/),p}function n(){let d=u(/^<([\w-:.]+)\s*/);if(!d)return;let p={name:d[1],attributes:{},children:[]};for(;!(c()||f(">")||f("?>")||f("/>"));){let m=i();if(!m)return p;p.attributes[m.name]=m.value}if(u(/^\s*\/>\s*/))return p;u(/\??>\s*/),p.content=o();let h;for(;h=n();)p.children.push(h);return u(/^<\/[\w-:.]+>\s*/),p}function o(){let d=u(/^([^<]*)/);return d?s(d[1]):""}function i(){let d=u(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(d)return{name:d[1],value:s(a(d[2]))}}function a(d){return d.replace(/^['"]|['"]$/g,"")}function s(d){return d.replaceAll("&lt;","<").replaceAll("&gt;",">").replaceAll("&amp;","&")}function u(d){let p=t.match(d);if(p)return t=t.slice(p[0].length),p}function c(){return t.length===0}function f(d){return t.startsWith(d)}}var Vr=class extends Error{};var St=class extends Vr{},Ls=class extends Vr{},uf=class extends Vr{bucketName;constructor(e){super(`Invalid bucket name: ${e}`),this.bucketName=e}},zr=class extends Vr{objectName;constructor(e){super(`Invalid object name: ${e}`),this.objectName=e}},Vn=class extends Vr{constructor(){super("accessKey is required")}},ma=class extends Vr{constructor(){super("secretKey is required")}},js=class extends Vr{constructor(){super("expirySeconds cannot be less than 1 second or more than 7 days")}},yn=class extends Vr{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 z1(t){try{let r=Hn(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 yn(t.status,n,o,{key:i,bucketName:a,resource:s,region:u})}catch{return new yn(t.status,"UnrecognizedError",`Error: Unexpected response code ${t.status} ${t.statusText}. Unable to parse response as XML.`)}}function K1(t){return typeof t!="number"||isNaN(t)?!1:t>=1&&t<=65535}function G1(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 zn(t){return!(!CM(t)||t.length===0)}function CM(t){return!(typeof t!="string"||t.length>1024)}function Us(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}function Lo(t=""){let e={'"':"","&quot;":"","&#34;":"","&QUOT;":"","&#x00022":""};return t.replace(/^("|&quot;|&#34;)|("|&quot;|&#34;)$/g,r=>e[r])}function zg(t){return t.get("x-amz-version-id")??null}function jo(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 Kg(t){return jo(t).slice(0,8)}function Gg(t,e){return`${Kg(e)}/${t}/s3/aws4_request`}async function cf(t){return t instanceof Uint8Array||(t=new TextEncoder().encode(t)),Us(new Uint8Array(await crypto.subtle.digest("SHA-256",t)))}var EM=["x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5"],lf=class extends WritableStream{getResult;constructor({client:e,bucketName:r,objectName:n,partSize:o,metadata:i}){let a,s=1,u,c=[],f,d=[];super({start(){},async write(p,h){let y=s++;try{if(y==1&&p.length<o){let E=await e.makeRequest({method:"PUT",headers:new Headers({...i,"Content-Length":String(p.length)}),bucketName:r,objectName:n,payload:p});a={etag:Lo(E.headers.get("etag")??void 0),versionId:zg(E.headers)};return}y===1&&(u=(await _M({client:e,bucketName:r,objectName:n,metadata:i})).uploadId);let D={"Content-Length":String(p.length)};for(let E of EM){let g=i[E];g&&(D[E]=g)}let v=e.makeRequest({method:"PUT",query:{partNumber:y.toString(),uploadId:u},headers:new Headers(D),bucketName:r,objectName:n,payload:p}).then(E=>{let g=E.headers.get("etag")??"";return g&&(g=g.replace(/^"/,"").replace(/"$/,"")),c.push({part:y,etag:g}),E});d.push(v.catch(E=>{f||(f=E)}))}catch(D){throw D}},async close(){if(!a)if(u){if(await Promise.all(d),f)throw f;c.sort((p,h)=>p.part>h.part?1:-1),a=await SM({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 _M(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=Hn(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 SM({client:t,bucketName:e,objectName:r,uploadId:n,etags:o}){let i=`
209
+ `).eq("app_id",e).order("created_at",{ascending:!1});if(o)throw r||l.error(`App ${e} not found in database`),new Error(`App ${e} not found in database: ${q(o)}`);return n}async function Yg(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||l.error(a),new Error(`${a}: ${q(i)}`)}}async function af(t,e,r,n={}){let{silent:o=!1,autoUnlink:i=!1}=n,a=await b5(t,e,r,{silent:o});await FO(t,e,a,{silent:o,autoUnlink:i}),await Yg(t,e,r,{silent:o})}function sf(t,e=!1){if(e)return;if(!t.length)throw new Error("No bundle found");let r=new ut;r.theme=ut.roundTheme,r.headers=["Version","Created","Keep"],r.rows=[];for(let n of t.toReversed())r.rows.push([n.name,ca(n.created_at),n.keep??""]);l.success("Bundles"),l.success(r.toString())}async function uf(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||l.error(a),new Error(`${a}: ${q(i)}`)}return o??[]}async function NO(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||l.error(a),new Error(`${a}: ${q(i)}`)}return(o??[]).map(a=>a.version)}async function b5(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||l.error(s),new Error(`${s}${a?`: ${q(a)}`:""}`)}return i}async function w5(t,e,r,n){for await(let o of t)n||l.warn(`Removing ${o.name} created on ${ca(o.created_at)}`),await af(e,r,o.name)}function v5(t,e,r){let n=[];for(let o of t??[]){let i=ge(o.name);Cd(i,e)&&er(i,r)&&n.push(o)}return n}async function C5(t,e,r=!1){r||ee("Cleanup versions in Capgo"),await Ee(),e.apikey=e.apikey||ne();let{bundle:n,keep:o=4}=e,i=e.force||!1,a=e.ignoreChannel||!1,s=await te();if(t=fe(t,s?.config),!e.apikey)throw r||l.error("Missing API key, you need to provide an API key to delete your app"),new Error("Missing API key");if(!t)throw r||l.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 ae(u,e.apikey,["write","all"]),await Me(u,e.apikey,t,3,r),r||l.info("Querying all available versions in Capgo");let c=await uf(u,t),f=await NO(u,t);if(r||l.info(`Total active versions in Capgo: ${c?.length??0}`),!c?.length)throw r||l.error("No versions found, aborting cleanup"),new Error("No versions found");if(n){let h=ge(n),m=An(h,"major");r||l.info(`Querying available versions in Capgo between ${Ht(h)} and ${Ht(m)}`),c=v5(c,h,m),r||l.info(`Active versions in Capgo between ${Ht(h)} and ${Ht(m)}: ${c?.length??0}`)}let d=[],p=0;for(let h of c){let m=f.find(y=>y===h.id);p<o||m&&!a?(h.keep=m?"\u2705 (Linked to channel)":"\u2705",p+=1):(h.keep="\u274C",d.push(h))}if(!d.length)return r||l.warn("Nothing to be removed, aborting removal..."),{removed:0,kept:p};if(r||sf(c),!i){if(r)throw new Error("Cleanup requires force=true in SDK mode to prevent accidental deletions");{let h=await ue({message:"Do you want to continue removing the versions specified?"});if(le(h)||!h)throw l.warn("Not confirmed, aborting removal..."),new Error("Cleanup cancelled by user")}}return r||l.success("You have confirmed removal, removing versions now"),await w5(d,u,t,r),r||K("Done \u2705"),{removed:d.length,kept:p}}async function LO(t,e){return C5(t,e)}async function E5(t,e,r=!1){r||ee("Check compatibility");let n={...e,apikey:e.apikey||ne()},o=await te(),i=fe(t,o?.config),a=n.channel;if(!a)throw r||l.error("Missing argument, you need to provide a channel"),new Error("Missing channel");if(!n.apikey)throw r||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!i)throw r||l.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 ae(s,n.apikey,["write","all","read","upload"]),await Me(s,n.apikey,i,1,r);let u=await Zl(s,i,a,n.packageJson,n.nodeModules);if(!r){let c=new ut;c.headers=["Package","Local version","Remote version","Compatible"],c.theme=ut.roundTheme,c.rows=[];let f=n.text?"Yes":"\u2705",d=n.text?"No":"\u274C";for(let p of u.finalCompatibility){let{name:h,localVersion:m,remoteVersion:y}=p,D=Bo(p)?f:d;c.rows.push([h,m,y,D])}l.success("Compatibility"),l.success(c.toString())}return{finalCompatibility:u.finalCompatibility}}async function jO(t,e){try{await E5(t,e,!1)}catch(r){throw l.error(`Error checking compatibility ${q(r)}`),r}}var Dn=require("node:fs");var gn=require("node:buffer"),mt=require("node:crypto"),MO="aes-128-cbc",yn="base64",UO="hex",Us=mt.constants.RSA_PKCS1_PADDING;function cf(t){let e=(0,mt.randomBytes)(16),r=(0,mt.randomBytes)(16),n=e.toString(yn),o=(0,mt.privateEncrypt)({key:t,padding:Us},r).toString(yn);return{sessionKey:r,ivSessionKey:`${n}:${o}`}}function ha(t,e,r){let[n]=r.split(":"),o=gn.Buffer.from(n,yn),i=(0,mt.createCipheriv)(MO,e,o);return i.setAutoPadding(!0),gn.Buffer.concat([i.update(t),i.final()])}function qO(t,e,r){let[n,o]=e.split(":"),i=(0,mt.publicDecrypt)({key:r,padding:Us},gn.Buffer.from(o,yn)),a=gn.Buffer.from(n,yn),s=(0,mt.createDecipheriv)(MO,i,a);return s.setAutoPadding(!0),gn.Buffer.concat([s.update(t),s.final()])}function ma(t,e){return(0,mt.privateEncrypt)({key:e,padding:Us},gn.Buffer.from(t,yn)).toString(yn)}function lf(t,e){return(0,mt.privateEncrypt)({key:e,padding:Us},gn.Buffer.from(t,UO)).toString(UO)}function HO(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 VO(t,e){return(0,mt.publicDecrypt)({key:e,padding:Us},gn.Buffer.from(t,yn)).toString(yn)}function zO(t){return t?t.replace(/-----BEGIN RSA PUBLIC KEY-----/g,"").replace(/-----END RSA PUBLIC KEY-----/g,"").replace(/\n/g,"").replace(/\r/g,"").replace(/ /g,"").substring(0,4):""}function _5(t,e){let r=t.key||mn,n=e.config.plugins?.CapacitorUpdater?.publicKey;return(0,Dn.existsSync)(r)?n=(0,Dn.readFileSync)(r,"utf8"):!n&&t.keyData&&(n=t.keyData),{publicKey:n,fallbackKeyPath:r}}async function S5(t,e,r,n=!1){n||ee("Decrypt zip file");try{if(await Ee(),!(0,Dn.existsSync)(t)){let d=`Zip not found at the path ${t}`;throw n||l.error(d),new Error(d)}let o=await te();if(!r.key&&!(0,Dn.existsSync)(mn)&&!o.config.plugins?.CapacitorUpdater?.publicKey){let d=`Public Key not found at the path ${mn} or in ${o.path}`;throw n||l.error(d),new Error(d)}let{publicKey:i,fallbackKeyPath:a}=_5(r,o);if(!i){let d=`Cannot find public key ${a} or as keyData option or in ${o.path}`;throw n||l.error(d),new Error(d)}let s=(0,Dn.readFileSync)(t),u=qO(s,e,r.keyData??i),c=`${t}_decrypted.zip`;(0,Dn.writeFileSync)(c,u),n||l.info(`Decrypted zip file at ${c}`);let f;if(r.checksum){let d=await ln(u,"sha256"),p=VO(r.checksum,r.keyData??i);if(f=d===p,!f){let h=`Checksum does not match ${d} !== ${p}`;throw n||l.error(h),new Error(h)}n||l.info("Checksum matches")}return n||K("\u2705 done"),{outputPath:c,checksumMatches:f}}catch(o){throw n||l.error(`Error decrypting zip file ${q(o)}`),o instanceof Error?o:new Error(String(o))}}async function KO(t,e,r){await S5(t,e,r,!1)}async function x5(t,e,r,n=!1){n||ee("Delete bundle"),r.apikey=r.apikey||ne();let o=await te();if(e=fe(e,o?.config),!r.apikey)throw n||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||l.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||l.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 ae(i,r.apikey,["write","all"]),await Me(i,r.apikey,e,3,n),n||(l.info(`Deleting bundle ${e}@${t} from Capgo`),l.info("Keep in mind that you will not be able to reuse this bundle version, it's gone forever")),await af(i,e,t),n||(l.success(`Bundle ${e}@${t} deleted in Capgo`),K("Done")),!0}async function GO(t,e,r){return x5(t,e,r)}var bn=require("node:fs");function Ms(t){console.error(q(t))}async function A5(t,e,r,n=!1){let{json:o}=r,i=!o&&!n;i&&(ee("Encryption"),await Ee());try{let a=await te(),s=!!a.config.plugins?.CapacitorUpdater?.privateKey,u=!!a.config.plugins?.CapacitorUpdater?.publicKey;if(s&&i&&l.warning("There is still a privateKey in the config"),!(0,bn.existsSync)(t)){let v=`Zip not found at the path ${t}`;throw n||(o?Ms({error:"zip_not_found"}):l.error(`Error: ${v}`)),new Error(v)}if(!u)throw n||(o?Ms({error:"missing_public_key"}):l.warning("Warning: Missing Public Key in config")),new Error("Missing public key in config");let c=r.key||or,f=r.keyData||"";if(!(0,bn.existsSync)(c)&&!f)throw n||(o?Ms({error:"missing_key"}):(l.warning(`Cannot find a private key at ${c} or as a keyData option`),l.error("Error: Missing key"))),new Error("Missing private key");if((0,bn.existsSync)(c)&&(f=(0,bn.readFileSync)(c,"utf8")),f&&!f.startsWith("-----BEGIN RSA PRIVATE KEY-----"))throw n||(o?Ms({error:"invalid_private_key"}):l.error("The private key provided is not a valid RSA Private key")),new Error("Invalid private key format");let d=(0,bn.readFileSync)(t),{sessionKey:p,ivSessionKey:h}=cf(f),m=ha(d,p,h),y=ma(e,f),D=`${t}_encrypted.zip`;return(0,bn.writeFileSync)(D,m),n||(o?console.log(JSON.stringify({checksum:y,filename:D,ivSessionKey:h},null,2)):(l.success(`Encoded Checksum: ${y}`),l.success(`ivSessionKey: ${h}`),l.success(`Encrypted zip saved at ${D}`),K("Done \u2705"))),{checksum:y,filename:D,ivSessionKey:h}}catch(a){throw n||(r.json?Ms(a):l.error(`Error encrypting zip file ${q(a)}`)),a instanceof Error?a:new Error(String(a))}}async function WO(t,e,r){await A5(t,e,r,!1)}async function YO(t,e,r=!1){r||ee("List bundles"),await Ee(),e.apikey=e.apikey||ne();let n=await te();if(t=fe(t,n?.config),!e.apikey)throw r||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||l.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 ae(o,e.apikey,["write","all","read","upload"]),await Me(o,e.apikey,t,1,r),r||l.info(`Querying available versions of: ${t} in Capgo`);let i=await uf(o,t);return r||(l.info(`Active versions in Capgo: ${i?.length??0}`),sf(i),K("Done \u2705")),i}var SF=require("node:crypto"),Ko=require("node:fs"),Sf=require("node:process");var ff=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 zn(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 p={attributes:{}};for(;!(c()||f("?>"));){let h=i();if(!h)return p;p.attributes[h.name]=h.value}return u(/\?>\s*/),p}function n(){let d=u(/^<([\w-:.]+)\s*/);if(!d)return;let p={name:d[1],attributes:{},children:[]};for(;!(c()||f(">")||f("?>")||f("/>"));){let m=i();if(!m)return p;p.attributes[m.name]=m.value}if(u(/^\s*\/>\s*/))return p;u(/\??>\s*/),p.content=o();let h;for(;h=n();)p.children.push(h);return u(/^<\/[\w-:.]+>\s*/),p}function o(){let d=u(/^([^<]*)/);return d?s(d[1]):""}function i(){let d=u(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(d)return{name:d[1],value:s(a(d[2]))}}function a(d){return d.replace(/^['"]|['"]$/g,"")}function s(d){return d.replaceAll("&lt;","<").replaceAll("&gt;",">").replaceAll("&amp;","&")}function u(d){let p=t.match(d);if(p)return t=t.slice(p[0].length),p}function c(){return t.length===0}function f(d){return t.startsWith(d)}}var Wr=class extends Error{};var xt=class extends Wr{},qs=class extends Wr{},df=class extends Wr{bucketName;constructor(e){super(`Invalid bucket name: ${e}`),this.bucketName=e}},Yr=class extends Wr{objectName;constructor(e){super(`Invalid object name: ${e}`),this.objectName=e}},Kn=class extends Wr{constructor(){super("accessKey is required")}},ga=class extends Wr{constructor(){super("secretKey is required")}},Hs=class extends Wr{constructor(){super("expirySeconds cannot be less than 1 second or more than 7 days")}},wn=class extends Wr{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 JO(t){try{let r=zn(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 wn(t.status,n,o,{key:i,bucketName:a,resource:s,region:u})}catch{return new wn(t.status,"UnrecognizedError",`Error: Unexpected response code ${t.status} ${t.statusText}. Unable to parse response as XML.`)}}function XO(t){return typeof t!="number"||isNaN(t)?!1:t>=1&&t<=65535}function ZO(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 Gn(t){return!(!O5(t)||t.length===0)}function O5(t){return!(typeof t!="string"||t.length>1024)}function Vs(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}function Lo(t=""){let e={'"':"","&quot;":"","&#34;":"","&QUOT;":"","&#x00022":""};return t.replace(/^("|&quot;|&#34;)|("|&quot;|&#34;)$/g,r=>e[r])}function Xg(t){return t.get("x-amz-version-id")??null}function jo(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 Zg(t){return jo(t).slice(0,8)}function Qg(t,e){return`${Zg(e)}/${t}/s3/aws4_request`}async function pf(t){return t instanceof Uint8Array||(t=new TextEncoder().encode(t)),Vs(new Uint8Array(await crypto.subtle.digest("SHA-256",t)))}var F5=["x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5"],hf=class extends WritableStream{getResult;constructor({client:e,bucketName:r,objectName:n,partSize:o,metadata:i}){let a,s=1,u,c=[],f,d=[];super({start(){},async write(p,h){let y=s++;try{if(y==1&&p.length<o){let E=await e.makeRequest({method:"PUT",headers:new Headers({...i,"Content-Length":String(p.length)}),bucketName:r,objectName:n,payload:p});a={etag:Lo(E.headers.get("etag")??void 0),versionId:Xg(E.headers)};return}y===1&&(u=(await P5({client:e,bucketName:r,objectName:n,metadata:i})).uploadId);let D={"Content-Length":String(p.length)};for(let E of F5){let g=i[E];g&&(D[E]=g)}let v=e.makeRequest({method:"PUT",query:{partNumber:y.toString(),uploadId:u},headers:new Headers(D),bucketName:r,objectName:n,payload:p}).then(E=>{let g=E.headers.get("etag")??"";return g&&(g=g.replace(/^"/,"").replace(/"$/,"")),c.push({part:y,etag:g}),E});d.push(v.catch(E=>{f||(f=E)}))}catch(D){throw D}},async close(){if(!a)if(u){if(await Promise.all(d),f)throw f;c.sort((p,h)=>p.part>h.part?1:-1),a=await k5({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 P5(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=zn(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 k5({client:t,bucketName:e,objectName:r,uploadId:n,etags:o}){let i=`
208
210
  <CompleteMultipartUpload xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
209
211
  ${o.map(d=>` <Part><PartNumber>${d.part}</PartNumber><ETag>${d.etag}</ETag></Part>`).join(`
210
212
  `)}
211
213
  </CompleteMultipartUpload>
212
- `,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=Hn(s).root;if(!u||u.name!=="CompleteMultipartUploadResult")throw new Error(`Unexpected response: ${s}`);let c=u.children.find(d=>d.name==="ETag")?.content;if(!c)throw new Error(`Unable to get ETag from response: ${s}`);let f=zg(a.headers);return{etag:Lo(c),versionId:f}}var Ms="AWS4-HMAC-SHA256";async function W1(t){if(!t.accessKey)throw new Vn;if(!t.secretKey)throw new ma;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=J1(t.headers),n=X1(t.method,t.path,t.headers,r,e),o=await Z1(n,t.date,t.region),i=await Yg(t.date,t.region,t.secretKey),a=Jg(t.accessKey,t.region,t.date),s=Us(await Mo(i,o)).toLowerCase();return`${Ms} Credential=${a}, SignedHeaders=${r.join(";").toLowerCase()}, Signature=${s}`}async function Y1(t){if(!t.accessKey)throw new Vn;if(!t.secretKey)throw new ma;if(t.expirySeconds<1||t.expirySeconds>604800)throw new js;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=jo(t.date),o=J1(t.headers),i=Jg(t.accessKey,t.region,t.date),a="UNSIGNED-PAYLOAD",s=new URLSearchParams(r);s.set("X-Amz-Algorithm",Ms),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,f=e.split("/").map(D=>encodeURIComponent(D)).join("/"),d=X1(t.method,c,t.headers,o,a),p=await Z1(d,t.date,t.region),h=await Yg(t.date,t.region,t.secretKey),m=Us(await Mo(h,p)).toLowerCase();return`${t.protocol}//${t.headers.get("Host")}${f}?${u}&X-Amz-Signature=${m}`}function J1(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 Uo={A:65,Z:90,a:97,z:122,0:48,9:57,"/":47},xM="-._~".split("").map(t=>t.charCodeAt(0));function Wg(t,e=!1){let r=new TextEncoder().encode(t),n="";for(let o of r)o>=Uo.A&&o<=Uo.Z||o>=Uo.a&&o<=Uo.z||o>=Uo[0]&&o<=Uo[9]||xM.includes(o)||o==Uo["/"]&&e?n+=String.fromCharCode(o):n+="%"+o.toString(16).padStart(2,"0").toUpperCase();return n}function X1(t,e,r,n,o){let i=n.reduce((u,c)=>{let f=`${r.get(c)}`.replace(/ +/g," ");return u.push(`${c.toLowerCase()}:${f}`),u},[]),a=e.split("?")[0],s=e.split("?")[1];return s?s=s.split("&").map(u=>{let[c,f]=u.split("=",2);return Wg(decodeURIComponent(c))+"="+Wg(decodeURIComponent(f||""))}).sort().join("&"):s="",[t.toUpperCase(),Wg(a,!0),s,i.join(`
214
+ `,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=zn(s).root;if(!u||u.name!=="CompleteMultipartUploadResult")throw new Error(`Unexpected response: ${s}`);let c=u.children.find(d=>d.name==="ETag")?.content;if(!c)throw new Error(`Unable to get ETag from response: ${s}`);let f=Xg(a.headers);return{etag:Lo(c),versionId:f}}var zs="AWS4-HMAC-SHA256";async function QO(t){if(!t.accessKey)throw new Kn;if(!t.secretKey)throw new ga;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=t1(t.headers),n=r1(t.method,t.path,t.headers,r,e),o=await n1(n,t.date,t.region),i=await ty(t.date,t.region,t.secretKey),a=ry(t.accessKey,t.region,t.date),s=Vs(await Mo(i,o)).toLowerCase();return`${zs} Credential=${a}, SignedHeaders=${r.join(";").toLowerCase()}, Signature=${s}`}async function e1(t){if(!t.accessKey)throw new Kn;if(!t.secretKey)throw new ga;if(t.expirySeconds<1||t.expirySeconds>604800)throw new Hs;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=jo(t.date),o=t1(t.headers),i=ry(t.accessKey,t.region,t.date),a="UNSIGNED-PAYLOAD",s=new URLSearchParams(r);s.set("X-Amz-Algorithm",zs),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,f=e.split("/").map(D=>encodeURIComponent(D)).join("/"),d=r1(t.method,c,t.headers,o,a),p=await n1(d,t.date,t.region),h=await ty(t.date,t.region,t.secretKey),m=Vs(await Mo(h,p)).toLowerCase();return`${t.protocol}//${t.headers.get("Host")}${f}?${u}&X-Amz-Signature=${m}`}function t1(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 Uo={A:65,Z:90,a:97,z:122,0:48,9:57,"/":47},$5="-._~".split("").map(t=>t.charCodeAt(0));function ey(t,e=!1){let r=new TextEncoder().encode(t),n="";for(let o of r)o>=Uo.A&&o<=Uo.Z||o>=Uo.a&&o<=Uo.z||o>=Uo[0]&&o<=Uo[9]||$5.includes(o)||o==Uo["/"]&&e?n+=String.fromCharCode(o):n+="%"+o.toString(16).padStart(2,"0").toUpperCase();return n}function r1(t,e,r,n,o){let i=n.reduce((u,c)=>{let f=`${r.get(c)}`.replace(/ +/g," ");return u.push(`${c.toLowerCase()}:${f}`),u},[]),a=e.split("?")[0],s=e.split("?")[1];return s?s=s.split("&").map(u=>{let[c,f]=u.split("=",2);return ey(decodeURIComponent(c))+"="+ey(decodeURIComponent(f||""))}).sort().join("&"):s="",[t.toUpperCase(),ey(a,!0),s,i.join(`
213
215
  `)+`
214
216
  `,n.join(";").toLowerCase(),o].join(`
215
- `)}async function Z1(t,e,r){let n=await cf(t),o=Gg(r,e);return[Ms,jo(e),o,n].join(`
216
- `)}async function Yg(t,e,r){let n=Kg(t),o=await Mo("AWS4"+r,n),i=await Mo(o,e),a=await Mo(i,"s3");return await Mo(a,"aws4_request")}function Jg(t,e,r){return`${t}/${Gg(e,r)}`}async function Mo(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 Q1(t){if(!t.accessKey)throw new Vn;if(!t.secretKey)throw new ma;if(t.expirySeconds<1||t.expirySeconds>604800)throw new js;let e=new Date(t.date);e.setSeconds(e.getSeconds()+t.expirySeconds);let r=Jg(t.accessKey,t.region,t.date),n=jo(t.date),o={"X-Amz-Algorithm":Ms,"X-Amz-Credential":r,"X-Amz-Date":n,key:t.objectKey,...t.fields},i=[{bucket:t.bucket},{key:t.objectKey},{"X-Amz-Algorithm":Ms},{"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,f=await Yg(t.date,t.region,t.secretKey),d=Us(await Mo(f,c)).toLowerCase();return o["X-Amz-Signature"]=d,{url:`${t.protocol}//${t.host}/${t.bucket}`,fields:o}}var AM=["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"],OM=5*1024*1024,FM=5*1024*1024*1024,Xg=5*1024*1024*1024*1024,qs=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 St("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 Ls(`Invalid endPoint URL: ${e}`)}}if(typeof e!="string"||e.length===0)throw new Ls(`Invalid endPoint: ${e}`);if(r===void 0&&(r=!0),n!==void 0&&!K1(n))throw new St(`Invalid port: ${n}`);if(i.accessKey&&!i.secretKey)throw new St("If specifying access key, secret key must also be provided.");if(i.accessKey&&i.accessKey.startsWith("ASIA")&&!i.sessionToken)throw new St("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 St("pathPrefix is incompatible with pathStyle=false");if(!this.pathPrefix.startsWith("/"))throw new St("pathPrefix should start with /");if(this.pathPrefix.endsWith("/"))throw new St("pathPrefix should not end with /")}}getBucketName(e){let r=e?.bucketName??this.defaultBucket;if(r===void 0||!G1(r))throw new uf(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(f=>encodeURIComponent(f)).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 f=await cf(r??new Uint8Array);i.set("x-amz-date",jo(o)),i.set("x-amz-content-sha256",f),this.accessKey&&(this.sessionToken&&i.set("x-amz-security-token",this.sessionToken),i.set("authorization",await W1({headers:i,method:e,path:s,accessKey:this.accessKey,secretKey:this.#e,region:this.region,date:o})));let d=`${this.protocol}//${a}${u}`,p=await fetch(d,{method:e,headers:i,body:r});if(p.status!==c)throw p.status>=400?await z1(p):p.status===301?new yn(p.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 yn(p.status,"UnexpectedStatusCode",`Unexpected response code from the server (expected ${c}, got ${p.status} ${p.statusText}).`);return n.returnBody||await p.body?.getReader().read(),p}async deleteObject(e,r={}){let n=this.getBucketName(r);if(!zn(e))throw new zr(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 yn&&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(!zn(e))throw new zr(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 Vn;if(!zn(r))throw new zr(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 Y1({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 St("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=Hn(u).root;if(!c||c.name!=="ListBucketResult")throw new Error(`Unexpected response: ${u}`);let f=c.children.filter(h=>h.name==="CommonPrefixes").flatMap(h=>h.children),d=[];for(let h of f)d.push({type:"CommonPrefix",prefix:h.content??""}),i++;for(let h of c.children.filter(m=>m.name==="Contents"))d.push({type:"Object",key:h.children.find(m=>m.name==="Key")?.content??"",etag:Lo(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++;d.sort((h,m)=>{let y=h.type==="Object"?h.key:h.prefix,D=m.type==="Object"?m.key:m.prefix;return y>D?1:y<D?-1:0});for(let h of d)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(!zn(e))throw new zr(e);let i,a;if(typeof r=="string"){let f=new TextEncoder().encode(r);typeof ReadableStream.from<"u"?a=ReadableStream.from([f]):a=new ReadableStream({start(d){d.enqueue(f),d.close()}}),i=f.length}else if(r instanceof Uint8Array)typeof ReadableStream.from<"u"?a=ReadableStream.from([r]):a=new ReadableStream({start(f){f.enqueue(r),f.close()}}),i=r.byteLength;else if(r instanceof ReadableStream)a=r;else throw new St("Invalid stream/data type provided.");if(n?.size!==void 0){if(i!==void 0&&n?.size!==i)throw new St(`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 St(`invalid size specified: ${n.size}`);i=n.size}let s=n?.partSize??this.calculatePartSize(i);if(s<OM)throw new St("Part size should be greater than 5MB");if(s>FM)throw new St("Part size should be less than 6MB");let u=new sf(s),c=new lf({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(!zn(e))throw new zr(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 AM)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:Lo(i.headers.get("ETag")??"")}}async copyObject(e,r,n){let o=this.getBucketName(n),i=e.sourceBucketName??o;if(!zn(r))throw new zr(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(),f=Hn(c).root;if(!f||f.name!=="CopyObjectResult")throw new Error(`Unexpected response: ${c}`);let d=f.children.find(h=>h.name==="ETag")?.content??"",p=f.children.find(h=>h.name==="LastModified")?.content;if(p===void 0)throw new Error("Unable to find <LastModified>...</LastModified> from the server.");return{copySourceVersionId:u.headers.get("x-amz-copy-source-version-id")||null,etag:Lo(d),lastModified:new Date(p),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 yn&&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(!zn(e))throw new zr(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 Q1({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})}};function eO(t){try{let e=ge(t);return qt(_n(e,"patch"))}catch{let e=t.match(/^(\d+)\.(\d+)\.(\d+)/);if(e){let[,r,n,o]=e;return`${r}.${n}.${Number.parseInt(o)+1}`}return"1.0.1"}}async function tO(t,e){let r=eO(t),n=e?` for ${e}`:"",o=await mt({message:`How do you want to handle the version${n}?`,options:[{value:"auto",label:`Auto: Bump patch version (${t} \u2192 ${r})`},{value:"manual",label:"Manual: I'll provide the version number"}]});if(le(o))return null;if(o==="auto")return l.info(`\u{1F522} Auto-bumped version from ${t} to ${r}`),r;let i=await Ut({message:`Current version is ${t}. Enter new version:`,validate:a=>{if(!a)return"Version is required";if(!a.match(/^\d+\.\d+\.\d+/))return"Please enter a valid version (x.y.z)"}});return le(i)?null:i}function rO(t){let e=eO(t);try{let r=ge(t);return[e,qt(_n(r,"minor")),`${t}-beta.1`,`${t}.1`]}catch{return[e,`${t}.1`,`${t}-beta.1`,`${t}-rc.1`]}}var qo=require("node:fs"),ff=require("node:path");function kM(t,e){return(0,qo.readFileSync)(t,"utf8").includes(e)}function Hs(t,e){let r=(0,qo.readdirSync)(t);for(let n of r){let o=(0,ff.join)(t,n),i=(0,qo.statSync)(o);if(i.isDirectory()){if(Hs(o,e))return!0}else if(i.isFile()&&(0,ff.extname)(o)===".js"&&kM(o,e))return!0}return!1}function df(t){return(0,qo.readdirSync)(t).indexOf("index.html")>-1}var fF=require("node:buffer"),dF=require("node:crypto"),Da=require("node:fs"),pF=require("node:os"),zo=require("node:path"),hF=require("node:process"),wf=require("node:stream/consumers"),mF=require("node:zlib");var gF=fe(lF()),yF=fe(el());async function z9(t,e){try{return(await fetch(`${t.hostFilesApi}/files/read/attachments/${encodeURIComponent(e)}`,{method:"HEAD"})).ok}catch{return!1}}var K9=8192;async function G9(t){let e=Dt((0,hF.cwd)()),r=await Hr("@capgo/capacitor-updater",e,t.packageJson),n;try{n=r?ge(r):void 0}catch{n=void 0}if(!r||!n)return{version:null,supportsBrotliV2:!1};let o=!Mn(n,void 0,void 0,Is);return{version:`${n.major}.${n.minor}.${n.patch}`,supportsBrotliV2:o}}function W9(t,e){if(!e)return!1;let r=e.split(",").map(n=>n.trim()).filter(n=>!!n);return r.length===0?!1:gF.isMatch(t,r)}async function Y9(t,e,r){let o=(0,Da.statSync)(t).size,i=await(0,wf.buffer)((0,Da.createReadStream)(t));if(o===0)return{buffer:i,useBrotli:!1};if(W9(e,r.noBrotliPatterns))return{buffer:i,useBrotli:!1};if(o<K9)return{buffer:i,useBrotli:!1};try{let a=await(0,wf.buffer)((0,Da.createReadStream)(t).pipe((0,mF.createBrotliCompress)({})));return a.length>=o-10?{buffer:i,useBrotli:!1}:{buffer:a,useBrotli:!0}}catch(a){return l.warn(`Brotli compression failed for ${t}: ${a}, using original file`),{buffer:i,useBrotli:!1}}}async function DF(t,e,r,n,o,i,a=!1){let s=be();s.start(o!=="v2"?"Generating the update manifest":`Generating the update manifest with ${a?"V3":"V2"} encryption`);let u=await WA(t);if(o==="v2")for(let c of u)c.hash=a?af(c.hash,i):ha(c.hash,i);return s.stop("Manifest generated successfully"),await me(e,{channel:"partial-update",event:"Generate manifest",icon:"\u{1F4C2}",user_id:r,tags:{"app-id":n},notify:!1}),u}function J9(t){return(0,pF.platform)()!=="win32"?t:zo.win32.normalize(t).split(zo.win32.sep).join(zo.posix.sep)}function X9(t){let e=t.split("/").map(r=>encodeURIComponent(r)).join("/");return t.includes(" ")&&l.warn(`File "${t}" contains spaces in its name.`),e}async function bF(t,e,r,n,o,i,a){let s=be();s.start("Preparing partial update with TUS protocol");let u=performance.now(),c=await mr(),f=!!(a.partial||a.delta||a.partialOnly||a.deltaOnly),{version:d,supportsBrotliV2:p}=await G9(a);if(p)a.disableBrotli?l.info("Brotli compression disabled by user request"):a.noBrotliPatterns&&l.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 (${d||"unknown"}). To use Delta updates, please upgrade to version ${KA} (v5), ${GA} (v6) or ${Is} (v7) or higher.`);let h=e.filter(v=>v.file.includes(" "));if(h.length>0)throw new Error(`Files with spaces in their names (${h.map(v=>v.file).join(", ")}). Please rename the files.`);let m=0,y=e.length,D=0;try{s.message(`Uploading ${y} files using TUS protocol`);let v=async P=>{let F=(0,zo.join)(r,P.file),B=J9(P.file),T,j=!1;if(a.disableBrotli)T=await(0,wf.buffer)((0,Da.createReadStream)(F)),j=!1;else{let b=await Y9(F,B,a);T=b.buffer,j=b.useBrotli}let A=T;i&&(A=pa(T,i.sessionKey,i.ivSessionKey));let M=B;j&&(M=`${B}.br`,D++);let L=X9(M),X=(0,dF.createHash)("sha256").update(P.hash).digest("hex"),k;if(i){let b=fF.Buffer.from(i.ivSessionKey).toString("hex");k=`orgs/${o}/apps/${n}/delta/${b}/${X}_${L}`}else k=`orgs/${o}/apps/${n}/delta/${X}_${L}`;return!i&&await z9(c,k)?(m++,Promise.resolve({file_name:L,s3_path:k,file_hash:P.hash})):new Promise((b,w)=>{s.message(`Prepare upload partial file: ${B}`),new yF.Upload(A,{endpoint:`${c.hostFilesApi}/files/upload/attachments/`,chunkSize:a.tusChunkSize,retryDelays:[0,1e3,3e3,5e3,1e4],removeFingerprintOnSuccess:!0,metadata:{filename:k},headers:{Authorization:t},onError:O=>{let R=O.toString(),$;try{let I=R.match(/response text: (\{.*?\})/);I&&I[1]&&($=JSON.parse(I[1]).moreInfo?.requestId)}catch{}let H=$?` [requestId: ${$}]`:"";l.error(`Failed to upload ${B}: ${R}${H}`),w(O)},onProgress(){let O=(m/y*100).toFixed(2);s.message(`Uploading partial update: ${O}%`)},onSuccess(){m++,b({file_name:L,s3_path:k,file_hash:P.hash})}}).start()})},E=500,g=[];for(let P=0;P<e.length;P+=E){let F=e.slice(P,P+E),B=Math.floor(P/E)+1,T=Math.ceil(e.length/E);T>1&&s.message(`Processing batch ${B}/${T} (${F.length} files)`);let j=await Promise.all(F.map(A=>v(A)));g.push(...j)}let S=((performance.now()-u)/1e3).toFixed(2);return s.stop(`Partial update uploaded successfully \u{1F4AA} in (${S} seconds)`),D>0&&l.info(`${D} of ${y} files were compressed with brotli and use .br extension`),await me(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 me(t,{channel:"performance",event:"Partial upload performance",icon:"\u{1F684}",user_id:o,tags:{"app-id":n,time:S},notify:!1}),g}catch(v){let g=((performance.now()-u)/1e3).toFixed(2);if(s.stop(`Failed to upload Partial bundle (after ${g} seconds)`),f)throw l.error(`Error uploading partial update: ${v}`),l.error("Delta/partial upload was explicitly requested but failed. Upload aborted."),v;return l.info(`Error uploading partial update: ${v}, This is not a critical error, the bundle has been uploaded without the partial files`),null}}function De(t){throw l.error(t),new Error(t)}async function Z9(t,e){let r=Fr("",e.packageJson),n=e.bundle||t?.plugins?.CapacitorUpdater?.version||r||`0.0.1-beta.${(0,wF.randomUUID)().split("-")[0]}`;return ia.test(n)||De(`Your bundle name ${n}, is not valid it should follow semver convention : https://semver.org/`),n}function Q9(t){let e=t.apikey||ne();return e||De("Missing API key, you need to provide an API key to upload your bundle"),e}function e7(t,e,r){let n=pe(t,r),o=e.path||r?.webDir;return n||De("Missing argument, you need to provide a appid or be in a capacitor project"),o||De("Missing argument, you need to provide a path (--path), or be in a capacitor project"),(0,Ko.existsSync)(o)||De(`Path ${o} does not exist, build your app first, or provide a valid path`),{appid:n,path:o}}function t7(t,e){let r=t.codeCheck;(typeof r>"u"||r)&&(Hs(e,"notifyAppReady")||De(`notifyAppReady() is missing in the build folder of your app. see: https://capgo.app/docs/plugin/api/#notifyappready
217
- If you are sure your app has this code, you can use the --no-code-check option`),df(e)||De(`index.html is missing in the root folder of ${e}`))}async function r7(t,e,r,n,o,i){let a=r.ignoreMetadataCheck,s=r.autoMinUpdateVersion,u=r.minUpdateVersion,{data:c,error:f}=await t.from("channels").select("disable_auto_update, version ( min_update_version, native_packages )").eq("name",n).eq("app_id",o).single(),d=!!c&&c.disable_auto_update==="version_number",p,h;if(!f&&c&&c.version&&c.version.native_packages&&!a){let D=be();D.start(`Checking bundle compatibility with channel ${n}`);let{finalCompatibility:v,localDependencies:E}=await Wl(t,o,n,r.packageJson,r.nodeModules);if(h=v,p=E,h.find(g=>!To(g)))D.stop(`Bundle NOT compatible with ${n} channel`),l.warn(`You can check compatibility with "${e.runner} @capgo/cli bundle compatibility"`),s&&(u=i,l.info(`Auto set min-update-version to ${u}`));else if(s)try{let{min_update_version:g}=c.version;(!g||!ia.test(g))&&De("Invalid remote min update version, skipping auto setting compatibility"),u=g,D.stop(`Auto set min-update-version to ${u}`)}catch{De(`Cannot auto set compatibility, invalid data ${c}`)}else D.stop(`Bundle compatible with ${n} channel`)}else a||(l.warn(`Channel ${n} is new or it's your first upload with compatibility check, it will be ignored this time`),p=await Ng(r.packageJson,r.nodeModules),s&&(u=i,l.info(`Auto set min-update-version to ${u}`)));d&&!u&&!a&&De("You need to provide a min-update-version to upload a bundle to this channel"),u&&(ia.test(u)||De(`Your minimal version update ${u}, is not valid it should follow semver convention : https://semver.org/`));let m=p?new Map(p.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,v])=>({name:D,version:v.version})):void 0,minUpdateVersion:u}}async function n7(t,e,r,n=!1,o=!1){let{data:i,error:a}=await t.rpc("exist_app_versions",{appid:e,name_version:r}).single();if(i||a){if(n)return l.warn(`Version ${r} already exists - exiting gracefully due to --silent-fail option`),K("Bundle version already exists - exiting gracefully \u{1F389}"),!0;if(o){l.error(`\u274C Version ${r} already exists`);let s=rO(r);l.info("\u{1F4A1} Here are some suggestions:"),s.forEach((f,d)=>{l.info(` ${d+1}. ${f}`)});let u=await mt({message:"What would you like to do?",options:[{value:"suggest1",label:`Use ${s[0]}`},{value:"suggest2",label:`Use ${s[1]}`},{value:"suggest3",label:`Use ${s[2]}`},{value:"suggest4",label:`Use ${s[3]}`},{value:"custom",label:"Enter a custom version"},{value:"cancel",label:"Cancel upload"}]});(le(u)||u==="cancel")&&De("Upload cancelled by user");let c;if(u==="custom"){let f=await tO(r,"upload");f||De("Upload cancelled by user"),c=f}else{let f=Number.parseInt(u.replace("suggest",""))-1;c=s[f]}return l.info(`\u{1F504} Retrying with new version: ${c}`),c}De(`Version ${r} already exists ${q(a)}`)}return!1}async function o7(t,e,r,n,o,i,a,s){let u,c,f="",d=null,p="none",h="",m="",y=e.keyV2,D=e.key===!1,v=be();v.start(`Zipping bundle from ${t}`),d=await Kl(t),v.message("Calculating checksum");let E=Dt((0,vf.cwd)()),g=await Hr("@capgo/capacitor-updater",E,e.packageJson),_=!1,S;try{S=g?ge(g):void 0}catch{S=void 0}if(g?S?_=!Mn(S,Is):(g==="link:@capgo/capacitor-updater"||g==="file:.."||g==="file:../")&&(l.warn("Using local @capgo/capacitor-updater. Assuming latest version for checksum calculation."),_=!0):De("Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager"),(y||e.keyDataV2||(0,Ko.existsSync)(nr))&&!D||_?f=await an(d,"sha256"):f=await an(d,"crc32"),v.stop(`Checksum ${_?"SHA256":"CRC32"}: ${f}`),D)l.info("Encryption ignored");else if((y||(0,Ko.existsSync)(nr)||e.keyDataV2)&&!e.oldEncryption){let B=typeof y=="string"?y:nr,T=e.keyDataV2||"";!T&&!(0,Ko.existsSync)(B)&&De(`Cannot find private key ${B}`),await me(r,{channel:"app",event:"App encryption v2",icon:"\u{1F511}",user_id:n,tags:{"app-id":o},notify:!1},e.verbose),T||(T=(0,Ko.readFileSync)(B).toString());let j=S&&!Mn(S,"5.30.0","6.30.0","7.30.0");l.info(`Encrypting your bundle with ${j?"V3":"V2"}`);let{sessionKey:A,ivSessionKey:M}=of(T),L=pa(d,A,M);f=j?af(f,T):ha(f,T),u=M,c=A,p="v2",h=T,s&&(m=U1(s),e.verbose&&l.info(`[Verbose] Encryption key_id: ${m}`)),e.displayIvSession&&l.info(`Your Iv Session key is ${u},
217
+ `)}async function n1(t,e,r){let n=await pf(t),o=Qg(r,e);return[zs,jo(e),o,n].join(`
218
+ `)}async function ty(t,e,r){let n=Zg(t),o=await Mo("AWS4"+r,n),i=await Mo(o,e),a=await Mo(i,"s3");return await Mo(a,"aws4_request")}function ry(t,e,r){return`${t}/${Qg(e,r)}`}async function Mo(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 o1(t){if(!t.accessKey)throw new Kn;if(!t.secretKey)throw new ga;if(t.expirySeconds<1||t.expirySeconds>604800)throw new Hs;let e=new Date(t.date);e.setSeconds(e.getSeconds()+t.expirySeconds);let r=ry(t.accessKey,t.region,t.date),n=jo(t.date),o={"X-Amz-Algorithm":zs,"X-Amz-Credential":r,"X-Amz-Date":n,key:t.objectKey,...t.fields},i=[{bucket:t.bucket},{key:t.objectKey},{"X-Amz-Algorithm":zs},{"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,f=await ty(t.date,t.region,t.secretKey),d=Vs(await Mo(f,c)).toLowerCase();return o["X-Amz-Signature"]=d,{url:`${t.protocol}//${t.host}/${t.bucket}`,fields:o}}var I5=["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"],T5=5*1024*1024,R5=5*1024*1024*1024,ny=5*1024*1024*1024*1024,Ks=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 xt("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 qs(`Invalid endPoint URL: ${e}`)}}if(typeof e!="string"||e.length===0)throw new qs(`Invalid endPoint: ${e}`);if(r===void 0&&(r=!0),n!==void 0&&!XO(n))throw new xt(`Invalid port: ${n}`);if(i.accessKey&&!i.secretKey)throw new xt("If specifying access key, secret key must also be provided.");if(i.accessKey&&i.accessKey.startsWith("ASIA")&&!i.sessionToken)throw new xt("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 xt("pathPrefix is incompatible with pathStyle=false");if(!this.pathPrefix.startsWith("/"))throw new xt("pathPrefix should start with /");if(this.pathPrefix.endsWith("/"))throw new xt("pathPrefix should not end with /")}}getBucketName(e){let r=e?.bucketName??this.defaultBucket;if(r===void 0||!ZO(r))throw new df(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(f=>encodeURIComponent(f)).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 f=await pf(r??new Uint8Array);i.set("x-amz-date",jo(o)),i.set("x-amz-content-sha256",f),this.accessKey&&(this.sessionToken&&i.set("x-amz-security-token",this.sessionToken),i.set("authorization",await QO({headers:i,method:e,path:s,accessKey:this.accessKey,secretKey:this.#e,region:this.region,date:o})));let d=`${this.protocol}//${a}${u}`,p=await fetch(d,{method:e,headers:i,body:r});if(p.status!==c)throw p.status>=400?await JO(p):p.status===301?new wn(p.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 wn(p.status,"UnexpectedStatusCode",`Unexpected response code from the server (expected ${c}, got ${p.status} ${p.statusText}).`);return n.returnBody||await p.body?.getReader().read(),p}async deleteObject(e,r={}){let n=this.getBucketName(r);if(!Gn(e))throw new Yr(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 wn&&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(!Gn(e))throw new Yr(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 Kn;if(!Gn(r))throw new Yr(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 e1({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 xt("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=zn(u).root;if(!c||c.name!=="ListBucketResult")throw new Error(`Unexpected response: ${u}`);let f=c.children.filter(h=>h.name==="CommonPrefixes").flatMap(h=>h.children),d=[];for(let h of f)d.push({type:"CommonPrefix",prefix:h.content??""}),i++;for(let h of c.children.filter(m=>m.name==="Contents"))d.push({type:"Object",key:h.children.find(m=>m.name==="Key")?.content??"",etag:Lo(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++;d.sort((h,m)=>{let y=h.type==="Object"?h.key:h.prefix,D=m.type==="Object"?m.key:m.prefix;return y>D?1:y<D?-1:0});for(let h of d)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(!Gn(e))throw new Yr(e);let i,a;if(typeof r=="string"){let f=new TextEncoder().encode(r);typeof ReadableStream.from<"u"?a=ReadableStream.from([f]):a=new ReadableStream({start(d){d.enqueue(f),d.close()}}),i=f.length}else if(r instanceof Uint8Array)typeof ReadableStream.from<"u"?a=ReadableStream.from([r]):a=new ReadableStream({start(f){f.enqueue(r),f.close()}}),i=r.byteLength;else if(r instanceof ReadableStream)a=r;else throw new xt("Invalid stream/data type provided.");if(n?.size!==void 0){if(i!==void 0&&n?.size!==i)throw new xt(`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 xt(`invalid size specified: ${n.size}`);i=n.size}let s=n?.partSize??this.calculatePartSize(i);if(s<T5)throw new xt("Part size should be greater than 5MB");if(s>R5)throw new xt("Part size should be less than 6MB");let u=new ff(s),c=new hf({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=ny),e>ny)throw new TypeError(`size should not be more than ${ny}`);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(!Gn(e))throw new Yr(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 I5)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:Lo(i.headers.get("ETag")??"")}}async copyObject(e,r,n){let o=this.getBucketName(n),i=e.sourceBucketName??o;if(!Gn(r))throw new Yr(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(),f=zn(c).root;if(!f||f.name!=="CopyObjectResult")throw new Error(`Unexpected response: ${c}`);let d=f.children.find(h=>h.name==="ETag")?.content??"",p=f.children.find(h=>h.name==="LastModified")?.content;if(p===void 0)throw new Error("Unable to find <LastModified>...</LastModified> from the server.");return{copySourceVersionId:u.headers.get("x-amz-copy-source-version-id")||null,etag:Lo(d),lastModified:new Date(p),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 wn&&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(!Gn(e))throw new Yr(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 o1({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})}};function i1(t){try{let e=ge(t);return Ht(An(e,"patch"))}catch{let e=t.match(/^(\d+)\.(\d+)\.(\d+)/);if(e){let[,r,n,o]=e;return`${r}.${n}.${Number.parseInt(o)+1}`}return"1.0.1"}}async function a1(t,e){let r=i1(t),n=e?` for ${e}`:"",o=await gt({message:`How do you want to handle the version${n}?`,options:[{value:"auto",label:`Auto: Bump patch version (${t} \u2192 ${r})`},{value:"manual",label:"Manual: I'll provide the version number"}]});if(le(o))return null;if(o==="auto")return l.info(`\u{1F522} Auto-bumped version from ${t} to ${r}`),r;let i=await Mt({message:`Current version is ${t}. Enter new version:`,validate:a=>{if(!a)return"Version is required";if(!a.match(/^\d+\.\d+\.\d+/))return"Please enter a valid version (x.y.z)"}});return le(i)?null:i}function s1(t){let e=i1(t);try{let r=ge(t);return[e,Ht(An(r,"minor")),`${t}-beta.1`,`${t}.1`]}catch{return[e,`${t}.1`,`${t}-beta.1`,`${t}-rc.1`]}}var qo=require("node:fs"),mf=require("node:path");function B5(t,e){return(0,qo.readFileSync)(t,"utf8").includes(e)}function Gs(t,e){let r=(0,qo.readdirSync)(t);for(let n of r){let o=(0,mf.join)(t,n),i=(0,qo.statSync)(o);if(i.isDirectory()){if(Gs(o,e))return!0}else if(i.isFile()&&(0,mf.extname)(o)===".js"&&B5(o,e))return!0}return!1}function gf(t){return(0,qo.readdirSync)(t).indexOf("index.html")>-1}var gF=require("node:buffer"),yF=require("node:crypto"),ba=require("node:fs"),DF=require("node:os"),zo=require("node:path"),bF=require("node:process"),_f=require("node:stream/consumers"),wF=require("node:zlib");var vF=pe(mF()),CF=pe(ol());async function X9(t,e){try{return(await fetch(`${t.hostFilesApi}/files/read/attachments/${encodeURIComponent(e)}`,{method:"HEAD"})).ok}catch{return!1}}var Z9=8192;async function Q9(t){let e=bt((0,bF.cwd)()),r=await Kr("@capgo/capacitor-updater",e,t.packageJson),n;try{n=r?ge(r):void 0}catch{n=void 0}if(!r||!n)return{version:null,supportsBrotliV2:!1};let o=!Vn(n,void 0,void 0,Ts);return{version:`${n.major}.${n.minor}.${n.patch}`,supportsBrotliV2:o}}function e7(t,e){if(!e)return!1;let r=e.split(",").map(n=>n.trim()).filter(n=>!!n);return r.length===0?!1:vF.isMatch(t,r)}async function t7(t,e,r){let o=(0,ba.statSync)(t).size,i=await(0,_f.buffer)((0,ba.createReadStream)(t));if(o===0)return{buffer:i,useBrotli:!1};if(e7(e,r.noBrotliPatterns))return{buffer:i,useBrotli:!1};if(o<Z9)return{buffer:i,useBrotli:!1};try{let a=await(0,_f.buffer)((0,ba.createReadStream)(t).pipe((0,wF.createBrotliCompress)({})));return a.length>=o-10?{buffer:i,useBrotli:!1}:{buffer:a,useBrotli:!0}}catch(a){return l.warn(`Brotli compression failed for ${t}: ${a}, using original file`),{buffer:i,useBrotli:!1}}}async function EF(t,e,r,n,o,i,a=!1){let s=be();s.start(o!=="v2"?"Generating the update manifest":`Generating the update manifest with ${a?"V3":"V2"} encryption`);let u=await QA(t);if(o==="v2")for(let c of u)c.hash=a?lf(c.hash,i):ma(c.hash,i);return s.stop("Manifest generated successfully"),await me(e,{channel:"partial-update",event:"Generate manifest",icon:"\u{1F4C2}",user_id:r,tags:{"app-id":n},notify:!1}),u}function r7(t){return(0,DF.platform)()!=="win32"?t:zo.win32.normalize(t).split(zo.win32.sep).join(zo.posix.sep)}function n7(t){let e=t.split("/").map(r=>encodeURIComponent(r)).join("/");return t.includes(" ")&&l.warn(`File "${t}" contains spaces in its name.`),e}async function _F(t,e,r,n,o,i,a){let s=be();s.start("Preparing partial update with TUS protocol");let u=performance.now(),c=await yr(),f=!!(a.partial||a.delta||a.partialOnly||a.deltaOnly),{version:d,supportsBrotliV2:p}=await Q9(a);if(p)a.disableBrotli?l.info("Brotli compression disabled by user request"):a.noBrotliPatterns&&l.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 (${d||"unknown"}). To use Delta updates, please upgrade to version ${XA} (v5), ${ZA} (v6) or ${Ts} (v7) or higher.`);let h=e.filter(v=>v.file.includes(" "));if(h.length>0)throw new Error(`Files with spaces in their names (${h.map(v=>v.file).join(", ")}). Please rename the files.`);let m=0,y=e.length,D=0;try{s.message(`Uploading ${y} files using TUS protocol`);let v=async k=>{let F=(0,zo.join)(r,k.file),B=r7(k.file),T,j=!1;if(a.disableBrotli)T=await(0,_f.buffer)((0,ba.createReadStream)(F)),j=!1;else{let b=await t7(F,B,a);T=b.buffer,j=b.useBrotli}let A=T;i&&(A=ha(T,i.sessionKey,i.ivSessionKey));let M=B;j&&(M=`${B}.br`,D++);let L=n7(M),X=(0,yF.createHash)("sha256").update(k.hash).digest("hex"),P;if(i){let b=gF.Buffer.from(i.ivSessionKey).toString("hex");P=`orgs/${o}/apps/${n}/delta/${b}/${X}_${L}`}else P=`orgs/${o}/apps/${n}/delta/${X}_${L}`;return!i&&await X9(c,P)?(m++,Promise.resolve({file_name:L,s3_path:P,file_hash:k.hash})):new Promise((b,w)=>{s.message(`Prepare upload partial file: ${B}`),new CF.Upload(A,{endpoint:`${c.hostFilesApi}/files/upload/attachments/`,chunkSize:a.tusChunkSize,retryDelays:[0,1e3,3e3,5e3,1e4],removeFingerprintOnSuccess:!0,metadata:{filename:P},headers:{Authorization:t},onError:O=>{let R=O.toString(),$;try{let I=R.match(/response text: (\{.*?\})/);I&&I[1]&&($=JSON.parse(I[1]).moreInfo?.requestId)}catch{}let H=$?` [requestId: ${$}]`:"";l.error(`Failed to upload ${B}: ${R}${H}`),w(O)},onProgress(){let O=(m/y*100).toFixed(2);s.message(`Uploading partial update: ${O}%`)},onSuccess(){m++,b({file_name:L,s3_path:P,file_hash:k.hash})}}).start()})},E=500,g=[];for(let k=0;k<e.length;k+=E){let F=e.slice(k,k+E),B=Math.floor(k/E)+1,T=Math.ceil(e.length/E);T>1&&s.message(`Processing batch ${B}/${T} (${F.length} files)`);let j=await Promise.all(F.map(A=>v(A)));g.push(...j)}let S=((performance.now()-u)/1e3).toFixed(2);return s.stop(`Partial update uploaded successfully \u{1F4AA} in (${S} seconds)`),D>0&&l.info(`${D} of ${y} files were compressed with brotli and use .br extension`),await me(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 me(t,{channel:"performance",event:"Partial upload performance",icon:"\u{1F684}",user_id:o,tags:{"app-id":n,time:S},notify:!1}),g}catch(v){let g=((performance.now()-u)/1e3).toFixed(2);if(s.stop(`Failed to upload Partial bundle (after ${g} seconds)`),f)throw l.error(`Error uploading partial update: ${v}`),l.error("Delta/partial upload was explicitly requested but failed. Upload aborted."),v;return l.info(`Error uploading partial update: ${v}, This is not a critical error, the bundle has been uploaded without the partial files`),null}}function De(t){throw l.error(t),new Error(t)}async function o7(t,e){let r=Ir("",e.packageJson),n=e.bundle||t?.plugins?.CapacitorUpdater?.version||r||`0.0.1-beta.${(0,SF.randomUUID)().split("-")[0]}`;return ia.test(n)||De(`Your bundle name ${n}, is not valid it should follow semver convention : https://semver.org/`),n}function i7(t){let e=t.apikey||ne();return e||De("Missing API key, you need to provide an API key to upload your bundle"),e}function a7(t,e,r){let n=fe(t,r),o=e.path||r?.webDir;return n||De("Missing argument, you need to provide a appid or be in a capacitor project"),o||De("Missing argument, you need to provide a path (--path), or be in a capacitor project"),(0,Ko.existsSync)(o)||De(`Path ${o} does not exist, build your app first, or provide a valid path`),{appid:n,path:o}}function s7(t,e){let r=t.codeCheck;(typeof r>"u"||r)&&(Gs(e,"notifyAppReady")||De(`notifyAppReady() is missing in the build folder of your app. see: https://capgo.app/docs/plugin/api/#notifyappready
219
+ If you are sure your app has this code, you can use the --no-code-check option`),gf(e)||De(`index.html is missing in the root folder of ${e}`))}async function u7(t,e,r,n,o,i){let a=r.ignoreMetadataCheck,s=r.autoMinUpdateVersion,u=r.minUpdateVersion,{data:c,error:f}=await t.from("channels").select("disable_auto_update, version ( min_update_version, native_packages )").eq("name",n).eq("app_id",o).single(),d=!!c&&c.disable_auto_update==="version_number",p,h;if(!f&&c&&c.version&&c.version.native_packages&&!a){let D=be();D.start(`Checking bundle compatibility with channel ${n}`);let{finalCompatibility:v,localDependencies:E}=await Zl(t,o,n,r.packageJson,r.nodeModules);if(h=v,p=E,h.find(g=>!Bo(g)))D.stop(`Bundle NOT compatible with ${n} channel`),l.warn(`You can check compatibility with "${e.runner} @capgo/cli bundle compatibility"`),s&&(u=i,l.info(`Auto set min-update-version to ${u}`));else if(s)try{let{min_update_version:g}=c.version;(!g||!ia.test(g))&&De("Invalid remote min update version, skipping auto setting compatibility"),u=g,D.stop(`Auto set min-update-version to ${u}`)}catch{De(`Cannot auto set compatibility, invalid data ${c}`)}else D.stop(`Bundle compatible with ${n} channel`)}else a||(l.warn(`Channel ${n} is new or it's your first upload with compatibility check, it will be ignored this time`),p=await qg(r.packageJson,r.nodeModules),s&&(u=i,l.info(`Auto set min-update-version to ${u}`)));d&&!u&&!a&&De("You need to provide a min-update-version to upload a bundle to this channel"),u&&(ia.test(u)||De(`Your minimal version update ${u}, is not valid it should follow semver convention : https://semver.org/`));let m=p?new Map(p.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,v])=>({name:D,version:v.version})):void 0,minUpdateVersion:u}}async function c7(t,e,r,n=!1,o=!1){let{data:i,error:a}=await t.rpc("exist_app_versions",{appid:e,name_version:r}).single();if(i||a){if(n)return l.warn(`Version ${r} already exists - exiting gracefully due to --silent-fail option`),K("Bundle version already exists - exiting gracefully \u{1F389}"),!0;if(o){l.error(`\u274C Version ${r} already exists`);let s=s1(r);l.info("\u{1F4A1} Here are some suggestions:"),s.forEach((f,d)=>{l.info(` ${d+1}. ${f}`)});let u=await gt({message:"What would you like to do?",options:[{value:"suggest1",label:`Use ${s[0]}`},{value:"suggest2",label:`Use ${s[1]}`},{value:"suggest3",label:`Use ${s[2]}`},{value:"suggest4",label:`Use ${s[3]}`},{value:"custom",label:"Enter a custom version"},{value:"cancel",label:"Cancel upload"}]});(le(u)||u==="cancel")&&De("Upload cancelled by user");let c;if(u==="custom"){let f=await a1(r,"upload");f||De("Upload cancelled by user"),c=f}else{let f=Number.parseInt(u.replace("suggest",""))-1;c=s[f]}return l.info(`\u{1F504} Retrying with new version: ${c}`),c}De(`Version ${r} already exists ${q(a)}`)}return!1}async function l7(t,e,r,n,o,i,a,s){let u,c,f="",d=null,p="none",h="",m="",y=e.keyV2,D=e.key===!1,v=be();v.start(`Zipping bundle from ${t}`),d=await Jl(t),v.message("Calculating checksum");let E=bt((0,Sf.cwd)()),g=await Kr("@capgo/capacitor-updater",E,e.packageJson),_=!1,S;try{S=g?ge(g):void 0}catch{S=void 0}if(g?S?_=!Vn(S,Ts):(g==="link:@capgo/capacitor-updater"||g==="file:.."||g==="file:../")&&(l.warn("Using local @capgo/capacitor-updater. Assuming latest version for checksum calculation."),_=!0):De("Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager"),(y||e.keyDataV2||(0,Ko.existsSync)(or))&&!D||_?f=await ln(d,"sha256"):f=await ln(d,"crc32"),v.stop(`Checksum ${_?"SHA256":"CRC32"}: ${f}`),D)l.info("Encryption ignored");else if((y||(0,Ko.existsSync)(or)||e.keyDataV2)&&!e.oldEncryption){let B=typeof y=="string"?y:or,T=e.keyDataV2||"";!T&&!(0,Ko.existsSync)(B)&&De(`Cannot find private key ${B}`),await me(r,{channel:"app",event:"App encryption v2",icon:"\u{1F511}",user_id:n,tags:{"app-id":o},notify:!1},e.verbose),T||(T=(0,Ko.readFileSync)(B).toString());let j=S&&!Vn(S,"5.30.0","6.30.0","7.30.0");l.info(`Encrypting your bundle with ${j?"V3":"V2"}`);let{sessionKey:A,ivSessionKey:M}=cf(T),L=ha(d,A,M);f=j?lf(f,T):ma(f,T),u=M,c=A,p="v2",h=T,s&&(m=zO(s),e.verbose&&l.info(`[Verbose] Encryption key_id: ${m}`)),e.displayIvSession&&l.info(`Your Iv Session key is ${u},
218
220
  keep it safe, you will need it to decrypt your bundle.
219
221
  It will be also visible in your dashboard
220
- `),d=L}let P=Math.floor((d?.byteLength??0)/1024/1024),F=Math.floor(i/1024/1024);return d?.byteLength>i?De(`The bundle size is ${P} Mb, this is greater than the maximum upload length ${F} Mb, please reduce the size of your bundle`):d?.byteLength>a?(l.warn(`WARNING !!
221
- The bundle size is ${P} Mb, this may take a while to download for users
222
+ `),d=L}let k=Math.floor((d?.byteLength??0)/1024/1024),F=Math.floor(i/1024/1024);return d?.byteLength>i?De(`The bundle size is ${k} Mb, this is greater than the maximum upload length ${F} Mb, please reduce the size of your bundle`):d?.byteLength>a?(l.warn(`WARNING !!
223
+ The bundle size is ${k} Mb, this may take a while to download for users
222
224
  `),l.info(`Learn how to optimize your assets https://capgo.app/blog/optimise-your-images-for-updates/
223
- `),e.verbose&&(l.info("[Verbose] Bundle size details:"),l.info(` - Actual size: ${P} MB (${d?.byteLength} bytes)`),l.info(` - Alert threshold: ${Math.floor(a/1024/1024)} MB`),l.info(` - Maximum allowed: ${F} MB`),l.info("[Verbose] Sending 'App Too Large' event to analytics...")),await me(r,{channel:"app-error",event:"App Too Large",icon:"\u{1F69B}",user_id:n,tags:{"app-id":o},notify:!1},e.verbose),e.verbose&&l.info("[Verbose] Event sent successfully")):e.verbose&&l.info(`[Verbose] Bundle size OK: ${P} MB (under ${Math.floor(a/1024/1024)} MB alert threshold)`),e.verbose&&l.info("[Verbose] Bundle preparation complete, returning bundle data"),{zipped:d,ivSessionKey:u,sessionKey:c,checksum:f,encryptionMethod:p,finalKeyData:h,keyId:m}}async function i7(t,e,r,n,o,i,a,s){let u=be();u.start("Uploading Bundle");let c=performance.now(),f=!1;if(a.verbose&&(l.info("[Verbose] uploadBundleToCapgoCloud called:"),l.info(` - Bundle size: ${Math.floor(i.byteLength/1024)} KB`),l.info(` - App ID: ${r}`),l.info(` - Bundle version: ${n}`),l.info(` - Chunk size: ${Math.floor(s/1024/1024)} MB`)),a.dryUpload){u.stop(`Dry run, bundle not uploaded
224
- Bundle uploaded \u{1F4AA} in 0 seconds`),a.verbose&&l.info("[Verbose] Dry upload mode - skipping actual upload");return}try{let h=await mr();if(a.verbose&&l.info("[Verbose] Local config retrieved for upload"),a.multipart!==void 0&&a.multipart||a.tus!==void 0&&a.tus){a.multipart?l.info("Uploading bundle with multipart is deprecated, we upload with TUS instead"):l.info("Uploading bundle with TUS protocol"),a.verbose&&(l.info("[Verbose] Starting TUS resumable upload..."),l.info(` - Host: ${h.hostWeb}`),l.info(` - Chunk size: ${Math.floor(s/1024/1024)} MB`)),await YA(t,i,o,r,n,u,h,s),f=!0,a.verbose&&l.info("[Verbose] TUS upload completed, updating database with R2 path...");let m=`orgs/${o}/apps/${r}/${n}.zip`,{error:y}=await e.from("app_versions").update({r2_path:m}).eq("name",n).eq("app_id",r);if(y)return l.error(`Cannot finish TUS upload ${q(y)}`),a.verbose&&l.info(`[Verbose] Database update failed: ${q(y)}`),Promise.reject(new Error("Cannot finish TUS upload"));a.verbose&&l.info(`[Verbose] Database updated with R2 path: ${m}`)}else{a.verbose&&l.info("[Verbose] Using standard upload (non-TUS), getting presigned URL...");let m=await VA(e,r,n);if(!m)return l.error("Cannot get upload url"),a.verbose&&l.info("[Verbose] Failed to retrieve presigned upload URL from database"),Promise.reject(new Error("Cannot get upload url"));a.verbose&&(l.info("[Verbose] Presigned URL obtained, uploading via HTTP PUT..."),l.info(` - Timeout: ${a.timeout||Pg}ms`),l.info(" - Retry attempts: 5"),l.info(" - Content-Type: application/zip"));let y=new AbortController,D=setTimeout(()=>y.abort(),a.timeout||Pg);try{let v=await fetch(m,{method:"PUT",body:i,headers:{"Content-Type":"application/zip"},signal:y.signal});if(!v.ok)throw new Error(`HTTP error! status: ${v.status}`)}finally{clearTimeout(D)}a.verbose&&l.info("[Verbose] HTTP PUT upload completed successfully")}}catch(h){let y=((performance.now()-c)/1e3).toFixed(2);if(u.stop(`Failed to upload bundle ( after ${y} seconds)`),a.verbose&&(l.info(`[Verbose] Upload failed after ${y} seconds`),l.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+)/),v=D?D[1]:"unknown";l.error(`Upload failed with status ${v}: ${h.message}`)}catch{l.error(`Upload failed: ${h.message}`)}else a.verbose&&l.info(`[Verbose] Non-HTTP error: ${q(h)}`),a.tus?l.error(`Cannot upload bundle please contact support if the issue persists ${q(h)}`):l.error(`Cannot upload bundle ( try again with --tus option) ${q(h)}`);throw a.verbose&&l.info("[Verbose] Cleaning up failed version from database..."),await JA(e,r,n),a.verbose&&l.info("[Verbose] Failed version cleaned up"),h instanceof Error?h:new Error(String(h))}let p=((performance.now()-c)/1e3).toFixed(2);u.stop(`Bundle uploaded \u{1F4AA} in (${p} seconds)`),a.verbose&&(l.info("[Verbose] Upload successful:"),l.info(` - Upload time: ${p} seconds`),l.info(` - Upload method: ${f?"TUS (resumable)":"Standard HTTP PUT"}`),l.info(` - Bundle size: ${Math.floor(i.byteLength/1024)} KB`),l.info("[Verbose] Sending performance event...")),await me(t,{channel:"performance",event:f?"TUS upload zip performance":"Upload zip performance",icon:"\u{1F684}",user_id:o,tags:{"app-id":r,time:p},notify:!1},a.verbose),a.verbose&&l.info("[Verbose] Performance event sent successfully")}async function a7(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){l.error(`Cannot delete linked bundle on upload ${q(o)}`);return}if(n.length===0){l.warn("No linked bundle found in the channel you are trying to upload to");return}let i=n[0].version;if(i.deleted){l.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){l.error(`Cannot delete linked bundle on upload ${q(a)}`);return}l.info("Linked bundle deleted")}async function s7(t,e,r,n,o,i,a,s,u,c){let{data:f}=await t.rpc("get_app_versions",{apikey:e,name_version:n,appid:s}).single();f||De("Cannot get version id, cannot set channel");let{data:d}=await t.rpc("is_allowed_capgkey",{apikey:e,keymode:["write","all"]}).single();if(d){let{error:p,data:h}=await Gl(t,{name:o,app_id:s,created_by:i,version:f,owner_org:a,...c?{allow_device_self_set:!0}:{}});p&&De(`Cannot set channel, the upload key is not allowed to do that, use the "all" for this. ${q(p)}`);let m=`${u.hostWeb}/app/${s}/channel/${h.id}`;h?.public?l.info("Your update is now available in your public channel \u{1F389}"):h?.id&&l.info(`Link device to this bundle to try it: ${m}`),r&&l.info(`Bundle url: ${m}`)}else l.warn("The upload key is not allowed to set the version in the channel")}async function u7(t,e,r){let{error:n,data:o}=await e.from("apps").select("default_upload_channel").eq("app_id",t).single();return n?(l.warn("Cannot find default upload channel"),l.info(`You can set it here: ${r}/app/${t}/info`),null):o.default_upload_channel}async function Ef(t,e,r=!1){r||ee(`Uploading with CLI version ${Cr.version}`);let n,o=rt();await Ee();let{s3Region:i,s3Apikey:a,s3Apisecret:s,s3BucketName:u,s3Endpoint:c,s3Port:f,s3SSL:d}=e;e.verbose&&(l.info("[Verbose] Starting upload process with options:"),l.info(` - API key: ${e.apikey?"provided":"from saved key"}`),l.info(` - Path: ${e.path||"from capacitor config"}`),l.info(` - Channel: ${e.channel||"from default upload channel"}`),l.info(` - Bundle: ${e.bundle||"auto-detected"}`),l.info(` - External: ${e.external||"false"}`),l.info(` - Encryption: ${e.keyV2||e.keyDataV2?"v2":e.key===!1?"disabled":"auto"}`),l.info(` - Upload method: ${e.tus?"TUS":e.zip?"ZIP":"auto"}`),l.info(` - Delta updates: ${e.delta||e.partial?"enabled":"disabled"}`));let p=Q9(e);e.verbose&&l.info("[Verbose] API key retrieved successfully");let h=await te();e.verbose&&l.info("[Verbose] Capacitor config loaded successfully");let m=await RA();e.verbose&&(l.info("[Verbose] Remote file config retrieved:"),l.info(` - Max upload length: ${Math.floor(m.maxUploadLength/1024/1024)} MB`),l.info(` - Alert upload size: ${Math.floor(m.alertUploadSize/1024/1024)} MB`),l.info(` - TUS upload: ${m.TUSUpload?"enabled":"disabled"}`),l.info(` - TUS upload forced: ${m.TUSUploadForced?"yes":"no"}`),l.info(` - Partial upload: ${m.partialUpload?"enabled":"disabled"}`),l.info(` - Max chunk size: ${Math.floor(m.maxChunkSize/1024/1024)} MB`));let{appid:y,path:D}=e7(t,e,h.config);e.verbose&&l.info(`[Verbose] App ID: ${y}, Build path: ${D}`);let v=await Z9(h.config,e);e.verbose&&l.info(`[Verbose] Bundle version: ${v}`);let E=e.external?"external":"r2-direct",g="none";e.autoSetBundle&&(await $s({version:v}),e.verbose&&l.info("[Verbose] Auto-set bundle version in capacitor.config.json")),t7(e,D),e.verbose&&l.info("[Verbose] Code check passed (notifyAppReady found and index.html present)"),l.info(`Upload ${y}@${v} started from path "${D}" to Capgo cloud`);let _=await mr();e.verbose&&l.info(`[Verbose] Local config loaded: host=${_.hostWeb}`),e.supaHost&&e.supaAnon&&(l.info("Using custom supabase instance from provided options"),_.supaHost=e.supaHost,_.supaKey=e.supaAnon,e.verbose&&l.info(`[Verbose] Custom Supabase host: ${e.supaHost}`));let S=await re(p,e.supaHost,e.supaAnon);e.verbose&&l.info("[Verbose] Supabase client created successfully");let P=await ae(S,p,["write","all","upload"]);e.verbose&&l.info(`[Verbose] User verified successfully, user_id: ${P}`);let F=e.channel||await u7(y,S,_.hostWeb)||"production";e.verbose&&l.info(`[Verbose] Target channel: ${F}`);let B=await Ct(S,y);e.verbose&&l.info(`[Verbose] Organization ID: ${B}`),await jA(S,B,Cr.version),e.verbose&&l.info("[Verbose] Remote CLI messages checked"),await MA(S,B,p,y,!0),e.verbose&&l.info("[Verbose] Plan validation passed"),e.verbose&&l.info("[Verbose] Trial check completed"),e.verbose&&l.info(`[Verbose] Checking compatibility with channel ${F}...`);let{nativePackages:T,minUpdateVersion:j}=await r7(S,o,e,F,y,v);e.verbose&&(l.info("[Verbose] Compatibility check completed:"),l.info(` - Native packages: ${T?T.length:0}`),l.info(` - Min update version: ${j||"none"}`)),e.verbose&&l.info(`[Verbose] Checking if version ${v} already exists...`);let A=!r,M=await n7(S,y,v,e.versionExistsOk,A);if(e.verbose&&l.info(`[Verbose] Version exists check: ${M?typeof M=="string"?`retry with ${M}`:"yes (skipping)":"no (continuing)"}`),M===!0)return{success:!0,skipped:!0,reason:"VERSION_EXISTS",bundle:v,checksum:null,encryptionMethod:g,storageProvider:E};if(typeof M=="string")return l.info(`Retrying upload with new version: ${M}`),Ef(t,{...e,bundle:M},r);e.external&&!e.external.startsWith("https://")&&De(`External link should should start with "https://" current is "${e.external}"`),e.deleteLinkedBundleOnUpload&&(l.warn("Deleting linked bundle on upload is destructive, it will delete the currently linked bundle in the channel you are trying to upload to."),l.warn("Please make sure you want to do this, if you are not sure, please do not use this option."));let L={name:v,app_id:y,session_key:void 0,external_url:e.external,storage_provider:E,min_update_version:j,native_packages:T,owner_org:B,user_id:P,checksum:void 0,link:e.link||null,comment:e.comment||null,key_id:void 0},X=null,k="";if(e.external)e.verbose&&l.info(`[Verbose] Using external URL: ${e.external}`),await me(p,{channel:"app",event:"App external",icon:"\u{1F4E4}",user_id:B,tags:{"app-id":y},notify:!1},e.verbose),L.session_key=e.ivSessionKey,L.checksum=e.encryptedChecksum,e.verbose&&(l.info("[Verbose] External bundle configured:"),l.info(` - URL: ${e.external}`),l.info(` - IV Session Key: ${e.ivSessionKey?"provided":"none"}`),l.info(` - Encrypted Checksum: ${e.encryptedChecksum?"provided":"none"}`));else{e.verbose&&l.info(`[Verbose] Preparing bundle file from path: ${D}`);let N=h.config?.plugins?.CapacitorUpdater?.publicKey,{zipped:Z,ivSessionKey:U,checksum:oe,sessionKey:Xt,encryptionMethod:z,finalKeyData:Se,keyId:V}=await o7(D,e,p,B,y,m.maxUploadLength,m.alertUploadSize,N);L.session_key=U,L.checksum=oe,L.key_id=V||void 0,n=Xt,X=Z,g=z,k=Se,e.verbose&&(l.info("[Verbose] Bundle prepared:"),l.info(` - Size: ${Math.floor((Z?.byteLength??0)/1024)} KB`),l.info(` - Checksum: ${oe}`),l.info(` - Encryption: ${z}`),l.info(` - IV Session Key: ${U?"present":"none"}`),l.info(` - Key ID: ${V||"none"}`)),e.ignoreChecksumCheck||(e.verbose&&l.info("[Verbose] Checking for duplicate checksum..."),await QA(S,y,F,oe),e.verbose&&l.info("[Verbose] Checksum is unique"))}e.zip?(e.tus=!1,e.verbose&&l.info("[Verbose] Upload method: ZIP (explicitly set via --zip)")):!m.TUSUpload||e.external?(e.tus=!1,e.verbose&&l.info("[Verbose] Upload method: Standard (TUS not available or external URL)")):(e.tus=e.tus||m.TUSUploadForced,e.verbose&&l.info(`[Verbose] Upload method: ${e.tus?"TUS (resumable)":"Standard"}`)),!m.partialUpload||e.external?(e.delta=!1,e.verbose&&e.external&&l.info("[Verbose] Delta updates disabled (not available with external URLs)")):(e.delta=e.delta||e.partial||e.deltaOnly||e.partialOnly||m.partialUploadForced,e.verbose&&l.info(`[Verbose] Delta updates: ${e.delta?"enabled":"disabled"}`)),e.encryptPartial&&g==="v1"&&De("You cannot encrypt the partial update if you are not using the v2 encryption method");let b="5.30.0",w="6.30.0",C="7.30.0",O=!1;if(e.delta&&g==="v2"&&!e.encryptPartial){let N=Dt((0,vf.cwd)()),Z=await Hr("@capgo/capacitor-updater",N,e.packageJson),U;try{U=Z?ge(Z):void 0}catch{U=void 0}Z&&U&&SD(U,ge("6.14.4"))&&(l.info(`Auto-enabling partial update encryption for updater version ${U} (> 6.14.4)`),e.verbose&&l.info("[Verbose] Partial encryption auto-enabled for updater >= 6.14.4"),e.encryptPartial=!0)}if(e.delta&&(e.encryptPartial||g==="v2")){let N=Dt((0,vf.cwd)()),Z=await Hr("@capgo/capacitor-updater",N,e.packageJson),U;try{U=Z?ge(Z):void 0}catch{U=void 0}Z&&U&&(O=!Mn(U,b,w,C),e.verbose&&O&&l.info(`[Verbose] Using hex checksum format for updater version ${U}`))}e.verbose&&e.delta&&l.info("[Verbose] Preparing delta/partial update manifest...");let R=e.delta?await DF(D,p,B,y,e.encryptPartial?g:"none",k,O):[];e.verbose&&e.delta&&l.info(`[Verbose] Delta manifest prepared with ${R.length} files`),e.verbose&&l.info("[Verbose] Creating version record in database...");let{error:$}=await Bg(S,L);if($&&De(`Cannot add bundle ${q($)}`),e.verbose&&l.info("[Verbose] Version record created successfully"),e.tusChunkSize&&e.tusChunkSize>m.maxChunkSize?(l.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&&l.info(`[Verbose] TUS chunk size: ${Math.floor(e.tusChunkSize/1024/1024)} MB`),X&&(u||c||i||a||s||f||d)){(!u||!c||!i||!a||!s||!f)&&De("Missing argument, for S3 upload you need to provide a bucket name, endpoint, region, port, API key, and API secret"),l.info("Uploading to S3"),e.verbose&&(l.info("[Verbose] S3 configuration:"),l.info(` - Endpoint: ${c}`),l.info(` - Region: ${i}`),l.info(` - Bucket: ${u}`),l.info(` - Port: ${f}`),l.info(` - SSL: ${d?"enabled":"disabled"}`));let N=d?`https://${c}`:`http://${c}`,Z=new qs({endPoint:c,region:i,port:f,pathStyle:!0,bucket:u,accessKey:a,secretKey:s}),U=`${y}-${v}`,oe=encodeURIComponent(U);e.verbose&&l.info(`[Verbose] Uploading to S3 as: ${U}`),await Z.putObject(U,Uint8Array.from(X)),L.external_url=`${N}/${oe}`,L.storage_provider="external",e.verbose&&l.info(`[Verbose] S3 upload complete, external URL: ${L.external_url}`)}else if(X){!e.partialOnly&&!e.deltaOnly?(e.verbose&&l.info("[Verbose] Starting full bundle upload to Capgo Cloud..."),await i7(p,S,y,v,B,X,e,e.tusChunkSize)):e.verbose&&l.info("[Verbose] Skipping full bundle upload (delta-only mode)");let N=null;try{e.dryUpload&&(e.delta=!1,e.verbose&&l.info("[Verbose] Dry upload mode: skipping delta upload"));let U=L.session_key&&e.encryptPartial&&n?{sessionKey:n,ivSessionKey:L.session_key}:void 0;e.verbose&&e.delta&&(l.info("[Verbose] Starting delta/partial file upload..."),l.info(` - Manifest entries: ${R.length}`),l.info(` - Encryption: ${U?"enabled":"disabled"}`)),N=e.delta?await bF(p,R,D,y,B,U,e):null,e.verbose&&N&&l.info(`[Verbose] Delta upload complete with ${N.length} files`)}catch(U){if(!!(e.partial||e.delta||e.partialOnly||e.deltaOnly))throw U;l.info(`Failed to upload partial files to capgo cloud. Error: ${q(U)}. This is not a critical error, the bundle has been uploaded without the partial files`),e.verbose&&l.info(`[Verbose] Delta upload error details: ${q(U)}`)}L.storage_provider="r2",L.manifest=N,e.verbose&&l.info("[Verbose] Updating version record with storage provider and manifest...");let{error:Z}=await Bg(S,L);Z&&De(`Cannot update bundle ${q(Z)}`),e.verbose&&l.info("[Verbose] Version record updated successfully")}e.verbose&&l.info("[Verbose] Checking app permissions...");let H=await Me(S,p,y,2);e.verbose&&(l.info("[Verbose] Permissions:"),l.info(` - Upload: ${aa(H,2)?"yes":"no"}`),l.info(` - Write: ${aa(H,3)?"yes":"no"}`),l.info(` - Admin: ${aa(H,4)?"yes":"no"}`)),e.deleteLinkedBundleOnUpload&&aa(H,3)?(e.verbose&&l.info(`[Verbose] Deleting linked bundle in channel ${F}...`),await a7(S,y,F)):e.deleteLinkedBundleOnUpload&&l.warn("Cannot delete linked bundle on upload as a upload organization member"),aa(H,3)?(e.verbose&&l.info(`[Verbose] Setting bundle ${v} to channel ${F}...`),await s7(S,p,!!e.bundleUrl,v,F,P,B,y,_,e.selfAssign),e.verbose&&l.info("[Verbose] Channel updated successfully")):l.warn("Cannot set channel as a upload organization member"),e.verbose&&l.info("[Verbose] Sending upload event..."),await me(p,{channel:"app",event:"App Uploaded",icon:"\u23EB",user_id:B,tags:{"app-id":y},notify:!1},e.verbose);let I={success:!0,bundle:v,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&&(l.info("[Verbose] Upload completed successfully:"),l.info(` - Bundle: ${I.bundle}`),l.info(` - Checksum: ${I.checksum}`),l.info(` - Encryption: ${I.encryptionMethod}`),l.info(` - Storage: ${I.storageProvider}`)),r&&!I.skipped&&K("Time to share your update to the world \u{1F30D}"),I}function c7(t){t.ivSessionKey&&!t.external&&De("You need to provide an external url if you want to use the --iv-session-key option"),t.encryptedChecksum&&!t.external&&De("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&&De("You cannot use the --partial/--delta/--partial-only/--delta-only option with an external url"),t.tus&&t.external&&De("You cannot use the --tus option with an external url"),t.dryUpload&&t.external&&De("You cannot use the --dry-upload option with an external url"),t.multipart&&t.external&&De("You cannot use the --multipart option with an external url"),t.external&&(t.keyV2||t.keyDataV2)&&De("You cannot set a key if you are uploading to an external url"),t.keyV2&&t.keyDataV2&&De("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)&&De("You cannot set S3 options if you are uploading to an external url, it's automatically handled"),t.encryptedChecksum&&!t.external&&De("You cannot set the --encrypted-checksum option if you are not uploading to an external url"),t.minUpdateVersion&&t.autoMinUpdateVersion&&De("You cannot set both min-update-version and auto-min-update-version, use only one of them")}async function Cf(t,e){try{c7(e),await Ef(t,e)}catch(r){let n=r instanceof Error?r.message:String(r),o=q(r);e.verbose?l.error(`uploadBundle failed:${o}`):l.error(`uploadBundle failed: ${n}`);let i=n.includes("Cannot upload the same bundle content");if(!e.versionExistsOk)try{if(i){let a=await mt({message:"Would you like to retry the upload?",options:[{value:"ignore",label:"Retry with --ignore-checksum-check (force upload same content)"},{value:"cancel",label:"Cancel upload"}]});if(le(a)||a==="cancel")throw r instanceof Error?r:new Error(String(r));if(a==="ignore")return l.info("\u{1F504} Retrying upload with --ignore-checksum-check..."),Cf(t,{...e,ignoreChecksumCheck:!0})}else{let a=await ue({message:"Would you like to retry the upload?"});if(le(a))throw r instanceof Error?r:new Error(String(r));if(a)return l.info("\u{1F504} Retrying upload..."),Cf(t,e)}}catch{throw r instanceof Error?r:new Error(String(r))}throw r instanceof Error?r:new Error(String(r))}}var vF=require("node:crypto"),_f=require("node:fs"),CF=require("node:process");var l7=20;function f7(t){console.log(JSON.stringify(t,null,2))}function Ws(t){console.error(q(t))}async function d7(t,e,r=!1){let{json:n}=e,{bundle:o,path:i}=e,a=!n&&!r;try{a&&await Ee();let s=await te(),u=pe(t,s?.config),c=(0,vF.randomUUID)().split("-")[0],f=Fr("",e.packageJson);if(o=o||f||`0.0.1-beta.${c}`,a&&ee(`Zipping ${u}@${o}`),o&&!ia.test(o)){let P=`Your bundle name ${o}, is not valid it should follow semver convention : https://semver.org/`;throw r||(n?Ws({error:"invalid_semver"}):l.error(P)),new Error("Invalid bundle version format")}if(i=i||s?.config?.webDir,!u||!o||!i){let P="Missing argument, you need to provide a appId and a bundle and a path, or be in a capacitor project";throw r||(n?Ws({error:"missing_argument"}):l.error(P)),new Error(P)}if(a&&l.info(`Started from path "${i}"`),typeof e.codeCheck>"u"?!0:e.codeCheck){if(!Hs(i,"notifyAppReady"))throw r||(n?Ws({error:"notifyAppReady_not_in_source_code"}):l.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(!df(i))throw r||(n?Ws({error:"index_html_not_found"}):l.error(`index.html is missing in the root folder of ${i}`)),new Error("index.html is missing in root folder")}let p=await Kl(i);a&&l.info(`Zipped ${p.byteLength} bytes`);let h=a?be():null;h&&h.start("Calculating checksum");let m=Dt((0,CF.cwd)()),y=await Hr("@capgo/capacitor-updater",m,e.packageJson);if(!y){let P="Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager";throw r||l.warn(P),new Error(P)}let D=!1,v;try{v=y?ge(y):void 0}catch{v=void 0}v?D=!Mn(v,void 0,void 0,"7.0.0"):y==="link:@capgo/capacitor-updater"&&(r||l.warn("Using local @capgo/capacitor-updater. Assuming v7"),D=!0);let E=await an(p,e.keyV2||(0,_f.existsSync)(nr)||D?"sha256":"crc32");h&&h.stop(`Checksum ${D?"SHA256":"CRC32"}: ${E}`);let g=Math.floor(p.byteLength/1024/1024);g>l7&&a&&(l.warn(`WARNING !!
225
+ `),e.verbose&&(l.info("[Verbose] Bundle size details:"),l.info(` - Actual size: ${k} MB (${d?.byteLength} bytes)`),l.info(` - Alert threshold: ${Math.floor(a/1024/1024)} MB`),l.info(` - Maximum allowed: ${F} MB`),l.info("[Verbose] Sending 'App Too Large' event to analytics...")),await me(r,{channel:"app-error",event:"App Too Large",icon:"\u{1F69B}",user_id:n,tags:{"app-id":o},notify:!1},e.verbose),e.verbose&&l.info("[Verbose] Event sent successfully")):e.verbose&&l.info(`[Verbose] Bundle size OK: ${k} MB (under ${Math.floor(a/1024/1024)} MB alert threshold)`),e.verbose&&l.info("[Verbose] Bundle preparation complete, returning bundle data"),{zipped:d,ivSessionKey:u,sessionKey:c,checksum:f,encryptionMethod:p,finalKeyData:h,keyId:m}}async function f7(t,e,r,n,o,i,a,s){let u=be();u.start("Uploading Bundle");let c=performance.now(),f=!1;if(a.verbose&&(l.info("[Verbose] uploadBundleToCapgoCloud called:"),l.info(` - Bundle size: ${Math.floor(i.byteLength/1024)} KB`),l.info(` - App ID: ${r}`),l.info(` - Bundle version: ${n}`),l.info(` - Chunk size: ${Math.floor(s/1024/1024)} MB`)),a.dryUpload){u.stop(`Dry run, bundle not uploaded
226
+ Bundle uploaded \u{1F4AA} in 0 seconds`),a.verbose&&l.info("[Verbose] Dry upload mode - skipping actual upload");return}try{let h=await yr();if(a.verbose&&l.info("[Verbose] Local config retrieved for upload"),a.multipart!==void 0&&a.multipart||a.tus!==void 0&&a.tus){a.multipart?l.info("Uploading bundle with multipart is deprecated, we upload with TUS instead"):l.info("Uploading bundle with TUS protocol"),a.verbose&&(l.info("[Verbose] Starting TUS resumable upload..."),l.info(` - Host: ${h.hostWeb}`),l.info(` - Chunk size: ${Math.floor(s/1024/1024)} MB`)),await eO(t,i,o,r,n,u,h,s),f=!0,a.verbose&&l.info("[Verbose] TUS upload completed, updating database with R2 path...");let m=`orgs/${o}/apps/${r}/${n}.zip`,{error:y}=await e.from("app_versions").update({r2_path:m}).eq("name",n).eq("app_id",r);if(y)return l.error(`Cannot finish TUS upload ${q(y)}`),a.verbose&&l.info(`[Verbose] Database update failed: ${q(y)}`),Promise.reject(new Error("Cannot finish TUS upload"));a.verbose&&l.info(`[Verbose] Database updated with R2 path: ${m}`)}else{a.verbose&&l.info("[Verbose] Using standard upload (non-TUS), getting presigned URL...");let m=await YA(e,r,n);if(!m)return l.error("Cannot get upload url"),a.verbose&&l.info("[Verbose] Failed to retrieve presigned upload URL from database"),Promise.reject(new Error("Cannot get upload url"));a.verbose&&(l.info("[Verbose] Presigned URL obtained, uploading via HTTP PUT..."),l.info(` - Timeout: ${a.timeout||Bg}ms`),l.info(" - Retry attempts: 5"),l.info(" - Content-Type: application/zip"));let y=new AbortController,D=setTimeout(()=>y.abort(),a.timeout||Bg);try{let v=await fetch(m,{method:"PUT",body:i,headers:{"Content-Type":"application/zip"},signal:y.signal});if(!v.ok)throw new Error(`HTTP error! status: ${v.status}`)}finally{clearTimeout(D)}a.verbose&&l.info("[Verbose] HTTP PUT upload completed successfully")}}catch(h){let y=((performance.now()-c)/1e3).toFixed(2);if(u.stop(`Failed to upload bundle ( after ${y} seconds)`),a.verbose&&(l.info(`[Verbose] Upload failed after ${y} seconds`),l.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+)/),v=D?D[1]:"unknown";l.error(`Upload failed with status ${v}: ${h.message}`)}catch{l.error(`Upload failed: ${h.message}`)}else a.verbose&&l.info(`[Verbose] Non-HTTP error: ${q(h)}`),a.tus?l.error(`Cannot upload bundle please contact support if the issue persists ${q(h)}`):l.error(`Cannot upload bundle ( try again with --tus option) ${q(h)}`);throw a.verbose&&l.info("[Verbose] Cleaning up failed version from database..."),await tO(e,r,n),a.verbose&&l.info("[Verbose] Failed version cleaned up"),h instanceof Error?h:new Error(String(h))}let p=((performance.now()-c)/1e3).toFixed(2);u.stop(`Bundle uploaded \u{1F4AA} in (${p} seconds)`),a.verbose&&(l.info("[Verbose] Upload successful:"),l.info(` - Upload time: ${p} seconds`),l.info(` - Upload method: ${f?"TUS (resumable)":"Standard HTTP PUT"}`),l.info(` - Bundle size: ${Math.floor(i.byteLength/1024)} KB`),l.info("[Verbose] Sending performance event...")),await me(t,{channel:"performance",event:f?"TUS upload zip performance":"Upload zip performance",icon:"\u{1F684}",user_id:o,tags:{"app-id":r,time:p},notify:!1},a.verbose),a.verbose&&l.info("[Verbose] Performance event sent successfully")}async function d7(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){l.error(`Cannot delete linked bundle on upload ${q(o)}`);return}if(n.length===0){l.warn("No linked bundle found in the channel you are trying to upload to");return}let i=n[0].version;if(i.deleted){l.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){l.error(`Cannot delete linked bundle on upload ${q(a)}`);return}l.info("Linked bundle deleted")}async function p7(t,e,r,n,o,i,a,s,u,c){let{data:f}=await t.rpc("get_app_versions",{apikey:e,name_version:n,appid:s}).single();f||De("Cannot get version id, cannot set channel");let{data:d}=await t.rpc("is_allowed_capgkey",{apikey:e,keymode:["write","all"]}).single();if(d){let{error:p,data:h}=await Xl(t,{name:o,app_id:s,created_by:i,version:f,owner_org:a,...c?{allow_device_self_set:!0}:{}});p&&De(`Cannot set channel, the upload key is not allowed to do that, use the "all" for this. ${q(p)}`);let m=`${u.hostWeb}/app/${s}/channel/${h.id}`;h?.public?l.info("Your update is now available in your public channel \u{1F389}"):h?.id&&l.info(`Link device to this bundle to try it: ${m}`),r&&l.info(`Bundle url: ${m}`)}else l.warn("The upload key is not allowed to set the version in the channel")}async function h7(t,e,r){let{error:n,data:o}=await e.from("apps").select("default_upload_channel").eq("app_id",t).single();return n?(l.warn("Cannot find default upload channel"),l.info(`You can set it here: ${r}/app/${t}/info`),null):o.default_upload_channel}async function Af(t,e,r=!1){r||ee(`Uploading with CLI version ${xr.version}`);let n,o=nt();await Ee();let{s3Region:i,s3Apikey:a,s3Apisecret:s,s3BucketName:u,s3Endpoint:c,s3Port:f,s3SSL:d}=e;e.verbose&&(l.info("[Verbose] Starting upload process with options:"),l.info(` - API key: ${e.apikey?"provided":"from saved key"}`),l.info(` - Path: ${e.path||"from capacitor config"}`),l.info(` - Channel: ${e.channel||"from default upload channel"}`),l.info(` - Bundle: ${e.bundle||"auto-detected"}`),l.info(` - External: ${e.external||"false"}`),l.info(` - Encryption: ${e.keyV2||e.keyDataV2?"v2":e.key===!1?"disabled":"auto"}`),l.info(` - Upload method: ${e.tus?"TUS":e.zip?"ZIP":"auto"}`),l.info(` - Delta updates: ${e.delta||e.partial?"enabled":"disabled"}`));let p=i7(e);e.verbose&&l.info("[Verbose] API key retrieved successfully");let h=await te();e.verbose&&l.info("[Verbose] Capacitor config loaded successfully");let m=await UA();e.verbose&&(l.info("[Verbose] Remote file config retrieved:"),l.info(` - Max upload length: ${Math.floor(m.maxUploadLength/1024/1024)} MB`),l.info(` - Alert upload size: ${Math.floor(m.alertUploadSize/1024/1024)} MB`),l.info(` - TUS upload: ${m.TUSUpload?"enabled":"disabled"}`),l.info(` - TUS upload forced: ${m.TUSUploadForced?"yes":"no"}`),l.info(` - Partial upload: ${m.partialUpload?"enabled":"disabled"}`),l.info(` - Max chunk size: ${Math.floor(m.maxChunkSize/1024/1024)} MB`));let{appid:y,path:D}=a7(t,e,h.config);e.verbose&&l.info(`[Verbose] App ID: ${y}, Build path: ${D}`);let v=await o7(h.config,e);e.verbose&&l.info(`[Verbose] Bundle version: ${v}`);let E=e.external?"external":"r2-direct",g="none";e.autoSetBundle&&(await Is({version:v}),e.verbose&&l.info("[Verbose] Auto-set bundle version in capacitor.config.json")),s7(e,D),e.verbose&&l.info("[Verbose] Code check passed (notifyAppReady found and index.html present)"),l.info(`Upload ${y}@${v} started from path "${D}" to Capgo cloud`);let _=await yr();e.verbose&&l.info(`[Verbose] Local config loaded: host=${_.hostWeb}`),e.supaHost&&e.supaAnon&&(l.info("Using custom supabase instance from provided options"),_.supaHost=e.supaHost,_.supaKey=e.supaAnon,e.verbose&&l.info(`[Verbose] Custom Supabase host: ${e.supaHost}`));let S=await re(p,e.supaHost,e.supaAnon);e.verbose&&l.info("[Verbose] Supabase client created successfully");let k=await ae(S,p,["write","all","upload"]);e.verbose&&l.info(`[Verbose] User verified successfully, user_id: ${k}`);let F=e.channel||await h7(y,S,_.hostWeb)||"production";e.verbose&&l.info(`[Verbose] Target channel: ${F}`);let B=await Et(S,y);e.verbose&&l.info(`[Verbose] Organization ID: ${B}`),await VA(S,B,xr.version),e.verbose&&l.info("[Verbose] Remote CLI messages checked"),await KA(S,B,p,y,!0),e.verbose&&l.info("[Verbose] Plan validation passed"),e.verbose&&l.info("[Verbose] Trial check completed"),e.verbose&&l.info(`[Verbose] Checking compatibility with channel ${F}...`);let{nativePackages:T,minUpdateVersion:j}=await u7(S,o,e,F,y,v);e.verbose&&(l.info("[Verbose] Compatibility check completed:"),l.info(` - Native packages: ${T?T.length:0}`),l.info(` - Min update version: ${j||"none"}`)),e.verbose&&l.info(`[Verbose] Checking if version ${v} already exists...`);let A=!r,M=await c7(S,y,v,e.versionExistsOk,A);if(e.verbose&&l.info(`[Verbose] Version exists check: ${M?typeof M=="string"?`retry with ${M}`:"yes (skipping)":"no (continuing)"}`),M===!0)return{success:!0,skipped:!0,reason:"VERSION_EXISTS",bundle:v,checksum:null,encryptionMethod:g,storageProvider:E};if(typeof M=="string")return l.info(`Retrying upload with new version: ${M}`),Af(t,{...e,bundle:M},r);e.external&&!e.external.startsWith("https://")&&De(`External link should should start with "https://" current is "${e.external}"`),e.deleteLinkedBundleOnUpload&&(l.warn("Deleting linked bundle on upload is destructive, it will delete the currently linked bundle in the channel you are trying to upload to."),l.warn("Please make sure you want to do this, if you are not sure, please do not use this option."));let L={name:v,app_id:y,session_key:void 0,external_url:e.external,storage_provider:E,min_update_version:j,native_packages:T,owner_org:B,user_id:k,checksum:void 0,link:e.link||null,comment:e.comment||null,key_id:void 0},X=null,P="";if(e.external)e.verbose&&l.info(`[Verbose] Using external URL: ${e.external}`),await me(p,{channel:"app",event:"App external",icon:"\u{1F4E4}",user_id:B,tags:{"app-id":y},notify:!1},e.verbose),L.session_key=e.ivSessionKey,L.checksum=e.encryptedChecksum,e.verbose&&(l.info("[Verbose] External bundle configured:"),l.info(` - URL: ${e.external}`),l.info(` - IV Session Key: ${e.ivSessionKey?"provided":"none"}`),l.info(` - Encrypted Checksum: ${e.encryptedChecksum?"provided":"none"}`));else{e.verbose&&l.info(`[Verbose] Preparing bundle file from path: ${D}`);let N=h.config?.plugins?.CapacitorUpdater?.publicKey,{zipped:Z,ivSessionKey:U,checksum:oe,sessionKey:Zt,encryptionMethod:z,finalKeyData:Se,keyId:V}=await l7(D,e,p,B,y,m.maxUploadLength,m.alertUploadSize,N);L.session_key=U,L.checksum=oe,L.key_id=V||void 0,n=Zt,X=Z,g=z,P=Se,e.verbose&&(l.info("[Verbose] Bundle prepared:"),l.info(` - Size: ${Math.floor((Z?.byteLength??0)/1024)} KB`),l.info(` - Checksum: ${oe}`),l.info(` - Encryption: ${z}`),l.info(` - IV Session Key: ${U?"present":"none"}`),l.info(` - Key ID: ${V||"none"}`)),e.ignoreChecksumCheck||(e.verbose&&l.info("[Verbose] Checking for duplicate checksum..."),await oO(S,y,F,oe),e.verbose&&l.info("[Verbose] Checksum is unique"))}e.zip?(e.tus=!1,e.verbose&&l.info("[Verbose] Upload method: ZIP (explicitly set via --zip)")):!m.TUSUpload||e.external?(e.tus=!1,e.verbose&&l.info("[Verbose] Upload method: Standard (TUS not available or external URL)")):(e.tus=e.tus||m.TUSUploadForced,e.verbose&&l.info(`[Verbose] Upload method: ${e.tus?"TUS (resumable)":"Standard"}`)),!m.partialUpload||e.external?(e.delta=!1,e.verbose&&e.external&&l.info("[Verbose] Delta updates disabled (not available with external URLs)")):(e.delta=e.delta||e.partial||e.deltaOnly||e.partialOnly||m.partialUploadForced,e.verbose&&l.info(`[Verbose] Delta updates: ${e.delta?"enabled":"disabled"}`)),e.encryptPartial&&g==="v1"&&De("You cannot encrypt the partial update if you are not using the v2 encryption method");let b="5.30.0",w="6.30.0",C="7.30.0",O=!1;if(e.delta&&g==="v2"&&!e.encryptPartial){let N=bt((0,Sf.cwd)()),Z=await Kr("@capgo/capacitor-updater",N,e.packageJson),U;try{U=Z?ge(Z):void 0}catch{U=void 0}Z&&U&&PD(U,ge("6.14.4"))&&(l.info(`Auto-enabling partial update encryption for updater version ${U} (> 6.14.4)`),e.verbose&&l.info("[Verbose] Partial encryption auto-enabled for updater >= 6.14.4"),e.encryptPartial=!0)}if(e.delta&&(e.encryptPartial||g==="v2")){let N=bt((0,Sf.cwd)()),Z=await Kr("@capgo/capacitor-updater",N,e.packageJson),U;try{U=Z?ge(Z):void 0}catch{U=void 0}Z&&U&&(O=!Vn(U,b,w,C),e.verbose&&O&&l.info(`[Verbose] Using hex checksum format for updater version ${U}`))}e.verbose&&e.delta&&l.info("[Verbose] Preparing delta/partial update manifest...");let R=e.delta?await EF(D,p,B,y,e.encryptPartial?g:"none",P,O):[];e.verbose&&e.delta&&l.info(`[Verbose] Delta manifest prepared with ${R.length} files`),e.verbose&&l.info("[Verbose] Creating version record in database...");let{error:$}=await Mg(S,L);if($&&De(`Cannot add bundle ${q($)}`),e.verbose&&l.info("[Verbose] Version record created successfully"),e.tusChunkSize&&e.tusChunkSize>m.maxChunkSize?(l.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&&l.info(`[Verbose] TUS chunk size: ${Math.floor(e.tusChunkSize/1024/1024)} MB`),X&&(u||c||i||a||s||f||d)){(!u||!c||!i||!a||!s||!f)&&De("Missing argument, for S3 upload you need to provide a bucket name, endpoint, region, port, API key, and API secret"),l.info("Uploading to S3"),e.verbose&&(l.info("[Verbose] S3 configuration:"),l.info(` - Endpoint: ${c}`),l.info(` - Region: ${i}`),l.info(` - Bucket: ${u}`),l.info(` - Port: ${f}`),l.info(` - SSL: ${d?"enabled":"disabled"}`));let N=d?`https://${c}`:`http://${c}`,Z=new Ks({endPoint:c,region:i,port:f,pathStyle:!0,bucket:u,accessKey:a,secretKey:s}),U=`${y}-${v}`,oe=encodeURIComponent(U);e.verbose&&l.info(`[Verbose] Uploading to S3 as: ${U}`),await Z.putObject(U,Uint8Array.from(X)),L.external_url=`${N}/${oe}`,L.storage_provider="external",e.verbose&&l.info(`[Verbose] S3 upload complete, external URL: ${L.external_url}`)}else if(X){!e.partialOnly&&!e.deltaOnly?(e.verbose&&l.info("[Verbose] Starting full bundle upload to Capgo Cloud..."),await f7(p,S,y,v,B,X,e,e.tusChunkSize)):e.verbose&&l.info("[Verbose] Skipping full bundle upload (delta-only mode)");let N=null;try{e.dryUpload&&(e.delta=!1,e.verbose&&l.info("[Verbose] Dry upload mode: skipping delta upload"));let U=L.session_key&&e.encryptPartial&&n?{sessionKey:n,ivSessionKey:L.session_key}:void 0;e.verbose&&e.delta&&(l.info("[Verbose] Starting delta/partial file upload..."),l.info(` - Manifest entries: ${R.length}`),l.info(` - Encryption: ${U?"enabled":"disabled"}`)),N=e.delta?await _F(p,R,D,y,B,U,e):null,e.verbose&&N&&l.info(`[Verbose] Delta upload complete with ${N.length} files`)}catch(U){if(!!(e.partial||e.delta||e.partialOnly||e.deltaOnly))throw U;l.info(`Failed to upload partial files to capgo cloud. Error: ${q(U)}. This is not a critical error, the bundle has been uploaded without the partial files`),e.verbose&&l.info(`[Verbose] Delta upload error details: ${q(U)}`)}L.storage_provider="r2",L.manifest=N,e.verbose&&l.info("[Verbose] Updating version record with storage provider and manifest...");let{error:Z}=await Mg(S,L);Z&&De(`Cannot update bundle ${q(Z)}`),e.verbose&&l.info("[Verbose] Version record updated successfully")}e.verbose&&l.info("[Verbose] Checking app permissions...");let H=await Me(S,p,y,2);e.verbose&&(l.info("[Verbose] Permissions:"),l.info(` - Upload: ${aa(H,2)?"yes":"no"}`),l.info(` - Write: ${aa(H,3)?"yes":"no"}`),l.info(` - Admin: ${aa(H,4)?"yes":"no"}`)),e.deleteLinkedBundleOnUpload&&aa(H,3)?(e.verbose&&l.info(`[Verbose] Deleting linked bundle in channel ${F}...`),await d7(S,y,F)):e.deleteLinkedBundleOnUpload&&l.warn("Cannot delete linked bundle on upload as a upload organization member"),aa(H,3)?(e.verbose&&l.info(`[Verbose] Setting bundle ${v} to channel ${F}...`),await p7(S,p,!!e.bundleUrl,v,F,k,B,y,_,e.selfAssign),e.verbose&&l.info("[Verbose] Channel updated successfully")):l.warn("Cannot set channel as a upload organization member"),e.verbose&&l.info("[Verbose] Sending upload event..."),await me(p,{channel:"app",event:"App Uploaded",icon:"\u23EB",user_id:B,tags:{"app-id":y},notify:!1},e.verbose);let I={success:!0,bundle:v,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&&(l.info("[Verbose] Upload completed successfully:"),l.info(` - Bundle: ${I.bundle}`),l.info(` - Checksum: ${I.checksum}`),l.info(` - Encryption: ${I.encryptionMethod}`),l.info(` - Storage: ${I.storageProvider}`)),r&&!I.skipped&&K("Time to share your update to the world \u{1F30D}"),I}function m7(t){t.ivSessionKey&&!t.external&&De("You need to provide an external url if you want to use the --iv-session-key option"),t.encryptedChecksum&&!t.external&&De("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&&De("You cannot use the --partial/--delta/--partial-only/--delta-only option with an external url"),t.tus&&t.external&&De("You cannot use the --tus option with an external url"),t.dryUpload&&t.external&&De("You cannot use the --dry-upload option with an external url"),t.multipart&&t.external&&De("You cannot use the --multipart option with an external url"),t.external&&(t.keyV2||t.keyDataV2)&&De("You cannot set a key if you are uploading to an external url"),t.keyV2&&t.keyDataV2&&De("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)&&De("You cannot set S3 options if you are uploading to an external url, it's automatically handled"),t.encryptedChecksum&&!t.external&&De("You cannot set the --encrypted-checksum option if you are not uploading to an external url"),t.minUpdateVersion&&t.autoMinUpdateVersion&&De("You cannot set both min-update-version and auto-min-update-version, use only one of them")}async function xf(t,e){try{m7(e),await Af(t,e)}catch(r){let n=r instanceof Error?r.message:String(r),o=q(r);e.verbose?l.error(`uploadBundle failed:${o}`):l.error(`uploadBundle failed: ${n}`);let i=n.includes("Cannot upload the same bundle content");if(!e.versionExistsOk)try{if(i){let a=await gt({message:"Would you like to retry the upload?",options:[{value:"ignore",label:"Retry with --ignore-checksum-check (force upload same content)"},{value:"cancel",label:"Cancel upload"}]});if(le(a)||a==="cancel")throw r instanceof Error?r:new Error(String(r));if(a==="ignore")return l.info("\u{1F504} Retrying upload with --ignore-checksum-check..."),xf(t,{...e,ignoreChecksumCheck:!0})}else{let a=await ue({message:"Would you like to retry the upload?"});if(le(a))throw r instanceof Error?r:new Error(String(r));if(a)return l.info("\u{1F504} Retrying upload..."),xf(t,e)}}catch{throw r instanceof Error?r:new Error(String(r))}throw r instanceof Error?r:new Error(String(r))}}var xF=require("node:crypto"),Of=require("node:fs"),AF=require("node:process");var g7=20;function y7(t){console.log(JSON.stringify(t,null,2))}function Zs(t){console.error(q(t))}async function D7(t,e,r=!1){let{json:n}=e,{bundle:o,path:i}=e,a=!n&&!r;try{a&&await Ee();let s=await te(),u=fe(t,s?.config),c=(0,xF.randomUUID)().split("-")[0],f=Ir("",e.packageJson);if(o=o||f||`0.0.1-beta.${c}`,a&&ee(`Zipping ${u}@${o}`),o&&!ia.test(o)){let k=`Your bundle name ${o}, is not valid it should follow semver convention : https://semver.org/`;throw r||(n?Zs({error:"invalid_semver"}):l.error(k)),new Error("Invalid bundle version format")}if(i=i||s?.config?.webDir,!u||!o||!i){let k="Missing argument, you need to provide a appId and a bundle and a path, or be in a capacitor project";throw r||(n?Zs({error:"missing_argument"}):l.error(k)),new Error(k)}if(a&&l.info(`Started from path "${i}"`),typeof e.codeCheck>"u"?!0:e.codeCheck){if(!Gs(i,"notifyAppReady"))throw r||(n?Zs({error:"notifyAppReady_not_in_source_code"}):l.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(!gf(i))throw r||(n?Zs({error:"index_html_not_found"}):l.error(`index.html is missing in the root folder of ${i}`)),new Error("index.html is missing in root folder")}let p=await Jl(i);a&&l.info(`Zipped ${p.byteLength} bytes`);let h=a?be():null;h&&h.start("Calculating checksum");let m=bt((0,AF.cwd)()),y=await Kr("@capgo/capacitor-updater",m,e.packageJson);if(!y){let k="Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager";throw r||l.warn(k),new Error(k)}let D=!1,v;try{v=y?ge(y):void 0}catch{v=void 0}v?D=!Vn(v,void 0,void 0,"7.0.0"):y==="link:@capgo/capacitor-updater"&&(r||l.warn("Using local @capgo/capacitor-updater. Assuming v7"),D=!0);let E=await ln(p,e.keyV2||(0,Of.existsSync)(or)||D?"sha256":"crc32");h&&h.stop(`Checksum ${D?"SHA256":"CRC32"}: ${E}`);let g=Math.floor(p.byteLength/1024/1024);g>g7&&a&&(l.warn(`WARNING !!
225
227
  The bundle size is ${g} Mb, this may take a while to download for users
226
228
  `),l.warn(`Learn how to optimize your assets https://capgo.app/blog/optimise-your-images-for-updates/
227
- `));let _=a?be():null,S=e.name||`${u}_${o}.zip`;return _&&_.start(`Saving to ${S}`),(0,_f.writeFileSync)(S,p),_&&_.stop(`Saved to ${S}`),a&&K("Done \u2705"),!r&&n&&f7({bundle:o,filename:S,checksum:E}),{bundle:o,filename:S,checksum:E}}catch(s){throw r||(n?Ws(s):l.error(q(s))),s instanceof Error?s:new Error(String(s))}}async function EF(t,e){await d7(t,e,!1)}async function hy(t,e,r,n=!1){n||ee("Create channel"),r.apikey=r.apikey||ne();let o=await te().catch(()=>{});if(e=pe(e,o?.config),!r.apikey)throw n||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||l.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 ae(i,r.apikey,["write","all"]),await Me(i,r.apikey,e,4,n),n||l.info(`Creating channel ${e}#${t} to Capgo`);let a=await qg(i,e);if(!a)throw n||l.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 Ct(i,e),u=await ae(i,r.apikey,["write","all"]),c=await S1(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||l.error(`Cannot create Channel \u{1F640}
228
- ${q(c.error)}`),new Error(`Cannot create channel: ${q(c.error)}`);return await me(r.apikey,{channel:"channel",event:"Create channel",icon:"\u2705",user_id:s,tags:{"app-id":e,channel:t},notify:!1}).catch(()=>{}),n||(l.success("Channel created \u2705"),K("Done \u2705")),c.data??!0}async function _F(t,e,r){await hy(t,e,r,!1)}async function p7(t,e,r,n=!1){let{quiet:o}=r;!o&&!n&&ee("List current bundle"),r.apikey=r.apikey||ne(o);let i=await te();if(e=pe(e,i?.config),!r.apikey)throw n||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||l.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 ae(a,r.apikey,["write","all","read"]),await Me(a,r.apikey,e,1,n),!t)throw n||l.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||l.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||l.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?l.info(c.name):l.info(`Current bundle for channel ${t} is ${c.name}`)),c.name}async function SF(t,e,r){return p7(t,e,r)}async function h7(t,e,r,n=!1){n||ee("Delete channel"),r.apikey=r.apikey||ne();let o=await te();if(e=pe(e,o?.config),!r.apikey)throw n||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||l.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 ae(i,r.apikey,["all"]);if(await Me(i,r.apikey,e,4,n),r.deleteBundle&&!n&&l.info(`Deleting bundle ${e}#${t} from Capgo`),r.deleteBundle){let p=await F1(i,e,t);p?.name&&!n&&l.info(`Deleting bundle ${p.name} from Capgo`),p?.name&&await Hg(i,e,p.name)}let{data:s,error:u}=await A1(i,e,t);if(u||!s){if(n||l.error(`Channel ${t} not found`),r.successIfNotFound)return n||l.success(`Channel ${t} not found and successIfNotFound is true`),!0;throw new Error(`Channel ${t} not found`)}let{error:c}=await O1(i,e,s.id);if(c)throw n||l.error(`Cannot delete channel devices: ${q(c)}`),new Error(`Cannot delete channel devices: ${q(c)}`);n||l.info(`Deleting channel ${e}#${t} from Capgo`);let f=await x1(i,t,e,a);if(f.error)throw n||l.error(`Cannot delete Channel \u{1F640} ${q(f.error)}`),new Error(`Cannot delete channel: ${q(f.error)}`);let d=await Ct(i,e);return await me(r.apikey,{channel:"channel",event:"Delete channel",icon:"\u2705",user_id:d,tags:{"app-id":e,channel:t},notify:!1}).catch(()=>{}),n||(l.success("Channel deleted"),K("Done \u2705")),!0}async function xF(t,e,r){return h7(t,e,r,!1)}async function m7(t,e,r=!1){r||ee("List channels"),e.apikey=e.apikey||ne();let n=await te();if(t=pe(t,n?.config),!e.apikey)throw r||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||l.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 ae(o,e.apikey,["write","all","read","upload"]);await Me(o,e.apikey,t,1,r),r||l.info("Querying available channels in Capgo");let a=await P1(o,t);return r||(l.info(`Active channels in Capgo: ${a?.length??0}`),k1(a)),await me(e.apikey,{channel:"channel",event:"List channel",icon:"\u2705",user_id:i,tags:{"app-id":t},notify:!1}).catch(()=>{}),r||K("Done \u2705"),a}async function AF(t,e){return m7(t,e,!1)}var OF=["major","minor","metadata","patch","none"];async function g7(t,e,r,n=!1){n||ee("Set channel"),r.apikey=r.apikey||ne();let o=await te();if(e=pe(e,o?.config),!r.apikey)throw n||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||l.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||l.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 ae(i,r.apikey,["write","all"]);await Me(i,r.apikey,e,4,n);let s=await Ct(i,e),{bundle:u,state:c,downgrade:f,latest:d,latestRemote:p,ios:h,android:m,selfAssign:y,disableAutoUpdate:D,dev:v,emulator:E}=r;if(d&&u)throw n||l.error("Cannot set latest and bundle at the same time"),new Error("Cannot set both latest and bundle simultaneously");if(p&&u)throw n||l.error("Cannot set latest remote and bundle at the same time"),new Error("Cannot set both latest remote and bundle simultaneously");if(p&&d)throw n||l.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&&d==null&&p==null&&f==null&&h==null&&m==null&&y==null&&v==null&&E==null&&D==null)throw n||l.error("Missing argument, you need to provide a option to set"),new Error("No channel option provided");await UA(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||l.error(`Cannot find channel ${t}`),new Error(`Cannot find channel ${t}`);let S=d?o?.config?.plugins?.CapacitorUpdater?.version||Fr("",r.packageJson):u;if(S!=null){let{data:F,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||!F)throw n||l.error(`Cannot find version ${S}`),new Error(`Cannot find version ${S}`);if(!r.ignoreMetadataCheck){let{finalCompatibility:T,localDependencies:j}=await Lg(i,e,t,F.native_packages??[]),A=rt();if(j.length>0&&T.some(M=>!To(M)))throw n||(l.warn(`Bundle NOT compatible with ${t} channel`),l.warn(`You can check compatibility with "${A.runner} @capgo/cli bundle compatibility"`)),new Error(`Bundle is not compatible with ${t} channel`);n||(j.length===0&&T.length>0?l.info(`Ignoring check compatibility with ${t} channel because the bundle does not contain any native packages`):l.info(`Bundle is compatible with ${t} channel`))}n||l.info(`Set ${e} channel: ${t} to @${S}`),g.version=F.id}if(p){let{data:F,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||!F)throw n||l.error("Cannot find latest remote version"),new Error("Cannot find latest remote version");if(!r.ignoreMetadataCheck){let{finalCompatibility:T}=await Lg(i,e,t,F.native_packages??[]),j=rt();if(T.some(A=>!To(A)))throw n||(l.warn(`Bundle NOT compatible with ${t} channel`),l.warn(`You can check compatibility with "${j.runner} @capgo/cli bundle compatibility"`)),new Error(`Latest remote bundle is not compatible with ${t} channel`)}n||l.info(`Set ${e} channel: ${t} to @${F.name}`),g.version=F.id}if(c!=null){if(c!=="normal"&&c!=="default")throw n||l.error(`State ${c} is not known. The possible values are: normal, default.`),new Error(`Unknown state ${c}. Expected normal or default`);n||l.info(`Set ${e} channel: ${t} to ${c}`),g.public=c==="default"}if(f!=null&&(n||l.info(`Set ${e} channel: ${t} to ${f?"allow":"disallow"} downgrade`),g.disable_auto_update_under_native=!f),h!=null&&(n||l.info(`Set ${e} channel: ${t} to ${h?"allow":"disallow"} ios update`),g.ios=!!h),m!=null&&(n||l.info(`Set ${e} channel: ${t} to ${m?"allow":"disallow"} android update`),g.android=!!m),y!=null&&(n||l.info(`Set ${e} channel: ${t} to ${y?"allow":"disallow"} self assign to this channel`),g.allow_device_self_set=!!y),v!=null&&(n||l.info(`Set ${e} channel: ${t} to ${v?"allow":"disallow"} dev devices`),g.allow_dev=!!v),E!=null&&(n||l.info(`Set ${e} channel: ${t} to ${E?"allow":"disallow"} emulator devices`),g.allow_emulator=!!E),D!=null){let F=D.toLowerCase();if(!OF.includes(F))throw n||l.error(`Channel strategy ${F} is not known. The possible values are: ${OF.join(", ")}.`),new Error(`Unknown channel strategy ${F}`);F==="metadata"&&(F="version_number"),g.disable_auto_update=F,n||l.info(`Set ${e} channel: ${t} to ${F} disable update strategy to this channel`)}let{error:P}=await Gl(i,g);if(P)throw n||l.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 me(r.apikey,{channel:"channel",event:"Set channel",icon:"\u2705",user_id:s,tags:{"app-id":e},notify:!1}).catch(()=>{}),n||K("Done \u2705"),!0}async function FF(t,e,r){return g7(t,e,r,!1)}var Wr=require("node:fs");function my(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 kF(t="./README.md",e){let r=it.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 f=c,d=f._actionHandler!==null&&f._actionHandler!==void 0;return{name:c.name(),alias:c.alias()||"",description:c.description(),options:c.options.map(p=>({flags:p.flags,description:p.description||""})),subcommands:[],hasAction:d,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),f;i?f=a?`${a}-${u}`:u:f=s?"options":u;let d=i?"###":"##",p="",h=my(u);s&&!i||(p+=`${d} <a id="${f}"></a> ${h} **${c}**
229
+ `));let _=a?be():null,S=e.name||`${u}_${o}.zip`;return _&&_.start(`Saving to ${S}`),(0,Of.writeFileSync)(S,p),_&&_.stop(`Saved to ${S}`),a&&K("Done \u2705"),!r&&n&&y7({bundle:o,filename:S,checksum:E}),{bundle:o,filename:S,checksum:E}}catch(s){throw r||(n?Zs(s):l.error(q(s))),s instanceof Error?s:new Error(String(s))}}async function OF(t,e){await D7(t,e,!1)}async function wy(t,e,r,n=!1){n||ee("Create channel"),r.apikey=r.apikey||ne();let o=await te().catch(()=>{});if(e=fe(e,o?.config),!r.apikey)throw n||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||l.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 ae(i,r.apikey,["write","all"]),await Me(i,r.apikey,e,4,n),n||l.info(`Creating channel ${e}#${t} to Capgo`);let a=await Wg(i,e);if(!a)throw n||l.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 Et(i,e),u=await ae(i,r.apikey,["write","all"]),c=await PO(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||l.error(`Cannot create Channel \u{1F640}
230
+ ${q(c.error)}`),new Error(`Cannot create channel: ${q(c.error)}`);return await me(r.apikey,{channel:"channel",event:"Create channel",icon:"\u2705",user_id:s,tags:{"app-id":e,channel:t},notify:!1}).catch(()=>{}),n||(l.success("Channel created \u2705"),K("Done \u2705")),c.data??!0}async function FF(t,e,r){await wy(t,e,r,!1)}async function b7(t,e,r,n=!1){let{quiet:o}=r;!o&&!n&&ee("List current bundle"),r.apikey=r.apikey||ne(o);let i=await te();if(e=fe(e,i?.config),!r.apikey)throw n||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||l.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 ae(a,r.apikey,["write","all","read"]),await Me(a,r.apikey,e,1,n),!t)throw n||l.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||l.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||l.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?l.info(c.name):l.info(`Current bundle for channel ${t} is ${c.name}`)),c.name}async function PF(t,e,r){return b7(t,e,r)}async function w7(t,e,r,n=!1){n||ee("Delete channel"),r.apikey=r.apikey||ne();let o=await te();if(e=fe(e,o?.config),!r.apikey)throw n||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||l.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 ae(i,r.apikey,["all"]);if(await Me(i,r.apikey,e,4,n),r.deleteBundle&&!n&&l.info(`Deleting bundle ${e}#${t} from Capgo`),r.deleteBundle){let p=await TO(i,e,t);p?.name&&!n&&l.info(`Deleting bundle ${p.name} from Capgo`),p?.name&&await Yg(i,e,p.name)}let{data:s,error:u}=await $O(i,e,t);if(u||!s){if(n||l.error(`Channel ${t} not found`),r.successIfNotFound)return n||l.success(`Channel ${t} not found and successIfNotFound is true`),!0;throw new Error(`Channel ${t} not found`)}let{error:c}=await IO(i,e,s.id);if(c)throw n||l.error(`Cannot delete channel devices: ${q(c)}`),new Error(`Cannot delete channel devices: ${q(c)}`);n||l.info(`Deleting channel ${e}#${t} from Capgo`);let f=await kO(i,t,e,a);if(f.error)throw n||l.error(`Cannot delete Channel \u{1F640} ${q(f.error)}`),new Error(`Cannot delete channel: ${q(f.error)}`);let d=await Et(i,e);return await me(r.apikey,{channel:"channel",event:"Delete channel",icon:"\u2705",user_id:d,tags:{"app-id":e,channel:t},notify:!1}).catch(()=>{}),n||(l.success("Channel deleted"),K("Done \u2705")),!0}async function kF(t,e,r){return w7(t,e,r,!1)}async function v7(t,e,r=!1){r||ee("List channels"),e.apikey=e.apikey||ne();let n=await te();if(t=fe(t,n?.config),!e.apikey)throw r||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||l.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 ae(o,e.apikey,["write","all","read","upload"]);await Me(o,e.apikey,t,1,r),r||l.info("Querying available channels in Capgo");let a=await BO(o,t);return r||(l.info(`Active channels in Capgo: ${a?.length??0}`),RO(a)),await me(e.apikey,{channel:"channel",event:"List channel",icon:"\u2705",user_id:i,tags:{"app-id":t},notify:!1}).catch(()=>{}),r||K("Done \u2705"),a}async function $F(t,e){return v7(t,e,!1)}var IF=["major","minor","metadata","patch","none"];async function C7(t,e,r,n=!1){n||ee("Set channel"),r.apikey=r.apikey||ne();let o=await te();if(e=fe(e,o?.config),!r.apikey)throw n||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||l.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||l.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 ae(i,r.apikey,["write","all"]);await Me(i,r.apikey,e,4,n);let s=await Et(i,e),{bundle:u,state:c,downgrade:f,latest:d,latestRemote:p,ios:h,android:m,selfAssign:y,disableAutoUpdate:D,dev:v,emulator:E}=r;if(d&&u)throw n||l.error("Cannot set latest and bundle at the same time"),new Error("Cannot set both latest and bundle simultaneously");if(p&&u)throw n||l.error("Cannot set latest remote and bundle at the same time"),new Error("Cannot set both latest remote and bundle simultaneously");if(p&&d)throw n||l.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&&d==null&&p==null&&f==null&&h==null&&m==null&&y==null&&v==null&&E==null&&D==null)throw n||l.error("Missing argument, you need to provide a option to set"),new Error("No channel option provided");await zA(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||l.error(`Cannot find channel ${t}`),new Error(`Cannot find channel ${t}`);let S=d?o?.config?.plugins?.CapacitorUpdater?.version||Ir("",r.packageJson):u;if(S!=null){let{data:F,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||!F)throw n||l.error(`Cannot find version ${S}`),new Error(`Cannot find version ${S}`);if(!r.ignoreMetadataCheck){let{finalCompatibility:T,localDependencies:j}=await Hg(i,e,t,F.native_packages??[]),A=nt();if(j.length>0&&T.some(M=>!Bo(M)))throw n||(l.warn(`Bundle NOT compatible with ${t} channel`),l.warn(`You can check compatibility with "${A.runner} @capgo/cli bundle compatibility"`)),new Error(`Bundle is not compatible with ${t} channel`);n||(j.length===0&&T.length>0?l.info(`Ignoring check compatibility with ${t} channel because the bundle does not contain any native packages`):l.info(`Bundle is compatible with ${t} channel`))}n||l.info(`Set ${e} channel: ${t} to @${S}`),g.version=F.id}if(p){let{data:F,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||!F)throw n||l.error("Cannot find latest remote version"),new Error("Cannot find latest remote version");if(!r.ignoreMetadataCheck){let{finalCompatibility:T}=await Hg(i,e,t,F.native_packages??[]),j=nt();if(T.some(A=>!Bo(A)))throw n||(l.warn(`Bundle NOT compatible with ${t} channel`),l.warn(`You can check compatibility with "${j.runner} @capgo/cli bundle compatibility"`)),new Error(`Latest remote bundle is not compatible with ${t} channel`)}n||l.info(`Set ${e} channel: ${t} to @${F.name}`),g.version=F.id}if(c!=null){if(c!=="normal"&&c!=="default")throw n||l.error(`State ${c} is not known. The possible values are: normal, default.`),new Error(`Unknown state ${c}. Expected normal or default`);n||l.info(`Set ${e} channel: ${t} to ${c}`),g.public=c==="default"}if(f!=null&&(n||l.info(`Set ${e} channel: ${t} to ${f?"allow":"disallow"} downgrade`),g.disable_auto_update_under_native=!f),h!=null&&(n||l.info(`Set ${e} channel: ${t} to ${h?"allow":"disallow"} ios update`),g.ios=!!h),m!=null&&(n||l.info(`Set ${e} channel: ${t} to ${m?"allow":"disallow"} android update`),g.android=!!m),y!=null&&(n||l.info(`Set ${e} channel: ${t} to ${y?"allow":"disallow"} self assign to this channel`),g.allow_device_self_set=!!y),v!=null&&(n||l.info(`Set ${e} channel: ${t} to ${v?"allow":"disallow"} dev devices`),g.allow_dev=!!v),E!=null&&(n||l.info(`Set ${e} channel: ${t} to ${E?"allow":"disallow"} emulator devices`),g.allow_emulator=!!E),D!=null){let F=D.toLowerCase();if(!IF.includes(F))throw n||l.error(`Channel strategy ${F} is not known. The possible values are: ${IF.join(", ")}.`),new Error(`Unknown channel strategy ${F}`);F==="metadata"&&(F="version_number"),g.disable_auto_update=F,n||l.info(`Set ${e} channel: ${t} to ${F} disable update strategy to this channel`)}let{error:k}=await Xl(i,g);if(k)throw n||l.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 me(r.apikey,{channel:"channel",event:"Set channel",icon:"\u2705",user_id:s,tags:{"app-id":e},notify:!1}).catch(()=>{}),n||K("Done \u2705"),!0}async function TF(t,e,r){return C7(t,e,r,!1)}var Zr=require("node:fs");function vy(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 RF(t="./README.md",e){let r=at.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 f=c,d=f._actionHandler!==null&&f._actionHandler!==void 0;return{name:c.name(),alias:c.alias()||"",description:c.description(),options:c.options.map(p=>({flags:p.flags,description:p.description||""})),subcommands:[],hasAction:d,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),f;i?f=a?`${a}-${u}`:u:f=s?"options":u;let d=i?"###":"##",p="",h=vy(u);s&&!i||(p+=`${d} <a id="${f}"></a> ${h} **${c}**
229
231
 
230
232
  `),o.alias&&(p+=`**Alias:** \`${o.alias}\`
231
233
 
@@ -248,8 +250,8 @@ ${q(c.error)}`),new Error(`Cannot create channel: ${q(c.error)}`);return await m
248
250
  `,p+=`| -------------- | ------------- | -------------------- |
249
251
  `;for(let v of o.options){let E=v.flags.split(" ")[0],g=v.flags.split(" ").length>1?"string":"boolean";p+=`| **${E}** | <code>${g}</code> | ${v.description} |
250
252
  `}p+=`
251
- `}return p};if(e){(0,Wr.existsSync)(e)||(0,Wr.mkdirSync)(e,{recursive:!0});for(let o of r){if(o.name==="generate-docs")return;let a=`---
252
- title: ${my(o.name)} ${o.name}
253
+ `}return p};if(e){(0,Zr.existsSync)(e)||(0,Zr.mkdirSync)(e,{recursive:!0});for(let o of r){if(o.name==="generate-docs")return;let a=`---
254
+ title: ${vy(o.name)} ${o.name}
253
255
  description: ${o.description.split(`
254
256
  `)[0]}
255
257
  sidebar_label: ${o.name}
@@ -260,55 +262,55 @@ sidebar:
260
262
  `,s=o.description.split(`
261
263
  `)[0];a+=`${s}
262
264
 
263
- `;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,Wr.writeFileSync)(`${e}/${o.name}.mdx`,a,"utf8"),l.success(`Generated documentation file for ${o.name} command in ${e}/${o.name}.mdx`)}catch(c){console.error(`Error generating file for ${o.name}:`,c)}}l.success(`Documentation files generated in ${e}/`)}else{let o=`## \u{1F4D1} Capgo CLI Commands
265
+ `;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,Zr.writeFileSync)(`${e}/${o.name}.mdx`,a,"utf8"),l.success(`Generated documentation file for ${o.name} command in ${e}/${o.name}.mdx`)}catch(c){console.error(`Error generating file for ${o.name}:`,c)}}l.success(`Documentation files generated in ${e}/`)}else{let o=`## \u{1F4D1} Capgo CLI Commands
264
266
 
265
267
  `;o+=`## \u{1F4CB} Table of Contents
266
268
 
267
- `;for(let f of r){if(f.name==="generate-docs")continue;let d=my(f.name);if(o+=`- ${d} [${f.name.charAt(0).toUpperCase()+f.name.slice(1)}](#${f.name})
269
+ `;for(let f of r){if(f.name==="generate-docs")continue;let d=vy(f.name);if(o+=`- ${d} [${f.name.charAt(0).toUpperCase()+f.name.slice(1)}](#${f.name})
268
270
  `,f.subcommands.length>0)for(let p of f.subcommands)o+=` - [${p.name.charAt(0).toUpperCase()+p.name.slice(1)}](#${f.name}-${p.name})
269
271
  `}o+=`
270
272
  `;for(let f of r)if(f.name!=="generate-docs"){if(o+=n(f,!1,void 0,!1),f.subcommands.length>0){f.isCommandGroup||(o+=`#### ${f.name.toUpperCase()} Subcommands:
271
273
 
272
274
  `);for(let d of f.subcommands)o+=n(d,!0,f.name)}o+=`
273
- `}let i="<!-- AUTO-GENERATED-DOCS-START -->",a="<!-- AUTO-GENERATED-DOCS-END -->",s="";try{s=(0,Wr.readFileSync)(t,"utf8")}catch{s=""}let u=s.indexOf(i),c=s.indexOf(a,u);if(u!==-1&&c!==-1){let f=s.substring(0,u+i.length),d=s.substring(c),p=`${f}
275
+ `}let i="<!-- AUTO-GENERATED-DOCS-START -->",a="<!-- AUTO-GENERATED-DOCS-END -->",s="";try{s=(0,Zr.readFileSync)(t,"utf8")}catch{s=""}let u=s.indexOf(i),c=s.indexOf(a,u);if(u!==-1&&c!==-1){let f=s.substring(0,u+i.length),d=s.substring(c),p=`${f}
274
276
  ${o}
275
- ${d}`;(0,Wr.writeFileSync)(t,p,"utf8"),l.success(`Documentation updated in ${t}`)}else(0,Wr.writeFileSync)(t,o,"utf8"),l.success(`Documentation written to ${t}`)}}var va=require("node:child_process"),Ae=require("node:fs"),$r=require("node:path"),se=require("node:process");var Af=fe(WF());var Lt=require("node:fs");function YF(t){return t.plugins??={},t.plugins.extConfig??={},t.plugins.CapacitorUpdater??={},t.plugins.CapacitorUpdater}async function N7(t,e=!1){e||ee("Save keys \u{1F511}");let r=await te(),n=t.key||fn,o=t.keyData||"";if(!(0,Lt.existsSync)(n)&&!o)throw e||l.error(`Cannot find a public key at ${n} or as keyData option or in ${r.path}`),new Error("Missing public key");if((0,Lt.existsSync)(n)&&(o=(0,Lt.readFileSync)(n,"utf8")),!o.startsWith("-----BEGIN RSA PUBLIC KEY-----"))throw e||l.error("The public key provided is not a valid RSA Public key"),new Error("Invalid RSA public key");if(r?.config){let i=YF(r.config);i.privateKey&&(delete i.privateKey,e||l.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await ue({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 Qi(r)}return e||(l.success(`Public key saved into ${r.path} file in local directory`),l.success("Your app will decode the zip archive with this key")),!0}async function L7(t,e=!1){e||ee("Deleting old private key \u{1F5D1}\uFE0F");let r=await te(),n=r?.config?.plugins?.CapacitorUpdater;if(n?.privateKey){if(delete n.privateKey,await Qi(r),(0,Lt.existsSync)(oa))try{(0,Lt.unlinkSync)(oa),e||l.success(`Old private key file deleted: ${oa}`)}catch(o){e||l.error(`Failed to delete old private key file: ${oa} (${String(o)})`)}if((0,Lt.existsSync)(Hl))try{(0,Lt.unlinkSync)(Hl),e||l.success(`Old public key file deleted: ${Hl}`)}catch(o){e||l.error(`Failed to delete old public key file: ${fn} (${String(o)})`)}return e||(l.success(`Old private key deleted from ${r.path} file`),K("Done \u2705")),!0}return e||l.info("No old private key found in config file"),!1}async function JF(t){await Ee(),await N7(t,!1)}async function wy(t,e=!1){e||ee("Create keys \u{1F511}");let{publicKey:r,privateKey:n}=L1();if((0,Lt.existsSync)(fn)&&!t.force)throw e||l.error("Public Key already exists, use --force to overwrite"),new Error("Public key already exists");if((0,Lt.writeFileSync)(fn,r),(0,Lt.existsSync)(nr)&&!t.force)throw e||l.error("Private Key already exists, use --force to overwrite"),new Error("Private key already exists");(0,Lt.writeFileSync)(nr,n);let o=await te();if(o){let i=YF(o.config);i.privateKey&&(delete i.privateKey,e||l.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await ue({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 Qi(o)}if(!e){l.success("Your RSA key has been generated"),l.success(`Private key saved in ${nr}`),l.success("This key will be used to encrypt your bundle before sending it to Capgo"),l.success("Keep it safe"),l.success("Then make it unreadable by Capgo and unmodifiable by anyone"),l.success(`Public key saved in ${o.path}`),l.success("Your app will be the only one having it"),l.success("Only your users can decrypt your update"),l.success("Only you can send them an update");try{await Yl(),K("Done \u2705")}catch(i){if(i instanceof Error&&i.message==="Capacitor sync cancelled")return!0;throw i}}return!0}async function XF(t){await Ee(),await wy(t,!1)}async function ZF(t){await Ee(),await L7(t,!1)}var wn=require("node:fs"),vy=require("node:os");function QF(){let t=(0,vy.homedir)();return(0,wn.existsSync)(`${t}/.capgo`)||(0,wn.existsSync)(".capgo")}async function Cy(t,e,r=!1){if(r||ee("Login to Capgo"),!t)throw r||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");await Ee();let{local:n}=e;if(n){if(!(0,wn.existsSync)(".git"))throw r||l.error("To use local you should be in a git repository"),new Error("Not in a git repository");(0,wn.writeFileSync)(".capgo",`${t}
276
- `),(0,wn.appendFileSync)(".gitignore",`.capgo
277
- `)}else{let a=(0,vy.homedir)();(0,wn.writeFileSync)(`${a}/.capgo`,`${t}
278
- `)}let o=await re(t,e.supaHost,e.supaAnon),i=await ae(o,t,["write","all","upload"]);await me(t,{channel:"user-login",event:"User CLI login",icon:"\u2705",user_id:i,notify:!1}).catch(),r||(l.success(`login saved into .capgo file in ${n?"local":"home"} directory`),K("Done \u2705"))}async function e2(t,e){await Cy(t,e,!1)}var Ey="import { CapacitorUpdater } from '@capgo/capacitor-updater'",Ys="CapacitorUpdater.notifyAppReady()",j7=/import.*from.*/g,Js="production",_y={stdio:"pipe"},Xs,Kn;function t2(){Xs??=(0,Ae.readdirSync)(Af.default.tmpdir).map(t=>({name:t,full:`${Af.default.tmpdir}/${t}`})).find(t=>t.name.startsWith("capgocli"))?.full??Af.default.fileSync({prefix:"capgocli"}).name}function jt(t,e){try{t2(),(0,Ae.writeFileSync)(Xs,JSON.stringify(e?{step_done:t,pathToPackageJson:e}:{step_done:t,pathToPackageJson:Kn})),e&&(Kn=e)}catch(r){l.error(`Cannot mark step as done in the CLI, error:
279
- ${r}`),l.warn("Onboarding will continue but please report it to the capgo team!")}}async function U7(t,e){try{t2();let r=(0,Ae.readFileSync)(Xs,"utf-8");if(!r||r.length===0)return;let{step_done:n,pathToPackageJson:o}=JSON.parse(r);l.info(`You have already got to the step ${n}/10 in the previous session`);let i=await ue({message:"Would you like to continue from where you left off?"});return await Xe(i,t,e),i?(o&&(Kn=o),n):void 0}catch(r){l.error(`Cannot read which steps have been completed, error:
280
- ${r}`),l.warn("Onboarding will continue but please report it to the capgo team!");return}}function M7(){if(Xs)try{(0,Ae.rmSync)(Xs)}catch(t){l.error(`Cannot delete the tmp steps file.
281
- Error: ${t}`)}}async function Xe(t,e,r){le(t)&&(await vt("onboarding-v2",e,r,"canceled","\u{1F937}"),K(`Bye \u{1F44B}
282
- \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)())}async function xt(t,e,r,n){return vt("onboarding-v2",t,e,`onboarding-step-${r}`,n)}async function q7(t,e){l.info("\u{1F4CB} Checking development environment prerequisites"),l.info(" For mobile development, you need at least one platform setup");let r=se.platform==="darwin"&&(0,Ae.existsSync)("/Applications/Xcode.app"),n=se.env.HOME||se.env.USERPROFILE||"~",i=[se.env.ANDROID_HOME,se.env.ANDROID_SDK_ROOT,(0,$r.join)(n,"Library","Android","sdk"),(0,$r.join)(n,"Android","Sdk"),(0,$r.join)(n,"AppData","Local","Android","Sdk")].filter(Boolean).some(a=>a&&(0,Ae.existsSync)(a));if(r?l.success("\u2705 Xcode detected - iOS development ready"):se.platform==="darwin"&&l.warn("\u26A0\uFE0F Xcode not found"),i?l.success("\u2705 Android SDK detected - Android development ready"):l.warn("\u26A0\uFE0F Android SDK not found"),!r&&!i){l.error("\u274C No development environment detected"),l.info(""),l.info("\u{1F4F1} To develop mobile apps with Capacitor, you need:"),l.info(" \u2022 For iOS: Xcode (macOS only) - https://developer.apple.com/xcode/"),l.info(" \u2022 For Android: Android Studio - https://developer.android.com/studio"),l.info("");let a=await ue({message:"Continue onboarding without a development environment? (You won't be able to build or test)",initialValue:!1});await Xe(a,t,e),a||(l.info("\u{1F4DD} Please install a development environment and run the onboarding again"),K(`Bye \u{1F44B}
283
- \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)()),l.warn("\u26A0\uFE0F Continuing without development environment - you'll need to set it up later")}else if(!r&&se.platform==="darwin"){let a=await ue({message:"Xcode is not installed. Do you plan to develop for iOS?",initialValue:!1});if(await Xe(a,t,e),a){l.info("\u{1F4E5} Please install Xcode from: https://developer.apple.com/xcode/"),l.info("\u{1F4A1} After installing Xcode, you can continue the onboarding");let s=await ue({message:"Have you installed Xcode? (Choose No to continue with Android only)",initialValue:!1});await Xe(s,t,e),s||l.info("\u{1F4F1} Continuing with Android development only")}}else if(!i){let a=await ue({message:"Android SDK is not installed. Do you plan to develop for Android?",initialValue:!1});if(await Xe(a,t,e),a){l.info("\u{1F4E5} Please install Android Studio from: https://developer.android.com/studio"),l.info("\u{1F4A1} After installing Android Studio, set up the Android SDK");let s=await ue({message:"Have you installed Android Studio? (Choose No to continue with iOS only)",initialValue:!1});await Xe(s,t,e),s||l.info("\u{1F4F1} Continuing with iOS development only")}}await xt(t,e,"check-prerequisites","checked")}async function H7(t,e,r,n){let o=rt(),i=r,a=0,s=5;for(;a<s;){let u=await ue({message:`Add ${i} in Capgo?`});if(await Xe(u,t.gid,e),!u)return l.info(`If you change your mind, run it for yourself with: "${o.runner} @capgo/cli@latest app add ${i}"`),await xt(t.gid,e,"add-app",i),i;try{let c=be();return c.start(`Running: ${o.runner} @capgo/cli@latest app add ${i}`),await jg(i,n,t,!0)?c.stop("App add Done \u2705"):c.stop("App already add \u2705"),await xt(t.gid,e,"add-app",i),i}catch(c){if((c instanceof Error?c.message:String(c)).includes("already exist")){a++,l.error(`\u274C App ID "${i}" is already taken`);let d=[`${r}2`,`${r}3`,`${r}.new`,`${r}.app`];l.info("\u{1F4A1} Here are some suggestions:"),d.forEach((h,m)=>{l.info(` ${m+1}. ${h}`)});let p=await mt({message:"What would you like to do?",options:[{value:"suggest1",label:`Use ${d[0]}`},{value:"suggest2",label:`Use ${d[1]}`},{value:"suggest3",label:`Use ${d[2]}`},{value:"suggest4",label:`Use ${d[3]}`},{value:"custom",label:"Enter a custom app ID"},{value:"cancel",label:"Cancel onboarding"}]});if(le(p)&&(await vt("onboarding-v2",t.gid,e,"canceled","\u{1F937}"),K(`Bye \u{1F44B}
284
- \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)()),p==="cancel"&&(await vt("onboarding-v2",t.gid,e,"canceled-appid-conflict","\u{1F937}"),K(`Bye \u{1F44B}
285
- \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)()),p==="custom"){let h=await Ut({message:"Enter your custom app ID (e.g., com.example.myapp):",validate:m=>{if(!m)return"App ID is required";if(m.includes("--"))return'App ID cannot contain "--"';if(!/^[a-z0-9]+(?:\.[\w-]+)+$/i.test(m))return"Invalid format. Use reverse domain notation (e.g., com.example.app)"}});le(h)&&(await vt("onboarding-v2",t.gid,e,"canceled","\u{1F937}"),K(`Bye \u{1F44B}
277
+ ${d}`;(0,Zr.writeFileSync)(t,p,"utf8"),l.success(`Documentation updated in ${t}`)}else(0,Zr.writeFileSync)(t,o,"utf8"),l.success(`Documentation written to ${t}`)}}var Ca=require("node:child_process"),Oe=require("node:fs"),Rr=require("node:path"),se=require("node:process");var kf=pe(QF());var jt=require("node:fs");function e2(t){return t.plugins??={},t.plugins.extConfig??={},t.plugins.CapacitorUpdater??={},t.plugins.CapacitorUpdater}async function H7(t,e=!1){e||ee("Save keys \u{1F511}");let r=await te(),n=t.key||mn,o=t.keyData||"";if(!(0,jt.existsSync)(n)&&!o)throw e||l.error(`Cannot find a public key at ${n} or as keyData option or in ${r.path}`),new Error("Missing public key");if((0,jt.existsSync)(n)&&(o=(0,jt.readFileSync)(n,"utf8")),!o.startsWith("-----BEGIN RSA PUBLIC KEY-----"))throw e||l.error("The public key provided is not a valid RSA Public key"),new Error("Invalid RSA public key");if(r?.config){let i=e2(r.config);i.privateKey&&(delete i.privateKey,e||l.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await ue({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 Qi(r)}return e||(l.success(`Public key saved into ${r.path} file in local directory`),l.success("Your app will decode the zip archive with this key")),!0}async function V7(t,e=!1){e||ee("Deleting old private key \u{1F5D1}\uFE0F");let r=await te(),n=r?.config?.plugins?.CapacitorUpdater;if(n?.privateKey){if(delete n.privateKey,await Qi(r),(0,jt.existsSync)(oa))try{(0,jt.unlinkSync)(oa),e||l.success(`Old private key file deleted: ${oa}`)}catch(o){e||l.error(`Failed to delete old private key file: ${oa} (${String(o)})`)}if((0,jt.existsSync)(Gl))try{(0,jt.unlinkSync)(Gl),e||l.success(`Old public key file deleted: ${Gl}`)}catch(o){e||l.error(`Failed to delete old public key file: ${mn} (${String(o)})`)}return e||(l.success(`Old private key deleted from ${r.path} file`),K("Done \u2705")),!0}return e||l.info("No old private key found in config file"),!1}async function t2(t){await Ee(),await H7(t,!1)}async function xy(t,e=!1){e||ee("Create keys \u{1F511}");let{publicKey:r,privateKey:n}=HO();if((0,jt.existsSync)(mn)&&!t.force)throw e||l.error("Public Key already exists, use --force to overwrite"),new Error("Public key already exists");if((0,jt.writeFileSync)(mn,r),(0,jt.existsSync)(or)&&!t.force)throw e||l.error("Private Key already exists, use --force to overwrite"),new Error("Private key already exists");(0,jt.writeFileSync)(or,n);let o=await te();if(o){let i=e2(o.config);i.privateKey&&(delete i.privateKey,e||l.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await ue({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 Qi(o)}if(!e){l.success("Your RSA key has been generated"),l.success(`Private key saved in ${or}`),l.success("This key will be used to encrypt your bundle before sending it to Capgo"),l.success("Keep it safe"),l.success("Then make it unreadable by Capgo and unmodifiable by anyone"),l.success(`Public key saved in ${o.path}`),l.success("Your app will be the only one having it"),l.success("Only your users can decrypt your update"),l.success("Only you can send them an update");try{await Ql(),K("Done \u2705")}catch(i){if(i instanceof Error&&i.message==="Capacitor sync cancelled")return!0;throw i}}return!0}async function r2(t){await Ee(),await xy(t,!1)}async function n2(t){await Ee(),await V7(t,!1)}var En=require("node:fs"),Ay=require("node:os");function o2(){let t=(0,Ay.homedir)();return(0,En.existsSync)(`${t}/.capgo`)||(0,En.existsSync)(".capgo")}async function Oy(t,e,r=!1){if(r||ee("Login to Capgo"),!t)throw r||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");await Ee();let{local:n}=e;if(n){if(!(0,En.existsSync)(".git"))throw r||l.error("To use local you should be in a git repository"),new Error("Not in a git repository");(0,En.writeFileSync)(".capgo",`${t}
278
+ `),(0,En.appendFileSync)(".gitignore",`.capgo
279
+ `)}else{let a=(0,Ay.homedir)();(0,En.writeFileSync)(`${a}/.capgo`,`${t}
280
+ `)}let o=await re(t,e.supaHost,e.supaAnon),i=await ae(o,t,["write","all","upload"]);await me(t,{channel:"user-login",event:"User CLI login",icon:"\u2705",user_id:i,notify:!1}).catch(),r||(l.success(`login saved into .capgo file in ${n?"local":"home"} directory`),K("Done \u2705"))}async function i2(t,e){await Oy(t,e,!1)}var Fy="import { CapacitorUpdater } from '@capgo/capacitor-updater'",Qs="CapacitorUpdater.notifyAppReady()",z7=/import.*from.*/g,eu="production",Py={stdio:"pipe"},tu,Wn;function a2(){tu??=(0,Oe.readdirSync)(kf.default.tmpdir).map(t=>({name:t,full:`${kf.default.tmpdir}/${t}`})).find(t=>t.name.startsWith("capgocli"))?.full??kf.default.fileSync({prefix:"capgocli"}).name}function Ut(t,e){try{a2(),(0,Oe.writeFileSync)(tu,JSON.stringify(e?{step_done:t,pathToPackageJson:e}:{step_done:t,pathToPackageJson:Wn})),e&&(Wn=e)}catch(r){l.error(`Cannot mark step as done in the CLI, error:
281
+ ${r}`),l.warn("Onboarding will continue but please report it to the capgo team!")}}async function K7(t,e){try{a2();let r=(0,Oe.readFileSync)(tu,"utf-8");if(!r||r.length===0)return;let{step_done:n,pathToPackageJson:o}=JSON.parse(r);l.info(`You have already got to the step ${n}/10 in the previous session`);let i=await ue({message:"Would you like to continue from where you left off?"});return await Ze(i,t,e),i?(o&&(Wn=o),n):void 0}catch(r){l.error(`Cannot read which steps have been completed, error:
282
+ ${r}`),l.warn("Onboarding will continue but please report it to the capgo team!");return}}function G7(){if(tu)try{(0,Oe.rmSync)(tu)}catch(t){l.error(`Cannot delete the tmp steps file.
283
+ Error: ${t}`)}}async function Ze(t,e,r){le(t)&&(await Ct("onboarding-v2",e,r,"canceled","\u{1F937}"),K(`Bye \u{1F44B}
284
+ \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)())}async function At(t,e,r,n){return Ct("onboarding-v2",t,e,`onboarding-step-${r}`,n)}async function W7(t,e){l.info("\u{1F4CB} Checking development environment prerequisites"),l.info(" For mobile development, you need at least one platform setup");let r=se.platform==="darwin"&&(0,Oe.existsSync)("/Applications/Xcode.app"),n=se.env.HOME||se.env.USERPROFILE||"~",i=[se.env.ANDROID_HOME,se.env.ANDROID_SDK_ROOT,(0,Rr.join)(n,"Library","Android","sdk"),(0,Rr.join)(n,"Android","Sdk"),(0,Rr.join)(n,"AppData","Local","Android","Sdk")].filter(Boolean).some(a=>a&&(0,Oe.existsSync)(a));if(r?l.success("\u2705 Xcode detected - iOS development ready"):se.platform==="darwin"&&l.warn("\u26A0\uFE0F Xcode not found"),i?l.success("\u2705 Android SDK detected - Android development ready"):l.warn("\u26A0\uFE0F Android SDK not found"),!r&&!i){l.error("\u274C No development environment detected"),l.info(""),l.info("\u{1F4F1} To develop mobile apps with Capacitor, you need:"),l.info(" \u2022 For iOS: Xcode (macOS only) - https://developer.apple.com/xcode/"),l.info(" \u2022 For Android: Android Studio - https://developer.android.com/studio"),l.info("");let a=await ue({message:"Continue onboarding without a development environment? (You won't be able to build or test)",initialValue:!1});await Ze(a,t,e),a||(l.info("\u{1F4DD} Please install a development environment and run the onboarding again"),K(`Bye \u{1F44B}
285
+ \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)()),l.warn("\u26A0\uFE0F Continuing without development environment - you'll need to set it up later")}else if(!r&&se.platform==="darwin"){let a=await ue({message:"Xcode is not installed. Do you plan to develop for iOS?",initialValue:!1});if(await Ze(a,t,e),a){l.info("\u{1F4E5} Please install Xcode from: https://developer.apple.com/xcode/"),l.info("\u{1F4A1} After installing Xcode, you can continue the onboarding");let s=await ue({message:"Have you installed Xcode? (Choose No to continue with Android only)",initialValue:!1});await Ze(s,t,e),s||l.info("\u{1F4F1} Continuing with Android development only")}}else if(!i){let a=await ue({message:"Android SDK is not installed. Do you plan to develop for Android?",initialValue:!1});if(await Ze(a,t,e),a){l.info("\u{1F4E5} Please install Android Studio from: https://developer.android.com/studio"),l.info("\u{1F4A1} After installing Android Studio, set up the Android SDK");let s=await ue({message:"Have you installed Android Studio? (Choose No to continue with iOS only)",initialValue:!1});await Ze(s,t,e),s||l.info("\u{1F4F1} Continuing with iOS development only")}}await At(t,e,"check-prerequisites","checked")}async function Y7(t,e,r,n){let o=nt(),i=r,a=0,s=5;for(;a<s;){let u=await ue({message:`Add ${i} in Capgo?`});if(await Ze(u,t.gid,e),!u)return l.info(`If you change your mind, run it for yourself with: "${o.runner} @capgo/cli@latest app add ${i}"`),await At(t.gid,e,"add-app",i),i;try{let c=be();return c.start(`Running: ${o.runner} @capgo/cli@latest app add ${i}`),await Vg(i,n,t,!0)?c.stop("App add Done \u2705"):c.stop("App already add \u2705"),await At(t.gid,e,"add-app",i),i}catch(c){if((c instanceof Error?c.message:String(c)).includes("already exist")){a++,l.error(`\u274C App ID "${i}" is already taken`);let d=[`${r}2`,`${r}3`,`${r}.new`,`${r}.app`];l.info("\u{1F4A1} Here are some suggestions:"),d.forEach((h,m)=>{l.info(` ${m+1}. ${h}`)});let p=await gt({message:"What would you like to do?",options:[{value:"suggest1",label:`Use ${d[0]}`},{value:"suggest2",label:`Use ${d[1]}`},{value:"suggest3",label:`Use ${d[2]}`},{value:"suggest4",label:`Use ${d[3]}`},{value:"custom",label:"Enter a custom app ID"},{value:"cancel",label:"Cancel onboarding"}]});if(le(p)&&(await Ct("onboarding-v2",t.gid,e,"canceled","\u{1F937}"),K(`Bye \u{1F44B}
286
+ \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)()),p==="cancel"&&(await Ct("onboarding-v2",t.gid,e,"canceled-appid-conflict","\u{1F937}"),K(`Bye \u{1F44B}
287
+ \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)()),p==="custom"){let h=await Mt({message:"Enter your custom app ID (e.g., com.example.myapp):",validate:m=>{if(!m)return"App ID is required";if(m.includes("--"))return'App ID cannot contain "--"';if(!/^[a-z0-9]+(?:\.[\w-]+)+$/i.test(m))return"Invalid format. Use reverse domain notation (e.g., com.example.app)"}});le(h)&&(await Ct("onboarding-v2",t.gid,e,"canceled","\u{1F937}"),K(`Bye \u{1F44B}
286
288
  \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)()),i=h}else{let h=Number.parseInt(p.replace("suggest",""))-1;i=d[h]}l.info(`\u{1F504} Trying with new app ID: ${i}`);continue}throw c}}l.error(`\u274C Maximum retry attempts (${s}) reached`),K(`Bye \u{1F44B}
287
- \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)(1)}async function V7(t,e,r){let n=rt(),o=await ue({message:`Create default channel ${Js} for ${r} in Capgo?`});if(await Xe(o,t,e),o){let i=be();i.start(`Running: ${n.runner} @capgo/cli@latest channel add ${Js} ${r} --default`),await hy(Js,r,{default:!0,apikey:e},!0)?i.stop("Channel add Done \u2705"):i.stop("Channel already added \u2705")}else l.info(`If you change your mind, run it for yourself with: "${n.runner} @capgo/cli@latest channel add ${Js} ${r} --default"`);await xt(t,e,"add-channel",r)}async function z7(t){let e=(0,$r.join)(Dt((0,se.cwd)()),Dr),r=Kn?await br(void 0,Kn):await br(void 0,e);if(r.size===0||!r.has("@capacitor/core")){l.warn("No adequate dependencies found");let n=await ue({message:"Would you like to select the package.json file manually?"});if(le(n)&&(Wn("Operation cancelled."),(0,se.exit)(1)),n){let o=await ue({message:"Would you like to use a tree selector to choose the package.json file?"});if(le(o)&&(Wn("Operation cancelled."),(0,se.exit)(1)),o){let a=(0,se.cwd)(),s=Dr;for(;;){let u=(0,Ae.readdirSync)(a).map(c=>({value:c,label:c}));if(u.push({value:"..",label:".."}),s=await mt({message:"Select package.json file:",options:u}),le(s)&&(Wn("Operation cancelled."),(0,se.exit)(1)),!(0,Ae.statSync)((0,$r.join)(a,s)).isDirectory()&&s!==Dr){l.error("Selected a file that is not a package.json file");continue}if(a=(0,$r.join)(a,s),s===Dr)break}return await jt(t,a),{dependencies:await br(void 0,a),path:a}}let i=await Ut({message:"Enter path to node_modules folder:"});return le(i)&&(Wn("Operation cancelled."),(0,se.exit)(1)),(0,Ae.existsSync)(i)||(l.error(`Path ${i} does not exist`),(0,se.exit)(1)),{dependencies:await br(void 0,i),path:i}}}return await jt(t,e),{dependencies:await br(void 0,e),path:e}}var K7="https://capacitorjs.com/docs/updating/5-0",G7="https://capacitorjs.com/docs/updating/6-0",W7="https://capacitorjs.com/docs/updating/7-0",Y7="https://capacitorjs.com/docs/updating/8-0";async function J7(t,e,r){let n=rt(),o="1.0.0",i=!1,a=await ue({message:`Automatic Install "@capgo/capacitor-updater" dependency in ${r}?`});if(await Xe(a,t,e),a){let s=be(),u="latest",{dependencies:c,path:f}=await z7(3);s.start("Checking if @capgo/capacitor-updater is installed"),c.has("@capacitor/core")||(s.stop("Error"),l.warn("Cannot find @capacitor/core in package.json"),K(`Bye \u{1F44B}
289
+ \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)(1)}async function J7(t,e,r){let n=nt(),o=await ue({message:`Create default channel ${eu} for ${r} in Capgo?`});if(await Ze(o,t,e),o){let i=be();i.start(`Running: ${n.runner} @capgo/cli@latest channel add ${eu} ${r} --default`),await wy(eu,r,{default:!0,apikey:e},!0)?i.stop("Channel add Done \u2705"):i.stop("Channel already added \u2705")}else l.info(`If you change your mind, run it for yourself with: "${n.runner} @capgo/cli@latest channel add ${eu} ${r} --default"`);await At(t,e,"add-channel",r)}async function X7(t){let e=(0,Rr.join)(bt((0,se.cwd)()),wr),r=Wn?await vr(void 0,Wn):await vr(void 0,e);if(r.size===0||!r.has("@capacitor/core")){l.warn("No adequate dependencies found");let n=await ue({message:"Would you like to select the package.json file manually?"});if(le(n)&&(Jn("Operation cancelled."),(0,se.exit)(1)),n){let o=await ue({message:"Would you like to use a tree selector to choose the package.json file?"});if(le(o)&&(Jn("Operation cancelled."),(0,se.exit)(1)),o){let a=(0,se.cwd)(),s=wr;for(;;){let u=(0,Oe.readdirSync)(a).map(c=>({value:c,label:c}));if(u.push({value:"..",label:".."}),s=await gt({message:"Select package.json file:",options:u}),le(s)&&(Jn("Operation cancelled."),(0,se.exit)(1)),!(0,Oe.statSync)((0,Rr.join)(a,s)).isDirectory()&&s!==wr){l.error("Selected a file that is not a package.json file");continue}if(a=(0,Rr.join)(a,s),s===wr)break}return await Ut(t,a),{dependencies:await vr(void 0,a),path:a}}let i=await Mt({message:"Enter path to node_modules folder:"});return le(i)&&(Jn("Operation cancelled."),(0,se.exit)(1)),(0,Oe.existsSync)(i)||(l.error(`Path ${i} does not exist`),(0,se.exit)(1)),{dependencies:await vr(void 0,i),path:i}}}return await Ut(t,e),{dependencies:await vr(void 0,e),path:e}}var Z7="https://capacitorjs.com/docs/updating/5-0",Q7="https://capacitorjs.com/docs/updating/6-0",eq="https://capacitorjs.com/docs/updating/7-0",tq="https://capacitorjs.com/docs/updating/8-0";async function rq(t,e,r){let n=nt(),o="1.0.0",i=!1,a=await ue({message:`Automatic Install "@capgo/capacitor-updater" dependency in ${r}?`});if(await Ze(a,t,e),a){let s=be(),u="latest",{dependencies:c,path:f}=await X7(3);s.start("Checking if @capgo/capacitor-updater is installed"),c.has("@capacitor/core")||(s.stop("Error"),l.warn("Cannot find @capacitor/core in package.json"),K(`Bye \u{1F44B}
288
290
  \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)());let d=c.get("@capacitor/core");if(d||(s.stop("Error"),l.warn("Cannot find @capacitor/core in package.json, please run `capgo init` in a capacitor project"),K(`Bye \u{1F44B}
289
291
  \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)()),d==="latest"?(s.stop(`@capacitor/core version is ${d}, make sure to use a proper version, using Latest as value is not recommended and will lead to unexpected behavior`),K(`Bye \u{1F44B}
290
- \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)()):Qt(ge(d),ge("5.0.0"))?(s.stop("Error"),l.warn(`@capacitor/core version is ${d}, Capgo only supports Capacitor v5 and above, please update to Capacitor v5 minimum: ${K7}`),K(`Bye \u{1F44B}
291
- \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)()):Qt(ge(d),ge("6.0.0"))?(l.info(`@capacitor/core version is ${d}, installing compatible capacitor-updater v5`),l.warn(`Consider upgrading to Capacitor v6 or higher to support the latest mobile OS features: ${G7}`),u="^5.0.0"):Qt(ge(d),ge("7.0.0"))?(l.info(`@capacitor/core version is ${d}, installing compatible capacitor-updater v6`),l.warn(`Consider upgrading to Capacitor v7 or higher to support the latest mobile OS features: ${W7}`),u="^6.0.0"):Qt(ge(d),ge("8.0.0"))?(l.info(`@capacitor/core version is ${d}, installing compatible capacitor-updater v7`),l.warn(`Consider upgrading to Capacitor v8 to support the latest mobile OS features: ${Y7}`),u="^7.0.0"):(l.info(`@capacitor/core version is ${d}, installing latest capacitor-updater v8+`),u="^8.0.0"),n.pm==="unknown"&&(s.stop("Error"),l.warn("Cannot recognize package manager, please run `capgo init` in a capacitor project with npm, pnpm, bun or yarn"),K(`Bye \u{1F44B}
292
- \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)()),await Hr("@capgo/capacitor-updater",f.replace("/package.json",""),f))s.stop("Capgo already installed \u2705");else{await(0,va.execSync)(`${n.installCommand} --force @capgo/capacitor-updater@${u}`,{..._y,cwd:f.replace("/package.json","")}),s.stop("Install Done \u2705"),o=Fr(void 0,f)||"1.0.0";let h=!1;u==="latest"&&(h=await ue({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 Xe(h,t,e)),s.start("Updating config file"),i=!!h;let m=h?{directUpdate:"always",autoSplashscreen:!0}:{};h&&await Ig("SplashScreen",{launchAutoHide:!1}),await $s({version:o,appId:r,autoUpdate:!0,...m}),s.stop("Config file updated \u2705")}}else l.info(`If you change your mind, run it for yourself with: "${n.installCommand} @capgo/capacitor-updater@latest"`);return await xt(t,e,"add-updater",r),{pkgVersion:o,delta:i}}async function X7(t,e,r){let n=await ue({message:`Automatic Add "${Ys}" code and import in ${r}?`});if(await Xe(n,t,e),n){let o=be();o.start("Adding @capacitor-updater to your main file");let i=await zl();if(i==="nuxtjs-js"||i==="nuxtjs-ts"){let a=(0,$r.join)("plugins");(0,Ae.existsSync)(a)||(0,Ae.mkdirSync)(a,{recursive:!0});let s;i==="nuxtjs-ts"?s=(0,$r.join)(a,"capacitorUpdater.client.ts"):s=(0,$r.join)(a,"capacitorUpdater.client.js");let u=`
292
+ \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)()):er(ge(d),ge("5.0.0"))?(s.stop("Error"),l.warn(`@capacitor/core version is ${d}, Capgo only supports Capacitor v5 and above, please update to Capacitor v5 minimum: ${Z7}`),K(`Bye \u{1F44B}
293
+ \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)()):er(ge(d),ge("6.0.0"))?(l.info(`@capacitor/core version is ${d}, installing compatible capacitor-updater v5`),l.warn(`Consider upgrading to Capacitor v6 or higher to support the latest mobile OS features: ${Q7}`),u="^5.0.0"):er(ge(d),ge("7.0.0"))?(l.info(`@capacitor/core version is ${d}, installing compatible capacitor-updater v6`),l.warn(`Consider upgrading to Capacitor v7 or higher to support the latest mobile OS features: ${eq}`),u="^6.0.0"):er(ge(d),ge("8.0.0"))?(l.info(`@capacitor/core version is ${d}, installing compatible capacitor-updater v7`),l.warn(`Consider upgrading to Capacitor v8 to support the latest mobile OS features: ${tq}`),u="^7.0.0"):(l.info(`@capacitor/core version is ${d}, installing latest capacitor-updater v8+`),u="^8.0.0"),n.pm==="unknown"&&(s.stop("Error"),l.warn("Cannot recognize package manager, please run `capgo init` in a capacitor project with npm, pnpm, bun or yarn"),K(`Bye \u{1F44B}
294
+ \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)()),await Kr("@capgo/capacitor-updater",f.replace("/package.json",""),f))s.stop("Capgo already installed \u2705");else{await(0,Ca.execSync)(`${n.installCommand} --force @capgo/capacitor-updater@${u}`,{...Py,cwd:f.replace("/package.json","")}),s.stop("Install Done \u2705"),o=Ir(void 0,f)||"1.0.0";let h=!1;u==="latest"&&(h=await ue({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 Ze(h,t,e)),s.start("Updating config file"),i=!!h;let m=h?{directUpdate:"always",autoSplashscreen:!0}:{};h&&await Lg("SplashScreen",{launchAutoHide:!1}),await Is({version:o,appId:r,autoUpdate:!0,...m}),s.stop("Config file updated \u2705")}}else l.info(`If you change your mind, run it for yourself with: "${n.installCommand} @capgo/capacitor-updater@latest"`);return await At(t,e,"add-updater",r),{pkgVersion:o,delta:i}}async function nq(t,e,r){let n=await ue({message:`Automatic Add "${Qs}" code and import in ${r}?`});if(await Ze(n,t,e),n){let o=be();o.start("Adding @capacitor-updater to your main file");let i=await Yl();if(i==="nuxtjs-js"||i==="nuxtjs-ts"){let a=(0,Rr.join)("plugins");(0,Oe.existsSync)(a)||(0,Oe.mkdirSync)(a,{recursive:!0});let s;i==="nuxtjs-ts"?s=(0,Rr.join)(a,"capacitorUpdater.client.ts"):s=(0,Rr.join)(a,"capacitorUpdater.client.js");let u=`
293
295
  import { CapacitorUpdater } from '@capgo/capacitor-updater'
294
296
 
295
297
  export default defineNuxtPlugin(() => {
296
298
  CapacitorUpdater.notifyAppReady()
297
299
  })
298
- `;(0,Ae.existsSync)(s)?(0,Ae.readFileSync)(s,"utf8").includes("CapacitorUpdater.notifyAppReady()")?(o.stop("Code already added to capacitorUpdater.client.ts file inside plugins directory \u2705"),l.info("Plugins directory and capacitorUpdater.client.ts file already exist with required code")):((0,Ae.writeFileSync)(s,u,"utf8"),o.stop("Code added to capacitorUpdater.client.ts file inside plugins directory \u2705"),l.info("Updated capacitorUpdater.client.ts file with required code")):((0,Ae.writeFileSync)(s,u,"utf8"),o.stop("Code added to capacitorUpdater.client.ts file inside plugins directory \u2705"),l.info("Created plugins directory and capacitorUpdater.client.ts file"))}else{let a;if(i==="unknown")a=await HA();else{let d=i.endsWith("-ts");a=await qA(i,d)}if(!a||!(0,Ae.existsSync)(a)){o.stop("Cannot find main file to install Updater plugin");let d=await Ut({message:"Provide the correct relative path to your main file (JS or TS):",validate:p=>{if(!(0,Ae.existsSync)(p))return"File does not exist. Please provide a valid path."}});le(d)&&(Wn("Operation cancelled."),(0,se.exit)(1)),a=d}let u=(0,Ae.readFileSync)(a,"utf8").toString(),f=u.match(j7)?.pop();if(f)if(u.includes(Ys))o.stop(`Code already added to ${a} \u2705`);else{let d=u.replace(f,`${f}
299
- ${Ey};
300
+ `;(0,Oe.existsSync)(s)?(0,Oe.readFileSync)(s,"utf8").includes("CapacitorUpdater.notifyAppReady()")?(o.stop("Code already added to capacitorUpdater.client.ts file inside plugins directory \u2705"),l.info("Plugins directory and capacitorUpdater.client.ts file already exist with required code")):((0,Oe.writeFileSync)(s,u,"utf8"),o.stop("Code added to capacitorUpdater.client.ts file inside plugins directory \u2705"),l.info("Updated capacitorUpdater.client.ts file with required code")):((0,Oe.writeFileSync)(s,u,"utf8"),o.stop("Code added to capacitorUpdater.client.ts file inside plugins directory \u2705"),l.info("Created plugins directory and capacitorUpdater.client.ts file"))}else{let a;if(i==="unknown")a=await WA();else{let d=i.endsWith("-ts");a=await GA(i,d)}if(!a||!(0,Oe.existsSync)(a)){o.stop("Cannot find main file to install Updater plugin");let d=await Mt({message:"Provide the correct relative path to your main file (JS or TS):",validate:p=>{if(!(0,Oe.existsSync)(p))return"File does not exist. Please provide a valid path."}});le(d)&&(Jn("Operation cancelled."),(0,se.exit)(1)),a=d}let u=(0,Oe.readFileSync)(a,"utf8").toString(),f=u.match(z7)?.pop();if(f)if(u.includes(Qs))o.stop(`Code already added to ${a} \u2705`);else{let d=u.replace(f,`${f}
301
+ ${Fy};
300
302
 
301
- ${Ys};
302
- `);(0,Ae.writeFileSync)(a,d,"utf8"),o.stop(`Code added to ${a} \u2705`)}else{o.stop("Cannot auto-inject code"),l.warn(`\u274C Cannot find import statements in ${a}`),l.info("\u{1F4A1} You'll need to add the code manually"),l.info("\u{1F4DD} Add this to your main file:"),l.info(` ${Ey}`),l.info(` ${Ys}`),l.info("\u{1F4DA} Or follow: https://capgo.app/docs/getting-started/add-an-app/");let d=await ue({message:"Continue without auto-injecting the code? (You'll add it manually)"});await Xe(d,t,e),d||(K(`Bye \u{1F44B}
303
- \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)()),l.info("\u23ED\uFE0F Skipping auto-injection - remember to add the code manually!"),await xt(t,e,"add-code-manual",r)}}await xt(t,e,"add-code",r)}else l.info(`Add to your main file the following code:
303
+ ${Qs};
304
+ `);(0,Oe.writeFileSync)(a,d,"utf8"),o.stop(`Code added to ${a} \u2705`)}else{o.stop("Cannot auto-inject code"),l.warn(`\u274C Cannot find import statements in ${a}`),l.info("\u{1F4A1} You'll need to add the code manually"),l.info("\u{1F4DD} Add this to your main file:"),l.info(` ${Fy}`),l.info(` ${Qs}`),l.info("\u{1F4DA} Or follow: https://capgo.app/docs/getting-started/add-an-app/");let d=await ue({message:"Continue without auto-injecting the code? (You'll add it manually)"});await Ze(d,t,e),d||(K(`Bye \u{1F44B}
305
+ \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)()),l.info("\u23ED\uFE0F Skipping auto-injection - remember to add the code manually!"),await At(t,e,"add-code-manual",r)}}await At(t,e,"add-code",r)}else l.info(`Add to your main file the following code:
304
306
 
305
- ${Ey};
307
+ ${Fy};
306
308
 
307
- ${Ys};
308
- `)}async function Z7(t,e,r){let o=(await br()).get("@capacitor/core");o||l.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=rt();l.info("\u{1F510} End-to-end encryption"),l.info(" \u2705 Use this for: Banking, healthcare, or apps with legal encryption requirements"),l.info(" \u26A0\uFE0F Note: Makes debugging harder - skip if you don't need it");let a=await ue({message:`Enable end-to-end encryption for ${r} updates?`,initialValue:!1});if(await Xe(a,t,e),a){if(o==="latest"){l.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&&Qt(ge(o),ge("6.0.0"))){l.warn("Encryption is not supported in Capacitor V5.");return}let s=be();s.start(`Running: ${i.runner} @capgo/cli@latest key create`),await wy({force:!0},!1)?s.stop("key created \u{1F511}"):(s.stop("Error"),l.warn("Cannot create key \u274C"),K("Bye \u{1F44B}"),(0,se.exit)(1));try{await Yl(!0,t,e),vt("onboarding-v2",t,e,"Use encryption v2",r)}catch(c){if(!(c instanceof Error&&c.message==="Capacitor sync cancelled"))throw c}}await xt(t,e,"add-encryption",r)}async function Q7(t,e,r,n){let o=rt(),i=await ue({message:`Automatic build ${r} with "${o.pm} run build" ?`});if(await Xe(i,t,e),i){let a=be();a.start("Checking project type");let s=await zl(),u=await Rg(s);if(a.message(`Running: ${o.pm} run ${u} && ${o.runner} cap sync ${n}`),!$g()[u]){a.stop("Missing build script"),l.warn(`\u274C Cannot find "${u}" script in package.json`),l.info(`\u{1F4A1} Your package.json needs a "${u}" script to build the app`);let f=await ue({message:"Would you like to skip the build for now and continue? You can build manually later."});if(await Xe(f,t,e),f){l.info(`\u23ED\uFE0F Skipping build step - you can build manually with: ${o.pm} run ${u}`),l.info(`\u{1F4DD} After building, run: ${o.runner} cap sync ${n}`),await xt(t,e,"build-project-skipped",r);return}K(`Bye \u{1F44B}
309
- \u{1F4A1} Add a "${u}" script to package.json and run the command again`),(0,se.exit)()}(0,va.execSync)(`${o.pm} run ${u} && ${o.runner} cap sync ${n}`,_y),a.stop("Build & Sync Done \u2705")}else l.info(`Build yourself with command: ${o.pm} run build && ${o.runner} cap sync ${n}`);await xt(t,e,"build-project",r)}async function eq(t,e){l.info("\u{1F4F1} Platform selection for onboarding"),l.info(" This is just for testing during onboarding - your app will work on all platforms");let r=await mt({message:"Which platform do you want to test with during this onboarding?",options:[{value:"ios",label:"IOS"},{value:"android",label:"Android"}]});le(r)&&(await vt("onboarding-v2",t,e,"canceled","\u{1F937}"),K(`Bye \u{1F44B}
310
- \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)());let n=r;return l.info(`\u{1F3AF} Testing with: ${n.toUpperCase()}`),l.info(`\u{1F4A1} Note: Onboarding builds will use ${n} only`),await xt(t,e,"select-platform",n),n}async function tq(t,e,r,n){let o=rt(),i=await ue({message:`Run ${r} on ${n.toUpperCase()} device now to test the initial version?`});if(await Xe(i,t,e),i){let a=be();a.start(`Running: ${o.runner} cap run ${n}`),await(0,va.spawnSync)(o.runner,["cap","run",n],{stdio:"inherit"}),a.stop("App started \u2705"),l.info(`\u{1F4F1} Your app should now be running on your ${n} device with Capgo integrated`),l.info("\u{1F504} This is your baseline version - we'll create an update next")}else l.info(`If you change your mind, run it for yourself with: ${o.runner} cap run ${n}`);await xt(t,e,"run-device",r)}async function rq(t,e,r,n,o){l.info("\u{1F3AF} Now let's test Capgo by making a visible change and deploying an update!");let i=await mt({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(le(i)&&(await vt("onboarding-v2",t,e,"canceled","\u{1F937}"),K(`Bye \u{1F44B}
311
- \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)()),i==="auto"){let d=be();d.start("Making automatic changes to test Capgo updates");let p=!1,h=["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 m of h)if((0,Ae.existsSync)(m)&&!p)try{let y=(0,Ae.readFileSync)(m,"utf8"),D=y;if(m.endsWith(".html")?y.includes("<body>")&&!y.includes("capgo-test-banner")&&(D=y.replace("<body>",`<body>
309
+ ${Qs};
310
+ `)}async function oq(t,e,r){let o=(await vr()).get("@capacitor/core");o||l.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=nt();l.info("\u{1F510} End-to-end encryption"),l.info(" \u2705 Use this for: Banking, healthcare, or apps with legal encryption requirements"),l.info(" \u26A0\uFE0F Note: Makes debugging harder - skip if you don't need it");let a=await ue({message:`Enable end-to-end encryption for ${r} updates?`,initialValue:!1});if(await Ze(a,t,e),a){if(o==="latest"){l.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&&er(ge(o),ge("6.0.0"))){l.warn("Encryption is not supported in Capacitor V5.");return}let s=be();s.start(`Running: ${i.runner} @capgo/cli@latest key create`),await xy({force:!0},!1)?s.stop("key created \u{1F511}"):(s.stop("Error"),l.warn("Cannot create key \u274C"),K("Bye \u{1F44B}"),(0,se.exit)(1));try{await Ql(!0,t,e),Ct("onboarding-v2",t,e,"Use encryption v2",r)}catch(c){if(!(c instanceof Error&&c.message==="Capacitor sync cancelled"))throw c}}await At(t,e,"add-encryption",r)}async function iq(t,e,r,n){let o=nt(),i=await ue({message:`Automatic build ${r} with "${o.pm} run build" ?`});if(await Ze(i,t,e),i){let a=be();a.start("Checking project type");let s=await Yl(),u=await Ug(s);if(a.message(`Running: ${o.pm} run ${u} && ${o.runner} cap sync ${n}`),!Ng()[u]){a.stop("Missing build script"),l.warn(`\u274C Cannot find "${u}" script in package.json`),l.info(`\u{1F4A1} Your package.json needs a "${u}" script to build the app`);let f=await ue({message:"Would you like to skip the build for now and continue? You can build manually later."});if(await Ze(f,t,e),f){l.info(`\u23ED\uFE0F Skipping build step - you can build manually with: ${o.pm} run ${u}`),l.info(`\u{1F4DD} After building, run: ${o.runner} cap sync ${n}`),await At(t,e,"build-project-skipped",r);return}K(`Bye \u{1F44B}
311
+ \u{1F4A1} Add a "${u}" script to package.json and run the command again`),(0,se.exit)()}(0,Ca.execSync)(`${o.pm} run ${u} && ${o.runner} cap sync ${n}`,Py),a.stop("Build & Sync Done \u2705")}else l.info(`Build yourself with command: ${o.pm} run build && ${o.runner} cap sync ${n}`);await At(t,e,"build-project",r)}async function aq(t,e){l.info("\u{1F4F1} Platform selection for onboarding"),l.info(" This is just for testing during onboarding - your app will work on all platforms");let r=await gt({message:"Which platform do you want to test with during this onboarding?",options:[{value:"ios",label:"IOS"},{value:"android",label:"Android"}]});le(r)&&(await Ct("onboarding-v2",t,e,"canceled","\u{1F937}"),K(`Bye \u{1F44B}
312
+ \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)());let n=r;return l.info(`\u{1F3AF} Testing with: ${n.toUpperCase()}`),l.info(`\u{1F4A1} Note: Onboarding builds will use ${n} only`),await At(t,e,"select-platform",n),n}async function sq(t,e,r,n){let o=nt(),i=await ue({message:`Run ${r} on ${n.toUpperCase()} device now to test the initial version?`});if(await Ze(i,t,e),i){let a=be();a.start(`Running: ${o.runner} cap run ${n}`),await(0,Ca.spawnSync)(o.runner,["cap","run",n],{stdio:"inherit"}),a.stop("App started \u2705"),l.info(`\u{1F4F1} Your app should now be running on your ${n} device with Capgo integrated`),l.info("\u{1F504} This is your baseline version - we'll create an update next")}else l.info(`If you change your mind, run it for yourself with: ${o.runner} cap run ${n}`);await At(t,e,"run-device",r)}async function uq(t,e,r,n,o){l.info("\u{1F3AF} Now let's test Capgo by making a visible change and deploying an update!");let i=await gt({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(le(i)&&(await Ct("onboarding-v2",t,e,"canceled","\u{1F937}"),K(`Bye \u{1F44B}
313
+ \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)()),i==="auto"){let d=be();d.start("Making automatic changes to test Capgo updates");let p=!1,h=["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 m of h)if((0,Oe.existsSync)(m)&&!p)try{let y=(0,Oe.readFileSync)(m,"utf8"),D=y;if(m.endsWith(".html")?y.includes("<body>")&&!y.includes("capgo-test-banner")&&(D=y.replace("<body>",`<body>
312
314
  <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));">
313
315
  \u{1F680} Capgo Update Test - This banner shows the update worked!
314
316
  </div>
@@ -323,122 +325,122 @@ body {
323
325
  /* capgo-test-background */
324
326
  }
325
327
 
326
- ${y}`)),D!==y){(0,Ae.writeFileSync)(m,D,"utf8"),d.stop(`\u2705 Made test changes to ${m}`),l.info("\u{1F4DD} Added visible test modification to verify the update works"),p=!0;break}}catch{}if(!p){d.stop("\u26A0\uFE0F Could not automatically modify files"),l.warn("Please make a visible change manually (like editing a text or color)");let m=await ue({message:"Continue after making your changes?"});await Xe(m,t,e)}}else{l.info("\u270B Please make a visible change to your app now (example: change a text, color, or add an element)"),l.info("\u{1F4A1} This change will help you see that Capgo updates work correctly");let d=await ue({message:"Have you made your changes and ready to continue?"});await Xe(d,t,e)}let a="1.0.1";try{let d=ge(n);a=qt(_n(d,"patch"))}catch{a="1.0.1"}let s=await mt({message:"How do you want to handle the version for this update?",options:[{value:"auto",label:`Auto: Bump patch version (${n} \u2192 ${a})`},{value:"manual",label:"Manual: I'll provide the version number"}]});le(s)&&(await vt("onboarding-v2",t,e,"canceled","\u{1F937}"),K(`Bye \u{1F44B}
327
- \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)());let u=n;if(s==="auto")try{let d=ge(n);u=qt(_n(d,"patch")),l.info(`\u{1F522} Auto-bumped version from ${n} to ${u}`)}catch{u="1.0.1",l.warn(`Could not parse version ${n}, using fallback ${u}`)}else{let d=await Ut({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)"}});le(d)&&(await vt("onboarding-v2",t,e,"canceled","\u{1F937}"),K(`Bye \u{1F44B}
328
- \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)()),u=d}let c=rt(),f=await ue({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 Xe(f,t,e),f){let d=be();d.start("Checking project type");let p=await zl(),h=await Rg(p);if(d.message(`Running: ${c.pm} run ${h} && ${c.runner} cap sync ${o}`),$g()[h])(0,va.execSync)(`${c.pm} run ${h} && ${c.runner} cap sync ${o}`,_y),d.stop("\u2705 Build with changes completed"),l.info("\u{1F4E6} Your modifications have been built and synced");else{d.stop("Missing build script"),l.warn(`\u274C Cannot find "${h}" script in package.json`),l.info("\u{1F4A1} Build manually in another terminal, then come back and continue");let y=await ue({message:"Have you built the app manually? (If not, we'll skip the build)"});await Xe(y,t,e),y?l.info("\u2705 Great! Continuing with your manual build"):(l.warn("\u26A0\uFE0F Continuing without build - upload may fail if app isn't built"),l.info(`\u{1F4A1} Build with: ${c.pm} run ${h} && ${c.runner} cap sync ${o}`))}}else l.info(`Build yourself with command: ${c.pm} run build && ${c.runner} cap sync ${o}`);return await xt(t,e,"add-code-change",r),u}async function nq(t,e,r,n,o){let i=rt(),a=await ue({message:`Upload the updated ${r} bundle (v${n}) to Capgo?`});if(await Xe(a,t,e),a){let s=be(),u;s.start(`Running: ${i.runner} @capgo/cli@latest bundle upload ${o?"--delta-only":""}`);let c=IA((0,se.cwd)());Kn&&c&&(l.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"),l.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,$r.join)(Dt((0,se.cwd)()),"node_modules"),l.warn(`Guessed node modules path at: ${u}`),(0,Ae.existsSync)(u)||(l.error("Node modules path does not exist, upload skipped"),K(`Bye \u{1F44B}
329
- \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)(1))),(await Ef(r,{channel:Js,apikey:e,packageJson:c?Kn:void 0,nodeModules:c?u:void 0,deltaOnly:o,bundle:n},!1))?.success?(s.stop(`\u2705 Update v${n} uploaded successfully!`),l.info("\u{1F389} Your updated bundle is now available on Capgo")):(s.stop("Error"),l.warn("Upload failed \u274C"),K(`Bye \u{1F44B}
330
- \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)())}else l.info(`Upload yourself with command: ${i.runner} @capgo/cli@latest bundle upload`);await xt(t,e,"upload",r)}async function oq(t,e,r,n,o){l.info("\u{1F9EA} Time to test the Capgo update system!"),l.info("\u{1F4F1} Go to your device where the app is running"),o?(l.info("\u{1F504} IMPORTANT: Background your app (swipe up/press home button) and then reopen it"),l.info("\u23F1\uFE0F The update should be downloaded and applied automatically")):(l.info("\u{1F4F1} With standard updates, you will need to:"),l.info(" 1. Background the app (swipe up/press home button) to start download"),l.info(" 2. Wait a few seconds for download to complete"),l.info(" 3. Background and foreground again to see the update")),l.info("\u{1F440} You should see your changes appear in the app!");let i=await ue({message:"Monitor Capgo logs to verify the update worked?"});await Xe(i,t,e),i?(l.info(`\u{1F4CA} Watching logs from ${r}...`),l.info("\u{1F504} Please background and reopen your app now to trigger the update"),await pm("onboarding-v2",e,r,e,t)):l.info(`\u{1F4CA} Check logs manually at ${n}/app/${r}/logs to verify the update`),await xt(t,e,"test-update",r)}async function r2(t,e,r){let n=rt();ee("Capgo onboarding \u{1F6EB}"),await Ee();let o=!r.supaAnon||!r.supaHost?await te():await $s({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 mr();e=pe(e,o?.config),r.apikey=t||ne(),e===void 0&&(e=await Ut({message:"Enter your appId:"}),le(e)&&(Wn("Operation cancelled."),(0,se.exit)(1)));let a=be();(!QF()||t)&&(a.start(`Running: ${n.runner} @capgo/cli@latest login ***`),await Cy(r.apikey,r,!1),a.stop("Login Done \u2705"));let s=await re(r.apikey,r.supaHost,r.supaAnon);await ae(s,r.apikey,["upload","all","read","write"]);let u=await ua(s,["admin","super_admin"]),c=u.gid,f=await U7(c,r.apikey)??0,d=Fr(void 0,Kn)||"1.0.0",p=!1,h=d,m="ios";try{if(f<1&&(await q7(c,r.apikey),jt(1)),f<2&&(e=await H7(u,r.apikey,e,r),jt(2)),f<3&&(await V7(c,r.apikey,e),jt(3)),f<4){let y=await J7(c,r.apikey,e);d=y.pkgVersion,h=d,p=y.delta,jt(4)}f<5&&(await X7(c,r.apikey,e),jt(5)),f<6&&(await Z7(c,r.apikey,e),jt(6)),f<7&&(m=await eq(c,r.apikey),jt(7)),f<8&&(await Q7(c,r.apikey,e,m),jt(8)),f<9&&(await tq(c,r.apikey,e,m),jt(9)),f<10&&(h=await rq(c,r.apikey,e,d,m),jt(10)),f<11&&(await nq(c,r.apikey,e,h,p),jt(11)),f<12&&(await oq(c,r.apikey,e,i.hostWeb,p),jt(12)),f<13&&jt(13),await xt(c,r.apikey,"done",e),M7()}catch(y){console.error(y),l.error(`Error during onboarding.
328
+ ${y}`)),D!==y){(0,Oe.writeFileSync)(m,D,"utf8"),d.stop(`\u2705 Made test changes to ${m}`),l.info("\u{1F4DD} Added visible test modification to verify the update works"),p=!0;break}}catch{}if(!p){d.stop("\u26A0\uFE0F Could not automatically modify files"),l.warn("Please make a visible change manually (like editing a text or color)");let m=await ue({message:"Continue after making your changes?"});await Ze(m,t,e)}}else{l.info("\u270B Please make a visible change to your app now (example: change a text, color, or add an element)"),l.info("\u{1F4A1} This change will help you see that Capgo updates work correctly");let d=await ue({message:"Have you made your changes and ready to continue?"});await Ze(d,t,e)}let a="1.0.1";try{let d=ge(n);a=Ht(An(d,"patch"))}catch{a="1.0.1"}let s=await gt({message:"How do you want to handle the version for this update?",options:[{value:"auto",label:`Auto: Bump patch version (${n} \u2192 ${a})`},{value:"manual",label:"Manual: I'll provide the version number"}]});le(s)&&(await Ct("onboarding-v2",t,e,"canceled","\u{1F937}"),K(`Bye \u{1F44B}
329
+ \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)());let u=n;if(s==="auto")try{let d=ge(n);u=Ht(An(d,"patch")),l.info(`\u{1F522} Auto-bumped version from ${n} to ${u}`)}catch{u="1.0.1",l.warn(`Could not parse version ${n}, using fallback ${u}`)}else{let d=await Mt({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)"}});le(d)&&(await Ct("onboarding-v2",t,e,"canceled","\u{1F937}"),K(`Bye \u{1F44B}
330
+ \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)()),u=d}let c=nt(),f=await ue({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 Ze(f,t,e),f){let d=be();d.start("Checking project type");let p=await Yl(),h=await Ug(p);if(d.message(`Running: ${c.pm} run ${h} && ${c.runner} cap sync ${o}`),Ng()[h])(0,Ca.execSync)(`${c.pm} run ${h} && ${c.runner} cap sync ${o}`,Py),d.stop("\u2705 Build with changes completed"),l.info("\u{1F4E6} Your modifications have been built and synced");else{d.stop("Missing build script"),l.warn(`\u274C Cannot find "${h}" script in package.json`),l.info("\u{1F4A1} Build manually in another terminal, then come back and continue");let y=await ue({message:"Have you built the app manually? (If not, we'll skip the build)"});await Ze(y,t,e),y?l.info("\u2705 Great! Continuing with your manual build"):(l.warn("\u26A0\uFE0F Continuing without build - upload may fail if app isn't built"),l.info(`\u{1F4A1} Build with: ${c.pm} run ${h} && ${c.runner} cap sync ${o}`))}}else l.info(`Build yourself with command: ${c.pm} run build && ${c.runner} cap sync ${o}`);return await At(t,e,"add-code-change",r),u}async function cq(t,e,r,n,o){let i=nt(),a=await ue({message:`Upload the updated ${r} bundle (v${n}) to Capgo?`});if(await Ze(a,t,e),a){let s=be(),u;s.start(`Running: ${i.runner} @capgo/cli@latest bundle upload ${o?"--delta-only":""}`);let c=LA((0,se.cwd)());Wn&&c&&(l.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"),l.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,Rr.join)(bt((0,se.cwd)()),"node_modules"),l.warn(`Guessed node modules path at: ${u}`),(0,Oe.existsSync)(u)||(l.error("Node modules path does not exist, upload skipped"),K(`Bye \u{1F44B}
331
+ \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)(1))),(await Af(r,{channel:eu,apikey:e,packageJson:c?Wn:void 0,nodeModules:c?u:void 0,deltaOnly:o,bundle:n},!1))?.success?(s.stop(`\u2705 Update v${n} uploaded successfully!`),l.info("\u{1F389} Your updated bundle is now available on Capgo")):(s.stop("Error"),l.warn("Upload failed \u274C"),K(`Bye \u{1F44B}
332
+ \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)())}else l.info(`Upload yourself with command: ${i.runner} @capgo/cli@latest bundle upload`);await At(t,e,"upload",r)}async function lq(t,e,r,n,o){l.info("\u{1F9EA} Time to test the Capgo update system!"),l.info("\u{1F4F1} Go to your device where the app is running"),o?(l.info("\u{1F504} IMPORTANT: Background your app (swipe up/press home button) and then reopen it"),l.info("\u23F1\uFE0F The update should be downloaded and applied automatically")):(l.info("\u{1F4F1} With standard updates, you will need to:"),l.info(" 1. Background the app (swipe up/press home button) to start download"),l.info(" 2. Wait a few seconds for download to complete"),l.info(" 3. Background and foreground again to see the update")),l.info("\u{1F440} You should see your changes appear in the app!");let i=await ue({message:"Monitor Capgo logs to verify the update worked?"});await Ze(i,t,e),i?(l.info(`\u{1F4CA} Watching logs from ${r}...`),l.info("\u{1F504} Please background and reopen your app now to trigger the update"),await Dm("onboarding-v2",e,r,e,t)):l.info(`\u{1F4CA} Check logs manually at ${n}/app/${r}/logs to verify the update`),await At(t,e,"test-update",r)}async function s2(t,e,r){let n=nt();ee("Capgo onboarding \u{1F6EB}"),await Ee();let o=!r.supaAnon||!r.supaHost?await te():await Is({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 yr();e=fe(e,o?.config),r.apikey=t||ne(),e===void 0&&(e=await Mt({message:"Enter your appId:"}),le(e)&&(Jn("Operation cancelled."),(0,se.exit)(1)));let a=be();(!o2()||t)&&(a.start(`Running: ${n.runner} @capgo/cli@latest login ***`),await Oy(r.apikey,r,!1),a.stop("Login Done \u2705"));let s=await re(r.apikey,r.supaHost,r.supaAnon);await ae(s,r.apikey,["upload","all","read","write"]);let u=await ua(s,["admin","super_admin"]),c=u.gid,f=await K7(c,r.apikey)??0,d=Ir(void 0,Wn)||"1.0.0",p=!1,h=d,m="ios";try{if(f<1&&(await W7(c,r.apikey),Ut(1)),f<2&&(e=await Y7(u,r.apikey,e,r),Ut(2)),f<3&&(await J7(c,r.apikey,e),Ut(3)),f<4){let y=await rq(c,r.apikey,e);d=y.pkgVersion,h=d,p=y.delta,Ut(4)}f<5&&(await nq(c,r.apikey,e),Ut(5)),f<6&&(await oq(c,r.apikey,e),Ut(6)),f<7&&(m=await aq(c,r.apikey),Ut(7)),f<8&&(await iq(c,r.apikey,e,m),Ut(8)),f<9&&(await sq(c,r.apikey,e,m),Ut(9)),f<10&&(h=await uq(c,r.apikey,e,d,m),Ut(10)),f<11&&(await cq(c,r.apikey,e,h,p),Ut(11)),f<12&&(await lq(c,r.apikey,e,i.hostWeb,p),Ut(12)),f<13&&Ut(13),await At(c,r.apikey,"done",e),G7()}catch(y){console.error(y),l.error(`Error during onboarding.
331
333
  if the error persists please contact support@capgo.app
332
- Or use manual installation: https://capgo.app/docs/getting-started/add-an-app/`),(0,se.exit)(1)}l.info("Welcome onboard \u2708\uFE0F!"),l.info("Your Capgo update system is setup"),l.info(`Next time use \`${n.runner} @capgo/cli@latest bundle upload\` to only upload your bundle`),l.info(`If you have any issue try to use the debug command \`${n.runner} @capgo/cli@latest app debug\``),K("Bye \u{1F44B}"),(0,se.exit)()}async function iq(t,e=!1){e||ee("Adding organization"),await Ee();let r={...t,apikey:t.apikey||ne()};if(!r.apikey)throw e||l.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 ae(n,r.apikey,["write","all"]),{name:i,email:a}=r;if(!e&&!i){let c=await Ut({message:"Organization name:",placeholder:"My Organization"});if(le(c))throw l.error("Canceled adding organization"),new Error("Organization creation cancelled");i=c}if(!e&&!a){let c=await Ut({message:"Management email:",placeholder:"admin@example.com"});if(le(c))throw l.error("Canceled adding organization"),new Error("Organization creation cancelled");a=c}if(!i||!a)throw e||l.error("Missing arguments, you need to provide an organization name and management email"),new Error("Missing organization name or management email");e||l.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||l.error(`Could not add organization ${q(u)}`),new Error(`Could not add organization: ${q(u)}`);return await me(r.apikey,{channel:"organization",event:"Organization Created",icon:"\u{1F3E2}",user_id:s.id,tags:{"org-name":i},notify:!1}).catch(()=>{}),e||(l.success(`Organization "${i}" added to Capgo`),K("Done \u2705")),s}async function Sy(t){await iq(t,!1)}async function aq(t,e,r=!1){r||ee("Deleting organization"),await Ee();let n={...e,apikey:e.apikey||ne()};if(!n.apikey)throw r||l.error("Missing API key, you need to provide an API key to delete an organization"),new Error("Missing API key");if(!t)throw r||l.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 ae(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||l.error(`Cannot get organization details ${q(s)}`),new Error(`Cannot get organization details: ${q(s)}`);if(a.created_by!==i){if(r)throw new Error("Deleting an organization is restricted to the organization owner");l.warn("Deleting an organization is restricted to the organization owner"),l.warn("You are not the owner of this organization"),l.warn("It's strongly recommended that you do not continue!");let c=await mt({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(le(c)||c==="no")throw l.error("Canceled deleting the organization"),new Error("Organization deletion cancelled")}if(!r&&!n.autoConfirm){let c=await ue({message:`Are you sure you want to delete organization "${a.name}"? This action cannot be undone.`});if(le(c)||!c)throw l.error("Canceled deleting the organization"),new Error("Organization deletion cancelled")}r||l.info(`Deleting organization "${a.name}"`);let{error:u}=await o.from("orgs").delete().eq("id",t);if(u)throw r||l.error(`Could not delete organization ${q(u)}`),new Error(`Could not delete organization: ${q(u)}`);return await me(n.apikey,{channel:"organization",event:"Organization Deleted",icon:"\u{1F5D1}\uFE0F",user_id:t,tags:{"org-name":a.name},notify:!1}).catch(()=>{}),r||(l.success(`Organization "${a.name}" deleted from Capgo`),K("Done \u2705")),!0}async function xy(t,e){await aq(t,e,!1)}function sq(t,e){if(e)return;if(!t.length){l.error("No organizations found");return}let r=new st;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"]);l.success("Organizations"),l.success(r.toString())}async function uq(t,e=!1){e||ee("List organizations"),await Ee();let r={...t,apikey:t.apikey||ne()};if(!r.apikey)throw e||l.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 ae(n,r.apikey,["read","write","all"]),e||l.info("Getting organizations from Capgo");let{error:o,data:i}=await n.rpc("get_orgs_v6");if(o)throw e||l.error(`Cannot get organizations ${q(o)}`),new Error(`Cannot get organizations: ${q(o)}`);let a=i||[];return e||(l.info(`Organizations found: ${a.length}`),sq(a,e),K("Done \u2705")),a}async function Ay(t){await uq(t,!1)}async function cq(t,e,r=!1){r||ee("Updating organization"),await Ee();let n={...e,apikey:e.apikey||ne()};if(!n.apikey)throw r||l.error("Missing API key, you need to provide an API key to update an organization"),new Error("Missing API key");if(!t)throw r||l.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 ae(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||l.error(`Cannot get organization details ${q(a)}`),new Error(`Cannot get organization details: ${q(a)}`);let{name:s,email:u}=n;if(!r&&!s){let f=await Ut({message:"New organization name:",placeholder:i.name||"My Organization"});if(le(f))throw l.error("Canceled updating organization"),new Error("Organization update cancelled");s=f}if(!r&&!u){let f=await Ut({message:"Management email:",placeholder:i.management_email||"admin@example.com"});if(le(f))throw l.error("Canceled updating organization"),new Error("Organization update cancelled");u=f}if(!s||!u)throw r||l.error("Missing arguments, you need to provide an organization name and management email"),new Error("Missing organization name or management email");r||l.info(`Updating organization "${t}"`);let{error:c}=await o.from("orgs").update({name:s,management_email:u}).eq("id",t);if(c)throw r||l.error(`Could not update organization ${q(c)}`),new Error(`Could not update organization: ${q(c)}`);return await me(n.apikey,{channel:"organization",event:"Organization Updated",icon:"\u270F\uFE0F",user_id:t,tags:{"org-name":s},notify:!1}).catch(()=>{}),r||(l.success("Organization updated"),K("Done \u2705")),{orgId:t,name:s,email:u}}async function Oy(t,e){await cq(t,e,!1)}async function lq(t,e=!1){e||ee("Getting user id");let r={...t,apikey:t.apikey||ne()};if(!r.apikey)throw e||l.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 ae(n,r.apikey,["read","all","write"]);return e||K(`Done \u2705: ${o}`),o}catch(n){throw e||l.error(`Error getting user id ${q(n)}`),n instanceof Error?n:new Error(String(n))}}async function n2(t){await lq(t,!1)}var G={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 with detailed logging"};it.name(Cr.name).description("\u{1F4E6} Manage packages and bundle versions in Capgo Cloud").version(Cr.version,"-v, --version","output the current version");it.command("init [apikey] [appId]").alias("i").description(`\u{1F680} Initialize a new app in Capgo Cloud with step-by-step guidance.
334
+ Or use manual installation: https://capgo.app/docs/getting-started/add-an-app/`),(0,se.exit)(1)}l.info("Welcome onboard \u2708\uFE0F!"),l.info("Your Capgo update system is setup"),l.info(`Next time use \`${n.runner} @capgo/cli@latest bundle upload\` to only upload your bundle`),l.info(`If you have any issue try to use the debug command \`${n.runner} @capgo/cli@latest app debug\``),K("Bye \u{1F44B}"),(0,se.exit)()}async function fq(t,e=!1){e||ee("Adding organization"),await Ee();let r={...t,apikey:t.apikey||ne()};if(!r.apikey)throw e||l.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 ae(n,r.apikey,["write","all"]),{name:i,email:a}=r;if(!e&&!i){let c=await Mt({message:"Organization name:",placeholder:"My Organization"});if(le(c))throw l.error("Canceled adding organization"),new Error("Organization creation cancelled");i=c}if(!e&&!a){let c=await Mt({message:"Management email:",placeholder:"admin@example.com"});if(le(c))throw l.error("Canceled adding organization"),new Error("Organization creation cancelled");a=c}if(!i||!a)throw e||l.error("Missing arguments, you need to provide an organization name and management email"),new Error("Missing organization name or management email");e||l.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||l.error(`Could not add organization ${q(u)}`),new Error(`Could not add organization: ${q(u)}`);return await me(r.apikey,{channel:"organization",event:"Organization Created",icon:"\u{1F3E2}",user_id:s.id,tags:{"org-name":i},notify:!1}).catch(()=>{}),e||(l.success(`Organization "${i}" added to Capgo`),K("Done \u2705")),s}async function ky(t){await fq(t,!1)}async function dq(t,e,r=!1){r||ee("Deleting organization"),await Ee();let n={...e,apikey:e.apikey||ne()};if(!n.apikey)throw r||l.error("Missing API key, you need to provide an API key to delete an organization"),new Error("Missing API key");if(!t)throw r||l.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 ae(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||l.error(`Cannot get organization details ${q(s)}`),new Error(`Cannot get organization details: ${q(s)}`);if(a.created_by!==i){if(r)throw new Error("Deleting an organization is restricted to the organization owner");l.warn("Deleting an organization is restricted to the organization owner"),l.warn("You are not the owner of this organization"),l.warn("It's strongly recommended that you do not continue!");let c=await gt({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(le(c)||c==="no")throw l.error("Canceled deleting the organization"),new Error("Organization deletion cancelled")}if(!r&&!n.autoConfirm){let c=await ue({message:`Are you sure you want to delete organization "${a.name}"? This action cannot be undone.`});if(le(c)||!c)throw l.error("Canceled deleting the organization"),new Error("Organization deletion cancelled")}r||l.info(`Deleting organization "${a.name}"`);let{error:u}=await o.from("orgs").delete().eq("id",t);if(u)throw r||l.error(`Could not delete organization ${q(u)}`),new Error(`Could not delete organization: ${q(u)}`);return await me(n.apikey,{channel:"organization",event:"Organization Deleted",icon:"\u{1F5D1}\uFE0F",user_id:t,tags:{"org-name":a.name},notify:!1}).catch(()=>{}),r||(l.success(`Organization "${a.name}" deleted from Capgo`),K("Done \u2705")),!0}async function $y(t,e){await dq(t,e,!1)}function pq(t,e){if(e)return;if(!t.length){l.error("No organizations found");return}let r=new ut;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"]);l.success("Organizations"),l.success(r.toString())}async function hq(t,e=!1){e||ee("List organizations"),await Ee();let r={...t,apikey:t.apikey||ne()};if(!r.apikey)throw e||l.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 ae(n,r.apikey,["read","write","all"]),e||l.info("Getting organizations from Capgo");let{error:o,data:i}=await n.rpc("get_orgs_v6");if(o)throw e||l.error(`Cannot get organizations ${q(o)}`),new Error(`Cannot get organizations: ${q(o)}`);let a=i||[];return e||(l.info(`Organizations found: ${a.length}`),pq(a,e),K("Done \u2705")),a}async function Iy(t){await hq(t,!1)}async function mq(t,e,r=!1){r||ee("Updating organization"),await Ee();let n={...e,apikey:e.apikey||ne()};if(!n.apikey)throw r||l.error("Missing API key, you need to provide an API key to update an organization"),new Error("Missing API key");if(!t)throw r||l.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 ae(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||l.error(`Cannot get organization details ${q(a)}`),new Error(`Cannot get organization details: ${q(a)}`);let{name:s,email:u}=n;if(!r&&!s){let f=await Mt({message:"New organization name:",placeholder:i.name||"My Organization"});if(le(f))throw l.error("Canceled updating organization"),new Error("Organization update cancelled");s=f}if(!r&&!u){let f=await Mt({message:"Management email:",placeholder:i.management_email||"admin@example.com"});if(le(f))throw l.error("Canceled updating organization"),new Error("Organization update cancelled");u=f}if(!s||!u)throw r||l.error("Missing arguments, you need to provide an organization name and management email"),new Error("Missing organization name or management email");r||l.info(`Updating organization "${t}"`);let{error:c}=await o.from("orgs").update({name:s,management_email:u}).eq("id",t);if(c)throw r||l.error(`Could not update organization ${q(c)}`),new Error(`Could not update organization: ${q(c)}`);return await me(n.apikey,{channel:"organization",event:"Organization Updated",icon:"\u270F\uFE0F",user_id:t,tags:{"org-name":s},notify:!1}).catch(()=>{}),r||(l.success("Organization updated"),K("Done \u2705")),{orgId:t,name:s,email:u}}async function Ty(t,e){await mq(t,e,!1)}async function gq(t,e=!1){e||ee("Getting user id");let r={...t,apikey:t.apikey||ne()};if(!r.apikey)throw e||l.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 ae(n,r.apikey,["read","all","write"]);return e||K(`Done \u2705: ${o}`),o}catch(n){throw e||l.error(`Error getting user id ${q(n)}`),n instanceof Error?n:new Error(String(n))}}async function u2(t){await gq(t,!1)}var G={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 with detailed logging"};at.name(xr.name).description("\u{1F4E6} Manage packages and bundle versions in Capgo Cloud").version(xr.version,"-v, --version","output the current version");at.command("init [apikey] [appId]").alias("i").description(`\u{1F680} Initialize a new app in Capgo Cloud with step-by-step guidance.
333
335
 
334
336
  This includes adding code for updates, building, uploading your app, and verifying update functionality.
335
337
 
336
- Example: npx @capgo/cli@latest init YOUR_API_KEY com.example.app`).action(r2).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>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon);it.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.
338
+ Example: npx @capgo/cli@latest init YOUR_API_KEY com.example.app`).action(s2).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>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon);at.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.
337
339
 
338
340
  This command helps diagnose issues with your setup.
339
341
 
340
- Example: npx @capgo/cli@latest doctor`).option("--package-json <packageJson>",G.packageJson).action(async(...t)=>{let e=t.at(-1);await i1(e)});it.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.
342
+ Example: npx @capgo/cli@latest doctor`).option("--package-json <packageJson>",G.packageJson).action(async(...t)=>{let e=t.at(-1);await lO(e)});at.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.
341
343
 
342
344
  Use --apikey=******** in any command to override it.
343
345
 
344
- Example: npx @capgo/cli@latest login YOUR_API_KEY`).action(e2).option("--local","Only save in local folder, git ignored for security.").option("--supa-host <supaHost>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon);var Gn=it.command("bundle").description("\u{1F4E6} Manage app bundles for deployment in Capgo Cloud, including upload, compatibility checks, and encryption.");Gn.command("upload [appId]").alias("u").description(`\u2B06\uFE0F Upload a new app bundle to Capgo Cloud for distribution.
346
+ Example: npx @capgo/cli@latest login YOUR_API_KEY`).action(i2).option("--local","Only save in local folder, git ignored for security.").option("--supa-host <supaHost>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon);var Yn=at.command("bundle").description("\u{1F4E6} Manage app bundles for deployment in Capgo Cloud, including upload, compatibility checks, and encryption.");Yn.command("upload [appId]").alias("u").description(`\u2B06\uFE0F Upload a new app bundle to Capgo Cloud for distribution.
345
347
 
346
348
  Version must be > 0.0.0 and unique. Deleted versions cannot be reused for security.
347
349
 
348
350
  External option: Store only a URL link (useful for apps >200MB or privacy requirements).
349
351
  Capgo never inspects external content. Add encryption for trustless security.
350
352
 
351
- Example: npx @capgo/cli@latest bundle upload com.example.app --path ./dist --channel production`).action(Cf).option("-a, --apikey <apikey>",G.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>",G.packageJson).option("--node-modules <nodeModules>",G.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>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon).option("--verbose",G.verbose);Gn.command("compatibility [appId]").description(`\u{1F9EA} Check compatibility of a bundle with a specific channel in Capgo Cloud to ensure updates are safe.
353
+ Example: npx @capgo/cli@latest bundle upload com.example.app --path ./dist --channel production`).action(xf).option("-a, --apikey <apikey>",G.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>",G.packageJson).option("--node-modules <nodeModules>",G.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>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon).option("--verbose",G.verbose);Yn.command("compatibility [appId]").description(`\u{1F9EA} Check compatibility of a bundle with a specific channel in Capgo Cloud to ensure updates are safe.
352
354
 
353
- Example: npx @capgo/cli@latest bundle compatibility com.example.app --channel production`).action(T1).option("-a, --apikey <apikey>",G.apikey).option("-c, --channel <channel>","Channel to check the compatibility with").option("--text","Output text instead of emojis").option("--package-json <packageJson>",G.packageJson).option("--node-modules <nodeModules>",G.nodeModules).option("--supa-host <supaHost>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon);Gn.command("delete [bundleId] [appId]").alias("d").description(`\u{1F5D1}\uFE0F Delete a specific bundle from Capgo Cloud, optionally targeting a single version.
355
+ Example: npx @capgo/cli@latest bundle compatibility com.example.app --channel production`).action(jO).option("-a, --apikey <apikey>",G.apikey).option("-c, --channel <channel>","Channel to check the compatibility with").option("--text","Output text instead of emojis").option("--package-json <packageJson>",G.packageJson).option("--node-modules <nodeModules>",G.nodeModules).option("--supa-host <supaHost>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon);Yn.command("delete [bundleId] [appId]").alias("d").description(`\u{1F5D1}\uFE0F Delete a specific bundle from Capgo Cloud, optionally targeting a single version.
354
356
 
355
- Example: npx @capgo/cli@latest bundle delete BUNDLE_ID com.example.app`).action(async(t,e,r)=>{await q1(t,e,r)}).option("-a, --apikey <apikey>",G.apikey).option("--supa-host <supaHost>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon);Gn.command("list [appId]").alias("l").description(`\u{1F4CB} List all bundles uploaded for an app in Capgo Cloud.
357
+ Example: npx @capgo/cli@latest bundle delete BUNDLE_ID com.example.app`).action(async(t,e,r)=>{await GO(t,e,r)}).option("-a, --apikey <apikey>",G.apikey).option("--supa-host <supaHost>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon);Yn.command("list [appId]").alias("l").description(`\u{1F4CB} List all bundles uploaded for an app in Capgo Cloud.
356
358
 
357
- Example: npx @capgo/cli@latest bundle list com.example.app`).action(async(t,e)=>{await V1(t,e)}).option("-a, --apikey <apikey>",G.apikey).option("--supa-host <supaHost>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon);Gn.command("cleanup [appId]").alias("c").description(`\u{1F9F9} Delete old bundles in Capgo Cloud, keeping specified number of recent versions.
359
+ Example: npx @capgo/cli@latest bundle list com.example.app`).action(async(t,e)=>{await YO(t,e)}).option("-a, --apikey <apikey>",G.apikey).option("--supa-host <supaHost>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon);Yn.command("cleanup [appId]").alias("c").description(`\u{1F9F9} Delete old bundles in Capgo Cloud, keeping specified number of recent versions.
358
360
 
359
361
  Bundles linked to channels are preserved unless --ignore-channel is used.
360
362
 
361
- Example: npx @capgo/cli@latest bundle cleanup com.example.app --bundle=1.0 --keep=3`).action(async(t,e)=>{await I1(t,e)}).option("-b, --bundle <bundle>","Bundle version number of the app to delete").option("-a, --apikey <apikey>",G.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>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon);Gn.command("encrypt [zipPath] [checksum]").description(`\u{1F512} Encrypt a zip bundle for secure external storage.
363
+ Example: npx @capgo/cli@latest bundle cleanup com.example.app --bundle=1.0 --keep=3`).action(async(t,e)=>{await LO(t,e)}).option("-b, --bundle <bundle>","Bundle version number of the app to delete").option("-a, --apikey <apikey>",G.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>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon);Yn.command("encrypt [zipPath] [checksum]").description(`\u{1F512} Encrypt a zip bundle for secure external storage.
362
364
 
363
365
  Returns ivSessionKey for upload/decryption. Get checksum using 'bundle zip --json'.
364
366
 
365
- Example: npx @capgo/cli@latest bundle encrypt ./myapp.zip CHECKSUM`).action(H1).option("--key <key>","Custom path for private signing key").option("--key-data <keyData>","Private signing key").option("-j, --json","Output in JSON");Gn.command("decrypt [zipPath] [checksum]").description(`\u{1F513} Decrypt an encrypted bundle (mainly for testing).
367
+ Example: npx @capgo/cli@latest bundle encrypt ./myapp.zip CHECKSUM`).action(WO).option("--key <key>","Custom path for private signing key").option("--key-data <keyData>","Private signing key").option("-j, --json","Output in JSON");Yn.command("decrypt [zipPath] [checksum]").description(`\u{1F513} Decrypt an encrypted bundle (mainly for testing).
366
368
 
367
369
  Prints base64 session key for verification.
368
370
 
369
- Example: npx @capgo/cli@latest bundle decrypt ./myapp_encrypted.zip CHECKSUM`).action(M1).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");Gn.command("zip [appId]").description(`\u{1F5DC}\uFE0F Create a zip file of your app bundle.
371
+ Example: npx @capgo/cli@latest bundle decrypt ./myapp_encrypted.zip CHECKSUM`).action(KO).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");Yn.command("zip [appId]").description(`\u{1F5DC}\uFE0F Create a zip file of your app bundle.
370
372
 
371
373
  Returns checksum for use with encryption. Use --json for machine-readable output.
372
374
 
373
- Example: npx @capgo/cli@latest bundle zip com.example.app --path ./dist`).action(EF).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>",G.packageJson);var Ca=it.command("app").description("\u{1F4F1} Manage your Capgo app settings and configurations in Capgo Cloud.");Ca.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.
375
+ Example: npx @capgo/cli@latest bundle zip com.example.app --path ./dist`).action(OF).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>",G.packageJson);var Ea=at.command("app").description("\u{1F4F1} Manage your Capgo app settings and configurations in Capgo Cloud.");Ea.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.
374
376
 
375
377
  All options can be guessed from config if not provided.
376
378
 
377
- Example: npx @capgo/cli@latest app add com.example.app --name "My App" --icon ./icon.png`).action(t1).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>",G.apikey).option("--supa-host <supaHost>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon);Ca.command("delete [appId]").description(`\u{1F5D1}\uFE0F Delete an app from Capgo Cloud, optionally specifying a version to delete only that bundle.
379
+ Example: npx @capgo/cli@latest app add com.example.app --name "My App" --icon ./icon.png`).action(aO).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>",G.apikey).option("--supa-host <supaHost>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon);Ea.command("delete [appId]").description(`\u{1F5D1}\uFE0F Delete an app from Capgo Cloud, optionally specifying a version to delete only that bundle.
378
380
 
379
- Example: npx @capgo/cli@latest app delete com.example.app`).action(async(t,e)=>{await r1(t,e)}).option("-a, --apikey <apikey>",G.apikey).option("--supa-host <supaHost>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon);Ca.command("list").alias("l").description(`\u{1F4CB} List all apps registered under your account in Capgo Cloud.
381
+ Example: npx @capgo/cli@latest app delete com.example.app`).action(async(t,e)=>{await sO(t,e)}).option("-a, --apikey <apikey>",G.apikey).option("--supa-host <supaHost>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon);Ea.command("list").alias("l").description(`\u{1F4CB} List all apps registered under your account in Capgo Cloud.
380
382
 
381
- Example: npx @capgo/cli@latest app list`).action(async t=>{await a1(t)}).option("-a, --apikey <apikey>",G.apikey).option("--supa-host <supaHost>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon);Ca.command("debug [appId]").action(oE).description(`\u{1F41E} Listen for live update events in Capgo Cloud to debug your app.
383
+ Example: npx @capgo/cli@latest app list`).action(async t=>{await fO(t)}).option("-a, --apikey <apikey>",G.apikey).option("--supa-host <supaHost>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon);Ea.command("debug [appId]").action(cE).description(`\u{1F41E} Listen for live update events in Capgo Cloud to debug your app.
382
384
 
383
385
  Optionally target a specific device for detailed diagnostics.
384
386
 
385
- Example: npx @capgo/cli@latest app debug com.example.app --device DEVICE_ID`).option("-a, --apikey <apikey>",G.apikey).option("-d, --device <device>","The specific device ID to debug").option("--supa-host <supaHost>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon);Ca.command("setting [path]").description(`\u2699\uFE0F Modify Capacitor configuration programmatically.
387
+ Example: npx @capgo/cli@latest app debug com.example.app --device DEVICE_ID`).option("-a, --apikey <apikey>",G.apikey).option("-d, --device <device>","The specific device ID to debug").option("--supa-host <supaHost>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon);Ea.command("setting [path]").description(`\u2699\uFE0F Modify Capacitor configuration programmatically.
386
388
 
387
389
  Specify setting path (e.g., plugins.CapacitorUpdater.defaultChannel) with --string or --bool.
388
390
 
389
- 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(c1);Ca.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.
391
+ 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(hO);Ea.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.
390
392
 
391
393
  Retention of 0 means infinite storage.
392
394
 
393
- Example: npx @capgo/cli@latest app set com.example.app --name "Updated App" --retention 30`).action(async(t,e)=>{await u1(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>",G.apikey).option("-r, --retention <retention>","Days to keep old bundles (0 = infinite, default: 0)").option("--expose-metadata <exposeMetadata>","Expose bundle metadata (link and comment) to the plugin (true/false, default: false)").option("--supa-host <supaHost>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon);var Zs=it.command("channel").description("\u{1F4E2} Manage distribution channels for app updates in Capgo Cloud, controlling how updates are delivered to devices.");Zs.command("add [channelId] [appId]").alias("a").description(`\u2795 Create a new channel for app distribution in Capgo Cloud to manage update delivery.
395
+ Example: npx @capgo/cli@latest app set com.example.app --name "Updated App" --retention 30`).action(async(t,e)=>{await pO(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>",G.apikey).option("-r, --retention <retention>","Days to keep old bundles (0 = infinite, default: 0)").option("--expose-metadata <exposeMetadata>","Expose bundle metadata (link and comment) to the plugin (true/false, default: false)").option("--supa-host <supaHost>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon);var ru=at.command("channel").description("\u{1F4E2} Manage distribution channels for app updates in Capgo Cloud, controlling how updates are delivered to devices.");ru.command("add [channelId] [appId]").alias("a").description(`\u2795 Create a new channel for app distribution in Capgo Cloud to manage update delivery.
394
396
 
395
- Example: npx @capgo/cli@latest channel add production com.example.app --default`).action(_F).option("-d, --default","Set the channel as default").option("--self-assign","Allow device to self-assign to this channel").option("-a, --apikey <apikey>",G.apikey).option("--supa-host <supaHost>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon);Zs.command("delete [channelId] [appId]").alias("d").description(`\u{1F5D1}\uFE0F Delete a channel from Capgo Cloud, optionally removing associated bundles to free up resources.
397
+ Example: npx @capgo/cli@latest channel add production com.example.app --default`).action(FF).option("-d, --default","Set the channel as default").option("--self-assign","Allow device to self-assign to this channel").option("-a, --apikey <apikey>",G.apikey).option("--supa-host <supaHost>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon);ru.command("delete [channelId] [appId]").alias("d").description(`\u{1F5D1}\uFE0F Delete a channel from Capgo Cloud, optionally removing associated bundles to free up resources.
396
398
 
397
- 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>",G.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>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon);Zs.command("list [appId]").alias("l").description(`\u{1F4CB} List all channels configured for an app in Capgo Cloud to review distribution settings.
399
+ Example: npx @capgo/cli@latest channel delete production com.example.app`).action(async(t,e,r)=>{await kF(t,e,r)}).option("-a, --apikey <apikey>",G.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>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon);ru.command("list [appId]").alias("l").description(`\u{1F4CB} List all channels configured for an app in Capgo Cloud to review distribution settings.
398
400
 
399
- Example: npx @capgo/cli@latest channel list com.example.app`).action(async(t,e)=>{await AF(t,e)}).option("-a, --apikey <apikey>",G.apikey).option("--supa-host <supaHost>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon);Zs.command("currentBundle [channel] [appId]").description(`\u{1F4E6} Get the current bundle linked to a specific channel in Capgo Cloud for update tracking.
401
+ Example: npx @capgo/cli@latest channel list com.example.app`).action(async(t,e)=>{await $F(t,e)}).option("-a, --apikey <apikey>",G.apikey).option("--supa-host <supaHost>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon);ru.command("currentBundle [channel] [appId]").description(`\u{1F4E6} Get the current bundle linked to a specific channel in Capgo Cloud for update tracking.
400
402
 
401
- Example: npx @capgo/cli@latest channel currentBundle production com.example.app`).action(async(t,e,r)=>{await SF(t,e,r)}).option("-c, --channel <channel>","Channel to get the current bundle from").option("-a, --apikey <apikey>",G.apikey).option("--quiet","Only print the bundle version").option("--supa-host <supaHost>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon);Zs.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).
403
+ Example: npx @capgo/cli@latest channel currentBundle production com.example.app`).action(async(t,e,r)=>{await PF(t,e,r)}).option("-c, --channel <channel>","Channel to get the current bundle from").option("-a, --apikey <apikey>",G.apikey).option("--quiet","Only print the bundle version").option("--supa-host <supaHost>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon);ru.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).
402
404
 
403
405
  One channel must be default.
404
406
 
405
- Example: npx @capgo/cli@latest channel set production com.example.app --bundle 1.0.0 --state default`).action(async(t,e,r)=>{await FF(t,e,r)}).option("-a, --apikey <apikey>",G.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>",G.packageJson).option("--ignore-metadata-check","Ignore checking node_modules compatibility if present in the bundle").option("--supa-host <supaHost>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon);var Fy=it.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.");Fy.command("save").description(`\u{1F4BE} Save the public key in the Capacitor config, useful for CI environments.
407
+ Example: npx @capgo/cli@latest channel set production com.example.app --bundle 1.0.0 --state default`).action(async(t,e,r)=>{await TF(t,e,r)}).option("-a, --apikey <apikey>",G.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>",G.packageJson).option("--ignore-metadata-check","Ignore checking node_modules compatibility if present in the bundle").option("--supa-host <supaHost>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon);var Ry=at.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.");Ry.command("save").description(`\u{1F4BE} Save the public key in the Capacitor config, useful for CI environments.
406
408
 
407
409
  Recommended not to commit the key for security.
408
410
 
409
- Example: npx @capgo/cli@latest key save --key ./path/to/key.pub`).action(JF).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");Fy.command("create").description(`\u{1F528} Create RSA key pair for end-to-end encryption.
411
+ Example: npx @capgo/cli@latest key save --key ./path/to/key.pub`).action(t2).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");Ry.command("create").description(`\u{1F528} Create RSA key pair for end-to-end encryption.
410
412
 
411
413
  Creates .capgo_key_v2 (private) and .capgo_key_v2.pub (public) in project root.
412
414
  Public key is saved to capacitor.config for mobile app decryption.
413
415
  NEVER commit the private key - store it securely!
414
416
 
415
- Example: npx @capgo/cli@latest key create`).action(XF).option("-f, --force","Force generate a new one");Fy.command("delete_old").description(`\u{1F9F9} Delete the old encryption key from the Capacitor config to ensure only the current key is used.
417
+ Example: npx @capgo/cli@latest key create`).action(r2).option("-f, --force","Force generate a new one");Ry.command("delete_old").description(`\u{1F9F9} Delete the old encryption key from the Capacitor config to ensure only the current key is used.
416
418
 
417
- Example: npx @capgo/cli@latest key delete_old`).action(ZF);var fq=it.command("account").description("\u{1F464} Manage your Capgo account details and retrieve information for support or collaboration.");fq.command("id").description(`\u{1FAAA} Retrieve your account ID, safe to share for collaboration or support purposes in Discord or other platforms.
419
+ Example: npx @capgo/cli@latest key delete_old`).action(n2);var yq=at.command("account").description("\u{1F464} Manage your Capgo account details and retrieve information for support or collaboration.");yq.command("id").description(`\u{1FAAA} Retrieve your account ID, safe to share for collaboration or support purposes in Discord or other platforms.
418
420
 
419
- Example: npx @capgo/cli@latest account id`).action(n2).option("-a, --apikey <apikey>",G.apikey);var Ff=it.command("organisation").description("\u{1F3E2} Manage your organizations in Capgo Cloud for team collaboration and app management.");Ff.command("list").alias("l").description(`\u{1F4CB} List all organizations you have access to in Capgo Cloud.
421
+ Example: npx @capgo/cli@latest account id`).action(u2).option("-a, --apikey <apikey>",G.apikey);var If=at.command("organisation").description("\u{1F3E2} Manage your organizations in Capgo Cloud for team collaboration and app management.");If.command("list").alias("l").description(`\u{1F4CB} List all organizations you have access to in Capgo Cloud.
420
422
 
421
- Example: npx @capgo/cli@latest organisation list`).action(Ay).option("-a, --apikey <apikey>",G.apikey).option("--supa-host <supaHost>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon);Ff.command("add").alias("a").description(`\u2795 Create a new organization in Capgo Cloud for team collaboration.
423
+ Example: npx @capgo/cli@latest organisation list`).action(Iy).option("-a, --apikey <apikey>",G.apikey).option("--supa-host <supaHost>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon);If.command("add").alias("a").description(`\u2795 Create a new organization in Capgo Cloud for team collaboration.
422
424
 
423
- Example: npx @capgo/cli@latest organisation add --name "My Company" --email admin@mycompany.com`).action(Sy).option("-n, --name <name>","Organization name").option("-e, --email <email>","Management email for the organization").option("-a, --apikey <apikey>",G.apikey).option("--supa-host <supaHost>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon);Ff.command("set [orgId]").alias("s").description(`\u2699\uFE0F Update organization settings such as name and management email.
425
+ Example: npx @capgo/cli@latest organisation add --name "My Company" --email admin@mycompany.com`).action(ky).option("-n, --name <name>","Organization name").option("-e, --email <email>","Management email for the organization").option("-a, --apikey <apikey>",G.apikey).option("--supa-host <supaHost>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon);If.command("set [orgId]").alias("s").description(`\u2699\uFE0F Update organization settings such as name and management email.
424
426
 
425
- Example: npx @capgo/cli@latest organisation set ORG_ID --name "Updated Company Name"`).action(Oy).option("-n, --name <name>","Organization name").option("-e, --email <email>","Management email for the organization").option("-a, --apikey <apikey>",G.apikey).option("--supa-host <supaHost>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon);Ff.command("delete [orgId]").alias("d").description(`\u{1F5D1}\uFE0F Delete an organization from Capgo Cloud. This action cannot be undone.
427
+ Example: npx @capgo/cli@latest organisation set ORG_ID --name "Updated Company Name"`).action(Ty).option("-n, --name <name>","Organization name").option("-e, --email <email>","Management email for the organization").option("-a, --apikey <apikey>",G.apikey).option("--supa-host <supaHost>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon);If.command("delete [orgId]").alias("d").description(`\u{1F5D1}\uFE0F Delete an organization from Capgo Cloud. This action cannot be undone.
426
428
 
427
429
  Only organization owners can delete organizations.
428
430
 
429
- Example: npx @capgo/cli@latest organisation delete ORG_ID`).action(xy).option("-a, --apikey <apikey>",G.apikey).option("--supa-host <supaHost>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon);var o2=it.command("build").description(`\u{1F3D7}\uFE0F Manage native iOS/Android builds through Capgo Cloud.
431
+ Example: npx @capgo/cli@latest organisation delete ORG_ID`).action($y).option("-a, --apikey <apikey>",G.apikey).option("--supa-host <supaHost>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon);var c2=at.command("build").description(`\u{1F3D7}\uFE0F Manage native iOS/Android builds through Capgo Cloud.
430
432
 
431
433
  \u26A0\uFE0F This feature is currently in PUBLIC BETA and cannot be used by anyone at this time.
432
434
 
433
435
  \u{1F512} SECURITY GUARANTEE:
434
436
  Build credentials are NEVER stored on Capgo servers.
435
- They are used only during the build and auto-deleted after (max 24 hours).
437
+ They are used only during the build and auto-deleted after.
436
438
  Builds sent directly to app stores - Capgo keeps nothing.
437
439
 
438
440
  \u{1F4CB} BEFORE BUILDING:
439
441
  Save your credentials first:
440
442
  npx @capgo/cli build credentials save --appId <your-app-id> --platform ios
441
- npx @capgo/cli build credentials save --appId <your-app-id> --platform android`);o2.command("request [appId]").description(`Request a native build from Capgo Cloud.
443
+ npx @capgo/cli build credentials save --appId <your-app-id> --platform android`);c2.command("request [appId]").description(`Request a native build from Capgo Cloud.
442
444
 
443
445
  This command will zip your project directory and upload it to Capgo for building.
444
446
  The build will be processed and sent directly to app stores.
@@ -449,58 +451,68 @@ The build will be processed and sent directly to app stores.
449
451
  \u{1F4CB} PREREQUISITE: Save credentials first with:
450
452
  npx @capgo/cli build credentials save --appId <app-id> --platform <ios|android>
451
453
 
452
- Example: npx @capgo/cli@latest build request com.example.app --platform ios --path .`).action(E1).option("--path <path>","Path to the project directory to build (default: current directory)").option("--platform <platform>","Target platform: ios or android (required)").option("--build-mode <buildMode>","Build mode: debug or release (default: release)").option("--build-config <buildConfig>","Additional build configuration as JSON string").option("--build-certificate-base64 <cert>","iOS: Base64-encoded .p12 certificate").option("--build-provision-profile-base64 <profile>","iOS: Base64-encoded provisioning profile").option("--build-provision-profile-base64-prod <profile>","iOS: Base64-encoded production provisioning profile").option("--p12-password <password>","iOS: Certificate password (optional if cert has no password)").option("--apple-id <email>","iOS: Apple ID email").option("--apple-app-specific-password <password>","iOS: App-specific password").option("--apple-key-id <id>","iOS: App Store Connect API Key ID").option("--apple-issuer-id <id>","iOS: App Store Connect Issuer ID").option("--apple-key-content <content>","iOS: Base64-encoded App Store Connect API key (.p8)").option("--apple-profile-name <name>","iOS: Provisioning profile name").option("--app-store-connect-team-id <id>","iOS: App Store Connect Team ID").option("--android-keystore-file <keystore>","Android: Base64-encoded keystore file").option("--keystore-key-alias <alias>","Android: Keystore key alias").option("--keystore-key-password <password>","Android: Keystore key password").option("--keystore-store-password <password>","Android: Keystore store password").option("--play-config-json <json>","Android: Base64-encoded Google Play service account JSON").option("-a, --apikey <apikey>",G.apikey).option("--supa-host <supaHost>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon).option("--verbose",G.verbose);var ky=o2.command("credentials").description(`Manage build credentials stored locally on your machine.
454
+ Example: npx @capgo/cli@latest build request com.example.app --platform ios --path .`).action(OO).option("--path <path>","Path to the project directory to build (default: current directory)").option("--platform <platform>","Target platform: ios or android (required)").option("--build-mode <buildMode>","Build mode: debug or release (default: release)").option("--build-config <buildConfig>","Additional build configuration as JSON string").option("--build-certificate-base64 <cert>","iOS: Base64-encoded .p12 certificate").option("--build-provision-profile-base64 <profile>","iOS: Base64-encoded provisioning profile").option("--build-provision-profile-base64-prod <profile>","iOS: Base64-encoded production provisioning profile").option("--p12-password <password>","iOS: Certificate password (optional if cert has no password)").option("--apple-id <email>","iOS: Apple ID email").option("--apple-app-specific-password <password>","iOS: App-specific password").option("--apple-key-id <id>","iOS: App Store Connect API Key ID").option("--apple-issuer-id <id>","iOS: App Store Connect Issuer ID").option("--apple-key-content <content>","iOS: Base64-encoded App Store Connect API key (.p8)").option("--apple-profile-name <name>","iOS: Provisioning profile name").option("--app-store-connect-team-id <id>","iOS: App Store Connect Team ID").option("--android-keystore-file <keystore>","Android: Base64-encoded keystore file").option("--keystore-key-alias <alias>","Android: Keystore key alias").option("--keystore-key-password <password>","Android: Keystore key password").option("--keystore-store-password <password>","Android: Keystore store password").option("--play-config-json <json>","Android: Base64-encoded Google Play service account JSON").option("-a, --apikey <apikey>",G.apikey).option("--supa-host <supaHost>",G.supaHost).option("--supa-anon <supaAnon>",G.supaAnon).option("--verbose",G.verbose);var Tf=c2.command("credentials").description(`Manage build credentials stored locally on your machine.
453
455
 
454
456
  \u{1F512} SECURITY:
455
- - Credentials saved to ~/.capgo-credentials/credentials.json (local machine only)
457
+ - Credentials saved to ~/.capgo-credentials/credentials.json (global) or .capgo-credentials.json (local)
456
458
  - When building, sent to Capgo but NEVER stored permanently
457
- - Auto-deleted from Capgo after build (max 24 hours)
458
- - Builds sent directly to app stores - Capgo keeps nothing`);ky.command("save").description(`Save build credentials locally for iOS or Android.
459
+ - Deleted from Capgo immediately after build
460
+ - Builds sent directly to app stores - Capgo keeps nothing
459
461
 
460
- Credentials are stored in ~/.capgo-credentials/credentials.json per app ID and automatically used when building.
462
+ \u{1F4DA} DOCUMENTATION:
463
+ iOS setup: https://capgo.app/docs/cli/cloud-build/ios/
464
+ Android setup: https://capgo.app/docs/cli/cloud-build/android/`);Tf.command("save").description(`Save build credentials locally for iOS or Android.
465
+
466
+ Credentials are stored in:
467
+ - ~/.capgo-credentials/credentials.json (default, global)
468
+ - .capgo-credentials.json in project root (with --local flag)
461
469
 
462
470
  \u26A0\uFE0F REQUIRED BEFORE BUILDING: You must save credentials before requesting a build.
463
471
 
464
472
  \u{1F512} These credentials are NEVER stored on Capgo servers permanently.
465
- They are only used during the build and deleted after (max 24 hours).
466
- Builds sent directly to app stores - Capgo keeps nothing.
473
+ They are deleted immediately after the build completes.
474
+
475
+ \u{1F4DA} Setup guides:
476
+ iOS: https://capgo.app/docs/cli/cloud-build/ios/
477
+ Android: https://capgo.app/docs/cli/cloud-build/android/
467
478
 
468
479
  iOS Example:
469
- npx @capgo/cli build credentials save \\
470
- --appId com.example.app \\
471
- --platform ios \\
472
- --certificate ./cert.p12 \\
473
- --p12-password "password" \\ # Optional if cert has no password
480
+ npx @capgo/cli build credentials save --platform ios \\
481
+ --certificate ./cert.p12 --p12-password "password" \\
474
482
  --provisioning-profile ./profile.mobileprovision \\
475
- --apple-key ./AuthKey.p8 \\
476
- --apple-key-id "KEY123" \\
477
- --apple-issuer-id "issuer-uuid" \\
478
- --apple-profile-name "My App Profile" \\
479
- --apple-team-id "team-id"
483
+ --apple-key ./AuthKey.p8 --apple-key-id "KEY123" \\
484
+ --apple-issuer-id "issuer-uuid" --apple-team-id "team-id" \\
485
+ --apple-profile-name "My App Profile"
480
486
 
481
487
  Android Example:
482
- npx @capgo/cli build credentials save \\
483
- --appId com.example.app \\
484
- --platform android \\
485
- --keystore ./release.keystore \\ # or ./release.jks
486
- --keystore-alias "my-key" \\
488
+ npx @capgo/cli build credentials save --platform android \\
489
+ --keystore ./release.keystore --keystore-alias "my-key" \\
487
490
  --keystore-key-password "key-pass" \\
488
- --keystore-store-password "store-pass" \\
489
- --play-config ./service-account.json`).action(y1).option("--appId <appId>","App ID (e.g., com.example.app) (required)").option("--platform <platform>","Platform: ios or android (required)").option("--certificate <path>","iOS: Path to .p12 certificate file").option("--provisioning-profile <path>","iOS: Path to provisioning profile (.mobileprovision)").option("--provisioning-profile-prod <path>","iOS: Path to production provisioning profile").option("--p12-password <password>","iOS: Certificate password (optional if cert has no password)").option("--apple-key <path>","iOS: Path to .p8 App Store Connect API key").option("--apple-key-id <id>","iOS: App Store Connect API Key ID").option("--apple-issuer-id <id>","iOS: App Store Connect Issuer ID").option("--apple-profile-name <name>","iOS: Provisioning profile name").option("--apple-team-id <id>","iOS: App Store Connect Team ID").option("--apple-id <email>","iOS: Apple ID email (optional)").option("--apple-app-password <password>","iOS: App-specific password (optional)").option("--keystore <path>","Android: Path to keystore file (.keystore or .jks)").option("--keystore-alias <alias>","Android: Keystore key alias").option("--keystore-key-password <password>","Android: Keystore key password").option("--keystore-store-password <password>","Android: Keystore store password").option("--play-config <path>","Android: Path to Play Store service account JSON");ky.command("list").description(`List saved build credentials (passwords masked).
491
+ --play-config ./service-account.json
492
+
493
+ Local storage (per-project):
494
+ npx @capgo/cli build credentials save --local --platform ios ...`).action(vO).option("--appId <appId>","App ID (e.g., com.example.app) (required)").option("--platform <platform>","Platform: ios or android (required)").option("--certificate <path>","iOS: Path to .p12 certificate file").option("--provisioning-profile <path>","iOS: Path to provisioning profile (.mobileprovision)").option("--provisioning-profile-prod <path>","iOS: Path to production provisioning profile").option("--p12-password <password>","iOS: Certificate password (optional if cert has no password)").option("--apple-key <path>","iOS: Path to .p8 App Store Connect API key").option("--apple-key-id <id>","iOS: App Store Connect API Key ID").option("--apple-issuer-id <id>","iOS: App Store Connect Issuer ID").option("--apple-profile-name <name>","iOS: Provisioning profile name").option("--apple-team-id <id>","iOS: App Store Connect Team ID").option("--apple-id <email>","iOS: Apple ID email (optional)").option("--apple-app-password <password>","iOS: App-specific password (optional)").option("--keystore <path>","Android: Path to keystore file (.keystore or .jks)").option("--keystore-alias <alias>","Android: Keystore key alias").option("--keystore-key-password <password>","Android: Keystore key password").option("--keystore-store-password <password>","Android: Keystore store password").option("--play-config <path>","Android: Path to Play Store service account JSON").option("--local","Save to .capgo-credentials.json in project root instead of global ~/.capgo-credentials/");Tf.command("list").description(`List saved build credentials (passwords masked).
490
495
 
491
- Shows what credentials are currently saved in ~/.capgo-credentials/credentials.json
496
+ Shows what credentials are currently saved (both global and local).
492
497
 
493
498
  Examples:
494
499
  npx @capgo/cli build credentials list # List all apps
495
- npx @capgo/cli build credentials list --appId com.example.app # List specific app`).action(D1).option("--appId <appId>","App ID to list (optional, lists all if omitted)");ky.command("clear").description(`Clear saved build credentials.
500
+ npx @capgo/cli build credentials list --appId com.example.app # List specific app`).action(CO).option("--appId <appId>","App ID to list (optional, lists all if omitted)").option("--local","List credentials from local .capgo-credentials.json only");Tf.command("clear").description(`Clear saved build credentials.
496
501
 
497
- Remove credentials from ~/.capgo-credentials/credentials.json
502
+ Remove credentials from storage.
498
503
  Use --appId and --platform to target specific credentials.
499
504
 
500
505
  Examples:
501
- npx @capgo/cli build credentials clear # Clear all apps
502
- npx @capgo/cli build credentials clear --appId com.example.app # Clear specific app
503
- npx @capgo/cli build credentials clear --appId com.example.app --platform ios # Clear iOS only`).action(b1).option("--appId <appId>","App ID to clear (optional, clears all apps if omitted)").option("--platform <platform>","Platform to clear: ios or android (optional, clears all platforms if omitted)");it.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)=>{kF(t,e.folder)});it.exitOverride();it.configureOutput({writeErr:t=>{}});it.parseAsync().catch(t=>{if(typeof t=="object"&&t!==null&&"code"in t){let e=t;(e.code==="commander.version"||e.code==="commander.helpDisplayed")&&(0,Of.exit)(0),e.message&&console.error(e.message);let r=e.exitCode??1;(0,Of.exit)(r)}console.error(`Error: ${q(t)}`),(0,Of.exit)(1)});
506
+ npx @capgo/cli build credentials clear # Clear all apps (global)
507
+ npx @capgo/cli build credentials clear --local # Clear local credentials
508
+ npx @capgo/cli build credentials clear --appId com.example.app --platform ios`).action(EO).option("--appId <appId>","App ID to clear (optional, clears all apps if omitted)").option("--platform <platform>","Platform to clear: ios or android (optional, clears all platforms if omitted)").option("--local","Clear from local .capgo-credentials.json instead of global");Tf.command("update").description(`Update specific credentials without providing all of them again.
509
+
510
+ Update existing credentials by providing only the fields you want to change.
511
+ Platform is auto-detected from the options you provide.
512
+
513
+ Examples:
514
+ npx @capgo/cli build credentials update --provisioning-profile ./new-profile.mobileprovision
515
+ npx @capgo/cli build credentials update --local --keystore ./new-keystore.jks`).action(_O).option("--appId <appId>","App ID (auto-detected from capacitor.config if omitted)").option("--platform <platform>","Platform: ios or android (auto-detected from options)").option("--local","Update local .capgo-credentials.json instead of global").option("--certificate <path>","Path to P12 certificate file").option("--provisioning-profile <path>","Path to provisioning profile (.mobileprovision)").option("--provisioning-profile-prod <path>","Path to production provisioning profile").option("--p12-password <password>","P12 certificate password").option("--apple-key <path>","Path to App Store Connect API key (.p8 file)").option("--apple-key-id <id>","App Store Connect API Key ID").option("--apple-issuer-id <id>","App Store Connect Issuer ID").option("--apple-profile-name <name>","Provisioning profile name").option("--apple-team-id <id>","App Store Connect Team ID").option("--keystore <path>","Path to keystore file (.keystore or .jks)").option("--keystore-alias <alias>","Keystore key alias").option("--keystore-key-password <password>","Keystore key password").option("--keystore-store-password <password>","Keystore store password").option("--play-config <path>","Path to Google Play service account JSON");at.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)=>{RF(t,e.folder)});at.exitOverride();at.configureOutput({writeErr:t=>{}});at.parseAsync().catch(t=>{if(typeof t=="object"&&t!==null&&"code"in t){let e=t;(e.code==="commander.version"||e.code==="commander.helpDisplayed")&&(0,$f.exit)(0),e.message&&console.error(e.message);let r=e.exitCode??1;(0,$f.exit)(r)}console.error(`Error: ${q(t)}`),(0,$f.exit)(1)});
504
516
  /*! Bundled license information:
505
517
 
506
518
  tus-js-client/lib.es5/upload.js: