startx 1.0.8 → 1.0.9

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.
@@ -9,7 +9,7 @@ FROM base AS builder
9
9
 
10
10
  COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
11
11
 
12
- COPY --parents apps/*/package.json ./
12
+ COPY --parents apps/core-server/package.json ./
13
13
  COPY --parents packages/*/package.json ./
14
14
  COPY --parents packages/*/*/package.json ./
15
15
  COPY --parents configs/*/package.json ./
@@ -20,11 +20,12 @@ RUN --mount=type=cache,id=pnpm,target=/root/.local/share/pnpm/store \
20
20
  COPY apps/core-server/ ./apps/core-server/
21
21
  COPY packages ./packages
22
22
  COPY configs ./configs
23
+ COPY assets ./assets
23
24
  COPY turbo.json ./
24
25
 
25
26
  # Build the required packages with Turbo cache mounted
26
27
  RUN --mount=type=cache,id=turbo,target=/app/.turbo/cache \
27
- pnpm build --filter=queue-worker
28
+ pnpm build --filter=core-server
28
29
 
29
30
  # --- Final production image ---
30
31
  FROM node:24-alpine
@@ -1,4 +1,4 @@
1
- import type { SessionUser } from "@repo/lib/session-module";
1
+ import type { SessionUser } from "@repo/common/types/users";
2
2
 
3
3
  declare global {
4
4
  // eslint-disable-next-line @typescript-eslint/no-namespace
@@ -9,7 +9,7 @@ FROM base AS builder
9
9
 
10
10
  COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
11
11
 
12
- COPY --parents apps/*/package.json ./
12
+ COPY --parents apps/queue-worker/package.json ./
13
13
  COPY --parents packages/*/package.json ./
14
14
  COPY --parents packages/*/*/package.json ./
15
15
  COPY --parents configs/*/package.json ./
@@ -56,7 +56,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
56
56
  `)?c+=`
57
57
  `:c=`
58
58
  `+c,s=e+c;return s}t.exports=o})),Ph=_(((e,t)=>{let n=nm(),r=x(`path`),i=`envFile`,a=Wp(),{determine:o}=gh(),{keyNames:s,keyValues:c,keyValuesSync:l}=ch(),{encryptValue:u,decryptKeyValue:d,isEncrypted:f,provision:p,provisionSync:m,provisionWithPrivateKey:h}=kh(),g=Nh(),_=Xm(),v=Gm(),y=Km();t.exports=class{constructor(e,t,n=[],r=!0,i=null,a=!1,s=!1){this.envs=o(n,process.env),this.key=e,this.value=t,this.encrypt=r,this.envKeysFilepath=i,this.noOps=a,this.noCreate=s,this.processedEnvs=[],this.changedFilepaths=new Set,this.unchangedFilepaths=new Set,this.readableFilepaths=new Set}runSync(){for(let e of this.envs)e.type===i&&this._setEnvFileSync(e.value);return{processedEnvs:this.processedEnvs,changedFilepaths:[...this.changedFilepaths],unchangedFilepaths:[...this.unchangedFilepaths]}}async run(){for(let e of this.envs)e.type===i&&await this._setEnvFile(e.value);return{processedEnvs:this.processedEnvs,changedFilepaths:[...this.changedFilepaths],unchangedFilepaths:[...this.unchangedFilepaths]}}_setEnvFileSync(e){let t={};t.key=this.key||null,t.value=this.value||null,t.type=i;let o=r.resolve(e);t.filepath=o,t.envFilepath=e,t.changed=!1;try{let r=!1;n.existsSync(o)||(this.noCreate?y(o):n.writeFileXSync(o,``));let i=y(o),c=n.readFileXSync(o,{encoding:i});t.key&&c.trim().length===0&&(c=`${t.key}="${this.value}"\n`,r=!0),t.originalValue=_(c)[t.key]||null,r&&(t.originalValue=null);let p=!f(t.originalValue);if(this.readableFilepaths.add(e),this.encrypt){let n,r,{publicKeyName:i,privateKeyName:f}=s(o),{publicKeyValue:p,privateKeyValue:g}=l(o,{keysFilepath:this.envKeysFilepath,noOps:this.noOps});if(!g&&!p){let i=m({envSrc:c,envFilepath:e,keysFilepath:this.envKeysFilepath,noOps:this.noOps});c=i.envSrc,n=i.publicKey,r=i.privateKey,t.envKeysFilepath=i.envKeysFilepath,t.localPrivateKeyAdded=i.localPrivateKeyAdded,t.remotePrivateKeyAdded=i.remotePrivateKeyAdded}else if(g){let a=h({envSrc:c,envFilepath:e,keysFilepath:this.envKeysFilepath,privateKeyValue:g,publicKeyValue:p,publicKeyName:i});n=a.publicKey,r=a.privateKey,c=a.envSrc,t.originalValue&&=d(t.key,t.originalValue,f,r)}else p&&(n=p);t.publicKey=n,t.privateKey=r;try{t.encryptedValue=u(this.value,n)}catch{throw new a({publicKeyName:i,publicKey:n}).invalidPublicKey()}t.privateKeyName=f}let v=p&&this.encrypt,b=this.value!==t.originalValue;r&&!this.encrypt?(t.envSrc=c,this.changedFilepaths.add(e),t.changed=!0):v||b?(t.envSrc=g(c,this.key,t.encryptedValue||this.value),this.changedFilepaths.add(e),t.changed=!0):(t.envSrc=c,this.unchangedFilepaths.add(e),t.changed=!1)}catch(n){n.code===`ENOENT`?t.error=new a({envFilepath:e,filepath:o}).missingEnvFile():t.error=n}this.processedEnvs.push(t)}async _setEnvFile(e){let t={};t.key=this.key||null,t.value=this.value||null,t.type=i;let o=r.resolve(e);t.filepath=o,t.envFilepath=e,t.changed=!1;try{let r=!1;await n.exists(o)||(this.noCreate?await v(o):await n.writeFileX(o,``));let i=await v(o),l=await n.readFileX(o,{encoding:i});t.key&&l.trim().length===0&&(l=`${t.key}="${this.value}"\n`,r=!0),t.originalValue=_(l)[t.key]||null,r&&(t.originalValue=null);let m=!f(t.originalValue);if(this.readableFilepaths.add(e),this.encrypt){let n,r,{publicKeyName:i,privateKeyName:f}=s(o),{publicKeyValue:m,privateKeyValue:g}=await c(o,{keysFilepath:this.envKeysFilepath,noOps:this.noOps});if(!g&&!m){let i=await p({envSrc:l,envFilepath:e,keysFilepath:this.envKeysFilepath,noOps:this.noOps});l=i.envSrc,n=i.publicKey,r=i.privateKey,t.envKeysFilepath=i.envKeysFilepath,t.localPrivateKeyAdded=i.localPrivateKeyAdded,t.remotePrivateKeyAdded=i.remotePrivateKeyAdded}else if(g){let a=h({envSrc:l,envFilepath:e,keysFilepath:this.envKeysFilepath,privateKeyValue:g,publicKeyValue:m,publicKeyName:i});n=a.publicKey,r=a.privateKey,l=a.envSrc,t.originalValue&&=d(t.key,t.originalValue,f,r)}else m&&(n=m);t.publicKey=n,t.privateKey=r;try{t.encryptedValue=u(this.value,n)}catch{throw new a({publicKeyName:i,publicKey:n}).invalidPublicKey()}t.privateKeyName=f}let y=m&&this.encrypt,b=this.value!==t.originalValue;r&&!this.encrypt?(t.envSrc=l,this.changedFilepaths.add(e),t.changed=!0):y||b?(t.envSrc=g(l,this.key,t.encryptedValue||this.value),this.changedFilepaths.add(e),t.changed=!0):(t.envSrc=l,this.unchangedFilepaths.add(e),t.changed=!1)}catch(n){n.code===`ENOENT`?t.error=new a({envFilepath:e,filepath:o}).missingEnvFile():t.error=n}this.processedEnvs.push(t)}}})),Fh=_(((e,t)=>{let n=lh(),r=Wp(),{determine:i}=gh();t.exports=class{constructor(e,t=[],n=!1,r=!1,i=null,a=!1){this.key=e,this.envs=t,this.overload=n,this.all=r,this.envKeysFilepath=i,this.noOps=a}runSync(){let e={...process.env},{processedEnvs:t}=new n(i(this.envs,e),this.overload,e,this.envKeysFilepath,this.noOps).runSync();return this._result(t,e)}async run(){let e={...process.env},{processedEnvs:t}=await new n(i(this.envs,e),this.overload,e,this.envKeysFilepath,this.noOps).run();return this._result(t,e)}_result(e,t){let n=[];for(let t of e)for(let e of t.errors)n.push(e);if(this.key){let e={},i=t[this.key];return e[this.key]=i,i===void 0&&n.push(new r({key:this.key}).missingKey()),{parsed:e,errors:n}}if(this.all)return{parsed:t,errors:n};let i={};for(let n of e)if(n.parsed)for(let e of Object.keys(n.parsed))i[e]=t[e];return{parsed:i,errors:n}}}})),Ih=_(((e,t)=>{let{keyNames:n,keyValues:r,keyValuesSync:i}=ch();t.exports=class{constructor(e=`.env`,t=null,n=!1){this.envFile=e,this.envKeysFilepath=t,this.noOps=n}runSync(){let e={},t=this._filepaths();for(let r of t){let{publicKeyName:t,privateKeyName:a}=n(r),{publicKeyValue:o,privateKeyValue:s}=i(r,{keysFilepath:this.envKeysFilepath,noOps:this.noOps});e[t]=o,e[a]=s}return e}async run(){let e={},t=this._filepaths();for(let i of t){let{publicKeyName:t,privateKeyName:a}=n(i),{publicKeyValue:o,privateKeyValue:s}=await r(i,{keysFilepath:this.envKeysFilepath,noOps:this.noOps});e[t]=o,e[a]=s}return e}_filepaths(){return Array.isArray(this.envFile)?this.envFile:[this.envFile]}}})),Lh=_(((e,t)=>{let n=nm(),r=x(`path`),i=Wp(),a=hh(),o=Nh(),s=Xm();t.exports=class{constructor(e=`.`,t){this.directory=e,this.envFile=t||a(e),this.exampleFilename=`.env.example`,this.exampleFilepath=r.resolve(this.directory,this.exampleFilename)}run(){if(this.envFile.length<1)throw new i().missingEnvFiles();let e=new Set,t=new Set,a=this._envFilepaths(),c={},l={},u=`# ${this.exampleFilename} - generated with dotenvx\n`;for(let t of a){let a=r.resolve(this.directory,t);if(!n.existsSync(a)){let e=new i({envFilepath:t,filepath:a}).missingEnvFile();throw e.help=`? add it with [echo "HELLO=World" > ${t}] and then run [dotenvx genexample]`,e}let c=n.readFileXSync(a),l=s(c);for(let t in l)e.add(t),c=o(c,t,``);u+=`\n${c}`}if(n.existsSync(this.exampleFilepath)){u=n.readFileXSync(this.exampleFilepath);let r=s(u);for(let n of[...e])n in r?l[n]=r[n]:(u+=`${n}=''\n`,t.add(n),c[n]=``)}else for(let n of[...e])t.add(n),c[n]=``;return{envExampleFile:u,envFile:this.envFile,exampleFilepath:this.exampleFilepath,addedKeys:[...t],injected:c,preExisted:l}}_envFilepaths(){return Array.isArray(this.envFile)?this.envFile:[this.envFile]}}})),Rh=_(((e,t)=>{let n=$m(),{logger:r}=qp();t.exports=class{constructor(){this.ops=new n}async noOps(){let e=await this.ops.status();return r.debug(`ops: ${e}`),e===`off`}noOpsSync(){let e=this.ops.statusSync();return r.debug(`ops: ${e}`),e===`off`}}})),zh=_(((e,t)=>{let n=x(`path`);function r(e){return e?n.isAbsolute(e)?n.relative(process.cwd(),e)||n.basename(e):e:`.env.keys`}t.exports=r})),Bh=_(((e,t)=>{let n=x(`path`),{setLogLevel:r,setLogName:i,setLogVersion:a,logger:o}=qp(),{getColor:s,bold:c}=Kp(),l=tm(),u=lh(),d=Ph(),f=Fh(),p=Ih(),m=Lh(),h=Rh(),g=ph(),{determine:_}=gh(),v=Wm(),y=nm(),b=zh(),S=function(e={}){let t=process.env;e&&e.processEnv!=null&&(t=e.processEnv);let s=e.overload||e.override,c=e.ignore||[],l=e.strict,d=e.envKeysFile;e&&(r(e),i(e),a(e));let f=k(e);try{let r=g(e);e.envs||(r=_(r,t));let{processedEnvs:i,readableFilepaths:a,uniqueInjectedKeys:p}=new u(r,s,t,d,f).runSync(),m,h={};for(let t of i){t.type===`envFile`&&o.verbose(`loading env from ${t.filepath} (${n.resolve(t.filepath)})`);for(let n of t.errors||[]){if(c.includes(n.code)){o.verbose(`ignored: ${n.message}`);continue}if(l)throw n;m=n,n.code===`MISSING_ENV_FILE`&&e.convention||o.error(n.messageWithHelp)}Object.assign(h,t.injected||{}),Object.assign(h,t.preExisted||{}),o.debug(t.parsed);for(let[e,n]of Object.entries(t.injected||{}))o.verbose(`${e} set`),o.debug(`${e} set to ${n}`);for(let[e,n]of Object.entries(t.preExisted||{}))o.verbose(`${e} pre-exists (protip: use --overload to override)`),o.debug(`${e} pre-exists as ${n} (protip: use --overload to override)`)}let v=`injected env (${p.length})`;return a.length>0&&(v+=` from ${a.join(`, `)}`),o.successv(v),m?{parsed:h,error:m}:{parsed:h}}catch(e){if(l)throw e;return o.error(e.messageWithHelp),{parsed:{},error:e}}},C=function(e,t={}){let n=process.env;t&&t.processEnv!=null&&(n=t.processEnv);let r=t.privateKey||null,i=t.overload||t.override,{parsed:a,errors:s}=new v(e,r,n,i).run();for(let e of s)o.error(e.messageWithHelp);return a},w=function(e,t,n={}){let s=!0;(n.plain||n.encrypt===!1)&&(s=!1),n&&(r(n),i(n),a(n));let c=g(n),l=n.envKeysFile,u=k(n),{processedEnvs:f,changedFilepaths:p,unchangedFilepaths:m}=new d(e,t,c,s,l,u).runSync(),h=``;s&&(h=` with encryption`);for(let e of f)if(o.verbose(`setting for ${e.envFilepath}`),e.error){let t=e.error,n=t.messageWithHelp||(t.help?`${t.message}. ${t.help}`:t.message);o.warn(n)}else y.writeFileXSync(e.filepath,e.envSrc),o.verbose(`${e.key} set${h} (${e.envFilepath})`),o.debug(`${e.key} set${h} to ${e.value} (${e.envFilepath})`);let _=``,v=f.find(e=>e.localPrivateKeyAdded),x=f.find(e=>e.remotePrivateKeyAdded);if(v&&(_=` + local key (${b(v.envKeysFilepath)})`),x&&(_=` + armored key ⛨`),p.length>0)s?o.success(`◈ encrypted ${e} (${p.join(`,`)})${_}`):o.success(`◇ set ${e} (${p.join(`,`)})`);else if(s&&v){let t=v.envFilepath||p[0]||`.env`;o.success(`◈ encrypted ${e} (${t})${_}`)}else m.length>0&&o.info(`○ no change (${m})`);return{processedEnvs:f,changedFilepaths:p,unchangedFilepaths:m}},T=function(e,t={}){let n=g(t),r=k(t),i=t.ignore||[],{parsed:a,errors:s}=new f(e,n,t.overload,t.all,t.envKeysFile,r).runSync();for(let e of s||[])if(!i.includes(e.code)){if(t.strict)throw e;o.error(e.messageWithHelp)}if(e){let t=a[e];return t===void 0?void 0:t}else if(t.format===`eval`){let e=``;for(let[t,n]of Object.entries(a))e+=`${t}=${escape(n)}\n`;return e=e.trim(),e}else if(t.format===`shell`){let e=``;for(let[t,n]of Object.entries(a))e+=`${t}=${n} `;return e=e.trim(),e}else if(t.format===`colon`){let e=``;for(let[t,n]of Object.entries(a))e+=`${t}:${n} `;return e=e.trim(),e}else return a},E=function(e,t,n){return new l(e,t,n).run()},D=function(e,t){return new m(e,t).run()},O=function(e,t,n=null,r=!1){let i=new p(e,n,r).runSync();return t?i[t]:i};function k(e={}){let t=new h;return e.noOps===!0||e.opsOff===!0||t.noOpsSync()}t.exports={config:S,parse:C,set:w,get:T,ls:E,keypair:O,genexample:D,setLogLevel:r,logger:o,getColor:s,bold:c}}))();function Vh(){if(process.env.PROJECT_ROOT)return t.resolve(process.env.PROJECT_ROOT);try{let e=r(import.meta.url),n=t.dirname(e);return t.resolve(n,`../../../../`)}catch(e){return console.error({error:e}),process.cwd()}}function Hh(e){let n=e?.root??Vh(),r={quiet:!0,ignore:[`MISSING_ENV_FILE`]};(0,Bh.config)({path:t.join(process.cwd(),`.env`),...r}),(0,Bh.config)({path:t.join(n,`.env`),...r}),(0,Bh.config)({path:t.join(n,`.env.local`),override:!0,...r}),(0,Bh.config)({path:t.join(n,`.env.production.local`),override:!0,...r})}Hh();function Uh(e){return typeof e==`object`&&!!e&&`parse`in e}const Wh=new Map;function Gh(e){let t={},n={};for(let r of Object.keys(e)){let i=e[r],a=Uh(i)?{schema:i,default:void 0,env:r}:{schema:i.schema,default:i.default,env:i.env??r};process.env[a.env]&&(Wh.set(a.env,process.env[a.env]??``),delete process.env[a.env]);let o=Wh.get(a.env);t[r]=o===void 0?a.default:o,n[r]=a.schema}try{return nf(n).parse(t)}catch(e){if(e instanceof cu){let t=e.issues.map(e=>`${e.path.join(`.`)}: ${e.message}`);throw Error(`Invalid environment variables:\n ❌ ${t.join(`
59
- ❌ `)}`)}throw e}}const Kh=Gh({NODE_ENV:Bp.enum([`development`,`production`,`test`,`staging`]).default(`production`),CLIENT_URL:Bp.string().optional().default(`http://localhost:5000`),SERVER_URL:Bp.string().optional().default(`http://localhost:3000`),CORS_URL:Bp.string().optional().default(`http://localhost:3000`),PORT:Bp.string().optional().default(`3000`),LOG_LEVEL:Bp.enum([`error`,`warn`,`info`,`http`,`debug`]).default(`debug`)});var qh=_(((e,t)=>{var n=class e extends Error{constructor(t){super(`Format functions must be synchronous taking a two arguments: (info, opts)
59
+ ❌ `)}`)}throw e}}const Kh=Gh({NODE_ENV:Bp.enum([`development`,`production`,`test`,`staging`]).default(`production`),CLIENT_URL:Bp.string().optional().default(`http://localhost:5000`),SERVER_URL:Bp.string().optional().default(`http://localhost:3000`),CORS_URL:Bp.string().optional().default(`http://localhost:3000`),PORT:Bp.string().optional().default(`3000`),LOG_LEVEL:Bp.enum([`error`,`warn`,`info`,`http`,`debug`]).default(`debug`),FILE_STORAGE_PATH:Bp.string().optional().default(`storage`)});var qh=_(((e,t)=>{var n=class e extends Error{constructor(t){super(`Format functions must be synchronous taking a two arguments: (info, opts)
60
60
  Found: ${t.toString().split(`
61
61
  `)[0]}\n`),Error.captureStackTrace(this,e)}};t.exports=e=>{if(e.length>2)throw new n(e);function t(e={}){this.options=e}t.prototype.transform=e;function r(e){return new t(e)}return r.Format=t,r}})),Jh=_(((e,t)=>{var n={};t.exports=n;var r={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],grey:[90,39],brightRed:[91,39],brightGreen:[92,39],brightYellow:[93,39],brightBlue:[94,39],brightMagenta:[95,39],brightCyan:[96,39],brightWhite:[97,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgGray:[100,49],bgGrey:[100,49],bgBrightRed:[101,49],bgBrightGreen:[102,49],bgBrightYellow:[103,49],bgBrightBlue:[104,49],bgBrightMagenta:[105,49],bgBrightCyan:[106,49],bgBrightWhite:[107,49],blackBG:[40,49],redBG:[41,49],greenBG:[42,49],yellowBG:[43,49],blueBG:[44,49],magentaBG:[45,49],cyanBG:[46,49],whiteBG:[47,49]};Object.keys(r).forEach(function(e){var t=r[e],i=n[e]=[];i.open=`\x1B[`+t[0]+`m`,i.close=`\x1B[`+t[1]+`m`})})),Yh=_(((e,t)=>{t.exports=function(e,t){t=t||process.argv||[];var n=t.indexOf(`--`),r=/^-{1,2}/.test(e)?``:`--`,i=t.indexOf(r+e);return i!==-1&&(n===-1?!0:i<n)}})),Xh=_(((e,t)=>{var n=x(`os`),r=Yh(),i=process.env,a=void 0;r(`no-color`)||r(`no-colors`)||r(`color=false`)?a=!1:(r(`color`)||r(`colors`)||r(`color=true`)||r(`color=always`))&&(a=!0),`FORCE_COLOR`in i&&(a=i.FORCE_COLOR.length===0||parseInt(i.FORCE_COLOR,10)!==0);function o(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function s(e){if(a===!1)return 0;if(r(`color=16m`)||r(`color=full`)||r(`color=truecolor`))return 3;if(r(`color=256`))return 2;if(e&&!e.isTTY&&a!==!0)return 0;var t=a?1:0;if(process.platform===`win32`){var o=n.release().split(`.`);return Number(process.versions.node.split(`.`)[0])>=8&&Number(o[0])>=10&&Number(o[2])>=10586?Number(o[2])>=14931?3:2:1}if(`CI`in i)return[`TRAVIS`,`CIRCLECI`,`APPVEYOR`,`GITLAB_CI`].some(function(e){return e in i})||i.CI_NAME===`codeship`?1:t;if(`TEAMCITY_VERSION`in i)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(i.TEAMCITY_VERSION)?1:0;if(`TERM_PROGRAM`in i){var s=parseInt((i.TERM_PROGRAM_VERSION||``).split(`.`)[0],10);switch(i.TERM_PROGRAM){case`iTerm.app`:return s>=3?3:2;case`Hyper`:return 3;case`Apple_Terminal`:return 2}}return/-256(color)?$/i.test(i.TERM)?2:/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(i.TERM)||`COLORTERM`in i?1:(i.TERM,t)}function c(e){return o(s(e))}t.exports={supportsColor:c,stdout:c(process.stdout),stderr:c(process.stderr)}})),Zh=_(((e,t)=>{t.exports=function(e,t){var n=``;e||=`Run the trap, drop the bass`,e=e.split(``);var r={a:[`@`,`Ą`,`Ⱥ`,`Ʌ`,`Δ`,`Λ`,`Д`],b:[`ß`,`Ɓ`,`Ƀ`,`ɮ`,`β`,`฿`],c:[`©`,`Ȼ`,`Ͼ`],d:[`Ð`,`Ɗ`,`Ԁ`,`ԁ`,`Ԃ`,`ԃ`],e:[`Ë`,`ĕ`,`Ǝ`,`ɘ`,`Σ`,`ξ`,`Ҽ`,`੬`],f:[`Ӻ`],g:[`ɢ`],h:[`Ħ`,`ƕ`,`Ң`,`Һ`,`Ӈ`,`Ԋ`],i:[`༏`],j:[`Ĵ`],k:[`ĸ`,`Ҡ`,`Ӄ`,`Ԟ`],l:[`Ĺ`],m:[`ʍ`,`Ӎ`,`ӎ`,`Ԡ`,`ԡ`,`൩`],n:[`Ñ`,`ŋ`,`Ɲ`,`Ͷ`,`Π`,`Ҋ`],o:[`Ø`,`õ`,`ø`,`Ǿ`,`ʘ`,`Ѻ`,`ם`,`۝`,`๏`],p:[`Ƿ`,`Ҏ`],q:[`্`],r:[`®`,`Ʀ`,`Ȑ`,`Ɍ`,`ʀ`,`Я`],s:[`§`,`Ϟ`,`ϟ`,`Ϩ`],t:[`Ł`,`Ŧ`,`ͳ`],u:[`Ʊ`,`Ս`],v:[`ט`],w:[`Ш`,`Ѡ`,`Ѽ`,`൰`],x:[`Ҳ`,`Ӿ`,`Ӽ`,`ӽ`],y:[`¥`,`Ұ`,`Ӌ`],z:[`Ƶ`,`ɀ`]};return e.forEach(function(e){e=e.toLowerCase();var t=r[e]||[` `],i=Math.floor(Math.random()*t.length);r[e]===void 0?n+=e:n+=r[e][i]}),n}})),Qh=_(((e,t)=>{t.exports=function(e,t){e||=` he is here `;var n={up:`̍.̎.̄.̅.̿.̑.̆.̐.͒.͗.͑.̇.̈.̊.͂.̓.̈.͊.͋.͌.̃.̂.̌.͐.̀.́.̋.̏.̒.̓.̔.̽.̉.ͣ.ͤ.ͥ.ͦ.ͧ.ͨ.ͩ.ͪ.ͫ.ͬ.ͭ.ͮ.ͯ.̾.͛.͆.̚`.split(`.`),down:`̖.̗.̘.̙.̜.̝.̞.̟.̠.̤.̥.̦.̩.̪.̫.̬.̭.̮.̯.̰.̱.̲.̳.̹.̺.̻.̼.ͅ.͇.͈.͉.͍.͎.͓.͔.͕.͖.͙.͚.̣`.split(`.`),mid:[`̕`,`̛`,`̀`,`́`,`͘`,`̡`,`̢`,`̧`,`̨`,`̴`,`̵`,`̶`,`͜`,`͝`,`͞`,`͟`,`͠`,`͢`,`̸`,`̷`,`͡`,` ҉`]},r=[].concat(n.up,n.down,n.mid);function i(e){return Math.floor(Math.random()*e)}function a(e){var t=!1;return r.filter(function(n){t=n===e}),t}function o(e,t){var r=``,o,s;for(s in t||={},t.up=t.up===void 0?!0:t.up,t.mid=t.mid===void 0?!0:t.mid,t.down=t.down===void 0?!0:t.down,t.size=t.size===void 0?`maxi`:t.size,e=e.split(``),e)if(!a(s)){switch(r+=e[s],o={up:0,down:0,mid:0},t.size){case`mini`:o.up=i(8),o.mid=i(2),o.down=i(8);break;case`maxi`:o.up=i(16)+3,o.mid=i(4)+1,o.down=i(64)+3;break;default:o.up=i(8)+1,o.mid=i(6)/2,o.down=i(8)+1;break}var c=[`up`,`mid`,`down`];for(var l in c)for(var u=c[l],d=0;d<=o[u];d++)t[u]&&(r+=n[u][i(n[u].length)])}return r}return o(e,t)}})),$h=_(((e,t)=>{t.exports=function(e){return function(t,n,r){if(t===` `)return t;switch(n%3){case 0:return e.red(t);case 1:return e.white(t);case 2:return e.blue(t)}}}})),eg=_(((e,t)=>{t.exports=function(e){return function(t,n,r){return n%2==0?t:e.inverse(t)}}})),tg=_(((e,t)=>{t.exports=function(e){var t=[`red`,`yellow`,`green`,`blue`,`magenta`];return function(n,r,i){return n===` `?n:e[t[r++%t.length]](n)}}})),ng=_(((e,t)=>{t.exports=function(e){var t=[`underline`,`inverse`,`grey`,`yellow`,`red`,`green`,`blue`,`white`,`cyan`,`magenta`,`brightYellow`,`brightRed`,`brightGreen`,`brightBlue`,`brightWhite`,`brightCyan`,`brightMagenta`];return function(n,r,i){return n===` `?n:e[t[Math.round(Math.random()*(t.length-2))]](n)}}})),rg=_(((e,t)=>{var n={};t.exports=n,n.themes={};var r=x(`util`),i=n.styles=Jh(),a=Object.defineProperties,o=new RegExp(/[\r\n]+/g);n.supportsColor=Xh().supportsColor,n.enabled===void 0&&(n.enabled=n.supportsColor()!==!1),n.enable=function(){n.enabled=!0},n.disable=function(){n.enabled=!1},n.stripColors=n.strip=function(e){return(``+e).replace(/\x1B\[\d+m/g,``)},n.stylize=function(e,t){if(!n.enabled)return e+``;var r=i[t];return!r&&t in n?n[t](e):r.open+e+r.close};var s=/[|\\{}()[\]^$+*?.]/g,c=function(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(s,`\\$&`)};function l(e){var t=function e(){return f.apply(e,arguments)};return t._styles=e,t.__proto__=d,t}var u=(function(){var e={};return i.grey=i.gray,Object.keys(i).forEach(function(t){i[t].closeRe=new RegExp(c(i[t].close),`g`),e[t]={get:function(){return l(this._styles.concat(t))}}}),e})(),d=a(function(){},u);function f(){var e=Array.prototype.slice.call(arguments).map(function(e){return e!=null&&e.constructor===String?e:r.inspect(e)}).join(` `);if(!n.enabled||!e)return e;for(var t=e.indexOf(`
62
62
  `)!=-1,a=this._styles,s=a.length;s--;){var c=i[a[s]];e=c.open+e.replace(c.closeRe,c.open)+c.close,t&&(e=e.replace(o,function(e){return c.close+e+c.open}))}return e}n.setTheme=function(e){if(typeof e==`string`){console.log(`colors.setTheme now only accepts an object, not a string. If you are trying to set a theme from a file, it is now your (the caller's) responsibility to require the file. The old syntax looked like colors.setTheme(__dirname + '/../themes/generic-logging.js'); The new syntax looks like colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));`);return}for(var t in e)(function(t){n[t]=function(r){if(typeof e[t]==`object`){var i=r;for(var a in e[t])i=n[e[t][a]](i);return i}return n[e[t]](r)}})(t)};function p(){var e={};return Object.keys(u).forEach(function(t){e[t]={get:function(){return l([t])}}}),e}var m=function(e,t){var n=t.split(``);return n=n.map(e),n.join(``)};for(var h in n.trap=Zh(),n.zalgo=Qh(),n.maps={},n.maps.america=$h()(n),n.maps.zebra=eg()(n),n.maps.rainbow=tg()(n),n.maps.random=ng()(n),n.maps)(function(e){n[e]=function(t){return m(n.maps[e],t)}})(h);a(n,p())})),ig=_(((e,t)=>{t.exports=rg()})),ag=_((e=>{e.levels={error:0,warn:1,help:2,data:3,info:4,debug:5,prompt:6,verbose:7,input:8,silly:9},e.colors={error:`red`,warn:`yellow`,help:`cyan`,data:`grey`,info:`green`,debug:`blue`,prompt:`grey`,verbose:`cyan`,input:`grey`,silly:`magenta`}})),og=_((e=>{e.levels={error:0,warn:1,info:2,http:3,verbose:4,debug:5,silly:6},e.colors={error:`red`,warn:`yellow`,info:`green`,http:`green`,verbose:`cyan`,debug:`blue`,silly:`magenta`}})),sg=_((e=>{e.levels={emerg:0,alert:1,crit:2,error:3,warning:4,notice:5,info:6,debug:7},e.colors={emerg:`red`,alert:`yellow`,crit:`red`,error:`red`,warning:`red`,notice:`yellow`,info:`green`,debug:`blue`}})),cg=_((e=>{Object.defineProperty(e,`cli`,{value:ag()}),Object.defineProperty(e,`npm`,{value:og()}),Object.defineProperty(e,`syslog`,{value:sg()})})),lg=_((e=>{Object.defineProperty(e,`LEVEL`,{value:Symbol.for(`level`)}),Object.defineProperty(e,`MESSAGE`,{value:Symbol.for(`message`)}),Object.defineProperty(e,`SPLAT`,{value:Symbol.for(`splat`)}),Object.defineProperty(e,`configs`,{value:cg()})})),ug=_(((e,t)=>{let n=ig(),{LEVEL:r,MESSAGE:i}=lg();n.enabled=!0;let a=/\s+/;var o=class e{constructor(e={}){e.colors&&this.addColors(e.colors),this.options=e}static addColors(t){let n=Object.keys(t).reduce((e,n)=>(e[n]=a.test(t[n])?t[n].split(a):t[n],e),{});return e.allColors=Object.assign({},e.allColors||{},n),e.allColors}addColors(t){return e.addColors(t)}colorize(t,r,i){if(i===void 0&&(i=r),!Array.isArray(e.allColors[t]))return n[e.allColors[t]](i);for(let r=0,a=e.allColors[t].length;r<a;r++)i=n[e.allColors[t][r]](i);return i}transform(e,t){return t.all&&typeof e[i]==`string`&&(e[i]=this.colorize(e[r],e.level,e[i])),(t.level||t.all||!t.message)&&(e.level=this.colorize(e[r],e.level)),(t.all||t.message)&&(e.message=this.colorize(e[r],e.level,e.message)),e}};t.exports=e=>new o(e),t.exports.Colorizer=t.exports.Format=o})),dg=_(((e,t)=>{let{Colorizer:n}=ug();t.exports=e=>(n.addColors(e.colors||e),e)})),fg=_(((e,t)=>{t.exports=qh()(e=>(e.message=`\t${e.message}`,e))})),pg=_(((e,t)=>{let n=qh(),{LEVEL:r,MESSAGE:i}=lg();t.exports=n((e,{stack:t,cause:n})=>{if(e instanceof Error){let a=Object.assign({},e,{level:e.level,[r]:e[r]||e.level,message:e.message,[i]:e[i]||e.message});return t&&(a.stack=e.stack),n&&(a.cause=e.cause),a}if(!(e.message instanceof Error))return e;let a=e.message;return Object.assign(e,a),e.message=a.message,e[i]=a.message,t&&(e.stack=a.stack),n&&(e.cause=a.cause),e})})),mg=_(((e,t)=>{let{configs:n,LEVEL:r,MESSAGE:i}=lg();var a=class e{constructor(t={levels:n.npm.levels}){this.paddings=e.paddingForLevels(t.levels,t.filler),this.options=t}static getLongestLevel(e){let t=Object.keys(e).map(e=>e.length);return Math.max(...t)}static paddingForLevel(e,t,n){let r=n+1-e.length,i=Math.floor(r/t.length);return`${t}${t.repeat(i)}`.slice(0,r)}static paddingForLevels(t,n=` `){let r=e.getLongestLevel(t);return Object.keys(t).reduce((t,i)=>(t[i]=e.paddingForLevel(i,n,r),t),{})}transform(e,t){return e.message=`${this.paddings[e[r]]}${e.message}`,e[i]&&(e[i]=`${this.paddings[e[r]]}${e[i]}`),e}};t.exports=e=>new a(e),t.exports.Padder=t.exports.Format=a})),hg=_(((e,t)=>{let{Colorizer:n}=ug(),{Padder:r}=mg(),{configs:i,MESSAGE:a}=lg();var o=class{constructor(e={}){e.levels||=i.cli.levels,this.colorizer=new n(e),this.padder=new r(e),this.options=e}transform(e,t){return this.colorizer.transform(this.padder.transform(e,t),t),e[a]=`${e.level}:${e.message}`,e}};t.exports=e=>new o(e),t.exports.Format=o})),gg=_(((e,t)=>{let n=qh();function r(e){if(e.every(i))return t=>{let n=t;for(let t=0;t<e.length;t++)if(n=e[t].transform(n,e[t].options),!n)return!1;return n}}function i(e){if(typeof e.transform!=`function`)throw Error([`No transform function found on format. Did you create a format instance?`,`const myFormat = format(formatFn);`,`const instance = myFormat();`].join(`
@@ -199,7 +199,7 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
199
199
  `)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
200
200
  `,e)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(this.onKeyLine=!1,t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){Array.prototype.push.apply(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,r=n&&(t.sep||t.explicitKey)&&this.type!==`seq-item-ind`,a=[];if(r&&t.sep&&!t.value){let n=[];for(let r=0;r<t.sep.length;++r){let i=t.sep[r];switch(i.type){case`newline`:n.push(r);break;case`space`:break;case`comment`:i.indent>e.indent&&(n.length=0);break;default:n.length=0}}n.length>=2&&(a=t.sep.splice(n[1]))}switch(this.type){case`anchor`:case`tag`:r||t.value?(a.push(this.sourceToken),e.items.push({start:a}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`explicit-key-ind`:!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):r||t.value?(a.push(this.sourceToken),e.items.push({start:a,explicitKey:!0})):this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case`map-value-ind`:if(t.explicitKey)if(!t.sep)if(i(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=c(t.start);this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:null,sep:[this.sourceToken]}]})}else if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(i(t.sep,`map-value-ind`))this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:a,key:null,sep:[this.sourceToken]}]});else if(o(t.key)&&!i(t.sep,`newline`)){let e=c(t.start),n=t.key,r=t.sep;r.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:n,sep:r}]})}else a.length>0?t.sep=t.sep.concat(a,this.sourceToken):t.sep.push(this.sourceToken);else t.sep?t.value||r?e.items.push({start:a,key:null,sep:[this.sourceToken]}):i(t.sep,`map-value-ind`)?this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);r||t.value?(e.items.push({start:a,key:n,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(n):(Object.assign(t,{key:n,sep:[]}),this.onKeyLine=!0);return}default:{let r=this.startBlockValue(e);if(r){if(r.type===`block-seq`){if(!t.explicitKey&&t.sep&&!i(t.sep,`newline`)){yield*this.pop({type:`error`,offset:this.offset,message:`Unexpected block-seq-ind on same line with key`,source:this.source});return}}else n&&e.items.push({start:a});this.stack.push(r);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){Array.prototype.push.apply(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case`anchor`:case`tag`:if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case`seq-item-ind`:if(this.indent!==e.indent)break;t.value||i(t.start,`seq-item-ind`)?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let t=this.startBlockValue(e);if(t){this.stack.push(t);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type===`flow-error-end`){let e;do yield*this.pop(),e=this.peek(1);while(e?.type===`flow-collection`)}else if(e.end.length===0){switch(this.type){case`comma`:case`explicit-key-ind`:!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case`map-value-ind`:!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case`space`:case`comment`:case`newline`:case`anchor`:case`tag`:!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:n,sep:[]}):t.sep?this.stack.push(n):Object.assign(t,{key:n,sep:[]});return}case`flow-map-end`:case`flow-seq-end`:e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let t=this.peek(2);if(t.type===`block-map`&&(this.type===`map-value-ind`&&t.indent===e.indent||this.type===`newline`&&!t.items[t.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type===`map-value-ind`&&t.type!==`flow-collection`){let n=c(s(t));l(e);let r=e.end.splice(1,e.end.length);r.push(this.sourceToken);let i={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let e=this.source.indexOf(`
201
201
  `)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
202
- `,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=c(s(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=c(s(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}}})),ky=_((e=>{var t=xy(),n=iy(),r=ay(),i=kv(),a=$(),o=Dy(),s=Oy();function c(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new o.LineCounter||null,prettyErrors:t}}function l(e,n={}){let{lineCounter:i,prettyErrors:a}=c(n),o=new s.Parser(i?.addNewLine),l=new t.Composer(n),u=Array.from(l.compose(o.parse(e)));if(a&&i)for(let t of u)t.errors.forEach(r.prettifyError(e,i)),t.warnings.forEach(r.prettifyError(e,i));return u.length>0?u:Object.assign([],{empty:!0},l.streamInfo())}function u(e,n={}){let{lineCounter:i,prettyErrors:a}=c(n),o=new s.Parser(i?.addNewLine),l=new t.Composer(n),u=null;for(let t of l.compose(o.parse(e),!0,e.length))if(!u)u=t;else if(u.options.logLevel!==`silent`){u.errors.push(new r.YAMLParseError(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return a&&i&&(u.errors.forEach(r.prettifyError(e,i)),u.warnings.forEach(r.prettifyError(e,i))),u}function d(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let a=u(e,n);if(!a)return null;if(a.warnings.forEach(e=>i.warn(a.options.logLevel,e)),a.errors.length>0){if(a.options.logLevel!==`silent`)throw a.errors[0];a.errors=[]}return a.toJS(Object.assign({reviver:r},n))}function f(e,t,r){let i=null;if(typeof t==`function`||Array.isArray(t)?i=t:r===void 0&&t&&(r=t),typeof r==`string`&&(r=r.length),typeof r==`number`){let e=Math.round(r);r=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=r??t??{};if(!e)return}return a.isDocument(e)&&!i?e.toString(r):new n.Document(e,i,r).toString(r)}e.parse=d,e.parseAllDocuments=l,e.parseDocument=u,e.stringify=f})),Ay=b(_((e=>{var t=xy(),n=iy(),r=ny(),i=ay(),a=bv(),o=$(),s=Mv(),c=xv(),l=Pv(),u=Iv();Ty();var d=Ey(),f=Dy(),p=Oy(),m=ky(),h=mv();e.Composer=t.Composer,e.Document=n.Document,e.Schema=r.Schema,e.YAMLError=i.YAMLError,e.YAMLParseError=i.YAMLParseError,e.YAMLWarning=i.YAMLWarning,e.Alias=a.Alias,e.isAlias=o.isAlias,e.isCollection=o.isCollection,e.isDocument=o.isDocument,e.isMap=o.isMap,e.isNode=o.isNode,e.isPair=o.isPair,e.isScalar=o.isScalar,e.isSeq=o.isSeq,e.Pair=s.Pair,e.Scalar=c.Scalar,e.YAMLMap=l.YAMLMap,e.YAMLSeq=u.YAMLSeq,e.Lexer=d.Lexer,e.LineCounter=f.LineCounter,e.Parser=p.Parser,e.parse=m.parse,e.parseAllDocuments=m.parseAllDocuments,e.parseDocument=m.parseDocument,e.stringify=m.stringify,e.visit=h.visit,e.visitAsync=h.visitAsync}))(),1);function jy(){return Kh.NODE_ENV===`development`?t.resolve(process.cwd(),`../../`):process.cwd()}const My=new class{root=jy();async pathExists(e){try{return await a.access(e),!0}catch{return!1}}async writeFile({file:e,content:n}){await a.writeFile(t.resolve(this.root,e),n)}async writeJSONFile({file:e,content:n,dir:r}){e=`${e}.json`;let i=t.resolve(this.root,e);if(r){let n=t.resolve(this.root,r);await this.ensurePathExists({dir:r}),i=t.resolve(n,e)}await a.writeFile(i,JSON.stringify(n,null,2))}async readFile({file:e}){return await a.readFile(t.resolve(this.root,e),`utf-8`)}async readJSONFile({file:e,dir:n}){try{e=`${e}.json`;let r=t.resolve(this.root,n??``,e),i=await a.readFile(r,`utf-8`);return JSON.parse(i)}catch(t){return console.error(`Failed to read JSON file at ${e}:`,t),null}}async readYamlFile({file:e,dir:n}){try{e=`${e}.yaml`;let r=t.resolve(this.root,n??``,e),i=await a.readFile(r,`utf-8`);return Ay.parseDocument(i)}catch(t){return console.error(`Failed to read Yaml file at ${e}:`,t),null}}async ensurePathExists({dir:e}){let n=t.resolve(this.root,e);await this.pathExists(n)||await a.mkdir(n,{recursive:!0})}async avoidOverriding({file:e}){let n=t.resolve(this.root,e);if(await this.pathExists(n))throw Error(`File ${n} already exists`)}async removeFile({file:e}){let n=t.resolve(this.root,e);await this.pathExists(n)&&await a.unlink(n)}async removeDirectory({dir:e,target:n}){let r=t.resolve(this.root,e,n);await this.pathExists(r)&&await a.rm(r,{recursive:!0,force:!0})}async copyFile({from:e,to:n}){await this.ensurePathExists({dir:t.dirname(n)}),await a.copyFile(t.resolve(this.root,e),t.resolve(this.root,n))}async copyDirectory({from:e,to:n,recursive:r=!0,include:i,exclude:o}){let s=t.resolve(this.root,e),c=t.resolve(this.root,n);if(!await this.pathExists(s))return;await this.ensurePathExists({dir:t.join(n)});let l=await a.readdir(s,{withFileTypes:!0});for(let u of l){let l=t.join(s,u.name),d=t.join(c,u.name),f=(!i||i.test(u.name))&&(!o||!o.test(u.name));u.isDirectory()?r&&await this.copyDirectory({from:t.join(e,u.name),to:t.join(n,u.name),recursive:r,include:i,exclude:o}):u.isFile()&&f&&await a.copyFile(l,d)}}async listDirectories({dir:e}){try{return(await a.readdir(t.resolve(this.root,e),{withFileTypes:!0})).filter(e=>e.isDirectory()).map(e=>e.name)}catch(t){return console.error(`Error listing directories in ${e}:`,t),[]}}async listFiles({dir:e}){try{return(await a.readdir(t.resolve(this.root,e),{withFileTypes:!0})).filter(e=>e.isFile()).map(e=>e.name)}catch(t){return console.error(`Error listing files in ${e}:`,t),[]}}},Ny={"startx.json":{tags:[`never`]},".npmignore":{tags:[`never`]},".npmrc":{tags:[`never`]},".prettier.cjs":{tags:[`prettier`]},".prettierignore":{tags:[`biome`]},"biome.json":{tags:[`biome`]},"pnpm-lock.yaml":{tags:[`never`]},"pnpm-workspace.yaml":{tags:[`root`]},"turbo.json":{tags:[`root`]},LICENSE:{tags:[`never`]},".env":{tags:[`never`]},"tsdown.config.ts":{tags:[`tsdown`]},"eslint.config.ts":{tags:[`eslint`,`node`]},"vitest.config.ts":{tags:[`vitest`,`node`]},"package.json":{tags:[`never`]}},Py=Gh({STARTX_ENV:Bp.enum([`development`,`production`,`test`,`staging`]).default(`production`)});var Fy=class{static getDirectory(){let e=r(import.meta.url),n=t.dirname(e),i=process.cwd();return n=Py.STARTX_ENV===`development`?t.resolve(n,`../../../../`):t.resolve(n,`../../../`),{template:n,workspace:i}}static async getPackageList(){let e=this.getDirectory().template,n=async(n,r,i=``,a)=>{let o=t.join(e,...n.split(`/`));try{let n=await My.listDirectories({dir:o});return a&&(n=n.filter(a)),(await Promise.all(n.map(async n=>{let a=t.join(o,n),s=t.relative(e,a),c=i?`${i}${n}`:n,l;try{l=await this.parsePackageJson({dir:a})}catch{l=null}return l?{type:r,path:a,relativePath:s,name:c,packageJson:l}:(console.error(`Ignoring this package failed to read package.json: ${c}`),null)}))).filter(e=>e!==null)}catch(e){return console.error(`Error reading directory ${o}:`,e),[]}},r=[`@repo`,`@db`];return(await Promise.all([n(`apps`,`apps`),n(`configs`,`configs`),n(`packages`,`packages`,``,e=>!r.includes(e)),n(`packages/@repo`,`packages`,`@repo/`),n(`packages/@db`,`packages`,`@db/`)])).flat()}static async parsePackageJson({dir:e,file:t=`package`}){return await My.readJSONFile({dir:e,file:t})}static async parsePnpmWorkspace({dir:e}){return(await My.readYamlFile({file:`pnpm-workspace`,dir:e}))?.toJSON()}};const Iy={"@biomejs/biome":{tags:[`node`,`biome`,`root`],version:`catalog:`,isDevDependency:!0},prettier:{tags:[`node`,`prettier`,`root`],version:`catalog:`,isDevDependency:!0},eslint:{tags:[`node`,`eslint`,`root`],version:`catalog:`,isDevDependency:!0},vitest:{tags:[`node`,`vitest`,`root`],version:`catalog:`,isDevDependency:!0},tsdown:{isDevDependency:!0,tags:[`node`,`tsdown`,`root`],version:`catalog:`},"tsdown-config":{tags:[`node`,`tsdown`,`runnable`],version:`workspace:^`,isDevDependency:!0},"@types/node":{tags:[`node`,`root`],version:`catalog:`,isDevDependency:!0},"typescript-config":{tags:[`node`],version:`workspace:^`,isDevDependency:!0},"eslint-config":{tags:[`node`,`eslint`],version:`workspace:^`,isDevDependency:!0},"vitest-config":{tags:[`node`,`vitest`],version:`workspace:^`,isDevDependency:!0}},Ly={dev:[{script:`turbo run dev`,tags:[`runnable`,`root`]},{script:`tsx watch src/index.ts`,tags:[`runnable`,`node`,`backend`,`express`]},{script:`email dev --port 3014 --dir ./src`,tags:[`node`,`mail`]},{script:`react-router dev`,tags:[`react-router`,`frontend`]}],"dev:debug":[{script:`turbo run dev:debug`,tags:[`node`,`runnable`,`root`]},{script:`tsx watch --inspect src/index.ts`,tags:[`backend`,`node`,`runnable`,`express`]}],"bun:dev":[{script:`turbo run bun:dev`,tags:[`node`,`runnable`,`root`]},{script:`bun --watch src/index.ts`,tags:[`backend`,`node`,`runnable`,`express`]}],build:[{script:`turbo run build`,tags:[`runnable`,`root`]},{script:`react-router build`,tags:[`react-router`,`frontend`,`runnable`]},{script:`tsdown --config-loader unrun`,tags:[`runnable`,`node`,`tsdown`]}],cli:[{script:`turbo run cli -- `,tags:[`runnable`,`node`,`cli`,`root`]},{script:`tsx src/index.ts`,tags:[`runnable`,`node`,`cli`,`commander`]}],start:[{script:`turbo run start`,tags:[`backend`,`runnable`,`node`,`root`]},{script:`node dist/index.mjs`,tags:[`node`,`runnable`]},{script:`react-router-serve ./build/server/index.js`,tags:[`react-router`,`frontend`]}],lint:[{script:`turbo run lint`,tags:[`node`,`eslint`,`root`]},{script:`eslint .`,tags:[`node`,`eslint`]}],"lint:fix":[{script:`turbo run lint:fix`,tags:[`node`,`eslint`,`root`]},{script:`eslint . src/**/*.ts --fix`,tags:[`node`,`eslint`]}],clean:[{script:`turbo run clean`,tags:[`root`]},{script:`rimraf dist build .turbo`,tags:[]}],"deep:clean":[{script:`turbo run deep:clean`,tags:[`root`]},{script:`rimraf node_modules dist build .turbo`,tags:[`node`]}],"db:push":[{script:`drizzle-kit push`,tags:[`drizzle`,`db`]},{script:`turbo run db:push`,tags:[`db`,`root`]}],"db:studio":[{script:`drizzle-kit studio`,tags:[`drizzle`,`db`]},{script:`turbo run db:studio`,tags:[`db`,`root`]}],"db:pull":[{script:`drizzle-kit pull`,tags:[`drizzle`,`db`]},{script:`turbo run db:pull`,tags:[`db`,`root`]}],"db:generate":[{script:`drizzle-kit generate`,tags:[`drizzle`,`db`]},{script:`turbo run db:generate`,tags:[`db`,`root`]}],"db:migrate":[{script:`drizzle-kit migrate`,tags:[`drizzle`,`db`]},{script:`turbo run db:migrate`,tags:[`db`,`root`]}],"db:check":[{script:`drizzle-kit check`,tags:[`drizzle`,`db`]},{script:`turbo run db:check`,tags:[`db`,`root`]}],typecheck:[{script:`turbo run typecheck`,tags:[`node`,`root`]},{script:`tsc --noEmit`,tags:[`node`]},{script:`react-router typegen && tsc`,tags:[`react-router`,`frontend`]}],format:[{script:`turbo run format`,tags:[`node`,`root`]},{script:`biome format --write .`,tags:[`node`,`biome`,`prettier`]},{script:`prettier --write .`,tags:[`node`,`prettier`]}],"format:check":[{script:`turbo run format:check`,tags:[`node`,`root`]},{script:`biome ci .`,tags:[`node`,`biome`,`prettier`]},{script:`prettier --check .`,tags:[`node`,`prettier`]}],test:[{script:`turbo run test`,tags:[`node`,`vitest`,`root`]},{script:`vitest run`,tags:[`node`,`vitest`]}]},Ry={packageManager:`pnpm@10.28.2`,node:`>=22`};var zy=class{static objSorter(e,t=[]){let n=Object.fromEntries(Object.entries(e).filter(([,e])=>e!=null)),r=[];for(let e of t)e in n&&(r.push([e,n[e]]),delete n[e]);for(let e of Object.entries(n))r.push(e);return Object.fromEntries(r)}static handlePackageJson(e){let t=!!e.app.devDependencies?.turbo,n=t?[...e.tags,`root`]:[...e.tags],r=t?{version:`1.0.0`,packageManager:Ry.packageManager,engines:{node:Ry.node}}:{},i=Object.fromEntries(Object.entries(Ly).map(([e,t])=>{let r=t.find(e=>e.tags.every(e=>n.includes(e)));return r?[e,r.script]:null}).filter(e=>e!==null)),a=e=>Object.fromEntries(Object.entries(e??{}).filter(([e])=>{let t=Iy[e];return!t||t.tags.every(e=>n.includes(e))})),o=a(e.app.dependencies),s=a(e.app.devDependencies);for(let[e,t]of Object.entries(o))t.includes(`workspace:`)&&delete o[e];for(let[e,t]of Object.entries(s))t.includes(`workspace:`)&&delete s[e];if(e.dependencies)for(let[t,n]of Object.entries(e.dependencies))o[t]||(o[t]=n);e.app.startx?.requiredDevDeps?.forEach(e=>s[e]=`workspace:^`),e.app.startx?.requiredDeps?.forEach(e=>o[e]=`workspace:^`);for(let[e,r]of Object.entries(Iy)){if(!r.tags.every(e=>n.includes(e))||t&&!r.tags.includes(`root`))continue;let i=r.isDevDependency;i&&!s[e]?s[e]=r.version:!i&&!o[e]&&(o[e]=r.version)}for(let t of e.app.startx?.ignore??[])delete o[t],delete s[t];let c={name:e.name||e.app.name,description:e.app.description,type:`module`,exports:e.app.exports,files:e.app.files,scripts:i,dependencies:o,devDependencies:s,...r};return{packageJson:this.objSorter(c,[`name`,`description`,`version`,`type`,`scripts`,`files`,`exports`,`dependencies`,`devDependencies`,`packageManager`,`engines`]),isWorkspace:t}}};const By=(e,t=[])=>e.name===`up`||t.includes(`vim`)&&e.name===`k`||t.includes(`emacs`)&&e.ctrl&&e.name===`p`,Vy=(e,t=[])=>e.name===`down`||t.includes(`vim`)&&e.name===`j`||t.includes(`emacs`)&&e.ctrl&&e.name===`n`,Hy=e=>e.name===`space`,Uy=e=>e.name===`backspace`,Wy=e=>e.name===`tab`,Gy=e=>`1234567890`.includes(e.name),Ky=e=>e.name===`enter`||e.name===`return`;var qy=class extends Error{name=`AbortPromptError`;message=`Prompt was aborted`;constructor(e){super(),this.cause=e?.cause}},Jy=class extends Error{name=`CancelPromptError`;message=`Prompt was canceled`},Yy=class extends Error{name=`ExitPromptError`},Xy=class extends Error{name=`HookError`},Zy=class extends Error{name=`ValidationError`};const Qy=new o;function $y(e){return{rl:e,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function eb(e,t){let n=$y(e);return Qy.run(n,()=>{function e(e){n.handleChange=()=>{n.index=0,e()},n.handleChange()}return t(e)})}function tb(){let e=Qy.getStore();if(!e)throw new Xy(`[Inquirer] Hook functions can only be called from within a prompt`);return e}function nb(){return tb().rl}function rb(e){return s.bind((...t)=>{let n=tb(),r=!1,i=n.handleChange;n.handleChange=()=>{r=!0};let a=e(...t);return r&&i(),n.handleChange=i,a})}function ib(e){let t=tb(),{index:n}=t,r=e({get(){return t.hooks[n]},set(e){t.hooks[n]=e},initialized:n in t.hooks});return t.index++,r}function ab(){tb().handleChange()}const ob={queue(e){let t=tb(),{index:n}=t;t.hooksEffect.push(()=>{t.hooksCleanup[n]?.();let r=e(nb());if(r!=null&&typeof r!=`function`)throw new Zy(`useEffect return value must be a cleanup function or nothing.`);t.hooksCleanup[n]=r})},run(){let e=tb();rb(()=>{e.hooksEffect.forEach(e=>{e()}),e.hooksEffect.length=0})()},clearAll(){let e=tb();e.hooksCleanup.forEach(e=>{e?.()}),e.hooksEffect.length=0,e.hooksCleanup.length=0}};function sb(e){return ib(t=>{let n=s.bind(function(e){t.get()!==e&&(t.set(e),ab())});if(t.initialized)return[t.get(),n];let r=typeof e==`function`?e():e;return t.set(r),[r,n]})}function cb(e,t){ib(n=>{let r=n.get();(!Array.isArray(r)||t.some((e,t)=>!Object.is(e,r[t])))&&ob.queue(e),n.set(t)})}function lb(){return i.platform===`win32`?!!i.env.WT_SESSION||!!i.env.TERMINUS_SUBLIME||i.env.ConEmuTask===`{cmd::Cmder}`||i.env.TERM_PROGRAM===`Terminus-Sublime`||i.env.TERM_PROGRAM===`vscode`||i.env.TERM===`xterm-256color`||i.env.TERM===`alacritty`||i.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:i.env.TERM!==`linux`}const ub={circleQuestionMark:`(?)`,questionMarkPrefix:`(?)`,square:`█`,squareDarkShade:`▓`,squareMediumShade:`▒`,squareLightShade:`░`,squareTop:`▀`,squareBottom:`▄`,squareLeft:`▌`,squareRight:`▐`,squareCenter:`■`,bullet:`●`,dot:`․`,ellipsis:`…`,pointerSmall:`›`,triangleUp:`▲`,triangleUpSmall:`▴`,triangleDown:`▼`,triangleDownSmall:`▾`,triangleLeftSmall:`◂`,triangleRightSmall:`▸`,home:`⌂`,heart:`♥`,musicNote:`♪`,musicNoteBeamed:`♫`,arrowUp:`↑`,arrowDown:`↓`,arrowLeft:`←`,arrowRight:`→`,arrowLeftRight:`↔`,arrowUpDown:`↕`,almostEqual:`≈`,notEqual:`≠`,lessOrEqual:`≤`,greaterOrEqual:`≥`,identical:`≡`,infinity:`∞`,subscriptZero:`₀`,subscriptOne:`₁`,subscriptTwo:`₂`,subscriptThree:`₃`,subscriptFour:`₄`,subscriptFive:`₅`,subscriptSix:`₆`,subscriptSeven:`₇`,subscriptEight:`₈`,subscriptNine:`₉`,oneHalf:`½`,oneThird:`⅓`,oneQuarter:`¼`,oneFifth:`⅕`,oneSixth:`⅙`,oneEighth:`⅛`,twoThirds:`⅔`,twoFifths:`⅖`,threeQuarters:`¾`,threeFifths:`⅗`,threeEighths:`⅜`,fourFifths:`⅘`,fiveSixths:`⅚`,fiveEighths:`⅝`,sevenEighths:`⅞`,line:`─`,lineBold:`━`,lineDouble:`═`,lineDashed0:`┄`,lineDashed1:`┅`,lineDashed2:`┈`,lineDashed3:`┉`,lineDashed4:`╌`,lineDashed5:`╍`,lineDashed6:`╴`,lineDashed7:`╶`,lineDashed8:`╸`,lineDashed9:`╺`,lineDashed10:`╼`,lineDashed11:`╾`,lineDashed12:`−`,lineDashed13:`–`,lineDashed14:`‐`,lineDashed15:`⁃`,lineVertical:`│`,lineVerticalBold:`┃`,lineVerticalDouble:`║`,lineVerticalDashed0:`┆`,lineVerticalDashed1:`┇`,lineVerticalDashed2:`┊`,lineVerticalDashed3:`┋`,lineVerticalDashed4:`╎`,lineVerticalDashed5:`╏`,lineVerticalDashed6:`╵`,lineVerticalDashed7:`╷`,lineVerticalDashed8:`╹`,lineVerticalDashed9:`╻`,lineVerticalDashed10:`╽`,lineVerticalDashed11:`╿`,lineDownLeft:`┐`,lineDownLeftArc:`╮`,lineDownBoldLeftBold:`┓`,lineDownBoldLeft:`┒`,lineDownLeftBold:`┑`,lineDownDoubleLeftDouble:`╗`,lineDownDoubleLeft:`╖`,lineDownLeftDouble:`╕`,lineDownRight:`┌`,lineDownRightArc:`╭`,lineDownBoldRightBold:`┏`,lineDownBoldRight:`┎`,lineDownRightBold:`┍`,lineDownDoubleRightDouble:`╔`,lineDownDoubleRight:`╓`,lineDownRightDouble:`╒`,lineUpLeft:`┘`,lineUpLeftArc:`╯`,lineUpBoldLeftBold:`┛`,lineUpBoldLeft:`┚`,lineUpLeftBold:`┙`,lineUpDoubleLeftDouble:`╝`,lineUpDoubleLeft:`╜`,lineUpLeftDouble:`╛`,lineUpRight:`└`,lineUpRightArc:`╰`,lineUpBoldRightBold:`┗`,lineUpBoldRight:`┖`,lineUpRightBold:`┕`,lineUpDoubleRightDouble:`╚`,lineUpDoubleRight:`╙`,lineUpRightDouble:`╘`,lineUpDownLeft:`┤`,lineUpBoldDownBoldLeftBold:`┫`,lineUpBoldDownBoldLeft:`┨`,lineUpDownLeftBold:`┥`,lineUpBoldDownLeftBold:`┩`,lineUpDownBoldLeftBold:`┪`,lineUpDownBoldLeft:`┧`,lineUpBoldDownLeft:`┦`,lineUpDoubleDownDoubleLeftDouble:`╣`,lineUpDoubleDownDoubleLeft:`╢`,lineUpDownLeftDouble:`╡`,lineUpDownRight:`├`,lineUpBoldDownBoldRightBold:`┣`,lineUpBoldDownBoldRight:`┠`,lineUpDownRightBold:`┝`,lineUpBoldDownRightBold:`┡`,lineUpDownBoldRightBold:`┢`,lineUpDownBoldRight:`┟`,lineUpBoldDownRight:`┞`,lineUpDoubleDownDoubleRightDouble:`╠`,lineUpDoubleDownDoubleRight:`╟`,lineUpDownRightDouble:`╞`,lineDownLeftRight:`┬`,lineDownBoldLeftBoldRightBold:`┳`,lineDownLeftBoldRightBold:`┯`,lineDownBoldLeftRight:`┰`,lineDownBoldLeftBoldRight:`┱`,lineDownBoldLeftRightBold:`┲`,lineDownLeftRightBold:`┮`,lineDownLeftBoldRight:`┭`,lineDownDoubleLeftDoubleRightDouble:`╦`,lineDownDoubleLeftRight:`╥`,lineDownLeftDoubleRightDouble:`╤`,lineUpLeftRight:`┴`,lineUpBoldLeftBoldRightBold:`┻`,lineUpLeftBoldRightBold:`┷`,lineUpBoldLeftRight:`┸`,lineUpBoldLeftBoldRight:`┹`,lineUpBoldLeftRightBold:`┺`,lineUpLeftRightBold:`┶`,lineUpLeftBoldRight:`┵`,lineUpDoubleLeftDoubleRightDouble:`╩`,lineUpDoubleLeftRight:`╨`,lineUpLeftDoubleRightDouble:`╧`,lineUpDownLeftRight:`┼`,lineUpBoldDownBoldLeftBoldRightBold:`╋`,lineUpDownBoldLeftBoldRightBold:`╈`,lineUpBoldDownLeftBoldRightBold:`╇`,lineUpBoldDownBoldLeftRightBold:`╊`,lineUpBoldDownBoldLeftBoldRight:`╉`,lineUpBoldDownLeftRight:`╀`,lineUpDownBoldLeftRight:`╁`,lineUpDownLeftBoldRight:`┽`,lineUpDownLeftRightBold:`┾`,lineUpBoldDownBoldLeftRight:`╂`,lineUpDownLeftBoldRightBold:`┿`,lineUpBoldDownLeftBoldRight:`╃`,lineUpBoldDownLeftRightBold:`╄`,lineUpDownBoldLeftBoldRight:`╅`,lineUpDownBoldLeftRightBold:`╆`,lineUpDoubleDownDoubleLeftDoubleRightDouble:`╬`,lineUpDoubleDownDoubleLeftRight:`╫`,lineUpDownLeftDoubleRightDouble:`╪`,lineCross:`╳`,lineBackslash:`╲`,lineSlash:`╱`},db={tick:`✔`,info:`ℹ`,warning:`⚠`,cross:`✘`,squareSmall:`◻`,squareSmallFilled:`◼`,circle:`◯`,circleFilled:`◉`,circleDotted:`◌`,circleDouble:`◎`,circleCircle:`ⓞ`,circleCross:`ⓧ`,circlePipe:`Ⓘ`,radioOn:`◉`,radioOff:`◯`,checkboxOn:`☒`,checkboxOff:`☐`,checkboxCircleOn:`ⓧ`,checkboxCircleOff:`Ⓘ`,pointer:`❯`,triangleUpOutline:`△`,triangleLeft:`◀`,triangleRight:`▶`,lozenge:`◆`,lozengeOutline:`◇`,hamburger:`☰`,smiley:`㋡`,mustache:`෴`,star:`★`,play:`▶`,nodejs:`⬢`,oneSeventh:`⅐`,oneNinth:`⅑`,oneTenth:`⅒`},fb={tick:`√`,info:`i`,warning:`‼`,cross:`×`,squareSmall:`□`,squareSmallFilled:`■`,circle:`( )`,circleFilled:`(*)`,circleDotted:`( )`,circleDouble:`( )`,circleCircle:`(○)`,circleCross:`(×)`,circlePipe:`(│)`,radioOn:`(*)`,radioOff:`( )`,checkboxOn:`[×]`,checkboxOff:`[ ]`,checkboxCircleOn:`(×)`,checkboxCircleOff:`( )`,pointer:`>`,triangleUpOutline:`∆`,triangleLeft:`◄`,triangleRight:`►`,lozenge:`♦`,lozengeOutline:`◊`,hamburger:`≡`,smiley:`☺`,mustache:`┌─┐`,star:`✶`,play:`►`,nodejs:`♦`,oneSeventh:`1/7`,oneNinth:`1/9`,oneTenth:`1/10`},pb={...ub,...db},mb={...ub,...fb};var hb=lb()?pb:mb;Object.entries(db);const gb={prefix:{idle:l(`blue`,`?`),done:l(`green`,hb.tick)},spinner:{interval:80,frames:[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`].map(e=>l(`yellow`,e))},style:{answer:e=>l(`cyan`,e),message:e=>l(`bold`,e),error:e=>l(`red`,`> ${e}`),defaultAnswer:e=>l(`dim`,`(${e})`),help:e=>l(`dim`,e),highlight:e=>l(`cyan`,e),key:e=>l(`cyan`,l(`bold`,`<${e}>`))}};function _b(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function vb(...e){let t={};for(let n of e)for(let[e,r]of Object.entries(n)){let n=t[e];t[e]=_b(n)&&_b(r)?vb(n,r):r}return t}function yb(...e){return vb(gb,...e.filter(e=>e!=null))}function bb({status:e=`idle`,theme:t}){let[n,r]=sb(!1),[i,a]=sb(0),{prefix:o,spinner:s}=yb(t);return cb(()=>{if(e===`loading`){let e,t=-1,n=setTimeout(()=>{r(!0),e=setInterval(()=>{t+=1,a(t%s.frames.length)},s.interval)},300);return()=>{clearTimeout(n),clearInterval(e)}}else r(!1)},[e]),n?s.frames[i]:typeof o==`string`?o:o[e===`loading`?`idle`:e]??o.idle}function xb(e,t){return ib(n=>{let r=n.get();if(!r||r.dependencies.length!==t.length||r.dependencies.some((e,n)=>e!==t[n])){let r=e();return n.set({value:r,dependencies:t}),r}return r.value})}function Sb(e){return sb({current:e})[0]}function Cb(e){let t=Sb(e);t.current=e,cb(e=>{let n=!1,r=rb((r,i)=>{n||t.current(i,e)});return e.input.on(`keypress`,r),()=>{n=!0,e.input.removeListener(`keypress`,r)}},[])}var wb=_(((e,t)=>{t.exports=r;function n(e){let t={defaultWidth:0,output:process.stdout,tty:x(`tty`)};return e?(Object.keys(t).forEach(function(n){e[n]||(e[n]=t[n])}),e):t}function r(e){let t=n(e);if(t.output.getWindowSize)return t.output.getWindowSize()[0]||t.defaultWidth;if(t.tty.getWindowSize)return t.tty.getWindowSize()[1]||t.defaultWidth;if(t.output.columns)return t.output.columns;if(process.env.CLI_WIDTH){let e=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(e)&&e!==0)return e}return t.defaultWidth}}));const Tb=(()=>{let e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let n=0;for(e.lastIndex=0;e.test(t);)n+=1;return t.length-n}})(),Eb=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,Db=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,Ob=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,kb=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,Ab=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy,jb=/\t{1,1000}/y,Mb=/[\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?))*/uy,Nb=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,Pb=/\p{M}+/gu,Fb={limit:1/0,ellipsis:``},Ib=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?Ib(i,Fb,n).width:0),o=n.controlWidth??0,s=n.tabWidth??8,c=n.emojiWidth??2,l=n.regularWidth??1,u=n.wideWidth??2,d=[[Nb,l],[Ob,0],[kb,o],[jb,s],[Mb,c],[Ab,u]],f=0,p=0,m=e.length,h=0,g=!1,_=m,v=Math.max(0,r-a),y=0,b=0,x=0,S=0;outer:for(;;){if(b>y||p>=m&&p>f){let t=e.slice(y,b)||e.slice(f,p);h=0;for(let e of t.replaceAll(Pb,``)){let t=e.codePointAt(0)||0;if(S=Eb(t)?2:Db(t)?u:l,x+S>v&&(_=Math.min(_,Math.max(y,f)+h)),x+S>r){g=!0;break outer}h+=e.length,x+=S}y=b=0}if(p>=m)break outer;for(let t=0,n=d.length;t<n;t++){let[n,i]=d[t];if(n.lastIndex=p,n.test(e)){if(h=n===Ab?Tb(e.slice(p,n.lastIndex)):n===Mb?1:n.lastIndex-p,S=h*i,x+S>v&&(_=Math.min(_,p+Math.floor((v-x)/i))),x+S>r){g=!0;break outer}x+=S,y=f,b=p,p=f=n.lastIndex;continue outer}}p+=1}return{width:g?v:x,index:g?_:m,truncated:g,ellipsed:g&&r>=a}};var Lb=Ib;const Rb={limit:1/0,ellipsis:``,ellipsisWidth:0};var zb=(e,t={})=>Lb(e,Rb,t).width;const Bb=`]8;;`,Vb=RegExp(`(?:\\[(?<code>\\d+)m|\\${Bb}(?<uri>.*))`,`y`),Hb=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},Ub=e=>`[${e}m`,Wb=e=>`${Bb}${e}`,Gb=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:zb(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=zb(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===`›`)&&(i=!0,a=t.startsWith(Bb,u+1)),i?a?o===`\x07`&&(i=!1,a=!1):o===`m`&&(i=!1):(s+=d,s===n&&!l.done&&(e.push(``),s=0)),c=l,l=r.next(),u+=o.length}o=e.at(-1),!s&&o!==void 0&&o.length&&e.length>1&&(e[e.length-2]+=e.pop())},Kb=e=>{let t=e.split(` `),n=t.length;for(;n&&!zb(t[n-1]);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},qb=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=e.split(` `),s=[``],c=0;for(let e=0;e<o.length;e++){let r=o[e];if(n.trim!==!1){let e=s.at(-1)??``,t=e.trimStart();e.length!==t.length&&(s[s.length-1]=t,c=zb(t))}e!==0&&(c>=t&&(n.wordWrap===!1||n.trim===!1)&&(s.push(``),c=0),(c||n.trim===!1)&&(s[s.length-1]+=` `,c++));let i=zb(r);if(n.hard&&i>t){let e=t-c,n=1+Math.floor((i-e-1)/t);Math.floor((i-1)/t)<n&&s.push(``),Gb(s,r,t),c=zb(s.at(-1)??``);continue}if(c+i>t&&c&&i){if(n.wordWrap===!1&&c<t){Gb(s,r,t),c=zb(s.at(-1)??``);continue}s.push(``),c=0}if(c+i>t&&n.wordWrap===!1){Gb(s,r,t),c=zb(s.at(-1)??``);continue}s[s.length-1]+=r,c+=i}n.trim!==!1&&(s=s.map(e=>Kb(e)));let l=s.join(`
202
+ `,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=c(s(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=c(s(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}}})),ky=_((e=>{var t=xy(),n=iy(),r=ay(),i=kv(),a=$(),o=Dy(),s=Oy();function c(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new o.LineCounter||null,prettyErrors:t}}function l(e,n={}){let{lineCounter:i,prettyErrors:a}=c(n),o=new s.Parser(i?.addNewLine),l=new t.Composer(n),u=Array.from(l.compose(o.parse(e)));if(a&&i)for(let t of u)t.errors.forEach(r.prettifyError(e,i)),t.warnings.forEach(r.prettifyError(e,i));return u.length>0?u:Object.assign([],{empty:!0},l.streamInfo())}function u(e,n={}){let{lineCounter:i,prettyErrors:a}=c(n),o=new s.Parser(i?.addNewLine),l=new t.Composer(n),u=null;for(let t of l.compose(o.parse(e),!0,e.length))if(!u)u=t;else if(u.options.logLevel!==`silent`){u.errors.push(new r.YAMLParseError(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return a&&i&&(u.errors.forEach(r.prettifyError(e,i)),u.warnings.forEach(r.prettifyError(e,i))),u}function d(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let a=u(e,n);if(!a)return null;if(a.warnings.forEach(e=>i.warn(a.options.logLevel,e)),a.errors.length>0){if(a.options.logLevel!==`silent`)throw a.errors[0];a.errors=[]}return a.toJS(Object.assign({reviver:r},n))}function f(e,t,r){let i=null;if(typeof t==`function`||Array.isArray(t)?i=t:r===void 0&&t&&(r=t),typeof r==`string`&&(r=r.length),typeof r==`number`){let e=Math.round(r);r=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=r??t??{};if(!e)return}return a.isDocument(e)&&!i?e.toString(r):new n.Document(e,i,r).toString(r)}e.parse=d,e.parseAllDocuments=l,e.parseDocument=u,e.stringify=f})),Ay=b(_((e=>{var t=xy(),n=iy(),r=ny(),i=ay(),a=bv(),o=$(),s=Mv(),c=xv(),l=Pv(),u=Iv();Ty();var d=Ey(),f=Dy(),p=Oy(),m=ky(),h=mv();e.Composer=t.Composer,e.Document=n.Document,e.Schema=r.Schema,e.YAMLError=i.YAMLError,e.YAMLParseError=i.YAMLParseError,e.YAMLWarning=i.YAMLWarning,e.Alias=a.Alias,e.isAlias=o.isAlias,e.isCollection=o.isCollection,e.isDocument=o.isDocument,e.isMap=o.isMap,e.isNode=o.isNode,e.isPair=o.isPair,e.isScalar=o.isScalar,e.isSeq=o.isSeq,e.Pair=s.Pair,e.Scalar=c.Scalar,e.YAMLMap=l.YAMLMap,e.YAMLSeq=u.YAMLSeq,e.Lexer=d.Lexer,e.LineCounter=f.LineCounter,e.Parser=p.Parser,e.parse=m.parse,e.parseAllDocuments=m.parseAllDocuments,e.parseDocument=m.parseDocument,e.stringify=m.stringify,e.visit=h.visit,e.visitAsync=h.visitAsync}))(),1);function jy(){return Kh.NODE_ENV===`development`?t.resolve(process.cwd(),`../../`):process.cwd()}const My=new class{root=jy();async pathExists(e){try{return await a.access(e),!0}catch{return!1}}async writeFile({file:e,content:n}){await a.writeFile(t.resolve(this.root,e),n)}async writeJSONFile({file:e,content:n,dir:r}){e=`${e}.json`;let i=t.resolve(this.root,e);if(r){let n=t.resolve(this.root,r);await this.ensurePathExists({dir:r}),i=t.resolve(n,e)}await a.writeFile(i,JSON.stringify(n,null,2))}async readFile({file:e}){return await a.readFile(t.resolve(this.root,e),`utf-8`)}async readJSONFile({file:e,dir:n}){try{e=`${e}.json`;let r=t.resolve(this.root,n??``,e),i=await a.readFile(r,`utf-8`);return JSON.parse(i)}catch(t){return console.error(`Failed to read JSON file at ${e}:`,t),null}}async readYamlFile({file:e,dir:n}){try{e=`${e}.yaml`;let r=t.resolve(this.root,n??``,e),i=await a.readFile(r,`utf-8`);return Ay.parseDocument(i)}catch(t){return console.error(`Failed to read Yaml file at ${e}:`,t),null}}async ensurePathExists({dir:e}){let n=t.resolve(this.root,e);await this.pathExists(n)||await a.mkdir(n,{recursive:!0})}async avoidOverriding({file:e}){let n=t.resolve(this.root,e);if(await this.pathExists(n))throw Error(`File ${n} already exists`)}async removeFile({file:e}){let n=t.resolve(this.root,e);await this.pathExists(n)&&await a.unlink(n)}async removeDirectory({dir:e,target:n}){let r=t.resolve(this.root,e,n);await this.pathExists(r)&&await a.rm(r,{recursive:!0,force:!0})}async copyFile({from:e,to:n}){await this.ensurePathExists({dir:t.dirname(n)}),await a.copyFile(t.resolve(this.root,e),t.resolve(this.root,n))}async copyDirectory({from:e,to:n,recursive:r=!0,include:i,exclude:o}){let s=t.resolve(this.root,e),c=t.resolve(this.root,n);if(!await this.pathExists(s))return;await this.ensurePathExists({dir:t.join(n)});let l=await a.readdir(s,{withFileTypes:!0});for(let u of l){let l=t.join(s,u.name),d=t.join(c,u.name),f=(!i||i.test(u.name))&&(!o||!o.test(u.name));u.isDirectory()?r&&await this.copyDirectory({from:t.join(e,u.name),to:t.join(n,u.name),recursive:r,include:i,exclude:o}):u.isFile()&&f&&await a.copyFile(l,d)}}async listDirectories({dir:e}){try{return(await a.readdir(t.resolve(this.root,e),{withFileTypes:!0})).filter(e=>e.isDirectory()).map(e=>e.name)}catch(t){return console.error(`Error listing directories in ${e}:`,t),[]}}async listFiles({dir:e}){try{return(await a.readdir(t.resolve(this.root,e),{withFileTypes:!0})).filter(e=>e.isFile()).map(e=>e.name)}catch(t){return console.error(`Error listing files in ${e}:`,t),[]}}},Ny={"startx.json":{tags:[`never`]},".npmignore":{tags:[`never`]},".npmrc":{tags:[`never`]},".prettier.cjs":{tags:[`prettier`]},".prettierignore":{tags:[`biome`]},"biome.json":{tags:[`biome`]},"pnpm-lock.yaml":{tags:[`never`]},"pnpm-workspace.yaml":{tags:[`root`]},"turbo.json":{tags:[`root`]},LICENSE:{tags:[`never`]},".env":{tags:[`never`]},"tsdown.config.ts":{tags:[`tsdown`]},"eslint.config.ts":{tags:[`eslint`,`node`]},"vitest.config.ts":{tags:[`vitest`,`node`]},"package.json":{tags:[`never`]}},Py=Gh({STARTX_ENV:Bp.enum([`development`,`production`,`test`,`staging`]).default(`production`)});var Fy=class{static getDirectory(){let e=r(import.meta.url),n=t.dirname(e),i=process.cwd();return n=Py.STARTX_ENV===`development`?t.resolve(n,`../../../../`):t.resolve(n,`../../../`),{template:n,workspace:i}}static async getPackageList(){let e=this.getDirectory().template,n=async(n,r,i=``,a)=>{let o=t.join(e,...n.split(`/`));try{let n=await My.listDirectories({dir:o});return a&&(n=n.filter(a)),(await Promise.all(n.map(async n=>{let a=t.join(o,n),s=t.relative(e,a),c=i?`${i}${n}`:n,l;try{l=await this.parsePackageJson({dir:a})}catch{l=null}return l?{type:r,path:a,relativePath:s,name:c,packageJson:l}:(console.error(`Ignoring this package failed to read package.json: ${c}`),null)}))).filter(e=>e!==null)}catch(e){return console.error(`Error reading directory ${o}:`,e),[]}},r=[`@repo`,`@db`];return(await Promise.all([n(`apps`,`apps`),n(`configs`,`configs`),n(`packages`,`packages`,``,e=>!r.includes(e)),n(`packages/@repo`,`packages`,`@repo/`),n(`packages/@db`,`packages`,`@db/`)])).flat()}static async parsePackageJson({dir:e,file:t=`package`}){return await My.readJSONFile({dir:e,file:t})}static async parsePnpmWorkspace({dir:e}){return(await My.readYamlFile({file:`pnpm-workspace`,dir:e}))?.toJSON()}};const Iy={"@biomejs/biome":{tags:[`node`,`biome`,`root`],version:`catalog:`,isDevDependency:!0},prettier:{tags:[`node`,`prettier`,`root`],version:`catalog:`,isDevDependency:!0},eslint:{tags:[`node`,`eslint`,`root`],version:`catalog:`,isDevDependency:!0},vitest:{tags:[`node`,`vitest`,`root`],version:`catalog:`,isDevDependency:!0},tsdown:{isDevDependency:!0,tags:[`node`,`tsdown`,`root`],version:`catalog:`},"tsdown-config":{tags:[`node`,`tsdown`,`runnable`],version:`workspace:^`,isDevDependency:!0},"@types/node":{tags:[`node`,`root`],version:`catalog:`,isDevDependency:!0},"typescript-config":{tags:[`node`],version:`workspace:^`,isDevDependency:!0},"eslint-config":{tags:[`node`,`eslint`],version:`workspace:^`,isDevDependency:!0},"vitest-config":{tags:[`node`,`vitest`],version:`workspace:^`,isDevDependency:!0}},Ly={dev:[{script:`turbo run dev`,tags:[`runnable`,`root`]},{script:`tsx watch src/index.ts`,tags:[`runnable`,`node`,`backend`,`express`]},{script:`email dev --port 3014 --dir ./src`,tags:[`node`,`mail`]},{script:`react-router dev`,tags:[`react-router`,`frontend`]}],"dev:debug":[{script:`turbo run dev:debug`,tags:[`node`,`runnable`,`root`]},{script:`tsx watch --inspect src/index.ts`,tags:[`backend`,`node`,`runnable`,`express`]}],"bun:dev":[{script:`turbo run bun:dev`,tags:[`node`,`runnable`,`root`]},{script:`bun --watch src/index.ts`,tags:[`backend`,`node`,`runnable`,`express`]}],build:[{script:`turbo run build`,tags:[`runnable`,`root`]},{script:`react-router build`,tags:[`react-router`,`frontend`,`runnable`]},{script:`tsdown --config-loader unrun`,tags:[`runnable`,`node`,`tsdown`]}],cli:[{script:`turbo run cli -- `,tags:[`runnable`,`node`,`cli`,`root`]},{script:`tsx src/index.ts`,tags:[`runnable`,`node`,`cli`,`commander`]}],start:[{script:`turbo run start`,tags:[`backend`,`runnable`,`node`,`root`]},{script:`vite preview`,tags:[`react-router`,`frontend`,`runnable`]},{script:`node dist/index.mjs`,tags:[`node`,`runnable`]}],lint:[{script:`turbo run lint`,tags:[`node`,`eslint`,`root`]},{script:`eslint .`,tags:[`node`,`eslint`]}],"lint:fix":[{script:`turbo run lint:fix`,tags:[`node`,`eslint`,`root`]},{script:`eslint . src/**/*.ts --fix`,tags:[`node`,`eslint`]}],clean:[{script:`turbo run clean`,tags:[`root`]},{script:`rimraf dist build .turbo`,tags:[]}],"deep:clean":[{script:`turbo run deep:clean`,tags:[`root`]},{script:`rimraf node_modules dist build .turbo`,tags:[`node`]}],"db:push":[{script:`drizzle-kit push`,tags:[`drizzle`,`db`]},{script:`turbo run db:push`,tags:[`db`,`root`]}],"db:studio":[{script:`drizzle-kit studio`,tags:[`drizzle`,`db`]},{script:`turbo run db:studio`,tags:[`db`,`root`]}],"db:pull":[{script:`drizzle-kit pull`,tags:[`drizzle`,`db`]},{script:`turbo run db:pull`,tags:[`db`,`root`]}],"db:generate":[{script:`drizzle-kit generate`,tags:[`drizzle`,`db`]},{script:`turbo run db:generate`,tags:[`db`,`root`]}],"db:migrate":[{script:`drizzle-kit migrate`,tags:[`drizzle`,`db`]},{script:`turbo run db:migrate`,tags:[`db`,`root`]}],"db:check":[{script:`drizzle-kit check`,tags:[`drizzle`,`db`]},{script:`turbo run db:check`,tags:[`db`,`root`]}],typecheck:[{script:`turbo run typecheck`,tags:[`node`,`root`]},{script:`tsc --noEmit`,tags:[`node`]},{script:`react-router typegen && tsc`,tags:[`react-router`,`frontend`]}],format:[{script:`turbo run format`,tags:[`node`,`root`]},{script:`biome format --write .`,tags:[`node`,`biome`,`prettier`]},{script:`prettier --write .`,tags:[`node`,`prettier`]}],"format:check":[{script:`turbo run format:check`,tags:[`node`,`root`]},{script:`biome ci .`,tags:[`node`,`biome`,`prettier`]},{script:`prettier --check .`,tags:[`node`,`prettier`]}],test:[{script:`turbo run test`,tags:[`node`,`vitest`,`root`]},{script:`vitest run`,tags:[`node`,`vitest`]}]},Ry={packageManager:`pnpm@10.28.2`,node:`>=22`};var zy=class{static objSorter(e,t=[]){let n=Object.fromEntries(Object.entries(e).filter(([,e])=>e!=null)),r=[];for(let e of t)e in n&&(r.push([e,n[e]]),delete n[e]);for(let e of Object.entries(n))r.push(e);return Object.fromEntries(r)}static handlePackageJson(e){let t=!!e.app.devDependencies?.turbo,n=t?[...e.tags,`root`]:[...e.tags],r=t?{version:`1.0.0`,packageManager:Ry.packageManager,engines:{node:Ry.node}}:{},i=Object.fromEntries(Object.entries(Ly).map(([e,t])=>{let r=t.find(e=>e.tags.every(e=>n.includes(e)));return r?[e,r.script]:null}).filter(e=>e!==null)),a=e=>Object.fromEntries(Object.entries(e??{}).filter(([e])=>{let t=Iy[e];return!t||t.tags.every(e=>n.includes(e))})),o=a(e.app.dependencies),s=a(e.app.devDependencies);for(let[e,t]of Object.entries(o))t.includes(`workspace:`)&&delete o[e];for(let[e,t]of Object.entries(s))t.includes(`workspace:`)&&delete s[e];if(e.dependencies)for(let[t,n]of Object.entries(e.dependencies))o[t]||(o[t]=n);e.app.startx?.requiredDevDeps?.forEach(e=>s[e]=`workspace:^`),e.app.startx?.requiredDeps?.forEach(e=>o[e]=`workspace:^`);for(let[e,r]of Object.entries(Iy)){if(!r.tags.every(e=>n.includes(e))||t&&!r.tags.includes(`root`))continue;let i=r.isDevDependency;i&&!s[e]?s[e]=r.version:!i&&!o[e]&&(o[e]=r.version)}for(let t of e.app.startx?.ignore??[])delete o[t],delete s[t];let c={name:e.name||e.app.name,description:e.app.description,type:`module`,exports:e.app.exports,files:e.app.files,scripts:i,dependencies:o,devDependencies:s,...r};return{packageJson:this.objSorter(c,[`name`,`description`,`version`,`type`,`scripts`,`files`,`exports`,`dependencies`,`devDependencies`,`packageManager`,`engines`]),isWorkspace:t}}};const By=(e,t=[])=>e.name===`up`||t.includes(`vim`)&&e.name===`k`||t.includes(`emacs`)&&e.ctrl&&e.name===`p`,Vy=(e,t=[])=>e.name===`down`||t.includes(`vim`)&&e.name===`j`||t.includes(`emacs`)&&e.ctrl&&e.name===`n`,Hy=e=>e.name===`space`,Uy=e=>e.name===`backspace`,Wy=e=>e.name===`tab`,Gy=e=>`1234567890`.includes(e.name),Ky=e=>e.name===`enter`||e.name===`return`;var qy=class extends Error{name=`AbortPromptError`;message=`Prompt was aborted`;constructor(e){super(),this.cause=e?.cause}},Jy=class extends Error{name=`CancelPromptError`;message=`Prompt was canceled`},Yy=class extends Error{name=`ExitPromptError`},Xy=class extends Error{name=`HookError`},Zy=class extends Error{name=`ValidationError`};const Qy=new o;function $y(e){return{rl:e,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function eb(e,t){let n=$y(e);return Qy.run(n,()=>{function e(e){n.handleChange=()=>{n.index=0,e()},n.handleChange()}return t(e)})}function tb(){let e=Qy.getStore();if(!e)throw new Xy(`[Inquirer] Hook functions can only be called from within a prompt`);return e}function nb(){return tb().rl}function rb(e){return s.bind((...t)=>{let n=tb(),r=!1,i=n.handleChange;n.handleChange=()=>{r=!0};let a=e(...t);return r&&i(),n.handleChange=i,a})}function ib(e){let t=tb(),{index:n}=t,r=e({get(){return t.hooks[n]},set(e){t.hooks[n]=e},initialized:n in t.hooks});return t.index++,r}function ab(){tb().handleChange()}const ob={queue(e){let t=tb(),{index:n}=t;t.hooksEffect.push(()=>{t.hooksCleanup[n]?.();let r=e(nb());if(r!=null&&typeof r!=`function`)throw new Zy(`useEffect return value must be a cleanup function or nothing.`);t.hooksCleanup[n]=r})},run(){let e=tb();rb(()=>{e.hooksEffect.forEach(e=>{e()}),e.hooksEffect.length=0})()},clearAll(){let e=tb();e.hooksCleanup.forEach(e=>{e?.()}),e.hooksEffect.length=0,e.hooksCleanup.length=0}};function sb(e){return ib(t=>{let n=s.bind(function(e){t.get()!==e&&(t.set(e),ab())});if(t.initialized)return[t.get(),n];let r=typeof e==`function`?e():e;return t.set(r),[r,n]})}function cb(e,t){ib(n=>{let r=n.get();(!Array.isArray(r)||t.some((e,t)=>!Object.is(e,r[t])))&&ob.queue(e),n.set(t)})}function lb(){return i.platform===`win32`?!!i.env.WT_SESSION||!!i.env.TERMINUS_SUBLIME||i.env.ConEmuTask===`{cmd::Cmder}`||i.env.TERM_PROGRAM===`Terminus-Sublime`||i.env.TERM_PROGRAM===`vscode`||i.env.TERM===`xterm-256color`||i.env.TERM===`alacritty`||i.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:i.env.TERM!==`linux`}const ub={circleQuestionMark:`(?)`,questionMarkPrefix:`(?)`,square:`█`,squareDarkShade:`▓`,squareMediumShade:`▒`,squareLightShade:`░`,squareTop:`▀`,squareBottom:`▄`,squareLeft:`▌`,squareRight:`▐`,squareCenter:`■`,bullet:`●`,dot:`․`,ellipsis:`…`,pointerSmall:`›`,triangleUp:`▲`,triangleUpSmall:`▴`,triangleDown:`▼`,triangleDownSmall:`▾`,triangleLeftSmall:`◂`,triangleRightSmall:`▸`,home:`⌂`,heart:`♥`,musicNote:`♪`,musicNoteBeamed:`♫`,arrowUp:`↑`,arrowDown:`↓`,arrowLeft:`←`,arrowRight:`→`,arrowLeftRight:`↔`,arrowUpDown:`↕`,almostEqual:`≈`,notEqual:`≠`,lessOrEqual:`≤`,greaterOrEqual:`≥`,identical:`≡`,infinity:`∞`,subscriptZero:`₀`,subscriptOne:`₁`,subscriptTwo:`₂`,subscriptThree:`₃`,subscriptFour:`₄`,subscriptFive:`₅`,subscriptSix:`₆`,subscriptSeven:`₇`,subscriptEight:`₈`,subscriptNine:`₉`,oneHalf:`½`,oneThird:`⅓`,oneQuarter:`¼`,oneFifth:`⅕`,oneSixth:`⅙`,oneEighth:`⅛`,twoThirds:`⅔`,twoFifths:`⅖`,threeQuarters:`¾`,threeFifths:`⅗`,threeEighths:`⅜`,fourFifths:`⅘`,fiveSixths:`⅚`,fiveEighths:`⅝`,sevenEighths:`⅞`,line:`─`,lineBold:`━`,lineDouble:`═`,lineDashed0:`┄`,lineDashed1:`┅`,lineDashed2:`┈`,lineDashed3:`┉`,lineDashed4:`╌`,lineDashed5:`╍`,lineDashed6:`╴`,lineDashed7:`╶`,lineDashed8:`╸`,lineDashed9:`╺`,lineDashed10:`╼`,lineDashed11:`╾`,lineDashed12:`−`,lineDashed13:`–`,lineDashed14:`‐`,lineDashed15:`⁃`,lineVertical:`│`,lineVerticalBold:`┃`,lineVerticalDouble:`║`,lineVerticalDashed0:`┆`,lineVerticalDashed1:`┇`,lineVerticalDashed2:`┊`,lineVerticalDashed3:`┋`,lineVerticalDashed4:`╎`,lineVerticalDashed5:`╏`,lineVerticalDashed6:`╵`,lineVerticalDashed7:`╷`,lineVerticalDashed8:`╹`,lineVerticalDashed9:`╻`,lineVerticalDashed10:`╽`,lineVerticalDashed11:`╿`,lineDownLeft:`┐`,lineDownLeftArc:`╮`,lineDownBoldLeftBold:`┓`,lineDownBoldLeft:`┒`,lineDownLeftBold:`┑`,lineDownDoubleLeftDouble:`╗`,lineDownDoubleLeft:`╖`,lineDownLeftDouble:`╕`,lineDownRight:`┌`,lineDownRightArc:`╭`,lineDownBoldRightBold:`┏`,lineDownBoldRight:`┎`,lineDownRightBold:`┍`,lineDownDoubleRightDouble:`╔`,lineDownDoubleRight:`╓`,lineDownRightDouble:`╒`,lineUpLeft:`┘`,lineUpLeftArc:`╯`,lineUpBoldLeftBold:`┛`,lineUpBoldLeft:`┚`,lineUpLeftBold:`┙`,lineUpDoubleLeftDouble:`╝`,lineUpDoubleLeft:`╜`,lineUpLeftDouble:`╛`,lineUpRight:`└`,lineUpRightArc:`╰`,lineUpBoldRightBold:`┗`,lineUpBoldRight:`┖`,lineUpRightBold:`┕`,lineUpDoubleRightDouble:`╚`,lineUpDoubleRight:`╙`,lineUpRightDouble:`╘`,lineUpDownLeft:`┤`,lineUpBoldDownBoldLeftBold:`┫`,lineUpBoldDownBoldLeft:`┨`,lineUpDownLeftBold:`┥`,lineUpBoldDownLeftBold:`┩`,lineUpDownBoldLeftBold:`┪`,lineUpDownBoldLeft:`┧`,lineUpBoldDownLeft:`┦`,lineUpDoubleDownDoubleLeftDouble:`╣`,lineUpDoubleDownDoubleLeft:`╢`,lineUpDownLeftDouble:`╡`,lineUpDownRight:`├`,lineUpBoldDownBoldRightBold:`┣`,lineUpBoldDownBoldRight:`┠`,lineUpDownRightBold:`┝`,lineUpBoldDownRightBold:`┡`,lineUpDownBoldRightBold:`┢`,lineUpDownBoldRight:`┟`,lineUpBoldDownRight:`┞`,lineUpDoubleDownDoubleRightDouble:`╠`,lineUpDoubleDownDoubleRight:`╟`,lineUpDownRightDouble:`╞`,lineDownLeftRight:`┬`,lineDownBoldLeftBoldRightBold:`┳`,lineDownLeftBoldRightBold:`┯`,lineDownBoldLeftRight:`┰`,lineDownBoldLeftBoldRight:`┱`,lineDownBoldLeftRightBold:`┲`,lineDownLeftRightBold:`┮`,lineDownLeftBoldRight:`┭`,lineDownDoubleLeftDoubleRightDouble:`╦`,lineDownDoubleLeftRight:`╥`,lineDownLeftDoubleRightDouble:`╤`,lineUpLeftRight:`┴`,lineUpBoldLeftBoldRightBold:`┻`,lineUpLeftBoldRightBold:`┷`,lineUpBoldLeftRight:`┸`,lineUpBoldLeftBoldRight:`┹`,lineUpBoldLeftRightBold:`┺`,lineUpLeftRightBold:`┶`,lineUpLeftBoldRight:`┵`,lineUpDoubleLeftDoubleRightDouble:`╩`,lineUpDoubleLeftRight:`╨`,lineUpLeftDoubleRightDouble:`╧`,lineUpDownLeftRight:`┼`,lineUpBoldDownBoldLeftBoldRightBold:`╋`,lineUpDownBoldLeftBoldRightBold:`╈`,lineUpBoldDownLeftBoldRightBold:`╇`,lineUpBoldDownBoldLeftRightBold:`╊`,lineUpBoldDownBoldLeftBoldRight:`╉`,lineUpBoldDownLeftRight:`╀`,lineUpDownBoldLeftRight:`╁`,lineUpDownLeftBoldRight:`┽`,lineUpDownLeftRightBold:`┾`,lineUpBoldDownBoldLeftRight:`╂`,lineUpDownLeftBoldRightBold:`┿`,lineUpBoldDownLeftBoldRight:`╃`,lineUpBoldDownLeftRightBold:`╄`,lineUpDownBoldLeftBoldRight:`╅`,lineUpDownBoldLeftRightBold:`╆`,lineUpDoubleDownDoubleLeftDoubleRightDouble:`╬`,lineUpDoubleDownDoubleLeftRight:`╫`,lineUpDownLeftDoubleRightDouble:`╪`,lineCross:`╳`,lineBackslash:`╲`,lineSlash:`╱`},db={tick:`✔`,info:`ℹ`,warning:`⚠`,cross:`✘`,squareSmall:`◻`,squareSmallFilled:`◼`,circle:`◯`,circleFilled:`◉`,circleDotted:`◌`,circleDouble:`◎`,circleCircle:`ⓞ`,circleCross:`ⓧ`,circlePipe:`Ⓘ`,radioOn:`◉`,radioOff:`◯`,checkboxOn:`☒`,checkboxOff:`☐`,checkboxCircleOn:`ⓧ`,checkboxCircleOff:`Ⓘ`,pointer:`❯`,triangleUpOutline:`△`,triangleLeft:`◀`,triangleRight:`▶`,lozenge:`◆`,lozengeOutline:`◇`,hamburger:`☰`,smiley:`㋡`,mustache:`෴`,star:`★`,play:`▶`,nodejs:`⬢`,oneSeventh:`⅐`,oneNinth:`⅑`,oneTenth:`⅒`},fb={tick:`√`,info:`i`,warning:`‼`,cross:`×`,squareSmall:`□`,squareSmallFilled:`■`,circle:`( )`,circleFilled:`(*)`,circleDotted:`( )`,circleDouble:`( )`,circleCircle:`(○)`,circleCross:`(×)`,circlePipe:`(│)`,radioOn:`(*)`,radioOff:`( )`,checkboxOn:`[×]`,checkboxOff:`[ ]`,checkboxCircleOn:`(×)`,checkboxCircleOff:`( )`,pointer:`>`,triangleUpOutline:`∆`,triangleLeft:`◄`,triangleRight:`►`,lozenge:`♦`,lozengeOutline:`◊`,hamburger:`≡`,smiley:`☺`,mustache:`┌─┐`,star:`✶`,play:`►`,nodejs:`♦`,oneSeventh:`1/7`,oneNinth:`1/9`,oneTenth:`1/10`},pb={...ub,...db},mb={...ub,...fb};var hb=lb()?pb:mb;Object.entries(db);const gb={prefix:{idle:l(`blue`,`?`),done:l(`green`,hb.tick)},spinner:{interval:80,frames:[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`].map(e=>l(`yellow`,e))},style:{answer:e=>l(`cyan`,e),message:e=>l(`bold`,e),error:e=>l(`red`,`> ${e}`),defaultAnswer:e=>l(`dim`,`(${e})`),help:e=>l(`dim`,e),highlight:e=>l(`cyan`,e),key:e=>l(`cyan`,l(`bold`,`<${e}>`))}};function _b(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function vb(...e){let t={};for(let n of e)for(let[e,r]of Object.entries(n)){let n=t[e];t[e]=_b(n)&&_b(r)?vb(n,r):r}return t}function yb(...e){return vb(gb,...e.filter(e=>e!=null))}function bb({status:e=`idle`,theme:t}){let[n,r]=sb(!1),[i,a]=sb(0),{prefix:o,spinner:s}=yb(t);return cb(()=>{if(e===`loading`){let e,t=-1,n=setTimeout(()=>{r(!0),e=setInterval(()=>{t+=1,a(t%s.frames.length)},s.interval)},300);return()=>{clearTimeout(n),clearInterval(e)}}else r(!1)},[e]),n?s.frames[i]:typeof o==`string`?o:o[e===`loading`?`idle`:e]??o.idle}function xb(e,t){return ib(n=>{let r=n.get();if(!r||r.dependencies.length!==t.length||r.dependencies.some((e,n)=>e!==t[n])){let r=e();return n.set({value:r,dependencies:t}),r}return r.value})}function Sb(e){return sb({current:e})[0]}function Cb(e){let t=Sb(e);t.current=e,cb(e=>{let n=!1,r=rb((r,i)=>{n||t.current(i,e)});return e.input.on(`keypress`,r),()=>{n=!0,e.input.removeListener(`keypress`,r)}},[])}var wb=_(((e,t)=>{t.exports=r;function n(e){let t={defaultWidth:0,output:process.stdout,tty:x(`tty`)};return e?(Object.keys(t).forEach(function(n){e[n]||(e[n]=t[n])}),e):t}function r(e){let t=n(e);if(t.output.getWindowSize)return t.output.getWindowSize()[0]||t.defaultWidth;if(t.tty.getWindowSize)return t.tty.getWindowSize()[1]||t.defaultWidth;if(t.output.columns)return t.output.columns;if(process.env.CLI_WIDTH){let e=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(e)&&e!==0)return e}return t.defaultWidth}}));const Tb=(()=>{let e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let n=0;for(e.lastIndex=0;e.test(t);)n+=1;return t.length-n}})(),Eb=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,Db=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,Ob=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,kb=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,Ab=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy,jb=/\t{1,1000}/y,Mb=/[\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?))*/uy,Nb=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,Pb=/\p{M}+/gu,Fb={limit:1/0,ellipsis:``},Ib=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?Ib(i,Fb,n).width:0),o=n.controlWidth??0,s=n.tabWidth??8,c=n.emojiWidth??2,l=n.regularWidth??1,u=n.wideWidth??2,d=[[Nb,l],[Ob,0],[kb,o],[jb,s],[Mb,c],[Ab,u]],f=0,p=0,m=e.length,h=0,g=!1,_=m,v=Math.max(0,r-a),y=0,b=0,x=0,S=0;outer:for(;;){if(b>y||p>=m&&p>f){let t=e.slice(y,b)||e.slice(f,p);h=0;for(let e of t.replaceAll(Pb,``)){let t=e.codePointAt(0)||0;if(S=Eb(t)?2:Db(t)?u:l,x+S>v&&(_=Math.min(_,Math.max(y,f)+h)),x+S>r){g=!0;break outer}h+=e.length,x+=S}y=b=0}if(p>=m)break outer;for(let t=0,n=d.length;t<n;t++){let[n,i]=d[t];if(n.lastIndex=p,n.test(e)){if(h=n===Ab?Tb(e.slice(p,n.lastIndex)):n===Mb?1:n.lastIndex-p,S=h*i,x+S>v&&(_=Math.min(_,p+Math.floor((v-x)/i))),x+S>r){g=!0;break outer}x+=S,y=f,b=p,p=f=n.lastIndex;continue outer}}p+=1}return{width:g?v:x,index:g?_:m,truncated:g,ellipsed:g&&r>=a}};var Lb=Ib;const Rb={limit:1/0,ellipsis:``,ellipsisWidth:0};var zb=(e,t={})=>Lb(e,Rb,t).width;const Bb=`]8;;`,Vb=RegExp(`(?:\\[(?<code>\\d+)m|\\${Bb}(?<uri>.*))`,`y`),Hb=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},Ub=e=>`[${e}m`,Wb=e=>`${Bb}${e}`,Gb=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:zb(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=zb(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===`›`)&&(i=!0,a=t.startsWith(Bb,u+1)),i?a?o===`\x07`&&(i=!1,a=!1):o===`m`&&(i=!1):(s+=d,s===n&&!l.done&&(e.push(``),s=0)),c=l,l=r.next(),u+=o.length}o=e.at(-1),!s&&o!==void 0&&o.length&&e.length>1&&(e[e.length-2]+=e.pop())},Kb=e=>{let t=e.split(` `),n=t.length;for(;n&&!zb(t[n-1]);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},qb=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=e.split(` `),s=[``],c=0;for(let e=0;e<o.length;e++){let r=o[e];if(n.trim!==!1){let e=s.at(-1)??``,t=e.trimStart();e.length!==t.length&&(s[s.length-1]=t,c=zb(t))}e!==0&&(c>=t&&(n.wordWrap===!1||n.trim===!1)&&(s.push(``),c=0),(c||n.trim===!1)&&(s[s.length-1]+=` `,c++));let i=zb(r);if(n.hard&&i>t){let e=t-c,n=1+Math.floor((i-e-1)/t);Math.floor((i-1)/t)<n&&s.push(``),Gb(s,r,t),c=zb(s.at(-1)??``);continue}if(c+i>t&&c&&i){if(n.wordWrap===!1&&c<t){Gb(s,r,t),c=zb(s.at(-1)??``);continue}s.push(``),c=0}if(c+i>t&&n.wordWrap===!1){Gb(s,r,t),c=zb(s.at(-1)??``);continue}s[s.length-1]+=r,c+=i}n.trim!==!1&&(s=s.map(e=>Kb(e)));let l=s.join(`
203
203
  `),u=!1;for(let e=0;e<l.length;e++){let t=l[e];if(r+=t,u)u=!1;else if(u=t>=`\ud800`&&t<=`\udbff`,u)continue;if(t===`\x1B`||t===`›`){Vb.lastIndex=e+1;let t=Vb.exec(l)?.groups;if(t?.code!==void 0){let e=Number.parseFloat(t.code);i=e===39?void 0:e}else t?.uri!==void 0&&(a=t.uri.length===0?void 0:t.uri)}if(l[e+1]===`
204
204
  `){a&&(r+=Wb(``));let e=i?Hb(i):void 0;i&&e&&(r+=Ub(e))}else t===`
205
205
  `&&(i&&Hb(i)&&(r+=Ub(i)),a&&(r+=Wb(a)))}return r},Jb=/\r?\n/;function Yb(e,t,n){return String(e).normalize().split(Jb).map(e=>qb(e,t,n)).join(`
@@ -215,4 +215,4 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
215
215
  `+t:``),o=Math.floor(n.length/i)-this.cursorPos.rows+(t?Sx(t):0);o>0&&(a+=_x(o)),a+=yx(this.cursorPos.cols),this.write(vx(this.extraLinesUnderPrompt)+xx(this.height)+a),this.extraLinesUnderPrompt=o,this.height=Sx(a)}checkCursorPos(){let e=this.rl.getCursorPos();e.cols!==this.cursorPos.cols&&(this.write(yx(e.cols)),this.cursorPos=e)}done({clearContent:e}){this.rl.setPrompt(``);let t=vx(this.extraLinesUnderPrompt);t+=e?xx(this.height):`
216
216
  `,t+=`\x1B[?25h`,this.write(t),this.rl.close()}},Tx=class extends Promise{static withResolver(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}},Ex=b(tx(),1);const Dx=globalThis.setImmediate;function Ox(){let e=Error.prepareStackTrace,t=[];try{Error.prepareStackTrace=(e,n)=>{let r=n.slice(1);return t=r,r},Error().stack}catch{return t}return Error.prepareStackTrace=e,t}function kx(e){let t=Ox();return(n,r={})=>{let{input:i=process.stdin,signal:a}=r,o=new Set,c=new Ex.default;c.pipe(r.output??process.stdout),c.mute();let l=u.createInterface({terminal:!0,input:i,output:c}),d=new wx(l),{promise:f,resolve:p,reject:m}=Tx.withResolver(),h=()=>m(new Jy);if(a){let e=()=>m(new qy({cause:a.reason}));if(a.aborted)return e(),Object.assign(f,{cancel:h});a.addEventListener(`abort`,e),o.add(()=>a.removeEventListener(`abort`,e))}o.add(px((e,t)=>{m(new Yy(`User force closed the prompt with ${e} ${t}`))}));let g=()=>m(new Yy(`User force closed the prompt with SIGINT`));return l.on(`SIGINT`,g),o.add(()=>l.removeListener(`SIGINT`,g)),eb(l,a=>{let u=s.bind(()=>ob.clearAll());l.on(`close`,u),o.add(()=>l.removeListener(`close`,u));let g=()=>{let r=()=>d.checkCursorPos();l.input.on(`keypress`,r),o.add(()=>l.input.removeListener(`keypress`,r)),a(()=>{try{let r=e(n,e=>{setImmediate(()=>p(e))});if(r===void 0){let e=t[1]?.getFileName();throw Error(`Prompt functions must return a string.\n at ${e}`)}let[i,a]=typeof r==`string`?[r]:r;d.render(i,a),ob.run()}catch(e){m(e)}})};return`readableFlowing`in i?Dx(g):g(),Object.assign(f.then(e=>(ob.clearAll(),e),e=>{throw ob.clearAll(),e}).finally(()=>{o.forEach(e=>e()),d.done({clearContent:!!r.clearPromptOnDone}),c.end()}).then(()=>f),{cancel:h})})}}var Ax=class{separator=l(`dim`,Array.from({length:15}).join(hb.line));type=`separator`;constructor(e){e&&(this.separator=e)}static isSeparator(e){return!!(e&&typeof e==`object`&&`type`in e&&e.type===`separator`)}};const jx={icon:{checked:l(`green`,hb.circleFilled),unchecked:hb.circle,cursor:hb.pointer,disabledChecked:l(`green`,hb.circleDouble),disabledUnchecked:`-`},style:{disabled:e=>l(`dim`,e),renderSelectedChoices:e=>e.map(e=>e.short).join(`, `),description:e=>l(`cyan`,e),keysHelpTip:e=>e.map(([e,t])=>`${l(`bold`,e)} ${l(`dim`,t)}`).join(l(`dim`,` • `))},i18n:{disabledError:`This option is disabled and cannot be toggled.`},keybindings:[]};function Mx(e){return!Ax.isSeparator(e)&&!e.disabled}function Nx(e){return!Ax.isSeparator(e)}function Px(e){return!Ax.isSeparator(e)&&e.checked}function Fx(e){return Mx(e)?{...e,checked:!e.checked}:e}function Ix(e){return function(t){return Mx(t)?{...t,checked:e}:t}}function Lx(e){return e.map(e=>{if(Ax.isSeparator(e))return e;if(typeof e==`string`)return{value:e,name:e,short:e,checkedName:e,disabled:!1,checked:!1};let t=e.name??String(e.value),n={value:e.value,name:t,short:e.short??t,checkedName:e.checkedName??t,disabled:e.disabled??!1,checked:e.checked??!1};return e.description&&(n.description=e.description),n})}var Rx=kx((e,t)=>{let{pageSize:n=7,loop:r=!0,required:i,validate:a=()=>!0}=e,o={all:`a`,invert:`i`,...e.shortcuts},s=yb(jx,e.theme),{keybindings:c}=s,[l,u]=sb(`idle`),d=bb({status:l,theme:s}),[f,p]=sb(Lx(e.choices)),m=xb(()=>{let e=f.findIndex(Nx),t=f.findLastIndex(Nx);if(e===-1)throw new Zy(`[checkbox prompt] No selectable choices. All choices are disabled.`);return{first:e,last:t}},[f]),[h,g]=sb(m.first),[_,v]=sb();Cb(async e=>{if(Ky(e)){let e=f.filter(Px),n=await a([...e]);i&&!e.length?v(`At least one choice must be selected`):n===!0?(u(`done`),t(e.map(e=>e.value))):v(n||`You must select a valid value`)}else if(By(e,c)||Vy(e,c)){if(_&&v(void 0),r||By(e,c)&&h!==m.first||Vy(e,c)&&h!==m.last){let t=By(e,c)?-1:1,n=h;do n=(n+t+f.length)%f.length;while(!Nx(f[n]));g(n)}}else if(Hy(e)){let e=f[h];e&&!Ax.isSeparator(e)&&(e.disabled?v(s.i18n.disabledError):(v(void 0),p(f.map((e,t)=>t===h?Fx(e):e))))}else if(e.name===o.all){let e=f.some(e=>Mx(e)&&!e.checked);p(f.map(Ix(e)))}else if(e.name===o.invert)p(f.map(Fx));else if(Gy(e)){let t=Number(e.name)-1,n=-1,r=f.findIndex(e=>Ax.isSeparator(e)?!1:(n++,n===t)),i=f[r];i&&Mx(i)&&(g(r),p(f.map((e,t)=>t===r?Fx(e):e)))}});let y=s.style.message(e.message,l),b,x=ex({items:f,active:h,renderItem({item:e,isActive:t}){if(Ax.isSeparator(e))return` ${e.separator}`;let n=t?s.icon.cursor:` `;if(e.disabled){let t=typeof e.disabled==`string`?e.disabled:`(disabled)`,r=e.checked?s.icon.disabledChecked:s.icon.disabledUnchecked;return s.style.disabled(`${n}${r} ${e.name} ${t}`)}t&&(b=e.description);let r=e.checked?s.icon.checked:s.icon.unchecked,i=e.checked?e.checkedName:e.name;return(t?s.style.highlight:e=>e)(`${n}${r} ${i}`)},pageSize:n,loop:r});if(l===`done`){let e=f.filter(Px);return[d,y,s.style.answer(s.style.renderSelectedChoices(e,f))].filter(Boolean).join(` `)}let S=[[`↑↓`,`navigate`],[`space`,`select`]];o.all&&S.push([o.all,`all`]),o.invert&&S.push([o.invert,`invert`]),S.push([`⏎`,`submit`]);let C=s.style.keysHelpTip(S);return`${[[d,y].filter(Boolean).join(` `),x,` `,b?s.style.description(b):``,_?s.style.error(_):``,C].filter(Boolean).join(`
217
217
  `).trimEnd()}${gx}`});function zx(e,t){let n=t!==!1;return/^(y|yes)/i.test(e)?n=!0:/^(n|no)/i.test(e)&&(n=!1),n}function Bx(e){return e?`Yes`:`No`}var Vx=kx((e,t)=>{let{transformer:n=Bx}=e,[r,i]=sb(`idle`),[a,o]=sb(``),s=yb(e.theme),c=bb({status:r,theme:s});Cb((s,c)=>{if(r===`idle`)if(Ky(s)){let r=zx(a,e.default);o(n(r)),i(`done`),t(r)}else if(Wy(s)){let t=Bx(!zx(a,e.default));c.clearLine(0),c.write(t),o(t)}else o(c.line)});let l=a,u=``;return r===`done`?l=s.style.answer(a):u=` ${s.style.defaultAnswer(e.default===!1?`y/N`:`Y/n`)}`,`${c} ${s.style.message(e.message,r)}${u} ${l}`});const Hx={validationFailureMode:`keep`};var Ux=kx((e,t)=>{let{prefill:n=`tab`}=e,r=yb(Hx,e.theme),[i,a]=sb(`idle`),[o,s]=sb(String(e.default??``)),[c,l]=sb(),[u,d]=sb(``),f=bb({status:i,theme:r});async function p(t){let{required:n,pattern:r,patternError:i=`Invalid input`}=e;return n&&!t?`You must provide a value`:r&&!r.test(t)?i:typeof e.validate==`function`?await e.validate(t)||`You must provide a valid value`:!0}Cb(async(e,n)=>{if(i===`idle`)if(Ky(e)){let e=u||o;a(`loading`);let i=await p(e);i===!0?(d(e),a(`done`),t(e)):(r.validationFailureMode===`clear`?d(``):n.write(u),l(i),a(`idle`))}else Uy(e)&&!u?s(``):Wy(e)&&!u?(s(``),n.clearLine(0),n.write(o),d(o)):(d(n.line),l(void 0))}),cb(e=>{n===`editable`&&o&&(e.write(o),d(o))},[]);let m=r.style.message(e.message,i),h=u;typeof e.transformer==`function`?h=e.transformer(u,{isFinal:i===`done`}):i===`done`&&(h=r.style.answer(u));let g;o&&i!==`done`&&!u&&(g=r.style.defaultAnswer(o));let _=``;return c&&(_=r.style.error(c)),[[f,m,g,h].filter(e=>e!==void 0).join(` `),_]});const Wx={icon:{cursor:hb.pointer},style:{disabled:e=>l(`dim`,e),description:e=>l(`cyan`,e),keysHelpTip:e=>e.map(([e,t])=>`${l(`bold`,e)} ${l(`dim`,t)}`).join(l(`dim`,` • `))},i18n:{disabledError:`This option is disabled and cannot be selected.`},indexMode:`hidden`,keybindings:[]};function Gx(e){return!Ax.isSeparator(e)&&!e.disabled}function Kx(e){return!Ax.isSeparator(e)}function qx(e){return e.map(e=>{if(Ax.isSeparator(e))return e;if(typeof e!=`object`||!e||!(`value`in e)){let t=String(e);return{value:e,name:t,short:t,disabled:!1}}let t=e.name??String(e.value),n={value:e.value,name:t,short:e.short??t,disabled:e.disabled??!1};return e.description&&(n.description=e.description),n})}var Jx=kx((e,t)=>{let{loop:n=!0,pageSize:r=7}=e,i=yb(Wx,e.theme),{keybindings:a}=i,[o,s]=sb(`idle`),c=bb({status:o,theme:i}),l=Sb(),u=!a.includes(`vim`),d=xb(()=>qx(e.choices),[e.choices]),f=xb(()=>{let e=d.findIndex(Kx),t=d.findLastIndex(Kx);if(e===-1)throw new Zy(`[select prompt] No selectable choices. All choices are disabled.`);return{first:e,last:t}},[d]),p=xb(()=>`default`in e?d.findIndex(t=>Gx(t)&&t.value===e.default):-1,[e.default,d]),[m,h]=sb(p===-1?f.first:p),g=d[m],[_,v]=sb();Cb((e,r)=>{if(clearTimeout(l.current),_&&v(void 0),Ky(e))g.disabled?v(i.i18n.disabledError):(s(`done`),t(g.value));else if(By(e,a)||Vy(e,a)){if(r.clearLine(0),n||By(e,a)&&m!==f.first||Vy(e,a)&&m!==f.last){let t=By(e,a)?-1:1,n=m;do n=(n+t+d.length)%d.length;while(!Kx(d[n]));h(n)}}else if(Gy(e)&&!Number.isNaN(Number(r.line))){let e=Number(r.line)-1,t=-1,n=d.findIndex(n=>Ax.isSeparator(n)?!1:(t++,t===e)),i=d[n];i!=null&&Gx(i)&&h(n),l.current=setTimeout(()=>{r.clearLine(0)},700)}else if(Uy(e))r.clearLine(0);else if(u){let e=r.line.toLowerCase(),t=d.findIndex(t=>Ax.isSeparator(t)||!Gx(t)?!1:t.name.toLowerCase().startsWith(e));t!==-1&&h(t),l.current=setTimeout(()=>{r.clearLine(0)},700)}}),cb(()=>()=>{clearTimeout(l.current)},[]);let y=i.style.message(e.message,o),b=i.style.keysHelpTip([[`↑↓`,`navigate`],[`⏎`,`select`]]),x=0,S=ex({items:d,active:m,renderItem({item:e,isActive:t,index:n}){if(Ax.isSeparator(e))return x++,` ${e.separator}`;let r=t?i.icon.cursor:` `,a=i.indexMode===`number`?`${n+1-x}. `:``;if(e.disabled){let n=typeof e.disabled==`string`?e.disabled:`(disabled)`,r=t?i.icon.cursor:`-`;return i.style.disabled(`${r} ${a}${e.name} ${n}`)}return(t?i.style.highlight:e=>e)(`${r} ${a}${e.name}`)},pageSize:r,loop:n});if(o===`done`)return[c,y,i.style.answer(g.short)].filter(Boolean).join(` `);let{description:C}=g;return`${[[c,y].filter(Boolean).join(` `),S,` `,C?i.style.description(C):``,_?i.style.error(_):``,b].filter(Boolean).join(`
218
- `).trimEnd()}${gx}`}),Yx=class{static async confirm(e){return await Vx({message:e.message,default:e.default})}static async getText(e){let{message:t,schema:n,default:r}=e,i;if(n&&r!==void 0){let e=n.safeParse(r);e.success&&(i=e.data)}else !n&&r!==void 0&&(i=r);if(n&&n instanceof wf)return await Jx({message:t,choices:n.options.map(e=>({value:e})),default:i});let a=await Ux({message:t,default:i,validate:e=>{if(!n)return!0;let t=e;if(n instanceof xd){if(e.trim()===``)return`Input cannot be empty`;let n=Number(e);if(Number.isNaN(n))return`Please enter a valid number`;t=n}let r=n.safeParse(t);return r.success?!0:r.error.issues[0]?.message??`Invalid input`}});if(!n)return a;let o=n instanceof xd?Number(a):a;return n.parse(o)}static async choose(e){let{message:t,options:n,mode:r=`single`,default:i,includeAllOption:a=!1,required:o=!1}=e,s=`__all__`,c=r===`single`?[i]:[...i||[]],l=[...r===`multiple`&&a?[{name:`All`,value:s,checked:c.includes(s)}]:[],...n.map(e=>({name:e,value:e,checked:c.includes(e)}))];if(r===`multiple`){let e=await Rx({message:t,choices:l,validate:e=>o&&e.length===0?`You must select at least one option.`:!0});return a&&e.includes(s)?n:e}return await Jx({message:t,choices:n.map(e=>({name:e,value:e})),default:typeof i==`string`?i:void 0})}},Xx=class e{static command=new uv(`init`).argument(`[projectName]`).option(`-d, --dir <path>`,`workspace directory`).action(e.run.bind(e));static async run(e,t){let n=await Fy.getPackageList(),r=n.filter(e=>e.type===`apps`&&e.packageJson?.startx?.mode!==`silent`),i=await this.getPrefs({projectName:e,options:t,projects:r}),a=n.filter(e=>e.type!==`apps`),o=await this.getConfigPrefs({selectedApps:i.selectedApps,packages:a}),s=await this.getPackagesPrefs({selectedPackages:o.selectedConfigs,packages:a,tags:o.gTags}),c=[...s.gTags,`runnable`];await this.installWorkspace({name:i.projectName,tags:[...c,`runnable`],dir:i.directory});let l=[...s.selectedPackages,...i.selectedApps];await Promise.all(l.map(async e=>{let t={},n=new Set(s.gTags);e.packageJson?.startx?.mode===`standalone`&&n.add(`runnable`),e.type===`apps`&&(n.add(`runnable`),s.selectedPackages.filter(t=>t.type!==`packages`||t.packageJson?.startx?.mode===`standalone`?!1:t.packageJson?.startx?.iTags?.every(t=>e.packageJson?.startx?.gTags?.includes(t))).forEach(e=>{let n=e.packageJson?.name||e.name;t[n]=`workspace:^`})),await this.installPackage({pkg:e,directory:i.directory,tags:Array.from(n),dependencies:t})}))}static async getPrefs(e){let n=await Yx.getText({message:`Project name`,name:`projectName`,default:e.projectName,schema:Bp.string().min(1,`Package name is required`).max(214,`Package name too long`).regex(/^(?:@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/,`Invalid package name`)});if(e.projects.length===0)throw Error(`No apps found to install.`);let r=Fy.getDirectory(),i=e.options.dir?t.resolve(r.workspace,e.options.dir):t.join(r.workspace,n),a=await Yx.choose({message:`Select apps to install`,options:e.projects.map(e=>e.name),includeAllOption:!0,mode:`multiple`,required:!0});return{projectName:n,directory:{workspace:i,template:r.template},selectedApps:e.projects.filter(e=>a.includes(e.name))}}static async getConfigPrefs(e){let t=new Set([`common`]),n=new Map;this.getGlobalTags({pkgs:e.selectedApps}).forEach(e=>t.add(e)),this.getPackageDeps({allPkgs:e.packages,pkgs:e.selectedApps}).forEach(e=>n.set(e.name,e));let r=e.packages.filter(e=>e.type!==`configs`||e.packageJson?.startx?.mode===`silent`||n.has(e.name)?!1:e.packageJson?.startx?.iTags?.every(e=>t.has(e))??!0);if(r.length>0){let e=await Yx.choose({message:`Select configs to install`,options:r.map(e=>e.name),includeAllOption:!0,mode:`multiple`,required:!1});r.filter(t=>e.includes(t.name)).forEach(e=>n.set(e.name,e))}return t.has(`node`)&&(await Yx.choose({message:`Select formatter`,options:[`prettier + biome`,`prettier`],mode:`single`,default:`prettier`,required:!0})===`prettier`||t.add(`biome`),t.add(`prettier`)),this.getPackageDeps({allPkgs:e.packages,pkgs:Array.from(n.values())}).forEach(e=>n.set(e.name,e)),this.getGlobalTags({pkgs:Array.from(n.values())}).forEach(e=>t.add(e)),{gTags:Array.from(t),selectedConfigs:Array.from(n.values())}}static async getPackagesPrefs(e){let t=new Set(e.tags),n=new Map(e.selectedPackages.map(e=>[e.name,e])),r=e.packages.filter(e=>e.type!==`packages`||e.packageJson?.startx?.mode===`silent`||n.has(e.name)?!1:e.packageJson?.startx?.iTags?.every(e=>t.has(e))??!1);if(r.length>0){let e=await Yx.choose({message:`Select packages to install`,options:r.map(e=>e.name),includeAllOption:!0,mode:`multiple`,required:!1});r.filter(t=>e.includes(t.name)).forEach(e=>n.set(e.name,e))}return this.getPackageDeps({allPkgs:e.packages,pkgs:Array.from(n.values())}).forEach(e=>n.set(e.name,e)),this.getGlobalTags({pkgs:Array.from(n.values())}).forEach(e=>t.add(e)),{gTags:Array.from(t),selectedPackages:Array.from(n.values())}}static async installPackage(e){if(!e.pkg.packageJson)throw Error(`Missing package.json for ${e.pkg.name}`);let n=new Set([...e.tags,...e.pkg.packageJson.startx?.tags||[]]),r=e.pkg.packageJson.startx?.ignore||[];r.includes(`eslint-config`)&&n.delete(`eslint`),r.includes(`vitest-config`)&&n.delete(`vitest`);let{packageJson:i,isWorkspace:a}=zy.handlePackageJson({app:e.pkg.packageJson,tags:Array.from(n),name:e.packageName||e.pkg.packageJson.name||e.pkg.name,dependencies:e.dependencies});if(a)throw Error(`Cannot install workspace as a package: ${e.pkg.name}`);let o=t.join(e.directory.workspace,e.pkg.relativePath),s=t.join(e.pkg.path);await My.writeJSONFile({dir:o,file:`package`,content:i}),await this.copyValidatedFilesFromFolder(s,o,n),await My.copyDirectory({from:t.join(s,`src`),to:t.join(o,`src`),exclude:n.has(`vitest`)?void 0:/\.test\.tsx?$/}),X_.info(`Successfully installed ${e.pkg.name}`)}static async installWorkspace(e){let t=await Fy.parsePackageJson({dir:e.dir.template}),n=await Fy.parsePackageJson({dir:e.dir.template,file:`startx`});if(!t)throw Error(`Failed to parse root package.json`);t.dependencies={...t.dependencies,...n?.dependencies||{}},t.devDependencies={...t.devDependencies,...n?.devDependencies||{}};let{packageJson:r}=zy.handlePackageJson({app:t,tags:[`root`,...e.tags],name:e.name});await My.writeJSONFile({dir:e.dir.workspace,file:`package`,content:r}),await this.copyValidatedFilesFromFolder(e.dir.template,e.dir.workspace,new Set([`root`,...e.tags]))}static getPackageDeps(e){let t=new Map(e.pkgs.map(e=>[e.name,e]));return Array.from(t.values()).forEach(n=>{[...n.packageJson?.startx?.requiredDeps||[],...n.packageJson?.startx?.requiredDevDeps||[]].forEach(n=>{let r=e.allPkgs.find(e=>e.packageJson?.name===n);r&&t.set(r.name,r)})}),e.pkgs.forEach(e=>t.delete(e.name)),Array.from(t.values())}static getGlobalTags(e){let t=new Set(e.gTags||[]);return e.pkgs.forEach(e=>{e.packageJson?.startx?.gTags?.forEach(e=>t.add(e))}),Array.from(t)}static async copyValidatedFilesFromFolder(e,n,r){let i=await My.listFiles({dir:e}).catch(()=>[]);for(let a of i){let i=Ny[a];if(i&&!i.tags.every(e=>r.has(e)))continue;let o=a===`_gitignore`?`.gitignore`:a;try{await My.copyFile({from:t.join(e,a),to:t.join(n,o)})}catch(e){X_.error(`Failed to copy file ${a}:`,e)}}}},Zx=`1.0.8`;const Qx=new uv;Qx.name(`startx`).description(`StartX CLI - Your all in one monorepo startup tool.`).version(Zx),Qx.command(`ping`).action(()=>{X_.info(`pong`)}),Qx.addCommand(Xx.command),Qx.parse(process.argv);export{};
218
+ `).trimEnd()}${gx}`}),Yx=class{static async confirm(e){return await Vx({message:e.message,default:e.default})}static async getText(e){let{message:t,schema:n,default:r}=e,i;if(n&&r!==void 0){let e=n.safeParse(r);e.success&&(i=e.data)}else !n&&r!==void 0&&(i=r);if(n&&n instanceof wf)return await Jx({message:t,choices:n.options.map(e=>({value:e})),default:i});let a=await Ux({message:t,default:i,validate:e=>{if(!n)return!0;let t=e;if(n instanceof xd){if(e.trim()===``)return`Input cannot be empty`;let n=Number(e);if(Number.isNaN(n))return`Please enter a valid number`;t=n}let r=n.safeParse(t);return r.success?!0:r.error.issues[0]?.message??`Invalid input`}});if(!n)return a;let o=n instanceof xd?Number(a):a;return n.parse(o)}static async choose(e){let{message:t,options:n,mode:r=`single`,default:i,includeAllOption:a=!1,required:o=!1}=e,s=`__all__`,c=r===`single`?[i]:[...i||[]],l=[...r===`multiple`&&a?[{name:`All`,value:s,checked:c.includes(s)}]:[],...n.map(e=>({name:e,value:e,checked:c.includes(e)}))];if(r===`multiple`){let e=await Rx({message:t,choices:l,validate:e=>o&&e.length===0?`You must select at least one option.`:!0});return a&&e.includes(s)?n:e}return await Jx({message:t,choices:n.map(e=>({name:e,value:e})),default:typeof i==`string`?i:void 0})}},Xx=class e{static command=new uv(`init`).argument(`[projectName]`).option(`-d, --dir <path>`,`workspace directory`).action(e.run.bind(e));static async run(e,t){let n=await Fy.getPackageList(),r=n.filter(e=>e.type===`apps`&&e.packageJson?.startx?.mode!==`silent`),i=await this.getPrefs({projectName:e,options:t,projects:r}),a=n.filter(e=>e.type!==`apps`),o=await this.getConfigPrefs({selectedApps:i.selectedApps,packages:a}),s=await this.getPackagesPrefs({selectedPackages:o.selectedConfigs,packages:a,tags:o.gTags}),c=[...s.gTags,`runnable`];await this.installWorkspace({name:i.projectName,tags:[...c,`runnable`],dir:i.directory});let l=[...s.selectedPackages,...i.selectedApps];await Promise.all(l.map(async e=>{let t={},n=new Set(s.gTags);e.packageJson?.startx?.mode===`standalone`&&n.add(`runnable`),e.type===`apps`&&(n.add(`runnable`),s.selectedPackages.filter(t=>t.type!==`packages`||t.packageJson?.startx?.mode===`standalone`?!1:t.packageJson?.startx?.iTags?.every(t=>e.packageJson?.startx?.gTags?.includes(t))).forEach(e=>{let n=e.packageJson?.name||e.name;t[n]=`workspace:^`})),await this.installPackage({pkg:e,directory:i.directory,tags:Array.from(n),dependencies:t})}))}static async getPrefs(e){let n=await Yx.getText({message:`Project name`,name:`projectName`,default:e.projectName,schema:Bp.string().min(1,`Package name is required`).max(214,`Package name too long`).regex(/^(?:@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/,`Invalid package name`)});if(e.projects.length===0)throw Error(`No apps found to install.`);let r=Fy.getDirectory(),i=e.options.dir?t.resolve(r.workspace,e.options.dir):t.join(r.workspace,n),a=await Yx.choose({message:`Select apps to install`,options:e.projects.map(e=>e.name),includeAllOption:!0,mode:`multiple`,required:!0});return{projectName:n,directory:{workspace:i,template:r.template},selectedApps:e.projects.filter(e=>a.includes(e.name))}}static async getConfigPrefs(e){let t=new Set([`common`]),n=new Map;this.getGlobalTags({pkgs:e.selectedApps}).forEach(e=>t.add(e)),this.getPackageDeps({allPkgs:e.packages,pkgs:e.selectedApps}).forEach(e=>n.set(e.name,e));let r=e.packages.filter(e=>e.type!==`configs`||e.packageJson?.startx?.mode===`silent`||n.has(e.name)?!1:e.packageJson?.startx?.iTags?.every(e=>t.has(e))??!0);if(r.length>0){let e=await Yx.choose({message:`Select configs to install`,options:r.map(e=>e.name),includeAllOption:!0,mode:`multiple`,required:!1});r.filter(t=>e.includes(t.name)).forEach(e=>n.set(e.name,e))}return t.has(`node`)&&(await Yx.choose({message:`Select formatter`,options:[`prettier + biome`,`prettier`],mode:`single`,default:`prettier`,required:!0})===`prettier`||t.add(`biome`),t.add(`prettier`)),this.getPackageDeps({allPkgs:e.packages,pkgs:Array.from(n.values())}).forEach(e=>n.set(e.name,e)),this.getGlobalTags({pkgs:Array.from(n.values())}).forEach(e=>t.add(e)),{gTags:Array.from(t),selectedConfigs:Array.from(n.values())}}static async getPackagesPrefs(e){let t=new Set(e.tags),n=new Map(e.selectedPackages.map(e=>[e.name,e])),r=e.packages.filter(e=>e.type!==`packages`||e.packageJson?.startx?.mode===`silent`||n.has(e.name)?!1:e.packageJson?.startx?.iTags?.every(e=>t.has(e))??!1);if(r.length>0){let e=await Yx.choose({message:`Select packages to install`,options:r.map(e=>e.name),includeAllOption:!0,mode:`multiple`,required:!1});r.filter(t=>e.includes(t.name)).forEach(e=>n.set(e.name,e))}return this.getPackageDeps({allPkgs:e.packages,pkgs:Array.from(n.values())}).forEach(e=>n.set(e.name,e)),this.getGlobalTags({pkgs:Array.from(n.values())}).forEach(e=>t.add(e)),{gTags:Array.from(t),selectedPackages:Array.from(n.values())}}static async installPackage(e){if(!e.pkg.packageJson)throw Error(`Missing package.json for ${e.pkg.name}`);let n=new Set([...e.tags,...e.pkg.packageJson.startx?.tags||[]]),r=e.pkg.packageJson.startx?.ignore||[];r.includes(`eslint-config`)&&n.delete(`eslint`),r.includes(`vitest-config`)&&n.delete(`vitest`);let{packageJson:i,isWorkspace:a}=zy.handlePackageJson({app:e.pkg.packageJson,tags:Array.from(n),name:e.packageName||e.pkg.packageJson.name||e.pkg.name,dependencies:e.dependencies});if(a)throw Error(`Cannot install workspace as a package: ${e.pkg.name}`);let o=t.join(e.directory.workspace,e.pkg.relativePath),s=t.join(e.pkg.path);await My.writeJSONFile({dir:o,file:`package`,content:i}),await this.copyValidatedFilesFromFolder(s,o,n),await My.copyDirectory({from:t.join(s,`src`),to:t.join(o,`src`),exclude:n.has(`vitest`)?void 0:/\.test\.tsx?$/}),X_.info(`Successfully installed ${e.pkg.name}`)}static async installWorkspace(e){let t=await Fy.parsePackageJson({dir:e.dir.template}),n=await Fy.parsePackageJson({dir:e.dir.template,file:`startx`});if(!t)throw Error(`Failed to parse root package.json`);t.dependencies={...t.dependencies,...n?.dependencies||{}},t.devDependencies={...t.devDependencies,...n?.devDependencies||{}};let{packageJson:r}=zy.handlePackageJson({app:t,tags:[`root`,...e.tags],name:e.name});await My.writeJSONFile({dir:e.dir.workspace,file:`package`,content:r}),await this.copyValidatedFilesFromFolder(e.dir.template,e.dir.workspace,new Set([`root`,...e.tags]))}static getPackageDeps(e){let t=new Map(e.pkgs.map(e=>[e.name,e]));return Array.from(t.values()).forEach(n=>{[...n.packageJson?.startx?.requiredDeps||[],...n.packageJson?.startx?.requiredDevDeps||[]].forEach(n=>{let r=e.allPkgs.find(e=>e.packageJson?.name===n);r&&t.set(r.name,r)})}),e.pkgs.forEach(e=>t.delete(e.name)),Array.from(t.values())}static getGlobalTags(e){let t=new Set(e.gTags||[]);return e.pkgs.forEach(e=>{e.packageJson?.startx?.gTags?.forEach(e=>t.add(e))}),Array.from(t)}static async copyValidatedFilesFromFolder(e,n,r){let i=await My.listFiles({dir:e}).catch(()=>[]);for(let a of i){let i=Ny[a];if(i&&!i.tags.every(e=>r.has(e)))continue;let o=a===`_gitignore`?`.gitignore`:a;try{await My.copyFile({from:t.join(e,a),to:t.join(n,o)})}catch(e){X_.error(`Failed to copy file ${a}:`,e)}}}},Zx=`1.0.9`;const Qx=new uv;Qx.name(`startx`).description(`StartX CLI - Your all in one monorepo startup tool.`).version(Zx),Qx.command(`ping`).action(()=>{X_.info(`pong`)}),Qx.addCommand(Xx.command),Qx.parse(process.argv);export{};
@@ -69,12 +69,12 @@ export const scripts: SCRIPT = {
69
69
  tags: ["backend", "runnable", "node", "root"],
70
70
  },
71
71
  {
72
- script: "node dist/index.mjs",
73
- tags: ["node", "runnable"],
72
+ script: "vite preview",
73
+ tags: ["react-router", "frontend", "runnable"],
74
74
  },
75
75
  {
76
- script: "react-router-serve ./build/server/index.js",
77
- tags: ["react-router", "frontend"],
76
+ script: "node dist/index.mjs",
77
+ tags: ["node", "runnable"],
78
78
  },
79
79
  ],
80
80
  "lint": [
@@ -0,0 +1,40 @@
1
+ # syntax=docker/dockerfile:1
2
+
3
+ FROM node:24-alpine AS base
4
+ RUN corepack enable && corepack prepare pnpm@11.5.1 --activate
5
+
6
+ WORKDIR /app
7
+
8
+ FROM base AS builder
9
+
10
+ COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
11
+
12
+ COPY --parents apps/web-client/package.json ./
13
+ COPY --parents packages/common/package.json ./
14
+ COPY --parents packages/ui/package.json ./
15
+ COPY --parents configs/*/package.json ./
16
+
17
+ RUN --mount=type=cache,id=pnpm,target=/root/.local/share/pnpm/store \
18
+ pnpm install --frozen-lockfile
19
+
20
+ COPY apps/web-client/ ./apps/web-client/
21
+ COPY packages/common ./packages/common
22
+ COPY packages/ui ./packages/ui
23
+ COPY configs ./configs
24
+ COPY turbo.json ./
25
+
26
+ # Build the required packages with Turbo cache mounted
27
+ RUN --mount=type=cache,id=turbo,target=/app/.turbo/cache \
28
+ pnpm build --filter=web-client
29
+
30
+ # --- Final production image ---
31
+ FROM nginx:stable-alpine
32
+
33
+
34
+ # Copy built server dist
35
+ COPY --from=builder /app/apps/web-client/build/client /usr/share/nginx/html
36
+ COPY --from=builder /app/apps/web-client/nginx.conf /etc/nginx/conf.d/default.conf
37
+
38
+ EXPOSE 80
39
+
40
+ CMD ["nginx", "-g", "daemon off;"]
@@ -0,0 +1,20 @@
1
+ server {
2
+ listen 80;
3
+ server_name _;
4
+
5
+ root /usr/share/nginx/html;
6
+ index index.html;
7
+
8
+ include /etc/nginx/mime.types;
9
+
10
+ location / {
11
+ try_files $uri $uri/ /index.html;
12
+ }
13
+
14
+ location /assets/ {
15
+ expires 1y;
16
+ add_header Cache-Control "public, immutable";
17
+ }
18
+
19
+ error_page 404 /index.html;
20
+ }
@@ -8,7 +8,7 @@
8
8
  "dev": "react-router dev",
9
9
  "format": "biome format --write .",
10
10
  "format:check": "biome ci .",
11
- "start": "react-router-serve ./build/server/index.js",
11
+ "start": "vite preview",
12
12
  "typecheck": "react-router typegen && tsc",
13
13
  "test": "vitest run",
14
14
  "lint": "eslint .",
@@ -1 +0,0 @@
1
- @import "tailwindcss";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "startx",
3
3
  "description": "",
4
- "version": "1.0.8",
4
+ "version": "1.0.9",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/avinashid/startx.git"
@@ -9,4 +9,5 @@ export const ENV = defineEnv({
9
9
  CORS_URL: z.string().optional().default("http://localhost:3000"),
10
10
  PORT: z.string().optional().default("3000"),
11
11
  LOG_LEVEL: z.enum(["error", "warn", "info", "http", "debug"]).default("debug"),
12
+ FILE_STORAGE_PATH: z.string().optional().default("storage"),
12
13
  });
@@ -20,9 +20,9 @@ const COOKIE_NAMES = {
20
20
  } as const;
21
21
 
22
22
  const COOKIE_TTL = {
23
- development: Time.days(90).milliseconds, // 3 months
24
- staging: Time.days(90).milliseconds, // 3 months
25
- production: Time.days(30).milliseconds, // 30 days
23
+ development: Time.days(90).milliseconds,
24
+ staging: Time.days(90).milliseconds,
25
+ production: Time.days(30).milliseconds,
26
26
  } as const;
27
27
 
28
28
  function getRuntimeEnv(): RuntimeEnv {
@@ -4,7 +4,7 @@ import type { Transporter, SendMailOptions } from "nodemailer";
4
4
  import * as nodemailer from "nodemailer";
5
5
  import z from "zod";
6
6
 
7
- const credentials = defineEnv({
7
+ const credentials = {
8
8
  SMTP_HOST: z.string(),
9
9
  SMTP_PORT: z.coerce.number().default(465),
10
10
  SMTP_USER: z.string(),
@@ -12,9 +12,10 @@ const credentials = defineEnv({
12
12
  SMTP_MAIL_ENCRYPTION: z.enum(["ssl", "tls", "starttls"]).default("ssl"),
13
13
  SMTP_SENDER_MAIL: z.string().email(),
14
14
  SMTP_SENDER_NAME: z.string().default("Startx"),
15
- });
15
+ };
16
+ const _SMTPConfigSchema = z.object(credentials);
16
17
 
17
- export type SMTPConfig = typeof credentials;
18
+ export type SMTPConfig = z.infer<typeof _SMTPConfigSchema>;
18
19
 
19
20
  class SMTPMailService {
20
21
  private static transporters = new Map<string, Transporter>();
@@ -39,7 +40,7 @@ class SMTPMailService {
39
40
  }
40
41
 
41
42
  static async verifyConnection(customConfig?: SMTPConfig): Promise<boolean> {
42
- const config = customConfig || credentials;
43
+ const config = customConfig || defineEnv(credentials);
43
44
  const transporter = this.getTransporter(config);
44
45
 
45
46
  try {
@@ -56,7 +57,7 @@ class SMTPMailService {
56
57
  props: { to: string; subject: string; text: string; html?: string },
57
58
  customConfig?: SMTPConfig
58
59
  ) {
59
- const config = customConfig || credentials;
60
+ const config = customConfig || defineEnv(credentials);
60
61
  const transporter = this.getTransporter(config);
61
62
 
62
63
  const mailOptions: SendMailOptions = {
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "extends": "typescript-config/tsconfig.node.json",
3
3
  "compilerOptions": {
4
- "jsx": "react"
4
+ "jsx": "react",
5
+ "lib": ["DOM", "ES2022"]
5
6
  },
6
7
  "include": ["src/**/*.ts"]
7
8
  }
package/turbo.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "build": {
11
11
  "cache": true,
12
12
  "inputs": ["src/**", "tsdown.config.ts", "eslint.config.*", "tsconfig*.json", "package.json"],
13
- "outputs": ["dist/**"],
13
+ "outputs": ["dist/**", "build/**"],
14
14
  "dependsOn": ["lint", "^build"]
15
15
  },
16
16
 
@@ -1,50 +0,0 @@
1
- import { ENV } from "@repo/env";
2
- import { logger } from "@repo/logger";
3
- import type { UploadedFile } from "express-fileupload";
4
- import fs from "fs";
5
- import path from "path";
6
-
7
- import { Random } from "../utils.js";
8
-
9
- export class FileBasedBucket {
10
- static async upload(file: UploadedFile, subpath?: string) {
11
- const fileName = Random.generateString(4, "hex") + path.extname(file.name);
12
- const filePath = path.join(process.cwd(), "storage", subpath ?? "", fileName);
13
- await FileBasedBucket.createDirectoryIfNotExists(`storage/${subpath ?? ""}`);
14
- await file.mv(filePath);
15
- const publicUrl = FileBasedBucket.getPublicUrl(`${subpath ?? ""}/${fileName}`);
16
- return publicUrl;
17
- }
18
- static deleteFile(url: string) {
19
- const filePath = FileBasedBucket.getPath(url);
20
- try {
21
- fs.unlinkSync(filePath);
22
- } catch (error) {
23
- logger.error("Error deleting file:", error);
24
- }
25
- }
26
-
27
- static getPath(url: string) {
28
- const path = url.replace(`${ENV.SERVER_URL}/files/`, `${process.cwd()}/storage/`);
29
- return path;
30
- }
31
-
32
- static getPublicUrl(key: string) {
33
- return path.join(ENV.SERVER_URL, "/files", key);
34
- }
35
-
36
- static async createDirectoryIfNotExists(path: string) {
37
- return await new Promise<boolean>((resolve, reject) => {
38
- if (fs.existsSync(path)) {
39
- resolve(true);
40
- } else {
41
- fs.mkdir(path, { recursive: true }, err => {
42
- if (err) {
43
- reject(err);
44
- }
45
- resolve(true);
46
- });
47
- }
48
- });
49
- }
50
- }
@@ -1,3 +0,0 @@
1
- export * from "./file-storage.js";
2
- export * from "./s3-storage.js";
3
- export * from "./utils.js";
@@ -1,120 +0,0 @@
1
- /**
2
- * TODO: connect to bucket
3
- */
4
- import {
5
- DeleteObjectCommand,
6
- PutObjectCommand,
7
- type PutObjectCommandInput,
8
- S3Client,
9
- } from "@aws-sdk/client-s3";
10
- import { defineEnv } from "@repo/env";
11
- import z from "zod";
12
-
13
- const credentials = defineEnv({
14
- AWS_ACCESS_KEY_ID: z.string(),
15
- AWS_SECRET_ACCESS_KEY: z.string(),
16
- AWS_REGION: z.string().default("us-east-1"),
17
- AWS_BUCKET: z.string(),
18
- S3_ENDPOINT: z.string().optional(),
19
- });
20
-
21
- const s3Endpoint = credentials.S3_ENDPOINT;
22
- const s3Client = new S3Client({
23
- credentials: {
24
- accessKeyId: credentials.AWS_ACCESS_KEY_ID,
25
- secretAccessKey: credentials.AWS_SECRET_ACCESS_KEY,
26
- },
27
- region: credentials.AWS_REGION,
28
- endpoint: s3Endpoint,
29
- });
30
-
31
- const bucket = credentials.AWS_BUCKET;
32
-
33
- export type UploadFile = {
34
- name: string;
35
- mimetype: string;
36
- data: Buffer;
37
- };
38
-
39
- export class S3Bucket {
40
- static async uploadFile(file: UploadFile, path: string) {
41
- let key = `${path}`;
42
- if (!key.includes(".")) {
43
- key += ".jpeg";
44
- }
45
- const params = {
46
- Bucket: bucket,
47
- Key: key,
48
- Body: file.data,
49
- ContentType: file.mimetype,
50
- } as PutObjectCommandInput;
51
- const command = new PutObjectCommand(params);
52
- await s3Client.send(command);
53
- const fileUrl = S3Bucket.getAwsUrl(key);
54
- return fileUrl;
55
- }
56
-
57
- static getAwsUrl(path: string) {
58
- return `https://${bucket}.s3.${credentials.AWS_REGION}.amazonaws.com/${path}`;
59
- }
60
-
61
- static getKeyFromUrl(url: string) {
62
- const key = url.split(`https://${bucket}.s3.${credentials.AWS_REGION}.amazonaws.com/`)[1];
63
- return key;
64
- }
65
-
66
- static async uploadFiles({ path, files }: { path: string; files: UploadFile[] }) {
67
- try {
68
- if (!path) throw new Error("Path must be provided.");
69
- if (!files) throw new Error("File must be provided.");
70
- // const buffers: UploadFile[] = [];
71
- // for (const key in file) {
72
- // const item = file[key];
73
- // if (Array.isArray(item)) item.forEach((e) => buffers.push(e));
74
- // else buffers.push(item!);
75
- // }
76
-
77
- // let upload = [] as { url: string; type: string; name: string }[];
78
- const upload = await Promise.all(
79
- files.map(async file => {
80
- const key = file.name;
81
- const params: PutObjectCommandInput = {
82
- Bucket: bucket,
83
- Key: `${path}/${key}`,
84
- Body: file.data,
85
- ContentType: file.mimetype,
86
- };
87
- const command = new PutObjectCommand(params);
88
- await s3Client.send(command);
89
- return {
90
- url: S3Bucket.getAwsUrl(`${path}/${key}`),
91
- type: file.mimetype,
92
- name: file.name,
93
- };
94
- })
95
- );
96
- return upload;
97
- // if (upload.length > 0) return upload;
98
- // else throw new Error("Something went wrong.");
99
- } catch (error) {
100
- console.log(error);
101
- throw error;
102
- }
103
- }
104
-
105
- // ! don't use
106
- static async deleteFile(path: string) {
107
- try {
108
- const params = {
109
- Bucket: bucket,
110
- Key: path,
111
- };
112
-
113
- const command = new DeleteObjectCommand(params);
114
- await s3Client.send(command);
115
- } catch (error) {
116
- console.log(error);
117
- throw error;
118
- }
119
- }
120
- }
@@ -1,10 +0,0 @@
1
- import { S3Bucket } from "./s3-storage.js";
2
-
3
- export const pathGenerator = {
4
- asset: {
5
- base: "image/assets",
6
- },
7
- profile: (userId: string) => `user/${userId}/profile`,
8
- };
9
-
10
- export const defaultAvatarUrl = `${S3Bucket.getAwsUrl("image/assets/avatar_image.png")}`;