shadcn 4.16.0 → 4.16.2

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.
@@ -0,0 +1,145 @@
1
+ import {c as c$2}from'./chunk-2XFBGS5K.js';import {m,f,l,b,d as d$1,c as c$1,e,n,v,r,s,t,u,A,C,p,g,q as q$1,y}from'./chunk-4WBGNKSZ.js';import {a,d,c,b as b$1,g as g$1,f as f$1}from'./chunk-7SBJAAAY.js';import Do,{promises,existsSync,statSync}from'fs';import*as S from'path';import S__default,{join,basename,normalize,delimiter,resolve,dirname}from'path';import {z}from'zod';import {green,cyan,yellow,red}from'kleur/colors';import Q from'fs-extra';import Wt from'fast-glob';import {loadConfig,createMatchPath}from'tsconfig-paths';import {cosmiconfig}from'cosmiconfig';import df,{tmpdir,homedir}from'os';import yc from'ora';import {Project,SyntaxKind,ScriptKind,VariableDeclarationKind,QuoteKind}from'ts-morph';import {transformFromAstSync}from'@babel/core';import {parse}from'@babel/parser';import Cc from'@babel/plugin-transform-typescript';import*as qt from'recast';import Wc from'prompts';import {AsyncLocalStorage}from'async_hooks';import Be from'deepmerge';import {createHash}from'crypto';import {EnvHttpProxyAgent}from'undici';import {execa}from'execa';import su from'stringify-object';import ie,{cwd}from'process';import tf from'readline';import pf from'events';import*as Vi from'fs/promises';import Vi__default from'fs/promises';import {createRequire}from'module';import {spawn}from'child_process';import {PassThrough}from'stream';import hf from'tty';import A$1 from'postcss';import bp from'postcss/lib/at-rule';import {twMerge}from'tailwind-merge';import Sd from'fuzzysort';var Ae=process.env.REGISTRY_URL??"https://ui.shadcn.com/r",V=Ae.replace(/\/r\/?$/,""),$t="new-york-v4",xn=[{name:"neutral",label:"Neutral"},{name:"zinc",label:"Zinc"},{name:"stone",label:"Stone"},{name:"mauve",label:"Mauve"},{name:"olive",label:"Olive"},{name:"mist",label:"Mist"},{name:"taupe",label:"Taupe"}],H={"@shadcn":`${Ae}/styles/{style}/{name}.json`};var Zd=[{name:"toast",deprecatedBy:"sonner",message:"The toast component is only available for Base UI projects. Use the sonner component instead.",availableIn:["base"]},{name:"toaster",deprecatedBy:"sonner",message:"The toaster component is deprecated. Use the sonner component instead."}],Xd=[{name:"sonner",hiddenIn:["base"]}];var L={NETWORK_ERROR:"NETWORK_ERROR",NOT_FOUND:"NOT_FOUND",GONE:"GONE",UNAUTHORIZED:"UNAUTHORIZED",FORBIDDEN:"FORBIDDEN",FETCH_ERROR:"FETCH_ERROR",NOT_CONFIGURED:"NOT_CONFIGURED",INVALID_CONFIG:"INVALID_CONFIG",MISSING_ENV_VARS:"MISSING_ENV_VARS",LOCAL_FILE_ERROR:"LOCAL_FILE_ERROR",PARSE_ERROR:"PARSE_ERROR",VALIDATION_ERROR:"VALIDATION_ERROR",UNKNOWN_ERROR:"UNKNOWN_ERROR"},_=class extends Error{code;statusCode;context;suggestion;timestamp;cause;constructor(t,r={}){super(t),this.name="RegistryError",this.code=r.code||L.UNKNOWN_ERROR,this.statusCode=r.statusCode,this.cause=r.cause,this.context=r.context,this.suggestion=r.suggestion,this.timestamp=new Date,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor);}toJSON(){return {name:this.name,message:this.message,code:this.code,statusCode:this.statusCode,context:this.context,suggestion:this.suggestion,timestamp:this.timestamp,stack:this.stack}}},je=class extends _{constructor(r,s){let n=`The item at ${r} was not found. It may not exist at the registry.`;super(n,{code:L.NOT_FOUND,statusCode:404,cause:s,context:{url:r},suggestion:"Check if the item name is correct and the registry URL is accessible."});this.url=r;this.name="RegistryNotFoundError";}},Pt=class extends _{constructor(r,s){let n=`The item at ${r} is no longer available. It may have been removed or expired.`;super(n,{code:L.GONE,statusCode:410,cause:s,context:{url:r},suggestion:"This resource was previously available but has been permanently removed. Check if a newer version exists or contact the registry maintainer."});this.url=r;this.name="RegistryGoneError";}},tt=class extends _{constructor(r,s){let n=`You are not authorized to access the item at ${r}. If this is a remote registry, you may need to authenticate.`;super(n,{code:L.UNAUTHORIZED,statusCode:401,cause:s,context:{url:r},suggestion:"Check your authentication credentials and environment variables."});this.url=r;this.name="RegistryUnauthorizedError";}},rt=class extends _{constructor(r,s){let n=`You are not authorized to access the item at ${r}. If this is a remote registry, you may need to authenticate.`;super(n,{code:L.FORBIDDEN,statusCode:403,cause:s,context:{url:r},suggestion:"Check your authentication credentials and environment variables."});this.url=r;this.name="RegistryForbiddenError";}},st=class extends _{constructor(r,s,n,i){let o=s?`Failed to fetch from registry (${s}): ${r}`:`Failed to fetch from registry: ${r}`,c=typeof i=="string"&&i?`${o} - ${i}`:o,a="Check your network connection and try again.";s===404?a="The requested resource was not found. Check the URL or item name.":s===500?a="The registry server encountered an error. Try again later.":s&&s>=400&&s<500&&(a="There was a client error. Check your request parameters.");super(c,{code:L.FETCH_ERROR,statusCode:s,cause:i,context:{url:r,responseBody:n},suggestion:a});this.url=r;this.responseBody=n;this.name="RegistryFetchError";}},de=class extends _{constructor(r){let s=r?`Unknown registry "${r}". Make sure it is defined under "registries" in your components.json or package.json file:
2
+ {
3
+ "registries": {
4
+ "${r}": "[URL_TO_REGISTRY]"
5
+ }
6
+ }`:'Unknown registry. Make sure it is defined under "registries" in your components.json or package.json file.';super(s,{code:L.NOT_CONFIGURED,context:{registryName:r},suggestion:'Add the registry configuration under "registries" in your components.json or package.json file.'});this.registryName=r;this.name="RegistryNotConfiguredError";}},ae=class extends _{constructor(r,s,n={}){super(n.message??`Failed to read local registry file: ${r}`,{code:L.LOCAL_FILE_ERROR,cause:s,context:{filePath:r,...n.context},suggestion:n.suggestion??"Check if the file exists and you have read permissions."});this.filePath=r;this.name="RegistryLocalFileError";}},K=class extends _{constructor(r,s,n={}){super(n.message??`Failed to read registry source file: ${r}`,{code:L.FETCH_ERROR,cause:s,context:{filePath:r,...n.context},suggestion:n.suggestion??"Check if the source file exists and is accessible."});this.filePath=r;this.name="RegistrySourceFileError";}},W=class extends _{constructor(r,s,n={}){let i=n.subject??"registry item",o=`Failed to parse ${i}: ${r}`;s instanceof z.ZodError&&(o=`Failed to parse ${i}: ${r}
7
+ ${s.errors.map(c=>` - ${c.path.join(".")}: ${c.message}`).join(`
8
+ `)}`);super(o,{code:L.PARSE_ERROR,cause:s,context:{item:r,...n.context},suggestion:n.suggestion??`The registry item may be corrupted or have an invalid format. Please make sure it returns a valid JSON object. See ${V}/schema/registry-item.json.`});this.item=r;this.parseError=s,this.name="RegistryParseError";}parseError},P=class extends _{constructor(t,r={}){super(t,{code:L.VALIDATION_ERROR,cause:r.cause,context:{...r.registryFile?{registryFile:r.registryFile}:{},...r.context},suggestion:r.suggestion??"Update the registry.json file and try running the command again."}),this.name="RegistryValidationError";}},Oe=class extends _{constructor(r){super(`Registry item "${r}" was not found.`,{code:L.NOT_FOUND,statusCode:404,context:{itemName:r},suggestion:"Check that the item name exists in the resolved registry catalog."});this.itemName=r;this.name="RegistryItemNotFoundError";}},nt=class extends _{constructor(r,s){let n=`Registry "${r}" requires the following environment variables:
9
+
10
+ `+s.map(i=>` \u2022 ${i}`).join(`
11
+ `);super(n,{code:L.MISSING_ENV_VARS,context:{registryName:r,missingVars:s},suggestion:"Set the required environment variables to your .env or .env.local file."});this.registryName=r;this.missingVars=s;this.name="RegistryMissingEnvironmentVariablesError";}},it=class extends _{constructor(r){let s=`Invalid registry namespace: "${r}". Registry names must start with @ (e.g., @shadcn, @v0).`;super(s,{code:L.VALIDATION_ERROR,context:{name:r},suggestion:"Use a valid registry name starting with @ or provide a direct URL to the registry."});this.name=r;this.name="RegistryInvalidNamespaceError";}};var We=class extends _{constructor(r,s,n="components.json"){let i=n==="package.json"?'package.json "registries"':n==="config"?"provided config":"components.json",o=`Invalid ${i} configuration in ${r}.`;s instanceof z.ZodError&&(o=`Invalid ${i} configuration in ${r}:
12
+ ${s.errors.map(c=>` - ${c.path.join(".")}: ${c.message}`).join(`
13
+ `)}`);super(o,{code:L.INVALID_CONFIG,cause:s,context:{cwd:r,configFile:n},suggestion:n==="package.json"?'Check the "registries" field in your package.json file for invalid configuration.':n==="config"?"Pass a valid full project config, or omit resolvedPaths and provide only registry configuration.":"Check your components.json file for syntax errors or invalid configuration. Run 'npx shadcn@latest init' to regenerate a valid configuration."});this.cwd=r;this.configFile=n;this.name="ConfigParseError";}},ot=class extends _{parseError;constructor(t){let r="Failed to parse registries index";if(t instanceof z.ZodError){let s=t.errors.filter(n=>n.path.length>0).map(n=>`"${n.path[0]}"`).filter((n,i,o)=>o.indexOf(n)===i);s.length>0?r=`Failed to parse registries index. Invalid registry namespace(s): ${s.join(", ")}
14
+ ${t.errors.map(n=>` - ${n.path.join(".")}: ${n.message}`).join(`
15
+ `)}`:r=`Failed to parse registries index:
16
+ ${t.errors.map(n=>` - ${n.path.join(".")}: ${n.message}`).join(`
17
+ `)}`;}super(r,{code:L.PARSE_ERROR,cause:t,context:{parseError:t},suggestion:"The registries index may be corrupted or have invalid registry namespace format. Registry names must start with @ (e.g., @shadcn, @example)."}),this.parseError=t,this.name="RegistriesIndexParseError";}};var Ea=/^(@[a-zA-Z0-9](?:[a-zA-Z0-9-_]*[a-zA-Z0-9])?)\/(.+)$/;function he(e){if(!e.startsWith("@"))return {registry:null,item:e};let t=e.match(Ea);return t?{registry:t[1],item:t[2]}:{registry:null,item:e}}var G={"next-app":{name:"next-app",label:"Next.js",links:{installation:`${V}/docs/installation/next`,tailwind:"https://tailwindcss.com/docs/guides/nextjs"}},"next-pages":{name:"next-pages",label:"Next.js",links:{installation:`${V}/docs/installation/next`,tailwind:"https://tailwindcss.com/docs/guides/nextjs"}},remix:{name:"remix",label:"Remix",links:{installation:`${V}/docs/installation/remix`,tailwind:"https://tailwindcss.com/docs/guides/remix"}},"react-router":{name:"react-router",label:"React Router",links:{installation:`${V}/docs/installation/react-router`,tailwind:"https://tailwindcss.com/docs/installation/framework-guides/react-router"}},vite:{name:"vite",label:"Vite",links:{installation:`${V}/docs/installation/vite`,tailwind:"https://tailwindcss.com/docs/guides/vite"}},astro:{name:"astro",label:"Astro",links:{installation:`${V}/docs/installation/astro`,tailwind:"https://tailwindcss.com/docs/guides/astro"}},laravel:{name:"laravel",label:"Laravel",links:{installation:`${V}/docs/installation/laravel`,tailwind:"https://tailwindcss.com/docs/guides/laravel"}},"tanstack-start":{name:"tanstack-start",label:"TanStack Start",links:{installation:`${V}/docs/installation/tanstack`,tailwind:"https://tailwindcss.com/docs/installation/using-postcss"}},gatsby:{name:"gatsby",label:"Gatsby",links:{installation:`${V}/docs/installation/gatsby`,tailwind:"https://tailwindcss.com/docs/guides/gatsby"}},expo:{name:"expo",label:"Expo",links:{installation:`${V}/docs/installation/expo`,tailwind:"https://www.nativewind.dev/docs/getting-started/installation"}},manual:{name:"manual",label:"Manual",links:{installation:`${V}/docs/installation/manual`,tailwind:"https://tailwindcss.com/docs/installation"}}};var T={error:red,warn:yellow,info:cyan,success:green};function Tt(e){let t=[e];for(;t.length;){let r=t.shift();if(typeof r=="string"){if(r.startsWith("./"))return r;continue}if(Array.isArray(r)){t.unshift(...r);continue}r&&typeof r=="object"&&t.unshift(...Object.values(r));}return null}function At(e){if(!e.includes("*"))return "strip_extension";let t=e.slice(e.indexOf("*")+1);return t&&/^\.[^/]+$/.test(t)?"strip_extension":"preserve_extension"}function jt(e,t){let r=t.find(n=>!n.hasWildcard&&n.key===e);if(r)return {path:S__default.resolve(r.rootDir,r.target),matchedAlias:r.key,matchedTarget:r.target,emitMode:r.emitMode};let s=t.filter(n=>n.hasWildcard).sort((n,i)=>i.key.length-n.key.length);for(let n of s){let i=wr(e,n.key,{allowBareAliasBase:true});if(i!==null)return {path:S__default.resolve(n.rootDir,Ta(n.target,i)),matchedAlias:n.key,matchedTarget:n.target,emitMode:n.emitMode}}return null}function wr(e,t,r={}){if(!t.includes("*"))return e===t?"":null;let[s,n=""]=t.split("*");return e.startsWith(s)&&e.endsWith(n)?n?e.slice(s.length,-n.length):e.slice(s.length):r.allowBareAliasBase&&n===""&&s.endsWith("/")&&e===s.slice(0,-1)?"":null}function Ta(e,t){if(!e.includes("*"))return e;let[r,s=""]=e.split("*");return t?`${r}${t}${s}`:r.replace(/\/$/,"")}function J(e="",t=true){let r=S__default.join(e,"package.json");return Q.readJSONSync(r,{throws:t})}var xr=new Map;function vr(e){let t=S__default.resolve(e),r=xr.get(t);if(r)return r;let n=J(e,false)?.imports;if(!n||typeof n!="object"||Array.isArray(n))return xr.set(t,[]),[];let i=[];for(let[o,c]of Object.entries(n)){if(!o.startsWith("#"))continue;let a=Tt(c);a&&i.push({key:o,aliasBase:o==="#*"?"#":o.endsWith("/*")?o.slice(0,-2):o,target:a,emitMode:At(a),hasWildcard:o.includes("*"),rootDir:t});}return xr.set(t,i),i}function bn(e){let t=vr(e).map(r=>r.aliasBase);return t.length?Fa(t):null}function ct(e,t){return jt(e,vr(t))}function Rn(e){let t=vr(e),r=t.some(s=>s.key==="#*")?{components:"#components",ui:"#components/ui",lib:"#lib",hooks:"#hooks",utils:"#lib/utils"}:null;return {components:at(t,"components")??r?.components,ui:at(t,"ui")??r?.ui,lib:at(t,"lib")??r?.lib,hooks:at(t,"hooks")??r?.hooks,utils:at(t,"utils")??r?.utils}}function at(e,t){return e.map(s=>({entry:s,score:Na(s,t)})).filter(s=>s.score>0).sort((s,n)=>n.score-s.score||n.entry.aliasBase.length-s.entry.aliasBase.length)[0]?.entry.aliasBase}function Na(e,t){let r=e.aliasBase.toLowerCase(),s=_a(e.target).toLowerCase();switch(t){case "components":return r.endsWith("/ui")||s.includes("/components/ui")?0:Ot(r,"components")?4:Ot(s,"components")?3:0;case "ui":return r.endsWith("/ui")||r==="#ui"?5:s.includes("/components/ui")?4:s.endsWith("/ui")?3:0;case "lib":return r==="#lib"||r.endsWith("/lib")?5:s.endsWith("/lib")?4:Ot(s,"lib")?3:0;case "hooks":return r==="#hooks"||r.endsWith("/hooks")?5:s.endsWith("/hooks")?4:Ot(s,"hooks")?3:0;case "utils":return r==="#utils"||r.endsWith("/utils")?5:s.endsWith("/lib/utils")?4:s.endsWith("/utils")?3:0}}function _a(e){return e.replace(/\/\*$/,"").replace(/\*$/,"").replace(/\/index\.[^/]+$/,"")}function Ot(e,t){return e===t||e.includes(`/${t}`)||e.includes(`${t}/`)}function Fa(e){let t=e.map(r=>r.slice(1).split("/").filter(Boolean)).reduce((r,s,n)=>n?r.filter((i,o)=>s[o]===i):s,[]);return t.length?`#${t.join("/")}`:"#"}var I={error(...e){console.log(T.error(e.join(" ")));},warn(...e){console.log(T.warn(e.join(" ")));},info(...e){console.log(T.info(e.join(" ")));},success(...e){console.log(T.success(e.join(" ")));},log(...e){console.log(e.join(" "));},break(){console.log("");}};var Ma=["next.config.*","vite.config.*","astro.config.*","remix.config.*","nuxt.config.*","svelte.config.*","gatsby-config.*","angular.json"];async function Ih(e){if(Q.existsSync(S__default.resolve(e,"pnpm-workspace.yaml")))return true;let t=S__default.resolve(e,"package.json");if(Q.existsSync(t))try{if((await Q.readJson(t)).workspaces)return !0}catch{}return !!(Q.existsSync(S__default.resolve(e,"lerna.json"))||Q.existsSync(S__default.resolve(e,"nx.json")))}async function Eh(e){let t=await Nt(e);if(!t.length)return [];let r=await Wt(t,{cwd:e,onlyDirectories:true,ignore:["**/node_modules/**"]}),s=[];for(let n of r){let i=S__default.resolve(e,n);if(!Q.existsSync(S__default.resolve(i,"package.json")))continue;let o=Q.existsSync(S__default.resolve(i,"components.json")),c=Ma.some(a=>Wt.sync(a,{cwd:i,dot:true}).length>0);(o||c)&&s.push({name:n,hasConfig:o});}return s}function Ch(e,t,r){let s=r?.cwdFlag??"-c";I.break(),I.log(`It looks like you are running ${T.info(e)} from a monorepo root.`),I.log(`To use shadcn in a specific workspace, use the ${T.info(s)} flag:`),I.break();for(let n of t)I.log(` shadcn ${e} ${s} ${n.name}`);I.break();}async function Nt(e){let t=[],r=S__default.resolve(e,"pnpm-workspace.yaml");if(Q.existsSync(r)){let n=await Q.readFile(r,"utf8");t.push(...Da(n));}let s=S__default.resolve(e,"package.json");if(Q.existsSync(s))try{let n=await Q.readJson(s),i=Array.isArray(n.workspaces)?n.workspaces:n.workspaces?.packages;Array.isArray(i)&&t.push(...i.filter(o=>!o.startsWith("!")));}catch{}return Array.from(new Set(t))}function Da(e){let t=[],r=false,s=0;for(let n of e.split(`
18
+ `)){let i=n.trim();if(!i||i.startsWith("#"))continue;let o=n.match(/^(\s*)([A-Za-z0-9_-]+)\s*:/);if(o){s=o[1].length,r=o[2]==="packages";continue}if(!r)continue;let c=n.match(/^(\s*)-\s*(.+?)\s*(?:#.*)?$/);!c||c[1].length<=s||t.push(c[2].trim().replace(/^["']|["']$/g,""));}return t}var In=new Map,br=new Map,_t=new Map;async function En(e,t){let r=Ga(e);if(!r)return null;let s=await za(t,r.packageName);return s?jt(e,Wa(s)):null}function Wa(e){let t=`${e.packageRoot}:${e.packageName}`,r=br.get(t);if(r)return r;let n=J(e.packageRoot,false)?.exports;if(!n||typeof n!="object"||Array.isArray(n))return br.set(t,[]),[];let i=[];for(let[o,c]of Object.entries(n)){if(o!=="."&&!o.startsWith("./"))continue;let a=Tt(c);if(!a)continue;let f=Ba(e.packageName,o);i.push({key:o.includes("*")?`${f}/*`:f,aliasBase:f,target:a,emitMode:At(a),hasWildcard:o.includes("*"),rootDir:e.packageRoot});}return br.set(t,i),i}async function za(e,t){let r=await Ha(e);if(!r)return null;let s=In.get(r);if(s?.has(t))return s.get(t)??null;let n=await Ua(r);return In.set(r,n),n.get(t)??null}async function Ua(e){let t=await Nt(e),r=new Map;if(!t.length)return r;let s=await Wt(t.map(n=>S__default.posix.join(n.split(S__default.sep).join("/"),"package.json")),{cwd:e,ignore:["**/node_modules/**"]});for(let n of s){let i=S__default.resolve(e,S__default.dirname(n)),c=J(i,false)?.name;c&&r.set(c,{packageName:c,packageRoot:i});}return r}async function Ha(e){let t=S__default.resolve(e),r=_t.get(t);if(r!==void 0)return r;let s=t,n=await Ka(t);for(;;){if((await Nt(s)).length)return _t.set(t,s),s;if(n&&s===n)return _t.set(t,null),null;let o=S__default.dirname(s);if(o===s)return _t.set(t,null),null;s=o;}}async function Ka(e){let t=S__default.resolve(e);for(;;){if(Q.existsSync(S__default.resolve(t,".git")))return t;let r=S__default.dirname(t);if(r===t)return null;t=r;}}function Ga(e){if(e.startsWith("#")||e.startsWith(".")||S__default.isAbsolute(e))return null;let t=e.split("/");return e.startsWith("@")?t.length<2?null:{packageName:`${t[0]}/${t[1]}`}:{packageName:t[0]}}function Ba(e,t){if(t===".")return e;let r=t.slice(2).replace(/\/\*$/,"");return r?`${e}/${r}`:e}async function Ft(e,t){let r=t.cwd??t.absoluteBaseUrl;if(e.startsWith("#")){let n=ct(e,r);if(n)return {path:n.path,source:"package_imports",matchedAlias:n.matchedAlias,matchedTarget:n.matchedTarget,emitMode:n.emitMode}}let s=await En(e,r);return s?{path:s.path,source:"workspace_package_exports",matchedAlias:s.matchedAlias,matchedTarget:s.matchedTarget,emitMode:s.emitMode}:Ya(e,t)}function Cn(e,t){return e.startsWith("#")?true:t?e.startsWith(`${t}/`):false}function Ja(e){return /^@[^/]+\/[^/]+(?:\/.*)?$/.test(e)}function Ya(e,t){let r=createMatchPath(t.absoluteBaseUrl,t.paths)(e,void 0,()=>true,[".ts",".tsx",".jsx",".js",".css"]);if(!r)return null;let s=Za(e,t.paths);return !s&&Ja(e)?null:{path:r,source:"tsconfig_paths",matchedAlias:s?.key??e,matchedTarget:s?.target??r,emitMode:"strip_extension"}}function Za(e,t){for(let[r,s]of Object.entries(t)){let n=Array.isArray(s)?s:[s],i=wr(e,r);if(i!==null)return {key:r,target:n[0]?.includes("*")&&i!==null?n[0].replace(/\*/g,i):n[0]}}return null}var Yh="@/components",Zh="@/lib/utils",Xh="app/globals.css",Qh="tailwind.config.js";var Mt=cosmiconfig("components",{searchPlaces:["components.json"]});async function ut(e){let t=await rc(e);return t?(t.iconLibrary||(t.iconLibrary=t.style==="new-york"?"radix":"lucide"),await Dt(e,t)):null}async function Dt(e,t){t.registries={...H,...t.registries||{}};let r=await loadConfig(e);if(r.resultType==="failed")throw new Error(`Failed to load ${t.tsx?"tsconfig":"jsconfig"}.json. ${r.message??""}`.trim());let s=await lt("utils",t.aliases.utils,e,r),n=await lt("components",t.aliases.components,e,r),i=t.aliases.ui?await lt("ui",t.aliases.ui,e,r):S__default.resolve(n??e,"ui"),o=t.aliases.lib?await lt("lib",t.aliases.lib,e,r):S__default.resolve(s??e,".."),c=t.aliases.hooks?await lt("hooks",t.aliases.hooks,e,r):S__default.resolve(n??e,"..","hooks");return tc(e,{components:n,utils:s,ui:i,lib:o,hooks:c}),d$1.parse({...t,resolvedPaths:{cwd:e,tailwindConfig:t.tailwind.config?S__default.resolve(e,t.tailwind.config):"",tailwindCss:S__default.resolve(e,t.tailwind.css),utils:s,components:n,ui:i,lib:o,hooks:c}})}async function lt(e,t,r,s){let n=await Ft(t,{...s,cwd:r});if(!n?.path||t.startsWith("#")&&n.path===S__default.resolve(r,t))return null;if(e!=="utils"&&(n.source==="package_imports"||n.source==="workspace_package_exports")){if(!n.matchedAlias.includes("*")&&/\/index\.[^/]+$/.test(n.path))return S__default.dirname(n.path);if(n.matchedAlias.includes("*")&&/\.[^/]+$/.test(n.path))return n.path.replace(/\.[^/]+$/,"")}return n.path}function tc(e,t){let r=["components","ui","lib","hooks","utils"].filter(s=>!t[s]);if(r.length)throw new Error([`Could not resolve the following aliases in ${T.info(e)}: ${T.info(r.join(", "))}.`,`Configure path aliases in ${T.info("tsconfig.json")} or imports in ${T.info("package.json")} for this workspace and try again.`].join(`
19
+ `))}async function rc(e){try{let t=await Mt.search(e);if(!t)return null;let r=c$1.parse(t.config);if(r.registries){for(let s of Object.keys(r.registries))if(s in H)throw new Error(`"${s}" is a built-in registry and cannot be overridden.`)}return r}catch(t){let r=`${e}/components.json`;throw t instanceof Error&&t.message.includes("reserved registry")?t:new Error(`Invalid configuration found in ${T.info(r)}.`)}}async function kn(e$1){let t={};for(let s of Object.keys(e$1.aliases)){if(!sc(s,e$1))continue;let n=e$1.resolvedPaths[s],i=await Rr(e$1.resolvedPaths.cwd,n);if(!i){t[s]=e$1;continue}let o=await ut(i);if(!o)throw new Error([`Could not load the workspace config in ${T.info(i)}.`,`Add ${T.info("components.json")} to this workspace and configure its path aliases or package imports, then try again.`].join(`
20
+ `));t[s]=o;}let r=e.safeParse(t);return r.success?r.data:null}async function Rr(e,t){let r=Lt(e,t),s=S__default.relative(r,t),i=(await Wt.glob("**/package.json",{cwd:r,deep:3,ignore:["**/node_modules/**","**/dist/**","**/build/**","**/public/**"]})).map(o=>S__default.dirname(o)).find(o=>s.startsWith(o));return i?S__default.join(r,i):null}function sc(e,t){return Object.keys(t.resolvedPaths).filter(r=>r!=="utils").includes(e)}function Lt(e,t){let r=e.split(S__default.sep),s=t.split(S__default.sep),n=[];for(let i=0;i<Math.min(r.length,s.length)&&r[i]===s[i];i++)n.push(r[i]);return n.join(S__default.sep)}async function $n(e,t){return (await Y(e))?.tailwindVersion==="v4"?"new-york-v4":t}function em(e){return e===void 0?"base":c$2(e).base??"radix"}function Pn(e){let t={resolvedPaths:{cwd:process.cwd(),tailwindConfig:"",tailwindCss:"",utils:"",components:"",ui:"",lib:"",hooks:""},style:"",tailwind:{config:"",css:"",baseColor:"",cssVariables:false},rsc:false,tsx:true,aliases:{components:"",utils:""},registries:{...H}};return e?{...t,...e,resolvedPaths:{...t.resolvedPaths,...e.resolvedPaths||{}},tailwind:{...t.tailwind,...e.tailwind||{}},aliases:{...t.aliases,...e.aliases||{}},registries:{...t.registries,...e.registries||{}}}:t}var zt=["**/node_modules/**",".next","public","dist","build"],oc=z.object({compilerOptions:z.object({paths:z.record(z.string().or(z.array(z.string())))})});async function Y(e,t){let[r,s,n,i,o,c,a,f]=await Promise.all([Wt.glob("**/{next,vite,astro,app}.config.*|gatsby-config.*|composer.json|react-router.config.*",{cwd:e,deep:3,ignore:zt}),Q.pathExists(S__default.resolve(e,"src")),fc(e),lc(e),cc(e,t?.configCssFile),Tn(e),An(e),J(e,false)]),l=await Q.pathExists(S__default.resolve(e,`${s?"src/":""}app`)),u={framework:G.manual,isSrcDir:s,isRSC:false,isTsx:n,tailwindConfigFile:i,tailwindCssFile:o,tailwindVersion:c,frameworkVersion:null,aliasPrefix:a.prefix};if(r.find(p=>p.startsWith("next.config."))?.length)return u.framework=l?G["next-app"]:G["next-pages"],u.isRSC=l,u.frameworkVersion=await ac(u.framework,f),u;if(r.find(p=>p.startsWith("astro.config."))?.length)return u.framework=G.astro,u;if(r.find(p=>p.startsWith("gatsby-config."))?.length)return u.framework=G.gatsby,u;if(r.find(p=>p.startsWith("composer.json"))?.length)return u.framework=G.laravel,u;if(Object.keys(f?.dependencies??{}).find(p=>p.startsWith("@remix-run/")))return u.framework=G.remix,u;if([...Object.keys(f?.dependencies??{}),...Object.keys(f?.devDependencies??{})].find(p=>p.startsWith("@tanstack/react-start")))return u.framework=G["tanstack-start"],u;if(r.find(p=>p.startsWith("react-router.config."))?.length)return u.framework=G["react-router"],u;if(r.find(p=>p.startsWith("vite.config."))?.length)return u.framework=G.vite,u;let d=r.find(p=>p.startsWith("app.config"));return d?.length&&(await Q.readFile(S__default.resolve(e,d),"utf8")).includes("defineConfig")?(u.framework=G.vite,u):(f?.dependencies?.expo&&(u.framework=G.expo),u)}async function ac(e,t){if(!t||!["next-app","next-pages"].includes(e.name))return null;let r=t.dependencies?.next||t.devDependencies?.next;if(!r)return null;let s=r.match(/^[\^~]?(\d+\.\d+\.\d+)/);if(s)return s[1];let n=r.match(/(\d+\.\d+\.\d+)/);return n?n[1]:r}async function Tn(e){let[t,r]=await Promise.all([J(e,false),ut(e)]);return r?.tailwind?.config===""?"v4":!t?.dependencies?.tailwindcss&&!t?.devDependencies?.tailwindcss?null:/^(?:\^|~)?3(?:\.\d+)*(?:-.*)?$/.test(t?.dependencies?.tailwindcss||t?.devDependencies?.tailwindcss||"")?"v3":"v4"}async function cc(e,t){if(t){let i=S__default.resolve(e,t);if(await Q.pathExists(i))return t}let[r,s]=await Promise.all([Wt.glob(["**/*.css","**/*.scss"],{cwd:e,deep:5,ignore:zt}),Tn(e)]);if(!r.length)return null;for(let i of r){let o=await Q.readFile(S__default.resolve(e,i),"utf8");if(o.includes('@import "tailwindcss"')||o.includes("@import 'tailwindcss'")||o.includes("@tailwind base"))return i}return null}async function lc(e){let t=await Wt.glob("tailwind.config.*",{cwd:e,deep:3,ignore:zt});return t.length?t[0]:null}async function uc(e){let t=await loadConfig(e),r=t?.resultType==="success"&&Object.entries(t.paths).length?t.paths:(await pc(e))?.compilerOptions.paths;if(!r||!Object.entries(r).length)return null;for(let[s,n]of Object.entries(r)){let i=Array.isArray(n)?n:[n];if(i.includes("./*")||i.includes("./src/*")||i.includes("./app/*")||i.includes("./resources/js/*"))return s.replace(/\/\*$/,"")??null}return Object.keys(r)?.[0].replace(/\/\*$/,"")??null}async function An(e){let t=await uc(e),r=bn(e);return r&&t?.startsWith("#")?{prefix:r,source:"package_imports"}:t?{prefix:t,source:"tsconfig_paths"}:r?{prefix:r,source:"package_imports"}:{prefix:null,source:null}}async function fc(e){return (await Wt.glob("tsconfig.*",{cwd:e,deep:1,ignore:zt})).length>0}async function pc(e){for(let t of ["tsconfig.json","tsconfig.web.json","tsconfig.app.json"]){let r=S__default.resolve(e,t);if(!await Q.pathExists(r))continue;let s=await Q.readFile(r,"utf8"),n;try{n=JSON.parse(dc(s));}catch{continue}let i=oc.safeParse(n);if(!i.error)return i.data}return null}function dc(e){let t="",r=false,s=false;for(let n=0;n<e.length;n++){let i=e[n],o=e[n+1];if(r){if(t+=i,s){s=false;continue}if(i==="\\"){s=true;continue}i==='"'&&(r=false);continue}if(i==='"'){r=true,t+=i;continue}if(i==="/"&&o==="/"){for(;n<e.length&&e[n]!==`
21
+ `;)n++;n<e.length&&(t+=e[n]);continue}if(i==="/"&&o==="*"){for(n+=2;n<e.length;){if(e[n]==="*"&&e[n+1]==="/"){n++;break}e[n]===`
22
+ `&&(t+=`
23
+ `),n++;}continue}if(i===","){let c=n+1;for(;c<e.length;){for(;/\s/.test(e[c]??"");)c++;if(e[c]==="/"&&e[c+1]==="/"){for(c+=2;c<e.length&&e[c]!==`
24
+ `&&e[c]!=="\r";)c++;continue}if(e[c]==="/"&&e[c+1]==="*"){for(c+=2;c<e.length&&!(e[c]==="*"&&e[c+1]==="/");)c++;c+=2;continue}break}if(e[c]==="}"||e[c]==="]")continue}t+=i;}return t}async function mm(e,t=null){let[r,s,n]=await Promise.all([ut(e),t?Promise.resolve(t):Y(e),An(e)]);if(r)return r;if(!s||!s.tailwindCssFile||s.tailwindVersion==="v3"&&!s.tailwindConfigFile)return null;let i=n.source==="package_imports"?Rn(e):null;if(!s.aliasPrefix)return null;let o=hc(s.aliasPrefix,n.source==="package_imports"),c=n.source==="package_imports"&&i?mc({...o,components:i.components??o.components,ui:i.ui??o.ui,hooks:i.hooks??o.hooks,lib:i.lib??o.lib,utils:i.utils??o.utils}):o;if(!c.components||!c.utils)return null;let a={$schema:"https://ui.shadcn.com/schema.json",rsc:s.isRSC,tsx:s.isTsx,style:"new-york",tailwind:{config:s.tailwindConfigFile??"",baseColor:"zinc",css:s.tailwindCssFile,cssVariables:true,prefix:""},iconLibrary:"lucide",aliases:c};return await Dt(e,a)}function hc(e,t=false){return t&&e==="#"?{components:"",ui:void 0,hooks:void 0,lib:void 0,utils:""}:{components:`${e}/components`,ui:`${e}/components/ui`,hooks:`${e}/hooks`,lib:`${e}/lib`,utils:`${e}/lib/utils`}}function mc(e){let t={...e};return !t.ui&&t.components&&(t.ui=`${t.components}/ui`),!t.lib&&t.utils.endsWith("/utils")&&(t.lib=t.utils.slice(0,-6)),!t.utils&&t.lib&&(t.utils=`${t.lib}/utils`),t}async function Ne(e){if(!e.resolvedPaths?.cwd)return "v3";let t=await Y(e.resolvedPaths.cwd);return t?.tailwindVersion?t.tailwindVersion:null}async function gm(e){let t=await ut(e);if(!t)return [];let s=(await Dt(e,t)).resolvedPaths.ui;if(!Q.existsSync(s))return [];let n=await Vt(),i=new Set(n?.map(c=>c.name)??[]);return (await promises.readdir(s)).filter(c=>/\.(tsx|jsx)$/.test(c)).map(c=>S__default.basename(c,S__default.extname(c))).filter(c=>i.has(c))}function jn(e,t,r={}){let{ignoreImports:s=false}=r,n=e.replace(/\r\n/g,`
25
+ `).trim(),i=t.replace(/\r\n/g,`
26
+ `).trim();if(n===i)return true;if(!s)return false;let o=/^(import\s+(?:type\s+)?(?:\*\s+as\s+\w+|\{[^}]*\}|\w+)?(?:\s*,\s*(?:\{[^}]*\}|\w+))?\s+from\s+["'])([^"']+)(["'])/gm,c=l=>l.replace(o,(u,d,p,h)=>{if(p.startsWith("."))return `${d}${p}${h}`;let m=p.split("/"),g=m[m.length-1];return `${d}@normalized/${g}${h}`}),a=c(n),f=c(i);return a===f}function _e(e){let t=S__default.basename(e);return /^\.env(\.|$)/.test(t)}function Ut(e){let t=[".env.local",".env",".env.development.local",".env.development"];for(let r of t){let s=S__default.join(e,r);if(existsSync(s))return s}return null}function Ue(e){let t=e.split(`
27
+ `),r={};for(let s of t){let n=s.trim();if(!n||n.startsWith("#"))continue;let i=n.indexOf("=");if(i===-1)continue;let o=n.substring(0,i).trim(),c=n.substring(i+1).trim();o&&(r[o]=c.replace(/^["']|["']$/g,""));}return r}function Ht(e,t){let r=Ue(e),s=Ue(t),n=[];for(let i of Object.keys(s))i in r||n.push(i);return n}function Kt(e,t){let r=Ue(e),s=Ue(t),n=e.trimEnd();n&&!n.endsWith(`
28
+ `)&&(n+=`
29
+ `);let i=[];for(let[o,c]of Object.entries(s))o in r||i.push(`${o}=${c}`);return i.length>0?(n&&(n+=`
30
+ `),n+=i.join(`
31
+ `),n+`
32
+ `):n&&!n.endsWith(`
33
+ `)?n+`
34
+ `:n}function j(e,t){return yc({text:e,isSilent:t?.silent})}var wc=["components","ui","lib","hooks"];function Sr(e){return wc.includes(e)}function Gt(e){let t=e?.match(/^@([^/]+)\//);return t&&Sr(t[1])?t[1]:null}var Bt=async({sourceFile:e,config:t,isRemote:r})=>{let s=t.aliases?.utils,n=typeof s=="string"?bc(s):"@",i=n?`${n}/lib/utils`:"@/lib/utils";if(![".tsx",".ts",".jsx",".js"].includes(e.getExtension()))return e;for(let o of e.getImportStringLiterals()){let c=vc(o.getLiteralValue(),t,r);if(o.setLiteralValue(c),i===c||c==="@/lib/utils"){if(!o.getFirstAncestorByKind(SyntaxKind.ImportDeclaration)?.getNamedImports().some(l=>l.getName()==="cn")||!t.aliases.utils)continue;o.setLiteralValue(i===c?c.replace(i,t.aliases.utils):t.aliases.utils);}}return e};function vc(e,t,r=false){if(e=Rc(e,t),!e.startsWith("@/")&&!r)return e;if(r&&e.startsWith("@/")&&(e=e.replace(/^@\//,"@/registry/new-york/")),e==="@/registry")return t.aliases.components;if(!e.startsWith("@/registry/")){if(e==="@/lib/utils"&&t.aliases.utils)return t.aliases.utils;if(t.aliases.ui&&e.match(/^@\/components\/ui(?=\/|$)/))return e.replace(/^@\/components\/ui/,t.aliases.ui);if(t.aliases.components&&e.match(/^@\/components(?=\/|$)/))return e.replace(/^@\/components/,t.aliases.components);if(t.aliases.hooks&&e.match(/^@\/hooks(?=\/|$)/))return e.replace(/^@\/hooks/,t.aliases.hooks);if(t.aliases.lib&&e.match(/^@\/lib(?=\/|$)/))return e.replace(/^@\/lib/,t.aliases.lib);let s=t.aliases.components.split("/")[0];return e.replace(/^@\//,`${s}/`)}return e.match(/^@\/registry\/(.+)\/ui/)?e.replace(/^@\/registry\/(.+)\/ui/,t.aliases.ui??`${t.aliases.components}/ui`):t.aliases.utils&&e.match(/^@\/registry\/(.+)\/lib\/utils$/)?t.aliases.utils:t.aliases.components&&e.match(/^@\/registry\/(.+)\/components/)?e.replace(/^@\/registry\/(.+)\/components/,t.aliases.components):t.aliases.lib&&e.match(/^@\/registry\/(.+)\/lib/)?e.replace(/^@\/registry\/(.+)\/lib/,t.aliases.lib):t.aliases.hooks&&e.match(/^@\/registry\/(.+)\/hooks/)?e.replace(/^@\/registry\/(.+)\/hooks/,t.aliases.hooks):e.replace(/^@\/registry\/[^/]+/,t.aliases.components)}function bc(e){if(e.startsWith("#"))return "";if(e.endsWith("/lib/utils"))return e.slice(0,-10);if(e.startsWith("@")){let[r,s]=e.split("/");return r&&s?`${r}/${s}`:e}let t=e.indexOf("/");return t===-1?e:e.slice(0,t)}function Rc(e,t){if(e==="#registry")return "@/registry";if(e.startsWith("#/"))return e.replace(/^#\//,"@/");if(e.startsWith("#registry/"))return e.replace(/^#registry\//,"@/registry/");for(let{alias:r,normalized:s}of Sc(t)){if(e===r)return s;if(e.startsWith(`${r}/`))return `${s}${e.slice(r.length)}`}return e}function Sc(e){return e.aliases?[{alias:e.aliases.ui,normalized:"@/components/ui"},{alias:e.aliases.components,normalized:"@/components"},{alias:e.aliases.hooks,normalized:"@/hooks"},{alias:e.aliases.lib,normalized:"@/lib"},{alias:e.aliases.utils,normalized:"@/lib/utils"}].filter(t=>typeof t.alias=="string"&&t.alias.startsWith("#")).sort((t,r)=>r.alias.length-t.alias.length):[]}var kc={sourceType:"module",allowImportExportEverywhere:true,allowReturnOutsideFunction:true,startLine:1,tokens:true,plugins:["asyncGenerators","bigInt","classPrivateMethods","classPrivateProperties","classProperties","classStaticBlock","decimal","decorators-legacy","doExpressions","dynamicImport","exportDefaultFrom","exportNamespaceFrom","functionBind","functionSent","importAssertions","importMeta","nullishCoalescingOperator","numericSeparator","objectRestSpread","optionalCatchBinding","optionalChaining",["pipelineOperator",{proposal:"minimal"}],["recordAndTuple",{syntaxType:"hash"}],"throwExpressions","topLevelAwait","v8intrinsic","typescript","jsx"]},Nn=async({sourceFile:e,config:t})=>{let r=e.getFullText();if(t.tsx)return r;let s=qt.parse(r,{parser:{parse:i=>parse(i,kc)}}),n=transformFromAstSync(s,r,{cloneInputAst:false,code:false,ast:true,plugins:[Cc],configFile:false});if(!n||!n.ast)throw new Error("Failed to transform JSX");return qt.print(n.ast).code};var Pc=/^["']use client["']$/g,Jt=async({sourceFile:e,config:t})=>{if(t.rsc)return e;let r=e.getFirstChildByKind(SyntaxKind.ExpressionStatement);return r&&Pc.test(r.getText())&&r.remove(),e};var Tc=new Set(["cn-font-heading"]),Ac=/\bcn-[a-z-]+\b/;function _n(e){return Ac.test(e)&&!Tc.has(e)}function Fn(e){return e.split(/\s+/).filter(t=>t.length>0&&!_n(t)).join(" ")}function Mn(e){return e.split(/\s+/).some(_n)}function Yt(e){let t=e.getLiteralValue();if(!Mn(t))return;let r=Fn(t);r!==t&&e.setLiteralValue(r);}function Ir(e){for(let t of e.getDescendantsOfKind(SyntaxKind.StringLiteral))Yt(t);for(let t of e.getDescendantsOfKind(SyntaxKind.NoSubstitutionTemplateLiteral))Yt(t);}function jc(e){let t=[];for(let r of e.getDescendantsOfKind(SyntaxKind.JsxAttribute)){let s=r.getNameNode().getText();if(s!=="className"&&s!=="classNames")continue;let n=r.getInitializer();if(n?.isKind(SyntaxKind.StringLiteral)){let i=n.getLiteralValue();if(Mn(i)){let o=Fn(i);o===""?t.push(r):o!==i&&n.setLiteralValue(o);}}n?.isKind(SyntaxKind.JsxExpression)&&Ir(n);}for(let r of t)r.remove();for(let r of e.getDescendantsOfKind(SyntaxKind.CallExpression))if(r.getExpression().getText()==="cva")for(let s of r.getArguments()){if(s.isKind(SyntaxKind.StringLiteral)){Yt(s);continue}if(s.isKind(SyntaxKind.NoSubstitutionTemplateLiteral)){Yt(s);continue}Ir(s);}for(let r of e.getDescendantsOfKind(SyntaxKind.CallExpression))r.getExpression().getText()==="mergeProps"&&Ir(r);}var Zt=async({sourceFile:e})=>(jc(e),e);var Xt=async({sourceFile:e,config:t})=>{if(!t.tailwind?.prefix)return e;let r=await Ne(t);return e.getDescendantsOfKind(SyntaxKind.CallExpression).filter(s=>s.getExpression().getText()==="cva").forEach(s=>{if(s.getArguments()[0]?.isKind(SyntaxKind.StringLiteral)){let n=s.getArguments()[0];n&&n.replaceWithText(`"${ye(n.getText()?.replace(/"|'/g,""),t.tailwind.prefix,r)}"`);}s.getArguments()[1]?.isKind(SyntaxKind.ObjectLiteralExpression)&&s.getArguments()[1]?.getDescendantsOfKind(SyntaxKind.PropertyAssignment).find(n=>n.getName()==="variants")?.getDescendantsOfKind(SyntaxKind.PropertyAssignment).forEach(n=>{n.getDescendantsOfKind(SyntaxKind.PropertyAssignment).forEach(i=>{let o=i.getInitializerIfKind(SyntaxKind.StringLiteral);o&&o?.replaceWithText(`"${ye(o.getText()?.replace(/"|'/g,""),t.tailwind.prefix,r)}"`);});});}),e.getDescendantsOfKind(SyntaxKind.JsxAttribute).forEach(s=>{if(s.getNameNode().getText()==="className"){if(s.getInitializer()?.isKind(SyntaxKind.StringLiteral)){let n=s.getInitializer();n&&n.replaceWithText(`"${ye(n.getText()?.replace(/"|'/g,""),t.tailwind.prefix,r)}"`);}if(s.getInitializer()?.isKind(SyntaxKind.JsxExpression)){let n=s.getInitializer()?.getDescendantsOfKind(SyntaxKind.CallExpression).find(i=>i.getExpression().getText()==="cn");n&&n.getArguments().forEach(i=>{(i.isKind(SyntaxKind.ConditionalExpression)||i.isKind(SyntaxKind.BinaryExpression))&&i.getChildrenOfKind(SyntaxKind.StringLiteral).forEach(o=>{o.replaceWithText(`"${ye(o.getText()?.replace(/"|'/g,""),t.tailwind.prefix,r)}"`);}),i.isKind(SyntaxKind.StringLiteral)&&i.replaceWithText(`"${ye(i.getText()?.replace(/"|'/g,""),t.tailwind.prefix,r)}"`);});}}s.getNameNode().getText()==="classNames"&&s.getInitializer()?.isKind(SyntaxKind.JsxExpression)&&s.getDescendantsOfKind(SyntaxKind.PropertyAssignment).forEach(n=>{if(n.getInitializer()?.isKind(SyntaxKind.CallExpression)){let i=n.getInitializerIfKind(SyntaxKind.CallExpression);i&&i.getArguments().forEach(o=>{o.isKind(SyntaxKind.ConditionalExpression)&&o.getChildrenOfKind(SyntaxKind.StringLiteral).forEach(c=>{c.replaceWithText(`"${ye(c.getText()?.replace(/"|'/g,""),t.tailwind.prefix,r)}"`);}),o.isKind(SyntaxKind.StringLiteral)&&o.replaceWithText(`"${ye(o.getText()?.replace(/"|'/g,""),t.tailwind.prefix,r)}"`);});}if(n.getInitializer()?.isKind(SyntaxKind.StringLiteral)&&n.getNameNode().getText()!=="variant"){let i=n.getInitializer();i&&i.replaceWithText(`"${ye(i.getText()?.replace(/"|'/g,""),t.tailwind.prefix,r)}"`);}});}),e};function ye(e,t="",r){return r==="v3"?e.split(" ").map(s=>{let[n,i,o]=b$1(s);return n?o?`${n}:${t}${i}/${o}`:`${n}:${t}${i}`:o?`${t}${i}/${o}`:`${t}${i}`}).join(" "):e.split(" ").map(s=>s.indexOf(`${t}:`)===0?s:`${t}:${s.trim()}`).join(" ")}var Mc=new Project({compilerOptions:{}});async function Dc(e){let t=await promises.mkdtemp(S__default.join(tmpdir(),"shadcn-"));return S__default.join(t,e)}async function Ln(e,t=[Bt,Jt,a,Xt,d,c,Zt]){let r=await Dc(e.filename),s=Mc.createSourceFile(r,e.raw,{scriptKind:ScriptKind.TSX});for(let n of t)await n({sourceFile:s,...e});return e.transformJsx?await Nn({sourceFile:s,...e}):s.getText()}var Lc=["a","span","div","Link","label","Label"],Vn=async({sourceFile:e,config:t})=>{if(!t.style?.startsWith("base-"))return e;let r=10;for(let s=0;s<r;s++){let i=e.getDescendantsOfKind(SyntaxKind.JsxElement).filter(a=>a.getOpeningElement().getAttribute("asChild"));if(i.length===0)break;let o=i.filter(a=>!a.getDescendantsOfKind(SyntaxKind.JsxElement).some(l=>l.getOpeningElement().getAttribute("asChild"))),c=[];for(let a of o){let f=a.getOpeningElement(),l=f.getAttribute("asChild");if(!l)continue;let u=f.getTagNameNode().getText(),p=a.getJsxChildren().find(y=>y.getKind()===SyntaxKind.JsxElement||y.getKind()===SyntaxKind.JsxSelfClosingElement);if(!p){l.remove();continue}let h,m,g;if(p.getKind()===SyntaxKind.JsxSelfClosingElement){let y=p.asKindOrThrow(SyntaxKind.JsxSelfClosingElement);h=y.getTagNameNode().getText(),m=y.getAttributes().map(w=>w.getText()).join(" "),g="";}else {let y=p.asKindOrThrow(SyntaxKind.JsxElement),w=y.getOpeningElement();h=w.getTagNameNode().getText(),m=w.getAttributes().map(v=>v.getText()).join(" "),g=y.getJsxChildren().map(v=>v.getText()).join("");}let x=u==="Button"&&Lc.includes(h);c.push({parentElement:a,parentTagName:u,childTagName:h,childProps:m,childChildren:g,needsNativeButton:x});}for(let a of c.reverse()){let l=a.parentElement.getOpeningElement().getAttributes().filter(m=>m.getKind()===SyntaxKind.JsxAttribute?m.asKindOrThrow(SyntaxKind.JsxAttribute).getNameNode().getText()!=="asChild":true).map(m=>m.getText()).join(" "),u=a.childProps?`{<${a.childTagName} ${a.childProps} />}`:`{<${a.childTagName} />}`,d=l?`${l} `:"";d+=`render=${u}`,a.needsNativeButton&&(d+=" nativeButton={false}");let p=a.childChildren.trim()?`${a.childChildren}`:"",h=`<${a.parentTagName} ${d}>${p}</${a.parentTagName}>`;a.parentElement.replaceWithText(h);}}return e};var Wn=async({sourceFile:e})=>(e.getFunctions().forEach(t=>{t.getName()==="middleware"&&t.rename("proxy");}),e.getVariableDeclarations().forEach(t=>{t.getName()==="middleware"&&t.rename("proxy");}),e.getExportDeclarations().forEach(t=>{t.getNamedExports().forEach(s=>{s.getName()==="middleware"&&s.setName("proxy"),s.getAliasNode()?.getText()==="middleware"&&s.setAlias("proxy");});}),e);var Cr=[".ts",".tsx",".js",".jsx"],zc=new Set(["tailwindConfig","tailwindCss"]);async function kr(e,t,r){if(!e?.length)return {filesCreated:[],filesUpdated:[],filesSkipped:[]};r={overwrite:false,force:false,silent:false,interactive:true,isRemote:false,isWorkspace:false,...r};let s=j("Updating files.",{silent:r.silent})?.start(),[n,i]=await Promise.all([Y(t.resolvedPaths.cwd),t.tailwind.baseColor?tr(t.tailwind.baseColor):Promise.resolve(void 0)]),o=loadConfig(t.resolvedPaths.cwd),c$1=qc(r.plannedFiles??e,t,{isSrcDir:n?.isSrcDir,framework:n?.framework.name,path:r.path}),a$1=new Project({compilerOptions:{}}),f=[],l=[],u=[],d$1=[],p=null;for(let x=0;x<e.length;x++){let y=e[x];if(!y.content)continue;let w=Qt(y,t,{isSrcDir:n?.isSrcDir,framework:n?.framework.name,commonRoot:er(e.map($=>$.path),y.path),path:r.path,fileIndex:x});if(!w)continue;let v=basename(y.path),b=S__default.dirname(w);if(t.tsx||(w=w.replace(/\.tsx?$/,$=>$===".tsx"?".jsx":".js")),_e(w)&&!existsSync(w)){let $=Ut(b);$&&(w=$);}let R=existsSync(w);if(y.type==="registry:lib"&&basename(y.path)==="utils.ts"&&n?.framework.name==="laravel"&&R){u.push(S__default.relative(t.resolvedPaths.cwd,w));continue}if(R&&statSync(w).isDirectory())throw new Error(`Cannot write to ${w}: path exists and is a directory. Please provide a file path instead.`);let E=y.type==="registry:file"||y.type==="registry:item",k=_e(w)||E?y.content:await Ln({filename:y.path,raw:y.content,config:t,baseColor:i,transformJsx:!t.tsx,isRemote:r.isRemote,supportedFontMarkers:r.supportedFontMarkers},[Bt,Jt,a,Xt,c,g$1,Vn,d,...zn(w,n,t)?[Wn]:[],f$1,Zt]);if(R&&!_e(w)){let $=await Bn({config:t,content:k,filePaths:c$1,project:a$1,projectInfo:n,resolvedPath:w,tsConfig:o}),D=await promises.readFile(w,"utf-8");if(jn(D,$,{ignoreImports:r.isWorkspace})){u.push(S__default.relative(t.resolvedPaths.cwd,w));continue}}if(R&&!r.overwrite&&!_e(w)){if(!r.interactive){u.push(S__default.relative(t.resolvedPaths.cwd,w));continue}s.stop(),r.rootSpinner&&r.rootSpinner.stop();let{overwrite:$}=await Wc({type:"confirm",name:"overwrite",message:`The file ${T.info(v)} already exists. Would you like to overwrite?`,initial:false});if(!$){u.push(S__default.relative(t.resolvedPaths.cwd,w)),r.rootSpinner&&r.rootSpinner.start();continue}s?.start(),r.rootSpinner&&r.rootSpinner.start();}if(zn(w,n,t)&&(w=w.replace(/middleware\.(ts|js)$/,"proxy.$1")),existsSync(b)||await promises.mkdir(b,{recursive:true}),_e(w)&&R){let $=await promises.readFile(w,"utf-8"),D=Kt($,k);if(d$1=Ht($,k),p=S__default.relative(t.resolvedPaths.cwd,w),!d$1.length){u.push(S__default.relative(t.resolvedPaths.cwd,w));continue}await promises.writeFile(w,D,"utf-8"),l.push(S__default.relative(t.resolvedPaths.cwd,w));continue}await promises.writeFile(w,k,"utf-8"),R?l.push(S__default.relative(t.resolvedPaths.cwd,w)):(f.push(S__default.relative(t.resolvedPaths.cwd,w)),_e(w)&&(d$1=Object.keys(Ue(k)),p=S__default.relative(t.resolvedPaths.cwd,w)));}let h=r.interactive?[...f,...l,...u]:[...f,...l],m=await Bc(h,t,c$1);if(l.push(...m),f=Array.from(new Set(f)),l=Array.from(new Set(l.filter(x=>!f.includes(x)))),u=Array.from(new Set(u)),!(f.length||l.length)&&!u.length&&s?.info("No files updated."),f.length){if(s?.succeed(`Created ${f.length} ${f.length===1?"file":"files"}:`),!r.silent)for(let x of f)I.log(` - ${x}`);}else s?.stop();if(l.length&&(j(`Updated ${l.length} ${l.length===1?"file":"files"}:`,{silent:r.silent})?.info(),!r.silent))for(let x of l)I.log(` - ${x}`);if(u.length&&(j(`Skipped ${u.length} ${u.length===1?"file":"files"}: (files might be identical, use --overwrite to overwrite)`,{silent:r.silent})?.info(),!r.silent))for(let x of u)I.log(` - ${x}`);if(d$1.length&&p&&(j(`Added the following variables to ${T.info(p)}:`)?.info(),!r.silent))for(let x of d$1)I.log(` ${T.success("+")} ${x}`);return {filesCreated:f,filesUpdated:l,filesSkipped:u}}function Qt(e,t,r){if(r.path){let i=S__default.isAbsolute(r.path)?r.path:S__default.join(t.resolvedPaths.cwd,r.path);if(/\.[^/\\]+$/.test(i)){if(r.fileIndex===0)return i}else {let c=S__default.basename(e.path);return S__default.join(i,c)}}if(e.target){if(e.target.startsWith("~/"))return S__default.join(t.resolvedPaths.cwd,e.target.replace("~/",""));let i=e.target,o=Uc(i,t);return o?.resolvedPath?o.resolvedPath:(o?.target&&(i=o.target),e.type==="registry:page"&&(i=Gc(i,r.framework),!i)?"":r.isSrcDir?S__default.join(t.resolvedPaths.cwd,"src",i.replace("src/","")):S__default.join(t.resolvedPaths.cwd,i.replace("src/","")))}let s=Hc(e,t),n=Kc(e.path,s);return S__default.join(s,n)}function Uc(e,t){let r=e.match(/^@([^/]+)\/(.+)$/);if(!r)return null;let[,s,n]=r;if(!Sr(s))return {target:`${s}/${n}`};let i=S__default.resolve(t.resolvedPaths[s]),o=S__default.resolve(i,n);if(o!==i&&!o.startsWith(`${i}${S__default.sep}`))throw new Error(`Invalid target path "${e}". Target paths using @${s}/ must stay within the ${s} alias root.`);return {resolvedPath:o}}function Hc(e,t){return e.type==="registry:ui"?t.resolvedPaths.ui:e.type==="registry:lib"?t.resolvedPaths.lib:e.type==="registry:block"||e.type==="registry:component"?t.resolvedPaths.components:e.type==="registry:hook"?t.resolvedPaths.hooks:t.resolvedPaths.components}function er(e,t){let r=e.map(o=>o.replace(/^\//,"")),s=t.replace(/^\//,""),n=s.split("/").slice(0,-1).join("/");if(!n)return "";let i=n.split("/");for(let o=i.length;o>0;o--){let c=i.slice(0,o).join("/");if(r.some(f=>f!==s&&f.startsWith(c+"/")))return "/"+c}return "/"+n}function Kc(e,t){let r=e.replace(/^\/|\/$/g,""),s=t.replace(/^\/|\/$/g,""),n=r.split("/"),i=s.split("/"),o=i[i.length-1],c=n.findIndex(a=>a===o);return c===-1?n[n.length-1]:n.slice(c+1).join("/")}function Gc(e,t){if(!t)return "";if(t==="next-app")return e;if(t==="next-pages"){let r=e.replace(/^app\//,"pages/");return r=r.replace(/\/page(\.[jt]sx?)$/,"$1"),r}if(t==="react-router"){let r=e.replace(/^app\//,"app/routes/");return r=r.replace(/\/page(\.[jt]sx?)$/,"$1"),r}if(t==="laravel"){let r=e.replace(/^app\//,"resources/js/pages/");return r=r.replace(/\/page(\.[jt]sx?)$/,"$1"),r}return ""}async function Bc(e,t,r=e){let s=new Project({compilerOptions:{}}),n=await Y(t.resolvedPaths.cwd),i=loadConfig(t.resolvedPaths.cwd),o=[];if(!n||i.resultType==="failed")return [];for(let c of e){let a=S__default.resolve(t.resolvedPaths.cwd,c);if(!existsSync(a))continue;let f=await promises.readFile(a,"utf-8"),l=await promises.mkdtemp(S__default.join(tmpdir(),"shadcn-")),u=s.createSourceFile(S__default.join(l,basename(a)),f,{scriptKind:ScriptKind.TSX});if(![".tsx",".ts",".jsx",".js"].includes(u.getExtension()))continue;let d=await Bn({config:t,content:f,filePaths:r,project:s,projectInfo:n,resolvedPath:a,sourceFile:u,tsConfig:i});d!==f&&(await promises.writeFile(a,d,"utf-8"),o.push(c));}return o}function qc(e,t,r){return (e??[])?.filter(s=>!!s?.content).map((s,n)=>{let i=Qt(s,t,{isSrcDir:r.isSrcDir,framework:r.framework,commonRoot:er((e??[]).map(o=>o.path),s.path),path:r.path,fileIndex:n});return i?(t.tsx||(i=i.replace(/\.tsx?$/,o=>o===".tsx"?".jsx":".js")),S__default.relative(t.resolvedPaths.cwd,i)):null}).filter(s=>!!s)}async function Bn({content:e,resolvedPath:t,filePaths:r,config:s,projectInfo:n,tsConfig:i,project:o,sourceFile:c}){if(!n||i.resultType==="failed")return e;let a=S__default.extname(t);if(![".tsx",".ts",".jsx",".js"].includes(a))return e;let f=c===void 0?o.createSourceFile(S__default.join(tmpdir(),`shadcn-${Math.random().toString(36).slice(2)}${a||".tsx"}`),e,{scriptKind:ScriptKind.TSX,overwrite:true}):null,l=c??f;try{let u=!1;for(let d of l.getImportDeclarations()){let p=d.getModuleSpecifierValue();if(!Cn(p,n.aliasPrefix??null))continue;let h=await Jc(p,r,s,i);if(!h)continue;let m=Zc(h,s,n,t);!m||m===p||(d.setModuleSpecifier(m),u=!0);}return u?l.getFullText():e}finally{f&&o.removeSourceFile(f);}}async function Jc(e,t,r,s){let n=(await Ft(e,{...s,cwd:r.resolvedPaths.cwd}))?.path,i=!n&&!e.startsWith(".")?Qc(e,r):null;return !n&&!i?null:Yc(n??i,t,r)}function Yc(e,t,r,s=[".tsx",".ts",".js",".jsx",".css"]){let n=S__default.normalize(r.resolvedPaths.cwd),i=t.map(g=>g.split(S__default.sep).join(S__default.posix.sep)),o=new Set(i),c=S__default.extname(e),a=c!=="",f=a?e.slice(0,-c.length):e,u=S__default.relative(n,f).split(S__default.sep).join(S__default.posix.sep),d=a?[c]:s,p=new Set;for(let g of d){let x=f+g,y=S__default.posix.normalize(S__default.relative(n,x));(o.has(y)||existsSync(x))&&p.add(y);let w=S__default.join(f,`index${g}`),v=S__default.posix.normalize(S__default.relative(n,w));(o.has(v)||existsSync(w))&&p.add(v);}let h=S__default.basename(f);for(let g of i)d.some(x=>g.endsWith(`/${h}${x}`))&&p.add(g);return p.size===0?null:Array.from(p).sort((g,x)=>{let y=S__default.posix.extname(g),w=S__default.posix.extname(x),v=d.indexOf(y)-d.indexOf(w);if(v!==0)return v;let b=u&&g.startsWith(u)?-1:1,R=u&&x.startsWith(u)?-1:1;return b-R})[0]}function Zc(e,t,r,s){let n=S__default.normalize(S__default.join(t.resolvedPaths.cwd,e)),i=Object.entries(t.resolvedPaths).filter(([h,m])=>{if(!m||zc.has(h))return false;let g=S__default.normalize(m);if(n===g){let x=t.aliases[h];if(typeof x!="string"||!x.startsWith("#"))return true;let y=ct(x,t.resolvedPaths.cwd);return y!==null&&!y.matchedAlias.includes("*")}return n.startsWith(S__default.normalize(m+S__default.sep))}).sort((h,m)=>m[1].length-h[1].length);if(i.length===0)return null;let[o,c]=i[0],a=S__default.relative(c,n);a=a.split(S__default.sep).join("/");let f=o==="cwd"?r.aliasPrefix:t.aliases[o];if(!f)return null;if(f.startsWith("#")){let h=ct(f,t.resolvedPaths.cwd);if(h)return Xc(f,a,h)??(s?tl(s,n):null)}let l=S__default.posix.extname(a),u=Cr.includes(l)?"":l,d=a.slice(0,a.length-l.length);d.endsWith("/index")&&(d=d.slice(0,-6));let p=d===""?"":`/${d}`;return p=p.replace("/src",""),`${f}${p}${u}`}function Xc(e,t,r){let s=S__default.posix.extname(t),n=Cr.includes(s)&&r.emitMode==="strip_extension"?"":s,i=t?t.slice(0,t.length-s.length)+n:"";return r.matchedAlias.includes("*")?i?`${e}/${i}`:e:i===""||i==="index"?e:null}function Qc(e,t){let r=el(t);for(let s of r){if(e===s.alias||e===s.canonical)return s.rootPath;if(e.startsWith(`${s.alias}/`))return S__default.join(s.rootPath,e.slice(s.alias.length+1));if(e.startsWith(`${s.canonical}/`))return S__default.join(s.rootPath,e.slice(s.canonical.length+1))}return null}function el(e){return [{alias:e.aliases.ui,canonical:"@/components/ui",rootPath:e.resolvedPaths.ui},{alias:e.aliases.components,canonical:"@/components",rootPath:e.resolvedPaths.components},{alias:e.aliases.hooks,canonical:"@/hooks",rootPath:e.resolvedPaths.hooks},{alias:e.aliases.lib,canonical:"@/lib",rootPath:e.resolvedPaths.lib},{alias:e.aliases.utils,canonical:"@/lib/utils",rootPath:e.resolvedPaths.utils}].filter(t=>typeof t.alias=="string"&&typeof t.rootPath=="string").sort((t,r)=>r.alias.length-t.alias.length||r.canonical.length-t.canonical.length)}function tl(e,t){let r=S__default.relative(S__default.dirname(e),t);r=r.split(S__default.sep).join("/");let s=S__default.posix.extname(r),n=Cr.includes(s)?"":s,i=r.slice(0,r.length-s.length);return i.endsWith("/index")&&(i=i.slice(0,-6)),i.startsWith(".")||(i=`./${i}`),`${i}${n}`}function zn(e,t,r){let s=e===S__default.join(r.resolvedPaths.cwd,"middleware.ts")||e===S__default.join(r.resolvedPaths.cwd,"middleware.js"),n=t?.framework.name==="next-app"||t?.framework.name==="next-pages";if(!s||!n||!t?.frameworkVersion)return false;let i=parseInt(t.frameworkVersion.split(".")[0]);return !isNaN(i)&&i>=16}new Project({compilerOptions:{}});function M(e){try{return new URL(e),!0}catch{return false}}function xe(e){return e.endsWith(".json")&&!M(e)}function Jn(e){return !e||e.type!=="registry:item"&&e.type!=="registry:file"?false:(e.files??[]).every(r=>!!r.target&&(r.type==="registry:file"||r.type==="registry:item"))}async function Yn(e,t){if(!sl(t))return z.array(g).parse(e.flat().filter(Boolean));let r=await Y(t.resolvedPaths.cwd),s=new Map,n=z.array(g).parse(e.flat().filter(Boolean));return n.forEach(i=>{let o=Qt(i,t,{isSrcDir:r?.isSrcDir,framework:r?.framework.name,commonRoot:er(n.map(c=>c.path),i.path)});o&&s.set(o,i);}),Array.from(s.values())}function sl(e){return !!(e?.resolvedPaths?.cwd&&(e?.resolvedPaths?.ui||e?.resolvedPaths?.lib||e?.resolvedPaths?.components||e?.resolvedPaths?.hooks))}var nl=/^(?!.*--)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,37}[a-zA-Z0-9])?$/,il=/^[a-zA-Z0-9._-]+$/,ol=new Set([".",".."]),al=/[\x00-\x1F\x7F]/,cl=/\s/,ll=/^-/;function ft(e){if(M(e))return {scheme:"url",url:e};if(xe(e))return {scheme:"file",path:e};let{registry:t,item:r}=he(e);if(t)return {scheme:"namespace",namespace:t,item:r};let s=ul(e);return s||{scheme:"shadcn",item:e}}function rr(e){return ft(e).scheme==="github"}function pt(e){let t=e.indexOf("#"),r=t===-1?e:e.slice(0,t),s=t===-1?void 0:e.slice(t+1),n=r.split("/");if(n.length!==2)return null;let[i,o]=n;if(!Xn(i)||!Qn(o))return null;if(s!==void 0&&!ei(s))throw new P(`Invalid GitHub ref in registry source "${e}".`,{context:{source:e,ref:s},suggestion:"Use a non-empty branch, tag, or commit SHA without whitespace, control characters or leading dashes."});return {owner:i,repo:o,ref:s}}function Zn(e){return pt(e)!==null}function ul(e){let t=e.indexOf("#"),r=t===-1?e:e.slice(0,t),s=t===-1?void 0:e.slice(t+1),n=r.split("/");if(n.length<3)return null;let[i,o,...c]=n;if(!Xn(i)||!Qn(o))return null;let a=c.join("/");if(!a)return null;if(s!==void 0&&!ei(s))throw new P(`Invalid GitHub ref in item address "${e}".`,{context:{address:e,ref:s},suggestion:"Use a non-empty branch, tag, or commit SHA without whitespace, control characters or leading dashes."});return {scheme:"github",owner:i,repo:o,item:a,ref:s}}function Xn(e){return nl.test(e)}function Qn(e){return il.test(e)&&!ol.has(e)}function ei(e){return !!e&&!al.test(e)&&!cl.test(e)&&!ll.test(e)}var Ke=new AsyncLocalStorage,$r={headers:{}};function ve(e,t={}){let r=Ke.getStore();return Ke.run({headers:{},env:t.env??r?.env},e)}function dt(e){let t=Ke.getStore()??$r;t.headers={...t.headers,...e};}function ti(e){return (Ke.getStore()??$r).headers[e]||{}}function sr(e){let t=Ke.getStore();return t?.env?t.env[e]:process.env[e]}function ri(){let e=Ke.getStore()??$r;e.headers={};}function ht(e){return e.replace(/\${(\w+)}/g,(t,r)=>sr(r)||"")}function mt(e){let t=[],r=/\${(\w+)}/g,s;for(;(s=r.exec(e))!==null;)t.push(s[1]);return t}function dl(e){return e.style?e.style==="new-york"&&e.tailwind?.config===""?$t:e.style:$t}function ne(e){let t=Pn({style:$t,registries:H});return e?d$1.parse(Be(t,{...e,style:dl(e),registries:{...H,...e.registries}})):t}function hl(e){let t=new Set;return typeof e=="string"?mt(e).forEach(r=>t.add(r)):(mt(e.url).forEach(r=>t.add(r)),e.params&&Object.values(e.params).forEach(r=>{mt(r).forEach(s=>t.add(s));}),e.headers&&Object.values(e.headers).forEach(r=>{mt(r).forEach(s=>t.add(s));})),Array.from(t)}function si(e,t){let s=hl(t).filter(n=>!sr(n));if(s.length>0)throw new nt(e,s)}function vy(e,t){for(let r of e)Zn(r)||Ge(r,ne(t));ri();}var ni="{name}",nr="{style}",ii=/\${(\w+)}/g,oi="?",ml="&";function gl(e){return e.startsWith("./")||e.startsWith("/")}function Ge(e,t){let{registry:r,item:s}=he(e);if(!r){if(M(e)||xe(e)||gl(e)||rr(e))return null;r="@shadcn";}let i={...H,...t?.registries}[r];if(!i)throw new de(r);return si(r,i),{url:yl(s,i,t),headers:wl(i)}}function yl(e,t,r){if(typeof t=="string"){let n=t.replace(ni,e);return r?.style&&n.includes(nr)&&(n=n.replace(nr,r.style)),ht(n)}let s=t.url.replace(ni,e);return r?.style&&s.includes(nr)&&(s=s.replace(nr,r.style)),s=ht(s),t.params?xl(s,t.params):s}function wl(e){if(typeof e=="string"||!e.headers)return {};let t={};for(let[r,s]of Object.entries(e.headers)){let n=ht(s);vl(s,n)&&(t[r]=n);}return t}function xl(e,t){let r=new URLSearchParams;for(let[i,o]of Object.entries(t)){let c=ht(o);c&&r.append(i,c);}let s=r.toString();if(!s)return e;let n=e.includes(oi)?ml:oi;return `${e}${n}${s}`}function vl(e,t){let r=t.trim();if(!r)return false;if(e.includes("${")&&e.match(ii)){let n=e.replace(ii,"").trim();return r!==n}return true}function ir(e){if(M(e)){let t=new URL(e);return t.pathname.match(/\/chat\/b\//)&&!t.pathname.endsWith("/json")&&(t.pathname=`${t.pathname}/json`),t.toString()}return `${Ae}/${e}`}var Rl=process.env.https_proxy||process.env.HTTPS_PROXY||process.env.http_proxy||process.env.HTTP_PROXY?new EnvHttpProxyAgent:void 0,Sl=5,Il=new Set(["accept","user-agent"]);async function or(e,t){let r=new URL(e).origin,s=new Headers(t?.headers),n=new URL(e).toString(),i=s;for(let o=0;o<=Sl;o++){let c=await El(n,t,i);if(!(c.status>=300&&c.status<400&&c.headers.has("location")))return c;let f=c.headers.get("location"),l=new URL(f,n);if(l.origin!==r){let u=new Headers;s.forEach((d,p)=>{Il.has(p.toLowerCase())&&u.set(p,d);}),i=u;}else i=s;n=l.toString();}throw new Error(`Too many redirects while fetching ${e}`)}async function El(e,t,r){try{return await fetch(e,{...t,headers:r,redirect:"manual",dispatcher:Rl})}catch(s){let n=s instanceof TypeError?s.cause:void 0;if(n){let i=new Error(`Request to ${e} failed, reason: ${ai(n)}`);throw i.cause=n,i}throw s}}function ai(e){if(e instanceof Error&&"errors"in e){let t=e.errors;if(Array.isArray(t)&&t.length)return ai(t[0])}return e instanceof Error?e.message||e.code||"unknown error":String(e)}var Pr=new Map;async function U(e,t={}){t={useCache:true,...t};try{return await Promise.all(e.map(async s=>{let n=ir(s),i=ti(n),o=Pl(n,i);if(t.useCache&&Pr.has(o))return Pr.get(o);let c=(async()=>{let a=new Headers({Accept:"application/vnd.shadcn.v1+json, application/json;q=0.9","User-Agent":"shadcn"});for(let[l,u]of Object.entries(i))a.set(l,u);let f=await or(n,{headers:a});if(!f.ok){let l;if(f.headers.get("content-type")?.includes("application/json")){let u=await f.json(),d=z.object({detail:z.string().optional(),title:z.string().optional(),message:z.string().optional(),error:z.string().optional()}).safeParse(u);d.success&&(l=d.data.detail||d.data.message,d.data.error&&(l=`[${d.data.error}] ${l}`));}throw f.status===401?new tt(n,l):f.status===404?new je(n,l):f.status===410?new Pt(n,l):f.status===403?new rt(n,l):new st(n,f.status,l)}return f.json()})();return t.useCache&&Pr.set(o,c),c}))}catch(r){throw r}}function Pl(e,t){let r=Object.entries(t).map(([n,i])=>[n.toLowerCase(),i]).sort(([n],[i])=>n.localeCompare(i)),s=createHash("sha256").update(JSON.stringify(r)).digest("hex");return `${e}:${s}`}async function li(e){try{let t=e;e.startsWith("~/")&&(t=S__default.join(homedir(),e.slice(2)));let r=S__default.resolve(t),s=await promises.readFile(r,"utf8"),n$1=JSON.parse(s);try{return n.parse(n$1)}catch(i){throw new W(e,i)}}catch(t){throw t instanceof Error&&(t.message.includes("ENOENT")||t.message.includes("no such file"))?new ae(e,t):t instanceof W?t:new ae(e,t)}}var Al="https://github.com",ui=/^[a-fA-F0-9]{40}$/,jl=15e3;async function fi(e,t={}){let r=e.ref??"HEAD";if(ui.test(r))return r.toLowerCase();let s=`${e.owner}/${e.repo}#${r}`;if(t.cache?.has(s))return t.cache.get(s);let n=Ol(e,r).catch(i=>{throw t.cache?.delete(s),i});return t.cache?.set(s,n),n}async function Ol(e,t){let r=`${Al}/${e.owner}/${e.repo}.git`,s=Nl(t),n;try{n=(await execa("git",["ls-remote","--symref","--",r,...s],{env:{GIT_TERMINAL_PROMPT:"0"},timeout:jl})).stdout;}catch(o){throw Fl(e,t,r,o)}let i=_l(n);for(let o of pi(t)){let c=i.get(o);if(c)return c}throw new K("registry.json",void 0,{message:`Could not resolve GitHub ref "${t}" for ${e.owner}/${e.repo}.`,context:{reason:"github-ref-resolution",source:di(e),ref:t,repoUrl:r},suggestion:'Use an existing branch, tag, or full commit SHA. For example: "owner/repo/item#main" or "owner/repo/item#v1.0.0".'})}function Nl(e){return Array.from(new Set(pi(e)))}function pi(e){return e==="HEAD"?["HEAD"]:e.startsWith("refs/tags/")?[`${e}^{}`,e]:e.startsWith("refs/")?[e]:[`refs/heads/${e}`,`refs/tags/${e}^{}`,`refs/tags/${e}`,e]}function _l(e){let t=new Map;for(let r of e.split(`
35
+ `)){let s=r.trim();if(!s||s.startsWith("ref:"))continue;let[n,i]=s.split(/\s+/);n&&i&&ui.test(n)&&t.set(i,n.toLowerCase());}return t}function Fl(e,t,r,s){return new K("registry.json",s,{message:`Failed to resolve GitHub ref "${t}" for ${e.owner}/${e.repo}.`,context:{reason:"github-ref-resolution",source:di(e),ref:t,repoUrl:r},suggestion:Ml(s)})}function Ml(e){return Dl(e)?"Install Git and try again. Git is required to resolve GitHub registry refs.":Ll(e)?"GitHub ref resolution timed out. Check your network connection and try again.":"Check that the public GitHub repository exists and the ref is accessible."}function Dl(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="ENOENT"}function Ll(e){return typeof e=="object"&&e!==null&&"timedOut"in e&&e.timedOut===true}function di(e){return `${e.owner}/${e.repo}#${e.ref??"HEAD"}`}async function Tr(e,t,r={}){let s=Ei(r.registryFile??"registry.json"),n=await gi(s,t,{source:r.source}),i=n.registry.items.find(o=>o.name===e);if(!i)throw new Oe(e);return Vl(i,n,t)}async function Ar(e,t={}){let r=Ei(t.registryFile??"registry.json"),s=await gi(r,e,{source:t.source});return Wl(s)}async function gi(e,t,r={}){let s=await vi(e,t,r),n=bi(s,e);hi(n,e);let i={itemSources:new Map,itemSourcesByItem:new Map,firstIncludedFrom:new Map},o=!!n.include?.length;if(!o){let l=Ii(e);return n.items.forEach((u,d)=>{Si(u,e,l);let p={registryFile:e,registryDir:l,itemIndex:d};i.itemSources.set(u.name,p),i.itemSourcesByItem.set(u,p);}),mi(n.items,i.itemSourcesByItem),{registry:n,itemSources:i.itemSources,itemSourcesByItem:i.itemSourcesByItem,usesInclude:o}}if(S__default.posix.basename(e)!=="registry.json")throw new P(`Invalid source registry file at ${e}: registries that use include must be named registry.json.`,{registryFile:e});let c=await xi(e,n,t,i,[]);mi(c.items,i.itemSourcesByItem);let{include:a,...f}=c;return hi(f,e),{registry:f,itemSources:i.itemSources,itemSourcesByItem:i.itemSourcesByItem,usesInclude:o}}async function Vl(e,t,r){let s={...yi(e,t.itemSourcesByItem),$schema:"https://ui.shadcn.com/schema/registry-item.json"};return await Promise.all((e.files??[]).map(async(n,i)=>{let o=s.files?.[i];if(!o)return;let c=t.itemSourcesByItem.get(e),a=wi(e,n.path,t.itemSourcesByItem);o.content=await zl(e.name,n.path,a,c,r);})),n.parse(s)}function Wl(e){return {...e.registry,items:e.registry.items.map(t=>Ul(yi(t,e.itemSourcesByItem)))}}async function zl(e,t,r,s,n){try{return await n.readText(r)}catch(i){let o=i instanceof K&&i.context?.reason==="github-source-file";throw new K(r,i,{message:`Failed to read file "${t}" for registry item "${e}" (${yt(s)}). Expected file at ${r}.`,context:{registryFile:s?.registryFile,itemIndex:s?.itemIndex,itemName:e,itemFilePath:t,sourcePath:r},suggestion:o&&i.suggestion?i.suggestion:"Make sure the file path is relative to the registry.json file that declares the item."})}}function yi(e,t){return {...e,files:e.files?.map(r=>({...r,path:Hl(e,r.path,t)}))}}function Ul(e){return {...e,files:e.files?.map(({content:t,...r})=>r)}}function wi(e,t,r){let s=r.get(e);return jr(s?.registryDir??".",t)}function Hl(e,t,r){let s=wi(e,t,r);return Gl(".",s)}async function xi(e,t,r,s,n){if(Ri(e),n.length>=32)throw new P(`Registry include tree is too deep at ${e}. The maximum include depth is 32.`,{registryFile:e,context:{maxDepth:32},suggestion:"Flatten part of the registry include tree or reduce nested include depth."});if(n.includes(e))throw new P(Bl([...n,e]),{registryFile:e});let i=n.at(-1)??e,o=s.firstIncludedFrom.get(e);if(o)throw new P(`Registry file included more than once: ${e}.
36
+ - first included from ${o}
37
+ - included again from ${i}
38
+ Each registry.json file can only appear once in the resolved include tree. Remove one include or move shared items into a single included registry.json.`,{registryFile:e,context:{firstSource:o,secondSource:i}});s.firstIncludedFrom.set(e,i);let c=[...n,e],a=Ii(e),f=[];for(let l of t.include??[]){let u=Kl(l,a,e),d=await vi(u,r),p=bi(d,u),h=await xi(u,p,r,s,c);f.push(...h.items);}return t.items?.forEach((l,u)=>{Si(l,e,a),s.itemSources.set(l.name,{registryFile:e,registryDir:a,itemIndex:u}),s.itemSourcesByItem.set(l,{registryFile:e,registryDir:a,itemIndex:u});}),{...t,items:[...f,...t.items??[]]}}async function vi(e,t,r={}){try{return await t.readText(e)}catch(s){throw s instanceof K&&(s.context?.reason==="github-ref-resolution"||s.context?.reason==="github-source-file")?s:new K(e,s,{message:`Failed to read source registry file at ${ql(e,r.source)}.`,context:{registryFile:e,source:r.source},suggestion:e==="registry.json"?"Check that the repository has a registry.json file at its root.":"Check that the included registry.json file exists and that the include path is correct."})}}function bi(e,t){let r;try{r=JSON.parse(e);}catch(n){throw new W(t,n,{subject:"registry file",context:{registryFile:t},suggestion:"Fix the JSON syntax in the registry.json file and try again."})}let s=p.safeParse(r);if(!s.success)throw new P(`Invalid registry file at ${t}:
39
+ ${Jl(s.error)}`,{registryFile:t,cause:s.error,suggestion:"Update the registry.json file so it matches the registry schema."});return s.data}function hi(e,t){let r=[];if(e.name||r.push("name"),e.homepage||r.push("homepage"),r.length)throw new P(`Invalid root registry file at ${t}: root registry.json must define ${r.map(s=>`"${s}"`).join(" and ")}. Included registry.json files may omit these fields.`,{registryFile:t})}function Kl(e,t,r){if(M(e))throw new P(`Invalid include "${e}" in ${r}: remote includes are not supported by shadcn build. Use a relative path to a registry.json file in the same repository.`,{registryFile:r,context:{includePath:e}});if(S__default.posix.isAbsolute(e))throw new P(`Invalid include "${e}" in ${r}: include paths must be relative. Use a path like "./registry/ui/registry.json".`,{registryFile:r,context:{includePath:e}});if(ki(e))throw new P(`Invalid include "${e}" in ${r}: include paths cannot use parent-directory traversal. Keep included registry.json files inside the registry root.`,{registryFile:r,context:{includePath:e}});if(S__default.posix.basename(e)!=="registry.json")throw new P(`Invalid include "${e}" in ${r}: include paths must explicitly reference a registry.json file. Use a path like "./registry/ui/registry.json".`,{registryFile:r,context:{includePath:e}});let s=jr(t,e);return Ri(s),s}function Ri(e){if(!Ci(e))throw new P(`Invalid registry file at ${e}: registry includes must stay inside the source registry root.`,{registryFile:e})}function Si(e,t,r){for(let s of e.files??[]){if(M(s.path))throw new P(`Invalid file path "${s.path}" for item "${e.name}" in ${t}: remote file paths are not supported by shadcn build.`,{registryFile:t,context:{itemName:e.name,filePath:s.path}});if(S__default.posix.isAbsolute(s.path))throw new P(`Invalid file path "${s.path}" for item "${e.name}" in ${t}: file paths must be relative.`,{registryFile:t,context:{itemName:e.name,filePath:s.path}});if(ki(s.path))throw new P(`Invalid file path "${s.path}" for item "${e.name}" in ${t}: file paths cannot use parent-directory traversal.`,{registryFile:t,context:{itemName:e.name,filePath:s.path}});let n=jr(r,s.path);if(!Ci(n,r))throw new P(`Invalid file path "${s.path}" for item "${e.name}" in ${t}: file paths must stay inside the registry chunk directory.`,{registryFile:t,context:{itemName:e.name,filePath:s.path}})}}function mi(e,t){let r=new Map;for(let s of e){let n=r.get(s.name);if(!n){r.set(s.name,s);continue}let i=t.get(n),o=t.get(s);throw new P(`Duplicate registry item name "${s.name}". Registry item names must be unique.
40
+ - ${yt(i)}
41
+ - ${yt(o)}
42
+ Rename one of these items so each name is unique across the resolved registry.`,{context:{itemName:s.name,firstSource:yt(i),secondSource:yt(o)}})}}function Ii(e){let t=S__default.posix.dirname(e);return t==="."?".":t}function jr(...e){let t=S__default.posix.normalize(S__default.posix.join(...e));return t==="."?"":t}function Ei(e){let t=S__default.posix.normalize(e);return t.startsWith("./")?t.slice(2):t}function Gl(e,t){return S__default.posix.relative(e,t)||S__default.posix.basename(t)}function Ci(e,t="."){let r=S__default.posix.relative(t,e);return !!r&&!r.startsWith("..")&&!S__default.posix.isAbsolute(r)}function ki(e){return e.split(/[\\/]+/).includes("..")}function Bl(e){return `Registry include cycle detected:
43
+ ${e.map(t=>` - ${t}`).join(`
44
+ `)}`}function yt(e){return e?`${e.registryFile} items[${e.itemIndex}]`:"unknown source"}function ql(e,t){return t?`${t}/${e}`:e}function Jl(e){return e.errors.map(t=>` - ${t.path.length?t.path.join("."):"(root)"}: ${t.message}`).join(`
45
+ `)}var Yl="https://raw.githubusercontent.com",Zl=8;async function Pi(e,t={}){t={...t,sourceCache:t.sourceCache??new Map};let r=Or(e,t);return Tr(e.item,r,{source:Fe(e)})}async function Ti(e,t={}){t={...t,sourceCache:t.sourceCache??new Map};let r=Or(e,t);return Ar(r,{source:Fe(e)})}async function tw(e,t={}){let r=Fe(e),s=`${r}/registry.json`,n=new Set,i=t.sourceCache??new Map,o={...t,sourceCache:i},c=Or(e,o),a={async readText(f){return f.endsWith("registry.json")&&n.add(`${r}/${f}`),c.readText(f)}};try{let f=await Ar(a,{source:r}),u=(await eu(f.items,Zl,async(d,p)=>{try{return await Tr(d.name,a,{source:r}),null}catch(h){return $i(h,{defaultRegistryFile:s,itemName:d.name,itemIndex:p,sourceLabel:r})}})).filter(d=>d!==null);return {valid:u.length===0,cwd:r,registryFiles:n.size,registryFilePaths:Array.from(n),items:f.items.length,diagnostics:u}}catch(f){return {valid:false,cwd:r,registryFiles:n.size||1,registryFilePaths:n.size?Array.from(n):[s],items:0,diagnostics:[$i(f,{defaultRegistryFile:s,sourceLabel:r})]}}}function Or(e,t){let r=fi(e,{cache:t.sourceCache});return {async readText(s){let n=await r,i=Ql(e,n,s);if(t.useCache!==false&&t.sourceCache?.has(i))return t.sourceCache.get(i);let o=Xl(i,s,e);return t.useCache!==false&&t.sourceCache?.set(i,o),o}}}async function Xl(e,t,r){let s;try{s=await or(e,{headers:new Headers({"Accept-Encoding":"identity","User-Agent":"shadcn"})});}catch(n){throw new K(t,n,{message:`Failed to read GitHub source file "${t}" from ${Fe(r)}.`,context:{reason:"github-source-file",url:e,source:Fe(r),filePath:t},suggestion:"GitHub ref resolution succeeded, but the CLI could not fetch from raw.githubusercontent.com. Check that raw.githubusercontent.com is accessible from this network."})}if(!s.ok)throw new K(t,void 0,{message:`Failed to read GitHub source file "${t}" from ${Fe(r)}.`,context:{reason:"github-source-file",url:e,statusCode:s.status,source:Fe(r),filePath:t},suggestion:t==="registry.json"?"The GitHub repository and ref were resolved, but raw.githubusercontent.com did not return a root registry.json file. Check that the public repository has registry.json at its root and that raw.githubusercontent.com is accessible from this network.":"Check that the file path exists in the public GitHub repository."});return s.text()}function Ql(e,t,r){let s=r.split("/").map(n=>encodeURIComponent(n)).join("/");return `${Yl}/${e.owner}/${e.repo}/${t}/${s}`}async function eu(e,t,r){let s=new Array(e.length),n=0,i=Math.min(t,e.length),o=Array.from({length:i},async()=>{for(;n<e.length;){let c=n++;s[c]=await r(e[c],c);}});return await Promise.all(o),s}function Fe(e){return `${e.owner}/${e.repo}#${e.ref??"HEAD"}`}function $i(e,t){return e instanceof _?{registryFile:typeof e.context?.registryFile=="string"?`${t.sourceLabel}/${e.context.registryFile}`:t.defaultRegistryFile,itemName:t.itemName,itemIndex:typeof e.context?.itemIndex=="number"?e.context.itemIndex:t.itemIndex,filePath:typeof e.context?.itemFilePath=="string"?e.context.itemFilePath:typeof e.context?.filePath=="string"?e.context.filePath:void 0,includePath:typeof e.context?.includePath=="string"?e.context.includePath:void 0,message:e.message,suggestion:e.suggestion}:{registryFile:t.defaultRegistryFile,itemName:t.itemName,itemIndex:t.itemIndex,message:e instanceof Error?e.message:"Unknown error."}}async function _r(e,t,r){if(!e||(r={silent:false,tailwindVersion:"v3",...r},r.tailwindVersion==="v4"))return;let s=S__default.relative(t.resolvedPaths.cwd,t.resolvedPaths.tailwindConfig),n=j(`Updating ${T.info(s)}`,{silent:r.silent}).start(),i=await promises.readFile(t.resolvedPaths.tailwindConfig,"utf8"),o=await ou(i,e,t);await promises.writeFile(t.resolvedPaths.tailwindConfig,o,"utf8"),n?.succeed();}async function ou(e,t,r){let s=await ji(e,r),n=s.getDescendantsOfKind(SyntaxKind.ObjectLiteralExpression).find(o=>o.getProperties().some(c=>c.isKind(SyntaxKind.PropertyAssignment)&&c.getName()==="content"));if(!n)return e;let i=uu(n);return au(n,{name:"darkMode",value:"class"},{quoteChar:i}),t.plugins?.forEach(o=>{lu(n,o);}),t.theme&&await cu(n,t.theme),s.getFullText()}function au(e,t,{quoteChar:r}){let s=e.getProperty("darkMode");if(!s){let n={name:t.name,initializer:`[${r}${t.value}${r}]`};return t.name==="darkMode"?(e.insertPropertyAssignment(0,n),e):(e.addPropertyAssignment(n),e)}if(s.isKind(SyntaxKind.PropertyAssignment)){let n=s.getInitializer(),i=`${r}${t.value}${r}`;if(n?.isKind(SyntaxKind.StringLiteral)){let o=n.getText();return n.replaceWithText(`[${o}, ${i}]`),e}if(n?.isKind(SyntaxKind.ArrayLiteralExpression)){if(n.getElements().map(o=>o.getText()).includes(i))return e;n.addElement(i);}return e}return e}async function cu(e,t){e.getProperty("theme")||e.addPropertyAssignment({name:"theme",initializer:"{}"}),Fr(e);let s=(e.getPropertyOrThrow("theme")?.asKindOrThrow(SyntaxKind.PropertyAssignment)).getInitializer();if(s?.isKind(SyntaxKind.ObjectLiteralExpression)){let n=s.getText(),i=await fu(n),o=Be(i,t,{arrayMerge:(a,f)=>f}),c=su(o).replace(/\'\.\.\.(.*)\'/g,"...$1").replace(/\'\"/g,"'").replace(/\"\'/g,"'").replace(/\'\[/g,"[").replace(/\]\'/g,"]").replace(/\'\\\'/g,"'").replace(/\\\'/g,"'").replace(/\\\'\'/g,"'").replace(/\'\'/g,"'");s.replaceWithText(c);}Mr(e);}function lu(e,t){let r=e.getProperty("plugins");if(!r)return e.addPropertyAssignment({name:"plugins",initializer:`[${t}]`}),e;if(r.isKind(SyntaxKind.PropertyAssignment)){let s=r.getInitializer();if(s?.isKind(SyntaxKind.ArrayLiteralExpression)){if(s.getElements().map(n=>n.getText().replace(/["']/g,"")).includes(t.replace(/["']/g,"")))return e;s.addElement(t);}return e}return e}async function ji(e,t){let r=await promises.mkdtemp(S__default.join(tmpdir(),"shadcn-")),s=t?.resolvedPaths?.tailwindConfig||"tailwind.config.ts",n=S__default.join(r,`shadcn-${S__default.basename(s)}`);return new Project({compilerOptions:{}}).createSourceFile(n,e,{scriptKind:S__default.extname(s)===".ts"?ScriptKind.TS:ScriptKind.JS})}function uu(e){return e.getFirstDescendantByKind(SyntaxKind.StringLiteral)?.getQuoteKind()===QuoteKind.Single?"'":'"'}function Fr(e){let t=e.getProperties();for(let r=0;r<t.length;r++){let s=t[r];if(s.isKind(SyntaxKind.SpreadAssignment)){let n=s.asKindOrThrow(SyntaxKind.SpreadAssignment),i=n.getExpression().getText();e.insertPropertyAssignment(r,{name:`"___${i.replace(/^\.\.\./,"")}"`,initializer:`"...${i.replace(/^\.\.\./,"")}"`}),n.remove();}else if(s.isKind(SyntaxKind.PropertyAssignment)){let i=s.asKindOrThrow(SyntaxKind.PropertyAssignment).getInitializer();i&&i.isKind(SyntaxKind.ObjectLiteralExpression)?Fr(i.asKindOrThrow(SyntaxKind.ObjectLiteralExpression)):i&&i.isKind(SyntaxKind.ArrayLiteralExpression)&&Oi(i.asKindOrThrow(SyntaxKind.ArrayLiteralExpression));}}}function Oi(e){let t=e.getElements();for(let r=0;r<t.length;r++){let s=t[r];if(s.isKind(SyntaxKind.ObjectLiteralExpression))Fr(s.asKindOrThrow(SyntaxKind.ObjectLiteralExpression));else if(s.isKind(SyntaxKind.ArrayLiteralExpression))Oi(s.asKindOrThrow(SyntaxKind.ArrayLiteralExpression));else if(s.isKind(SyntaxKind.SpreadElement)){let n=s.getText();e.removeElement(r),e.insertElement(r,`"${n}"`);}}}function Mr(e){let t=e.getProperties();for(let r=0;r<t.length;r++){let s=t[r];if(s.isKind(SyntaxKind.PropertyAssignment)){let n=s,i=n.getInitializer();if(i&&i.isKind(SyntaxKind.StringLiteral)){let o=i.asKindOrThrow(SyntaxKind.StringLiteral).getLiteralValue();o.startsWith("...")&&(e.insertSpreadAssignment(r,{expression:o.slice(3)}),n.remove());}else i?.isKind(SyntaxKind.ObjectLiteralExpression)?Mr(i):i&&i.isKind(SyntaxKind.ArrayLiteralExpression)&&Ni(i.asKindOrThrow(SyntaxKind.ArrayLiteralExpression));}}}function Ni(e){let t=e.getElements();for(let r=0;r<t.length;r++){let s=t[r];if(s.isKind(SyntaxKind.ObjectLiteralExpression))Mr(s.asKindOrThrow(SyntaxKind.ObjectLiteralExpression));else if(s.isKind(SyntaxKind.ArrayLiteralExpression))Ni(s.asKindOrThrow(SyntaxKind.ArrayLiteralExpression));else if(s.isKind(SyntaxKind.StringLiteral)){let n=s.getText(),i=/(?:^['"])(\.\.\..*)(?:['"]$)/g;i.test(n)&&(e.removeElement(r),e.insertElement(r,n.replace(i,"$1")));}}}async function fu(e){let r=(await ji(`const theme = ${e}`,null)).getStatements()[0];if(r?.getKind()===SyntaxKind.VariableStatement){let n=(r.getDeclarationList()?.getDeclarations()[0]).getInitializer();if(n?.isKind(SyntaxKind.ObjectLiteralExpression))return await ar(n)}throw new Error("Invalid input: not an object literal")}function ar(e){let t={};for(let r of e.getProperties())if(r.isKind(SyntaxKind.PropertyAssignment)){let s=r.getName().replace(/\'/g,"");r.getInitializer()?.isKind(SyntaxKind.ObjectLiteralExpression)?t[s]=ar(r.getInitializer()):r.getInitializer()?.isKind(SyntaxKind.ArrayLiteralExpression)?t[s]=_i(r.getInitializer()):t[s]=Dr(r.getInitializer());}return t}function _i(e){let t=[];for(let r of e.getElements())r.isKind(SyntaxKind.ObjectLiteralExpression)?t.push(ar(r.asKindOrThrow(SyntaxKind.ObjectLiteralExpression))):r.isKind(SyntaxKind.ArrayLiteralExpression)?t.push(_i(r.asKindOrThrow(SyntaxKind.ArrayLiteralExpression))):t.push(Dr(r));return t}function Dr(e){switch(e.getKind()){case SyntaxKind.StringLiteral:return e.getText();case SyntaxKind.NumericLiteral:return Number(e.getText());case SyntaxKind.TrueKeyword:return true;case SyntaxKind.FalseKeyword:return false;case SyntaxKind.NullKeyword:return null;case SyntaxKind.ArrayLiteralExpression:return e.getElements().map(Dr);case SyntaxKind.ObjectLiteralExpression:return ar(e);default:return e.getText()}}function Fi(e){let t={};for(let r of Object.keys(e)){let s=r.split("-"),n=s[0],i=s.slice(1).join("-");i===""?typeof t[n]=="object"?t[n].DEFAULT=`hsl(var(--${r}))`:t[n]=`hsl(var(--${r}))`:(typeof t[n]!="object"&&(t[n]={DEFAULT:`hsl(var(--${n}))`}),t[n][i]=`hsl(var(--${r}))`);}for(let[r,s]of Object.entries(t))typeof s=="object"&&s.DEFAULT===`hsl(var(--${r}))`&&!(r in e)&&delete s.DEFAULT;return t}function qe(e,t){let r={},s=[...e];if(!t?.registries)return dt({}),s;for(let n=0;n<s.length;n++){if(rr(s[n]))continue;let i=Ge(s[n],t);i&&(s[n]=i.url,Object.keys(i.headers).length>0&&(r[i.url]=i.headers));}return dt(r),s}async function be(e,t,r={}){return r={...r,sourceCache:r.sourceCache??new Map},await Promise.all(e.map(async n$1=>{let i=ft(n$1);if(i.scheme==="github")return Pi(i,r);if(xe(n$1))return li(n$1);if(M(n$1)){let[a]=await U([n$1],r);try{return n.parse(a)}catch(f){throw new W(n$1,f)}}if(n$1.startsWith("@")&&t?.registries){let a=qe([n$1],t),[f]=await U(a,r);try{return n.parse(f)}catch(l){throw new W(n$1,l)}}let o=`styles/${t?.style??"new-york-v4"}/${n$1}.json`,[c]=await U([o],r);try{return n.parse(c)}catch(a){throw new W(n$1,a)}}))}m.extend({type:f,_source:z.string().optional(),font:l.optional(),config:z.any().optional()}).passthrough();async function Ye(e,t,r={}){r={useCache:true,...r,sourceCache:r.sourceCache??new Map};let s=[],n$1=[],i=[],o=Array.from(new Set(e)),c=await be(o,t,r),a=new Map;for(let y=0;y<c.length;y++)c[y]&&a.set(o[y],c[y]);for(let[y,w]of Array.from(a.entries())){let v={...w,_source:y};if(s.push(v),w.registryDependencies){let b=w.registryDependencies;if(t?.registries)b=qe(w.registryDependencies,t);else {let k=w.registryDependencies.filter($=>$.startsWith("@"));if(k.length>0){let{registry:$}=he(k[0]);throw new de($)}}let{items:R,registryNames:E}=await Je(b,t,r,new Set(o));n$1.push(...R),i.push(...E);}}if(s.push(...n$1),i.length>0){let y=Array.from(new Set(i)),w=y.filter(b=>!b.startsWith("@")),v=y.filter(b=>b.startsWith("@"));if(v.length>0){let b=await be(v,t,r);for(let R=0;R<b.length;R++){let k={...b[R],_source:v[R]};s.push(k);}}if(w.length>0){let b=await Vt();if(!b&&s.length===0)return null;if(b){w.includes("index")&&w.unshift("index");let R=[];for(let D of w){let X=await du(D,t,r);R.push(...X);}let E=Array.from(new Set(R)),k=await U(E,r),$=z.array(n).parse(k);s.push(...$);}}}if(!s.length)return null;if(r.requireUniversal&&!s.every(y=>Jn(y)))throw new Error("A full project config is required to add non-universal registry items or dependencies.");if((o.includes("index")||i.includes("index"))&&t.tailwind.baseColor){let y=await hu(t.tailwind.baseColor,t);y&&s.unshift(y);}let f=new Map;s.forEach(y=>{let w=y._source||y.name;f.set(y,w);}),s=gu(s,f),s.sort((y,w)=>y.type==="registry:theme"&&w.type!=="registry:theme"?-1:y.type!=="registry:theme"&&w.type==="registry:theme"?1:0);let l={};s.forEach(y=>{l=Be(l,y.tailwind??{});});let u={};s.forEach(y=>{u=Be(u,y.cssVars??{});});let d={};s.forEach(y=>{d=Be(d,y.css??{});});let p="";s.forEach(y=>{y.docs&&(p+=`${y.docs}
46
+ `);});let h={};s.forEach(y=>{h=Be(h,y.envVars??{});});let m=await Yn(s.map(y=>y.files??[]),t),g=s.filter(y=>y.type==="registry:font"&&y.font).map(y=>({...y,type:"registry:font",font:y.font})),x=v.parse({dependencies:Be.all(s.map(y=>y.dependencies??[])),devDependencies:Be.all(s.map(y=>y.devDependencies??[])),files:m,tailwind:l,cssVars:u,css:d,docs:p,fonts:g.length>0?g:void 0});return Object.keys(h).length>0&&(x.envVars=h),x}async function Je(e,t,r={},s=new Set){let n=[],i=[];for(let o of e){if(s.has(o))continue;if(s.add(o),ft(o).scheme==="github"){let[a]=await be([o],t,r);if(a&&(n.push({...a,_source:o}),a.registryDependencies)){let f=t?.registries?qe(a.registryDependencies,t):a.registryDependencies,l=await Je(f,t,r,s);n.push(...l.items),i.push(...l.registryNames);}}else if(M(o)||xe(o)){let[a]=await be([o],t,r);if(a&&(n.push({...a,_source:o}),a.registryDependencies)){let f=t?.registries?qe(a.registryDependencies,t):a.registryDependencies,l=await Je(f,t,r,s);n.push(...l.items),i.push(...l.registryNames);}}else if(o.startsWith("@")&&t?.registries){let{registry:a}=he(o);if(a&&!(a in t.registries))throw new de(a);let[f]=await be([o],t,r);if(f&&(n.push(f),f.registryDependencies)){let l=t?.registries?qe(f.registryDependencies,t):f.registryDependencies,u=await Je(l,t,r,s);n.push(...u.items),i.push(...u.registryNames);}}else if(i.push(o),t)try{let[a]=await be([o],t,r);if(a&&a.registryDependencies){let f=t?.registries?qe(a.registryDependencies,t):a.registryDependencies,l=await Je(f,t,r,s);n.push(...l.items),i.push(...l.registryNames);}}catch{}}return {items:n,registryNames:i}}async function du(e,t,r={}){if(M(e))return [e];let{registryNames:s}=await Je([e],t,r,new Set),n=t.resolvedPaths?.cwd?await $n(t.resolvedPaths.cwd,t.style):t.style,i=s.map(o=>ir(M(o)?o:`styles/${n}/${o}.json`));return Array.from(new Set(i))}async function hu(e,t){let[r,s]=await Promise.all([tr(e),Ne(t)]);if(!r)return null;let n={name:e,type:"registry:theme",tailwind:{config:{theme:{extend:{borderRadius:{lg:"var(--radius)",md:"calc(var(--radius) - 2px)",sm:"calc(var(--radius) - 4px)"},colors:{}}}}},cssVars:{theme:{},light:{radius:"0.5rem"},dark:{}}};return t.tailwind.cssVariables&&(n.tailwind.config.theme.extend.colors={...n.tailwind.config.theme.extend.colors,...Fi(r.cssVars.dark??{})},n.cssVars={theme:{...r.cssVars.theme,...n.cssVars.theme},light:{...r.cssVars.light,...n.cssVars.light},dark:{...r.cssVars.dark,...n.cssVars.dark}},s==="v4"&&r.cssVarsV4&&(n.cssVars={theme:{...r.cssVarsV4.theme,...n.cssVars.theme},light:{radius:"0.625rem",...r.cssVarsV4.light},dark:{...r.cssVarsV4.dark}})),n}function fe(e,t){let r=t||e.name,s=createHash("sha256").update(r).digest("hex").substring(0,8);return `${e.name}::${s}`}function mu(e){let t=ft(e);if(t.scheme==="github")return {name:t.item,hash:fe({name:t.item},e)};if(M(e)){let n=new URL(e).pathname,i=n.match(/\/([^/]+)\.json$/),o=i?i[1]:S__default.basename(n,".json");return {name:o,hash:fe({name:o},e)}}if(xe(e)){let s=e.match(/\/([^/]+)\.json$/),n=s?s[1]:S__default.basename(e,".json");return {name:n,hash:fe({name:n},e)}}let{item:r}=he(e);return {name:r,hash:fe({name:r},e)}}function gu(e,t){let r=new Map,s=new Map,n=new Map,i=new Map;e.forEach(f=>{let l=t.get(f)||f.name,u=fe(f,l);r.set(u,f),s.set(u,f),n.set(u,0),i.set(u,[]);});let o=new Map;e.forEach(f=>{let l=t.get(f)||f.name,u=fe(f,l);o.has(f.name)||o.set(f.name,[]),o.get(f.name).push(u),l!==f.name&&(o.has(l)||o.set(l,[]),o.get(l).push(u));}),e.forEach(f=>{let l=t.get(f)||f.name,u=fe(f,l);f.registryDependencies&&f.registryDependencies.forEach(d=>{let p,h=o.get(d)||[];if(h.length===1)p=h[0];else if(h.length>1)p=h[0];else {let{name:m}=mu(d),g=o.get(m)||[];g.length>0&&(p=g[0]);}p&&r.has(p)&&(i.get(p).push(u),n.set(u,n.get(u)+1));});});let c=[],a=[];for(n.forEach((f,l)=>{f===0&&c.push(l);});c.length>0;){let f=c.shift(),l=r.get(f);a.push(l),i.get(f).forEach(u=>{let d=n.get(u)-1;n.set(u,d),d===0&&c.push(u);});}if(a.length!==e.length){let f=new Set(a.map(l=>{let u=t.get(l)||l.name;return fe(l,u)}));e.forEach(l=>{let u=t.get(l)||l.name,d=fe(l,u);f.has(d)||a.push(l);});}return a}var Vr=["npm","yarn","yarn@berry","pnpm","pnpm@6","bun","deno"],Wr={"bun.lock":"bun","bun.lockb":"bun","deno.lock":"deno","pnpm-lock.yaml":"pnpm","pnpm-workspace.yaml":"pnpm","yarn.lock":"yarn","package-lock.json":"npm","npm-shrinkwrap.json":"npm"},zr={"node_modules/.deno/":"deno","node_modules/.pnpm/":"pnpm","node_modules/.yarn-state.yml":"yarn","node_modules/.yarn_integrity":"yarn","node_modules/.package-lock.json":"npm",".pnp.cjs":"yarn",".pnp.js":"yarn","bun.lock":"bun","bun.lockb":"bun"},Di={bun:"https://bun.sh",deno:"https://deno.com",pnpm:"https://pnpm.io/installation","pnpm@6":"https://pnpm.io/6.x/installation",yarn:"https://classic.yarnpkg.com/en/docs/install","yarn@berry":"https://yarnpkg.com/getting-started/install",npm:"https://docs.npmjs.com/cli/configuring-npm/install"};async function Ur(e,t){try{let r=await Vi__default.stat(e);return t==="file"?r.isFile():r.isDirectory()}catch{return false}}function*wu(e=ie.cwd()){let t=S__default.resolve(e),{root:r}=S__default.parse(t);for(;t&&t!==r;)yield t,t=S__default.dirname(t);}async function Li(e,t){return !e||!Ur(e,"file")?null:await vu(e,t)}async function Hr(e={}){let{cwd:t,strategies:r=["lockfile","packageManager-field","devEngines-field"],onUnknown:s}=e,n;if(typeof e.stopDir=="string"){let i=S__default.resolve(e.stopDir);n=o=>o===i;}else n=e.stopDir;for(let i of wu(t)){for(let o of r)switch(o){case "lockfile":{for(let c of Object.keys(Wr))if(await Ur(S__default.join(i,c),"file")){let a=Wr[c],f=await Li(S__default.join(i,"package.json"),s);return f||{name:a,agent:a}}break}case "packageManager-field":case "devEngines-field":{let c=await Li(S__default.join(i,"package.json"),s);if(c)return c;break}case "install-metadata":{for(let c of Object.keys(zr)){let a=c.endsWith("/")?"dir":"file";if(await Ur(S__default.join(i,c),a)){let f=zr[c],l=f==="yarn"?bu(c)?"yarn":"yarn@berry":f;return {name:f,agent:l}}}break}}if(n?.(i))break}return null}function xu(e){let t=r=>r?.match(/\d+(\.\d+){0,2}/)?.[0]??r;if(typeof e.packageManager=="string"){let[r,s]=e.packageManager.replace(/^\^/,"").split("@");return {name:r,ver:t(s)}}if(typeof e.devEngines?.packageManager?.name=="string")return {name:e.devEngines.packageManager.name,ver:t(e.devEngines.packageManager.version)}}async function vu(e,t){try{let r=JSON.parse(await Vi__default.readFile(e,"utf8")),s,n=xu(r);if(n){let i=n.name,o=n.ver,c=o;return i==="yarn"&&o&&Number.parseInt(o)>1?(s="yarn@berry",c="berry",{name:i,agent:s,version:c}):i==="pnpm"&&o&&Number.parseInt(o)<7?(s="pnpm@6",{name:i,agent:s,version:c}):Vr.includes(i)?(s=i,{name:i,agent:s,version:c}):t?.(r.packageManager)??null}}catch{}return null}function bu(e){return e.endsWith(".yarn_integrity")}var Ze=createRequire(import.meta.url),Su=Object.create,Hi=Object.defineProperty,Iu=Object.getOwnPropertyDescriptor,Eu=Object.getOwnPropertyNames,Cu=Object.getPrototypeOf,ku=Object.prototype.hasOwnProperty,Se=(e=>typeof Ze<"u"?Ze:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof Ze<"u"?Ze:t)[r]}):e)(function(e){if(typeof Ze<"u")return Ze.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),q=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),$u=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Eu(t))!ku.call(e,n)&&n!==r&&Hi(e,n,{get:()=>t[n],enumerable:!(s=Iu(t,n))||s.enumerable});return e},Pu=(e,t,r)=>(r=e!=null?Su(Cu(e)):{},$u(Hi(r,"default",{value:e,enumerable:true}),e)),Tu=q((e,t)=>{t.exports=i,i.sync=o;var r=Se("fs");function s(c,a){var f=a.pathExt!==void 0?a.pathExt:process.env.PATHEXT;if(!f||(f=f.split(";"),f.indexOf("")!==-1))return true;for(var l=0;l<f.length;l++){var u=f[l].toLowerCase();if(u&&c.substr(-u.length).toLowerCase()===u)return true}return false}function n(c,a,f){return !c.isSymbolicLink()&&!c.isFile()?false:s(a,f)}function i(c,a,f){r.stat(c,function(l,u){f(l,l?false:n(u,c,a));});}function o(c,a){return n(r.statSync(c),c,a)}}),Au=q((e,t)=>{t.exports=s,s.sync=n;var r=Se("fs");function s(c,a,f){r.stat(c,function(l,u){f(l,l?false:i(u,a));});}function n(c,a){return i(r.statSync(c),a)}function i(c,a){return c.isFile()&&o(c,a)}function o(c,a){var f=c.mode,l=c.uid,u=c.gid,d=a.uid!==void 0?a.uid:process.getuid&&process.getuid(),p=a.gid!==void 0?a.gid:process.getgid&&process.getgid(),h=parseInt("100",8),m=parseInt("010",8),g=parseInt("001",8),x=h|m,y=f&g||f&m&&u===p||f&h&&l===d||f&x&&d===0;return y}}),ju=q((e,t)=>{Se("fs");var s;process.platform==="win32"||global.TESTING_WINDOWS?s=Tu():s=Au(),t.exports=n,n.sync=i;function n(o,c,a){if(typeof c=="function"&&(a=c,c={}),!a){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(f,l){n(o,c||{},function(u,d){u?l(u):f(d);});})}s(o,c||{},function(f,l){f&&(f.code==="EACCES"||c&&c.ignoreErrors)&&(f=null,l=false),a(f,l);});}function i(o,c){try{return s.sync(o,c||{})}catch(a){if(c&&c.ignoreErrors||a.code==="EACCES")return false;throw a}}}),Ou=q((e,t)=>{var r=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",s=Se("path"),n=r?";":":",i=ju(),o=l=>Object.assign(new Error(`not found: ${l}`),{code:"ENOENT"}),c=(l,u)=>{let d=u.colon||n,p=l.match(/\//)||r&&l.match(/\\/)?[""]:[...r?[process.cwd()]:[],...(u.path||process.env.PATH||"").split(d)],h=r?u.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",m=r?h.split(d):[""];return r&&l.indexOf(".")!==-1&&m[0]!==""&&m.unshift(""),{pathEnv:p,pathExt:m,pathExtExe:h}},a=(l,u,d)=>{typeof u=="function"&&(d=u,u={}),u||(u={});let{pathEnv:p,pathExt:h,pathExtExe:m}=c(l,u),g=[],x=w=>new Promise((v,b)=>{if(w===p.length)return u.all&&g.length?v(g):b(o(l));let R=p[w],E=/^".*"$/.test(R)?R.slice(1,-1):R,k=s.join(E,l),$=!E&&/^\.[\\\/]/.test(l)?l.slice(0,2)+k:k;v(y($,w,0));}),y=(w,v,b)=>new Promise((R,E)=>{if(b===h.length)return R(x(v+1));let k=h[b];i(w+k,{pathExt:m},($,D)=>{if(!$&&D)if(u.all)g.push(w+k);else return R(w+k);return R(y(w,v,b+1))});});return d?x(0).then(w=>d(null,w),d):x(0)},f=(l,u)=>{u=u||{};let{pathEnv:d,pathExt:p,pathExtExe:h}=c(l,u),m=[];for(let g=0;g<d.length;g++){let x=d[g],y=/^".*"$/.test(x)?x.slice(1,-1):x,w=s.join(y,l),v=!y&&/^\.[\\\/]/.test(l)?l.slice(0,2)+w:w;for(let b=0;b<p.length;b++){let R=v+p[b];try{if(i.sync(R,{pathExt:h}))if(u.all)m.push(R);else return R}catch{}}}if(u.all&&m.length)return m;if(u.nothrow)return null;throw o(l)};t.exports=a,a.sync=f;}),Nu=q((e,t)=>{var r=(s={})=>{let n=s.env||process.env;return (s.platform||process.platform)!=="win32"?"PATH":Object.keys(n).reverse().find(i=>i.toUpperCase()==="PATH")||"Path"};t.exports=r,t.exports.default=r;}),_u=q((e,t)=>{var r=Se("path"),s=Ou(),n=Nu();function i(c,a){let f=c.options.env||process.env,l=process.cwd(),u=c.options.cwd!=null,d=u&&process.chdir!==void 0&&!process.chdir.disabled;if(d)try{process.chdir(c.options.cwd);}catch{}let p;try{p=s.sync(c.command,{path:f[n({env:f})],pathExt:a?r.delimiter:void 0});}catch{}finally{d&&process.chdir(l);}return p&&(p=r.resolve(u?c.options.cwd:"",p)),p}function o(c){return i(c)||i(c,true)}t.exports=o;}),Fu=q((e,t)=>{var r=/([()\][%!^"`<>&|;, *?])/g;function s(i){return i=i.replace(r,"^$1"),i}function n(i,o){return i=`${i}`,i=i.replace(/(\\*)"/g,'$1$1\\"'),i=i.replace(/(\\*)$/,"$1$1"),i=`"${i}"`,i=i.replace(r,"^$1"),o&&(i=i.replace(r,"^$1")),i}t.exports.command=s,t.exports.argument=n;}),Mu=q((e,t)=>{t.exports=/^#!(.*)/;}),Du=q((e,t)=>{var r=Mu();t.exports=(s="")=>{let n=s.match(r);if(!n)return null;let[i,o]=n[0].replace(/#! ?/,"").split(" "),c=i.split("/").pop();return c==="env"?o:o?`${c} ${o}`:c};}),Lu=q((e,t)=>{var r=Se("fs"),s=Du();function n(i){let o=Buffer.alloc(150),c;try{c=r.openSync(i,"r"),r.readSync(c,o,0,150,0),r.closeSync(c);}catch{}return s(o.toString())}t.exports=n;}),Vu=q((e,t)=>{var r=Se("path"),s=_u(),n=Fu(),i=Lu(),o=process.platform==="win32",c=/\.(?:com|exe)$/i,a=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function f(d){d.file=s(d);let p=d.file&&i(d.file);return p?(d.args.unshift(d.file),d.command=p,s(d)):d.file}function l(d){if(!o)return d;let p=f(d),h=!c.test(p);if(d.options.forceShell||h){let m=a.test(p);d.command=r.normalize(d.command),d.command=n.command(d.command),d.args=d.args.map(x=>n.argument(x,m));let g=[d.command].concat(d.args).join(" ");d.args=["/d","/s","/c",`"${g}"`],d.command=process.env.comspec||"cmd.exe",d.options.windowsVerbatimArguments=true;}return d}function u(d,p,h){p&&!Array.isArray(p)&&(h=p,p=null),p=p?p.slice(0):[],h=Object.assign({},h);let m={command:d,args:p,options:h,file:void 0,original:{command:d,args:p}};return h.shell?m:l(m)}t.exports=u;}),Wu=q((e,t)=>{var r=process.platform==="win32";function s(c,a){return Object.assign(new Error(`${a} ${c.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${a} ${c.command}`,path:c.command,spawnargs:c.args})}function n(c,a){if(!r)return;let f=c.emit;c.emit=function(l,u){if(l==="exit"){let d=i(u,a);if(d)return f.call(c,"error",d)}return f.apply(c,arguments)};}function i(c,a){return r&&c===1&&!a.file?s(a.original,"spawn"):null}function o(c,a){return r&&c===1&&!a.file?s(a.original,"spawnSync"):null}t.exports={hookChildProcess:n,verifyENOENT:i,verifyENOENTSync:o,notFoundError:s};}),zu=q((e,t)=>{var r=Se("child_process"),s=Vu(),n=Wu();function i(c,a,f){let l=s(c,a,f),u=r.spawn(l.command,l.args,l.options);return n.hookChildProcess(u,l),u}function o(c,a,f){let l=s(c,a,f),u=r.spawnSync(l.command,l.args,l.options);return u.error=u.error||n.verifyENOENTSync(u.status,l),u}t.exports=i,t.exports.spawn=i,t.exports.sync=o,t.exports._parse=s,t.exports._enoent=n;}),qu=/^path$/i,zi={key:"PATH",value:""};function Ju(e){for(let t in e){if(!Object.prototype.hasOwnProperty.call(e,t)||!qu.test(t))continue;let r=e[t];return r?{key:t,value:r}:zi}return zi}function Yu(e,t){let r=t.value.split(delimiter),s=e,n;do r.push(resolve(s,"node_modules",".bin")),n=s,s=dirname(s);while(s!==n);return {key:t.key,value:r.join(delimiter)}}function Zu(e,t){let r={...process.env,...t},s=Yu(e,Ju(r));return r[s.key]=s.value,r}var Qu=e=>{let t=e.length,r=new PassThrough,s=()=>{--t===0&&r.emit("end");};for(let n of e)n.pipe(r,{end:false}),n.on("end",s);return r},ef=Pu(zu()),Ui=class extends Error{result;output;get exitCode(){if(this.result.exitCode!==null)return this.result.exitCode}constructor(e,t){super(`Process exited with non-zero status (${e.exitCode})`),this.result=e,this.output=t;}},rf={timeout:void 0,persist:false},sf={windowsHide:true};function nf(e,t){return {command:normalize(e),args:t??[]}}function of(e){let t=new AbortController;for(let r of e){if(r.aborted)return t.abort(),r;let s=()=>{t.abort(r.reason);};r.addEventListener("abort",s,{signal:t.signal});}return t.signal}var af=class{_process;_aborted=false;_options;_command;_args;_resolveClose;_processClosed;_thrownError;get process(){return this._process}get pid(){return this._process?.pid}get exitCode(){if(this._process&&this._process.exitCode!==null)return this._process.exitCode}constructor(e,t,r){this._options={...rf,...r},this._command=e,this._args=t??[],this._processClosed=new Promise(s=>{this._resolveClose=s;});}kill(e){return this._process?.kill(e)===true}get aborted(){return this._aborted}get killed(){return this._process?.killed===true}pipe(e,t,r){return cf(e,t,{...r,stdin:this})}async*[Symbol.asyncIterator](){let e=this._process;if(!e)return;let t=[];this._streamErr&&t.push(this._streamErr),this._streamOut&&t.push(this._streamOut);let r=Qu(t),s=tf.createInterface({input:r});for await(let n of s)yield n.toString();if(await this._processClosed,e.removeAllListeners(),this._thrownError)throw this._thrownError;if(this._options?.throwOnError&&this.exitCode!==0&&this.exitCode!==void 0)throw new Ui(this)}async _waitForOutput(){let e=this._process;if(!e)throw new Error("No process was started");let t="",r="";if(this._streamOut)for await(let n of this._streamOut)r+=n.toString();if(this._streamErr)for await(let n of this._streamErr)t+=n.toString();if(await this._processClosed,this._options?.stdin&&await this._options.stdin,e.removeAllListeners(),this._thrownError)throw this._thrownError;let s={stderr:t,stdout:r,exitCode:this.exitCode};if(this._options.throwOnError&&this.exitCode!==0&&this.exitCode!==void 0)throw new Ui(this,s);return s}then(e,t){return this._waitForOutput().then(e,t)}_streamOut;_streamErr;spawn(){let e=cwd(),t=this._options,r={...sf,...t.nodeOptions},s=[];this._resetState(),t.timeout!==void 0&&s.push(AbortSignal.timeout(t.timeout)),t.signal!==void 0&&s.push(t.signal),t.persist===true&&(r.detached=true),s.length>0&&(r.signal=of(s)),r.env=Zu(e,r.env);let{command:n,args:i}=nf(this._command,this._args),o=(0, ef._parse)(n,i,r),c=spawn(o.command,o.args,o.options);if(c.stderr&&(this._streamErr=c.stderr),c.stdout&&(this._streamOut=c.stdout),this._process=c,c.once("error",this._onError),c.once("close",this._onClose),t.stdin!==void 0&&c.stdin&&t.stdin.process){let{stdout:a}=t.stdin.process;a&&a.pipe(c.stdin);}}_resetState(){this._aborted=false,this._processClosed=new Promise(e=>{this._resolveClose=e;}),this._thrownError=void 0;}_onError=e=>{if(e.name==="AbortError"&&(!(e.cause instanceof Error)||e.cause.name!=="TimeoutError")){this._aborted=true;return}this._thrownError=e;};_onClose=()=>{this._resolveClose&&this._resolveClose();}},Kr=(e,t,r)=>{let s=new af(e,t,r);return s.spawn(),s},cf=Kr;function Os(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Br={},qr,Gi;function te(){if(Gi)return qr;Gi=1;let e,t,r,s,n=true;typeof process<"u"&&({FORCE_COLOR:e,NODE_DISABLE_COLORS:t,NO_COLOR:r,TERM:s}=process.env||{},n=process.stdout&&process.stdout.isTTY);let i={enabled:!t&&r==null&&s!=="dumb"&&(e!=null&&e!=="0"||n),reset:a(0,0),bold:a(1,22),dim:a(2,22),italic:a(3,23),underline:a(4,24),inverse:a(7,27),hidden:a(8,28),strikethrough:a(9,29),black:a(30,39),red:a(31,39),green:a(32,39),yellow:a(33,39),blue:a(34,39),magenta:a(35,39),cyan:a(36,39),white:a(37,39),gray:a(90,39),grey:a(90,39),bgBlack:a(40,49),bgRed:a(41,49),bgGreen:a(42,49),bgYellow:a(43,49),bgBlue:a(44,49),bgMagenta:a(45,49),bgCyan:a(46,49),bgWhite:a(47,49)};function o(f,l){let u=0,d,p="",h="";for(;u<f.length;u++)d=f[u],p+=d.open,h+=d.close,~l.indexOf(d.close)&&(l=l.replace(d.rgx,d.close+d.open));return p+l+h}function c(f,l){let u={has:f,keys:l};return u.reset=i.reset.bind(u),u.bold=i.bold.bind(u),u.dim=i.dim.bind(u),u.italic=i.italic.bind(u),u.underline=i.underline.bind(u),u.inverse=i.inverse.bind(u),u.hidden=i.hidden.bind(u),u.strikethrough=i.strikethrough.bind(u),u.black=i.black.bind(u),u.red=i.red.bind(u),u.green=i.green.bind(u),u.yellow=i.yellow.bind(u),u.blue=i.blue.bind(u),u.magenta=i.magenta.bind(u),u.cyan=i.cyan.bind(u),u.white=i.white.bind(u),u.gray=i.gray.bind(u),u.grey=i.grey.bind(u),u.bgBlack=i.bgBlack.bind(u),u.bgRed=i.bgRed.bind(u),u.bgGreen=i.bgGreen.bind(u),u.bgYellow=i.bgYellow.bind(u),u.bgBlue=i.bgBlue.bind(u),u.bgMagenta=i.bgMagenta.bind(u),u.bgCyan=i.bgCyan.bind(u),u.bgWhite=i.bgWhite.bind(u),u}function a(f,l){let u={open:`\x1B[${f}m`,close:`\x1B[${l}m`,rgx:new RegExp(`\\x1b\\[${l}m`,"g")};return function(d){return this!==void 0&&this.has!==void 0?(~this.has.indexOf(f)||(this.has.push(f),this.keys.push(u)),d===void 0?this:i.enabled?o(this.keys,d+""):d+""):d===void 0?c([f],[u]):i.enabled?o([u],d+""):d+""}}return qr=i,qr}var Jr,Bi;function wf(){return Bi||(Bi=1,Jr=(e,t)=>{if(!(e.meta&&e.name!=="escape")){if(e.ctrl)return e.name==="a"?"first":e.name==="c"||e.name==="d"?"abort":e.name==="e"?"last":e.name==="g"?"reset":e.name==="n"?"down":e.name==="p"?"up":void 0;if(t){if(e.name==="j")return "down";if(e.name==="k")return "up"}return e.name==="return"||e.name==="enter"?"submit":e.name==="backspace"?"delete":e.name==="delete"?"deleteForward":e.name==="abort"?"abort":e.name==="escape"?"exit":e.name==="tab"?"next":e.name==="pagedown"?"nextPage":e.name==="pageup"?"prevPage":e.name==="home"?"home":e.name==="end"?"end":e.name==="up"?"up":e.name==="down"?"down":e.name==="right"?"right":e.name==="left"?"left":false}}),Jr}var Yr,qi;function Ns(){return qi||(qi=1,Yr=e=>{let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),r=new RegExp(t,"g");return typeof e=="string"?e.replace(r,""):e}),Yr}var Zr,Ji;function re(){if(Ji)return Zr;Ji=1;let e="\x1B",t=`${e}[`,r="\x07",s={to(o,c){return c?`${t}${c+1};${o+1}H`:`${t}${o+1}G`},move(o,c){let a="";return o<0?a+=`${t}${-o}D`:o>0&&(a+=`${t}${o}C`),c<0?a+=`${t}${-c}A`:c>0&&(a+=`${t}${c}B`),a},up:(o=1)=>`${t}${o}A`,down:(o=1)=>`${t}${o}B`,forward:(o=1)=>`${t}${o}C`,backward:(o=1)=>`${t}${o}D`,nextLine:(o=1)=>`${t}E`.repeat(o),prevLine:(o=1)=>`${t}F`.repeat(o),left:`${t}G`,hide:`${t}?25l`,show:`${t}?25h`,save:`${e}7`,restore:`${e}8`},n={up:(o=1)=>`${t}S`.repeat(o),down:(o=1)=>`${t}T`.repeat(o)},i={screen:`${t}2J`,up:(o=1)=>`${t}1J`.repeat(o),down:(o=1)=>`${t}J`.repeat(o),line:`${t}2K`,lineEnd:`${t}K`,lineStart:`${t}1K`,lines(o){let c="";for(let a=0;a<o;a++)c+=this.line+(a<o-1?s.up():"");return o&&(c+=s.left),c}};return Zr={cursor:s,scroll:n,erase:i,beep:r},Zr}var Xr,Yi;function xf(){if(Yi)return Xr;Yi=1;let e=Ns(),{erase:t,cursor:r}=re(),s=n=>[...e(n)].length;return Xr=function(n,i){if(!i)return t.line+r.to(0);let o=0,c=n.split(/\r?\n/);for(let a of c)o+=1+Math.floor(Math.max(s(a)-1,0)/i);return t.lines(o)},Xr}var Qr,Zi;function Vo(){if(Zi)return Qr;Zi=1;let e={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},t={arrowUp:e.arrowUp,arrowDown:e.arrowDown,arrowLeft:e.arrowLeft,arrowRight:e.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"};return Qr=process.platform==="win32"?t:e,Qr}var es,Xi;function vf(){if(Xi)return es;Xi=1;let e=te(),t=Vo(),r=Object.freeze({password:{scale:1,render:a=>"*".repeat(a.length)},emoji:{scale:2,render:a=>"\u{1F603}".repeat(a.length)},invisible:{scale:0,render:a=>""},default:{scale:1,render:a=>`${a}`}}),s=a=>r[a]||r.default,n=Object.freeze({aborted:e.red(t.cross),done:e.green(t.tick),exited:e.yellow(t.cross),default:e.cyan("?")});return es={styles:r,render:s,symbols:n,symbol:(a,f,l)=>f?n.aborted:l?n.exited:a?n.done:n.default,delimiter:a=>e.gray(a?t.ellipsis:t.pointerSmall),item:(a,f)=>e.gray(a?f?t.pointerSmall:"+":t.line)},es}var ts,Qi;function bf(){if(Qi)return ts;Qi=1;let e=Ns();return ts=function(t,r){let s=String(e(t)||"").split(/\r?\n/);return r?s.map(n=>Math.ceil(n.length/r)).reduce((n,i)=>n+i):s.length},ts}var rs,eo;function Rf(){return eo||(eo=1,rs=(e,t={})=>{let r=Number.isSafeInteger(parseInt(t.margin))?new Array(parseInt(t.margin)).fill(" ").join(""):t.margin||"",s=t.width;return (e||"").split(/\r?\n/g).map(n=>n.split(/\s+/g).reduce((i,o)=>(o.length+r.length>=s||i[i.length-1].length+o.length+1<s?i[i.length-1]+=` ${o}`:i.push(`${r}${o}`),i),[r]).join(`
47
+ `)).join(`
48
+ `)}),rs}var ss,to;function Sf(){return to||(to=1,ss=(e,t,r)=>{r=r||t;let s=Math.min(t-r,e-Math.floor(r/2));s<0&&(s=0);let n=Math.min(s+r,t);return {startIndex:s,endIndex:n}}),ss}var ns,ro;function oe(){return ro||(ro=1,ns={action:wf(),clear:xf(),style:vf(),strip:Ns(),figures:Vo(),lines:bf(),wrap:Rf(),entriesToDisplay:Sf()}),ns}var is,so;function Ie(){if(so)return is;so=1;let e=tf,{action:t}=oe(),r=pf,{beep:s,cursor:n}=re(),i=te();class o extends r{constructor(a={}){super(),this.firstRender=true,this.in=a.stdin||process.stdin,this.out=a.stdout||process.stdout,this.onRender=(a.onRender||(()=>{})).bind(this);let f=e.createInterface({input:this.in,escapeCodeTimeout:50});e.emitKeypressEvents(this.in,f),this.in.isTTY&&this.in.setRawMode(true);let l=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,u=(d,p)=>{let h=t(p,l);h===false?this._&&this._(d,p):typeof this[h]=="function"?this[h](p):this.bell();};this.close=()=>{this.out.write(n.show),this.in.removeListener("keypress",u),this.in.isTTY&&this.in.setRawMode(false),f.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=true;},this.in.on("keypress",u);}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited});}bell(){this.out.write(s);}render(){this.onRender(i),this.firstRender&&(this.firstRender=false);}}return is=o,is}var os,no;function If(){if(no)return os;no=1;let e=te(),t=Ie(),{erase:r,cursor:s}=re(),{style:n,clear:i,lines:o,figures:c}=oe();class a extends t{constructor(l={}){super(l),this.transform=n.render(l.style),this.scale=this.transform.scale,this.msg=l.message,this.initial=l.initial||"",this.validator=l.validate||(()=>true),this.value="",this.errorMsg=l.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=i("",this.out.columns),this.render();}set value(l){!l&&this.initial?(this.placeholder=true,this.rendered=e.gray(this.transform.render(this.initial))):(this.placeholder=false,this.rendered=this.transform.render(l)),this._value=l,this.fire();}get value(){return this._value}reset(){this.value="",this.cursor=+!!this.initial,this.cursorOffset=0,this.fire(),this.render();}exit(){this.abort();}abort(){this.value=this.value||this.initial,this.done=this.aborted=true,this.error=false,this.red=false,this.fire(),this.render(),this.out.write(`
49
+ `),this.close();}async validate(){let l=await this.validator(this.value);typeof l=="string"&&(this.errorMsg=l,l=false),this.error=!l;}async submit(){if(this.value=this.value||this.initial,this.cursorOffset=0,this.cursor=this.rendered.length,await this.validate(),this.error){this.red=true,this.fire(),this.render();return}this.done=true,this.aborted=false,this.fire(),this.render(),this.out.write(`
50
+ `),this.close();}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render();}moveCursor(l){this.placeholder||(this.cursor=this.cursor+l,this.cursorOffset+=l);}_(l,u){let d=this.value.slice(0,this.cursor),p=this.value.slice(this.cursor);this.value=`${d}${l}${p}`,this.red=false,this.cursor=this.placeholder?0:d.length+1,this.render();}delete(){if(this.isCursorAtStart())return this.bell();let l=this.value.slice(0,this.cursor-1),u=this.value.slice(this.cursor);this.value=`${l}${u}`,this.red=false,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render();}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let l=this.value.slice(0,this.cursor),u=this.value.slice(this.cursor+1);this.value=`${l}${u}`,this.red=false,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render();}first(){this.cursor=0,this.render();}last(){this.cursor=this.value.length,this.render();}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render();}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render();}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(s.down(o(this.outputError,this.out.columns)-1)+i(this.outputError,this.out.columns)),this.out.write(i(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[n.symbol(this.done,this.aborted),e.bold(this.msg),n.delimiter(this.done),this.red?e.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
51
+ `).reduce((l,u,d)=>l+`
52
+ ${d?" ":c.pointerSmall} ${e.red().italic(u)}`,"")),this.out.write(r.line+s.to(0)+this.outputText+s.save+this.outputError+s.restore+s.move(this.cursorOffset,0)));}}return os=a,os}var as,io;function Ef(){if(io)return as;io=1;let e=te(),t=Ie(),{style:r,clear:s,figures:n,wrap:i,entriesToDisplay:o}=oe(),{cursor:c}=re();class a extends t{constructor(l={}){super(l),this.msg=l.message,this.hint=l.hint||"- Use arrow-keys. Return to submit.",this.warn=l.warn||"- This option is disabled",this.cursor=l.initial||0,this.choices=l.choices.map((u,d)=>(typeof u=="string"&&(u={title:u,value:d}),{title:u&&(u.title||u.value||u),value:u&&(u.value===void 0?d:u.value),description:u&&u.description,selected:u&&u.selected,disabled:u&&u.disabled})),this.optionsPerPage=l.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=s("",this.out.columns),this.render();}moveCursor(l){this.cursor=l,this.value=this.choices[l].value,this.fire();}reset(){this.moveCursor(0),this.fire(),this.render();}exit(){this.abort();}abort(){this.done=this.aborted=true,this.fire(),this.render(),this.out.write(`
53
+ `),this.close();}submit(){this.selection.disabled?this.bell():(this.done=true,this.aborted=false,this.fire(),this.render(),this.out.write(`
54
+ `),this.close());}first(){this.moveCursor(0),this.render();}last(){this.moveCursor(this.choices.length-1),this.render();}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render();}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render();}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render();}_(l,u){if(l===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(c.hide):this.out.write(s(this.outputText,this.out.columns)),super.render();let{startIndex:l,endIndex:u}=o(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[r.symbol(this.done,this.aborted),e.bold(this.msg),r.delimiter(false),this.done?this.selection.title:this.selection.disabled?e.yellow(this.warn):e.gray(this.hint)].join(" "),!this.done){this.outputText+=`
55
+ `;for(let d=l;d<u;d++){let p,h,m="",g=this.choices[d];d===l&&l>0?h=n.arrowUp:d===u-1&&u<this.choices.length?h=n.arrowDown:h=" ",g.disabled?(p=this.cursor===d?e.gray().underline(g.title):e.strikethrough().gray(g.title),h=(this.cursor===d?e.bold().gray(n.pointer)+" ":" ")+h):(p=this.cursor===d?e.cyan().underline(g.title):g.title,h=(this.cursor===d?e.cyan(n.pointer)+" ":" ")+h,g.description&&this.cursor===d&&(m=` - ${g.description}`,(h.length+p.length+m.length>=this.out.columns||g.description.split(/\r?\n/).length>1)&&(m=`
56
+ `+i(g.description,{margin:3,width:this.out.columns})))),this.outputText+=`${h} ${p}${e.gray(m)}
57
+ `;}}this.out.write(this.outputText);}}return as=a,as}var cs,oo;function Cf(){if(oo)return cs;oo=1;let e=te(),t=Ie(),{style:r,clear:s}=oe(),{cursor:n,erase:i}=re();class o extends t{constructor(a={}){super(a),this.msg=a.message,this.value=!!a.initial,this.active=a.active||"on",this.inactive=a.inactive||"off",this.initialValue=this.value,this.render();}reset(){this.value=this.initialValue,this.fire(),this.render();}exit(){this.abort();}abort(){this.done=this.aborted=true,this.fire(),this.render(),this.out.write(`
58
+ `),this.close();}submit(){this.done=true,this.aborted=false,this.fire(),this.render(),this.out.write(`
59
+ `),this.close();}deactivate(){if(this.value===false)return this.bell();this.value=false,this.render();}activate(){if(this.value===true)return this.bell();this.value=true,this.render();}delete(){this.deactivate();}left(){this.deactivate();}right(){this.activate();}down(){this.deactivate();}up(){this.activate();}next(){this.value=!this.value,this.fire(),this.render();}_(a,f){if(a===" ")this.value=!this.value;else if(a==="1")this.value=true;else if(a==="0")this.value=false;else return this.bell();this.render();}render(){this.closed||(this.firstRender?this.out.write(n.hide):this.out.write(s(this.outputText,this.out.columns)),super.render(),this.outputText=[r.symbol(this.done,this.aborted),e.bold(this.msg),r.delimiter(this.done),this.value?this.inactive:e.cyan().underline(this.inactive),e.gray("/"),this.value?e.cyan().underline(this.active):this.active].join(" "),this.out.write(i.line+n.to(0)+this.outputText));}}return cs=o,cs}var ls,ao;function pe(){if(ao)return ls;ao=1;class e{constructor({token:r,date:s,parts:n,locales:i}){this.token=r,this.date=s||new Date,this.parts=n||[this],this.locales=i||{};}up(){}down(){}next(){let r=this.parts.indexOf(this);return this.parts.find((s,n)=>n>r&&s instanceof e)}setTo(r){}prev(){let r=[].concat(this.parts).reverse(),s=r.indexOf(this);return r.find((n,i)=>i>s&&n instanceof e)}toString(){return String(this.date)}}return ls=e,ls}var us,co;function kf(){if(co)return us;co=1;let e=pe();class t extends e{constructor(s={}){super(s);}up(){this.date.setHours((this.date.getHours()+12)%24);}down(){this.up();}toString(){let s=this.date.getHours()>12?"pm":"am";return /\A/.test(this.token)?s.toUpperCase():s}}return us=t,us}var fs,lo;function $f(){if(lo)return fs;lo=1;let e=pe(),t=s=>(s=s%10,s===1?"st":s===2?"nd":s===3?"rd":"th");class r extends e{constructor(n={}){super(n);}up(){this.date.setDate(this.date.getDate()+1);}down(){this.date.setDate(this.date.getDate()-1);}setTo(n){this.date.setDate(parseInt(n.substr(-2)));}toString(){let n=this.date.getDate(),i=this.date.getDay();return this.token==="DD"?String(n).padStart(2,"0"):this.token==="Do"?n+t(n):this.token==="d"?i+1:this.token==="ddd"?this.locales.weekdaysShort[i]:this.token==="dddd"?this.locales.weekdays[i]:n}}return fs=r,fs}var ps,uo;function Pf(){if(uo)return ps;uo=1;let e=pe();class t extends e{constructor(s={}){super(s);}up(){this.date.setHours(this.date.getHours()+1);}down(){this.date.setHours(this.date.getHours()-1);}setTo(s){this.date.setHours(parseInt(s.substr(-2)));}toString(){let s=this.date.getHours();return /h/.test(this.token)&&(s=s%12||12),this.token.length>1?String(s).padStart(2,"0"):s}}return ps=t,ps}var ds,fo;function Tf(){if(fo)return ds;fo=1;let e=pe();class t extends e{constructor(s={}){super(s);}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1);}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1);}setTo(s){this.date.setMilliseconds(parseInt(s.substr(-this.token.length)));}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}}return ds=t,ds}var hs,po;function Af(){if(po)return hs;po=1;let e=pe();class t extends e{constructor(s={}){super(s);}up(){this.date.setMinutes(this.date.getMinutes()+1);}down(){this.date.setMinutes(this.date.getMinutes()-1);}setTo(s){this.date.setMinutes(parseInt(s.substr(-2)));}toString(){let s=this.date.getMinutes();return this.token.length>1?String(s).padStart(2,"0"):s}}return hs=t,hs}var ms,ho;function jf(){if(ho)return ms;ho=1;let e=pe();class t extends e{constructor(s={}){super(s);}up(){this.date.setMonth(this.date.getMonth()+1);}down(){this.date.setMonth(this.date.getMonth()-1);}setTo(s){s=parseInt(s.substr(-2))-1,this.date.setMonth(s<0?0:s);}toString(){let s=this.date.getMonth(),n=this.token.length;return n===2?String(s+1).padStart(2,"0"):n===3?this.locales.monthsShort[s]:n===4?this.locales.months[s]:String(s+1)}}return ms=t,ms}var gs,mo;function Of(){if(mo)return gs;mo=1;let e=pe();class t extends e{constructor(s={}){super(s);}up(){this.date.setSeconds(this.date.getSeconds()+1);}down(){this.date.setSeconds(this.date.getSeconds()-1);}setTo(s){this.date.setSeconds(parseInt(s.substr(-2)));}toString(){let s=this.date.getSeconds();return this.token.length>1?String(s).padStart(2,"0"):s}}return gs=t,gs}var ys,go;function Nf(){if(go)return ys;go=1;let e=pe();class t extends e{constructor(s={}){super(s);}up(){this.date.setFullYear(this.date.getFullYear()+1);}down(){this.date.setFullYear(this.date.getFullYear()-1);}setTo(s){this.date.setFullYear(s.substr(-4));}toString(){let s=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?s.substr(-2):s}}return ys=t,ys}var ws,yo;function _f(){return yo||(yo=1,ws={DatePart:pe(),Meridiem:kf(),Day:$f(),Hours:Pf(),Milliseconds:Tf(),Minutes:Af(),Month:jf(),Seconds:Of(),Year:Nf()}),ws}var xs,wo;function Ff(){if(wo)return xs;wo=1;let e=te(),t=Ie(),{style:r,clear:s,figures:n}=oe(),{erase:i,cursor:o}=re(),{DatePart:c,Meridiem:a,Day:f,Hours:l,Milliseconds:u,Minutes:d,Month:p,Seconds:h,Year:m}=_f(),g=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,x={1:({token:v})=>v.replace(/\\(.)/g,"$1"),2:v=>new f(v),3:v=>new p(v),4:v=>new m(v),5:v=>new a(v),6:v=>new l(v),7:v=>new d(v),8:v=>new h(v),9:v=>new u(v)},y={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")};class w extends t{constructor(b={}){super(b),this.msg=b.message,this.cursor=0,this.typed="",this.locales=Object.assign(y,b.locales),this._date=b.initial||new Date,this.errorMsg=b.error||"Please Enter A Valid Value",this.validator=b.validate||(()=>true),this.mask=b.mask||"YYYY-MM-DD HH:mm:ss",this.clear=s("",this.out.columns),this.render();}get value(){return this.date}get date(){return this._date}set date(b){b&&this._date.setTime(b.getTime());}set mask(b){let R;for(this.parts=[];R=g.exec(b);){let k=R.shift(),$=R.findIndex(D=>D!=null);this.parts.push($ in x?x[$]({token:R[$]||k,date:this.date,parts:this.parts,locales:this.locales}):R[$]||k);}let E=this.parts.reduce((k,$)=>(typeof $=="string"&&typeof k[k.length-1]=="string"?k[k.length-1]+=$:k.push($),k),[]);this.parts.splice(0),this.parts.push(...E),this.reset();}moveCursor(b){this.typed="",this.cursor=b,this.fire();}reset(){this.moveCursor(this.parts.findIndex(b=>b instanceof c)),this.fire(),this.render();}exit(){this.abort();}abort(){this.done=this.aborted=true,this.error=false,this.fire(),this.render(),this.out.write(`
60
+ `),this.close();}async validate(){let b=await this.validator(this.value);typeof b=="string"&&(this.errorMsg=b,b=false),this.error=!b;}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}this.done=true,this.aborted=false,this.fire(),this.render(),this.out.write(`
61
+ `),this.close();}up(){this.typed="",this.parts[this.cursor].up(),this.render();}down(){this.typed="",this.parts[this.cursor].down(),this.render();}left(){let b=this.parts[this.cursor].prev();if(b==null)return this.bell();this.moveCursor(this.parts.indexOf(b)),this.render();}right(){let b=this.parts[this.cursor].next();if(b==null)return this.bell();this.moveCursor(this.parts.indexOf(b)),this.render();}next(){let b=this.parts[this.cursor].next();this.moveCursor(b?this.parts.indexOf(b):this.parts.findIndex(R=>R instanceof c)),this.render();}_(b){/\d/.test(b)&&(this.typed+=b,this.parts[this.cursor].setTo(this.typed),this.render());}render(){this.closed||(this.firstRender?this.out.write(o.hide):this.out.write(s(this.outputText,this.out.columns)),super.render(),this.outputText=[r.symbol(this.done,this.aborted),e.bold(this.msg),r.delimiter(false),this.parts.reduce((b,R,E)=>b.concat(E===this.cursor&&!this.done?e.cyan().underline(R.toString()):R),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
62
+ `).reduce((b,R,E)=>b+`
63
+ ${E?" ":n.pointerSmall} ${e.red().italic(R)}`,"")),this.out.write(i.line+o.to(0)+this.outputText));}}return xs=w,xs}var vs,xo;function Mf(){if(xo)return vs;xo=1;let e=te(),t=Ie(),{cursor:r,erase:s}=re(),{style:n,figures:i,clear:o,lines:c}=oe(),a=/[0-9]/,f=d=>d!==void 0,l=(d,p)=>{let h=Math.pow(10,p);return Math.round(d*h)/h};class u extends t{constructor(p={}){super(p),this.transform=n.render(p.style),this.msg=p.message,this.initial=f(p.initial)?p.initial:"",this.float=!!p.float,this.round=p.round||2,this.inc=p.increment||1,this.min=f(p.min)?p.min:-1/0,this.max=f(p.max)?p.max:1/0,this.errorMsg=p.error||"Please Enter A Valid Value",this.validator=p.validate||(()=>true),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render();}set value(p){!p&&p!==0?(this.placeholder=true,this.rendered=e.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=false,this.rendered=this.transform.render(`${l(p,this.round)}`),this._value=l(p,this.round)),this.fire();}get value(){return this._value}parse(p){return this.float?parseFloat(p):parseInt(p)}valid(p){return p==="-"||p==="."&&this.float||a.test(p)}reset(){this.typed="",this.value="",this.fire(),this.render();}exit(){this.abort();}abort(){let p=this.value;this.value=p!==""?p:this.initial,this.done=this.aborted=true,this.error=false,this.fire(),this.render(),this.out.write(`
64
+ `),this.close();}async validate(){let p=await this.validator(this.value);typeof p=="string"&&(this.errorMsg=p,p=false),this.error=!p;}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}let p=this.value;this.value=p!==""?p:this.initial,this.done=true,this.aborted=false,this.error=false,this.fire(),this.render(),this.out.write(`
65
+ `),this.close();}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render();}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render();}delete(){let p=this.value.toString();if(p.length===0)return this.bell();this.value=this.parse(p=p.slice(0,-1))||"",this.value!==""&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render();}next(){this.value=this.initial,this.fire(),this.render();}_(p,h){if(!this.valid(p))return this.bell();let m=Date.now();if(m-this.lastHit>1e3&&(this.typed=""),this.typed+=p,this.lastHit=m,this.color="cyan",p===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render();}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(r.down(c(this.outputError,this.out.columns)-1)+o(this.outputError,this.out.columns)),this.out.write(o(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[n.symbol(this.done,this.aborted),e.bold(this.msg),n.delimiter(this.done),!this.done||!this.done&&!this.placeholder?e[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
66
+ `).reduce((p,h,m)=>p+`
67
+ ${m?" ":i.pointerSmall} ${e.red().italic(h)}`,"")),this.out.write(s.line+r.to(0)+this.outputText+r.save+this.outputError+r.restore));}}return vs=u,vs}var bs,vo;function Wo(){if(vo)return bs;vo=1;let e=te(),{cursor:t}=re(),r=Ie(),{clear:s,figures:n,style:i,wrap:o,entriesToDisplay:c}=oe();class a extends r{constructor(l={}){super(l),this.msg=l.message,this.cursor=l.cursor||0,this.scrollIndex=l.cursor||0,this.hint=l.hint||"",this.warn=l.warn||"- This option is disabled -",this.minSelected=l.min,this.showMinError=false,this.maxChoices=l.max,this.instructions=l.instructions,this.optionsPerPage=l.optionsPerPage||10,this.value=l.choices.map((u,d)=>(typeof u=="string"&&(u={title:u,value:d}),{title:u&&(u.title||u.value||u),description:u&&u.description,value:u&&(u.value===void 0?d:u.value),selected:u&&u.selected,disabled:u&&u.disabled})),this.clear=s("",this.out.columns),l.overrideRender||this.render();}reset(){this.value.map(l=>!l.selected),this.cursor=0,this.fire(),this.render();}selected(){return this.value.filter(l=>l.selected)}exit(){this.abort();}abort(){this.done=this.aborted=true,this.fire(),this.render(),this.out.write(`
68
+ `),this.close();}submit(){let l=this.value.filter(u=>u.selected);this.minSelected&&l.length<this.minSelected?(this.showMinError=true,this.render()):(this.done=true,this.aborted=false,this.fire(),this.render(),this.out.write(`
69
+ `),this.close());}first(){this.cursor=0,this.render();}last(){this.cursor=this.value.length-1,this.render();}next(){this.cursor=(this.cursor+1)%this.value.length,this.render();}up(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render();}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render();}left(){this.value[this.cursor].selected=false,this.render();}right(){if(this.value.filter(l=>l.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=true,this.render();}handleSpaceToggle(){let l=this.value[this.cursor];if(l.selected)l.selected=false,this.render();else {if(l.disabled||this.value.filter(u=>u.selected).length>=this.maxChoices)return this.bell();l.selected=true,this.render();}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let l=!this.value[this.cursor].selected;this.value.filter(u=>!u.disabled).forEach(u=>u.selected=l),this.render();}_(l,u){if(l===" ")this.handleSpaceToggle();else if(l==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
70
+ Instructions:
71
+ ${n.arrowUp}/${n.arrowDown}: Highlight option
72
+ ${n.arrowLeft}/${n.arrowRight}/[space]: Toggle selection
73
+ `+(this.maxChoices===void 0?` a: Toggle all
74
+ `:"")+" enter/return: Complete answer":""}renderOption(l,u,d,p){let h=(u.selected?e.green(n.radioOn):n.radioOff)+" "+p+" ",m,g;return u.disabled?m=l===d?e.gray().underline(u.title):e.strikethrough().gray(u.title):(m=l===d?e.cyan().underline(u.title):u.title,l===d&&u.description&&(g=` - ${u.description}`,(h.length+m.length+g.length>=this.out.columns||u.description.split(/\r?\n/).length>1)&&(g=`
75
+ `+o(u.description,{margin:h.length,width:this.out.columns})))),h+m+e.gray(g||"")}paginateOptions(l){if(l.length===0)return e.red("No matches for this query.");let{startIndex:u,endIndex:d}=c(this.cursor,l.length,this.optionsPerPage),p,h=[];for(let m=u;m<d;m++)m===u&&u>0?p=n.arrowUp:m===d-1&&d<l.length?p=n.arrowDown:p=" ",h.push(this.renderOption(this.cursor,l[m],m,p));return `
76
+ `+h.join(`
77
+ `)}renderOptions(l){return this.done?"":this.paginateOptions(l)}renderDoneOrInstructions(){if(this.done)return this.value.filter(u=>u.selected).map(u=>u.title).join(", ");let l=[e.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&l.push(e.yellow(this.warn)),l.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(t.hide),super.render();let l=[i.symbol(this.done,this.aborted),e.bold(this.msg),i.delimiter(false),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(l+=e.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=false),l+=this.renderOptions(this.value),this.out.write(this.clear+l),this.clear=s(l,this.out.columns);}}return bs=a,bs}var Rs,bo;function Df(){if(bo)return Rs;bo=1;let e=te(),t=Ie(),{erase:r,cursor:s}=re(),{style:n,clear:i,figures:o,wrap:c,entriesToDisplay:a}=oe(),f=(p,h)=>p[h]&&(p[h].value||p[h].title||p[h]),l=(p,h)=>p[h]&&(p[h].title||p[h].value||p[h]),u=(p,h)=>{let m=p.findIndex(g=>g.value===h||g.title===h);return m>-1?m:void 0};class d extends t{constructor(h={}){super(h),this.msg=h.message,this.suggest=h.suggest,this.choices=h.choices,this.initial=typeof h.initial=="number"?h.initial:u(h.choices,h.initial),this.select=this.initial||h.cursor||0,this.i18n={noMatches:h.noMatches||"no matches found"},this.fallback=h.fallback||this.initial,this.clearFirst=h.clearFirst||false,this.suggestions=[],this.input="",this.limit=h.limit||10,this.cursor=0,this.transform=n.render(h.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=i("",this.out.columns),this.complete(this.render),this.render();}set fallback(h){this._fb=Number.isSafeInteger(parseInt(h))?parseInt(h):h;}get fallback(){let h;return typeof this._fb=="number"?h=this.choices[this._fb]:typeof this._fb=="string"&&(h={title:this._fb}),h||this._fb||{title:this.i18n.noMatches}}moveSelect(h){this.select=h,this.suggestions.length>0?this.value=f(this.suggestions,h):this.value=this.fallback.value,this.fire();}async complete(h){let m=this.completing=this.suggest(this.input,this.choices),g=await m;if(this.completing!==m)return;this.suggestions=g.map((y,w,v)=>({title:l(v,w),value:f(v,w),description:y.description})),this.completing=false;let x=Math.max(g.length-1,0);this.moveSelect(Math.min(x,this.select)),h&&h();}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render();}),this.render();}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=true,this.aborted=false,this.fire(),this.render(),this.out.write(`
78
+ `),this.close());}abort(){this.done=this.aborted=true,this.exited=false,this.fire(),this.render(),this.out.write(`
79
+ `),this.close();}submit(){this.done=true,this.aborted=this.exited=false,this.fire(),this.render(),this.out.write(`
80
+ `),this.close();}_(h,m){let g=this.input.slice(0,this.cursor),x=this.input.slice(this.cursor);this.input=`${g}${h}${x}`,this.cursor=g.length+1,this.complete(this.render),this.render();}delete(){if(this.cursor===0)return this.bell();let h=this.input.slice(0,this.cursor-1),m=this.input.slice(this.cursor);this.input=`${h}${m}`,this.complete(this.render),this.cursor=this.cursor-1,this.render();}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let h=this.input.slice(0,this.cursor),m=this.input.slice(this.cursor+1);this.input=`${h}${m}`,this.complete(this.render),this.render();}first(){this.moveSelect(0),this.render();}last(){this.moveSelect(this.suggestions.length-1),this.render();}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render();}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render();}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render();}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render();}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render();}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render();}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render();}renderOption(h,m,g,x){let y,w=g?o.arrowUp:x?o.arrowDown:" ",v=m?e.cyan().underline(h.title):h.title;return w=(m?e.cyan(o.pointer)+" ":" ")+w,h.description&&(y=` - ${h.description}`,(w.length+v.length+y.length>=this.out.columns||h.description.split(/\r?\n/).length>1)&&(y=`
81
+ `+c(h.description,{margin:3,width:this.out.columns}))),w+" "+v+e.gray(y||"")}render(){if(this.closed)return;this.firstRender?this.out.write(s.hide):this.out.write(i(this.outputText,this.out.columns)),super.render();let{startIndex:h,endIndex:m}=a(this.select,this.choices.length,this.limit);if(this.outputText=[n.symbol(this.done,this.aborted,this.exited),e.bold(this.msg),n.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){let g=this.suggestions.slice(h,m).map((x,y)=>this.renderOption(x,this.select===y+h,y===0&&h>0,y+h===m-1&&m<this.choices.length)).join(`
82
+ `);this.outputText+=`
83
+ `+(g||e.gray(this.fallback.title));}this.out.write(r.line+s.to(0)+this.outputText);}}return Rs=d,Rs}var Ss,Ro;function Lf(){if(Ro)return Ss;Ro=1;let e=te(),{cursor:t}=re(),r=Wo(),{clear:s,style:n,figures:i}=oe();class o extends r{constructor(a={}){a.overrideRender=true,super(a),this.inputValue="",this.clear=s("",this.out.columns),this.filteredOptions=this.value,this.render();}last(){this.cursor=this.filteredOptions.length-1,this.render();}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render();}up(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render();}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render();}left(){this.filteredOptions[this.cursor].selected=false,this.render();}right(){if(this.value.filter(a=>a.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=true,this.render();}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions());}updateFilteredOptions(){let a=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(l=>this.inputValue?!!(typeof l.title=="string"&&l.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof l.value=="string"&&l.value.toLowerCase().includes(this.inputValue.toLowerCase())):true);let f=this.filteredOptions.findIndex(l=>l===a);this.cursor=f<0?0:f,this.render();}handleSpaceToggle(){let a=this.filteredOptions[this.cursor];if(a.selected)a.selected=false,this.render();else {if(a.disabled||this.value.filter(f=>f.selected).length>=this.maxChoices)return this.bell();a.selected=true,this.render();}}handleInputChange(a){this.inputValue=this.inputValue+a,this.updateFilteredOptions();}_(a,f){a===" "?this.handleSpaceToggle():this.handleInputChange(a);}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
84
+ Instructions:
85
+ ${i.arrowUp}/${i.arrowDown}: Highlight option
86
+ ${i.arrowLeft}/${i.arrowRight}/[space]: Toggle selection
87
+ [a,b,c]/delete: Filter choices
88
+ enter/return: Complete answer
89
+ `:""}renderCurrentInput(){return `
90
+ Filtered results for: ${this.inputValue?this.inputValue:e.gray("Enter something to filter")}
91
+ `}renderOption(a,f,l,u){let d=(f.selected?e.green(i.radioOn):i.radioOff)+" "+u+" ",p;return f.disabled?p=a===l?e.gray().underline(f.title):e.strikethrough().gray(f.title):p=a===l?e.cyan().underline(f.title):f.title,d+p}renderDoneOrInstructions(){if(this.done)return this.value.filter(f=>f.selected).map(f=>f.title).join(", ");let a=[e.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&a.push(e.yellow(this.warn)),a.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(t.hide),super.render();let a=[n.symbol(this.done,this.aborted),e.bold(this.msg),n.delimiter(false),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(a+=e.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=false),a+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+a),this.clear=s(a,this.out.columns);}}return Ss=o,Ss}var Is,So;function Vf(){if(So)return Is;So=1;let e=te(),t=Ie(),{style:r,clear:s}=oe(),{erase:n,cursor:i}=re();class o extends t{constructor(a={}){super(a),this.msg=a.message,this.value=a.initial,this.initialValue=!!a.initial,this.yesMsg=a.yes||"yes",this.yesOption=a.yesOption||"(Y/n)",this.noMsg=a.no||"no",this.noOption=a.noOption||"(y/N)",this.render();}reset(){this.value=this.initialValue,this.fire(),this.render();}exit(){this.abort();}abort(){this.done=this.aborted=true,this.fire(),this.render(),this.out.write(`
92
+ `),this.close();}submit(){this.value=this.value||false,this.done=true,this.aborted=false,this.fire(),this.render(),this.out.write(`
93
+ `),this.close();}_(a,f){return a.toLowerCase()==="y"?(this.value=true,this.submit()):a.toLowerCase()==="n"?(this.value=false,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(i.hide):this.out.write(s(this.outputText,this.out.columns)),super.render(),this.outputText=[r.symbol(this.done,this.aborted),e.bold(this.msg),r.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:e.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(n.line+i.to(0)+this.outputText));}}return Is=o,Is}var Es,Io;function Wf(){return Io||(Io=1,Es={TextPrompt:If(),SelectPrompt:Ef(),TogglePrompt:Cf(),DatePrompt:Ff(),NumberPrompt:Mf(),MultiselectPrompt:Wo(),AutocompletePrompt:Df(),AutocompleteMultiselectPrompt:Lf(),ConfirmPrompt:Vf()}),Es}var Eo;function zf(){return Eo||(Eo=1,(function(e){let t=e,r=Wf(),s=o=>o;function n(o,c,a={}){return new Promise((f,l)=>{let u=new r[o](c),d=a.onAbort||s,p=a.onSubmit||s,h=a.onExit||s;u.on("state",c.onState||s),u.on("submit",m=>f(p(m))),u.on("exit",m=>f(h(m))),u.on("abort",m=>l(d(m)));})}t.text=o=>n("TextPrompt",o),t.password=o=>(o.style="password",t.text(o)),t.invisible=o=>(o.style="invisible",t.text(o)),t.number=o=>n("NumberPrompt",o),t.date=o=>n("DatePrompt",o),t.confirm=o=>n("ConfirmPrompt",o),t.list=o=>{let c=o.separator||",";return n("TextPrompt",o,{onSubmit:a=>a.split(c).map(f=>f.trim())})},t.toggle=o=>n("TogglePrompt",o),t.select=o=>n("SelectPrompt",o),t.multiselect=o=>{o.choices=[].concat(o.choices||[]);let c=a=>a.filter(f=>f.selected).map(f=>f.value);return n("MultiselectPrompt",o,{onAbort:c,onSubmit:c})},t.autocompleteMultiselect=o=>{o.choices=[].concat(o.choices||[]);let c=a=>a.filter(f=>f.selected).map(f=>f.value);return n("AutocompleteMultiselectPrompt",o,{onAbort:c,onSubmit:c})};let i=(o,c)=>Promise.resolve(c.filter(a=>a.title.slice(0,o.length).toLowerCase()===o.toLowerCase()));t.autocomplete=o=>(o.suggest=o.suggest||i,o.choices=[].concat(o.choices||[]),n("AutocompletePrompt",o));})(Br)),Br}var Cs,Co;function Uf(){if(Co)return Cs;Co=1;let e=zf(),t=["suggest","format","onState","validate","onRender","type"],r=()=>{};async function s(c=[],{onSubmit:a=r,onCancel:f=r}={}){let l={},u=s._override||{};c=[].concat(c);let d,p,h,m,g,x,y=async(w,v,b=false)=>{if(!(!b&&w.validate&&w.validate(v)!==true))return w.format?await w.format(v,l):v};for(p of c)if({name:m,type:g}=p,typeof g=="function"&&(g=await g(d,{...l},p),p.type=g),!!g){for(let w in p){if(t.includes(w))continue;let v=p[w];p[w]=typeof v=="function"?await v(d,{...l},x):v;}if(x=p,typeof p.message!="string")throw new Error("prompt message is required");if({name:m,type:g}=p,e[g]===void 0)throw new Error(`prompt type (${g}) is not defined`);if(u[p.name]!==void 0&&(d=await y(p,u[p.name]),d!==void 0)){l[m]=d;continue}try{d=s._injected?n(s._injected,p.initial):await e[g](p),l[m]=d=await y(p,d,!0),h=await a(p,d,l);}catch{h=!await f(p,l);}if(h)return l}return l}function n(c,a){let f=c.shift();if(f instanceof Error)throw f;return f===void 0?a:f}function i(c){s._injected=(s._injected||[]).concat(c);}function o(c){s._override=Object.assign({},c);}return Cs=Object.assign(s,{prompt:s,prompts:e,inject:i,override:o}),Cs}var ks,ko;function Hf(){return ko||(ko=1,ks=Uf()),ks}var Kf=Hf(),Gf=Os(Kf),_s=globalThis.window?.document!==void 0;globalThis.process?.versions?.node;globalThis.process?.versions?.bun;globalThis.Deno?.version?.deno;globalThis.process?.versions?.electron;globalThis.navigator?.userAgent?.includes("jsdom");typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;typeof DedicatedWorkerGlobalScope<"u"&&globalThis instanceof DedicatedWorkerGlobalScope;typeof SharedWorkerGlobalScope<"u"&&globalThis instanceof SharedWorkerGlobalScope;typeof ServiceWorkerGlobalScope<"u"&&globalThis instanceof ServiceWorkerGlobalScope;var lr=globalThis.navigator?.userAgentData?.platform;lr==="macOS"||globalThis.navigator?.platform==="MacIntel"||globalThis.navigator?.userAgent?.includes(" Mac ")===true||globalThis.process?.platform;lr==="Windows"||globalThis.navigator?.platform==="Win32"||globalThis.process?.platform;lr==="Linux"||globalThis.navigator?.platform?.startsWith("Linux")===true||globalThis.navigator?.userAgent?.includes(" Linux ")===true||globalThis.process?.platform;lr==="Android"||globalThis.navigator?.platform==="Android"||globalThis.navigator?.userAgent?.includes(" Android ")===true||globalThis.process?.platform;var $o="\x1B]",Po="\x07",cr=";";!_s&&ie.env.TERM_PROGRAM;!_s&&ie.platform;_s||ie.cwd;var Bf=(e,t)=>[$o,"8",cr,cr,t,Po,e,$o,"8",cr,cr,Po].join(""),$s,To;function zo(){return To||(To=1,$s=(e,t=process.argv)=>{let r=e.startsWith("-")?"":e.length===1?"-":"--",s=t.indexOf(r+e),n=t.indexOf("--");return s!==-1&&(n===-1||s<n)}),$s}var Ps,Ao;function qf(){if(Ao)return Ps;Ao=1;let e=df,t=hf,r=zo(),{env:s}=process,n;r("no-color")||r("no-colors")||r("color=false")||r("color=never")?n=0:(r("color")||r("colors")||r("color=true")||r("color=always"))&&(n=1),"FORCE_COLOR"in s&&(s.FORCE_COLOR==="true"?n=1:s.FORCE_COLOR==="false"?n=0:n=s.FORCE_COLOR.length===0?1:Math.min(parseInt(s.FORCE_COLOR,10),3));function i(a){return a===0?false:{level:a,hasBasic:true,has256:a>=2,has16m:a>=3}}function o(a,f){if(n===0)return 0;if(r("color=16m")||r("color=full")||r("color=truecolor"))return 3;if(r("color=256"))return 2;if(a&&!f&&n===void 0)return 0;let l=n||0;if(s.TERM==="dumb")return l;if(process.platform==="win32"){let u=e.release().split(".");return Number(u[0])>=10&&Number(u[2])>=10586?Number(u[2])>=14931?3:2:1}if("CI"in s)return ["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(u=>u in s)||s.CI_NAME==="codeship"?1:l;if("TEAMCITY_VERSION"in s)return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(s.TEAMCITY_VERSION)?1:0;if(s.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in s){let u=parseInt((s.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(s.TERM_PROGRAM){case "iTerm.app":return u>=3?3:2;case "Apple_Terminal":return 2}}return /-256(color)?$/i.test(s.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(s.TERM)||"COLORTERM"in s?1:l}function c(a){let f=o(a,a&&a.isTTY);return i(f)}return Ps={supportsColor:c,stdout:i(o(true,t.isatty(1))),stderr:i(o(true,t.isatty(2)))},Ps}var Ts,jo;function Jf(){if(jo)return Ts;jo=1;let e=qf(),t=zo();function r(n){if(/^\d{3,4}$/.test(n)){let o=/(\d{1,2})(\d{2})/.exec(n)||[];return {major:0,minor:parseInt(o[1],10),patch:parseInt(o[2],10)}}let i=(n||"").split(".").map(o=>parseInt(o,10));return {major:i[0],minor:i[1],patch:i[2]}}function s(n){let{CI:i,FORCE_HYPERLINK:o,NETLIFY:c,TEAMCITY_VERSION:a,TERM_PROGRAM:f,TERM_PROGRAM_VERSION:l,VTE_VERSION:u,TERM:d}=process.env;if(o)return !(o.length>0&&parseInt(o,10)===0);if(t("no-hyperlink")||t("no-hyperlinks")||t("hyperlink=false")||t("hyperlink=never"))return false;if(t("hyperlink=true")||t("hyperlink=always")||c)return true;if(!e.supportsColor(n)||n&&!n.isTTY)return false;if("WT_SESSION"in process.env)return true;if(process.platform==="win32"||i||a)return false;if(f){let p=r(l||"");switch(f){case "iTerm.app":return p.major===3?p.minor>=1:p.major>3;case "WezTerm":return p.major>=20200620;case "vscode":return p.major>1||p.major===1&&p.minor>=72;case "ghostty":return true}}if(u){if(u==="0.50.0")return false;let p=r(u);return p.major>0||p.minor>=50}switch(d){case "alacritty":return true}return false}return Ts={supportsHyperlink:s,stdout:s(process.stdout),stderr:s(process.stderr)},Ts}var Yf=Jf(),Fs=Os(Yf);function xt(e,t,{target:r="stdout",...s}={}){return Fs[r]?Bf(e,t):s.fallback===false?e:typeof s.fallback=="function"?s.fallback(e,t):`${e} (\u200B${t}\u200B)`}xt.isSupported=Fs.stdout;xt.stderr=(e,t,r={})=>xt(e,t,{target:"stderr",...r});xt.stderr.isSupported=Fs.stderr;var ee={},Me={},Oo;function Zf(){if(Oo)return Me;Oo=1,Object.defineProperty(Me,"__esModule",{value:true}),Me.sync=Me.isexe=void 0;let e=Do,t=Vi__default,r=async(o,c={})=>{let{ignoreErrors:a=false}=c;try{return n(await(0,t.stat)(o),c)}catch(f){let l=f;if(a||l.code==="EACCES")return false;throw l}};Me.isexe=r;let s=(o,c={})=>{let{ignoreErrors:a=false}=c;try{return n((0,e.statSync)(o),c)}catch(f){let l=f;if(a||l.code==="EACCES")return false;throw l}};Me.sync=s;let n=(o,c)=>o.isFile()&&i(o,c),i=(o,c)=>{let a=c.uid??process.getuid?.(),f=c.groups??process.getgroups?.()??[],l=c.gid??process.getgid?.()??f[0];if(a===void 0||l===void 0)throw new Error("cannot get uid or gid");let u=new Set([l,...f]),d=o.mode,p=o.uid,h=o.gid,m=parseInt("100",8),g=parseInt("010",8),x=parseInt("001",8),y=m|g;return !!(d&x||d&g&&u.has(h)||d&m&&p===a||d&y&&a===0)};return Me}var De={},No;function Xf(){if(No)return De;No=1,Object.defineProperty(De,"__esModule",{value:true}),De.sync=De.isexe=void 0;let e=Do,t=Vi__default,r=async(o,c={})=>{let{ignoreErrors:a=false}=c;try{return i(await(0,t.stat)(o),o,c)}catch(f){let l=f;if(a||l.code==="EACCES")return false;throw l}};De.isexe=r;let s=(o,c={})=>{let{ignoreErrors:a=false}=c;try{return i((0,e.statSync)(o),o,c)}catch(f){let l=f;if(a||l.code==="EACCES")return false;throw l}};De.sync=s;let n=(o,c)=>{let{pathExt:a=process.env.PATHEXT||""}=c,f=a.split(";");if(f.indexOf("")!==-1)return true;for(let l=0;l<f.length;l++){let u=f[l].toLowerCase(),d=o.substring(o.length-u.length).toLowerCase();if(u&&d===u)return true}return false},i=(o,c,a)=>o.isFile()&&n(c,a);return De}var As={},_o;function Qf(){return _o||(_o=1,Object.defineProperty(As,"__esModule",{value:true})),As}var Fo;function ep(){return Fo||(Fo=1,(function(e){var t=ee&&ee.__createBinding||(Object.create?(function(f,l,u,d){d===void 0&&(d=u);var p=Object.getOwnPropertyDescriptor(l,u);(!p||("get"in p?!l.__esModule:p.writable||p.configurable))&&(p={enumerable:true,get:function(){return l[u]}}),Object.defineProperty(f,d,p);}):(function(f,l,u,d){d===void 0&&(d=u),f[d]=l[u];})),r=ee&&ee.__setModuleDefault||(Object.create?(function(f,l){Object.defineProperty(f,"default",{enumerable:true,value:l});}):function(f,l){f.default=l;}),s=ee&&ee.__importStar||function(f){if(f&&f.__esModule)return f;var l={};if(f!=null)for(var u in f)u!=="default"&&Object.prototype.hasOwnProperty.call(f,u)&&t(l,f,u);return r(l,f),l},n=ee&&ee.__exportStar||function(f,l){for(var u in f)u!=="default"&&!Object.prototype.hasOwnProperty.call(l,u)&&t(l,f,u);};Object.defineProperty(e,"__esModule",{value:true}),e.sync=e.isexe=e.posix=e.win32=void 0;let i=s(Zf());e.posix=i;let o=s(Xf());e.win32=o,n(Qf(),e);let a=(process.env._ISEXE_TEST_PLATFORM_||process.platform)==="win32"?o:i;e.isexe=a.isexe,e.sync=a.sync;})(ee)),ee}var js,Mo;function tp(){if(Mo)return js;Mo=1;let{isexe:e,sync:t}=ep(),{join:r,delimiter:s,sep:n,posix:i}=S__default,o=process.platform==="win32",c=new RegExp(`[${i.sep}${n===i.sep?"":n}]`.replace(/(\\)/g,"\\$1")),a=new RegExp(`^\\.${c.source}`),f=h=>Object.assign(new Error(`not found: ${h}`),{code:"ENOENT"}),l=(h,{path:m=process.env.PATH,pathExt:g=process.env.PATHEXT,delimiter:x=s})=>{let y=h.match(c)?[""]:[...o?[process.cwd()]:[],...(m||"").split(x)];if(o){let w=g||[".EXE",".CMD",".BAT",".COM"].join(x),v=w.split(x).flatMap(b=>[b,b.toLowerCase()]);return h.includes(".")&&v[0]!==""&&v.unshift(""),{pathEnv:y,pathExt:v,pathExtExe:w}}return {pathEnv:y,pathExt:[""]}},u=(h,m)=>{let g=/^".*"$/.test(h)?h.slice(1,-1):h;return (!g&&a.test(m)?m.slice(0,2):"")+r(g,m)},d=async(h,m={})=>{let{pathEnv:g,pathExt:x,pathExtExe:y}=l(h,m),w=[];for(let v of g){let b=u(v,h);for(let R of x){let E=b+R;if(await e(E,{pathExt:y,ignoreErrors:true})){if(!m.all)return E;w.push(E);}}}if(m.all&&w.length)return w;if(m.nothrow)return null;throw f(h)},p=(h,m={})=>{let{pathEnv:g,pathExt:x,pathExtExe:y}=l(h,m),w=[];for(let v of g){let b=u(v,h);for(let R of x){let E=b+R;if(t(E,{pathExt:y,ignoreErrors:true})){if(!m.all)return E;w.push(E);}}}if(m.all&&w.length)return w;if(m.nothrow)return null;throw f(h)};return js=d,d.sync=p,js}var rp=tp(),sp=Os(rp);join(df.tmpdir(),"antfu-ni");function Uo(e){return sp.sync(e,{nothrow:true})!==null}async function Ms({autoInstall:e,programmatic:t,cwd:r}={}){let{name:s,agent:n,version:i}=await Hr({cwd:r,onUnknown:o=>{t||console.warn("[ni] Unknown packageManager:",o);}})||{};if(s&&!Uo(s)&&!t){if(!e){console.warn(`[ni] Detected ${s} but it doesn't seem to be installed.
94
+ `),ie.env.CI&&ie.exit(1);let o=xt(s,Di[s]),{tryInstall:c}=await Gf({name:"tryInstall",type:"confirm",message:`Would you like to globally install ${o}?`});c||ie.exit(1);}await Kr("npm",["i","-g",`${s}${i?`@${i}`:""}`],{nodeOptions:{stdio:"inherit",cwd:r},throwOnError:true});}return n}ie.env.NI_CONFIG_FILE;var ip=ie.platform==="win32"?ie.env.USERPROFILE:ie.env.HOME;S__default.join(ip||"~/",".nirc");async function Ds(e,{withFallback:t}={withFallback:false}){let r=await Ms({programmatic:true,cwd:e});return r==="yarn@berry"?"yarn":r==="pnpm@6"?"pnpm":r==="bun"?"bun":r==="deno"?"deno":t?Ls()??"npm":r??"npm"}function Ls(e=process.env.npm_config_user_agent||""){return e.startsWith("yarn")?"yarn":e.startsWith("pnpm")?"pnpm":e.startsWith("bun")?"bun":e.startsWith("deno")?"deno":e.startsWith("npm")?"npm":null}function Vs(e){return e==="pnpm"?"pnpm dlx":e==="bun"?"bunx":"npx"}async function nv(e){let t=await Ds(e);return Vs(t)}var Ho={name:"shadcn",version:"4.16.2",description:"Add components to your apps.",publishConfig:{access:"public"},license:"MIT",author:{name:"shadcn",url:"https://twitter.com/shadcn"},repository:{type:"git",url:"https://github.com/shadcn-ui/ui.git",directory:"packages/shadcn"},files:["dist"],keywords:["components","ui","tailwind","radix-ui","base-ui","shadcn"],type:"module",exports:{".":{types:"./dist/index.d.ts",default:"./dist/index.js"},"./registry":{types:"./dist/registry/index.d.ts",default:"./dist/registry/index.js"},"./schema":{types:"./dist/schema/index.d.ts",default:"./dist/schema/index.js"},"./mcp":{types:"./dist/mcp/index.d.ts",default:"./dist/mcp/index.js"},"./utils":{types:"./dist/utils/index.d.ts",default:"./dist/utils/index.js"},"./icons":{types:"./dist/icons/index.d.ts",default:"./dist/icons/index.js"},"./preset":{types:"./dist/preset/index.d.ts",default:"./dist/preset/index.js"},"./tailwind.css":"./dist/tailwind.css"},sideEffects:["./dist/tailwind.css"],bin:"./dist/index.js",engines:{node:">=20.18.1"},scripts:{dev:"tsup --watch",build:"tsup",typecheck:"tsc --noEmit",clean:"rimraf dist && rimraf components","start:dev":"cross-env REGISTRY_URL=http://localhost:4000/r SHADCN_TEMPLATE_DIR=../../templates node dist/index.js","start:prod":"cross-env REGISTRY_URL=https://ui.shadcn.com/r node dist/index.js",start:"node dist/index.js","format:write":'prettier --write "**/*.{ts,tsx,mdx}" --cache',"format:check":'prettier --check "**/*.{ts,tsx,mdx}" --cache',release:"changeset version","pub:beta":"pnpm build && pnpm publish --no-git-checks --access public --tag beta","pub:rc":"pnpm build && pnpm publish --no-git-checks --access public --tag rc","pub:next":"pnpm build && pnpm publish --no-git-checks --access public --tag next","pub:release":"pnpm build && pnpm publish --access public",test:"vitest run","test:dev":"REGISTRY_URL=http://localhost:4000/r SHADCN_TEMPLATE_DIR=../../templates vitest run","mcp:inspect":"pnpm dlx @modelcontextprotocol/inspector node dist/index.js mcp"},dependencies:{"@babel/core":"^7.28.0","@babel/parser":"^7.28.0","@babel/plugin-transform-typescript":"^7.28.0","@babel/preset-typescript":"^7.27.1","@dotenvx/dotenvx":"^1.48.4","@modelcontextprotocol/sdk":"^1.26.0","@types/validate-npm-package-name":"^4.0.2",browserslist:"^4.26.2",commander:"^14.0.0",cosmiconfig:"^9.0.0",dedent:"^1.6.0",deepmerge:"^4.3.1",diff:"^8.0.2",execa:"^9.6.0","fast-glob":"^3.3.3","fs-extra":"^11.3.1",fuzzysort:"^3.1.0",kleur:"^4.1.5",open:"^11.0.0",ora:"^8.2.0",postcss:"^8.5.6","postcss-selector-parser":"^7.1.0",prompts:"^2.4.2",recast:"^0.23.11","stringify-object":"^5.0.0","tailwind-merge":"^3.0.1","ts-morph":"^26.0.0","tsconfig-paths":"^4.2.0",undici:"^7.27.2","validate-npm-package-name":"^7.0.1",zod:"^3.24.1","zod-to-json-schema":"^3.24.6"},devDependencies:{"@antfu/ni":"^25.0.0","@types/babel__core":"^7.20.5","@types/fs-extra":"^11.0.4","@types/prompts":"^2.4.9","@types/stringify-object":"^4.0.5",msw:"^2.10.4",rimraf:"^6.0.1",tsup:"^8.5.0","type-fest":"^4.41.0",typescript:"^5.9.2"}};function ur(e){if(I.break(),I.error("Something went wrong. Please check the error below for more details."),I.error("If the problem persists, please open an issue on GitHub."),I.error(""),typeof e=="string"&&(I.error(e),vt()),e instanceof _&&(e.message&&(I.error(e.cause?"Error:":"Message:"),I.error(e.message)),e.cause&&(I.error(`
95
+ Message:`),I.error(e.cause)),e.suggestion&&(I.error(`
96
+ Suggestion:`),I.error(e.suggestion)),vt()),e instanceof z.ZodError){I.error("Validation failed:");for(let[t,r]of Object.entries(e.flatten().fieldErrors))I.error(`- ${T.info(t)}: ${r}`);vt();}e instanceof Error&&(I.error(e.message),vt()),vt();}function cp(e){let t=e.match(/^(\d+)\.(\d+)\.\d+/);if(!t)return null;let r=Number.parseInt(t[1],10),s=Number.parseInt(t[2],10);return s===0?null:`${r}.${s-1}.0`}function lp(e=Ho.version,t=process.argv.slice(2)){let r=cp(e);return r?[...Vs(Ls()).split(" "),`shadcn@${r}`,...t].map(up).join(" "):null}function vt(){let e=lp();e&&(I.error(""),I.error("You can also try a previous version to see if that works:"),I.error(e)),I.break(),process.exit(1);}function up(e){return /^[a-zA-Z0-9_./:@%+=,-]+$/.test(e)?e:`'${e.replace(/'/g,"'\\''")}'`}var Go=cosmiconfig("registries",{packageProp:"registries",searchPlaces:["package.json"]}),pp=z.object({registries:b.optional()});function Bo(e,t){if(!t)return e;let r=new URL(e);return t.query&&r.searchParams.set("q",t.query),t.types?.length&&r.searchParams.set("type",t.types.join(",")),t.limit!==void 0&&r.searchParams.set("limit",String(t.limit)),t.offset!==void 0&&r.searchParams.set("offset",String(t.offset)),r.toString()}async function zs(e,t){return ve(()=>dp(e,t))}async function dp(e,t){let{config:r,useCache:s,searchParams:n}=t||{};if(M(e)){let l=Bo(e,n),[u]=await U([l],{useCache:s});return qo(e,u)}let i=pt(e);if(i)return Ti(i,{useCache:s});if(!e.startsWith("@"))throw new it(e);let o=e;o.endsWith("/registry")||(o=`${o}/registry`);let c=Ge(o,ne(r));if(!c?.url)throw new je(o);let a=Bo(c.url,n);c.headers&&Object.keys(c.headers).length>0&&dt({[a]:c.headers});let[f]=await U([a],{useCache:s});return qo(o,f)}function qo(e,t){try{let r=q$1.parse(t);if(r.include?.length)throw new P(`Registry catalog "${e}" uses "include", but consumer registry endpoints must serve a resolved registry catalog. Run "npx shadcn build" and serve the built registry.json, or use loadRegistry() in a dynamic route.`,{context:{registry:e,include:r.include},suggestion:"Serve a flattened registry.json for CLI consumers. Source registry.json files with include are supported by shadcn build and loadRegistry()."});return r}catch(r){throw r instanceof P?r:new W(e,r,{subject:"registry catalog",suggestion:"The registry catalog may be corrupted or have an invalid format. Please make sure it returns a valid registry.json object. See https://ui.shadcn.com/schema/registry.json."})}}async function Us(e,t){let{config:r,useCache:s=false}=t||{};return ve(()=>be(e,ne(r),{useCache:s}))}async function hp(e,t){let{config:r,useCache:s=false}=t||{};return ve(()=>Ye(e,ne(r),{useCache:s}))}async function mp(e,t){let{useCache:r=true}=t||{};r||(Mt.clearCaches(),Go.clearCaches());let s=S__default.resolve(e,"components.json");if(existsSync(s)){let i=await Mt.load(s),o=Jo(e,i?.config,"components.json");return {registries:{...H,...o.registries}}}let n=S__default.resolve(e,"package.json");if(existsSync(n)){let i=await Go.load(n);return Jo(e,{registries:i?.config},"package.json")}return {registries:{}}}function Jo(e,t,r){let s=pp.safeParse(t);if(!s.success)throw new We(e,s.error,r);return {registries:s.data.registries||{}}}async function Vt(){let[e]=await U(["index.json"]);return r.parse(e)}async function Nv(){try{let[e]=await U(["styles/index.json"]);return s.parse(e)}catch(e){return I.error(`
97
+ `),ur(e),[]}}async function _v(){try{let[e]=await U(["icons/index.json"]);return t.parse(e)}catch(e){return ur(e),{}}}async function Fv(){return xn}async function tr(e){let[t]=await U([`colors/${e}.json`]);return u.parse(t)}async function gp(e,t){let r=[];for(let s of t){let n=e.find(i=>i.name===s);if(n&&(r.push(n),n.registryDependencies)){let i=await gp(e,n.registryDependencies);r.push(...i);}}return r.filter((s,n,i)=>i.findIndex(o=>o.name===s.name)===n)}async function Mv(e,t){try{let r=t.map(n=>`styles/${e}/${n.name}.json`);return (await U(r)).map(n$1=>n.parse(n$1))}catch(r){return ur(r),[]}}async function Dv(e,t,r){if(r)return r;if(t.type==="registry:ui")return e.resolvedPaths.ui??e.resolvedPaths.components;let[s,n]=t.type?.split(":")??[];return s in e.resolvedPaths?S__default.join(e.resolvedPaths[s],n):null}async function Zo(e){e={useCache:true,...e};let t=`${Ae}/registries.json`,[r]=await U([t],{useCache:e.useCache});try{return A.parse(r)}catch(s){throw s instanceof z.ZodError?new ot(s):s}}async function yp(e){let t=await Zo(e);return t?Object.fromEntries(t.map(r=>[r.name,r.url])):null}async function wp(e){e={useCache:true,...e};let t=`${Ae}/config.json`,[r]=await U([t],{useCache:e.useCache});return C.parse(r).presets}async function Lv(e,t){return (await wp(t)).find(s=>s.name.toLowerCase()===e.toLowerCase())??null}var Xo={"--font-heading":"cn-font-heading"};function xp(e){return e.startsWith("--")?e:`--${e}`}function Hs(e){let t=new Set;for(let r of e){for(let s of r.fonts??[]){let n=s.font?.variable;if(!n)continue;let i=Xo[n];i&&t.add(i);}for(let s of Object.values(r.cssVars??{}))for(let n of Object.keys(s??{})){let i=Xo[xp(n)];i&&t.add(i);}}return Array.from(t)}function Qo(e,t){if(e.includes("\0"))return false;let r;try{r=e;let d="";for(;r!==d&&r.includes("%");)d=r,r=decodeURIComponent(r);}catch{return false}let s=S__default.normalize(r.replace(/\\/g,"/")),n=S__default.normalize(t),i=d=>d.replace(/\[\.\.\..*?\]/g,"").includes("..");if(i(s)||i(r)||i(e))return false;let o=d=>d.replace(/\[\.\.\..*?\]/g,""),c=o(e),a=o(r);if([/\.\.[\/\\]/,/[\/\\]\.\./,/\.\./,/\.\.%/,/\x00/,/[\x01-\x1f]/].some(d=>d.test(c)||d.test(a))||(e.includes("~")||r.includes("~"))&&(e.includes("../")||r.includes("../")))return false;if(/^[a-zA-Z]:[\/\\]/.test(r))return process.platform==="win32"?r.toLowerCase().startsWith(t.toLowerCase()):false;if(S__default.isAbsolute(s))return s.startsWith(n+S__default.sep);let u=S__default.resolve(n,s);return u.startsWith(n+S__default.sep)||u===n}async function Zv(e,t,r){if(!t.resolvedPaths.tailwindCss||!Object.keys(e??{}).length)return;r={cleanupDefaultNextStyles:false,silent:false,tailwindVersion:"v3",overwriteCssVars:false,...r};let s=t.resolvedPaths.tailwindCss,n=S__default.relative(t.resolvedPaths.cwd,s),i=j(`Updating CSS variables in ${T.info(n)}`,{silent:r.silent}).start(),o=await promises.readFile(s,"utf8"),c=await Ks(o,e??{},t,{cleanupDefaultNextStyles:r.cleanupDefaultNextStyles,tailwindVersion:r.tailwindVersion,tailwindConfig:r.tailwindConfig,overwriteCssVars:r.overwriteCssVars});await promises.writeFile(s,c,"utf8"),i.succeed();}async function Ks(e,t,r,s={cleanupDefaultNextStyles:false,tailwindVersion:"v3",tailwindConfig:void 0,overwriteCssVars:false}){s={cleanupDefaultNextStyles:false,tailwindVersion:"v3",tailwindConfig:void 0,overwriteCssVars:false,...s};let n=[Rp(t)];s.cleanupDefaultNextStyles&&n.push(ra()),s.tailwindVersion==="v4"&&(n=[],n.push(Cp({params:"dark (&:is(.dark *))"})),s.cleanupDefaultNextStyles&&n.push(ra()),n.push(Ip(t,{overwriteCssVars:s.overwriteCssVars})),n.push(Ep(t)),s.tailwindConfig&&(n.push(kp(s.tailwindConfig)),n.push(Pp(s.tailwindConfig)),n.push($p(s.tailwindConfig))));let o=(await A$1(n).process(e,{from:void 0})).css;return o=o.replace(/\/\* ---break--- \*\//g,""),s.tailwindVersion==="v4"&&(o=o.replace(/(\n\s*\n)+/g,`
98
+
99
+ `)),o}function Rp(e){return {postcssPlugin:"update-css-vars",Once(t){let r=t.nodes.find(s=>s.type==="atrule"&&s.name==="layer"&&s.params==="base");r instanceof bp||(r=A$1.atRule({name:"layer",params:"base",nodes:[],raws:{semicolon:true,before:`
100
+ `,between:" "}}),t.append(r),t.insertBefore(r,A$1.comment({text:"---break---"}))),r!==void 0&&Object.entries(e).forEach(([s,n])=>{let i=s==="light"?":root":`.${s}`;Sp(r,i,n);});}}}function ta(e){let t=e.nodes.find(r=>r.type==="rule"&&r.selector===":root");if(t){let r=["--background","--foreground"];t.nodes.filter(s=>s.type==="decl"&&r.includes(s.prop)).forEach(s=>s.remove()),t.nodes.length===0&&t.remove();}}function ra(){return {postcssPlugin:"cleanup-default-next-styles",Once(e){let t=e.nodes.find(s=>s.type==="rule"&&s.selector==="body");t&&(t.nodes.find(s=>s.type==="decl"&&s.prop==="color"&&["rgb(var(--foreground-rgb))","var(--foreground)"].includes(s.value))?.remove(),t.nodes.find(s=>s.type==="decl"&&s.prop==="background"&&(s.value.startsWith("linear-gradient")||s.value==="var(--background)"))?.remove(),t.nodes.find(s=>s.type==="decl"&&s.prop==="font-family"&&s.value==="Arial, Helvetica, sans-serif")?.remove(),t.nodes.length===0&&t.remove()),ta(e);let r=e.nodes.find(s=>s.type==="atrule"&&s.params==="(prefers-color-scheme: dark)");r&&(ta(r),r.nodes.length===0&&r.remove());}}}function Sp(e,t,r){let s=e.nodes?.find(n=>n.type==="rule"&&n.selector===t);s||Object.keys(r).length>0&&(s=A$1.rule({selector:t,raws:{between:" ",before:`
101
+ `}}),e.append(s)),Object.entries(r).forEach(([n,i])=>{let o=`--${n.replace(/^--/,"")}`,c=A$1.decl({prop:o,value:i,raws:{semicolon:true}}),a=s?.nodes.find(f=>f.type==="decl"&&f.prop===o);a?a.replaceWith(c):s?.append(c);});}function Ip(e,t){return {postcssPlugin:"update-css-vars-v4",Once(r){Object.entries(e).forEach(([s,n])=>{let i=s==="light"?":root":`.${s}`;if(s==="theme"){i="@theme";let c=fr(r);Object.entries(n).forEach(([a,f])=>{let l=`--${a.replace(/^--/,"")}`,u=A$1.decl({prop:l,value:f,raws:{semicolon:true}}),d=c?.nodes?.find(p=>p.type==="decl"&&p.prop===l);t.overwriteCssVars?d?d.replaceWith(u):c?.append(u):d||c?.append(u);});return}let o=r.nodes?.find(c=>c.type==="rule"&&c.selector===i);!o&&Object.keys(n).length>0&&(o=A$1.rule({selector:i,nodes:[],raws:{semicolon:true,between:" ",before:`
102
+ `}}),r.append(o),r.insertBefore(o,A$1.comment({text:"---break---"}))),Object.entries(n).forEach(([c,a])=>{let f=`--${c.replace(/^--/,"")}`;f==="--sidebar-background"&&(f="--sidebar"),sa(a)&&(a=`hsl(${a})`);let l=A$1.decl({prop:f,value:a,raws:{semicolon:true}}),u=o?.nodes.find(d=>d.type==="decl"&&d.prop===f);t.overwriteCssVars?u?u.replaceWith(l):o?.append(l):u||o?.append(l);});});}}}function Ep(e){return {postcssPlugin:"update-theme",Once(t){let r=Array.from(new Set(Object.keys(e).flatMap(i=>Object.keys(e[i]||{}))));if(!r.length)return;let s=fr(t),n=s.nodes?.filter(i=>i.type==="decl"&&i.prop.startsWith("--"));for(let i of r){let o=Object.values(e).find(u=>u[i])?.[i];if(!o)continue;if(i==="radius"){let u={sm:"calc(var(--radius) * 0.6)",md:"calc(var(--radius) * 0.8)",lg:"var(--radius)",xl:"calc(var(--radius) * 1.4)","2xl":"calc(var(--radius) * 1.8)","3xl":"calc(var(--radius) * 2.2)","4xl":"calc(var(--radius) * 2.6)"};for(let[d,p]of Object.entries(u)){let h=A$1.decl({prop:`--radius-${d}`,value:p,raws:{semicolon:true}});s?.nodes?.find(m=>m.type==="decl"&&m.prop===h.prop)||s?.append(h);}continue}let c=sa(o)||Ap(o)?`--color-${i.replace(/^--/,"")}`:`--${i.replace(/^--/,"")}`;c==="--color-sidebar-background"&&(c="--color-sidebar");let a=`var(--${i})`;c==="--color-sidebar"&&(a="var(--sidebar)");let f=A$1.decl({prop:c,value:a,raws:{semicolon:true}});s?.nodes?.find(u=>u.type==="decl"&&u.prop===f.prop)||(n?.length?s?.insertAfter(n[n.length-1],f):s?.append(f));}}}}function fr(e){let t=e.nodes.find(r=>r.type==="atrule"&&r.name==="theme"&&r.params==="inline");return t||(t=A$1.atRule({name:"theme",params:"inline",nodes:[],raws:{semicolon:true,between:" ",before:`
103
+ `}}),e.append(t),e.insertBefore(t,A$1.comment({text:"---break---"}))),t}function Cp({params:e}){return {postcssPlugin:"add-custom-variant",Once(t){if(!t.nodes.find(s=>s.type==="atrule"&&s.name==="custom-variant")){let s=t.nodes.filter(i=>i.type==="atrule"&&i.name==="import"),n=A$1.atRule({name:"custom-variant",params:e,raws:{semicolon:true,before:`
104
+ `}});if(s.length>0){let i=s[s.length-1];t.insertAfter(i,n);}else t.insertAfter(t.nodes[0],n);t.insertBefore(n,A$1.comment({text:"---break---"}));}}}}function kp(e){return {postcssPlugin:"update-tailwind-config",Once(t){if(!e?.plugins)return;let s=Tp(t)==="single"?"'":'"',n=t.nodes.filter(o=>o.type==="atrule"&&o.name==="plugin"),i=n[n.length-1]||t.nodes[0];for(let o of e.plugins){let c=o.replace(/^require\(["']|["']\)$/g,"");if(n.some(f=>f.params.replace(/["']/g,"")===c))continue;let a=A$1.atRule({name:"plugin",params:`${s}${c}${s}`,raws:{semicolon:true,before:`
105
+ `}});t.insertAfter(i,a),t.insertBefore(a,A$1.comment({text:"---break---"}));}}}}function $p(e){return {postcssPlugin:"update-tailwind-config-keyframes",Once(t){if(!e?.theme?.extend?.keyframes)return;let r=fr(t),s=r.nodes?.filter(i=>i.type==="atrule"&&i.name==="keyframes"),n=z.record(z.string(),z.record(z.string(),z.string()));for(let[i,o]of Object.entries(e.theme.extend.keyframes)){if(typeof i!="string")continue;let c=n.safeParse(o);if(!c.success||s?.find(f=>f.type==="atrule"&&f.name==="keyframes"&&f.params===i))continue;let a=A$1.atRule({name:"keyframes",params:i,nodes:[],raws:{semicolon:true,between:" ",before:`
106
+ `}});for(let[f,l]of Object.entries(c.data)){let u=A$1.rule({selector:f,nodes:Object.entries(l).map(([d,p])=>A$1.decl({prop:d,value:p,raws:{semicolon:true,before:`
107
+ `,between:": "}})),raws:{semicolon:true,between:" ",before:`
108
+ `}});a.append(u);}r.append(a),r.insertBefore(a,A$1.comment({text:"---break---"}));}}}}function Pp(e){return {postcssPlugin:"update-tailwind-config-animation",Once(t){if(!e?.theme?.extend?.animation)return;let r=fr(t),s=r.nodes?.filter(i=>i.type==="decl"&&i.prop.startsWith("--animate-")),n=z.record(z.string(),z.string()).safeParse(e.theme.extend.animation);if(n.success)for(let[i,o]of Object.entries(n.data)){let c=`--animate-${i}`;if(s?.find(f=>f.prop===c))continue;let a=A$1.decl({prop:c,value:o,raws:{semicolon:true,between:": ",before:`
109
+ `}});r.append(a);}}}}function Tp(e){return e.nodes[0].toString().includes("'")?"single":"double"}function sa(e){if(e.startsWith("hsl")||e.startsWith("rgb")||e.startsWith("#")||e.startsWith("oklch"))return false;let t=e.split(" ");return t.length===3&&t.slice(1,3).every(r=>r.includes("%"))}function Ap(e){return e.startsWith("hsl")||e.startsWith("rgb")||e.startsWith("#")||e.startsWith("oklch")||e.includes("--color-")}async function Gs(e,t,r){let s=e&&Object.keys(e).length>0,n=Object.keys(r.cssVars??{}).length>0;if(!t.resolvedPaths.tailwindCss||!s&&!n)return;r={silent:false,...r};let i=t.resolvedPaths.tailwindCss,o=S__default.relative(t.resolvedPaths.cwd,i),c=j(`Updating ${T.info(o)}`,{silent:r.silent}).start(),a=await promises.readFile(i,"utf8");n&&(a=await Ks(a,r.cssVars,t,{cleanupDefaultNextStyles:r.cleanupDefaultNextStyles,tailwindVersion:r.tailwindVersion,tailwindConfig:r.tailwindConfig,overwriteCssVars:r.overwriteCssVars})),s&&(a=await Np(a,e)),await promises.writeFile(i,a,"utf8"),c.succeed();}async function Np(e,t){let r=[_p(t)],s=await A$1(r).process(e,{from:void 0}),n=s.css,i=s.root;if(i.nodes&&i.nodes.length>0){let o=i.nodes[i.nodes.length-1];o.type==="atrule"&&!o.nodes&&!n.trimEnd().endsWith(";")&&(n=n.trimEnd()+";");}return n=n.replace(/\/\* ---break--- \*\//g,""),n=n.replace(/(\n\s*\n)+/g,`
110
+
111
+ `),n=n.trimEnd(),n}function _p(e){return {postcssPlugin:"update-css",Once(t){for(let[r,s]of Object.entries(e))if(r.startsWith("@")){let n=r.match(/@([a-zA-Z-]+)\s*(.*)/);if(!n)continue;let[,i,o]=n;if(i==="import"){if(!t.nodes?.find(a=>a.type==="atrule"&&a.name==="import"&&a.params===o)){let a=A$1.atRule({name:"import",params:o,raws:{semicolon:true}}),f=t.nodes?.filter(l=>l.type==="atrule"&&l.name==="import");if(f&&f.length>0){let l=f[f.length-1];a.raws.before=`
112
+ `,t.insertAfter(l,a);}else !t.nodes||t.nodes.length,a.raws.before="",t.prepend(a);}}else if(i==="plugin"){let c=o;o&&!o.startsWith('"')&&!o.startsWith("'")&&(c=`"${o}"`);let a=l=>l.startsWith('"')&&l.endsWith('"')||l.startsWith("'")&&l.endsWith("'")?l.slice(1,-1):l;if(!t.nodes?.find(l=>l.type!=="atrule"||l.name!=="plugin"?false:a(l.params)===a(o))){let l=A$1.atRule({name:"plugin",params:c,raws:{semicolon:true,before:`
113
+ `}}),u=t.nodes?.filter(p=>p.type==="atrule"&&p.name==="import"),d=t.nodes?.filter(p=>p.type==="atrule"&&p.name==="plugin");if(d&&d.length>0){let p=d[d.length-1];t.insertAfter(p,l);}else if(u&&u.length>0){let p=u[u.length-1];t.insertAfter(p,l),t.insertBefore(l,A$1.comment({text:"---break---"})),t.insertAfter(l,A$1.comment({text:"---break---"}));}else t.prepend(l),t.insertBefore(l,A$1.comment({text:"---break---"})),t.insertAfter(l,A$1.comment({text:"---break---"}));}}else if(typeof s=="object"&&Object.keys(s).length===0){if(!t.nodes?.find(a=>a.type==="atrule"&&a.name===i&&a.params===o)){let a=A$1.atRule({name:i,params:o,raws:{semicolon:true}});t.append(a),t.insertBefore(a,A$1.comment({text:"---break---"}));}}else if(i==="keyframes"){let c=t.nodes?.find(l=>l.type==="atrule"&&l.name==="theme"&&l.params==="inline");c||(c=A$1.atRule({name:"theme",params:"inline",raws:{semicolon:true,between:" ",before:`
114
+ `}}),t.append(c),t.insertBefore(c,A$1.comment({text:"---break---"})));let a=c.nodes?.find(l=>l.type==="atrule"&&l.name==="keyframes"&&l.params===o),f;if(a?(f=A$1.atRule({name:"keyframes",params:o,raws:{semicolon:true,between:" ",before:`
115
+ `}}),a.replaceWith(f)):(f=A$1.atRule({name:"keyframes",params:o,raws:{semicolon:true,between:" ",before:`
116
+ `}}),c.append(f)),typeof s=="object")for(let[l,u]of Object.entries(s))Le(f,l,u);}else if(i==="utility"){let c=t.nodes?.find(a=>a.type==="atrule"&&a.name===i&&a.params===o);if(c){if(typeof s=="object")for(let[a,f]of Object.entries(s))if(typeof f=="string"){let l=c.nodes?.find(d=>d.type==="decl"&&d.prop===a),u=A$1.decl({prop:a,value:f,raws:{semicolon:true,before:`
117
+ `}});l?l.replaceWith(u):c.append(u);}else if(a.startsWith("@")&&typeof f=="object"&&f!==null&&Object.keys(f).length===0){let l=a.match(/@([a-zA-Z-]+)\s*(.*)/);if(l){let[,u,d]=l;if(!c.nodes?.find(h=>h.type==="atrule"&&h.name===u&&h.params===d)){let h=A$1.atRule({name:u,params:d,raws:{semicolon:true,before:`
118
+ `}});c.append(h);}}}else typeof f=="object"&&Le(c,a,f);}else {let a=A$1.atRule({name:i,params:o,raws:{semicolon:true,between:" ",before:`
119
+ `}});if(t.append(a),t.insertBefore(a,A$1.comment({text:"---break---"})),typeof s=="object")for(let[f,l]of Object.entries(s))if(typeof l=="string"){let u=A$1.decl({prop:f,value:l,raws:{semicolon:true,before:`
120
+ `}});a.append(u);}else if(f.startsWith("@")&&typeof l=="object"&&l!==null&&Object.keys(l).length===0){let u=f.match(/@([a-zA-Z-]+)\s*(.*)/);if(u){let[,d,p]=u;if(!a.nodes?.find(m=>m.type==="atrule"&&m.name===d&&m.params===p)){let m=A$1.atRule({name:d,params:p,raws:{semicolon:true,before:`
121
+ `}});a.append(m);}}}else typeof l=="object"&&Le(a,f,l);}}else i==="property"?Le(t,r,s):ia(t,i,o,s);}else Le(t,r,s);}}}function ia(e,t,r,s){let n=e.nodes?.find(i=>i.type==="atrule"&&i.name===t&&i.params===r);if(n||(n=A$1.atRule({name:t,params:r,raws:{semicolon:true,between:" ",before:`
122
+ `}}),e.append(n),e.insertBefore(n,A$1.comment({text:"---break---"}))),typeof s=="object")for(let[i,o]of Object.entries(s))if(i.startsWith("@")){let c=i.match(/@([a-zA-Z-]+)\s*(.*)/);if(c){let[,a,f]=c;ia(n,a,f,o);}}else Le(n,i,o);else if(typeof s=="string")try{let o=A$1.parse(`.temp{${s}}`).first;if(o&&o.nodes){let c=A$1.rule({selector:"temp",raws:{semicolon:!0,between:" ",before:`
123
+ `}});o.nodes.forEach(a=>{if(a.type==="decl"){let f=a.clone();f.raws.before=`
124
+ `,c.append(f);}}),c.nodes?.length&&n.append(c);}}catch(i){throw console.error("Error parsing at-rule content:",s,i),i}}function Le(e,t,r){let s=e.nodes?.find(n=>n.type==="rule"&&n.selector===t);if(s||(s=A$1.rule({selector:t,raws:{semicolon:true,between:" ",before:`
125
+ `}}),e.append(s)),typeof r=="object"){for(let[n,i]of Object.entries(r))if(n.startsWith("@")&&typeof i=="object"&&i!==null&&Object.keys(i).length===0){let o=n.match(/@([a-zA-Z-]+)\s*(.*)/);if(o){let[,c,a]=o;if(!s.nodes?.find(l=>l.type==="atrule"&&l.name===c&&l.params===a)){if(c==="apply"){let u=s.nodes?.find(d=>d.type==="atrule"&&d.name==="apply");if(u){u.params=twMerge(u.params,a);continue}}let l=A$1.atRule({name:c,params:a,raws:{semicolon:true,before:`
126
+ `}});s.append(l);}}}else if(typeof i=="string"){let o=A$1.decl({prop:n,value:i,raws:{semicolon:true,before:`
127
+ `}}),c=s.nodes?.find(a=>a.type==="decl"&&a.prop===n);c?c.replaceWith(o):s.append(o);}else if(typeof i=="object"){let o=n.startsWith("&")?t.replace(/^([^:]+)/,`$1${n.substring(1)}`):n;Le(e,o,i);}}else if(typeof r=="string")try{let i=A$1.parse(`.temp{${r}}`).first;i&&i.nodes&&i.nodes.forEach(o=>{if(o.type==="decl"){let c=o.clone();c.raws.before=`
128
+ `,s?.append(c);}});}catch(n){throw console.error("Error parsing rule content:",t,r,n),n}}async function Bs(e,t,r,s){let n=J(r.resolvedPaths.cwd,false),i=await Lp(r),o=i!=="expo";if(e=oa(e,n,{skipInstalled:o}),t=oa(t,n,{skipInstalled:o}),!e?.length&&!t?.length)return;s={silent:false,interactive:true,...s};let c=j("Installing dependencies.",{silent:s.silent})?.start(),a="";if(Dp(r)&&i==="npm")if(s.silent||!s.interactive)a="force";else {c.stopAndPersist(),I.warn(`
129
+ It looks like you are using React 19.
130
+ Some packages may fail to install due to peer dependency issues in npm (see ${V}/react-19).
131
+ `);let f=await Wc([{type:"select",name:"flag",message:"How would you like to proceed?",choices:[{title:"Use --force",value:"force"},{title:"Use --legacy-peer-deps",value:"legacy-peer-deps"}]}]);f&&(a=f.flag);}c?.start(),await Vp(i,e,t,r.resolvedPaths.cwd,a),c?.succeed();}function oa(e=[],t,{skipInstalled:r=true}={}){let s=new Set([...Object.keys(t?.dependencies??{}),...Object.keys(t?.devDependencies??{}),...Object.keys(t?.optionalDependencies??{}),...Object.keys(t?.peerDependencies??{})]),n=new Map;for(let i of e){let o=Mp(i);if(!o){n.set(i,{dependency:i,hasSpecifier:true});continue}if(r&&!o.hasSpecifier&&s.has(o.name))continue;let c=n.get(o.name);(!c||!c.hasSpecifier&&o.hasSpecifier)&&n.set(o.name,{dependency:i,hasSpecifier:o.hasSpecifier});}return Array.from(n.values()).map(({dependency:i})=>i)}function Mp(e){if(/^[a-z][a-z0-9+.-]*:/i.test(e))return null;let t=e.startsWith("@")?e.match(/^(@[^/]+\/[^@/]+)(@.+)?$/):e.match(/^([^@/]+)(@.+)?$/);return t?{name:t[1],hasSpecifier:!!t[2]}:null}function Dp(e){let t=J(e.resolvedPaths.cwd,false);if(!t?.dependencies?.react)return false;let r=/^(?:\^|~)?19(?:\.\d+)*(?:-.*)?$/.test(t.dependencies.react),s=t.dependencies["react-day-picker"]?.startsWith("8");return r&&s}async function Lp(e){return J(e.resolvedPaths.cwd,false)?.dependencies?.expo?"expo":Ds(e.resolvedPaths.cwd)}function Qe(e){for(let t of e)if(t.trim().startsWith("-"))throw new Error(`Invalid dependency "${t}": dependency names cannot start with "-".`)}async function Vp(e,t,r,s,n){if(e==="npm")return Wp(t,r,s,n);if(e==="deno")return zp(t,r,s);if(e==="expo")return Up(t,r,s);Qe(t),Qe(r),t?.length&&await execa(e,["add","--",...t],{cwd:s}),r?.length&&await execa(e,["add","-D","--",...r],{cwd:s});}async function Wp(e,t,r,s){Qe(e),Qe(t),e.length&&await execa("npm",["install",...s?[`--${s}`]:[],"--",...e],{cwd:r}),t.length&&await execa("npm",["install",...s?[`--${s}`]:[],"-D","--",...t],{cwd:r});}async function zp(e,t,r){e?.length&&await execa("deno",["add",...e.map(s=>`npm:${s}`)],{cwd:r}),t?.length&&await execa("deno",["add","-D",...t.map(s=>`npm:${s}`)],{cwd:r});}async function Up(e,t,r){Qe(e),Qe(t),e.length&&await execa("npx",["expo","install","--",...e],{cwd:r}),t.length&&await execa("npx",["expo","install","-- -D","--",...t],{cwd:r});}async function Js(e,t,r){if(!e||Object.keys(e).length===0)return {envVarsAdded:[],envFileUpdated:null,envFileCreated:null};r={silent:false,...r};let s=j("Adding environment variables.",{silent:r.silent})?.start(),n=t.resolvedPaths.cwd,i=S__default.join(n,".env.local"),o=Ut(n);o&&(i=o);let c=existsSync(i),a=S__default.basename(i),f=Object.entries(e).map(([p,h])=>`${p}=${h}`).join(`
132
+ `),l=[],u=null,d=null;if(c){let p=await promises.readFile(i,"utf-8"),h=Kt(p,f);if(l=Ht(p,f),l.length>0){if(await promises.writeFile(i,h,"utf-8"),u=S__default.relative(n,i),s?.succeed(`Added the following variables to ${T.info(a)}:`),!r.silent)for(let m of l)I.log(` ${T.success("+")} ${m}`);}else s?.stop();}else if(await promises.writeFile(i,f+`
133
+ `,"utf-8"),d=S__default.relative(n,i),l=Object.keys(e),s?.succeed(`Added the following variables to ${T.info(a)}:`),!r.silent)for(let p of l)I.log(` ${T.success("+")} ${p}`);return !r.silent&&l.length>0&&I.break(),{envVarsAdded:l,envFileUpdated:u,envFileCreated:d}}var Yp=new Set(["--font-sans","--font-serif","--font-mono"]);async function Ys(e,t){if(!e.fonts?.length)return e;let r=await Y(t.resolvedPaths.cwd);if(!r)return e;e.cssVars??={},e.cssVars.theme??={};let s=r.framework.name==="next-app"||r.framework.name==="next-pages";for(let n of e.fonts)if(s)e.cssVars.theme[n.font.variable]=`var(${n.font.variable})`;else {let i=n.name.replace("font-",""),o=n.font.dependency??`@fontsource-variable/${i}`;e.dependencies??=[],e.dependencies.push(o),e.css??={},e.css[`@import "${o}"`]={},e.cssVars.theme[n.font.variable]=n.font.family;}if(e.fonts.length>0){let n=new Map;for(let i of e.fonts){let o=i.font.selector??td(i.font.variable);if(!o)continue;let c=i.font.variable.replace("--","");n.has(o)||n.set(o,[]),n.get(o).push(c);}e.css??={},e.css["@layer base"]??={};for(let[i,o]of Array.from(n.entries())){let c=o.join(" ");e.css["@layer base"][i]??={};let a=Object.keys(e.css["@layer base"][i]).find(f=>f.startsWith("@apply "));a?(delete e.css["@layer base"][i][a],e.css["@layer base"][i][`${a} ${c}`]={}):e.css["@layer base"][i][`@apply ${c}`]={};}}return e}async function Zs(e,t,r){if(!e?.length)return;let s=await Y(t.resolvedPaths.cwd);if(!s||s.framework.name!=="next-app"&&s.framework.name!=="next-pages")return;let n=j("Updating fonts.",{silent:r.silent})?.start();try{await Zp(e,t,s),n?.succeed("Updating fonts.");}catch(i){throw n?.fail("Failed to update fonts."),i}}async function Zp(e,t,r){let s=await Xp(t,r);if(!s)return;let n=await promises.readFile(s,"utf-8"),i=await Qp(n,e,t);i!==n&&await promises.writeFile(s,i,"utf-8");}async function Xp(e,t){let r=e.resolvedPaths.cwd,s=t.isSrcDir,i=t.isTsx?"tsx":"jsx",o=s?[`src/app/layout.${i}`,`app/layout.${i}`]:[`app/layout.${i}`];for(let c of o){let a=S__default.join(r,c);if(existsSync(a))return a}return null}async function Qp(e,t,r){let n=new Project({compilerOptions:{}}).createSourceFile("layout.tsx",e,{scriptKind:ScriptKind.TSX}),i=t.filter(u=>u.font.provider==="google"),o=[],c=[];for(let u of i){let d=u.font.import;if(!d)continue;let p=n.getImportDeclaration(w=>w.getModuleSpecifierValue()==="next/font/google"),h=false;p?(h=p.getNamedImports().some(v=>v.getName()===d),h||p.addNamedImport(d)):n.addImportDeclaration({moduleSpecifier:"next/font/google",namedImports:[d]});let m=sd(d,u.font.variable),g=ed(u),x=od(n,u.font.variable),y=m;if(!(h&&!x&&dr(u.font.variable)&&!ad(n,d))){if(x)x.setInitializer(`${d}(${g})`),x.getName()!==m&&x.rename(m),y=m;else {let w=cd(n);n.insertVariableStatement(w,{declarationKind:VariableDeclarationKind.Const,declarations:[{name:m,initializer:`${d}(${g})`}]}).appendWhitespace(`
134
+ `);}o.push(y),rd(u)&&c.push(u.font.variable.replace("--",""));}}let a=new Set(["font-sans","font-serif","font-mono"]),f=[...c].reverse().find(u=>a.has(u)),l=c.filter(u=>!a.has(u));return f&&l.unshift(f),o.length>0&&ld(n,o,l,r),n.getFullText()}function ed(e){let t={};return e.font.subsets?.length&&(t.subsets=e.font.subsets),e.font.weight?.length&&(t.weight=e.font.weight),t.variable=e.font.variable,JSON.stringify(t).replace(/"([^"]+)":/g,"$1:").replace(/"/g,"'")}function dr(e){return Yp.has(e)}function td(e){return dr(e)?"html":null}function rd(e){return !e.font.selector&&dr(e.font.variable)}function sd(e,t){let r=nd(e);return dr(t)?r:`${r}${id(t.replace(/^--font-/,""))}`}function nd(e){return e.split("_").map((t,r)=>r===0?t.toLowerCase():t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join("")}function id(e){return e.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join("")}function od(e,t){let r=e.getVariableStatements();for(let s of r)for(let n of s.getDeclarations()){let i=n.getInitializer();if(!i||i.getKind()!==SyntaxKind.CallExpression)continue;let c=i.getArguments();if(c.length===0)continue;let a=c[0].getText();if(a.includes("variable:")&&a.includes(t))return n}return null}function ad(e,t){let r=e.getVariableStatements();for(let s of r)for(let n of s.getDeclarations()){let i=n.getInitializer();if(!i||i.getKind()!==SyntaxKind.CallExpression)continue;let o=i;if(o.getExpression().getText()!==t)continue;let c=o.getArguments();if(!c.length)continue;let a=c[0].getText();if(a.includes("variable:")&&a.includes("--font-heading"))return true}return false}function cd(e){let t=e.getImportDeclarations();return t.length>0?t[t.length-1].getChildIndex()+1:0}function ld(e,t,r,s){let n=e.getDescendantsOfKind(SyntaxKind.JsxOpeningElement);for(let i of n){if(i.getTagNameNode().getText()!=="html")continue;let c=r.map(p=>`"${p}"`),a=t.map(p=>`${p}.variable`),f=[...c,...a],l=i.getAttribute("className");if(!l){bt(e,s),i.addAttribute({name:"className",initializer:`{cn(${f.join(", ")})}`});return}if(l.getKind()!==SyntaxKind.JsxAttribute)return;let u=l.asKindOrThrow(SyntaxKind.JsxAttribute),d=u.getInitializer();if(!d)return;if(d.getKind()===SyntaxKind.StringLiteral){let p=d.getText().slice(1,-1);bt(e,s),u.setInitializer(`{cn("${p}", ${f.join(", ")})}`);}else if(d.getKind()===SyntaxKind.JsxExpression){let p=d.asKindOrThrow(SyntaxKind.JsxExpression),h=p.getExpression();if(!h)return;let m=h.getText();if(m.startsWith("cn(")){let g=a.every(b=>m.includes(b)),x=r.every(b=>m.includes(`"${b}"`)),y=["font-sans","font-serif","font-mono"].filter(b=>!r.includes(b)).some(b=>m.includes(`"${b}"`));if(g&&x&&!y)continue;let w=fd(m,a);w=pd(w);let v=dd(w,f);p.replaceWithText(`{${v}}`);}else if(/^\w+\.variable$/.test(m)){if(a.includes(m)&&r.length===0)continue;bt(e,s);let x=(m.split(".")[0]??"").toLowerCase().includes("heading")||r.length===0;p.replaceWithText(x?`{cn(${m}, ${f.join(", ")})}`:`{cn(${f.join(", ")})}`);}else if(m.startsWith("`")&&m.endsWith("`")){let g=ud(m);bt(e,s);let x=new Set(f),y=new Set(["font-sans","font-serif","font-mono"].map(v=>`"${v}"`)),w=g.filter(v=>!x.has(v)&&!y.has(v));p.replaceWithText(`{cn(${[...w,...f].join(", ")})}`);}else bt(e,s),p.replaceWithText(`{cn(${m}, ${f.join(", ")})}`);}}}function bt(e,t){if(!e.getImportDeclaration(s=>s.getNamedImports().some(i=>i.getName()==="cn"))){let s=e.getImportDeclaration(n=>n.getModuleSpecifierValue().includes("/lib/utils"));s?s.getNamedImports().some(i=>i.getName()==="cn")||s.addNamedImport("cn"):e.addImportDeclaration({moduleSpecifier:t.aliases.utils,namedImports:["cn"]});}}function ud(e){let t=[],r=[],n=e.slice(1,-1).split(/(\$\{[^}]+\})/);for(let i of n)if(i)if(i.startsWith("${")&&i.endsWith("}")){let o=i.slice(2,-1).trim();o&&r.push(o);}else {let o=i.trim().split(/\s+/).filter(Boolean);for(let c of o)t.push(`"${c}"`);}return [...t,...r]}function fd(e,t){let r=e;for(let s of t)r=r.replace(new RegExp(`,?\\s*${s.replace(".","\\.")}`,"g"),"").replace(/cn\(\s*,/,"cn(");return r}function pd(e){let t=e;for(let r of ["font-sans","font-serif","font-mono"])t=t.replace(new RegExp(`,?\\s*"${r}"`,"g"),"").replace(/cn\(\s*,/,"cn(");return t}function dd(e,t){let r=t.join(", ");return e.replace(/\)$/,`, ${r})`)}async function ca(e,t,r){r={overwrite:false,silent:false,interactive:true,isNewProject:false,...r};let s=await kn(t);return s&&s.ui&&s.ui.resolvedPaths.cwd!==t.resolvedPaths.cwd?await gd(e,t,s,{...r,isRemote:e?.length===1&&!!e[0].match(/\/chat\/b\//)}):await md(e,t,{...r,skipFonts:r.skipFonts})}async function md(e,t,r){if(!e.length)return;let s=await la(e,t,r),n=await Ne(t);r.skipFonts||(s=await Ys(s,t));let i=Hs([s]);await Bs(s.dependencies,s.devDependencies,t,{silent:r.silent,interactive:r.interactive}),await _r(s.tailwind?.config,t,{silent:r.silent,tailwindVersion:n}),await Js(s.envVars,t,{silent:r.silent}),r.skipFonts||await Zs(s.fonts,t,{silent:r.silent}),await kr(s.files,t,{overwrite:r.overwrite,silent:r.silent,interactive:r.interactive,path:r.path,supportedFontMarkers:i});let o=await ua(s,e,t,r.overwriteCssVars);await Gs(s.css,t,{silent:r.silent,cssVars:s.cssVars,cleanupDefaultNextStyles:r.isNewProject,overwriteCssVars:o,tailwindVersion:n,tailwindConfig:s.tailwind?.config}),s.docs&&I.info(s.docs);}async function gd(e,t,r,s){if(!e.length)return;let n=await la(e,t,s),i=[],o=[],c=[],a=j("Installing components.")?.start(),f=r.ui,l=await Ne(f),u=Lt(t.resolvedPaths.cwd,f.resolvedPaths.ui);n=await Ys(n,t);let d=Hs([n]);await Bs(n.dependencies,n.devDependencies,f,{silent:true,interactive:s.interactive}),n.tailwind?.config&&(await _r(n.tailwind?.config,f,{silent:true,tailwindVersion:l}),o.push(S__default.relative(u,f.resolvedPaths.tailwindConfig))),n.envVars&&await Js(n.envVars,f,{silent:true}),await Zs(n.fonts,t,{silent:true});let p=new Map,h={"registry:ui":"ui","registry:hook":"hooks","registry:lib":"lib"},m=R=>Gt(R.target)??h[R.type||"registry:ui"]??"components",g=R=>R&&r[R]?r[R]:t;for(let R of n.files??[]){let E=m(R);p.has(E)||p.set(E,[]),p.get(E).push(R);}for(let R of Array.from(p.keys())){let E=p.get(R),k=g(R),$=(n.files??[]).filter(Te=>g(m(Te)).resolvedPaths.cwd===k.resolvedPaths.cwd),D=Lt(t.resolvedPaths.cwd,k.resolvedPaths.ui||k.resolvedPaths.cwd),X=await Rr(D,k.resolvedPaths.cwd)??k.resolvedPaths.cwd,hr=await kr(E,k,{overwrite:s.overwrite,silent:true,interactive:s.interactive,rootSpinner:a,isRemote:s.isRemote,isWorkspace:true,path:s.path,plannedFiles:$,supportedFontMarkers:d});i.push(...hr.filesCreated.map(Te=>S__default.relative(D,S__default.join(X,Te)))),o.push(...hr.filesUpdated.map(Te=>S__default.relative(D,S__default.join(X,Te)))),c.push(...hr.filesSkipped.map(Te=>S__default.relative(D,S__default.join(X,Te))));}let x=await ua(n,e,t,s.overwriteCssVars);await Gs(n.css,f,{silent:true,cssVars:n.cssVars,overwriteCssVars:x,tailwindVersion:l,tailwindConfig:n.tailwind?.config}),(n.cssVars||n.css)&&o.push(S__default.relative(u,f.resolvedPaths.tailwindCss)),a?.succeed();let y=Array.from(new Set(i)).sort(),w=Array.from(new Set(o.filter(R=>!i.includes(R)))).sort(),v=Array.from(new Set(c)).sort();if(!(y.length||w.length)&&!v.length&&j("No files updated.",{silent:s.silent})?.info(),y.length){j(`Created ${y.length} ${y.length===1?"file":"files"}:`,{silent:s.silent})?.succeed();for(let R of y)I.log(` - ${R}`);}if(w.length){j(`Updated ${w.length} ${w.length===1?"file":"files"}:`,{silent:s.silent})?.info();for(let R of w)I.log(` - ${R}`);}if(v.length){j(`Skipped ${v.length} ${v.length===1?"file":"files"}: (use --overwrite to overwrite)`,{silent:s.silent})?.info();for(let R of v)I.log(` - ${R}`);}n.docs&&I.info(n.docs);}async function la(e,t,r){let s=j("Checking registry.",{silent:r.silent})?.start(),n=r.resolvedTree??await Ye(e,ne(t));if(!n)throw s?.fail(),new Error("Failed to fetch components from registry.");try{wd(n.files??[],t.resolvedPaths.cwd);}catch(i){throw s?.fail(),i}return s?.succeed(),n}async function ua(e,t,r,s){if(!(!e.cssVars||Object.keys(e.cssVars).length===0))return s??yd(t,r)}async function yd(e,t){let r=await Us(e,{config:t});return z.array(n).parse(r).some(n=>n.type==="registry:theme"||n.type==="registry:style"||n.type==="registry:font"||n.type==="registry:base")}function wd(e,t){for(let r of e){let s=r?.target??r?.path;if(s&&!Qo(s,t))throw new Error(`We found an unsafe file path "${s}" in the registry item. Installation aborted.`)}}async function fa(e=process.cwd(),t={}){let r=t.processEnv??process.env;try{let{config:s}=await import('@dotenvx/dotenvx'),n=[".env.local",".env.development.local",".env.development",".env"];for(let i of n){let o=join(e,i);existsSync(o)&&s({path:o,overload:!1,quiet:!0,processEnv:r});}}catch(s){I.warn("Failed to load env files:",s);}return r}async function bd(e,t={}){if(e.length===0)return;let{config:r,cwd:s,...n}=t,i=d$1.safeParse(r);if(!i.success&&r&&"resolvedPaths"in r){let l=typeof r.resolvedPaths?.cwd=="string"?r.resolvedPaths.cwd:void 0;throw new We(S__default.resolve(s??l??process.cwd()),i.error,"config")}let o=i.success?i.data.resolvedPaths.cwd:void 0,c=S__default.resolve(s??o??process.cwd());if(s!==void 0&&o!==void 0&&c!==S__default.resolve(o))throw new Error("The provided cwd must match config.resolvedPaths.cwd.");let a=ne(i.success?i.data:{...r,resolvedPaths:{...r?.resolvedPaths,cwd:c}}),f=await fa(c,{processEnv:{...process.env}});return ve(async()=>{let l=await Ye(e,a,{useCache:true,requireUniversal:!i.success});if(!l)throw new Error("Failed to fetch components from registry.");if(!i.success&&!Rd(l,a))throw new Error("A full project config is required to resolve target aliases.");await ca(e,a,{...n,interactive:false,overwriteCssVars:t.overwriteCssVars??(i.success?void 0:false),resolvedTree:l});},{env:f})}function Rd(e,t){return (e.files??[]).every(r=>{let s=Gt(r.target);return !s||!!t.resolvedPaths[s]})}function ER(e,t){return e.length>0?e:Object.keys(t?.registries??{}).filter(r=>!(r in H))}var Id=8;async function Ed(e,t,r){let s=new Array(e.length),n=0;async function i(){for(;n<e.length;){let c=n++;try{s[c]={status:"fulfilled",value:await r(e[c])};}catch(a){s[c]={status:"rejected",reason:a};}}}let o=Array.from({length:Math.min(t,e.length)},()=>i());return await Promise.all(o),s}async function Cd(e,t){return ve(()=>kd(e,t))}async function kd(e,t){let{query:r,types:s,limit:n,offset:i,config:o,useCache:c=false,continueOnError:a}=t||{},f=[],l=e.length===1,u=s?.map(E=>Od(E)),d=l?{query:r,types:u,limit:n,offset:i}:{query:r,types:u,limit:n!==void 0?(i||0)+n:void 0,offset:void 0},p=await Ed(e,Id,E=>zs(E,{config:o,useCache:c,searchParams:d})),h=[],m=[];for(let E=0;E<e.length;E++){let k=e[E],$=p[E];if($.status==="rejected"){if(!a)throw $.reason;f.push({registry:k,message:$.reason instanceof Error?$.reason.message:String($.reason)});continue}let D=($.value.items||[]).map(X=>({name:X.name,title:X.title,type:X.type,description:X.description,registry:k,addCommandArgument:Ad(X.name,k)}));if($.value.pagination){m.push({items:D,pagination:$.value.pagination});continue}h=h.concat(D);}if(l&&m.length===1){let[E]=m;return y.parse({pagination:E.pagination,items:E.items})}if(s?.length){let E=new Set(s.map(k=>et(k).toLowerCase()));h=h.filter(k=>k.type&&E.has(et(k.type).toLowerCase()));}r&&(h=Pd(h,{query:r,limit:h.length,keys:["name","title","description"]}));let g=m.flatMap(E=>E.items).concat(h),x=m.reduce((E,k)=>E+k.pagination.total,0),y$1=i||0,w=n||g.length,v=x+h.length,b=m.some(E=>E.pagination.hasMore&&d.limit!==void 0&&E.items.length>=d.limit),R={pagination:{total:v,offset:y$1,limit:w,hasMore:y$1+w<g.length||b},items:g.slice(y$1,y$1+w),...f.length>0?{errors:f}:{}};return y.parse(R)}var $d=z.object({name:z.string(),title:z.string().optional(),type:z.string().optional(),description:z.string().optional(),registry:z.string().optional(),addCommandArgument:z.string().optional()}).passthrough();function Pd(e,t){t={limit:100,threshold:-1e4,...t};let s=Sd.go(t.query,e,{keys:t.keys,threshold:t.threshold,limit:t.limit}).map(n=>n.obj);return z.array($d).parse(s)}function Td(e){try{return new URL(e),!0}catch{return false}}function Ad(e,t){let r=pt(t);if(r){let p=`${r.owner}/${r.repo}/${e}`;return r.ref?`${p}#${r.ref}`:p}if(!Td(t))return `${t}/${e}`;let s=t.indexOf("://")+3,n=t.indexOf("/",s);if(n===-1){let p=t.indexOf("?",s);if(p!==-1){let h=t.substring(0,p),g=t.substring(p).replace(/\bregistry\b/g,e);return h+g}return t}let i=t.substring(0,n),o=t.substring(n),c=o.indexOf("?")!==-1?o.indexOf("?"):o.length,a=o.substring(0,c),f=o.substring(c),l=a.lastIndexOf("registry"),u=a;l!==-1&&(u=a.substring(0,l)+e+a.substring(l+8));let d=f.replace(/\bregistry\b/g,e);return i+u+d}var jd=80;function et(e){return e?e.startsWith("registry:")?e.slice(9):e:""}function Od(e){return e.startsWith("registry:")?e:`registry:${e}`}var Nd=["registry:example","registry:internal"],_d=f.options.filter(e=>!Nd.includes(e)).map(e=>et(e));function CR(e){let t=new Set(_d.map(r=>r.toLowerCase()));return e.filter(r=>!t.has(et(r).toLowerCase()))}function Fd(e,t=jd){let r=e.trim().replace(/\s+/g," ");if(r.length<=t)return r;let s=r.slice(0,t-3).trimEnd(),n=s.lastIndexOf(" ");return `${(n>t*.6?s.slice(0,n):s).trimEnd()}...`}function Md(e,t){let r=e.addCommandArgument??e.name,s=et(e.type),n=s?` (${s})`:"",i=t.showRegistry&&e.registry?` \xB7 ${e.registry}`:"",o=e.description?` \u2014 ${Fd(e.description)}`:"";return `- ${T.info(r)}${n}${i}${o}`}function pa(e){let{query:t,types:r,registries:s}=e,n="";return r?.length&&(n+=` of type ${r.map(i=>et(i)).join(", ")}`),t&&(n+=` matching ${T.info(`"${t}"`)}`),s.length>0&&(n+=` in ${s.join(", ")}`),n}function kR(e,t){let{pagination:r,items:s,errors:n}=e,i=t.registries.length>1;if(n?.length){for(let{registry:f,message:l}of n)I.warn(`Skipped ${f}: ${l}`);I.break();}if(s.length===0){I.warn(`No items found${pa(t)}.`);return}let o=`${r.total} item${r.total===1?"":"s"}`;I.info(`Found ${o}${pa(t)}`);let c=r.offset+1,a=Math.min(r.offset+r.limit,r.total);I.log(`Showing ${c}-${a} of ${r.total}`),I.break(),I.log(s.map(f=>Md(f,{showRegistry:i})).join(`
135
+ `)),r.hasMore&&(I.break(),I.log(`More items available. Use ${T.info(`--offset ${r.offset+r.limit}`)} to see the next page.`));}var Qs=32;async function Dd(e){let{cwd:t,registryFile:r}=ba(e),s=await ha(r,{cwd:t}),n=Ra(s,t,r);return Vd(s,n,t)}async function Ld(e,t){let{cwd:r,registryFile:s}=ba(t),n=await ha(s,{cwd:r}),i=n.registry.items.find(c=>c.name===e);if(!i)throw new Oe(e);let o=Ra(n,r,s);return Wd(i,n,o,r)}async function ha(e,t){let r=S.resolve(t.cwd,e),s=await wa(r),n=xa(s,r);da(n,r);let i={cwd:S.resolve(t.cwd),itemSources:new Map,itemSourcesByItem:new Map,firstIncludedFrom:new Map},o=!!n.include?.length;if(!o)return n.items.forEach((l,u)=>{let d={registryFile:r,registryDir:i.cwd,itemIndex:u};i.itemSources.set(l.name,d),i.itemSourcesByItem.set(l,d);}),{registry:n,itemSources:i.itemSources,itemSourcesByItem:i.itemSourcesByItem,usesInclude:o};if(S.basename(r)!=="registry.json")throw new P(`Invalid registry file at ${r}: registries that use include must be named registry.json.`,{registryFile:r});let c=await ya(r,n,i,[]);Bd(c.items,i.itemSourcesByItem);let{include:a,...f}=c;return da(f,r),{registry:f,itemSources:i.itemSources,itemSourcesByItem:i.itemSourcesByItem,usesInclude:o}}function Vd(e,t,r){return {...e.registry,items:e.registry.items.map(s=>Ud(ma(s,e.itemSourcesByItem,t,r)))}}async function Wd(e,t,r,s){let n$1={...ma(e,t.itemSourcesByItem,r,s),$schema:"https://ui.shadcn.com/schema/registry-item.json"};return await Promise.all((e.files??[]).map(async(i,o)=>{let c=n$1.files?.[o];if(!c)return;let a=t.itemSourcesByItem.get(e),f=ga(e,i.path,t.itemSourcesByItem,s);c.content=await zd(e.name,i.path,f,a);})),n.parse(n$1)}async function zd(e,t,r,s){try{return await Vi.readFile(r,"utf-8")}catch(n){throw new ae(r,n,{message:`Failed to read file "${t}" for registry item "${e}" (${Rt(s)}). Expected file at ${r}.`,context:{itemName:e,itemFilePath:t,sourcePath:r},suggestion:"Make sure the file path is relative to the registry.json file that declares the item."})}}function ma(e,t,r,s){return {...e,files:e.files?.map(n=>({...n,path:Hd(e,n.path,t,r,s)}))}}function Ud(e){return {...e,files:e.files?.map(({content:t,...r})=>r)}}function ga(e,t,r,s){let n=r.get(e);return S.resolve(n?.registryDir??s,t)}function Hd(e,t,r,s,n){let i=ga(e,t,r,n);return S.relative(s,i).split(S.sep).join("/")}async function ya(e,t,r,s){if(va(e,r.cwd),s.length>=Qs)throw new P(`Registry include tree is too deep at ${e}. The maximum include depth is ${Qs}.`,{registryFile:e,context:{maxDepth:Qs},suggestion:"Flatten part of the registry include tree or reduce nested include depth."});if(s.includes(e))throw new P(qd([...s,e]),{registryFile:e});let n=s.at(-1)??e,i=r.firstIncludedFrom.get(e);if(i)throw new P(`Registry file included more than once: ${e}.
136
+ - first included from ${i}
137
+ - included again from ${n}
138
+ Each registry.json file can only appear once in the resolved include tree. Remove one include or move shared items into a single included registry.json.`,{registryFile:e,context:{firstSource:i,secondSource:n}});r.firstIncludedFrom.set(e,n);let o=[...s,e],c=S.dirname(e),a=[];for(let f of t.include??[]){let l=Kd(f,c,r.cwd,e),u=await wa(l),d=xa(u,l),p=await ya(l,d,r,o);a.push(...p.items);}return t.items.forEach((f,l)=>{Gd(f,e,c),r.itemSources.set(f.name,{registryFile:e,registryDir:c,itemIndex:l}),r.itemSourcesByItem.set(f,{registryFile:e,registryDir:c,itemIndex:l});}),{...t,items:[...a,...t.items]}}async function wa(e){try{return await Vi.readFile(e,"utf-8")}catch(t){throw new ae(e,t,{message:`Failed to read registry file at ${e}.`,context:{registryFile:e},suggestion:"Check that the registry.json file exists and that the path is correct."})}}function xa(e,t){let r;try{r=JSON.parse(e);}catch(n){throw new W(t,n,{subject:"registry file",context:{registryFile:t},suggestion:"Fix the JSON syntax in the registry.json file and try again."})}let s=p.safeParse(r);if(!s.success)throw new P(`Invalid registry file at ${t}:
139
+ ${Jd(s.error)}`,{registryFile:t,cause:s.error,suggestion:"Update the registry.json file so it matches the registry schema."});return s.data}function da(e,t){let r=[];if(e.name||r.push("name"),e.homepage||r.push("homepage"),r.length)throw new P(`Invalid root registry file at ${t}: root registry.json must define ${r.map(s=>`"${s}"`).join(" and ")}. Included registry.json files may omit these fields.`,{registryFile:t})}function Kd(e,t,r,s){if(M(e))throw new P(`Invalid include "${e}" in ${s}: remote includes are not supported by shadcn build. Use a relative path to a registry.json file in the same repository.`,{registryFile:s,context:{includePath:e}});if(S.isAbsolute(e))throw new P(`Invalid include "${e}" in ${s}: include paths must be relative. Use a path like "./registry/ui/registry.json".`,{registryFile:s,context:{includePath:e}});if(Sa(e))throw new P(`Invalid include "${e}" in ${s}: include paths cannot use parent-directory traversal. Keep included registry.json files inside the registry root.`,{registryFile:s,context:{includePath:e}});if(S.basename(e)!=="registry.json")throw new P(`Invalid include "${e}" in ${s}: include paths must explicitly reference a registry.json file. Use a path like "./registry/ui/registry.json".`,{registryFile:s,context:{includePath:e}});let n=S.resolve(t,e);return va(n,r),n}function va(e,t){if(!Ia(e,t))throw new P(`Invalid registry file at ${e}: registry includes must stay inside ${t}.`,{registryFile:e,context:{cwd:t}})}function ba(e){return {cwd:S.resolve(e?.cwd??process.cwd()),registryFile:e?.registryFile??"registry.json"}}function Ra(e,t,r){return e.usesInclude?S.dirname(S.resolve(t,r)):t}function Gd(e,t,r){for(let s of e.files??[]){if(M(s.path))throw new P(`Invalid file path "${s.path}" for item "${e.name}" in ${t}: remote file paths are not supported by shadcn build.`,{registryFile:t,context:{itemName:e.name,filePath:s.path}});if(S.isAbsolute(s.path))throw new P(`Invalid file path "${s.path}" for item "${e.name}" in ${t}: file paths must be relative.`,{registryFile:t,context:{itemName:e.name,filePath:s.path}});if(Sa(s.path))throw new P(`Invalid file path "${s.path}" for item "${e.name}" in ${t}: file paths cannot use parent-directory traversal.`,{registryFile:t,context:{itemName:e.name,filePath:s.path}});let n=S.resolve(r,s.path);if(!Ia(n,r))throw new P(`Invalid file path "${s.path}" for item "${e.name}" in ${t}: file paths must stay inside the registry chunk directory.`,{registryFile:t,context:{itemName:e.name,filePath:s.path}})}}function Bd(e,t){let r=new Map;for(let s of e){let n=r.get(s.name);if(!n){r.set(s.name,s);continue}let i=t.get(n),o=t.get(s);throw new P(`Duplicate registry item name "${s.name}". Registry item names must be unique.
140
+ - ${Rt(i)}
141
+ - ${Rt(o)}
142
+ Rename one of these items so each name is unique across the resolved registry.`,{context:{itemName:s.name,firstSource:Rt(i),secondSource:Rt(o)}})}}function Sa(e){return e.split(/[\\/]+/).includes("..")}function Ia(e,t){let r=S.relative(t,e);return !!r&&!r.startsWith("..")&&!S.isAbsolute(r)}function qd(e){return `Registry include cycle detected:
143
+ ${e.map(t=>` - ${t}`).join(`
144
+ `)}`}function Rt(e){return e?`${e.registryFile} items[${e.itemIndex}]`:"unknown source"}function Jd(e){return e.errors.map(t=>` - ${t.path.length?t.path.join("."):"(root)"}: ${t.message}`).join(`
145
+ `)}export{ne as $,jn as A,mm as Aa,_e as B,Ne as Ba,j as C,gm as Ca,Bt as D,Hs as Da,Jt as E,Zv as Ea,Zt as F,Ks as Fa,Xt as G,Gs as Ga,Ln as H,Np as Ha,Vn as I,Bs as Ia,Qt as J,Ys as Ja,er as K,Zs as Ka,qc as L,ca as La,Bn as M,fa as Ma,M as N,Dd as Na,Jn as O,Ld as Oa,pt as P,ha as Pa,ri as Q,Vd as Qa,Yh as R,Wd as Ra,Zh as S,bd as Sa,Xh as T,ER as Ta,Qh as U,Cd as Ua,Mt as V,_d as Va,ut as W,CR as Wa,Dt as X,kR as Xa,kn as Y,em as Z,Pn as _,V as a,vy as aa,H as b,Ge as ba,Zd as c,tw as ca,Xd as d,be as da,T as e,Ye as ea,I as f,Ds as fa,Ih as g,nv as ga,Eh as h,Ho as ha,Ch as i,ur as ia,Da as j,zs as ja,L as k,Us as ka,_ as l,hp as la,je as m,mp as ma,tt as n,Vt as na,rt as o,Nv as oa,st as p,_v as pa,de as q,Fv as qa,ae as r,tr as ra,W as s,gp as sa,P as t,Mv as ta,Oe as u,Dv as ua,nt as v,Zo as va,it as w,yp as wa,ot as x,wp as xa,he as y,Lv as ya,J as z,Y as za};