@capgo/cli 7.18.23 → 7.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/dist/index.js +214 -214
  2. package/dist/src/sdk.js +1 -1
  3. package/package.json +9 -2
  4. package/dist/package.json +0 -86
  5. package/dist/src/api/app.js +0 -45
  6. package/dist/src/api/app.js.map +0 -1
  7. package/dist/src/api/channels.js +0 -167
  8. package/dist/src/api/channels.js.map +0 -1
  9. package/dist/src/api/cryptoV2.js +0 -102
  10. package/dist/src/api/cryptoV2.js.map +0 -1
  11. package/dist/src/api/update.js +0 -13
  12. package/dist/src/api/update.js.map +0 -1
  13. package/dist/src/api/versions.js +0 -92
  14. package/dist/src/api/versions.js.map +0 -1
  15. package/dist/src/app/add.js +0 -150
  16. package/dist/src/app/add.js.map +0 -1
  17. package/dist/src/app/debug.js +0 -222
  18. package/dist/src/app/debug.js.map +0 -1
  19. package/dist/src/app/delete.js +0 -89
  20. package/dist/src/app/delete.js.map +0 -1
  21. package/dist/src/app/info.js +0 -84
  22. package/dist/src/app/info.js.map +0 -1
  23. package/dist/src/app/list.js +0 -48
  24. package/dist/src/app/list.js.map +0 -1
  25. package/dist/src/app/set.js +0 -96
  26. package/dist/src/app/set.js.map +0 -1
  27. package/dist/src/app/setting.js +0 -50
  28. package/dist/src/app/setting.js.map +0 -1
  29. package/dist/src/bundle/check.js +0 -30
  30. package/dist/src/bundle/check.js.map +0 -1
  31. package/dist/src/bundle/cleanup.js +0 -105
  32. package/dist/src/bundle/cleanup.js.map +0 -1
  33. package/dist/src/bundle/compatibility.js +0 -62
  34. package/dist/src/bundle/compatibility.js.map +0 -1
  35. package/dist/src/bundle/decryptV2.js +0 -76
  36. package/dist/src/bundle/decryptV2.js.map +0 -1
  37. package/dist/src/bundle/delete.js +0 -40
  38. package/dist/src/bundle/delete.js.map +0 -1
  39. package/dist/src/bundle/encryptV2.js +0 -108
  40. package/dist/src/bundle/encryptV2.js.map +0 -1
  41. package/dist/src/bundle/list.js +0 -36
  42. package/dist/src/bundle/list.js.map +0 -1
  43. package/dist/src/bundle/partial.js +0 -277
  44. package/dist/src/bundle/partial.js.map +0 -1
  45. package/dist/src/bundle/unlink.js +0 -70
  46. package/dist/src/bundle/unlink.js.map +0 -1
  47. package/dist/src/bundle/upload.js +0 -940
  48. package/dist/src/bundle/upload.js.map +0 -1
  49. package/dist/src/bundle/upload_interface.js +0 -2
  50. package/dist/src/bundle/upload_interface.js.map +0 -1
  51. package/dist/src/bundle/zip.js +0 -156
  52. package/dist/src/bundle/zip.js.map +0 -1
  53. package/dist/src/channel/add.js +0 -68
  54. package/dist/src/channel/add.js.map +0 -1
  55. package/dist/src/channel/currentBundle.js +0 -54
  56. package/dist/src/channel/currentBundle.js.map +0 -1
  57. package/dist/src/channel/delete.js +0 -77
  58. package/dist/src/channel/delete.js.map +0 -1
  59. package/dist/src/channel/list.js +0 -45
  60. package/dist/src/channel/list.js.map +0 -1
  61. package/dist/src/channel/set.js +0 -220
  62. package/dist/src/channel/set.js.map +0 -1
  63. package/dist/src/checksum.js +0 -46
  64. package/dist/src/checksum.js.map +0 -1
  65. package/dist/src/config/index.js +0 -31
  66. package/dist/src/config/index.js.map +0 -1
  67. package/dist/src/docs.js +0 -280
  68. package/dist/src/docs.js.map +0 -1
  69. package/dist/src/index.js +0 -522
  70. package/dist/src/index.js.map +0 -1
  71. package/dist/src/init.js +0 -803
  72. package/dist/src/init.js.map +0 -1
  73. package/dist/src/keyV2.js +0 -163
  74. package/dist/src/keyV2.js.map +0 -1
  75. package/dist/src/login.js +0 -51
  76. package/dist/src/login.js.map +0 -1
  77. package/dist/src/organisation/add.js +0 -82
  78. package/dist/src/organisation/add.js.map +0 -1
  79. package/dist/src/organisation/delete.js +0 -91
  80. package/dist/src/organisation/delete.js.map +0 -1
  81. package/dist/src/organisation/index.js +0 -5
  82. package/dist/src/organisation/index.js.map +0 -1
  83. package/dist/src/organisation/list.js +0 -60
  84. package/dist/src/organisation/list.js.map +0 -1
  85. package/dist/src/organisation/set.js +0 -95
  86. package/dist/src/organisation/set.js.map +0 -1
  87. package/dist/src/sdk.js.map +0 -1
  88. package/dist/src/types/supabase.types.js +0 -86
  89. package/dist/src/types/supabase.types.js.map +0 -1
  90. package/dist/src/user/account.js +0 -31
  91. package/dist/src/user/account.js.map +0 -1
  92. package/dist/src/utils/latest-version.js +0 -26
  93. package/dist/src/utils/latest-version.js.map +0 -1
  94. package/dist/src/utils.js +0 -1222
  95. package/dist/src/utils.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,80 +1,80 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var Nk=Object.create;var ru=Object.defineProperty;var Lk=Object.getOwnPropertyDescriptor;var jk=Object.getOwnPropertyNames;var Uk=Object.getPrototypeOf,Mk=Object.prototype.hasOwnProperty;var it=(t,e)=>()=>(t&&(e=t(t=0)),e);var C=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),wn=(t,e)=>{for(var r in e)ru(t,r,{get:e[r],enumerable:!0})},JD=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of jk(e))!Mk.call(t,o)&&o!==r&&ru(t,o,{get:()=>e[o],enumerable:!(n=Lk(e,o))||n.enumerable});return t};var be=(t,e,r)=>(r=t!=null?Nk(Uk(t)):{},JD(e||!t||!t.__esModule?ru(r,"default",{value:t,enumerable:!0}):r,t)),oe=t=>JD(ru({},"__esModule",{value:!0}),t);var Es=C(Bf=>{var nu=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}},If=class extends nu{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Bf.CommanderError=nu;Bf.InvalidArgumentError=If});var ou=C(Lf=>{var{InvalidArgumentError:qk}=Es(),Nf=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 qk(`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 Hk(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}Lf.Argument=Nf;Lf.humanReadableArgName=Hk});var Mf=C(Uf=>{var{humanReadableArgName:Vk}=ou(),jf=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=>Vk(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 s=n(i);o.has(s)||o.set(s,[])}),r.forEach(i=>{let s=n(i);o.has(s)||o.set(s,[]),o.get(s).push(i)}),o}formatHelp(e,r){let n=r.padWidth(e,r),o=r.helpWidth??80;function i(f,h){return r.formatItem(f,n,h,r)}let s=[`${r.styleTitle("Usage:")} ${r.styleUsage(r.commandUsage(e))}`,""],a=r.commandDescription(e);a.length>0&&(s=s.concat([r.boxWrap(r.styleCommandDescription(a),o),""]));let u=r.visibleArguments(e).map(f=>i(r.styleArgumentTerm(r.argumentTerm(f)),r.styleArgumentDescription(r.argumentDescription(f))));if(s=s.concat(this.formatItemList("Arguments:",u,r)),this.groupItems(e.options,r.visibleOptions(e),f=>f.helpGroupHeading??"Options:").forEach((f,h)=>{let d=f.map(m=>i(r.styleOptionTerm(r.optionTerm(m)),r.styleOptionDescription(r.optionDescription(m))));s=s.concat(this.formatItemList(h,d,r))}),r.showGlobalOptions){let f=r.visibleGlobalOptions(e).map(h=>i(r.styleOptionTerm(r.optionTerm(h)),r.styleOptionDescription(r.optionDescription(h))));s=s.concat(this.formatItemList("Global Options:",f,r))}return this.groupItems(e.commands,r.visibleCommands(e),f=>f.helpGroup()||"Commands:").forEach((f,h)=>{let d=f.map(m=>i(r.styleSubcommandTerm(r.subcommandTerm(m)),r.styleSubcommandDescription(r.subcommandDescription(m))));s=s.concat(this.formatItemList(h,d,r))}),s.join(`
3
- `)}displayWidth(e){return ZD(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 s=" ".repeat(2);if(!n)return s+e;let a=e.padEnd(r+e.length-o.displayWidth(e)),u=2,l=(this.helpWidth??80)-r-u-2,f;return l<this.minWidthToWrap||o.preformatted(n)?f=n:f=o.boxWrap(n,l).replace(/\n/g,`
4
- `+" ".repeat(r+u)),s+a+" ".repeat(u)+f.replace(/\n/g,`
5
- ${s}`)}boxWrap(e,r){if(r<this.minWidthToWrap)return e;let n=e.split(/\r\n|\n/),o=/[\s]*[^\s]+/g,i=[];return n.forEach(s=>{let a=s.match(o);if(a===null){i.push("");return}let u=[a.shift()],c=this.displayWidth(u[0]);a.forEach(l=>{let f=this.displayWidth(l);if(c+f<=r){u.push(l),c+=f;return}i.push(u.join(""));let h=l.trimStart();u=[h],c=this.displayWidth(h)}),i.push(u.join(""))}),i.join(`
6
- `)}};function ZD(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}Uf.Help=jf;Uf.stripColor=ZD});var zf=C(Vf=>{var{InvalidArgumentError:zk}=Es(),qf=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=Gk(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 zk(`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?QD(this.name().replace(/^no-/,"")):QD(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}},Hf=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 QD(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function Gk(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 s=i[0],a=`option creation failed due to '${s}' in option flags '${t}'`;throw/^-[^-][^-]/.test(s)?new Error(`${a}
2
+ "use strict";var QF=Object.create;var Bs=Object.defineProperty;var eA=Object.getOwnPropertyDescriptor;var tA=Object.getOwnPropertyNames;var rA=Object.getPrototypeOf,nA=Object.prototype.hasOwnProperty;var et=(t,e)=>()=>(t&&(e=t(t=0)),e);var x=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),qr=(t,e)=>{for(var r in e)Bs(t,r,{get:e[r],enumerable:!0})},eD=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of tA(e))!nA.call(t,o)&&o!==r&&Bs(t,o,{get:()=>e[o],enumerable:!(n=eA(e,o))||n.enumerable});return t};var ge=(t,e,r)=>(r=t!=null?QF(rA(t)):{},eD(e||!t||!t.__esModule?Bs(r,"default",{value:t,enumerable:!0}):r,t)),re=t=>eD(Bs({},"__esModule",{value:!0}),t);var ca=x(nf=>{var js=class extends Error{constructor(e,r,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=r,this.exitCode=e,this.nestedError=void 0}},rf=class extends js{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};nf.CommanderError=js;nf.InvalidArgumentError=rf});var Ns=x(af=>{var{InvalidArgumentError:oA}=ca(),of=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 oA(`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 iA(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}af.Argument=of;af.humanReadableArgName=iA});var cf=x(uf=>{var{humanReadableArgName:aA}=Ns(),sf=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=>aA(n)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,r){return r.visibleCommands(e).reduce((n,o)=>Math.max(n,this.displayWidth(r.styleSubcommandTerm(r.subcommandTerm(o)))),0)}longestOptionTermLength(e,r){return r.visibleOptions(e).reduce((n,o)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(o)))),0)}longestGlobalOptionTermLength(e,r){return r.visibleGlobalOptions(e).reduce((n,o)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(o)))),0)}longestArgumentTermLength(e,r){return r.visibleArguments(e).reduce((n,o)=>Math.max(n,this.displayWidth(r.styleArgumentTerm(r.argumentTerm(o)))),0)}commandUsage(e){let r=e._name;e._aliases[0]&&(r=r+"|"+e._aliases[0]);let n="";for(let o=e.parent;o;o=o.parent)n=o.name()+" "+n;return n+r+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&r.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&r.push(`env: ${e.envVar}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,r,n){return r.length===0?[]:[n.styleTitle(e),...r,""]}groupItems(e,r,n){let o=new Map;return e.forEach(i=>{let a=n(i);o.has(a)||o.set(a,[])}),r.forEach(i=>{let a=n(i);o.has(a)||o.set(a,[]),o.get(a).push(i)}),o}formatHelp(e,r){let n=r.padWidth(e,r),o=r.helpWidth??80;function i(f,d){return r.formatItem(f,n,d,r)}let a=[`${r.styleTitle("Usage:")} ${r.styleUsage(r.commandUsage(e))}`,""],s=r.commandDescription(e);s.length>0&&(a=a.concat([r.boxWrap(r.styleCommandDescription(s),o),""]));let u=r.visibleArguments(e).map(f=>i(r.styleArgumentTerm(r.argumentTerm(f)),r.styleArgumentDescription(r.argumentDescription(f))));if(a=a.concat(this.formatItemList("Arguments:",u,r)),this.groupItems(e.options,r.visibleOptions(e),f=>f.helpGroupHeading??"Options:").forEach((f,d)=>{let h=f.map(m=>i(r.styleOptionTerm(r.optionTerm(m)),r.styleOptionDescription(r.optionDescription(m))));a=a.concat(this.formatItemList(d,h,r))}),r.showGlobalOptions){let f=r.visibleGlobalOptions(e).map(d=>i(r.styleOptionTerm(r.optionTerm(d)),r.styleOptionDescription(r.optionDescription(d))));a=a.concat(this.formatItemList("Global Options:",f,r))}return this.groupItems(e.commands,r.visibleCommands(e),f=>f.helpGroup()||"Commands:").forEach((f,d)=>{let h=f.map(m=>i(r.styleSubcommandTerm(r.subcommandTerm(m)),r.styleSubcommandDescription(r.subcommandDescription(m))));a=a.concat(this.formatItemList(d,h,r))}),a.join(`
3
+ `)}displayWidth(e){return tD(e).length}styleTitle(e){return e}styleUsage(e){return e.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r==="[command]"?this.styleSubcommandText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleCommandText(r)).join(" ")}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleSubcommandText(r)).join(" ")}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,r){return Math.max(r.longestOptionTermLength(e,r),r.longestGlobalOptionTermLength(e,r),r.longestSubcommandTermLength(e,r),r.longestArgumentTermLength(e,r))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,r,n,o){let a=" ".repeat(2);if(!n)return a+e;let s=e.padEnd(r+e.length-o.displayWidth(e)),u=2,l=(this.helpWidth??80)-r-u-2,f;return l<this.minWidthToWrap||o.preformatted(n)?f=n:f=o.boxWrap(n,l).replace(/\n/g,`
4
+ `+" ".repeat(r+u)),a+s+" ".repeat(u)+f.replace(/\n/g,`
5
+ ${a}`)}boxWrap(e,r){if(r<this.minWidthToWrap)return e;let n=e.split(/\r\n|\n/),o=/[\s]*[^\s]+/g,i=[];return n.forEach(a=>{let s=a.match(o);if(s===null){i.push("");return}let u=[s.shift()],c=this.displayWidth(u[0]);s.forEach(l=>{let f=this.displayWidth(l);if(c+f<=r){u.push(l),c+=f;return}i.push(u.join(""));let d=l.trimStart();u=[d],c=this.displayWidth(d)}),i.push(u.join(""))}),i.join(`
6
+ `)}};function tD(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}uf.Help=sf;uf.stripColor=tD});var df=x(pf=>{var{InvalidArgumentError:sA}=ca(),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=uA(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 sA(`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?rD(this.name().replace(/^no-/,"")):rD(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}},ff=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 rD(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function uA(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
- - or use a double dash for a long option (and can have two, like '--ws, --workspace')`):n.test(s)?new Error(`${a}
10
- - too many short flags`):o.test(s)?new Error(`${a}
11
- - too many long flags`):new Error(`${a}
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}}Vf.Option=qf;Vf.DualOptions=Hf});var ty=C(ey=>{function Wk(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 Kk(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(s=>s.slice(2)));let n=[],o=3,i=.4;return e.forEach(s=>{if(s.length<=1)return;let a=Wk(t,s),u=Math.max(t.length,s.length);(u-a)/u>i&&(a<o?(o=a,n=[s]):a===o&&n.push(s))}),n.sort((s,a)=>s.localeCompare(a)),r&&(n=n.map(s=>`--${s}`)),n.length>1?`
9
+ - or use a double dash for a long option (and can have two, like '--ws, --workspace')`):n.test(a)?new Error(`${s}
10
+ - too many short flags`):o.test(a)?new Error(`${s}
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}}pf.Option=lf;pf.DualOptions=ff});var oD=x(nD=>{function cA(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 lA(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=cA(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]}?)`:""}ey.suggestSimilar=Kk});var iy=C(Yf=>{var Xk=require("node:events").EventEmitter,Gf=require("node:child_process"),Qr=require("node:path"),iu=require("node:fs"),ve=require("node:process"),{Argument:Yk,humanReadableArgName:Jk}=ou(),{CommanderError:Wf}=Es(),{Help:Zk,stripColor:Qk}=Mf(),{Option:ry,DualOptions:e$}=zf(),{suggestSimilar:ny}=ty(),Kf=class t extends Xk{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:r=>ve.stdout.write(r),writeErr:r=>ve.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>ve.stdout.isTTY?ve.stdout.columns:void 0,getErrHelpWidth:()=>ve.stderr.isTTY?ve.stderr.columns:void 0,getOutHasColors:()=>Xf()??(ve.stdout.isTTY&&ve.stdout.hasColors?.()),getErrHasColors:()=>Xf()??(ve.stderr.isTTY&&ve.stderr.hasColors?.()),stripColor:r=>Qk(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[,s,a]=e.match(/([^ ]+) *(.*)/),u=this.createCommand(s);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,a&&u.arguments(a),this._registerCommand(u),u.parent=this,u.copyInheritedSettings(this),o?this:u}createCommand(e){return new t(e)}createHelp(){return Object.assign(new Zk,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 Yk(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(/([^ ]+) *(.*)/),s=r??"display help for command",a=this.createCommand(o);return a.helpOption(!1),i&&a.arguments(i),s&&a.description(s),this._addImplicitHelpCommand=!0,this._helpCommand=a,(e||r)&&this._initCommandGroup(a),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)),ve.exit(e)}action(e){let r=n=>{let o=this.registeredArguments.length,i=n.slice(0,o);return this._storeOptionsAsProperties?i[o]=this:i[o]=this.opts(),i.push(this),e.apply(this,i)};return this._actionHandler=r,this}createOption(e,r){return new ry(e,r)}_callParseArg(e,r,n,o){try{return e.parseArg(r,n)}catch(i){if(i.code==="commander.invalidArgument"){let s=`${o} ${i.message}`;this.error(s,{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,s,a)=>{i==null&&e.presetArg!==void 0&&(i=e.presetArg);let u=this.getOptionValue(n);i!==null&&e.parseArg?i=this._callParseArg(e,i,u,s):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,a)};return this.on("option:"+r,i=>{let s=`error: option '${e.flags}' argument '${i}' is invalid.`;o(i,s,"cli")}),e.envVar&&this.on("optionEnv:"+r,i=>{let s=`error: option '${e.flags}' value '${i}' from env '${e.envVar}' is invalid.`;o(i,s,"env")}),this}_optionEx(e,r,n,o,i){if(typeof r=="object"&&r instanceof ry)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let s=this.createOption(r,n);if(s.makeOptionMandatory(!!e.mandatory),typeof o=="function")s.default(i).argParser(o);else if(o instanceof RegExp){let a=o;o=(u,c)=>{let l=a.exec(u);return l?l[0]:c},s.default(i).argParser(o)}else s.default(o);return this.addOption(s)}option(e,r,n,o){return this._optionEx({},e,r,n,o)}requiredOption(e,r,n,o){return this._optionEx({mandatory:!0},e,r,n,o)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,r){return this.setOptionValueWithSource(e,r,void 0)}setOptionValueWithSource(e,r,n){return this._storeOptionsAsProperties?this[e]=r:this._optionValues[e]=r,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let r;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(r=n.getOptionValueSource(e))}),r}_prepareUserArgs(e,r){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(r=r||{},e===void 0&&r.from===void 0){ve.versions?.electron&&(r.from="electron");let o=ve.execArgv??[];(o.includes("-e")||o.includes("--eval")||o.includes("-p")||o.includes("--print"))&&(r.from="eval")}e===void 0&&(e=ve.argv),this.rawArgs=e.slice();let n;switch(r.from){case void 0:case"node":this._scriptPath=e[1],n=e.slice(2);break;case"electron":ve.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case"user":n=e.slice(0);break;case"eval":n=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${r.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(e,r){this._prepareForParse();let n=this._prepareUserArgs(e,r);return this._parseCommand([],n),this}async parseAsync(e,r){this._prepareForParse();let n=this._prepareUserArgs(e,r);return await this._parseCommand([],n),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
18
- - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(e,r,n){if(iu.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]}?)`:""}nD.suggestSimilar=lA});var uD=x(yf=>{var fA=require("node:events").EventEmitter,hf=require("node:child_process"),Hr=require("node:path"),Ls=require("node:fs"),ye=require("node:process"),{Argument:pA,humanReadableArgName:dA}=Ns(),{CommanderError:mf}=ca(),{Help:hA,stripColor:mA}=cf(),{Option:iD,DualOptions:gA}=df(),{suggestSimilar:aD}=oD(),gf=class t extends fA{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=>ye.stdout.write(r),writeErr:r=>ye.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>ye.stdout.isTTY?ye.stdout.columns:void 0,getErrHelpWidth:()=>ye.stderr.isTTY?ye.stderr.columns:void 0,getOutHasColors:()=>Df()??(ye.stdout.isTTY&&ye.stdout.hasColors?.()),getErrHasColors:()=>Df()??(ye.stderr.isTTY&&ye.stderr.hasColors?.()),stripColor:r=>mA(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 hA,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 pA(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 mf(e,r,n)),ye.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 iD(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 iD)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let a=this.createOption(r,n);if(a.makeOptionMandatory(!!e.mandatory),typeof o=="function")a.default(i).argParser(o);else if(o instanceof RegExp){let s=o;o=(u,c)=>{let l=s.exec(u);return l?l[0]:c},a.default(i).argParser(o)}else a.default(o);return this.addOption(a)}option(e,r,n,o){return this._optionEx({},e,r,n,o)}requiredOption(e,r,n,o){return this._optionEx({mandatory:!0},e,r,n,o)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,r){return this.setOptionValueWithSource(e,r,void 0)}setOptionValueWithSource(e,r,n){return this._storeOptionsAsProperties?this[e]=r:this._optionValues[e]=r,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let r;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(r=n.getOptionValueSource(e))}),r}_prepareUserArgs(e,r){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(r=r||{},e===void 0&&r.from===void 0){ye.versions?.electron&&(r.from="electron");let o=ye.execArgv??[];(o.includes("-e")||o.includes("--eval")||o.includes("-p")||o.includes("--print"))&&(r.from="eval")}e===void 0&&(e=ye.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":ye.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case"user":n=e.slice(0);break;case"eval":n=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${r.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(e,r){this._prepareForParse();let n=this._prepareUserArgs(e,r);return this._parseCommand([],n),this}async parseAsync(e,r){this._prepareForParse();let n=this._prepareUserArgs(e,r);return await this._parseCommand([],n),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
18
+ - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(e,r,n){if(Ls.existsSync(e))return;let o=r?`searched for local subcommand relative to directory '${r}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",i=`'${e}' does not exist
19
19
  - if '${n}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
20
20
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
21
- - ${o}`;throw new Error(i)}_executeSubCommand(e,r){r=r.slice();let n=!1,o=[".js",".ts",".tsx",".mjs",".cjs"];function i(l,f){let h=Qr.resolve(l,f);if(iu.existsSync(h))return h;if(o.includes(Qr.extname(f)))return;let d=o.find(m=>iu.existsSync(`${h}${m}`));if(d)return`${h}${d}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let s=e._executableFile||`${this._name}-${e._name}`,a=this._executableDir||"";if(this._scriptPath){let l;try{l=iu.realpathSync(this._scriptPath)}catch{l=this._scriptPath}a=Qr.resolve(Qr.dirname(l),a)}if(a){let l=i(a,s);if(!l&&!e._executableFile&&this._scriptPath){let f=Qr.basename(this._scriptPath,Qr.extname(this._scriptPath));f!==this._name&&(l=i(a,`${f}-${e._name}`))}s=l||s}n=o.includes(Qr.extname(s));let u;ve.platform!=="win32"?n?(r.unshift(s),r=oy(ve.execArgv).concat(r),u=Gf.spawn(ve.argv[0],r,{stdio:"inherit"})):u=Gf.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=oy(ve.execArgv).concat(r),u=Gf.spawn(ve.execPath,r,{stdio:"inherit"})),u.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(f=>{ve.on(f,()=>{u.killed===!1&&u.exitCode===null&&u.kill(f)})});let c=this._exitCallback;u.on("close",l=>{l=l??1,c?c(new Wf(l,"commander.executeSubCommandAsync","(close)")):ve.exit(l)}),u.on("error",l=>{if(l.code==="ENOENT")this._checkForMissingExecutable(s,a,e._name);else if(l.code==="EACCES")throw new Error(`'${s}' not executable`);if(!c)ve.exit(1);else{let f=new Wf(1,"commander.executeSubCommandAsync","(error)");f.nestedError=l,c(f)}}),this.runningCommand=u}_dispatchSubcommand(e,r,n){let o=this._findCommand(e);o||this.help({error:!0}),o._prepareForParse();let i;return i=this._chainOrCallSubCommandHook(i,o,"preSubcommand"),i=this._chainOrCall(i,()=>{if(o._executableHandler)this._executeSubCommand(o,r.concat(n));else return o._parseCommand(r,n)}),i}_dispatchHelpCommand(e){e||this.help();let r=this._findCommand(e);return r&&!r._executableHandler&&r.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,r)=>{e.required&&this.args[r]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(n,o,i)=>{let s=o;if(o!==null&&n.parseArg){let a=`error: command-argument value '${o}' is invalid for argument '${n.name()}'.`;s=this._callParseArg(n,o,i,a)}return s};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((s,a)=>e(n,a,s),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(s=>{o.push({hookedCommand:i,callback:s})})}),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 s;return s=this._chainOrCallHooks(s,"preAction"),s=this._chainOrCall(s,()=>this._actionHandler(this.processedArgs)),this.parent&&(s=this._chainOrCall(s,()=>{this.parent.emit(i,e,r)})),s=this._chainOrCallHooks(s,"postAction"),s}if(this.parent?.listenerCount(i))o(),this._processArguments(),this.parent.emit(i,e,r);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,r);this.listenerCount("command:*")?this.emit("command:*",e,r):this.commands.length?this.unknownCommand():(o(),this._processArguments())}else this.commands.length?(o(),this.help({error:!0})):(o(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(r=>r._name===e||r._aliases.includes(e))}_findOption(e){return this.options.find(r=>r.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(r=>{r.mandatory&&e.getOptionValue(r.attributeName())===void 0&&e.missingMandatoryOptionValue(r)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(n=>{let o=n.attributeName();return this.getOptionValue(o)===void 0?!1:this.getOptionValueSource(o)!=="default"});e.filter(n=>n.conflictsWith.length>0).forEach(n=>{let o=e.find(i=>n.conflictsWith.includes(i.attributeName()));o&&this._conflictingOption(n,o)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let r=[],n=[],o=r;function i(l){return l.length>1&&l[0]==="-"}let s=l=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(l)?!this._getCommandAndAncestors().some(f=>f.options.map(h=>h.short).some(h=>/^-\d$/.test(h))):!1,a=null,u=null,c=0;for(;c<e.length||u;){let l=u??e[c++];if(u=null,l==="--"){o===n&&o.push(l),o.push(...e.slice(c));break}if(a&&(!i(l)||s(l))){this.emit(`option:${a.name()}`,l);continue}if(a=null,i(l)){let f=this._findOption(l);if(f){if(f.required){let h=e[c++];h===void 0&&this.optionMissingArgument(f),this.emit(`option:${f.name()}`,h)}else if(f.optional){let h=null;c<e.length&&(!i(e[c])||s(e[c]))&&(h=e[c++]),this.emit(`option:${f.name()}`,h)}else this.emit(`option:${f.name()}`);a=f.variadic?f:null;continue}}if(l.length>2&&l[0]==="-"&&l[1]!=="-"){let f=this._findOption(`-${l[1]}`);if(f){f.required||f.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${f.name()}`,l.slice(2)):(this.emit(`option:${f.name()}`),u=`-${l.slice(2)}`);continue}}if(/^--[^=]+=/.test(l)){let f=l.indexOf("="),h=this._findOption(l.slice(0,f));if(h&&(h.required||h.optional)){this.emit(`option:${h.name()}`,l.slice(f+1));continue}}if(o===r&&i(l)&&!(this.commands.length===0&&s(l))&&(o=n),(this._enablePositionalOptions||this._passThroughOptions)&&r.length===0&&n.length===0){if(this._findCommand(l)){r.push(l),n.push(...e.slice(c));break}else if(this._getHelpCommand()&&l===this._getHelpCommand().name()){r.push(l,...e.slice(c));break}else if(this._defaultCommandName){n.push(l,...e.slice(c));break}}if(this._passThroughOptions){o.push(l,...e.slice(c));break}o.push(l)}return{operands:r,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},r=this.options.length;for(let n=0;n<r;n++){let o=this.options[n].attributeName();e[o]=o===this._versionOptionName?this._version:this[o]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,r)=>Object.assign(e,r.opts()),{})}error(e,r){this._outputConfiguration.outputError(`${e}
21
+ - ${o}`;throw new Error(i)}_executeSubCommand(e,r){r=r.slice();let n=!1,o=[".js",".ts",".tsx",".mjs",".cjs"];function i(l,f){let d=Hr.resolve(l,f);if(Ls.existsSync(d))return d;if(o.includes(Hr.extname(f)))return;let h=o.find(m=>Ls.existsSync(`${d}${m}`));if(h)return`${d}${h}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let a=e._executableFile||`${this._name}-${e._name}`,s=this._executableDir||"";if(this._scriptPath){let l;try{l=Ls.realpathSync(this._scriptPath)}catch{l=this._scriptPath}s=Hr.resolve(Hr.dirname(l),s)}if(s){let l=i(s,a);if(!l&&!e._executableFile&&this._scriptPath){let f=Hr.basename(this._scriptPath,Hr.extname(this._scriptPath));f!==this._name&&(l=i(s,`${f}-${e._name}`))}a=l||a}n=o.includes(Hr.extname(a));let u;ye.platform!=="win32"?n?(r.unshift(a),r=sD(ye.execArgv).concat(r),u=hf.spawn(ye.argv[0],r,{stdio:"inherit"})):u=hf.spawn(a,r,{stdio:"inherit"}):(this._checkForMissingExecutable(a,s,e._name),r.unshift(a),r=sD(ye.execArgv).concat(r),u=hf.spawn(ye.execPath,r,{stdio:"inherit"})),u.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(f=>{ye.on(f,()=>{u.killed===!1&&u.exitCode===null&&u.kill(f)})});let c=this._exitCallback;u.on("close",l=>{l=l??1,c?c(new mf(l,"commander.executeSubCommandAsync","(close)")):ye.exit(l)}),u.on("error",l=>{if(l.code==="ENOENT")this._checkForMissingExecutable(a,s,e._name);else if(l.code==="EACCES")throw new Error(`'${a}' not executable`);if(!c)ye.exit(1);else{let f=new mf(1,"commander.executeSubCommandAsync","(error)");f.nestedError=l,c(f)}}),this.runningCommand=u}_dispatchSubcommand(e,r,n){let o=this._findCommand(e);o||this.help({error:!0}),o._prepareForParse();let i;return i=this._chainOrCallSubCommandHook(i,o,"preSubcommand"),i=this._chainOrCall(i,()=>{if(o._executableHandler)this._executeSubCommand(o,r.concat(n));else return o._parseCommand(r,n)}),i}_dispatchHelpCommand(e){e||this.help();let r=this._findCommand(e);return r&&!r._executableHandler&&r.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,r)=>{e.required&&this.args[r]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(n,o,i)=>{let a=o;if(o!==null&&n.parseArg){let s=`error: command-argument value '${o}' is invalid for argument '${n.name()}'.`;a=this._callParseArg(n,o,i,s)}return a};this._checkNumberOfArguments();let r=[];this.registeredArguments.forEach((n,o)=>{let i=n.defaultValue;n.variadic?o<this.args.length?(i=this.args.slice(o),n.parseArg&&(i=i.reduce((a,s)=>e(n,s,a),n.defaultValue))):i===void 0&&(i=[]):o<this.args.length&&(i=this.args[o],n.parseArg&&(i=e(n,i,n.defaultValue))),r[o]=i}),this.processedArgs=r}_chainOrCall(e,r){return e?.then&&typeof e.then=="function"?e.then(()=>r()):r()}_chainOrCallHooks(e,r){let n=e,o=[];return this._getCommandAndAncestors().reverse().filter(i=>i._lifeCycleHooks[r]!==void 0).forEach(i=>{i._lifeCycleHooks[r].forEach(a=>{o.push({hookedCommand:i,callback:a})})}),r==="postAction"&&o.reverse(),o.forEach(i=>{n=this._chainOrCall(n,()=>i.callback(i.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,r,n){let o=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(i=>{o=this._chainOrCall(o,()=>i(this,r))}),o}_parseCommand(e,r){let n=this.parseOptions(r);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),r=n.unknown,this.args=e.concat(r),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),r);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(r),this._dispatchSubcommand(this._defaultCommandName,e,r);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},i=`command:${this.name()}`;if(this._actionHandler){o(),this._processArguments();let a;return a=this._chainOrCallHooks(a,"preAction"),a=this._chainOrCall(a,()=>this._actionHandler(this.processedArgs)),this.parent&&(a=this._chainOrCall(a,()=>{this.parent.emit(i,e,r)})),a=this._chainOrCallHooks(a,"postAction"),a}if(this.parent?.listenerCount(i))o(),this._processArguments(),this.parent.emit(i,e,r);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,r);this.listenerCount("command:*")?this.emit("command:*",e,r):this.commands.length?this.unknownCommand():(o(),this._processArguments())}else this.commands.length?(o(),this.help({error:!0})):(o(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(r=>r._name===e||r._aliases.includes(e))}_findOption(e){return this.options.find(r=>r.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(r=>{r.mandatory&&e.getOptionValue(r.attributeName())===void 0&&e.missingMandatoryOptionValue(r)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(n=>{let o=n.attributeName();return this.getOptionValue(o)===void 0?!1:this.getOptionValueSource(o)!=="default"});e.filter(n=>n.conflictsWith.length>0).forEach(n=>{let o=e.find(i=>n.conflictsWith.includes(i.attributeName()));o&&this._conflictingOption(n,o)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let r=[],n=[],o=r;function i(l){return l.length>1&&l[0]==="-"}let a=l=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(l)?!this._getCommandAndAncestors().some(f=>f.options.map(d=>d.short).some(d=>/^-\d$/.test(d))):!1,s=null,u=null,c=0;for(;c<e.length||u;){let l=u??e[c++];if(u=null,l==="--"){o===n&&o.push(l),o.push(...e.slice(c));break}if(s&&(!i(l)||a(l))){this.emit(`option:${s.name()}`,l);continue}if(s=null,i(l)){let f=this._findOption(l);if(f){if(f.required){let d=e[c++];d===void 0&&this.optionMissingArgument(f),this.emit(`option:${f.name()}`,d)}else if(f.optional){let d=null;c<e.length&&(!i(e[c])||a(e[c]))&&(d=e[c++]),this.emit(`option:${f.name()}`,d)}else this.emit(`option:${f.name()}`);s=f.variadic?f:null;continue}}if(l.length>2&&l[0]==="-"&&l[1]!=="-"){let f=this._findOption(`-${l[1]}`);if(f){f.required||f.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${f.name()}`,l.slice(2)):(this.emit(`option:${f.name()}`),u=`-${l.slice(2)}`);continue}}if(/^--[^=]+=/.test(l)){let f=l.indexOf("="),d=this._findOption(l.slice(0,f));if(d&&(d.required||d.optional)){this.emit(`option:${d.name()}`,l.slice(f+1));continue}}if(o===r&&i(l)&&!(this.commands.length===0&&a(l))&&(o=n),(this._enablePositionalOptions||this._passThroughOptions)&&r.length===0&&n.length===0){if(this._findCommand(l)){r.push(l),n.push(...e.slice(c));break}else if(this._getHelpCommand()&&l===this._getHelpCommand().name()){r.push(l,...e.slice(c));break}else if(this._defaultCommandName){n.push(l,...e.slice(c));break}}if(this._passThroughOptions){o.push(l,...e.slice(c));break}o.push(l)}return{operands:r,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},r=this.options.length;for(let n=0;n<r;n++){let o=this.options[n].attributeName();e[o]=o===this._versionOptionName?this._version:this[o]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,r)=>Object.assign(e,r.opts()),{})}error(e,r){this._outputConfiguration.outputError(`${e}
22
22
  `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
23
23
  `):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
24
- `),this.outputHelp({error:!0}));let n=r||{},o=n.exitCode||1,i=n.code||"commander.error";this._exit(o,i,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in ve.env){let r=e.attributeName();(this.getOptionValue(r)===void 0||["default","config","env"].includes(this.getOptionValueSource(r)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,ve.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new e$(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=s=>{let a=s.attributeName(),u=this.getOptionValue(a),c=this.options.find(f=>f.negate&&a===f.attributeName()),l=this.options.find(f=>!f.negate&&a===f.attributeName());return c&&(c.presetArg===void 0&&u===!1||c.presetArg!==void 0&&u===c.presetArg)?c:l||s},o=s=>{let a=n(s),u=a.attributeName();return this.getOptionValueSource(u)==="env"?`environment variable '${a.envVar}'`:`option '${a.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 s=i.createHelp().visibleOptions(i).filter(a=>a.long).map(a=>a.long);o=o.concat(s),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=>Jk(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=Qr.basename(e,Qr.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=a=>this._outputConfiguration.writeErr(a),o=this._outputConfiguration.getErrHasColors(),i=this._outputConfiguration.getErrHelpWidth()):(n=a=>this._outputConfiguration.writeOut(a),o=this._outputConfiguration.getOutHasColors(),i=this._outputConfiguration.getOutHelpWidth()),{error:r,write:a=>(o||(a=this._outputConfiguration.stripColor(a)),n(a)),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(s=>s.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(s=>s.emit("afterAllHelp",o))}helpOption(e,r){return typeof e=="boolean"?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??"-h, --help",r??"display help for command"),(e||r)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let r=Number(ve.exitCode??0);r===0&&e&&typeof e!="function"&&e.error&&(r=1),this._exit(r,"commander.help","(outputHelp)")}addHelpText(e,r){let n=["beforeAll","before","after","afterAll"];if(!n.includes(e))throw new Error(`Unexpected value for position to addHelpText.
26
- Expecting one of '${n.join("', '")}'`);let o=`${e}Help`;return this.on(o,i=>{let s;typeof r=="function"?s=r({error:i.error,command:i.command}):s=r,s&&i.write(`${s}
27
- `)}),this}_outputHelpIfRequested(e){let r=this._getHelpOption();r&&e.find(o=>r.is(o))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function oy(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 Xf(){if(ve.env.NO_COLOR||ve.env.FORCE_COLOR==="0"||ve.env.FORCE_COLOR==="false")return!1;if(ve.env.FORCE_COLOR||ve.env.CLICOLOR_FORCE!==void 0)return!0}Yf.Command=Kf;Yf.useColor=Xf});var cy=C(ir=>{var{Argument:sy}=ou(),{Command:Jf}=iy(),{CommanderError:t$,InvalidArgumentError:ay}=Es(),{Help:r$}=Mf(),{Option:uy}=zf();ir.program=new Jf;ir.createCommand=t=>new Jf(t);ir.createOption=(t,e)=>new uy(t,e);ir.createArgument=(t,e)=>new sy(t,e);ir.Command=Jf;ir.Option=uy;ir.Argument=sy;ir.Help=r$;ir.CommanderError=t$;ir.InvalidArgumentError=ay;ir.InvalidOptionArgumentError=ay});var Qf=C((lG,fy)=>{"use strict";var Zf={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"},o$={up:(t=1)=>"\x1B[S".repeat(t),down:(t=1)=>"\x1B[T".repeat(t)},i$={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?Zf.up():"");return t&&(e+=Zf.left),e}};fy.exports={cursor:Zf,scroll:o$,erase:i$,beep:"\x07"}});var tp=C((fG,ep)=>{var au=process||{},py=au.argv||[],su=au.env||{},s$=!(su.NO_COLOR||py.includes("--no-color"))&&(!!su.FORCE_COLOR||py.includes("--color")||au.platform==="win32"||(au.stdout||{}).isTTY&&su.TERM!=="dumb"||!!su.CI),a$=(t,e,r=t)=>n=>{let o=""+n,i=o.indexOf(e,t.length);return~i?t+u$(o,e,r,i)+e:t+o+e},u$=(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)},dy=(t=s$)=>{let e=t?a$:()=>String;return{isColorSupported:t,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};ep.exports=dy();ep.exports.createColors=dy});var gu=C(Ht=>{"use strict";Object.defineProperty(Ht,"__esModule",{value:!0});Ht.isNXMonorepo=Ht.isMonorepo=Ht.findPackageRelativePathInMonorepo=Ht.findPackagePath=Ht.findNXMonorepoRoot=Ht.findMonorepoRoot=void 0;var xs=require("node:fs"),En=require("node:path");function mu(t){let e=(0,En.join)(t,"package.json"),r=(0,En.join)(t,"pnpm-workspace.yaml");if((0,xs.existsSync)(r)||(0,xs.existsSync)(e)&&JSON.parse((0,xs.readFileSync)(e,"utf-8")).workspaces)return t;let n=(0,En.dirname)(t);if(n===t)throw new Error("Monorepo root not found");return mu(n)}Ht.findMonorepoRoot=mu;function hp(t){let e=(0,En.join)(t,"nx.json");if((0,xs.existsSync)(e))return t;let r=(0,En.dirname)(t);if(r===t)throw new Error("Monorepo root not found");return hp(r)}Ht.findNXMonorepoRoot=hp;function mp(t,e,r){let n=(0,En.join)(e,"node_modules",t);if((0,xs.existsSync)(n))return n;if(e===r)return null;let o=(0,En.dirname)(e);return mp(t,o,r)}Ht.findPackagePath=mp;function U$(t,e){let r=mu(e),n=mp(t,e,r);return n?(0,En.relative)(e,n):null}Ht.findPackageRelativePathInMonorepo=U$;function M$(t){try{return mu(t),!0}catch{return!1}}Ht.isMonorepo=M$;function q$(t){try{return hp(t),!0}catch{return!1}}Ht.isNXMonorepo=q$});var de={};wn(de,{__addDisposableResource:()=>m0,__assign:()=>Cu,__asyncDelegator:()=>a0,__asyncGenerator:()=>s0,__asyncValues:()=>u0,__await:()=>Jo,__awaiter:()=>e0,__classPrivateFieldGet:()=>p0,__classPrivateFieldIn:()=>h0,__classPrivateFieldSet:()=>d0,__createBinding:()=>xu,__decorate:()=>Wy,__disposeResources:()=>g0,__esDecorate:()=>Xy,__exportStar:()=>r0,__extends:()=>zy,__generator:()=>t0,__importDefault:()=>f0,__importStar:()=>l0,__makeTemplateObject:()=>c0,__metadata:()=>Qy,__param:()=>Ky,__propKey:()=>Jy,__read:()=>_p,__rest:()=>Gy,__rewriteRelativeImportExtension:()=>D0,__runInitializers:()=>Yy,__setFunctionName:()=>Zy,__spread:()=>n0,__spreadArray:()=>i0,__spreadArrays:()=>o0,__values:()=>_u,default:()=>p3});function zy(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Ep(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Gy(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 Wy(t,e,r,n){var o=arguments.length,i=o<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(i=(o<3?s(i):o>3?s(e,r,i):s(e,r))||i);return o>3&&i&&Object.defineProperty(e,r,i),i}function Ky(t,e){return function(r,n){e(r,n,t)}}function Xy(t,e,r,n,o,i){function s(E){if(E!==void 0&&typeof E!="function")throw new TypeError("Function expected");return E}for(var a=n.kind,u=a==="getter"?"get":a==="setter"?"set":"value",c=!e&&t?n.static?t:t.prototype:null,l=e||(c?Object.getOwnPropertyDescriptor(c,n.name):{}),f,h=!1,d=r.length-1;d>=0;d--){var m={};for(var b in n)m[b]=b==="access"?{}:n[b];for(var b in n.access)m.access[b]=n.access[b];m.addInitializer=function(E){if(h)throw new TypeError("Cannot add initializers after decoration has completed");i.push(s(E||null))};var D=(0,r[d])(a==="accessor"?{get:l.get,set:l.set}:l[u],m);if(a==="accessor"){if(D===void 0)continue;if(D===null||typeof D!="object")throw new TypeError("Object expected");(f=s(D.get))&&(l.get=f),(f=s(D.set))&&(l.set=f),(f=s(D.init))&&o.unshift(f)}else(f=s(D))&&(a==="field"?o.unshift(f):l[u]=f)}c&&Object.defineProperty(c,n.name,l),h=!0}function Yy(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 Jy(t){return typeof t=="symbol"?t:"".concat(t)}function Zy(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 Qy(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function e0(t,e,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(l){try{c(n.next(l))}catch(f){s(f)}}function u(l){try{c(n.throw(l))}catch(f){s(f)}}function c(l){l.done?i(l.value):o(l.value).then(a,u)}c((n=n.apply(t,e||[])).next())})}function t0(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(c){return function(l){return u([c,l])}}function u(c){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(r=0)),r;)try{if(n=1,o&&(i=c[0]&2?o.return:c[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,c[1])).done)return i;switch(o=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,o=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=e.call(t,r)}catch(l){c=[6,l],o=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function r0(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&xu(e,t,r)}function _u(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 _p(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),o,i=[],s;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i}function n0(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(_p(arguments[e]));return t}function o0(){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],s=0,a=i.length;s<a;s++,o++)n[o]=i[s];return n}function i0(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 Jo(t){return this instanceof Jo?(this.v=t,this):new Jo(t)}function s0(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),a("next"),a("throw"),a("return",s),o[Symbol.asyncIterator]=function(){return this},o;function s(d){return function(m){return Promise.resolve(m).then(d,f)}}function a(d,m){n[d]&&(o[d]=function(b){return new Promise(function(D,E){i.push([d,b,D,E])>1||u(d,b)})},m&&(o[d]=m(o[d])))}function u(d,m){try{c(n[d](m))}catch(b){h(i[0][3],b)}}function c(d){d.value instanceof Jo?Promise.resolve(d.value.v).then(l,f):h(i[0][2],d)}function l(d){u("next",d)}function f(d){u("throw",d)}function h(d,m){d(m),i.shift(),i.length&&u(i[0][0],i[0][1])}}function a0(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(s){return(r=!r)?{value:Jo(t[o](s)),done:!1}:i?i(s):s}:i}}function u0(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 _u=="function"?_u(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(s){return new Promise(function(a,u){s=t[i](s),o(a,u,s.done,s.value)})}}function o(i,s,a,u){Promise.resolve(u).then(function(c){i({value:c,done:a})},s)}}function c0(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function l0(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=Cp(t),n=0;n<r.length;n++)r[n]!=="default"&&xu(e,t,r[n]);return l3(e,t),e}function f0(t){return t&&t.__esModule?t:{default:t}}function p0(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 d0(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 h0(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 m0(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 g0(t){function e(i){t.error=t.hasError?new f3(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(s){return e(s),o()})}else n|=1}catch(s){e(s)}if(n===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return o()}function D0(t,e){return typeof t=="string"&&/^\.\.?\//.test(t)?t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(r,n,o,i,s){return n?e?".jsx":".js":o&&(!i||!s)?r:o+i+"."+s.toLowerCase()+"js"}):t}var Ep,Cu,xu,l3,Cp,f3,p3,he=it(()=>{Ep=function(t,e){return Ep=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])},Ep(t,e)};Cu=function(){return Cu=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},Cu.apply(this,arguments)};xu=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]});l3=Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e},Cp=function(t){return Cp=Object.getOwnPropertyNames||function(e){var r=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[r.length]=n);return r},Cp(t)};f3=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};p3={__extends:zy,__assign:Cu,__rest:Gy,__decorate:Wy,__param:Ky,__esDecorate:Xy,__runInitializers:Yy,__propKey:Jy,__setFunctionName:Zy,__metadata:Qy,__awaiter:e0,__generator:t0,__createBinding:xu,__exportStar:r0,__values:_u,__read:_p,__spread:n0,__spreadArrays:o0,__spreadArray:i0,__await:Jo,__asyncGenerator:s0,__asyncDelegator:a0,__asyncValues:u0,__makeTemplateObject:c0,__importStar:l0,__importDefault:f0,__classPrivateFieldGet:p0,__classPrivateFieldSet:d0,__classPrivateFieldIn:h0,__addDisposableResource:m0,__disposeResources:g0,__rewriteRelativeImportExtension:D0}});var y0=C(Su=>{"use strict";Object.defineProperty(Su,"__esModule",{value:!0});Su.resolveFetch=void 0;var d3=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);Su.resolveFetch=d3});var Fp=C(ar=>{"use strict";Object.defineProperty(ar,"__esModule",{value:!0});ar.FunctionRegion=ar.FunctionsHttpError=ar.FunctionsRelayError=ar.FunctionsFetchError=ar.FunctionsError=void 0;var Zo=class extends Error{constructor(e,r="FunctionsError",n){super(e),this.name=r,this.context=n}};ar.FunctionsError=Zo;var xp=class extends Zo{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}};ar.FunctionsFetchError=xp;var Sp=class extends Zo{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}};ar.FunctionsRelayError=Sp;var Ap=class extends Zo{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}};ar.FunctionsHttpError=Ap;var b0;(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"})(b0||(ar.FunctionRegion=b0={}))});var w0=C(Au=>{"use strict";Object.defineProperty(Au,"__esModule",{value:!0});Au.FunctionsClient=void 0;var h3=(he(),oe(de)),m3=y0(),eo=Fp(),Op=class{constructor(e,{headers:r={},customFetch:n,region:o=eo.FunctionRegion.Any}={}){this.url=e,this.headers=r,this.region=o,this.fetch=(0,m3.resolveFetch)(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return h3.__awaiter(this,arguments,void 0,function*(r,n={}){var o;try{let{headers:i,method:s,body:a,signal:u}=n,c={},{region:l}=n;l||(l=this.region);let f=new URL(`${this.url}/${r}`);l&&l!=="any"&&(c["x-region"]=l,f.searchParams.set("forceFunctionRegion",l));let h;a&&(i&&!Object.prototype.hasOwnProperty.call(i,"Content-Type")||!i)?typeof Blob<"u"&&a instanceof Blob||a instanceof ArrayBuffer?(c["Content-Type"]="application/octet-stream",h=a):typeof a=="string"?(c["Content-Type"]="text/plain",h=a):typeof FormData<"u"&&a instanceof FormData?h=a:(c["Content-Type"]="application/json",h=JSON.stringify(a)):h=a;let d=yield this.fetch(f.toString(),{method:s||"POST",headers:Object.assign(Object.assign(Object.assign({},c),this.headers),i),body:h,signal:u}).catch(E=>{throw E.name==="AbortError"?E:new eo.FunctionsFetchError(E)}),m=d.headers.get("x-relay-error");if(m&&m==="true")throw new eo.FunctionsRelayError(d);if(!d.ok)throw new eo.FunctionsHttpError(d);let b=((o=d.headers.get("Content-Type"))!==null&&o!==void 0?o:"text/plain").split(";")[0].trim(),D;return b==="application/json"?D=yield d.json():b==="application/octet-stream"||b==="application/pdf"?D=yield d.blob():b==="text/event-stream"?D=d:b==="multipart/form-data"?D=yield d.formData():D=yield d.text(),{data:D,error:null,response:d}}catch(i){return i instanceof Error&&i.name==="AbortError"?{data:null,error:new eo.FunctionsFetchError(i)}:{data:null,error:i,response:i instanceof eo.FunctionsHttpError||i instanceof eo.FunctionsRelayError?i.context:void 0}}})}};Au.FunctionsClient=Op});var kp=C(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.FunctionRegion=Vt.FunctionsRelayError=Vt.FunctionsHttpError=Vt.FunctionsFetchError=Vt.FunctionsError=Vt.FunctionsClient=void 0;var g3=w0();Object.defineProperty(Vt,"FunctionsClient",{enumerable:!0,get:function(){return g3.FunctionsClient}});var ks=Fp();Object.defineProperty(Vt,"FunctionsError",{enumerable:!0,get:function(){return ks.FunctionsError}});Object.defineProperty(Vt,"FunctionsFetchError",{enumerable:!0,get:function(){return ks.FunctionsFetchError}});Object.defineProperty(Vt,"FunctionsHttpError",{enumerable:!0,get:function(){return ks.FunctionsHttpError}});Object.defineProperty(Vt,"FunctionsRelayError",{enumerable:!0,get:function(){return ks.FunctionsRelayError}});Object.defineProperty(Vt,"FunctionRegion",{enumerable:!0,get:function(){return ks.FunctionRegion}})});var Tp=C(Pp=>{"use strict";Object.defineProperty(Pp,"__esModule",{value:!0});var $p=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}};Pp.default=$p});var Bp=C(Ip=>{"use strict";Object.defineProperty(Ip,"__esModule",{value:!0});var D3=(he(),oe(de)),y3=D3.__importDefault(Tp()),Rp=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 s,a,u,c;let l=null,f=null,h=null,d=i.status,m=i.statusText;if(i.ok){if(this.method!=="HEAD"){let _=await i.text();_===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&(!((s=this.headers.get("Accept"))===null||s===void 0)&&s.includes("application/vnd.pgrst.plan+text"))?f=_:f=JSON.parse(_))}let D=(a=this.headers.get("Prefer"))===null||a===void 0?void 0:a.match(/count=(exact|planned|estimated)/),E=(u=i.headers.get("content-range"))===null||u===void 0?void 0:u.split("/");D&&E&&E.length>1&&(h=parseInt(E[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(f)&&(f.length>1?(l={code:"PGRST116",details:`Results contain ${f.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},f=null,h=null,d=406,m="Not Acceptable"):f.length===1?f=f[0]:f=null)}else{let D=await i.text();try{l=JSON.parse(D),Array.isArray(l)&&i.status===404&&(f=[],l=null,d=200,m="OK")}catch{i.status===404&&D===""?(d=204,m="No Content"):l={message:D}}if(l&&this.isMaybeSingle&&(!((c=l?.details)===null||c===void 0)&&c.includes("0 rows"))&&(l=null,d=200,m="OK"),l&&this.shouldThrowOnError)throw new y3.default(l)}return{error:l,data:f,count:h,status:d,statusText:m}});return this.shouldThrowOnError||(o=o.catch(i=>{var s,a,u;return{error:{message:`${(s=i?.name)!==null&&s!==void 0?s:"FetchError"}: ${i?.message}`,details:`${(a=i?.stack)!==null&&a!==void 0?a:""}`,hint:"",code:`${(u=i?.code)!==null&&u!==void 0?u:""}`},data:null,count:null,status:0,statusText:""}})),o.then(e,r)}returns(){return this}overrideTypes(){return this}};Ip.default=Rp});var jp=C(Lp=>{"use strict";Object.defineProperty(Lp,"__esModule",{value:!0});var b3=(he(),oe(de)),w3=b3.__importDefault(Bp()),Np=class extends w3.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 s=i?`${i}.order`:"order",a=this.url.searchParams.get(s);return this.url.searchParams.set(s,`${a?`${a},`:""}${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`,s=typeof o>"u"?"limit":`${o}.limit`;return this.url.searchParams.set(i,`${e}`),this.url.searchParams.set(s,`${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:s="text"}={}){var a;let u=[e?"analyze":null,r?"verbose":null,n?"settings":null,o?"buffers":null,i?"wal":null].filter(Boolean).join("|"),c=(a=this.headers.get("Accept"))!==null&&a!==void 0?a:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${s}; for="${c}"; options=${u};`),s==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};Lp.default=Np});var Fu=C(Mp=>{"use strict";Object.defineProperty(Mp,"__esModule",{value:!0});var v3=(he(),oe(de)),E3=v3.__importDefault(jp()),C3=new RegExp("[,()]"),Up=class extends E3.default{eq(e,r){return this.url.searchParams.append(e,`eq.${r}`),this}neq(e,r){return this.url.searchParams.append(e,`neq.${r}`),this}gt(e,r){return this.url.searchParams.append(e,`gt.${r}`),this}gte(e,r){return this.url.searchParams.append(e,`gte.${r}`),this}lt(e,r){return this.url.searchParams.append(e,`lt.${r}`),this}lte(e,r){return this.url.searchParams.append(e,`lte.${r}`),this}like(e,r){return this.url.searchParams.append(e,`like.${r}`),this}likeAllOf(e,r){return this.url.searchParams.append(e,`like(all).{${r.join(",")}}`),this}likeAnyOf(e,r){return this.url.searchParams.append(e,`like(any).{${r.join(",")}}`),this}ilike(e,r){return this.url.searchParams.append(e,`ilike.${r}`),this}ilikeAllOf(e,r){return this.url.searchParams.append(e,`ilike(all).{${r.join(",")}}`),this}ilikeAnyOf(e,r){return this.url.searchParams.append(e,`ilike(any).{${r.join(",")}}`),this}is(e,r){return this.url.searchParams.append(e,`is.${r}`),this}in(e,r){let n=Array.from(new Set(r)).map(o=>typeof o=="string"&&C3.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 s=n===void 0?"":`(${n})`;return this.url.searchParams.append(e,`${i}fts${s}.${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}};Mp.default=Up});var Vp=C(Hp=>{"use strict";Object.defineProperty(Hp,"__esModule",{value:!0});var _3=(he(),oe(de)),$s=_3.__importDefault(Fu()),qp=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",s=!1,a=(e??"*").split("").map(u=>/\s/.test(u)&&!s?"":(u==='"'&&(s=!s),u)).join("");return this.url.searchParams.set("select",a),o&&this.headers.append("Prefer",`count=${o}`),new $s.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 s=e.reduce((a,u)=>a.concat(Object.keys(u)),[]);if(s.length>0){let a=[...new Set(s)].map(u=>`"${u}"`);this.url.searchParams.set("columns",a.join(","))}}return new $s.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 s;let a="POST";if(this.headers.append("Prefer",`resolution=${n?"ignore":"merge"}-duplicates`),r!==void 0&&this.url.searchParams.set("on_conflict",r),o&&this.headers.append("Prefer",`count=${o}`),i||this.headers.append("Prefer","missing=default"),Array.isArray(e)){let u=e.reduce((c,l)=>c.concat(Object.keys(l)),[]);if(u.length>0){let c=[...new Set(u)].map(l=>`"${l}"`);this.url.searchParams.set("columns",c.join(","))}}return new $s.default({method:a,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(s=this.fetch)!==null&&s!==void 0?s:fetch})}update(e,{count:r}={}){var n;let o="PATCH";return r&&this.headers.append("Prefer",`count=${r}`),new $s.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 $s.default({method:n,url:this.url,headers:this.headers,schema:this.schema,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}};Hp.default=qp});var E0=C(Gp=>{"use strict";Object.defineProperty(Gp,"__esModule",{value:!0});var v0=(he(),oe(de)),x3=v0.__importDefault(Vp()),S3=v0.__importDefault(Fu()),zp=class t{constructor(e,{headers:r={},schema:n,fetch:o}={}){this.url=e,this.headers=new Headers(r),this.schemaName=n,this.fetch=o}from(e){let r=new URL(`${this.url}/${e}`);return new x3.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 s;let a,u=new URL(`${this.url}/rpc/${e}`),c;n||o?(a=n?"HEAD":"GET",Object.entries(r).filter(([f,h])=>h!==void 0).map(([f,h])=>[f,Array.isArray(h)?`{${h.join(",")}}`:`${h}`]).forEach(([f,h])=>{u.searchParams.append(f,h)})):(a="POST",c=r);let l=new Headers(this.headers);return i&&l.set("Prefer",`count=${i}`),new S3.default({method:a,url:u,headers:l,schema:this.schemaName,body:c,fetch:(s=this.fetch)!==null&&s!==void 0?s:fetch})}};Gp.default=zp});var Wp=C(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.PostgrestError=Tt.PostgrestBuilder=Tt.PostgrestTransformBuilder=Tt.PostgrestFilterBuilder=Tt.PostgrestQueryBuilder=Tt.PostgrestClient=void 0;var Qo=(he(),oe(de)),C0=Qo.__importDefault(E0());Tt.PostgrestClient=C0.default;var _0=Qo.__importDefault(Vp());Tt.PostgrestQueryBuilder=_0.default;var x0=Qo.__importDefault(Fu());Tt.PostgrestFilterBuilder=x0.default;var S0=Qo.__importDefault(jp());Tt.PostgrestTransformBuilder=S0.default;var A0=Qo.__importDefault(Bp());Tt.PostgrestBuilder=A0.default;var F0=Qo.__importDefault(Tp());Tt.PostgrestError=F0.default;Tt.default={PostgrestClient:C0.default,PostgrestQueryBuilder:_0.default,PostgrestFilterBuilder:x0.default,PostgrestTransformBuilder:S0.default,PostgrestBuilder:A0.default,PostgrestError:F0.default}});var Xp={};wn(Xp,{RealtimeClient:()=>Kp});var Kp,Yp=it(()=>{Kp=class{constructor(){}connect(){}disconnect(){}}});var xn=C(tn=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0});tn.StorageUnknownError=tn.StorageApiError=tn.StorageError=void 0;tn.isStorageError=A3;var Ps=class extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}};tn.StorageError=Ps;function A3(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var Jp=class extends Ps{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}}};tn.StorageApiError=Jp;var Zp=class extends Ps{constructor(e,r){super(e),this.name="StorageUnknownError",this.originalError=r}};tn.StorageUnknownError=Zp});var Ts=C(ur=>{"use strict";Object.defineProperty(ur,"__esModule",{value:!0});ur.isPlainObject=ur.recursiveToCamel=ur.resolveResponse=ur.resolveFetch=void 0;var F3=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);ur.resolveFetch=F3;var O3=()=>Response;ur.resolveResponse=O3;var k3=t=>{if(Array.isArray(t))return t.map(r=>(0,ur.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,ur.recursiveToCamel)(n)}),e};ur.recursiveToCamel=k3;var $3=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)};ur.isPlainObject=$3});var Ou=C(ro=>{"use strict";Object.defineProperty(ro,"__esModule",{value:!0});ro.get=R3;ro.post=I3;ro.put=B3;ro.head=N3;ro.remove=L3;var to=(he(),oe(de)),Qp=xn(),O0=Ts(),ed=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)},P3=(t,e,r)=>to.__awaiter(void 0,void 0,void 0,function*(){let n=yield(0,O0.resolveResponse)();t instanceof n&&!r?.noResolveJson?t.json().then(o=>{let i=t.status||500,s=o?.statusCode||i+"";e(new Qp.StorageApiError(ed(o),i,s))}).catch(o=>{e(new Qp.StorageUnknownError(ed(o),o))}):e(new Qp.StorageUnknownError(ed(t),t))}),T3=(t,e,r,n)=>{let o={method:t,headers:e?.headers||{}};return t==="GET"||!n?o:((0,O0.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 Rs(t,e,r,n,o,i){return to.__awaiter(this,void 0,void 0,function*(){return new Promise((s,a)=>{t(r,T3(e,n,o,i)).then(u=>{if(!u.ok)throw u;return n?.noResolveJson?u:u.json()}).then(u=>s(u)).catch(u=>P3(u,a,n))})})}function R3(t,e,r,n){return to.__awaiter(this,void 0,void 0,function*(){return Rs(t,"GET",e,r,n)})}function I3(t,e,r,n,o){return to.__awaiter(this,void 0,void 0,function*(){return Rs(t,"POST",e,n,o,r)})}function B3(t,e,r,n,o){return to.__awaiter(this,void 0,void 0,function*(){return Rs(t,"PUT",e,n,o,r)})}function N3(t,e,r,n){return to.__awaiter(this,void 0,void 0,function*(){return Rs(t,"HEAD",e,Object.assign(Object.assign({},r),{noResolveJson:!0}),n)})}function L3(t,e,r,n,o){return to.__awaiter(this,void 0,void 0,function*(){return Rs(t,"DELETE",e,n,o,r)})}});var k0=C(rd=>{"use strict";Object.defineProperty(rd,"__esModule",{value:!0});var j3=(he(),oe(de)),U3=xn(),td=class{constructor(e,r){this.downloadFn=e,this.shouldThrowOnError=r}then(e,r){return this.execute().then(e,r)}execute(){return j3.__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,U3.isStorageError)(e))return{data:null,error:e};throw e}})}};rd.default=td});var T0=C(od=>{"use strict";var $0;Object.defineProperty(od,"__esModule",{value:!0});var P0=(he(),oe(de)),M3=xn(),q3=P0.__importDefault(k0()),nd=class{constructor(e,r){this.downloadFn=e,this.shouldThrowOnError=r,this[$0]="BlobDownloadBuilder",this.promise=null}asStream(){return new q3.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,M3.isStorageError)(e))return{data:null,error:e};throw e}})}};$0=Symbol.toStringTag;od.default=nd});var B0=C(sd=>{"use strict";Object.defineProperty(sd,"__esModule",{value:!0});var Rt=(he(),oe(de)),zt=xn(),Gt=Ou(),R0=Ts(),H3=Rt.__importDefault(T0()),V3={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},I0={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1},id=class{constructor(e,r={},n,o){this.shouldThrowOnError=!1,this.url=e,this.headers=r,this.bucketId=n,this.fetch=(0,R0.resolveFetch)(o)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(e,r,n,o){return Rt.__awaiter(this,void 0,void 0,function*(){try{let i,s=Object.assign(Object.assign({},I0),o),a=Object.assign(Object.assign({},this.headers),e==="POST"&&{"x-upsert":String(s.upsert)}),u=s.metadata;typeof Blob<"u"&&n instanceof Blob?(i=new FormData,i.append("cacheControl",s.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",s.cacheControl),u&&!i.has("metadata")&&i.append("metadata",this.encodeMetadata(u))):(i=n,a["cache-control"]=`max-age=${s.cacheControl}`,a["content-type"]=s.contentType,u&&(a["x-metadata"]=this.toBase64(this.encodeMetadata(u))),(typeof ReadableStream<"u"&&i instanceof ReadableStream||i&&typeof i=="object"&&"pipe"in i&&typeof i.pipe=="function")&&!s.duplex&&(s.duplex="half")),o?.headers&&(a=Object.assign(Object.assign({},a),o.headers));let c=this._removeEmptyFolders(r),l=this._getFinalPath(c),f=yield(e=="PUT"?Gt.put:Gt.post)(this.fetch,`${this.url}/object/${l}`,i,Object.assign({headers:a},s?.duplex?{duplex:s.duplex}:{}));return{data:{path:c,id:f.Id,fullPath:f.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 Rt.__awaiter(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,r,n)})}uploadToSignedUrl(e,r,n,o){return Rt.__awaiter(this,void 0,void 0,function*(){let i=this._removeEmptyFolders(e),s=this._getFinalPath(i),a=new URL(this.url+`/object/upload/sign/${s}`);a.searchParams.set("token",r);try{let u,c=Object.assign({upsert:I0.upsert},o),l=Object.assign(Object.assign({},this.headers),{"x-upsert":String(c.upsert)});typeof Blob<"u"&&n instanceof Blob?(u=new FormData,u.append("cacheControl",c.cacheControl),u.append("",n)):typeof FormData<"u"&&n instanceof FormData?(u=n,u.append("cacheControl",c.cacheControl)):(u=n,l["cache-control"]=`max-age=${c.cacheControl}`,l["content-type"]=c.contentType);let f=yield(0,Gt.put)(this.fetch,a.toString(),u,{headers:l});return{data:{path:i,fullPath:f.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 Rt.__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,Gt.post)(this.fetch,`${this.url}/object/upload/sign/${n}`,{},{headers:o}),s=new URL(this.url+i.url),a=s.searchParams.get("token");if(!a)throw new zt.StorageError("No token returned by API");return{data:{signedUrl:s.toString(),path:e,token:a},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 Rt.__awaiter(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,r,n)})}move(e,r,n){return Rt.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Gt.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 Rt.__awaiter(this,void 0,void 0,function*(){try{return{data:{path:(yield(0,Gt.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 Rt.__awaiter(this,void 0,void 0,function*(){try{let o=this._getFinalPath(e),i=yield(0,Gt.post)(this.fetch,`${this.url}/object/sign/${o}`,Object.assign({expiresIn:r},n?.transform?{transform:n.transform}:{}),{headers:this.headers}),s=n?.download?`&download=${n.download===!0?"":n.download}`:"";return i={signedUrl:encodeURI(`${this.url}${i.signedURL}${s}`)},{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 Rt.__awaiter(this,void 0,void 0,function*(){try{let o=yield(0,Gt.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(s=>Object.assign(Object.assign({},s),{signedUrl:s.signedURL?encodeURI(`${this.url}${s.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||{}),s=i?`?${i}`:"",a=this._getFinalPath(e),u=()=>(0,Gt.get)(this.fetch,`${this.url}/${o}/${a}${s}`,{headers:this.headers,noResolveJson:!0});return new H3.default(u,this.shouldThrowOnError)}info(e){return Rt.__awaiter(this,void 0,void 0,function*(){let r=this._getFinalPath(e);try{let n=yield(0,Gt.get)(this.fetch,`${this.url}/object/info/${r}`,{headers:this.headers});return{data:(0,R0.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 Rt.__awaiter(this,void 0,void 0,function*(){let r=this._getFinalPath(e);try{return yield(0,Gt.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 a=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}/${a}/public/${n}${c}`)}}}remove(e){return Rt.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Gt.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 Rt.__awaiter(this,void 0,void 0,function*(){try{let o=Object.assign(Object.assign(Object.assign({},V3),r),{prefix:e||""});return{data:yield(0,Gt.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 Rt.__awaiter(this,void 0,void 0,function*(){try{let n=Object.assign({},e);return{data:yield(0,Gt.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("&")}};sd.default=id});var ad=C(ku=>{"use strict";Object.defineProperty(ku,"__esModule",{value:!0});ku.version=void 0;ku.version="2.79.0"});var ud=C($u=>{"use strict";Object.defineProperty($u,"__esModule",{value:!0});$u.DEFAULT_HEADERS=void 0;var z3=ad();$u.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${z3.version}`}});var N0=C(ld=>{"use strict";Object.defineProperty(ld,"__esModule",{value:!0});var ei=(he(),oe(de)),G3=ud(),ti=xn(),ri=Ou(),W3=Ts(),cd=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({},G3.DEFAULT_HEADERS),r),this.fetch=(0,W3.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(e){return ei.__awaiter(this,void 0,void 0,function*(){try{let r=this.listBucketOptionsToQueryString(e);return{data:yield(0,ri.get)(this.fetch,`${this.url}/bucket${r}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ti.isStorageError)(r))return{data:null,error:r};throw r}})}getBucket(e){return ei.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ri.get)(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ti.isStorageError)(r))return{data:null,error:r};throw r}})}createBucket(e){return ei.__awaiter(this,arguments,void 0,function*(r,n={public:!1}){try{return{data:yield(0,ri.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,ti.isStorageError)(o))return{data:null,error:o};throw o}})}updateBucket(e,r){return ei.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ri.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,ti.isStorageError)(n))return{data:null,error:n};throw n}})}emptyBucket(e){return ei.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ri.post)(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ti.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return ei.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ri.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ti.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():""}};ld.default=cd});var gd=C(md=>{"use strict";Object.defineProperty(md,"__esModule",{value:!0});var fd=(he(),oe(de)),K3=ud(),pd=xn(),dd=Ou(),X3=Ts(),hd=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},K3.DEFAULT_HEADERS),r),this.fetch=(0,X3.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return fd.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,dd.post)(this.fetch,`${this.url}/bucket`,{name:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,pd.isStorageError)(r))return{data:null,error:r};throw r}})}listBuckets(e){return fd.__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,dd.get)(this.fetch,o,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,pd.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return fd.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,dd.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,pd.isStorageError)(r))return{data:null,error:r};throw r}})}};md.default=hd});var Tu=C(Pu=>{"use strict";Object.defineProperty(Pu,"__esModule",{value:!0});Pu.DEFAULT_HEADERS=void 0;var Y3=ad();Pu.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${Y3.version}`,"Content-Type":"application/json"}});var ni=C(Or=>{"use strict";Object.defineProperty(Or,"__esModule",{value:!0});Or.StorageVectorsErrorCode=Or.StorageVectorsUnknownError=Or.StorageVectorsApiError=Or.StorageVectorsError=void 0;Or.isStorageVectorsError=J3;var Is=class extends Error{constructor(e){super(e),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};Or.StorageVectorsError=Is;function J3(t){return typeof t=="object"&&t!==null&&"__isStorageVectorsError"in t}var Dd=class extends Is{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=Dd;var yd=class extends Is{constructor(e,r){super(e),this.name="StorageVectorsUnknownError",this.originalError=r}};Or.StorageVectorsUnknownError=yd;var L0;(function(t){t.InternalError="InternalError",t.S3VectorConflictException="S3VectorConflictException",t.S3VectorNotFoundException="S3VectorNotFoundException",t.S3VectorBucketNotEmpty="S3VectorBucketNotEmpty",t.S3VectorMaxBucketsExceeded="S3VectorMaxBucketsExceeded",t.S3VectorMaxIndexesExceeded="S3VectorMaxIndexesExceeded"})(L0||(Or.StorageVectorsErrorCode=L0={}))});var oi=C(cr=>{"use strict";Object.defineProperty(cr,"__esModule",{value:!0});cr.validateVectorDimension=cr.normalizeToFloat32=cr.isPlainObject=cr.resolveResponse=cr.resolveFetch=void 0;var Z3=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);cr.resolveFetch=Z3;var Q3=()=>Response;cr.resolveResponse=Q3;var eP=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)};cr.isPlainObject=eP;var tP=t=>Array.from(new Float32Array(t));cr.normalizeToFloat32=tP;var rP=(t,e)=>{if(e!==void 0&&t.float32.length!==e)throw new Error(`Vector dimension mismatch: expected ${e}, got ${t.float32.length}`)};cr.validateVectorDimension=rP});var Bu=C(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:!0});si.get=sP;si.post=aP;si.put=uP;si.remove=cP;var ii=(he(),oe(de)),Ru=ni(),nP=oi(),j0=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),oP=(t,e,r)=>ii.__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(s=>{let a=s?.statusCode||s?.code||o+"";e(new Ru.StorageVectorsApiError(j0(s),o,a))}).catch(()=>{let s=o+"",a=i.statusText||`HTTP ${o} error`;e(new Ru.StorageVectorsApiError(a,o,s))});else{let s=o+"",a=i.statusText||`HTTP ${o} error`;e(new Ru.StorageVectorsApiError(a,o,s))}}else e(new Ru.StorageVectorsUnknownError(j0(t),t))}),iP=(t,e,r,n)=>{let o={method:t,headers:e?.headers||{}};return t==="GET"||!n?o:((0,nP.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 ii.__awaiter(this,void 0,void 0,function*(){return new Promise((s,a)=>{t(r,iP(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=>s(u)).catch(u=>oP(u,a,n))})})}function sP(t,e,r,n){return ii.__awaiter(this,void 0,void 0,function*(){return Iu(t,"GET",e,r,n)})}function aP(t,e,r,n,o){return ii.__awaiter(this,void 0,void 0,function*(){return Iu(t,"POST",e,n,o,r)})}function uP(t,e,r,n,o){return ii.__awaiter(this,void 0,void 0,function*(){return Iu(t,"PUT",e,n,o,r)})}function cP(t,e,r,n,o){return ii.__awaiter(this,void 0,void 0,function*(){return Iu(t,"DELETE",e,n,o,r)})}});var vd=C(wd=>{"use strict";Object.defineProperty(wd,"__esModule",{value:!0});var Nu=(he(),oe(de)),lP=Tu(),Lu=ni(),ju=Bu(),fP=oi(),bd=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},lP.DEFAULT_HEADERS),r),this.fetch=(0,fP.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createIndex(e){return Nu.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,ju.post)(this.fetch,`${this.url}/CreateIndex`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Lu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getIndex(e,r){return Nu.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ju.post)(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:e,indexName:r},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Lu.isStorageVectorsError)(n))return{data:null,error:n};throw n}})}listIndexes(e){return Nu.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ju.post)(this.fetch,`${this.url}/ListIndexes`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Lu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteIndex(e,r){return Nu.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,ju.post)(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:e,indexName:r},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Lu.isStorageVectorsError)(n))return{data:null,error:n};throw n}})}};wd.default=bd});var _d=C(Cd=>{"use strict";Object.defineProperty(Cd,"__esModule",{value:!0});var Bs=(he(),oe(de)),pP=Tu(),Ns=ni(),Ls=Bu(),dP=oi(),Ed=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},pP.DEFAULT_HEADERS),r),this.fetch=(0,dP.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}putVectors(e){return Bs.__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,Ls.post)(this.fetch,`${this.url}/PutVectors`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ns.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getVectors(e){return Bs.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ls.post)(this.fetch,`${this.url}/GetVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ns.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}listVectors(e){return Bs.__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,Ls.post)(this.fetch,`${this.url}/ListVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ns.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}queryVectors(e){return Bs.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ls.post)(this.fetch,`${this.url}/QueryVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ns.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteVectors(e){return Bs.__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,Ls.post)(this.fetch,`${this.url}/DeleteVectors`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ns.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}};Cd.default=Ed});var Ad=C(Sd=>{"use strict";Object.defineProperty(Sd,"__esModule",{value:!0});var Uu=(he(),oe(de)),hP=Tu(),Mu=ni(),qu=Bu(),mP=oi(),xd=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},hP.DEFAULT_HEADERS),r),this.fetch=(0,mP.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return Uu.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,qu.post)(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Mu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getBucket(e){return Uu.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,qu.post)(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Mu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}listBuckets(){return Uu.__awaiter(this,arguments,void 0,function*(e={}){try{return{data:yield(0,qu.post)(this.fetch,`${this.url}/ListVectorBuckets`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Mu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return Uu.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,qu.post)(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Mu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}};Sd.default=xd});var U0=C(Sn=>{"use strict";Object.defineProperty(Sn,"__esModule",{value:!0});Sn.VectorIndexScope=Sn.VectorBucketScope=Sn.StorageVectorsClient=void 0;var lr=(he(),oe(de)),gP=lr.__importDefault(vd()),DP=lr.__importDefault(_d()),yP=lr.__importDefault(Ad()),Fd=class extends yP.default{constructor(e,r={}){super(e,r.headers||{},r.fetch)}from(e){return new Hu(this.url,this.headers,e,this.fetch)}};Sn.StorageVectorsClient=Fd;var Hu=class extends gP.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 lr.__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 lr.__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 lr.__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 lr.__awaiter(this,void 0,void 0,function*(){return r.deleteIndex.call(this,this.vectorBucketName,e)})}index(e){return new Vu(this.url,this.headers,this.vectorBucketName,e,this.fetch)}};Sn.VectorBucketScope=Hu;var Vu=class extends DP.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 lr.__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 lr.__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 lr.__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 lr.__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 lr.__awaiter(this,void 0,void 0,function*(){return r.deleteVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}};Sn.VectorIndexScope=Vu});var $d=C(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.validateVectorDimension=me.normalizeToFloat32=me.isPlainObject=me.resolveResponse=me.resolveFetch=me.isStorageVectorsError=me.StorageVectorsErrorCode=me.StorageVectorsUnknownError=me.StorageVectorsApiError=me.StorageVectorsError=me.VectorDataApi=me.VectorIndexApi=me.VectorBucketApi=me.VectorIndexScope=me.VectorBucketScope=me.StorageVectorsClient=void 0;var Od=(he(),oe(de)),kd=U0();Object.defineProperty(me,"StorageVectorsClient",{enumerable:!0,get:function(){return kd.StorageVectorsClient}});Object.defineProperty(me,"VectorBucketScope",{enumerable:!0,get:function(){return kd.VectorBucketScope}});Object.defineProperty(me,"VectorIndexScope",{enumerable:!0,get:function(){return kd.VectorIndexScope}});var bP=Ad();Object.defineProperty(me,"VectorBucketApi",{enumerable:!0,get:function(){return Od.__importDefault(bP).default}});var wP=vd();Object.defineProperty(me,"VectorIndexApi",{enumerable:!0,get:function(){return Od.__importDefault(wP).default}});var vP=_d();Object.defineProperty(me,"VectorDataApi",{enumerable:!0,get:function(){return Od.__importDefault(vP).default}});var js=ni();Object.defineProperty(me,"StorageVectorsError",{enumerable:!0,get:function(){return js.StorageVectorsError}});Object.defineProperty(me,"StorageVectorsApiError",{enumerable:!0,get:function(){return js.StorageVectorsApiError}});Object.defineProperty(me,"StorageVectorsUnknownError",{enumerable:!0,get:function(){return js.StorageVectorsUnknownError}});Object.defineProperty(me,"StorageVectorsErrorCode",{enumerable:!0,get:function(){return js.StorageVectorsErrorCode}});Object.defineProperty(me,"isStorageVectorsError",{enumerable:!0,get:function(){return js.isStorageVectorsError}});var Us=oi();Object.defineProperty(me,"resolveFetch",{enumerable:!0,get:function(){return Us.resolveFetch}});Object.defineProperty(me,"resolveResponse",{enumerable:!0,get:function(){return Us.resolveResponse}});Object.defineProperty(me,"isPlainObject",{enumerable:!0,get:function(){return Us.isPlainObject}});Object.defineProperty(me,"normalizeToFloat32",{enumerable:!0,get:function(){return Us.normalizeToFloat32}});Object.defineProperty(me,"validateVectorDimension",{enumerable:!0,get:function(){return Us.validateVectorDimension}})});var M0=C(zu=>{"use strict";Object.defineProperty(zu,"__esModule",{value:!0});zu.StorageClient=void 0;var Td=(he(),oe(de)),EP=Td.__importDefault(B0()),CP=Td.__importDefault(N0()),_P=Td.__importDefault(gd()),xP=$d(),Pd=class extends CP.default{constructor(e,r={},n,o){super(e,r,n,o)}from(e){return new EP.default(this.url,this.headers,e,this.fetch)}get vectors(){return new xP.StorageVectorsClient(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new _P.default(this.url+"/iceberg",this.headers,this.fetch)}};zu.StorageClient=Pd});var H0=C(q0=>{"use strict";Object.defineProperty(q0,"__esModule",{value:!0})});var V0=C(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.StorageAnalyticsApi=rn.StorageClient=void 0;var Gu=(he(),oe(de)),SP=M0();Object.defineProperty(rn,"StorageClient",{enumerable:!0,get:function(){return SP.StorageClient}});var AP=gd();Object.defineProperty(rn,"StorageAnalyticsApi",{enumerable:!0,get:function(){return Gu.__importDefault(AP).default}});Gu.__exportStar(H0(),rn);Gu.__exportStar(xn(),rn);Gu.__exportStar($d(),rn)});var z0=C(Wu=>{"use strict";Object.defineProperty(Wu,"__esModule",{value:!0});Wu.version=void 0;Wu.version="2.79.0"});var G0=C(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 FP=z0(),Ms="";typeof Deno<"u"?Ms="deno":typeof document<"u"?Ms="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Ms="react-native":Ms="node";er.DEFAULT_HEADERS={"X-Client-Info":`supabase-js-${Ms}/${FP.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 W0=C(Ir=>{"use strict";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.fetchWithAuth=Ir.resolveHeadersConstructor=Ir.resolveFetch=void 0;var OP=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);Ir.resolveFetch=OP;var kP=()=>Headers;Ir.resolveHeadersConstructor=kP;var $P=(t,e,r)=>{let n=(0,Ir.resolveFetch)(r),o=(0,Ir.resolveHeadersConstructor)();return async(i,s)=>{var a;let u=(a=await e())!==null&&a!==void 0?a:t,c=new o(s?.headers);return c.has("apikey")||c.set("apikey",t),c.has("Authorization")||c.set("Authorization",`Bearer ${u}`),n(i,Object.assign(Object.assign({},s),{headers:c}))}};Ir.fetchWithAuth=$P});var X0=C(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.isBrowser=void 0;An.uuid=PP;An.ensureTrailingSlash=K0;An.applySettingDefaults=RP;An.validateSupabaseUrl=IP;function PP(){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 K0(t){return t.endsWith("/")?t:t+"/"}var TP=()=>typeof window<"u";An.isBrowser=TP;function RP(t,e){var r,n;let{db:o,auth:i,realtime:s,global:a}=t,{db:u,auth:c,realtime:l,global:f}=e,h={db:Object.assign(Object.assign({},u),o),auth:Object.assign(Object.assign({},c),i),realtime:Object.assign(Object.assign({},l),s),storage:{},global:Object.assign(Object.assign(Object.assign({},f),a),{headers:Object.assign(Object.assign({},(r=f?.headers)!==null&&r!==void 0?r:{}),(n=a?.headers)!==null&&n!==void 0?n:{})}),accessToken:async()=>""};return t.accessToken?h.accessToken=t.accessToken:delete h.accessToken,h}function IP(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(K0(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}});var Gd={};wn(Gd,{AuthAdminApi:()=>Id,AuthApiError:()=>Bd,AuthClient:()=>Rd,AuthError:()=>kr,AuthImplicitGrantRedirectError:()=>Md,AuthInvalidCredentialsError:()=>Ud,AuthInvalidTokenResponseError:()=>jd,AuthPKCEGrantCodeExchangeError:()=>qd,AuthRetryableError:()=>Nd,AuthSessionMissingError:()=>Ld,AuthWeakPasswordError:()=>Hd,GoTrueAdminApi:()=>Xu,GoTrueClient:()=>Ku,NavigatorLockAcquireTimeoutError:()=>Vd,isAuthApiError:()=>UP,isAuthError:()=>jP,isAuthRetryableError:()=>MP,isAuthSessionMissingError:()=>qP,isAuthWeakPasswordError:()=>HP,lockInternals:()=>LP,navigatorLock:()=>BP,processLock:()=>NP});var zd,Y0,Ku,Xu,Rd,Id,kr,Bd,Nd,Ld,jd,Ud,Md,qd,Hd,BP,NP,Vd,LP,jP,UP,MP,qP,HP,Wd=it(()=>{zd=()=>Promise.resolve({data:{session:null,user:null},error:null}),Y0={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}):zd}},Ku=class{constructor(e){return this.options=e,new Proxy(this,Y0)}},Xu=class{constructor(e){return this.options=e,new Proxy(this,Y0)}},Rd=class extends Ku{},Id=class extends Xu{},kr=class extends Error{},Bd=class extends kr{},Nd=class extends kr{},Ld=class extends kr{},jd=class extends kr{},Ud=class extends kr{},Md=class extends kr{},qd=class extends kr{},Hd=class extends kr{},BP=zd,NP=zd,Vd=class extends Error{},LP={},jP=()=>!1,UP=()=>!1,MP=()=>!1,qP=()=>!1,HP=()=>!1});var J0=C(Yu=>{"use strict";Object.defineProperty(Yu,"__esModule",{value:!0});Yu.SupabaseAuthClient=void 0;var VP=(Wd(),oe(Gd)),Kd=class extends VP.AuthClient{constructor(e){super(e)}};Yu.SupabaseAuthClient=Kd});var Jd=C(Yd=>{"use strict";Object.defineProperty(Yd,"__esModule",{value:!0});var zP=kp(),GP=Wp(),WP=(Yp(),oe(Xp)),KP=V0(),Ju=G0(),XP=W0(),Z0=X0(),YP=J0(),Xd=class{constructor(e,r,n){var o,i,s;this.supabaseUrl=e,this.supabaseKey=r;let a=(0,Z0.validateSupabaseUrl)(e);if(!r)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",a),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",a),this.storageUrl=new URL("storage/v1",a),this.functionsUrl=new URL("functions/v1",a);let u=`sb-${a.hostname.split(".")[0]}-auth-token`,c={db:Ju.DEFAULT_DB_OPTIONS,realtime:Ju.DEFAULT_REALTIME_OPTIONS,auth:Object.assign(Object.assign({},Ju.DEFAULT_AUTH_OPTIONS),{storageKey:u}),global:Ju.DEFAULT_GLOBAL_OPTIONS},l=(0,Z0.applySettingDefaults)(n??{},c);this.storageKey=(o=l.auth.storageKey)!==null&&o!==void 0?o:"",this.headers=(i=l.global.headers)!==null&&i!==void 0?i:{},l.accessToken?(this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(f,h)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(h)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((s=l.auth)!==null&&s!==void 0?s:{},this.headers,l.global.fetch),this.fetch=(0,XP.fetchWithAuth)(r,this._getAccessToken.bind(this),l.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},l.realtime)),this.rest=new GP.PostgrestClient(new URL("rest/v1",a).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch}),this.storage=new KP.StorageClient(this.storageUrl.href,this.headers,this.fetch,n?.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new zP.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:s,flowType:a,lock:u,debug:c,throwOnError:l},f,h){let d={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new YP.SupabaseAuthClient({url:this.authUrl.href,headers:Object.assign(Object.assign({},d),f),storageKey:s,autoRefreshToken:e,persistSession:r,detectSessionInUrl:n,storage:o,userStorage:i,flowType:a,lock:u,debug:c,throwOnError:l,fetch:h,hasCustomAuthorizationHeader:Object.keys(this.headers).some(m=>m.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new WP.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)}};Yd.default=Xd});var tb=C(Ie=>{"use strict";var JP=Ie&&Ie.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),Q0=Ie&&Ie.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&JP(e,t,r)},eb=Ie&&Ie.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ie,"__esModule",{value:!0});Ie.createClient=Ie.SupabaseClient=Ie.FunctionRegion=Ie.FunctionsError=Ie.FunctionsRelayError=Ie.FunctionsFetchError=Ie.FunctionsHttpError=Ie.PostgrestError=void 0;var ZP=eb(Jd());Q0((Wd(),oe(Gd)),Ie);var QP=Wp();Object.defineProperty(Ie,"PostgrestError",{enumerable:!0,get:function(){return QP.PostgrestError}});var qs=kp();Object.defineProperty(Ie,"FunctionsHttpError",{enumerable:!0,get:function(){return qs.FunctionsHttpError}});Object.defineProperty(Ie,"FunctionsFetchError",{enumerable:!0,get:function(){return qs.FunctionsFetchError}});Object.defineProperty(Ie,"FunctionsRelayError",{enumerable:!0,get:function(){return qs.FunctionsRelayError}});Object.defineProperty(Ie,"FunctionsError",{enumerable:!0,get:function(){return qs.FunctionsError}});Object.defineProperty(Ie,"FunctionRegion",{enumerable:!0,get:function(){return qs.FunctionRegion}});Q0((Yp(),oe(Xp)),Ie);var eT=Jd();Object.defineProperty(Ie,"SupabaseClient",{enumerable:!0,get:function(){return eb(eT).default}});var tT=(t,e,r)=>new ZP.default(t,e,r);Ie.createClient=tT;function rT(){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}rT()&&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 Zd=C((iX,rb)=>{rb.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 Zu=C(ob=>{var nb={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 nT(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(nb))ob[t]=nT(nb[t])});var cb=C((aX,ub)=>{var oT=require("fs"),ot=require("path"),ib=Zd(),iT=Zu(),sT=typeof process=="object"&&process.platform==="win32",sb=t=>typeof t=="object"&&t!==null,ab=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 Xe(t){this.sep=ot.sep,this.fs=oT,sb(t)&&sb(t.fs)&&typeof t.fs.statSync=="function"&&(this.fs=t.fs)}ub.exports=Xe;Xe.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 s;try{s=e.fs.statSync(o)}catch{e.fs.mkdirSync(o)}if(s&&s.isFile())throw iT.FILE_IN_THE_WAY(`"${o}"`)}})}r(t)};Xe.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 s=ot.dirname(t);o.fs.existsSync(s)||o.makeDir(s);var a;try{a=o.fs.openSync(t,"w",438)}catch{o.fs.chmodSync(t,438),a=o.fs.openSync(t,"w",438)}if(a)try{o.fs.writeSync(a,e,0,e.length,0)}finally{o.fs.closeSync(a)}return o.fs.chmodSync(t,n||438),!0};Xe.prototype.writeFileToAsync=function(t,e,r,n,o){typeof n=="function"&&(o=n,n=void 0);let i=this;i.fs.exists(t,function(s){if(s&&!r)return o(!1);i.fs.stat(t,function(a,u){if(s&&u.isDirectory())return o(!1);var c=ot.dirname(t);i.fs.exists(c,function(l){l||i.makeDir(c),i.fs.open(t,"w",438,function(f,h){f?i.fs.chmod(t,438,function(){i.fs.open(t,"w",438,function(d,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)})})})})}):h?i.fs.write(h,e,0,e.length,0,function(){i.fs.close(h,function(){i.fs.chmod(t,n||438,function(){o(!0)})})}):i.fs.chmod(t,n||438,function(){o(!0)})})})})})};Xe.prototype.findFiles=function(t){let e=this;function r(n,o,i){typeof o=="boolean"&&(i=o,o=void 0);let s=[];return e.fs.readdirSync(n).forEach(function(a){let u=ot.join(n,a),c=e.fs.statSync(u);(!o||o.test(u))&&s.push(ot.normalize(u)+(c.isDirectory()?e.sep:"")),c.isDirectory()&&i&&(s=s.concat(r(u,o,i)))}),s}return r(t,void 0,!0)};Xe.prototype.findFilesAsync=function(t,e){let r=this,n=[];r.fs.readdir(t,function(o,i){if(o)return e(o);let s=i.length;if(!s)return e(null,n);i.forEach(function(a){a=ot.join(t,a),r.fs.stat(a,function(u,c){if(u)return e(u);c&&(n.push(ot.normalize(a)+(c.isDirectory()?r.sep:"")),c.isDirectory()?r.findFilesAsync(a,function(l,f){if(l)return e(l);n=n.concat(f),--s||e(null,n)}):--s||e(null,n))})})})};Xe.prototype.getAttributes=function(){};Xe.prototype.setAttributes=function(){};Xe.crc32update=function(t,e){return ab[(t^e)&255]^t>>>8};Xe.crc32=function(t){typeof t=="string"&&(t=Buffer.from(t,"utf8"));let e=t.length,r=-1;for(let n=0;n<e;)r=Xe.crc32update(r,t[n++]);return~r>>>0};Xe.methodToString=function(t){switch(t){case ib.STORED:return"STORED ("+t+")";case ib.DEFLATED:return"DEFLATED ("+t+")";default:return"UNSUPPORTED ("+t+")"}};Xe.canonical=function(t){if(!t)return"";let e=ot.posix.normalize("/"+t.split("\\").join("/"));return ot.join(".",e)};Xe.zipnamefix=function(t){if(!t)return"";let e=ot.posix.normalize("/"+t.split("\\").join("/"));return ot.posix.join(".",e)};Xe.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]};Xe.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)))};Xe.toBuffer=function(e,r){return Buffer.isBuffer(e)?e:e instanceof Uint8Array?Buffer.from(e):typeof e=="string"?r(e):Buffer.alloc(0)};Xe.readBigUInt64LE=function(t,e){var r=Buffer.from(t.slice(e,e+8));return r.swap64(),parseInt(`0x${r.toString("hex")}`)};Xe.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)};Xe.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};Xe.isWin=sT;Xe.crcTable=ab});var fb=C((uX,lb)=>{var aT=require("path");lb.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=aT.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 db=C((cX,pb)=>{pb.exports={efs:!0,encode:t=>Buffer.from(t,"utf8"),decode:t=>t.toString("utf8")}});var ui=C((lX,ai)=>{ai.exports=cb();ai.exports.Constants=Zd();ai.exports.Errors=Zu();ai.exports.FileAttr=fb();ai.exports.decoder=db()});var mb=C((fX,hb)=>{var Fn=ui(),W=Fn.Constants;hb.exports=function(){var t=20,e=10,r=0,n=0,o=0,i=0,s=0,a=0,u=0,c=0,l=0,f=0,h=0,d=0,m=0;t|=Fn.isWin?2560:768,r|=W.FLG_EFS;let b={extraLen:0},D=g=>Math.max(0,g)>>>0,E=g=>Math.max(0,g)&65535,_=g=>Math.max(0,g)&255;return o=Fn.fromDate2DOS(new Date),{get made(){return t},set made(g){t=g},get version(){return e},set version(g){e=g},get flags(){return r},set flags(g){r=g},get flags_efs(){return(r&W.FLG_EFS)>0},set flags_efs(g){g?r|=W.FLG_EFS:r&=~W.FLG_EFS},get flags_desc(){return(r&W.FLG_DESC)>0},set flags_desc(g){g?r|=W.FLG_DESC:r&=~W.FLG_DESC},get method(){return n},set method(g){switch(g){case W.STORED:this.version=10;case W.DEFLATED:default:this.version=20}n=g},get time(){return Fn.fromDOS2Date(this.timeval)},set time(g){this.timeval=Fn.fromDate2DOS(g)},get timeval(){return o},set timeval(g){o=D(g)},get timeHighByte(){return _(o>>>8)},get crc(){return i},set crc(g){i=D(g)},get compressedSize(){return s},set compressedSize(g){s=D(g)},get size(){return a},set size(g){a=D(g)},get fileNameLength(){return u},set fileNameLength(g){u=g},get extraLength(){return c},set extraLength(g){c=g},get extraLocalLength(){return b.extraLen},set extraLocalLength(g){b.extraLen=g},get commentLength(){return l},set commentLength(g){l=g},get diskNumStart(){return f},set diskNumStart(g){f=D(g)},get inAttr(){return h},set inAttr(g){h=D(g)},get attr(){return d},set attr(g){d=D(g)},get fileAttr(){return(d||0)>>16&4095},get offset(){return m},set offset(g){m=D(g)},get encrypted(){return(r&W.FLG_ENC)===W.FLG_ENC},get centralHeaderSize(){return W.CENHDR+u+c+l},get realDataOffset(){return m+W.LOCHDR+b.fnameLen+b.extraLen},get localHeader(){return b},loadLocalHeaderFromBinary:function(g){var x=g.slice(m,m+W.LOCHDR);if(x.readUInt32LE(0)!==W.LOCSIG)throw Fn.Errors.INVALID_LOC();b.version=x.readUInt16LE(W.LOCVER),b.flags=x.readUInt16LE(W.LOCFLG),b.method=x.readUInt16LE(W.LOCHOW),b.time=x.readUInt32LE(W.LOCTIM),b.crc=x.readUInt32LE(W.LOCCRC),b.compressedSize=x.readUInt32LE(W.LOCSIZ),b.size=x.readUInt32LE(W.LOCLEN),b.fnameLen=x.readUInt16LE(W.LOCNAM),b.extraLen=x.readUInt16LE(W.LOCEXT);let S=m+W.LOCHDR+b.fnameLen,T=S+b.extraLen;return g.slice(S,T)},loadFromBinary:function(g){if(g.length!==W.CENHDR||g.readUInt32LE(0)!==W.CENSIG)throw Fn.Errors.INVALID_CEN();t=g.readUInt16LE(W.CENVEM),e=g.readUInt16LE(W.CENVER),r=g.readUInt16LE(W.CENFLG),n=g.readUInt16LE(W.CENHOW),o=g.readUInt32LE(W.CENTIM),i=g.readUInt32LE(W.CENCRC),s=g.readUInt32LE(W.CENSIZ),a=g.readUInt32LE(W.CENLEN),u=g.readUInt16LE(W.CENNAM),c=g.readUInt16LE(W.CENEXT),l=g.readUInt16LE(W.CENCOM),f=g.readUInt16LE(W.CENDSK),h=g.readUInt16LE(W.CENATT),d=g.readUInt32LE(W.CENATX),m=g.readUInt32LE(W.CENOFF)},localHeaderToBinary:function(){var g=Buffer.alloc(W.LOCHDR);return g.writeUInt32LE(W.LOCSIG,0),g.writeUInt16LE(e,W.LOCVER),g.writeUInt16LE(r,W.LOCFLG),g.writeUInt16LE(n,W.LOCHOW),g.writeUInt32LE(o,W.LOCTIM),g.writeUInt32LE(i,W.LOCCRC),g.writeUInt32LE(s,W.LOCSIZ),g.writeUInt32LE(a,W.LOCLEN),g.writeUInt16LE(u,W.LOCNAM),g.writeUInt16LE(b.extraLen,W.LOCEXT),g},centralHeaderToBinary:function(){var g=Buffer.alloc(W.CENHDR+u+c+l);return g.writeUInt32LE(W.CENSIG,0),g.writeUInt16LE(t,W.CENVEM),g.writeUInt16LE(e,W.CENVER),g.writeUInt16LE(r,W.CENFLG),g.writeUInt16LE(n,W.CENHOW),g.writeUInt32LE(o,W.CENTIM),g.writeUInt32LE(i,W.CENCRC),g.writeUInt32LE(s,W.CENSIZ),g.writeUInt32LE(a,W.CENLEN),g.writeUInt16LE(u,W.CENNAM),g.writeUInt16LE(c,W.CENEXT),g.writeUInt16LE(l,W.CENCOM),g.writeUInt16LE(f,W.CENDSK),g.writeUInt16LE(h,W.CENATT),g.writeUInt32LE(d,W.CENATX),g.writeUInt32LE(m,W.CENOFF),g},toJSON:function(){let g=function(x){return x+" bytes"};return{made:t,version:e,flags:r,method:Fn.methodToString(n),time:this.time,crc:"0x"+i.toString(16).toUpperCase(),compressedSize:g(s),size:g(a),fileNameLength:g(u),extraLength:g(c),commentLength:g(l),diskNumStart:f,inAttr:h,attr:d,offset:m,centralHeaderSize:g(W.CENHDR+u+c+l)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var Db=C((pX,gb)=>{var ci=ui(),ze=ci.Constants;gb.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 ci.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=ci.readBigUInt64LE(i,ze.ZIP64SUB),e=ci.readBigUInt64LE(i,ze.ZIP64TOT),r=ci.readBigUInt64LE(i,ze.ZIP64SIZE),n=ci.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(s,a){let u=s.toString(16).toUpperCase();for(;u.length<a;)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 eh=C(Qd=>{Qd.EntryHeader=mb();Qd.MainHeader=Db()});var bb=C((hX,yb)=>{yb.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=[],s=0;o.on("data",function(a){i.push(a),s+=a.length}),o.on("end",function(){var a=Buffer.alloc(s),u=0;a.fill(0);for(var c=0;c<i.length;c++){var l=i[c];l.copy(a,u),u+=l.length}n&&n(a)}),o.end(t)}}}});var vb=C((mX,wb)=>{var uT=+(process.versions?process.versions.node:"").split(".")[0]||0;wb.exports=function(t,e){var r=require("zlib");let n=uT>=15&&e>0?{maxOutputLength:e}:{};return{inflate:function(){return r.inflateRawSync(t,n)},inflateAsync:function(o){var i=r.createInflateRaw(n),s=[],a=0;i.on("data",function(u){s.push(u),a+=u.length}),i.on("end",function(){var u=Buffer.alloc(a),c=0;u.fill(0);for(var l=0;l<s.length;l++){var f=s[l];f.copy(u,c),c+=f.length}o&&o(u)}),i.end(t)}}}});var Sb=C((gX,xb)=>{"use strict";var{randomFillSync:Eb}=require("crypto"),cT=Zu(),lT=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}),_b=(t,e)=>Math.imul(t,e)>>>0,Cb=(t,e)=>lT[(t^e)&255]^t>>>8,Hs=()=>typeof Eb=="function"?Eb(Buffer.alloc(12)):Hs.node();Hs.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 Qu={genSalt:Hs};function ec(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])}ec.prototype.updateKeys=function(t){let e=this.keys;return e[0]=Cb(e[0],t),e[1]+=e[0]&255,e[1]=_b(e[1],134775813)+1,e[2]=Cb(e[2],e[1]>>>24),t};ec.prototype.next=function(){let t=(this.keys[2]|2)>>>0;return _b(t,t^1)>>8&255};function fT(t){let e=new ec(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 pT(t){let e=new ec(t);return function(r,n,o=0){n||(n=Buffer.alloc(r.length));for(let i of r){let s=e.next();n[o++]=i^s,e.updateKeys(i)}return n}}function dT(t,e,r){if(!t||!Buffer.isBuffer(t)||t.length<12)return Buffer.alloc(0);let n=fT(r),o=n(t.slice(0,12)),i=(e.flags&8)===8?e.timeHighByte:e.crc>>>24;if(o[11]!==i)throw cT.WRONG_PASSWORD();return n(t.slice(12))}function hT(t){Buffer.isBuffer(t)&&t.length>=12?Qu.genSalt=function(){return t.slice(0,12)}:t==="node"?Qu.genSalt=Hs.node:Qu.genSalt=Hs}function mT(t,e,r,n=!1){t==null&&(t=Buffer.alloc(0)),Buffer.isBuffer(t)||(t=Buffer.from(t.toString()));let o=pT(r),i=Qu.genSalt();i[11]=e.crc>>>24&255,n&&(i[10]=e.crc>>>16&255);let s=Buffer.alloc(t.length+12);return o(i,s),o(t,s,12)}xb.exports={decrypt:dT,encrypt:mT,_salter:hT}});var Ab=C(tc=>{tc.Deflater=bb();tc.Inflater=vb();tc.ZipCrypto=Sb()});var rh=C((yX,Fb)=>{var Fe=ui(),gT=eh(),Ye=Fe.Constants,th=Ab();Fb.exports=function(t,e){var r=new gT.EntryHeader,n=Buffer.alloc(0),o=Buffer.alloc(0),i=!1,s=null,a=Buffer.alloc(0),u=Buffer.alloc(0),c=!0;let l=t,f=typeof l.decoder=="object"?l.decoder:Fe.decoder;c=f.hasOwnProperty("efs")?f.efs:!1;function h(){return!e||!(e instanceof Uint8Array)?Buffer.alloc(0):(u=r.loadLocalHeaderFromBinary(e),e.slice(r.realDataOffset,r.realDataOffset+r.compressedSize))}function d(g){if(r.flags_desc){let x={},S=r.realDataOffset+r.compressedSize;if(e.readUInt32LE(S)==Ye.LOCSIG||e.readUInt32LE(S)==Ye.CENSIG)throw Fe.Errors.DESCRIPTOR_NOT_EXIST();if(e.readUInt32LE(S)==Ye.EXTSIG)x.crc=e.readUInt32LE(S+Ye.EXTCRC),x.compressedSize=e.readUInt32LE(S+Ye.EXTSIZ),x.size=e.readUInt32LE(S+Ye.EXTLEN);else if(e.readUInt16LE(S+12)===19280)x.crc=e.readUInt32LE(S+Ye.EXTCRC-4),x.compressedSize=e.readUInt32LE(S+Ye.EXTSIZ-4),x.size=e.readUInt32LE(S+Ye.EXTLEN-4);else throw Fe.Errors.DESCRIPTOR_UNKNOWN();if(x.compressedSize!==r.compressedSize||x.size!==r.size||x.crc!==r.crc)throw Fe.Errors.DESCRIPTOR_FAULTY();if(Fe.crc32(g)!==x.crc)return!1}else if(Fe.crc32(g)!==r.localHeader.crc)return!1;return!0}function m(g,x,S){if(typeof x>"u"&&typeof g=="string"&&(S=g,g=void 0),i)return g&&x&&x(Buffer.alloc(0),Fe.Errors.DIRECTORY_CONTENT_ERROR()),Buffer.alloc(0);var T=h();if(T.length===0)return g&&x&&x(T),T;if(r.encrypted){if(typeof S!="string"&&!Buffer.isBuffer(S))throw Fe.Errors.INVALID_PASS_PARAM();T=th.ZipCrypto.decrypt(T,r,S)}var O=Buffer.alloc(r.size);switch(r.method){case Fe.Constants.STORED:if(T.copy(O),d(O))return g&&x&&x(O),O;throw g&&x&&x(O,Fe.Errors.BAD_CRC()),Fe.Errors.BAD_CRC();case Fe.Constants.DEFLATED:var B=new th.Inflater(T,r.size);if(g)B.inflateAsync(function(I){I.copy(I,0),x&&(d(I)?x(I):x(I,Fe.Errors.BAD_CRC()))});else{if(B.inflate(O).copy(O,0),!d(O))throw Fe.Errors.BAD_CRC(`"${f.decode(n)}"`);return O}break;default:throw g&&x&&x(Buffer.alloc(0),Fe.Errors.UNKNOWN_METHOD()),Fe.Errors.UNKNOWN_METHOD()}}function b(g,x){if((!s||!s.length)&&Buffer.isBuffer(e))return g&&x&&x(h()),h();if(s.length&&!i){var S;switch(r.method){case Fe.Constants.STORED:return r.compressedSize=r.size,S=Buffer.alloc(s.length),s.copy(S),g&&x&&x(S),S;default:case Fe.Constants.DEFLATED:var T=new th.Deflater(s);if(g)T.deflateAsync(function(B){S=Buffer.alloc(B.length),r.compressedSize=B.length,B.copy(S),x&&x(S)});else{var O=T.deflate();return r.compressedSize=O.length,O}T=null;break}}else if(g&&x)x(Buffer.alloc(0));else return Buffer.alloc(0)}function D(g,x){return(g.readUInt32LE(x+4)<<4)+g.readUInt32LE(x)}function E(g){try{for(var x=0,S,T,O;x+4<g.length;)S=g.readUInt16LE(x),x+=2,T=g.readUInt16LE(x),x+=2,O=g.slice(x,x+T),x+=T,Ye.ID_ZIP64===S&&_(O)}catch{throw Fe.Errors.EXTRA_FIELD_PARSE_ERROR()}}function _(g){var x,S,T,O;g.length>=Ye.EF_ZIP64_SCOMP&&(x=D(g,Ye.EF_ZIP64_SUNCOMP),r.size===Ye.EF_ZIP64_OR_32&&(r.size=x)),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&&(T=D(g,Ye.EF_ZIP64_RHO),r.offset===Ye.EF_ZIP64_OR_32&&(r.offset=T)),g.length>=Ye.EF_ZIP64_DSN+4&&(O=g.readUInt32LE(Ye.EF_ZIP64_DSN),r.diskNumStart===Ye.EF_ZIP64_OR_16&&(r.diskNumStart=O))}return{get entryName(){return f.decode(n)},get rawEntryName(){return n},set entryName(g){n=Fe.toBuffer(g,f.encode);var x=n[n.length-1];i=x===47||x===92,r.fileNameLength=n.length},get efs(){return typeof c=="function"?c(this.entryName):c},get extra(){return a},set extra(g){a=g,r.extraLength=g.length,E(g)},get comment(){return f.decode(o)},set comment(g){if(o=Fe.toBuffer(g,f.encode),r.commentLength=o.length,o.length>65535)throw Fe.Errors.COMMENT_TOO_LONG()},get name(){var g=f.decode(n);return i?g.substr(g.length-1).split("/").pop():g.split("/").pop()},get isDirectory(){return i},getCompressedData:function(){return b(!1,null)},getCompressedDataAsync:function(g){b(!0,g)},setData:function(g){s=Fe.toBuffer(g,Fe.decoder.encode),!i&&s.length?(r.size=s.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?s:m(!1,null,g)},getDataAsync:function(g,x){r.changed?g(s):m(!0,g,x)},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=a.length;var g=r.centralHeaderToBinary(),x=Fe.Constants.CENHDR;return n.copy(g,x),x+=n.length,a.copy(g,x),x+=r.extraLength,o.copy(g,x),g},packLocalHeader:function(){let g=0;r.flags_efs=this.efs,r.extraLocalLength=u.length;let x=r.localHeaderToBinary(),S=Buffer.alloc(x.length+n.length+r.extraLocalLength);return x.copy(S,g),g+=x.length,n.copy(S,g),g+=n.length,u.copy(S,g),g+=u.length,S},toJSON:function(){let g=function(x){return"<"+(x&&x.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(s)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var $b=C((bX,kb)=>{var Ob=rh(),DT=eh(),Dt=ui();kb.exports=function(t,e){var r=[],n={},o=Buffer.alloc(0),i=new DT.MainHeader,s=!1,a=null;let u=new Set,c=e,{noSort:l,decoder:f}=c;t?m(c.readEntries):s=!0;function h(){let D=new Set;for(let E of Object.keys(n)){let _=E.split("/");if(_.pop(),!!_.length)for(let g=0;g<_.length;g++){let x=_.slice(0,g+1).join("/")+"/";D.add(x)}}for(let E of D)if(!(E in n)){let _=new Ob(c);_.entryName=E,_.attr=16,_.temporary=!0,r.push(_),n[_.entryName]=_,u.add(_)}}function d(){if(s=!0,n={},i.diskEntries>(t.length-i.offset)/Dt.Constants.CENHDR)throw Dt.Errors.DISK_ENTRY_TOO_LARGE();r=new Array(i.diskEntries);for(var D=i.offset,E=0;E<r.length;E++){var _=D,g=new Ob(c,t);g.header=t.slice(_,_+=Dt.Constants.CENHDR),g.entryName=t.slice(_,_+=g.header.fileNameLength),g.header.extraLength&&(g.extra=t.slice(_,_+=g.header.extraLength)),g.header.commentLength&&(g.comment=t.slice(_,_+g.header.commentLength)),D+=g.header.centralHeaderSize,r[E]=g,n[g.entryName]=g}u.clear(),h()}function m(D){var E=t.length-Dt.Constants.ENDHDR,_=Math.max(0,E-65535),g=_,x=t.length,S=-1,T=0;for((typeof c.trailingSpace=="boolean"?c.trailingSpace:!1)&&(_=0),E;E>=g;E--)if(t[E]===80){if(t.readUInt32LE(E)===Dt.Constants.ENDSIG){S=E,T=E,x=E+Dt.Constants.ENDHDR,g=E-Dt.Constants.END64HDR;continue}if(t.readUInt32LE(E)===Dt.Constants.END64SIG){g=_;continue}if(t.readUInt32LE(E)===Dt.Constants.ZIP64SIG){S=E,x=E+Dt.readBigUInt64LE(t,E+Dt.Constants.ZIP64SIZE)+Dt.Constants.ZIP64LEAD;break}}if(S==-1)throw Dt.Errors.INVALID_FORMAT();i.loadFromBinary(t.slice(S,x)),i.commentLength&&(o=t.slice(T+Dt.Constants.ENDHDR)),D&&d()}function b(){r.length>1&&!l&&r.sort((D,E)=>D.entryName.toLowerCase().localeCompare(E.entryName.toLowerCase()))}return{get entries(){return s||d(),r.filter(D=>!u.has(D))},get comment(){return f.decode(o)},set comment(D){o=Dt.toBuffer(D,f.encode),i.commentLength=o.length},getEntryCount:function(){return s?r.length:i.diskEntries},forEach:function(D){this.entries.forEach(D)},getEntry:function(D){return s||d(),n[D]||null},setEntry:function(D){s||d(),r.push(D),n[D.entryName]=D,i.totalEntries=r.length},deleteFile:function(D,E=!0){s||d();let _=n[D];this.getEntryChildren(_,E).map(x=>x.entryName).forEach(this.deleteEntry)},deleteEntry:function(D){s||d();let E=n[D],_=r.indexOf(E);_>=0&&(r.splice(_,1),delete n[D],i.totalEntries=r.length)},getEntryChildren:function(D,E=!0){if(s||d(),typeof D=="object")if(D.isDirectory&&E){let _=[],g=D.entryName;for(let x of r)x.entryName.startsWith(g)&&_.push(x);return _}else return[D];return[]},getChildCount:function(D){if(D&&D.isDirectory){let E=this.getEntryChildren(D);return E.includes(D)?E.length-1:E.length}return 0},compressToBuffer:function(){s||d(),b();let D=[],E=[],_=0,g=0;i.size=0,i.offset=0;let x=0;for(let O of this.entries){let B=O.getCompressedData();O.header.offset=g;let I=O.packLocalHeader(),L=I.length+B.length;g+=L,D.push(I),D.push(B);let F=O.packCentralHeader();E.push(F),i.size+=F.length,_+=L+F.length,x++}_+=i.mainHeaderSize,i.offset=g,i.totalEntries=x,g=0;let S=Buffer.alloc(_);for(let O of D)O.copy(S,g),g+=O.length;for(let O of E)O.copy(S,g),g+=O.length;let T=i.toBinary();return o&&o.copy(T,Dt.Constants.ENDHDR),T.copy(S,g),t=S,s=!1,S},toAsyncBuffer:function(D,E,_,g){try{s||d(),b();let x=[],S=[],T=0,O=0,B=0;i.size=0,i.offset=0;let I=function(L){if(L.length>0){let F=L.shift(),U=F.entryName+F.extra.toString();_&&_(U),F.getCompressedDataAsync(function(M){g&&g(U),F.header.offset=O;let te=F.packLocalHeader(),$=te.length+M.length;O+=$,x.push(te),x.push(M);let y=F.packCentralHeader();S.push(y),i.size+=y.length,T+=$+y.length,B++,I(L)})}else{T+=i.mainHeaderSize,i.offset=O,i.totalEntries=B,O=0;let F=Buffer.alloc(T);x.forEach(function(M){M.copy(F,O),O+=M.length}),S.forEach(function(M){M.copy(F,O),O+=M.length});let U=i.toBinary();o&&o.copy(U,Dt.Constants.ENDHDR),U.copy(F,O),t=F,s=!1,D(F)}};I(Array.from(this.entries))}catch(x){E(x)}}}}});var Rb=C((wX,Tb)=>{var Ge=ui(),Je=require("path"),yT=rh(),bT=$b(),no=(...t)=>Ge.findLast(t,e=>typeof e=="boolean"),Pb=(...t)=>Ge.findLast(t,e=>typeof e=="string"),wT=(...t)=>Ge.findLast(t,e=>typeof e=="function"),vT={noSort:!1,readEntries:!1,method:Ge.Constants.NONE,fs:null};Tb.exports=function(t,e){let r=null,n=Object.assign(Object.create(null),vT);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=Ge.Constants.BUFFER,t=void 0)),Object.assign(n,e);let o=new Ge(n);if((typeof n.decoder!="object"||typeof n.decoder.encode!="function"||typeof n.decoder.decode!="function")&&(n.decoder=Ge.decoder),t&&typeof t=="string")if(o.fs.existsSync(t))n.method=Ge.Constants.FILE,n.filename=t,r=o.fs.readFileSync(t);else throw Ge.Errors.INVALID_FILENAME();let i=new bT(r,n),{canonical:s,sanitize:a,zipnamefix:u}=Ge;function c(d){if(d&&i){var m;if(typeof d=="string"&&(m=i.getEntry(Je.posix.normalize(d))),typeof d=="object"&&typeof d.entryName<"u"&&typeof d.header<"u"&&(m=i.getEntry(d.entryName)),m)return m}return null}function l(d){let{join:m,normalize:b,sep:D}=Je.posix;return m(".",b(D+d.split("\\").join(D)+D))}function f(d){return d instanceof RegExp?(function(m){return function(b){return m.test(b)}})(d):typeof d!="function"?()=>!0:d}let h=(d,m)=>{let b=m.slice(-1);return b=b===o.sep?o.sep:"",Je.relative(d,m)+b};return{readFile:function(d,m){var b=c(d);return b&&b.getData(m)||null},childCount:function(d){let m=c(d);if(m)return i.getChildCount(m)},readFileAsync:function(d,m){var b=c(d);b?b.getDataAsync(m):m(null,"getEntry failed for:"+d)},readAsText:function(d,m){var b=c(d);if(b){var D=b.getData();if(D&&D.length)return D.toString(m||"utf8")}return""},readAsTextAsync:function(d,m,b){var D=c(d);D?D.getDataAsync(function(E,_){if(_){m(E,_);return}E&&E.length?m(E.toString(b||"utf8")):m("")}):m("")},deleteFile:function(d,m=!0){var b=c(d);b&&i.deleteFile(b.entryName,m)},deleteEntry:function(d){var m=c(d);m&&i.deleteEntry(m.entryName)},addZipComment:function(d){i.comment=d},getZipComment:function(){return i.comment||""},addZipEntryComment:function(d,m){var b=c(d);b&&(b.comment=m)},getZipEntryComment:function(d){var m=c(d);return m&&m.comment||""},updateFile:function(d,m){var b=c(d);b&&b.setData(m)},addLocalFile:function(d,m,b,D){if(o.fs.existsSync(d)){m=m?l(m):"";let E=Je.win32.basename(Je.win32.normalize(d));m+=b||E;let _=o.fs.statSync(d),g=_.isFile()?o.fs.readFileSync(d):Buffer.alloc(0);_.isDirectory()&&(m+=o.sep),this.addFile(m,g,D,_)}else throw Ge.Errors.FILE_NOT_FOUND(d)},addLocalFileAsync:function(d,m){d=typeof d=="object"?d:{localPath:d};let b=Je.resolve(d.localPath),{comment:D}=d,{zipPath:E,zipName:_}=d,g=this;o.fs.stat(b,function(x,S){if(x)return m(x,!1);E=E?l(E):"";let T=Je.win32.basename(Je.win32.normalize(b));if(E+=_||T,S.isFile())o.fs.readFile(b,function(O,B){return O?m(O,!1):(g.addFile(E,B,D,S),setImmediate(m,void 0,!0))});else if(S.isDirectory())return E+=o.sep,g.addFile(E,Buffer.alloc(0),D,S),setImmediate(m,void 0,!0)})},addLocalFolder:function(d,m,b){if(b=f(b),m=m?l(m):"",d=Je.normalize(d),o.fs.existsSync(d)){let D=o.findFiles(d),E=this;if(D.length)for(let _ of D){let g=Je.join(m,h(d,_));b(g)&&E.addLocalFile(_,Je.dirname(g))}}else throw Ge.Errors.FILE_NOT_FOUND(d)},addLocalFolderAsync:function(d,m,b,D){D=f(D),b=b?l(b):"",d=Je.normalize(d);var E=this;o.fs.open(d,"r",function(_){if(_&&_.code==="ENOENT")m(void 0,Ge.Errors.FILE_NOT_FOUND(d));else if(_)m(void 0,_);else{var g=o.findFiles(d),x=-1,S=function(){if(x+=1,x<g.length){var T=g[x],O=h(d,T).split("\\").join("/");O=O.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),D(O)?o.fs.stat(T,function(B,I){B&&m(void 0,B),I.isFile()?o.fs.readFile(T,function(L,F){L?m(void 0,L):(E.addFile(b+O,F,"",I),S())}):(E.addFile(b+O+"/",Buffer.alloc(0),"",I),S())}):process.nextTick(()=>{S()})}else m(!0,void 0)};S()}})},addLocalFolderAsync2:function(d,m){let b=this;d=typeof d=="object"?d:{localPath:d},localPath=Je.resolve(l(d.localPath));let{zipPath:D,filter:E,namefix:_}=d;E instanceof RegExp?E=(function(S){return function(T){return S.test(T)}})(E):typeof E!="function"&&(E=function(){return!0}),D=D?l(D):"",_=="latin1"&&(_=S=>S.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,"")),typeof _!="function"&&(_=S=>S);let g=S=>Je.join(D,_(h(localPath,S))),x=S=>Je.win32.basename(Je.win32.normalize(_(S)));o.fs.open(localPath,"r",function(S){S&&S.code==="ENOENT"?m(void 0,Ge.Errors.FILE_NOT_FOUND(localPath)):S?m(void 0,S):o.findFilesAsync(localPath,function(T,O){if(T)return m(T);O=O.filter(B=>E(g(B))),O.length||m(void 0,!1),setImmediate(O.reverse().reduce(function(B,I){return function(L,F){if(L||F===!1)return setImmediate(B,L,!1);b.addLocalFileAsync({localPath:I,zipPath:Je.dirname(g(I)),zipName:x(I)},B)}},m))})})},addLocalFolderPromise:function(d,m){return new Promise((b,D)=>{this.addLocalFolderAsync2(Object.assign({localPath:d},m),(E,_)=>{E&&D(E),_&&b(this)})})},addFile:function(d,m,b,D){d=u(d);let E=c(d),_=E!=null;_||(E=new yT(n),E.entryName=d),E.comment=b||"";let g=typeof D=="object"&&D instanceof o.fs.Stats;g&&(E.header.time=D.mtime);var x=E.isDirectory?16:0;let S=E.isDirectory?16384:32768;return g?S|=4095&D.mode:typeof D=="number"?S|=4095&D:S|=E.isDirectory?493:420,x=(x|S<<16)>>>0,E.attr=x,E.setData(m),_||i.setEntry(E),E},getEntries:function(d){return i.password=d,i?i.entries:[]},getEntry:function(d){return c(d)},getEntryCount:function(){return i.getEntryCount()},forEach:function(d){return i.forEach(d)},extractEntryTo:function(d,m,b,D,E,_){D=no(!1,D),E=no(!1,E),b=no(!0,b),_=Pb(E,_);var g=c(d);if(!g)throw Ge.Errors.NO_ENTRY();var x=s(g.entryName),S=a(m,_&&!g.isDirectory?_:b?x:Je.basename(x));if(g.isDirectory){var T=i.getEntryChildren(g);return T.forEach(function(I){if(I.isDirectory)return;var L=I.getData();if(!L)throw Ge.Errors.CANT_EXTRACT_FILE();var F=s(I.entryName),U=a(m,b?F:Je.basename(F));let M=E?I.header.fileAttr:void 0;o.writeFileTo(U,L,D,M)}),!0}var O=g.getData(i.password);if(!O)throw Ge.Errors.CANT_EXTRACT_FILE();if(o.fs.existsSync(S)&&!D)throw Ge.Errors.CANT_OVERRIDE();let B=E?d.header.fileAttr:void 0;return o.writeFileTo(S,O,D,B),!0},test:function(d){if(!i)return!1;for(var m in i.entries)try{if(m.isDirectory)continue;var b=i.entries[m].getData(d);if(!b)return!1}catch{return!1}return!0},extractAllTo:function(d,m,b,D){if(b=no(!1,b),D=Pb(b,D),m=no(!1,m),!i)throw Ge.Errors.NO_ZIP();i.entries.forEach(function(E){var _=a(d,s(E.entryName));if(E.isDirectory){o.makeDir(_);return}var g=E.getData(D);if(!g)throw Ge.Errors.CANT_EXTRACT_FILE();let x=b?E.header.fileAttr:void 0;o.writeFileTo(_,g,m,x);try{o.fs.utimesSync(_,E.header.time,E.header.time)}catch{throw Ge.Errors.CANT_EXTRACT_FILE()}})},extractAllToAsync:function(d,m,b,D){if(D=wT(m,b,D),b=no(!1,b),m=no(!1,m),!D)return new Promise((S,T)=>{this.extractAllToAsync(d,m,b,function(O){O?T(O):S(this)})});if(!i){D(Ge.Errors.NO_ZIP());return}d=Je.resolve(d);let E=S=>a(d,Je.normalize(s(S.entryName))),_=(S,T)=>new Error(S+': "'+T+'"'),g=[],x=[];i.entries.forEach(S=>{S.isDirectory?g.push(S):x.push(S)});for(let S of g){let T=E(S),O=b?S.header.fileAttr:void 0;try{o.makeDir(T),O&&o.fs.chmodSync(T,O),o.fs.utimesSync(T,S.header.time,S.header.time)}catch{D(_("Unable to create folder",T))}}x.reverse().reduce(function(S,T){return function(O){if(O)S(O);else{let B=Je.normalize(s(T.entryName)),I=a(d,B);T.getDataAsync(function(L,F){if(F)S(F);else if(!L)S(Ge.Errors.CANT_EXTRACT_FILE());else{let U=b?T.header.fileAttr:void 0;o.writeFileToAsync(I,L,m,U,function(M){M||S(_("Unable to write file",I)),o.fs.utimes(I,T.header.time,T.header.time,function(te){te?S(_("Unable to set times",I)):S()})})}})}}},D)()},writeZip:function(d,m){if(arguments.length===1&&typeof d=="function"&&(m=d,d=""),!d&&n.filename&&(d=n.filename),!!d){var b=i.compressToBuffer();if(b){var D=o.writeFileTo(d,b,!0);typeof m=="function"&&m(D?null:new Error("failed"),"")}}},writeZipPromise:function(d,m){let{overwrite:b,perm:D}=Object.assign({overwrite:!0},m);return new Promise((E,_)=>{!d&&n.filename&&(d=n.filename),d||_("ADM-ZIP: ZIP File Name Missing"),this.toBufferPromise().then(g=>{let x=S=>S?E(S):_("ADM-ZIP: Wasn't able to write zip file");o.writeFileToAsync(d,g,b,D,x)},_)})},toBufferPromise:function(){return new Promise((d,m)=>{i.toAsyncBuffer(d,m)})},toBuffer:function(d,m,b,D){return typeof d=="function"?(i.toAsyncBuffer(d,m,b,D),null):i.compressToBuffer()}}}});var Lb=C((vX,Nb)=>{var Bb={};Nb.exports=Bb;var Ib={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(Ib).forEach(function(t){var e=Ib[t],r=Bb[t]=[];r.open="\x1B["+e[0]+"m",r.close="\x1B["+e[1]+"m"})});var Ub=C((EX,jb)=>{"use strict";jb.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 qb=C((CX,Mb)=>{"use strict";var ET=require("os"),$r=Ub(),It=process.env,li=void 0;$r("no-color")||$r("no-colors")||$r("color=false")?li=!1:($r("color")||$r("colors")||$r("color=true")||$r("color=always"))&&(li=!0);"FORCE_COLOR"in It&&(li=It.FORCE_COLOR.length===0||parseInt(It.FORCE_COLOR,10)!==0);function CT(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function _T(t){if(li===!1)return 0;if($r("color=16m")||$r("color=full")||$r("color=truecolor"))return 3;if($r("color=256"))return 2;if(t&&!t.isTTY&&li!==!0)return 0;var e=li?1:0;if(process.platform==="win32"){var r=ET.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 nh(t){var e=_T(t);return CT(e)}Mb.exports={supportsColor:nh,stdout:nh(process.stdout),stderr:nh(process.stderr)}});var Vb=C((_X,Hb)=>{Hb.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 s=o[i]||[" "],a=Math.floor(Math.random()*s.length);typeof o[i]<"u"?n+=o[i][a]:n+=i}),n}});var Gb=C((xX,zb)=>{zb.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 s(u){var c=!1;return o.filter(function(l){c=l===u}),c}function a(u,c){var l="",f,h;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(h in u)if(!s(h)){switch(l=l+u[h],f={up:0,down:0,mid:0},c.size){case"mini":f.up=i(8),f.mid=i(2),f.down=i(8);break;case"maxi":f.up=i(16)+3,f.mid=i(4)+1,f.down=i(64)+3;break;default:f.up=i(8)+1,f.mid=i(6)/2,f.down=i(8)+1;break}var d=["up","mid","down"];for(var m in d)for(var b=d[m],D=0;D<=f[b];D++)c[b]&&(l=l+n[b][i(n[b].length)])}return l}return a(e,r)}});var Kb=C((SX,Wb)=>{Wb.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 Yb=C((AX,Xb)=>{Xb.exports=function(t){return function(e,r,n){return r%2===0?e:t.inverse(e)}}});var Zb=C((FX,Jb)=>{Jb.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 ew=C((OX,Qb)=>{Qb.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 sw=C(($X,iw)=>{var pe={};iw.exports=pe;pe.themes={};var xT=require("util"),oo=pe.styles=Lb(),rw=Object.defineProperties,ST=new RegExp(/[\r\n]+/g);pe.supportsColor=qb().supportsColor;typeof pe.enabled>"u"&&(pe.enabled=pe.supportsColor()!==!1);pe.enable=function(){pe.enabled=!0};pe.disable=function(){pe.enabled=!1};pe.stripColors=pe.strip=function(t){return(""+t).replace(/\x1B\[\d+m/g,"")};var kX=pe.stylize=function(e,r){if(!pe.enabled)return e+"";var n=oo[r];return!n&&r in pe?pe[r](e):n.open+e+n.close},AT=/[|\\{}()[\]^$+*?.]/g,FT=function(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(AT,"\\$&")};function nw(t){var e=function r(){return kT.apply(r,arguments)};return e._styles=t,e.__proto__=OT,e}var ow=(function(){var t={};return oo.grey=oo.gray,Object.keys(oo).forEach(function(e){oo[e].closeRe=new RegExp(FT(oo[e].close),"g"),t[e]={get:function(){return nw(this._styles.concat(e))}}}),t})(),OT=rw(function(){},ow);function kT(){var t=Array.prototype.slice.call(arguments),e=t.map(function(s){return s!=null&&s.constructor===String?s:xT.inspect(s)}).join(" ");if(!pe.enabled||!e)return e;for(var r=e.indexOf(`
28
- `)!=-1,n=this._styles,o=n.length;o--;){var i=oo[n[o]];e=i.open+e.replace(i.closeRe,i.open)+i.close,r&&(e=e.replace(ST,function(s){return i.close+s+i.open}))}return e}pe.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){pe[r]=function(n){if(typeof t[r]=="object"){var o=n;for(var i in t[r])o=pe[t[r][i]](o);return o}return pe[t[r]](n)}})(e)};function $T(){var t={};return Object.keys(ow).forEach(function(e){t[e]={get:function(){return nw([e])}}}),t}var PT=function(e,r){var n=r.split("");return n=n.map(e),n.join("")};pe.trap=Vb();pe.zalgo=Gb();pe.maps={};pe.maps.america=Kb()(pe);pe.maps.zebra=Yb()(pe);pe.maps.rainbow=Zb()(pe);pe.maps.random=ew()(pe);for(tw in pe.maps)(function(t){pe[t]=function(e){return PT(pe.maps[t],e)}})(tw);var tw;rw(pe,$T())});var uw=C((PX,aw)=>{var TT=sw();aw.exports=TT});var cw=C(oh=>{"use strict";oh.indent=function(e){return new Array(e+1).join(" ")};oh.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 lw=C((RX,RT)=>{RT.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 fw=C(Vs=>{"use strict";var Br=uw(),On=cw(),IT=/[^\w\s\n\r\v\t\.,]/i;Vs.version=lw().version;var ih=function(t,e){return t!==void 0||e.renderUndefined},rc=function(t,e,r){return!!(typeof t=="boolean"||typeof t=="number"||typeof t=="function"||t===null||t===void 0||t instanceof Date||typeof t=="string"&&t.indexOf(`
29
- `)===-1||r.inlineArrays&&!e&&Array.isArray(t)&&rc(t[0],!0,r))},BT=function(t,e){if(e.noColor)return t;if(typeof t=="string")return e.stringColor?Br[e.stringColor](t):t;var r=t+"";return t===!0?Br.green(r):t===!1?Br.red(r):t==null?Br.grey(r):typeof t=="number"?t>=0?Br[e.positiveNumberColor](r):Br[e.negativeNumberColor](r):typeof t=="function"?"function() {}":Array.isArray(t)?t.join(", "):r},sh=function(t,e){return t.multilineStringColor===null||t.noColor?e:Br[t.multilineStringColor](e)},NT=function(t,e,r){var n=t.split(`
30
- `);return n=n.map(function(o){return On.indent(e)+sh(r,o)}),n.join(`
31
- `)},fi=function(t,e,r){if(typeof t=="string"&&t.match(IT)&&e.escape&&(t=JSON.stringify(t)),!ih(t,e))return[];if(rc(t,!1,e))return[On.indent(r)+BT(t,e)];if(typeof t=="string")return[On.indent(r)+sh(e,'"""'),NT(t,r+e.defaultIndentation,e),On.indent(r)+sh(e,'"""')];if(Array.isArray(t)){if(t.length===0)return[On.indent(r)+e.emptyArrayMsg];var n=[];return t.forEach(function(a){if(ih(a,e)){var u="- ";e.noColor||(u=Br[e.dashColor](u)),u=On.indent(r)+u,rc(a,!1,e)?(u+=fi(a,e,0)[0],n.push(u)):(n.push(u),n.push.apply(n,fi(a,e,r+e.defaultIndentation)))}}),n}if(t instanceof Error)return fi({message:t.message,stack:t.stack.split(`
32
- `)},e,r);var o=e.noAlign?0:On.getMaxIndexLength(t),i,s=[];return Object.getOwnPropertyNames(t).forEach(function(a){if(ih(t[a],e))if(i=a+": ",e.noColor||(i=Br[e.keysColor](i)),i=On.indent(r)+i,rc(t[a],!1,e)){var u=e.noAlign?0:o-a.length;i+=fi(t[a],e,u)[0],s.push(i)}else s.push(i),s.push.apply(s,fi(t[a],e,r+e.defaultIndentation))}),s};Vs.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,fi(e,r,n).join(`
33
- `)};Vs.renderString=function(e,r,n){var o="",i;if(typeof e!="string"||e==="")return"";if(e[0]!=="{"&&e[0]!=="["){var s;e.indexOf("{")===-1?s=e.indexOf("["):e.indexOf("[")===-1||e.indexOf("{")<e.indexOf("[")?s=e.indexOf("{"):s=e.indexOf("["),o+=e.substr(0,s)+`
34
- `,e=e.substr(s)}try{i=JSON.parse(e)}catch{return Br.red("Error:")+" Not valid JSON!"}return o+=Vs.render(i,r,n),o}});var ch=C(nc=>{"use strict";Object.defineProperty(nc,"__esModule",{value:!0});nc.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 pw(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,jT(n.key),n)}}function LT(t,e,r){return e&&pw(t.prototype,e),r&&pw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function jT(t){var e=UT(t,"string");return pi(e)=="symbol"?e:e+""}function UT(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 MT(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function qT(t,e,r){return e=Gs(e),HT(t,uh()?Reflect.construct(e,r||[],Gs(t).constructor):e.apply(t,r))}function HT(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 VT(t)}function VT(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function zT(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&&zs(t,e)}function ah(t){var e=typeof Map=="function"?new Map:void 0;return ah=function(n){if(n===null||!WT(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 GT(n,arguments,Gs(this).constructor)}return o.prototype=Object.create(n.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),zs(o,n)},ah(t)}function GT(t,e,r){if(uh())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var o=new(t.bind.apply(t,n));return r&&zs(o,r.prototype),o}function uh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(uh=function(){return!!t})()}function WT(t){try{return Function.toString.call(t).indexOf("[native code]")!==-1}catch{return typeof t=="function"}}function zs(t,e){return zs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},zs(t,e)}function Gs(t){return Gs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Gs(t)}var KT=(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,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;if(MT(this,e),n=qT(this,e,[r]),n.originalRequest=i,n.originalResponse=s,n.causingError=o,o!=null&&(r+=", caused by ".concat(o.toString())),i!=null){var a=i.getHeader("X-Request-ID")||"n/a",u=i.getMethod(),c=i.getURL(),l=s?s.getStatus():"n/a",f=s?s.getBody()||"":"n/a";r+=", originated from request (method: ".concat(u,", url: ").concat(c,", response code: ").concat(l,", response text: ").concat(f,", request id: ").concat(a,")")}return n.message=r,n}return zT(e,t),LT(e)})(ah(Error)),BX=nc.default=KT});var lh=C(oc=>{"use strict";Object.defineProperty(oc,"__esModule",{value:!0});oc.enableDebugLog=XT;oc.log=YT;var dw=!1;function XT(){dw=!0}function YT(t){dw&&console.log(t)}});var mw=C(ic=>{"use strict";Object.defineProperty(ic,"__esModule",{value:!0});ic.default=void 0;function Ws(t){"@babel/helpers - typeof";return Ws=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},Ws(t)}function JT(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,QT(n.key),n)}}function ZT(t,e,r){return e&&hw(t.prototype,e),r&&hw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function QT(t){var e=eR(t,"string");return Ws(e)=="symbol"?e:e+""}function eR(t,e){if(Ws(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Ws(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var jX=ic.default=(function(){function t(){JT(this,t)}return ZT(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 gw=C((fh,ph)=>{(function(t,e){typeof fh=="object"&&typeof ph<"u"?ph.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:fh,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+/=",s=Array.prototype.slice.call(i),a=(function(P){var N={};return P.forEach(function(re,V){return N[re]=V}),N})(s),u=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,c=String.fromCharCode.bind(String),l=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):function(P){return new Uint8Array(Array.prototype.slice.call(P,0))},f=function(P){return P.replace(/=/g,"").replace(/[+\/]/g,function(N){return N=="+"?"-":"_"})},h=function(P){return P.replace(/[^A-Za-z0-9\+\/]/g,"")},d=function(P){for(var N,re,V,le,Cr="",z=P.length%3,xe=0;xe<P.length;){if((re=P.charCodeAt(xe++))>255||(V=P.charCodeAt(xe++))>255||(le=P.charCodeAt(xe++))>255)throw new TypeError("invalid character found");N=re<<16|V<<8|le,Cr+=s[N>>18&63]+s[N>>12&63]+s[N>>6&63]+s[N&63]}return z?Cr.slice(0,z-3)+"===".substring(z):Cr},m=typeof btoa=="function"?function(P){return btoa(P)}:r?function(P){return Buffer.from(P,"binary").toString("base64")}:d,b=r?function(P){return Buffer.from(P).toString("base64")}:function(P){for(var N=4096,re=[],V=0,le=P.length;V<le;V+=N)re.push(c.apply(null,P.subarray(V,V+N)));return m(re.join(""))},D=function(P,N){return N===void 0&&(N=!1),N?f(b(P)):b(P)},E=function(P){if(P.length<2){var N=P.charCodeAt(0);return N<128?P: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+(P.charCodeAt(0)-55296)*1024+(P.charCodeAt(1)-56320);return c(240|N>>>18&7)+c(128|N>>>12&63)+c(128|N>>>6&63)+c(128|N&63)}},_=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,g=function(P){return P.replace(_,E)},x=r?function(P){return Buffer.from(P,"utf8").toString("base64")}:o?function(P){return b(o.encode(P))}:function(P){return m(g(P))},S=function(P,N){return N===void 0&&(N=!1),N?f(x(P)):x(P)},T=function(P){return S(P,!0)},O=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,B=function(P){switch(P.length){case 4:var N=(7&P.charCodeAt(0))<<18|(63&P.charCodeAt(1))<<12|(63&P.charCodeAt(2))<<6|63&P.charCodeAt(3),re=N-65536;return c((re>>>10)+55296)+c((re&1023)+56320);case 3:return c((15&P.charCodeAt(0))<<12|(63&P.charCodeAt(1))<<6|63&P.charCodeAt(2));default:return c((31&P.charCodeAt(0))<<6|63&P.charCodeAt(1))}},I=function(P){return P.replace(O,B)},L=function(P){if(P=P.replace(/\s+/g,""),!u.test(P))throw new TypeError("malformed base64.");P+="==".slice(2-(P.length&3));for(var N,re,V,le=[],Cr=0;Cr<P.length;)N=a[P.charAt(Cr++)]<<18|a[P.charAt(Cr++)]<<12|(re=a[P.charAt(Cr++)])<<6|(V=a[P.charAt(Cr++)]),re===64?le.push(c(N>>16&255)):V===64?le.push(c(N>>16&255,N>>8&255)):le.push(c(N>>16&255,N>>8&255,N&255));return le.join("")},F=typeof atob=="function"?function(P){return atob(h(P))}:r?function(P){return Buffer.from(P,"base64").toString("binary")}:L,U=r?function(P){return l(Buffer.from(P,"base64"))}:function(P){return l(F(P).split("").map(function(N){return N.charCodeAt(0)}))},M=function(P){return U($(P))},te=r?function(P){return Buffer.from(P,"base64").toString("utf8")}:n?function(P){return n.decode(U(P))}:function(P){return I(F(P))},$=function(P){return h(P.replace(/[-_]/g,function(N){return N=="-"?"+":"/"}))},y=function(P){return te($(P))},w=function(P){if(typeof P!="string")return!1;var N=P.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(N)||!/[^\s0-9a-zA-Z\-_]/.test(N)},v=function(P){return{value:P,enumerable:!1,writable:!0,configurable:!0}},A=function(){var P=function(N,re){return Object.defineProperty(String.prototype,N,v(re))};P("fromBase64",function(){return y(this)}),P("toBase64",function(N){return S(this,N)}),P("toBase64URI",function(){return S(this,!0)}),P("toBase64URL",function(){return S(this,!0)}),P("toUint8Array",function(){return M(this)})},R=function(){var P=function(N,re){return Object.defineProperty(Uint8Array.prototype,N,v(re))};P("toBase64",function(N){return D(this,N)}),P("toBase64URI",function(){return D(this,!0)}),P("toBase64URL",function(){return D(this,!0)})},k=function(){A(),R()},q={version:t,VERSION:e,atob:F,atobPolyfill:L,btoa:m,btoaPolyfill:d,fromBase64:y,toBase64:S,encode:S,encodeURI:T,encodeURL:T,utob:g,btou:I,decode:y,isValid:w,fromUint8Array:D,toUint8Array:M,extendString:A,extendUint8Array:R,extendBuiltins:k};return q.Base64={},Object.keys(q).forEach(function(P){return q.Base64[P]=q[P]}),q})});var yw=C((MX,Dw)=>{"use strict";Dw.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 vw=C(dh=>{"use strict";var tR=Object.prototype.hasOwnProperty,rR;function bw(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch{return null}}function ww(t){try{return encodeURIComponent(t)}catch{return null}}function nR(t){for(var e=/([^=?#&]+)=?([^&]*)/g,r={},n;n=e.exec(t);){var o=bw(n[1]),i=bw(n[2]);o===null||i===null||o in r||(r[o]=i)}return r}function oR(t,e){e=e||"";var r=[],n,o;typeof e!="string"&&(e="?");for(o in t)if(tR.call(t,o)){if(n=t[o],!n&&(n===null||n===rR||isNaN(n))&&(n=""),o=ww(o),n=ww(n),o===null||n===null)continue;r.push(o+"="+n)}return r.length?e+r.join("&"):""}dh.stringify=oR;dh.parse=nR});var Ow=C((HX,Fw)=>{"use strict";var Cw=yw(),sc=vw(),iR=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,_w=/[\n\r\t]/g,sR=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,xw=/:\d+$/,aR=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,uR=/^[a-zA-Z]:/;function mh(t){return(t||"").toString().replace(iR,"")}var hh=[["#","hash"],["?","query"],function(e,r){return Nr(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]],Ew={hash:1,query:1};function Sw(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 Lr(unescape(t.pathname),{});else if(o==="string"){n=new Lr(t,{});for(i in Ew)delete n[i]}else if(o==="object"){for(i in t)i in Ew||(n[i]=t[i]);n.slashes===void 0&&(n.slashes=sR.test(t.href))}return n}function Nr(t){return t==="file:"||t==="ftp:"||t==="http:"||t==="https:"||t==="ws:"||t==="wss:"}function Aw(t,e){t=mh(t),t=t.replace(_w,""),e=e||{};var r=aR.exec(t),n=r[1]?r[1].toLowerCase():"",o=!!r[2],i=!!r[3],s=0,a;return o?i?(a=r[2]+r[3]+r[4],s=r[2].length+r[3].length):(a=r[2]+r[4],s=r[2].length):i?(a=r[3]+r[4],s=r[3].length):a=r[4],n==="file:"?s>=2&&(a=a.slice(2)):Nr(n)?a=r[4]:n?o&&(a=a.slice(2)):s>=2&&Nr(e.protocol)&&(a=r[4]),{protocol:n,slashes:o||Nr(n),slashesCount:s,rest:a}}function cR(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,s=0;n--;)r[n]==="."?r.splice(n,1):r[n]===".."?(r.splice(n,1),s++):s&&(n===0&&(i=!0),r.splice(n,1),s--);return i&&r.unshift(""),(o==="."||o==="..")&&r.push(""),r.join("/")}function Lr(t,e,r){if(t=mh(t),t=t.replace(_w,""),!(this instanceof Lr))return new Lr(t,e,r);var n,o,i,s,a,u,c=hh.slice(),l=typeof e,f=this,h=0;for(l!=="object"&&l!=="string"&&(r=e,e=null),r&&typeof r!="function"&&(r=sc.parse),e=Sw(e),o=Aw(t||"",e),n=!o.protocol&&!o.slashes,f.slashes=o.slashes||n&&e.slashes,f.protocol=o.protocol||e.protocol||"",t=o.rest,(o.protocol==="file:"&&(o.slashesCount!==2||uR.test(t))||!o.slashes&&(o.protocol||o.slashesCount<2||!Nr(f.protocol)))&&(c[3]=[/(.*)/,"pathname"]);h<c.length;h++){if(s=c[h],typeof s=="function"){t=s(t,f);continue}i=s[0],u=s[1],i!==i?f[u]=t:typeof i=="string"?(a=i==="@"?t.lastIndexOf(i):t.indexOf(i),~a&&(typeof s[2]=="number"?(f[u]=t.slice(0,a),t=t.slice(a+s[2])):(f[u]=t.slice(a),t=t.slice(0,a)))):(a=i.exec(t))&&(f[u]=a[1],t=t.slice(0,a.index)),f[u]=f[u]||n&&s[3]&&e[u]||"",s[4]&&(f[u]=f[u].toLowerCase())}r&&(f.query=r(f.query)),n&&e.slashes&&f.pathname.charAt(0)!=="/"&&(f.pathname!==""||e.pathname!=="")&&(f.pathname=cR(f.pathname,e.pathname)),f.pathname.charAt(0)!=="/"&&Nr(f.protocol)&&(f.pathname="/"+f.pathname),Cw(f.port,f.protocol)||(f.host=f.hostname,f.port=""),f.username=f.password="",f.auth&&(a=f.auth.indexOf(":"),~a?(f.username=f.auth.slice(0,a),f.username=encodeURIComponent(decodeURIComponent(f.username)),f.password=f.auth.slice(a+1),f.password=encodeURIComponent(decodeURIComponent(f.password))):f.username=encodeURIComponent(decodeURIComponent(f.auth)),f.auth=f.password?f.username+":"+f.password:f.username),f.origin=f.protocol!=="file:"&&Nr(f.protocol)&&f.host?f.protocol+"//"+f.host:"null",f.href=f.toString()}function lR(t,e,r){var n=this;switch(t){case"query":typeof e=="string"&&e.length&&(e=(r||sc.parse)(e)),n[t]=e;break;case"port":n[t]=e,Cw(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,xw.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 s=0;s<hh.length;s++){var a=hh[s];a[4]&&(n[a[1]]=n[a[1]].toLowerCase())}return n.auth=n.password?n.username+":"+n.password:n.username,n.origin=n.protocol!=="file:"&&Nr(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function fR(t){(!t||typeof t!="function")&&(t=sc.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||Nr(r.protocol)?"//":"");return r.username?(i+=r.username,r.password&&(i+=":"+r.password),i+="@"):r.password?(i+=":"+r.password,i+="@"):r.protocol!=="file:"&&Nr(r.protocol)&&!n&&r.pathname!=="/"&&(i+="@"),(n[n.length-1]===":"||xw.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}Lr.prototype={set:lR,toString:fR};Lr.extractProtocol=Aw;Lr.location=Sw;Lr.trimLeft=mh;Lr.qs=sc;Fw.exports=Lr});var kw=C(gh=>{"use strict";Object.defineProperty(gh,"__esModule",{value:!0});gh.default=pR;function pR(){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 zw=C(lc=>{"use strict";Object.defineProperty(lc,"__esModule",{value:!0});lc.default=void 0;var dR=gw(),hR=bh(Ow()),ac=bh(ch()),io=lh(),mR=bh(kw());function bh(t){return t&&t.__esModule?t:{default:t}}function Dh(){"use strict";Dh=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(y,w,v){y[w]=v.value},i=typeof Symbol=="function"?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(y,w,v){return Object.defineProperty(y,w,{value:v,enumerable:!0,configurable:!0,writable:!0}),y[w]}try{c({},"")}catch{c=function(v,A,R){return v[A]=R}}function l(y,w,v,A){var R=w&&w.prototype instanceof E?w:E,k=Object.create(R.prototype),q=new te(A||[]);return o(k,"_invoke",{value:L(y,v,q)}),k}function f(y,w,v){try{return{type:"normal",arg:y.call(w,v)}}catch(A){return{type:"throw",arg:A}}}e.wrap=l;var h="suspendedStart",d="suspendedYield",m="executing",b="completed",D={};function E(){}function _(){}function g(){}var x={};c(x,s,function(){return this});var S=Object.getPrototypeOf,T=S&&S(S($([])));T&&T!==r&&n.call(T,s)&&(x=T);var O=g.prototype=E.prototype=Object.create(x);function B(y){["next","throw","return"].forEach(function(w){c(y,w,function(v){return this._invoke(w,v)})})}function I(y,w){function v(R,k,q,P){var N=f(y[R],y,k);if(N.type!=="throw"){var re=N.arg,V=re.value;return V&&so(V)=="object"&&n.call(V,"__await")?w.resolve(V.__await).then(function(le){v("next",le,q,P)},function(le){v("throw",le,q,P)}):w.resolve(V).then(function(le){re.value=le,q(re)},function(le){return v("throw",le,q,P)})}P(N.arg)}var A;o(this,"_invoke",{value:function(k,q){function P(){return new w(function(N,re){v(k,q,N,re)})}return A=A?A.then(P,P):P()}})}function L(y,w,v){var A=h;return function(R,k){if(A===m)throw Error("Generator is already running");if(A===b){if(R==="throw")throw k;return{value:t,done:!0}}for(v.method=R,v.arg=k;;){var q=v.delegate;if(q){var P=F(q,v);if(P){if(P===D)continue;return P}}if(v.method==="next")v.sent=v._sent=v.arg;else if(v.method==="throw"){if(A===h)throw A=b,v.arg;v.dispatchException(v.arg)}else v.method==="return"&&v.abrupt("return",v.arg);A=m;var N=f(y,w,v);if(N.type==="normal"){if(A=v.done?b:d,N.arg===D)continue;return{value:N.arg,done:v.done}}N.type==="throw"&&(A=b,v.method="throw",v.arg=N.arg)}}}function F(y,w){var v=w.method,A=y.iterator[v];if(A===t)return w.delegate=null,v==="throw"&&y.iterator.return&&(w.method="return",w.arg=t,F(y,w),w.method==="throw")||v!=="return"&&(w.method="throw",w.arg=new TypeError("The iterator does not provide a '"+v+"' method")),D;var R=f(A,y.iterator,w.arg);if(R.type==="throw")return w.method="throw",w.arg=R.arg,w.delegate=null,D;var k=R.arg;return k?k.done?(w[y.resultName]=k.value,w.next=y.nextLoc,w.method!=="return"&&(w.method="next",w.arg=t),w.delegate=null,D):k:(w.method="throw",w.arg=new TypeError("iterator result is not an object"),w.delegate=null,D)}function U(y){var w={tryLoc:y[0]};1 in y&&(w.catchLoc=y[1]),2 in y&&(w.finallyLoc=y[2],w.afterLoc=y[3]),this.tryEntries.push(w)}function M(y){var w=y.completion||{};w.type="normal",delete w.arg,y.completion=w}function te(y){this.tryEntries=[{tryLoc:"root"}],y.forEach(U,this),this.reset(!0)}function $(y){if(y||y===""){var w=y[s];if(w)return w.call(y);if(typeof y.next=="function")return y;if(!isNaN(y.length)){var v=-1,A=function R(){for(;++v<y.length;)if(n.call(y,v))return R.value=y[v],R.done=!1,R;return R.value=t,R.done=!0,R};return A.next=A}}throw new TypeError(so(y)+" is not iterable")}return _.prototype=g,o(O,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:_,configurable:!0}),_.displayName=c(g,u,"GeneratorFunction"),e.isGeneratorFunction=function(y){var w=typeof y=="function"&&y.constructor;return!!w&&(w===_||(w.displayName||w.name)==="GeneratorFunction")},e.mark=function(y){return Object.setPrototypeOf?Object.setPrototypeOf(y,g):(y.__proto__=g,c(y,u,"GeneratorFunction")),y.prototype=Object.create(O),y},e.awrap=function(y){return{__await:y}},B(I.prototype),c(I.prototype,a,function(){return this}),e.AsyncIterator=I,e.async=function(y,w,v,A,R){R===void 0&&(R=Promise);var k=new I(l(y,w,v,A),R);return e.isGeneratorFunction(w)?k:k.next().then(function(q){return q.done?q.value:k.next()})},B(O),c(O,u,"Generator"),c(O,s,function(){return this}),c(O,"toString",function(){return"[object Generator]"}),e.keys=function(y){var w=Object(y),v=[];for(var A in w)v.push(A);return v.reverse(),function R(){for(;v.length;){var k=v.pop();if(k in w)return R.value=k,R.done=!1,R}return R.done=!0,R}},e.values=$,te.prototype={constructor:te,reset:function(w){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(M),!w)for(var v in this)v.charAt(0)==="t"&&n.call(this,v)&&!isNaN(+v.slice(1))&&(this[v]=t)},stop:function(){this.done=!0;var w=this.tryEntries[0].completion;if(w.type==="throw")throw w.arg;return this.rval},dispatchException:function(w){if(this.done)throw w;var v=this;function A(re,V){return q.type="throw",q.arg=w,v.next=re,V&&(v.method="next",v.arg=t),!!V}for(var R=this.tryEntries.length-1;R>=0;--R){var k=this.tryEntries[R],q=k.completion;if(k.tryLoc==="root")return A("end");if(k.tryLoc<=this.prev){var P=n.call(k,"catchLoc"),N=n.call(k,"finallyLoc");if(P&&N){if(this.prev<k.catchLoc)return A(k.catchLoc,!0);if(this.prev<k.finallyLoc)return A(k.finallyLoc)}else if(P){if(this.prev<k.catchLoc)return A(k.catchLoc,!0)}else{if(!N)throw Error("try statement without catch or finally");if(this.prev<k.finallyLoc)return A(k.finallyLoc)}}}},abrupt:function(w,v){for(var A=this.tryEntries.length-1;A>=0;--A){var R=this.tryEntries[A];if(R.tryLoc<=this.prev&&n.call(R,"finallyLoc")&&this.prev<R.finallyLoc){var k=R;break}}k&&(w==="break"||w==="continue")&&k.tryLoc<=v&&v<=k.finallyLoc&&(k=null);var q=k?k.completion:{};return q.type=w,q.arg=v,k?(this.method="next",this.next=k.finallyLoc,D):this.complete(q)},complete:function(w,v){if(w.type==="throw")throw w.arg;return w.type==="break"||w.type==="continue"?this.next=w.arg:w.type==="return"?(this.rval=this.arg=w.arg,this.method="return",this.next="end"):w.type==="normal"&&v&&(this.next=v),D},finish:function(w){for(var v=this.tryEntries.length-1;v>=0;--v){var A=this.tryEntries[v];if(A.finallyLoc===w)return this.complete(A.completion,A.afterLoc),M(A),D}},catch:function(w){for(var v=this.tryEntries.length-1;v>=0;--v){var A=this.tryEntries[v];if(A.tryLoc===w){var R=A.completion;if(R.type==="throw"){var k=R.arg;M(A)}return k}}throw Error("illegal catch attempt")},delegateYield:function(w,v,A){return this.delegate={iterator:$(w),resultName:v,nextLoc:A},this.method==="next"&&(this.arg=t),D}},e}function $w(t,e,r,n,o,i,s){try{var a=t[i](s),u=a.value}catch(c){r(c);return}a.done?e(u):Promise.resolve(u).then(n,o)}function gR(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function s(u){$w(i,n,o,s,a,"next",u)}function a(u){$w(i,n,o,s,a,"throw",u)}s(void 0)})}}function Uw(t,e){return bR(t)||yR(t,e)||Mw(t,e)||DR()}function DR(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
35
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function yR(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,o,i,s,a=[],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)&&(a.push(n.value),a.length!==e);u=!0);}catch(l){c=!0,o=l}finally{try{if(!u&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(c)throw o}}return a}}function bR(t){if(Array.isArray(t))return t}function so(t){"@babel/helpers - typeof";return so=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},so(t)}function wR(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Mw(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(c){throw c},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
36
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,s=!1,a;return{s:function(){r=r.call(t)},n:function(){var c=r.next();return i=c.done,c},e:function(c){s=!0,a=c},f:function(){try{!i&&r.return!=null&&r.return()}finally{if(s)throw a}}}}function Mw(t,e){if(t){if(typeof t=="string")return Pw(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 Pw(t,e)}}function Pw(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 Tw(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 di(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Tw(Object(r),!0).forEach(function(n){vR(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Tw(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function vR(t,e,r){return e=qw(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ER(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,qw(n.key),n)}}function CR(t,e,r){return e&&Rw(t.prototype,e),r&&Rw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function qw(t){var e=_R(t,"string");return so(e)=="symbol"?e:e+""}function _R(t,e){if(so(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(so(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var uc="tus-v1",cc="ietf-draft-03",Ks="ietf-draft-05",xR={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:Vw,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:uc},Hw=(function(){function t(e,r){ER(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 CR(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(![uc,cc,Ks].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,s=["uploadUrl","uploadSize","uploadLengthDeferred"];i<s.length;i++){var a=s[i];if(this.options[a]){this._emitError(new Error("tus: cannot use the ".concat(a," option when parallelUploads is enabled")));return}}if(this.options.parallelUploadBoundaries){if(this.options.parallelUploads<=1){this._emitError(new Error("tus: cannot use the `parallelUploadBoundaries` option when `parallelUploads` is disabled"));return}if(this.options.parallelUploads!==this.options.parallelUploadBoundaries.length){this._emitError(new Error("tus: the `parallelUploadBoundaries` must have the same length as the value of `parallelUploads`"));return}}this.options.fingerprint(n,this.options).then(function(u){return u==null?(0,io.log)("No fingerprint was calculated meaning that the upload cannot be stored in the URL storage."):(0,io.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 s=this._parallelUploadUrls!=null?this._parallelUploadUrls.length:this.options.parallelUploads,a=(r=this.options.parallelUploadBoundaries)!==null&&r!==void 0?r:AR(this._source.size,s);this._parallelUploadUrls&&a.forEach(function(l,f){l.uploadUrl=n._parallelUploadUrls[f]||null}),this._parallelUploadUrls=new Array(a.length);var u=a.map(function(l,f){var h=0;return n._source.slice(l.start,l.end).then(function(d){var m=d.value;return new Promise(function(b,D){var E=di(di({},n.options),{},{uploadUrl:l.uploadUrl||null,storeFingerprintForResuming:!1,removeFingerprintOnSuccess:!1,parallelUploads:1,parallelUploadBoundaries:null,metadata:n.options.metadataForPartialUploads,headers:di(di({},n.options.headers),{},{"Upload-Concat":"partial"}),onSuccess:b,onError:D,onProgress:function(x){i=i-h+x,h=x,n._emitProgress(i,o)},onUploadUrlAvailable:function(){n._parallelUploadUrls[f]=_.url,n._parallelUploadUrls.filter(function(x){return!!x}).length===a.length&&n._saveUploadInUrlStorage()}}),_=new t(m,E);_.start(),n._parallelUploads.push(_)})})}),c;Promise.all(u).then(function(){c=n._openRequest("POST",n.options.endpoint),c.setHeader("Upload-Concat","final;".concat(n._parallelUploadUrls.join(" ")));var l=Iw(n.options.metadata);return l!==""&&c.setHeader("Upload-Metadata",l),n._sendRequest(c,null)}).then(function(l){if(!hi(l.getStatus(),200)){n._emitHttpError(c,l,"tus: unexpected response while creating upload");return}var f=l.getHeader("Location");if(f==null){n._emitHttpError(c,l,"tus: invalid or missing Location header");return}n.url=jw(n.options.endpoint,f),(0,io.log)("Created upload at ".concat(n.url)),n._emitSuccess(l)}).catch(function(l){n._emitError(l)})}},{key:"_startSingleUpload",value:function(){if(this._aborted=!1,this.url!=null){(0,io.log)("Resuming upload from previous URL: ".concat(this.url)),this._resumeUpload();return}if(this.options.uploadUrl!=null){(0,io.log)("Resuming upload from provided URL: ".concat(this.options.uploadUrl)),this.url=this.options.uploadUrl,this._resumeUpload();return}(0,io.log)("Creating a new upload"),this._createUpload()}},{key:"abort",value:function(r){var n=this;if(this._parallelUploads!=null){var o=wR(this._parallelUploads),i;try{for(o.s();!(i=o.n()).done;){var s=i.value;s.abort(r)}}catch(a){o.e(a)}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 ac.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),Lw(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=Iw(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===cc||this.options.protocol===Ks)&&n.setHeader("Upload-Complete","?0"),i=this._sendRequest(n,null)),i.then(function(s){if(!hi(s.getStatus(),200)){r._emitHttpError(n,s,"tus: unexpected response while creating upload");return}var a=s.getHeader("Location");if(a==null){r._emitHttpError(n,s,"tus: invalid or missing Location header");return}if(r.url=jw(r.options.endpoint,a),(0,io.log)("Created upload at ".concat(r.url)),typeof r.options.onUploadUrlAvailable=="function"&&r.options.onUploadUrlAvailable(),r._size===0){r._emitSuccess(s),r._source.close();return}r._saveUploadInUrlStorage().then(function(){r.options.uploadDataDuringCreation?r._handleUploadResponse(n,s):(r._offset=0,r._performUpload())})}).catch(function(s){r._emitHttpError(n,null,"tus: failed to create upload",s)})}},{key:"_resumeUpload",value:function(){var r=this,n=this._openRequest("HEAD",this.url),o=this._sendRequest(n,null);o.then(function(i){var s=i.getStatus();if(!hi(s,200)){if(s===423){r._emitHttpError(n,i,"tus: upload is currently locked; retry later");return}if(hi(s,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 a=Number.parseInt(i.getHeader("Upload-Offset"),10);if(Number.isNaN(a)){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===uc){r._emitHttpError(n,i,"tus: invalid or missing length value");return}typeof r.options.onUploadUrlAvailable=="function"&&r.options.onUploadUrlAvailable(),r._saveUploadInUrlStorage().then(function(){if(a===u){r._emitProgress(u,u),r._emitSuccess(i);return}r._offset=a,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(!hi(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(s){n._emitProgress(o+s,n._size)}),this.options.protocol===uc?r.setHeader("Content-Type","application/offset+octet-stream"):this.options.protocol===Ks&&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(s){var a=s.value,u=s.done,c=a!=null&&a.size?a.size:0;n.options.uploadLengthDeferred&&u&&(n._size=n._offset+c,r.setHeader("Upload-Length","".concat(n._size)));var l=n._offset+c;return!n.options.uploadLengthDeferred&&u&&l!==n._size?Promise.reject(new Error("upload was configured with a size of ".concat(n._size," bytes, but the source is done after ").concat(l," bytes"))):a===null?n._sendRequest(r):((n.options.protocol===cc||n.options.protocol===Ks)&&r.setHeader("Upload-Complete",u?"?1":"?0"),n._emitProgress(n._offset,n._size),n._sendRequest(r,a))})}},{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=Bw(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 Nw(r,n,this.options)}}],[{key:"terminate",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=Bw("DELETE",r,n);return Nw(o,null,n).then(function(i){if(i.getStatus()!==204)throw new ac.default("tus: unexpected response while terminating upload",null,o,i)}).catch(function(i){if(i instanceof ac.default||(i=new ac.default("tus: failed to terminate upload",i,o,null)),!Lw(i,0,n))throw i;var s=n.retryDelays[0],a=n.retryDelays.slice(1),u=di(di({},n),{},{retryDelays:a});return new Promise(function(c){return setTimeout(c,s)}).then(function(){return t.terminate(r,u)})})}}])})();function Iw(t){return Object.entries(t).map(function(e){var r=Uw(e,2),n=r[0],o=r[1];return"".concat(n," ").concat(dR.Base64.encode(String(o)))}).join(",")}function hi(t,e){return t>=e&&t<e+100}function Bw(t,e,r){var n=r.httpStack.createRequest(t,e);r.protocol===cc?n.setHeader("Upload-Draft-Interop-Version","5"):r.protocol===Ks?n.setHeader("Upload-Draft-Interop-Version","6"):n.setHeader("Tus-Resumable","1.0.0");for(var o=r.headers||{},i=0,s=Object.entries(o);i<s.length;i++){var a=Uw(s[i],2),u=a[0],c=a[1];n.setHeader(u,c)}if(r.addRequestId){var l=(0,mR.default)();n.setHeader("X-Request-ID",l)}return n}function Nw(t,e,r){return yh.apply(this,arguments)}function yh(){return yh=gR(Dh().mark(function t(e,r,n){var o;return Dh().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:if(typeof n.onBeforeRequest!="function"){s.next=3;break}return s.next=3,n.onBeforeRequest(e);case 3:return s.next=5,e.send(r);case 5:if(o=s.sent,typeof n.onAfterResponse!="function"){s.next=9;break}return s.next=9,n.onAfterResponse(e,o);case 9:return s.abrupt("return",o);case 10:case"end":return s.stop()}},t)})),yh.apply(this,arguments)}function SR(){var t=!0;return typeof navigator<"u"&&navigator.onLine===!1&&(t=!1),t}function Lw(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):Vw(t)}function Vw(t){var e=t.originalResponse?t.originalResponse.getStatus():0;return(!hi(e,400)||e===409||e===423)&&SR()}function jw(t,e){return new hR.default(e,t).toString()}function AR(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}Hw.defaultOptions=xR;var zX=lc.default=Hw});var Ww=C((WX,Gw)=>{"use strict";var jr=t=>t!==null&&typeof t=="object"&&typeof t.pipe=="function";jr.writable=t=>jr(t)&&t.writable!==!1&&typeof t._write=="function"&&typeof t._writableState=="object";jr.readable=t=>jr(t)&&t.readable!==!1&&typeof t._read=="function"&&typeof t._readableState=="object";jr.duplex=t=>jr.writable(t)&&jr.readable(t);jr.transform=t=>jr.duplex(t)&&typeof t._transform=="function";Gw.exports=jr});var Xw=C(fc=>{"use strict";Object.defineProperty(fc,"__esModule",{value:!0});fc.default=void 0;function Xs(t){"@babel/helpers - typeof";return Xs=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},Xs(t)}function FR(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,kR(n.key),n)}}function OR(t,e,r){return e&&Kw(t.prototype,e),r&&Kw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function kR(t){var e=$R(t,"string");return Xs(e)=="symbol"?e:e+""}function $R(t,e){if(Xs(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Xs(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var KX=fc.default=(function(){function t(e){FR(this,t),this._buffer=e,this.size=e.length}return OR(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 Qw=C(Eh=>{"use strict";Object.defineProperty(Eh,"__esModule",{value:!0});Eh.default=NR;var Zw=require("fs");function ao(t){"@babel/helpers - typeof";return ao=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},ao(t)}function wh(){"use strict";wh=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(y,w,v){y[w]=v.value},i=typeof Symbol=="function"?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(y,w,v){return Object.defineProperty(y,w,{value:v,enumerable:!0,configurable:!0,writable:!0}),y[w]}try{c({},"")}catch{c=function(v,A,R){return v[A]=R}}function l(y,w,v,A){var R=w&&w.prototype instanceof E?w:E,k=Object.create(R.prototype),q=new te(A||[]);return o(k,"_invoke",{value:L(y,v,q)}),k}function f(y,w,v){try{return{type:"normal",arg:y.call(w,v)}}catch(A){return{type:"throw",arg:A}}}e.wrap=l;var h="suspendedStart",d="suspendedYield",m="executing",b="completed",D={};function E(){}function _(){}function g(){}var x={};c(x,s,function(){return this});var S=Object.getPrototypeOf,T=S&&S(S($([])));T&&T!==r&&n.call(T,s)&&(x=T);var O=g.prototype=E.prototype=Object.create(x);function B(y){["next","throw","return"].forEach(function(w){c(y,w,function(v){return this._invoke(w,v)})})}function I(y,w){function v(R,k,q,P){var N=f(y[R],y,k);if(N.type!=="throw"){var re=N.arg,V=re.value;return V&&ao(V)=="object"&&n.call(V,"__await")?w.resolve(V.__await).then(function(le){v("next",le,q,P)},function(le){v("throw",le,q,P)}):w.resolve(V).then(function(le){re.value=le,q(re)},function(le){return v("throw",le,q,P)})}P(N.arg)}var A;o(this,"_invoke",{value:function(k,q){function P(){return new w(function(N,re){v(k,q,N,re)})}return A=A?A.then(P,P):P()}})}function L(y,w,v){var A=h;return function(R,k){if(A===m)throw Error("Generator is already running");if(A===b){if(R==="throw")throw k;return{value:t,done:!0}}for(v.method=R,v.arg=k;;){var q=v.delegate;if(q){var P=F(q,v);if(P){if(P===D)continue;return P}}if(v.method==="next")v.sent=v._sent=v.arg;else if(v.method==="throw"){if(A===h)throw A=b,v.arg;v.dispatchException(v.arg)}else v.method==="return"&&v.abrupt("return",v.arg);A=m;var N=f(y,w,v);if(N.type==="normal"){if(A=v.done?b:d,N.arg===D)continue;return{value:N.arg,done:v.done}}N.type==="throw"&&(A=b,v.method="throw",v.arg=N.arg)}}}function F(y,w){var v=w.method,A=y.iterator[v];if(A===t)return w.delegate=null,v==="throw"&&y.iterator.return&&(w.method="return",w.arg=t,F(y,w),w.method==="throw")||v!=="return"&&(w.method="throw",w.arg=new TypeError("The iterator does not provide a '"+v+"' method")),D;var R=f(A,y.iterator,w.arg);if(R.type==="throw")return w.method="throw",w.arg=R.arg,w.delegate=null,D;var k=R.arg;return k?k.done?(w[y.resultName]=k.value,w.next=y.nextLoc,w.method!=="return"&&(w.method="next",w.arg=t),w.delegate=null,D):k:(w.method="throw",w.arg=new TypeError("iterator result is not an object"),w.delegate=null,D)}function U(y){var w={tryLoc:y[0]};1 in y&&(w.catchLoc=y[1]),2 in y&&(w.finallyLoc=y[2],w.afterLoc=y[3]),this.tryEntries.push(w)}function M(y){var w=y.completion||{};w.type="normal",delete w.arg,y.completion=w}function te(y){this.tryEntries=[{tryLoc:"root"}],y.forEach(U,this),this.reset(!0)}function $(y){if(y||y===""){var w=y[s];if(w)return w.call(y);if(typeof y.next=="function")return y;if(!isNaN(y.length)){var v=-1,A=function R(){for(;++v<y.length;)if(n.call(y,v))return R.value=y[v],R.done=!1,R;return R.value=t,R.done=!0,R};return A.next=A}}throw new TypeError(ao(y)+" is not iterable")}return _.prototype=g,o(O,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:_,configurable:!0}),_.displayName=c(g,u,"GeneratorFunction"),e.isGeneratorFunction=function(y){var w=typeof y=="function"&&y.constructor;return!!w&&(w===_||(w.displayName||w.name)==="GeneratorFunction")},e.mark=function(y){return Object.setPrototypeOf?Object.setPrototypeOf(y,g):(y.__proto__=g,c(y,u,"GeneratorFunction")),y.prototype=Object.create(O),y},e.awrap=function(y){return{__await:y}},B(I.prototype),c(I.prototype,a,function(){return this}),e.AsyncIterator=I,e.async=function(y,w,v,A,R){R===void 0&&(R=Promise);var k=new I(l(y,w,v,A),R);return e.isGeneratorFunction(w)?k:k.next().then(function(q){return q.done?q.value:k.next()})},B(O),c(O,u,"Generator"),c(O,s,function(){return this}),c(O,"toString",function(){return"[object Generator]"}),e.keys=function(y){var w=Object(y),v=[];for(var A in w)v.push(A);return v.reverse(),function R(){for(;v.length;){var k=v.pop();if(k in w)return R.value=k,R.done=!1,R}return R.done=!0,R}},e.values=$,te.prototype={constructor:te,reset:function(w){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(M),!w)for(var v in this)v.charAt(0)==="t"&&n.call(this,v)&&!isNaN(+v.slice(1))&&(this[v]=t)},stop:function(){this.done=!0;var w=this.tryEntries[0].completion;if(w.type==="throw")throw w.arg;return this.rval},dispatchException:function(w){if(this.done)throw w;var v=this;function A(re,V){return q.type="throw",q.arg=w,v.next=re,V&&(v.method="next",v.arg=t),!!V}for(var R=this.tryEntries.length-1;R>=0;--R){var k=this.tryEntries[R],q=k.completion;if(k.tryLoc==="root")return A("end");if(k.tryLoc<=this.prev){var P=n.call(k,"catchLoc"),N=n.call(k,"finallyLoc");if(P&&N){if(this.prev<k.catchLoc)return A(k.catchLoc,!0);if(this.prev<k.finallyLoc)return A(k.finallyLoc)}else if(P){if(this.prev<k.catchLoc)return A(k.catchLoc,!0)}else{if(!N)throw Error("try statement without catch or finally");if(this.prev<k.finallyLoc)return A(k.finallyLoc)}}}},abrupt:function(w,v){for(var A=this.tryEntries.length-1;A>=0;--A){var R=this.tryEntries[A];if(R.tryLoc<=this.prev&&n.call(R,"finallyLoc")&&this.prev<R.finallyLoc){var k=R;break}}k&&(w==="break"||w==="continue")&&k.tryLoc<=v&&v<=k.finallyLoc&&(k=null);var q=k?k.completion:{};return q.type=w,q.arg=v,k?(this.method="next",this.next=k.finallyLoc,D):this.complete(q)},complete:function(w,v){if(w.type==="throw")throw w.arg;return w.type==="break"||w.type==="continue"?this.next=w.arg:w.type==="return"?(this.rval=this.arg=w.arg,this.method="return",this.next="end"):w.type==="normal"&&v&&(this.next=v),D},finish:function(w){for(var v=this.tryEntries.length-1;v>=0;--v){var A=this.tryEntries[v];if(A.finallyLoc===w)return this.complete(A.completion,A.afterLoc),M(A),D}},catch:function(w){for(var v=this.tryEntries.length-1;v>=0;--v){var A=this.tryEntries[v];if(A.tryLoc===w){var R=A.completion;if(R.type==="throw"){var k=R.arg;M(A)}return k}}throw Error("illegal catch attempt")},delegateYield:function(w,v,A){return this.delegate={iterator:$(w),resultName:v,nextLoc:A},this.method==="next"&&(this.arg=t),D}},e}function PR(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,RR(n.key),n)}}function TR(t,e,r){return e&&Yw(t.prototype,e),r&&Yw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function RR(t){var e=IR(t,"string");return ao(e)=="symbol"?e:e+""}function IR(t,e){if(ao(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ao(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Jw(t,e,r,n,o,i,s){try{var a=t[i](s),u=a.value}catch(c){r(c);return}a.done?e(u):Promise.resolve(u).then(n,o)}function BR(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function s(u){Jw(i,n,o,s,a,"next",u)}function a(u){Jw(i,n,o,s,a,"throw",u)}s(void 0)})}}function NR(t){return vh.apply(this,arguments)}function vh(){return vh=BR(wh().mark(function t(e){var r,n,o,i,s,a,u;return wh().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return n=e.path.toString(),l.next=3,Zw.promises.stat(n);case 3:return o=l.sent,i=o.size,s=(r=e.start)!==null&&r!==void 0?r:0,a=Number.isFinite(e.end)?e.end+1:i,u=a-s,l.abrupt("return",new LR(e,n,u));case 9:case"end":return l.stop()}},t)})),vh.apply(this,arguments)}var LR=(function(){function t(e,r,n){PR(this,t),this._stream=e,this._path=r,this.size=n}return TR(t,[{key:"slice",value:function(r,n){var o,i=(o=this._stream.start)!==null&&o!==void 0?o:0,s=(0,Zw.createReadStream)(this._path,{start:i+r,end:i+n-1,autoClose:!0});s.size=Math.min(n-r,this.size);var a=s.size>=this.size;return Promise.resolve({value:s,done:a})}},{key:"close",value:function(){this._stream.destroy()}}])})()});var _h=C(pc=>{"use strict";Object.defineProperty(pc,"__esModule",{value:!0});pc.default=void 0;function uo(t){"@babel/helpers - typeof";return uo=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},uo(t)}function Ys(){"use strict";Ys=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(y,w,v){y[w]=v.value},i=typeof Symbol=="function"?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(y,w,v){return Object.defineProperty(y,w,{value:v,enumerable:!0,configurable:!0,writable:!0}),y[w]}try{c({},"")}catch{c=function(v,A,R){return v[A]=R}}function l(y,w,v,A){var R=w&&w.prototype instanceof E?w:E,k=Object.create(R.prototype),q=new te(A||[]);return o(k,"_invoke",{value:L(y,v,q)}),k}function f(y,w,v){try{return{type:"normal",arg:y.call(w,v)}}catch(A){return{type:"throw",arg:A}}}e.wrap=l;var h="suspendedStart",d="suspendedYield",m="executing",b="completed",D={};function E(){}function _(){}function g(){}var x={};c(x,s,function(){return this});var S=Object.getPrototypeOf,T=S&&S(S($([])));T&&T!==r&&n.call(T,s)&&(x=T);var O=g.prototype=E.prototype=Object.create(x);function B(y){["next","throw","return"].forEach(function(w){c(y,w,function(v){return this._invoke(w,v)})})}function I(y,w){function v(R,k,q,P){var N=f(y[R],y,k);if(N.type!=="throw"){var re=N.arg,V=re.value;return V&&uo(V)=="object"&&n.call(V,"__await")?w.resolve(V.__await).then(function(le){v("next",le,q,P)},function(le){v("throw",le,q,P)}):w.resolve(V).then(function(le){re.value=le,q(re)},function(le){return v("throw",le,q,P)})}P(N.arg)}var A;o(this,"_invoke",{value:function(k,q){function P(){return new w(function(N,re){v(k,q,N,re)})}return A=A?A.then(P,P):P()}})}function L(y,w,v){var A=h;return function(R,k){if(A===m)throw Error("Generator is already running");if(A===b){if(R==="throw")throw k;return{value:t,done:!0}}for(v.method=R,v.arg=k;;){var q=v.delegate;if(q){var P=F(q,v);if(P){if(P===D)continue;return P}}if(v.method==="next")v.sent=v._sent=v.arg;else if(v.method==="throw"){if(A===h)throw A=b,v.arg;v.dispatchException(v.arg)}else v.method==="return"&&v.abrupt("return",v.arg);A=m;var N=f(y,w,v);if(N.type==="normal"){if(A=v.done?b:d,N.arg===D)continue;return{value:N.arg,done:v.done}}N.type==="throw"&&(A=b,v.method="throw",v.arg=N.arg)}}}function F(y,w){var v=w.method,A=y.iterator[v];if(A===t)return w.delegate=null,v==="throw"&&y.iterator.return&&(w.method="return",w.arg=t,F(y,w),w.method==="throw")||v!=="return"&&(w.method="throw",w.arg=new TypeError("The iterator does not provide a '"+v+"' method")),D;var R=f(A,y.iterator,w.arg);if(R.type==="throw")return w.method="throw",w.arg=R.arg,w.delegate=null,D;var k=R.arg;return k?k.done?(w[y.resultName]=k.value,w.next=y.nextLoc,w.method!=="return"&&(w.method="next",w.arg=t),w.delegate=null,D):k:(w.method="throw",w.arg=new TypeError("iterator result is not an object"),w.delegate=null,D)}function U(y){var w={tryLoc:y[0]};1 in y&&(w.catchLoc=y[1]),2 in y&&(w.finallyLoc=y[2],w.afterLoc=y[3]),this.tryEntries.push(w)}function M(y){var w=y.completion||{};w.type="normal",delete w.arg,y.completion=w}function te(y){this.tryEntries=[{tryLoc:"root"}],y.forEach(U,this),this.reset(!0)}function $(y){if(y||y===""){var w=y[s];if(w)return w.call(y);if(typeof y.next=="function")return y;if(!isNaN(y.length)){var v=-1,A=function R(){for(;++v<y.length;)if(n.call(y,v))return R.value=y[v],R.done=!1,R;return R.value=t,R.done=!0,R};return A.next=A}}throw new TypeError(uo(y)+" is not iterable")}return _.prototype=g,o(O,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:_,configurable:!0}),_.displayName=c(g,u,"GeneratorFunction"),e.isGeneratorFunction=function(y){var w=typeof y=="function"&&y.constructor;return!!w&&(w===_||(w.displayName||w.name)==="GeneratorFunction")},e.mark=function(y){return Object.setPrototypeOf?Object.setPrototypeOf(y,g):(y.__proto__=g,c(y,u,"GeneratorFunction")),y.prototype=Object.create(O),y},e.awrap=function(y){return{__await:y}},B(I.prototype),c(I.prototype,a,function(){return this}),e.AsyncIterator=I,e.async=function(y,w,v,A,R){R===void 0&&(R=Promise);var k=new I(l(y,w,v,A),R);return e.isGeneratorFunction(w)?k:k.next().then(function(q){return q.done?q.value:k.next()})},B(O),c(O,u,"Generator"),c(O,s,function(){return this}),c(O,"toString",function(){return"[object Generator]"}),e.keys=function(y){var w=Object(y),v=[];for(var A in w)v.push(A);return v.reverse(),function R(){for(;v.length;){var k=v.pop();if(k in w)return R.value=k,R.done=!1,R}return R.done=!0,R}},e.values=$,te.prototype={constructor:te,reset:function(w){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(M),!w)for(var v in this)v.charAt(0)==="t"&&n.call(this,v)&&!isNaN(+v.slice(1))&&(this[v]=t)},stop:function(){this.done=!0;var w=this.tryEntries[0].completion;if(w.type==="throw")throw w.arg;return this.rval},dispatchException:function(w){if(this.done)throw w;var v=this;function A(re,V){return q.type="throw",q.arg=w,v.next=re,V&&(v.method="next",v.arg=t),!!V}for(var R=this.tryEntries.length-1;R>=0;--R){var k=this.tryEntries[R],q=k.completion;if(k.tryLoc==="root")return A("end");if(k.tryLoc<=this.prev){var P=n.call(k,"catchLoc"),N=n.call(k,"finallyLoc");if(P&&N){if(this.prev<k.catchLoc)return A(k.catchLoc,!0);if(this.prev<k.finallyLoc)return A(k.finallyLoc)}else if(P){if(this.prev<k.catchLoc)return A(k.catchLoc,!0)}else{if(!N)throw Error("try statement without catch or finally");if(this.prev<k.finallyLoc)return A(k.finallyLoc)}}}},abrupt:function(w,v){for(var A=this.tryEntries.length-1;A>=0;--A){var R=this.tryEntries[A];if(R.tryLoc<=this.prev&&n.call(R,"finallyLoc")&&this.prev<R.finallyLoc){var k=R;break}}k&&(w==="break"||w==="continue")&&k.tryLoc<=v&&v<=k.finallyLoc&&(k=null);var q=k?k.completion:{};return q.type=w,q.arg=v,k?(this.method="next",this.next=k.finallyLoc,D):this.complete(q)},complete:function(w,v){if(w.type==="throw")throw w.arg;return w.type==="break"||w.type==="continue"?this.next=w.arg:w.type==="return"?(this.rval=this.arg=w.arg,this.method="return",this.next="end"):w.type==="normal"&&v&&(this.next=v),D},finish:function(w){for(var v=this.tryEntries.length-1;v>=0;--v){var A=this.tryEntries[v];if(A.finallyLoc===w)return this.complete(A.completion,A.afterLoc),M(A),D}},catch:function(w){for(var v=this.tryEntries.length-1;v>=0;--v){var A=this.tryEntries[v];if(A.tryLoc===w){var R=A.completion;if(R.type==="throw"){var k=R.arg;M(A)}return k}}throw Error("illegal catch attempt")},delegateYield:function(w,v,A){return this.delegate={iterator:$(w),resultName:v,nextLoc:A},this.method==="next"&&(this.arg=t),D}},e}function jR(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,MR(n.key),n)}}function UR(t,e,r){return e&&ev(t.prototype,e),r&&ev(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function MR(t){var e=qR(t,"string");return uo(e)=="symbol"?e:e+""}function qR(t,e){if(uo(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(uo(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function tv(t,e,r,n,o,i,s){try{var a=t[i](s),u=a.value}catch(c){r(c);return}a.done?e(u):Promise.resolve(u).then(n,o)}function rv(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function s(u){tv(i,n,o,s,a,"next",u)}function a(u){tv(i,n,o,s,a,"throw",u)}s(void 0)})}}function HR(t,e){return Ch.apply(this,arguments)}function Ch(){return Ch=rv(Ys().mark(function t(e,r){return Ys().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.abrupt("return",new Promise(function(i,s){var a=function(l){e.off("readable",u),s(l)},u=function c(){var l=e.read(r);l!==null&&(e.off("error",a),e.off("readable",c),i(l))};e.once("error",a),e.on("readable",u)}));case 1:case"end":return o.stop()}},t)})),Ch.apply(this,arguments)}var JX=pc.default=(function(){function t(e){var r=this;jR(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 UR(t,[{key:"slice",value:(function(){var e=rv(Ys().mark(function n(o,i){var s,a,u,c,l;return Ys().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:if(!(o<this._bufPos)){h.next=2;break}throw new Error("cannot slice from position which we already seeked away");case 2:if(!(o>this._bufPos+this._buf.length)){h.next=4;break}throw new Error("slice start is outside of buffer (currently not implemented)");case 4:if(!this._error){h.next=6;break}throw this._error;case 6:if(o<this._bufPos+this._buf.length?(a=o-this._bufPos,u=Math.min(this._buf.length,i-this._bufPos),s=this._buf.slice(a,u)):s=Buffer.alloc(0),!this._ended){h.next=10;break}return s.size=s.length,h.abrupt("return",{value:s,done:!0});case 10:if(c=i-o,!(c>s.length)){h.next=16;break}return h.next=14,HR(this._stream,c-s.length);case 14:l=h.sent,s=Buffer.concat([s,l]);case 16:return this._buf=s,this._bufPos=o,s.size=s.length,h.abrupt("return",{value:s,done:this._ended});case 20:case"end":return h.stop()}},n,this)}));function r(n,o){return e.apply(this,arguments)}return r})()},{key:"close",value:function(){this._stream.destroy()}}])})()});var ov=C(hc=>{"use strict";Object.defineProperty(hc,"__esModule",{value:!0});hc.default=void 0;var VR=require("fs"),zR=dc(Ww()),GR=dc(Xw()),WR=dc(Qw()),KR=dc(_h());function dc(t){return t&&t.__esModule?t:{default:t}}function Js(t){"@babel/helpers - typeof";return Js=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},Js(t)}function XR(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function nv(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,JR(n.key),n)}}function YR(t,e,r){return e&&nv(t.prototype,e),r&&nv(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function JR(t){var e=ZR(t,"string");return Js(e)=="symbol"?e:e+""}function ZR(t,e){if(Js(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Js(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var QX=hc.default=(function(){function t(){XR(this,t)}return YR(t,[{key:"openFile",value:function(r,n){return Buffer.isBuffer(r)?Promise.resolve(new GR.default(r)):r instanceof VR.ReadStream&&r.path!=null?(0,WR.default)(r):zR.default.readable(r)?(n=Number(n),Number.isFinite(n)?Promise.resolve(new KR.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 uv=C(xh=>{"use strict";Object.defineProperty(xh,"__esModule",{value:!0});xh.default=tI;var QR=require("crypto"),iv=av(require("fs")),eI=av(require("path"));function sv(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(sv=function(n){return n?r:e})(t)}function av(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=sv(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 s=o?Object.getOwnPropertyDescriptor(t,i):null;s&&(s.get||s.set)?Object.defineProperty(n,i,s):n[i]=t[i]}return n.default=t,r&&r.set(t,n),n}function tI(t,e){if(Buffer.isBuffer(t)){var r=65536,n=t.slice(0,Math.min(r,t.length)),o=(0,QR.createHash)("md5").update(n).digest("hex"),i=["node-buffer",o,t.length,e.endpoint].join("-");return Promise.resolve(i)}return t instanceof iv.ReadStream&&t.path!=null?new Promise(function(s,a){var u=eI.resolve(t.path);iv.stat(t.path,function(c,l){if(c){a(c);return}var f=["node-file",u,l.size,l.mtime.getTime(),e.endpoint].join("-");s(f)})}):Promise.resolve(null)}});var dv=C((rY,pv)=>{var fv="Expected a function",cv=NaN,rI="[object Symbol]",nI=/^\s+|\s+$/g,oI=/^[-+]0x[0-9a-f]+$/i,iI=/^0b[01]+$/i,sI=/^0o[0-7]+$/i,aI=parseInt,uI=typeof global=="object"&&global&&global.Object===Object&&global,cI=typeof self=="object"&&self&&self.Object===Object&&self,lI=uI||cI||Function("return this")(),fI=Object.prototype,pI=fI.toString,dI=Math.max,hI=Math.min,Sh=function(){return lI.Date.now()};function mI(t,e,r){var n,o,i,s,a,u,c=0,l=!1,f=!1,h=!0;if(typeof t!="function")throw new TypeError(fv);e=lv(e)||0,mc(r)&&(l=!!r.leading,f="maxWait"in r,i=f?dI(lv(r.maxWait)||0,e):i,h="trailing"in r?!!r.trailing:h);function d(T){var O=n,B=o;return n=o=void 0,c=T,s=t.apply(B,O),s}function m(T){return c=T,a=setTimeout(E,e),l?d(T):s}function b(T){var O=T-u,B=T-c,I=e-O;return f?hI(I,i-B):I}function D(T){var O=T-u,B=T-c;return u===void 0||O>=e||O<0||f&&B>=i}function E(){var T=Sh();if(D(T))return _(T);a=setTimeout(E,b(T))}function _(T){return a=void 0,h&&n?d(T):(n=o=void 0,s)}function g(){a!==void 0&&clearTimeout(a),c=0,n=u=o=a=void 0}function x(){return a===void 0?s:_(Sh())}function S(){var T=Sh(),O=D(T);if(n=arguments,o=this,u=T,O){if(a===void 0)return m(u);if(f)return a=setTimeout(E,e),d(u)}return a===void 0&&(a=setTimeout(E,e)),s}return S.cancel=g,S.flush=x,S}function gI(t,e,r){var n=!0,o=!0;if(typeof t!="function")throw new TypeError(fv);return mc(r)&&(n="leading"in r?!!r.leading:n,o="trailing"in r?!!r.trailing:o),mI(t,e,{leading:n,maxWait:e,trailing:o})}function mc(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function DI(t){return!!t&&typeof t=="object"}function yI(t){return typeof t=="symbol"||DI(t)&&pI.call(t)==rI}function lv(t){if(typeof t=="number")return t;if(yI(t))return cv;if(mc(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=mc(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(nI,"");var r=iI.test(t);return r||sI.test(t)?aI(t.slice(2),r?2:8):oI.test(t)?cv:+t}pv.exports=gI});var Ev=C(bc=>{"use strict";Object.defineProperty(bc,"__esModule",{value:!0});bc.default=void 0;var bI=bv(require("http")),wI=bv(require("https")),gv=require("stream"),vI=require("url"),Dv=EI(dv());function EI(t){return t&&t.__esModule?t:{default:t}}function yv(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(yv=function(n){return n?r:e})(t)}function bv(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=yv(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 s=o?Object.getOwnPropertyDescriptor(t,i):null;s&&(s.get||s.set)?Object.defineProperty(n,i,s):n[i]=t[i]}return n.default=t,r&&r.set(t,n),n}function CI(t,e,r){return e=gc(e),_I(t,wv()?Reflect.construct(e,r||[],gc(t).constructor):e.apply(t,r))}function _I(t,e){if(e&&(mi(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return xI(t)}function xI(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function wv(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(wv=function(){return!!t})()}function gc(t){return gc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},gc(t)}function SI(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&&Ah(t,e)}function Ah(t,e){return Ah=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Ah(t,e)}function hv(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 Zs(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?hv(Object(r),!0).forEach(function(n){AI(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):hv(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function AI(t,e,r){return e=vv(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function mi(t){"@babel/helpers - typeof";return mi=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},mi(t)}function Dc(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function mv(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,vv(n.key),n)}}function yc(t,e,r){return e&&mv(t.prototype,e),r&&mv(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function vv(t){var e=FI(t,"string");return mi(e)=="symbol"?e:e+""}function FI(t,e){if(mi(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(mi(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var nY=bc.default=(function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Dc(this,t),this._requestOptions=e}return yc(t,[{key:"createRequest",value:function(r,n){return new OI(r,n,this._requestOptions)}},{key:"getName",value:function(){return"NodeHttpStack"}}])})(),OI=(function(){function t(e,r,n){Dc(this,t),this._method=e,this._url=r,this._headers={},this._request=null,this._progressHandler=function(){},this._requestOptions=n||{}}return yc(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 s=Zs(Zs(Zs({},(0,vI.parse)(r._url)),r._requestOptions),{},{method:r._method,headers:Zs(Zs({},r._requestOptions.headers||{}),r._headers)});n!=null&&n.size&&(s.headers["Content-Length"]=n.size);var a=s.protocol==="https:"?wI:bI;r._request=a.request(s);var u=r._request;u.on("response",function(c){var l=[];c.on("data",function(f){l.push(f)}),c.on("end",function(){var f=Buffer.concat(l).toString("utf8");o(new kI(c,f))})}),u.on("error",function(c){i(c)}),n instanceof gv.Readable?n.pipe(new $I(r._progressHandler)).pipe(u):n instanceof Uint8Array?PI(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}}])})(),kI=(function(){function t(e,r){Dc(this,t),this._response=e,this._body=r}return yc(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}}])})(),$I=(function(t){function e(r){var n;return Dc(this,e),n=CI(this,e),n._onprogress=(0,Dv.default)(r,100,{leading:!0,trailing:!1}),n._position=0,n}return SI(e,t),yc(e,[{key:"_transform",value:function(n,o,i){this._position+=n.length,this._onprogress(this._position),i(null,n)}}])})(gv.Transform),PI=function(e,r,n){n=(0,Dv.default)(n,100,{leading:!0,trailing:!1});var o=0;function i(){var s=Math.min(e.writableHighWaterMark,r.length-o),a=r.subarray(o,o+s);o+=a.length;var u=e.write(a);u?o<r.length?i():e.end():(e.once("drain",i),n(o))}i()}});var Cv=C(Fh=>{"use strict";Fh.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};Fh.root=function(t,e,r){var n=this,o,i={stackLength:Error.stackTraceLimit,rootOnly:!0},s="",a=Error.stackTraceLimit,u;function c(){u[0]=n.toString(),n.stack=u.join(`
37
- `)}(!e||typeof e!="object")&&(e={}),e.hasOwnProperty("stackLength")&&typeof e.stackLength=="number"&&!isNaN(e.stackLength)&&e.stackLength>=0&&(i.stackLength=e.stackLength),e.hasOwnProperty("rootOnly")||(i.rootOnly=e.rootOnly),(!i.rootOnly||this.CustomError.parent===Error)&&(Object.keys(t).forEach(function(l){switch(l){case"code":o=t.code||void 0;break;case"message":s=t.message||"";break;default:n[l]=t[l]}}),Error.stackTraceLimit=i.stackLength+2,u=new Error().stack.split(`
38
- `),u.splice(0,3),u.unshift(""),Error.stackTraceLimit=a,this.stack=u.join(`
39
- `),Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,get:function(){return o},set:function(l){o=l,c()}}),Object.defineProperty(this,"message",{configurable:!0,enumerable:!0,get:function(){return s},set:function(l){s=l,c()}}),c())}});var Sv=C((sY,xv)=>{"use strict";xv.exports=co;co.factory=Cv();var $h=co("CustomError");$h.order=co($h,{message:"Arguments out of order.",code:"EOARG"});function co(t,e,r,n){var o,i;return e=wc(arguments,1,Error,_v,[Oh,vc]),r=wc(arguments,2,{},Oh,[vc]),n=wc(arguments,3,kh,vc,[]),t=wc(arguments,0,e===Error?"Error":e.prototype.CustomError.name,TI,[_v,Oh,vc]),i=e===Error,i&&n===kh&&(n=co.factory.root),o=function(s,a){var u,c,l,f,h,d;if(!(this instanceof o))return new o(s,a);for(delete this.constructor.name,Object.defineProperty(this.constructor,"name",{enumerable:!1,configurable:!0,value:t,writable:!1}),typeof s=="string"&&(s={message:s}),s||(s={}),c=this.CustomError.chain.slice(0).reverse().map(function(m){return m.properties}),c.push(s),c.unshift({}),d=Object.assign.apply(Object,c),u=this,l={},Object.keys(co.factory).forEach(function(m){l[m]=function(b,D){co.factory[m].call(u,b,D,l)}}),f=this.CustomError.chain.length-1;f>=0;f--)h=this.CustomError.chain[f],h.factory!==kh&&h.factory.call(this,d,a,l)},o.prototype=Object.create(e.prototype),o.prototype.constructor=o,o.prototype.name=t,o.prototype.CustomError={chain:i?[]:e.prototype.CustomError.chain.slice(0),factory:n,name:t,parent:e,properties:r},o.prototype.CustomError.chain.unshift(o.prototype.CustomError),o.prototype.toString=function(){var s=this.CustomError.chain[this.CustomError.chain.length-1].name;return this.code&&(s+=" "+this.code),this.message&&(s+=": "+this.message),s},o}function wc(t,e,r,n,o){var i=-1,s=-1,a,u,c=e<t.length?e:t.length,l;for(a=0;a<=c;a++){if(l=t[a],i===-1)for(u=0;u<o.length;u++)o[u](l)&&(i=a);s===-1&&n(l)&&(s=a)}if(s!==-1&&i!==-1&&i<s)throw new $h.order;return s!==-1?t[s]:r}function vc(t){return typeof t=="function"&&t!==Error&&!t.prototype.CustomError}function TI(t){return typeof t=="string"}function _v(t){return typeof t=="function"&&(t===Error||t.prototype.CustomError)}function Oh(t){return t&&typeof t=="object"}function kh(){}});var Fv=C((aY,Av)=>{Av.exports=Sv()});var Tv=C((lo,gi)=>{var RI=1/0,II="[object Symbol]",Qs={function:!0,object:!0},BI=Qs[typeof lo]&&lo&&!lo.nodeType?lo:void 0,NI=Qs[typeof gi]&&gi&&!gi.nodeType?gi:void 0,LI=Ec(BI&&NI&&typeof global=="object"&&global),jI=Ec(Qs[typeof self]&&self),Ov=Ec(Qs[typeof window]&&window),Ph=Ec(Qs[typeof lo]&&lo),UI=LI||Ov!==(Ph&&Ph.window)&&Ov||jI||Ph||Function("return this")();function Ec(t){return t&&t.Object===Object?t:null}var MI=Object.prototype,qI=MI.toString,kv=UI.Symbol,$v=kv?kv.prototype:void 0,Pv=$v?$v.toString:void 0;function HI(t){if(typeof t=="string")return t;if(zI(t))return Pv?Pv.call(t):"";var e=t+"";return e=="0"&&1/t==-RI?"-0":e}function VI(t){return!!t&&typeof t=="object"}function zI(t){return typeof t=="symbol"||VI(t)&&qI.call(t)==II}gi.exports=HI});var Uv=C((fo,Di)=>{var GI=Tv(),WI="Expected a function",Iv="__lodash_hash_undefined__",KI="[object Function]",XI="[object GeneratorFunction]",YI=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g,JI=/[\\^$.*+?()[\]{}|]/g,ZI=/\\(\\)?/g,QI=/^\[object .+?Constructor\]$/,ta={function:!0,object:!0},e6=ta[typeof fo]&&fo&&!fo.nodeType?fo:void 0,t6=ta[typeof Di]&&Di&&!Di.nodeType?Di:void 0,r6=Cc(e6&&t6&&typeof global=="object"&&global),n6=Cc(ta[typeof self]&&self),Rv=Cc(ta[typeof window]&&window),Th=Cc(ta[typeof fo]&&fo),o6=r6||Rv!==(Th&&Th.window)&&Rv||n6||Th||Function("return this")();function Cc(t){return t&&t.Object===Object?t:null}function i6(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}var s6=Array.prototype,Bv=Object.prototype,Nv=Function.prototype.toString,Rh=Bv.hasOwnProperty,a6=Bv.toString,u6=RegExp("^"+Nv.call(Rh).replace(JI,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),c6=s6.splice,l6=Lv(o6,"Map"),ea=Lv(Object,"create");function po(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function f6(){this.__data__=ea?ea(null):{}}function p6(t){return this.has(t)&&delete this.__data__[t]}function d6(t){var e=this.__data__;if(ea){var r=e[t];return r===Iv?void 0:r}return Rh.call(e,t)?e[t]:void 0}function h6(t){var e=this.__data__;return ea?e[t]!==void 0:Rh.call(e,t)}function m6(t,e){var r=this.__data__;return r[t]=ea&&e===void 0?Iv:e,this}po.prototype.clear=f6;po.prototype.delete=p6;po.prototype.get=d6;po.prototype.has=h6;po.prototype.set=m6;function yi(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 g6(){this.__data__=[]}function D6(t){var e=this.__data__,r=_c(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():c6.call(e,r,1),!0}function y6(t){var e=this.__data__,r=_c(e,t);return r<0?void 0:e[r][1]}function b6(t){return _c(this.__data__,t)>-1}function w6(t,e){var r=this.__data__,n=_c(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}yi.prototype.clear=g6;yi.prototype.delete=D6;yi.prototype.get=y6;yi.prototype.has=b6;yi.prototype.set=w6;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 v6(){this.__data__={hash:new po,map:new(l6||yi),string:new po}}function E6(t){return xc(this,t).delete(t)}function C6(t){return xc(this,t).get(t)}function _6(t){return xc(this,t).has(t)}function x6(t,e){return xc(this,t).set(t,e),this}ho.prototype.clear=v6;ho.prototype.delete=E6;ho.prototype.get=C6;ho.prototype.has=_6;ho.prototype.set=x6;function _c(t,e){for(var r=t.length;r--;)if(O6(t[r][0],e))return r;return-1}function xc(t,e){var r=t.__data__;return S6(e)?r[typeof e=="string"?"string":"hash"]:r.map}function Lv(t,e){var r=t[e];return $6(r)?r:void 0}function S6(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var A6=Ih(function(t){var e=[];return P6(t).replace(YI,function(r,n,o,i){e.push(o?i.replace(ZI,"$1"):n||r)}),e});function F6(t){if(t!=null){try{return Nv.call(t)}catch{}try{return t+""}catch{}}return""}function Ih(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(WI);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 s=t.apply(this,n);return r.cache=i.set(o,s),s};return r.cache=new(Ih.Cache||ho),r}Ih.Cache=ho;function O6(t,e){return t===e||t!==t&&e!==e}function k6(t){var e=jv(t)?a6.call(t):"";return e==KI||e==XI}function jv(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function $6(t){if(!jv(t))return!1;var e=k6(t)||i6(t)?u6:QI;return e.test(F6(t))}function P6(t){return t==null?"":GI(t)}Di.exports=A6});var gE=C((mo,wi)=>{var T6=Uv(),R6=200,Gh="__lodash_hash_undefined__",kc=1,vi=2,I6=1/0,Gv=9007199254740991,Sc="[object Arguments]",Lh="[object Array]",Wv="[object Boolean]",Kv="[object Date]",Xv="[object Error]",Yv="[object Function]",B6="[object GeneratorFunction]",ra="[object Map]",Jv="[object Number]",bi="[object Object]",Mv="[object Promise]",Zv="[object RegExp]",na="[object Set]",Wh="[object String]",Qv="[object Symbol]",jh="[object WeakMap]",eE="[object ArrayBuffer]",Ac="[object DataView]",N6="[object Float32Array]",L6="[object Float64Array]",j6="[object Int8Array]",U6="[object Int16Array]",M6="[object Int32Array]",q6="[object Uint8Array]",H6="[object Uint8ClampedArray]",V6="[object Uint16Array]",z6="[object Uint32Array]",G6=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,W6=/^\w*$/,K6=/[\\^$.*+?()[\]{}|]/g,X6=/^\[object .+?Constructor\]$/,Y6=/^(?:0|[1-9]\d*)$/,Ne={};Ne[N6]=Ne[L6]=Ne[j6]=Ne[U6]=Ne[M6]=Ne[q6]=Ne[H6]=Ne[V6]=Ne[z6]=!0;Ne[Sc]=Ne[Lh]=Ne[eE]=Ne[Wv]=Ne[Ac]=Ne[Kv]=Ne[Xv]=Ne[Yv]=Ne[ra]=Ne[Jv]=Ne[bi]=Ne[Zv]=Ne[na]=Ne[Wh]=Ne[jh]=!1;var ia={function:!0,object:!0},J6=ia[typeof mo]&&mo&&!mo.nodeType?mo:void 0,Z6=ia[typeof wi]&&wi&&!wi.nodeType?wi:void 0,Q6=$c(J6&&Z6&&typeof global=="object"&&global),e8=$c(ia[typeof self]&&self),qv=$c(ia[typeof window]&&window),Bh=$c(ia[typeof mo]&&mo),yo=Q6||qv!==(Bh&&Bh.window)&&qv||e8||Bh||Function("return this")();function t8(t,e){for(var r=-1,n=t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}function r8(t,e){for(var r=-1,n=t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}function n8(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function o8(t,e){return t8(e,function(r){return[r,t[r]]})}function $c(t){return t&&t.Object===Object?t:null}function Uh(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function tE(t){var e=-1,r=Array(t.size);return t.forEach(function(n,o){r[++e]=[o,n]}),r}function i8(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}function s8(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=[n,n]}),r}var a8=Array.prototype,Pc=Object.prototype,rE=Function.prototype.toString,go=Pc.hasOwnProperty,bo=Pc.toString,u8=RegExp("^"+rE.call(go).replace(K6,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Hv=yo.Symbol,Vv=yo.Uint8Array,c8=Pc.propertyIsEnumerable,l8=a8.splice,f8=Object.getPrototypeOf,p8=Object.keys,Mh=Ei(yo,"DataView"),Fc=Ei(yo,"Map"),qh=Ei(yo,"Promise"),Hh=Ei(yo,"Set"),Vh=Ei(yo,"WeakMap"),oa=Ei(Object,"create"),d8=vo(Mh),h8=vo(Fc),m8=vo(qh),g8=vo(Hh),D8=vo(Vh),zv=Hv?Hv.prototype:void 0,Nh=zv?zv.valueOf:void 0;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 y8(){this.__data__=oa?oa(null):{}}function b8(t){return this.has(t)&&delete this.__data__[t]}function w8(t){var e=this.__data__;if(oa){var r=e[t];return r===Gh?void 0:r}return go.call(e,t)?e[t]:void 0}function v8(t){var e=this.__data__;return oa?e[t]!==void 0:go.call(e,t)}function E8(t,e){var r=this.__data__;return r[t]=oa&&e===void 0?Gh:e,this}Do.prototype.clear=y8;Do.prototype.delete=b8;Do.prototype.get=w8;Do.prototype.has=v8;Do.prototype.set=E8;function sn(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 C8(){this.__data__=[]}function _8(t){var e=this.__data__,r=Tc(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():l8.call(e,r,1),!0}function x8(t){var e=this.__data__,r=Tc(e,t);return r<0?void 0:e[r][1]}function S8(t){return Tc(this.__data__,t)>-1}function A8(t,e){var r=this.__data__,n=Tc(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}sn.prototype.clear=C8;sn.prototype.delete=_8;sn.prototype.get=x8;sn.prototype.has=S8;sn.prototype.set=A8;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 F8(){this.__data__={hash:new Do,map:new(Fc||sn),string:new Do}}function O8(t){return Rc(this,t).delete(t)}function k8(t){return Rc(this,t).get(t)}function $8(t){return Rc(this,t).has(t)}function P8(t,e){return Rc(this,t).set(t,e),this}wo.prototype.clear=F8;wo.prototype.delete=O8;wo.prototype.get=k8;wo.prototype.has=$8;wo.prototype.set=P8;function Oc(t){var e=-1,r=t?t.length:0;for(this.__data__=new wo;++e<r;)this.add(t[e])}function T8(t){return this.__data__.set(t,Gh),this}function R8(t){return this.__data__.has(t)}Oc.prototype.add=Oc.prototype.push=T8;Oc.prototype.has=R8;function on(t){this.__data__=new sn(t)}function I8(){this.__data__=new sn}function B8(t){return this.__data__.delete(t)}function N8(t){return this.__data__.get(t)}function L8(t){return this.__data__.has(t)}function j8(t,e){var r=this.__data__;return r instanceof sn&&r.__data__.length==R6&&(r=this.__data__=new wo(r.__data__)),r.set(t,e),this}on.prototype.clear=I8;on.prototype.delete=B8;on.prototype.get=N8;on.prototype.has=L8;on.prototype.set=j8;function Tc(t,e){for(var r=t.length;r--;)if(oB(t[r][0],e))return r;return-1}function nE(t,e){e=Ic(e,t)?[e]:sE(e);for(var r=0,n=e.length;t!=null&&r<n;)t=t[Bc(e[r++])];return r&&r==n?t:void 0}function oE(t,e){return go.call(t,e)||typeof t=="object"&&e in t&&Q8(t)===null}function U8(t,e){return e in Object(t)}function Kh(t,e,r,n,o){return t===e?!0:t==null||e==null||!Lc(t)&&!sa(e)?t!==t&&e!==e:M8(t,e,Kh,r,n,o)}function M8(t,e,r,n,o,i){var s=kn(t),a=kn(e),u=Lh,c=Lh;s||(u=nn(t),u=u==Sc?bi:u),a||(c=nn(e),c=c==Sc?bi:c);var l=u==bi&&!Uh(t),f=c==bi&&!Uh(e),h=u==c;if(h&&!l)return i||(i=new on),s||aB(t)?aE(t,e,r,n,o,i):X8(t,e,u,r,n,o,i);if(!(o&vi)){var d=l&&go.call(t,"__wrapped__"),m=f&&go.call(e,"__wrapped__");if(d||m){var b=d?t.value():t,D=m?e.value():e;return i||(i=new on),r(b,D,n,o,i)}}return h?(i||(i=new on),Y8(t,e,r,n,o,i)):!1}function q8(t,e,r,n){var o=r.length,i=o,s=!n;if(t==null)return!i;for(t=Object(t);o--;){var a=r[o];if(s&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++o<i;){a=r[o];var u=a[0],c=t[u],l=a[1];if(s&&a[2]){if(c===void 0&&!(u in t))return!1}else{var f=new on;if(n)var h=n(c,l,u,t,e,f);if(!(h===void 0?Kh(l,c,n,kc|vi,f):h))return!1}}return!0}function H8(t){return typeof t=="function"?t:t==null?fB:typeof t=="object"?kn(t)?G8(t[0],t[1]):z8(t):pB(t)}function V8(t){return p8(Object(t))}function z8(t){var e=Z8(t);return e.length==1&&e[0][2]?lE(e[0][0],e[0][1]):function(r){return r===t||q8(r,t,e)}}function G8(t,e){return Ic(t)&&cE(e)?lE(Bc(t),e):function(r){var n=uB(r,t);return n===void 0&&n===e?cB(r,t):Kh(e,n,void 0,kc|vi)}}function iE(t){return function(e){return e?.[t]}}function W8(t){return function(e){return nE(e,t)}}function sE(t){return kn(t)?t:T6(t)}function K8(t){return function(e){var r=nn(e);return r==ra?tE(e):r==na?s8(e):o8(e,t(e))}}function aE(t,e,r,n,o,i){var s=o&vi,a=t.length,u=e.length;if(a!=u&&!(s&&u>a))return!1;var c=i.get(t);if(c)return c==e;var l=-1,f=!0,h=o&kc?new Oc:void 0;for(i.set(t,e);++l<a;){var d=t[l],m=e[l];if(n)var b=s?n(m,d,l,e,t,i):n(d,m,l,t,e,i);if(b!==void 0){if(b)continue;f=!1;break}if(h){if(!r8(e,function(D,E){if(!h.has(E)&&(d===D||r(d,D,n,o,i)))return h.add(E)})){f=!1;break}}else if(!(d===m||r(d,m,n,o,i))){f=!1;break}}return i.delete(t),f}function X8(t,e,r,n,o,i,s){switch(r){case Ac:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case eE:return!(t.byteLength!=e.byteLength||!n(new Vv(t),new Vv(e)));case Wv:case Kv:return+t==+e;case Xv:return t.name==e.name&&t.message==e.message;case Jv:return t!=+t?e!=+e:t==+e;case Zv:case Wh:return t==e+"";case ra:var a=tE;case na:var u=i&vi;if(a||(a=i8),t.size!=e.size&&!u)return!1;var c=s.get(t);return c?c==e:(i|=kc,s.set(t,e),aE(a(t),a(e),n,o,i,s));case Qv:if(Nh)return Nh.call(t)==Nh.call(e)}return!1}function Y8(t,e,r,n,o,i){var s=o&vi,a=zh(t),u=a.length,c=zh(e),l=c.length;if(u!=l&&!s)return!1;for(var f=u;f--;){var h=a[f];if(!(s?h in e:oE(e,h)))return!1}var d=i.get(t);if(d)return d==e;var m=!0;i.set(t,e);for(var b=s;++f<u;){h=a[f];var D=t[h],E=e[h];if(n)var _=s?n(E,D,h,e,t,i):n(D,E,h,t,e,i);if(!(_===void 0?D===E||r(D,E,n,o,i):_)){m=!1;break}b||(b=h=="constructor")}if(m&&!b){var g=t.constructor,x=e.constructor;g!=x&&"constructor"in t&&"constructor"in e&&!(typeof g=="function"&&g instanceof g&&typeof x=="function"&&x instanceof x)&&(m=!1)}return i.delete(t),m}var J8=iE("length");function Rc(t,e){var r=t.__data__;return rB(e)?r[typeof e=="string"?"string":"hash"]:r.map}function Z8(t){for(var e=lB(t),r=e.length;r--;)e[r][2]=cE(e[r][1]);return e}function Ei(t,e){var r=t[e];return sB(r)?r:void 0}function Q8(t){return f8(Object(t))}function nn(t){return bo.call(t)}(Mh&&nn(new Mh(new ArrayBuffer(1)))!=Ac||Fc&&nn(new Fc)!=ra||qh&&nn(qh.resolve())!=Mv||Hh&&nn(new Hh)!=na||Vh&&nn(new Vh)!=jh)&&(nn=function(t){var e=bo.call(t),r=e==bi?t.constructor:void 0,n=r?vo(r):void 0;if(n)switch(n){case d8:return Ac;case h8:return ra;case m8:return Mv;case g8:return na;case D8:return jh}return e});function eB(t,e,r){e=Ic(e,t)?[e]:sE(e);for(var n,o=-1,s=e.length;++o<s;){var i=Bc(e[o]);if(!(n=t!=null&&r(t,i)))break;t=t[i]}if(n)return n;var s=t?t.length:0;return!!s&&Nc(s)&&uE(i,s)&&(kn(t)||hE(t)||fE(t))}function tB(t){var e=t?t.length:void 0;return Nc(e)&&(kn(t)||hE(t)||fE(t))?n8(e,String):null}function uE(t,e){return e=e??Gv,!!e&&(typeof t=="number"||Y6.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||mE(t)?!0:W6.test(t)||!G6.test(t)||e!=null&&t in Object(e)}function rB(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function nB(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Pc;return t===r}function cE(t){return t===t&&!Lc(t)}function lE(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}function Bc(t){if(typeof t=="string"||mE(t))return t;var e=t+"";return e=="0"&&1/t==-I6?"-0":e}function vo(t){if(t!=null){try{return rE.call(t)}catch{}try{return t+""}catch{}}return""}function oB(t,e){return t===e||t!==t&&e!==e}function fE(t){return iB(t)&&go.call(t,"callee")&&(!c8.call(t,"callee")||bo.call(t)==Sc)}var kn=Array.isArray;function pE(t){return t!=null&&Nc(J8(t))&&!dE(t)}function iB(t){return sa(t)&&pE(t)}function dE(t){var e=Lc(t)?bo.call(t):"";return e==Yv||e==B6}function Nc(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Gv}function Lc(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function sa(t){return!!t&&typeof t=="object"}function sB(t){if(!Lc(t))return!1;var e=dE(t)||Uh(t)?u8:X6;return e.test(vo(t))}function hE(t){return typeof t=="string"||!kn(t)&&sa(t)&&bo.call(t)==Wh}function mE(t){return typeof t=="symbol"||sa(t)&&bo.call(t)==Qv}function aB(t){return sa(t)&&Nc(t.length)&&!!Ne[bo.call(t)]}function uB(t,e,r){var n=t==null?void 0:nE(t,e);return n===void 0?r:n}function cB(t,e){return t!=null&&eB(t,e,U8)}function zh(t){var e=nB(t);if(!(e||pE(t)))return V8(t);var r=tB(t),n=!!r,o=r||[],i=o.length;for(var s in t)oE(t,s)&&!(n&&(s=="length"||uE(s,i)))&&!(e&&s=="constructor")&&o.push(s);return o}var lB=K8(zh);function fB(t){return t}function pB(t){return Ic(t)?iE(Bc(t)):W8(t)}wi.exports=H8});var vE=C((Eo,Ci)=>{var dB=1/0,hB="[object Function]",mB="[object GeneratorFunction]",gB=/[\\^$.*+?()[\]{}|]/g,DB=/^\[object .+?Constructor\]$/,aa={function:!0,object:!0},yB=aa[typeof Eo]&&Eo&&!Eo.nodeType?Eo:void 0,bB=aa[typeof Ci]&&Ci&&!Ci.nodeType?Ci:void 0,wB=jc(yB&&bB&&typeof global=="object"&&global),vB=jc(aa[typeof self]&&self),DE=jc(aa[typeof window]&&window),Xh=jc(aa[typeof Eo]&&Eo),EB=wB||DE!==(Xh&&Xh.window)&&DE||vB||Xh||Function("return this")();function jc(t){return t&&t.Object===Object?t:null}function CB(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function _B(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var yE=Object.prototype,bE=Function.prototype.toString,xB=yE.hasOwnProperty,SB=yE.toString,AB=RegExp("^"+bE.call(xB).replace(gB,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Yh=OB(EB,"Set"),FB=Yh&&1/_B(new Yh([,-0]))[1]==dB?function(t){return new Yh(t)}:TB;function OB(t,e){var r=t[e];return PB(r)?r:void 0}function kB(t){if(t!=null){try{return bE.call(t)}catch{}try{return t+""}catch{}}return""}function $B(t){var e=wE(t)?SB.call(t):"";return e==hB||e==mB}function wE(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function PB(t){if(!wE(t))return!1;var e=$B(t)||CB(t)?AB:DB;return e.test(kB(t))}function TB(){}Ci.exports=FB});var CE=C((Co,_i)=>{var ua={function:!0,object:!0},RB=ua[typeof Co]&&Co&&!Co.nodeType?Co:void 0,IB=ua[typeof _i]&&_i&&!_i.nodeType?_i:void 0,BB=Uc(RB&&IB&&typeof global=="object"&&global),NB=Uc(ua[typeof self]&&self),EE=Uc(ua[typeof window]&&window),Jh=Uc(ua[typeof Co]&&Co),LB=BB||EE!==(Jh&&Jh.window)&&EE||NB||Jh||Function("return this")();function Uc(t){return t&&t.Object===Object?t:null}_i.exports=LB});var OE=C((uY,FE)=>{var jB=vE(),UB=CE(),MB=200,Zh="__lodash_hash_undefined__",qB="[object Function]",HB="[object GeneratorFunction]",VB=/[\\^$.*+?()[\]{}|]/g,zB=/^\[object .+?Constructor\]$/;function GB(t,e){return!!t.length&&KB(t,e,0)>-1}function WB(t,e,r){for(var n=-1,o=t.length;++n<o;)if(r(e,t[n]))return!0;return!1}function KB(t,e,r){if(e!==e)return YB(t,r);for(var n=r-1,o=t.length;++n<o;)if(t[n]===e)return n;return-1}function XB(t,e){return t.has(e)}function YB(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 JB(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function ZB(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var QB=Array.prototype,_E=Object.prototype,xE=Function.prototype.toString,Qh=_E.hasOwnProperty,eN=_E.toString,tN=RegExp("^"+xE.call(Qh).replace(VB,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),rN=QB.splice,nN=SE(UB,"Map"),ca=SE(Object,"create");function _o(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 oN(){this.__data__=ca?ca(null):{}}function iN(t){return this.has(t)&&delete this.__data__[t]}function sN(t){var e=this.__data__;if(ca){var r=e[t];return r===Zh?void 0:r}return Qh.call(e,t)?e[t]:void 0}function aN(t){var e=this.__data__;return ca?e[t]!==void 0:Qh.call(e,t)}function uN(t,e){var r=this.__data__;return r[t]=ca&&e===void 0?Zh:e,this}_o.prototype.clear=oN;_o.prototype.delete=iN;_o.prototype.get=sN;_o.prototype.has=aN;_o.prototype.set=uN;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 cN(){this.__data__=[]}function lN(t){var e=this.__data__,r=qc(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():rN.call(e,r,1),!0}function fN(t){var e=this.__data__,r=qc(e,t);return r<0?void 0:e[r][1]}function pN(t){return qc(this.__data__,t)>-1}function dN(t,e){var r=this.__data__,n=qc(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}xi.prototype.clear=cN;xi.prototype.delete=lN;xi.prototype.get=fN;xi.prototype.has=pN;xi.prototype.set=dN;function Si(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 hN(){this.__data__={hash:new _o,map:new(nN||xi),string:new _o}}function mN(t){return Hc(this,t).delete(t)}function gN(t){return Hc(this,t).get(t)}function DN(t){return Hc(this,t).has(t)}function yN(t,e){return Hc(this,t).set(t,e),this}Si.prototype.clear=hN;Si.prototype.delete=mN;Si.prototype.get=gN;Si.prototype.has=DN;Si.prototype.set=yN;function Mc(t){var e=-1,r=t?t.length:0;for(this.__data__=new Si;++e<r;)this.add(t[e])}function bN(t){return this.__data__.set(t,Zh),this}function wN(t){return this.__data__.has(t)}Mc.prototype.add=Mc.prototype.push=bN;Mc.prototype.has=wN;function qc(t,e){for(var r=t.length;r--;)if(_N(t[r][0],e))return r;return-1}function vN(t,e,r){var n=-1,o=GB,i=t.length,s=!0,a=[],u=a;if(r)s=!1,o=WB;else if(i>=MB){var c=e?null:jB(t);if(c)return ZB(c);s=!1,o=XB,u=new Mc}else u=e?[]:a;e:for(;++n<i;){var l=t[n],f=e?e(l):l;if(l=r||l!==0?l:0,s&&f===f){for(var h=u.length;h--;)if(u[h]===f)continue e;e&&u.push(f),a.push(l)}else o(u,f,r)||(u!==a&&u.push(f),a.push(l))}return a}function Hc(t,e){var r=t.__data__;return EN(e)?r[typeof e=="string"?"string":"hash"]:r.map}function SE(t,e){var r=t[e];return SN(r)?r:void 0}function EN(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function CN(t){if(t!=null){try{return xE.call(t)}catch{}try{return t+""}catch{}}return""}function _N(t,e){return t===e||t!==t&&e!==e}function xN(t){var e=AE(t)?eN.call(t):"";return e==qB||e==HB}function AE(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function SN(t){if(!AE(t))return!1;var e=xN(t)||JB(t)?tN:zB;return e.test(CN(t))}FE.exports=vN});var $E=C((cY,kE)=>{var AN=gE(),FN=OE();function ON(t,e){return t&&t.length?FN(t,AN(e)):[]}kE.exports=ON});var TE=C((lY,PE)=>{"use strict";var kN=Fv(),$N=$E(),PN=kN("MultiError");PE.exports=em;function em(t){if(!(this instanceof em))return new em(t);if(t=Array.isArray(t)?t:[t],t=$N(t,function(r){return r.stack}),t.length===1)return t[0];var e=new PN({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(`
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 ye.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()}`,ye.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new gA(this.options),r=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&r(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(o=>!r(o)).forEach(o=>{this.setOptionValueWithSource(o,n.implied[o],"implied")})})}missingArgument(e){let r=`error: missing required argument '${e}'`;this.error(r,{code:"commander.missingArgument"})}optionMissingArgument(e){let r=`error: option '${e.flags}' argument missing`;this.error(r,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let r=`error: required option '${e.flags}' not specified`;this.error(r,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,r){let n=a=>{let s=a.attributeName(),u=this.getOptionValue(s),c=this.options.find(f=>f.negate&&s===f.attributeName()),l=this.options.find(f=>!f.negate&&s===f.attributeName());return c&&(c.presetArg===void 0&&u===!1||c.presetArg!==void 0&&u===c.presetArg)?c:l||a},o=a=>{let s=n(a),u=s.attributeName();return this.getOptionValueSource(u)==="env"?`environment variable '${s.envVar}'`:`option '${s.flags}'`},i=`error: ${o(e)} cannot be used with ${o(r)}`;this.error(i,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let r="";if(e.startsWith("--")&&this._showSuggestionAfterError){let o=[],i=this;do{let a=i.createHelp().visibleOptions(i).filter(s=>s.long).map(s=>s.long);o=o.concat(a),i=i.parent}while(i&&!i._enablePositionalOptions);r=aD(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=aD(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=>dA(n));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?r:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=Hr.basename(e,Hr.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let r=this.createHelp(),n=this._getOutputContext(e);r.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let o=r.formatHelp(this,r);return n.hasColors?o:this._outputConfiguration.stripColor(o)}_getOutputContext(e){e=e||{};let r=!!e.error,n,o,i;return r?(n=s=>this._outputConfiguration.writeErr(s),o=this._outputConfiguration.getErrHasColors(),i=this._outputConfiguration.getErrHelpWidth()):(n=s=>this._outputConfiguration.writeOut(s),o=this._outputConfiguration.getOutHasColors(),i=this._outputConfiguration.getOutHelpWidth()),{error:r,write:s=>(o||(s=this._outputConfiguration.stripColor(s)),n(s)),hasColors:o,helpWidth:i}}outputHelp(e){let r;typeof e=="function"&&(r=e,e=void 0);let n=this._getOutputContext(e),o={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(a=>a.emit("beforeAllHelp",o)),this.emit("beforeHelp",o);let i=this.helpInformation({error:n.error});if(r&&(i=r(i),typeof i!="string"&&!Buffer.isBuffer(i)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(i),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",o),this._getCommandAndAncestors().forEach(a=>a.emit("afterAllHelp",o))}helpOption(e,r){return typeof e=="boolean"?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??"-h, --help",r??"display help for command"),(e||r)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let r=Number(ye.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
+ 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 sD(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 Df(){if(ye.env.NO_COLOR||ye.env.FORCE_COLOR==="0"||ye.env.FORCE_COLOR==="false")return!1;if(ye.env.FORCE_COLOR||ye.env.CLICOLOR_FORCE!==void 0)return!0}yf.Command=gf;yf.useColor=Df});var pD=x(Xt=>{var{Argument:cD}=Ns(),{Command:bf}=uD(),{CommanderError:DA,InvalidArgumentError:lD}=ca(),{Help:yA}=cf(),{Option:fD}=df();Xt.program=new bf;Xt.createCommand=t=>new bf(t);Xt.createOption=(t,e)=>new fD(t,e);Xt.createArgument=(t,e)=>new cD(t,e);Xt.Command=bf;Xt.Option=fD;Xt.Argument=cD;Xt.Help=yA;Xt.CommanderError=DA;Xt.InvalidArgumentError=lD;Xt.InvalidOptionArgumentError=lD});var wf=x((i7,hD)=>{"use strict";var vf={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"},vA={up:(t=1)=>"\x1B[S".repeat(t),down:(t=1)=>"\x1B[T".repeat(t)},wA={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?vf.up():"");return t&&(e+=vf.left),e}};hD.exports={cursor:vf,scroll:vA,erase:wA,beep:"\x07"}});var Ef=x((a7,Cf)=>{var Ms=process||{},mD=Ms.argv||[],Us=Ms.env||{},CA=!(Us.NO_COLOR||mD.includes("--no-color"))&&(!!Us.FORCE_COLOR||mD.includes("--color")||Ms.platform==="win32"||(Ms.stdout||{}).isTTY&&Us.TERM!=="dumb"||!!Us.CI),EA=(t,e,r=t)=>n=>{let o=""+n,i=o.indexOf(e,t.length);return~i?t+_A(o,e,r,i)+e:t+o+e},_A=(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)},gD=(t=CA)=>{let e=t?EA:()=>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")}};Cf.exports=gD();Cf.exports.createColors=gD});var Js=x(Rt=>{"use strict";Object.defineProperty(Rt,"__esModule",{value:!0});Rt.isNXMonorepo=Rt.isMonorepo=Rt.findPackageRelativePathInMonorepo=Rt.findPackagePath=Rt.findNXMonorepoRoot=Rt.findMonorepoRoot=void 0;var pa=require("node:fs"),fn=require("node:path");function Ys(t){let e=(0,fn.join)(t,"package.json"),r=(0,fn.join)(t,"pnpm-workspace.yaml");if((0,pa.existsSync)(r)||(0,pa.existsSync)(e)&&JSON.parse((0,pa.readFileSync)(e,"utf-8")).workspaces)return t;let n=(0,fn.dirname)(t);if(n===t)throw new Error("Monorepo root not found");return Ys(n)}Rt.findMonorepoRoot=Ys;function Bf(t){let e=(0,fn.join)(t,"nx.json");if((0,pa.existsSync)(e))return t;let r=(0,fn.dirname)(t);if(r===t)throw new Error("Monorepo root not found");return Bf(r)}Rt.findNXMonorepoRoot=Bf;function jf(t,e,r){let n=(0,fn.join)(e,"node_modules",t);if((0,pa.existsSync)(n))return n;if(e===r)return null;let o=(0,fn.dirname)(e);return jf(t,o,r)}Rt.findPackagePath=jf;function rO(t,e){let r=Ys(e),n=jf(t,e,r);return n?(0,fn.relative)(e,n):null}Rt.findPackageRelativePathInMonorepo=rO;function nO(t){try{return Ys(t),!0}catch{return!1}}Rt.isMonorepo=nO;function oO(t){try{return Bf(t),!0}catch{return!1}}Rt.isNXMonorepo=oO});var le={};qr(le,{__addDisposableResource:()=>yy,__assign:()=>nu,__asyncDelegator:()=>ly,__asyncGenerator:()=>cy,__asyncValues:()=>fy,__await:()=>Lo,__awaiter:()=>ny,__classPrivateFieldGet:()=>my,__classPrivateFieldIn:()=>Dy,__classPrivateFieldSet:()=>gy,__createBinding:()=>iu,__decorate:()=>JD,__disposeResources:()=>by,__esDecorate:()=>ZD,__exportStar:()=>iy,__extends:()=>KD,__generator:()=>oy,__importDefault:()=>hy,__importStar:()=>dy,__makeTemplateObject:()=>py,__metadata:()=>ry,__param:()=>XD,__propKey:()=>ey,__read:()=>Gf,__rest:()=>YD,__rewriteRelativeImportExtension:()=>vy,__runInitializers:()=>QD,__setFunctionName:()=>ty,__spread:()=>ay,__spreadArray:()=>uy,__spreadArrays:()=>sy,__values:()=>ou,default:()=>AO});function KD(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Vf(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function YD(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 JD(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 XD(t,e){return function(r,n){e(r,n,t)}}function ZD(t,e,r,n,o,i){function a(C){if(C!==void 0&&typeof C!="function")throw new TypeError("Function expected");return C}for(var s=n.kind,u=s==="getter"?"get":s==="setter"?"set":"value",c=!e&&t?n.static?t:t.prototype:null,l=e||(c?Object.getOwnPropertyDescriptor(c,n.name):{}),f,d=!1,h=r.length-1;h>=0;h--){var m={};for(var b in n)m[b]=b==="access"?{}:n[b];for(var b in n.access)m.access[b]=n.access[b];m.addInitializer=function(C){if(d)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(C||null))};var D=(0,r[h])(s==="accessor"?{get:l.get,set:l.set}:l[u],m);if(s==="accessor"){if(D===void 0)continue;if(D===null||typeof D!="object")throw new TypeError("Object expected");(f=a(D.get))&&(l.get=f),(f=a(D.set))&&(l.set=f),(f=a(D.init))&&o.unshift(f)}else(f=a(D))&&(s==="field"?o.unshift(f):l[u]=f)}c&&Object.defineProperty(c,n.name,l),d=!0}function QD(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 ey(t){return typeof t=="symbol"?t:"".concat(t)}function ty(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 ry(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function ny(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(l){try{c(n.next(l))}catch(f){a(f)}}function u(l){try{c(n.throw(l))}catch(f){a(f)}}function c(l){l.done?i(l.value):o(l.value).then(s,u)}c((n=n.apply(t,e||[])).next())})}function oy(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(c){return function(l){return u([c,l])}}function u(c){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(r=0)),r;)try{if(n=1,o&&(i=c[0]&2?o.return:c[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,c[1])).done)return i;switch(o=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,o=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=e.call(t,r)}catch(l){c=[6,l],o=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function iy(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&iu(e,t,r)}function ou(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Gf(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 ay(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Gf(arguments[e]));return t}function sy(){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 uy(t,e,r){if(r||arguments.length===2)for(var n=0,o=e.length,i;n<o;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}function Lo(t){return this instanceof Lo?(this.v=t,this):new Lo(t)}function cy(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(h){return function(m){return Promise.resolve(m).then(h,f)}}function s(h,m){n[h]&&(o[h]=function(b){return new Promise(function(D,C){i.push([h,b,D,C])>1||u(h,b)})},m&&(o[h]=m(o[h])))}function u(h,m){try{c(n[h](m))}catch(b){d(i[0][3],b)}}function c(h){h.value instanceof Lo?Promise.resolve(h.value.v).then(l,f):d(i[0][2],h)}function l(h){u("next",h)}function f(h){u("throw",h)}function d(h,m){h(m),i.shift(),i.length&&u(i[0][0],i[0][1])}}function ly(t){var e,r;return e={},n("next"),n("throw",function(o){throw o}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(o,i){e[o]=t[o]?function(a){return(r=!r)?{value:Lo(t[o](a)),done:!1}:i?i(a):a}:i}}function fy(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof ou=="function"?ou(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(a){return new Promise(function(s,u){a=t[i](a),o(s,u,a.done,a.value)})}}function o(i,a,s,u){Promise.resolve(u).then(function(c){i({value:c,done:s})},a)}}function py(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function dy(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=zf(t),n=0;n<r.length;n++)r[n]!=="default"&&iu(e,t,r[n]);return SO(e,t),e}function hy(t){return t&&t.__esModule?t:{default:t}}function my(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 gy(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 Dy(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 yy(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 by(t){function e(i){t.error=t.hasError?new FO(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 vy(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 Vf,nu,iu,SO,zf,FO,AO,fe=et(()=>{Vf=function(t,e){return Vf=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])},Vf(t,e)};nu=function(){return nu=Object.assign||function(e){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},nu.apply(this,arguments)};iu=Object.create?(function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]});SO=Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e},zf=function(t){return zf=Object.getOwnPropertyNames||function(e){var r=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[r.length]=n);return r},zf(t)};FO=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};AO={__extends:KD,__assign:nu,__rest:YD,__decorate:JD,__param:XD,__esDecorate:ZD,__runInitializers:QD,__propKey:ey,__setFunctionName:ty,__metadata:ry,__awaiter:ny,__generator:oy,__createBinding:iu,__exportStar:iy,__values:ou,__read:Gf,__spread:ay,__spreadArrays:sy,__spreadArray:uy,__await:Lo,__asyncGenerator:cy,__asyncDelegator:ly,__asyncValues:fy,__makeTemplateObject:py,__importStar:dy,__importDefault:hy,__classPrivateFieldGet:my,__classPrivateFieldSet:gy,__classPrivateFieldIn:Dy,__addDisposableResource:yy,__disposeResources:by,__rewriteRelativeImportExtension:vy}});var wy=x(au=>{"use strict";Object.defineProperty(au,"__esModule",{value:!0});au.resolveFetch=void 0;var OO=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);au.resolveFetch=OO});var Jf=x(Qt=>{"use strict";Object.defineProperty(Qt,"__esModule",{value:!0});Qt.FunctionRegion=Qt.FunctionsHttpError=Qt.FunctionsRelayError=Qt.FunctionsFetchError=Qt.FunctionsError=void 0;var Uo=class extends Error{constructor(e,r="FunctionsError",n){super(e),this.name=r,this.context=n}};Qt.FunctionsError=Uo;var Wf=class extends Uo{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}};Qt.FunctionsFetchError=Wf;var Kf=class extends Uo{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}};Qt.FunctionsRelayError=Kf;var Yf=class extends Uo{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}};Qt.FunctionsHttpError=Yf;var Cy;(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"})(Cy||(Qt.FunctionRegion=Cy={}))});var Ey=x(su=>{"use strict";Object.defineProperty(su,"__esModule",{value:!0});su.FunctionsClient=void 0;var kO=(fe(),re(le)),$O=wy(),Hn=Jf(),Xf=class{constructor(e,{headers:r={},customFetch:n,region:o=Hn.FunctionRegion.Any}={}){this.url=e,this.headers=r,this.region=o,this.fetch=(0,$O.resolveFetch)(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return kO.__awaiter(this,arguments,void 0,function*(r,n={}){var o;try{let{headers:i,method:a,body:s,signal:u}=n,c={},{region:l}=n;l||(l=this.region);let f=new URL(`${this.url}/${r}`);l&&l!=="any"&&(c["x-region"]=l,f.searchParams.set("forceFunctionRegion",l));let d;s&&(i&&!Object.prototype.hasOwnProperty.call(i,"Content-Type")||!i)?typeof Blob<"u"&&s instanceof Blob||s instanceof ArrayBuffer?(c["Content-Type"]="application/octet-stream",d=s):typeof s=="string"?(c["Content-Type"]="text/plain",d=s):typeof FormData<"u"&&s instanceof FormData?d=s:(c["Content-Type"]="application/json",d=JSON.stringify(s)):d=s;let h=yield this.fetch(f.toString(),{method:a||"POST",headers:Object.assign(Object.assign(Object.assign({},c),this.headers),i),body:d,signal:u}).catch(C=>{throw C.name==="AbortError"?C:new Hn.FunctionsFetchError(C)}),m=h.headers.get("x-relay-error");if(m&&m==="true")throw new Hn.FunctionsRelayError(h);if(!h.ok)throw new Hn.FunctionsHttpError(h);let b=((o=h.headers.get("Content-Type"))!==null&&o!==void 0?o:"text/plain").split(";")[0].trim(),D;return b==="application/json"?D=yield h.json():b==="application/octet-stream"||b==="application/pdf"?D=yield h.blob():b==="text/event-stream"?D=h:b==="multipart/form-data"?D=yield h.formData():D=yield h.text(),{data:D,error:null,response:h}}catch(i){return i instanceof Error&&i.name==="AbortError"?{data:null,error:new Hn.FunctionsFetchError(i)}:{data:null,error:i,response:i instanceof Hn.FunctionsHttpError||i instanceof Hn.FunctionsRelayError?i.context:void 0}}})}};su.FunctionsClient=Xf});var Zf=x(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.FunctionRegion=Bt.FunctionsRelayError=Bt.FunctionsHttpError=Bt.FunctionsFetchError=Bt.FunctionsError=Bt.FunctionsClient=void 0;var PO=Ey();Object.defineProperty(Bt,"FunctionsClient",{enumerable:!0,get:function(){return PO.FunctionsClient}});var Da=Jf();Object.defineProperty(Bt,"FunctionsError",{enumerable:!0,get:function(){return Da.FunctionsError}});Object.defineProperty(Bt,"FunctionsFetchError",{enumerable:!0,get:function(){return Da.FunctionsFetchError}});Object.defineProperty(Bt,"FunctionsHttpError",{enumerable:!0,get:function(){return Da.FunctionsHttpError}});Object.defineProperty(Bt,"FunctionsRelayError",{enumerable:!0,get:function(){return Da.FunctionsRelayError}});Object.defineProperty(Bt,"FunctionRegion",{enumerable:!0,get:function(){return Da.FunctionRegion}})});var tp=x(ep=>{"use strict";Object.defineProperty(ep,"__esModule",{value:!0});var Qf=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}};ep.default=Qf});var op=x(np=>{"use strict";Object.defineProperty(np,"__esModule",{value:!0});var TO=(fe(),re(le)),IO=TO.__importDefault(tp()),rp=class{constructor(e){var r,n;this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=(r=e.shouldThrowOnError)!==null&&r!==void 0?r:!1,this.signal=e.signal,this.isMaybeSingle=(n=e.isMaybeSingle)!==null&&n!==void 0?n:!1,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,r){return this.headers=new Headers(this.headers),this.headers.set(e,r),this}then(e,r){this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");let n=this.fetch,o=n(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async i=>{var a,s,u,c;let l=null,f=null,d=null,h=i.status,m=i.statusText;if(i.ok){if(this.method!=="HEAD"){let E=await i.text();E===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&(!((a=this.headers.get("Accept"))===null||a===void 0)&&a.includes("application/vnd.pgrst.plan+text"))?f=E:f=JSON.parse(E))}let D=(s=this.headers.get("Prefer"))===null||s===void 0?void 0:s.match(/count=(exact|planned|estimated)/),C=(u=i.headers.get("content-range"))===null||u===void 0?void 0:u.split("/");D&&C&&C.length>1&&(d=parseInt(C[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(f)&&(f.length>1?(l={code:"PGRST116",details:`Results contain ${f.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},f=null,d=null,h=406,m="Not Acceptable"):f.length===1?f=f[0]:f=null)}else{let D=await i.text();try{l=JSON.parse(D),Array.isArray(l)&&i.status===404&&(f=[],l=null,h=200,m="OK")}catch{i.status===404&&D===""?(h=204,m="No Content"):l={message:D}}if(l&&this.isMaybeSingle&&(!((c=l?.details)===null||c===void 0)&&c.includes("0 rows"))&&(l=null,h=200,m="OK"),l&&this.shouldThrowOnError)throw new IO.default(l)}return{error:l,data:f,count:d,status:h,statusText:m}});return this.shouldThrowOnError||(o=o.catch(i=>{var a,s,u;return{error:{message:`${(a=i?.name)!==null&&a!==void 0?a:"FetchError"}: ${i?.message}`,details:`${(s=i?.stack)!==null&&s!==void 0?s:""}`,hint:"",code:`${(u=i?.code)!==null&&u!==void 0?u:""}`},data:null,count:null,status:0,statusText:""}})),o.then(e,r)}returns(){return this}overrideTypes(){return this}};np.default=rp});var sp=x(ap=>{"use strict";Object.defineProperty(ap,"__esModule",{value:!0});var RO=(fe(),re(le)),BO=RO.__importDefault(op()),ip=class extends BO.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}};ap.default=ip});var uu=x(cp=>{"use strict";Object.defineProperty(cp,"__esModule",{value:!0});var jO=(fe(),re(le)),NO=jO.__importDefault(sp()),LO=new RegExp("[,()]"),up=class extends NO.default{eq(e,r){return this.url.searchParams.append(e,`eq.${r}`),this}neq(e,r){return this.url.searchParams.append(e,`neq.${r}`),this}gt(e,r){return this.url.searchParams.append(e,`gt.${r}`),this}gte(e,r){return this.url.searchParams.append(e,`gte.${r}`),this}lt(e,r){return this.url.searchParams.append(e,`lt.${r}`),this}lte(e,r){return this.url.searchParams.append(e,`lte.${r}`),this}like(e,r){return this.url.searchParams.append(e,`like.${r}`),this}likeAllOf(e,r){return this.url.searchParams.append(e,`like(all).{${r.join(",")}}`),this}likeAnyOf(e,r){return this.url.searchParams.append(e,`like(any).{${r.join(",")}}`),this}ilike(e,r){return this.url.searchParams.append(e,`ilike.${r}`),this}ilikeAllOf(e,r){return this.url.searchParams.append(e,`ilike(all).{${r.join(",")}}`),this}ilikeAnyOf(e,r){return this.url.searchParams.append(e,`ilike(any).{${r.join(",")}}`),this}is(e,r){return this.url.searchParams.append(e,`is.${r}`),this}in(e,r){let n=Array.from(new Set(r)).map(o=>typeof o=="string"&&LO.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}};cp.default=up});var pp=x(fp=>{"use strict";Object.defineProperty(fp,"__esModule",{value:!0});var UO=(fe(),re(le)),ya=UO.__importDefault(uu()),lp=class{constructor(e,{headers:r={},schema:n,fetch:o}){this.url=e,this.headers=new Headers(r),this.schema=n,this.fetch=o}select(e,r){let{head:n=!1,count:o}=r??{},i=n?"HEAD":"GET",a=!1,s=(e??"*").split("").map(u=>/\s/.test(u)&&!a?"":(u==='"'&&(a=!a),u)).join("");return this.url.searchParams.set("select",s),o&&this.headers.append("Prefer",`count=${o}`),new ya.default({method:i,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(e,{count:r,defaultToNull:n=!0}={}){var o;let i="POST";if(r&&this.headers.append("Prefer",`count=${r}`),n||this.headers.append("Prefer","missing=default"),Array.isArray(e)){let a=e.reduce((s,u)=>s.concat(Object.keys(u)),[]);if(a.length>0){let s=[...new Set(a)].map(u=>`"${u}"`);this.url.searchParams.set("columns",s.join(","))}}return new ya.default({method:i,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}upsert(e,{onConflict:r,ignoreDuplicates:n=!1,count:o,defaultToNull:i=!0}={}){var a;let s="POST";if(this.headers.append("Prefer",`resolution=${n?"ignore":"merge"}-duplicates`),r!==void 0&&this.url.searchParams.set("on_conflict",r),o&&this.headers.append("Prefer",`count=${o}`),i||this.headers.append("Prefer","missing=default"),Array.isArray(e)){let u=e.reduce((c,l)=>c.concat(Object.keys(l)),[]);if(u.length>0){let c=[...new Set(u)].map(l=>`"${l}"`);this.url.searchParams.set("columns",c.join(","))}}return new ya.default({method:s,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}update(e,{count:r}={}){var n;let o="PATCH";return r&&this.headers.append("Prefer",`count=${r}`),new ya.default({method:o,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch})}delete({count:e}={}){var r;let n="DELETE";return e&&this.headers.append("Prefer",`count=${e}`),new ya.default({method:n,url:this.url,headers:this.headers,schema:this.schema,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}};fp.default=lp});var xy=x(hp=>{"use strict";Object.defineProperty(hp,"__esModule",{value:!0});var _y=(fe(),re(le)),MO=_y.__importDefault(pp()),qO=_y.__importDefault(uu()),dp=class t{constructor(e,{headers:r={},schema:n,fetch:o}={}){this.url=e,this.headers=new Headers(r),this.schemaName=n,this.fetch=o}from(e){let r=new URL(`${this.url}/${e}`);return new MO.default(r,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new t(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,r={},{head:n=!1,get:o=!1,count:i}={}){var a;let s,u=new URL(`${this.url}/rpc/${e}`),c;n||o?(s=n?"HEAD":"GET",Object.entries(r).filter(([f,d])=>d!==void 0).map(([f,d])=>[f,Array.isArray(d)?`{${d.join(",")}}`:`${d}`]).forEach(([f,d])=>{u.searchParams.append(f,d)})):(s="POST",c=r);let l=new Headers(this.headers);return i&&l.set("Prefer",`count=${i}`),new qO.default({method:s,url:u,headers:l,schema:this.schemaName,body:c,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}};hp.default=dp});var mp=x(Ft=>{"use strict";Object.defineProperty(Ft,"__esModule",{value:!0});Ft.PostgrestError=Ft.PostgrestBuilder=Ft.PostgrestTransformBuilder=Ft.PostgrestFilterBuilder=Ft.PostgrestQueryBuilder=Ft.PostgrestClient=void 0;var Mo=(fe(),re(le)),Sy=Mo.__importDefault(xy());Ft.PostgrestClient=Sy.default;var Fy=Mo.__importDefault(pp());Ft.PostgrestQueryBuilder=Fy.default;var Ay=Mo.__importDefault(uu());Ft.PostgrestFilterBuilder=Ay.default;var Oy=Mo.__importDefault(sp());Ft.PostgrestTransformBuilder=Oy.default;var ky=Mo.__importDefault(op());Ft.PostgrestBuilder=ky.default;var $y=Mo.__importDefault(tp());Ft.PostgrestError=$y.default;Ft.default={PostgrestClient:Sy.default,PostgrestQueryBuilder:Fy.default,PostgrestFilterBuilder:Ay.default,PostgrestTransformBuilder:Oy.default,PostgrestBuilder:ky.default,PostgrestError:$y.default}});var Dp={};qr(Dp,{RealtimeClient:()=>gp});var gp,yp=et(()=>{gp=class{constructor(){}connect(){}disconnect(){}}});var hn=x(zr=>{"use strict";Object.defineProperty(zr,"__esModule",{value:!0});zr.StorageUnknownError=zr.StorageApiError=zr.StorageError=void 0;zr.isStorageError=HO;var ba=class extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}};zr.StorageError=ba;function HO(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var bp=class extends ba{constructor(e,r,n){super(e),this.name="StorageApiError",this.status=r,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};zr.StorageApiError=bp;var vp=class extends ba{constructor(e,r){super(e),this.name="StorageUnknownError",this.originalError=r}};zr.StorageUnknownError=vp});var va=x(er=>{"use strict";Object.defineProperty(er,"__esModule",{value:!0});er.isPlainObject=er.recursiveToCamel=er.resolveResponse=er.resolveFetch=void 0;var VO=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);er.resolveFetch=VO;var zO=()=>Response;er.resolveResponse=zO;var GO=t=>{if(Array.isArray(t))return t.map(r=>(0,er.recursiveToCamel)(r));if(typeof t=="function"||t!==Object(t))return t;let e={};return Object.entries(t).forEach(([r,n])=>{let o=r.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));e[o]=(0,er.recursiveToCamel)(n)}),e};er.recursiveToCamel=GO;var WO=t=>{if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)};er.isPlainObject=WO});var cu=x(zn=>{"use strict";Object.defineProperty(zn,"__esModule",{value:!0});zn.get=JO;zn.post=XO;zn.put=ZO;zn.head=QO;zn.remove=ek;var Vn=(fe(),re(le)),wp=hn(),Py=va(),Cp=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)},KO=(t,e,r)=>Vn.__awaiter(void 0,void 0,void 0,function*(){let n=yield(0,Py.resolveResponse)();t instanceof n&&!r?.noResolveJson?t.json().then(o=>{let i=t.status||500,a=o?.statusCode||i+"";e(new wp.StorageApiError(Cp(o),i,a))}).catch(o=>{e(new wp.StorageUnknownError(Cp(o),o))}):e(new wp.StorageUnknownError(Cp(t),t))}),YO=(t,e,r,n)=>{let o={method:t,headers:e?.headers||{}};return t==="GET"||!n?o:((0,Py.isPlainObject)(n)?(o.headers=Object.assign({"Content-Type":"application/json"},e?.headers),o.body=JSON.stringify(n)):o.body=n,e?.duplex&&(o.duplex=e.duplex),Object.assign(Object.assign({},o),r))};function wa(t,e,r,n,o,i){return Vn.__awaiter(this,void 0,void 0,function*(){return new Promise((a,s)=>{t(r,YO(e,n,o,i)).then(u=>{if(!u.ok)throw u;return n?.noResolveJson?u:u.json()}).then(u=>a(u)).catch(u=>KO(u,s,n))})})}function JO(t,e,r,n){return Vn.__awaiter(this,void 0,void 0,function*(){return wa(t,"GET",e,r,n)})}function XO(t,e,r,n,o){return Vn.__awaiter(this,void 0,void 0,function*(){return wa(t,"POST",e,n,o,r)})}function ZO(t,e,r,n,o){return Vn.__awaiter(this,void 0,void 0,function*(){return wa(t,"PUT",e,n,o,r)})}function QO(t,e,r,n){return Vn.__awaiter(this,void 0,void 0,function*(){return wa(t,"HEAD",e,Object.assign(Object.assign({},r),{noResolveJson:!0}),n)})}function ek(t,e,r,n,o){return Vn.__awaiter(this,void 0,void 0,function*(){return wa(t,"DELETE",e,n,o,r)})}});var Ty=x(_p=>{"use strict";Object.defineProperty(_p,"__esModule",{value:!0});var tk=(fe(),re(le)),rk=hn(),Ep=class{constructor(e,r){this.downloadFn=e,this.shouldThrowOnError=r}then(e,r){return this.execute().then(e,r)}execute(){return tk.__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,rk.isStorageError)(e))return{data:null,error:e};throw e}})}};_p.default=Ep});var By=x(Sp=>{"use strict";var Iy;Object.defineProperty(Sp,"__esModule",{value:!0});var Ry=(fe(),re(le)),nk=hn(),ok=Ry.__importDefault(Ty()),xp=class{constructor(e,r){this.downloadFn=e,this.shouldThrowOnError=r,this[Iy]="BlobDownloadBuilder",this.promise=null}asStream(){return new ok.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 Ry.__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,nk.isStorageError)(e))return{data:null,error:e};throw e}})}};Iy=Symbol.toStringTag;Sp.default=xp});var Ly=x(Ap=>{"use strict";Object.defineProperty(Ap,"__esModule",{value:!0});var At=(fe(),re(le)),jt=hn(),Nt=cu(),jy=va(),ik=At.__importDefault(By()),ak={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Ny={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1},Fp=class{constructor(e,r={},n,o){this.shouldThrowOnError=!1,this.url=e,this.headers=r,this.bucketId=n,this.fetch=(0,jy.resolveFetch)(o)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(e,r,n,o){return At.__awaiter(this,void 0,void 0,function*(){try{let i,a=Object.assign(Object.assign({},Ny),o),s=Object.assign(Object.assign({},this.headers),e==="POST"&&{"x-upsert":String(a.upsert)}),u=a.metadata;typeof Blob<"u"&&n instanceof Blob?(i=new FormData,i.append("cacheControl",a.cacheControl),u&&i.append("metadata",this.encodeMetadata(u)),i.append("",n)):typeof FormData<"u"&&n instanceof FormData?(i=n,i.has("cacheControl")||i.append("cacheControl",a.cacheControl),u&&!i.has("metadata")&&i.append("metadata",this.encodeMetadata(u))):(i=n,s["cache-control"]=`max-age=${a.cacheControl}`,s["content-type"]=a.contentType,u&&(s["x-metadata"]=this.toBase64(this.encodeMetadata(u))),(typeof ReadableStream<"u"&&i instanceof ReadableStream||i&&typeof i=="object"&&"pipe"in i&&typeof i.pipe=="function")&&!a.duplex&&(a.duplex="half")),o?.headers&&(s=Object.assign(Object.assign({},s),o.headers));let c=this._removeEmptyFolders(r),l=this._getFinalPath(c),f=yield(e=="PUT"?Nt.put:Nt.post)(this.fetch,`${this.url}/object/${l}`,i,Object.assign({headers:s},a?.duplex?{duplex:a.duplex}:{}));return{data:{path:c,id:f.Id,fullPath:f.Key},error:null}}catch(i){if(this.shouldThrowOnError)throw i;if((0,jt.isStorageError)(i))return{data:null,error:i};throw i}})}upload(e,r,n){return At.__awaiter(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,r,n)})}uploadToSignedUrl(e,r,n,o){return At.__awaiter(this,void 0,void 0,function*(){let i=this._removeEmptyFolders(e),a=this._getFinalPath(i),s=new URL(this.url+`/object/upload/sign/${a}`);s.searchParams.set("token",r);try{let u,c=Object.assign({upsert:Ny.upsert},o),l=Object.assign(Object.assign({},this.headers),{"x-upsert":String(c.upsert)});typeof Blob<"u"&&n instanceof Blob?(u=new FormData,u.append("cacheControl",c.cacheControl),u.append("",n)):typeof FormData<"u"&&n instanceof FormData?(u=n,u.append("cacheControl",c.cacheControl)):(u=n,l["cache-control"]=`max-age=${c.cacheControl}`,l["content-type"]=c.contentType);let f=yield(0,Nt.put)(this.fetch,s.toString(),u,{headers:l});return{data:{path:i,fullPath:f.Key},error:null}}catch(u){if(this.shouldThrowOnError)throw u;if((0,jt.isStorageError)(u))return{data:null,error:u};throw u}})}createSignedUploadUrl(e,r){return At.__awaiter(this,void 0,void 0,function*(){try{let n=this._getFinalPath(e),o=Object.assign({},this.headers);r?.upsert&&(o["x-upsert"]="true");let i=yield(0,Nt.post)(this.fetch,`${this.url}/object/upload/sign/${n}`,{},{headers:o}),a=new URL(this.url+i.url),s=a.searchParams.get("token");if(!s)throw new jt.StorageError("No token returned by API");return{data:{signedUrl:a.toString(),path:e,token:s},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,jt.isStorageError)(n))return{data:null,error:n};throw n}})}update(e,r,n){return At.__awaiter(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,r,n)})}move(e,r,n){return At.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Nt.post)(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:r,destinationBucket:n?.destinationBucket},{headers:this.headers}),error:null}}catch(o){if(this.shouldThrowOnError)throw o;if((0,jt.isStorageError)(o))return{data:null,error:o};throw o}})}copy(e,r,n){return At.__awaiter(this,void 0,void 0,function*(){try{return{data:{path:(yield(0,Nt.post)(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:r,destinationBucket:n?.destinationBucket},{headers:this.headers})).Key},error:null}}catch(o){if(this.shouldThrowOnError)throw o;if((0,jt.isStorageError)(o))return{data:null,error:o};throw o}})}createSignedUrl(e,r,n){return At.__awaiter(this,void 0,void 0,function*(){try{let o=this._getFinalPath(e),i=yield(0,Nt.post)(this.fetch,`${this.url}/object/sign/${o}`,Object.assign({expiresIn:r},n?.transform?{transform:n.transform}:{}),{headers:this.headers}),a=n?.download?`&download=${n.download===!0?"":n.download}`:"";return i={signedUrl:encodeURI(`${this.url}${i.signedURL}${a}`)},{data:i,error:null}}catch(o){if(this.shouldThrowOnError)throw o;if((0,jt.isStorageError)(o))return{data:null,error:o};throw o}})}createSignedUrls(e,r,n){return At.__awaiter(this,void 0,void 0,function*(){try{let o=yield(0,Nt.post)(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:r,paths:e},{headers:this.headers}),i=n?.download?`&download=${n.download===!0?"":n.download}`:"";return{data:o.map(a=>Object.assign(Object.assign({},a),{signedUrl:a.signedURL?encodeURI(`${this.url}${a.signedURL}${i}`):null})),error:null}}catch(o){if(this.shouldThrowOnError)throw o;if((0,jt.isStorageError)(o))return{data:null,error:o};throw o}})}download(e,r){let o=typeof r?.transform<"u"?"render/image/authenticated":"object",i=this.transformOptsToQueryString(r?.transform||{}),a=i?`?${i}`:"",s=this._getFinalPath(e),u=()=>(0,Nt.get)(this.fetch,`${this.url}/${o}/${s}${a}`,{headers:this.headers,noResolveJson:!0});return new ik.default(u,this.shouldThrowOnError)}info(e){return At.__awaiter(this,void 0,void 0,function*(){let r=this._getFinalPath(e);try{let n=yield(0,Nt.get)(this.fetch,`${this.url}/object/info/${r}`,{headers:this.headers});return{data:(0,jy.recursiveToCamel)(n),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,jt.isStorageError)(n))return{data:null,error:n};throw n}})}exists(e){return At.__awaiter(this,void 0,void 0,function*(){let r=this._getFinalPath(e);try{return yield(0,Nt.head)(this.fetch,`${this.url}/object/${r}`,{headers:this.headers}),{data:!0,error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,jt.isStorageError)(n)&&n instanceof jt.StorageUnknownError){let o=n.originalError;if([400,404].includes(o?.status))return{data:!1,error:n}}throw n}})}getPublicUrl(e,r){let n=this._getFinalPath(e),o=[],i=r?.download?`download=${r.download===!0?"":r.download}`:"";i!==""&&o.push(i);let s=typeof r?.transform<"u"?"render/image":"object",u=this.transformOptsToQueryString(r?.transform||{});u!==""&&o.push(u);let c=o.join("&");return c!==""&&(c=`?${c}`),{data:{publicUrl:encodeURI(`${this.url}/${s}/public/${n}${c}`)}}}remove(e){return At.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Nt.remove)(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,jt.isStorageError)(r))return{data:null,error:r};throw r}})}list(e,r,n){return At.__awaiter(this,void 0,void 0,function*(){try{let o=Object.assign(Object.assign(Object.assign({},ak),r),{prefix:e||""});return{data:yield(0,Nt.post)(this.fetch,`${this.url}/object/list/${this.bucketId}`,o,{headers:this.headers},n),error:null}}catch(o){if(this.shouldThrowOnError)throw o;if((0,jt.isStorageError)(o))return{data:null,error:o};throw o}})}listV2(e,r){return At.__awaiter(this,void 0,void 0,function*(){try{let n=Object.assign({},e);return{data:yield(0,Nt.post)(this.fetch,`${this.url}/object/list-v2/${this.bucketId}`,n,{headers:this.headers},r),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,jt.isStorageError)(n))return{data:null,error:n};throw n}})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return typeof Buffer<"u"?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){let r=[];return e.width&&r.push(`width=${e.width}`),e.height&&r.push(`height=${e.height}`),e.resize&&r.push(`resize=${e.resize}`),e.format&&r.push(`format=${e.format}`),e.quality&&r.push(`quality=${e.quality}`),r.join("&")}};Ap.default=Fp});var Op=x(lu=>{"use strict";Object.defineProperty(lu,"__esModule",{value:!0});lu.version=void 0;lu.version="2.79.0"});var kp=x(fu=>{"use strict";Object.defineProperty(fu,"__esModule",{value:!0});fu.DEFAULT_HEADERS=void 0;var sk=Op();fu.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${sk.version}`}});var Uy=x(Pp=>{"use strict";Object.defineProperty(Pp,"__esModule",{value:!0});var qo=(fe(),re(le)),uk=kp(),Ho=hn(),Vo=cu(),ck=va(),$p=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({},uk.DEFAULT_HEADERS),r),this.fetch=(0,ck.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(e){return qo.__awaiter(this,void 0,void 0,function*(){try{let r=this.listBucketOptionsToQueryString(e);return{data:yield(0,Vo.get)(this.fetch,`${this.url}/bucket${r}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ho.isStorageError)(r))return{data:null,error:r};throw r}})}getBucket(e){return qo.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Vo.get)(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ho.isStorageError)(r))return{data:null,error:r};throw r}})}createBucket(e){return qo.__awaiter(this,arguments,void 0,function*(r,n={public:!1}){try{return{data:yield(0,Vo.post)(this.fetch,`${this.url}/bucket`,{id:r,name:r,type:n.type,public:n.public,file_size_limit:n.fileSizeLimit,allowed_mime_types:n.allowedMimeTypes},{headers:this.headers}),error:null}}catch(o){if(this.shouldThrowOnError)throw o;if((0,Ho.isStorageError)(o))return{data:null,error:o};throw o}})}updateBucket(e,r){return qo.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Vo.put)(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:r.public,file_size_limit:r.fileSizeLimit,allowed_mime_types:r.allowedMimeTypes},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Ho.isStorageError)(n))return{data:null,error:n};throw n}})}emptyBucket(e){return qo.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Vo.post)(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ho.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return qo.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Vo.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ho.isStorageError)(r))return{data:null,error:r};throw r}})}listBucketOptionsToQueryString(e){let r={};return e&&("limit"in e&&(r.limit=String(e.limit)),"offset"in e&&(r.offset=String(e.offset)),e.search&&(r.search=e.search),e.sortColumn&&(r.sortColumn=e.sortColumn),e.sortOrder&&(r.sortOrder=e.sortOrder)),Object.keys(r).length>0?"?"+new URLSearchParams(r).toString():""}};Pp.default=$p});var Np=x(jp=>{"use strict";Object.defineProperty(jp,"__esModule",{value:!0});var Tp=(fe(),re(le)),lk=kp(),Ip=hn(),Rp=cu(),fk=va(),Bp=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},lk.DEFAULT_HEADERS),r),this.fetch=(0,fk.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return Tp.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Rp.post)(this.fetch,`${this.url}/bucket`,{name:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ip.isStorageError)(r))return{data:null,error:r};throw r}})}listBuckets(e){return Tp.__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,Rp.get)(this.fetch,o,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ip.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return Tp.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Rp.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ip.isStorageError)(r))return{data:null,error:r};throw r}})}};jp.default=Bp});var du=x(pu=>{"use strict";Object.defineProperty(pu,"__esModule",{value:!0});pu.DEFAULT_HEADERS=void 0;var pk=Op();pu.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${pk.version}`,"Content-Type":"application/json"}});var zo=x(br=>{"use strict";Object.defineProperty(br,"__esModule",{value:!0});br.StorageVectorsErrorCode=br.StorageVectorsUnknownError=br.StorageVectorsApiError=br.StorageVectorsError=void 0;br.isStorageVectorsError=dk;var Ca=class extends Error{constructor(e){super(e),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};br.StorageVectorsError=Ca;function dk(t){return typeof t=="object"&&t!==null&&"__isStorageVectorsError"in t}var Lp=class extends Ca{constructor(e,r,n){super(e),this.name="StorageVectorsApiError",this.status=r,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};br.StorageVectorsApiError=Lp;var Up=class extends Ca{constructor(e,r){super(e),this.name="StorageVectorsUnknownError",this.originalError=r}};br.StorageVectorsUnknownError=Up;var My;(function(t){t.InternalError="InternalError",t.S3VectorConflictException="S3VectorConflictException",t.S3VectorNotFoundException="S3VectorNotFoundException",t.S3VectorBucketNotEmpty="S3VectorBucketNotEmpty",t.S3VectorMaxBucketsExceeded="S3VectorMaxBucketsExceeded",t.S3VectorMaxIndexesExceeded="S3VectorMaxIndexesExceeded"})(My||(br.StorageVectorsErrorCode=My={}))});var Go=x(tr=>{"use strict";Object.defineProperty(tr,"__esModule",{value:!0});tr.validateVectorDimension=tr.normalizeToFloat32=tr.isPlainObject=tr.resolveResponse=tr.resolveFetch=void 0;var hk=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);tr.resolveFetch=hk;var mk=()=>Response;tr.resolveResponse=mk;var gk=t=>{if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)};tr.isPlainObject=gk;var Dk=t=>Array.from(new Float32Array(t));tr.normalizeToFloat32=Dk;var yk=(t,e)=>{if(e!==void 0&&t.float32.length!==e)throw new Error(`Vector dimension mismatch: expected ${e}, got ${t.float32.length}`)};tr.validateVectorDimension=yk});var gu=x(Ko=>{"use strict";Object.defineProperty(Ko,"__esModule",{value:!0});Ko.get=Ck;Ko.post=Ek;Ko.put=_k;Ko.remove=xk;var Wo=(fe(),re(le)),hu=zo(),bk=Go(),qy=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),vk=(t,e,r)=>Wo.__awaiter(void 0,void 0,void 0,function*(){if(t&&typeof t=="object"&&"status"in t&&"ok"in t&&typeof t.status=="number"&&!r?.noResolveJson){let o=t.status||500,i=t;if(typeof i.json=="function")i.json().then(a=>{let s=a?.statusCode||a?.code||o+"";e(new hu.StorageVectorsApiError(qy(a),o,s))}).catch(()=>{let a=o+"",s=i.statusText||`HTTP ${o} error`;e(new hu.StorageVectorsApiError(s,o,a))});else{let a=o+"",s=i.statusText||`HTTP ${o} error`;e(new hu.StorageVectorsApiError(s,o,a))}}else e(new hu.StorageVectorsUnknownError(qy(t),t))}),wk=(t,e,r,n)=>{let o={method:t,headers:e?.headers||{}};return t==="GET"||!n?o:((0,bk.isPlainObject)(n)?(o.headers=Object.assign({"Content-Type":"application/json"},e?.headers),o.body=JSON.stringify(n)):o.body=n,Object.assign(Object.assign({},o),r))};function mu(t,e,r,n,o,i){return Wo.__awaiter(this,void 0,void 0,function*(){return new Promise((a,s)=>{t(r,wk(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=>vk(u,s,n))})})}function Ck(t,e,r,n){return Wo.__awaiter(this,void 0,void 0,function*(){return mu(t,"GET",e,r,n)})}function Ek(t,e,r,n,o){return Wo.__awaiter(this,void 0,void 0,function*(){return mu(t,"POST",e,n,o,r)})}function _k(t,e,r,n,o){return Wo.__awaiter(this,void 0,void 0,function*(){return mu(t,"PUT",e,n,o,r)})}function xk(t,e,r,n,o){return Wo.__awaiter(this,void 0,void 0,function*(){return mu(t,"DELETE",e,n,o,r)})}});var Hp=x(qp=>{"use strict";Object.defineProperty(qp,"__esModule",{value:!0});var Du=(fe(),re(le)),Sk=du(),yu=zo(),bu=gu(),Fk=Go(),Mp=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Sk.DEFAULT_HEADERS),r),this.fetch=(0,Fk.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createIndex(e){return Du.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,bu.post)(this.fetch,`${this.url}/CreateIndex`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,yu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getIndex(e,r){return Du.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,bu.post)(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:e,indexName:r},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,yu.isStorageVectorsError)(n))return{data:null,error:n};throw n}})}listIndexes(e){return Du.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,bu.post)(this.fetch,`${this.url}/ListIndexes`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,yu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteIndex(e,r){return Du.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,bu.post)(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:e,indexName:r},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,yu.isStorageVectorsError)(n))return{data:null,error:n};throw n}})}};qp.default=Mp});var Gp=x(zp=>{"use strict";Object.defineProperty(zp,"__esModule",{value:!0});var Ea=(fe(),re(le)),Ak=du(),_a=zo(),xa=gu(),Ok=Go(),Vp=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Ak.DEFAULT_HEADERS),r),this.fetch=(0,Ok.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}putVectors(e){return Ea.__awaiter(this,void 0,void 0,function*(){try{if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return{data:(yield(0,xa.post)(this.fetch,`${this.url}/PutVectors`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,_a.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getVectors(e){return Ea.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,xa.post)(this.fetch,`${this.url}/GetVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,_a.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}listVectors(e){return Ea.__awaiter(this,void 0,void 0,function*(){try{if(e.segmentCount!==void 0){if(e.segmentCount<1||e.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(e.segmentIndex!==void 0&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw new Error(`segmentIndex must be between 0 and ${e.segmentCount-1}`)}return{data:yield(0,xa.post)(this.fetch,`${this.url}/ListVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,_a.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}queryVectors(e){return Ea.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,xa.post)(this.fetch,`${this.url}/QueryVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,_a.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteVectors(e){return Ea.__awaiter(this,void 0,void 0,function*(){try{if(e.keys.length<1||e.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return{data:(yield(0,xa.post)(this.fetch,`${this.url}/DeleteVectors`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,_a.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}};zp.default=Vp});var Yp=x(Kp=>{"use strict";Object.defineProperty(Kp,"__esModule",{value:!0});var vu=(fe(),re(le)),kk=du(),wu=zo(),Cu=gu(),$k=Go(),Wp=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},kk.DEFAULT_HEADERS),r),this.fetch=(0,$k.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return vu.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Cu.post)(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,wu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getBucket(e){return vu.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Cu.post)(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,wu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}listBuckets(){return vu.__awaiter(this,arguments,void 0,function*(e={}){try{return{data:yield(0,Cu.post)(this.fetch,`${this.url}/ListVectorBuckets`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,wu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return vu.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Cu.post)(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,wu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}};Kp.default=Wp});var Hy=x(mn=>{"use strict";Object.defineProperty(mn,"__esModule",{value:!0});mn.VectorIndexScope=mn.VectorBucketScope=mn.StorageVectorsClient=void 0;var rr=(fe(),re(le)),Pk=rr.__importDefault(Hp()),Tk=rr.__importDefault(Gp()),Ik=rr.__importDefault(Yp()),Jp=class extends Ik.default{constructor(e,r={}){super(e,r.headers||{},r.fetch)}from(e){return new Eu(this.url,this.headers,e,this.fetch)}};mn.StorageVectorsClient=Jp;var Eu=class extends Pk.default{constructor(e,r,n,o){super(e,r,o),this.vectorBucketName=n}createIndex(e){let r=Object.create(null,{createIndex:{get:()=>super.createIndex}});return rr.__awaiter(this,void 0,void 0,function*(){return r.createIndex.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName}))})}listIndexes(){let e=Object.create(null,{listIndexes:{get:()=>super.listIndexes}});return rr.__awaiter(this,arguments,void 0,function*(r={}){return e.listIndexes.call(this,Object.assign(Object.assign({},r),{vectorBucketName:this.vectorBucketName}))})}getIndex(e){let r=Object.create(null,{getIndex:{get:()=>super.getIndex}});return rr.__awaiter(this,void 0,void 0,function*(){return r.getIndex.call(this,this.vectorBucketName,e)})}deleteIndex(e){let r=Object.create(null,{deleteIndex:{get:()=>super.deleteIndex}});return rr.__awaiter(this,void 0,void 0,function*(){return r.deleteIndex.call(this,this.vectorBucketName,e)})}index(e){return new _u(this.url,this.headers,this.vectorBucketName,e,this.fetch)}};mn.VectorBucketScope=Eu;var _u=class extends Tk.default{constructor(e,r,n,o,i){super(e,r,i),this.vectorBucketName=n,this.indexName=o}putVectors(e){let r=Object.create(null,{putVectors:{get:()=>super.putVectors}});return rr.__awaiter(this,void 0,void 0,function*(){return r.putVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}getVectors(e){let r=Object.create(null,{getVectors:{get:()=>super.getVectors}});return rr.__awaiter(this,void 0,void 0,function*(){return r.getVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}listVectors(){let e=Object.create(null,{listVectors:{get:()=>super.listVectors}});return rr.__awaiter(this,arguments,void 0,function*(r={}){return e.listVectors.call(this,Object.assign(Object.assign({},r),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}queryVectors(e){let r=Object.create(null,{queryVectors:{get:()=>super.queryVectors}});return rr.__awaiter(this,void 0,void 0,function*(){return r.queryVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}deleteVectors(e){let r=Object.create(null,{deleteVectors:{get:()=>super.deleteVectors}});return rr.__awaiter(this,void 0,void 0,function*(){return r.deleteVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}};mn.VectorIndexScope=_u});var Qp=x(pe=>{"use strict";Object.defineProperty(pe,"__esModule",{value:!0});pe.validateVectorDimension=pe.normalizeToFloat32=pe.isPlainObject=pe.resolveResponse=pe.resolveFetch=pe.isStorageVectorsError=pe.StorageVectorsErrorCode=pe.StorageVectorsUnknownError=pe.StorageVectorsApiError=pe.StorageVectorsError=pe.VectorDataApi=pe.VectorIndexApi=pe.VectorBucketApi=pe.VectorIndexScope=pe.VectorBucketScope=pe.StorageVectorsClient=void 0;var Xp=(fe(),re(le)),Zp=Hy();Object.defineProperty(pe,"StorageVectorsClient",{enumerable:!0,get:function(){return Zp.StorageVectorsClient}});Object.defineProperty(pe,"VectorBucketScope",{enumerable:!0,get:function(){return Zp.VectorBucketScope}});Object.defineProperty(pe,"VectorIndexScope",{enumerable:!0,get:function(){return Zp.VectorIndexScope}});var Rk=Yp();Object.defineProperty(pe,"VectorBucketApi",{enumerable:!0,get:function(){return Xp.__importDefault(Rk).default}});var Bk=Hp();Object.defineProperty(pe,"VectorIndexApi",{enumerable:!0,get:function(){return Xp.__importDefault(Bk).default}});var jk=Gp();Object.defineProperty(pe,"VectorDataApi",{enumerable:!0,get:function(){return Xp.__importDefault(jk).default}});var Sa=zo();Object.defineProperty(pe,"StorageVectorsError",{enumerable:!0,get:function(){return Sa.StorageVectorsError}});Object.defineProperty(pe,"StorageVectorsApiError",{enumerable:!0,get:function(){return Sa.StorageVectorsApiError}});Object.defineProperty(pe,"StorageVectorsUnknownError",{enumerable:!0,get:function(){return Sa.StorageVectorsUnknownError}});Object.defineProperty(pe,"StorageVectorsErrorCode",{enumerable:!0,get:function(){return Sa.StorageVectorsErrorCode}});Object.defineProperty(pe,"isStorageVectorsError",{enumerable:!0,get:function(){return Sa.isStorageVectorsError}});var Fa=Go();Object.defineProperty(pe,"resolveFetch",{enumerable:!0,get:function(){return Fa.resolveFetch}});Object.defineProperty(pe,"resolveResponse",{enumerable:!0,get:function(){return Fa.resolveResponse}});Object.defineProperty(pe,"isPlainObject",{enumerable:!0,get:function(){return Fa.isPlainObject}});Object.defineProperty(pe,"normalizeToFloat32",{enumerable:!0,get:function(){return Fa.normalizeToFloat32}});Object.defineProperty(pe,"validateVectorDimension",{enumerable:!0,get:function(){return Fa.validateVectorDimension}})});var Vy=x(xu=>{"use strict";Object.defineProperty(xu,"__esModule",{value:!0});xu.StorageClient=void 0;var td=(fe(),re(le)),Nk=td.__importDefault(Ly()),Lk=td.__importDefault(Uy()),Uk=td.__importDefault(Np()),Mk=Qp(),ed=class extends Lk.default{constructor(e,r={},n,o){super(e,r,n,o)}from(e){return new Nk.default(this.url,this.headers,e,this.fetch)}get vectors(){return new Mk.StorageVectorsClient(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new Uk.default(this.url+"/iceberg",this.headers,this.fetch)}};xu.StorageClient=ed});var Gy=x(zy=>{"use strict";Object.defineProperty(zy,"__esModule",{value:!0})});var Wy=x(Gr=>{"use strict";Object.defineProperty(Gr,"__esModule",{value:!0});Gr.StorageAnalyticsApi=Gr.StorageClient=void 0;var Su=(fe(),re(le)),qk=Vy();Object.defineProperty(Gr,"StorageClient",{enumerable:!0,get:function(){return qk.StorageClient}});var Hk=Np();Object.defineProperty(Gr,"StorageAnalyticsApi",{enumerable:!0,get:function(){return Su.__importDefault(Hk).default}});Su.__exportStar(Gy(),Gr);Su.__exportStar(hn(),Gr);Su.__exportStar(Qp(),Gr)});var Ky=x(Fu=>{"use strict";Object.defineProperty(Fu,"__esModule",{value:!0});Fu.version=void 0;Fu.version="2.79.0"});var Yy=x(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.DEFAULT_REALTIME_OPTIONS=Gt.DEFAULT_AUTH_OPTIONS=Gt.DEFAULT_DB_OPTIONS=Gt.DEFAULT_GLOBAL_OPTIONS=Gt.DEFAULT_HEADERS=void 0;var Vk=Ky(),Aa="";typeof Deno<"u"?Aa="deno":typeof document<"u"?Aa="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Aa="react-native":Aa="node";Gt.DEFAULT_HEADERS={"X-Client-Info":`supabase-js-${Aa}/${Vk.version}`};Gt.DEFAULT_GLOBAL_OPTIONS={headers:Gt.DEFAULT_HEADERS};Gt.DEFAULT_DB_OPTIONS={schema:"public"};Gt.DEFAULT_AUTH_OPTIONS={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"};Gt.DEFAULT_REALTIME_OPTIONS={}});var Jy=x(xr=>{"use strict";Object.defineProperty(xr,"__esModule",{value:!0});xr.fetchWithAuth=xr.resolveHeadersConstructor=xr.resolveFetch=void 0;var zk=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);xr.resolveFetch=zk;var Gk=()=>Headers;xr.resolveHeadersConstructor=Gk;var Wk=(t,e,r)=>{let n=(0,xr.resolveFetch)(r),o=(0,xr.resolveHeadersConstructor)();return async(i,a)=>{var s;let u=(s=await e())!==null&&s!==void 0?s:t,c=new o(a?.headers);return c.has("apikey")||c.set("apikey",t),c.has("Authorization")||c.set("Authorization",`Bearer ${u}`),n(i,Object.assign(Object.assign({},a),{headers:c}))}};xr.fetchWithAuth=Wk});var Zy=x(gn=>{"use strict";Object.defineProperty(gn,"__esModule",{value:!0});gn.isBrowser=void 0;gn.uuid=Kk;gn.ensureTrailingSlash=Xy;gn.applySettingDefaults=Jk;gn.validateSupabaseUrl=Xk;function Kk(){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 Xy(t){return t.endsWith("/")?t:t+"/"}var Yk=()=>typeof window<"u";gn.isBrowser=Yk;function Jk(t,e){var r,n;let{db:o,auth:i,realtime:a,global:s}=t,{db:u,auth:c,realtime:l,global:f}=e,d={db:Object.assign(Object.assign({},u),o),auth:Object.assign(Object.assign({},c),i),realtime:Object.assign(Object.assign({},l),a),storage:{},global:Object.assign(Object.assign(Object.assign({},f),s),{headers:Object.assign(Object.assign({},(r=f?.headers)!==null&&r!==void 0?r:{}),(n=s?.headers)!==null&&n!==void 0?n:{})}),accessToken:async()=>""};return t.accessToken?d.accessToken=t.accessToken:delete d.accessToken,d}function Xk(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(Xy(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}});var hd={};qr(hd,{AuthAdminApi:()=>nd,AuthApiError:()=>od,AuthClient:()=>rd,AuthError:()=>vr,AuthImplicitGrantRedirectError:()=>cd,AuthInvalidCredentialsError:()=>ud,AuthInvalidTokenResponseError:()=>sd,AuthPKCEGrantCodeExchangeError:()=>ld,AuthRetryableError:()=>id,AuthSessionMissingError:()=>ad,AuthWeakPasswordError:()=>fd,GoTrueAdminApi:()=>Ou,GoTrueClient:()=>Au,NavigatorLockAcquireTimeoutError:()=>pd,isAuthApiError:()=>r3,isAuthError:()=>t3,isAuthRetryableError:()=>n3,isAuthSessionMissingError:()=>o3,isAuthWeakPasswordError:()=>i3,lockInternals:()=>e3,navigatorLock:()=>Zk,processLock:()=>Qk});var dd,Qy,Au,Ou,rd,nd,vr,od,id,ad,sd,ud,cd,ld,fd,Zk,Qk,pd,e3,t3,r3,n3,o3,i3,md=et(()=>{dd=()=>Promise.resolve({data:{session:null,user:null},error:null}),Qy={get:(t,e)=>{if(e==="constructor")return t.constructor;if(!(e==="then"||e==="catch"||e==="finally")&&typeof e!="symbol")return e==="getSession"?()=>Promise.resolve({data:{session:null,user:null},error:null}):e==="onAuthStateChange"?()=>({data:{subscription:{unsubscribe:()=>{}}},error:null}):dd}},Au=class{constructor(e){return this.options=e,new Proxy(this,Qy)}},Ou=class{constructor(e){return this.options=e,new Proxy(this,Qy)}},rd=class extends Au{},nd=class extends Ou{},vr=class extends Error{},od=class extends vr{},id=class extends vr{},ad=class extends vr{},sd=class extends vr{},ud=class extends vr{},cd=class extends vr{},ld=class extends vr{},fd=class extends vr{},Zk=dd,Qk=dd,pd=class extends Error{},e3={},t3=()=>!1,r3=()=>!1,n3=()=>!1,o3=()=>!1,i3=()=>!1});var e0=x(ku=>{"use strict";Object.defineProperty(ku,"__esModule",{value:!0});ku.SupabaseAuthClient=void 0;var a3=(md(),re(hd)),gd=class extends a3.AuthClient{constructor(e){super(e)}};ku.SupabaseAuthClient=gd});var bd=x(yd=>{"use strict";Object.defineProperty(yd,"__esModule",{value:!0});var s3=Zf(),u3=mp(),c3=(yp(),re(Dp)),l3=Wy(),$u=Yy(),f3=Jy(),t0=Zy(),p3=e0(),Dd=class{constructor(e,r,n){var o,i,a;this.supabaseUrl=e,this.supabaseKey=r;let s=(0,t0.validateSupabaseUrl)(e);if(!r)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",s),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",s),this.storageUrl=new URL("storage/v1",s),this.functionsUrl=new URL("functions/v1",s);let u=`sb-${s.hostname.split(".")[0]}-auth-token`,c={db:$u.DEFAULT_DB_OPTIONS,realtime:$u.DEFAULT_REALTIME_OPTIONS,auth:Object.assign(Object.assign({},$u.DEFAULT_AUTH_OPTIONS),{storageKey:u}),global:$u.DEFAULT_GLOBAL_OPTIONS},l=(0,t0.applySettingDefaults)(n??{},c);this.storageKey=(o=l.auth.storageKey)!==null&&o!==void 0?o:"",this.headers=(i=l.global.headers)!==null&&i!==void 0?i:{},l.accessToken?(this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(f,d)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(d)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((a=l.auth)!==null&&a!==void 0?a:{},this.headers,l.global.fetch),this.fetch=(0,f3.fetchWithAuth)(r,this._getAccessToken.bind(this),l.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},l.realtime)),this.rest=new u3.PostgrestClient(new URL("rest/v1",s).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch}),this.storage=new l3.StorageClient(this.storageUrl.href,this.headers,this.fetch,n?.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new s3.FunctionsClient(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,r={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,r,n)}channel(e,r={config:{}}){return this.realtime.channel(e,r)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e,r;if(this.accessToken)return await this.accessToken();let{data:n}=await this.auth.getSession();return(r=(e=n.session)===null||e===void 0?void 0:e.access_token)!==null&&r!==void 0?r:this.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:r,detectSessionInUrl:n,storage:o,userStorage:i,storageKey:a,flowType:s,lock:u,debug:c,throwOnError:l},f,d){let h={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new p3.SupabaseAuthClient({url:this.authUrl.href,headers:Object.assign(Object.assign({},h),f),storageKey:a,autoRefreshToken:e,persistSession:r,detectSessionInUrl:n,storage:o,userStorage:i,flowType:s,lock:u,debug:c,throwOnError:l,fetch:d,hasCustomAuthorizationHeader:Object.keys(this.headers).some(m=>m.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new c3.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)}};yd.default=Dd});var o0=x(Pe=>{"use strict";var d3=Pe&&Pe.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),r0=Pe&&Pe.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&d3(e,t,r)},n0=Pe&&Pe.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Pe,"__esModule",{value:!0});Pe.createClient=Pe.SupabaseClient=Pe.FunctionRegion=Pe.FunctionsError=Pe.FunctionsRelayError=Pe.FunctionsFetchError=Pe.FunctionsHttpError=Pe.PostgrestError=void 0;var h3=n0(bd());r0((md(),re(hd)),Pe);var m3=mp();Object.defineProperty(Pe,"PostgrestError",{enumerable:!0,get:function(){return m3.PostgrestError}});var Oa=Zf();Object.defineProperty(Pe,"FunctionsHttpError",{enumerable:!0,get:function(){return Oa.FunctionsHttpError}});Object.defineProperty(Pe,"FunctionsFetchError",{enumerable:!0,get:function(){return Oa.FunctionsFetchError}});Object.defineProperty(Pe,"FunctionsRelayError",{enumerable:!0,get:function(){return Oa.FunctionsRelayError}});Object.defineProperty(Pe,"FunctionsError",{enumerable:!0,get:function(){return Oa.FunctionsError}});Object.defineProperty(Pe,"FunctionRegion",{enumerable:!0,get:function(){return Oa.FunctionRegion}});r0((yp(),re(Dp)),Pe);var g3=bd();Object.defineProperty(Pe,"SupabaseClient",{enumerable:!0,get:function(){return n0(g3).default}});var D3=(t,e,r)=>new h3.default(t,e,r);Pe.createClient=D3;function y3(){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}y3()&&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 vd=x((eV,i0)=>{i0.exports={LOCHDR:30,LOCSIG:67324752,LOCVER:4,LOCFLG:6,LOCHOW:8,LOCTIM:10,LOCCRC:14,LOCSIZ:18,LOCLEN:22,LOCNAM:26,LOCEXT:28,EXTSIG:134695760,EXTHDR:16,EXTCRC:4,EXTSIZ:8,EXTLEN:12,CENHDR:46,CENSIG:33639248,CENVEM:4,CENVER:6,CENFLG:8,CENHOW:10,CENTIM:12,CENCRC:16,CENSIZ:20,CENLEN:24,CENNAM:28,CENEXT:30,CENCOM:32,CENDSK:34,CENATT:36,CENATX:38,CENOFF:42,ENDHDR:22,ENDSIG:101010256,ENDSUB:8,ENDTOT:10,ENDSIZ:12,ENDOFF:16,ENDCOM:20,END64HDR:20,END64SIG:117853008,END64START:4,END64OFF:8,END64NUMDISKS:16,ZIP64SIG:101075792,ZIP64HDR:56,ZIP64LEAD:12,ZIP64SIZE:4,ZIP64VEM:12,ZIP64VER:14,ZIP64DSK:16,ZIP64DSKDIR:20,ZIP64SUB:24,ZIP64TOT:32,ZIP64SIZB:40,ZIP64OFF:48,ZIP64EXTRA:56,STORED:0,SHRUNK:1,REDUCED1:2,REDUCED2:3,REDUCED3:4,REDUCED4:5,IMPLODED:6,DEFLATED:8,ENHANCED_DEFLATED:9,PKWARE:10,BZIP2:12,LZMA:14,IBM_TERSE:18,IBM_LZ77:19,AES_ENCRYPT:99,FLG_ENC:1,FLG_COMP1:2,FLG_COMP2:4,FLG_DESC:8,FLG_ENH:16,FLG_PATCH:32,FLG_STR:64,FLG_EFS:2048,FLG_MSK:4096,FILE:2,BUFFER:1,NONE:0,EF_ID:0,EF_SIZE:2,ID_ZIP64:1,ID_AVINFO:7,ID_PFS:8,ID_OS2:9,ID_NTFS:10,ID_OPENVMS:12,ID_UNIX:13,ID_FORK:14,ID_PATCH:15,ID_X509_PKCS7:20,ID_X509_CERTID_F:21,ID_X509_CERTID_C:22,ID_STRONGENC:23,ID_RECORD_MGT:24,ID_X509_PKCS7_RL:25,ID_IBM1:101,ID_IBM2:102,ID_POSZIP:18064,EF_ZIP64_OR_32:4294967295,EF_ZIP64_OR_16:65535,EF_ZIP64_SUNCOMP:0,EF_ZIP64_SCOMP:8,EF_ZIP64_RHO:16,EF_ZIP64_DSN:24}});var Pu=x(s0=>{var a0={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 b3(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(a0))s0[t]=b3(a0[t])});var p0=x((rV,f0)=>{var v3=require("fs"),tt=require("path"),u0=vd(),w3=Pu(),C3=typeof process=="object"&&process.platform==="win32",c0=t=>typeof t=="object"&&t!==null,l0=new Uint32Array(256).map((t,e)=>{for(let r=0;r<8;r++)(e&1)!==0?e=3988292384^e>>>1:e>>>=1;return e>>>0});function ze(t){this.sep=tt.sep,this.fs=v3,c0(t)&&c0(t.fs)&&typeof t.fs.statSync=="function"&&(this.fs=t.fs)}f0.exports=ze;ze.prototype.makeDir=function(t){let e=this;function r(n){let o=n.split(e.sep)[0];n.split(e.sep).forEach(function(i){if(!(!i||i.substr(-1,1)===":")){o+=e.sep+i;var a;try{a=e.fs.statSync(o)}catch{e.fs.mkdirSync(o)}if(a&&a.isFile())throw w3.FILE_IN_THE_WAY(`"${o}"`)}})}r(t)};ze.prototype.writeFileTo=function(t,e,r,n){let o=this;if(o.fs.existsSync(t)){if(!r)return!1;var i=o.fs.statSync(t);if(i.isDirectory())return!1}var a=tt.dirname(t);o.fs.existsSync(a)||o.makeDir(a);var s;try{s=o.fs.openSync(t,"w",438)}catch{o.fs.chmodSync(t,438),s=o.fs.openSync(t,"w",438)}if(s)try{o.fs.writeSync(s,e,0,e.length,0)}finally{o.fs.closeSync(s)}return o.fs.chmodSync(t,n||438),!0};ze.prototype.writeFileToAsync=function(t,e,r,n,o){typeof n=="function"&&(o=n,n=void 0);let i=this;i.fs.exists(t,function(a){if(a&&!r)return o(!1);i.fs.stat(t,function(s,u){if(a&&u.isDirectory())return o(!1);var c=tt.dirname(t);i.fs.exists(c,function(l){l||i.makeDir(c),i.fs.open(t,"w",438,function(f,d){f?i.fs.chmod(t,438,function(){i.fs.open(t,"w",438,function(h,m){i.fs.write(m,e,0,e.length,0,function(){i.fs.close(m,function(){i.fs.chmod(t,n||438,function(){o(!0)})})})})}):d?i.fs.write(d,e,0,e.length,0,function(){i.fs.close(d,function(){i.fs.chmod(t,n||438,function(){o(!0)})})}):i.fs.chmod(t,n||438,function(){o(!0)})})})})})};ze.prototype.findFiles=function(t){let e=this;function r(n,o,i){typeof o=="boolean"&&(i=o,o=void 0);let a=[];return e.fs.readdirSync(n).forEach(function(s){let u=tt.join(n,s),c=e.fs.statSync(u);(!o||o.test(u))&&a.push(tt.normalize(u)+(c.isDirectory()?e.sep:"")),c.isDirectory()&&i&&(a=a.concat(r(u,o,i)))}),a}return r(t,void 0,!0)};ze.prototype.findFilesAsync=function(t,e){let r=this,n=[];r.fs.readdir(t,function(o,i){if(o)return e(o);let a=i.length;if(!a)return e(null,n);i.forEach(function(s){s=tt.join(t,s),r.fs.stat(s,function(u,c){if(u)return e(u);c&&(n.push(tt.normalize(s)+(c.isDirectory()?r.sep:"")),c.isDirectory()?r.findFilesAsync(s,function(l,f){if(l)return e(l);n=n.concat(f),--a||e(null,n)}):--a||e(null,n))})})})};ze.prototype.getAttributes=function(){};ze.prototype.setAttributes=function(){};ze.crc32update=function(t,e){return l0[(t^e)&255]^t>>>8};ze.crc32=function(t){typeof t=="string"&&(t=Buffer.from(t,"utf8"));let e=t.length,r=-1;for(let n=0;n<e;)r=ze.crc32update(r,t[n++]);return~r>>>0};ze.methodToString=function(t){switch(t){case u0.STORED:return"STORED ("+t+")";case u0.DEFLATED:return"DEFLATED ("+t+")";default:return"UNSUPPORTED ("+t+")"}};ze.canonical=function(t){if(!t)return"";let e=tt.posix.normalize("/"+t.split("\\").join("/"));return tt.join(".",e)};ze.zipnamefix=function(t){if(!t)return"";let e=tt.posix.normalize("/"+t.split("\\").join("/"));return tt.posix.join(".",e)};ze.findLast=function(t,e){if(!Array.isArray(t))throw new TypeError("arr is not array");let r=t.length>>>0;for(let n=r-1;n>=0;n--)if(e(t[n],n,t))return t[n]};ze.sanitize=function(t,e){t=tt.resolve(tt.normalize(t));for(var r=e.split("/"),n=0,o=r.length;n<o;n++){var i=tt.normalize(tt.join(t,r.slice(n,o).join(tt.sep)));if(i.indexOf(t)===0)return i}return tt.normalize(tt.join(t,tt.basename(e)))};ze.toBuffer=function(e,r){return Buffer.isBuffer(e)?e:e instanceof Uint8Array?Buffer.from(e):typeof e=="string"?r(e):Buffer.alloc(0)};ze.readBigUInt64LE=function(t,e){var r=Buffer.from(t.slice(e,e+8));return r.swap64(),parseInt(`0x${r.toString("hex")}`)};ze.fromDOS2Date=function(t){return new Date((t>>25&127)+1980,Math.max((t>>21&15)-1,0),Math.max(t>>16&31,1),t>>11&31,t>>5&63,(t&31)<<1)};ze.fromDate2DOS=function(t){let e=0,r=0;return t.getFullYear()>1979&&(e=(t.getFullYear()-1980&127)<<9|t.getMonth()+1<<5|t.getDate(),r=t.getHours()<<11|t.getMinutes()<<5|t.getSeconds()>>1),e<<16|r};ze.isWin=C3;ze.crcTable=l0});var h0=x((nV,d0)=>{var E3=require("path");d0.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=E3.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 g0=x((oV,m0)=>{m0.exports={efs:!0,encode:t=>Buffer.from(t,"utf8"),decode:t=>t.toString("utf8")}});var Jo=x((iV,Yo)=>{Yo.exports=p0();Yo.exports.Constants=vd();Yo.exports.Errors=Pu();Yo.exports.FileAttr=h0();Yo.exports.decoder=g0()});var y0=x((aV,D0)=>{var Dn=Jo(),W=Dn.Constants;D0.exports=function(){var t=20,e=10,r=0,n=0,o=0,i=0,a=0,s=0,u=0,c=0,l=0,f=0,d=0,h=0,m=0;t|=Dn.isWin?2560:768,r|=W.FLG_EFS;let b={extraLen:0},D=g=>Math.max(0,g)>>>0,C=g=>Math.max(0,g)&65535,E=g=>Math.max(0,g)&255;return o=Dn.fromDate2DOS(new Date),{get made(){return t},set made(g){t=g},get version(){return e},set version(g){e=g},get flags(){return r},set flags(g){r=g},get flags_efs(){return(r&W.FLG_EFS)>0},set flags_efs(g){g?r|=W.FLG_EFS:r&=~W.FLG_EFS},get flags_desc(){return(r&W.FLG_DESC)>0},set flags_desc(g){g?r|=W.FLG_DESC:r&=~W.FLG_DESC},get method(){return n},set method(g){switch(g){case W.STORED:this.version=10;case W.DEFLATED:default:this.version=20}n=g},get time(){return Dn.fromDOS2Date(this.timeval)},set time(g){this.timeval=Dn.fromDate2DOS(g)},get timeval(){return o},set timeval(g){o=D(g)},get timeHighByte(){return E(o>>>8)},get crc(){return i},set crc(g){i=D(g)},get compressedSize(){return a},set compressedSize(g){a=D(g)},get size(){return s},set size(g){s=D(g)},get fileNameLength(){return u},set fileNameLength(g){u=g},get extraLength(){return c},set extraLength(g){c=g},get extraLocalLength(){return b.extraLen},set extraLocalLength(g){b.extraLen=g},get commentLength(){return l},set commentLength(g){l=g},get diskNumStart(){return f},set diskNumStart(g){f=D(g)},get inAttr(){return d},set inAttr(g){d=D(g)},get attr(){return h},set attr(g){h=D(g)},get fileAttr(){return(h||0)>>16&4095},get offset(){return m},set offset(g){m=D(g)},get encrypted(){return(r&W.FLG_ENC)===W.FLG_ENC},get centralHeaderSize(){return W.CENHDR+u+c+l},get realDataOffset(){return m+W.LOCHDR+b.fnameLen+b.extraLen},get localHeader(){return b},loadLocalHeaderFromBinary:function(g){var _=g.slice(m,m+W.LOCHDR);if(_.readUInt32LE(0)!==W.LOCSIG)throw Dn.Errors.INVALID_LOC();b.version=_.readUInt16LE(W.LOCVER),b.flags=_.readUInt16LE(W.LOCFLG),b.method=_.readUInt16LE(W.LOCHOW),b.time=_.readUInt32LE(W.LOCTIM),b.crc=_.readUInt32LE(W.LOCCRC),b.compressedSize=_.readUInt32LE(W.LOCSIZ),b.size=_.readUInt32LE(W.LOCLEN),b.fnameLen=_.readUInt16LE(W.LOCNAM),b.extraLen=_.readUInt16LE(W.LOCEXT);let S=m+W.LOCHDR+b.fnameLen,T=S+b.extraLen;return g.slice(S,T)},loadFromBinary:function(g){if(g.length!==W.CENHDR||g.readUInt32LE(0)!==W.CENSIG)throw Dn.Errors.INVALID_CEN();t=g.readUInt16LE(W.CENVEM),e=g.readUInt16LE(W.CENVER),r=g.readUInt16LE(W.CENFLG),n=g.readUInt16LE(W.CENHOW),o=g.readUInt32LE(W.CENTIM),i=g.readUInt32LE(W.CENCRC),a=g.readUInt32LE(W.CENSIZ),s=g.readUInt32LE(W.CENLEN),u=g.readUInt16LE(W.CENNAM),c=g.readUInt16LE(W.CENEXT),l=g.readUInt16LE(W.CENCOM),f=g.readUInt16LE(W.CENDSK),d=g.readUInt16LE(W.CENATT),h=g.readUInt32LE(W.CENATX),m=g.readUInt32LE(W.CENOFF)},localHeaderToBinary:function(){var g=Buffer.alloc(W.LOCHDR);return g.writeUInt32LE(W.LOCSIG,0),g.writeUInt16LE(e,W.LOCVER),g.writeUInt16LE(r,W.LOCFLG),g.writeUInt16LE(n,W.LOCHOW),g.writeUInt32LE(o,W.LOCTIM),g.writeUInt32LE(i,W.LOCCRC),g.writeUInt32LE(a,W.LOCSIZ),g.writeUInt32LE(s,W.LOCLEN),g.writeUInt16LE(u,W.LOCNAM),g.writeUInt16LE(b.extraLen,W.LOCEXT),g},centralHeaderToBinary:function(){var g=Buffer.alloc(W.CENHDR+u+c+l);return g.writeUInt32LE(W.CENSIG,0),g.writeUInt16LE(t,W.CENVEM),g.writeUInt16LE(e,W.CENVER),g.writeUInt16LE(r,W.CENFLG),g.writeUInt16LE(n,W.CENHOW),g.writeUInt32LE(o,W.CENTIM),g.writeUInt32LE(i,W.CENCRC),g.writeUInt32LE(a,W.CENSIZ),g.writeUInt32LE(s,W.CENLEN),g.writeUInt16LE(u,W.CENNAM),g.writeUInt16LE(c,W.CENEXT),g.writeUInt16LE(l,W.CENCOM),g.writeUInt16LE(f,W.CENDSK),g.writeUInt16LE(d,W.CENATT),g.writeUInt32LE(h,W.CENATX),g.writeUInt32LE(m,W.CENOFF),g},toJSON:function(){let g=function(_){return _+" bytes"};return{made:t,version:e,flags:r,method:Dn.methodToString(n),time:this.time,crc:"0x"+i.toString(16).toUpperCase(),compressedSize:g(a),size:g(s),fileNameLength:g(u),extraLength:g(c),commentLength:g(l),diskNumStart:f,inAttr:d,attr:h,offset:m,centralHeaderSize:g(W.CENHDR+u+c+l)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var v0=x((sV,b0)=>{var Xo=Jo(),Me=Xo.Constants;b0.exports=function(){var t=0,e=0,r=0,n=0,o=0;return{get diskEntries(){return t},set diskEntries(i){t=e=i},get totalEntries(){return e},set totalEntries(i){e=t=i},get size(){return r},set size(i){r=i},get offset(){return n},set offset(i){n=i},get commentLength(){return o},set commentLength(i){o=i},get mainHeaderSize(){return Me.ENDHDR+o},loadFromBinary:function(i){if((i.length!==Me.ENDHDR||i.readUInt32LE(0)!==Me.ENDSIG)&&(i.length<Me.ZIP64HDR||i.readUInt32LE(0)!==Me.ZIP64SIG))throw Xo.Errors.INVALID_END();i.readUInt32LE(0)===Me.ENDSIG?(t=i.readUInt16LE(Me.ENDSUB),e=i.readUInt16LE(Me.ENDTOT),r=i.readUInt32LE(Me.ENDSIZ),n=i.readUInt32LE(Me.ENDOFF),o=i.readUInt16LE(Me.ENDCOM)):(t=Xo.readBigUInt64LE(i,Me.ZIP64SUB),e=Xo.readBigUInt64LE(i,Me.ZIP64TOT),r=Xo.readBigUInt64LE(i,Me.ZIP64SIZE),n=Xo.readBigUInt64LE(i,Me.ZIP64OFF),o=0)},toBinary:function(){var i=Buffer.alloc(Me.ENDHDR+o);return i.writeUInt32LE(Me.ENDSIG,0),i.writeUInt32LE(0,4),i.writeUInt16LE(t,Me.ENDSUB),i.writeUInt16LE(e,Me.ENDTOT),i.writeUInt32LE(r,Me.ENDSIZ),i.writeUInt32LE(n,Me.ENDOFF),i.writeUInt16LE(o,Me.ENDCOM),i.fill(" ",Me.ENDHDR),i},toJSON:function(){let i=function(a,s){let u=a.toString(16).toUpperCase();for(;u.length<s;)u="0"+u;return"0x"+u};return{diskEntries:t,totalEntries:e,size:r+" bytes",offset:i(n,4),commentLength:o}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var Cd=x(wd=>{wd.EntryHeader=y0();wd.MainHeader=v0()});var C0=x((cV,w0)=>{w0.exports=function(t){var e=require("zlib"),r={chunkSize:(parseInt(t.length/1024)+1)*1024};return{deflate:function(){return e.deflateRawSync(t,r)},deflateAsync:function(n){var o=e.createDeflateRaw(r),i=[],a=0;o.on("data",function(s){i.push(s),a+=s.length}),o.on("end",function(){var s=Buffer.alloc(a),u=0;s.fill(0);for(var c=0;c<i.length;c++){var l=i[c];l.copy(s,u),u+=l.length}n&&n(s)}),o.end(t)}}}});var _0=x((lV,E0)=>{var _3=+(process.versions?process.versions.node:"").split(".")[0]||0;E0.exports=function(t,e){var r=require("zlib");let n=_3>=15&&e>0?{maxOutputLength:e}:{};return{inflate:function(){return r.inflateRawSync(t,n)},inflateAsync:function(o){var i=r.createInflateRaw(n),a=[],s=0;i.on("data",function(u){a.push(u),s+=u.length}),i.on("end",function(){var u=Buffer.alloc(s),c=0;u.fill(0);for(var l=0;l<a.length;l++){var f=a[l];f.copy(u,c),c+=f.length}o&&o(u)}),i.end(t)}}}});var O0=x((fV,A0)=>{"use strict";var{randomFillSync:x0}=require("crypto"),x3=Pu(),S3=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}),F0=(t,e)=>Math.imul(t,e)>>>0,S0=(t,e)=>S3[(t^e)&255]^t>>>8,ka=()=>typeof x0=="function"?x0(Buffer.alloc(12)):ka.node();ka.node=()=>{let t=Buffer.alloc(12),e=t.length;for(let r=0;r<e;r++)t[r]=Math.random()*256&255;return t};var Tu={genSalt:ka};function Iu(t){let e=Buffer.isBuffer(t)?t:Buffer.from(t);this.keys=new Uint32Array([305419896,591751049,878082192]);for(let r=0;r<e.length;r++)this.updateKeys(e[r])}Iu.prototype.updateKeys=function(t){let e=this.keys;return e[0]=S0(e[0],t),e[1]+=e[0]&255,e[1]=F0(e[1],134775813)+1,e[2]=S0(e[2],e[1]>>>24),t};Iu.prototype.next=function(){let t=(this.keys[2]|2)>>>0;return F0(t,t^1)>>8&255};function F3(t){let e=new Iu(t);return function(r){let n=Buffer.alloc(r.length),o=0;for(let i of r)n[o++]=e.updateKeys(i^e.next());return n}}function A3(t){let e=new Iu(t);return function(r,n,o=0){n||(n=Buffer.alloc(r.length));for(let i of r){let a=e.next();n[o++]=i^a,e.updateKeys(i)}return n}}function O3(t,e,r){if(!t||!Buffer.isBuffer(t)||t.length<12)return Buffer.alloc(0);let n=F3(r),o=n(t.slice(0,12)),i=(e.flags&8)===8?e.timeHighByte:e.crc>>>24;if(o[11]!==i)throw x3.WRONG_PASSWORD();return n(t.slice(12))}function k3(t){Buffer.isBuffer(t)&&t.length>=12?Tu.genSalt=function(){return t.slice(0,12)}:t==="node"?Tu.genSalt=ka.node:Tu.genSalt=ka}function $3(t,e,r,n=!1){t==null&&(t=Buffer.alloc(0)),Buffer.isBuffer(t)||(t=Buffer.from(t.toString()));let o=A3(r),i=Tu.genSalt();i[11]=e.crc>>>24&255,n&&(i[10]=e.crc>>>16&255);let a=Buffer.alloc(t.length+12);return o(i,a),o(t,a,12)}A0.exports={decrypt:O3,encrypt:$3,_salter:k3}});var k0=x(Ru=>{Ru.Deflater=C0();Ru.Inflater=_0();Ru.ZipCrypto=O0()});var _d=x((dV,$0)=>{var xe=Jo(),P3=Cd(),Ge=xe.Constants,Ed=k0();$0.exports=function(t,e){var r=new P3.EntryHeader,n=Buffer.alloc(0),o=Buffer.alloc(0),i=!1,a=null,s=Buffer.alloc(0),u=Buffer.alloc(0),c=!0;let l=t,f=typeof l.decoder=="object"?l.decoder:xe.decoder;c=f.hasOwnProperty("efs")?f.efs:!1;function d(){return!e||!(e instanceof Uint8Array)?Buffer.alloc(0):(u=r.loadLocalHeaderFromBinary(e),e.slice(r.realDataOffset,r.realDataOffset+r.compressedSize))}function h(g){if(r.flags_desc){let _={},S=r.realDataOffset+r.compressedSize;if(e.readUInt32LE(S)==Ge.LOCSIG||e.readUInt32LE(S)==Ge.CENSIG)throw xe.Errors.DESCRIPTOR_NOT_EXIST();if(e.readUInt32LE(S)==Ge.EXTSIG)_.crc=e.readUInt32LE(S+Ge.EXTCRC),_.compressedSize=e.readUInt32LE(S+Ge.EXTSIZ),_.size=e.readUInt32LE(S+Ge.EXTLEN);else if(e.readUInt16LE(S+12)===19280)_.crc=e.readUInt32LE(S+Ge.EXTCRC-4),_.compressedSize=e.readUInt32LE(S+Ge.EXTSIZ-4),_.size=e.readUInt32LE(S+Ge.EXTLEN-4);else throw xe.Errors.DESCRIPTOR_UNKNOWN();if(_.compressedSize!==r.compressedSize||_.size!==r.size||_.crc!==r.crc)throw xe.Errors.DESCRIPTOR_FAULTY();if(xe.crc32(g)!==_.crc)return!1}else if(xe.crc32(g)!==r.localHeader.crc)return!1;return!0}function m(g,_,S){if(typeof _>"u"&&typeof g=="string"&&(S=g,g=void 0),i)return g&&_&&_(Buffer.alloc(0),xe.Errors.DIRECTORY_CONTENT_ERROR()),Buffer.alloc(0);var T=d();if(T.length===0)return g&&_&&_(T),T;if(r.encrypted){if(typeof S!="string"&&!Buffer.isBuffer(S))throw xe.Errors.INVALID_PASS_PARAM();T=Ed.ZipCrypto.decrypt(T,r,S)}var O=Buffer.alloc(r.size);switch(r.method){case xe.Constants.STORED:if(T.copy(O),h(O))return g&&_&&_(O),O;throw g&&_&&_(O,xe.Errors.BAD_CRC()),xe.Errors.BAD_CRC();case xe.Constants.DEFLATED:var B=new Ed.Inflater(T,r.size);if(g)B.inflateAsync(function(R){R.copy(R,0),_&&(h(R)?_(R):_(R,xe.Errors.BAD_CRC()))});else{if(B.inflate(O).copy(O,0),!h(O))throw xe.Errors.BAD_CRC(`"${f.decode(n)}"`);return O}break;default:throw g&&_&&_(Buffer.alloc(0),xe.Errors.UNKNOWN_METHOD()),xe.Errors.UNKNOWN_METHOD()}}function b(g,_){if((!a||!a.length)&&Buffer.isBuffer(e))return g&&_&&_(d()),d();if(a.length&&!i){var S;switch(r.method){case xe.Constants.STORED:return r.compressedSize=r.size,S=Buffer.alloc(a.length),a.copy(S),g&&_&&_(S),S;default:case xe.Constants.DEFLATED:var T=new Ed.Deflater(a);if(g)T.deflateAsync(function(B){S=Buffer.alloc(B.length),r.compressedSize=B.length,B.copy(S),_&&_(S)});else{var O=T.deflate();return r.compressedSize=O.length,O}T=null;break}}else if(g&&_)_(Buffer.alloc(0));else return Buffer.alloc(0)}function D(g,_){return(g.readUInt32LE(_+4)<<4)+g.readUInt32LE(_)}function C(g){try{for(var _=0,S,T,O;_+4<g.length;)S=g.readUInt16LE(_),_+=2,T=g.readUInt16LE(_),_+=2,O=g.slice(_,_+T),_+=T,Ge.ID_ZIP64===S&&E(O)}catch{throw xe.Errors.EXTRA_FIELD_PARSE_ERROR()}}function E(g){var _,S,T,O;g.length>=Ge.EF_ZIP64_SCOMP&&(_=D(g,Ge.EF_ZIP64_SUNCOMP),r.size===Ge.EF_ZIP64_OR_32&&(r.size=_)),g.length>=Ge.EF_ZIP64_RHO&&(S=D(g,Ge.EF_ZIP64_SCOMP),r.compressedSize===Ge.EF_ZIP64_OR_32&&(r.compressedSize=S)),g.length>=Ge.EF_ZIP64_DSN&&(T=D(g,Ge.EF_ZIP64_RHO),r.offset===Ge.EF_ZIP64_OR_32&&(r.offset=T)),g.length>=Ge.EF_ZIP64_DSN+4&&(O=g.readUInt32LE(Ge.EF_ZIP64_DSN),r.diskNumStart===Ge.EF_ZIP64_OR_16&&(r.diskNumStart=O))}return{get entryName(){return f.decode(n)},get rawEntryName(){return n},set entryName(g){n=xe.toBuffer(g,f.encode);var _=n[n.length-1];i=_===47||_===92,r.fileNameLength=n.length},get efs(){return typeof c=="function"?c(this.entryName):c},get extra(){return s},set extra(g){s=g,r.extraLength=g.length,C(g)},get comment(){return f.decode(o)},set comment(g){if(o=xe.toBuffer(g,f.encode),r.commentLength=o.length,o.length>65535)throw xe.Errors.COMMENT_TOO_LONG()},get name(){var g=f.decode(n);return i?g.substr(g.length-1).split("/").pop():g.split("/").pop()},get isDirectory(){return i},getCompressedData:function(){return b(!1,null)},getCompressedDataAsync:function(g){b(!0,g)},setData:function(g){a=xe.toBuffer(g,xe.decoder.encode),!i&&a.length?(r.size=a.length,r.method=xe.Constants.DEFLATED,r.crc=xe.crc32(g),r.changed=!0):r.method=xe.Constants.STORED},getData:function(g){return r.changed?a:m(!1,null,g)},getDataAsync:function(g,_){r.changed?g(a):m(!0,g,_)},set attr(g){r.attr=g},get attr(){return r.attr},set header(g){r.loadFromBinary(g)},get header(){return r},packCentralHeader:function(){r.flags_efs=this.efs,r.extraLength=s.length;var g=r.centralHeaderToBinary(),_=xe.Constants.CENHDR;return n.copy(g,_),_+=n.length,s.copy(g,_),_+=r.extraLength,o.copy(g,_),g},packLocalHeader:function(){let g=0;r.flags_efs=this.efs,r.extraLocalLength=u.length;let _=r.localHeaderToBinary(),S=Buffer.alloc(_.length+n.length+r.extraLocalLength);return _.copy(S,g),g+=_.length,n.copy(S,g),g+=n.length,u.copy(S,g),g+=u.length,S},toJSON:function(){let g=function(_){return"<"+(_&&_.length+" bytes buffer"||"null")+">"};return{entryName:this.entryName,name:this.name,comment:this.comment,isDirectory:this.isDirectory,header:r.toJSON(),compressedData:g(e),data:g(a)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var I0=x((hV,T0)=>{var P0=_d(),T3=Cd(),dt=Jo();T0.exports=function(t,e){var r=[],n={},o=Buffer.alloc(0),i=new T3.MainHeader,a=!1,s=null;let u=new Set,c=e,{noSort:l,decoder:f}=c;t?m(c.readEntries):a=!0;function d(){let D=new Set;for(let C of Object.keys(n)){let E=C.split("/");if(E.pop(),!!E.length)for(let g=0;g<E.length;g++){let _=E.slice(0,g+1).join("/")+"/";D.add(_)}}for(let C of D)if(!(C in n)){let E=new P0(c);E.entryName=C,E.attr=16,E.temporary=!0,r.push(E),n[E.entryName]=E,u.add(E)}}function h(){if(a=!0,n={},i.diskEntries>(t.length-i.offset)/dt.Constants.CENHDR)throw dt.Errors.DISK_ENTRY_TOO_LARGE();r=new Array(i.diskEntries);for(var D=i.offset,C=0;C<r.length;C++){var E=D,g=new P0(c,t);g.header=t.slice(E,E+=dt.Constants.CENHDR),g.entryName=t.slice(E,E+=g.header.fileNameLength),g.header.extraLength&&(g.extra=t.slice(E,E+=g.header.extraLength)),g.header.commentLength&&(g.comment=t.slice(E,E+g.header.commentLength)),D+=g.header.centralHeaderSize,r[C]=g,n[g.entryName]=g}u.clear(),d()}function m(D){var C=t.length-dt.Constants.ENDHDR,E=Math.max(0,C-65535),g=E,_=t.length,S=-1,T=0;for((typeof c.trailingSpace=="boolean"?c.trailingSpace:!1)&&(E=0),C;C>=g;C--)if(t[C]===80){if(t.readUInt32LE(C)===dt.Constants.ENDSIG){S=C,T=C,_=C+dt.Constants.ENDHDR,g=C-dt.Constants.END64HDR;continue}if(t.readUInt32LE(C)===dt.Constants.END64SIG){g=E;continue}if(t.readUInt32LE(C)===dt.Constants.ZIP64SIG){S=C,_=C+dt.readBigUInt64LE(t,C+dt.Constants.ZIP64SIZE)+dt.Constants.ZIP64LEAD;break}}if(S==-1)throw dt.Errors.INVALID_FORMAT();i.loadFromBinary(t.slice(S,_)),i.commentLength&&(o=t.slice(T+dt.Constants.ENDHDR)),D&&h()}function b(){r.length>1&&!l&&r.sort((D,C)=>D.entryName.toLowerCase().localeCompare(C.entryName.toLowerCase()))}return{get entries(){return a||h(),r.filter(D=>!u.has(D))},get comment(){return f.decode(o)},set comment(D){o=dt.toBuffer(D,f.encode),i.commentLength=o.length},getEntryCount:function(){return a?r.length:i.diskEntries},forEach:function(D){this.entries.forEach(D)},getEntry:function(D){return a||h(),n[D]||null},setEntry:function(D){a||h(),r.push(D),n[D.entryName]=D,i.totalEntries=r.length},deleteFile:function(D,C=!0){a||h();let E=n[D];this.getEntryChildren(E,C).map(_=>_.entryName).forEach(this.deleteEntry)},deleteEntry:function(D){a||h();let C=n[D],E=r.indexOf(C);E>=0&&(r.splice(E,1),delete n[D],i.totalEntries=r.length)},getEntryChildren:function(D,C=!0){if(a||h(),typeof D=="object")if(D.isDirectory&&C){let E=[],g=D.entryName;for(let _ of r)_.entryName.startsWith(g)&&E.push(_);return E}else return[D];return[]},getChildCount:function(D){if(D&&D.isDirectory){let C=this.getEntryChildren(D);return C.includes(D)?C.length-1:C.length}return 0},compressToBuffer:function(){a||h(),b();let D=[],C=[],E=0,g=0;i.size=0,i.offset=0;let _=0;for(let O of this.entries){let B=O.getCompressedData();O.header.offset=g;let R=O.packLocalHeader(),N=R.length+B.length;g+=N,D.push(R),D.push(B);let A=O.packCentralHeader();C.push(A),i.size+=A.length,E+=N+A.length,_++}E+=i.mainHeaderSize,i.offset=g,i.totalEntries=_,g=0;let S=Buffer.alloc(E);for(let O of D)O.copy(S,g),g+=O.length;for(let O of C)O.copy(S,g),g+=O.length;let T=i.toBinary();return o&&o.copy(T,dt.Constants.ENDHDR),T.copy(S,g),t=S,a=!1,S},toAsyncBuffer:function(D,C,E,g){try{a||h(),b();let _=[],S=[],T=0,O=0,B=0;i.size=0,i.offset=0;let R=function(N){if(N.length>0){let A=N.shift(),U=A.entryName+A.extra.toString();E&&E(U),A.getCompressedDataAsync(function(M){g&&g(U),A.header.offset=O;let Q=A.packLocalHeader(),$=Q.length+M.length;O+=$,_.push(Q),_.push(M);let y=A.packCentralHeader();S.push(y),i.size+=y.length,T+=$+y.length,B++,R(N)})}else{T+=i.mainHeaderSize,i.offset=O,i.totalEntries=B,O=0;let A=Buffer.alloc(T);_.forEach(function(M){M.copy(A,O),O+=M.length}),S.forEach(function(M){M.copy(A,O),O+=M.length});let U=i.toBinary();o&&o.copy(U,dt.Constants.ENDHDR),U.copy(A,O),t=A,a=!1,D(A)}};R(Array.from(this.entries))}catch(_){C(_)}}}}});var j0=x((mV,B0)=>{var qe=Jo(),We=require("path"),I3=_d(),R3=I0(),Gn=(...t)=>qe.findLast(t,e=>typeof e=="boolean"),R0=(...t)=>qe.findLast(t,e=>typeof e=="string"),B3=(...t)=>qe.findLast(t,e=>typeof e=="function"),j3={noSort:!1,readEntries:!1,method:qe.Constants.NONE,fs:null};B0.exports=function(t,e){let r=null,n=Object.assign(Object.create(null),j3);t&&typeof t=="object"&&(t instanceof Uint8Array||(Object.assign(n,t),t=n.input?n.input:void 0,n.input&&delete n.input),Buffer.isBuffer(t)&&(r=t,n.method=qe.Constants.BUFFER,t=void 0)),Object.assign(n,e);let o=new qe(n);if((typeof n.decoder!="object"||typeof n.decoder.encode!="function"||typeof n.decoder.decode!="function")&&(n.decoder=qe.decoder),t&&typeof t=="string")if(o.fs.existsSync(t))n.method=qe.Constants.FILE,n.filename=t,r=o.fs.readFileSync(t);else throw qe.Errors.INVALID_FILENAME();let i=new R3(r,n),{canonical:a,sanitize:s,zipnamefix:u}=qe;function c(h){if(h&&i){var m;if(typeof h=="string"&&(m=i.getEntry(We.posix.normalize(h))),typeof h=="object"&&typeof h.entryName<"u"&&typeof h.header<"u"&&(m=i.getEntry(h.entryName)),m)return m}return null}function l(h){let{join:m,normalize:b,sep:D}=We.posix;return m(".",b(D+h.split("\\").join(D)+D))}function f(h){return h instanceof RegExp?(function(m){return function(b){return m.test(b)}})(h):typeof h!="function"?()=>!0:h}let d=(h,m)=>{let b=m.slice(-1);return b=b===o.sep?o.sep:"",We.relative(h,m)+b};return{readFile:function(h,m){var b=c(h);return b&&b.getData(m)||null},childCount:function(h){let m=c(h);if(m)return i.getChildCount(m)},readFileAsync:function(h,m){var b=c(h);b?b.getDataAsync(m):m(null,"getEntry failed for:"+h)},readAsText:function(h,m){var b=c(h);if(b){var D=b.getData();if(D&&D.length)return D.toString(m||"utf8")}return""},readAsTextAsync:function(h,m,b){var D=c(h);D?D.getDataAsync(function(C,E){if(E){m(C,E);return}C&&C.length?m(C.toString(b||"utf8")):m("")}):m("")},deleteFile:function(h,m=!0){var b=c(h);b&&i.deleteFile(b.entryName,m)},deleteEntry:function(h){var m=c(h);m&&i.deleteEntry(m.entryName)},addZipComment:function(h){i.comment=h},getZipComment:function(){return i.comment||""},addZipEntryComment:function(h,m){var b=c(h);b&&(b.comment=m)},getZipEntryComment:function(h){var m=c(h);return m&&m.comment||""},updateFile:function(h,m){var b=c(h);b&&b.setData(m)},addLocalFile:function(h,m,b,D){if(o.fs.existsSync(h)){m=m?l(m):"";let C=We.win32.basename(We.win32.normalize(h));m+=b||C;let E=o.fs.statSync(h),g=E.isFile()?o.fs.readFileSync(h):Buffer.alloc(0);E.isDirectory()&&(m+=o.sep),this.addFile(m,g,D,E)}else throw qe.Errors.FILE_NOT_FOUND(h)},addLocalFileAsync:function(h,m){h=typeof h=="object"?h:{localPath:h};let b=We.resolve(h.localPath),{comment:D}=h,{zipPath:C,zipName:E}=h,g=this;o.fs.stat(b,function(_,S){if(_)return m(_,!1);C=C?l(C):"";let T=We.win32.basename(We.win32.normalize(b));if(C+=E||T,S.isFile())o.fs.readFile(b,function(O,B){return O?m(O,!1):(g.addFile(C,B,D,S),setImmediate(m,void 0,!0))});else if(S.isDirectory())return C+=o.sep,g.addFile(C,Buffer.alloc(0),D,S),setImmediate(m,void 0,!0)})},addLocalFolder:function(h,m,b){if(b=f(b),m=m?l(m):"",h=We.normalize(h),o.fs.existsSync(h)){let D=o.findFiles(h),C=this;if(D.length)for(let E of D){let g=We.join(m,d(h,E));b(g)&&C.addLocalFile(E,We.dirname(g))}}else throw qe.Errors.FILE_NOT_FOUND(h)},addLocalFolderAsync:function(h,m,b,D){D=f(D),b=b?l(b):"",h=We.normalize(h);var C=this;o.fs.open(h,"r",function(E){if(E&&E.code==="ENOENT")m(void 0,qe.Errors.FILE_NOT_FOUND(h));else if(E)m(void 0,E);else{var g=o.findFiles(h),_=-1,S=function(){if(_+=1,_<g.length){var T=g[_],O=d(h,T).split("\\").join("/");O=O.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),D(O)?o.fs.stat(T,function(B,R){B&&m(void 0,B),R.isFile()?o.fs.readFile(T,function(N,A){N?m(void 0,N):(C.addFile(b+O,A,"",R),S())}):(C.addFile(b+O+"/",Buffer.alloc(0),"",R),S())}):process.nextTick(()=>{S()})}else m(!0,void 0)};S()}})},addLocalFolderAsync2:function(h,m){let b=this;h=typeof h=="object"?h:{localPath:h},localPath=We.resolve(l(h.localPath));let{zipPath:D,filter:C,namefix:E}=h;C instanceof RegExp?C=(function(S){return function(T){return S.test(T)}})(C):typeof C!="function"&&(C=function(){return!0}),D=D?l(D):"",E=="latin1"&&(E=S=>S.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,"")),typeof E!="function"&&(E=S=>S);let g=S=>We.join(D,E(d(localPath,S))),_=S=>We.win32.basename(We.win32.normalize(E(S)));o.fs.open(localPath,"r",function(S){S&&S.code==="ENOENT"?m(void 0,qe.Errors.FILE_NOT_FOUND(localPath)):S?m(void 0,S):o.findFilesAsync(localPath,function(T,O){if(T)return m(T);O=O.filter(B=>C(g(B))),O.length||m(void 0,!1),setImmediate(O.reverse().reduce(function(B,R){return function(N,A){if(N||A===!1)return setImmediate(B,N,!1);b.addLocalFileAsync({localPath:R,zipPath:We.dirname(g(R)),zipName:_(R)},B)}},m))})})},addLocalFolderPromise:function(h,m){return new Promise((b,D)=>{this.addLocalFolderAsync2(Object.assign({localPath:h},m),(C,E)=>{C&&D(C),E&&b(this)})})},addFile:function(h,m,b,D){h=u(h);let C=c(h),E=C!=null;E||(C=new I3(n),C.entryName=h),C.comment=b||"";let g=typeof D=="object"&&D instanceof o.fs.Stats;g&&(C.header.time=D.mtime);var _=C.isDirectory?16:0;let S=C.isDirectory?16384:32768;return g?S|=4095&D.mode:typeof D=="number"?S|=4095&D:S|=C.isDirectory?493:420,_=(_|S<<16)>>>0,C.attr=_,C.setData(m),E||i.setEntry(C),C},getEntries:function(h){return i.password=h,i?i.entries:[]},getEntry:function(h){return c(h)},getEntryCount:function(){return i.getEntryCount()},forEach:function(h){return i.forEach(h)},extractEntryTo:function(h,m,b,D,C,E){D=Gn(!1,D),C=Gn(!1,C),b=Gn(!0,b),E=R0(C,E);var g=c(h);if(!g)throw qe.Errors.NO_ENTRY();var _=a(g.entryName),S=s(m,E&&!g.isDirectory?E:b?_:We.basename(_));if(g.isDirectory){var T=i.getEntryChildren(g);return T.forEach(function(R){if(R.isDirectory)return;var N=R.getData();if(!N)throw qe.Errors.CANT_EXTRACT_FILE();var A=a(R.entryName),U=s(m,b?A:We.basename(A));let M=C?R.header.fileAttr:void 0;o.writeFileTo(U,N,D,M)}),!0}var O=g.getData(i.password);if(!O)throw qe.Errors.CANT_EXTRACT_FILE();if(o.fs.existsSync(S)&&!D)throw qe.Errors.CANT_OVERRIDE();let B=C?h.header.fileAttr:void 0;return o.writeFileTo(S,O,D,B),!0},test:function(h){if(!i)return!1;for(var m in i.entries)try{if(m.isDirectory)continue;var b=i.entries[m].getData(h);if(!b)return!1}catch{return!1}return!0},extractAllTo:function(h,m,b,D){if(b=Gn(!1,b),D=R0(b,D),m=Gn(!1,m),!i)throw qe.Errors.NO_ZIP();i.entries.forEach(function(C){var E=s(h,a(C.entryName));if(C.isDirectory){o.makeDir(E);return}var g=C.getData(D);if(!g)throw qe.Errors.CANT_EXTRACT_FILE();let _=b?C.header.fileAttr:void 0;o.writeFileTo(E,g,m,_);try{o.fs.utimesSync(E,C.header.time,C.header.time)}catch{throw qe.Errors.CANT_EXTRACT_FILE()}})},extractAllToAsync:function(h,m,b,D){if(D=B3(m,b,D),b=Gn(!1,b),m=Gn(!1,m),!D)return new Promise((S,T)=>{this.extractAllToAsync(h,m,b,function(O){O?T(O):S(this)})});if(!i){D(qe.Errors.NO_ZIP());return}h=We.resolve(h);let C=S=>s(h,We.normalize(a(S.entryName))),E=(S,T)=>new Error(S+': "'+T+'"'),g=[],_=[];i.entries.forEach(S=>{S.isDirectory?g.push(S):_.push(S)});for(let S of g){let T=C(S),O=b?S.header.fileAttr:void 0;try{o.makeDir(T),O&&o.fs.chmodSync(T,O),o.fs.utimesSync(T,S.header.time,S.header.time)}catch{D(E("Unable to create folder",T))}}_.reverse().reduce(function(S,T){return function(O){if(O)S(O);else{let B=We.normalize(a(T.entryName)),R=s(h,B);T.getDataAsync(function(N,A){if(A)S(A);else if(!N)S(qe.Errors.CANT_EXTRACT_FILE());else{let U=b?T.header.fileAttr:void 0;o.writeFileToAsync(R,N,m,U,function(M){M||S(E("Unable to write file",R)),o.fs.utimes(R,T.header.time,T.header.time,function(Q){Q?S(E("Unable to set times",R)):S()})})}})}}},D)()},writeZip:function(h,m){if(arguments.length===1&&typeof h=="function"&&(m=h,h=""),!h&&n.filename&&(h=n.filename),!!h){var b=i.compressToBuffer();if(b){var D=o.writeFileTo(h,b,!0);typeof m=="function"&&m(D?null:new Error("failed"),"")}}},writeZipPromise:function(h,m){let{overwrite:b,perm:D}=Object.assign({overwrite:!0},m);return new Promise((C,E)=>{!h&&n.filename&&(h=n.filename),h||E("ADM-ZIP: ZIP File Name Missing"),this.toBufferPromise().then(g=>{let _=S=>S?C(S):E("ADM-ZIP: Wasn't able to write zip file");o.writeFileToAsync(h,g,b,D,_)},E)})},toBufferPromise:function(){return new Promise((h,m)=>{i.toAsyncBuffer(h,m)})},toBuffer:function(h,m,b,D){return typeof h=="function"?(i.toAsyncBuffer(h,m,b,D),null):i.compressToBuffer()}}}});var M0=x((gV,U0)=>{var L0={};U0.exports=L0;var N0={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(N0).forEach(function(t){var e=N0[t],r=L0[t]=[];r.open="\x1B["+e[0]+"m",r.close="\x1B["+e[1]+"m"})});var H0=x((DV,q0)=>{"use strict";q0.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 z0=x((yV,V0)=>{"use strict";var N3=require("os"),wr=H0(),Ot=process.env,Zo=void 0;wr("no-color")||wr("no-colors")||wr("color=false")?Zo=!1:(wr("color")||wr("colors")||wr("color=true")||wr("color=always"))&&(Zo=!0);"FORCE_COLOR"in Ot&&(Zo=Ot.FORCE_COLOR.length===0||parseInt(Ot.FORCE_COLOR,10)!==0);function L3(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function U3(t){if(Zo===!1)return 0;if(wr("color=16m")||wr("color=full")||wr("color=truecolor"))return 3;if(wr("color=256"))return 2;if(t&&!t.isTTY&&Zo!==!0)return 0;var e=Zo?1:0;if(process.platform==="win32"){var r=N3.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in Ot)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(o){return o in Ot})||Ot.CI_NAME==="codeship"?1:e;if("TEAMCITY_VERSION"in Ot)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Ot.TEAMCITY_VERSION)?1:0;if("TERM_PROGRAM"in Ot){var n=parseInt((Ot.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Ot.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Ot.TERM)?2:/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(Ot.TERM)||"COLORTERM"in Ot?1:(Ot.TERM==="dumb",e)}function xd(t){var e=U3(t);return L3(e)}V0.exports={supportsColor:xd,stdout:xd(process.stdout),stderr:xd(process.stderr)}});var W0=x((bV,G0)=>{G0.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 Y0=x((vV,K0)=>{K0.exports=function(e,r){e=e||" he is here ";var n={up:["\u030D","\u030E","\u0304","\u0305","\u033F","\u0311","\u0306","\u0310","\u0352","\u0357","\u0351","\u0307","\u0308","\u030A","\u0342","\u0313","\u0308","\u034A","\u034B","\u034C","\u0303","\u0302","\u030C","\u0350","\u0300","\u0301","\u030B","\u030F","\u0312","\u0313","\u0314","\u033D","\u0309","\u0363","\u0364","\u0365","\u0366","\u0367","\u0368","\u0369","\u036A","\u036B","\u036C","\u036D","\u036E","\u036F","\u033E","\u035B","\u0346","\u031A"],down:["\u0316","\u0317","\u0318","\u0319","\u031C","\u031D","\u031E","\u031F","\u0320","\u0324","\u0325","\u0326","\u0329","\u032A","\u032B","\u032C","\u032D","\u032E","\u032F","\u0330","\u0331","\u0332","\u0333","\u0339","\u033A","\u033B","\u033C","\u0345","\u0347","\u0348","\u0349","\u034D","\u034E","\u0353","\u0354","\u0355","\u0356","\u0359","\u035A","\u0323"],mid:["\u0315","\u031B","\u0300","\u0301","\u0358","\u0321","\u0322","\u0327","\u0328","\u0334","\u0335","\u0336","\u035C","\u035D","\u035E","\u035F","\u0360","\u0362","\u0338","\u0337","\u0361"," \u0489"]},o=[].concat(n.up,n.down,n.mid);function i(u){var c=Math.floor(Math.random()*u);return c}function a(u){var c=!1;return o.filter(function(l){c=l===u}),c}function s(u,c){var l="",f,d;c=c||{},c.up=typeof c.up<"u"?c.up:!0,c.mid=typeof c.mid<"u"?c.mid:!0,c.down=typeof c.down<"u"?c.down:!0,c.size=typeof c.size<"u"?c.size:"maxi",u=u.split("");for(d in u)if(!a(d)){switch(l=l+u[d],f={up:0,down:0,mid:0},c.size){case"mini":f.up=i(8),f.mid=i(2),f.down=i(8);break;case"maxi":f.up=i(16)+3,f.mid=i(4)+1,f.down=i(64)+3;break;default:f.up=i(8)+1,f.mid=i(6)/2,f.down=i(8)+1;break}var h=["up","mid","down"];for(var m in h)for(var b=h[m],D=0;D<=f[b];D++)c[b]&&(l=l+n[b][i(n[b].length)])}return l}return s(e,r)}});var X0=x((wV,J0)=>{J0.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 Q0=x((CV,Z0)=>{Z0.exports=function(t){return function(e,r,n){return r%2===0?e:t.inverse(e)}}});var tb=x((EV,eb)=>{eb.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 nb=x((_V,rb)=>{rb.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 cb=x((SV,ub)=>{var ce={};ub.exports=ce;ce.themes={};var M3=require("util"),Wn=ce.styles=M0(),ib=Object.defineProperties,q3=new RegExp(/[\r\n]+/g);ce.supportsColor=z0().supportsColor;typeof ce.enabled>"u"&&(ce.enabled=ce.supportsColor()!==!1);ce.enable=function(){ce.enabled=!0};ce.disable=function(){ce.enabled=!1};ce.stripColors=ce.strip=function(t){return(""+t).replace(/\x1B\[\d+m/g,"")};var xV=ce.stylize=function(e,r){if(!ce.enabled)return e+"";var n=Wn[r];return!n&&r in ce?ce[r](e):n.open+e+n.close},H3=/[|\\{}()[\]^$+*?.]/g,V3=function(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(H3,"\\$&")};function ab(t){var e=function r(){return G3.apply(r,arguments)};return e._styles=t,e.__proto__=z3,e}var sb=(function(){var t={};return Wn.grey=Wn.gray,Object.keys(Wn).forEach(function(e){Wn[e].closeRe=new RegExp(V3(Wn[e].close),"g"),t[e]={get:function(){return ab(this._styles.concat(e))}}}),t})(),z3=ib(function(){},sb);function G3(){var t=Array.prototype.slice.call(arguments),e=t.map(function(a){return a!=null&&a.constructor===String?a:M3.inspect(a)}).join(" ");if(!ce.enabled||!e)return e;for(var r=e.indexOf(`
28
+ `)!=-1,n=this._styles,o=n.length;o--;){var i=Wn[n[o]];e=i.open+e.replace(i.closeRe,i.open)+i.close,r&&(e=e.replace(q3,function(a){return i.close+a+i.open}))}return e}ce.setTheme=function(t){if(typeof t=="string"){console.log("colors.setTheme now only accepts an object, not a string. If you are trying to set a theme from a file, it is now your (the caller's) responsibility to require the file. The old syntax looked like colors.setTheme(__dirname + '/../themes/generic-logging.js'); The new syntax looks like colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));");return}for(var e in t)(function(r){ce[r]=function(n){if(typeof t[r]=="object"){var o=n;for(var i in t[r])o=ce[t[r][i]](o);return o}return ce[t[r]](n)}})(e)};function W3(){var t={};return Object.keys(sb).forEach(function(e){t[e]={get:function(){return ab([e])}}}),t}var K3=function(e,r){var n=r.split("");return n=n.map(e),n.join("")};ce.trap=W0();ce.zalgo=Y0();ce.maps={};ce.maps.america=X0()(ce);ce.maps.zebra=Q0()(ce);ce.maps.rainbow=tb()(ce);ce.maps.random=nb()(ce);for(ob in ce.maps)(function(t){ce[t]=function(e){return K3(ce.maps[t],e)}})(ob);var ob;ib(ce,W3())});var fb=x((FV,lb)=>{var Y3=cb();lb.exports=Y3});var pb=x(Sd=>{"use strict";Sd.indent=function(e){return new Array(e+1).join(" ")};Sd.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 db=x((OV,J3)=>{J3.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 hb=x($a=>{"use strict";var Sr=fb(),yn=pb(),X3=/[^\w\s\n\r\v\t\.,]/i;$a.version=db().version;var Fd=function(t,e){return t!==void 0||e.renderUndefined},Bu=function(t,e,r){return!!(typeof t=="boolean"||typeof t=="number"||typeof t=="function"||t===null||t===void 0||t instanceof Date||typeof t=="string"&&t.indexOf(`
29
+ `)===-1||r.inlineArrays&&!e&&Array.isArray(t)&&Bu(t[0],!0,r))},Z3=function(t,e){if(e.noColor)return t;if(typeof t=="string")return e.stringColor?Sr[e.stringColor](t):t;var r=t+"";return t===!0?Sr.green(r):t===!1?Sr.red(r):t==null?Sr.grey(r):typeof t=="number"?t>=0?Sr[e.positiveNumberColor](r):Sr[e.negativeNumberColor](r):typeof t=="function"?"function() {}":Array.isArray(t)?t.join(", "):r},Ad=function(t,e){return t.multilineStringColor===null||t.noColor?e:Sr[t.multilineStringColor](e)},Q3=function(t,e,r){var n=t.split(`
30
+ `);return n=n.map(function(o){return yn.indent(e)+Ad(r,o)}),n.join(`
31
+ `)},Qo=function(t,e,r){if(typeof t=="string"&&t.match(X3)&&e.escape&&(t=JSON.stringify(t)),!Fd(t,e))return[];if(Bu(t,!1,e))return[yn.indent(r)+Z3(t,e)];if(typeof t=="string")return[yn.indent(r)+Ad(e,'"""'),Q3(t,r+e.defaultIndentation,e),yn.indent(r)+Ad(e,'"""')];if(Array.isArray(t)){if(t.length===0)return[yn.indent(r)+e.emptyArrayMsg];var n=[];return t.forEach(function(s){if(Fd(s,e)){var u="- ";e.noColor||(u=Sr[e.dashColor](u)),u=yn.indent(r)+u,Bu(s,!1,e)?(u+=Qo(s,e,0)[0],n.push(u)):(n.push(u),n.push.apply(n,Qo(s,e,r+e.defaultIndentation)))}}),n}if(t instanceof Error)return Qo({message:t.message,stack:t.stack.split(`
32
+ `)},e,r);var o=e.noAlign?0:yn.getMaxIndexLength(t),i,a=[];return Object.getOwnPropertyNames(t).forEach(function(s){if(Fd(t[s],e))if(i=s+": ",e.noColor||(i=Sr[e.keysColor](i)),i=yn.indent(r)+i,Bu(t[s],!1,e)){var u=e.noAlign?0:o-s.length;i+=Qo(t[s],e,u)[0],a.push(i)}else a.push(i),a.push.apply(a,Qo(t[s],e,r+e.defaultIndentation))}),a};$a.render=function(e,r,n){return n=n||0,r=r||{},r.emptyArrayMsg=r.emptyArrayMsg||"(empty array)",r.keysColor=r.keysColor||"green",r.dashColor=r.dashColor||"green",r.numberColor=r.numberColor||"blue",r.positiveNumberColor=r.positiveNumberColor||r.numberColor,r.negativeNumberColor=r.negativeNumberColor||r.numberColor,r.defaultIndentation=r.defaultIndentation||2,r.noColor=!!r.noColor,r.noAlign=!!r.noAlign,r.escape=!!r.escape,r.renderUndefined=!!r.renderUndefined,r.stringColor=r.stringColor||null,r.multilineStringColor=r.multilineStringColor||null,Qo(e,r,n).join(`
33
+ `)};$a.renderString=function(e,r,n){var o="",i;if(typeof e!="string"||e==="")return"";if(e[0]!=="{"&&e[0]!=="["){var a;e.indexOf("{")===-1?a=e.indexOf("["):e.indexOf("[")===-1||e.indexOf("{")<e.indexOf("[")?a=e.indexOf("{"):a=e.indexOf("["),o+=e.substr(0,a)+`
34
+ `,e=e.substr(a)}try{i=JSON.parse(e)}catch{return Sr.red("Error:")+" Not valid JSON!"}return o+=$a.render(i,r,n),o}});var $d=x(ju=>{"use strict";Object.defineProperty(ju,"__esModule",{value:!0});ju.default=void 0;function ei(t){"@babel/helpers - typeof";return ei=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ei(t)}function mb(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,t$(n.key),n)}}function e$(t,e,r){return e&&mb(t.prototype,e),r&&mb(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function t$(t){var e=r$(t,"string");return ei(e)=="symbol"?e:e+""}function r$(t,e){if(ei(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ei(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function n$(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o$(t,e,r){return e=Ta(e),i$(t,kd()?Reflect.construct(e,r||[],Ta(t).constructor):e.apply(t,r))}function i$(t,e){if(e&&(ei(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return a$(t)}function a$(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function s$(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Pa(t,e)}function Od(t){var e=typeof Map=="function"?new Map:void 0;return Od=function(n){if(n===null||!c$(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 u$(n,arguments,Ta(this).constructor)}return o.prototype=Object.create(n.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),Pa(o,n)},Od(t)}function u$(t,e,r){if(kd())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var o=new(t.bind.apply(t,n));return r&&Pa(o,r.prototype),o}function kd(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(kd=function(){return!!t})()}function c$(t){try{return Function.toString.call(t).indexOf("[native code]")!==-1}catch{return typeof t=="function"}}function Pa(t,e){return Pa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Pa(t,e)}function Ta(t){return Ta=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Ta(t)}var l$=(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(n$(this,e),n=o$(this,e,[r]),n.originalRequest=i,n.originalResponse=a,n.causingError=o,o!=null&&(r+=", caused by ".concat(o.toString())),i!=null){var s=i.getHeader("X-Request-ID")||"n/a",u=i.getMethod(),c=i.getURL(),l=a?a.getStatus():"n/a",f=a?a.getBody()||"":"n/a";r+=", originated from request (method: ".concat(u,", url: ").concat(c,", response code: ").concat(l,", response text: ").concat(f,", request id: ").concat(s,")")}return n.message=r,n}return s$(e,t),e$(e)})(Od(Error)),$V=ju.default=l$});var Pd=x(Nu=>{"use strict";Object.defineProperty(Nu,"__esModule",{value:!0});Nu.enableDebugLog=f$;Nu.log=p$;var gb=!1;function f$(){gb=!0}function p$(t){gb&&console.log(t)}});var yb=x(Lu=>{"use strict";Object.defineProperty(Lu,"__esModule",{value:!0});Lu.default=void 0;function Ia(t){"@babel/helpers - typeof";return Ia=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ia(t)}function d$(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Db(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,m$(n.key),n)}}function h$(t,e,r){return e&&Db(t.prototype,e),r&&Db(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function m$(t){var e=g$(t,"string");return Ia(e)=="symbol"?e:e+""}function g$(t,e){if(Ia(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Ia(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var IV=Lu.default=(function(){function t(){d$(this,t)}return h$(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 bb=x((Td,Id)=>{(function(t,e){typeof Td=="object"&&typeof Id<"u"?Id.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:Td,function(){"use strict";var t="3.7.8",e=t,r=typeof Buffer=="function",n=typeof TextDecoder=="function"?new TextDecoder:void 0,o=typeof TextEncoder=="function"?new TextEncoder:void 0,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=Array.prototype.slice.call(i),s=(function(P){var j={};return P.forEach(function(ee,V){return j[ee]=V}),j})(a),u=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,c=String.fromCharCode.bind(String),l=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):function(P){return new Uint8Array(Array.prototype.slice.call(P,0))},f=function(P){return P.replace(/=/g,"").replace(/[+\/]/g,function(j){return j=="+"?"-":"_"})},d=function(P){return P.replace(/[^A-Za-z0-9\+\/]/g,"")},h=function(P){for(var j,ee,V,se,dr="",z=P.length%3,Ce=0;Ce<P.length;){if((ee=P.charCodeAt(Ce++))>255||(V=P.charCodeAt(Ce++))>255||(se=P.charCodeAt(Ce++))>255)throw new TypeError("invalid character found");j=ee<<16|V<<8|se,dr+=a[j>>18&63]+a[j>>12&63]+a[j>>6&63]+a[j&63]}return z?dr.slice(0,z-3)+"===".substring(z):dr},m=typeof btoa=="function"?function(P){return btoa(P)}:r?function(P){return Buffer.from(P,"binary").toString("base64")}:h,b=r?function(P){return Buffer.from(P).toString("base64")}:function(P){for(var j=4096,ee=[],V=0,se=P.length;V<se;V+=j)ee.push(c.apply(null,P.subarray(V,V+j)));return m(ee.join(""))},D=function(P,j){return j===void 0&&(j=!1),j?f(b(P)):b(P)},C=function(P){if(P.length<2){var j=P.charCodeAt(0);return j<128?P:j<2048?c(192|j>>>6)+c(128|j&63):c(224|j>>>12&15)+c(128|j>>>6&63)+c(128|j&63)}else{var j=65536+(P.charCodeAt(0)-55296)*1024+(P.charCodeAt(1)-56320);return c(240|j>>>18&7)+c(128|j>>>12&63)+c(128|j>>>6&63)+c(128|j&63)}},E=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,g=function(P){return P.replace(E,C)},_=r?function(P){return Buffer.from(P,"utf8").toString("base64")}:o?function(P){return b(o.encode(P))}:function(P){return m(g(P))},S=function(P,j){return j===void 0&&(j=!1),j?f(_(P)):_(P)},T=function(P){return S(P,!0)},O=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,B=function(P){switch(P.length){case 4:var j=(7&P.charCodeAt(0))<<18|(63&P.charCodeAt(1))<<12|(63&P.charCodeAt(2))<<6|63&P.charCodeAt(3),ee=j-65536;return c((ee>>>10)+55296)+c((ee&1023)+56320);case 3:return c((15&P.charCodeAt(0))<<12|(63&P.charCodeAt(1))<<6|63&P.charCodeAt(2));default:return c((31&P.charCodeAt(0))<<6|63&P.charCodeAt(1))}},R=function(P){return P.replace(O,B)},N=function(P){if(P=P.replace(/\s+/g,""),!u.test(P))throw new TypeError("malformed base64.");P+="==".slice(2-(P.length&3));for(var j,ee,V,se=[],dr=0;dr<P.length;)j=s[P.charAt(dr++)]<<18|s[P.charAt(dr++)]<<12|(ee=s[P.charAt(dr++)])<<6|(V=s[P.charAt(dr++)]),ee===64?se.push(c(j>>16&255)):V===64?se.push(c(j>>16&255,j>>8&255)):se.push(c(j>>16&255,j>>8&255,j&255));return se.join("")},A=typeof atob=="function"?function(P){return atob(d(P))}:r?function(P){return Buffer.from(P,"base64").toString("binary")}:N,U=r?function(P){return l(Buffer.from(P,"base64"))}:function(P){return l(A(P).split("").map(function(j){return j.charCodeAt(0)}))},M=function(P){return U($(P))},Q=r?function(P){return Buffer.from(P,"base64").toString("utf8")}:n?function(P){return n.decode(U(P))}:function(P){return R(A(P))},$=function(P){return d(P.replace(/[-_]/g,function(j){return j=="-"?"+":"/"}))},y=function(P){return Q($(P))},v=function(P){if(typeof P!="string")return!1;var j=P.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(j)||!/[^\s0-9a-zA-Z\-_]/.test(j)},w=function(P){return{value:P,enumerable:!1,writable:!0,configurable:!0}},F=function(){var P=function(j,ee){return Object.defineProperty(String.prototype,j,w(ee))};P("fromBase64",function(){return y(this)}),P("toBase64",function(j){return S(this,j)}),P("toBase64URI",function(){return S(this,!0)}),P("toBase64URL",function(){return S(this,!0)}),P("toUint8Array",function(){return M(this)})},I=function(){var P=function(j,ee){return Object.defineProperty(Uint8Array.prototype,j,w(ee))};P("toBase64",function(j){return D(this,j)}),P("toBase64URI",function(){return D(this,!0)}),P("toBase64URL",function(){return D(this,!0)})},k=function(){F(),I()},q={version:t,VERSION:e,atob:A,atobPolyfill:N,btoa:m,btoaPolyfill:h,fromBase64:y,toBase64:S,encode:S,encodeURI:T,encodeURL:T,utob:g,btou:R,decode:y,isValid:v,fromUint8Array:D,toUint8Array:M,extendString:F,extendUint8Array:I,extendBuiltins:k};return q.Base64={},Object.keys(q).forEach(function(P){return q.Base64[P]=q[P]}),q})});var wb=x((BV,vb)=>{"use strict";vb.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 _b=x(Rd=>{"use strict";var D$=Object.prototype.hasOwnProperty,y$;function Cb(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch{return null}}function Eb(t){try{return encodeURIComponent(t)}catch{return null}}function b$(t){for(var e=/([^=?#&]+)=?([^&]*)/g,r={},n;n=e.exec(t);){var o=Cb(n[1]),i=Cb(n[2]);o===null||i===null||o in r||(r[o]=i)}return r}function v$(t,e){e=e||"";var r=[],n,o;typeof e!="string"&&(e="?");for(o in t)if(D$.call(t,o)){if(n=t[o],!n&&(n===null||n===y$||isNaN(n))&&(n=""),o=Eb(o),n=Eb(n),o===null||n===null)continue;r.push(o+"="+n)}return r.length?e+r.join("&"):""}Rd.stringify=v$;Rd.parse=b$});var Pb=x((NV,$b)=>{"use strict";var Sb=wb(),Uu=_b(),w$=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,Fb=/[\n\r\t]/g,C$=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,Ab=/:\d+$/,E$=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,_$=/^[a-zA-Z]:/;function jd(t){return(t||"").toString().replace(w$,"")}var Bd=[["#","hash"],["?","query"],function(e,r){return Fr(r.protocol)?e.replace(/\\/g,"/"):e},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],xb={hash:1,query:1};function Ob(t){var e;typeof window<"u"?e=window:typeof global<"u"?e=global:typeof self<"u"?e=self:e={};var r=e.location||{};t=t||r;var n={},o=typeof t,i;if(t.protocol==="blob:")n=new Ar(unescape(t.pathname),{});else if(o==="string"){n=new Ar(t,{});for(i in xb)delete n[i]}else if(o==="object"){for(i in t)i in xb||(n[i]=t[i]);n.slashes===void 0&&(n.slashes=C$.test(t.href))}return n}function Fr(t){return t==="file:"||t==="ftp:"||t==="http:"||t==="https:"||t==="ws:"||t==="wss:"}function kb(t,e){t=jd(t),t=t.replace(Fb,""),e=e||{};var r=E$.exec(t),n=r[1]?r[1].toLowerCase():"",o=!!r[2],i=!!r[3],a=0,s;return o?i?(s=r[2]+r[3]+r[4],a=r[2].length+r[3].length):(s=r[2]+r[4],a=r[2].length):i?(s=r[3]+r[4],a=r[3].length):s=r[4],n==="file:"?a>=2&&(s=s.slice(2)):Fr(n)?s=r[4]:n?o&&(s=s.slice(2)):a>=2&&Fr(e.protocol)&&(s=r[4]),{protocol:n,slashes:o||Fr(n),slashesCount:a,rest:s}}function x$(t,e){if(t==="")return e;for(var r=(e||"/").split("/").slice(0,-1).concat(t.split("/")),n=r.length,o=r[n-1],i=!1,a=0;n--;)r[n]==="."?r.splice(n,1):r[n]===".."?(r.splice(n,1),a++):a&&(n===0&&(i=!0),r.splice(n,1),a--);return i&&r.unshift(""),(o==="."||o==="..")&&r.push(""),r.join("/")}function Ar(t,e,r){if(t=jd(t),t=t.replace(Fb,""),!(this instanceof Ar))return new Ar(t,e,r);var n,o,i,a,s,u,c=Bd.slice(),l=typeof e,f=this,d=0;for(l!=="object"&&l!=="string"&&(r=e,e=null),r&&typeof r!="function"&&(r=Uu.parse),e=Ob(e),o=kb(t||"",e),n=!o.protocol&&!o.slashes,f.slashes=o.slashes||n&&e.slashes,f.protocol=o.protocol||e.protocol||"",t=o.rest,(o.protocol==="file:"&&(o.slashesCount!==2||_$.test(t))||!o.slashes&&(o.protocol||o.slashesCount<2||!Fr(f.protocol)))&&(c[3]=[/(.*)/,"pathname"]);d<c.length;d++){if(a=c[d],typeof a=="function"){t=a(t,f);continue}i=a[0],u=a[1],i!==i?f[u]=t:typeof i=="string"?(s=i==="@"?t.lastIndexOf(i):t.indexOf(i),~s&&(typeof a[2]=="number"?(f[u]=t.slice(0,s),t=t.slice(s+a[2])):(f[u]=t.slice(s),t=t.slice(0,s)))):(s=i.exec(t))&&(f[u]=s[1],t=t.slice(0,s.index)),f[u]=f[u]||n&&a[3]&&e[u]||"",a[4]&&(f[u]=f[u].toLowerCase())}r&&(f.query=r(f.query)),n&&e.slashes&&f.pathname.charAt(0)!=="/"&&(f.pathname!==""||e.pathname!=="")&&(f.pathname=x$(f.pathname,e.pathname)),f.pathname.charAt(0)!=="/"&&Fr(f.protocol)&&(f.pathname="/"+f.pathname),Sb(f.port,f.protocol)||(f.host=f.hostname,f.port=""),f.username=f.password="",f.auth&&(s=f.auth.indexOf(":"),~s?(f.username=f.auth.slice(0,s),f.username=encodeURIComponent(decodeURIComponent(f.username)),f.password=f.auth.slice(s+1),f.password=encodeURIComponent(decodeURIComponent(f.password))):f.username=encodeURIComponent(decodeURIComponent(f.auth)),f.auth=f.password?f.username+":"+f.password:f.username),f.origin=f.protocol!=="file:"&&Fr(f.protocol)&&f.host?f.protocol+"//"+f.host:"null",f.href=f.toString()}function S$(t,e,r){var n=this;switch(t){case"query":typeof e=="string"&&e.length&&(e=(r||Uu.parse)(e)),n[t]=e;break;case"port":n[t]=e,Sb(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,Ab.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<Bd.length;a++){var s=Bd[a];s[4]&&(n[s[1]]=n[s[1]].toLowerCase())}return n.auth=n.password?n.username+":"+n.password:n.username,n.origin=n.protocol!=="file:"&&Fr(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function F$(t){(!t||typeof t!="function")&&(t=Uu.stringify);var e,r=this,n=r.host,o=r.protocol;o&&o.charAt(o.length-1)!==":"&&(o+=":");var i=o+(r.protocol&&r.slashes||Fr(r.protocol)?"//":"");return r.username?(i+=r.username,r.password&&(i+=":"+r.password),i+="@"):r.password?(i+=":"+r.password,i+="@"):r.protocol!=="file:"&&Fr(r.protocol)&&!n&&r.pathname!=="/"&&(i+="@"),(n[n.length-1]===":"||Ab.test(r.hostname)&&!r.port)&&(n+=":"),i+=n+r.pathname,e=typeof r.query=="object"?t(r.query):r.query,e&&(i+=e.charAt(0)!=="?"?"?"+e:e),r.hash&&(i+=r.hash),i}Ar.prototype={set:S$,toString:F$};Ar.extractProtocol=kb;Ar.location=Ob;Ar.trimLeft=jd;Ar.qs=Uu;$b.exports=Ar});var Tb=x(Nd=>{"use strict";Object.defineProperty(Nd,"__esModule",{value:!0});Nd.default=A$;function A$(){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 Kb=x(Vu=>{"use strict";Object.defineProperty(Vu,"__esModule",{value:!0});Vu.default=void 0;var O$=bb(),k$=Md(Pb()),Mu=Md($d()),Kn=Pd(),$$=Md(Tb());function Md(t){return t&&t.__esModule?t:{default:t}}function Ld(){"use strict";Ld=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(y,v,w){y[v]=w.value},i=typeof Symbol=="function"?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(y,v,w){return Object.defineProperty(y,v,{value:w,enumerable:!0,configurable:!0,writable:!0}),y[v]}try{c({},"")}catch{c=function(w,F,I){return w[F]=I}}function l(y,v,w,F){var I=v&&v.prototype instanceof C?v:C,k=Object.create(I.prototype),q=new Q(F||[]);return o(k,"_invoke",{value:N(y,w,q)}),k}function f(y,v,w){try{return{type:"normal",arg:y.call(v,w)}}catch(F){return{type:"throw",arg:F}}}e.wrap=l;var d="suspendedStart",h="suspendedYield",m="executing",b="completed",D={};function C(){}function E(){}function g(){}var _={};c(_,a,function(){return this});var S=Object.getPrototypeOf,T=S&&S(S($([])));T&&T!==r&&n.call(T,a)&&(_=T);var O=g.prototype=C.prototype=Object.create(_);function B(y){["next","throw","return"].forEach(function(v){c(y,v,function(w){return this._invoke(v,w)})})}function R(y,v){function w(I,k,q,P){var j=f(y[I],y,k);if(j.type!=="throw"){var ee=j.arg,V=ee.value;return V&&Yn(V)=="object"&&n.call(V,"__await")?v.resolve(V.__await).then(function(se){w("next",se,q,P)},function(se){w("throw",se,q,P)}):v.resolve(V).then(function(se){ee.value=se,q(ee)},function(se){return w("throw",se,q,P)})}P(j.arg)}var F;o(this,"_invoke",{value:function(k,q){function P(){return new v(function(j,ee){w(k,q,j,ee)})}return F=F?F.then(P,P):P()}})}function N(y,v,w){var F=d;return function(I,k){if(F===m)throw Error("Generator is already running");if(F===b){if(I==="throw")throw k;return{value:t,done:!0}}for(w.method=I,w.arg=k;;){var q=w.delegate;if(q){var P=A(q,w);if(P){if(P===D)continue;return P}}if(w.method==="next")w.sent=w._sent=w.arg;else if(w.method==="throw"){if(F===d)throw F=b,w.arg;w.dispatchException(w.arg)}else w.method==="return"&&w.abrupt("return",w.arg);F=m;var j=f(y,v,w);if(j.type==="normal"){if(F=w.done?b:h,j.arg===D)continue;return{value:j.arg,done:w.done}}j.type==="throw"&&(F=b,w.method="throw",w.arg=j.arg)}}}function A(y,v){var w=v.method,F=y.iterator[w];if(F===t)return v.delegate=null,w==="throw"&&y.iterator.return&&(v.method="return",v.arg=t,A(y,v),v.method==="throw")||w!=="return"&&(v.method="throw",v.arg=new TypeError("The iterator does not provide a '"+w+"' method")),D;var I=f(F,y.iterator,v.arg);if(I.type==="throw")return v.method="throw",v.arg=I.arg,v.delegate=null,D;var k=I.arg;return k?k.done?(v[y.resultName]=k.value,v.next=y.nextLoc,v.method!=="return"&&(v.method="next",v.arg=t),v.delegate=null,D):k:(v.method="throw",v.arg=new TypeError("iterator result is not an object"),v.delegate=null,D)}function U(y){var v={tryLoc:y[0]};1 in y&&(v.catchLoc=y[1]),2 in y&&(v.finallyLoc=y[2],v.afterLoc=y[3]),this.tryEntries.push(v)}function M(y){var v=y.completion||{};v.type="normal",delete v.arg,y.completion=v}function Q(y){this.tryEntries=[{tryLoc:"root"}],y.forEach(U,this),this.reset(!0)}function $(y){if(y||y===""){var v=y[a];if(v)return v.call(y);if(typeof y.next=="function")return y;if(!isNaN(y.length)){var w=-1,F=function I(){for(;++w<y.length;)if(n.call(y,w))return I.value=y[w],I.done=!1,I;return I.value=t,I.done=!0,I};return F.next=F}}throw new TypeError(Yn(y)+" is not iterable")}return E.prototype=g,o(O,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:E,configurable:!0}),E.displayName=c(g,u,"GeneratorFunction"),e.isGeneratorFunction=function(y){var v=typeof y=="function"&&y.constructor;return!!v&&(v===E||(v.displayName||v.name)==="GeneratorFunction")},e.mark=function(y){return Object.setPrototypeOf?Object.setPrototypeOf(y,g):(y.__proto__=g,c(y,u,"GeneratorFunction")),y.prototype=Object.create(O),y},e.awrap=function(y){return{__await:y}},B(R.prototype),c(R.prototype,s,function(){return this}),e.AsyncIterator=R,e.async=function(y,v,w,F,I){I===void 0&&(I=Promise);var k=new R(l(y,v,w,F),I);return e.isGeneratorFunction(v)?k:k.next().then(function(q){return q.done?q.value:k.next()})},B(O),c(O,u,"Generator"),c(O,a,function(){return this}),c(O,"toString",function(){return"[object Generator]"}),e.keys=function(y){var v=Object(y),w=[];for(var F in v)w.push(F);return w.reverse(),function I(){for(;w.length;){var k=w.pop();if(k in v)return I.value=k,I.done=!1,I}return I.done=!0,I}},e.values=$,Q.prototype={constructor:Q,reset:function(v){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(M),!v)for(var w in this)w.charAt(0)==="t"&&n.call(this,w)&&!isNaN(+w.slice(1))&&(this[w]=t)},stop:function(){this.done=!0;var v=this.tryEntries[0].completion;if(v.type==="throw")throw v.arg;return this.rval},dispatchException:function(v){if(this.done)throw v;var w=this;function F(ee,V){return q.type="throw",q.arg=v,w.next=ee,V&&(w.method="next",w.arg=t),!!V}for(var I=this.tryEntries.length-1;I>=0;--I){var k=this.tryEntries[I],q=k.completion;if(k.tryLoc==="root")return F("end");if(k.tryLoc<=this.prev){var P=n.call(k,"catchLoc"),j=n.call(k,"finallyLoc");if(P&&j){if(this.prev<k.catchLoc)return F(k.catchLoc,!0);if(this.prev<k.finallyLoc)return F(k.finallyLoc)}else if(P){if(this.prev<k.catchLoc)return F(k.catchLoc,!0)}else{if(!j)throw Error("try statement without catch or finally");if(this.prev<k.finallyLoc)return F(k.finallyLoc)}}}},abrupt:function(v,w){for(var F=this.tryEntries.length-1;F>=0;--F){var I=this.tryEntries[F];if(I.tryLoc<=this.prev&&n.call(I,"finallyLoc")&&this.prev<I.finallyLoc){var k=I;break}}k&&(v==="break"||v==="continue")&&k.tryLoc<=w&&w<=k.finallyLoc&&(k=null);var q=k?k.completion:{};return q.type=v,q.arg=w,k?(this.method="next",this.next=k.finallyLoc,D):this.complete(q)},complete:function(v,w){if(v.type==="throw")throw v.arg;return v.type==="break"||v.type==="continue"?this.next=v.arg:v.type==="return"?(this.rval=this.arg=v.arg,this.method="return",this.next="end"):v.type==="normal"&&w&&(this.next=w),D},finish:function(v){for(var w=this.tryEntries.length-1;w>=0;--w){var F=this.tryEntries[w];if(F.finallyLoc===v)return this.complete(F.completion,F.afterLoc),M(F),D}},catch:function(v){for(var w=this.tryEntries.length-1;w>=0;--w){var F=this.tryEntries[w];if(F.tryLoc===v){var I=F.completion;if(I.type==="throw"){var k=I.arg;M(F)}return k}}throw Error("illegal catch attempt")},delegateYield:function(v,w,F){return this.delegate={iterator:$(v),resultName:w,nextLoc:F},this.method==="next"&&(this.arg=t),D}},e}function Ib(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 P$(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(u){Ib(i,n,o,a,s,"next",u)}function s(u){Ib(i,n,o,a,s,"throw",u)}a(void 0)})}}function Hb(t,e){return R$(t)||I$(t,e)||Vb(t,e)||T$()}function T$(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
35
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function I$(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,o,i,a,s=[],u=!0,c=!1;try{if(i=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(s.push(n.value),s.length!==e);u=!0);}catch(l){c=!0,o=l}finally{try{if(!u&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}function R$(t){if(Array.isArray(t))return t}function Yn(t){"@babel/helpers - typeof";return Yn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Yn(t)}function B$(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Vb(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(c){throw c},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
36
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,a=!1,s;return{s:function(){r=r.call(t)},n:function(){var c=r.next();return i=c.done,c},e:function(c){a=!0,s=c},f:function(){try{!i&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function Vb(t,e){if(t){if(typeof t=="string")return Rb(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 Rb(t,e)}}function Rb(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 Bb(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?Bb(Object(r),!0).forEach(function(n){j$(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Bb(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function j$(t,e,r){return e=zb(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function N$(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function jb(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,zb(n.key),n)}}function L$(t,e,r){return e&&jb(t.prototype,e),r&&jb(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function zb(t){var e=U$(t,"string");return Yn(e)=="symbol"?e:e+""}function U$(t,e){if(Yn(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Yn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var qu="tus-v1",Hu="ietf-draft-03",Ra="ietf-draft-05",M$={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:Wb,chunkSize:Number.POSITIVE_INFINITY,retryDelays:[0,1e3,3e3,5e3],parallelUploads:1,parallelUploadBoundaries:null,storeFingerprintForResuming:!0,removeFingerprintOnSuccess:!1,uploadLengthDeferred:!1,uploadDataDuringCreation:!1,urlStorage:null,fileReader:null,httpStack:null,protocol:qu},Gb=(function(){function t(e,r){N$(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 L$(t,[{key:"findPreviousUploads",value:function(){var r=this;return this.options.fingerprint(this.file,this.options).then(function(n){return r._urlStorage.findUploadsByFingerprint(n)})}},{key:"resumeFromPreviousUpload",value:function(r){this.url=r.uploadUrl||null,this._parallelUploadUrls=r.parallelUploadUrls||null,this._urlStorageKey=r.urlStorageKey}},{key:"start",value:function(){var r=this,n=this.file;if(!n){this._emitError(new Error("tus: no file or stream to upload provided"));return}if(![qu,Hu,Ra].includes(this.options.protocol)){this._emitError(new Error("tus: unsupported protocol ".concat(this.options.protocol)));return}if(!this.options.endpoint&&!this.options.uploadUrl&&!this.url){this._emitError(new Error("tus: neither an endpoint or an upload URL is provided"));return}var o=this.options.retryDelays;if(o!=null&&Object.prototype.toString.call(o)!=="[object Array]"){this._emitError(new Error("tus: the `retryDelays` option must either be an array or null"));return}if(this.options.parallelUploads>1)for(var i=0,a=["uploadUrl","uploadSize","uploadLengthDeferred"];i<a.length;i++){var s=a[i];if(this.options[s]){this._emitError(new Error("tus: cannot use the ".concat(s," option when parallelUploads is enabled")));return}}if(this.options.parallelUploadBoundaries){if(this.options.parallelUploads<=1){this._emitError(new Error("tus: cannot use the `parallelUploadBoundaries` option when `parallelUploads` is disabled"));return}if(this.options.parallelUploads!==this.options.parallelUploadBoundaries.length){this._emitError(new Error("tus: the `parallelUploadBoundaries` must have the same length as the value of `parallelUploads`"));return}}this.options.fingerprint(n,this.options).then(function(u){return u==null?(0,Kn.log)("No fingerprint was calculated meaning that the upload cannot be stored in the URL storage."):(0,Kn.log)("Calculated fingerprint: ".concat(u)),r._fingerprint=u,r._source?r._source:r.options.fileReader.openFile(n,r.options.chunkSize)}).then(function(u){if(r._source=u,r.options.uploadLengthDeferred)r._size=null;else if(r.options.uploadSize!=null){if(r._size=Number(r.options.uploadSize),Number.isNaN(r._size)){r._emitError(new Error("tus: cannot convert `uploadSize` option into a number"));return}}else if(r._size=r._source.size,r._size==null){r._emitError(new Error("tus: cannot automatically derive upload's size from input. Specify it manually using the `uploadSize` option or use the `uploadLengthDeferred` option"));return}r.options.parallelUploads>1||r._parallelUploadUrls!=null?r._startParallelUpload():r._startSingleUpload()}).catch(function(u){r._emitError(u)})}},{key:"_startParallelUpload",value:function(){var r,n=this,o=this._size,i=0;this._parallelUploads=[];var a=this._parallelUploadUrls!=null?this._parallelUploadUrls.length:this.options.parallelUploads,s=(r=this.options.parallelUploadBoundaries)!==null&&r!==void 0?r:H$(this._source.size,a);this._parallelUploadUrls&&s.forEach(function(l,f){l.uploadUrl=n._parallelUploadUrls[f]||null}),this._parallelUploadUrls=new Array(s.length);var u=s.map(function(l,f){var d=0;return n._source.slice(l.start,l.end).then(function(h){var m=h.value;return new Promise(function(b,D){var C=ti(ti({},n.options),{},{uploadUrl:l.uploadUrl||null,storeFingerprintForResuming:!1,removeFingerprintOnSuccess:!1,parallelUploads:1,parallelUploadBoundaries:null,metadata:n.options.metadataForPartialUploads,headers:ti(ti({},n.options.headers),{},{"Upload-Concat":"partial"}),onSuccess:b,onError:D,onProgress:function(_){i=i-d+_,d=_,n._emitProgress(i,o)},onUploadUrlAvailable:function(){n._parallelUploadUrls[f]=E.url,n._parallelUploadUrls.filter(function(_){return!!_}).length===s.length&&n._saveUploadInUrlStorage()}}),E=new t(m,C);E.start(),n._parallelUploads.push(E)})})}),c;Promise.all(u).then(function(){c=n._openRequest("POST",n.options.endpoint),c.setHeader("Upload-Concat","final;".concat(n._parallelUploadUrls.join(" ")));var l=Nb(n.options.metadata);return l!==""&&c.setHeader("Upload-Metadata",l),n._sendRequest(c,null)}).then(function(l){if(!ri(l.getStatus(),200)){n._emitHttpError(c,l,"tus: unexpected response while creating upload");return}var f=l.getHeader("Location");if(f==null){n._emitHttpError(c,l,"tus: invalid or missing Location header");return}n.url=qb(n.options.endpoint,f),(0,Kn.log)("Created upload at ".concat(n.url)),n._emitSuccess(l)}).catch(function(l){n._emitError(l)})}},{key:"_startSingleUpload",value:function(){if(this._aborted=!1,this.url!=null){(0,Kn.log)("Resuming upload from previous URL: ".concat(this.url)),this._resumeUpload();return}if(this.options.uploadUrl!=null){(0,Kn.log)("Resuming upload from provided URL: ".concat(this.options.uploadUrl)),this.url=this.options.uploadUrl,this._resumeUpload();return}(0,Kn.log)("Creating a new upload"),this._createUpload()}},{key:"abort",value:function(r){var n=this;if(this._parallelUploads!=null){var o=B$(this._parallelUploads),i;try{for(o.s();!(i=o.n()).done;){var a=i.value;a.abort(r)}}catch(s){o.e(s)}finally{o.f()}}return this._req!==null&&this._req.abort(),this._aborted=!0,this._retryTimeout!=null&&(clearTimeout(this._retryTimeout),this._retryTimeout=null),!r||this.url==null?Promise.resolve():t.terminate(this.url,this.options).then(function(){return n._removeFromUrlStorage()})}},{key:"_emitHttpError",value:function(r,n,o,i){this._emitError(new Mu.default(o,i,r,n))}},{key:"_emitError",value:function(r){var n=this;if(!this._aborted){if(this.options.retryDelays!=null){var o=this._offset!=null&&this._offset>this._offsetBeforeRetry;if(o&&(this._retryAttempt=0),Mb(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=Nb(this.options.metadata);o!==""&&n.setHeader("Upload-Metadata",o);var i;this.options.uploadDataDuringCreation&&!this.options.uploadLengthDeferred?(this._offset=0,i=this._addChunkToRequest(n)):((this.options.protocol===Hu||this.options.protocol===Ra)&&n.setHeader("Upload-Complete","?0"),i=this._sendRequest(n,null)),i.then(function(a){if(!ri(a.getStatus(),200)){r._emitHttpError(n,a,"tus: unexpected response while creating upload");return}var s=a.getHeader("Location");if(s==null){r._emitHttpError(n,a,"tus: invalid or missing Location header");return}if(r.url=qb(r.options.endpoint,s),(0,Kn.log)("Created upload at ".concat(r.url)),typeof r.options.onUploadUrlAvailable=="function"&&r.options.onUploadUrlAvailable(),r._size===0){r._emitSuccess(a),r._source.close();return}r._saveUploadInUrlStorage().then(function(){r.options.uploadDataDuringCreation?r._handleUploadResponse(n,a):(r._offset=0,r._performUpload())})}).catch(function(a){r._emitHttpError(n,null,"tus: failed to create upload",a)})}},{key:"_resumeUpload",value:function(){var r=this,n=this._openRequest("HEAD",this.url),o=this._sendRequest(n,null);o.then(function(i){var a=i.getStatus();if(!ri(a,200)){if(a===423){r._emitHttpError(n,i,"tus: upload is currently locked; retry later");return}if(ri(a,400)&&r._removeFromUrlStorage(),!r.options.endpoint){r._emitHttpError(n,i,"tus: unable to resume upload (new upload cannot be created without an endpoint)");return}r.url=null,r._createUpload();return}var s=Number.parseInt(i.getHeader("Upload-Offset"),10);if(Number.isNaN(s)){r._emitHttpError(n,i,"tus: invalid or missing offset value");return}var u=Number.parseInt(i.getHeader("Upload-Length"),10);if(Number.isNaN(u)&&!r.options.uploadLengthDeferred&&r.options.protocol===qu){r._emitHttpError(n,i,"tus: invalid or missing length value");return}typeof r.options.onUploadUrlAvailable=="function"&&r.options.onUploadUrlAvailable(),r._saveUploadInUrlStorage().then(function(){if(s===u){r._emitProgress(u,u),r._emitSuccess(i);return}r._offset=s,r._performUpload()})}).catch(function(i){r._emitHttpError(n,null,"tus: failed to resume upload",i)})}},{key:"_performUpload",value:function(){var r=this;if(!this._aborted){var n;this.options.overridePatchMethod?(n=this._openRequest("POST",this.url),n.setHeader("X-HTTP-Method-Override","PATCH")):n=this._openRequest("PATCH",this.url),n.setHeader("Upload-Offset","".concat(this._offset));var o=this._addChunkToRequest(n);o.then(function(i){if(!ri(i.getStatus(),200)){r._emitHttpError(n,i,"tus: unexpected response while uploading chunk");return}r._handleUploadResponse(n,i)}).catch(function(i){r._aborted||r._emitHttpError(n,null,"tus: failed to upload chunk at offset ".concat(r._offset),i)})}}},{key:"_addChunkToRequest",value:function(r){var n=this,o=this._offset,i=this._offset+this.options.chunkSize;return r.setProgressHandler(function(a){n._emitProgress(o+a,n._size)}),this.options.protocol===qu?r.setHeader("Content-Type","application/offset+octet-stream"):this.options.protocol===Ra&&r.setHeader("Content-Type","application/partial-upload"),(i===Number.POSITIVE_INFINITY||i>this._size)&&!this.options.uploadLengthDeferred&&(i=this._size),this._source.slice(o,i).then(function(a){var s=a.value,u=a.done,c=s!=null&&s.size?s.size:0;n.options.uploadLengthDeferred&&u&&(n._size=n._offset+c,r.setHeader("Upload-Length","".concat(n._size)));var l=n._offset+c;return!n.options.uploadLengthDeferred&&u&&l!==n._size?Promise.reject(new Error("upload was configured with a size of ".concat(n._size," bytes, but the source is done after ").concat(l," bytes"))):s===null?n._sendRequest(r):((n.options.protocol===Hu||n.options.protocol===Ra)&&r.setHeader("Upload-Complete",u?"?1":"?0"),n._emitProgress(n._offset,n._size),n._sendRequest(r,s))})}},{key:"_handleUploadResponse",value:function(r,n){var o=Number.parseInt(n.getHeader("Upload-Offset"),10);if(Number.isNaN(o)){this._emitHttpError(r,n,"tus: invalid or missing offset value");return}if(this._emitProgress(o,this._size),this._emitChunkComplete(o-this._offset,o,this._size),this._offset=o,o===this._size){this._emitSuccess(n),this._source.close();return}this._performUpload()}},{key:"_openRequest",value:function(r,n){var o=Lb(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 Ub(r,n,this.options)}}],[{key:"terminate",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=Lb("DELETE",r,n);return Ub(o,null,n).then(function(i){if(i.getStatus()!==204)throw new Mu.default("tus: unexpected response while terminating upload",null,o,i)}).catch(function(i){if(i instanceof Mu.default||(i=new Mu.default("tus: failed to terminate upload",i,o,null)),!Mb(i,0,n))throw i;var a=n.retryDelays[0],s=n.retryDelays.slice(1),u=ti(ti({},n),{},{retryDelays:s});return new Promise(function(c){return setTimeout(c,a)}).then(function(){return t.terminate(r,u)})})}}])})();function Nb(t){return Object.entries(t).map(function(e){var r=Hb(e,2),n=r[0],o=r[1];return"".concat(n," ").concat(O$.Base64.encode(String(o)))}).join(",")}function ri(t,e){return t>=e&&t<e+100}function Lb(t,e,r){var n=r.httpStack.createRequest(t,e);r.protocol===Hu?n.setHeader("Upload-Draft-Interop-Version","5"):r.protocol===Ra?n.setHeader("Upload-Draft-Interop-Version","6"):n.setHeader("Tus-Resumable","1.0.0");for(var o=r.headers||{},i=0,a=Object.entries(o);i<a.length;i++){var s=Hb(a[i],2),u=s[0],c=s[1];n.setHeader(u,c)}if(r.addRequestId){var l=(0,$$.default)();n.setHeader("X-Request-ID",l)}return n}function Ub(t,e,r){return Ud.apply(this,arguments)}function Ud(){return Ud=P$(Ld().mark(function t(e,r,n){var o;return Ld().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)})),Ud.apply(this,arguments)}function q$(){var t=!0;return typeof navigator<"u"&&navigator.onLine===!1&&(t=!1),t}function Mb(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):Wb(t)}function Wb(t){var e=t.originalResponse?t.originalResponse.getStatus():0;return(!ri(e,400)||e===409||e===423)&&q$()}function qb(t,e){return new k$.default(e,t).toString()}function H$(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}Gb.defaultOptions=M$;var UV=Vu.default=Gb});var Jb=x((qV,Yb)=>{"use strict";var Or=t=>t!==null&&typeof t=="object"&&typeof t.pipe=="function";Or.writable=t=>Or(t)&&t.writable!==!1&&typeof t._write=="function"&&typeof t._writableState=="object";Or.readable=t=>Or(t)&&t.readable!==!1&&typeof t._read=="function"&&typeof t._readableState=="object";Or.duplex=t=>Or.writable(t)&&Or.readable(t);Or.transform=t=>Or.duplex(t)&&typeof t._transform=="function";Yb.exports=Or});var Zb=x(zu=>{"use strict";Object.defineProperty(zu,"__esModule",{value:!0});zu.default=void 0;function Ba(t){"@babel/helpers - typeof";return Ba=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ba(t)}function V$(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}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,G$(n.key),n)}}function z$(t,e,r){return e&&Xb(t.prototype,e),r&&Xb(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function G$(t){var e=W$(t,"string");return Ba(e)=="symbol"?e:e+""}function W$(t,e){if(Ba(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Ba(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var HV=zu.default=(function(){function t(e){V$(this,t),this._buffer=e,this.size=e.length}return z$(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 rv=x(Vd=>{"use strict";Object.defineProperty(Vd,"__esModule",{value:!0});Vd.default=Q$;var tv=require("fs");function Jn(t){"@babel/helpers - typeof";return Jn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Jn(t)}function qd(){"use strict";qd=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(y,v,w){y[v]=w.value},i=typeof Symbol=="function"?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(y,v,w){return Object.defineProperty(y,v,{value:w,enumerable:!0,configurable:!0,writable:!0}),y[v]}try{c({},"")}catch{c=function(w,F,I){return w[F]=I}}function l(y,v,w,F){var I=v&&v.prototype instanceof C?v:C,k=Object.create(I.prototype),q=new Q(F||[]);return o(k,"_invoke",{value:N(y,w,q)}),k}function f(y,v,w){try{return{type:"normal",arg:y.call(v,w)}}catch(F){return{type:"throw",arg:F}}}e.wrap=l;var d="suspendedStart",h="suspendedYield",m="executing",b="completed",D={};function C(){}function E(){}function g(){}var _={};c(_,a,function(){return this});var S=Object.getPrototypeOf,T=S&&S(S($([])));T&&T!==r&&n.call(T,a)&&(_=T);var O=g.prototype=C.prototype=Object.create(_);function B(y){["next","throw","return"].forEach(function(v){c(y,v,function(w){return this._invoke(v,w)})})}function R(y,v){function w(I,k,q,P){var j=f(y[I],y,k);if(j.type!=="throw"){var ee=j.arg,V=ee.value;return V&&Jn(V)=="object"&&n.call(V,"__await")?v.resolve(V.__await).then(function(se){w("next",se,q,P)},function(se){w("throw",se,q,P)}):v.resolve(V).then(function(se){ee.value=se,q(ee)},function(se){return w("throw",se,q,P)})}P(j.arg)}var F;o(this,"_invoke",{value:function(k,q){function P(){return new v(function(j,ee){w(k,q,j,ee)})}return F=F?F.then(P,P):P()}})}function N(y,v,w){var F=d;return function(I,k){if(F===m)throw Error("Generator is already running");if(F===b){if(I==="throw")throw k;return{value:t,done:!0}}for(w.method=I,w.arg=k;;){var q=w.delegate;if(q){var P=A(q,w);if(P){if(P===D)continue;return P}}if(w.method==="next")w.sent=w._sent=w.arg;else if(w.method==="throw"){if(F===d)throw F=b,w.arg;w.dispatchException(w.arg)}else w.method==="return"&&w.abrupt("return",w.arg);F=m;var j=f(y,v,w);if(j.type==="normal"){if(F=w.done?b:h,j.arg===D)continue;return{value:j.arg,done:w.done}}j.type==="throw"&&(F=b,w.method="throw",w.arg=j.arg)}}}function A(y,v){var w=v.method,F=y.iterator[w];if(F===t)return v.delegate=null,w==="throw"&&y.iterator.return&&(v.method="return",v.arg=t,A(y,v),v.method==="throw")||w!=="return"&&(v.method="throw",v.arg=new TypeError("The iterator does not provide a '"+w+"' method")),D;var I=f(F,y.iterator,v.arg);if(I.type==="throw")return v.method="throw",v.arg=I.arg,v.delegate=null,D;var k=I.arg;return k?k.done?(v[y.resultName]=k.value,v.next=y.nextLoc,v.method!=="return"&&(v.method="next",v.arg=t),v.delegate=null,D):k:(v.method="throw",v.arg=new TypeError("iterator result is not an object"),v.delegate=null,D)}function U(y){var v={tryLoc:y[0]};1 in y&&(v.catchLoc=y[1]),2 in y&&(v.finallyLoc=y[2],v.afterLoc=y[3]),this.tryEntries.push(v)}function M(y){var v=y.completion||{};v.type="normal",delete v.arg,y.completion=v}function Q(y){this.tryEntries=[{tryLoc:"root"}],y.forEach(U,this),this.reset(!0)}function $(y){if(y||y===""){var v=y[a];if(v)return v.call(y);if(typeof y.next=="function")return y;if(!isNaN(y.length)){var w=-1,F=function I(){for(;++w<y.length;)if(n.call(y,w))return I.value=y[w],I.done=!1,I;return I.value=t,I.done=!0,I};return F.next=F}}throw new TypeError(Jn(y)+" is not iterable")}return E.prototype=g,o(O,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:E,configurable:!0}),E.displayName=c(g,u,"GeneratorFunction"),e.isGeneratorFunction=function(y){var v=typeof y=="function"&&y.constructor;return!!v&&(v===E||(v.displayName||v.name)==="GeneratorFunction")},e.mark=function(y){return Object.setPrototypeOf?Object.setPrototypeOf(y,g):(y.__proto__=g,c(y,u,"GeneratorFunction")),y.prototype=Object.create(O),y},e.awrap=function(y){return{__await:y}},B(R.prototype),c(R.prototype,s,function(){return this}),e.AsyncIterator=R,e.async=function(y,v,w,F,I){I===void 0&&(I=Promise);var k=new R(l(y,v,w,F),I);return e.isGeneratorFunction(v)?k:k.next().then(function(q){return q.done?q.value:k.next()})},B(O),c(O,u,"Generator"),c(O,a,function(){return this}),c(O,"toString",function(){return"[object Generator]"}),e.keys=function(y){var v=Object(y),w=[];for(var F in v)w.push(F);return w.reverse(),function I(){for(;w.length;){var k=w.pop();if(k in v)return I.value=k,I.done=!1,I}return I.done=!0,I}},e.values=$,Q.prototype={constructor:Q,reset:function(v){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(M),!v)for(var w in this)w.charAt(0)==="t"&&n.call(this,w)&&!isNaN(+w.slice(1))&&(this[w]=t)},stop:function(){this.done=!0;var v=this.tryEntries[0].completion;if(v.type==="throw")throw v.arg;return this.rval},dispatchException:function(v){if(this.done)throw v;var w=this;function F(ee,V){return q.type="throw",q.arg=v,w.next=ee,V&&(w.method="next",w.arg=t),!!V}for(var I=this.tryEntries.length-1;I>=0;--I){var k=this.tryEntries[I],q=k.completion;if(k.tryLoc==="root")return F("end");if(k.tryLoc<=this.prev){var P=n.call(k,"catchLoc"),j=n.call(k,"finallyLoc");if(P&&j){if(this.prev<k.catchLoc)return F(k.catchLoc,!0);if(this.prev<k.finallyLoc)return F(k.finallyLoc)}else if(P){if(this.prev<k.catchLoc)return F(k.catchLoc,!0)}else{if(!j)throw Error("try statement without catch or finally");if(this.prev<k.finallyLoc)return F(k.finallyLoc)}}}},abrupt:function(v,w){for(var F=this.tryEntries.length-1;F>=0;--F){var I=this.tryEntries[F];if(I.tryLoc<=this.prev&&n.call(I,"finallyLoc")&&this.prev<I.finallyLoc){var k=I;break}}k&&(v==="break"||v==="continue")&&k.tryLoc<=w&&w<=k.finallyLoc&&(k=null);var q=k?k.completion:{};return q.type=v,q.arg=w,k?(this.method="next",this.next=k.finallyLoc,D):this.complete(q)},complete:function(v,w){if(v.type==="throw")throw v.arg;return v.type==="break"||v.type==="continue"?this.next=v.arg:v.type==="return"?(this.rval=this.arg=v.arg,this.method="return",this.next="end"):v.type==="normal"&&w&&(this.next=w),D},finish:function(v){for(var w=this.tryEntries.length-1;w>=0;--w){var F=this.tryEntries[w];if(F.finallyLoc===v)return this.complete(F.completion,F.afterLoc),M(F),D}},catch:function(v){for(var w=this.tryEntries.length-1;w>=0;--w){var F=this.tryEntries[w];if(F.tryLoc===v){var I=F.completion;if(I.type==="throw"){var k=I.arg;M(F)}return k}}throw Error("illegal catch attempt")},delegateYield:function(v,w,F){return this.delegate={iterator:$(v),resultName:w,nextLoc:F},this.method==="next"&&(this.arg=t),D}},e}function K$(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,J$(n.key),n)}}function Y$(t,e,r){return e&&Qb(t.prototype,e),r&&Qb(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function J$(t){var e=X$(t,"string");return Jn(e)=="symbol"?e:e+""}function X$(t,e){if(Jn(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Jn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ev(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 Z$(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(u){ev(i,n,o,a,s,"next",u)}function s(u){ev(i,n,o,a,s,"throw",u)}a(void 0)})}}function Q$(t){return Hd.apply(this,arguments)}function Hd(){return Hd=Z$(qd().mark(function t(e){var r,n,o,i,a,s,u;return qd().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return n=e.path.toString(),l.next=3,tv.promises.stat(n);case 3:return o=l.sent,i=o.size,a=(r=e.start)!==null&&r!==void 0?r:0,s=Number.isFinite(e.end)?e.end+1:i,u=s-a,l.abrupt("return",new eP(e,n,u));case 9:case"end":return l.stop()}},t)})),Hd.apply(this,arguments)}var eP=(function(){function t(e,r,n){K$(this,t),this._stream=e,this._path=r,this.size=n}return Y$(t,[{key:"slice",value:function(r,n){var o,i=(o=this._stream.start)!==null&&o!==void 0?o:0,a=(0,tv.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 Gd=x(Gu=>{"use strict";Object.defineProperty(Gu,"__esModule",{value:!0});Gu.default=void 0;function Xn(t){"@babel/helpers - typeof";return Xn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Xn(t)}function ja(){"use strict";ja=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(y,v,w){y[v]=w.value},i=typeof Symbol=="function"?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(y,v,w){return Object.defineProperty(y,v,{value:w,enumerable:!0,configurable:!0,writable:!0}),y[v]}try{c({},"")}catch{c=function(w,F,I){return w[F]=I}}function l(y,v,w,F){var I=v&&v.prototype instanceof C?v:C,k=Object.create(I.prototype),q=new Q(F||[]);return o(k,"_invoke",{value:N(y,w,q)}),k}function f(y,v,w){try{return{type:"normal",arg:y.call(v,w)}}catch(F){return{type:"throw",arg:F}}}e.wrap=l;var d="suspendedStart",h="suspendedYield",m="executing",b="completed",D={};function C(){}function E(){}function g(){}var _={};c(_,a,function(){return this});var S=Object.getPrototypeOf,T=S&&S(S($([])));T&&T!==r&&n.call(T,a)&&(_=T);var O=g.prototype=C.prototype=Object.create(_);function B(y){["next","throw","return"].forEach(function(v){c(y,v,function(w){return this._invoke(v,w)})})}function R(y,v){function w(I,k,q,P){var j=f(y[I],y,k);if(j.type!=="throw"){var ee=j.arg,V=ee.value;return V&&Xn(V)=="object"&&n.call(V,"__await")?v.resolve(V.__await).then(function(se){w("next",se,q,P)},function(se){w("throw",se,q,P)}):v.resolve(V).then(function(se){ee.value=se,q(ee)},function(se){return w("throw",se,q,P)})}P(j.arg)}var F;o(this,"_invoke",{value:function(k,q){function P(){return new v(function(j,ee){w(k,q,j,ee)})}return F=F?F.then(P,P):P()}})}function N(y,v,w){var F=d;return function(I,k){if(F===m)throw Error("Generator is already running");if(F===b){if(I==="throw")throw k;return{value:t,done:!0}}for(w.method=I,w.arg=k;;){var q=w.delegate;if(q){var P=A(q,w);if(P){if(P===D)continue;return P}}if(w.method==="next")w.sent=w._sent=w.arg;else if(w.method==="throw"){if(F===d)throw F=b,w.arg;w.dispatchException(w.arg)}else w.method==="return"&&w.abrupt("return",w.arg);F=m;var j=f(y,v,w);if(j.type==="normal"){if(F=w.done?b:h,j.arg===D)continue;return{value:j.arg,done:w.done}}j.type==="throw"&&(F=b,w.method="throw",w.arg=j.arg)}}}function A(y,v){var w=v.method,F=y.iterator[w];if(F===t)return v.delegate=null,w==="throw"&&y.iterator.return&&(v.method="return",v.arg=t,A(y,v),v.method==="throw")||w!=="return"&&(v.method="throw",v.arg=new TypeError("The iterator does not provide a '"+w+"' method")),D;var I=f(F,y.iterator,v.arg);if(I.type==="throw")return v.method="throw",v.arg=I.arg,v.delegate=null,D;var k=I.arg;return k?k.done?(v[y.resultName]=k.value,v.next=y.nextLoc,v.method!=="return"&&(v.method="next",v.arg=t),v.delegate=null,D):k:(v.method="throw",v.arg=new TypeError("iterator result is not an object"),v.delegate=null,D)}function U(y){var v={tryLoc:y[0]};1 in y&&(v.catchLoc=y[1]),2 in y&&(v.finallyLoc=y[2],v.afterLoc=y[3]),this.tryEntries.push(v)}function M(y){var v=y.completion||{};v.type="normal",delete v.arg,y.completion=v}function Q(y){this.tryEntries=[{tryLoc:"root"}],y.forEach(U,this),this.reset(!0)}function $(y){if(y||y===""){var v=y[a];if(v)return v.call(y);if(typeof y.next=="function")return y;if(!isNaN(y.length)){var w=-1,F=function I(){for(;++w<y.length;)if(n.call(y,w))return I.value=y[w],I.done=!1,I;return I.value=t,I.done=!0,I};return F.next=F}}throw new TypeError(Xn(y)+" is not iterable")}return E.prototype=g,o(O,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:E,configurable:!0}),E.displayName=c(g,u,"GeneratorFunction"),e.isGeneratorFunction=function(y){var v=typeof y=="function"&&y.constructor;return!!v&&(v===E||(v.displayName||v.name)==="GeneratorFunction")},e.mark=function(y){return Object.setPrototypeOf?Object.setPrototypeOf(y,g):(y.__proto__=g,c(y,u,"GeneratorFunction")),y.prototype=Object.create(O),y},e.awrap=function(y){return{__await:y}},B(R.prototype),c(R.prototype,s,function(){return this}),e.AsyncIterator=R,e.async=function(y,v,w,F,I){I===void 0&&(I=Promise);var k=new R(l(y,v,w,F),I);return e.isGeneratorFunction(v)?k:k.next().then(function(q){return q.done?q.value:k.next()})},B(O),c(O,u,"Generator"),c(O,a,function(){return this}),c(O,"toString",function(){return"[object Generator]"}),e.keys=function(y){var v=Object(y),w=[];for(var F in v)w.push(F);return w.reverse(),function I(){for(;w.length;){var k=w.pop();if(k in v)return I.value=k,I.done=!1,I}return I.done=!0,I}},e.values=$,Q.prototype={constructor:Q,reset:function(v){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(M),!v)for(var w in this)w.charAt(0)==="t"&&n.call(this,w)&&!isNaN(+w.slice(1))&&(this[w]=t)},stop:function(){this.done=!0;var v=this.tryEntries[0].completion;if(v.type==="throw")throw v.arg;return this.rval},dispatchException:function(v){if(this.done)throw v;var w=this;function F(ee,V){return q.type="throw",q.arg=v,w.next=ee,V&&(w.method="next",w.arg=t),!!V}for(var I=this.tryEntries.length-1;I>=0;--I){var k=this.tryEntries[I],q=k.completion;if(k.tryLoc==="root")return F("end");if(k.tryLoc<=this.prev){var P=n.call(k,"catchLoc"),j=n.call(k,"finallyLoc");if(P&&j){if(this.prev<k.catchLoc)return F(k.catchLoc,!0);if(this.prev<k.finallyLoc)return F(k.finallyLoc)}else if(P){if(this.prev<k.catchLoc)return F(k.catchLoc,!0)}else{if(!j)throw Error("try statement without catch or finally");if(this.prev<k.finallyLoc)return F(k.finallyLoc)}}}},abrupt:function(v,w){for(var F=this.tryEntries.length-1;F>=0;--F){var I=this.tryEntries[F];if(I.tryLoc<=this.prev&&n.call(I,"finallyLoc")&&this.prev<I.finallyLoc){var k=I;break}}k&&(v==="break"||v==="continue")&&k.tryLoc<=w&&w<=k.finallyLoc&&(k=null);var q=k?k.completion:{};return q.type=v,q.arg=w,k?(this.method="next",this.next=k.finallyLoc,D):this.complete(q)},complete:function(v,w){if(v.type==="throw")throw v.arg;return v.type==="break"||v.type==="continue"?this.next=v.arg:v.type==="return"?(this.rval=this.arg=v.arg,this.method="return",this.next="end"):v.type==="normal"&&w&&(this.next=w),D},finish:function(v){for(var w=this.tryEntries.length-1;w>=0;--w){var F=this.tryEntries[w];if(F.finallyLoc===v)return this.complete(F.completion,F.afterLoc),M(F),D}},catch:function(v){for(var w=this.tryEntries.length-1;w>=0;--w){var F=this.tryEntries[w];if(F.tryLoc===v){var I=F.completion;if(I.type==="throw"){var k=I.arg;M(F)}return k}}throw Error("illegal catch attempt")},delegateYield:function(v,w,F){return this.delegate={iterator:$(v),resultName:w,nextLoc:F},this.method==="next"&&(this.arg=t),D}},e}function tP(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function nv(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,nP(n.key),n)}}function rP(t,e,r){return e&&nv(t.prototype,e),r&&nv(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function nP(t){var e=oP(t,"string");return Xn(e)=="symbol"?e:e+""}function oP(t,e){if(Xn(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Xn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ov(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 iv(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(u){ov(i,n,o,a,s,"next",u)}function s(u){ov(i,n,o,a,s,"throw",u)}a(void 0)})}}function iP(t,e){return zd.apply(this,arguments)}function zd(){return zd=iv(ja().mark(function t(e,r){return ja().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.abrupt("return",new Promise(function(i,a){var s=function(l){e.off("readable",u),a(l)},u=function c(){var l=e.read(r);l!==null&&(e.off("error",s),e.off("readable",c),i(l))};e.once("error",s),e.on("readable",u)}));case 1:case"end":return o.stop()}},t)})),zd.apply(this,arguments)}var GV=Gu.default=(function(){function t(e){var r=this;tP(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 rP(t,[{key:"slice",value:(function(){var e=iv(ja().mark(function n(o,i){var a,s,u,c,l;return ja().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:if(!(o<this._bufPos)){d.next=2;break}throw new Error("cannot slice from position which we already seeked away");case 2:if(!(o>this._bufPos+this._buf.length)){d.next=4;break}throw new Error("slice start is outside of buffer (currently not implemented)");case 4:if(!this._error){d.next=6;break}throw this._error;case 6:if(o<this._bufPos+this._buf.length?(s=o-this._bufPos,u=Math.min(this._buf.length,i-this._bufPos),a=this._buf.slice(s,u)):a=Buffer.alloc(0),!this._ended){d.next=10;break}return a.size=a.length,d.abrupt("return",{value:a,done:!0});case 10:if(c=i-o,!(c>a.length)){d.next=16;break}return d.next=14,iP(this._stream,c-a.length);case 14:l=d.sent,a=Buffer.concat([a,l]);case 16:return this._buf=a,this._bufPos=o,a.size=a.length,d.abrupt("return",{value:a,done:this._ended});case 20:case"end":return d.stop()}},n,this)}));function r(n,o){return e.apply(this,arguments)}return r})()},{key:"close",value:function(){this._stream.destroy()}}])})()});var sv=x(Ku=>{"use strict";Object.defineProperty(Ku,"__esModule",{value:!0});Ku.default=void 0;var aP=require("fs"),sP=Wu(Jb()),uP=Wu(Zb()),cP=Wu(rv()),lP=Wu(Gd());function Wu(t){return t&&t.__esModule?t:{default:t}}function Na(t){"@babel/helpers - typeof";return Na=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Na(t)}function fP(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function av(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,dP(n.key),n)}}function pP(t,e,r){return e&&av(t.prototype,e),r&&av(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function dP(t){var e=hP(t,"string");return Na(e)=="symbol"?e:e+""}function hP(t,e){if(Na(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Na(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var KV=Ku.default=(function(){function t(){fP(this,t)}return pP(t,[{key:"openFile",value:function(r,n){return Buffer.isBuffer(r)?Promise.resolve(new uP.default(r)):r instanceof aP.ReadStream&&r.path!=null?(0,cP.default)(r):sP.default.readable(r)?(n=Number(n),Number.isFinite(n)?Promise.resolve(new lP.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 fv=x(Wd=>{"use strict";Object.defineProperty(Wd,"__esModule",{value:!0});Wd.default=DP;var mP=require("crypto"),uv=lv(require("fs")),gP=lv(require("path"));function cv(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(cv=function(n){return n?r:e})(t)}function lv(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=cv(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 DP(t,e){if(Buffer.isBuffer(t)){var r=65536,n=t.slice(0,Math.min(r,t.length)),o=(0,mP.createHash)("md5").update(n).digest("hex"),i=["node-buffer",o,t.length,e.endpoint].join("-");return Promise.resolve(i)}return t instanceof uv.ReadStream&&t.path!=null?new Promise(function(a,s){var u=gP.resolve(t.path);uv.stat(t.path,function(c,l){if(c){s(c);return}var f=["node-file",u,l.size,l.mtime.getTime(),e.endpoint].join("-");a(f)})}):Promise.resolve(null)}});var gv=x((XV,mv)=>{var hv="Expected a function",pv=NaN,yP="[object Symbol]",bP=/^\s+|\s+$/g,vP=/^[-+]0x[0-9a-f]+$/i,wP=/^0b[01]+$/i,CP=/^0o[0-7]+$/i,EP=parseInt,_P=typeof global=="object"&&global&&global.Object===Object&&global,xP=typeof self=="object"&&self&&self.Object===Object&&self,SP=_P||xP||Function("return this")(),FP=Object.prototype,AP=FP.toString,OP=Math.max,kP=Math.min,Kd=function(){return SP.Date.now()};function $P(t,e,r){var n,o,i,a,s,u,c=0,l=!1,f=!1,d=!0;if(typeof t!="function")throw new TypeError(hv);e=dv(e)||0,Yu(r)&&(l=!!r.leading,f="maxWait"in r,i=f?OP(dv(r.maxWait)||0,e):i,d="trailing"in r?!!r.trailing:d);function h(T){var O=n,B=o;return n=o=void 0,c=T,a=t.apply(B,O),a}function m(T){return c=T,s=setTimeout(C,e),l?h(T):a}function b(T){var O=T-u,B=T-c,R=e-O;return f?kP(R,i-B):R}function D(T){var O=T-u,B=T-c;return u===void 0||O>=e||O<0||f&&B>=i}function C(){var T=Kd();if(D(T))return E(T);s=setTimeout(C,b(T))}function E(T){return s=void 0,d&&n?h(T):(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(Kd())}function S(){var T=Kd(),O=D(T);if(n=arguments,o=this,u=T,O){if(s===void 0)return m(u);if(f)return s=setTimeout(C,e),h(u)}return s===void 0&&(s=setTimeout(C,e)),a}return S.cancel=g,S.flush=_,S}function PP(t,e,r){var n=!0,o=!0;if(typeof t!="function")throw new TypeError(hv);return Yu(r)&&(n="leading"in r?!!r.leading:n,o="trailing"in r?!!r.trailing:o),$P(t,e,{leading:n,maxWait:e,trailing:o})}function Yu(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function TP(t){return!!t&&typeof t=="object"}function IP(t){return typeof t=="symbol"||TP(t)&&AP.call(t)==yP}function dv(t){if(typeof t=="number")return t;if(IP(t))return pv;if(Yu(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Yu(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(bP,"");var r=wP.test(t);return r||CP.test(t)?EP(t.slice(2),r?2:8):vP.test(t)?pv:+t}mv.exports=PP});var xv=x(Qu=>{"use strict";Object.defineProperty(Qu,"__esModule",{value:!0});Qu.default=void 0;var RP=Cv(require("http")),BP=Cv(require("https")),bv=require("stream"),jP=require("url"),vv=NP(gv());function NP(t){return t&&t.__esModule?t:{default:t}}function wv(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(wv=function(n){return n?r:e})(t)}function Cv(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=wv(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 LP(t,e,r){return e=Ju(e),UP(t,Ev()?Reflect.construct(e,r||[],Ju(t).constructor):e.apply(t,r))}function UP(t,e){if(e&&(ni(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return MP(t)}function MP(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 Ju(t){return Ju=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Ju(t)}function qP(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&&Yd(t,e)}function Yd(t,e){return Yd=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Yd(t,e)}function Dv(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r.push.apply(r,n)}return r}function La(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Dv(Object(r),!0).forEach(function(n){HP(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Dv(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function HP(t,e,r){return e=_v(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ni(t){"@babel/helpers - typeof";return ni=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ni(t)}function Xu(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function yv(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,_v(n.key),n)}}function Zu(t,e,r){return e&&yv(t.prototype,e),r&&yv(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function _v(t){var e=VP(t,"string");return ni(e)=="symbol"?e:e+""}function VP(t,e){if(ni(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ni(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var ZV=Qu.default=(function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Xu(this,t),this._requestOptions=e}return Zu(t,[{key:"createRequest",value:function(r,n){return new zP(r,n,this._requestOptions)}},{key:"getName",value:function(){return"NodeHttpStack"}}])})(),zP=(function(){function t(e,r,n){Xu(this,t),this._method=e,this._url=r,this._headers={},this._request=null,this._progressHandler=function(){},this._requestOptions=n||{}}return Zu(t,[{key:"getMethod",value:function(){return this._method}},{key:"getURL",value:function(){return this._url}},{key:"setHeader",value:function(r,n){this._headers[r]=n}},{key:"getHeader",value:function(r){return this._headers[r]}},{key:"setProgressHandler",value:function(r){this._progressHandler=r}},{key:"send",value:function(){var r=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return new Promise(function(o,i){var a=La(La(La({},(0,jP.parse)(r._url)),r._requestOptions),{},{method:r._method,headers:La(La({},r._requestOptions.headers||{}),r._headers)});n!=null&&n.size&&(a.headers["Content-Length"]=n.size);var s=a.protocol==="https:"?BP:RP;r._request=s.request(a);var u=r._request;u.on("response",function(c){var l=[];c.on("data",function(f){l.push(f)}),c.on("end",function(){var f=Buffer.concat(l).toString("utf8");o(new GP(c,f))})}),u.on("error",function(c){i(c)}),n instanceof bv.Readable?n.pipe(new WP(r._progressHandler)).pipe(u):n instanceof Uint8Array?KP(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}}])})(),GP=(function(){function t(e,r){Xu(this,t),this._response=e,this._body=r}return Zu(t,[{key:"getStatus",value:function(){return this._response.statusCode}},{key:"getHeader",value:function(r){return this._response.headers[r.toLowerCase()]}},{key:"getBody",value:function(){return this._body}},{key:"getUnderlyingObject",value:function(){return this._response}}])})(),WP=(function(t){function e(r){var n;return Xu(this,e),n=LP(this,e),n._onprogress=(0,vv.default)(r,100,{leading:!0,trailing:!1}),n._position=0,n}return qP(e,t),Zu(e,[{key:"_transform",value:function(n,o,i){this._position+=n.length,this._onprogress(this._position),i(null,n)}}])})(bv.Transform),KP=function(e,r,n){n=(0,vv.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 Sv=x(Jd=>{"use strict";Jd.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};Jd.root=function(t,e,r){var n=this,o,i={stackLength:Error.stackTraceLimit,rootOnly:!0},a="",s=Error.stackTraceLimit,u;function c(){u[0]=n.toString(),n.stack=u.join(`
37
+ `)}(!e||typeof e!="object")&&(e={}),e.hasOwnProperty("stackLength")&&typeof e.stackLength=="number"&&!isNaN(e.stackLength)&&e.stackLength>=0&&(i.stackLength=e.stackLength),e.hasOwnProperty("rootOnly")||(i.rootOnly=e.rootOnly),(!i.rootOnly||this.CustomError.parent===Error)&&(Object.keys(t).forEach(function(l){switch(l){case"code":o=t.code||void 0;break;case"message":a=t.message||"";break;default:n[l]=t[l]}}),Error.stackTraceLimit=i.stackLength+2,u=new Error().stack.split(`
38
+ `),u.splice(0,3),u.unshift(""),Error.stackTraceLimit=s,this.stack=u.join(`
39
+ `),Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,get:function(){return o},set:function(l){o=l,c()}}),Object.defineProperty(this,"message",{configurable:!0,enumerable:!0,get:function(){return a},set:function(l){a=l,c()}}),c())}});var Ov=x((tz,Av)=>{"use strict";Av.exports=Zn;Zn.factory=Sv();var Qd=Zn("CustomError");Qd.order=Zn(Qd,{message:"Arguments out of order.",code:"EOARG"});function Zn(t,e,r,n){var o,i;return e=ec(arguments,1,Error,Fv,[Xd,tc]),r=ec(arguments,2,{},Xd,[tc]),n=ec(arguments,3,Zd,tc,[]),t=ec(arguments,0,e===Error?"Error":e.prototype.CustomError.name,YP,[Fv,Xd,tc]),i=e===Error,i&&n===Zd&&(n=Zn.factory.root),o=function(a,s){var u,c,l,f,d,h;if(!(this instanceof o))return new o(a,s);for(delete this.constructor.name,Object.defineProperty(this.constructor,"name",{enumerable:!1,configurable:!0,value:t,writable:!1}),typeof a=="string"&&(a={message:a}),a||(a={}),c=this.CustomError.chain.slice(0).reverse().map(function(m){return m.properties}),c.push(a),c.unshift({}),h=Object.assign.apply(Object,c),u=this,l={},Object.keys(Zn.factory).forEach(function(m){l[m]=function(b,D){Zn.factory[m].call(u,b,D,l)}}),f=this.CustomError.chain.length-1;f>=0;f--)d=this.CustomError.chain[f],d.factory!==Zd&&d.factory.call(this,h,s,l)},o.prototype=Object.create(e.prototype),o.prototype.constructor=o,o.prototype.name=t,o.prototype.CustomError={chain:i?[]:e.prototype.CustomError.chain.slice(0),factory:n,name:t,parent:e,properties:r},o.prototype.CustomError.chain.unshift(o.prototype.CustomError),o.prototype.toString=function(){var a=this.CustomError.chain[this.CustomError.chain.length-1].name;return this.code&&(a+=" "+this.code),this.message&&(a+=": "+this.message),a},o}function ec(t,e,r,n,o){var i=-1,a=-1,s,u,c=e<t.length?e:t.length,l;for(s=0;s<=c;s++){if(l=t[s],i===-1)for(u=0;u<o.length;u++)o[u](l)&&(i=s);a===-1&&n(l)&&(a=s)}if(a!==-1&&i!==-1&&i<a)throw new Qd.order;return a!==-1?t[a]:r}function tc(t){return typeof t=="function"&&t!==Error&&!t.prototype.CustomError}function YP(t){return typeof t=="string"}function Fv(t){return typeof t=="function"&&(t===Error||t.prototype.CustomError)}function Xd(t){return t&&typeof t=="object"}function Zd(){}});var $v=x((rz,kv)=>{kv.exports=Ov()});var Bv=x((Qn,oi)=>{var JP=1/0,XP="[object Symbol]",Ua={function:!0,object:!0},ZP=Ua[typeof Qn]&&Qn&&!Qn.nodeType?Qn:void 0,QP=Ua[typeof oi]&&oi&&!oi.nodeType?oi:void 0,eT=rc(ZP&&QP&&typeof global=="object"&&global),tT=rc(Ua[typeof self]&&self),Pv=rc(Ua[typeof window]&&window),eh=rc(Ua[typeof Qn]&&Qn),rT=eT||Pv!==(eh&&eh.window)&&Pv||tT||eh||Function("return this")();function rc(t){return t&&t.Object===Object?t:null}var nT=Object.prototype,oT=nT.toString,Tv=rT.Symbol,Iv=Tv?Tv.prototype:void 0,Rv=Iv?Iv.toString:void 0;function iT(t){if(typeof t=="string")return t;if(sT(t))return Rv?Rv.call(t):"";var e=t+"";return e=="0"&&1/t==-JP?"-0":e}function aT(t){return!!t&&typeof t=="object"}function sT(t){return typeof t=="symbol"||aT(t)&&oT.call(t)==XP}oi.exports=iT});var Hv=x((eo,ii)=>{var uT=Bv(),cT="Expected a function",Nv="__lodash_hash_undefined__",lT="[object Function]",fT="[object GeneratorFunction]",pT=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g,dT=/[\\^$.*+?()[\]{}|]/g,hT=/\\(\\)?/g,mT=/^\[object .+?Constructor\]$/,qa={function:!0,object:!0},gT=qa[typeof eo]&&eo&&!eo.nodeType?eo:void 0,DT=qa[typeof ii]&&ii&&!ii.nodeType?ii:void 0,yT=nc(gT&&DT&&typeof global=="object"&&global),bT=nc(qa[typeof self]&&self),jv=nc(qa[typeof window]&&window),th=nc(qa[typeof eo]&&eo),vT=yT||jv!==(th&&th.window)&&jv||bT||th||Function("return this")();function nc(t){return t&&t.Object===Object?t:null}function wT(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}var CT=Array.prototype,Lv=Object.prototype,Uv=Function.prototype.toString,rh=Lv.hasOwnProperty,ET=Lv.toString,_T=RegExp("^"+Uv.call(rh).replace(dT,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),xT=CT.splice,ST=Mv(vT,"Map"),Ma=Mv(Object,"create");function to(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function FT(){this.__data__=Ma?Ma(null):{}}function AT(t){return this.has(t)&&delete this.__data__[t]}function OT(t){var e=this.__data__;if(Ma){var r=e[t];return r===Nv?void 0:r}return rh.call(e,t)?e[t]:void 0}function kT(t){var e=this.__data__;return Ma?e[t]!==void 0:rh.call(e,t)}function $T(t,e){var r=this.__data__;return r[t]=Ma&&e===void 0?Nv:e,this}to.prototype.clear=FT;to.prototype.delete=AT;to.prototype.get=OT;to.prototype.has=kT;to.prototype.set=$T;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 PT(){this.__data__=[]}function TT(t){var e=this.__data__,r=oc(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():xT.call(e,r,1),!0}function IT(t){var e=this.__data__,r=oc(e,t);return r<0?void 0:e[r][1]}function RT(t){return oc(this.__data__,t)>-1}function BT(t,e){var r=this.__data__,n=oc(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}ai.prototype.clear=PT;ai.prototype.delete=TT;ai.prototype.get=IT;ai.prototype.has=RT;ai.prototype.set=BT;function ro(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function jT(){this.__data__={hash:new to,map:new(ST||ai),string:new to}}function NT(t){return ic(this,t).delete(t)}function LT(t){return ic(this,t).get(t)}function UT(t){return ic(this,t).has(t)}function MT(t,e){return ic(this,t).set(t,e),this}ro.prototype.clear=jT;ro.prototype.delete=NT;ro.prototype.get=LT;ro.prototype.has=UT;ro.prototype.set=MT;function oc(t,e){for(var r=t.length;r--;)if(zT(t[r][0],e))return r;return-1}function ic(t,e){var r=t.__data__;return qT(e)?r[typeof e=="string"?"string":"hash"]:r.map}function Mv(t,e){var r=t[e];return WT(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 HT=nh(function(t){var e=[];return KT(t).replace(pT,function(r,n,o,i){e.push(o?i.replace(hT,"$1"):n||r)}),e});function VT(t){if(t!=null){try{return Uv.call(t)}catch{}try{return t+""}catch{}}return""}function nh(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(cT);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||ro),r}nh.Cache=ro;function zT(t,e){return t===e||t!==t&&e!==e}function GT(t){var e=qv(t)?ET.call(t):"";return e==lT||e==fT}function qv(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function WT(t){if(!qv(t))return!1;var e=GT(t)||wT(t)?_T:mT;return e.test(VT(t))}function KT(t){return t==null?"":uT(t)}ii.exports=HT});var bw=x((no,ui)=>{var YT=Hv(),JT=200,hh="__lodash_hash_undefined__",lc=1,ci=2,XT=1/0,Yv=9007199254740991,ac="[object Arguments]",ah="[object Array]",Jv="[object Boolean]",Xv="[object Date]",Zv="[object Error]",Qv="[object Function]",ZT="[object GeneratorFunction]",Ha="[object Map]",ew="[object Number]",si="[object Object]",Vv="[object Promise]",tw="[object RegExp]",Va="[object Set]",mh="[object String]",rw="[object Symbol]",sh="[object WeakMap]",nw="[object ArrayBuffer]",sc="[object DataView]",QT="[object Float32Array]",e6="[object Float64Array]",t6="[object Int8Array]",r6="[object Int16Array]",n6="[object Int32Array]",o6="[object Uint8Array]",i6="[object Uint8ClampedArray]",a6="[object Uint16Array]",s6="[object Uint32Array]",u6=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,c6=/^\w*$/,l6=/[\\^$.*+?()[\]{}|]/g,f6=/^\[object .+?Constructor\]$/,p6=/^(?:0|[1-9]\d*)$/,Ie={};Ie[QT]=Ie[e6]=Ie[t6]=Ie[r6]=Ie[n6]=Ie[o6]=Ie[i6]=Ie[a6]=Ie[s6]=!0;Ie[ac]=Ie[ah]=Ie[nw]=Ie[Jv]=Ie[sc]=Ie[Xv]=Ie[Zv]=Ie[Qv]=Ie[Ha]=Ie[ew]=Ie[si]=Ie[tw]=Ie[Va]=Ie[mh]=Ie[sh]=!1;var Ga={function:!0,object:!0},d6=Ga[typeof no]&&no&&!no.nodeType?no:void 0,h6=Ga[typeof ui]&&ui&&!ui.nodeType?ui:void 0,m6=fc(d6&&h6&&typeof global=="object"&&global),g6=fc(Ga[typeof self]&&self),zv=fc(Ga[typeof window]&&window),oh=fc(Ga[typeof no]&&no),ao=m6||zv!==(oh&&oh.window)&&zv||g6||oh||Function("return this")();function D6(t,e){for(var r=-1,n=t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}function y6(t,e){for(var r=-1,n=t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}function b6(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function v6(t,e){return D6(e,function(r){return[r,t[r]]})}function fc(t){return t&&t.Object===Object?t:null}function uh(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function ow(t){var e=-1,r=Array(t.size);return t.forEach(function(n,o){r[++e]=[o,n]}),r}function w6(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}function C6(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=[n,n]}),r}var E6=Array.prototype,pc=Object.prototype,iw=Function.prototype.toString,oo=pc.hasOwnProperty,so=pc.toString,_6=RegExp("^"+iw.call(oo).replace(l6,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Gv=ao.Symbol,Wv=ao.Uint8Array,x6=pc.propertyIsEnumerable,S6=E6.splice,F6=Object.getPrototypeOf,A6=Object.keys,ch=li(ao,"DataView"),uc=li(ao,"Map"),lh=li(ao,"Promise"),fh=li(ao,"Set"),ph=li(ao,"WeakMap"),za=li(Object,"create"),O6=co(ch),k6=co(uc),$6=co(lh),P6=co(fh),T6=co(ph),Kv=Gv?Gv.prototype:void 0,ih=Kv?Kv.valueOf:void 0;function io(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function I6(){this.__data__=za?za(null):{}}function R6(t){return this.has(t)&&delete this.__data__[t]}function B6(t){var e=this.__data__;if(za){var r=e[t];return r===hh?void 0:r}return oo.call(e,t)?e[t]:void 0}function j6(t){var e=this.__data__;return za?e[t]!==void 0:oo.call(e,t)}function N6(t,e){var r=this.__data__;return r[t]=za&&e===void 0?hh:e,this}io.prototype.clear=I6;io.prototype.delete=R6;io.prototype.get=B6;io.prototype.has=j6;io.prototype.set=N6;function Yr(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function L6(){this.__data__=[]}function U6(t){var e=this.__data__,r=dc(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():S6.call(e,r,1),!0}function M6(t){var e=this.__data__,r=dc(e,t);return r<0?void 0:e[r][1]}function q6(t){return dc(this.__data__,t)>-1}function H6(t,e){var r=this.__data__,n=dc(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}Yr.prototype.clear=L6;Yr.prototype.delete=U6;Yr.prototype.get=M6;Yr.prototype.has=q6;Yr.prototype.set=H6;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 V6(){this.__data__={hash:new io,map:new(uc||Yr),string:new io}}function z6(t){return hc(this,t).delete(t)}function G6(t){return hc(this,t).get(t)}function W6(t){return hc(this,t).has(t)}function K6(t,e){return hc(this,t).set(t,e),this}uo.prototype.clear=V6;uo.prototype.delete=z6;uo.prototype.get=G6;uo.prototype.has=W6;uo.prototype.set=K6;function cc(t){var e=-1,r=t?t.length:0;for(this.__data__=new uo;++e<r;)this.add(t[e])}function Y6(t){return this.__data__.set(t,hh),this}function J6(t){return this.__data__.has(t)}cc.prototype.add=cc.prototype.push=Y6;cc.prototype.has=J6;function Kr(t){this.__data__=new Yr(t)}function X6(){this.__data__=new Yr}function Z6(t){return this.__data__.delete(t)}function Q6(t){return this.__data__.get(t)}function e8(t){return this.__data__.has(t)}function t8(t,e){var r=this.__data__;return r instanceof Yr&&r.__data__.length==JT&&(r=this.__data__=new uo(r.__data__)),r.set(t,e),this}Kr.prototype.clear=X6;Kr.prototype.delete=Z6;Kr.prototype.get=Q6;Kr.prototype.has=e8;Kr.prototype.set=t8;function dc(t,e){for(var r=t.length;r--;)if(v8(t[r][0],e))return r;return-1}function aw(t,e){e=mc(e,t)?[e]:cw(e);for(var r=0,n=e.length;t!=null&&r<n;)t=t[gc(e[r++])];return r&&r==n?t:void 0}function sw(t,e){return oo.call(t,e)||typeof t=="object"&&e in t&&m8(t)===null}function r8(t,e){return e in Object(t)}function gh(t,e,r,n,o){return t===e?!0:t==null||e==null||!yc(t)&&!Wa(e)?t!==t&&e!==e:n8(t,e,gh,r,n,o)}function n8(t,e,r,n,o,i){var a=bn(t),s=bn(e),u=ah,c=ah;a||(u=Wr(t),u=u==ac?si:u),s||(c=Wr(e),c=c==ac?si:c);var l=u==si&&!uh(t),f=c==si&&!uh(e),d=u==c;if(d&&!l)return i||(i=new Kr),a||E8(t)?lw(t,e,r,n,o,i):f8(t,e,u,r,n,o,i);if(!(o&ci)){var h=l&&oo.call(t,"__wrapped__"),m=f&&oo.call(e,"__wrapped__");if(h||m){var b=h?t.value():t,D=m?e.value():e;return i||(i=new Kr),r(b,D,n,o,i)}}return d?(i||(i=new Kr),p8(t,e,r,n,o,i)):!1}function o8(t,e,r,n){var o=r.length,i=o,a=!n;if(t==null)return!i;for(t=Object(t);o--;){var s=r[o];if(a&&s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++o<i;){s=r[o];var u=s[0],c=t[u],l=s[1];if(a&&s[2]){if(c===void 0&&!(u in t))return!1}else{var f=new Kr;if(n)var d=n(c,l,u,t,e,f);if(!(d===void 0?gh(l,c,n,lc|ci,f):d))return!1}}return!0}function i8(t){return typeof t=="function"?t:t==null?F8:typeof t=="object"?bn(t)?u8(t[0],t[1]):s8(t):A8(t)}function a8(t){return A6(Object(t))}function s8(t){var e=h8(t);return e.length==1&&e[0][2]?dw(e[0][0],e[0][1]):function(r){return r===t||o8(r,t,e)}}function u8(t,e){return mc(t)&&pw(e)?dw(gc(t),e):function(r){var n=_8(r,t);return n===void 0&&n===e?x8(r,t):gh(e,n,void 0,lc|ci)}}function uw(t){return function(e){return e?.[t]}}function c8(t){return function(e){return aw(e,t)}}function cw(t){return bn(t)?t:YT(t)}function l8(t){return function(e){var r=Wr(e);return r==Ha?ow(e):r==Va?C6(e):v6(e,t(e))}}function lw(t,e,r,n,o,i){var a=o&ci,s=t.length,u=e.length;if(s!=u&&!(a&&u>s))return!1;var c=i.get(t);if(c)return c==e;var l=-1,f=!0,d=o&lc?new cc:void 0;for(i.set(t,e);++l<s;){var h=t[l],m=e[l];if(n)var b=a?n(m,h,l,e,t,i):n(h,m,l,t,e,i);if(b!==void 0){if(b)continue;f=!1;break}if(d){if(!y6(e,function(D,C){if(!d.has(C)&&(h===D||r(h,D,n,o,i)))return d.add(C)})){f=!1;break}}else if(!(h===m||r(h,m,n,o,i))){f=!1;break}}return i.delete(t),f}function f8(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 nw:return!(t.byteLength!=e.byteLength||!n(new Wv(t),new Wv(e)));case Jv:case Xv:return+t==+e;case Zv:return t.name==e.name&&t.message==e.message;case ew:return t!=+t?e!=+e:t==+e;case tw:case mh:return t==e+"";case Ha:var s=ow;case Va:var u=i&ci;if(s||(s=w6),t.size!=e.size&&!u)return!1;var c=a.get(t);return c?c==e:(i|=lc,a.set(t,e),lw(s(t),s(e),n,o,i,a));case rw:if(ih)return ih.call(t)==ih.call(e)}return!1}function p8(t,e,r,n,o,i){var a=o&ci,s=dh(t),u=s.length,c=dh(e),l=c.length;if(u!=l&&!a)return!1;for(var f=u;f--;){var d=s[f];if(!(a?d in e:sw(e,d)))return!1}var h=i.get(t);if(h)return h==e;var m=!0;i.set(t,e);for(var b=a;++f<u;){d=s[f];var D=t[d],C=e[d];if(n)var E=a?n(C,D,d,e,t,i):n(D,C,d,t,e,i);if(!(E===void 0?D===C||r(D,C,n,o,i):E)){m=!1;break}b||(b=d=="constructor")}if(m&&!b){var g=t.constructor,_=e.constructor;g!=_&&"constructor"in t&&"constructor"in e&&!(typeof g=="function"&&g instanceof g&&typeof _=="function"&&_ instanceof _)&&(m=!1)}return i.delete(t),m}var d8=uw("length");function hc(t,e){var r=t.__data__;return y8(e)?r[typeof e=="string"?"string":"hash"]:r.map}function h8(t){for(var e=S8(t),r=e.length;r--;)e[r][2]=pw(e[r][1]);return e}function li(t,e){var r=t[e];return C8(r)?r:void 0}function m8(t){return F6(Object(t))}function Wr(t){return so.call(t)}(ch&&Wr(new ch(new ArrayBuffer(1)))!=sc||uc&&Wr(new uc)!=Ha||lh&&Wr(lh.resolve())!=Vv||fh&&Wr(new fh)!=Va||ph&&Wr(new ph)!=sh)&&(Wr=function(t){var e=so.call(t),r=e==si?t.constructor:void 0,n=r?co(r):void 0;if(n)switch(n){case O6:return sc;case k6:return Ha;case $6:return Vv;case P6:return Va;case T6:return sh}return e});function g8(t,e,r){e=mc(e,t)?[e]:cw(e);for(var n,o=-1,a=e.length;++o<a;){var i=gc(e[o]);if(!(n=t!=null&&r(t,i)))break;t=t[i]}if(n)return n;var a=t?t.length:0;return!!a&&Dc(a)&&fw(i,a)&&(bn(t)||Dw(t)||hw(t))}function D8(t){var e=t?t.length:void 0;return Dc(e)&&(bn(t)||Dw(t)||hw(t))?b6(e,String):null}function fw(t,e){return e=e??Yv,!!e&&(typeof t=="number"||p6.test(t))&&t>-1&&t%1==0&&t<e}function mc(t,e){if(bn(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||yw(t)?!0:c6.test(t)||!u6.test(t)||e!=null&&t in Object(e)}function y8(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function b8(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||pc;return t===r}function pw(t){return t===t&&!yc(t)}function dw(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}function gc(t){if(typeof t=="string"||yw(t))return t;var e=t+"";return e=="0"&&1/t==-XT?"-0":e}function co(t){if(t!=null){try{return iw.call(t)}catch{}try{return t+""}catch{}}return""}function v8(t,e){return t===e||t!==t&&e!==e}function hw(t){return w8(t)&&oo.call(t,"callee")&&(!x6.call(t,"callee")||so.call(t)==ac)}var bn=Array.isArray;function mw(t){return t!=null&&Dc(d8(t))&&!gw(t)}function w8(t){return Wa(t)&&mw(t)}function gw(t){var e=yc(t)?so.call(t):"";return e==Qv||e==ZT}function Dc(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Yv}function yc(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function Wa(t){return!!t&&typeof t=="object"}function C8(t){if(!yc(t))return!1;var e=gw(t)||uh(t)?_6:f6;return e.test(co(t))}function Dw(t){return typeof t=="string"||!bn(t)&&Wa(t)&&so.call(t)==mh}function yw(t){return typeof t=="symbol"||Wa(t)&&so.call(t)==rw}function E8(t){return Wa(t)&&Dc(t.length)&&!!Ie[so.call(t)]}function _8(t,e,r){var n=t==null?void 0:aw(t,e);return n===void 0?r:n}function x8(t,e){return t!=null&&g8(t,e,r8)}function dh(t){var e=b8(t);if(!(e||mw(t)))return a8(t);var r=D8(t),n=!!r,o=r||[],i=o.length;for(var a in t)sw(t,a)&&!(n&&(a=="length"||fw(a,i)))&&!(e&&a=="constructor")&&o.push(a);return o}var S8=l8(dh);function F8(t){return t}function A8(t){return mc(t)?uw(gc(t)):c8(t)}ui.exports=i8});var _w=x((lo,fi)=>{var O8=1/0,k8="[object Function]",$8="[object GeneratorFunction]",P8=/[\\^$.*+?()[\]{}|]/g,T8=/^\[object .+?Constructor\]$/,Ka={function:!0,object:!0},I8=Ka[typeof lo]&&lo&&!lo.nodeType?lo:void 0,R8=Ka[typeof fi]&&fi&&!fi.nodeType?fi:void 0,B8=bc(I8&&R8&&typeof global=="object"&&global),j8=bc(Ka[typeof self]&&self),vw=bc(Ka[typeof window]&&window),Dh=bc(Ka[typeof lo]&&lo),N8=B8||vw!==(Dh&&Dh.window)&&vw||j8||Dh||Function("return this")();function bc(t){return t&&t.Object===Object?t:null}function L8(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function U8(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var ww=Object.prototype,Cw=Function.prototype.toString,M8=ww.hasOwnProperty,q8=ww.toString,H8=RegExp("^"+Cw.call(M8).replace(P8,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),yh=z8(N8,"Set"),V8=yh&&1/U8(new yh([,-0]))[1]==O8?function(t){return new yh(t)}:Y8;function z8(t,e){var r=t[e];return K8(r)?r:void 0}function G8(t){if(t!=null){try{return Cw.call(t)}catch{}try{return t+""}catch{}}return""}function W8(t){var e=Ew(t)?q8.call(t):"";return e==k8||e==$8}function Ew(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function K8(t){if(!Ew(t))return!1;var e=W8(t)||L8(t)?H8:T8;return e.test(G8(t))}function Y8(){}fi.exports=V8});var Sw=x((fo,pi)=>{var Ya={function:!0,object:!0},J8=Ya[typeof fo]&&fo&&!fo.nodeType?fo:void 0,X8=Ya[typeof pi]&&pi&&!pi.nodeType?pi:void 0,Z8=vc(J8&&X8&&typeof global=="object"&&global),Q8=vc(Ya[typeof self]&&self),xw=vc(Ya[typeof window]&&window),bh=vc(Ya[typeof fo]&&fo),eI=Z8||xw!==(bh&&bh.window)&&xw||Q8||bh||Function("return this")();function vc(t){return t&&t.Object===Object?t:null}pi.exports=eI});var Pw=x((nz,$w)=>{var tI=_w(),rI=Sw(),nI=200,vh="__lodash_hash_undefined__",oI="[object Function]",iI="[object GeneratorFunction]",aI=/[\\^$.*+?()[\]{}|]/g,sI=/^\[object .+?Constructor\]$/;function uI(t,e){return!!t.length&&lI(t,e,0)>-1}function cI(t,e,r){for(var n=-1,o=t.length;++n<o;)if(r(e,t[n]))return!0;return!1}function lI(t,e,r){if(e!==e)return pI(t,r);for(var n=r-1,o=t.length;++n<o;)if(t[n]===e)return n;return-1}function fI(t,e){return t.has(e)}function pI(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 dI(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function hI(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var mI=Array.prototype,Fw=Object.prototype,Aw=Function.prototype.toString,wh=Fw.hasOwnProperty,gI=Fw.toString,DI=RegExp("^"+Aw.call(wh).replace(aI,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),yI=mI.splice,bI=Ow(rI,"Map"),Ja=Ow(Object,"create");function po(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function vI(){this.__data__=Ja?Ja(null):{}}function wI(t){return this.has(t)&&delete this.__data__[t]}function CI(t){var e=this.__data__;if(Ja){var r=e[t];return r===vh?void 0:r}return wh.call(e,t)?e[t]:void 0}function EI(t){var e=this.__data__;return Ja?e[t]!==void 0:wh.call(e,t)}function _I(t,e){var r=this.__data__;return r[t]=Ja&&e===void 0?vh:e,this}po.prototype.clear=vI;po.prototype.delete=wI;po.prototype.get=CI;po.prototype.has=EI;po.prototype.set=_I;function di(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function xI(){this.__data__=[]}function SI(t){var e=this.__data__,r=Cc(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():yI.call(e,r,1),!0}function FI(t){var e=this.__data__,r=Cc(e,t);return r<0?void 0:e[r][1]}function AI(t){return Cc(this.__data__,t)>-1}function OI(t,e){var r=this.__data__,n=Cc(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}di.prototype.clear=xI;di.prototype.delete=SI;di.prototype.get=FI;di.prototype.has=AI;di.prototype.set=OI;function hi(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function kI(){this.__data__={hash:new po,map:new(bI||di),string:new po}}function $I(t){return Ec(this,t).delete(t)}function PI(t){return Ec(this,t).get(t)}function TI(t){return Ec(this,t).has(t)}function II(t,e){return Ec(this,t).set(t,e),this}hi.prototype.clear=kI;hi.prototype.delete=$I;hi.prototype.get=PI;hi.prototype.has=TI;hi.prototype.set=II;function wc(t){var e=-1,r=t?t.length:0;for(this.__data__=new hi;++e<r;)this.add(t[e])}function RI(t){return this.__data__.set(t,vh),this}function BI(t){return this.__data__.has(t)}wc.prototype.add=wc.prototype.push=RI;wc.prototype.has=BI;function Cc(t,e){for(var r=t.length;r--;)if(UI(t[r][0],e))return r;return-1}function jI(t,e,r){var n=-1,o=uI,i=t.length,a=!0,s=[],u=s;if(r)a=!1,o=cI;else if(i>=nI){var c=e?null:tI(t);if(c)return hI(c);a=!1,o=fI,u=new wc}else u=e?[]:s;e:for(;++n<i;){var l=t[n],f=e?e(l):l;if(l=r||l!==0?l:0,a&&f===f){for(var d=u.length;d--;)if(u[d]===f)continue e;e&&u.push(f),s.push(l)}else o(u,f,r)||(u!==s&&u.push(f),s.push(l))}return s}function Ec(t,e){var r=t.__data__;return NI(e)?r[typeof e=="string"?"string":"hash"]:r.map}function Ow(t,e){var r=t[e];return qI(r)?r:void 0}function NI(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function LI(t){if(t!=null){try{return Aw.call(t)}catch{}try{return t+""}catch{}}return""}function UI(t,e){return t===e||t!==t&&e!==e}function MI(t){var e=kw(t)?gI.call(t):"";return e==oI||e==iI}function kw(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function qI(t){if(!kw(t))return!1;var e=MI(t)||dI(t)?DI:sI;return e.test(LI(t))}$w.exports=jI});var Iw=x((oz,Tw)=>{var HI=bw(),VI=Pw();function zI(t,e){return t&&t.length?VI(t,HI(e)):[]}Tw.exports=zI});var Bw=x((iz,Rw)=>{"use strict";var GI=$v(),WI=Iw(),KI=GI("MultiError");Rw.exports=Ch;function Ch(t){if(!(this instanceof Ch))return new Ch(t);if(t=Array.isArray(t)?t:[t],t=WI(t,function(r){return r.stack}),t.length===1)return t[0];var e=new KI({message:t.map(function(r){return r.message}).join("; "),errors:t.reduce(function(r,n){return r.concat(n.errors||n)},[])});return e.__defineGetter__("stack",function(){return t.map(function(r){return r.stack}).join(`
40
40
 
41
41
  `)}),e.__defineSetter__("stack",function(r){return[r].concat(e.stack).join(`
42
42
 
43
- `)}),e}});var IE=C((fY,RE)=>{var $n=require("constants"),TN=process.cwd,Vc=null,RN=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return Vc||(Vc=TN.call(process)),Vc};try{process.cwd()}catch{}typeof process.chdir=="function"&&(tm=process.chdir,process.chdir=function(t){Vc=null,tm.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,tm));var tm;RE.exports=IN;function IN(t){$n.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=s(t.chownSync),t.fchownSync=s(t.fchownSync),t.lchownSync=s(t.lchownSync),t.chmodSync=o(t.chmodSync),t.fchmodSync=o(t.fchmodSync),t.lchmodSync=o(t.lchmodSync),t.stat=a(t.stat),t.fstat=a(t.fstat),t.lstat=a(t.lstat),t.statSync=u(t.statSync),t.fstatSync=u(t.fstatSync),t.lstatSync=u(t.lstatSync),t.chmod&&!t.lchmod&&(t.lchmod=function(l,f,h){h&&process.nextTick(h)},t.lchmodSync=function(){}),t.chown&&!t.lchown&&(t.lchown=function(l,f,h,d){d&&process.nextTick(d)},t.lchownSync=function(){}),RN==="win32"&&(t.rename=typeof t.rename!="function"?t.rename:(function(l){function f(h,d,m){var b=Date.now(),D=0;l(h,d,function E(_){if(_&&(_.code==="EACCES"||_.code==="EPERM"||_.code==="EBUSY")&&Date.now()-b<6e4){setTimeout(function(){t.stat(d,function(g,x){g&&g.code==="ENOENT"?l(h,d,E):m(_)})},D),D<100&&(D+=10);return}m&&m(_)})}return Object.setPrototypeOf&&Object.setPrototypeOf(f,l),f})(t.rename)),t.read=typeof t.read!="function"?t.read:(function(l){function f(h,d,m,b,D,E){var _;if(E&&typeof E=="function"){var g=0;_=function(x,S,T){if(x&&x.code==="EAGAIN"&&g<10)return g++,l.call(t,h,d,m,b,D,_);E.apply(this,arguments)}}return l.call(t,h,d,m,b,D,_)}return Object.setPrototypeOf&&Object.setPrototypeOf(f,l),f})(t.read),t.readSync=typeof t.readSync!="function"?t.readSync:(function(l){return function(f,h,d,m,b){for(var D=0;;)try{return l.call(t,f,h,d,m,b)}catch(E){if(E.code==="EAGAIN"&&D<10){D++;continue}throw E}}})(t.readSync);function e(l){l.lchmod=function(f,h,d){l.open(f,$n.O_WRONLY|$n.O_SYMLINK,h,function(m,b){if(m){d&&d(m);return}l.fchmod(b,h,function(D){l.close(b,function(E){d&&d(D||E)})})})},l.lchmodSync=function(f,h){var d=l.openSync(f,$n.O_WRONLY|$n.O_SYMLINK,h),m=!0,b;try{b=l.fchmodSync(d,h),m=!1}finally{if(m)try{l.closeSync(d)}catch{}else l.closeSync(d)}return b}}function r(l){$n.hasOwnProperty("O_SYMLINK")&&l.futimes?(l.lutimes=function(f,h,d,m){l.open(f,$n.O_SYMLINK,function(b,D){if(b){m&&m(b);return}l.futimes(D,h,d,function(E){l.close(D,function(_){m&&m(E||_)})})})},l.lutimesSync=function(f,h,d){var m=l.openSync(f,$n.O_SYMLINK),b,D=!0;try{b=l.futimesSync(m,h,d),D=!1}finally{if(D)try{l.closeSync(m)}catch{}else l.closeSync(m)}return b}):l.futimes&&(l.lutimes=function(f,h,d,m){m&&process.nextTick(m)},l.lutimesSync=function(){})}function n(l){return l&&function(f,h,d){return l.call(t,f,h,function(m){c(m)&&(m=null),d&&d.apply(this,arguments)})}}function o(l){return l&&function(f,h){try{return l.call(t,f,h)}catch(d){if(!c(d))throw d}}}function i(l){return l&&function(f,h,d,m){return l.call(t,f,h,d,function(b){c(b)&&(b=null),m&&m.apply(this,arguments)})}}function s(l){return l&&function(f,h,d){try{return l.call(t,f,h,d)}catch(m){if(!c(m))throw m}}}function a(l){return l&&function(f,h,d){typeof h=="function"&&(d=h,h=null);function m(b,D){D&&(D.uid<0&&(D.uid+=4294967296),D.gid<0&&(D.gid+=4294967296)),d&&d.apply(this,arguments)}return h?l.call(t,f,h,m):l.call(t,f,m)}}function u(l){return l&&function(f,h){var d=h?l.call(t,f,h):l.call(t,f);return d&&(d.uid<0&&(d.uid+=4294967296),d.gid<0&&(d.gid+=4294967296)),d}}function c(l){if(!l||l.code==="ENOSYS")return!0;var f=!process.getuid||process.getuid()!==0;return!!(f&&(l.code==="EINVAL"||l.code==="EPERM"))}}});var LE=C((pY,NE)=>{var BE=require("stream").Stream;NE.exports=BN;function BN(t){return{ReadStream:e,WriteStream:r};function e(n,o){if(!(this instanceof e))return new e(n,o);BE.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 s=Object.keys(o),a=0,u=s.length;a<u;a++){var c=s[a];this[c]=o[c]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){i._read()});return}t.open(this.path,this.flags,this.mode,function(l,f){if(l){i.emit("error",l),i.readable=!1;return}i.fd=f,i.emit("open",f),i._read()})}function r(n,o){if(!(this instanceof r))return new r(n,o);BE.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),s=0,a=i.length;s<a;s++){var u=i[s];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 UE=C((dY,jE)=>{"use strict";jE.exports=LN;var NN=Object.getPrototypeOf||function(t){return t.__proto__};function LN(t){if(t===null||typeof t!="object")return t;if(t instanceof Object)var e={__proto__:NN(t)};else var e=Object.create(null);return Object.getOwnPropertyNames(t).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}});var Pn=C((hY,om)=>{var We=require("fs"),jN=IE(),UN=LE(),MN=UE(),zc=require("util"),yt,Wc;typeof Symbol=="function"&&typeof Symbol.for=="function"?(yt=Symbol.for("graceful-fs.queue"),Wc=Symbol.for("graceful-fs.previous")):(yt="___graceful-fs.queue",Wc="___graceful-fs.previous");function qN(){}function HE(t,e){Object.defineProperty(t,yt,{get:function(){return e}})}var xo=qN;zc.debuglog?xo=zc.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(xo=function(){var t=zc.format.apply(zc,arguments);t="GFS4: "+t.split(/\n/).join(`
44
- GFS4: `),console.error(t)});We[yt]||(ME=global[yt]||[],HE(We,ME),We.close=(function(t){function e(r,n){return t.call(We,r,function(o){o||qE(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(e,Wc,{value:t}),e})(We.close),We.closeSync=(function(t){function e(r){t.apply(We,arguments),qE()}return Object.defineProperty(e,Wc,{value:t}),e})(We.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){xo(We[yt]),require("assert").equal(We[yt].length,0)}));var ME;global[yt]||HE(global,We[yt]);om.exports=rm(MN(We));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!We.__patched&&(om.exports=rm(We),We.__patched=!0);function rm(t){jN(t),t.gracefulify=rm,t.createReadStream=S,t.createWriteStream=T;var e=t.readFile;t.readFile=r;function r(I,L,F){return typeof L=="function"&&(F=L,L=null),U(I,L,F);function U(M,te,$,y){return e(M,te,function(w){w&&(w.code==="EMFILE"||w.code==="ENFILE")?Ai([U,[M,te,$],w,y||Date.now(),Date.now()]):typeof $=="function"&&$.apply(this,arguments)})}}var n=t.writeFile;t.writeFile=o;function o(I,L,F,U){return typeof F=="function"&&(U=F,F=null),M(I,L,F,U);function M(te,$,y,w,v){return n(te,$,y,function(A){A&&(A.code==="EMFILE"||A.code==="ENFILE")?Ai([M,[te,$,y,w],A,v||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}var i=t.appendFile;i&&(t.appendFile=s);function s(I,L,F,U){return typeof F=="function"&&(U=F,F=null),M(I,L,F,U);function M(te,$,y,w,v){return i(te,$,y,function(A){A&&(A.code==="EMFILE"||A.code==="ENFILE")?Ai([M,[te,$,y,w],A,v||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}var a=t.copyFile;a&&(t.copyFile=u);function u(I,L,F,U){return typeof F=="function"&&(U=F,F=0),M(I,L,F,U);function M(te,$,y,w,v){return a(te,$,y,function(A){A&&(A.code==="EMFILE"||A.code==="ENFILE")?Ai([M,[te,$,y,w],A,v||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}var c=t.readdir;t.readdir=f;var l=/^v[0-5]\./;function f(I,L,F){typeof L=="function"&&(F=L,L=null);var U=l.test(process.version)?function($,y,w,v){return c($,M($,y,w,v))}:function($,y,w,v){return c($,y,M($,y,w,v))};return U(I,L,F);function M(te,$,y,w){return function(v,A){v&&(v.code==="EMFILE"||v.code==="ENFILE")?Ai([U,[te,$,y],v,w||Date.now(),Date.now()]):(A&&A.sort&&A.sort(),typeof y=="function"&&y.call(this,v,A))}}}if(process.version.substr(0,4)==="v0.8"){var h=UN(t);E=h.ReadStream,g=h.WriteStream}var d=t.ReadStream;d&&(E.prototype=Object.create(d.prototype),E.prototype.open=_);var m=t.WriteStream;m&&(g.prototype=Object.create(m.prototype),g.prototype.open=x),Object.defineProperty(t,"ReadStream",{get:function(){return E},set:function(I){E=I},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WriteStream",{get:function(){return g},set:function(I){g=I},enumerable:!0,configurable:!0});var b=E;Object.defineProperty(t,"FileReadStream",{get:function(){return b},set:function(I){b=I},enumerable:!0,configurable:!0});var D=g;Object.defineProperty(t,"FileWriteStream",{get:function(){return D},set:function(I){D=I},enumerable:!0,configurable:!0});function E(I,L){return this instanceof E?(d.apply(this,arguments),this):E.apply(Object.create(E.prototype),arguments)}function _(){var I=this;B(I.path,I.flags,I.mode,function(L,F){L?(I.autoClose&&I.destroy(),I.emit("error",L)):(I.fd=F,I.emit("open",F),I.read())})}function g(I,L){return this instanceof g?(m.apply(this,arguments),this):g.apply(Object.create(g.prototype),arguments)}function x(){var I=this;B(I.path,I.flags,I.mode,function(L,F){L?(I.destroy(),I.emit("error",L)):(I.fd=F,I.emit("open",F))})}function S(I,L){return new t.ReadStream(I,L)}function T(I,L){return new t.WriteStream(I,L)}var O=t.open;t.open=B;function B(I,L,F,U){return typeof F=="function"&&(U=F,F=null),M(I,L,F,U);function M(te,$,y,w,v){return O(te,$,y,function(A,R){A&&(A.code==="EMFILE"||A.code==="ENFILE")?Ai([M,[te,$,y,w],A,v||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}return t}function Ai(t){xo("ENQUEUE",t[0].name,t[1]),We[yt].push(t),nm()}var Gc;function qE(){for(var t=Date.now(),e=0;e<We[yt].length;++e)We[yt][e].length>2&&(We[yt][e][3]=t,We[yt][e][4]=t);nm()}function nm(){if(clearTimeout(Gc),Gc=void 0,We[yt].length!==0){var t=We[yt].shift(),e=t[0],r=t[1],n=t[2],o=t[3],i=t[4];if(o===void 0)xo("RETRY",e.name,r),e.apply(null,r);else if(Date.now()-o>=6e4){xo("TIMEOUT",e.name,r);var s=r.pop();typeof s=="function"&&s.call(null,n)}else{var a=Date.now()-i,u=Math.max(i-o,1),c=Math.min(u*1.2,100);a>=c?(xo("RETRY",e.name,r),e.apply(null,r.concat([o]))):We[yt].push(t)}Gc===void 0&&(Gc=setTimeout(nm,0))}}});var zE=C((mY,VE)=>{function fr(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))}VE.exports=fr;fr.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};fr.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};fr.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};fr.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)};fr.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};fr.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};fr.prototype.start=fr.prototype.try;fr.prototype.errors=function(){return this._errors};fr.prototype.attempts=function(){return this._attempts};fr.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,s=(t[i]||0)+1;t[i]=s,s>=r&&(e=o,r=s)}return e}});var GE=C(So=>{var HN=zE();So.operation=function(t){var e=So.timeouts(t);return new HN(e,{forever:t&&t.forever,unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};So.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,s){return i-s}),n};So.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};So.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],s=t[i];t[i]=function(u){var c=So.operation(e),l=Array.prototype.slice.call(arguments,1),f=l.pop();l.push(function(h){c.retry(h)||(h&&(arguments[0]=c.mainError()),f.apply(this,arguments))}),c.attempt(function(){u.apply(t,l)})}.bind(t,s),t[i].options=e}}});var KE=C((DY,WE)=>{WE.exports=GE()});var XE=C((yY,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 am=C((bY,ki)=>{var Me=global.process,Ao=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"};Ao(Me)?(YE=require("assert"),Fi=XE(),JE=/^win/i.test(Me.platform),la=require("events"),typeof la!="function"&&(la=la.EventEmitter),Me.__signal_exit_emitter__?st=Me.__signal_exit_emitter__:(st=Me.__signal_exit_emitter__=new la,st.count=0,st.emitted={}),st.infinite||(st.setMaxListeners(1/0),st.infinite=!0),ki.exports=function(t,e){if(!Ao(global.process))return function(){};YE.equal(typeof t,"function","a callback must be provided for exit handler"),Oi===!1&&im();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(){!Oi||!Ao(global.process)||(Oi=!1,Fi.forEach(function(e){try{Me.removeListener(e,Yc[e])}catch{}}),Me.emit=Jc,Me.reallyExit=sm,st.count-=1)},ki.exports.unload=Xc,Fo=function(e,r,n){st.emitted[e]||(st.emitted[e]=!0,st.emit(e,r,n))},Yc={},Fi.forEach(function(t){Yc[t]=function(){if(Ao(global.process)){var r=Me.listeners(t);r.length===st.count&&(Xc(),Fo("exit",null,t),Fo("afterexit",null,t),JE&&t==="SIGHUP"&&(t="SIGINT"),Me.kill(Me.pid,t))}}}),ki.exports.signals=function(){return Fi},Oi=!1,im=function(){Oi||!Ao(global.process)||(Oi=!0,st.count+=1,Fi=Fi.filter(function(e){try{return Me.on(e,Yc[e]),!0}catch{return!1}}),Me.emit=QE,Me.reallyExit=ZE)},ki.exports.load=im,sm=Me.reallyExit,ZE=function(e){Ao(global.process)&&(Me.exitCode=e||0,Fo("exit",Me.exitCode,null),Fo("afterexit",Me.exitCode,null),sm.call(Me,Me.exitCode))},Jc=Me.emit,QE=function(e,r){if(e==="exit"&&Ao(global.process)){r!==void 0&&(Me.exitCode=r);var n=Jc.apply(this,arguments);return Fo("exit",Me.exitCode,null),Fo("afterexit",Me.exitCode,null),n}else return Jc.apply(this,arguments)}):ki.exports=function(){return function(){}};var YE,Fi,JE,la,st,Xc,Fo,Yc,Oi,im,sm,ZE,Jc,QE});var tC=C((wY,um)=>{"use strict";var eC=Symbol();function VN(t,e,r){let n=e[eC];if(n)return e.stat(t,(i,s)=>{if(i)return r(i);r(null,s.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,(s,a)=>{if(s)return r(s);let u=a.mtime.getTime()%1e3===0?"s":"ms";Object.defineProperty(e,eC,{value:u}),r(null,a.mtime,u)})})}function zN(t){let e=Date.now();return t==="s"&&(e=Math.ceil(e/1e3)*1e3),new Date(e)}um.exports.probe=VN;um.exports.getMtime=zN});var sC=C((vY,pa)=>{"use strict";var GN=require("path"),fm=Pn(),WN=KE(),KN=am(),rC=tC(),an={};function fa(t,e){return e.lockfilePath||`${t}.lock`}function pm(t,e,r){if(!e.realpath)return r(null,GN.resolve(t));e.fs.realpath(t,r)}function lm(t,e,r){let n=fa(t,e);e.fs.mkdir(n,o=>{if(!o)return rC.probe(n,e.fs,(i,s,a)=>{if(i)return e.fs.rmdir(n,()=>{}),r(i);r(null,s,a)});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,s)=>{if(i)return i.code==="ENOENT"?lm(t,{...e,stale:0},r):r(i);if(!nC(s,e))return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:t}));oC(t,e,a=>{if(a)return r(a);lm(t,{...e,stale:0},r)})})})}function nC(t,e){return t.mtime.getTime()<Date.now()-e.stale}function oC(t,e,r){e.fs.rmdir(fa(t,e),n=>{if(n&&n.code!=="ENOENT")return r(n);r()})}function Zc(t,e){let r=an[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?cm(t,r,Object.assign(n,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,Zc(t,e));if(!(r.mtime.getTime()===o.mtime.getTime()))return cm(t,r,Object.assign(new Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let a=rC.getMtime(r.mtimePrecision);e.fs.utimes(r.lockfilePath,a,a,u=>{let c=r.lastUpdate+e.stale<Date.now();if(!r.released){if(u)return u.code==="ENOENT"||c?cm(t,r,Object.assign(u,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,Zc(t,e));r.mtime=a,r.lastUpdate=Date.now(),r.updateDelay=null,Zc(t,e)}})})},r.updateDelay),r.updateTimeout.unref&&r.updateTimeout.unref())}function cm(t,e,r){e.released=!0,e.updateTimeout&&clearTimeout(e.updateTimeout),an[t]===e&&delete an[t],e.options.onCompromised(r)}function XN(t,e,r){e={stale:1e4,update:null,realpath:!0,retries:0,fs:fm,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),pm(t,e,(n,o)=>{if(n)return r(n);let i=WN.operation(e.retries);i.attempt(()=>{lm(o,e,(s,a,u)=>{if(i.retry(s))return;if(s)return r(i.mainError());let c=an[o]={lockfilePath:fa(o,e),mtime:a,mtimePrecision:u,options:e,lastUpdate:Date.now()};Zc(o,e),r(null,l=>{if(c.released)return l&&l(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));iC(o,{...e,realpath:!1},l)})})})})}function iC(t,e,r){e={fs:fm,realpath:!0,...e},pm(t,e,(n,o)=>{if(n)return r(n);let i=an[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 an[o],oC(o,e,r)})}function YN(t,e,r){e={stale:1e4,realpath:!0,fs:fm,...e},e.stale=Math.max(e.stale||0,2e3),pm(t,e,(n,o)=>{if(n)return r(n);e.fs.stat(fa(o,e),(i,s)=>i?i.code==="ENOENT"?r(null,!1):r(i):r(null,!nC(s,e)))})}function JN(){return an}KN(()=>{for(let t in an){let e=an[t].options;try{e.fs.rmdirSync(fa(t,e))}catch{}}});pa.exports.lock=XN;pa.exports.unlock=iC;pa.exports.check=YN;pa.exports.getLocks=JN});var uC=C((EY,aC)=>{"use strict";var ZN=Pn();function QN(t){let e=["mkdir","realpath","stat","rmdir","utimes"],r={...t};return e.forEach(n=>{r[n]=(...o)=>{let i=o.pop(),s;try{s=t[`${n}Sync`](...o)}catch(a){return i(a)}i(null,s)}}),r}function eL(t){return(...e)=>new Promise((r,n)=>{e.push((o,i)=>{o?n(o):r(i)}),t(...e)})}function tL(t){return(...e)=>{let r,n;if(e.push((o,i)=>{r=o,n=i}),t(...e),r)throw r;return n}}function rL(t){if(t={...t},t.fs=QN(t.fs||ZN),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}aC.exports={toPromise:eL,toSync:tL,toSyncOptions:rL}});var lC=C((CY,Tn)=>{"use strict";var $i=sC(),{toPromise:Qc,toSync:el,toSyncOptions:dm}=uC();async function cC(t,e){let r=await Qc($i.lock)(t,e);return Qc(r)}function nL(t,e){let r=el($i.lock)(t,dm(e));return el(r)}function oL(t,e){return Qc($i.unlock)(t,e)}function iL(t,e){return el($i.unlock)(t,dm(e))}function sL(t,e){return Qc($i.check)(t,e)}function aL(t,e){return el($i.check)(t,dm(e))}Tn.exports=cC;Tn.exports.lock=cC;Tn.exports.unlock=oL;Tn.exports.lockSync=nL;Tn.exports.unlockSync=iL;Tn.exports.check=sL;Tn.exports.checkSync=aL});var mC=C(Pi=>{"use strict";Object.defineProperty(Pi,"__esModule",{value:!0});Pi.canStoreURLs=Pi.FileUrlStorage=void 0;var fC=require("fs"),uL=lL(TE()),pC=cL(lC());function hC(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(hC=function(n){return n?r:e})(t)}function cL(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=hC(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 s=o?Object.getOwnPropertyDescriptor(t,i):null;s&&(s.get||s.set)?Object.defineProperty(n,i,s):n[i]=t[i]}return n.default=t,r&&r.set(t,n),n}function lL(t){return t&&t.__esModule?t:{default:t}}function da(t){"@babel/helpers - typeof";return da=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},da(t)}function fL(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function dC(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,dL(n.key),n)}}function pL(t,e,r){return e&&dC(t.prototype,e),r&&dC(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function dL(t){var e=hL(t,"string");return da(e)=="symbol"?e:e+""}function hL(t,e){if(da(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(da(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var _Y=Pi.canStoreURLs=!0,xY=Pi.FileUrlStorage=(function(){function t(e){fL(this,t),this.path=e}return pL(t,[{key:"findAllUploads",value:function(){var r=this;return new Promise(function(n,o){r._getItems("tus::",function(i,s){i?o(i):n(s)})})}},{key:"findUploadsByFingerprint",value:function(r){var n=this;return new Promise(function(o,i){n._getItems("tus::".concat(r),function(s,a){s?i(s):o(a)})})}},{key:"removeUpload",value:function(r){var n=this;return new Promise(function(o,i){n._removeItem(r,function(s){s?i(s):o()})})}},{key:"addUpload",value:function(r,n){var o=this,i=Math.round(Math.random()*1e12),s="tus::".concat(r,"::").concat(i);return new Promise(function(a,u){o._setItem(s,n,function(c){c?u(c):a(s)})})}},{key:"_setItem",value:function(r,n,o){var i=this;pC.lock(this.path,this._lockfileOptions()).then(function(s){o=i._releaseAndCb(s,o),i._getData(function(a,u){if(a){o(a);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 s=Object.keys(i).filter(function(a){return a.startsWith(r)}).map(function(a){var u=i[a];return u.urlStorageKey=a,u});n(null,s)})}},{key:"_removeItem",value:function(r,n){var o=this;pC.lock(this.path,this._lockfileOptions()).then(function(i){n=o._releaseAndCb(i,n),o._getData(function(s,a){if(s){n(s);return}delete a[r],o._writeData(a,function(u){return n(u)})})}).catch(n)}},{key:"_lockfileOptions",value:function(){return{realpath:!1,retries:{retries:5,minTimeout:20}}}},{key:"_releaseAndCb",value:function(r,n){return function(o){if(o){r().then(function(){return n(o)}).catch(function(i){return n((0,uL.default)([o,i]))});return}r().then(n).catch(n)}}},{key:"_writeData",value:function(r,n){var o={encoding:"utf8",mode:432,flag:"w"};(0,fC.writeFile)(this.path,JSON.stringify(r),o,function(i){return n(i)})}},{key:"_getData",value:function(r){(0,fC.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 gm=C(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Object.defineProperty(Wt,"DefaultHttpStack",{enumerable:!0,get:function(){return bC.default}});Object.defineProperty(Wt,"DetailedError",{enumerable:!0,get:function(){return mL.default}});Object.defineProperty(Wt,"FileUrlStorage",{enumerable:!0,get:function(){return wC.FileUrlStorage}});Object.defineProperty(Wt,"StreamSource",{enumerable:!0,get:function(){return wL.default}});Wt.Upload=void 0;Object.defineProperty(Wt,"canStoreURLs",{enumerable:!0,get:function(){return wC.canStoreURLs}});Wt.defaultOptions=void 0;Object.defineProperty(Wt,"enableDebugLog",{enumerable:!0,get:function(){return gL.enableDebugLog}});Wt.isSupported=void 0;var mL=Oo(ch()),gL=lh(),DL=Oo(mw()),hm=Oo(zw()),yL=Oo(ov()),bL=Oo(uv()),bC=Oo(Ev()),wL=Oo(_h()),wC=mC();function Oo(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 vL(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,EC(n.key),n)}}function EL(t,e,r){return e&&gC(t.prototype,e),r&&gC(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function CL(t,e,r){return e=tl(e),_L(t,vC()?Reflect.construct(e,r||[],tl(t).constructor):e.apply(t,r))}function _L(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 xL(t)}function xL(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function vC(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(vC=function(){return!!t})()}function tl(t){return tl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},tl(t)}function SL(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&&mm(t,e)}function mm(t,e){return mm=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},mm(t,e)}function DC(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?DC(Object(r),!0).forEach(function(n){AL(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):DC(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function AL(t,e,r){return e=EC(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function EC(t){var e=FL(t,"string");return Ri(e)=="symbol"?e:e+""}function FL(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 yC=Wt.defaultOptions=Ti(Ti({},hm.default.defaultOptions),{},{httpStack:new bC.default,fileReader:new yL.default,urlStorage:new DL.default,fingerprint:bL.default}),AY=Wt.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 vL(this,e),n=Ti(Ti({},yC),n),CL(this,e,[r,n])}return SL(e,t),EL(e,null,[{key:"terminate",value:function(n){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return o=Ti(Ti({},yC),o),hm.default.terminate(n,o)}}])})(hm.default),FY=Wt.isSupported=!0});var xC=C(($Y,_C)=>{var Ii=1e3,Bi=Ii*60,Ni=Bi*60,ko=Ni*24,$L=ko*7,PL=ko*365.25;_C.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return TL(t);if(r==="number"&&isFinite(t))return e.long?IL(t):RL(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function TL(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*PL;case"weeks":case"week":case"w":return r*$L;case"days":case"day":case"d":return r*ko;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Ni;case"minutes":case"minute":case"mins":case"min":case"m":return r*Bi;case"seconds":case"second":case"secs":case"sec":case"s":return r*Ii;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function RL(t){var e=Math.abs(t);return e>=ko?Math.round(t/ko)+"d":e>=Ni?Math.round(t/Ni)+"h":e>=Bi?Math.round(t/Bi)+"m":e>=Ii?Math.round(t/Ii)+"s":t+"ms"}function IL(t){var e=Math.abs(t);return e>=ko?rl(t,e,ko,"day"):e>=Ni?rl(t,e,Ni,"hour"):e>=Bi?rl(t,e,Bi,"minute"):e>=Ii?rl(t,e,Ii,"second"):t+" ms"}function rl(t,e,r,n){var o=e>=r*1.5;return Math.round(t/r)+" "+n+(o?"s":"")}});var ym=C((PY,SC)=>{function BL(t){r.debug=r,r.default=r,r.coerce=u,r.disable=s,r.enable=o,r.enabled=a,r.humanize=xC(),r.destroy=c,Object.keys(t).forEach(l=>{r[l]=t[l]}),r.names=[],r.skips=[],r.formatters={};function e(l){let f=0;for(let h=0;h<l.length;h++)f=(f<<5)-f+l.charCodeAt(h),f|=0;return r.colors[Math.abs(f)%r.colors.length]}r.selectColor=e;function r(l){let f,h=null,d,m;function b(...D){if(!b.enabled)return;let E=b,_=Number(new Date),g=_-(f||_);E.diff=g,E.prev=f,E.curr=_,f=_,D[0]=r.coerce(D[0]),typeof D[0]!="string"&&D.unshift("%O");let x=0;D[0]=D[0].replace(/%([a-zA-Z%])/g,(T,O)=>{if(T==="%%")return"%";x++;let B=r.formatters[O];if(typeof B=="function"){let I=D[x];T=B.call(E,I),D.splice(x,1),x--}return T}),r.formatArgs.call(E,D),(E.log||r.log).apply(E,D)}return b.namespace=l,b.useColors=r.useColors(),b.color=r.selectColor(l),b.extend=n,b.destroy=r.destroy,Object.defineProperty(b,"enabled",{enumerable:!0,configurable:!1,get:()=>h!==null?h:(d!==r.namespaces&&(d=r.namespaces,m=r.enabled(l)),m),set:D=>{h=D}}),typeof r.init=="function"&&r.init(b),b}function n(l,f){let h=r(this.namespace+(typeof f>"u"?":":f)+l);return h.log=this.log,h}function o(l){r.save(l),r.namespaces=l,r.names=[],r.skips=[];let f=(typeof l=="string"?l:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let h of f)h[0]==="-"?r.skips.push(h.slice(1)):r.names.push(h)}function i(l,f){let h=0,d=0,m=-1,b=0;for(;h<l.length;)if(d<f.length&&(f[d]===l[h]||f[d]==="*"))f[d]==="*"?(m=d,b=h,d++):(h++,d++);else if(m!==-1)d=m+1,b++,h=b;else return!1;for(;d<f.length&&f[d]==="*";)d++;return d===f.length}function s(){let l=[...r.names,...r.skips.map(f=>"-"+f)].join(",");return r.enable(""),l}function a(l){for(let f of r.skips)if(i(l,f))return!1;for(let f of r.names)if(i(l,f))return!0;return!1}function u(l){return l instanceof Error?l.stack||l.message:l}function c(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}SC.exports=BL});var AC=C((Kt,nl)=>{Kt.formatArgs=LL;Kt.save=jL;Kt.load=UL;Kt.useColors=NL;Kt.storage=ML();Kt.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`."))}})();Kt.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 NL(){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 LL(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)}Kt.log=console.debug||console.log||(()=>{});function jL(t){try{t?Kt.storage.setItem("debug",t):Kt.storage.removeItem("debug")}catch{}}function UL(){let t;try{t=Kt.storage.getItem("debug")||Kt.storage.getItem("DEBUG")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function ML(){try{return localStorage}catch{}}nl.exports=ym()(Kt);var{formatters:qL}=nl.exports;qL.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var OC=C((TY,FC)=>{"use strict";FC.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 PC=C((RY,$C)=>{"use strict";var HL=require("os"),kC=require("tty"),pr=OC(),{env:at}=process,Rn;pr("no-color")||pr("no-colors")||pr("color=false")||pr("color=never")?Rn=0:(pr("color")||pr("colors")||pr("color=true")||pr("color=always"))&&(Rn=1);"FORCE_COLOR"in at&&(at.FORCE_COLOR==="true"?Rn=1:at.FORCE_COLOR==="false"?Rn=0:Rn=at.FORCE_COLOR.length===0?1:Math.min(parseInt(at.FORCE_COLOR,10),3));function bm(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function wm(t,e){if(Rn===0)return 0;if(pr("color=16m")||pr("color=full")||pr("color=truecolor"))return 3;if(pr("color=256"))return 2;if(t&&!e&&Rn===void 0)return 0;let r=Rn||0;if(at.TERM==="dumb")return r;if(process.platform==="win32"){let n=HL.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in at)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in at)||at.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in at)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(at.TEAMCITY_VERSION)?1:0;if(at.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in at){let n=parseInt((at.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(at.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(at.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(at.TERM)||"COLORTERM"in at?1:r}function VL(t){let e=wm(t,t&&t.isTTY);return bm(e)}$C.exports={supportsColor:VL,stdout:bm(wm(!0,kC.isatty(1))),stderr:bm(wm(!0,kC.isatty(2)))}});var RC=C((ut,il)=>{var zL=require("tty"),ol=require("util");ut.init=ZL;ut.log=XL;ut.formatArgs=WL;ut.save=YL;ut.load=JL;ut.useColors=GL;ut.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`.");ut.colors=[6,2,3,4,5,1];try{let t=PC();t&&(t.stderr||t).level>=2&&(ut.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{}ut.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 GL(){return"colors"in ut.inspectOpts?!!ut.inspectOpts.colors:zL.isatty(process.stderr.fd)}function WL(t){let{namespace:e,useColors:r}=this;if(r){let n=this.color,o="\x1B[3"+(n<8?n:"8;5;"+n),i=` ${o};1m${e} \x1B[0m`;t[0]=i+t[0].split(`
43
+ `)}),e}});var Nw=x((az,jw)=>{var vn=require("constants"),YI=process.cwd,_c=null,JI=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return _c||(_c=YI.call(process)),_c};try{process.cwd()}catch{}typeof process.chdir=="function"&&(Eh=process.chdir,process.chdir=function(t){_c=null,Eh.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,Eh));var Eh;jw.exports=XI;function XI(t){vn.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&e(t),t.lutimes||r(t),t.chown=i(t.chown),t.fchown=i(t.fchown),t.lchown=i(t.lchown),t.chmod=n(t.chmod),t.fchmod=n(t.fchmod),t.lchmod=n(t.lchmod),t.chownSync=a(t.chownSync),t.fchownSync=a(t.fchownSync),t.lchownSync=a(t.lchownSync),t.chmodSync=o(t.chmodSync),t.fchmodSync=o(t.fchmodSync),t.lchmodSync=o(t.lchmodSync),t.stat=s(t.stat),t.fstat=s(t.fstat),t.lstat=s(t.lstat),t.statSync=u(t.statSync),t.fstatSync=u(t.fstatSync),t.lstatSync=u(t.lstatSync),t.chmod&&!t.lchmod&&(t.lchmod=function(l,f,d){d&&process.nextTick(d)},t.lchmodSync=function(){}),t.chown&&!t.lchown&&(t.lchown=function(l,f,d,h){h&&process.nextTick(h)},t.lchownSync=function(){}),JI==="win32"&&(t.rename=typeof t.rename!="function"?t.rename:(function(l){function f(d,h,m){var b=Date.now(),D=0;l(d,h,function C(E){if(E&&(E.code==="EACCES"||E.code==="EPERM"||E.code==="EBUSY")&&Date.now()-b<6e4){setTimeout(function(){t.stat(h,function(g,_){g&&g.code==="ENOENT"?l(d,h,C):m(E)})},D),D<100&&(D+=10);return}m&&m(E)})}return Object.setPrototypeOf&&Object.setPrototypeOf(f,l),f})(t.rename)),t.read=typeof t.read!="function"?t.read:(function(l){function f(d,h,m,b,D,C){var E;if(C&&typeof C=="function"){var g=0;E=function(_,S,T){if(_&&_.code==="EAGAIN"&&g<10)return g++,l.call(t,d,h,m,b,D,E);C.apply(this,arguments)}}return l.call(t,d,h,m,b,D,E)}return Object.setPrototypeOf&&Object.setPrototypeOf(f,l),f})(t.read),t.readSync=typeof t.readSync!="function"?t.readSync:(function(l){return function(f,d,h,m,b){for(var D=0;;)try{return l.call(t,f,d,h,m,b)}catch(C){if(C.code==="EAGAIN"&&D<10){D++;continue}throw C}}})(t.readSync);function e(l){l.lchmod=function(f,d,h){l.open(f,vn.O_WRONLY|vn.O_SYMLINK,d,function(m,b){if(m){h&&h(m);return}l.fchmod(b,d,function(D){l.close(b,function(C){h&&h(D||C)})})})},l.lchmodSync=function(f,d){var h=l.openSync(f,vn.O_WRONLY|vn.O_SYMLINK,d),m=!0,b;try{b=l.fchmodSync(h,d),m=!1}finally{if(m)try{l.closeSync(h)}catch{}else l.closeSync(h)}return b}}function r(l){vn.hasOwnProperty("O_SYMLINK")&&l.futimes?(l.lutimes=function(f,d,h,m){l.open(f,vn.O_SYMLINK,function(b,D){if(b){m&&m(b);return}l.futimes(D,d,h,function(C){l.close(D,function(E){m&&m(C||E)})})})},l.lutimesSync=function(f,d,h){var m=l.openSync(f,vn.O_SYMLINK),b,D=!0;try{b=l.futimesSync(m,d,h),D=!1}finally{if(D)try{l.closeSync(m)}catch{}else l.closeSync(m)}return b}):l.futimes&&(l.lutimes=function(f,d,h,m){m&&process.nextTick(m)},l.lutimesSync=function(){})}function n(l){return l&&function(f,d,h){return l.call(t,f,d,function(m){c(m)&&(m=null),h&&h.apply(this,arguments)})}}function o(l){return l&&function(f,d){try{return l.call(t,f,d)}catch(h){if(!c(h))throw h}}}function i(l){return l&&function(f,d,h,m){return l.call(t,f,d,h,function(b){c(b)&&(b=null),m&&m.apply(this,arguments)})}}function a(l){return l&&function(f,d,h){try{return l.call(t,f,d,h)}catch(m){if(!c(m))throw m}}}function s(l){return l&&function(f,d,h){typeof d=="function"&&(h=d,d=null);function m(b,D){D&&(D.uid<0&&(D.uid+=4294967296),D.gid<0&&(D.gid+=4294967296)),h&&h.apply(this,arguments)}return d?l.call(t,f,d,m):l.call(t,f,m)}}function u(l){return l&&function(f,d){var h=d?l.call(t,f,d):l.call(t,f);return h&&(h.uid<0&&(h.uid+=4294967296),h.gid<0&&(h.gid+=4294967296)),h}}function c(l){if(!l||l.code==="ENOSYS")return!0;var f=!process.getuid||process.getuid()!==0;return!!(f&&(l.code==="EINVAL"||l.code==="EPERM"))}}});var Mw=x((sz,Uw)=>{var Lw=require("stream").Stream;Uw.exports=ZI;function ZI(t){return{ReadStream:e,WriteStream:r};function e(n,o){if(!(this instanceof e))return new e(n,o);Lw.call(this);var i=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,o=o||{};for(var a=Object.keys(o),s=0,u=a.length;s<u;s++){var c=a[s];this[c]=o[c]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){i._read()});return}t.open(this.path,this.flags,this.mode,function(l,f){if(l){i.emit("error",l),i.readable=!1;return}i.fd=f,i.emit("open",f),i._read()})}function r(n,o){if(!(this instanceof r))return new r(n,o);Lw.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 Hw=x((uz,qw)=>{"use strict";qw.exports=eR;var QI=Object.getPrototypeOf||function(t){return t.__proto__};function eR(t){if(t===null||typeof t!="object")return t;if(t instanceof Object)var e={__proto__:QI(t)};else var e=Object.create(null);return Object.getOwnPropertyNames(t).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}});var wn=x((cz,Sh)=>{var He=require("fs"),tR=Nw(),rR=Mw(),nR=Hw(),xc=require("util"),ht,Fc;typeof Symbol=="function"&&typeof Symbol.for=="function"?(ht=Symbol.for("graceful-fs.queue"),Fc=Symbol.for("graceful-fs.previous")):(ht="___graceful-fs.queue",Fc="___graceful-fs.previous");function oR(){}function Gw(t,e){Object.defineProperty(t,ht,{get:function(){return e}})}var ho=oR;xc.debuglog?ho=xc.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(ho=function(){var t=xc.format.apply(xc,arguments);t="GFS4: "+t.split(/\n/).join(`
44
+ GFS4: `),console.error(t)});He[ht]||(Vw=global[ht]||[],Gw(He,Vw),He.close=(function(t){function e(r,n){return t.call(He,r,function(o){o||zw(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(e,Fc,{value:t}),e})(He.close),He.closeSync=(function(t){function e(r){t.apply(He,arguments),zw()}return Object.defineProperty(e,Fc,{value:t}),e})(He.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){ho(He[ht]),require("assert").equal(He[ht].length,0)}));var Vw;global[ht]||Gw(global,He[ht]);Sh.exports=_h(nR(He));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!He.__patched&&(Sh.exports=_h(He),He.__patched=!0);function _h(t){tR(t),t.gracefulify=_h,t.createReadStream=S,t.createWriteStream=T;var e=t.readFile;t.readFile=r;function r(R,N,A){return typeof N=="function"&&(A=N,N=null),U(R,N,A);function U(M,Q,$,y){return e(M,Q,function(v){v&&(v.code==="EMFILE"||v.code==="ENFILE")?mi([U,[M,Q,$],v,y||Date.now(),Date.now()]):typeof $=="function"&&$.apply(this,arguments)})}}var n=t.writeFile;t.writeFile=o;function o(R,N,A,U){return typeof A=="function"&&(U=A,A=null),M(R,N,A,U);function M(Q,$,y,v,w){return n(Q,$,y,function(F){F&&(F.code==="EMFILE"||F.code==="ENFILE")?mi([M,[Q,$,y,v],F,w||Date.now(),Date.now()]):typeof v=="function"&&v.apply(this,arguments)})}}var i=t.appendFile;i&&(t.appendFile=a);function a(R,N,A,U){return typeof A=="function"&&(U=A,A=null),M(R,N,A,U);function M(Q,$,y,v,w){return i(Q,$,y,function(F){F&&(F.code==="EMFILE"||F.code==="ENFILE")?mi([M,[Q,$,y,v],F,w||Date.now(),Date.now()]):typeof v=="function"&&v.apply(this,arguments)})}}var s=t.copyFile;s&&(t.copyFile=u);function u(R,N,A,U){return typeof A=="function"&&(U=A,A=0),M(R,N,A,U);function M(Q,$,y,v,w){return s(Q,$,y,function(F){F&&(F.code==="EMFILE"||F.code==="ENFILE")?mi([M,[Q,$,y,v],F,w||Date.now(),Date.now()]):typeof v=="function"&&v.apply(this,arguments)})}}var c=t.readdir;t.readdir=f;var l=/^v[0-5]\./;function f(R,N,A){typeof N=="function"&&(A=N,N=null);var U=l.test(process.version)?function($,y,v,w){return c($,M($,y,v,w))}:function($,y,v,w){return c($,y,M($,y,v,w))};return U(R,N,A);function M(Q,$,y,v){return function(w,F){w&&(w.code==="EMFILE"||w.code==="ENFILE")?mi([U,[Q,$,y],w,v||Date.now(),Date.now()]):(F&&F.sort&&F.sort(),typeof y=="function"&&y.call(this,w,F))}}}if(process.version.substr(0,4)==="v0.8"){var d=rR(t);C=d.ReadStream,g=d.WriteStream}var h=t.ReadStream;h&&(C.prototype=Object.create(h.prototype),C.prototype.open=E);var m=t.WriteStream;m&&(g.prototype=Object.create(m.prototype),g.prototype.open=_),Object.defineProperty(t,"ReadStream",{get:function(){return C},set:function(R){C=R},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WriteStream",{get:function(){return g},set:function(R){g=R},enumerable:!0,configurable:!0});var b=C;Object.defineProperty(t,"FileReadStream",{get:function(){return b},set:function(R){b=R},enumerable:!0,configurable:!0});var D=g;Object.defineProperty(t,"FileWriteStream",{get:function(){return D},set:function(R){D=R},enumerable:!0,configurable:!0});function C(R,N){return this instanceof C?(h.apply(this,arguments),this):C.apply(Object.create(C.prototype),arguments)}function E(){var R=this;B(R.path,R.flags,R.mode,function(N,A){N?(R.autoClose&&R.destroy(),R.emit("error",N)):(R.fd=A,R.emit("open",A),R.read())})}function g(R,N){return this instanceof g?(m.apply(this,arguments),this):g.apply(Object.create(g.prototype),arguments)}function _(){var R=this;B(R.path,R.flags,R.mode,function(N,A){N?(R.destroy(),R.emit("error",N)):(R.fd=A,R.emit("open",A))})}function S(R,N){return new t.ReadStream(R,N)}function T(R,N){return new t.WriteStream(R,N)}var O=t.open;t.open=B;function B(R,N,A,U){return typeof A=="function"&&(U=A,A=null),M(R,N,A,U);function M(Q,$,y,v,w){return O(Q,$,y,function(F,I){F&&(F.code==="EMFILE"||F.code==="ENFILE")?mi([M,[Q,$,y,v],F,w||Date.now(),Date.now()]):typeof v=="function"&&v.apply(this,arguments)})}}return t}function mi(t){ho("ENQUEUE",t[0].name,t[1]),He[ht].push(t),xh()}var Sc;function zw(){for(var t=Date.now(),e=0;e<He[ht].length;++e)He[ht][e].length>2&&(He[ht][e][3]=t,He[ht][e][4]=t);xh()}function xh(){if(clearTimeout(Sc),Sc=void 0,He[ht].length!==0){var t=He[ht].shift(),e=t[0],r=t[1],n=t[2],o=t[3],i=t[4];if(o===void 0)ho("RETRY",e.name,r),e.apply(null,r);else if(Date.now()-o>=6e4){ho("TIMEOUT",e.name,r);var a=r.pop();typeof a=="function"&&a.call(null,n)}else{var s=Date.now()-i,u=Math.max(i-o,1),c=Math.min(u*1.2,100);s>=c?(ho("RETRY",e.name,r),e.apply(null,r.concat([o]))):He[ht].push(t)}Sc===void 0&&(Sc=setTimeout(xh,0))}}});var Kw=x((lz,Ww)=>{function nr(t,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}Ww.exports=nr;nr.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};nr.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};nr.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=new Date().getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var r=this._timeouts.shift();if(r===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),r=this._timeouts.shift();else return!1;var n=this,o=setTimeout(function(){n._attempts++,n._operationTimeoutCb&&(n._timeout=setTimeout(function(){n._operationTimeoutCb(n._attempts)},n._operationTimeout),n._options.unref&&n._timeout.unref()),n._fn(n._attempts)},r);return this._options.unref&&o.unref(),!0};nr.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){r._operationTimeoutCb()},r._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};nr.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};nr.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};nr.prototype.start=nr.prototype.try;nr.prototype.errors=function(){return this._errors};nr.prototype.attempts=function(){return this._attempts};nr.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},e=null,r=0,n=0;n<this._errors.length;n++){var o=this._errors[n],i=o.message,a=(t[i]||0)+1;t[i]=a,a>=r&&(e=o,r=a)}return e}});var Yw=x(mo=>{var iR=Kw();mo.operation=function(t){var e=mo.timeouts(t);return new iR(e,{forever:t&&t.forever,unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};mo.timeouts=function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var r in t)e[r]=t[r];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var n=[],o=0;o<e.retries;o++)n.push(this.createTimeout(o,e));return t&&t.forever&&!n.length&&n.push(this.createTimeout(o,e)),n.sort(function(i,a){return i-a}),n};mo.createTimeout=function(t,e){var r=e.randomize?Math.random()+1:1,n=Math.round(r*e.minTimeout*Math.pow(e.factor,t));return n=Math.min(n,e.maxTimeout),n};mo.wrap=function(t,e,r){if(e instanceof Array&&(r=e,e=null),!r){r=[];for(var n in t)typeof t[n]=="function"&&r.push(n)}for(var o=0;o<r.length;o++){var i=r[o],a=t[i];t[i]=function(u){var c=mo.operation(e),l=Array.prototype.slice.call(arguments,1),f=l.pop();l.push(function(d){c.retry(d)||(d&&(arguments[0]=c.mainError()),f.apply(this,arguments))}),c.attempt(function(){u.apply(t,l)})}.bind(t,a),t[i].options=e}}});var Xw=x((pz,Jw)=>{Jw.exports=Yw()});var Zw=x((dz,Ac)=>{Ac.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&Ac.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Ac.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var Oh=x((hz,yi)=>{var je=global.process,go=function(t){return t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function"};go(je)?(Qw=require("assert"),gi=Zw(),eC=/^win/i.test(je.platform),Xa=require("events"),typeof Xa!="function"&&(Xa=Xa.EventEmitter),je.__signal_exit_emitter__?rt=je.__signal_exit_emitter__:(rt=je.__signal_exit_emitter__=new Xa,rt.count=0,rt.emitted={}),rt.infinite||(rt.setMaxListeners(1/0),rt.infinite=!0),yi.exports=function(t,e){if(!go(global.process))return function(){};Qw.equal(typeof t,"function","a callback must be provided for exit handler"),Di===!1&&Fh();var r="exit";e&&e.alwaysLast&&(r="afterexit");var n=function(){rt.removeListener(r,t),rt.listeners("exit").length===0&&rt.listeners("afterexit").length===0&&Oc()};return rt.on(r,t),n},Oc=function(){!Di||!go(global.process)||(Di=!1,gi.forEach(function(e){try{je.removeListener(e,kc[e])}catch{}}),je.emit=$c,je.reallyExit=Ah,rt.count-=1)},yi.exports.unload=Oc,Do=function(e,r,n){rt.emitted[e]||(rt.emitted[e]=!0,rt.emit(e,r,n))},kc={},gi.forEach(function(t){kc[t]=function(){if(go(global.process)){var r=je.listeners(t);r.length===rt.count&&(Oc(),Do("exit",null,t),Do("afterexit",null,t),eC&&t==="SIGHUP"&&(t="SIGINT"),je.kill(je.pid,t))}}}),yi.exports.signals=function(){return gi},Di=!1,Fh=function(){Di||!go(global.process)||(Di=!0,rt.count+=1,gi=gi.filter(function(e){try{return je.on(e,kc[e]),!0}catch{return!1}}),je.emit=rC,je.reallyExit=tC)},yi.exports.load=Fh,Ah=je.reallyExit,tC=function(e){go(global.process)&&(je.exitCode=e||0,Do("exit",je.exitCode,null),Do("afterexit",je.exitCode,null),Ah.call(je,je.exitCode))},$c=je.emit,rC=function(e,r){if(e==="exit"&&go(global.process)){r!==void 0&&(je.exitCode=r);var n=$c.apply(this,arguments);return Do("exit",je.exitCode,null),Do("afterexit",je.exitCode,null),n}else return $c.apply(this,arguments)}):yi.exports=function(){return function(){}};var Qw,gi,eC,Xa,rt,Oc,Do,kc,Di,Fh,Ah,tC,$c,rC});var oC=x((mz,kh)=>{"use strict";var nC=Symbol();function aR(t,e,r){let n=e[nC];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,nC,{value:u}),r(null,s.mtime,u)})})}function sR(t){let e=Date.now();return t==="s"&&(e=Math.ceil(e/1e3)*1e3),new Date(e)}kh.exports.probe=aR;kh.exports.getMtime=sR});var cC=x((gz,Qa)=>{"use strict";var uR=require("path"),Th=wn(),cR=Xw(),lR=Oh(),iC=oC(),Jr={};function Za(t,e){return e.lockfilePath||`${t}.lock`}function Ih(t,e,r){if(!e.realpath)return r(null,uR.resolve(t));e.fs.realpath(t,r)}function Ph(t,e,r){let n=Za(t,e);e.fs.mkdir(n,o=>{if(!o)return iC.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"?Ph(t,{...e,stale:0},r):r(i);if(!aC(a,e))return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:t}));sC(t,e,s=>{if(s)return r(s);Ph(t,{...e,stale:0},r)})})})}function aC(t,e){return t.mtime.getTime()<Date.now()-e.stale}function sC(t,e,r){e.fs.rmdir(Za(t,e),n=>{if(n&&n.code!=="ENOENT")return r(n);r()})}function Pc(t,e){let r=Jr[t];r.updateTimeout||(r.updateDelay=r.updateDelay||e.update,r.updateTimeout=setTimeout(()=>{r.updateTimeout=null,e.fs.stat(r.lockfilePath,(n,o)=>{let i=r.lastUpdate+e.stale<Date.now();if(n)return n.code==="ENOENT"||i?$h(t,r,Object.assign(n,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,Pc(t,e));if(!(r.mtime.getTime()===o.mtime.getTime()))return $h(t,r,Object.assign(new Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let s=iC.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?$h(t,r,Object.assign(u,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,Pc(t,e));r.mtime=s,r.lastUpdate=Date.now(),r.updateDelay=null,Pc(t,e)}})})},r.updateDelay),r.updateTimeout.unref&&r.updateTimeout.unref())}function $h(t,e,r){e.released=!0,e.updateTimeout&&clearTimeout(e.updateTimeout),Jr[t]===e&&delete Jr[t],e.options.onCompromised(r)}function fR(t,e,r){e={stale:1e4,update:null,realpath:!0,retries:0,fs:Th,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),Ih(t,e,(n,o)=>{if(n)return r(n);let i=cR.operation(e.retries);i.attempt(()=>{Ph(o,e,(a,s,u)=>{if(i.retry(a))return;if(a)return r(i.mainError());let c=Jr[o]={lockfilePath:Za(o,e),mtime:s,mtimePrecision:u,options:e,lastUpdate:Date.now()};Pc(o,e),r(null,l=>{if(c.released)return l&&l(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));uC(o,{...e,realpath:!1},l)})})})})}function uC(t,e,r){e={fs:Th,realpath:!0,...e},Ih(t,e,(n,o)=>{if(n)return r(n);let i=Jr[o];if(!i)return r(Object.assign(new Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));i.updateTimeout&&clearTimeout(i.updateTimeout),i.released=!0,delete Jr[o],sC(o,e,r)})}function pR(t,e,r){e={stale:1e4,realpath:!0,fs:Th,...e},e.stale=Math.max(e.stale||0,2e3),Ih(t,e,(n,o)=>{if(n)return r(n);e.fs.stat(Za(o,e),(i,a)=>i?i.code==="ENOENT"?r(null,!1):r(i):r(null,!aC(a,e)))})}function dR(){return Jr}lR(()=>{for(let t in Jr){let e=Jr[t].options;try{e.fs.rmdirSync(Za(t,e))}catch{}}});Qa.exports.lock=fR;Qa.exports.unlock=uC;Qa.exports.check=pR;Qa.exports.getLocks=dR});var fC=x((Dz,lC)=>{"use strict";var hR=wn();function mR(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 gR(t){return(...e)=>new Promise((r,n)=>{e.push((o,i)=>{o?n(o):r(i)}),t(...e)})}function DR(t){return(...e)=>{let r,n;if(e.push((o,i)=>{r=o,n=i}),t(...e),r)throw r;return n}}function yR(t){if(t={...t},t.fs=mR(t.fs||hR),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}lC.exports={toPromise:gR,toSync:DR,toSyncOptions:yR}});var dC=x((yz,Cn)=>{"use strict";var bi=cC(),{toPromise:Tc,toSync:Ic,toSyncOptions:Rh}=fC();async function pC(t,e){let r=await Tc(bi.lock)(t,e);return Tc(r)}function bR(t,e){let r=Ic(bi.lock)(t,Rh(e));return Ic(r)}function vR(t,e){return Tc(bi.unlock)(t,e)}function wR(t,e){return Ic(bi.unlock)(t,Rh(e))}function CR(t,e){return Tc(bi.check)(t,e)}function ER(t,e){return Ic(bi.check)(t,Rh(e))}Cn.exports=pC;Cn.exports.lock=pC;Cn.exports.unlock=vR;Cn.exports.lockSync=bR;Cn.exports.unlockSync=wR;Cn.exports.check=CR;Cn.exports.checkSync=ER});var yC=x(vi=>{"use strict";Object.defineProperty(vi,"__esModule",{value:!0});vi.canStoreURLs=vi.FileUrlStorage=void 0;var hC=require("fs"),_R=SR(Bw()),mC=xR(dC());function DC(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(DC=function(n){return n?r:e})(t)}function xR(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=DC(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 SR(t){return t&&t.__esModule?t:{default:t}}function es(t){"@babel/helpers - typeof";return es=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},es(t)}function FR(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,OR(n.key),n)}}function AR(t,e,r){return e&&gC(t.prototype,e),r&&gC(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function OR(t){var e=kR(t,"string");return es(e)=="symbol"?e:e+""}function kR(t,e){if(es(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(es(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var bz=vi.canStoreURLs=!0,vz=vi.FileUrlStorage=(function(){function t(e){FR(this,t),this.path=e}return AR(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;mC.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;mC.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,_R.default)([o,i]))});return}r().then(n).catch(n)}}},{key:"_writeData",value:function(r,n){var o={encoding:"utf8",mode:432,flag:"w"};(0,hC.writeFile)(this.path,JSON.stringify(r),o,function(i){return n(i)})}},{key:"_getData",value:function(r){(0,hC.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 Nh=x(Lt=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:!0});Object.defineProperty(Lt,"DefaultHttpStack",{enumerable:!0,get:function(){return CC.default}});Object.defineProperty(Lt,"DetailedError",{enumerable:!0,get:function(){return $R.default}});Object.defineProperty(Lt,"FileUrlStorage",{enumerable:!0,get:function(){return EC.FileUrlStorage}});Object.defineProperty(Lt,"StreamSource",{enumerable:!0,get:function(){return BR.default}});Lt.Upload=void 0;Object.defineProperty(Lt,"canStoreURLs",{enumerable:!0,get:function(){return EC.canStoreURLs}});Lt.defaultOptions=void 0;Object.defineProperty(Lt,"enableDebugLog",{enumerable:!0,get:function(){return PR.enableDebugLog}});Lt.isSupported=void 0;var $R=yo($d()),PR=Pd(),TR=yo(yb()),Bh=yo(Kb()),IR=yo(sv()),RR=yo(fv()),CC=yo(xv()),BR=yo(Gd()),EC=yC();function yo(t){return t&&t.__esModule?t:{default:t}}function Ci(t){"@babel/helpers - typeof";return Ci=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ci(t)}function jR(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function bC(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,xC(n.key),n)}}function NR(t,e,r){return e&&bC(t.prototype,e),r&&bC(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function LR(t,e,r){return e=Rc(e),UR(t,_C()?Reflect.construct(e,r||[],Rc(t).constructor):e.apply(t,r))}function UR(t,e){if(e&&(Ci(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return MR(t)}function MR(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _C(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(_C=function(){return!!t})()}function Rc(t){return Rc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Rc(t)}function qR(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&&jh(t,e)}function jh(t,e){return jh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},jh(t,e)}function vC(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r.push.apply(r,n)}return r}function wi(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?vC(Object(r),!0).forEach(function(n){HR(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):vC(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function HR(t,e,r){return e=xC(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function xC(t){var e=VR(t,"string");return Ci(e)=="symbol"?e:e+""}function VR(t,e){if(Ci(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Ci(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var wC=Lt.defaultOptions=wi(wi({},Bh.default.defaultOptions),{},{httpStack:new CC.default,fileReader:new IR.default,urlStorage:new TR.default,fingerprint:RR.default}),Cz=Lt.Upload=(function(t){function e(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return jR(this,e),n=wi(wi({},wC),n),LR(this,e,[r,n])}return qR(e,t),NR(e,null,[{key:"terminate",value:function(n){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return o=wi(wi({},wC),o),Bh.default.terminate(n,o)}}])})(Bh.default),Ez=Lt.isSupported=!0});var AC=x((Sz,FC)=>{var Ei=1e3,_i=Ei*60,xi=_i*60,bo=xi*24,WR=bo*7,KR=bo*365.25;FC.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return YR(t);if(r==="number"&&isFinite(t))return e.long?XR(t):JR(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function YR(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*KR;case"weeks":case"week":case"w":return r*WR;case"days":case"day":case"d":return r*bo;case"hours":case"hour":case"hrs":case"hr":case"h":return r*xi;case"minutes":case"minute":case"mins":case"min":case"m":return r*_i;case"seconds":case"second":case"secs":case"sec":case"s":return r*Ei;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function JR(t){var e=Math.abs(t);return e>=bo?Math.round(t/bo)+"d":e>=xi?Math.round(t/xi)+"h":e>=_i?Math.round(t/_i)+"m":e>=Ei?Math.round(t/Ei)+"s":t+"ms"}function XR(t){var e=Math.abs(t);return e>=bo?Bc(t,e,bo,"day"):e>=xi?Bc(t,e,xi,"hour"):e>=_i?Bc(t,e,_i,"minute"):e>=Ei?Bc(t,e,Ei,"second"):t+" ms"}function Bc(t,e,r,n){var o=e>=r*1.5;return Math.round(t/r)+" "+n+(o?"s":"")}});var Uh=x((Fz,OC)=>{function ZR(t){r.debug=r,r.default=r,r.coerce=u,r.disable=a,r.enable=o,r.enabled=s,r.humanize=AC(),r.destroy=c,Object.keys(t).forEach(l=>{r[l]=t[l]}),r.names=[],r.skips=[],r.formatters={};function e(l){let f=0;for(let d=0;d<l.length;d++)f=(f<<5)-f+l.charCodeAt(d),f|=0;return r.colors[Math.abs(f)%r.colors.length]}r.selectColor=e;function r(l){let f,d=null,h,m;function b(...D){if(!b.enabled)return;let C=b,E=Number(new Date),g=E-(f||E);C.diff=g,C.prev=f,C.curr=E,f=E,D[0]=r.coerce(D[0]),typeof D[0]!="string"&&D.unshift("%O");let _=0;D[0]=D[0].replace(/%([a-zA-Z%])/g,(T,O)=>{if(T==="%%")return"%";_++;let B=r.formatters[O];if(typeof B=="function"){let R=D[_];T=B.call(C,R),D.splice(_,1),_--}return T}),r.formatArgs.call(C,D),(C.log||r.log).apply(C,D)}return b.namespace=l,b.useColors=r.useColors(),b.color=r.selectColor(l),b.extend=n,b.destroy=r.destroy,Object.defineProperty(b,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(h!==r.namespaces&&(h=r.namespaces,m=r.enabled(l)),m),set:D=>{d=D}}),typeof r.init=="function"&&r.init(b),b}function n(l,f){let d=r(this.namespace+(typeof f>"u"?":":f)+l);return d.log=this.log,d}function o(l){r.save(l),r.namespaces=l,r.names=[],r.skips=[];let f=(typeof l=="string"?l:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let d of f)d[0]==="-"?r.skips.push(d.slice(1)):r.names.push(d)}function i(l,f){let d=0,h=0,m=-1,b=0;for(;d<l.length;)if(h<f.length&&(f[h]===l[d]||f[h]==="*"))f[h]==="*"?(m=h,b=d,h++):(d++,h++);else if(m!==-1)h=m+1,b++,d=b;else return!1;for(;h<f.length&&f[h]==="*";)h++;return h===f.length}function a(){let l=[...r.names,...r.skips.map(f=>"-"+f)].join(",");return r.enable(""),l}function s(l){for(let f of r.skips)if(i(l,f))return!1;for(let f of r.names)if(i(l,f))return!0;return!1}function u(l){return l instanceof Error?l.stack||l.message:l}function c(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}OC.exports=ZR});var kC=x((Ut,jc)=>{Ut.formatArgs=eB;Ut.save=tB;Ut.load=rB;Ut.useColors=QR;Ut.storage=nB();Ut.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();Ut.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function QR(){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 eB(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+jc.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,n=0;t[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(r++,o==="%c"&&(n=r))}),t.splice(n,0,e)}Ut.log=console.debug||console.log||(()=>{});function tB(t){try{t?Ut.storage.setItem("debug",t):Ut.storage.removeItem("debug")}catch{}}function rB(){let t;try{t=Ut.storage.getItem("debug")||Ut.storage.getItem("DEBUG")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function nB(){try{return localStorage}catch{}}jc.exports=Uh()(Ut);var{formatters:oB}=jc.exports;oB.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var PC=x((Az,$C)=>{"use strict";$C.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 RC=x((Oz,IC)=>{"use strict";var iB=require("os"),TC=require("tty"),or=PC(),{env:nt}=process,En;or("no-color")||or("no-colors")||or("color=false")||or("color=never")?En=0:(or("color")||or("colors")||or("color=true")||or("color=always"))&&(En=1);"FORCE_COLOR"in nt&&(nt.FORCE_COLOR==="true"?En=1:nt.FORCE_COLOR==="false"?En=0:En=nt.FORCE_COLOR.length===0?1:Math.min(parseInt(nt.FORCE_COLOR,10),3));function Mh(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function qh(t,e){if(En===0)return 0;if(or("color=16m")||or("color=full")||or("color=truecolor"))return 3;if(or("color=256"))return 2;if(t&&!e&&En===void 0)return 0;let r=En||0;if(nt.TERM==="dumb")return r;if(process.platform==="win32"){let n=iB.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in nt)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in nt)||nt.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in nt)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(nt.TEAMCITY_VERSION)?1:0;if(nt.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in nt){let n=parseInt((nt.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(nt.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(nt.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(nt.TERM)||"COLORTERM"in nt?1:r}function aB(t){let e=qh(t,t&&t.isTTY);return Mh(e)}IC.exports={supportsColor:aB,stdout:Mh(qh(!0,TC.isatty(1))),stderr:Mh(qh(!0,TC.isatty(2)))}});var jC=x((ot,Lc)=>{var sB=require("tty"),Nc=require("util");ot.init=hB;ot.log=fB;ot.formatArgs=cB;ot.save=pB;ot.load=dB;ot.useColors=uB;ot.destroy=Nc.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");ot.colors=[6,2,3,4,5,1];try{let t=RC();t&&(t.stderr||t).level>=2&&(ot.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{}ot.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 uB(){return"colors"in ot.inspectOpts?!!ot.inspectOpts.colors:sB.isatty(process.stderr.fd)}function cB(t){let{namespace:e,useColors:r}=this;if(r){let n=this.color,o="\x1B[3"+(n<8?n:"8;5;"+n),i=` ${o};1m${e} \x1B[0m`;t[0]=i+t[0].split(`
45
45
  `).join(`
46
- `+i),t.push(o+"m+"+il.exports.humanize(this.diff)+"\x1B[0m")}else t[0]=KL()+e+" "+t[0]}function KL(){return ut.inspectOpts.hideDate?"":new Date().toISOString()+" "}function XL(...t){return process.stderr.write(ol.formatWithOptions(ut.inspectOpts,...t)+`
47
- `)}function YL(t){t?process.env.DEBUG=t:delete process.env.DEBUG}function JL(){return process.env.DEBUG}function ZL(t){t.inspectOpts={};let e=Object.keys(ut.inspectOpts);for(let r=0;r<e.length;r++)t.inspectOpts[e[r]]=ut.inspectOpts[e[r]]}il.exports=ym()(ut);var{formatters:TC}=il.exports;TC.o=function(t){return this.inspectOpts.colors=this.useColors,ol.inspect(t,this.inspectOpts).split(`
48
- `).map(e=>e.trim()).join(" ")};TC.O=function(t){return this.inspectOpts.colors=this.useColors,ol.inspect(t,this.inspectOpts)}});var Em=C((IY,vm)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?vm.exports=AC():vm.exports=RC()});var ct=C(Cm=>{"use strict";Cm.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})};Cm.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 Nt=C(cn=>{"use strict";var IC=ct().fromCallback,Bt=Pn(),QL=["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 Bt[t]=="function");Object.assign(cn,Bt);QL.forEach(t=>{cn[t]=IC(Bt[t])});cn.exists=function(t,e){return typeof e=="function"?Bt.exists(t,e):new Promise(r=>Bt.exists(t,r))};cn.read=function(t,e,r,n,o,i){return typeof i=="function"?Bt.read(t,e,r,n,o,i):new Promise((s,a)=>{Bt.read(t,e,r,n,o,(u,c,l)=>{if(u)return a(u);s({bytesRead:c,buffer:l})})})};cn.write=function(t,e,...r){return typeof r[r.length-1]=="function"?Bt.write(t,e,...r):new Promise((n,o)=>{Bt.write(t,e,...r,(i,s,a)=>{if(i)return o(i);n({bytesWritten:s,buffer:a})})})};cn.readv=function(t,e,...r){return typeof r[r.length-1]=="function"?Bt.readv(t,e,...r):new Promise((n,o)=>{Bt.readv(t,e,...r,(i,s,a)=>{if(i)return o(i);n({bytesRead:s,buffers:a})})})};cn.writev=function(t,e,...r){return typeof r[r.length-1]=="function"?Bt.writev(t,e,...r):new Promise((n,o)=>{Bt.writev(t,e,...r,(i,s,a)=>{if(i)return o(i);n({bytesWritten:s,buffers:a})})})};typeof Bt.realpath.native=="function"?cn.realpath.native=IC(Bt.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")});var NC=C((LY,BC)=>{"use strict";var ej=require("path");BC.exports.checkPath=function(e){if(process.platform==="win32"&&/[<>:"|?*]/.test(e.replace(ej.parse(e).root,""))){let n=new Error(`Path contains invalid characters: ${e}`);throw n.code="EINVAL",n}}});var MC=C((jY,_m)=>{"use strict";var LC=Nt(),{checkPath:jC}=NC(),UC=t=>{let e={mode:511};return typeof t=="number"?t:{...e,...t}.mode};_m.exports.makeDir=async(t,e)=>(jC(t),LC.mkdir(t,{mode:UC(e),recursive:!0}));_m.exports.makeDirSync=(t,e)=>(jC(t),LC.mkdirSync(t,{mode:UC(e),recursive:!0}))});var Pr=C((UY,qC)=>{"use strict";var tj=ct().fromPromise,{makeDir:rj,makeDirSync:xm}=MC(),Sm=tj(rj);qC.exports={mkdirs:Sm,mkdirsSync:xm,mkdirp:Sm,mkdirpSync:xm,ensureDir:Sm,ensureDirSync:xm}});var In=C((MY,VC)=>{"use strict";var nj=ct().fromPromise,HC=Nt();function oj(t){return HC.access(t).then(()=>!0).catch(()=>!1)}VC.exports={pathExists:nj(oj),pathExistsSync:HC.existsSync}});var Am=C((qY,zC)=>{"use strict";var Li=Nt(),ij=ct().fromPromise;async function sj(t,e,r){let n=await Li.open(t,"r+"),o=null;try{await Li.futimes(n,e,r)}finally{try{await Li.close(n)}catch(i){o=i}}if(o)throw o}function aj(t,e,r){let n=Li.openSync(t,"r+");return Li.futimesSync(n,e,r),Li.closeSync(n)}zC.exports={utimesMillis:ij(sj),utimesMillisSync:aj}});var $o=C((HY,XC)=>{"use strict";var ji=Nt(),lt=require("path"),GC=ct().fromPromise;function uj(t,e,r){let n=r.dereference?o=>ji.stat(o,{bigint:!0}):o=>ji.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 cj(t,e,r){let n,o=r.dereference?s=>ji.statSync(s,{bigint:!0}):s=>ji.lstatSync(s,{bigint:!0}),i=o(t);try{n=o(e)}catch(s){if(s.code==="ENOENT")return{srcStat:i,destStat:null};throw s}return{srcStat:i,destStat:n}}async function lj(t,e,r,n){let{srcStat:o,destStat:i}=await uj(t,e,n);if(i){if(ha(o,i)){let s=lt.basename(t),a=lt.basename(e);if(r==="move"&&s!==a&&s.toLowerCase()===a.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()&&Fm(t,e))throw new Error(sl(t,e,r));return{srcStat:o,destStat:i}}function fj(t,e,r,n){let{srcStat:o,destStat:i}=cj(t,e,n);if(i){if(ha(o,i)){let s=lt.basename(t),a=lt.basename(e);if(r==="move"&&s!==a&&s.toLowerCase()===a.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()&&Fm(t,e))throw new Error(sl(t,e,r));return{srcStat:o,destStat:i}}async function WC(t,e,r,n){let o=lt.resolve(lt.dirname(t)),i=lt.resolve(lt.dirname(r));if(i===o||i===lt.parse(i).root)return;let s;try{s=await ji.stat(i,{bigint:!0})}catch(a){if(a.code==="ENOENT")return;throw a}if(ha(e,s))throw new Error(sl(t,r,n));return WC(t,e,i,n)}function KC(t,e,r,n){let o=lt.resolve(lt.dirname(t)),i=lt.resolve(lt.dirname(r));if(i===o||i===lt.parse(i).root)return;let s;try{s=ji.statSync(i,{bigint:!0})}catch(a){if(a.code==="ENOENT")return;throw a}if(ha(e,s))throw new Error(sl(t,r,n));return KC(t,e,i,n)}function ha(t,e){return e.ino!==void 0&&e.dev!==void 0&&e.ino===t.ino&&e.dev===t.dev}function Fm(t,e){let r=lt.resolve(t).split(lt.sep).filter(o=>o),n=lt.resolve(e).split(lt.sep).filter(o=>o);return r.every((o,i)=>n[i]===o)}function sl(t,e,r){return`Cannot ${r} '${t}' to a subdirectory of itself, '${e}'.`}XC.exports={checkPaths:GC(lj),checkPathsSync:fj,checkParentPaths:GC(WC),checkParentPathsSync:KC,isSrcSubdir:Fm,areIdentical:ha}});var JC=C((VY,YC)=>{"use strict";async function pj(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})))}YC.exports={asyncIteratorConcurrentProcess:pj}});var r_=C((zY,t_)=>{"use strict";var Et=Nt(),ma=require("path"),{mkdirs:dj}=Pr(),{pathExists:hj}=In(),{utimesMillis:mj}=Am(),ga=$o(),{asyncIteratorConcurrentProcess:gj}=JC();async function Dj(t,e,r={}){typeof r=="function"&&(r={filter:r}),r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
46
+ `+i),t.push(o+"m+"+Lc.exports.humanize(this.diff)+"\x1B[0m")}else t[0]=lB()+e+" "+t[0]}function lB(){return ot.inspectOpts.hideDate?"":new Date().toISOString()+" "}function fB(...t){return process.stderr.write(Nc.formatWithOptions(ot.inspectOpts,...t)+`
47
+ `)}function pB(t){t?process.env.DEBUG=t:delete process.env.DEBUG}function dB(){return process.env.DEBUG}function hB(t){t.inspectOpts={};let e=Object.keys(ot.inspectOpts);for(let r=0;r<e.length;r++)t.inspectOpts[e[r]]=ot.inspectOpts[e[r]]}Lc.exports=Uh()(ot);var{formatters:BC}=Lc.exports;BC.o=function(t){return this.inspectOpts.colors=this.useColors,Nc.inspect(t,this.inspectOpts).split(`
48
+ `).map(e=>e.trim()).join(" ")};BC.O=function(t){return this.inspectOpts.colors=this.useColors,Nc.inspect(t,this.inspectOpts)}});var Vh=x((kz,Hh)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?Hh.exports=kC():Hh.exports=jC()});var it=x(zh=>{"use strict";zh.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})};zh.fromPromise=function(t){return Object.defineProperty(function(...e){let r=e[e.length-1];if(typeof r!="function")return t.apply(this,e);e.pop(),t.apply(this,e).then(n=>r(null,n),r)},"name",{value:t.name})}});var $t=x(Zr=>{"use strict";var NC=it().fromCallback,kt=wn(),mB=["access","appendFile","chmod","chown","close","copyFile","cp","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","glob","lchmod","lchown","lutimes","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","statfs","symlink","truncate","unlink","utimes","writeFile"].filter(t=>typeof kt[t]=="function");Object.assign(Zr,kt);mB.forEach(t=>{Zr[t]=NC(kt[t])});Zr.exists=function(t,e){return typeof e=="function"?kt.exists(t,e):new Promise(r=>kt.exists(t,r))};Zr.read=function(t,e,r,n,o,i){return typeof i=="function"?kt.read(t,e,r,n,o,i):new Promise((a,s)=>{kt.read(t,e,r,n,o,(u,c,l)=>{if(u)return s(u);a({bytesRead:c,buffer:l})})})};Zr.write=function(t,e,...r){return typeof r[r.length-1]=="function"?kt.write(t,e,...r):new Promise((n,o)=>{kt.write(t,e,...r,(i,a,s)=>{if(i)return o(i);n({bytesWritten:a,buffer:s})})})};Zr.readv=function(t,e,...r){return typeof r[r.length-1]=="function"?kt.readv(t,e,...r):new Promise((n,o)=>{kt.readv(t,e,...r,(i,a,s)=>{if(i)return o(i);n({bytesRead:a,buffers:s})})})};Zr.writev=function(t,e,...r){return typeof r[r.length-1]=="function"?kt.writev(t,e,...r):new Promise((n,o)=>{kt.writev(t,e,...r,(i,a,s)=>{if(i)return o(i);n({bytesWritten:a,buffers:s})})})};typeof kt.realpath.native=="function"?Zr.realpath.native=NC(kt.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")});var UC=x((Tz,LC)=>{"use strict";var gB=require("path");LC.exports.checkPath=function(e){if(process.platform==="win32"&&/[<>:"|?*]/.test(e.replace(gB.parse(e).root,""))){let n=new Error(`Path contains invalid characters: ${e}`);throw n.code="EINVAL",n}}});var VC=x((Iz,Gh)=>{"use strict";var MC=$t(),{checkPath:qC}=UC(),HC=t=>{let e={mode:511};return typeof t=="number"?t:{...e,...t}.mode};Gh.exports.makeDir=async(t,e)=>(qC(t),MC.mkdir(t,{mode:HC(e),recursive:!0}));Gh.exports.makeDirSync=(t,e)=>(qC(t),MC.mkdirSync(t,{mode:HC(e),recursive:!0}))});var Cr=x((Rz,zC)=>{"use strict";var DB=it().fromPromise,{makeDir:yB,makeDirSync:Wh}=VC(),Kh=DB(yB);zC.exports={mkdirs:Kh,mkdirsSync:Wh,mkdirp:Kh,mkdirpSync:Wh,ensureDir:Kh,ensureDirSync:Wh}});var _n=x((Bz,WC)=>{"use strict";var bB=it().fromPromise,GC=$t();function vB(t){return GC.access(t).then(()=>!0).catch(()=>!1)}WC.exports={pathExists:bB(vB),pathExistsSync:GC.existsSync}});var Yh=x((jz,KC)=>{"use strict";var Si=$t(),wB=it().fromPromise;async function CB(t,e,r){let n=await Si.open(t,"r+"),o=null;try{await Si.futimes(n,e,r)}finally{try{await Si.close(n)}catch(i){o=i}}if(o)throw o}function EB(t,e,r){let n=Si.openSync(t,"r+");return Si.futimesSync(n,e,r),Si.closeSync(n)}KC.exports={utimesMillis:wB(CB),utimesMillisSync:EB}});var vo=x((Nz,ZC)=>{"use strict";var Fi=$t(),at=require("path"),YC=it().fromPromise;function _B(t,e,r){let n=r.dereference?o=>Fi.stat(o,{bigint:!0}):o=>Fi.lstat(o,{bigint:!0});return Promise.all([n(t),n(e).catch(o=>{if(o.code==="ENOENT")return null;throw o})]).then(([o,i])=>({srcStat:o,destStat:i}))}function xB(t,e,r){let n,o=r.dereference?a=>Fi.statSync(a,{bigint:!0}):a=>Fi.lstatSync(a,{bigint:!0}),i=o(t);try{n=o(e)}catch(a){if(a.code==="ENOENT")return{srcStat:i,destStat:null};throw a}return{srcStat:i,destStat:n}}async function SB(t,e,r,n){let{srcStat:o,destStat:i}=await _B(t,e,n);if(i){if(ts(o,i)){let a=at.basename(t),s=at.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()&&Jh(t,e))throw new Error(Uc(t,e,r));return{srcStat:o,destStat:i}}function FB(t,e,r,n){let{srcStat:o,destStat:i}=xB(t,e,n);if(i){if(ts(o,i)){let a=at.basename(t),s=at.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()&&Jh(t,e))throw new Error(Uc(t,e,r));return{srcStat:o,destStat:i}}async function JC(t,e,r,n){let o=at.resolve(at.dirname(t)),i=at.resolve(at.dirname(r));if(i===o||i===at.parse(i).root)return;let a;try{a=await Fi.stat(i,{bigint:!0})}catch(s){if(s.code==="ENOENT")return;throw s}if(ts(e,a))throw new Error(Uc(t,r,n));return JC(t,e,i,n)}function XC(t,e,r,n){let o=at.resolve(at.dirname(t)),i=at.resolve(at.dirname(r));if(i===o||i===at.parse(i).root)return;let a;try{a=Fi.statSync(i,{bigint:!0})}catch(s){if(s.code==="ENOENT")return;throw s}if(ts(e,a))throw new Error(Uc(t,r,n));return XC(t,e,i,n)}function ts(t,e){return e.ino!==void 0&&e.dev!==void 0&&e.ino===t.ino&&e.dev===t.dev}function Jh(t,e){let r=at.resolve(t).split(at.sep).filter(o=>o),n=at.resolve(e).split(at.sep).filter(o=>o);return r.every((o,i)=>n[i]===o)}function Uc(t,e,r){return`Cannot ${r} '${t}' to a subdirectory of itself, '${e}'.`}ZC.exports={checkPaths:YC(SB),checkPathsSync:FB,checkParentPaths:YC(JC),checkParentPathsSync:XC,isSrcSubdir:Jh,areIdentical:ts}});var eE=x((Lz,QC)=>{"use strict";async function AB(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})))}QC.exports={asyncIteratorConcurrentProcess:AB}});var iE=x((Uz,oE)=>{"use strict";var yt=$t(),rs=require("path"),{mkdirs:OB}=Cr(),{pathExists:kB}=_n(),{utimesMillis:$B}=Yh(),ns=vo(),{asyncIteratorConcurrentProcess:PB}=eE();async function TB(t,e,r={}){typeof r=="function"&&(r={filter:r}),r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
49
49
 
50
- see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0001");let{srcStat:n,destStat:o}=await ga.checkPaths(t,e,"copy",r);if(await ga.checkParentPaths(t,n,e,"copy"),!await QC(t,e,r))return;let s=ma.dirname(e);await hj(s)||await dj(s),await e_(o,t,e,r)}async function QC(t,e,r){return r.filter?r.filter(t,e):!0}async function e_(t,e,r,n){let i=await(n.dereference?Et.stat:Et.lstat)(e);if(i.isDirectory())return vj(i,t,e,r,n);if(i.isFile()||i.isCharacterDevice()||i.isBlockDevice())return yj(i,t,e,r,n);if(i.isSymbolicLink())return Ej(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 yj(t,e,r,n,o){if(!e)return ZC(t,r,n,o);if(o.overwrite)return await Et.unlink(n),ZC(t,r,n,o);if(o.errorOnExist)throw new Error(`'${n}' already exists`)}async function ZC(t,e,r,n){if(await Et.copyFile(e,r),n.preserveTimestamps){bj(t.mode)&&await wj(r,t.mode);let o=await Et.stat(e);await mj(r,o.atime,o.mtime)}return Et.chmod(r,t.mode)}function bj(t){return(t&128)===0}function wj(t,e){return Et.chmod(t,e|128)}async function vj(t,e,r,n,o){e||await Et.mkdir(n),await gj(await Et.opendir(r),async i=>{let s=ma.join(r,i.name),a=ma.join(n,i.name);if(await QC(s,a,o)){let{destStat:c}=await ga.checkPaths(s,a,"copy",o);await e_(c,s,a,o)}}),e||await Et.chmod(n,t.mode)}async function Ej(t,e,r,n){let o=await Et.readlink(e);if(n.dereference&&(o=ma.resolve(process.cwd(),o)),!t)return Et.symlink(o,r);let i=null;try{i=await Et.readlink(r)}catch(s){if(s.code==="EINVAL"||s.code==="UNKNOWN")return Et.symlink(o,r);throw s}if(n.dereference&&(i=ma.resolve(process.cwd(),i)),ga.isSrcSubdir(o,i))throw new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`);if(ga.isSrcSubdir(i,o))throw new Error(`Cannot overwrite '${i}' with '${o}'.`);return await Et.unlink(r),Et.symlink(o,r)}t_.exports=Dj});var a_=C((GY,s_)=>{"use strict";var Lt=Pn(),Da=require("path"),Cj=Pr().mkdirsSync,_j=Am().utimesMillisSync,ya=$o();function xj(t,e,r){typeof r=="function"&&(r={filter:r}),r=r||{},r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
50
+ see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0001");let{srcStat:n,destStat:o}=await ns.checkPaths(t,e,"copy",r);if(await ns.checkParentPaths(t,n,e,"copy"),!await rE(t,e,r))return;let a=rs.dirname(e);await kB(a)||await OB(a),await nE(o,t,e,r)}async function rE(t,e,r){return r.filter?r.filter(t,e):!0}async function nE(t,e,r,n){let i=await(n.dereference?yt.stat:yt.lstat)(e);if(i.isDirectory())return jB(i,t,e,r,n);if(i.isFile()||i.isCharacterDevice()||i.isBlockDevice())return IB(i,t,e,r,n);if(i.isSymbolicLink())return NB(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 IB(t,e,r,n,o){if(!e)return tE(t,r,n,o);if(o.overwrite)return await yt.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 yt.copyFile(e,r),n.preserveTimestamps){RB(t.mode)&&await BB(r,t.mode);let o=await yt.stat(e);await $B(r,o.atime,o.mtime)}return yt.chmod(r,t.mode)}function RB(t){return(t&128)===0}function BB(t,e){return yt.chmod(t,e|128)}async function jB(t,e,r,n,o){e||await yt.mkdir(n),await PB(await yt.opendir(r),async i=>{let a=rs.join(r,i.name),s=rs.join(n,i.name);if(await rE(a,s,o)){let{destStat:c}=await ns.checkPaths(a,s,"copy",o);await nE(c,a,s,o)}}),e||await yt.chmod(n,t.mode)}async function NB(t,e,r,n){let o=await yt.readlink(e);if(n.dereference&&(o=rs.resolve(process.cwd(),o)),!t)return yt.symlink(o,r);let i=null;try{i=await yt.readlink(r)}catch(a){if(a.code==="EINVAL"||a.code==="UNKNOWN")return yt.symlink(o,r);throw a}if(n.dereference&&(i=rs.resolve(process.cwd(),i)),ns.isSrcSubdir(o,i))throw new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`);if(ns.isSrcSubdir(i,o))throw new Error(`Cannot overwrite '${i}' with '${o}'.`);return await yt.unlink(r),yt.symlink(o,r)}oE.exports=TB});var lE=x((Mz,cE)=>{"use strict";var Pt=wn(),os=require("path"),LB=Cr().mkdirsSync,UB=Yh().utimesMillisSync,is=vo();function MB(t,e,r){typeof r=="function"&&(r={filter:r}),r=r||{},r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
51
51
 
52
- see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0002");let{srcStat:n,destStat:o}=ya.checkPathsSync(t,e,"copy",r);if(ya.checkParentPathsSync(t,n,e,"copy"),r.filter&&!r.filter(t,e))return;let i=Da.dirname(e);return Lt.existsSync(i)||Cj(i),n_(o,t,e,r)}function n_(t,e,r,n){let i=(n.dereference?Lt.statSync:Lt.lstatSync)(e);if(i.isDirectory())return Pj(i,t,e,r,n);if(i.isFile()||i.isCharacterDevice()||i.isBlockDevice())return Sj(i,t,e,r,n);if(i.isSymbolicLink())return Ij(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 Sj(t,e,r,n,o){return e?Aj(t,r,n,o):o_(t,r,n,o)}function Aj(t,e,r,n){if(n.overwrite)return Lt.unlinkSync(r),o_(t,e,r,n);if(n.errorOnExist)throw new Error(`'${r}' already exists`)}function o_(t,e,r,n){return Lt.copyFileSync(e,r),n.preserveTimestamps&&Fj(t.mode,e,r),Om(r,t.mode)}function Fj(t,e,r){return Oj(t)&&kj(r,t),$j(e,r)}function Oj(t){return(t&128)===0}function kj(t,e){return Om(t,e|128)}function Om(t,e){return Lt.chmodSync(t,e)}function $j(t,e){let r=Lt.statSync(t);return _j(e,r.atime,r.mtime)}function Pj(t,e,r,n,o){return e?i_(r,n,o):Tj(t.mode,r,n,o)}function Tj(t,e,r,n){return Lt.mkdirSync(r),i_(e,r,n),Om(r,t)}function i_(t,e,r){let n=Lt.opendirSync(t);try{let o;for(;(o=n.readSync())!==null;)Rj(o.name,t,e,r)}finally{n.closeSync()}}function Rj(t,e,r,n){let o=Da.join(e,t),i=Da.join(r,t);if(n.filter&&!n.filter(o,i))return;let{destStat:s}=ya.checkPathsSync(o,i,"copy",n);return n_(s,o,i,n)}function Ij(t,e,r,n){let o=Lt.readlinkSync(e);if(n.dereference&&(o=Da.resolve(process.cwd(),o)),t){let i;try{i=Lt.readlinkSync(r)}catch(s){if(s.code==="EINVAL"||s.code==="UNKNOWN")return Lt.symlinkSync(o,r);throw s}if(n.dereference&&(i=Da.resolve(process.cwd(),i)),ya.isSrcSubdir(o,i))throw new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`);if(ya.isSrcSubdir(i,o))throw new Error(`Cannot overwrite '${i}' with '${o}'.`);return Bj(o,r)}else return Lt.symlinkSync(o,r)}function Bj(t,e){return Lt.unlinkSync(e),Lt.symlinkSync(t,e)}s_.exports=xj});var al=C((WY,u_)=>{"use strict";var Nj=ct().fromPromise;u_.exports={copy:Nj(r_()),copySync:a_()}});var ba=C((KY,l_)=>{"use strict";var c_=Pn(),Lj=ct().fromCallback;function jj(t,e){c_.rm(t,{recursive:!0,force:!0},e)}function Uj(t){c_.rmSync(t,{recursive:!0,force:!0})}l_.exports={remove:Lj(jj),removeSync:Uj}});var y_=C((XY,D_)=>{"use strict";var Mj=ct().fromPromise,d_=Nt(),h_=require("path"),m_=Pr(),g_=ba(),f_=Mj(async function(e){let r;try{r=await d_.readdir(e)}catch{return m_.mkdirs(e)}return Promise.all(r.map(n=>g_.remove(h_.join(e,n))))});function p_(t){let e;try{e=d_.readdirSync(t)}catch{return m_.mkdirsSync(t)}e.forEach(r=>{r=h_.join(t,r),g_.removeSync(r)})}D_.exports={emptyDirSync:p_,emptydirSync:p_,emptyDir:f_,emptydir:f_}});var E_=C((YY,v_)=>{"use strict";var qj=ct().fromPromise,b_=require("path"),ln=Nt(),w_=Pr();async function Hj(t){let e;try{e=await ln.stat(t)}catch{}if(e&&e.isFile())return;let r=b_.dirname(t),n=null;try{n=await ln.stat(r)}catch(o){if(o.code==="ENOENT"){await w_.mkdirs(r),await ln.writeFile(t,"");return}else throw o}n.isDirectory()?await ln.writeFile(t,""):await ln.readdir(r)}function Vj(t){let e;try{e=ln.statSync(t)}catch{}if(e&&e.isFile())return;let r=b_.dirname(t);try{ln.statSync(r).isDirectory()||ln.readdirSync(r)}catch(n){if(n&&n.code==="ENOENT")w_.mkdirsSync(r);else throw n}ln.writeFileSync(t,"")}v_.exports={createFile:qj(Hj),createFileSync:Vj}});var A_=C((JY,S_)=>{"use strict";var zj=ct().fromPromise,C_=require("path"),Bn=Nt(),__=Pr(),{pathExists:Gj}=In(),{areIdentical:x_}=$o();async function Wj(t,e){let r;try{r=await Bn.lstat(e)}catch{}let n;try{n=await Bn.lstat(t)}catch(s){throw s.message=s.message.replace("lstat","ensureLink"),s}if(r&&x_(n,r))return;let o=C_.dirname(e);await Gj(o)||await __.mkdirs(o),await Bn.link(t,e)}function Kj(t,e){let r;try{r=Bn.lstatSync(e)}catch{}try{let i=Bn.lstatSync(t);if(r&&x_(i,r))return}catch(i){throw i.message=i.message.replace("lstat","ensureLink"),i}let n=C_.dirname(e);return Bn.existsSync(n)||__.mkdirsSync(n),Bn.linkSync(t,e)}S_.exports={createLink:zj(Wj),createLinkSync:Kj}});var O_=C((ZY,F_)=>{"use strict";var Nn=require("path"),wa=Nt(),{pathExists:Xj}=In(),Yj=ct().fromPromise;async function Jj(t,e){if(Nn.isAbsolute(t)){try{await wa.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 Xj(n))return{toCwd:n,toDst:t};try{await wa.lstat(t)}catch(i){throw i.message=i.message.replace("lstat","ensureSymlink"),i}return{toCwd:t,toDst:Nn.relative(r,t)}}function Zj(t,e){if(Nn.isAbsolute(t)){if(!wa.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(wa.existsSync(n))return{toCwd:n,toDst:t};if(!wa.existsSync(t))throw new Error("relative srcpath does not exist");return{toCwd:t,toDst:Nn.relative(r,t)}}F_.exports={symlinkPaths:Yj(Jj),symlinkPathsSync:Zj}});var P_=C((QY,$_)=>{"use strict";var k_=Nt(),Qj=ct().fromPromise;async function e4(t,e){if(e)return e;let r;try{r=await k_.lstat(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}function t4(t,e){if(e)return e;let r;try{r=k_.lstatSync(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}$_.exports={symlinkType:Qj(e4),symlinkTypeSync:t4}});var B_=C((eJ,I_)=>{"use strict";var r4=ct().fromPromise,T_=require("path"),Ur=Nt(),{mkdirs:n4,mkdirsSync:o4}=Pr(),{symlinkPaths:i4,symlinkPathsSync:s4}=O_(),{symlinkType:a4,symlinkTypeSync:u4}=P_(),{pathExists:c4}=In(),{areIdentical:R_}=$o();async function l4(t,e,r){let n;try{n=await Ur.lstat(e)}catch{}if(n&&n.isSymbolicLink()){let[a,u]=await Promise.all([Ur.stat(t),Ur.stat(e)]);if(R_(a,u))return}let o=await i4(t,e);t=o.toDst;let i=await a4(o.toCwd,r),s=T_.dirname(e);return await c4(s)||await n4(s),Ur.symlink(t,e,i)}function f4(t,e,r){let n;try{n=Ur.lstatSync(e)}catch{}if(n&&n.isSymbolicLink()){let a=Ur.statSync(t),u=Ur.statSync(e);if(R_(a,u))return}let o=s4(t,e);t=o.toDst,r=u4(o.toCwd,r);let i=T_.dirname(e);return Ur.existsSync(i)||o4(i),Ur.symlinkSync(t,e,r)}I_.exports={createSymlink:r4(l4),createSymlinkSync:f4}});var V_=C((tJ,H_)=>{"use strict";var{createFile:N_,createFileSync:L_}=E_(),{createLink:j_,createLinkSync:U_}=A_(),{createSymlink:M_,createSymlinkSync:q_}=B_();H_.exports={createFile:N_,createFileSync:L_,ensureFile:N_,ensureFileSync:L_,createLink:j_,createLinkSync:U_,ensureLink:j_,ensureLinkSync:U_,createSymlink:M_,createSymlinkSync:q_,ensureSymlink:M_,ensureSymlinkSync:q_}});var ul=C((rJ,z_)=>{function p4(t,{EOL:e=`
53
- `,finalEOL:r=!0,replacer:n=null,spaces:o}={}){let i=r?e:"";return JSON.stringify(t,n,o).replace(/\n/g,e)+i}function d4(t){return Buffer.isBuffer(t)&&(t=t.toString("utf8")),t.replace(/^\uFEFF/,"")}z_.exports={stringify:p4,stripBom:d4}});var X_=C((nJ,K_)=>{var Ui;try{Ui=Pn()}catch{Ui=require("fs")}var cl=ct(),{stringify:G_,stripBom:W_}=ul();async function h4(t,e={}){typeof e=="string"&&(e={encoding:e});let r=e.fs||Ui,n="throws"in e?e.throws:!0,o=await cl.fromCallback(r.readFile)(t,e);o=W_(o);let i;try{i=JSON.parse(o,e?e.reviver:null)}catch(s){if(n)throw s.message=`${t}: ${s.message}`,s;return null}return i}var m4=cl.fromPromise(h4);function g4(t,e={}){typeof e=="string"&&(e={encoding:e});let r=e.fs||Ui,n="throws"in e?e.throws:!0;try{let o=r.readFileSync(t,e);return o=W_(o),JSON.parse(o,e.reviver)}catch(o){if(n)throw o.message=`${t}: ${o.message}`,o;return null}}async function D4(t,e,r={}){let n=r.fs||Ui,o=G_(e,r);await cl.fromCallback(n.writeFile)(t,o,r)}var y4=cl.fromPromise(D4);function b4(t,e,r={}){let n=r.fs||Ui,o=G_(e,r);return n.writeFileSync(t,o,r)}K_.exports={readFile:m4,readFileSync:g4,writeFile:y4,writeFileSync:b4}});var J_=C((oJ,Y_)=>{"use strict";var ll=X_();Y_.exports={readJson:ll.readFile,readJsonSync:ll.readFileSync,writeJson:ll.writeFile,writeJsonSync:ll.writeFileSync}});var fl=C((iJ,ex)=>{"use strict";var w4=ct().fromPromise,km=Nt(),Z_=require("path"),Q_=Pr(),v4=In().pathExists;async function E4(t,e,r="utf-8"){let n=Z_.dirname(t);return await v4(n)||await Q_.mkdirs(n),km.writeFile(t,e,r)}function C4(t,...e){let r=Z_.dirname(t);km.existsSync(r)||Q_.mkdirsSync(r),km.writeFileSync(t,...e)}ex.exports={outputFile:w4(E4),outputFileSync:C4}});var rx=C((sJ,tx)=>{"use strict";var{stringify:_4}=ul(),{outputFile:x4}=fl();async function S4(t,e,r={}){let n=_4(e,r);await x4(t,n,r)}tx.exports=S4});var ox=C((aJ,nx)=>{"use strict";var{stringify:A4}=ul(),{outputFileSync:F4}=fl();function O4(t,e,r){let n=A4(e,r);F4(t,n,r)}nx.exports=O4});var sx=C((uJ,ix)=>{"use strict";var k4=ct().fromPromise,jt=J_();jt.outputJson=k4(rx());jt.outputJsonSync=ox();jt.outputJSON=jt.outputJson;jt.outputJSONSync=jt.outputJsonSync;jt.writeJSON=jt.writeJson;jt.writeJSONSync=jt.writeJsonSync;jt.readJSON=jt.readJson;jt.readJSONSync=jt.readJsonSync;ix.exports=jt});var fx=C((cJ,lx)=>{"use strict";var $4=Nt(),ax=require("path"),{copy:P4}=al(),{remove:cx}=ba(),{mkdirp:T4}=Pr(),{pathExists:R4}=In(),ux=$o();async function I4(t,e,r={}){let n=r.overwrite||r.clobber||!1,{srcStat:o,isChangingCase:i=!1}=await ux.checkPaths(t,e,"move",r);await ux.checkParentPaths(t,o,e,"move");let s=ax.dirname(e);return ax.parse(s).root!==s&&await T4(s),B4(t,e,n,i)}async function B4(t,e,r,n){if(!n){if(r)await cx(e);else if(await R4(e))throw new Error("dest already exists.")}try{await $4.rename(t,e)}catch(o){if(o.code!=="EXDEV")throw o;await N4(t,e,r)}}async function N4(t,e,r){return await P4(t,e,{overwrite:r,errorOnExist:!0,preserveTimestamps:!0}),cx(t)}lx.exports=I4});var gx=C((lJ,mx)=>{"use strict";var dx=Pn(),Pm=require("path"),L4=al().copySync,hx=ba().removeSync,j4=Pr().mkdirpSync,px=$o();function U4(t,e,r){r=r||{};let n=r.overwrite||r.clobber||!1,{srcStat:o,isChangingCase:i=!1}=px.checkPathsSync(t,e,"move",r);return px.checkParentPathsSync(t,o,e,"move"),M4(e)||j4(Pm.dirname(e)),q4(t,e,n,i)}function M4(t){let e=Pm.dirname(t);return Pm.parse(e).root===e}function q4(t,e,r,n){if(n)return $m(t,e,r);if(r)return hx(e),$m(t,e,r);if(dx.existsSync(e))throw new Error("dest already exists.");return $m(t,e,r)}function $m(t,e,r){try{dx.renameSync(t,e)}catch(n){if(n.code!=="EXDEV")throw n;return H4(t,e,r)}}function H4(t,e,r){return L4(t,e,{overwrite:r,errorOnExist:!0,preserveTimestamps:!0}),hx(t)}mx.exports=U4});var yx=C((fJ,Dx)=>{"use strict";var V4=ct().fromPromise;Dx.exports={move:V4(fx()),moveSync:gx()}});var Mi=C((pJ,bx)=>{"use strict";bx.exports={...Nt(),...al(),...y_(),...V_(),...sx(),...Pr(),...yx(),...fl(),...In(),...ba()}});var Sx=C((dJ,xx)=>{"use strict";var Tm,vx,Ex,Cx,_x=!0;typeof process<"u"&&({FORCE_COLOR:Tm,NODE_DISABLE_COLORS:vx,NO_COLOR:Ex,TERM:Cx}=process.env||{},_x=process.stdout&&process.stdout.isTTY);var Oe={enabled:!vx&&Ex==null&&Cx!=="dumb"&&(Tm!=null&&Tm!=="0"||_x),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 wx(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 z4(t,e){let r={has:t,keys:e};return r.reset=Oe.reset.bind(r),r.bold=Oe.bold.bind(r),r.dim=Oe.dim.bind(r),r.italic=Oe.italic.bind(r),r.underline=Oe.underline.bind(r),r.inverse=Oe.inverse.bind(r),r.hidden=Oe.hidden.bind(r),r.strikethrough=Oe.strikethrough.bind(r),r.black=Oe.black.bind(r),r.red=Oe.red.bind(r),r.green=Oe.green.bind(r),r.yellow=Oe.yellow.bind(r),r.blue=Oe.blue.bind(r),r.magenta=Oe.magenta.bind(r),r.cyan=Oe.cyan.bind(r),r.white=Oe.white.bind(r),r.gray=Oe.gray.bind(r),r.grey=Oe.grey.bind(r),r.bgBlack=Oe.bgBlack.bind(r),r.bgRed=Oe.bgRed.bind(r),r.bgGreen=Oe.bgGreen.bind(r),r.bgYellow=Oe.bgYellow.bind(r),r.bgBlue=Oe.bgBlue.bind(r),r.bgMagenta=Oe.bgMagenta.bind(r),r.bgCyan=Oe.bgCyan.bind(r),r.bgWhite=Oe.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:Oe.enabled?wx(this.keys,n+""):n+""):n===void 0?z4([t],[r]):Oe.enabled?wx([r],n+""):n+""}}xx.exports=Oe});var qi=C(tt=>{"use strict";Object.defineProperty(tt,"__esModule",{value:!0});tt.ancillary=tt.failure=tt.success=tt.input=tt.weak=tt.strong=void 0;var G4=(he(),oe(de)),Mr=G4.__importDefault(Sx());tt.strong=Mr.default.bold;tt.weak=Mr.default.dim;tt.input=Mr.default.cyan;tt.success=Mr.default.green;tt.failure=Mr.default.red;tt.ancillary=Mr.default.cyan;var W4={strong:tt.strong,weak:tt.weak,input:tt.input,success:tt.success,failure:tt.failure,ancillary:tt.ancillary,log:{DEBUG:Mr.default.magenta,INFO:Mr.default.cyan,WARN:Mr.default.yellow,ERROR:Mr.default.red}};tt.default=W4});var Rm=C(pl=>{"use strict";Object.defineProperty(pl,"__esModule",{value:!0});pl.EscapeCode=void 0;var Tr="\x1B[",ft=class{};pl.EscapeCode=ft;ft.cursorLeft=()=>`${Tr}G`;ft.cursorUp=(t=1)=>`${Tr}${t}A`;ft.cursorDown=(t=1)=>`${Tr}${t}B`;ft.cursorForward=(t=1)=>`${Tr}${t}C`;ft.cursorBackward=(t=1)=>`${Tr}${t}D`;ft.cursorHide=()=>`${Tr}?25l`;ft.cursorShow=()=>`${Tr}?25h`;ft.eraseLine=()=>`${Tr}2K`;ft.eraseLines=t=>{let e="";for(let r=0;r<t;r++)e+=ft.eraseLine(),r<t-1&&(e+=ft.cursorUp());return`${e}${ft.cursorLeft()}`};ft.eraseUp=()=>`${Tr}1J`;ft.eraseDown=()=>`${Tr}J`;ft.eraseScreen=()=>`${Tr}2J`});var Fx=C(dl=>{"use strict";Object.defineProperty(dl,"__esModule",{value:!0});dl.Cursor=void 0;var K4=(he(),oe(de)),X4=K4.__importDefault(am()),Ax=Rm(),Hi=class t{static show(){t.stream.isTTY&&(t._isVisible=!0,t.stream.write(Ax.EscapeCode.cursorShow()))}static hide(){t.stream.isTTY&&(t._listenerAttached||((0,X4.default)(()=>{t.show()}),t._listenerAttached=!0),t._isVisible=!1,t.stream.write(Ax.EscapeCode.cursorHide()))}static toggle(){t._isVisible?t.hide():t.show()}};dl.Cursor=Hi;Hi.stream=process.stderr;Hi._isVisible=!0;Hi._listenerAttached=!1});var Bm=C((DJ,Im)=>{"use strict";var Ox=t=>Number.isNaN(t)?!1:t>=4352&&(t<=4447||t===9001||t===9002||11904<=t&&t<=12871&&t!==12351||12880<=t&&t<=19903||19968<=t&&t<=42182||43360<=t&&t<=43388||44032<=t&&t<=55203||63744<=t&&t<=64255||65040<=t&&t<=65049||65072<=t&&t<=65131||65281<=t&&t<=65376||65504<=t&&t<=65510||110592<=t&&t<=110593||127488<=t&&t<=127569||131072<=t&&t<=262141);Im.exports=Ox;Im.exports.default=Ox});var Px=C((yJ,$x)=>{"use strict";var kx="[\uD800-\uDBFF][\uDC00-\uDFFF]",Y4=t=>t&&t.exact?new RegExp(`^${kx}$`):new RegExp(kx,"g");$x.exports=Y4});var Rx=C((bJ,Tx)=>{"use strict";Tx.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 Nm=C((wJ,Bx)=>{var va=Rx(),Ix={};for(let t of Object.keys(va))Ix[va[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"]}};Bx.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),s=i-o,a,u;i===o?a=0:e===i?a=(r-n)/s:r===i?a=2+(n-e)/s:n===i&&(a=4+(e-r)/s),a=Math.min(a*60,360),a<0&&(a+=360);let c=(o+i)/2;return i===o?u=0:c<=.5?u=s/(i+o):u=s/(2-i-o),[a,u*100,c*100]};Q.rgb.hsv=function(t){let e,r,n,o,i,s=t[0]/255,a=t[1]/255,u=t[2]/255,c=Math.max(s,a,u),l=c-Math.min(s,a,u),f=function(h){return(c-h)/6/l+1/2};return l===0?(o=0,i=0):(i=l/c,e=f(s),r=f(a),n=f(u),s===c?o=n-r:a===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,s=(1-r-o)/(1-o)||0,a=(1-n-o)/(1-o)||0;return[i*100,s*100,a*100,o*100]};function J4(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=Ix[t];if(e)return e;let r=1/0,n;for(let o of Object.keys(va)){let i=va[o],s=J4(t,i);s<r&&(r=s,n=o)}return n};Q.keyword.rgb=function(t){return va[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,s=e*.0193+r*.1192+n*.9505;return[o*100,i*100,s*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,s=500*(r-n),a=200*(n-o);return[i,s,a]};Q.hsl.rgb=function(t){let e=t[0]/360,r=t[1]/100,n=t[2]/100,o,i,s;if(r===0)return s=n*255,[s,s,s];n<.5?o=n*(1+r):o=n+r-n*r;let a=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?s=a+(o-a)*6*i:2*i<1?s=o:3*i<2?s=a+(o-a)*(2/3-i)*6:s=a,u[c]=s*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 s=(n+r)/2,a=n===0?2*o/(i+o):2*r/(n+r);return[e,a*100,s*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),s=255*n*(1-r),a=255*n*(1-r*i),u=255*n*(1-r*(1-i));switch(n*=255,o){case 0:return[n,u,s];case 1:return[a,n,s];case 2:return[s,n,u];case 3:return[s,a,n];case 4:return[u,s,n];case 5:return[n,s,a]}};Q.hsv.hsl=function(t){let e=t[0],r=t[1]/100,n=t[2]/100,o=Math.max(n,.01),i,s;s=(2-r)*n;let a=(2-r)*o;return i=r*o,i/=a<=1?a:2-a,i=i||0,s/=2,[e,i*100,s*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 s=Math.floor(6*e),a=1-n;i=6*e-s,(s&1)!==0&&(i=1-i);let u=r+i*(a-r),c,l,f;switch(s){default:case 6:case 0:c=a,l=u,f=r;break;case 1:c=u,l=a,f=r;break;case 2:c=r,l=a,f=u;break;case 3:c=r,l=u,f=a;break;case 4:c=u,l=r,f=a;break;case 5:c=a,l=r,f=u;break}return[c*255,l*255,f*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),s=1-Math.min(1,r*(1-o)+o),a=1-Math.min(1,n*(1-o)+o);return[i*255,s*255,a*255]};Q.xyz.rgb=function(t){let e=t[0]/100,r=t[1]/100,n=t[2]/100,o,i,s;return o=e*3.2406+r*-1.5372+n*-.4986,i=e*-.9689+r*1.8758+n*.0415,s=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,s=s>.0031308?1.055*s**(1/2.4)-.055:s*12.92,o=Math.min(Math.max(0,o),1),i=Math.min(Math.max(0,i),1),s=Math.min(Math.max(0,s),1),[o*255,i*255,s*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),s=200*(r-n);return[o,i,s]};Q.lab.xyz=function(t){let e=t[0],r=t[1],n=t[2],o,i,s;i=(e+16)/116,o=r/500+i,s=i-n/200;let a=i**3,u=o**3,c=s**3;return i=a>.008856?a:(i-16/116)/7.787,o=u>.008856?u:(o-16/116)/7.787,s=c>.008856?c:(s-16/116)/7.787,o*=95.047,i*=100,s*=108.883,[o,i,s]};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 s=Math.sqrt(r*r+n*n);return[e,s,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),s=r*Math.sin(o);return[e,i,s]};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 s=30+(Math.round(o/255)<<2|Math.round(n/255)<<1|Math.round(r/255));return i===2&&(s+=60),s};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(a=>a+a).join(""));let n=parseInt(r,16),o=n>>16&255,i=n>>8&255,s=n&255;return[o,i,s]};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),s=o-i,a,u;return s<1?a=i/(1-s):a=0,s<=0?u=0:o===e?u=(r-n)/s%6:o===r?u=2+(n-e)/s:u=4+(e-r)/s,u/=6,u%=1,[u*360,s*100,a*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,s=i%1,a=1-s,u=0;switch(Math.floor(i)){case 0:o[0]=1,o[1]=s,o[2]=0;break;case 1:o[0]=a,o[1]=1,o[2]=0;break;case 2:o[0]=0,o[1]=1,o[2]=s;break;case 3:o[0]=0,o[1]=a,o[2]=1;break;case 4:o[0]=s,o[1]=0,o[2]=1;break;default:o[0]=1,o[1]=0,o[2]=a}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 Lx=C((vJ,Nx)=>{var hl=Nm();function Z4(){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 Q4(t){let e=Z4(),r=[t];for(e[t].distance=0;r.length;){let n=r.pop(),o=Object.keys(hl[n]);for(let i=o.length,s=0;s<i;s++){let a=o[s],u=e[a];u.distance===-1&&(u.distance=e[n].distance+1,u.parent=n,r.unshift(a))}}return e}function eU(t,e){return function(r){return e(t(r))}}function tU(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=eU(hl[e[o].parent][o],n),o=e[o].parent;return n.conversion=r,n}Nx.exports=function(t){let e=Q4(t),r={},n=Object.keys(e);for(let o=n.length,i=0;i<o;i++){let s=n[i];e[s].parent!==null&&(r[s]=tU(s,e))}return r}});var Ux=C((EJ,jx)=>{var Lm=Nm(),rU=Lx(),Vi={},nU=Object.keys(Lm);function oU(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 iU(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,s=0;s<i;s++)o[s]=Math.round(o[s]);return o};return"conversion"in t&&(e.conversion=t.conversion),e}nU.forEach(t=>{Vi[t]={},Object.defineProperty(Vi[t],"channels",{value:Lm[t].channels}),Object.defineProperty(Vi[t],"labels",{value:Lm[t].labels});let e=rU(t);Object.keys(e).forEach(n=>{let o=e[n];Vi[t][n]=iU(o),Vi[t][n].raw=oU(o)})});jx.exports=Vi});var Um=C((CJ,zx)=>{"use strict";var Mx=(t,e)=>(...r)=>`\x1B[${t(...r)+e}m`,qx=(t,e)=>(...r)=>{let n=t(...r);return`\x1B[${38+e};5;${n}m`},Hx=(t,e)=>(...r)=>{let n=t(...r);return`\x1B[${38+e};2;${n[0]};${n[1]};${n[2]}m`},ml=t=>t,Vx=(t,e,r)=>[t,e,r],zi=(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})},jm,Gi=(t,e,r,n)=>{jm===void 0&&(jm=Ux());let o=n?10:0,i={};for(let[s,a]of Object.entries(jm)){let u=s==="ansi16"?"ansi":s;s===e?i[u]=t(r,o):typeof a=="object"&&(i[u]=t(a[e],o))}return i};function sU(){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",zi(e.color,"ansi",()=>Gi(Mx,"ansi16",ml,!1)),zi(e.color,"ansi256",()=>Gi(qx,"ansi256",ml,!1)),zi(e.color,"ansi16m",()=>Gi(Hx,"rgb",Vx,!1)),zi(e.bgColor,"ansi",()=>Gi(Mx,"ansi16",ml,!0)),zi(e.bgColor,"ansi256",()=>Gi(qx,"ansi256",ml,!0)),zi(e.bgColor,"ansi16m",()=>Gi(Hx,"rgb",Vx,!0)),e}Object.defineProperty(zx,"exports",{enumerable:!0,get:sU})});var Yx=C((_J,Xx)=>{"use strict";var aU=Bm(),uU=Px(),Gx=Um(),Kx=["\x1B","\x9B"],gl=t=>`${Kx[0]}[${t}m`,Wx=(t,e,r)=>{let n=[];t=[...t];for(let o of t){let i=o;o.includes(";")&&(o=o.split(";")[0][0]+"0");let s=Gx.codes.get(Number.parseInt(o,10));if(s){let a=t.indexOf(s.toString());a===-1?n.push(gl(e?s:i)):t.splice(a,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(Gx.codes.get(Number.parseInt(r,10)));n=n.reduce((i,s)=>s===o?[s,...i]:[...i,s],[])}return n.join("")};Xx.exports=(t,e,r)=>{let n=[...t],o=[],i=typeof r=="number"?r:n.length,s=!1,a,u=0,c="";for(let[l,f]of n.entries()){let h=!1;if(Kx.includes(f)){let d=/\d[^m]*/.exec(t.slice(l,l+18));a=d&&d.length>0?d[0]:void 0,u<i&&(s=!0,a!==void 0&&o.push(a))}else s&&f==="m"&&(s=!1,h=!0);if(!s&&!h&&u++,!uU({exact:!0}).test(f)&&aU(f.codePointAt())&&(u++,typeof r!="number"&&i++),u>e&&u<=i)c+=f;else if(u===e&&!s&&a!==void 0)c=Wx(o);else if(u>=i){c+=Wx(o,!0,a);break}}return c}});var Zx=C((xJ,Jx)=>{"use strict";Jx.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 Dl=C((SJ,Qx)=>{"use strict";var cU=Zx();Qx.exports=t=>typeof t=="string"?t.replace(cU(),""):t});var tS=C((AJ,eS)=>{"use strict";eS.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 qm=C((FJ,Mm)=>{"use strict";var lU=Dl(),fU=Bm(),pU=tS(),rS=t=>{if(typeof t!="string"||t.length===0||(t=lU(t),t.length===0))return 0;t=t.replace(pU()," ");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+=fU(n)?2:1)}return e};Mm.exports=rS;Mm.exports.default=rS});var uS=C((OJ,aS)=>{"use strict";var Ea=qm(),dU=Dl(),hU=Um(),yl=new Set(["\x1B","\x9B"]),mU=39,Vm="\x07",iS="[",gU="]",sS="m",zm=`${gU}8;;`,nS=t=>`${yl.values().next().value}${iS}${t}${sS}`,oS=t=>`${yl.values().next().value}${zm}${t}${Vm}`,DU=t=>t.split(" ").map(e=>Ea(e)),Hm=(t,e,r)=>{let n=[...e],o=!1,i=!1,s=Ea(dU(t[t.length-1]));for(let[a,u]of n.entries()){let c=Ea(u);if(s+c<=r?t[t.length-1]+=u:(t.push(u),s=0),yl.has(u)&&(o=!0,i=n.slice(a+1).join("").startsWith(zm)),o){i?u===Vm&&(o=!1,i=!1):u===sS&&(o=!1);continue}s+=c,s===r&&a<n.length-1&&(t.push(""),s=0)}!s&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},yU=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(Ea(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},bU=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",o,i,s=DU(t),a=[""];for(let[c,l]of t.split(" ").entries()){r.trim!==!1&&(a[a.length-1]=a[a.length-1].trimStart());let f=Ea(a[a.length-1]);if(c!==0&&(f>=e&&(r.wordWrap===!1||r.trim===!1)&&(a.push(""),f=0),(f>0||r.trim===!1)&&(a[a.length-1]+=" ",f++)),r.hard&&s[c]>e){let h=e-f,d=1+Math.floor((s[c]-h-1)/e);Math.floor((s[c]-1)/e)<d&&a.push(""),Hm(a,l,e);continue}if(f+s[c]>e&&f>0&&s[c]>0){if(r.wordWrap===!1&&f<e){Hm(a,l,e);continue}a.push("")}if(f+s[c]>e&&r.wordWrap===!1){Hm(a,l,e);continue}a[a.length-1]+=l}r.trim!==!1&&(a=a.map(yU));let u=[...a.join(`
54
- `)];for(let[c,l]of u.entries()){if(n+=l,yl.has(l)){let{groups:h}=new RegExp(`(?:\\${iS}(?<code>\\d+)m|\\${zm}(?<uri>.*)${Vm})`).exec(u.slice(c).join(""))||{groups:{}};if(h.code!==void 0){let d=Number.parseFloat(h.code);o=d===mU?void 0:d}else h.uri!==void 0&&(i=h.uri.length===0?void 0:h.uri)}let f=hU.codes.get(Number(o));u[c+1]===`
55
- `?(i&&(n+=oS("")),o&&f&&(n+=nS(f))):l===`
56
- `&&(o&&f&&(n+=nS(o)),i&&(n+=oS(i)))}return n};aS.exports=(t,e,r)=>String(t).normalize().replace(/\r\n/g,`
52
+ see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0002");let{srcStat:n,destStat:o}=is.checkPathsSync(t,e,"copy",r);if(is.checkParentPathsSync(t,n,e,"copy"),r.filter&&!r.filter(t,e))return;let i=os.dirname(e);return Pt.existsSync(i)||LB(i),aE(o,t,e,r)}function aE(t,e,r,n){let i=(n.dereference?Pt.statSync:Pt.lstatSync)(e);if(i.isDirectory())return KB(i,t,e,r,n);if(i.isFile()||i.isCharacterDevice()||i.isBlockDevice())return qB(i,t,e,r,n);if(i.isSymbolicLink())return XB(t,e,r,n);throw i.isSocket()?new Error(`Cannot copy a socket file: ${e}`):i.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${e}`):new Error(`Unknown file: ${e}`)}function qB(t,e,r,n,o){return e?HB(t,r,n,o):sE(t,r,n,o)}function HB(t,e,r,n){if(n.overwrite)return Pt.unlinkSync(r),sE(t,e,r,n);if(n.errorOnExist)throw new Error(`'${r}' already exists`)}function sE(t,e,r,n){return Pt.copyFileSync(e,r),n.preserveTimestamps&&VB(t.mode,e,r),Xh(r,t.mode)}function VB(t,e,r){return zB(t)&&GB(r,t),WB(e,r)}function zB(t){return(t&128)===0}function GB(t,e){return Xh(t,e|128)}function Xh(t,e){return Pt.chmodSync(t,e)}function WB(t,e){let r=Pt.statSync(t);return UB(e,r.atime,r.mtime)}function KB(t,e,r,n,o){return e?uE(r,n,o):YB(t.mode,r,n,o)}function YB(t,e,r,n){return Pt.mkdirSync(r),uE(e,r,n),Xh(r,t)}function uE(t,e,r){let n=Pt.opendirSync(t);try{let o;for(;(o=n.readSync())!==null;)JB(o.name,t,e,r)}finally{n.closeSync()}}function JB(t,e,r,n){let o=os.join(e,t),i=os.join(r,t);if(n.filter&&!n.filter(o,i))return;let{destStat:a}=is.checkPathsSync(o,i,"copy",n);return aE(a,o,i,n)}function XB(t,e,r,n){let o=Pt.readlinkSync(e);if(n.dereference&&(o=os.resolve(process.cwd(),o)),t){let i;try{i=Pt.readlinkSync(r)}catch(a){if(a.code==="EINVAL"||a.code==="UNKNOWN")return Pt.symlinkSync(o,r);throw a}if(n.dereference&&(i=os.resolve(process.cwd(),i)),is.isSrcSubdir(o,i))throw new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`);if(is.isSrcSubdir(i,o))throw new Error(`Cannot overwrite '${i}' with '${o}'.`);return ZB(o,r)}else return Pt.symlinkSync(o,r)}function ZB(t,e){return Pt.unlinkSync(e),Pt.symlinkSync(t,e)}cE.exports=MB});var Mc=x((qz,fE)=>{"use strict";var QB=it().fromPromise;fE.exports={copy:QB(iE()),copySync:lE()}});var as=x((Hz,dE)=>{"use strict";var pE=wn(),ej=it().fromCallback;function tj(t,e){pE.rm(t,{recursive:!0,force:!0},e)}function rj(t){pE.rmSync(t,{recursive:!0,force:!0})}dE.exports={remove:ej(tj),removeSync:rj}});var wE=x((Vz,vE)=>{"use strict";var nj=it().fromPromise,gE=$t(),DE=require("path"),yE=Cr(),bE=as(),hE=nj(async function(e){let r;try{r=await gE.readdir(e)}catch{return yE.mkdirs(e)}return Promise.all(r.map(n=>bE.remove(DE.join(e,n))))});function mE(t){let e;try{e=gE.readdirSync(t)}catch{return yE.mkdirsSync(t)}e.forEach(r=>{r=DE.join(t,r),bE.removeSync(r)})}vE.exports={emptyDirSync:mE,emptydirSync:mE,emptyDir:hE,emptydir:hE}});var xE=x((zz,_E)=>{"use strict";var oj=it().fromPromise,CE=require("path"),Qr=$t(),EE=Cr();async function ij(t){let e;try{e=await Qr.stat(t)}catch{}if(e&&e.isFile())return;let r=CE.dirname(t),n=null;try{n=await Qr.stat(r)}catch(o){if(o.code==="ENOENT"){await EE.mkdirs(r),await Qr.writeFile(t,"");return}else throw o}n.isDirectory()?await Qr.writeFile(t,""):await Qr.readdir(r)}function aj(t){let e;try{e=Qr.statSync(t)}catch{}if(e&&e.isFile())return;let r=CE.dirname(t);try{Qr.statSync(r).isDirectory()||Qr.readdirSync(r)}catch(n){if(n&&n.code==="ENOENT")EE.mkdirsSync(r);else throw n}Qr.writeFileSync(t,"")}_E.exports={createFile:oj(ij),createFileSync:aj}});var kE=x((Gz,OE)=>{"use strict";var sj=it().fromPromise,SE=require("path"),xn=$t(),FE=Cr(),{pathExists:uj}=_n(),{areIdentical:AE}=vo();async function cj(t,e){let r;try{r=await xn.lstat(e)}catch{}let n;try{n=await xn.lstat(t)}catch(a){throw a.message=a.message.replace("lstat","ensureLink"),a}if(r&&AE(n,r))return;let o=SE.dirname(e);await uj(o)||await FE.mkdirs(o),await xn.link(t,e)}function lj(t,e){let r;try{r=xn.lstatSync(e)}catch{}try{let i=xn.lstatSync(t);if(r&&AE(i,r))return}catch(i){throw i.message=i.message.replace("lstat","ensureLink"),i}let n=SE.dirname(e);return xn.existsSync(n)||FE.mkdirsSync(n),xn.linkSync(t,e)}OE.exports={createLink:sj(cj),createLinkSync:lj}});var PE=x((Wz,$E)=>{"use strict";var Sn=require("path"),ss=$t(),{pathExists:fj}=_n(),pj=it().fromPromise;async function dj(t,e){if(Sn.isAbsolute(t)){try{await ss.lstat(t)}catch(i){throw i.message=i.message.replace("lstat","ensureSymlink"),i}return{toCwd:t,toDst:t}}let r=Sn.dirname(e),n=Sn.join(r,t);if(await fj(n))return{toCwd:n,toDst:t};try{await ss.lstat(t)}catch(i){throw i.message=i.message.replace("lstat","ensureSymlink"),i}return{toCwd:t,toDst:Sn.relative(r,t)}}function hj(t,e){if(Sn.isAbsolute(t)){if(!ss.existsSync(t))throw new Error("absolute srcpath does not exist");return{toCwd:t,toDst:t}}let r=Sn.dirname(e),n=Sn.join(r,t);if(ss.existsSync(n))return{toCwd:n,toDst:t};if(!ss.existsSync(t))throw new Error("relative srcpath does not exist");return{toCwd:t,toDst:Sn.relative(r,t)}}$E.exports={symlinkPaths:pj(dj),symlinkPathsSync:hj}});var RE=x((Kz,IE)=>{"use strict";var TE=$t(),mj=it().fromPromise;async function gj(t,e){if(e)return e;let r;try{r=await TE.lstat(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}function Dj(t,e){if(e)return e;let r;try{r=TE.lstatSync(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}IE.exports={symlinkType:mj(gj),symlinkTypeSync:Dj}});var LE=x((Yz,NE)=>{"use strict";var yj=it().fromPromise,BE=require("path"),kr=$t(),{mkdirs:bj,mkdirsSync:vj}=Cr(),{symlinkPaths:wj,symlinkPathsSync:Cj}=PE(),{symlinkType:Ej,symlinkTypeSync:_j}=RE(),{pathExists:xj}=_n(),{areIdentical:jE}=vo();async function Sj(t,e,r){let n;try{n=await kr.lstat(e)}catch{}if(n&&n.isSymbolicLink()){let[s,u]=await Promise.all([kr.stat(t),kr.stat(e)]);if(jE(s,u))return}let o=await wj(t,e);t=o.toDst;let i=await Ej(o.toCwd,r),a=BE.dirname(e);return await xj(a)||await bj(a),kr.symlink(t,e,i)}function Fj(t,e,r){let n;try{n=kr.lstatSync(e)}catch{}if(n&&n.isSymbolicLink()){let s=kr.statSync(t),u=kr.statSync(e);if(jE(s,u))return}let o=Cj(t,e);t=o.toDst,r=_j(o.toCwd,r);let i=BE.dirname(e);return kr.existsSync(i)||vj(i),kr.symlinkSync(t,e,r)}NE.exports={createSymlink:yj(Sj),createSymlinkSync:Fj}});var WE=x((Jz,GE)=>{"use strict";var{createFile:UE,createFileSync:ME}=xE(),{createLink:qE,createLinkSync:HE}=kE(),{createSymlink:VE,createSymlinkSync:zE}=LE();GE.exports={createFile:UE,createFileSync:ME,ensureFile:UE,ensureFileSync:ME,createLink:qE,createLinkSync:HE,ensureLink:qE,ensureLinkSync:HE,createSymlink:VE,createSymlinkSync:zE,ensureSymlink:VE,ensureSymlinkSync:zE}});var qc=x((Xz,KE)=>{function Aj(t,{EOL:e=`
53
+ `,finalEOL:r=!0,replacer:n=null,spaces:o}={}){let i=r?e:"";return JSON.stringify(t,n,o).replace(/\n/g,e)+i}function Oj(t){return Buffer.isBuffer(t)&&(t=t.toString("utf8")),t.replace(/^\uFEFF/,"")}KE.exports={stringify:Aj,stripBom:Oj}});var ZE=x((Zz,XE)=>{var Ai;try{Ai=wn()}catch{Ai=require("fs")}var Hc=it(),{stringify:YE,stripBom:JE}=qc();async function kj(t,e={}){typeof e=="string"&&(e={encoding:e});let r=e.fs||Ai,n="throws"in e?e.throws:!0,o=await Hc.fromCallback(r.readFile)(t,e);o=JE(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 $j=Hc.fromPromise(kj);function Pj(t,e={}){typeof e=="string"&&(e={encoding:e});let r=e.fs||Ai,n="throws"in e?e.throws:!0;try{let o=r.readFileSync(t,e);return o=JE(o),JSON.parse(o,e.reviver)}catch(o){if(n)throw o.message=`${t}: ${o.message}`,o;return null}}async function Tj(t,e,r={}){let n=r.fs||Ai,o=YE(e,r);await Hc.fromCallback(n.writeFile)(t,o,r)}var Ij=Hc.fromPromise(Tj);function Rj(t,e,r={}){let n=r.fs||Ai,o=YE(e,r);return n.writeFileSync(t,o,r)}XE.exports={readFile:$j,readFileSync:Pj,writeFile:Ij,writeFileSync:Rj}});var e_=x((Qz,QE)=>{"use strict";var Vc=ZE();QE.exports={readJson:Vc.readFile,readJsonSync:Vc.readFileSync,writeJson:Vc.writeFile,writeJsonSync:Vc.writeFileSync}});var zc=x((eG,n_)=>{"use strict";var Bj=it().fromPromise,Zh=$t(),t_=require("path"),r_=Cr(),jj=_n().pathExists;async function Nj(t,e,r="utf-8"){let n=t_.dirname(t);return await jj(n)||await r_.mkdirs(n),Zh.writeFile(t,e,r)}function Lj(t,...e){let r=t_.dirname(t);Zh.existsSync(r)||r_.mkdirsSync(r),Zh.writeFileSync(t,...e)}n_.exports={outputFile:Bj(Nj),outputFileSync:Lj}});var i_=x((tG,o_)=>{"use strict";var{stringify:Uj}=qc(),{outputFile:Mj}=zc();async function qj(t,e,r={}){let n=Uj(e,r);await Mj(t,n,r)}o_.exports=qj});var s_=x((rG,a_)=>{"use strict";var{stringify:Hj}=qc(),{outputFileSync:Vj}=zc();function zj(t,e,r){let n=Hj(e,r);Vj(t,n,r)}a_.exports=zj});var c_=x((nG,u_)=>{"use strict";var Gj=it().fromPromise,Tt=e_();Tt.outputJson=Gj(i_());Tt.outputJsonSync=s_();Tt.outputJSON=Tt.outputJson;Tt.outputJSONSync=Tt.outputJsonSync;Tt.writeJSON=Tt.writeJson;Tt.writeJSONSync=Tt.writeJsonSync;Tt.readJSON=Tt.readJson;Tt.readJSONSync=Tt.readJsonSync;u_.exports=Tt});var h_=x((oG,d_)=>{"use strict";var Wj=$t(),l_=require("path"),{copy:Kj}=Mc(),{remove:p_}=as(),{mkdirp:Yj}=Cr(),{pathExists:Jj}=_n(),f_=vo();async function Xj(t,e,r={}){let n=r.overwrite||r.clobber||!1,{srcStat:o,isChangingCase:i=!1}=await f_.checkPaths(t,e,"move",r);await f_.checkParentPaths(t,o,e,"move");let a=l_.dirname(e);return l_.parse(a).root!==a&&await Yj(a),Zj(t,e,n,i)}async function Zj(t,e,r,n){if(!n){if(r)await p_(e);else if(await Jj(e))throw new Error("dest already exists.")}try{await Wj.rename(t,e)}catch(o){if(o.code!=="EXDEV")throw o;await Qj(t,e,r)}}async function Qj(t,e,r){return await Kj(t,e,{overwrite:r,errorOnExist:!0,preserveTimestamps:!0}),p_(t)}d_.exports=Xj});var b_=x((iG,y_)=>{"use strict";var g_=wn(),em=require("path"),eN=Mc().copySync,D_=as().removeSync,tN=Cr().mkdirpSync,m_=vo();function rN(t,e,r){r=r||{};let n=r.overwrite||r.clobber||!1,{srcStat:o,isChangingCase:i=!1}=m_.checkPathsSync(t,e,"move",r);return m_.checkParentPathsSync(t,o,e,"move"),nN(e)||tN(em.dirname(e)),oN(t,e,n,i)}function nN(t){let e=em.dirname(t);return em.parse(e).root===e}function oN(t,e,r,n){if(n)return Qh(t,e,r);if(r)return D_(e),Qh(t,e,r);if(g_.existsSync(e))throw new Error("dest already exists.");return Qh(t,e,r)}function Qh(t,e,r){try{g_.renameSync(t,e)}catch(n){if(n.code!=="EXDEV")throw n;return iN(t,e,r)}}function iN(t,e,r){return eN(t,e,{overwrite:r,errorOnExist:!0,preserveTimestamps:!0}),D_(t)}y_.exports=rN});var w_=x((aG,v_)=>{"use strict";var aN=it().fromPromise;v_.exports={move:aN(h_()),moveSync:b_()}});var Oi=x((sG,C_)=>{"use strict";C_.exports={...$t(),...Mc(),...wE(),...WE(),...c_(),...Cr(),...w_(),...zc(),..._n(),...as()}});var O_=x((uG,A_)=>{"use strict";var tm,__,x_,S_,F_=!0;typeof process<"u"&&({FORCE_COLOR:tm,NODE_DISABLE_COLORS:__,NO_COLOR:x_,TERM:S_}=process.env||{},F_=process.stdout&&process.stdout.isTTY);var Se={enabled:!__&&x_==null&&S_!=="dumb"&&(tm!=null&&tm!=="0"||F_),reset:Te(0,0),bold:Te(1,22),dim:Te(2,22),italic:Te(3,23),underline:Te(4,24),inverse:Te(7,27),hidden:Te(8,28),strikethrough:Te(9,29),black:Te(30,39),red:Te(31,39),green:Te(32,39),yellow:Te(33,39),blue:Te(34,39),magenta:Te(35,39),cyan:Te(36,39),white:Te(37,39),gray:Te(90,39),grey:Te(90,39),bgBlack:Te(40,49),bgRed:Te(41,49),bgGreen:Te(42,49),bgYellow:Te(43,49),bgBlue:Te(44,49),bgMagenta:Te(45,49),bgCyan:Te(46,49),bgWhite:Te(47,49)};function E_(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 sN(t,e){let r={has:t,keys:e};return r.reset=Se.reset.bind(r),r.bold=Se.bold.bind(r),r.dim=Se.dim.bind(r),r.italic=Se.italic.bind(r),r.underline=Se.underline.bind(r),r.inverse=Se.inverse.bind(r),r.hidden=Se.hidden.bind(r),r.strikethrough=Se.strikethrough.bind(r),r.black=Se.black.bind(r),r.red=Se.red.bind(r),r.green=Se.green.bind(r),r.yellow=Se.yellow.bind(r),r.blue=Se.blue.bind(r),r.magenta=Se.magenta.bind(r),r.cyan=Se.cyan.bind(r),r.white=Se.white.bind(r),r.gray=Se.gray.bind(r),r.grey=Se.grey.bind(r),r.bgBlack=Se.bgBlack.bind(r),r.bgRed=Se.bgRed.bind(r),r.bgGreen=Se.bgGreen.bind(r),r.bgYellow=Se.bgYellow.bind(r),r.bgBlue=Se.bgBlue.bind(r),r.bgMagenta=Se.bgMagenta.bind(r),r.bgCyan=Se.bgCyan.bind(r),r.bgWhite=Se.bgWhite.bind(r),r}function Te(t,e){let r={open:`\x1B[${t}m`,close:`\x1B[${e}m`,rgx:new RegExp(`\\x1b\\[${e}m`,"g")};return function(n){return this!==void 0&&this.has!==void 0?(~this.has.indexOf(t)||(this.has.push(t),this.keys.push(r)),n===void 0?this:Se.enabled?E_(this.keys,n+""):n+""):n===void 0?sN([t],[r]):Se.enabled?E_([r],n+""):n+""}}A_.exports=Se});var ki=x(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.ancillary=Xe.failure=Xe.success=Xe.input=Xe.weak=Xe.strong=void 0;var uN=(fe(),re(le)),$r=uN.__importDefault(O_());Xe.strong=$r.default.bold;Xe.weak=$r.default.dim;Xe.input=$r.default.cyan;Xe.success=$r.default.green;Xe.failure=$r.default.red;Xe.ancillary=$r.default.cyan;var cN={strong:Xe.strong,weak:Xe.weak,input:Xe.input,success:Xe.success,failure:Xe.failure,ancillary:Xe.ancillary,log:{DEBUG:$r.default.magenta,INFO:$r.default.cyan,WARN:$r.default.yellow,ERROR:$r.default.red}};Xe.default=cN});var rm=x(Gc=>{"use strict";Object.defineProperty(Gc,"__esModule",{value:!0});Gc.EscapeCode=void 0;var Er="\x1B[",st=class{};Gc.EscapeCode=st;st.cursorLeft=()=>`${Er}G`;st.cursorUp=(t=1)=>`${Er}${t}A`;st.cursorDown=(t=1)=>`${Er}${t}B`;st.cursorForward=(t=1)=>`${Er}${t}C`;st.cursorBackward=(t=1)=>`${Er}${t}D`;st.cursorHide=()=>`${Er}?25l`;st.cursorShow=()=>`${Er}?25h`;st.eraseLine=()=>`${Er}2K`;st.eraseLines=t=>{let e="";for(let r=0;r<t;r++)e+=st.eraseLine(),r<t-1&&(e+=st.cursorUp());return`${e}${st.cursorLeft()}`};st.eraseUp=()=>`${Er}1J`;st.eraseDown=()=>`${Er}J`;st.eraseScreen=()=>`${Er}2J`});var $_=x(Wc=>{"use strict";Object.defineProperty(Wc,"__esModule",{value:!0});Wc.Cursor=void 0;var lN=(fe(),re(le)),fN=lN.__importDefault(Oh()),k_=rm(),$i=class t{static show(){t.stream.isTTY&&(t._isVisible=!0,t.stream.write(k_.EscapeCode.cursorShow()))}static hide(){t.stream.isTTY&&(t._listenerAttached||((0,fN.default)(()=>{t.show()}),t._listenerAttached=!0),t._isVisible=!1,t.stream.write(k_.EscapeCode.cursorHide()))}static toggle(){t._isVisible?t.hide():t.show()}};Wc.Cursor=$i;$i.stream=process.stderr;$i._isVisible=!0;$i._listenerAttached=!1});var om=x((pG,nm)=>{"use strict";var P_=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=P_;nm.exports.default=P_});var R_=x((dG,I_)=>{"use strict";var T_="[\uD800-\uDBFF][\uDC00-\uDFFF]",pN=t=>t&&t.exact?new RegExp(`^${T_}$`):new RegExp(T_,"g");I_.exports=pN});var j_=x((hG,B_)=>{"use strict";B_.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 im=x((mG,L_)=>{var us=j_(),N_={};for(let t of Object.keys(us))N_[us[t]]=t;var X={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};L_.exports=X;for(let t of Object.keys(X)){if(!("channels"in X[t]))throw new Error("missing channels property: "+t);if(!("labels"in X[t]))throw new Error("missing channel labels property: "+t);if(X[t].labels.length!==X[t].channels)throw new Error("channel and label counts mismatch: "+t);let{channels:e,labels:r}=X[t];delete X[t].channels,delete X[t].labels,Object.defineProperty(X[t],"channels",{value:e}),Object.defineProperty(X[t],"labels",{value:r})}X.rgb.hsl=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255,o=Math.min(e,r,n),i=Math.max(e,r,n),a=i-o,s,u;i===o?s=0:e===i?s=(r-n)/a:r===i?s=2+(n-e)/a:n===i&&(s=4+(e-r)/a),s=Math.min(s*60,360),s<0&&(s+=360);let c=(o+i)/2;return i===o?u=0:c<=.5?u=a/(i+o):u=a/(2-i-o),[s,u*100,c*100]};X.rgb.hsv=function(t){let e,r,n,o,i,a=t[0]/255,s=t[1]/255,u=t[2]/255,c=Math.max(a,s,u),l=c-Math.min(a,s,u),f=function(d){return(c-d)/6/l+1/2};return l===0?(o=0,i=0):(i=l/c,e=f(a),r=f(s),n=f(u),a===c?o=n-r:s===c?o=1/3+e-n:u===c&&(o=2/3+r-e),o<0?o+=1:o>1&&(o-=1)),[o*360,i*100,c*100]};X.rgb.hwb=function(t){let e=t[0],r=t[1],n=t[2],o=X.rgb.hsl(t)[0],i=1/255*Math.min(e,Math.min(r,n));return n=1-1/255*Math.max(e,Math.max(r,n)),[o,i*100,n*100]};X.rgb.cmyk=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255,o=Math.min(1-e,1-r,1-n),i=(1-e-o)/(1-o)||0,a=(1-r-o)/(1-o)||0,s=(1-n-o)/(1-o)||0;return[i*100,a*100,s*100,o*100]};function dN(t,e){return(t[0]-e[0])**2+(t[1]-e[1])**2+(t[2]-e[2])**2}X.rgb.keyword=function(t){let e=N_[t];if(e)return e;let r=1/0,n;for(let o of Object.keys(us)){let i=us[o],a=dN(t,i);a<r&&(r=a,n=o)}return n};X.keyword.rgb=function(t){return us[t]};X.rgb.xyz=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255;e=e>.04045?((e+.055)/1.055)**2.4:e/12.92,r=r>.04045?((r+.055)/1.055)**2.4:r/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92;let o=e*.4124+r*.3576+n*.1805,i=e*.2126+r*.7152+n*.0722,a=e*.0193+r*.1192+n*.9505;return[o*100,i*100,a*100]};X.rgb.lab=function(t){let e=X.rgb.xyz(t),r=e[0],n=e[1],o=e[2];r/=95.047,n/=100,o/=108.883,r=r>.008856?r**(1/3):7.787*r+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,o=o>.008856?o**(1/3):7.787*o+16/116;let i=116*n-16,a=500*(r-n),s=200*(n-o);return[i,a,s]};X.hsl.rgb=function(t){let e=t[0]/360,r=t[1]/100,n=t[2]/100,o,i,a;if(r===0)return a=n*255,[a,a,a];n<.5?o=n*(1+r):o=n+r-n*r;let s=2*n-o,u=[0,0,0];for(let c=0;c<3;c++)i=e+1/3*-(c-1),i<0&&i++,i>1&&i--,6*i<1?a=s+(o-s)*6*i:2*i<1?a=o:3*i<2?a=s+(o-s)*(2/3-i)*6:a=s,u[c]=a*255;return u};X.hsl.hsv=function(t){let e=t[0],r=t[1]/100,n=t[2]/100,o=r,i=Math.max(n,.01);n*=2,r*=n<=1?n:2-n,o*=i<=1?i:2-i;let a=(n+r)/2,s=n===0?2*o/(i+o):2*r/(n+r);return[e,s*100,a*100]};X.hsv.rgb=function(t){let e=t[0]/60,r=t[1]/100,n=t[2]/100,o=Math.floor(e)%6,i=e-Math.floor(e),a=255*n*(1-r),s=255*n*(1-r*i),u=255*n*(1-r*(1-i));switch(n*=255,o){case 0:return[n,u,a];case 1:return[s,n,a];case 2:return[a,n,u];case 3:return[a,s,n];case 4:return[u,a,n];case 5:return[n,a,s]}};X.hsv.hsl=function(t){let e=t[0],r=t[1]/100,n=t[2]/100,o=Math.max(n,.01),i,a;a=(2-r)*n;let s=(2-r)*o;return i=r*o,i/=s<=1?s:2-s,i=i||0,a/=2,[e,i*100,a*100]};X.hwb.rgb=function(t){let e=t[0]/360,r=t[1]/100,n=t[2]/100,o=r+n,i;o>1&&(r/=o,n/=o);let a=Math.floor(6*e),s=1-n;i=6*e-a,(a&1)!==0&&(i=1-i);let u=r+i*(s-r),c,l,f;switch(a){default:case 6:case 0:c=s,l=u,f=r;break;case 1:c=u,l=s,f=r;break;case 2:c=r,l=s,f=u;break;case 3:c=r,l=u,f=s;break;case 4:c=u,l=r,f=s;break;case 5:c=s,l=r,f=u;break}return[c*255,l*255,f*255]};X.cmyk.rgb=function(t){let e=t[0]/100,r=t[1]/100,n=t[2]/100,o=t[3]/100,i=1-Math.min(1,e*(1-o)+o),a=1-Math.min(1,r*(1-o)+o),s=1-Math.min(1,n*(1-o)+o);return[i*255,a*255,s*255]};X.xyz.rgb=function(t){let e=t[0]/100,r=t[1]/100,n=t[2]/100,o,i,a;return o=e*3.2406+r*-1.5372+n*-.4986,i=e*-.9689+r*1.8758+n*.0415,a=e*.0557+r*-.204+n*1.057,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,i=i>.0031308?1.055*i**(1/2.4)-.055:i*12.92,a=a>.0031308?1.055*a**(1/2.4)-.055:a*12.92,o=Math.min(Math.max(0,o),1),i=Math.min(Math.max(0,i),1),a=Math.min(Math.max(0,a),1),[o*255,i*255,a*255]};X.xyz.lab=function(t){let e=t[0],r=t[1],n=t[2];e/=95.047,r/=100,n/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,n=n>.008856?n**(1/3):7.787*n+16/116;let o=116*r-16,i=500*(e-r),a=200*(r-n);return[o,i,a]};X.lab.xyz=function(t){let e=t[0],r=t[1],n=t[2],o,i,a;i=(e+16)/116,o=r/500+i,a=i-n/200;let s=i**3,u=o**3,c=a**3;return i=s>.008856?s:(i-16/116)/7.787,o=u>.008856?u:(o-16/116)/7.787,a=c>.008856?c:(a-16/116)/7.787,o*=95.047,i*=100,a*=108.883,[o,i,a]};X.lab.lch=function(t){let e=t[0],r=t[1],n=t[2],o;o=Math.atan2(n,r)*360/2/Math.PI,o<0&&(o+=360);let a=Math.sqrt(r*r+n*n);return[e,a,o]};X.lch.lab=function(t){let e=t[0],r=t[1],o=t[2]/360*2*Math.PI,i=r*Math.cos(o),a=r*Math.sin(o);return[e,i,a]};X.rgb.ansi16=function(t,e=null){let[r,n,o]=t,i=e===null?X.rgb.hsv(t)[2]:e;if(i=Math.round(i/50),i===0)return 30;let a=30+(Math.round(o/255)<<2|Math.round(n/255)<<1|Math.round(r/255));return i===2&&(a+=60),a};X.hsv.ansi16=function(t){return X.rgb.ansi16(X.hsv.rgb(t),t[2])};X.rgb.ansi256=function(t){let e=t[0],r=t[1],n=t[2];return e===r&&r===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)};X.ansi16.rgb=function(t){let e=t%10;if(e===0||e===7)return t>50&&(e+=3.5),e=e/10.5*255,[e,e,e];let r=(~~(t>50)+1)*.5,n=(e&1)*r*255,o=(e>>1&1)*r*255,i=(e>>2&1)*r*255;return[n,o,i]};X.ansi256.rgb=function(t){if(t>=232){let i=(t-232)*10+8;return[i,i,i]}t-=16;let e,r=Math.floor(t/36)/5*255,n=Math.floor((e=t%36)/6)/5*255,o=e%6/5*255;return[r,n,o]};X.rgb.hex=function(t){let r=(((Math.round(t[0])&255)<<16)+((Math.round(t[1])&255)<<8)+(Math.round(t[2])&255)).toString(16).toUpperCase();return"000000".substring(r.length)+r};X.hex.rgb=function(t){let e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let r=e[0];e[0].length===3&&(r=r.split("").map(s=>s+s).join(""));let n=parseInt(r,16),o=n>>16&255,i=n>>8&255,a=n&255;return[o,i,a]};X.rgb.hcg=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255,o=Math.max(Math.max(e,r),n),i=Math.min(Math.min(e,r),n),a=o-i,s,u;return a<1?s=i/(1-a):s=0,a<=0?u=0:o===e?u=(r-n)/a%6:o===r?u=2+(n-e)/a:u=4+(e-r)/a,u/=6,u%=1,[u*360,a*100,s*100]};X.hsl.hcg=function(t){let e=t[1]/100,r=t[2]/100,n=r<.5?2*e*r:2*e*(1-r),o=0;return n<1&&(o=(r-.5*n)/(1-n)),[t[0],n*100,o*100]};X.hsv.hcg=function(t){let e=t[1]/100,r=t[2]/100,n=e*r,o=0;return n<1&&(o=(r-n)/(1-n)),[t[0],n*100,o*100]};X.hcg.rgb=function(t){let e=t[0]/360,r=t[1]/100,n=t[2]/100;if(r===0)return[n*255,n*255,n*255];let o=[0,0,0],i=e%1*6,a=i%1,s=1-a,u=0;switch(Math.floor(i)){case 0:o[0]=1,o[1]=a,o[2]=0;break;case 1:o[0]=s,o[1]=1,o[2]=0;break;case 2:o[0]=0,o[1]=1,o[2]=a;break;case 3:o[0]=0,o[1]=s,o[2]=1;break;case 4:o[0]=a,o[1]=0,o[2]=1;break;default:o[0]=1,o[1]=0,o[2]=s}return u=(1-r)*n,[(r*o[0]+u)*255,(r*o[1]+u)*255,(r*o[2]+u)*255]};X.hcg.hsv=function(t){let e=t[1]/100,r=t[2]/100,n=e+r*(1-e),o=0;return n>0&&(o=e/n),[t[0],o*100,n*100]};X.hcg.hsl=function(t){let e=t[1]/100,n=t[2]/100*(1-e)+.5*e,o=0;return n>0&&n<.5?o=e/(2*n):n>=.5&&n<1&&(o=e/(2*(1-n))),[t[0],o*100,n*100]};X.hcg.hwb=function(t){let e=t[1]/100,r=t[2]/100,n=e+r*(1-e);return[t[0],(n-e)*100,(1-n)*100]};X.hwb.hcg=function(t){let e=t[1]/100,n=1-t[2]/100,o=n-e,i=0;return o<1&&(i=(n-o)/(1-o)),[t[0],o*100,i*100]};X.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]};X.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]};X.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]};X.gray.hsl=function(t){return[0,0,t[0]]};X.gray.hsv=X.gray.hsl;X.gray.hwb=function(t){return[0,100,t[0]]};X.gray.cmyk=function(t){return[0,0,0,t[0]]};X.gray.lab=function(t){return[t[0],0,0]};X.gray.hex=function(t){let e=Math.round(t[0]/100*255)&255,n=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(n.length)+n};X.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]}});var M_=x((gG,U_)=>{var Kc=im();function hN(){let t={},e=Object.keys(Kc);for(let r=e.length,n=0;n<r;n++)t[e[n]]={distance:-1,parent:null};return t}function mN(t){let e=hN(),r=[t];for(e[t].distance=0;r.length;){let n=r.pop(),o=Object.keys(Kc[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 gN(t,e){return function(r){return e(t(r))}}function DN(t,e){let r=[e[t].parent,t],n=Kc[e[t].parent][t],o=e[t].parent;for(;e[o].parent;)r.unshift(e[o].parent),n=gN(Kc[e[o].parent][o],n),o=e[o].parent;return n.conversion=r,n}U_.exports=function(t){let e=mN(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]=DN(a,e))}return r}});var H_=x((DG,q_)=>{var am=im(),yN=M_(),Pi={},bN=Object.keys(am);function vN(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 wN(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}bN.forEach(t=>{Pi[t]={},Object.defineProperty(Pi[t],"channels",{value:am[t].channels}),Object.defineProperty(Pi[t],"labels",{value:am[t].labels});let e=yN(t);Object.keys(e).forEach(n=>{let o=e[n];Pi[t][n]=wN(o),Pi[t][n].raw=vN(o)})});q_.exports=Pi});var um=x((yG,K_)=>{"use strict";var V_=(t,e)=>(...r)=>`\x1B[${t(...r)+e}m`,z_=(t,e)=>(...r)=>{let n=t(...r);return`\x1B[${38+e};5;${n}m`},G_=(t,e)=>(...r)=>{let n=t(...r);return`\x1B[${38+e};2;${n[0]};${n[1]};${n[2]}m`},Yc=t=>t,W_=(t,e,r)=>[t,e,r],Ti=(t,e,r)=>{Object.defineProperty(t,e,{get:()=>{let n=r();return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0}),n},enumerable:!0,configurable:!0})},sm,Ii=(t,e,r,n)=>{sm===void 0&&(sm=H_());let o=n?10:0,i={};for(let[a,s]of Object.entries(sm)){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 CN(){let t=new Map,e={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};e.color.gray=e.color.blackBright,e.bgColor.bgGray=e.bgColor.bgBlackBright,e.color.grey=e.color.blackBright,e.bgColor.bgGrey=e.bgColor.bgBlackBright;for(let[r,n]of Object.entries(e)){for(let[o,i]of Object.entries(n))e[o]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},n[o]=e[o],t.set(i[0],i[1]);Object.defineProperty(e,r,{value:n,enumerable:!1})}return Object.defineProperty(e,"codes",{value:t,enumerable:!1}),e.color.close="\x1B[39m",e.bgColor.close="\x1B[49m",Ti(e.color,"ansi",()=>Ii(V_,"ansi16",Yc,!1)),Ti(e.color,"ansi256",()=>Ii(z_,"ansi256",Yc,!1)),Ti(e.color,"ansi16m",()=>Ii(G_,"rgb",W_,!1)),Ti(e.bgColor,"ansi",()=>Ii(V_,"ansi16",Yc,!0)),Ti(e.bgColor,"ansi256",()=>Ii(z_,"ansi256",Yc,!0)),Ti(e.bgColor,"ansi16m",()=>Ii(G_,"rgb",W_,!0)),e}Object.defineProperty(K_,"exports",{enumerable:!0,get:CN})});var Q_=x((bG,Z_)=>{"use strict";var EN=om(),_N=R_(),Y_=um(),X_=["\x1B","\x9B"],Jc=t=>`${X_[0]}[${t}m`,J_=(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=Y_.codes.get(Number.parseInt(o,10));if(a){let s=t.indexOf(a.toString());s===-1?n.push(Jc(e?a:i)):t.splice(s,1)}else if(e){n.push(Jc(0));break}else n.push(Jc(i))}if(e&&(n=n.filter((o,i)=>n.indexOf(o)===i),r!==void 0)){let o=Jc(Y_.codes.get(Number.parseInt(r,10)));n=n.reduce((i,a)=>a===o?[a,...i]:[...i,a],[])}return n.join("")};Z_.exports=(t,e,r)=>{let n=[...t],o=[],i=typeof r=="number"?r:n.length,a=!1,s,u=0,c="";for(let[l,f]of n.entries()){let d=!1;if(X_.includes(f)){let h=/\d[^m]*/.exec(t.slice(l,l+18));s=h&&h.length>0?h[0]:void 0,u<i&&(a=!0,s!==void 0&&o.push(s))}else a&&f==="m"&&(a=!1,d=!0);if(!a&&!d&&u++,!_N({exact:!0}).test(f)&&EN(f.codePointAt())&&(u++,typeof r!="number"&&i++),u>e&&u<=i)c+=f;else if(u===e&&!a&&s!==void 0)c=J_(o);else if(u>=i){c+=J_(o,!0,s);break}}return c}});var tx=x((vG,ex)=>{"use strict";ex.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 Xc=x((wG,rx)=>{"use strict";var xN=tx();rx.exports=t=>typeof t=="string"?t.replace(xN(),""):t});var ox=x((CG,nx)=>{"use strict";nx.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 lm=x((EG,cm)=>{"use strict";var SN=Xc(),FN=om(),AN=ox(),ix=t=>{if(typeof t!="string"||t.length===0||(t=SN(t),t.length===0))return 0;t=t.replace(AN()," ");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+=FN(n)?2:1)}return e};cm.exports=ix;cm.exports.default=ix});var fx=x((_G,lx)=>{"use strict";var cs=lm(),ON=Xc(),kN=um(),Zc=new Set(["\x1B","\x9B"]),$N=39,pm="\x07",ux="[",PN="]",cx="m",dm=`${PN}8;;`,ax=t=>`${Zc.values().next().value}${ux}${t}${cx}`,sx=t=>`${Zc.values().next().value}${dm}${t}${pm}`,TN=t=>t.split(" ").map(e=>cs(e)),fm=(t,e,r)=>{let n=[...e],o=!1,i=!1,a=cs(ON(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),Zc.has(u)&&(o=!0,i=n.slice(s+1).join("").startsWith(dm)),o){i?u===pm&&(o=!1,i=!1):u===cx&&(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())},IN=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("")},RN=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",o,i,a=TN(t),s=[""];for(let[c,l]of t.split(" ").entries()){r.trim!==!1&&(s[s.length-1]=s[s.length-1].trimStart());let f=cs(s[s.length-1]);if(c!==0&&(f>=e&&(r.wordWrap===!1||r.trim===!1)&&(s.push(""),f=0),(f>0||r.trim===!1)&&(s[s.length-1]+=" ",f++)),r.hard&&a[c]>e){let d=e-f,h=1+Math.floor((a[c]-d-1)/e);Math.floor((a[c]-1)/e)<h&&s.push(""),fm(s,l,e);continue}if(f+a[c]>e&&f>0&&a[c]>0){if(r.wordWrap===!1&&f<e){fm(s,l,e);continue}s.push("")}if(f+a[c]>e&&r.wordWrap===!1){fm(s,l,e);continue}s[s.length-1]+=l}r.trim!==!1&&(s=s.map(IN));let u=[...s.join(`
54
+ `)];for(let[c,l]of u.entries()){if(n+=l,Zc.has(l)){let{groups:d}=new RegExp(`(?:\\${ux}(?<code>\\d+)m|\\${dm}(?<uri>.*)${pm})`).exec(u.slice(c).join(""))||{groups:{}};if(d.code!==void 0){let h=Number.parseFloat(d.code);o=h===$N?void 0:h}else d.uri!==void 0&&(i=d.uri.length===0?void 0:d.uri)}let f=kN.codes.get(Number(o));u[c+1]===`
55
+ `?(i&&(n+=sx("")),o&&f&&(n+=ax(f))):l===`
56
+ `&&(o&&f&&(n+=ax(o)),i&&(n+=sx(i)))}return n};lx.exports=(t,e,r)=>String(t).normalize().replace(/\r\n/g,`
57
57
  `).split(`
58
- `).map(n=>bU(n,e,r)).join(`
59
- `)});var fS=C((kJ,lS)=>{"use strict";var wU=require("os"),cS=wU.homedir();lS.exports=t=>{if(typeof t!="string")throw new TypeError(`Expected a string, got ${typeof t}`);return cS?t.replace(/^~(?=$|\/|\\)/,cS):t}});var DS=C(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke.columnar=Ke.generateFillSpaceStringList=Ke.expandPath=Ke.prettyPath=Ke.wordWrap=Ke.indent=Ke.TTY_WIDTH=Ke.stripAnsi=Ke.stringWidth=Ke.sliceAnsi=void 0;var pS=(he(),oe(de)),vU=pS.__importStar(require("os")),fn=pS.__importStar(require("path")),dS=Yx();Ke.sliceAnsi=dS;var bl=qm();Ke.stringWidth=bl;var EU=Dl();Ke.stripAnsi=EU;var CU=uS(),_U=fS(),xU=80,SU=120;Ke.TTY_WIDTH=process.stdout.columns?Math.max(xU,Math.min(process.stdout.columns,SU)):1/0;function hS(t=4){return" ".repeat(t)}Ke.indent=hS;function AU(t,{width:e=Ke.TTY_WIDTH,indentation:r=0,append:n=""}){return CU(t,e-r-n.length,{trim:!0}).split(`
58
+ `).map(n=>RN(n,e,r)).join(`
59
+ `)});var hx=x((xG,dx)=>{"use strict";var BN=require("os"),px=BN.homedir();dx.exports=t=>{if(typeof t!="string")throw new TypeError(`Expected a string, got ${typeof t}`);return px?t.replace(/^~(?=$|\/|\\)/,px):t}});var vx=x(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.columnar=Ve.generateFillSpaceStringList=Ve.expandPath=Ve.prettyPath=Ve.wordWrap=Ve.indent=Ve.TTY_WIDTH=Ve.stripAnsi=Ve.stringWidth=Ve.sliceAnsi=void 0;var mx=(fe(),re(le)),jN=mx.__importStar(require("os")),en=mx.__importStar(require("path")),gx=Q_();Ve.sliceAnsi=gx;var Qc=lm();Ve.stringWidth=Qc;var NN=Xc();Ve.stripAnsi=NN;var LN=fx(),UN=hx(),MN=80,qN=120;Ve.TTY_WIDTH=process.stdout.columns?Math.max(MN,Math.min(process.stdout.columns,qN)):1/0;function Dx(t=4){return" ".repeat(t)}Ve.indent=Dx;function HN(t,{width:e=Ve.TTY_WIDTH,indentation:r=0,append:n=""}){return LN(t,e-r-n.length,{trim:!0}).split(`
60
60
  `).join(`${n}
61
- ${hS(r)}`)}Ke.wordWrap=AU;function FU(t){t=mS(t);let e=process.cwd(),r=fn.dirname(t),n=vU.homedir(),o=Math.abs(r.split(fn.sep).length-e.split(fn.sep).length);if(e===r)return"."+fn.sep+fn.basename(t);if(r.startsWith(e))return"."+fn.sep+t.substring(e.length+1);if(o<=2){let i=fn.relative(e,t);return i||"."}else{if(t===n)return"~";if(t.indexOf(n)===0)return"~"+fn.sep+t.substring(n.length+1)}return t}Ke.prettyPath=FU;function mS(t){return fn.resolve(_U(t))}Ke.expandPath=mS;function gS(t,e=1,r=" "){e<2&&(e=2);let n=Math.max(...t.map(s=>bl(s))),o=n>e?n+1:e,i=r.repeat(o);return t.map(s=>dS(i,0,o-bl(s)))}Ke.generateFillSpaceStringList=gS;function OU(t,{hsep:e="-",vsep:r="|",headers:n}){let o=!!n;if(!t[0])return"";let i=n?n.length:t[0].length,s=n?n.map(l=>[l]):t[0].map(()=>[]);for(let l of t){let f=0,h=l.map(d=>{let m=d.split(`
62
- `);return f=Math.max(f,m.length),m});for(let d in l)s[d]&&s[d].push(...h[d],...Array(f-h[d].length).fill(""))}let a=s.map((l,f)=>{if(f<i-1){let h=gS(l);return l.map((d,m)=>`${d}${h[m]}${r===""?"":`${r} `}`)}else return l}),u=0,c=a.reduce((l,f)=>l.map((h,d)=>{let m=l[d]+f[d];return u=Math.max(u,bl(m)),m}));return o&&e!==""&&c.splice(1,0,e.repeat(u)),c.join(`
63
- `)}Ke.columnar=OU});var yS=C(dr=>{"use strict";Object.defineProperty(dr,"__esModule",{value:!0});dr.TERMINAL_INFO=dr.CI_ENVIRONMENT_VARIABLES_DETECTED=dr.CI_ENVIRONMENT_VARIABLES=void 0;var kU=(he(),oe(de)),$U=Em(),PU=kU.__importStar(require("os")),TU=(0,$U.debug)("ionic:utils-terminal:info");dr.CI_ENVIRONMENT_VARIABLES=["CI","BUILD_ID","BUILD_NUMBER","BITBUCKET_COMMIT","CODEBUILD_BUILD_ARN","GITHUB_ACTIONS"];dr.CI_ENVIRONMENT_VARIABLES_DETECTED=dr.CI_ENVIRONMENT_VARIABLES.filter(t=>!!process.env[t]);function RU(){let{shell:t}=PU.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")}dr.CI_ENVIRONMENT_VARIABLES_DETECTED.length>0&&TU(`Environment variables for CI detected: ${dr.CI_ENVIRONMENT_VARIABLES_DETECTED.join(", ")}`);dr.TERMINAL_INFO=Object.freeze({ci:dr.CI_ENVIRONMENT_VARIABLES_DETECTED.length>0,shell:RU(),tty:!!(process.stdin.isTTY&&process.stdout.isTTY&&process.stderr.isTTY),windows:process.platform==="win32"||!!(process.env.OSTYPE&&/^(msys|cygwin)$/.test(process.env.OSTYPE)||process.env.MSYSTEM&&/^MINGW(32|64)$/.test(process.env.MSYSTEM))})});var Gm=C(Wi=>{"use strict";Object.defineProperty(Wi,"__esModule",{value:!0});var wl=(he(),oe(de));wl.__exportStar(Rm(),Wi);wl.__exportStar(Fx(),Wi);wl.__exportStar(DS(),Wi);wl.__exportStar(yS(),Wi)});var El=C(qr=>{"use strict";Object.defineProperty(qr,"__esModule",{value:!0});qr.isFatal=qr.fatal=qr.FatalException=qr.BaseException=void 0;var vl=class extends Error{constructor(e,r){super(e),this.message=e,this.code=r}};qr.BaseException=vl;var Ca=class extends vl{constructor(e,r=1){super(e,"FATAL"),this.message=e,this.exitCode=r}};qr.FatalException=Ca;function IU(t){throw new Ca(t)}qr.fatal=IU;function BU(t){return t&&t instanceof Ca}qr.isFatal=BU});var Xm={};wn(Xm,{LOGGER_LEVELS:()=>VU,Logger:()=>Km,NO_COLORS:()=>bS,StreamOutputStrategy:()=>Cl,TTYOutputStrategy:()=>Wm,TTY_WIDTH:()=>NU,createDefaultLogger:()=>HU,indent:()=>LU,sliceAnsi:()=>jU,stringWidth:()=>UU,stripAnsi:()=>MU,wordWrap:()=>qU});var NU,LU,jU,UU,MU,qU,HU,bS,Cl,Wm,Km,VU,Ym=it(()=>{NU=80,LU=t=>t,jU=t=>t,UU=t=>t.length,MU=t=>t,qU=t=>t,HU=()=>({info:console.log,warn:console.warn,error:console.error,debug:console.debug}),bS={},Cl=class{constructor(){this.colors=bS,this.stream=process.stdout}},Wm=class extends Cl{constructor(e){super(),this.options=e}},Km=class{constructor(){}info(){}warn(){}error(){}debug(){}},VU={DEBUG:"DEBUG",INFO:"INFO",WARN:"WARN",ERROR:"ERROR"}});var vS=C(Po=>{"use strict";Object.defineProperty(Po,"__esModule",{value:!0});Po.isInteractive=Po.checkInteractive=void 0;var zU=(he(),oe(de)),wS=Gm(),GU=zU.__importDefault(qi()),WU=_a(),KU=(...t)=>(0,Po.isInteractive)()?!0:t.length?t.filter(e=>!e).length?(WU.logger.error(`Non-interactive shell detected.
64
- Run the command with ${GU.default.input("--help")} to see a list of arguments that must be provided.`),!1):!0:!1;Po.checkInteractive=KU;var XU=()=>wS.TERMINAL_INFO.tty&&!wS.TERMINAL_INFO.ci;Po.isInteractive=XU});var _l={};wn(_l,{default:()=>ES});function ES(){throw new Error("Prompts are not supported in this CLI build")}var xl=it(()=>{});var _a=C(Xt=>{"use strict";Object.defineProperty(Xt,"__esModule",{value:!0});Xt.logSuccess=Xt.logPrompt=Xt.logger=Xt.output=void 0;var Jm=(he(),oe(de)),To=(Ym(),oe(Xm)),Ro=Jm.__importDefault(qi()),YU=vS(),CS={colors:Ro.default,stream:process.argv.includes("--json")?process.stderr:process.stdout};Xt.output=(0,YU.isInteractive)()?new To.TTYOutputStrategy(CS):new To.StreamOutputStrategy(CS);Xt.logger=(0,To.createDefaultLogger)({output:Xt.output,formatterOptions:{titleize:!1,tags:new Map([[To.LOGGER_LEVELS.DEBUG,Ro.default.log.DEBUG("[debug]")],[To.LOGGER_LEVELS.INFO,Ro.default.log.INFO("[info]")],[To.LOGGER_LEVELS.WARN,Ro.default.log.WARN("[warn]")],[To.LOGGER_LEVELS.ERROR,Ro.default.log.ERROR("[error]")]])}});async function JU(t,e){let{wordWrap:r}=await Promise.resolve().then(()=>Jm.__importStar((Ym(),oe(Xm)))),{prompt:n}=await Promise.resolve().then(()=>Jm.__importStar((xl(),oe(_l))));return Xt.logger.log({msg:`${Ro.default.input("[?]")} ${r(t,{indentation:4})}`,logger:Xt.logger,format:!1}),n(e,{onCancel:()=>process.exit(1)})}Xt.logPrompt=JU;function ZU(t){Xt.logger.msg(`${Ro.default.success("[success]")} ${t}`)}Xt.logSuccess=ZU});var Sl=C(Ki=>{"use strict";Object.defineProperty(Ki,"__esModule",{value:!0});Ki.resolveNode=Ki.requireTS=void 0;var QU=require("fs"),e5=Mi(),t5=require("path"),r5=(t,e)=>{let r=(0,t5.resolve)(e);delete require.cache[r],require.extensions[".ts"]=(o,i)=>{var s;let a=(0,e5.readFileSync)(i,"utf8");i.endsWith(".ts")?a=t.transpileModule(a,{fileName:i,compilerOptions:{module:t.ModuleKind.CommonJS,moduleResolution:t.ModuleResolutionKind.NodeJs,esModuleInterop:!0,strict:!0,target:t.ScriptTarget.ES2017},reportDiagnostics:!0}).outputText:a=a.replace(/export\s+\w+\s+(\w+)/gm,"exports.$1"),(s=o._compile)===null||s===void 0||s.call(o,a,i)};let n=require(r);return delete require.extensions[".ts"],n};Ki.requireTS=r5;function n5(t,...e){try{return require.resolve(e.join("/"),{paths:[t]})}catch{let n=[t,"node_modules",...e].join("/");return(0,QU.existsSync)(n)?n:null}}Ki.resolveNode=n5});var _S={};wn(_S,{default:()=>o5});var o5,xS=it(()=>{o5={}});var SS=C(Hr=>{"use strict";Object.defineProperty(Hr,"__esModule",{value:!0});Hr.buildXmlElement=Hr.writeXML=Hr.parseXML=Hr.readXML=void 0;var i5=(he(),oe(de)),s5=Mi(),xa=i5.__importDefault((xS(),oe(_S)));async function a5(t){var e;try{let r=await(0,s5.readFile)(t,{encoding:"utf-8"});try{return await xa.default.parseStringPromise(r)}catch(n){throw`Error parsing: ${t}, ${(e=n.stack)!==null&&e!==void 0?e:n}`}}catch{throw`Unable to read: ${t}`}}Hr.readXML=a5;function u5(t,e){let r=e!==void 0?new xa.default.Parser({...e}):new xa.default.Parser,n;return r.parseString(t,(o,i)=>{o||(n=i)}),n}Hr.parseXML=u5;async function c5(t){return new Promise(e=>{let n=new xa.default.Builder({headless:!0,explicitRoot:!1,rootName:"deleteme"}).buildObject(t);n=n.replace("<deleteme>","").replace("</deleteme>",""),e(n)})}Hr.writeXML=c5;function l5(t,e){return new xa.default.Builder({headless:!0,explicitRoot:!1,rootName:e}).buildObject(t)}Hr.buildXmlElement=l5});var $S=C(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 f5=(he(),oe(de)),p5=Mi(),Zm=require("path"),Xi=f5.__importDefault(qi()),d5=El(),h5=_a(),AS=Sl(),m5=SS();function FS(t,e){var r,n,o,i;let{extConfig:s}=t.app;switch(e){case"android":return(n=(r=s.android)===null||r===void 0?void 0:r.includePlugins)!==null&&n!==void 0?n:s.includePlugins;case"ios":return(i=(o=s.ios)===null||o===void 0?void 0:o.includePlugins)!==null&&i!==void 0?i:s.includePlugins}}ke.getIncludedPluginPackages=FS;async function g5(t,e){var r;let n=(r=FS(t,e))!==null&&r!==void 0?r:kS(t);return(await Promise.all(n.map(async i=>OS(t,i)))).filter(i=>!!i)}ke.getPlugins=g5;async function OS(t,e){try{let r=(0,AS.resolveNode)(t.app.rootDir,e,"package.json");r||(0,d5.fatal)(`Unable to find ${Xi.default.strong(`node_modules/${e}`)}.
65
- Are you sure ${Xi.default.strong(e)} is installed?`);let n=(0,Zm.dirname)(r),o=await(0,p5.readJSON)(r);if(!o)return null;if(o.capacitor)return{id:e,name:Qm(e),version:o.version,rootPath:n,repository:o.repository,manifest:o.capacitor};let i=(0,Zm.join)(n,"plugin.xml"),s=await(0,m5.readXML)(i);return{id:e,name:Qm(e),version:o.version,rootPath:n,repository:o.repository,xml:s.plugin}}catch{}return null}ke.resolvePlugin=OS;function kS(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=kS;function Qm(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=Qm;function D5(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 ${Xi.default.strong(e)}:
66
- `;break;case"incompatible":n=`Found ${t.length} incompatible Cordova plugin${o} for ${Xi.default.strong(e)}, skipped install:
67
- `;break;case"capacitor":n=`Found ${t.length} Capacitor plugin${o} for ${Xi.default.strong(e)}:
68
- `;break}n+=t.map(i=>`${i.id}${Xi.default.weak(`@${i.version}`)}`).join(`
69
- `),h5.logger.info(n)}ke.printPlugins=D5;function eg(t,e){return t.xml.platform?t.xml.platform.filter(function(o){return o.$.name===e})[0]:[]}ke.getPluginPlatform=eg;function y5(t,e,r){let n=eg(t,e);if(n){let o=n[r];if(o)return o}return[]}ke.getPlatformElement=y5;function b5(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=b5;function w5(t,e){return tg(t,e,"js-module")}ke.getJSModules=w5;function v5(t,e){return tg(t,e,"asset")}ke.getAssets=v5;function E5(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,AS.resolveNode)(t.app.rootDir,...n);if(!o)throw new Error(`Can't resolve module ${n[0]}`);return o}return(0,Zm.join)(e.rootPath,r)}ke.getFilePath=E5;function tg(t,e,r){let n=[];t.xml[r]&&(n=n.concat(t.xml[r]));let o=eg(t,e);return o?.[r]&&(n=n.concat(o[r])),n}ke.getAllElements=tg});var PS={};wn(PS,{default:()=>C5});var C5,TS=it(()=>{C5={}});var Al=C(Ln=>{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});Ln.isInstalled=Ln.getCommandOutput=Ln.runCommand=void 0;var rg=(TS(),oe(PS));async function RS(t,e,r={}){let n=new rg.Subprocess(t,e,r);try{return await n.output()}catch(o){throw o instanceof rg.SubprocessError?o.output?o.output:o.cause?`${o.message} ${o.cause.toString()}`:o.code?o.code:"Unknown error":o}}Ln.runCommand=RS;async function _5(t,e,r={}){try{return(await RS(t,e,r)).trim()}catch{return null}}Ln.getCommandOutput=_5;async function x5(t){try{await(0,rg.which)(t)}catch{return!1}return!0}Ln.isInstalled=x5});var Sa=C((MJ,IS)=>{"use strict";var S5="2.0.0",A5=Number.MAX_SAFE_INTEGER||9007199254740991,F5=16,O5=250,k5=["major","premajor","minor","preminor","patch","prepatch","prerelease"];IS.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:F5,MAX_SAFE_BUILD_LENGTH:O5,MAX_SAFE_INTEGER:A5,RELEASE_TYPES:k5,SEMVER_SPEC_VERSION:S5,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var Aa=C((qJ,BS)=>{"use strict";var $5=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};BS.exports=$5});var Yi=C((Vr,NS)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:ng,MAX_SAFE_BUILD_LENGTH:P5,MAX_LENGTH:T5}=Sa(),R5=Aa();Vr=NS.exports={};var I5=Vr.re=[],B5=Vr.safeRe=[],X=Vr.src=[],N5=Vr.safeSrc=[],Y=Vr.t={},L5=0,og="[a-zA-Z0-9-]",j5=[["\\s",1],["\\d",T5],[og,P5]],U5=t=>{for(let[e,r]of j5)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},se=(t,e,r)=>{let n=U5(e),o=L5++;R5(t,o,e),Y[t]=o,X[o]=e,N5[o]=n,I5[o]=new RegExp(e,r?"g":void 0),B5[o]=new RegExp(n,r?"g":void 0)};se("NUMERICIDENTIFIER","0|[1-9]\\d*");se("NUMERICIDENTIFIERLOOSE","\\d+");se("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${og}*`);se("MAINVERSION",`(${X[Y.NUMERICIDENTIFIER]})\\.(${X[Y.NUMERICIDENTIFIER]})\\.(${X[Y.NUMERICIDENTIFIER]})`);se("MAINVERSIONLOOSE",`(${X[Y.NUMERICIDENTIFIERLOOSE]})\\.(${X[Y.NUMERICIDENTIFIERLOOSE]})\\.(${X[Y.NUMERICIDENTIFIERLOOSE]})`);se("PRERELEASEIDENTIFIER",`(?:${X[Y.NONNUMERICIDENTIFIER]}|${X[Y.NUMERICIDENTIFIER]})`);se("PRERELEASEIDENTIFIERLOOSE",`(?:${X[Y.NONNUMERICIDENTIFIER]}|${X[Y.NUMERICIDENTIFIERLOOSE]})`);se("PRERELEASE",`(?:-(${X[Y.PRERELEASEIDENTIFIER]}(?:\\.${X[Y.PRERELEASEIDENTIFIER]})*))`);se("PRERELEASELOOSE",`(?:-?(${X[Y.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${X[Y.PRERELEASEIDENTIFIERLOOSE]})*))`);se("BUILDIDENTIFIER",`${og}+`);se("BUILD",`(?:\\+(${X[Y.BUILDIDENTIFIER]}(?:\\.${X[Y.BUILDIDENTIFIER]})*))`);se("FULLPLAIN",`v?${X[Y.MAINVERSION]}${X[Y.PRERELEASE]}?${X[Y.BUILD]}?`);se("FULL",`^${X[Y.FULLPLAIN]}$`);se("LOOSEPLAIN",`[v=\\s]*${X[Y.MAINVERSIONLOOSE]}${X[Y.PRERELEASELOOSE]}?${X[Y.BUILD]}?`);se("LOOSE",`^${X[Y.LOOSEPLAIN]}$`);se("GTLT","((?:<|>)?=?)");se("XRANGEIDENTIFIERLOOSE",`${X[Y.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);se("XRANGEIDENTIFIER",`${X[Y.NUMERICIDENTIFIER]}|x|X|\\*`);se("XRANGEPLAIN",`[v=\\s]*(${X[Y.XRANGEIDENTIFIER]})(?:\\.(${X[Y.XRANGEIDENTIFIER]})(?:\\.(${X[Y.XRANGEIDENTIFIER]})(?:${X[Y.PRERELEASE]})?${X[Y.BUILD]}?)?)?`);se("XRANGEPLAINLOOSE",`[v=\\s]*(${X[Y.XRANGEIDENTIFIERLOOSE]})(?:\\.(${X[Y.XRANGEIDENTIFIERLOOSE]})(?:\\.(${X[Y.XRANGEIDENTIFIERLOOSE]})(?:${X[Y.PRERELEASELOOSE]})?${X[Y.BUILD]}?)?)?`);se("XRANGE",`^${X[Y.GTLT]}\\s*${X[Y.XRANGEPLAIN]}$`);se("XRANGELOOSE",`^${X[Y.GTLT]}\\s*${X[Y.XRANGEPLAINLOOSE]}$`);se("COERCEPLAIN",`(^|[^\\d])(\\d{1,${ng}})(?:\\.(\\d{1,${ng}}))?(?:\\.(\\d{1,${ng}}))?`);se("COERCE",`${X[Y.COERCEPLAIN]}(?:$|[^\\d])`);se("COERCEFULL",X[Y.COERCEPLAIN]+`(?:${X[Y.PRERELEASE]})?(?:${X[Y.BUILD]})?(?:$|[^\\d])`);se("COERCERTL",X[Y.COERCE],!0);se("COERCERTLFULL",X[Y.COERCEFULL],!0);se("LONETILDE","(?:~>?)");se("TILDETRIM",`(\\s*)${X[Y.LONETILDE]}\\s+`,!0);Vr.tildeTrimReplace="$1~";se("TILDE",`^${X[Y.LONETILDE]}${X[Y.XRANGEPLAIN]}$`);se("TILDELOOSE",`^${X[Y.LONETILDE]}${X[Y.XRANGEPLAINLOOSE]}$`);se("LONECARET","(?:\\^)");se("CARETTRIM",`(\\s*)${X[Y.LONECARET]}\\s+`,!0);Vr.caretTrimReplace="$1^";se("CARET",`^${X[Y.LONECARET]}${X[Y.XRANGEPLAIN]}$`);se("CARETLOOSE",`^${X[Y.LONECARET]}${X[Y.XRANGEPLAINLOOSE]}$`);se("COMPARATORLOOSE",`^${X[Y.GTLT]}\\s*(${X[Y.LOOSEPLAIN]})$|^$`);se("COMPARATOR",`^${X[Y.GTLT]}\\s*(${X[Y.FULLPLAIN]})$|^$`);se("COMPARATORTRIM",`(\\s*)${X[Y.GTLT]}\\s*(${X[Y.LOOSEPLAIN]}|${X[Y.XRANGEPLAIN]})`,!0);Vr.comparatorTrimReplace="$1$2$3";se("HYPHENRANGE",`^\\s*(${X[Y.XRANGEPLAIN]})\\s+-\\s+(${X[Y.XRANGEPLAIN]})\\s*$`);se("HYPHENRANGELOOSE",`^\\s*(${X[Y.XRANGEPLAINLOOSE]})\\s+-\\s+(${X[Y.XRANGEPLAINLOOSE]})\\s*$`);se("STAR","(<|>)?=?\\s*\\*");se("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");se("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Fl=C((HJ,LS)=>{"use strict";var M5=Object.freeze({loose:!0}),q5=Object.freeze({}),H5=t=>t?typeof t!="object"?M5:t:q5;LS.exports=H5});var ig=C((VJ,MS)=>{"use strict";var jS=/^[0-9]+$/,US=(t,e)=>{if(typeof t=="number"&&typeof e=="number")return t===e?0:t<e?-1:1;let r=jS.test(t),n=jS.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:t<e?-1:1},V5=(t,e)=>US(e,t);MS.exports={compareIdentifiers:US,rcompareIdentifiers:V5}});var Ct=C((zJ,HS)=>{"use strict";var Ol=Aa(),{MAX_LENGTH:qS,MAX_SAFE_INTEGER:kl}=Sa(),{safeRe:$l,t:Pl}=Yi(),z5=Fl(),{compareIdentifiers:sg}=ig(),ag=class t{constructor(e,r){if(r=z5(r),e instanceof t){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>qS)throw new TypeError(`version is longer than ${qS} characters`);Ol("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?$l[Pl.LOOSE]:$l[Pl.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>kl||this.major<0)throw new TypeError("Invalid major version");if(this.minor>kl||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>kl||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(o=>{if(/^[0-9]+$/.test(o)){let i=+o;if(i>=0&&i<kl)return i}return o}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(Ol("SemVer.compare",this.version,this.options,e),!(e instanceof t)){if(typeof e=="string"&&e===this.version)return 0;e=new t(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof t||(e=new t(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(e){if(e instanceof t||(e=new t(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],o=e.prerelease[r];if(Ol("prerelease compare",r,n,o),n===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(n===void 0)return-1;if(n===o)continue;return sg(n,o)}while(++r)}compareBuild(e){e instanceof t||(e=new t(e,this.options));let r=0;do{let n=this.build[r],o=e.build[r];if(Ol("build compare",r,n,o),n===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(n===void 0)return-1;if(n===o)continue;return sg(n,o)}while(++r)}inc(e,r,n){if(e.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let o=`-${r}`.match(this.options.loose?$l[Pl.PRERELEASELOOSE]:$l[Pl.PRERELEASE]);if(!o||o[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let o=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[o];else{let i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(o)}}if(r){let i=[r,o];n===!1&&(i=[r]),sg(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};HS.exports=ag});var Io=C((GJ,zS)=>{"use strict";var VS=Ct(),G5=(t,e,r=!1)=>{if(t instanceof VS)return t;try{return new VS(t,e)}catch(n){if(!r)return null;throw n}};zS.exports=G5});var WS=C((WJ,GS)=>{"use strict";var W5=Io(),K5=(t,e)=>{let r=W5(t,e);return r?r.version:null};GS.exports=K5});var XS=C((KJ,KS)=>{"use strict";var X5=Io(),Y5=(t,e)=>{let r=X5(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};KS.exports=Y5});var ZS=C((XJ,JS)=>{"use strict";var YS=Ct(),J5=(t,e,r,n,o)=>{typeof r=="string"&&(o=n,n=r,r=void 0);try{return new YS(t instanceof YS?t.version:t,r).inc(e,n,o).version}catch{return null}};JS.exports=J5});var t1=C((YJ,e1)=>{"use strict";var QS=Io(),Z5=(t,e)=>{let r=QS(t,null,!0),n=QS(e,null,!0),o=r.compare(n);if(o===0)return null;let i=o>0,s=i?r:n,a=i?n:r,u=!!s.prerelease.length;if(!!a.prerelease.length&&!u){if(!a.patch&&!a.minor)return"major";if(a.compareMain(s)===0)return a.minor&&!a.patch?"minor":"patch"}let l=u?"pre":"";return r.major!==n.major?l+"major":r.minor!==n.minor?l+"minor":r.patch!==n.patch?l+"patch":"prerelease"};e1.exports=Z5});var n1=C((JJ,r1)=>{"use strict";var Q5=Ct(),eM=(t,e)=>new Q5(t,e).major;r1.exports=eM});var i1=C((ZJ,o1)=>{"use strict";var tM=Ct(),rM=(t,e)=>new tM(t,e).minor;o1.exports=rM});var a1=C((QJ,s1)=>{"use strict";var nM=Ct(),oM=(t,e)=>new nM(t,e).patch;s1.exports=oM});var c1=C((eZ,u1)=>{"use strict";var iM=Io(),sM=(t,e)=>{let r=iM(t,e);return r&&r.prerelease.length?r.prerelease:null};u1.exports=sM});var hr=C((tZ,f1)=>{"use strict";var l1=Ct(),aM=(t,e,r)=>new l1(t,r).compare(new l1(e,r));f1.exports=aM});var d1=C((rZ,p1)=>{"use strict";var uM=hr(),cM=(t,e,r)=>uM(e,t,r);p1.exports=cM});var m1=C((nZ,h1)=>{"use strict";var lM=hr(),fM=(t,e)=>lM(t,e,!0);h1.exports=fM});var Tl=C((oZ,D1)=>{"use strict";var g1=Ct(),pM=(t,e,r)=>{let n=new g1(t,r),o=new g1(e,r);return n.compare(o)||n.compareBuild(o)};D1.exports=pM});var b1=C((iZ,y1)=>{"use strict";var dM=Tl(),hM=(t,e)=>t.sort((r,n)=>dM(r,n,e));y1.exports=hM});var v1=C((sZ,w1)=>{"use strict";var mM=Tl(),gM=(t,e)=>t.sort((r,n)=>mM(n,r,e));w1.exports=gM});var Fa=C((aZ,E1)=>{"use strict";var DM=hr(),yM=(t,e,r)=>DM(t,e,r)>0;E1.exports=yM});var Rl=C((uZ,C1)=>{"use strict";var bM=hr(),wM=(t,e,r)=>bM(t,e,r)<0;C1.exports=wM});var ug=C((cZ,_1)=>{"use strict";var vM=hr(),EM=(t,e,r)=>vM(t,e,r)===0;_1.exports=EM});var cg=C((lZ,x1)=>{"use strict";var CM=hr(),_M=(t,e,r)=>CM(t,e,r)!==0;x1.exports=_M});var Il=C((fZ,S1)=>{"use strict";var xM=hr(),SM=(t,e,r)=>xM(t,e,r)>=0;S1.exports=SM});var Bl=C((pZ,A1)=>{"use strict";var AM=hr(),FM=(t,e,r)=>AM(t,e,r)<=0;A1.exports=FM});var lg=C((dZ,F1)=>{"use strict";var OM=ug(),kM=cg(),$M=Fa(),PM=Il(),TM=Rl(),RM=Bl(),IM=(t,e,r,n)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t===r;case"!==":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t!==r;case"":case"=":case"==":return OM(t,r,n);case"!=":return kM(t,r,n);case">":return $M(t,r,n);case">=":return PM(t,r,n);case"<":return TM(t,r,n);case"<=":return RM(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};F1.exports=IM});var k1=C((hZ,O1)=>{"use strict";var BM=Ct(),NM=Io(),{safeRe:Nl,t:Ll}=Yi(),LM=(t,e)=>{if(t instanceof BM)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let r=null;if(!e.rtl)r=t.match(e.includePrerelease?Nl[Ll.COERCEFULL]:Nl[Ll.COERCE]);else{let u=e.includePrerelease?Nl[Ll.COERCERTLFULL]:Nl[Ll.COERCERTL],c;for(;(c=u.exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||c.index+c[0].length!==r.index+r[0].length)&&(r=c),u.lastIndex=c.index+c[1].length+c[2].length;u.lastIndex=-1}if(r===null)return null;let n=r[2],o=r[3]||"0",i=r[4]||"0",s=e.includePrerelease&&r[5]?`-${r[5]}`:"",a=e.includePrerelease&&r[6]?`+${r[6]}`:"";return NM(`${n}.${o}.${i}${s}${a}`,e)};O1.exports=LM});var P1=C((mZ,$1)=>{"use strict";var fg=class{constructor(){this.max=1e3,this.map=new Map}get(e){let r=this.map.get(e);if(r!==void 0)return this.map.delete(e),this.map.set(e,r),r}delete(e){return this.map.delete(e)}set(e,r){if(!this.delete(e)&&r!==void 0){if(this.map.size>=this.max){let o=this.map.keys().next().value;this.delete(o)}this.map.set(e,r)}return this}};$1.exports=fg});var mr=C((gZ,B1)=>{"use strict";var jM=/\s+/g,pg=class t{constructor(e,r){if(r=MM(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof dg)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=e.trim().replace(jM," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(o=>!R1(o[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let o of this.set)if(o.length===1&&KM(o[0])){this.set=[o];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");let r=this.set[e];for(let n=0;n<r.length;n++)n>0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let n=((this.options.includePrerelease&&GM)|(this.options.loose&&WM))+":"+e,o=T1.get(n);if(o)return o;let i=this.options.loose,s=i?Ut[_t.HYPHENRANGELOOSE]:Ut[_t.HYPHENRANGE];e=e.replace(s,o9(this.options.includePrerelease)),Le("hyphen replace",e),e=e.replace(Ut[_t.COMPARATORTRIM],HM),Le("comparator trim",e),e=e.replace(Ut[_t.TILDETRIM],VM),Le("tilde trim",e),e=e.replace(Ut[_t.CARETTRIM],zM),Le("caret trim",e);let a=e.split(" ").map(f=>XM(f,this.options)).join(" ").split(/\s+/).map(f=>n9(f,this.options));i&&(a=a.filter(f=>(Le("loose invalid filter",f,this.options),!!f.match(Ut[_t.COMPARATORLOOSE])))),Le("range list",a);let u=new Map,c=a.map(f=>new dg(f,this.options));for(let f of c){if(R1(f))return[f];u.set(f.value,f)}u.size>1&&u.has("")&&u.delete("");let l=[...u.values()];return T1.set(n,l),l}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(n=>I1(n,r)&&e.set.some(o=>I1(o,r)&&n.every(i=>o.every(s=>i.intersects(s,r)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new qM(e,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(i9(this.set[r],e,this.options))return!0;return!1}};B1.exports=pg;var UM=P1(),T1=new UM,MM=Fl(),dg=Oa(),Le=Aa(),qM=Ct(),{safeRe:Ut,t:_t,comparatorTrimReplace:HM,tildeTrimReplace:VM,caretTrimReplace:zM}=Yi(),{FLAG_INCLUDE_PRERELEASE:GM,FLAG_LOOSE:WM}=Sa(),R1=t=>t.value==="<0.0.0-0",KM=t=>t.value==="",I1=(t,e)=>{let r=!0,n=t.slice(),o=n.pop();for(;r&&n.length;)r=n.every(i=>o.intersects(i,e)),o=n.pop();return r},XM=(t,e)=>(t=t.replace(Ut[_t.BUILD],""),Le("comp",t,e),t=ZM(t,e),Le("caret",t),t=YM(t,e),Le("tildes",t),t=e9(t,e),Le("xrange",t),t=r9(t,e),Le("stars",t),t),Mt=t=>!t||t.toLowerCase()==="x"||t==="*",YM=(t,e)=>t.trim().split(/\s+/).map(r=>JM(r,e)).join(" "),JM=(t,e)=>{let r=e.loose?Ut[_t.TILDELOOSE]:Ut[_t.TILDE];return t.replace(r,(n,o,i,s,a)=>{Le("tilde",t,n,o,i,s,a);let u;return Mt(o)?u="":Mt(i)?u=`>=${o}.0.0 <${+o+1}.0.0-0`:Mt(s)?u=`>=${o}.${i}.0 <${o}.${+i+1}.0-0`:a?(Le("replaceTilde pr",a),u=`>=${o}.${i}.${s}-${a} <${o}.${+i+1}.0-0`):u=`>=${o}.${i}.${s} <${o}.${+i+1}.0-0`,Le("tilde return",u),u})},ZM=(t,e)=>t.trim().split(/\s+/).map(r=>QM(r,e)).join(" "),QM=(t,e)=>{Le("caret",t,e);let r=e.loose?Ut[_t.CARETLOOSE]:Ut[_t.CARET],n=e.includePrerelease?"-0":"";return t.replace(r,(o,i,s,a,u)=>{Le("caret",t,o,i,s,a,u);let c;return Mt(i)?c="":Mt(s)?c=`>=${i}.0.0${n} <${+i+1}.0.0-0`:Mt(a)?i==="0"?c=`>=${i}.${s}.0${n} <${i}.${+s+1}.0-0`:c=`>=${i}.${s}.0${n} <${+i+1}.0.0-0`:u?(Le("replaceCaret pr",u),i==="0"?s==="0"?c=`>=${i}.${s}.${a}-${u} <${i}.${s}.${+a+1}-0`:c=`>=${i}.${s}.${a}-${u} <${i}.${+s+1}.0-0`:c=`>=${i}.${s}.${a}-${u} <${+i+1}.0.0-0`):(Le("no pr"),i==="0"?s==="0"?c=`>=${i}.${s}.${a}${n} <${i}.${s}.${+a+1}-0`:c=`>=${i}.${s}.${a}${n} <${i}.${+s+1}.0-0`:c=`>=${i}.${s}.${a} <${+i+1}.0.0-0`),Le("caret return",c),c})},e9=(t,e)=>(Le("replaceXRanges",t,e),t.split(/\s+/).map(r=>t9(r,e)).join(" ")),t9=(t,e)=>{t=t.trim();let r=e.loose?Ut[_t.XRANGELOOSE]:Ut[_t.XRANGE];return t.replace(r,(n,o,i,s,a,u)=>{Le("xRange",t,n,o,i,s,a,u);let c=Mt(i),l=c||Mt(s),f=l||Mt(a),h=f;return o==="="&&h&&(o=""),u=e.includePrerelease?"-0":"",c?o===">"||o==="<"?n="<0.0.0-0":n="*":o&&h?(l&&(s=0),a=0,o===">"?(o=">=",l?(i=+i+1,s=0,a=0):(s=+s+1,a=0)):o==="<="&&(o="<",l?i=+i+1:s=+s+1),o==="<"&&(u="-0"),n=`${o+i}.${s}.${a}${u}`):l?n=`>=${i}.0.0${u} <${+i+1}.0.0-0`:f&&(n=`>=${i}.${s}.0${u} <${i}.${+s+1}.0-0`),Le("xRange return",n),n})},r9=(t,e)=>(Le("replaceStars",t,e),t.trim().replace(Ut[_t.STAR],"")),n9=(t,e)=>(Le("replaceGTE0",t,e),t.trim().replace(Ut[e.includePrerelease?_t.GTE0PRE:_t.GTE0],"")),o9=t=>(e,r,n,o,i,s,a,u,c,l,f,h)=>(Mt(n)?r="":Mt(o)?r=`>=${n}.0.0${t?"-0":""}`:Mt(i)?r=`>=${n}.${o}.0${t?"-0":""}`:s?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,Mt(c)?u="":Mt(l)?u=`<${+c+1}.0.0-0`:Mt(f)?u=`<${c}.${+l+1}.0-0`:h?u=`<=${c}.${l}.${f}-${h}`:t?u=`<${c}.${l}.${+f+1}-0`:u=`<=${u}`,`${r} ${u}`.trim()),i9=(t,e,r)=>{for(let n=0;n<t.length;n++)if(!t[n].test(e))return!1;if(e.prerelease.length&&!r.includePrerelease){for(let n=0;n<t.length;n++)if(Le(t[n].semver),t[n].semver!==dg.ANY&&t[n].semver.prerelease.length>0){let o=t[n].semver;if(o.major===e.major&&o.minor===e.minor&&o.patch===e.patch)return!0}return!1}return!0}});var Oa=C((DZ,q1)=>{"use strict";var ka=Symbol("SemVer ANY"),gg=class t{static get ANY(){return ka}constructor(e,r){if(r=N1(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),mg("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===ka?this.value="":this.value=this.operator+this.semver.version,mg("comp",this)}parse(e){let r=this.options.loose?L1[j1.COMPARATORLOOSE]:L1[j1.COMPARATOR],n=e.match(r);if(!n)throw new TypeError(`Invalid comparator: ${e}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new U1(n[2],this.options.loose):this.semver=ka}toString(){return this.value}test(e){if(mg("Comparator.test",e,this.options.loose),this.semver===ka||e===ka)return!0;if(typeof e=="string")try{e=new U1(e,this.options)}catch{return!1}return hg(e,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new M1(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new M1(this.value,r).test(e.semver):(r=N1(r),r.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||hg(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||hg(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};q1.exports=gg;var N1=Fl(),{safeRe:L1,t:j1}=Yi(),hg=lg(),mg=Aa(),U1=Ct(),M1=mr()});var $a=C((yZ,H1)=>{"use strict";var s9=mr(),a9=(t,e,r)=>{try{e=new s9(e,r)}catch{return!1}return e.test(t)};H1.exports=a9});var z1=C((bZ,V1)=>{"use strict";var u9=mr(),c9=(t,e)=>new u9(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));V1.exports=c9});var W1=C((wZ,G1)=>{"use strict";var l9=Ct(),f9=mr(),p9=(t,e,r)=>{let n=null,o=null,i=null;try{i=new f9(e,r)}catch{return null}return t.forEach(s=>{i.test(s)&&(!n||o.compare(s)===-1)&&(n=s,o=new l9(n,r))}),n};G1.exports=p9});var X1=C((vZ,K1)=>{"use strict";var d9=Ct(),h9=mr(),m9=(t,e,r)=>{let n=null,o=null,i=null;try{i=new h9(e,r)}catch{return null}return t.forEach(s=>{i.test(s)&&(!n||o.compare(s)===1)&&(n=s,o=new d9(n,r))}),n};K1.exports=m9});var Z1=C((EZ,J1)=>{"use strict";var Dg=Ct(),g9=mr(),Y1=Fa(),D9=(t,e)=>{t=new g9(t,e);let r=new Dg("0.0.0");if(t.test(r)||(r=new Dg("0.0.0-0"),t.test(r)))return r;r=null;for(let n=0;n<t.set.length;++n){let o=t.set[n],i=null;o.forEach(s=>{let a=new Dg(s.semver.version);switch(s.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!i||Y1(a,i))&&(i=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${s.operator}`)}}),i&&(!r||Y1(r,i))&&(r=i)}return r&&t.test(r)?r:null};J1.exports=D9});var eA=C((CZ,Q1)=>{"use strict";var y9=mr(),b9=(t,e)=>{try{return new y9(t,e).range||"*"}catch{return null}};Q1.exports=b9});var jl=C((_Z,oA)=>{"use strict";var w9=Ct(),nA=Oa(),{ANY:v9}=nA,E9=mr(),C9=$a(),tA=Fa(),rA=Rl(),_9=Bl(),x9=Il(),S9=(t,e,r,n)=>{t=new w9(t,n),e=new E9(e,n);let o,i,s,a,u;switch(r){case">":o=tA,i=_9,s=rA,a=">",u=">=";break;case"<":o=rA,i=x9,s=tA,a="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(C9(t,e,n))return!1;for(let c=0;c<e.set.length;++c){let l=e.set[c],f=null,h=null;if(l.forEach(d=>{d.semver===v9&&(d=new nA(">=0.0.0")),f=f||d,h=h||d,o(d.semver,f.semver,n)?f=d:s(d.semver,h.semver,n)&&(h=d)}),f.operator===a||f.operator===u||(!h.operator||h.operator===a)&&i(t,h.semver))return!1;if(h.operator===u&&s(t,h.semver))return!1}return!0};oA.exports=S9});var sA=C((xZ,iA)=>{"use strict";var A9=jl(),F9=(t,e,r)=>A9(t,e,">",r);iA.exports=F9});var uA=C((SZ,aA)=>{"use strict";var O9=jl(),k9=(t,e,r)=>O9(t,e,"<",r);aA.exports=k9});var fA=C((AZ,lA)=>{"use strict";var cA=mr(),$9=(t,e,r)=>(t=new cA(t,r),e=new cA(e,r),t.intersects(e,r));lA.exports=$9});var dA=C((FZ,pA)=>{"use strict";var P9=$a(),T9=hr();pA.exports=(t,e,r)=>{let n=[],o=null,i=null,s=t.sort((l,f)=>T9(l,f,r));for(let l of s)P9(l,e,r)?(i=l,o||(o=l)):(i&&n.push([o,i]),i=null,o=null);o&&n.push([o,null]);let a=[];for(let[l,f]of n)l===f?a.push(l):!f&&l===s[0]?a.push("*"):f?l===s[0]?a.push(`<=${f}`):a.push(`${l} - ${f}`):a.push(`>=${l}`);let u=a.join(" || "),c=typeof e.raw=="string"?e.raw:String(e);return u.length<c.length?u:e}});var bA=C((OZ,yA)=>{"use strict";var hA=mr(),bg=Oa(),{ANY:yg}=bg,Pa=$a(),wg=hr(),R9=(t,e,r={})=>{if(t===e)return!0;t=new hA(t,r),e=new hA(e,r);let n=!1;e:for(let o of t.set){for(let i of e.set){let s=B9(o,i,r);if(n=n||s!==null,s)continue e}if(n)return!1}return!0},I9=[new bg(">=0.0.0-0")],mA=[new bg(">=0.0.0")],B9=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===yg){if(e.length===1&&e[0].semver===yg)return!0;r.includePrerelease?t=I9:t=mA}if(e.length===1&&e[0].semver===yg){if(r.includePrerelease)return!0;e=mA}let n=new Set,o,i;for(let d of t)d.operator===">"||d.operator===">="?o=gA(o,d,r):d.operator==="<"||d.operator==="<="?i=DA(i,d,r):n.add(d.semver);if(n.size>1)return null;let s;if(o&&i){if(s=wg(o.semver,i.semver,r),s>0)return null;if(s===0&&(o.operator!==">="||i.operator!=="<="))return null}for(let d of n){if(o&&!Pa(d,String(o),r)||i&&!Pa(d,String(i),r))return null;for(let m of e)if(!Pa(d,String(m),r))return!1;return!0}let a,u,c,l,f=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,h=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1;f&&f.prerelease.length===1&&i.operator==="<"&&f.prerelease[0]===0&&(f=!1);for(let d of e){if(l=l||d.operator===">"||d.operator===">=",c=c||d.operator==="<"||d.operator==="<=",o){if(h&&d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===h.major&&d.semver.minor===h.minor&&d.semver.patch===h.patch&&(h=!1),d.operator===">"||d.operator===">="){if(a=gA(o,d,r),a===d&&a!==o)return!1}else if(o.operator===">="&&!Pa(o.semver,String(d),r))return!1}if(i){if(f&&d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===f.major&&d.semver.minor===f.minor&&d.semver.patch===f.patch&&(f=!1),d.operator==="<"||d.operator==="<="){if(u=DA(i,d,r),u===d&&u!==i)return!1}else if(i.operator==="<="&&!Pa(i.semver,String(d),r))return!1}if(!d.operator&&(i||o)&&s!==0)return!1}return!(o&&c&&!i&&s!==0||i&&l&&!o&&s!==0||h||f)},gA=(t,e,r)=>{if(!t)return e;let n=wg(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},DA=(t,e,r)=>{if(!t)return e;let n=wg(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};yA.exports=R9});var CA=C((kZ,EA)=>{"use strict";var vg=Yi(),wA=Sa(),N9=Ct(),vA=ig(),L9=Io(),j9=WS(),U9=XS(),M9=ZS(),q9=t1(),H9=n1(),V9=i1(),z9=a1(),G9=c1(),W9=hr(),K9=d1(),X9=m1(),Y9=Tl(),J9=b1(),Z9=v1(),Q9=Fa(),eq=Rl(),tq=ug(),rq=cg(),nq=Il(),oq=Bl(),iq=lg(),sq=k1(),aq=Oa(),uq=mr(),cq=$a(),lq=z1(),fq=W1(),pq=X1(),dq=Z1(),hq=eA(),mq=jl(),gq=sA(),Dq=uA(),yq=fA(),bq=dA(),wq=bA();EA.exports={parse:L9,valid:j9,clean:U9,inc:M9,diff:q9,major:H9,minor:V9,patch:z9,prerelease:G9,compare:W9,rcompare:K9,compareLoose:X9,compareBuild:Y9,sort:J9,rsort:Z9,gt:Q9,lt:eq,eq:tq,neq:rq,gte:nq,lte:oq,cmp:iq,coerce:sq,Comparator:aq,Range:uq,satisfies:cq,toComparators:lq,maxSatisfying:fq,minSatisfying:pq,minVersion:dq,validRange:hq,outside:mq,gtr:gq,ltr:Dq,intersects:yq,simplifyRange:bq,subset:wq,SemVer:N9,re:vg.re,src:vg.src,tokens:vg.t,SEMVER_SPEC_VERSION:wA.SEMVER_SPEC_VERSION,RELEASE_TYPES:wA.RELEASE_TYPES,compareIdentifiers:vA.compareIdentifiers,rcompareIdentifiers:vA.rcompareIdentifiers}});var IA=C(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 Ra=(he(),oe(de)),_A=Gm(),jn=Mi(),Bo=require("path"),$e=Ra.__importDefault(qi()),Ji=El(),SA=_a(),vq=$S(),xA=gu(),Ta=Sl(),Eq=Al();async function Cq(t){let r=(await Promise.all(t.map(n=>n()))).filter(n=>n!=null);if(r.length>0)throw r.join(`
70
- `)}J.check=Cq;async function _q(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,Bo.join)(t.app.webDirAbs,"index.html"))?null:`The web assets directory (${$e.default.strong((0,_A.prettyPath)(t.app.webDirAbs))}) must contain an ${$e.default.strong("index.html")} file.
71
- It will be the entry point for the web portion of the Capacitor app.`:`Could not find the web assets directory: ${$e.default.strong((0,_A.prettyPath)(t.app.webDirAbs))}.
72
- 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=_q;async function xq(){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.
61
+ ${Dx(r)}`)}Ve.wordWrap=HN;function VN(t){t=yx(t);let e=process.cwd(),r=en.dirname(t),n=jN.homedir(),o=Math.abs(r.split(en.sep).length-e.split(en.sep).length);if(e===r)return"."+en.sep+en.basename(t);if(r.startsWith(e))return"."+en.sep+t.substring(e.length+1);if(o<=2){let i=en.relative(e,t);return i||"."}else{if(t===n)return"~";if(t.indexOf(n)===0)return"~"+en.sep+t.substring(n.length+1)}return t}Ve.prettyPath=VN;function yx(t){return en.resolve(UN(t))}Ve.expandPath=yx;function bx(t,e=1,r=" "){e<2&&(e=2);let n=Math.max(...t.map(a=>Qc(a))),o=n>e?n+1:e,i=r.repeat(o);return t.map(a=>gx(i,0,o-Qc(a)))}Ve.generateFillSpaceStringList=bx;function zN(t,{hsep:e="-",vsep:r="|",headers:n}){let o=!!n;if(!t[0])return"";let i=n?n.length:t[0].length,a=n?n.map(l=>[l]):t[0].map(()=>[]);for(let l of t){let f=0,d=l.map(h=>{let m=h.split(`
62
+ `);return f=Math.max(f,m.length),m});for(let h in l)a[h]&&a[h].push(...d[h],...Array(f-d[h].length).fill(""))}let s=a.map((l,f)=>{if(f<i-1){let d=bx(l);return l.map((h,m)=>`${h}${d[m]}${r===""?"":`${r} `}`)}else return l}),u=0,c=s.reduce((l,f)=>l.map((d,h)=>{let m=l[h]+f[h];return u=Math.max(u,Qc(m)),m}));return o&&e!==""&&c.splice(1,0,e.repeat(u)),c.join(`
63
+ `)}Ve.columnar=zN});var wx=x(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.TERMINAL_INFO=ir.CI_ENVIRONMENT_VARIABLES_DETECTED=ir.CI_ENVIRONMENT_VARIABLES=void 0;var GN=(fe(),re(le)),WN=Vh(),KN=GN.__importStar(require("os")),YN=(0,WN.debug)("ionic:utils-terminal:info");ir.CI_ENVIRONMENT_VARIABLES=["CI","BUILD_ID","BUILD_NUMBER","BITBUCKET_COMMIT","CODEBUILD_BUILD_ARN","GITHUB_ACTIONS"];ir.CI_ENVIRONMENT_VARIABLES_DETECTED=ir.CI_ENVIRONMENT_VARIABLES.filter(t=>!!process.env[t]);function JN(){let{shell:t}=KN.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")}ir.CI_ENVIRONMENT_VARIABLES_DETECTED.length>0&&YN(`Environment variables for CI detected: ${ir.CI_ENVIRONMENT_VARIABLES_DETECTED.join(", ")}`);ir.TERMINAL_INFO=Object.freeze({ci:ir.CI_ENVIRONMENT_VARIABLES_DETECTED.length>0,shell:JN(),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(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});var el=(fe(),re(le));el.__exportStar(rm(),Ri);el.__exportStar($_(),Ri);el.__exportStar(vx(),Ri);el.__exportStar(wx(),Ri)});var rl=x(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});Pr.isFatal=Pr.fatal=Pr.FatalException=Pr.BaseException=void 0;var tl=class extends Error{constructor(e,r){super(e),this.message=e,this.code=r}};Pr.BaseException=tl;var ls=class extends tl{constructor(e,r=1){super(e,"FATAL"),this.message=e,this.exitCode=r}};Pr.FatalException=ls;function XN(t){throw new ls(t)}Pr.fatal=XN;function ZN(t){return t&&t instanceof ls}Pr.isFatal=ZN});var Dm={};qr(Dm,{LOGGER_LEVELS:()=>aL,Logger:()=>gm,NO_COLORS:()=>Cx,StreamOutputStrategy:()=>nl,TTYOutputStrategy:()=>mm,TTY_WIDTH:()=>QN,createDefaultLogger:()=>iL,indent:()=>eL,sliceAnsi:()=>tL,stringWidth:()=>rL,stripAnsi:()=>nL,wordWrap:()=>oL});var QN,eL,tL,rL,nL,oL,iL,Cx,nl,mm,gm,aL,ym=et(()=>{QN=80,eL=t=>t,tL=t=>t,rL=t=>t.length,nL=t=>t,oL=t=>t,iL=()=>({info:console.log,warn:console.warn,error:console.error,debug:console.debug}),Cx={},nl=class{constructor(){this.colors=Cx,this.stream=process.stdout}},mm=class extends nl{constructor(e){super(),this.options=e}},gm=class{constructor(){}info(){}warn(){}error(){}debug(){}},aL={DEBUG:"DEBUG",INFO:"INFO",WARN:"WARN",ERROR:"ERROR"}});var _x=x(wo=>{"use strict";Object.defineProperty(wo,"__esModule",{value:!0});wo.isInteractive=wo.checkInteractive=void 0;var sL=(fe(),re(le)),Ex=hm(),uL=sL.__importDefault(ki()),cL=fs(),lL=(...t)=>(0,wo.isInteractive)()?!0:t.length?t.filter(e=>!e).length?(cL.logger.error(`Non-interactive shell detected.
64
+ Run the command with ${uL.default.input("--help")} to see a list of arguments that must be provided.`),!1):!0:!1;wo.checkInteractive=lL;var fL=()=>Ex.TERMINAL_INFO.tty&&!Ex.TERMINAL_INFO.ci;wo.isInteractive=fL});var ol={};qr(ol,{default:()=>xx});function xx(){throw new Error("Prompts are not supported in this CLI build")}var il=et(()=>{});var fs=x(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.logSuccess=Mt.logPrompt=Mt.logger=Mt.output=void 0;var bm=(fe(),re(le)),Co=(ym(),re(Dm)),Eo=bm.__importDefault(ki()),pL=_x(),Sx={colors:Eo.default,stream:process.argv.includes("--json")?process.stderr:process.stdout};Mt.output=(0,pL.isInteractive)()?new Co.TTYOutputStrategy(Sx):new Co.StreamOutputStrategy(Sx);Mt.logger=(0,Co.createDefaultLogger)({output:Mt.output,formatterOptions:{titleize:!1,tags:new Map([[Co.LOGGER_LEVELS.DEBUG,Eo.default.log.DEBUG("[debug]")],[Co.LOGGER_LEVELS.INFO,Eo.default.log.INFO("[info]")],[Co.LOGGER_LEVELS.WARN,Eo.default.log.WARN("[warn]")],[Co.LOGGER_LEVELS.ERROR,Eo.default.log.ERROR("[error]")]])}});async function dL(t,e){let{wordWrap:r}=await Promise.resolve().then(()=>bm.__importStar((ym(),re(Dm)))),{prompt:n}=await Promise.resolve().then(()=>bm.__importStar((il(),re(ol))));return Mt.logger.log({msg:`${Eo.default.input("[?]")} ${r(t,{indentation:4})}`,logger:Mt.logger,format:!1}),n(e,{onCancel:()=>process.exit(1)})}Mt.logPrompt=dL;function hL(t){Mt.logger.msg(`${Eo.default.success("[success]")} ${t}`)}Mt.logSuccess=hL});var al=x(Bi=>{"use strict";Object.defineProperty(Bi,"__esModule",{value:!0});Bi.resolveNode=Bi.requireTS=void 0;var mL=require("fs"),gL=Oi(),DL=require("path"),yL=(t,e)=>{let r=(0,DL.resolve)(e);delete require.cache[r],require.extensions[".ts"]=(o,i)=>{var a;let s=(0,gL.readFileSync)(i,"utf8");i.endsWith(".ts")?s=t.transpileModule(s,{fileName:i,compilerOptions:{module:t.ModuleKind.CommonJS,moduleResolution:t.ModuleResolutionKind.NodeJs,esModuleInterop:!0,strict:!0,target:t.ScriptTarget.ES2017},reportDiagnostics:!0}).outputText:s=s.replace(/export\s+\w+\s+(\w+)/gm,"exports.$1"),(a=o._compile)===null||a===void 0||a.call(o,s,i)};let n=require(r);return delete require.extensions[".ts"],n};Bi.requireTS=yL;function bL(t,...e){try{return require.resolve(e.join("/"),{paths:[t]})}catch{let n=[t,"node_modules",...e].join("/");return(0,mL.existsSync)(n)?n:null}}Bi.resolveNode=bL});var Fx={};qr(Fx,{default:()=>vL});var vL,Ax=et(()=>{vL={}});var Ox=x(Tr=>{"use strict";Object.defineProperty(Tr,"__esModule",{value:!0});Tr.buildXmlElement=Tr.writeXML=Tr.parseXML=Tr.readXML=void 0;var wL=(fe(),re(le)),CL=Oi(),ps=wL.__importDefault((Ax(),re(Fx)));async function EL(t){var e;try{let r=await(0,CL.readFile)(t,{encoding:"utf-8"});try{return await ps.default.parseStringPromise(r)}catch(n){throw`Error parsing: ${t}, ${(e=n.stack)!==null&&e!==void 0?e:n}`}}catch{throw`Unable to read: ${t}`}}Tr.readXML=EL;function _L(t,e){let r=e!==void 0?new ps.default.Parser({...e}):new ps.default.Parser,n;return r.parseString(t,(o,i)=>{o||(n=i)}),n}Tr.parseXML=_L;async function xL(t){return new Promise(e=>{let n=new ps.default.Builder({headless:!0,explicitRoot:!1,rootName:"deleteme"}).buildObject(t);n=n.replace("<deleteme>","").replace("</deleteme>",""),e(n)})}Tr.writeXML=xL;function SL(t,e){return new ps.default.Builder({headless:!0,explicitRoot:!1,rootName:e}).buildObject(t)}Tr.buildXmlElement=SL});var Ix=x(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.getAllElements=Fe.getFilePath=Fe.getAssets=Fe.getJSModules=Fe.getPluginType=Fe.getPlatformElement=Fe.getPluginPlatform=Fe.printPlugins=Fe.fixName=Fe.getDependencies=Fe.resolvePlugin=Fe.getPlugins=Fe.getIncludedPluginPackages=void 0;var FL=(fe(),re(le)),AL=Oi(),vm=require("path"),ji=FL.__importDefault(ki()),OL=rl(),kL=fs(),kx=al(),$L=Ox();function $x(t,e){var r,n,o,i;let{extConfig:a}=t.app;switch(e){case"android":return(n=(r=a.android)===null||r===void 0?void 0:r.includePlugins)!==null&&n!==void 0?n:a.includePlugins;case"ios":return(i=(o=a.ios)===null||o===void 0?void 0:o.includePlugins)!==null&&i!==void 0?i:a.includePlugins}}Fe.getIncludedPluginPackages=$x;async function PL(t,e){var r;let n=(r=$x(t,e))!==null&&r!==void 0?r:Tx(t);return(await Promise.all(n.map(async i=>Px(t,i)))).filter(i=>!!i)}Fe.getPlugins=PL;async function Px(t,e){try{let r=(0,kx.resolveNode)(t.app.rootDir,e,"package.json");r||(0,OL.fatal)(`Unable to find ${ji.default.strong(`node_modules/${e}`)}.
65
+ Are you sure ${ji.default.strong(e)} is installed?`);let n=(0,vm.dirname)(r),o=await(0,AL.readJSON)(r);if(!o)return null;if(o.capacitor)return{id:e,name:wm(e),version:o.version,rootPath:n,repository:o.repository,manifest:o.capacitor};let i=(0,vm.join)(n,"plugin.xml"),a=await(0,$L.readXML)(i);return{id:e,name:wm(e),version:o.version,rootPath:n,repository:o.repository,xml:a.plugin}}catch{}return null}Fe.resolvePlugin=Px;function Tx(t){var e,r;return[...Object.keys((e=t.app.package.dependencies)!==null&&e!==void 0?e:{}),...Object.keys((r=t.app.package.devDependencies)!==null&&r!==void 0?r:{})]}Fe.getDependencies=Tx;function wm(t){return t=t.replace(/\//g,"_").replace(/-/g,"_").replace(/@/g,"").replace(/_\w/g,e=>e[1].toUpperCase()),t.charAt(0).toUpperCase()+t.slice(1)}Fe.fixName=wm;function TL(t,e,r="capacitor"){if(t.length===0)return;let n,o=t.length===1?"":"s";switch(r){case"cordova":n=`Found ${t.length} Cordova plugin${o} for ${ji.default.strong(e)}:
66
+ `;break;case"incompatible":n=`Found ${t.length} incompatible Cordova plugin${o} for ${ji.default.strong(e)}, skipped install:
67
+ `;break;case"capacitor":n=`Found ${t.length} Capacitor plugin${o} for ${ji.default.strong(e)}:
68
+ `;break}n+=t.map(i=>`${i.id}${ji.default.weak(`@${i.version}`)}`).join(`
69
+ `),kL.logger.info(n)}Fe.printPlugins=TL;function Cm(t,e){return t.xml.platform?t.xml.platform.filter(function(o){return o.$.name===e})[0]:[]}Fe.getPluginPlatform=Cm;function IL(t,e,r){let n=Cm(t,e);if(n){let o=n[r];if(o)return o}return[]}Fe.getPlatformElement=IL;function RL(t,e){var r,n,o,i;switch(e){case"ios":return(n=(r=t.ios)===null||r===void 0?void 0:r.type)!==null&&n!==void 0?n:0;case"android":return(i=(o=t.android)===null||o===void 0?void 0:o.type)!==null&&i!==void 0?i:0}return 0}Fe.getPluginType=RL;function BL(t,e){return Em(t,e,"js-module")}Fe.getJSModules=BL;function jL(t,e){return Em(t,e,"asset")}Fe.getAssets=jL;function NL(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,kx.resolveNode)(t.app.rootDir,...n);if(!o)throw new Error(`Can't resolve module ${n[0]}`);return o}return(0,vm.join)(e.rootPath,r)}Fe.getFilePath=NL;function Em(t,e,r){let n=[];t.xml[r]&&(n=n.concat(t.xml[r]));let o=Cm(t,e);return o?.[r]&&(n=n.concat(o[r])),n}Fe.getAllElements=Em});var Rx={};qr(Rx,{default:()=>LL});var LL,Bx=et(()=>{LL={}});var sl=x(Fn=>{"use strict";Object.defineProperty(Fn,"__esModule",{value:!0});Fn.isInstalled=Fn.getCommandOutput=Fn.runCommand=void 0;var _m=(Bx(),re(Rx));async function jx(t,e,r={}){let n=new _m.Subprocess(t,e,r);try{return await n.output()}catch(o){throw o instanceof _m.SubprocessError?o.output?o.output:o.cause?`${o.message} ${o.cause.toString()}`:o.code?o.code:"Unknown error":o}}Fn.runCommand=jx;async function UL(t,e,r={}){try{return(await jx(t,e,r)).trim()}catch{return null}}Fn.getCommandOutput=UL;async function ML(t){try{await(0,_m.which)(t)}catch{return!1}return!0}Fn.isInstalled=ML});var Nx={};qr(Nx,{Comparator:()=>m4,Range:()=>d4,SemVer:()=>h4,clean:()=>zL,coerce:()=>p4,compare:()=>JL,diff:()=>qL,eq:()=>e4,gt:()=>ZL,gte:()=>r4,gtr:()=>c4,inc:()=>GL,intersects:()=>f4,lt:()=>QL,lte:()=>n4,ltr:()=>l4,major:()=>WL,maxSatisfying:()=>i4,minSatisfying:()=>a4,minor:()=>KL,neq:()=>t4,outside:()=>u4,parse:()=>HL,patch:()=>YL,rcompare:()=>XL,satisfies:()=>o4,valid:()=>VL,validRange:()=>s4});var qL,HL,VL,zL,GL,WL,KL,YL,JL,XL,ZL,QL,e4,t4,r4,n4,o4,i4,a4,s4,u4,c4,l4,f4,p4,d4,h4,m4,Lx=et(()=>{qL=()=>null,HL=()=>null,VL=()=>null,zL=()=>null,GL=()=>null,WL=()=>null,KL=()=>null,YL=()=>null,JL=()=>0,XL=()=>0,ZL=()=>!1,QL=()=>!1,e4=()=>!1,t4=()=>!0,r4=()=>!1,n4=()=>!1,o4=()=>!1,i4=()=>null,a4=()=>null,s4=()=>null,u4=()=>!1,c4=()=>!1,l4=()=>!1,f4=()=>!1,p4=()=>null,d4=class{},h4=class{},m4=class{}});var Xx=x(Y=>{"use strict";Object.defineProperty(Y,"__esModule",{value:!0});Y.parseApkNameFromFlavor=Y.checkJDKMajorVersion=Y.resolvePlatform=Y.checkPlatformVersions=Y.getAddedPlatforms=Y.getPlatformTargetName=Y.promptForPlatformTarget=Y.promptForPlatform=Y.isValidEnterprisePlatform=Y.getKnownEnterprisePlatforms=Y.isValidCommunityPlatform=Y.getKnownCommunityPlatforms=Y.isValidPlatform=Y.getKnownPlatforms=Y.selectPlatforms=Y.getProjectPlatformDirectory=Y.getCLIVersion=Y.getCoreVersion=Y.getCapacitorPackageVersion=Y.requireCapacitorPackage=Y.getCapacitorPackage=Y.runTask=Y.runPlatformHook=Y.runHooks=Y.wait=Y.checkAppName=Y.checkAppId=Y.checkAppDir=Y.checkAppConfig=Y.checkCapacitorPlatform=Y.checkPackage=Y.checkWebDir=Y.check=void 0;var hs=(fe(),re(le)),Ux=hm(),An=Oi(),_o=require("path"),Ae=hs.__importDefault(ki()),Ni=rl(),qx=fs(),g4=Ix(),Mx=Js(),ds=al(),D4=sl();async function y4(t){let r=(await Promise.all(t.map(n=>n()))).filter(n=>n!=null);if(r.length>0)throw r.join(`
70
+ `)}Y.check=y4;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,An.pathExists)(t.app.webDirAbs)?await(0,An.pathExists)((0,_o.join)(t.app.webDirAbs,"index.html"))?null:`The web assets directory (${Ae.default.strong((0,Ux.prettyPath)(t.app.webDirAbs))}) must contain an ${Ae.default.strong("index.html")} file.
71
+ It will be the entry point for the web portion of the Capacitor app.`:`Could not find the web assets directory: ${Ae.default.strong((0,Ux.prettyPath)(t.app.webDirAbs))}.
72
+ Please create it and make sure it has an ${Ae.default.strong("index.html")} file. You can change the path of this directory in ${Ae.default.strong(t.app.extConfigName)} (${Ae.default.input("webDir")} option). You may need to compile the web assets for your app (typically ${Ae.default.input("npm run build")}). More info: ${Ae.default.strong("https://capacitorjs.com/docs/basics/workflow#sync-your-project")}`}Y.checkWebDir=b4;async function v4(){return await(0,An.pathExists)("package.json")||await(0,An.pathExists)("project.json")?null:`The Capacitor CLI needs to run at the root of an npm package or in a valid NX monorepo.
73
73
  Make sure you have a package.json or project.json file in the directory where you run the Capacitor CLI.
74
- More info: ${$e.default.strong("https://docs.npmjs.com/cli/init")}`}J.checkPackage=xq;async function Sq(t,e){return await Cg(t,e)?null:`Could not find the ${$e.default.input(e)} platform.
75
- You must install it in your project first, e.g. w/ ${$e.default.input(`npm install @capacitor/${e}`)}`}J.checkCapacitorPlatform=Sq;async function Aq(t){if(!t.app.appId)return`Missing ${$e.default.input("appId")} for new platform.
76
- 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.
77
- Please add it in ${t.app.extConfigName} or run ${$e.default.input("npx cap init")}.`;let e=await AA(t,t.app.appId);if(e)return e;let r=await FA(t,t.app.appName);return r||null}J.checkAppConfig=Aq;async function Fq(t,e){return/^\S*$/.test(e)?null:"Your app directory should not contain spaces"}J.checkAppDir=Fq;async function AA(t,e){return e?/^[a-zA-Z][\w]*(?:\.[a-zA-Z][\w]*)+$/.test(e.toLowerCase())?null:`
74
+ More info: ${Ae.default.strong("https://docs.npmjs.com/cli/init")}`}Y.checkPackage=v4;async function w4(t,e){return await Sm(t,e)?null:`Could not find the ${Ae.default.input(e)} platform.
75
+ You must install it in your project first, e.g. w/ ${Ae.default.input(`npm install @capacitor/${e}`)}`}Y.checkCapacitorPlatform=w4;async function C4(t){if(!t.app.appId)return`Missing ${Ae.default.input("appId")} for new platform.
76
+ Please add it in ${t.app.extConfigName} or run ${Ae.default.input("npx cap init")}.`;if(!t.app.appName)return`Missing ${Ae.default.input("appName")} for new platform.
77
+ Please add it in ${t.app.extConfigName} or run ${Ae.default.input("npx cap init")}.`;let e=await Hx(t,t.app.appId);if(e)return e;let r=await Vx(t,t.app.appName);return r||null}Y.checkAppConfig=C4;async function E4(t,e){return/^\S*$/.test(e)?null:"Your app directory should not contain spaces"}Y.checkAppDir=E4;async function Hx(t,e){return e?/^[a-zA-Z][\w]*(?:\.[a-zA-Z][\w]*)+$/.test(e.toLowerCase())?null:`
78
78
  Invalid App ID "${e}". Your App ID must meet the following requirements to be valid on both iOS and Android:
79
79
  - Must be in Java package form with no dashes (ex: com.example.app)
80
80
  - It must have at least two segments (one or more dots).
@@ -82,94 +82,94 @@ Please add it in ${t.app.extConfigName} or run ${$e.default.input("npx cap init"
82
82
  - All characters must be alphanumeric or an underscore [a-zA-Z][a-zA-Z0-9]+.
83
83
 
84
84
  If you would like to skip validation, run "cap init" with the "--skip-appid-validation" flag.
85
- `:"Invalid App ID. App ID is required and cannot be blank."}J.checkAppId=AA;async function FA(t,e){return e?.length?null:"Must provide an app name. For example: 'Spacebook'"}J.checkAppName=FA;async function Oq(t){return new Promise(e=>setTimeout(e,t))}J.wait=Oq;async function kq(t,e,r,n){await Eg(t,e,r,n);let o=await(0,vq.getPlugins)(t,e);for(let i of o)await Eg(t,e,i.rootPath,n)}J.runHooks=kq;async function Eg(t,e,r,n){var o;let{spawn:i}=await Promise.resolve().then(()=>Ra.__importStar(require("child_process"))),s;(0,xA.isNXMonorepo)(r)?s=await(0,jn.readJSON)((0,Bo.join)((0,xA.findNXMonorepoRoot)(r),"package.json")):s=await(0,jn.readJSON)((0,Bo.join)(r,"package.json"));let a=(o=s.scripts)===null||o===void 0?void 0:o[n];if(a)return new Promise((u,c)=>{let l=i(a,{stdio:"inherit",shell:!0,cwd:r,env:{INIT_CWD:r,CAPACITOR_ROOT_DIR:t.app.rootDir,CAPACITOR_WEB_DIR:t.app.webDirAbs,CAPACITOR_CONFIG:JSON.stringify(t.app.extConfig),CAPACITOR_PLATFORM_NAME:e,...process.env}});l.on("close",f=>{f===0?u():c(new Error(`${n} hook on ${e} failed with error code: ${f} while running command: ${a}`))}),l.on("error",f=>{c(f)})})}J.runPlatformHook=Eg;async function $q(t,e){let r=SA.output.createTaskChain();r.next(t);try{let n=await e();return r.end(),n}catch(n){throw r.fail(),n}}J.runTask=$q;async function Cg(t,e){let r=(0,Ta.resolveNode)(t.app.rootDir,`@capacitor/${e}`,"package.json");return r?(0,jn.readJSON)(r):null}J.getCapacitorPackage=Cg;async function OA(t,e){let r=await Cg(t,e);return r||(0,Ji.fatal)(`Unable to find node_modules/@capacitor/${e}.
86
- Are you sure ${$e.default.strong(`@capacitor/${e}`)} is installed?`),r}J.requireCapacitorPackage=OA;async function Ml(t,e){return(await OA(t,e)).version}J.getCapacitorPackageVersion=Ml;async function kA(t){return Ml(t,"core")}J.getCoreVersion=kA;async function Pq(t){return Ml(t,"cli")}J.getCLIVersion=Pq;function Tq(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 Ul(t,e){let r=Tq(t,e);return r&&await(0,jn.pathExists)(r)?r:null}J.getProjectPlatformDirectory=Ul;async function Rq(t,e){if(e){let r=e.toLowerCase().trim();return await xg(r)?await Ul(t,r)||(r==="web"&&(0,Ji.fatal)(`Could not find the web platform directory.
87
- Make sure ${$e.default.strong(t.app.webDir)} exists.`),(0,Ji.fatal)(`${$e.default.strong(r)} platform has not been added yet.
88
- See the docs for adding the ${$e.default.strong(r)} platform: ${$e.default.strong(`https://capacitorjs.com/docs/${r}#adding-the-${r}-platform`)}`)):(0,Ji.fatal)(`Invalid platform: ${$e.default.input(r)}`),[r]}return RA(t)}J.selectPlatforms=Rq;async function _g(){return["web","android","ios"]}J.getKnownPlatforms=_g;async function xg(t){return(await _g()).includes(t)}J.isValidPlatform=xg;async function $A(){return["electron"]}J.getKnownCommunityPlatforms=$A;async function Iq(t){return(await $A()).includes(t)}J.isValidCommunityPlatform=Iq;async function PA(){return["windows"]}J.getKnownEnterprisePlatforms=PA;async function Bq(t){return(await PA()).includes(t)}J.isValidEnterprisePlatform=Bq;async function Nq(t,e,r){let{prompt:n}=await Promise.resolve().then(()=>Ra.__importStar((xl(),oe(_l))));if(!r)return(await n([{type:"select",name:"mode",message:e,choices:t.map(s=>({title:s,value:s}))}],{onCancel:()=>process.exit(1)})).mode.toLowerCase().trim();let o=r.toLowerCase().trim();if(!await xg(o)){let i=await _g();(0,Ji.fatal)(`Invalid platform: ${$e.default.input(o)}.
89
- Valid platforms include: ${i.join(", ")}`)}return o}J.promptForPlatform=Nq;async function Lq(t,e){let{prompt:r}=await Promise.resolve().then(()=>Ra.__importStar((xl(),oe(_l)))),n=t.filter(s=>s.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(a=>({title:`${TA(a)} (${a.id})`,value:a}))}],{onCancel:()=>process.exit(1)})).target;let o=e.trim(),i=t.find(s=>s.id===o);return i||(0,Ji.fatal)(`Invalid target ID: ${$e.default.input(o)}.
90
- Valid targets are: ${t.map(s=>s.id).join(", ")}`),i}J.promptForPlatformTarget=Lq;function TA(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=TA;async function RA(t){let e=[];return await Ul(t,t.android.name)&&e.push(t.android.name),await Ul(t,t.ios.name)&&e.push(t.ios.name),e.push(t.web.name),e}J.getAddedPlatforms=RA;async function jq(t,e){let r=await Promise.resolve().then(()=>Ra.__importStar(CA())),n=await kA(t),o=await Ml(t,e);(r.diff(n,o)==="minor"||r.diff(n,o)==="major")&&SA.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.
91
- Consider updating to a matching version, e.g. w/ ${$e.default.input(`npm install @capacitor/core@${o}`)}`)}J.checkPlatformVersions=jq;function Uq(t,e){if(e[0]!=="@"){let n=(0,Ta.resolveNode)(t.app.rootDir,`@capacitor/${e}`,"package.json");if(n)return(0,Bo.dirname)(n);let o=(0,Ta.resolveNode)(t.app.rootDir,`@capacitor-community/${e}`,"package.json");if(o)return(0,Bo.dirname)(o);let i=(0,Ta.resolveNode)(t.app.rootDir,`@ionic-enterprise/capacitor-${e}`,"package.json");if(i)return(0,Bo.dirname)(i)}let r=(0,Ta.resolveNode)(t.app.rootDir,e,"package.json");return r?(0,Bo.dirname)(r):null}J.resolvePlatform=Uq;async function Mq(){try{let t=await(0,Eq.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=Mq;function qq(t){let e=t.replace(/([A-Z])/g,"$1").toLowerCase();return`app-${e?`${e}-`:""}debug.apk`}J.parseApkNameFromFlavor=qq});var BA=C(ql=>{"use strict";Object.defineProperty(ql,"__esModule",{value:!0});ql.tryFn=void 0;var Hq=async(t,...e)=>{try{return await t(...e)}catch{}return null};ql.tryFn=Hq});var NA=C(Hl=>{"use strict";Object.defineProperty(Hl,"__esModule",{value:!0});Hl.formatJSObject=void 0;var Vq=(he(),oe(de)),zq=Vq.__importDefault(require("util"));function Gq(t){try{t=JSON.parse(JSON.stringify(t))}catch(e){throw new Error(`Cannot parse object as JSON: ${e.stack?e.stack:e}`)}return zq.default.inspect(t,{compact:!1,breakLength:1/0,depth:1/0,maxArrayLength:1/0,maxStringLength:1/0})}Hl.formatJSObject=Gq});var LA=C(Un=>{"use strict";Object.defineProperty(Un,"__esModule",{value:!0});Un.lazy=Un.LazyPromise=Un.allSerial=void 0;function Wq(t){return t.reduce((e,r)=>e.then(n=>r().then(o=>n.concat(o))),Promise.resolve([]))}Un.allSerial=Wq;var Vl=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=Vl;function Kq(t){return new Vl(async(e,r)=>{try{e(await t())}catch(n){r(n)}})}Un.lazy=Kq});var qA=C(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 Ag=(he(),oe(de)),Xq=Ag.__importDefault(Em()),Yt=Mi(),ue=require("path"),No=Ag.__importDefault(qi()),Yq=IA(),zl=El(),Jq=_a(),Sg=BA(),Zq=NA(),jA=gu(),UA=Sl(),Zi=LA(),Qq=Al(),MA=(0,Xq.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 e7(){var t,e,r,n;let o=process.cwd(),i=(0,ue.dirname)(__dirname),s=await o7(o),a=await(async()=>{var d,m;if((0,jA.isNXMonorepo)(o)){let b=(0,jA.findNXMonorepoRoot)(o),D=await(0,Sg.tryFn)(Yt.readJSON,(0,ue.resolve)(b,"package.json")),E=(d=D?.devDependencies)!==null&&d!==void 0?d:{},_=(m=D?.dependencies)!==null&&m!==void 0?m:{};return{devDependencies:E,dependencies:_}}return{}})(),u=(t=s.extConfig.appId)!==null&&t!==void 0?t:"",c=(e=s.extConfig.appName)!==null&&e!==void 0?e:"",l=(r=s.extConfig.webDir)!==null&&r!==void 0?r:"www",f=await i7(i),h={android:await s7(o,s.extConfig,f),ios:await a7(o,s.extConfig),web:await u7(o,l),cli:f,app:{rootDir:o,appId:u,appName:c,webDir:l,webDirAbs:(0,ue.resolve)(o,l),package:(n=await(0,Sg.tryFn)(Yt.readJSON,(0,ue.resolve)(o,"package.json")))!==null&&n!==void 0?n:{name:c,version:"1.0.0",...a},...s}};return MA("config: %O",h),h}pt.loadConfig=e7;async function t7(t,e){switch((0,ue.extname)(e)){case".json":{await(0,Yt.writeJSON)(e,t,{spaces:2});break}case".ts":{await(0,Yt.writeFile)(e,h7(t));break}}}pt.writeConfig=t7;async function r7(t,e,r){var n;try{let o=(0,UA.resolveNode)(t,"typescript");o||(0,zl.fatal)(`Could not find installation of TypeScript.
92
- To use ${No.default.strong(e)} files, you must install TypeScript in your project, e.g. w/ ${No.default.input("npm install -D typescript")}`);let i=require(o),s=(0,UA.requireTS)(i,r),a=s.default?await s.default:s;return{extConfigType:"ts",extConfigName:e,extConfigFilePath:r,extConfig:a}}catch(o){throw(0,zl.isFatal)(o)||(0,zl.fatal)(`Parsing ${No.default.strong(e)} failed.
85
+ `:"Invalid App ID. App ID is required and cannot be blank."}Y.checkAppId=Hx;async function Vx(t,e){return e?.length?null:"Must provide an app name. For example: 'Spacebook'"}Y.checkAppName=Vx;async function _4(t){return new Promise(e=>setTimeout(e,t))}Y.wait=_4;async function x4(t,e,r,n){await xm(t,e,r,n);let o=await(0,g4.getPlugins)(t,e);for(let i of o)await xm(t,e,i.rootPath,n)}Y.runHooks=x4;async function xm(t,e,r,n){var o;let{spawn:i}=await Promise.resolve().then(()=>hs.__importStar(require("child_process"))),a;(0,Mx.isNXMonorepo)(r)?a=await(0,An.readJSON)((0,_o.join)((0,Mx.findNXMonorepoRoot)(r),"package.json")):a=await(0,An.readJSON)((0,_o.join)(r,"package.json"));let s=(o=a.scripts)===null||o===void 0?void 0:o[n];if(s)return new Promise((u,c)=>{let l=i(s,{stdio:"inherit",shell:!0,cwd:r,env:{INIT_CWD:r,CAPACITOR_ROOT_DIR:t.app.rootDir,CAPACITOR_WEB_DIR:t.app.webDirAbs,CAPACITOR_CONFIG:JSON.stringify(t.app.extConfig),CAPACITOR_PLATFORM_NAME:e,...process.env}});l.on("close",f=>{f===0?u():c(new Error(`${n} hook on ${e} failed with error code: ${f} while running command: ${s}`))}),l.on("error",f=>{c(f)})})}Y.runPlatformHook=xm;async function S4(t,e){let r=qx.output.createTaskChain();r.next(t);try{let n=await e();return r.end(),n}catch(n){throw r.fail(),n}}Y.runTask=S4;async function Sm(t,e){let r=(0,ds.resolveNode)(t.app.rootDir,`@capacitor/${e}`,"package.json");return r?(0,An.readJSON)(r):null}Y.getCapacitorPackage=Sm;async function zx(t,e){let r=await Sm(t,e);return r||(0,Ni.fatal)(`Unable to find node_modules/@capacitor/${e}.
86
+ Are you sure ${Ae.default.strong(`@capacitor/${e}`)} is installed?`),r}Y.requireCapacitorPackage=zx;async function cl(t,e){return(await zx(t,e)).version}Y.getCapacitorPackageVersion=cl;async function Gx(t){return cl(t,"core")}Y.getCoreVersion=Gx;async function F4(t){return cl(t,"cli")}Y.getCLIVersion=F4;function A4(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 ul(t,e){let r=A4(t,e);return r&&await(0,An.pathExists)(r)?r:null}Y.getProjectPlatformDirectory=ul;async function O4(t,e){if(e){let r=e.toLowerCase().trim();return await Am(r)?await ul(t,r)||(r==="web"&&(0,Ni.fatal)(`Could not find the web platform directory.
87
+ Make sure ${Ae.default.strong(t.app.webDir)} exists.`),(0,Ni.fatal)(`${Ae.default.strong(r)} platform has not been added yet.
88
+ See the docs for adding the ${Ae.default.strong(r)} platform: ${Ae.default.strong(`https://capacitorjs.com/docs/${r}#adding-the-${r}-platform`)}`)):(0,Ni.fatal)(`Invalid platform: ${Ae.default.input(r)}`),[r]}return Jx(t)}Y.selectPlatforms=O4;async function Fm(){return["web","android","ios"]}Y.getKnownPlatforms=Fm;async function Am(t){return(await Fm()).includes(t)}Y.isValidPlatform=Am;async function Wx(){return["electron"]}Y.getKnownCommunityPlatforms=Wx;async function k4(t){return(await Wx()).includes(t)}Y.isValidCommunityPlatform=k4;async function Kx(){return["windows"]}Y.getKnownEnterprisePlatforms=Kx;async function $4(t){return(await Kx()).includes(t)}Y.isValidEnterprisePlatform=$4;async function P4(t,e,r){let{prompt:n}=await Promise.resolve().then(()=>hs.__importStar((il(),re(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 Am(o)){let i=await Fm();(0,Ni.fatal)(`Invalid platform: ${Ae.default.input(o)}.
89
+ Valid platforms include: ${i.join(", ")}`)}return o}Y.promptForPlatform=P4;async function T4(t,e){let{prompt:r}=await Promise.resolve().then(()=>hs.__importStar((il(),re(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:`${Yx(s)} (${s.id})`,value:s}))}],{onCancel:()=>process.exit(1)})).target;let o=e.trim(),i=t.find(a=>a.id===o);return i||(0,Ni.fatal)(`Invalid target ID: ${Ae.default.input(o)}.
90
+ Valid targets are: ${t.map(a=>a.id).join(", ")}`),i}Y.promptForPlatformTarget=T4;function Yx(t){var e,r,n;return`${(n=(r=(e=t.name)!==null&&e!==void 0?e:t.model)!==null&&r!==void 0?r:t.id)!==null&&n!==void 0?n:"?"}${t.virtual?` (${t.platform==="ios"?"simulator":"emulator"})`:""}`}Y.getPlatformTargetName=Yx;async function Jx(t){let e=[];return await ul(t,t.android.name)&&e.push(t.android.name),await ul(t,t.ios.name)&&e.push(t.ios.name),e.push(t.web.name),e}Y.getAddedPlatforms=Jx;async function I4(t,e){let r=await Promise.resolve().then(()=>hs.__importStar((Lx(),re(Nx)))),n=await Gx(t),o=await cl(t,e);(r.diff(n,o)==="minor"||r.diff(n,o)==="major")&&qx.logger.warn(`${Ae.default.strong("@capacitor/core")}${Ae.default.weak(`@${n}`)} version doesn't match ${Ae.default.strong(`@capacitor/${e}`)}${Ae.default.weak(`@${o}`)} version.
91
+ Consider updating to a matching version, e.g. w/ ${Ae.default.input(`npm install @capacitor/core@${o}`)}`)}Y.checkPlatformVersions=I4;function R4(t,e){if(e[0]!=="@"){let n=(0,ds.resolveNode)(t.app.rootDir,`@capacitor/${e}`,"package.json");if(n)return(0,_o.dirname)(n);let o=(0,ds.resolveNode)(t.app.rootDir,`@capacitor-community/${e}`,"package.json");if(o)return(0,_o.dirname)(o);let i=(0,ds.resolveNode)(t.app.rootDir,`@ionic-enterprise/capacitor-${e}`,"package.json");if(i)return(0,_o.dirname)(i)}let r=(0,ds.resolveNode)(t.app.rootDir,e,"package.json");return r?(0,_o.dirname)(r):null}Y.resolvePlatform=R4;async function B4(){try{let t=await(0,D4.runCommand)("java",["--version"]),r=RegExp(/([0-9]+)\.?([0-9]*)\.?([0-9]*)/).exec(t);if(r===null)return-1;let n=parseInt(r[1]),o=parseInt(r[2]);return typeof n=="number"&&n!=1?n:typeof o=="number"&&n==1&&o<9?o:-1}catch{return-1}}Y.checkJDKMajorVersion=B4;function j4(t){let e=t.replace(/([A-Z])/g,"$1").toLowerCase();return`app-${e?`${e}-`:""}debug.apk`}Y.parseApkNameFromFlavor=j4});var Zx=x(ll=>{"use strict";Object.defineProperty(ll,"__esModule",{value:!0});ll.tryFn=void 0;var N4=async(t,...e)=>{try{return await t(...e)}catch{}return null};ll.tryFn=N4});var Qx=x(fl=>{"use strict";Object.defineProperty(fl,"__esModule",{value:!0});fl.formatJSObject=void 0;var L4=(fe(),re(le)),U4=L4.__importDefault(require("util"));function M4(t){try{t=JSON.parse(JSON.stringify(t))}catch(e){throw new Error(`Cannot parse object as JSON: ${e.stack?e.stack:e}`)}return U4.default.inspect(t,{compact:!1,breakLength:1/0,depth:1/0,maxArrayLength:1/0,maxStringLength:1/0})}fl.formatJSObject=M4});var e1=x(On=>{"use strict";Object.defineProperty(On,"__esModule",{value:!0});On.lazy=On.LazyPromise=On.allSerial=void 0;function q4(t){return t.reduce((e,r)=>e.then(n=>r().then(o=>n.concat(o))),Promise.resolve([]))}On.allSerial=q4;var pl=class extends Promise{constructor(e){super(()=>{}),this._executor=e}then(e,r){return this._promise=this._promise||new Promise(this._executor),this._promise.then(e,r)}catch(e){return this._promise=this._promise||new Promise(this._executor),this._promise.catch(e)}};On.LazyPromise=pl;function H4(t){return new pl(async(e,r)=>{try{e(await t())}catch(n){r(n)}})}On.lazy=H4});var o1=x(ut=>{"use strict";Object.defineProperty(ut,"__esModule",{value:!0});ut.writeConfig=ut.loadConfig=ut.CONFIG_FILE_NAME_JSON=ut.CONFIG_FILE_NAME_JS=ut.CONFIG_FILE_NAME_TS=void 0;var km=(fe(),re(le)),V4=km.__importDefault(Vh()),qt=Oi(),ie=require("path"),xo=km.__importDefault(ki()),z4=Xx(),dl=rl(),G4=fs(),Om=Zx(),W4=Qx(),t1=Js(),r1=al(),Li=e1(),K4=sl(),n1=(0,V4.default)("capacitor:config");ut.CONFIG_FILE_NAME_TS="capacitor.config.ts";ut.CONFIG_FILE_NAME_JS="capacitor.config.js";ut.CONFIG_FILE_NAME_JSON="capacitor.config.json";async function Y4(){var t,e,r,n;let o=process.cwd(),i=(0,ie.dirname)(__dirname),a=await Q4(o),s=await(async()=>{var h,m;if((0,t1.isNXMonorepo)(o)){let b=(0,t1.findNXMonorepoRoot)(o),D=await(0,Om.tryFn)(qt.readJSON,(0,ie.resolve)(b,"package.json")),C=(h=D?.devDependencies)!==null&&h!==void 0?h:{},E=(m=D?.dependencies)!==null&&m!==void 0?m:{};return{devDependencies:C,dependencies:E}}return{}})(),u=(t=a.extConfig.appId)!==null&&t!==void 0?t:"",c=(e=a.extConfig.appName)!==null&&e!==void 0?e:"",l=(r=a.extConfig.webDir)!==null&&r!==void 0?r:"www",f=await e5(i),d={android:await t5(o,a.extConfig,f),ios:await r5(o,a.extConfig),web:await n5(o,l),cli:f,app:{rootDir:o,appId:u,appName:c,webDir:l,webDirAbs:(0,ie.resolve)(o,l),package:(n=await(0,Om.tryFn)(qt.readJSON,(0,ie.resolve)(o,"package.json")))!==null&&n!==void 0?n:{name:c,version:"1.0.0",...s},...a}};return n1("config: %O",d),d}ut.loadConfig=Y4;async function J4(t,e){switch((0,ie.extname)(e)){case".json":{await(0,qt.writeJSON)(e,t,{spaces:2});break}case".ts":{await(0,qt.writeFile)(e,c5(t));break}}}ut.writeConfig=J4;async function X4(t,e,r){var n;try{let o=(0,r1.resolveNode)(t,"typescript");o||(0,dl.fatal)(`Could not find installation of TypeScript.
92
+ To use ${xo.default.strong(e)} files, you must install TypeScript in your project, e.g. w/ ${xo.default.input("npm install -D typescript")}`);let i=require(o),a=(0,r1.requireTS)(i,r),s=a.default?await a.default:a;return{extConfigType:"ts",extConfigName:e,extConfigFilePath:r,extConfig:s}}catch(o){throw(0,dl.isFatal)(o)||(0,dl.fatal)(`Parsing ${xo.default.strong(e)} failed.
93
93
 
94
- ${(n=o.stack)!==null&&n!==void 0?n:o}`),o}}async function n7(t,e,r){var n;try{return{extConfigType:"js",extConfigName:e,extConfigFilePath:r,extConfig:await require(r)}}catch(o){(0,zl.fatal)(`Parsing ${No.default.strong(e)} failed.
94
+ ${(n=o.stack)!==null&&n!==void 0?n:o}`),o}}async function Z4(t,e,r){var n;try{return{extConfigType:"js",extConfigName:e,extConfigFilePath:r,extConfig:await require(r)}}catch(o){(0,dl.fatal)(`Parsing ${xo.default.strong(e)} failed.
95
95
 
96
- ${(n=o.stack)!==null&&n!==void 0?n:o}`)}}async function o7(t){var e;let r=(0,ue.resolve)(t,pt.CONFIG_FILE_NAME_TS);if(await(0,Yt.pathExists)(r))return r7(t,pt.CONFIG_FILE_NAME_TS,r);let n=(0,ue.resolve)(t,pt.CONFIG_FILE_NAME_JS);if(await(0,Yt.pathExists)(n))return n7(t,pt.CONFIG_FILE_NAME_JS,n);let o=(0,ue.resolve)(t,pt.CONFIG_FILE_NAME_JSON);return{extConfigType:"json",extConfigName:pt.CONFIG_FILE_NAME_JSON,extConfigFilePath:o,extConfig:(e=await(0,Sg.tryFn)(Yt.readJSON,o))!==null&&e!==void 0?e:{}}}async function i7(t){let e="assets",r=(0,ue.join)(t,e),n="ios-pods-template.tar.gz",o="capacitor-cordova-ios-plugins.tar.gz",i="android-template.tar.gz",s="capacitor-cordova-android-plugins.tar.gz";return{rootDir:t,assetsDir:e,assetsDirAbs:r,assets:{ios:{platformTemplateArchive:n,platformTemplateArchiveAbs:(0,ue.resolve)(r,n),cordovaPluginsTemplateArchive:o,cordovaPluginsTemplateArchiveAbs:(0,ue.resolve)(r,o)},android:{platformTemplateArchive:i,platformTemplateArchiveAbs:(0,ue.resolve)(r,i),cordovaPluginsTemplateArchive:s,cordovaPluginsTemplateArchiveAbs:(0,ue.resolve)(r,s)}},package:await(0,Yt.readJSON)((0,ue.resolve)(t,"package.json")),os:c7(process.platform)}}async function s7(t,e,r){var n,o,i,s,a,u,c,l,f,h,d,m,b,D,E,_,g;let x="android",S=(o=(n=e.android)===null||n===void 0?void 0:n.path)!==null&&o!==void 0?o:"android",T=(0,ue.resolve)(t,S),O="app",B=`${O}/src`,I=`${B}/main`,L=`${I}/assets`,F=`${L}/public`,U=`${I}/res`,M=`${O}/build/outputs/apk/`,te=((i=e.android)===null||i===void 0?void 0:i.flavor)||"";!((s=e.android)===null||s===void 0)&&s.flavor&&(M=`${M}/${(a=e.android)===null||a===void 0?void 0:a.flavor}`);let $=(0,Yq.parseApkNameFromFlavor)(te),y=`${M}/debug`,w="capacitor-cordova-android-plugins",v=(0,Zi.lazy)(()=>p7(r.os)),A={keystorePath:(c=(u=e.android)===null||u===void 0?void 0:u.buildOptions)===null||c===void 0?void 0:c.keystorePath,keystorePassword:(f=(l=e.android)===null||l===void 0?void 0:l.buildOptions)===null||f===void 0?void 0:f.keystorePassword,keystoreAlias:(d=(h=e.android)===null||h===void 0?void 0:h.buildOptions)===null||d===void 0?void 0:d.keystoreAlias,keystoreAliasPassword:(b=(m=e.android)===null||m===void 0?void 0:m.buildOptions)===null||b===void 0?void 0:b.keystoreAliasPassword,signingType:(E=(D=e.android)===null||D===void 0?void 0:D.buildOptions)===null||E===void 0?void 0:E.signingType,releaseType:(g=(_=e.android)===null||_===void 0?void 0:_.buildOptions)===null||g===void 0?void 0:g.releaseType};return{name:x,minVersion:"23",studioPath:v,platformDir:S,platformDirAbs:T,cordovaPluginsDir:w,cordovaPluginsDirAbs:(0,ue.resolve)(T,w),appDir:O,appDirAbs:(0,ue.resolve)(T,O),srcDir:B,srcDirAbs:(0,ue.resolve)(T,B),srcMainDir:I,srcMainDirAbs:(0,ue.resolve)(T,I),assetsDir:L,assetsDirAbs:(0,ue.resolve)(T,L),webDir:F,webDirAbs:(0,ue.resolve)(T,F),resDir:U,resDirAbs:(0,ue.resolve)(T,U),apkName:$,buildOutputDir:y,buildOutputDirAbs:(0,ue.resolve)(T,y),flavor:te,buildOptions:A}}async function a7(t,e){var r,n,o,i,s,a,u,c,l,f,h,d;let b=(n=(r=e.ios)===null||r===void 0?void 0:r.path)!==null&&n!==void 0?n:"ios",D=(0,ue.resolve)(t,b),E=(i=(o=e.ios)===null||o===void 0?void 0:o.scheme)!==null&&i!==void 0?i:"App",_="App",g=(0,ue.resolve)(D,_),x=`${_}/App`,S=(0,ue.resolve)(D,x),T=`${_}/App.xcodeproj`,O=(0,ue.resolve)(D,T),B=(0,Zi.lazy)(()=>l7(g)),I=(0,Zi.lazy)(()=>d7(t,D,g)),L=(0,Zi.lazy)(()=>f7(g,S,O)),F="capacitor-cordova-ios-plugins",U={exportMethod:(a=(s=e.ios)===null||s===void 0?void 0:s.buildOptions)===null||a===void 0?void 0:a.exportMethod,xcodeSigningStyle:(c=(u=e.ios)===null||u===void 0?void 0:u.buildOptions)===null||c===void 0?void 0:c.signingStyle,signingCertificate:(f=(l=e.ios)===null||l===void 0?void 0:l.buildOptions)===null||f===void 0?void 0:f.signingCertificate,provisioningProfile:(d=(h=e.ios)===null||h===void 0?void 0:h.buildOptions)===null||d===void 0?void 0:d.provisioningProfile};return{name:"ios",minVersion:"14.0",platformDir:b,platformDirAbs:D,scheme:E,cordovaPluginsDir:F,cordovaPluginsDirAbs:(0,ue.resolve)(D,F),nativeProjectDir:_,nativeProjectDirAbs:g,nativeTargetDir:x,nativeTargetDirAbs:S,nativeXcodeProjDir:T,nativeXcodeProjDirAbs:O,nativeXcodeWorkspaceDir:(0,Zi.lazy)(async()=>(0,ue.relative)(D,await B)),nativeXcodeWorkspaceDirAbs:B,webDir:(0,Zi.lazy)(async()=>(0,ue.relative)(D,await L)),webDirAbs:L,podPath:I,buildOptions:U}}async function u7(t,e){let r=e,n=(0,ue.resolve)(t,r);return{name:"web",platformDir:r,platformDirAbs:n}}function c7(t){switch(t){case"darwin":return"mac";case"win32":return"windows";case"linux":return"linux"}return"unknown"}async function l7(t){return(0,ue.resolve)(t,"App.xcworkspace")}async function f7(t,e,r){let n=/path\s=\spublic[\s\S]+?sourceTree\s=\s([^;]+)/,o=(0,ue.resolve)(r,"project.pbxproj");try{let s=(await(0,Yt.readFile)(o,{encoding:"utf8"})).match(n);if(s&&s[1]==="SOURCE_ROOT")return Jq.logger.warn(`Using the iOS project root for the ${No.default.strong("public")} directory is deprecated.
97
- Please follow the Upgrade Guide to move ${No.default.strong("public")} inside the iOS target directory: ${No.default.strong("https://capacitorjs.com/docs/updating/3-0#move-public-into-the-ios-target-directory")}`),(0,ue.resolve)(t,"public")}catch{}return(0,ue.resolve)(e,"public")}async function p7(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(()=>Ag.__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){MA("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 d7(t,e,r){if(process.env.CAPACITOR_COCOAPODS_PATH)return process.env.CAPACITOR_COCOAPODS_PATH;let n="";if(await(0,Yt.pathExists)((0,ue.resolve)(t,"Gemfile"))?n=(0,ue.resolve)(t,"Gemfile"):await(0,Yt.pathExists)((0,ue.resolve)(e,"Gemfile"))?n=(0,ue.resolve)(e,"Gemfile"):await(0,Yt.pathExists)((0,ue.resolve)(r,"Gemfile"))&&(n=(0,ue.resolve)(r,"Gemfile")),!(n!=""))try{let i=await(0,Qq.getCommandOutput)("git",["rev-parse","--show-toplevel"],{cwd:t});i!=null&&(n=(0,ue.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 h7(t){return`import type { CapacitorConfig } from '@capacitor/cli';
96
+ ${(n=o.stack)!==null&&n!==void 0?n:o}`)}}async function Q4(t){var e;let r=(0,ie.resolve)(t,ut.CONFIG_FILE_NAME_TS);if(await(0,qt.pathExists)(r))return X4(t,ut.CONFIG_FILE_NAME_TS,r);let n=(0,ie.resolve)(t,ut.CONFIG_FILE_NAME_JS);if(await(0,qt.pathExists)(n))return Z4(t,ut.CONFIG_FILE_NAME_JS,n);let o=(0,ie.resolve)(t,ut.CONFIG_FILE_NAME_JSON);return{extConfigType:"json",extConfigName:ut.CONFIG_FILE_NAME_JSON,extConfigFilePath:o,extConfig:(e=await(0,Om.tryFn)(qt.readJSON,o))!==null&&e!==void 0?e:{}}}async function e5(t){let e="assets",r=(0,ie.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,ie.resolve)(r,n),cordovaPluginsTemplateArchive:o,cordovaPluginsTemplateArchiveAbs:(0,ie.resolve)(r,o)},android:{platformTemplateArchive:i,platformTemplateArchiveAbs:(0,ie.resolve)(r,i),cordovaPluginsTemplateArchive:a,cordovaPluginsTemplateArchiveAbs:(0,ie.resolve)(r,a)}},package:await(0,qt.readJSON)((0,ie.resolve)(t,"package.json")),os:o5(process.platform)}}async function t5(t,e,r){var n,o,i,a,s,u,c,l,f,d,h,m,b,D,C,E,g;let _="android",S=(o=(n=e.android)===null||n===void 0?void 0:n.path)!==null&&o!==void 0?o:"android",T=(0,ie.resolve)(t,S),O="app",B=`${O}/src`,R=`${B}/main`,N=`${R}/assets`,A=`${N}/public`,U=`${R}/res`,M=`${O}/build/outputs/apk/`,Q=((i=e.android)===null||i===void 0?void 0:i.flavor)||"";!((a=e.android)===null||a===void 0)&&a.flavor&&(M=`${M}/${(s=e.android)===null||s===void 0?void 0:s.flavor}`);let $=(0,z4.parseApkNameFromFlavor)(Q),y=`${M}/debug`,v="capacitor-cordova-android-plugins",w=(0,Li.lazy)(()=>s5(r.os)),F={keystorePath:(c=(u=e.android)===null||u===void 0?void 0:u.buildOptions)===null||c===void 0?void 0:c.keystorePath,keystorePassword:(f=(l=e.android)===null||l===void 0?void 0:l.buildOptions)===null||f===void 0?void 0:f.keystorePassword,keystoreAlias:(h=(d=e.android)===null||d===void 0?void 0:d.buildOptions)===null||h===void 0?void 0:h.keystoreAlias,keystoreAliasPassword:(b=(m=e.android)===null||m===void 0?void 0:m.buildOptions)===null||b===void 0?void 0:b.keystoreAliasPassword,signingType:(C=(D=e.android)===null||D===void 0?void 0:D.buildOptions)===null||C===void 0?void 0:C.signingType,releaseType:(g=(E=e.android)===null||E===void 0?void 0:E.buildOptions)===null||g===void 0?void 0:g.releaseType};return{name:_,minVersion:"23",studioPath:w,platformDir:S,platformDirAbs:T,cordovaPluginsDir:v,cordovaPluginsDirAbs:(0,ie.resolve)(T,v),appDir:O,appDirAbs:(0,ie.resolve)(T,O),srcDir:B,srcDirAbs:(0,ie.resolve)(T,B),srcMainDir:R,srcMainDirAbs:(0,ie.resolve)(T,R),assetsDir:N,assetsDirAbs:(0,ie.resolve)(T,N),webDir:A,webDirAbs:(0,ie.resolve)(T,A),resDir:U,resDirAbs:(0,ie.resolve)(T,U),apkName:$,buildOutputDir:y,buildOutputDirAbs:(0,ie.resolve)(T,y),flavor:Q,buildOptions:F}}async function r5(t,e){var r,n,o,i,a,s,u,c,l,f,d,h;let b=(n=(r=e.ios)===null||r===void 0?void 0:r.path)!==null&&n!==void 0?n:"ios",D=(0,ie.resolve)(t,b),C=(i=(o=e.ios)===null||o===void 0?void 0:o.scheme)!==null&&i!==void 0?i:"App",E="App",g=(0,ie.resolve)(D,E),_=`${E}/App`,S=(0,ie.resolve)(D,_),T=`${E}/App.xcodeproj`,O=(0,ie.resolve)(D,T),B=(0,Li.lazy)(()=>i5(g)),R=(0,Li.lazy)(()=>u5(t,D,g)),N=(0,Li.lazy)(()=>a5(g,S,O)),A="capacitor-cordova-ios-plugins",U={exportMethod:(s=(a=e.ios)===null||a===void 0?void 0:a.buildOptions)===null||s===void 0?void 0:s.exportMethod,xcodeSigningStyle:(c=(u=e.ios)===null||u===void 0?void 0:u.buildOptions)===null||c===void 0?void 0:c.signingStyle,signingCertificate:(f=(l=e.ios)===null||l===void 0?void 0:l.buildOptions)===null||f===void 0?void 0:f.signingCertificate,provisioningProfile:(h=(d=e.ios)===null||d===void 0?void 0:d.buildOptions)===null||h===void 0?void 0:h.provisioningProfile};return{name:"ios",minVersion:"14.0",platformDir:b,platformDirAbs:D,scheme:C,cordovaPluginsDir:A,cordovaPluginsDirAbs:(0,ie.resolve)(D,A),nativeProjectDir:E,nativeProjectDirAbs:g,nativeTargetDir:_,nativeTargetDirAbs:S,nativeXcodeProjDir:T,nativeXcodeProjDirAbs:O,nativeXcodeWorkspaceDir:(0,Li.lazy)(async()=>(0,ie.relative)(D,await B)),nativeXcodeWorkspaceDirAbs:B,webDir:(0,Li.lazy)(async()=>(0,ie.relative)(D,await N)),webDirAbs:N,podPath:R,buildOptions:U}}async function n5(t,e){let r=e,n=(0,ie.resolve)(t,r);return{name:"web",platformDir:r,platformDirAbs:n}}function o5(t){switch(t){case"darwin":return"mac";case"win32":return"windows";case"linux":return"linux"}return"unknown"}async function i5(t){return(0,ie.resolve)(t,"App.xcworkspace")}async function a5(t,e,r){let n=/path\s=\spublic[\s\S]+?sourceTree\s=\s([^;]+)/,o=(0,ie.resolve)(r,"project.pbxproj");try{let a=(await(0,qt.readFile)(o,{encoding:"utf8"})).match(n);if(a&&a[1]==="SOURCE_ROOT")return G4.logger.warn(`Using the iOS project root for the ${xo.default.strong("public")} directory is deprecated.
97
+ Please follow the Upgrade Guide to move ${xo.default.strong("public")} inside the iOS target directory: ${xo.default.strong("https://capacitorjs.com/docs/updating/3-0#move-public-into-the-ios-target-directory")}`),(0,ie.resolve)(t,"public")}catch{}return(0,ie.resolve)(e,"public")}async function s5(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(()=>km.__importStar(sl())),r="C:\\Program Files\\Android\\Android Studio\\bin\\studio64.exe";try{if(!await(0,qt.pathExists)(r)){let n=await e("REG",["QUERY","HKEY_LOCAL_MACHINE\\SOFTWARE\\Android Studio","/v","Path"]);n=n.replace(/(\r\n|\n|\r)/gm,"");let o=n.indexOf("REG_SZ");o>0&&(r=n.substring(o+6).trim()+"\\bin\\studio64.exe")}}catch(n){n1("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 u5(t,e,r){if(process.env.CAPACITOR_COCOAPODS_PATH)return process.env.CAPACITOR_COCOAPODS_PATH;let n="";if(await(0,qt.pathExists)((0,ie.resolve)(t,"Gemfile"))?n=(0,ie.resolve)(t,"Gemfile"):await(0,qt.pathExists)((0,ie.resolve)(e,"Gemfile"))?n=(0,ie.resolve)(e,"Gemfile"):await(0,qt.pathExists)((0,ie.resolve)(r,"Gemfile"))&&(n=(0,ie.resolve)(r,"Gemfile")),!(n!=""))try{let i=await(0,K4.getCommandOutput)("git",["rev-parse","--show-toplevel"],{cwd:t});i!=null&&(n=(0,ie.resolve)(i,"Gemfile"))}catch{}try{let i=(await(0,qt.readFile)(n)).toString();return i&&new RegExp(/gem\s+['"]cocoapods/).test(i)?"bundle exec pod":"pod"}catch{return"pod"}}function c5(t){return`import type { CapacitorConfig } from '@capacitor/cli';
98
98
 
99
- const config: CapacitorConfig = ${(0,Zq.formatJSObject)(t)};
99
+ const config: CapacitorConfig = ${(0,W4.formatJSObject)(t)};
100
100
 
101
101
  export default config;
102
- `}});function m7(){try{return kg.default.statSync("/.dockerenv"),!0}catch{return!1}}function g7(){try{return kg.default.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function $g(){return Og===void 0&&(Og=m7()||g7()),Og}var kg,Og,VA=it(()=>{kg=be(require("node:fs"),1)});function es(){return Pg===void 0&&(Pg=D7()||$g()),Pg}var zA,Pg,D7,Tg=it(()=>{zA=be(require("node:fs"),1);VA();D7=()=>{try{return zA.default.statSync("/run/.containerenv"),!0}catch{return!1}}});var Rg,WA,KA,GA,Mn,Ig=it(()=>{Rg=be(require("node:process"),1),WA=be(require("node:os"),1),KA=be(require("node:fs"),1);Tg();GA=()=>{if(Rg.default.platform!=="linux")return!1;if(WA.default.release().toLowerCase().includes("microsoft"))return!es();try{return KA.default.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!es():!1}catch{return!1}},Mn=Rg.default.env.__IS_WSL_TEST__?GA:GA()});var Bg,Ba,y7,b7,Ng,XA=it(()=>{Bg=be(require("node:process"),1),Ba=be(require("node:fs/promises"),1);Ig();Ig();y7=(()=>{let t="/mnt/",e;return async function(){if(e)return e;let r="/etc/wsl.conf",n=!1;try{await Ba.default.access(r,Ba.constants.F_OK),n=!0}catch{}if(!n)return t;let o=await Ba.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}})(),b7=async()=>`${await y7()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,Ng=async()=>Mn?b7():`${Bg.default.env.SYSTEMROOT||Bg.default.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`});function qn(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 YA=it(()=>{});async function Lg(){if(ZA.default.platform!=="darwin")throw new Error("macOS only");let{stdout:t}=await w7("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]);return/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(t)?.groups.id??"com.apple.Safari"}var JA,ZA,QA,w7,eF=it(()=>{JA=require("node:util"),ZA=be(require("node:process"),1),QA=require("node:child_process"),w7=(0,JA.promisify)(QA.execFile)});async function nF(t,{humanReadableOutput:e=!0,signal:r}={}){if(tF.default.platform!=="darwin")throw new Error("macOS only");let n=e?[]:["-ss"],o={};r&&(o.signal=r);let{stdout:i}=await v7("osascript",["-e",t,n],o);return i.trim()}var tF,rF,jg,v7,oF=it(()=>{tF=be(require("node:process"),1),rF=require("node:util"),jg=require("node:child_process"),v7=(0,rF.promisify)(jg.execFile)});async function Ug(t){return nF(`tell application "Finder" to set app_path to application file id "${t}" as string
103
- tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}var iF=it(()=>{oF()});async function Mg(t=E7){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 Gl(`Cannot find Windows browser in stdout: ${JSON.stringify(e)}`);let{id:n}=r.groups,o=C7[n];if(!o)throw new Gl(`Unknown browser ID: ${n}`);return o}var sF,aF,E7,C7,Gl,uF=it(()=>{sF=require("node:util"),aF=require("node:child_process"),E7=(0,sF.promisify)(aF.execFile),C7={AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},MSEdgeDHTML:{name:"Edge",id:"com.microsoft.edge"},MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"}},Gl=class extends Error{}});async function qg(){if(Wl.default.platform==="darwin"){let t=await Lg();return{name:await Ug(t),id:t}}if(Wl.default.platform==="linux"){let{stdout:t}=await _7("xdg-mime",["query","default","x-scheme-handler/http"]),e=t.trim();return{name:x7(e.replace(/.desktop$/,"").replace("-"," ")),id:e}}if(Wl.default.platform==="win32")return Mg();throw new Error("Only macOS, Linux, and Windows are supported")}var cF,Wl,lF,_7,x7,fF=it(()=>{cF=require("node:util"),Wl=be(require("node:process"),1),lF=require("node:child_process");eF();iF();uF();_7=(0,cF.promisify)(lF.execFile),x7=t=>t.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase())});var Kg={};wn(Kg,{apps:()=>Hn,default:()=>k7,openApp:()=>O7});async function A7(){let t=await Ng(),e=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,r=zg.Buffer.from(e,"utf16le").toString("base64"),{stdout:n}=await S7(t,["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand",r],{encoding:"utf8"}),o=n.trim(),i={ChromeHTML:"com.google.chrome",BraveHTML:"com.brave.Browser",MSEdgeHTM:"com.microsoft.edge",FirefoxURL:"org.mozilla.firefox"};return i[o]?{id:i[o]}:{}}function mF(t){if(typeof t=="string"||Array.isArray(t))return t;let{[dF]:e}=t;if(!e)throw new Error(`${dF} is not supported`);return e}function Xl({[ts]:t},{wsl:e}){if(e&&Mn)return mF(e);if(!t)throw new Error(`${ts} is not supported`);return mF(t)}var Vg,zg,Gg,gF,DF,Wg,Kl,$7,S7,Hg,pF,ts,dF,hF,Na,F7,O7,Hn,k7,Xg=it(()=>{Vg=be(require("node:process"),1),zg=require("node:buffer"),Gg=be(require("node:path"),1),gF=require("node:url"),DF=require("node:util"),Wg=be(require("node:child_process"),1),Kl=be(require("node:fs/promises"),1);XA();YA();fF();Tg();$7={},S7=(0,DF.promisify)(Wg.default.execFile),Hg=Gg.default.dirname((0,gF.fileURLToPath)($7.url)),pF=Gg.default.join(Hg,"xdg-open"),{platform:ts,arch:dF}=Vg.default;hF=async(t,e)=>{let r;for(let n of t)try{return await e(n)}catch(o){r=o}throw r},Na=async t=>{if(t={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...t},Array.isArray(t.app))return hF(t.app,a=>Na({...t,app:a}));let{name:e,arguments:r=[]}=t.app??{};if(r=[...r],Array.isArray(e))return hF(e,a=>Na({...t,app:{name:a,arguments:r}}));if(e==="browser"||e==="browserPrivate"){let a={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.Browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge"},u={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},c=Mn?await A7():await qg();if(c.id in a){let l=a[c.id];return e==="browserPrivate"&&r.push(u[l]),Na({...t,app:{name:Hn[l],arguments:r}})}throw new Error(`${c.name} is not supported as a default browser`)}let n,o=[],i={};if(ts==="darwin")n="open",t.wait&&o.push("--wait-apps"),t.background&&o.push("--background"),t.newInstance&&o.push("--new"),e&&o.push("-a",e);else if(ts==="win32"||Mn&&!es()&&!e){n=await Ng(),o.push("-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"),Mn||(i.windowsVerbatimArguments=!0);let a=["Start"];t.wait&&a.push("-Wait"),e?(a.push(`"\`"${e}\`""`),t.target&&r.push(t.target)):t.target&&a.push(`"${t.target}"`),r.length>0&&(r=r.map(u=>`"\`"${u}\`""`),a.push("-ArgumentList",r.join(","))),t.target=zg.Buffer.from(a.join(" "),"utf16le").toString("base64")}else{if(e)n=e;else{let a=!Hg||Hg==="/",u=!1;try{await Kl.default.access(pF,Kl.constants.X_OK),u=!0}catch{}n=Vg.default.versions.electron??(ts==="android"||a||!u)?"xdg-open":pF}r.length>0&&o.push(...r),t.wait||(i.stdio="ignore",i.detached=!0)}ts==="darwin"&&r.length>0&&o.push("--args",...r),t.target&&o.push(t.target);let s=Wg.default.spawn(n,o,i);return t.wait?new Promise((a,u)=>{s.once("error",u),s.once("close",c=>{if(!t.allowNonzeroExitCode&&c>0){u(new Error(`Exited with code ${c}`));return}a(s)})}):(s.unref(),s)},F7=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a `target`");return Na({...e,target:t})},O7=(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 Na({...e,app:{name:t,arguments:r}})};Hn={};qn(Hn,"chrome",()=>Xl({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));qn(Hn,"brave",()=>Xl({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"]}}));qn(Hn,"firefox",()=>Xl({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));qn(Hn,"edge",()=>Xl({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));qn(Hn,"browser",()=>"browser");qn(Hn,"browserPrivate",()=>"browserPrivate");k7=F7});var bf=C(wr=>{"use strict";wr.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;wr.find=(t,e)=>t.nodes.find(r=>r.type===e);wr.exceedsLimit=(t,e,r=1,n)=>n===!1||!wr.isInteger(t)||!wr.isInteger(e)?!1:(Number(e)-Number(t))/Number(r)>=n;wr.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)};wr.encloseBrace=t=>t.type!=="brace"?!1:t.commas>>0+t.ranges>>0===0?(t.invalid=!0,!0):!1;wr.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;wr.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;wr.reduce=t=>t.reduce((e,r)=>(r.type==="text"&&e.push(r.value),r.type==="range"&&(r.type="text"),e),[]);wr.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 wf=C((cte,$2)=>{"use strict";var k2=bf();$2.exports=(t,e={})=>{let r=(n,o={})=>{let i=e.escapeInvalid&&k2.isInvalidBrace(o),s=n.invalid===!0&&e.escapeInvalid===!0,a="";if(n.value)return(i||s)&&k2.isOpenOrClose(n)?"\\"+n.value:n.value;if(n.value)return n.value;if(n.nodes)for(let u of n.nodes)a+=r(u);return a};return r(t)}});var T2=C((lte,P2)=>{"use strict";P2.exports=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}});var q2=C((fte,M2)=>{"use strict";var R2=T2(),Vo=(t,e,r)=>{if(R2(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(R2(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),s=String(n.capture),a=String(n.wrap),u=t+":"+e+"="+o+i+s+a;if(Vo.cache.hasOwnProperty(u))return Vo.cache[u].result;let c=Math.min(t,e),l=Math.max(t,e);if(Math.abs(c-l)===1){let b=t+"|"+e;return n.capture?`(${b})`:n.wrap===!1?b:`(?:${b})`}let f=U2(t)||U2(e),h={min:t,max:e,a:c,b:l},d=[],m=[];if(f&&(h.isPadded=f,h.maxLen=String(h.max).length),c<0){let b=l<0?Math.abs(l):1;m=I2(b,Math.abs(c),h,n),c=h.a=0}return l>=0&&(d=I2(c,l,h,n)),h.negatives=m,h.positives=d,h.result=DH(m,d,n),n.capture===!0?h.result=`(${h.result})`:n.wrap!==!1&&d.length+m.length>1&&(h.result=`(?:${h.result})`),Vo.cache[u]=h,h.result};function DH(t,e,r){let n=yD(t,e,"-",!1,r)||[],o=yD(e,t,"",!1,r)||[],i=yD(t,e,"-?",!0,r)||[];return n.concat(i).concat(o).join("|")}function yH(t,e){let r=1,n=1,o=N2(t,r),i=new Set([e]);for(;t<=o&&o<=e;)i.add(o),r+=1,o=N2(t,r);for(o=L2(e+1,n)-1;t<o&&o<=e;)i.add(o),n+=1,o=L2(e+1,n)-1;return i=[...i],i.sort(vH),i}function bH(t,e,r){if(t===e)return{pattern:t,count:[],digits:0};let n=wH(t,e),o=n.length,i="",s=0;for(let a=0;a<o;a++){let[u,c]=n[a];u===c?i+=u:u!=="0"||c!=="9"?i+=EH(u,c,r):s++}return s&&(i+=r.shorthand===!0?"\\d":"[0-9]"),{pattern:i,count:[s],digits:o}}function I2(t,e,r,n){let o=yH(t,e),i=[],s=t,a;for(let u=0;u<o.length;u++){let c=o[u],l=bH(String(s),String(c),n),f="";if(!r.isPadded&&a&&a.pattern===l.pattern){a.count.length>1&&a.count.pop(),a.count.push(l.count[0]),a.string=a.pattern+j2(a.count),s=c+1;continue}r.isPadded&&(f=CH(c,r,n)),l.string=f+l.pattern+j2(l.count),i.push(l),s=c+1,a=l}return i}function yD(t,e,r,n,o){let i=[];for(let s of t){let{string:a}=s;!n&&!B2(e,"string",a)&&i.push(r+a),n&&B2(e,"string",a)&&i.push(r+a)}return i}function wH(t,e){let r=[];for(let n=0;n<t.length;n++)r.push([t[n],e[n]]);return r}function vH(t,e){return t>e?1:e>t?-1:0}function B2(t,e,r){return t.some(n=>n[e]===r)}function N2(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function L2(t,e){return t-t%Math.pow(10,e)}function j2(t){let[e=0,r=""]=t;return r||e>1?`{${e+(r?","+r:"")}}`:""}function EH(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function U2(t){return/^-?(0+)\d/.test(t)}function CH(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}}`}}Vo.cache={};Vo.clearCache=()=>Vo.cache={};M2.exports=Vo});var vD=C((pte,X2)=>{"use strict";var _H=require("util"),V2=q2(),H2=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),xH=t=>e=>t===!0?Number(e):String(e),bD=t=>typeof t=="number"||typeof t=="string"&&t!=="",Wa=t=>Number.isInteger(+t),wD=t=>{let e=`${t}`,r=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++r]==="0";);return r>0},SH=(t,e,r)=>typeof t=="string"||typeof e=="string"?!0:r.stringify===!0,AH=(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},Ef=(t,e)=>{let r=t[0]==="-"?"-":"";for(r&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return r?"-"+t:t},FH=(t,e,r)=>{t.negatives.sort((a,u)=>a<u?-1:a>u?1:0),t.positives.sort((a,u)=>a<u?-1:a>u?1:0);let n=e.capture?"":"?:",o="",i="",s;return t.positives.length&&(o=t.positives.map(a=>Ef(String(a),r)).join("|")),t.negatives.length&&(i=`-(${n}${t.negatives.map(a=>Ef(String(a),r)).join("|")})`),o&&i?s=`${o}|${i}`:s=o||i,e.wrap?`(${n}${s})`:s},z2=(t,e,r,n)=>{if(r)return V2(t,e,{wrap:!1,...n});let o=String.fromCharCode(t);if(t===e)return o;let i=String.fromCharCode(e);return`[${o}-${i}]`},G2=(t,e,r)=>{if(Array.isArray(t)){let n=r.wrap===!0,o=r.capture?"":"?:";return n?`(${o}${t.join("|")})`:t.join("|")}return V2(t,e,r)},W2=(...t)=>new RangeError("Invalid range arguments: "+_H.inspect(...t)),K2=(t,e,r)=>{if(r.strictRanges===!0)throw W2([t,e]);return[]},OH=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return[]},kH=(t,e,r=1,n={})=>{let o=Number(t),i=Number(e);if(!Number.isInteger(o)||!Number.isInteger(i)){if(n.strictRanges===!0)throw W2([t,e]);return[]}o===0&&(o=0),i===0&&(i=0);let s=o>i,a=String(t),u=String(e),c=String(r);r=Math.max(Math.abs(r),1);let l=wD(a)||wD(u)||wD(c),f=l?Math.max(a.length,u.length,c.length):0,h=l===!1&&SH(t,e,n)===!1,d=n.transform||xH(h);if(n.toRegex&&r===1)return z2(Ef(t,f),Ef(e,f),!0,n);let m={negatives:[],positives:[]},b=_=>m[_<0?"negatives":"positives"].push(Math.abs(_)),D=[],E=0;for(;s?o>=i:o<=i;)n.toRegex===!0&&r>1?b(o):D.push(AH(d(o,E),f,h)),o=s?o-r:o+r,E++;return n.toRegex===!0?r>1?FH(m,n,f):G2(D,null,{wrap:!1,...n}):D},$H=(t,e,r=1,n={})=>{if(!Wa(t)&&t.length>1||!Wa(e)&&e.length>1)return K2(t,e,n);let o=n.transform||(h=>String.fromCharCode(h)),i=`${t}`.charCodeAt(0),s=`${e}`.charCodeAt(0),a=i>s,u=Math.min(i,s),c=Math.max(i,s);if(n.toRegex&&r===1)return z2(u,c,!1,n);let l=[],f=0;for(;a?i>=s:i<=s;)l.push(o(i,f)),i=a?i-r:i+r,f++;return n.toRegex===!0?G2(l,null,{wrap:!1,options:n}):l},vf=(t,e,r,n={})=>{if(e==null&&bD(t))return[t];if(!bD(t)||!bD(e))return K2(t,e,n);if(typeof r=="function")return vf(t,e,1,{transform:r});if(H2(r))return vf(t,e,0,r);let o={...n};return o.capture===!0&&(o.wrap=!0),r=r||o.step||1,Wa(r)?Wa(t)&&Wa(e)?kH(t,e,r,o):$H(t,e,Math.max(Math.abs(r),1),o):r!=null&&!H2(r)?OH(r,o):vf(t,e,1,r)};X2.exports=vf});var Z2=C((dte,J2)=>{"use strict";var PH=vD(),Y2=bf(),TH=(t,e={})=>{let r=(n,o={})=>{let i=Y2.isInvalidBrace(o),s=n.invalid===!0&&e.escapeInvalid===!0,a=i===!0||s===!0,u=e.escapeInvalid===!0?"\\":"",c="";if(n.isOpen===!0)return u+n.value;if(n.isClose===!0)return console.log("node.isClose",u,n.value),u+n.value;if(n.type==="open")return a?u+n.value:"(";if(n.type==="close")return a?u+n.value:")";if(n.type==="comma")return n.prev.type==="comma"?"":a?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let l=Y2.reduce(n.nodes),f=PH(...l,{...e,wrap:!1,toRegex:!0,strictZeros:!0});if(f.length!==0)return l.length>1&&f.length>1?`(${f})`:f}if(n.nodes)for(let l of n.nodes)c+=r(l,n);return c};return r(t)};J2.exports=TH});var tO=C((hte,eO)=>{"use strict";var RH=vD(),Q2=wf(),ms=bf(),zo=(t="",e="",r=!1)=>{let n=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return r?ms.flatten(e).map(o=>`{${o}}`):e;for(let o of t)if(Array.isArray(o))for(let i of o)n.push(zo(i,e,r));else for(let i of e)r===!0&&typeof i=="string"&&(i=`{${i}}`),n.push(Array.isArray(i)?zo(o,i,r):o+i);return ms.flatten(n)},IH=(t,e={})=>{let r=e.rangeLimit===void 0?1e3:e.rangeLimit,n=(o,i={})=>{o.queue=[];let s=i,a=i.queue;for(;s.type!=="brace"&&s.type!=="root"&&s.parent;)s=s.parent,a=s.queue;if(o.invalid||o.dollar){a.push(zo(a.pop(),Q2(o,e)));return}if(o.type==="brace"&&o.invalid!==!0&&o.nodes.length===2){a.push(zo(a.pop(),["{}"]));return}if(o.nodes&&o.ranges>0){let f=ms.reduce(o.nodes);if(ms.exceedsLimit(...f,e.step,r))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let h=RH(...f,e);h.length===0&&(h=Q2(o,e)),a.push(zo(a.pop(),h)),o.nodes=[];return}let u=ms.encloseBrace(o),c=o.queue,l=o;for(;l.type!=="brace"&&l.type!=="root"&&l.parent;)l=l.parent,c=l.queue;for(let f=0;f<o.nodes.length;f++){let h=o.nodes[f];if(h.type==="comma"&&o.type==="brace"){f===1&&c.push(""),c.push("");continue}if(h.type==="close"){a.push(zo(a.pop(),c,u));continue}if(h.value&&h.type!=="open"){c.push(zo(c.pop(),h.value));continue}h.nodes&&n(h,o)}return c};return ms.flatten(n(t))};eO.exports=IH});var nO=C((mte,rO)=>{"use strict";rO.exports={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
104
- `,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var uO=C((gte,aO)=>{"use strict";var BH=wf(),{MAX_LENGTH:oO,CHAR_BACKSLASH:ED,CHAR_BACKTICK:NH,CHAR_COMMA:LH,CHAR_DOT:jH,CHAR_LEFT_PARENTHESES:UH,CHAR_RIGHT_PARENTHESES:MH,CHAR_LEFT_CURLY_BRACE:qH,CHAR_RIGHT_CURLY_BRACE:HH,CHAR_LEFT_SQUARE_BRACKET:iO,CHAR_RIGHT_SQUARE_BRACKET:sO,CHAR_DOUBLE_QUOTE:VH,CHAR_SINGLE_QUOTE:zH,CHAR_NO_BREAK_SPACE:GH,CHAR_ZERO_WIDTH_NOBREAK_SPACE:WH}=nO(),KH=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let r=e||{},n=typeof r.maxLength=="number"?Math.min(oO,r.maxLength):oO;if(t.length>n)throw new SyntaxError(`Input length (${t.length}), exceeds max characters (${n})`);let o={type:"root",input:t,nodes:[]},i=[o],s=o,a=o,u=0,c=t.length,l=0,f=0,h,d=()=>t[l++],m=b=>{if(b.type==="text"&&a.type==="dot"&&(a.type="text"),a&&a.type==="text"&&b.type==="text"){a.value+=b.value;return}return s.nodes.push(b),b.parent=s,b.prev=a,a=b,b};for(m({type:"bos"});l<c;)if(s=i[i.length-1],h=d(),!(h===WH||h===GH)){if(h===ED){m({type:"text",value:(e.keepEscaping?h:"")+d()});continue}if(h===sO){m({type:"text",value:"\\"+h});continue}if(h===iO){u++;let b;for(;l<c&&(b=d());){if(h+=b,b===iO){u++;continue}if(b===ED){h+=d();continue}if(b===sO&&(u--,u===0))break}m({type:"text",value:h});continue}if(h===UH){s=m({type:"paren",nodes:[]}),i.push(s),m({type:"text",value:h});continue}if(h===MH){if(s.type!=="paren"){m({type:"text",value:h});continue}s=i.pop(),m({type:"text",value:h}),s=i[i.length-1];continue}if(h===VH||h===zH||h===NH){let b=h,D;for(e.keepQuotes!==!0&&(h="");l<c&&(D=d());){if(D===ED){h+=D+d();continue}if(D===b){e.keepQuotes===!0&&(h+=D);break}h+=D}m({type:"text",value:h});continue}if(h===qH){f++;let D={type:"brace",open:!0,close:!1,dollar:a.value&&a.value.slice(-1)==="$"||s.dollar===!0,depth:f,commas:0,ranges:0,nodes:[]};s=m(D),i.push(s),m({type:"open",value:h});continue}if(h===HH){if(s.type!=="brace"){m({type:"text",value:h});continue}let b="close";s=i.pop(),s.close=!0,m({type:b,value:h}),f--,s=i[i.length-1];continue}if(h===LH&&f>0){if(s.ranges>0){s.ranges=0;let b=s.nodes.shift();s.nodes=[b,{type:"text",value:BH(s)}]}m({type:"comma",value:h}),s.commas++;continue}if(h===jH&&f>0&&s.commas===0){let b=s.nodes;if(f===0||b.length===0){m({type:"text",value:h});continue}if(a.type==="dot"){if(s.range=[],a.value+=h,a.type="range",s.nodes.length!==3&&s.nodes.length!==5){s.invalid=!0,s.ranges=0,a.type="text";continue}s.ranges++,s.args=[];continue}if(a.type==="range"){b.pop();let D=b[b.length-1];D.value+=a.value+h,a=D,s.ranges--;continue}m({type:"dot",value:h});continue}m({type:"text",value:h})}do if(s=i.pop(),s.type!=="root"){s.nodes.forEach(E=>{E.nodes||(E.type==="open"&&(E.isOpen=!0),E.type==="close"&&(E.isClose=!0),E.nodes||(E.type="text"),E.invalid=!0)});let b=i[i.length-1],D=b.nodes.indexOf(s);b.nodes.splice(D,1,...s.nodes)}while(i.length>0);return m({type:"eos"}),o};aO.exports=KH});var fO=C((Dte,lO)=>{"use strict";var cO=wf(),XH=Z2(),YH=tO(),JH=uO(),rr=(t,e={})=>{let r=[];if(Array.isArray(t))for(let n of t){let o=rr.create(n,e);Array.isArray(o)?r.push(...o):r.push(o)}else r=[].concat(rr.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(r=[...new Set(r)]),r};rr.parse=(t,e={})=>JH(t,e);rr.stringify=(t,e={})=>cO(typeof t=="string"?rr.parse(t,e):t,e);rr.compile=(t,e={})=>(typeof t=="string"&&(t=rr.parse(t,e)),XH(t,e));rr.expand=(t,e={})=>{typeof t=="string"&&(t=rr.parse(t,e));let r=YH(t,e);return e.noempty===!0&&(r=r.filter(Boolean)),e.nodupes===!0&&(r=[...new Set(r)]),r};rr.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?rr.compile(t,e):rr.expand(t,e);lO.exports=rr});var Ka=C((yte,gO)=>{"use strict";var ZH=require("path"),Xr="\\\\/",pO=`[^${Xr}]`,Dn="\\.",QH="\\+",eV="\\?",Cf="\\/",tV="(?=.)",dO="[^/]",CD=`(?:${Cf}|$)`,hO=`(?:^|${Cf})`,_D=`${Dn}{1,2}${CD}`,rV=`(?!${Dn})`,nV=`(?!${hO}${_D})`,oV=`(?!${Dn}{0,1}${CD})`,iV=`(?!${_D})`,sV=`[^.${Cf}]`,aV=`${dO}*?`,mO={DOT_LITERAL:Dn,PLUS_LITERAL:QH,QMARK_LITERAL:eV,SLASH_LITERAL:Cf,ONE_CHAR:tV,QMARK:dO,END_ANCHOR:CD,DOTS_SLASH:_D,NO_DOT:rV,NO_DOTS:nV,NO_DOT_SLASH:oV,NO_DOTS_SLASH:iV,QMARK_NO_DOT:sV,STAR:aV,START_ANCHOR:hO},uV={...mO,SLASH_LITERAL:`[${Xr}]`,QMARK:pO,STAR:`${pO}*?`,DOTS_SLASH:`${Dn}{1,2}(?:[${Xr}]|$)`,NO_DOT:`(?!${Dn})`,NO_DOTS:`(?!(?:^|[${Xr}])${Dn}{1,2}(?:[${Xr}]|$))`,NO_DOT_SLASH:`(?!${Dn}{0,1}(?:[${Xr}]|$))`,NO_DOTS_SLASH:`(?!${Dn}{1,2}(?:[${Xr}]|$))`,QMARK_NO_DOT:`[^.${Xr}]`,START_ANCHOR:`(?:^|[${Xr}])`,END_ANCHOR:`(?:[${Xr}]|$)`},cV={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"};gO.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:cV,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:ZH.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?uV:mO}}});var Xa=C(Jt=>{"use strict";var lV=require("path"),fV=process.platform==="win32",{REGEX_BACKSLASH:pV,REGEX_REMOVE_BACKSLASH:dV,REGEX_SPECIAL_CHARS:hV,REGEX_SPECIAL_CHARS_GLOBAL:mV}=Ka();Jt.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Jt.hasRegexChars=t=>hV.test(t);Jt.isRegexChar=t=>t.length===1&&Jt.hasRegexChars(t);Jt.escapeRegex=t=>t.replace(mV,"\\$1");Jt.toPosixSlashes=t=>t.replace(pV,"/");Jt.removeBackslashes=t=>t.replace(dV,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:fV===!0||lV.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 _O=C((wte,CO)=>{"use strict";var DO=Xa(),{CHAR_ASTERISK:xD,CHAR_AT:gV,CHAR_BACKWARD_SLASH:Ya,CHAR_COMMA:DV,CHAR_DOT:SD,CHAR_EXCLAMATION_MARK:AD,CHAR_FORWARD_SLASH:EO,CHAR_LEFT_CURLY_BRACE:FD,CHAR_LEFT_PARENTHESES:OD,CHAR_LEFT_SQUARE_BRACKET:yV,CHAR_PLUS:bV,CHAR_QUESTION_MARK:yO,CHAR_RIGHT_CURLY_BRACE:wV,CHAR_RIGHT_PARENTHESES:bO,CHAR_RIGHT_SQUARE_BRACKET:vV}=Ka(),wO=t=>t===EO||t===Ya,vO=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},EV=(t,e)=>{let r=e||{},n=t.length-1,o=r.parts===!0||r.scanToEnd===!0,i=[],s=[],a=[],u=t,c=-1,l=0,f=0,h=!1,d=!1,m=!1,b=!1,D=!1,E=!1,_=!1,g=!1,x=!1,S=!1,T=0,O,B,I={value:"",depth:0,isGlob:!1},L=()=>c>=n,F=()=>u.charCodeAt(c+1),U=()=>(O=B,u.charCodeAt(++c));for(;c<n;){B=U();let w;if(B===Ya){_=I.backslashes=!0,B=U(),B===FD&&(E=!0);continue}if(E===!0||B===FD){for(T++;L()!==!0&&(B=U());){if(B===Ya){_=I.backslashes=!0,U();continue}if(B===FD){T++;continue}if(E!==!0&&B===SD&&(B=U())===SD){if(h=I.isBrace=!0,m=I.isGlob=!0,S=!0,o===!0)continue;break}if(E!==!0&&B===DV){if(h=I.isBrace=!0,m=I.isGlob=!0,S=!0,o===!0)continue;break}if(B===wV&&(T--,T===0)){E=!1,h=I.isBrace=!0,S=!0;break}}if(o===!0)continue;break}if(B===EO){if(i.push(c),s.push(I),I={value:"",depth:0,isGlob:!1},S===!0)continue;if(O===SD&&c===l+1){l+=2;continue}f=c+1;continue}if(r.noext!==!0&&(B===bV||B===gV||B===xD||B===yO||B===AD)===!0&&F()===OD){if(m=I.isGlob=!0,b=I.isExtglob=!0,S=!0,B===AD&&c===l&&(x=!0),o===!0){for(;L()!==!0&&(B=U());){if(B===Ya){_=I.backslashes=!0,B=U();continue}if(B===bO){m=I.isGlob=!0,S=!0;break}}continue}break}if(B===xD){if(O===xD&&(D=I.isGlobstar=!0),m=I.isGlob=!0,S=!0,o===!0)continue;break}if(B===yO){if(m=I.isGlob=!0,S=!0,o===!0)continue;break}if(B===yV){for(;L()!==!0&&(w=U());){if(w===Ya){_=I.backslashes=!0,U();continue}if(w===vV){d=I.isBracket=!0,m=I.isGlob=!0,S=!0;break}}if(o===!0)continue;break}if(r.nonegate!==!0&&B===AD&&c===l){g=I.negated=!0,l++;continue}if(r.noparen!==!0&&B===OD){if(m=I.isGlob=!0,o===!0){for(;L()!==!0&&(B=U());){if(B===OD){_=I.backslashes=!0,B=U();continue}if(B===bO){S=!0;break}}continue}break}if(m===!0){if(S=!0,o===!0)continue;break}}r.noext===!0&&(b=!1,m=!1);let M=u,te="",$="";l>0&&(te=u.slice(0,l),u=u.slice(l),f-=l),M&&m===!0&&f>0?(M=u.slice(0,f),$=u.slice(f)):m===!0?(M="",$=u):M=u,M&&M!==""&&M!=="/"&&M!==u&&wO(M.charCodeAt(M.length-1))&&(M=M.slice(0,-1)),r.unescape===!0&&($&&($=DO.removeBackslashes($)),M&&_===!0&&(M=DO.removeBackslashes(M)));let y={prefix:te,input:t,start:l,base:M,glob:$,isBrace:h,isBracket:d,isGlob:m,isExtglob:b,isGlobstar:D,negated:g,negatedExtglob:x};if(r.tokens===!0&&(y.maxDepth=0,wO(B)||s.push(I),y.tokens=s),r.parts===!0||r.tokens===!0){let w;for(let v=0;v<i.length;v++){let A=w?w+1:l,R=i[v],k=t.slice(A,R);r.tokens&&(v===0&&l!==0?(s[v].isPrefix=!0,s[v].value=te):s[v].value=k,vO(s[v]),y.maxDepth+=s[v].depth),(v!==0||k!=="")&&a.push(k),w=R}if(w&&w+1<t.length){let v=t.slice(w+1);a.push(v),r.tokens&&(s[s.length-1].value=v,vO(s[s.length-1]),y.maxDepth+=s[s.length-1].depth)}y.slashes=i,y.parts=a}return y};CO.exports=EV});var AO=C((vte,SO)=>{"use strict";var _f=Ka(),nr=Xa(),{MAX_LENGTH:xf,POSIX_REGEX_SOURCE:CV,REGEX_NON_SPECIAL_CHARS:_V,REGEX_SPECIAL_CHARS_BACKREF:xV,REPLACEMENTS:xO}=_f,SV=(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=>nr.escapeRegex(o)).join("..")}return r},gs=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,kD=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=xO[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(xf,r.maxLength):xf,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||""},s=[i],a=r.capture?"":"?:",u=nr.isWindows(e),c=_f.globChars(u),l=_f.extglobChars(c),{DOT_LITERAL:f,PLUS_LITERAL:h,SLASH_LITERAL:d,ONE_CHAR:m,DOTS_SLASH:b,NO_DOT:D,NO_DOT_SLASH:E,NO_DOTS_SLASH:_,QMARK:g,QMARK_NO_DOT:x,STAR:S,START_ANCHOR:T}=c,O=z=>`(${a}(?:(?!${T}${z.dot?b:f}).)*?)`,B=r.dot?"":D,I=r.dot?g:x,L=r.bash===!0?O(r):S;r.capture&&(L=`(${L})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let F={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:s};t=nr.removePrefix(t,F),o=t.length;let U=[],M=[],te=[],$=i,y,w=()=>F.index===o-1,v=F.peek=(z=1)=>t[F.index+z],A=F.advance=()=>t[++F.index]||"",R=()=>t.slice(F.index+1),k=(z="",xe=0)=>{F.consumed+=z,F.index+=xe},q=z=>{F.output+=z.output!=null?z.output:z.value,k(z.value)},P=()=>{let z=1;for(;v()==="!"&&(v(2)!=="("||v(3)==="?");)A(),F.start++,z++;return z%2===0?!1:(F.negated=!0,F.start++,!0)},N=z=>{F[z]++,te.push(z)},re=z=>{F[z]--,te.pop()},V=z=>{if($.type==="globstar"){let xe=F.braces>0&&(z.type==="comma"||z.type==="brace"),H=z.extglob===!0||U.length&&(z.type==="pipe"||z.type==="paren");z.type!=="slash"&&z.type!=="paren"&&!xe&&!H&&(F.output=F.output.slice(0,-$.output.length),$.type="star",$.value="*",$.output=L,F.output+=$.output)}if(U.length&&z.type!=="paren"&&(U[U.length-1].inner+=z.value),(z.value||z.output)&&q(z),$&&$.type==="text"&&z.type==="text"){$.value+=z.value,$.output=($.output||"")+z.value;return}z.prev=$,s.push(z),$=z},le=(z,xe)=>{let H={...l[xe],conditions:1,inner:""};H.prev=$,H.parens=F.parens,H.output=F.output;let fe=(r.capture?"(":"")+H.open;N("parens"),V({type:z,value:xe,output:F.output?"":m}),V({type:"paren",extglob:!0,value:A(),output:fe}),U.push(H)},Cr=z=>{let xe=z.close+(r.capture?")":""),H;if(z.type==="negate"){let fe=L;if(z.inner&&z.inner.length>1&&z.inner.includes("/")&&(fe=O(r)),(fe!==L||w()||/^\)+$/.test(R()))&&(xe=z.close=`)$))${fe}`),z.inner.includes("*")&&(H=R())&&/^\.[^\\/.]+$/.test(H)){let He=kD(H,{...e,fastpaths:!1}).output;xe=z.close=`)${He})${fe})`}z.prev.type==="bos"&&(F.negatedExtglob=!0)}V({type:"paren",extglob:!0,value:y,output:xe}),re("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let z=!1,xe=t.replace(xV,(H,fe,He,Ot,nt,Rf)=>Ot==="\\"?(z=!0,H):Ot==="?"?fe?fe+Ot+(nt?g.repeat(nt.length):""):Rf===0?I+(nt?g.repeat(nt.length):""):g.repeat(He.length):Ot==="."?f.repeat(He.length):Ot==="*"?fe?fe+Ot+(nt?L:""):L:fe?H:`\\${H}`);return z===!0&&(r.unescape===!0?xe=xe.replace(/\\/g,""):xe=xe.replace(/\\+/g,H=>H.length%2===0?"\\\\":H?"\\":"")),xe===t&&r.contains===!0?(F.output=t,F):(F.output=nr.wrapOutput(xe,F,e),F)}for(;!w();){if(y=A(),y==="\0")continue;if(y==="\\"){let H=v();if(H==="/"&&r.bash!==!0||H==="."||H===";")continue;if(!H){y+="\\",V({type:"text",value:y});continue}let fe=/^\\+/.exec(R()),He=0;if(fe&&fe[0].length>2&&(He=fe[0].length,F.index+=He,He%2!==0&&(y+="\\")),r.unescape===!0?y=A():y+=A(),F.brackets===0){V({type:"text",value:y});continue}}if(F.brackets>0&&(y!=="]"||$.value==="["||$.value==="[^")){if(r.posix!==!1&&y===":"){let H=$.value.slice(1);if(H.includes("[")&&($.posix=!0,H.includes(":"))){let fe=$.value.lastIndexOf("["),He=$.value.slice(0,fe),Ot=$.value.slice(fe+2),nt=CV[Ot];if(nt){$.value=He+nt,F.backtrack=!0,A(),!i.output&&s.indexOf($)===1&&(i.output=m);continue}}}(y==="["&&v()!==":"||y==="-"&&v()==="]")&&(y=`\\${y}`),y==="]"&&($.value==="["||$.value==="[^")&&(y=`\\${y}`),r.posix===!0&&y==="!"&&$.value==="["&&(y="^"),$.value+=y,q({value:y});continue}if(F.quotes===1&&y!=='"'){y=nr.escapeRegex(y),$.value+=y,q({value:y});continue}if(y==='"'){F.quotes=F.quotes===1?0:1,r.keepQuotes===!0&&V({type:"text",value:y});continue}if(y==="("){N("parens"),V({type:"paren",value:y});continue}if(y===")"){if(F.parens===0&&r.strictBrackets===!0)throw new SyntaxError(gs("opening","("));let H=U[U.length-1];if(H&&F.parens===H.parens+1){Cr(U.pop());continue}V({type:"paren",value:y,output:F.parens?")":"\\)"}),re("parens");continue}if(y==="["){if(r.nobracket===!0||!R().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(gs("closing","]"));y=`\\${y}`}else N("brackets");V({type:"bracket",value:y});continue}if(y==="]"){if(r.nobracket===!0||$&&$.type==="bracket"&&$.value.length===1){V({type:"text",value:y,output:`\\${y}`});continue}if(F.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(gs("opening","["));V({type:"text",value:y,output:`\\${y}`});continue}re("brackets");let H=$.value.slice(1);if($.posix!==!0&&H[0]==="^"&&!H.includes("/")&&(y=`/${y}`),$.value+=y,q({value:y}),r.literalBrackets===!1||nr.hasRegexChars(H))continue;let fe=nr.escapeRegex($.value);if(F.output=F.output.slice(0,-$.value.length),r.literalBrackets===!0){F.output+=fe,$.value=fe;continue}$.value=`(${a}${fe}|${$.value})`,F.output+=$.value;continue}if(y==="{"&&r.nobrace!==!0){N("braces");let H={type:"brace",value:y,output:"(",outputIndex:F.output.length,tokensIndex:F.tokens.length};M.push(H),V(H);continue}if(y==="}"){let H=M[M.length-1];if(r.nobrace===!0||!H){V({type:"text",value:y,output:y});continue}let fe=")";if(H.dots===!0){let He=s.slice(),Ot=[];for(let nt=He.length-1;nt>=0&&(s.pop(),He[nt].type!=="brace");nt--)He[nt].type!=="dots"&&Ot.unshift(He[nt].value);fe=SV(Ot,r),F.backtrack=!0}if(H.comma!==!0&&H.dots!==!0){let He=F.output.slice(0,H.outputIndex),Ot=F.tokens.slice(H.tokensIndex);H.value=H.output="\\{",y=fe="\\}",F.output=He;for(let nt of Ot)F.output+=nt.output||nt.value}V({type:"brace",value:y,output:fe}),re("braces"),M.pop();continue}if(y==="|"){U.length>0&&U[U.length-1].conditions++,V({type:"text",value:y});continue}if(y===","){let H=y,fe=M[M.length-1];fe&&te[te.length-1]==="braces"&&(fe.comma=!0,H="|"),V({type:"comma",value:y,output:H});continue}if(y==="/"){if($.type==="dot"&&F.index===F.start+1){F.start=F.index+1,F.consumed="",F.output="",s.pop(),$=i;continue}V({type:"slash",value:y,output:d});continue}if(y==="."){if(F.braces>0&&$.type==="dot"){$.value==="."&&($.output=f);let H=M[M.length-1];$.type="dots",$.output+=y,$.value+=y,H.dots=!0;continue}if(F.braces+F.parens===0&&$.type!=="bos"&&$.type!=="slash"){V({type:"text",value:y,output:f});continue}V({type:"dot",value:y,output:f});continue}if(y==="?"){if(!($&&$.value==="(")&&r.noextglob!==!0&&v()==="("&&v(2)!=="?"){le("qmark",y);continue}if($&&$.type==="paren"){let fe=v(),He=y;if(fe==="<"&&!nr.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");($.value==="("&&!/[!=<:]/.test(fe)||fe==="<"&&!/<([!=]|\w+>)/.test(R()))&&(He=`\\${y}`),V({type:"text",value:y,output:He});continue}if(r.dot!==!0&&($.type==="slash"||$.type==="bos")){V({type:"qmark",value:y,output:x});continue}V({type:"qmark",value:y,output:g});continue}if(y==="!"){if(r.noextglob!==!0&&v()==="("&&(v(2)!=="?"||!/[!=<:]/.test(v(3)))){le("negate",y);continue}if(r.nonegate!==!0&&F.index===0){P();continue}}if(y==="+"){if(r.noextglob!==!0&&v()==="("&&v(2)!=="?"){le("plus",y);continue}if($&&$.value==="("||r.regex===!1){V({type:"plus",value:y,output:h});continue}if($&&($.type==="bracket"||$.type==="paren"||$.type==="brace")||F.parens>0){V({type:"plus",value:y});continue}V({type:"plus",value:h});continue}if(y==="@"){if(r.noextglob!==!0&&v()==="("&&v(2)!=="?"){V({type:"at",extglob:!0,value:y,output:""});continue}V({type:"text",value:y});continue}if(y!=="*"){(y==="$"||y==="^")&&(y=`\\${y}`);let H=_V.exec(R());H&&(y+=H[0],F.index+=H[0].length),V({type:"text",value:y});continue}if($&&($.type==="globstar"||$.star===!0)){$.type="star",$.star=!0,$.value+=y,$.output=L,F.backtrack=!0,F.globstar=!0,k(y);continue}let z=R();if(r.noextglob!==!0&&/^\([^?]/.test(z)){le("star",y);continue}if($.type==="star"){if(r.noglobstar===!0){k(y);continue}let H=$.prev,fe=H.prev,He=H.type==="slash"||H.type==="bos",Ot=fe&&(fe.type==="star"||fe.type==="globstar");if(r.bash===!0&&(!He||z[0]&&z[0]!=="/")){V({type:"star",value:y,output:""});continue}let nt=F.braces>0&&(H.type==="comma"||H.type==="brace"),Rf=U.length&&(H.type==="pipe"||H.type==="paren");if(!He&&H.type!=="paren"&&!nt&&!Rf){V({type:"star",value:y,output:""});continue}for(;z.slice(0,3)==="/**";){let tu=t[F.index+4];if(tu&&tu!=="/")break;z=z.slice(3),k("/**",3)}if(H.type==="bos"&&w()){$.type="globstar",$.value+=y,$.output=O(r),F.output=$.output,F.globstar=!0,k(y);continue}if(H.type==="slash"&&H.prev.type!=="bos"&&!Ot&&w()){F.output=F.output.slice(0,-(H.output+$.output).length),H.output=`(?:${H.output}`,$.type="globstar",$.output=O(r)+(r.strictSlashes?")":"|$)"),$.value+=y,F.globstar=!0,F.output+=H.output+$.output,k(y);continue}if(H.type==="slash"&&H.prev.type!=="bos"&&z[0]==="/"){let tu=z[1]!==void 0?"|$":"";F.output=F.output.slice(0,-(H.output+$.output).length),H.output=`(?:${H.output}`,$.type="globstar",$.output=`${O(r)}${d}|${d}${tu})`,$.value+=y,F.output+=H.output+$.output,F.globstar=!0,k(y+A()),V({type:"slash",value:"/",output:""});continue}if(H.type==="bos"&&z[0]==="/"){$.type="globstar",$.value+=y,$.output=`(?:^|${d}|${O(r)}${d})`,F.output=$.output,F.globstar=!0,k(y+A()),V({type:"slash",value:"/",output:""});continue}F.output=F.output.slice(0,-$.output.length),$.type="globstar",$.output=O(r),$.value+=y,F.output+=$.output,F.globstar=!0,k(y);continue}let xe={type:"star",value:y,output:L};if(r.bash===!0){xe.output=".*?",($.type==="bos"||$.type==="slash")&&(xe.output=B+xe.output),V(xe);continue}if($&&($.type==="bracket"||$.type==="paren")&&r.regex===!0){xe.output=y,V(xe);continue}(F.index===F.start||$.type==="slash"||$.type==="dot")&&($.type==="dot"?(F.output+=E,$.output+=E):r.dot===!0?(F.output+=_,$.output+=_):(F.output+=B,$.output+=B),v()!=="*"&&(F.output+=m,$.output+=m)),V(xe)}for(;F.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(gs("closing","]"));F.output=nr.escapeLast(F.output,"["),re("brackets")}for(;F.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(gs("closing",")"));F.output=nr.escapeLast(F.output,"("),re("parens")}for(;F.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(gs("closing","}"));F.output=nr.escapeLast(F.output,"{"),re("braces")}if(r.strictSlashes!==!0&&($.type==="star"||$.type==="bracket")&&V({type:"maybe_slash",value:"",output:`${d}?`}),F.backtrack===!0){F.output="";for(let z of F.tokens)F.output+=z.output!=null?z.output:z.value,z.suffix&&(F.output+=z.suffix)}return F};kD.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(xf,r.maxLength):xf,o=t.length;if(o>n)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${n}`);t=xO[t]||t;let i=nr.isWindows(e),{DOT_LITERAL:s,SLASH_LITERAL:a,ONE_CHAR:u,DOTS_SLASH:c,NO_DOT:l,NO_DOTS:f,NO_DOTS_SLASH:h,STAR:d,START_ANCHOR:m}=_f.globChars(i),b=r.dot?f:l,D=r.dot?h:l,E=r.capture?"":"?:",_={negated:!1,prefix:""},g=r.bash===!0?".*?":d;r.capture&&(g=`(${g})`);let x=B=>B.noglobstar===!0?g:`(${E}(?:(?!${m}${B.dot?c:s}).)*?)`,S=B=>{switch(B){case"*":return`${b}${u}${g}`;case".*":return`${s}${u}${g}`;case"*.*":return`${b}${g}${s}${u}${g}`;case"*/*":return`${b}${g}${a}${u}${D}${g}`;case"**":return b+x(r);case"**/*":return`(?:${b}${x(r)}${a})?${D}${u}${g}`;case"**/*.*":return`(?:${b}${x(r)}${a})?${D}${g}${s}${u}${g}`;case"**/.*":return`(?:${b}${x(r)}${a})?${s}${u}${g}`;default:{let I=/^(.*?)\.(\w+)$/.exec(B);if(!I)return;let L=S(I[1]);return L?L+s+I[2]:void 0}}},T=nr.removePrefix(t,_),O=S(T);return O&&r.strictSlashes!==!0&&(O+=`${a}?`),O};SO.exports=kD});var OO=C((Ete,FO)=>{"use strict";var AV=require("path"),FV=_O(),$D=AO(),PD=Xa(),OV=Ka(),kV=t=>t&&typeof t=="object"&&!Array.isArray(t),rt=(t,e,r=!1)=>{if(Array.isArray(t)){let l=t.map(h=>rt(h,e,r));return h=>{for(let d of l){let m=d(h);if(m)return m}return!1}}let n=kV(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=PD.isWindows(e),s=n?rt.compileRe(t,e):rt.makeRe(t,e,!1,!0),a=s.state;delete s.state;let u=()=>!1;if(o.ignore){let l={...e,ignore:null,onMatch:null,onResult:null};u=rt(o.ignore,l,r)}let c=(l,f=!1)=>{let{isMatch:h,match:d,output:m}=rt.test(l,s,e,{glob:t,posix:i}),b={glob:t,state:a,regex:s,posix:i,input:l,output:m,match:d,isMatch:h};return typeof o.onResult=="function"&&o.onResult(b),h===!1?(b.isMatch=!1,f?b:!1):u(l)?(typeof o.onIgnore=="function"&&o.onIgnore(b),b.isMatch=!1,f?b:!1):(typeof o.onMatch=="function"&&o.onMatch(b),f?b:!0)};return r&&(c.state=a),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||{},s=i.format||(o?PD.toPosixSlashes:null),a=t===n,u=a&&s?s(t):t;return a===!1&&(u=s?s(t):t,a=u===n),(a===!1||i.capture===!0)&&(i.matchBase===!0||i.basename===!0?a=rt.matchBase(t,e,r,o):a=e.exec(u)),{isMatch:!!a,match:a,output:u}};rt.matchBase=(t,e,r,n=PD.isWindows(r))=>(e instanceof RegExp?e:rt.makeRe(e,r)).test(AV.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)):$D(t,{...e,fastpaths:!1});rt.scan=(t,e)=>FV(t,e);rt.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let o=e||{},i=o.contains?"":"^",s=o.contains?"":"$",a=`${i}(?:${t.output})${s}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let u=rt.toRegex(a,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=$D.fastpaths(t,e)),o.output||(o=$D(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=OV;FO.exports=rt});var $O=C((Cte,kO)=>{"use strict";kO.exports=OO()});var NO=C((_te,BO)=>{"use strict";var TO=require("util"),RO=fO(),Yr=$O(),TD=Xa(),PO=t=>t===""||t==="./",IO=t=>{let e=t.indexOf("{");return e>-1&&t.indexOf("}",e)>-1},je=(t,e,r)=>{e=[].concat(e),t=[].concat(t);let n=new Set,o=new Set,i=new Set,s=0,a=l=>{i.add(l.output),r&&r.onResult&&r.onResult(l)};for(let l=0;l<e.length;l++){let f=Yr(String(e[l]),{...r,onResult:a},!0),h=f.state.negated||f.state.negatedExtglob;h&&s++;for(let d of t){let m=f(d,!0);(h?!m.isMatch:m.isMatch)&&(h?n.add(m.output):(n.delete(m.output),o.add(m.output)))}}let c=(s===e.length?[...i]:[...o]).filter(l=>!n.has(l));if(r&&c.length===0){if(r.failglob===!0)throw new Error(`No matches found for "${e.join(", ")}"`);if(r.nonull===!0||r.nullglob===!0)return r.unescape?e.map(l=>l.replace(/\\/g,"")):e}return c};je.match=je;je.matcher=(t,e)=>Yr(t,e);je.isMatch=(t,e,r)=>Yr(e,r)(t);je.any=je.isMatch;je.not=(t,e,r={})=>{e=[].concat(e).map(String);let n=new Set,o=[],i=a=>{r.onResult&&r.onResult(a),o.push(a.output)},s=new Set(je(t,e,{...r,onResult:i}));for(let a of o)s.has(a)||n.add(a);return[...n]};je.contains=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${TO.inspect(t)}"`);if(Array.isArray(e))return e.some(n=>je.contains(t,n,r));if(typeof e=="string"){if(PO(t)||PO(e))return!1;if(t.includes(e)||t.startsWith("./")&&t.slice(2).includes(e))return!0}return je.isMatch(t,e,{...r,contains:!0})};je.matchKeys=(t,e,r)=>{if(!TD.isObject(t))throw new TypeError("Expected the first argument to be an object");let n=je(Object.keys(t),e,r),o={};for(let i of n)o[i]=t[i];return o};je.some=(t,e,r)=>{let n=[].concat(t);for(let o of[].concat(e)){let i=Yr(String(o),r);if(n.some(s=>i(s)))return!0}return!1};je.every=(t,e,r)=>{let n=[].concat(t);for(let o of[].concat(e)){let i=Yr(String(o),r);if(!n.every(s=>i(s)))return!1}return!0};je.all=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${TO.inspect(t)}"`);return[].concat(e).every(n=>Yr(n,r)(t))};je.capture=(t,e,r)=>{let n=TD.isWindows(r),i=Yr.makeRe(String(t),{...r,capture:!0}).exec(n?TD.toPosixSlashes(e):e);if(i)return i.slice(1).map(s=>s===void 0?"":s)};je.makeRe=(...t)=>Yr.makeRe(...t);je.scan=(...t)=>Yr.scan(...t);je.parse=(t,e)=>{let r=[];for(let n of[].concat(t||[]))for(let o of RO(String(n),e))r.push(Yr.parse(o,e));return r};je.braces=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return e&&e.nobrace===!0||!IO(t)?[t]:RO(t,e)};je.braceExpand=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return je.braces(t,{...e,expand:!0})};je.hasBraces=IO;BO.exports=je});var _k=C((Ere,yn)=>{var Pe=require("fs"),Of=require("os"),wt=require("path"),ak=require("crypto"),Zr={fs:Pe.constants,os:Of.constants},uk="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",pk=/XXXXXX/,QV=3,dk=(Zr.O_CREAT||Zr.fs.O_CREAT)|(Zr.O_EXCL||Zr.fs.O_EXCL)|(Zr.O_RDWR||Zr.fs.O_RDWR),ez=Of.platform()==="win32",tz=Zr.EBADF||Zr.os.errno.EBADF,rz=Zr.ENOENT||Zr.os.errno.ENOENT,hk=448,mk=384,nz="exit",ys=[],gk=Pe.rmdirSync.bind(Pe),Dk=!1;function oz(t,e){return Pe.rm(t,{recursive:!0},e)}function yk(t){return Pe.rmSync(t,{recursive:!0})}function MD(t,e){let r=bs(t,e),n=r[0],o=r[1];hz(n,function(i,s){if(i)return o(i);let a=s.tries;(function u(){try{let c=wk(s);Pe.stat(c,function(l){if(!l)return a-- >0?u():o(new Error("Could not get a unique tmp filename, max tries reached "+c));o(null,c)})}catch(c){o(c)}})()})}function qD(t){let e=bs(t),r=e[0],n=mz(r),o=n.tries;do{let i=wk(n);try{Pe.statSync(i)}catch{return i}}while(o-- >0);throw new Error("Could not get a unique tmp filename, max tries reached")}function iz(t,e){let r=bs(t,e),n=r[0],o=r[1];MD(n,function(s,a){if(s)return o(s);Pe.open(a,dk,n.mode||mk,function(c,l){if(c)return o(c);if(n.discardDescriptor)return Pe.close(l,function(h){return o(h,a,void 0,jD(a,-1,n,!1))});{let f=n.discardDescriptor||n.detachDescriptor;o(null,a,l,jD(a,f?-1:l,n,!1))}})})}function sz(t){let e=bs(t),r=e[0],n=r.discardDescriptor||r.detachDescriptor,o=qD(r),i=Pe.openSync(o,dk,r.mode||mk);return r.discardDescriptor&&(Pe.closeSync(i),i=void 0),{name:o,fd:i,removeCallback:jD(o,n?-1:i,r,!0)}}function az(t,e){let r=bs(t,e),n=r[0],o=r[1];MD(n,function(s,a){if(s)return o(s);Pe.mkdir(a,n.mode||hk,function(c){if(c)return o(c);o(null,a,bk(a,n,!1))})})}function uz(t){let e=bs(t),r=e[0],n=qD(r);return Pe.mkdirSync(n,r.mode||hk),{name:n,removeCallback:bk(n,r,!0)}}function cz(t,e){let r=function(n){if(n&&!UD(n))return e(n);e()};0<=t[0]?Pe.close(t[0],function(){Pe.unlink(t[1],r)}):Pe.unlink(t[1],r)}function lz(t){let e=null;try{0<=t[0]&&Pe.closeSync(t[0])}catch(r){if(!gz(r)&&!UD(r))throw r}finally{try{Pe.unlinkSync(t[1])}catch(r){UD(r)||(e=r)}}if(e!==null)throw e}function jD(t,e,r,n){let o=Ff(lz,[e,t],n),i=Ff(cz,[e,t],n,o);return r.keep||ys.unshift(o),n?o:i}function bk(t,e,r){let n=e.unsafeCleanup?oz:Pe.rmdir.bind(Pe),o=e.unsafeCleanup?yk:gk,i=Ff(o,t,r),s=Ff(n,t,r,i);return e.keep||ys.unshift(i),r?i:s}function Ff(t,e,r,n){let o=!1;return function i(s){if(!o){let a=n||i,u=ys.indexOf(a);return u>=0&&ys.splice(u,1),o=!0,r||t===gk||t===yk?t(e):t(e,s||function(){})}}}function fz(){if(Dk)for(;ys.length;)try{ys[0]()}catch{}}function ck(t){let e=[],r=null;try{r=ak.randomBytes(t)}catch{r=ak.pseudoRandomBytes(t)}for(let n=0;n<t;n++)e.push(uk[r[n]%uk.length]);return e.join("")}function or(t){return typeof t>"u"}function bs(t,e){if(typeof t=="function")return[{},t];if(or(t))return[{},e];let r={};for(let n of Object.getOwnPropertyNames(t))r[n]=t[n];return[r,e]}function pz(t,e,r){let n=wt.isAbsolute(t)?t:wt.join(e,t);Pe.stat(n,function(o){o?Pe.realpath(wt.dirname(n),function(i,s){if(i)return r(i);r(null,wt.join(s,wt.basename(n)))}):Pe.realpath(n,r)})}function dz(t,e){let r=wt.isAbsolute(t)?t:wt.join(e,t);try{return Pe.statSync(r),Pe.realpathSync(r)}catch{let o=Pe.realpathSync(wt.dirname(r));return wt.join(o,wt.basename(r))}}function wk(t){let e=t.tmpdir;if(!or(t.name))return wt.join(e,t.dir,t.name);if(!or(t.template))return wt.join(e,t.dir,t.template).replace(pk,ck(6));let r=[t.prefix?t.prefix:"tmp","-",process.pid,"-",ck(12),t.postfix?"-"+t.postfix:""].join("");return wt.join(e,t.dir,r)}function vk(t){if(!or(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(!or(t.template)&&!t.template.match(pk))throw new Error(`Invalid template, found "${t.template}".`);if(!or(t.tries)&&isNaN(t.tries)||t.tries<0)throw new Error(`Invalid tries, found "${t.tries}".`);t.tries=or(t.name)?t.tries||QV:1,t.keep=!!t.keep,t.detachDescriptor=!!t.detachDescriptor,t.discardDescriptor=!!t.discardDescriptor,t.unsafeCleanup=!!t.unsafeCleanup,t.prefix=or(t.prefix)?"":t.prefix,t.postfix=or(t.postfix)?"":t.postfix}function lk(t,e,r,n){if(or(e))return n(null);pz(e,r,function(o,i){if(o)return n(o);let s=wt.relative(r,i);if(!i.startsWith(r))return n(new Error(`${t} option must be relative to "${r}", found "${s}".`));n(null,s)})}function fk(t,e,r){if(or(e))return;let n=dz(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 hz(t,e){yz(t,function(r,n){if(r)return e(r);t.tmpdir=n;try{vk(t,n)}catch(o){return e(o)}lk("dir",t.dir,n,function(o,i){if(o)return e(o);t.dir=or(i)?"":i,lk("template",t.template,n,function(s,a){if(s)return e(s);t.template=a,e(null,t)})})})}function mz(t){let e=t.tmpdir=Ck(t);vk(t,e);let r=fk("dir",t.dir,e);return t.dir=or(r)?"":r,t.template=fk("template",t.template,e),t}function gz(t){return Ek(t,-tz,"EBADF")}function UD(t){return Ek(t,-rz,"ENOENT")}function Ek(t,e,r){return ez?t.code===r:t.code===r&&t.errno===e}function Dz(){Dk=!0}function yz(t,e){return Pe.realpath(t&&t.tmpdir||Of.tmpdir(),e)}function Ck(t){return Pe.realpathSync(t&&t.tmpdir||Of.tmpdir())}process.addListener(nz,fz);Object.defineProperty(yn.exports,"tmpdir",{enumerable:!0,configurable:!1,get:function(){return Ck()}});yn.exports.dir=az;yn.exports.dirSync=uz;yn.exports.file=iz;yn.exports.fileSync=sz;yn.exports.tmpName=MD;yn.exports.tmpNameSync=qD;yn.exports.setGracefulCleanup=Dz});var Pf=require("node:process");var ly=be(cy(),1),{program:gt,createCommand:Zz,createArgument:Qz,createOption:eG,CommanderError:tG,InvalidArgumentError:rG,InvalidOptionArgumentError:nG,Command:oG,Argument:iG,Option:sG,Help:aG}=ly.default;var _r={name:"@capgo/cli",version:"7.18.23",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/CLI#readme",repository:{type:"git",url:"git+https://github.com/Cap-go/CLI.git"},bugs:{url:"https://github.com/Cap-go/CLI/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli","sdk"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js",require:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && node build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"npx --yes supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",lint:'eslint "src/**/*.ts" --fix',"check-posix-paths":"node test/check-posix-paths.js","generate-docs":"node dist/index.js generate-docs README.md"},devDependencies:{"@antfu/eslint-config":"^6.1.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.4","@capacitor/cli":"^7.4.4","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^0.11.0","@sauber/table":"npm:@jsr/sauber__table","@std/semver":"npm:@jsr/std__semver@1.0.6","@supabase/supabase-js":"^2.79.0","@types/adm-zip":"^0.5.7","@types/node":"^24.9.1","@types/prettyjson":"^0.0.33","@types/tmp":"^0.2.6","@vercel/ncc":"^0.38.4","adm-zip":"^0.5.16","ci-info":"^4.3.1",commander:"^14.0.2",esbuild:"^0.25.11",eslint:"^9.38.0","git-format-staged":"3.1.1",husky:"^9.1.7","is-wsl":"^3.1.0",open:"^10.1.2",prettyjson:"^1.2.5",tmp:"^0.2.5","tus-js-client":"^4.3.1",typescript:"^5.9.3"}};var ls=require("node:fs");var vt=be(Qf(),1),Wo=require("node:process"),vn=be(require("node:readline"),1),op=be(require("node:readline"),1),vy=require("node:stream"),Ey=be(tp(),1);function c$({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 l$=c$();function Cy(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(l$,"")}function _y(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var xy={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,s=o;return 55296<=o&&o<=56319&&56320<=i&&i<=57343&&(o&=1023,i&=1023,s=o<<10|i,s+=65536),s==12288||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":s==8361||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||s==172||s==175||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":s==161||s==164||167<=s&&s<=168||s==170||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||s==198||s==208||215<=s&&s<=216||222<=s&&s<=225||s==230||232<=s&&s<=234||236<=s&&s<=237||s==240||242<=s&&s<=243||247<=s&&s<=250||s==252||s==254||s==257||s==273||s==275||s==283||294<=s&&s<=295||s==299||305<=s&&s<=307||s==312||319<=s&&s<=322||s==324||328<=s&&s<=331||s==333||338<=s&&s<=339||358<=s&&s<=359||s==363||s==462||s==464||s==466||s==468||s==470||s==472||s==474||s==476||s==593||s==609||s==708||s==711||713<=s&&s<=715||s==717||s==720||728<=s&&s<=731||s==733||s==735||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||s==1025||1040<=s&&s<=1103||s==1105||s==8208||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||s==8240||8242<=s&&s<=8243||s==8245||s==8251||s==8254||s==8308||s==8319||8321<=s&&s<=8324||s==8364||s==8451||s==8453||s==8457||s==8467||s==8470||8481<=s&&s<=8482||s==8486||s==8491||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||s==8585||8592<=s&&s<=8601||8632<=s&&s<=8633||s==8658||s==8660||s==8679||s==8704||8706<=s&&s<=8707||8711<=s&&s<=8712||s==8715||s==8719||s==8721||s==8725||s==8730||8733<=s&&s<=8736||s==8739||s==8741||8743<=s&&s<=8748||s==8750||8756<=s&&s<=8759||8764<=s&&s<=8765||s==8776||s==8780||s==8786||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||s==8853||s==8857||s==8869||s==8895||s==8978||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||s==9675||9678<=s&&s<=9681||9698<=s&&s<=9701||s==9711||9733<=s&&s<=9734||s==9737||9742<=s&&s<=9743||9748<=s&&s<=9749||s==9756||s==9758||s==9792||s==9794||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||s==9839||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||s==9955||9960<=s&&s<=9983||s==10045||s==10071||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||s==65533||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=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,s=0;s<o.length;s++)i=i+this.characterLength(o[s]);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 s="",a=0,u=r(n),c=0;c<u.length;c++){var l=u[c],f=e.length(l);if(a>=o-(f==2?1:0))if(a+f<=i)s+=l;else break;a+=f}return s}})(xy);var f$=xy.exports,p$=_y(f$),d$=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},h$=_y(d$);function Cs(t,e={}){if(typeof t!="string"||t.length===0||(e={ambiguousIsNarrow:!0,...e},t=Cy(t),t.length===0))return 0;t=t.replace(h$()," ");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(p$.eastAsianWidth(o)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}var rp=10,hy=(t=0)=>e=>`\x1B[${e+t}m`,my=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,gy=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`,Ue={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(Ue.modifier);var m$=Object.keys(Ue.color),g$=Object.keys(Ue.bgColor);[...m$,...g$];function D$(){let t=new Map;for(let[e,r]of Object.entries(Ue)){for(let[n,o]of Object.entries(r))Ue[n]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},r[n]=Ue[n],t.set(o[0],o[1]);Object.defineProperty(Ue,e,{value:r,enumerable:!1})}return Object.defineProperty(Ue,"codes",{value:t,enumerable:!1}),Ue.color.close="\x1B[39m",Ue.bgColor.close="\x1B[49m",Ue.color.ansi=hy(),Ue.color.ansi256=my(),Ue.color.ansi16m=gy(),Ue.bgColor.ansi=hy(rp),Ue.bgColor.ansi256=my(rp),Ue.bgColor.ansi16m=gy(rp),Object.defineProperties(Ue,{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=>Ue.rgbToAnsi256(...Ue.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 a=e%36;r=Math.floor(e/36)/5,n=Math.floor(a/6)/5,o=a%6/5}let i=Math.max(r,n,o)*2;if(i===0)return 30;let s=30+(Math.round(o)<<2|Math.round(n)<<1|Math.round(r));return i===2&&(s+=60),s},enumerable:!1},rgbToAnsi:{value:(e,r,n)=>Ue.ansi256ToAnsi(Ue.rgbToAnsi256(e,r,n)),enumerable:!1},hexToAnsi:{value:e=>Ue.ansi256ToAnsi(Ue.hexToAnsi256(e)),enumerable:!1}}),Ue}var y$=D$(),du=new Set(["\x1B","\x9B"]),b$=39,sp="\x07",Sy="[",w$="]",Ay="m",ap=`${w$}8;;`,Dy=t=>`${du.values().next().value}${Sy}${t}${Ay}`,yy=t=>`${du.values().next().value}${ap}${t}${sp}`,v$=t=>t.split(" ").map(e=>Cs(e)),np=(t,e,r)=>{let n=[...e],o=!1,i=!1,s=Cs(Cy(t[t.length-1]));for(let[a,u]of n.entries()){let c=Cs(u);if(s+c<=r?t[t.length-1]+=u:(t.push(u),s=0),du.has(u)&&(o=!0,i=n.slice(a+1).join("").startsWith(ap)),o){i?u===sp&&(o=!1,i=!1):u===Ay&&(o=!1);continue}s+=c,s===r&&a<n.length-1&&(t.push(""),s=0)}!s&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},E$=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("")},C$=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",o,i,s=v$(t),a=[""];for(let[c,l]of t.split(" ").entries()){r.trim!==!1&&(a[a.length-1]=a[a.length-1].trimStart());let f=Cs(a[a.length-1]);if(c!==0&&(f>=e&&(r.wordWrap===!1||r.trim===!1)&&(a.push(""),f=0),(f>0||r.trim===!1)&&(a[a.length-1]+=" ",f++)),r.hard&&s[c]>e){let h=e-f,d=1+Math.floor((s[c]-h-1)/e);Math.floor((s[c]-1)/e)<d&&a.push(""),np(a,l,e);continue}if(f+s[c]>e&&f>0&&s[c]>0){if(r.wordWrap===!1&&f<e){np(a,l,e);continue}a.push("")}if(f+s[c]>e&&r.wordWrap===!1){np(a,l,e);continue}a[a.length-1]+=l}r.trim!==!1&&(a=a.map(c=>E$(c)));let u=[...a.join(`
105
- `)];for(let[c,l]of u.entries()){if(n+=l,du.has(l)){let{groups:h}=new RegExp(`(?:\\${Sy}(?<code>\\d+)m|\\${ap}(?<uri>.*)${sp})`).exec(u.slice(c).join(""))||{groups:{}};if(h.code!==void 0){let d=Number.parseFloat(h.code);o=d===b$?void 0:d}else h.uri!==void 0&&(i=h.uri.length===0?void 0:h.uri)}let f=y$.codes.get(Number(o));u[c+1]===`
106
- `?(i&&(n+=yy("")),o&&f&&(n+=Dy(f))):l===`
107
- `&&(o&&f&&(n+=Dy(o)),i&&(n+=yy(i)))}return n};function by(t,e,r){return String(t).normalize().replace(/\r\n/g,`
102
+ `}});function l5(){try{return Tm.default.statSync("/.dockerenv"),!0}catch{return!1}}function f5(){try{return Tm.default.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function Im(){return Pm===void 0&&(Pm=l5()||f5()),Pm}var Tm,Pm,a1=et(()=>{Tm=ge(require("node:fs"),1)});function Mi(){return Rm===void 0&&(Rm=p5()||Im()),Rm}var s1,Rm,p5,Bm=et(()=>{s1=ge(require("node:fs"),1);a1();p5=()=>{try{return s1.default.statSync("/run/.containerenv"),!0}catch{return!1}}});var jm,c1,l1,u1,kn,Nm=et(()=>{jm=ge(require("node:process"),1),c1=ge(require("node:os"),1),l1=ge(require("node:fs"),1);Bm();u1=()=>{if(jm.default.platform!=="linux")return!1;if(c1.default.release().toLowerCase().includes("microsoft"))return!Mi();try{return l1.default.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!Mi():!1}catch{return!1}},kn=jm.default.env.__IS_WSL_TEST__?u1:u1()});var Lm,gs,d5,h5,Um,f1=et(()=>{Lm=ge(require("node:process"),1),gs=ge(require("node:fs/promises"),1);Nm();Nm();d5=(()=>{let t="/mnt/",e;return async function(){if(e)return e;let r="/etc/wsl.conf",n=!1;try{await gs.default.access(r,gs.constants.F_OK),n=!0}catch{}if(!n)return t;let o=await gs.default.readFile(r,{encoding:"utf8"}),i=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(o);return i?(e=i.groups.mountPoint.trim(),e=e.endsWith("/")?e:`${e}/`,e):t}})(),h5=async()=>`${await d5()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,Um=async()=>kn?h5():`${Lm.default.env.SYSTEMROOT||Lm.default.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`});function $n(t,e,r){let n=o=>Object.defineProperty(t,e,{value:o,enumerable:!0,writable:!0});return Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get(){let o=r();return n(o),o},set(o){n(o)}}),t}var p1=et(()=>{});async function Mm(){if(h1.default.platform!=="darwin")throw new Error("macOS only");let{stdout:t}=await m5("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]);return/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(t)?.groups.id??"com.apple.Safari"}var d1,h1,m1,m5,g1=et(()=>{d1=require("node:util"),h1=ge(require("node:process"),1),m1=require("node:child_process"),m5=(0,d1.promisify)(m1.execFile)});async function b1(t,{humanReadableOutput:e=!0,signal:r}={}){if(D1.default.platform!=="darwin")throw new Error("macOS only");let n=e?[]:["-ss"],o={};r&&(o.signal=r);let{stdout:i}=await g5("osascript",["-e",t,n],o);return i.trim()}var D1,y1,qm,g5,v1=et(()=>{D1=ge(require("node:process"),1),y1=require("node:util"),qm=require("node:child_process"),g5=(0,y1.promisify)(qm.execFile)});async function Hm(t){return b1(`tell application "Finder" to set app_path to application file id "${t}" as string
103
+ tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}var w1=et(()=>{v1()});async function Vm(t=D5){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 hl(`Cannot find Windows browser in stdout: ${JSON.stringify(e)}`);let{id:n}=r.groups,o=y5[n];if(!o)throw new hl(`Unknown browser ID: ${n}`);return o}var C1,E1,D5,y5,hl,_1=et(()=>{C1=require("node:util"),E1=require("node:child_process"),D5=(0,C1.promisify)(E1.execFile),y5={AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},MSEdgeDHTML:{name:"Edge",id:"com.microsoft.edge"},MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"}},hl=class extends Error{}});async function zm(){if(ml.default.platform==="darwin"){let t=await Mm();return{name:await Hm(t),id:t}}if(ml.default.platform==="linux"){let{stdout:t}=await b5("xdg-mime",["query","default","x-scheme-handler/http"]),e=t.trim();return{name:v5(e.replace(/.desktop$/,"").replace("-"," ")),id:e}}if(ml.default.platform==="win32")return Vm();throw new Error("Only macOS, Linux, and Windows are supported")}var x1,ml,S1,b5,v5,F1=et(()=>{x1=require("node:util"),ml=ge(require("node:process"),1),S1=require("node:child_process");g1();w1();_1();b5=(0,x1.promisify)(S1.execFile),v5=t=>t.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase())});var Xm={};qr(Xm,{apps:()=>Pn,default:()=>x5,openApp:()=>_5});async function C5(){let t=await Um(),e=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,r=Km.Buffer.from(e,"utf16le").toString("base64"),{stdout:n}=await w5(t,["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand",r],{encoding:"utf8"}),o=n.trim(),i={ChromeHTML:"com.google.chrome",BraveHTML:"com.brave.Browser",MSEdgeHTM:"com.microsoft.edge",FirefoxURL:"org.mozilla.firefox"};return i[o]?{id:i[o]}:{}}function $1(t){if(typeof t=="string"||Array.isArray(t))return t;let{[O1]:e}=t;if(!e)throw new Error(`${O1} is not supported`);return e}function Dl({[qi]:t},{wsl:e}){if(e&&kn)return $1(e);if(!t)throw new Error(`${qi} is not supported`);return $1(t)}var Wm,Km,Ym,P1,T1,Jm,gl,S5,w5,Gm,A1,qi,O1,k1,Ds,E5,_5,Pn,x5,Zm=et(()=>{Wm=ge(require("node:process"),1),Km=require("node:buffer"),Ym=ge(require("node:path"),1),P1=require("node:url"),T1=require("node:util"),Jm=ge(require("node:child_process"),1),gl=ge(require("node:fs/promises"),1);f1();p1();F1();Bm();S5={},w5=(0,T1.promisify)(Jm.default.execFile),Gm=Ym.default.dirname((0,P1.fileURLToPath)(S5.url)),A1=Ym.default.join(Gm,"xdg-open"),{platform:qi,arch:O1}=Wm.default;k1=async(t,e)=>{let r;for(let n of t)try{return await e(n)}catch(o){r=o}throw r},Ds=async t=>{if(t={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...t},Array.isArray(t.app))return k1(t.app,s=>Ds({...t,app:s}));let{name:e,arguments:r=[]}=t.app??{};if(r=[...r],Array.isArray(e))return k1(e,s=>Ds({...t,app:{name:s,arguments:r}}));if(e==="browser"||e==="browserPrivate"){let s={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.Browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge"},u={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},c=kn?await C5():await zm();if(c.id in s){let l=s[c.id];return e==="browserPrivate"&&r.push(u[l]),Ds({...t,app:{name:Pn[l],arguments:r}})}throw new Error(`${c.name} is not supported as a default browser`)}let n,o=[],i={};if(qi==="darwin")n="open",t.wait&&o.push("--wait-apps"),t.background&&o.push("--background"),t.newInstance&&o.push("--new"),e&&o.push("-a",e);else if(qi==="win32"||kn&&!Mi()&&!e){n=await Um(),o.push("-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"),kn||(i.windowsVerbatimArguments=!0);let s=["Start"];t.wait&&s.push("-Wait"),e?(s.push(`"\`"${e}\`""`),t.target&&r.push(t.target)):t.target&&s.push(`"${t.target}"`),r.length>0&&(r=r.map(u=>`"\`"${u}\`""`),s.push("-ArgumentList",r.join(","))),t.target=Km.Buffer.from(s.join(" "),"utf16le").toString("base64")}else{if(e)n=e;else{let s=!Gm||Gm==="/",u=!1;try{await gl.default.access(A1,gl.constants.X_OK),u=!0}catch{}n=Wm.default.versions.electron??(qi==="android"||s||!u)?"xdg-open":A1}r.length>0&&o.push(...r),t.wait||(i.stdio="ignore",i.detached=!0)}qi==="darwin"&&r.length>0&&o.push("--args",...r),t.target&&o.push(t.target);let a=Jm.default.spawn(n,o,i);return t.wait?new Promise((s,u)=>{a.once("error",u),a.once("close",c=>{if(!t.allowNonzeroExitCode&&c>0){u(new Error(`Exited with code ${c}`));return}s(a)})}):(a.unref(),a)},E5=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a `target`");return Ds({...e,target:t})},_5=(t,e)=>{if(typeof t!="string"&&!Array.isArray(t))throw new TypeError("Expected a valid `name`");let{arguments:r=[]}=e??{};if(r!=null&&!Array.isArray(r))throw new TypeError("Expected `appArguments` as Array type");return Ds({...e,app:{name:t,arguments:r}})};Pn={};$n(Pn,"chrome",()=>Dl({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));$n(Pn,"brave",()=>Dl({darwin:"brave browser",win32:"brave",linux:["brave-browser","brave"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",x64:["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe","/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]}}));$n(Pn,"firefox",()=>Dl({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));$n(Pn,"edge",()=>Dl({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));$n(Pn,"browser",()=>"browser");$n(Pn,"browserPrivate",()=>"browserPrivate");x5=E5});var Ul=x(lr=>{"use strict";lr.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;lr.find=(t,e)=>t.nodes.find(r=>r.type===e);lr.exceedsLimit=(t,e,r=1,n)=>n===!1||!lr.isInteger(t)||!lr.isInteger(e)?!1:(Number(e)-Number(t))/Number(r)>=n;lr.escapeNode=(t,e=0,r)=>{let n=t.nodes[e];n&&(r&&n.type===r||n.type==="open"||n.type==="close")&&n.escaped!==!0&&(n.value="\\"+n.value,n.escaped=!0)};lr.encloseBrace=t=>t.type!=="brace"?!1:t.commas>>0+t.ranges>>0===0?(t.invalid=!0,!0):!1;lr.isInvalidBrace=t=>t.type!=="brace"?!1:t.invalid===!0||t.dollar?!0:t.commas>>0+t.ranges>>0===0||t.open!==!0||t.close!==!0?(t.invalid=!0,!0):!1;lr.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;lr.reduce=t=>t.reduce((e,r)=>(r.type==="text"&&e.push(r.value),r.type==="range"&&(r.type="text"),e),[]);lr.flatten=(...t)=>{let e=[],r=n=>{for(let o=0;o<n.length;o++){let i=n[o];if(Array.isArray(i)){r(i);continue}i!==void 0&&e.push(i)}return e};return r(t),e}});var Ml=x((DY,W2)=>{"use strict";var G2=Ul();W2.exports=(t,e={})=>{let r=(n,o={})=>{let i=e.escapeInvalid&&G2.isInvalidBrace(o),a=n.invalid===!0&&e.escapeInvalid===!0,s="";if(n.value)return(i||a)&&G2.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 Y2=x((yY,K2)=>{"use strict";K2.exports=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}});var oS=x((bY,nS)=>{"use strict";var J2=Y2(),Po=(t,e,r)=>{if(J2(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(J2(e)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let n={relaxZeros:!0,...r};typeof n.strictZeros=="boolean"&&(n.relaxZeros=n.strictZeros===!1);let o=String(n.relaxZeros),i=String(n.shorthand),a=String(n.capture),s=String(n.wrap),u=t+":"+e+"="+o+i+a+s;if(Po.cache.hasOwnProperty(u))return Po.cache[u].result;let c=Math.min(t,e),l=Math.max(t,e);if(Math.abs(c-l)===1){let b=t+"|"+e;return n.capture?`(${b})`:n.wrap===!1?b:`(?:${b})`}let f=rS(t)||rS(e),d={min:t,max:e,a:c,b:l},h=[],m=[];if(f&&(d.isPadded=f,d.maxLen=String(d.max).length),c<0){let b=l<0?Math.abs(l):1;m=X2(b,Math.abs(c),d,n),c=d.a=0}return l>=0&&(h=X2(c,l,d,n)),d.negatives=m,d.positives=h,d.result=pU(m,h,n),n.capture===!0?d.result=`(${d.result})`:n.wrap!==!1&&h.length+m.length>1&&(d.result=`(?:${d.result})`),Po.cache[u]=d,d.result};function pU(t,e,r){let n=wg(t,e,"-",!1,r)||[],o=wg(e,t,"",!1,r)||[],i=wg(t,e,"-?",!0,r)||[];return n.concat(i).concat(o).join("|")}function dU(t,e){let r=1,n=1,o=Q2(t,r),i=new Set([e]);for(;t<=o&&o<=e;)i.add(o),r+=1,o=Q2(t,r);for(o=eS(e+1,n)-1;t<o&&o<=e;)i.add(o),n+=1,o=eS(e+1,n)-1;return i=[...i],i.sort(gU),i}function hU(t,e,r){if(t===e)return{pattern:t,count:[],digits:0};let n=mU(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+=DU(u,c,r):a++}return a&&(i+=r.shorthand===!0?"\\d":"[0-9]"),{pattern:i,count:[a],digits:o}}function X2(t,e,r,n){let o=dU(t,e),i=[],a=t,s;for(let u=0;u<o.length;u++){let c=o[u],l=hU(String(a),String(c),n),f="";if(!r.isPadded&&s&&s.pattern===l.pattern){s.count.length>1&&s.count.pop(),s.count.push(l.count[0]),s.string=s.pattern+tS(s.count),a=c+1;continue}r.isPadded&&(f=yU(c,r,n)),l.string=f+l.pattern+tS(l.count),i.push(l),a=c+1,s=l}return i}function wg(t,e,r,n,o){let i=[];for(let a of t){let{string:s}=a;!n&&!Z2(e,"string",s)&&i.push(r+s),n&&Z2(e,"string",s)&&i.push(r+s)}return i}function mU(t,e){let r=[];for(let n=0;n<t.length;n++)r.push([t[n],e[n]]);return r}function gU(t,e){return t>e?1:e>t?-1:0}function Z2(t,e,r){return t.some(n=>n[e]===r)}function Q2(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function eS(t,e){return t-t%Math.pow(10,e)}function tS(t){let[e=0,r=""]=t;return r||e>1?`{${e+(r?","+r:"")}}`:""}function DU(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function rS(t){return/^-?(0+)\d/.test(t)}function yU(t,e,r){if(!e.isPadded)return t;let n=Math.abs(e.maxLen-String(t).length),o=r.relaxZeros!==!1;switch(n){case 0:return"";case 1:return o?"0?":"0";case 2:return o?"0{0,2}":"00";default:return o?`0{0,${n}}`:`0{${n}}`}}Po.cache={};Po.clearCache=()=>Po.cache={};nS.exports=Po});var _g=x((vY,fS)=>{"use strict";var bU=require("util"),aS=oS(),iS=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),vU=t=>e=>t===!0?Number(e):String(e),Cg=t=>typeof t=="number"||typeof t=="string"&&t!=="",Fs=t=>Number.isInteger(+t),Eg=t=>{let e=`${t}`,r=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++r]==="0";);return r>0},wU=(t,e,r)=>typeof t=="string"||typeof e=="string"?!0:r.stringify===!0,CU=(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},Hl=(t,e)=>{let r=t[0]==="-"?"-":"";for(r&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return r?"-"+t:t},EU=(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=>Hl(String(s),r)).join("|")),t.negatives.length&&(i=`-(${n}${t.negatives.map(s=>Hl(String(s),r)).join("|")})`),o&&i?a=`${o}|${i}`:a=o||i,e.wrap?`(${n}${a})`:a},sS=(t,e,r,n)=>{if(r)return aS(t,e,{wrap:!1,...n});let o=String.fromCharCode(t);if(t===e)return o;let i=String.fromCharCode(e);return`[${o}-${i}]`},uS=(t,e,r)=>{if(Array.isArray(t)){let n=r.wrap===!0,o=r.capture?"":"?:";return n?`(${o}${t.join("|")})`:t.join("|")}return aS(t,e,r)},cS=(...t)=>new RangeError("Invalid range arguments: "+bU.inspect(...t)),lS=(t,e,r)=>{if(r.strictRanges===!0)throw cS([t,e]);return[]},_U=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return[]},xU=(t,e,r=1,n={})=>{let o=Number(t),i=Number(e);if(!Number.isInteger(o)||!Number.isInteger(i)){if(n.strictRanges===!0)throw cS([t,e]);return[]}o===0&&(o=0),i===0&&(i=0);let a=o>i,s=String(t),u=String(e),c=String(r);r=Math.max(Math.abs(r),1);let l=Eg(s)||Eg(u)||Eg(c),f=l?Math.max(s.length,u.length,c.length):0,d=l===!1&&wU(t,e,n)===!1,h=n.transform||vU(d);if(n.toRegex&&r===1)return sS(Hl(t,f),Hl(e,f),!0,n);let m={negatives:[],positives:[]},b=E=>m[E<0?"negatives":"positives"].push(Math.abs(E)),D=[],C=0;for(;a?o>=i:o<=i;)n.toRegex===!0&&r>1?b(o):D.push(CU(h(o,C),f,d)),o=a?o-r:o+r,C++;return n.toRegex===!0?r>1?EU(m,n,f):uS(D,null,{wrap:!1,...n}):D},SU=(t,e,r=1,n={})=>{if(!Fs(t)&&t.length>1||!Fs(e)&&e.length>1)return lS(t,e,n);let o=n.transform||(d=>String.fromCharCode(d)),i=`${t}`.charCodeAt(0),a=`${e}`.charCodeAt(0),s=i>a,u=Math.min(i,a),c=Math.max(i,a);if(n.toRegex&&r===1)return sS(u,c,!1,n);let l=[],f=0;for(;s?i>=a:i<=a;)l.push(o(i,f)),i=s?i-r:i+r,f++;return n.toRegex===!0?uS(l,null,{wrap:!1,options:n}):l},ql=(t,e,r,n={})=>{if(e==null&&Cg(t))return[t];if(!Cg(t)||!Cg(e))return lS(t,e,n);if(typeof r=="function")return ql(t,e,1,{transform:r});if(iS(r))return ql(t,e,0,r);let o={...n};return o.capture===!0&&(o.wrap=!0),r=r||o.step||1,Fs(r)?Fs(t)&&Fs(e)?xU(t,e,r,o):SU(t,e,Math.max(Math.abs(r),1),o):r!=null&&!iS(r)?_U(r,o):ql(t,e,1,r)};fS.exports=ql});var hS=x((wY,dS)=>{"use strict";var FU=_g(),pS=Ul(),AU=(t,e={})=>{let r=(n,o={})=>{let i=pS.isInvalidBrace(o),a=n.invalid===!0&&e.escapeInvalid===!0,s=i===!0||a===!0,u=e.escapeInvalid===!0?"\\":"",c="";if(n.isOpen===!0)return u+n.value;if(n.isClose===!0)return console.log("node.isClose",u,n.value),u+n.value;if(n.type==="open")return s?u+n.value:"(";if(n.type==="close")return s?u+n.value:")";if(n.type==="comma")return n.prev.type==="comma"?"":s?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let l=pS.reduce(n.nodes),f=FU(...l,{...e,wrap:!1,toRegex:!0,strictZeros:!0});if(f.length!==0)return l.length>1&&f.length>1?`(${f})`:f}if(n.nodes)for(let l of n.nodes)c+=r(l,n);return c};return r(t)};dS.exports=AU});var DS=x((CY,gS)=>{"use strict";var OU=_g(),mS=Ml(),ra=Ul(),To=(t="",e="",r=!1)=>{let n=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return r?ra.flatten(e).map(o=>`{${o}}`):e;for(let o of t)if(Array.isArray(o))for(let i of o)n.push(To(i,e,r));else for(let i of e)r===!0&&typeof i=="string"&&(i=`{${i}}`),n.push(Array.isArray(i)?To(o,i,r):o+i);return ra.flatten(n)},kU=(t,e={})=>{let r=e.rangeLimit===void 0?1e3:e.rangeLimit,n=(o,i={})=>{o.queue=[];let a=i,s=i.queue;for(;a.type!=="brace"&&a.type!=="root"&&a.parent;)a=a.parent,s=a.queue;if(o.invalid||o.dollar){s.push(To(s.pop(),mS(o,e)));return}if(o.type==="brace"&&o.invalid!==!0&&o.nodes.length===2){s.push(To(s.pop(),["{}"]));return}if(o.nodes&&o.ranges>0){let f=ra.reduce(o.nodes);if(ra.exceedsLimit(...f,e.step,r))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let d=OU(...f,e);d.length===0&&(d=mS(o,e)),s.push(To(s.pop(),d)),o.nodes=[];return}let u=ra.encloseBrace(o),c=o.queue,l=o;for(;l.type!=="brace"&&l.type!=="root"&&l.parent;)l=l.parent,c=l.queue;for(let f=0;f<o.nodes.length;f++){let d=o.nodes[f];if(d.type==="comma"&&o.type==="brace"){f===1&&c.push(""),c.push("");continue}if(d.type==="close"){s.push(To(s.pop(),c,u));continue}if(d.value&&d.type!=="open"){c.push(To(c.pop(),d.value));continue}d.nodes&&n(d,o)}return c};return ra.flatten(n(t))};gS.exports=kU});var bS=x((EY,yS)=>{"use strict";yS.exports={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
104
+ `,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var _S=x((_Y,ES)=>{"use strict";var $U=Ml(),{MAX_LENGTH:vS,CHAR_BACKSLASH:xg,CHAR_BACKTICK:PU,CHAR_COMMA:TU,CHAR_DOT:IU,CHAR_LEFT_PARENTHESES:RU,CHAR_RIGHT_PARENTHESES:BU,CHAR_LEFT_CURLY_BRACE:jU,CHAR_RIGHT_CURLY_BRACE:NU,CHAR_LEFT_SQUARE_BRACKET:wS,CHAR_RIGHT_SQUARE_BRACKET:CS,CHAR_DOUBLE_QUOTE:LU,CHAR_SINGLE_QUOTE:UU,CHAR_NO_BREAK_SPACE:MU,CHAR_ZERO_WIDTH_NOBREAK_SPACE:qU}=bS(),HU=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let r=e||{},n=typeof r.maxLength=="number"?Math.min(vS,r.maxLength):vS;if(t.length>n)throw new SyntaxError(`Input length (${t.length}), exceeds max characters (${n})`);let o={type:"root",input:t,nodes:[]},i=[o],a=o,s=o,u=0,c=t.length,l=0,f=0,d,h=()=>t[l++],m=b=>{if(b.type==="text"&&s.type==="dot"&&(s.type="text"),s&&s.type==="text"&&b.type==="text"){s.value+=b.value;return}return a.nodes.push(b),b.parent=a,b.prev=s,s=b,b};for(m({type:"bos"});l<c;)if(a=i[i.length-1],d=h(),!(d===qU||d===MU)){if(d===xg){m({type:"text",value:(e.keepEscaping?d:"")+h()});continue}if(d===CS){m({type:"text",value:"\\"+d});continue}if(d===wS){u++;let b;for(;l<c&&(b=h());){if(d+=b,b===wS){u++;continue}if(b===xg){d+=h();continue}if(b===CS&&(u--,u===0))break}m({type:"text",value:d});continue}if(d===RU){a=m({type:"paren",nodes:[]}),i.push(a),m({type:"text",value:d});continue}if(d===BU){if(a.type!=="paren"){m({type:"text",value:d});continue}a=i.pop(),m({type:"text",value:d}),a=i[i.length-1];continue}if(d===LU||d===UU||d===PU){let b=d,D;for(e.keepQuotes!==!0&&(d="");l<c&&(D=h());){if(D===xg){d+=D+h();continue}if(D===b){e.keepQuotes===!0&&(d+=D);break}d+=D}m({type:"text",value:d});continue}if(d===jU){f++;let D={type:"brace",open:!0,close:!1,dollar:s.value&&s.value.slice(-1)==="$"||a.dollar===!0,depth:f,commas:0,ranges:0,nodes:[]};a=m(D),i.push(a),m({type:"open",value:d});continue}if(d===NU){if(a.type!=="brace"){m({type:"text",value:d});continue}let b="close";a=i.pop(),a.close=!0,m({type:b,value:d}),f--,a=i[i.length-1];continue}if(d===TU&&f>0){if(a.ranges>0){a.ranges=0;let b=a.nodes.shift();a.nodes=[b,{type:"text",value:$U(a)}]}m({type:"comma",value:d}),a.commas++;continue}if(d===IU&&f>0&&a.commas===0){let b=a.nodes;if(f===0||b.length===0){m({type:"text",value:d});continue}if(s.type==="dot"){if(a.range=[],s.value+=d,s.type="range",a.nodes.length!==3&&a.nodes.length!==5){a.invalid=!0,a.ranges=0,s.type="text";continue}a.ranges++,a.args=[];continue}if(s.type==="range"){b.pop();let D=b[b.length-1];D.value+=s.value+d,s=D,a.ranges--;continue}m({type:"dot",value:d});continue}m({type:"text",value:d})}do if(a=i.pop(),a.type!=="root"){a.nodes.forEach(C=>{C.nodes||(C.type==="open"&&(C.isOpen=!0),C.type==="close"&&(C.isClose=!0),C.nodes||(C.type="text"),C.invalid=!0)});let b=i[i.length-1],D=b.nodes.indexOf(a);b.nodes.splice(D,1,...a.nodes)}while(i.length>0);return m({type:"eos"}),o};ES.exports=HU});var FS=x((xY,SS)=>{"use strict";var xS=Ml(),VU=hS(),zU=DS(),GU=_S(),Kt=(t,e={})=>{let r=[];if(Array.isArray(t))for(let n of t){let o=Kt.create(n,e);Array.isArray(o)?r.push(...o):r.push(o)}else r=[].concat(Kt.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(r=[...new Set(r)]),r};Kt.parse=(t,e={})=>GU(t,e);Kt.stringify=(t,e={})=>xS(typeof t=="string"?Kt.parse(t,e):t,e);Kt.compile=(t,e={})=>(typeof t=="string"&&(t=Kt.parse(t,e)),VU(t,e));Kt.expand=(t,e={})=>{typeof t=="string"&&(t=Kt.parse(t,e));let r=zU(t,e);return e.noempty===!0&&(r=r.filter(Boolean)),e.nodupes===!0&&(r=[...new Set(r)]),r};Kt.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?Kt.compile(t,e):Kt.expand(t,e);SS.exports=Kt});var As=x((SY,PS)=>{"use strict";var WU=require("path"),Nr="\\\\/",AS=`[^${Nr}]`,sn="\\.",KU="\\+",YU="\\?",Vl="\\/",JU="(?=.)",OS="[^/]",Sg=`(?:${Vl}|$)`,kS=`(?:^|${Vl})`,Fg=`${sn}{1,2}${Sg}`,XU=`(?!${sn})`,ZU=`(?!${kS}${Fg})`,QU=`(?!${sn}{0,1}${Sg})`,eM=`(?!${Fg})`,tM=`[^.${Vl}]`,rM=`${OS}*?`,$S={DOT_LITERAL:sn,PLUS_LITERAL:KU,QMARK_LITERAL:YU,SLASH_LITERAL:Vl,ONE_CHAR:JU,QMARK:OS,END_ANCHOR:Sg,DOTS_SLASH:Fg,NO_DOT:XU,NO_DOTS:ZU,NO_DOT_SLASH:QU,NO_DOTS_SLASH:eM,QMARK_NO_DOT:tM,STAR:rM,START_ANCHOR:kS},nM={...$S,SLASH_LITERAL:`[${Nr}]`,QMARK:AS,STAR:`${AS}*?`,DOTS_SLASH:`${sn}{1,2}(?:[${Nr}]|$)`,NO_DOT:`(?!${sn})`,NO_DOTS:`(?!(?:^|[${Nr}])${sn}{1,2}(?:[${Nr}]|$))`,NO_DOT_SLASH:`(?!${sn}{0,1}(?:[${Nr}]|$))`,NO_DOTS_SLASH:`(?!${sn}{1,2}(?:[${Nr}]|$))`,QMARK_NO_DOT:`[^.${Nr}]`,START_ANCHOR:`(?:^|[${Nr}])`,END_ANCHOR:`(?:[${Nr}]|$)`},oM={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"};PS.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:oM,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:WU.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?nM:$S}}});var Os=x(Ht=>{"use strict";var iM=require("path"),aM=process.platform==="win32",{REGEX_BACKSLASH:sM,REGEX_REMOVE_BACKSLASH:uM,REGEX_SPECIAL_CHARS:cM,REGEX_SPECIAL_CHARS_GLOBAL:lM}=As();Ht.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Ht.hasRegexChars=t=>cM.test(t);Ht.isRegexChar=t=>t.length===1&&Ht.hasRegexChars(t);Ht.escapeRegex=t=>t.replace(lM,"\\$1");Ht.toPosixSlashes=t=>t.replace(sM,"/");Ht.removeBackslashes=t=>t.replace(uM,e=>e==="\\"?"":e);Ht.supportsLookbehinds=()=>{let t=process.version.slice(1).split(".").map(Number);return t.length===3&&t[0]>=9||t[0]===8&&t[1]>=10};Ht.isWindows=t=>t&&typeof t.windows=="boolean"?t.windows:aM===!0||iM.sep==="\\";Ht.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Ht.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Ht.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Ht.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",o=r.contains?"":"$",i=`${n}(?:${t})${o}`;return e.negated===!0&&(i=`(?:^(?!${i}).*$)`),i}});var US=x((AY,LS)=>{"use strict";var TS=Os(),{CHAR_ASTERISK:Ag,CHAR_AT:fM,CHAR_BACKWARD_SLASH:ks,CHAR_COMMA:pM,CHAR_DOT:Og,CHAR_EXCLAMATION_MARK:kg,CHAR_FORWARD_SLASH:NS,CHAR_LEFT_CURLY_BRACE:$g,CHAR_LEFT_PARENTHESES:Pg,CHAR_LEFT_SQUARE_BRACKET:dM,CHAR_PLUS:hM,CHAR_QUESTION_MARK:IS,CHAR_RIGHT_CURLY_BRACE:mM,CHAR_RIGHT_PARENTHESES:RS,CHAR_RIGHT_SQUARE_BRACKET:gM}=As(),BS=t=>t===NS||t===ks,jS=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},DM=(t,e)=>{let r=e||{},n=t.length-1,o=r.parts===!0||r.scanToEnd===!0,i=[],a=[],s=[],u=t,c=-1,l=0,f=0,d=!1,h=!1,m=!1,b=!1,D=!1,C=!1,E=!1,g=!1,_=!1,S=!1,T=0,O,B,R={value:"",depth:0,isGlob:!1},N=()=>c>=n,A=()=>u.charCodeAt(c+1),U=()=>(O=B,u.charCodeAt(++c));for(;c<n;){B=U();let v;if(B===ks){E=R.backslashes=!0,B=U(),B===$g&&(C=!0);continue}if(C===!0||B===$g){for(T++;N()!==!0&&(B=U());){if(B===ks){E=R.backslashes=!0,U();continue}if(B===$g){T++;continue}if(C!==!0&&B===Og&&(B=U())===Og){if(d=R.isBrace=!0,m=R.isGlob=!0,S=!0,o===!0)continue;break}if(C!==!0&&B===pM){if(d=R.isBrace=!0,m=R.isGlob=!0,S=!0,o===!0)continue;break}if(B===mM&&(T--,T===0)){C=!1,d=R.isBrace=!0,S=!0;break}}if(o===!0)continue;break}if(B===NS){if(i.push(c),a.push(R),R={value:"",depth:0,isGlob:!1},S===!0)continue;if(O===Og&&c===l+1){l+=2;continue}f=c+1;continue}if(r.noext!==!0&&(B===hM||B===fM||B===Ag||B===IS||B===kg)===!0&&A()===Pg){if(m=R.isGlob=!0,b=R.isExtglob=!0,S=!0,B===kg&&c===l&&(_=!0),o===!0){for(;N()!==!0&&(B=U());){if(B===ks){E=R.backslashes=!0,B=U();continue}if(B===RS){m=R.isGlob=!0,S=!0;break}}continue}break}if(B===Ag){if(O===Ag&&(D=R.isGlobstar=!0),m=R.isGlob=!0,S=!0,o===!0)continue;break}if(B===IS){if(m=R.isGlob=!0,S=!0,o===!0)continue;break}if(B===dM){for(;N()!==!0&&(v=U());){if(v===ks){E=R.backslashes=!0,U();continue}if(v===gM){h=R.isBracket=!0,m=R.isGlob=!0,S=!0;break}}if(o===!0)continue;break}if(r.nonegate!==!0&&B===kg&&c===l){g=R.negated=!0,l++;continue}if(r.noparen!==!0&&B===Pg){if(m=R.isGlob=!0,o===!0){for(;N()!==!0&&(B=U());){if(B===Pg){E=R.backslashes=!0,B=U();continue}if(B===RS){S=!0;break}}continue}break}if(m===!0){if(S=!0,o===!0)continue;break}}r.noext===!0&&(b=!1,m=!1);let M=u,Q="",$="";l>0&&(Q=u.slice(0,l),u=u.slice(l),f-=l),M&&m===!0&&f>0?(M=u.slice(0,f),$=u.slice(f)):m===!0?(M="",$=u):M=u,M&&M!==""&&M!=="/"&&M!==u&&BS(M.charCodeAt(M.length-1))&&(M=M.slice(0,-1)),r.unescape===!0&&($&&($=TS.removeBackslashes($)),M&&E===!0&&(M=TS.removeBackslashes(M)));let y={prefix:Q,input:t,start:l,base:M,glob:$,isBrace:d,isBracket:h,isGlob:m,isExtglob:b,isGlobstar:D,negated:g,negatedExtglob:_};if(r.tokens===!0&&(y.maxDepth=0,BS(B)||a.push(R),y.tokens=a),r.parts===!0||r.tokens===!0){let v;for(let w=0;w<i.length;w++){let F=v?v+1:l,I=i[w],k=t.slice(F,I);r.tokens&&(w===0&&l!==0?(a[w].isPrefix=!0,a[w].value=Q):a[w].value=k,jS(a[w]),y.maxDepth+=a[w].depth),(w!==0||k!=="")&&s.push(k),v=I}if(v&&v+1<t.length){let w=t.slice(v+1);s.push(w),r.tokens&&(a[a.length-1].value=w,jS(a[a.length-1]),y.maxDepth+=a[a.length-1].depth)}y.slashes=i,y.parts=s}return y};LS.exports=DM});var HS=x((OY,qS)=>{"use strict";var zl=As(),Yt=Os(),{MAX_LENGTH:Gl,POSIX_REGEX_SOURCE:yM,REGEX_NON_SPECIAL_CHARS:bM,REGEX_SPECIAL_CHARS_BACKREF:vM,REPLACEMENTS:MS}=zl,wM=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(o=>Yt.escapeRegex(o)).join("..")}return r},na=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,Tg=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=MS[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(Gl,r.maxLength):Gl,o=t.length;if(o>n)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${n}`);let i={type:"bos",value:"",output:r.prepend||""},a=[i],s=r.capture?"":"?:",u=Yt.isWindows(e),c=zl.globChars(u),l=zl.extglobChars(c),{DOT_LITERAL:f,PLUS_LITERAL:d,SLASH_LITERAL:h,ONE_CHAR:m,DOTS_SLASH:b,NO_DOT:D,NO_DOT_SLASH:C,NO_DOTS_SLASH:E,QMARK:g,QMARK_NO_DOT:_,STAR:S,START_ANCHOR:T}=c,O=z=>`(${s}(?:(?!${T}${z.dot?b:f}).)*?)`,B=r.dot?"":D,R=r.dot?g:_,N=r.bash===!0?O(r):S;r.capture&&(N=`(${N})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let A={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:a};t=Yt.removePrefix(t,A),o=t.length;let U=[],M=[],Q=[],$=i,y,v=()=>A.index===o-1,w=A.peek=(z=1)=>t[A.index+z],F=A.advance=()=>t[++A.index]||"",I=()=>t.slice(A.index+1),k=(z="",Ce=0)=>{A.consumed+=z,A.index+=Ce},q=z=>{A.output+=z.output!=null?z.output:z.value,k(z.value)},P=()=>{let z=1;for(;w()==="!"&&(w(2)!=="("||w(3)==="?");)F(),A.start++,z++;return z%2===0?!1:(A.negated=!0,A.start++,!0)},j=z=>{A[z]++,Q.push(z)},ee=z=>{A[z]--,Q.pop()},V=z=>{if($.type==="globstar"){let Ce=A.braces>0&&(z.type==="comma"||z.type==="brace"),H=z.extglob===!0||U.length&&(z.type==="pipe"||z.type==="paren");z.type!=="slash"&&z.type!=="paren"&&!Ce&&!H&&(A.output=A.output.slice(0,-$.output.length),$.type="star",$.value="*",$.output=N,A.output+=$.output)}if(U.length&&z.type!=="paren"&&(U[U.length-1].inner+=z.value),(z.value||z.output)&&q(z),$&&$.type==="text"&&z.type==="text"){$.value+=z.value,$.output=($.output||"")+z.value;return}z.prev=$,a.push(z),$=z},se=(z,Ce)=>{let H={...l[Ce],conditions:1,inner:""};H.prev=$,H.parens=A.parens,H.output=A.output;let ue=(r.capture?"(":"")+H.open;j("parens"),V({type:z,value:Ce,output:A.output?"":m}),V({type:"paren",extglob:!0,value:F(),output:ue}),U.push(H)},dr=z=>{let Ce=z.close+(r.capture?")":""),H;if(z.type==="negate"){let ue=N;if(z.inner&&z.inner.length>1&&z.inner.includes("/")&&(ue=O(r)),(ue!==N||v()||/^\)+$/.test(I()))&&(Ce=z.close=`)$))${ue}`),z.inner.includes("*")&&(H=I())&&/^\.[^\\/.]+$/.test(H)){let Le=Tg(H,{...e,fastpaths:!1}).output;Ce=z.close=`)${Le})${ue})`}z.prev.type==="bos"&&(A.negatedExtglob=!0)}V({type:"paren",extglob:!0,value:y,output:Ce}),ee("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let z=!1,Ce=t.replace(vM,(H,ue,Le,Et,Qe,tf)=>Et==="\\"?(z=!0,H):Et==="?"?ue?ue+Et+(Qe?g.repeat(Qe.length):""):tf===0?R+(Qe?g.repeat(Qe.length):""):g.repeat(Le.length):Et==="."?f.repeat(Le.length):Et==="*"?ue?ue+Et+(Qe?N:""):N:ue?H:`\\${H}`);return z===!0&&(r.unescape===!0?Ce=Ce.replace(/\\/g,""):Ce=Ce.replace(/\\+/g,H=>H.length%2===0?"\\\\":H?"\\":"")),Ce===t&&r.contains===!0?(A.output=t,A):(A.output=Yt.wrapOutput(Ce,A,e),A)}for(;!v();){if(y=F(),y==="\0")continue;if(y==="\\"){let H=w();if(H==="/"&&r.bash!==!0||H==="."||H===";")continue;if(!H){y+="\\",V({type:"text",value:y});continue}let ue=/^\\+/.exec(I()),Le=0;if(ue&&ue[0].length>2&&(Le=ue[0].length,A.index+=Le,Le%2!==0&&(y+="\\")),r.unescape===!0?y=F():y+=F(),A.brackets===0){V({type:"text",value:y});continue}}if(A.brackets>0&&(y!=="]"||$.value==="["||$.value==="[^")){if(r.posix!==!1&&y===":"){let H=$.value.slice(1);if(H.includes("[")&&($.posix=!0,H.includes(":"))){let ue=$.value.lastIndexOf("["),Le=$.value.slice(0,ue),Et=$.value.slice(ue+2),Qe=yM[Et];if(Qe){$.value=Le+Qe,A.backtrack=!0,F(),!i.output&&a.indexOf($)===1&&(i.output=m);continue}}}(y==="["&&w()!==":"||y==="-"&&w()==="]")&&(y=`\\${y}`),y==="]"&&($.value==="["||$.value==="[^")&&(y=`\\${y}`),r.posix===!0&&y==="!"&&$.value==="["&&(y="^"),$.value+=y,q({value:y});continue}if(A.quotes===1&&y!=='"'){y=Yt.escapeRegex(y),$.value+=y,q({value:y});continue}if(y==='"'){A.quotes=A.quotes===1?0:1,r.keepQuotes===!0&&V({type:"text",value:y});continue}if(y==="("){j("parens"),V({type:"paren",value:y});continue}if(y===")"){if(A.parens===0&&r.strictBrackets===!0)throw new SyntaxError(na("opening","("));let H=U[U.length-1];if(H&&A.parens===H.parens+1){dr(U.pop());continue}V({type:"paren",value:y,output:A.parens?")":"\\)"}),ee("parens");continue}if(y==="["){if(r.nobracket===!0||!I().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(na("closing","]"));y=`\\${y}`}else j("brackets");V({type:"bracket",value:y});continue}if(y==="]"){if(r.nobracket===!0||$&&$.type==="bracket"&&$.value.length===1){V({type:"text",value:y,output:`\\${y}`});continue}if(A.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(na("opening","["));V({type:"text",value:y,output:`\\${y}`});continue}ee("brackets");let H=$.value.slice(1);if($.posix!==!0&&H[0]==="^"&&!H.includes("/")&&(y=`/${y}`),$.value+=y,q({value:y}),r.literalBrackets===!1||Yt.hasRegexChars(H))continue;let ue=Yt.escapeRegex($.value);if(A.output=A.output.slice(0,-$.value.length),r.literalBrackets===!0){A.output+=ue,$.value=ue;continue}$.value=`(${s}${ue}|${$.value})`,A.output+=$.value;continue}if(y==="{"&&r.nobrace!==!0){j("braces");let H={type:"brace",value:y,output:"(",outputIndex:A.output.length,tokensIndex:A.tokens.length};M.push(H),V(H);continue}if(y==="}"){let H=M[M.length-1];if(r.nobrace===!0||!H){V({type:"text",value:y,output:y});continue}let ue=")";if(H.dots===!0){let Le=a.slice(),Et=[];for(let Qe=Le.length-1;Qe>=0&&(a.pop(),Le[Qe].type!=="brace");Qe--)Le[Qe].type!=="dots"&&Et.unshift(Le[Qe].value);ue=wM(Et,r),A.backtrack=!0}if(H.comma!==!0&&H.dots!==!0){let Le=A.output.slice(0,H.outputIndex),Et=A.tokens.slice(H.tokensIndex);H.value=H.output="\\{",y=ue="\\}",A.output=Le;for(let Qe of Et)A.output+=Qe.output||Qe.value}V({type:"brace",value:y,output:ue}),ee("braces"),M.pop();continue}if(y==="|"){U.length>0&&U[U.length-1].conditions++,V({type:"text",value:y});continue}if(y===","){let H=y,ue=M[M.length-1];ue&&Q[Q.length-1]==="braces"&&(ue.comma=!0,H="|"),V({type:"comma",value:y,output:H});continue}if(y==="/"){if($.type==="dot"&&A.index===A.start+1){A.start=A.index+1,A.consumed="",A.output="",a.pop(),$=i;continue}V({type:"slash",value:y,output:h});continue}if(y==="."){if(A.braces>0&&$.type==="dot"){$.value==="."&&($.output=f);let H=M[M.length-1];$.type="dots",$.output+=y,$.value+=y,H.dots=!0;continue}if(A.braces+A.parens===0&&$.type!=="bos"&&$.type!=="slash"){V({type:"text",value:y,output:f});continue}V({type:"dot",value:y,output:f});continue}if(y==="?"){if(!($&&$.value==="(")&&r.noextglob!==!0&&w()==="("&&w(2)!=="?"){se("qmark",y);continue}if($&&$.type==="paren"){let ue=w(),Le=y;if(ue==="<"&&!Yt.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");($.value==="("&&!/[!=<:]/.test(ue)||ue==="<"&&!/<([!=]|\w+>)/.test(I()))&&(Le=`\\${y}`),V({type:"text",value:y,output:Le});continue}if(r.dot!==!0&&($.type==="slash"||$.type==="bos")){V({type:"qmark",value:y,output:_});continue}V({type:"qmark",value:y,output:g});continue}if(y==="!"){if(r.noextglob!==!0&&w()==="("&&(w(2)!=="?"||!/[!=<:]/.test(w(3)))){se("negate",y);continue}if(r.nonegate!==!0&&A.index===0){P();continue}}if(y==="+"){if(r.noextglob!==!0&&w()==="("&&w(2)!=="?"){se("plus",y);continue}if($&&$.value==="("||r.regex===!1){V({type:"plus",value:y,output:d});continue}if($&&($.type==="bracket"||$.type==="paren"||$.type==="brace")||A.parens>0){V({type:"plus",value:y});continue}V({type:"plus",value:d});continue}if(y==="@"){if(r.noextglob!==!0&&w()==="("&&w(2)!=="?"){V({type:"at",extglob:!0,value:y,output:""});continue}V({type:"text",value:y});continue}if(y!=="*"){(y==="$"||y==="^")&&(y=`\\${y}`);let H=bM.exec(I());H&&(y+=H[0],A.index+=H[0].length),V({type:"text",value:y});continue}if($&&($.type==="globstar"||$.star===!0)){$.type="star",$.star=!0,$.value+=y,$.output=N,A.backtrack=!0,A.globstar=!0,k(y);continue}let z=I();if(r.noextglob!==!0&&/^\([^?]/.test(z)){se("star",y);continue}if($.type==="star"){if(r.noglobstar===!0){k(y);continue}let H=$.prev,ue=H.prev,Le=H.type==="slash"||H.type==="bos",Et=ue&&(ue.type==="star"||ue.type==="globstar");if(r.bash===!0&&(!Le||z[0]&&z[0]!=="/")){V({type:"star",value:y,output:""});continue}let Qe=A.braces>0&&(H.type==="comma"||H.type==="brace"),tf=U.length&&(H.type==="pipe"||H.type==="paren");if(!Le&&H.type!=="paren"&&!Qe&&!tf){V({type:"star",value:y,output:""});continue}for(;z.slice(0,3)==="/**";){let Rs=t[A.index+4];if(Rs&&Rs!=="/")break;z=z.slice(3),k("/**",3)}if(H.type==="bos"&&v()){$.type="globstar",$.value+=y,$.output=O(r),A.output=$.output,A.globstar=!0,k(y);continue}if(H.type==="slash"&&H.prev.type!=="bos"&&!Et&&v()){A.output=A.output.slice(0,-(H.output+$.output).length),H.output=`(?:${H.output}`,$.type="globstar",$.output=O(r)+(r.strictSlashes?")":"|$)"),$.value+=y,A.globstar=!0,A.output+=H.output+$.output,k(y);continue}if(H.type==="slash"&&H.prev.type!=="bos"&&z[0]==="/"){let Rs=z[1]!==void 0?"|$":"";A.output=A.output.slice(0,-(H.output+$.output).length),H.output=`(?:${H.output}`,$.type="globstar",$.output=`${O(r)}${h}|${h}${Rs})`,$.value+=y,A.output+=H.output+$.output,A.globstar=!0,k(y+F()),V({type:"slash",value:"/",output:""});continue}if(H.type==="bos"&&z[0]==="/"){$.type="globstar",$.value+=y,$.output=`(?:^|${h}|${O(r)}${h})`,A.output=$.output,A.globstar=!0,k(y+F()),V({type:"slash",value:"/",output:""});continue}A.output=A.output.slice(0,-$.output.length),$.type="globstar",$.output=O(r),$.value+=y,A.output+=$.output,A.globstar=!0,k(y);continue}let Ce={type:"star",value:y,output:N};if(r.bash===!0){Ce.output=".*?",($.type==="bos"||$.type==="slash")&&(Ce.output=B+Ce.output),V(Ce);continue}if($&&($.type==="bracket"||$.type==="paren")&&r.regex===!0){Ce.output=y,V(Ce);continue}(A.index===A.start||$.type==="slash"||$.type==="dot")&&($.type==="dot"?(A.output+=C,$.output+=C):r.dot===!0?(A.output+=E,$.output+=E):(A.output+=B,$.output+=B),w()!=="*"&&(A.output+=m,$.output+=m)),V(Ce)}for(;A.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(na("closing","]"));A.output=Yt.escapeLast(A.output,"["),ee("brackets")}for(;A.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(na("closing",")"));A.output=Yt.escapeLast(A.output,"("),ee("parens")}for(;A.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(na("closing","}"));A.output=Yt.escapeLast(A.output,"{"),ee("braces")}if(r.strictSlashes!==!0&&($.type==="star"||$.type==="bracket")&&V({type:"maybe_slash",value:"",output:`${h}?`}),A.backtrack===!0){A.output="";for(let z of A.tokens)A.output+=z.output!=null?z.output:z.value,z.suffix&&(A.output+=z.suffix)}return A};Tg.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(Gl,r.maxLength):Gl,o=t.length;if(o>n)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${n}`);t=MS[t]||t;let i=Yt.isWindows(e),{DOT_LITERAL:a,SLASH_LITERAL:s,ONE_CHAR:u,DOTS_SLASH:c,NO_DOT:l,NO_DOTS:f,NO_DOTS_SLASH:d,STAR:h,START_ANCHOR:m}=zl.globChars(i),b=r.dot?f:l,D=r.dot?d:l,C=r.capture?"":"?:",E={negated:!1,prefix:""},g=r.bash===!0?".*?":h;r.capture&&(g=`(${g})`);let _=B=>B.noglobstar===!0?g:`(${C}(?:(?!${m}${B.dot?c:a}).)*?)`,S=B=>{switch(B){case"*":return`${b}${u}${g}`;case".*":return`${a}${u}${g}`;case"*.*":return`${b}${g}${a}${u}${g}`;case"*/*":return`${b}${g}${s}${u}${D}${g}`;case"**":return b+_(r);case"**/*":return`(?:${b}${_(r)}${s})?${D}${u}${g}`;case"**/*.*":return`(?:${b}${_(r)}${s})?${D}${g}${a}${u}${g}`;case"**/.*":return`(?:${b}${_(r)}${s})?${a}${u}${g}`;default:{let R=/^(.*?)\.(\w+)$/.exec(B);if(!R)return;let N=S(R[1]);return N?N+a+R[2]:void 0}}},T=Yt.removePrefix(t,E),O=S(T);return O&&r.strictSlashes!==!0&&(O+=`${s}?`),O};qS.exports=Tg});var zS=x((kY,VS)=>{"use strict";var CM=require("path"),EM=US(),Ig=HS(),Rg=Os(),_M=As(),xM=t=>t&&typeof t=="object"&&!Array.isArray(t),Ze=(t,e,r=!1)=>{if(Array.isArray(t)){let l=t.map(d=>Ze(d,e,r));return d=>{for(let h of l){let m=h(d);if(m)return m}return!1}}let n=xM(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=Rg.isWindows(e),a=n?Ze.compileRe(t,e):Ze.makeRe(t,e,!1,!0),s=a.state;delete a.state;let u=()=>!1;if(o.ignore){let l={...e,ignore:null,onMatch:null,onResult:null};u=Ze(o.ignore,l,r)}let c=(l,f=!1)=>{let{isMatch:d,match:h,output:m}=Ze.test(l,a,e,{glob:t,posix:i}),b={glob:t,state:s,regex:a,posix:i,input:l,output:m,match:h,isMatch:d};return typeof o.onResult=="function"&&o.onResult(b),d===!1?(b.isMatch=!1,f?b:!1):u(l)?(typeof o.onIgnore=="function"&&o.onIgnore(b),b.isMatch=!1,f?b:!1):(typeof o.onMatch=="function"&&o.onMatch(b),f?b:!0)};return r&&(c.state=s),c};Ze.test=(t,e,r,{glob:n,posix:o}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let i=r||{},a=i.format||(o?Rg.toPosixSlashes:null),s=t===n,u=s&&a?a(t):t;return s===!1&&(u=a?a(t):t,s=u===n),(s===!1||i.capture===!0)&&(i.matchBase===!0||i.basename===!0?s=Ze.matchBase(t,e,r,o):s=e.exec(u)),{isMatch:!!s,match:s,output:u}};Ze.matchBase=(t,e,r,n=Rg.isWindows(r))=>(e instanceof RegExp?e:Ze.makeRe(e,r)).test(CM.basename(t));Ze.isMatch=(t,e,r)=>Ze(e,r)(t);Ze.parse=(t,e)=>Array.isArray(t)?t.map(r=>Ze.parse(r,e)):Ig(t,{...e,fastpaths:!1});Ze.scan=(t,e)=>EM(t,e);Ze.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let o=e||{},i=o.contains?"":"^",a=o.contains?"":"$",s=`${i}(?:${t.output})${a}`;t&&t.negated===!0&&(s=`^(?!${s}).*$`);let u=Ze.toRegex(s,e);return n===!0&&(u.state=t),u};Ze.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let o={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(o.output=Ig.fastpaths(t,e)),o.output||(o=Ig(t,e)),Ze.compileRe(o,e,r,n)};Ze.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};Ze.constants=_M;VS.exports=Ze});var WS=x(($Y,GS)=>{"use strict";GS.exports=zS()});var QS=x((PY,ZS)=>{"use strict";var YS=require("util"),JS=FS(),Lr=WS(),Bg=Os(),KS=t=>t===""||t==="./",XS=t=>{let e=t.indexOf("{");return e>-1&&t.indexOf("}",e)>-1},Re=(t,e,r)=>{e=[].concat(e),t=[].concat(t);let n=new Set,o=new Set,i=new Set,a=0,s=l=>{i.add(l.output),r&&r.onResult&&r.onResult(l)};for(let l=0;l<e.length;l++){let f=Lr(String(e[l]),{...r,onResult:s},!0),d=f.state.negated||f.state.negatedExtglob;d&&a++;for(let h of t){let m=f(h,!0);(d?!m.isMatch:m.isMatch)&&(d?n.add(m.output):(n.delete(m.output),o.add(m.output)))}}let c=(a===e.length?[...i]:[...o]).filter(l=>!n.has(l));if(r&&c.length===0){if(r.failglob===!0)throw new Error(`No matches found for "${e.join(", ")}"`);if(r.nonull===!0||r.nullglob===!0)return r.unescape?e.map(l=>l.replace(/\\/g,"")):e}return c};Re.match=Re;Re.matcher=(t,e)=>Lr(t,e);Re.isMatch=(t,e,r)=>Lr(e,r)(t);Re.any=Re.isMatch;Re.not=(t,e,r={})=>{e=[].concat(e).map(String);let n=new Set,o=[],i=s=>{r.onResult&&r.onResult(s),o.push(s.output)},a=new Set(Re(t,e,{...r,onResult:i}));for(let s of o)a.has(s)||n.add(s);return[...n]};Re.contains=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${YS.inspect(t)}"`);if(Array.isArray(e))return e.some(n=>Re.contains(t,n,r));if(typeof e=="string"){if(KS(t)||KS(e))return!1;if(t.includes(e)||t.startsWith("./")&&t.slice(2).includes(e))return!0}return Re.isMatch(t,e,{...r,contains:!0})};Re.matchKeys=(t,e,r)=>{if(!Bg.isObject(t))throw new TypeError("Expected the first argument to be an object");let n=Re(Object.keys(t),e,r),o={};for(let i of n)o[i]=t[i];return o};Re.some=(t,e,r)=>{let n=[].concat(t);for(let o of[].concat(e)){let i=Lr(String(o),r);if(n.some(a=>i(a)))return!0}return!1};Re.every=(t,e,r)=>{let n=[].concat(t);for(let o of[].concat(e)){let i=Lr(String(o),r);if(!n.every(a=>i(a)))return!1}return!0};Re.all=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${YS.inspect(t)}"`);return[].concat(e).every(n=>Lr(n,r)(t))};Re.capture=(t,e,r)=>{let n=Bg.isWindows(r),i=Lr.makeRe(String(t),{...r,capture:!0}).exec(n?Bg.toPosixSlashes(e):e);if(i)return i.slice(1).map(a=>a===void 0?"":a)};Re.makeRe=(...t)=>Lr.makeRe(...t);Re.scan=(...t)=>Lr.scan(...t);Re.parse=(t,e)=>{let r=[];for(let n of[].concat(t||[]))for(let o of JS(String(n),e))r.push(Lr.parse(o,e));return r};Re.braces=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return e&&e.nobrace===!0||!XS(t)?[t]:JS(t,e)};Re.braceExpand=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return Re.braces(t,{...e,expand:!0})};Re.hasBraces=XS;ZS.exports=Re});var UF=x((kJ,un)=>{var Oe=require("fs"),Jl=require("os"),gt=require("path"),EF=require("crypto"),Mr={fs:Oe.constants,os:Jl.constants},_F="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",AF=/XXXXXX/,KM=3,OF=(Mr.O_CREAT||Mr.fs.O_CREAT)|(Mr.O_EXCL||Mr.fs.O_EXCL)|(Mr.O_RDWR||Mr.fs.O_RDWR),YM=Jl.platform()==="win32",JM=Mr.EBADF||Mr.os.errno.EBADF,XM=Mr.ENOENT||Mr.os.errno.ENOENT,kF=448,$F=384,ZM="exit",ia=[],PF=Oe.rmdirSync.bind(Oe),TF=!1;function QM(t,e){return Oe.rm(t,{recursive:!0},e)}function IF(t){return Oe.rmSync(t,{recursive:!0})}function Vg(t,e){let r=aa(t,e),n=r[0],o=r[1];c9(n,function(i,a){if(i)return o(i);let s=a.tries;(function u(){try{let c=BF(a);Oe.stat(c,function(l){if(!l)return s-- >0?u():o(new Error("Could not get a unique tmp filename, max tries reached "+c));o(null,c)})}catch(c){o(c)}})()})}function zg(t){let e=aa(t),r=e[0],n=l9(r),o=n.tries;do{let i=BF(n);try{Oe.statSync(i)}catch{return i}}while(o-- >0);throw new Error("Could not get a unique tmp filename, max tries reached")}function e9(t,e){let r=aa(t,e),n=r[0],o=r[1];Vg(n,function(a,s){if(a)return o(a);Oe.open(s,OF,n.mode||$F,function(c,l){if(c)return o(c);if(n.discardDescriptor)return Oe.close(l,function(d){return o(d,s,void 0,qg(s,-1,n,!1))});{let f=n.discardDescriptor||n.detachDescriptor;o(null,s,l,qg(s,f?-1:l,n,!1))}})})}function t9(t){let e=aa(t),r=e[0],n=r.discardDescriptor||r.detachDescriptor,o=zg(r),i=Oe.openSync(o,OF,r.mode||$F);return r.discardDescriptor&&(Oe.closeSync(i),i=void 0),{name:o,fd:i,removeCallback:qg(o,n?-1:i,r,!0)}}function r9(t,e){let r=aa(t,e),n=r[0],o=r[1];Vg(n,function(a,s){if(a)return o(a);Oe.mkdir(s,n.mode||kF,function(c){if(c)return o(c);o(null,s,RF(s,n,!1))})})}function n9(t){let e=aa(t),r=e[0],n=zg(r);return Oe.mkdirSync(n,r.mode||kF),{name:n,removeCallback:RF(n,r,!0)}}function o9(t,e){let r=function(n){if(n&&!Hg(n))return e(n);e()};0<=t[0]?Oe.close(t[0],function(){Oe.unlink(t[1],r)}):Oe.unlink(t[1],r)}function i9(t){let e=null;try{0<=t[0]&&Oe.closeSync(t[0])}catch(r){if(!f9(r)&&!Hg(r))throw r}finally{try{Oe.unlinkSync(t[1])}catch(r){Hg(r)||(e=r)}}if(e!==null)throw e}function qg(t,e,r,n){let o=Yl(i9,[e,t],n),i=Yl(o9,[e,t],n,o);return r.keep||ia.unshift(o),n?o:i}function RF(t,e,r){let n=e.unsafeCleanup?QM:Oe.rmdir.bind(Oe),o=e.unsafeCleanup?IF:PF,i=Yl(o,t,r),a=Yl(n,t,r,i);return e.keep||ia.unshift(i),r?i:a}function Yl(t,e,r,n){let o=!1;return function i(a){if(!o){let s=n||i,u=ia.indexOf(s);return u>=0&&ia.splice(u,1),o=!0,r||t===PF||t===IF?t(e):t(e,a||function(){})}}}function a9(){if(TF)for(;ia.length;)try{ia[0]()}catch{}}function xF(t){let e=[],r=null;try{r=EF.randomBytes(t)}catch{r=EF.pseudoRandomBytes(t)}for(let n=0;n<t;n++)e.push(_F[r[n]%_F.length]);return e.join("")}function Jt(t){return typeof t>"u"}function aa(t,e){if(typeof t=="function")return[{},t];if(Jt(t))return[{},e];let r={};for(let n of Object.getOwnPropertyNames(t))r[n]=t[n];return[r,e]}function s9(t,e,r){let n=gt.isAbsolute(t)?t:gt.join(e,t);Oe.stat(n,function(o){o?Oe.realpath(gt.dirname(n),function(i,a){if(i)return r(i);r(null,gt.join(a,gt.basename(n)))}):Oe.realpath(n,r)})}function u9(t,e){let r=gt.isAbsolute(t)?t:gt.join(e,t);try{return Oe.statSync(r),Oe.realpathSync(r)}catch{let o=Oe.realpathSync(gt.dirname(r));return gt.join(o,gt.basename(r))}}function BF(t){let e=t.tmpdir;if(!Jt(t.name))return gt.join(e,t.dir,t.name);if(!Jt(t.template))return gt.join(e,t.dir,t.template).replace(AF,xF(6));let r=[t.prefix?t.prefix:"tmp","-",process.pid,"-",xF(12),t.postfix?"-"+t.postfix:""].join("");return gt.join(e,t.dir,r)}function jF(t){if(!Jt(t.name)){let e=t.name;if(gt.isAbsolute(e))throw new Error(`name option must not contain an absolute path, found "${e}".`);let r=gt.basename(e);if(r===".."||r==="."||r!==e)throw new Error(`name option must not contain a path, found "${e}".`)}if(!Jt(t.template)&&!t.template.match(AF))throw new Error(`Invalid template, found "${t.template}".`);if(!Jt(t.tries)&&isNaN(t.tries)||t.tries<0)throw new Error(`Invalid tries, found "${t.tries}".`);t.tries=Jt(t.name)?t.tries||KM:1,t.keep=!!t.keep,t.detachDescriptor=!!t.detachDescriptor,t.discardDescriptor=!!t.discardDescriptor,t.unsafeCleanup=!!t.unsafeCleanup,t.prefix=Jt(t.prefix)?"":t.prefix,t.postfix=Jt(t.postfix)?"":t.postfix}function SF(t,e,r,n){if(Jt(e))return n(null);s9(e,r,function(o,i){if(o)return n(o);let a=gt.relative(r,i);if(!i.startsWith(r))return n(new Error(`${t} option must be relative to "${r}", found "${a}".`));n(null,a)})}function FF(t,e,r){if(Jt(e))return;let n=u9(e,r),o=gt.relative(r,n);if(!n.startsWith(r))throw new Error(`${t} option must be relative to "${r}", found "${o}".`);return o}function c9(t,e){d9(t,function(r,n){if(r)return e(r);t.tmpdir=n;try{jF(t,n)}catch(o){return e(o)}SF("dir",t.dir,n,function(o,i){if(o)return e(o);t.dir=Jt(i)?"":i,SF("template",t.template,n,function(a,s){if(a)return e(a);t.template=s,e(null,t)})})})}function l9(t){let e=t.tmpdir=LF(t);jF(t,e);let r=FF("dir",t.dir,e);return t.dir=Jt(r)?"":r,t.template=FF("template",t.template,e),t}function f9(t){return NF(t,-JM,"EBADF")}function Hg(t){return NF(t,-XM,"ENOENT")}function NF(t,e,r){return YM?t.code===r:t.code===r&&t.errno===e}function p9(){TF=!0}function d9(t,e){return Oe.realpath(t&&t.tmpdir||Jl.tmpdir(),e)}function LF(t){return Oe.realpathSync(t&&t.tmpdir||Jl.tmpdir())}process.addListener(ZM,a9);Object.defineProperty(un.exports,"tmpdir",{enumerable:!0,configurable:!1,get:function(){return LF()}});un.exports.dir=r9;un.exports.dirSync=n9;un.exports.file=e9;un.exports.fileSync=t9;un.exports.tmpName=Vg;un.exports.tmpNameSync=zg;un.exports.setGracefulCleanup=p9});var Ql=require("node:process");var dD=ge(pD(),1),{program:pt,createCommand:W9,createArgument:K9,createOption:Y9,CommanderError:J9,InvalidArgumentError:X9,InvalidOptionArgumentError:Z9,Command:Q9,Argument:e7,Option:t7,Help:r7}=dD.default;var hr={name:"@capgo/cli",version:"7.19.1",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/CLI#readme",repository:{type:"git",url:"git+https://github.com/Cap-go/CLI.git"},bugs:{url:"https://github.com/Cap-go/CLI/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli","sdk"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js",require:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && node build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"npx --yes supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",lint:'eslint "src/**/*.ts" --fix',"check-posix-paths":"node test/check-posix-paths.js","generate-docs":"node dist/index.js generate-docs README.md","test:bundle":"bun test/test-bundle.mjs","test:functional":"bun test/test-functional.mjs","test:semver":"bun test/test-semver-validation.mjs","test:version-edge-cases":"bun test/test-version-validation.mjs","test:regex":"bun test/test-regex-validation.mjs","test:upload":"bun test/test-upload-validation.mjs",test:"bun run test:bundle && bun run test:functional && bun run test:semver && bun run test:version-edge-cases && bun run test:regex && bun run test:upload"},devDependencies:{"@antfu/eslint-config":"^6.1.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.4","@capacitor/cli":"^7.4.4","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^0.11.0","@sauber/table":"npm:@jsr/sauber__table","@std/semver":"npm:@jsr/std__semver@1.0.6","@supabase/supabase-js":"^2.79.0","@types/adm-zip":"^0.5.7","@types/node":"^24.9.1","@types/prettyjson":"^0.0.33","@types/tmp":"^0.2.6","@vercel/ncc":"^0.38.4","adm-zip":"^0.5.16","ci-info":"^4.3.1",commander:"^14.0.2",esbuild:"^0.25.11",eslint:"^9.38.0","git-format-staged":"3.1.1",husky:"^9.1.7","is-wsl":"^3.1.0",open:"^10.1.2",prettyjson:"^1.2.5",tmp:"^0.2.5","tus-js-client":"^4.3.1",typescript:"^5.9.3"}};var Xi=require("node:fs");var Dt=ge(wf(),1),Ro=require("node:process"),ln=ge(require("node:readline"),1),Sf=ge(require("node:readline"),1),_D=require("node:stream"),xD=ge(Ef(),1);function xA({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 SA=xA();function SD(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(SA,"")}function FD(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var AD={exports:{}};(function(t){var e={};t.exports=e,e.eastAsianWidth=function(n){var o=n.charCodeAt(0),i=n.length==2?n.charCodeAt(1):0,a=o;return 55296<=o&&o<=56319&&56320<=i&&i<=57343&&(o&=1023,i&=1023,a=o<<10|i,a+=65536),a==12288||65281<=a&&a<=65376||65504<=a&&a<=65510?"F":a==8361||65377<=a&&a<=65470||65474<=a&&a<=65479||65482<=a&&a<=65487||65490<=a&&a<=65495||65498<=a&&a<=65500||65512<=a&&a<=65518?"H":4352<=a&&a<=4447||4515<=a&&a<=4519||4602<=a&&a<=4607||9001<=a&&a<=9002||11904<=a&&a<=11929||11931<=a&&a<=12019||12032<=a&&a<=12245||12272<=a&&a<=12283||12289<=a&&a<=12350||12353<=a&&a<=12438||12441<=a&&a<=12543||12549<=a&&a<=12589||12593<=a&&a<=12686||12688<=a&&a<=12730||12736<=a&&a<=12771||12784<=a&&a<=12830||12832<=a&&a<=12871||12880<=a&&a<=13054||13056<=a&&a<=19903||19968<=a&&a<=42124||42128<=a&&a<=42182||43360<=a&&a<=43388||44032<=a&&a<=55203||55216<=a&&a<=55238||55243<=a&&a<=55291||63744<=a&&a<=64255||65040<=a&&a<=65049||65072<=a&&a<=65106||65108<=a&&a<=65126||65128<=a&&a<=65131||110592<=a&&a<=110593||127488<=a&&a<=127490||127504<=a&&a<=127546||127552<=a&&a<=127560||127568<=a&&a<=127569||131072<=a&&a<=194367||177984<=a&&a<=196605||196608<=a&&a<=262141?"W":32<=a&&a<=126||162<=a&&a<=163||165<=a&&a<=166||a==172||a==175||10214<=a&&a<=10221||10629<=a&&a<=10630?"Na":a==161||a==164||167<=a&&a<=168||a==170||173<=a&&a<=174||176<=a&&a<=180||182<=a&&a<=186||188<=a&&a<=191||a==198||a==208||215<=a&&a<=216||222<=a&&a<=225||a==230||232<=a&&a<=234||236<=a&&a<=237||a==240||242<=a&&a<=243||247<=a&&a<=250||a==252||a==254||a==257||a==273||a==275||a==283||294<=a&&a<=295||a==299||305<=a&&a<=307||a==312||319<=a&&a<=322||a==324||328<=a&&a<=331||a==333||338<=a&&a<=339||358<=a&&a<=359||a==363||a==462||a==464||a==466||a==468||a==470||a==472||a==474||a==476||a==593||a==609||a==708||a==711||713<=a&&a<=715||a==717||a==720||728<=a&&a<=731||a==733||a==735||768<=a&&a<=879||913<=a&&a<=929||931<=a&&a<=937||945<=a&&a<=961||963<=a&&a<=969||a==1025||1040<=a&&a<=1103||a==1105||a==8208||8211<=a&&a<=8214||8216<=a&&a<=8217||8220<=a&&a<=8221||8224<=a&&a<=8226||8228<=a&&a<=8231||a==8240||8242<=a&&a<=8243||a==8245||a==8251||a==8254||a==8308||a==8319||8321<=a&&a<=8324||a==8364||a==8451||a==8453||a==8457||a==8467||a==8470||8481<=a&&a<=8482||a==8486||a==8491||8531<=a&&a<=8532||8539<=a&&a<=8542||8544<=a&&a<=8555||8560<=a&&a<=8569||a==8585||8592<=a&&a<=8601||8632<=a&&a<=8633||a==8658||a==8660||a==8679||a==8704||8706<=a&&a<=8707||8711<=a&&a<=8712||a==8715||a==8719||a==8721||a==8725||a==8730||8733<=a&&a<=8736||a==8739||a==8741||8743<=a&&a<=8748||a==8750||8756<=a&&a<=8759||8764<=a&&a<=8765||a==8776||a==8780||a==8786||8800<=a&&a<=8801||8804<=a&&a<=8807||8810<=a&&a<=8811||8814<=a&&a<=8815||8834<=a&&a<=8835||8838<=a&&a<=8839||a==8853||a==8857||a==8869||a==8895||a==8978||9312<=a&&a<=9449||9451<=a&&a<=9547||9552<=a&&a<=9587||9600<=a&&a<=9615||9618<=a&&a<=9621||9632<=a&&a<=9633||9635<=a&&a<=9641||9650<=a&&a<=9651||9654<=a&&a<=9655||9660<=a&&a<=9661||9664<=a&&a<=9665||9670<=a&&a<=9672||a==9675||9678<=a&&a<=9681||9698<=a&&a<=9701||a==9711||9733<=a&&a<=9734||a==9737||9742<=a&&a<=9743||9748<=a&&a<=9749||a==9756||a==9758||a==9792||a==9794||9824<=a&&a<=9825||9827<=a&&a<=9829||9831<=a&&a<=9834||9836<=a&&a<=9837||a==9839||9886<=a&&a<=9887||9918<=a&&a<=9919||9924<=a&&a<=9933||9935<=a&&a<=9953||a==9955||9960<=a&&a<=9983||a==10045||a==10071||10102<=a&&a<=10111||11093<=a&&a<=11097||12872<=a&&a<=12879||57344<=a&&a<=63743||65024<=a&&a<=65039||a==65533||127232<=a&&a<=127242||127248<=a&&a<=127277||127280<=a&&a<=127337||127344<=a&&a<=127386||917760<=a&&a<=917999||983040<=a&&a<=1048573||1048576<=a&&a<=1114109?"A":"N"},e.characterLength=function(n){var o=this.eastAsianWidth(n);return o=="F"||o=="W"||o=="A"?2:1};function r(n){return n.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}e.length=function(n){for(var o=r(n),i=0,a=0;a<o.length;a++)i=i+this.characterLength(o[a]);return i},e.slice=function(n,o,i){textLen=e.length(n),o=o||0,i=i||1,o<0&&(o=textLen+o),i<0&&(i=textLen+i);for(var a="",s=0,u=r(n),c=0;c<u.length;c++){var l=u[c],f=e.length(l);if(s>=o-(f==2?1:0))if(s+f<=i)a+=l;else break;s+=f}return a}})(AD);var FA=AD.exports,AA=FD(FA),OA=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},kA=FD(OA);function la(t,e={}){if(typeof t!="string"||t.length===0||(e={ambiguousIsNarrow:!0,...e},t=SD(t),t.length===0))return 0;t=t.replace(kA()," ");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(AA.eastAsianWidth(o)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}var _f=10,DD=(t=0)=>e=>`\x1B[${e+t}m`,yD=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,bD=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`,Be={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(Be.modifier);var $A=Object.keys(Be.color),PA=Object.keys(Be.bgColor);[...$A,...PA];function TA(){let t=new Map;for(let[e,r]of Object.entries(Be)){for(let[n,o]of Object.entries(r))Be[n]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},r[n]=Be[n],t.set(o[0],o[1]);Object.defineProperty(Be,e,{value:r,enumerable:!1})}return Object.defineProperty(Be,"codes",{value:t,enumerable:!1}),Be.color.close="\x1B[39m",Be.bgColor.close="\x1B[49m",Be.color.ansi=DD(),Be.color.ansi256=yD(),Be.color.ansi16m=bD(),Be.bgColor.ansi=DD(_f),Be.bgColor.ansi256=yD(_f),Be.bgColor.ansi16m=bD(_f),Object.defineProperties(Be,{rgbToAnsi256:{value:(e,r,n)=>e===r&&r===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value:e=>{let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!r)return[0,0,0];let[n]=r;n.length===3&&(n=[...n].map(i=>i+i).join(""));let o=Number.parseInt(n,16);return[o>>16&255,o>>8&255,o&255]},enumerable:!1},hexToAnsi256:{value:e=>Be.rgbToAnsi256(...Be.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value:e=>{if(e<8)return 30+e;if(e<16)return 90+(e-8);let r,n,o;if(e>=232)r=((e-232)*10+8)/255,n=r,o=r;else{e-=16;let s=e%36;r=Math.floor(e/36)/5,n=Math.floor(s/6)/5,o=s%6/5}let i=Math.max(r,n,o)*2;if(i===0)return 30;let a=30+(Math.round(o)<<2|Math.round(n)<<1|Math.round(r));return i===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(e,r,n)=>Be.ansi256ToAnsi(Be.rgbToAnsi256(e,r,n)),enumerable:!1},hexToAnsi:{value:e=>Be.ansi256ToAnsi(Be.hexToAnsi256(e)),enumerable:!1}}),Be}var IA=TA(),Ws=new Set(["\x1B","\x9B"]),RA=39,Af="\x07",OD="[",BA="]",kD="m",Of=`${BA}8;;`,vD=t=>`${Ws.values().next().value}${OD}${t}${kD}`,wD=t=>`${Ws.values().next().value}${Of}${t}${Af}`,jA=t=>t.split(" ").map(e=>la(e)),xf=(t,e,r)=>{let n=[...e],o=!1,i=!1,a=la(SD(t[t.length-1]));for(let[s,u]of n.entries()){let c=la(u);if(a+c<=r?t[t.length-1]+=u:(t.push(u),a=0),Ws.has(u)&&(o=!0,i=n.slice(s+1).join("").startsWith(Of)),o){i?u===Af&&(o=!1,i=!1):u===kD&&(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())},NA=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(la(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},LA=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",o,i,a=jA(t),s=[""];for(let[c,l]of t.split(" ").entries()){r.trim!==!1&&(s[s.length-1]=s[s.length-1].trimStart());let f=la(s[s.length-1]);if(c!==0&&(f>=e&&(r.wordWrap===!1||r.trim===!1)&&(s.push(""),f=0),(f>0||r.trim===!1)&&(s[s.length-1]+=" ",f++)),r.hard&&a[c]>e){let d=e-f,h=1+Math.floor((a[c]-d-1)/e);Math.floor((a[c]-1)/e)<h&&s.push(""),xf(s,l,e);continue}if(f+a[c]>e&&f>0&&a[c]>0){if(r.wordWrap===!1&&f<e){xf(s,l,e);continue}s.push("")}if(f+a[c]>e&&r.wordWrap===!1){xf(s,l,e);continue}s[s.length-1]+=l}r.trim!==!1&&(s=s.map(c=>NA(c)));let u=[...s.join(`
105
+ `)];for(let[c,l]of u.entries()){if(n+=l,Ws.has(l)){let{groups:d}=new RegExp(`(?:\\${OD}(?<code>\\d+)m|\\${Of}(?<uri>.*)${Af})`).exec(u.slice(c).join(""))||{groups:{}};if(d.code!==void 0){let h=Number.parseFloat(d.code);o=h===RA?void 0:h}else d.uri!==void 0&&(i=d.uri.length===0?void 0:d.uri)}let f=IA.codes.get(Number(o));u[c+1]===`
106
+ `?(i&&(n+=wD("")),o&&f&&(n+=vD(f))):l===`
107
+ `&&(o&&f&&(n+=vD(o)),i&&(n+=wD(i)))}return n};function CD(t,e,r){return String(t).normalize().replace(/\r\n/g,`
108
108
  `).split(`
109
- `).map(n=>C$(n,e,r)).join(`
110
- `)}var _$=["up","down","left","right","space","enter","cancel"],cu={actions:new Set(_$),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]])};function up(t,e){if(typeof t=="string")return cu.aliases.get(t)===e;for(let r of t)if(r!==void 0&&up(r,e))return!0;return!1}function x$(t,e){if(t===e)return;let r=t.split(`
109
+ `).map(n=>LA(n,e,r)).join(`
110
+ `)}var UA=["up","down","left","right","space","enter","cancel"],Hs={actions:new Set(UA),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]])};function kf(t,e){if(typeof t=="string")return Hs.aliases.get(t)===e;for(let r of t)if(r!==void 0&&kf(r,e))return!0;return!1}function MA(t,e){if(t===e)return;let r=t.split(`
111
111
  `),n=e.split(`
112
- `),o=[];for(let i=0;i<Math.max(r.length,n.length);i++)r[i]!==n[i]&&o.push(i);return o}var S$=globalThis.process.platform.startsWith("win"),ip=Symbol("clack:cancel");function Ee(t){return t===ip}function uu(t,e){let r=t;r.isTTY&&r.setRawMode(e)}function Fy({input:t=Wo.stdin,output:e=Wo.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=(s,{name:a,sequence:u})=>{let c=String(s);if(up([c,a,u],"cancel")){n&&e.write(vt.cursor.show),process.exit(0);return}if(!r)return;vn.moveCursor(e,a==="return"?0:-1,a==="return"?-1:0,()=>{vn.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&&!S$&&t.setRawMode(!1),o.terminal=!1,o.close()}}var A$=Object.defineProperty,F$=(t,e,r)=>e in t?A$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Qt=(t,e,r)=>(F$(t,typeof e!="symbol"?e+"":e,r),r),_s=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=Wo.stdin,output:o=Wo.stdout,render:i,signal:s,...a}=e;this.opts=a,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=s,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(ip);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let n=new vy.Writable;n._write=(o,i,s)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,""),this._cursor=this.rl?.cursor??0,this.emit("value",this.value)),s()},this.input.pipe(n),this.rl=op.default.createInterface({input:this.input,output:n,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),op.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),uu(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),uu(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(vt.cursor.show),this.output.off("resize",this.render),uu(this.input,!1),e(ip)})})}onKeypress(e,r){if(this.state==="error"&&(this.state="active"),r?.name&&(!this._track&&cu.aliases.has(r.name)&&this.emit("cursor",cu.aliases.get(r.name)),cu.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")}up([e,r?.name,r?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
113
- `),uu(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=by(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
114
- `).length-1;this.output.write(vt.cursor.move(-999,e*-1))}render(){let e=by(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=x$(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(`
115
- `);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(`
112
+ `),o=[];for(let i=0;i<Math.max(r.length,n.length);i++)r[i]!==n[i]&&o.push(i);return o}var qA=globalThis.process.platform.startsWith("win"),Ff=Symbol("clack:cancel");function be(t){return t===Ff}function qs(t,e){let r=t;r.isTTY&&r.setRawMode(e)}function $D({input:t=Ro.stdin,output:e=Ro.stdout,overwrite:r=!0,hideCursor:n=!0}={}){let o=ln.createInterface({input:t,output:e,prompt:"",tabSize:1});ln.emitKeypressEvents(t,o),t.isTTY&&t.setRawMode(!0);let i=(a,{name:s,sequence:u})=>{let c=String(a);if(kf([c,s,u],"cancel")){n&&e.write(Dt.cursor.show),process.exit(0);return}if(!r)return;ln.moveCursor(e,s==="return"?0:-1,s==="return"?-1:0,()=>{ln.clearLine(e,1,()=>{t.once("keypress",i)})})};return n&&e.write(Dt.cursor.hide),t.once("keypress",i),()=>{t.off("keypress",i),n&&e.write(Dt.cursor.show),t.isTTY&&!qA&&t.setRawMode(!1),o.terminal=!1,o.close()}}var HA=Object.defineProperty,VA=(t,e,r)=>e in t?HA(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,zt=(t,e,r)=>(VA(t,typeof e!="symbol"?e+"":e,r),r),fa=class{constructor(e,r=!0){zt(this,"input"),zt(this,"output"),zt(this,"_abortSignal"),zt(this,"rl"),zt(this,"opts"),zt(this,"_render"),zt(this,"_track",!1),zt(this,"_prevFrame",""),zt(this,"_subscribers",new Map),zt(this,"_cursor",0),zt(this,"state","initial"),zt(this,"error",""),zt(this,"value");let{input:n=Ro.stdin,output:o=Ro.stdout,render:i,signal:a,...s}=e;this.opts=s,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=i.bind(this),this._track=r,this._abortSignal=a,this.input=n,this.output=o}unsubscribe(){this._subscribers.clear()}setSubscriber(e,r){let n=this._subscribers.get(e)??[];n.push(r),this._subscribers.set(e,n)}on(e,r){this.setSubscriber(e,{cb:r})}once(e,r){this.setSubscriber(e,{cb:r,once:!0})}emit(e,...r){let n=this._subscribers.get(e)??[],o=[];for(let i of n)i.cb(...r),i.once&&o.push(()=>n.splice(n.indexOf(i),1));for(let i of o)i()}prompt(){return new Promise((e,r)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),e(Ff);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let n=new _D.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=Sf.default.createInterface({input:this.input,output:n,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),Sf.default.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),qs(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(Dt.cursor.show),this.output.off("resize",this.render),qs(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(Dt.cursor.show),this.output.off("resize",this.render),qs(this.input,!1),e(Ff)})})}onKeypress(e,r){if(this.state==="error"&&(this.state="active"),r?.name&&(!this._track&&Hs.aliases.has(r.name)&&this.emit("cursor",Hs.aliases.get(r.name)),Hs.actions.has(r.name)&&this.emit("cursor",r.name)),e&&(e.toLowerCase()==="y"||e.toLowerCase()==="n")&&this.emit("confirm",e.toLowerCase()==="y"),e===" "&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),e&&this.emit("key",e.toLowerCase()),r?.name==="return"){if(this.opts.validate){let n=this.opts.validate(this.value);n&&(this.error=n instanceof Error?n.message:n,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}kf([e,r?.name,r?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
113
+ `),qs(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=CD(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
114
+ `).length-1;this.output.write(Dt.cursor.move(-999,e*-1))}render(){let e=CD(this._render(this)??"",process.stdout.columns,{hard:!0});if(e!==this._prevFrame){if(this.state==="initial")this.output.write(Dt.cursor.hide);else{let r=MA(this._prevFrame,e);if(this.restoreCursor(),r&&r?.length===1){let n=r[0];this.output.write(Dt.cursor.move(0,n)),this.output.write(Dt.erase.lines(1));let o=e.split(`
115
+ `);this.output.write(o[n]),this._prevFrame=e,this.output.write(Dt.cursor.move(0,o.length-n-1));return}if(r&&r?.length>1){let n=r[0];this.output.write(Dt.cursor.move(0,n)),this.output.write(Dt.erase.down());let o=e.split(`
116
116
  `).slice(n);this.output.write(o.join(`
117
- `)),this._prevFrame=e;return}this.output.write(vt.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}},lu=class extends _s{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 O$;O$=new WeakMap;var k$=Object.defineProperty,$$=(t,e,r)=>e in t?k$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,wy=(t,e,r)=>($$(t,typeof e!="symbol"?e+"":e,r),r),fu=class extends _s{constructor(e){super(e,!1),wy(this,"options"),wy(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 pu=class extends _s{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}${Ey.default.inverse(r)}${n.join("")}`}get cursor(){return this._cursor}constructor(e){super(e),this.on("finalize",()=>{this.value||(this.value=e.defaultValue)})}};var sr=be(require("node:process"),1),G=be(tp(),1),hu=be(Qf(),1);function P$(){return sr.default.platform!=="win32"?sr.default.env.TERM!=="linux":!!sr.default.env.CI||!!sr.default.env.WT_SESSION||!!sr.default.env.TERMINUS_SUBLIME||sr.default.env.ConEmuTask==="{cmd::Cmder}"||sr.default.env.TERM_PROGRAM==="Terminus-Sublime"||sr.default.env.TERM_PROGRAM==="vscode"||sr.default.env.TERM==="xterm-256color"||sr.default.env.TERM==="alacritty"||sr.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var cp=P$(),et=(t,e)=>cp?t:e,T$=et("\u25C6","*"),Oy=et("\u25A0","x"),ky=et("\u25B2","x"),pp=et("\u25C7","o"),R$=et("\u250C","T"),Ve=et("\u2502","|"),Ko=et("\u2514","\u2014"),lp=et("\u25CF",">"),fp=et("\u25CB"," "),bG=et("\u25FB","[\u2022]"),wG=et("\u25FC","[+]"),vG=et("\u25FB","[ ]"),EG=et("\u25AA","\u2022"),CG=et("\u2500","-"),_G=et("\u256E","+"),xG=et("\u251C","+"),SG=et("\u256F","+"),I$=et("\u25CF","\u2022"),B$=et("\u25C6","*"),N$=et("\u25B2","!"),L$=et("\u25A0","x"),dp=t=>{switch(t){case"initial":case"active":return G.default.cyan(T$);case"cancel":return G.default.red(Oy);case"error":return G.default.yellow(ky);case"submit":return G.default.green(pp)}},j$=t=>{let{cursor:e,options:r,style:n}=t,o=t.maxItems??Number.POSITIVE_INFINITY,i=Math.max(process.stdout.rows-4,0),s=Math.min(i,Math.max(o,5)),a=0;e>=a+s-3?a=Math.max(Math.min(e-s+3,r.length-s),0):e<a+2&&(a=Math.max(e-2,0));let u=s<r.length&&a>0,c=s<r.length&&a+s<r.length;return r.slice(a,a+s).map((l,f,h)=>{let d=f===0&&u,m=f===h.length-1&&c;return d||m?G.default.dim("..."):n(l,f+a===e)})},xr=t=>new pu({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,render(){let e=`${G.default.gray(Ve)}
118
- ${dp(this.state)} ${t.message}
117
+ `)),this._prevFrame=e;return}this.output.write(Dt.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}},Vs=class extends fa{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(e){super(e,!1),this.value=!!e.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",r=>{this.output.write(Dt.cursor.move(0,-1)),this.value=r,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};var zA;zA=new WeakMap;var GA=Object.defineProperty,WA=(t,e,r)=>e in t?GA(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ED=(t,e,r)=>(WA(t,typeof e!="symbol"?e+"":e,r),r),zs=class extends fa{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 Gs=class extends fa{get valueWithCursor(){if(this.state==="submit")return this.value;if(this.cursor>=this.value.length)return`${this.value}\u2588`;let e=this.value.slice(0,this.cursor),[r,...n]=this.value.slice(this.cursor);return`${e}${xD.default.inverse(r)}${n.join("")}`}get cursor(){return this._cursor}constructor(e){super(e),this.on("finalize",()=>{this.value||(this.value=e.defaultValue)})}};var Zt=ge(require("node:process"),1),G=ge(Ef(),1),Ks=ge(wf(),1);function KA(){return Zt.default.platform!=="win32"?Zt.default.env.TERM!=="linux":!!Zt.default.env.CI||!!Zt.default.env.WT_SESSION||!!Zt.default.env.TERMINUS_SUBLIME||Zt.default.env.ConEmuTask==="{cmd::Cmder}"||Zt.default.env.TERM_PROGRAM==="Terminus-Sublime"||Zt.default.env.TERM_PROGRAM==="vscode"||Zt.default.env.TERM==="xterm-256color"||Zt.default.env.TERM==="alacritty"||Zt.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var $f=KA(),Je=(t,e)=>$f?t:e,YA=Je("\u25C6","*"),PD=Je("\u25A0","x"),TD=Je("\u25B2","x"),If=Je("\u25C7","o"),JA=Je("\u250C","T"),Ue=Je("\u2502","|"),Bo=Je("\u2514","\u2014"),Pf=Je("\u25CF",">"),Tf=Je("\u25CB"," "),h7=Je("\u25FB","[\u2022]"),m7=Je("\u25FC","[+]"),g7=Je("\u25FB","[ ]"),D7=Je("\u25AA","\u2022"),y7=Je("\u2500","-"),b7=Je("\u256E","+"),v7=Je("\u251C","+"),w7=Je("\u256F","+"),XA=Je("\u25CF","\u2022"),ZA=Je("\u25C6","*"),QA=Je("\u25B2","!"),eO=Je("\u25A0","x"),Rf=t=>{switch(t){case"initial":case"active":return G.default.cyan(YA);case"cancel":return G.default.red(PD);case"error":return G.default.yellow(TD);case"submit":return G.default.green(If)}},tO=t=>{let{cursor:e,options:r,style:n}=t,o=t.maxItems??Number.POSITIVE_INFINITY,i=Math.max(process.stdout.rows-4,0),a=Math.min(i,Math.max(o,5)),s=0;e>=s+a-3?s=Math.max(Math.min(e-a+3,r.length-a),0):e<s+2&&(s=Math.max(e-2,0));let u=a<r.length&&s>0,c=a<r.length&&s+a<r.length;return r.slice(s,s+a).map((l,f,d)=>{let h=f===0&&u,m=f===d.length-1&&c;return h||m?G.default.dim("..."):n(l,f+s===e)})},mr=t=>new Gs({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,render(){let e=`${G.default.gray(Ue)}
118
+ ${Rf(this.state)} ${t.message}
119
119
  `,r=t.placeholder?G.default.inverse(t.placeholder[0])+G.default.dim(t.placeholder.slice(1)):G.default.inverse(G.default.hidden("_")),n=this.value?this.valueWithCursor:r;switch(this.state){case"error":return`${e.trim()}
120
- ${G.default.yellow(Ve)} ${n}
121
- ${G.default.yellow(Ko)} ${G.default.yellow(this.error)}
122
- `;case"submit":return`${e}${G.default.gray(Ve)} ${G.default.dim(this.value||t.placeholder)}`;case"cancel":return`${e}${G.default.gray(Ve)} ${G.default.strikethrough(G.default.dim(this.value??""))}${this.value?.trim()?`
123
- ${G.default.gray(Ve)}`:""}`;default:return`${e}${G.default.cyan(Ve)} ${n}
124
- ${G.default.cyan(Ko)}
125
- `}}}).prompt();var Ce=t=>{let e=t.active??"Yes",r=t.inactive??"No";return new lu({active:e,inactive:r,initialValue:t.initialValue??!0,render(){let n=`${G.default.gray(Ve)}
126
- ${dp(this.state)} ${t.message}
127
- `,o=this.value?e:r;switch(this.state){case"submit":return`${n}${G.default.gray(Ve)} ${G.default.dim(o)}`;case"cancel":return`${n}${G.default.gray(Ve)} ${G.default.strikethrough(G.default.dim(o))}
128
- ${G.default.gray(Ve)}`;default:return`${n}${G.default.cyan(Ve)} ${this.value?`${G.default.green(lp)} ${e}`:`${G.default.dim(fp)} ${G.default.dim(e)}`} ${G.default.dim("/")} ${this.value?`${G.default.dim(fp)} ${G.default.dim(r)}`:`${G.default.green(lp)} ${r}`}
129
- ${G.default.cyan(Ko)}
130
- `}}}).prompt()},Sr=t=>{let e=(r,n)=>{let o=r.label??String(r.value);switch(n){case"selected":return`${G.default.dim(o)}`;case"active":return`${G.default.green(lp)} ${o} ${r.hint?G.default.dim(`(${r.hint})`):""}`;case"cancelled":return`${G.default.strikethrough(G.default.dim(o))}`;default:return`${G.default.dim(fp)} ${G.default.dim(o)}`}};return new fu({options:t.options,initialValue:t.initialValue,render(){let r=`${G.default.gray(Ve)}
131
- ${dp(this.state)} ${t.message}
132
- `;switch(this.state){case"submit":return`${r}${G.default.gray(Ve)} ${e(this.options[this.cursor],"selected")}`;case"cancel":return`${r}${G.default.gray(Ve)} ${e(this.options[this.cursor],"cancelled")}
133
- ${G.default.gray(Ve)}`;default:return`${r}${G.default.cyan(Ve)} ${j$({cursor:this.cursor,options:this.options,maxItems:t.maxItems,style:(n,o)=>e(n,o?"active":"inactive")}).join(`
134
- ${G.default.cyan(Ve)} `)}
135
- ${G.default.cyan(Ko)}
136
- `}}}).prompt()};var Zn=(t="")=>{process.stdout.write(`${G.default.gray(Ko)} ${G.default.red(t)}
137
-
138
- `)},ee=(t="")=>{process.stdout.write(`${G.default.gray(R$)} ${t}
139
- `)},Z=(t="")=>{process.stdout.write(`${G.default.gray(Ve)}
140
- ${G.default.gray(Ko)} ${t}
141
-
142
- `)},p={message:(t="",{symbol:e=G.default.gray(Ve)}={})=>{let r=[`${G.default.gray(Ve)}`];if(t){let[n,...o]=t.split(`
143
- `);r.push(`${e} ${n}`,...o.map(i=>`${G.default.gray(Ve)} ${i}`))}process.stdout.write(`${r.join(`
120
+ ${G.default.yellow(Ue)} ${n}
121
+ ${G.default.yellow(Bo)} ${G.default.yellow(this.error)}
122
+ `;case"submit":return`${e}${G.default.gray(Ue)} ${G.default.dim(this.value||t.placeholder)}`;case"cancel":return`${e}${G.default.gray(Ue)} ${G.default.strikethrough(G.default.dim(this.value??""))}${this.value?.trim()?`
123
+ ${G.default.gray(Ue)}`:""}`;default:return`${e}${G.default.cyan(Ue)} ${n}
124
+ ${G.default.cyan(Bo)}
125
+ `}}}).prompt();var ve=t=>{let e=t.active??"Yes",r=t.inactive??"No";return new Vs({active:e,inactive:r,initialValue:t.initialValue??!0,render(){let n=`${G.default.gray(Ue)}
126
+ ${Rf(this.state)} ${t.message}
127
+ `,o=this.value?e:r;switch(this.state){case"submit":return`${n}${G.default.gray(Ue)} ${G.default.dim(o)}`;case"cancel":return`${n}${G.default.gray(Ue)} ${G.default.strikethrough(G.default.dim(o))}
128
+ ${G.default.gray(Ue)}`;default:return`${n}${G.default.cyan(Ue)} ${this.value?`${G.default.green(Pf)} ${e}`:`${G.default.dim(Tf)} ${G.default.dim(e)}`} ${G.default.dim("/")} ${this.value?`${G.default.dim(Tf)} ${G.default.dim(r)}`:`${G.default.green(Pf)} ${r}`}
129
+ ${G.default.cyan(Bo)}
130
+ `}}}).prompt()},gr=t=>{let e=(r,n)=>{let o=r.label??String(r.value);switch(n){case"selected":return`${G.default.dim(o)}`;case"active":return`${G.default.green(Pf)} ${o} ${r.hint?G.default.dim(`(${r.hint})`):""}`;case"cancelled":return`${G.default.strikethrough(G.default.dim(o))}`;default:return`${G.default.dim(Tf)} ${G.default.dim(o)}`}};return new zs({options:t.options,initialValue:t.initialValue,render(){let r=`${G.default.gray(Ue)}
131
+ ${Rf(this.state)} ${t.message}
132
+ `;switch(this.state){case"submit":return`${r}${G.default.gray(Ue)} ${e(this.options[this.cursor],"selected")}`;case"cancel":return`${r}${G.default.gray(Ue)} ${e(this.options[this.cursor],"cancelled")}
133
+ ${G.default.gray(Ue)}`;default:return`${r}${G.default.cyan(Ue)} ${tO({cursor:this.cursor,options:this.options,maxItems:t.maxItems,style:(n,o)=>e(n,o?"active":"inactive")}).join(`
134
+ ${G.default.cyan(Ue)} `)}
135
+ ${G.default.cyan(Bo)}
136
+ `}}}).prompt()};var Mn=(t="")=>{process.stdout.write(`${G.default.gray(Bo)} ${G.default.red(t)}
137
+
138
+ `)},Z=(t="")=>{process.stdout.write(`${G.default.gray(JA)} ${t}
139
+ `)},J=(t="")=>{process.stdout.write(`${G.default.gray(Ue)}
140
+ ${G.default.gray(Bo)} ${t}
141
+
142
+ `)},p={message:(t="",{symbol:e=G.default.gray(Ue)}={})=>{let r=[`${G.default.gray(Ue)}`];if(t){let[n,...o]=t.split(`
143
+ `);r.push(`${e} ${n}`,...o.map(i=>`${G.default.gray(Ue)} ${i}`))}process.stdout.write(`${r.join(`
144
144
  `)}
145
- `)},info:t=>{p.message(t,{symbol:G.default.blue(I$)})},success:t=>{p.message(t,{symbol:G.default.green(B$)})},step:t=>{p.message(t,{symbol:G.default.green(pp)})},warn:t=>{p.message(t,{symbol:G.default.yellow(N$)})},warning:t=>{p.warn(t)},error:t=>{p.message(t,{symbol:G.default.red(L$)})}},AG=`${G.default.gray(Ve)} `;var Se=({indicator:t="dots"}={})=>{let e=cp?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],r=cp?80:120,n=process.env.CI==="true",o,i,s=!1,a="",u,c=performance.now(),l=x=>{let S=x>1?"Something went wrong":"Canceled";s&&g(S,x)},f=()=>l(2),h=()=>l(1),d=()=>{process.on("uncaughtExceptionMonitor",f),process.on("unhandledRejection",f),process.on("SIGINT",h),process.on("SIGTERM",h),process.on("exit",l)},m=()=>{process.removeListener("uncaughtExceptionMonitor",f),process.removeListener("unhandledRejection",f),process.removeListener("SIGINT",h),process.removeListener("SIGTERM",h),process.removeListener("exit",l)},b=()=>{if(u===void 0)return;n&&process.stdout.write(`
146
- `);let x=u.split(`
147
- `);process.stdout.write(hu.cursor.move(-999,x.length-1)),process.stdout.write(hu.erase.down(x.length))},D=x=>x.replace(/\.+$/,""),E=x=>{let S=(performance.now()-x)/1e3,T=Math.floor(S/60),O=Math.floor(S%60);return T>0?`[${T}m ${O}s]`:`[${O}s]`},_=(x="")=>{s=!0,o=Fy(),a=D(x),c=performance.now(),process.stdout.write(`${G.default.gray(Ve)}
148
- `);let S=0,T=0;d(),i=setInterval(()=>{if(n&&a===u)return;b(),u=a;let O=G.default.magenta(e[S]);if(n)process.stdout.write(`${O} ${a}...`);else if(t==="timer")process.stdout.write(`${O} ${a} ${E(c)}`);else{let B=".".repeat(Math.floor(T)).slice(0,3);process.stdout.write(`${O} ${a}${B}`)}S=S+1<e.length?S+1:0,T=T<e.length?T+.125:0},r)},g=(x="",S=0)=>{s=!1,clearInterval(i),b();let T=S===0?G.default.green(pp):S===1?G.default.red(Oy):G.default.red(ky);a=D(x??a),t==="timer"?process.stdout.write(`${T} ${a} ${E(c)}
149
- `):process.stdout.write(`${T} ${a}
150
- `),m(),o()};return{start:_,stop:g,message:(x="")=>{a=D(x??a)}}};var Qe=require("node:fs"),Jl=require("node:os"),Ze=be(require("node:path")),gr=require("node:process"),zr=be(gu());var kt=require("fs"),Ss=(t=".",e="unknown")=>{let r=`${t}/bun.lockb`,n=`${t}/bun.lock`,o=`${t}/pnpm-lock.yaml`,i=`${t}/shrinkwrap.yaml`,s=`${t}/yarn.lock`,a=`${t}/package-lock.json`,u=`${t}/npm-shrinkwrap.json`;return(0,kt.existsSync)(r)||(0,kt.existsSync)(n)?"bun":(0,kt.existsSync)(o)||(0,kt.existsSync)(i)?"pnpm":(0,kt.existsSync)(s)?"yarn":(0,kt.existsSync)(a)||(0,kt.existsSync)(u)?"npm":e},Du=(t=Ss(),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"}},$y=(t=".",e="npx")=>{let r=`${t}/bun.lockb`,n=`${t}/bun.lock`,o=`${t}/pnpm-lock.yaml`,i=`${t}/shrinkwrap.yaml`,s=`${t}/yarn.lock`,a=`${t}/package-lock.json`,u=`${t}/npm-shrinkwrap.json`;return(0,kt.existsSync)(r)||(0,kt.existsSync)(n)?"bunx":(0,kt.existsSync)(o)||(0,kt.existsSync)(i)?"pnpm exec":(0,kt.existsSync)(s)?"yarn dlx":(0,kt.existsSync)(a)||(0,kt.existsSync)(u)?"npx":e};function yu(t,e){if(isNaN(t)||isNaN(e))throw new Error("Cannot compare against non-numbers");return t===e?0:t<e?-1:1}function Ry(t=[],e=[]){return t.length&&!e.length?-1:!t.length&&e.length?1:0}function Dp(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 Xo="0|[1-9]\\d*",H$="\\d*[a-zA-Z-][a-zA-Z0-9-]*",V$=`(?<major>${Xo})\\.(?<minor>${Xo})\\.(?<patch>${Xo})`,Py=`(?:${Xo}|${H$})`,Iy=`(?:-(?<prerelease>${Py}(?:\\.${Py})*))`,Ty="[0-9A-Za-z-]+",By=`(?:\\+(?<buildmetadata>${Ty}(?:\\.${Ty})*))`,Ny=`v?${V$}${Iy}?${By}?`,Ly=new RegExp(`^${Ny}$`),jy="(?:<|>)?=?",z$="x|X|\\*",gp=`${Xo}|${z$}`,bu=`[v=\\s]*(?<major>${gp})(?:\\.(?<minor>${gp})(?:\\.(?<patch>${gp})${Iy}?${By}?)?)?`,Uy=new RegExp(`^(?<operator>~>?|\\^|${jy})\\s*${bu}$`),My=new RegExp(`^(?<operator>${jy})\\s*(${Ny})$|^$`);function yp(t){return typeof t=="number"&&!Number.isNaN(t)&&(!Number.isFinite(t)||0<=t&&t<=Number.MAX_SAFE_INTEGER)}var bp=256;var G$=new RegExp(`^${Xo}$`);function $t(t){return t.split(".").filter(Boolean).map(e=>{if(G$.test(e)){let r=Number(e);if(yp(r))return r}return e})}function Ar(t){return t.split(".").filter(Boolean)}function Cn(t,e){let r=Number(t);if(!yp(r))throw new TypeError(e);return r}function en(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 Pt(t,e){return t===e?0:yu(t.major,e.major)||yu(t.minor,e.minor)||yu(t.patch,e.patch)||Ry(t.prerelease,e.prerelease)||Dp(t.prerelease,e.prerelease)}function wp(t){return t.toFixed(0)}function Fr(t){let e=wp(t.major),r=wp(t.minor),n=wp(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 W$(t,e){if(en(e))return!0;let r=Pt(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 wu(t,e){for(let r of e)if(!W$(t,r))return!1;if(t.prerelease&&t.prerelease.length>0){for(let r of e){if(en(r))continue;let{major:n,minor:o,patch:i,prerelease:s}=r;if(s&&s.length>0&&t.major===n&&t.minor===o&&t.patch===i)return!0}return!1}return!0}function As(t,e){return e.some(r=>wu(t,r))}function K$(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 Fs(t=[],e){let r=K$(t);if(!e)return r;let n=$t(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 Os(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:Fs(t.prerelease,r.prerelease),build:n};case"preminor":return{major:t.major,minor:t.minor+1,patch:0,prerelease:Fs(t.prerelease,r.prerelease),build:n};case"prepatch":return{major:t.major,minor:t.minor,patch:t.patch+1,prerelease:Fs(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:Fs(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:Fs(t.prerelease,r.prerelease),build:n};default:throw new TypeError(`Cannot increment version: invalid argument ${e}`)}}var vu={major:Number.NaN,minor:Number.NaN,patch:Number.NaN,prerelease:[],build:[]},Yo={operator:void 0,...vu};function vp(t,e){return Pt(t,e)>0}function Qn(t,e){return Pt(t,e)<0}function X$(t){let r=t.match(My)?.groups;if(!r)return null;let{operator:n,prerelease:o,buildmetadata:i}=r,s=r.major?{major:Cn(r.major,`Cannot parse comparator ${t}: invalid major version`),minor:Cn(r.minor,`Cannot parse comparator ${t}: invalid minor version`),patch:Cn(r.patch,`Cannot parse comparator ${t}: invalid patch version`),prerelease:o?$t(o):[],build:i?Ar(i):[]}:vu;return{operator:n||void 0,...s}}function Re(t){return!t||t.toLowerCase()==="x"||t==="*"}function Y$(t){if(!Re(t.major))return Re(t.minor)?{operator:">=",major:+t.major,minor:0,patch:0,prerelease:[],build:[]}:Re(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?$t(t.prerelease):[],build:[]}}function J$(t){if(!Re(t.major))return Re(t.minor)?{operator:"<",major:+t.major+1,minor:0,patch:0,prerelease:[],build:[]}:Re(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:$t(t.prerelease),build:[]}:{operator:"<=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:[],build:[]}}function Z$(t){let e=t.match(new RegExp(`^${bu}`)),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,a=t.slice(n+i).match(new RegExp(`^${bu}\\s*$`))?.groups;if(!a)return null;let u=Y$(r),c=J$(a);return[u,c].filter(Boolean)}function Q$(t){let e=Re(t.major),r=Re(t.minor),n=Re(t.patch),o=+t.major,i=+t.minor,s=+t.patch;if(e)return[Yo];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 a=$t(t.prerelease??"");return o===0?i===0?[{operator:">=",major:o,minor:i,patch:s,prerelease:a},{operator:"<",major:o,minor:i,patch:s+1}]:[{operator:">=",major:o,minor:i,patch:s,prerelease:a},{operator:"<",major:o,minor:i+1,patch:0}]:[{operator:">=",major:o,minor:i,patch:s,prerelease:a},{operator:"<",major:o+1,minor:0,patch:0}]}function e3(t){let e=Re(t.major),r=Re(t.minor),n=Re(t.patch),o=+t.major,i=+t.minor,s=+t.patch;if(e)return[Yo];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 a=$t(t.prerelease??"");return[{operator:">=",major:o,minor:i,patch:s,prerelease:a},{operator:"<",major:o,minor:i+1,patch:0}]}function t3(t){let e=Re(t.major),r=Re(t.minor),n=Re(t.patch),o=+t.major,i=+t.minor,s=+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 a=$t(t.prerelease??""),u=Ar(t.build??"");return[{operator:"<",major:o,minor:i,patch:s,prerelease:a,build:u}]}function r3(t){let e=Re(t.minor),r=Re(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 s=$t(t.prerelease??""),a=Ar(t.build??"");return[{operator:"<=",major:n,minor:o,patch:i,prerelease:s,build:a}]}function n3(t){let e=Re(t.major),r=Re(t.minor),n=Re(t.patch),o=+t.major,i=+t.minor,s=+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 a=$t(t.prerelease??""),u=Ar(t.build??"");return[{operator:">",major:o,minor:i,patch:s,prerelease:a,build:u}]}function o3(t){let e=Re(t.major),r=Re(t.minor),n=Re(t.patch),o=+t.major,i=+t.minor,s=+t.patch;if(e)return[Yo];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 a=$t(t.prerelease??""),u=Ar(t.build??"");return[{operator:">=",major:o,minor:i,patch:s,prerelease:a,build:u}]}function i3(t){let e=Re(t.major),r=Re(t.minor),n=Re(t.patch),o=+t.major,i=+t.minor,s=+t.patch;if(e)return[Yo];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 a=$t(t.prerelease??""),u=Ar(t.build??"");return[{operator:void 0,major:o,minor:i,patch:s,prerelease:a,build:u}]}function s3(t){let e=t.match(Uy)?.groups;if(!e)return X$(t);switch(e.operator){case"^":return Q$(e);case"~":case"~>":return e3(e);case"<":return t3(e);case"<=":return r3(e);case">":return n3(e);case">=":return o3(e);case"=":case"":return i3(e);default:throw new Error(`Cannot parse version range: '${e.operator}' is not a valid operator`)}}function a3(t){return t.split(/\s+/).flatMap(s3)}function Eu(t){let e=t.replaceAll(/(?<=<|>|=|~|\^)(\s+)/g,"").split(/\s*\|\|\s*/).map(r=>Z$(r)||a3(r));if(e.some(r=>r.includes(null)))throw new TypeError(`Cannot parse version range: range "${t}" is invalid`);return e}function Ae(t){if(typeof t!="string")throw new TypeError(`Cannot parse version as version must be a string: received ${typeof t}`);if(t.length>bp)throw new TypeError(`Cannot parse version as version length is too long: length is ${t.length}, max length is ${bp}`);t=t.trim();let e=t.match(Ly)?.groups;if(!e)throw new TypeError(`Cannot parse version: ${t}`);let r=Cn(e.major,`Cannot parse version ${t}: invalid major version`),n=Cn(e.minor,`Cannot parse version ${t}: invalid minor version`),o=Cn(e.patch,`Cannot parse version ${t}: invalid patch version`),i=e.prerelease?$t(e.prerelease):[],s=e.buildmetadata?Ar(e.buildmetadata):[];return{major:r,minor:n,patch:o,prerelease:i,build:s}}function qy(t,e){let r=t.operator,n=e.operator;if(r===void 0)return en(t)?!0:As(t,[[e]]);if(n===void 0)return en(e)?!0:As(e,[[t]]);let o=Pt(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 u3(t){return t.every(e=>e.some(r=>c3(r)))}function c3(t){for(let e=0;e<t.length-1;e++){let r=t[e];for(let n of t.slice(e+1))if(!qy(r,n))return!1}return!0}function Hy(t,e){return u3([t,e])&&t.some(r=>e.some(n=>r.every(o=>n.every(i=>qy(o,i)))))}function Vy(t){try{return Ae(t),!0}catch{return!1}}function _n(t,e){return Pt(t,e)>=0}var ns=be(tb()),Jg=be(Rb()),_F=be(fw()),Zl=be(gm());var Dm=require("node:buffer"),CC=require("node:crypto"),OL=(()=>{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 kL(t){let e=4294967295;for(let r=0;r<t.length;r++){let n=t[r];e=OL[(e^n)&255]^e>>>8}return e=e^4294967295,(e>>>0).toString(16).padStart(8,"0")}async function un(t,e="sha256"){let r=Dm.Buffer.isBuffer(t)?t:Dm.Buffer.from(t);if(e==="crc32")return kL(r);let n=(0,CC.createHash)(e);return n.update(r),n.digest("hex")}var Ia=be(qA());async function HA(){let t=await(0,Ia.loadConfig)();return{config:t.app.extConfig,path:t.app.extConfigFilePath}}async function Fg(t,e,r=!1){let n=await(0,Ia.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,Ia.writeConfig)(o,n.app.extConfigFilePath))}async function Qi(t,e=!1){await Fg("CapacitorUpdater",t,e)}var os=".capgo_key",tr=".capgo_key_v2",Ql=`${os}.pub`,pn=`${tr}.pub`,yF="https://capgo.app",bF="https://files.capgo.app",wF="https://api.capgo.app",vF="https://console.capgo.app",Zg=12e4,P7=1024*1024*20,T7=1024*1024*1024,R7=1024*1024*99,xt="package.json",is=/^(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,j=t=>t?`
151
- ${_F.default.render(t)}`:"";function Yl(t){return new Promise(e=>{setTimeout(e,t)})}function xF(t){return(0,zr.isMonorepo)(t)||(0,zr.isNXMonorepo)(t)}function St(t){return(0,zr.isMonorepo)(t)?(0,zr.findMonorepoRoot)(t):(0,zr.isNXMonorepo)(t)?(0,zr.findNXMonorepoRoot)(t):t}function SF(t=St((0,gr.cwd)()),e=void 0){let r=e?.split(",")[0];if(r&&!(0,Qe.existsSync)(r)){let o=`Package.json at ${r} does not exist`;throw p.error(o),new Error(o)}let n=(0,Qe.readFileSync)(r??(0,Ze.join)(t,xt));return JSON.parse(n)}function Qg(t=St((0,gr.cwd)()),e=void 0){return SF(t,e).scripts}function Rr(t=St((0,gr.cwd)()),e=void 0){return SF(t,e).version??""}function EF(t){let e=t.replace("^","").replace("~","");if(Vy(e))try{let r=Ae(e);return Fr(r)}catch{return e}return e}async function dt(t=St((0,gr.cwd)()),e=void 0){let r=e?.split(",");if(r??=[(0,Ze.join)(t,xt)],r){for(let o of r)if(!(0,Qe.existsSync)(o)){let i=`Package.json at ${o} does not exist`;throw p.error(i),new Error(i)}}let n=new Map;for(let o of r){let i=(0,Qe.readFileSync)(o),s=JSON.parse(i);for(let a in s.dependencies)n.set(a,EF(s.dependencies[a]));for(let a in s.devDependencies)n.set(a,EF(s.devDependencies[a]))}return n}async function ne(){try{let t=await HA();if(!t){let e="No capacitor config file found, run `cap init` first";throw p.error(e),new Error(e)}return t}catch(t){let e=`No capacitor config file found, run \`cap init\` first ${j(t)}`;throw p.error(e),new Error(e)}}async function eD(t,e){let r=await ne();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 ja(t){return eD("CapacitorUpdater",t)}async function Dr(){try{let t=await ne(),e={host:t?.config?.plugins?.CapacitorUpdater?.localHost||yF,hostWeb:t?.config?.plugins?.CapacitorUpdater?.localWebHost||vF,hostFilesApi:t?.config?.plugins?.CapacitorUpdater?.localApiFiles||bF,hostApi:t?.config?.plugins?.CapacitorUpdater?.localApi||wF};return t?.config?.plugins?.CapacitorUpdater?.localSupa&&t?.config?.plugins?.CapacitorUpdater?.localSupaAnon&&(p.info("Using custom supabase instance from capacitor.config.json"),e.supaKey=t?.config?.plugins?.CapacitorUpdater?.localSupaAnon,e.supaHost=t?.config?.plugins?.CapacitorUpdater?.localSupa),e}catch{return{host:yF,hostWeb:vF,hostFilesApi:bF,hostApi:wF}}}var I7=/([A-Za-z0-9]+)\.(java|swift|kt|scala)$/;async function ef(){let t=await Dr();try{let e=await fetch(`${t.hostApi}/private/config`);if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return{...await e.json(),...t}}catch{return p.info(`Local config ${j(t)}`),t}}async function AF(){let t=await Dr();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:T7,maxChunkSize:R7,alertUploadSize:P7}}}async function ie(t,e,r){let n=await ef();if(e&&r&&(p.info("Using custom supabase instance from provided options"),n.supaHost=e,n.supaKey=r),!n.supaHost||!n.supaKey)throw p.error("Cannot connect to server please try again later"),new Error("Cannot connect to server please try again later");return(0,ns.createClient)(n.supaHost,n.supaKey,{auth:{persistSession:!1},global:{headers:{capgkey:t}}})}async function B7(t,e,r){let{data:n}=await t.rpc("is_allowed_capgkey",{apikey:e,keymode:r}).single();if(!n){p.error("Invalid API key or insufficient permissions.");let i=`Your key should be: ${r.map((s,a)=>r.length===1?`"${s}"`:a===r.length-1?`or "${s}"`:`"${s}", `).join("")} mode.`;throw p.error(i),new Error("Invalid API key or insufficient permissions.")}}async function FF(t,e){let{data:r}=await t.rpc("is_paying_org",{orgid:e}).single();return r||!1}async function OF(t,e){let{data:r}=await t.rpc("is_trial_org",{orgid:e}).single();return r||0}async function N7(t,e){let{data:r}=await t.rpc("is_allowed_action_org",{orgid:e}).single();return!!r}async function L7(t,e,r){let{data:n}=await t.rpc("is_allowed_action",{apikey:r,appid:e}).single();return!!n}var At=(s=>(s[s.none=0]="none",s[s.read=1]="read",s[s.upload=2]="upload",s[s.write=3]="write",s[s.admin=4]="admin",s[s.super_admin=5]="super_admin",s))(At||{}),ss=(t,e)=>t>=e;async function kF(t,e,r){let{data:n,error:o}=await t.rpc("get_org_perm_for_apikey",{apikey:e,app_id:r}).single();if(o)throw p.error("Cannot get permissions for organization!"),console.error(o),new Error("Cannot get permissions for organization");if(n.includes("perm")){let a=null;switch(n){case"perm_none":{a=0;break}case"perm_read":{a=1;break}case"perm_upload":{a=2;break}case"perm_write":{a=3;break}case"perm_admin":{a=4;break}case"perm_owner":{a=5;break}default:throw n.includes("invite")?(p.info("Please accept/deny the organization invitation before trying to access the app"),new Error("Organization invitation pending")):(p.error(`Invalid output when fetching organization permission. Response: ${n}`),new Error(`Invalid output when fetching organization permission. Response: ${n}`))}return{okay:!0,data:a}}let s=null;switch(n){case"INVALID_APIKEY":{s="INVALID_APIKEY";break}case"NO_APP":{s="NO_APP";break}case"NO_ORG":{s="NO_ORG";break}default:throw p.error(`Invalid error when fetching organization permission. Response: ${n}`),new Error(`Invalid error when fetching organization permission. Response: ${n}`)}return{okay:!1,error:s}}async function $F(t,e,r){let{data:n,error:o}=await t.rpc("get_organization_cli_warnings",{orgid:e,cli_version:r});if(o){p.error(`Cannot get cli warnings: ${j(o)}`);return}if(n.length>0){p.warn(`Found ${n.length} cli warnings for your organization.`);let i=null;for(let s of n){if(typeof s!="object"||typeof s.message!="string"||typeof s.fatal!="boolean"){p.error(`Invalid cli warning: ${s}`);continue}let a=s;a.fatal?(p.error(`${a.message.replaceAll("\\n",`
152
- `)}`),i=new Error(a.message)):p.warn(`${a.message.replaceAll("\\n",`
153
- `)}`)}if(i)throw p.error("Please fix the warnings and try again."),i;p.info("End of cli warnings.")}}async function PF(t,e,r,n,o=!0){let i=await ef();if(!await(n?L7(t,n,r):N7(t,e)))throw p.error(`You need to upgrade your plan to continue to use capgo.
145
+ `)},info:t=>{p.message(t,{symbol:G.default.blue(XA)})},success:t=>{p.message(t,{symbol:G.default.green(ZA)})},step:t=>{p.message(t,{symbol:G.default.green(If)})},warn:t=>{p.message(t,{symbol:G.default.yellow(QA)})},warning:t=>{p.warn(t)},error:t=>{p.message(t,{symbol:G.default.red(eO)})}},C7=`${G.default.gray(Ue)} `;var Ee=({indicator:t="dots"}={})=>{let e=$f?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],r=$f?80:120,n=process.env.CI==="true",o,i,a=!1,s="",u,c=performance.now(),l=_=>{let S=_>1?"Something went wrong":"Canceled";a&&g(S,_)},f=()=>l(2),d=()=>l(1),h=()=>{process.on("uncaughtExceptionMonitor",f),process.on("unhandledRejection",f),process.on("SIGINT",d),process.on("SIGTERM",d),process.on("exit",l)},m=()=>{process.removeListener("uncaughtExceptionMonitor",f),process.removeListener("unhandledRejection",f),process.removeListener("SIGINT",d),process.removeListener("SIGTERM",d),process.removeListener("exit",l)},b=()=>{if(u===void 0)return;n&&process.stdout.write(`
146
+ `);let _=u.split(`
147
+ `);process.stdout.write(Ks.cursor.move(-999,_.length-1)),process.stdout.write(Ks.erase.down(_.length))},D=_=>_.replace(/\.+$/,""),C=_=>{let S=(performance.now()-_)/1e3,T=Math.floor(S/60),O=Math.floor(S%60);return T>0?`[${T}m ${O}s]`:`[${O}s]`},E=(_="")=>{a=!0,o=$D(),s=D(_),c=performance.now(),process.stdout.write(`${G.default.gray(Ue)}
148
+ `);let S=0,T=0;h(),i=setInterval(()=>{if(n&&s===u)return;b(),u=s;let O=G.default.magenta(e[S]);if(n)process.stdout.write(`${O} ${s}...`);else if(t==="timer")process.stdout.write(`${O} ${s} ${C(c)}`);else{let B=".".repeat(Math.floor(T)).slice(0,3);process.stdout.write(`${O} ${s}${B}`)}S=S+1<e.length?S+1:0,T=T<e.length?T+.125:0},r)},g=(_="",S=0)=>{a=!1,clearInterval(i),b();let T=S===0?G.default.green(If):S===1?G.default.red(PD):G.default.red(TD);s=D(_??s),t==="timer"?process.stdout.write(`${T} ${s} ${C(c)}
149
+ `):process.stdout.write(`${T} ${s}
150
+ `),m(),o()};return{start:E,stop:g,message:(_="")=>{s=D(_??s)}}};var Ye=require("node:fs"),bl=require("node:os"),Ke=ge(require("node:path")),ar=require("node:process"),Ir=ge(Js());var _t=require("fs"),da=(t=".",e="unknown")=>{let r=`${t}/bun.lockb`,n=`${t}/bun.lock`,o=`${t}/pnpm-lock.yaml`,i=`${t}/shrinkwrap.yaml`,a=`${t}/yarn.lock`,s=`${t}/package-lock.json`,u=`${t}/npm-shrinkwrap.json`;return(0,_t.existsSync)(r)||(0,_t.existsSync)(n)?"bun":(0,_t.existsSync)(o)||(0,_t.existsSync)(i)?"pnpm":(0,_t.existsSync)(a)?"yarn":(0,_t.existsSync)(s)||(0,_t.existsSync)(u)?"npm":e},Xs=(t=da(),e=!1)=>{switch(t){case"bun":return e?"bun install":"install";case"pnpm":return e?"pnpm install":"install";case"yarn":return e?"yarn install":"install";case"npm":return e?"npm install":"install";case"unknown":return e?"unknown unknown":"unknown";default:return e?"npm install":"install"}},ID=(t=".",e="npx")=>{let r=`${t}/bun.lockb`,n=`${t}/bun.lock`,o=`${t}/pnpm-lock.yaml`,i=`${t}/shrinkwrap.yaml`,a=`${t}/yarn.lock`,s=`${t}/package-lock.json`,u=`${t}/npm-shrinkwrap.json`;return(0,_t.existsSync)(r)||(0,_t.existsSync)(n)?"bunx":(0,_t.existsSync)(o)||(0,_t.existsSync)(i)?"pnpm exec":(0,_t.existsSync)(a)?"yarn dlx":(0,_t.existsSync)(s)||(0,_t.existsSync)(u)?"npx":e};function Zs(t,e){if(isNaN(t)||isNaN(e))throw new Error("Cannot compare against non-numbers");return t===e?0:t<e?-1:1}function jD(t=[],e=[]){return t.length&&!e.length?-1:!t.length&&e.length?1:0}function Lf(t=[],e=[]){let r=Math.max(t.length,e.length);for(let n=0;n<r;n++){let o=t[n],i=e[n];if(o===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(o===void 0)return-1;if(typeof o=="string"&&typeof i=="number")return 1;if(typeof o=="number"&&typeof i=="string"||o<i)return-1;if(o>i)return 1}return 0}var jo="0|[1-9]\\d*",iO="\\d*[a-zA-Z-][a-zA-Z0-9-]*",aO=`(?<major>${jo})\\.(?<minor>${jo})\\.(?<patch>${jo})`,RD=`(?:${jo}|${iO})`,ND=`(?:-(?<prerelease>${RD}(?:\\.${RD})*))`,BD="[0-9A-Za-z-]+",LD=`(?:\\+(?<buildmetadata>${BD}(?:\\.${BD})*))`,UD=`v?${aO}${ND}?${LD}?`,MD=new RegExp(`^${UD}$`),qD="(?:<|>)?=?",sO="x|X|\\*",Nf=`${jo}|${sO}`,Qs=`[v=\\s]*(?<major>${Nf})(?:\\.(?<minor>${Nf})(?:\\.(?<patch>${Nf})${ND}?${LD}?)?)?`,HD=new RegExp(`^(?<operator>~>?|\\^|${qD})\\s*${Qs}$`),VD=new RegExp(`^(?<operator>${qD})\\s*(${UD})$|^$`);function Uf(t){return typeof t=="number"&&!Number.isNaN(t)&&(!Number.isFinite(t)||0<=t&&t<=Number.MAX_SAFE_INTEGER)}var Mf=256;var uO=new RegExp(`^${jo}$`);function xt(t){return t.split(".").filter(Boolean).map(e=>{if(uO.test(e)){let r=Number(e);if(Uf(r))return r}return e})}function Dr(t){return t.split(".").filter(Boolean)}function pn(t,e){let r=Number(t);if(!Uf(r))throw new TypeError(e);return r}function Vr(t){return Number.isNaN(t.major)&&Number.isNaN(t.minor)&&Number.isNaN(t.patch)&&(t.prerelease===void 0||t.prerelease.length===0)&&(t.build===void 0||t.build.length===0)}function St(t,e){return t===e?0:Zs(t.major,e.major)||Zs(t.minor,e.minor)||Zs(t.patch,e.patch)||jD(t.prerelease,e.prerelease)||Lf(t.prerelease,e.prerelease)}function qf(t){return t.toFixed(0)}function yr(t){let e=qf(t.major),r=qf(t.minor),n=qf(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 cO(t,e){if(Vr(e))return!0;let r=St(t,e);switch(e.operator){case"=":case void 0:return r===0;case"!=":return r!==0;case">":return r>0;case"<":return r<0;case">=":return r>=0;case"<=":return r<=0}}function eu(t,e){for(let r of e)if(!cO(t,r))return!1;if(t.prerelease&&t.prerelease.length>0){for(let r of e){if(Vr(r))continue;let{major:n,minor:o,patch:i,prerelease:a}=r;if(a&&a.length>0&&t.major===n&&t.minor===o&&t.patch===i)return!0}return!1}return!0}function ha(t,e){return e.some(r=>eu(t,r))}function lO(t=[]){let e=[...t],r=e.length;for(;r>=0;){let n=e[r];if(typeof n=="number"){e[r]=n+1;break}r-=1}return r===-1&&e.push(0),e}function ma(t=[],e){let r=lO(t);if(!e)return r;let n=xt(e);if(n.every(o=>typeof o=="string")){if(n.every((o,i)=>o===r[i])&&typeof r[n.length]=="number")return r;n=[...n,0]}return n}function ga(t,e,r={}){let n=r.build!==void 0?Dr(r.build):t.build??[];switch(e){case"premajor":return{major:t.major+1,minor:0,patch:0,prerelease:ma(t.prerelease,r.prerelease),build:n};case"preminor":return{major:t.major,minor:t.minor+1,patch:0,prerelease:ma(t.prerelease,r.prerelease),build:n};case"prepatch":return{major:t.major,minor:t.minor,patch:t.patch+1,prerelease:ma(t.prerelease,r.prerelease),build:n};case"prerelease":{let i=(t.prerelease??[]).length===0?t.patch+1:t.patch;return{major:t.major,minor:t.minor,patch:i,prerelease:ma(t.prerelease,r.prerelease),build:n}}case"major":return{major:(t.prerelease??[]).length===0||t.minor!==0||t.patch!==0?t.major+1:t.major,minor:0,patch:0,prerelease:[],build:n};case"minor":{let i=(t.prerelease??[]).length===0||t.patch!==0?t.minor+1:t.minor;return{major:t.major,minor:i,patch:0,prerelease:[],build:n}}case"patch":{let i=(t.prerelease??[]).length===0?t.patch+1:t.patch;return{major:t.major,minor:t.minor,patch:i,prerelease:[],build:n}}case"pre":return{major:t.major,minor:t.minor,patch:t.patch,prerelease:ma(t.prerelease,r.prerelease),build:n};default:throw new TypeError(`Cannot increment version: invalid argument ${e}`)}}var tu={major:Number.NaN,minor:Number.NaN,patch:Number.NaN,prerelease:[],build:[]},No={operator:void 0,...tu};function Hf(t,e){return St(t,e)>0}function qn(t,e){return St(t,e)<0}function fO(t){let r=t.match(VD)?.groups;if(!r)return null;let{operator:n,prerelease:o,buildmetadata:i}=r,a=r.major?{major:pn(r.major,`Cannot parse comparator ${t}: invalid major version`),minor:pn(r.minor,`Cannot parse comparator ${t}: invalid minor version`),patch:pn(r.patch,`Cannot parse comparator ${t}: invalid patch version`),prerelease:o?xt(o):[],build:i?Dr(i):[]}:tu;return{operator:n||void 0,...a}}function $e(t){return!t||t.toLowerCase()==="x"||t==="*"}function pO(t){if(!$e(t.major))return $e(t.minor)?{operator:">=",major:+t.major,minor:0,patch:0,prerelease:[],build:[]}:$e(t.patch)?{operator:">=",major:+t.major,minor:+t.minor,patch:0,prerelease:[],build:[]}:{operator:">=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:t.prerelease?xt(t.prerelease):[],build:[]}}function dO(t){if(!$e(t.major))return $e(t.minor)?{operator:"<",major:+t.major+1,minor:0,patch:0,prerelease:[],build:[]}:$e(t.patch)?{operator:"<",major:+t.major,minor:+t.minor+1,patch:0,prerelease:[],build:[]}:t.prerelease?{operator:"<=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:xt(t.prerelease),build:[]}:{operator:"<=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:[],build:[]}}function hO(t){let e=t.match(new RegExp(`^${Qs}`)),r=e?.groups;if(!r)return null;let n=e[0].length,o=t.slice(n).match(/^\s+-\s+/);if(!o)return null;let i=o[0].length,s=t.slice(n+i).match(new RegExp(`^${Qs}\\s*$`))?.groups;if(!s)return null;let u=pO(r),c=dO(s);return[u,c].filter(Boolean)}function mO(t){let e=$e(t.major),r=$e(t.minor),n=$e(t.patch),o=+t.major,i=+t.minor,a=+t.patch;if(e)return[No];if(r)return[{operator:">=",major:o,minor:0,patch:0},{operator:"<",major:o+1,minor:0,patch:0}];if(n)return o===0?[{operator:">=",major:o,minor:i,patch:0},{operator:"<",major:o,minor:i+1,patch:0}]:[{operator:">=",major:o,minor:i,patch:0},{operator:"<",major:o+1,minor:0,patch:0}];let s=xt(t.prerelease??"");return o===0?i===0?[{operator:">=",major:o,minor:i,patch:a,prerelease:s},{operator:"<",major:o,minor:i,patch:a+1}]:[{operator:">=",major:o,minor:i,patch:a,prerelease:s},{operator:"<",major:o,minor:i+1,patch:0}]:[{operator:">=",major:o,minor:i,patch:a,prerelease:s},{operator:"<",major:o+1,minor:0,patch:0}]}function gO(t){let e=$e(t.major),r=$e(t.minor),n=$e(t.patch),o=+t.major,i=+t.minor,a=+t.patch;if(e)return[No];if(r)return[{operator:">=",major:o,minor:0,patch:0},{operator:"<",major:o+1,minor:0,patch:0}];if(n)return[{operator:">=",major:o,minor:i,patch:0},{operator:"<",major:o,minor:i+1,patch:0}];let s=xt(t.prerelease??"");return[{operator:">=",major:o,minor:i,patch:a,prerelease:s},{operator:"<",major:o,minor:i+1,patch:0}]}function DO(t){let e=$e(t.major),r=$e(t.minor),n=$e(t.patch),o=+t.major,i=+t.minor,a=+t.patch;if(e)return[{operator:"<",major:0,minor:0,patch:0}];if(r)return n?[{operator:"<",major:o,minor:0,patch:0}]:[{operator:"<",major:o,minor:0,patch:0}];if(n)return[{operator:"<",major:o,minor:i,patch:0}];let s=xt(t.prerelease??""),u=Dr(t.build??"");return[{operator:"<",major:o,minor:i,patch:a,prerelease:s,build:u}]}function yO(t){let e=$e(t.minor),r=$e(t.patch),n=+t.major,o=+t.minor,i=+t.patch;if(e)return r?[{operator:"<",major:n+1,minor:0,patch:0}]:[{operator:"<",major:n,minor:o+1,patch:0}];if(r)return[{operator:"<",major:n,minor:o+1,patch:0}];let a=xt(t.prerelease??""),s=Dr(t.build??"");return[{operator:"<=",major:n,minor:o,patch:i,prerelease:a,build:s}]}function bO(t){let e=$e(t.major),r=$e(t.minor),n=$e(t.patch),o=+t.major,i=+t.minor,a=+t.patch;if(e)return[{operator:"<",major:0,minor:0,patch:0}];if(r)return[{operator:">=",major:o+1,minor:0,patch:0}];if(n)return[{operator:">=",major:o,minor:i+1,patch:0}];let s=xt(t.prerelease??""),u=Dr(t.build??"");return[{operator:">",major:o,minor:i,patch:a,prerelease:s,build:u}]}function vO(t){let e=$e(t.major),r=$e(t.minor),n=$e(t.patch),o=+t.major,i=+t.minor,a=+t.patch;if(e)return[No];if(r)return n?[{operator:">=",major:o,minor:0,patch:0}]:[{operator:">=",major:o,minor:0,patch:0}];if(n)return[{operator:">=",major:o,minor:i,patch:0}];let s=xt(t.prerelease??""),u=Dr(t.build??"");return[{operator:">=",major:o,minor:i,patch:a,prerelease:s,build:u}]}function wO(t){let e=$e(t.major),r=$e(t.minor),n=$e(t.patch),o=+t.major,i=+t.minor,a=+t.patch;if(e)return[No];if(r)return[{operator:">=",major:o,minor:0,patch:0},{operator:"<",major:o+1,minor:0,patch:0}];if(n)return[{operator:">=",major:o,minor:i,patch:0},{operator:"<",major:o,minor:i+1,patch:0}];let s=xt(t.prerelease??""),u=Dr(t.build??"");return[{operator:void 0,major:o,minor:i,patch:a,prerelease:s,build:u}]}function CO(t){let e=t.match(HD)?.groups;if(!e)return fO(t);switch(e.operator){case"^":return mO(e);case"~":case"~>":return gO(e);case"<":return DO(e);case"<=":return yO(e);case">":return bO(e);case">=":return vO(e);case"=":case"":return wO(e);default:throw new Error(`Cannot parse version range: '${e.operator}' is not a valid operator`)}}function EO(t){return t.split(/\s+/).flatMap(CO)}function ru(t){let e=t.replaceAll(/(?<=<|>|=|~|\^)(\s+)/g,"").split(/\s*\|\|\s*/).map(r=>hO(r)||EO(r));if(e.some(r=>r.includes(null)))throw new TypeError(`Cannot parse version range: range "${t}" is invalid`);return e}function _e(t){if(typeof t!="string")throw new TypeError(`Cannot parse version as version must be a string: received ${typeof t}`);if(t.length>Mf)throw new TypeError(`Cannot parse version as version length is too long: length is ${t.length}, max length is ${Mf}`);t=t.trim();let e=t.match(MD)?.groups;if(!e)throw new TypeError(`Cannot parse version: ${t}`);let r=pn(e.major,`Cannot parse version ${t}: invalid major version`),n=pn(e.minor,`Cannot parse version ${t}: invalid minor version`),o=pn(e.patch,`Cannot parse version ${t}: invalid patch version`),i=e.prerelease?xt(e.prerelease):[],a=e.buildmetadata?Dr(e.buildmetadata):[];return{major:r,minor:n,patch:o,prerelease:i,build:a}}function zD(t,e){let r=t.operator,n=e.operator;if(r===void 0)return Vr(t)?!0:ha(t,[[e]]);if(n===void 0)return Vr(e)?!0:ha(e,[[t]]);let o=St(t,e);return(r===">="||r===">")&&(n===">="||n===">")||(r==="<="||r==="<")&&(n==="<="||n==="<")||o===0&&((r===">="||r==="<=")&&(n===">="||n==="<="))||o===-1&&(r===">="||r===">")&&(n==="<="||n==="<")||o===1&&(r==="<="||r==="<")&&(n===">="||n===">")}function _O(t){return t.every(e=>e.some(r=>xO(r)))}function xO(t){for(let e=0;e<t.length-1;e++){let r=t[e];for(let n of t.slice(e+1))if(!zD(r,n))return!1}return!0}function GD(t,e){return _O([t,e])&&t.some(r=>e.some(n=>r.every(o=>n.every(i=>zD(o,i)))))}function WD(t){try{return _e(t),!0}catch{return!1}}function dn(t,e){return St(t,e)>=0}var Vi=ge(o0()),eg=ge(j0()),U1=ge(hb()),vl=ge(Nh());var Lh=require("node:buffer"),SC=require("node:crypto"),zR=(()=>{let t=[];for(let e=0;e<256;e++){let r=e;for(let n=0;n<8;n++)r=r&1?3988292384^r>>>1:r>>>1;t[e]=r}return t})();function GR(t){let e=4294967295;for(let r=0;r<t.length;r++){let n=t[r];e=zR[(e^n)&255]^e>>>8}return e=e^4294967295,(e>>>0).toString(16).padStart(8,"0")}async function Xr(t,e="sha256"){let r=Lh.Buffer.isBuffer(t)?t:Lh.Buffer.from(t);if(e==="crc32")return GR(r);let n=(0,SC.createHash)(e);return n.update(r),n.digest("hex")}var ms=ge(o1());async function i1(){let t=await(0,ms.loadConfig)();return{config:t.app.extConfig,path:t.app.extConfigFilePath}}async function $m(t,e,r=!1){let n=await(0,ms.loadConfig)(),{extConfig:o}=n.app;o&&(o.plugins||(o.plugins={extConfig:{},[t]:{}}),o.plugins[t]||(o.plugins[t]={}),r?o=e.config:o.plugins[t]=e.config.plugins?.[t],(0,ms.writeConfig)(o,n.app.extConfigFilePath))}async function Ui(t,e=!1){await $m("CapacitorUpdater",t,e)}var zi=".capgo_key",Wt=".capgo_key_v2",wl=`${zi}.pub`,tn=`${Wt}.pub`,I1="https://capgo.app",R1="https://files.capgo.app",B1="https://api.capgo.app",j1="https://console.capgo.app",tg=12e4,F5=1024*1024*20,A5=1024*1024*1024,O5=1024*1024*99,bt="package.json",Gi=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-z-][0-9a-z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-z-][0-9a-z-]*))*))?(?:\+([0-9a-z-]+(?:\.[0-9a-z-]+)*))?$/i,L=t=>t?`
151
+ ${U1.default.render(t)}`:"";function yl(t){return new Promise(e=>{setTimeout(e,t)})}function M1(t){return(0,Ir.isMonorepo)(t)||(0,Ir.isNXMonorepo)(t)}function vt(t){return(0,Ir.isMonorepo)(t)?(0,Ir.findMonorepoRoot)(t):(0,Ir.isNXMonorepo)(t)?(0,Ir.findNXMonorepoRoot)(t):t}function q1(t=vt((0,ar.cwd)()),e=void 0){let r=e?.split(",")[0];if(r&&!(0,Ye.existsSync)(r)){let o=`Package.json at ${r} does not exist`;throw p.error(o),new Error(o)}let n=(0,Ye.readFileSync)(r??(0,Ke.join)(t,bt));return JSON.parse(n)}function rg(t=vt((0,ar.cwd)()),e=void 0){return q1(t,e).scripts}function _r(t=vt((0,ar.cwd)()),e=void 0){return q1(t,e).version??""}function N1(t){let e=t.replace("^","").replace("~","");if(WD(e))try{let r=_e(e);return yr(r)}catch{return e}return e}async function ct(t=vt((0,ar.cwd)()),e=void 0){let r=e?.split(",");if(r??=[(0,Ke.join)(t,bt)],r){for(let o of r)if(!(0,Ye.existsSync)(o)){let i=`Package.json at ${o} does not exist`;throw p.error(i),new Error(i)}}let n=new Map;for(let o of r){let i=(0,Ye.readFileSync)(o),a=JSON.parse(i);for(let s in a.dependencies)n.set(s,N1(a.dependencies[s]));for(let s in a.devDependencies)n.set(s,N1(a.devDependencies[s]))}return n}async function te(){try{let t=await i1();if(!t){let e="No capacitor config file found, run `cap init` first";throw p.error(e),new Error(e)}return t}catch(t){let e=`No capacitor config file found, run \`cap init\` first ${L(t)}`;throw p.error(e),new Error(e)}}async function ng(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 $m(t,r)),r}async function bs(t){return ng("CapacitorUpdater",t)}async function sr(){try{let t=await te(),e={host:t?.config?.plugins?.CapacitorUpdater?.localHost||I1,hostWeb:t?.config?.plugins?.CapacitorUpdater?.localWebHost||j1,hostFilesApi:t?.config?.plugins?.CapacitorUpdater?.localApiFiles||R1,hostApi:t?.config?.plugins?.CapacitorUpdater?.localApi||B1};return t?.config?.plugins?.CapacitorUpdater?.localSupa&&t?.config?.plugins?.CapacitorUpdater?.localSupaAnon&&(p.info("Using custom supabase instance from capacitor.config.json"),e.supaKey=t?.config?.plugins?.CapacitorUpdater?.localSupaAnon,e.supaHost=t?.config?.plugins?.CapacitorUpdater?.localSupa),e}catch{return{host:I1,hostWeb:j1,hostFilesApi:R1,hostApi:B1}}}var k5=/([A-Za-z0-9]+)\.(java|swift|kt|scala)$/;async function Cl(){let t=await sr();try{let e=await fetch(`${t.hostApi}/private/config`);if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return{...await e.json(),...t}}catch{return p.info(`Local config ${L(t)}`),t}}async function H1(){let t=await sr();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:A5,maxChunkSize:O5,alertUploadSize:F5}}}async function ne(t,e,r){let n=await Cl();if(e&&r&&(p.info("Using custom supabase instance from provided options"),n.supaHost=e,n.supaKey=r),!n.supaHost||!n.supaKey)throw p.error("Cannot connect to server please try again later"),new Error("Cannot connect to server please try again later");return(0,Vi.createClient)(n.supaHost,n.supaKey,{auth:{persistSession:!1},global:{headers:{capgkey:t}}})}async function $5(t,e,r){let{data:n}=await t.rpc("is_allowed_capgkey",{apikey:e,keymode:r}).single();if(!n){p.error("Invalid API key or insufficient permissions.");let i=`Your key should be: ${r.map((a,s)=>r.length===1?`"${a}"`:s===r.length-1?`or "${a}"`:`"${a}", `).join("")} mode.`;throw p.error(i),new Error("Invalid API key or insufficient permissions.")}}async function V1(t,e){let{data:r}=await t.rpc("is_paying_org",{orgid:e}).single();return r||!1}async function z1(t,e){let{data:r}=await t.rpc("is_trial_org",{orgid:e}).single();return r||0}async function P5(t,e){let{data:r}=await t.rpc("is_allowed_action_org",{orgid:e}).single();return!!r}async function T5(t,e,r){let{data:n}=await t.rpc("is_allowed_action",{apikey:r,appid:e}).single();return!!n}var wt=(a=>(a[a.none=0]="none",a[a.read=1]="read",a[a.upload=2]="upload",a[a.write=3]="write",a[a.admin=4]="admin",a[a.super_admin=5]="super_admin",a))(wt||{}),Wi=(t,e)=>t>=e;async function G1(t,e,r){let{data:n,error:o}=await t.rpc("get_org_perm_for_apikey",{apikey:e,app_id:r}).single();if(o)throw p.error("Cannot get permissions for organization!"),console.error(o),new Error("Cannot get permissions for organization");if(n.includes("perm")){let s=null;switch(n){case"perm_none":{s=0;break}case"perm_read":{s=1;break}case"perm_upload":{s=2;break}case"perm_write":{s=3;break}case"perm_admin":{s=4;break}case"perm_owner":{s=5;break}default:throw n.includes("invite")?(p.info("Please accept/deny the organization invitation before trying to access the app"),new Error("Organization invitation pending")):(p.error(`Invalid output when fetching organization permission. Response: ${n}`),new Error(`Invalid output when fetching organization permission. Response: ${n}`))}return{okay:!0,data:s}}let a=null;switch(n){case"INVALID_APIKEY":{a="INVALID_APIKEY";break}case"NO_APP":{a="NO_APP";break}case"NO_ORG":{a="NO_ORG";break}default:throw p.error(`Invalid error when fetching organization permission. Response: ${n}`),new Error(`Invalid error when fetching organization permission. Response: ${n}`)}return{okay:!1,error:a}}async function W1(t,e,r){let{data:n,error:o}=await t.rpc("get_organization_cli_warnings",{orgid:e,cli_version:r});if(o){p.error(`Cannot get cli warnings: ${L(o)}`);return}if(n.length>0){p.warn(`Found ${n.length} cli warnings for your organization.`);let i=null;for(let a of n){if(typeof a!="object"||typeof a.message!="string"||typeof a.fatal!="boolean"){p.error(`Invalid cli warning: ${a}`);continue}let s=a;s.fatal?(p.error(`${s.message.replaceAll("\\n",`
152
+ `)}`),i=new Error(s.message)):p.warn(`${s.message.replaceAll("\\n",`
153
+ `)}`)}if(i)throw p.error("Please fix the warnings and try again."),i;p.info("End of cli warnings.")}}async function K1(t,e,r,n,o=!0){let i=await Cl();if(!await(n?T5(t,n,r):P5(t,e)))throw p.error(`You need to upgrade your plan to continue to use capgo.
154
154
  Upgrade here: ${i.hostWeb}/dashboard/settings/plans
155
- `),Yl(100),Promise.resolve().then(()=>(Xg(),Kg)).then(c=>{c.default(`${i.hostWeb}/dashboard/settings/plans`)}),Yl(500),new Error("Plan upgrade required");let[a,u]=await Promise.all([OF(t,e),FF(t,e)]);a>0&&o&&!u&&p.warn(`WARNING !!
156
- Trial expires in ${a} days, upgrade here: ${i.hostWeb}/dashboard/settings/plans
157
- `)}async function TF(t,e,r,n,o=!0){let i=await ef(),{data:s}=await t.rpc("is_allowed_action_org_action",{orgid:e,actions:["storage"]});if(!s)throw p.error(`You need to upgrade your plan to continue to use capgo.
155
+ `),yl(100),Promise.resolve().then(()=>(Zm(),Xm)).then(c=>{c.default(`${i.hostWeb}/dashboard/settings/plans`)}),yl(500),new Error("Plan upgrade required");let[s,u]=await Promise.all([z1(t,e),V1(t,e)]);s>0&&o&&!u&&p.warn(`WARNING !!
156
+ Trial expires in ${s} days, upgrade here: ${i.hostWeb}/dashboard/settings/plans
157
+ `)}async function Y1(t,e,r,n,o=!0){let i=await Cl(),{data:a}=await t.rpc("is_allowed_action_org_action",{orgid:e,actions:["storage"]});if(!a)throw p.error(`You need to upgrade your plan to continue to use capgo.
158
158
  Upgrade here: ${i.hostWeb}/dashboard/settings/plans
159
- `),Yl(100),Promise.resolve().then(()=>(Xg(),Kg)).then(c=>{c.default(`${i.hostWeb}/dashboard/settings/plans`)}),Yl(500),new Error("Plan upgrade required for upload");let[a,u]=await Promise.all([OF(t,e),FF(t,e)]);a>0&&o&&!u&&p.warn(`WARNING !!
160
- Trial expires in ${a} days, upgrade here: ${i.hostWeb}/dashboard/settings/plans
161
- `)}function ce(t=!1){let e=gr.env.CAPGO_TOKEN?.trim();if(e)return t||p.info("Use CAPGO_TOKEN environment variable"),e;let r=(0,Jl.homedir)(),n,o=`${r}/.capgo`;if((0,Qe.existsSync)(o)&&(t||p.info(`Use global API key ${o}`),n=(0,Qe.readFileSync)(o,"utf8").trim()),o=".capgo",!n&&(0,Qe.existsSync)(o)&&(t||p.info(`Use local API key ${o}`),n=(0,Qe.readFileSync)(o,"utf8").trim()),!n){let i=`Cannot find API key in local folder or global, please login first with ${ht().runner} @capacitor/cli login`;throw p.error(i),new Error(i)}return n}async function*tD(t){let e=await(0,Qe.readdirSync)(t,{withFileTypes:!0});for(let r of e){let n=(0,Ze.resolve)(t,r.name);r.isDirectory()&&!r.name.startsWith(".")&&!r.name.startsWith("node_modules")&&!r.name.startsWith("dist")?yield*tD(n):yield n}}function as(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 tf(){let t=(0,gr.cwd)(),e=!1,r=(0,Ze.resolve)(t,"tsconfig.json");(0,Qe.existsSync)(r)&&(e=!0);for await(let n of tD(t)){if(n.includes("angular.json"))return p.info("Found angular project"),e?"angular-ts":"angular-js";if(n.includes("nuxt.config.js")||n.includes("nuxt.config.ts"))return p.info("Found nuxtjs project"),e?"nuxtjs-ts":"nuxtjs-js";if(n.includes("next.config.js")||n.includes("next.config.mjs"))return p.info("Found nextjs project"),e?"nextjs-ts":"nextjs-js";if(n.includes("svelte.config.js"))return p.info("Found sveltekit project"),e?"sveltekit-ts":"sveltekit-js";if(n.includes("rolluconfig.js"))return p.info("Found svelte project"),e?"svelte-ts":"svelte-js";if(n.includes("vue.config.js"))return p.info("Found vue project"),e?"vue-ts":"vue-js";if(n.includes(xt)){let o=(0,Ze.dirname)(n),i=await dt(o);if(i){if(i.get("react"))return p.info("Found react project test"),e?"react-ts":"react-js";if(i.get("vue"))return p.info("Found vue project"),e?"vue-ts":"vue-js"}}}return"unknown"}function RF(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 rD(t){if(t==="angular")return p.info("Angular project detected"),"build";if(t==="nuxtjs")return p.info("Nuxtjs project detected"),"generate";if(t==="nextjs"){if(p.info("Nextjs project detected"),p.warn("Please make sure you have configured static export in your next.config.js: https://nextjs.org/docs/pages/building-your-application/deploying/static-exports"),p.warn("Please make sure you have the output: 'export' and distDir: 'dist' in your next.config.js"),!await Ce({message:"Do you want to continue?"})){let r="Build command selection aborted by user";throw p.error(r),new Error(r)}return"build"}if(t==="sveltekit"){if(p.info("Sveltekit project detected"),p.warn("Please make sure you have the adapter-static installed: https://kit.svelte.dev/docs/adapter-static"),p.warn("Please make sure you have the pages: 'dist' and assets: 'dest', in your svelte.config.js adaptater"),!await Ce({message:"Do you want to continue?"})){let r="Build command selection aborted by user";throw p.error(r),new Error(r)}return"build"}return"build"}async function IF(){let t=/(main|index)\.(ts|tsx|js|jsx)$/,e="",r=(0,gr.cwd)(),n=r.split("/").length;for await(let o of tD(r))if(o.split("/").length-n<=2&&t.test(o)){e=o,p.info(`Found main file here ${o}`);break}return e}async function nD(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 BF(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 ns.FunctionsHttpError){let s=await i.error.context.json();p.error(`Upload URL error: ${s.status||JSON.stringify(s)}`)}else p.error(`Cannot get upload url: ${i.error.message}`);return""}return i.data.url}catch(o){p.error(`Cannot get upload url ${j(o)}`)}return""}async function*NF(t){let e=(0,Qe.readdirSync)(t,{withFileTypes:!0});for(let r of e){let n=(0,Ze.join)(t,r.name);r.isDirectory()?yield*NF(n):yield n}}async function LF(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 NF(t)){if(r.some(a=>n.includes(a))){p.info(`Ignoring file ${n}, please ensure you have only required files in your dist folder`);continue}let o=(0,Qe.readFileSync)(n);if(o.length===0){p.info(`Ignoring empty file ${n}, please ensure you have only required files in your dist folder`);continue}let i=await un(o,"sha256"),s=(0,Ze.relative)(t,n);s.startsWith("/")&&(s=s.substring(1)),e.push({file:s,hash:i})}return e}async function rf(t){return(0,Jl.platform)()==="win32"?U7(t):j7(t)}function j7(t){let e=new Jg.default;return e.addLocalFolder(t),e.toBuffer()}async function U7(t){p.info("Zipping file windows mode");let e=new Jg.default,r=(n,o)=>{let i=(0,Qe.readdirSync)(n);for(let s of i){let a=(0,Ze.join)(n,s),u=(0,Qe.statSync)(a);if(u.isFile()){let c=(0,Qe.readFileSync)(a);e.addFile((0,Ze.join)(o,s).split(Ze.sep).join("/"),c)}else u.isDirectory()&&r(a,(0,Ze.join)(o,s))}};return r(t,""),e.toBuffer()}async function jF(t,e,r,n,o,i,s,a){return new Promise((u,c)=>{we(t,{channel:"app",event:"App TUS upload",icon:"\u23EB",user_id:r,tags:{"app-id":n},notify:!1}),new Zl.Upload(e,{endpoint:`${s.hostFilesApi}/files/upload/attachments/`,chunkSize:a,metadataForPartialUploads:{filename:`orgs/${r}/apps/${n}/${o}.zip`,filetype:"application/gzip"},metadata:{filename:`orgs/${r}/apps/${n}/${o}.zip`,filetype:"application/zip"},headers:{Authorization:t},onError(f){if(p.error(`Error uploading bundle: ${f.message}`),f instanceof Zl.DetailedError){let h=f.originalResponse?.getBody(),d=JSON.parse(h||'{"error": "unknown error"}');c(d.status||d.error||d.message||"unknown error")}else c(f.message||f.toString()||"unknown error")},onProgress(f,h){let d=(f/h*100).toFixed(2);i.message(`Uploaded ${d}%`)},async onSuccess(){await we(t,{channel:"app",event:"App TUS done",icon:"\u23EB",user_id:r,tags:{"app-id":n},notify:!1}).catch(),u(!0)}}).start()})}async function UF(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 ns.FunctionsHttpError){let s=await i.error.context.json();p.error(`Cannot delete failed version: ${s.status||JSON.stringify(s)}`)}else p.error(`Cannot delete failed version: ${i.error.message}`);return}return i.data?.status}catch(o){if(o instanceof ns.FunctionsHttpError){let i=await o.context.json();p.error(`Cannot delete failed version: ${i.message||JSON.stringify(i)}`)}else p.error(`Cannot delete failed version: ${j(o)}`)}}async function nf(t,e){if(!e.app_id||!e.name||!e.created_by)return p.error("missing app_id, name, or created_by"),Promise.reject(new Error("missing app_id, name, or created_by"));let{data:r,error:n}=await t.from("channels").select().eq("app_id",e.app_id).eq("name",e.name).single();return r&&!n?t.from("channels").update(e).eq("app_id",e.app_id).eq("name",e.name).select().single():t.from("channels").insert(e).select().single()}async function we(t,e,r){try{r&&p.info(`Get remove config: for ${e.event}`);let n=await ef();r&&p.info(`Sending LogSnag event: ${JSON.stringify(e)}`);let o=new AbortController,i=setTimeout(()=>o.abort(),1e4);try{let s=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),!s.ok)throw new Error(`HTTP error! status: ${s.status}`);let a=await s.json();a.error&&p.error(`Failed to send LogSnag event: ${a.error}`)}finally{clearTimeout(i)}}catch(n){r&&(p.error("Failed to send Stats event details:"),p.error(j(n)))}}async function us(t,e){let{error:r,data:n}=await t.rpc("get_orgs_v6");if(r)throw p.error("Cannot get the list of organizations - exiting"),p.error(`Error ${JSON.stringify(r)}`),new Error("Cannot get the list of organizations");let o=n.filter(u=>!!e.find(c=>c===u.role));if(n.length===0)throw p.error("Could not get organization please create an organization first"),new Error("No organizations available");if(o.length===0)throw p.error(`Could not find organization with roles: ${e.join(" or ")} please create an organization or ask the admin to add you to the organization with this roles`),new Error("Could not find organization with required roles");let i=o.length>1?await Sr({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(Ee(i))throw p.error("Canceled organization selection, exiting"),new Error("Organization selection cancelled");let s=i,a=n.find(u=>u.gid===s);return p.info(`Using the organization "${a.name}" as the app owner`),a}async function ae(t,e,r=["all"]){await B7(t,e,r);let{data:n,error:o}=await t.rpc("get_user_id",{apikey:e}).single(),i=(n||"").toString();if(!i||o)throw p.error("Cannot auth user with apikey"),new Error("Cannot authenticate user with provided API key");return i}async function yr(t,e){let{data:r,error:n}=await t.from("apps").select("owner_org").eq("app_id",e).single();if(!r||n)throw p.error(`Cannot get organization id for app id ${e}`),j(n),new Error(`Cannot get organization id for app id ${e}`);return r.owner_org}function cs(t){return new Date(t||"").toLocaleString()}var CF=!1,rs="npm",La="install",Yg="npx";function ht(){if(CF)return{pm:rs,command:La,installCommand:`${rs} ${La}`,runner:Yg};let t=St((0,gr.cwd)());return rs=Ss(t,"npm"),La=Du(rs),CF=!0,Yg=$y(t),{pm:rs,command:La,installCommand:`${rs} ${La}`,runner:Yg}}function MF(t){return(0,Qe.readdirSync)(t,{withFileTypes:!0}).flatMap(n=>{let o=(0,Ze.join)(t,n.name);return n.isDirectory()?MF(o):o.split(`node_modules${Ze.sep}`)[1]||o})}async function oD(t,e){let r=e?e.split(","):[],n;try{n=await dt("",t)}catch(l){throw p.error("Invalid package.json, JSON parsing failed"),console.error("json parse error: ",l),l instanceof Error?l:new Error("Invalid package.json")}let o=t?.split(",")[0],i=o?Ze.default.resolve(o).replace(xt,""):St((0,gr.cwd)());if(!n)throw p.error("Missing dependencies section in package.json"),new Error("Missing dependencies section in package.json");for(let[l,f]of Object.entries(n))if(typeof f!="string")throw p.error(`Invalid dependency ${l}: ${f}, expected string, got ${typeof f}`),new Error(`Invalid dependency ${l}: expected string version`);let s=r.length===0?[(0,Ze.join)((0,gr.cwd)(),"node_modules")]:r;if(!s.some(l=>(0,Qe.existsSync)(l))){let l=Ss(i,"npm"),f=Du(l);throw p.error(`Missing node_modules folder at ${s.join(", ")}, please run ${l} ${f}`),new Error("Missing node_modules folder")}let u=!1,c=await Promise.all(Array.from(n.entries()).map(async([l,f])=>{let h=!1,d=!1;for(let m of s){let b=(0,Ze.join)(m,l);if((0,Qe.existsSync)(b)){h=!0;try{if(MF(b).some(E=>I7.test(E))){d=!0;break}}catch(D){throw p.error(`Error reading node_modules files for ${l} package in ${m}`),console.error(D),D instanceof Error?D:new Error(`Error reading node_modules files for ${l}`)}}}if(!h){u=!0;let m=Ss(i,"npm"),b=Du(m);return p.error(`Missing dependency ${l}, please run ${m} ${b}`),{name:l,version:f}}return{name:l,version:f,native:d}})).catch(()=>[]);if(u||c.find(l=>l.native===void 0))throw p.error("Missing dependencies or invalid dependencies"),p.error("If you use monorepo, workspace or any special package manager you can use the --package-json [path,] and --node-modules [path,] options to make the command work properly"),new Error("Missing dependencies or invalid dependencies");return c}async function M7(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 q7(t){if(!t)throw p.error("Error parsing native packages, perhaps the metadata does not exist in Capgo?"),new Error("Error parsing native packages");for(let r of t){if(typeof r!="object")throw p.error(`Invalid remote native package data: ${r}, expected object, got ${typeof r}`),new Error("Invalid remote native package data");let{name:n,version:o}=r;if(!n||typeof n!="string")throw p.error(`Invalid remote native package name: ${n}, expected string, got ${typeof n}`),new Error("Invalid remote native package name");if(!o||typeof o!="string")throw p.error(`Invalid remote native package version: ${o}, expected string, got ${typeof o}`),new Error("Invalid remote native package version")}return new Map(t.map(r=>[r.name,r]))}async function qF(t,e,r){let{data:n,error:o}=await t.from("channels").select(`version (
159
+ `),yl(100),Promise.resolve().then(()=>(Zm(),Xm)).then(c=>{c.default(`${i.hostWeb}/dashboard/settings/plans`)}),yl(500),new Error("Plan upgrade required for upload");let[s,u]=await Promise.all([z1(t,e),V1(t,e)]);s>0&&o&&!u&&p.warn(`WARNING !!
160
+ Trial expires in ${s} days, upgrade here: ${i.hostWeb}/dashboard/settings/plans
161
+ `)}function ae(t=!1){let e=ar.env.CAPGO_TOKEN?.trim();if(e)return t||p.info("Use CAPGO_TOKEN environment variable"),e;let r=(0,bl.homedir)(),n,o=`${r}/.capgo`;if((0,Ye.existsSync)(o)&&(t||p.info(`Use global API key ${o}`),n=(0,Ye.readFileSync)(o,"utf8").trim()),o=".capgo",!n&&(0,Ye.existsSync)(o)&&(t||p.info(`Use local API key ${o}`),n=(0,Ye.readFileSync)(o,"utf8").trim()),!n){let i=`Cannot find API key in local folder or global, please login first with ${lt().runner} @capacitor/cli login`;throw p.error(i),new Error(i)}return n}async function*og(t){let e=await(0,Ye.readdirSync)(t,{withFileTypes:!0});for(let r of e){let n=(0,Ke.resolve)(t,r.name);r.isDirectory()&&!r.name.startsWith(".")&&!r.name.startsWith("node_modules")&&!r.name.startsWith("dist")?yield*og(n):yield n}}function Ki(t){let e=/\.(jpg|jpeg|png|gif|bmp|webp)$/i,r=t.match(e);if(r)switch(r[1].toLowerCase()){case"jpg":case"jpeg":return"image/jpeg";case"png":return"image/png";case"webp":return"image/webp"}return null}async function El(){let t=(0,ar.cwd)(),e=!1,r=(0,Ke.resolve)(t,"tsconfig.json");(0,Ye.existsSync)(r)&&(e=!0);for await(let n of og(t)){if(n.includes("angular.json"))return p.info("Found angular project"),e?"angular-ts":"angular-js";if(n.includes("nuxt.config.js")||n.includes("nuxt.config.ts"))return p.info("Found nuxtjs project"),e?"nuxtjs-ts":"nuxtjs-js";if(n.includes("next.config.js")||n.includes("next.config.mjs"))return p.info("Found nextjs project"),e?"nextjs-ts":"nextjs-js";if(n.includes("svelte.config.js"))return p.info("Found sveltekit project"),e?"sveltekit-ts":"sveltekit-js";if(n.includes("rolluconfig.js"))return p.info("Found svelte project"),e?"svelte-ts":"svelte-js";if(n.includes("vue.config.js"))return p.info("Found vue project"),e?"vue-ts":"vue-js";if(n.includes(bt)){let o=(0,Ke.dirname)(n),i=await ct(o);if(i){if(i.get("react"))return p.info("Found react project test"),e?"react-ts":"react-js";if(i.get("vue"))return p.info("Found vue project"),e?"vue-ts":"vue-js"}}}return"unknown"}function J1(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 ig(t){if(t==="angular")return p.info("Angular project detected"),"build";if(t==="nuxtjs")return p.info("Nuxtjs project detected"),"generate";if(t==="nextjs"){if(p.info("Nextjs project detected"),p.warn("Please make sure you have configured static export in your next.config.js: https://nextjs.org/docs/pages/building-your-application/deploying/static-exports"),p.warn("Please make sure you have the output: 'export' and distDir: 'dist' in your next.config.js"),!await ve({message:"Do you want to continue?"})){let r="Build command selection aborted by user";throw p.error(r),new Error(r)}return"build"}if(t==="sveltekit"){if(p.info("Sveltekit project detected"),p.warn("Please make sure you have the adapter-static installed: https://kit.svelte.dev/docs/adapter-static"),p.warn("Please make sure you have the pages: 'dist' and assets: 'dest', in your svelte.config.js adaptater"),!await ve({message:"Do you want to continue?"})){let r="Build command selection aborted by user";throw p.error(r),new Error(r)}return"build"}return"build"}async function X1(){let t=/(main|index)\.(ts|tsx|js|jsx)$/,e="",r=(0,ar.cwd)(),n=r.split("/").length;for await(let o of og(r))if(o.split("/").length-n<=2&&t.test(o)){e=o,p.info(`Found main file here ${o}`);break}return e}async function ag(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 Z1(t,e,r){let n={app_id:e,name:r,version:0};try{let i=await t.functions.invoke("files/upload_link",{body:JSON.stringify(n)});if(i.error){if(i.error instanceof Vi.FunctionsHttpError){let a=await i.error.context.json();p.error(`Upload URL error: ${a.status||JSON.stringify(a)}`)}else p.error(`Cannot get upload url: ${i.error.message}`);return""}return i.data.url}catch(o){p.error(`Cannot get upload url ${L(o)}`)}return""}async function*Q1(t){let e=(0,Ye.readdirSync)(t,{withFileTypes:!0});for(let r of e){let n=(0,Ke.join)(t,r.name);r.isDirectory()?yield*Q1(n):yield n}}async function e2(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 Q1(t)){if(r.some(s=>n.includes(s))){p.info(`Ignoring file ${n}, please ensure you have only required files in your dist folder`);continue}let o=(0,Ye.readFileSync)(n);if(o.length===0){p.info(`Ignoring empty file ${n}, please ensure you have only required files in your dist folder`);continue}let i=await Xr(o,"sha256"),a=(0,Ke.relative)(t,n);a.startsWith("/")&&(a=a.substring(1)),e.push({file:a,hash:i})}return e}async function _l(t){return(0,bl.platform)()==="win32"?R5(t):I5(t)}function I5(t){let e=new eg.default;return e.addLocalFolder(t),e.toBuffer()}async function R5(t){p.info("Zipping file windows mode");let e=new eg.default,r=(n,o)=>{let i=(0,Ye.readdirSync)(n);for(let a of i){let s=(0,Ke.join)(n,a),u=(0,Ye.statSync)(s);if(u.isFile()){let c=(0,Ye.readFileSync)(s);e.addFile((0,Ke.join)(o,a).split(Ke.sep).join("/"),c)}else u.isDirectory()&&r(s,(0,Ke.join)(o,a))}};return r(t,""),e.toBuffer()}async function t2(t,e,r,n,o,i,a,s){return new Promise((u,c)=>{De(t,{channel:"app",event:"App TUS upload",icon:"\u23EB",user_id:r,tags:{"app-id":n},notify:!1}),new vl.Upload(e,{endpoint:`${a.hostFilesApi}/files/upload/attachments/`,chunkSize:s,metadataForPartialUploads:{filename:`orgs/${r}/apps/${n}/${o}.zip`,filetype:"application/gzip"},metadata:{filename:`orgs/${r}/apps/${n}/${o}.zip`,filetype:"application/zip"},headers:{Authorization:t},onError(f){if(p.error(`Error uploading bundle: ${f.message}`),f instanceof vl.DetailedError){let d=f.originalResponse?.getBody(),h=JSON.parse(d||'{"error": "unknown error"}');c(h.status||h.error||h.message||"unknown error")}else c(f.message||f.toString()||"unknown error")},onProgress(f,d){let h=(f/d*100).toFixed(2);i.message(`Uploaded ${h}%`)},async onSuccess(){await De(t,{channel:"app",event:"App TUS done",icon:"\u23EB",user_id:r,tags:{"app-id":n},notify:!1}).catch(),u(!0)}}).start()})}async function r2(t,e,r){let n={app_id:e,name:r};try{let i=await t.functions.invoke("private/delete_failed_version",{body:JSON.stringify(n),method:"DELETE"});if(i.error){if(i.error instanceof Vi.FunctionsHttpError){let a=await i.error.context.json();p.error(`Cannot delete failed version: ${a.status||JSON.stringify(a)}`)}else p.error(`Cannot delete failed version: ${i.error.message}`);return}return i.data?.status}catch(o){if(o instanceof Vi.FunctionsHttpError){let i=await o.context.json();p.error(`Cannot delete failed version: ${i.message||JSON.stringify(i)}`)}else p.error(`Cannot delete failed version: ${L(o)}`)}}async function xl(t,e){if(!e.app_id||!e.name||!e.created_by)return p.error("missing app_id, name, or created_by"),Promise.reject(new Error("missing app_id, name, or created_by"));let{data:r,error:n}=await t.from("channels").select().eq("app_id",e.app_id).eq("name",e.name).single();return r&&!n?t.from("channels").update(e).eq("app_id",e.app_id).eq("name",e.name).select().single():t.from("channels").insert(e).select().single()}async function De(t,e,r){try{r&&p.info(`Get remove config: for ${e.event}`);let n=await Cl();r&&p.info(`Sending LogSnag event: ${JSON.stringify(e)}`);let o=new AbortController,i=setTimeout(()=>o.abort(),1e4);try{let a=await fetch(`${n.hostApi}/private/events`,{method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json",capgkey:t},signal:o.signal});if(clearTimeout(i),!a.ok)throw new Error(`HTTP error! status: ${a.status}`);let s=await a.json();s.error&&p.error(`Failed to send LogSnag event: ${s.error}`)}finally{clearTimeout(i)}}catch(n){r&&(p.error("Failed to send Stats event details:"),p.error(L(n)))}}async function Yi(t,e){let{error:r,data:n}=await t.rpc("get_orgs_v6");if(r)throw p.error("Cannot get the list of organizations - exiting"),p.error(`Error ${JSON.stringify(r)}`),new Error("Cannot get the list of organizations");let o=n.filter(u=>!!e.find(c=>c===u.role));if(n.length===0)throw p.error("Could not get organization please create an organization first"),new Error("No organizations available");if(o.length===0)throw p.error(`Could not find organization with roles: ${e.join(" or ")} please create an organization or ask the admin to add you to the organization with this roles`),new Error("Could not find organization with required roles");let i=o.length>1?await gr({message:"Please pick the organization that you want to insert to",options:o.map(u=>({value:u.gid,label:u.name}))}):o[0].gid;if(be(i))throw p.error("Canceled organization selection, exiting"),new Error("Organization selection cancelled");let a=i,s=n.find(u=>u.gid===a);return p.info(`Using the organization "${s.name}" as the app owner`),s}async function oe(t,e,r=["all"]){await $5(t,e,r);let{data:n,error:o}=await t.rpc("get_user_id",{apikey:e}).single(),i=(n||"").toString();if(!i||o)throw p.error("Cannot auth user with apikey"),new Error("Cannot authenticate user with provided API key");return i}async function ur(t,e){let{data:r,error:n}=await t.from("apps").select("owner_org").eq("app_id",e).single();if(!r||n)throw p.error(`Cannot get organization id for app id ${e}`),L(n),new Error(`Cannot get organization id for app id ${e}`);return r.owner_org}function Ji(t){return new Date(t||"").toLocaleString()}var L1=!1,Hi="npm",ys="install",Qm="npx";function lt(){if(L1)return{pm:Hi,command:ys,installCommand:`${Hi} ${ys}`,runner:Qm};let t=vt((0,ar.cwd)());return Hi=da(t,"npm"),ys=Xs(Hi),L1=!0,Qm=ID(t),{pm:Hi,command:ys,installCommand:`${Hi} ${ys}`,runner:Qm}}function n2(t){return(0,Ye.readdirSync)(t,{withFileTypes:!0}).flatMap(n=>{let o=(0,Ke.join)(t,n.name);return n.isDirectory()?n2(o):o.split(`node_modules${Ke.sep}`)[1]||o})}async function sg(t,e){let r=e?e.split(","):[],n;try{n=await ct("",t)}catch(l){throw p.error("Invalid package.json, JSON parsing failed"),console.error("json parse error: ",l),l instanceof Error?l:new Error("Invalid package.json")}let o=t?.split(",")[0],i=o?Ke.default.resolve(o).replace(bt,""):vt((0,ar.cwd)());if(!n)throw p.error("Missing dependencies section in package.json"),new Error("Missing dependencies section in package.json");for(let[l,f]of Object.entries(n))if(typeof f!="string")throw p.error(`Invalid dependency ${l}: ${f}, expected string, got ${typeof f}`),new Error(`Invalid dependency ${l}: expected string version`);let a=r.length===0?[(0,Ke.join)((0,ar.cwd)(),"node_modules")]:r;if(!a.some(l=>(0,Ye.existsSync)(l))){let l=da(i,"npm"),f=Xs(l);throw p.error(`Missing node_modules folder at ${a.join(", ")}, please run ${l} ${f}`),new Error("Missing node_modules folder")}let u=!1,c=await Promise.all(Array.from(n.entries()).map(async([l,f])=>{let d=!1,h=!1;for(let m of a){let b=(0,Ke.join)(m,l);if((0,Ye.existsSync)(b)){d=!0;try{if(n2(b).some(C=>k5.test(C))){h=!0;break}}catch(D){throw p.error(`Error reading node_modules files for ${l} package in ${m}`),console.error(D),D instanceof Error?D:new Error(`Error reading node_modules files for ${l}`)}}}if(!d){u=!0;let m=da(i,"npm"),b=Xs(m);return p.error(`Missing dependency ${l}, please run ${m} ${b}`),{name:l,version:f}}return{name:l,version:f,native:h}})).catch(()=>[]);if(u||c.find(l=>l.native===void 0))throw p.error("Missing dependencies or invalid dependencies"),p.error("If you use monorepo, workspace or any special package manager you can use the --package-json [path,] and --node-modules [path,] options to make the command work properly"),new Error("Missing dependencies or invalid dependencies");return c}async function B5(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 j5(t){if(!t)throw p.error("Error parsing native packages, perhaps the metadata does not exist in Capgo?"),new Error("Error parsing native packages");for(let r of t){if(typeof r!="object")throw p.error(`Invalid remote native package data: ${r}, expected object, got ${typeof r}`),new Error("Invalid remote native package data");let{name:n,version:o}=r;if(!n||typeof n!="string")throw p.error(`Invalid remote native package name: ${n}, expected string, got ${typeof n}`),new Error("Invalid remote native package name");if(!o||typeof o!="string")throw p.error(`Invalid remote native package version: ${o}, expected string, got ${typeof o}`),new Error("Invalid remote native package version")}return new Map(t.map(r=>[r.name,r]))}async function o2(t,e,r){let{data:n,error:o}=await t.from("channels").select(`version (
162
162
  native_packages
163
- )`).eq("name",r).eq("app_id",e).single();if(o)throw p.error(`Error fetching native packages: ${o.message}`),new Error(`Error fetching native packages: ${o.message}`);return q7(n.version.native_packages??[])}async function HF(t,e,r,n){let o=Se();o.start(`Checking bundle checksum compatibility with channel ${r}`);let i=await M7(t,e,r);if(!i){o.stop(`No checksum found for channel ${r}, the bundle will be uploaded`);return}if(i&&i===n)throw p.error(`Cannot upload the same bundle content.
163
+ )`).eq("name",r).eq("app_id",e).single();if(o)throw p.error(`Error fetching native packages: ${o.message}`),new Error(`Error fetching native packages: ${o.message}`);return j5(n.version.native_packages??[])}async function i2(t,e,r,n){let o=Ee();o.start(`Checking bundle checksum compatibility with channel ${r}`);let i=await B5(t,e,r);if(!i){o.stop(`No checksum found for channel ${r}, the bundle will be uploaded`);return}if(i&&i===n)throw p.error(`Cannot upload the same bundle content.
164
164
  Current bundle checksum matches remote bundle for channel ${r}
165
165
  Did you builded your app before uploading?
166
- 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 ge(t,e){return t||e?.plugins?.CapacitorUpdater?.appId||e?.appId}function Lo(t){if(!t.localVersion)return!0;if(!t.remoteVersion)return!1;try{let e=Eu(t.localVersion),r=Eu(t.remoteVersion);return Hy(e,r)}catch{return!1}}async function of(t,e,r,n,o){let i=await oD(n,o),s=await qF(t,e,r),a=i.filter(c=>!!c.native).map(c=>{let l=s.get(c.name);return l?{name:c.name,localVersion:c.version,remoteVersion:l.version}:{name:c.name,localVersion:c.version,remoteVersion:void 0}}),u=[...s].filter(([c])=>i.find(l=>l.name===c)===void 0).map(([c,l])=>({name:c,localVersion:void 0,remoteVersion:l.version}));return a.push(...u),{finalCompatibility:a,localDependencies:i}}async function iD(t,e,r,n){let o=await qF(t,e,r),i=n.map(a=>{let u=o.get(a.name);return u?{name:a.name,localVersion:a.version,remoteVersion:u.version}:{name:a.name,localVersion:a.version,remoteVersion:void 0}}),s=[...o].filter(([a])=>n.find(u=>u.name===a)===void 0).map(([a,u])=>({name:a,localVersion:void 0,remoteVersion:u.version}));return i.push(...s),{finalCompatibility:i,localDependencies:n}}async function VF(t,e){let{data:r}=await t.rpc("exist_app_v2",{appid:e}).single();return!!r}async function qe(t,e,r,n,o=!1){let i=ht(),s=await kF(t,e,r);if(!s.okay)switch(s.error){case"INVALID_APIKEY":{let c="Invalid apikey, such apikey does not exists!";throw o||p.error(c),new Error(c)}case"NO_APP":{let c=`App ${r} does not exist, run first \`${i.runner} @capgo/cli app add ${r}\` to create it`;throw o||p.error(c),new Error(c)}case"NO_ORG":{let c="Could not find organization, please contact support to resolve this!";throw o||p.error(c),new Error(c)}}let a=s.data;if(n>a){let c=`Insuficcent permissions for app ${r}. Current permission: ${At[s.data]}, required for this action: ${At[n]}.`;throw o||p.error(c),new Error(c)}return s.data}var br="assets/icon.png";async function sf(t){try{let r=`https://registry.npmjs.org/${encodeURIComponent(t.toLowerCase())}`,n=await fetch(r,{headers:{accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"}});return n.ok&&(await n.json())["dist-tags"]?.latest||null}catch{return null}}async function De(){let t=await sf("@capgo/cli")??"",e=t?.split(".")[0];t!==_r.version&&p.warning(`\u{1F6A8} You are using @capgo/cli@${_r.version} it's not the latest version.
167
- Please use @capgo/cli@${t}" or @capgo/cli@${e} to keep up to date with the latest features and bug fixes.`)}function H7(t,e,r){if(!e.apikey)throw r||p.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||p.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(t.includes("--"))throw r||p.error('The app id includes illegal symbols. You cannot use "--" in the app id'),new Error("App id includes illegal symbols")}async function V7(t,e,r){if(await VF(t,e))throw e==="io.ionic.starter"?(r||p.error(`This appId ${e} cannot be used it's reserved, please change it in your capacitor config.`),new Error("Reserved appId, please change it in capacitor config")):(r||p.error(`App ${e} already exist`),new Error(`App ${e} already exists`))}async function z7(t,e,r=!1){return sD(t,e,void 0,r)}async function sD(t,e,r,n=!1){n||ee("Adding"),await De(),e.apikey=e.apikey||ce();let o=await ne(),i=ge(t,o?.config);H7(i,e,n);let s=await ie(e.apikey,e.supaHost,e.supaAnon),a=await ae(s,e.apikey,["write","all"]);await V7(s,i,n),r||(r=await us(s,["admin","super_admin"]));let u=r.gid,{name:c,icon:l}=e;if(c=c||o.config?.appName||"Unknown",l=l||"resources/icon.png",!l||!c)throw n||p.error("Missing argument, you need to provide a appId and a name, or be in a capacitor project"),new Error("Missing app name or icon path");n||p.info(`Adding ${i} to Capgo`);let f=null,h=null;l&&(0,ls.existsSync)(l)?(f=(0,ls.readFileSync)(l),h=as(l)||"image/png",n||p.warn(`Found app icon ${l}`)):(0,ls.existsSync)(br)?(f=(0,ls.readFileSync)(br),h=as(br)||"image/png",n||p.warn(`Found app icon ${br}`)):n||p.warn(`Cannot find app icon in any of the following locations: ${l}, ${br}`);let d="icon",m="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(f&&h){let{error:E}=await s.storage.from(`images/org/${u}/${i}`).upload(d,f,{contentType:h});if(E)throw n||console.error(E),n||p.error(`Could not add app ${j(E)}`),new Error(`Could not add app ${j(E)}`);let{data:_}=await s.storage.from(`images/org/${u}/${i}`).getPublicUrl(d);m=_?.publicUrl||m}let{error:b}=await s.from("apps").insert({icon_url:m,owner_org:u,user_id:a,name:c,app_id:i});if(b)throw n||p.error(`Could not add app ${j(b)}`),new Error(`Could not add app ${j(b)}`);let{error:D}=await s.from("app_versions").insert([{owner_org:u,deleted:!0,name:"unknown",app_id:i},{owner_org:u,deleted:!0,name:"builtin",app_id:i}]);if(D)throw n||p.error(`Could not add app ${j(D)}`),new Error(`Could not add app ${j(D)}`);return n||(p.success(`App ${i} added to Capgo. You can upload a bundle now`),Z("Done \u2705")),{appId:i,organizationUid:u,userId:a,name:c,signedURL:m}}async function zF(t,e){await z7(t,e,!1)}function GF(t,e){let n=["normal","bold","dim","italic","underline","strikethrough"].indexOf(t),o="\x1B[";return o+n+"m"+e+o+"0m"}var mt=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?GF("bold",o):o,s=r-o.length,a=this.theme.row[1];switch(typeof e){case"number":return a.repeat(s)+i;case"string":return i+a.repeat(s);case"boolean":case"object":return a.repeat(Math.ceil(s/2))+GF("italic",o)+a.repeat(Math.floor(s/2));default:return a.repeat(s)}}renderRow(e,r=!1){let n=this.theme.row,o=this.columnWidth();return n[0]+e.map((i,s)=>this.renderCell(i,o[s],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(`
168
- `)}};function G7(t){return new Promise(e=>{setTimeout(e,t)})}function W7(t){return new Date(t||"").toLocaleTimeString()}async function Gr(t,e,r,n,o,i="\u2705"){await we(r,{channel:t,event:n,icon:i,user_id:e,...o?{tags:{"app-id":o}}:{},notify:!1})}async function K7(t,e,r,n){if(Ee(e))throw await Gr(t,r,n,"canceled",void 0,"\u{1F937}"),new Error("Command cancelled")}async function X7(t,e,r){try{let n=await Dr(),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 s=await i.json();if(s?.length>0)return s}catch(n){console.error("Cannot get devices",n),p.error(`Cannot get stats ${j(n)}`)}return[]}function Y7(t){let e={get:{summary:()=>"Update request by device. Waiting for download\u2026",level:"info",snag:"done"},delete:{summary:()=>"Bundle deleted on device",level:"info"},set:{summary:()=>"Bundle set on device \u2764\uFE0F",level:"info",snag:"set",stop:!0},NoChannelOrOverride:{summary:()=>"No default channel/override; create it in channel settings",level:"error"},needPlanUpgrade:{summary:({baseUrl:r})=>`Out of quota. Upgrade plan: ${r}/dashboard/settings/plans`,level:"error"},missingBundle:{summary:()=>"Requested bundle not found on server",level:"error"},noNew:{summary:()=>"Device already has latest available version",level:"info"},disablePlatformIos:{summary:()=>"iOS platform disabled in channel",level:"error"},disablePlatformAndroid:{summary:()=>"Android platform disabled in channel",level:"error"},disableAutoUpdate:{summary:()=>"Automatic updates disabled in channel",level:"error"},disableAutoUpdateToMajor:{summary:()=>"Auto-update to major versions disabled",level:"error"},disableAutoUpdateToMinor:{summary:()=>"Auto-update to minor versions disabled",level:"error"},disableAutoUpdateToPatch:{summary:()=>"Auto-update to patch versions disabled",level:"error"},disableAutoUpdateUnderNative:{summary:()=>"Channel update version is lower than device native",level:"error"},disableDevBuild:{summary:()=>"Dev build updates disabled in channel",level:"error"},disableEmulator:{summary:()=>"Emulator updates disabled in channel",level:"error"},cannotGetBundle:{summary:()=>"Cannot retrieve bundle from channel",level:"error"},cannotUpdateViaPrivateChannel:{summary:()=>"No access to private channel",level:"error"},channelMisconfigured:{summary:()=>"Channel configuration invalid or incomplete",level:"error"},disableAutoUpdateMetadata:{summary:()=>"Auto-update on metadata disabled",level:"error"},set_fail:{summary:()=>"Bundle set failed. Possibly corrupted",level:"error"},reset:{summary:()=>"Device reset to builtin bundle",level:"warn"},update_fail:{summary:()=>"Installed bundle failed to call notifyAppReady",level:"error"},checksum_fail:{summary:()=>"Downloaded bundle checksum validation failed",level:"error"},windows_path_fail:{summary:()=>"Bundle contains illegal Windows-style paths",level:"error"},canonical_path_fail:{summary:()=>"Bundle contains non-canonical paths",level:"error"},directory_path_fail:{summary:()=>"Bundle ZIP contains invalid directory paths",level:"error"},unzip_fail:{summary:()=>"Failed to unzip bundle on device",level:"error"},low_mem_fail:{summary:()=>"Download failed due to low device memory",level:"error"},app_moved_to_background:{summary:()=>"App moved to background",level:"info"},app_moved_to_foreground:{summary:()=>"App moved to foreground",level:"info"},decrypt_fail:{summary:()=>"Failed to decrypt downloaded bundle",level:"error"},getChannel:{summary:()=>"Queried current channel on device",level:"info"},setChannel:{summary:()=>"Channel set on device",level:"info"},InvalidIp:{summary:()=>"Device appears in Google datacenter; blocking recent updates (<4h)",level:"warn"},uninstall:{summary:()=>"App uninstalled or Capgo data cleared on device",level:"warn"}};if(t.action.startsWith("download_")){let r=t.action.split("_")[1];return r==="complete"?{summary:()=>"Download complete; relaunch app to apply",level:"info",snag:"downloaded"}:r==="fail"?{summary:()=>"Download failed on device",level:"error"}:{summary:()=>`Downloading ${r}%`,level:"info"}}return e[t.action]||null}async function J7(t,e,r,n,o,i){let s=Y7(t);if(!s)return{};s.snag&&await Gr(e,r,n,s.snag);let a=W7(t.created_at),u=t.action,c=t.version_id?`(version #${t.version_id})`:"",l=t.version?` (version ${t.version})`:c,f=`${s.summary({data:t,baseAppUrl:o,baseUrl:i})}${l}`;return{row:[a,t.device_id,u,f],stop:s.stop}}async function aD(t,e,r,n,o){let i=!0,s=await Dr(),a=`${s.hostWeb}/app/p/${r}`;await Gr(t,n,e,"Use waitlog",r);let u={appId:r,devicesId:o?[o]:void 0,order:[{key:"created_at",sortable:"desc"}],rangeStart:new Date().toISOString()},c=null,l=new Set,f=Se(),h=`${s.host}/docs/plugins/updater/debugging/#sent-from-the-backend`;for(f.start(`Waiting for logs (Expect delay of 30 sec) more info: ${h}`);i;){await G7(5e3);let d=await X7(e,u,c);if(d.length>0){let m=d.reduce((_,g)=>{let x=new Date(g.created_at).getTime();return Math.max(_,x)},c?new Date(c).getTime():0);m>0&&(c=new Date(m).toISOString());let b=d.filter(_=>{let g=`${_.app_id}|${_.device_id}|${_.action}|${_.version_id}|${_.created_at}`;return l.has(g)?!1:(l.add(g),!0)}).sort((_,g)=>new Date(_.created_at).getTime()-new Date(g.created_at).getTime()),D=new mt;D.headers=["Time","Device","Key","Message"],D.theme=mt.roundTheme,D.rows=[];let E=!1;for(let _ of b){let{row:g,stop:x}=await J7(_,t,n,e,a,s.hostWeb);g&&D.rows.push(g),x&&(E=!0)}if(D.rows.length&&(f.stop(""),p.info(D.toString()),f.start(`Waiting for logs (Expect delay of 30 sec) more info: ${h}`)),E){i=!1;break}}}return f.stop("Stop watching logs"),Promise.resolve()}async function WF(t,e,r=!1){r||ee("Debug Live update in Capgo"),await De(),e.apikey=e.apikey||ce();let n=await ne();t=ge(t,n?.config);let o=e.device;if(!e.apikey)throw r||p.error("Missing API key, you need to provide an API key to delete your app"),new Error("Missing API key");if(!t)throw r||p.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(r)throw new Error("Debug command requires an interactive terminal");let i=await ie(e.apikey,e.supaHost,e.supaAnon),s=await yr(i,t),a=await Ce({message:"Automatic check if update working in device ?"});await K7("debug",a,s,e.apikey),a?(r||p.info(`Wait logs sent to Capgo from ${t} device, Please background your app and open it again \u{1F4AA}`),await aD("debug",e.apikey,t,s,o),r||Z("Done \u2705")):r||Z("Canceled \u274C")}async function KF(t,e,r=!1,n=!1){r||ee("Deleting"),e.apikey=e.apikey||ce();let o=await ne(),i=ge(t,o?.config);if(!e.apikey)throw r||p.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!i)throw r||p.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let s=await ie(e.apikey,e.supaHost,e.supaAnon),a=await ae(s,e.apikey,["write","all"]);await qe(s,e.apikey,i,5,r);let{data:u,error:c}=await s.from("apps").select("owner_org ( created_by, id )").eq("app_id",i).single(),l=u;if(!n&&!c&&(l?.owner_org.created_by??"")!==a){if(r)throw new Error("Cannot delete app: you are not the organization owner");{p.warn("Deleting the app is not recomended for users that are not the organization owner"),p.warn("You are invited as a super_admin but your are not the owner"),p.warn("It's strongly recomended that you do not continue!");let b=await Sr({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(Ee(b)||b==="no")throw p.error("Canceled deleting the app, exiting"),new Error("App deletion cancelled")}}else c&&!r&&p.warn(`Cannot get the app owner ${j(c)}`);let{error:f}=await s.storage.from("images").remove([`org/${l?.owner_org.id}/${i}/icon`]);f&&!r&&p.error("Could not delete app logo");let{error:h}=await s.storage.from(`apps/${i}/${a}`).remove(["versions"]);h&&!r&&p.error("Could not delete app version");let{error:d}=await s.from("apps").delete().eq("app_id",i);if(d)throw r||p.error("Could not delete app"),new Error(`Could not delete app: ${j(d)}`);let m=await yr(s,i);return await we(e.apikey,{channel:"app",event:"App Deleted",icon:"\u{1F5D1}\uFE0F",user_id:m,tags:{"app-id":i},notify:!1}).catch(()=>{}),r||(p.success("App deleted in Capgo"),Z("Done \u2705")),!0}var af=require("node:os"),YF=require("node:process");async function XF(t){let e={},r=Object.keys(t);return(await Promise.all(r.map(o=>sf(o)))).forEach((o,i)=>{o&&(e[r[i]]=o)}),e}async function Z7(){let t=await dt(),e={"@capgo/cli":_r.version};for(let[r,n]of t)(r.startsWith("@capgo/")||r.startsWith("@capawesome/")||r.startsWith("capacitor"))&&(e[r]=n);return e}async function JF(t,e=!1){e||p.warn(" \u{1F48A} Capgo Doctor \u{1F48A}");let r=await ne(),n=Rr("",t.packageJson),o=r?.config?.plugins?.CapacitorUpdater?.version||n,i=r?.config?.appName||"",s=ge("",r?.config),a=r?.config?.webDir||"";e||(p.info(` App Name: ${i}`),p.info(` App ID: ${s}`),p.info(` App Version: ${o}`),p.info(` Web Dir: ${a}`),p.info(` OS: ${(0,af.platform)()} ${(0,af.version)()}`),p.info(` Node: ${YF.version}`),p.info(" Installed Dependencies:"));let u=await Z7();if(Object.keys(u).length===0)throw e||p.warning("\x1B[31m%s\x1B[0m \u{1F6A8} No dependencies found"),new Error("No dependencies found");if(!e)for(let l of Object.keys(u))p.info(` ${l}: ${u[l]}`);let c={};if(e)c=await XF(u);else{let l=Se();l.start("Running: Loading latest dependencies"),c=await XF(u),l.stop("Latest Dependencies:");for(let f of Object.keys(c))p.info(` ${f}: ${c[f]}`)}if(JSON.stringify(u)!==JSON.stringify(c))throw e||p.warn("\x1B[31m\u{1F6A8} Some dependencies are not up to date\x1B[0m"),new Error("Some dependencies are not up to date");return e||p.success("\x1B[32m\u2705 All dependencies are up to date\x1B[0m"),{appName:i,appId:s,appVersion:o,webDir:a,installedDependencies:u,latestDependencies:c}}function Q7(t){let e=new mt;e.headers=["Name","id","Created"],e.rows=[];for(let r of t.toReversed())e.rows.push([r.name??"",r.app_id,cs(r.created_at)]);p.success("Apps"),p.success(e.toString())}async function eH(t,e){let{data:r,error:n}=await t.from("apps").select().order("created_at",{ascending:!1});if(n)throw e||p.error("Apps not found"),new Error("Apps not found");return r??[]}async function ZF(t,e=!1){e||ee("List apps in Capgo"),await De(),t.apikey=t.apikey||ce();let r=await ie(t.apikey,t.supaHost,t.supaAnon);await ae(r,t.apikey,["write","all","read","upload"]),e||p.info("Getting active bundle in Capgo");let n=await eH(r,e);if(!n.length)throw e||p.error("No apps found"),new Error("No apps found");return e||(p.info(`Active app in Capgo: ${n.length}`),Q7(n),Z("Done \u2705")),n}var QF=require("node:crypto"),fs=require("node:fs");async function e2(t,e,r=!1){r||ee("Set app"),e.apikey=e.apikey||ce();let n=await ne();if(t=ge(t,n?.config),!e.apikey)throw r||p.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||p.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let o=await ie(e.apikey,e.supaHost,e.supaAnon),s=(await us(o,["admin","super_admin"])).gid,a=await ae(o,e.apikey,["write","all"]);await qe(o,e.apikey,t,4,r);let{name:u,icon:c,retention:l}=e;if(l&&Number.isNaN(Number(l)))throw r||p.error("retention value must be a number"),new Error("Retention value must be a number");if(l&&l<0)throw r||p.error("retention value cannot be less than 0"),new Error("Retention value cannot be less than 0");if(l&&l>=63113904)throw r||p.error("retention value cannot be greater than 63113904 seconds (2 years)"),new Error("Retention value cannot be greater than 63113904 seconds (2 years)");let f,h,d=`icon_${(0,QF.randomUUID)()}`,m="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(c&&(0,fs.existsSync)(c)?(f=(0,fs.readFileSync)(c),h=as(c)||"image/png",r||p.warn(`Found app icon ${c}`)):(0,fs.existsSync)(br)?(f=(0,fs.readFileSync)(br),h=as(br)||"image/png",r||p.warn(`Found app icon ${br}`)):r||p.warn(`Cannot find app icon in any of the following locations: ${c}, ${br}`),f&&h){let{error:D}=await o.storage.from(`images/org/${s}/${t}`).upload(d,f,{contentType:h});if(D)throw r||p.error(`Could not set app ${j(D)}`),new Error(`Could not set app: ${j(D)}`);let{data:E}=await o.storage.from(`images/org/${s}/${t}`).getPublicUrl(d);m=E?.publicUrl||m}let{error:b}=await o.from("apps").update({icon_url:m,name:u,retention:l?l*24*60*60:void 0}).eq("app_id",t).eq("user_id",a);if(b)throw r||p.error(`Could not set app ${j(b)}`),new Error(`Could not set app: ${j(b)}`);return r||Z("Done \u2705"),!0}async function t2(t,e,r=!1){if(r||ee("Set a specific setting in capacitor config"),e.bool&&e.string)throw r||p.error("Bool and string CANNOT be set at the same time"),new Error("Bool and string cannot both be provided");if(!e.bool&&!e.string)throw r||p.error("You MUST provide either bool or string as the value"),new Error("Either bool or string value is required");if(e.bool&&e.bool!=="true"&&e.bool!=="false")throw r||p.error("Invalid bool"),new Error("Invalid bool value; expected true or false");try{let n=await ne(),o=n.config,i=t.split(".");if(i.length===0)throw r||p.error("Invalid path"),new Error("Invalid config path");for(let a of i.slice(0,-1))Object.prototype.hasOwnProperty.call(o,a)||(o[a]={}),o=o[a];let s=e.bool?e.bool==="true":e.string;o[i.at(-1)]=s,await Qi(n,!0),r||p.success(`Set "${t}" to "${s}"`)}catch(n){throw r||p.error(`Cannot set config in capacitor settings ${j(n)}`),new Error(`Cannot set capacitor config: ${j(n)}`)}r||Z("Done \u2705")}async function r2(t,e,r,n={}){let{silent:o=!1,autoUnlink:i=!1}=n,{data:s,error:a}=await t.from("channels").select().eq("app_id",e).eq("version",r.id);if(a)throw o||p.error(`Cannot check Version ${e}@${r.name}: ${j(a)}`),new Error(`Cannot check version ${e}@${r.name}: ${j(a)}`);if(!s?.length)return;if(o)throw new Error(`Version ${e}@${r.name} is used in ${s.length} channel(s)`);ee(`\u274C Version ${e}@${r.name} is used in ${s.length} channel${s.length>1?"s":""}`);let u=i;if(i||(u=await Ce({message:"unlink it?"})===!0),!u)throw p.error("Unlink it first"),new Error(`Version ${e}@${r.name} is still linked to channel(s)`);for(let c of s){let l=Se();l.start(`Unlinking channel ${c.name}`);let f=await uD(t,e,{silent:o});if(!f)throw l.stop(`Cannot find unknown version for ${e}`),new Error(`Cannot find unknown version for ${e}`);let{error:h}=await t.from("channels").update({version:f.id}).eq("id",c.id);if(h)throw l.stop(`Cannot update channel ${c.name} ${j(h)}`),new Error(`Cannot update channel ${c.name}: ${j(h)}`);l.stop(`\u2705 Channel ${c.name} unlinked`)}Z(`Version unlinked from ${s.length} channel${s.length>1?"s":""}`)}async function uD(t,e,r={}){let{silent:n=!1}=r,{data:o,error:i}=await t.from("app_versions").select("id").eq("app_id",e).eq("name","unknown").single();if(i)throw n||p.error(`Cannot call findUnknownVersion as it returned an error.
169
- ${j(i)}`),new Error(`Cannot retrieve unknown version for app ${e}: ${j(i)}`);return o}function n2(t,e){return t.from("channels").insert(e).select().single()}function o2(t,e,r,n){return t.from("channels").delete().eq("name",e).eq("app_id",r).single()}function i2(t,e,r){return t.from("channels").select().eq("app_id",e).eq("name",r).single()}function s2(t,e,r){return t.from("channel_devices").delete().eq("app_id",e).eq("channel_id",r)}function a2(t,e,r){return t.from("channels").select(`
166
+ 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 de(t,e){return t||e?.plugins?.CapacitorUpdater?.appId||e?.appId}function So(t){if(!t.localVersion)return!0;if(!t.remoteVersion)return!1;try{let e=ru(t.localVersion),r=ru(t.remoteVersion);return GD(e,r)}catch{return!1}}async function Sl(t,e,r,n,o){let i=await sg(n,o),a=await o2(t,e,r),s=i.filter(c=>!!c.native).map(c=>{let l=a.get(c.name);return l?{name:c.name,localVersion:c.version,remoteVersion:l.version}:{name:c.name,localVersion:c.version,remoteVersion:void 0}}),u=[...a].filter(([c])=>i.find(l=>l.name===c)===void 0).map(([c,l])=>({name:c,localVersion:void 0,remoteVersion:l.version}));return s.push(...u),{finalCompatibility:s,localDependencies:i}}async function ug(t,e,r,n){let o=await o2(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 a2(t,e){let{data:r}=await t.rpc("exist_app_v2",{appid:e}).single();return!!r}async function Ne(t,e,r,n,o=!1){let i=lt(),a=await G1(t,e,r);if(!a.okay)switch(a.error){case"INVALID_APIKEY":{let c="Invalid apikey, such apikey does not exists!";throw o||p.error(c),new Error(c)}case"NO_APP":{let c=`App ${r} does not exist, run first \`${i.runner} @capgo/cli app add ${r}\` to create it`;throw o||p.error(c),new Error(c)}case"NO_ORG":{let c="Could not find organization, please contact support to resolve this!";throw o||p.error(c),new Error(c)}}let s=a.data;if(n>s){let c=`Insuficcent permissions for app ${r}. Current permission: ${wt[a.data]}, required for this action: ${wt[n]}.`;throw o||p.error(c),new Error(c)}return a.data}var cr="assets/icon.png";async function Fl(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 he(){let t=await Fl("@capgo/cli")??"",e=t?.split(".")[0];t!==hr.version&&p.warning(`\u{1F6A8} You are using @capgo/cli@${hr.version} it's not the latest version.
167
+ Please use @capgo/cli@${t}" or @capgo/cli@${e} to keep up to date with the latest features and bug fixes.`)}function N5(t,e,r){if(!e.apikey)throw r||p.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||p.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(t.includes("--"))throw r||p.error('The app id includes illegal symbols. You cannot use "--" in the app id'),new Error("App id includes illegal symbols")}async function L5(t,e,r){if(await a2(t,e))throw e==="io.ionic.starter"?(r||p.error(`This appId ${e} cannot be used it's reserved, please change it in your capacitor config.`),new Error("Reserved appId, please change it in capacitor config")):(r||p.error(`App ${e} already exist`),new Error(`App ${e} already exists`))}async function U5(t,e,r=!1){return cg(t,e,void 0,r)}async function cg(t,e,r,n=!1){n||Z("Adding"),await he(),e.apikey=e.apikey||ae();let o=await te(),i=de(t,o?.config);N5(i,e,n);let a=await ne(e.apikey,e.supaHost,e.supaAnon),s=await oe(a,e.apikey,["write","all"]);await L5(a,i,n),r||(r=await Yi(a,["admin","super_admin"]));let u=r.gid,{name:c,icon:l}=e;if(c=c||o.config?.appName||"Unknown",l=l||"resources/icon.png",!l||!c)throw n||p.error("Missing argument, you need to provide a appId and a name, or be in a capacitor project"),new Error("Missing app name or icon path");n||p.info(`Adding ${i} to Capgo`);let f=null,d=null;l&&(0,Xi.existsSync)(l)?(f=(0,Xi.readFileSync)(l),d=Ki(l)||"image/png",n||p.warn(`Found app icon ${l}`)):(0,Xi.existsSync)(cr)?(f=(0,Xi.readFileSync)(cr),d=Ki(cr)||"image/png",n||p.warn(`Found app icon ${cr}`)):n||p.warn(`Cannot find app icon in any of the following locations: ${l}, ${cr}`);let h="icon",m="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(f&&d){let{error:C}=await a.storage.from(`images/org/${u}/${i}`).upload(h,f,{contentType:d});if(C)throw n||console.error(C),n||p.error(`Could not add app ${L(C)}`),new Error(`Could not add app ${L(C)}`);let{data:E}=await a.storage.from(`images/org/${u}/${i}`).getPublicUrl(h);m=E?.publicUrl||m}let{error:b}=await a.from("apps").insert({icon_url:m,owner_org:u,user_id:s,name:c,app_id:i});if(b)throw n||p.error(`Could not add app ${L(b)}`),new Error(`Could not add app ${L(b)}`);let{error:D}=await a.from("app_versions").insert([{owner_org:u,deleted:!0,name:"unknown",app_id:i},{owner_org:u,deleted:!0,name:"builtin",app_id:i}]);if(D)throw n||p.error(`Could not add app ${L(D)}`),new Error(`Could not add app ${L(D)}`);return n||(p.success(`App ${i} added to Capgo. You can upload a bundle now`),J("Done \u2705")),{appId:i,organizationUid:u,userId:s,name:c,signedURL:m}}async function s2(t,e){await U5(t,e,!1)}function u2(t,e){let n=["normal","bold","dim","italic","underline","strikethrough"].indexOf(t),o="\x1B[";return o+n+"m"+e+o+"0m"}var ft=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?u2("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))+u2("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(`
168
+ `)}};function M5(t){return new Promise(e=>{setTimeout(e,t)})}function q5(t){return new Date(t||"").toLocaleTimeString()}async function Rr(t,e,r,n,o,i="\u2705"){await De(r,{channel:t,event:n,icon:i,user_id:e,...o?{tags:{"app-id":o}}:{},notify:!1})}async function H5(t,e,r,n){if(be(e))throw await Rr(t,r,n,"canceled",void 0,"\u{1F937}"),new Error("Command cancelled")}async function V5(t,e,r){try{let n=await sr(),o=r?{...e,rangeStart:r}:{...e},i=await fetch(`${n.hostApi}/private/stats`,{method:"POST",headers:{"Content-Type":"application/json",capgkey:t},body:JSON.stringify(o)});if(!i.ok)throw new Error(`HTTP error! status: ${i.status}`);let a=await i.json();if(a?.length>0)return a}catch(n){console.error("Cannot get devices",n),p.error(`Cannot get stats ${L(n)}`)}return[]}function z5(t){let e={get:{summary:()=>"Update request by device. Waiting for download\u2026",level:"info",snag:"done"},delete:{summary:()=>"Bundle deleted on device",level:"info"},set:{summary:()=>"Bundle set on device \u2764\uFE0F",level:"info",snag:"set",stop:!0},NoChannelOrOverride:{summary:()=>"No default channel/override; create it in channel settings",level:"error"},needPlanUpgrade:{summary:({baseUrl:r})=>`Out of quota. Upgrade plan: ${r}/dashboard/settings/plans`,level:"error"},missingBundle:{summary:()=>"Requested bundle not found on server",level:"error"},noNew:{summary:()=>"Device already has latest available version",level:"info"},disablePlatformIos:{summary:()=>"iOS platform disabled in channel",level:"error"},disablePlatformAndroid:{summary:()=>"Android platform disabled in channel",level:"error"},disableAutoUpdate:{summary:()=>"Automatic updates disabled in channel",level:"error"},disableAutoUpdateToMajor:{summary:()=>"Auto-update to major versions disabled",level:"error"},disableAutoUpdateToMinor:{summary:()=>"Auto-update to minor versions disabled",level:"error"},disableAutoUpdateToPatch:{summary:()=>"Auto-update to patch versions disabled",level:"error"},disableAutoUpdateUnderNative:{summary:()=>"Channel update version is lower than device native",level:"error"},disableDevBuild:{summary:()=>"Dev build updates disabled in channel",level:"error"},disableEmulator:{summary:()=>"Emulator updates disabled in channel",level:"error"},cannotGetBundle:{summary:()=>"Cannot retrieve bundle from channel",level:"error"},cannotUpdateViaPrivateChannel:{summary:()=>"No access to private channel",level:"error"},channelMisconfigured:{summary:()=>"Channel configuration invalid or incomplete",level:"error"},disableAutoUpdateMetadata:{summary:()=>"Auto-update on metadata disabled",level:"error"},set_fail:{summary:()=>"Bundle set failed. Possibly corrupted",level:"error"},reset:{summary:()=>"Device reset to builtin bundle",level:"warn"},update_fail:{summary:()=>"Installed bundle failed to call notifyAppReady",level:"error"},checksum_fail:{summary:()=>"Downloaded bundle checksum validation failed",level:"error"},windows_path_fail:{summary:()=>"Bundle contains illegal Windows-style paths",level:"error"},canonical_path_fail:{summary:()=>"Bundle contains non-canonical paths",level:"error"},directory_path_fail:{summary:()=>"Bundle ZIP contains invalid directory paths",level:"error"},unzip_fail:{summary:()=>"Failed to unzip bundle on device",level:"error"},low_mem_fail:{summary:()=>"Download failed due to low device memory",level:"error"},app_moved_to_background:{summary:()=>"App moved to background",level:"info"},app_moved_to_foreground:{summary:()=>"App moved to foreground",level:"info"},decrypt_fail:{summary:()=>"Failed to decrypt downloaded bundle",level:"error"},getChannel:{summary:()=>"Queried current channel on device",level:"info"},setChannel:{summary:()=>"Channel set on device",level:"info"},InvalidIp:{summary:()=>"Device appears in Google datacenter; blocking recent updates (<4h)",level:"warn"},uninstall:{summary:()=>"App uninstalled or Capgo data cleared on device",level:"warn"}};if(t.action.startsWith("download_")){let r=t.action.split("_")[1];return r==="complete"?{summary:()=>"Download complete; relaunch app to apply",level:"info",snag:"downloaded"}:r==="fail"?{summary:()=>"Download failed on device",level:"error"}:{summary:()=>`Downloading ${r}%`,level:"info"}}return e[t.action]||null}async function G5(t,e,r,n,o,i){let a=z5(t);if(!a)return{};a.snag&&await Rr(e,r,n,a.snag);let s=q5(t.created_at),u=t.action,c=t.version_id?`(version #${t.version_id})`:"",l=t.version?` (version ${t.version})`:c,f=`${a.summary({data:t,baseAppUrl:o,baseUrl:i})}${l}`;return{row:[s,t.device_id,u,f],stop:a.stop}}async function lg(t,e,r,n,o){let i=!0,a=await sr(),s=`${a.hostWeb}/app/p/${r}`;await Rr(t,n,e,"Use waitlog",r);let u={appId:r,devicesId:o?[o]:void 0,order:[{key:"created_at",sortable:"desc"}],rangeStart:new Date().toISOString()},c=null,l=new Set,f=Ee(),d=`${a.host}/docs/plugins/updater/debugging/#sent-from-the-backend`;for(f.start(`Waiting for logs (Expect delay of 30 sec) more info: ${d}`);i;){await M5(5e3);let h=await V5(e,u,c);if(h.length>0){let m=h.reduce((E,g)=>{let _=new Date(g.created_at).getTime();return Math.max(E,_)},c?new Date(c).getTime():0);m>0&&(c=new Date(m).toISOString());let b=h.filter(E=>{let g=`${E.app_id}|${E.device_id}|${E.action}|${E.version_id}|${E.created_at}`;return l.has(g)?!1:(l.add(g),!0)}).sort((E,g)=>new Date(E.created_at).getTime()-new Date(g.created_at).getTime()),D=new ft;D.headers=["Time","Device","Key","Message"],D.theme=ft.roundTheme,D.rows=[];let C=!1;for(let E of b){let{row:g,stop:_}=await G5(E,t,n,e,s,a.hostWeb);g&&D.rows.push(g),_&&(C=!0)}if(D.rows.length&&(f.stop(""),p.info(D.toString()),f.start(`Waiting for logs (Expect delay of 30 sec) more info: ${d}`)),C){i=!1;break}}}return f.stop("Stop watching logs"),Promise.resolve()}async function c2(t,e,r=!1){r||Z("Debug Live update in Capgo"),await he(),e.apikey=e.apikey||ae();let n=await te();t=de(t,n?.config);let o=e.device;if(!e.apikey)throw r||p.error("Missing API key, you need to provide an API key to delete your app"),new Error("Missing API key");if(!t)throw r||p.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(r)throw new Error("Debug command requires an interactive terminal");let i=await ne(e.apikey,e.supaHost,e.supaAnon),a=await ur(i,t),s=await ve({message:"Automatic check if update working in device ?"});await H5("debug",s,a,e.apikey),s?(r||p.info(`Wait logs sent to Capgo from ${t} device, Please background your app and open it again \u{1F4AA}`),await lg("debug",e.apikey,t,a,o),r||J("Done \u2705")):r||J("Canceled \u274C")}async function l2(t,e,r=!1,n=!1){r||Z("Deleting"),e.apikey=e.apikey||ae();let o=await te(),i=de(t,o?.config);if(!e.apikey)throw r||p.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!i)throw r||p.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let a=await ne(e.apikey,e.supaHost,e.supaAnon),s=await oe(a,e.apikey,["write","all"]);await Ne(a,e.apikey,i,5,r);let{data:u,error:c}=await a.from("apps").select("owner_org ( created_by, id )").eq("app_id",i).single(),l=u;if(!n&&!c&&(l?.owner_org.created_by??"")!==s){if(r)throw new Error("Cannot delete app: you are not the organization owner");{p.warn("Deleting the app is not recomended for users that are not the organization owner"),p.warn("You are invited as a super_admin but your are not the owner"),p.warn("It's strongly recomended that you do not continue!");let b=await gr({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(be(b)||b==="no")throw p.error("Canceled deleting the app, exiting"),new Error("App deletion cancelled")}}else c&&!r&&p.warn(`Cannot get the app owner ${L(c)}`);let{error:f}=await a.storage.from("images").remove([`org/${l?.owner_org.id}/${i}/icon`]);f&&!r&&p.error("Could not delete app logo");let{error:d}=await a.storage.from(`apps/${i}/${s}`).remove(["versions"]);d&&!r&&p.error("Could not delete app version");let{error:h}=await a.from("apps").delete().eq("app_id",i);if(h)throw r||p.error("Could not delete app"),new Error(`Could not delete app: ${L(h)}`);let m=await ur(a,i);return await De(e.apikey,{channel:"app",event:"App Deleted",icon:"\u{1F5D1}\uFE0F",user_id:m,tags:{"app-id":i},notify:!1}).catch(()=>{}),r||(p.success("App deleted in Capgo"),J("Done \u2705")),!0}var Al=require("node:os"),p2=require("node:process");async function f2(t){let e={},r=Object.keys(t);return(await Promise.all(r.map(o=>Fl(o)))).forEach((o,i)=>{o&&(e[r[i]]=o)}),e}async function W5(){let t=await ct(),e={"@capgo/cli":hr.version};for(let[r,n]of t)(r.startsWith("@capgo/")||r.startsWith("@capawesome/")||r.startsWith("capacitor"))&&(e[r]=n);return e}async function d2(t,e=!1){e||p.warn(" \u{1F48A} Capgo Doctor \u{1F48A}");let r=await te(),n=_r("",t.packageJson),o=r?.config?.plugins?.CapacitorUpdater?.version||n,i=r?.config?.appName||"",a=de("",r?.config),s=r?.config?.webDir||"";e||(p.info(` App Name: ${i}`),p.info(` App ID: ${a}`),p.info(` App Version: ${o}`),p.info(` Web Dir: ${s}`),p.info(` OS: ${(0,Al.platform)()} ${(0,Al.version)()}`),p.info(` Node: ${p2.version}`),p.info(" Installed Dependencies:"));let u=await W5();if(Object.keys(u).length===0)throw e||p.warning("\x1B[31m%s\x1B[0m \u{1F6A8} No dependencies found"),new Error("No dependencies found");if(!e)for(let l of Object.keys(u))p.info(` ${l}: ${u[l]}`);let c={};if(e)c=await f2(u);else{let l=Ee();l.start("Running: Loading latest dependencies"),c=await f2(u),l.stop("Latest Dependencies:");for(let f of Object.keys(c))p.info(` ${f}: ${c[f]}`)}if(JSON.stringify(u)!==JSON.stringify(c))throw e||p.warn("\x1B[31m\u{1F6A8} Some dependencies are not up to date\x1B[0m"),new Error("Some dependencies are not up to date");return e||p.success("\x1B[32m\u2705 All dependencies are up to date\x1B[0m"),{appName:i,appId:a,appVersion:o,webDir:s,installedDependencies:u,latestDependencies:c}}function K5(t){let e=new ft;e.headers=["Name","id","Created"],e.rows=[];for(let r of t.toReversed())e.rows.push([r.name??"",r.app_id,Ji(r.created_at)]);p.success("Apps"),p.success(e.toString())}async function Y5(t,e){let{data:r,error:n}=await t.from("apps").select().order("created_at",{ascending:!1});if(n)throw e||p.error("Apps not found"),new Error("Apps not found");return r??[]}async function h2(t,e=!1){e||Z("List apps in Capgo"),await he(),t.apikey=t.apikey||ae();let r=await ne(t.apikey,t.supaHost,t.supaAnon);await oe(r,t.apikey,["write","all","read","upload"]),e||p.info("Getting active bundle in Capgo");let n=await Y5(r,e);if(!n.length)throw e||p.error("No apps found"),new Error("No apps found");return e||(p.info(`Active app in Capgo: ${n.length}`),K5(n),J("Done \u2705")),n}var m2=require("node:crypto"),Zi=require("node:fs");async function g2(t,e,r=!1){r||Z("Set app"),e.apikey=e.apikey||ae();let n=await te();if(t=de(t,n?.config),!e.apikey)throw r||p.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||p.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let o=await ne(e.apikey,e.supaHost,e.supaAnon),a=(await Yi(o,["admin","super_admin"])).gid,s=await oe(o,e.apikey,["write","all"]);await Ne(o,e.apikey,t,4,r);let{name:u,icon:c,retention:l}=e;if(l&&Number.isNaN(Number(l)))throw r||p.error("retention value must be a number"),new Error("Retention value must be a number");if(l&&l<0)throw r||p.error("retention value cannot be less than 0"),new Error("Retention value cannot be less than 0");if(l&&l>=63113904)throw r||p.error("retention value cannot be greater than 63113904 seconds (2 years)"),new Error("Retention value cannot be greater than 63113904 seconds (2 years)");let f,d,h=`icon_${(0,m2.randomUUID)()}`,m="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(c&&(0,Zi.existsSync)(c)?(f=(0,Zi.readFileSync)(c),d=Ki(c)||"image/png",r||p.warn(`Found app icon ${c}`)):(0,Zi.existsSync)(cr)?(f=(0,Zi.readFileSync)(cr),d=Ki(cr)||"image/png",r||p.warn(`Found app icon ${cr}`)):r||p.warn(`Cannot find app icon in any of the following locations: ${c}, ${cr}`),f&&d){let{error:D}=await o.storage.from(`images/org/${a}/${t}`).upload(h,f,{contentType:d});if(D)throw r||p.error(`Could not set app ${L(D)}`),new Error(`Could not set app: ${L(D)}`);let{data:C}=await o.storage.from(`images/org/${a}/${t}`).getPublicUrl(h);m=C?.publicUrl||m}let{error:b}=await o.from("apps").update({icon_url:m,name:u,retention:l?l*24*60*60:void 0}).eq("app_id",t).eq("user_id",s);if(b)throw r||p.error(`Could not set app ${L(b)}`),new Error(`Could not set app: ${L(b)}`);return r||J("Done \u2705"),!0}async function D2(t,e,r=!1){if(r||Z("Set a specific setting in capacitor config"),e.bool&&e.string)throw r||p.error("Bool and string CANNOT be set at the same time"),new Error("Bool and string cannot both be provided");if(!e.bool&&!e.string)throw r||p.error("You MUST provide either bool or string as the value"),new Error("Either bool or string value is required");if(e.bool&&e.bool!=="true"&&e.bool!=="false")throw r||p.error("Invalid bool"),new Error("Invalid bool value; expected true or false");try{let n=await te(),o=n.config,i=t.split(".");if(i.length===0)throw r||p.error("Invalid path"),new Error("Invalid config path");for(let s of i.slice(0,-1))Object.prototype.hasOwnProperty.call(o,s)||(o[s]={}),o=o[s];let a=e.bool?e.bool==="true":e.string;o[i.at(-1)]=a,await Ui(n,!0),r||p.success(`Set "${t}" to "${a}"`)}catch(n){throw r||p.error(`Cannot set config in capacitor settings ${L(n)}`),new Error(`Cannot set capacitor config: ${L(n)}`)}r||J("Done \u2705")}async function y2(t,e,r,n={}){let{silent:o=!1,autoUnlink:i=!1}=n,{data:a,error:s}=await t.from("channels").select().eq("app_id",e).eq("version",r.id);if(s)throw o||p.error(`Cannot check Version ${e}@${r.name}: ${L(s)}`),new Error(`Cannot check version ${e}@${r.name}: ${L(s)}`);if(!a?.length)return;if(o)throw new Error(`Version ${e}@${r.name} is used in ${a.length} channel(s)`);Z(`\u274C Version ${e}@${r.name} is used in ${a.length} channel${a.length>1?"s":""}`);let u=i;if(i||(u=await ve({message:"unlink it?"})===!0),!u)throw p.error("Unlink it first"),new Error(`Version ${e}@${r.name} is still linked to channel(s)`);for(let c of a){let l=Ee();l.start(`Unlinking channel ${c.name}`);let f=await fg(t,e,{silent:o});if(!f)throw l.stop(`Cannot find unknown version for ${e}`),new Error(`Cannot find unknown version for ${e}`);let{error:d}=await t.from("channels").update({version:f.id}).eq("id",c.id);if(d)throw l.stop(`Cannot update channel ${c.name} ${L(d)}`),new Error(`Cannot update channel ${c.name}: ${L(d)}`);l.stop(`\u2705 Channel ${c.name} unlinked`)}J(`Version unlinked from ${a.length} channel${a.length>1?"s":""}`)}async function fg(t,e,r={}){let{silent:n=!1}=r,{data:o,error:i}=await t.from("app_versions").select("id").eq("app_id",e).eq("name","unknown").single();if(i)throw n||p.error(`Cannot call findUnknownVersion as it returned an error.
169
+ ${L(i)}`),new Error(`Cannot retrieve unknown version for app ${e}: ${L(i)}`);return o}function b2(t,e){return t.from("channels").insert(e).select().single()}function v2(t,e,r,n){return t.from("channels").delete().eq("name",e).eq("app_id",r).single()}function w2(t,e,r){return t.from("channels").select().eq("app_id",e).eq("name",r).single()}function C2(t,e,r){return t.from("channel_devices").delete().eq("app_id",e).eq("channel_id",r)}function E2(t,e,r){return t.from("channels").select(`
170
170
  id,
171
171
  version (id, name)
172
- `).eq("app_id",e).eq("name",r).single().throwOnError().then(({data:n})=>n?.version)}function u2(t,e=!1){if(e)return;let r=new mt;r.theme=mt.roundTheme,r.headers=["Name","Version","Public","iOS","Android","Auto Update","Native Auto Update","Device Self Set","Progressive Deploy","Secondary Version","Secondary Version Percentage","AB Testing","AB Testing Version","AB Testing Percentage","Emulator","Dev"],r.rows=[];for(let n of t.toReversed())r.rows.push([n.name,n.version?.name,n.public?"\u2705":"\u274C",n.ios?"\u2705":"\u274C",n.android?"\u2705":"\u274C",n.disable_auto_update,n.disable_auto_update_under_native?"\u274C":"\u2705",n.allow_device_self_set?"\u2705":"\u274C",n.allow_emulator?"\u2705":"\u274C",n.allow_dev?"\u2705":"\u274C"]);p.success("Channels"),p.success(r.toString())}async function c2(t,e,r=!1){let{data:n,error:o}=await t.from("channels").select(`
172
+ `).eq("app_id",e).eq("name",r).single().throwOnError().then(({data:n})=>n?.version)}function _2(t,e=!1){if(e)return;let r=new ft;r.theme=ft.roundTheme,r.headers=["Name","Version","Public","iOS","Android","Auto Update","Native Auto Update","Device Self Set","Progressive Deploy","Secondary Version","Secondary Version Percentage","AB Testing","AB Testing Version","AB Testing Percentage","Emulator","Dev"],r.rows=[];for(let n of t.toReversed())r.rows.push([n.name,n.version?.name,n.public?"\u2705":"\u274C",n.ios?"\u2705":"\u274C",n.android?"\u2705":"\u274C",n.disable_auto_update,n.disable_auto_update_under_native?"\u274C":"\u2705",n.allow_device_self_set?"\u2705":"\u274C",n.allow_emulator?"\u2705":"\u274C",n.allow_dev?"\u2705":"\u274C"]);p.success("Channels"),p.success(r.toString())}async function x2(t,e,r=!1){let{data:n,error:o}=await t.from("channels").select(`
173
173
  id,
174
174
  name,
175
175
  public,
@@ -184,53 +184,53 @@ ${j(i)}`),new Error(`Cannot retrieve unknown version for app ${e}: ${j(i)}`);ret
184
184
  created_by,
185
185
  app_id,
186
186
  version (id, name)
187
- `).eq("app_id",e).order("created_at",{ascending:!1});if(o)throw r||p.error(`App ${e} not found in database`),new Error(`App ${e} not found in database: ${j(o)}`);return n}async function cD(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 s=`App version ${e}@${r} not found in database`;throw o||p.error(s),new Error(`${s}: ${j(i)}`)}}async function uf(t,e,r,n={}){let{silent:o=!1,autoUnlink:i=!1}=n,s=await tH(t,e,r,{silent:o});await r2(t,e,s,{silent:o,autoUnlink:i}),await cD(t,e,r,{silent:o})}function cf(t,e=!1){if(e)return;if(!t.length)throw new Error("No bundle found");let r=new mt;r.theme=mt.roundTheme,r.headers=["Version","Created","Keep"],r.rows=[];for(let n of t.toReversed())r.rows.push([n.name,cs(n.created_at),n.keep??""]);p.success("Bundles"),p.success(r.toString())}async function lf(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 s=`App ${e} not found in database`;throw n||p.error(s),new Error(`${s}: ${j(i)}`)}return o??[]}async function l2(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 s=`App ${e} not found in database`;throw n||p.error(s),new Error(`${s}: ${j(i)}`)}return(o??[]).map(s=>s.version)}async function tH(t,e,r,n={}){let{silent:o=!1}=n,{data:i,error:s}=await t.from("app_versions").select().eq("app_id",e).eq("name",r).eq("deleted",!1).single();if(!i||s){let a=`App version ${e}@${r} doesn't exist`;throw o||p.error(a),new Error(`${a}${s?`: ${j(s)}`:""}`)}return i}async function rH(t,e,r,n){for await(let o of t)n||p.warn(`Removing ${o.name} created on ${cs(o.created_at)}`),await uf(e,r,o.name)}function nH(t,e,r){let n=[];for(let o of t??[]){let i=Ae(o.name);vp(i,e)&&Qn(i,r)&&n.push(o)}return n}async function f2(t,e,r=!1){r||ee("Cleanup versions in Capgo"),await De(),e.apikey=e.apikey||ce();let{bundle:n,keep:o=4}=e,i=e.force||!1,s=e.ignoreChannel||!1,a=await ne();if(t=ge(t,a?.config),!e.apikey)throw r||p.error("Missing API key, you need to provide an API key to delete your app"),new Error("Missing API key");if(!t)throw r||p.error("Missing argument, you need to provide a appid, or be in a capacitor project"),new Error("Missing appId");let u=await ie(e.apikey,e.supaHost,e.supaAnon);await ae(u,e.apikey,["write","all"]),await qe(u,e.apikey,t,3,r),r||p.info("Querying all available versions in Capgo");let c=await lf(u,t),l=await l2(u,t);if(r||p.info(`Total active versions in Capgo: ${c?.length??0}`),!c?.length)throw r||p.error("No versions found, aborting cleanup"),new Error("No versions found");if(n){let d=Ae(n),m=Os(d,"major");r||p.info(`Querying available versions in Capgo between ${Fr(d)} and ${Fr(m)}`),c=nH(c,d,m),r||p.info(`Active versions in Capgo between ${Fr(d)} and ${Fr(m)}: ${c?.length??0}`)}let f=[],h=0;for(let d of c){let m=l.find(b=>b===d.id);h<o||m&&!s?(d.keep=m?"\u2705 (Linked to channel)":"\u2705",h+=1):(d.keep="\u274C",f.push(d))}if(!f.length)return r||p.warn("Nothing to be removed, aborting removal..."),{removed:0,kept:h};if(r||cf(c),!i){if(r)throw new Error("Cleanup requires force=true in SDK mode to prevent accidental deletions");{let d=await Ce({message:"Do you want to continue removing the versions specified?"});if(Ee(d)||!d)throw p.warn("Not confirmed, aborting removal..."),new Error("Cleanup cancelled by user")}}return r||p.success("You have confirmed removal, removing versions now"),await rH(f,u,t,r),r||Z("Done \u2705"),{removed:f.length,kept:h}}async function oH(t,e,r=!1){r||ee("Check compatibility");let n={...e,apikey:e.apikey||ce()},o=await ne(),i=ge(t,o?.config),s=n.channel;if(!s)throw r||p.error("Missing argument, you need to provide a channel"),new Error("Missing channel");if(!n.apikey)throw r||p.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!i)throw r||p.error("Missing argument, you need to provide an appId, or be in a capacitor project"),new Error("Missing appId");let a=await ie(n.apikey,n.supaHost,n.supaAnon);await ae(a,n.apikey,["write","all","read","upload"]),await qe(a,n.apikey,i,1,r);let u=await of(a,i,s,n.packageJson,n.nodeModules);if(!r){let c=new mt;c.headers=["Package","Local version","Remote version","Compatible"],c.theme=mt.roundTheme,c.rows=[];let l=n.text?"Yes":"\u2705",f=n.text?"No":"\u274C";for(let h of u.finalCompatibility){let{name:d,localVersion:m,remoteVersion:b}=h,D=Lo(h)?l:f;c.rows.push([d,m,b,D])}p.success("Compatibility"),p.success(c.toString())}return{finalCompatibility:u.finalCompatibility}}async function p2(t,e){try{await oH(t,e,!1)}catch(r){throw p.error(`Error checking compatibility ${j(r)}`),r}}var hn=require("node:fs");var Vn=require("node:buffer"),bt=require("node:crypto"),d2="aes-128-cbc",dn="base64",ff=bt.constants.RSA_PKCS1_PADDING;function pf(t){let e=(0,bt.randomBytes)(16),r=(0,bt.randomBytes)(16),n=e.toString(dn),o=(0,bt.privateEncrypt)({key:t,padding:ff},r).toString(dn);return{sessionKey:r,ivSessionKey:`${n}:${o}`}}function ps(t,e,r){let[n]=r.split(":"),o=Vn.Buffer.from(n,dn),i=(0,bt.createCipheriv)(d2,e,o);return i.setAutoPadding(!0),Vn.Buffer.concat([i.update(t),i.final()])}function h2(t,e,r){let[n,o]=e.split(":"),i=(0,bt.publicDecrypt)({key:r,padding:ff},Vn.Buffer.from(o,dn)),s=Vn.Buffer.from(n,dn),a=(0,bt.createDecipheriv)(d2,i,s);return a.setAutoPadding(!0),Vn.Buffer.concat([a.update(t),a.final()])}function ds(t,e){return(0,bt.privateEncrypt)({key:e,padding:ff},Vn.Buffer.from(t,dn)).toString(dn)}function m2(t="pem",e=2048){let{publicKey:r,privateKey:n}=(0,bt.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 g2(t,e){return(0,bt.publicDecrypt)({key:e,padding:ff},Vn.Buffer.from(t,dn)).toString(dn)}function iH(t,e){let r=t.key||pn,n=e.config.plugins?.CapacitorUpdater?.publicKey;return(0,hn.existsSync)(r)?n=(0,hn.readFileSync)(r,"utf8"):!n&&t.keyData&&(n=t.keyData),{publicKey:n,fallbackKeyPath:r}}async function sH(t,e,r,n=!1){n||ee("Decrypt zip file");try{if(await De(),!(0,hn.existsSync)(t)){let f=`Zip not found at the path ${t}`;throw n||p.error(f),new Error(f)}let o=await ne();if(!r.key&&!(0,hn.existsSync)(pn)&&!o.config.plugins?.CapacitorUpdater?.privateKey){let f=`Private Key not found at the path ${pn} or in ${o.path}`;throw n||p.error(f),new Error(f)}let{publicKey:i,fallbackKeyPath:s}=iH(r,o);if(!i){let f=`Cannot find public key ${s} or as keyData option or in ${o.path}`;throw n||p.error(f),new Error(f)}let a=(0,hn.readFileSync)(t),u=h2(a,e,r.keyData??i),c=`${t}_decrypted.zip`;(0,hn.writeFileSync)(c,u),n||p.info(`Decrypted zip file at ${c}`);let l;if(r.checksum){let f=await un(u,"sha256"),h=g2(r.checksum,r.keyData??i);if(l=f===h,!l){let d=`Checksum does not match ${f} !== ${h}`;throw n||p.error(d),new Error(d)}n||p.info("Checksum matches")}return n||Z("\u2705 done"),{outputPath:c,checksumMatches:l}}catch(o){throw n||p.error(`Error decrypting zip file ${j(o)}`),o instanceof Error?o:new Error(String(o))}}async function D2(t,e,r){await sH(t,e,r,!1)}async function y2(t,e,r,n=!1){n||ee("Delete bundle"),r.apikey=r.apikey||ce();let o=await ne();if(e=ge(e,o?.config),!r.apikey)throw n||p.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||p.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||p.error("Missing argument, you need to provide a bundleId, or be in a capacitor project"),new Error("Missing bundleId");let i=await ie(r.apikey,r.supaHost,r.supaAnon);return await ae(i,r.apikey,["write","all"]),await qe(i,r.apikey,e,3,n),n||(p.info(`Deleting bundle ${e}@${t} from Capgo`),p.info("Keep in mind that you will not be able to reuse this bundle version, it's gone forever")),await uf(i,e,t),n||(p.success(`Bundle ${e}@${t} deleted in Capgo`),Z("Done")),!0}var mn=require("node:fs");function Ua(t){console.error(j(t))}async function aH(t,e,r,n=!1){let{json:o}=r,i=!o&&!n;i&&(ee("Encryption"),await De());try{let s=await ne(),a=!!s.config.plugins?.CapacitorUpdater?.privateKey,u=!!s.config.plugins?.CapacitorUpdater?.publicKey;if(a&&i&&p.warning("There is still a privateKey in the config"),!(0,mn.existsSync)(t)){let E=`Zip not found at the path ${t}`;throw n||(o?Ua({error:"zip_not_found"}):p.error(`Error: ${E}`)),new Error(E)}if(!u)throw n||(o?Ua({error:"missing_public_key"}):p.warning("Warning: Missing Public Key in config")),new Error("Missing public key in config");let c=r.key||tr,l=r.keyData||"";if(!(0,mn.existsSync)(c)&&!l)throw n||(o?Ua({error:"missing_key"}):(p.warning(`Cannot find a private key at ${c} or as a keyData option`),p.error("Error: Missing key"))),new Error("Missing private key");if((0,mn.existsSync)(c)&&(l=(0,mn.readFileSync)(c,"utf8")),l&&!l.startsWith("-----BEGIN RSA PRIVATE KEY-----"))throw n||(o?Ua({error:"invalid_private_key"}):p.error("The private key provided is not a valid RSA Private key")),new Error("Invalid private key format");let f=(0,mn.readFileSync)(t),{sessionKey:h,ivSessionKey:d}=pf(l),m=ps(f,h,d),b=ds(e,l),D=`${t}_encrypted.zip`;return(0,mn.writeFileSync)(D,m),n||(o?console.log(JSON.stringify({checksum:b,filename:D,ivSessionKey:d},null,2)):(p.success(`Encoded Checksum: ${b}`),p.success(`ivSessionKey: ${d}`),p.success(`Encrypted zip saved at ${D}`),Z("Done \u2705"))),{checksum:b,filename:D,ivSessionKey:d}}catch(s){throw n||(r.json?Ua(s):p.error(`Error encrypting zip file ${j(s)}`)),s instanceof Error?s:new Error(String(s))}}async function b2(t,e,r){await aH(t,e,r,!1)}async function w2(t,e,r=!1){r||ee("List bundles"),await De(),e.apikey=e.apikey||ce();let n=await ne();if(t=ge(t,n?.config),!e.apikey)throw r||p.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||p.error("Missing argument, you need to provide a appid, or be in a capacitor project"),new Error("Missing appId");let o=await ie(e.apikey,e.supaHost,e.supaAnon);await ae(o,e.apikey,["write","all","read","upload"]),await qe(o,e.apikey,t,1,r),r||p.info(`Querying available versions of: ${t} in Capgo`);let i=await lf(o,t);return r||(p.info(`Active versions in Capgo: ${i?.length??0}`),cf(i),Z("Done \u2705")),i}var KO=require("node:crypto"),Go=require("node:fs"),RD=require("node:path/posix"),ID=require("node:process");var df=class extends TransformStream{outChunkSize;constructor(e){let r=new Uint8Array(e),n=0;super({transform(o,i){let s=0;for(;s<o.length;){let a=e-n,u=Math.min(a,o.length-s);r.set(o.subarray(s,s+u),n),s+=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 h={attributes:{}};for(;!(c()||l("?>"));){let d=i();if(!d)return h;h.attributes[d.name]=d.value}return u(/\?>\s*/),h}function n(){let f=u(/^<([\w-:.]+)\s*/);if(!f)return;let h={name:f[1],attributes:{},children:[]};for(;!(c()||l(">")||l("?>")||l("/>"));){let m=i();if(!m)return h;h.attributes[m.name]=m.value}if(u(/^\s*\/>\s*/))return h;u(/\??>\s*/),h.content=o();let d;for(;d=n();)h.children.push(d);return u(/^<\/[\w-:.]+>\s*/),h}function o(){let f=u(/^([^<]*)/);return f?a(f[1]):""}function i(){let f=u(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(f)return{name:f[1],value:a(s(f[2]))}}function s(f){return f.replace(/^['"]|['"]$/g,"")}function a(f){return f.replaceAll("&lt;","<").replaceAll("&gt;",">").replaceAll("&amp;","&")}function u(f){let h=t.match(f);if(h)return t=t.slice(h[0].length),h}function c(){return t.length===0}function l(f){return t.startsWith(f)}}var Wr=class extends Error{};var Ft=class extends Wr{},Ma=class extends Wr{},hf=class extends Wr{bucketName;constructor(e){super(`Invalid bucket name: ${e}`),this.bucketName=e}},Kr=class extends Wr{objectName;constructor(e){super(`Invalid object name: ${e}`),this.objectName=e}},Gn=class extends Wr{constructor(){super("accessKey is required")}},hs=class extends Wr{constructor(){super("secretKey is required")}},qa=class extends Wr{constructor(){super("expirySeconds cannot be less than 1 second or more than 7 days")}},gn=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 v2(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,s=r.children.find(c=>c.name==="BucketName")?.content,a=r.children.find(c=>c.name==="Resource")?.content,u=r.children.find(c=>c.name==="Region")?.content;return new gn(t.status,n,o,{key:i,bucketName:s,resource:a,region:u})}catch{return new gn(t.status,"UnrecognizedError",`Error: Unexpected response code ${t.status} ${t.statusText}. Unable to parse response as XML.`)}}function E2(t){return typeof t!="number"||isNaN(t)?!1:t>=1&&t<=65535}function C2(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 Wn(t){return!(!uH(t)||t.length===0)}function uH(t){return!(typeof t!="string"||t.length>1024)}function Ha(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}function jo(t=""){let e={'"':"","&quot;":"","&#34;":"","&QUOT;":"","&#x00022":""};return t.replace(/^("|&quot;|&#34;)|("|&quot;|&#34;)$/g,r=>e[r])}function fD(t){return t.get("x-amz-version-id")??null}function Uo(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 pD(t){return Uo(t).slice(0,8)}function dD(t,e){return`${pD(e)}/${t}/s3/aws4_request`}async function mf(t){return t instanceof Uint8Array||(t=new TextEncoder().encode(t)),Ha(new Uint8Array(await crypto.subtle.digest("SHA-256",t)))}var cH=["x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5"],gf=class extends WritableStream{getResult;constructor({client:e,bucketName:r,objectName:n,partSize:o,metadata:i}){let s,a=1,u,c=[],l,f=[];super({start(){},async write(h,d){let b=a++;try{if(b==1&&h.length<o){let _=await e.makeRequest({method:"PUT",headers:new Headers({...i,"Content-Length":String(h.length)}),bucketName:r,objectName:n,payload:h});s={etag:jo(_.headers.get("etag")??void 0),versionId:fD(_.headers)};return}b===1&&(u=(await lH({client:e,bucketName:r,objectName:n,metadata:i})).uploadId);let D={"Content-Length":String(h.length)};for(let _ of cH){let g=i[_];g&&(D[_]=g)}let E=e.makeRequest({method:"PUT",query:{partNumber:b.toString(),uploadId:u},headers:new Headers(D),bucketName:r,objectName:n,payload:h}).then(_=>{let g=_.headers.get("etag")??"";return g&&(g=g.replace(/^"/,"").replace(/"$/,"")),c.push({part:b,etag:g}),_});f.push(E.catch(_=>{l||(l=_)}))}catch(D){throw D}},async close(){if(!s)if(u){if(await Promise.all(f),l)throw l;c.sort((h,d)=>h.part>d.part?1:-1),s=await fH({client:e,bucketName:r,objectName:n,uploadId:u,etags:c})}else throw new Error("Stream was closed without uploading any data.")}}),this.getResult=()=>{if(s===void 0)throw new Error("Result is not ready. await the stream first.");return s}}};async function lH(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(),s=zn(i).root;if(!s||s.name!=="InitiateMultipartUploadResult")throw new Error(`Unexpected response: ${i}`);let a=s.children.find(u=>u.name==="UploadId")?.content;if(!a)throw new Error(`Unable to get UploadId from response: ${i}`);return{uploadId:a}}async function fH({client:t,bucketName:e,objectName:r,uploadId:n,etags:o}){let i=`
187
+ `).eq("app_id",e).order("created_at",{ascending:!1});if(o)throw r||p.error(`App ${e} not found in database`),new Error(`App ${e} not found in database: ${L(o)}`);return n}async function pg(t,e,r,n={}){let{silent:o=!1}=n,{error:i}=await t.from("app_versions").update({deleted:!0}).eq("app_id",e).eq("deleted",!1).eq("name",r);if(i){let a=`App version ${e}@${r} not found in database`;throw o||p.error(a),new Error(`${a}: ${L(i)}`)}}async function Ol(t,e,r,n={}){let{silent:o=!1,autoUnlink:i=!1}=n,a=await J5(t,e,r,{silent:o});await y2(t,e,a,{silent:o,autoUnlink:i}),await pg(t,e,r,{silent:o})}function kl(t,e=!1){if(e)return;if(!t.length)throw new Error("No bundle found");let r=new ft;r.theme=ft.roundTheme,r.headers=["Version","Created","Keep"],r.rows=[];for(let n of t.toReversed())r.rows.push([n.name,Ji(n.created_at),n.keep??""]);p.success("Bundles"),p.success(r.toString())}async function $l(t,e,r={}){let{silent:n=!1}=r,{data:o,error:i}=await t.from("app_versions").select().eq("app_id",e).eq("deleted",!1).order("created_at",{ascending:!1});if(i){let a=`App ${e} not found in database`;throw n||p.error(a),new Error(`${a}: ${L(i)}`)}return o??[]}async function S2(t,e,r={}){let{silent:n=!1}=r,{data:o,error:i}=await t.from("channels").select("version").eq("app_id",e);if(i){let a=`App ${e} not found in database`;throw n||p.error(a),new Error(`${a}: ${L(i)}`)}return(o??[]).map(a=>a.version)}async function J5(t,e,r,n={}){let{silent:o=!1}=n,{data:i,error:a}=await t.from("app_versions").select().eq("app_id",e).eq("name",r).eq("deleted",!1).single();if(!i||a){let s=`App version ${e}@${r} doesn't exist`;throw o||p.error(s),new Error(`${s}${a?`: ${L(a)}`:""}`)}return i}async function X5(t,e,r,n){for await(let o of t)n||p.warn(`Removing ${o.name} created on ${Ji(o.created_at)}`),await Ol(e,r,o.name)}function Z5(t,e,r){let n=[];for(let o of t??[]){let i=_e(o.name);Hf(i,e)&&qn(i,r)&&n.push(o)}return n}async function F2(t,e,r=!1){r||Z("Cleanup versions in Capgo"),await he(),e.apikey=e.apikey||ae();let{bundle:n,keep:o=4}=e,i=e.force||!1,a=e.ignoreChannel||!1,s=await te();if(t=de(t,s?.config),!e.apikey)throw r||p.error("Missing API key, you need to provide an API key to delete your app"),new Error("Missing API key");if(!t)throw r||p.error("Missing argument, you need to provide a appid, or be in a capacitor project"),new Error("Missing appId");let u=await ne(e.apikey,e.supaHost,e.supaAnon);await oe(u,e.apikey,["write","all"]),await Ne(u,e.apikey,t,3,r),r||p.info("Querying all available versions in Capgo");let c=await $l(u,t),l=await S2(u,t);if(r||p.info(`Total active versions in Capgo: ${c?.length??0}`),!c?.length)throw r||p.error("No versions found, aborting cleanup"),new Error("No versions found");if(n){let h=_e(n),m=ga(h,"major");r||p.info(`Querying available versions in Capgo between ${yr(h)} and ${yr(m)}`),c=Z5(c,h,m),r||p.info(`Active versions in Capgo between ${yr(h)} and ${yr(m)}: ${c?.length??0}`)}let f=[],d=0;for(let h of c){let m=l.find(b=>b===h.id);d<o||m&&!a?(h.keep=m?"\u2705 (Linked to channel)":"\u2705",d+=1):(h.keep="\u274C",f.push(h))}if(!f.length)return r||p.warn("Nothing to be removed, aborting removal..."),{removed:0,kept:d};if(r||kl(c),!i){if(r)throw new Error("Cleanup requires force=true in SDK mode to prevent accidental deletions");{let h=await ve({message:"Do you want to continue removing the versions specified?"});if(be(h)||!h)throw p.warn("Not confirmed, aborting removal..."),new Error("Cleanup cancelled by user")}}return r||p.success("You have confirmed removal, removing versions now"),await X5(f,u,t,r),r||J("Done \u2705"),{removed:f.length,kept:d}}async function Q5(t,e,r=!1){r||Z("Check compatibility");let n={...e,apikey:e.apikey||ae()},o=await te(),i=de(t,o?.config),a=n.channel;if(!a)throw r||p.error("Missing argument, you need to provide a channel"),new Error("Missing channel");if(!n.apikey)throw r||p.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!i)throw r||p.error("Missing argument, you need to provide an appId, or be in a capacitor project"),new Error("Missing appId");let s=await ne(n.apikey,n.supaHost,n.supaAnon);await oe(s,n.apikey,["write","all","read","upload"]),await Ne(s,n.apikey,i,1,r);let u=await Sl(s,i,a,n.packageJson,n.nodeModules);if(!r){let c=new ft;c.headers=["Package","Local version","Remote version","Compatible"],c.theme=ft.roundTheme,c.rows=[];let l=n.text?"Yes":"\u2705",f=n.text?"No":"\u274C";for(let d of u.finalCompatibility){let{name:h,localVersion:m,remoteVersion:b}=d,D=So(d)?l:f;c.rows.push([h,m,b,D])}p.success("Compatibility"),p.success(c.toString())}return{finalCompatibility:u.finalCompatibility}}async function A2(t,e){try{await Q5(t,e,!1)}catch(r){throw p.error(`Error checking compatibility ${L(r)}`),r}}var nn=require("node:fs");var Tn=require("node:buffer"),mt=require("node:crypto"),O2="aes-128-cbc",rn="base64",Pl=mt.constants.RSA_PKCS1_PADDING;function Tl(t){let e=(0,mt.randomBytes)(16),r=(0,mt.randomBytes)(16),n=e.toString(rn),o=(0,mt.privateEncrypt)({key:t,padding:Pl},r).toString(rn);return{sessionKey:r,ivSessionKey:`${n}:${o}`}}function Qi(t,e,r){let[n]=r.split(":"),o=Tn.Buffer.from(n,rn),i=(0,mt.createCipheriv)(O2,e,o);return i.setAutoPadding(!0),Tn.Buffer.concat([i.update(t),i.final()])}function k2(t,e,r){let[n,o]=e.split(":"),i=(0,mt.publicDecrypt)({key:r,padding:Pl},Tn.Buffer.from(o,rn)),a=Tn.Buffer.from(n,rn),s=(0,mt.createDecipheriv)(O2,i,a);return s.setAutoPadding(!0),Tn.Buffer.concat([s.update(t),s.final()])}function ea(t,e){return(0,mt.privateEncrypt)({key:e,padding:Pl},Tn.Buffer.from(t,rn)).toString(rn)}function $2(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 P2(t,e){return(0,mt.publicDecrypt)({key:e,padding:Pl},Tn.Buffer.from(t,rn)).toString(rn)}function eU(t,e){let r=t.key||tn,n=e.config.plugins?.CapacitorUpdater?.publicKey;return(0,nn.existsSync)(r)?n=(0,nn.readFileSync)(r,"utf8"):!n&&t.keyData&&(n=t.keyData),{publicKey:n,fallbackKeyPath:r}}async function tU(t,e,r,n=!1){n||Z("Decrypt zip file");try{if(await he(),!(0,nn.existsSync)(t)){let f=`Zip not found at the path ${t}`;throw n||p.error(f),new Error(f)}let o=await te();if(!r.key&&!(0,nn.existsSync)(tn)&&!o.config.plugins?.CapacitorUpdater?.privateKey){let f=`Private Key not found at the path ${tn} or in ${o.path}`;throw n||p.error(f),new Error(f)}let{publicKey:i,fallbackKeyPath:a}=eU(r,o);if(!i){let f=`Cannot find public key ${a} or as keyData option or in ${o.path}`;throw n||p.error(f),new Error(f)}let s=(0,nn.readFileSync)(t),u=k2(s,e,r.keyData??i),c=`${t}_decrypted.zip`;(0,nn.writeFileSync)(c,u),n||p.info(`Decrypted zip file at ${c}`);let l;if(r.checksum){let f=await Xr(u,"sha256"),d=P2(r.checksum,r.keyData??i);if(l=f===d,!l){let h=`Checksum does not match ${f} !== ${d}`;throw n||p.error(h),new Error(h)}n||p.info("Checksum matches")}return n||J("\u2705 done"),{outputPath:c,checksumMatches:l}}catch(o){throw n||p.error(`Error decrypting zip file ${L(o)}`),o instanceof Error?o:new Error(String(o))}}async function T2(t,e,r){await tU(t,e,r,!1)}async function I2(t,e,r,n=!1){n||Z("Delete bundle"),r.apikey=r.apikey||ae();let o=await te();if(e=de(e,o?.config),!r.apikey)throw n||p.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||p.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||p.error("Missing argument, you need to provide a bundleId, or be in a capacitor project"),new Error("Missing bundleId");let i=await ne(r.apikey,r.supaHost,r.supaAnon);return await oe(i,r.apikey,["write","all"]),await Ne(i,r.apikey,e,3,n),n||(p.info(`Deleting bundle ${e}@${t} from Capgo`),p.info("Keep in mind that you will not be able to reuse this bundle version, it's gone forever")),await Ol(i,e,t),n||(p.success(`Bundle ${e}@${t} deleted in Capgo`),J("Done")),!0}var on=require("node:fs");function vs(t){console.error(L(t))}async function rU(t,e,r,n=!1){let{json:o}=r,i=!o&&!n;i&&(Z("Encryption"),await he());try{let a=await te(),s=!!a.config.plugins?.CapacitorUpdater?.privateKey,u=!!a.config.plugins?.CapacitorUpdater?.publicKey;if(s&&i&&p.warning("There is still a privateKey in the config"),!(0,on.existsSync)(t)){let C=`Zip not found at the path ${t}`;throw n||(o?vs({error:"zip_not_found"}):p.error(`Error: ${C}`)),new Error(C)}if(!u)throw n||(o?vs({error:"missing_public_key"}):p.warning("Warning: Missing Public Key in config")),new Error("Missing public key in config");let c=r.key||Wt,l=r.keyData||"";if(!(0,on.existsSync)(c)&&!l)throw n||(o?vs({error:"missing_key"}):(p.warning(`Cannot find a private key at ${c} or as a keyData option`),p.error("Error: Missing key"))),new Error("Missing private key");if((0,on.existsSync)(c)&&(l=(0,on.readFileSync)(c,"utf8")),l&&!l.startsWith("-----BEGIN RSA PRIVATE KEY-----"))throw n||(o?vs({error:"invalid_private_key"}):p.error("The private key provided is not a valid RSA Private key")),new Error("Invalid private key format");let f=(0,on.readFileSync)(t),{sessionKey:d,ivSessionKey:h}=Tl(l),m=Qi(f,d,h),b=ea(e,l),D=`${t}_encrypted.zip`;return(0,on.writeFileSync)(D,m),n||(o?console.log(JSON.stringify({checksum:b,filename:D,ivSessionKey:h},null,2)):(p.success(`Encoded Checksum: ${b}`),p.success(`ivSessionKey: ${h}`),p.success(`Encrypted zip saved at ${D}`),J("Done \u2705"))),{checksum:b,filename:D,ivSessionKey:h}}catch(a){throw n||(r.json?vs(a):p.error(`Error encrypting zip file ${L(a)}`)),a instanceof Error?a:new Error(String(a))}}async function R2(t,e,r){await rU(t,e,r,!1)}async function B2(t,e,r=!1){r||Z("List bundles"),await he(),e.apikey=e.apikey||ae();let n=await te();if(t=de(t,n?.config),!e.apikey)throw r||p.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||p.error("Missing argument, you need to provide a appid, or be in a capacitor project"),new Error("Missing appId");let o=await ne(e.apikey,e.supaHost,e.supaAnon);await oe(o,e.apikey,["write","all","read","upload"]),await Ne(o,e.apikey,t,1,r),r||p.info(`Querying available versions of: ${t} in Capgo`);let i=await $l(o,t);return r||(p.info(`Active versions in Capgo: ${i?.length??0}`),kl(i),J("Done \u2705")),i}var lF=require("node:crypto"),Io=require("node:fs"),jg=require("node:path/posix"),Ng=require("node:process");var Il=class extends TransformStream{outChunkSize;constructor(e){let r=new Uint8Array(e),n=0;super({transform(o,i){let a=0;for(;a<o.length;){let s=e-n,u=Math.min(s,o.length-a);r.set(o.subarray(a,a+u),n),a+=u,n+=u,n===e&&(i.enqueue(r),r=new Uint8Array(e),n=0)}},flush(o){n>0&&o.enqueue(r.subarray(0,n))}}),this.outChunkSize=e}};function In(t){return t=t.trim(),t=t.replace(/<!--[\s\S]*?-->/g,""),e();function e(){return{declaration:r(),root:n()}}function r(){if(!u(/^<\?xml\s*/))return;let d={attributes:{}};for(;!(c()||l("?>"));){let h=i();if(!h)return d;d.attributes[h.name]=h.value}return u(/\?>\s*/),d}function n(){let f=u(/^<([\w-:.]+)\s*/);if(!f)return;let d={name:f[1],attributes:{},children:[]};for(;!(c()||l(">")||l("?>")||l("/>"));){let m=i();if(!m)return d;d.attributes[m.name]=m.value}if(u(/^\s*\/>\s*/))return d;u(/\??>\s*/),d.content=o();let h;for(;h=n();)d.children.push(h);return u(/^<\/[\w-:.]+>\s*/),d}function o(){let f=u(/^([^<]*)/);return f?s(f[1]):""}function i(){let f=u(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(f)return{name:f[1],value:s(a(f[2]))}}function a(f){return f.replace(/^['"]|['"]$/g,"")}function s(f){return f.replaceAll("&lt;","<").replaceAll("&gt;",">").replaceAll("&amp;","&")}function u(f){let d=t.match(f);if(d)return t=t.slice(d[0].length),d}function c(){return t.length===0}function l(f){return t.startsWith(f)}}var Br=class extends Error{};var Ct=class extends Br{},ws=class extends Br{},Rl=class extends Br{bucketName;constructor(e){super(`Invalid bucket name: ${e}`),this.bucketName=e}},jr=class extends Br{objectName;constructor(e){super(`Invalid object name: ${e}`),this.objectName=e}},Rn=class extends Br{constructor(){super("accessKey is required")}},ta=class extends Br{constructor(){super("secretKey is required")}},Cs=class extends Br{constructor(){super("expirySeconds cannot be less than 1 second or more than 7 days")}},an=class extends Br{statusCode;code;key;bucketName;resource;region;constructor(e,r,n,o={}){super(n),this.statusCode=e,this.code=r,this.key=o.key,this.bucketName=o.bucketName,this.resource=o.resource,this.region=o.region}};async function j2(t){try{let r=In(await t.text()).root;if(r?.name!=="Error")throw new Error("Invalid root, expected <Error>");let n=r.children.find(c=>c.name==="Code")?.content??"UnknownErrorCode",o=r.children.find(c=>c.name==="Message")?.content??"The error message could not be determined.",i=r.children.find(c=>c.name==="Key")?.content,a=r.children.find(c=>c.name==="BucketName")?.content,s=r.children.find(c=>c.name==="Resource")?.content,u=r.children.find(c=>c.name==="Region")?.content;return new an(t.status,n,o,{key:i,bucketName:a,resource:s,region:u})}catch{return new an(t.status,"UnrecognizedError",`Error: Unexpected response code ${t.status} ${t.statusText}. Unable to parse response as XML.`)}}function N2(t){return typeof t!="number"||isNaN(t)?!1:t>=1&&t<=65535}function L2(t){return typeof t!="string"||t.length<3||t.length>63||t.includes("..")||t.match(/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/)?!1:!!t.match(/^[a-z0-9][a-z0-9.-]+[a-z0-9]$/)}function Bn(t){return!(!nU(t)||t.length===0)}function nU(t){return!(typeof t!="string"||t.length>1024)}function Es(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}function Fo(t=""){let e={'"':"","&quot;":"","&#34;":"","&QUOT;":"","&#x00022":""};return t.replace(/^("|&quot;|&#34;)|("|&quot;|&#34;)$/g,r=>e[r])}function hg(t){return t.get("x-amz-version-id")??null}function Ao(t){let e=t.toISOString();return e.slice(0,4)+e.slice(5,7)+e.slice(8,13)+e.slice(14,16)+e.slice(17,19)+"Z"}function mg(t){return Ao(t).slice(0,8)}function gg(t,e){return`${mg(e)}/${t}/s3/aws4_request`}async function Bl(t){return t instanceof Uint8Array||(t=new TextEncoder().encode(t)),Es(new Uint8Array(await crypto.subtle.digest("SHA-256",t)))}var oU=["x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5"],jl=class extends WritableStream{getResult;constructor({client:e,bucketName:r,objectName:n,partSize:o,metadata:i}){let a,s=1,u,c=[],l,f=[];super({start(){},async write(d,h){let b=s++;try{if(b==1&&d.length<o){let E=await e.makeRequest({method:"PUT",headers:new Headers({...i,"Content-Length":String(d.length)}),bucketName:r,objectName:n,payload:d});a={etag:Fo(E.headers.get("etag")??void 0),versionId:hg(E.headers)};return}b===1&&(u=(await iU({client:e,bucketName:r,objectName:n,metadata:i})).uploadId);let D={"Content-Length":String(d.length)};for(let E of oU){let g=i[E];g&&(D[E]=g)}let C=e.makeRequest({method:"PUT",query:{partNumber:b.toString(),uploadId:u},headers:new Headers(D),bucketName:r,objectName:n,payload:d}).then(E=>{let g=E.headers.get("etag")??"";return g&&(g=g.replace(/^"/,"").replace(/"$/,"")),c.push({part:b,etag:g}),E});f.push(C.catch(E=>{l||(l=E)}))}catch(D){throw D}},async close(){if(!a)if(u){if(await Promise.all(f),l)throw l;c.sort((d,h)=>d.part>h.part?1:-1),a=await aU({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 iU(t){let e="POST",r=new Headers(t.metadata),i=await(await t.client.makeRequest({method:e,bucketName:t.bucketName,objectName:t.objectName,query:"uploads",headers:r,returnBody:!0})).text(),a=In(i).root;if(!a||a.name!=="InitiateMultipartUploadResult")throw new Error(`Unexpected response: ${i}`);let s=a.children.find(u=>u.name==="UploadId")?.content;if(!s)throw new Error(`Unable to get UploadId from response: ${i}`);return{uploadId:s}}async function aU({client:t,bucketName:e,objectName:r,uploadId:n,etags:o}){let i=`
188
188
  <CompleteMultipartUpload xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
189
189
  ${o.map(f=>` <Part><PartNumber>${f.part}</PartNumber><ETag>${f.etag}</ETag></Part>`).join(`
190
190
  `)}
191
191
  </CompleteMultipartUpload>
192
- `,s=await t.makeRequest({method:"POST",bucketName:e,objectName:r,query:`uploadId=${encodeURIComponent(n)}`,payload:new TextEncoder().encode(i),returnBody:!0}),a=await s.text(),u=zn(a).root;if(!u||u.name!=="CompleteMultipartUploadResult")throw new Error(`Unexpected response: ${a}`);let c=u.children.find(f=>f.name==="ETag")?.content;if(!c)throw new Error(`Unable to get ETag from response: ${a}`);let l=fD(s.headers);return{etag:jo(c),versionId:l}}var Va="AWS4-HMAC-SHA256";async function _2(t){if(!t.accessKey)throw new Gn;if(!t.secretKey)throw new hs;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=S2(t.headers),n=A2(t.method,t.path,t.headers,r,e),o=await F2(n,t.date,t.region),i=await mD(t.date,t.region,t.secretKey),s=gD(t.accessKey,t.region,t.date),a=Ha(await qo(i,o)).toLowerCase();return`${Va} Credential=${s}, SignedHeaders=${r.join(";").toLowerCase()}, Signature=${a}`}async function x2(t){if(!t.accessKey)throw new Gn;if(!t.secretKey)throw new hs;if(t.expirySeconds<1||t.expirySeconds>604800)throw new qa;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=Uo(t.date),o=S2(t.headers),i=gD(t.accessKey,t.region,t.date),s="UNSIGNED-PAYLOAD",a=new URLSearchParams(r);a.set("X-Amz-Algorithm",Va),a.set("X-Amz-Credential",i),a.set("X-Amz-Date",n),a.set("X-Amz-Expires",t.expirySeconds.toString()),a.set("X-Amz-SignedHeaders",o.join(";").toLowerCase()),t.sessionToken&&a.set("X-Amz-Security-Token",t.sessionToken);let u=a.toString().replace("+","%20"),c=e+"?"+u,l=e.split("/").map(D=>encodeURIComponent(D)).join("/"),f=A2(t.method,c,t.headers,o,s),h=await F2(f,t.date,t.region),d=await mD(t.date,t.region,t.secretKey),m=Ha(await qo(d,h)).toLowerCase();return`${t.protocol}//${t.headers.get("Host")}${l}?${u}&X-Amz-Signature=${m}`}function S2(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 Mo={A:65,Z:90,a:97,z:122,0:48,9:57,"/":47},pH="-._~".split("").map(t=>t.charCodeAt(0));function hD(t,e=!1){let r=new TextEncoder().encode(t),n="";for(let o of r)o>=Mo.A&&o<=Mo.Z||o>=Mo.a&&o<=Mo.z||o>=Mo[0]&&o<=Mo[9]||pH.includes(o)||o==Mo["/"]&&e?n+=String.fromCharCode(o):n+="%"+o.toString(16).padStart(2,"0").toUpperCase();return n}function A2(t,e,r,n,o){let i=n.reduce((u,c)=>{let l=`${r.get(c)}`.replace(/ +/g," ");return u.push(`${c.toLowerCase()}:${l}`),u},[]),s=e.split("?")[0],a=e.split("?")[1];return a?a=a.split("&").map(u=>{let[c,l]=u.split("=",2);return hD(decodeURIComponent(c))+"="+hD(decodeURIComponent(l||""))}).sort().join("&"):a="",[t.toUpperCase(),hD(s,!0),a,i.join(`
192
+ `,a=await t.makeRequest({method:"POST",bucketName:e,objectName:r,query:`uploadId=${encodeURIComponent(n)}`,payload:new TextEncoder().encode(i),returnBody:!0}),s=await a.text(),u=In(s).root;if(!u||u.name!=="CompleteMultipartUploadResult")throw new Error(`Unexpected response: ${s}`);let c=u.children.find(f=>f.name==="ETag")?.content;if(!c)throw new Error(`Unable to get ETag from response: ${s}`);let l=hg(a.headers);return{etag:Fo(c),versionId:l}}var _s="AWS4-HMAC-SHA256";async function U2(t){if(!t.accessKey)throw new Rn;if(!t.secretKey)throw new ta;let e=t.headers.get("x-amz-content-sha256");if(e===null)throw new Error("Internal S3 client error - expected x-amz-content-sha256 header, but it's missing.");let r=q2(t.headers),n=H2(t.method,t.path,t.headers,r,e),o=await V2(n,t.date,t.region),i=await yg(t.date,t.region,t.secretKey),a=bg(t.accessKey,t.region,t.date),s=Es(await ko(i,o)).toLowerCase();return`${_s} Credential=${a}, SignedHeaders=${r.join(";").toLowerCase()}, Signature=${s}`}async function M2(t){if(!t.accessKey)throw new Rn;if(!t.secretKey)throw new ta;if(t.expirySeconds<1||t.expirySeconds>604800)throw new Cs;if(!t.headers.has("Host"))throw new Error("Internal error: host header missing");let e=t.path.split("?")[0],r=t.path.split("?")[1],n=Ao(t.date),o=q2(t.headers),i=bg(t.accessKey,t.region,t.date),a="UNSIGNED-PAYLOAD",s=new URLSearchParams(r);s.set("X-Amz-Algorithm",_s),s.set("X-Amz-Credential",i),s.set("X-Amz-Date",n),s.set("X-Amz-Expires",t.expirySeconds.toString()),s.set("X-Amz-SignedHeaders",o.join(";").toLowerCase()),t.sessionToken&&s.set("X-Amz-Security-Token",t.sessionToken);let u=s.toString().replace("+","%20"),c=e+"?"+u,l=e.split("/").map(D=>encodeURIComponent(D)).join("/"),f=H2(t.method,c,t.headers,o,a),d=await V2(f,t.date,t.region),h=await yg(t.date,t.region,t.secretKey),m=Es(await ko(h,d)).toLowerCase();return`${t.protocol}//${t.headers.get("Host")}${l}?${u}&X-Amz-Signature=${m}`}function q2(t){let e=["authorization","content-length","content-type","user-agent"],r=[];for(let n of t.keys())e.includes(n.toLowerCase())||r.push(n);return r.sort(),r}var Oo={A:65,Z:90,a:97,z:122,0:48,9:57,"/":47},sU="-._~".split("").map(t=>t.charCodeAt(0));function Dg(t,e=!1){let r=new TextEncoder().encode(t),n="";for(let o of r)o>=Oo.A&&o<=Oo.Z||o>=Oo.a&&o<=Oo.z||o>=Oo[0]&&o<=Oo[9]||sU.includes(o)||o==Oo["/"]&&e?n+=String.fromCharCode(o):n+="%"+o.toString(16).padStart(2,"0").toUpperCase();return n}function H2(t,e,r,n,o){let i=n.reduce((u,c)=>{let l=`${r.get(c)}`.replace(/ +/g," ");return u.push(`${c.toLowerCase()}:${l}`),u},[]),a=e.split("?")[0],s=e.split("?")[1];return s?s=s.split("&").map(u=>{let[c,l]=u.split("=",2);return Dg(decodeURIComponent(c))+"="+Dg(decodeURIComponent(l||""))}).sort().join("&"):s="",[t.toUpperCase(),Dg(a,!0),s,i.join(`
193
193
  `)+`
194
194
  `,n.join(";").toLowerCase(),o].join(`
195
- `)}async function F2(t,e,r){let n=await mf(t),o=dD(r,e);return[Va,Uo(e),o,n].join(`
196
- `)}async function mD(t,e,r){let n=pD(t),o=await qo("AWS4"+r,n),i=await qo(o,e),s=await qo(i,"s3");return await qo(s,"aws4_request")}function gD(t,e,r){return`${t}/${dD(e,r)}`}async function qo(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 O2(t){if(!t.accessKey)throw new Gn;if(!t.secretKey)throw new hs;if(t.expirySeconds<1||t.expirySeconds>604800)throw new qa;let e=new Date(t.date);e.setSeconds(e.getSeconds()+t.expirySeconds);let r=gD(t.accessKey,t.region,t.date),n=Uo(t.date),o={"X-Amz-Algorithm":Va,"X-Amz-Credential":r,"X-Amz-Date":n,key:t.objectKey,...t.fields},i=[{bucket:t.bucket},{key:t.objectKey},{"X-Amz-Algorithm":Va},{"X-Amz-Credential":r},{"X-Amz-Date":n}];t.conditions&&i.push(...t.conditions);for(let[d,m]of Object.entries(t.fields||{}))["key","X-Amz-Algorithm","X-Amz-Credential","X-Amz-Date"].includes(d)||i.push({[d]:m});let s={expiration:e.toISOString(),conditions:i},a=new TextEncoder().encode(JSON.stringify(s)),u=btoa(String.fromCharCode(...a));o.policy=u;let c=u,l=await mD(t.date,t.region,t.secretKey),f=Ha(await qo(l,c)).toLowerCase();return o["X-Amz-Signature"]=f,{url:`${t.protocol}//${t.host}/${t.bucket}`,fields:o}}var dH=["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"],hH=5*1024*1024,mH=5*1024*1024*1024,DD=5*1024*1024*1024*1024,za=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 Ft("useSSL/port/pathPrefix cannot be specified if endPoint is a URL.");try{let a=new URL(e);e=a.hostname,r=a.protocol==="https:",n=a.port?parseInt(a.port,10):r?443:80,a.pathname&&a.pathname!=="/"&&(o=a.pathname.endsWith("/")?a.pathname.slice(0,-1):a.pathname)}catch{throw new Ma(`Invalid endPoint URL: ${e}`)}}if(typeof e!="string"||e.length===0)throw new Ma(`Invalid endPoint: ${e}`);if(r===void 0&&(r=!0),n!==void 0&&!E2(n))throw new Ft(`Invalid port: ${n}`);if(i.accessKey&&!i.secretKey)throw new Ft("If specifying access key, secret key must also be provided.");if(i.accessKey&&i.accessKey.startsWith("ASIA")&&!i.sessionToken)throw new Ft("If specifying temporary access key, session token must also be provided.");let s=r?443:80;if(this.port=n??s,this.host=e.toLowerCase()+(this.port!==s?`:${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 Ft("pathPrefix is incompatible with pathStyle=false");if(!this.pathPrefix.startsWith("/"))throw new Ft("pathPrefix should start with /");if(this.pathPrefix.endsWith("/"))throw new Ft("pathPrefix should not end with /")}}getBucketName(e){let r=e?.bucketName??this.defaultBucket;if(r===void 0||!C2(r))throw new hf(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,s=this.pathStyle?`${this.pathPrefix}/${r}/${e.objectName}`:`/${e.objectName}`,a=i?`?${i}`:"",u=s+a,c=s.split("/").map(l=>encodeURIComponent(l)).join("/")+a;return{headers:o,host:n,path:u,encodedPath:c}}async makeRequest({method:e,payload:r,...n}){let o=new Date,{headers:i,host:s,path:a,encodedPath:u}=this.buildRequestOptions(n),c=n.statusCode??200;if(e==="POST"||e==="PUT"||e==="DELETE")r===void 0?r=new Uint8Array:typeof r=="string"&&(r=new TextEncoder().encode(r)),i.set("Content-Length",String(r.length));else if(r)throw new Error(`Unexpected payload on ${e} request.`);let l=await mf(r??new Uint8Array);i.set("x-amz-date",Uo(o)),i.set("x-amz-content-sha256",l),this.accessKey&&(this.sessionToken&&i.set("x-amz-security-token",this.sessionToken),i.set("authorization",await _2({headers:i,method:e,path:a,accessKey:this.accessKey,secretKey:this.#e,region:this.region,date:o})));let f=`${this.protocol}//${s}${u}`,h=await fetch(f,{method:e,headers:i,body:r});if(h.status!==c)throw h.status>=400?await v2(h):h.status===301?new gn(h.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 gn(h.status,"UnexpectedStatusCode",`Unexpected response code from the server (expected ${c}, got ${h.status} ${h.statusText}).`);return n.returnBody||await h.body?.getReader().read(),h}async deleteObject(e,r={}){let n=this.getBucketName(r);if(!Wn(e))throw new Kr(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 gn&&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(!Wn(e))throw new Kr(e);let s=new Headers(Object.entries(o.metadata??{})),a=200;if(r||n){let c="";r?c=`bytes=${+r}-`:(c="bytes=0-",r=0),n&&(c+=`${+n+r-1}`),s.set("Range",c),a=206}let u={...o.responseParams,...o.versionId?{versionId:o.versionId}:{}};return await this.makeRequest({method:"GET",bucketName:i,objectName:e,headers:s,query:u,statusCode:a,returnBody:!0})}getPresignedUrl(e,r,n={}){if(!this.accessKey)throw new Gn;if(!Wn(r))throw new Kr(r);let{headers:o,path:i}=this.buildRequestOptions({objectName:r,bucketName:n.bucketName,query:n.parameters}),s=n.requestDate??new Date,a=n.expirySeconds??1440*60*7;return x2({protocol:this.protocol,headers:o,method:e,path:i,accessKey:this.accessKey,secretKey:this.#e,sessionToken:this.sessionToken,region:this.region,date:s,expirySeconds:a})}presignedGetObject(e,r={}){let{versionId:n,responseParams:o,...i}=r,s={...o,...n?{versionId:n}:{}};return this.getPresignedUrl("GET",e,{parameters:s,...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 Ft("pageSize must be between 1 and 1,000.");let i=0;for(;;){let s=e.maxResults?Math.min(o,e.maxResults-i):o;if(s===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(s),...n?{"continuation-token":n}:{}},returnBody:!0})).text(),c=zn(u).root;if(!c||c.name!=="ListBucketResult")throw new Error(`Unexpected response: ${u}`);let l=c.children.filter(d=>d.name==="CommonPrefixes").flatMap(d=>d.children),f=[];for(let d of l)f.push({type:"CommonPrefix",prefix:d.content??""}),i++;for(let d of c.children.filter(m=>m.name==="Contents"))f.push({type:"Object",key:d.children.find(m=>m.name==="Key")?.content??"",etag:jo(d.children.find(m=>m.name==="ETag")?.content??""),size:parseInt(d.children.find(m=>m.name==="Size")?.content??"",10),lastModified:new Date(d.children.find(m=>m.name==="LastModified")?.content??"invalid")}),i++;f.sort((d,m)=>{let b=d.type==="Object"?d.key:d.prefix,D=m.type==="Object"?m.key:m.prefix;return b>D?1:b<D?-1:0});for(let d of f)yield d;if(c.children.find(d=>d.name==="IsTruncated")?.content==="true"){let d=c.children.find(m=>m.name==="NextContinuationToken")?.content;if(!d)throw new Error("Unexpectedly missing continuation token, but server said there are more results.");n=d}else return}}async putObject(e,r,n){let o=this.getBucketName(n);if(!Wn(e))throw new Kr(e);let i,s;if(typeof r=="string"){let l=new TextEncoder().encode(r);typeof ReadableStream.from<"u"?s=ReadableStream.from([l]):s=new ReadableStream({start(f){f.enqueue(l),f.close()}}),i=l.length}else if(r instanceof Uint8Array)typeof ReadableStream.from<"u"?s=ReadableStream.from([r]):s=new ReadableStream({start(l){l.enqueue(r),l.close()}}),i=r.byteLength;else if(r instanceof ReadableStream)s=r;else throw new Ft("Invalid stream/data type provided.");if(n?.size!==void 0){if(i!==void 0&&n?.size!==i)throw new Ft(`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 Ft(`invalid size specified: ${n.size}`);i=n.size}let a=n?.partSize??this.calculatePartSize(i);if(a<hH)throw new Ft("Part size should be greater than 5MB");if(a>mH)throw new Ft("Part size should be less than 6MB");let u=new df(a),c=new gf({client:this,bucketName:o,objectName:e,partSize:a,metadata:n?.metadata??{}});return await s.pipeThrough(u).pipeTo(c),c.getResult()}calculatePartSize(e){if(e===void 0&&(e=DD),e>DD)throw new TypeError(`size should not be more than ${DD}`);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(!Wn(e))throw new Kr(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)}),s={};for(let a of dH)i.headers.has(a)&&(s[a]=i.headers.get(a));return i.headers.forEach((a,u)=>{u.startsWith("x-amz-meta-")&&(s[u]=i.headers.get(u))}),{type:"Object",key:e,size:parseInt(i.headers.get("content-length")??"",10),metadata:s,lastModified:new Date(i.headers.get("Last-Modified")??"error: missing last modified"),versionId:i.headers.get("x-amz-version-id")||null,etag:jo(i.headers.get("ETag")??"")}}async copyObject(e,r,n){let o=this.getBucketName(n),i=e.sourceBucketName??o;if(!Wn(r))throw new Kr(r);let s=`${i}/${e.sourceKey}`;e.sourceVersionId&&(s+=`?versionId=${e.sourceVersionId}`);let a=new Headers(n?.metadata);n?.metadata!==void 0&&a.set("x-amz-metadata-directive","REPLACE"),a.set("x-amz-copy-source",s);let u=await this.makeRequest({method:"PUT",bucketName:o,objectName:r,headers:a,returnBody:!0}),c=await u.text(),l=zn(c).root;if(!l||l.name!=="CopyObjectResult")throw new Error(`Unexpected response: ${c}`);let f=l.children.find(d=>d.name==="ETag")?.content??"",h=l.children.find(d=>d.name==="LastModified")?.content;if(h===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:jo(f),lastModified:new Date(h),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 gn&&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(!Wn(e))throw new Kr(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 O2({protocol:this.protocol,host:this.host,bucket:n,objectKey:e,accessKey:this.accessKey||"",secretKey:this.#e||"",region:this.region,date:o,expirySeconds:i,conditions:r.conditions,fields:r.fields})}};var Ho=require("node:fs"),Df=require("node:path");function gH(t,e){return(0,Ho.readFileSync)(t,"utf8").includes(e)}function Ga(t,e){let r=(0,Ho.readdirSync)(t);for(let n of r){let o=(0,Df.join)(t,n),i=(0,Ho.statSync)(o);if(i.isDirectory()){if(Ga(o,e))return!0}else if(i.isFile()&&(0,Df.extname)(o)===".js"&&gH(o,e))return!0}return!1}function yf(t){return(0,Ho.readdirSync)(t).indexOf("index.html")>-1}var Ds=require("node:fs"),LO=require("node:os"),Kn=require("node:path"),jO=require("node:process"),Sf=require("node:stream/consumers"),UO=require("node:zlib");var MO=be(NO()),qO=be(gm());async function $V(t,e){try{return(await fetch(`${t.hostFilesApi}/files/read/attachments/${encodeURIComponent(e)}`,{method:"HEAD"})).ok}catch{return!1}}var HO=8192,VO="6.25.0",zO="7.0.35";async function PV(t){let e=(0,Kn.join)(St((0,jO.cwd)()),xt),n=(await dt(void 0,t.packageJson||e)).get("@capgo/capacitor-updater"),o;try{o=n?Ae(n):void 0}catch{o=void 0}if(!n||!o)return{version:null,supportsBrotliV2:!1};let i=o.major===6&&_n(o,Ae(VO)),s=o.major>=7&&_n(o,Ae(zO)),a=i||s;return{version:`${o.major}.${o.minor}.${o.patch}`,supportsBrotliV2:a}}function TV(t,e){if(!e)return!1;let r=e.split(",").map(n=>n.trim()).filter(n=>!!n);return r.length===0?!1:MO.isMatch(t,r)}async function RV(t,e,r){let o=(0,Ds.statSync)(t).size,i=await(0,Sf.buffer)((0,Ds.createReadStream)(t));if(o===0)return{buffer:i,useBrotli:!1};if(TV(e,r.noBrotliPatterns))return p.info(`Skipping brotli for excluded file: ${e}`),{buffer:i,useBrotli:!1};if(o<HO)return{buffer:i,useBrotli:!1};try{let s=await(0,Sf.buffer)((0,Ds.createReadStream)(t).pipe((0,UO.createBrotliCompress)({})));return s.length>=o-10?(p.info(`Brotli not effective for ${e} (${o} bytes), using original file`),{buffer:i,useBrotli:!1}):{buffer:s,useBrotli:!0}}catch(s){return p.warn(`Brotli compression failed for ${t}: ${s}, using original file`),{buffer:i,useBrotli:!1}}}async function GO(t,e,r,n,o,i){let s=Se();s.start(o!=="v2"?"Generating the update manifest":"Generating the update manifest with v2 encryption");let a=await LF(t);if(o==="v2")for(let u of a)u.hash=ds(u.hash,i);return s.stop("Manifest generated successfully"),await we(e,{channel:"partial-update",event:"Generate manifest",icon:"\u{1F4C2}",user_id:r,tags:{"app-id":n},notify:!1}),a}function IV(t){return(0,LO.platform)()!=="win32"?t:Kn.win32.normalize(t).split(Kn.win32.sep).join(Kn.posix.sep)}function BV(t){let e=t.split("/").map(r=>encodeURIComponent(r)).join("/");return t.includes(" ")&&p.warn(`File "${t}" contains spaces in its name.`),e}async function WO(t,e,r,n,o,i,s,a){let u=Se();u.start("Preparing partial update with TUS protocol");let c=performance.now(),l=await Dr(),{version:f,supportsBrotliV2:h}=await PV(a);if(h)a.disableBrotli?p.info("Brotli compression disabled by user request"):(u.message(`Using .br extension for compatible files (updater ${f})`),a.noBrotliPatterns&&p.info(`Files matching patterns (${a.noBrotliPatterns}) will be excluded from brotli compression`),p.info(`Files smaller than ${HO} bytes will be excluded from brotli compression (Brotli RFC minimum)`));else throw new Error(`Your project is using an older version of @capgo/capacitor-updater (${f||"unknown"}). To use Delta updates, please upgrade to version ${VO} (v6) or ${zO} (v7) or higher.`);let d=e.filter(E=>E.file.includes(" "));if(d.length>0)throw new Error(`Files with spaces in their names (${d.map(E=>E.file).join(", ")}). Please rename the files.`);let m=0,b=e.length,D=0;try{let E=e.map(async S=>{let T=(0,Kn.join)(r,S.file),O=IV(S.file),B,I=!1;if(a.disableBrotli)B=await(0,Sf.buffer)((0,Ds.createReadStream)(T)),I=!1;else{let te=await RV(T,O,a);B=te.buffer,I=te.useBrotli}let L=B;s&&(L=ps(B,s.sessionKey,s.ivSessionKey));let F=O;I&&(F=`${O}.br`,D++);let U=BV(F),M=`orgs/${i}/apps/${n}/delta/${S.hash}_${U}`;return await $V(l,M)?(m++,Promise.resolve({file_name:U,s3_path:M,file_hash:S.hash})):new Promise((te,$)=>{new qO.Upload(L,{endpoint:`${l.hostFilesApi}/files/upload/attachments/`,chunkSize:a.tusChunkSize,metadata:{filename:M},headers:{Authorization:t},onError(w){p.info(`Failed to upload ${O}: ${w}`),$(w)},onProgress(){let w=(m/b*100).toFixed(2);u.message(`Uploading partial update: ${w}%`)},onSuccess(){m++,te({file_name:U,s3_path:M,file_hash:S.hash})}}).start()})}),_=await Promise.all(E),x=((performance.now()-c)/1e3).toFixed(2);return u.stop(`Partial update uploaded successfully \u{1F4AA} in (${x} seconds)`),D>0&&p.info(`${D} of ${b} files were compressed with brotli and use .br extension`),await we(t,{channel:"app",event:`App Partial TUS done${D>0?" with .br extension":""}`,icon:"\u23EB",user_id:i,tags:{"app-id":n},notify:!1}),await we(t,{channel:"performance",event:"Partial upload performance",icon:"\u{1F684}",user_id:i,tags:{"app-id":n,time:x},notify:!1}),_}catch(E){let g=((performance.now()-c)/1e3).toFixed(2);return u.stop(`Failed to upload Partial bundle (after ${g} seconds)`),p.info(`Error uploading partial update: ${E}, This is not a critical error, the bundle has been uploaded without the partial files`),null}}function ye(t){throw p.error(t),new Error(t)}async function NV(t,e){let r=Rr("",e.packageJson),n=e.bundle||t?.plugins?.CapacitorUpdater?.version||r||`0.0.1-beta.${(0,KO.randomUUID)().split("-")[0]}`;return is.test(n)||ye(`Your bundle name ${n}, is not valid it should follow semver convention : https://semver.org/`),n}function LV(t){let e=t.apikey||ce();return e||ye("Missing API key, you need to provide an API key to upload your bundle"),e}function jV(t,e,r){let n=ge(t,r),o=e.path||r?.webDir;return n||ye("Missing argument, you need to provide a appid or be in a capacitor project"),o||ye("Missing argument, you need to provide a path (--path), or be in a capacitor project"),(0,Go.existsSync)(o)||ye(`Path ${o} does not exist, build your app first, or provide a valid path`),{appid:n,path:o}}function UV(t,e){let r=t.codeCheck;(typeof r>"u"||r)&&(Ga(e,"notifyAppReady")||ye(`notifyAppReady() is missing in the build folder of your app. see: https://capgo.app/docs/plugin/api/#notifyappready
197
- If you are sure your app has this code, you can use the --no-code-check option`),yf(e)||ye(`index.html is missing in the root folder of ${e}`))}async function MV(t,e,r,n,o,i){let s=r.ignoreMetadataCheck,a=r.autoMinUpdateVersion,u=r.minUpdateVersion,{data:c,error:l}=await t.from("channels").select("disable_auto_update, version ( min_update_version, native_packages )").eq("name",n).eq("app_id",o).single(),f=!!c&&c.disable_auto_update==="version_number",h,d;if(!l&&c&&c.version&&c.version.native_packages&&!s){let D=Se();D.start(`Checking bundle compatibility with channel ${n}`);let{finalCompatibility:E,localDependencies:_}=await of(t,o,n,r.packageJson,r.nodeModules);if(d=E,h=_,d.find(g=>!Lo(g)))D.stop(`Bundle NOT compatible with ${n} channel`),p.warn(`You can check compatibility with "${e.runner} @capgo/cli bundle compatibility"`),a&&(u=i,p.info(`Auto set min-update-version to ${u}`));else if(a)try{let{min_update_version:g}=c.version;(!g||!is.test(g))&&ye("Invalid remote min update version, skipping auto setting compatibility"),u=g,D.stop(`Auto set min-update-version to ${u}`)}catch{ye(`Cannot auto set compatibility, invalid data ${c}`)}else D.stop(`Bundle compatible with ${n} channel`)}else s||(p.warn(`Channel ${n} is new or it's your first upload with compatibility check, it will be ignored this time`),h=await oD(r.packageJson,r.nodeModules),a&&(u=i,p.info(`Auto set min-update-version to ${u}`)));f&&!u&&!s&&ye("You need to provide a min-update-version to upload a bundle to this channel"),u&&(is.test(u)||ye(`Your minimal version update ${u}, is not valid it should follow semver convention : https://semver.org/`));let m=h?new Map(h.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,E])=>({name:D,version:E.version})):void 0,minUpdateVersion:u}}async function qV(t,e,r){let{data:n,error:o}=await t.rpc("is_trial_org",{orgid:e}).single();(n&&n>0||o)&&(p.warn(`WARNING !!
198
- Trial expires in ${n} days`),p.warn(`Upgrade here: ${r.hostWeb}/dashboard/settings/plans?oid=${e}`))}async function HV(t,e,r,n=!1){let{data:o,error:i}=await t.rpc("exist_app_versions",{appid:e,apikey:"",name_version:r}).single();if(o||i){if(n)return p.warn(`Version ${r} already exists - exiting gracefully due to --silent-fail option`),Z("Bundle version already exists - exiting gracefully \u{1F389}"),!0;ye(`Version ${r} already exists ${j(i)}`)}return!1}async function VV(t,e,r,n,o,i,s){let a,u,c="",l=null,f="none",h="",d=e.keyV2,m=e.key===!1;l=await rf(t);let b=Se();b.start("Calculating checksum");let D=(0,RD.join)(St((0,ID.cwd)()),xt),_=(await dt(void 0,e.packageJson||D)).get("@capgo/capacitor-updater"),g=!1,x;try{x=_?Ae(_):void 0}catch{x=void 0}if(_?x?g=_n(x,Ae("6.25.0")):_==="link:@capgo/capacitor-updater"&&(p.warn("Using local @capgo/capacitor-updater. Assuming v7"),g=!0):ye("Cannot find @capgo/capacitor-updater in ./package.json, provide the package.json path with --package-json it's required for v7 CLI to work"),(d||e.keyDataV2||(0,Go.existsSync)(tr))&&!m||g?c=await un(l,"sha256"):c=await un(l,"crc32"),b.stop(`Checksum ${g?"SHA256":"CRC32"}: ${c}`),m)p.info("Encryption ignored");else if((d||(0,Go.existsSync)(tr)||e.keyDataV2)&&!e.oldEncryption){let O=typeof d=="string"?d:tr,B=e.keyDataV2||"";!B&&!(0,Go.existsSync)(O)&&ye(`Cannot find private key ${O}`),await we(r,{channel:"app",event:"App encryption v2",icon:"\u{1F511}",user_id:n,tags:{"app-id":o},notify:!1},e.verbose),B||(B=(0,Go.readFileSync)(O).toString()),p.info("Encrypting your bundle with V2");let{sessionKey:I,ivSessionKey:L}=pf(B),F=ps(l,I,L);c=ds(c,B),a=L,u=I,f="v2",h=B,e.displayIvSession&&p.info(`Your Iv Session key is ${a},
195
+ `)}async function V2(t,e,r){let n=await Bl(t),o=gg(r,e);return[_s,Ao(e),o,n].join(`
196
+ `)}async function yg(t,e,r){let n=mg(t),o=await ko("AWS4"+r,n),i=await ko(o,e),a=await ko(i,"s3");return await ko(a,"aws4_request")}function bg(t,e,r){return`${t}/${gg(e,r)}`}async function ko(t,e){let r=new TextEncoder,n=await crypto.subtle.importKey("raw",t instanceof Uint8Array?t:r.encode(t),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),o=await crypto.subtle.sign("HMAC",n,e instanceof Uint8Array?e:r.encode(e));return new Uint8Array(o)}async function z2(t){if(!t.accessKey)throw new Rn;if(!t.secretKey)throw new ta;if(t.expirySeconds<1||t.expirySeconds>604800)throw new Cs;let e=new Date(t.date);e.setSeconds(e.getSeconds()+t.expirySeconds);let r=bg(t.accessKey,t.region,t.date),n=Ao(t.date),o={"X-Amz-Algorithm":_s,"X-Amz-Credential":r,"X-Amz-Date":n,key:t.objectKey,...t.fields},i=[{bucket:t.bucket},{key:t.objectKey},{"X-Amz-Algorithm":_s},{"X-Amz-Credential":r},{"X-Amz-Date":n}];t.conditions&&i.push(...t.conditions);for(let[h,m]of Object.entries(t.fields||{}))["key","X-Amz-Algorithm","X-Amz-Credential","X-Amz-Date"].includes(h)||i.push({[h]:m});let a={expiration:e.toISOString(),conditions:i},s=new TextEncoder().encode(JSON.stringify(a)),u=btoa(String.fromCharCode(...s));o.policy=u;let c=u,l=await yg(t.date,t.region,t.secretKey),f=Es(await ko(l,c)).toLowerCase();return o["X-Amz-Signature"]=f,{url:`${t.protocol}//${t.host}/${t.bucket}`,fields:o}}var uU=["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"],cU=5*1024*1024,lU=5*1024*1024*1024,vg=5*1024*1024*1024*1024,xs=class{host;port;protocol;accessKey;#e;sessionToken;defaultBucket;region;userAgent="s3-lite-client";pathStyle;pathPrefix;constructor({endPoint:e,useSSL:r,port:n,pathPrefix:o,...i}){if(/^https?:\/\//i.test(e)){if(r!==void 0||n!==void 0||o!==void 0)throw new Ct("useSSL/port/pathPrefix cannot be specified if endPoint is a URL.");try{let s=new URL(e);e=s.hostname,r=s.protocol==="https:",n=s.port?parseInt(s.port,10):r?443:80,s.pathname&&s.pathname!=="/"&&(o=s.pathname.endsWith("/")?s.pathname.slice(0,-1):s.pathname)}catch{throw new ws(`Invalid endPoint URL: ${e}`)}}if(typeof e!="string"||e.length===0)throw new ws(`Invalid endPoint: ${e}`);if(r===void 0&&(r=!0),n!==void 0&&!N2(n))throw new Ct(`Invalid port: ${n}`);if(i.accessKey&&!i.secretKey)throw new Ct("If specifying access key, secret key must also be provided.");if(i.accessKey&&i.accessKey.startsWith("ASIA")&&!i.sessionToken)throw new Ct("If specifying temporary access key, session token must also be provided.");let a=r?443:80;if(this.port=n??a,this.host=e.toLowerCase()+(this.port!==a?`:${this.port}`:""),this.protocol=r?"https:":"http:",this.accessKey=i.accessKey,this.#e=i.secretKey??"",this.sessionToken=i.sessionToken,this.pathStyle=i.pathStyle??!0,this.pathPrefix=o??"",this.defaultBucket=i.bucket,this.region=i.region,this.pathPrefix){if(!this.pathStyle)throw new Ct("pathPrefix is incompatible with pathStyle=false");if(!this.pathPrefix.startsWith("/"))throw new Ct("pathPrefix should start with /");if(this.pathPrefix.endsWith("/"))throw new Ct("pathPrefix should not end with /")}}getBucketName(e){let r=e?.bucketName??this.defaultBucket;if(r===void 0||!L2(r))throw new Rl(r??"");return r}buildRequestOptions(e){let r=this.getBucketName(e),n=this.pathStyle?this.host:`${r}.${this.host}`,o=e.headers??new Headers;o.set("host",n);let i=typeof e.query=="object"?new URLSearchParams(e.query).toString().replace("+","%20"):e.query,a=this.pathStyle?`${this.pathPrefix}/${r}/${e.objectName}`:`/${e.objectName}`,s=i?`?${i}`:"",u=a+s,c=a.split("/").map(l=>encodeURIComponent(l)).join("/")+s;return{headers:o,host:n,path:u,encodedPath:c}}async makeRequest({method:e,payload:r,...n}){let o=new Date,{headers:i,host:a,path:s,encodedPath:u}=this.buildRequestOptions(n),c=n.statusCode??200;if(e==="POST"||e==="PUT"||e==="DELETE")r===void 0?r=new Uint8Array:typeof r=="string"&&(r=new TextEncoder().encode(r)),i.set("Content-Length",String(r.length));else if(r)throw new Error(`Unexpected payload on ${e} request.`);let l=await Bl(r??new Uint8Array);i.set("x-amz-date",Ao(o)),i.set("x-amz-content-sha256",l),this.accessKey&&(this.sessionToken&&i.set("x-amz-security-token",this.sessionToken),i.set("authorization",await U2({headers:i,method:e,path:s,accessKey:this.accessKey,secretKey:this.#e,region:this.region,date:o})));let f=`${this.protocol}//${a}${u}`,d=await fetch(f,{method:e,headers:i,body:r});if(d.status!==c)throw d.status>=400?await j2(d):d.status===301?new an(d.status,"UnexpectedRedirect",'The server unexpectedly returned a redirect response. With AWS S3, this usually means you need to use a region-specific endpoint like "s3.us-west-2.amazonaws.com" instead of "s3.amazonaws.com"'):new an(d.status,"UnexpectedStatusCode",`Unexpected response code from the server (expected ${c}, got ${d.status} ${d.statusText}).`);return n.returnBody||await d.body?.getReader().read(),d}async deleteObject(e,r={}){let n=this.getBucketName(r);if(!Bn(e))throw new jr(e);let o=r.versionId?{versionId:r.versionId}:{},i=new Headers;r.governanceBypass&&i.set("X-Amz-Bypass-Governance-Retention","true"),await this.makeRequest({method:"DELETE",bucketName:n,objectName:e,headers:i,query:o,statusCode:204})}async exists(e,r){try{return await this.statObject(e,r),!0}catch(n){if(n instanceof an&&n.statusCode===404)return!1;throw n}}getObject(e,r){return this.getPartialObject(e,{...r,offset:0,length:0})}async getPartialObject(e,{offset:r,length:n,...o}){let i=this.getBucketName(o);if(!Bn(e))throw new jr(e);let a=new Headers(Object.entries(o.metadata??{})),s=200;if(r||n){let c="";r?c=`bytes=${+r}-`:(c="bytes=0-",r=0),n&&(c+=`${+n+r-1}`),a.set("Range",c),s=206}let u={...o.responseParams,...o.versionId?{versionId:o.versionId}:{}};return await this.makeRequest({method:"GET",bucketName:i,objectName:e,headers:a,query:u,statusCode:s,returnBody:!0})}getPresignedUrl(e,r,n={}){if(!this.accessKey)throw new Rn;if(!Bn(r))throw new jr(r);let{headers:o,path:i}=this.buildRequestOptions({objectName:r,bucketName:n.bucketName,query:n.parameters}),a=n.requestDate??new Date,s=n.expirySeconds??1440*60*7;return M2({protocol:this.protocol,headers:o,method:e,path:i,accessKey:this.accessKey,secretKey:this.#e,sessionToken:this.sessionToken,region:this.region,date:a,expirySeconds:s})}presignedGetObject(e,r={}){let{versionId:n,responseParams:o,...i}=r,a={...o,...n?{versionId:n}:{}};return this.getPresignedUrl("GET",e,{parameters:a,...i})}async*listObjects(e={}){for await(let r of this.listObjectsGrouped({...e,delimiter:""}))if(r.type==="Object")yield r;else throw new Error(`Unexpected result from listObjectsGrouped(): ${r}`)}async*listObjectsGrouped(e){let r=this.getBucketName(e),n="",o=e.pageSize??1e3;if(o<1||o>1e3)throw new Ct("pageSize must be between 1 and 1,000.");let i=0;for(;;){let a=e.maxResults?Math.min(o,e.maxResults-i):o;if(a===0)return;let u=await(await this.makeRequest({method:"GET",bucketName:r,objectName:"",query:{"list-type":"2",prefix:e.prefix??"",delimiter:e.delimiter,"max-keys":String(a),...n?{"continuation-token":n}:{}},returnBody:!0})).text(),c=In(u).root;if(!c||c.name!=="ListBucketResult")throw new Error(`Unexpected response: ${u}`);let l=c.children.filter(h=>h.name==="CommonPrefixes").flatMap(h=>h.children),f=[];for(let h of l)f.push({type:"CommonPrefix",prefix:h.content??""}),i++;for(let h of c.children.filter(m=>m.name==="Contents"))f.push({type:"Object",key:h.children.find(m=>m.name==="Key")?.content??"",etag:Fo(h.children.find(m=>m.name==="ETag")?.content??""),size:parseInt(h.children.find(m=>m.name==="Size")?.content??"",10),lastModified:new Date(h.children.find(m=>m.name==="LastModified")?.content??"invalid")}),i++;f.sort((h,m)=>{let b=h.type==="Object"?h.key:h.prefix,D=m.type==="Object"?m.key:m.prefix;return b>D?1:b<D?-1:0});for(let h of f)yield h;if(c.children.find(h=>h.name==="IsTruncated")?.content==="true"){let h=c.children.find(m=>m.name==="NextContinuationToken")?.content;if(!h)throw new Error("Unexpectedly missing continuation token, but server said there are more results.");n=h}else return}}async putObject(e,r,n){let o=this.getBucketName(n);if(!Bn(e))throw new jr(e);let i,a;if(typeof r=="string"){let l=new TextEncoder().encode(r);typeof ReadableStream.from<"u"?a=ReadableStream.from([l]):a=new ReadableStream({start(f){f.enqueue(l),f.close()}}),i=l.length}else if(r instanceof Uint8Array)typeof ReadableStream.from<"u"?a=ReadableStream.from([r]):a=new ReadableStream({start(l){l.enqueue(r),l.close()}}),i=r.byteLength;else if(r instanceof ReadableStream)a=r;else throw new Ct("Invalid stream/data type provided.");if(n?.size!==void 0){if(i!==void 0&&n?.size!==i)throw new Ct(`size was specified (${n.size}) but doesn't match auto-detected size (${i}).`);if(typeof n.size!="number"||n.size<0||isNaN(n.size))throw new Ct(`invalid size specified: ${n.size}`);i=n.size}let s=n?.partSize??this.calculatePartSize(i);if(s<cU)throw new Ct("Part size should be greater than 5MB");if(s>lU)throw new Ct("Part size should be less than 6MB");let u=new Il(s),c=new jl({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=vg),e>vg)throw new TypeError(`size should not be more than ${vg}`);let r=64*1024*1024;for(;;){if(r*1e4>e)return r;r+=16*1024*1024}}async statObject(e,r){let n=this.getBucketName(r);if(!Bn(e))throw new jr(e);let o={};r?.versionId&&(o.versionId=r.versionId);let i=await this.makeRequest({method:"HEAD",bucketName:n,objectName:e,query:o,headers:new Headers(r?.headers)}),a={};for(let s of uU)i.headers.has(s)&&(a[s]=i.headers.get(s));return i.headers.forEach((s,u)=>{u.startsWith("x-amz-meta-")&&(a[u]=i.headers.get(u))}),{type:"Object",key:e,size:parseInt(i.headers.get("content-length")??"",10),metadata:a,lastModified:new Date(i.headers.get("Last-Modified")??"error: missing last modified"),versionId:i.headers.get("x-amz-version-id")||null,etag:Fo(i.headers.get("ETag")??"")}}async copyObject(e,r,n){let o=this.getBucketName(n),i=e.sourceBucketName??o;if(!Bn(r))throw new jr(r);let a=`${i}/${e.sourceKey}`;e.sourceVersionId&&(a+=`?versionId=${e.sourceVersionId}`);let s=new Headers(n?.metadata);n?.metadata!==void 0&&s.set("x-amz-metadata-directive","REPLACE"),s.set("x-amz-copy-source",a);let u=await this.makeRequest({method:"PUT",bucketName:o,objectName:r,headers:s,returnBody:!0}),c=await u.text(),l=In(c).root;if(!l||l.name!=="CopyObjectResult")throw new Error(`Unexpected response: ${c}`);let f=l.children.find(h=>h.name==="ETag")?.content??"",d=l.children.find(h=>h.name==="LastModified")?.content;if(d===void 0)throw new Error("Unable to find <LastModified>...</LastModified> from the server.");return{copySourceVersionId:u.headers.get("x-amz-copy-source-version-id")||null,etag:Fo(f),lastModified:new Date(d),versionId:u.headers.get("x-amz-version-id")||null}}async bucketExists(e){try{return await this.listObjects({bucketName:e}).next(),!0}catch(r){if(r instanceof an&&r.statusCode===404)return!1;throw r}}async makeBucket(e){await this.makeRequest({method:"PUT",bucketName:this.getBucketName({bucketName:e}),objectName:"",statusCode:200})}async removeBucket(e){await this.makeRequest({method:"DELETE",bucketName:this.getBucketName({bucketName:e}),objectName:"",statusCode:204})}presignedPostObject(e,r={}){if(!Bn(e))throw new jr(e);let n=this.getBucketName(r);if(!n)throw new Error("Bucket name is required for presignedPost, but none was provided either to this method nor to the client constructor");let o=r.requestDate||new Date,i=r.expirySeconds??3600;return z2({protocol:this.protocol,host:this.host,bucket:n,objectKey:e,accessKey:this.accessKey||"",secretKey:this.#e||"",region:this.region,date:o,expirySeconds:i,conditions:r.conditions,fields:r.fields})}};var $o=require("node:fs"),Nl=require("node:path");function fU(t,e){return(0,$o.readFileSync)(t,"utf8").includes(e)}function Ss(t,e){let r=(0,$o.readdirSync)(t);for(let n of r){let o=(0,Nl.join)(t,n),i=(0,$o.statSync)(o);if(i.isDirectory()){if(Ss(o,e))return!0}else if(i.isFile()&&(0,Nl.extname)(o)===".js"&&fU(o,e))return!0}return!1}function Ll(t){return(0,$o.readdirSync)(t).indexOf("index.html")>-1}var oa=require("node:fs"),eF=require("node:os"),jn=require("node:path"),tF=require("node:process"),Wl=require("node:stream/consumers"),rF=require("node:zlib");var nF=ge(QS()),oF=ge(Nh());async function SM(t,e){try{return(await fetch(`${t.hostFilesApi}/files/read/attachments/${encodeURIComponent(e)}`,{method:"HEAD"})).ok}catch{return!1}}var iF=8192,aF="6.25.0",sF="7.0.35";async function FM(t){let e=(0,jn.join)(vt((0,tF.cwd)()),bt),n=(await ct(void 0,t.packageJson||e)).get("@capgo/capacitor-updater"),o;try{o=n?_e(n):void 0}catch{o=void 0}if(!n||!o)return{version:null,supportsBrotliV2:!1};let i=o.major===6&&dn(o,_e(aF)),a=o.major>=7&&dn(o,_e(sF)),s=i||a;return{version:`${o.major}.${o.minor}.${o.patch}`,supportsBrotliV2:s}}function AM(t,e){if(!e)return!1;let r=e.split(",").map(n=>n.trim()).filter(n=>!!n);return r.length===0?!1:nF.isMatch(t,r)}async function OM(t,e,r){let o=(0,oa.statSync)(t).size,i=await(0,Wl.buffer)((0,oa.createReadStream)(t));if(o===0)return{buffer:i,useBrotli:!1};if(AM(e,r.noBrotliPatterns))return p.info(`Skipping brotli for excluded file: ${e}`),{buffer:i,useBrotli:!1};if(o<iF)return{buffer:i,useBrotli:!1};try{let a=await(0,Wl.buffer)((0,oa.createReadStream)(t).pipe((0,rF.createBrotliCompress)({})));return a.length>=o-10?(p.info(`Brotli not effective for ${e} (${o} bytes), using original file`),{buffer:i,useBrotli:!1}):{buffer:a,useBrotli:!0}}catch(a){return p.warn(`Brotli compression failed for ${t}: ${a}, using original file`),{buffer:i,useBrotli:!1}}}async function uF(t,e,r,n,o,i){let a=Ee();a.start(o!=="v2"?"Generating the update manifest":"Generating the update manifest with v2 encryption");let s=await e2(t);if(o==="v2")for(let u of s)u.hash=ea(u.hash,i);return a.stop("Manifest generated successfully"),await De(e,{channel:"partial-update",event:"Generate manifest",icon:"\u{1F4C2}",user_id:r,tags:{"app-id":n},notify:!1}),s}function kM(t){return(0,eF.platform)()!=="win32"?t:jn.win32.normalize(t).split(jn.win32.sep).join(jn.posix.sep)}function $M(t){let e=t.split("/").map(r=>encodeURIComponent(r)).join("/");return t.includes(" ")&&p.warn(`File "${t}" contains spaces in its name.`),e}async function cF(t,e,r,n,o,i,a,s){let u=Ee();u.start("Preparing partial update with TUS protocol");let c=performance.now(),l=await sr(),{version:f,supportsBrotliV2:d}=await FM(s);if(d)s.disableBrotli?p.info("Brotli compression disabled by user request"):(u.message(`Using .br extension for compatible files (updater ${f})`),s.noBrotliPatterns&&p.info(`Files matching patterns (${s.noBrotliPatterns}) will be excluded from brotli compression`),p.info(`Files smaller than ${iF} bytes will be excluded from brotli compression (Brotli RFC minimum)`));else throw new Error(`Your project is using an older version of @capgo/capacitor-updater (${f||"unknown"}). To use Delta updates, please upgrade to version ${aF} (v6) or ${sF} (v7) or higher.`);let h=e.filter(C=>C.file.includes(" "));if(h.length>0)throw new Error(`Files with spaces in their names (${h.map(C=>C.file).join(", ")}). Please rename the files.`);let m=0,b=e.length,D=0;try{let C=e.map(async S=>{let T=(0,jn.join)(r,S.file),O=kM(S.file),B,R=!1;if(s.disableBrotli)B=await(0,Wl.buffer)((0,oa.createReadStream)(T)),R=!1;else{let Q=await OM(T,O,s);B=Q.buffer,R=Q.useBrotli}let N=B;a&&(N=Qi(B,a.sessionKey,a.ivSessionKey));let A=O;R&&(A=`${O}.br`,D++);let U=$M(A),M=`orgs/${i}/apps/${n}/delta/${S.hash}_${U}`;return await SM(l,M)?(m++,Promise.resolve({file_name:U,s3_path:M,file_hash:S.hash})):new Promise((Q,$)=>{new oF.Upload(N,{endpoint:`${l.hostFilesApi}/files/upload/attachments/`,chunkSize:s.tusChunkSize,metadata:{filename:M},headers:{Authorization:t},onError(v){p.info(`Failed to upload ${O}: ${v}`),$(v)},onProgress(){let v=(m/b*100).toFixed(2);u.message(`Uploading partial update: ${v}%`)},onSuccess(){m++,Q({file_name:U,s3_path:M,file_hash:S.hash})}}).start()})}),E=await Promise.all(C),_=((performance.now()-c)/1e3).toFixed(2);return u.stop(`Partial update uploaded successfully \u{1F4AA} in (${_} seconds)`),D>0&&p.info(`${D} of ${b} files were compressed with brotli and use .br extension`),await De(t,{channel:"app",event:`App Partial TUS done${D>0?" with .br extension":""}`,icon:"\u23EB",user_id:i,tags:{"app-id":n},notify:!1}),await De(t,{channel:"performance",event:"Partial upload performance",icon:"\u{1F684}",user_id:i,tags:{"app-id":n,time:_},notify:!1}),E}catch(C){let g=((performance.now()-c)/1e3).toFixed(2);return u.stop(`Failed to upload Partial bundle (after ${g} seconds)`),p.info(`Error uploading partial update: ${C}, This is not a critical error, the bundle has been uploaded without the partial files`),null}}function me(t){throw p.error(t),new Error(t)}async function PM(t,e){let r=_r("",e.packageJson),n=e.bundle||t?.plugins?.CapacitorUpdater?.version||r||`0.0.1-beta.${(0,lF.randomUUID)().split("-")[0]}`;return Gi.test(n)||me(`Your bundle name ${n}, is not valid it should follow semver convention : https://semver.org/`),n}function TM(t){let e=t.apikey||ae();return e||me("Missing API key, you need to provide an API key to upload your bundle"),e}function IM(t,e,r){let n=de(t,r),o=e.path||r?.webDir;return n||me("Missing argument, you need to provide a appid or be in a capacitor project"),o||me("Missing argument, you need to provide a path (--path), or be in a capacitor project"),(0,Io.existsSync)(o)||me(`Path ${o} does not exist, build your app first, or provide a valid path`),{appid:n,path:o}}function RM(t,e){let r=t.codeCheck;(typeof r>"u"||r)&&(Ss(e,"notifyAppReady")||me(`notifyAppReady() is missing in the build folder of your app. see: https://capgo.app/docs/plugin/api/#notifyappready
197
+ If you are sure your app has this code, you can use the --no-code-check option`),Ll(e)||me(`index.html is missing in the root folder of ${e}`))}async function BM(t,e,r,n,o,i){let a=r.ignoreMetadataCheck,s=r.autoMinUpdateVersion,u=r.minUpdateVersion,{data:c,error:l}=await t.from("channels").select("disable_auto_update, version ( min_update_version, native_packages )").eq("name",n).eq("app_id",o).single(),f=!!c&&c.disable_auto_update==="version_number",d,h;if(!l&&c&&c.version&&c.version.native_packages&&!a){let D=Ee();D.start(`Checking bundle compatibility with channel ${n}`);let{finalCompatibility:C,localDependencies:E}=await Sl(t,o,n,r.packageJson,r.nodeModules);if(h=C,d=E,h.find(g=>!So(g)))D.stop(`Bundle NOT compatible with ${n} channel`),p.warn(`You can check compatibility with "${e.runner} @capgo/cli bundle compatibility"`),s&&(u=i,p.info(`Auto set min-update-version to ${u}`));else if(s)try{let{min_update_version:g}=c.version;(!g||!Gi.test(g))&&me("Invalid remote min update version, skipping auto setting compatibility"),u=g,D.stop(`Auto set min-update-version to ${u}`)}catch{me(`Cannot auto set compatibility, invalid data ${c}`)}else D.stop(`Bundle compatible with ${n} channel`)}else a||(p.warn(`Channel ${n} is new or it's your first upload with compatibility check, it will be ignored this time`),d=await sg(r.packageJson,r.nodeModules),s&&(u=i,p.info(`Auto set min-update-version to ${u}`)));f&&!u&&!a&&me("You need to provide a min-update-version to upload a bundle to this channel"),u&&(Gi.test(u)||me(`Your minimal version update ${u}, is not valid it should follow semver convention : https://semver.org/`));let m=d?new Map(d.filter(D=>!!D.native&&D.native!==void 0).map(D=>[D.name,D])):new Map;return{nativePackages:m.size>0||!r.ignoreMetadataCheck?Array.from(m,([D,C])=>({name:D,version:C.version})):void 0,minUpdateVersion:u}}async function jM(t,e,r){let{data:n,error:o}=await t.rpc("is_trial_org",{orgid:e}).single();(n&&n>0||o)&&(p.warn(`WARNING !!
198
+ Trial expires in ${n} days`),p.warn(`Upgrade here: ${r.hostWeb}/dashboard/settings/plans?oid=${e}`))}async function NM(t,e,r,n=!1){let{data:o,error:i}=await t.rpc("exist_app_versions",{appid:e,apikey:"",name_version:r}).single();if(o||i){if(n)return p.warn(`Version ${r} already exists - exiting gracefully due to --silent-fail option`),J("Bundle version already exists - exiting gracefully \u{1F389}"),!0;me(`Version ${r} already exists ${L(i)}`)}return!1}async function LM(t,e,r,n,o,i,a){let s,u,c="",l=null,f="none",d="",h=e.keyV2,m=e.key===!1;l=await _l(t);let b=Ee();b.start("Calculating checksum");let D=(0,jg.join)(vt((0,Ng.cwd)()),bt),E=(await ct(void 0,e.packageJson||D)).get("@capgo/capacitor-updater"),g=!1,_;try{_=E?_e(E):void 0}catch{_=void 0}if(E?_?g=dn(_,_e("6.25.0")):E==="link:@capgo/capacitor-updater"&&(p.warn("Using local @capgo/capacitor-updater. Assuming v7"),g=!0):me("Cannot find @capgo/capacitor-updater in ./package.json, provide the package.json path with --package-json it's required for v7 CLI to work"),(h||e.keyDataV2||(0,Io.existsSync)(Wt))&&!m||g?c=await Xr(l,"sha256"):c=await Xr(l,"crc32"),b.stop(`Checksum ${g?"SHA256":"CRC32"}: ${c}`),m)p.info("Encryption ignored");else if((h||(0,Io.existsSync)(Wt)||e.keyDataV2)&&!e.oldEncryption){let O=typeof h=="string"?h:Wt,B=e.keyDataV2||"";!B&&!(0,Io.existsSync)(O)&&me(`Cannot find private key ${O}`),await De(r,{channel:"app",event:"App encryption v2",icon:"\u{1F511}",user_id:n,tags:{"app-id":o},notify:!1},e.verbose),B||(B=(0,Io.readFileSync)(O).toString()),p.info("Encrypting your bundle with V2");let{sessionKey:R,ivSessionKey:N}=Tl(B),A=Qi(l,R,N);c=ea(c,B),s=N,u=R,f="v2",d=B,e.displayIvSession&&p.info(`Your Iv Session key is ${s},
199
199
  keep it safe, you will need it to decrypt your bundle.
200
200
  It will be also visible in your dashboard
201
- `),l=F}let S=Math.floor((l?.byteLength??0)/1024/1024),T=Math.floor(i/1024/1024);return l?.byteLength>i?ye(`The bundle size is ${S} Mb, this is greater than the maximum upload length ${T} Mb, please reduce the size of your bundle`):l?.byteLength>s?(p.warn(`WARNING !!
201
+ `),l=A}let S=Math.floor((l?.byteLength??0)/1024/1024),T=Math.floor(i/1024/1024);return l?.byteLength>i?me(`The bundle size is ${S} Mb, this is greater than the maximum upload length ${T} Mb, please reduce the size of your bundle`):l?.byteLength>a?(p.warn(`WARNING !!
202
202
  The bundle size is ${S} Mb, this may take a while to download for users
203
203
  `),p.info(`Learn how to optimize your assets https://capgo.app/blog/optimise-your-images-for-updates/
204
- `),e.verbose&&(p.info("[Verbose] Bundle size details:"),p.info(` - Actual size: ${S} MB (${l?.byteLength} bytes)`),p.info(` - Alert threshold: ${Math.floor(s/1024/1024)} MB`),p.info(` - Maximum allowed: ${T} MB`),p.info("[Verbose] Sending 'App Too Large' event to analytics...")),await we(r,{channel:"app-error",event:"App Too Large",icon:"\u{1F69B}",user_id:n,tags:{"app-id":o},notify:!1},e.verbose),e.verbose&&p.info("[Verbose] Event sent successfully")):e.verbose&&p.info(`[Verbose] Bundle size OK: ${S} MB (under ${Math.floor(s/1024/1024)} MB alert threshold)`),e.verbose&&p.info("[Verbose] Bundle preparation complete, returning bundle data"),{zipped:l,ivSessionKey:a,sessionKey:u,checksum:c,encryptionMethod:f,finalKeyData:h}}async function zV(t,e,r,n,o,i,s,a){let u=Se();u.start("Uploading Bundle");let c=performance.now(),l=!1;if(s.verbose&&(p.info("[Verbose] uploadBundleToCapgoCloud called:"),p.info(` - Bundle size: ${Math.floor(i.byteLength/1024)} KB`),p.info(` - App ID: ${r}`),p.info(` - Bundle version: ${n}`),p.info(` - Chunk size: ${Math.floor(a/1024/1024)} MB`)),s.dryUpload){u.stop(`Dry run, bundle not uploaded
205
- Bundle uploaded \u{1F4AA} in 0 seconds`),s.verbose&&p.info("[Verbose] Dry upload mode - skipping actual upload");return}try{let d=await Dr();if(s.verbose&&p.info("[Verbose] Local config retrieved for upload"),s.multipart!==void 0&&s.multipart||s.tus!==void 0&&s.tus){s.multipart?p.info("Uploading bundle with multipart is deprecated, we upload with TUS instead"):p.info("Uploading bundle with TUS protocol"),s.verbose&&(p.info("[Verbose] Starting TUS resumable upload..."),p.info(` - Host: ${d.hostWeb}`),p.info(` - Chunk size: ${Math.floor(a/1024/1024)} MB`)),await jF(t,i,o,r,n,u,d,a),l=!0,s.verbose&&p.info("[Verbose] TUS upload completed, updating database with R2 path...");let m=`orgs/${o}/apps/${r}/${n}.zip`,{error:b}=await e.from("app_versions").update({r2_path:m}).eq("name",n).eq("app_id",r);if(b)return p.error(`Cannot finish TUS upload ${j(b)}`),s.verbose&&p.info(`[Verbose] Database update failed: ${j(b)}`),Promise.reject(new Error("Cannot finish TUS upload"));s.verbose&&p.info(`[Verbose] Database updated with R2 path: ${m}`)}else{s.verbose&&p.info("[Verbose] Using standard upload (non-TUS), getting presigned URL...");let m=await BF(e,r,n);if(!m)return p.error("Cannot get upload url"),s.verbose&&p.info("[Verbose] Failed to retrieve presigned upload URL from database"),Promise.reject(new Error("Cannot get upload url"));s.verbose&&(p.info("[Verbose] Presigned URL obtained, uploading via HTTP PUT..."),p.info(` - Timeout: ${s.timeout||Zg}ms`),p.info(" - Retry attempts: 5"),p.info(" - Content-Type: application/zip"));let b=new AbortController,D=setTimeout(()=>b.abort(),s.timeout||Zg);try{let E=await fetch(m,{method:"PUT",body:i,headers:{"Content-Type":"application/zip"},signal:b.signal});if(!E.ok)throw new Error(`HTTP error! status: ${E.status}`)}finally{clearTimeout(D)}s.verbose&&p.info("[Verbose] HTTP PUT upload completed successfully")}}catch(d){let b=((performance.now()-c)/1e3).toFixed(2);if(u.stop(`Failed to upload bundle ( after ${b} seconds)`),s.verbose&&(p.info(`[Verbose] Upload failed after ${b} seconds`),p.info(`[Verbose] Error type: ${d instanceof Error?"Error":typeof d}`)),d instanceof Error&&d.message.includes("HTTP error"))try{let D=d.message.match(/status: (\d+)/),E=D?D[1]:"unknown";p.error(`Upload failed with status ${E}: ${d.message}`)}catch{p.error(`Upload failed: ${d.message}`)}else s.verbose&&p.info(`[Verbose] Non-HTTP error: ${j(d)}`),s.tus?p.error(`Cannot upload bundle please contact support if the issue persists ${j(d)}`):p.error(`Cannot upload bundle ( try again with --tus option) ${j(d)}`);throw s.verbose&&p.info("[Verbose] Cleaning up failed version from database..."),await UF(e,r,n),s.verbose&&p.info("[Verbose] Failed version cleaned up"),d instanceof Error?d:new Error(String(d))}let h=((performance.now()-c)/1e3).toFixed(2);u.stop(`Bundle uploaded \u{1F4AA} in (${h} seconds)`),s.verbose&&(p.info("[Verbose] Upload successful:"),p.info(` - Upload time: ${h} seconds`),p.info(` - Upload method: ${l?"TUS (resumable)":"Standard HTTP PUT"}`),p.info(` - Bundle size: ${Math.floor(i.byteLength/1024)} KB`),p.info("[Verbose] Sending performance event...")),await we(t,{channel:"performance",event:l?"TUS upload zip performance":"Upload zip performance",icon:"\u{1F684}",user_id:o,tags:{"app-id":r,time:h},notify:!1},s.verbose),s.verbose&&p.info("[Verbose] Performance event sent successfully")}async function GV(t,e,r){let{data:n,error:o}=await t.from("channels").select("version ( id, name, deleted )").eq("app_id",e).eq("name",r);if(o){p.error(`Cannot delete linked bundle on upload ${j(o)}`);return}if(n.length===0){p.warn("No linked bundle found in the channel you are trying to upload to");return}let i=n[0].version;if(i.deleted){p.warn("The linked bundle is already deleted");return}let{error:s}=await t.from("app_versions").update({deleted:!0}).eq("id",i.id);if(s){p.error(`Cannot delete linked bundle on upload ${j(s)}`);return}p.info("Linked bundle deleted")}async function WV(t,e,r,n,o,i,s,a,u,c){let{data:l}=await t.rpc("get_app_versions",{apikey:e,name_version:n,appid:a}).single();l||ye("Cannot get version id, cannot set channel");let{data:f}=await t.rpc("is_allowed_capgkey",{apikey:e,keymode:["write","all"]}).single();if(f){let{error:h,data:d}=await nf(t,{name:o,app_id:a,created_by:i,version:l,owner_org:s,...c?{allow_device_self_set:!0}:{}});h&&ye(`Cannot set channel, the upload key is not allowed to do that, use the "all" for this. ${j(h)}`);let m=`${u.hostWeb}/app/p/${a}/channel/${d.id}`;d?.public?p.info("Your update is now available in your public channel \u{1F389}"):d?.id&&p.info(`Link device to this bundle to try it: ${m}`),r&&p.info(`Bundle url: ${m}`)}else p.warn("The upload key is not allowed to set the version in the channel")}async function KV(t,e,r){let{error:n,data:o}=await e.from("apps").select("default_upload_channel").eq("app_id",t).single();return n?(p.warn("Cannot find default upload channel"),p.info(`You can set it here: ${r}/app/p/${t}/settings`),null):o.default_upload_channel}async function BD(t,e,r=!0){r&&ee(`Uploading with CLI version ${_r.version}`);let n,o=ht();await De();let{s3Region:i,s3Apikey:s,s3Apisecret:a,s3BucketName:u,s3Endpoint:c,s3Port:l,s3SSL:f}=e;e.verbose&&(p.info("[Verbose] Starting upload process with options:"),p.info(` - API key: ${e.apikey?"provided":"from saved key"}`),p.info(` - Path: ${e.path||"from capacitor config"}`),p.info(` - Channel: ${e.channel||"from default upload channel"}`),p.info(` - Bundle: ${e.bundle||"auto-detected"}`),p.info(` - External: ${e.external||"false"}`),p.info(` - Encryption: ${e.keyV2||e.keyDataV2?"v2":e.key===!1?"disabled":"auto"}`),p.info(` - Upload method: ${e.tus?"TUS":e.zip?"ZIP":"auto"}`),p.info(` - Delta updates: ${e.delta||e.partial?"enabled":"disabled"}`));let h=LV(e);e.verbose&&p.info("[Verbose] API key retrieved successfully");let d=await ne();e.verbose&&p.info("[Verbose] Capacitor config loaded successfully");let m=await AF();e.verbose&&(p.info("[Verbose] Remote file config retrieved:"),p.info(` - Max upload length: ${Math.floor(m.maxUploadLength/1024/1024)} MB`),p.info(` - Alert upload size: ${Math.floor(m.alertUploadSize/1024/1024)} MB`),p.info(` - TUS upload: ${m.TUSUpload?"enabled":"disabled"}`),p.info(` - TUS upload forced: ${m.TUSUploadForced?"yes":"no"}`),p.info(` - Partial upload: ${m.partialUpload?"enabled":"disabled"}`),p.info(` - Max chunk size: ${Math.floor(m.maxChunkSize/1024/1024)} MB`));let{appid:b,path:D}=jV(t,e,d.config);e.verbose&&p.info(`[Verbose] App ID: ${b}, Build path: ${D}`);let E=await NV(d.config,e);e.verbose&&p.info(`[Verbose] Bundle version: ${E}`);let _=e.external?"external":"r2-direct",g="none";e.autoSetBundle&&(await ja({version:E}),e.verbose&&p.info("[Verbose] Auto-set bundle version in capacitor.config.json")),UV(e,D),e.verbose&&p.info("[Verbose] Code check passed (notifyAppReady found and index.html present)"),p.info(`Upload ${b}@${E} started from path "${D}" to Capgo cloud`);let x=await Dr();e.verbose&&p.info(`[Verbose] Local config loaded: host=${x.hostWeb}`),e.supaHost&&e.supaAnon&&(p.info("Using custom supabase instance from provided options"),x.supaHost=e.supaHost,x.supaKey=e.supaAnon,e.verbose&&p.info(`[Verbose] Custom Supabase host: ${e.supaHost}`));let S=await ie(h,e.supaHost,e.supaAnon);e.verbose&&p.info("[Verbose] Supabase client created successfully");let T=await ae(S,h,["write","all","upload"]);e.verbose&&p.info(`[Verbose] User verified successfully, user_id: ${T}`);let O=e.channel||await KV(b,S,x.hostWeb)||"dev";e.verbose&&p.info(`[Verbose] Target channel: ${O}`);let B=await yr(S,b);e.verbose&&p.info(`[Verbose] Organization ID: ${B}`),await $F(S,B,_r.version),e.verbose&&p.info("[Verbose] Remote CLI messages checked"),await TF(S,B,h,b,!0),e.verbose&&p.info("[Verbose] Plan validation passed"),await qV(S,B,x),e.verbose&&p.info("[Verbose] Trial check completed"),e.verbose&&p.info(`[Verbose] Checking compatibility with channel ${O}...`);let{nativePackages:I,minUpdateVersion:L}=await MV(S,o,e,O,b,E);e.verbose&&(p.info("[Verbose] Compatibility check completed:"),p.info(` - Native packages: ${I?I.length:0}`),p.info(` - Min update version: ${L||"none"}`)),e.verbose&&p.info(`[Verbose] Checking if version ${E} already exists...`);let F=await HV(S,b,E,e.versionExistsOk);if(e.verbose&&p.info(`[Verbose] Version exists check: ${F?"yes (skipping)":"no (continuing)"}`),F)return{success:!0,skipped:!0,reason:"VERSION_EXISTS",bundle:E,checksum:null,encryptionMethod:g,storageProvider:_};e.external&&!e.external.startsWith("https://")&&ye(`External link should should start with "https://" current is "${e.external}"`),e.deleteLinkedBundleOnUpload&&(p.warn("Deleting linked bundle on upload is destructive, it will delete the currently linked bundle in the channel you are trying to upload to."),p.warn("Please make sure you want to do this, if you are not sure, please do not use this option."));let U={name:E,app_id:b,session_key:void 0,external_url:e.external,storage_provider:_,min_update_version:L,native_packages:I,owner_org:B,user_id:T,checksum:void 0,link:e.link||null,comment:e.comment||null},M=null,te="";if(e.external)e.verbose&&p.info(`[Verbose] Using external URL: ${e.external}`),await we(h,{channel:"app",event:"App external",icon:"\u{1F4E4}",user_id:B,tags:{"app-id":b},notify:!1},e.verbose),U.session_key=e.ivSessionKey,U.checksum=e.encryptedChecksum,e.verbose&&(p.info("[Verbose] External bundle configured:"),p.info(` - URL: ${e.external}`),p.info(` - IV Session Key: ${e.ivSessionKey?"provided":"none"}`),p.info(` - Encrypted Checksum: ${e.encryptedChecksum?"provided":"none"}`));else{e.verbose&&p.info(`[Verbose] Preparing bundle file from path: ${D}`);let{zipped:A,ivSessionKey:R,checksum:k,sessionKey:q,encryptionMethod:P,finalKeyData:N}=await VV(D,e,h,B,b,m.maxUploadLength,m.alertUploadSize);U.session_key=R,U.checksum=k,n=q,M=A,g=P,te=N,e.verbose&&(p.info("[Verbose] Bundle prepared:"),p.info(` - Size: ${Math.floor((A?.byteLength??0)/1024)} KB`),p.info(` - Checksum: ${k}`),p.info(` - Encryption: ${P}`),p.info(` - IV Session Key: ${R?"present":"none"}`)),e.ignoreChecksumCheck||(e.verbose&&p.info("[Verbose] Checking for duplicate checksum..."),await HF(S,b,O,k),e.verbose&&p.info("[Verbose] Checksum is unique"))}if(e.zip?(e.tus=!1,e.verbose&&p.info("[Verbose] Upload method: ZIP (explicitly set via --zip)")):!m.TUSUpload||e.external?(e.tus=!1,e.verbose&&p.info("[Verbose] Upload method: Standard (TUS not available or external URL)")):(e.tus=e.tus||m.TUSUploadForced,e.verbose&&p.info(`[Verbose] Upload method: ${e.tus?"TUS (resumable)":"Standard"}`)),!m.partialUpload||e.external?(e.delta=!1,e.verbose&&e.external&&p.info("[Verbose] Delta updates disabled (not available with external URLs)")):(e.delta=e.delta||e.partial||e.deltaOnly||e.partialOnly||m.partialUploadForced,e.verbose&&p.info(`[Verbose] Delta updates: ${e.delta?"enabled":"disabled"}`)),e.encryptPartial&&g==="v1"&&ye("You cannot encrypt the partial update if you are not using the v2 encryption method"),e.delta&&g==="v2"&&!e.encryptPartial){let A=(0,RD.join)(St((0,ID.cwd)()),xt),k=(await dt(void 0,e.packageJson||A)).get("@capgo/capacitor-updater"),q;try{q=k?Ae(k):void 0}catch{q=void 0}k&&q&&_n(q,Ae("6.14.4"))&&(p.info(`Auto-enabling partial update encryption for updater version ${q} (> 6.14.4)`),e.verbose&&p.info("[Verbose] Partial encryption auto-enabled for updater >= 6.14.4"),e.encryptPartial=!0)}e.verbose&&e.delta&&p.info("[Verbose] Preparing delta/partial update manifest...");let $=e.delta?await GO(D,h,B,b,e.encryptPartial?g:"none",te):[];e.verbose&&e.delta&&p.info(`[Verbose] Delta manifest prepared with ${$.length} files`),e.verbose&&p.info("[Verbose] Creating version record in database...");let{error:y}=await nD(S,U);if(y&&ye(`Cannot add bundle ${j(y)}`),e.verbose&&p.info("[Verbose] Version record created successfully"),e.tusChunkSize&&e.tusChunkSize>m.maxChunkSize?(p.error(`Chunk size ${e.tusChunkSize} is greater than the maximum chunk size ${m.maxChunkSize}, using the maximum chunk size`),e.tusChunkSize=m.maxChunkSize):e.tusChunkSize||(e.tusChunkSize=m.maxChunkSize),e.verbose&&p.info(`[Verbose] TUS chunk size: ${Math.floor(e.tusChunkSize/1024/1024)} MB`),M&&(u||c||i||s||a||l||f)){(!u||!c||!i||!s||!a||!l)&&ye("Missing argument, for S3 upload you need to provide a bucket name, endpoint, region, port, API key, and API secret"),p.info("Uploading to S3"),e.verbose&&(p.info("[Verbose] S3 configuration:"),p.info(` - Endpoint: ${c}`),p.info(` - Region: ${i}`),p.info(` - Bucket: ${u}`),p.info(` - Port: ${l}`),p.info(` - SSL: ${f?"enabled":"disabled"}`));let A=f?`https://${c}`:`http://${c}`,R=new za({endPoint:c,region:i,port:l,pathStyle:!0,bucket:u,accessKey:s,secretKey:a}),k=`${b}-${E}`,q=encodeURIComponent(k);e.verbose&&p.info(`[Verbose] Uploading to S3 as: ${k}`),await R.putObject(k,Uint8Array.from(M)),U.external_url=`${A}/${q}`,U.storage_provider="external",e.verbose&&p.info(`[Verbose] S3 upload complete, external URL: ${U.external_url}`)}else if(M){!e.partialOnly&&!e.deltaOnly?(e.verbose&&p.info("[Verbose] Starting full bundle upload to Capgo Cloud..."),await zV(h,S,b,E,B,M,e,e.tusChunkSize)):e.verbose&&p.info("[Verbose] Skipping full bundle upload (delta-only mode)");let A=null;try{e.dryUpload&&(e.delta=!1,e.verbose&&p.info("[Verbose] Dry upload mode: skipping delta upload"));let k=U.session_key&&e.encryptPartial&&n?{sessionKey:n,ivSessionKey:U.session_key}:void 0;e.verbose&&e.delta&&(p.info("[Verbose] Starting delta/partial file upload..."),p.info(` - Manifest entries: ${$.length}`),p.info(` - Encryption: ${k?"enabled":"disabled"}`)),A=e.delta?await WO(h,$,D,b,E,B,k,e):null,e.verbose&&A&&p.info(`[Verbose] Delta upload complete with ${A.length} files`)}catch(k){p.info(`Failed to upload partial files to capgo cloud. Error: ${j(k)}. This is not a critical error, the bundle has been uploaded without the partial files`),e.verbose&&p.info(`[Verbose] Delta upload error details: ${j(k)}`)}U.storage_provider="r2",U.manifest=A,e.verbose&&p.info("[Verbose] Updating version record with storage provider and manifest...");let{error:R}=await nD(S,U);R&&ye(`Cannot update bundle ${j(R)}`),e.verbose&&p.info("[Verbose] Version record updated successfully")}e.verbose&&p.info("[Verbose] Checking app permissions...");let w=await qe(S,h,b,2);e.verbose&&(p.info("[Verbose] Permissions:"),p.info(` - Upload: ${ss(w,2)?"yes":"no"}`),p.info(` - Write: ${ss(w,3)?"yes":"no"}`),p.info(` - Admin: ${ss(w,4)?"yes":"no"}`)),e.deleteLinkedBundleOnUpload&&ss(w,3)?(e.verbose&&p.info(`[Verbose] Deleting linked bundle in channel ${O}...`),await GV(S,b,O)):e.deleteLinkedBundleOnUpload&&p.warn("Cannot delete linked bundle on upload as a upload organization member"),ss(w,3)?(e.verbose&&p.info(`[Verbose] Setting bundle ${E} to channel ${O}...`),await WV(S,h,!!e.bundleUrl,E,O,T,B,b,x,e.selfAssign),e.verbose&&p.info("[Verbose] Channel updated successfully")):p.warn("Cannot set channel as a upload organization member"),e.verbose&&p.info("[Verbose] Sending upload event..."),await we(h,{channel:"app",event:"App Uploaded",icon:"\u23EB",user_id:B,tags:{"app-id":b},notify:!1},e.verbose);let v={success:!0,bundle:E,checksum:U.checksum??null,encryptionMethod:g,sessionKey:n?n.toString("base64"):void 0,ivSessionKey:typeof U.session_key=="string"?U.session_key:void 0,storageProvider:U.storage_provider};return e.verbose&&(p.info("[Verbose] Upload completed successfully:"),p.info(` - Bundle: ${v.bundle}`),p.info(` - Checksum: ${v.checksum}`),p.info(` - Encryption: ${v.encryptionMethod}`),p.info(` - Storage: ${v.storageProvider}`)),r&&!v.skipped&&Z("Time to share your update to the world \u{1F30D}"),v}function XV(t){t.ivSessionKey&&!t.external&&ye("You need to provide an external url if you want to use the --iv-session-key option"),t.encryptedChecksum&&!t.external&&ye("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&&ye("You cannot use the --partial/--delta/--partial-only/--delta-only option with an external url"),t.tus&&t.external&&ye("You cannot use the --tus option with an external url"),t.dryUpload&&t.external&&ye("You cannot use the --dry-upload option with an external url"),t.multipart&&t.external&&ye("You cannot use the --multipart option with an external url"),t.external&&(t.keyV2||t.keyDataV2)&&ye("You cannot set a key if you are uploading to an external url"),t.keyV2&&t.keyDataV2&&ye("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)&&ye("You cannot set S3 options if you are uploading to an external url, it's automatically handled"),t.encryptedChecksum&&!t.external&&ye("You cannot set the --encrypted-checksum option if you are not uploading to an external url"),t.minUpdateVersion&&t.autoMinUpdateVersion&&ye("You cannot set both min-update-version and auto-min-update-version, use only one of them")}async function XO(t,e){try{XV(e),await BD(t,e,!0)}catch(r){throw p.error(`uploadBundle failded: ${j(r)}`),r instanceof Error?r:new Error(String(r))}}var YO=require("node:crypto"),Af=require("node:fs"),JO=require("node:path"),ZO=require("node:process");var YV=20;function JV(t){console.log(JSON.stringify(t,null,2))}function Ja(t){console.error(j(t))}async function ZV(t,e,r=!1){let{json:n}=e,{bundle:o,path:i}=e,s=!n&&!r;try{s&&await De();let a=await ne(),u=ge(t,a?.config),c=(0,YO.randomUUID)().split("-")[0],l=Rr("",e.packageJson);if(o=o||l||`0.0.1-beta.${c}`,s&&ee(`Zipping ${u}@${o}`),o&&!is.test(o)){let O=`Your bundle name ${o}, is not valid it should follow semver convention : https://semver.org/`;throw r||(n?Ja({error:"invalid_semver"}):p.error(O)),new Error("Invalid bundle version format")}if(i=i||a?.config?.webDir,!u||!o||!i){let O="Missing argument, you need to provide a appId and a bundle and a path, or be in a capacitor project";throw r||(n?Ja({error:"missing_argument"}):p.error(O)),new Error(O)}if(s&&p.info(`Started from path "${i}"`),typeof e.codeCheck>"u"?!0:e.codeCheck){if(!Ga(i,"notifyAppReady"))throw r||(n?Ja({error:"notifyAppReady_not_in_source_code"}):p.error("notifyAppReady() is missing in the build folder of your app. see: https://capgo.app/docs/plugin/api/#notifyappready")),new Error("notifyAppReady() is missing in build folder");if(!yf(i))throw r||(n?Ja({error:"index_html_not_found"}):p.error(`index.html is missing in the root folder of ${i}`)),new Error("index.html is missing in root folder")}let h=await rf(i);s&&p.info(`Zipped ${h.byteLength} bytes`);let d=s?Se():null;d&&d.start("Calculating checksum");let m=(0,JO.join)(St((0,ZO.cwd)()),xt),D=(await dt(void 0,e.packageJson||m)).get("@capgo/capacitor-updater");if(!D){let O="Cannot find @capgo/capacitor-updater in ./package.json, provide the package.json path with --package-json it's required for v7 CLI to work";throw r||p.warn(O),new Error(O)}let E=!1,_;try{_=D?Ae(D):void 0}catch{_=void 0}if(_){let O=_.major===6&&_n(_,Ae("6.25.0")),B=_.major>=7;E=O||B}else D==="link:@capgo/capacitor-updater"&&(r||p.warn("Using local @capgo/capacitor-updater. Assuming v7"),E=!0);let g=await un(h,e.keyV2||(0,Af.existsSync)(tr)||E?"sha256":"crc32");d&&d.stop(`Checksum ${E?"SHA256":"CRC32"}: ${g}`);let x=Math.floor(h.byteLength/1024/1024);x>YV&&s&&(p.warn(`WARNING !!
206
- The bundle size is ${x} Mb, this may take a while to download for users
204
+ `),e.verbose&&(p.info("[Verbose] Bundle size details:"),p.info(` - Actual size: ${S} MB (${l?.byteLength} bytes)`),p.info(` - Alert threshold: ${Math.floor(a/1024/1024)} MB`),p.info(` - Maximum allowed: ${T} MB`),p.info("[Verbose] Sending 'App Too Large' event to analytics...")),await De(r,{channel:"app-error",event:"App Too Large",icon:"\u{1F69B}",user_id:n,tags:{"app-id":o},notify:!1},e.verbose),e.verbose&&p.info("[Verbose] Event sent successfully")):e.verbose&&p.info(`[Verbose] Bundle size OK: ${S} MB (under ${Math.floor(a/1024/1024)} MB alert threshold)`),e.verbose&&p.info("[Verbose] Bundle preparation complete, returning bundle data"),{zipped:l,ivSessionKey:s,sessionKey:u,checksum:c,encryptionMethod:f,finalKeyData:d}}async function UM(t,e,r,n,o,i,a,s){let u=Ee();u.start("Uploading Bundle");let c=performance.now(),l=!1;if(a.verbose&&(p.info("[Verbose] uploadBundleToCapgoCloud called:"),p.info(` - Bundle size: ${Math.floor(i.byteLength/1024)} KB`),p.info(` - App ID: ${r}`),p.info(` - Bundle version: ${n}`),p.info(` - Chunk size: ${Math.floor(s/1024/1024)} MB`)),a.dryUpload){u.stop(`Dry run, bundle not uploaded
205
+ Bundle uploaded \u{1F4AA} in 0 seconds`),a.verbose&&p.info("[Verbose] Dry upload mode - skipping actual upload");return}try{let h=await sr();if(a.verbose&&p.info("[Verbose] Local config retrieved for upload"),a.multipart!==void 0&&a.multipart||a.tus!==void 0&&a.tus){a.multipart?p.info("Uploading bundle with multipart is deprecated, we upload with TUS instead"):p.info("Uploading bundle with TUS protocol"),a.verbose&&(p.info("[Verbose] Starting TUS resumable upload..."),p.info(` - Host: ${h.hostWeb}`),p.info(` - Chunk size: ${Math.floor(s/1024/1024)} MB`)),await t2(t,i,o,r,n,u,h,s),l=!0,a.verbose&&p.info("[Verbose] TUS upload completed, updating database with R2 path...");let m=`orgs/${o}/apps/${r}/${n}.zip`,{error:b}=await e.from("app_versions").update({r2_path:m}).eq("name",n).eq("app_id",r);if(b)return p.error(`Cannot finish TUS upload ${L(b)}`),a.verbose&&p.info(`[Verbose] Database update failed: ${L(b)}`),Promise.reject(new Error("Cannot finish TUS upload"));a.verbose&&p.info(`[Verbose] Database updated with R2 path: ${m}`)}else{a.verbose&&p.info("[Verbose] Using standard upload (non-TUS), getting presigned URL...");let m=await Z1(e,r,n);if(!m)return p.error("Cannot get upload url"),a.verbose&&p.info("[Verbose] Failed to retrieve presigned upload URL from database"),Promise.reject(new Error("Cannot get upload url"));a.verbose&&(p.info("[Verbose] Presigned URL obtained, uploading via HTTP PUT..."),p.info(` - Timeout: ${a.timeout||tg}ms`),p.info(" - Retry attempts: 5"),p.info(" - Content-Type: application/zip"));let b=new AbortController,D=setTimeout(()=>b.abort(),a.timeout||tg);try{let C=await fetch(m,{method:"PUT",body:i,headers:{"Content-Type":"application/zip"},signal:b.signal});if(!C.ok)throw new Error(`HTTP error! status: ${C.status}`)}finally{clearTimeout(D)}a.verbose&&p.info("[Verbose] HTTP PUT upload completed successfully")}}catch(h){let b=((performance.now()-c)/1e3).toFixed(2);if(u.stop(`Failed to upload bundle ( after ${b} seconds)`),a.verbose&&(p.info(`[Verbose] Upload failed after ${b} seconds`),p.info(`[Verbose] Error type: ${h instanceof Error?"Error":typeof h}`)),h instanceof Error&&h.message.includes("HTTP error"))try{let D=h.message.match(/status: (\d+)/),C=D?D[1]:"unknown";p.error(`Upload failed with status ${C}: ${h.message}`)}catch{p.error(`Upload failed: ${h.message}`)}else a.verbose&&p.info(`[Verbose] Non-HTTP error: ${L(h)}`),a.tus?p.error(`Cannot upload bundle please contact support if the issue persists ${L(h)}`):p.error(`Cannot upload bundle ( try again with --tus option) ${L(h)}`);throw a.verbose&&p.info("[Verbose] Cleaning up failed version from database..."),await r2(e,r,n),a.verbose&&p.info("[Verbose] Failed version cleaned up"),h instanceof Error?h:new Error(String(h))}let d=((performance.now()-c)/1e3).toFixed(2);u.stop(`Bundle uploaded \u{1F4AA} in (${d} seconds)`),a.verbose&&(p.info("[Verbose] Upload successful:"),p.info(` - Upload time: ${d} seconds`),p.info(` - Upload method: ${l?"TUS (resumable)":"Standard HTTP PUT"}`),p.info(` - Bundle size: ${Math.floor(i.byteLength/1024)} KB`),p.info("[Verbose] Sending performance event...")),await De(t,{channel:"performance",event:l?"TUS upload zip performance":"Upload zip performance",icon:"\u{1F684}",user_id:o,tags:{"app-id":r,time:d},notify:!1},a.verbose),a.verbose&&p.info("[Verbose] Performance event sent successfully")}async function MM(t,e,r){let{data:n,error:o}=await t.from("channels").select("version ( id, name, deleted )").eq("app_id",e).eq("name",r);if(o){p.error(`Cannot delete linked bundle on upload ${L(o)}`);return}if(n.length===0){p.warn("No linked bundle found in the channel you are trying to upload to");return}let i=n[0].version;if(i.deleted){p.warn("The linked bundle is already deleted");return}let{error:a}=await t.from("app_versions").update({deleted:!0}).eq("id",i.id);if(a){p.error(`Cannot delete linked bundle on upload ${L(a)}`);return}p.info("Linked bundle deleted")}async function qM(t,e,r,n,o,i,a,s,u,c){let{data:l}=await t.rpc("get_app_versions",{apikey:e,name_version:n,appid:s}).single();l||me("Cannot get version id, cannot set channel");let{data:f}=await t.rpc("is_allowed_capgkey",{apikey:e,keymode:["write","all"]}).single();if(f){let{error:d,data:h}=await xl(t,{name:o,app_id:s,created_by:i,version:l,owner_org:a,...c?{allow_device_self_set:!0}:{}});d&&me(`Cannot set channel, the upload key is not allowed to do that, use the "all" for this. ${L(d)}`);let m=`${u.hostWeb}/app/p/${s}/channel/${h.id}`;h?.public?p.info("Your update is now available in your public channel \u{1F389}"):h?.id&&p.info(`Link device to this bundle to try it: ${m}`),r&&p.info(`Bundle url: ${m}`)}else p.warn("The upload key is not allowed to set the version in the channel")}async function HM(t,e,r){let{error:n,data:o}=await e.from("apps").select("default_upload_channel").eq("app_id",t).single();return n?(p.warn("Cannot find default upload channel"),p.info(`You can set it here: ${r}/app/p/${t}/settings`),null):o.default_upload_channel}async function Lg(t,e,r=!0){r&&Z(`Uploading with CLI version ${hr.version}`);let n,o=lt();await he();let{s3Region:i,s3Apikey:a,s3Apisecret:s,s3BucketName:u,s3Endpoint:c,s3Port:l,s3SSL:f}=e;e.verbose&&(p.info("[Verbose] Starting upload process with options:"),p.info(` - API key: ${e.apikey?"provided":"from saved key"}`),p.info(` - Path: ${e.path||"from capacitor config"}`),p.info(` - Channel: ${e.channel||"from default upload channel"}`),p.info(` - Bundle: ${e.bundle||"auto-detected"}`),p.info(` - External: ${e.external||"false"}`),p.info(` - Encryption: ${e.keyV2||e.keyDataV2?"v2":e.key===!1?"disabled":"auto"}`),p.info(` - Upload method: ${e.tus?"TUS":e.zip?"ZIP":"auto"}`),p.info(` - Delta updates: ${e.delta||e.partial?"enabled":"disabled"}`));let d=TM(e);e.verbose&&p.info("[Verbose] API key retrieved successfully");let h=await te();e.verbose&&p.info("[Verbose] Capacitor config loaded successfully");let m=await H1();e.verbose&&(p.info("[Verbose] Remote file config retrieved:"),p.info(` - Max upload length: ${Math.floor(m.maxUploadLength/1024/1024)} MB`),p.info(` - Alert upload size: ${Math.floor(m.alertUploadSize/1024/1024)} MB`),p.info(` - TUS upload: ${m.TUSUpload?"enabled":"disabled"}`),p.info(` - TUS upload forced: ${m.TUSUploadForced?"yes":"no"}`),p.info(` - Partial upload: ${m.partialUpload?"enabled":"disabled"}`),p.info(` - Max chunk size: ${Math.floor(m.maxChunkSize/1024/1024)} MB`));let{appid:b,path:D}=IM(t,e,h.config);e.verbose&&p.info(`[Verbose] App ID: ${b}, Build path: ${D}`);let C=await PM(h.config,e);e.verbose&&p.info(`[Verbose] Bundle version: ${C}`);let E=e.external?"external":"r2-direct",g="none";e.autoSetBundle&&(await bs({version:C}),e.verbose&&p.info("[Verbose] Auto-set bundle version in capacitor.config.json")),RM(e,D),e.verbose&&p.info("[Verbose] Code check passed (notifyAppReady found and index.html present)"),p.info(`Upload ${b}@${C} started from path "${D}" to Capgo cloud`);let _=await sr();e.verbose&&p.info(`[Verbose] Local config loaded: host=${_.hostWeb}`),e.supaHost&&e.supaAnon&&(p.info("Using custom supabase instance from provided options"),_.supaHost=e.supaHost,_.supaKey=e.supaAnon,e.verbose&&p.info(`[Verbose] Custom Supabase host: ${e.supaHost}`));let S=await ne(d,e.supaHost,e.supaAnon);e.verbose&&p.info("[Verbose] Supabase client created successfully");let T=await oe(S,d,["write","all","upload"]);e.verbose&&p.info(`[Verbose] User verified successfully, user_id: ${T}`);let O=e.channel||await HM(b,S,_.hostWeb)||"dev";e.verbose&&p.info(`[Verbose] Target channel: ${O}`);let B=await ur(S,b);e.verbose&&p.info(`[Verbose] Organization ID: ${B}`),await W1(S,B,hr.version),e.verbose&&p.info("[Verbose] Remote CLI messages checked"),await Y1(S,B,d,b,!0),e.verbose&&p.info("[Verbose] Plan validation passed"),await jM(S,B,_),e.verbose&&p.info("[Verbose] Trial check completed"),e.verbose&&p.info(`[Verbose] Checking compatibility with channel ${O}...`);let{nativePackages:R,minUpdateVersion:N}=await BM(S,o,e,O,b,C);e.verbose&&(p.info("[Verbose] Compatibility check completed:"),p.info(` - Native packages: ${R?R.length:0}`),p.info(` - Min update version: ${N||"none"}`)),e.verbose&&p.info(`[Verbose] Checking if version ${C} already exists...`);let A=await NM(S,b,C,e.versionExistsOk);if(e.verbose&&p.info(`[Verbose] Version exists check: ${A?"yes (skipping)":"no (continuing)"}`),A)return{success:!0,skipped:!0,reason:"VERSION_EXISTS",bundle:C,checksum:null,encryptionMethod:g,storageProvider:E};e.external&&!e.external.startsWith("https://")&&me(`External link should should start with "https://" current is "${e.external}"`),e.deleteLinkedBundleOnUpload&&(p.warn("Deleting linked bundle on upload is destructive, it will delete the currently linked bundle in the channel you are trying to upload to."),p.warn("Please make sure you want to do this, if you are not sure, please do not use this option."));let U={name:C,app_id:b,session_key:void 0,external_url:e.external,storage_provider:E,min_update_version:N,native_packages:R,owner_org:B,user_id:T,checksum:void 0,link:e.link||null,comment:e.comment||null},M=null,Q="";if(e.external)e.verbose&&p.info(`[Verbose] Using external URL: ${e.external}`),await De(d,{channel:"app",event:"App external",icon:"\u{1F4E4}",user_id:B,tags:{"app-id":b},notify:!1},e.verbose),U.session_key=e.ivSessionKey,U.checksum=e.encryptedChecksum,e.verbose&&(p.info("[Verbose] External bundle configured:"),p.info(` - URL: ${e.external}`),p.info(` - IV Session Key: ${e.ivSessionKey?"provided":"none"}`),p.info(` - Encrypted Checksum: ${e.encryptedChecksum?"provided":"none"}`));else{e.verbose&&p.info(`[Verbose] Preparing bundle file from path: ${D}`);let{zipped:F,ivSessionKey:I,checksum:k,sessionKey:q,encryptionMethod:P,finalKeyData:j}=await LM(D,e,d,B,b,m.maxUploadLength,m.alertUploadSize);U.session_key=I,U.checksum=k,n=q,M=F,g=P,Q=j,e.verbose&&(p.info("[Verbose] Bundle prepared:"),p.info(` - Size: ${Math.floor((F?.byteLength??0)/1024)} KB`),p.info(` - Checksum: ${k}`),p.info(` - Encryption: ${P}`),p.info(` - IV Session Key: ${I?"present":"none"}`)),e.ignoreChecksumCheck||(e.verbose&&p.info("[Verbose] Checking for duplicate checksum..."),await i2(S,b,O,k),e.verbose&&p.info("[Verbose] Checksum is unique"))}if(e.zip?(e.tus=!1,e.verbose&&p.info("[Verbose] Upload method: ZIP (explicitly set via --zip)")):!m.TUSUpload||e.external?(e.tus=!1,e.verbose&&p.info("[Verbose] Upload method: Standard (TUS not available or external URL)")):(e.tus=e.tus||m.TUSUploadForced,e.verbose&&p.info(`[Verbose] Upload method: ${e.tus?"TUS (resumable)":"Standard"}`)),!m.partialUpload||e.external?(e.delta=!1,e.verbose&&e.external&&p.info("[Verbose] Delta updates disabled (not available with external URLs)")):(e.delta=e.delta||e.partial||e.deltaOnly||e.partialOnly||m.partialUploadForced,e.verbose&&p.info(`[Verbose] Delta updates: ${e.delta?"enabled":"disabled"}`)),e.encryptPartial&&g==="v1"&&me("You cannot encrypt the partial update if you are not using the v2 encryption method"),e.delta&&g==="v2"&&!e.encryptPartial){let F=(0,jg.join)(vt((0,Ng.cwd)()),bt),k=(await ct(void 0,e.packageJson||F)).get("@capgo/capacitor-updater"),q;try{q=k?_e(k):void 0}catch{q=void 0}k&&q&&dn(q,_e("6.14.4"))&&(p.info(`Auto-enabling partial update encryption for updater version ${q} (> 6.14.4)`),e.verbose&&p.info("[Verbose] Partial encryption auto-enabled for updater >= 6.14.4"),e.encryptPartial=!0)}e.verbose&&e.delta&&p.info("[Verbose] Preparing delta/partial update manifest...");let $=e.delta?await uF(D,d,B,b,e.encryptPartial?g:"none",Q):[];e.verbose&&e.delta&&p.info(`[Verbose] Delta manifest prepared with ${$.length} files`),e.verbose&&p.info("[Verbose] Creating version record in database...");let{error:y}=await ag(S,U);if(y&&me(`Cannot add bundle ${L(y)}`),e.verbose&&p.info("[Verbose] Version record created successfully"),e.tusChunkSize&&e.tusChunkSize>m.maxChunkSize?(p.error(`Chunk size ${e.tusChunkSize} is greater than the maximum chunk size ${m.maxChunkSize}, using the maximum chunk size`),e.tusChunkSize=m.maxChunkSize):e.tusChunkSize||(e.tusChunkSize=m.maxChunkSize),e.verbose&&p.info(`[Verbose] TUS chunk size: ${Math.floor(e.tusChunkSize/1024/1024)} MB`),M&&(u||c||i||a||s||l||f)){(!u||!c||!i||!a||!s||!l)&&me("Missing argument, for S3 upload you need to provide a bucket name, endpoint, region, port, API key, and API secret"),p.info("Uploading to S3"),e.verbose&&(p.info("[Verbose] S3 configuration:"),p.info(` - Endpoint: ${c}`),p.info(` - Region: ${i}`),p.info(` - Bucket: ${u}`),p.info(` - Port: ${l}`),p.info(` - SSL: ${f?"enabled":"disabled"}`));let F=f?`https://${c}`:`http://${c}`,I=new xs({endPoint:c,region:i,port:l,pathStyle:!0,bucket:u,accessKey:a,secretKey:s}),k=`${b}-${C}`,q=encodeURIComponent(k);e.verbose&&p.info(`[Verbose] Uploading to S3 as: ${k}`),await I.putObject(k,Uint8Array.from(M)),U.external_url=`${F}/${q}`,U.storage_provider="external",e.verbose&&p.info(`[Verbose] S3 upload complete, external URL: ${U.external_url}`)}else if(M){!e.partialOnly&&!e.deltaOnly?(e.verbose&&p.info("[Verbose] Starting full bundle upload to Capgo Cloud..."),await UM(d,S,b,C,B,M,e,e.tusChunkSize)):e.verbose&&p.info("[Verbose] Skipping full bundle upload (delta-only mode)");let F=null;try{e.dryUpload&&(e.delta=!1,e.verbose&&p.info("[Verbose] Dry upload mode: skipping delta upload"));let k=U.session_key&&e.encryptPartial&&n?{sessionKey:n,ivSessionKey:U.session_key}:void 0;e.verbose&&e.delta&&(p.info("[Verbose] Starting delta/partial file upload..."),p.info(` - Manifest entries: ${$.length}`),p.info(` - Encryption: ${k?"enabled":"disabled"}`)),F=e.delta?await cF(d,$,D,b,C,B,k,e):null,e.verbose&&F&&p.info(`[Verbose] Delta upload complete with ${F.length} files`)}catch(k){p.info(`Failed to upload partial files to capgo cloud. Error: ${L(k)}. This is not a critical error, the bundle has been uploaded without the partial files`),e.verbose&&p.info(`[Verbose] Delta upload error details: ${L(k)}`)}U.storage_provider="r2",U.manifest=F,e.verbose&&p.info("[Verbose] Updating version record with storage provider and manifest...");let{error:I}=await ag(S,U);I&&me(`Cannot update bundle ${L(I)}`),e.verbose&&p.info("[Verbose] Version record updated successfully")}e.verbose&&p.info("[Verbose] Checking app permissions...");let v=await Ne(S,d,b,2);e.verbose&&(p.info("[Verbose] Permissions:"),p.info(` - Upload: ${Wi(v,2)?"yes":"no"}`),p.info(` - Write: ${Wi(v,3)?"yes":"no"}`),p.info(` - Admin: ${Wi(v,4)?"yes":"no"}`)),e.deleteLinkedBundleOnUpload&&Wi(v,3)?(e.verbose&&p.info(`[Verbose] Deleting linked bundle in channel ${O}...`),await MM(S,b,O)):e.deleteLinkedBundleOnUpload&&p.warn("Cannot delete linked bundle on upload as a upload organization member"),Wi(v,3)?(e.verbose&&p.info(`[Verbose] Setting bundle ${C} to channel ${O}...`),await qM(S,d,!!e.bundleUrl,C,O,T,B,b,_,e.selfAssign),e.verbose&&p.info("[Verbose] Channel updated successfully")):p.warn("Cannot set channel as a upload organization member"),e.verbose&&p.info("[Verbose] Sending upload event..."),await De(d,{channel:"app",event:"App Uploaded",icon:"\u23EB",user_id:B,tags:{"app-id":b},notify:!1},e.verbose);let w={success:!0,bundle:C,checksum:U.checksum??null,encryptionMethod:g,sessionKey:n?n.toString("base64"):void 0,ivSessionKey:typeof U.session_key=="string"?U.session_key:void 0,storageProvider:U.storage_provider};return e.verbose&&(p.info("[Verbose] Upload completed successfully:"),p.info(` - Bundle: ${w.bundle}`),p.info(` - Checksum: ${w.checksum}`),p.info(` - Encryption: ${w.encryptionMethod}`),p.info(` - Storage: ${w.storageProvider}`)),r&&!w.skipped&&J("Time to share your update to the world \u{1F30D}"),w}function VM(t){t.ivSessionKey&&!t.external&&me("You need to provide an external url if you want to use the --iv-session-key option"),t.encryptedChecksum&&!t.external&&me("You need to provide an external url if you want to use the --encrypted-checksum option"),(t.partial||t.delta||t.partialOnly||t.deltaOnly)&&t.external&&me("You cannot use the --partial/--delta/--partial-only/--delta-only option with an external url"),t.tus&&t.external&&me("You cannot use the --tus option with an external url"),t.dryUpload&&t.external&&me("You cannot use the --dry-upload option with an external url"),t.multipart&&t.external&&me("You cannot use the --multipart option with an external url"),t.external&&(t.keyV2||t.keyDataV2)&&me("You cannot set a key if you are uploading to an external url"),t.keyV2&&t.keyDataV2&&me("You cannot set both key-v2 and key-data-v2"),t.external&&(t.s3Region||t.s3Apikey||t.s3Apisecret||t.s3Endpoint||t.s3BucketName||t.s3Port||t.s3SSL)&&me("You cannot set S3 options if you are uploading to an external url, it's automatically handled"),t.encryptedChecksum&&!t.external&&me("You cannot set the --encrypted-checksum option if you are not uploading to an external url"),t.minUpdateVersion&&t.autoMinUpdateVersion&&me("You cannot set both min-update-version and auto-min-update-version, use only one of them")}async function fF(t,e){try{VM(e),await Lg(t,e,!0)}catch(r){throw p.error(`uploadBundle failded: ${L(r)}`),r instanceof Error?r:new Error(String(r))}}var pF=require("node:crypto"),Kl=require("node:fs"),dF=require("node:path"),hF=require("node:process");var zM=20;function GM(t){console.log(JSON.stringify(t,null,2))}function $s(t){console.error(L(t))}async function WM(t,e,r=!1){let{json:n}=e,{bundle:o,path:i}=e,a=!n&&!r;try{a&&await he();let s=await te(),u=de(t,s?.config),c=(0,pF.randomUUID)().split("-")[0],l=_r("",e.packageJson);if(o=o||l||`0.0.1-beta.${c}`,a&&Z(`Zipping ${u}@${o}`),o&&!Gi.test(o)){let O=`Your bundle name ${o}, is not valid it should follow semver convention : https://semver.org/`;throw r||(n?$s({error:"invalid_semver"}):p.error(O)),new Error("Invalid bundle version format")}if(i=i||s?.config?.webDir,!u||!o||!i){let O="Missing argument, you need to provide a appId and a bundle and a path, or be in a capacitor project";throw r||(n?$s({error:"missing_argument"}):p.error(O)),new Error(O)}if(a&&p.info(`Started from path "${i}"`),typeof e.codeCheck>"u"?!0:e.codeCheck){if(!Ss(i,"notifyAppReady"))throw r||(n?$s({error:"notifyAppReady_not_in_source_code"}):p.error("notifyAppReady() is missing in the build folder of your app. see: https://capgo.app/docs/plugin/api/#notifyappready")),new Error("notifyAppReady() is missing in build folder");if(!Ll(i))throw r||(n?$s({error:"index_html_not_found"}):p.error(`index.html is missing in the root folder of ${i}`)),new Error("index.html is missing in root folder")}let d=await _l(i);a&&p.info(`Zipped ${d.byteLength} bytes`);let h=a?Ee():null;h&&h.start("Calculating checksum");let m=(0,dF.join)(vt((0,hF.cwd)()),bt),D=(await ct(void 0,e.packageJson||m)).get("@capgo/capacitor-updater");if(!D){let O="Cannot find @capgo/capacitor-updater in ./package.json, provide the package.json path with --package-json it's required for v7 CLI to work";throw r||p.warn(O),new Error(O)}let C=!1,E;try{E=D?_e(D):void 0}catch{E=void 0}if(E){let O=E.major===6&&dn(E,_e("6.25.0")),B=E.major>=7;C=O||B}else D==="link:@capgo/capacitor-updater"&&(r||p.warn("Using local @capgo/capacitor-updater. Assuming v7"),C=!0);let g=await Xr(d,e.keyV2||(0,Kl.existsSync)(Wt)||C?"sha256":"crc32");h&&h.stop(`Checksum ${C?"SHA256":"CRC32"}: ${g}`);let _=Math.floor(d.byteLength/1024/1024);_>zM&&a&&(p.warn(`WARNING !!
206
+ The bundle size is ${_} Mb, this may take a while to download for users
207
207
  `),p.warn(`Learn how to optimize your assets https://capgo.app/blog/optimise-your-images-for-updates/
208
- `));let S=s?Se():null,T=e.name||`${u}_${o}.zip`;return S&&S.start(`Saving to ${T}`),(0,Af.writeFileSync)(T,h),S&&S.stop(`Saved to ${T}`),s&&Z("Done \u2705"),!r&&n&&JV({bundle:o,filename:T,checksum:g}),{bundle:o,filename:T,checksum:g}}catch(a){throw r||(n?Ja(a):p.error(j(a))),a instanceof Error?a:new Error(String(a))}}async function QO(t,e){await ZV(t,e,!1)}async function ND(t,e,r,n=!1){n||ee("Create channel"),r.apikey=r.apikey||ce();let o=await ne().catch(()=>{});if(e=ge(e,o?.config),!r.apikey)throw n||p.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||p.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let i=await ie(r.apikey,r.supaHost,r.supaAnon);await ae(i,r.apikey,["write","all"]),await qe(i,r.apikey,e,4,n),n||p.info(`Creating channel ${e}#${t} to Capgo`);let s=await uD(i,e);if(!s)throw n||p.error("Cannot find default version for channel creation, please contact Capgo support \u{1F928}"),new Error("Cannot find default version for channel creation");let a=await yr(i,e),u=await ae(i,r.apikey,["write","all"]),c=await n2(i,{name:t,app_id:e,version:s.id,created_by:u,owner_org:a,allow_device_self_set:r.selfAssign??!1,public:r.default??!1});if(c.error)throw n||p.error(`Cannot create Channel \u{1F640}
209
- ${j(c.error)}`),new Error(`Cannot create channel: ${j(c.error)}`);return await we(r.apikey,{channel:"channel",event:"Create channel",icon:"\u2705",user_id:a,tags:{"app-id":e,channel:t},notify:!1}).catch(()=>{}),n||(p.success("Channel created \u2705"),Z("Done \u2705")),c.data??!0}async function ek(t,e,r){await ND(t,e,r,!1)}async function tk(t,e,r,n=!1){let{quiet:o}=r;!o&&!n&&ee("List current bundle"),r.apikey=r.apikey||ce(o);let i=await ne();if(e=ge(e,i?.config),!r.apikey)throw n||p.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||p.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let s=await ie(r.apikey,r.supaHost,r.supaAnon);if(await ae(s,r.apikey,["write","all","read"]),await qe(s,r.apikey,e,1,n),!t)throw n||p.error("Please provide a channel to get the bundle from."),new Error("Channel name missing");let{data:a,error:u}=await s.from("channels").select("version ( name )").eq("name",t).eq("app_id",e).limit(1);if(u||!a?.length)throw n||p.error(`Error retrieving channel ${t} for app ${e}. Perhaps the channel does not exist?`),new Error(`Channel ${t} not found for app ${e}`);let{version:c}=a[0];if(!c)throw n||p.error(`Error retrieving channel ${t} for app ${e}. Perhaps the channel does not exist?`),new Error(`Channel ${t} does not have a bundle linked`);return n||(o?p.info(c.name):p.info(`Current bundle for channel ${t} is ${c.name}`)),c.name}async function rk(t,e,r,n=!1){n||ee("Delete channel"),r.apikey=r.apikey||ce();let o=await ne();if(e=ge(e,o?.config),!r.apikey)throw n||p.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||p.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let i=await ie(r.apikey,r.supaHost,r.supaAnon),s=await ae(i,r.apikey,["all"]);if(await qe(i,r.apikey,e,4,n),r.deleteBundle&&!n&&p.info(`Deleting bundle ${e}#${t} from Capgo`),r.deleteBundle){let h=await a2(i,e,t);h?.name&&!n&&p.info(`Deleting bundle ${h.name} from Capgo`),h?.name&&await cD(i,e,h.name)}let{data:a,error:u}=await i2(i,e,t);if(u||!a){if(n||p.error(`Channel ${t} not found`),r.successIfNotFound)return n||p.success(`Channel ${t} not found and successIfNotFound is true`),!0;throw new Error(`Channel ${t} not found`)}let{error:c}=await s2(i,e,a.id);if(c)throw n||p.error(`Cannot delete channel devices: ${j(c)}`),new Error(`Cannot delete channel devices: ${j(c)}`);n||p.info(`Deleting channel ${e}#${t} from Capgo`);let l=await o2(i,t,e,s);if(l.error)throw n||p.error(`Cannot delete Channel \u{1F640} ${j(l.error)}`),new Error(`Cannot delete channel: ${j(l.error)}`);let f=await yr(i,e);return await we(r.apikey,{channel:"channel",event:"Delete channel",icon:"\u2705",user_id:f,tags:{"app-id":e,channel:t},notify:!1}).catch(()=>{}),n||(p.success("Channel deleted"),Z("Done \u2705")),!0}async function nk(t,e,r=!1){r||ee("List channels"),e.apikey=e.apikey||ce();let n=await ne();if(t=ge(t,n?.config),!e.apikey)throw r||p.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||p.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let o=await ie(e.apikey,e.supaHost,e.supaAnon),i=await ae(o,e.apikey,["write","all","read","upload"]);await qe(o,e.apikey,t,1,r),r||p.info("Querying available channels in Capgo");let s=await c2(o,t);return r||(p.info(`Active channels in Capgo: ${s?.length??0}`),u2(s)),await we(e.apikey,{channel:"channel",event:"List channel",icon:"\u2705",user_id:i,tags:{"app-id":t},notify:!1}).catch(()=>{}),r||Z("Done \u2705"),s}var ok=["major","minor","metadata","patch","none"];async function ik(t,e,r,n=!1){n||ee("Set channel"),r.apikey=r.apikey||ce();let o=await ne();if(e=ge(e,o?.config),!r.apikey)throw n||p.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||p.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||p.error("Missing argument, you need to provide a channel"),new Error("Missing channel id");let i=await ie(r.apikey,r.supaHost,r.supaAnon),s=await ae(i,r.apikey,["write","all"]);await qe(i,r.apikey,e,4,n);let a=await yr(i,e),{bundle:u,state:c,downgrade:l,latest:f,latestRemote:h,ios:d,android:m,selfAssign:b,disableAutoUpdate:D,dev:E,emulator:_}=r;if(f&&u)throw n||p.error("Cannot set latest and bundle at the same time"),new Error("Cannot set both latest and bundle simultaneously");if(h&&u)throw n||p.error("Cannot set latest remote and bundle at the same time"),new Error("Cannot set both latest remote and bundle simultaneously");if(h&&f)throw n||p.error("Cannot set latest remote and latest at the same time"),new Error("Cannot set both latest remote and latest simultaneously");if(u==null&&c==null&&f==null&&h==null&&l==null&&d==null&&m==null&&b==null&&E==null&&_==null&&D==null)throw n||p.error("Missing argument, you need to provide a option to set"),new Error("No channel option provided");await PF(i,a,r.apikey,e);let g={created_by:s,app_id:e,name:t,owner_org:a,version:void 0},{error:x}=await i.from("channels").select().eq("app_id",e).eq("name",t).single();if(x)throw n||p.error(`Cannot find channel ${t}`),new Error(`Cannot find channel ${t}`);let S=f?o?.config?.plugins?.CapacitorUpdater?.version||Rr("",r.packageJson):u;if(S!=null){let{data:O,error:B}=await i.from("app_versions").select().eq("app_id",e).eq("name",S).eq("user_id",s).eq("deleted",!1).single();if(B||!O)throw n||p.error(`Cannot find version ${S}`),new Error(`Cannot find version ${S}`);if(!r.ignoreMetadataCheck){let{finalCompatibility:I,localDependencies:L}=await iD(i,e,t,O.native_packages??[]),F=ht();if(L.length>0&&I.some(U=>!Lo(U)))throw n||(p.warn(`Bundle NOT compatible with ${t} channel`),p.warn(`You can check compatibility with "${F.runner} @capgo/cli bundle compatibility"`)),new Error(`Bundle is not compatible with ${t} channel`);n||(L.length===0&&I.length>0?p.info(`Ignoring check compatibility with ${t} channel because the bundle does not contain any native packages`):p.info(`Bundle is compatible with ${t} channel`))}n||p.info(`Set ${e} channel: ${t} to @${S}`),g.version=O.id}if(h){let{data:O,error:B}=await i.from("app_versions").select().eq("app_id",e).eq("user_id",s).eq("deleted",!1).order("created_at",{ascending:!1}).single();if(B||!O)throw n||p.error("Cannot find latest remote version"),new Error("Cannot find latest remote version");if(!r.ignoreMetadataCheck){let{finalCompatibility:I}=await iD(i,e,t,O.native_packages??[]),L=ht();if(I.some(F=>!Lo(F)))throw n||(p.warn(`Bundle NOT compatible with ${t} channel`),p.warn(`You can check compatibility with "${L.runner} @capgo/cli bundle compatibility"`)),new Error(`Latest remote bundle is not compatible with ${t} channel`)}n||p.info(`Set ${e} channel: ${t} to @${O.name}`),g.version=O.id}if(c!=null){if(c!=="normal"&&c!=="default")throw n||p.error(`State ${c} is not known. The possible values are: normal, default.`),new Error(`Unknown state ${c}. Expected normal or default`);n||p.info(`Set ${e} channel: ${t} to ${c}`),g.public=c==="default"}if(l!=null&&(n||p.info(`Set ${e} channel: ${t} to ${l?"allow":"disallow"} downgrade`),g.disable_auto_update_under_native=!l),d!=null&&(n||p.info(`Set ${e} channel: ${t} to ${d?"allow":"disallow"} ios update`),g.ios=!!d),m!=null&&(n||p.info(`Set ${e} channel: ${t} to ${m?"allow":"disallow"} android update`),g.android=!!m),b!=null&&(n||p.info(`Set ${e} channel: ${t} to ${b?"allow":"disallow"} self assign to this channel`),g.allow_device_self_set=!!b),E!=null&&(n||p.info(`Set ${e} channel: ${t} to ${E?"allow":"disallow"} dev devices`),g.allow_dev=!!E),_!=null&&(n||p.info(`Set ${e} channel: ${t} to ${_?"allow":"disallow"} emulator devices`),g.allow_emulator=!!_),D!=null){let O=D.toLowerCase();if(!ok.includes(O))throw n||p.error(`Channel strategy ${O} is not known. The possible values are: ${ok.join(", ")}.`),new Error(`Unknown channel strategy ${O}`);O==="metadata"&&(O="version_number"),g.disable_auto_update=O,n||p.info(`Set ${e} channel: ${t} to ${O} disable update strategy to this channel`)}let{error:T}=await nf(i,g);if(T)throw n||p.error('Cannot set channel the upload key is not allowed to do that, use the "all" for this.'),new Error("Upload key is not allowed to set this channel");return await we(r.apikey,{channel:"channel",event:"Set channel",icon:"\u2705",user_id:a,tags:{"app-id":e},notify:!1}).catch(()=>{}),n||Z("Done \u2705"),!0}var Jr=require("node:fs");function LD(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 sk(t="./README.md",e){let r=gt.commands.map(o=>{let i=o,s=i._actionHandler!==null&&i._actionHandler!==void 0,u=o.commands&&o.commands.length>0&&!s;return{name:o.name(),alias:o.alias()||"",description:o.description(),options:o.options.map(c=>({flags:c.flags,description:c.description||""})),subcommands:o.commands?o.commands.map(c=>{let l=c,f=l._actionHandler!==null&&l._actionHandler!==void 0;return{name:c.name(),alias:c.alias()||"",description:c.description(),options:c.options.map(h=>({flags:h.flags,description:h.description||""})),subcommands:[],hasAction:f,isCommandGroup:!1}}):[],hasAction:s,isCommandGroup:u}}),n=(o,i=!1,s,a=!1)=>{let u=o.name,c=u.charAt(0).toUpperCase()+u.slice(1),l;i?l=s?`${s}-${u}`:u:l=a?"options":u;let f=i?"###":"##",h="",d=LD(u);a&&!i||(h+=`${f} <a id="${l}"></a> ${d} **${c}**
208
+ `));let S=a?Ee():null,T=e.name||`${u}_${o}.zip`;return S&&S.start(`Saving to ${T}`),(0,Kl.writeFileSync)(T,d),S&&S.stop(`Saved to ${T}`),a&&J("Done \u2705"),!r&&n&&GM({bundle:o,filename:T,checksum:g}),{bundle:o,filename:T,checksum:g}}catch(s){throw r||(n?$s(s):p.error(L(s))),s instanceof Error?s:new Error(String(s))}}async function mF(t,e){await WM(t,e,!1)}async function Ug(t,e,r,n=!1){n||Z("Create channel"),r.apikey=r.apikey||ae();let o=await te().catch(()=>{});if(e=de(e,o?.config),!r.apikey)throw n||p.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||p.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let i=await ne(r.apikey,r.supaHost,r.supaAnon);await oe(i,r.apikey,["write","all"]),await Ne(i,r.apikey,e,4,n),n||p.info(`Creating channel ${e}#${t} to Capgo`);let a=await fg(i,e);if(!a)throw n||p.error("Cannot find default version for channel creation, please contact Capgo support \u{1F928}"),new Error("Cannot find default version for channel creation");let s=await ur(i,e),u=await oe(i,r.apikey,["write","all"]),c=await b2(i,{name:t,app_id:e,version:a.id,created_by:u,owner_org:s,allow_device_self_set:r.selfAssign??!1,public:r.default??!1});if(c.error)throw n||p.error(`Cannot create Channel \u{1F640}
209
+ ${L(c.error)}`),new Error(`Cannot create channel: ${L(c.error)}`);return await De(r.apikey,{channel:"channel",event:"Create channel",icon:"\u2705",user_id:s,tags:{"app-id":e,channel:t},notify:!1}).catch(()=>{}),n||(p.success("Channel created \u2705"),J("Done \u2705")),c.data??!0}async function gF(t,e,r){await Ug(t,e,r,!1)}async function DF(t,e,r,n=!1){let{quiet:o}=r;!o&&!n&&Z("List current bundle"),r.apikey=r.apikey||ae(o);let i=await te();if(e=de(e,i?.config),!r.apikey)throw n||p.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||p.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let a=await ne(r.apikey,r.supaHost,r.supaAnon);if(await oe(a,r.apikey,["write","all","read"]),await Ne(a,r.apikey,e,1,n),!t)throw n||p.error("Please provide a channel to get the bundle from."),new Error("Channel name missing");let{data:s,error:u}=await a.from("channels").select("version ( name )").eq("name",t).eq("app_id",e).limit(1);if(u||!s?.length)throw n||p.error(`Error retrieving channel ${t} for app ${e}. Perhaps the channel does not exist?`),new Error(`Channel ${t} not found for app ${e}`);let{version:c}=s[0];if(!c)throw n||p.error(`Error retrieving channel ${t} for app ${e}. Perhaps the channel does not exist?`),new Error(`Channel ${t} does not have a bundle linked`);return n||(o?p.info(c.name):p.info(`Current bundle for channel ${t} is ${c.name}`)),c.name}async function yF(t,e,r,n=!1){n||Z("Delete channel"),r.apikey=r.apikey||ae();let o=await te();if(e=de(e,o?.config),!r.apikey)throw n||p.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||p.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let i=await ne(r.apikey,r.supaHost,r.supaAnon),a=await oe(i,r.apikey,["all"]);if(await Ne(i,r.apikey,e,4,n),r.deleteBundle&&!n&&p.info(`Deleting bundle ${e}#${t} from Capgo`),r.deleteBundle){let d=await E2(i,e,t);d?.name&&!n&&p.info(`Deleting bundle ${d.name} from Capgo`),d?.name&&await pg(i,e,d.name)}let{data:s,error:u}=await w2(i,e,t);if(u||!s){if(n||p.error(`Channel ${t} not found`),r.successIfNotFound)return n||p.success(`Channel ${t} not found and successIfNotFound is true`),!0;throw new Error(`Channel ${t} not found`)}let{error:c}=await C2(i,e,s.id);if(c)throw n||p.error(`Cannot delete channel devices: ${L(c)}`),new Error(`Cannot delete channel devices: ${L(c)}`);n||p.info(`Deleting channel ${e}#${t} from Capgo`);let l=await v2(i,t,e,a);if(l.error)throw n||p.error(`Cannot delete Channel \u{1F640} ${L(l.error)}`),new Error(`Cannot delete channel: ${L(l.error)}`);let f=await ur(i,e);return await De(r.apikey,{channel:"channel",event:"Delete channel",icon:"\u2705",user_id:f,tags:{"app-id":e,channel:t},notify:!1}).catch(()=>{}),n||(p.success("Channel deleted"),J("Done \u2705")),!0}async function bF(t,e,r=!1){r||Z("List channels"),e.apikey=e.apikey||ae();let n=await te();if(t=de(t,n?.config),!e.apikey)throw r||p.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||p.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let o=await ne(e.apikey,e.supaHost,e.supaAnon),i=await oe(o,e.apikey,["write","all","read","upload"]);await Ne(o,e.apikey,t,1,r),r||p.info("Querying available channels in Capgo");let a=await x2(o,t);return r||(p.info(`Active channels in Capgo: ${a?.length??0}`),_2(a)),await De(e.apikey,{channel:"channel",event:"List channel",icon:"\u2705",user_id:i,tags:{"app-id":t},notify:!1}).catch(()=>{}),r||J("Done \u2705"),a}var vF=["major","minor","metadata","patch","none"];async function wF(t,e,r,n=!1){n||Z("Set channel"),r.apikey=r.apikey||ae();let o=await te();if(e=de(e,o?.config),!r.apikey)throw n||p.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||p.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||p.error("Missing argument, you need to provide a channel"),new Error("Missing channel id");let i=await ne(r.apikey,r.supaHost,r.supaAnon),a=await oe(i,r.apikey,["write","all"]);await Ne(i,r.apikey,e,4,n);let s=await ur(i,e),{bundle:u,state:c,downgrade:l,latest:f,latestRemote:d,ios:h,android:m,selfAssign:b,disableAutoUpdate:D,dev:C,emulator:E}=r;if(f&&u)throw n||p.error("Cannot set latest and bundle at the same time"),new Error("Cannot set both latest and bundle simultaneously");if(d&&u)throw n||p.error("Cannot set latest remote and bundle at the same time"),new Error("Cannot set both latest remote and bundle simultaneously");if(d&&f)throw n||p.error("Cannot set latest remote and latest at the same time"),new Error("Cannot set both latest remote and latest simultaneously");if(u==null&&c==null&&f==null&&d==null&&l==null&&h==null&&m==null&&b==null&&C==null&&E==null&&D==null)throw n||p.error("Missing argument, you need to provide a option to set"),new Error("No channel option provided");await K1(i,s,r.apikey,e);let g={created_by:a,app_id:e,name:t,owner_org:s,version:void 0},{error:_}=await i.from("channels").select().eq("app_id",e).eq("name",t).single();if(_)throw n||p.error(`Cannot find channel ${t}`),new Error(`Cannot find channel ${t}`);let S=f?o?.config?.plugins?.CapacitorUpdater?.version||_r("",r.packageJson):u;if(S!=null){let{data:O,error:B}=await i.from("app_versions").select().eq("app_id",e).eq("name",S).eq("user_id",a).eq("deleted",!1).single();if(B||!O)throw n||p.error(`Cannot find version ${S}`),new Error(`Cannot find version ${S}`);if(!r.ignoreMetadataCheck){let{finalCompatibility:R,localDependencies:N}=await ug(i,e,t,O.native_packages??[]),A=lt();if(N.length>0&&R.some(U=>!So(U)))throw n||(p.warn(`Bundle NOT compatible with ${t} channel`),p.warn(`You can check compatibility with "${A.runner} @capgo/cli bundle compatibility"`)),new Error(`Bundle is not compatible with ${t} channel`);n||(N.length===0&&R.length>0?p.info(`Ignoring check compatibility with ${t} channel because the bundle does not contain any native packages`):p.info(`Bundle is compatible with ${t} channel`))}n||p.info(`Set ${e} channel: ${t} to @${S}`),g.version=O.id}if(d){let{data:O,error:B}=await i.from("app_versions").select().eq("app_id",e).eq("user_id",a).eq("deleted",!1).order("created_at",{ascending:!1}).single();if(B||!O)throw n||p.error("Cannot find latest remote version"),new Error("Cannot find latest remote version");if(!r.ignoreMetadataCheck){let{finalCompatibility:R}=await ug(i,e,t,O.native_packages??[]),N=lt();if(R.some(A=>!So(A)))throw n||(p.warn(`Bundle NOT compatible with ${t} channel`),p.warn(`You can check compatibility with "${N.runner} @capgo/cli bundle compatibility"`)),new Error(`Latest remote bundle is not compatible with ${t} channel`)}n||p.info(`Set ${e} channel: ${t} to @${O.name}`),g.version=O.id}if(c!=null){if(c!=="normal"&&c!=="default")throw n||p.error(`State ${c} is not known. The possible values are: normal, default.`),new Error(`Unknown state ${c}. Expected normal or default`);n||p.info(`Set ${e} channel: ${t} to ${c}`),g.public=c==="default"}if(l!=null&&(n||p.info(`Set ${e} channel: ${t} to ${l?"allow":"disallow"} downgrade`),g.disable_auto_update_under_native=!l),h!=null&&(n||p.info(`Set ${e} channel: ${t} to ${h?"allow":"disallow"} ios update`),g.ios=!!h),m!=null&&(n||p.info(`Set ${e} channel: ${t} to ${m?"allow":"disallow"} android update`),g.android=!!m),b!=null&&(n||p.info(`Set ${e} channel: ${t} to ${b?"allow":"disallow"} self assign to this channel`),g.allow_device_self_set=!!b),C!=null&&(n||p.info(`Set ${e} channel: ${t} to ${C?"allow":"disallow"} dev devices`),g.allow_dev=!!C),E!=null&&(n||p.info(`Set ${e} channel: ${t} to ${E?"allow":"disallow"} emulator devices`),g.allow_emulator=!!E),D!=null){let O=D.toLowerCase();if(!vF.includes(O))throw n||p.error(`Channel strategy ${O} is not known. The possible values are: ${vF.join(", ")}.`),new Error(`Unknown channel strategy ${O}`);O==="metadata"&&(O="version_number"),g.disable_auto_update=O,n||p.info(`Set ${e} channel: ${t} to ${O} disable update strategy to this channel`)}let{error:T}=await xl(i,g);if(T)throw n||p.error('Cannot set channel the upload key is not allowed to do that, use the "all" for this.'),new Error("Upload key is not allowed to set this channel");return await De(r.apikey,{channel:"channel",event:"Set channel",icon:"\u2705",user_id:s,tags:{"app-id":e},notify:!1}).catch(()=>{}),n||J("Done \u2705"),!0}var Ur=require("node:fs");function Mg(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 CF(t="./README.md",e){let r=pt.commands.map(o=>{let i=o,a=i._actionHandler!==null&&i._actionHandler!==void 0,u=o.commands&&o.commands.length>0&&!a;return{name:o.name(),alias:o.alias()||"",description:o.description(),options:o.options.map(c=>({flags:c.flags,description:c.description||""})),subcommands:o.commands?o.commands.map(c=>{let l=c,f=l._actionHandler!==null&&l._actionHandler!==void 0;return{name:c.name(),alias:c.alias()||"",description:c.description(),options:c.options.map(d=>({flags:d.flags,description:d.description||""})),subcommands:[],hasAction:f,isCommandGroup:!1}}):[],hasAction:a,isCommandGroup:u}}),n=(o,i=!1,a,s=!1)=>{let u=o.name,c=u.charAt(0).toUpperCase()+u.slice(1),l;i?l=a?`${a}-${u}`:u:l=s?"options":u;let f=i?"###":"##",d="",h=Mg(u);s&&!i||(d+=`${f} <a id="${l}"></a> ${h} **${c}**
210
210
 
211
- `),o.alias&&(h+=`**Alias:** \`${o.alias}\`
211
+ `),o.alias&&(d+=`**Alias:** \`${o.alias}\`
212
212
 
213
- `),o.isCommandGroup||(h+="```bash\n",i?h+=`npx @capgo/cli@latest ${s} ${u}
214
- `:h+=`npx @capgo/cli@latest ${u}
215
- `,h+="```\n\n");let m=o.description.split(`
216
- `),b=!i&&a?1:0;for(let E=b;E<m.length;E++){let _=m[E];_.trim().startsWith("Note:")?h+=`> \u2139\uFE0F ${_.trim().substring(5).trim()}
213
+ `),o.isCommandGroup||(d+="```bash\n",i?d+=`npx @capgo/cli@latest ${a} ${u}
214
+ `:d+=`npx @capgo/cli@latest ${u}
215
+ `,d+="```\n\n");let m=o.description.split(`
216
+ `),b=!i&&s?1:0;for(let C=b;C<m.length;C++){let E=m[C];E.trim().startsWith("Note:")?d+=`> \u2139\uFE0F ${E.trim().substring(5).trim()}
217
217
 
218
- `:_.includes("Example:")||_.trim()&&(h+=`${_}
219
- `)}h+=`
218
+ `:E.includes("Example:")||E.trim()&&(d+=`${E}
219
+ `)}d+=`
220
220
  `;let D=o.description.split(`
221
- `).find(E=>E.includes("Example:"));if(D&&!o.isCommandGroup&&(h+=`**Example:**
221
+ `).find(C=>C.includes("Example:"));if(D&&!o.isCommandGroup&&(d+=`**Example:**
222
222
 
223
- `,h+="```bash\n",h+=`${D.replace("Example: ","")}
224
- `,h+="```\n\n"),o.options.length>0){i?h+=`**Options:**
223
+ `,d+="```bash\n",d+=`${D.replace("Example: ","")}
224
+ `,d+="```\n\n"),o.options.length>0){i?d+=`**Options:**
225
225
 
226
- `:h+=`## <a id="options"></a> Options
226
+ `:d+=`## <a id="options"></a> Options
227
227
 
228
- `,h+=`| Param | Type | Description |
229
- `,h+=`| -------------- | ------------- | -------------------- |
230
- `;for(let E of o.options){let _=E.flags.split(" ")[0],g=E.flags.split(" ").length>1?"string":"boolean";h+=`| **${_}** | <code>${g}</code> | ${E.description} |
231
- `}h+=`
232
- `}return h};if(e){(0,Jr.existsSync)(e)||(0,Jr.mkdirSync)(e,{recursive:!0});for(let o of r){if(o.name==="generate-docs")return;let s=`---
233
- title: ${LD(o.name)} ${o.name}
228
+ `,d+=`| Param | Type | Description |
229
+ `,d+=`| -------------- | ------------- | -------------------- |
230
+ `;for(let C of o.options){let E=C.flags.split(" ")[0],g=C.flags.split(" ").length>1?"string":"boolean";d+=`| **${E}** | <code>${g}</code> | ${C.description} |
231
+ `}d+=`
232
+ `}return d};if(e){(0,Ur.existsSync)(e)||(0,Ur.mkdirSync)(e,{recursive:!0});for(let o of r){if(o.name==="generate-docs")return;let a=`---
233
+ title: ${Mg(o.name)} ${o.name}
234
234
  description: ${o.description.split(`
235
235
  `)[0]}
236
236
  sidebar_label: ${o.name}
@@ -238,157 +238,157 @@ sidebar:
238
238
  order: ${r.indexOf(o)+1}
239
239
  ---
240
240
 
241
- `,a=o.description.split(`
242
- `)[0];s+=`${a}
241
+ `,s=o.description.split(`
242
+ `)[0];a+=`${s}
243
243
 
244
- `;let u="";if(o.subcommands.length===0)u=n(o,!1,o.name,!0);else for(let c of o.subcommands)u+=n(c,!0,o.name);s+=u;try{(0,Jr.writeFileSync)(`${e}/${o.name}.mdx`,s,"utf8"),p.success(`Generated documentation file for ${o.name} command in ${e}/${o.name}.mdx`)}catch(c){console.error(`Error generating file for ${o.name}:`,c)}}p.success(`Documentation files generated in ${e}/`)}else{let o=`## \u{1F4D1} Capgo CLI Commands
244
+ `;let u="";if(o.subcommands.length===0)u=n(o,!1,o.name,!0);else for(let c of o.subcommands)u+=n(c,!0,o.name);a+=u;try{(0,Ur.writeFileSync)(`${e}/${o.name}.mdx`,a,"utf8"),p.success(`Generated documentation file for ${o.name} command in ${e}/${o.name}.mdx`)}catch(c){console.error(`Error generating file for ${o.name}:`,c)}}p.success(`Documentation files generated in ${e}/`)}else{let o=`## \u{1F4D1} Capgo CLI Commands
245
245
 
246
246
  `;o+=`## \u{1F4CB} Table of Contents
247
247
 
248
- `;for(let l of r){if(l.name==="generate-docs")continue;let f=LD(l.name);if(o+=`- ${f} [${l.name.charAt(0).toUpperCase()+l.name.slice(1)}](#${l.name})
249
- `,l.subcommands.length>0)for(let h of l.subcommands)o+=` - [${h.name.charAt(0).toUpperCase()+h.name.slice(1)}](#${l.name}-${h.name})
248
+ `;for(let l of r){if(l.name==="generate-docs")continue;let f=Mg(l.name);if(o+=`- ${f} [${l.name.charAt(0).toUpperCase()+l.name.slice(1)}](#${l.name})
249
+ `,l.subcommands.length>0)for(let d of l.subcommands)o+=` - [${d.name.charAt(0).toUpperCase()+d.name.slice(1)}](#${l.name}-${d.name})
250
250
  `}o+=`
251
251
  `;for(let l of r)if(l.name!=="generate-docs"){if(o+=n(l,!1,void 0,!1),l.subcommands.length>0){l.isCommandGroup||(o+=`#### ${l.name.toUpperCase()} Subcommands:
252
252
 
253
253
  `);for(let f of l.subcommands)o+=n(f,!0,l.name)}o+=`
254
- `}let i="<!-- AUTO-GENERATED-DOCS-START -->",s="<!-- AUTO-GENERATED-DOCS-END -->",a="";try{a=(0,Jr.readFileSync)(t,"utf8")}catch{a=""}let u=a.indexOf(i),c=a.indexOf(s,u);if(u!==-1&&c!==-1){let l=a.substring(0,u+i.length),f=a.substring(c),h=`${l}
254
+ `}let i="<!-- AUTO-GENERATED-DOCS-START -->",a="<!-- AUTO-GENERATED-DOCS-END -->",s="";try{s=(0,Ur.readFileSync)(t,"utf8")}catch{s=""}let u=s.indexOf(i),c=s.indexOf(a,u);if(u!==-1&&c!==-1){let l=s.substring(0,u+i.length),f=s.substring(c),d=`${l}
255
255
  ${o}
256
- ${f}`;(0,Jr.writeFileSync)(t,h,"utf8"),p.success(`Documentation updated in ${t}`)}else(0,Jr.writeFileSync)(t,o,"utf8"),p.success(`Documentation written to ${t}`)}}var ws=require("node:child_process"),Te=require("node:fs"),Xn=require("node:path"),_e=require("node:process");var $f=be(_k());var qt=require("node:fs");function xk(t){return t.plugins??={},t.plugins.extConfig??={},t.plugins.CapacitorUpdater??={},t.plugins.CapacitorUpdater}async function bz(t,e=!1){e||ee("Save keys \u{1F511}");let r=await ne(),n=t.key||pn,o=t.keyData||"";if(!(0,qt.existsSync)(n)&&!o)throw e||p.error(`Cannot find a public key at ${n} or as keyData option or in ${r.path}`),new Error("Missing public key");if((0,qt.existsSync)(n)&&(o=(0,qt.readFileSync)(n,"utf8")),!o.startsWith("-----BEGIN RSA PUBLIC KEY-----"))throw e||p.error("The public key provided is not a valid RSA Public key"),new Error("Invalid RSA public key");if(r?.config){let i=xk(r.config);i.privateKey&&(delete i.privateKey,e||p.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await Ce({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||(p.success(`Public key saved into ${r.path} file in local directory`),p.success("Your app will decode the zip archive with this key")),!0}async function wz(t,e=!1){e||ee("Deleting old private key \u{1F5D1}\uFE0F");let r=await ne(),n=r?.config?.plugins?.CapacitorUpdater;if(n?.privateKey){if(delete n.privateKey,await Qi(r),(0,qt.existsSync)(os))try{(0,qt.unlinkSync)(os),e||p.success(`Old private key file deleted: ${os}`)}catch(o){e||p.error(`Failed to delete old private key file: ${os} (${String(o)})`)}if((0,qt.existsSync)(Ql))try{(0,qt.unlinkSync)(Ql),e||p.success(`Old public key file deleted: ${Ql}`)}catch(o){e||p.error(`Failed to delete old public key file: ${pn} (${String(o)})`)}return e||(p.success(`Old private key deleted from ${r.path} file`),Z("Done \u2705")),!0}return e||p.info("No old private key found in config file"),!1}async function Sk(t){await De(),await bz(t,!1)}async function Ak(t,e=!1){e||ee("Create keys \u{1F511}");let{publicKey:r,privateKey:n}=m2();if((0,qt.existsSync)(pn)&&!t.force)throw e||p.error("Public Key already exists, use --force to overwrite"),new Error("Public key already exists");if((0,qt.writeFileSync)(pn,r),(0,qt.existsSync)(tr)&&!t.force)throw e||p.error("Private Key already exists, use --force to overwrite"),new Error("Private key already exists");(0,qt.writeFileSync)(tr,n);let o=await ne();if(o){let i=xk(o.config);i.privateKey&&(delete i.privateKey,e||p.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await Ce({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)}return e||(p.success("Your RSA key has been generated"),p.success(`Private key saved in ${tr}`),p.success("This key will be used to encrypt your bundle before sending it to Capgo"),p.success("Keep it safe"),p.success("Then make it unreadable by Capgo and unmodifiable by anyone"),p.success(`Public key saved in ${o.path}`),p.success("Your app will be the only one having it"),p.success("Only your users can decrypt your update"),p.success("Only you can send them an update"),Z("Done \u2705")),!0}async function Fk(t,e=!0){return Ak(t,!e)}async function Ok(t){await De(),await Ak(t,!1)}async function kk(t){await De(),await wz(t,!1)}var bn=require("node:fs"),HD=require("node:os");function $k(){let t=(0,HD.homedir)();return(0,bn.existsSync)(`${t}/.capgo`)||(0,bn.existsSync)(".capgo")}async function VD(t,e,r=!1){if(r||ee("Login to Capgo"),!t)throw r||p.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");await De();let{local:n}=e;if(n){if(!(0,bn.existsSync)(".git"))throw r||p.error("To use local you should be in a git repository"),new Error("Not in a git repository");(0,bn.writeFileSync)(".capgo",`${t}
257
- `),(0,bn.appendFileSync)(".gitignore",`.capgo
258
- `)}else{let s=(0,HD.homedir)();(0,bn.writeFileSync)(`${s}/.capgo`,`${t}
259
- `)}let o=await ie(t,e.supaHost,e.supaAnon),i=await ae(o,t,["write","all","upload"]);await we(t,{channel:"user-login",event:"User CLI login",icon:"\u2705",user_id:i,notify:!1}).catch(),r||(p.success(`login saved into .capgo file in ${n?"local":"home"} directory`),Z("Done \u2705"))}async function Pk(t,e){await VD(t,e,!1)}var Tk="import { CapacitorUpdater } from '@capgo/capacitor-updater'",kf="CapacitorUpdater.notifyAppReady()",vz=/import.*from.*/g,Za="production",zD={stdio:"pipe"},Qa,Yn;function Rk(){Qa??=(0,Te.readdirSync)($f.default.tmpdir).map(t=>({name:t,full:`${$f.default.tmpdir}/${t}`})).find(t=>t.name.startsWith("capgocli"))?.full??$f.default.fileSync({prefix:"capgocli"}).name}function vr(t,e){try{Rk(),(0,Te.writeFileSync)(Qa,JSON.stringify(e?{step_done:t,pathToPackageJson:e}:{step_done:t,pathToPackageJson:Yn})),e&&(Yn=e)}catch(r){p.error(`Cannot mark step as done in the CLI, error:
260
- ${r}`),p.warn("Onboarding will continue but please report it to the capgo team!")}}async function Ez(t,e){try{Rk();let r=(0,Te.readFileSync)(Qa,"utf-8");if(!r||r.length===0)return;let{step_done:n,pathToPackageJson:o}=JSON.parse(r);p.info(`You have already got to the step ${n}/10 in the previous session`);let i=await Ce({message:"Would you like to continue from where you left off?"});return await Zt(i,t,e),i?(o&&(Yn=o),n):void 0}catch(r){p.error(`Cannot read which steps have been compleated, error:
261
- ${r}`),p.warn("Onboarding will continue but please report it to the capgo team!");return}}function Cz(){if(Qa)try{(0,Te.rmSync)(Qa)}catch(t){p.error(`Cannot delete the tmp steps file.
262
- Error: ${t}`)}}async function Zt(t,e,r){Ee(t)&&(await Gr("onboarding-v2",e,r,"canceled","\u{1F937}"),(0,_e.exit)())}async function Er(t,e,r,n){return Gr("onboarding-v2",t,e,`onboarding-step-${r}`,n)}async function _z(t,e,r,n){let o=ht(),i=await Ce({message:`Add ${r} in Capgo?`});if(await Zt(i,t.gid,e),i){let s=Se();s.start(`Running: ${o.runner} @capgo/cli@latest app add ${r}`),await sD(r,n,t,!0)?s.stop("App add Done \u2705"):s.stop("App already add \u2705")}else p.info(`If you change your mind, run it for yourself with: "${o.runner} @capgo/cli@latest app add ${r}"`);await Er(t.gid,e,"add-app",r)}async function xz(t,e,r){let n=ht(),o=await Ce({message:`Create default channel ${Za} for ${r} in Capgo?`});if(await Zt(o,t,e),o){let i=Se();i.start(`Running: ${n.runner} @capgo/cli@latest channel add ${Za} ${r} --default`),await ND(Za,r,{default:!0,apikey:e},!0)?i.stop("Channel add Done \u2705"):i.stop("Channel already added \u2705")}else p.info(`If you change your mind, run it for yourself with: "${n.runner} @capgo/cli@latest channel add ${Za} ${r} --default"`);await Er(t,e,"add-channel",r)}async function Sz(t){let e=(0,Xn.join)(St((0,_e.cwd)()),xt),r=Yn?await dt(void 0,Yn):await dt(void 0,e);if(r.size===0||!r.has("@capacitor/core")){p.warn("No adequate dependencies found");let n=await Ce({message:"Would you like to select the package.json file manually?"});if(Ee(n)&&(Zn("Operation cancelled."),(0,_e.exit)(1)),n){let o=await Ce({message:"Would you like to use a tree selector to choose the package.json file?"});if(Ee(o)&&(Zn("Operation cancelled."),(0,_e.exit)(1)),o){let s=(0,_e.cwd)(),a=xt;for(;;){let u=(0,Te.readdirSync)(s).map(c=>({value:c,label:c}));if(u.push({value:"..",label:".."}),a=await Sr({message:"Select package.json file:",options:u}),Ee(a)&&(Zn("Operation cancelled."),(0,_e.exit)(1)),!(0,Te.statSync)((0,Xn.join)(s,a)).isDirectory()&&a!==xt){p.error("Selected a file that is not a package.json file");continue}if(s=(0,Xn.join)(s,a),a===xt)break}return await vr(t,s),{dependencies:await dt(void 0,s),path:s}}let i=await xr({message:"Enter path to node_modules folder:"});return Ee(i)&&(Zn("Operation cancelled."),(0,_e.exit)(1)),(0,Te.existsSync)(i)||(p.error(`Path ${i} does not exist`),(0,_e.exit)(1)),{dependencies:await dt(void 0,i),path:i}}}return await vr(t,e),{dependencies:await dt(void 0,e),path:e}}var Az="https://capacitorjs.com/docs/updating/6-0",Fz="https://capacitorjs.com/docs/updating/7-0";async function Oz(t,e,r){let n=ht(),o="1.0.0",i=!1,s=await Ce({message:`Automatic Install "@capgo/capacitor-updater" dependency in ${r}?`});if(await Zt(s,t,e),s){let a=Se(),u="latest",{dependencies:c,path:l}=await Sz(3);a.start("Checking if @capgo/capacitor-updater is installed"),c.has("@capacitor/core")||(a.stop("Error"),p.warn("Cannot find @capacitor/core in package.json"),Z("Bye \u{1F44B}"),(0,_e.exit)());let f=c.get("@capacitor/core");if(f||(a.stop("Error"),p.warn("Cannot find @capacitor/core in package.json, please run `capgo init` in a capacitor project"),Z("Bye \u{1F44B}"),(0,_e.exit)()),f==="latest"?(a.stop(`@capacitor/core version is ${f}, make sure to use a proper version, using Latest as value is not recommended and will lead to unexpected behavior`),Z("Bye \u{1F44B}"),(0,_e.exit)()):Qn(Ae(f),Ae("6.0.0"))?(a.stop("Error"),p.warn(`@capacitor/core version is ${f}, Capgo only support 2 last Capacitor versions, please update to Capacitor v6 minimum: ${Az}`),Z("Bye \u{1F44B}"),(0,_e.exit)()):Qn(Ae(f),Ae("7.0.0"))&&(a.stop(`@capacitor/core version is ${f}, update to Capacitor v7 minimum: ${Fz} to support latest Mobile OS versions`),u="^6.0.0"),n.pm==="unknown"&&(a.stop("Error"),p.warn("Cannot reconize package manager, please run `capgo init` in a capacitor project with npm, pnpm, bun or yarn"),Z("Bye \u{1F44B}"),(0,_e.exit)()),c.get("@capgo/capacitor-updater"))a.stop("Capgo already installed \u2705");else{await(0,ws.execSync)(`${n.installCommand} --force @capgo/capacitor-updater@${u}`,{...zD,cwd:l.replace("/package.json","")}),a.stop("Install Done \u2705"),o=Rr(void 0,l)||"1.0.0";let h=!1;u==="latest"&&(h=await Ce({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 Zt(h,t,e)),a.start("Updating config file"),i=!!h;let d=h?{directUpdate:"always",autoSplashscreen:!0}:{};h&&await eD("SplashScreen",{launchAutoHide:!1}),await ja({version:o,appId:r,autoUpdate:!0,...d}),a.stop("Config file updated \u2705")}}else p.info(`If you change your mind, run it for yourself with: "${n.installCommand} @capgo/capacitor-updater@latest"`);return await Er(t,e,"add-updater",r),{pkgVersion:o,delta:i}}async function kz(t,e,r){let n=await Ce({message:`Automatic Add "${kf}" code and import in ${r}?`});if(await Zt(n,t,e),n){let o=Se();o.start("Adding @capacitor-updater to your main file");let i=await tf();if(i==="nuxtjs-js"||i==="nuxtjs-ts"){let s=(0,Xn.join)("plugins");(0,Te.existsSync)(s)||(0,Te.mkdirSync)(s,{recursive:!0});let a;i==="nuxtjs-ts"?a=(0,Xn.join)(s,"capacitorUpdater.client.ts"):a=(0,Xn.join)(s,"capacitorUpdater.client.js");let u=`
256
+ ${f}`;(0,Ur.writeFileSync)(t,d,"utf8"),p.success(`Documentation updated in ${t}`)}else(0,Ur.writeFileSync)(t,o,"utf8"),p.success(`Documentation written to ${t}`)}}var sa=require("node:child_process"),ke=require("node:fs"),Nn=require("node:path"),we=require("node:process");var Zl=ge(UF());var It=require("node:fs");function MF(t){return t.plugins??={},t.plugins.extConfig??={},t.plugins.CapacitorUpdater??={},t.plugins.CapacitorUpdater}async function h9(t,e=!1){e||Z("Save keys \u{1F511}");let r=await te(),n=t.key||tn,o=t.keyData||"";if(!(0,It.existsSync)(n)&&!o)throw e||p.error(`Cannot find a public key at ${n} or as keyData option or in ${r.path}`),new Error("Missing public key");if((0,It.existsSync)(n)&&(o=(0,It.readFileSync)(n,"utf8")),!o.startsWith("-----BEGIN RSA PUBLIC KEY-----"))throw e||p.error("The public key provided is not a valid RSA Public key"),new Error("Invalid RSA public key");if(r?.config){let i=MF(r.config);i.privateKey&&(delete i.privateKey,e||p.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await ve({message:"Do you want to setup encryption with the new channel in order to support old apps and facilitate the migration?"}))&&(i.defaultChannel="encryption_v2")),i.publicKey=o,await Ui(r)}return e||(p.success(`Public key saved into ${r.path} file in local directory`),p.success("Your app will decode the zip archive with this key")),!0}async function m9(t,e=!1){e||Z("Deleting old private key \u{1F5D1}\uFE0F");let r=await te(),n=r?.config?.plugins?.CapacitorUpdater;if(n?.privateKey){if(delete n.privateKey,await Ui(r),(0,It.existsSync)(zi))try{(0,It.unlinkSync)(zi),e||p.success(`Old private key file deleted: ${zi}`)}catch(o){e||p.error(`Failed to delete old private key file: ${zi} (${String(o)})`)}if((0,It.existsSync)(wl))try{(0,It.unlinkSync)(wl),e||p.success(`Old public key file deleted: ${wl}`)}catch(o){e||p.error(`Failed to delete old public key file: ${tn} (${String(o)})`)}return e||(p.success(`Old private key deleted from ${r.path} file`),J("Done \u2705")),!0}return e||p.info("No old private key found in config file"),!1}async function qF(t){await he(),await h9(t,!1)}async function HF(t,e=!1){e||Z("Create keys \u{1F511}");let{publicKey:r,privateKey:n}=$2();if((0,It.existsSync)(tn)&&!t.force)throw e||p.error("Public Key already exists, use --force to overwrite"),new Error("Public key already exists");if((0,It.writeFileSync)(tn,r),(0,It.existsSync)(Wt)&&!t.force)throw e||p.error("Private Key already exists, use --force to overwrite"),new Error("Private key already exists");(0,It.writeFileSync)(Wt,n);let o=await te();if(o){let i=MF(o.config);i.privateKey&&(delete i.privateKey,e||p.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await ve({message:"Do you want to setup encryption with the new channel in order to support old apps and facilitate the migration?"}))&&(i.defaultChannel="encryption_v2")),i.publicKey=r,await Ui(o)}return e||(p.success("Your RSA key has been generated"),p.success(`Private key saved in ${Wt}`),p.success("This key will be used to encrypt your bundle before sending it to Capgo"),p.success("Keep it safe"),p.success("Then make it unreadable by Capgo and unmodifiable by anyone"),p.success(`Public key saved in ${o.path}`),p.success("Your app will be the only one having it"),p.success("Only your users can decrypt your update"),p.success("Only you can send them an update"),J("Done \u2705")),!0}async function VF(t,e=!0){return HF(t,!e)}async function zF(t){await he(),await HF(t,!1)}async function GF(t){await he(),await m9(t,!1)}var cn=require("node:fs"),Gg=require("node:os");function WF(){let t=(0,Gg.homedir)();return(0,cn.existsSync)(`${t}/.capgo`)||(0,cn.existsSync)(".capgo")}async function Wg(t,e,r=!1){if(r||Z("Login to Capgo"),!t)throw r||p.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");await he();let{local:n}=e;if(n){if(!(0,cn.existsSync)(".git"))throw r||p.error("To use local you should be in a git repository"),new Error("Not in a git repository");(0,cn.writeFileSync)(".capgo",`${t}
257
+ `),(0,cn.appendFileSync)(".gitignore",`.capgo
258
+ `)}else{let a=(0,Gg.homedir)();(0,cn.writeFileSync)(`${a}/.capgo`,`${t}
259
+ `)}let o=await ne(t,e.supaHost,e.supaAnon),i=await oe(o,t,["write","all","upload"]);await De(t,{channel:"user-login",event:"User CLI login",icon:"\u2705",user_id:i,notify:!1}).catch(),r||(p.success(`login saved into .capgo file in ${n?"local":"home"} directory`),J("Done \u2705"))}async function KF(t,e){await Wg(t,e,!1)}var YF="import { CapacitorUpdater } from '@capgo/capacitor-updater'",Xl="CapacitorUpdater.notifyAppReady()",g9=/import.*from.*/g,Ps="production",Kg={stdio:"pipe"},Ts,Ln;function JF(){Ts??=(0,ke.readdirSync)(Zl.default.tmpdir).map(t=>({name:t,full:`${Zl.default.tmpdir}/${t}`})).find(t=>t.name.startsWith("capgocli"))?.full??Zl.default.fileSync({prefix:"capgocli"}).name}function fr(t,e){try{JF(),(0,ke.writeFileSync)(Ts,JSON.stringify(e?{step_done:t,pathToPackageJson:e}:{step_done:t,pathToPackageJson:Ln})),e&&(Ln=e)}catch(r){p.error(`Cannot mark step as done in the CLI, error:
260
+ ${r}`),p.warn("Onboarding will continue but please report it to the capgo team!")}}async function D9(t,e){try{JF();let r=(0,ke.readFileSync)(Ts,"utf-8");if(!r||r.length===0)return;let{step_done:n,pathToPackageJson:o}=JSON.parse(r);p.info(`You have already got to the step ${n}/10 in the previous session`);let i=await ve({message:"Would you like to continue from where you left off?"});return await Vt(i,t,e),i?(o&&(Ln=o),n):void 0}catch(r){p.error(`Cannot read which steps have been compleated, error:
261
+ ${r}`),p.warn("Onboarding will continue but please report it to the capgo team!");return}}function y9(){if(Ts)try{(0,ke.rmSync)(Ts)}catch(t){p.error(`Cannot delete the tmp steps file.
262
+ Error: ${t}`)}}async function Vt(t,e,r){be(t)&&(await Rr("onboarding-v2",e,r,"canceled","\u{1F937}"),(0,we.exit)())}async function pr(t,e,r,n){return Rr("onboarding-v2",t,e,`onboarding-step-${r}`,n)}async function b9(t,e,r,n){let o=lt(),i=await ve({message:`Add ${r} in Capgo?`});if(await Vt(i,t.gid,e),i){let a=Ee();a.start(`Running: ${o.runner} @capgo/cli@latest app add ${r}`),await cg(r,n,t,!0)?a.stop("App add Done \u2705"):a.stop("App already add \u2705")}else p.info(`If you change your mind, run it for yourself with: "${o.runner} @capgo/cli@latest app add ${r}"`);await pr(t.gid,e,"add-app",r)}async function v9(t,e,r){let n=lt(),o=await ve({message:`Create default channel ${Ps} for ${r} in Capgo?`});if(await Vt(o,t,e),o){let i=Ee();i.start(`Running: ${n.runner} @capgo/cli@latest channel add ${Ps} ${r} --default`),await Ug(Ps,r,{default:!0,apikey:e},!0)?i.stop("Channel add Done \u2705"):i.stop("Channel already added \u2705")}else p.info(`If you change your mind, run it for yourself with: "${n.runner} @capgo/cli@latest channel add ${Ps} ${r} --default"`);await pr(t,e,"add-channel",r)}async function w9(t){let e=(0,Nn.join)(vt((0,we.cwd)()),bt),r=Ln?await ct(void 0,Ln):await ct(void 0,e);if(r.size===0||!r.has("@capacitor/core")){p.warn("No adequate dependencies found");let n=await ve({message:"Would you like to select the package.json file manually?"});if(be(n)&&(Mn("Operation cancelled."),(0,we.exit)(1)),n){let o=await ve({message:"Would you like to use a tree selector to choose the package.json file?"});if(be(o)&&(Mn("Operation cancelled."),(0,we.exit)(1)),o){let a=(0,we.cwd)(),s=bt;for(;;){let u=(0,ke.readdirSync)(a).map(c=>({value:c,label:c}));if(u.push({value:"..",label:".."}),s=await gr({message:"Select package.json file:",options:u}),be(s)&&(Mn("Operation cancelled."),(0,we.exit)(1)),!(0,ke.statSync)((0,Nn.join)(a,s)).isDirectory()&&s!==bt){p.error("Selected a file that is not a package.json file");continue}if(a=(0,Nn.join)(a,s),s===bt)break}return await fr(t,a),{dependencies:await ct(void 0,a),path:a}}let i=await mr({message:"Enter path to node_modules folder:"});return be(i)&&(Mn("Operation cancelled."),(0,we.exit)(1)),(0,ke.existsSync)(i)||(p.error(`Path ${i} does not exist`),(0,we.exit)(1)),{dependencies:await ct(void 0,i),path:i}}}return await fr(t,e),{dependencies:await ct(void 0,e),path:e}}var C9="https://capacitorjs.com/docs/updating/6-0",E9="https://capacitorjs.com/docs/updating/7-0";async function _9(t,e,r){let n=lt(),o="1.0.0",i=!1,a=await ve({message:`Automatic Install "@capgo/capacitor-updater" dependency in ${r}?`});if(await Vt(a,t,e),a){let s=Ee(),u="latest",{dependencies:c,path:l}=await w9(3);s.start("Checking if @capgo/capacitor-updater is installed"),c.has("@capacitor/core")||(s.stop("Error"),p.warn("Cannot find @capacitor/core in package.json"),J("Bye \u{1F44B}"),(0,we.exit)());let f=c.get("@capacitor/core");if(f||(s.stop("Error"),p.warn("Cannot find @capacitor/core in package.json, please run `capgo init` in a capacitor project"),J("Bye \u{1F44B}"),(0,we.exit)()),f==="latest"?(s.stop(`@capacitor/core version is ${f}, make sure to use a proper version, using Latest as value is not recommended and will lead to unexpected behavior`),J("Bye \u{1F44B}"),(0,we.exit)()):qn(_e(f),_e("6.0.0"))?(s.stop("Error"),p.warn(`@capacitor/core version is ${f}, Capgo only support 2 last Capacitor versions, please update to Capacitor v6 minimum: ${C9}`),J("Bye \u{1F44B}"),(0,we.exit)()):qn(_e(f),_e("7.0.0"))&&(s.stop(`@capacitor/core version is ${f}, update to Capacitor v7 minimum: ${E9} to support latest Mobile OS versions`),u="^6.0.0"),n.pm==="unknown"&&(s.stop("Error"),p.warn("Cannot reconize package manager, please run `capgo init` in a capacitor project with npm, pnpm, bun or yarn"),J("Bye \u{1F44B}"),(0,we.exit)()),c.get("@capgo/capacitor-updater"))s.stop("Capgo already installed \u2705");else{await(0,sa.execSync)(`${n.installCommand} --force @capgo/capacitor-updater@${u}`,{...Kg,cwd:l.replace("/package.json","")}),s.stop("Install Done \u2705"),o=_r(void 0,l)||"1.0.0";let d=!1;u==="latest"&&(d=await ve({message:`Do you want to set instant updates in ${r}? Read more about it here: https://capgo.app/docs/live-updates/update-behavior/#applying-updates-immediately`}),await Vt(d,t,e)),s.start("Updating config file"),i=!!d;let h=d?{directUpdate:"always",autoSplashscreen:!0}:{};d&&await ng("SplashScreen",{launchAutoHide:!1}),await bs({version:o,appId:r,autoUpdate:!0,...h}),s.stop("Config file updated \u2705")}}else p.info(`If you change your mind, run it for yourself with: "${n.installCommand} @capgo/capacitor-updater@latest"`);return await pr(t,e,"add-updater",r),{pkgVersion:o,delta:i}}async function x9(t,e,r){let n=await ve({message:`Automatic Add "${Xl}" code and import in ${r}?`});if(await Vt(n,t,e),n){let o=Ee();o.start("Adding @capacitor-updater to your main file");let i=await El();if(i==="nuxtjs-js"||i==="nuxtjs-ts"){let a=(0,Nn.join)("plugins");(0,ke.existsSync)(a)||(0,ke.mkdirSync)(a,{recursive:!0});let s;i==="nuxtjs-ts"?s=(0,Nn.join)(a,"capacitorUpdater.client.ts"):s=(0,Nn.join)(a,"capacitorUpdater.client.js");let u=`
263
263
  import { CapacitorUpdater } from '@capgo/capacitor-updater'
264
264
 
265
265
  export default defineNuxtPlugin(() => {
266
266
  CapacitorUpdater.notifyAppReady()
267
267
  })
268
- `;(0,Te.existsSync)(a)?(0,Te.readFileSync)(a,"utf8").includes("CapacitorUpdater.notifyAppReady()")?(o.stop("Code already added to capacitorUpdater.client.ts file inside plugins directory \u2705"),p.info("Plugins directory and capacitorUpdater.client.ts file already exist with required code")):((0,Te.writeFileSync)(a,u,"utf8"),o.stop("Code added to capacitorUpdater.client.ts file inside plugins directory \u2705"),p.info("Updated capacitorUpdater.client.ts file with required code")):((0,Te.writeFileSync)(a,u,"utf8"),o.stop("Code added to capacitorUpdater.client.ts file inside plugins directory \u2705"),p.info("Created plugins directory and capacitorUpdater.client.ts file"))}else{let s;if(i==="unknown")s=await IF();else{let f=i.endsWith("-ts");s=await RF(i,f)}if(!s||!(0,Te.existsSync)(s)){o.stop("Cannot find main file to install Updater plugin");let f=await xr({message:"Provide the correct relative path to your main file (JS or TS):",validate:h=>{if(!(0,Te.existsSync)(h))return"File does not exist. Please provide a valid path."}});Ee(f)&&(Zn("Operation cancelled."),(0,_e.exit)(1)),s=f}let u=(0,Te.readFileSync)(s,"utf8").toString(),l=u.match(vz)?.pop();if(l||(o.stop("Error"),p.warn("Cannot find import line in main file, use manual installation: https://capgo.app/docs/getting-started/add-an-app/"),Z("Bye \u{1F44B}"),(0,_e.exit)()),u.includes(kf))o.stop(`Code already added to ${s} \u2705`);else{let f=u.replace(l,`${l}
269
- ${Tk};
268
+ `;(0,ke.existsSync)(s)?(0,ke.readFileSync)(s,"utf8").includes("CapacitorUpdater.notifyAppReady()")?(o.stop("Code already added to capacitorUpdater.client.ts file inside plugins directory \u2705"),p.info("Plugins directory and capacitorUpdater.client.ts file already exist with required code")):((0,ke.writeFileSync)(s,u,"utf8"),o.stop("Code added to capacitorUpdater.client.ts file inside plugins directory \u2705"),p.info("Updated capacitorUpdater.client.ts file with required code")):((0,ke.writeFileSync)(s,u,"utf8"),o.stop("Code added to capacitorUpdater.client.ts file inside plugins directory \u2705"),p.info("Created plugins directory and capacitorUpdater.client.ts file"))}else{let a;if(i==="unknown")a=await X1();else{let f=i.endsWith("-ts");a=await J1(i,f)}if(!a||!(0,ke.existsSync)(a)){o.stop("Cannot find main file to install Updater plugin");let f=await mr({message:"Provide the correct relative path to your main file (JS or TS):",validate:d=>{if(!(0,ke.existsSync)(d))return"File does not exist. Please provide a valid path."}});be(f)&&(Mn("Operation cancelled."),(0,we.exit)(1)),a=f}let u=(0,ke.readFileSync)(a,"utf8").toString(),l=u.match(g9)?.pop();if(l||(o.stop("Error"),p.warn("Cannot find import line in main file, use manual installation: https://capgo.app/docs/getting-started/add-an-app/"),J("Bye \u{1F44B}"),(0,we.exit)()),u.includes(Xl))o.stop(`Code already added to ${a} \u2705`);else{let f=u.replace(l,`${l}
269
+ ${YF};
270
270
 
271
- ${kf};
272
- `);(0,Te.writeFileSync)(s,f,"utf8"),o.stop(`Code added to ${s} \u2705`)}}await Er(t,e,"add-code",r)}else p.info(`Add to your main file the following code:
271
+ ${Xl};
272
+ `);(0,ke.writeFileSync)(a,f,"utf8"),o.stop(`Code added to ${a} \u2705`)}}await pr(t,e,"add-code",r)}else p.info(`Add to your main file the following code:
273
273
 
274
- ${Tk};
274
+ ${YF};
275
275
 
276
- ${kf};
277
- `)}async function $z(t,e,r){let o=(await dt()).get("@capacitor/core");o||p.warn("Cannot find @capacitor/core in package.json. It is likely that you are using a monorepo. Please NOTE that encryption is not supported in Capacitor V5.");let i=ht(),s=await Ce({message:`Automatic configure end-to-end encryption in ${r} updates?`});if(await Zt(s,t,e),s){if(o==="latest"){p.error(`@capacitor/core version is ${o}, make sure to use a proper version, using Latest as value is not recommended and will lead to unexpected behavior`);return}if(o&&Qn(Ae(o),Ae("6.0.0"))){p.warn("Encryption is not supported in Capacitor V5.");return}let a=Se();a.start(`Running: ${i.runner} @capgo/cli@latest key create`),await Fk({force:!0},!1)?a.stop("key created \u{1F511}"):(a.stop("Error"),p.warn("Cannot create key \u274C"),Z("Bye \u{1F44B}"),(0,_e.exit)(1)),Gr("onboarding-v2",t,e,"Use encryption v2",r)}await Er(t,e,"add-encryption",r)}async function Pz(t,e,r){let n=ht(),o=await Ce({message:`Automatic build ${r} with "${n.pm} run build" ?`});if(await Zt(o,t,e),o){let i=Se();i.start("Checking project type");let s=await tf(),a=await rD(s);i.message(`Running: ${n.pm} run ${a} && ${n.runner} cap sync`),Qg()[a]||(i.stop("Error"),p.warn(`Cannot find ${a} script in package.json, please add it and run \`capgo init\` again`),Z("Bye \u{1F44B}"),(0,_e.exit)()),(0,ws.execSync)(`${n.pm} run ${a} && ${n.runner} cap sync`,zD),i.stop("Build & Sync Done \u2705")}else p.info(`Build yourself with command: ${n.pm} run build && ${n.runner} cap sync`);await Er(t,e,"build-project",r)}async function Tz(t,e,r){let n=ht(),o=await Ce({message:`Run ${r} in device now to test the initial version?`});if(await Zt(o,t,e),o){let i=await Sr({message:"Pick a platform to run your app",options:[{value:"ios",label:"IOS"},{value:"android",label:"Android"}]});Ee(i)&&(Z("Bye \u{1F44B}"),(0,_e.exit)());let s=i,a=Se();a.start(`Running: ${n.runner} cap run ${s}`),await(0,ws.spawnSync)(n.runner,["cap","run",s],{stdio:"inherit"}),a.stop("App started \u2705"),p.info(`\u{1F4F1} Your app should now be running on your ${s} device with Capgo integrated`),p.info("\u{1F504} This is your baseline version - we'll create an update next")}else p.info(`If you change your mind, run it for yourself with: ${n.runner} cap run <ios|android>`);await Er(t,e,"run-device",r)}async function Rz(t,e,r,n){p.info("\u{1F3AF} Now let's test Capgo by making a visible change and deploying an update!");let o=await Sr({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(Ee(o)&&(await Gr("onboarding-v2",t,e,"canceled","\u{1F937}"),(0,_e.exit)()),o==="auto"){let l=Se();l.start("Making automatic changes to test Capgo updates");let f=!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 d of h)if((0,Te.existsSync)(d)&&!f)try{let m=(0,Te.readFileSync)(d,"utf8"),b=m;if(d.endsWith(".html")?m.includes("<body>")&&!m.includes("capgo-test-banner")&&(b=m.replace("<body>",`<body>
276
+ ${Xl};
277
+ `)}async function S9(t,e,r){let o=(await ct()).get("@capacitor/core");o||p.warn("Cannot find @capacitor/core in package.json. It is likely that you are using a monorepo. Please NOTE that encryption is not supported in Capacitor V5.");let i=lt(),a=await ve({message:`Automatic configure end-to-end encryption in ${r} updates?`});if(await Vt(a,t,e),a){if(o==="latest"){p.error(`@capacitor/core version is ${o}, make sure to use a proper version, using Latest as value is not recommended and will lead to unexpected behavior`);return}if(o&&qn(_e(o),_e("6.0.0"))){p.warn("Encryption is not supported in Capacitor V5.");return}let s=Ee();s.start(`Running: ${i.runner} @capgo/cli@latest key create`),await VF({force:!0},!1)?s.stop("key created \u{1F511}"):(s.stop("Error"),p.warn("Cannot create key \u274C"),J("Bye \u{1F44B}"),(0,we.exit)(1)),Rr("onboarding-v2",t,e,"Use encryption v2",r)}await pr(t,e,"add-encryption",r)}async function F9(t,e,r){let n=lt(),o=await ve({message:`Automatic build ${r} with "${n.pm} run build" ?`});if(await Vt(o,t,e),o){let i=Ee();i.start("Checking project type");let a=await El(),s=await ig(a);i.message(`Running: ${n.pm} run ${s} && ${n.runner} cap sync`),rg()[s]||(i.stop("Error"),p.warn(`Cannot find ${s} script in package.json, please add it and run \`capgo init\` again`),J("Bye \u{1F44B}"),(0,we.exit)()),(0,sa.execSync)(`${n.pm} run ${s} && ${n.runner} cap sync`,Kg),i.stop("Build & Sync Done \u2705")}else p.info(`Build yourself with command: ${n.pm} run build && ${n.runner} cap sync`);await pr(t,e,"build-project",r)}async function A9(t,e,r){let n=lt(),o=await ve({message:`Run ${r} in device now to test the initial version?`});if(await Vt(o,t,e),o){let i=await gr({message:"Pick a platform to run your app",options:[{value:"ios",label:"IOS"},{value:"android",label:"Android"}]});be(i)&&(J("Bye \u{1F44B}"),(0,we.exit)());let a=i,s=Ee();s.start(`Running: ${n.runner} cap run ${a}`),await(0,sa.spawnSync)(n.runner,["cap","run",a],{stdio:"inherit"}),s.stop("App started \u2705"),p.info(`\u{1F4F1} Your app should now be running on your ${a} device with Capgo integrated`),p.info("\u{1F504} This is your baseline version - we'll create an update next")}else p.info(`If you change your mind, run it for yourself with: ${n.runner} cap run <ios|android>`);await pr(t,e,"run-device",r)}async function O9(t,e,r,n){p.info("\u{1F3AF} Now let's test Capgo by making a visible change and deploying an update!");let o=await gr({message:"How would you like to test the update?",options:[{value:"auto",label:"Auto: Let Capgo CLI make a visible change for you"},{value:"manual",label:"Manual: I'll make changes myself"}]});if(be(o)&&(await Rr("onboarding-v2",t,e,"canceled","\u{1F937}"),(0,we.exit)()),o==="auto"){let l=Ee();l.start("Making automatic changes to test Capgo updates");let f=!1,d=["src/index.html","public/index.html","index.html","src/App.vue","src/app/app.component.html","src/app/home/home.page.html","src/main.css","src/style.css","public/style.css"];for(let h of d)if((0,ke.existsSync)(h)&&!f)try{let m=(0,ke.readFileSync)(h,"utf8"),b=m;if(h.endsWith(".html")?m.includes("<body>")&&!m.includes("capgo-test-banner")&&(b=m.replace("<body>",`<body>
278
278
  <div id="capgo-test-banner" style="background: linear-gradient(90deg, #4CAF50, #2196F3); color: white; padding: 15px; text-align: center; font-weight: bold; position: fixed; top: env(safe-area-inset-top, 0); left: env(safe-area-inset-left, 0); right: env(safe-area-inset-right, 0); z-index: 9999; box-shadow: 0 2px 10px rgba(0,0,0,0.1); padding-top: calc(15px + env(safe-area-inset-top, 0));">
279
279
  \u{1F680} Capgo Update Test - This banner shows the update worked!
280
280
  </div>
281
281
  <style>
282
282
  body { padding-top: calc(60px + env(safe-area-inset-top, 0)) !important; }
283
- </style>`)):d.endsWith(".vue")?m.includes("<template>")&&!m.includes("capgo-test-vue")&&(b=m.replace("<template>",`<template>
283
+ </style>`)):h.endsWith(".vue")?m.includes("<template>")&&!m.includes("capgo-test-vue")&&(b=m.replace("<template>",`<template>
284
284
  <div class="capgo-test-vue" style="background: linear-gradient(90deg, #4CAF50, #2196F3); color: white; padding: 15px; text-align: center; font-weight: bold; margin-bottom: 20px; padding-top: calc(15px + env(safe-area-inset-top, 0)); padding-left: calc(15px + env(safe-area-inset-left, 0)); padding-right: calc(15px + env(safe-area-inset-right, 0));">
285
285
  \u{1F680} Capgo Update Test - Vue component updated!
286
- </div>`)):d.endsWith(".css")&&(m.includes("capgo-test-background")||(b=`/* Capgo test modification - background change */
286
+ </div>`)):h.endsWith(".css")&&(m.includes("capgo-test-background")||(b=`/* Capgo test modification - background change */
287
287
  body {
288
288
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
289
289
  /* capgo-test-background */
290
290
  }
291
291
 
292
- ${m}`)),b!==m){(0,Te.writeFileSync)(d,b,"utf8"),l.stop(`\u2705 Made test changes to ${d}`),p.info("\u{1F4DD} Added visible test modification to verify the update works"),f=!0;break}}catch{}if(!f){l.stop("\u26A0\uFE0F Could not automatically modify files"),p.warn("Please make a visible change manually (like editing a text or color)");let d=await Ce({message:"Continue after making your changes?"});await Zt(d,t,e)}}else{p.info("\u270B Please make a visible change to your app now (example: change a text, color, or add an element)"),p.info("\u{1F4A1} This change will help you see that Capgo updates work correctly");let l=await Ce({message:"Have you made your changes and ready to continue?"});await Zt(l,t,e)}let i="1.0.1";try{let l=Ae(n);i=Fr(Os(l,"patch"))}catch{i="1.0.1"}let s=await Sr({message:"How do you want to handle the version for this update?",options:[{value:"auto",label:`Auto: Bump patch version (${n} \u2192 ${i})`},{value:"manual",label:"Manual: I'll provide the version number"}]});Ee(s)&&(await Gr("onboarding-v2",t,e,"canceled","\u{1F937}"),(0,_e.exit)());let a=n;if(s==="auto")try{let l=Ae(n);a=Fr(Os(l,"patch")),p.info(`\u{1F522} Auto-bumped version from ${n} to ${a}`)}catch{a="1.0.1",p.warn(`Could not parse version ${n}, using fallback ${a}`)}else{let l=await xr({message:`Current version is ${n}. Enter new version:`,validate:f=>{if(!f.match(/^\d+\.\d+\.\d+/))return"Please enter a valid version (x.y.z)"}});Ee(l)&&(await Gr("onboarding-v2",t,e,"canceled","\u{1F937}"),(0,_e.exit)()),a=l}let u=ht(),c=await Ce({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 Zt(c,t,e),c){let l=Se();l.start("Checking project type");let f=await tf(),h=await rD(f);l.message(`Running: ${u.pm} run ${h} && ${u.runner} cap sync`),Qg()[h]||(l.stop("Error"),p.warn(`Cannot find ${h} script in package.json, please add it and run \`capgo init\` again`),Z("Bye \u{1F44B}"),(0,_e.exit)()),(0,ws.execSync)(`${u.pm} run ${h} && ${u.runner} cap sync`,zD),l.stop("\u2705 Build with changes completed"),p.info("\u{1F4E6} Your modifications have been built and synced")}else p.info(`Build yourself with command: ${u.pm} run build && ${u.runner} cap sync`);return await Er(t,e,"add-code-change",r),a}async function Iz(t,e,r,n,o){let i=ht(),s=await Ce({message:`Upload the updated ${r} bundle (v${n}) to Capgo?`});if(await Zt(s,t,e),s){let a=Se(),u;a.start(`Running: ${i.runner} @capgo/cli@latest bundle upload ${o?"--delta-only":""}`);let c=xF((0,_e.cwd)());Yn&&c&&(p.warn("You are most likely using a monorepo, please provide the path to your package.json file AND node_modules path folder when uploading your bundle"),p.warn(`Example: ${i.runner} @capgo/cli@latest bundle upload --package-json ./packages/my-app/package.json --node-modules ./packages/my-app/node_modules ${o?"--delta-only":""}`),u=(0,Xn.join)(St((0,_e.cwd)()),"node_modules"),p.warn(`Guessed node modules path at: ${u}`),(0,Te.existsSync)(u)||(p.error("Node modules path does not exist, upload skipped"),Z("Bye \u{1F44B}"),(0,_e.exit)(1))),(await BD(r,{channel:Za,apikey:e,packageJson:c?Yn:void 0,nodeModules:c?u:void 0,deltaOnly:o,bundle:n},!1))?.success?(a.stop(`\u2705 Update v${n} uploaded successfully!`),p.info("\u{1F389} Your updated bundle is now available on Capgo")):(a.stop("Error"),p.warn("Upload failed \u274C"),Z("Bye \u{1F44B}"),(0,_e.exit)())}else p.info(`Upload yourself with command: ${i.runner} @capgo/cli@latest bundle upload`);await Er(t,e,"upload",r)}async function Bz(t,e,r,n,o){p.info("\u{1F9EA} Time to test the Capgo update system!"),p.info("\u{1F4F1} Go to your device where the app is running"),o?(p.info("\u{1F504} IMPORTANT: Background your app (swipe up/press home button) and then reopen it"),p.info("\u23F1\uFE0F The update should be downloaded and applied automatically")):(p.info("\u{1F4F1} With standard updates, you will need to:"),p.info(" 1. Background the app (swipe up/press home button) to start download"),p.info(" 2. Wait a few seconds for download to complete"),p.info(" 3. Background and foreground again to see the update")),p.info("\u{1F440} You should see your changes appear in the app!");let i=await Ce({message:"Monitor Capgo logs to verify the update worked?"});await Zt(i,t,e),i?(p.info(`\u{1F4CA} Watching logs from ${r}...`),p.info("\u{1F504} Please background and reopen your app now to trigger the update"),await aD("onboarding-v2",e,r,e,t)):p.info(`\u{1F4CA} Check logs manually at ${n}/app/p/${r}/logs to verify the update`),await Er(t,e,"test-update",r)}async function Ik(t,e,r){let n=ht();ee("Capgo onboarding \u{1F6EB}"),await De();let o=!r.supaAnon||!r.supaHost?await ne():await ja({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 Dr();e=ge(e,o?.config),r.apikey=t||ce(),e===void 0&&(e=await xr({message:"Enter your appId:"}),Ee(e)&&(Zn("Operation cancelled."),(0,_e.exit)(1)));let s=Se();(!$k()||t)&&(s.start(`Running: ${n.runner} @capgo/cli@latest login ***`),await VD(r.apikey,r,!1),s.stop("Login Done \u2705"));let a=await ie(r.apikey,r.supaHost,r.supaAnon);await ae(a,r.apikey,["upload","all","read","write"]);let u=await us(a,["admin","super_admin"]),c=u.gid,l=await Ez(c,r.apikey)??0,f=Rr(void 0,Yn)||"1.0.0",h=!1,d=f;try{if(l<1&&await Er(c,r.apikey,"add-app",e),l<2&&(await _z(u,r.apikey,e,r),vr(2)),l<3&&(await xz(c,r.apikey,e),vr(3)),l<4){let m=await Oz(c,r.apikey,e);f=m.pkgVersion,d=f,h=m.delta,vr(4)}l<5&&(await kz(c,r.apikey,e),vr(5)),l<6&&(await $z(c,r.apikey,e),vr(6)),l<7&&(await Pz(c,r.apikey,e),vr(7)),l<8&&(await Tz(c,r.apikey,e),vr(8)),l<9&&(d=await Rz(c,r.apikey,e,f),vr(9)),l<10&&(await Iz(c,r.apikey,e,d,h),vr(10)),l<11&&(await Bz(c,r.apikey,e,i.hostWeb,h),vr(11)),await Er(c,r.apikey,"done",e),Cz()}catch(m){console.error(m),p.error(`Error during onboarding.
292
+ ${m}`)),b!==m){(0,ke.writeFileSync)(h,b,"utf8"),l.stop(`\u2705 Made test changes to ${h}`),p.info("\u{1F4DD} Added visible test modification to verify the update works"),f=!0;break}}catch{}if(!f){l.stop("\u26A0\uFE0F Could not automatically modify files"),p.warn("Please make a visible change manually (like editing a text or color)");let h=await ve({message:"Continue after making your changes?"});await Vt(h,t,e)}}else{p.info("\u270B Please make a visible change to your app now (example: change a text, color, or add an element)"),p.info("\u{1F4A1} This change will help you see that Capgo updates work correctly");let l=await ve({message:"Have you made your changes and ready to continue?"});await Vt(l,t,e)}let i="1.0.1";try{let l=_e(n);i=yr(ga(l,"patch"))}catch{i="1.0.1"}let a=await gr({message:"How do you want to handle the version for this update?",options:[{value:"auto",label:`Auto: Bump patch version (${n} \u2192 ${i})`},{value:"manual",label:"Manual: I'll provide the version number"}]});be(a)&&(await Rr("onboarding-v2",t,e,"canceled","\u{1F937}"),(0,we.exit)());let s=n;if(a==="auto")try{let l=_e(n);s=yr(ga(l,"patch")),p.info(`\u{1F522} Auto-bumped version from ${n} to ${s}`)}catch{s="1.0.1",p.warn(`Could not parse version ${n}, using fallback ${s}`)}else{let l=await mr({message:`Current version is ${n}. Enter new version:`,validate:f=>{if(!f.match(/^\d+\.\d+\.\d+/))return"Please enter a valid version (x.y.z)"}});be(l)&&(await Rr("onboarding-v2",t,e,"canceled","\u{1F937}"),(0,we.exit)()),s=l}let u=lt(),c=await ve({message:`Build ${r} with changes before uploading? If you need to build yourself please do it now in other terminal, and then select no`});if(await Vt(c,t,e),c){let l=Ee();l.start("Checking project type");let f=await El(),d=await ig(f);l.message(`Running: ${u.pm} run ${d} && ${u.runner} cap sync`),rg()[d]||(l.stop("Error"),p.warn(`Cannot find ${d} script in package.json, please add it and run \`capgo init\` again`),J("Bye \u{1F44B}"),(0,we.exit)()),(0,sa.execSync)(`${u.pm} run ${d} && ${u.runner} cap sync`,Kg),l.stop("\u2705 Build with changes completed"),p.info("\u{1F4E6} Your modifications have been built and synced")}else p.info(`Build yourself with command: ${u.pm} run build && ${u.runner} cap sync`);return await pr(t,e,"add-code-change",r),s}async function k9(t,e,r,n,o){let i=lt(),a=await ve({message:`Upload the updated ${r} bundle (v${n}) to Capgo?`});if(await Vt(a,t,e),a){let s=Ee(),u;s.start(`Running: ${i.runner} @capgo/cli@latest bundle upload ${o?"--delta-only":""}`);let c=M1((0,we.cwd)());Ln&&c&&(p.warn("You are most likely using a monorepo, please provide the path to your package.json file AND node_modules path folder when uploading your bundle"),p.warn(`Example: ${i.runner} @capgo/cli@latest bundle upload --package-json ./packages/my-app/package.json --node-modules ./packages/my-app/node_modules ${o?"--delta-only":""}`),u=(0,Nn.join)(vt((0,we.cwd)()),"node_modules"),p.warn(`Guessed node modules path at: ${u}`),(0,ke.existsSync)(u)||(p.error("Node modules path does not exist, upload skipped"),J("Bye \u{1F44B}"),(0,we.exit)(1))),(await Lg(r,{channel:Ps,apikey:e,packageJson:c?Ln:void 0,nodeModules:c?u:void 0,deltaOnly:o,bundle:n},!1))?.success?(s.stop(`\u2705 Update v${n} uploaded successfully!`),p.info("\u{1F389} Your updated bundle is now available on Capgo")):(s.stop("Error"),p.warn("Upload failed \u274C"),J("Bye \u{1F44B}"),(0,we.exit)())}else p.info(`Upload yourself with command: ${i.runner} @capgo/cli@latest bundle upload`);await pr(t,e,"upload",r)}async function $9(t,e,r,n,o){p.info("\u{1F9EA} Time to test the Capgo update system!"),p.info("\u{1F4F1} Go to your device where the app is running"),o?(p.info("\u{1F504} IMPORTANT: Background your app (swipe up/press home button) and then reopen it"),p.info("\u23F1\uFE0F The update should be downloaded and applied automatically")):(p.info("\u{1F4F1} With standard updates, you will need to:"),p.info(" 1. Background the app (swipe up/press home button) to start download"),p.info(" 2. Wait a few seconds for download to complete"),p.info(" 3. Background and foreground again to see the update")),p.info("\u{1F440} You should see your changes appear in the app!");let i=await ve({message:"Monitor Capgo logs to verify the update worked?"});await Vt(i,t,e),i?(p.info(`\u{1F4CA} Watching logs from ${r}...`),p.info("\u{1F504} Please background and reopen your app now to trigger the update"),await lg("onboarding-v2",e,r,e,t)):p.info(`\u{1F4CA} Check logs manually at ${n}/app/p/${r}/logs to verify the update`),await pr(t,e,"test-update",r)}async function XF(t,e,r){let n=lt();Z("Capgo onboarding \u{1F6EB}"),await he();let o=!r.supaAnon||!r.supaHost?await te():await bs({statsUrl:`${r.supaHost}/functions/v1/stats`,channelUrl:`${r.supaHost}/functions/v1/channel_self`,updateUrl:`${r.supaHost}/functions/v1/updates`,localApiFiles:`${r.supaHost}/functions/v1`,localS3:!0,localSupa:r.supaHost,localSupaAnon:r.supaAnon}),i=await sr();e=de(e,o?.config),r.apikey=t||ae(),e===void 0&&(e=await mr({message:"Enter your appId:"}),be(e)&&(Mn("Operation cancelled."),(0,we.exit)(1)));let a=Ee();(!WF()||t)&&(a.start(`Running: ${n.runner} @capgo/cli@latest login ***`),await Wg(r.apikey,r,!1),a.stop("Login Done \u2705"));let s=await ne(r.apikey,r.supaHost,r.supaAnon);await oe(s,r.apikey,["upload","all","read","write"]);let u=await Yi(s,["admin","super_admin"]),c=u.gid,l=await D9(c,r.apikey)??0,f=_r(void 0,Ln)||"1.0.0",d=!1,h=f;try{if(l<1&&await pr(c,r.apikey,"add-app",e),l<2&&(await b9(u,r.apikey,e,r),fr(2)),l<3&&(await v9(c,r.apikey,e),fr(3)),l<4){let m=await _9(c,r.apikey,e);f=m.pkgVersion,h=f,d=m.delta,fr(4)}l<5&&(await x9(c,r.apikey,e),fr(5)),l<6&&(await S9(c,r.apikey,e),fr(6)),l<7&&(await F9(c,r.apikey,e),fr(7)),l<8&&(await A9(c,r.apikey,e),fr(8)),l<9&&(h=await O9(c,r.apikey,e,f),fr(9)),l<10&&(await k9(c,r.apikey,e,h,d),fr(10)),l<11&&(await $9(c,r.apikey,e,i.hostWeb,d),fr(11)),await pr(c,r.apikey,"done",e),y9()}catch(m){console.error(m),p.error(`Error during onboarding.
293
293
  if the error persists please contact support@capgo.app
294
- Or use manual installation: https://capgo.app/docs/getting-started/add-an-app/`),(0,_e.exit)(1)}p.info("Welcome onboard \u2708\uFE0F!"),p.info("Your Capgo update system is setup"),p.info(`Next time use \`${n.runner} @capgo/cli@latest bundle upload\` to only upload your bundle`),p.info(`If you have any issue try to use the debug command \`${n.runner} @capgo/cli@latest app debug\``),Z("Bye \u{1F44B}"),(0,_e.exit)()}async function Nz(t,e=!1){e||ee("Adding organization"),await De();let r={...t,apikey:t.apikey||ce()};if(!r.apikey)throw e||p.error("Missing API key, you need to provide an API key to add an organization"),new Error("Missing API key");let n=await ie(r.apikey,r.supaHost,r.supaAnon),o=await ae(n,r.apikey,["write","all"]),{name:i,email:s}=r;if(!e&&!i){let c=await xr({message:"Organization name:",placeholder:"My Organization"});if(Ee(c))throw p.error("Canceled adding organization"),new Error("Organization creation cancelled");i=c}if(!e&&!s){let c=await xr({message:"Management email:",placeholder:"admin@example.com"});if(Ee(c))throw p.error("Canceled adding organization"),new Error("Organization creation cancelled");s=c}if(!i||!s)throw e||p.error("Missing arguments, you need to provide an organization name and management email"),new Error("Missing organization name or management email");e||p.info(`Adding organization "${i}" to Capgo`);let{data:a,error:u}=await n.from("orgs").insert({name:i,management_email:s,created_by:o}).select().single();if(u)throw e||p.error(`Could not add organization ${j(u)}`),new Error(`Could not add organization: ${j(u)}`);return await we(r.apikey,{channel:"organization",event:"Organization Created",icon:"\u{1F3E2}",user_id:a.id,tags:{"org-name":i},notify:!1}).catch(()=>{}),e||(p.success(`Organization "${i}" added to Capgo`),Z("Done \u2705")),a}async function GD(t){await Nz(t,!1)}async function Lz(t,e,r=!1){r||ee("Deleting organization"),await De();let n={...e,apikey:e.apikey||ce()};if(!n.apikey)throw r||p.error("Missing API key, you need to provide an API key to delete an organization"),new Error("Missing API key");if(!t)throw r||p.error("Missing argument, you need to provide an organization ID"),new Error("Missing organization id");let o=await ie(n.apikey,n.supaHost,n.supaAnon),i=await ae(o,n.apikey,["write","all"]),{data:s,error:a}=await o.from("orgs").select("created_by, name").eq("id",t).single();if(a||!s)throw r||p.error(`Cannot get organization details ${j(a)}`),new Error(`Cannot get organization details: ${j(a)}`);if(s.created_by!==i){if(r)throw new Error("Deleting an organization is restricted to the organization owner");p.warn("Deleting an organization is restricted to the organization owner"),p.warn("You are not the owner of this organization"),p.warn("It's strongly recommended that you do not continue!");let c=await Sr({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(Ee(c)||c==="no")throw p.error("Canceled deleting the organization"),new Error("Organization deletion cancelled")}if(!r&&!n.autoConfirm){let c=await Ce({message:`Are you sure you want to delete organization "${s.name}"? This action cannot be undone.`});if(Ee(c)||!c)throw p.error("Canceled deleting the organization"),new Error("Organization deletion cancelled")}r||p.info(`Deleting organization "${s.name}"`);let{error:u}=await o.from("orgs").delete().eq("id",t);if(u)throw r||p.error(`Could not delete organization ${j(u)}`),new Error(`Could not delete organization: ${j(u)}`);return await we(n.apikey,{channel:"organization",event:"Organization Deleted",icon:"\u{1F5D1}\uFE0F",user_id:t,tags:{"org-name":s.name},notify:!1}).catch(()=>{}),r||(p.success(`Organization "${s.name}" deleted from Capgo`),Z("Done \u2705")),!0}async function WD(t,e){await Lz(t,e,!1)}function jz(t,e){if(e)return;if(!t.length){p.error("No organizations found");return}let r=new mt;r.headers=["Name","ID","Role","Apps"],r.rows=[];for(let n of t.toReversed())r.rows.push([n.name??"Unknown",n.gid,n.role,n.app_count?.toString()||"0"]);p.success("Organizations"),p.success(r.toString())}async function Uz(t,e=!1){e||ee("List organizations"),await De();let r={...t,apikey:t.apikey||ce()};if(!r.apikey)throw e||p.error("Missing API key, you need to provide an API key to list organizations"),new Error("Missing API key");let n=await ie(r.apikey,r.supaHost,r.supaAnon);await ae(n,r.apikey,["read","write","all"]),e||p.info("Getting organizations from Capgo");let{error:o,data:i}=await n.rpc("get_orgs_v6");if(o)throw e||p.error(`Cannot get organizations ${j(o)}`),new Error(`Cannot get organizations: ${j(o)}`);let s=i||[];return e||(p.info(`Organizations found: ${s.length}`),jz(s,e),Z("Done \u2705")),s}async function KD(t){await Uz(t,!1)}async function Mz(t,e,r=!1){r||ee("Updating organization"),await De();let n={...e,apikey:e.apikey||ce()};if(!n.apikey)throw r||p.error("Missing API key, you need to provide an API key to update an organization"),new Error("Missing API key");if(!t)throw r||p.error("Missing argument, you need to provide an organization ID"),new Error("Missing organization id");let o=await ie(n.apikey,n.supaHost,n.supaAnon);await ae(o,n.apikey,["write","all"]);let{data:i,error:s}=await o.from("orgs").select("name, management_email, created_by").eq("id",t).single();if(s||!i)throw r||p.error(`Cannot get organization details ${j(s)}`),new Error(`Cannot get organization details: ${j(s)}`);let{name:a,email:u}=n;if(!r&&!a){let l=await xr({message:"New organization name:",placeholder:i.name||"My Organization"});if(Ee(l))throw p.error("Canceled updating organization"),new Error("Organization update cancelled");a=l}if(!r&&!u){let l=await xr({message:"Management email:",placeholder:i.management_email||"admin@example.com"});if(Ee(l))throw p.error("Canceled updating organization"),new Error("Organization update cancelled");u=l}if(!a||!u)throw r||p.error("Missing arguments, you need to provide an organization name and management email"),new Error("Missing organization name or management email");r||p.info(`Updating organization "${t}"`);let{error:c}=await o.from("orgs").update({name:a,management_email:u}).eq("id",t);if(c)throw r||p.error(`Could not update organization ${j(c)}`),new Error(`Could not update organization: ${j(c)}`);return await we(n.apikey,{channel:"organization",event:"Organization Updated",icon:"\u270F\uFE0F",user_id:t,tags:{"org-name":a},notify:!1}).catch(()=>{}),r||(p.success("Organization updated"),Z("Done \u2705")),{orgId:t,name:a,email:u}}async function XD(t,e){await Mz(t,e,!1)}async function qz(t,e=!1){e||ee("Getting user id");let r={...t,apikey:t.apikey||ce()};if(!r.apikey)throw e||p.error("Missing API key, you need to provide an API key to fetch the user id"),new Error("Missing API key");try{let n=await ie(r.apikey,r.supaHost,r.supaAnon),o=await ae(n,r.apikey,["read","all","write"]);return e||Z(`Done \u2705: ${o}`),o}catch(n){throw e||p.error(`Error getting user id ${j(n)}`),n instanceof Error?n:new Error(String(n))}}async function Bk(t){await qz(t,!1)}var K={apikey:"API key to link to your account",supaHost:"Custom Supabase host URL (for self-hosting or Capgo development)",supaAnon:"Custom Supabase anon key (for self-hosting)",packageJson:"Paths to package.json files for monorepos (comma-separated)",nodeModules:"Paths to node_modules directories for monorepos (comma-separated)",verbose:"Enable verbose output"};gt.name(_r.name).description("\u{1F4E6} Manage packages and bundle versions in Capgo Cloud").version(_r.version,"-v, --version","output the current version");gt.command("init [apikey] [appId]").alias("i").description(`\u{1F680} Initialize a new app in Capgo Cloud with step-by-step guidance.
294
+ Or use manual installation: https://capgo.app/docs/getting-started/add-an-app/`),(0,we.exit)(1)}p.info("Welcome onboard \u2708\uFE0F!"),p.info("Your Capgo update system is setup"),p.info(`Next time use \`${n.runner} @capgo/cli@latest bundle upload\` to only upload your bundle`),p.info(`If you have any issue try to use the debug command \`${n.runner} @capgo/cli@latest app debug\``),J("Bye \u{1F44B}"),(0,we.exit)()}async function P9(t,e=!1){e||Z("Adding organization"),await he();let r={...t,apikey:t.apikey||ae()};if(!r.apikey)throw e||p.error("Missing API key, you need to provide an API key to add an organization"),new Error("Missing API key");let n=await ne(r.apikey,r.supaHost,r.supaAnon),o=await oe(n,r.apikey,["write","all"]),{name:i,email:a}=r;if(!e&&!i){let c=await mr({message:"Organization name:",placeholder:"My Organization"});if(be(c))throw p.error("Canceled adding organization"),new Error("Organization creation cancelled");i=c}if(!e&&!a){let c=await mr({message:"Management email:",placeholder:"admin@example.com"});if(be(c))throw p.error("Canceled adding organization"),new Error("Organization creation cancelled");a=c}if(!i||!a)throw e||p.error("Missing arguments, you need to provide an organization name and management email"),new Error("Missing organization name or management email");e||p.info(`Adding organization "${i}" to Capgo`);let{data:s,error:u}=await n.from("orgs").insert({name:i,management_email:a,created_by:o}).select().single();if(u)throw e||p.error(`Could not add organization ${L(u)}`),new Error(`Could not add organization: ${L(u)}`);return await De(r.apikey,{channel:"organization",event:"Organization Created",icon:"\u{1F3E2}",user_id:s.id,tags:{"org-name":i},notify:!1}).catch(()=>{}),e||(p.success(`Organization "${i}" added to Capgo`),J("Done \u2705")),s}async function Yg(t){await P9(t,!1)}async function T9(t,e,r=!1){r||Z("Deleting organization"),await he();let n={...e,apikey:e.apikey||ae()};if(!n.apikey)throw r||p.error("Missing API key, you need to provide an API key to delete an organization"),new Error("Missing API key");if(!t)throw r||p.error("Missing argument, you need to provide an organization ID"),new Error("Missing organization id");let o=await ne(n.apikey,n.supaHost,n.supaAnon),i=await oe(o,n.apikey,["write","all"]),{data:a,error:s}=await o.from("orgs").select("created_by, name").eq("id",t).single();if(s||!a)throw r||p.error(`Cannot get organization details ${L(s)}`),new Error(`Cannot get organization details: ${L(s)}`);if(a.created_by!==i){if(r)throw new Error("Deleting an organization is restricted to the organization owner");p.warn("Deleting an organization is restricted to the organization owner"),p.warn("You are not the owner of this organization"),p.warn("It's strongly recommended that you do not continue!");let c=await gr({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(be(c)||c==="no")throw p.error("Canceled deleting the organization"),new Error("Organization deletion cancelled")}if(!r&&!n.autoConfirm){let c=await ve({message:`Are you sure you want to delete organization "${a.name}"? This action cannot be undone.`});if(be(c)||!c)throw p.error("Canceled deleting the organization"),new Error("Organization deletion cancelled")}r||p.info(`Deleting organization "${a.name}"`);let{error:u}=await o.from("orgs").delete().eq("id",t);if(u)throw r||p.error(`Could not delete organization ${L(u)}`),new Error(`Could not delete organization: ${L(u)}`);return await De(n.apikey,{channel:"organization",event:"Organization Deleted",icon:"\u{1F5D1}\uFE0F",user_id:t,tags:{"org-name":a.name},notify:!1}).catch(()=>{}),r||(p.success(`Organization "${a.name}" deleted from Capgo`),J("Done \u2705")),!0}async function Jg(t,e){await T9(t,e,!1)}function I9(t,e){if(e)return;if(!t.length){p.error("No organizations found");return}let r=new ft;r.headers=["Name","ID","Role","Apps"],r.rows=[];for(let n of t.toReversed())r.rows.push([n.name??"Unknown",n.gid,n.role,n.app_count?.toString()||"0"]);p.success("Organizations"),p.success(r.toString())}async function R9(t,e=!1){e||Z("List organizations"),await he();let r={...t,apikey:t.apikey||ae()};if(!r.apikey)throw e||p.error("Missing API key, you need to provide an API key to list organizations"),new Error("Missing API key");let n=await ne(r.apikey,r.supaHost,r.supaAnon);await oe(n,r.apikey,["read","write","all"]),e||p.info("Getting organizations from Capgo");let{error:o,data:i}=await n.rpc("get_orgs_v6");if(o)throw e||p.error(`Cannot get organizations ${L(o)}`),new Error(`Cannot get organizations: ${L(o)}`);let a=i||[];return e||(p.info(`Organizations found: ${a.length}`),I9(a,e),J("Done \u2705")),a}async function Xg(t){await R9(t,!1)}async function B9(t,e,r=!1){r||Z("Updating organization"),await he();let n={...e,apikey:e.apikey||ae()};if(!n.apikey)throw r||p.error("Missing API key, you need to provide an API key to update an organization"),new Error("Missing API key");if(!t)throw r||p.error("Missing argument, you need to provide an organization ID"),new Error("Missing organization id");let o=await ne(n.apikey,n.supaHost,n.supaAnon);await oe(o,n.apikey,["write","all"]);let{data:i,error:a}=await o.from("orgs").select("name, management_email, created_by").eq("id",t).single();if(a||!i)throw r||p.error(`Cannot get organization details ${L(a)}`),new Error(`Cannot get organization details: ${L(a)}`);let{name:s,email:u}=n;if(!r&&!s){let l=await mr({message:"New organization name:",placeholder:i.name||"My Organization"});if(be(l))throw p.error("Canceled updating organization"),new Error("Organization update cancelled");s=l}if(!r&&!u){let l=await mr({message:"Management email:",placeholder:i.management_email||"admin@example.com"});if(be(l))throw p.error("Canceled updating organization"),new Error("Organization update cancelled");u=l}if(!s||!u)throw r||p.error("Missing arguments, you need to provide an organization name and management email"),new Error("Missing organization name or management email");r||p.info(`Updating organization "${t}"`);let{error:c}=await o.from("orgs").update({name:s,management_email:u}).eq("id",t);if(c)throw r||p.error(`Could not update organization ${L(c)}`),new Error(`Could not update organization: ${L(c)}`);return await De(n.apikey,{channel:"organization",event:"Organization Updated",icon:"\u270F\uFE0F",user_id:t,tags:{"org-name":s},notify:!1}).catch(()=>{}),r||(p.success("Organization updated"),J("Done \u2705")),{orgId:t,name:s,email:u}}async function Zg(t,e){await B9(t,e,!1)}async function j9(t,e=!1){e||Z("Getting user id");let r={...t,apikey:t.apikey||ae()};if(!r.apikey)throw e||p.error("Missing API key, you need to provide an API key to fetch the user id"),new Error("Missing API key");try{let n=await ne(r.apikey,r.supaHost,r.supaAnon),o=await oe(n,r.apikey,["read","all","write"]);return e||J(`Done \u2705: ${o}`),o}catch(n){throw e||p.error(`Error getting user id ${L(n)}`),n instanceof Error?n:new Error(String(n))}}async function ZF(t){await j9(t,!1)}var K={apikey:"API key to link to your account",supaHost:"Custom Supabase host URL (for self-hosting or Capgo development)",supaAnon:"Custom Supabase anon key (for self-hosting)",packageJson:"Paths to package.json files for monorepos (comma-separated)",nodeModules:"Paths to node_modules directories for monorepos (comma-separated)",verbose:"Enable verbose output"};pt.name(hr.name).description("\u{1F4E6} Manage packages and bundle versions in Capgo Cloud").version(hr.version,"-v, --version","output the current version");pt.command("init [apikey] [appId]").alias("i").description(`\u{1F680} Initialize a new app in Capgo Cloud with step-by-step guidance.
295
295
 
296
296
  This includes adding code for updates, building, uploading your app, and verifying update functionality.
297
297
 
298
- Example: npx @capgo/cli@latest init YOUR_API_KEY com.example.app`).action(Ik).option("-n, --name <name>","App name for display in Capgo Cloud").option("-i, --icon <icon>","App icon path for display in Capgo Cloud").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);gt.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.
298
+ Example: npx @capgo/cli@latest init YOUR_API_KEY com.example.app`).action(XF).option("-n, --name <name>","App name for display in Capgo Cloud").option("-i, --icon <icon>","App icon path for display in Capgo Cloud").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);pt.command("doctor").description(`\u{1F468}\u200D\u2695\uFE0F Check if your Capgo app installation is up-to-date and gather information useful for bug reports.
299
299
 
300
300
  This command helps diagnose issues with your setup.
301
301
 
302
- Example: npx @capgo/cli@latest doctor`).option("--package-json <packageJson>",K.packageJson).action(async(...t)=>{let e=t.at(-1);await JF(e)});gt.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.
302
+ Example: npx @capgo/cli@latest doctor`).option("--package-json <packageJson>",K.packageJson).action(async(...t)=>{let e=t.at(-1);await d2(e)});pt.command("login [apikey]").alias("l").description(`\u{1F511} Save your Capgo API key to your machine or local folder for easier access to Capgo Cloud services.
303
303
 
304
304
  Use --apikey=******** in any command to override it.
305
305
 
306
- Example: npx @capgo/cli@latest login YOUR_API_KEY`).action(Pk).option("--local","Only save in local folder, git ignored for security.").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);var Jn=gt.command("bundle").description("\u{1F4E6} Manage app bundles for deployment in Capgo Cloud, including upload, compatibility checks, and encryption.");Jn.command("upload [appId]").alias("u").description(`\u2B06\uFE0F Upload a new app bundle to Capgo Cloud for distribution.
306
+ Example: npx @capgo/cli@latest login YOUR_API_KEY`).action(KF).option("--local","Only save in local folder, git ignored for security.").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);var Un=pt.command("bundle").description("\u{1F4E6} Manage app bundles for deployment in Capgo Cloud, including upload, compatibility checks, and encryption.");Un.command("upload [appId]").alias("u").description(`\u2B06\uFE0F Upload a new app bundle to Capgo Cloud for distribution.
307
307
 
308
308
  Version must be > 0.0.0 and unique. Deleted versions cannot be reused for security.
309
309
 
310
310
  External option: Store only a URL link (useful for apps >200MB or privacy requirements).
311
311
  Capgo never inspects external content. Add encryption for trustless security.
312
312
 
313
- Example: npx @capgo/cli@latest bundle upload com.example.app --path ./dist --channel production`).action(XO).option("-a, --apikey <apikey>",K.apikey).option("-p, --path <path>","Path of the folder to upload, if not provided it will use the webDir set in capacitor.config").option("-c, --channel <channel>","Channel to link to").option("-e, --external <url>","Link to external URL instead of upload to Capgo Cloud").option("--iv-session-key <key>","Set the IV and session key for bundle URL external").option("--s3-region <region>","Region for your S3 bucket").option("--s3-apikey <apikey>","API key for your S3 endpoint").option("--s3-apisecret <apisecret>","API secret for your S3 endpoint").option("--s3-endpoint <s3Endpoint>","URL of S3 endpoint").option("--s3-bucket-name <bucketName>","Name for your AWS S3 bucket").option("--s3-port <port>","Port for your S3 endpoint").option("--no-s3-ssl","Disable SSL for S3 upload").option("--key-v2 <key>","Custom path for private signing key (v2 system)").option("--key-data-v2 <keyDataV2>","Private signing key (v2 system)").option("--bundle-url","Prints bundle URL into stdout").option("--no-key","Ignore signing key and send clear update").option("--no-code-check","Ignore checking if notifyAppReady() is called in source code and index present in root folder").option("--display-iv-session","Show in the console the IV and session key used to encrypt the update").option("-b, --bundle <bundle>","Bundle version number of the bundle to upload").option("--link <link>","Link to external resource (e.g. GitHub release)").option("--comment <comment>","Comment about this version, could be a release note, a commit hash, a commit message, etc.").option("--min-update-version <minUpdateVersion>","Minimal version required to update to this version. Used only if the disable auto update is set to metadata in channel").option("--auto-min-update-version","Set the min update version based on native packages").option("--ignore-metadata-check","Ignores the metadata (node_modules) check when uploading").option("--ignore-checksum-check","Ignores the checksum check when uploading").option("--timeout <timeout>","Timeout for the upload process in seconds").option("--multipart","[DEPRECATED] Use --tus instead. Uses multipart protocol for S3 uploads").option("--zip","Upload the bundle using zip to Capgo cloud (legacy)").option("--tus","Upload the bundle using TUS to Capgo cloud").option("--tus-chunk-size <tusChunkSize>","Chunk size in bytes for TUS resumable uploads (default: auto)").option("--partial","[DEPRECATED] Use --delta instead. Upload incremental updates").option("--partial-only","[DEPRECATED] Use --delta-only instead. Upload only incremental updates, skip full bundle").option("--delta","Upload incremental/differential updates to reduce bandwidth").option("--delta-only","Upload only delta updates without full bundle (useful for large apps)").option("--encrypted-checksum <encryptedChecksum>","An encrypted checksum (signature). Used only when uploading an external bundle.").option("--auto-set-bundle","Set the bundle in capacitor.config.json").option("--dry-upload","Dry upload the bundle process, mean it will not upload the files but add the row in database (Used by Capgo for internal testing)").option("--package-json <packageJson>",K.packageJson).option("--node-modules <nodeModules>",K.nodeModules).option("--encrypt-partial","Encrypt delta update files (auto-enabled for updater > 6.14.4)").option("--delete-linked-bundle-on-upload","Locates the currently linked bundle in the channel you are trying to upload to, and deletes it").option("--no-brotli-patterns <patterns>",'Files to exclude from Brotli compression (comma-separated globs, e.g., "*.jpg,*.png")').option("--disable-brotli","Completely disable brotli compression even if updater version supports it").option("--version-exists-ok","Exit successfully if bundle version already exists, useful for CI/CD workflows with monorepos").option("--self-assign","Allow devices to auto-join this channel (updates channel setting)").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon).option("--verbose",K.verbose);Jn.command("compatibility [appId]").description(`\u{1F9EA} Check compatibility of a bundle with a specific channel in Capgo Cloud to ensure updates are safe.
313
+ Example: npx @capgo/cli@latest bundle upload com.example.app --path ./dist --channel production`).action(fF).option("-a, --apikey <apikey>",K.apikey).option("-p, --path <path>","Path of the folder to upload, if not provided it will use the webDir set in capacitor.config").option("-c, --channel <channel>","Channel to link to").option("-e, --external <url>","Link to external URL instead of upload to Capgo Cloud").option("--iv-session-key <key>","Set the IV and session key for bundle URL external").option("--s3-region <region>","Region for your S3 bucket").option("--s3-apikey <apikey>","API key for your S3 endpoint").option("--s3-apisecret <apisecret>","API secret for your S3 endpoint").option("--s3-endpoint <s3Endpoint>","URL of S3 endpoint").option("--s3-bucket-name <bucketName>","Name for your AWS S3 bucket").option("--s3-port <port>","Port for your S3 endpoint").option("--no-s3-ssl","Disable SSL for S3 upload").option("--key-v2 <key>","Custom path for private signing key (v2 system)").option("--key-data-v2 <keyDataV2>","Private signing key (v2 system)").option("--bundle-url","Prints bundle URL into stdout").option("--no-key","Ignore signing key and send clear update").option("--no-code-check","Ignore checking if notifyAppReady() is called in source code and index present in root folder").option("--display-iv-session","Show in the console the IV and session key used to encrypt the update").option("-b, --bundle <bundle>","Bundle version number of the bundle to upload").option("--link <link>","Link to external resource (e.g. GitHub release)").option("--comment <comment>","Comment about this version, could be a release note, a commit hash, a commit message, etc.").option("--min-update-version <minUpdateVersion>","Minimal version required to update to this version. Used only if the disable auto update is set to metadata in channel").option("--auto-min-update-version","Set the min update version based on native packages").option("--ignore-metadata-check","Ignores the metadata (node_modules) check when uploading").option("--ignore-checksum-check","Ignores the checksum check when uploading").option("--timeout <timeout>","Timeout for the upload process in seconds").option("--multipart","[DEPRECATED] Use --tus instead. Uses multipart protocol for S3 uploads").option("--zip","Upload the bundle using zip to Capgo cloud (legacy)").option("--tus","Upload the bundle using TUS to Capgo cloud").option("--tus-chunk-size <tusChunkSize>","Chunk size in bytes for TUS resumable uploads (default: auto)").option("--partial","[DEPRECATED] Use --delta instead. Upload incremental updates").option("--partial-only","[DEPRECATED] Use --delta-only instead. Upload only incremental updates, skip full bundle").option("--delta","Upload incremental/differential updates to reduce bandwidth").option("--delta-only","Upload only delta updates without full bundle (useful for large apps)").option("--encrypted-checksum <encryptedChecksum>","An encrypted checksum (signature). Used only when uploading an external bundle.").option("--auto-set-bundle","Set the bundle in capacitor.config.json").option("--dry-upload","Dry upload the bundle process, mean it will not upload the files but add the row in database (Used by Capgo for internal testing)").option("--package-json <packageJson>",K.packageJson).option("--node-modules <nodeModules>",K.nodeModules).option("--encrypt-partial","Encrypt delta update files (auto-enabled for updater > 6.14.4)").option("--delete-linked-bundle-on-upload","Locates the currently linked bundle in the channel you are trying to upload to, and deletes it").option("--no-brotli-patterns <patterns>",'Files to exclude from Brotli compression (comma-separated globs, e.g., "*.jpg,*.png")').option("--disable-brotli","Completely disable brotli compression even if updater version supports it").option("--version-exists-ok","Exit successfully if bundle version already exists, useful for CI/CD workflows with monorepos").option("--self-assign","Allow devices to auto-join this channel (updates channel setting)").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon).option("--verbose",K.verbose);Un.command("compatibility [appId]").description(`\u{1F9EA} Check compatibility of a bundle with a specific channel in Capgo Cloud to ensure updates are safe.
314
314
 
315
- Example: npx @capgo/cli@latest bundle compatibility com.example.app --channel production`).action(p2).option("-a, --apikey <apikey>",K.apikey).option("-c, --channel <channel>","Channel to check the compatibility with").option("--text","Output text instead of emojis").option("--package-json <packageJson>",K.packageJson).option("--node-modules <nodeModules>",K.nodeModules).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);Jn.command("delete [bundleId] [appId]").alias("d").description(`\u{1F5D1}\uFE0F Delete a specific bundle from Capgo Cloud, optionally targeting a single version.
315
+ Example: npx @capgo/cli@latest bundle compatibility com.example.app --channel production`).action(A2).option("-a, --apikey <apikey>",K.apikey).option("-c, --channel <channel>","Channel to check the compatibility with").option("--text","Output text instead of emojis").option("--package-json <packageJson>",K.packageJson).option("--node-modules <nodeModules>",K.nodeModules).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);Un.command("delete [bundleId] [appId]").alias("d").description(`\u{1F5D1}\uFE0F Delete a specific bundle from Capgo Cloud, optionally targeting a single version.
316
316
 
317
- Example: npx @capgo/cli@latest bundle delete BUNDLE_ID com.example.app`).action(async(t,e,r)=>{await y2(t,e,r)}).option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);Jn.command("list [appId]").alias("l").description(`\u{1F4CB} List all bundles uploaded for an app in Capgo Cloud.
317
+ Example: npx @capgo/cli@latest bundle delete BUNDLE_ID com.example.app`).action(async(t,e,r)=>{await I2(t,e,r)}).option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);Un.command("list [appId]").alias("l").description(`\u{1F4CB} List all bundles uploaded for an app in Capgo Cloud.
318
318
 
319
- Example: npx @capgo/cli@latest bundle list com.example.app`).action(async(t,e)=>{await w2(t,e)}).option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);Jn.command("cleanup [appId]").alias("c").description(`\u{1F9F9} Delete old bundles in Capgo Cloud, keeping specified number of recent versions.
319
+ Example: npx @capgo/cli@latest bundle list com.example.app`).action(async(t,e)=>{await B2(t,e)}).option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);Un.command("cleanup [appId]").alias("c").description(`\u{1F9F9} Delete old bundles in Capgo Cloud, keeping specified number of recent versions.
320
320
 
321
321
  Bundles linked to channels are preserved unless --ignore-channel is used.
322
322
 
323
- Example: npx @capgo/cli@latest bundle cleanup com.example.app --bundle=1.0 --keep=3`).action(async(t,e)=>{await f2(t,e)}).option("-b, --bundle <bundle>","Bundle version number of the app to delete").option("-a, --apikey <apikey>",K.apikey).option("-k, --keep <keep>","Number of versions to keep").option("-f, --force","Force removal").option("--ignore-channel","Delete bundles even if linked to channels (WARNING: deletes channels too)").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);Jn.command("encrypt [zipPath] [checksum]").description(`\u{1F512} Encrypt a zip bundle for secure external storage.
323
+ Example: npx @capgo/cli@latest bundle cleanup com.example.app --bundle=1.0 --keep=3`).action(async(t,e)=>{await F2(t,e)}).option("-b, --bundle <bundle>","Bundle version number of the app to delete").option("-a, --apikey <apikey>",K.apikey).option("-k, --keep <keep>","Number of versions to keep").option("-f, --force","Force removal").option("--ignore-channel","Delete bundles even if linked to channels (WARNING: deletes channels too)").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);Un.command("encrypt [zipPath] [checksum]").description(`\u{1F512} Encrypt a zip bundle for secure external storage.
324
324
 
325
325
  Returns ivSessionKey for upload/decryption. Get checksum using 'bundle zip --json'.
326
326
 
327
- Example: npx @capgo/cli@latest bundle encrypt ./myapp.zip CHECKSUM`).action(b2).option("--key <key>","Custom path for private signing key").option("--key-data <keyData>","Private signing key").option("-j, --json","Output in JSON");Jn.command("decrypt [zipPath] [checksum]").description(`\u{1F513} Decrypt an encrypted bundle (mainly for testing).
327
+ Example: npx @capgo/cli@latest bundle encrypt ./myapp.zip CHECKSUM`).action(R2).option("--key <key>","Custom path for private signing key").option("--key-data <keyData>","Private signing key").option("-j, --json","Output in JSON");Un.command("decrypt [zipPath] [checksum]").description(`\u{1F513} Decrypt an encrypted bundle (mainly for testing).
328
328
 
329
329
  Prints base64 session key for verification.
330
330
 
331
- Example: npx @capgo/cli@latest bundle decrypt ./myapp_encrypted.zip CHECKSUM`).action(D2).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");Jn.command("zip [appId]").description(`\u{1F5DC}\uFE0F Create a zip file of your app bundle.
331
+ Example: npx @capgo/cli@latest bundle decrypt ./myapp_encrypted.zip CHECKSUM`).action(T2).option("--key <key>","Custom path for private signing key").option("--key-data <keyData>","Private signing key").option("--checksum <checksum>","Checksum of the bundle, to verify the integrity of the bundle");Un.command("zip [appId]").description(`\u{1F5DC}\uFE0F Create a zip file of your app bundle.
332
332
 
333
333
  Returns checksum for use with encryption. Use --json for machine-readable output.
334
334
 
335
- Example: npx @capgo/cli@latest bundle zip com.example.app --path ./dist`).action(QO).option("-p, --path <path>","Path of the folder to upload, if not provided it will use the webDir set in capacitor.config").option("-b, --bundle <bundle>","Bundle version number to name the zip file").option("-n, --name <name>","Name of the zip file").option("-j, --json","Output in JSON").option("--no-code-check","Ignore checking if notifyAppReady() is called in source code and index present in root folder").option("--key-v2","Use encryption v2").option("--package-json <packageJson>",K.packageJson);var vs=gt.command("app").description("\u{1F4F1} Manage your Capgo app settings and configurations in Capgo Cloud.");vs.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.
335
+ Example: npx @capgo/cli@latest bundle zip com.example.app --path ./dist`).action(mF).option("-p, --path <path>","Path of the folder to upload, if not provided it will use the webDir set in capacitor.config").option("-b, --bundle <bundle>","Bundle version number to name the zip file").option("-n, --name <name>","Name of the zip file").option("-j, --json","Output in JSON").option("--no-code-check","Ignore checking if notifyAppReady() is called in source code and index present in root folder").option("--key-v2","Use encryption v2").option("--package-json <packageJson>",K.packageJson);var ua=pt.command("app").description("\u{1F4F1} Manage your Capgo app settings and configurations in Capgo Cloud.");ua.command("add [appId]").alias("a").description(`\u2795 Add a new app to Capgo Cloud with a unique app ID in the format com.test.app.
336
336
 
337
337
  All options can be guessed from config if not provided.
338
338
 
339
- Example: npx @capgo/cli@latest app add com.example.app --name "My App" --icon ./icon.png`).action(zF).option("-n, --name <name>","App name for display in Capgo Cloud").option("-i, --icon <icon>","App icon path for display in Capgo Cloud").option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);vs.command("delete [appId]").description(`\u{1F5D1}\uFE0F Delete an app from Capgo Cloud, optionally specifying a version to delete only that bundle.
339
+ Example: npx @capgo/cli@latest app add com.example.app --name "My App" --icon ./icon.png`).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("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);ua.command("delete [appId]").description(`\u{1F5D1}\uFE0F Delete an app from Capgo Cloud, optionally specifying a version to delete only that bundle.
340
340
 
341
- Example: npx @capgo/cli@latest app delete com.example.app`).action(async(t,e)=>{await KF(t,e)}).option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);vs.command("list").alias("l").description(`\u{1F4CB} List all apps registered under your account in Capgo Cloud.
341
+ Example: npx @capgo/cli@latest app delete com.example.app`).action(async(t,e)=>{await l2(t,e)}).option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);ua.command("list").alias("l").description(`\u{1F4CB} List all apps registered under your account in Capgo Cloud.
342
342
 
343
- Example: npx @capgo/cli@latest app list`).action(async t=>{await ZF(t)}).option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);vs.command("debug [appId]").action(WF).description(`\u{1F41E} Listen for live update events in Capgo Cloud to debug your app.
343
+ Example: npx @capgo/cli@latest app list`).action(async t=>{await h2(t)}).option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);ua.command("debug [appId]").action(c2).description(`\u{1F41E} Listen for live update events in Capgo Cloud to debug your app.
344
344
 
345
345
  Optionally target a specific device for detailed diagnostics.
346
346
 
347
- Example: npx @capgo/cli@latest app debug com.example.app --device DEVICE_ID`).option("-a, --apikey <apikey>",K.apikey).option("-d, --device <device>","The specific device ID to debug").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);vs.command("setting [path]").description(`\u2699\uFE0F Modify Capacitor configuration programmatically.
347
+ Example: npx @capgo/cli@latest app debug com.example.app --device DEVICE_ID`).option("-a, --apikey <apikey>",K.apikey).option("-d, --device <device>","The specific device ID to debug").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);ua.command("setting [path]").description(`\u2699\uFE0F Modify Capacitor configuration programmatically.
348
348
 
349
349
  Specify setting path (e.g., plugins.CapacitorUpdater.defaultChannel) with --string or --bool.
350
350
 
351
- Example: npx @capgo/cli@latest app setting plugins.CapacitorUpdater.defaultChannel --string "Production"`).option("--bool <bool>","A value for the setting to modify as a boolean, ex: --bool true").option("--string <string>",'A value for the setting to modify as a string, ex: --string "Production"').action(t2);vs.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.
351
+ Example: npx @capgo/cli@latest app setting plugins.CapacitorUpdater.defaultChannel --string "Production"`).option("--bool <bool>","A value for the setting to modify as a boolean, ex: --bool true").option("--string <string>",'A value for the setting to modify as a string, ex: --string "Production"').action(D2);ua.command("set [appId]").alias("s").description(`\u2699\uFE0F Update settings for an existing app in Capgo Cloud, such as name, icon, or retention period for bundles.
352
352
 
353
353
  Retention of 0 means infinite storage.
354
354
 
355
- Example: npx @capgo/cli@latest app set com.example.app --name "Updated App" --retention 30`).action(async(t,e)=>{await e2(t,e)}).option("-n, --name <name>","App name for display in Capgo Cloud").option("-i, --icon <icon>","App icon path for display in Capgo Cloud").option("-a, --apikey <apikey>",K.apikey).option("-r, --retention <retention>","Days to keep old bundles (0 = infinite, default: 0)").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);var eu=gt.command("channel").description("\u{1F4E2} Manage distribution channels for app updates in Capgo Cloud, controlling how updates are delivered to devices.");eu.command("add [channelId] [appId]").alias("a").description(`\u2795 Create a new channel for app distribution in Capgo Cloud to manage update delivery.
355
+ Example: npx @capgo/cli@latest app set com.example.app --name "Updated App" --retention 30`).action(async(t,e)=>{await g2(t,e)}).option("-n, --name <name>","App name for display in Capgo Cloud").option("-i, --icon <icon>","App icon path for display in Capgo Cloud").option("-a, --apikey <apikey>",K.apikey).option("-r, --retention <retention>","Days to keep old bundles (0 = infinite, default: 0)").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);var Is=pt.command("channel").description("\u{1F4E2} Manage distribution channels for app updates in Capgo Cloud, controlling how updates are delivered to devices.");Is.command("add [channelId] [appId]").alias("a").description(`\u2795 Create a new channel for app distribution in Capgo Cloud to manage update delivery.
356
356
 
357
- Example: npx @capgo/cli@latest channel add production com.example.app --default`).action(ek).option("-d, --default","Set the channel as default").option("--self-assign","Allow device to self-assign to this channel").option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);eu.command("delete [channelId] [appId]").alias("d").description(`\u{1F5D1}\uFE0F Delete a channel from Capgo Cloud, optionally removing associated bundles to free up resources.
357
+ Example: npx @capgo/cli@latest channel add production com.example.app --default`).action(gF).option("-d, --default","Set the channel as default").option("--self-assign","Allow device to self-assign to this channel").option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);Is.command("delete [channelId] [appId]").alias("d").description(`\u{1F5D1}\uFE0F Delete a channel from Capgo Cloud, optionally removing associated bundles to free up resources.
358
358
 
359
- Example: npx @capgo/cli@latest channel delete production com.example.app`).action(async(t,e,r)=>{await rk(t,e,r)}).option("-a, --apikey <apikey>",K.apikey).option("--delete-bundle","Delete the bundle associated with the channel").option("--success-if-not-found","Success if the channel is not found").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);eu.command("list [appId]").alias("l").description(`\u{1F4CB} List all channels configured for an app in Capgo Cloud to review distribution settings.
359
+ Example: npx @capgo/cli@latest channel delete production com.example.app`).action(async(t,e,r)=>{await yF(t,e,r)}).option("-a, --apikey <apikey>",K.apikey).option("--delete-bundle","Delete the bundle associated with the channel").option("--success-if-not-found","Success if the channel is not found").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);Is.command("list [appId]").alias("l").description(`\u{1F4CB} List all channels configured for an app in Capgo Cloud to review distribution settings.
360
360
 
361
- Example: npx @capgo/cli@latest channel list com.example.app`).action(async(t,e)=>{await nk(t,e)}).option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);eu.command("currentBundle [channel] [appId]").description(`\u{1F4E6} Get the current bundle linked to a specific channel in Capgo Cloud for update tracking.
361
+ Example: npx @capgo/cli@latest channel list com.example.app`).action(async(t,e)=>{await bF(t,e)}).option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);Is.command("currentBundle [channel] [appId]").description(`\u{1F4E6} Get the current bundle linked to a specific channel in Capgo Cloud for update tracking.
362
362
 
363
- Example: npx @capgo/cli@latest channel currentBundle production com.example.app`).action(async(t,e,r)=>{await tk(t,e,r)}).option("-c, --channel <channel>","Channel to get the current bundle from").option("-a, --apikey <apikey>",K.apikey).option("--quiet","Only print the bundle version").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);eu.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).
363
+ Example: npx @capgo/cli@latest channel currentBundle production com.example.app`).action(async(t,e,r)=>{await DF(t,e,r)}).option("-c, --channel <channel>","Channel to get the current bundle from").option("-a, --apikey <apikey>",K.apikey).option("--quiet","Only print the bundle version").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);Is.command("set [channelId] [appId]").alias("s").description(`\u2699\uFE0F Configure settings for a channel, such as linking a bundle, setting update strategies (major, minor, metadata, patch, none), or device targeting (iOS, Android, dev, emulator).
364
364
 
365
365
  One channel must be default.
366
366
 
367
- Example: npx @capgo/cli@latest channel set production com.example.app --bundle 1.0.0 --state default`).action(async(t,e,r)=>{await ik(t,e,r)}).option("-a, --apikey <apikey>",K.apikey).option("-b, --bundle <bundle>","Bundle version number of the file to set").option("-s, --state <state>","Set the state of the channel, default or normal").option("--latest-remote","Get the latest bundle uploaded in capgo cloud and set it to the channel").option("--latest","Get the latest version key in the package.json to set it to the channel").option("--downgrade","Allow to downgrade to version under native one").option("--no-downgrade","Disable downgrade to version under native one").option("--ios","Allow sending update to iOS devices").option("--no-ios","Disable sending update to iOS devices").option("--android","Allow sending update to Android devices").option("--no-android","Disable sending update to Android devices").option("--self-assign","Allow device to self-assign to this channel").option("--no-self-assign","Disable devices to self-assign to this channel").option("--disable-auto-update <disableAutoUpdate>","Block updates by type: major, minor, metadata, patch, or none (allows all)").option("--dev","Allow sending update to development devices").option("--no-dev","Disable sending update to development devices").option("--emulator","Allow sending update to emulator devices").option("--no-emulator","Disable sending update to emulator devices").option("--package-json <packageJson>",K.packageJson).option("--ignore-metadata-check","Ignore checking node_modules compatibility if present in the bundle").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);var YD=gt.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.");YD.command("save").description(`\u{1F4BE} Save the public key in the Capacitor config, useful for CI environments.
367
+ Example: npx @capgo/cli@latest channel set production com.example.app --bundle 1.0.0 --state default`).action(async(t,e,r)=>{await wF(t,e,r)}).option("-a, --apikey <apikey>",K.apikey).option("-b, --bundle <bundle>","Bundle version number of the file to set").option("-s, --state <state>","Set the state of the channel, default or normal").option("--latest-remote","Get the latest bundle uploaded in capgo cloud and set it to the channel").option("--latest","Get the latest version key in the package.json to set it to the channel").option("--downgrade","Allow to downgrade to version under native one").option("--no-downgrade","Disable downgrade to version under native one").option("--ios","Allow sending update to iOS devices").option("--no-ios","Disable sending update to iOS devices").option("--android","Allow sending update to Android devices").option("--no-android","Disable sending update to Android devices").option("--self-assign","Allow device to self-assign to this channel").option("--no-self-assign","Disable devices to self-assign to this channel").option("--disable-auto-update <disableAutoUpdate>","Block updates by type: major, minor, metadata, patch, or none (allows all)").option("--dev","Allow sending update to development devices").option("--no-dev","Disable sending update to development devices").option("--emulator","Allow sending update to emulator devices").option("--no-emulator","Disable sending update to emulator devices").option("--package-json <packageJson>",K.packageJson).option("--ignore-metadata-check","Ignore checking node_modules compatibility if present in the bundle").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);var Qg=pt.command("key").description("\u{1F510} Manage encryption keys for secure bundle distribution in Capgo Cloud, supporting end-to-end encryption with RSA and AES combination.");Qg.command("save").description(`\u{1F4BE} Save the public key in the Capacitor config, useful for CI environments.
368
368
 
369
369
  Recommended not to commit the key for security.
370
370
 
371
- Example: npx @capgo/cli@latest key save --key ./path/to/key.pub`).action(Sk).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");YD.command("create").description(`\u{1F528} Create RSA key pair for end-to-end encryption.
371
+ Example: npx @capgo/cli@latest key save --key ./path/to/key.pub`).action(qF).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");Qg.command("create").description(`\u{1F528} Create RSA key pair for end-to-end encryption.
372
372
 
373
373
  Creates .capgo_key_v2 (private) and .capgo_key_v2.pub (public) in project root.
374
374
  Public key is saved to capacitor.config for mobile app decryption.
375
375
  NEVER commit the private key - store it securely!
376
376
 
377
- Example: npx @capgo/cli@latest key create`).action(Ok).option("-f, --force","Force generate a new one");YD.command("delete_old").description(`\u{1F9F9} Delete the old encryption key from the Capacitor config to ensure only the current key is used.
377
+ Example: npx @capgo/cli@latest key create`).action(zF).option("-f, --force","Force generate a new one");Qg.command("delete_old").description(`\u{1F9F9} Delete the old encryption key from the Capacitor config to ensure only the current key is used.
378
378
 
379
- Example: npx @capgo/cli@latest key delete_old`).action(kk);var Hz=gt.command("account").description("\u{1F464} Manage your Capgo account details and retrieve information for support or collaboration.");Hz.command("id").description(`\u{1FAAA} Retrieve your account ID, safe to share for collaboration or support purposes in Discord or other platforms.
379
+ Example: npx @capgo/cli@latest key delete_old`).action(GF);var N9=pt.command("account").description("\u{1F464} Manage your Capgo account details and retrieve information for support or collaboration.");N9.command("id").description(`\u{1FAAA} Retrieve your account ID, safe to share for collaboration or support purposes in Discord or other platforms.
380
380
 
381
- Example: npx @capgo/cli@latest account id`).action(Bk).option("-a, --apikey <apikey>",K.apikey);var Tf=gt.command("organisation").description("\u{1F3E2} Manage your organizations in Capgo Cloud for team collaboration and app management.");Tf.command("list").alias("l").description(`\u{1F4CB} List all organizations you have access to in Capgo Cloud.
381
+ Example: npx @capgo/cli@latest account id`).action(ZF).option("-a, --apikey <apikey>",K.apikey);var ef=pt.command("organisation").description("\u{1F3E2} Manage your organizations in Capgo Cloud for team collaboration and app management.");ef.command("list").alias("l").description(`\u{1F4CB} List all organizations you have access to in Capgo Cloud.
382
382
 
383
- Example: npx @capgo/cli@latest organisation list`).action(KD).option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);Tf.command("add").alias("a").description(`\u2795 Create a new organization in Capgo Cloud for team collaboration.
383
+ Example: npx @capgo/cli@latest organisation list`).action(Xg).option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);ef.command("add").alias("a").description(`\u2795 Create a new organization in Capgo Cloud for team collaboration.
384
384
 
385
- Example: npx @capgo/cli@latest organisation add --name "My Company" --email admin@mycompany.com`).action(GD).option("-n, --name <name>","Organization name").option("-e, --email <email>","Management email for the organization").option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);Tf.command("set [orgId]").alias("s").description(`\u2699\uFE0F Update organization settings such as name and management email.
385
+ Example: npx @capgo/cli@latest organisation add --name "My Company" --email admin@mycompany.com`).action(Yg).option("-n, --name <name>","Organization name").option("-e, --email <email>","Management email for the organization").option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);ef.command("set [orgId]").alias("s").description(`\u2699\uFE0F Update organization settings such as name and management email.
386
386
 
387
- Example: npx @capgo/cli@latest organisation set ORG_ID --name "Updated Company Name"`).action(XD).option("-n, --name <name>","Organization name").option("-e, --email <email>","Management email for the organization").option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);Tf.command("delete [orgId]").alias("d").description(`\u{1F5D1}\uFE0F Delete an organization from Capgo Cloud. This action cannot be undone.
387
+ Example: npx @capgo/cli@latest organisation set ORG_ID --name "Updated Company Name"`).action(Zg).option("-n, --name <name>","Organization name").option("-e, --email <email>","Management email for the organization").option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);ef.command("delete [orgId]").alias("d").description(`\u{1F5D1}\uFE0F Delete an organization from Capgo Cloud. This action cannot be undone.
388
388
 
389
389
  Only organization owners can delete organizations.
390
390
 
391
- Example: npx @capgo/cli@latest organisation delete ORG_ID`).action(WD).option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);gt.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)=>{sk(t,e.folder)});gt.exitOverride();gt.configureOutput({writeErr:t=>{}});gt.parseAsync().catch(t=>{if(typeof t=="object"&&t!==null&&"code"in t){let e=t;(e.code==="commander.version"||e.code==="commander.helpDisplayed")&&(0,Pf.exit)(0),e.message&&console.error(e.message);let r=e.exitCode??1;(0,Pf.exit)(r)}console.error(`Error: ${j(t)}`),(0,Pf.exit)(1)});
391
+ Example: npx @capgo/cli@latest organisation delete ORG_ID`).action(Jg).option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);pt.command("generate-docs [filePath]").description("Generate Markdown documentation for CLI commands - either for README or individual files").option("--folder <folderPath>","Generate individual markdown files for each command in the specified folder (instead of updating README)").action((t,e)=>{CF(t,e.folder)});pt.exitOverride();pt.configureOutput({writeErr:t=>{}});pt.parseAsync().catch(t=>{if(typeof t=="object"&&t!==null&&"code"in t){let e=t;(e.code==="commander.version"||e.code==="commander.helpDisplayed")&&(0,Ql.exit)(0),e.message&&console.error(e.message);let r=e.exitCode??1;(0,Ql.exit)(r)}console.error(`Error: ${L(t)}`),(0,Ql.exit)(1)});
392
392
  /*! Bundled license information:
393
393
 
394
394
  tus-js-client/lib.es5/upload.js: