@spree/cli 2.3.4 → 2.3.6

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 (2) hide show
  1. package/dist/index.js +183 -178
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,105 +1,173 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __createRequire } from "node:module";
3
3
  const require = __createRequire(import.meta.url);
4
- var rh=Object.create;var Uo=Object.defineProperty;var ih=Object.getOwnPropertyDescriptor;var nh=Object.getOwnPropertyNames;var sh=Object.getPrototypeOf,oh=Object.prototype.hasOwnProperty;var oe=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var S=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}};var ah=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of nh(t))!oh.call(e,n)&&n!==r&&Uo(e,n,{get:()=>t[n],enumerable:!(i=ih(t,n))||i.enumerable});return e};var U=(e,t,r)=>(r=e!=null?rh(sh(e)):{},ah(t||!e||!e.__esModule?Uo(r,"default",{value:e,enumerable:!0}):r,e));var Ft=S(pn=>{"use strict";var xr=class extends Error{constructor(t,r,i){super(i),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=r,this.exitCode=t,this.nestedError=void 0}},cn=class extends xr{constructor(t){super(1,"commander.invalidArgument",t),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};pn.CommanderError=xr;pn.InvalidArgumentError=cn});var wr=S(un=>{"use strict";var{InvalidArgumentError:ch}=Ft(),dn=class{constructor(t,r){switch(this.description=r||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,t[0]){case"<":this.required=!0,this._name=t.slice(1,-1);break;case"[":this.required=!1,this._name=t.slice(1,-1);break;default:this.required=!0,this._name=t;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(t,r){return r===this.defaultValue||!Array.isArray(r)?[t]:(r.push(t),r)}default(t,r){return this.defaultValue=t,this.defaultValueDescription=r,this}argParser(t){return this.parseArg=t,this}choices(t){return this.argChoices=t.slice(),this.parseArg=(r,i)=>{if(!this.argChoices.includes(r))throw new ch(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,i):r},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function ph(e){let t=e.name()+(e.variadic===!0?"...":"");return e.required?"<"+t+">":"["+t+"]"}un.Argument=dn;un.humanReadableArgName=ph});var hn=S(mn=>{"use strict";var{humanReadableArgName:dh}=wr(),ln=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(t){this.helpWidth=this.helpWidth??t.helpWidth??80}visibleCommands(t){let r=t.commands.filter(n=>!n._hidden),i=t._getHelpCommand();return i&&!i._hidden&&r.push(i),this.sortSubcommands&&r.sort((n,s)=>n.name().localeCompare(s.name())),r}compareOptions(t,r){let i=n=>n.short?n.short.replace(/^-/,""):n.long.replace(/^--/,"");return i(t).localeCompare(i(r))}visibleOptions(t){let r=t.options.filter(n=>!n.hidden),i=t._getHelpOption();if(i&&!i.hidden){let n=i.short&&t._findOption(i.short),s=i.long&&t._findOption(i.long);!n&&!s?r.push(i):i.long&&!s?r.push(t.createOption(i.long,i.description)):i.short&&!n&&r.push(t.createOption(i.short,i.description))}return this.sortOptions&&r.sort(this.compareOptions),r}visibleGlobalOptions(t){if(!this.showGlobalOptions)return[];let r=[];for(let i=t.parent;i;i=i.parent){let n=i.options.filter(s=>!s.hidden);r.push(...n)}return this.sortOptions&&r.sort(this.compareOptions),r}visibleArguments(t){return t._argsDescription&&t.registeredArguments.forEach(r=>{r.description=r.description||t._argsDescription[r.name()]||""}),t.registeredArguments.find(r=>r.description)?t.registeredArguments:[]}subcommandTerm(t){let r=t.registeredArguments.map(i=>dh(i)).join(" ");return t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(t){return t.flags}argumentTerm(t){return t.name()}longestSubcommandTermLength(t,r){return r.visibleCommands(t).reduce((i,n)=>Math.max(i,this.displayWidth(r.styleSubcommandTerm(r.subcommandTerm(n)))),0)}longestOptionTermLength(t,r){return r.visibleOptions(t).reduce((i,n)=>Math.max(i,this.displayWidth(r.styleOptionTerm(r.optionTerm(n)))),0)}longestGlobalOptionTermLength(t,r){return r.visibleGlobalOptions(t).reduce((i,n)=>Math.max(i,this.displayWidth(r.styleOptionTerm(r.optionTerm(n)))),0)}longestArgumentTermLength(t,r){return r.visibleArguments(t).reduce((i,n)=>Math.max(i,this.displayWidth(r.styleArgumentTerm(r.argumentTerm(n)))),0)}commandUsage(t){let r=t._name;t._aliases[0]&&(r=r+"|"+t._aliases[0]);let i="";for(let n=t.parent;n;n=n.parent)i=n.name()+" "+i;return i+r+" "+t.usage()}commandDescription(t){return t.description()}subcommandDescription(t){return t.summary()||t.description()}optionDescription(t){let r=[];if(t.argChoices&&r.push(`choices: ${t.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),t.defaultValue!==void 0&&(t.required||t.optional||t.isBoolean()&&typeof t.defaultValue=="boolean")&&r.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),t.presetArg!==void 0&&t.optional&&r.push(`preset: ${JSON.stringify(t.presetArg)}`),t.envVar!==void 0&&r.push(`env: ${t.envVar}`),r.length>0){let i=`(${r.join(", ")})`;return t.description?`${t.description} ${i}`:i}return t.description}argumentDescription(t){let r=[];if(t.argChoices&&r.push(`choices: ${t.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),t.defaultValue!==void 0&&r.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),r.length>0){let i=`(${r.join(", ")})`;return t.description?`${t.description} ${i}`:i}return t.description}formatItemList(t,r,i){return r.length===0?[]:[i.styleTitle(t),...r,""]}groupItems(t,r,i){let n=new Map;return t.forEach(s=>{let o=i(s);n.has(o)||n.set(o,[])}),r.forEach(s=>{let o=i(s);n.has(o)||n.set(o,[]),n.get(o).push(s)}),n}formatHelp(t,r){let i=r.padWidth(t,r),n=r.helpWidth??80;function s(u,l){return r.formatItem(u,i,l,r)}let o=[`${r.styleTitle("Usage:")} ${r.styleUsage(r.commandUsage(t))}`,""],a=r.commandDescription(t);a.length>0&&(o=o.concat([r.boxWrap(r.styleCommandDescription(a),n),""]));let c=r.visibleArguments(t).map(u=>s(r.styleArgumentTerm(r.argumentTerm(u)),r.styleArgumentDescription(r.argumentDescription(u))));if(o=o.concat(this.formatItemList("Arguments:",c,r)),this.groupItems(t.options,r.visibleOptions(t),u=>u.helpGroupHeading??"Options:").forEach((u,l)=>{let m=u.map(h=>s(r.styleOptionTerm(r.optionTerm(h)),r.styleOptionDescription(r.optionDescription(h))));o=o.concat(this.formatItemList(l,m,r))}),r.showGlobalOptions){let u=r.visibleGlobalOptions(t).map(l=>s(r.styleOptionTerm(r.optionTerm(l)),r.styleOptionDescription(r.optionDescription(l))));o=o.concat(this.formatItemList("Global Options:",u,r))}return this.groupItems(t.commands,r.visibleCommands(t),u=>u.helpGroup()||"Commands:").forEach((u,l)=>{let m=u.map(h=>s(r.styleSubcommandTerm(r.subcommandTerm(h)),r.styleSubcommandDescription(r.subcommandDescription(h))));o=o.concat(this.formatItemList(l,m,r))}),o.join(`
5
- `)}displayWidth(t){return No(t).length}styleTitle(t){return t}styleUsage(t){return t.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(t){return this.styleDescriptionText(t)}styleOptionDescription(t){return this.styleDescriptionText(t)}styleSubcommandDescription(t){return this.styleDescriptionText(t)}styleArgumentDescription(t){return this.styleDescriptionText(t)}styleDescriptionText(t){return t}styleOptionTerm(t){return this.styleOptionText(t)}styleSubcommandTerm(t){return t.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleSubcommandText(r)).join(" ")}styleArgumentTerm(t){return this.styleArgumentText(t)}styleOptionText(t){return t}styleArgumentText(t){return t}styleSubcommandText(t){return t}styleCommandText(t){return t}padWidth(t,r){return Math.max(r.longestOptionTermLength(t,r),r.longestGlobalOptionTermLength(t,r),r.longestSubcommandTermLength(t,r),r.longestArgumentTermLength(t,r))}preformatted(t){return/\n[^\S\r\n]/.test(t)}formatItem(t,r,i,n){let o=" ".repeat(2);if(!i)return o+t;let a=t.padEnd(r+t.length-n.displayWidth(t)),c=2,p=(this.helpWidth??80)-r-c-2,u;return p<this.minWidthToWrap||n.preformatted(i)?u=i:u=n.boxWrap(i,p).replace(/\n/g,`
4
+ var oh=Object.create;var zo=Object.defineProperty;var ah=Object.getOwnPropertyDescriptor;var ch=Object.getOwnPropertyNames;var ph=Object.getPrototypeOf,dh=Object.prototype.hasOwnProperty;var oe=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var q=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}};var uh=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ch(t))!dh.call(e,n)&&n!==r&&zo(e,n,{get:()=>t[n],enumerable:!(i=ah(t,n))||i.enumerable});return e};var N=(e,t,r)=>(r=e!=null?oh(ph(e)):{},uh(t||!e||!e.__esModule?zo(r,"default",{value:e,enumerable:!0}):r,e));var Ut=q(un=>{"use strict";var kr=class extends Error{constructor(t,r,i){super(i),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=r,this.exitCode=t,this.nestedError=void 0}},dn=class extends kr{constructor(t){super(1,"commander.invalidArgument",t),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};un.CommanderError=kr;un.InvalidArgumentError=dn});var vr=q(mn=>{"use strict";var{InvalidArgumentError:lh}=Ut(),ln=class{constructor(t,r){switch(this.description=r||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,t[0]){case"<":this.required=!0,this._name=t.slice(1,-1);break;case"[":this.required=!1,this._name=t.slice(1,-1);break;default:this.required=!0,this._name=t;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(t,r){return r===this.defaultValue||!Array.isArray(r)?[t]:(r.push(t),r)}default(t,r){return this.defaultValue=t,this.defaultValueDescription=r,this}argParser(t){return this.parseArg=t,this}choices(t){return this.argChoices=t.slice(),this.parseArg=(r,i)=>{if(!this.argChoices.includes(r))throw new lh(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,i):r},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function mh(e){let t=e.name()+(e.variadic===!0?"...":"");return e.required?"<"+t+">":"["+t+"]"}mn.Argument=ln;mn.humanReadableArgName=mh});var fn=q(yn=>{"use strict";var{humanReadableArgName:hh}=vr(),hn=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(t){this.helpWidth=this.helpWidth??t.helpWidth??80}visibleCommands(t){let r=t.commands.filter(n=>!n._hidden),i=t._getHelpCommand();return i&&!i._hidden&&r.push(i),this.sortSubcommands&&r.sort((n,s)=>n.name().localeCompare(s.name())),r}compareOptions(t,r){let i=n=>n.short?n.short.replace(/^-/,""):n.long.replace(/^--/,"");return i(t).localeCompare(i(r))}visibleOptions(t){let r=t.options.filter(n=>!n.hidden),i=t._getHelpOption();if(i&&!i.hidden){let n=i.short&&t._findOption(i.short),s=i.long&&t._findOption(i.long);!n&&!s?r.push(i):i.long&&!s?r.push(t.createOption(i.long,i.description)):i.short&&!n&&r.push(t.createOption(i.short,i.description))}return this.sortOptions&&r.sort(this.compareOptions),r}visibleGlobalOptions(t){if(!this.showGlobalOptions)return[];let r=[];for(let i=t.parent;i;i=i.parent){let n=i.options.filter(s=>!s.hidden);r.push(...n)}return this.sortOptions&&r.sort(this.compareOptions),r}visibleArguments(t){return t._argsDescription&&t.registeredArguments.forEach(r=>{r.description=r.description||t._argsDescription[r.name()]||""}),t.registeredArguments.find(r=>r.description)?t.registeredArguments:[]}subcommandTerm(t){let r=t.registeredArguments.map(i=>hh(i)).join(" ");return t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(t){return t.flags}argumentTerm(t){return t.name()}longestSubcommandTermLength(t,r){return r.visibleCommands(t).reduce((i,n)=>Math.max(i,this.displayWidth(r.styleSubcommandTerm(r.subcommandTerm(n)))),0)}longestOptionTermLength(t,r){return r.visibleOptions(t).reduce((i,n)=>Math.max(i,this.displayWidth(r.styleOptionTerm(r.optionTerm(n)))),0)}longestGlobalOptionTermLength(t,r){return r.visibleGlobalOptions(t).reduce((i,n)=>Math.max(i,this.displayWidth(r.styleOptionTerm(r.optionTerm(n)))),0)}longestArgumentTermLength(t,r){return r.visibleArguments(t).reduce((i,n)=>Math.max(i,this.displayWidth(r.styleArgumentTerm(r.argumentTerm(n)))),0)}commandUsage(t){let r=t._name;t._aliases[0]&&(r=r+"|"+t._aliases[0]);let i="";for(let n=t.parent;n;n=n.parent)i=n.name()+" "+i;return i+r+" "+t.usage()}commandDescription(t){return t.description()}subcommandDescription(t){return t.summary()||t.description()}optionDescription(t){let r=[];if(t.argChoices&&r.push(`choices: ${t.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),t.defaultValue!==void 0&&(t.required||t.optional||t.isBoolean()&&typeof t.defaultValue=="boolean")&&r.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),t.presetArg!==void 0&&t.optional&&r.push(`preset: ${JSON.stringify(t.presetArg)}`),t.envVar!==void 0&&r.push(`env: ${t.envVar}`),r.length>0){let i=`(${r.join(", ")})`;return t.description?`${t.description} ${i}`:i}return t.description}argumentDescription(t){let r=[];if(t.argChoices&&r.push(`choices: ${t.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),t.defaultValue!==void 0&&r.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),r.length>0){let i=`(${r.join(", ")})`;return t.description?`${t.description} ${i}`:i}return t.description}formatItemList(t,r,i){return r.length===0?[]:[i.styleTitle(t),...r,""]}groupItems(t,r,i){let n=new Map;return t.forEach(s=>{let o=i(s);n.has(o)||n.set(o,[])}),r.forEach(s=>{let o=i(s);n.has(o)||n.set(o,[]),n.get(o).push(s)}),n}formatHelp(t,r){let i=r.padWidth(t,r),n=r.helpWidth??80;function s(u,l){return r.formatItem(u,i,l,r)}let o=[`${r.styleTitle("Usage:")} ${r.styleUsage(r.commandUsage(t))}`,""],a=r.commandDescription(t);a.length>0&&(o=o.concat([r.boxWrap(r.styleCommandDescription(a),n),""]));let c=r.visibleArguments(t).map(u=>s(r.styleArgumentTerm(r.argumentTerm(u)),r.styleArgumentDescription(r.argumentDescription(u))));if(o=o.concat(this.formatItemList("Arguments:",c,r)),this.groupItems(t.options,r.visibleOptions(t),u=>u.helpGroupHeading??"Options:").forEach((u,l)=>{let m=u.map(h=>s(r.styleOptionTerm(r.optionTerm(h)),r.styleOptionDescription(r.optionDescription(h))));o=o.concat(this.formatItemList(l,m,r))}),r.showGlobalOptions){let u=r.visibleGlobalOptions(t).map(l=>s(r.styleOptionTerm(r.optionTerm(l)),r.styleOptionDescription(r.optionDescription(l))));o=o.concat(this.formatItemList("Global Options:",u,r))}return this.groupItems(t.commands,r.visibleCommands(t),u=>u.helpGroup()||"Commands:").forEach((u,l)=>{let m=u.map(h=>s(r.styleSubcommandTerm(r.subcommandTerm(h)),r.styleSubcommandDescription(r.subcommandDescription(h))));o=o.concat(this.formatItemList(l,m,r))}),o.join(`
5
+ `)}displayWidth(t){return Vo(t).length}styleTitle(t){return t}styleUsage(t){return t.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(t){return this.styleDescriptionText(t)}styleOptionDescription(t){return this.styleDescriptionText(t)}styleSubcommandDescription(t){return this.styleDescriptionText(t)}styleArgumentDescription(t){return this.styleDescriptionText(t)}styleDescriptionText(t){return t}styleOptionTerm(t){return this.styleOptionText(t)}styleSubcommandTerm(t){return t.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleSubcommandText(r)).join(" ")}styleArgumentTerm(t){return this.styleArgumentText(t)}styleOptionText(t){return t}styleArgumentText(t){return t}styleSubcommandText(t){return t}styleCommandText(t){return t}padWidth(t,r){return Math.max(r.longestOptionTermLength(t,r),r.longestGlobalOptionTermLength(t,r),r.longestSubcommandTermLength(t,r),r.longestArgumentTermLength(t,r))}preformatted(t){return/\n[^\S\r\n]/.test(t)}formatItem(t,r,i,n){let o=" ".repeat(2);if(!i)return o+t;let a=t.padEnd(r+t.length-n.displayWidth(t)),c=2,p=(this.helpWidth??80)-r-c-2,u;return p<this.minWidthToWrap||n.preformatted(i)?u=i:u=n.boxWrap(i,p).replace(/\n/g,`
6
6
  `+" ".repeat(r+c)),o+a+" ".repeat(c)+u.replace(/\n/g,`
7
7
  ${o}`)}boxWrap(t,r){if(r<this.minWidthToWrap)return t;let i=t.split(/\r\n|\n/),n=/[\s]*[^\s]+/g,s=[];return i.forEach(o=>{let a=o.match(n);if(a===null){s.push("");return}let c=[a.shift()],d=this.displayWidth(c[0]);a.forEach(p=>{let u=this.displayWidth(p);if(d+u<=r){c.push(p),d+=u;return}s.push(c.join(""));let l=p.trimStart();c=[l],d=this.displayWidth(l)}),s.push(c.join(""))}),s.join(`
8
- `)}};function No(e){let t=/\x1b\[\d*(;\d*)*m/g;return e.replace(t,"")}mn.Help=ln;mn.stripColor=No});var _n=S(gn=>{"use strict";var{InvalidArgumentError:uh}=Ft(),yn=class{constructor(t,r){this.flags=t,this.description=r||"",this.required=t.includes("<"),this.optional=t.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(t),this.mandatory=!1;let i=lh(t);this.short=i.shortFlag,this.long=i.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(t,r){return this.defaultValue=t,this.defaultValueDescription=r,this}preset(t){return this.presetArg=t,this}conflicts(t){return this.conflictsWith=this.conflictsWith.concat(t),this}implies(t){let r=t;return typeof t=="string"&&(r={[t]:!0}),this.implied=Object.assign(this.implied||{},r),this}env(t){return this.envVar=t,this}argParser(t){return this.parseArg=t,this}makeOptionMandatory(t=!0){return this.mandatory=!!t,this}hideHelp(t=!0){return this.hidden=!!t,this}_collectValue(t,r){return r===this.defaultValue||!Array.isArray(r)?[t]:(r.push(t),r)}choices(t){return this.argChoices=t.slice(),this.parseArg=(r,i)=>{if(!this.argChoices.includes(r))throw new uh(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,i):r},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?Go(this.name().replace(/^no-/,"")):Go(this.name())}helpGroup(t){return this.helpGroupHeading=t,this}is(t){return this.short===t||this.long===t}isBoolean(){return!this.required&&!this.optional&&!this.negate}},fn=class{constructor(t){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,t.forEach(r=>{r.negate?this.negativeOptions.set(r.attributeName(),r):this.positiveOptions.set(r.attributeName(),r)}),this.negativeOptions.forEach((r,i)=>{this.positiveOptions.has(i)&&this.dualOptions.add(i)})}valueFromOption(t,r){let i=r.attributeName();if(!this.dualOptions.has(i))return!0;let n=this.negativeOptions.get(i).presetArg,s=n!==void 0?n:!1;return r.negate===(s===t)}};function Go(e){return e.split("-").reduce((t,r)=>t+r[0].toUpperCase()+r.slice(1))}function lh(e){let t,r,i=/^-[^-]$/,n=/^--[^-]/,s=e.split(/[ |,]+/).concat("guard");if(i.test(s[0])&&(t=s.shift()),n.test(s[0])&&(r=s.shift()),!t&&i.test(s[0])&&(t=s.shift()),!t&&n.test(s[0])&&(t=r,r=s.shift()),s[0].startsWith("-")){let o=s[0],a=`option creation failed due to '${o}' in option flags '${e}'`;throw/^-[^-][^-]/.test(o)?new Error(`${a}
8
+ `)}};function Vo(e){let t=/\x1b\[\d*(;\d*)*m/g;return e.replace(t,"")}yn.Help=hn;yn.stripColor=Vo});var xn=q(bn=>{"use strict";var{InvalidArgumentError:yh}=Ut(),gn=class{constructor(t,r){this.flags=t,this.description=r||"",this.required=t.includes("<"),this.optional=t.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(t),this.mandatory=!1;let i=fh(t);this.short=i.shortFlag,this.long=i.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(t,r){return this.defaultValue=t,this.defaultValueDescription=r,this}preset(t){return this.presetArg=t,this}conflicts(t){return this.conflictsWith=this.conflictsWith.concat(t),this}implies(t){let r=t;return typeof t=="string"&&(r={[t]:!0}),this.implied=Object.assign(this.implied||{},r),this}env(t){return this.envVar=t,this}argParser(t){return this.parseArg=t,this}makeOptionMandatory(t=!0){return this.mandatory=!!t,this}hideHelp(t=!0){return this.hidden=!!t,this}_collectValue(t,r){return r===this.defaultValue||!Array.isArray(r)?[t]:(r.push(t),r)}choices(t){return this.argChoices=t.slice(),this.parseArg=(r,i)=>{if(!this.argChoices.includes(r))throw new yh(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,i):r},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?Wo(this.name().replace(/^no-/,"")):Wo(this.name())}helpGroup(t){return this.helpGroupHeading=t,this}is(t){return this.short===t||this.long===t}isBoolean(){return!this.required&&!this.optional&&!this.negate}},_n=class{constructor(t){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,t.forEach(r=>{r.negate?this.negativeOptions.set(r.attributeName(),r):this.positiveOptions.set(r.attributeName(),r)}),this.negativeOptions.forEach((r,i)=>{this.positiveOptions.has(i)&&this.dualOptions.add(i)})}valueFromOption(t,r){let i=r.attributeName();if(!this.dualOptions.has(i))return!0;let n=this.negativeOptions.get(i).presetArg,s=n!==void 0?n:!1;return r.negate===(s===t)}};function Wo(e){return e.split("-").reduce((t,r)=>t+r[0].toUpperCase()+r.slice(1))}function fh(e){let t,r,i=/^-[^-]$/,n=/^--[^-]/,s=e.split(/[ |,]+/).concat("guard");if(i.test(s[0])&&(t=s.shift()),n.test(s[0])&&(r=s.shift()),!t&&i.test(s[0])&&(t=s.shift()),!t&&n.test(s[0])&&(t=r,r=s.shift()),s[0].startsWith("-")){let o=s[0],a=`option creation failed due to '${o}' in option flags '${e}'`;throw/^-[^-][^-]/.test(o)?new Error(`${a}
9
9
  - a short flag is a single dash and a single character
10
10
  - either use a single dash and a single character (for a short flag)
11
11
  - or use a double dash for a long option (and can have two, like '--ws, --workspace')`):i.test(o)?new Error(`${a}
12
12
  - too many short flags`):n.test(o)?new Error(`${a}
13
13
  - too many long flags`):new Error(`${a}
14
- - unrecognised flag format`)}if(t===void 0&&r===void 0)throw new Error(`option creation failed due to no flags found in '${e}'.`);return{shortFlag:t,longFlag:r}}gn.Option=yn;gn.DualOptions=fn});var Vo=S(zo=>{"use strict";function mh(e,t){if(Math.abs(e.length-t.length)>3)return Math.max(e.length,t.length);let r=[];for(let i=0;i<=e.length;i++)r[i]=[i];for(let i=0;i<=t.length;i++)r[0][i]=i;for(let i=1;i<=t.length;i++)for(let n=1;n<=e.length;n++){let s=1;e[n-1]===t[i-1]?s=0:s=1,r[n][i]=Math.min(r[n-1][i]+1,r[n][i-1]+1,r[n-1][i-1]+s),n>1&&i>1&&e[n-1]===t[i-2]&&e[n-2]===t[i-1]&&(r[n][i]=Math.min(r[n][i],r[n-2][i-2]+1))}return r[e.length][t.length]}function hh(e,t){if(!t||t.length===0)return"";t=Array.from(new Set(t));let r=e.startsWith("--");r&&(e=e.slice(2),t=t.map(o=>o.slice(2)));let i=[],n=3,s=.4;return t.forEach(o=>{if(o.length<=1)return;let a=mh(e,o),c=Math.max(e.length,o.length);(c-a)/c>s&&(a<n?(n=a,i=[o]):a===n&&i.push(o))}),i.sort((o,a)=>o.localeCompare(a)),r&&(i=i.map(o=>`--${o}`)),i.length>1?`
14
+ - unrecognised flag format`)}if(t===void 0&&r===void 0)throw new Error(`option creation failed due to no flags found in '${e}'.`);return{shortFlag:t,longFlag:r}}bn.Option=gn;bn.DualOptions=_n});var Ko=q(Ho=>{"use strict";function gh(e,t){if(Math.abs(e.length-t.length)>3)return Math.max(e.length,t.length);let r=[];for(let i=0;i<=e.length;i++)r[i]=[i];for(let i=0;i<=t.length;i++)r[0][i]=i;for(let i=1;i<=t.length;i++)for(let n=1;n<=e.length;n++){let s=1;e[n-1]===t[i-1]?s=0:s=1,r[n][i]=Math.min(r[n-1][i]+1,r[n][i-1]+1,r[n-1][i-1]+s),n>1&&i>1&&e[n-1]===t[i-2]&&e[n-2]===t[i-1]&&(r[n][i]=Math.min(r[n][i],r[n-2][i-2]+1))}return r[e.length][t.length]}function _h(e,t){if(!t||t.length===0)return"";t=Array.from(new Set(t));let r=e.startsWith("--");r&&(e=e.slice(2),t=t.map(o=>o.slice(2)));let i=[],n=3,s=.4;return t.forEach(o=>{if(o.length<=1)return;let a=gh(e,o),c=Math.max(e.length,o.length);(c-a)/c>s&&(a<n?(n=a,i=[o]):a===n&&i.push(o))}),i.sort((o,a)=>o.localeCompare(a)),r&&(i=i.map(o=>`--${o}`)),i.length>1?`
15
15
  (Did you mean one of ${i.join(", ")}?)`:i.length===1?`
16
- (Did you mean ${i[0]}?)`:""}zo.suggestSimilar=hh});var Yo=S(vn=>{"use strict";var yh=oe("events").EventEmitter,bn=oe("child_process"),De=oe("path"),kr=oe("fs"),P=oe("process"),{Argument:fh,humanReadableArgName:gh}=wr(),{CommanderError:xn}=Ft(),{Help:_h,stripColor:bh}=hn(),{Option:Wo,DualOptions:xh}=_n(),{suggestSimilar:Ho}=Vo(),wn=class e extends yh{constructor(t){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=t||"",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=>P.stdout.write(r),writeErr:r=>P.stderr.write(r),outputError:(r,i)=>i(r),getOutHelpWidth:()=>P.stdout.isTTY?P.stdout.columns:void 0,getErrHelpWidth:()=>P.stderr.isTTY?P.stderr.columns:void 0,getOutHasColors:()=>kn()??(P.stdout.isTTY&&P.stdout.hasColors?.()),getErrHasColors:()=>kn()??(P.stderr.isTTY&&P.stderr.hasColors?.()),stripColor:r=>bh(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(t){return this._outputConfiguration=t._outputConfiguration,this._helpOption=t._helpOption,this._helpCommand=t._helpCommand,this._helpConfiguration=t._helpConfiguration,this._exitCallback=t._exitCallback,this._storeOptionsAsProperties=t._storeOptionsAsProperties,this._combineFlagAndOptionalValue=t._combineFlagAndOptionalValue,this._allowExcessArguments=t._allowExcessArguments,this._enablePositionalOptions=t._enablePositionalOptions,this._showHelpAfterError=t._showHelpAfterError,this._showSuggestionAfterError=t._showSuggestionAfterError,this}_getCommandAndAncestors(){let t=[];for(let r=this;r;r=r.parent)t.push(r);return t}command(t,r,i){let n=r,s=i;typeof n=="object"&&n!==null&&(s=n,n=null),s=s||{};let[,o,a]=t.match(/([^ ]+) *(.*)/),c=this.createCommand(o);return n&&(c.description(n),c._executableHandler=!0),s.isDefault&&(this._defaultCommandName=c._name),c._hidden=!!(s.noHelp||s.hidden),c._executableFile=s.executableFile||null,a&&c.arguments(a),this._registerCommand(c),c.parent=this,c.copyInheritedSettings(this),n?this:c}createCommand(t){return new e(t)}createHelp(){return Object.assign(new _h,this.configureHelp())}configureHelp(t){return t===void 0?this._helpConfiguration:(this._helpConfiguration=t,this)}configureOutput(t){return t===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...t},this)}showHelpAfterError(t=!0){return typeof t!="string"&&(t=!!t),this._showHelpAfterError=t,this}showSuggestionAfterError(t=!0){return this._showSuggestionAfterError=!!t,this}addCommand(t,r){if(!t._name)throw new Error(`Command passed to .addCommand() must have a name
17
- - specify the name in Command constructor or using .name()`);return r=r||{},r.isDefault&&(this._defaultCommandName=t._name),(r.noHelp||r.hidden)&&(t._hidden=!0),this._registerCommand(t),t.parent=this,t._checkForBrokenPassThrough(),this}createArgument(t,r){return new fh(t,r)}argument(t,r,i,n){let s=this.createArgument(t,r);return typeof i=="function"?s.default(n).argParser(i):s.default(i),this.addArgument(s),this}arguments(t){return t.trim().split(/ +/).forEach(r=>{this.argument(r)}),this}addArgument(t){let r=this.registeredArguments.slice(-1)[0];if(r?.variadic)throw new Error(`only the last argument can be variadic '${r.name()}'`);if(t.required&&t.defaultValue!==void 0&&t.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${t.name()}'`);return this.registeredArguments.push(t),this}helpCommand(t,r){if(typeof t=="boolean")return this._addImplicitHelpCommand=t,t&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let i=t??"help [command]",[,n,s]=i.match(/([^ ]+) *(.*)/),o=r??"display help for command",a=this.createCommand(n);return a.helpOption(!1),s&&a.arguments(s),o&&a.description(o),this._addImplicitHelpCommand=!0,this._helpCommand=a,(t||r)&&this._initCommandGroup(a),this}addHelpCommand(t,r){return typeof t!="object"?(this.helpCommand(t,r),this):(this._addImplicitHelpCommand=!0,this._helpCommand=t,this._initCommandGroup(t),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(t,r){let i=["preSubcommand","preAction","postAction"];if(!i.includes(t))throw new Error(`Unexpected value for event passed to hook : '${t}'.
18
- Expecting one of '${i.join("', '")}'`);return this._lifeCycleHooks[t]?this._lifeCycleHooks[t].push(r):this._lifeCycleHooks[t]=[r],this}exitOverride(t){return t?this._exitCallback=t:this._exitCallback=r=>{if(r.code!=="commander.executeSubCommandAsync")throw r},this}_exit(t,r,i){this._exitCallback&&this._exitCallback(new xn(t,r,i)),P.exit(t)}action(t){let r=i=>{let n=this.registeredArguments.length,s=i.slice(0,n);return this._storeOptionsAsProperties?s[n]=this:s[n]=this.opts(),s.push(this),t.apply(this,s)};return this._actionHandler=r,this}createOption(t,r){return new Wo(t,r)}_callParseArg(t,r,i,n){try{return t.parseArg(r,i)}catch(s){if(s.code==="commander.invalidArgument"){let o=`${n} ${s.message}`;this.error(o,{exitCode:s.exitCode,code:s.code})}throw s}}_registerOption(t){let r=t.short&&this._findOption(t.short)||t.long&&this._findOption(t.long);if(r){let i=t.long&&this._findOption(t.long)?t.long:t.short;throw new Error(`Cannot add option '${t.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${i}'
19
- - already used by option '${r.flags}'`)}this._initOptionGroup(t),this.options.push(t)}_registerCommand(t){let r=n=>[n.name()].concat(n.aliases()),i=r(t).find(n=>this._findCommand(n));if(i){let n=r(this._findCommand(i)).join("|"),s=r(t).join("|");throw new Error(`cannot add command '${s}' as already have command '${n}'`)}this._initCommandGroup(t),this.commands.push(t)}addOption(t){this._registerOption(t);let r=t.name(),i=t.attributeName();if(t.negate){let s=t.long.replace(/^--no-/,"--");this._findOption(s)||this.setOptionValueWithSource(i,t.defaultValue===void 0?!0:t.defaultValue,"default")}else t.defaultValue!==void 0&&this.setOptionValueWithSource(i,t.defaultValue,"default");let n=(s,o,a)=>{s==null&&t.presetArg!==void 0&&(s=t.presetArg);let c=this.getOptionValue(i);s!==null&&t.parseArg?s=this._callParseArg(t,s,c,o):s!==null&&t.variadic&&(s=t._collectValue(s,c)),s==null&&(t.negate?s=!1:t.isBoolean()||t.optional?s=!0:s=""),this.setOptionValueWithSource(i,s,a)};return this.on("option:"+r,s=>{let o=`error: option '${t.flags}' argument '${s}' is invalid.`;n(s,o,"cli")}),t.envVar&&this.on("optionEnv:"+r,s=>{let o=`error: option '${t.flags}' value '${s}' from env '${t.envVar}' is invalid.`;n(s,o,"env")}),this}_optionEx(t,r,i,n,s){if(typeof r=="object"&&r instanceof Wo)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let o=this.createOption(r,i);if(o.makeOptionMandatory(!!t.mandatory),typeof n=="function")o.default(s).argParser(n);else if(n instanceof RegExp){let a=n;n=(c,d)=>{let p=a.exec(c);return p?p[0]:d},o.default(s).argParser(n)}else o.default(n);return this.addOption(o)}option(t,r,i,n){return this._optionEx({},t,r,i,n)}requiredOption(t,r,i,n){return this._optionEx({mandatory:!0},t,r,i,n)}combineFlagAndOptionalValue(t=!0){return this._combineFlagAndOptionalValue=!!t,this}allowUnknownOption(t=!0){return this._allowUnknownOption=!!t,this}allowExcessArguments(t=!0){return this._allowExcessArguments=!!t,this}enablePositionalOptions(t=!0){return this._enablePositionalOptions=!!t,this}passThroughOptions(t=!0){return this._passThroughOptions=!!t,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(t=!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=!!t,this}getOptionValue(t){return this._storeOptionsAsProperties?this[t]:this._optionValues[t]}setOptionValue(t,r){return this.setOptionValueWithSource(t,r,void 0)}setOptionValueWithSource(t,r,i){return this._storeOptionsAsProperties?this[t]=r:this._optionValues[t]=r,this._optionValueSources[t]=i,this}getOptionValueSource(t){return this._optionValueSources[t]}getOptionValueSourceWithGlobals(t){let r;return this._getCommandAndAncestors().forEach(i=>{i.getOptionValueSource(t)!==void 0&&(r=i.getOptionValueSource(t))}),r}_prepareUserArgs(t,r){if(t!==void 0&&!Array.isArray(t))throw new Error("first parameter to parse must be array or undefined");if(r=r||{},t===void 0&&r.from===void 0){P.versions?.electron&&(r.from="electron");let n=P.execArgv??[];(n.includes("-e")||n.includes("--eval")||n.includes("-p")||n.includes("--print"))&&(r.from="eval")}t===void 0&&(t=P.argv),this.rawArgs=t.slice();let i;switch(r.from){case void 0:case"node":this._scriptPath=t[1],i=t.slice(2);break;case"electron":P.defaultApp?(this._scriptPath=t[1],i=t.slice(2)):i=t.slice(1);break;case"user":i=t.slice(0);break;case"eval":i=t.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",i}parse(t,r){this._prepareForParse();let i=this._prepareUserArgs(t,r);return this._parseCommand([],i),this}async parseAsync(t,r){this._prepareForParse();let i=this._prepareUserArgs(t,r);return await this._parseCommand([],i),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.
20
- - 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(t,r,i){if(kr.existsSync(t))return;let n=r?`searched for local subcommand relative to directory '${r}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",s=`'${t}' does not exist
16
+ (Did you mean ${i[0]}?)`:""}Ho.suggestSimilar=_h});var Qo=q(qn=>{"use strict";var bh=oe("events").EventEmitter,wn=oe("child_process"),Me=oe("path"),Sr=oe("fs"),T=oe("process"),{Argument:xh,humanReadableArgName:wh}=vr(),{CommanderError:kn}=Ut(),{Help:kh,stripColor:vh}=fn(),{Option:Yo,DualOptions:Sh}=xn(),{suggestSimilar:Jo}=Ko(),vn=class e extends bh{constructor(t){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=t||"",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=>T.stdout.write(r),writeErr:r=>T.stderr.write(r),outputError:(r,i)=>i(r),getOutHelpWidth:()=>T.stdout.isTTY?T.stdout.columns:void 0,getErrHelpWidth:()=>T.stderr.isTTY?T.stderr.columns:void 0,getOutHasColors:()=>Sn()??(T.stdout.isTTY&&T.stdout.hasColors?.()),getErrHasColors:()=>Sn()??(T.stderr.isTTY&&T.stderr.hasColors?.()),stripColor:r=>vh(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(t){return this._outputConfiguration=t._outputConfiguration,this._helpOption=t._helpOption,this._helpCommand=t._helpCommand,this._helpConfiguration=t._helpConfiguration,this._exitCallback=t._exitCallback,this._storeOptionsAsProperties=t._storeOptionsAsProperties,this._combineFlagAndOptionalValue=t._combineFlagAndOptionalValue,this._allowExcessArguments=t._allowExcessArguments,this._enablePositionalOptions=t._enablePositionalOptions,this._showHelpAfterError=t._showHelpAfterError,this._showSuggestionAfterError=t._showSuggestionAfterError,this}_getCommandAndAncestors(){let t=[];for(let r=this;r;r=r.parent)t.push(r);return t}command(t,r,i){let n=r,s=i;typeof n=="object"&&n!==null&&(s=n,n=null),s=s||{};let[,o,a]=t.match(/([^ ]+) *(.*)/),c=this.createCommand(o);return n&&(c.description(n),c._executableHandler=!0),s.isDefault&&(this._defaultCommandName=c._name),c._hidden=!!(s.noHelp||s.hidden),c._executableFile=s.executableFile||null,a&&c.arguments(a),this._registerCommand(c),c.parent=this,c.copyInheritedSettings(this),n?this:c}createCommand(t){return new e(t)}createHelp(){return Object.assign(new kh,this.configureHelp())}configureHelp(t){return t===void 0?this._helpConfiguration:(this._helpConfiguration=t,this)}configureOutput(t){return t===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...t},this)}showHelpAfterError(t=!0){return typeof t!="string"&&(t=!!t),this._showHelpAfterError=t,this}showSuggestionAfterError(t=!0){return this._showSuggestionAfterError=!!t,this}addCommand(t,r){if(!t._name)throw new Error(`Command passed to .addCommand() must have a name
17
+ - specify the name in Command constructor or using .name()`);return r=r||{},r.isDefault&&(this._defaultCommandName=t._name),(r.noHelp||r.hidden)&&(t._hidden=!0),this._registerCommand(t),t.parent=this,t._checkForBrokenPassThrough(),this}createArgument(t,r){return new xh(t,r)}argument(t,r,i,n){let s=this.createArgument(t,r);return typeof i=="function"?s.default(n).argParser(i):s.default(i),this.addArgument(s),this}arguments(t){return t.trim().split(/ +/).forEach(r=>{this.argument(r)}),this}addArgument(t){let r=this.registeredArguments.slice(-1)[0];if(r?.variadic)throw new Error(`only the last argument can be variadic '${r.name()}'`);if(t.required&&t.defaultValue!==void 0&&t.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${t.name()}'`);return this.registeredArguments.push(t),this}helpCommand(t,r){if(typeof t=="boolean")return this._addImplicitHelpCommand=t,t&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let i=t??"help [command]",[,n,s]=i.match(/([^ ]+) *(.*)/),o=r??"display help for command",a=this.createCommand(n);return a.helpOption(!1),s&&a.arguments(s),o&&a.description(o),this._addImplicitHelpCommand=!0,this._helpCommand=a,(t||r)&&this._initCommandGroup(a),this}addHelpCommand(t,r){return typeof t!="object"?(this.helpCommand(t,r),this):(this._addImplicitHelpCommand=!0,this._helpCommand=t,this._initCommandGroup(t),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(t,r){let i=["preSubcommand","preAction","postAction"];if(!i.includes(t))throw new Error(`Unexpected value for event passed to hook : '${t}'.
18
+ Expecting one of '${i.join("', '")}'`);return this._lifeCycleHooks[t]?this._lifeCycleHooks[t].push(r):this._lifeCycleHooks[t]=[r],this}exitOverride(t){return t?this._exitCallback=t:this._exitCallback=r=>{if(r.code!=="commander.executeSubCommandAsync")throw r},this}_exit(t,r,i){this._exitCallback&&this._exitCallback(new kn(t,r,i)),T.exit(t)}action(t){let r=i=>{let n=this.registeredArguments.length,s=i.slice(0,n);return this._storeOptionsAsProperties?s[n]=this:s[n]=this.opts(),s.push(this),t.apply(this,s)};return this._actionHandler=r,this}createOption(t,r){return new Yo(t,r)}_callParseArg(t,r,i,n){try{return t.parseArg(r,i)}catch(s){if(s.code==="commander.invalidArgument"){let o=`${n} ${s.message}`;this.error(o,{exitCode:s.exitCode,code:s.code})}throw s}}_registerOption(t){let r=t.short&&this._findOption(t.short)||t.long&&this._findOption(t.long);if(r){let i=t.long&&this._findOption(t.long)?t.long:t.short;throw new Error(`Cannot add option '${t.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${i}'
19
+ - already used by option '${r.flags}'`)}this._initOptionGroup(t),this.options.push(t)}_registerCommand(t){let r=n=>[n.name()].concat(n.aliases()),i=r(t).find(n=>this._findCommand(n));if(i){let n=r(this._findCommand(i)).join("|"),s=r(t).join("|");throw new Error(`cannot add command '${s}' as already have command '${n}'`)}this._initCommandGroup(t),this.commands.push(t)}addOption(t){this._registerOption(t);let r=t.name(),i=t.attributeName();if(t.negate){let s=t.long.replace(/^--no-/,"--");this._findOption(s)||this.setOptionValueWithSource(i,t.defaultValue===void 0?!0:t.defaultValue,"default")}else t.defaultValue!==void 0&&this.setOptionValueWithSource(i,t.defaultValue,"default");let n=(s,o,a)=>{s==null&&t.presetArg!==void 0&&(s=t.presetArg);let c=this.getOptionValue(i);s!==null&&t.parseArg?s=this._callParseArg(t,s,c,o):s!==null&&t.variadic&&(s=t._collectValue(s,c)),s==null&&(t.negate?s=!1:t.isBoolean()||t.optional?s=!0:s=""),this.setOptionValueWithSource(i,s,a)};return this.on("option:"+r,s=>{let o=`error: option '${t.flags}' argument '${s}' is invalid.`;n(s,o,"cli")}),t.envVar&&this.on("optionEnv:"+r,s=>{let o=`error: option '${t.flags}' value '${s}' from env '${t.envVar}' is invalid.`;n(s,o,"env")}),this}_optionEx(t,r,i,n,s){if(typeof r=="object"&&r instanceof Yo)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let o=this.createOption(r,i);if(o.makeOptionMandatory(!!t.mandatory),typeof n=="function")o.default(s).argParser(n);else if(n instanceof RegExp){let a=n;n=(c,d)=>{let p=a.exec(c);return p?p[0]:d},o.default(s).argParser(n)}else o.default(n);return this.addOption(o)}option(t,r,i,n){return this._optionEx({},t,r,i,n)}requiredOption(t,r,i,n){return this._optionEx({mandatory:!0},t,r,i,n)}combineFlagAndOptionalValue(t=!0){return this._combineFlagAndOptionalValue=!!t,this}allowUnknownOption(t=!0){return this._allowUnknownOption=!!t,this}allowExcessArguments(t=!0){return this._allowExcessArguments=!!t,this}enablePositionalOptions(t=!0){return this._enablePositionalOptions=!!t,this}passThroughOptions(t=!0){return this._passThroughOptions=!!t,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(t=!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=!!t,this}getOptionValue(t){return this._storeOptionsAsProperties?this[t]:this._optionValues[t]}setOptionValue(t,r){return this.setOptionValueWithSource(t,r,void 0)}setOptionValueWithSource(t,r,i){return this._storeOptionsAsProperties?this[t]=r:this._optionValues[t]=r,this._optionValueSources[t]=i,this}getOptionValueSource(t){return this._optionValueSources[t]}getOptionValueSourceWithGlobals(t){let r;return this._getCommandAndAncestors().forEach(i=>{i.getOptionValueSource(t)!==void 0&&(r=i.getOptionValueSource(t))}),r}_prepareUserArgs(t,r){if(t!==void 0&&!Array.isArray(t))throw new Error("first parameter to parse must be array or undefined");if(r=r||{},t===void 0&&r.from===void 0){T.versions?.electron&&(r.from="electron");let n=T.execArgv??[];(n.includes("-e")||n.includes("--eval")||n.includes("-p")||n.includes("--print"))&&(r.from="eval")}t===void 0&&(t=T.argv),this.rawArgs=t.slice();let i;switch(r.from){case void 0:case"node":this._scriptPath=t[1],i=t.slice(2);break;case"electron":T.defaultApp?(this._scriptPath=t[1],i=t.slice(2)):i=t.slice(1);break;case"user":i=t.slice(0);break;case"eval":i=t.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",i}parse(t,r){this._prepareForParse();let i=this._prepareUserArgs(t,r);return this._parseCommand([],i),this}async parseAsync(t,r){this._prepareForParse();let i=this._prepareUserArgs(t,r);return await this._parseCommand([],i),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.
20
+ - 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(t,r,i){if(Sr.existsSync(t))return;let n=r?`searched for local subcommand relative to directory '${r}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",s=`'${t}' does not exist
21
21
  - if '${i}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
22
22
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
23
- - ${n}`;throw new Error(s)}_executeSubCommand(t,r){r=r.slice();let i=!1,n=[".js",".ts",".tsx",".mjs",".cjs"];function s(p,u){let l=De.resolve(p,u);if(kr.existsSync(l))return l;if(n.includes(De.extname(u)))return;let m=n.find(h=>kr.existsSync(`${l}${h}`));if(m)return`${l}${m}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o=t._executableFile||`${this._name}-${t._name}`,a=this._executableDir||"";if(this._scriptPath){let p;try{p=kr.realpathSync(this._scriptPath)}catch{p=this._scriptPath}a=De.resolve(De.dirname(p),a)}if(a){let p=s(a,o);if(!p&&!t._executableFile&&this._scriptPath){let u=De.basename(this._scriptPath,De.extname(this._scriptPath));u!==this._name&&(p=s(a,`${u}-${t._name}`))}o=p||o}i=n.includes(De.extname(o));let c;P.platform!=="win32"?i?(r.unshift(o),r=Ko(P.execArgv).concat(r),c=bn.spawn(P.argv[0],r,{stdio:"inherit"})):c=bn.spawn(o,r,{stdio:"inherit"}):(this._checkForMissingExecutable(o,a,t._name),r.unshift(o),r=Ko(P.execArgv).concat(r),c=bn.spawn(P.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(u=>{P.on(u,()=>{c.killed===!1&&c.exitCode===null&&c.kill(u)})});let d=this._exitCallback;c.on("close",p=>{p=p??1,d?d(new xn(p,"commander.executeSubCommandAsync","(close)")):P.exit(p)}),c.on("error",p=>{if(p.code==="ENOENT")this._checkForMissingExecutable(o,a,t._name);else if(p.code==="EACCES")throw new Error(`'${o}' not executable`);if(!d)P.exit(1);else{let u=new xn(1,"commander.executeSubCommandAsync","(error)");u.nestedError=p,d(u)}}),this.runningCommand=c}_dispatchSubcommand(t,r,i){let n=this._findCommand(t);n||this.help({error:!0}),n._prepareForParse();let s;return s=this._chainOrCallSubCommandHook(s,n,"preSubcommand"),s=this._chainOrCall(s,()=>{if(n._executableHandler)this._executeSubCommand(n,r.concat(i));else return n._parseCommand(r,i)}),s}_dispatchHelpCommand(t){t||this.help();let r=this._findCommand(t);return r&&!r._executableHandler&&r.help(),this._dispatchSubcommand(t,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((t,r)=>{t.required&&this.args[r]==null&&this.missingArgument(t.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let t=(i,n,s)=>{let o=n;if(n!==null&&i.parseArg){let a=`error: command-argument value '${n}' is invalid for argument '${i.name()}'.`;o=this._callParseArg(i,n,s,a)}return o};this._checkNumberOfArguments();let r=[];this.registeredArguments.forEach((i,n)=>{let s=i.defaultValue;i.variadic?n<this.args.length?(s=this.args.slice(n),i.parseArg&&(s=s.reduce((o,a)=>t(i,a,o),i.defaultValue))):s===void 0&&(s=[]):n<this.args.length&&(s=this.args[n],i.parseArg&&(s=t(i,s,i.defaultValue))),r[n]=s}),this.processedArgs=r}_chainOrCall(t,r){return t?.then&&typeof t.then=="function"?t.then(()=>r()):r()}_chainOrCallHooks(t,r){let i=t,n=[];return this._getCommandAndAncestors().reverse().filter(s=>s._lifeCycleHooks[r]!==void 0).forEach(s=>{s._lifeCycleHooks[r].forEach(o=>{n.push({hookedCommand:s,callback:o})})}),r==="postAction"&&n.reverse(),n.forEach(s=>{i=this._chainOrCall(i,()=>s.callback(s.hookedCommand,this))}),i}_chainOrCallSubCommandHook(t,r,i){let n=t;return this._lifeCycleHooks[i]!==void 0&&this._lifeCycleHooks[i].forEach(s=>{n=this._chainOrCall(n,()=>s(this,r))}),n}_parseCommand(t,r){let i=this.parseOptions(r);if(this._parseOptionsEnv(),this._parseOptionsImplied(),t=t.concat(i.operands),r=i.unknown,this.args=t.concat(r),t&&this._findCommand(t[0]))return this._dispatchSubcommand(t[0],t.slice(1),r);if(this._getHelpCommand()&&t[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(t[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(r),this._dispatchSubcommand(this._defaultCommandName,t,r);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(i.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let n=()=>{i.unknown.length>0&&this.unknownOption(i.unknown[0])},s=`command:${this.name()}`;if(this._actionHandler){n(),this._processArguments();let o;return o=this._chainOrCallHooks(o,"preAction"),o=this._chainOrCall(o,()=>this._actionHandler(this.processedArgs)),this.parent&&(o=this._chainOrCall(o,()=>{this.parent.emit(s,t,r)})),o=this._chainOrCallHooks(o,"postAction"),o}if(this.parent?.listenerCount(s))n(),this._processArguments(),this.parent.emit(s,t,r);else if(t.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",t,r);this.listenerCount("command:*")?this.emit("command:*",t,r):this.commands.length?this.unknownCommand():(n(),this._processArguments())}else this.commands.length?(n(),this.help({error:!0})):(n(),this._processArguments())}_findCommand(t){if(t)return this.commands.find(r=>r._name===t||r._aliases.includes(t))}_findOption(t){return this.options.find(r=>r.is(t))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(t=>{t.options.forEach(r=>{r.mandatory&&t.getOptionValue(r.attributeName())===void 0&&t.missingMandatoryOptionValue(r)})})}_checkForConflictingLocalOptions(){let t=this.options.filter(i=>{let n=i.attributeName();return this.getOptionValue(n)===void 0?!1:this.getOptionValueSource(n)!=="default"});t.filter(i=>i.conflictsWith.length>0).forEach(i=>{let n=t.find(s=>i.conflictsWith.includes(s.attributeName()));n&&this._conflictingOption(i,n)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(t=>{t._checkForConflictingLocalOptions()})}parseOptions(t){let r=[],i=[],n=r;function s(p){return p.length>1&&p[0]==="-"}let o=p=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(p)?!this._getCommandAndAncestors().some(u=>u.options.map(l=>l.short).some(l=>/^-\d$/.test(l))):!1,a=null,c=null,d=0;for(;d<t.length||c;){let p=c??t[d++];if(c=null,p==="--"){n===i&&n.push(p),n.push(...t.slice(d));break}if(a&&(!s(p)||o(p))){this.emit(`option:${a.name()}`,p);continue}if(a=null,s(p)){let u=this._findOption(p);if(u){if(u.required){let l=t[d++];l===void 0&&this.optionMissingArgument(u),this.emit(`option:${u.name()}`,l)}else if(u.optional){let l=null;d<t.length&&(!s(t[d])||o(t[d]))&&(l=t[d++]),this.emit(`option:${u.name()}`,l)}else this.emit(`option:${u.name()}`);a=u.variadic?u:null;continue}}if(p.length>2&&p[0]==="-"&&p[1]!=="-"){let u=this._findOption(`-${p[1]}`);if(u){u.required||u.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${u.name()}`,p.slice(2)):(this.emit(`option:${u.name()}`),c=`-${p.slice(2)}`);continue}}if(/^--[^=]+=/.test(p)){let u=p.indexOf("="),l=this._findOption(p.slice(0,u));if(l&&(l.required||l.optional)){this.emit(`option:${l.name()}`,p.slice(u+1));continue}}if(n===r&&s(p)&&!(this.commands.length===0&&o(p))&&(n=i),(this._enablePositionalOptions||this._passThroughOptions)&&r.length===0&&i.length===0){if(this._findCommand(p)){r.push(p),i.push(...t.slice(d));break}else if(this._getHelpCommand()&&p===this._getHelpCommand().name()){r.push(p,...t.slice(d));break}else if(this._defaultCommandName){i.push(p,...t.slice(d));break}}if(this._passThroughOptions){n.push(p,...t.slice(d));break}n.push(p)}return{operands:r,unknown:i}}opts(){if(this._storeOptionsAsProperties){let t={},r=this.options.length;for(let i=0;i<r;i++){let n=this.options[i].attributeName();t[n]=n===this._versionOptionName?this._version:this[n]}return t}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((t,r)=>Object.assign(t,r.opts()),{})}error(t,r){this._outputConfiguration.outputError(`${t}
23
+ - ${n}`;throw new Error(s)}_executeSubCommand(t,r){r=r.slice();let i=!1,n=[".js",".ts",".tsx",".mjs",".cjs"];function s(p,u){let l=Me.resolve(p,u);if(Sr.existsSync(l))return l;if(n.includes(Me.extname(u)))return;let m=n.find(h=>Sr.existsSync(`${l}${h}`));if(m)return`${l}${m}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o=t._executableFile||`${this._name}-${t._name}`,a=this._executableDir||"";if(this._scriptPath){let p;try{p=Sr.realpathSync(this._scriptPath)}catch{p=this._scriptPath}a=Me.resolve(Me.dirname(p),a)}if(a){let p=s(a,o);if(!p&&!t._executableFile&&this._scriptPath){let u=Me.basename(this._scriptPath,Me.extname(this._scriptPath));u!==this._name&&(p=s(a,`${u}-${t._name}`))}o=p||o}i=n.includes(Me.extname(o));let c;T.platform!=="win32"?i?(r.unshift(o),r=Xo(T.execArgv).concat(r),c=wn.spawn(T.argv[0],r,{stdio:"inherit"})):c=wn.spawn(o,r,{stdio:"inherit"}):(this._checkForMissingExecutable(o,a,t._name),r.unshift(o),r=Xo(T.execArgv).concat(r),c=wn.spawn(T.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(u=>{T.on(u,()=>{c.killed===!1&&c.exitCode===null&&c.kill(u)})});let d=this._exitCallback;c.on("close",p=>{p=p??1,d?d(new kn(p,"commander.executeSubCommandAsync","(close)")):T.exit(p)}),c.on("error",p=>{if(p.code==="ENOENT")this._checkForMissingExecutable(o,a,t._name);else if(p.code==="EACCES")throw new Error(`'${o}' not executable`);if(!d)T.exit(1);else{let u=new kn(1,"commander.executeSubCommandAsync","(error)");u.nestedError=p,d(u)}}),this.runningCommand=c}_dispatchSubcommand(t,r,i){let n=this._findCommand(t);n||this.help({error:!0}),n._prepareForParse();let s;return s=this._chainOrCallSubCommandHook(s,n,"preSubcommand"),s=this._chainOrCall(s,()=>{if(n._executableHandler)this._executeSubCommand(n,r.concat(i));else return n._parseCommand(r,i)}),s}_dispatchHelpCommand(t){t||this.help();let r=this._findCommand(t);return r&&!r._executableHandler&&r.help(),this._dispatchSubcommand(t,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((t,r)=>{t.required&&this.args[r]==null&&this.missingArgument(t.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let t=(i,n,s)=>{let o=n;if(n!==null&&i.parseArg){let a=`error: command-argument value '${n}' is invalid for argument '${i.name()}'.`;o=this._callParseArg(i,n,s,a)}return o};this._checkNumberOfArguments();let r=[];this.registeredArguments.forEach((i,n)=>{let s=i.defaultValue;i.variadic?n<this.args.length?(s=this.args.slice(n),i.parseArg&&(s=s.reduce((o,a)=>t(i,a,o),i.defaultValue))):s===void 0&&(s=[]):n<this.args.length&&(s=this.args[n],i.parseArg&&(s=t(i,s,i.defaultValue))),r[n]=s}),this.processedArgs=r}_chainOrCall(t,r){return t?.then&&typeof t.then=="function"?t.then(()=>r()):r()}_chainOrCallHooks(t,r){let i=t,n=[];return this._getCommandAndAncestors().reverse().filter(s=>s._lifeCycleHooks[r]!==void 0).forEach(s=>{s._lifeCycleHooks[r].forEach(o=>{n.push({hookedCommand:s,callback:o})})}),r==="postAction"&&n.reverse(),n.forEach(s=>{i=this._chainOrCall(i,()=>s.callback(s.hookedCommand,this))}),i}_chainOrCallSubCommandHook(t,r,i){let n=t;return this._lifeCycleHooks[i]!==void 0&&this._lifeCycleHooks[i].forEach(s=>{n=this._chainOrCall(n,()=>s(this,r))}),n}_parseCommand(t,r){let i=this.parseOptions(r);if(this._parseOptionsEnv(),this._parseOptionsImplied(),t=t.concat(i.operands),r=i.unknown,this.args=t.concat(r),t&&this._findCommand(t[0]))return this._dispatchSubcommand(t[0],t.slice(1),r);if(this._getHelpCommand()&&t[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(t[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(r),this._dispatchSubcommand(this._defaultCommandName,t,r);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(i.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let n=()=>{i.unknown.length>0&&this.unknownOption(i.unknown[0])},s=`command:${this.name()}`;if(this._actionHandler){n(),this._processArguments();let o;return o=this._chainOrCallHooks(o,"preAction"),o=this._chainOrCall(o,()=>this._actionHandler(this.processedArgs)),this.parent&&(o=this._chainOrCall(o,()=>{this.parent.emit(s,t,r)})),o=this._chainOrCallHooks(o,"postAction"),o}if(this.parent?.listenerCount(s))n(),this._processArguments(),this.parent.emit(s,t,r);else if(t.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",t,r);this.listenerCount("command:*")?this.emit("command:*",t,r):this.commands.length?this.unknownCommand():(n(),this._processArguments())}else this.commands.length?(n(),this.help({error:!0})):(n(),this._processArguments())}_findCommand(t){if(t)return this.commands.find(r=>r._name===t||r._aliases.includes(t))}_findOption(t){return this.options.find(r=>r.is(t))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(t=>{t.options.forEach(r=>{r.mandatory&&t.getOptionValue(r.attributeName())===void 0&&t.missingMandatoryOptionValue(r)})})}_checkForConflictingLocalOptions(){let t=this.options.filter(i=>{let n=i.attributeName();return this.getOptionValue(n)===void 0?!1:this.getOptionValueSource(n)!=="default"});t.filter(i=>i.conflictsWith.length>0).forEach(i=>{let n=t.find(s=>i.conflictsWith.includes(s.attributeName()));n&&this._conflictingOption(i,n)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(t=>{t._checkForConflictingLocalOptions()})}parseOptions(t){let r=[],i=[],n=r;function s(p){return p.length>1&&p[0]==="-"}let o=p=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(p)?!this._getCommandAndAncestors().some(u=>u.options.map(l=>l.short).some(l=>/^-\d$/.test(l))):!1,a=null,c=null,d=0;for(;d<t.length||c;){let p=c??t[d++];if(c=null,p==="--"){n===i&&n.push(p),n.push(...t.slice(d));break}if(a&&(!s(p)||o(p))){this.emit(`option:${a.name()}`,p);continue}if(a=null,s(p)){let u=this._findOption(p);if(u){if(u.required){let l=t[d++];l===void 0&&this.optionMissingArgument(u),this.emit(`option:${u.name()}`,l)}else if(u.optional){let l=null;d<t.length&&(!s(t[d])||o(t[d]))&&(l=t[d++]),this.emit(`option:${u.name()}`,l)}else this.emit(`option:${u.name()}`);a=u.variadic?u:null;continue}}if(p.length>2&&p[0]==="-"&&p[1]!=="-"){let u=this._findOption(`-${p[1]}`);if(u){u.required||u.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${u.name()}`,p.slice(2)):(this.emit(`option:${u.name()}`),c=`-${p.slice(2)}`);continue}}if(/^--[^=]+=/.test(p)){let u=p.indexOf("="),l=this._findOption(p.slice(0,u));if(l&&(l.required||l.optional)){this.emit(`option:${l.name()}`,p.slice(u+1));continue}}if(n===r&&s(p)&&!(this.commands.length===0&&o(p))&&(n=i),(this._enablePositionalOptions||this._passThroughOptions)&&r.length===0&&i.length===0){if(this._findCommand(p)){r.push(p),i.push(...t.slice(d));break}else if(this._getHelpCommand()&&p===this._getHelpCommand().name()){r.push(p,...t.slice(d));break}else if(this._defaultCommandName){i.push(p,...t.slice(d));break}}if(this._passThroughOptions){n.push(p,...t.slice(d));break}n.push(p)}return{operands:r,unknown:i}}opts(){if(this._storeOptionsAsProperties){let t={},r=this.options.length;for(let i=0;i<r;i++){let n=this.options[i].attributeName();t[n]=n===this._versionOptionName?this._version:this[n]}return t}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((t,r)=>Object.assign(t,r.opts()),{})}error(t,r){this._outputConfiguration.outputError(`${t}
24
24
  `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
25
25
  `):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
26
- `),this.outputHelp({error:!0}));let i=r||{},n=i.exitCode||1,s=i.code||"commander.error";this._exit(n,s,t)}_parseOptionsEnv(){this.options.forEach(t=>{if(t.envVar&&t.envVar in P.env){let r=t.attributeName();(this.getOptionValue(r)===void 0||["default","config","env"].includes(this.getOptionValueSource(r)))&&(t.required||t.optional?this.emit(`optionEnv:${t.name()}`,P.env[t.envVar]):this.emit(`optionEnv:${t.name()}`))}})}_parseOptionsImplied(){let t=new xh(this.options),r=i=>this.getOptionValue(i)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(i));this.options.filter(i=>i.implied!==void 0&&r(i.attributeName())&&t.valueFromOption(this.getOptionValue(i.attributeName()),i)).forEach(i=>{Object.keys(i.implied).filter(n=>!r(n)).forEach(n=>{this.setOptionValueWithSource(n,i.implied[n],"implied")})})}missingArgument(t){let r=`error: missing required argument '${t}'`;this.error(r,{code:"commander.missingArgument"})}optionMissingArgument(t){let r=`error: option '${t.flags}' argument missing`;this.error(r,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(t){let r=`error: required option '${t.flags}' not specified`;this.error(r,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(t,r){let i=o=>{let a=o.attributeName(),c=this.getOptionValue(a),d=this.options.find(u=>u.negate&&a===u.attributeName()),p=this.options.find(u=>!u.negate&&a===u.attributeName());return d&&(d.presetArg===void 0&&c===!1||d.presetArg!==void 0&&c===d.presetArg)?d:p||o},n=o=>{let a=i(o),c=a.attributeName();return this.getOptionValueSource(c)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},s=`error: ${n(t)} cannot be used with ${n(r)}`;this.error(s,{code:"commander.conflictingOption"})}unknownOption(t){if(this._allowUnknownOption)return;let r="";if(t.startsWith("--")&&this._showSuggestionAfterError){let n=[],s=this;do{let o=s.createHelp().visibleOptions(s).filter(a=>a.long).map(a=>a.long);n=n.concat(o),s=s.parent}while(s&&!s._enablePositionalOptions);r=Ho(t,n)}let i=`error: unknown option '${t}'${r}`;this.error(i,{code:"commander.unknownOption"})}_excessArguments(t){if(this._allowExcessArguments)return;let r=this.registeredArguments.length,i=r===1?"":"s",s=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${r} argument${i} but got ${t.length}.`;this.error(s,{code:"commander.excessArguments"})}unknownCommand(){let t=this.args[0],r="";if(this._showSuggestionAfterError){let n=[];this.createHelp().visibleCommands(this).forEach(s=>{n.push(s.name()),s.alias()&&n.push(s.alias())}),r=Ho(t,n)}let i=`error: unknown command '${t}'${r}`;this.error(i,{code:"commander.unknownCommand"})}version(t,r,i){if(t===void 0)return this._version;this._version=t,r=r||"-V, --version",i=i||"output the version number";let n=this.createOption(r,i);return this._versionOptionName=n.attributeName(),this._registerOption(n),this.on("option:"+n.name(),()=>{this._outputConfiguration.writeOut(`${t}
27
- `),this._exit(0,"commander.version",t)}),this}description(t,r){return t===void 0&&r===void 0?this._description:(this._description=t,r&&(this._argsDescription=r),this)}summary(t){return t===void 0?this._summary:(this._summary=t,this)}alias(t){if(t===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]),t===r._name)throw new Error("Command alias can't be the same as its name");let i=this.parent?._findCommand(t);if(i){let n=[i.name()].concat(i.aliases()).join("|");throw new Error(`cannot add alias '${t}' to command '${this.name()}' as already have command '${n}'`)}return r._aliases.push(t),this}aliases(t){return t===void 0?this._aliases:(t.forEach(r=>this.alias(r)),this)}usage(t){if(t===void 0){if(this._usage)return this._usage;let r=this.registeredArguments.map(i=>gh(i));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?r:[]).join(" ")}return this._usage=t,this}name(t){return t===void 0?this._name:(this._name=t,this)}helpGroup(t){return t===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=t,this)}commandsGroup(t){return t===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=t,this)}optionsGroup(t){return t===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=t,this)}_initOptionGroup(t){this._defaultOptionGroup&&!t.helpGroupHeading&&t.helpGroup(this._defaultOptionGroup)}_initCommandGroup(t){this._defaultCommandGroup&&!t.helpGroup()&&t.helpGroup(this._defaultCommandGroup)}nameFromFilename(t){return this._name=De.basename(t,De.extname(t)),this}executableDir(t){return t===void 0?this._executableDir:(this._executableDir=t,this)}helpInformation(t){let r=this.createHelp(),i=this._getOutputContext(t);r.prepareContext({error:i.error,helpWidth:i.helpWidth,outputHasColors:i.hasColors});let n=r.formatHelp(this,r);return i.hasColors?n:this._outputConfiguration.stripColor(n)}_getOutputContext(t){t=t||{};let r=!!t.error,i,n,s;return r?(i=a=>this._outputConfiguration.writeErr(a),n=this._outputConfiguration.getErrHasColors(),s=this._outputConfiguration.getErrHelpWidth()):(i=a=>this._outputConfiguration.writeOut(a),n=this._outputConfiguration.getOutHasColors(),s=this._outputConfiguration.getOutHelpWidth()),{error:r,write:a=>(n||(a=this._outputConfiguration.stripColor(a)),i(a)),hasColors:n,helpWidth:s}}outputHelp(t){let r;typeof t=="function"&&(r=t,t=void 0);let i=this._getOutputContext(t),n={error:i.error,write:i.write,command:this};this._getCommandAndAncestors().reverse().forEach(o=>o.emit("beforeAllHelp",n)),this.emit("beforeHelp",n);let s=this.helpInformation({error:i.error});if(r&&(s=r(s),typeof s!="string"&&!Buffer.isBuffer(s)))throw new Error("outputHelp callback must return a string or a Buffer");i.write(s),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",n),this._getCommandAndAncestors().forEach(o=>o.emit("afterAllHelp",n))}helpOption(t,r){return typeof t=="boolean"?(t?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(t??"-h, --help",r??"display help for command"),(t||r)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(t){return this._helpOption=t,this._initOptionGroup(t),this}help(t){this.outputHelp(t);let r=Number(P.exitCode??0);r===0&&t&&typeof t!="function"&&t.error&&(r=1),this._exit(r,"commander.help","(outputHelp)")}addHelpText(t,r){let i=["beforeAll","before","after","afterAll"];if(!i.includes(t))throw new Error(`Unexpected value for position to addHelpText.
26
+ `),this.outputHelp({error:!0}));let i=r||{},n=i.exitCode||1,s=i.code||"commander.error";this._exit(n,s,t)}_parseOptionsEnv(){this.options.forEach(t=>{if(t.envVar&&t.envVar in T.env){let r=t.attributeName();(this.getOptionValue(r)===void 0||["default","config","env"].includes(this.getOptionValueSource(r)))&&(t.required||t.optional?this.emit(`optionEnv:${t.name()}`,T.env[t.envVar]):this.emit(`optionEnv:${t.name()}`))}})}_parseOptionsImplied(){let t=new Sh(this.options),r=i=>this.getOptionValue(i)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(i));this.options.filter(i=>i.implied!==void 0&&r(i.attributeName())&&t.valueFromOption(this.getOptionValue(i.attributeName()),i)).forEach(i=>{Object.keys(i.implied).filter(n=>!r(n)).forEach(n=>{this.setOptionValueWithSource(n,i.implied[n],"implied")})})}missingArgument(t){let r=`error: missing required argument '${t}'`;this.error(r,{code:"commander.missingArgument"})}optionMissingArgument(t){let r=`error: option '${t.flags}' argument missing`;this.error(r,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(t){let r=`error: required option '${t.flags}' not specified`;this.error(r,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(t,r){let i=o=>{let a=o.attributeName(),c=this.getOptionValue(a),d=this.options.find(u=>u.negate&&a===u.attributeName()),p=this.options.find(u=>!u.negate&&a===u.attributeName());return d&&(d.presetArg===void 0&&c===!1||d.presetArg!==void 0&&c===d.presetArg)?d:p||o},n=o=>{let a=i(o),c=a.attributeName();return this.getOptionValueSource(c)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},s=`error: ${n(t)} cannot be used with ${n(r)}`;this.error(s,{code:"commander.conflictingOption"})}unknownOption(t){if(this._allowUnknownOption)return;let r="";if(t.startsWith("--")&&this._showSuggestionAfterError){let n=[],s=this;do{let o=s.createHelp().visibleOptions(s).filter(a=>a.long).map(a=>a.long);n=n.concat(o),s=s.parent}while(s&&!s._enablePositionalOptions);r=Jo(t,n)}let i=`error: unknown option '${t}'${r}`;this.error(i,{code:"commander.unknownOption"})}_excessArguments(t){if(this._allowExcessArguments)return;let r=this.registeredArguments.length,i=r===1?"":"s",s=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${r} argument${i} but got ${t.length}.`;this.error(s,{code:"commander.excessArguments"})}unknownCommand(){let t=this.args[0],r="";if(this._showSuggestionAfterError){let n=[];this.createHelp().visibleCommands(this).forEach(s=>{n.push(s.name()),s.alias()&&n.push(s.alias())}),r=Jo(t,n)}let i=`error: unknown command '${t}'${r}`;this.error(i,{code:"commander.unknownCommand"})}version(t,r,i){if(t===void 0)return this._version;this._version=t,r=r||"-V, --version",i=i||"output the version number";let n=this.createOption(r,i);return this._versionOptionName=n.attributeName(),this._registerOption(n),this.on("option:"+n.name(),()=>{this._outputConfiguration.writeOut(`${t}
27
+ `),this._exit(0,"commander.version",t)}),this}description(t,r){return t===void 0&&r===void 0?this._description:(this._description=t,r&&(this._argsDescription=r),this)}summary(t){return t===void 0?this._summary:(this._summary=t,this)}alias(t){if(t===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]),t===r._name)throw new Error("Command alias can't be the same as its name");let i=this.parent?._findCommand(t);if(i){let n=[i.name()].concat(i.aliases()).join("|");throw new Error(`cannot add alias '${t}' to command '${this.name()}' as already have command '${n}'`)}return r._aliases.push(t),this}aliases(t){return t===void 0?this._aliases:(t.forEach(r=>this.alias(r)),this)}usage(t){if(t===void 0){if(this._usage)return this._usage;let r=this.registeredArguments.map(i=>wh(i));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?r:[]).join(" ")}return this._usage=t,this}name(t){return t===void 0?this._name:(this._name=t,this)}helpGroup(t){return t===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=t,this)}commandsGroup(t){return t===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=t,this)}optionsGroup(t){return t===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=t,this)}_initOptionGroup(t){this._defaultOptionGroup&&!t.helpGroupHeading&&t.helpGroup(this._defaultOptionGroup)}_initCommandGroup(t){this._defaultCommandGroup&&!t.helpGroup()&&t.helpGroup(this._defaultCommandGroup)}nameFromFilename(t){return this._name=Me.basename(t,Me.extname(t)),this}executableDir(t){return t===void 0?this._executableDir:(this._executableDir=t,this)}helpInformation(t){let r=this.createHelp(),i=this._getOutputContext(t);r.prepareContext({error:i.error,helpWidth:i.helpWidth,outputHasColors:i.hasColors});let n=r.formatHelp(this,r);return i.hasColors?n:this._outputConfiguration.stripColor(n)}_getOutputContext(t){t=t||{};let r=!!t.error,i,n,s;return r?(i=a=>this._outputConfiguration.writeErr(a),n=this._outputConfiguration.getErrHasColors(),s=this._outputConfiguration.getErrHelpWidth()):(i=a=>this._outputConfiguration.writeOut(a),n=this._outputConfiguration.getOutHasColors(),s=this._outputConfiguration.getOutHelpWidth()),{error:r,write:a=>(n||(a=this._outputConfiguration.stripColor(a)),i(a)),hasColors:n,helpWidth:s}}outputHelp(t){let r;typeof t=="function"&&(r=t,t=void 0);let i=this._getOutputContext(t),n={error:i.error,write:i.write,command:this};this._getCommandAndAncestors().reverse().forEach(o=>o.emit("beforeAllHelp",n)),this.emit("beforeHelp",n);let s=this.helpInformation({error:i.error});if(r&&(s=r(s),typeof s!="string"&&!Buffer.isBuffer(s)))throw new Error("outputHelp callback must return a string or a Buffer");i.write(s),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",n),this._getCommandAndAncestors().forEach(o=>o.emit("afterAllHelp",n))}helpOption(t,r){return typeof t=="boolean"?(t?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(t??"-h, --help",r??"display help for command"),(t||r)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(t){return this._helpOption=t,this._initOptionGroup(t),this}help(t){this.outputHelp(t);let r=Number(T.exitCode??0);r===0&&t&&typeof t!="function"&&t.error&&(r=1),this._exit(r,"commander.help","(outputHelp)")}addHelpText(t,r){let i=["beforeAll","before","after","afterAll"];if(!i.includes(t))throw new Error(`Unexpected value for position to addHelpText.
28
28
  Expecting one of '${i.join("', '")}'`);let n=`${t}Help`;return this.on(n,s=>{let o;typeof r=="function"?o=r({error:s.error,command:s.command}):o=r,o&&s.write(`${o}
29
- `)}),this}_outputHelpIfRequested(t){let r=this._getHelpOption();r&&t.find(n=>r.is(n))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function Ko(e){return e.map(t=>{if(!t.startsWith("--inspect"))return t;let r,i="127.0.0.1",n="9229",s;return(s=t.match(/^(--inspect(-brk)?)$/))!==null?r=s[1]:(s=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(r=s[1],/^\d+$/.test(s[3])?n=s[3]:i=s[3]):(s=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(r=s[1],i=s[3],n=s[4]),r&&n!=="0"?`${r}=${i}:${parseInt(n)+1}`:t})}function kn(){if(P.env.NO_COLOR||P.env.FORCE_COLOR==="0"||P.env.FORCE_COLOR==="false")return!1;if(P.env.FORCE_COLOR||P.env.CLICOLOR_FORCE!==void 0)return!0}vn.Command=wn;vn.useColor=kn});var Zo=S(de=>{"use strict";var{Argument:Jo}=wr(),{Command:qn}=Yo(),{CommanderError:wh,InvalidArgumentError:Xo}=Ft(),{Help:kh}=hn(),{Option:Qo}=_n();de.program=new qn;de.createCommand=e=>new qn(e);de.createOption=(e,t)=>new Qo(e,t);de.createArgument=(e,t)=>new Jo(e,t);de.Command=qn;de.Option=Qo;de.Argument=Jo;de.Help=kh;de.CommanderError=wh;de.InvalidArgumentError=Xo;de.InvalidOptionArgumentError=Xo});var X=S((Zv,Sn)=>{"use strict";var qr=process||{},ia=qr.argv||[],vr=qr.env||{},vh=!(vr.NO_COLOR||ia.includes("--no-color"))&&(!!vr.FORCE_COLOR||ia.includes("--color")||qr.platform==="win32"||(qr.stdout||{}).isTTY&&vr.TERM!=="dumb"||!!vr.CI),qh=(e,t,r=e)=>i=>{let n=""+i,s=n.indexOf(t,e.length);return~s?e+Sh(n,t,r,s)+t:e+n+t},Sh=(e,t,r,i)=>{let n="",s=0;do n+=e.substring(s,i)+r,s=i+t.length,i=e.indexOf(t,s);while(~i);return n+e.substring(s)},na=(e=vh)=>{let t=e?qh:()=>String;return{isColorSupported:e,reset:t("\x1B[0m","\x1B[0m"),bold:t("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:t("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:t("\x1B[3m","\x1B[23m"),underline:t("\x1B[4m","\x1B[24m"),inverse:t("\x1B[7m","\x1B[27m"),hidden:t("\x1B[8m","\x1B[28m"),strikethrough:t("\x1B[9m","\x1B[29m"),black:t("\x1B[30m","\x1B[39m"),red:t("\x1B[31m","\x1B[39m"),green:t("\x1B[32m","\x1B[39m"),yellow:t("\x1B[33m","\x1B[39m"),blue:t("\x1B[34m","\x1B[39m"),magenta:t("\x1B[35m","\x1B[39m"),cyan:t("\x1B[36m","\x1B[39m"),white:t("\x1B[37m","\x1B[39m"),gray:t("\x1B[90m","\x1B[39m"),bgBlack:t("\x1B[40m","\x1B[49m"),bgRed:t("\x1B[41m","\x1B[49m"),bgGreen:t("\x1B[42m","\x1B[49m"),bgYellow:t("\x1B[43m","\x1B[49m"),bgBlue:t("\x1B[44m","\x1B[49m"),bgMagenta:t("\x1B[45m","\x1B[49m"),bgCyan:t("\x1B[46m","\x1B[49m"),bgWhite:t("\x1B[47m","\x1B[49m"),blackBright:t("\x1B[90m","\x1B[39m"),redBright:t("\x1B[91m","\x1B[39m"),greenBright:t("\x1B[92m","\x1B[39m"),yellowBright:t("\x1B[93m","\x1B[39m"),blueBright:t("\x1B[94m","\x1B[39m"),magentaBright:t("\x1B[95m","\x1B[39m"),cyanBright:t("\x1B[96m","\x1B[39m"),whiteBright:t("\x1B[97m","\x1B[39m"),bgBlackBright:t("\x1B[100m","\x1B[49m"),bgRedBright:t("\x1B[101m","\x1B[49m"),bgGreenBright:t("\x1B[102m","\x1B[49m"),bgYellowBright:t("\x1B[103m","\x1B[49m"),bgBlueBright:t("\x1B[104m","\x1B[49m"),bgMagentaBright:t("\x1B[105m","\x1B[49m"),bgCyanBright:t("\x1B[106m","\x1B[49m"),bgWhiteBright:t("\x1B[107m","\x1B[49m")}};Sn.exports=na();Sn.exports.createColors=na});var An=S(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.DEFAULT_COLOR_MAP=void 0;gt.DEFAULT_COLOR_MAP={red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",white_bold:"\x1B[01m",reset:"\x1B[0m"};var $n=class{constructor(t=gt.DEFAULT_COLOR_MAP){this.text="",this.colorMap=t}addCharsWithColor(t,r){let i=this.colorMap[t];this.text+=i!==void 0?`${i}${r}${this.colorMap.reset}`:r}renderConsole(){return this.text}};gt.default=$n});var Ut=S(W=>{"use strict";Object.defineProperty(W,"__esModule",{value:!0});W.DEFAULT_HEADER_ALIGNMENT=W.DEFAULT_ROW_ALIGNMENT=W.DEFAULT_HEADER_FONT_COLOR=W.DEFAULT_ROW_FONT_COLOR=W.COLORS=W.ALIGNMENTS=W.DEFAULT_TABLE_STYLE=W.DEFAULT_ROW_SEPARATOR=W.DEFAULT_COLUMN_LEN=void 0;W.DEFAULT_COLUMN_LEN=20;W.DEFAULT_ROW_SEPARATOR=!1;W.DEFAULT_TABLE_STYLE={headerTop:{left:"\u250C",mid:"\u252C",right:"\u2510",other:"\u2500"},headerBottom:{left:"\u251C",mid:"\u253C",right:"\u2524",other:"\u2500"},tableBottom:{left:"\u2514",mid:"\u2534",right:"\u2518",other:"\u2500"},vertical:"\u2502",rowSeparator:{left:"\u251C",mid:"\u253C",right:"\u2524",other:"\u2500"}};W.ALIGNMENTS=["right","left","center"];W.COLORS=["red","green","yellow","white","blue","magenta","cyan","white_bold","reset"];W.DEFAULT_ROW_FONT_COLOR="white";W.DEFAULT_HEADER_FONT_COLOR="white_bold";W.DEFAULT_ROW_ALIGNMENT="right";W.DEFAULT_HEADER_ALIGNMENT="center"});var aa=S(Cn=>{"use strict";Object.defineProperty(Cn,"__esModule",{value:!0});var Ih=[{first:768,last:879},{first:1155,last:1158},{first:1160,last:1161},{first:1425,last:1469},{first:1471,last:1471},{first:1473,last:1474},{first:1476,last:1477},{first:1479,last:1479},{first:1536,last:1539},{first:1552,last:1557},{first:1611,last:1630},{first:1648,last:1648},{first:1750,last:1764},{first:1767,last:1768},{first:1770,last:1773},{first:1807,last:1807},{first:1809,last:1809},{first:1840,last:1866},{first:1958,last:1968},{first:2027,last:2035},{first:2305,last:2306},{first:2364,last:2364},{first:2369,last:2376},{first:2381,last:2381},{first:2385,last:2388},{first:2402,last:2403},{first:2433,last:2433},{first:2492,last:2492},{first:2497,last:2500},{first:2509,last:2509},{first:2530,last:2531},{first:2561,last:2562},{first:2620,last:2620},{first:2625,last:2626},{first:2631,last:2632},{first:2635,last:2637},{first:2672,last:2673},{first:2689,last:2690},{first:2748,last:2748},{first:2753,last:2757},{first:2759,last:2760},{first:2765,last:2765},{first:2786,last:2787},{first:2817,last:2817},{first:2876,last:2876},{first:2879,last:2879},{first:2881,last:2883},{first:2893,last:2893},{first:2902,last:2902},{first:2946,last:2946},{first:3008,last:3008},{first:3021,last:3021},{first:3134,last:3136},{first:3142,last:3144},{first:3146,last:3149},{first:3157,last:3158},{first:3260,last:3260},{first:3263,last:3263},{first:3270,last:3270},{first:3276,last:3277},{first:3298,last:3299},{first:3393,last:3395},{first:3405,last:3405},{first:3530,last:3530},{first:3538,last:3540},{first:3542,last:3542},{first:3633,last:3633},{first:3636,last:3642},{first:3655,last:3662},{first:3761,last:3761},{first:3764,last:3769},{first:3771,last:3772},{first:3784,last:3789},{first:3864,last:3865},{first:3893,last:3893},{first:3895,last:3895},{first:3897,last:3897},{first:3953,last:3966},{first:3968,last:3972},{first:3974,last:3975},{first:3984,last:3991},{first:3993,last:4028},{first:4038,last:4038},{first:4141,last:4144},{first:4146,last:4146},{first:4150,last:4151},{first:4153,last:4153},{first:4184,last:4185},{first:4448,last:4607},{first:4959,last:4959},{first:5906,last:5908},{first:5938,last:5940},{first:5970,last:5971},{first:6002,last:6003},{first:6068,last:6069},{first:6071,last:6077},{first:6086,last:6086},{first:6089,last:6099},{first:6109,last:6109},{first:6155,last:6157},{first:6313,last:6313},{first:6432,last:6434},{first:6439,last:6440},{first:6450,last:6450},{first:6457,last:6459},{first:6679,last:6680},{first:6912,last:6915},{first:6964,last:6964},{first:6966,last:6970},{first:6972,last:6972},{first:6978,last:6978},{first:7019,last:7027},{first:7616,last:7626},{first:7678,last:7679},{first:8203,last:8207},{first:8234,last:8238},{first:8288,last:8291},{first:8298,last:8303},{first:8400,last:8431},{first:12330,last:12335},{first:12441,last:12442},{first:43014,last:43014},{first:43019,last:43019},{first:43045,last:43046},{first:64286,last:64286},{first:65024,last:65039},{first:65056,last:65059},{first:65279,last:65279},{first:65529,last:65531},{first:68097,last:68099},{first:68101,last:68102},{first:68108,last:68111},{first:68152,last:68154},{first:68159,last:68159},{first:119143,last:119145},{first:119155,last:119170},{first:119173,last:119179},{first:119210,last:119213},{first:119362,last:119364},{first:917505,last:917505},{first:917536,last:917631},{first:917760,last:917999}];Cn.default=Ih});var ca=S(En=>{"use strict";Object.defineProperty(En,"__esModule",{value:!0});var Rh=(e,t,r)=>{let i=0,n,s=r;if(e<t[0].first||e>t[s].last)return 0;for(;s>=i;)if(n=Math.floor((i+s)/2),e>t[n].last)i=n+1;else if(e<t[n].first)s=n-1;else return 1;return 0};En.default=Rh});var Pn=S(Nt=>{"use strict";var da=Nt&&Nt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Nt,"__esModule",{value:!0});var pa=da(aa()),jh=da(ca()),Dh=e=>e===0?0:e<32||e>=127&&e<160?-1:(0,jh.default)(e,pa.default,pa.default.length-1)?0:1+ +(e>=4352&&(e<=4447||e===9001||e===9002||e>=11904&&e<=42191&&e!==12351||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65135||e>=65280&&e<=65376||e>=65504&&e<=65510||e>=131072&&e<=196605||e>=196608&&e<=262141));Nt.default=Dh});var ua=S(Gt=>{"use strict";var Lh=Gt&&Gt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Gt,"__esModule",{value:!0});var Mh=Lh(Pn()),Fh=e=>{let t=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r),n=(0,Mh.default)(i);if(n<0)return-1;t+=n}return t};Gt.default=Fh});var ma=S(ze=>{"use strict";var la=ze&&ze.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ze,"__esModule",{value:!0});ze.wcswidth=ze.wcwidth=void 0;var Bh=la(ua());ze.wcswidth=Bh.default;var Uh=la(Pn());ze.wcwidth=Uh.default});var Tn=S(nt=>{"use strict";Object.defineProperty(nt,"__esModule",{value:!0});nt.findWidthInConsole=nt.stripAnsi=void 0;var Nh=ma(),Gh=/\x1b\[\d{1,3}(;\d{1,3})*m/g,zh=e=>e.replace(Gh,"");nt.stripAnsi=zh;var Vh=(e,t)=>{let r=0;return e=(0,nt.stripAnsi)(e),t&&Object.entries(t).forEach(([i,n])=>{let s=new RegExp(i,"g");r+=(e.match(s)||[]).length*n,e=e.replace(i,"")}),r+=(0,Nh.wcswidth)(e),r};nt.findWidthInConsole=Vh});var In=S(ke=>{"use strict";Object.defineProperty(ke,"__esModule",{value:!0});ke.biggestWordInSentence=ke.textWithPadding=ke.splitTextIntoTextsOfMinLen=void 0;var On=Tn(),Wh=(e,t,r)=>{let i=[];return e.split(/[\n\r]/).forEach(s=>{let o=s.split(" "),a=[],c=0;o.forEach(d=>{let p=(0,On.findWidthInConsole)(d,r);c+p<=t?(c+=p+1,a.push(d)):(a.length>0&&i.push(a.join(" ")),a=[d],c=p+1)}),i.push(a.join(" "))}),i};ke.splitTextIntoTextsOfMinLen=Wh;var Hh=(e,t,r,i)=>{let n=(0,On.findWidthInConsole)(e,i),s=Math.floor((r-n)/2),o=r-s-n;if(r<n){let a=(0,ke.splitTextIntoTextsOfMinLen)(e,r);return a.length===1?e:a.map(c=>(0,ke.textWithPadding)(c,t,r,i)).join(`
30
- `)}switch(t){case"left":return e.concat(" ".repeat(r-n));case"center":return" ".repeat(s).concat(e).concat(" ".repeat(o));default:return" ".repeat(r-n).concat(e)}};ke.textWithPadding=Hh;var Kh=(e,t)=>e.split(" ").reduce((r,i)=>Math.max(r,(0,On.findWidthInConsole)(i,t)),0);ke.biggestWordInSentence=Kh});var zt=S(M=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0});M.getWidthLimitedColumnsArray=M.createHeaderAsRow=M.renderTableHorizontalBorders=M.findLenOfColumn=M.createRow=M.createColumFromOnlyName=M.createTableHorizontalBorders=M.convertRawRowOptionsToStandard=M.evaluateCellText=M.cellText=void 0;var ha=Tn(),Rn=In(),jn=Ut(),_t=(e,t)=>Math.max(e,t),Yh=e=>e==null?"":`${e}`;M.cellText=Yh;var Jh=(e,t)=>t?`${t(e)}`:(0,M.cellText)(e);M.evaluateCellText=Jh;var Xh=e=>{if(e)return{color:e.color,separator:e.separator||jn.DEFAULT_ROW_SEPARATOR}};M.convertRawRowOptionsToStandard=Xh;var Qh=({left:e,mid:t,right:r,other:i},n)=>{let s=e;return n.forEach(o=>{s+=i.repeat(o+2),s+=t}),s=s.slice(0,-t.length),s+=r,s};M.createTableHorizontalBorders=Qh;var Zh=e=>({name:e,title:e});M.createColumFromOnlyName=Zh;var ey=(e,t,r)=>({color:e,separator:r,text:t});M.createRow=ey;var ty=(e,t,r)=>{let i=e.name,n=e.title,s=e.transform,o=_t(0,e?.minLen||0);return e.maxLen?(o=_t(o,_t(e.maxLen,(0,Rn.biggestWordInSentence)(n,r))),o=t.reduce((a,c)=>_t(a,(0,Rn.biggestWordInSentence)((0,M.evaluateCellText)(c.text[i],s),r)),o),o):(o=_t(o,(0,ha.findWidthInConsole)(n,r)),t.forEach(a=>{o=_t(o,(0,ha.findWidthInConsole)((0,M.evaluateCellText)(a.text[i],s),r))}),o)};M.findLenOfColumn=ty;var ry=(e,t)=>(0,M.createTableHorizontalBorders)(e,t);M.renderTableHorizontalBorders=ry;var iy=(e,t)=>{let r=jn.DEFAULT_HEADER_FONT_COLOR,i=e(r,{},!1);return t.forEach(n=>{i.text[n.name]=n.title}),i};M.createHeaderAsRow=iy;var ny=(e,t,r)=>{let i={};return e.forEach(n=>{i[n.name]=(0,Rn.splitTextIntoTextsOfMinLen)((0,M.cellText)(t.text[n.name]),n.length||jn.DEFAULT_COLUMN_LEN,r)}),i};M.getWidthLimitedColumnsArray=ny});var ya=S(Le=>{"use strict";Object.defineProperty(Le,"__esModule",{value:!0});Le.rawColumnToInternalColumn=Le.objIfExists=void 0;var sy=Ut(),oy=(e,t)=>t?{[e]:t}:{};Le.objIfExists=oy;var ay=(e,t)=>{var r;return Object.assign(Object.assign(Object.assign(Object.assign({name:e.name,title:(r=e.title)!==null&&r!==void 0?r:e.name},(0,Le.objIfExists)("color",e.color||t?.color)),(0,Le.objIfExists)("maxLen",e.maxLen||t?.maxLen)),(0,Le.objIfExists)("minLen",e.minLen||t?.minLen)),{alignment:e.alignment||t?.alignment||sy.DEFAULT_ROW_ALIGNMENT,transform:e.transform})};Le.rawColumnToInternalColumn=ay});var fa=S(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.preProcessRows=bt.preProcessColumns=void 0;var cy=zt(),py=e=>{e.computedColumns.length&&e.computedColumns.forEach(t=>{e.columns.some(i=>i.name===t.name)||(e.addColumn(Object.assign(Object.assign({},t),e.defaultColumnOptions)),e.rows.forEach((i,n,s)=>{let o=s.map(a=>a.text);i.text[t.name]=t.function(i.text,n,o)}))})},dy=e=>{e.enabledColumns.length&&(e.columns=e.columns.filter(t=>e.enabledColumns.includes(t.name)))},uy=e=>{e.disabledColumns.length&&(e.columns=e.columns.filter(t=>!e.disabledColumns.includes(t.name)))},ly=e=>{e.columns.forEach(t=>{t.length=(0,cy.findLenOfColumn)(t,e.rows,e.charLength)})},my=e=>{py(e),uy(e),dy(e),ly(e)};bt.preProcessColumns=my;var hy=e=>{let t=e.rows.filter(r=>e.filterFunction(r.text)).sort((r,i)=>e.sortFunction(r.text,i.text));e.rows=t};bt.preProcessRows=hy});var Dn=S(ue=>{"use strict";var _a=ue&&ue.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ue,"__esModule",{value:!0});ue.printSimpleTable=ue.renderSimpleTable=ue.renderTable=void 0;var ba=_a(An()),xa=In(),fe=Ut(),Ve=zt(),yy=_a(Ln()),ga=fa(),fy=(e,t,r,i,n,s,o,a)=>{let c=new ba.default(o);return c.addCharsWithColor("",e.vertical),t.forEach(d=>{let u=r<i[d.name].length?(0,Ve.cellText)(i[d.name][r]):"";c.addCharsWithColor(fe.DEFAULT_ROW_FONT_COLOR," "),c.addCharsWithColor(n&&fe.DEFAULT_HEADER_FONT_COLOR||d.color||s.color,(0,xa.textWithPadding)(u,d.alignment||fe.DEFAULT_ROW_ALIGNMENT,d.length||fe.DEFAULT_COLUMN_LEN,a)),c.addCharsWithColor("",` ${e.vertical}`)}),c.renderConsole()},wa=(e,t,r,i,n,s)=>{let o=(0,Ve.getWidthLimitedColumnsArray)(t,r,s),a=Object.values(o).reduce((d,p)=>Math.max(d,p.length),0),c=[];for(let d=0;d<a;d+=1){let p=fy(e,t,d,o,n,r,i,s);c.push(p)}return c},gy=(e,t)=>{let r=JSON.parse(JSON.stringify(e)),i={};return t.filter(n=>!!n.transform).forEach(n=>{i[n.name]=n.transform}),Object.keys(i).forEach(n=>{r.text[n]=i[n](r.text[n])}),r},_y=(e,t)=>{let r=[],i=gy(t,e.columns);return r=r.concat(wa(e.tableStyle,e.columns,i,e.colorMap,void 0,e.charLength)),r},by=e=>{let t=[];if(e.title===void 0)return t;let r=()=>{let s=(o,a)=>o+a+2+1;return e.columns.map(o=>o.length||fe.DEFAULT_COLUMN_LEN).reduce(s,1)},i=(0,xa.textWithPadding)(e.title,fe.DEFAULT_HEADER_ALIGNMENT,r()),n=new ba.default(e.colorMap);return n.addCharsWithColor(fe.DEFAULT_HEADER_FONT_COLOR,i),t.push(n.renderConsole()),t},xy=e=>{let t=[];t.push((0,Ve.renderTableHorizontalBorders)(e.tableStyle.headerTop,e.columns.map(i=>i.length||fe.DEFAULT_COLUMN_LEN)));let r=(0,Ve.createHeaderAsRow)(Ve.createRow,e.columns);return t=t.concat(wa(e.tableStyle,e.columns,r,e.colorMap,!0)),t.push((0,Ve.renderTableHorizontalBorders)(e.tableStyle.headerBottom,e.columns.map(i=>i.length||fe.DEFAULT_COLUMN_LEN))),t},wy=e=>{let t=[];return t.push((0,Ve.renderTableHorizontalBorders)(e.tableStyle.tableBottom,e.columns.map(r=>r.length||fe.DEFAULT_COLUMN_LEN))),t},ky=(e,t)=>{let r=[],i=e.rows.length-1;return e.rows.indexOf(t)!==i&&t.separator&&r.push((0,Ve.renderTableHorizontalBorders)(e.tableStyle.rowSeparator,e.columns.map(s=>s.length||fe.DEFAULT_COLUMN_LEN))),r},vy=e=>{(0,ga.preProcessColumns)(e),(0,ga.preProcessRows)(e);let t=[];return by(e).forEach(r=>t.push(r)),xy(e).forEach(r=>t.push(r)),e.rows.forEach(r=>{_y(e,r).forEach(i=>t.push(i)),ky(e,r).forEach(i=>t.push(i))}),wy(e).forEach(r=>t.push(r)),t.join(`
31
- `)};ue.renderTable=vy;var qy=(e,t)=>{let r=new yy.default(t);return r.addRows(e),(0,ue.renderTable)(r)};ue.renderSimpleTable=qy;var Sy=(e,t)=>{console.log((0,ue.renderSimpleTable)(e,t))};ue.printSimpleTable=Sy});var Ln=S(Un=>{"use strict";Object.defineProperty(Un,"__esModule",{value:!0});var $y=An(),Sr=Ut(),Mn=zt(),Fn=ya(),Ay=Dn(),Cy=()=>0,Ey=()=>!0,Bn=class{initSimple(t){this.columns=t.map(r=>({name:r,title:r,alignment:Sr.DEFAULT_ROW_ALIGNMENT}))}initDetailed(t){var r;this.title=t?.title||this.title,this.tableStyle=Object.assign(Object.assign({},this.tableStyle),t?.style),this.sortFunction=t?.sort||this.sortFunction,this.filterFunction=t?.filter||this.filterFunction,this.enabledColumns=t?.enabledColumns||this.enabledColumns,this.disabledColumns=t?.disabledColumns||this.disabledColumns,this.computedColumns=t?.computedColumns||this.computedColumns,this.columns=((r=t?.columns)===null||r===void 0?void 0:r.map(i=>(0,Fn.rawColumnToInternalColumn)(i,t?.defaultColumnOptions)))||this.columns,this.rowSeparator=t?.rowSeparator||this.rowSeparator,this.charLength=t?.charLength||this.charLength,this.defaultColumnOptions=t?.defaultColumnOptions||this.defaultColumnOptions,t?.shouldDisableColors?this.colorMap={}:t?.colorMap&&(this.colorMap=Object.assign(Object.assign({},this.colorMap),t.colorMap)),t.rows!==void 0&&this.addRows(t.rows)}constructor(t){this.rows=[],this.columns=[],this.title=void 0,this.tableStyle=Sr.DEFAULT_TABLE_STYLE,this.filterFunction=Ey,this.sortFunction=Cy,this.enabledColumns=[],this.disabledColumns=[],this.computedColumns=[],this.rowSeparator=Sr.DEFAULT_ROW_SEPARATOR,this.colorMap=$y.DEFAULT_COLOR_MAP,this.charLength={},this.defaultColumnOptions=void 0,this.transforms={},t instanceof Array?this.initSimple(t):typeof t=="object"&&this.initDetailed(t)}createColumnFromRow(t){let r=this.columns.map(i=>i.name);Object.keys(t).forEach(i=>{r.includes(i)||this.columns.push((0,Fn.rawColumnToInternalColumn)((0,Mn.createColumFromOnlyName)(i),this.defaultColumnOptions))})}addColumn(t){let r=typeof t=="string"?(0,Mn.createColumFromOnlyName)(t):t;this.columns.push((0,Fn.rawColumnToInternalColumn)(r,this.defaultColumnOptions))}addColumns(t){t.forEach(r=>{this.addColumn(r)})}addRow(t,r){this.createColumnFromRow(t),this.rows.push((0,Mn.createRow)(r?.color||Sr.DEFAULT_ROW_FONT_COLOR,t,r?.separator!==void 0?r?.separator:this.rowSeparator))}addRows(t,r){t.forEach(i=>{this.addRow(i,r)})}renderTable(){return(0,Ay.renderTable)(this)}};Un.default=Bn});var va=S(Vt=>{"use strict";var Py=Vt&&Vt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Vt,"__esModule",{value:!0});var Ty=Py(Ln()),ka=zt(),Nn=class{constructor(t){this.table=new Ty.default(t)}addColumn(t){return this.table.addColumn(t),this}addColumns(t){return this.table.addColumns(t),this}addRow(t,r){return this.table.addRow(t,(0,ka.convertRawRowOptionsToStandard)(r)),this}addRows(t,r){return this.table.addRows(t,(0,ka.convertRawRowOptionsToStandard)(r)),this}printTable(){let t=this.table.renderTable();console.log(t)}render(){return this.table.renderTable()}};Vt.default=Nn});var Wt=S(ve=>{"use strict";var Oy=ve&&ve.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ve,"__esModule",{value:!0});ve.renderTable=ve.printTable=ve.Table=void 0;var Iy=Oy(va());ve.Table=Iy.default;var qa=Dn();Object.defineProperty(ve,"printTable",{enumerable:!0,get:function(){return qa.printSimpleTable}});Object.defineProperty(ve,"renderTable",{enumerable:!0,get:function(){return qa.renderSimpleTable}})});var nc=S((c$,ic)=>{"use strict";ic.exports=rc;rc.sync=Ff;var ec=oe("fs");function Mf(e,t){var r=t.pathExt!==void 0?t.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var i=0;i<r.length;i++){var n=r[i].toLowerCase();if(n&&e.substr(-n.length).toLowerCase()===n)return!0}return!1}function tc(e,t,r){return!e.isSymbolicLink()&&!e.isFile()?!1:Mf(t,r)}function rc(e,t,r){ec.stat(e,function(i,n){r(i,i?!1:tc(n,e,t))})}function Ff(e,t){return tc(ec.statSync(e),e,t)}});var pc=S((p$,cc)=>{"use strict";cc.exports=oc;oc.sync=Bf;var sc=oe("fs");function oc(e,t,r){sc.stat(e,function(i,n){r(i,i?!1:ac(n,t))})}function Bf(e,t){return ac(sc.statSync(e),t)}function ac(e,t){return e.isFile()&&Uf(e,t)}function Uf(e,t){var r=e.mode,i=e.uid,n=e.gid,s=t.uid!==void 0?t.uid:process.getuid&&process.getuid(),o=t.gid!==void 0?t.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8),d=parseInt("001",8),p=a|c,u=r&d||r&c&&n===o||r&a&&i===s||r&p&&s===0;return u}});var uc=S((u$,dc)=>{"use strict";var d$=oe("fs"),Ur;process.platform==="win32"||global.TESTING_WINDOWS?Ur=nc():Ur=pc();dc.exports=es;es.sync=Nf;function es(e,t,r){if(typeof t=="function"&&(r=t,t={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(i,n){es(e,t||{},function(s,o){s?n(s):i(o)})})}Ur(e,t||{},function(i,n){i&&(i.code==="EACCES"||t&&t.ignoreErrors)&&(i=null,n=!1),r(i,n)})}function Nf(e,t){try{return Ur.sync(e,t||{})}catch(r){if(t&&t.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var _c=S((l$,gc)=>{"use strict";var qt=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",lc=oe("path"),Gf=qt?";":":",mc=uc(),hc=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),yc=(e,t)=>{let r=t.colon||Gf,i=e.match(/\//)||qt&&e.match(/\\/)?[""]:[...qt?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],n=qt?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=qt?n.split(r):[""];return qt&&e.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:i,pathExt:s,pathExtExe:n}},fc=(e,t,r)=>{typeof t=="function"&&(r=t,t={}),t||(t={});let{pathEnv:i,pathExt:n,pathExtExe:s}=yc(e,t),o=[],a=d=>new Promise((p,u)=>{if(d===i.length)return t.all&&o.length?p(o):u(hc(e));let l=i[d],m=/^".*"$/.test(l)?l.slice(1,-1):l,h=lc.join(m,e),f=!m&&/^\.[\\\/]/.test(e)?e.slice(0,2)+h:h;p(c(f,d,0))}),c=(d,p,u)=>new Promise((l,m)=>{if(u===n.length)return l(a(p+1));let h=n[u];mc(d+h,{pathExt:s},(f,x)=>{if(!f&&x)if(t.all)o.push(d+h);else return l(d+h);return l(c(d,p,u+1))})});return r?a(0).then(d=>r(null,d),r):a(0)},zf=(e,t)=>{t=t||{};let{pathEnv:r,pathExt:i,pathExtExe:n}=yc(e,t),s=[];for(let o=0;o<r.length;o++){let a=r[o],c=/^".*"$/.test(a)?a.slice(1,-1):a,d=lc.join(c,e),p=!c&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d;for(let u=0;u<i.length;u++){let l=p+i[u];try{if(mc.sync(l,{pathExt:n}))if(t.all)s.push(l);else return l}catch{}}}if(t.all&&s.length)return s;if(t.nothrow)return null;throw hc(e)};gc.exports=fc;fc.sync=zf});var xc=S((m$,ts)=>{"use strict";var bc=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(i=>i.toUpperCase()==="PATH")||"Path"};ts.exports=bc;ts.exports.default=bc});var qc=S((h$,vc)=>{"use strict";var wc=oe("path"),Vf=_c(),Wf=xc();function kc(e,t){let r=e.options.env||process.env,i=process.cwd(),n=e.options.cwd!=null,s=n&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(e.options.cwd)}catch{}let o;try{o=Vf.sync(e.command,{path:r[Wf({env:r})],pathExt:t?wc.delimiter:void 0})}catch{}finally{s&&process.chdir(i)}return o&&(o=wc.resolve(n?e.options.cwd:"",o)),o}function Hf(e){return kc(e)||kc(e,!0)}vc.exports=Hf});var Sc=S((y$,is)=>{"use strict";var rs=/([()\][%!^"`<>&|;, *?])/g;function Kf(e){return e=e.replace(rs,"^$1"),e}function Yf(e,t){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(rs,"^$1"),t&&(e=e.replace(rs,"^$1")),e}is.exports.command=Kf;is.exports.argument=Yf});var Ac=S((f$,$c)=>{"use strict";$c.exports=/^#!(.*)/});var Ec=S((g$,Cc)=>{"use strict";var Jf=Ac();Cc.exports=(e="")=>{let t=e.match(Jf);if(!t)return null;let[r,i]=t[0].replace(/#! ?/,"").split(" "),n=r.split("/").pop();return n==="env"?i:i?`${n} ${i}`:n}});var Tc=S((_$,Pc)=>{"use strict";var ns=oe("fs"),Xf=Ec();function Qf(e){let r=Buffer.alloc(150),i;try{i=ns.openSync(e,"r"),ns.readSync(i,r,0,150,0),ns.closeSync(i)}catch{}return Xf(r.toString())}Pc.exports=Qf});var jc=S((b$,Rc)=>{"use strict";var Zf=oe("path"),Oc=qc(),Ic=Sc(),eg=Tc(),tg=process.platform==="win32",rg=/\.(?:com|exe)$/i,ig=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function ng(e){e.file=Oc(e);let t=e.file&&eg(e.file);return t?(e.args.unshift(e.file),e.command=t,Oc(e)):e.file}function sg(e){if(!tg)return e;let t=ng(e),r=!rg.test(t);if(e.options.forceShell||r){let i=ig.test(t);e.command=Zf.normalize(e.command),e.command=Ic.command(e.command),e.args=e.args.map(s=>Ic.argument(s,i));let n=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${n}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}function og(e,t,r){t&&!Array.isArray(t)&&(r=t,t=null),t=t?t.slice(0):[],r=Object.assign({},r);let i={command:e,args:t,options:r,file:void 0,original:{command:e,args:t}};return r.shell?i:sg(i)}Rc.exports=og});var Mc=S((x$,Lc)=>{"use strict";var ss=process.platform==="win32";function os(e,t){return Object.assign(new Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function ag(e,t){if(!ss)return;let r=e.emit;e.emit=function(i,n){if(i==="exit"){let s=Dc(n,t);if(s)return r.call(e,"error",s)}return r.apply(e,arguments)}}function Dc(e,t){return ss&&e===1&&!t.file?os(t.original,"spawn"):null}function cg(e,t){return ss&&e===1&&!t.file?os(t.original,"spawnSync"):null}Lc.exports={hookChildProcess:ag,verifyENOENT:Dc,verifyENOENTSync:cg,notFoundError:os}});var Uc=S((w$,St)=>{"use strict";var Fc=oe("child_process"),as=jc(),cs=Mc();function Bc(e,t,r){let i=as(e,t,r),n=Fc.spawn(i.command,i.args,i.options);return cs.hookChildProcess(n,i),n}function pg(e,t,r){let i=as(e,t,r),n=Fc.spawnSync(i.command,i.args,i.options);return n.error=n.error||cs.verifyENOENTSync(n.status,i),n}St.exports=Bc;St.exports.spawn=Bc;St.exports.sync=pg;St.exports._parse=as;St.exports._enoent=cs});var To=S((pD,cm)=>{"use strict";var Po={to(e,t){return t?`\x1B[${t+1};${e+1}H`:`\x1B[${e+1}G`},move(e,t){let r="";return e<0?r+=`\x1B[${-e}D`:e>0&&(r+=`\x1B[${e}C`),t<0?r+=`\x1B[${-t}A`:t>0&&(r+=`\x1B[${t}B`),r},up:(e=1)=>`\x1B[${e}A`,down:(e=1)=>`\x1B[${e}B`,forward:(e=1)=>`\x1B[${e}C`,backward:(e=1)=>`\x1B[${e}D`,nextLine:(e=1)=>"\x1B[E".repeat(e),prevLine:(e=1)=>"\x1B[F".repeat(e),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},jk={up:(e=1)=>"\x1B[S".repeat(e),down:(e=1)=>"\x1B[T".repeat(e)},Dk={screen:"\x1B[2J",up:(e=1)=>"\x1B[1J".repeat(e),down:(e=1)=>"\x1B[J".repeat(e),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(e){let t="";for(let r=0;r<e;r++)t+=this.line+(r<e-1?Po.up():"");return e&&(t+=Po.left),t}};cm.exports={cursor:Po,scroll:jk,erase:Dk,beep:"\x07"}});var ea=U(Zo(),1),{program:Gv,createCommand:zv,createArgument:Vv,createOption:Wv,CommanderError:Hv,InvalidArgumentError:Kv,InvalidOptionArgumentError:Yv,Command:ta,Argument:Jv,Option:ra,Help:Xv}=ea.default;var Zm=U(X(),1);function C(e){if(!e)return;let t={};return e.expand?.length&&(t.expand=e.expand.join(",")),e.fields?.length&&(t.fields=e.fields.join(",")),Object.keys(t).length>0?t:void 0}function $h(e){return e===!1?!1:{maxRetries:e?.maxRetries??2,retryOnStatus:e?.retryOnStatus??[429,500,502,503,504],baseDelay:e?.baseDelay??300,maxDelay:e?.maxDelay??1e4,retryOnNetworkError:e?.retryOnNetworkError??!0}}var Ah=new Set(["page","limit","expand","sort","fields"]);function b(e){let t={};for(let[r,i]of Object.entries(e))if(i!==void 0){if(Ah.has(r)){t[r]=Array.isArray(i)?i.join(","):i;continue}if(r.startsWith("q[")){t[r]=i;continue}if(Array.isArray(i)){let n=r.endsWith("[]")?r.slice(0,-2):r;t[`q[${n}][]`]=i}else t[`q[${r}]`]=i}return t}var it=class extends Error{code;status;details;constructor(e,t){super(e.error.message),this.name="SpreeError",this.code=e.error.code,this.status=t,this.details=e.error.details}};function sa(e,t){let r=t.baseDelay*2**e,i=Math.random()*t.baseDelay;return Math.min(r+i,t.maxDelay)}function oa(e){return new Promise(t=>setTimeout(t,e))}function Ch(){return`spree-sdk-retry-${crypto.randomUUID()}`}function Eh(e,t,r,i){return e==="GET"||e==="HEAD"||i?r.retryOnStatus.includes(t):t===429}function Ph(e,t,r){return t.retryOnNetworkError?e==="GET"||e==="HEAD"||r:!1}function Th(e,t,r,i){return async function(s,o,a={}){let{token:c,spreeToken:d,idempotencyKey:p,headers:u={},body:l,params:m}=a,h=a.locale??i?.locale,f=a.currency??i?.currency,x=a.country??i?.country,_=a.channel??i?.channel,q=typeof window<"u"?window.location.origin:void 0,A=e.baseUrl||q;if(!A)throw new TypeError("sdk-core: baseUrl is required in non-browser environments (no window.location to resolve relative URLs against)");let E=new URL(`${e.baseUrl}${t}${o}`,A);m&&Object.entries(m).forEach(([G,v])=>{if(v!==void 0)if(Array.isArray(v))for(let Oe of v)E.searchParams.append(G,String(Oe));else E.searchParams.set(G,String(v))});let w={"Content-Type":"application/json",...u};r.headerValue&&(w[r.headerName]=r.headerValue),c&&(w.Authorization=`Bearer ${c}`),d&&(w["x-spree-token"]=d),h&&(w["x-spree-locale"]=h),f&&(w["x-spree-currency"]=f),x&&(w["x-spree-country"]=x),_&&(w["x-spree-channel"]=_);let O=p??(s!=="GET"&&s!=="HEAD"&&e.retryConfig?Ch():void 0);O&&(w["Idempotency-Key"]=O);let R=!!O,F=e.retryConfig?e.retryConfig.maxRetries+1:1;for(let G=0;G<F;G++)try{let v=await e.fetchFn(E.toString(),{method:s,headers:w,body:l?JSON.stringify(l):void 0,credentials:e.credentials});if(!v.ok){if(!(G>=F-1)&&e.retryConfig&&Eh(s,v.status,e.retryConfig,R)){let B=v.headers.get("Retry-After"),se=B?Math.min(parseInt(B,10)*1e3,e.retryConfig.maxDelay):sa(G,e.retryConfig);await oa(se);continue}let Ie=await v.json();throw new it(Ie,v.status)}return v.status===204?void 0:v.status===202?v.headers.get("content-type")?.includes("application/json")?v.json():void 0:v.json()}catch(v){if(v instanceof it)throw v;if(!(G>=F-1)&&e.retryConfig&&Ph(s,e.retryConfig,R)){let Ie=sa(G,e.retryConfig);await oa(Ie);continue}throw v}throw new Error("Unexpected end of retry loop")}}var rt={"Spree::Product":"/products","Spree::Variant":"/variants","Spree::Order":"/orders","Spree::User":"/customers","Spree::Category":"/categories","Spree::OptionType":"/option_types"},Oh=class{request;constructor(e){this.request=e}parentScopedCustomFields(e){return{list:(t,r,i)=>this.request("GET",`${e}/${t}/custom_fields`,{...i,params:r?b(r):void 0}),get:(t,r,i)=>this.request("GET",`${e}/${t}/custom_fields/${r}`,i),create:(t,r,i)=>this.request("POST",`${e}/${t}/custom_fields`,{...i,body:r}),update:(t,r,i,n)=>this.request("PATCH",`${e}/${t}/custom_fields/${r}`,{...n,body:i}),delete:(t,r,i)=>this.request("DELETE",`${e}/${t}/custom_fields/${r}`,i)}}parentScopedTranslations(e){return{get:(t,r)=>this.request("GET",`${e}/${t}/translations`,r).then(i=>i.data)}}customFields(e,t){let r=rt[e];if(!r)throw new Error(`Unknown custom-field owner type: ${e}. Add it to CUSTOM_FIELD_OWNER_PATHS.`);let i=this.parentScopedCustomFields(r);return{list:(n,s)=>i.list(t,n,s),get:(n,s)=>i.get(t,n,s),create:(n,s)=>i.create(t,n,s),update:(n,s,o)=>i.update(t,n,s,o),delete:(n,s)=>i.delete(t,n,s)}}customFieldDefinitions={list:(e,t)=>this.request("GET","/custom_field_definitions",{...t,params:e?b(e):void 0}),get:(e,t)=>this.request("GET",`/custom_field_definitions/${e}`,t),create:(e,t)=>this.request("POST","/custom_field_definitions",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/custom_field_definitions/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/custom_field_definitions/${e}`,t)};auth={login:(e,t)=>this.request("POST","/auth/login",{...t,body:e}),refresh:e=>this.request("POST","/auth/refresh",e),logout:e=>this.request("POST","/auth/logout",e),lookupInvitation:(e,t,r)=>this.request("GET",`/auth/invitations/${e}/lookup`,{...r,params:{token:t}}),acceptInvitation:(e,t,r,i)=>this.request("POST",`/auth/invitations/${e}/accept`,{...i,params:{token:t},body:r})};me={get:e=>this.request("GET","/me",e),update:(e,t)=>this.request("PATCH","/me",{...t,body:e})};dashboard={analytics:(e,t)=>this.request("GET","/dashboard/analytics",{...t,params:e})};store={get:e=>this.request("GET","/store",e),update:(e,t)=>this.request("PATCH","/store",{...t,body:e})};locales={list:e=>this.request("GET","/locales",e).then(t=>t.data)};translatableResources={list:e=>this.request("GET","/translatable_resources",e).then(t=>t.data)};translations={batch:(e,t)=>this.request("POST","/translations/batch",{...t,body:{translations:e}}).then(r=>r.data)};products={list:(e,t)=>this.request("GET","/products",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/products/${e}`,{...r,params:C(t)}),create:(e,t)=>this.request("POST","/products",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/products/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/products/${e}`,t),clone:(e,t)=>this.request("POST",`/products/${e}/clone`,t),bulkStatusUpdate:(e,t)=>this.request("POST","/products/bulk_status_update",{...t,body:e}),bulkAddToCategories:(e,t)=>this.request("POST","/products/bulk_add_to_categories",{...t,body:e}),bulkRemoveFromCategories:(e,t)=>this.request("POST","/products/bulk_remove_from_categories",{...t,body:e}),bulkAddToChannels:(e,t)=>this.request("POST","/products/bulk_add_to_channels",{...t,body:e}),bulkRemoveFromChannels:(e,t)=>this.request("POST","/products/bulk_remove_from_channels",{...t,body:e}),bulkAddTags:(e,t)=>this.request("POST","/products/bulk_add_tags",{...t,body:e}),bulkRemoveTags:(e,t)=>this.request("POST","/products/bulk_remove_tags",{...t,body:e}),bulkDestroy:(e,t)=>this.request("DELETE","/products/bulk_destroy",{...t,body:e}),media:{list:(e,t,r)=>this.request("GET",`/products/${e}/media`,{...r,params:t?b(t):void 0}),create:(e,t,r)=>this.request("POST",`/products/${e}/media`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/products/${e}/media/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/products/${e}/media/${t}`,r)},variants:{list:(e,t,r)=>this.request("GET",`/products/${e}/variants`,{...r,params:t?b(t):void 0}),get:(e,t,r,i)=>this.request("GET",`/products/${e}/variants/${t}`,{...i,params:C(r)}),create:(e,t,r)=>this.request("POST",`/products/${e}/variants`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/products/${e}/variants/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/products/${e}/variants/${t}`,r),media:{list:(e,t,r,i)=>this.request("GET",`/products/${e}/variants/${t}/media`,{...i,params:r?b(r):void 0}),create:(e,t,r,i)=>this.request("POST",`/products/${e}/variants/${t}/media`,{...i,body:r}),update:(e,t,r,i,n)=>this.request("PATCH",`/products/${e}/variants/${t}/media/${r}`,{...n,body:i}),delete:(e,t,r,i)=>this.request("DELETE",`/products/${e}/variants/${t}/media/${r}`,i)}},customFields:this.parentScopedCustomFields(rt["Spree::Product"]),translations:this.parentScopedTranslations("/products")};orders={list:(e,t)=>this.request("GET","/orders",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/orders/${e}`,{...r,params:C(t)}),create:(e,t)=>this.request("POST","/orders",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/orders/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/orders/${e}`,t),complete:(e,t,r)=>this.request("PATCH",`/orders/${e}/complete`,{...r,body:t}),cancel:(e,t,r)=>this.request("PATCH",`/orders/${e}/cancel`,{...r,body:t}),approve:(e,t,r)=>this.request("PATCH",`/orders/${e}/approve`,{...r,body:t}),resume:(e,t)=>this.request("PATCH",`/orders/${e}/resume`,t),resendConfirmation:(e,t)=>this.request("POST",`/orders/${e}/resend_confirmation`,t),giftCards:{apply:(e,t,r)=>this.request("POST",`/orders/${e}/gift_cards`,{...r,body:t}),remove:(e,t,r)=>this.request("DELETE",`/orders/${e}/gift_cards/${t}`,r)},storeCredits:{apply:(e,t,r)=>this.request("POST",`/orders/${e}/store_credits`,{...r,body:t}),remove:(e,t)=>this.request("DELETE",`/orders/${e}/store_credits`,t)},items:{list:(e,t,r)=>this.request("GET",`/orders/${e}/items`,{...r,params:t?b(t):void 0}),get:(e,t,r,i)=>this.request("GET",`/orders/${e}/items/${t}`,{...i,params:C(r)}),create:(e,t,r)=>this.request("POST",`/orders/${e}/items`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/items/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/orders/${e}/items/${t}`,r)},fulfillments:{list:(e,t,r)=>this.request("GET",`/orders/${e}/fulfillments`,{...r,params:t?b(t):void 0}),get:(e,t,r,i)=>this.request("GET",`/orders/${e}/fulfillments/${t}`,{...i,params:C(r)}),update:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/fulfillments/${t}`,{...i,body:r}),fulfill:(e,t,r)=>this.request("PATCH",`/orders/${e}/fulfillments/${t}/fulfill`,r),cancel:(e,t,r)=>this.request("PATCH",`/orders/${e}/fulfillments/${t}/cancel`,r),resume:(e,t,r)=>this.request("PATCH",`/orders/${e}/fulfillments/${t}/resume`,r),split:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/fulfillments/${t}/split`,{...i,body:r})},payments:{list:(e,t,r)=>this.request("GET",`/orders/${e}/payments`,{...r,params:t?b(t):void 0}),get:(e,t,r,i)=>this.request("GET",`/orders/${e}/payments/${t}`,{...i,params:C(r)}),create:(e,t,r)=>this.request("POST",`/orders/${e}/payments`,{...r,body:t}),capture:(e,t,r)=>this.request("PATCH",`/orders/${e}/payments/${t}/capture`,r),void:(e,t,r)=>this.request("PATCH",`/orders/${e}/payments/${t}/void`,r)},refunds:{list:(e,t,r)=>this.request("GET",`/orders/${e}/refunds`,{...r,params:t?b(t):void 0}),create:(e,t,r)=>this.request("POST",`/orders/${e}/refunds`,{...r,body:t})},adjustments:{list:(e,t,r)=>this.request("GET",`/orders/${e}/adjustments`,{...r,params:t?b(t):void 0}),get:(e,t,r)=>this.request("GET",`/orders/${e}/adjustments/${t}`,r)},customFields:this.parentScopedCustomFields(rt["Spree::Order"])};optionTypes={list:(e,t)=>this.request("GET","/option_types",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/option_types/${e}`,{...r,params:C(t)}),create:(e,t)=>this.request("POST","/option_types",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/option_types/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/option_types/${e}`,t),customFields:this.parentScopedCustomFields(rt["Spree::OptionType"]),translations:this.parentScopedTranslations("/option_types")};paymentMethods={list:(e,t)=>this.request("GET","/payment_methods",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/payment_methods/${e}`,{...r,params:C(t)}),create:(e,t)=>this.request("POST","/payment_methods",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/payment_methods/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/payment_methods/${e}`,t),types:e=>this.request("GET","/payment_methods/types",e)};priceLists={list:(e,t)=>this.request("GET","/price_lists",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/price_lists/${e}`,{...r,params:C(t)}),create:(e,t)=>this.request("POST","/price_lists",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/price_lists/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/price_lists/${e}`,t),activate:(e,t)=>this.request("PATCH",`/price_lists/${e}/activate`,t),deactivate:(e,t)=>this.request("PATCH",`/price_lists/${e}/deactivate`,t),ruleTypes:e=>this.request("GET","/price_lists/price_rule_types",e)};prices={list:(e,t)=>this.request("GET","/prices",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/prices/${e}`,{...r,params:C(t)}),create:(e,t)=>this.request("POST","/prices",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/prices/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/prices/${e}`,t),bulkUpsert:(e,t)=>this.request("POST","/prices/bulk_upsert",{...t,body:e}),bulkDestroy:(e,t)=>this.request("DELETE","/prices/bulk_destroy",{...t,body:e})};promotions={list:(e,t)=>this.request("GET","/promotions",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/promotions/${e}`,{...r,params:C(t)}),create:(e,t)=>this.request("POST","/promotions",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/promotions/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/promotions/${e}`,t),actions:{list:(e,t,r)=>this.request("GET",`/promotions/${e}/promotion_actions`,{...r,params:t?b(t):void 0}),get:(e,t,r)=>this.request("GET",`/promotions/${e}/promotion_actions/${t}`,r),create:(e,t,r)=>this.request("POST",`/promotions/${e}/promotion_actions`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/promotions/${e}/promotion_actions/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/promotions/${e}/promotion_actions/${t}`,r)},rules:{list:(e,t,r)=>this.request("GET",`/promotions/${e}/promotion_rules`,{...r,params:t?b(t):void 0}),get:(e,t,r)=>this.request("GET",`/promotions/${e}/promotion_rules/${t}`,r),create:(e,t,r)=>this.request("POST",`/promotions/${e}/promotion_rules`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/promotions/${e}/promotion_rules/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/promotions/${e}/promotion_rules/${t}`,r)},couponCodes:{list:(e,t,r)=>this.request("GET",`/promotions/${e}/coupon_codes`,{...r,params:t?b(t):void 0}),get:(e,t,r)=>this.request("GET",`/promotions/${e}/coupon_codes/${t}`,r)}};promotionActions={types:e=>this.request("GET","/promotion_actions/types",e),calculators:(e,t)=>this.request("GET","/promotion_actions/calculators",{...t,params:{type:e}})};promotionRules={types:e=>this.request("GET","/promotion_rules/types",e)};tags={list:(e,t)=>this.request("GET","/tags",{...t,params:e})};customerGroups={list:(e,t)=>this.request("GET","/customer_groups",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/customer_groups/${e}`,{...r,params:C(t)}),create:(e,t)=>this.request("POST","/customer_groups",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/customer_groups/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/customer_groups/${e}`,t)};giftCards={list:(e,t)=>this.request("GET","/gift_cards",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/gift_cards/${e}`,{...r,params:C(t)}),create:(e,t)=>this.request("POST","/gift_cards",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/gift_cards/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/gift_cards/${e}`,t)};giftCardBatches={list:(e,t)=>this.request("GET","/gift_card_batches",{...t,params:e?b(e):void 0}),get:(e,t)=>this.request("GET",`/gift_card_batches/${e}`,t),create:(e,t)=>this.request("POST","/gift_card_batches",{...t,body:e})};exports={list:(e,t)=>this.request("GET","/exports",{...t,params:e?b(e):void 0}),get:(e,t)=>this.request("GET",`/exports/${e}`,t),create:(e,t)=>this.request("POST","/exports",{...t,body:e}),delete:(e,t)=>this.request("DELETE",`/exports/${e}`,t)};customers={list:(e,t)=>this.request("GET","/customers",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/customers/${e}`,{...r,params:C(t)}),creditCards:{list:(e,t,r)=>this.request("GET",`/customers/${e}/credit_cards`,{...r,params:t?b(t):void 0}),get:(e,t,r,i)=>this.request("GET",`/customers/${e}/credit_cards/${t}`,{...i,params:C(r)}),delete:(e,t,r)=>this.request("DELETE",`/customers/${e}/credit_cards/${t}`,r)},create:(e,t)=>this.request("POST","/customers",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/customers/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/customers/${e}`,t),bulkAddToGroups:(e,t)=>this.request("POST","/customers/bulk_add_to_groups",{...t,body:e}),bulkRemoveFromGroups:(e,t)=>this.request("POST","/customers/bulk_remove_from_groups",{...t,body:e}),bulkAddTags:(e,t)=>this.request("POST","/customers/bulk_add_tags",{...t,body:e}),bulkRemoveTags:(e,t)=>this.request("POST","/customers/bulk_remove_tags",{...t,body:e}),addresses:{list:(e,t,r)=>this.request("GET",`/customers/${e}/addresses`,{...r,params:t?b(t):void 0}),get:(e,t,r,i)=>this.request("GET",`/customers/${e}/addresses/${t}`,{...i,params:C(r)}),create:(e,t,r)=>this.request("POST",`/customers/${e}/addresses`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/customers/${e}/addresses/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/customers/${e}/addresses/${t}`,r)},storeCredits:{list:(e,t,r)=>this.request("GET",`/customers/${e}/store_credits`,{...r,params:t?b(t):void 0}),get:(e,t,r,i)=>this.request("GET",`/customers/${e}/store_credits/${t}`,{...i,params:C(r)}),create:(e,t,r)=>this.request("POST",`/customers/${e}/store_credits`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/customers/${e}/store_credits/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/customers/${e}/store_credits/${t}`,r)},customFields:this.parentScopedCustomFields(rt["Spree::User"])};categories={list:(e,t)=>this.request("GET","/categories",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/categories/${e}`,{...r,params:C(t)}),create:(e,t)=>this.request("POST","/categories",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/categories/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/categories/${e}`,t),reposition:(e,t,r)=>this.request("PATCH",`/categories/${e}/reposition`,{...r,body:t}),products:{list:(e,t,r)=>this.request("GET",`/categories/${e}/products`,{...r,params:t?b(t):void 0}),add:(e,t,r)=>this.request("POST",`/categories/${e}/products`,{...r,body:{product_id:t}}),remove:(e,t,r)=>this.request("DELETE",`/categories/${e}/products/${t}`,r),reposition:(e,t,r,i)=>this.request("PATCH",`/categories/${e}/products/${t}/reposition`,{...i,body:r})},customFields:this.parentScopedCustomFields(rt["Spree::Category"]),translations:this.parentScopedTranslations("/categories")};variants={list:(e,t)=>this.request("GET","/variants",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/variants/${e}`,{...r,params:C(t)}),customFields:this.parentScopedCustomFields(rt["Spree::Variant"])};taxCategories={list:(e,t)=>this.request("GET","/tax_categories",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/tax_categories/${e}`,{...r,params:C(t)}),create:(e,t)=>this.request("POST","/tax_categories",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/tax_categories/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/tax_categories/${e}`,t)};channels={list:(e,t)=>this.request("GET","/channels",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/channels/${e}`,{...r,params:C(t)}),create:(e,t)=>this.request("POST","/channels",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/channels/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/channels/${e}`,t),addProducts:(e,t,r)=>this.request("POST",`/channels/${e}/add_products`,{...r,body:t}),removeProducts:(e,t,r)=>this.request("POST",`/channels/${e}/remove_products`,{...r,body:t})};markets={list:(e,t)=>this.request("GET","/markets",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/markets/${e}`,{...r,params:C(t)}),create:(e,t)=>this.request("POST","/markets",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/markets/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/markets/${e}`,t)};storeCreditCategories={list:(e,t)=>this.request("GET","/store_credit_categories",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/store_credit_categories/${e}`,{...r,params:C(t)})};stockLocations={list:(e,t)=>this.request("GET","/stock_locations",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/stock_locations/${e}`,{...r,params:C(t)}),create:(e,t)=>this.request("POST","/stock_locations",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/stock_locations/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/stock_locations/${e}`,t)};stockItems={list:(e,t)=>this.request("GET","/stock_items",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/stock_items/${e}`,{...r,params:C(t)}),update:(e,t,r)=>this.request("PATCH",`/stock_items/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/stock_items/${e}`,t)};stockTransfers={list:(e,t)=>this.request("GET","/stock_transfers",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/stock_transfers/${e}`,{...r,params:C(t)}),create:(e,t)=>this.request("POST","/stock_transfers",{...t,body:e}),delete:(e,t)=>this.request("DELETE",`/stock_transfers/${e}`,t)};countries={list:(e,t)=>this.request("GET","/countries",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/countries/${e}`,{...r,params:C(t)})};directUploads={create:(e,t)=>this.request("POST","/direct_uploads",{...t,body:e})};adminUsers={list:(e,t)=>this.request("GET","/admin_users",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/admin_users/${e}`,{...r,params:C(t)}),update:(e,t,r)=>this.request("PATCH",`/admin_users/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/admin_users/${e}`,t)};invitations={list:(e,t)=>this.request("GET","/invitations",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/invitations/${e}`,{...r,params:C(t)}),create:(e,t)=>this.request("POST","/invitations",{...t,body:e}),delete:(e,t)=>this.request("DELETE",`/invitations/${e}`,t),resend:(e,t)=>this.request("PATCH",`/invitations/${e}/resend`,t)};apiKeys={list:(e,t)=>this.request("GET","/api_keys",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/api_keys/${e}`,{...r,params:C(t)}),current:e=>this.request("GET","/api_keys/current",e??{}),create:(e,t)=>this.request("POST","/api_keys",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/api_keys/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/api_keys/${e}`,t),revoke:(e,t)=>this.request("PATCH",`/api_keys/${e}/revoke`,t)};allowedOrigins={list:(e,t)=>this.request("GET","/allowed_origins",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/allowed_origins/${e}`,{...r,params:C(t)}),create:(e,t)=>this.request("POST","/allowed_origins",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/allowed_origins/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/allowed_origins/${e}`,t)};webhookEndpoints={list:(e,t)=>this.request("GET","/webhook_endpoints",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/webhook_endpoints/${e}`,{...r,params:C(t)}),create:(e,t)=>this.request("POST","/webhook_endpoints",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/webhook_endpoints/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/webhook_endpoints/${e}`,t),sendTest:(e,t)=>this.request("POST",`/webhook_endpoints/${e}/send_test`,t),enable:(e,t)=>this.request("PATCH",`/webhook_endpoints/${e}/enable`,t),disable:(e,t,r)=>this.request("PATCH",`/webhook_endpoints/${e}/disable`,{...r,body:t}),deliveries:{list:(e,t,r)=>this.request("GET",`/webhook_endpoints/${e}/deliveries`,{...r,params:t?b(t):void 0}),get:(e,t,r)=>this.request("GET",`/webhook_endpoints/${e}/deliveries/${t}`,r),redeliver:(e,t,r)=>this.request("POST",`/webhook_endpoints/${e}/deliveries/${t}/redeliver`,r)}};roles={list:(e,t)=>this.request("GET","/roles",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/roles/${e}`,{...r,params:C(t)})}};function Bt(e){let t=e.baseUrl.replace(/\/$/,""),r=e.fetch||fetch.bind(globalThis),i=$h(e.retry),n={baseUrl:t,fetchFn:r,retryConfig:i,credentials:e.credentials??"include"},s=e.jwtToken,o=e.storeId,a=null,c="/api/v3/admin",d=async(l,m,h={})=>{let f={};o&&(f["X-Spree-Store-Id"]=o);let x={...h,headers:{...f,...h.headers}},_=()=>{let q=e.secretKey?{headerName:"X-Spree-Api-Key",headerValue:e.secretKey}:{headerName:"Authorization",headerValue:s?`Bearer ${s}`:""};return Th(n,c,q)(l,m,x)};try{return await _()}catch(q){if(q instanceof it&&q.status===401&&a&&!m.includes("/auth/")&&await a())return _();throw q}},p=new Oh(d),u=Object.create(p);return u.setStore=l=>{o=l},u.setToken=l=>{s=l},u.onUnauthorized=l=>{a=l},u}var zl=U(Wt(),1),we=U(X(),1);var Sa=U(X(),1);import Ry from"fs";var Gn=Symbol("no-body");async function $a(e){if(e===void 0)return Gn;let t;if(e==="-")t=await jy();else if(e.startsWith("@")){let r=e.slice(1);try{t=Ry.readFileSync(r,"utf-8")}catch(i){throw i?.code==="ENOENT"?new Error(`Request body file not found: ${r}`):new Error(`Could not read request body file ${r}: ${i.message}`)}}else t=e;try{return JSON.parse(t)}catch{let r=e==="-"?" (from stdin)":e.startsWith("@")?` (${e.slice(1)})`:"";throw new Error(`Request body is not valid JSON${r}`)}}async function jy(){process.stdin.isTTY&&process.stderr.write(`${Sa.default.dim("Reading request body from stdin \u2014 paste JSON and press Ctrl-D...")}
32
- `);let e=[];for await(let t of process.stdin)e.push(t);return Buffer.concat(e).toString("utf-8")}var $o=U(Wt(),1),ce=U(X(),1);var pr=U(X(),1);import Ne from"fs";import dk from"os";import Dt from"path";var $r="spree@example.com",Ar="spree123";import st from"fs";import xt from"path";function g(e=process.cwd()){let t=Dy(e),r=xt.join(t,"docker-compose.yml");if(!st.existsSync(r))throw new Error(`Not a Spree project directory. No docker-compose.yml found.
33
- Run this command from a directory created with create-spree-app.`);let i=Ly(t);return{mode:"docker",projectDir:t,port:i}}function Dy(e){if(xt.basename(e)!=="backend")return e;let t=xt.dirname(e);for(let r of["docker-compose.yml","docker-compose.dev.yml"]){let i=xt.join(t,r);if(st.existsSync(i))try{if(/\.\/backend:\/rails(:\w+)?(\s|$)/m.test(st.readFileSync(i,"utf-8")))return t}catch{}}return e}function We(e){let t=xt.join(e,".env");if(!st.existsSync(t))return!1;try{let r=st.readFileSync(t,"utf-8");return/^\s*SPREE_PATH\s*=/m.test(r)}catch{return!1}}function Ly(e){let t=xt.join(e,".env");if(!st.existsSync(t))return 3e3;let i=st.readFileSync(t,"utf-8").match(/^SPREE_PORT=(\d+)/m);return i?Number(i[1]):3e3}function V(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}import{fileURLToPath as My}from"url";var wt=(e,t)=>{let r=Vn(Fy(e));if(typeof r!="string")throw new TypeError(`${t} must be a string or a file URL: ${r}.`);return r},Fy=e=>zn(e)?e.toString():e,zn=e=>typeof e!="string"&&e&&Object.getPrototypeOf(e)===String.prototype,Vn=e=>e instanceof URL?My(e):e;var Er=(e,t=[],r={})=>{let i=wt(e,"First argument"),[n,s]=V(t)?[[],t]:[t,r];if(!Array.isArray(n))throw new TypeError(`Second argument must be either an array of arguments or an options object: ${n}`);if(n.some(c=>typeof c=="object"&&c!==null))throw new TypeError(`Second argument must be an array of strings: ${n}`);let o=n.map(String),a=o.find(c=>c.includes("\0"));if(a!==void 0)throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${a}`);if(!V(s))throw new TypeError(`Last argument must be an options object: ${s}`);return[i,o,s]};import{ChildProcess as Wy}from"child_process";import{StringDecoder as By}from"string_decoder";var{toString:Aa}=Object.prototype,Ca=e=>Aa.call(e)==="[object ArrayBuffer]",K=e=>Aa.call(e)==="[object Uint8Array]",Me=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),Uy=new TextEncoder,Ea=e=>Uy.encode(e),Ny=new TextDecoder,Pr=e=>Ny.decode(e),Pa=(e,t)=>Gy(e,t).join(""),Gy=(e,t)=>{if(t==="utf8"&&e.every(s=>typeof s=="string"))return e;let r=new By(t),i=e.map(s=>typeof s=="string"?Ea(s):s).map(s=>r.write(s)),n=r.end();return n===""?i:[...i,n]},Ht=e=>e.length===1&&K(e[0])?e[0]:Wn(zy(e)),zy=e=>e.map(t=>typeof t=="string"?Ea(t):t),Wn=e=>{let t=new Uint8Array(Vy(e)),r=0;for(let i of e)t.set(i,r),r+=i.length;return t},Vy=e=>{let t=0;for(let r of e)t+=r.length;return t};var Ra=e=>Array.isArray(e)&&Array.isArray(e.raw),ja=(e,t)=>{let r=[];for(let[s,o]of e.entries())r=Hy({templates:e,expressions:t,tokens:r,index:s,template:o});if(r.length===0)throw new TypeError("Template script must not be empty");let[i,...n]=r;return[i,n,{}]},Hy=({templates:e,expressions:t,tokens:r,index:i,template:n})=>{if(n===void 0)throw new TypeError(`Invalid backslash sequence: ${e.raw[i]}`);let{nextTokens:s,leadingWhitespaces:o,trailingWhitespaces:a}=Ky(n,e.raw[i]),c=Oa(r,s,o);if(i===t.length)return c;let d=t[i],p=Array.isArray(d)?d.map(u=>Ia(u)):[Ia(d)];return Oa(c,p,a)},Ky=(e,t)=>{if(t.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],i=0,n=Ta.has(t[0]);for(let o=0,a=0;o<e.length;o+=1,a+=1){let c=t[a];if(Ta.has(c))i!==o&&r.push(e.slice(i,o)),i=o+1;else if(c==="\\"){let d=t[a+1];d===`
34
- `?(o-=1,a+=1):d==="u"&&t[a+2]==="{"?a=t.indexOf("}",a+3):a+=Yy[d]??1}}let s=i===e.length;return s||r.push(e.slice(i)),{nextTokens:r,leadingWhitespaces:n,trailingWhitespaces:s}},Ta=new Set([" "," ","\r",`
35
- `]),Yy={x:3,u:5},Oa=(e,t,r)=>r||e.length===0||t.length===0?[...e,...t]:[...e.slice(0,-1),`${e.at(-1)}${t[0]}`,...t.slice(1)],Ia=e=>{let t=typeof e;if(t==="string")return e;if(t==="number")return String(e);if(V(e)&&("stdout"in e||"isMaxBuffer"in e))return Jy(e);throw e instanceof Wy||Object.prototype.toString.call(e)==="[object Promise]"?new TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):new TypeError(`Unexpected "${t}" in template expression`)},Jy=({stdout:e})=>{if(typeof e=="string")return e;if(K(e))return Pr(e);throw e===void 0?new TypeError(`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`):new TypeError(`Unexpected "${typeof e}" stdout in template expression`)};import{spawnSync as tw}from"child_process";import{debuglog as Xy}from"util";import Hn from"process";var ge=e=>Tr.includes(e),Tr=[Hn.stdin,Hn.stdout,Hn.stderr],le=["stdin","stdout","stderr"],Or=e=>le[e]??`stdio[${e}]`;var La=e=>{let t={...e};for(let r of Jn)t[r]=Kn(e,r);return t},Kn=(e,t)=>{let r=Array.from({length:Qy(e)+1}),i=Zy(e[t],r,t);return sf(i,t)},Qy=({stdio:e})=>Array.isArray(e)?Math.max(e.length,le.length):le.length,Zy=(e,t,r)=>V(e)?ef(e,t,r):t.fill(e),ef=(e,t,r)=>{for(let i of Object.keys(e).sort(tf))for(let n of rf(i,r,t))t[n]=e[i];return t},tf=(e,t)=>Da(e)<Da(t)?1:-1,Da=e=>e==="stdout"||e==="stderr"?0:e==="all"?2:1,rf=(e,t,r)=>{if(e==="ipc")return[r.length-1];let i=Yn(e);if(i===void 0||i===0)throw new TypeError(`"${t}.${e}" is invalid.
29
+ `)}),this}_outputHelpIfRequested(t){let r=this._getHelpOption();r&&t.find(n=>r.is(n))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function Xo(e){return e.map(t=>{if(!t.startsWith("--inspect"))return t;let r,i="127.0.0.1",n="9229",s;return(s=t.match(/^(--inspect(-brk)?)$/))!==null?r=s[1]:(s=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(r=s[1],/^\d+$/.test(s[3])?n=s[3]:i=s[3]):(s=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(r=s[1],i=s[3],n=s[4]),r&&n!=="0"?`${r}=${i}:${parseInt(n)+1}`:t})}function Sn(){if(T.env.NO_COLOR||T.env.FORCE_COLOR==="0"||T.env.FORCE_COLOR==="false")return!1;if(T.env.FORCE_COLOR||T.env.CLICOLOR_FORCE!==void 0)return!0}qn.Command=vn;qn.useColor=Sn});var ra=q(ue=>{"use strict";var{Argument:Zo}=vr(),{Command:$n}=Qo(),{CommanderError:qh,InvalidArgumentError:ea}=Ut(),{Help:$h}=fn(),{Option:ta}=xn();ue.program=new $n;ue.createCommand=e=>new $n(e);ue.createOption=(e,t)=>new ta(e,t);ue.createArgument=(e,t)=>new Zo(e,t);ue.Command=$n;ue.Option=ta;ue.Argument=Zo;ue.Help=$h;ue.CommanderError=qh;ue.InvalidArgumentError=ea;ue.InvalidOptionArgumentError=ea});var X=q((oS,An)=>{"use strict";var $r=process||{},oa=$r.argv||[],qr=$r.env||{},Ah=!(qr.NO_COLOR||oa.includes("--no-color"))&&(!!qr.FORCE_COLOR||oa.includes("--color")||$r.platform==="win32"||($r.stdout||{}).isTTY&&qr.TERM!=="dumb"||!!qr.CI),Ch=(e,t,r=e)=>i=>{let n=""+i,s=n.indexOf(t,e.length);return~s?e+Eh(n,t,r,s)+t:e+n+t},Eh=(e,t,r,i)=>{let n="",s=0;do n+=e.substring(s,i)+r,s=i+t.length,i=e.indexOf(t,s);while(~i);return n+e.substring(s)},aa=(e=Ah)=>{let t=e?Ch:()=>String;return{isColorSupported:e,reset:t("\x1B[0m","\x1B[0m"),bold:t("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:t("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:t("\x1B[3m","\x1B[23m"),underline:t("\x1B[4m","\x1B[24m"),inverse:t("\x1B[7m","\x1B[27m"),hidden:t("\x1B[8m","\x1B[28m"),strikethrough:t("\x1B[9m","\x1B[29m"),black:t("\x1B[30m","\x1B[39m"),red:t("\x1B[31m","\x1B[39m"),green:t("\x1B[32m","\x1B[39m"),yellow:t("\x1B[33m","\x1B[39m"),blue:t("\x1B[34m","\x1B[39m"),magenta:t("\x1B[35m","\x1B[39m"),cyan:t("\x1B[36m","\x1B[39m"),white:t("\x1B[37m","\x1B[39m"),gray:t("\x1B[90m","\x1B[39m"),bgBlack:t("\x1B[40m","\x1B[49m"),bgRed:t("\x1B[41m","\x1B[49m"),bgGreen:t("\x1B[42m","\x1B[49m"),bgYellow:t("\x1B[43m","\x1B[49m"),bgBlue:t("\x1B[44m","\x1B[49m"),bgMagenta:t("\x1B[45m","\x1B[49m"),bgCyan:t("\x1B[46m","\x1B[49m"),bgWhite:t("\x1B[47m","\x1B[49m"),blackBright:t("\x1B[90m","\x1B[39m"),redBright:t("\x1B[91m","\x1B[39m"),greenBright:t("\x1B[92m","\x1B[39m"),yellowBright:t("\x1B[93m","\x1B[39m"),blueBright:t("\x1B[94m","\x1B[39m"),magentaBright:t("\x1B[95m","\x1B[39m"),cyanBright:t("\x1B[96m","\x1B[39m"),whiteBright:t("\x1B[97m","\x1B[39m"),bgBlackBright:t("\x1B[100m","\x1B[49m"),bgRedBright:t("\x1B[101m","\x1B[49m"),bgGreenBright:t("\x1B[102m","\x1B[49m"),bgYellowBright:t("\x1B[103m","\x1B[49m"),bgBlueBright:t("\x1B[104m","\x1B[49m"),bgMagentaBright:t("\x1B[105m","\x1B[49m"),bgCyanBright:t("\x1B[106m","\x1B[49m"),bgWhiteBright:t("\x1B[107m","\x1B[49m")}};An.exports=aa();An.exports.createColors=aa});var En=q(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.DEFAULT_COLOR_MAP=void 0;bt.DEFAULT_COLOR_MAP={red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",white_bold:"\x1B[01m",reset:"\x1B[0m"};var Cn=class{constructor(t=bt.DEFAULT_COLOR_MAP){this.text="",this.colorMap=t}addCharsWithColor(t,r){let i=this.colorMap[t];this.text+=i!==void 0?`${i}${r}${this.colorMap.reset}`:r}renderConsole(){return this.text}};bt.default=Cn});var Gt=q(W=>{"use strict";Object.defineProperty(W,"__esModule",{value:!0});W.DEFAULT_HEADER_ALIGNMENT=W.DEFAULT_ROW_ALIGNMENT=W.DEFAULT_HEADER_FONT_COLOR=W.DEFAULT_ROW_FONT_COLOR=W.COLORS=W.ALIGNMENTS=W.DEFAULT_TABLE_STYLE=W.DEFAULT_ROW_SEPARATOR=W.DEFAULT_COLUMN_LEN=void 0;W.DEFAULT_COLUMN_LEN=20;W.DEFAULT_ROW_SEPARATOR=!1;W.DEFAULT_TABLE_STYLE={headerTop:{left:"\u250C",mid:"\u252C",right:"\u2510",other:"\u2500"},headerBottom:{left:"\u251C",mid:"\u253C",right:"\u2524",other:"\u2500"},tableBottom:{left:"\u2514",mid:"\u2534",right:"\u2518",other:"\u2500"},vertical:"\u2502",rowSeparator:{left:"\u251C",mid:"\u253C",right:"\u2524",other:"\u2500"}};W.ALIGNMENTS=["right","left","center"];W.COLORS=["red","green","yellow","white","blue","magenta","cyan","white_bold","reset"];W.DEFAULT_ROW_FONT_COLOR="white";W.DEFAULT_HEADER_FONT_COLOR="white_bold";W.DEFAULT_ROW_ALIGNMENT="right";W.DEFAULT_HEADER_ALIGNMENT="center"});var da=q(Pn=>{"use strict";Object.defineProperty(Pn,"__esModule",{value:!0});var Lh=[{first:768,last:879},{first:1155,last:1158},{first:1160,last:1161},{first:1425,last:1469},{first:1471,last:1471},{first:1473,last:1474},{first:1476,last:1477},{first:1479,last:1479},{first:1536,last:1539},{first:1552,last:1557},{first:1611,last:1630},{first:1648,last:1648},{first:1750,last:1764},{first:1767,last:1768},{first:1770,last:1773},{first:1807,last:1807},{first:1809,last:1809},{first:1840,last:1866},{first:1958,last:1968},{first:2027,last:2035},{first:2305,last:2306},{first:2364,last:2364},{first:2369,last:2376},{first:2381,last:2381},{first:2385,last:2388},{first:2402,last:2403},{first:2433,last:2433},{first:2492,last:2492},{first:2497,last:2500},{first:2509,last:2509},{first:2530,last:2531},{first:2561,last:2562},{first:2620,last:2620},{first:2625,last:2626},{first:2631,last:2632},{first:2635,last:2637},{first:2672,last:2673},{first:2689,last:2690},{first:2748,last:2748},{first:2753,last:2757},{first:2759,last:2760},{first:2765,last:2765},{first:2786,last:2787},{first:2817,last:2817},{first:2876,last:2876},{first:2879,last:2879},{first:2881,last:2883},{first:2893,last:2893},{first:2902,last:2902},{first:2946,last:2946},{first:3008,last:3008},{first:3021,last:3021},{first:3134,last:3136},{first:3142,last:3144},{first:3146,last:3149},{first:3157,last:3158},{first:3260,last:3260},{first:3263,last:3263},{first:3270,last:3270},{first:3276,last:3277},{first:3298,last:3299},{first:3393,last:3395},{first:3405,last:3405},{first:3530,last:3530},{first:3538,last:3540},{first:3542,last:3542},{first:3633,last:3633},{first:3636,last:3642},{first:3655,last:3662},{first:3761,last:3761},{first:3764,last:3769},{first:3771,last:3772},{first:3784,last:3789},{first:3864,last:3865},{first:3893,last:3893},{first:3895,last:3895},{first:3897,last:3897},{first:3953,last:3966},{first:3968,last:3972},{first:3974,last:3975},{first:3984,last:3991},{first:3993,last:4028},{first:4038,last:4038},{first:4141,last:4144},{first:4146,last:4146},{first:4150,last:4151},{first:4153,last:4153},{first:4184,last:4185},{first:4448,last:4607},{first:4959,last:4959},{first:5906,last:5908},{first:5938,last:5940},{first:5970,last:5971},{first:6002,last:6003},{first:6068,last:6069},{first:6071,last:6077},{first:6086,last:6086},{first:6089,last:6099},{first:6109,last:6109},{first:6155,last:6157},{first:6313,last:6313},{first:6432,last:6434},{first:6439,last:6440},{first:6450,last:6450},{first:6457,last:6459},{first:6679,last:6680},{first:6912,last:6915},{first:6964,last:6964},{first:6966,last:6970},{first:6972,last:6972},{first:6978,last:6978},{first:7019,last:7027},{first:7616,last:7626},{first:7678,last:7679},{first:8203,last:8207},{first:8234,last:8238},{first:8288,last:8291},{first:8298,last:8303},{first:8400,last:8431},{first:12330,last:12335},{first:12441,last:12442},{first:43014,last:43014},{first:43019,last:43019},{first:43045,last:43046},{first:64286,last:64286},{first:65024,last:65039},{first:65056,last:65059},{first:65279,last:65279},{first:65529,last:65531},{first:68097,last:68099},{first:68101,last:68102},{first:68108,last:68111},{first:68152,last:68154},{first:68159,last:68159},{first:119143,last:119145},{first:119155,last:119170},{first:119173,last:119179},{first:119210,last:119213},{first:119362,last:119364},{first:917505,last:917505},{first:917536,last:917631},{first:917760,last:917999}];Pn.default=Lh});var ua=q(Tn=>{"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});var Mh=(e,t,r)=>{let i=0,n,s=r;if(e<t[0].first||e>t[s].last)return 0;for(;s>=i;)if(n=Math.floor((i+s)/2),e>t[n].last)i=n+1;else if(e<t[n].first)s=n-1;else return 1;return 0};Tn.default=Mh});var On=q(zt=>{"use strict";var ma=zt&&zt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(zt,"__esModule",{value:!0});var la=ma(da()),Fh=ma(ua()),Bh=e=>e===0?0:e<32||e>=127&&e<160?-1:(0,Fh.default)(e,la.default,la.default.length-1)?0:1+ +(e>=4352&&(e<=4447||e===9001||e===9002||e>=11904&&e<=42191&&e!==12351||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65135||e>=65280&&e<=65376||e>=65504&&e<=65510||e>=131072&&e<=196605||e>=196608&&e<=262141));zt.default=Bh});var ha=q(Vt=>{"use strict";var Uh=Vt&&Vt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Vt,"__esModule",{value:!0});var Nh=Uh(On()),Gh=e=>{let t=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r),n=(0,Nh.default)(i);if(n<0)return-1;t+=n}return t};Vt.default=Gh});var fa=q(We=>{"use strict";var ya=We&&We.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(We,"__esModule",{value:!0});We.wcswidth=We.wcwidth=void 0;var zh=ya(ha());We.wcswidth=zh.default;var Vh=ya(On());We.wcwidth=Vh.default});var In=q(st=>{"use strict";Object.defineProperty(st,"__esModule",{value:!0});st.findWidthInConsole=st.stripAnsi=void 0;var Wh=fa(),Hh=/\x1b\[\d{1,3}(;\d{1,3})*m/g,Kh=e=>e.replace(Hh,"");st.stripAnsi=Kh;var Yh=(e,t)=>{let r=0;return e=(0,st.stripAnsi)(e),t&&Object.entries(t).forEach(([i,n])=>{let s=new RegExp(i,"g");r+=(e.match(s)||[]).length*n,e=e.replace(i,"")}),r+=(0,Wh.wcswidth)(e),r};st.findWidthInConsole=Yh});var jn=q(ve=>{"use strict";Object.defineProperty(ve,"__esModule",{value:!0});ve.biggestWordInSentence=ve.textWithPadding=ve.splitTextIntoTextsOfMinLen=void 0;var Rn=In(),Jh=(e,t,r)=>{let i=[];return e.split(/[\n\r]/).forEach(s=>{let o=s.split(" "),a=[],c=0;o.forEach(d=>{let p=(0,Rn.findWidthInConsole)(d,r);c+p<=t?(c+=p+1,a.push(d)):(a.length>0&&i.push(a.join(" ")),a=[d],c=p+1)}),i.push(a.join(" "))}),i};ve.splitTextIntoTextsOfMinLen=Jh;var Xh=(e,t,r,i)=>{let n=(0,Rn.findWidthInConsole)(e,i),s=Math.floor((r-n)/2),o=r-s-n;if(r<n){let a=(0,ve.splitTextIntoTextsOfMinLen)(e,r);return a.length===1?e:a.map(c=>(0,ve.textWithPadding)(c,t,r,i)).join(`
30
+ `)}switch(t){case"left":return e.concat(" ".repeat(r-n));case"center":return" ".repeat(s).concat(e).concat(" ".repeat(o));default:return" ".repeat(r-n).concat(e)}};ve.textWithPadding=Xh;var Qh=(e,t)=>e.split(" ").reduce((r,i)=>Math.max(r,(0,Rn.findWidthInConsole)(i,t)),0);ve.biggestWordInSentence=Qh});var Wt=q(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});L.getWidthLimitedColumnsArray=L.createHeaderAsRow=L.renderTableHorizontalBorders=L.findLenOfColumn=L.createRow=L.createColumFromOnlyName=L.createTableHorizontalBorders=L.convertRawRowOptionsToStandard=L.evaluateCellText=L.cellText=void 0;var ga=In(),Dn=jn(),Ln=Gt(),xt=(e,t)=>Math.max(e,t),Zh=e=>e==null?"":`${e}`;L.cellText=Zh;var ey=(e,t)=>t?`${t(e)}`:(0,L.cellText)(e);L.evaluateCellText=ey;var ty=e=>{if(e)return{color:e.color,separator:e.separator||Ln.DEFAULT_ROW_SEPARATOR}};L.convertRawRowOptionsToStandard=ty;var ry=({left:e,mid:t,right:r,other:i},n)=>{let s=e;return n.forEach(o=>{s+=i.repeat(o+2),s+=t}),s=s.slice(0,-t.length),s+=r,s};L.createTableHorizontalBorders=ry;var iy=e=>({name:e,title:e});L.createColumFromOnlyName=iy;var ny=(e,t,r)=>({color:e,separator:r,text:t});L.createRow=ny;var sy=(e,t,r)=>{let i=e.name,n=e.title,s=e.transform,o=xt(0,e?.minLen||0);return e.maxLen?(o=xt(o,xt(e.maxLen,(0,Dn.biggestWordInSentence)(n,r))),o=t.reduce((a,c)=>xt(a,(0,Dn.biggestWordInSentence)((0,L.evaluateCellText)(c.text[i],s),r)),o),o):(o=xt(o,(0,ga.findWidthInConsole)(n,r)),t.forEach(a=>{o=xt(o,(0,ga.findWidthInConsole)((0,L.evaluateCellText)(a.text[i],s),r))}),o)};L.findLenOfColumn=sy;var oy=(e,t)=>(0,L.createTableHorizontalBorders)(e,t);L.renderTableHorizontalBorders=oy;var ay=(e,t)=>{let r=Ln.DEFAULT_HEADER_FONT_COLOR,i=e(r,{},!1);return t.forEach(n=>{i.text[n.name]=n.title}),i};L.createHeaderAsRow=ay;var cy=(e,t,r)=>{let i={};return e.forEach(n=>{i[n.name]=(0,Dn.splitTextIntoTextsOfMinLen)((0,L.cellText)(t.text[n.name]),n.length||Ln.DEFAULT_COLUMN_LEN,r)}),i};L.getWidthLimitedColumnsArray=cy});var _a=q(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.rawColumnToInternalColumn=Fe.objIfExists=void 0;var py=Gt(),dy=(e,t)=>t?{[e]:t}:{};Fe.objIfExists=dy;var uy=(e,t)=>{var r;return Object.assign(Object.assign(Object.assign(Object.assign({name:e.name,title:(r=e.title)!==null&&r!==void 0?r:e.name},(0,Fe.objIfExists)("color",e.color||t?.color)),(0,Fe.objIfExists)("maxLen",e.maxLen||t?.maxLen)),(0,Fe.objIfExists)("minLen",e.minLen||t?.minLen)),{alignment:e.alignment||t?.alignment||py.DEFAULT_ROW_ALIGNMENT,transform:e.transform})};Fe.rawColumnToInternalColumn=uy});var ba=q(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.preProcessRows=wt.preProcessColumns=void 0;var ly=Wt(),my=e=>{e.computedColumns.length&&e.computedColumns.forEach(t=>{e.columns.some(i=>i.name===t.name)||(e.addColumn(Object.assign(Object.assign({},t),e.defaultColumnOptions)),e.rows.forEach((i,n,s)=>{let o=s.map(a=>a.text);i.text[t.name]=t.function(i.text,n,o)}))})},hy=e=>{e.enabledColumns.length&&(e.columns=e.columns.filter(t=>e.enabledColumns.includes(t.name)))},yy=e=>{e.disabledColumns.length&&(e.columns=e.columns.filter(t=>!e.disabledColumns.includes(t.name)))},fy=e=>{e.columns.forEach(t=>{t.length=(0,ly.findLenOfColumn)(t,e.rows,e.charLength)})},gy=e=>{my(e),yy(e),hy(e),fy(e)};wt.preProcessColumns=gy;var _y=e=>{let t=e.rows.filter(r=>e.filterFunction(r.text)).sort((r,i)=>e.sortFunction(r.text,i.text));e.rows=t};wt.preProcessRows=_y});var Mn=q(le=>{"use strict";var wa=le&&le.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(le,"__esModule",{value:!0});le.printSimpleTable=le.renderSimpleTable=le.renderTable=void 0;var ka=wa(En()),va=jn(),fe=Gt(),He=Wt(),by=wa(Fn()),xa=ba(),xy=(e,t,r,i,n,s,o,a)=>{let c=new ka.default(o);return c.addCharsWithColor("",e.vertical),t.forEach(d=>{let u=r<i[d.name].length?(0,He.cellText)(i[d.name][r]):"";c.addCharsWithColor(fe.DEFAULT_ROW_FONT_COLOR," "),c.addCharsWithColor(n&&fe.DEFAULT_HEADER_FONT_COLOR||d.color||s.color,(0,va.textWithPadding)(u,d.alignment||fe.DEFAULT_ROW_ALIGNMENT,d.length||fe.DEFAULT_COLUMN_LEN,a)),c.addCharsWithColor("",` ${e.vertical}`)}),c.renderConsole()},Sa=(e,t,r,i,n,s)=>{let o=(0,He.getWidthLimitedColumnsArray)(t,r,s),a=Object.values(o).reduce((d,p)=>Math.max(d,p.length),0),c=[];for(let d=0;d<a;d+=1){let p=xy(e,t,d,o,n,r,i,s);c.push(p)}return c},wy=(e,t)=>{let r=JSON.parse(JSON.stringify(e)),i={};return t.filter(n=>!!n.transform).forEach(n=>{i[n.name]=n.transform}),Object.keys(i).forEach(n=>{r.text[n]=i[n](r.text[n])}),r},ky=(e,t)=>{let r=[],i=wy(t,e.columns);return r=r.concat(Sa(e.tableStyle,e.columns,i,e.colorMap,void 0,e.charLength)),r},vy=e=>{let t=[];if(e.title===void 0)return t;let r=()=>{let s=(o,a)=>o+a+2+1;return e.columns.map(o=>o.length||fe.DEFAULT_COLUMN_LEN).reduce(s,1)},i=(0,va.textWithPadding)(e.title,fe.DEFAULT_HEADER_ALIGNMENT,r()),n=new ka.default(e.colorMap);return n.addCharsWithColor(fe.DEFAULT_HEADER_FONT_COLOR,i),t.push(n.renderConsole()),t},Sy=e=>{let t=[];t.push((0,He.renderTableHorizontalBorders)(e.tableStyle.headerTop,e.columns.map(i=>i.length||fe.DEFAULT_COLUMN_LEN)));let r=(0,He.createHeaderAsRow)(He.createRow,e.columns);return t=t.concat(Sa(e.tableStyle,e.columns,r,e.colorMap,!0)),t.push((0,He.renderTableHorizontalBorders)(e.tableStyle.headerBottom,e.columns.map(i=>i.length||fe.DEFAULT_COLUMN_LEN))),t},qy=e=>{let t=[];return t.push((0,He.renderTableHorizontalBorders)(e.tableStyle.tableBottom,e.columns.map(r=>r.length||fe.DEFAULT_COLUMN_LEN))),t},$y=(e,t)=>{let r=[],i=e.rows.length-1;return e.rows.indexOf(t)!==i&&t.separator&&r.push((0,He.renderTableHorizontalBorders)(e.tableStyle.rowSeparator,e.columns.map(s=>s.length||fe.DEFAULT_COLUMN_LEN))),r},Ay=e=>{(0,xa.preProcessColumns)(e),(0,xa.preProcessRows)(e);let t=[];return vy(e).forEach(r=>t.push(r)),Sy(e).forEach(r=>t.push(r)),e.rows.forEach(r=>{ky(e,r).forEach(i=>t.push(i)),$y(e,r).forEach(i=>t.push(i))}),qy(e).forEach(r=>t.push(r)),t.join(`
31
+ `)};le.renderTable=Ay;var Cy=(e,t)=>{let r=new by.default(t);return r.addRows(e),(0,le.renderTable)(r)};le.renderSimpleTable=Cy;var Ey=(e,t)=>{console.log((0,le.renderSimpleTable)(e,t))};le.printSimpleTable=Ey});var Fn=q(Gn=>{"use strict";Object.defineProperty(Gn,"__esModule",{value:!0});var Py=En(),Ar=Gt(),Bn=Wt(),Un=_a(),Ty=Mn(),Oy=()=>0,Iy=()=>!0,Nn=class{initSimple(t){this.columns=t.map(r=>({name:r,title:r,alignment:Ar.DEFAULT_ROW_ALIGNMENT}))}initDetailed(t){var r;this.title=t?.title||this.title,this.tableStyle=Object.assign(Object.assign({},this.tableStyle),t?.style),this.sortFunction=t?.sort||this.sortFunction,this.filterFunction=t?.filter||this.filterFunction,this.enabledColumns=t?.enabledColumns||this.enabledColumns,this.disabledColumns=t?.disabledColumns||this.disabledColumns,this.computedColumns=t?.computedColumns||this.computedColumns,this.columns=((r=t?.columns)===null||r===void 0?void 0:r.map(i=>(0,Un.rawColumnToInternalColumn)(i,t?.defaultColumnOptions)))||this.columns,this.rowSeparator=t?.rowSeparator||this.rowSeparator,this.charLength=t?.charLength||this.charLength,this.defaultColumnOptions=t?.defaultColumnOptions||this.defaultColumnOptions,t?.shouldDisableColors?this.colorMap={}:t?.colorMap&&(this.colorMap=Object.assign(Object.assign({},this.colorMap),t.colorMap)),t.rows!==void 0&&this.addRows(t.rows)}constructor(t){this.rows=[],this.columns=[],this.title=void 0,this.tableStyle=Ar.DEFAULT_TABLE_STYLE,this.filterFunction=Iy,this.sortFunction=Oy,this.enabledColumns=[],this.disabledColumns=[],this.computedColumns=[],this.rowSeparator=Ar.DEFAULT_ROW_SEPARATOR,this.colorMap=Py.DEFAULT_COLOR_MAP,this.charLength={},this.defaultColumnOptions=void 0,this.transforms={},t instanceof Array?this.initSimple(t):typeof t=="object"&&this.initDetailed(t)}createColumnFromRow(t){let r=this.columns.map(i=>i.name);Object.keys(t).forEach(i=>{r.includes(i)||this.columns.push((0,Un.rawColumnToInternalColumn)((0,Bn.createColumFromOnlyName)(i),this.defaultColumnOptions))})}addColumn(t){let r=typeof t=="string"?(0,Bn.createColumFromOnlyName)(t):t;this.columns.push((0,Un.rawColumnToInternalColumn)(r,this.defaultColumnOptions))}addColumns(t){t.forEach(r=>{this.addColumn(r)})}addRow(t,r){this.createColumnFromRow(t),this.rows.push((0,Bn.createRow)(r?.color||Ar.DEFAULT_ROW_FONT_COLOR,t,r?.separator!==void 0?r?.separator:this.rowSeparator))}addRows(t,r){t.forEach(i=>{this.addRow(i,r)})}renderTable(){return(0,Ty.renderTable)(this)}};Gn.default=Nn});var $a=q(Ht=>{"use strict";var Ry=Ht&&Ht.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ht,"__esModule",{value:!0});var jy=Ry(Fn()),qa=Wt(),zn=class{constructor(t){this.table=new jy.default(t)}addColumn(t){return this.table.addColumn(t),this}addColumns(t){return this.table.addColumns(t),this}addRow(t,r){return this.table.addRow(t,(0,qa.convertRawRowOptionsToStandard)(r)),this}addRows(t,r){return this.table.addRows(t,(0,qa.convertRawRowOptionsToStandard)(r)),this}printTable(){let t=this.table.renderTable();console.log(t)}render(){return this.table.renderTable()}};Ht.default=zn});var Kt=q(Se=>{"use strict";var Dy=Se&&Se.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Se,"__esModule",{value:!0});Se.renderTable=Se.printTable=Se.Table=void 0;var Ly=Dy($a());Se.Table=Ly.default;var Aa=Mn();Object.defineProperty(Se,"printTable",{enumerable:!0,get:function(){return Aa.printSimpleTable}});Object.defineProperty(Se,"renderTable",{enumerable:!0,get:function(){return Aa.renderSimpleTable}})});var Jn=q((BS,za)=>{"use strict";var Yn={to(e,t){return t?`\x1B[${t+1};${e+1}H`:`\x1B[${e+1}G`},move(e,t){let r="";return e<0?r+=`\x1B[${-e}D`:e>0&&(r+=`\x1B[${e}C`),t<0?r+=`\x1B[${-t}A`:t>0&&(r+=`\x1B[${t}B`),r},up:(e=1)=>`\x1B[${e}A`,down:(e=1)=>`\x1B[${e}B`,forward:(e=1)=>`\x1B[${e}C`,backward:(e=1)=>`\x1B[${e}D`,nextLine:(e=1)=>"\x1B[E".repeat(e),prevLine:(e=1)=>"\x1B[F".repeat(e),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},tf={up:(e=1)=>"\x1B[S".repeat(e),down:(e=1)=>"\x1B[T".repeat(e)},rf={screen:"\x1B[2J",up:(e=1)=>"\x1B[1J".repeat(e),down:(e=1)=>"\x1B[J".repeat(e),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(e){let t="";for(let r=0;r<e;r++)t+=this.line+(r<e-1?Yn.up():"");return e&&(t+=Yn.left),t}};za.exports={cursor:Yn,scroll:tf,erase:rf,beep:"\x07"}});var Pc=q((oA,Ec)=>{"use strict";Ec.exports=Cc;Cc.sync=Ag;var $c=oe("fs");function $g(e,t){var r=t.pathExt!==void 0?t.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var i=0;i<r.length;i++){var n=r[i].toLowerCase();if(n&&e.substr(-n.length).toLowerCase()===n)return!0}return!1}function Ac(e,t,r){return!e.isSymbolicLink()&&!e.isFile()?!1:$g(t,r)}function Cc(e,t,r){$c.stat(e,function(i,n){r(i,i?!1:Ac(n,e,t))})}function Ag(e,t){return Ac($c.statSync(e),e,t)}});var jc=q((aA,Rc)=>{"use strict";Rc.exports=Oc;Oc.sync=Cg;var Tc=oe("fs");function Oc(e,t,r){Tc.stat(e,function(i,n){r(i,i?!1:Ic(n,t))})}function Cg(e,t){return Ic(Tc.statSync(e),t)}function Ic(e,t){return e.isFile()&&Eg(e,t)}function Eg(e,t){var r=e.mode,i=e.uid,n=e.gid,s=t.uid!==void 0?t.uid:process.getuid&&process.getuid(),o=t.gid!==void 0?t.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8),d=parseInt("001",8),p=a|c,u=r&d||r&c&&n===o||r&a&&i===s||r&p&&s===0;return u}});var Lc=q((pA,Dc)=>{"use strict";var cA=oe("fs"),ri;process.platform==="win32"||global.TESTING_WINDOWS?ri=Pc():ri=jc();Dc.exports=hs;hs.sync=Pg;function hs(e,t,r){if(typeof t=="function"&&(r=t,t={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(i,n){hs(e,t||{},function(s,o){s?n(s):i(o)})})}ri(e,t||{},function(i,n){i&&(i.code==="EACCES"||t&&t.ignoreErrors)&&(i=null,n=!1),r(i,n)})}function Pg(e,t){try{return ri.sync(e,t||{})}catch(r){if(t&&t.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var zc=q((dA,Gc)=>{"use strict";var $t=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",Mc=oe("path"),Tg=$t?";":":",Fc=Lc(),Bc=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),Uc=(e,t)=>{let r=t.colon||Tg,i=e.match(/\//)||$t&&e.match(/\\/)?[""]:[...$t?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],n=$t?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=$t?n.split(r):[""];return $t&&e.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:i,pathExt:s,pathExtExe:n}},Nc=(e,t,r)=>{typeof t=="function"&&(r=t,t={}),t||(t={});let{pathEnv:i,pathExt:n,pathExtExe:s}=Uc(e,t),o=[],a=d=>new Promise((p,u)=>{if(d===i.length)return t.all&&o.length?p(o):u(Bc(e));let l=i[d],m=/^".*"$/.test(l)?l.slice(1,-1):l,h=Mc.join(m,e),f=!m&&/^\.[\\\/]/.test(e)?e.slice(0,2)+h:h;p(c(f,d,0))}),c=(d,p,u)=>new Promise((l,m)=>{if(u===n.length)return l(a(p+1));let h=n[u];Fc(d+h,{pathExt:s},(f,x)=>{if(!f&&x)if(t.all)o.push(d+h);else return l(d+h);return l(c(d,p,u+1))})});return r?a(0).then(d=>r(null,d),r):a(0)},Og=(e,t)=>{t=t||{};let{pathEnv:r,pathExt:i,pathExtExe:n}=Uc(e,t),s=[];for(let o=0;o<r.length;o++){let a=r[o],c=/^".*"$/.test(a)?a.slice(1,-1):a,d=Mc.join(c,e),p=!c&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d;for(let u=0;u<i.length;u++){let l=p+i[u];try{if(Fc.sync(l,{pathExt:n}))if(t.all)s.push(l);else return l}catch{}}}if(t.all&&s.length)return s;if(t.nothrow)return null;throw Bc(e)};Gc.exports=Nc;Nc.sync=Og});var Wc=q((uA,ys)=>{"use strict";var Vc=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(i=>i.toUpperCase()==="PATH")||"Path"};ys.exports=Vc;ys.exports.default=Vc});var Jc=q((lA,Yc)=>{"use strict";var Hc=oe("path"),Ig=zc(),Rg=Wc();function Kc(e,t){let r=e.options.env||process.env,i=process.cwd(),n=e.options.cwd!=null,s=n&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(e.options.cwd)}catch{}let o;try{o=Ig.sync(e.command,{path:r[Rg({env:r})],pathExt:t?Hc.delimiter:void 0})}catch{}finally{s&&process.chdir(i)}return o&&(o=Hc.resolve(n?e.options.cwd:"",o)),o}function jg(e){return Kc(e)||Kc(e,!0)}Yc.exports=jg});var Xc=q((mA,gs)=>{"use strict";var fs=/([()\][%!^"`<>&|;, *?])/g;function Dg(e){return e=e.replace(fs,"^$1"),e}function Lg(e,t){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(fs,"^$1"),t&&(e=e.replace(fs,"^$1")),e}gs.exports.command=Dg;gs.exports.argument=Lg});var Zc=q((hA,Qc)=>{"use strict";Qc.exports=/^#!(.*)/});var tp=q((yA,ep)=>{"use strict";var Mg=Zc();ep.exports=(e="")=>{let t=e.match(Mg);if(!t)return null;let[r,i]=t[0].replace(/#! ?/,"").split(" "),n=r.split("/").pop();return n==="env"?i:i?`${n} ${i}`:n}});var ip=q((fA,rp)=>{"use strict";var _s=oe("fs"),Fg=tp();function Bg(e){let r=Buffer.alloc(150),i;try{i=_s.openSync(e,"r"),_s.readSync(i,r,0,150,0),_s.closeSync(i)}catch{}return Fg(r.toString())}rp.exports=Bg});var ap=q((gA,op)=>{"use strict";var Ug=oe("path"),np=Jc(),sp=Xc(),Ng=ip(),Gg=process.platform==="win32",zg=/\.(?:com|exe)$/i,Vg=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Wg(e){e.file=np(e);let t=e.file&&Ng(e.file);return t?(e.args.unshift(e.file),e.command=t,np(e)):e.file}function Hg(e){if(!Gg)return e;let t=Wg(e),r=!zg.test(t);if(e.options.forceShell||r){let i=Vg.test(t);e.command=Ug.normalize(e.command),e.command=sp.command(e.command),e.args=e.args.map(s=>sp.argument(s,i));let n=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${n}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}function Kg(e,t,r){t&&!Array.isArray(t)&&(r=t,t=null),t=t?t.slice(0):[],r=Object.assign({},r);let i={command:e,args:t,options:r,file:void 0,original:{command:e,args:t}};return r.shell?i:Hg(i)}op.exports=Kg});var dp=q((_A,pp)=>{"use strict";var bs=process.platform==="win32";function xs(e,t){return Object.assign(new Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function Yg(e,t){if(!bs)return;let r=e.emit;e.emit=function(i,n){if(i==="exit"){let s=cp(n,t);if(s)return r.call(e,"error",s)}return r.apply(e,arguments)}}function cp(e,t){return bs&&e===1&&!t.file?xs(t.original,"spawn"):null}function Jg(e,t){return bs&&e===1&&!t.file?xs(t.original,"spawnSync"):null}pp.exports={hookChildProcess:Yg,verifyENOENT:cp,verifyENOENTSync:Jg,notFoundError:xs}});var mp=q((bA,At)=>{"use strict";var up=oe("child_process"),ws=ap(),ks=dp();function lp(e,t,r){let i=ws(e,t,r),n=up.spawn(i.command,i.args,i.options);return ks.hookChildProcess(n,i),n}function Xg(e,t,r){let i=ws(e,t,r),n=up.spawnSync(i.command,i.args,i.options);return n.error=n.error||ks.verifyENOENTSync(n.status,i),n}At.exports=lp;At.exports.spawn=lp;At.exports.sync=Xg;At.exports._parse=ws;At.exports._enoent=ks});var ia=N(ra(),1),{program:Jv,createCommand:Xv,createArgument:Qv,createOption:Zv,CommanderError:eS,InvalidArgumentError:tS,InvalidOptionArgumentError:rS,Command:na,Argument:iS,Option:sa,Help:nS}=ia.default;var ih=N(X(),1);function C(e){if(!e)return;let t={};return e.expand?.length&&(t.expand=e.expand.join(",")),e.fields?.length&&(t.fields=e.fields.join(",")),Object.keys(t).length>0?t:void 0}function Ph(e){return e===!1?!1:{maxRetries:e?.maxRetries??2,retryOnStatus:e?.retryOnStatus??[429,500,502,503,504],baseDelay:e?.baseDelay??300,maxDelay:e?.maxDelay??1e4,retryOnNetworkError:e?.retryOnNetworkError??!0}}var Th=new Set(["page","limit","expand","sort","fields"]);function b(e){let t={};for(let[r,i]of Object.entries(e))if(i!==void 0){if(Th.has(r)){t[r]=Array.isArray(i)?i.join(","):i;continue}if(r.startsWith("q[")){t[r]=i;continue}if(Array.isArray(i)){let n=r.endsWith("[]")?r.slice(0,-2):r;t[`q[${n}][]`]=i}else t[`q[${r}]`]=i}return t}var nt=class extends Error{code;status;details;constructor(e,t){super(e.error.message),this.name="SpreeError",this.code=e.error.code,this.status=t,this.details=e.error.details}};function ca(e,t){let r=t.baseDelay*2**e,i=Math.random()*t.baseDelay;return Math.min(r+i,t.maxDelay)}function pa(e){return new Promise(t=>setTimeout(t,e))}function Oh(){return`spree-sdk-retry-${crypto.randomUUID()}`}function Ih(e,t,r,i){return e==="GET"||e==="HEAD"||i?r.retryOnStatus.includes(t):t===429}function Rh(e,t,r){return t.retryOnNetworkError?e==="GET"||e==="HEAD"||r:!1}function jh(e,t,r,i){return async function(s,o,a={}){let{token:c,spreeToken:d,idempotencyKey:p,headers:u={},body:l,params:m}=a,h=a.locale??i?.locale,f=a.currency??i?.currency,x=a.country??i?.country,_=a.channel??i?.channel,S=typeof window<"u"?window.location.origin:void 0,A=e.baseUrl||S;if(!A)throw new TypeError("sdk-core: baseUrl is required in non-browser environments (no window.location to resolve relative URLs against)");let P=new URL(`${e.baseUrl}${t}${o}`,A);m&&Object.entries(m).forEach(([z,v])=>{if(v!==void 0)if(Array.isArray(v))for(let Re of v)P.searchParams.append(z,String(Re));else P.searchParams.set(z,String(v))});let w={"Content-Type":"application/json",...u};r.headerValue&&(w[r.headerName]=r.headerValue),c&&(w.Authorization=`Bearer ${c}`),d&&(w["x-spree-token"]=d),h&&(w["x-spree-locale"]=h),f&&(w["x-spree-currency"]=f),x&&(w["x-spree-country"]=x),_&&(w["x-spree-channel"]=_);let O=p??(s!=="GET"&&s!=="HEAD"&&e.retryConfig?Oh():void 0);O&&(w["Idempotency-Key"]=O);let I=!!O,F=e.retryConfig?e.retryConfig.maxRetries+1:1;for(let z=0;z<F;z++)try{let v=await e.fetchFn(P.toString(),{method:s,headers:w,body:l?JSON.stringify(l):void 0,credentials:e.credentials});if(!v.ok){if(!(z>=F-1)&&e.retryConfig&&Ih(s,v.status,e.retryConfig,I)){let U=v.headers.get("Retry-After"),se=U?Math.min(parseInt(U,10)*1e3,e.retryConfig.maxDelay):ca(z,e.retryConfig);await pa(se);continue}let je=await v.json();throw new nt(je,v.status)}return v.status===204?void 0:v.status===202?v.headers.get("content-type")?.includes("application/json")?v.json():void 0:v.json()}catch(v){if(v instanceof nt)throw v;if(!(z>=F-1)&&e.retryConfig&&Rh(s,e.retryConfig,I)){let je=ca(z,e.retryConfig);await pa(je);continue}throw v}throw new Error("Unexpected end of retry loop")}}var it={"Spree::Product":"/products","Spree::Variant":"/variants","Spree::Order":"/orders","Spree::User":"/customers","Spree::Category":"/categories","Spree::OptionType":"/option_types"},Dh=class{request;constructor(e){this.request=e}parentScopedCustomFields(e){return{list:(t,r,i)=>this.request("GET",`${e}/${t}/custom_fields`,{...i,params:r?b(r):void 0}),get:(t,r,i)=>this.request("GET",`${e}/${t}/custom_fields/${r}`,i),create:(t,r,i)=>this.request("POST",`${e}/${t}/custom_fields`,{...i,body:r}),update:(t,r,i,n)=>this.request("PATCH",`${e}/${t}/custom_fields/${r}`,{...n,body:i}),delete:(t,r,i)=>this.request("DELETE",`${e}/${t}/custom_fields/${r}`,i)}}parentScopedTranslations(e){return{get:(t,r)=>this.request("GET",`${e}/${t}/translations`,r).then(i=>i.data)}}customFields(e,t){let r=it[e];if(!r)throw new Error(`Unknown custom-field owner type: ${e}. Add it to CUSTOM_FIELD_OWNER_PATHS.`);let i=this.parentScopedCustomFields(r);return{list:(n,s)=>i.list(t,n,s),get:(n,s)=>i.get(t,n,s),create:(n,s)=>i.create(t,n,s),update:(n,s,o)=>i.update(t,n,s,o),delete:(n,s)=>i.delete(t,n,s)}}customFieldDefinitions={list:(e,t)=>this.request("GET","/custom_field_definitions",{...t,params:e?b(e):void 0}),get:(e,t)=>this.request("GET",`/custom_field_definitions/${e}`,t),create:(e,t)=>this.request("POST","/custom_field_definitions",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/custom_field_definitions/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/custom_field_definitions/${e}`,t)};auth={login:(e,t)=>this.request("POST","/auth/login",{...t,body:e}),refresh:e=>this.request("POST","/auth/refresh",e),logout:e=>this.request("POST","/auth/logout",e),lookupInvitation:(e,t,r)=>this.request("GET",`/auth/invitations/${e}/lookup`,{...r,params:{token:t}}),acceptInvitation:(e,t,r,i)=>this.request("POST",`/auth/invitations/${e}/accept`,{...i,params:{token:t},body:r})};me={get:e=>this.request("GET","/me",e),update:(e,t)=>this.request("PATCH","/me",{...t,body:e})};dashboard={analytics:(e,t)=>this.request("GET","/dashboard/analytics",{...t,params:e})};store={get:e=>this.request("GET","/store",e),update:(e,t)=>this.request("PATCH","/store",{...t,body:e})};locales={list:e=>this.request("GET","/locales",e).then(t=>t.data)};translatableResources={list:e=>this.request("GET","/translatable_resources",e).then(t=>t.data)};translations={batch:(e,t)=>this.request("POST","/translations/batch",{...t,body:{translations:e}}).then(r=>r.data)};products={list:(e,t)=>this.request("GET","/products",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/products/${e}`,{...r,params:C(t)}),create:(e,t)=>this.request("POST","/products",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/products/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/products/${e}`,t),clone:(e,t)=>this.request("POST",`/products/${e}/clone`,t),bulkStatusUpdate:(e,t)=>this.request("POST","/products/bulk_status_update",{...t,body:e}),bulkAddToCategories:(e,t)=>this.request("POST","/products/bulk_add_to_categories",{...t,body:e}),bulkRemoveFromCategories:(e,t)=>this.request("POST","/products/bulk_remove_from_categories",{...t,body:e}),bulkAddToChannels:(e,t)=>this.request("POST","/products/bulk_add_to_channels",{...t,body:e}),bulkRemoveFromChannels:(e,t)=>this.request("POST","/products/bulk_remove_from_channels",{...t,body:e}),bulkAddTags:(e,t)=>this.request("POST","/products/bulk_add_tags",{...t,body:e}),bulkRemoveTags:(e,t)=>this.request("POST","/products/bulk_remove_tags",{...t,body:e}),bulkDestroy:(e,t)=>this.request("DELETE","/products/bulk_destroy",{...t,body:e}),media:{list:(e,t,r)=>this.request("GET",`/products/${e}/media`,{...r,params:t?b(t):void 0}),create:(e,t,r)=>this.request("POST",`/products/${e}/media`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/products/${e}/media/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/products/${e}/media/${t}`,r)},variants:{list:(e,t,r)=>this.request("GET",`/products/${e}/variants`,{...r,params:t?b(t):void 0}),get:(e,t,r,i)=>this.request("GET",`/products/${e}/variants/${t}`,{...i,params:C(r)}),create:(e,t,r)=>this.request("POST",`/products/${e}/variants`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/products/${e}/variants/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/products/${e}/variants/${t}`,r),media:{list:(e,t,r,i)=>this.request("GET",`/products/${e}/variants/${t}/media`,{...i,params:r?b(r):void 0}),create:(e,t,r,i)=>this.request("POST",`/products/${e}/variants/${t}/media`,{...i,body:r}),update:(e,t,r,i,n)=>this.request("PATCH",`/products/${e}/variants/${t}/media/${r}`,{...n,body:i}),delete:(e,t,r,i)=>this.request("DELETE",`/products/${e}/variants/${t}/media/${r}`,i)}},customFields:this.parentScopedCustomFields(it["Spree::Product"]),translations:this.parentScopedTranslations("/products")};orders={list:(e,t)=>this.request("GET","/orders",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/orders/${e}`,{...r,params:C(t)}),create:(e,t)=>this.request("POST","/orders",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/orders/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/orders/${e}`,t),complete:(e,t,r)=>this.request("PATCH",`/orders/${e}/complete`,{...r,body:t}),cancel:(e,t,r)=>this.request("PATCH",`/orders/${e}/cancel`,{...r,body:t}),approve:(e,t,r)=>this.request("PATCH",`/orders/${e}/approve`,{...r,body:t}),resume:(e,t)=>this.request("PATCH",`/orders/${e}/resume`,t),resendConfirmation:(e,t)=>this.request("POST",`/orders/${e}/resend_confirmation`,t),giftCards:{apply:(e,t,r)=>this.request("POST",`/orders/${e}/gift_cards`,{...r,body:t}),remove:(e,t,r)=>this.request("DELETE",`/orders/${e}/gift_cards/${t}`,r)},storeCredits:{apply:(e,t,r)=>this.request("POST",`/orders/${e}/store_credits`,{...r,body:t}),remove:(e,t)=>this.request("DELETE",`/orders/${e}/store_credits`,t)},items:{list:(e,t,r)=>this.request("GET",`/orders/${e}/items`,{...r,params:t?b(t):void 0}),get:(e,t,r,i)=>this.request("GET",`/orders/${e}/items/${t}`,{...i,params:C(r)}),create:(e,t,r)=>this.request("POST",`/orders/${e}/items`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/items/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/orders/${e}/items/${t}`,r)},fulfillments:{list:(e,t,r)=>this.request("GET",`/orders/${e}/fulfillments`,{...r,params:t?b(t):void 0}),get:(e,t,r,i)=>this.request("GET",`/orders/${e}/fulfillments/${t}`,{...i,params:C(r)}),update:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/fulfillments/${t}`,{...i,body:r}),fulfill:(e,t,r)=>this.request("PATCH",`/orders/${e}/fulfillments/${t}/fulfill`,r),cancel:(e,t,r)=>this.request("PATCH",`/orders/${e}/fulfillments/${t}/cancel`,r),resume:(e,t,r)=>this.request("PATCH",`/orders/${e}/fulfillments/${t}/resume`,r),split:(e,t,r,i)=>this.request("PATCH",`/orders/${e}/fulfillments/${t}/split`,{...i,body:r})},payments:{list:(e,t,r)=>this.request("GET",`/orders/${e}/payments`,{...r,params:t?b(t):void 0}),get:(e,t,r,i)=>this.request("GET",`/orders/${e}/payments/${t}`,{...i,params:C(r)}),create:(e,t,r)=>this.request("POST",`/orders/${e}/payments`,{...r,body:t}),capture:(e,t,r)=>this.request("PATCH",`/orders/${e}/payments/${t}/capture`,r),void:(e,t,r)=>this.request("PATCH",`/orders/${e}/payments/${t}/void`,r)},refunds:{list:(e,t,r)=>this.request("GET",`/orders/${e}/refunds`,{...r,params:t?b(t):void 0}),create:(e,t,r)=>this.request("POST",`/orders/${e}/refunds`,{...r,body:t})},adjustments:{list:(e,t,r)=>this.request("GET",`/orders/${e}/adjustments`,{...r,params:t?b(t):void 0}),get:(e,t,r)=>this.request("GET",`/orders/${e}/adjustments/${t}`,r)},customFields:this.parentScopedCustomFields(it["Spree::Order"])};optionTypes={list:(e,t)=>this.request("GET","/option_types",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/option_types/${e}`,{...r,params:C(t)}),create:(e,t)=>this.request("POST","/option_types",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/option_types/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/option_types/${e}`,t),customFields:this.parentScopedCustomFields(it["Spree::OptionType"]),translations:this.parentScopedTranslations("/option_types")};paymentMethods={list:(e,t)=>this.request("GET","/payment_methods",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/payment_methods/${e}`,{...r,params:C(t)}),create:(e,t)=>this.request("POST","/payment_methods",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/payment_methods/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/payment_methods/${e}`,t),types:e=>this.request("GET","/payment_methods/types",e)};priceLists={list:(e,t)=>this.request("GET","/price_lists",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/price_lists/${e}`,{...r,params:C(t)}),create:(e,t)=>this.request("POST","/price_lists",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/price_lists/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/price_lists/${e}`,t),activate:(e,t)=>this.request("PATCH",`/price_lists/${e}/activate`,t),deactivate:(e,t)=>this.request("PATCH",`/price_lists/${e}/deactivate`,t),ruleTypes:e=>this.request("GET","/price_lists/price_rule_types",e)};prices={list:(e,t)=>this.request("GET","/prices",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/prices/${e}`,{...r,params:C(t)}),create:(e,t)=>this.request("POST","/prices",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/prices/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/prices/${e}`,t),bulkUpsert:(e,t)=>this.request("POST","/prices/bulk_upsert",{...t,body:e}),bulkDestroy:(e,t)=>this.request("DELETE","/prices/bulk_destroy",{...t,body:e})};promotions={list:(e,t)=>this.request("GET","/promotions",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/promotions/${e}`,{...r,params:C(t)}),create:(e,t)=>this.request("POST","/promotions",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/promotions/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/promotions/${e}`,t),actions:{list:(e,t,r)=>this.request("GET",`/promotions/${e}/promotion_actions`,{...r,params:t?b(t):void 0}),get:(e,t,r)=>this.request("GET",`/promotions/${e}/promotion_actions/${t}`,r),create:(e,t,r)=>this.request("POST",`/promotions/${e}/promotion_actions`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/promotions/${e}/promotion_actions/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/promotions/${e}/promotion_actions/${t}`,r)},rules:{list:(e,t,r)=>this.request("GET",`/promotions/${e}/promotion_rules`,{...r,params:t?b(t):void 0}),get:(e,t,r)=>this.request("GET",`/promotions/${e}/promotion_rules/${t}`,r),create:(e,t,r)=>this.request("POST",`/promotions/${e}/promotion_rules`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/promotions/${e}/promotion_rules/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/promotions/${e}/promotion_rules/${t}`,r)},couponCodes:{list:(e,t,r)=>this.request("GET",`/promotions/${e}/coupon_codes`,{...r,params:t?b(t):void 0}),get:(e,t,r)=>this.request("GET",`/promotions/${e}/coupon_codes/${t}`,r)}};promotionActions={types:e=>this.request("GET","/promotion_actions/types",e),calculators:(e,t)=>this.request("GET","/promotion_actions/calculators",{...t,params:{type:e}})};promotionRules={types:e=>this.request("GET","/promotion_rules/types",e)};tags={list:(e,t)=>this.request("GET","/tags",{...t,params:e})};customerGroups={list:(e,t)=>this.request("GET","/customer_groups",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/customer_groups/${e}`,{...r,params:C(t)}),create:(e,t)=>this.request("POST","/customer_groups",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/customer_groups/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/customer_groups/${e}`,t)};giftCards={list:(e,t)=>this.request("GET","/gift_cards",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/gift_cards/${e}`,{...r,params:C(t)}),create:(e,t)=>this.request("POST","/gift_cards",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/gift_cards/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/gift_cards/${e}`,t)};giftCardBatches={list:(e,t)=>this.request("GET","/gift_card_batches",{...t,params:e?b(e):void 0}),get:(e,t)=>this.request("GET",`/gift_card_batches/${e}`,t),create:(e,t)=>this.request("POST","/gift_card_batches",{...t,body:e})};exports={list:(e,t)=>this.request("GET","/exports",{...t,params:e?b(e):void 0}),get:(e,t)=>this.request("GET",`/exports/${e}`,t),create:(e,t)=>this.request("POST","/exports",{...t,body:e}),delete:(e,t)=>this.request("DELETE",`/exports/${e}`,t)};customers={list:(e,t)=>this.request("GET","/customers",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/customers/${e}`,{...r,params:C(t)}),creditCards:{list:(e,t,r)=>this.request("GET",`/customers/${e}/credit_cards`,{...r,params:t?b(t):void 0}),get:(e,t,r,i)=>this.request("GET",`/customers/${e}/credit_cards/${t}`,{...i,params:C(r)}),delete:(e,t,r)=>this.request("DELETE",`/customers/${e}/credit_cards/${t}`,r)},create:(e,t)=>this.request("POST","/customers",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/customers/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/customers/${e}`,t),bulkAddToGroups:(e,t)=>this.request("POST","/customers/bulk_add_to_groups",{...t,body:e}),bulkRemoveFromGroups:(e,t)=>this.request("POST","/customers/bulk_remove_from_groups",{...t,body:e}),bulkAddTags:(e,t)=>this.request("POST","/customers/bulk_add_tags",{...t,body:e}),bulkRemoveTags:(e,t)=>this.request("POST","/customers/bulk_remove_tags",{...t,body:e}),addresses:{list:(e,t,r)=>this.request("GET",`/customers/${e}/addresses`,{...r,params:t?b(t):void 0}),get:(e,t,r,i)=>this.request("GET",`/customers/${e}/addresses/${t}`,{...i,params:C(r)}),create:(e,t,r)=>this.request("POST",`/customers/${e}/addresses`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/customers/${e}/addresses/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/customers/${e}/addresses/${t}`,r)},storeCredits:{list:(e,t,r)=>this.request("GET",`/customers/${e}/store_credits`,{...r,params:t?b(t):void 0}),get:(e,t,r,i)=>this.request("GET",`/customers/${e}/store_credits/${t}`,{...i,params:C(r)}),create:(e,t,r)=>this.request("POST",`/customers/${e}/store_credits`,{...r,body:t}),update:(e,t,r,i)=>this.request("PATCH",`/customers/${e}/store_credits/${t}`,{...i,body:r}),delete:(e,t,r)=>this.request("DELETE",`/customers/${e}/store_credits/${t}`,r)},customFields:this.parentScopedCustomFields(it["Spree::User"])};categories={list:(e,t)=>this.request("GET","/categories",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/categories/${e}`,{...r,params:C(t)}),create:(e,t)=>this.request("POST","/categories",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/categories/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/categories/${e}`,t),reposition:(e,t,r)=>this.request("PATCH",`/categories/${e}/reposition`,{...r,body:t}),products:{list:(e,t,r)=>this.request("GET",`/categories/${e}/products`,{...r,params:t?b(t):void 0}),add:(e,t,r)=>this.request("POST",`/categories/${e}/products`,{...r,body:{product_id:t}}),remove:(e,t,r)=>this.request("DELETE",`/categories/${e}/products/${t}`,r),reposition:(e,t,r,i)=>this.request("PATCH",`/categories/${e}/products/${t}/reposition`,{...i,body:r})},customFields:this.parentScopedCustomFields(it["Spree::Category"]),translations:this.parentScopedTranslations("/categories")};variants={list:(e,t)=>this.request("GET","/variants",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/variants/${e}`,{...r,params:C(t)}),customFields:this.parentScopedCustomFields(it["Spree::Variant"])};taxCategories={list:(e,t)=>this.request("GET","/tax_categories",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/tax_categories/${e}`,{...r,params:C(t)}),create:(e,t)=>this.request("POST","/tax_categories",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/tax_categories/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/tax_categories/${e}`,t)};channels={list:(e,t)=>this.request("GET","/channels",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/channels/${e}`,{...r,params:C(t)}),create:(e,t)=>this.request("POST","/channels",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/channels/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/channels/${e}`,t),addProducts:(e,t,r)=>this.request("POST",`/channels/${e}/add_products`,{...r,body:t}),removeProducts:(e,t,r)=>this.request("POST",`/channels/${e}/remove_products`,{...r,body:t})};markets={list:(e,t)=>this.request("GET","/markets",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/markets/${e}`,{...r,params:C(t)}),create:(e,t)=>this.request("POST","/markets",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/markets/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/markets/${e}`,t)};storeCreditCategories={list:(e,t)=>this.request("GET","/store_credit_categories",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/store_credit_categories/${e}`,{...r,params:C(t)})};stockLocations={list:(e,t)=>this.request("GET","/stock_locations",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/stock_locations/${e}`,{...r,params:C(t)}),create:(e,t)=>this.request("POST","/stock_locations",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/stock_locations/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/stock_locations/${e}`,t)};stockItems={list:(e,t)=>this.request("GET","/stock_items",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/stock_items/${e}`,{...r,params:C(t)}),update:(e,t,r)=>this.request("PATCH",`/stock_items/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/stock_items/${e}`,t)};stockTransfers={list:(e,t)=>this.request("GET","/stock_transfers",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/stock_transfers/${e}`,{...r,params:C(t)}),create:(e,t)=>this.request("POST","/stock_transfers",{...t,body:e}),delete:(e,t)=>this.request("DELETE",`/stock_transfers/${e}`,t)};countries={list:(e,t)=>this.request("GET","/countries",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/countries/${e}`,{...r,params:C(t)})};directUploads={create:(e,t)=>this.request("POST","/direct_uploads",{...t,body:e})};adminUsers={list:(e,t)=>this.request("GET","/admin_users",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/admin_users/${e}`,{...r,params:C(t)}),update:(e,t,r)=>this.request("PATCH",`/admin_users/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/admin_users/${e}`,t)};invitations={list:(e,t)=>this.request("GET","/invitations",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/invitations/${e}`,{...r,params:C(t)}),create:(e,t)=>this.request("POST","/invitations",{...t,body:e}),delete:(e,t)=>this.request("DELETE",`/invitations/${e}`,t),resend:(e,t)=>this.request("PATCH",`/invitations/${e}/resend`,t)};apiKeys={list:(e,t)=>this.request("GET","/api_keys",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/api_keys/${e}`,{...r,params:C(t)}),current:e=>this.request("GET","/api_keys/current",e??{}),create:(e,t)=>this.request("POST","/api_keys",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/api_keys/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/api_keys/${e}`,t),revoke:(e,t)=>this.request("PATCH",`/api_keys/${e}/revoke`,t)};allowedOrigins={list:(e,t)=>this.request("GET","/allowed_origins",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/allowed_origins/${e}`,{...r,params:C(t)}),create:(e,t)=>this.request("POST","/allowed_origins",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/allowed_origins/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/allowed_origins/${e}`,t)};webhookEndpoints={list:(e,t)=>this.request("GET","/webhook_endpoints",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/webhook_endpoints/${e}`,{...r,params:C(t)}),create:(e,t)=>this.request("POST","/webhook_endpoints",{...t,body:e}),update:(e,t,r)=>this.request("PATCH",`/webhook_endpoints/${e}`,{...r,body:t}),delete:(e,t)=>this.request("DELETE",`/webhook_endpoints/${e}`,t),sendTest:(e,t)=>this.request("POST",`/webhook_endpoints/${e}/send_test`,t),enable:(e,t)=>this.request("PATCH",`/webhook_endpoints/${e}/enable`,t),disable:(e,t,r)=>this.request("PATCH",`/webhook_endpoints/${e}/disable`,{...r,body:t}),deliveries:{list:(e,t,r)=>this.request("GET",`/webhook_endpoints/${e}/deliveries`,{...r,params:t?b(t):void 0}),get:(e,t,r)=>this.request("GET",`/webhook_endpoints/${e}/deliveries/${t}`,r),redeliver:(e,t,r)=>this.request("POST",`/webhook_endpoints/${e}/deliveries/${t}/redeliver`,r)}};roles={list:(e,t)=>this.request("GET","/roles",{...t,params:e?b(e):void 0}),get:(e,t,r)=>this.request("GET",`/roles/${e}`,{...r,params:C(t)})}};function Nt(e){let t=e.baseUrl.replace(/\/$/,""),r=e.fetch||fetch.bind(globalThis),i=Ph(e.retry),n={baseUrl:t,fetchFn:r,retryConfig:i,credentials:e.credentials??"include"},s=e.jwtToken,o=e.storeId,a=null,c="/api/v3/admin",d=async(l,m,h={})=>{let f={};o&&(f["X-Spree-Store-Id"]=o);let x={...h,headers:{...f,...h.headers}},_=()=>{let S=e.secretKey?{headerName:"X-Spree-Api-Key",headerValue:e.secretKey}:{headerName:"Authorization",headerValue:s?`Bearer ${s}`:""};return jh(n,c,S)(l,m,x)};try{return await _()}catch(S){if(S instanceof nt&&S.status===401&&a&&!m.includes("/auth/")&&await a())return _();throw S}},p=new Dh(d),u=Object.create(p);return u.setStore=l=>{o=l},u.setToken=l=>{s=l},u.onUnauthorized=l=>{a=l},u}var gm=N(Kt(),1),we=N(X(),1);var Ca=N(X(),1);import My from"fs";var Vn=Symbol("no-body");async function Ea(e){if(e===void 0)return Vn;let t;if(e==="-")t=await Fy();else if(e.startsWith("@")){let r=e.slice(1);try{t=My.readFileSync(r,"utf-8")}catch(i){throw i?.code==="ENOENT"?new Error(`Request body file not found: ${r}`):new Error(`Could not read request body file ${r}: ${i.message}`)}}else t=e;try{return JSON.parse(t)}catch{let r=e==="-"?" (from stdin)":e.startsWith("@")?` (${e.slice(1)})`:"";throw new Error(`Request body is not valid JSON${r}`)}}async function Fy(){process.stdin.isTTY&&process.stderr.write(`${Ca.default.dim("Reading request body from stdin \u2014 paste JSON and press Ctrl-D...")}
32
+ `);let e=[];for await(let t of process.stdin)e.push(t);return Buffer.concat(e).toString("utf-8")}var Uo=N(Kt(),1),pe=N(X(),1);var hr=N(X(),1);import ze from"fs";import Qk from"os";import Mt from"path";var Cr="spree@example.com",Er="spree123";import ot from"fs";import kt from"path";function g(e=process.cwd()){let t=By(e),r=kt.join(t,"docker-compose.yml");if(!ot.existsSync(r))throw new Error(`Not a Spree project directory. No docker-compose.yml found.
33
+ Run this command from a directory created with create-spree-app.`);let i=Uy(t);return{mode:"docker",projectDir:t,port:i}}function By(e){if(kt.basename(e)!=="backend")return e;let t=kt.dirname(e);for(let r of["docker-compose.yml","docker-compose.dev.yml"]){let i=kt.join(t,r);if(ot.existsSync(i))try{if(/\.\/backend:\/rails(:\w+)?(\s|$)/m.test(ot.readFileSync(i,"utf-8")))return t}catch{}}return e}function qe(e){let t=kt.join(e,".env");if(!ot.existsSync(t))return!1;try{let r=ot.readFileSync(t,"utf-8");return/^\s*SPREE_PATH\s*=/m.test(r)}catch{return!1}}function Uy(e){let t=kt.join(e,".env");if(!ot.existsSync(t))return 3e3;let i=ot.readFileSync(t,"utf-8").match(/^SPREE_PORT=(\d+)/m);return i?Number(i[1]):3e3}import{styleText as Xn}from"util";import{stdout as Zn,stdin as Wa}from"process";import*as Ke from"readline";import nf from"readline";var Pa=(()=>{let e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let r=0;for(e.lastIndex=0;e.test(t);)r+=1;return t.length-r}})(),Ta=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,Oa=e=>e===8987||e===9001||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e>=131072&&e<=196605||e>=196608&&e<=262141;var Ny=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,Gy=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,Ia=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu,zy=/\t{1,1000}/y,Ra=new RegExp("[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*","yu"),Vy=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,Wy=new RegExp("\\p{M}+","gu"),Hy={limit:1/0,ellipsis:""},ja=(e,t={},r={})=>{let i=t.limit??1/0,n=t.ellipsis??"",s=t?.ellipsisWidth??(n?ja(n,Hy,r).width:0),o=0,a=r.controlWidth??0,c=r.tabWidth??8,d=r.emojiWidth??2,p=2,u=r.regularWidth??1,l=r.wideWidth??p,m=[[Vy,u],[Ny,o],[Gy,a],[zy,c],[Ra,d],[Ia,l]],h=0,f=0,x=e.length,_=0,S=!1,A=x,P=Math.max(0,i-s),w=0,D=0,O=0,I=0;e:for(;;){if(D>w||f>=x&&f>h){let F=e.slice(w,D)||e.slice(h,f);_=0;for(let z of F.replaceAll(Wy,"")){let v=z.codePointAt(0)||0;if(Ta(v)?I=p:Oa(v)?I=l:I=u,O+I>P&&(A=Math.min(A,Math.max(w,h)+_)),O+I>i){S=!0;break e}_+=z.length,O+=I}w=D=0}if(f>=x)break e;for(let F=0,z=m.length;F<z;F++){let[v,Re]=m[F];if(v.lastIndex=f,v.test(e)){if(_=v===Ia?Pa(e.slice(f,v.lastIndex)):v===Ra?1:v.lastIndex-f,I=_*Re,O+I>P&&(A=Math.min(A,f+Math.floor((P-O)/Re))),O+I>i){S=!0;break e}O+=I,w=h,D=f,f=h=v.lastIndex;continue e}}f+=1}return{width:S?P:O,index:S?A:x,truncated:S,ellipsed:S&&i>=s}},Da=ja;var Ky={limit:1/0,ellipsis:"",ellipsisWidth:0},Yy=(e,t={})=>Da(e,Ky,t).width,ie=Yy;var Tr="\x1B",Ua="\x9B",Jy=39,Hn="\x07",Na="[",Xy="]",Ga="m",Kn=`${Xy}8;;`,La=new RegExp(`(?:\\${Na}(?<code>\\d+)m|\\${Kn}(?<uri>.*)${Hn})`,"y"),Ma=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},Fa=e=>`${Tr}${Na}${e}${Ga}`,Ba=e=>`${Tr}${Kn}${e}${Hn}`,Wn=(e,t,r)=>{let i=t[Symbol.iterator](),n=!1,s=!1,o=e.at(-1),a=o===void 0?0:ie(o),c=i.next(),d=i.next(),p=0;for(;!c.done;){let u=c.value,l=ie(u);a+l<=r?e[e.length-1]+=u:(e.push(u),a=0),(u===Tr||u===Ua)&&(n=!0,s=t.startsWith(Kn,p+1)),n?s?u===Hn&&(n=!1,s=!1):u===Ga&&(n=!1):(a+=l,a===r&&!d.done&&(e.push(""),a=0)),c=d,d=i.next(),p+=u.length}o=e.at(-1),!a&&o!==void 0&&o.length&&e.length>1&&(e[e.length-2]+=e.pop())},Qy=e=>{let t=e.split(" "),r=t.length;for(;r&&!ie(t[r-1]);)r--;return r===t.length?e:t.slice(0,r).join(" ")+t.slice(r).join("")},Zy=(e,t,r={})=>{if(r.trim!==!1&&e.trim()==="")return"";let i="",n,s,o=e.split(" "),a=[""],c=0;for(let u=0;u<o.length;u++){let l=o[u];if(r.trim!==!1){let h=a.at(-1)??"",f=h.trimStart();h.length!==f.length&&(a[a.length-1]=f,c=ie(f))}u!==0&&(c>=t&&(r.wordWrap===!1||r.trim===!1)&&(a.push(""),c=0),(c||r.trim===!1)&&(a[a.length-1]+=" ",c++));let m=ie(l);if(r.hard&&m>t){let h=t-c,f=1+Math.floor((m-h-1)/t);Math.floor((m-1)/t)<f&&a.push(""),Wn(a,l,t),c=ie(a.at(-1)??"");continue}if(c+m>t&&c&&m){if(r.wordWrap===!1&&c<t){Wn(a,l,t),c=ie(a.at(-1)??"");continue}a.push(""),c=0}if(c+m>t&&r.wordWrap===!1){Wn(a,l,t),c=ie(a.at(-1)??"");continue}a[a.length-1]+=l,c+=m}r.trim!==!1&&(a=a.map(u=>Qy(u)));let d=a.join(`
34
+ `),p=!1;for(let u=0;u<d.length;u++){let l=d[u];if(i+=l,p)p=!1;else if(p=l>="\uD800"&&l<="\uDBFF",p)continue;if(l===Tr||l===Ua){La.lastIndex=u+1;let h=La.exec(d)?.groups;if(h?.code!==void 0){let f=Number.parseFloat(h.code);n=f===Jy?void 0:f}else h?.uri!==void 0&&(s=h.uri.length===0?void 0:h.uri)}if(d[u+1]===`
35
+ `){s&&(i+=Ba(""));let m=n?Ma(n):void 0;n&&m&&(i+=Fa(m))}else l===`
36
+ `&&(n&&Ma(n)&&(i+=Fa(n)),s&&(i+=Ba(s)))}return i},ef=/\r?\n/;function $e(e,t,r){return String(e).normalize().split(ef).map(i=>Zy(i,t,r)).join(`
37
+ `)}var te=N(Jn(),1);import{ReadStream as Va}from"tty";function Ir(e,t,r){if(!r.some(o=>!o.disabled))return e;let i=e+t,n=Math.max(r.length-1,0),s=i<0?n:i>n?0:i;return r[s].disabled?Ir(s,t<0?-1:1,r):s}var sf=["up","down","left","right","space","enter","cancel"],of=["January","February","March","April","May","June","July","August","September","October","November","December"],Z={actions:new Set(sf),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"},withGuide:!0,date:{monthNames:[...of],messages:{required:"Please enter a valid date",invalidMonth:"There are only 12 months in a year",invalidDay:(e,t)=>`There are only ${e} days in ${t}`,afterMin:e=>`Date must be on or after ${e.toISOString().slice(0,10)}`,beforeMax:e=>`Date must be on or before ${e.toISOString().slice(0,10)}`}}};function es(e,t){if(typeof e=="string")return Z.aliases.get(e)===t;for(let r of e)if(r!==void 0&&es(r,t))return!0;return!1}function af(e,t){if(e===t)return;let r=e.split(`
38
+ `),i=t.split(`
39
+ `),n=Math.max(r.length,i.length),s=[];for(let o=0;o<n;o++)r[o]!==i[o]&&s.push(o);return{lines:s,numLinesBefore:r.length,numLinesAfter:i.length,numLines:n}}var cf=globalThis.process.platform.startsWith("win"),Qn=Symbol("clack:cancel");function K(e){return e===Qn}function Or(e,t){let r=e;r.isTTY&&r.setRawMode(t)}function Ha({input:e=Wa,output:t=Zn,overwrite:r=!0,hideCursor:i=!0}={}){let n=Ke.createInterface({input:e,output:t,prompt:"",tabSize:1});Ke.emitKeypressEvents(e,n),e instanceof Va&&e.isTTY&&e.setRawMode(!0);let s=(o,{name:a,sequence:c})=>{let d=String(o);if(es([d,a,c],"cancel")){i&&t.write(te.cursor.show),process.exit(0);return}if(!r)return;Ke.moveCursor(t,a==="return"?0:-1,a==="return"?-1:0,()=>{Ke.clearLine(t,1,()=>{e.once("keypress",s)})})};return i&&t.write(te.cursor.hide),e.once("keypress",s),()=>{e.off("keypress",s),i&&t.write(te.cursor.show),e instanceof Va&&e.isTTY&&!cf&&e.setRawMode(!1),n.terminal=!1,n.close()}}var Yt=e=>"columns"in e&&typeof e.columns=="number"?e.columns:80,ts=e=>"rows"in e&&typeof e.rows=="number"?e.rows:20;function Jt(e,t,r,i=r,n){let s=Yt(e??Zn);return $e(t,s-r.length,{hard:!0,trim:!1}).split(`
40
+ `).map((o,a)=>{let c=n?n(o,a):o;return`${a===0?i:r}${c}`}).join(`
41
+ `)}var Mr=class{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame="";_subscribers=new Map;_cursor=0;state="initial";error="";value;userInput="";constructor(e,t=!0){let{input:r=Wa,output:i=Zn,render:n,signal:s,...o}=e;this.opts=o,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=n.bind(this),this._track=t,this._abortSignal=s,this.input=r,this.output=i}unsubscribe(){this._subscribers.clear()}setSubscriber(e,t){let r=this._subscribers.get(e)??[];r.push(t),this._subscribers.set(e,r)}on(e,t){this.setSubscriber(e,{cb:t})}once(e,t){this.setSubscriber(e,{cb:t,once:!0})}emit(e,...t){let r=this._subscribers.get(e)??[],i=[];for(let n of r)n.cb(...t),n.once&&i.push(()=>r.splice(r.indexOf(n),1));for(let n of i)n()}prompt(){return new Promise(e=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),e(Qn);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}this.rl=nf.createInterface({input:this.input,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),this.rl.prompt(),this.opts.initialUserInput!==void 0&&this._setUserInput(this.opts.initialUserInput,!0),this.input.on("keypress",this.onKeypress),Or(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(te.cursor.show),this.output.off("resize",this.render),Or(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(te.cursor.show),this.output.off("resize",this.render),Or(this.input,!1),e(Qn)})})}_isActionKey(e,t){return e===" "}_shouldSubmit(e,t){return!0}_setValue(e){this.value=e,this.emit("value",this.value)}_setUserInput(e,t){this.userInput=e??"",this.emit("userInput",this.userInput),t&&this._track&&this.rl&&(this.rl.write(this.userInput),this._cursor=this.rl.cursor)}_clearUserInput(){this.rl?.write(null,{ctrl:!0,name:"u"}),this._setUserInput("")}onKeypress(e,t){if(this._track&&t.name!=="return"&&(t.name&&this._isActionKey(e,t)&&this.rl?.write(null,{ctrl:!0,name:"h"}),this._cursor=this.rl?.cursor??0,this._setUserInput(this.rl?.line)),this.state==="error"&&(this.state="active"),t?.name&&(!this._track&&Z.aliases.has(t.name)&&this.emit("cursor",Z.aliases.get(t.name)),Z.actions.has(t.name)&&this.emit("cursor",t.name)),e&&(e.toLowerCase()==="y"||e.toLowerCase()==="n")&&this.emit("confirm",e.toLowerCase()==="y"),this.emit("key",e?.toLowerCase(),t),t?.name==="return"&&this._shouldSubmit(e,t)){if(this.opts.validate){let r=this.opts.validate(this.value);r&&(this.error=r instanceof Error?r.message:r,this.state="error",this.rl?.write(this.userInput))}this.state!=="error"&&(this.state="submit")}es([e,t?.name,t?.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(`
42
+ `),Or(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=$e(this._prevFrame,process.stdout.columns,{hard:!0,trim:!1}).split(`
43
+ `).length-1;this.output.write(te.cursor.move(-999,e*-1))}render(){let e=$e(this._render(this)??"",process.stdout.columns,{hard:!0,trim:!1});if(e!==this._prevFrame){if(this.state==="initial")this.output.write(te.cursor.hide);else{let t=af(this._prevFrame,e),r=ts(this.output);if(this.restoreCursor(),t){let i=Math.max(0,t.numLinesAfter-r),n=Math.max(0,t.numLinesBefore-r),s=t.lines.find(o=>o>=i);if(s===void 0){this._prevFrame=e;return}if(t.lines.length===1){this.output.write(te.cursor.move(0,s-n)),this.output.write(te.erase.lines(1));let o=e.split(`
44
+ `);this.output.write(o[s]),this._prevFrame=e,this.output.write(te.cursor.move(0,o.length-s-1));return}else if(t.lines.length>1){if(i<n)s=i;else{let a=s-n;a>0&&this.output.write(te.cursor.move(0,a))}this.output.write(te.erase.down());let o=e.split(`
45
+ `).slice(s);this.output.write(o.join(`
46
+ `)),this._prevFrame=e;return}}this.output.write(te.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}};var Rr=class extends Mr{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(t){super(t,!1),this.value=!!t.initialValue,this.on("userInput",()=>{this.value=this._value}),this.on("confirm",r=>{this.output.write(te.cursor.move(0,-1)),this.value=r,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};var jr=class extends Mr{_mask="\u2022";get cursor(){return this._cursor}get masked(){return this.userInput.replaceAll(/./g,this._mask)}get userInputWithCursor(){if(this.state==="submit"||this.state==="cancel")return this.masked;let t=this.userInput;if(this.cursor>=t.length)return`${this.masked}${Xn(["inverse","hidden"],"_")}`;let r=this.masked,i=r.slice(0,this.cursor),n=r.slice(this.cursor);return`${i}${Xn("inverse",n[0])}${n.slice(1)}`}clear(){this._clearUserInput()}constructor({mask:t,...r}){super(r),this._mask=t??"\u2022",this.on("userInput",i=>{this._setValue(i)})}},Dr=class extends Mr{options;cursor=0;get _selectedValue(){return this.options[this.cursor]}changeValue(){this.value=this._selectedValue.value}constructor(t){super(t,!1),this.options=t.options;let r=this.options.findIndex(({value:n})=>n===t.initialValue),i=r===-1?0:r;this.cursor=this.options[i].disabled?Ir(i,1,this.options):i,this.changeValue(),this.on("cursor",n=>{switch(n){case"left":case"up":this.cursor=Ir(this.cursor,-1,this.options);break;case"down":case"right":this.cursor=Ir(this.cursor,1,this.options);break}this.changeValue()})}};var Lr=class extends Mr{get userInputWithCursor(){if(this.state==="submit")return this.userInput;let t=this.userInput;if(this.cursor>=t.length)return`${this.userInput}\u2588`;let r=t.slice(0,this.cursor),[i,...n]=t.slice(this.cursor);return`${r}${Xn("inverse",i)}${n.join("")}`}get cursor(){return this._cursor}constructor(t){super({...t,initialUserInput:t.initialUserInput??t.initialValue}),this.on("userInput",r=>{this._setValue(r)}),this.on("finalize",()=>{this.value||(this.value=t.defaultValue),this.value===void 0&&(this.value="")})}};import{styleText as y,stripVTControlCharacters as iq}from"util";import me from"process";var Xt=N(Jn(),1);import{existsSync as cq,lstatSync as pq,readdirSync as dq}from"fs";import{dirname as lq,join as mq}from"path";function pf(){return me.platform!=="win32"?me.env.TERM!=="linux":!!me.env.CI||!!me.env.WT_SESSION||!!me.env.TERMINUS_SUBLIME||me.env.ConEmuTask==="{cmd::Cmder}"||me.env.TERM_PROGRAM==="Terminus-Sublime"||me.env.TERM_PROGRAM==="vscode"||me.env.TERM==="xterm-256color"||me.env.TERM==="alacritty"||me.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var rs=pf(),df=()=>process.env.CI==="true";var R=(e,t)=>rs?e:t,uf=R("\u25C6","*"),Ya=R("\u25A0","x"),Ja=R("\u25B2","x"),Ur=R("\u25C7","o"),hq=R("\u250C","T"),$=R("\u2502","|"),Ye=R("\u2514","\u2014"),yq=R("\u2510","T"),fq=R("\u2518","\u2014"),is=R("\u25CF",">"),Br=R("\u25CB"," "),gq=R("\u25FB","[\u2022]"),_q=R("\u25FC","[+]"),bq=R("\u25FB","[ ]"),lf=R("\u25AA","\u2022"),Ka=R("\u2500","-"),mf=R("\u256E","+"),hf=R("\u251C","+"),yf=R("\u256F","+"),ff=R("\u2570","+"),xq=R("\u256D","+"),gf=R("\u25CF","\u2022"),_f=R("\u25C6","*"),bf=R("\u25B2","!"),xf=R("\u25A0","x"),Nr=e=>{switch(e){case"initial":case"active":return y("cyan",uf);case"cancel":return y("red",Ya);case"error":return y("yellow",Ja);case"submit":return y("green",Ur)}},wf=e=>{switch(e){case"initial":case"active":return y("cyan",$);case"cancel":return y("red",$);case"error":return y("yellow",$);case"submit":return y("green",$)}},kf=(e,t,r,i,n)=>{let s=t,o=0;for(let a=r;a<i;a++){let c=e[a];if(s=s-c.length,o++,s<=n)break}return{lineCount:s,removals:o}},vf=({cursor:e,options:t,style:r,output:i=process.stdout,maxItems:n=Number.POSITIVE_INFINITY,columnPadding:s=0,rowPadding:o=4})=>{let a=Yt(i)-s,c=ts(i),d=y("dim","..."),p=Math.max(c-o,0),u=Math.max(Math.min(n,p),5),l=0;e>=u-3&&(l=Math.max(Math.min(e-u+3,t.length-u),0));let m=u<t.length&&l>0,h=u<t.length&&l+u<t.length,f=Math.min(l+u,t.length),x=[],_=0;m&&_++,h&&_++;let S=l+(m?1:0),A=f-(h?1:0);for(let w=S;w<A;w++){let D=$e(r(t[w],w===e),a,{hard:!0,trim:!1}).split(`
47
+ `);x.push(D),_+=D.length}if(_>p){let w=0,D=0,O=_,I=e-S,F=(z,v)=>kf(x,O,z,v,p);m?({lineCount:O,removals:w}=F(0,I),O>p&&({lineCount:O,removals:D}=F(I+1,x.length))):({lineCount:O,removals:D}=F(I+1,x.length),O>p&&({lineCount:O,removals:w}=F(0,I))),w>0&&(m=!0,x.splice(0,w)),D>0&&(h=!0,x.splice(x.length-D,D))}let P=[];m&&P.push(d);for(let w of x)for(let D of w)P.push(D);return h&&P.push(d),P};var at=e=>{let t=e.active??"Yes",r=e.inactive??"No";return new Rr({active:t,inactive:r,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue??!0,render(){let i=e.withGuide??Z.withGuide,n=`${Nr(this.state)} `,s=i?`${y("gray",$)} `:"",o=Jt(e.output,e.message,s,n),a=`${i?`${y("gray",$)}
48
+ `:""}${o}
49
+ `,c=this.value?t:r;switch(this.state){case"submit":{let d=i?`${y("gray",$)} `:"";return`${a}${d}${y("dim",c)}`}case"cancel":{let d=i?`${y("gray",$)} `:"";return`${a}${d}${y(["strikethrough","dim"],c)}${i?`
50
+ ${y("gray",$)}`:""}`}default:{let d=i?`${y("cyan",$)} `:"",p=i?y("cyan",Ye):"";return`${a}${d}${this.value?`${y("green",is)} ${t}`:`${y("dim",Br)} ${y("dim",t)}`}${e.vertical?i?`
51
+ ${y("cyan",$)} `:`
52
+ `:` ${y("dim","/")} `}${this.value?`${y("dim",Br)} ${y("dim",r)}`:`${y("green",is)} ${r}`}
53
+ ${p}
54
+ `}}}}).prompt()};var E={message:(e=[],{symbol:t=y("gray",$),secondarySymbol:r=y("gray",$),output:i=process.stdout,spacing:n=1,withGuide:s}={})=>{let o=[],a=s??Z.withGuide,c=a?r:"",d=a?`${t} `:"",p=a?`${r} `:"";for(let l=0;l<n;l++)o.push(c);let u=Array.isArray(e)?e:e.split(`
55
+ `);if(u.length>0){let[l,...m]=u;l.length>0?o.push(`${d}${l}`):o.push(a?t:"");for(let h of m)h.length>0?o.push(`${p}${h}`):o.push(a?r:"")}i.write(`${o.join(`
56
+ `)}
57
+ `)},info:(e,t)=>{E.message(e,{...t,symbol:y("blue",gf)})},success:(e,t)=>{E.message(e,{...t,symbol:y("green",_f)})},step:(e,t)=>{E.message(e,{...t,symbol:y("green",Ur)})},warn:(e,t)=>{E.message(e,{...t,symbol:y("yellow",bf)})},warning:(e,t)=>{E.warn(e,t)},error:(e,t)=>{E.message(e,{...t,symbol:y("red",xf)})}},M=(e="",t)=>{let r=t?.output??process.stdout,i=t?.withGuide??Z.withGuide?`${y("gray",Ye)} `:"";r.write(`${i}${y("red",e)}
58
+
59
+ `)};var Xa=(e="",t)=>{let r=t?.output??process.stdout,i=t?.withGuide??Z.withGuide?`${y("gray",$)}
60
+ ${y("gray",Ye)} `:"";r.write(`${i}${e}
61
+
62
+ `)};var Sf=e=>y("dim",e),qf=(e,t,r)=>{let i={hard:!0,trim:!1},n=$e(e,t,i).split(`
63
+ `),s=n.reduce((c,d)=>Math.max(ie(d),c),0),o=n.map(r).reduce((c,d)=>Math.max(ie(d),c),0),a=t-(o-s);return $e(e,a,i)},Y=(e="",t="",r)=>{let i=r?.output??me.stdout,n=r?.withGuide??Z.withGuide,s=r?.format??Sf,o=["",...qf(e,Yt(i)-6,s).split(`
64
+ `).map(s),""],a=ie(t),c=Math.max(o.reduce((l,m)=>{let h=ie(m);return h>l?h:l},0),a)+2,d=o.map(l=>`${y("gray",$)} ${l}${" ".repeat(c-ie(l))}${y("gray",$)}`).join(`
65
+ `),p=n?`${y("gray",$)}
66
+ `:"",u=n?hf:ff;i.write(`${p}${y("green",Ur)} ${y("reset",t)} ${y("gray",Ka.repeat(Math.max(c-a-1,1))+mf)}
67
+ ${d}
68
+ ${y("gray",u+Ka.repeat(c+2)+yf)}
69
+ `)},Gr=e=>new jr({validate:e.validate,mask:e.mask??lf,signal:e.signal,input:e.input,output:e.output,render(){let t=e.withGuide??Z.withGuide,r=`${t?`${y("gray",$)}
70
+ `:""}${Nr(this.state)} ${e.message}
71
+ `,i=this.userInputWithCursor,n=this.masked;switch(this.state){case"error":{let s=t?`${y("yellow",$)} `:"",o=t?`${y("yellow",Ye)} `:"",a=n??"";return e.clearOnError&&this.clear(),`${r.trim()}
72
+ ${s}${a}
73
+ ${o}${y("yellow",this.error)}
74
+ `}case"submit":{let s=t?`${y("gray",$)} `:"",o=n?y("dim",n):"";return`${r}${s}${o}`}case"cancel":{let s=t?`${y("gray",$)} `:"",o=n?y(["strikethrough","dim"],n):"";return`${r}${s}${o}${n&&t?`
75
+ ${y("gray",$)}`:""}`}default:{let s=t?`${y("cyan",$)} `:"",o=t?y("cyan",Ye):"";return`${r}${s}${i}
76
+ ${o}
77
+ `}}}}).prompt();var $f=e=>y("magenta",e),G=({indicator:e="dots",onCancel:t,output:r=process.stdout,cancelMessage:i,errorMessage:n,frames:s=rs?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],delay:o=rs?80:120,signal:a,...c}={})=>{let d=df(),p,u,l=!1,m=!1,h="",f,x=performance.now(),_=Yt(r),S=c?.styleFrame??$f,A=U=>{let se=U>1?n??Z.messages.error:i??Z.messages.cancel;m=U===1,l&&(je(se,U),m&&typeof t=="function"&&t())},P=()=>A(2),w=()=>A(1),D=()=>{process.on("uncaughtExceptionMonitor",P),process.on("unhandledRejection",P),process.on("SIGINT",w),process.on("SIGTERM",w),process.on("exit",A),a&&a.addEventListener("abort",w)},O=()=>{process.removeListener("uncaughtExceptionMonitor",P),process.removeListener("unhandledRejection",P),process.removeListener("SIGINT",w),process.removeListener("SIGTERM",w),process.removeListener("exit",A),a&&a.removeEventListener("abort",w)},I=()=>{if(f===void 0)return;d&&r.write(`
78
+ `);let U=$e(f,_,{hard:!0,trim:!1}).split(`
79
+ `);U.length>1&&r.write(Xt.cursor.up(U.length-1)),r.write(Xt.cursor.to(0)),r.write(Xt.erase.down())},F=U=>U.replace(/\.+$/,""),z=U=>{let se=(performance.now()-U)/1e3,De=Math.floor(se/60),Le=Math.floor(se%60);return De>0?`[${De}m ${Le}s]`:`[${Le}s]`},v=c.withGuide??Z.withGuide,Re=(U="")=>{l=!0,p=Ha({output:r}),h=F(U),x=performance.now(),v&&r.write(`${y("gray",$)}
80
+ `);let se=0,De=0;D(),u=setInterval(()=>{if(d&&h===f)return;I(),f=h;let Le=S(s[se]),wr;if(d)wr=`${Le} ${h}...`;else if(e==="timer")wr=`${Le} ${h} ${z(x)}`;else{let sh=".".repeat(Math.floor(De)).slice(0,3);wr=`${Le} ${h}${sh}`}let nh=$e(wr,_,{hard:!0,trim:!1});r.write(nh),se=se+1<s.length?se+1:0,De=De<4?De+.125:0},o)},je=(U="",se=0,De=!1)=>{if(!l)return;l=!1,clearInterval(u),I();let Le=se===0?y("green",Ur):se===1?y("red",Ya):y("red",Ja);h=U??h,De||(e==="timer"?r.write(`${Le} ${h} ${z(x)}
81
+ `):r.write(`${Le} ${h}
82
+ `)),O(),p()};return{start:Re,stop:(U="")=>je(U,0),message:(U="")=>{h=F(U??h)},cancel:(U="")=>je(U,1),error:(U="")=>je(U,2),clear:()=>je("",0,!0),get isCancelled(){return m}}},wq={light:R("\u2500","-"),heavy:R("\u2501","="),block:R("\u2588","#")};var Fr=(e,t)=>e.includes(`
83
+ `)?e.split(`
84
+ `).map(r=>t(r)).join(`
85
+ `):t(e),Qa=e=>{let t=(r,i)=>{let n=r.label??String(r.value);switch(i){case"disabled":return`${y("gray",Br)} ${Fr(n,s=>y("gray",s))}${r.hint?` ${y("dim",`(${r.hint??"disabled"})`)}`:""}`;case"selected":return`${Fr(n,s=>y("dim",s))}`;case"active":return`${y("green",is)} ${n}${r.hint?` ${y("dim",`(${r.hint})`)}`:""}`;case"cancelled":return`${Fr(n,s=>y(["strikethrough","dim"],s))}`;default:return`${y("dim",Br)} ${Fr(n,s=>y("dim",s))}`}};return new Dr({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue,render(){let r=e.withGuide??Z.withGuide,i=`${Nr(this.state)} `,n=`${wf(this.state)} `,s=Jt(e.output,e.message,n,i),o=`${r?`${y("gray",$)}
86
+ `:""}${s}
87
+ `;switch(this.state){case"submit":{let a=r?`${y("gray",$)} `:"",c=Jt(e.output,t(this.options[this.cursor],"selected"),a);return`${o}${c}`}case"cancel":{let a=r?`${y("gray",$)} `:"",c=Jt(e.output,t(this.options[this.cursor],"cancelled"),a);return`${o}${c}${r?`
88
+ ${y("gray",$)}`:""}`}default:{let a=r?`${y("cyan",$)} `:"",c=r?y("cyan",Ye):"",d=o.split(`
89
+ `).length,p=r?2:1;return`${o}${a}${vf({output:e.output,cursor:this.cursor,options:this.options,maxItems:e.maxItems,columnPadding:a.length,rowPadding:d+p,style:(u,l)=>t(u,u.disabled?"disabled":l?"active":"inactive")}).join(`
90
+ ${a}`)}
91
+ ${c}
92
+ `}}}}).prompt()};var kq=`${y("gray",$)} `;var ct=e=>new Lr({validate:e.validate,placeholder:e.placeholder,defaultValue:e.defaultValue,initialValue:e.initialValue,output:e.output,signal:e.signal,input:e.input,render(){let t=e?.withGuide??Z.withGuide,r=`${`${t?`${y("gray",$)}
93
+ `:""}${Nr(this.state)} `}${e.message}
94
+ `,i=e.placeholder?y("inverse",e.placeholder[0])+y("dim",e.placeholder.slice(1)):y(["inverse","hidden"],"_"),n=this.userInput?this.userInputWithCursor:i,s=this.value??"";switch(this.state){case"error":{let o=this.error?` ${y("yellow",this.error)}`:"",a=t?`${y("yellow",$)} `:"",c=t?y("yellow",Ye):"";return`${r.trim()}
95
+ ${a}${n}
96
+ ${c}${o}
97
+ `}case"submit":{let o=s?` ${y("dim",s)}`:"",a=t?y("gray",$):"";return`${r}${a}${o}`}case"cancel":{let o=s?` ${y(["strikethrough","dim"],s)}`:"",a=t?y("gray",$):"";return`${r}${a}${o}${s.trim()?`
98
+ ${a}`:""}`}default:{let o=t?`${y("cyan",$)} `:"",a=t?y("cyan",Ye):"";return`${r}${o}${n}
99
+ ${a}
100
+ `}}}}).prompt();function V(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}import{fileURLToPath as Af}from"url";var vt=(e,t)=>{let r=ss(Cf(e));if(typeof r!="string")throw new TypeError(`${t} must be a string or a file URL: ${r}.`);return r},Cf=e=>ns(e)?e.toString():e,ns=e=>typeof e!="string"&&e&&Object.getPrototypeOf(e)===String.prototype,ss=e=>e instanceof URL?Af(e):e;var zr=(e,t=[],r={})=>{let i=vt(e,"First argument"),[n,s]=V(t)?[[],t]:[t,r];if(!Array.isArray(n))throw new TypeError(`Second argument must be either an array of arguments or an options object: ${n}`);if(n.some(c=>typeof c=="object"&&c!==null))throw new TypeError(`Second argument must be an array of strings: ${n}`);let o=n.map(String),a=o.find(c=>c.includes("\0"));if(a!==void 0)throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${a}`);if(!V(s))throw new TypeError(`Last argument must be an options object: ${s}`);return[i,o,s]};import{ChildProcess as jf}from"child_process";import{StringDecoder as Ef}from"string_decoder";var{toString:Za}=Object.prototype,ec=e=>Za.call(e)==="[object ArrayBuffer]",J=e=>Za.call(e)==="[object Uint8Array]",Be=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),Pf=new TextEncoder,tc=e=>Pf.encode(e),Tf=new TextDecoder,Vr=e=>Tf.decode(e),rc=(e,t)=>Of(e,t).join(""),Of=(e,t)=>{if(t==="utf8"&&e.every(s=>typeof s=="string"))return e;let r=new Ef(t),i=e.map(s=>typeof s=="string"?tc(s):s).map(s=>r.write(s)),n=r.end();return n===""?i:[...i,n]},Qt=e=>e.length===1&&J(e[0])?e[0]:os(If(e)),If=e=>e.map(t=>typeof t=="string"?tc(t):t),os=e=>{let t=new Uint8Array(Rf(e)),r=0;for(let i of e)t.set(i,r),r+=i.length;return t},Rf=e=>{let t=0;for(let r of e)t+=r.length;return t};var oc=e=>Array.isArray(e)&&Array.isArray(e.raw),ac=(e,t)=>{let r=[];for(let[s,o]of e.entries())r=Df({templates:e,expressions:t,tokens:r,index:s,template:o});if(r.length===0)throw new TypeError("Template script must not be empty");let[i,...n]=r;return[i,n,{}]},Df=({templates:e,expressions:t,tokens:r,index:i,template:n})=>{if(n===void 0)throw new TypeError(`Invalid backslash sequence: ${e.raw[i]}`);let{nextTokens:s,leadingWhitespaces:o,trailingWhitespaces:a}=Lf(n,e.raw[i]),c=nc(r,s,o);if(i===t.length)return c;let d=t[i],p=Array.isArray(d)?d.map(u=>sc(u)):[sc(d)];return nc(c,p,a)},Lf=(e,t)=>{if(t.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],i=0,n=ic.has(t[0]);for(let o=0,a=0;o<e.length;o+=1,a+=1){let c=t[a];if(ic.has(c))i!==o&&r.push(e.slice(i,o)),i=o+1;else if(c==="\\"){let d=t[a+1];d===`
101
+ `?(o-=1,a+=1):d==="u"&&t[a+2]==="{"?a=t.indexOf("}",a+3):a+=Mf[d]??1}}let s=i===e.length;return s||r.push(e.slice(i)),{nextTokens:r,leadingWhitespaces:n,trailingWhitespaces:s}},ic=new Set([" "," ","\r",`
102
+ `]),Mf={x:3,u:5},nc=(e,t,r)=>r||e.length===0||t.length===0?[...e,...t]:[...e.slice(0,-1),`${e.at(-1)}${t[0]}`,...t.slice(1)],sc=e=>{let t=typeof e;if(t==="string")return e;if(t==="number")return String(e);if(V(e)&&("stdout"in e||"isMaxBuffer"in e))return Ff(e);throw e instanceof jf||Object.prototype.toString.call(e)==="[object Promise]"?new TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):new TypeError(`Unexpected "${t}" in template expression`)},Ff=({stdout:e})=>{if(typeof e=="string")return e;if(J(e))return Vr(e);throw e===void 0?new TypeError(`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`):new TypeError(`Unexpected "${typeof e}" stdout in template expression`)};import{spawnSync as Gw}from"child_process";import{debuglog as Bf}from"util";import as from"process";var ge=e=>Wr.includes(e),Wr=[as.stdin,as.stdout,as.stderr],he=["stdin","stdout","stderr"],Hr=e=>he[e]??`stdio[${e}]`;var pc=e=>{let t={...e};for(let r of ds)t[r]=cs(e,r);return t},cs=(e,t)=>{let r=Array.from({length:Uf(e)+1}),i=Nf(e[t],r,t);return Hf(i,t)},Uf=({stdio:e})=>Array.isArray(e)?Math.max(e.length,he.length):he.length,Nf=(e,t,r)=>V(e)?Gf(e,t,r):t.fill(e),Gf=(e,t,r)=>{for(let i of Object.keys(e).sort(zf))for(let n of Vf(i,r,t))t[n]=e[i];return t},zf=(e,t)=>cc(e)<cc(t)?1:-1,cc=e=>e==="stdout"||e==="stderr"?0:e==="all"?2:1,Vf=(e,t,r)=>{if(e==="ipc")return[r.length-1];let i=ps(e);if(i===void 0||i===0)throw new TypeError(`"${t}.${e}" is invalid.
36
103
  It must be "${t}.stdout", "${t}.stderr", "${t}.all", "${t}.ipc", or "${t}.fd3", "${t}.fd4" (and so on).`);if(i>=r.length)throw new TypeError(`"${t}.${e}" is invalid: that file descriptor does not exist.
37
- Please set the "stdio" option to ensure that file descriptor exists.`);return i==="all"?[1,2]:[i]},Yn=e=>{if(e==="all")return e;if(le.includes(e))return le.indexOf(e);let t=nf.exec(e);if(t!==null)return Number(t[1])},nf=/^fd(\d+)$/,sf=(e,t)=>e.map(r=>r===void 0?af[t]:r),of=Xy("execa").enabled?"full":"none",af={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:of,stripFinalNewline:!0},Jn=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],Fe=(e,t)=>t==="ipc"?e.at(-1):e[t];var kt=({verbose:e},t)=>Xn(e,t)!=="none",vt=({verbose:e},t)=>!["none","short"].includes(Xn(e,t)),Ma=({verbose:e},t)=>{let r=Xn(e,t);return Ir(r)?r:void 0},Xn=(e,t)=>t===void 0?cf(e):Fe(e,t),cf=e=>e.find(t=>Ir(t))??Rr.findLast(t=>e.includes(t)),Ir=e=>typeof e=="function",Rr=["none","short","full"];import{inspect as Pf}from"util";import{platform as pf}from"process";import{stripVTControlCharacters as df}from"util";var Fa=(e,t)=>{let r=[e,...t],i=r.join(" "),n=r.map(s=>ff(Ba(s))).join(" ");return{command:i,escapedCommand:n}},Kt=e=>df(e).split(`
38
- `).map(t=>Ba(t)).join(`
39
- `),Ba=e=>e.replaceAll(mf,t=>uf(t)),uf=e=>{let t=hf[e];if(t!==void 0)return t;let r=e.codePointAt(0),i=r.toString(16);return r<=yf?`\\u${i.padStart(4,"0")}`:`\\U${i}`},lf=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},mf=lf(),hf={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},yf=65535,ff=e=>gf.test(e)?e:pf==="win32"?`"${e.replaceAll('"','""')}"`:`'${e.replaceAll("'","'\\''")}'`,gf=/^[\w./-]+$/;import Ua from"process";function Qn(){let{env:e}=Ua,{TERM:t,TERM_PROGRAM:r}=e;return Ua.platform!=="win32"?t!=="linux":!!e.WT_SESSION||!!e.TERMINUS_SUBLIME||e.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||t==="xterm-256color"||t==="alacritty"||t==="rxvt-unicode"||t==="rxvt-unicode-256color"||e.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var Na={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},Ga={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},_f={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},bf={...Na,...Ga},xf={...Na,..._f},wf=Qn(),kf=wf?bf:xf,jr=kf,Qq=Object.entries(Ga);import vf from"tty";var qf=vf?.WriteStream?.prototype?.hasColors?.()??!1,k=(e,t)=>{if(!qf)return n=>n;let r=`\x1B[${e}m`,i=`\x1B[${t}m`;return n=>{let s=n+"",o=s.indexOf(i);if(o===-1)return r+s+i;let a=r,c=0,p=(t===22?i:"")+r;for(;o!==-1;)a+=s.slice(c,o)+p,c=o+i.length,o=s.indexOf(i,c);return a+=s.slice(c)+i,a}},tS=k(0,0),za=k(1,22),rS=k(2,22),iS=k(3,23),nS=k(4,24),sS=k(53,55),oS=k(7,27),aS=k(8,28),cS=k(9,29),pS=k(30,39),dS=k(31,39),uS=k(32,39),lS=k(33,39),mS=k(34,39),hS=k(35,39),yS=k(36,39),fS=k(37,39),Dr=k(90,39),gS=k(40,49),_S=k(41,49),bS=k(42,49),xS=k(43,49),wS=k(44,49),kS=k(45,49),vS=k(46,49),qS=k(47,49),SS=k(100,49),Va=k(91,39),$S=k(92,39),Wa=k(93,39),AS=k(94,39),CS=k(95,39),ES=k(96,39),PS=k(97,39),TS=k(101,49),OS=k(102,49),IS=k(103,49),RS=k(104,49),jS=k(105,49),DS=k(106,49),LS=k(107,49);var Ya=({type:e,message:t,timestamp:r,piped:i,commandId:n,result:{failed:s=!1}={},options:{reject:o=!0}})=>{let a=Sf(r),c=$f[e]({failed:s,reject:o,piped:i}),d=Af[e]({reject:o});return`${Dr(`[${a}]`)} ${Dr(`[${n}]`)} ${d(c)} ${d(t)}`},Sf=e=>`${Lr(e.getHours(),2)}:${Lr(e.getMinutes(),2)}:${Lr(e.getSeconds(),2)}.${Lr(e.getMilliseconds(),3)}`,Lr=(e,t)=>String(e).padStart(t,"0"),Ha=({failed:e,reject:t})=>e?t?jr.cross:jr.warning:jr.tick,$f={command:({piped:e})=>e?"|":"$",output:()=>" ",ipc:()=>"*",error:Ha,duration:Ha},Ka=e=>e,Af={command:()=>za,output:()=>Ka,ipc:()=>Ka,error:({reject:e})=>e?Va:Wa,duration:()=>Dr};var Ja=(e,t,r)=>{let i=Ma(t,r);return e.map(({verboseLine:n,verboseObject:s})=>Cf(n,s,i)).filter(n=>n!==void 0).map(n=>Ef(n)).join("")},Cf=(e,t,r)=>{if(r===void 0)return e;let i=r(e,t);if(typeof i=="string")return i},Ef=e=>e.endsWith(`
104
+ Please set the "stdio" option to ensure that file descriptor exists.`);return i==="all"?[1,2]:[i]},ps=e=>{if(e==="all")return e;if(he.includes(e))return he.indexOf(e);let t=Wf.exec(e);if(t!==null)return Number(t[1])},Wf=/^fd(\d+)$/,Hf=(e,t)=>e.map(r=>r===void 0?Yf[t]:r),Kf=Bf("execa").enabled?"full":"none",Yf={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:Kf,stripFinalNewline:!0},ds=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],Ue=(e,t)=>t==="ipc"?e.at(-1):e[t];var St=({verbose:e},t)=>us(e,t)!=="none",qt=({verbose:e},t)=>!["none","short"].includes(us(e,t)),dc=({verbose:e},t)=>{let r=us(e,t);return Kr(r)?r:void 0},us=(e,t)=>t===void 0?Jf(e):Ue(e,t),Jf=e=>e.find(t=>Kr(t))??Yr.findLast(t=>e.includes(t)),Kr=e=>typeof e=="function",Yr=["none","short","full"];import{inspect as _g}from"util";import{platform as Xf}from"process";import{stripVTControlCharacters as Qf}from"util";var uc=(e,t)=>{let r=[e,...t],i=r.join(" "),n=r.map(s=>ng(lc(s))).join(" ");return{command:i,escapedCommand:n}},Zt=e=>Qf(e).split(`
105
+ `).map(t=>lc(t)).join(`
106
+ `),lc=e=>e.replaceAll(tg,t=>Zf(t)),Zf=e=>{let t=rg[e];if(t!==void 0)return t;let r=e.codePointAt(0),i=r.toString(16);return r<=ig?`\\u${i.padStart(4,"0")}`:`\\U${i}`},eg=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},tg=eg(),rg={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},ig=65535,ng=e=>sg.test(e)?e:Xf==="win32"?`"${e.replaceAll('"','""')}"`:`'${e.replaceAll("'","'\\''")}'`,sg=/^[\w./-]+$/;import mc from"process";function ls(){let{env:e}=mc,{TERM:t,TERM_PROGRAM:r}=e;return mc.platform!=="win32"?t!=="linux":!!e.WT_SESSION||!!e.TERMINUS_SUBLIME||e.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||t==="xterm-256color"||t==="alacritty"||t==="rxvt-unicode"||t==="rxvt-unicode-256color"||e.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var hc={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},yc={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},og={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},ag={...hc,...yc},cg={...hc,...og},pg=ls(),dg=pg?ag:cg,Jr=dg,Jq=Object.entries(yc);import ug from"tty";var lg=ug?.WriteStream?.prototype?.hasColors?.()??!1,k=(e,t)=>{if(!lg)return n=>n;let r=`\x1B[${e}m`,i=`\x1B[${t}m`;return n=>{let s=n+"",o=s.indexOf(i);if(o===-1)return r+s+i;let a=r,c=0,p=(t===22?i:"")+r;for(;o!==-1;)a+=s.slice(c,o)+p,c=o+i.length,o=s.indexOf(i,c);return a+=s.slice(c)+i,a}},Zq=k(0,0),fc=k(1,22),e$=k(2,22),t$=k(3,23),r$=k(4,24),i$=k(53,55),n$=k(7,27),s$=k(8,28),o$=k(9,29),a$=k(30,39),c$=k(31,39),p$=k(32,39),d$=k(33,39),u$=k(34,39),l$=k(35,39),m$=k(36,39),h$=k(37,39),Xr=k(90,39),y$=k(40,49),f$=k(41,49),g$=k(42,49),_$=k(43,49),b$=k(44,49),x$=k(45,49),w$=k(46,49),k$=k(47,49),v$=k(100,49),gc=k(91,39),S$=k(92,39),_c=k(93,39),q$=k(94,39),$$=k(95,39),A$=k(96,39),C$=k(97,39),E$=k(101,49),P$=k(102,49),T$=k(103,49),O$=k(104,49),I$=k(105,49),R$=k(106,49),j$=k(107,49);var wc=({type:e,message:t,timestamp:r,piped:i,commandId:n,result:{failed:s=!1}={},options:{reject:o=!0}})=>{let a=mg(r),c=hg[e]({failed:s,reject:o,piped:i}),d=yg[e]({reject:o});return`${Xr(`[${a}]`)} ${Xr(`[${n}]`)} ${d(c)} ${d(t)}`},mg=e=>`${Qr(e.getHours(),2)}:${Qr(e.getMinutes(),2)}:${Qr(e.getSeconds(),2)}.${Qr(e.getMilliseconds(),3)}`,Qr=(e,t)=>String(e).padStart(t,"0"),bc=({failed:e,reject:t})=>e?t?Jr.cross:Jr.warning:Jr.tick,hg={command:({piped:e})=>e?"|":"$",output:()=>" ",ipc:()=>"*",error:bc,duration:bc},xc=e=>e,yg={command:()=>fc,output:()=>xc,ipc:()=>xc,error:({reject:e})=>e?gc:_c,duration:()=>Xr};var kc=(e,t,r)=>{let i=dc(t,r);return e.map(({verboseLine:n,verboseObject:s})=>fg(n,s,i)).filter(n=>n!==void 0).map(n=>gg(n)).join("")},fg=(e,t,r)=>{if(r===void 0)return e;let i=r(e,t);if(typeof i=="string")return i},gg=e=>e.endsWith(`
40
107
  `)?e:`${e}
41
- `;var qe=({type:e,verboseMessage:t,fdNumber:r,verboseInfo:i,result:n})=>{let s=Tf({type:e,result:n,verboseInfo:i}),o=Of(t,s),a=Ja(o,i,r);a!==""&&console.warn(a.slice(0,-1))},Tf=({type:e,result:t,verboseInfo:{escapedCommand:r,commandId:i,rawOptions:{piped:n=!1,...s}}})=>({type:e,escapedCommand:r,commandId:`${i}`,timestamp:new Date,piped:n,result:t,options:s}),Of=(e,t)=>e.split(`
42
- `).map(r=>If({...t,message:r})),If=e=>({verboseLine:Ya(e),verboseObject:e}),Mr=e=>{let t=typeof e=="string"?e:Pf(e);return Kt(t).replaceAll(" "," ".repeat(Rf))},Rf=2;var Xa=(e,t)=>{kt(t)&&qe({type:"command",verboseMessage:e,verboseInfo:t})};var Qa=(e,t,r)=>{Lf(e);let i=jf(e);return{verbose:e,escapedCommand:t,commandId:i,rawOptions:r}},jf=e=>kt({verbose:e})?Df++:void 0,Df=0n,Lf=e=>{for(let t of e){if(t===!1)throw new TypeError(`The "verbose: false" option was renamed to "verbose: 'none'".`);if(t===!0)throw new TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!Rr.includes(t)&&!Ir(t)){let r=Rr.map(i=>`'${i}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${t}. Allowed values are: ${r} or a function.`)}}};import{hrtime as Za}from"process";var Fr=()=>Za.bigint(),Zn=e=>Number(Za.bigint()-e)/1e6;var Br=(e,t,r)=>{let i=Fr(),{command:n,escapedCommand:s}=Fa(e,t),o=Kn(r,"verbose"),a=Qa(o,s,{...r});return Xa(s,a),{command:n,escapedCommand:s,startTime:i,verboseInfo:a}};var Qp=U(Uc(),1);import x_ from"path";import Xp from"process";import zr from"process";import ot from"path";function Nr(e={}){let{env:t=process.env,platform:r=process.platform}=e;return r!=="win32"?"PATH":Object.keys(t).reverse().find(i=>i.toUpperCase()==="PATH")||"Path"}import{promisify as dg}from"util";import{execFile as ug,execFileSync as S$}from"child_process";import Nc from"path";import{fileURLToPath as lg}from"url";var C$=dg(ug);function Gr(e){return e instanceof URL?lg(e):e}function Gc(e){return{*[Symbol.iterator](){let t=Nc.resolve(Gr(e)),r;for(;r!==t;)yield t,r=t,t=Nc.resolve(t,"..")}}}var E$=10*1024*1024;var mg=({cwd:e=zr.cwd(),path:t=zr.env[Nr()],preferLocal:r=!0,execPath:i=zr.execPath,addExecPath:n=!0}={})=>{let s=ot.resolve(Gr(e)),o=[],a=t.split(ot.delimiter);return r&&hg(o,a,s),n&&yg(o,a,i,s),t===""||t===ot.delimiter?`${o.join(ot.delimiter)}${t}`:[...o,t].join(ot.delimiter)},hg=(e,t,r)=>{for(let i of Gc(r)){let n=ot.join(i,"node_modules/.bin");t.includes(n)||e.push(n)}},yg=(e,t,r,i)=>{let n=ot.resolve(i,Gr(r),"..");t.includes(n)||e.push(n)},zc=({env:e=zr.env,...t}={})=>{e={...e};let r=Nr({env:e});return t.path=e[r],e[r]=mg(t),e};import{setTimeout as Pg}from"timers/promises";var Vc=(e,t,r)=>{let i=r?Jt:Yt,n=e instanceof _e?{}:{cause:e};return new i(t,n)},_e=class extends Error{},Wc=(e,t)=>{Object.defineProperty(e.prototype,"name",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,Kc,{value:!0,writable:!1,enumerable:!1,configurable:!1})},Hc=e=>Vr(e)&&Kc in e,Kc=Symbol("isExecaError"),Vr=e=>Object.prototype.toString.call(e)==="[object Error]",Yt=class extends Error{};Wc(Yt,Yt.name);var Jt=class extends Error{};Wc(Jt,Jt.name);import{constants as Xt}from"os";import{constants as bg}from"os";var Yc=()=>{let e=Xc-Jc+1;return Array.from({length:e},fg)},fg=(e,t)=>({name:`SIGRT${t+1}`,number:Jc+t,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),Jc=34,Xc=64;import{constants as gg}from"os";var Qc=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}];var ps=()=>{let e=Yc();return[...Qc,...e].map(_g)},_g=({name:e,number:t,description:r,action:i,forced:n=!1,standard:s})=>{let{signals:{[e]:o}}=gg,a=o!==void 0;return{name:e,number:a?o:t,description:r,supported:a,action:i,forced:n,standard:s}};var xg=()=>{let e=ps();return Object.fromEntries(e.map(wg))},wg=({name:e,number:t,description:r,supported:i,action:n,forced:s,standard:o})=>[e,{name:e,number:t,description:r,supported:i,action:n,forced:s,standard:o}],Zc=xg(),kg=()=>{let e=ps(),t=65,r=Array.from({length:t},(i,n)=>vg(n,e));return Object.assign({},...r)},vg=(e,t)=>{let r=qg(e,t);if(r===void 0)return{};let{name:i,description:n,supported:s,action:o,forced:a,standard:c}=r;return{[e]:{name:i,number:e,description:n,supported:s,action:o,forced:a,standard:c}}},qg=(e,t)=>{let r=t.find(({name:i})=>bg.signals[i]===e);return r!==void 0?r:t.find(i=>i.number===e)},W$=kg();var tp=e=>{let t="option `killSignal`";if(e===0)throw new TypeError(`Invalid ${t}: 0 cannot be used.`);return ip(e,t)},rp=e=>e===0?e:ip(e,"`subprocess.kill()`'s argument"),ip=(e,t)=>{if(Number.isInteger(e))return Sg(e,t);if(typeof e=="string")return Ag(e,t);throw new TypeError(`Invalid ${t} ${String(e)}: it must be a string or an integer.
43
- ${ds()}`)},Sg=(e,t)=>{if(ep.has(e))return ep.get(e);throw new TypeError(`Invalid ${t} ${e}: this signal integer does not exist.
44
- ${ds()}`)},$g=()=>new Map(Object.entries(Xt.signals).reverse().map(([e,t])=>[t,e])),ep=$g(),Ag=(e,t)=>{if(e in Xt.signals)return e;throw e.toUpperCase()in Xt.signals?new TypeError(`Invalid ${t} '${e}': please rename it to '${e.toUpperCase()}'.`):new TypeError(`Invalid ${t} '${e}': this signal name does not exist.
45
- ${ds()}`)},ds=()=>`Available signal names: ${Cg()}.
46
- Available signal numbers: ${Eg()}.`,Cg=()=>Object.keys(Xt.signals).sort().map(e=>`'${e}'`).join(", "),Eg=()=>[...new Set(Object.values(Xt.signals).sort((e,t)=>e-t))].join(", "),Wr=e=>Zc[e].description;var np=e=>{if(e===!1)return e;if(e===!0)return Tg;if(!Number.isFinite(e)||e<0)throw new TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e},Tg=1e3*5,sp=({kill:e,options:{forceKillAfterDelay:t,killSignal:r},onInternalError:i,context:n,controller:s},o,a)=>{let{signal:c,error:d}=Og(o,a,r);Ig(d,i);let p=e(c);return Rg({kill:e,signal:c,forceKillAfterDelay:t,killSignal:r,killResult:p,context:n,controller:s}),p},Og=(e,t,r)=>{let[i=r,n]=Vr(e)?[void 0,e]:[e,t];if(typeof i!="string"&&!Number.isInteger(i))throw new TypeError(`The first argument must be an error instance or a signal name string/integer: ${String(i)}`);if(n!==void 0&&!Vr(n))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${n}`);return{signal:rp(i),error:n}},Ig=(e,t)=>{e!==void 0&&t.reject(e)},Rg=async({kill:e,signal:t,forceKillAfterDelay:r,killSignal:i,killResult:n,context:s,controller:o})=>{t===i&&n&&us({kill:e,forceKillAfterDelay:r,context:s,controllerSignal:o.signal})},us=async({kill:e,forceKillAfterDelay:t,context:r,controllerSignal:i})=>{if(t!==!1)try{await Pg(t,void 0,{signal:i}),e("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}};import{once as jg}from"events";var Hr=async(e,t)=>{e.aborted||await jg(e,"abort",{signal:t})};var op=({cancelSignal:e})=>{if(e!==void 0&&Object.prototype.toString.call(e)!=="[object AbortSignal]")throw new Error(`The \`cancelSignal\` option must be an AbortSignal: ${String(e)}`)},ap=({subprocess:e,cancelSignal:t,gracefulCancel:r,context:i,controller:n})=>t===void 0||r?[]:[Dg(e,t,i,n)],Dg=async(e,t,r,{signal:i})=>{throw await Hr(t,i),r.terminationReason??="cancel",e.kill(),t.reason};import{scheduler as i_}from"timers/promises";import{promisify as e_}from"util";var $t=({methodName:e,isSubprocess:t,ipc:r,isConnected:i})=>{Lg(e,t,r),ls(e,t,i)},Lg=(e,t,r)=>{if(!r)throw new Error(`${be(e,t)} can only be used if the \`ipc\` option is \`true\`.`)},ls=(e,t,r)=>{if(!r)throw new Error(`${be(e,t)} cannot be used: the ${He(t)} has already exited or disconnected.`)},cp=e=>{throw new Error(`${be("getOneMessage",e)} could not complete: the ${He(e)} exited or disconnected.`)},pp=e=>{throw new Error(`${be("sendMessage",e)} failed: the ${He(e)} is sending a message too, instead of listening to incoming messages.
108
+ `;var Ae=({type:e,verboseMessage:t,fdNumber:r,verboseInfo:i,result:n})=>{let s=bg({type:e,result:n,verboseInfo:i}),o=xg(t,s),a=kc(o,i,r);a!==""&&console.warn(a.slice(0,-1))},bg=({type:e,result:t,verboseInfo:{escapedCommand:r,commandId:i,rawOptions:{piped:n=!1,...s}}})=>({type:e,escapedCommand:r,commandId:`${i}`,timestamp:new Date,piped:n,result:t,options:s}),xg=(e,t)=>e.split(`
109
+ `).map(r=>wg({...t,message:r})),wg=e=>({verboseLine:wc(e),verboseObject:e}),Zr=e=>{let t=typeof e=="string"?e:_g(e);return Zt(t).replaceAll(" "," ".repeat(kg))},kg=2;var vc=(e,t)=>{St(t)&&Ae({type:"command",verboseMessage:e,verboseInfo:t})};var Sc=(e,t,r)=>{qg(e);let i=vg(e);return{verbose:e,escapedCommand:t,commandId:i,rawOptions:r}},vg=e=>St({verbose:e})?Sg++:void 0,Sg=0n,qg=e=>{for(let t of e){if(t===!1)throw new TypeError(`The "verbose: false" option was renamed to "verbose: 'none'".`);if(t===!0)throw new TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!Yr.includes(t)&&!Kr(t)){let r=Yr.map(i=>`'${i}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${t}. Allowed values are: ${r} or a function.`)}}};import{hrtime as qc}from"process";var ei=()=>qc.bigint(),ms=e=>Number(qc.bigint()-e)/1e6;var ti=(e,t,r)=>{let i=ei(),{command:n,escapedCommand:s}=uc(e,t),o=cs(r,"verbose"),a=Sc(o,s,{...r});return vc(s,a),{command:n,escapedCommand:s,startTime:i,verboseInfo:a}};var Sd=N(mp(),1);import cb from"path";import vd from"process";import si from"process";import pt from"path";function ii(e={}){let{env:t=process.env,platform:r=process.platform}=e;return r!=="win32"?"PATH":Object.keys(t).reverse().find(i=>i.toUpperCase()==="PATH")||"Path"}import{promisify as Qg}from"util";import{execFile as Zg,execFileSync as vA}from"child_process";import hp from"path";import{fileURLToPath as e_}from"url";var $A=Qg(Zg);function ni(e){return e instanceof URL?e_(e):e}function yp(e){return{*[Symbol.iterator](){let t=hp.resolve(ni(e)),r;for(;r!==t;)yield t,r=t,t=hp.resolve(t,"..")}}}var AA=10*1024*1024;var t_=({cwd:e=si.cwd(),path:t=si.env[ii()],preferLocal:r=!0,execPath:i=si.execPath,addExecPath:n=!0}={})=>{let s=pt.resolve(ni(e)),o=[],a=t.split(pt.delimiter);return r&&r_(o,a,s),n&&i_(o,a,i,s),t===""||t===pt.delimiter?`${o.join(pt.delimiter)}${t}`:[...o,t].join(pt.delimiter)},r_=(e,t,r)=>{for(let i of yp(r)){let n=pt.join(i,"node_modules/.bin");t.includes(n)||e.push(n)}},i_=(e,t,r,i)=>{let n=pt.resolve(i,ni(r),"..");t.includes(n)||e.push(n)},fp=({env:e=si.env,...t}={})=>{e={...e};let r=ii({env:e});return t.path=e[r],e[r]=t_(t),e};import{setTimeout as __}from"timers/promises";var gp=(e,t,r)=>{let i=r?tr:er,n=e instanceof _e?{}:{cause:e};return new i(t,n)},_e=class extends Error{},_p=(e,t)=>{Object.defineProperty(e.prototype,"name",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,xp,{value:!0,writable:!1,enumerable:!1,configurable:!1})},bp=e=>oi(e)&&xp in e,xp=Symbol("isExecaError"),oi=e=>Object.prototype.toString.call(e)==="[object Error]",er=class extends Error{};_p(er,er.name);var tr=class extends Error{};_p(tr,tr.name);import{constants as rr}from"os";import{constants as a_}from"os";var wp=()=>{let e=vp-kp+1;return Array.from({length:e},n_)},n_=(e,t)=>({name:`SIGRT${t+1}`,number:kp+t,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),kp=34,vp=64;import{constants as s_}from"os";var Sp=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}];var vs=()=>{let e=wp();return[...Sp,...e].map(o_)},o_=({name:e,number:t,description:r,action:i,forced:n=!1,standard:s})=>{let{signals:{[e]:o}}=s_,a=o!==void 0;return{name:e,number:a?o:t,description:r,supported:a,action:i,forced:n,standard:s}};var c_=()=>{let e=vs();return Object.fromEntries(e.map(p_))},p_=({name:e,number:t,description:r,supported:i,action:n,forced:s,standard:o})=>[e,{name:e,number:t,description:r,supported:i,action:n,forced:s,standard:o}],qp=c_(),d_=()=>{let e=vs(),t=65,r=Array.from({length:t},(i,n)=>u_(n,e));return Object.assign({},...r)},u_=(e,t)=>{let r=l_(e,t);if(r===void 0)return{};let{name:i,description:n,supported:s,action:o,forced:a,standard:c}=r;return{[e]:{name:i,number:e,description:n,supported:s,action:o,forced:a,standard:c}}},l_=(e,t)=>{let r=t.find(({name:i})=>a_.signals[i]===e);return r!==void 0?r:t.find(i=>i.number===e)},zA=d_();var Ap=e=>{let t="option `killSignal`";if(e===0)throw new TypeError(`Invalid ${t}: 0 cannot be used.`);return Ep(e,t)},Cp=e=>e===0?e:Ep(e,"`subprocess.kill()`'s argument"),Ep=(e,t)=>{if(Number.isInteger(e))return m_(e,t);if(typeof e=="string")return y_(e,t);throw new TypeError(`Invalid ${t} ${String(e)}: it must be a string or an integer.
110
+ ${Ss()}`)},m_=(e,t)=>{if($p.has(e))return $p.get(e);throw new TypeError(`Invalid ${t} ${e}: this signal integer does not exist.
111
+ ${Ss()}`)},h_=()=>new Map(Object.entries(rr.signals).reverse().map(([e,t])=>[t,e])),$p=h_(),y_=(e,t)=>{if(e in rr.signals)return e;throw e.toUpperCase()in rr.signals?new TypeError(`Invalid ${t} '${e}': please rename it to '${e.toUpperCase()}'.`):new TypeError(`Invalid ${t} '${e}': this signal name does not exist.
112
+ ${Ss()}`)},Ss=()=>`Available signal names: ${f_()}.
113
+ Available signal numbers: ${g_()}.`,f_=()=>Object.keys(rr.signals).sort().map(e=>`'${e}'`).join(", "),g_=()=>[...new Set(Object.values(rr.signals).sort((e,t)=>e-t))].join(", "),ai=e=>qp[e].description;var Pp=e=>{if(e===!1)return e;if(e===!0)return b_;if(!Number.isFinite(e)||e<0)throw new TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e},b_=1e3*5,Tp=({kill:e,options:{forceKillAfterDelay:t,killSignal:r},onInternalError:i,context:n,controller:s},o,a)=>{let{signal:c,error:d}=x_(o,a,r);w_(d,i);let p=e(c);return k_({kill:e,signal:c,forceKillAfterDelay:t,killSignal:r,killResult:p,context:n,controller:s}),p},x_=(e,t,r)=>{let[i=r,n]=oi(e)?[void 0,e]:[e,t];if(typeof i!="string"&&!Number.isInteger(i))throw new TypeError(`The first argument must be an error instance or a signal name string/integer: ${String(i)}`);if(n!==void 0&&!oi(n))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${n}`);return{signal:Cp(i),error:n}},w_=(e,t)=>{e!==void 0&&t.reject(e)},k_=async({kill:e,signal:t,forceKillAfterDelay:r,killSignal:i,killResult:n,context:s,controller:o})=>{t===i&&n&&qs({kill:e,forceKillAfterDelay:r,context:s,controllerSignal:o.signal})},qs=async({kill:e,forceKillAfterDelay:t,context:r,controllerSignal:i})=>{if(t!==!1)try{await __(t,void 0,{signal:i}),e("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}};import{once as v_}from"events";var ci=async(e,t)=>{e.aborted||await v_(e,"abort",{signal:t})};var Op=({cancelSignal:e})=>{if(e!==void 0&&Object.prototype.toString.call(e)!=="[object AbortSignal]")throw new Error(`The \`cancelSignal\` option must be an AbortSignal: ${String(e)}`)},Ip=({subprocess:e,cancelSignal:t,gracefulCancel:r,context:i,controller:n})=>t===void 0||r?[]:[S_(e,t,i,n)],S_=async(e,t,r,{signal:i})=>{throw await ci(t,i),r.terminationReason??="cancel",e.kill(),t.reason};import{scheduler as V_}from"timers/promises";import{promisify as N_}from"util";var Ct=({methodName:e,isSubprocess:t,ipc:r,isConnected:i})=>{q_(e,t,r),$s(e,t,i)},q_=(e,t,r)=>{if(!r)throw new Error(`${be(e,t)} can only be used if the \`ipc\` option is \`true\`.`)},$s=(e,t,r)=>{if(!r)throw new Error(`${be(e,t)} cannot be used: the ${Je(t)} has already exited or disconnected.`)},Rp=e=>{throw new Error(`${be("getOneMessage",e)} could not complete: the ${Je(e)} exited or disconnected.`)},jp=e=>{throw new Error(`${be("sendMessage",e)} failed: the ${Je(e)} is sending a message too, instead of listening to incoming messages.
47
114
  This can be fixed by both sending a message and listening to incoming messages at the same time:
48
115
 
49
116
  const [receivedMessage] = await Promise.all([
50
117
  ${be("getOneMessage",e)},
51
118
  ${be("sendMessage",e,"message, {strict: true}")},
52
- ]);`)},Kr=(e,t)=>new Error(`${be("sendMessage",t)} failed when sending an acknowledgment response to the ${He(t)}.`,{cause:e}),dp=e=>{throw new Error(`${be("sendMessage",e)} failed: the ${He(e)} is not listening to incoming messages.`)},up=e=>{throw new Error(`${be("sendMessage",e)} failed: the ${He(e)} exited without listening to incoming messages.`)},lp=()=>new Error(`\`cancelSignal\` aborted: the ${He(!0)} disconnected.`),mp=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},hp=({error:e,methodName:t,isSubprocess:r})=>{if(e.code==="EPIPE")throw new Error(`${be(t,r)} cannot be used: the ${He(r)} is disconnecting.`,{cause:e})},yp=({error:e,methodName:t,isSubprocess:r,message:i})=>{if(Mg(e))throw new Error(`${be(t,r)}'s argument type is invalid: the message cannot be serialized: ${String(i)}.`,{cause:e})},Mg=({code:e,message:t})=>Fg.has(e)||Bg.some(r=>t.includes(r)),Fg=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),Bg=["could not be cloned","circular structure","call stack size exceeded"],be=(e,t,r="")=>e==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${Ug(t)}${e}(${r})`,Ug=e=>e?"":"subprocess.",He=e=>e?"parent process":"subprocess",At=e=>{e.connected&&e.disconnect()};var Se=()=>{let e={},t=new Promise((r,i)=>{Object.assign(e,{resolve:r,reject:i})});return Object.assign(t,e)};var Jr=(e,t="stdin")=>{let{options:i,fileDescriptors:n}=$e.get(e),s=fp(n,t,!0),o=e.stdio[s];if(o===null)throw new TypeError(gp(s,t,i,!0));return o},Ct=(e,t="stdout")=>{let{options:i,fileDescriptors:n}=$e.get(e),s=fp(n,t,!1),o=s==="all"?e.all:e.stdio[s];if(o==null)throw new TypeError(gp(s,t,i,!1));return o},$e=new WeakMap,fp=(e,t,r)=>{let i=Ng(t,r);return Gg(i,t,r,e),i},Ng=(e,t)=>{let r=Yn(e);if(r!==void 0)return r;let{validOptions:i,defaultValue:n}=t?{validOptions:'"stdin"',defaultValue:"stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw new TypeError(`"${Qt(t)}" must not be "${e}".
119
+ ]);`)},pi=(e,t)=>new Error(`${be("sendMessage",t)} failed when sending an acknowledgment response to the ${Je(t)}.`,{cause:e}),Dp=e=>{throw new Error(`${be("sendMessage",e)} failed: the ${Je(e)} is not listening to incoming messages.`)},Lp=e=>{throw new Error(`${be("sendMessage",e)} failed: the ${Je(e)} exited without listening to incoming messages.`)},Mp=()=>new Error(`\`cancelSignal\` aborted: the ${Je(!0)} disconnected.`),Fp=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},Bp=({error:e,methodName:t,isSubprocess:r})=>{if(e.code==="EPIPE")throw new Error(`${be(t,r)} cannot be used: the ${Je(r)} is disconnecting.`,{cause:e})},Up=({error:e,methodName:t,isSubprocess:r,message:i})=>{if($_(e))throw new Error(`${be(t,r)}'s argument type is invalid: the message cannot be serialized: ${String(i)}.`,{cause:e})},$_=({code:e,message:t})=>A_.has(e)||C_.some(r=>t.includes(r)),A_=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),C_=["could not be cloned","circular structure","call stack size exceeded"],be=(e,t,r="")=>e==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${E_(t)}${e}(${r})`,E_=e=>e?"":"subprocess.",Je=e=>e?"parent process":"subprocess",Et=e=>{e.connected&&e.disconnect()};var Ce=()=>{let e={},t=new Promise((r,i)=>{Object.assign(e,{resolve:r,reject:i})});return Object.assign(t,e)};var ui=(e,t="stdin")=>{let{options:i,fileDescriptors:n}=Ee.get(e),s=Np(n,t,!0),o=e.stdio[s];if(o===null)throw new TypeError(Gp(s,t,i,!0));return o},Pt=(e,t="stdout")=>{let{options:i,fileDescriptors:n}=Ee.get(e),s=Np(n,t,!1),o=s==="all"?e.all:e.stdio[s];if(o==null)throw new TypeError(Gp(s,t,i,!1));return o},Ee=new WeakMap,Np=(e,t,r)=>{let i=P_(t,r);return T_(i,t,r,e),i},P_=(e,t)=>{let r=ps(e);if(r!==void 0)return r;let{validOptions:i,defaultValue:n}=t?{validOptions:'"stdin"',defaultValue:"stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw new TypeError(`"${ir(t)}" must not be "${e}".
53
120
  It must be ${i} or "fd3", "fd4" (and so on).
54
- It is optional and defaults to "${n}".`)},Gg=(e,t,r,i)=>{let n=i[_p(e)];if(n===void 0)throw new TypeError(`"${Qt(r)}" must not be ${t}. That file descriptor does not exist.
55
- Please set the "stdio" option to ensure that file descriptor exists.`);if(n.direction==="input"&&!r)throw new TypeError(`"${Qt(r)}" must not be ${t}. It must be a readable stream, not writable.`);if(n.direction!=="input"&&r)throw new TypeError(`"${Qt(r)}" must not be ${t}. It must be a writable stream, not readable.`)},gp=(e,t,r,i)=>{if(e==="all"&&!r.all)return`The "all" option must be true to use "from: 'all'".`;let{optionName:n,optionValue:s}=zg(e,r);return`The "${n}: ${Yr(s)}" option is incompatible with using "${Qt(i)}: ${Yr(t)}".
56
- Please set this option with "pipe" instead.`},zg=(e,{stdin:t,stdout:r,stderr:i,stdio:n})=>{let s=_p(e);return s===0&&t!==void 0?{optionName:"stdin",optionValue:t}:s===1&&r!==void 0?{optionName:"stdout",optionValue:r}:s===2&&i!==void 0?{optionName:"stderr",optionValue:i}:{optionName:`stdio[${s}]`,optionValue:n[s]}},_p=e=>e==="all"?1:e,Qt=e=>e?"to":"from",Yr=e=>typeof e=="string"?`'${e}'`:typeof e=="number"?`${e}`:"Stream";import{once as Jg}from"events";import{addAbortListener as Vg}from"events";var at=(e,t,r)=>{let i=e.getMaxListeners();i===0||i===Number.POSITIVE_INFINITY||(e.setMaxListeners(i+t),Vg(r,()=>{e.setMaxListeners(e.getMaxListeners()-t)}))};import{EventEmitter as Kg}from"events";import{once as Wg}from"events";import{scheduler as Hg}from"timers/promises";var Xr=(e,t)=>{t&&ms(e)},ms=e=>{e.refCounted()},Qr=(e,t)=>{t&&hs(e)},hs=e=>{e.unrefCounted()},bp=(e,t)=>{t&&(hs(e),hs(e))},xp=(e,t)=>{t&&(ms(e),ms(e))};var wp=async({anyProcess:e,channel:t,isSubprocess:r,ipcEmitter:i},n)=>{if(qp(n)||$p(n))return;Zr.has(e)||Zr.set(e,[]);let s=Zr.get(e);if(s.push(n),!(s.length>1))for(;s.length>0;){await Sp(e,i,n),await Hg.yield();let o=await vp({wrappedMessage:s[0],anyProcess:e,channel:t,isSubprocess:r,ipcEmitter:i});s.shift(),i.emit("message",o),i.emit("message:done")}},kp=async({anyProcess:e,channel:t,isSubprocess:r,ipcEmitter:i,boundOnMessage:n})=>{ys();let s=Zr.get(e);for(;s?.length>0;)await Wg(i,"message:done");e.removeListener("message",n),xp(t,r),i.connected=!1,i.emit("disconnect")},Zr=new WeakMap;var Ke=(e,t,r)=>{if(ei.has(e))return ei.get(e);let i=new Kg;return i.connected=!0,ei.set(e,i),Yg({ipcEmitter:i,anyProcess:e,channel:t,isSubprocess:r}),i},ei=new WeakMap,Yg=({ipcEmitter:e,anyProcess:t,channel:r,isSubprocess:i})=>{let n=wp.bind(void 0,{anyProcess:t,channel:r,isSubprocess:i,ipcEmitter:e});t.on("message",n),t.once("disconnect",kp.bind(void 0,{anyProcess:t,channel:r,isSubprocess:i,ipcEmitter:e,boundOnMessage:n})),bp(r,i)},ti=e=>{let t=ei.get(e);return t===void 0?e.channel!==null:t.connected};var Ap=({anyProcess:e,channel:t,isSubprocess:r,message:i,strict:n})=>{if(!n)return i;let s=Ke(e,t,r),o=ni(e,s);return{id:Xg++,type:ii,message:i,hasListeners:o}},Xg=0n,Cp=(e,t)=>{if(!(t?.type!==ii||t.hasListeners))for(let{id:r}of e)r!==void 0&&ri[r].resolve({isDeadlock:!0,hasListeners:!1})},vp=async({wrappedMessage:e,anyProcess:t,channel:r,isSubprocess:i,ipcEmitter:n})=>{if(e?.type!==ii||!t.connected)return e;let{id:s,message:o}=e,a={id:s,type:Pp,message:ni(t,n)};try{await si({anyProcess:t,channel:r,isSubprocess:i,ipc:!0},a)}catch(c){n.emit("strict:error",c)}return o},qp=e=>{if(e?.type!==Pp)return!1;let{id:t,message:r}=e;return ri[t]?.resolve({isDeadlock:!1,hasListeners:r}),!0},Ep=async(e,t,r)=>{if(e?.type!==ii)return;let i=Se();ri[e.id]=i;let n=new AbortController;try{let{isDeadlock:s,hasListeners:o}=await Promise.race([i,Qg(t,r,n)]);s&&pp(r),o||dp(r)}finally{n.abort(),delete ri[e.id]}},ri={},Qg=async(e,t,{signal:r})=>{at(e,1,r),await Jg(e,"disconnect",{signal:r}),up(t)},ii="execa:ipc:request",Pp="execa:ipc:response";var Tp=(e,t,r)=>{Zt.has(e)||Zt.set(e,new Set);let i=Zt.get(e),n=Se(),s=r?t.id:void 0,o={onMessageSent:n,id:s};return i.add(o),{outgoingMessages:i,outgoingMessage:o}},Op=({outgoingMessages:e,outgoingMessage:t})=>{e.delete(t),t.onMessageSent.resolve()},Sp=async(e,t,r)=>{for(;!ni(e,t)&&Zt.get(e)?.size>0;){let i=[...Zt.get(e)];Cp(i,r),await Promise.all(i.map(({onMessageSent:n})=>n))}},Zt=new WeakMap,ni=(e,t)=>t.listenerCount("message")>Zg(e),Zg=e=>$e.has(e)&&!Fe($e.get(e).options.buffer,"ipc")?1:0;var si=({anyProcess:e,channel:t,isSubprocess:r,ipc:i},n,{strict:s=!1}={})=>{let o="sendMessage";return $t({methodName:o,isSubprocess:r,ipc:i,isConnected:e.connected}),t_({anyProcess:e,channel:t,methodName:o,isSubprocess:r,message:n,strict:s})},t_=async({anyProcess:e,channel:t,methodName:r,isSubprocess:i,message:n,strict:s})=>{let o=Ap({anyProcess:e,channel:t,isSubprocess:i,message:n,strict:s}),a=Tp(e,o,s);try{await gs({anyProcess:e,methodName:r,isSubprocess:i,wrappedMessage:o,message:n})}catch(c){throw At(e),c}finally{Op(a)}},gs=async({anyProcess:e,methodName:t,isSubprocess:r,wrappedMessage:i,message:n})=>{let s=r_(e);try{await Promise.all([Ep(i,e,r),s(i)])}catch(o){throw hp({error:o,methodName:t,isSubprocess:r}),yp({error:o,methodName:t,isSubprocess:r,message:n}),o}},r_=e=>{if(fs.has(e))return fs.get(e);let t=e_(e.send.bind(e));return fs.set(e,t),t},fs=new WeakMap;var Rp=(e,t)=>{let r="cancelSignal";return ls(r,!1,e.connected),gs({anyProcess:e,methodName:r,isSubprocess:!1,wrappedMessage:{type:Dp,message:t},message:t})},jp=async({anyProcess:e,channel:t,isSubprocess:r,ipc:i})=>(await n_({anyProcess:e,channel:t,isSubprocess:r,ipc:i}),_s.signal),n_=async({anyProcess:e,channel:t,isSubprocess:r,ipc:i})=>{if(!Ip){if(Ip=!0,!i){mp();return}if(t===null){ys();return}Ke(e,t,r),await i_.yield()}},Ip=!1,$p=e=>e?.type!==Dp?!1:(_s.abort(e.message),!0),Dp="execa:ipc:cancel",ys=()=>{_s.abort(lp())},_s=new AbortController;var Lp=({gracefulCancel:e,cancelSignal:t,ipc:r,serialization:i})=>{if(e){if(t===void 0)throw new Error("The `cancelSignal` option must be defined when setting the `gracefulCancel` option.");if(!r)throw new Error("The `ipc` option cannot be false when setting the `gracefulCancel` option.");if(i==="json")throw new Error("The `serialization` option cannot be 'json' when setting the `gracefulCancel` option.")}},Mp=({subprocess:e,cancelSignal:t,gracefulCancel:r,forceKillAfterDelay:i,context:n,controller:s})=>r?[s_({subprocess:e,cancelSignal:t,forceKillAfterDelay:i,context:n,controller:s})]:[],s_=async({subprocess:e,cancelSignal:t,forceKillAfterDelay:r,context:i,controller:{signal:n}})=>{await Hr(t,n);let s=o_(t);throw await Rp(e,s),us({kill:e.kill,forceKillAfterDelay:r,context:i,controllerSignal:n}),i.terminationReason??="gracefulCancel",t.reason},o_=({reason:e})=>{if(!(e instanceof DOMException))return e;let t=new Error(e.message);return Object.defineProperty(t,"stack",{value:e.stack,enumerable:!1,configurable:!0,writable:!0}),t};import{setTimeout as a_}from"timers/promises";var Fp=({timeout:e})=>{if(e!==void 0&&(!Number.isFinite(e)||e<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`)},Bp=(e,t,r,i)=>t===0||t===void 0?[]:[c_(e,t,r,i)],c_=async(e,t,r,{signal:i})=>{throw await a_(t,void 0,{signal:i}),r.terminationReason??="timeout",e.kill(),new _e};import{execPath as p_,execArgv as d_}from"process";import Up from"path";var Np=({options:e})=>{if(e.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...e,node:!0}}},Gp=(e,t,{node:r=!1,nodePath:i=p_,nodeOptions:n=d_.filter(c=>!c.startsWith("--inspect")),cwd:s,execPath:o,...a})=>{if(o!==void 0)throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');let c=wt(i,'The "nodePath" option'),d=Up.resolve(s,c),p={...a,nodePath:d,node:r,cwd:s};if(!r)return[e,t,p];if(Up.basename(e,".exe")==="node")throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');return[d,[...n,e,...t],{ipc:!0,...p,shell:!1}]};import{serialize as u_}from"v8";var zp=({ipcInput:e,ipc:t,serialization:r})=>{if(e!==void 0){if(!t)throw new Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");h_[r](e)}},l_=e=>{try{u_(e)}catch(t){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:t})}},m_=e=>{try{JSON.stringify(e)}catch(t){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:t})}},h_={advanced:l_,json:m_},Vp=async(e,t)=>{t!==void 0&&await e.sendMessage(t)};var Hp=({encoding:e})=>{if(bs.has(e))return;let t=f_(e);if(t!==void 0)throw new TypeError(`Invalid option \`encoding: ${oi(e)}\`.
57
- Please rename it to ${oi(t)}.`);let r=[...bs].map(i=>oi(i)).join(", ");throw new TypeError(`Invalid option \`encoding: ${oi(e)}\`.
58
- Please rename it to one of: ${r}.`)},y_=new Set(["utf8","utf16le"]),ae=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),bs=new Set([...y_,...ae]),f_=e=>{if(e===null)return"buffer";if(typeof e!="string")return;let t=e.toLowerCase();if(t in Wp)return Wp[t];if(bs.has(t))return t},Wp={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},oi=e=>typeof e=="string"?`"${e}"`:String(e);import{statSync as g_}from"fs";import __ from"path";import b_ from"process";var Kp=(e=Yp())=>{let t=wt(e,'The "cwd" option');return __.resolve(t)},Yp=()=>{try{return b_.cwd()}catch(e){throw e.message=`The current directory does not exist.
59
- ${e.message}`,e}},Jp=(e,t)=>{if(t===Yp())return e;let r;try{r=g_(t)}catch(i){return`The "cwd" option is invalid: ${t}.
121
+ It is optional and defaults to "${n}".`)},T_=(e,t,r,i)=>{let n=i[zp(e)];if(n===void 0)throw new TypeError(`"${ir(r)}" must not be ${t}. That file descriptor does not exist.
122
+ Please set the "stdio" option to ensure that file descriptor exists.`);if(n.direction==="input"&&!r)throw new TypeError(`"${ir(r)}" must not be ${t}. It must be a readable stream, not writable.`);if(n.direction!=="input"&&r)throw new TypeError(`"${ir(r)}" must not be ${t}. It must be a writable stream, not readable.`)},Gp=(e,t,r,i)=>{if(e==="all"&&!r.all)return`The "all" option must be true to use "from: 'all'".`;let{optionName:n,optionValue:s}=O_(e,r);return`The "${n}: ${di(s)}" option is incompatible with using "${ir(i)}: ${di(t)}".
123
+ Please set this option with "pipe" instead.`},O_=(e,{stdin:t,stdout:r,stderr:i,stdio:n})=>{let s=zp(e);return s===0&&t!==void 0?{optionName:"stdin",optionValue:t}:s===1&&r!==void 0?{optionName:"stdout",optionValue:r}:s===2&&i!==void 0?{optionName:"stderr",optionValue:i}:{optionName:`stdio[${s}]`,optionValue:n[s]}},zp=e=>e==="all"?1:e,ir=e=>e?"to":"from",di=e=>typeof e=="string"?`'${e}'`:typeof e=="number"?`${e}`:"Stream";import{once as M_}from"events";import{addAbortListener as I_}from"events";var dt=(e,t,r)=>{let i=e.getMaxListeners();i===0||i===Number.POSITIVE_INFINITY||(e.setMaxListeners(i+t),I_(r,()=>{e.setMaxListeners(e.getMaxListeners()-t)}))};import{EventEmitter as D_}from"events";import{once as R_}from"events";import{scheduler as j_}from"timers/promises";var li=(e,t)=>{t&&As(e)},As=e=>{e.refCounted()},mi=(e,t)=>{t&&Cs(e)},Cs=e=>{e.unrefCounted()},Vp=(e,t)=>{t&&(Cs(e),Cs(e))},Wp=(e,t)=>{t&&(As(e),As(e))};var Hp=async({anyProcess:e,channel:t,isSubprocess:r,ipcEmitter:i},n)=>{if(Jp(n)||Qp(n))return;hi.has(e)||hi.set(e,[]);let s=hi.get(e);if(s.push(n),!(s.length>1))for(;s.length>0;){await Xp(e,i,n),await j_.yield();let o=await Yp({wrappedMessage:s[0],anyProcess:e,channel:t,isSubprocess:r,ipcEmitter:i});s.shift(),i.emit("message",o),i.emit("message:done")}},Kp=async({anyProcess:e,channel:t,isSubprocess:r,ipcEmitter:i,boundOnMessage:n})=>{Es();let s=hi.get(e);for(;s?.length>0;)await R_(i,"message:done");e.removeListener("message",n),Wp(t,r),i.connected=!1,i.emit("disconnect")},hi=new WeakMap;var Xe=(e,t,r)=>{if(yi.has(e))return yi.get(e);let i=new D_;return i.connected=!0,yi.set(e,i),L_({ipcEmitter:i,anyProcess:e,channel:t,isSubprocess:r}),i},yi=new WeakMap,L_=({ipcEmitter:e,anyProcess:t,channel:r,isSubprocess:i})=>{let n=Hp.bind(void 0,{anyProcess:t,channel:r,isSubprocess:i,ipcEmitter:e});t.on("message",n),t.once("disconnect",Kp.bind(void 0,{anyProcess:t,channel:r,isSubprocess:i,ipcEmitter:e,boundOnMessage:n})),Vp(r,i)},fi=e=>{let t=yi.get(e);return t===void 0?e.channel!==null:t.connected};var Zp=({anyProcess:e,channel:t,isSubprocess:r,message:i,strict:n})=>{if(!n)return i;let s=Xe(e,t,r),o=bi(e,s);return{id:F_++,type:_i,message:i,hasListeners:o}},F_=0n,ed=(e,t)=>{if(!(t?.type!==_i||t.hasListeners))for(let{id:r}of e)r!==void 0&&gi[r].resolve({isDeadlock:!0,hasListeners:!1})},Yp=async({wrappedMessage:e,anyProcess:t,channel:r,isSubprocess:i,ipcEmitter:n})=>{if(e?.type!==_i||!t.connected)return e;let{id:s,message:o}=e,a={id:s,type:rd,message:bi(t,n)};try{await xi({anyProcess:t,channel:r,isSubprocess:i,ipc:!0},a)}catch(c){n.emit("strict:error",c)}return o},Jp=e=>{if(e?.type!==rd)return!1;let{id:t,message:r}=e;return gi[t]?.resolve({isDeadlock:!1,hasListeners:r}),!0},td=async(e,t,r)=>{if(e?.type!==_i)return;let i=Ce();gi[e.id]=i;let n=new AbortController;try{let{isDeadlock:s,hasListeners:o}=await Promise.race([i,B_(t,r,n)]);s&&jp(r),o||Dp(r)}finally{n.abort(),delete gi[e.id]}},gi={},B_=async(e,t,{signal:r})=>{dt(e,1,r),await M_(e,"disconnect",{signal:r}),Lp(t)},_i="execa:ipc:request",rd="execa:ipc:response";var id=(e,t,r)=>{nr.has(e)||nr.set(e,new Set);let i=nr.get(e),n=Ce(),s=r?t.id:void 0,o={onMessageSent:n,id:s};return i.add(o),{outgoingMessages:i,outgoingMessage:o}},nd=({outgoingMessages:e,outgoingMessage:t})=>{e.delete(t),t.onMessageSent.resolve()},Xp=async(e,t,r)=>{for(;!bi(e,t)&&nr.get(e)?.size>0;){let i=[...nr.get(e)];ed(i,r),await Promise.all(i.map(({onMessageSent:n})=>n))}},nr=new WeakMap,bi=(e,t)=>t.listenerCount("message")>U_(e),U_=e=>Ee.has(e)&&!Ue(Ee.get(e).options.buffer,"ipc")?1:0;var xi=({anyProcess:e,channel:t,isSubprocess:r,ipc:i},n,{strict:s=!1}={})=>{let o="sendMessage";return Ct({methodName:o,isSubprocess:r,ipc:i,isConnected:e.connected}),G_({anyProcess:e,channel:t,methodName:o,isSubprocess:r,message:n,strict:s})},G_=async({anyProcess:e,channel:t,methodName:r,isSubprocess:i,message:n,strict:s})=>{let o=Zp({anyProcess:e,channel:t,isSubprocess:i,message:n,strict:s}),a=id(e,o,s);try{await Ts({anyProcess:e,methodName:r,isSubprocess:i,wrappedMessage:o,message:n})}catch(c){throw Et(e),c}finally{nd(a)}},Ts=async({anyProcess:e,methodName:t,isSubprocess:r,wrappedMessage:i,message:n})=>{let s=z_(e);try{await Promise.all([td(i,e,r),s(i)])}catch(o){throw Bp({error:o,methodName:t,isSubprocess:r}),Up({error:o,methodName:t,isSubprocess:r,message:n}),o}},z_=e=>{if(Ps.has(e))return Ps.get(e);let t=N_(e.send.bind(e));return Ps.set(e,t),t},Ps=new WeakMap;var od=(e,t)=>{let r="cancelSignal";return $s(r,!1,e.connected),Ts({anyProcess:e,methodName:r,isSubprocess:!1,wrappedMessage:{type:cd,message:t},message:t})},ad=async({anyProcess:e,channel:t,isSubprocess:r,ipc:i})=>(await W_({anyProcess:e,channel:t,isSubprocess:r,ipc:i}),Os.signal),W_=async({anyProcess:e,channel:t,isSubprocess:r,ipc:i})=>{if(!sd){if(sd=!0,!i){Fp();return}if(t===null){Es();return}Xe(e,t,r),await V_.yield()}},sd=!1,Qp=e=>e?.type!==cd?!1:(Os.abort(e.message),!0),cd="execa:ipc:cancel",Es=()=>{Os.abort(Mp())},Os=new AbortController;var pd=({gracefulCancel:e,cancelSignal:t,ipc:r,serialization:i})=>{if(e){if(t===void 0)throw new Error("The `cancelSignal` option must be defined when setting the `gracefulCancel` option.");if(!r)throw new Error("The `ipc` option cannot be false when setting the `gracefulCancel` option.");if(i==="json")throw new Error("The `serialization` option cannot be 'json' when setting the `gracefulCancel` option.")}},dd=({subprocess:e,cancelSignal:t,gracefulCancel:r,forceKillAfterDelay:i,context:n,controller:s})=>r?[H_({subprocess:e,cancelSignal:t,forceKillAfterDelay:i,context:n,controller:s})]:[],H_=async({subprocess:e,cancelSignal:t,forceKillAfterDelay:r,context:i,controller:{signal:n}})=>{await ci(t,n);let s=K_(t);throw await od(e,s),qs({kill:e.kill,forceKillAfterDelay:r,context:i,controllerSignal:n}),i.terminationReason??="gracefulCancel",t.reason},K_=({reason:e})=>{if(!(e instanceof DOMException))return e;let t=new Error(e.message);return Object.defineProperty(t,"stack",{value:e.stack,enumerable:!1,configurable:!0,writable:!0}),t};import{setTimeout as Y_}from"timers/promises";var ud=({timeout:e})=>{if(e!==void 0&&(!Number.isFinite(e)||e<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`)},ld=(e,t,r,i)=>t===0||t===void 0?[]:[J_(e,t,r,i)],J_=async(e,t,r,{signal:i})=>{throw await Y_(t,void 0,{signal:i}),r.terminationReason??="timeout",e.kill(),new _e};import{execPath as X_,execArgv as Q_}from"process";import md from"path";var hd=({options:e})=>{if(e.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...e,node:!0}}},yd=(e,t,{node:r=!1,nodePath:i=X_,nodeOptions:n=Q_.filter(c=>!c.startsWith("--inspect")),cwd:s,execPath:o,...a})=>{if(o!==void 0)throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');let c=vt(i,'The "nodePath" option'),d=md.resolve(s,c),p={...a,nodePath:d,node:r,cwd:s};if(!r)return[e,t,p];if(md.basename(e,".exe")==="node")throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');return[d,[...n,e,...t],{ipc:!0,...p,shell:!1}]};import{serialize as Z_}from"v8";var fd=({ipcInput:e,ipc:t,serialization:r})=>{if(e!==void 0){if(!t)throw new Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");rb[r](e)}},eb=e=>{try{Z_(e)}catch(t){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:t})}},tb=e=>{try{JSON.stringify(e)}catch(t){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:t})}},rb={advanced:eb,json:tb},gd=async(e,t)=>{t!==void 0&&await e.sendMessage(t)};var bd=({encoding:e})=>{if(Is.has(e))return;let t=nb(e);if(t!==void 0)throw new TypeError(`Invalid option \`encoding: ${wi(e)}\`.
124
+ Please rename it to ${wi(t)}.`);let r=[...Is].map(i=>wi(i)).join(", ");throw new TypeError(`Invalid option \`encoding: ${wi(e)}\`.
125
+ Please rename it to one of: ${r}.`)},ib=new Set(["utf8","utf16le"]),ae=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),Is=new Set([...ib,...ae]),nb=e=>{if(e===null)return"buffer";if(typeof e!="string")return;let t=e.toLowerCase();if(t in _d)return _d[t];if(Is.has(t))return t},_d={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},wi=e=>typeof e=="string"?`"${e}"`:String(e);import{statSync as sb}from"fs";import ob from"path";import ab from"process";var xd=(e=wd())=>{let t=vt(e,'The "cwd" option');return ob.resolve(t)},wd=()=>{try{return ab.cwd()}catch(e){throw e.message=`The current directory does not exist.
126
+ ${e.message}`,e}},kd=(e,t)=>{if(t===wd())return e;let r;try{r=sb(t)}catch(i){return`The "cwd" option is invalid: ${t}.
60
127
  ${i.message}
61
128
  ${e}`}return r.isDirectory()?e:`The "cwd" option is not a directory: ${t}.
62
- ${e}`};var ai=(e,t,r)=>{r.cwd=Kp(r.cwd);let[i,n,s]=Gp(e,t,r),{command:o,args:a,options:c}=Qp.default._parse(i,n,s),d=La(c),p=w_(d);return Fp(p),Hp(p),zp(p),op(p),Lp(p),p.shell=Vn(p.shell),p.env=k_(p),p.killSignal=tp(p.killSignal),p.forceKillAfterDelay=np(p.forceKillAfterDelay),p.lines=p.lines.map((u,l)=>u&&!ae.has(p.encoding)&&p.buffer[l]),Xp.platform==="win32"&&x_.basename(o,".exe")==="cmd"&&a.unshift("/q"),{file:o,commandArguments:a,options:p}},w_=({extendEnv:e=!0,preferLocal:t=!1,cwd:r,localDir:i=r,encoding:n="utf8",reject:s=!0,cleanup:o=!0,all:a=!1,windowsHide:c=!0,killSignal:d="SIGTERM",forceKillAfterDelay:p=!0,gracefulCancel:u=!1,ipcInput:l,ipc:m=l!==void 0||u,serialization:h="advanced",...f})=>({...f,extendEnv:e,preferLocal:t,cwd:r,localDirectory:i,encoding:n,reject:s,cleanup:o,all:a,windowsHide:c,killSignal:d,forceKillAfterDelay:p,gracefulCancel:u,ipcInput:l,ipc:m,serialization:h}),k_=({env:e,extendEnv:t,preferLocal:r,node:i,localDirectory:n,nodePath:s})=>{let o=t?{...Xp.env,...e}:e;return r||i?zc({env:o,cwd:n,execPath:s,preferLocal:r,addExecPath:i}):o};var ci=(e,t,r)=>r.shell&&t.length>0?[[e,...t].join(" "),[],r]:[e,t,r];import{inspect as rb}from"util";function Et(e){if(typeof e=="string")return v_(e);if(!(ArrayBuffer.isView(e)&&e.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return q_(e)}var v_=e=>e.at(-1)===Zp?e.slice(0,e.at(-2)===ed?-2:-1):e,q_=e=>e.at(-1)===S_?e.subarray(0,e.at(-2)===$_?-2:-1):e,Zp=`
63
- `,S_=Zp.codePointAt(0),ed="\r",$_=ed.codePointAt(0);import{on as Q_}from"events";import{finished as Z_}from"stream/promises";function xe(e,{checkOpen:t=!0}={}){return e!==null&&typeof e=="object"&&(e.writable||e.readable||!t||e.writable===void 0&&e.readable===void 0)&&typeof e.pipe=="function"}function xs(e,{checkOpen:t=!0}={}){return xe(e,{checkOpen:t})&&(e.writable||!t)&&typeof e.write=="function"&&typeof e.end=="function"&&typeof e.writable=="boolean"&&typeof e.writableObjectMode=="boolean"&&typeof e.destroy=="function"&&typeof e.destroyed=="boolean"}function ct(e,{checkOpen:t=!0}={}){return xe(e,{checkOpen:t})&&(e.readable||!t)&&typeof e.read=="function"&&typeof e.readable=="boolean"&&typeof e.readableObjectMode=="boolean"&&typeof e.destroy=="function"&&typeof e.destroyed=="boolean"}function ws(e,t){return xs(e,t)&&ct(e,t)}var A_=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),ks=class{#t;#r;#e=!1;#i=void 0;constructor(t,r){this.#t=t,this.#r=r}next(){let t=()=>this.#s();return this.#i=this.#i?this.#i.then(t,t):t(),this.#i}return(t){let r=()=>this.#n(t);return this.#i?this.#i.then(r,r):r()}async#s(){if(this.#e)return{done:!0,value:void 0};let t;try{t=await this.#t.read()}catch(r){throw this.#i=void 0,this.#e=!0,this.#t.releaseLock(),r}return t.done&&(this.#i=void 0,this.#e=!0,this.#t.releaseLock()),t}async#n(t){if(this.#e)return{done:!0,value:t};if(this.#e=!0,!this.#r){let r=this.#t.cancel(t);return this.#t.releaseLock(),await r,{done:!0,value:t}}return this.#t.releaseLock(),{done:!0,value:t}}},vs=Symbol();function td(){return this[vs].next()}Object.defineProperty(td,"name",{value:"next"});function rd(e){return this[vs].return(e)}Object.defineProperty(rd,"name",{value:"return"});var C_=Object.create(A_,{next:{enumerable:!0,configurable:!0,writable:!0,value:td},return:{enumerable:!0,configurable:!0,writable:!0,value:rd}});function qs({preventCancel:e=!1}={}){let t=this.getReader(),r=new ks(t,e),i=Object.create(C_);return i[vs]=r,i}var id=e=>{if(ct(e,{checkOpen:!1})&&er.on!==void 0)return P_(e);if(typeof e?.[Symbol.asyncIterator]=="function")return e;if(E_.call(e)==="[object ReadableStream]")return qs.call(e);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:E_}=Object.prototype,P_=async function*(e){let t=new AbortController,r={};T_(e,t,r);try{for await(let[i]of er.on(e,"data",{signal:t.signal}))yield i}catch(i){if(r.error!==void 0)throw r.error;if(!t.signal.aborted)throw i}finally{e.destroy()}},T_=async(e,t,r)=>{try{await er.finished(e,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(i){r.error=i}finally{t.abort()}},er={};var Pt=async(e,{init:t,convertChunk:r,getSize:i,truncateChunk:n,addChunk:s,getFinalChunk:o,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let d=id(e),p=t();p.length=0;try{for await(let u of d){let l=I_(u),m=r[l](u,p);od({convertedChunk:m,state:p,getSize:i,truncateChunk:n,addChunk:s,maxBuffer:c})}return O_({state:p,convertChunk:r,getSize:i,truncateChunk:n,addChunk:s,getFinalChunk:o,maxBuffer:c}),a(p)}catch(u){let l=typeof u=="object"&&u!==null?u:new Error(u);throw l.bufferedData=a(p),l}},O_=({state:e,getSize:t,truncateChunk:r,addChunk:i,getFinalChunk:n,maxBuffer:s})=>{let o=n(e);o!==void 0&&od({convertedChunk:o,state:e,getSize:t,truncateChunk:r,addChunk:i,maxBuffer:s})},od=({convertedChunk:e,state:t,getSize:r,truncateChunk:i,addChunk:n,maxBuffer:s})=>{let o=r(e),a=t.length+o;if(a<=s){nd(e,t,n,a);return}let c=i(e,s-t.length);throw c!==void 0&&nd(c,t,n,s),new Ae},nd=(e,t,r,i)=>{t.contents=r(e,t,i),t.length=i},I_=e=>{let t=typeof e;if(t==="string")return"string";if(t!=="object"||e===null)return"others";if(globalThis.Buffer?.isBuffer(e))return"buffer";let r=sd.call(e);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(e.byteLength)&&Number.isInteger(e.byteOffset)&&sd.call(e.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:sd}=Object.prototype,Ae=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}};var Be=e=>e,tr=()=>{},pi=({contents:e})=>e,di=e=>{throw new Error(`Streams in object mode are not supported: ${String(e)}`)},ui=e=>e.length;async function li(e,t){return Pt(e,L_,t)}var R_=()=>({contents:[]}),j_=()=>1,D_=(e,{contents:t})=>(t.push(e),t),L_={init:R_,convertChunk:{string:Be,buffer:Be,arrayBuffer:Be,dataView:Be,typedArray:Be,others:Be},getSize:j_,truncateChunk:tr,addChunk:D_,getFinalChunk:tr,finalize:pi};async function mi(e,t){return Pt(e,W_,t)}var M_=()=>({contents:new ArrayBuffer(0)}),F_=e=>B_.encode(e),B_=new TextEncoder,ad=e=>new Uint8Array(e),cd=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),U_=(e,t)=>e.slice(0,t),N_=(e,{contents:t,length:r},i)=>{let n=ud()?z_(t,i):G_(t,i);return new Uint8Array(n).set(e,r),n},G_=(e,t)=>{if(t<=e.byteLength)return e;let r=new ArrayBuffer(dd(t));return new Uint8Array(r).set(new Uint8Array(e),0),r},z_=(e,t)=>{if(t<=e.maxByteLength)return e.resize(t),e;let r=new ArrayBuffer(t,{maxByteLength:dd(t)});return new Uint8Array(r).set(new Uint8Array(e),0),r},dd=e=>pd**Math.ceil(Math.log(e)/Math.log(pd)),pd=2,V_=({contents:e,length:t})=>ud()?e:e.slice(0,t),ud=()=>"resize"in ArrayBuffer.prototype,W_={init:M_,convertChunk:{string:F_,buffer:ad,arrayBuffer:ad,dataView:cd,typedArray:cd,others:di},getSize:ui,truncateChunk:U_,addChunk:N_,getFinalChunk:tr,finalize:V_};async function yi(e,t){return Pt(e,X_,t)}var H_=()=>({contents:"",textDecoder:new TextDecoder}),hi=(e,{textDecoder:t})=>t.decode(e,{stream:!0}),K_=(e,{contents:t})=>t+e,Y_=(e,t)=>e.slice(0,t),J_=({textDecoder:e})=>{let t=e.decode();return t===""?void 0:t},X_={init:H_,convertChunk:{string:Be,buffer:hi,arrayBuffer:hi,dataView:hi,typedArray:hi,others:di},getSize:ui,truncateChunk:Y_,addChunk:K_,getFinalChunk:J_,finalize:pi};Object.assign(er,{on:Q_,finished:Z_});var ld=({error:e,stream:t,readableObjectMode:r,lines:i,encoding:n,fdNumber:s})=>{if(!(e instanceof Ae))throw e;if(s==="all")return e;let o=eb(r,i,n);throw e.maxBufferInfo={fdNumber:s,unit:o},t.destroy(),e},eb=(e,t,r)=>e?"objects":t?"lines":r==="buffer"?"bytes":"characters",md=(e,t,r)=>{if(t.length!==r)return;let i=new Ae;throw i.maxBufferInfo={fdNumber:"ipc"},i},hd=(e,t)=>{let{streamName:r,threshold:i,unit:n}=tb(e,t);return`Command's ${r} was larger than ${i} ${n}`},tb=(e,t)=>{if(e?.maxBufferInfo===void 0)return{streamName:"output",threshold:t[1],unit:"bytes"};let{maxBufferInfo:{fdNumber:r,unit:i}}=e;delete e.maxBufferInfo;let n=Fe(t,r);return r==="ipc"?{streamName:"IPC output",threshold:n,unit:"messages"}:{streamName:Or(r),threshold:n,unit:i}},yd=(e,t,r)=>e?.code==="ENOBUFS"&&t!==null&&t.some(i=>i!==null&&i.length>fi(r)),fd=(e,t,r)=>{if(!t)return e;let i=fi(r);return e.length>i?e.slice(0,i):e},fi=([,e])=>e;var _d=({stdio:e,all:t,ipcOutput:r,originalError:i,signal:n,signalDescription:s,exitCode:o,escapedCommand:a,timedOut:c,isCanceled:d,isGracefullyCanceled:p,isMaxBuffer:u,isForcefullyTerminated:l,forceKillAfterDelay:m,killSignal:h,maxBuffer:f,timeout:x,cwd:_})=>{let q=i?.code,A=ib({originalError:i,timedOut:c,timeout:x,isMaxBuffer:u,maxBuffer:f,errorCode:q,signal:n,signalDescription:s,exitCode:o,isCanceled:d,isGracefullyCanceled:p,isForcefullyTerminated:l,forceKillAfterDelay:m,killSignal:h}),E=sb(i,_),w=E===void 0?"":`
64
- ${E}`,L=`${A}: ${a}${w}`,O=t===void 0?[e[2],e[1]]:[t],R=[L,...O,...e.slice(3),r.map(F=>ob(F)).join(`
65
- `)].map(F=>Kt(Et(ab(F)))).filter(Boolean).join(`
66
-
67
- `);return{originalMessage:E,shortMessage:L,message:R}},ib=({originalError:e,timedOut:t,timeout:r,isMaxBuffer:i,maxBuffer:n,errorCode:s,signal:o,signalDescription:a,exitCode:c,isCanceled:d,isGracefullyCanceled:p,isForcefullyTerminated:u,forceKillAfterDelay:l,killSignal:m})=>{let h=nb(u,l);return t?`Command timed out after ${r} milliseconds${h}`:p?o===void 0?`Command was gracefully canceled with exit code ${c}`:u?`Command was gracefully canceled${h}`:`Command was gracefully canceled with ${o} (${a})`:d?`Command was canceled${h}`:i?`${hd(e,n)}${h}`:s!==void 0?`Command failed with ${s}${h}`:u?`Command was killed with ${m} (${Wr(m)})${h}`:o!==void 0?`Command was killed with ${o} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},nb=(e,t)=>e?` and was forcefully terminated after ${t} milliseconds`:"",sb=(e,t)=>{if(e instanceof _e)return;let r=Hc(e)?e.originalMessage:String(e?.message??e),i=Kt(Jp(r,t));return i===""?void 0:i},ob=e=>typeof e=="string"?e:rb(e),ab=e=>Array.isArray(e)?e.map(t=>Et(gd(t))).filter(Boolean).join(`
68
- `):gd(e),gd=e=>typeof e=="string"?e:K(e)?Pr(e):"";var gi=({command:e,escapedCommand:t,stdio:r,all:i,ipcOutput:n,options:{cwd:s},startTime:o})=>bd({command:e,escapedCommand:t,cwd:s,durationMs:Zn(o),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:r[1],stderr:r[2],all:i,stdio:r,ipcOutput:n,pipedFrom:[]}),Tt=({error:e,command:t,escapedCommand:r,fileDescriptors:i,options:n,startTime:s,isSync:o})=>rr({error:e,command:t,escapedCommand:r,startTime:s,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:i.length}),ipcOutput:[],options:n,isSync:o}),rr=({error:e,command:t,escapedCommand:r,startTime:i,timedOut:n,isCanceled:s,isGracefullyCanceled:o,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:d,signal:p,stdio:u,all:l,ipcOutput:m,options:{timeoutDuration:h,timeout:f=h,forceKillAfterDelay:x,killSignal:_,cwd:q,maxBuffer:A},isSync:E})=>{let{exitCode:w,signal:L,signalDescription:O}=pb(d,p),{originalMessage:R,shortMessage:F,message:G}=_d({stdio:u,all:l,ipcOutput:m,originalError:e,signal:L,signalDescription:O,exitCode:w,escapedCommand:r,timedOut:n,isCanceled:s,isGracefullyCanceled:o,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:x,killSignal:_,maxBuffer:A,timeout:f,cwd:q}),v=Vc(e,G,E);return Object.assign(v,cb({error:v,command:t,escapedCommand:r,startTime:i,timedOut:n,isCanceled:s,isGracefullyCanceled:o,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:L,signalDescription:O,stdio:u,all:l,ipcOutput:m,cwd:q,originalMessage:R,shortMessage:F})),v},cb=({error:e,command:t,escapedCommand:r,startTime:i,timedOut:n,isCanceled:s,isGracefullyCanceled:o,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:d,signal:p,signalDescription:u,stdio:l,all:m,ipcOutput:h,cwd:f,originalMessage:x,shortMessage:_})=>bd({shortMessage:_,originalMessage:x,command:t,escapedCommand:r,cwd:f,durationMs:Zn(i),failed:!0,timedOut:n,isCanceled:s,isGracefullyCanceled:o,isTerminated:p!==void 0,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:d,signal:p,signalDescription:u,code:e.cause?.code,stdout:l[1],stderr:l[2],all:m,stdio:l,ipcOutput:h,pipedFrom:[]}),bd=e=>Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0)),pb=(e,t)=>{let r=e===null?void 0:e,i=t===null?void 0:t,n=i===void 0?void 0:Wr(t);return{exitCode:r,signal:i,signalDescription:n}};var xd=e=>Number.isFinite(e)?e:0;function db(e){return{days:Math.trunc(e/864e5),hours:Math.trunc(e/36e5%24),minutes:Math.trunc(e/6e4%60),seconds:Math.trunc(e/1e3%60),milliseconds:Math.trunc(e%1e3),microseconds:Math.trunc(xd(e*1e3)%1e3),nanoseconds:Math.trunc(xd(e*1e6)%1e3)}}function ub(e){return{days:e/86400000n,hours:e/3600000n%24n,minutes:e/60000n%60n,seconds:e/1000n%60n,milliseconds:e%1000n,microseconds:0n,nanoseconds:0n}}function Ss(e){switch(typeof e){case"number":{if(Number.isFinite(e))return db(e);break}case"bigint":return ub(e)}throw new TypeError("Expected a finite number or bigint")}var lb=e=>e===0||e===0n,mb=(e,t)=>t===1||t===1n?e:`${e}s`,hb=1e-7,yb=24n*60n*60n*1000n;function $s(e,t){let r=typeof e=="bigint";if(!r&&!Number.isFinite(e))throw new TypeError("Expected a finite number or bigint");t={...t};let i=e<0?"-":"";e=e<0?-e:e,t.colonNotation&&(t.compact=!1,t.formatSubMilliseconds=!1,t.separateMilliseconds=!1,t.verbose=!1),t.compact&&(t.unitCount=1,t.secondsDecimalDigits=0,t.millisecondsDecimalDigits=0);let n=[],s=(p,u)=>{let l=Math.floor(p*10**u+hb);return(Math.round(l)/10**u).toFixed(u)},o=(p,u,l,m)=>{if(!((n.length===0||!t.colonNotation)&&lb(p)&&!(t.colonNotation&&l==="m"))){if(m??=String(p),t.colonNotation){let h=m.includes(".")?m.split(".")[0].length:m.length,f=n.length>0?2:1;m="0".repeat(Math.max(0,f-h))+m}else m+=t.verbose?" "+mb(u,p):l;n.push(m)}},a=Ss(e),c=BigInt(a.days);if(t.hideYearAndDays?o(BigInt(c)*24n+BigInt(a.hours),"hour","h"):(t.hideYear?o(c,"day","d"):(o(c/365n,"year","y"),o(c%365n,"day","d")),o(Number(a.hours),"hour","h")),o(Number(a.minutes),"minute","m"),!t.hideSeconds)if(t.separateMilliseconds||t.formatSubMilliseconds||!t.colonNotation&&e<1e3&&!t.subSecondsAsDecimals){let p=Number(a.seconds),u=Number(a.milliseconds),l=Number(a.microseconds),m=Number(a.nanoseconds);if(o(p,"second","s"),t.formatSubMilliseconds)o(u,"millisecond","ms"),o(l,"microsecond","\xB5s"),o(m,"nanosecond","ns");else{let h=u+l/1e3+m/1e6,f=typeof t.millisecondsDecimalDigits=="number"?t.millisecondsDecimalDigits:0,x=h>=1?Math.round(h):Math.ceil(h),_=f?h.toFixed(f):x;o(Number.parseFloat(_),"millisecond","ms",_)}}else{let p=(r?Number(e%yb):e)/1e3%60,u=typeof t.secondsDecimalDigits=="number"?t.secondsDecimalDigits:1,l=s(p,u),m=t.keepDecimalsOnWholeSeconds?l:l.replace(/\.0+$/,"");o(Number.parseFloat(m),"second","s",m)}if(n.length===0)return i+"0"+(t.verbose?" milliseconds":"ms");let d=t.colonNotation?":":" ";return typeof t.unitCount=="number"&&(n=n.slice(0,Math.max(t.unitCount,1))),i+n.join(d)}var wd=(e,t)=>{e.failed&&qe({type:"error",verboseMessage:e.shortMessage,verboseInfo:t,result:e})};var kd=(e,t)=>{kt(t)&&(wd(e,t),fb(e,t))},fb=(e,t)=>{let r=`(done in ${$s(e.durationMs)})`;qe({type:"duration",verboseMessage:r,verboseInfo:t,result:e})};var Ot=(e,t,{reject:r})=>{if(kd(e,t),e.failed&&r)throw e;return e};import{readFileSync as Yd}from"fs";var Sd=(e,t)=>pt(e)?"asyncGenerator":Cd(e)?"generator":_i(e)?"fileUrl":wb(e)?"filePath":qb(e)?"webStream":xe(e,{checkOpen:!1})?"native":K(e)?"uint8Array":Sb(e)?"asyncIterable":$b(e)?"iterable":Es(e)?$d({transform:e},t):xb(e)?gb(e,t):"native",gb=(e,t)=>ws(e.transform,{checkOpen:!1})?_b(e,t):Es(e.transform)?$d(e,t):bb(e,t),_b=(e,t)=>(Ad(e,t,"Duplex stream"),"duplex"),$d=(e,t)=>(Ad(e,t,"web TransformStream"),"webTransform"),Ad=({final:e,binary:t,objectMode:r},i,n)=>{vd(e,`${i}.final`,n),vd(t,`${i}.binary`,n),As(r,`${i}.objectMode`)},vd=(e,t,r)=>{if(e!==void 0)throw new TypeError(`The \`${t}\` option can only be defined when using a generator, not a ${r}.`)},bb=({transform:e,final:t,binary:r,objectMode:i},n)=>{if(e!==void 0&&!qd(e))throw new TypeError(`The \`${n}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(ws(t,{checkOpen:!1}))throw new TypeError(`The \`${n}.final\` option must not be a Duplex stream.`);if(Es(t))throw new TypeError(`The \`${n}.final\` option must not be a web TransformStream.`);if(t!==void 0&&!qd(t))throw new TypeError(`The \`${n}.final\` option must be a generator.`);return As(r,`${n}.binary`),As(i,`${n}.objectMode`),pt(e)||pt(t)?"asyncGenerator":"generator"},As=(e,t)=>{if(e!==void 0&&typeof e!="boolean")throw new TypeError(`The \`${t}\` option must use a boolean.`)},qd=e=>pt(e)||Cd(e),pt=e=>Object.prototype.toString.call(e)==="[object AsyncGeneratorFunction]",Cd=e=>Object.prototype.toString.call(e)==="[object GeneratorFunction]",xb=e=>V(e)&&(e.transform!==void 0||e.final!==void 0),_i=e=>Object.prototype.toString.call(e)==="[object URL]",Ed=e=>_i(e)&&e.protocol!=="file:",wb=e=>V(e)&&Object.keys(e).length>0&&Object.keys(e).every(t=>kb.has(t))&&Cs(e.file),kb=new Set(["file","append"]),Cs=e=>typeof e=="string",Pd=(e,t)=>e==="native"&&typeof t=="string"&&!vb.has(t),vb=new Set(["ipc","ignore","inherit","overlapped","pipe"]),Td=e=>Object.prototype.toString.call(e)==="[object ReadableStream]",bi=e=>Object.prototype.toString.call(e)==="[object WritableStream]",qb=e=>Td(e)||bi(e),Es=e=>Td(e?.readable)&&bi(e?.writable),Sb=e=>Od(e)&&typeof e[Symbol.asyncIterator]=="function",$b=e=>Od(e)&&typeof e[Symbol.iterator]=="function",Od=e=>typeof e=="object"&&e!==null,me=new Set(["generator","asyncGenerator","duplex","webTransform"]),xi=new Set(["fileUrl","filePath","fileNumber"]),Ps=new Set(["fileUrl","filePath"]),Id=new Set([...Ps,"webStream","nodeStream"]),Rd=new Set(["webTransform","duplex"]),Ye={generator:"a generator",asyncGenerator:"an async generator",fileUrl:"a file URL",filePath:"a file path string",fileNumber:"a file descriptor number",webStream:"a web stream",nodeStream:"a Node.js stream",webTransform:"a web TransformStream",duplex:"a Duplex stream",native:"any value",iterable:"an iterable",asyncIterable:"an async iterable",string:"a string",uint8Array:"a Uint8Array"};var Ts=(e,t,r,i)=>i==="output"?Ab(e,t,r):Cb(e,t,r),Ab=(e,t,r)=>{let i=t!==0&&r[t-1].value.readableObjectMode;return{writableObjectMode:i,readableObjectMode:e??i}},Cb=(e,t,r)=>{let i=t===0?e===!0:r[t-1].value.readableObjectMode,n=t!==r.length-1&&(e??i);return{writableObjectMode:i,readableObjectMode:n}},jd=(e,t)=>{let r=e.findLast(({type:i})=>me.has(i));return r===void 0?!1:t==="input"?r.value.writableObjectMode:r.value.readableObjectMode};var Dd=(e,t,r,i)=>[...e.filter(({type:n})=>!me.has(n)),...Eb(e,t,r,i)],Eb=(e,t,r,{encoding:i})=>{let n=e.filter(({type:o})=>me.has(o)),s=Array.from({length:n.length});for(let[o,a]of Object.entries(n))s[o]=Pb({stdioItem:a,index:Number(o),newTransforms:s,optionName:t,direction:r,encoding:i});return Rb(s,r)},Pb=({stdioItem:e,stdioItem:{type:t},index:r,newTransforms:i,optionName:n,direction:s,encoding:o})=>t==="duplex"?Tb({stdioItem:e,optionName:n}):t==="webTransform"?Ob({stdioItem:e,index:r,newTransforms:i,direction:s}):Ib({stdioItem:e,index:r,newTransforms:i,direction:s,encoding:o}),Tb=({stdioItem:e,stdioItem:{value:{transform:t,transform:{writableObjectMode:r,readableObjectMode:i},objectMode:n=i}},optionName:s})=>{if(n&&!i)throw new TypeError(`The \`${s}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!n&&i)throw new TypeError(`The \`${s}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{...e,value:{transform:t,writableObjectMode:r,readableObjectMode:i}}},Ob=({stdioItem:e,stdioItem:{value:t},index:r,newTransforms:i,direction:n})=>{let{transform:s,objectMode:o}=V(t)?t:{transform:t},{writableObjectMode:a,readableObjectMode:c}=Ts(o,r,i,n);return{...e,value:{transform:s,writableObjectMode:a,readableObjectMode:c}}},Ib=({stdioItem:e,stdioItem:{value:t},index:r,newTransforms:i,direction:n,encoding:s})=>{let{transform:o,final:a,binary:c=!1,preserveNewlines:d=!1,objectMode:p}=V(t)?t:{transform:t},u=c||ae.has(s),{writableObjectMode:l,readableObjectMode:m}=Ts(p,r,i,n);return{...e,value:{transform:o,final:a,binary:u,preserveNewlines:d,writableObjectMode:l,readableObjectMode:m}}},Rb=(e,t)=>t==="input"?e.reverse():e;import Os from"process";var Ld=(e,t,r)=>{let i=e.map(n=>jb(n,t));if(i.includes("input")&&i.includes("output"))throw new TypeError(`The \`${r}\` option must not be an array of both readable and writable values.`);return i.find(Boolean)??Mb},jb=({type:e,value:t},r)=>Db[r]??Md[e](t),Db=["input","output","output"],It=()=>{},Is=()=>"input",Md={generator:It,asyncGenerator:It,fileUrl:It,filePath:It,iterable:Is,asyncIterable:Is,uint8Array:Is,webStream:e=>bi(e)?"output":"input",nodeStream(e){return ct(e,{checkOpen:!1})?xs(e,{checkOpen:!1})?void 0:"input":"output"},webTransform:It,duplex:It,native(e){let t=Lb(e);if(t!==void 0)return t;if(xe(e,{checkOpen:!1}))return Md.nodeStream(e)}},Lb=e=>{if([0,Os.stdin].includes(e))return"input";if([1,2,Os.stdout,Os.stderr].includes(e))return"output"},Mb="output";var Fd=(e,t)=>t&&!e.includes("ipc")?[...e,"ipc"]:e;var Bd=({stdio:e,ipc:t,buffer:r,...i},n,s)=>{let o=Fb(e,i).map((a,c)=>Ud(a,c));return s?Ub(o,r,n):Fd(o,t)},Fb=(e,t)=>{if(e===void 0)return le.map(i=>t[i]);if(Bb(t))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${le.map(i=>`\`${i}\``).join(", ")}`);if(typeof e=="string")return[e,e,e];if(!Array.isArray(e))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof e}\``);let r=Math.max(e.length,le.length);return Array.from({length:r},(i,n)=>e[n])},Bb=e=>le.some(t=>e[t]!==void 0),Ud=(e,t)=>Array.isArray(e)?e.map(r=>Ud(r,t)):e??(t>=le.length?"ignore":"pipe"),Ub=(e,t,r)=>e.map((i,n)=>!t[n]&&n!==0&&!vt(r,n)&&Nb(i)?"ignore":i),Nb=e=>e==="pipe"||Array.isArray(e)&&e.every(t=>t==="pipe");import{readFileSync as Gb}from"fs";import zb from"tty";var Gd=({stdioItem:e,stdioItem:{type:t},isStdioArray:r,fdNumber:i,direction:n,isSync:s})=>!r||t!=="native"?e:s?Vb({stdioItem:e,fdNumber:i,direction:n}):Kb({stdioItem:e,fdNumber:i}),Vb=({stdioItem:e,stdioItem:{value:t,optionName:r},fdNumber:i,direction:n})=>{let s=Wb({value:t,optionName:r,fdNumber:i,direction:n});if(s!==void 0)return s;if(xe(t,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return e},Wb=({value:e,optionName:t,fdNumber:r,direction:i})=>{let n=Hb(e,r);if(n!==void 0){if(i==="output")return{type:"fileNumber",value:n,optionName:t};if(zb.isatty(n))throw new TypeError(`The \`${t}: ${Yr(e)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:Me(Gb(n)),optionName:t}}},Hb=(e,t)=>{if(e==="inherit")return t;if(typeof e=="number")return e;let r=Tr.indexOf(e);if(r!==-1)return r},Kb=({stdioItem:e,stdioItem:{value:t,optionName:r},fdNumber:i})=>t==="inherit"?{type:"nodeStream",value:Nd(i,t,r),optionName:r}:typeof t=="number"?{type:"nodeStream",value:Nd(t,t,r),optionName:r}:xe(t,{checkOpen:!1})?{type:"nodeStream",value:t,optionName:r}:e,Nd=(e,t,r)=>{let i=Tr[e];if(i===void 0)throw new TypeError(`The \`${r}: ${t}\` option is invalid: no such standard stream.`);return i};var zd=({input:e,inputFile:t},r)=>r===0?[...Yb(e),...Xb(t)]:[],Yb=e=>e===void 0?[]:[{type:Jb(e),value:e,optionName:"input"}],Jb=e=>{if(ct(e,{checkOpen:!1}))return"nodeStream";if(typeof e=="string")return"string";if(K(e))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},Xb=e=>e===void 0?[]:[{...Qb(e),optionName:"inputFile"}],Qb=e=>{if(_i(e))return{type:"fileUrl",value:e};if(Cs(e))return{type:"filePath",value:{file:e}};throw new Error("The `inputFile` option must be a file path string or a file URL.")};var Vd=e=>e.filter((t,r)=>e.every((i,n)=>t.value!==i.value||r>=n||t.type==="generator"||t.type==="asyncGenerator")),Wd=({stdioItem:{type:e,value:t,optionName:r},direction:i,fileDescriptors:n,isSync:s})=>{let o=Zb(n,e);if(o.length!==0){if(s){ex({otherStdioItems:o,type:e,value:t,optionName:r,direction:i});return}if(Id.has(e))return Hd({otherStdioItems:o,type:e,value:t,optionName:r,direction:i});Rd.has(e)&&rx({otherStdioItems:o,type:e,value:t,optionName:r})}},Zb=(e,t)=>e.flatMap(({direction:r,stdioItems:i})=>i.filter(n=>n.type===t).map((n=>({...n,direction:r})))),ex=({otherStdioItems:e,type:t,value:r,optionName:i,direction:n})=>{Ps.has(t)&&Hd({otherStdioItems:e,type:t,value:r,optionName:i,direction:n})},Hd=({otherStdioItems:e,type:t,value:r,optionName:i,direction:n})=>{let s=e.filter(a=>tx(a,r));if(s.length===0)return;let o=s.find(a=>a.direction!==n);return Kd(o,i,t),n==="output"?s[0].stream:void 0},tx=({type:e,value:t},r)=>e==="filePath"?t.file===r.file:e==="fileUrl"?t.href===r.href:t===r,rx=({otherStdioItems:e,type:t,value:r,optionName:i})=>{let n=e.find(({value:{transform:s}})=>s===r.transform);Kd(n,i,t)},Kd=(e,t,r)=>{if(e!==void 0)throw new TypeError(`The \`${e.optionName}\` and \`${t}\` options must not target ${Ye[r]} that is the same.`)};var wi=(e,t,r,i)=>{let s=Bd(t,r,i).map((a,c)=>ix({stdioOption:a,fdNumber:c,options:t,isSync:i})),o=ux({initialFileDescriptors:s,addProperties:e,options:t,isSync:i});return t.stdio=o.map(({stdioItems:a})=>hx(a)),o},ix=({stdioOption:e,fdNumber:t,options:r,isSync:i})=>{let n=Or(t),{stdioItems:s,isStdioArray:o}=nx({stdioOption:e,fdNumber:t,options:r,optionName:n}),a=Ld(s,t,n),c=s.map(u=>Gd({stdioItem:u,isStdioArray:o,fdNumber:t,direction:a,isSync:i})),d=Dd(c,n,a,r),p=jd(d,a);return dx(d,p),{direction:a,objectMode:p,stdioItems:d}},nx=({stdioOption:e,fdNumber:t,options:r,optionName:i})=>{let s=[...(Array.isArray(e)?e:[e]).map(c=>sx(c,i)),...zd(r,t)],o=Vd(s),a=o.length>1;return ox(o,a,i),cx(o),{stdioItems:o,isStdioArray:a}},sx=(e,t)=>({type:Sd(e,t),value:e,optionName:t}),ox=(e,t,r)=>{if(e.length===0)throw new TypeError(`The \`${r}\` option must not be an empty array.`);if(t){for(let{value:i,optionName:n}of e)if(ax.has(i))throw new Error(`The \`${n}\` option must not include \`${i}\`.`)}},ax=new Set(["ignore","ipc"]),cx=e=>{for(let t of e)px(t)},px=({type:e,value:t,optionName:r})=>{if(Ed(t))throw new TypeError(`The \`${r}: URL\` option must use the \`file:\` scheme.
69
- For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(Pd(e,t))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},dx=(e,t)=>{if(!t)return;let r=e.find(({type:i})=>xi.has(i));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},ux=({initialFileDescriptors:e,addProperties:t,options:r,isSync:i})=>{let n=[];try{for(let s of e)n.push(lx({fileDescriptor:s,fileDescriptors:n,addProperties:t,options:r,isSync:i}));return n}catch(s){throw Rs(n),s}},lx=({fileDescriptor:{direction:e,objectMode:t,stdioItems:r},fileDescriptors:i,addProperties:n,options:s,isSync:o})=>{let a=r.map(c=>mx({stdioItem:c,addProperties:n,direction:e,options:s,fileDescriptors:i,isSync:o}));return{direction:e,objectMode:t,stdioItems:a}},mx=({stdioItem:e,addProperties:t,direction:r,options:i,fileDescriptors:n,isSync:s})=>{let o=Wd({stdioItem:e,direction:r,fileDescriptors:n,isSync:s});return o!==void 0?{...e,stream:o}:{...e,...t[r][e.type](e,i)}},Rs=e=>{for(let{stdioItems:t}of e)for(let{stream:r}of t)r!==void 0&&!ge(r)&&r.destroy()},hx=e=>{if(e.length>1)return e.some(({value:i})=>i==="overlapped")?"overlapped":"pipe";let[{type:t,value:r}]=e;return t==="native"?r:"pipe"};var Xd=(e,t)=>wi(fx,e,t,!0),Ce=({type:e,optionName:t})=>{Qd(t,Ye[e])},yx=({optionName:e,value:t})=>((t==="ipc"||t==="overlapped")&&Qd(e,`"${t}"`),{}),Qd=(e,t)=>{throw new TypeError(`The \`${e}\` option cannot be ${t} with synchronous methods.`)},Jd={generator(){},asyncGenerator:Ce,webStream:Ce,nodeStream:Ce,webTransform:Ce,duplex:Ce,asyncIterable:Ce,native:yx},fx={input:{...Jd,fileUrl:({value:e})=>({contents:[Me(Yd(e))]}),filePath:({value:{file:e}})=>({contents:[Me(Yd(e))]}),fileNumber:Ce,iterable:({value:e})=>({contents:[...e]}),string:({value:e})=>({contents:[e]}),uint8Array:({value:e})=>({contents:[e]})},output:{...Jd,fileUrl:({value:e})=>({path:e}),filePath:({value:{file:e,append:t}})=>({path:e,append:t}),fileNumber:({value:e})=>({path:e}),iterable:Ce,string:Ce,uint8Array:Ce}};var Ue=(e,{stripFinalNewline:t},r)=>js(t,r)&&e!==void 0&&!Array.isArray(e)?Et(e):e,js=(e,t)=>t==="all"?e[1]||e[2]:e[t];import{Transform as Lx,getDefaultHighWaterMark as pu}from"stream";var ki=(e,t,r,i)=>e||r?void 0:eu(t,i),Ls=(e,t,r)=>r?e.flatMap(i=>Zd(i,t)):Zd(e,t),Zd=(e,t)=>{let{transform:r,final:i}=eu(t,{});return[...r(e),...i()]},eu=(e,t)=>(t.previousChunks="",{transform:gx.bind(void 0,t,e),final:bx.bind(void 0,t)}),gx=function*(e,t,r){if(typeof r!="string"){yield r;return}let{previousChunks:i}=e,n=-1;for(let s=0;s<r.length;s+=1)if(r[s]===`
70
- `){let o=_x(r,s,t,e),a=r.slice(n+1,s+1-o);i.length>0&&(a=Ds(i,a),i=""),yield a,n=s}n!==r.length-1&&(i=Ds(i,r.slice(n+1))),e.previousChunks=i},_x=(e,t,r,i)=>r?0:(i.isWindowsNewline=t!==0&&e[t-1]==="\r",i.isWindowsNewline?2:1),bx=function*({previousChunks:e}){e.length>0&&(yield e)},tu=({binary:e,preserveNewlines:t,readableObjectMode:r,state:i})=>e||t||r?void 0:{transform:xx.bind(void 0,i)},xx=function*({isWindowsNewline:e=!1},t){let{unixNewline:r,windowsNewline:i,LF:n,concatBytes:s}=typeof t=="string"?wx:vx;if(t.at(-1)===n){yield t;return}yield s(t,e?i:r)},Ds=(e,t)=>`${e}${t}`,wx={windowsNewline:`\r
129
+ ${e}`};var ki=(e,t,r)=>{r.cwd=xd(r.cwd);let[i,n,s]=yd(e,t,r),{command:o,args:a,options:c}=Sd.default._parse(i,n,s),d=pc(c),p=pb(d);return ud(p),bd(p),fd(p),Op(p),pd(p),p.shell=ss(p.shell),p.env=db(p),p.killSignal=Ap(p.killSignal),p.forceKillAfterDelay=Pp(p.forceKillAfterDelay),p.lines=p.lines.map((u,l)=>u&&!ae.has(p.encoding)&&p.buffer[l]),vd.platform==="win32"&&cb.basename(o,".exe")==="cmd"&&a.unshift("/q"),{file:o,commandArguments:a,options:p}},pb=({extendEnv:e=!0,preferLocal:t=!1,cwd:r,localDir:i=r,encoding:n="utf8",reject:s=!0,cleanup:o=!0,all:a=!1,windowsHide:c=!0,killSignal:d="SIGTERM",forceKillAfterDelay:p=!0,gracefulCancel:u=!1,ipcInput:l,ipc:m=l!==void 0||u,serialization:h="advanced",...f})=>({...f,extendEnv:e,preferLocal:t,cwd:r,localDirectory:i,encoding:n,reject:s,cleanup:o,all:a,windowsHide:c,killSignal:d,forceKillAfterDelay:p,gracefulCancel:u,ipcInput:l,ipc:m,serialization:h}),db=({env:e,extendEnv:t,preferLocal:r,node:i,localDirectory:n,nodePath:s})=>{let o=t?{...vd.env,...e}:e;return r||i?fp({env:o,cwd:n,execPath:s,preferLocal:r,addExecPath:i}):o};var vi=(e,t,r)=>r.shell&&t.length>0?[[e,...t].join(" "),[],r]:[e,t,r];import{inspect as zb}from"util";function Tt(e){if(typeof e=="string")return ub(e);if(!(ArrayBuffer.isView(e)&&e.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return lb(e)}var ub=e=>e.at(-1)===qd?e.slice(0,e.at(-2)===$d?-2:-1):e,lb=e=>e.at(-1)===mb?e.subarray(0,e.at(-2)===hb?-2:-1):e,qd=`
130
+ `,mb=qd.codePointAt(0),$d="\r",hb=$d.codePointAt(0);import{on as Bb}from"events";import{finished as Ub}from"stream/promises";function xe(e,{checkOpen:t=!0}={}){return e!==null&&typeof e=="object"&&(e.writable||e.readable||!t||e.writable===void 0&&e.readable===void 0)&&typeof e.pipe=="function"}function Rs(e,{checkOpen:t=!0}={}){return xe(e,{checkOpen:t})&&(e.writable||!t)&&typeof e.write=="function"&&typeof e.end=="function"&&typeof e.writable=="boolean"&&typeof e.writableObjectMode=="boolean"&&typeof e.destroy=="function"&&typeof e.destroyed=="boolean"}function ut(e,{checkOpen:t=!0}={}){return xe(e,{checkOpen:t})&&(e.readable||!t)&&typeof e.read=="function"&&typeof e.readable=="boolean"&&typeof e.readableObjectMode=="boolean"&&typeof e.destroy=="function"&&typeof e.destroyed=="boolean"}function js(e,t){return Rs(e,t)&&ut(e,t)}var yb=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),Ds=class{#t;#r;#e=!1;#i=void 0;constructor(t,r){this.#t=t,this.#r=r}next(){let t=()=>this.#s();return this.#i=this.#i?this.#i.then(t,t):t(),this.#i}return(t){let r=()=>this.#n(t);return this.#i?this.#i.then(r,r):r()}async#s(){if(this.#e)return{done:!0,value:void 0};let t;try{t=await this.#t.read()}catch(r){throw this.#i=void 0,this.#e=!0,this.#t.releaseLock(),r}return t.done&&(this.#i=void 0,this.#e=!0,this.#t.releaseLock()),t}async#n(t){if(this.#e)return{done:!0,value:t};if(this.#e=!0,!this.#r){let r=this.#t.cancel(t);return this.#t.releaseLock(),await r,{done:!0,value:t}}return this.#t.releaseLock(),{done:!0,value:t}}},Ls=Symbol();function Ad(){return this[Ls].next()}Object.defineProperty(Ad,"name",{value:"next"});function Cd(e){return this[Ls].return(e)}Object.defineProperty(Cd,"name",{value:"return"});var fb=Object.create(yb,{next:{enumerable:!0,configurable:!0,writable:!0,value:Ad},return:{enumerable:!0,configurable:!0,writable:!0,value:Cd}});function Ms({preventCancel:e=!1}={}){let t=this.getReader(),r=new Ds(t,e),i=Object.create(fb);return i[Ls]=r,i}var Ed=e=>{if(ut(e,{checkOpen:!1})&&sr.on!==void 0)return _b(e);if(typeof e?.[Symbol.asyncIterator]=="function")return e;if(gb.call(e)==="[object ReadableStream]")return Ms.call(e);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:gb}=Object.prototype,_b=async function*(e){let t=new AbortController,r={};bb(e,t,r);try{for await(let[i]of sr.on(e,"data",{signal:t.signal}))yield i}catch(i){if(r.error!==void 0)throw r.error;if(!t.signal.aborted)throw i}finally{e.destroy()}},bb=async(e,t,r)=>{try{await sr.finished(e,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(i){r.error=i}finally{t.abort()}},sr={};var Ot=async(e,{init:t,convertChunk:r,getSize:i,truncateChunk:n,addChunk:s,getFinalChunk:o,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let d=Ed(e),p=t();p.length=0;try{for await(let u of d){let l=wb(u),m=r[l](u,p);Od({convertedChunk:m,state:p,getSize:i,truncateChunk:n,addChunk:s,maxBuffer:c})}return xb({state:p,convertChunk:r,getSize:i,truncateChunk:n,addChunk:s,getFinalChunk:o,maxBuffer:c}),a(p)}catch(u){let l=typeof u=="object"&&u!==null?u:new Error(u);throw l.bufferedData=a(p),l}},xb=({state:e,getSize:t,truncateChunk:r,addChunk:i,getFinalChunk:n,maxBuffer:s})=>{let o=n(e);o!==void 0&&Od({convertedChunk:o,state:e,getSize:t,truncateChunk:r,addChunk:i,maxBuffer:s})},Od=({convertedChunk:e,state:t,getSize:r,truncateChunk:i,addChunk:n,maxBuffer:s})=>{let o=r(e),a=t.length+o;if(a<=s){Pd(e,t,n,a);return}let c=i(e,s-t.length);throw c!==void 0&&Pd(c,t,n,s),new Pe},Pd=(e,t,r,i)=>{t.contents=r(e,t,i),t.length=i},wb=e=>{let t=typeof e;if(t==="string")return"string";if(t!=="object"||e===null)return"others";if(globalThis.Buffer?.isBuffer(e))return"buffer";let r=Td.call(e);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(e.byteLength)&&Number.isInteger(e.byteOffset)&&Td.call(e.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:Td}=Object.prototype,Pe=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}};var Ne=e=>e,or=()=>{},Si=({contents:e})=>e,qi=e=>{throw new Error(`Streams in object mode are not supported: ${String(e)}`)},$i=e=>e.length;async function Ai(e,t){return Ot(e,qb,t)}var kb=()=>({contents:[]}),vb=()=>1,Sb=(e,{contents:t})=>(t.push(e),t),qb={init:kb,convertChunk:{string:Ne,buffer:Ne,arrayBuffer:Ne,dataView:Ne,typedArray:Ne,others:Ne},getSize:vb,truncateChunk:or,addChunk:Sb,getFinalChunk:or,finalize:Si};async function Ci(e,t){return Ot(e,Rb,t)}var $b=()=>({contents:new ArrayBuffer(0)}),Ab=e=>Cb.encode(e),Cb=new TextEncoder,Id=e=>new Uint8Array(e),Rd=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),Eb=(e,t)=>e.slice(0,t),Pb=(e,{contents:t,length:r},i)=>{let n=Ld()?Ob(t,i):Tb(t,i);return new Uint8Array(n).set(e,r),n},Tb=(e,t)=>{if(t<=e.byteLength)return e;let r=new ArrayBuffer(Dd(t));return new Uint8Array(r).set(new Uint8Array(e),0),r},Ob=(e,t)=>{if(t<=e.maxByteLength)return e.resize(t),e;let r=new ArrayBuffer(t,{maxByteLength:Dd(t)});return new Uint8Array(r).set(new Uint8Array(e),0),r},Dd=e=>jd**Math.ceil(Math.log(e)/Math.log(jd)),jd=2,Ib=({contents:e,length:t})=>Ld()?e:e.slice(0,t),Ld=()=>"resize"in ArrayBuffer.prototype,Rb={init:$b,convertChunk:{string:Ab,buffer:Id,arrayBuffer:Id,dataView:Rd,typedArray:Rd,others:qi},getSize:$i,truncateChunk:Eb,addChunk:Pb,getFinalChunk:or,finalize:Ib};async function Pi(e,t){return Ot(e,Fb,t)}var jb=()=>({contents:"",textDecoder:new TextDecoder}),Ei=(e,{textDecoder:t})=>t.decode(e,{stream:!0}),Db=(e,{contents:t})=>t+e,Lb=(e,t)=>e.slice(0,t),Mb=({textDecoder:e})=>{let t=e.decode();return t===""?void 0:t},Fb={init:jb,convertChunk:{string:Ne,buffer:Ei,arrayBuffer:Ei,dataView:Ei,typedArray:Ei,others:qi},getSize:$i,truncateChunk:Lb,addChunk:Db,getFinalChunk:Mb,finalize:Si};Object.assign(sr,{on:Bb,finished:Ub});var Md=({error:e,stream:t,readableObjectMode:r,lines:i,encoding:n,fdNumber:s})=>{if(!(e instanceof Pe))throw e;if(s==="all")return e;let o=Nb(r,i,n);throw e.maxBufferInfo={fdNumber:s,unit:o},t.destroy(),e},Nb=(e,t,r)=>e?"objects":t?"lines":r==="buffer"?"bytes":"characters",Fd=(e,t,r)=>{if(t.length!==r)return;let i=new Pe;throw i.maxBufferInfo={fdNumber:"ipc"},i},Bd=(e,t)=>{let{streamName:r,threshold:i,unit:n}=Gb(e,t);return`Command's ${r} was larger than ${i} ${n}`},Gb=(e,t)=>{if(e?.maxBufferInfo===void 0)return{streamName:"output",threshold:t[1],unit:"bytes"};let{maxBufferInfo:{fdNumber:r,unit:i}}=e;delete e.maxBufferInfo;let n=Ue(t,r);return r==="ipc"?{streamName:"IPC output",threshold:n,unit:"messages"}:{streamName:Hr(r),threshold:n,unit:i}},Ud=(e,t,r)=>e?.code==="ENOBUFS"&&t!==null&&t.some(i=>i!==null&&i.length>Ti(r)),Nd=(e,t,r)=>{if(!t)return e;let i=Ti(r);return e.length>i?e.slice(0,i):e},Ti=([,e])=>e;var zd=({stdio:e,all:t,ipcOutput:r,originalError:i,signal:n,signalDescription:s,exitCode:o,escapedCommand:a,timedOut:c,isCanceled:d,isGracefullyCanceled:p,isMaxBuffer:u,isForcefullyTerminated:l,forceKillAfterDelay:m,killSignal:h,maxBuffer:f,timeout:x,cwd:_})=>{let S=i?.code,A=Vb({originalError:i,timedOut:c,timeout:x,isMaxBuffer:u,maxBuffer:f,errorCode:S,signal:n,signalDescription:s,exitCode:o,isCanceled:d,isGracefullyCanceled:p,isForcefullyTerminated:l,forceKillAfterDelay:m,killSignal:h}),P=Hb(i,_),w=P===void 0?"":`
131
+ ${P}`,D=`${A}: ${a}${w}`,O=t===void 0?[e[2],e[1]]:[t],I=[D,...O,...e.slice(3),r.map(F=>Kb(F)).join(`
132
+ `)].map(F=>Zt(Tt(Yb(F)))).filter(Boolean).join(`
133
+
134
+ `);return{originalMessage:P,shortMessage:D,message:I}},Vb=({originalError:e,timedOut:t,timeout:r,isMaxBuffer:i,maxBuffer:n,errorCode:s,signal:o,signalDescription:a,exitCode:c,isCanceled:d,isGracefullyCanceled:p,isForcefullyTerminated:u,forceKillAfterDelay:l,killSignal:m})=>{let h=Wb(u,l);return t?`Command timed out after ${r} milliseconds${h}`:p?o===void 0?`Command was gracefully canceled with exit code ${c}`:u?`Command was gracefully canceled${h}`:`Command was gracefully canceled with ${o} (${a})`:d?`Command was canceled${h}`:i?`${Bd(e,n)}${h}`:s!==void 0?`Command failed with ${s}${h}`:u?`Command was killed with ${m} (${ai(m)})${h}`:o!==void 0?`Command was killed with ${o} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},Wb=(e,t)=>e?` and was forcefully terminated after ${t} milliseconds`:"",Hb=(e,t)=>{if(e instanceof _e)return;let r=bp(e)?e.originalMessage:String(e?.message??e),i=Zt(kd(r,t));return i===""?void 0:i},Kb=e=>typeof e=="string"?e:zb(e),Yb=e=>Array.isArray(e)?e.map(t=>Tt(Gd(t))).filter(Boolean).join(`
135
+ `):Gd(e),Gd=e=>typeof e=="string"?e:J(e)?Vr(e):"";var Oi=({command:e,escapedCommand:t,stdio:r,all:i,ipcOutput:n,options:{cwd:s},startTime:o})=>Vd({command:e,escapedCommand:t,cwd:s,durationMs:ms(o),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:r[1],stderr:r[2],all:i,stdio:r,ipcOutput:n,pipedFrom:[]}),It=({error:e,command:t,escapedCommand:r,fileDescriptors:i,options:n,startTime:s,isSync:o})=>ar({error:e,command:t,escapedCommand:r,startTime:s,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:i.length}),ipcOutput:[],options:n,isSync:o}),ar=({error:e,command:t,escapedCommand:r,startTime:i,timedOut:n,isCanceled:s,isGracefullyCanceled:o,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:d,signal:p,stdio:u,all:l,ipcOutput:m,options:{timeoutDuration:h,timeout:f=h,forceKillAfterDelay:x,killSignal:_,cwd:S,maxBuffer:A},isSync:P})=>{let{exitCode:w,signal:D,signalDescription:O}=Xb(d,p),{originalMessage:I,shortMessage:F,message:z}=zd({stdio:u,all:l,ipcOutput:m,originalError:e,signal:D,signalDescription:O,exitCode:w,escapedCommand:r,timedOut:n,isCanceled:s,isGracefullyCanceled:o,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:x,killSignal:_,maxBuffer:A,timeout:f,cwd:S}),v=gp(e,z,P);return Object.assign(v,Jb({error:v,command:t,escapedCommand:r,startTime:i,timedOut:n,isCanceled:s,isGracefullyCanceled:o,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:D,signalDescription:O,stdio:u,all:l,ipcOutput:m,cwd:S,originalMessage:I,shortMessage:F})),v},Jb=({error:e,command:t,escapedCommand:r,startTime:i,timedOut:n,isCanceled:s,isGracefullyCanceled:o,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:d,signal:p,signalDescription:u,stdio:l,all:m,ipcOutput:h,cwd:f,originalMessage:x,shortMessage:_})=>Vd({shortMessage:_,originalMessage:x,command:t,escapedCommand:r,cwd:f,durationMs:ms(i),failed:!0,timedOut:n,isCanceled:s,isGracefullyCanceled:o,isTerminated:p!==void 0,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:d,signal:p,signalDescription:u,code:e.cause?.code,stdout:l[1],stderr:l[2],all:m,stdio:l,ipcOutput:h,pipedFrom:[]}),Vd=e=>Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0)),Xb=(e,t)=>{let r=e===null?void 0:e,i=t===null?void 0:t,n=i===void 0?void 0:ai(t);return{exitCode:r,signal:i,signalDescription:n}};var Wd=e=>Number.isFinite(e)?e:0;function Qb(e){return{days:Math.trunc(e/864e5),hours:Math.trunc(e/36e5%24),minutes:Math.trunc(e/6e4%60),seconds:Math.trunc(e/1e3%60),milliseconds:Math.trunc(e%1e3),microseconds:Math.trunc(Wd(e*1e3)%1e3),nanoseconds:Math.trunc(Wd(e*1e6)%1e3)}}function Zb(e){return{days:e/86400000n,hours:e/3600000n%24n,minutes:e/60000n%60n,seconds:e/1000n%60n,milliseconds:e%1000n,microseconds:0n,nanoseconds:0n}}function Fs(e){switch(typeof e){case"number":{if(Number.isFinite(e))return Qb(e);break}case"bigint":return Zb(e)}throw new TypeError("Expected a finite number or bigint")}var ex=e=>e===0||e===0n,tx=(e,t)=>t===1||t===1n?e:`${e}s`,rx=1e-7,ix=24n*60n*60n*1000n;function Bs(e,t){let r=typeof e=="bigint";if(!r&&!Number.isFinite(e))throw new TypeError("Expected a finite number or bigint");t={...t};let i=e<0?"-":"";e=e<0?-e:e,t.colonNotation&&(t.compact=!1,t.formatSubMilliseconds=!1,t.separateMilliseconds=!1,t.verbose=!1),t.compact&&(t.unitCount=1,t.secondsDecimalDigits=0,t.millisecondsDecimalDigits=0);let n=[],s=(p,u)=>{let l=Math.floor(p*10**u+rx);return(Math.round(l)/10**u).toFixed(u)},o=(p,u,l,m)=>{if(!((n.length===0||!t.colonNotation)&&ex(p)&&!(t.colonNotation&&l==="m"))){if(m??=String(p),t.colonNotation){let h=m.includes(".")?m.split(".")[0].length:m.length,f=n.length>0?2:1;m="0".repeat(Math.max(0,f-h))+m}else m+=t.verbose?" "+tx(u,p):l;n.push(m)}},a=Fs(e),c=BigInt(a.days);if(t.hideYearAndDays?o(BigInt(c)*24n+BigInt(a.hours),"hour","h"):(t.hideYear?o(c,"day","d"):(o(c/365n,"year","y"),o(c%365n,"day","d")),o(Number(a.hours),"hour","h")),o(Number(a.minutes),"minute","m"),!t.hideSeconds)if(t.separateMilliseconds||t.formatSubMilliseconds||!t.colonNotation&&e<1e3&&!t.subSecondsAsDecimals){let p=Number(a.seconds),u=Number(a.milliseconds),l=Number(a.microseconds),m=Number(a.nanoseconds);if(o(p,"second","s"),t.formatSubMilliseconds)o(u,"millisecond","ms"),o(l,"microsecond","\xB5s"),o(m,"nanosecond","ns");else{let h=u+l/1e3+m/1e6,f=typeof t.millisecondsDecimalDigits=="number"?t.millisecondsDecimalDigits:0,x=h>=1?Math.round(h):Math.ceil(h),_=f?h.toFixed(f):x;o(Number.parseFloat(_),"millisecond","ms",_)}}else{let p=(r?Number(e%ix):e)/1e3%60,u=typeof t.secondsDecimalDigits=="number"?t.secondsDecimalDigits:1,l=s(p,u),m=t.keepDecimalsOnWholeSeconds?l:l.replace(/\.0+$/,"");o(Number.parseFloat(m),"second","s",m)}if(n.length===0)return i+"0"+(t.verbose?" milliseconds":"ms");let d=t.colonNotation?":":" ";return typeof t.unitCount=="number"&&(n=n.slice(0,Math.max(t.unitCount,1))),i+n.join(d)}var Hd=(e,t)=>{e.failed&&Ae({type:"error",verboseMessage:e.shortMessage,verboseInfo:t,result:e})};var Kd=(e,t)=>{St(t)&&(Hd(e,t),nx(e,t))},nx=(e,t)=>{let r=`(done in ${Bs(e.durationMs)})`;Ae({type:"duration",verboseMessage:r,verboseInfo:t,result:e})};var Rt=(e,t,{reject:r})=>{if(Kd(e,t),e.failed&&r)throw e;return e};import{readFileSync as wu}from"fs";var Xd=(e,t)=>lt(e)?"asyncGenerator":eu(e)?"generator":Ii(e)?"fileUrl":px(e)?"filePath":lx(e)?"webStream":xe(e,{checkOpen:!1})?"native":J(e)?"uint8Array":mx(e)?"asyncIterable":hx(e)?"iterable":Gs(e)?Qd({transform:e},t):cx(e)?sx(e,t):"native",sx=(e,t)=>js(e.transform,{checkOpen:!1})?ox(e,t):Gs(e.transform)?Qd(e,t):ax(e,t),ox=(e,t)=>(Zd(e,t,"Duplex stream"),"duplex"),Qd=(e,t)=>(Zd(e,t,"web TransformStream"),"webTransform"),Zd=({final:e,binary:t,objectMode:r},i,n)=>{Yd(e,`${i}.final`,n),Yd(t,`${i}.binary`,n),Us(r,`${i}.objectMode`)},Yd=(e,t,r)=>{if(e!==void 0)throw new TypeError(`The \`${t}\` option can only be defined when using a generator, not a ${r}.`)},ax=({transform:e,final:t,binary:r,objectMode:i},n)=>{if(e!==void 0&&!Jd(e))throw new TypeError(`The \`${n}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(js(t,{checkOpen:!1}))throw new TypeError(`The \`${n}.final\` option must not be a Duplex stream.`);if(Gs(t))throw new TypeError(`The \`${n}.final\` option must not be a web TransformStream.`);if(t!==void 0&&!Jd(t))throw new TypeError(`The \`${n}.final\` option must be a generator.`);return Us(r,`${n}.binary`),Us(i,`${n}.objectMode`),lt(e)||lt(t)?"asyncGenerator":"generator"},Us=(e,t)=>{if(e!==void 0&&typeof e!="boolean")throw new TypeError(`The \`${t}\` option must use a boolean.`)},Jd=e=>lt(e)||eu(e),lt=e=>Object.prototype.toString.call(e)==="[object AsyncGeneratorFunction]",eu=e=>Object.prototype.toString.call(e)==="[object GeneratorFunction]",cx=e=>V(e)&&(e.transform!==void 0||e.final!==void 0),Ii=e=>Object.prototype.toString.call(e)==="[object URL]",tu=e=>Ii(e)&&e.protocol!=="file:",px=e=>V(e)&&Object.keys(e).length>0&&Object.keys(e).every(t=>dx.has(t))&&Ns(e.file),dx=new Set(["file","append"]),Ns=e=>typeof e=="string",ru=(e,t)=>e==="native"&&typeof t=="string"&&!ux.has(t),ux=new Set(["ipc","ignore","inherit","overlapped","pipe"]),iu=e=>Object.prototype.toString.call(e)==="[object ReadableStream]",Ri=e=>Object.prototype.toString.call(e)==="[object WritableStream]",lx=e=>iu(e)||Ri(e),Gs=e=>iu(e?.readable)&&Ri(e?.writable),mx=e=>nu(e)&&typeof e[Symbol.asyncIterator]=="function",hx=e=>nu(e)&&typeof e[Symbol.iterator]=="function",nu=e=>typeof e=="object"&&e!==null,ye=new Set(["generator","asyncGenerator","duplex","webTransform"]),ji=new Set(["fileUrl","filePath","fileNumber"]),zs=new Set(["fileUrl","filePath"]),su=new Set([...zs,"webStream","nodeStream"]),ou=new Set(["webTransform","duplex"]),Qe={generator:"a generator",asyncGenerator:"an async generator",fileUrl:"a file URL",filePath:"a file path string",fileNumber:"a file descriptor number",webStream:"a web stream",nodeStream:"a Node.js stream",webTransform:"a web TransformStream",duplex:"a Duplex stream",native:"any value",iterable:"an iterable",asyncIterable:"an async iterable",string:"a string",uint8Array:"a Uint8Array"};var Vs=(e,t,r,i)=>i==="output"?yx(e,t,r):fx(e,t,r),yx=(e,t,r)=>{let i=t!==0&&r[t-1].value.readableObjectMode;return{writableObjectMode:i,readableObjectMode:e??i}},fx=(e,t,r)=>{let i=t===0?e===!0:r[t-1].value.readableObjectMode,n=t!==r.length-1&&(e??i);return{writableObjectMode:i,readableObjectMode:n}},au=(e,t)=>{let r=e.findLast(({type:i})=>ye.has(i));return r===void 0?!1:t==="input"?r.value.writableObjectMode:r.value.readableObjectMode};var cu=(e,t,r,i)=>[...e.filter(({type:n})=>!ye.has(n)),...gx(e,t,r,i)],gx=(e,t,r,{encoding:i})=>{let n=e.filter(({type:o})=>ye.has(o)),s=Array.from({length:n.length});for(let[o,a]of Object.entries(n))s[o]=_x({stdioItem:a,index:Number(o),newTransforms:s,optionName:t,direction:r,encoding:i});return kx(s,r)},_x=({stdioItem:e,stdioItem:{type:t},index:r,newTransforms:i,optionName:n,direction:s,encoding:o})=>t==="duplex"?bx({stdioItem:e,optionName:n}):t==="webTransform"?xx({stdioItem:e,index:r,newTransforms:i,direction:s}):wx({stdioItem:e,index:r,newTransforms:i,direction:s,encoding:o}),bx=({stdioItem:e,stdioItem:{value:{transform:t,transform:{writableObjectMode:r,readableObjectMode:i},objectMode:n=i}},optionName:s})=>{if(n&&!i)throw new TypeError(`The \`${s}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!n&&i)throw new TypeError(`The \`${s}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{...e,value:{transform:t,writableObjectMode:r,readableObjectMode:i}}},xx=({stdioItem:e,stdioItem:{value:t},index:r,newTransforms:i,direction:n})=>{let{transform:s,objectMode:o}=V(t)?t:{transform:t},{writableObjectMode:a,readableObjectMode:c}=Vs(o,r,i,n);return{...e,value:{transform:s,writableObjectMode:a,readableObjectMode:c}}},wx=({stdioItem:e,stdioItem:{value:t},index:r,newTransforms:i,direction:n,encoding:s})=>{let{transform:o,final:a,binary:c=!1,preserveNewlines:d=!1,objectMode:p}=V(t)?t:{transform:t},u=c||ae.has(s),{writableObjectMode:l,readableObjectMode:m}=Vs(p,r,i,n);return{...e,value:{transform:o,final:a,binary:u,preserveNewlines:d,writableObjectMode:l,readableObjectMode:m}}},kx=(e,t)=>t==="input"?e.reverse():e;import Ws from"process";var pu=(e,t,r)=>{let i=e.map(n=>vx(n,t));if(i.includes("input")&&i.includes("output"))throw new TypeError(`The \`${r}\` option must not be an array of both readable and writable values.`);return i.find(Boolean)??$x},vx=({type:e,value:t},r)=>Sx[r]??du[e](t),Sx=["input","output","output"],jt=()=>{},Hs=()=>"input",du={generator:jt,asyncGenerator:jt,fileUrl:jt,filePath:jt,iterable:Hs,asyncIterable:Hs,uint8Array:Hs,webStream:e=>Ri(e)?"output":"input",nodeStream(e){return ut(e,{checkOpen:!1})?Rs(e,{checkOpen:!1})?void 0:"input":"output"},webTransform:jt,duplex:jt,native(e){let t=qx(e);if(t!==void 0)return t;if(xe(e,{checkOpen:!1}))return du.nodeStream(e)}},qx=e=>{if([0,Ws.stdin].includes(e))return"input";if([1,2,Ws.stdout,Ws.stderr].includes(e))return"output"},$x="output";var uu=(e,t)=>t&&!e.includes("ipc")?[...e,"ipc"]:e;var lu=({stdio:e,ipc:t,buffer:r,...i},n,s)=>{let o=Ax(e,i).map((a,c)=>mu(a,c));return s?Ex(o,r,n):uu(o,t)},Ax=(e,t)=>{if(e===void 0)return he.map(i=>t[i]);if(Cx(t))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${he.map(i=>`\`${i}\``).join(", ")}`);if(typeof e=="string")return[e,e,e];if(!Array.isArray(e))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof e}\``);let r=Math.max(e.length,he.length);return Array.from({length:r},(i,n)=>e[n])},Cx=e=>he.some(t=>e[t]!==void 0),mu=(e,t)=>Array.isArray(e)?e.map(r=>mu(r,t)):e??(t>=he.length?"ignore":"pipe"),Ex=(e,t,r)=>e.map((i,n)=>!t[n]&&n!==0&&!qt(r,n)&&Px(i)?"ignore":i),Px=e=>e==="pipe"||Array.isArray(e)&&e.every(t=>t==="pipe");import{readFileSync as Tx}from"fs";import Ox from"tty";var yu=({stdioItem:e,stdioItem:{type:t},isStdioArray:r,fdNumber:i,direction:n,isSync:s})=>!r||t!=="native"?e:s?Ix({stdioItem:e,fdNumber:i,direction:n}):Dx({stdioItem:e,fdNumber:i}),Ix=({stdioItem:e,stdioItem:{value:t,optionName:r},fdNumber:i,direction:n})=>{let s=Rx({value:t,optionName:r,fdNumber:i,direction:n});if(s!==void 0)return s;if(xe(t,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return e},Rx=({value:e,optionName:t,fdNumber:r,direction:i})=>{let n=jx(e,r);if(n!==void 0){if(i==="output")return{type:"fileNumber",value:n,optionName:t};if(Ox.isatty(n))throw new TypeError(`The \`${t}: ${di(e)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:Be(Tx(n)),optionName:t}}},jx=(e,t)=>{if(e==="inherit")return t;if(typeof e=="number")return e;let r=Wr.indexOf(e);if(r!==-1)return r},Dx=({stdioItem:e,stdioItem:{value:t,optionName:r},fdNumber:i})=>t==="inherit"?{type:"nodeStream",value:hu(i,t,r),optionName:r}:typeof t=="number"?{type:"nodeStream",value:hu(t,t,r),optionName:r}:xe(t,{checkOpen:!1})?{type:"nodeStream",value:t,optionName:r}:e,hu=(e,t,r)=>{let i=Wr[e];if(i===void 0)throw new TypeError(`The \`${r}: ${t}\` option is invalid: no such standard stream.`);return i};var fu=({input:e,inputFile:t},r)=>r===0?[...Lx(e),...Fx(t)]:[],Lx=e=>e===void 0?[]:[{type:Mx(e),value:e,optionName:"input"}],Mx=e=>{if(ut(e,{checkOpen:!1}))return"nodeStream";if(typeof e=="string")return"string";if(J(e))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},Fx=e=>e===void 0?[]:[{...Bx(e),optionName:"inputFile"}],Bx=e=>{if(Ii(e))return{type:"fileUrl",value:e};if(Ns(e))return{type:"filePath",value:{file:e}};throw new Error("The `inputFile` option must be a file path string or a file URL.")};var gu=e=>e.filter((t,r)=>e.every((i,n)=>t.value!==i.value||r>=n||t.type==="generator"||t.type==="asyncGenerator")),_u=({stdioItem:{type:e,value:t,optionName:r},direction:i,fileDescriptors:n,isSync:s})=>{let o=Ux(n,e);if(o.length!==0){if(s){Nx({otherStdioItems:o,type:e,value:t,optionName:r,direction:i});return}if(su.has(e))return bu({otherStdioItems:o,type:e,value:t,optionName:r,direction:i});ou.has(e)&&zx({otherStdioItems:o,type:e,value:t,optionName:r})}},Ux=(e,t)=>e.flatMap(({direction:r,stdioItems:i})=>i.filter(n=>n.type===t).map((n=>({...n,direction:r})))),Nx=({otherStdioItems:e,type:t,value:r,optionName:i,direction:n})=>{zs.has(t)&&bu({otherStdioItems:e,type:t,value:r,optionName:i,direction:n})},bu=({otherStdioItems:e,type:t,value:r,optionName:i,direction:n})=>{let s=e.filter(a=>Gx(a,r));if(s.length===0)return;let o=s.find(a=>a.direction!==n);return xu(o,i,t),n==="output"?s[0].stream:void 0},Gx=({type:e,value:t},r)=>e==="filePath"?t.file===r.file:e==="fileUrl"?t.href===r.href:t===r,zx=({otherStdioItems:e,type:t,value:r,optionName:i})=>{let n=e.find(({value:{transform:s}})=>s===r.transform);xu(n,i,t)},xu=(e,t,r)=>{if(e!==void 0)throw new TypeError(`The \`${e.optionName}\` and \`${t}\` options must not target ${Qe[r]} that is the same.`)};var Di=(e,t,r,i)=>{let s=lu(t,r,i).map((a,c)=>Vx({stdioOption:a,fdNumber:c,options:t,isSync:i})),o=Zx({initialFileDescriptors:s,addProperties:e,options:t,isSync:i});return t.stdio=o.map(({stdioItems:a})=>rw(a)),o},Vx=({stdioOption:e,fdNumber:t,options:r,isSync:i})=>{let n=Hr(t),{stdioItems:s,isStdioArray:o}=Wx({stdioOption:e,fdNumber:t,options:r,optionName:n}),a=pu(s,t,n),c=s.map(u=>yu({stdioItem:u,isStdioArray:o,fdNumber:t,direction:a,isSync:i})),d=cu(c,n,a,r),p=au(d,a);return Qx(d,p),{direction:a,objectMode:p,stdioItems:d}},Wx=({stdioOption:e,fdNumber:t,options:r,optionName:i})=>{let s=[...(Array.isArray(e)?e:[e]).map(c=>Hx(c,i)),...fu(r,t)],o=gu(s),a=o.length>1;return Kx(o,a,i),Jx(o),{stdioItems:o,isStdioArray:a}},Hx=(e,t)=>({type:Xd(e,t),value:e,optionName:t}),Kx=(e,t,r)=>{if(e.length===0)throw new TypeError(`The \`${r}\` option must not be an empty array.`);if(t){for(let{value:i,optionName:n}of e)if(Yx.has(i))throw new Error(`The \`${n}\` option must not include \`${i}\`.`)}},Yx=new Set(["ignore","ipc"]),Jx=e=>{for(let t of e)Xx(t)},Xx=({type:e,value:t,optionName:r})=>{if(tu(t))throw new TypeError(`The \`${r}: URL\` option must use the \`file:\` scheme.
136
+ For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(ru(e,t))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},Qx=(e,t)=>{if(!t)return;let r=e.find(({type:i})=>ji.has(i));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},Zx=({initialFileDescriptors:e,addProperties:t,options:r,isSync:i})=>{let n=[];try{for(let s of e)n.push(ew({fileDescriptor:s,fileDescriptors:n,addProperties:t,options:r,isSync:i}));return n}catch(s){throw Ks(n),s}},ew=({fileDescriptor:{direction:e,objectMode:t,stdioItems:r},fileDescriptors:i,addProperties:n,options:s,isSync:o})=>{let a=r.map(c=>tw({stdioItem:c,addProperties:n,direction:e,options:s,fileDescriptors:i,isSync:o}));return{direction:e,objectMode:t,stdioItems:a}},tw=({stdioItem:e,addProperties:t,direction:r,options:i,fileDescriptors:n,isSync:s})=>{let o=_u({stdioItem:e,direction:r,fileDescriptors:n,isSync:s});return o!==void 0?{...e,stream:o}:{...e,...t[r][e.type](e,i)}},Ks=e=>{for(let{stdioItems:t}of e)for(let{stream:r}of t)r!==void 0&&!ge(r)&&r.destroy()},rw=e=>{if(e.length>1)return e.some(({value:i})=>i==="overlapped")?"overlapped":"pipe";let[{type:t,value:r}]=e;return t==="native"?r:"pipe"};var vu=(e,t)=>Di(nw,e,t,!0),Te=({type:e,optionName:t})=>{Su(t,Qe[e])},iw=({optionName:e,value:t})=>((t==="ipc"||t==="overlapped")&&Su(e,`"${t}"`),{}),Su=(e,t)=>{throw new TypeError(`The \`${e}\` option cannot be ${t} with synchronous methods.`)},ku={generator(){},asyncGenerator:Te,webStream:Te,nodeStream:Te,webTransform:Te,duplex:Te,asyncIterable:Te,native:iw},nw={input:{...ku,fileUrl:({value:e})=>({contents:[Be(wu(e))]}),filePath:({value:{file:e}})=>({contents:[Be(wu(e))]}),fileNumber:Te,iterable:({value:e})=>({contents:[...e]}),string:({value:e})=>({contents:[e]}),uint8Array:({value:e})=>({contents:[e]})},output:{...ku,fileUrl:({value:e})=>({path:e}),filePath:({value:{file:e,append:t}})=>({path:e,append:t}),fileNumber:({value:e})=>({path:e}),iterable:Te,string:Te,uint8Array:Te}};var Ge=(e,{stripFinalNewline:t},r)=>Ys(t,r)&&e!==void 0&&!Array.isArray(e)?Tt(e):e,Ys=(e,t)=>t==="all"?e[1]||e[2]:e[t];import{Transform as qw,getDefaultHighWaterMark as ju}from"stream";var Li=(e,t,r,i)=>e||r?void 0:$u(t,i),Xs=(e,t,r)=>r?e.flatMap(i=>qu(i,t)):qu(e,t),qu=(e,t)=>{let{transform:r,final:i}=$u(t,{});return[...r(e),...i()]},$u=(e,t)=>(t.previousChunks="",{transform:sw.bind(void 0,t,e),final:aw.bind(void 0,t)}),sw=function*(e,t,r){if(typeof r!="string"){yield r;return}let{previousChunks:i}=e,n=-1;for(let s=0;s<r.length;s+=1)if(r[s]===`
137
+ `){let o=ow(r,s,t,e),a=r.slice(n+1,s+1-o);i.length>0&&(a=Js(i,a),i=""),yield a,n=s}n!==r.length-1&&(i=Js(i,r.slice(n+1))),e.previousChunks=i},ow=(e,t,r,i)=>r?0:(i.isWindowsNewline=t!==0&&e[t-1]==="\r",i.isWindowsNewline?2:1),aw=function*({previousChunks:e}){e.length>0&&(yield e)},Au=({binary:e,preserveNewlines:t,readableObjectMode:r,state:i})=>e||t||r?void 0:{transform:cw.bind(void 0,i)},cw=function*({isWindowsNewline:e=!1},t){let{unixNewline:r,windowsNewline:i,LF:n,concatBytes:s}=typeof t=="string"?pw:uw;if(t.at(-1)===n){yield t;return}yield s(t,e?i:r)},Js=(e,t)=>`${e}${t}`,pw={windowsNewline:`\r
71
138
  `,unixNewline:`
72
139
  `,LF:`
73
- `,concatBytes:Ds},kx=(e,t)=>{let r=new Uint8Array(e.length+t.length);return r.set(e,0),r.set(t,e.length),r},vx={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:kx};import{Buffer as qx}from"buffer";var ru=(e,t)=>e?void 0:Sx.bind(void 0,t),Sx=function*(e,t){if(typeof t!="string"&&!K(t)&&!qx.isBuffer(t))throw new TypeError(`The \`${e}\` option's transform must use "objectMode: true" to receive as input: ${typeof t}.`);yield t},iu=(e,t)=>e?$x.bind(void 0,t):Ax.bind(void 0,t),$x=function*(e,t){nu(e,t),yield t},Ax=function*(e,t){if(nu(e,t),typeof t!="string"&&!K(t))throw new TypeError(`The \`${e}\` option's function must yield a string or an Uint8Array, not ${typeof t}.`);yield t},nu=(e,t)=>{if(t==null)throw new TypeError(`The \`${e}\` option's function must not call \`yield ${t}\`.
140
+ `,concatBytes:Js},dw=(e,t)=>{let r=new Uint8Array(e.length+t.length);return r.set(e,0),r.set(t,e.length),r},uw={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:dw};import{Buffer as lw}from"buffer";var Cu=(e,t)=>e?void 0:mw.bind(void 0,t),mw=function*(e,t){if(typeof t!="string"&&!J(t)&&!lw.isBuffer(t))throw new TypeError(`The \`${e}\` option's transform must use "objectMode: true" to receive as input: ${typeof t}.`);yield t},Eu=(e,t)=>e?hw.bind(void 0,t):yw.bind(void 0,t),hw=function*(e,t){Pu(e,t),yield t},yw=function*(e,t){if(Pu(e,t),typeof t!="string"&&!J(t))throw new TypeError(`The \`${e}\` option's function must yield a string or an Uint8Array, not ${typeof t}.`);yield t},Pu=(e,t)=>{if(t==null)throw new TypeError(`The \`${e}\` option's function must not call \`yield ${t}\`.
74
141
  Instead, \`yield\` should either be called with a value, or not be called at all. For example:
75
- if (condition) { yield value; }`)};import{Buffer as Cx}from"buffer";import{StringDecoder as Ex}from"string_decoder";var vi=(e,t,r)=>{if(r)return;if(e)return{transform:Px.bind(void 0,new TextEncoder)};let i=new Ex(t);return{transform:Tx.bind(void 0,i),final:Ox.bind(void 0,i)}},Px=function*(e,t){Cx.isBuffer(t)?yield Me(t):typeof t=="string"?yield e.encode(t):yield t},Tx=function*(e,t){yield K(t)?e.write(t):t},Ox=function*(e){let t=e.end();t!==""&&(yield t)};import{callbackify as su}from"util";var Ms=su(async(e,t,r,i)=>{t.currentIterable=e(...r);try{for await(let n of t.currentIterable)i.push(n)}finally{delete t.currentIterable}}),qi=async function*(e,t,r){if(r===t.length){yield e;return}let{transform:i=Rx}=t[r];for await(let n of i(e))yield*qi(n,t,r+1)},ou=async function*(e){for(let[t,{final:r}]of Object.entries(e))yield*Ix(r,Number(t),e)},Ix=async function*(e,t,r){if(e!==void 0)for await(let i of e())yield*qi(i,r,t+1)},au=su(async({currentIterable:e},t)=>{if(e!==void 0){await(t?e.throw(t):e.return());return}if(t)throw t}),Rx=function*(e){yield e};var Fs=(e,t,r,i)=>{try{for(let n of e(...t))r.push(n);i()}catch(n){i(n)}},cu=(e,t)=>[...t.flatMap(r=>[...dt(r,e,0)]),...ir(e)],dt=function*(e,t,r){if(r===t.length){yield e;return}let{transform:i=Dx}=t[r];for(let n of i(e))yield*dt(n,t,r+1)},ir=function*(e){for(let[t,{final:r}]of Object.entries(e))yield*jx(r,Number(t),e)},jx=function*(e,t,r){if(e!==void 0)for(let i of e())yield*dt(i,r,t+1)},Dx=function*(e){yield e};var Bs=({value:e,value:{transform:t,final:r,writableObjectMode:i,readableObjectMode:n},optionName:s},{encoding:o})=>{let a={},c=du(e,o,s),d=pt(t),p=pt(r),u=d?Ms.bind(void 0,qi,a):Fs.bind(void 0,dt),l=d||p?Ms.bind(void 0,ou,a):Fs.bind(void 0,ir),m=d||p?au.bind(void 0,a):void 0;return{stream:new Lx({writableObjectMode:i,writableHighWaterMark:pu(i),readableObjectMode:n,readableHighWaterMark:pu(n),transform(f,x,_){u([f,c,0],this,_)},flush(f){l([c],this,f)},destroy:m})}},Si=(e,t,r,i)=>{let n=t.filter(({type:o})=>o==="generator"),s=i?n.reverse():n;for(let{value:o,optionName:a}of s){let c=du(o,r,a);e=cu(c,e)}return e},du=({transform:e,final:t,binary:r,writableObjectMode:i,readableObjectMode:n,preserveNewlines:s},o,a)=>{let c={};return[{transform:ru(i,a)},vi(r,o,i),ki(r,s,i,c),{transform:e,final:t},{transform:iu(n,a)},tu({binary:r,preserveNewlines:s,readableObjectMode:n,state:c})].filter(Boolean)};var uu=(e,t)=>{for(let r of Mx(e))Fx(e,r,t)},Mx=e=>new Set(Object.entries(e).filter(([,{direction:t}])=>t==="input").map(([t])=>Number(t))),Fx=(e,t,r)=>{let{stdioItems:i}=e[t],n=i.filter(({contents:a})=>a!==void 0);if(n.length===0)return;if(t!==0){let[{type:a,optionName:c}]=n;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${Ye[a]} with synchronous methods.`)}let o=n.map(({contents:a})=>a).map(a=>Bx(a,i));r.input=Ht(o)},Bx=(e,t)=>{let r=Si(e,t,"utf8",!0);return Ux(r),Ht(r)},Ux=e=>{let t=e.find(r=>typeof r!="string"&&!K(r));if(t!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${t}.`)};import{writeFileSync as Vx,appendFileSync as Wx}from"fs";var $i=({stdioItems:e,encoding:t,verboseInfo:r,fdNumber:i})=>i!=="all"&&vt(r,i)&&!ae.has(t)&&Nx(i)&&(e.some(({type:n,value:s})=>n==="native"&&Gx.has(s))||e.every(({type:n})=>me.has(n))),Nx=e=>e===1||e===2,Gx=new Set(["pipe","overlapped"]),lu=async(e,t,r,i)=>{for await(let n of e)zx(t)||hu(n,r,i)},mu=(e,t,r)=>{for(let i of e)hu(i,t,r)},zx=e=>e._readableState.pipes.length>0,hu=(e,t,r)=>{let i=Mr(e);qe({type:"output",verboseMessage:i,fdNumber:t,verboseInfo:r})};var yu=({fileDescriptors:e,syncResult:{output:t},options:r,isMaxBuffer:i,verboseInfo:n})=>{if(t===null)return{output:Array.from({length:3})};let s={},o=new Set([]);return{output:t.map((c,d)=>Hx({result:c,fileDescriptors:e,fdNumber:d,state:s,outputFiles:o,isMaxBuffer:i,verboseInfo:n},r)),...s}},Hx=({result:e,fileDescriptors:t,fdNumber:r,state:i,outputFiles:n,isMaxBuffer:s,verboseInfo:o},{buffer:a,encoding:c,lines:d,stripFinalNewline:p,maxBuffer:u})=>{if(e===null)return;let l=fd(e,s,u),m=Me(l),{stdioItems:h,objectMode:f}=t[r],x=Kx([m],h,c,i),{serializedResult:_,finalResult:q=_}=Yx({chunks:x,objectMode:f,encoding:c,lines:d,stripFinalNewline:p,fdNumber:r});Jx({serializedResult:_,fdNumber:r,state:i,verboseInfo:o,encoding:c,stdioItems:h,objectMode:f});let A=a[r]?q:void 0;try{return i.error===void 0&&Xx(_,h,n),A}catch(E){return i.error=E,A}},Kx=(e,t,r,i)=>{try{return Si(e,t,r,!1)}catch(n){return i.error=n,e}},Yx=({chunks:e,objectMode:t,encoding:r,lines:i,stripFinalNewline:n,fdNumber:s})=>{if(t)return{serializedResult:e};if(r==="buffer")return{serializedResult:Ht(e)};let o=Pa(e,r);return i[s]?{serializedResult:o,finalResult:Ls(o,!n[s],t)}:{serializedResult:o}},Jx=({serializedResult:e,fdNumber:t,state:r,verboseInfo:i,encoding:n,stdioItems:s,objectMode:o})=>{if(!$i({stdioItems:s,encoding:n,verboseInfo:i,fdNumber:t}))return;let a=Ls(e,!1,o);try{mu(a,t,i)}catch(c){r.error??=c}},Xx=(e,t,r)=>{for(let{path:i,append:n}of t.filter(({type:s})=>xi.has(s))){let s=typeof i=="string"?i:i.toString();n||r.has(s)?Wx(i,e):(r.add(s),Vx(i,e))}};var fu=([,e,t],r)=>{if(r.all)return e===void 0?t:t===void 0?e:Array.isArray(e)?Array.isArray(t)?[...e,...t]:[...e,Ue(t,r,"all")]:Array.isArray(t)?[Ue(e,r,"all"),...t]:K(e)&&K(t)?Wn([e,t]):`${e}${t}`};import{once as Us}from"events";var gu=async(e,t)=>{let[r,i]=await Qx(e);return t.isForcefullyTerminated??=!1,[r,i]},Qx=async e=>{let[t,r]=await Promise.allSettled([Us(e,"spawn"),Us(e,"exit")]);return t.status==="rejected"?[]:r.status==="rejected"?_u(e):r.value},_u=async e=>{try{return await Us(e,"exit")}catch{return _u(e)}},bu=async e=>{let[t,r]=await e;if(!Zx(t,r)&&Ns(t,r))throw new _e;return[t,r]},Zx=(e,t)=>e===void 0&&t===void 0,Ns=(e,t)=>e!==0||t!==null;var xu=({error:e,status:t,signal:r,output:i},{maxBuffer:n})=>{let s=ew(e,t,r),o=s?.code==="ETIMEDOUT",a=yd(s,i,n);return{resultError:s,exitCode:t,signal:r,timedOut:o,isMaxBuffer:a}},ew=(e,t,r)=>e!==void 0?e:Ns(t,r)?new _e:void 0;var wu=(e,t,r)=>{let{file:i,commandArguments:n,command:s,escapedCommand:o,startTime:a,verboseInfo:c,options:d,fileDescriptors:p}=rw(e,t,r),u=sw({file:i,commandArguments:n,options:d,command:s,escapedCommand:o,verboseInfo:c,fileDescriptors:p,startTime:a});return Ot(u,c,d)},rw=(e,t,r)=>{let{command:i,escapedCommand:n,startTime:s,verboseInfo:o}=Br(e,t,r),a=iw(r),{file:c,commandArguments:d,options:p}=ai(e,t,a);nw(p);let u=Xd(p,o);return{file:c,commandArguments:d,command:i,escapedCommand:n,startTime:s,verboseInfo:o,options:p,fileDescriptors:u}},iw=e=>e.node&&!e.ipc?{...e,ipc:!1}:e,nw=({ipc:e,ipcInput:t,detached:r,cancelSignal:i})=>{t&&Ai("ipcInput"),e&&Ai("ipc: true"),r&&Ai("detached: true"),i&&Ai("cancelSignal")},Ai=e=>{throw new TypeError(`The "${e}" option cannot be used with synchronous methods.`)},sw=({file:e,commandArguments:t,options:r,command:i,escapedCommand:n,verboseInfo:s,fileDescriptors:o,startTime:a})=>{let c=ow({file:e,commandArguments:t,options:r,command:i,escapedCommand:n,fileDescriptors:o,startTime:a});if(c.failed)return c;let{resultError:d,exitCode:p,signal:u,timedOut:l,isMaxBuffer:m}=xu(c,r),{output:h,error:f=d}=yu({fileDescriptors:o,syncResult:c,options:r,isMaxBuffer:m,verboseInfo:s}),x=h.map((q,A)=>Ue(q,r,A)),_=Ue(fu(h,r),r,"all");return cw({error:f,exitCode:p,signal:u,timedOut:l,isMaxBuffer:m,stdio:x,all:_,options:r,command:i,escapedCommand:n,startTime:a})},ow=({file:e,commandArguments:t,options:r,command:i,escapedCommand:n,fileDescriptors:s,startTime:o})=>{try{uu(s,r);let a=aw(r);return tw(...ci(e,t,a))}catch(a){return Tt({error:a,command:i,escapedCommand:n,fileDescriptors:s,options:r,startTime:o,isSync:!0})}},aw=({encoding:e,maxBuffer:t,...r})=>({...r,encoding:"buffer",maxBuffer:fi(t)}),cw=({error:e,exitCode:t,signal:r,timedOut:i,isMaxBuffer:n,stdio:s,all:o,options:a,command:c,escapedCommand:d,startTime:p})=>e===void 0?gi({command:c,escapedCommand:d,stdio:s,all:o,ipcOutput:[],options:a,startTime:p}):rr({error:e,command:c,escapedCommand:d,timedOut:i,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:n,isForcefullyTerminated:!1,exitCode:t,signal:r,stdio:s,all:o,ipcOutput:[],options:a,startTime:p,isSync:!0});import{setMaxListeners as Y0}from"events";import{spawn as J0}from"child_process";import $u from"process";import{once as Gs,on as pw}from"events";var ku=({anyProcess:e,channel:t,isSubprocess:r,ipc:i},{reference:n=!0,filter:s}={})=>($t({methodName:"getOneMessage",isSubprocess:r,ipc:i,isConnected:ti(e)}),dw({anyProcess:e,channel:t,isSubprocess:r,filter:s,reference:n})),dw=async({anyProcess:e,channel:t,isSubprocess:r,filter:i,reference:n})=>{Xr(t,n);let s=Ke(e,t,r),o=new AbortController;try{return await Promise.race([uw(s,i,o),lw(s,r,o),mw(s,r,o)])}catch(a){throw At(e),a}finally{o.abort(),Qr(t,n)}},uw=async(e,t,{signal:r})=>{if(t===void 0){let[i]=await Gs(e,"message",{signal:r});return i}for await(let[i]of pw(e,"message",{signal:r}))if(t(i))return i},lw=async(e,t,{signal:r})=>{await Gs(e,"disconnect",{signal:r}),cp(t)},mw=async(e,t,{signal:r})=>{let[i]=await Gs(e,"strict:error",{signal:r});throw Kr(i,t)};import{once as qu,on as hw}from"events";var Su=({anyProcess:e,channel:t,isSubprocess:r,ipc:i},{reference:n=!0}={})=>zs({anyProcess:e,channel:t,isSubprocess:r,ipc:i,shouldAwait:!r,reference:n}),zs=({anyProcess:e,channel:t,isSubprocess:r,ipc:i,shouldAwait:n,reference:s})=>{$t({methodName:"getEachMessage",isSubprocess:r,ipc:i,isConnected:ti(e)}),Xr(t,s);let o=Ke(e,t,r),a=new AbortController,c={};return yw(e,o,a),fw({ipcEmitter:o,isSubprocess:r,controller:a,state:c}),gw({anyProcess:e,channel:t,ipcEmitter:o,isSubprocess:r,shouldAwait:n,controller:a,state:c,reference:s})},yw=async(e,t,r)=>{try{await qu(t,"disconnect",{signal:r.signal}),r.abort()}catch{}},fw=async({ipcEmitter:e,isSubprocess:t,controller:r,state:i})=>{try{let[n]=await qu(e,"strict:error",{signal:r.signal});i.error=Kr(n,t),r.abort()}catch{}},gw=async function*({anyProcess:e,channel:t,ipcEmitter:r,isSubprocess:i,shouldAwait:n,controller:s,state:o,reference:a}){try{for await(let[c]of hw(r,"message",{signal:s.signal}))vu(o),yield c}catch{vu(o)}finally{s.abort(),Qr(t,a),i||At(e),n&&await e}},vu=({error:e})=>{if(e)throw e};var Au=(e,{ipc:t})=>{Object.assign(e,Eu(e,!1,t))},Cu=()=>{let e=$u,t=!0,r=$u.channel!==void 0;return{...Eu(e,t,r),getCancelSignal:jp.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r})}},Eu=(e,t,r)=>({sendMessage:si.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r}),getOneMessage:ku.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r}),getEachMessage:Su.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r})});import{ChildProcess as _w}from"child_process";import{PassThrough as bw,Readable as xw,Writable as ww,Duplex as kw}from"stream";var Pu=({error:e,command:t,escapedCommand:r,fileDescriptors:i,options:n,startTime:s,verboseInfo:o})=>{Rs(i);let a=new _w;vw(a,i),Object.assign(a,{readable:qw,writable:Sw,duplex:$w});let c=Tt({error:e,command:t,escapedCommand:r,fileDescriptors:i,options:n,startTime:s,isSync:!1}),d=Aw(c,o,n);return{subprocess:a,promise:d}},vw=(e,t)=>{let r=nr(),i=nr(),n=nr(),s=Array.from({length:t.length-3},nr),o=nr(),a=[r,i,n,...s];Object.assign(e,{stdin:r,stdout:i,stderr:n,all:o,stdio:a})},nr=()=>{let e=new bw;return e.end(),e},qw=()=>new xw({read(){}}),Sw=()=>new ww({write(){}}),$w=()=>new kw({read(){},write(){}}),Aw=async(e,t,r)=>Ot(e,t,r);import{createReadStream as Tu,createWriteStream as Ou}from"fs";import{Buffer as Cw}from"buffer";import{Readable as sr,Writable as Ew,Duplex as Pw}from"stream";var Ru=(e,t)=>wi(Tw,e,t,!1),or=({type:e,optionName:t})=>{throw new TypeError(`The \`${t}\` option cannot be ${Ye[e]}.`)},Iu={fileNumber:or,generator:Bs,asyncGenerator:Bs,nodeStream:({value:e})=>({stream:e}),webTransform({value:{transform:e,writableObjectMode:t,readableObjectMode:r}}){let i=t||r;return{stream:Pw.fromWeb(e,{objectMode:i})}},duplex:({value:{transform:e}})=>({stream:e}),native(){}},Tw={input:{...Iu,fileUrl:({value:e})=>({stream:Tu(e)}),filePath:({value:{file:e}})=>({stream:Tu(e)}),webStream:({value:e})=>({stream:sr.fromWeb(e)}),iterable:({value:e})=>({stream:sr.from(e)}),asyncIterable:({value:e})=>({stream:sr.from(e)}),string:({value:e})=>({stream:sr.from(e)}),uint8Array:({value:e})=>({stream:sr.from(Cw.from(e))})},output:{...Iu,fileUrl:({value:e})=>({stream:Ou(e)}),filePath:({value:{file:e,append:t}})=>({stream:Ou(e,t?{flags:"a"}:{})}),webStream:({value:e})=>({stream:Ew.fromWeb(e)}),iterable:or,asyncIterable:or,string:or,uint8Array:or}};import{on as Ow,once as ju}from"events";import{PassThrough as Iw,getDefaultHighWaterMark as Rw}from"stream";import{finished as Mu}from"stream/promises";function ut(e){if(!Array.isArray(e))throw new TypeError(`Expected an array, got \`${typeof e}\`.`);for(let n of e)Ws(n);let t=e.some(({readableObjectMode:n})=>n),r=jw(e,t),i=new Vs({objectMode:t,writableHighWaterMark:r,readableHighWaterMark:r});for(let n of e)i.add(n);return i}var jw=(e,t)=>{if(e.length===0)return Rw(t);let r=e.filter(({readableObjectMode:i})=>i===t).map(({readableHighWaterMark:i})=>i);return Math.max(...r)},Vs=class extends Iw{#t=new Set([]);#r=new Set([]);#e=new Set([]);#i;#s=Symbol("unpipe");#n=new WeakMap;add(t){if(Ws(t),this.#t.has(t))return;this.#t.add(t),this.#i??=Dw(this,this.#t,this.#s);let r=Fw({passThroughStream:this,stream:t,streams:this.#t,ended:this.#r,aborted:this.#e,onFinished:this.#i,unpipeEvent:this.#s});this.#n.set(t,r),t.pipe(this,{end:!1})}async remove(t){if(Ws(t),!this.#t.has(t))return!1;let r=this.#n.get(t);return r===void 0?!1:(this.#n.delete(t),t.unpipe(this),await r,!0)}},Dw=async(e,t,r)=>{Ci(e,Du);let i=new AbortController;try{await Promise.race([Lw(e,i),Mw(e,t,r,i)])}finally{i.abort(),Ci(e,-Du)}},Lw=async(e,{signal:t})=>{try{await Mu(e,{signal:t,cleanup:!0})}catch(r){throw Fu(e,r),r}},Mw=async(e,t,r,{signal:i})=>{for await(let[n]of Ow(e,"unpipe",{signal:i}))t.has(n)&&n.emit(r)},Ws=e=>{if(typeof e?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof e}\`.`)},Fw=async({passThroughStream:e,stream:t,streams:r,ended:i,aborted:n,onFinished:s,unpipeEvent:o})=>{Ci(e,Lu);let a=new AbortController;try{await Promise.race([Bw(s,t,a),Uw({passThroughStream:e,stream:t,streams:r,ended:i,aborted:n,controller:a}),Nw({stream:t,streams:r,ended:i,aborted:n,unpipeEvent:o,controller:a})])}finally{a.abort(),Ci(e,-Lu)}r.size>0&&r.size===i.size+n.size&&(i.size===0&&n.size>0?Hs(e):Gw(e))},Bw=async(e,t,{signal:r})=>{try{await e,r.aborted||Hs(t)}catch(i){r.aborted||Fu(t,i)}},Uw=async({passThroughStream:e,stream:t,streams:r,ended:i,aborted:n,controller:{signal:s}})=>{try{await Mu(t,{signal:s,cleanup:!0,readable:!0,writable:!1}),r.has(t)&&i.add(t)}catch(o){if(s.aborted||!r.has(t))return;Bu(o)?n.add(t):Uu(e,o)}},Nw=async({stream:e,streams:t,ended:r,aborted:i,unpipeEvent:n,controller:{signal:s}})=>{if(await ju(e,n,{signal:s}),!e.readable)return ju(s,"abort",{signal:s});t.delete(e),r.delete(e),i.delete(e)},Gw=e=>{e.writable&&e.end()},Fu=(e,t)=>{Bu(t)?Hs(e):Uu(e,t)},Bu=e=>e?.code==="ERR_STREAM_PREMATURE_CLOSE",Hs=e=>{(e.readable||e.writable)&&e.destroy()},Uu=(e,t)=>{e.destroyed||(e.once("error",zw),e.destroy(t))},zw=()=>{},Ci=(e,t)=>{let r=e.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&e.setMaxListeners(r+t)},Du=2,Lu=1;import{finished as Nu}from"stream/promises";var Rt=(e,t)=>{e.pipe(t),Vw(e,t),Ww(e,t)},Vw=async(e,t)=>{if(!(ge(e)||ge(t))){try{await Nu(e,{cleanup:!0,readable:!0,writable:!1})}catch{}Ks(t)}},Ks=e=>{e.writable&&e.end()},Ww=async(e,t)=>{if(!(ge(e)||ge(t))){try{await Nu(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Ys(e)}},Ys=e=>{e.readable&&e.destroy()};var Gu=(e,t,r)=>{let i=new Map;for(let[n,{stdioItems:s,direction:o}]of Object.entries(t)){for(let{stream:a}of s.filter(({type:c})=>me.has(c)))Hw(e,a,o,n);for(let{stream:a}of s.filter(({type:c})=>!me.has(c)))Yw({subprocess:e,stream:a,direction:o,fdNumber:n,pipeGroups:i,controller:r})}for(let[n,s]of i.entries()){let o=s.length===1?s[0]:ut(s);Rt(o,n)}},Hw=(e,t,r,i)=>{r==="output"?Rt(e.stdio[i],t):Rt(t,e.stdio[i]);let n=Kw[i];n!==void 0&&(e[n]=t),e.stdio[i]=t},Kw=["stdin","stdout","stderr"],Yw=({subprocess:e,stream:t,direction:r,fdNumber:i,pipeGroups:n,controller:s})=>{if(t===void 0)return;Jw(t,s);let[o,a]=r==="output"?[t,e.stdio[i]]:[e.stdio[i],t],c=n.get(o)??[];n.set(o,[...c,a])},Jw=(e,{signal:t})=>{ge(e)&&at(e,Xw,t)},Xw=2;import{addAbortListener as e0}from"events";var lt=[];lt.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&lt.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&lt.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var Ei=e=>!!e&&typeof e=="object"&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function",Js=Symbol.for("signal-exit emitter"),Xs=globalThis,Qw=Object.defineProperty.bind(Object),Qs=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(Xs[Js])return Xs[Js];Qw(Xs,Js,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(t,r){this.listeners[t].push(r)}removeListener(t,r){let i=this.listeners[t],n=i.indexOf(r);n!==-1&&(n===0&&i.length===1?i.length=0:i.splice(n,1))}emit(t,r,i){if(this.emitted[t])return!1;this.emitted[t]=!0;let n=!1;for(let s of this.listeners[t])n=s(r,i)===!0||n;return t==="exit"&&(n=this.emit("afterExit",r,i)||n),n}},Pi=class{},Zw=e=>({onExit(t,r){return e.onExit(t,r)},load(){return e.load()},unload(){return e.unload()}}),Zs=class extends Pi{onExit(){return()=>{}}load(){}unload(){}},eo=class extends Pi{#t=to.platform==="win32"?"SIGINT":"SIGHUP";#r=new Qs;#e;#i;#s;#n={};#o=!1;constructor(t){super(),this.#e=t,this.#n={};for(let r of lt)this.#n[r]=()=>{let i=this.#e.listeners(r),{count:n}=this.#r,s=t;if(typeof s.__signal_exit_emitter__=="object"&&typeof s.__signal_exit_emitter__.count=="number"&&(n+=s.__signal_exit_emitter__.count),i.length===n){this.unload();let o=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#t:r;o||t.kill(t.pid,a)}};this.#s=t.reallyExit,this.#i=t.emit}onExit(t,r){if(!Ei(this.#e))return()=>{};this.#o===!1&&this.load();let i=r?.alwaysLast?"afterExit":"exit";return this.#r.on(i,t),()=>{this.#r.removeListener(i,t),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#o){this.#o=!0,this.#r.count+=1;for(let t of lt)try{let r=this.#n[t];r&&this.#e.on(t,r)}catch{}this.#e.emit=(t,...r)=>this.#c(t,...r),this.#e.reallyExit=t=>this.#a(t)}}unload(){this.#o&&(this.#o=!1,lt.forEach(t=>{let r=this.#n[t];if(!r)throw new Error("Listener not defined for signal: "+t);try{this.#e.removeListener(t,r)}catch{}}),this.#e.emit=this.#i,this.#e.reallyExit=this.#s,this.#r.count-=1)}#a(t){return Ei(this.#e)?(this.#e.exitCode=t||0,this.#r.emit("exit",this.#e.exitCode,null),this.#s.call(this.#e,this.#e.exitCode)):0}#c(t,...r){let i=this.#i;if(t==="exit"&&Ei(this.#e)){typeof r[0]=="number"&&(this.#e.exitCode=r[0]);let n=i.call(this.#e,t,...r);return this.#r.emit("exit",this.#e.exitCode,null),n}else return i.call(this.#e,t,...r)}},to=globalThis.process,{onExit:zu,load:EO,unload:PO}=Zw(Ei(to)?new eo(to):new Zs);var Vu=(e,{cleanup:t,detached:r},{signal:i})=>{if(!t||r)return;let n=zu(()=>{e.kill()});e0(i,()=>{n()})};var Hu=({source:e,sourcePromise:t,boundOptions:r,createNested:i},...n)=>{let s=Fr(),{destination:o,destinationStream:a,destinationError:c,from:d,unpipeSignal:p}=t0(r,i,n),{sourceStream:u,sourceError:l}=i0(e,d),{options:m,fileDescriptors:h}=$e.get(e);return{sourcePromise:t,sourceStream:u,sourceOptions:m,sourceError:l,destination:o,destinationStream:a,destinationError:c,unpipeSignal:p,fileDescriptors:h,startTime:s}},t0=(e,t,r)=>{try{let{destination:i,pipeOptions:{from:n,to:s,unpipeSignal:o}={}}=r0(e,t,...r),a=Jr(i,s);return{destination:i,destinationStream:a,from:n,unpipeSignal:o}}catch(i){return{destinationError:i}}},r0=(e,t,r,...i)=>{if(Array.isArray(r))return{destination:t(Wu,e)(r,...i),pipeOptions:e};if(typeof r=="string"||r instanceof URL||zn(r)){if(Object.keys(e).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[n,s,o]=Er(r,...i);return{destination:t(Wu)(n,s,o),pipeOptions:o}}if($e.has(r)){if(Object.keys(e).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:i[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},Wu=({options:e})=>({options:{...e,stdin:"pipe",piped:!0}}),i0=(e,t)=>{try{return{sourceStream:Ct(e,t)}}catch(r){return{sourceError:r}}};var Yu=({sourceStream:e,sourceError:t,destinationStream:r,destinationError:i,fileDescriptors:n,sourceOptions:s,startTime:o})=>{let a=n0({sourceStream:e,sourceError:t,destinationStream:r,destinationError:i});if(a!==void 0)throw ro({error:a,fileDescriptors:n,sourceOptions:s,startTime:o})},n0=({sourceStream:e,sourceError:t,destinationStream:r,destinationError:i})=>{if(t!==void 0&&i!==void 0)return i;if(i!==void 0)return Ys(e),i;if(t!==void 0)return Ks(r),t},ro=({error:e,fileDescriptors:t,sourceOptions:r,startTime:i})=>Tt({error:e,command:Ku,escapedCommand:Ku,fileDescriptors:t,options:r,startTime:i,isSync:!1}),Ku="source.pipe(destination)";var Ju=async e=>{let[{status:t,reason:r,value:i=r},{status:n,reason:s,value:o=s}]=await e;if(o.pipedFrom.includes(i)||o.pipedFrom.push(i),n==="rejected")throw o;if(t==="rejected")throw i;return o};import{finished as s0}from"stream/promises";var Xu=(e,t,r)=>{let i=Ti.has(t)?a0(e,t):o0(e,t);return at(e,p0,r.signal),at(t,d0,r.signal),c0(t),i},o0=(e,t)=>{let r=ut([e]);return Rt(r,t),Ti.set(t,r),r},a0=(e,t)=>{let r=Ti.get(t);return r.add(e),r},c0=async e=>{try{await s0(e,{cleanup:!0,readable:!1,writable:!0})}catch{}Ti.delete(e)},Ti=new WeakMap,p0=2,d0=1;import{aborted as u0}from"util";var Qu=(e,t)=>e===void 0?[]:[l0(e,t)],l0=async(e,{sourceStream:t,mergedStream:r,fileDescriptors:i,sourceOptions:n,startTime:s})=>{await u0(e,t),await r.remove(t);let o=new Error("Pipe canceled by `unpipeSignal` option.");throw ro({error:o,fileDescriptors:i,sourceOptions:n,startTime:s})};var Oi=(e,...t)=>{if(V(t[0]))return Oi.bind(void 0,{...e,boundOptions:{...e.boundOptions,...t[0]}});let{destination:r,...i}=Hu(e,...t),n=m0({...i,destination:r});return n.pipe=Oi.bind(void 0,{...e,source:r,sourcePromise:n,boundOptions:{}}),n},m0=async({sourcePromise:e,sourceStream:t,sourceOptions:r,sourceError:i,destination:n,destinationStream:s,destinationError:o,unpipeSignal:a,fileDescriptors:c,startTime:d})=>{let p=h0(e,n);Yu({sourceStream:t,sourceError:i,destinationStream:s,destinationError:o,fileDescriptors:c,sourceOptions:r,startTime:d});let u=new AbortController;try{let l=Xu(t,s,u);return await Promise.race([Ju(p),...Qu(a,{sourceStream:t,mergedStream:l,sourceOptions:r,fileDescriptors:c,startTime:d})])}finally{u.abort()}},h0=(e,t)=>Promise.allSettled([e,t]);import{setImmediate as w0}from"timers/promises";import{on as y0}from"events";import{getDefaultHighWaterMark as f0}from"stream";var Ii=({subprocessStdout:e,subprocess:t,binary:r,shouldEncode:i,encoding:n,preserveNewlines:s})=>{let o=new AbortController;return g0(t,o),el({stream:e,controller:o,binary:r,shouldEncode:!e.readableObjectMode&&i,encoding:n,shouldSplit:!e.readableObjectMode,preserveNewlines:s})},g0=async(e,t)=>{try{await e}catch{}finally{t.abort()}},io=({stream:e,onStreamEnd:t,lines:r,encoding:i,stripFinalNewline:n,allMixed:s})=>{let o=new AbortController;_0(t,o,e);let a=e.readableObjectMode&&!s;return el({stream:e,controller:o,binary:i==="buffer",shouldEncode:!a,encoding:i,shouldSplit:!a&&r,preserveNewlines:!n})},_0=async(e,t,r)=>{try{await e}catch{r.destroy()}finally{t.abort()}},el=({stream:e,controller:t,binary:r,shouldEncode:i,encoding:n,shouldSplit:s,preserveNewlines:o})=>{let a=y0(e,"data",{signal:t.signal,highWaterMark:Zu,highWatermark:Zu});return b0({onStdoutChunk:a,controller:t,binary:r,shouldEncode:i,encoding:n,shouldSplit:s,preserveNewlines:o})},no=f0(!0),Zu=no,b0=async function*({onStdoutChunk:e,controller:t,binary:r,shouldEncode:i,encoding:n,shouldSplit:s,preserveNewlines:o}){let a=x0({binary:r,shouldEncode:i,encoding:n,shouldSplit:s,preserveNewlines:o});try{for await(let[c]of e)yield*dt(c,a,0)}catch(c){if(!t.signal.aborted)throw c}finally{yield*ir(a)}},x0=({binary:e,shouldEncode:t,encoding:r,shouldSplit:i,preserveNewlines:n})=>[vi(e,r,!t),ki(e,n,!i,{})].filter(Boolean);var tl=async({stream:e,onStreamEnd:t,fdNumber:r,encoding:i,buffer:n,maxBuffer:s,lines:o,allMixed:a,stripFinalNewline:c,verboseInfo:d,streamInfo:p})=>{let u=k0({stream:e,onStreamEnd:t,fdNumber:r,encoding:i,allMixed:a,verboseInfo:d,streamInfo:p});if(!n){await Promise.all([v0(e),u]);return}let l=js(c,r),m=io({stream:e,onStreamEnd:t,lines:o,encoding:i,stripFinalNewline:l,allMixed:a}),[h]=await Promise.all([q0({stream:e,iterable:m,fdNumber:r,encoding:i,maxBuffer:s,lines:o}),u]);return h},k0=async({stream:e,onStreamEnd:t,fdNumber:r,encoding:i,allMixed:n,verboseInfo:s,streamInfo:{fileDescriptors:o}})=>{if(!$i({stdioItems:o[r]?.stdioItems,encoding:i,verboseInfo:s,fdNumber:r}))return;let a=io({stream:e,onStreamEnd:t,lines:!0,encoding:i,stripFinalNewline:!0,allMixed:n});await lu(a,e,r,s)},v0=async e=>{await w0(),e.readableFlowing===null&&e.resume()},q0=async({stream:e,stream:{readableObjectMode:t},iterable:r,fdNumber:i,encoding:n,maxBuffer:s,lines:o})=>{try{return t||o?await li(r,{maxBuffer:s}):n==="buffer"?new Uint8Array(await mi(r,{maxBuffer:s})):await yi(r,{maxBuffer:s})}catch(a){return rl(ld({error:a,stream:e,readableObjectMode:t,lines:o,encoding:n,fdNumber:i}))}},so=async e=>{try{return await e}catch(t){return rl(t)}},rl=({bufferedData:e})=>Ca(e)?new Uint8Array(e):e;import{finished as S0}from"stream/promises";var ar=async(e,t,r,{isSameDirection:i,stopOnExit:n=!1}={})=>{let s=$0(e,r),o=new AbortController;try{await Promise.race([...n?[r.exitPromise]:[],S0(e,{cleanup:!0,signal:o.signal})])}catch(a){s.stdinCleanedUp||E0(a,t,r,i)}finally{o.abort()}},$0=(e,{originalStreams:[t],subprocess:r})=>{let i={stdinCleanedUp:!1};return e===t&&A0(e,r,i),i},A0=(e,t,r)=>{let{_destroy:i}=e;e._destroy=(...n)=>{C0(t,r),i.call(e,...n)}},C0=({exitCode:e,signalCode:t},r)=>{(e!==null||t!==null)&&(r.stdinCleanedUp=!0)},E0=(e,t,r,i)=>{if(!P0(e,t,r,i))throw e},P0=(e,t,r,i=!0)=>r.propagating?il(e)||Ri(e):(r.propagating=!0,oo(r,t)===i?il(e):Ri(e)),oo=({fileDescriptors:e},t)=>t!=="all"&&e[t].direction==="input",Ri=e=>e?.code==="ERR_STREAM_PREMATURE_CLOSE",il=e=>e?.code==="EPIPE";var nl=({subprocess:e,encoding:t,buffer:r,maxBuffer:i,lines:n,stripFinalNewline:s,verboseInfo:o,streamInfo:a})=>e.stdio.map((c,d)=>ao({stream:c,fdNumber:d,encoding:t,buffer:r[d],maxBuffer:i[d],lines:n[d],allMixed:!1,stripFinalNewline:s,verboseInfo:o,streamInfo:a})),ao=async({stream:e,fdNumber:t,encoding:r,buffer:i,maxBuffer:n,lines:s,allMixed:o,stripFinalNewline:a,verboseInfo:c,streamInfo:d})=>{if(!e)return;let p=ar(e,t,d);if(oo(d,t)){await p;return}let[u]=await Promise.all([tl({stream:e,onStreamEnd:p,fdNumber:t,encoding:r,buffer:i,maxBuffer:n,lines:s,allMixed:o,stripFinalNewline:a,verboseInfo:c,streamInfo:d}),p]);return u};var sl=({stdout:e,stderr:t},{all:r})=>r&&(e||t)?ut([e,t].filter(Boolean)):void 0,ol=({subprocess:e,encoding:t,buffer:r,maxBuffer:i,lines:n,stripFinalNewline:s,verboseInfo:o,streamInfo:a})=>ao({...T0(e,r),fdNumber:"all",encoding:t,maxBuffer:i[1]+i[2],lines:n[1]||n[2],allMixed:O0(e),stripFinalNewline:s,verboseInfo:o,streamInfo:a}),T0=({stdout:e,stderr:t,all:r},[,i,n])=>{let s=i||n;return s?i?n?{stream:r,buffer:s}:{stream:e,buffer:s}:{stream:t,buffer:s}:{stream:r,buffer:s}},O0=({all:e,stdout:t,stderr:r})=>e&&t&&r&&t.readableObjectMode!==r.readableObjectMode;import{once as I0}from"events";var al=e=>vt(e,"ipc"),cl=(e,t)=>{let r=Mr(e);qe({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:t})};var pl=async({subprocess:e,buffer:t,maxBuffer:r,ipc:i,ipcOutput:n,verboseInfo:s})=>{if(!i)return n;let o=al(s),a=Fe(t,"ipc"),c=Fe(r,"ipc");for await(let d of zs({anyProcess:e,channel:e.channel,isSubprocess:!1,ipc:i,shouldAwait:!1,reference:!0}))a&&(md(e,n,c),n.push(d)),o&&cl(d,s);return n},dl=async(e,t)=>(await Promise.allSettled([e]),t);var ul=async({subprocess:e,options:{encoding:t,buffer:r,maxBuffer:i,lines:n,timeoutDuration:s,cancelSignal:o,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:d,ipc:p,ipcInput:u},context:l,verboseInfo:m,fileDescriptors:h,originalStreams:f,onInternalError:x,controller:_})=>{let q=gu(e,l),A={originalStreams:f,fileDescriptors:h,subprocess:e,exitPromise:q,propagating:!1},E=nl({subprocess:e,encoding:t,buffer:r,maxBuffer:i,lines:n,stripFinalNewline:d,verboseInfo:m,streamInfo:A}),w=ol({subprocess:e,encoding:t,buffer:r,maxBuffer:i,lines:n,stripFinalNewline:d,verboseInfo:m,streamInfo:A}),L=[],O=pl({subprocess:e,buffer:r,maxBuffer:i,ipc:p,ipcOutput:L,verboseInfo:m}),R=R0(f,e,A),F=j0(h,A);try{return await Promise.race([Promise.all([{},bu(q),Promise.all(E),w,O,Vp(e,u),...R,...F]),x,D0(e,_),...Bp(e,s,l,_),...ap({subprocess:e,cancelSignal:o,gracefulCancel:a,context:l,controller:_}),...Mp({subprocess:e,cancelSignal:o,gracefulCancel:a,forceKillAfterDelay:c,context:l,controller:_})])}catch(G){return l.terminationReason??="other",Promise.all([{error:G},q,Promise.all(E.map(v=>so(v))),so(w),dl(O,L),Promise.allSettled(R),Promise.allSettled(F)])}},R0=(e,t,r)=>e.map((i,n)=>i===t.stdio[n]?void 0:ar(i,n,r)),j0=(e,t)=>e.flatMap(({stdioItems:r},i)=>r.filter(({value:n,stream:s=n})=>xe(s,{checkOpen:!1})&&!ge(s)).map(({type:n,value:s,stream:o=s})=>ar(o,i,t,{isSameDirection:me.has(n),stopOnExit:n==="native"}))),D0=async(e,{signal:t})=>{let[r]=await I0(e,"error",{signal:t});throw r};var ll=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),cr=(e,t,r)=>{let i=e[r];i.has(t)||i.set(t,[]);let n=i.get(t),s=Se();return n.push(s),{resolve:s.resolve.bind(s),promises:n}},jt=async({resolve:e,promises:t},r)=>{e();let[i]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...t])]);return!i};import{Readable as L0}from"stream";import{callbackify as M0}from"util";import{finished as ml}from"stream/promises";var co=async e=>{if(e!==void 0)try{await po(e)}catch{}},hl=async e=>{if(e!==void 0)try{await uo(e)}catch{}},po=async e=>{await ml(e,{cleanup:!0,readable:!1,writable:!0})},uo=async e=>{await ml(e,{cleanup:!0,readable:!0,writable:!1})},ji=async(e,t)=>{if(await e,t)throw t},Di=(e,t,r)=>{r&&!Ri(r)?e.destroy(r):t&&e.destroy()};var yl=({subprocess:e,concurrentStreams:t,encoding:r},{from:i,binary:n=!0,preserveNewlines:s=!0}={})=>{let o=n||ae.has(r),{subprocessStdout:a,waitReadableDestroy:c}=lo(e,i,t),{readableEncoding:d,readableObjectMode:p,readableHighWaterMark:u}=mo(a,o),{read:l,onStdoutDataDone:m}=ho({subprocessStdout:a,subprocess:e,binary:o,encoding:r,preserveNewlines:s}),h=new L0({read:l,destroy:M0(fo.bind(void 0,{subprocessStdout:a,subprocess:e,waitReadableDestroy:c})),highWaterMark:u,objectMode:p,encoding:d});return yo({subprocessStdout:a,onStdoutDataDone:m,readable:h,subprocess:e}),h},lo=(e,t,r)=>{let i=Ct(e,t),n=cr(r,i,"readableDestroy");return{subprocessStdout:i,waitReadableDestroy:n}},mo=({readableEncoding:e,readableObjectMode:t,readableHighWaterMark:r},i)=>i?{readableEncoding:e,readableObjectMode:t,readableHighWaterMark:r}:{readableEncoding:e,readableObjectMode:!0,readableHighWaterMark:no},ho=({subprocessStdout:e,subprocess:t,binary:r,encoding:i,preserveNewlines:n})=>{let s=Se(),o=Ii({subprocessStdout:e,subprocess:t,binary:r,shouldEncode:!r,encoding:i,preserveNewlines:n});return{read(){F0(this,o,s)},onStdoutDataDone:s}},F0=async(e,t,r)=>{try{let{value:i,done:n}=await t.next();n?r.resolve():e.push(i)}catch{}},yo=async({subprocessStdout:e,onStdoutDataDone:t,readable:r,subprocess:i,subprocessStdin:n})=>{try{await uo(e),await i,await co(n),await t,r.readable&&r.push(null)}catch(s){await co(n),fl(r,s)}},fo=async({subprocessStdout:e,subprocess:t,waitReadableDestroy:r},i)=>{await jt(r,t)&&(fl(e,i),await ji(t,i))},fl=(e,t)=>{Di(e,e.readable,t)};import{Writable as B0}from"stream";import{callbackify as gl}from"util";var _l=({subprocess:e,concurrentStreams:t},{to:r}={})=>{let{subprocessStdin:i,waitWritableFinal:n,waitWritableDestroy:s}=go(e,r,t),o=new B0({..._o(i,e,n),destroy:gl(xo.bind(void 0,{subprocessStdin:i,subprocess:e,waitWritableFinal:n,waitWritableDestroy:s})),highWaterMark:i.writableHighWaterMark,objectMode:i.writableObjectMode});return bo(i,o),o},go=(e,t,r)=>{let i=Jr(e,t),n=cr(r,i,"writableFinal"),s=cr(r,i,"writableDestroy");return{subprocessStdin:i,waitWritableFinal:n,waitWritableDestroy:s}},_o=(e,t,r)=>({write:U0.bind(void 0,e),final:gl(N0.bind(void 0,e,t,r))}),U0=(e,t,r,i)=>{e.write(t,r)?i():e.once("drain",i)},N0=async(e,t,r)=>{await jt(r,t)&&(e.writable&&e.end(),await t)},bo=async(e,t,r)=>{try{await po(e),t.writable&&t.end()}catch(i){await hl(r),bl(t,i)}},xo=async({subprocessStdin:e,subprocess:t,waitWritableFinal:r,waitWritableDestroy:i},n)=>{await jt(r,t),await jt(i,t)&&(bl(e,n),await ji(t,n))},bl=(e,t)=>{Di(e,e.writable,t)};import{Duplex as G0}from"stream";import{callbackify as z0}from"util";var xl=({subprocess:e,concurrentStreams:t,encoding:r},{from:i,to:n,binary:s=!0,preserveNewlines:o=!0}={})=>{let a=s||ae.has(r),{subprocessStdout:c,waitReadableDestroy:d}=lo(e,i,t),{subprocessStdin:p,waitWritableFinal:u,waitWritableDestroy:l}=go(e,n,t),{readableEncoding:m,readableObjectMode:h,readableHighWaterMark:f}=mo(c,a),{read:x,onStdoutDataDone:_}=ho({subprocessStdout:c,subprocess:e,binary:a,encoding:r,preserveNewlines:o}),q=new G0({read:x,..._o(p,e,u),destroy:z0(V0.bind(void 0,{subprocessStdout:c,subprocessStdin:p,subprocess:e,waitReadableDestroy:d,waitWritableFinal:u,waitWritableDestroy:l})),readableHighWaterMark:f,writableHighWaterMark:p.writableHighWaterMark,readableObjectMode:h,writableObjectMode:p.writableObjectMode,encoding:m});return yo({subprocessStdout:c,onStdoutDataDone:_,readable:q,subprocess:e,subprocessStdin:p}),bo(p,q,c),q},V0=async({subprocessStdout:e,subprocessStdin:t,subprocess:r,waitReadableDestroy:i,waitWritableFinal:n,waitWritableDestroy:s},o)=>{await Promise.all([fo({subprocessStdout:e,subprocess:r,waitReadableDestroy:i},o),xo({subprocessStdin:t,subprocess:r,waitWritableFinal:n,waitWritableDestroy:s},o)])};var wo=(e,t,{from:r,binary:i=!1,preserveNewlines:n=!1}={})=>{let s=i||ae.has(t),o=Ct(e,r),a=Ii({subprocessStdout:o,subprocess:e,binary:s,shouldEncode:!0,encoding:t,preserveNewlines:n});return W0(a,o,e)},W0=async function*(e,t,r){try{yield*e}finally{t.readable&&t.destroy(),await r}};var wl=(e,{encoding:t})=>{let r=ll();e.readable=yl.bind(void 0,{subprocess:e,concurrentStreams:r,encoding:t}),e.writable=_l.bind(void 0,{subprocess:e,concurrentStreams:r}),e.duplex=xl.bind(void 0,{subprocess:e,concurrentStreams:r,encoding:t}),e.iterable=wo.bind(void 0,e,t),e[Symbol.asyncIterator]=wo.bind(void 0,e,t,{})};var kl=(e,t)=>{for(let[r,i]of K0){let n=i.value.bind(t);Reflect.defineProperty(e,r,{...i,value:n})}},H0=(async()=>{})().constructor.prototype,K0=["then","catch","finally"].map(e=>[e,Reflect.getOwnPropertyDescriptor(H0,e)]);var vl=(e,t,r,i)=>{let{file:n,commandArguments:s,command:o,escapedCommand:a,startTime:c,verboseInfo:d,options:p,fileDescriptors:u}=X0(e,t,r),{subprocess:l,promise:m}=Z0({file:n,commandArguments:s,options:p,startTime:c,verboseInfo:d,command:o,escapedCommand:a,fileDescriptors:u});return l.pipe=Oi.bind(void 0,{source:l,sourcePromise:m,boundOptions:{},createNested:i}),kl(l,m),$e.set(l,{options:p,fileDescriptors:u}),l},X0=(e,t,r)=>{let{command:i,escapedCommand:n,startTime:s,verboseInfo:o}=Br(e,t,r),{file:a,commandArguments:c,options:d}=ai(e,t,r),p=Q0(d),u=Ru(p,o);return{file:a,commandArguments:c,command:i,escapedCommand:n,startTime:s,verboseInfo:o,options:p,fileDescriptors:u}},Q0=({timeout:e,signal:t,...r})=>{if(t!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:e}},Z0=({file:e,commandArguments:t,options:r,startTime:i,verboseInfo:n,command:s,escapedCommand:o,fileDescriptors:a})=>{let c;try{c=J0(...ci(e,t,r))}catch(h){return Pu({error:h,command:s,escapedCommand:o,fileDescriptors:a,options:r,startTime:i,verboseInfo:n})}let d=new AbortController;Y0(Number.POSITIVE_INFINITY,d.signal);let p=[...c.stdio];Gu(c,a,d),Vu(c,r,d);let u={},l=Se();c.kill=sp.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:l,context:u,controller:d}),c.all=sl(c,r),wl(c,r),Au(c,r);let m=ek({subprocess:c,options:r,startTime:i,verboseInfo:n,fileDescriptors:a,originalStreams:p,command:s,escapedCommand:o,context:u,onInternalError:l,controller:d});return{subprocess:c,promise:m}},ek=async({subprocess:e,options:t,startTime:r,verboseInfo:i,fileDescriptors:n,originalStreams:s,command:o,escapedCommand:a,context:c,onInternalError:d,controller:p})=>{let[u,[l,m],h,f,x]=await ul({subprocess:e,options:t,context:c,verboseInfo:i,fileDescriptors:n,originalStreams:s,onInternalError:d,controller:p});p.abort(),d.resolve();let _=h.map((E,w)=>Ue(E,t,w)),q=Ue(f,t,"all"),A=tk({errorInfo:u,exitCode:l,signal:m,stdio:_,all:q,ipcOutput:x,context:c,options:t,command:o,escapedCommand:a,startTime:r});return Ot(A,i,t)},tk=({errorInfo:e,exitCode:t,signal:r,stdio:i,all:n,ipcOutput:s,context:o,options:a,command:c,escapedCommand:d,startTime:p})=>"error"in e?rr({error:e.error,command:c,escapedCommand:d,timedOut:o.terminationReason==="timeout",isCanceled:o.terminationReason==="cancel"||o.terminationReason==="gracefulCancel",isGracefullyCanceled:o.terminationReason==="gracefulCancel",isMaxBuffer:e.error instanceof Ae,isForcefullyTerminated:o.isForcefullyTerminated,exitCode:t,signal:r,stdio:i,all:n,ipcOutput:s,options:a,startTime:p,isSync:!1}):gi({command:c,escapedCommand:d,stdio:i,all:n,ipcOutput:s,options:a,startTime:p});var Li=(e,t)=>{let r=Object.fromEntries(Object.entries(t).map(([i,n])=>[i,rk(i,e[i],n)]));return{...e,...r}},rk=(e,t,r)=>ik.has(e)&&V(t)&&V(r)?{...t,...r}:r,ik=new Set(["env",...Jn]);var Je=(e,t,r,i)=>{let n=(o,a,c)=>Je(o,a,r,c),s=(...o)=>nk({mapArguments:e,deepOptions:r,boundOptions:t,setBoundExeca:i,createNested:n},...o);return i!==void 0&&i(s,n,t),s},nk=({mapArguments:e,deepOptions:t={},boundOptions:r={},setBoundExeca:i,createNested:n},s,...o)=>{if(V(s))return n(e,Li(r,s),i);let{file:a,commandArguments:c,options:d,isSync:p}=sk({mapArguments:e,firstArgument:s,nextArguments:o,deepOptions:t,boundOptions:r});return p?wu(a,c,d):vl(a,c,d,n)},sk=({mapArguments:e,firstArgument:t,nextArguments:r,deepOptions:i,boundOptions:n})=>{let s=Ra(t)?ja(t,r):[t,...r],[o,a,c]=Er(...s),d=Li(Li(i,n),c),{file:p=o,commandArguments:u=a,options:l=d,isSync:m=!1}=e({file:o,commandArguments:a,options:d});return{file:p,commandArguments:u,options:l,isSync:m}};var ql=({file:e,commandArguments:t})=>$l(e,t),Sl=({file:e,commandArguments:t})=>({...$l(e,t),isSync:!0}),$l=(e,t)=>{if(t.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${e} ${t}.`);let[r,...i]=ok(e);return{file:r,commandArguments:i}},ok=e=>{if(typeof e!="string")throw new TypeError(`The command must be a string: ${String(e)}.`);let t=e.trim();if(t==="")return[];let r=[];for(let i of t.split(ak)){let n=r.at(-1);n&&n.endsWith("\\")?r[r.length-1]=`${n.slice(0,-1)} ${i}`:r.push(i)}return r},ak=/ +/g;var Al=(e,t,r)=>{e.sync=t(ck,r),e.s=e.sync},Cl=({options:e})=>El(e),ck=({options:e})=>({...El(e),isSync:!0}),El=e=>({options:{...pk(e),...e}}),pk=({input:e,inputFile:t,stdio:r})=>e===void 0&&t===void 0&&r===void 0?{stdin:"inherit"}:{},Pl={preferLocal:!0};var he=Je(()=>({})),bj=Je(()=>({isSync:!0})),Mi=Je(ql),xj=Je(Sl),wj=Je(Np),kj=Je(Cl,{},Pl,Al),{sendMessage:vj,getOneMessage:qj,getEachMessage:Sj,getCancelSignal:$j}=Cu();async function H(e,t,r){return he("docker",["compose",...e],{cwd:t,...r})}async function Xe(e,t){try{await H(["up","-d","--no-deps","web"],e,{stdio:t?.stdio??"inherit"})}catch{}}async function Q(e,t,r){let i=["compose","exec","-T"];if(r)for(let[s,o]of Object.entries(r))i.push("-e",`${s}=${o}`);i.push("web","bin/rails",e);let{stdout:n}=await he("docker",i,{cwd:t});return n.split(`
142
+ if (condition) { yield value; }`)};import{Buffer as fw}from"buffer";import{StringDecoder as gw}from"string_decoder";var Mi=(e,t,r)=>{if(r)return;if(e)return{transform:_w.bind(void 0,new TextEncoder)};let i=new gw(t);return{transform:bw.bind(void 0,i),final:xw.bind(void 0,i)}},_w=function*(e,t){fw.isBuffer(t)?yield Be(t):typeof t=="string"?yield e.encode(t):yield t},bw=function*(e,t){yield J(t)?e.write(t):t},xw=function*(e){let t=e.end();t!==""&&(yield t)};import{callbackify as Tu}from"util";var Qs=Tu(async(e,t,r,i)=>{t.currentIterable=e(...r);try{for await(let n of t.currentIterable)i.push(n)}finally{delete t.currentIterable}}),Fi=async function*(e,t,r){if(r===t.length){yield e;return}let{transform:i=kw}=t[r];for await(let n of i(e))yield*Fi(n,t,r+1)},Ou=async function*(e){for(let[t,{final:r}]of Object.entries(e))yield*ww(r,Number(t),e)},ww=async function*(e,t,r){if(e!==void 0)for await(let i of e())yield*Fi(i,r,t+1)},Iu=Tu(async({currentIterable:e},t)=>{if(e!==void 0){await(t?e.throw(t):e.return());return}if(t)throw t}),kw=function*(e){yield e};var Zs=(e,t,r,i)=>{try{for(let n of e(...t))r.push(n);i()}catch(n){i(n)}},Ru=(e,t)=>[...t.flatMap(r=>[...mt(r,e,0)]),...cr(e)],mt=function*(e,t,r){if(r===t.length){yield e;return}let{transform:i=Sw}=t[r];for(let n of i(e))yield*mt(n,t,r+1)},cr=function*(e){for(let[t,{final:r}]of Object.entries(e))yield*vw(r,Number(t),e)},vw=function*(e,t,r){if(e!==void 0)for(let i of e())yield*mt(i,r,t+1)},Sw=function*(e){yield e};var eo=({value:e,value:{transform:t,final:r,writableObjectMode:i,readableObjectMode:n},optionName:s},{encoding:o})=>{let a={},c=Du(e,o,s),d=lt(t),p=lt(r),u=d?Qs.bind(void 0,Fi,a):Zs.bind(void 0,mt),l=d||p?Qs.bind(void 0,Ou,a):Zs.bind(void 0,cr),m=d||p?Iu.bind(void 0,a):void 0;return{stream:new qw({writableObjectMode:i,writableHighWaterMark:ju(i),readableObjectMode:n,readableHighWaterMark:ju(n),transform(f,x,_){u([f,c,0],this,_)},flush(f){l([c],this,f)},destroy:m})}},Bi=(e,t,r,i)=>{let n=t.filter(({type:o})=>o==="generator"),s=i?n.reverse():n;for(let{value:o,optionName:a}of s){let c=Du(o,r,a);e=Ru(c,e)}return e},Du=({transform:e,final:t,binary:r,writableObjectMode:i,readableObjectMode:n,preserveNewlines:s},o,a)=>{let c={};return[{transform:Cu(i,a)},Mi(r,o,i),Li(r,s,i,c),{transform:e,final:t},{transform:Eu(n,a)},Au({binary:r,preserveNewlines:s,readableObjectMode:n,state:c})].filter(Boolean)};var Lu=(e,t)=>{for(let r of $w(e))Aw(e,r,t)},$w=e=>new Set(Object.entries(e).filter(([,{direction:t}])=>t==="input").map(([t])=>Number(t))),Aw=(e,t,r)=>{let{stdioItems:i}=e[t],n=i.filter(({contents:a})=>a!==void 0);if(n.length===0)return;if(t!==0){let[{type:a,optionName:c}]=n;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${Qe[a]} with synchronous methods.`)}let o=n.map(({contents:a})=>a).map(a=>Cw(a,i));r.input=Qt(o)},Cw=(e,t)=>{let r=Bi(e,t,"utf8",!0);return Ew(r),Qt(r)},Ew=e=>{let t=e.find(r=>typeof r!="string"&&!J(r));if(t!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${t}.`)};import{writeFileSync as Iw,appendFileSync as Rw}from"fs";var Ui=({stdioItems:e,encoding:t,verboseInfo:r,fdNumber:i})=>i!=="all"&&qt(r,i)&&!ae.has(t)&&Pw(i)&&(e.some(({type:n,value:s})=>n==="native"&&Tw.has(s))||e.every(({type:n})=>ye.has(n))),Pw=e=>e===1||e===2,Tw=new Set(["pipe","overlapped"]),Mu=async(e,t,r,i)=>{for await(let n of e)Ow(t)||Bu(n,r,i)},Fu=(e,t,r)=>{for(let i of e)Bu(i,t,r)},Ow=e=>e._readableState.pipes.length>0,Bu=(e,t,r)=>{let i=Zr(e);Ae({type:"output",verboseMessage:i,fdNumber:t,verboseInfo:r})};var Uu=({fileDescriptors:e,syncResult:{output:t},options:r,isMaxBuffer:i,verboseInfo:n})=>{if(t===null)return{output:Array.from({length:3})};let s={},o=new Set([]);return{output:t.map((c,d)=>jw({result:c,fileDescriptors:e,fdNumber:d,state:s,outputFiles:o,isMaxBuffer:i,verboseInfo:n},r)),...s}},jw=({result:e,fileDescriptors:t,fdNumber:r,state:i,outputFiles:n,isMaxBuffer:s,verboseInfo:o},{buffer:a,encoding:c,lines:d,stripFinalNewline:p,maxBuffer:u})=>{if(e===null)return;let l=Nd(e,s,u),m=Be(l),{stdioItems:h,objectMode:f}=t[r],x=Dw([m],h,c,i),{serializedResult:_,finalResult:S=_}=Lw({chunks:x,objectMode:f,encoding:c,lines:d,stripFinalNewline:p,fdNumber:r});Mw({serializedResult:_,fdNumber:r,state:i,verboseInfo:o,encoding:c,stdioItems:h,objectMode:f});let A=a[r]?S:void 0;try{return i.error===void 0&&Fw(_,h,n),A}catch(P){return i.error=P,A}},Dw=(e,t,r,i)=>{try{return Bi(e,t,r,!1)}catch(n){return i.error=n,e}},Lw=({chunks:e,objectMode:t,encoding:r,lines:i,stripFinalNewline:n,fdNumber:s})=>{if(t)return{serializedResult:e};if(r==="buffer")return{serializedResult:Qt(e)};let o=rc(e,r);return i[s]?{serializedResult:o,finalResult:Xs(o,!n[s],t)}:{serializedResult:o}},Mw=({serializedResult:e,fdNumber:t,state:r,verboseInfo:i,encoding:n,stdioItems:s,objectMode:o})=>{if(!Ui({stdioItems:s,encoding:n,verboseInfo:i,fdNumber:t}))return;let a=Xs(e,!1,o);try{Fu(a,t,i)}catch(c){r.error??=c}},Fw=(e,t,r)=>{for(let{path:i,append:n}of t.filter(({type:s})=>ji.has(s))){let s=typeof i=="string"?i:i.toString();n||r.has(s)?Rw(i,e):(r.add(s),Iw(i,e))}};var Nu=([,e,t],r)=>{if(r.all)return e===void 0?t:t===void 0?e:Array.isArray(e)?Array.isArray(t)?[...e,...t]:[...e,Ge(t,r,"all")]:Array.isArray(t)?[Ge(e,r,"all"),...t]:J(e)&&J(t)?os([e,t]):`${e}${t}`};import{once as to}from"events";var Gu=async(e,t)=>{let[r,i]=await Bw(e);return t.isForcefullyTerminated??=!1,[r,i]},Bw=async e=>{let[t,r]=await Promise.allSettled([to(e,"spawn"),to(e,"exit")]);return t.status==="rejected"?[]:r.status==="rejected"?zu(e):r.value},zu=async e=>{try{return await to(e,"exit")}catch{return zu(e)}},Vu=async e=>{let[t,r]=await e;if(!Uw(t,r)&&ro(t,r))throw new _e;return[t,r]},Uw=(e,t)=>e===void 0&&t===void 0,ro=(e,t)=>e!==0||t!==null;var Wu=({error:e,status:t,signal:r,output:i},{maxBuffer:n})=>{let s=Nw(e,t,r),o=s?.code==="ETIMEDOUT",a=Ud(s,i,n);return{resultError:s,exitCode:t,signal:r,timedOut:o,isMaxBuffer:a}},Nw=(e,t,r)=>e!==void 0?e:ro(t,r)?new _e:void 0;var Hu=(e,t,r)=>{let{file:i,commandArguments:n,command:s,escapedCommand:o,startTime:a,verboseInfo:c,options:d,fileDescriptors:p}=zw(e,t,r),u=Hw({file:i,commandArguments:n,options:d,command:s,escapedCommand:o,verboseInfo:c,fileDescriptors:p,startTime:a});return Rt(u,c,d)},zw=(e,t,r)=>{let{command:i,escapedCommand:n,startTime:s,verboseInfo:o}=ti(e,t,r),a=Vw(r),{file:c,commandArguments:d,options:p}=ki(e,t,a);Ww(p);let u=vu(p,o);return{file:c,commandArguments:d,command:i,escapedCommand:n,startTime:s,verboseInfo:o,options:p,fileDescriptors:u}},Vw=e=>e.node&&!e.ipc?{...e,ipc:!1}:e,Ww=({ipc:e,ipcInput:t,detached:r,cancelSignal:i})=>{t&&Ni("ipcInput"),e&&Ni("ipc: true"),r&&Ni("detached: true"),i&&Ni("cancelSignal")},Ni=e=>{throw new TypeError(`The "${e}" option cannot be used with synchronous methods.`)},Hw=({file:e,commandArguments:t,options:r,command:i,escapedCommand:n,verboseInfo:s,fileDescriptors:o,startTime:a})=>{let c=Kw({file:e,commandArguments:t,options:r,command:i,escapedCommand:n,fileDescriptors:o,startTime:a});if(c.failed)return c;let{resultError:d,exitCode:p,signal:u,timedOut:l,isMaxBuffer:m}=Wu(c,r),{output:h,error:f=d}=Uu({fileDescriptors:o,syncResult:c,options:r,isMaxBuffer:m,verboseInfo:s}),x=h.map((S,A)=>Ge(S,r,A)),_=Ge(Nu(h,r),r,"all");return Jw({error:f,exitCode:p,signal:u,timedOut:l,isMaxBuffer:m,stdio:x,all:_,options:r,command:i,escapedCommand:n,startTime:a})},Kw=({file:e,commandArguments:t,options:r,command:i,escapedCommand:n,fileDescriptors:s,startTime:o})=>{try{Lu(s,r);let a=Yw(r);return Gw(...vi(e,t,a))}catch(a){return It({error:a,command:i,escapedCommand:n,fileDescriptors:s,options:r,startTime:o,isSync:!0})}},Yw=({encoding:e,maxBuffer:t,...r})=>({...r,encoding:"buffer",maxBuffer:Ti(t)}),Jw=({error:e,exitCode:t,signal:r,timedOut:i,isMaxBuffer:n,stdio:s,all:o,options:a,command:c,escapedCommand:d,startTime:p})=>e===void 0?Oi({command:c,escapedCommand:d,stdio:s,all:o,ipcOutput:[],options:a,startTime:p}):ar({error:e,command:c,escapedCommand:d,timedOut:i,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:n,isForcefullyTerminated:!1,exitCode:t,signal:r,stdio:s,all:o,ipcOutput:[],options:a,startTime:p,isSync:!0});import{setMaxListeners as Lk}from"events";import{spawn as Mk}from"child_process";import Qu from"process";import{once as io,on as Xw}from"events";var Ku=({anyProcess:e,channel:t,isSubprocess:r,ipc:i},{reference:n=!0,filter:s}={})=>(Ct({methodName:"getOneMessage",isSubprocess:r,ipc:i,isConnected:fi(e)}),Qw({anyProcess:e,channel:t,isSubprocess:r,filter:s,reference:n})),Qw=async({anyProcess:e,channel:t,isSubprocess:r,filter:i,reference:n})=>{li(t,n);let s=Xe(e,t,r),o=new AbortController;try{return await Promise.race([Zw(s,i,o),e0(s,r,o),t0(s,r,o)])}catch(a){throw Et(e),a}finally{o.abort(),mi(t,n)}},Zw=async(e,t,{signal:r})=>{if(t===void 0){let[i]=await io(e,"message",{signal:r});return i}for await(let[i]of Xw(e,"message",{signal:r}))if(t(i))return i},e0=async(e,t,{signal:r})=>{await io(e,"disconnect",{signal:r}),Rp(t)},t0=async(e,t,{signal:r})=>{let[i]=await io(e,"strict:error",{signal:r});throw pi(i,t)};import{once as Ju,on as r0}from"events";var Xu=({anyProcess:e,channel:t,isSubprocess:r,ipc:i},{reference:n=!0}={})=>no({anyProcess:e,channel:t,isSubprocess:r,ipc:i,shouldAwait:!r,reference:n}),no=({anyProcess:e,channel:t,isSubprocess:r,ipc:i,shouldAwait:n,reference:s})=>{Ct({methodName:"getEachMessage",isSubprocess:r,ipc:i,isConnected:fi(e)}),li(t,s);let o=Xe(e,t,r),a=new AbortController,c={};return i0(e,o,a),n0({ipcEmitter:o,isSubprocess:r,controller:a,state:c}),s0({anyProcess:e,channel:t,ipcEmitter:o,isSubprocess:r,shouldAwait:n,controller:a,state:c,reference:s})},i0=async(e,t,r)=>{try{await Ju(t,"disconnect",{signal:r.signal}),r.abort()}catch{}},n0=async({ipcEmitter:e,isSubprocess:t,controller:r,state:i})=>{try{let[n]=await Ju(e,"strict:error",{signal:r.signal});i.error=pi(n,t),r.abort()}catch{}},s0=async function*({anyProcess:e,channel:t,ipcEmitter:r,isSubprocess:i,shouldAwait:n,controller:s,state:o,reference:a}){try{for await(let[c]of r0(r,"message",{signal:s.signal}))Yu(o),yield c}catch{Yu(o)}finally{s.abort(),mi(t,a),i||Et(e),n&&await e}},Yu=({error:e})=>{if(e)throw e};var Zu=(e,{ipc:t})=>{Object.assign(e,tl(e,!1,t))},el=()=>{let e=Qu,t=!0,r=Qu.channel!==void 0;return{...tl(e,t,r),getCancelSignal:ad.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r})}},tl=(e,t,r)=>({sendMessage:xi.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r}),getOneMessage:Ku.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r}),getEachMessage:Xu.bind(void 0,{anyProcess:e,channel:e.channel,isSubprocess:t,ipc:r})});import{ChildProcess as o0}from"child_process";import{PassThrough as a0,Readable as c0,Writable as p0,Duplex as d0}from"stream";var rl=({error:e,command:t,escapedCommand:r,fileDescriptors:i,options:n,startTime:s,verboseInfo:o})=>{Ks(i);let a=new o0;u0(a,i),Object.assign(a,{readable:l0,writable:m0,duplex:h0});let c=It({error:e,command:t,escapedCommand:r,fileDescriptors:i,options:n,startTime:s,isSync:!1}),d=y0(c,o,n);return{subprocess:a,promise:d}},u0=(e,t)=>{let r=pr(),i=pr(),n=pr(),s=Array.from({length:t.length-3},pr),o=pr(),a=[r,i,n,...s];Object.assign(e,{stdin:r,stdout:i,stderr:n,all:o,stdio:a})},pr=()=>{let e=new a0;return e.end(),e},l0=()=>new c0({read(){}}),m0=()=>new p0({write(){}}),h0=()=>new d0({read(){},write(){}}),y0=async(e,t,r)=>Rt(e,t,r);import{createReadStream as il,createWriteStream as nl}from"fs";import{Buffer as f0}from"buffer";import{Readable as dr,Writable as g0,Duplex as _0}from"stream";var ol=(e,t)=>Di(b0,e,t,!1),ur=({type:e,optionName:t})=>{throw new TypeError(`The \`${t}\` option cannot be ${Qe[e]}.`)},sl={fileNumber:ur,generator:eo,asyncGenerator:eo,nodeStream:({value:e})=>({stream:e}),webTransform({value:{transform:e,writableObjectMode:t,readableObjectMode:r}}){let i=t||r;return{stream:_0.fromWeb(e,{objectMode:i})}},duplex:({value:{transform:e}})=>({stream:e}),native(){}},b0={input:{...sl,fileUrl:({value:e})=>({stream:il(e)}),filePath:({value:{file:e}})=>({stream:il(e)}),webStream:({value:e})=>({stream:dr.fromWeb(e)}),iterable:({value:e})=>({stream:dr.from(e)}),asyncIterable:({value:e})=>({stream:dr.from(e)}),string:({value:e})=>({stream:dr.from(e)}),uint8Array:({value:e})=>({stream:dr.from(f0.from(e))})},output:{...sl,fileUrl:({value:e})=>({stream:nl(e)}),filePath:({value:{file:e,append:t}})=>({stream:nl(e,t?{flags:"a"}:{})}),webStream:({value:e})=>({stream:g0.fromWeb(e)}),iterable:ur,asyncIterable:ur,string:ur,uint8Array:ur}};import{on as x0,once as al}from"events";import{PassThrough as w0,getDefaultHighWaterMark as k0}from"stream";import{finished as dl}from"stream/promises";function ht(e){if(!Array.isArray(e))throw new TypeError(`Expected an array, got \`${typeof e}\`.`);for(let n of e)oo(n);let t=e.some(({readableObjectMode:n})=>n),r=v0(e,t),i=new so({objectMode:t,writableHighWaterMark:r,readableHighWaterMark:r});for(let n of e)i.add(n);return i}var v0=(e,t)=>{if(e.length===0)return k0(t);let r=e.filter(({readableObjectMode:i})=>i===t).map(({readableHighWaterMark:i})=>i);return Math.max(...r)},so=class extends w0{#t=new Set([]);#r=new Set([]);#e=new Set([]);#i;#s=Symbol("unpipe");#n=new WeakMap;add(t){if(oo(t),this.#t.has(t))return;this.#t.add(t),this.#i??=S0(this,this.#t,this.#s);let r=A0({passThroughStream:this,stream:t,streams:this.#t,ended:this.#r,aborted:this.#e,onFinished:this.#i,unpipeEvent:this.#s});this.#n.set(t,r),t.pipe(this,{end:!1})}async remove(t){if(oo(t),!this.#t.has(t))return!1;let r=this.#n.get(t);return r===void 0?!1:(this.#n.delete(t),t.unpipe(this),await r,!0)}},S0=async(e,t,r)=>{Gi(e,cl);let i=new AbortController;try{await Promise.race([q0(e,i),$0(e,t,r,i)])}finally{i.abort(),Gi(e,-cl)}},q0=async(e,{signal:t})=>{try{await dl(e,{signal:t,cleanup:!0})}catch(r){throw ul(e,r),r}},$0=async(e,t,r,{signal:i})=>{for await(let[n]of x0(e,"unpipe",{signal:i}))t.has(n)&&n.emit(r)},oo=e=>{if(typeof e?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof e}\`.`)},A0=async({passThroughStream:e,stream:t,streams:r,ended:i,aborted:n,onFinished:s,unpipeEvent:o})=>{Gi(e,pl);let a=new AbortController;try{await Promise.race([C0(s,t,a),E0({passThroughStream:e,stream:t,streams:r,ended:i,aborted:n,controller:a}),P0({stream:t,streams:r,ended:i,aborted:n,unpipeEvent:o,controller:a})])}finally{a.abort(),Gi(e,-pl)}r.size>0&&r.size===i.size+n.size&&(i.size===0&&n.size>0?ao(e):T0(e))},C0=async(e,t,{signal:r})=>{try{await e,r.aborted||ao(t)}catch(i){r.aborted||ul(t,i)}},E0=async({passThroughStream:e,stream:t,streams:r,ended:i,aborted:n,controller:{signal:s}})=>{try{await dl(t,{signal:s,cleanup:!0,readable:!0,writable:!1}),r.has(t)&&i.add(t)}catch(o){if(s.aborted||!r.has(t))return;ll(o)?n.add(t):ml(e,o)}},P0=async({stream:e,streams:t,ended:r,aborted:i,unpipeEvent:n,controller:{signal:s}})=>{if(await al(e,n,{signal:s}),!e.readable)return al(s,"abort",{signal:s});t.delete(e),r.delete(e),i.delete(e)},T0=e=>{e.writable&&e.end()},ul=(e,t)=>{ll(t)?ao(e):ml(e,t)},ll=e=>e?.code==="ERR_STREAM_PREMATURE_CLOSE",ao=e=>{(e.readable||e.writable)&&e.destroy()},ml=(e,t)=>{e.destroyed||(e.once("error",O0),e.destroy(t))},O0=()=>{},Gi=(e,t)=>{let r=e.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&e.setMaxListeners(r+t)},cl=2,pl=1;import{finished as hl}from"stream/promises";var Dt=(e,t)=>{e.pipe(t),I0(e,t),R0(e,t)},I0=async(e,t)=>{if(!(ge(e)||ge(t))){try{await hl(e,{cleanup:!0,readable:!0,writable:!1})}catch{}co(t)}},co=e=>{e.writable&&e.end()},R0=async(e,t)=>{if(!(ge(e)||ge(t))){try{await hl(t,{cleanup:!0,readable:!1,writable:!0})}catch{}po(e)}},po=e=>{e.readable&&e.destroy()};var yl=(e,t,r)=>{let i=new Map;for(let[n,{stdioItems:s,direction:o}]of Object.entries(t)){for(let{stream:a}of s.filter(({type:c})=>ye.has(c)))j0(e,a,o,n);for(let{stream:a}of s.filter(({type:c})=>!ye.has(c)))L0({subprocess:e,stream:a,direction:o,fdNumber:n,pipeGroups:i,controller:r})}for(let[n,s]of i.entries()){let o=s.length===1?s[0]:ht(s);Dt(o,n)}},j0=(e,t,r,i)=>{r==="output"?Dt(e.stdio[i],t):Dt(t,e.stdio[i]);let n=D0[i];n!==void 0&&(e[n]=t),e.stdio[i]=t},D0=["stdin","stdout","stderr"],L0=({subprocess:e,stream:t,direction:r,fdNumber:i,pipeGroups:n,controller:s})=>{if(t===void 0)return;M0(t,s);let[o,a]=r==="output"?[t,e.stdio[i]]:[e.stdio[i],t],c=n.get(o)??[];n.set(o,[...c,a])},M0=(e,{signal:t})=>{ge(e)&&dt(e,F0,t)},F0=2;import{addAbortListener as N0}from"events";var yt=[];yt.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&yt.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&yt.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var zi=e=>!!e&&typeof e=="object"&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function",uo=Symbol.for("signal-exit emitter"),lo=globalThis,B0=Object.defineProperty.bind(Object),mo=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(lo[uo])return lo[uo];B0(lo,uo,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(t,r){this.listeners[t].push(r)}removeListener(t,r){let i=this.listeners[t],n=i.indexOf(r);n!==-1&&(n===0&&i.length===1?i.length=0:i.splice(n,1))}emit(t,r,i){if(this.emitted[t])return!1;this.emitted[t]=!0;let n=!1;for(let s of this.listeners[t])n=s(r,i)===!0||n;return t==="exit"&&(n=this.emit("afterExit",r,i)||n),n}},Vi=class{},U0=e=>({onExit(t,r){return e.onExit(t,r)},load(){return e.load()},unload(){return e.unload()}}),ho=class extends Vi{onExit(){return()=>{}}load(){}unload(){}},yo=class extends Vi{#t=fo.platform==="win32"?"SIGINT":"SIGHUP";#r=new mo;#e;#i;#s;#n={};#o=!1;constructor(t){super(),this.#e=t,this.#n={};for(let r of yt)this.#n[r]=()=>{let i=this.#e.listeners(r),{count:n}=this.#r,s=t;if(typeof s.__signal_exit_emitter__=="object"&&typeof s.__signal_exit_emitter__.count=="number"&&(n+=s.__signal_exit_emitter__.count),i.length===n){this.unload();let o=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#t:r;o||t.kill(t.pid,a)}};this.#s=t.reallyExit,this.#i=t.emit}onExit(t,r){if(!zi(this.#e))return()=>{};this.#o===!1&&this.load();let i=r?.alwaysLast?"afterExit":"exit";return this.#r.on(i,t),()=>{this.#r.removeListener(i,t),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#o){this.#o=!0,this.#r.count+=1;for(let t of yt)try{let r=this.#n[t];r&&this.#e.on(t,r)}catch{}this.#e.emit=(t,...r)=>this.#c(t,...r),this.#e.reallyExit=t=>this.#a(t)}}unload(){this.#o&&(this.#o=!1,yt.forEach(t=>{let r=this.#n[t];if(!r)throw new Error("Listener not defined for signal: "+t);try{this.#e.removeListener(t,r)}catch{}}),this.#e.emit=this.#i,this.#e.reallyExit=this.#s,this.#r.count-=1)}#a(t){return zi(this.#e)?(this.#e.exitCode=t||0,this.#r.emit("exit",this.#e.exitCode,null),this.#s.call(this.#e,this.#e.exitCode)):0}#c(t,...r){let i=this.#i;if(t==="exit"&&zi(this.#e)){typeof r[0]=="number"&&(this.#e.exitCode=r[0]);let n=i.call(this.#e,t,...r);return this.#r.emit("exit",this.#e.exitCode,null),n}else return i.call(this.#e,t,...r)}},fo=globalThis.process,{onExit:fl,load:AI,unload:CI}=U0(zi(fo)?new yo(fo):new ho);var gl=(e,{cleanup:t,detached:r},{signal:i})=>{if(!t||r)return;let n=fl(()=>{e.kill()});N0(i,()=>{n()})};var bl=({source:e,sourcePromise:t,boundOptions:r,createNested:i},...n)=>{let s=ei(),{destination:o,destinationStream:a,destinationError:c,from:d,unpipeSignal:p}=G0(r,i,n),{sourceStream:u,sourceError:l}=V0(e,d),{options:m,fileDescriptors:h}=Ee.get(e);return{sourcePromise:t,sourceStream:u,sourceOptions:m,sourceError:l,destination:o,destinationStream:a,destinationError:c,unpipeSignal:p,fileDescriptors:h,startTime:s}},G0=(e,t,r)=>{try{let{destination:i,pipeOptions:{from:n,to:s,unpipeSignal:o}={}}=z0(e,t,...r),a=ui(i,s);return{destination:i,destinationStream:a,from:n,unpipeSignal:o}}catch(i){return{destinationError:i}}},z0=(e,t,r,...i)=>{if(Array.isArray(r))return{destination:t(_l,e)(r,...i),pipeOptions:e};if(typeof r=="string"||r instanceof URL||ns(r)){if(Object.keys(e).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[n,s,o]=zr(r,...i);return{destination:t(_l)(n,s,o),pipeOptions:o}}if(Ee.has(r)){if(Object.keys(e).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:i[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},_l=({options:e})=>({options:{...e,stdin:"pipe",piped:!0}}),V0=(e,t)=>{try{return{sourceStream:Pt(e,t)}}catch(r){return{sourceError:r}}};var wl=({sourceStream:e,sourceError:t,destinationStream:r,destinationError:i,fileDescriptors:n,sourceOptions:s,startTime:o})=>{let a=W0({sourceStream:e,sourceError:t,destinationStream:r,destinationError:i});if(a!==void 0)throw go({error:a,fileDescriptors:n,sourceOptions:s,startTime:o})},W0=({sourceStream:e,sourceError:t,destinationStream:r,destinationError:i})=>{if(t!==void 0&&i!==void 0)return i;if(i!==void 0)return po(e),i;if(t!==void 0)return co(r),t},go=({error:e,fileDescriptors:t,sourceOptions:r,startTime:i})=>It({error:e,command:xl,escapedCommand:xl,fileDescriptors:t,options:r,startTime:i,isSync:!1}),xl="source.pipe(destination)";var kl=async e=>{let[{status:t,reason:r,value:i=r},{status:n,reason:s,value:o=s}]=await e;if(o.pipedFrom.includes(i)||o.pipedFrom.push(i),n==="rejected")throw o;if(t==="rejected")throw i;return o};import{finished as H0}from"stream/promises";var vl=(e,t,r)=>{let i=Wi.has(t)?Y0(e,t):K0(e,t);return dt(e,X0,r.signal),dt(t,Q0,r.signal),J0(t),i},K0=(e,t)=>{let r=ht([e]);return Dt(r,t),Wi.set(t,r),r},Y0=(e,t)=>{let r=Wi.get(t);return r.add(e),r},J0=async e=>{try{await H0(e,{cleanup:!0,readable:!1,writable:!0})}catch{}Wi.delete(e)},Wi=new WeakMap,X0=2,Q0=1;import{aborted as Z0}from"util";var Sl=(e,t)=>e===void 0?[]:[ek(e,t)],ek=async(e,{sourceStream:t,mergedStream:r,fileDescriptors:i,sourceOptions:n,startTime:s})=>{await Z0(e,t),await r.remove(t);let o=new Error("Pipe canceled by `unpipeSignal` option.");throw go({error:o,fileDescriptors:i,sourceOptions:n,startTime:s})};var Hi=(e,...t)=>{if(V(t[0]))return Hi.bind(void 0,{...e,boundOptions:{...e.boundOptions,...t[0]}});let{destination:r,...i}=bl(e,...t),n=tk({...i,destination:r});return n.pipe=Hi.bind(void 0,{...e,source:r,sourcePromise:n,boundOptions:{}}),n},tk=async({sourcePromise:e,sourceStream:t,sourceOptions:r,sourceError:i,destination:n,destinationStream:s,destinationError:o,unpipeSignal:a,fileDescriptors:c,startTime:d})=>{let p=rk(e,n);wl({sourceStream:t,sourceError:i,destinationStream:s,destinationError:o,fileDescriptors:c,sourceOptions:r,startTime:d});let u=new AbortController;try{let l=vl(t,s,u);return await Promise.race([kl(p),...Sl(a,{sourceStream:t,mergedStream:l,sourceOptions:r,fileDescriptors:c,startTime:d})])}finally{u.abort()}},rk=(e,t)=>Promise.allSettled([e,t]);import{setImmediate as pk}from"timers/promises";import{on as ik}from"events";import{getDefaultHighWaterMark as nk}from"stream";var Ki=({subprocessStdout:e,subprocess:t,binary:r,shouldEncode:i,encoding:n,preserveNewlines:s})=>{let o=new AbortController;return sk(t,o),$l({stream:e,controller:o,binary:r,shouldEncode:!e.readableObjectMode&&i,encoding:n,shouldSplit:!e.readableObjectMode,preserveNewlines:s})},sk=async(e,t)=>{try{await e}catch{}finally{t.abort()}},_o=({stream:e,onStreamEnd:t,lines:r,encoding:i,stripFinalNewline:n,allMixed:s})=>{let o=new AbortController;ok(t,o,e);let a=e.readableObjectMode&&!s;return $l({stream:e,controller:o,binary:i==="buffer",shouldEncode:!a,encoding:i,shouldSplit:!a&&r,preserveNewlines:!n})},ok=async(e,t,r)=>{try{await e}catch{r.destroy()}finally{t.abort()}},$l=({stream:e,controller:t,binary:r,shouldEncode:i,encoding:n,shouldSplit:s,preserveNewlines:o})=>{let a=ik(e,"data",{signal:t.signal,highWaterMark:ql,highWatermark:ql});return ak({onStdoutChunk:a,controller:t,binary:r,shouldEncode:i,encoding:n,shouldSplit:s,preserveNewlines:o})},bo=nk(!0),ql=bo,ak=async function*({onStdoutChunk:e,controller:t,binary:r,shouldEncode:i,encoding:n,shouldSplit:s,preserveNewlines:o}){let a=ck({binary:r,shouldEncode:i,encoding:n,shouldSplit:s,preserveNewlines:o});try{for await(let[c]of e)yield*mt(c,a,0)}catch(c){if(!t.signal.aborted)throw c}finally{yield*cr(a)}},ck=({binary:e,shouldEncode:t,encoding:r,shouldSplit:i,preserveNewlines:n})=>[Mi(e,r,!t),Li(e,n,!i,{})].filter(Boolean);var Al=async({stream:e,onStreamEnd:t,fdNumber:r,encoding:i,buffer:n,maxBuffer:s,lines:o,allMixed:a,stripFinalNewline:c,verboseInfo:d,streamInfo:p})=>{let u=dk({stream:e,onStreamEnd:t,fdNumber:r,encoding:i,allMixed:a,verboseInfo:d,streamInfo:p});if(!n){await Promise.all([uk(e),u]);return}let l=Ys(c,r),m=_o({stream:e,onStreamEnd:t,lines:o,encoding:i,stripFinalNewline:l,allMixed:a}),[h]=await Promise.all([lk({stream:e,iterable:m,fdNumber:r,encoding:i,maxBuffer:s,lines:o}),u]);return h},dk=async({stream:e,onStreamEnd:t,fdNumber:r,encoding:i,allMixed:n,verboseInfo:s,streamInfo:{fileDescriptors:o}})=>{if(!Ui({stdioItems:o[r]?.stdioItems,encoding:i,verboseInfo:s,fdNumber:r}))return;let a=_o({stream:e,onStreamEnd:t,lines:!0,encoding:i,stripFinalNewline:!0,allMixed:n});await Mu(a,e,r,s)},uk=async e=>{await pk(),e.readableFlowing===null&&e.resume()},lk=async({stream:e,stream:{readableObjectMode:t},iterable:r,fdNumber:i,encoding:n,maxBuffer:s,lines:o})=>{try{return t||o?await Ai(r,{maxBuffer:s}):n==="buffer"?new Uint8Array(await Ci(r,{maxBuffer:s})):await Pi(r,{maxBuffer:s})}catch(a){return Cl(Md({error:a,stream:e,readableObjectMode:t,lines:o,encoding:n,fdNumber:i}))}},xo=async e=>{try{return await e}catch(t){return Cl(t)}},Cl=({bufferedData:e})=>ec(e)?new Uint8Array(e):e;import{finished as mk}from"stream/promises";var lr=async(e,t,r,{isSameDirection:i,stopOnExit:n=!1}={})=>{let s=hk(e,r),o=new AbortController;try{await Promise.race([...n?[r.exitPromise]:[],mk(e,{cleanup:!0,signal:o.signal})])}catch(a){s.stdinCleanedUp||gk(a,t,r,i)}finally{o.abort()}},hk=(e,{originalStreams:[t],subprocess:r})=>{let i={stdinCleanedUp:!1};return e===t&&yk(e,r,i),i},yk=(e,t,r)=>{let{_destroy:i}=e;e._destroy=(...n)=>{fk(t,r),i.call(e,...n)}},fk=({exitCode:e,signalCode:t},r)=>{(e!==null||t!==null)&&(r.stdinCleanedUp=!0)},gk=(e,t,r,i)=>{if(!_k(e,t,r,i))throw e},_k=(e,t,r,i=!0)=>r.propagating?El(e)||Yi(e):(r.propagating=!0,wo(r,t)===i?El(e):Yi(e)),wo=({fileDescriptors:e},t)=>t!=="all"&&e[t].direction==="input",Yi=e=>e?.code==="ERR_STREAM_PREMATURE_CLOSE",El=e=>e?.code==="EPIPE";var Pl=({subprocess:e,encoding:t,buffer:r,maxBuffer:i,lines:n,stripFinalNewline:s,verboseInfo:o,streamInfo:a})=>e.stdio.map((c,d)=>ko({stream:c,fdNumber:d,encoding:t,buffer:r[d],maxBuffer:i[d],lines:n[d],allMixed:!1,stripFinalNewline:s,verboseInfo:o,streamInfo:a})),ko=async({stream:e,fdNumber:t,encoding:r,buffer:i,maxBuffer:n,lines:s,allMixed:o,stripFinalNewline:a,verboseInfo:c,streamInfo:d})=>{if(!e)return;let p=lr(e,t,d);if(wo(d,t)){await p;return}let[u]=await Promise.all([Al({stream:e,onStreamEnd:p,fdNumber:t,encoding:r,buffer:i,maxBuffer:n,lines:s,allMixed:o,stripFinalNewline:a,verboseInfo:c,streamInfo:d}),p]);return u};var Tl=({stdout:e,stderr:t},{all:r})=>r&&(e||t)?ht([e,t].filter(Boolean)):void 0,Ol=({subprocess:e,encoding:t,buffer:r,maxBuffer:i,lines:n,stripFinalNewline:s,verboseInfo:o,streamInfo:a})=>ko({...bk(e,r),fdNumber:"all",encoding:t,maxBuffer:i[1]+i[2],lines:n[1]||n[2],allMixed:xk(e),stripFinalNewline:s,verboseInfo:o,streamInfo:a}),bk=({stdout:e,stderr:t,all:r},[,i,n])=>{let s=i||n;return s?i?n?{stream:r,buffer:s}:{stream:e,buffer:s}:{stream:t,buffer:s}:{stream:r,buffer:s}},xk=({all:e,stdout:t,stderr:r})=>e&&t&&r&&t.readableObjectMode!==r.readableObjectMode;import{once as wk}from"events";var Il=e=>qt(e,"ipc"),Rl=(e,t)=>{let r=Zr(e);Ae({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:t})};var jl=async({subprocess:e,buffer:t,maxBuffer:r,ipc:i,ipcOutput:n,verboseInfo:s})=>{if(!i)return n;let o=Il(s),a=Ue(t,"ipc"),c=Ue(r,"ipc");for await(let d of no({anyProcess:e,channel:e.channel,isSubprocess:!1,ipc:i,shouldAwait:!1,reference:!0}))a&&(Fd(e,n,c),n.push(d)),o&&Rl(d,s);return n},Dl=async(e,t)=>(await Promise.allSettled([e]),t);var Ll=async({subprocess:e,options:{encoding:t,buffer:r,maxBuffer:i,lines:n,timeoutDuration:s,cancelSignal:o,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:d,ipc:p,ipcInput:u},context:l,verboseInfo:m,fileDescriptors:h,originalStreams:f,onInternalError:x,controller:_})=>{let S=Gu(e,l),A={originalStreams:f,fileDescriptors:h,subprocess:e,exitPromise:S,propagating:!1},P=Pl({subprocess:e,encoding:t,buffer:r,maxBuffer:i,lines:n,stripFinalNewline:d,verboseInfo:m,streamInfo:A}),w=Ol({subprocess:e,encoding:t,buffer:r,maxBuffer:i,lines:n,stripFinalNewline:d,verboseInfo:m,streamInfo:A}),D=[],O=jl({subprocess:e,buffer:r,maxBuffer:i,ipc:p,ipcOutput:D,verboseInfo:m}),I=kk(f,e,A),F=vk(h,A);try{return await Promise.race([Promise.all([{},Vu(S),Promise.all(P),w,O,gd(e,u),...I,...F]),x,Sk(e,_),...ld(e,s,l,_),...Ip({subprocess:e,cancelSignal:o,gracefulCancel:a,context:l,controller:_}),...dd({subprocess:e,cancelSignal:o,gracefulCancel:a,forceKillAfterDelay:c,context:l,controller:_})])}catch(z){return l.terminationReason??="other",Promise.all([{error:z},S,Promise.all(P.map(v=>xo(v))),xo(w),Dl(O,D),Promise.allSettled(I),Promise.allSettled(F)])}},kk=(e,t,r)=>e.map((i,n)=>i===t.stdio[n]?void 0:lr(i,n,r)),vk=(e,t)=>e.flatMap(({stdioItems:r},i)=>r.filter(({value:n,stream:s=n})=>xe(s,{checkOpen:!1})&&!ge(s)).map(({type:n,value:s,stream:o=s})=>lr(o,i,t,{isSameDirection:ye.has(n),stopOnExit:n==="native"}))),Sk=async(e,{signal:t})=>{let[r]=await wk(e,"error",{signal:t});throw r};var Ml=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),mr=(e,t,r)=>{let i=e[r];i.has(t)||i.set(t,[]);let n=i.get(t),s=Ce();return n.push(s),{resolve:s.resolve.bind(s),promises:n}},Lt=async({resolve:e,promises:t},r)=>{e();let[i]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...t])]);return!i};import{Readable as qk}from"stream";import{callbackify as $k}from"util";import{finished as Fl}from"stream/promises";var vo=async e=>{if(e!==void 0)try{await So(e)}catch{}},Bl=async e=>{if(e!==void 0)try{await qo(e)}catch{}},So=async e=>{await Fl(e,{cleanup:!0,readable:!1,writable:!0})},qo=async e=>{await Fl(e,{cleanup:!0,readable:!0,writable:!1})},Ji=async(e,t)=>{if(await e,t)throw t},Xi=(e,t,r)=>{r&&!Yi(r)?e.destroy(r):t&&e.destroy()};var Ul=({subprocess:e,concurrentStreams:t,encoding:r},{from:i,binary:n=!0,preserveNewlines:s=!0}={})=>{let o=n||ae.has(r),{subprocessStdout:a,waitReadableDestroy:c}=$o(e,i,t),{readableEncoding:d,readableObjectMode:p,readableHighWaterMark:u}=Ao(a,o),{read:l,onStdoutDataDone:m}=Co({subprocessStdout:a,subprocess:e,binary:o,encoding:r,preserveNewlines:s}),h=new qk({read:l,destroy:$k(Po.bind(void 0,{subprocessStdout:a,subprocess:e,waitReadableDestroy:c})),highWaterMark:u,objectMode:p,encoding:d});return Eo({subprocessStdout:a,onStdoutDataDone:m,readable:h,subprocess:e}),h},$o=(e,t,r)=>{let i=Pt(e,t),n=mr(r,i,"readableDestroy");return{subprocessStdout:i,waitReadableDestroy:n}},Ao=({readableEncoding:e,readableObjectMode:t,readableHighWaterMark:r},i)=>i?{readableEncoding:e,readableObjectMode:t,readableHighWaterMark:r}:{readableEncoding:e,readableObjectMode:!0,readableHighWaterMark:bo},Co=({subprocessStdout:e,subprocess:t,binary:r,encoding:i,preserveNewlines:n})=>{let s=Ce(),o=Ki({subprocessStdout:e,subprocess:t,binary:r,shouldEncode:!r,encoding:i,preserveNewlines:n});return{read(){Ak(this,o,s)},onStdoutDataDone:s}},Ak=async(e,t,r)=>{try{let{value:i,done:n}=await t.next();n?r.resolve():e.push(i)}catch{}},Eo=async({subprocessStdout:e,onStdoutDataDone:t,readable:r,subprocess:i,subprocessStdin:n})=>{try{await qo(e),await i,await vo(n),await t,r.readable&&r.push(null)}catch(s){await vo(n),Nl(r,s)}},Po=async({subprocessStdout:e,subprocess:t,waitReadableDestroy:r},i)=>{await Lt(r,t)&&(Nl(e,i),await Ji(t,i))},Nl=(e,t)=>{Xi(e,e.readable,t)};import{Writable as Ck}from"stream";import{callbackify as Gl}from"util";var zl=({subprocess:e,concurrentStreams:t},{to:r}={})=>{let{subprocessStdin:i,waitWritableFinal:n,waitWritableDestroy:s}=To(e,r,t),o=new Ck({...Oo(i,e,n),destroy:Gl(Ro.bind(void 0,{subprocessStdin:i,subprocess:e,waitWritableFinal:n,waitWritableDestroy:s})),highWaterMark:i.writableHighWaterMark,objectMode:i.writableObjectMode});return Io(i,o),o},To=(e,t,r)=>{let i=ui(e,t),n=mr(r,i,"writableFinal"),s=mr(r,i,"writableDestroy");return{subprocessStdin:i,waitWritableFinal:n,waitWritableDestroy:s}},Oo=(e,t,r)=>({write:Ek.bind(void 0,e),final:Gl(Pk.bind(void 0,e,t,r))}),Ek=(e,t,r,i)=>{e.write(t,r)?i():e.once("drain",i)},Pk=async(e,t,r)=>{await Lt(r,t)&&(e.writable&&e.end(),await t)},Io=async(e,t,r)=>{try{await So(e),t.writable&&t.end()}catch(i){await Bl(r),Vl(t,i)}},Ro=async({subprocessStdin:e,subprocess:t,waitWritableFinal:r,waitWritableDestroy:i},n)=>{await Lt(r,t),await Lt(i,t)&&(Vl(e,n),await Ji(t,n))},Vl=(e,t)=>{Xi(e,e.writable,t)};import{Duplex as Tk}from"stream";import{callbackify as Ok}from"util";var Wl=({subprocess:e,concurrentStreams:t,encoding:r},{from:i,to:n,binary:s=!0,preserveNewlines:o=!0}={})=>{let a=s||ae.has(r),{subprocessStdout:c,waitReadableDestroy:d}=$o(e,i,t),{subprocessStdin:p,waitWritableFinal:u,waitWritableDestroy:l}=To(e,n,t),{readableEncoding:m,readableObjectMode:h,readableHighWaterMark:f}=Ao(c,a),{read:x,onStdoutDataDone:_}=Co({subprocessStdout:c,subprocess:e,binary:a,encoding:r,preserveNewlines:o}),S=new Tk({read:x,...Oo(p,e,u),destroy:Ok(Ik.bind(void 0,{subprocessStdout:c,subprocessStdin:p,subprocess:e,waitReadableDestroy:d,waitWritableFinal:u,waitWritableDestroy:l})),readableHighWaterMark:f,writableHighWaterMark:p.writableHighWaterMark,readableObjectMode:h,writableObjectMode:p.writableObjectMode,encoding:m});return Eo({subprocessStdout:c,onStdoutDataDone:_,readable:S,subprocess:e,subprocessStdin:p}),Io(p,S,c),S},Ik=async({subprocessStdout:e,subprocessStdin:t,subprocess:r,waitReadableDestroy:i,waitWritableFinal:n,waitWritableDestroy:s},o)=>{await Promise.all([Po({subprocessStdout:e,subprocess:r,waitReadableDestroy:i},o),Ro({subprocessStdin:t,subprocess:r,waitWritableFinal:n,waitWritableDestroy:s},o)])};var jo=(e,t,{from:r,binary:i=!1,preserveNewlines:n=!1}={})=>{let s=i||ae.has(t),o=Pt(e,r),a=Ki({subprocessStdout:o,subprocess:e,binary:s,shouldEncode:!0,encoding:t,preserveNewlines:n});return Rk(a,o,e)},Rk=async function*(e,t,r){try{yield*e}finally{t.readable&&t.destroy(),await r}};var Hl=(e,{encoding:t})=>{let r=Ml();e.readable=Ul.bind(void 0,{subprocess:e,concurrentStreams:r,encoding:t}),e.writable=zl.bind(void 0,{subprocess:e,concurrentStreams:r}),e.duplex=Wl.bind(void 0,{subprocess:e,concurrentStreams:r,encoding:t}),e.iterable=jo.bind(void 0,e,t),e[Symbol.asyncIterator]=jo.bind(void 0,e,t,{})};var Kl=(e,t)=>{for(let[r,i]of Dk){let n=i.value.bind(t);Reflect.defineProperty(e,r,{...i,value:n})}},jk=(async()=>{})().constructor.prototype,Dk=["then","catch","finally"].map(e=>[e,Reflect.getOwnPropertyDescriptor(jk,e)]);var Yl=(e,t,r,i)=>{let{file:n,commandArguments:s,command:o,escapedCommand:a,startTime:c,verboseInfo:d,options:p,fileDescriptors:u}=Fk(e,t,r),{subprocess:l,promise:m}=Uk({file:n,commandArguments:s,options:p,startTime:c,verboseInfo:d,command:o,escapedCommand:a,fileDescriptors:u});return l.pipe=Hi.bind(void 0,{source:l,sourcePromise:m,boundOptions:{},createNested:i}),Kl(l,m),Ee.set(l,{options:p,fileDescriptors:u}),l},Fk=(e,t,r)=>{let{command:i,escapedCommand:n,startTime:s,verboseInfo:o}=ti(e,t,r),{file:a,commandArguments:c,options:d}=ki(e,t,r),p=Bk(d),u=ol(p,o);return{file:a,commandArguments:c,command:i,escapedCommand:n,startTime:s,verboseInfo:o,options:p,fileDescriptors:u}},Bk=({timeout:e,signal:t,...r})=>{if(t!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:e}},Uk=({file:e,commandArguments:t,options:r,startTime:i,verboseInfo:n,command:s,escapedCommand:o,fileDescriptors:a})=>{let c;try{c=Mk(...vi(e,t,r))}catch(h){return rl({error:h,command:s,escapedCommand:o,fileDescriptors:a,options:r,startTime:i,verboseInfo:n})}let d=new AbortController;Lk(Number.POSITIVE_INFINITY,d.signal);let p=[...c.stdio];yl(c,a,d),gl(c,r,d);let u={},l=Ce();c.kill=Tp.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:l,context:u,controller:d}),c.all=Tl(c,r),Hl(c,r),Zu(c,r);let m=Nk({subprocess:c,options:r,startTime:i,verboseInfo:n,fileDescriptors:a,originalStreams:p,command:s,escapedCommand:o,context:u,onInternalError:l,controller:d});return{subprocess:c,promise:m}},Nk=async({subprocess:e,options:t,startTime:r,verboseInfo:i,fileDescriptors:n,originalStreams:s,command:o,escapedCommand:a,context:c,onInternalError:d,controller:p})=>{let[u,[l,m],h,f,x]=await Ll({subprocess:e,options:t,context:c,verboseInfo:i,fileDescriptors:n,originalStreams:s,onInternalError:d,controller:p});p.abort(),d.resolve();let _=h.map((P,w)=>Ge(P,t,w)),S=Ge(f,t,"all"),A=Gk({errorInfo:u,exitCode:l,signal:m,stdio:_,all:S,ipcOutput:x,context:c,options:t,command:o,escapedCommand:a,startTime:r});return Rt(A,i,t)},Gk=({errorInfo:e,exitCode:t,signal:r,stdio:i,all:n,ipcOutput:s,context:o,options:a,command:c,escapedCommand:d,startTime:p})=>"error"in e?ar({error:e.error,command:c,escapedCommand:d,timedOut:o.terminationReason==="timeout",isCanceled:o.terminationReason==="cancel"||o.terminationReason==="gracefulCancel",isGracefullyCanceled:o.terminationReason==="gracefulCancel",isMaxBuffer:e.error instanceof Pe,isForcefullyTerminated:o.isForcefullyTerminated,exitCode:t,signal:r,stdio:i,all:n,ipcOutput:s,options:a,startTime:p,isSync:!1}):Oi({command:c,escapedCommand:d,stdio:i,all:n,ipcOutput:s,options:a,startTime:p});var Qi=(e,t)=>{let r=Object.fromEntries(Object.entries(t).map(([i,n])=>[i,zk(i,e[i],n)]));return{...e,...r}},zk=(e,t,r)=>Vk.has(e)&&V(t)&&V(r)?{...t,...r}:r,Vk=new Set(["env",...ds]);var Ze=(e,t,r,i)=>{let n=(o,a,c)=>Ze(o,a,r,c),s=(...o)=>Wk({mapArguments:e,deepOptions:r,boundOptions:t,setBoundExeca:i,createNested:n},...o);return i!==void 0&&i(s,n,t),s},Wk=({mapArguments:e,deepOptions:t={},boundOptions:r={},setBoundExeca:i,createNested:n},s,...o)=>{if(V(s))return n(e,Qi(r,s),i);let{file:a,commandArguments:c,options:d,isSync:p}=Hk({mapArguments:e,firstArgument:s,nextArguments:o,deepOptions:t,boundOptions:r});return p?Hu(a,c,d):Yl(a,c,d,n)},Hk=({mapArguments:e,firstArgument:t,nextArguments:r,deepOptions:i,boundOptions:n})=>{let s=oc(t)?ac(t,r):[t,...r],[o,a,c]=zr(...s),d=Qi(Qi(i,n),c),{file:p=o,commandArguments:u=a,options:l=d,isSync:m=!1}=e({file:o,commandArguments:a,options:d});return{file:p,commandArguments:u,options:l,isSync:m}};var Jl=({file:e,commandArguments:t})=>Ql(e,t),Xl=({file:e,commandArguments:t})=>({...Ql(e,t),isSync:!0}),Ql=(e,t)=>{if(t.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${e} ${t}.`);let[r,...i]=Kk(e);return{file:r,commandArguments:i}},Kk=e=>{if(typeof e!="string")throw new TypeError(`The command must be a string: ${String(e)}.`);let t=e.trim();if(t==="")return[];let r=[];for(let i of t.split(Yk)){let n=r.at(-1);n&&n.endsWith("\\")?r[r.length-1]=`${n.slice(0,-1)} ${i}`:r.push(i)}return r},Yk=/ +/g;var Zl=(e,t,r)=>{e.sync=t(Jk,r),e.s=e.sync},em=({options:e})=>tm(e),Jk=({options:e})=>({...tm(e),isSync:!0}),tm=e=>({options:{...Xk(e),...e}}),Xk=({input:e,inputFile:t,stdio:r})=>e===void 0&&t===void 0&&r===void 0?{stdin:"inherit"}:{},rm={preferLocal:!0};var ce=Ze(()=>({})),gD=Ze(()=>({isSync:!0})),Zi=Ze(Jl),_D=Ze(Xl),bD=Ze(hd),xD=Ze(em,{},rm,Zl),{sendMessage:wD,getOneMessage:kD,getEachMessage:vD,getCancelSignal:SD}=el();var im=N(X(),1);async function H(e,t,r){return ce("docker",["compose",...e],{cwd:t,...r})}async function et(e,t){try{await H(["up","-d","--no-deps","web"],e,{stdio:t?.stdio??"inherit"})}catch{}}async function ee(e,t,r){let i=["compose","exec","-T"];if(r)for(let[s,o]of Object.entries(r))i.push("-e",`${s}=${o}`);i.push("web","bin/rails",e);let{stdout:n}=await ce("docker",i,{cwd:t});return n.split(`
76
143
  `).filter(s=>!s.startsWith("[")).join(`
77
- `).trim()}async function Fi(e,t){let{stdout:r}=await he("docker",["compose","ps",e,"--format","{{.State}}"],{cwd:t});return r.split(`
78
- `).some(i=>i.trim()==="running")}async function I(e,t,r={}){let{service:i="web",tty:n=!0,env:s}=r,o=["compose","exec"];if(n||o.push("-T"),s)for(let[a,c]of Object.entries(s))o.push("-e",`${a}=${c}`);o.push(i,...e),await he("docker",o,{cwd:t,stdio:"inherit"})}async function Bi(e,t){await he("docker",["compose","logs","-f",e],{cwd:t,stdio:"inherit"})}var ko=`http://localhost:${3e3}`,Qe=class extends Error{};function Tl(){return process.env.XDG_CONFIG_HOME?Dt.join(process.env.XDG_CONFIG_HOME,"spree"):Dt.join(dk.homedir(),".config","spree")}function mt(){return Dt.join(Tl(),"config.json")}function vo(e){return e?.code==="ENOENT"}function dr(){let e;try{e=Ne.readFileSync(mt(),"utf-8")}catch(t){if(vo(t))return{profiles:{}};throw t}try{let t=JSON.parse(e);return{...t,profiles:t.profiles??{}}}catch{let t=`${mt()}.bak`;try{Ne.renameSync(mt(),t)}catch{}return process.stderr.write(`${pr.default.yellow(`warning: ${mt()} was not valid JSON; moved it to ${t} and starting fresh.`)}
79
- `),{profiles:{}}}}function qo(e){Ne.mkdirSync(Tl(),{recursive:!0,mode:448}),Ol(mt(),`${JSON.stringify(e,null,2)}
80
- `)}function Ol(e,t){Ne.writeFileSync(e,t,{mode:384}),Ne.chmodSync(e,384)}function Ui(e){return Dt.join(e,".spree","credentials.json")}function uk(e){let t;try{t=Ne.readFileSync(Ui(e),"utf-8")}catch(r){if(vo(r))return null;throw r}try{return JSON.parse(t)}catch{return null}}function lk(e,t){let r=Ui(e),i=Dt.dirname(r);Ne.mkdirSync(i,{recursive:!0,mode:448}),mk(Dt.join(i,".gitignore")),Ol(r,`${JSON.stringify(t,null,2)}
81
- `)}function mk(e){let t="";try{t=Ne.readFileSync(e,"utf-8")}catch(i){if(!vo(i))throw i}t.split(`
82
- `).some(i=>i.trim()==="*")||Ne.writeFileSync(e,t&&!t.endsWith(`
144
+ `).trim()}async function ft(e,t){let{stdout:r}=await ce("docker",["compose","ps",e,"--format","{{.State}}"],{cwd:t});return r.split(`
145
+ `).some(i=>i.trim()==="running")}async function B(e,t,r={}){let{service:i="web",tty:n=!0,env:s}=r,o=["compose","exec"];if(n||o.push("-T"),s)for(let[a,c]of Object.entries(s))o.push("-e",`${a}=${c}`);o.push(i,...e),await ce("docker",o,{cwd:t,stdio:"inherit"})}async function Do(e,t,r={}){let{service:i="web",env:n,captureStderr:s=!1}=r,o=["compose","run","--rm"];if(n)for(let[c,d]of Object.entries(n))o.push("-e",`${c}=${d}`);o.push(i,...e),await ce("docker",o,{cwd:t,...s?{stdin:"inherit",stdout:"inherit",stderr:["pipe","inherit"]}:{stdio:"inherit"}})}async function en(e,t,r={}){let{service:i="web",env:n,edgeHint:s}=r;if(await ft(i,t)){await B(e,t,{service:i,env:n});return}qe(t)&&(M([`The ${i} container is not running, and this is a monorepo edge project.`,`Run ${im.default.bold("pnpm server:dev")} from the monorepo root${s?` \u2014 ${s}`:""}.`].join(`
146
+ `)),process.exit(1)),E.info(`${i} container is not running \u2014 using a one-off container (\`docker compose run\`) instead.`),await Do(e,t,{service:i,env:n})}async function tn(e,t){await ce("docker",["compose","logs","-f",e],{cwd:t,stdio:"inherit"})}var Lo=`http://localhost:${3e3}`,tt=class extends Error{};function nm(){return process.env.XDG_CONFIG_HOME?Mt.join(process.env.XDG_CONFIG_HOME,"spree"):Mt.join(Qk.homedir(),".config","spree")}function gt(){return Mt.join(nm(),"config.json")}function Mo(e){return e?.code==="ENOENT"}function yr(){let e;try{e=ze.readFileSync(gt(),"utf-8")}catch(t){if(Mo(t))return{profiles:{}};throw t}try{let t=JSON.parse(e);return{...t,profiles:t.profiles??{}}}catch{let t=`${gt()}.bak`;try{ze.renameSync(gt(),t)}catch{}return process.stderr.write(`${hr.default.yellow(`warning: ${gt()} was not valid JSON; moved it to ${t} and starting fresh.`)}
147
+ `),{profiles:{}}}}function Fo(e){ze.mkdirSync(nm(),{recursive:!0,mode:448}),sm(gt(),`${JSON.stringify(e,null,2)}
148
+ `)}function sm(e,t){ze.writeFileSync(e,t,{mode:384}),ze.chmodSync(e,384)}function rn(e){return Mt.join(e,".spree","credentials.json")}function Zk(e){let t;try{t=ze.readFileSync(rn(e),"utf-8")}catch(r){if(Mo(r))return null;throw r}try{return JSON.parse(t)}catch{return null}}function ev(e,t){let r=rn(e),i=Mt.dirname(r);ze.mkdirSync(i,{recursive:!0,mode:448}),tv(Mt.join(i,".gitignore")),sm(r,`${JSON.stringify(t,null,2)}
149
+ `)}function tv(e){let t="";try{t=ze.readFileSync(e,"utf-8")}catch(i){if(!Mo(i))throw i}t.split(`
150
+ `).some(i=>i.trim()==="*")||ze.writeFileSync(e,t&&!t.endsWith(`
83
151
  `)?`${t}
84
152
  *
85
153
  `:`${t}*
86
- `)}function Ni(e){return e.slice(0,12)}async function So(e,t,r=!1){r||process.stderr.write(`${pr.default.dim("No credentials found \u2014 minting a read-only API key via the dev stack...")}
87
- `);let i;try{i=await Q("spree:cli:create_api_key",e,{NAME:"@spree/cli (auto)",KEY_TYPE:"secret",SCOPES:"read_all"})}catch(o){let a=o instanceof Error?o.message.split(`
88
- `)[0]:String(o);throw new Qe(`Could not mint an API key via the dev stack. Is it running? Start it with \`spree dev\`.
89
- ${pr.default.dim(a)}`)}let n=i.match(/sk_[A-Za-z0-9_-]+/);if(!n)throw new Qe("Could not mint an API key via the dev stack. Is it running? Start it with `spree dev`.");let s={baseUrl:`http://localhost:${t}`,token:n[0],scopes:["read_all"],mintedAt:new Date().toISOString()};return lk(e,s),r||process.stderr.write(`${pr.default.dim("Saved to .spree/credentials.json (scopes: read_all)")}
90
- `),s}async function ur(e,t={}){let{allowMint:r=!0,cwd:i=process.cwd()}=t,n=dr(),s=e.baseUrl,o=e.apiKey,a;if(o&&(a={apiKey:o,source:"flags"}),!a&&e.profile){let p=n.profiles[e.profile];if(!p)throw new Qe(`Unknown profile "${e.profile}". Run \`spree auth login --profile ${e.profile}\` to create it.`);a={baseUrl:p.baseUrl,apiKey:p.token,source:"profile",profileName:e.profile}}if(!a&&process.env.SPREE_API_KEY&&(a={baseUrl:process.env.SPREE_BASE_URL,apiKey:process.env.SPREE_API_KEY,source:"env"}),!a){let p,u=0;try{let l=g(i);p=l.projectDir,u=l.port}catch{}if(p){let l=`http://localhost:${u}`,m=!s||s.replace(/\/$/,"")===l,h=uk(p);!h&&r&&m&&(h=await So(p,u)),h&&(a={baseUrl:h.baseUrl,apiKey:h.token,source:"project",scopes:h.scopes})}}if(!a&&n.defaultProfile){let p=n.profiles[n.defaultProfile];p&&(a={baseUrl:p.baseUrl,apiKey:p.token,source:"profile",profileName:n.defaultProfile})}let c=s??a?.baseUrl,d=a?.apiKey;if(!c&&(a?.source==="flags"||a?.source==="env")&&(c=ko),!c||!d)throw new Qe(["No Admin API credentials found. Provide them via one of (host and key resolve together per source):"," - flags: --api-key <sk_...> (host defaults to "+ko+"; pass --base-url for a remote store)"," - env: SPREE_API_KEY (host defaults to "+ko+"; set SPREE_BASE_URL for a remote store)"," - project: run inside a Spree project with the dev stack up (auto-mints a read-only key)"," - profile: spree auth login --profile <name>"].join(`
91
- `));return{baseUrl:c,apiKey:d,source:a?.source??"flags",profileName:a?.profileName,tokenPrefix:Ni(d),scopes:a?.scopes}}function lr(e,t="json"){if(e!=null){if(t==="table"){let r=fk(e);if(r){(0,$o.printTable)(r.map(Il));return}let i=Il(e);(0,$o.printTable)(Object.entries(i).map(([n,s])=>({field:n,value:s})));return}process.stdout.isTTY?process.stdout.write(`${yk(JSON.stringify(e,null,2))}
154
+ `)}function nn(e){return e.slice(0,12)}async function Bo(e,t,r=!1){r||process.stderr.write(`${hr.default.dim("No credentials found \u2014 minting a read-only API key via the dev stack...")}
155
+ `);let i;try{i=await ee("spree:cli:create_api_key",e,{NAME:"@spree/cli (auto)",KEY_TYPE:"secret",SCOPES:"read_all"})}catch(o){let a=o instanceof Error?o.message.split(`
156
+ `)[0]:String(o);throw new tt(`Could not mint an API key via the dev stack. Is it running? Start it with \`spree dev\`.
157
+ ${hr.default.dim(a)}`)}let n=i.match(/sk_[A-Za-z0-9_-]+/);if(!n)throw new tt("Could not mint an API key via the dev stack. Is it running? Start it with `spree dev`.");let s={baseUrl:`http://localhost:${t}`,token:n[0],scopes:["read_all"],mintedAt:new Date().toISOString()};return ev(e,s),r||process.stderr.write(`${hr.default.dim("Saved to .spree/credentials.json (scopes: read_all)")}
158
+ `),s}async function fr(e,t={}){let{allowMint:r=!0,cwd:i=process.cwd()}=t,n=yr(),s=e.baseUrl,o=e.apiKey,a;if(o&&(a={apiKey:o,source:"flags"}),!a&&e.profile){let p=n.profiles[e.profile];if(!p)throw new tt(`Unknown profile "${e.profile}". Run \`spree auth login --profile ${e.profile}\` to create it.`);a={baseUrl:p.baseUrl,apiKey:p.token,source:"profile",profileName:e.profile}}if(!a&&process.env.SPREE_API_KEY&&(a={baseUrl:process.env.SPREE_BASE_URL,apiKey:process.env.SPREE_API_KEY,source:"env"}),!a){let p,u=0;try{let l=g(i);p=l.projectDir,u=l.port}catch{}if(p){let l=`http://localhost:${u}`,m=!s||s.replace(/\/$/,"")===l,h=Zk(p);!h&&r&&m&&(h=await Bo(p,u)),h&&(a={baseUrl:h.baseUrl,apiKey:h.token,source:"project",scopes:h.scopes})}}if(!a&&n.defaultProfile){let p=n.profiles[n.defaultProfile];p&&(a={baseUrl:p.baseUrl,apiKey:p.token,source:"profile",profileName:n.defaultProfile})}let c=s??a?.baseUrl,d=a?.apiKey;if(!c&&(a?.source==="flags"||a?.source==="env")&&(c=Lo),!c||!d)throw new tt(["No Admin API credentials found. Provide them via one of (host and key resolve together per source):"," - flags: --api-key <sk_...> (host defaults to "+Lo+"; pass --base-url for a remote store)"," - env: SPREE_API_KEY (host defaults to "+Lo+"; set SPREE_BASE_URL for a remote store)"," - project: run inside a Spree project with the dev stack up (auto-mints a read-only key)"," - profile: spree auth login --profile <name>"].join(`
159
+ `));return{baseUrl:c,apiKey:d,source:a?.source??"flags",profileName:a?.profileName,tokenPrefix:nn(d),scopes:a?.scopes}}function gr(e,t="json"){if(e!=null){if(t==="table"){let r=nv(e);if(r){(0,Uo.printTable)(r.map(om));return}let i=om(e);(0,Uo.printTable)(Object.entries(i).map(([n,s])=>({field:n,value:s})));return}process.stdout.isTTY?process.stdout.write(`${iv(JSON.stringify(e,null,2))}
92
160
  `):process.stdout.write(`${JSON.stringify(e)}
93
- `)}}var hk=/("(?:\\.|[^"\\])*"(\s*:)?)|\b(true|false|null)\b|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)/g;function yk(e){return e.replace(hk,(t,r,i,n,s)=>r!==void 0?i?ce.default.cyan(r.slice(0,-i.length))+i:ce.default.green(r):n!==void 0?ce.default.yellow(n):s!==void 0?ce.default.yellow(s):t)}function fk(e){return Array.isArray(e)?e:e&&typeof e=="object"&&Array.isArray(e.data)?e.data:null}function Il(e){let t={};for(let[r,i]of Object.entries(e))i===null||["string","number","boolean"].includes(typeof i)?t[r]=i:Array.isArray(i)?t[r]=`[${i.length}]`:t[r]="{\u2026}";return t}function ht(e,t={}){if(e instanceof it){let i=e.details?`
94
- ${JSON.stringify({details:e.details},null,2)}`:"";process.stderr.write(`${ce.default.red(`${e.code}:`)} ${e.message}${i}
95
- `);let n=e.details?.required_scope;typeof n=="string"&&process.stderr.write(`${ce.default.dim(`Hint: this key lacks \`${n}\`. Create one that has it and use it:`)}
96
- ${ce.default.dim(` spree api-key create --type secret --scopes ${n}`)}
97
- ${ce.default.dim(" then pass it via --api-key <sk_...> or export SPREE_API_KEY=<sk_...>")}
98
- `),process.exit(1)}if(e instanceof Qe&&(process.stderr.write(`${ce.default.red("error:")} ${e.message}
99
- `),process.exit(2)),e instanceof TypeError&&/fetch failed/i.test(e.message)){let i=e.cause,n=i instanceof Error?i.message:i?String(i):"",s=t.baseUrl?` (${t.baseUrl})`:"";process.stderr.write(`${ce.default.red("error:")} could not reach the server${s}${n?`: ${n}`:""}
100
- `),process.stderr.write(`${ce.default.dim("Hint: check the URL, or run `spree api status` to diagnose reachability and credentials.")}
101
- `),process.exit(2)}let r=e instanceof Error?e.message:String(e);process.stderr.write(`${ce.default.red("error:")} ${r}
102
- `),process.exit(2)}function jl(e){let t=new Map;for(let i of e.query??[]){let n=i.indexOf("=");if(n<=0)throw new Error(`Invalid -q expression "${i}" \u2014 expected key=value (e.g. -q status_eq=active)`);let s=i.slice(0,n),o=i.slice(n+1),a=t.get(s);a?a.push(o):t.set(s,[o])}let r={};for(let[i,n]of t)n.length>1?r[`q[${i}][]`]=n:r[`q[${i}]`]=n[0];return e.sort&&(r.sort=e.sort),e.page!==void 0&&(r.page=Rl(e.page,"--page")),e.limit!==void 0&&(r.limit=Rl(e.limit,"--limit")),e.expand&&(r.expand=e.expand),e.fields&&(r.fields=e.fields),r}function Rl(e,t){if(!/^[1-9]\d*$/.test(e))throw new Error(`Invalid ${t} "${e}" \u2014 expected a positive integer`);return Number(e)}function mr(e){let t=e.startsWith("/")?e:`/${e}`,r="/api/v3/admin";return t===r?"/":t.startsWith(`${r}/`)?t.slice(r.length):t}var Lt=U(X(),1);async function hr(e,t){let r=Bt({baseUrl:e,secretKey:t,retry:!1});try{return{status:"connected",storeName:(await r.request("GET","/store",{}))?.name}}catch(i){return i instanceof it?i.status===401?{status:"unauthorized",message:i.message}:i.status===403?{status:"forbidden"}:{status:"unreachable",message:`server responded HTTP ${i.status}: ${i.message}`}:{status:"unreachable",message:i instanceof Error?i.message:String(i)}}}async function Dl(e,t){let r=Bt({baseUrl:e,secretKey:t,retry:!1});try{return(await r.apiKeys.current()).scopes??null}catch{return null}}function Gi(e){return e.status==="unauthorized"||e.status==="unreachable"}function zi(e){return{connected:Lt.default.green(`connected${e.storeName?` (${e.storeName})`:""}`),forbidden:Lt.default.green("connected")+Lt.default.dim(" (key valid; lacks read_settings for store details)"),unauthorized:Lt.default.red("key rejected (401)"),unreachable:Lt.default.red(`unreachable \u2014 ${e.message}`)}[e.status]}var Ll={info:{title:"Admin API",contact:{name:"Spree Commerce",url:"https://spreecommerce.org",email:"hello@spreecommerce.org"},description:`Spree Admin API v3 - Administrative API for managing products, orders, and store settings.
161
+ `)}}var rv=/("(?:\\.|[^"\\])*"(\s*:)?)|\b(true|false|null)\b|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)/g;function iv(e){return e.replace(rv,(t,r,i,n,s)=>r!==void 0?i?pe.default.cyan(r.slice(0,-i.length))+i:pe.default.green(r):n!==void 0?pe.default.yellow(n):s!==void 0?pe.default.yellow(s):t)}function nv(e){return Array.isArray(e)?e:e&&typeof e=="object"&&Array.isArray(e.data)?e.data:null}function om(e){let t={};for(let[r,i]of Object.entries(e))i===null||["string","number","boolean"].includes(typeof i)?t[r]=i:Array.isArray(i)?t[r]=`[${i.length}]`:t[r]="{\u2026}";return t}function _t(e,t={}){if(e instanceof nt){let i=e.details?`
162
+ ${JSON.stringify({details:e.details},null,2)}`:"";process.stderr.write(`${pe.default.red(`${e.code}:`)} ${e.message}${i}
163
+ `);let n=e.details?.required_scope;typeof n=="string"&&process.stderr.write(`${pe.default.dim(`Hint: this key lacks \`${n}\`. Create one that has it and use it:`)}
164
+ ${pe.default.dim(` spree api-key create --type secret --scopes ${n}`)}
165
+ ${pe.default.dim(" then pass it via --api-key <sk_...> or export SPREE_API_KEY=<sk_...>")}
166
+ `),process.exit(1)}if(e instanceof tt&&(process.stderr.write(`${pe.default.red("error:")} ${e.message}
167
+ `),process.exit(2)),e instanceof TypeError&&/fetch failed/i.test(e.message)){let i=e.cause,n=i instanceof Error?i.message:i?String(i):"",s=t.baseUrl?` (${t.baseUrl})`:"";process.stderr.write(`${pe.default.red("error:")} could not reach the server${s}${n?`: ${n}`:""}
168
+ `),process.stderr.write(`${pe.default.dim("Hint: check the URL, or run `spree api status` to diagnose reachability and credentials.")}
169
+ `),process.exit(2)}let r=e instanceof Error?e.message:String(e);process.stderr.write(`${pe.default.red("error:")} ${r}
170
+ `),process.exit(2)}function cm(e){let t=new Map;for(let i of e.query??[]){let n=i.indexOf("=");if(n<=0)throw new Error(`Invalid -q expression "${i}" \u2014 expected key=value (e.g. -q status_eq=active)`);let s=i.slice(0,n),o=i.slice(n+1),a=t.get(s);a?a.push(o):t.set(s,[o])}let r={};for(let[i,n]of t)n.length>1?r[`q[${i}][]`]=n:r[`q[${i}]`]=n[0];return e.sort&&(r.sort=e.sort),e.page!==void 0&&(r.page=am(e.page,"--page")),e.limit!==void 0&&(r.limit=am(e.limit,"--limit")),e.expand&&(r.expand=e.expand),e.fields&&(r.fields=e.fields),r}function am(e,t){if(!/^[1-9]\d*$/.test(e))throw new Error(`Invalid ${t} "${e}" \u2014 expected a positive integer`);return Number(e)}function _r(e){let t=e.startsWith("/")?e:`/${e}`,r="/api/v3/admin";return t===r?"/":t.startsWith(`${r}/`)?t.slice(r.length):t}var Ft=N(X(),1);async function br(e,t){let r=Nt({baseUrl:e,secretKey:t,retry:!1});try{return{status:"connected",storeName:(await r.request("GET","/store",{}))?.name}}catch(i){return i instanceof nt?i.status===401?{status:"unauthorized",message:i.message}:i.status===403?{status:"forbidden"}:{status:"unreachable",message:`server responded HTTP ${i.status}: ${i.message}`}:{status:"unreachable",message:i instanceof Error?i.message:String(i)}}}async function pm(e,t){let r=Nt({baseUrl:e,secretKey:t,retry:!1});try{return(await r.apiKeys.current()).scopes??null}catch{return null}}function sn(e){return e.status==="unauthorized"||e.status==="unreachable"}function on(e){return{connected:Ft.default.green(`connected${e.storeName?` (${e.storeName})`:""}`),forbidden:Ft.default.green("connected")+Ft.default.dim(" (key valid; lacks read_settings for store details)"),unauthorized:Ft.default.red("key rejected (401)"),unreachable:Ft.default.red(`unreachable \u2014 ${e.message}`)}[e.status]}var dm={info:{title:"Admin API",contact:{name:"Spree Commerce",url:"https://spreecommerce.org",email:"hello@spreecommerce.org"},description:`Spree Admin API v3 - Administrative API for managing products, orders, and store settings.
103
171
 
104
172
  ## Authentication
105
173
 
@@ -266,92 +334,24 @@ accepts Spree's payloads.
266
334
  repeated delivery failures), no notification email is sent.
267
335
 
268
336
 
269
- **Required scope:** \`write_webhooks\` (for API-key authentication).`,parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}}],responses:{"200":{description:"webhook endpoint disabled",content:{"application/json":{}}}},requestBody:{content:{"application/json":{schema:{type:"object",properties:{reason:{type:"string"}}}}}}}},"/api/v3/admin/categories":{get:{summary:"List categories",tags:["Categories"],security:[{api_key:[],bearer_auth:[]}],description:"Returns a paginated list of the store's categories (manual hierarchical taxons; rule-based collections are excluded).\n\n**Required scope:** `read_categories` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}},{name:"page",in:"query",required:!1,description:"Page number",schema:{type:"integer"}},{name:"limit",in:"query",required:!1,description:"Number of records per page",schema:{type:"integer"}},{name:"expand",in:"query",required:!1,description:"Comma-separated associations to expand (e.g., children, parent, ancestors).",schema:{type:"string"}}],responses:{"200":{description:"categories found",content:{"application/json":{schema:{type:"object",properties:{data:{type:"array",items:{$ref:"#/components/schemas/Category"}},meta:{$ref:"#/components/schemas/PaginationMeta"}},required:["data","meta"]}}}}}},post:{summary:"Create a category",tags:["Categories"],security:[{api_key:[],bearer_auth:[]}],description:"Creates a category. Nests under the parent when parent_id is given, otherwise creates a top-level category.\n\n**Required scope:** `write_categories` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}}],responses:{"201":{description:"category created",content:{"application/json":{schema:{$ref:"#/components/schemas/Category"}}}},"422":{description:"validation error",content:{"application/json":{schema:{$ref:"#/components/schemas/ErrorResponse"}}}}},requestBody:{content:{"application/json":{schema:{type:"object",properties:{name:{type:"string"},parent_id:{type:"string",description:"Prefixed ID of the parent category"},description:{type:"string"},permalink:{type:"string"},meta_title:{type:"string"},meta_description:{type:"string"},meta_keywords:{type:"string"},hide_from_nav:{type:"boolean"}},required:["name"]}}}}}},"/api/v3/admin/categories/{id}":{get:{summary:"Get a category",tags:["Categories"],security:[{api_key:[],bearer_auth:[]}],description:"Returns a single category by ID.\n\n**Required scope:** `read_categories` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}},{name:"id",in:"path",required:!0,description:"Category ID",schema:{type:"string"}},{name:"expand",in:"query",required:!1,description:"Comma-separated associations to expand (e.g., children, parent, ancestors).",schema:{type:"string"}}],responses:{"200":{description:"category found",content:{"application/json":{schema:{$ref:"#/components/schemas/Category"}}}},"404":{description:"category not found",content:{"application/json":{schema:{$ref:"#/components/schemas/ErrorResponse"}}}}}},patch:{summary:"Update a category",tags:["Categories"],security:[{api_key:[],bearer_auth:[]}],description:"Updates a category.\n\n**Required scope:** `write_categories` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}},{name:"id",in:"path",required:!0,description:"Category ID",schema:{type:"string"}}],responses:{"200":{description:"category updated",content:{"application/json":{schema:{$ref:"#/components/schemas/Category"}}}}},requestBody:{content:{"application/json":{schema:{type:"object",properties:{name:{type:"string"},parent_id:{type:"string",description:"Prefixed ID of the parent category"},description:{type:"string"},permalink:{type:"string"},meta_title:{type:"string"},meta_description:{type:"string"},meta_keywords:{type:"string"},hide_from_nav:{type:"boolean"}}}}}}},delete:{summary:"Delete a category",tags:["Categories"],security:[{api_key:[],bearer_auth:[]}],description:"Deletes a category and its descendants.\n\n**Required scope:** `write_categories` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}},{name:"id",in:"path",required:!0,description:"Category ID",schema:{type:"string"}}],responses:{"204":{description:"category deleted"}}}},"/api/v3/admin/categories/{id}/reposition":{patch:{summary:"Reposition a category",tags:["Categories"],security:[{api_key:[],bearer_auth:[]}],description:"Moves a category to a new parent and/or index within the tree.\n\n**Required scope:** `write_categories` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}},{name:"id",in:"path",required:!0,description:"Category ID",schema:{type:"string"}}],responses:{"200":{description:"category repositioned",content:{"application/json":{schema:{$ref:"#/components/schemas/Category"}}}}},requestBody:{content:{"application/json":{schema:{type:"object",properties:{new_parent_id:{type:"string",description:"Prefixed ID of the new parent (omit for top level)"},new_position:{type:"integer",description:"0-based index among the new parent's children"}},required:["new_position"]}}}}}},"/api/v3/admin/categories/{category_id}/products":{get:{summary:"List category products",tags:["Categories"],security:[{api_key:[],bearer_auth:[]}],description:"Products classified under the category, ordered by their classification position.\n\n**Required scope:** `read_categories` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}},{name:"category_id",in:"path",required:!0,description:"Category ID",schema:{type:"string"}}],responses:{"200":{description:"products found",content:{"application/json":{schema:{type:"object",properties:{data:{type:"array",items:{$ref:"#/components/schemas/Product"}},meta:{$ref:"#/components/schemas/PaginationMeta"}},required:["data","meta"]}}}}}},post:{summary:"Add a product to a category",tags:["Categories"],security:[{api_key:[],bearer_auth:[]}],description:"Classifies a product under the category (appended to the end).\n\n**Required scope:** `write_categories` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}},{name:"category_id",in:"path",required:!0,description:"Category ID",schema:{type:"string"}}],responses:{"201":{description:"product added",content:{"application/json":{schema:{$ref:"#/components/schemas/Product"}}}}},requestBody:{content:{"application/json":{schema:{type:"object",properties:{product_id:{type:"string"}},required:["product_id"]}}}}}},"/api/v3/admin/categories/{category_id}/products/{id}/reposition":{patch:{summary:"Reposition a category product",tags:["Categories"],security:[{api_key:[],bearer_auth:[]}],description:"Moves a product to a new index among the category's products.\n\n**Required scope:** `write_categories` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}},{name:"category_id",in:"path",required:!0,description:"Category ID",schema:{type:"string"}},{name:"id",in:"path",required:!0,description:"Product ID",schema:{type:"string"}}],responses:{"204":{description:"product repositioned"}},requestBody:{content:{"application/json":{schema:{type:"object",properties:{new_position:{type:"integer",description:"0-based index among the category's products"}},required:["new_position"]}}}}}}},components:{schemas:{PaginationMeta:{type:"object",properties:{page:{type:"integer"},limit:{type:"integer"},count:{type:"integer",description:"Total number of records"},pages:{type:"integer",description:"Total number of pages"},from:{type:"integer",description:"Index of first record on this page"},to:{type:"integer",description:"Index of last record on this page"},in:{type:"integer",description:"Number of records on this page"},previous:{type:"integer",nullable:!0,description:"Previous page number"},next:{type:"integer",nullable:!0,description:"Next page number"}},required:["page","limit","count","pages","from","to","in"]},ErrorResponse:{type:"object",properties:{error:{type:"object",properties:{code:{type:"string"},message:{type:"string"},details:{type:"object",description:"Field-specific validation errors",nullable:!0}},required:["code","message"]}},required:["error"]},AuthResponse:{type:"object",properties:{token:{type:"string",description:"JWT access token"},user:{$ref:"#/components/schemas/AdminUser"}},required:["token","user"]},PermissionRule:{type:"object",description:"A single permission rule (CanCanCan rule). Rules are applied in order, last-matching-wins.",properties:{allow:{type:"boolean",description:"true for `can`, false for `cannot`"},actions:{type:"array",items:{type:"string"},description:'Action names, e.g. ["read", "update"] or ["manage"]'},subjects:{type:"array",items:{type:"string"},description:'Subject class names, e.g. ["Spree::Product"] or ["all"]'},has_conditions:{type:"boolean",description:"True if the server-side rule has per-record conditions. The SPA shows the action optimistically and handles 403 from the API."}},required:["allow","actions","subjects","has_conditions"]},MeResponse:{type:"object",description:"Current admin user profile and serialized permissions",properties:{user:{$ref:"#/components/schemas/AdminUser"},permissions:{type:"array",items:{$ref:"#/components/schemas/PermissionRule"}}},required:["user","permissions"]},CheckoutRequirement:{type:"object",properties:{step:{type:"string",description:"Checkout step this requirement belongs to"},field:{type:"string",description:"Field that needs to be satisfied"},message:{type:"string",description:"Human-readable requirement message"}},required:["step","field","message"]},CartWarning:{type:"object",description:"A warning about a cart issue (e.g., item removed due to stock change)",properties:{code:{type:"string",description:"Machine-readable warning code"},message:{type:"string",description:"Human-readable warning message"},line_item_id:{type:"string",nullable:!0,description:"Prefixed line item ID (when applicable)"},variant_id:{type:"string",nullable:!0,description:"Prefixed variant ID (when applicable)"}},required:["code","message"]},FulfillmentManifestItem:{type:"object",description:"An item within a fulfillment \u2014 which line item and how many units are in this fulfillment",properties:{item_id:{type:"string",description:"Line item ID"},variant_id:{type:"string",description:"Variant ID"},quantity:{type:"integer",description:"Quantity in this fulfillment"}},required:["item_id","variant_id","quantity"]},AdminUserRoleAssignment:{type:"object",description:"A role assignment for the current store on a staff member",properties:{id:{type:"string",description:"Prefixed role ID"},name:{type:"string",description:"Role name"}},required:["id","name"]},PreferenceField:{type:"object",description:"A single configurable preference on a payment method, promotion rule/action, or calculator. The frontend uses `type` + `default` to render a sensible input.",properties:{key:{type:"string"},type:{type:"string",description:"string | text | password | integer | decimal | boolean | array | hash"},default:{description:"Default value (any JSON type), null when there is no default",nullable:!0}},required:["key","type"]},PromotionActionCalculator:{type:"object",description:"The action's nested calculator (when the action carries one \u2014 null for actions like `free_shipping`)",properties:{type:{type:"string",description:"Wire shorthand for the calculator subclass"},label:{type:"string"},preferences:{type:"object",additionalProperties:!0},preference_schema:{type:"array",items:{$ref:"#/components/schemas/PreferenceField"}}},required:["type","label","preferences","preference_schema"]},PromotionActionLineItem:{type:"object",description:"One row in a `create_line_items` action \u2014 the variant added to the order and how many",properties:{variant_id:{type:"string"},quantity:{type:"integer"}},required:["variant_id","quantity"]},Address:{type:"object",properties:{id:{type:"string"},first_name:{type:"string",nullable:!0},last_name:{type:"string",nullable:!0},full_name:{type:"string"},address1:{type:"string",nullable:!0},address2:{type:"string",nullable:!0},postal_code:{type:"string",nullable:!0},city:{type:"string",nullable:!0},phone:{type:"string",nullable:!0},company:{type:"string",nullable:!0},country_name:{type:"string"},country_iso:{type:"string"},state_text:{type:"string",nullable:!0},state_abbr:{type:"string",nullable:!0},quick_checkout:{type:"boolean"},is_default_billing:{type:"boolean"},is_default_shipping:{type:"boolean"},state_name:{type:"string",nullable:!0},label:{type:"string",nullable:!0},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},customer_id:{type:"string",nullable:!0}},required:["id","first_name","last_name","full_name","address1","address2","postal_code","city","phone","company","country_name","country_iso","state_text","state_abbr","quick_checkout","is_default_billing","is_default_shipping","state_name","label","metadata","created_at","updated_at","customer_id"],"x-typelizer":!0},Adjustment:{type:"object",properties:{id:{type:"string"},label:{type:"string"},display_amount:{type:"string"},included:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"},amount:{type:"string"},order_id:{type:"string",nullable:!0}},required:["id","label","display_amount","included","created_at","updated_at","amount","order_id"],"x-typelizer":!0},AdminUser:{type:"object",properties:{id:{type:"string"},email:{type:"string"},first_name:{type:"string",nullable:!0},last_name:{type:"string",nullable:!0},full_name:{type:"string",nullable:!0},selected_locale:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},roles:{type:"array",items:{$ref:"#/components/schemas/AdminUserRoleAssignment"}}},required:["id","email","first_name","last_name","full_name","selected_locale","created_at","updated_at","roles"],"x-typelizer":!0},AllowedOrigin:{type:"object",properties:{id:{type:"string"},origin:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","origin","created_at","updated_at"],"x-typelizer":!0},ApiKey:{type:"object",properties:{id:{type:"string"},name:{type:"string"},key_type:{type:"string"},token_prefix:{type:"string",nullable:!0},scopes:{type:"array",items:{type:"string"}},created_at:{type:"string"},updated_at:{type:"string"},revoked_at:{type:"string",nullable:!0},last_used_at:{type:"string",nullable:!0},plaintext_token:{type:"string",nullable:!0},created_by_email:{type:"string",nullable:!0}},required:["id","name","key_type","token_prefix","scopes","created_at","updated_at","revoked_at","last_used_at","plaintext_token","created_by_email"],"x-typelizer":!0},Category:{type:"object",properties:{id:{type:"string"},name:{type:"string"},permalink:{type:"string"},position:{type:"number"},depth:{type:"number"},meta_title:{type:"string",nullable:!0},meta_description:{type:"string",nullable:!0},meta_keywords:{type:"string",nullable:!0},children_count:{type:"number"},parent_id:{type:"string",nullable:!0},description:{type:"string"},description_html:{type:"string"},image_url:{type:"string",nullable:!0},square_image_url:{type:"string",nullable:!0},is_root:{type:"boolean"},is_child:{type:"boolean"},is_leaf:{type:"boolean"},parent:{$ref:"#/components/schemas/Category"},children:{type:"array",items:{$ref:"#/components/schemas/Category"}},ancestors:{type:"array",items:{$ref:"#/components/schemas/Category"}},custom_fields:{type:"array",items:{$ref:"#/components/schemas/CustomField"}},translations:{type:"object"},metadata:{type:"object"},pretty_name:{type:"string"},lft:{type:"number"},rgt:{type:"number"},products_count:{type:"number"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","name","permalink","position","depth","meta_title","meta_description","meta_keywords","children_count","parent_id","description","description_html","image_url","square_image_url","is_root","is_child","is_leaf","metadata","pretty_name","lft","rgt","products_count","created_at","updated_at"],"x-typelizer":!0},Channel:{type:"object",properties:{id:{type:"string"},name:{type:"string"},code:{type:"string"},active:{type:"boolean"},default:{type:"boolean"},preferred_order_routing_strategy:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","name","code","active","default","preferred_order_routing_strategy","created_at","updated_at"],"x-typelizer":!0},Country:{type:"object",properties:{iso:{type:"string"},iso3:{type:"string"},name:{type:"string"},states_required:{type:"boolean"},zipcode_required:{type:"boolean"},states:{type:"array",items:{$ref:"#/components/schemas/State"}},market:{allOf:[{$ref:"#/components/schemas/Market"}],nullable:!0},created_at:{type:"object"},updated_at:{type:"object"}},required:["iso","iso3","name","states_required","zipcode_required","created_at","updated_at"],"x-typelizer":!0},CouponCode:{type:"object",properties:{id:{type:"string"},code:{type:"string"},state:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},promotion_id:{type:"string"},order_id:{type:"string",nullable:!0}},required:["id","code","state","created_at","updated_at","promotion_id","order_id"],"x-typelizer":!0},CreditCard:{type:"object",properties:{id:{type:"string"},brand:{type:"string"},last4:{type:"string"},month:{type:"number"},year:{type:"number"},name:{type:"string",nullable:!0},default:{type:"boolean"},gateway_payment_profile_id:{type:"string",nullable:!0},customer_id:{type:"string",nullable:!0},payment_method_id:{type:"string",nullable:!0},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","brand","last4","month","year","name","default","gateway_payment_profile_id","customer_id","payment_method_id","metadata","created_at","updated_at"],"x-typelizer":!0},CustomFieldDefinition:{type:"object",properties:{id:{type:"string"},namespace:{type:"string"},key:{type:"string"},label:{type:"string"},field_type:{type:"string",enum:["short_text","long_text","rich_text","number","boolean","json"]},resource_type:{type:"string"},storefront_visible:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","namespace","key","label","field_type","resource_type","storefront_visible","created_at","updated_at"],"x-typelizer":!0},CustomField:{type:"object",properties:{id:{type:"string"},label:{type:"string"},type:{type:"string",deprecated:!0},field_type:{type:"string",enum:["short_text","long_text","rich_text","number","boolean","json"]},key:{type:"string"},value:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},storefront_visible:{type:"boolean"},custom_field_definition_id:{type:"string"}},required:["id","label","type","field_type","key","value","created_at","updated_at","storefront_visible","custom_field_definition_id"],"x-typelizer":!0},CustomerGroup:{type:"object",properties:{id:{type:"string"},name:{type:"string"},description:{type:"string",nullable:!0},customers_count:{type:"number"},created_at:{type:"string"},updated_at:{type:"string"},customers:{type:"array",items:{$ref:"#/components/schemas/Customer"}}},required:["id","name","description","customers_count","created_at","updated_at"],"x-typelizer":!0},Customer:{type:"object",properties:{id:{type:"string"},email:{type:"string"},first_name:{type:"string",nullable:!0},last_name:{type:"string",nullable:!0},phone:{type:"string",nullable:!0},accepts_email_marketing:{type:"boolean"},full_name:{type:"string"},available_store_credit_total:{type:"string"},display_available_store_credit_total:{type:"string"},addresses:{type:"array",items:{$ref:"#/components/schemas/Address"}},default_billing_address:{allOf:[{$ref:"#/components/schemas/Address"}],nullable:!0},default_shipping_address:{allOf:[{$ref:"#/components/schemas/Address"}],nullable:!0},login:{type:"string",nullable:!0},metadata:{type:"object"},last_sign_in_at:{type:"string",nullable:!0},current_sign_in_at:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},sign_in_count:{type:"number"},failed_attempts:{type:"number"},last_sign_in_ip:{type:"string",nullable:!0},current_sign_in_ip:{type:"string",nullable:!0},tags:{type:"array",items:{type:"string"}},internal_note_html:{type:"string",nullable:!0},default_billing_address_id:{type:"string",nullable:!0},default_shipping_address_id:{type:"string",nullable:!0},orders_count:{type:"number"},total_spent:{type:"string"},display_total_spent:{type:"string"},last_order_completed_at:{type:"string",nullable:!0},orders:{type:"array",items:{$ref:"#/components/schemas/Order"}},store_credits:{type:"array",items:{$ref:"#/components/schemas/StoreCredit"}},customer_group_ids:{type:"array",items:{type:"string"}},customer_groups:{type:"array",items:{$ref:"#/components/schemas/CustomerGroup"}}},required:["id","email","first_name","last_name","phone","accepts_email_marketing","full_name","available_store_credit_total","display_available_store_credit_total","login","metadata","last_sign_in_at","current_sign_in_at","created_at","updated_at","sign_in_count","failed_attempts","last_sign_in_ip","current_sign_in_ip","tags","internal_note_html","default_billing_address_id","default_shipping_address_id","orders_count","total_spent","display_total_spent","last_order_completed_at","customer_group_ids"],"x-typelizer":!0},DeliveryMethod:{type:"object",properties:{id:{type:"string"},name:{type:"string"},code:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","name","code","created_at","updated_at"],"x-typelizer":!0},DeliveryRate:{type:"object",properties:{id:{type:"string"},delivery_method_id:{type:"string"},name:{type:"string"},selected:{type:"boolean"},cost:{type:"string"},total:{type:"string"},additional_tax_total:{type:"string"},included_tax_total:{type:"string"},tax_total:{type:"string"},display_cost:{type:"string"},display_total:{type:"string"},display_additional_tax_total:{type:"string"},display_included_tax_total:{type:"string"},display_tax_total:{type:"string"},delivery_method:{$ref:"#/components/schemas/DeliveryMethod"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","delivery_method_id","name","selected","cost","total","additional_tax_total","included_tax_total","tax_total","display_cost","display_total","display_additional_tax_total","display_included_tax_total","display_tax_total","created_at","updated_at"],"x-typelizer":!0},DigitalLink:{type:"object",properties:{id:{type:"string"},access_counter:{type:"number"},filename:{type:"string"},content_type:{type:"string"},download_url:{type:"string"},authorizable:{type:"boolean"},expired:{type:"boolean"},access_limit_exceeded:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","access_counter","filename","content_type","download_url","authorizable","expired","access_limit_exceeded","created_at","updated_at"],"x-typelizer":!0},Discount:{type:"object",properties:{id:{type:"string"},promotion_id:{type:"string"},name:{type:"string"},description:{type:"string",nullable:!0},code:{type:"string",nullable:!0},amount:{type:"string"},display_amount:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","promotion_id","name","description","code","amount","display_amount","created_at","updated_at"],"x-typelizer":!0},Export:{type:"object",properties:{id:{type:"string"},number:{type:"string"},type:{type:"string",nullable:!0},format:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},user_id:{type:"string",nullable:!0},done:{type:"boolean"},filename:{type:"string",nullable:!0},byte_size:{type:"number",nullable:!0},download_url:{type:"string",nullable:!0}},required:["id","number","type","format","created_at","updated_at","user_id","done","filename","byte_size","download_url"],"x-typelizer":!0},Fulfillment:{type:"object",properties:{id:{type:"string"},number:{type:"string"},tracking:{type:"string",nullable:!0},tracking_url:{type:"string",nullable:!0},cost:{type:"string"},display_cost:{type:"string"},total:{type:"string"},display_total:{type:"string"},discount_total:{type:"string"},display_discount_total:{type:"string"},additional_tax_total:{type:"string"},display_additional_tax_total:{type:"string"},included_tax_total:{type:"string"},display_included_tax_total:{type:"string"},tax_total:{type:"string"},display_tax_total:{type:"string"},status:{type:"string"},fulfillment_type:{type:"string"},fulfilled_at:{type:"string",nullable:!0},items:{type:"array",items:{$ref:"#/components/schemas/FulfillmentManifestItem"}},delivery_method:{$ref:"#/components/schemas/DeliveryMethod"},stock_location:{$ref:"#/components/schemas/StockLocation"},delivery_rates:{type:"array",items:{$ref:"#/components/schemas/DeliveryRate"}},metadata:{type:"object"},adjustment_total:{type:"string"},pre_tax_amount:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"},order_id:{type:"string",nullable:!0},stock_location_id:{type:"string",nullable:!0},order:{$ref:"#/components/schemas/Order"},adjustments:{type:"array",items:{$ref:"#/components/schemas/Adjustment"}}},required:["id","number","tracking","tracking_url","cost","display_cost","total","display_total","discount_total","display_discount_total","additional_tax_total","display_additional_tax_total","included_tax_total","display_included_tax_total","tax_total","display_tax_total","status","fulfillment_type","fulfilled_at","items","metadata","adjustment_total","pre_tax_amount","created_at","updated_at","order_id","stock_location_id"],"x-typelizer":!0},GiftCardBatch:{type:"object",properties:{id:{type:"string"},codes_count:{type:"number"},currency:{type:"string",nullable:!0},prefix:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},amount:{type:"string",nullable:!0},expires_at:{type:"string",nullable:!0},created_by_id:{type:"string",nullable:!0}},required:["id","codes_count","currency","prefix","created_at","updated_at","amount","expires_at","created_by_id"],"x-typelizer":!0},GiftCard:{type:"object",properties:{id:{type:"string"},code:{type:"string"},status:{type:"string"},currency:{type:"string"},amount:{type:"string"},amount_used:{type:"string"},amount_authorized:{type:"string"},amount_remaining:{type:"string"},display_amount:{type:"string"},display_amount_used:{type:"string"},display_amount_remaining:{type:"string"},expires_at:{type:"string",nullable:!0},redeemed_at:{type:"string",nullable:!0},expired:{type:"boolean"},active:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"},customer_id:{type:"string",nullable:!0},created_by_id:{type:"string",nullable:!0},customer:{$ref:"#/components/schemas/Customer"},created_by:{$ref:"#/components/schemas/AdminUser"},gift_card_batch:{$ref:"#/components/schemas/GiftCardBatch"},orders:{type:"array",items:{$ref:"#/components/schemas/Order"}}},required:["id","code","status","currency","amount","amount_used","amount_authorized","amount_remaining","display_amount","display_amount_used","display_amount_remaining","expires_at","redeemed_at","expired","active","created_at","updated_at","customer_id","created_by_id"],"x-typelizer":!0},Invitation:{type:"object",properties:{id:{type:"string"},email:{type:"string"},status:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"},expires_at:{type:"string"},role_id:{type:"string"},role_name:{type:"string"},inviter_email:{type:"string"},acceptance_url:{type:"string"},invitee_exists:{type:"boolean"},store:{type:"object"}},required:["id","email","status","created_at","updated_at","expires_at","role_id","role_name","inviter_email","acceptance_url","invitee_exists","store"],"x-typelizer":!0},LineItem:{type:"object",properties:{id:{type:"string"},variant_id:{type:"string"},quantity:{type:"number"},currency:{type:"string"},name:{type:"string"},slug:{type:"string"},options_text:{type:"string"},price:{type:"string"},display_price:{type:"string"},total:{type:"string"},display_total:{type:"string"},adjustment_total:{type:"string"},display_adjustment_total:{type:"string"},additional_tax_total:{type:"string"},display_additional_tax_total:{type:"string"},included_tax_total:{type:"string"},display_included_tax_total:{type:"string"},discount_total:{type:"string"},display_discount_total:{type:"string"},pre_tax_amount:{type:"string"},display_pre_tax_amount:{type:"string"},discounted_amount:{type:"string"},display_discounted_amount:{type:"string"},display_compare_at_amount:{type:"string",nullable:!0},compare_at_amount:{type:"string",nullable:!0},thumbnail_url:{type:"string",nullable:!0},option_values:{type:"array",items:{$ref:"#/components/schemas/OptionValue"}},digital_links:{type:"array",items:{$ref:"#/components/schemas/DigitalLink"}},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},cost_price:{type:"string",nullable:!0},tax_category_id:{type:"string",nullable:!0},variant:{$ref:"#/components/schemas/Variant"},tax_category:{$ref:"#/components/schemas/TaxCategory"},adjustments:{type:"array",items:{$ref:"#/components/schemas/Adjustment"}}},required:["id","variant_id","quantity","currency","name","slug","options_text","price","display_price","total","display_total","adjustment_total","display_adjustment_total","additional_tax_total","display_additional_tax_total","included_tax_total","display_included_tax_total","discount_total","display_discount_total","pre_tax_amount","display_pre_tax_amount","discounted_amount","display_discounted_amount","display_compare_at_amount","compare_at_amount","thumbnail_url","option_values","digital_links","metadata","created_at","updated_at","cost_price","tax_category_id"],"x-typelizer":!0},Market:{type:"object",properties:{id:{type:"string"},name:{type:"string"},currency:{type:"string"},default_locale:{type:"string"},tax_inclusive:{type:"boolean"},default:{type:"boolean"},country_isos:{type:"array",items:{type:"string"}},supported_locales:{type:"array",items:{type:"string"}},countries:{type:"array",items:{$ref:"#/components/schemas/Country"}},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","name","currency","default_locale","tax_inclusive","default","country_isos","supported_locales","created_at","updated_at"],"x-typelizer":!0},Media:{type:"object",properties:{id:{type:"string"},product_id:{type:"string",nullable:!0},variant_ids:{type:"array",items:{type:"string"}},position:{type:"number"},alt:{type:"string",nullable:!0},media_type:{type:"string"},focal_point_x:{type:"number",nullable:!0},focal_point_y:{type:"number",nullable:!0},external_video_url:{type:"string",nullable:!0},original_url:{type:"string",nullable:!0},mini_url:{type:"string",nullable:!0},small_url:{type:"string",nullable:!0},medium_url:{type:"string",nullable:!0},large_url:{type:"string",nullable:!0},xlarge_url:{type:"string",nullable:!0},og_image_url:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},viewable_id:{type:"string"},download_url:{type:"string",nullable:!0},metadata:{type:"object"},viewable_type:{type:"string"}},required:["id","product_id","variant_ids","position","alt","media_type","focal_point_x","focal_point_y","external_video_url","original_url","mini_url","small_url","medium_url","large_url","xlarge_url","og_image_url","created_at","updated_at","viewable_id","download_url","metadata","viewable_type"],"x-typelizer":!0},OptionType:{type:"object",properties:{id:{type:"string"},name:{type:"string"},label:{type:"string"},position:{type:"number"},kind:{type:"string"},translations:{type:"object"},metadata:{type:"object"},filterable:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"},option_values:{type:"array",items:{$ref:"#/components/schemas/OptionValue"}}},required:["id","name","label","position","kind","metadata","filterable","created_at","updated_at"],"x-typelizer":!0},OptionValue:{type:"object",properties:{id:{type:"string"},option_type_id:{type:"string"},name:{type:"string"},label:{type:"string"},position:{type:"number"},color_code:{type:"string",nullable:!0},option_type_name:{type:"string"},option_type_label:{type:"string"},image_url:{type:"string",nullable:!0},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},option_type:{$ref:"#/components/schemas/OptionType"}},required:["id","option_type_id","name","label","position","color_code","option_type_name","option_type_label","image_url","metadata","created_at","updated_at"],"x-typelizer":!0},Order:{type:"object",properties:{id:{type:"string"},market_id:{type:"string",nullable:!0},channel_id:{type:"string",nullable:!0},number:{type:"string"},email:{type:"string"},customer_note:{type:"string",nullable:!0},currency:{type:"string"},locale:{type:"string",nullable:!0},total_quantity:{type:"number"},item_total:{type:"string"},display_item_total:{type:"string"},adjustment_total:{type:"string"},display_adjustment_total:{type:"string"},discount_total:{type:"string"},display_discount_total:{type:"string"},tax_total:{type:"string"},display_tax_total:{type:"string"},included_tax_total:{type:"string"},display_included_tax_total:{type:"string"},additional_tax_total:{type:"string"},display_additional_tax_total:{type:"string"},total:{type:"string"},display_total:{type:"string"},gift_card_total:{type:"string"},display_gift_card_total:{type:"string"},amount_due:{type:"string"},display_amount_due:{type:"string"},delivery_total:{type:"string"},display_delivery_total:{type:"string"},fulfillment_status:{type:"string",nullable:!0},payment_status:{type:"string",nullable:!0},completed_at:{type:"string",nullable:!0},store_credit_total:{type:"string"},display_store_credit_total:{type:"string"},covered_by_store_credit:{type:"boolean"},discounts:{type:"array",items:{$ref:"#/components/schemas/Discount"}},items:{type:"array",items:{$ref:"#/components/schemas/LineItem"}},fulfillments:{type:"array",items:{$ref:"#/components/schemas/Fulfillment"}},payments:{type:"array",items:{$ref:"#/components/schemas/Payment"}},billing_address:{allOf:[{$ref:"#/components/schemas/Address"}],nullable:!0},shipping_address:{allOf:[{$ref:"#/components/schemas/Address"}],nullable:!0},gift_card:{allOf:[{$ref:"#/components/schemas/GiftCard"}],nullable:!0},market:{allOf:[{$ref:"#/components/schemas/Market"}],nullable:!0},status:{type:"string"},last_ip_address:{type:"string",nullable:!0},considered_risky:{type:"boolean"},confirmation_delivered:{type:"boolean"},store_owner_notification_delivered:{type:"boolean"},payment_total:{type:"string"},display_payment_total:{type:"string"},metadata:{type:"object"},canceled_at:{type:"string",nullable:!0},approved_at:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},preferred_stock_location_id:{type:"string",nullable:!0},tags:{type:"array",items:{type:"string"}},internal_note:{type:"string",nullable:!0},approver_id:{type:"string",nullable:!0},canceler_id:{type:"string",nullable:!0},created_by_id:{type:"string",nullable:!0},customer_id:{type:"string",nullable:!0},channel:{$ref:"#/components/schemas/Channel"},preferred_stock_location:{$ref:"#/components/schemas/StockLocation"},payment_methods:{type:"array",items:{$ref:"#/components/schemas/PaymentMethod"}},customer:{$ref:"#/components/schemas/Customer"},approver:{$ref:"#/components/schemas/Customer"},canceler:{$ref:"#/components/schemas/Customer"},created_by:{$ref:"#/components/schemas/Customer"},adjustments:{type:"array",items:{$ref:"#/components/schemas/Adjustment"}},return_authorizations:{type:"array",items:{$ref:"#/components/schemas/ReturnAuthorization"}},reimbursements:{type:"array",items:{$ref:"#/components/schemas/Reimbursement"}}},required:["id","market_id","channel_id","number","email","customer_note","currency","locale","total_quantity","item_total","display_item_total","adjustment_total","display_adjustment_total","discount_total","display_discount_total","tax_total","display_tax_total","included_tax_total","display_included_tax_total","additional_tax_total","display_additional_tax_total","total","display_total","gift_card_total","display_gift_card_total","amount_due","display_amount_due","delivery_total","display_delivery_total","fulfillment_status","payment_status","completed_at","store_credit_total","display_store_credit_total","covered_by_store_credit","gift_card","market","status","last_ip_address","considered_risky","confirmation_delivered","store_owner_notification_delivered","payment_total","display_payment_total","metadata","canceled_at","approved_at","created_at","updated_at","preferred_stock_location_id","tags","internal_note","approver_id","canceler_id","created_by_id","customer_id"],"x-typelizer":!0},PaymentMethod:{type:"object",properties:{id:{type:"string"},name:{type:"string"},description:{type:"string",nullable:!0},type:{type:"string"},session_required:{type:"boolean"},source_required:{type:"boolean"},metadata:{type:"object"},active:{type:"boolean"},auto_capture:{type:"boolean",nullable:!0},storefront_visible:{type:"boolean"},position:{type:"number"},created_at:{type:"string"},updated_at:{type:"string"},preferences:{type:"object"},preference_schema:{type:"object"}},required:["id","name","description","type","session_required","source_required","metadata","active","auto_capture","storefront_visible","position","created_at","updated_at","preferences","preference_schema"],"x-typelizer":!0},Payment:{type:"object",properties:{id:{type:"string"},payment_method_id:{type:"string"},response_code:{type:"string",nullable:!0},number:{type:"string"},amount:{type:"string"},display_amount:{type:"string"},status:{type:"string"},source_type:{type:"string",nullable:!0,enum:["credit_card","store_credit","payment_source"]},source_id:{type:"string",nullable:!0},source:{anyOf:[{$ref:"#/components/schemas/CreditCard"},{$ref:"#/components/schemas/StoreCredit"},{$ref:"#/components/schemas/PaymentSource"}],nullable:!0},payment_method:{$ref:"#/components/schemas/PaymentMethod"},metadata:{type:"object"},avs_response:{type:"string",nullable:!0},cvv_response_code:{type:"string",nullable:!0},cvv_response_message:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},captured_amount:{type:"string"},order_id:{type:"string",nullable:!0},order:{$ref:"#/components/schemas/Order"},refunds:{type:"array",items:{$ref:"#/components/schemas/Refund"}}},required:["id","payment_method_id","response_code","number","amount","display_amount","status","source_type","source_id","source","metadata","avs_response","cvv_response_code","cvv_response_message","created_at","updated_at","captured_amount","order_id"],"x-typelizer":!0},PaymentSource:{type:"object",properties:{id:{type:"string"},gateway_payment_profile_id:{type:"string",nullable:!0},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","gateway_payment_profile_id","metadata","created_at","updated_at"],"x-typelizer":!0},PriceHistory:{type:"object",properties:{id:{type:"string"},amount:{type:"string"},amount_in_cents:{type:"number"},currency:{type:"string"},display_amount:{type:"string"},recorded_at:{type:"string"},variant_id:{type:"string"},price_id:{type:"string"},compare_at_amount:{type:"string",nullable:!0},created_at:{type:"string"}},required:["id","amount","amount_in_cents","currency","display_amount","recorded_at","variant_id","price_id","compare_at_amount","created_at"],"x-typelizer":!0},PriceList:{type:"object",properties:{id:{type:"string"},name:{type:"string"},description:{type:"string",nullable:!0},status:{type:"string"},position:{type:"number"},match_policy:{type:"string"},starts_at:{type:"string",nullable:!0},ends_at:{type:"string",nullable:!0},deleted_at:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},currently_active:{type:"boolean"},products_count:{type:"number"},prices_count:{type:"number"},product_ids:{type:"array",items:{type:"string"}},price_rules:{type:"array",items:{$ref:"#/components/schemas/PriceRule"}}},required:["id","name","description","status","position","match_policy","starts_at","ends_at","deleted_at","created_at","updated_at","currently_active","products_count","prices_count","product_ids"],"x-typelizer":!0},PriceRule:{type:"object",properties:{id:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"},type:{type:"string"},price_list_id:{type:"string"},preferences:{type:"object"},preference_schema:{type:"array",items:{$ref:"#/components/schemas/PreferenceField"}},label:{type:"string"},description:{type:"string",nullable:!0},markets:{type:"array",items:{$ref:"#/components/schemas/Market"}},customer_groups:{type:"array",items:{$ref:"#/components/schemas/CustomerGroup"}},customers:{type:"array",items:{$ref:"#/components/schemas/Customer"}}},required:["id","created_at","updated_at","type","price_list_id","preferences","preference_schema","label","description"],"x-typelizer":!0},Price:{type:"object",properties:{id:{type:"string"},amount:{type:"string",nullable:!0},amount_in_cents:{type:"number",nullable:!0},compare_at_amount:{type:"string",nullable:!0},compare_at_amount_in_cents:{type:"number",nullable:!0},currency:{type:"string",nullable:!0},display_amount:{type:"string",nullable:!0},display_compare_at_amount:{type:"string",nullable:!0},price_list_id:{type:"string",nullable:!0},variant_id:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},variant:{$ref:"#/components/schemas/Variant"}},required:["id","amount","amount_in_cents","compare_at_amount","compare_at_amount_in_cents","currency","display_amount","display_compare_at_amount","price_list_id","variant_id","created_at","updated_at"],"x-typelizer":!0},ProductPublication:{type:"object",properties:{id:{type:"string"},published_at:{type:"string",nullable:!0},unpublished_at:{type:"string",nullable:!0},product_id:{type:"string"},channel_id:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","published_at","unpublished_at","product_id","channel_id","created_at","updated_at"],"x-typelizer":!0},Product:{type:"object",properties:{id:{type:"string"},name:{type:"string"},slug:{type:"string"},meta_title:{type:"string",nullable:!0},meta_description:{type:"string",nullable:!0},meta_keywords:{type:"string",nullable:!0},variant_count:{type:"number"},available_on:{type:"string",nullable:!0},purchasable:{type:"boolean"},in_stock:{type:"boolean"},backorderable:{type:"boolean"},available:{type:"boolean"},description:{type:"string",nullable:!0},description_html:{type:"string",nullable:!0},default_variant_id:{type:"string"},thumbnail_url:{type:"string",nullable:!0},tags:{type:"array",items:{type:"string"}},price:{allOf:[{$ref:"#/components/schemas/Price"}],nullable:!0},original_price:{allOf:[{$ref:"#/components/schemas/Price"}],nullable:!0},primary_media:{$ref:"#/components/schemas/Media"},media:{type:"array",items:{$ref:"#/components/schemas/Media"}},variants:{type:"array",items:{$ref:"#/components/schemas/Variant"}},default_variant:{$ref:"#/components/schemas/Variant"},option_types:{type:"array",items:{$ref:"#/components/schemas/OptionType"}},option_values:{type:"array",items:{$ref:"#/components/schemas/OptionValue"}},categories:{type:"array",items:{$ref:"#/components/schemas/Category"}},custom_fields:{type:"array",items:{$ref:"#/components/schemas/CustomField"}},prior_price:{allOf:[{$ref:"#/components/schemas/PriceHistory"}],nullable:!0},translations:{type:"object"},status:{type:"string"},metadata:{type:"object"},deleted_at:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},tax_category_id:{type:"string",nullable:!0},product_publications:{type:"array",items:{$ref:"#/components/schemas/ProductPublication"}},channels:{type:"array",items:{$ref:"#/components/schemas/Channel"}}},required:["id","name","slug","meta_title","meta_description","meta_keywords","variant_count","available_on","purchasable","in_stock","backorderable","available","description","description_html","default_variant_id","thumbnail_url","tags","price","original_price","status","metadata","deleted_at","created_at","updated_at","tax_category_id"],"x-typelizer":!0},PromotionAction:{type:"object",properties:{id:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"},type:{type:"string"},promotion_id:{type:"string"},preferences:{type:"object"},preference_schema:{type:"array",items:{$ref:"#/components/schemas/PreferenceField"}},label:{type:"string"},calculator:{allOf:[{$ref:"#/components/schemas/PromotionActionCalculator"}],nullable:!0},line_items:{type:"array",items:{$ref:"#/components/schemas/PromotionActionLineItem"},nullable:!0}},required:["id","created_at","updated_at","type","promotion_id","preferences","preference_schema","label","calculator","line_items"],"x-typelizer":!0},PromotionRule:{type:"object",properties:{id:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"},type:{type:"string"},promotion_id:{type:"string"},preferences:{type:"object"},preference_schema:{type:"array",items:{$ref:"#/components/schemas/PreferenceField"}},label:{type:"string"},product_ids:{type:"array",items:{type:"string"},nullable:!0},category_ids:{type:"array",items:{type:"string"},nullable:!0},customer_ids:{type:"array",items:{type:"string"},nullable:!0},products:{type:"array",items:{$ref:"#/components/schemas/Product"}},categories:{type:"array",items:{$ref:"#/components/schemas/Category"}},customers:{type:"array",items:{$ref:"#/components/schemas/Customer"}},customer_groups:{type:"array",items:{$ref:"#/components/schemas/CustomerGroup"}},countries:{type:"array",items:{$ref:"#/components/schemas/Country"}}},required:["id","created_at","updated_at","type","promotion_id","preferences","preference_schema","label","product_ids","category_ids","customer_ids"],"x-typelizer":!0},Promotion:{type:"object",properties:{id:{type:"string"},name:{type:"string"},description:{type:"string",nullable:!0},code:{type:"string",nullable:!0},starts_at:{type:"string",nullable:!0},expires_at:{type:"string",nullable:!0},usage_limit:{type:"number",nullable:!0},match_policy:{type:"string",enum:["all","any"]},path:{type:"string",nullable:!0},kind:{type:"string",enum:["coupon_code","automatic"]},multi_codes:{type:"boolean"},number_of_codes:{type:"number",nullable:!0},code_prefix:{type:"string",nullable:!0},promotion_category_id:{type:"string",nullable:!0},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},action_ids:{type:"array",items:{type:"string"}},rule_ids:{type:"array",items:{type:"string"}}},required:["id","name","description","code","starts_at","expires_at","usage_limit","match_policy","path","kind","multi_codes","number_of_codes","code_prefix","promotion_category_id","metadata","created_at","updated_at","action_ids","rule_ids"],"x-typelizer":!0},Refund:{type:"object",properties:{id:{type:"string"},transaction_id:{type:"string",nullable:!0},amount:{type:"string",nullable:!0},payment_id:{type:"string",nullable:!0},refund_reason_id:{type:"string",nullable:!0},reimbursement_id:{type:"string",nullable:!0},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},payment:{$ref:"#/components/schemas/Payment"},reimbursement:{$ref:"#/components/schemas/Reimbursement"}},required:["id","transaction_id","amount","payment_id","refund_reason_id","reimbursement_id","metadata","created_at","updated_at"],"x-typelizer":!0},Reimbursement:{type:"object",properties:{id:{type:"string"},number:{type:"string"},reimbursement_status:{type:"string",nullable:!0},total:{type:"string",nullable:!0},order_id:{type:"string",nullable:!0},customer_return_id:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},order:{$ref:"#/components/schemas/Order"}},required:["id","number","reimbursement_status","total","order_id","customer_return_id","created_at","updated_at"],"x-typelizer":!0},ReturnAuthorization:{type:"object",properties:{id:{type:"string"},number:{type:"string"},status:{type:"string"},order_id:{type:"string",nullable:!0},stock_location_id:{type:"string",nullable:!0},return_authorization_reason_id:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},order:{$ref:"#/components/schemas/Order"},stock_location:{$ref:"#/components/schemas/StockLocation"}},required:["id","number","status","order_id","stock_location_id","return_authorization_reason_id","created_at","updated_at"],"x-typelizer":!0},Role:{type:"object",properties:{id:{type:"string"},name:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","name","created_at","updated_at"],"x-typelizer":!0},State:{type:"object",properties:{abbr:{type:"string"},name:{type:"string"},created_at:{type:"object"},updated_at:{type:"object"}},required:["abbr","name","created_at","updated_at"],"x-typelizer":!0},StockItem:{type:"object",properties:{id:{type:"string"},count_on_hand:{type:"number"},backorderable:{type:"boolean"},stock_location_id:{type:"string",nullable:!0},variant_id:{type:"string",nullable:!0},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},allocated_count:{type:"number"},available_count:{type:"number"},stock_location:{$ref:"#/components/schemas/StockLocation"},variant:{$ref:"#/components/schemas/Variant"}},required:["id","count_on_hand","backorderable","stock_location_id","variant_id","metadata","created_at","updated_at","allocated_count","available_count"],"x-typelizer":!0},StockLocation:{type:"object",properties:{id:{type:"string"},state_abbr:{type:"string",nullable:!0},name:{type:"string"},address1:{type:"string",nullable:!0},city:{type:"string",nullable:!0},zipcode:{type:"string",nullable:!0},country_iso:{type:"string",nullable:!0},country_name:{type:"string",nullable:!0},state_text:{type:"string",nullable:!0},admin_name:{type:"string",nullable:!0},address2:{type:"string",nullable:!0},state_name:{type:"string",nullable:!0},phone:{type:"string",nullable:!0},company:{type:"string",nullable:!0},active:{type:"boolean"},default:{type:"boolean"},backorderable_default:{type:"boolean"},propagate_all_variants:{type:"boolean"},kind:{type:"string"},pickup_enabled:{type:"boolean"},pickup_stock_policy:{type:"string"},pickup_ready_in_minutes:{type:"number",nullable:!0},pickup_instructions:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","state_abbr","name","address1","city","zipcode","country_iso","country_name","state_text","admin_name","address2","state_name","phone","company","active","default","backorderable_default","propagate_all_variants","kind","pickup_enabled","pickup_stock_policy","pickup_ready_in_minutes","pickup_instructions","created_at","updated_at"],"x-typelizer":!0},StockReservation:{type:"object",properties:{id:{type:"string"},stock_item_id:{type:"string"},line_item_id:{type:"string"},order_id:{type:"string"},variant_id:{type:"string",nullable:!0},stock_location_id:{type:"string",nullable:!0},quantity:{type:"number"},expires_at:{type:"string"},active:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","stock_item_id","line_item_id","order_id","variant_id","stock_location_id","quantity","expires_at","active","created_at","updated_at"],"x-typelizer":!0},StockTransfer:{type:"object",properties:{id:{type:"string"},number:{type:"string"},reference:{type:"string",nullable:!0},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},source_location_id:{type:"string",nullable:!0},destination_location_id:{type:"string",nullable:!0},source_location:{$ref:"#/components/schemas/StockLocation"},destination_location:{$ref:"#/components/schemas/StockLocation"}},required:["id","number","reference","metadata","created_at","updated_at","source_location_id","destination_location_id"],"x-typelizer":!0},StoreCreditCategory:{type:"object",properties:{id:{type:"string"},name:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"},non_expiring:{type:"boolean"}},required:["id","name","created_at","updated_at","non_expiring"],"x-typelizer":!0},StoreCredit:{type:"object",properties:{id:{type:"string"},amount:{type:"string"},amount_used:{type:"string"},amount_remaining:{type:"string"},display_amount:{type:"string"},display_amount_used:{type:"string"},display_amount_remaining:{type:"string"},currency:{type:"string"},memo:{type:"string",nullable:!0},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},customer_id:{type:"string",nullable:!0},created_by_id:{type:"string",nullable:!0},category_id:{type:"string",nullable:!0},category_name:{type:"string",nullable:!0}},required:["id","amount","amount_used","amount_remaining","display_amount","display_amount_used","display_amount_remaining","currency","memo","metadata","created_at","updated_at","customer_id","created_by_id","category_id","category_name"],"x-typelizer":!0},Store:{type:"object",properties:{id:{type:"string"},metadata:{type:"object"},name:{type:"string"},default_currency:{type:"string"},default_locale:{type:"string"},mail_from_address:{type:"string",nullable:!0},customer_support_email:{type:"string",nullable:!0},new_order_notifications_email:{type:"string",nullable:!0},preferred_send_consumer_transactional_emails:{type:"boolean"},preferred_admin_locale:{type:"string",nullable:!0},preferred_timezone:{type:"string"},preferred_weight_unit:{type:"string"},preferred_unit_system:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"},url:{type:"string"},supported_currencies:{type:"array",items:{type:"string"}},supported_locales:{type:"array",items:{type:"string"}},available_locales:{type:"array",items:{type:"string"}},logo_url:{type:"string",nullable:!0},mailer_logo_url:{type:"string",nullable:!0}},required:["id","metadata","name","default_currency","default_locale","mail_from_address","customer_support_email","new_order_notifications_email","preferred_send_consumer_transactional_emails","preferred_admin_locale","preferred_timezone","preferred_weight_unit","preferred_unit_system","created_at","updated_at","url","supported_currencies","supported_locales","available_locales","logo_url","mailer_logo_url"],"x-typelizer":!0},TaxCategory:{type:"object",properties:{id:{type:"string"},name:{type:"string"},tax_code:{type:"string",nullable:!0},description:{type:"string",nullable:!0},is_default:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","name","tax_code","description","is_default","created_at","updated_at"],"x-typelizer":!0},Variant:{type:"object",properties:{id:{type:"string"},product_id:{type:"string"},sku:{type:"string",nullable:!0},options_text:{type:"string"},track_inventory:{type:"boolean"},media_count:{type:"number"},thumbnail_url:{type:"string",nullable:!0},purchasable:{type:"boolean"},in_stock:{type:"boolean"},backorderable:{type:"boolean"},weight:{type:"number",nullable:!0},height:{type:"number",nullable:!0},width:{type:"number",nullable:!0},depth:{type:"number",nullable:!0},price:{$ref:"#/components/schemas/Price"},original_price:{allOf:[{$ref:"#/components/schemas/Price"}],nullable:!0},primary_media:{$ref:"#/components/schemas/Media"},media:{type:"array",items:{$ref:"#/components/schemas/Media"}},option_values:{type:"array",items:{$ref:"#/components/schemas/OptionValue"}},custom_fields:{type:"array",items:{$ref:"#/components/schemas/CustomField"}},prior_price:{allOf:[{$ref:"#/components/schemas/PriceHistory"}],nullable:!0},metadata:{type:"object"},position:{type:"number"},cost_price:{type:"string",nullable:!0},cost_currency:{type:"string",nullable:!0},barcode:{type:"string",nullable:!0},weight_unit:{type:"string",nullable:!0},dimensions_unit:{type:"string",nullable:!0},deleted_at:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},tax_category_id:{type:"string",nullable:!0},available_stock:{type:"number",nullable:!0},reserved_quantity:{type:"number"},total_on_hand:{type:"number",nullable:!0},product_name:{type:"string"},prices:{type:"array",items:{$ref:"#/components/schemas/Price"}},stock_items:{type:"array",items:{$ref:"#/components/schemas/StockItem"}}},required:["id","product_id","sku","options_text","track_inventory","media_count","thumbnail_url","purchasable","in_stock","backorderable","weight","height","width","depth","price","original_price","option_values","metadata","position","cost_price","cost_currency","barcode","weight_unit","dimensions_unit","deleted_at","created_at","updated_at","tax_category_id","available_stock","reserved_quantity","total_on_hand","product_name"],"x-typelizer":!0},WebhookDelivery:{type:"object",properties:{id:{type:"string"},event_name:{type:"string"},event_id:{type:"string",nullable:!0},response_code:{type:"number",nullable:!0},execution_time:{type:"number",nullable:!0},error_type:{type:"string",nullable:!0},request_errors:{type:"string",nullable:!0},response_body:{type:"string",nullable:!0},success:{type:"boolean",nullable:!0},payload:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},delivered_at:{type:"string",nullable:!0},webhook_endpoint_id:{type:"string"},webhook_endpoint_url:{type:"string"}},required:["id","event_name","event_id","response_code","execution_time","error_type","request_errors","response_body","success","payload","created_at","updated_at","delivered_at","webhook_endpoint_id","webhook_endpoint_url"],"x-typelizer":!0},WebhookEndpoint:{type:"object",properties:{id:{type:"string"},name:{type:"string",nullable:!0},url:{type:"string"},active:{type:"boolean"},subscriptions:{type:"array",items:{type:"string"}},disabled_reason:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},disabled_at:{type:"string",nullable:!0},secret_key:{type:"string",nullable:!0},last_delivery_at:{type:"string",nullable:!0},recent_delivery_count:{type:"number"},recent_failure_count:{type:"number"},total_delivery_count:{type:"number"},successful_delivery_count:{type:"number"},failed_delivery_count:{type:"number"}},required:["id","name","url","active","subscriptions","disabled_reason","created_at","updated_at","disabled_at","secret_key","last_delivery_at","recent_delivery_count","recent_failure_count","total_delivery_count","successful_delivery_count","failed_delivery_count"],"x-typelizer":!0}}}};var Fl=new Set(["get","post","put","patch","delete"]);function Vi(){return Ll}function _k(e){let t=e.description?.match(/\*\*Required scope:\*\* (.+?) \(for API-key authentication\)\./);return t?t[1].replaceAll("`",""):"\u2014"}function Bl(e,t={}){let r=[];for(let[i,n]of Object.entries(e.paths)){let s=i.replace("/api/v3/admin","")||"/";for(let[o,a]of Object.entries(n)){if(!Fl.has(o))continue;if(t.resource){let d=s.split("/")[1]??"";if(d!==t.resource&&!d.startsWith(t.resource))continue}let c=a.summary??"";t.search&&!`${o} ${s} ${c}`.toLowerCase().includes(t.search.toLowerCase())||r.push({method:o.toUpperCase(),path:s,scope:_k(a),summary:c})}}return r}function Ul(e,t){let r=t.trim().split(/\s+/),i=r.length>1?r[0].toLowerCase():void 0,n=r.length>1?r[1]:r[0],s=mr(n),o=Ml(e,i,a=>a===s);return o.length>0?o:Ml(e,i,a=>bk(a,s))}function Ml(e,t,r){let i=[];for(let[n,s]of Object.entries(e.paths)){let o=n.replace("/api/v3/admin","")||"/";if(r(o))for(let[a,c]of Object.entries(s))Fl.has(a)&&(t&&a!==t||i.push({method:a.toUpperCase(),path:o,summary:c.summary,description:c.description,parameters:Mt(c.parameters,e),requestBody:Mt(c.requestBody,e),responses:Mt(c.responses,e)}))}return i}function bk(e,t){if(e===t)return!0;let r=e.split("/"),i=t.split("/");return r.length!==i.length?!1:r.every((n,s)=>n.startsWith("{")&&n.endsWith("}")?i[s].length>0:n===i[s])}var xk=8;function Mt(e,t,r=[]){if(Array.isArray(e))return e.map(o=>Mt(o,t,r));if(!e||typeof e!="object")return e;let i=e,n=i.$ref;if(typeof n=="string"){let o=n.replace("#/components/schemas/","");return r.includes(o)||r.length>=xk||!(o in t.components.schemas)?{$ref:n}:Mt(t.components.schemas[o],t,[...r,o])}let s={};for(let[o,a]of Object.entries(i))s[o]=Mt(a,t,r);return s}function wk(e,t){return[...t,e]}function Vl(e){return e.option("--profile <name>","use a saved profile (see `spree auth`)").option("--base-url <url>","store URL (overrides profile/env/project)").option("--api-key <key>","secret API key (prefer SPREE_API_KEY \u2014 flags leak into shell history)").option("--store-id <id>","X-Spree-Store-Id for hosts serving multiple stores")}function Wl(){return new ra("--format <format>","output format").choices(["json","table"]).default("json")}function Nl(e){return Vl(e).addOption(Wl())}async function Gl(e){let t=await ur({baseUrl:e.baseUrl,apiKey:e.apiKey,profile:e.profile});return{client:Bt({baseUrl:t.baseUrl,secretKey:t.apiKey,...e.storeId?{storeId:e.storeId}:{}}),credentials:t}}function Hl(e){let t=e.command("api").description("Call the Admin API directly (generic get/post/patch/delete)");t.addHelpText("after",["","Examples:"," spree api get /products -q status_eq=active --limit 10",` spree api post /products -d '{"name":"Classic Tee","prices":[{"currency":"USD","amount":"29.99"}]}'`," spree api get /orders/ord_x8k2J9aQ --expand items,payments","","Discover the surface (offline, no server needed):"," spree api endpoints --search <term> # find endpoints + required scopes",' spree api schema "POST /orders" # request/response schema for one operation'," spree completion zsh # tab-completion for paths, filters, scopes"].join(`
270
- `)),Nl(t.command("get <path>").description("GET an Admin API path, e.g. `spree api get /products -q status_eq=active`").option("-q, --query <expr>","Ransack predicate key=value (repeatable)",wk,[]).option("--sort <fields>","sort, e.g. -created_at").option("--page <n>","page number").option("--limit <n>","page size (max 100)").option("--expand <relations>","expand relations, e.g. variants,variants.prices").option("--fields <fields>","sparse fields, e.g. id,name")).action(async(r,i)=>{let n;try{let s=jl(i),{client:o,credentials:a}=await Gl(i);n=a.baseUrl;let c=await o.request("GET",mr(r),{params:s});lr(c,i.format)}catch(s){ht(s,{baseUrl:n})}});for(let r of["post","patch","delete"])Nl(t.command(`${r} <path>`).description(`${r.toUpperCase()} an Admin API path`).option("-d, --data <json>","request body: inline JSON, @file, or '-' for stdin")).action(async(i,n)=>{let s;try{let o=await $a(n.data),{client:a,credentials:c}=await Gl(n);s=c.baseUrl;let d=await a.request(r.toUpperCase(),mr(i),{...o===Gn?{}:{body:o}});lr(d,n.format)}catch(o){ht(o,{baseUrl:s})}});t.command("endpoints").description("List Admin API endpoints with their required scopes").option("--resource <name>","filter by first path segment, e.g. orders").option("--search <term>","filter by method, path, or summary").addOption(Wl()).action(r=>{let i=Bl(Vi(),{resource:r.resource,search:r.search});if(i.length===0){process.stderr.write(`No endpoints match.
271
- `),process.exitCode=1;return}if(r.format==="table"){(0,zl.printTable)(i.map(n=>({Method:n.method,Path:n.path,Scope:n.scope,Summary:n.summary})));return}lr(i,"json")}),t.command("schema <operation>").description('Show the request/response schema for an operation, e.g. `spree api schema "POST /products"`').action(r=>{let i=Ul(Vi(),r);if(i.length===0){process.stderr.write(`No operation matches "${r}". Try \`spree api endpoints --search ${r.split(/\s+/).pop()}\`.
272
- `),process.exitCode=1;return}let n=/\s/.test(r.trim());lr(n&&i.length===1?i[0]:i,"json")}),Vl(t.command("status").description("Show resolved credentials, server reachability, and the bundled spec version")).action(async r=>{try{let i=await ur({baseUrl:r.baseUrl,apiKey:r.apiKey,profile:r.profile},{allowMint:!1}),n=await hr(i.baseUrl,i.apiKey),s=Vi(),o=zi(n),a=[`${we.default.bold("Base URL:")} ${i.baseUrl}`,`${we.default.bold("Credentials:")} ${i.source}${i.profileName?` (${i.profileName})`:""}, key ${i.tokenPrefix}${we.default.dim("\u2026")}`],c=n.status==="unreachable"||n.status==="unauthorized"?null:await Dl(i.baseUrl,i.apiKey);c!==null?a.push(`${we.default.bold("Scopes:")} ${c.length?c.join(", "):we.default.dim("(none)")}`):i.scopes?.length&&a.push(`${we.default.bold("Scopes:")} ${i.scopes.join(", ")} ${we.default.dim("(local snapshot from mint time \u2014 may be stale)")}`),a.push(`${we.default.bold("Server:")} ${o}`),a.push(`${we.default.bold("Bundled spec:")} ${s.info?.version??"unknown"} ${we.default.dim("(spree api endpoints/schema reflect this snapshot, not the live server)")}`),process.stdout.write(`${a.join(`
337
+ **Required scope:** \`write_webhooks\` (for API-key authentication).`,parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}}],responses:{"200":{description:"webhook endpoint disabled",content:{"application/json":{}}}},requestBody:{content:{"application/json":{schema:{type:"object",properties:{reason:{type:"string"}}}}}}}},"/api/v3/admin/categories":{get:{summary:"List categories",tags:["Categories"],security:[{api_key:[],bearer_auth:[]}],description:"Returns a paginated list of the store's categories (manual hierarchical taxons; rule-based collections are excluded).\n\n**Required scope:** `read_categories` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}},{name:"page",in:"query",required:!1,description:"Page number",schema:{type:"integer"}},{name:"limit",in:"query",required:!1,description:"Number of records per page",schema:{type:"integer"}},{name:"expand",in:"query",required:!1,description:"Comma-separated associations to expand (e.g., children, parent, ancestors).",schema:{type:"string"}}],responses:{"200":{description:"categories found",content:{"application/json":{schema:{type:"object",properties:{data:{type:"array",items:{$ref:"#/components/schemas/Category"}},meta:{$ref:"#/components/schemas/PaginationMeta"}},required:["data","meta"]}}}}}},post:{summary:"Create a category",tags:["Categories"],security:[{api_key:[],bearer_auth:[]}],description:"Creates a category. Nests under the parent when parent_id is given, otherwise creates a top-level category.\n\n**Required scope:** `write_categories` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}}],responses:{"201":{description:"category created",content:{"application/json":{schema:{$ref:"#/components/schemas/Category"}}}},"422":{description:"validation error",content:{"application/json":{schema:{$ref:"#/components/schemas/ErrorResponse"}}}}},requestBody:{content:{"application/json":{schema:{type:"object",properties:{name:{type:"string"},parent_id:{type:"string",description:"Prefixed ID of the parent category"},description:{type:"string"},permalink:{type:"string"},meta_title:{type:"string"},meta_description:{type:"string"},meta_keywords:{type:"string"},hide_from_nav:{type:"boolean"}},required:["name"]}}}}}},"/api/v3/admin/categories/{id}":{get:{summary:"Get a category",tags:["Categories"],security:[{api_key:[],bearer_auth:[]}],description:"Returns a single category by ID.\n\n**Required scope:** `read_categories` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}},{name:"id",in:"path",required:!0,description:"Category ID",schema:{type:"string"}},{name:"expand",in:"query",required:!1,description:"Comma-separated associations to expand (e.g., children, parent, ancestors).",schema:{type:"string"}}],responses:{"200":{description:"category found",content:{"application/json":{schema:{$ref:"#/components/schemas/Category"}}}},"404":{description:"category not found",content:{"application/json":{schema:{$ref:"#/components/schemas/ErrorResponse"}}}}}},patch:{summary:"Update a category",tags:["Categories"],security:[{api_key:[],bearer_auth:[]}],description:"Updates a category.\n\n**Required scope:** `write_categories` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}},{name:"id",in:"path",required:!0,description:"Category ID",schema:{type:"string"}}],responses:{"200":{description:"category updated",content:{"application/json":{schema:{$ref:"#/components/schemas/Category"}}}}},requestBody:{content:{"application/json":{schema:{type:"object",properties:{name:{type:"string"},parent_id:{type:"string",description:"Prefixed ID of the parent category"},description:{type:"string"},permalink:{type:"string"},meta_title:{type:"string"},meta_description:{type:"string"},meta_keywords:{type:"string"},hide_from_nav:{type:"boolean"}}}}}}},delete:{summary:"Delete a category",tags:["Categories"],security:[{api_key:[],bearer_auth:[]}],description:"Deletes a category and its descendants.\n\n**Required scope:** `write_categories` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}},{name:"id",in:"path",required:!0,description:"Category ID",schema:{type:"string"}}],responses:{"204":{description:"category deleted"}}}},"/api/v3/admin/categories/{id}/reposition":{patch:{summary:"Reposition a category",tags:["Categories"],security:[{api_key:[],bearer_auth:[]}],description:"Moves a category to a new parent and/or index within the tree.\n\n**Required scope:** `write_categories` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}},{name:"id",in:"path",required:!0,description:"Category ID",schema:{type:"string"}}],responses:{"200":{description:"category repositioned",content:{"application/json":{schema:{$ref:"#/components/schemas/Category"}}}}},requestBody:{content:{"application/json":{schema:{type:"object",properties:{new_parent_id:{type:"string",description:"Prefixed ID of the new parent (omit for top level)"},new_position:{type:"integer",description:"0-based index among the new parent's children"}},required:["new_position"]}}}}}},"/api/v3/admin/categories/{category_id}/products":{get:{summary:"List category products",tags:["Categories"],security:[{api_key:[],bearer_auth:[]}],description:"Products classified under the category, ordered by their classification position.\n\n**Required scope:** `read_categories` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}},{name:"category_id",in:"path",required:!0,description:"Category ID",schema:{type:"string"}}],responses:{"200":{description:"products found",content:{"application/json":{schema:{type:"object",properties:{data:{type:"array",items:{$ref:"#/components/schemas/Product"}},meta:{$ref:"#/components/schemas/PaginationMeta"}},required:["data","meta"]}}}}}},post:{summary:"Add a product to a category",tags:["Categories"],security:[{api_key:[],bearer_auth:[]}],description:"Classifies a product under the category (appended to the end).\n\n**Required scope:** `write_categories` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}},{name:"category_id",in:"path",required:!0,description:"Category ID",schema:{type:"string"}}],responses:{"201":{description:"product added",content:{"application/json":{schema:{$ref:"#/components/schemas/Product"}}}}},requestBody:{content:{"application/json":{schema:{type:"object",properties:{product_id:{type:"string"}},required:["product_id"]}}}}}},"/api/v3/admin/categories/{category_id}/products/{id}/reposition":{patch:{summary:"Reposition a category product",tags:["Categories"],security:[{api_key:[],bearer_auth:[]}],description:"Moves a product to a new index among the category's products.\n\n**Required scope:** `write_categories` (for API-key authentication).",parameters:[{name:"x-spree-api-key",in:"header",required:!0,schema:{type:"string"}},{name:"Authorization",in:"header",required:!0,description:"Bearer token for admin authentication",schema:{type:"string"}},{name:"category_id",in:"path",required:!0,description:"Category ID",schema:{type:"string"}},{name:"id",in:"path",required:!0,description:"Product ID",schema:{type:"string"}}],responses:{"204":{description:"product repositioned"}},requestBody:{content:{"application/json":{schema:{type:"object",properties:{new_position:{type:"integer",description:"0-based index among the category's products"}},required:["new_position"]}}}}}}},components:{schemas:{PaginationMeta:{type:"object",properties:{page:{type:"integer"},limit:{type:"integer"},count:{type:"integer",description:"Total number of records"},pages:{type:"integer",description:"Total number of pages"},from:{type:"integer",description:"Index of first record on this page"},to:{type:"integer",description:"Index of last record on this page"},in:{type:"integer",description:"Number of records on this page"},previous:{type:"integer",nullable:!0,description:"Previous page number"},next:{type:"integer",nullable:!0,description:"Next page number"}},required:["page","limit","count","pages","from","to","in"]},ErrorResponse:{type:"object",properties:{error:{type:"object",properties:{code:{type:"string"},message:{type:"string"},details:{type:"object",description:"Field-specific validation errors",nullable:!0}},required:["code","message"]}},required:["error"]},AuthResponse:{type:"object",properties:{token:{type:"string",description:"JWT access token"},user:{$ref:"#/components/schemas/AdminUser"}},required:["token","user"]},PermissionRule:{type:"object",description:"A single permission rule (CanCanCan rule). Rules are applied in order, last-matching-wins.",properties:{allow:{type:"boolean",description:"true for `can`, false for `cannot`"},actions:{type:"array",items:{type:"string"},description:'Action names, e.g. ["read", "update"] or ["manage"]'},subjects:{type:"array",items:{type:"string"},description:'Subject class names, e.g. ["Spree::Product"] or ["all"]'},has_conditions:{type:"boolean",description:"True if the server-side rule has per-record conditions. The SPA shows the action optimistically and handles 403 from the API."}},required:["allow","actions","subjects","has_conditions"]},MeResponse:{type:"object",description:"Current admin user profile and serialized permissions",properties:{user:{$ref:"#/components/schemas/AdminUser"},permissions:{type:"array",items:{$ref:"#/components/schemas/PermissionRule"}}},required:["user","permissions"]},CheckoutRequirement:{type:"object",properties:{step:{type:"string",description:"Checkout step this requirement belongs to"},field:{type:"string",description:"Field that needs to be satisfied"},message:{type:"string",description:"Human-readable requirement message"}},required:["step","field","message"]},CartWarning:{type:"object",description:"A warning about a cart issue (e.g., item removed due to stock change)",properties:{code:{type:"string",description:"Machine-readable warning code"},message:{type:"string",description:"Human-readable warning message"},line_item_id:{type:"string",nullable:!0,description:"Prefixed line item ID (when applicable)"},variant_id:{type:"string",nullable:!0,description:"Prefixed variant ID (when applicable)"}},required:["code","message"]},FulfillmentManifestItem:{type:"object",description:"An item within a fulfillment \u2014 which line item and how many units are in this fulfillment",properties:{item_id:{type:"string",description:"Line item ID"},variant_id:{type:"string",description:"Variant ID"},quantity:{type:"integer",description:"Quantity in this fulfillment"}},required:["item_id","variant_id","quantity"]},AdminUserRoleAssignment:{type:"object",description:"A role assignment for the current store on a staff member",properties:{id:{type:"string",description:"Prefixed role ID"},name:{type:"string",description:"Role name"}},required:["id","name"]},PreferenceField:{type:"object",description:"A single configurable preference on a payment method, promotion rule/action, or calculator. The frontend uses `type` + `default` to render a sensible input.",properties:{key:{type:"string"},type:{type:"string",description:"string | text | password | integer | decimal | boolean | array | hash"},default:{description:"Default value (any JSON type), null when there is no default",nullable:!0}},required:["key","type"]},PromotionActionCalculator:{type:"object",description:"The action's nested calculator (when the action carries one \u2014 null for actions like `free_shipping`)",properties:{type:{type:"string",description:"Wire shorthand for the calculator subclass"},label:{type:"string"},preferences:{type:"object",additionalProperties:!0},preference_schema:{type:"array",items:{$ref:"#/components/schemas/PreferenceField"}}},required:["type","label","preferences","preference_schema"]},PromotionActionLineItem:{type:"object",description:"One row in a `create_line_items` action \u2014 the variant added to the order and how many",properties:{variant_id:{type:"string"},quantity:{type:"integer"}},required:["variant_id","quantity"]},Address:{type:"object",properties:{id:{type:"string"},first_name:{type:"string",nullable:!0},last_name:{type:"string",nullable:!0},full_name:{type:"string"},address1:{type:"string",nullable:!0},address2:{type:"string",nullable:!0},postal_code:{type:"string",nullable:!0},city:{type:"string",nullable:!0},phone:{type:"string",nullable:!0},company:{type:"string",nullable:!0},country_name:{type:"string"},country_iso:{type:"string"},state_text:{type:"string",nullable:!0},state_abbr:{type:"string",nullable:!0},quick_checkout:{type:"boolean"},is_default_billing:{type:"boolean"},is_default_shipping:{type:"boolean"},state_name:{type:"string",nullable:!0},label:{type:"string",nullable:!0},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},customer_id:{type:"string",nullable:!0}},required:["id","first_name","last_name","full_name","address1","address2","postal_code","city","phone","company","country_name","country_iso","state_text","state_abbr","quick_checkout","is_default_billing","is_default_shipping","state_name","label","metadata","created_at","updated_at","customer_id"],"x-typelizer":!0},Adjustment:{type:"object",properties:{id:{type:"string"},label:{type:"string"},display_amount:{type:"string"},included:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"},amount:{type:"string"},order_id:{type:"string",nullable:!0}},required:["id","label","display_amount","included","created_at","updated_at","amount","order_id"],"x-typelizer":!0},AdminUser:{type:"object",properties:{id:{type:"string"},email:{type:"string"},first_name:{type:"string",nullable:!0},last_name:{type:"string",nullable:!0},full_name:{type:"string",nullable:!0},selected_locale:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},roles:{type:"array",items:{$ref:"#/components/schemas/AdminUserRoleAssignment"}}},required:["id","email","first_name","last_name","full_name","selected_locale","created_at","updated_at","roles"],"x-typelizer":!0},AllowedOrigin:{type:"object",properties:{id:{type:"string"},origin:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","origin","created_at","updated_at"],"x-typelizer":!0},ApiKey:{type:"object",properties:{id:{type:"string"},name:{type:"string"},key_type:{type:"string"},token_prefix:{type:"string",nullable:!0},scopes:{type:"array",items:{type:"string"}},created_at:{type:"string"},updated_at:{type:"string"},revoked_at:{type:"string",nullable:!0},last_used_at:{type:"string",nullable:!0},plaintext_token:{type:"string",nullable:!0},created_by_email:{type:"string",nullable:!0}},required:["id","name","key_type","token_prefix","scopes","created_at","updated_at","revoked_at","last_used_at","plaintext_token","created_by_email"],"x-typelizer":!0},Category:{type:"object",properties:{id:{type:"string"},name:{type:"string"},permalink:{type:"string"},position:{type:"number"},depth:{type:"number"},meta_title:{type:"string",nullable:!0},meta_description:{type:"string",nullable:!0},meta_keywords:{type:"string",nullable:!0},children_count:{type:"number"},parent_id:{type:"string",nullable:!0},description:{type:"string"},description_html:{type:"string"},image_url:{type:"string",nullable:!0},square_image_url:{type:"string",nullable:!0},is_root:{type:"boolean"},is_child:{type:"boolean"},is_leaf:{type:"boolean"},parent:{$ref:"#/components/schemas/Category"},children:{type:"array",items:{$ref:"#/components/schemas/Category"}},ancestors:{type:"array",items:{$ref:"#/components/schemas/Category"}},custom_fields:{type:"array",items:{$ref:"#/components/schemas/CustomField"}},translations:{type:"object"},metadata:{type:"object"},pretty_name:{type:"string"},lft:{type:"number"},rgt:{type:"number"},products_count:{type:"number"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","name","permalink","position","depth","meta_title","meta_description","meta_keywords","children_count","parent_id","description","description_html","image_url","square_image_url","is_root","is_child","is_leaf","metadata","pretty_name","lft","rgt","products_count","created_at","updated_at"],"x-typelizer":!0},Channel:{type:"object",properties:{id:{type:"string"},name:{type:"string"},code:{type:"string"},active:{type:"boolean"},default:{type:"boolean"},preferred_order_routing_strategy:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","name","code","active","default","preferred_order_routing_strategy","created_at","updated_at"],"x-typelizer":!0},Country:{type:"object",properties:{iso:{type:"string"},iso3:{type:"string"},name:{type:"string"},states_required:{type:"boolean"},zipcode_required:{type:"boolean"},states:{type:"array",items:{$ref:"#/components/schemas/State"}},market:{allOf:[{$ref:"#/components/schemas/Market"}],nullable:!0},created_at:{type:"object"},updated_at:{type:"object"}},required:["iso","iso3","name","states_required","zipcode_required","created_at","updated_at"],"x-typelizer":!0},CouponCode:{type:"object",properties:{id:{type:"string"},code:{type:"string"},state:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},promotion_id:{type:"string"},order_id:{type:"string",nullable:!0}},required:["id","code","state","created_at","updated_at","promotion_id","order_id"],"x-typelizer":!0},CreditCard:{type:"object",properties:{id:{type:"string"},brand:{type:"string"},last4:{type:"string"},month:{type:"number"},year:{type:"number"},name:{type:"string",nullable:!0},default:{type:"boolean"},gateway_payment_profile_id:{type:"string",nullable:!0},customer_id:{type:"string",nullable:!0},payment_method_id:{type:"string",nullable:!0},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","brand","last4","month","year","name","default","gateway_payment_profile_id","customer_id","payment_method_id","metadata","created_at","updated_at"],"x-typelizer":!0},CustomFieldDefinition:{type:"object",properties:{id:{type:"string"},namespace:{type:"string"},key:{type:"string"},label:{type:"string"},field_type:{type:"string",enum:["short_text","long_text","rich_text","number","boolean","json"]},resource_type:{type:"string"},storefront_visible:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","namespace","key","label","field_type","resource_type","storefront_visible","created_at","updated_at"],"x-typelizer":!0},CustomField:{type:"object",properties:{id:{type:"string"},label:{type:"string"},type:{type:"string",deprecated:!0},field_type:{type:"string",enum:["short_text","long_text","rich_text","number","boolean","json"]},key:{type:"string"},value:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},storefront_visible:{type:"boolean"},custom_field_definition_id:{type:"string"}},required:["id","label","type","field_type","key","value","created_at","updated_at","storefront_visible","custom_field_definition_id"],"x-typelizer":!0},CustomerGroup:{type:"object",properties:{id:{type:"string"},name:{type:"string"},description:{type:"string",nullable:!0},customers_count:{type:"number"},created_at:{type:"string"},updated_at:{type:"string"},customers:{type:"array",items:{$ref:"#/components/schemas/Customer"}}},required:["id","name","description","customers_count","created_at","updated_at"],"x-typelizer":!0},Customer:{type:"object",properties:{id:{type:"string"},email:{type:"string"},first_name:{type:"string",nullable:!0},last_name:{type:"string",nullable:!0},phone:{type:"string",nullable:!0},accepts_email_marketing:{type:"boolean"},full_name:{type:"string"},available_store_credit_total:{type:"string"},display_available_store_credit_total:{type:"string"},addresses:{type:"array",items:{$ref:"#/components/schemas/Address"}},default_billing_address:{allOf:[{$ref:"#/components/schemas/Address"}],nullable:!0},default_shipping_address:{allOf:[{$ref:"#/components/schemas/Address"}],nullable:!0},login:{type:"string",nullable:!0},metadata:{type:"object"},last_sign_in_at:{type:"string",nullable:!0},current_sign_in_at:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},sign_in_count:{type:"number"},failed_attempts:{type:"number"},last_sign_in_ip:{type:"string",nullable:!0},current_sign_in_ip:{type:"string",nullable:!0},tags:{type:"array",items:{type:"string"}},internal_note_html:{type:"string",nullable:!0},default_billing_address_id:{type:"string",nullable:!0},default_shipping_address_id:{type:"string",nullable:!0},orders_count:{type:"number"},total_spent:{type:"string"},display_total_spent:{type:"string"},last_order_completed_at:{type:"string",nullable:!0},orders:{type:"array",items:{$ref:"#/components/schemas/Order"}},store_credits:{type:"array",items:{$ref:"#/components/schemas/StoreCredit"}},customer_group_ids:{type:"array",items:{type:"string"}},customer_groups:{type:"array",items:{$ref:"#/components/schemas/CustomerGroup"}}},required:["id","email","first_name","last_name","phone","accepts_email_marketing","full_name","available_store_credit_total","display_available_store_credit_total","login","metadata","last_sign_in_at","current_sign_in_at","created_at","updated_at","sign_in_count","failed_attempts","last_sign_in_ip","current_sign_in_ip","tags","internal_note_html","default_billing_address_id","default_shipping_address_id","orders_count","total_spent","display_total_spent","last_order_completed_at","customer_group_ids"],"x-typelizer":!0},DeliveryMethod:{type:"object",properties:{id:{type:"string"},name:{type:"string"},code:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","name","code","created_at","updated_at"],"x-typelizer":!0},DeliveryRate:{type:"object",properties:{id:{type:"string"},delivery_method_id:{type:"string"},name:{type:"string"},selected:{type:"boolean"},cost:{type:"string"},total:{type:"string"},additional_tax_total:{type:"string"},included_tax_total:{type:"string"},tax_total:{type:"string"},display_cost:{type:"string"},display_total:{type:"string"},display_additional_tax_total:{type:"string"},display_included_tax_total:{type:"string"},display_tax_total:{type:"string"},delivery_method:{$ref:"#/components/schemas/DeliveryMethod"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","delivery_method_id","name","selected","cost","total","additional_tax_total","included_tax_total","tax_total","display_cost","display_total","display_additional_tax_total","display_included_tax_total","display_tax_total","created_at","updated_at"],"x-typelizer":!0},DigitalLink:{type:"object",properties:{id:{type:"string"},access_counter:{type:"number"},filename:{type:"string"},content_type:{type:"string"},download_url:{type:"string"},authorizable:{type:"boolean"},expired:{type:"boolean"},access_limit_exceeded:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","access_counter","filename","content_type","download_url","authorizable","expired","access_limit_exceeded","created_at","updated_at"],"x-typelizer":!0},Discount:{type:"object",properties:{id:{type:"string"},promotion_id:{type:"string"},name:{type:"string"},description:{type:"string",nullable:!0},code:{type:"string",nullable:!0},amount:{type:"string"},display_amount:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","promotion_id","name","description","code","amount","display_amount","created_at","updated_at"],"x-typelizer":!0},Export:{type:"object",properties:{id:{type:"string"},number:{type:"string"},type:{type:"string",nullable:!0},format:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},user_id:{type:"string",nullable:!0},done:{type:"boolean"},filename:{type:"string",nullable:!0},byte_size:{type:"number",nullable:!0},download_url:{type:"string",nullable:!0}},required:["id","number","type","format","created_at","updated_at","user_id","done","filename","byte_size","download_url"],"x-typelizer":!0},Fulfillment:{type:"object",properties:{id:{type:"string"},number:{type:"string"},tracking:{type:"string",nullable:!0},tracking_url:{type:"string",nullable:!0},cost:{type:"string"},display_cost:{type:"string"},total:{type:"string"},display_total:{type:"string"},discount_total:{type:"string"},display_discount_total:{type:"string"},additional_tax_total:{type:"string"},display_additional_tax_total:{type:"string"},included_tax_total:{type:"string"},display_included_tax_total:{type:"string"},tax_total:{type:"string"},display_tax_total:{type:"string"},status:{type:"string"},fulfillment_type:{type:"string"},fulfilled_at:{type:"string",nullable:!0},items:{type:"array",items:{$ref:"#/components/schemas/FulfillmentManifestItem"}},delivery_method:{$ref:"#/components/schemas/DeliveryMethod"},stock_location:{$ref:"#/components/schemas/StockLocation"},delivery_rates:{type:"array",items:{$ref:"#/components/schemas/DeliveryRate"}},metadata:{type:"object"},adjustment_total:{type:"string"},pre_tax_amount:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"},order_id:{type:"string",nullable:!0},stock_location_id:{type:"string",nullable:!0},order:{$ref:"#/components/schemas/Order"},adjustments:{type:"array",items:{$ref:"#/components/schemas/Adjustment"}}},required:["id","number","tracking","tracking_url","cost","display_cost","total","display_total","discount_total","display_discount_total","additional_tax_total","display_additional_tax_total","included_tax_total","display_included_tax_total","tax_total","display_tax_total","status","fulfillment_type","fulfilled_at","items","metadata","adjustment_total","pre_tax_amount","created_at","updated_at","order_id","stock_location_id"],"x-typelizer":!0},GiftCardBatch:{type:"object",properties:{id:{type:"string"},codes_count:{type:"number"},currency:{type:"string",nullable:!0},prefix:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},amount:{type:"string",nullable:!0},expires_at:{type:"string",nullable:!0},created_by_id:{type:"string",nullable:!0}},required:["id","codes_count","currency","prefix","created_at","updated_at","amount","expires_at","created_by_id"],"x-typelizer":!0},GiftCard:{type:"object",properties:{id:{type:"string"},code:{type:"string"},status:{type:"string"},currency:{type:"string"},amount:{type:"string"},amount_used:{type:"string"},amount_authorized:{type:"string"},amount_remaining:{type:"string"},display_amount:{type:"string"},display_amount_used:{type:"string"},display_amount_remaining:{type:"string"},expires_at:{type:"string",nullable:!0},redeemed_at:{type:"string",nullable:!0},expired:{type:"boolean"},active:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"},customer_id:{type:"string",nullable:!0},created_by_id:{type:"string",nullable:!0},customer:{$ref:"#/components/schemas/Customer"},created_by:{$ref:"#/components/schemas/AdminUser"},gift_card_batch:{$ref:"#/components/schemas/GiftCardBatch"},orders:{type:"array",items:{$ref:"#/components/schemas/Order"}}},required:["id","code","status","currency","amount","amount_used","amount_authorized","amount_remaining","display_amount","display_amount_used","display_amount_remaining","expires_at","redeemed_at","expired","active","created_at","updated_at","customer_id","created_by_id"],"x-typelizer":!0},Invitation:{type:"object",properties:{id:{type:"string"},email:{type:"string"},status:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"},expires_at:{type:"string"},role_id:{type:"string"},role_name:{type:"string"},inviter_email:{type:"string"},acceptance_url:{type:"string"},invitee_exists:{type:"boolean"},store:{type:"object"}},required:["id","email","status","created_at","updated_at","expires_at","role_id","role_name","inviter_email","acceptance_url","invitee_exists","store"],"x-typelizer":!0},LineItem:{type:"object",properties:{id:{type:"string"},variant_id:{type:"string"},quantity:{type:"number"},currency:{type:"string"},name:{type:"string"},slug:{type:"string"},options_text:{type:"string"},price:{type:"string"},display_price:{type:"string"},total:{type:"string"},display_total:{type:"string"},adjustment_total:{type:"string"},display_adjustment_total:{type:"string"},additional_tax_total:{type:"string"},display_additional_tax_total:{type:"string"},included_tax_total:{type:"string"},display_included_tax_total:{type:"string"},discount_total:{type:"string"},display_discount_total:{type:"string"},pre_tax_amount:{type:"string"},display_pre_tax_amount:{type:"string"},discounted_amount:{type:"string"},display_discounted_amount:{type:"string"},display_compare_at_amount:{type:"string",nullable:!0},compare_at_amount:{type:"string",nullable:!0},thumbnail_url:{type:"string",nullable:!0},option_values:{type:"array",items:{$ref:"#/components/schemas/OptionValue"}},digital_links:{type:"array",items:{$ref:"#/components/schemas/DigitalLink"}},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},cost_price:{type:"string",nullable:!0},tax_category_id:{type:"string",nullable:!0},variant:{$ref:"#/components/schemas/Variant"},tax_category:{$ref:"#/components/schemas/TaxCategory"},adjustments:{type:"array",items:{$ref:"#/components/schemas/Adjustment"}}},required:["id","variant_id","quantity","currency","name","slug","options_text","price","display_price","total","display_total","adjustment_total","display_adjustment_total","additional_tax_total","display_additional_tax_total","included_tax_total","display_included_tax_total","discount_total","display_discount_total","pre_tax_amount","display_pre_tax_amount","discounted_amount","display_discounted_amount","display_compare_at_amount","compare_at_amount","thumbnail_url","option_values","digital_links","metadata","created_at","updated_at","cost_price","tax_category_id"],"x-typelizer":!0},Market:{type:"object",properties:{id:{type:"string"},name:{type:"string"},currency:{type:"string"},default_locale:{type:"string"},tax_inclusive:{type:"boolean"},default:{type:"boolean"},country_isos:{type:"array",items:{type:"string"}},supported_locales:{type:"array",items:{type:"string"}},countries:{type:"array",items:{$ref:"#/components/schemas/Country"}},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","name","currency","default_locale","tax_inclusive","default","country_isos","supported_locales","created_at","updated_at"],"x-typelizer":!0},Media:{type:"object",properties:{id:{type:"string"},product_id:{type:"string",nullable:!0},variant_ids:{type:"array",items:{type:"string"}},position:{type:"number"},alt:{type:"string",nullable:!0},media_type:{type:"string"},focal_point_x:{type:"number",nullable:!0},focal_point_y:{type:"number",nullable:!0},external_video_url:{type:"string",nullable:!0},original_url:{type:"string",nullable:!0},mini_url:{type:"string",nullable:!0},small_url:{type:"string",nullable:!0},medium_url:{type:"string",nullable:!0},large_url:{type:"string",nullable:!0},xlarge_url:{type:"string",nullable:!0},og_image_url:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},viewable_id:{type:"string"},download_url:{type:"string",nullable:!0},metadata:{type:"object"},viewable_type:{type:"string"}},required:["id","product_id","variant_ids","position","alt","media_type","focal_point_x","focal_point_y","external_video_url","original_url","mini_url","small_url","medium_url","large_url","xlarge_url","og_image_url","created_at","updated_at","viewable_id","download_url","metadata","viewable_type"],"x-typelizer":!0},OptionType:{type:"object",properties:{id:{type:"string"},name:{type:"string"},label:{type:"string"},position:{type:"number"},kind:{type:"string"},translations:{type:"object"},metadata:{type:"object"},filterable:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"},option_values:{type:"array",items:{$ref:"#/components/schemas/OptionValue"}}},required:["id","name","label","position","kind","metadata","filterable","created_at","updated_at"],"x-typelizer":!0},OptionValue:{type:"object",properties:{id:{type:"string"},option_type_id:{type:"string"},name:{type:"string"},label:{type:"string"},position:{type:"number"},color_code:{type:"string",nullable:!0},option_type_name:{type:"string"},option_type_label:{type:"string"},image_url:{type:"string",nullable:!0},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},option_type:{$ref:"#/components/schemas/OptionType"}},required:["id","option_type_id","name","label","position","color_code","option_type_name","option_type_label","image_url","metadata","created_at","updated_at"],"x-typelizer":!0},Order:{type:"object",properties:{id:{type:"string"},market_id:{type:"string",nullable:!0},channel_id:{type:"string",nullable:!0},number:{type:"string"},email:{type:"string"},customer_note:{type:"string",nullable:!0},currency:{type:"string"},locale:{type:"string",nullable:!0},total_quantity:{type:"number"},item_total:{type:"string"},display_item_total:{type:"string"},adjustment_total:{type:"string"},display_adjustment_total:{type:"string"},discount_total:{type:"string"},display_discount_total:{type:"string"},tax_total:{type:"string"},display_tax_total:{type:"string"},included_tax_total:{type:"string"},display_included_tax_total:{type:"string"},additional_tax_total:{type:"string"},display_additional_tax_total:{type:"string"},total:{type:"string"},display_total:{type:"string"},gift_card_total:{type:"string"},display_gift_card_total:{type:"string"},amount_due:{type:"string"},display_amount_due:{type:"string"},delivery_total:{type:"string"},display_delivery_total:{type:"string"},fulfillment_status:{type:"string",nullable:!0},payment_status:{type:"string",nullable:!0},completed_at:{type:"string",nullable:!0},store_credit_total:{type:"string"},display_store_credit_total:{type:"string"},covered_by_store_credit:{type:"boolean"},discounts:{type:"array",items:{$ref:"#/components/schemas/Discount"}},items:{type:"array",items:{$ref:"#/components/schemas/LineItem"}},fulfillments:{type:"array",items:{$ref:"#/components/schemas/Fulfillment"}},payments:{type:"array",items:{$ref:"#/components/schemas/Payment"}},billing_address:{allOf:[{$ref:"#/components/schemas/Address"}],nullable:!0},shipping_address:{allOf:[{$ref:"#/components/schemas/Address"}],nullable:!0},gift_card:{allOf:[{$ref:"#/components/schemas/GiftCard"}],nullable:!0},market:{allOf:[{$ref:"#/components/schemas/Market"}],nullable:!0},status:{type:"string"},last_ip_address:{type:"string",nullable:!0},considered_risky:{type:"boolean"},confirmation_delivered:{type:"boolean"},store_owner_notification_delivered:{type:"boolean"},payment_total:{type:"string"},display_payment_total:{type:"string"},metadata:{type:"object"},canceled_at:{type:"string",nullable:!0},approved_at:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},preferred_stock_location_id:{type:"string",nullable:!0},tags:{type:"array",items:{type:"string"}},internal_note:{type:"string",nullable:!0},approver_id:{type:"string",nullable:!0},canceler_id:{type:"string",nullable:!0},created_by_id:{type:"string",nullable:!0},customer_id:{type:"string",nullable:!0},channel:{$ref:"#/components/schemas/Channel"},preferred_stock_location:{$ref:"#/components/schemas/StockLocation"},payment_methods:{type:"array",items:{$ref:"#/components/schemas/PaymentMethod"}},customer:{$ref:"#/components/schemas/Customer"},approver:{$ref:"#/components/schemas/Customer"},canceler:{$ref:"#/components/schemas/Customer"},created_by:{$ref:"#/components/schemas/Customer"},adjustments:{type:"array",items:{$ref:"#/components/schemas/Adjustment"}},return_authorizations:{type:"array",items:{$ref:"#/components/schemas/ReturnAuthorization"}},reimbursements:{type:"array",items:{$ref:"#/components/schemas/Reimbursement"}}},required:["id","market_id","channel_id","number","email","customer_note","currency","locale","total_quantity","item_total","display_item_total","adjustment_total","display_adjustment_total","discount_total","display_discount_total","tax_total","display_tax_total","included_tax_total","display_included_tax_total","additional_tax_total","display_additional_tax_total","total","display_total","gift_card_total","display_gift_card_total","amount_due","display_amount_due","delivery_total","display_delivery_total","fulfillment_status","payment_status","completed_at","store_credit_total","display_store_credit_total","covered_by_store_credit","gift_card","market","status","last_ip_address","considered_risky","confirmation_delivered","store_owner_notification_delivered","payment_total","display_payment_total","metadata","canceled_at","approved_at","created_at","updated_at","preferred_stock_location_id","tags","internal_note","approver_id","canceler_id","created_by_id","customer_id"],"x-typelizer":!0},PaymentMethod:{type:"object",properties:{id:{type:"string"},name:{type:"string"},description:{type:"string",nullable:!0},type:{type:"string"},session_required:{type:"boolean"},source_required:{type:"boolean"},metadata:{type:"object"},active:{type:"boolean"},auto_capture:{type:"boolean",nullable:!0},storefront_visible:{type:"boolean"},position:{type:"number"},created_at:{type:"string"},updated_at:{type:"string"},preferences:{type:"object"},preference_schema:{type:"object"}},required:["id","name","description","type","session_required","source_required","metadata","active","auto_capture","storefront_visible","position","created_at","updated_at","preferences","preference_schema"],"x-typelizer":!0},Payment:{type:"object",properties:{id:{type:"string"},payment_method_id:{type:"string"},response_code:{type:"string",nullable:!0},number:{type:"string"},amount:{type:"string"},display_amount:{type:"string"},status:{type:"string"},source_type:{type:"string",nullable:!0,enum:["credit_card","store_credit","payment_source"]},source_id:{type:"string",nullable:!0},source:{anyOf:[{$ref:"#/components/schemas/CreditCard"},{$ref:"#/components/schemas/StoreCredit"},{$ref:"#/components/schemas/PaymentSource"}],nullable:!0},payment_method:{$ref:"#/components/schemas/PaymentMethod"},metadata:{type:"object"},avs_response:{type:"string",nullable:!0},cvv_response_code:{type:"string",nullable:!0},cvv_response_message:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},captured_amount:{type:"string"},order_id:{type:"string",nullable:!0},order:{$ref:"#/components/schemas/Order"},refunds:{type:"array",items:{$ref:"#/components/schemas/Refund"}}},required:["id","payment_method_id","response_code","number","amount","display_amount","status","source_type","source_id","source","metadata","avs_response","cvv_response_code","cvv_response_message","created_at","updated_at","captured_amount","order_id"],"x-typelizer":!0},PaymentSource:{type:"object",properties:{id:{type:"string"},gateway_payment_profile_id:{type:"string",nullable:!0},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","gateway_payment_profile_id","metadata","created_at","updated_at"],"x-typelizer":!0},PriceHistory:{type:"object",properties:{id:{type:"string"},amount:{type:"string"},amount_in_cents:{type:"number"},currency:{type:"string"},display_amount:{type:"string"},recorded_at:{type:"string"},variant_id:{type:"string"},price_id:{type:"string"},compare_at_amount:{type:"string",nullable:!0},created_at:{type:"string"}},required:["id","amount","amount_in_cents","currency","display_amount","recorded_at","variant_id","price_id","compare_at_amount","created_at"],"x-typelizer":!0},PriceList:{type:"object",properties:{id:{type:"string"},name:{type:"string"},description:{type:"string",nullable:!0},status:{type:"string"},position:{type:"number"},match_policy:{type:"string"},starts_at:{type:"string",nullable:!0},ends_at:{type:"string",nullable:!0},deleted_at:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},currently_active:{type:"boolean"},products_count:{type:"number"},prices_count:{type:"number"},product_ids:{type:"array",items:{type:"string"}},price_rules:{type:"array",items:{$ref:"#/components/schemas/PriceRule"}}},required:["id","name","description","status","position","match_policy","starts_at","ends_at","deleted_at","created_at","updated_at","currently_active","products_count","prices_count","product_ids"],"x-typelizer":!0},PriceRule:{type:"object",properties:{id:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"},type:{type:"string"},price_list_id:{type:"string"},preferences:{type:"object"},preference_schema:{type:"array",items:{$ref:"#/components/schemas/PreferenceField"}},label:{type:"string"},description:{type:"string",nullable:!0},markets:{type:"array",items:{$ref:"#/components/schemas/Market"}},customer_groups:{type:"array",items:{$ref:"#/components/schemas/CustomerGroup"}},customers:{type:"array",items:{$ref:"#/components/schemas/Customer"}}},required:["id","created_at","updated_at","type","price_list_id","preferences","preference_schema","label","description"],"x-typelizer":!0},Price:{type:"object",properties:{id:{type:"string"},amount:{type:"string",nullable:!0},amount_in_cents:{type:"number",nullable:!0},compare_at_amount:{type:"string",nullable:!0},compare_at_amount_in_cents:{type:"number",nullable:!0},currency:{type:"string",nullable:!0},display_amount:{type:"string",nullable:!0},display_compare_at_amount:{type:"string",nullable:!0},price_list_id:{type:"string",nullable:!0},variant_id:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},variant:{$ref:"#/components/schemas/Variant"}},required:["id","amount","amount_in_cents","compare_at_amount","compare_at_amount_in_cents","currency","display_amount","display_compare_at_amount","price_list_id","variant_id","created_at","updated_at"],"x-typelizer":!0},ProductPublication:{type:"object",properties:{id:{type:"string"},published_at:{type:"string",nullable:!0},unpublished_at:{type:"string",nullable:!0},product_id:{type:"string"},channel_id:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","published_at","unpublished_at","product_id","channel_id","created_at","updated_at"],"x-typelizer":!0},Product:{type:"object",properties:{id:{type:"string"},name:{type:"string"},slug:{type:"string"},meta_title:{type:"string",nullable:!0},meta_description:{type:"string",nullable:!0},meta_keywords:{type:"string",nullable:!0},variant_count:{type:"number"},available_on:{type:"string",nullable:!0},purchasable:{type:"boolean"},in_stock:{type:"boolean"},backorderable:{type:"boolean"},available:{type:"boolean"},description:{type:"string",nullable:!0},description_html:{type:"string",nullable:!0},default_variant_id:{type:"string"},thumbnail_url:{type:"string",nullable:!0},tags:{type:"array",items:{type:"string"}},price:{allOf:[{$ref:"#/components/schemas/Price"}],nullable:!0},original_price:{allOf:[{$ref:"#/components/schemas/Price"}],nullable:!0},primary_media:{$ref:"#/components/schemas/Media"},media:{type:"array",items:{$ref:"#/components/schemas/Media"}},variants:{type:"array",items:{$ref:"#/components/schemas/Variant"}},default_variant:{$ref:"#/components/schemas/Variant"},option_types:{type:"array",items:{$ref:"#/components/schemas/OptionType"}},option_values:{type:"array",items:{$ref:"#/components/schemas/OptionValue"}},categories:{type:"array",items:{$ref:"#/components/schemas/Category"}},custom_fields:{type:"array",items:{$ref:"#/components/schemas/CustomField"}},prior_price:{allOf:[{$ref:"#/components/schemas/PriceHistory"}],nullable:!0},translations:{type:"object"},status:{type:"string"},metadata:{type:"object"},deleted_at:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},tax_category_id:{type:"string",nullable:!0},product_publications:{type:"array",items:{$ref:"#/components/schemas/ProductPublication"}},channels:{type:"array",items:{$ref:"#/components/schemas/Channel"}}},required:["id","name","slug","meta_title","meta_description","meta_keywords","variant_count","available_on","purchasable","in_stock","backorderable","available","description","description_html","default_variant_id","thumbnail_url","tags","price","original_price","status","metadata","deleted_at","created_at","updated_at","tax_category_id"],"x-typelizer":!0},PromotionAction:{type:"object",properties:{id:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"},type:{type:"string"},promotion_id:{type:"string"},preferences:{type:"object"},preference_schema:{type:"array",items:{$ref:"#/components/schemas/PreferenceField"}},label:{type:"string"},calculator:{allOf:[{$ref:"#/components/schemas/PromotionActionCalculator"}],nullable:!0},line_items:{type:"array",items:{$ref:"#/components/schemas/PromotionActionLineItem"},nullable:!0}},required:["id","created_at","updated_at","type","promotion_id","preferences","preference_schema","label","calculator","line_items"],"x-typelizer":!0},PromotionRule:{type:"object",properties:{id:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"},type:{type:"string"},promotion_id:{type:"string"},preferences:{type:"object"},preference_schema:{type:"array",items:{$ref:"#/components/schemas/PreferenceField"}},label:{type:"string"},product_ids:{type:"array",items:{type:"string"},nullable:!0},category_ids:{type:"array",items:{type:"string"},nullable:!0},customer_ids:{type:"array",items:{type:"string"},nullable:!0},products:{type:"array",items:{$ref:"#/components/schemas/Product"}},categories:{type:"array",items:{$ref:"#/components/schemas/Category"}},customers:{type:"array",items:{$ref:"#/components/schemas/Customer"}},customer_groups:{type:"array",items:{$ref:"#/components/schemas/CustomerGroup"}},countries:{type:"array",items:{$ref:"#/components/schemas/Country"}}},required:["id","created_at","updated_at","type","promotion_id","preferences","preference_schema","label","product_ids","category_ids","customer_ids"],"x-typelizer":!0},Promotion:{type:"object",properties:{id:{type:"string"},name:{type:"string"},description:{type:"string",nullable:!0},code:{type:"string",nullable:!0},starts_at:{type:"string",nullable:!0},expires_at:{type:"string",nullable:!0},usage_limit:{type:"number",nullable:!0},match_policy:{type:"string",enum:["all","any"]},path:{type:"string",nullable:!0},kind:{type:"string",enum:["coupon_code","automatic"]},multi_codes:{type:"boolean"},number_of_codes:{type:"number",nullable:!0},code_prefix:{type:"string",nullable:!0},promotion_category_id:{type:"string",nullable:!0},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},action_ids:{type:"array",items:{type:"string"}},rule_ids:{type:"array",items:{type:"string"}}},required:["id","name","description","code","starts_at","expires_at","usage_limit","match_policy","path","kind","multi_codes","number_of_codes","code_prefix","promotion_category_id","metadata","created_at","updated_at","action_ids","rule_ids"],"x-typelizer":!0},Refund:{type:"object",properties:{id:{type:"string"},transaction_id:{type:"string",nullable:!0},amount:{type:"string",nullable:!0},payment_id:{type:"string",nullable:!0},refund_reason_id:{type:"string",nullable:!0},reimbursement_id:{type:"string",nullable:!0},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},payment:{$ref:"#/components/schemas/Payment"},reimbursement:{$ref:"#/components/schemas/Reimbursement"}},required:["id","transaction_id","amount","payment_id","refund_reason_id","reimbursement_id","metadata","created_at","updated_at"],"x-typelizer":!0},Reimbursement:{type:"object",properties:{id:{type:"string"},number:{type:"string"},reimbursement_status:{type:"string",nullable:!0},total:{type:"string",nullable:!0},order_id:{type:"string",nullable:!0},customer_return_id:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},order:{$ref:"#/components/schemas/Order"}},required:["id","number","reimbursement_status","total","order_id","customer_return_id","created_at","updated_at"],"x-typelizer":!0},ReturnAuthorization:{type:"object",properties:{id:{type:"string"},number:{type:"string"},status:{type:"string"},order_id:{type:"string",nullable:!0},stock_location_id:{type:"string",nullable:!0},return_authorization_reason_id:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},order:{$ref:"#/components/schemas/Order"},stock_location:{$ref:"#/components/schemas/StockLocation"}},required:["id","number","status","order_id","stock_location_id","return_authorization_reason_id","created_at","updated_at"],"x-typelizer":!0},Role:{type:"object",properties:{id:{type:"string"},name:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","name","created_at","updated_at"],"x-typelizer":!0},State:{type:"object",properties:{abbr:{type:"string"},name:{type:"string"},created_at:{type:"object"},updated_at:{type:"object"}},required:["abbr","name","created_at","updated_at"],"x-typelizer":!0},StockItem:{type:"object",properties:{id:{type:"string"},count_on_hand:{type:"number"},backorderable:{type:"boolean"},stock_location_id:{type:"string",nullable:!0},variant_id:{type:"string",nullable:!0},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},allocated_count:{type:"number"},available_count:{type:"number"},stock_location:{$ref:"#/components/schemas/StockLocation"},variant:{$ref:"#/components/schemas/Variant"}},required:["id","count_on_hand","backorderable","stock_location_id","variant_id","metadata","created_at","updated_at","allocated_count","available_count"],"x-typelizer":!0},StockLocation:{type:"object",properties:{id:{type:"string"},state_abbr:{type:"string",nullable:!0},name:{type:"string"},address1:{type:"string",nullable:!0},city:{type:"string",nullable:!0},zipcode:{type:"string",nullable:!0},country_iso:{type:"string",nullable:!0},country_name:{type:"string",nullable:!0},state_text:{type:"string",nullable:!0},admin_name:{type:"string",nullable:!0},address2:{type:"string",nullable:!0},state_name:{type:"string",nullable:!0},phone:{type:"string",nullable:!0},company:{type:"string",nullable:!0},active:{type:"boolean"},default:{type:"boolean"},backorderable_default:{type:"boolean"},propagate_all_variants:{type:"boolean"},kind:{type:"string"},pickup_enabled:{type:"boolean"},pickup_stock_policy:{type:"string"},pickup_ready_in_minutes:{type:"number",nullable:!0},pickup_instructions:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","state_abbr","name","address1","city","zipcode","country_iso","country_name","state_text","admin_name","address2","state_name","phone","company","active","default","backorderable_default","propagate_all_variants","kind","pickup_enabled","pickup_stock_policy","pickup_ready_in_minutes","pickup_instructions","created_at","updated_at"],"x-typelizer":!0},StockReservation:{type:"object",properties:{id:{type:"string"},stock_item_id:{type:"string"},line_item_id:{type:"string"},order_id:{type:"string"},variant_id:{type:"string",nullable:!0},stock_location_id:{type:"string",nullable:!0},quantity:{type:"number"},expires_at:{type:"string"},active:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","stock_item_id","line_item_id","order_id","variant_id","stock_location_id","quantity","expires_at","active","created_at","updated_at"],"x-typelizer":!0},StockTransfer:{type:"object",properties:{id:{type:"string"},number:{type:"string"},reference:{type:"string",nullable:!0},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},source_location_id:{type:"string",nullable:!0},destination_location_id:{type:"string",nullable:!0},source_location:{$ref:"#/components/schemas/StockLocation"},destination_location:{$ref:"#/components/schemas/StockLocation"}},required:["id","number","reference","metadata","created_at","updated_at","source_location_id","destination_location_id"],"x-typelizer":!0},StoreCreditCategory:{type:"object",properties:{id:{type:"string"},name:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"},non_expiring:{type:"boolean"}},required:["id","name","created_at","updated_at","non_expiring"],"x-typelizer":!0},StoreCredit:{type:"object",properties:{id:{type:"string"},amount:{type:"string"},amount_used:{type:"string"},amount_remaining:{type:"string"},display_amount:{type:"string"},display_amount_used:{type:"string"},display_amount_remaining:{type:"string"},currency:{type:"string"},memo:{type:"string",nullable:!0},metadata:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},customer_id:{type:"string",nullable:!0},created_by_id:{type:"string",nullable:!0},category_id:{type:"string",nullable:!0},category_name:{type:"string",nullable:!0}},required:["id","amount","amount_used","amount_remaining","display_amount","display_amount_used","display_amount_remaining","currency","memo","metadata","created_at","updated_at","customer_id","created_by_id","category_id","category_name"],"x-typelizer":!0},Store:{type:"object",properties:{id:{type:"string"},metadata:{type:"object"},name:{type:"string"},default_currency:{type:"string"},default_locale:{type:"string"},mail_from_address:{type:"string",nullable:!0},customer_support_email:{type:"string",nullable:!0},new_order_notifications_email:{type:"string",nullable:!0},preferred_send_consumer_transactional_emails:{type:"boolean"},preferred_admin_locale:{type:"string",nullable:!0},preferred_timezone:{type:"string"},preferred_weight_unit:{type:"string"},preferred_unit_system:{type:"string"},created_at:{type:"string"},updated_at:{type:"string"},url:{type:"string"},supported_currencies:{type:"array",items:{type:"string"}},supported_locales:{type:"array",items:{type:"string"}},available_locales:{type:"array",items:{type:"string"}},logo_url:{type:"string",nullable:!0},mailer_logo_url:{type:"string",nullable:!0}},required:["id","metadata","name","default_currency","default_locale","mail_from_address","customer_support_email","new_order_notifications_email","preferred_send_consumer_transactional_emails","preferred_admin_locale","preferred_timezone","preferred_weight_unit","preferred_unit_system","created_at","updated_at","url","supported_currencies","supported_locales","available_locales","logo_url","mailer_logo_url"],"x-typelizer":!0},TaxCategory:{type:"object",properties:{id:{type:"string"},name:{type:"string"},tax_code:{type:"string",nullable:!0},description:{type:"string",nullable:!0},is_default:{type:"boolean"},created_at:{type:"string"},updated_at:{type:"string"}},required:["id","name","tax_code","description","is_default","created_at","updated_at"],"x-typelizer":!0},Variant:{type:"object",properties:{id:{type:"string"},product_id:{type:"string"},sku:{type:"string",nullable:!0},options_text:{type:"string"},track_inventory:{type:"boolean"},media_count:{type:"number"},thumbnail_url:{type:"string",nullable:!0},purchasable:{type:"boolean"},in_stock:{type:"boolean"},backorderable:{type:"boolean"},weight:{type:"number",nullable:!0},height:{type:"number",nullable:!0},width:{type:"number",nullable:!0},depth:{type:"number",nullable:!0},price:{$ref:"#/components/schemas/Price"},original_price:{allOf:[{$ref:"#/components/schemas/Price"}],nullable:!0},primary_media:{$ref:"#/components/schemas/Media"},media:{type:"array",items:{$ref:"#/components/schemas/Media"}},option_values:{type:"array",items:{$ref:"#/components/schemas/OptionValue"}},custom_fields:{type:"array",items:{$ref:"#/components/schemas/CustomField"}},prior_price:{allOf:[{$ref:"#/components/schemas/PriceHistory"}],nullable:!0},metadata:{type:"object"},position:{type:"number"},cost_price:{type:"string",nullable:!0},cost_currency:{type:"string",nullable:!0},barcode:{type:"string",nullable:!0},weight_unit:{type:"string",nullable:!0},dimensions_unit:{type:"string",nullable:!0},deleted_at:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},tax_category_id:{type:"string",nullable:!0},available_stock:{type:"number",nullable:!0},reserved_quantity:{type:"number"},total_on_hand:{type:"number",nullable:!0},product_name:{type:"string"},prices:{type:"array",items:{$ref:"#/components/schemas/Price"}},stock_items:{type:"array",items:{$ref:"#/components/schemas/StockItem"}}},required:["id","product_id","sku","options_text","track_inventory","media_count","thumbnail_url","purchasable","in_stock","backorderable","weight","height","width","depth","price","original_price","option_values","metadata","position","cost_price","cost_currency","barcode","weight_unit","dimensions_unit","deleted_at","created_at","updated_at","tax_category_id","available_stock","reserved_quantity","total_on_hand","product_name"],"x-typelizer":!0},WebhookDelivery:{type:"object",properties:{id:{type:"string"},event_name:{type:"string"},event_id:{type:"string",nullable:!0},response_code:{type:"number",nullable:!0},execution_time:{type:"number",nullable:!0},error_type:{type:"string",nullable:!0},request_errors:{type:"string",nullable:!0},response_body:{type:"string",nullable:!0},success:{type:"boolean",nullable:!0},payload:{type:"object"},created_at:{type:"string"},updated_at:{type:"string"},delivered_at:{type:"string",nullable:!0},webhook_endpoint_id:{type:"string"},webhook_endpoint_url:{type:"string"}},required:["id","event_name","event_id","response_code","execution_time","error_type","request_errors","response_body","success","payload","created_at","updated_at","delivered_at","webhook_endpoint_id","webhook_endpoint_url"],"x-typelizer":!0},WebhookEndpoint:{type:"object",properties:{id:{type:"string"},name:{type:"string",nullable:!0},url:{type:"string"},active:{type:"boolean"},subscriptions:{type:"array",items:{type:"string"}},disabled_reason:{type:"string",nullable:!0},created_at:{type:"string"},updated_at:{type:"string"},disabled_at:{type:"string",nullable:!0},secret_key:{type:"string",nullable:!0},last_delivery_at:{type:"string",nullable:!0},recent_delivery_count:{type:"number"},recent_failure_count:{type:"number"},total_delivery_count:{type:"number"},successful_delivery_count:{type:"number"},failed_delivery_count:{type:"number"}},required:["id","name","url","active","subscriptions","disabled_reason","created_at","updated_at","disabled_at","secret_key","last_delivery_at","recent_delivery_count","recent_failure_count","total_delivery_count","successful_delivery_count","failed_delivery_count"],"x-typelizer":!0}}}};var lm=new Set(["get","post","put","patch","delete"]);function an(){return dm}function ov(e){let t=e.description?.match(/\*\*Required scope:\*\* (.+?) \(for API-key authentication\)\./);return t?t[1].replaceAll("`",""):"\u2014"}function mm(e,t={}){let r=[];for(let[i,n]of Object.entries(e.paths)){let s=i.replace("/api/v3/admin","")||"/";for(let[o,a]of Object.entries(n)){if(!lm.has(o))continue;if(t.resource){let d=s.split("/")[1]??"";if(d!==t.resource&&!d.startsWith(t.resource))continue}let c=a.summary??"";t.search&&!`${o} ${s} ${c}`.toLowerCase().includes(t.search.toLowerCase())||r.push({method:o.toUpperCase(),path:s,scope:ov(a),summary:c})}}return r}function hm(e,t){let r=t.trim().split(/\s+/),i=r.length>1?r[0].toLowerCase():void 0,n=r.length>1?r[1]:r[0],s=_r(n),o=um(e,i,a=>a===s);return o.length>0?o:um(e,i,a=>av(a,s))}function um(e,t,r){let i=[];for(let[n,s]of Object.entries(e.paths)){let o=n.replace("/api/v3/admin","")||"/";if(r(o))for(let[a,c]of Object.entries(s))lm.has(a)&&(t&&a!==t||i.push({method:a.toUpperCase(),path:o,summary:c.summary,description:c.description,parameters:Bt(c.parameters,e),requestBody:Bt(c.requestBody,e),responses:Bt(c.responses,e)}))}return i}function av(e,t){if(e===t)return!0;let r=e.split("/"),i=t.split("/");return r.length!==i.length?!1:r.every((n,s)=>n.startsWith("{")&&n.endsWith("}")?i[s].length>0:n===i[s])}var cv=8;function Bt(e,t,r=[]){if(Array.isArray(e))return e.map(o=>Bt(o,t,r));if(!e||typeof e!="object")return e;let i=e,n=i.$ref;if(typeof n=="string"){let o=n.replace("#/components/schemas/","");return r.includes(o)||r.length>=cv||!(o in t.components.schemas)?{$ref:n}:Bt(t.components.schemas[o],t,[...r,o])}let s={};for(let[o,a]of Object.entries(i))s[o]=Bt(a,t,r);return s}function pv(e,t){return[...t,e]}function _m(e){return e.option("--profile <name>","use a saved profile (see `spree auth`)").option("--base-url <url>","store URL (overrides profile/env/project)").option("--api-key <key>","secret API key (prefer SPREE_API_KEY \u2014 flags leak into shell history)").option("--store-id <id>","X-Spree-Store-Id for hosts serving multiple stores")}function bm(){return new sa("--format <format>","output format").choices(["json","table"]).default("json")}function ym(e){return _m(e).addOption(bm())}async function fm(e){let t=await fr({baseUrl:e.baseUrl,apiKey:e.apiKey,profile:e.profile});return{client:Nt({baseUrl:t.baseUrl,secretKey:t.apiKey,...e.storeId?{storeId:e.storeId}:{}}),credentials:t}}function xm(e){let t=e.command("api").description("Call the Admin API directly (generic get/post/patch/delete)");t.addHelpText("after",["","Examples:"," spree api get /products -q status_eq=active --limit 10",` spree api post /products -d '{"name":"Classic Tee","prices":[{"currency":"USD","amount":"29.99"}]}'`," spree api get /orders/ord_x8k2J9aQ --expand items,payments","","Discover the surface (offline, no server needed):"," spree api endpoints --search <term> # find endpoints + required scopes",' spree api schema "POST /orders" # request/response schema for one operation'," spree completion zsh # tab-completion for paths, filters, scopes"].join(`
338
+ `)),ym(t.command("get <path>").description("GET an Admin API path, e.g. `spree api get /products -q status_eq=active`").option("-q, --query <expr>","Ransack predicate key=value (repeatable)",pv,[]).option("--sort <fields>","sort, e.g. -created_at").option("--page <n>","page number").option("--limit <n>","page size (max 100)").option("--expand <relations>","expand relations, e.g. variants,variants.prices").option("--fields <fields>","sparse fields, e.g. id,name")).action(async(r,i)=>{let n;try{let s=cm(i),{client:o,credentials:a}=await fm(i);n=a.baseUrl;let c=await o.request("GET",_r(r),{params:s});gr(c,i.format)}catch(s){_t(s,{baseUrl:n})}});for(let r of["post","patch","delete"])ym(t.command(`${r} <path>`).description(`${r.toUpperCase()} an Admin API path`).option("-d, --data <json>","request body: inline JSON, @file, or '-' for stdin")).action(async(i,n)=>{let s;try{let o=await Ea(n.data),{client:a,credentials:c}=await fm(n);s=c.baseUrl;let d=await a.request(r.toUpperCase(),_r(i),{...o===Vn?{}:{body:o}});gr(d,n.format)}catch(o){_t(o,{baseUrl:s})}});t.command("endpoints").description("List Admin API endpoints with their required scopes").option("--resource <name>","filter by first path segment, e.g. orders").option("--search <term>","filter by method, path, or summary").addOption(bm()).action(r=>{let i=mm(an(),{resource:r.resource,search:r.search});if(i.length===0){process.stderr.write(`No endpoints match.
339
+ `),process.exitCode=1;return}if(r.format==="table"){(0,gm.printTable)(i.map(n=>({Method:n.method,Path:n.path,Scope:n.scope,Summary:n.summary})));return}gr(i,"json")}),t.command("schema <operation>").description('Show the request/response schema for an operation, e.g. `spree api schema "POST /products"`').action(r=>{let i=hm(an(),r);if(i.length===0){process.stderr.write(`No operation matches "${r}". Try \`spree api endpoints --search ${r.split(/\s+/).pop()}\`.
340
+ `),process.exitCode=1;return}let n=/\s/.test(r.trim());gr(n&&i.length===1?i[0]:i,"json")}),_m(t.command("status").description("Show resolved credentials, server reachability, and the bundled spec version")).action(async r=>{try{let i=await fr({baseUrl:r.baseUrl,apiKey:r.apiKey,profile:r.profile},{allowMint:!1}),n=await br(i.baseUrl,i.apiKey),s=an(),o=on(n),a=[`${we.default.bold("Base URL:")} ${i.baseUrl}`,`${we.default.bold("Credentials:")} ${i.source}${i.profileName?` (${i.profileName})`:""}, key ${i.tokenPrefix}${we.default.dim("\u2026")}`],c=n.status==="unreachable"||n.status==="unauthorized"?null:await pm(i.baseUrl,i.apiKey);c!==null?a.push(`${we.default.bold("Scopes:")} ${c.length?c.join(", "):we.default.dim("(none)")}`):i.scopes?.length&&a.push(`${we.default.bold("Scopes:")} ${i.scopes.join(", ")} ${we.default.dim("(local snapshot from mint time \u2014 may be stale)")}`),a.push(`${we.default.bold("Server:")} ${o}`),a.push(`${we.default.bold("Bundled spec:")} ${s.info?.version??"unknown"} ${we.default.dim("(spree api endpoints/schema reflect this snapshot, not the live server)")}`),process.stdout.write(`${a.join(`
273
341
  `)}
274
- `),Gi(n)&&(process.exitCode=1)}catch(i){ht(i,{baseUrl:r.baseUrl})}})}import{styleText as Oo}from"util";import{stdout as Ro,stdin as dm}from"process";import*as Ze from"readline";import Lk from"readline";var Kl=(()=>{let e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let r=0;for(e.lastIndex=0;e.test(t);)r+=1;return t.length-r}})(),Yl=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,Jl=e=>e===8987||e===9001||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e>=131072&&e<=196605||e>=196608&&e<=262141;var kk=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,vk=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,Xl=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu,qk=/\t{1,1000}/y,Ql=new RegExp("[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*","yu"),Sk=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,$k=new RegExp("\\p{M}+","gu"),Ak={limit:1/0,ellipsis:""},Zl=(e,t={},r={})=>{let i=t.limit??1/0,n=t.ellipsis??"",s=t?.ellipsisWidth??(n?Zl(n,Ak,r).width:0),o=0,a=r.controlWidth??0,c=r.tabWidth??8,d=r.emojiWidth??2,p=2,u=r.regularWidth??1,l=r.wideWidth??p,m=[[Sk,u],[kk,o],[vk,a],[qk,c],[Ql,d],[Xl,l]],h=0,f=0,x=e.length,_=0,q=!1,A=x,E=Math.max(0,i-s),w=0,L=0,O=0,R=0;e:for(;;){if(L>w||f>=x&&f>h){let F=e.slice(w,L)||e.slice(h,f);_=0;for(let G of F.replaceAll($k,"")){let v=G.codePointAt(0)||0;if(Yl(v)?R=p:Jl(v)?R=l:R=u,O+R>E&&(A=Math.min(A,Math.max(w,h)+_)),O+R>i){q=!0;break e}_+=G.length,O+=R}w=L=0}if(f>=x)break e;for(let F=0,G=m.length;F<G;F++){let[v,Oe]=m[F];if(v.lastIndex=f,v.test(e)){if(_=v===Xl?Kl(e.slice(f,v.lastIndex)):v===Ql?1:v.lastIndex-f,R=_*Oe,O+R>E&&(A=Math.min(A,f+Math.floor((E-O)/Oe))),O+R>i){q=!0;break e}O+=R,w=h,L=f,f=h=v.lastIndex;continue e}}f+=1}return{width:q?E:O,index:q?A:x,truncated:q,ellipsed:q&&i>=s}},em=Zl;var Ck={limit:1/0,ellipsis:"",ellipsisWidth:0},Ek=(e,t={})=>em(e,Ck,t).width,ie=Ek;var Wi="\x1B",sm="\x9B",Pk=39,Co="\x07",om="[",Tk="]",am="m",Eo=`${Tk}8;;`,tm=new RegExp(`(?:\\${om}(?<code>\\d+)m|\\${Eo}(?<uri>.*)${Co})`,"y"),rm=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},im=e=>`${Wi}${om}${e}${am}`,nm=e=>`${Wi}${Eo}${e}${Co}`,Ao=(e,t,r)=>{let i=t[Symbol.iterator](),n=!1,s=!1,o=e.at(-1),a=o===void 0?0:ie(o),c=i.next(),d=i.next(),p=0;for(;!c.done;){let u=c.value,l=ie(u);a+l<=r?e[e.length-1]+=u:(e.push(u),a=0),(u===Wi||u===sm)&&(n=!0,s=t.startsWith(Eo,p+1)),n?s?u===Co&&(n=!1,s=!1):u===am&&(n=!1):(a+=l,a===r&&!d.done&&(e.push(""),a=0)),c=d,d=i.next(),p+=u.length}o=e.at(-1),!a&&o!==void 0&&o.length&&e.length>1&&(e[e.length-2]+=e.pop())},Ok=e=>{let t=e.split(" "),r=t.length;for(;r&&!ie(t[r-1]);)r--;return r===t.length?e:t.slice(0,r).join(" ")+t.slice(r).join("")},Ik=(e,t,r={})=>{if(r.trim!==!1&&e.trim()==="")return"";let i="",n,s,o=e.split(" "),a=[""],c=0;for(let u=0;u<o.length;u++){let l=o[u];if(r.trim!==!1){let h=a.at(-1)??"",f=h.trimStart();h.length!==f.length&&(a[a.length-1]=f,c=ie(f))}u!==0&&(c>=t&&(r.wordWrap===!1||r.trim===!1)&&(a.push(""),c=0),(c||r.trim===!1)&&(a[a.length-1]+=" ",c++));let m=ie(l);if(r.hard&&m>t){let h=t-c,f=1+Math.floor((m-h-1)/t);Math.floor((m-1)/t)<f&&a.push(""),Ao(a,l,t),c=ie(a.at(-1)??"");continue}if(c+m>t&&c&&m){if(r.wordWrap===!1&&c<t){Ao(a,l,t),c=ie(a.at(-1)??"");continue}a.push(""),c=0}if(c+m>t&&r.wordWrap===!1){Ao(a,l,t),c=ie(a.at(-1)??"");continue}a[a.length-1]+=l,c+=m}r.trim!==!1&&(a=a.map(u=>Ok(u)));let d=a.join(`
275
- `),p=!1;for(let u=0;u<d.length;u++){let l=d[u];if(i+=l,p)p=!1;else if(p=l>="\uD800"&&l<="\uDBFF",p)continue;if(l===Wi||l===sm){tm.lastIndex=u+1;let h=tm.exec(d)?.groups;if(h?.code!==void 0){let f=Number.parseFloat(h.code);n=f===Pk?void 0:f}else h?.uri!==void 0&&(s=h.uri.length===0?void 0:h.uri)}if(d[u+1]===`
276
- `){s&&(i+=nm(""));let m=n?rm(n):void 0;n&&m&&(i+=im(m))}else l===`
277
- `&&(n&&rm(n)&&(i+=im(n)),s&&(i+=nm(s)))}return i},Rk=/\r?\n/;function Ee(e,t,r){return String(e).normalize().split(Rk).map(i=>Ik(i,t,r)).join(`
278
- `)}var te=U(To(),1);import{ReadStream as pm}from"tty";function Ki(e,t,r){if(!r.some(o=>!o.disabled))return e;let i=e+t,n=Math.max(r.length-1,0),s=i<0?n:i>n?0:i;return r[s].disabled?Ki(s,t<0?-1:1,r):s}var Mk=["up","down","left","right","space","enter","cancel"],Fk=["January","February","March","April","May","June","July","August","September","October","November","December"],Z={actions:new Set(Mk),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"},withGuide:!0,date:{monthNames:[...Fk],messages:{required:"Please enter a valid date",invalidMonth:"There are only 12 months in a year",invalidDay:(e,t)=>`There are only ${e} days in ${t}`,afterMin:e=>`Date must be on or after ${e.toISOString().slice(0,10)}`,beforeMax:e=>`Date must be on or before ${e.toISOString().slice(0,10)}`}}};function jo(e,t){if(typeof e=="string")return Z.aliases.get(e)===t;for(let r of e)if(r!==void 0&&jo(r,t))return!0;return!1}function Bk(e,t){if(e===t)return;let r=e.split(`
279
- `),i=t.split(`
280
- `),n=Math.max(r.length,i.length),s=[];for(let o=0;o<n;o++)r[o]!==i[o]&&s.push(o);return{lines:s,numLinesBefore:r.length,numLinesAfter:i.length,numLines:n}}var Uk=globalThis.process.platform.startsWith("win"),Io=Symbol("clack:cancel");function Y(e){return e===Io}function Hi(e,t){let r=e;r.isTTY&&r.setRawMode(t)}function um({input:e=dm,output:t=Ro,overwrite:r=!0,hideCursor:i=!0}={}){let n=Ze.createInterface({input:e,output:t,prompt:"",tabSize:1});Ze.emitKeypressEvents(e,n),e instanceof pm&&e.isTTY&&e.setRawMode(!0);let s=(o,{name:a,sequence:c})=>{let d=String(o);if(jo([d,a,c],"cancel")){i&&t.write(te.cursor.show),process.exit(0);return}if(!r)return;Ze.moveCursor(t,a==="return"?0:-1,a==="return"?-1:0,()=>{Ze.clearLine(t,1,()=>{e.once("keypress",s)})})};return i&&t.write(te.cursor.hide),e.once("keypress",s),()=>{e.off("keypress",s),i&&t.write(te.cursor.show),e instanceof pm&&e.isTTY&&!Uk&&e.setRawMode(!1),n.terminal=!1,n.close()}}var yr=e=>"columns"in e&&typeof e.columns=="number"?e.columns:80,Do=e=>"rows"in e&&typeof e.rows=="number"?e.rows:20;function fr(e,t,r,i=r,n){let s=yr(e??Ro);return Ee(t,s-r.length,{hard:!0,trim:!1}).split(`
281
- `).map((o,a)=>{let c=n?n(o,a):o;return`${a===0?i:r}${c}`}).join(`
282
- `)}var Zi=class{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame="";_subscribers=new Map;_cursor=0;state="initial";error="";value;userInput="";constructor(e,t=!0){let{input:r=dm,output:i=Ro,render:n,signal:s,...o}=e;this.opts=o,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=n.bind(this),this._track=t,this._abortSignal=s,this.input=r,this.output=i}unsubscribe(){this._subscribers.clear()}setSubscriber(e,t){let r=this._subscribers.get(e)??[];r.push(t),this._subscribers.set(e,r)}on(e,t){this.setSubscriber(e,{cb:t})}once(e,t){this.setSubscriber(e,{cb:t,once:!0})}emit(e,...t){let r=this._subscribers.get(e)??[],i=[];for(let n of r)n.cb(...t),n.once&&i.push(()=>r.splice(r.indexOf(n),1));for(let n of i)n()}prompt(){return new Promise(e=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),e(Io);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}this.rl=Lk.createInterface({input:this.input,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),this.rl.prompt(),this.opts.initialUserInput!==void 0&&this._setUserInput(this.opts.initialUserInput,!0),this.input.on("keypress",this.onKeypress),Hi(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(te.cursor.show),this.output.off("resize",this.render),Hi(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(te.cursor.show),this.output.off("resize",this.render),Hi(this.input,!1),e(Io)})})}_isActionKey(e,t){return e===" "}_shouldSubmit(e,t){return!0}_setValue(e){this.value=e,this.emit("value",this.value)}_setUserInput(e,t){this.userInput=e??"",this.emit("userInput",this.userInput),t&&this._track&&this.rl&&(this.rl.write(this.userInput),this._cursor=this.rl.cursor)}_clearUserInput(){this.rl?.write(null,{ctrl:!0,name:"u"}),this._setUserInput("")}onKeypress(e,t){if(this._track&&t.name!=="return"&&(t.name&&this._isActionKey(e,t)&&this.rl?.write(null,{ctrl:!0,name:"h"}),this._cursor=this.rl?.cursor??0,this._setUserInput(this.rl?.line)),this.state==="error"&&(this.state="active"),t?.name&&(!this._track&&Z.aliases.has(t.name)&&this.emit("cursor",Z.aliases.get(t.name)),Z.actions.has(t.name)&&this.emit("cursor",t.name)),e&&(e.toLowerCase()==="y"||e.toLowerCase()==="n")&&this.emit("confirm",e.toLowerCase()==="y"),this.emit("key",e?.toLowerCase(),t),t?.name==="return"&&this._shouldSubmit(e,t)){if(this.opts.validate){let r=this.opts.validate(this.value);r&&(this.error=r instanceof Error?r.message:r,this.state="error",this.rl?.write(this.userInput))}this.state!=="error"&&(this.state="submit")}jo([e,t?.name,t?.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(`
283
- `),Hi(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=Ee(this._prevFrame,process.stdout.columns,{hard:!0,trim:!1}).split(`
284
- `).length-1;this.output.write(te.cursor.move(-999,e*-1))}render(){let e=Ee(this._render(this)??"",process.stdout.columns,{hard:!0,trim:!1});if(e!==this._prevFrame){if(this.state==="initial")this.output.write(te.cursor.hide);else{let t=Bk(this._prevFrame,e),r=Do(this.output);if(this.restoreCursor(),t){let i=Math.max(0,t.numLinesAfter-r),n=Math.max(0,t.numLinesBefore-r),s=t.lines.find(o=>o>=i);if(s===void 0){this._prevFrame=e;return}if(t.lines.length===1){this.output.write(te.cursor.move(0,s-n)),this.output.write(te.erase.lines(1));let o=e.split(`
285
- `);this.output.write(o[s]),this._prevFrame=e,this.output.write(te.cursor.move(0,o.length-s-1));return}else if(t.lines.length>1){if(i<n)s=i;else{let a=s-n;a>0&&this.output.write(te.cursor.move(0,a))}this.output.write(te.erase.down());let o=e.split(`
286
- `).slice(s);this.output.write(o.join(`
287
- `)),this._prevFrame=e;return}}this.output.write(te.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}};var Yi=class extends Zi{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(t){super(t,!1),this.value=!!t.initialValue,this.on("userInput",()=>{this.value=this._value}),this.on("confirm",r=>{this.output.write(te.cursor.move(0,-1)),this.value=r,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};var Ji=class extends Zi{_mask="\u2022";get cursor(){return this._cursor}get masked(){return this.userInput.replaceAll(/./g,this._mask)}get userInputWithCursor(){if(this.state==="submit"||this.state==="cancel")return this.masked;let t=this.userInput;if(this.cursor>=t.length)return`${this.masked}${Oo(["inverse","hidden"],"_")}`;let r=this.masked,i=r.slice(0,this.cursor),n=r.slice(this.cursor);return`${i}${Oo("inverse",n[0])}${n.slice(1)}`}clear(){this._clearUserInput()}constructor({mask:t,...r}){super(r),this._mask=t??"\u2022",this.on("userInput",i=>{this._setValue(i)})}},Xi=class extends Zi{options;cursor=0;get _selectedValue(){return this.options[this.cursor]}changeValue(){this.value=this._selectedValue.value}constructor(t){super(t,!1),this.options=t.options;let r=this.options.findIndex(({value:n})=>n===t.initialValue),i=r===-1?0:r;this.cursor=this.options[i].disabled?Ki(i,1,this.options):i,this.changeValue(),this.on("cursor",n=>{switch(n){case"left":case"up":this.cursor=Ki(this.cursor,-1,this.options);break;case"down":case"right":this.cursor=Ki(this.cursor,1,this.options);break}this.changeValue()})}};var Qi=class extends Zi{get userInputWithCursor(){if(this.state==="submit")return this.userInput;let t=this.userInput;if(this.cursor>=t.length)return`${this.userInput}\u2588`;let r=t.slice(0,this.cursor),[i,...n]=t.slice(this.cursor);return`${r}${Oo("inverse",i)}${n.join("")}`}get cursor(){return this._cursor}constructor(t){super({...t,initialUserInput:t.initialUserInput??t.initialValue}),this.on("userInput",r=>{this._setValue(r)}),this.on("finalize",()=>{this.value||(this.value=t.defaultValue),this.value===void 0&&(this.value="")})}};import{styleText as y,stripVTControlCharacters as $D}from"util";import ye from"process";var gr=U(To(),1);import{existsSync as TD,lstatSync as OD,readdirSync as ID}from"fs";import{dirname as jD,join as DD}from"path";function Nk(){return ye.platform!=="win32"?ye.env.TERM!=="linux":!!ye.env.CI||!!ye.env.WT_SESSION||!!ye.env.TERMINUS_SUBLIME||ye.env.ConEmuTask==="{cmd::Cmder}"||ye.env.TERM_PROGRAM==="Terminus-Sublime"||ye.env.TERM_PROGRAM==="vscode"||ye.env.TERM==="xterm-256color"||ye.env.TERM==="alacritty"||ye.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var Lo=Nk(),Gk=()=>process.env.CI==="true";var j=(e,t)=>Lo?e:t,zk=j("\u25C6","*"),mm=j("\u25A0","x"),hm=j("\u25B2","x"),rn=j("\u25C7","o"),LD=j("\u250C","T"),$=j("\u2502","|"),et=j("\u2514","\u2014"),MD=j("\u2510","T"),FD=j("\u2518","\u2014"),Mo=j("\u25CF",">"),tn=j("\u25CB"," "),BD=j("\u25FB","[\u2022]"),UD=j("\u25FC","[+]"),ND=j("\u25FB","[ ]"),Vk=j("\u25AA","\u2022"),lm=j("\u2500","-"),Wk=j("\u256E","+"),Hk=j("\u251C","+"),Kk=j("\u256F","+"),Yk=j("\u2570","+"),GD=j("\u256D","+"),Jk=j("\u25CF","\u2022"),Xk=j("\u25C6","*"),Qk=j("\u25B2","!"),Zk=j("\u25A0","x"),nn=e=>{switch(e){case"initial":case"active":return y("cyan",zk);case"cancel":return y("red",mm);case"error":return y("yellow",hm);case"submit":return y("green",rn)}},ev=e=>{switch(e){case"initial":case"active":return y("cyan",$);case"cancel":return y("red",$);case"error":return y("yellow",$);case"submit":return y("green",$)}},tv=(e,t,r,i,n)=>{let s=t,o=0;for(let a=r;a<i;a++){let c=e[a];if(s=s-c.length,o++,s<=n)break}return{lineCount:s,removals:o}},rv=({cursor:e,options:t,style:r,output:i=process.stdout,maxItems:n=Number.POSITIVE_INFINITY,columnPadding:s=0,rowPadding:o=4})=>{let a=yr(i)-s,c=Do(i),d=y("dim","..."),p=Math.max(c-o,0),u=Math.max(Math.min(n,p),5),l=0;e>=u-3&&(l=Math.max(Math.min(e-u+3,t.length-u),0));let m=u<t.length&&l>0,h=u<t.length&&l+u<t.length,f=Math.min(l+u,t.length),x=[],_=0;m&&_++,h&&_++;let q=l+(m?1:0),A=f-(h?1:0);for(let w=q;w<A;w++){let L=Ee(r(t[w],w===e),a,{hard:!0,trim:!1}).split(`
288
- `);x.push(L),_+=L.length}if(_>p){let w=0,L=0,O=_,R=e-q,F=(G,v)=>tv(x,O,G,v,p);m?({lineCount:O,removals:w}=F(0,R),O>p&&({lineCount:O,removals:L}=F(R+1,x.length))):({lineCount:O,removals:L}=F(R+1,x.length),O>p&&({lineCount:O,removals:w}=F(0,R))),w>0&&(m=!0,x.splice(0,w)),L>0&&(h=!0,x.splice(x.length-L,L))}let E=[];m&&E.push(d);for(let w of x)for(let L of w)E.push(L);return h&&E.push(d),E};var yt=e=>{let t=e.active??"Yes",r=e.inactive??"No";return new Yi({active:t,inactive:r,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue??!0,render(){let i=e.withGuide??Z.withGuide,n=`${nn(this.state)} `,s=i?`${y("gray",$)} `:"",o=fr(e.output,e.message,s,n),a=`${i?`${y("gray",$)}
289
- `:""}${o}
290
- `,c=this.value?t:r;switch(this.state){case"submit":{let d=i?`${y("gray",$)} `:"";return`${a}${d}${y("dim",c)}`}case"cancel":{let d=i?`${y("gray",$)} `:"";return`${a}${d}${y(["strikethrough","dim"],c)}${i?`
291
- ${y("gray",$)}`:""}`}default:{let d=i?`${y("cyan",$)} `:"",p=i?y("cyan",et):"";return`${a}${d}${this.value?`${y("green",Mo)} ${t}`:`${y("dim",tn)} ${y("dim",t)}`}${e.vertical?i?`
292
- ${y("cyan",$)} `:`
293
- `:` ${y("dim","/")} `}${this.value?`${y("dim",tn)} ${y("dim",r)}`:`${y("green",Mo)} ${r}`}
294
- ${p}
295
- `}}}}).prompt()};var T={message:(e=[],{symbol:t=y("gray",$),secondarySymbol:r=y("gray",$),output:i=process.stdout,spacing:n=1,withGuide:s}={})=>{let o=[],a=s??Z.withGuide,c=a?r:"",d=a?`${t} `:"",p=a?`${r} `:"";for(let l=0;l<n;l++)o.push(c);let u=Array.isArray(e)?e:e.split(`
296
- `);if(u.length>0){let[l,...m]=u;l.length>0?o.push(`${d}${l}`):o.push(a?t:"");for(let h of m)h.length>0?o.push(`${p}${h}`):o.push(a?r:"")}i.write(`${o.join(`
297
- `)}
298
- `)},info:(e,t)=>{T.message(e,{...t,symbol:y("blue",Jk)})},success:(e,t)=>{T.message(e,{...t,symbol:y("green",Xk)})},step:(e,t)=>{T.message(e,{...t,symbol:y("green",rn)})},warn:(e,t)=>{T.message(e,{...t,symbol:y("yellow",Qk)})},warning:(e,t)=>{T.warn(e,t)},error:(e,t)=>{T.message(e,{...t,symbol:y("red",Zk)})}},N=(e="",t)=>{let r=t?.output??process.stdout,i=t?.withGuide??Z.withGuide?`${y("gray",et)} `:"";r.write(`${i}${y("red",e)}
299
-
300
- `)};var ym=(e="",t)=>{let r=t?.output??process.stdout,i=t?.withGuide??Z.withGuide?`${y("gray",$)}
301
- ${y("gray",et)} `:"";r.write(`${i}${e}
302
-
303
- `)};var iv=e=>y("dim",e),nv=(e,t,r)=>{let i={hard:!0,trim:!1},n=Ee(e,t,i).split(`
304
- `),s=n.reduce((c,d)=>Math.max(ie(d),c),0),o=n.map(r).reduce((c,d)=>Math.max(ie(d),c),0),a=t-(o-s);return Ee(e,a,i)},ee=(e="",t="",r)=>{let i=r?.output??ye.stdout,n=r?.withGuide??Z.withGuide,s=r?.format??iv,o=["",...nv(e,yr(i)-6,s).split(`
305
- `).map(s),""],a=ie(t),c=Math.max(o.reduce((l,m)=>{let h=ie(m);return h>l?h:l},0),a)+2,d=o.map(l=>`${y("gray",$)} ${l}${" ".repeat(c-ie(l))}${y("gray",$)}`).join(`
306
- `),p=n?`${y("gray",$)}
307
- `:"",u=n?Hk:Yk;i.write(`${p}${y("green",rn)} ${y("reset",t)} ${y("gray",lm.repeat(Math.max(c-a-1,1))+Wk)}
308
- ${d}
309
- ${y("gray",u+lm.repeat(c+2)+Kk)}
310
- `)},sn=e=>new Ji({validate:e.validate,mask:e.mask??Vk,signal:e.signal,input:e.input,output:e.output,render(){let t=e.withGuide??Z.withGuide,r=`${t?`${y("gray",$)}
311
- `:""}${nn(this.state)} ${e.message}
312
- `,i=this.userInputWithCursor,n=this.masked;switch(this.state){case"error":{let s=t?`${y("yellow",$)} `:"",o=t?`${y("yellow",et)} `:"",a=n??"";return e.clearOnError&&this.clear(),`${r.trim()}
313
- ${s}${a}
314
- ${o}${y("yellow",this.error)}
315
- `}case"submit":{let s=t?`${y("gray",$)} `:"",o=n?y("dim",n):"";return`${r}${s}${o}`}case"cancel":{let s=t?`${y("gray",$)} `:"",o=n?y(["strikethrough","dim"],n):"";return`${r}${s}${o}${n&&t?`
316
- ${y("gray",$)}`:""}`}default:{let s=t?`${y("cyan",$)} `:"",o=t?y("cyan",et):"";return`${r}${s}${i}
317
- ${o}
318
- `}}}}).prompt();var sv=e=>y("magenta",e),z=({indicator:e="dots",onCancel:t,output:r=process.stdout,cancelMessage:i,errorMessage:n,frames:s=Lo?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],delay:o=Lo?80:120,signal:a,...c}={})=>{let d=Gk(),p,u,l=!1,m=!1,h="",f,x=performance.now(),_=yr(r),q=c?.styleFrame??sv,A=B=>{let se=B>1?n??Z.messages.error:i??Z.messages.cancel;m=B===1,l&&(Ie(se,B),m&&typeof t=="function"&&t())},E=()=>A(2),w=()=>A(1),L=()=>{process.on("uncaughtExceptionMonitor",E),process.on("unhandledRejection",E),process.on("SIGINT",w),process.on("SIGTERM",w),process.on("exit",A),a&&a.addEventListener("abort",w)},O=()=>{process.removeListener("uncaughtExceptionMonitor",E),process.removeListener("unhandledRejection",E),process.removeListener("SIGINT",w),process.removeListener("SIGTERM",w),process.removeListener("exit",A),a&&a.removeEventListener("abort",w)},R=()=>{if(f===void 0)return;d&&r.write(`
319
- `);let B=Ee(f,_,{hard:!0,trim:!1}).split(`
320
- `);B.length>1&&r.write(gr.cursor.up(B.length-1)),r.write(gr.cursor.to(0)),r.write(gr.erase.down())},F=B=>B.replace(/\.+$/,""),G=B=>{let se=(performance.now()-B)/1e3,Re=Math.floor(se/60),je=Math.floor(se%60);return Re>0?`[${Re}m ${je}s]`:`[${je}s]`},v=c.withGuide??Z.withGuide,Oe=(B="")=>{l=!0,p=um({output:r}),h=F(B),x=performance.now(),v&&r.write(`${y("gray",$)}
321
- `);let se=0,Re=0;L(),u=setInterval(()=>{if(d&&h===f)return;R(),f=h;let je=q(s[se]),br;if(d)br=`${je} ${h}...`;else if(e==="timer")br=`${je} ${h} ${G(x)}`;else{let th=".".repeat(Math.floor(Re)).slice(0,3);br=`${je} ${h}${th}`}let eh=Ee(br,_,{hard:!0,trim:!1});r.write(eh),se=se+1<s.length?se+1:0,Re=Re<4?Re+.125:0},o)},Ie=(B="",se=0,Re=!1)=>{if(!l)return;l=!1,clearInterval(u),R();let je=se===0?y("green",rn):se===1?y("red",mm):y("red",hm);h=B??h,Re||(e==="timer"?r.write(`${je} ${h} ${G(x)}
322
- `):r.write(`${je} ${h}
323
- `)),O(),p()};return{start:Oe,stop:(B="")=>Ie(B,0),message:(B="")=>{h=F(B??h)},cancel:(B="")=>Ie(B,1),error:(B="")=>Ie(B,2),clear:()=>Ie("",0,!0),get isCancelled(){return m}}},zD={light:j("\u2500","-"),heavy:j("\u2501","="),block:j("\u2588","#")};var en=(e,t)=>e.includes(`
324
- `)?e.split(`
325
- `).map(r=>t(r)).join(`
326
- `):t(e),fm=e=>{let t=(r,i)=>{let n=r.label??String(r.value);switch(i){case"disabled":return`${y("gray",tn)} ${en(n,s=>y("gray",s))}${r.hint?` ${y("dim",`(${r.hint??"disabled"})`)}`:""}`;case"selected":return`${en(n,s=>y("dim",s))}`;case"active":return`${y("green",Mo)} ${n}${r.hint?` ${y("dim",`(${r.hint})`)}`:""}`;case"cancelled":return`${en(n,s=>y(["strikethrough","dim"],s))}`;default:return`${y("dim",tn)} ${en(n,s=>y("dim",s))}`}};return new Xi({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue,render(){let r=e.withGuide??Z.withGuide,i=`${nn(this.state)} `,n=`${ev(this.state)} `,s=fr(e.output,e.message,n,i),o=`${r?`${y("gray",$)}
327
- `:""}${s}
328
- `;switch(this.state){case"submit":{let a=r?`${y("gray",$)} `:"",c=fr(e.output,t(this.options[this.cursor],"selected"),a);return`${o}${c}`}case"cancel":{let a=r?`${y("gray",$)} `:"",c=fr(e.output,t(this.options[this.cursor],"cancelled"),a);return`${o}${c}${r?`
329
- ${y("gray",$)}`:""}`}default:{let a=r?`${y("cyan",$)} `:"",c=r?y("cyan",et):"",d=o.split(`
330
- `).length,p=r?2:1;return`${o}${a}${rv({output:e.output,cursor:this.cursor,options:this.options,maxItems:e.maxItems,columnPadding:a.length,rowPadding:d+p,style:(u,l)=>t(u,u.disabled?"disabled":l?"active":"inactive")}).join(`
331
- ${a}`)}
332
- ${c}
333
- `}}}}).prompt()};var VD=`${y("gray",$)} `;var ft=e=>new Qi({validate:e.validate,placeholder:e.placeholder,defaultValue:e.defaultValue,initialValue:e.initialValue,output:e.output,signal:e.signal,input:e.input,render(){let t=e?.withGuide??Z.withGuide,r=`${`${t?`${y("gray",$)}
334
- `:""}${nn(this.state)} `}${e.message}
335
- `,i=e.placeholder?y("inverse",e.placeholder[0])+y("dim",e.placeholder.slice(1)):y(["inverse","hidden"],"_"),n=this.userInput?this.userInputWithCursor:i,s=this.value??"";switch(this.state){case"error":{let o=this.error?` ${y("yellow",this.error)}`:"",a=t?`${y("yellow",$)} `:"",c=t?y("yellow",et):"";return`${r.trim()}
336
- ${a}${n}
337
- ${c}${o}
338
- `}case"submit":{let o=s?` ${y("dim",s)}`:"",a=t?y("gray",$):"";return`${r}${a}${o}`}case"cancel":{let o=s?` ${y(["strikethrough","dim"],s)}`:"",a=t?y("gray",$):"";return`${r}${a}${o}${s.trim()?`
339
- ${a}`:""}`}default:{let o=t?`${y("cyan",$)} `:"",a=t?y("cyan",et):"";return`${r}${o}${n}
340
- ${a}
341
- `}}}}).prompt();var gm=U(Wt(),1),Ge=U(X(),1);function _m(e){let t=e.command("api-key").description("Manage API keys");t.command("create").description("Create an API key").option("--name <name>","key name").option("--type <type>","key type: publishable or secret").option("--scopes <scopes>","comma-separated scopes for secret keys (e.g. read_all or read_orders,write_products)").action(async r=>{let i=g(),n=r.name,s=r.type,o=r.scopes;if(!n){let m=await ft({message:"Key name:",placeholder:"My Storefront",validate(h){if(!h)return"Name is required"}});Y(m)&&(N("Cancelled."),process.exit(0)),n=m}if(!s){let m=await fm({message:"Key type:",options:[{value:"publishable",label:"Publishable (for storefronts)"},{value:"secret",label:"Secret (for server-to-server)"}]});Y(m)&&(N("Cancelled."),process.exit(0)),s=m}if(s!=="publishable"&&s!=="secret")throw new Error('Key type must be "publishable" or "secret".');if(s==="secret"&&!o){let m=await ft({message:"Scopes (comma-separated):",placeholder:"read_all",initialValue:"read_all",validate(h){if(!h)return"Secret keys require at least one scope"}});Y(m)&&(N("Cancelled."),process.exit(0)),o=m}let a=z();a.start("Creating API key...");let c=await Q("spree:cli:create_api_key",i.projectDir,{NAME:n,KEY_TYPE:s,...s==="secret"&&o?{SCOPES:o}:{}}),d=s==="publishable"?"pk_":"sk_",p=c.match(new RegExp(`${d}[A-Za-z0-9_-]+`)),u=p?p[0]:c.trim();a.stop("API key created.");let l=[`${Ge.default.bold("Name:")} ${n}`,`${Ge.default.bold("Type:")} ${s}`,`${Ge.default.bold("Token:")} ${Ge.default.cyan(u)}`];s==="secret"&&(l.push(`${Ge.default.bold("Scopes:")} ${o}`),l.push(""),l.push(Ge.default.yellow("Save this token now \u2014 secret keys cannot be retrieved later."))),ee(l.join(`
342
- `),"API Key")}),t.command("list").description("List API keys").action(async()=>{let r=g(),i=z();i.start("Fetching API keys...");let n=await Q("spree:cli:list_api_keys",r.projectDir);i.stop("");let s=n.trim().split(`
343
- `).filter(Boolean);if(s.length===0){T.info("No API keys found.");return}let o=s.map(a=>{let[c,d,p,u,l,m]=a.split("|");return{ID:c??"",Name:d??"",Type:p??"",Token:u??"",Created:l??"",Status:m==="active"?Ge.default.green(m):Ge.default.red(m??"")}});(0,gm.printTable)(o)}),t.command("revoke").description("Revoke an API key").argument("<id>","ID of the key to revoke (from api-key list)").action(async r=>{let i=g(),n=z();n.start("Revoking API key...");let o=(await Q("spree:cli:revoke_api_key",i.projectDir,{ID:r})).trim();n.stop(`API key "${o}" revoked.`)})}var bm=U(Wt(),1),J=U(X(),1);function xm(e){let t=e.command("auth").description("Manage Admin API credentials (profiles in ~/.config/spree)");t.command("login").description("Save a secret API key as a named profile").option("--profile <name>","profile name","default").option("--base-url <url>","store URL, e.g. https://store.example.com").action(async r=>{process.stdin.isTTY||(process.stderr.write(`${J.default.red("error:")} \`spree auth login\` is interactive. For non-interactive use, set SPREE_BASE_URL + SPREE_API_KEY (or pass --base-url/--api-key to \`spree api\`).
344
- `),process.exit(2));let i=r.baseUrl;if(!i){let d=await ft({message:"Store URL:",placeholder:"https://store.example.com",validate(p){if(!p)return"URL is required";if(!/^https?:\/\//.test(p))return"Must start with http:// or https://"}});Y(d)&&(N("Cancelled."),process.exit(130)),i=d}i=i.replace(/\/$/,"");let n=await sn({message:"Secret API key (sk_...):",validate(d){if(!d)return"Key is required";if(!d.startsWith("sk_"))return"Admin API keys start with sk_"}});Y(n)&&(N("Cancelled."),process.exit(130));let s=n,o=z();o.start("Validating credentials...");let a=await hr(i,s);a.status==="unauthorized"&&(o.stop(J.default.red("The server rejected this key (401). Check the key and try again.")),process.exit(2)),a.status==="unreachable"&&(o.stop(J.default.red(`Could not reach ${i}: ${a.message}`)),process.exit(2)),o.stop(a.storeName?`Connected to ${J.default.bold(a.storeName)}.`:"Credentials accepted (key lacks read_settings, so the store name is hidden \u2014 that is fine).");let c=dr();c.profiles[r.profile]={baseUrl:i,token:s},c.defaultProfile||=r.profile,qo(c),ee([`${J.default.bold("Profile:")} ${r.profile}${c.defaultProfile===r.profile?J.default.dim(" (default)"):""}`,`${J.default.bold("Base URL:")} ${i}`,`${J.default.bold("Key:")} ${Ni(s)}${J.default.dim("\u2026")}`,"",J.default.dim(`Saved to ${mt()}`)].join(`
345
- `),"Logged in")}),t.command("status").description("Show which credentials `spree api` would use, and verify them").option("--profile <name>","check a specific profile").action(async r=>{let i;try{i=await ur({profile:r.profile},{allowMint:!1})}catch(a){ht(a)}let n=z();n.start("Checking server...");let s=await hr(i.baseUrl,i.apiKey);n.stop("");let o=zi(s);ee([`${J.default.bold("Source:")} ${i.source}${i.profileName?` (${i.profileName})`:""}`,`${J.default.bold("Base URL:")} ${i.baseUrl}`,`${J.default.bold("Key:")} ${i.tokenPrefix}${J.default.dim("\u2026")}`,...i.scopes?[`${J.default.bold("Scopes:")} ${i.scopes.join(", ")}`]:[],`${J.default.bold("Server:")} ${o}`].join(`
346
- `),"Auth status"),Gi(s)&&(process.exitCode=1)}),t.command("logout").description("Remove a saved profile (or the project credentials)").option("--profile <name>","profile to remove","default").option("--project","remove .spree/credentials.json from the current project instead").action(async r=>{if(r.project){let n;try{n=g().projectDir}catch(o){ht(o)}(await import("fs")).rmSync(Ui(n),{force:!0}),T.success("Removed project credentials. The next `spree api` call mints a fresh read-only key.");return}let i=dr();if(!i.profiles[r.profile]){let n=Object.keys(i.profiles),s=n.length?` Saved profiles: ${n.join(", ")}.`:" No profiles are saved.";process.stderr.write(`${J.default.red("error:")} no profile named "${r.profile}".${s}
347
- `),process.exit(2)}delete i.profiles[r.profile],i.defaultProfile===r.profile&&(i.defaultProfile=Object.keys(i.profiles)[0]),qo(i),T.success(`Removed profile "${r.profile}". The key itself stays active \u2014 revoke it with \`spree api-key revoke\` or in the admin.`)}),t.command("list").description("List saved profiles").action(()=>{let r=dr(),i=Object.keys(r.profiles);if(i.length===0){T.info("No profiles saved. Run `spree auth login` to add one.");return}(0,bm.printTable)(i.map(n=>({Profile:r.defaultProfile===n?`${n} *`:n,"Base URL":r.profiles[n].baseUrl,Key:`${Ni(r.profiles[n].token)}\u2026`})))})}import wm from"fs";import km from"path";var tt=U(X(),1);function vm(e){e.command("build").description("Rebuild the dev image (after Dockerfile / .ruby-version changes)").option("--reset-bundle","also wipe the bundle_cache volume to re-seed gems").option("--yes","skip confirmation prompts (for CI)").action(async t=>{let r=g();if(We(r.projectDir)&&(N(["This project uses SPREE_PATH for monorepo development.",`Use ${tt.default.bold("pnpm server:build")} from the monorepo root instead of ${tt.default.bold("spree build")}.`,"It builds against the edge compose overlay the running stack was started with."].join(`
348
- `)),process.exit(1)),ov(r.projectDir)||(console.error(`
349
- ${tt.default.red("Error:")} docker-compose.yml has no \`build:\` section. Run ${tt.default.bold("spree eject")} first to switch to a build-from-source stack.
350
- `),process.exit(1)),t.resetBundle){if(!t.yes){let n=await yt({message:"Wipe the bundle_cache volume? Any gems added via `spree bundle add` since the last image build will be lost.",initialValue:!1});(Y(n)||!n)&&(N("Build cancelled."),process.exit(0))}let i=z();i.start("Wiping bundle_cache volume...");try{await H(["down"],r.projectDir,{stdio:"ignore"});let s=`${await av(r.projectDir)}_bundle_cache`;await cv(s,r.projectDir)?(await he("docker",["volume","rm",s],{cwd:r.projectDir,stdio:"ignore"}),i.stop("bundle_cache volume wiped.")):i.stop(`bundle_cache volume not present (looked for ${s}).`)}catch(n){throw i.stop("Failed to wipe bundle_cache volume."),n}}console.log(`
351
- ${tt.default.bold("Rebuilding dev image...")}
352
- `),await H(["build","web","worker"],r.projectDir,{stdio:"inherit"}),ee([`Image rebuilt. Start the stack with ${tt.default.bold("spree dev")}.`,t.resetBundle?`On next boot, gems will re-seed into a fresh ${tt.default.dim("bundle_cache")} volume.`:""].filter(Boolean).join(`
353
- `),"Build complete")})}function ov(e){let t=km.join(e,"docker-compose.yml");return wm.existsSync(t)?/^\s*build\s*:/m.test(wm.readFileSync(t,"utf-8")):!1}async function av(e){try{let{stdout:t}=await he("docker",["compose","config","--format","json"],{cwd:e}),r=JSON.parse(t);if(r.name)return r.name}catch{}return km.basename(e).toLowerCase().replace(/[^a-z0-9_-]/g,"")}async function cv(e,t){try{return await he("docker",["volume","inspect",e],{cwd:t,stdio:"ignore"}),!0}catch{return!1}}var qm=U(X(),1);function Sm(e){e.command("bundle").description("Run a bundler command (`bundle \u2026`) inside the web container").argument("<args...>","arguments to pass to bundle").allowUnknownOption(!0).passThroughOptions(!0).action(async t=>{let r=g();if(await Fi("web",r.projectDir)){await I(["bundle",...t],r.projectDir);return}We(r.projectDir)&&(N(["The web container is not running, and this is a monorepo edge project.",`Run ${qm.default.bold("pnpm server:dev")} from the monorepo root \u2014 the edge stack heals gem drift on boot.`].join(`
354
- `)),process.exit(1)),T.info("web container is not running \u2014 using a one-off container (`docker compose run`) instead."),await H(["run","--rm","web","bundle",...t],r.projectDir,{stdio:"inherit"})})}var $m=["/admin_users","/allowed_origins","/api_keys","/auth","/categories","/channels","/custom_field_definitions","/customer_groups","/customers","/exports","/gift_card_batches","/gift_cards","/invitations","/locales","/markets","/me","/option_types","/orders","/payment_methods","/price_lists","/prices","/products","/promotion_actions","/promotion_rules","/promotions","/roles","/stock_locations","/store","/store_credit_categories","/tags","/translatable_resources","/translations","/webhook_endpoints"];var Am=["bash","zsh","fish"],dv=["eq","not_eq","cont","not_cont","start","end","in","not_in","gt","gteq","lt","lteq","null","not_null","present","blank"],uv=["get","post","patch","delete","endpoints","schema","status"],lv=["read_all","write_all","read_orders","write_orders","read_products","write_products","read_promotions","write_promotions","read_customers","write_customers","read_payments","write_payments","read_fulfillments","write_fulfillments","read_refunds","write_refunds","read_gift_cards","write_gift_cards","read_store_credits","write_store_credits","read_stock","write_stock","read_categories","write_categories","read_settings","write_settings","read_webhooks","write_webhooks","read_api_keys","write_api_keys","read_dashboard"];function mv(e){let[t,r,...i]=e,n=e[e.length-1]??"",s=e[e.length-2]??"";if(e.length<=1)return on(["api","auth",...hv],n);if((s==="-q"||s==="--query")&&n.includes("_")&&!n.includes("=")){let o=n.slice(0,n.lastIndexOf("_")+1);return dv.map(a=>`${o}${a}=`)}if(s==="--scopes"){let o=n.includes(",")?n.slice(n.lastIndexOf(",")+1):n,a=n.slice(0,n.length-o.length);return on(lv,o).map(c=>a+c)}if(t==="api"){if(e.length===2)return on(uv,n);if(["get","post","patch","delete","schema"].includes(r)&&i.length<=1)return on($m,n)}return[]}var hv=["api-key","dev","console","migrate"];function on(e,t){return t?e.filter(r=>r.startsWith(t)):e}function yv(e){return e==="fish"?`# spree fish completion \u2014 eval "$(spree completion fish)"
342
+ `),sn(n)&&(process.exitCode=1)}catch(i){_t(i,{baseUrl:r.baseUrl})}})}var wm=N(Kt(),1),Ve=N(X(),1);function km(e){let t=e.command("api-key").description("Manage API keys");t.command("create").description("Create an API key").option("--name <name>","key name").option("--type <type>","key type: publishable or secret").option("--scopes <scopes>","comma-separated scopes for secret keys (e.g. read_all or read_orders,write_products)").action(async r=>{let i=g(),n=r.name,s=r.type,o=r.scopes;if(!n){let m=await ct({message:"Key name:",placeholder:"My Storefront",validate(h){if(!h)return"Name is required"}});K(m)&&(M("Cancelled."),process.exit(0)),n=m}if(!s){let m=await Qa({message:"Key type:",options:[{value:"publishable",label:"Publishable (for storefronts)"},{value:"secret",label:"Secret (for server-to-server)"}]});K(m)&&(M("Cancelled."),process.exit(0)),s=m}if(s!=="publishable"&&s!=="secret")throw new Error('Key type must be "publishable" or "secret".');if(s==="secret"&&!o){let m=await ct({message:"Scopes (comma-separated):",placeholder:"read_all",initialValue:"read_all",validate(h){if(!h)return"Secret keys require at least one scope"}});K(m)&&(M("Cancelled."),process.exit(0)),o=m}let a=G();a.start("Creating API key...");let c=await ee("spree:cli:create_api_key",i.projectDir,{NAME:n,KEY_TYPE:s,...s==="secret"&&o?{SCOPES:o}:{}}),d=s==="publishable"?"pk_":"sk_",p=c.match(new RegExp(`${d}[A-Za-z0-9_-]+`)),u=p?p[0]:c.trim();a.stop("API key created.");let l=[`${Ve.default.bold("Name:")} ${n}`,`${Ve.default.bold("Type:")} ${s}`,`${Ve.default.bold("Token:")} ${Ve.default.cyan(u)}`];s==="secret"&&(l.push(`${Ve.default.bold("Scopes:")} ${o}`),l.push(""),l.push(Ve.default.yellow("Save this token now \u2014 secret keys cannot be retrieved later."))),Y(l.join(`
343
+ `),"API Key")}),t.command("list").description("List API keys").action(async()=>{let r=g(),i=G();i.start("Fetching API keys...");let n=await ee("spree:cli:list_api_keys",r.projectDir);i.stop("");let s=n.trim().split(`
344
+ `).filter(Boolean);if(s.length===0){E.info("No API keys found.");return}let o=s.map(a=>{let[c,d,p,u,l,m]=a.split("|");return{ID:c??"",Name:d??"",Type:p??"",Token:u??"",Created:l??"",Status:m==="active"?Ve.default.green(m):Ve.default.red(m??"")}});(0,wm.printTable)(o)}),t.command("revoke").description("Revoke an API key").argument("<id>","ID of the key to revoke (from api-key list)").action(async r=>{let i=g(),n=G();n.start("Revoking API key...");let o=(await ee("spree:cli:revoke_api_key",i.projectDir,{ID:r})).trim();n.stop(`API key "${o}" revoked.`)})}var vm=N(Kt(),1),Q=N(X(),1);function Sm(e){let t=e.command("auth").description("Manage Admin API credentials (profiles in ~/.config/spree)");t.command("login").description("Save a secret API key as a named profile").option("--profile <name>","profile name","default").option("--base-url <url>","store URL, e.g. https://store.example.com").action(async r=>{process.stdin.isTTY||(process.stderr.write(`${Q.default.red("error:")} \`spree auth login\` is interactive. For non-interactive use, set SPREE_BASE_URL + SPREE_API_KEY (or pass --base-url/--api-key to \`spree api\`).
345
+ `),process.exit(2));let i=r.baseUrl;if(!i){let d=await ct({message:"Store URL:",placeholder:"https://store.example.com",validate(p){if(!p)return"URL is required";if(!/^https?:\/\//.test(p))return"Must start with http:// or https://"}});K(d)&&(M("Cancelled."),process.exit(130)),i=d}i=i.replace(/\/$/,"");let n=await Gr({message:"Secret API key (sk_...):",validate(d){if(!d)return"Key is required";if(!d.startsWith("sk_"))return"Admin API keys start with sk_"}});K(n)&&(M("Cancelled."),process.exit(130));let s=n,o=G();o.start("Validating credentials...");let a=await br(i,s);a.status==="unauthorized"&&(o.stop(Q.default.red("The server rejected this key (401). Check the key and try again.")),process.exit(2)),a.status==="unreachable"&&(o.stop(Q.default.red(`Could not reach ${i}: ${a.message}`)),process.exit(2)),o.stop(a.storeName?`Connected to ${Q.default.bold(a.storeName)}.`:"Credentials accepted (key lacks read_settings, so the store name is hidden \u2014 that is fine).");let c=yr();c.profiles[r.profile]={baseUrl:i,token:s},c.defaultProfile||=r.profile,Fo(c),Y([`${Q.default.bold("Profile:")} ${r.profile}${c.defaultProfile===r.profile?Q.default.dim(" (default)"):""}`,`${Q.default.bold("Base URL:")} ${i}`,`${Q.default.bold("Key:")} ${nn(s)}${Q.default.dim("\u2026")}`,"",Q.default.dim(`Saved to ${gt()}`)].join(`
346
+ `),"Logged in")}),t.command("status").description("Show which credentials `spree api` would use, and verify them").option("--profile <name>","check a specific profile").action(async r=>{let i;try{i=await fr({profile:r.profile},{allowMint:!1})}catch(a){_t(a)}let n=G();n.start("Checking server...");let s=await br(i.baseUrl,i.apiKey);n.stop("");let o=on(s);Y([`${Q.default.bold("Source:")} ${i.source}${i.profileName?` (${i.profileName})`:""}`,`${Q.default.bold("Base URL:")} ${i.baseUrl}`,`${Q.default.bold("Key:")} ${i.tokenPrefix}${Q.default.dim("\u2026")}`,...i.scopes?[`${Q.default.bold("Scopes:")} ${i.scopes.join(", ")}`]:[],`${Q.default.bold("Server:")} ${o}`].join(`
347
+ `),"Auth status"),sn(s)&&(process.exitCode=1)}),t.command("logout").description("Remove a saved profile (or the project credentials)").option("--profile <name>","profile to remove","default").option("--project","remove .spree/credentials.json from the current project instead").action(async r=>{if(r.project){let n;try{n=g().projectDir}catch(o){_t(o)}(await import("fs")).rmSync(rn(n),{force:!0}),E.success("Removed project credentials. The next `spree api` call mints a fresh read-only key.");return}let i=yr();if(!i.profiles[r.profile]){let n=Object.keys(i.profiles),s=n.length?` Saved profiles: ${n.join(", ")}.`:" No profiles are saved.";process.stderr.write(`${Q.default.red("error:")} no profile named "${r.profile}".${s}
348
+ `),process.exit(2)}delete i.profiles[r.profile],i.defaultProfile===r.profile&&(i.defaultProfile=Object.keys(i.profiles)[0]),Fo(i),E.success(`Removed profile "${r.profile}". The key itself stays active \u2014 revoke it with \`spree api-key revoke\` or in the admin.`)}),t.command("list").description("List saved profiles").action(()=>{let r=yr(),i=Object.keys(r.profiles);if(i.length===0){E.info("No profiles saved. Run `spree auth login` to add one.");return}(0,vm.printTable)(i.map(n=>({Profile:r.defaultProfile===n?`${n} *`:n,"Base URL":r.profiles[n].baseUrl,Key:`${nn(r.profiles[n].token)}\u2026`})))})}import qm from"fs";import $m from"path";var rt=N(X(),1);function Am(e){e.command("build").description("Rebuild the dev image (after Dockerfile / .ruby-version changes)").option("--reset-bundle","also wipe the bundle_cache volume to re-seed gems").option("--yes","skip confirmation prompts (for CI)").action(async t=>{let r=g();if(qe(r.projectDir)&&(M(["This project uses SPREE_PATH for monorepo development.",`Use ${rt.default.bold("pnpm server:build")} from the monorepo root instead of ${rt.default.bold("spree build")}.`,"It builds against the edge compose overlay the running stack was started with."].join(`
349
+ `)),process.exit(1)),dv(r.projectDir)||(console.error(`
350
+ ${rt.default.red("Error:")} docker-compose.yml has no \`build:\` section. Run ${rt.default.bold("spree eject")} first to switch to a build-from-source stack.
351
+ `),process.exit(1)),t.resetBundle){if(!t.yes){let n=await at({message:"Wipe the bundle_cache volume? Any gems added via `spree bundle add` since the last image build will be lost.",initialValue:!1});(K(n)||!n)&&(M("Build cancelled."),process.exit(0))}let i=G();i.start("Wiping bundle_cache volume...");try{await H(["down"],r.projectDir,{stdio:"ignore"});let s=`${await uv(r.projectDir)}_bundle_cache`;await lv(s,r.projectDir)?(await ce("docker",["volume","rm",s],{cwd:r.projectDir,stdio:"ignore"}),i.stop("bundle_cache volume wiped.")):i.stop(`bundle_cache volume not present (looked for ${s}).`)}catch(n){throw i.stop("Failed to wipe bundle_cache volume."),n}}console.log(`
352
+ ${rt.default.bold("Rebuilding dev image...")}
353
+ `),await H(["build","web","worker"],r.projectDir,{stdio:"inherit"}),Y([`Image rebuilt. Start the stack with ${rt.default.bold("spree dev")}.`,t.resetBundle?`On next boot, gems will re-seed into a fresh ${rt.default.dim("bundle_cache")} volume.`:""].filter(Boolean).join(`
354
+ `),"Build complete")})}function dv(e){let t=$m.join(e,"docker-compose.yml");return qm.existsSync(t)?/^\s*build\s*:/m.test(qm.readFileSync(t,"utf-8")):!1}async function uv(e){try{let{stdout:t}=await ce("docker",["compose","config","--format","json"],{cwd:e}),r=JSON.parse(t);if(r.name)return r.name}catch{}return $m.basename(e).toLowerCase().replace(/[^a-z0-9_-]/g,"")}async function lv(e,t){try{return await ce("docker",["volume","inspect",e],{cwd:t,stdio:"ignore"}),!0}catch{return!1}}function Cm(e){e.command("bundle").description("Run a bundler command (`bundle \u2026`) inside the web container").argument("<args...>","arguments to pass to bundle").allowUnknownOption(!0).passThroughOptions(!0).action(async t=>{let r=g();await en(["bundle",...t],r.projectDir,{edgeHint:"the edge stack heals gem drift on boot"})})}var Em=["/admin_users","/allowed_origins","/api_keys","/auth","/categories","/channels","/custom_field_definitions","/customer_groups","/customers","/exports","/gift_card_batches","/gift_cards","/invitations","/locales","/markets","/me","/option_types","/orders","/payment_methods","/price_lists","/prices","/products","/promotion_actions","/promotion_rules","/promotions","/roles","/stock_locations","/store","/store_credit_categories","/tags","/translatable_resources","/translations","/webhook_endpoints"];var Pm=["bash","zsh","fish"],hv=["eq","not_eq","cont","not_cont","start","end","in","not_in","gt","gteq","lt","lteq","null","not_null","present","blank"],yv=["get","post","patch","delete","endpoints","schema","status"],fv=["read_all","write_all","read_orders","write_orders","read_products","write_products","read_promotions","write_promotions","read_customers","write_customers","read_payments","write_payments","read_fulfillments","write_fulfillments","read_refunds","write_refunds","read_gift_cards","write_gift_cards","read_store_credits","write_store_credits","read_stock","write_stock","read_categories","write_categories","read_settings","write_settings","read_webhooks","write_webhooks","read_api_keys","write_api_keys","read_dashboard"];function gv(e){let[t,r,...i]=e,n=e[e.length-1]??"",s=e[e.length-2]??"";if(e.length<=1)return cn(["api","auth",..._v],n);if((s==="-q"||s==="--query")&&n.includes("_")&&!n.includes("=")){let o=n.slice(0,n.lastIndexOf("_")+1);return hv.map(a=>`${o}${a}=`)}if(s==="--scopes"){let o=n.includes(",")?n.slice(n.lastIndexOf(",")+1):n,a=n.slice(0,n.length-o.length);return cn(fv,o).map(c=>a+c)}if(t==="api"){if(e.length===2)return cn(yv,n);if(["get","post","patch","delete","schema"].includes(r)&&i.length<=1)return cn(Em,n)}return[]}var _v=["api-key","dev","console","migrate"];function cn(e,t){return t?e.filter(r=>r.startsWith(t)):e}function bv(e){return e==="fish"?`# spree fish completion \u2014 eval "$(spree completion fish)"
355
355
  function __spree_complete
356
356
  set -l tokens (commandline -opc) (commandline -ct)
357
357
  spree __complete $tokens[2..-1]
@@ -370,30 +370,35 @@ _spree() {
370
370
  COMPREPLY=( $(spree __complete "\${words[@]}") )
371
371
  }
372
372
  complete -F _spree spree
373
- `}function Cm(e){e.command("completion <shell>").description("Output a shell completion script (bash, zsh, or fish)").action(t=>{if(!Am.includes(t)){process.stderr.write(`Unsupported shell "${t}". Choose one of: ${Am.join(", ")}.
374
- `),process.exitCode=2;return}process.stdout.write(yv(t))}),e.command("__complete",{hidden:!0}).allowUnknownOption().argument("[words...]").action(t=>{for(let r of mv(t??[]))process.stdout.write(`${r}
375
- `)})}function Em(e){e.command("console").description("Open Rails console").action(async()=>{let t=g();await I(["bin/rails","console"],t.projectDir)})}function Pm(e){e.command("db:reset").description("Drop, create, migrate, and seed the dev database (destructive)").option("--yes","skip the confirmation prompt (for CI)").action(async t=>{let r=g();if(!t.yes){let i=await yt({message:"This will drop the spree_development database. Continue?",initialValue:!1});(Y(i)||!i)&&(N("Cancelled."),process.exit(0))}await I(["bin/rails","db:drop","db:create","spree:install:migrations","db:migrate","db:seed"],r.projectDir)}),e.command("db:console").description("Open a psql session against the dev database").action(async()=>{let t=g();await I(["psql","-U","postgres","spree_development"],t.projectDir,{service:"postgres"})})}var Pe=U(X(),1);function Tm(e){e.command("dev").description("Run the app in the foreground \u2014 streams web + worker logs; Ctrl+C stops them").action(async()=>{let t=g();We(t.projectDir)&&(N(["This project uses SPREE_PATH for monorepo development.",`Use ${Pe.default.bold("pnpm server:dev")} from the monorepo root instead of ${Pe.default.bold("spree dev")}.`,"It loads the edge compose overlay and sets SPREE_PATH so the Spree gems resolve to the monorepo source."].join(`
376
- `)),process.exit(1)),ee(["",Pe.default.bold("Admin Dashboard"),` ${Pe.default.cyan(`http://localhost:${t.port}/admin`)}`,` Email: ${$r}`,` Password: ${Ar}`,"",Pe.default.bold("Store API"),` ${Pe.default.cyan(`http://localhost:${t.port}/api/v3/store`)}`,""].join(`
377
- `),"Spree Commerce"),T.info(`Starting services \u2014 web + worker logs stream below. ${Pe.default.bold("Ctrl+C")} stops them (databases keep running; ${Pe.default.bold("spree stop")} shuts everything down).
378
- `);let r=()=>{};process.on("SIGINT",r);let i;try{await Xe(t.projectDir),i=await H(["up","web","worker"],t.projectDir,{stdio:"inherit",reject:!1})}finally{process.off("SIGINT",r)}let n=i.exitCode??0;n!==0&&n!==130&&(N(`docker compose exited with code ${n} \u2014 see the output above.`),process.exit(n)),ym(`Web + worker stopped. Databases keep running \u2014 ${Pe.default.bold("spree stop")} shuts everything down.`)})}import _r from"fs";import Fo from"path";var pe=U(X(),1);function Om(e){e.command("eject").description("Switch to the dev compose: bind-mount ./backend with hot reload").action(async()=>{let t=g(),r=Fo.join(t.projectDir,"backend");_r.existsSync(r)||(console.error(`
379
- ${pe.default.red("Error:")} No backend/ directory found.
380
- `),process.exit(1));let i=Fo.join(t.projectDir,"docker-compose.dev.yml");_r.existsSync(i)||(console.error(`
381
- ${pe.default.red("Error:")} No docker-compose.dev.yml found.
382
- `),process.exit(1));let n=_r.readFileSync(i,"utf-8");n.includes("- .:/rails")&&(n=n.replace("- .:/rails","- ./backend:/rails"),_r.writeFileSync(i,n)),_r.writeFileSync(Fo.join(t.projectDir,"docker-compose.yml"),n),console.log(`
383
- ${pe.default.bold("Switching to dev compose (bind-mounts ./backend)...")}
384
- `),await Xe(t.projectDir),await H(["up","-d"],t.projectDir,{stdio:"inherit"}),console.log(`
385
- ${pe.default.bold("Preparing the development database...")}
386
- `),await I(["bin/rails","db:prepare"],t.projectDir,{tty:!1}),ee([`Backend is now bind-mounted from ${pe.default.bold("./backend")} \u2014 edits are live.`,"",`The dev stack uses its own ${pe.default.bold("spree_development")} database (just`,`created and seeded). Load demo products with ${pe.default.bold("spree sample-data")}.`,"","You can now customize:",` ${pe.default.dim("backend/app/")} \u2014 models, controllers, services (instant reload)`,` ${pe.default.dim("backend/config/")} \u2014 Rails configuration (instant reload)`,` ${pe.default.dim("backend/Gemfile")} \u2014 add gems via ${pe.default.bold("spree bundle add <gem>")}`,"",`Rebuild only on Dockerfile / .ruby-version changes: ${pe.default.bold("spree build")}`].join(`
387
- `),"Ejected!")})}function Im(e){e.command("exec").description("Run an arbitrary command inside the web container").argument("<command...>","command and arguments to run").allowUnknownOption(!0).passThroughOptions(!0).action(async t=>{let r=g();await I(t,r.projectDir)})}var fv=new Set(["migration","controller","scaffold","scaffold_controller","mailer","job","channel","helper","resource","integration_test","system_test","task","generator","benchmark"]);function Rm(e){e.command("generate").alias("g").description("Run a generator (Spree generators auto-prefixed; Rails built-ins forwarded as-is)").argument("<name>","generator name (`model`, `model_decorator`, `migration`, \u2026)").argument("[args...]","arguments to pass to the generator").allowUnknownOption(!0).passThroughOptions(!0).action(async(t,r)=>{let i=g(),n=t.includes(":")||fv.has(t)?t:`spree:${t}`;await I(["bin/rails","g",n,...r],i.projectDir)})}import Bo from"fs";import{platform as gv}from"os";import _v from"path";var Te=U(X(),1);var bv=3e3,jm=12e4;function Dm(e){e.command("init").description("First-run setup: start services, configure API key, load sample data").option("--no-sample-data","skip loading sample data").option("--no-open","skip opening browser").action(async t=>{let r=g();T.step("Pulling latest images..."),await H(["pull"],r.projectDir,{stdio:"inherit"});let i=z();i.start("Starting Docker services..."),await Xe(r.projectDir,{stdio:"ignore"}),await H(["up","-d"],r.projectDir),i.stop("Docker services started."),i.start("Waiting for Spree to be ready..."),await xv(r.port),i.stop("Spree is ready."),i.start("Seeding database..."),await Q("db:seed",r.projectDir),i.stop("Database seeded."),i.start("Configuring API keys...");let n=await wv(r.projectDir);vv(r.projectDir,n);let s=await kv(r.projectDir,r.port);i.stop("API keys configured."),t.sampleData&&(i.start("Loading sample data..."),await Q("spree:load_sample_data",r.projectDir),i.stop("Sample data loaded.")),i.start("Indexing products for search..."),await Q("spree:search:reindex",r.projectDir),i.stop("Search index ready."),ee(["",Te.default.bold("Admin Dashboard"),` ${Te.default.cyan(`http://localhost:${r.port}/admin`)}`,` Email: ${$r}`,` Password: ${Ar}`,"",Te.default.bold("Store API"),` ${Te.default.cyan(`http://localhost:${r.port}/api/v3/store`)}`,` Publishable key: ${Te.default.cyan(n)}`,"",Te.default.bold("Admin API"),` ${Te.default.cyan(`http://localhost:${r.port}/api/v3/admin`)}`,` Secret key: ${Te.default.cyan(s)}`,` ${Te.default.dim("Saved to .spree/credentials.json")}`,""].join(`
388
- `),"Your Spree store is ready!"),t.open&&await qv(`http://localhost:${r.port}/admin`),T.info(`Streaming logs (Ctrl+C to stop)...
389
- `),await Bi("web",r.projectDir)})}async function xv(e){let t=`http://localhost:${e}/up`,r=Date.now();for(;Date.now()-r<jm;){try{if((await fetch(t)).ok)return}catch{}await new Promise(i=>setTimeout(i,bv))}throw new Error(`Spree did not become healthy within ${jm/1e3}s`)}async function wv(e){let t=await Q("spree:cli:ensure_api_key",e),r=t.match(/pk_[A-Za-z0-9_-]+/);if(!r)throw new Error(`Could not extract API key from Rails output: ${t}`);return r[0]}async function kv(e,t){let{token:r}=await So(e,t,!0);return r}function vv(e,t){let r=_v.join(e,"apps","storefront",".env.local");if(!Bo.existsSync(r))return;let i=Bo.readFileSync(r,"utf-8");Bo.writeFileSync(r,i.replace(/SPREE_PUBLISHABLE_KEY=.*/,`SPREE_PUBLISHABLE_KEY=${t}`))}async function qv(e){let t=gv(),r=t==="darwin"?"open":t==="win32"?"start":"xdg-open";try{await Mi(`${r} ${e}`,{stdio:"ignore"})}catch{}}function Lm(e){e.command("logs").description("Stream service logs").argument("[service]","service name (web or worker)","web").action(async t=>{let r=g();await Bi(t,r.projectDir)})}var an=U(X(),1);function Mm(e){e.command("migrate").description("Install pending Spree migrations from gems, then run them (`spree:install:migrations` + `db:migrate`)").argument("[args...]","extra args forwarded to db:migrate").allowUnknownOption(!0).passThroughOptions(!0).action(async t=>{let r=g();console.log(`
390
- ${an.default.bold("\u2192 Installing pending Spree migrations from gems...")}`),await I(["bin/rails","spree:install:migrations"],r.projectDir),console.log(`
391
- ${an.default.bold("\u2192 Running db:migrate...")}`),await I(["bin/rails","db:migrate",...t],r.projectDir),ee(`Run ${an.default.bold("spree migrate:status")} to inspect the migration log.`,"Migrations up to date")}),e.command("migrate:rollback").description("Roll back the last migration (`STEP=n` to roll back n steps)").argument("[args...]","extra args forwarded to db:rollback (e.g. STEP=2)").allowUnknownOption(!0).passThroughOptions(!0).action(async t=>{let r=g();await I(["bin/rails","db:rollback",...t],r.projectDir)}),e.command("migrate:status").description("Show migration status (`bin/rails db:migrate:status`)").action(async()=>{let t=g();await I(["bin/rails","db:migrate:status"],t.projectDir)})}import{platform as Sv}from"os";function Fm(e){e.command("open").description("Open the admin dashboard in the browser").action(async()=>{let r=`http://localhost:${g().port}/admin`,i=Sv();await Mi(`${i==="darwin"?"open":i==="win32"?"start":"xdg-open"} ${r}`)})}function Bm(e){e.command("rails").description("Run a Rails command (`bin/rails \u2026`) inside the web container").argument("<args...>","arguments to pass to bin/rails").allowUnknownOption(!0).passThroughOptions(!0).action(async t=>{let r=g();await I(["bin/rails",...t],r.projectDir)})}function Um(e){e.command("rake").description("Run a rake task (`bin/rake \u2026`) inside the web container").argument("<args...>","task name and arguments").allowUnknownOption(!0).passThroughOptions(!0).action(async t=>{let r=g();await I(["bin/rake",...t],r.projectDir)})}function Nm(e){e.command("restart").description("Restart web + worker in place (does not reload Gemfile or compose changes)").action(async()=>{let t=g(),r=z();r.start("Restarting web + worker...");try{await H(["restart","web","worker"],t.projectDir),r.stop("Services restarted.")}catch(i){throw r.stop("Restart failed."),i}})}function Gm(e){e.command("routes").description("Show Rails routes (`bin/rails routes`)").argument("[args...]","arguments to pass to bin/rails routes").allowUnknownOption(!0).passThroughOptions(!0).action(async t=>{let r=g();await I(["bin/rails","routes",...t],r.projectDir)})}function zm(e){e.command("sample-data").description("Load sample data (products, categories, images)").action(async()=>{let t=g(),r=z();r.start("Loading sample data..."),await Q("spree:load_sample_data",t.projectDir),r.stop("Sample data loaded.")})}function Vm(e){e.command("seed").description("Seed the database").action(async()=>{let t=g(),r=z();r.start("Seeding database..."),await Q("db:seed",t.projectDir),r.stop("Database seeded.")})}function Wm(e){e.command("stop").description("Stop services").action(async()=>{let t=g(),r=z();r.start("Stopping services..."),await H(["stop"],t.projectDir),r.stop("Services stopped.")})}function Hm(e){e.command("task").description("Run a Spree rake task (auto-prefixes `spree:`)").argument("<name>","task name (without `spree:` prefix)").argument("[args...]","arguments to pass to the task").allowUnknownOption(!0).passThroughOptions(!0).action(async(t,r)=>{let i=g();await I(["bin/rake",`spree:${t}`,...r],i.projectDir)})}function Km(e){e.command("update").description("Pull latest image and recreate containers").action(async()=>{let t=g();T.step("Pulling latest images..."),await H(["pull"],t.projectDir,{stdio:"inherit"});let r=z();r.start("Recreating containers..."),await Xe(t.projectDir,{stdio:"ignore"}),await H(["up","-d"],t.projectDir),r.stop("Containers recreated."),T.success("Update complete! Migrations will run automatically on startup."),T.info("Run `spree logs` to follow the startup progress.")})}import Ym from"fs";import $v from"path";var ne=U(X(),1);function Jm(e){e.command("upgrade").description("Walk through a Spree version upgrade (bundle + migrate + spree:upgrade)").option("--plan","print the plan via spree:upgrade DRY_RUN=1; skip bundle + migrate").option("--step <id>","run a single rake step by id (skips bundle + migrate)").option("--to <version>","explicit target version (auto-detected from installed gem otherwise)").option("--yes","skip prompts on automated steps").action(async t=>{let r=g();await Av(r.projectDir),t.plan||t.step||(await Cv(r.projectDir,t),await Pv(r.projectDir,t)),await Tv(r.projectDir,t),t.plan||Iv(r.projectDir)})}async function Av(e){let t=i=>{N(i.join(`
392
- `)),process.exit(1)};We(e)&&t(["This is a monorepo edge project (SPREE_PATH set in .env).",`Run the upgrade from the monorepo root with ${ne.default.bold("pnpm server:*")} \u2014 the`,"project-local docker-compose.yml is not the running config here."]);let r;try{r=await Fi("web",e)}catch(i){return t(["Could not inspect the Docker stack from this directory.",` ${ne.default.dim(String(i.message).split(`
393
- `)[0])}`,"",`Run ${ne.default.bold("spree upgrade")} from your project root (the directory holding the`,".env with SECRET_KEY_BASE), and make sure Docker is running."])}r||t(["The web container is not running.",`Upgrade runs migrations and the ${ne.default.bold("spree:upgrade")} rake against your live`,`database, so the stack must be up. Start it with ${ne.default.bold("spree dev")}, then`,"re-run `spree upgrade`."])}async function Cv(e,t){if(!t.yes){let i=await yt({message:"Run `bundle update` to bump Spree gems?",initialValue:!0});if(Y(i)&&(N("Upgrade aborted."),process.exit(0)),!i){T.info("Skipping `bundle update`.");return}}let r=await Ev(e);if(r.length===0)throw new Error('No Spree gems detected in Gemfile.lock. Confirm the project has `gem "spree"` (or `spree_core`/`spree_admin`) in its Gemfile.');T.step(ne.default.bold(`bundle update ${r.join(" ")}`)),await I(["bundle","update",...r],e)}async function Ev(e){try{let{stdout:t}=await he("docker",["compose","exec","-T","web","sh","-c","bundle list --name-only | grep '^spree'"],{cwd:e});return t.split(`
373
+ `}function Tm(e){e.command("completion <shell>").description("Output a shell completion script (bash, zsh, or fish)").action(t=>{if(!Pm.includes(t)){process.stderr.write(`Unsupported shell "${t}". Choose one of: ${Pm.join(", ")}.
374
+ `),process.exitCode=2;return}process.stdout.write(bv(t))}),e.command("__complete",{hidden:!0}).allowUnknownOption().argument("[words...]").action(t=>{for(let r of gv(t??[]))process.stdout.write(`${r}
375
+ `)})}function Om(e){e.command("console").description("Open Rails console").action(async()=>{let t=g();await en(["bin/rails","console"],t.projectDir,{edgeHint:"then open the console"})})}var ke=N(X(),1);var xv=["bin/rails","db:drop","db:create","spree:install:migrations","db:migrate","db:seed"];function Im(e){e.command("db:reset").description("Drop, create, migrate, and seed the dev database (destructive; self-heals a running stack)").option("--yes","skip the confirmation prompt (for CI)").action(async t=>{let r=g(),i=s=>{M(s.join(`
376
+ `)),process.exit(1)};if(qe(r.projectDir)&&i(["This is a monorepo edge project (SPREE_PATH set in .env).",`Reset the dev database from the monorepo root with ${ke.default.bold("pnpm server:setup")}`,"(or the relevant `pnpm server:*` script) \u2014 the project-local compose is not the","running config here."]),!t.yes){let s=await at({message:"This will drop the spree_development database. Continue?",initialValue:!1});(K(s)||!s)&&(M("Cancelled."),process.exit(0))}let n;try{let[s,o]=await Promise.all([ft("web",r.projectDir),ft("worker",r.projectDir)]);n=s||o}catch(s){return i(["Could not inspect the Docker stack from this directory.",` ${ke.default.dim(String(s.message).split(`
377
+ `)[0])}`,"",`Run ${ke.default.bold("spree db:reset")} from your project root (the directory holding the`,".env with SECRET_KEY_BASE), and make sure Docker is running."])}if(n){let s=G();s.start("Stopping web + worker to release database connections..."),await H(["stop","web","worker"],r.projectDir),s.stop("Stopped web + worker.")}try{await Do(xv,r.projectDir,{captureStderr:!0})}catch(s){let o=String(s.stderr??s.message??"");throw/being accessed by other users|55006/.test(o)&&i(["Could not drop spree_development \u2014 another client is still connected.",`A database client (TablePlus, DataGrip, psql) may be connected on port ${ke.default.bold("5433")}.`,"Disconnect it, then re-run `spree db:reset`.",...n?["",`Bring the stack back up with ${ke.default.bold("spree dev")}.`]:[]]),s}E.success("Database reset."),n&&Y(`Bring the stack back up with ${ke.default.bold("spree dev")}.`,"Done")}),e.command("db:console").description("Open a psql session against the dev database").action(async()=>{let t=g(),r;try{r=await ft("postgres",t.projectDir)}catch(i){M(["Could not inspect the Docker stack from this directory.",` ${ke.default.dim(String(i.message).split(`
378
+ `)[0])}`,"",`Run ${ke.default.bold("spree db:console")} from your project root, and make sure Docker is running.`].join(`
379
+ `)),process.exit(1)}r||(M(["Postgres is not running.",`Start the stack with ${ke.default.bold("spree dev")}, then re-run ${ke.default.bold("spree db:console")}.`].join(`
380
+ `)),process.exit(1)),await B(["psql","-U","postgres","spree_development"],t.projectDir,{service:"postgres"})})}var Oe=N(X(),1);function Rm(e){e.command("dev").description("Run the app in the foreground \u2014 streams web + worker logs; Ctrl+C stops them").action(async()=>{let t=g();qe(t.projectDir)&&(M(["This project uses SPREE_PATH for monorepo development.",`Use ${Oe.default.bold("pnpm server:dev")} from the monorepo root instead of ${Oe.default.bold("spree dev")}.`,"It loads the edge compose overlay and sets SPREE_PATH so the Spree gems resolve to the monorepo source."].join(`
381
+ `)),process.exit(1)),Y(["",Oe.default.bold("Admin Dashboard"),` ${Oe.default.cyan(`http://localhost:${t.port}/admin`)}`,` Email: ${Cr}`,` Password: ${Er}`,"",Oe.default.bold("Store API"),` ${Oe.default.cyan(`http://localhost:${t.port}/api/v3/store`)}`,""].join(`
382
+ `),"Spree Commerce"),E.info(`Starting services \u2014 web + worker logs stream below. ${Oe.default.bold("Ctrl+C")} stops them (databases keep running; ${Oe.default.bold("spree stop")} shuts everything down).
383
+ `);let r=()=>{};process.on("SIGINT",r);let i;try{await et(t.projectDir),i=await H(["up","web","worker"],t.projectDir,{stdio:"inherit",reject:!1})}finally{process.off("SIGINT",r)}let n=i.exitCode??0;n!==0&&n!==130&&(M(`docker compose exited with code ${n} \u2014 see the output above.`),process.exit(n)),Xa(`Web + worker stopped. Databases keep running \u2014 ${Oe.default.bold("spree stop")} shuts everything down.`)})}import xr from"fs";import No from"path";var de=N(X(),1);function jm(e){e.command("eject").description("Switch to the dev compose: bind-mount ./backend with hot reload").action(async()=>{let t=g(),r=No.join(t.projectDir,"backend");xr.existsSync(r)||(console.error(`
384
+ ${de.default.red("Error:")} No backend/ directory found.
385
+ `),process.exit(1));let i=No.join(t.projectDir,"docker-compose.dev.yml");xr.existsSync(i)||(console.error(`
386
+ ${de.default.red("Error:")} No docker-compose.dev.yml found.
387
+ `),process.exit(1));let n=xr.readFileSync(i,"utf-8");n.includes("- .:/rails")&&(n=n.replace("- .:/rails","- ./backend:/rails"),xr.writeFileSync(i,n)),xr.writeFileSync(No.join(t.projectDir,"docker-compose.yml"),n),console.log(`
388
+ ${de.default.bold("Switching to dev compose (bind-mounts ./backend)...")}
389
+ `),await et(t.projectDir),await H(["up","-d"],t.projectDir,{stdio:"inherit"}),console.log(`
390
+ ${de.default.bold("Preparing the development database...")}
391
+ `),await B(["bin/rails","db:prepare"],t.projectDir,{tty:!1}),Y([`Backend is now bind-mounted from ${de.default.bold("./backend")} \u2014 edits are live.`,"",`The dev stack uses its own ${de.default.bold("spree_development")} database (just`,`created and seeded). Load demo products with ${de.default.bold("spree sample-data")}.`,"","You can now customize:",` ${de.default.dim("backend/app/")} \u2014 models, controllers, services (instant reload)`,` ${de.default.dim("backend/config/")} \u2014 Rails configuration (instant reload)`,` ${de.default.dim("backend/Gemfile")} \u2014 add gems via ${de.default.bold("spree bundle add <gem>")}`,"",`Rebuild only on Dockerfile / .ruby-version changes: ${de.default.bold("spree build")}`].join(`
392
+ `),"Ejected!")})}function Dm(e){e.command("exec").description("Run an arbitrary command inside the web container").argument("<command...>","command and arguments to run").allowUnknownOption(!0).passThroughOptions(!0).action(async t=>{let r=g();await B(t,r.projectDir)})}var wv=new Set(["migration","controller","scaffold","scaffold_controller","mailer","job","channel","helper","resource","integration_test","system_test","task","generator","benchmark"]);function Lm(e){e.command("generate").alias("g").description("Run a generator (Spree generators auto-prefixed; Rails built-ins forwarded as-is)").argument("<name>","generator name (`model`, `model_decorator`, `migration`, \u2026)").argument("[args...]","arguments to pass to the generator").allowUnknownOption(!0).passThroughOptions(!0).action(async(t,r)=>{let i=g(),n=t.includes(":")||wv.has(t)?t:`spree:${t}`;await B(["bin/rails","g",n,...r],i.projectDir)})}import Go from"fs";import{platform as kv}from"os";import vv from"path";var Ie=N(X(),1);var Sv=3e3,Mm=12e4;function Fm(e){e.command("init").description("First-run setup: start services, configure API key, load sample data").option("--no-sample-data","skip loading sample data").option("--no-open","skip opening browser").action(async t=>{let r=g();E.step("Pulling latest images..."),await H(["pull"],r.projectDir,{stdio:"inherit"});let i=G();i.start("Starting Docker services..."),await et(r.projectDir,{stdio:"ignore"}),await H(["up","-d"],r.projectDir),i.stop("Docker services started."),i.start("Waiting for Spree to be ready..."),await qv(r.port),i.stop("Spree is ready."),i.start("Seeding database..."),await ee("db:seed",r.projectDir),i.stop("Database seeded."),i.start("Configuring API keys...");let n=await $v(r.projectDir);Cv(r.projectDir,n);let s=await Av(r.projectDir,r.port);i.stop("API keys configured."),t.sampleData&&(i.start("Loading sample data..."),await ee("spree:load_sample_data",r.projectDir),i.stop("Sample data loaded.")),i.start("Indexing products for search..."),await ee("spree:search:reindex",r.projectDir),i.stop("Search index ready."),Y(["",Ie.default.bold("Admin Dashboard"),` ${Ie.default.cyan(`http://localhost:${r.port}/admin`)}`,` Email: ${Cr}`,` Password: ${Er}`,"",Ie.default.bold("Store API"),` ${Ie.default.cyan(`http://localhost:${r.port}/api/v3/store`)}`,` Publishable key: ${Ie.default.cyan(n)}`,"",Ie.default.bold("Admin API"),` ${Ie.default.cyan(`http://localhost:${r.port}/api/v3/admin`)}`,` Secret key: ${Ie.default.cyan(s)}`,` ${Ie.default.dim("Saved to .spree/credentials.json")}`,""].join(`
393
+ `),"Your Spree store is ready!"),t.open&&await Ev(`http://localhost:${r.port}/admin`),E.info(`Streaming logs (Ctrl+C to stop)...
394
+ `),await tn("web",r.projectDir)})}async function qv(e){let t=`http://localhost:${e}/up`,r=Date.now();for(;Date.now()-r<Mm;){try{if((await fetch(t)).ok)return}catch{}await new Promise(i=>setTimeout(i,Sv))}throw new Error(`Spree did not become healthy within ${Mm/1e3}s`)}async function $v(e){let t=await ee("spree:cli:ensure_api_key",e),r=t.match(/pk_[A-Za-z0-9_-]+/);if(!r)throw new Error(`Could not extract API key from Rails output: ${t}`);return r[0]}async function Av(e,t){let{token:r}=await Bo(e,t,!0);return r}function Cv(e,t){let r=vv.join(e,"apps","storefront",".env.local");if(!Go.existsSync(r))return;let i=Go.readFileSync(r,"utf-8");Go.writeFileSync(r,i.replace(/SPREE_PUBLISHABLE_KEY=.*/,`SPREE_PUBLISHABLE_KEY=${t}`))}async function Ev(e){let t=kv(),r=t==="darwin"?"open":t==="win32"?"start":"xdg-open";try{await Zi(`${r} ${e}`,{stdio:"ignore"})}catch{}}function Bm(e){e.command("logs").description("Stream service logs").argument("[service]","service name (web or worker)","web").action(async t=>{let r=g();await tn(t,r.projectDir)})}var pn=N(X(),1);function Um(e){e.command("migrate").description("Install pending Spree migrations from gems, then run them (`spree:install:migrations` + `db:migrate`)").argument("[args...]","extra args forwarded to db:migrate").allowUnknownOption(!0).passThroughOptions(!0).action(async t=>{let r=g();console.log(`
395
+ ${pn.default.bold("\u2192 Installing pending Spree migrations from gems...")}`),await B(["bin/rails","spree:install:migrations"],r.projectDir),console.log(`
396
+ ${pn.default.bold("\u2192 Running db:migrate...")}`),await B(["bin/rails","db:migrate",...t],r.projectDir),Y(`Run ${pn.default.bold("spree migrate:status")} to inspect the migration log.`,"Migrations up to date")}),e.command("migrate:rollback").description("Roll back the last migration (`STEP=n` to roll back n steps)").argument("[args...]","extra args forwarded to db:rollback (e.g. STEP=2)").allowUnknownOption(!0).passThroughOptions(!0).action(async t=>{let r=g();await B(["bin/rails","db:rollback",...t],r.projectDir)}),e.command("migrate:status").description("Show migration status (`bin/rails db:migrate:status`)").action(async()=>{let t=g();await B(["bin/rails","db:migrate:status"],t.projectDir)})}import{platform as Pv}from"os";function Nm(e){e.command("open").description("Open the admin dashboard in the browser").action(async()=>{let r=`http://localhost:${g().port}/admin`,i=Pv();await Zi(`${i==="darwin"?"open":i==="win32"?"start":"xdg-open"} ${r}`)})}function Gm(e){e.command("rails").description("Run a Rails command (`bin/rails \u2026`) inside the web container").argument("<args...>","arguments to pass to bin/rails").allowUnknownOption(!0).passThroughOptions(!0).action(async t=>{let r=g();await B(["bin/rails",...t],r.projectDir)})}function zm(e){e.command("rake").description("Run a rake task (`bin/rake \u2026`) inside the web container").argument("<args...>","task name and arguments").allowUnknownOption(!0).passThroughOptions(!0).action(async t=>{let r=g();await B(["bin/rake",...t],r.projectDir)})}function Vm(e){e.command("restart").description("Restart web + worker in place (does not reload Gemfile or compose changes)").action(async()=>{let t=g(),r=G();r.start("Restarting web + worker...");try{await H(["restart","web","worker"],t.projectDir),r.stop("Services restarted.")}catch(i){throw r.stop("Restart failed."),i}})}function Wm(e){e.command("routes").description("Show Rails routes (`bin/rails routes`)").argument("[args...]","arguments to pass to bin/rails routes").allowUnknownOption(!0).passThroughOptions(!0).action(async t=>{let r=g();await B(["bin/rails","routes",...t],r.projectDir)})}function Hm(e){e.command("sample-data").description("Load sample data (products, categories, images)").action(async()=>{let t=g(),r=G();r.start("Loading sample data..."),await ee("spree:load_sample_data",t.projectDir),r.stop("Sample data loaded.")})}function Km(e){e.command("seed").description("Seed the database").action(async()=>{let t=g(),r=G();r.start("Seeding database..."),await ee("db:seed",t.projectDir),r.stop("Database seeded.")})}function Ym(e){e.command("stop").description("Stop services").action(async()=>{let t=g(),r=G();r.start("Stopping services..."),await H(["stop"],t.projectDir),r.stop("Services stopped.")})}function Jm(e){e.command("task").description("Run a Spree rake task (auto-prefixes `spree:`)").argument("<name>","task name (without `spree:` prefix)").argument("[args...]","arguments to pass to the task").allowUnknownOption(!0).passThroughOptions(!0).action(async(t,r)=>{let i=g();await B(["bin/rake",`spree:${t}`,...r],i.projectDir)})}function Xm(e){e.command("update").description("Pull latest image and recreate containers").action(async()=>{let t=g();E.step("Pulling latest images..."),await H(["pull"],t.projectDir,{stdio:"inherit"});let r=G();r.start("Recreating containers..."),await et(t.projectDir,{stdio:"ignore"}),await H(["up","-d"],t.projectDir),r.stop("Containers recreated."),E.success("Update complete! Migrations will run automatically on startup."),E.info("Run `spree logs` to follow the startup progress.")})}import Qm from"fs";import Tv from"path";var ne=N(X(),1);function Zm(e){e.command("upgrade").description("Walk through a Spree version upgrade (bundle + migrate + spree:upgrade)").option("--plan","print the plan via spree:upgrade DRY_RUN=1; skip bundle + migrate").option("--step <id>","run a single rake step by id (skips bundle + migrate)").option("--to <version>","explicit target version (auto-detected from installed gem otherwise)").option("--yes","skip prompts on automated steps").action(async t=>{let r=g();await Ov(r.projectDir),t.plan||t.step||(await Iv(r.projectDir,t),await jv(r.projectDir,t)),await Dv(r.projectDir,t),t.plan||Mv(r.projectDir)})}async function Ov(e){let t=i=>{M(i.join(`
397
+ `)),process.exit(1)};qe(e)&&t(["This is a monorepo edge project (SPREE_PATH set in .env).",`Run the upgrade from the monorepo root with ${ne.default.bold("pnpm server:*")} \u2014 the`,"project-local docker-compose.yml is not the running config here."]);let r;try{r=await ft("web",e)}catch(i){return t(["Could not inspect the Docker stack from this directory.",` ${ne.default.dim(String(i.message).split(`
398
+ `)[0])}`,"",`Run ${ne.default.bold("spree upgrade")} from your project root (the directory holding the`,".env with SECRET_KEY_BASE), and make sure Docker is running."])}r||t(["The web container is not running.",`Upgrade runs migrations and the ${ne.default.bold("spree:upgrade")} rake against your live`,`database, so the stack must be up. Start it with ${ne.default.bold("spree dev")}, then`,"re-run `spree upgrade`."])}async function Iv(e,t){if(!t.yes){let i=await at({message:"Run `bundle update` to bump Spree gems?",initialValue:!0});if(K(i)&&(M("Upgrade aborted."),process.exit(0)),!i){E.info("Skipping `bundle update`.");return}}let r=await Rv(e);if(r.length===0)throw new Error('No Spree gems detected in Gemfile.lock. Confirm the project has `gem "spree"` (or `spree_core`/`spree_admin`) in its Gemfile.');E.step(ne.default.bold(`bundle update ${r.join(" ")}`)),await B(["bundle","update",...r],e)}async function Rv(e){try{let{stdout:t}=await ce("docker",["compose","exec","-T","web","sh","-c","bundle list --name-only | grep '^spree'"],{cwd:e});return t.split(`
394
399
  `).map(r=>r.trim()).filter(r=>r.length>0&&r.startsWith("spree"))}catch(t){let r=t;if(r.exitCode===1&&!r.stderr?.trim())return[];throw new Error("Could not list gems in the web container \u2014 the bundle looks out of sync.\nRun `spree bundle install` first, then re-run `spree upgrade`."+(r.stderr?.trim()?`
395
400
 
396
- ${r.stderr.trim()}`:""))}}async function Pv(e,t){if(!t.yes){let r=await yt({message:"Install + run pending migrations?",initialValue:!0});if(Y(r)&&(N("Upgrade aborted."),process.exit(0)),!r){T.info("Skipping migrations.");return}}T.step(ne.default.bold("spree:install:migrations + db:migrate")),await I(["bin/rails","spree:install:migrations","db:migrate"],e)}async function Tv(e,t){let r={};t.plan&&(r.DRY_RUN="1"),t.step&&(r.STEP=t.step),t.to&&(r.TO=t.to),T.step(ne.default.bold("spree:upgrade")),await I(["bin/rake","spree:upgrade"],e,{env:r})}function Ov(e){let t="Update @spree/sdk in any storefront or integration consuming the API",r=$v.join(e,"apps","storefront","package.json");if(!Ym.existsSync(r))return t;try{let i=JSON.parse(Ym.readFileSync(r,"utf-8")),n=i.dependencies?.["@spree/sdk"]??i.devDependencies?.["@spree/sdk"];return n?`Update @spree/sdk in apps/storefront (currently ${n}) to the release matching the new Spree version`:t}catch{return t}}function Iv(e){ee([`The manifest only ran ${ne.default.bold("rake-automatable")} steps.`,"","Don't forget the manual parts from the upgrade doc:",` ${ne.default.dim("- Schedule Spree::StockReservations::ExpireJob (cron)")}`,` ${ne.default.dim(`- ${Ov(e)}`)}`,` ${ne.default.dim("- Review behavior changes (cart, availability, payment-method types)")}`,` ${ne.default.dim("- Audit custom decorators against renamed APIs")}`,"",`Full checklist: ${ne.default.cyan("https://spreecommerce.org/docs/developer/upgrades")}`].join(`
397
- `),"Next steps")}var Xm=U(X(),1);function Qm(e){e.command("user").description("Manage admin users").command("create").description("Create an admin user").option("--email <email>","admin email").option("--password <password>","admin password").action(async r=>{let i=g(),n=r.email,s=r.password;if(!n){let a=await ft({message:"Admin email:",placeholder:"admin@example.com",validate(c){if(!c)return"Email is required";if(!c.includes("@"))return"Invalid email"}});Y(a)&&(N("Cancelled."),process.exit(0)),n=a}if(!s){let a=await sn({message:"Admin password:",validate(c){if(!c||c.length<6)return"Password must be at least 6 characters"}});Y(a)&&(N("Cancelled."),process.exit(0)),s=a}let o=z();o.start("Creating admin user..."),await Q("spree:cli:create_admin",i.projectDir,{EMAIL:n,PASSWORD:s}),o.stop("Admin user created."),T.success(`Email: ${Xm.default.cyan(n)}`)})}var D=new ta().name("spree").description("CLI for managing Spree Commerce projects").version("2.0.0").enablePositionalOptions().showSuggestionAfterError(!0).showHelpAfterError("(run `spree --help` for usage)").exitOverride(e=>{(e.code.startsWith("commander.help")||e.code==="commander.version")&&process.exit(0),process.exit(2)});Dm(D);Tm(D);Wm(D);Nm(D);Km(D);Lm(D);Om(D);vm(D);Rm(D);Mm(D);Pm(D);Gm(D);Jm(D);Im(D);Bm(D);Sm(D);Um(D);Hm(D);Em(D);Qm(D);_m(D);Fm(D);Vm(D);zm(D);Hl(D);xm(D);Cm(D);async function Rv(){try{await D.parseAsync()}catch(e){e instanceof Error&&"code"in e&&(e.code==="commander.helpDisplayed"||e.code==="commander.version")&&process.exit(0),e instanceof Error&&"code"in e&&String(e.code).startsWith("commander.")&&process.exit(2);let t=e instanceof Error&&e.constructor.name==="CredentialError"?2:1,r=e instanceof Error?e.message:"An unexpected error occurred.";console.error(`
398
- ${Zm.default.red("Error:")} ${r}
399
- `),process.exit(t)}}Rv();
401
+ ${r.stderr.trim()}`:""))}}async function jv(e,t){if(!t.yes){let r=await at({message:"Install + run pending migrations?",initialValue:!0});if(K(r)&&(M("Upgrade aborted."),process.exit(0)),!r){E.info("Skipping migrations.");return}}E.step(ne.default.bold("spree:install:migrations + db:migrate")),await B(["bin/rails","spree:install:migrations","db:migrate"],e)}async function Dv(e,t){let r={};t.plan&&(r.DRY_RUN="1"),t.step&&(r.STEP=t.step),t.to&&(r.TO=t.to),E.step(ne.default.bold("spree:upgrade")),await B(["bin/rake","spree:upgrade"],e,{env:r})}function Lv(e){let t="Update @spree/sdk in any storefront or integration consuming the API",r=Tv.join(e,"apps","storefront","package.json");if(!Qm.existsSync(r))return t;try{let i=JSON.parse(Qm.readFileSync(r,"utf-8")),n=i.dependencies?.["@spree/sdk"]??i.devDependencies?.["@spree/sdk"];return n?`Update @spree/sdk in apps/storefront (currently ${n}) to the release matching the new Spree version`:t}catch{return t}}function Mv(e){Y([`The manifest only ran ${ne.default.bold("rake-automatable")} steps.`,"","Don't forget the manual parts from the upgrade doc:",` ${ne.default.dim("- Schedule Spree::StockReservations::ExpireJob (cron)")}`,` ${ne.default.dim(`- ${Lv(e)}`)}`,` ${ne.default.dim("- Review behavior changes (cart, availability, payment-method types)")}`,` ${ne.default.dim("- Audit custom decorators against renamed APIs")}`,"",`Full checklist: ${ne.default.cyan("https://spreecommerce.org/docs/developer/upgrades")}`].join(`
402
+ `),"Next steps")}var eh=N(X(),1);function th(e){e.command("user").description("Manage admin users").command("create").description("Create an admin user").option("--email <email>","admin email").option("--password <password>","admin password").action(async r=>{let i=g(),n=r.email,s=r.password;if(!n){let a=await ct({message:"Admin email:",placeholder:"admin@example.com",validate(c){if(!c)return"Email is required";if(!c.includes("@"))return"Invalid email"}});K(a)&&(M("Cancelled."),process.exit(0)),n=a}if(!s){let a=await Gr({message:"Admin password:",validate(c){if(!c||c.length<6)return"Password must be at least 6 characters"}});K(a)&&(M("Cancelled."),process.exit(0)),s=a}let o=G();o.start("Creating admin user..."),await ee("spree:cli:create_admin",i.projectDir,{EMAIL:n,PASSWORD:s}),o.stop("Admin user created."),E.success(`Email: ${eh.default.cyan(n)}`)})}import{createRequire as Fv}from"module";var Bv=Fv(import.meta.url),rh=Bv("../package.json").version;var j=new na().name("spree").description("CLI for managing Spree Commerce projects").version(rh).enablePositionalOptions().showSuggestionAfterError(!0).showHelpAfterError("(run `spree --help` for usage)").exitOverride(e=>{(e.code.startsWith("commander.help")||e.code==="commander.version")&&process.exit(0),process.exit(2)});Fm(j);Rm(j);Ym(j);Vm(j);Xm(j);Bm(j);jm(j);Am(j);Lm(j);Um(j);Im(j);Wm(j);Zm(j);Dm(j);Gm(j);Cm(j);zm(j);Jm(j);Om(j);th(j);km(j);Nm(j);Km(j);Hm(j);xm(j);Sm(j);Tm(j);async function Uv(){try{await j.parseAsync()}catch(e){e instanceof Error&&"code"in e&&(e.code==="commander.helpDisplayed"||e.code==="commander.version")&&process.exit(0),e instanceof Error&&"code"in e&&String(e.code).startsWith("commander.")&&process.exit(2);let t=e instanceof Error&&e.constructor.name==="CredentialError"?2:1,r=e instanceof Error?e.message:"An unexpected error occurred.";console.error(`
403
+ ${ih.default.red("Error:")} ${r}
404
+ `),process.exit(t)}}Uv();