shadcn 4.0.8 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,33 @@
1
+ import {m,l,f,d as d$1,c as c$1,e,n,t,o,b as b$1,p,q as q$1,r,s,x,z as z$1,v as v$1,g as g$1}from'./chunk-HW2MEAJZ.js';import {a,d,c,b,g,f as f$1}from'./chunk-WLJDV6SE.js';import y,{basename}from'path';import {z}from'zod';import {promises,existsSync,statSync}from'fs';import {green,cyan,yellow,red}from'kleur/colors';import {loadConfig,createMatchPath}from'tsconfig-paths';import {cosmiconfig}from'cosmiconfig';import Ke from'fast-glob';import ne from'fs-extra';import {tmpdir,homedir}from'os';import Kr from'ora';import {Project,SyntaxKind,ScriptKind,QuoteKind}from'ts-morph';import {transformFromAstSync}from'@babel/core';import {parse}from'@babel/parser';import Ur from'@babel/plugin-transform-typescript';import*as We from'recast';import is from'prompts';import pe from'deepmerge';import {HttpsProxyAgent}from'https-proxy-agent';import js from'node-fetch';import {createHash}from'crypto';import Os from'stringify-object';import en from'fuzzysort';var J=process.env.REGISTRY_URL??"https://ui.shadcn.com/r",k=J.replace(/\/r\/?$/,""),Ae="new-york-v4",kt=[{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"}],N={"@shadcn":`${J}/styles/{style}/{name}.json`};var an=[{name:"toast",deprecatedBy:"sonner",message:"The toast component is deprecated. Use the sonner component instead."},{name:"toaster",deprecatedBy:"sonner",message:"The toaster component is deprecated. Use the sonner component instead."}];function ge(e){return e.replace(/\${(\w+)}/g,(t,r)=>process.env[r]||"")}function de(e){let t=[],r=/\${(\w+)}/g,s;for(;(s=r.exec(e))!==null;)t.push(s[1]);return t}var A={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"},I=class extends Error{code;statusCode;context;suggestion;timestamp;cause;constructor(t,r={}){super(t),this.name="RegistryError",this.code=r.code||A.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}}},G=class extends I{constructor(r,s){let n=`The item at ${r} was not found. It may not exist at the registry.`;super(n,{code:A.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";}},Oe=class extends I{constructor(r,s){let n=`The item at ${r} is no longer available. It may have been removed or expired.`;super(n,{code:A.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";}},ue=class extends I{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:A.UNAUTHORIZED,statusCode:401,cause:s,context:{url:r},suggestion:"Check your authentication credentials and environment variables."});this.url=r;this.name="RegistryUnauthorizedError";}},he=class extends I{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:A.FORBIDDEN,statusCode:403,cause:s,context:{url:r},suggestion:"Check your authentication credentials and environment variables."});this.url=r;this.name="RegistryForbiddenError";}},ye=class extends I{constructor(r,s,n,i){let o=s?`Failed to fetch from registry (${s}): ${r}`:`Failed to fetch from registry: ${r}`,a=typeof i=="string"&&i?`${o} - ${i}`:o,l="Check your network connection and try again.";s===404?l="The requested resource was not found. Check the URL or item name.":s===500?l="The registry server encountered an error. Try again later.":s&&s>=400&&s<500&&(l="There was a client error. Check your request parameters.");super(a,{code:A.FETCH_ERROR,statusCode:s,cause:i,context:{url:r,responseBody:n},suggestion:l});this.url=r;this.responseBody=n;this.name="RegistryFetchError";}},W=class extends I{constructor(r){let s=r?`Unknown registry "${r}". Make sure it is defined in components.json as follows:
2
+ {
3
+ "registries": {
4
+ "${r}": "[URL_TO_REGISTRY]"
5
+ }
6
+ }`:'Unknown registry. Make sure it is defined in components.json under "registries".';super(s,{code:A.NOT_CONFIGURED,context:{registryName:r},suggestion:"Add the registry configuration to your components.json file. Consult the registry documentation for the correct format."});this.registryName=r;this.name="RegistryNotConfiguredError";}},te=class extends I{constructor(r,s){super(`Failed to read local registry file: ${r}`,{code:A.LOCAL_FILE_ERROR,cause:s,context:{filePath:r},suggestion:"Check if the file exists and you have read permissions."});this.filePath=r;this.name="RegistryLocalFileError";}},$=class extends I{constructor(r,s){let n=`Failed to parse registry item: ${r}`;s instanceof z.ZodError&&(n=`Failed to parse registry item: ${r}
7
+ ${s.errors.map(i=>` - ${i.path.join(".")}: ${i.message}`).join(`
8
+ `)}`);super(n,{code:A.PARSE_ERROR,cause:s,context:{item:r},suggestion:`The registry item may be corrupted or have an invalid format. Please make sure it returns a valid JSON object. See ${k}/schema/registry-item.json.`});this.item=r;this.parseError=s,this.name="RegistryParseError";}parseError},xe=class extends I{constructor(r,s){let n=`Registry "${r}" requires the following environment variables:
9
+
10
+ `+s.map(i=>` \u2022 ${i}`).join(`
11
+ `);super(n,{code:A.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";}},we=class extends I{constructor(r){let s=`Invalid registry namespace: "${r}". Registry names must start with @ (e.g., @shadcn, @v0).`;super(s,{code:A.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 Ne=class extends I{constructor(r,s){let n=`Invalid components.json configuration in ${r}.`;s instanceof z.ZodError&&(n=`Invalid components.json configuration in ${r}:
12
+ ${s.errors.map(i=>` - ${i.path.join(".")}: ${i.message}`).join(`
13
+ `)}`);super(n,{code:A.INVALID_CONFIG,cause:s,context:{cwd:r},suggestion:"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.name="ConfigParseError";}},Ee=class extends I{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:A.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 ur=/^(@[a-zA-Z0-9](?:[a-zA-Z0-9-_]*[a-zA-Z0-9])?)\/(.+)$/;function re(e){if(!e.startsWith("@"))return {registry:null,item:e};let t=e.match(ur);return t?{registry:t[1],item:t[2]}:{registry:null,item:e}}var O={"next-app":{name:"next-app",label:"Next.js",links:{installation:`${k}/docs/installation/next`,tailwind:"https://tailwindcss.com/docs/guides/nextjs"}},"next-pages":{name:"next-pages",label:"Next.js",links:{installation:`${k}/docs/installation/next`,tailwind:"https://tailwindcss.com/docs/guides/nextjs"}},remix:{name:"remix",label:"Remix",links:{installation:`${k}/docs/installation/remix`,tailwind:"https://tailwindcss.com/docs/guides/remix"}},"react-router":{name:"react-router",label:"React Router",links:{installation:`${k}/docs/installation/react-router`,tailwind:"https://tailwindcss.com/docs/installation/framework-guides/react-router"}},vite:{name:"vite",label:"Vite",links:{installation:`${k}/docs/installation/vite`,tailwind:"https://tailwindcss.com/docs/guides/vite"}},astro:{name:"astro",label:"Astro",links:{installation:`${k}/docs/installation/astro`,tailwind:"https://tailwindcss.com/docs/guides/astro"}},laravel:{name:"laravel",label:"Laravel",links:{installation:`${k}/docs/installation/laravel`,tailwind:"https://tailwindcss.com/docs/guides/laravel"}},"tanstack-start":{name:"tanstack-start",label:"TanStack Start",links:{installation:`${k}/docs/installation/tanstack`,tailwind:"https://tailwindcss.com/docs/installation/using-postcss"}},gatsby:{name:"gatsby",label:"Gatsby",links:{installation:`${k}/docs/installation/gatsby`,tailwind:"https://tailwindcss.com/docs/guides/gatsby"}},expo:{name:"expo",label:"Expo",links:{installation:`${k}/docs/installation/expo`,tailwind:"https://www.nativewind.dev/docs/getting-started/installation"}},manual:{name:"manual",label:"Manual",links:{installation:`${k}/docs/installation/manual`,tailwind:"https://tailwindcss.com/docs/installation"}}};var T={error:red,warn:yellow,info:cyan,success:green};async function F(e,t){return createMatchPath(t.absoluteBaseUrl,t.paths)(e,void 0,()=>true,[".ts",".tsx",".jsx",".js",".css"])}var jn="@/components",kn="@/lib/utils",$n="app/globals.css",An="tailwind.config.js";var Fe=cosmiconfig("components",{searchPlaces:["components.json"]});async function ve(e){let t=await Sr(e);return t?(t.iconLibrary||(t.iconLibrary=t.style==="new-york"?"radix":"lucide"),await Le(e,t)):null}async function Le(e,t){t.registries={...N,...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());return d$1.parse({...t,resolvedPaths:{cwd:e,tailwindConfig:t.tailwind.config?y.resolve(e,t.tailwind.config):"",tailwindCss:y.resolve(e,t.tailwind.css),utils:await F(t.aliases.utils,r),components:await F(t.aliases.components,r),ui:t.aliases.ui?await F(t.aliases.ui,r):y.resolve(await F(t.aliases.components,r)??e,"ui"),lib:t.aliases.lib?await F(t.aliases.lib,r):y.resolve(await F(t.aliases.utils,r)??e,".."),hooks:t.aliases.hooks?await F(t.aliases.hooks,r):y.resolve(await F(t.aliases.components,r)??e,"..","hooks")}})}async function Sr(e){try{let t=await Fe.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 N)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 On(e$1){let t={};for(let s of Object.keys(e$1.aliases)){if(!Ir(s,e$1))continue;let n=e$1.resolvedPaths[s],i=await br(e$1.resolvedPaths.cwd,n);if(!i){t[s]=e$1;continue}t[s]=await ve(i);}let r=e.safeParse(t);return r.success?r.data:null}async function br(e,t){let r=Tr(e,t),s=y.relative(r,t),i=(await Ke.glob("**/package.json",{cwd:r,deep:3,ignore:["**/node_modules/**","**/dist/**","**/build/**","**/public/**"]})).map(o=>y.dirname(o)).find(o=>s.startsWith(o));return i?y.join(r,i):null}function Ir(e,t){return Object.keys(t.resolvedPaths).filter(r=>r!=="utils").includes(e)}function Tr(e,t){let r=e.split(y.sep),s=t.split(y.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(y.sep)}async function $t(e,t){return (await _(e))?.tailwindVersion==="v4"?"new-york-v4":t}function Nn(e){return e?.startsWith("base-")?"base":"radix"}function At(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:{...N}};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}function tt(e="",t=true){let r=y.join(e,"package.json");return ne.readJSONSync(r,{throws:t})}var _e=["**/node_modules/**",".next","public","dist","build"];z.object({compilerOptions:z.object({paths:z.record(z.string().or(z.array(z.string())))})});async function _(e,t){let[r,s,n,i,o,a,l,c]=await Promise.all([Ke.glob("**/{next,vite,astro,app}.config.*|gatsby-config.*|composer.json|react-router.config.*",{cwd:e,deep:3,ignore:_e}),ne.pathExists(y.resolve(e,"src")),Lr(e),Nr(e),Or(e,t?.configCssFile),Ot(e),Fr(e),tt(e,false)]),f=await ne.pathExists(y.resolve(e,`${s?"src/":""}app`)),p={framework:O.manual,isSrcDir:s,isRSC:false,isTsx:n,tailwindConfigFile:i,tailwindCssFile:o,tailwindVersion:a,frameworkVersion:null,aliasPrefix:l};if(r.find(d=>d.startsWith("next.config."))?.length)return p.framework=f?O["next-app"]:O["next-pages"],p.isRSC=f,p.frameworkVersion=await Ar(p.framework,c),p;if(r.find(d=>d.startsWith("astro.config."))?.length)return p.framework=O.astro,p;if(r.find(d=>d.startsWith("gatsby-config."))?.length)return p.framework=O.gatsby,p;if(r.find(d=>d.startsWith("composer.json"))?.length)return p.framework=O.laravel,p;if(Object.keys(c?.dependencies??{}).find(d=>d.startsWith("@remix-run/")))return p.framework=O.remix,p;if([...Object.keys(c?.dependencies??{}),...Object.keys(c?.devDependencies??{})].find(d=>d.startsWith("@tanstack/react-start")))return p.framework=O["tanstack-start"],p;if(r.find(d=>d.startsWith("react-router.config."))?.length)return p.framework=O["react-router"],p;if(r.find(d=>d.startsWith("vite.config."))?.length)return p.framework=O.vite,p;let x=r.find(d=>d.startsWith("app.config"));return x?.length&&(await ne.readFile(y.resolve(e,x),"utf8")).includes("defineConfig")?(p.framework=O.vite,p):(c?.dependencies?.expo&&(p.framework=O.expo),p)}async function Ar(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 Ot(e){let[t,r]=await Promise.all([tt(e,false),ve(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 Or(e,t){if(t){let i=y.resolve(e,t);if(await ne.pathExists(i))return t}let[r,s]=await Promise.all([Ke.glob(["**/*.css","**/*.scss"],{cwd:e,deep:5,ignore:_e}),Ot(e)]);if(!r.length)return null;for(let i of r){let o=await ne.readFile(y.resolve(e,i),"utf8");if(o.includes('@import "tailwindcss"')||o.includes("@import 'tailwindcss'")||o.includes("@tailwind base"))return i}return null}async function Nr(e){let t=await Ke.glob("tailwind.config.*",{cwd:e,deep:3,ignore:_e});return t.length?t[0]:null}async function Fr(e){let t=await loadConfig(e);if(t?.resultType==="failed"||!Object.entries(t?.paths).length)return null;for(let[r,s]of Object.entries(t.paths))if(s.includes("./*")||s.includes("./src/*")||s.includes("./app/*")||s.includes("./resources/js/*"))return r.replace(/\/\*$/,"")??null;return Object.keys(t?.paths)?.[0].replace(/\/\*$/,"")??null}async function Lr(e){return (await Ke.glob("tsconfig.*",{cwd:e,deep:1,ignore:_e})).length>0}async function Qn(e,t=null){let[r,s]=await Promise.all([ve(e),t?Promise.resolve(t):_(e)]);if(r)return r;if(!s||!s.tailwindCssFile||s.tailwindVersion==="v3"&&!s.tailwindConfigFile)return null;let n={$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:{components:`${s.aliasPrefix}/components`,ui:`${s.aliasPrefix}/components/ui`,hooks:`${s.aliasPrefix}/hooks`,lib:`${s.aliasPrefix}/lib`,utils:`${s.aliasPrefix}/lib/utils`}};return await Le(e,n)}async function ze(e){if(!e.resolvedPaths?.cwd)return "v3";let t=await _(e.resolvedPaths.cwd);return t?.tailwindVersion?t.tailwindVersion:null}async function Xn(e){let t=await ve(e);if(!t)return [];let s=(await Le(e,t)).resolvedPaths.ui;if(!ne.existsSync(s))return [];let n=await De(),i=new Set(n?.map(a=>a.name)??[]);return (await promises.readdir(s)).filter(a=>/\.(tsx|jsx)$/.test(a)).map(a=>y.basename(a,y.extname(a))).filter(a=>i.has(a))}function Nt(e,t,r={}){let{ignoreImports:s=false}=r,n=e.replace(/\r\n/g,`
18
+ `).trim(),i=t.replace(/\r\n/g,`
19
+ `).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,a=f=>f.replace(o,(p,x,d,h)=>{if(d.startsWith("."))return `${x}${d}${h}`;let w=d.split("/"),g=w[w.length-1];return `${x}@normalized/${g}${h}`}),l=a(n),c=a(i);return l===c}function q(e){let t=y.basename(e);return /^\.env(\.|$)/.test(t)}function Lt(e){let t=[".env.local",".env",".env.development.local",".env.development"];for(let r of t){let s=y.join(e,r);if(existsSync(s))return s}return null}function ie(e){let t=e.split(`
20
+ `),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(),a=n.substring(i+1).trim();o&&(r[o]=a.replace(/^["']|["']$/g,""));}return r}function Dt(e,t){let r=ie(e),s=ie(t),n=[];for(let i of Object.keys(s))i in r||n.push(i);return n}function Kt(e,t){let r=ie(e),s=ie(t),n=e.trimEnd();n&&!n.endsWith(`
21
+ `)&&(n+=`
22
+ `);let i=[];for(let[o,a]of Object.entries(s))o in r||i.push(`${o}=${a}`);return i.length>0?(n&&(n+=`
23
+ `),n+=i.join(`
24
+ `),n+`
25
+ `):n&&!n.endsWith(`
26
+ `)?n+`
27
+ `:n}var v={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("");}};function Y(e,t){return Kr({text:e,isSilent:t?.silent})}var Ve=async({sourceFile:e,config:t,isRemote:r})=>{let s=t.aliases?.utils,i=`${typeof s=="string"&&s.includes("/")?s.split("/")[0]:"@"}/lib/utils`;if(![".tsx",".ts",".jsx",".js"].includes(e.getExtension()))return e;for(let o of e.getImportStringLiterals()){let a=zr(o.getLiteralValue(),t,r);if(o.setLiteralValue(a),i===a||a==="@/lib/utils"){if(!o.getFirstAncestorByKind(SyntaxKind.ImportDeclaration)?.getNamedImports().some(f=>f.getName()==="cn")||!t.aliases.utils)continue;o.setLiteralValue(i===a?a.replace(i,t.aliases.utils):t.aliases.utils);}}return e};function zr(e,t,r=false){if(!e.startsWith("@/")&&!r)return e;if(r&&e.startsWith("@/")&&(e=e.replace(/^@\//,"@/registry/new-york/")),!e.startsWith("@/registry/")){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.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)}var Mr={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"]},_t=async({sourceFile:e,config:t})=>{let r=e.getFullText();if(t.tsx)return r;let s=We.parse(r,{parser:{parse:i=>parse(i,Mr)}}),n=transformFromAstSync(s,r,{cloneInputAst:false,code:false,ast:true,plugins:[Ur],configFile:false});if(!n||!n.ast)throw new Error("Failed to transform JSX");return We.print(n.ast).code};var Jr=/^["']use client["']$/g,Ue=async({sourceFile:e,config:t})=>{if(t.rsc)return e;let r=e.getFirstChildByKind(SyntaxKind.ExpressionStatement);return r&&Jr.test(r.getText())&&r.remove(),e};var Gr=new Set(["cn-font-heading"]),Hr=/\bcn-[a-z-]+\b/;function zt(e){return Hr.test(e)&&!Gr.has(e)}function Vt(e){return e.split(/\s+/).filter(t=>t.length>0&&!zt(t)).join(" ")}function Wt(e){return e.split(/\s+/).some(zt)}function Me(e){let t=e.getLiteralValue();if(!Wt(t))return;let r=Vt(t);r!==t&&e.setLiteralValue(r);}function rt(e){for(let t of e.getDescendantsOfKind(SyntaxKind.StringLiteral))Me(t);for(let t of e.getDescendantsOfKind(SyntaxKind.NoSubstitutionTemplateLiteral))Me(t);}function qr(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(Wt(i)){let o=Vt(i);o===""?t.push(r):o!==i&&n.setLiteralValue(o);}}n?.isKind(SyntaxKind.JsxExpression)&&rt(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)){Me(s);continue}if(s.isKind(SyntaxKind.NoSubstitutionTemplateLiteral)){Me(s);continue}rt(s);}for(let r of e.getDescendantsOfKind(SyntaxKind.CallExpression))r.getExpression().getText()==="mergeProps"&&rt(r);}var Be=async({sourceFile:e})=>(qr(e),e);var Je=async({sourceFile:e,config:t})=>{if(!t.tailwind?.prefix)return e;let r=await ze(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(`"${U(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(`"${U(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(`"${U(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(`"${U(o.getText()?.replace(/"|'/g,""),t.tailwind.prefix,r)}"`);}),i.isKind(SyntaxKind.StringLiteral)&&i.replaceWithText(`"${U(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(a=>{a.replaceWithText(`"${U(a.getText()?.replace(/"|'/g,""),t.tailwind.prefix,r)}"`);}),o.isKind(SyntaxKind.StringLiteral)&&o.replaceWithText(`"${U(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(`"${U(i.getText()?.replace(/"|'/g,""),t.tailwind.prefix,r)}"`);}});}),e};function U(e,t="",r){return r==="v3"?e.split(" ").map(s=>{let[n,i,o]=b(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 es=new Project({compilerOptions:{}});async function ts(e){let t=await promises.mkdtemp(y.join(tmpdir(),"shadcn-"));return y.join(t,e)}async function Mt(e,t=[Ve,Ue,a,Je,d,c,Be]){let r=await ts(e.filename),s=es.createSourceFile(r,e.raw,{scriptKind:ScriptKind.TSX});for(let n of t)await n({sourceFile:s,...e});return e.transformJsx?await _t({sourceFile:s,...e}):s.getText()}var rs=["a","span","div","Link","label","Label"],Bt=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(l=>l.getOpeningElement().getAttribute("asChild"));if(i.length===0)break;let o=i.filter(l=>!l.getDescendantsOfKind(SyntaxKind.JsxElement).some(f=>f.getOpeningElement().getAttribute("asChild"))),a=[];for(let l of o){let c=l.getOpeningElement(),f=c.getAttribute("asChild");if(!f)continue;let p=c.getTagNameNode().getText(),d=l.getJsxChildren().find(m=>m.getKind()===SyntaxKind.JsxElement||m.getKind()===SyntaxKind.JsxSelfClosingElement);if(!d){f.remove();continue}let h,w,g;if(d.getKind()===SyntaxKind.JsxSelfClosingElement){let m=d.asKindOrThrow(SyntaxKind.JsxSelfClosingElement);h=m.getTagNameNode().getText(),w=m.getAttributes().map(E=>E.getText()).join(" "),g="";}else {let m=d.asKindOrThrow(SyntaxKind.JsxElement),E=m.getOpeningElement();h=E.getTagNameNode().getText(),w=E.getAttributes().map(b=>b.getText()).join(" "),g=m.getJsxChildren().map(b=>b.getText()).join("");}let j=p==="Button"&&rs.includes(h);a.push({parentElement:l,parentTagName:p,childTagName:h,childProps:w,childChildren:g,needsNativeButton:j});}for(let l of a.reverse()){let f=l.parentElement.getOpeningElement().getAttributes().filter(w=>w.getKind()===SyntaxKind.JsxAttribute?w.asKindOrThrow(SyntaxKind.JsxAttribute).getNameNode().getText()!=="asChild":true).map(w=>w.getText()).join(" "),p=l.childProps?`{<${l.childTagName} ${l.childProps} />}`:`{<${l.childTagName} />}`,x=f?`${f} `:"";x+=`render=${p}`,l.needsNativeButton&&(x+=" nativeButton={false}");let d=l.childChildren.trim()?`${l.childChildren}`:"",h=`<${l.parentTagName} ${x}>${d}</${l.parentTagName}>`;l.parentElement.replaceWithText(h);}}return e};var Jt=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);async function Ro(e,t,r){if(!e?.length)return {filesCreated:[],filesUpdated:[],filesSkipped:[]};r={overwrite:false,force:false,silent:false,isRemote:false,isWorkspace:false,...r};let s=Y("Updating files.",{silent:r.silent})?.start(),[n,i]=await Promise.all([_(t.resolvedPaths.cwd),t.tailwind.baseColor?Ge(t.tailwind.baseColor):Promise.resolve(void 0)]),o=[],a$1=[],l=[],c$1=[],f=null;for(let h=0;h<e.length;h++){let w=e[h];if(!w.content)continue;let g$1=nt(w,t,{isSrcDir:n?.isSrcDir,framework:n?.framework.name,commonRoot:it(e.map(R=>R.path),w.path),path:r.path,fileIndex:h});if(!g$1)continue;let j=basename(w.path),m=y.dirname(g$1);if(t.tsx||(g$1=g$1.replace(/\.tsx?$/,R=>R===".tsx"?".jsx":".js")),q(g$1)&&!existsSync(g$1)){let R=Lt(m);R&&(g$1=R);}let E=existsSync(g$1);if(w.type==="registry:lib"&&basename(w.path)==="utils.ts"&&n?.framework.name==="laravel"&&E){l.push(y.relative(t.resolvedPaths.cwd,g$1));continue}if(E&&statSync(g$1).isDirectory())throw new Error(`Cannot write to ${g$1}: path exists and is a directory. Please provide a file path instead.`);let b=w.type==="registry:file"||w.type==="registry:item",S=q(g$1)||b?w.content:await Mt({filename:w.path,raw:w.content,config:t,baseColor:i,transformJsx:!t.tsx,isRemote:r.isRemote,supportedFontMarkers:r.supportedFontMarkers},[Ve,Ue,a,Je,c,g,Bt,d,...Gt(g$1,n,t)?[Jt]:[],f$1,Be]);if(E&&!q(g$1)){let R=await promises.readFile(g$1,"utf-8");if(Nt(R,S,{ignoreImports:r.isWorkspace})){l.push(y.relative(t.resolvedPaths.cwd,g$1));continue}}if(E&&!r.overwrite&&!q(g$1)){s.stop(),r.rootSpinner&&r.rootSpinner.stop();let{overwrite:R}=await is({type:"confirm",name:"overwrite",message:`The file ${T.info(j)} already exists. Would you like to overwrite?`,initial:false});if(!R){l.push(y.relative(t.resolvedPaths.cwd,g$1)),r.rootSpinner&&r.rootSpinner.start();continue}s?.start(),r.rootSpinner&&r.rootSpinner.start();}if(Gt(g$1,n,t)&&(g$1=g$1.replace(/middleware\.(ts|js)$/,"proxy.$1")),existsSync(m)||await promises.mkdir(m,{recursive:true}),q(g$1)&&E){let R=await promises.readFile(g$1,"utf-8"),X=Kt(R,S);if(c$1=Dt(R,S),f=y.relative(t.resolvedPaths.cwd,g$1),!c$1.length){l.push(y.relative(t.resolvedPaths.cwd,g$1));continue}await promises.writeFile(g$1,X,"utf-8"),a$1.push(y.relative(t.resolvedPaths.cwd,g$1));continue}await promises.writeFile(g$1,S,"utf-8"),E?a$1.push(y.relative(t.resolvedPaths.cwd,g$1)):(o.push(y.relative(t.resolvedPaths.cwd,g$1)),q(g$1)&&(c$1=Object.keys(ie(S)),f=y.relative(t.resolvedPaths.cwd,g$1)));}let p=[...o,...a$1,...l],x=await ms(p,t);if(a$1.push(...x),o=Array.from(new Set(o)),a$1=Array.from(new Set(a$1.filter(h=>!o.includes(h)))),l=Array.from(new Set(l)),!(o.length||a$1.length)&&!l.length&&s?.info("No files updated."),o.length){if(s?.succeed(`Created ${o.length} ${o.length===1?"file":"files"}:`),!r.silent)for(let h of o)v.log(` - ${h}`);}else s?.stop();if(a$1.length&&(Y(`Updated ${a$1.length} ${a$1.length===1?"file":"files"}:`,{silent:r.silent})?.info(),!r.silent))for(let h of a$1)v.log(` - ${h}`);if(l.length&&(Y(`Skipped ${l.length} ${l.length===1?"file":"files"}: (files might be identical, use --overwrite to overwrite)`,{silent:r.silent})?.info(),!r.silent))for(let h of l)v.log(` - ${h}`);if(c$1.length&&f&&(Y(`Added the following variables to ${T.info(f)}:`)?.info(),!r.silent))for(let h of c$1)v.log(` ${T.success("+")} ${h}`);return {filesCreated:o,filesUpdated:a$1,filesSkipped:l}}function nt(e,t,r){if(r.path){let i=y.isAbsolute(r.path)?r.path:y.join(t.resolvedPaths.cwd,r.path);if(/\.[^/\\]+$/.test(i)){if(r.fileIndex===0)return i}else {let a=y.basename(e.path);return y.join(i,a)}}if(e.target){if(e.target.startsWith("~/"))return y.join(t.resolvedPaths.cwd,e.target.replace("~/",""));let i=e.target;return e.type==="registry:page"&&(i=fs(i,r.framework),!i)?"":r.isSrcDir?y.join(t.resolvedPaths.cwd,"src",i.replace("src/","")):y.join(t.resolvedPaths.cwd,i.replace("src/",""))}let s=cs(e,t),n=ps(e.path,s);return y.join(s,n)}function cs(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 it(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 a=i.slice(0,o).join("/");if(r.some(c=>c!==s&&c.startsWith(a+"/")))return "/"+a}return "/"+n}function ps(e,t){let r=e.replace(/^\/|\/$/g,""),s=t.replace(/^\/|\/$/g,""),n=r.split("/"),i=s.split("/"),o=i[i.length-1],a=n.findIndex(l=>l===o);return a===-1?n[n.length-1]:n.slice(a+1).join("/")}function fs(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 ms(e,t){let r=new Project({compilerOptions:{}}),s=await _(t.resolvedPaths.cwd),n=loadConfig(t.resolvedPaths.cwd),i=[];if(!s||n.resultType==="failed")return [];for(let o of e){let a=y.resolve(t.resolvedPaths.cwd,o);if(!existsSync(a))continue;let l=await promises.readFile(a,"utf-8"),c=await promises.mkdtemp(y.join(tmpdir(),"shadcn-")),f=r.createSourceFile(y.join(c,basename(a)),l,{scriptKind:ScriptKind.TSX});if(![".tsx",".ts",".jsx",".js"].includes(f.getExtension()))continue;let p=f.getImportDeclarations();for(let x of p){let d=x.getModuleSpecifierValue();if(s?.aliasPrefix&&!d.startsWith(`${s.aliasPrefix}/`))continue;let h=await F(d,n);if(!h)continue;let w=gs(h,e,t);if(!w)continue;let g=ds(w,t,s);!g||g===d||(x.setModuleSpecifier(g),await promises.writeFile(a,f.getFullText(),"utf-8"),i.push(o));}}return i}function gs(e,t,r,s=[".tsx",".ts",".js",".jsx",".css"]){let n=y.normalize(r.resolvedPaths.cwd),i=t.map(g=>g.split(y.sep).join(y.posix.sep)),o=new Set(i),a=y.extname(e),l=a!=="",c=l?e.slice(0,-a.length):e,p=y.relative(n,c).split(y.sep).join(y.posix.sep),x=l?[a]:s,d=new Set;for(let g of x){let j=c+g,m=y.posix.normalize(y.relative(n,j));(o.has(m)||existsSync(j))&&d.add(m);let E=y.join(c,`index${g}`),b=y.posix.normalize(y.relative(n,E));(o.has(b)||existsSync(E))&&d.add(b);}let h=y.basename(c);for(let g of i)x.some(j=>g.endsWith(`/${h}${j}`))&&d.add(g);return d.size===0?null:Array.from(d).sort((g,j)=>{let m=y.posix.extname(g),E=y.posix.extname(j),b=x.indexOf(m)-x.indexOf(E);if(b!==0)return b;let S=p&&g.startsWith(p)?-1:1,R=p&&j.startsWith(p)?-1:1;return S-R})[0]}function ds(e,t,r){let s=y.normalize(y.join(t.resolvedPaths.cwd,e)),n=Object.entries(t.resolvedPaths).filter(([,h])=>h&&s.startsWith(y.normalize(h+y.sep))).sort((h,w)=>w[1].length-h[1].length);if(n.length===0)return null;let[i,o]=n[0],a=y.relative(o,s);a=a.split(y.sep).join("/");let l=y.posix.extname(a),f=[".ts",".tsx",".js",".jsx"].includes(l)?"":l,p=a.slice(0,a.length-l.length);p.endsWith("/index")&&(p=p.slice(0,-6));let x=i==="cwd"?r.aliasPrefix:t.aliases[i];if(!x)return null;let d=p===""?"":`/${p}`;return d=d.replace("/src",""),`${x}${d}${f}`}function Gt(e,t,r){let s=e===y.join(r.resolvedPaths.cwd,"middleware.ts")||e===y.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 L(e){try{return new URL(e),!0}catch{return false}}function ae(e){return e.endsWith(".json")&&!L(e)}function Do(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 qt(e,t){if(!hs(t))return z.array(g$1).parse(e.flat().filter(Boolean));let r=await _(t.resolvedPaths.cwd),s=new Map,n=z.array(g$1).parse(e.flat().filter(Boolean));return n.forEach(i=>{let o=nt(i,t,{isSrcDir:r?.isSrcDir,framework:r?.framework.name,commonRoot:it(n.map(a=>a.path),i.path)});o&&s.set(o,i);}),Array.from(s.values())}function hs(e){return !!(e?.resolvedPaths?.cwd&&(e?.resolvedPaths?.ui||e?.resolvedPaths?.lib||e?.resolvedPaths?.components||e?.resolvedPaths?.hooks))}function xs(e){return e.style?e.style==="new-york"&&e.tailwind?.config===""?Ae:e.style:Ae}function le(e){let t=At({style:Ae,registries:N});return e?d$1.parse(pe(t,{...e,style:xs(e),registries:{...N,...e.registries}})):t}var He={headers:{}};function Re(e){He.headers={...He.headers,...e};}function Yt(e){return He.headers[e]||{}}function Ce(){He.headers={};}function ws(e){let t=new Set;return typeof e=="string"?de(e).forEach(r=>t.add(r)):(de(e.url).forEach(r=>t.add(r)),e.params&&Object.values(e.params).forEach(r=>{de(r).forEach(s=>t.add(s));}),e.headers&&Object.values(e.headers).forEach(r=>{de(r).forEach(s=>t.add(s));})),Array.from(t)}function Zt(e,t){let s=ws(t).filter(n=>!process.env[n]);if(s.length>0)throw new xe(e,s)}function Qo(e,t){for(let r of e)ce(r,le(t));Ce();}var Qt="{name}",qe="{style}",Xt=/\${(\w+)}/g,er="?",Es="&";function vs(e){return e.startsWith("./")||e.startsWith("/")}function ce(e,t){let{registry:r,item:s}=re(e);if(!r){if(L(e)||ae(e)||vs(e))return null;r="@shadcn";}let i={...N,...t?.registries}[r];if(!i)throw new W(r);return Zt(r,i),{url:Rs(s,i,t),headers:Cs(i)}}function Rs(e,t,r){if(typeof t=="string"){let n=t.replace(Qt,e);return r?.style&&n.includes(qe)&&(n=n.replace(qe,r.style)),ge(n)}let s=t.url.replace(Qt,e);return r?.style&&s.includes(qe)&&(s=s.replace(qe,r.style)),s=ge(s),t.params?Ss(s,t.params):s}function Cs(e){if(typeof e=="string"||!e.headers)return {};let t={};for(let[r,s]of Object.entries(e.headers)){let n=ge(s);bs(s,n)&&(t[r]=n);}return t}function Ss(e,t){let r=new URLSearchParams;for(let[i,o]of Object.entries(t)){let a=ge(o);a&&r.append(i,a);}let s=r.toString();if(!s)return e;let n=e.includes(er)?Es:er;return `${e}${n}${s}`}function bs(e,t){let r=t.trim();if(!r)return false;if(e.includes("${")&&e.match(Xt)){let n=e.replace(Xt,"").trim();return r!==n}return true}function Ye(e){if(L(e)){let t=new URL(e);return t.pathname.match(/\/chat\/b\//)&&!t.pathname.endsWith("/json")&&(t.pathname=`${t.pathname}/json`),t.toString()}return `${J}/${e}`}var ks=process.env.https_proxy?new HttpsProxyAgent(process.env.https_proxy):void 0,ot=new Map;async function P(e,t={}){t={useCache:true,...t};try{return await Promise.all(e.map(async s=>{let n=Ye(s);if(t.useCache&&ot.has(n))return ot.get(n);let i=(async()=>{let o=Yt(n),a=await js(n,{agent:ks,headers:{...o}});if(!a.ok){let l;if(a.headers.get("content-type")?.includes("application/json")){let c=await a.json(),f=z.object({detail:z.string().optional(),title:z.string().optional(),message:z.string().optional(),error:z.string().optional()}).safeParse(c);f.success&&(l=f.data.detail||f.data.message,f.data.error&&(l=`[${f.data.error}] ${l}`));}throw a.status===401?new ue(n,l):a.status===404?new G(n,l):a.status===410?new Oe(n,l):a.status===403?new he(n,l):new ye(n,a.status,l)}return a.json()})();return t.useCache&&ot.set(n,i),i}))}catch(r){throw r}}async function rr(e){try{let t=e;e.startsWith("~/")&&(t=y.join(homedir(),e.slice(2)));let r=y.resolve(t),s=await promises.readFile(r,"utf8"),n$1=JSON.parse(s);try{return n.parse(n$1)}catch(i){throw new $(e,i)}}catch(t){throw t instanceof Error&&(t.message.includes("ENOENT")||t.message.includes("no such file"))?new te(e,t):t instanceof $?t:new te(e,t)}}async function ka(e,t,r){if(!e||(r={silent:false,tailwindVersion:"v3",...r},r.tailwindVersion==="v4"))return;let s=y.relative(t.resolvedPaths.cwd,t.resolvedPaths.tailwindConfig),n=Y(`Updating ${T.info(s)}`,{silent:r.silent}).start(),i=await promises.readFile(t.resolvedPaths.tailwindConfig,"utf8"),o=await Ls(i,e,t);await promises.writeFile(t.resolvedPaths.tailwindConfig,o,"utf8"),n?.succeed();}async function Ls(e,t,r){let s=await nr(e,r),n=s.getDescendantsOfKind(SyntaxKind.ObjectLiteralExpression).find(o=>o.getProperties().some(a=>a.isKind(SyntaxKind.PropertyAssignment)&&a.getName()==="content"));if(!n)return e;let i=zs(n);return Ds(n,{name:"darkMode",value:"class"},{quoteChar:i}),t.plugins?.forEach(o=>{_s(n,o);}),t.theme&&await Ks(n,t.theme),s.getFullText()}function Ds(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 Ks(e,t){e.getProperty("theme")||e.addPropertyAssignment({name:"theme",initializer:"{}"}),lt(e);let s=(e.getPropertyOrThrow("theme")?.asKindOrThrow(SyntaxKind.PropertyAssignment)).getInitializer();if(s?.isKind(SyntaxKind.ObjectLiteralExpression)){let n=s.getText(),i=await Vs(n),o=pe(i,t,{arrayMerge:(l,c)=>c}),a=Os(o).replace(/\'\.\.\.(.*)\'/g,"...$1").replace(/\'\"/g,"'").replace(/\"\'/g,"'").replace(/\'\[/g,"[").replace(/\]\'/g,"]").replace(/\'\\\'/g,"'").replace(/\\\'/g,"'").replace(/\\\'\'/g,"'").replace(/\'\'/g,"'");s.replaceWithText(a);}ct(e);}function _s(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 nr(e,t){let r=await promises.mkdtemp(y.join(tmpdir(),"shadcn-")),s=t?.resolvedPaths?.tailwindConfig||"tailwind.config.ts",n=y.join(r,`shadcn-${y.basename(s)}`);return new Project({compilerOptions:{}}).createSourceFile(n,e,{scriptKind:y.extname(s)===".ts"?ScriptKind.TS:ScriptKind.JS})}function zs(e){return e.getFirstDescendantByKind(SyntaxKind.StringLiteral)?.getQuoteKind()===QuoteKind.Single?"'":'"'}function lt(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)?lt(i.asKindOrThrow(SyntaxKind.ObjectLiteralExpression)):i&&i.isKind(SyntaxKind.ArrayLiteralExpression)&&ir(i.asKindOrThrow(SyntaxKind.ArrayLiteralExpression));}}}function ir(e){let t=e.getElements();for(let r=0;r<t.length;r++){let s=t[r];if(s.isKind(SyntaxKind.ObjectLiteralExpression))lt(s.asKindOrThrow(SyntaxKind.ObjectLiteralExpression));else if(s.isKind(SyntaxKind.ArrayLiteralExpression))ir(s.asKindOrThrow(SyntaxKind.ArrayLiteralExpression));else if(s.isKind(SyntaxKind.SpreadElement)){let n=s.getText();e.removeElement(r),e.insertElement(r,`"${n}"`);}}}function ct(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)?ct(i):i&&i.isKind(SyntaxKind.ArrayLiteralExpression)&&or(i.asKindOrThrow(SyntaxKind.ArrayLiteralExpression));}}}function or(e){let t=e.getElements();for(let r=0;r<t.length;r++){let s=t[r];if(s.isKind(SyntaxKind.ObjectLiteralExpression))ct(s.asKindOrThrow(SyntaxKind.ObjectLiteralExpression));else if(s.isKind(SyntaxKind.ArrayLiteralExpression))or(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 Vs(e){let r=(await nr(`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 Ze(n)}throw new Error("Invalid input: not an object literal")}function Ze(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]=Ze(r.getInitializer()):r.getInitializer()?.isKind(SyntaxKind.ArrayLiteralExpression)?t[s]=ar(r.getInitializer()):t[s]=pt(r.getInitializer());}return t}function ar(e){let t=[];for(let r of e.getElements())r.isKind(SyntaxKind.ObjectLiteralExpression)?t.push(Ze(r.asKindOrThrow(SyntaxKind.ObjectLiteralExpression))):r.isKind(SyntaxKind.ArrayLiteralExpression)?t.push(ar(r.asKindOrThrow(SyntaxKind.ArrayLiteralExpression))):t.push(pt(r));return t}function pt(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(pt);case SyntaxKind.ObjectLiteralExpression:return Ze(e);default:return e.getText()}}function lr(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 Ie(e,t){let r={},s=[...e];if(!t?.registries)return Re({}),s;for(let n=0;n<s.length;n++){let i=ce(s[n],t);i&&(s[n]=i.url,Object.keys(i.headers).length>0&&(r[i.url]=i.headers));}return Re(r),s}async function Z(e,t,r={}){return await Promise.all(e.map(async n$1=>{if(ae(n$1))return rr(n$1);if(L(n$1)){let[a]=await P([n$1],r);try{return n.parse(a)}catch(l){throw new $(n$1,l)}}if(n$1.startsWith("@")&&t?.registries){let a=Ie([n$1],t),[l]=await P(a,r);try{return n.parse(l)}catch(c){throw new $(n$1,c)}}let i=`styles/${t?.style??"new-york-v4"}/${n$1}.json`,[o]=await P([i],r);try{return n.parse(o)}catch(a){throw new $(n$1,a)}}))}m.extend({type:f,_source:z.string().optional(),font:l.optional(),config:z.any().optional()}).passthrough();async function pr(e,t$1,r={}){r={useCache:true,...r};let s=[],n$1=[],i=[],o=Array.from(new Set(e)),a=await Z(o,t$1,r),l=new Map;for(let m=0;m<a.length;m++)a[m]&&l.set(o[m],a[m]);for(let[m,E]of Array.from(l.entries())){let b={...E,_source:m};if(s.push(b),E.registryDependencies){let S=E.registryDependencies;if(t$1?.registries)S=Ie(E.registryDependencies,t$1);else {let ee=E.registryDependencies.filter(me=>me.startsWith("@"));if(ee.length>0){let{registry:me}=re(ee[0]);throw new W(me)}}let{items:R,registryNames:X}=await Te(S,t$1,r,new Set(o));n$1.push(...R),i.push(...X);}}if(s.push(...n$1),i.length>0){let m=Array.from(new Set(i)),E=m.filter(S=>!S.startsWith("@")),b=m.filter(S=>S.startsWith("@"));if(b.length>0){let S=await Z(b,t$1,r);for(let R=0;R<S.length;R++){let ee={...S[R],_source:b[R]};s.push(ee);}}if(E.length>0){let S=await De();if(!S&&s.length===0)return null;if(S){E.includes("index")&&E.unshift("index");let R=[];for(let gr of E){let dr=await Us(gr,t$1,r);R.push(...dr);}let X=Array.from(new Set(R)),ee=await P(X,r),me=z.array(n).parse(ee);s.push(...me);}}}if(!s.length)return null;if((o.includes("index")||i.includes("index"))&&t$1.tailwind.baseColor){let m=await Ms(t$1.tailwind.baseColor,t$1);m&&s.unshift(m);}let c=new Map;s.forEach(m=>{let E=m._source||m.name;c.set(m,E);}),s=Js(s,c),s.sort((m,E)=>m.type==="registry:theme"&&E.type!=="registry:theme"?-1:m.type!=="registry:theme"&&E.type==="registry:theme"?1:0);let f={};s.forEach(m=>{f=pe(f,m.tailwind??{});});let p={};s.forEach(m=>{p=pe(p,m.cssVars??{});});let x={};s.forEach(m=>{x=pe(x,m.css??{});});let d="";s.forEach(m=>{m.docs&&(d+=`${m.docs}
28
+ `);});let h={};s.forEach(m=>{h=pe(h,m.envVars??{});});let w=await qt(s.map(m=>m.files??[]),t$1),g=s.filter(m=>m.type==="registry:font"&&m.font).map(m=>({...m,type:"registry:font",font:m.font})),j=t.parse({dependencies:pe.all(s.map(m=>m.dependencies??[])),devDependencies:pe.all(s.map(m=>m.devDependencies??[])),files:w,tailwind:f,cssVars:p,css:x,docs:d,fonts:g.length>0?g:void 0});return Object.keys(h).length>0&&(j.envVars=h),j}async function Te(e,t,r={},s=new Set){let n=[],i=[];for(let o of e)if(!s.has(o)){if(s.add(o),L(o)||ae(o)){let[a]=await Z([o],t,r);if(a&&(n.push(a),a.registryDependencies)){let l=t?.registries?Ie(a.registryDependencies,t):a.registryDependencies,c=await Te(l,t,r,s);n.push(...c.items),i.push(...c.registryNames);}}else if(o.startsWith("@")&&t?.registries){let{registry:a}=re(o);if(a&&!(a in t.registries))throw new W(a);let[l]=await Z([o],t,r);if(l&&(n.push(l),l.registryDependencies)){let c=t?.registries?Ie(l.registryDependencies,t):l.registryDependencies,f=await Te(c,t,r,s);n.push(...f.items),i.push(...f.registryNames);}}else if(i.push(o),t)try{let[a]=await Z([o],t,r);if(a&&a.registryDependencies){let l=t?.registries?Ie(a.registryDependencies,t):a.registryDependencies,c=await Te(l,t,r,s);n.push(...c.items),i.push(...c.registryNames);}}catch{}}return {items:n,registryNames:i}}async function Us(e,t,r={}){if(L(e))return [e];let{registryNames:s}=await Te([e],t,r,new Set),n=t.resolvedPaths?.cwd?await $t(t.resolvedPaths.cwd,t.style):t.style,i=s.map(o=>Ye(L(o)?o:`styles/${n}/${o}.json`));return Array.from(new Set(i))}async function Ms(e,t){let[r,s]=await Promise.all([Ge(e),ze(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,...lr(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 B(e,t){let r=t||e.name,s=createHash("sha256").update(r).digest("hex").substring(0,8);return `${e.name}::${s}`}function Bs(e){if(L(e)){let s=new URL(e).pathname,n=s.match(/\/([^/]+)\.json$/),i=n?n[1]:y.basename(s,".json");return {name:i,hash:B({name:i},e)}}if(ae(e)){let r=e.match(/\/([^/]+)\.json$/),s=r?r[1]:y.basename(e,".json");return {name:s,hash:B({name:s},e)}}let{item:t}=re(e);return {name:t,hash:B({name:t},e)}}function Js(e,t){let r=new Map,s=new Map,n=new Map,i=new Map;e.forEach(c=>{let f=t.get(c)||c.name,p=B(c,f);r.set(p,c),s.set(p,c),n.set(p,0),i.set(p,[]);});let o=new Map;e.forEach(c=>{let f=t.get(c)||c.name,p=B(c,f);o.has(c.name)||o.set(c.name,[]),o.get(c.name).push(p),f!==c.name&&(o.has(f)||o.set(f,[]),o.get(f).push(p));}),e.forEach(c=>{let f=t.get(c)||c.name,p=B(c,f);c.registryDependencies&&c.registryDependencies.forEach(x=>{let d,h=o.get(x)||[];if(h.length===1)d=h[0];else if(h.length>1)d=h[0];else {let{name:w}=Bs(x),g=o.get(w)||[];g.length>0&&(d=g[0]);}d&&r.has(d)&&(i.get(d).push(p),n.set(p,n.get(p)+1));});});let a=[],l=[];for(n.forEach((c,f)=>{c===0&&a.push(f);});a.length>0;){let c=a.shift(),f=r.get(c);l.push(f),i.get(c).forEach(p=>{let x=n.get(p)-1;n.set(p,x),x===0&&a.push(p);});}if(l.length!==e.length){let c=new Set(l.map(f=>{let p=t.get(f)||f.name;return B(f,p)}));e.forEach(f=>{let p=t.get(f)||f.name,x=B(f,p);c.has(x)||l.push(f);});}return l}function fe(e){if(v.break(),v.error("Something went wrong. Please check the error below for more details."),v.error("If the problem persists, please open an issue on GitHub."),v.error(""),typeof e=="string"&&(v.error(e),v.break(),process.exit(1)),e instanceof I&&(e.message&&(v.error(e.cause?"Error:":"Message:"),v.error(e.message)),e.cause&&(v.error(`
29
+ Message:`),v.error(e.cause)),e.suggestion&&(v.error(`
30
+ Suggestion:`),v.error(e.suggestion)),v.break(),process.exit(1)),e instanceof z.ZodError){v.error("Validation failed:");for(let[t,r]of Object.entries(e.flatten().fieldErrors))v.error(`- ${T.info(t)}: ${r}`);v.break(),process.exit(1);}e instanceof Error&&(v.error(e.message),v.break(),process.exit(1)),v.break(),process.exit(1);}async function mt(e,t){let{config:r,useCache:s}=t||{};if(L(e)){let[a]=await P([e],{useCache:s});try{return o.parse(a)}catch(l){throw new $(e,l)}}if(!e.startsWith("@"))throw new we(e);let n=e;n.endsWith("/registry")||(n=`${n}/registry`);let i=ce(n,le(r));if(!i?.url)throw new G(n);i.headers&&Object.keys(i.headers).length>0&&Re({[i.url]:i.headers});let[o$1]=await P([i.url],{useCache:s});try{return o.parse(o$1)}catch(a){throw new $(n,a)}}async function qs(e,t){let{config:r,useCache:s=false}=t||{};return Ce(),Z(e,le(r),{useCache:s})}async function Ys(e,t){let{config:r,useCache:s=false}=t||{};return Ce(),pr(e,le(r),{useCache:s})}async function xl(e,t){let{useCache:r=true}=t||{};r||Fe.clearCaches();let s=await Fe.search(e);if(!s)return {registries:N};let n=z.object({registries:b$1.optional()}).safeParse(s.config);if(!n.success)throw new Ne(e,n.error);return {registries:{...N,...n.data.registries||{}}}}async function De(){try{let[e]=await P(["index.json"]);return p.parse(e)}catch(e){v.error(`
31
+ `),fe(e);}}async function wl(){try{let[e]=await P(["styles/index.json"]);return q$1.parse(e)}catch(e){return v.error(`
32
+ `),fe(e),[]}}async function El(){try{let[e]=await P(["icons/index.json"]);return r.parse(e)}catch(e){return fe(e),{}}}async function vl(){return kt}async function Ge(e){try{let[t]=await P([`colors/${e}.json`]);return s.parse(t)}catch(t){fe(t);}}async function Zs(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 Zs(e,n.registryDependencies);r.push(...i);}}return r.filter((s,n,i)=>i.findIndex(o=>o.name===s.name)===n)}async function Rl(e,t){try{let r=t.map(n=>`styles/${e}/${n.name}.json`);return (await P(r)).map(n$1=>n.parse(n$1))}catch(r){return fe(r),[]}}async function Cl(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?y.join(e.resolvedPaths[s],n):null}async function mr(e){e={useCache:true,...e};let t=`${J}/registries.json`,[r]=await P([t],{useCache:e.useCache});try{return x.parse(r)}catch(s){throw s instanceof z.ZodError?new Ee(s):s}}async function Qs(e){let t=await mr(e);return t?Object.fromEntries(t.map(r=>[r.name,r.url])):null}async function Xs(e){e={useCache:true,...e};let t=`${J}/config.json`,[r]=await P([t],{useCache:e.useCache});return z$1.parse(r).presets}async function Sl(e,t){return (await Xs(t)).find(s=>s.name.toLowerCase()===e.toLowerCase())??null}async function tn(e,t){let{query:r,limit:s,offset:n,config:i,useCache:o}=t||{},a=[];for(let x of e){let h=((await mt(x,{config:i,useCache:o})).items||[]).map(w=>({name:w.name,type:w.type,description:w.description,registry:x,addCommandArgument:on(w.name,x)}));a=a.concat(h);}r&&(a=sn(a,{query:r,limit:a.length,keys:["name","description"]}));let l=n||0,c=s||a.length,f=a.length,p={pagination:{total:f,offset:l,limit:c,hasMore:l+c<f},items:a.slice(l,l+c)};return v$1.parse(p)}var rn=z.object({name:z.string(),type:z.string().optional(),description:z.string().optional(),registry:z.string().optional(),addCommandArgument:z.string().optional()}).passthrough();function sn(e,t){t={limit:100,threshold:-1e4,...t};let s=en.go(t.query,e,{keys:t.keys,threshold:t.threshold,limit:t.limit}).map(n=>n.obj);return z.array(rn).parse(s)}function nn(e){try{return new URL(e),!0}catch{return false}}function on(e,t){if(!nn(t))return `${t}/${e}`;let r=t.indexOf("://")+3,s=t.indexOf("/",r);if(s===-1){let x=t.indexOf("?",r);if(x!==-1){let d=t.substring(0,x),w=t.substring(x).replace(/\bregistry\b/g,e);return d+w}return t}let n=t.substring(0,s),i=t.substring(s),o=i.indexOf("?")!==-1?i.indexOf("?"):i.length,a=i.substring(0,o),l=i.substring(o),c=a.lastIndexOf("registry"),f=a;c!==-1&&(f=a.substring(0,c)+e+a.substring(c+8));let p=l.replace(/\bregistry\b/g,e);return n+f+p}
33
+ export{fe as $,Je as A,Mt as B,Bt as C,Ro as D,nt as E,it as F,L as G,Do as H,jn as I,kn as J,$n as K,An as L,Fe as M,ve as N,Le as O,On as P,br as Q,Tr as R,Nn as S,At as T,le as U,Ce as V,Qo as W,ce as X,ka as Y,Z,pr as _,T as a,mt as aa,v as b,qs as ba,k as c,Ys as ca,N as d,xl as da,an as e,De as ea,I as f,wl as fa,G as g,El as ga,ue as h,vl as ha,he as i,Ge as ia,ye as j,Zs as ja,W as k,Rl as ka,te as l,Cl as la,$ as m,mr as ma,xe as n,Qs as na,we as o,Xs as oa,Ee as p,Sl as pa,re as q,tt as qa,Nt as r,_ as ra,q as s,Qn as sa,Lt as t,ze as ta,Dt as u,Xn as ua,Kt as v,tn as va,Y as w,Ve as x,Ue as y,Be as z};
@@ -1,4 +1,4 @@
1
- import {va,ba,f,da}from'./chunk-2QWB2ZQC.js';import {Server}from'@modelcontextprotocol/sdk/server/index.js';import {ListToolsRequestSchema,CallToolRequestSchema}from'@modelcontextprotocol/sdk/types.js';import P from'dedent';import {z}from'zod';import {zodToJsonSchema}from'zod-to-json-schema';import I,{join,normalize,delimiter,resolve,dirname}from'path';import R,{cwd}from'process';import Wr from'readline';import es from'events';import Qe from'fs/promises';import {createRequire}from'module';import {spawn}from'child_process';import {PassThrough}from'stream';import Kt from'fs';import ts from'os';import rs from'tty';var K=["npm","yarn","yarn@berry","pnpm","pnpm@6","bun","deno"],X={"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"},Z={"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"},Xe={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 Q(e,t){try{let o=await Qe.stat(e);return t==="file"?o.isFile():o.isDirectory()}catch{return false}}function*ar(e=R.cwd()){let t=I.resolve(e),{root:o}=I.parse(t);for(;t&&t!==o;)yield t,t=I.dirname(t);}async function Ze(e,t){return !e||!Q(e,"file")?null:await ur(e,t)}async function ee(e={}){let{cwd:t,strategies:o=["lockfile","packageManager-field","devEngines-field"],onUnknown:r}=e,u;if(typeof e.stopDir=="string"){let c=I.resolve(e.stopDir);u=l=>l===c;}else u=e.stopDir;for(let c of ar(t)){for(let l of o)switch(l){case "lockfile":{for(let a of Object.keys(X))if(await Q(I.join(c,a),"file")){let s=X[a],h=await Ze(I.join(c,"package.json"),r);return h||{name:s,agent:s}}break}case "packageManager-field":case "devEngines-field":{let a=await Ze(I.join(c,"package.json"),r);if(a)return a;break}case "install-metadata":{for(let a of Object.keys(Z)){let s=a.endsWith("/")?"dir":"file";if(await Q(I.join(c,a),s)){let h=Z[a],i=h==="yarn"?cr(a)?"yarn":"yarn@berry":h;return {name:h,agent:i}}}break}}if(u?.(c))break}return null}function lr(e){let t=o=>o?.match(/\d+(\.\d+){0,2}/)?.[0]??o;if(typeof e.packageManager=="string"){let[o,r]=e.packageManager.replace(/^\^/,"").split("@");return {name:o,ver:t(r)}}if(typeof e.devEngines?.packageManager?.name=="string")return {name:e.devEngines.packageManager.name,ver:t(e.devEngines.packageManager.version)}}async function ur(e,t){try{let o=JSON.parse(await Qe.readFile(e,"utf8")),r,u=lr(o);if(u){let c=u.name,l=u.ver,a=l;return c==="yarn"&&l&&Number.parseInt(l)>1?(r="yarn@berry",a="berry",{name:c,agent:r,version:a}):c==="pnpm"&&l&&Number.parseInt(l)<7?(r="pnpm@6",{name:c,agent:r,version:a}):K.includes(c)?(r=c,{name:c,agent:r,version:a}):t?.(o.packageManager)??null}}catch{}return null}function cr(e){return e.endsWith(".yarn_integrity")}var H=createRequire(import.meta.url),dr=Object.create,st=Object.defineProperty,fr=Object.getOwnPropertyDescriptor,pr=Object.getOwnPropertyNames,mr=Object.getPrototypeOf,gr=Object.prototype.hasOwnProperty,q=(e=>typeof H<"u"?H:typeof Proxy<"u"?new Proxy(e,{get:(t,o)=>(typeof H<"u"?H:t)[o]}):e)(function(e){if(typeof H<"u")return H.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),O=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),yr=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let u of pr(t))!gr.call(e,u)&&u!==o&&st(e,u,{get:()=>t[u],enumerable:!(r=fr(t,u))||r.enumerable});return e},vr=(e,t,o)=>(o=e!=null?dr(mr(e)):{},yr(st(o,"default",{value:e,enumerable:true}),e)),br=O((e,t)=>{t.exports=c,c.sync=l;var o=q("fs");function r(a,s){var h=s.pathExt!==void 0?s.pathExt:process.env.PATHEXT;if(!h||(h=h.split(";"),h.indexOf("")!==-1))return true;for(var i=0;i<h.length;i++){var n=h[i].toLowerCase();if(n&&a.substr(-n.length).toLowerCase()===n)return true}return false}function u(a,s,h){return !a.isSymbolicLink()&&!a.isFile()?false:r(s,h)}function c(a,s,h){o.stat(a,function(i,n){h(i,i?false:u(n,a,s));});}function l(a,s){return u(o.statSync(a),a,s)}}),wr=O((e,t)=>{t.exports=r,r.sync=u;var o=q("fs");function r(a,s,h){o.stat(a,function(i,n){h(i,i?false:c(n,s));});}function u(a,s){return c(o.statSync(a),s)}function c(a,s){return a.isFile()&&l(a,s)}function l(a,s){var h=a.mode,i=a.uid,n=a.gid,f=s.uid!==void 0?s.uid:process.getuid&&process.getuid(),d=s.gid!==void 0?s.gid:process.getgid&&process.getgid(),p=parseInt("100",8),g=parseInt("010",8),m=parseInt("001",8),b=p|g,x=h&m||h&g&&n===d||h&p&&i===f||h&b&&f===0;return x}}),xr=O((e,t)=>{q("fs");var r;process.platform==="win32"||global.TESTING_WINDOWS?r=br():r=wr(),t.exports=u,u.sync=c;function u(l,a,s){if(typeof a=="function"&&(s=a,a={}),!s){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(h,i){u(l,a||{},function(n,f){n?i(n):h(f);});})}r(l,a||{},function(h,i){h&&(h.code==="EACCES"||a&&a.ignoreErrors)&&(h=null,i=false),s(h,i);});}function c(l,a){try{return r.sync(l,a||{})}catch(s){if(a&&a.ignoreErrors||s.code==="EACCES")return false;throw s}}}),_r=O((e,t)=>{var o=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",r=q("path"),u=o?";":":",c=xr(),l=i=>Object.assign(new Error(`not found: ${i}`),{code:"ENOENT"}),a=(i,n)=>{let f=n.colon||u,d=i.match(/\//)||o&&i.match(/\\/)?[""]:[...o?[process.cwd()]:[],...(n.path||process.env.PATH||"").split(f)],p=o?n.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",g=o?p.split(f):[""];return o&&i.indexOf(".")!==-1&&g[0]!==""&&g.unshift(""),{pathEnv:d,pathExt:g,pathExtExe:p}},s=(i,n,f)=>{typeof n=="function"&&(f=n,n={}),n||(n={});let{pathEnv:d,pathExt:p,pathExtExe:g}=a(i,n),m=[],b=w=>new Promise((y,v)=>{if(w===d.length)return n.all&&m.length?y(m):v(l(i));let E=d[w],$=/^".*"$/.test(E)?E.slice(1,-1):E,S=r.join($,i),T=!$&&/^\.[\\\/]/.test(i)?i.slice(0,2)+S:S;y(x(T,w,0));}),x=(w,y,v)=>new Promise((E,$)=>{if(v===p.length)return E(b(y+1));let S=p[v];c(w+S,{pathExt:g},(T,z)=>{if(!T&&z)if(n.all)m.push(w+S);else return E(w+S);return E(x(w,y,v+1))});});return f?b(0).then(w=>f(null,w),f):b(0)},h=(i,n)=>{n=n||{};let{pathEnv:f,pathExt:d,pathExtExe:p}=a(i,n),g=[];for(let m=0;m<f.length;m++){let b=f[m],x=/^".*"$/.test(b)?b.slice(1,-1):b,w=r.join(x,i),y=!x&&/^\.[\\\/]/.test(i)?i.slice(0,2)+w:w;for(let v=0;v<d.length;v++){let E=y+d[v];try{if(c.sync(E,{pathExt:p}))if(n.all)g.push(E);else return E}catch{}}}if(n.all&&g.length)return g;if(n.nothrow)return null;throw l(i)};t.exports=s,s.sync=h;}),Er=O((e,t)=>{var o=(r={})=>{let u=r.env||process.env;return (r.platform||process.platform)!=="win32"?"PATH":Object.keys(u).reverse().find(c=>c.toUpperCase()==="PATH")||"Path"};t.exports=o,t.exports.default=o;}),Sr=O((e,t)=>{var o=q("path"),r=_r(),u=Er();function c(a,s){let h=a.options.env||process.env,i=process.cwd(),n=a.options.cwd!=null,f=n&&process.chdir!==void 0&&!process.chdir.disabled;if(f)try{process.chdir(a.options.cwd);}catch{}let d;try{d=r.sync(a.command,{path:h[u({env:h})],pathExt:s?o.delimiter:void 0});}catch{}finally{f&&process.chdir(i);}return d&&(d=o.resolve(n?a.options.cwd:"",d)),d}function l(a){return c(a)||c(a,true)}t.exports=l;}),$r=O((e,t)=>{var o=/([()\][%!^"`<>&|;, *?])/g;function r(c){return c=c.replace(o,"^$1"),c}function u(c,l){return c=`${c}`,c=c.replace(/(\\*)"/g,'$1$1\\"'),c=c.replace(/(\\*)$/,"$1$1"),c=`"${c}"`,c=c.replace(o,"^$1"),l&&(c=c.replace(o,"^$1")),c}t.exports.command=r,t.exports.argument=u;}),Or=O((e,t)=>{t.exports=/^#!(.*)/;}),Tr=O((e,t)=>{var o=Or();t.exports=(r="")=>{let u=r.match(o);if(!u)return null;let[c,l]=u[0].replace(/#! ?/,"").split(" "),a=c.split("/").pop();return a==="env"?l:l?`${a} ${l}`:a};}),Cr=O((e,t)=>{var o=q("fs"),r=Tr();function u(c){let l=Buffer.alloc(150),a;try{a=o.openSync(c,"r"),o.readSync(a,l,0,150,0),o.closeSync(a);}catch{}return r(l.toString())}t.exports=u;}),Ar=O((e,t)=>{var o=q("path"),r=Sr(),u=$r(),c=Cr(),l=process.platform==="win32",a=/\.(?:com|exe)$/i,s=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function h(f){f.file=r(f);let d=f.file&&c(f.file);return d?(f.args.unshift(f.file),f.command=d,r(f)):f.file}function i(f){if(!l)return f;let d=h(f),p=!a.test(d);if(f.options.forceShell||p){let g=s.test(d);f.command=o.normalize(f.command),f.command=u.command(f.command),f.args=f.args.map(b=>u.argument(b,g));let m=[f.command].concat(f.args).join(" ");f.args=["/d","/s","/c",`"${m}"`],f.command=process.env.comspec||"cmd.exe",f.options.windowsVerbatimArguments=true;}return f}function n(f,d,p){d&&!Array.isArray(d)&&(p=d,d=null),d=d?d.slice(0):[],p=Object.assign({},p);let g={command:f,args:d,options:p,file:void 0,original:{command:f,args:d}};return p.shell?g:i(g)}t.exports=n;}),Mr=O((e,t)=>{var o=process.platform==="win32";function r(a,s){return Object.assign(new Error(`${s} ${a.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${s} ${a.command}`,path:a.command,spawnargs:a.args})}function u(a,s){if(!o)return;let h=a.emit;a.emit=function(i,n){if(i==="exit"){let f=c(n,s);if(f)return h.call(a,"error",f)}return h.apply(a,arguments)};}function c(a,s){return o&&a===1&&!s.file?r(s.original,"spawn"):null}function l(a,s){return o&&a===1&&!s.file?r(s.original,"spawnSync"):null}t.exports={hookChildProcess:u,verifyENOENT:c,verifyENOENTSync:l,notFoundError:r};}),Pr=O((e,t)=>{var o=q("child_process"),r=Ar(),u=Mr();function c(a,s,h){let i=r(a,s,h),n=o.spawn(i.command,i.args,i.options);return u.hookChildProcess(n,i),n}function l(a,s,h){let i=r(a,s,h),n=o.spawnSync(i.command,i.args,i.options);return n.error=n.error||u.verifyENOENTSync(n.status,i),n}t.exports=c,t.exports.spawn=c,t.exports.sync=l,t.exports._parse=r,t.exports._enoent=u;}),Nr=/^path$/i,tt={key:"PATH",value:""};function Dr(e){for(let t in e){if(!Object.prototype.hasOwnProperty.call(e,t)||!Nr.test(t))continue;let o=e[t];return o?{key:t,value:o}:tt}return tt}function Lr(e,t){let o=t.value.split(delimiter),r=e,u;do o.push(resolve(r,"node_modules",".bin")),u=r,r=dirname(r);while(r!==u);return {key:t.key,value:o.join(delimiter)}}function Fr(e,t){let o={...process.env,...t},r=Lr(e,Dr(o));return o[r.key]=r.value,o}var Gr=e=>{let t=e.length,o=new PassThrough,r=()=>{--t===0&&o.emit("end");};for(let u of e)u.pipe(o,{end:false}),u.on("end",r);return o},Vr=vr(Pr()),rt=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;}},Yr={timeout:void 0,persist:false},Ur={windowsHide:true};function Br(e,t){return {command:normalize(e),args:t??[]}}function zr(e){let t=new AbortController;for(let o of e){if(o.aborted)return t.abort(),o;let r=()=>{t.abort(o.reason);};o.addEventListener("abort",r,{signal:t.signal});}return t.signal}var Jr=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,o){this._options={...Yr,...o},this._command=e,this._args=t??[],this._processClosed=new Promise(r=>{this._resolveClose=r;});}kill(e){return this._process?.kill(e)===true}get aborted(){return this._aborted}get killed(){return this._process?.killed===true}pipe(e,t,o){return Kr(e,t,{...o,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 o=Gr(t),r=Wr.createInterface({input:o});for await(let u of r)yield u.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 rt(this)}async _waitForOutput(){let e=this._process;if(!e)throw new Error("No process was started");let t="",o="";if(this._streamOut)for await(let u of this._streamOut)o+=u.toString();if(this._streamErr)for await(let u of this._streamErr)t+=u.toString();if(await this._processClosed,this._options?.stdin&&await this._options.stdin,e.removeAllListeners(),this._thrownError)throw this._thrownError;let r={stderr:t,stdout:o,exitCode:this.exitCode};if(this._options.throwOnError&&this.exitCode!==0&&this.exitCode!==void 0)throw new rt(this,r);return r}then(e,t){return this._waitForOutput().then(e,t)}_streamOut;_streamErr;spawn(){let e=cwd(),t=this._options,o={...Ur,...t.nodeOptions},r=[];this._resetState(),t.timeout!==void 0&&r.push(AbortSignal.timeout(t.timeout)),t.signal!==void 0&&r.push(t.signal),t.persist===true&&(o.detached=true),r.length>0&&(o.signal=zr(r)),o.env=Fr(e,o.env);let{command:u,args:c}=Br(this._command,this._args),l=(0, Vr._parse)(u,c,o),a=spawn(l.command,l.args,l.options);if(a.stderr&&(this._streamErr=a.stderr),a.stdout&&(this._streamOut=a.stdout),this._process=a,a.once("error",this._onError),a.once("close",this._onClose),t.stdin!==void 0&&a.stdin&&t.stdin.process){let{stdout:s}=t.stdin.process;s&&s.pipe(a.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();}},te=(e,t,o)=>{let r=new Jr(e,t,o);return r.spawn(),r},Kr=te;function Ve(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var se={},ie,nt;function A(){if(nt)return ie;nt=1;let e,t,o,r,u=true;typeof process<"u"&&({FORCE_COLOR:e,NODE_DISABLE_COLORS:t,NO_COLOR:o,TERM:r}=process.env||{},u=process.stdout&&process.stdout.isTTY);let c={enabled:!t&&o==null&&r!=="dumb"&&(e!=null&&e!=="0"||u),reset:s(0,0),bold:s(1,22),dim:s(2,22),italic:s(3,23),underline:s(4,24),inverse:s(7,27),hidden:s(8,28),strikethrough:s(9,29),black:s(30,39),red:s(31,39),green:s(32,39),yellow:s(33,39),blue:s(34,39),magenta:s(35,39),cyan:s(36,39),white:s(37,39),gray:s(90,39),grey:s(90,39),bgBlack:s(40,49),bgRed:s(41,49),bgGreen:s(42,49),bgYellow:s(43,49),bgBlue:s(44,49),bgMagenta:s(45,49),bgCyan:s(46,49),bgWhite:s(47,49)};function l(h,i){let n=0,f,d="",p="";for(;n<h.length;n++)f=h[n],d+=f.open,p+=f.close,~i.indexOf(f.close)&&(i=i.replace(f.rgx,f.close+f.open));return d+i+p}function a(h,i){let n={has:h,keys:i};return n.reset=c.reset.bind(n),n.bold=c.bold.bind(n),n.dim=c.dim.bind(n),n.italic=c.italic.bind(n),n.underline=c.underline.bind(n),n.inverse=c.inverse.bind(n),n.hidden=c.hidden.bind(n),n.strikethrough=c.strikethrough.bind(n),n.black=c.black.bind(n),n.red=c.red.bind(n),n.green=c.green.bind(n),n.yellow=c.yellow.bind(n),n.blue=c.blue.bind(n),n.magenta=c.magenta.bind(n),n.cyan=c.cyan.bind(n),n.white=c.white.bind(n),n.gray=c.gray.bind(n),n.grey=c.grey.bind(n),n.bgBlack=c.bgBlack.bind(n),n.bgRed=c.bgRed.bind(n),n.bgGreen=c.bgGreen.bind(n),n.bgYellow=c.bgYellow.bind(n),n.bgBlue=c.bgBlue.bind(n),n.bgMagenta=c.bgMagenta.bind(n),n.bgCyan=c.bgCyan.bind(n),n.bgWhite=c.bgWhite.bind(n),n}function s(h,i){let n={open:`\x1B[${h}m`,close:`\x1B[${i}m`,rgx:new RegExp(`\\x1b\\[${i}m`,"g")};return function(f){return this!==void 0&&this.has!==void 0?(~this.has.indexOf(h)||(this.has.push(h),this.keys.push(n)),f===void 0?this:c.enabled?l(this.keys,f+""):f+""):f===void 0?a([h],[n]):c.enabled?l([n],f+""):f+""}}return ie=c,ie}var ne,ot;function os(){return ot||(ot=1,ne=(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}}),ne}var oe,at;function We(){return at||(at=1,oe=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("|"),o=new RegExp(t,"g");return typeof e=="string"?e.replace(o,""):e}),oe}var ae,lt;function M(){if(lt)return ae;lt=1;let e="\x1B",t=`${e}[`,o="\x07",r={to(l,a){return a?`${t}${a+1};${l+1}H`:`${t}${l+1}G`},move(l,a){let s="";return l<0?s+=`${t}${-l}D`:l>0&&(s+=`${t}${l}C`),a<0?s+=`${t}${-a}A`:a>0&&(s+=`${t}${a}B`),s},up:(l=1)=>`${t}${l}A`,down:(l=1)=>`${t}${l}B`,forward:(l=1)=>`${t}${l}C`,backward:(l=1)=>`${t}${l}D`,nextLine:(l=1)=>`${t}E`.repeat(l),prevLine:(l=1)=>`${t}F`.repeat(l),left:`${t}G`,hide:`${t}?25l`,show:`${t}?25h`,save:`${e}7`,restore:`${e}8`},u={up:(l=1)=>`${t}S`.repeat(l),down:(l=1)=>`${t}T`.repeat(l)},c={screen:`${t}2J`,up:(l=1)=>`${t}1J`.repeat(l),down:(l=1)=>`${t}J`.repeat(l),line:`${t}2K`,lineEnd:`${t}K`,lineStart:`${t}1K`,lines(l){let a="";for(let s=0;s<l;s++)a+=this.line+(s<l-1?r.up():"");return l&&(a+=r.left),a}};return ae={cursor:r,scroll:u,erase:c,beep:o},ae}var le,ut;function as(){if(ut)return le;ut=1;let e=We(),{erase:t,cursor:o}=M(),r=u=>[...e(u)].length;return le=function(u,c){if(!c)return t.line+o.to(0);let l=0,a=u.split(/\r?\n/);for(let s of a)l+=1+Math.floor(Math.max(r(s)-1,0)/c);return t.lines(l)},le}var ue,ct;function Zt(){if(ct)return ue;ct=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 ue=process.platform==="win32"?t:e,ue}var ce,ht;function ls(){if(ht)return ce;ht=1;let e=A(),t=Zt(),o=Object.freeze({password:{scale:1,render:s=>"*".repeat(s.length)},emoji:{scale:2,render:s=>"\u{1F603}".repeat(s.length)},invisible:{scale:0,render:s=>""},default:{scale:1,render:s=>`${s}`}}),r=s=>o[s]||o.default,u=Object.freeze({aborted:e.red(t.cross),done:e.green(t.tick),exited:e.yellow(t.cross),default:e.cyan("?")});return ce={styles:o,render:r,symbols:u,symbol:(s,h,i)=>h?u.aborted:i?u.exited:s?u.done:u.default,delimiter:s=>e.gray(s?t.ellipsis:t.pointerSmall),item:(s,h)=>e.gray(s?h?t.pointerSmall:"+":t.line)},ce}var he,dt;function us(){if(dt)return he;dt=1;let e=We();return he=function(t,o){let r=String(e(t)||"").split(/\r?\n/);return o?r.map(u=>Math.ceil(u.length/o)).reduce((u,c)=>u+c):r.length},he}var de,ft;function cs(){return ft||(ft=1,de=(e,t={})=>{let o=Number.isSafeInteger(parseInt(t.margin))?new Array(parseInt(t.margin)).fill(" ").join(""):t.margin||"",r=t.width;return (e||"").split(/\r?\n/g).map(u=>u.split(/\s+/g).reduce((c,l)=>(l.length+o.length>=r||c[c.length-1].length+l.length+1<r?c[c.length-1]+=` ${l}`:c.push(`${o}${l}`),c),[o]).join(`
1
+ import {va,ba,f,da}from'./chunk-BT5UJFAL.js';import {Server}from'@modelcontextprotocol/sdk/server/index.js';import {ListToolsRequestSchema,CallToolRequestSchema}from'@modelcontextprotocol/sdk/types.js';import P from'dedent';import {z}from'zod';import {zodToJsonSchema}from'zod-to-json-schema';import I,{join,normalize,delimiter,resolve,dirname}from'path';import R,{cwd}from'process';import Wr from'readline';import es from'events';import Qe from'fs/promises';import {createRequire}from'module';import {spawn}from'child_process';import {PassThrough}from'stream';import Kt from'fs';import ts from'os';import rs from'tty';var K=["npm","yarn","yarn@berry","pnpm","pnpm@6","bun","deno"],X={"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"},Z={"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"},Xe={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 Q(e,t){try{let o=await Qe.stat(e);return t==="file"?o.isFile():o.isDirectory()}catch{return false}}function*ar(e=R.cwd()){let t=I.resolve(e),{root:o}=I.parse(t);for(;t&&t!==o;)yield t,t=I.dirname(t);}async function Ze(e,t){return !e||!Q(e,"file")?null:await ur(e,t)}async function ee(e={}){let{cwd:t,strategies:o=["lockfile","packageManager-field","devEngines-field"],onUnknown:r}=e,u;if(typeof e.stopDir=="string"){let c=I.resolve(e.stopDir);u=l=>l===c;}else u=e.stopDir;for(let c of ar(t)){for(let l of o)switch(l){case "lockfile":{for(let a of Object.keys(X))if(await Q(I.join(c,a),"file")){let s=X[a],h=await Ze(I.join(c,"package.json"),r);return h||{name:s,agent:s}}break}case "packageManager-field":case "devEngines-field":{let a=await Ze(I.join(c,"package.json"),r);if(a)return a;break}case "install-metadata":{for(let a of Object.keys(Z)){let s=a.endsWith("/")?"dir":"file";if(await Q(I.join(c,a),s)){let h=Z[a],i=h==="yarn"?cr(a)?"yarn":"yarn@berry":h;return {name:h,agent:i}}}break}}if(u?.(c))break}return null}function lr(e){let t=o=>o?.match(/\d+(\.\d+){0,2}/)?.[0]??o;if(typeof e.packageManager=="string"){let[o,r]=e.packageManager.replace(/^\^/,"").split("@");return {name:o,ver:t(r)}}if(typeof e.devEngines?.packageManager?.name=="string")return {name:e.devEngines.packageManager.name,ver:t(e.devEngines.packageManager.version)}}async function ur(e,t){try{let o=JSON.parse(await Qe.readFile(e,"utf8")),r,u=lr(o);if(u){let c=u.name,l=u.ver,a=l;return c==="yarn"&&l&&Number.parseInt(l)>1?(r="yarn@berry",a="berry",{name:c,agent:r,version:a}):c==="pnpm"&&l&&Number.parseInt(l)<7?(r="pnpm@6",{name:c,agent:r,version:a}):K.includes(c)?(r=c,{name:c,agent:r,version:a}):t?.(o.packageManager)??null}}catch{}return null}function cr(e){return e.endsWith(".yarn_integrity")}var H=createRequire(import.meta.url),dr=Object.create,st=Object.defineProperty,fr=Object.getOwnPropertyDescriptor,pr=Object.getOwnPropertyNames,mr=Object.getPrototypeOf,gr=Object.prototype.hasOwnProperty,q=(e=>typeof H<"u"?H:typeof Proxy<"u"?new Proxy(e,{get:(t,o)=>(typeof H<"u"?H:t)[o]}):e)(function(e){if(typeof H<"u")return H.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),O=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),yr=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let u of pr(t))!gr.call(e,u)&&u!==o&&st(e,u,{get:()=>t[u],enumerable:!(r=fr(t,u))||r.enumerable});return e},vr=(e,t,o)=>(o=e!=null?dr(mr(e)):{},yr(st(o,"default",{value:e,enumerable:true}),e)),br=O((e,t)=>{t.exports=c,c.sync=l;var o=q("fs");function r(a,s){var h=s.pathExt!==void 0?s.pathExt:process.env.PATHEXT;if(!h||(h=h.split(";"),h.indexOf("")!==-1))return true;for(var i=0;i<h.length;i++){var n=h[i].toLowerCase();if(n&&a.substr(-n.length).toLowerCase()===n)return true}return false}function u(a,s,h){return !a.isSymbolicLink()&&!a.isFile()?false:r(s,h)}function c(a,s,h){o.stat(a,function(i,n){h(i,i?false:u(n,a,s));});}function l(a,s){return u(o.statSync(a),a,s)}}),wr=O((e,t)=>{t.exports=r,r.sync=u;var o=q("fs");function r(a,s,h){o.stat(a,function(i,n){h(i,i?false:c(n,s));});}function u(a,s){return c(o.statSync(a),s)}function c(a,s){return a.isFile()&&l(a,s)}function l(a,s){var h=a.mode,i=a.uid,n=a.gid,f=s.uid!==void 0?s.uid:process.getuid&&process.getuid(),d=s.gid!==void 0?s.gid:process.getgid&&process.getgid(),p=parseInt("100",8),g=parseInt("010",8),m=parseInt("001",8),b=p|g,x=h&m||h&g&&n===d||h&p&&i===f||h&b&&f===0;return x}}),xr=O((e,t)=>{q("fs");var r;process.platform==="win32"||global.TESTING_WINDOWS?r=br():r=wr(),t.exports=u,u.sync=c;function u(l,a,s){if(typeof a=="function"&&(s=a,a={}),!s){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(h,i){u(l,a||{},function(n,f){n?i(n):h(f);});})}r(l,a||{},function(h,i){h&&(h.code==="EACCES"||a&&a.ignoreErrors)&&(h=null,i=false),s(h,i);});}function c(l,a){try{return r.sync(l,a||{})}catch(s){if(a&&a.ignoreErrors||s.code==="EACCES")return false;throw s}}}),_r=O((e,t)=>{var o=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",r=q("path"),u=o?";":":",c=xr(),l=i=>Object.assign(new Error(`not found: ${i}`),{code:"ENOENT"}),a=(i,n)=>{let f=n.colon||u,d=i.match(/\//)||o&&i.match(/\\/)?[""]:[...o?[process.cwd()]:[],...(n.path||process.env.PATH||"").split(f)],p=o?n.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",g=o?p.split(f):[""];return o&&i.indexOf(".")!==-1&&g[0]!==""&&g.unshift(""),{pathEnv:d,pathExt:g,pathExtExe:p}},s=(i,n,f)=>{typeof n=="function"&&(f=n,n={}),n||(n={});let{pathEnv:d,pathExt:p,pathExtExe:g}=a(i,n),m=[],b=w=>new Promise((y,v)=>{if(w===d.length)return n.all&&m.length?y(m):v(l(i));let E=d[w],$=/^".*"$/.test(E)?E.slice(1,-1):E,S=r.join($,i),T=!$&&/^\.[\\\/]/.test(i)?i.slice(0,2)+S:S;y(x(T,w,0));}),x=(w,y,v)=>new Promise((E,$)=>{if(v===p.length)return E(b(y+1));let S=p[v];c(w+S,{pathExt:g},(T,z)=>{if(!T&&z)if(n.all)m.push(w+S);else return E(w+S);return E(x(w,y,v+1))});});return f?b(0).then(w=>f(null,w),f):b(0)},h=(i,n)=>{n=n||{};let{pathEnv:f,pathExt:d,pathExtExe:p}=a(i,n),g=[];for(let m=0;m<f.length;m++){let b=f[m],x=/^".*"$/.test(b)?b.slice(1,-1):b,w=r.join(x,i),y=!x&&/^\.[\\\/]/.test(i)?i.slice(0,2)+w:w;for(let v=0;v<d.length;v++){let E=y+d[v];try{if(c.sync(E,{pathExt:p}))if(n.all)g.push(E);else return E}catch{}}}if(n.all&&g.length)return g;if(n.nothrow)return null;throw l(i)};t.exports=s,s.sync=h;}),Er=O((e,t)=>{var o=(r={})=>{let u=r.env||process.env;return (r.platform||process.platform)!=="win32"?"PATH":Object.keys(u).reverse().find(c=>c.toUpperCase()==="PATH")||"Path"};t.exports=o,t.exports.default=o;}),Sr=O((e,t)=>{var o=q("path"),r=_r(),u=Er();function c(a,s){let h=a.options.env||process.env,i=process.cwd(),n=a.options.cwd!=null,f=n&&process.chdir!==void 0&&!process.chdir.disabled;if(f)try{process.chdir(a.options.cwd);}catch{}let d;try{d=r.sync(a.command,{path:h[u({env:h})],pathExt:s?o.delimiter:void 0});}catch{}finally{f&&process.chdir(i);}return d&&(d=o.resolve(n?a.options.cwd:"",d)),d}function l(a){return c(a)||c(a,true)}t.exports=l;}),$r=O((e,t)=>{var o=/([()\][%!^"`<>&|;, *?])/g;function r(c){return c=c.replace(o,"^$1"),c}function u(c,l){return c=`${c}`,c=c.replace(/(\\*)"/g,'$1$1\\"'),c=c.replace(/(\\*)$/,"$1$1"),c=`"${c}"`,c=c.replace(o,"^$1"),l&&(c=c.replace(o,"^$1")),c}t.exports.command=r,t.exports.argument=u;}),Or=O((e,t)=>{t.exports=/^#!(.*)/;}),Tr=O((e,t)=>{var o=Or();t.exports=(r="")=>{let u=r.match(o);if(!u)return null;let[c,l]=u[0].replace(/#! ?/,"").split(" "),a=c.split("/").pop();return a==="env"?l:l?`${a} ${l}`:a};}),Cr=O((e,t)=>{var o=q("fs"),r=Tr();function u(c){let l=Buffer.alloc(150),a;try{a=o.openSync(c,"r"),o.readSync(a,l,0,150,0),o.closeSync(a);}catch{}return r(l.toString())}t.exports=u;}),Ar=O((e,t)=>{var o=q("path"),r=Sr(),u=$r(),c=Cr(),l=process.platform==="win32",a=/\.(?:com|exe)$/i,s=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function h(f){f.file=r(f);let d=f.file&&c(f.file);return d?(f.args.unshift(f.file),f.command=d,r(f)):f.file}function i(f){if(!l)return f;let d=h(f),p=!a.test(d);if(f.options.forceShell||p){let g=s.test(d);f.command=o.normalize(f.command),f.command=u.command(f.command),f.args=f.args.map(b=>u.argument(b,g));let m=[f.command].concat(f.args).join(" ");f.args=["/d","/s","/c",`"${m}"`],f.command=process.env.comspec||"cmd.exe",f.options.windowsVerbatimArguments=true;}return f}function n(f,d,p){d&&!Array.isArray(d)&&(p=d,d=null),d=d?d.slice(0):[],p=Object.assign({},p);let g={command:f,args:d,options:p,file:void 0,original:{command:f,args:d}};return p.shell?g:i(g)}t.exports=n;}),Mr=O((e,t)=>{var o=process.platform==="win32";function r(a,s){return Object.assign(new Error(`${s} ${a.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${s} ${a.command}`,path:a.command,spawnargs:a.args})}function u(a,s){if(!o)return;let h=a.emit;a.emit=function(i,n){if(i==="exit"){let f=c(n,s);if(f)return h.call(a,"error",f)}return h.apply(a,arguments)};}function c(a,s){return o&&a===1&&!s.file?r(s.original,"spawn"):null}function l(a,s){return o&&a===1&&!s.file?r(s.original,"spawnSync"):null}t.exports={hookChildProcess:u,verifyENOENT:c,verifyENOENTSync:l,notFoundError:r};}),Pr=O((e,t)=>{var o=q("child_process"),r=Ar(),u=Mr();function c(a,s,h){let i=r(a,s,h),n=o.spawn(i.command,i.args,i.options);return u.hookChildProcess(n,i),n}function l(a,s,h){let i=r(a,s,h),n=o.spawnSync(i.command,i.args,i.options);return n.error=n.error||u.verifyENOENTSync(n.status,i),n}t.exports=c,t.exports.spawn=c,t.exports.sync=l,t.exports._parse=r,t.exports._enoent=u;}),Nr=/^path$/i,tt={key:"PATH",value:""};function Dr(e){for(let t in e){if(!Object.prototype.hasOwnProperty.call(e,t)||!Nr.test(t))continue;let o=e[t];return o?{key:t,value:o}:tt}return tt}function Lr(e,t){let o=t.value.split(delimiter),r=e,u;do o.push(resolve(r,"node_modules",".bin")),u=r,r=dirname(r);while(r!==u);return {key:t.key,value:o.join(delimiter)}}function Fr(e,t){let o={...process.env,...t},r=Lr(e,Dr(o));return o[r.key]=r.value,o}var Gr=e=>{let t=e.length,o=new PassThrough,r=()=>{--t===0&&o.emit("end");};for(let u of e)u.pipe(o,{end:false}),u.on("end",r);return o},Vr=vr(Pr()),rt=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;}},Yr={timeout:void 0,persist:false},Ur={windowsHide:true};function Br(e,t){return {command:normalize(e),args:t??[]}}function zr(e){let t=new AbortController;for(let o of e){if(o.aborted)return t.abort(),o;let r=()=>{t.abort(o.reason);};o.addEventListener("abort",r,{signal:t.signal});}return t.signal}var Jr=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,o){this._options={...Yr,...o},this._command=e,this._args=t??[],this._processClosed=new Promise(r=>{this._resolveClose=r;});}kill(e){return this._process?.kill(e)===true}get aborted(){return this._aborted}get killed(){return this._process?.killed===true}pipe(e,t,o){return Kr(e,t,{...o,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 o=Gr(t),r=Wr.createInterface({input:o});for await(let u of r)yield u.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 rt(this)}async _waitForOutput(){let e=this._process;if(!e)throw new Error("No process was started");let t="",o="";if(this._streamOut)for await(let u of this._streamOut)o+=u.toString();if(this._streamErr)for await(let u of this._streamErr)t+=u.toString();if(await this._processClosed,this._options?.stdin&&await this._options.stdin,e.removeAllListeners(),this._thrownError)throw this._thrownError;let r={stderr:t,stdout:o,exitCode:this.exitCode};if(this._options.throwOnError&&this.exitCode!==0&&this.exitCode!==void 0)throw new rt(this,r);return r}then(e,t){return this._waitForOutput().then(e,t)}_streamOut;_streamErr;spawn(){let e=cwd(),t=this._options,o={...Ur,...t.nodeOptions},r=[];this._resetState(),t.timeout!==void 0&&r.push(AbortSignal.timeout(t.timeout)),t.signal!==void 0&&r.push(t.signal),t.persist===true&&(o.detached=true),r.length>0&&(o.signal=zr(r)),o.env=Fr(e,o.env);let{command:u,args:c}=Br(this._command,this._args),l=(0, Vr._parse)(u,c,o),a=spawn(l.command,l.args,l.options);if(a.stderr&&(this._streamErr=a.stderr),a.stdout&&(this._streamOut=a.stdout),this._process=a,a.once("error",this._onError),a.once("close",this._onClose),t.stdin!==void 0&&a.stdin&&t.stdin.process){let{stdout:s}=t.stdin.process;s&&s.pipe(a.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();}},te=(e,t,o)=>{let r=new Jr(e,t,o);return r.spawn(),r},Kr=te;function Ve(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var se={},ie,nt;function A(){if(nt)return ie;nt=1;let e,t,o,r,u=true;typeof process<"u"&&({FORCE_COLOR:e,NODE_DISABLE_COLORS:t,NO_COLOR:o,TERM:r}=process.env||{},u=process.stdout&&process.stdout.isTTY);let c={enabled:!t&&o==null&&r!=="dumb"&&(e!=null&&e!=="0"||u),reset:s(0,0),bold:s(1,22),dim:s(2,22),italic:s(3,23),underline:s(4,24),inverse:s(7,27),hidden:s(8,28),strikethrough:s(9,29),black:s(30,39),red:s(31,39),green:s(32,39),yellow:s(33,39),blue:s(34,39),magenta:s(35,39),cyan:s(36,39),white:s(37,39),gray:s(90,39),grey:s(90,39),bgBlack:s(40,49),bgRed:s(41,49),bgGreen:s(42,49),bgYellow:s(43,49),bgBlue:s(44,49),bgMagenta:s(45,49),bgCyan:s(46,49),bgWhite:s(47,49)};function l(h,i){let n=0,f,d="",p="";for(;n<h.length;n++)f=h[n],d+=f.open,p+=f.close,~i.indexOf(f.close)&&(i=i.replace(f.rgx,f.close+f.open));return d+i+p}function a(h,i){let n={has:h,keys:i};return n.reset=c.reset.bind(n),n.bold=c.bold.bind(n),n.dim=c.dim.bind(n),n.italic=c.italic.bind(n),n.underline=c.underline.bind(n),n.inverse=c.inverse.bind(n),n.hidden=c.hidden.bind(n),n.strikethrough=c.strikethrough.bind(n),n.black=c.black.bind(n),n.red=c.red.bind(n),n.green=c.green.bind(n),n.yellow=c.yellow.bind(n),n.blue=c.blue.bind(n),n.magenta=c.magenta.bind(n),n.cyan=c.cyan.bind(n),n.white=c.white.bind(n),n.gray=c.gray.bind(n),n.grey=c.grey.bind(n),n.bgBlack=c.bgBlack.bind(n),n.bgRed=c.bgRed.bind(n),n.bgGreen=c.bgGreen.bind(n),n.bgYellow=c.bgYellow.bind(n),n.bgBlue=c.bgBlue.bind(n),n.bgMagenta=c.bgMagenta.bind(n),n.bgCyan=c.bgCyan.bind(n),n.bgWhite=c.bgWhite.bind(n),n}function s(h,i){let n={open:`\x1B[${h}m`,close:`\x1B[${i}m`,rgx:new RegExp(`\\x1b\\[${i}m`,"g")};return function(f){return this!==void 0&&this.has!==void 0?(~this.has.indexOf(h)||(this.has.push(h),this.keys.push(n)),f===void 0?this:c.enabled?l(this.keys,f+""):f+""):f===void 0?a([h],[n]):c.enabled?l([n],f+""):f+""}}return ie=c,ie}var ne,ot;function os(){return ot||(ot=1,ne=(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}}),ne}var oe,at;function We(){return at||(at=1,oe=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("|"),o=new RegExp(t,"g");return typeof e=="string"?e.replace(o,""):e}),oe}var ae,lt;function M(){if(lt)return ae;lt=1;let e="\x1B",t=`${e}[`,o="\x07",r={to(l,a){return a?`${t}${a+1};${l+1}H`:`${t}${l+1}G`},move(l,a){let s="";return l<0?s+=`${t}${-l}D`:l>0&&(s+=`${t}${l}C`),a<0?s+=`${t}${-a}A`:a>0&&(s+=`${t}${a}B`),s},up:(l=1)=>`${t}${l}A`,down:(l=1)=>`${t}${l}B`,forward:(l=1)=>`${t}${l}C`,backward:(l=1)=>`${t}${l}D`,nextLine:(l=1)=>`${t}E`.repeat(l),prevLine:(l=1)=>`${t}F`.repeat(l),left:`${t}G`,hide:`${t}?25l`,show:`${t}?25h`,save:`${e}7`,restore:`${e}8`},u={up:(l=1)=>`${t}S`.repeat(l),down:(l=1)=>`${t}T`.repeat(l)},c={screen:`${t}2J`,up:(l=1)=>`${t}1J`.repeat(l),down:(l=1)=>`${t}J`.repeat(l),line:`${t}2K`,lineEnd:`${t}K`,lineStart:`${t}1K`,lines(l){let a="";for(let s=0;s<l;s++)a+=this.line+(s<l-1?r.up():"");return l&&(a+=r.left),a}};return ae={cursor:r,scroll:u,erase:c,beep:o},ae}var le,ut;function as(){if(ut)return le;ut=1;let e=We(),{erase:t,cursor:o}=M(),r=u=>[...e(u)].length;return le=function(u,c){if(!c)return t.line+o.to(0);let l=0,a=u.split(/\r?\n/);for(let s of a)l+=1+Math.floor(Math.max(r(s)-1,0)/c);return t.lines(l)},le}var ue,ct;function Zt(){if(ct)return ue;ct=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 ue=process.platform==="win32"?t:e,ue}var ce,ht;function ls(){if(ht)return ce;ht=1;let e=A(),t=Zt(),o=Object.freeze({password:{scale:1,render:s=>"*".repeat(s.length)},emoji:{scale:2,render:s=>"\u{1F603}".repeat(s.length)},invisible:{scale:0,render:s=>""},default:{scale:1,render:s=>`${s}`}}),r=s=>o[s]||o.default,u=Object.freeze({aborted:e.red(t.cross),done:e.green(t.tick),exited:e.yellow(t.cross),default:e.cyan("?")});return ce={styles:o,render:r,symbols:u,symbol:(s,h,i)=>h?u.aborted:i?u.exited:s?u.done:u.default,delimiter:s=>e.gray(s?t.ellipsis:t.pointerSmall),item:(s,h)=>e.gray(s?h?t.pointerSmall:"+":t.line)},ce}var he,dt;function us(){if(dt)return he;dt=1;let e=We();return he=function(t,o){let r=String(e(t)||"").split(/\r?\n/);return o?r.map(u=>Math.ceil(u.length/o)).reduce((u,c)=>u+c):r.length},he}var de,ft;function cs(){return ft||(ft=1,de=(e,t={})=>{let o=Number.isSafeInteger(parseInt(t.margin))?new Array(parseInt(t.margin)).fill(" ").join(""):t.margin||"",r=t.width;return (e||"").split(/\r?\n/g).map(u=>u.split(/\s+/g).reduce((c,l)=>(l.length+o.length>=r||c[c.length-1].length+l.length+1<r?c[c.length-1]+=` ${l}`:c.push(`${o}${l}`),c),[o]).join(`
2
2
  `)).join(`
3
3
  `)}),de}var fe,pt;function hs(){return pt||(pt=1,fe=(e,t,o)=>{o=o||t;let r=Math.min(t-o,e-Math.floor(o/2));r<0&&(r=0);let u=Math.min(r+o,t);return {startIndex:r,endIndex:u}}),fe}var pe,mt;function k(){return mt||(mt=1,pe={action:os(),clear:as(),style:ls(),strip:We(),figures:Zt(),lines:us(),wrap:cs(),entriesToDisplay:hs()}),pe}var me,gt;function N(){if(gt)return me;gt=1;let e=Wr,{action:t}=k(),o=es,{beep:r,cursor:u}=M(),c=A();class l extends o{constructor(s={}){super(),this.firstRender=true,this.in=s.stdin||process.stdin,this.out=s.stdout||process.stdout,this.onRender=(s.onRender||(()=>{})).bind(this);let h=e.createInterface({input:this.in,escapeCodeTimeout:50});e.emitKeypressEvents(this.in,h),this.in.isTTY&&this.in.setRawMode(true);let i=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,n=(f,d)=>{let p=t(d,i);p===false?this._&&this._(f,d):typeof this[p]=="function"?this[p](d):this.bell();};this.close=()=>{this.out.write(u.show),this.in.removeListener("keypress",n),this.in.isTTY&&this.in.setRawMode(false),h.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=true;},this.in.on("keypress",n);}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited});}bell(){this.out.write(r);}render(){this.onRender(c),this.firstRender&&(this.firstRender=false);}}return me=l,me}var ge,yt;function ds(){if(yt)return ge;yt=1;let e=A(),t=N(),{erase:o,cursor:r}=M(),{style:u,clear:c,lines:l,figures:a}=k();class s extends t{constructor(i={}){super(i),this.transform=u.render(i.style),this.scale=this.transform.scale,this.msg=i.message,this.initial=i.initial||"",this.validator=i.validate||(()=>true),this.value="",this.errorMsg=i.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=c("",this.out.columns),this.render();}set value(i){!i&&this.initial?(this.placeholder=true,this.rendered=e.gray(this.transform.render(this.initial))):(this.placeholder=false,this.rendered=this.transform.render(i)),this._value=i,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(`
4
4
  `),this.close();}async validate(){let i=await this.validator(this.value);typeof i=="string"&&(this.errorMsg=i,i=false),this.error=!i;}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(`
@@ -0,0 +1 @@
1
+ var A=["radix","base"],m=["nova","vega","maia","lyra","mira"],p=["neutral","stone","zinc","gray","mauve","olive","mist","taupe"],c=["neutral","stone","zinc","gray","amber","blue","cyan","emerald","fuchsia","green","indigo","lime","orange","pink","purple","red","rose","sky","teal","violet","yellow","mauve","olive","mist","taupe"],b=c,I={neutral:"blue",stone:"lime",zinc:"amber",mauve:"emerald",olive:"violet",mist:"rose",taupe:"cyan"},R=["lucide","hugeicons","tabler","phosphor","remixicon"],E=["inter","noto-sans","nunito-sans","figtree","roboto","raleway","dm-sans","public-sans","outfit","jetbrains-mono","geist","geist-mono","lora","merriweather","playfair-display","noto-serif","roboto-slab","oxanium","manrope","space-grotesk","montserrat","ibm-plex-sans","source-sans-3","instrument-sans"],g=["inherit",...E],_=["default","none","small","medium","large"],y=["subtle","bold"],d=["default","inverted","default-translucent","inverted-translucent"],f=[{key:"menuColor",values:d,bits:3},{key:"menuAccent",values:y,bits:3},{key:"radius",values:_,bits:4},{key:"font",values:E,bits:6},{key:"iconLibrary",values:R,bits:6},{key:"theme",values:c,bits:6},{key:"baseColor",values:p,bits:6},{key:"style",values:m,bits:6}],a=[...f,{key:"chartColor",values:b,bits:6},{key:"fontHeading",values:g,bits:5}],T=Object.fromEntries(a.map(e=>[e.key,e.values[0]])),l="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",P="b",S=["a","b"];function C(e){if(e===0)return "0";let t="",n=e;for(;n>0;)t=l[n%62]+t,n=Math.floor(n/62);return t}function x(e){let t=0;for(let n=0;n<e.length;n++){let s=l.indexOf(e[n]);if(s===-1)return -1;t=t*62+s;}return t}function O(e){let t={...T,...e},n=0,s=0;for(let o of a){let i=o.values.indexOf(t[o.key]);n+=(i===-1?0:i)*2**s,s+=o.bits;}return P+C(n)}function v(e){if(!e||e.length<2)return null;let t=e[0];if(!S.includes(t))return null;let n=t==="a"?f:a,s=x(e.slice(1));if(s<0)return null;let o={},i=0;for(let r of n){let u=Math.floor(s/2**i)%2**r.bits;o[r.key]=u<r.values.length?r.values[u]:r.values[0],i+=r.bits;}return t==="a"&&(o.fontHeading="inherit"),o}function N(e){if(!e||e.length<2||e.length>10||!S.includes(e[0]))return false;for(let t=1;t<e.length;t++)if(l.indexOf(e[t])===-1)return false;return true}function k(e){return v(e)!==null}function h(){let e=t=>t[Math.floor(Math.random()*t.length)];return Object.fromEntries(a.map(t=>[t.key,e(t.values)]))}function L(){return O(h())}export{A as a,m as b,p as c,c as d,b as e,I as f,R as g,E as h,g as i,_ as j,y as k,d as l,T as m,C as n,x as o,O as p,v as q,N as r,k as s,h as t,L as u};
@@ -0,0 +1,2 @@
1
+ import {a}from'./chunk-CHWMSXYA.js';import {SyntaxKind,Project,ScriptKind}from'ts-morph';import {promises}from'fs';import {twMerge}from'tailwind-merge';var ot=async({sourceFile:r,config:n})=>{let e=n.iconLibrary;if(!e||!(e in a))return r;let t=e,i=a[t],o=[];for(let a$1 of r.getDescendantsOfKind(SyntaxKind.JsxSelfClosingElement)){if(a$1.getTagNameNode()?.getText()!=="IconPlaceholder")continue;let f=a$1.getAttributes().find(g=>g.getKind()!==SyntaxKind.JsxAttribute?false:g.asKindOrThrow(SyntaxKind.JsxAttribute).getNameNode().getText()===t);if(!f)continue;let s=f.asKindOrThrow(SyntaxKind.JsxAttribute),l=s.getInitializer()?.getText().replace(/^["']|["']$/g,"");if(!l)continue;o.includes(l)||o.push(l);let u=i.usage.match(/<(\w+)([^>]*)\s*\/>/);s.remove();for(let g of a$1.getAttributes()){if(g.getKind()!==SyntaxKind.JsxAttribute)continue;let x=g.asKindOrThrow(SyntaxKind.JsxAttribute);x.getNameNode().getText()in a&&x.remove();}if(!u){a$1.getTagNameNode()?.replaceWithText(l);continue}let[,b,K]=u;if(b==="ICON"){let g=a$1.getAttributes().filter(x=>x.getKind()!==SyntaxKind.JsxAttribute?true:!(x.asKindOrThrow(SyntaxKind.JsxAttribute).getNameNode().getText()in a)).map(x=>x.getText()).join(" ");g.trim()?a$1.replaceWithText(`<${l} ${g} />`):a$1.getTagNameNode()?.replaceWithText(l);}else {let g=new Set(a$1.getAttributes().filter(m=>m.getKind()===SyntaxKind.JsxAttribute).map(m=>m.asKindOrThrow(SyntaxKind.JsxAttribute).getNameNode().getText())),A=K.replace(/\{ICON\}/g,`{${l}}`).trim().split(/\s+(?=\w+=)/).filter(m=>m).map(m=>{let E=m.split("=")[0];return E&&!g.has(E)?m:null}).filter(Boolean),$=a$1.getAttributes().filter(m=>m.getKind()!==SyntaxKind.JsxAttribute?true:!(m.asKindOrThrow(SyntaxKind.JsxAttribute).getNameNode().getText()in a)).map(m=>m.getText()).join(" "),M=[...A,$].filter(Boolean).join(" ");a$1.replaceWithText(`<${b} ${M} />`);}}for(let a of r.getImportDeclarations()??[])if(a.getModuleSpecifier()?.getText()?.includes("icon-placeholder")){let l=(a.getNamedImports()??[]).find(d=>d.getName()==="IconPlaceholder");l&&l.remove(),a.getNamedImports()?.length===0&&a.remove();}if(o.length>0){let a=i.import.split(`
2
+ `),f=[];for(let s of a){let l=s.match(/import\s+{([^}]+)}\s+from\s+['"]([^'"]+)['"]/);if(!l)continue;let[,d,u]=l,b=d.split(",").map(g=>g.trim()).map(g=>g==="ICON"?o.map(x=>({name:x})):{name:g}).flat(),K=r.addImportDeclaration({moduleSpecifier:u,namedImports:b});f.push(K);}if(!z(r))for(let s of f)s.replaceWithText(s.getText().replace(";",""));}return r};function z(r){return r.getImportDeclarations()?.[0]?.getText().endsWith(";")??false}var ft=async({sourceFile:r,config:n,baseColor:e})=>(n.tailwind?.cssVariables||!e?.inlineColors||r.getDescendantsOfKind(SyntaxKind.StringLiteral).forEach(t=>{let i=t.getLiteralText(),o=J(i,e.inlineColors).trim();o!==i&&t.setLiteralValue(o);}),r);function I(r){if(!r.includes("/")&&!r.includes(":"))return [null,r,null];let n=-1,e=0;for(let s=r.length-1;s>=0;s--){let l=r[s];if(l==="]")e++;else if(l==="[")e--;else if(l===":"&&e===0){n=s;break}}let t=null,i;n===-1?i=r:(t=r.slice(0,n),i=r.slice(n+1));let o=i.lastIndexOf("/");if(o===-1)return [t,i,null];let a=i.slice(0,o),f=i.slice(o+1);return [t,a,f]}var k=["bg-","text-","border-","ring-offset-","ring-"];function J(r,n){r.includes(" border ")&&(r=r.replace(" border "," border border-border "));let e=r.split(" "),t=new Set,i=new Set;for(let o of e){let[a,f,s]=I(o),l=k.find(u=>f?.startsWith(u));if(!l){t.has(o)||t.add(o);continue}let d=f?.replace(l,"");if(d&&d in n.light){t.add([a,`${l}${n.light[d]}`].filter(Boolean).join(":")+(s?`/${s}`:"")),i.add(["dark",a,`${l}${n.dark[d]}`].filter(Boolean).join(":")+(s?`/${s}`:""));continue}t.has(o)||t.add(o);}return [...Array.from(t),...Array.from(i)].join(" ").trim()}var V=[["-ml-","-ms-"],["-mr-","-me-"],["ml-","ms-"],["mr-","me-"],["pl-","ps-"],["pr-","pe-"],["-left-","-start-"],["-right-","-end-"],["left-","start-"],["right-","end-"],["inset-l-","inset-inline-start-"],["inset-r-","inset-inline-end-"],["rounded-tl-","rounded-ss-"],["rounded-tr-","rounded-se-"],["rounded-bl-","rounded-es-"],["rounded-br-","rounded-ee-"],["rounded-l-","rounded-s-"],["rounded-r-","rounded-e-"],["border-l-","border-s-"],["border-r-","border-e-"],["border-l","border-s"],["border-r","border-e"],["text-left","text-start"],["text-right","text-end"],["scroll-ml-","scroll-ms-"],["scroll-mr-","scroll-me-"],["scroll-pl-","scroll-ps-"],["scroll-pr-","scroll-pe-"],["float-left","float-start"],["float-right","float-end"],["clear-left","clear-start"],["clear-right","clear-end"],["origin-top-left","origin-top-start"],["origin-top-right","origin-top-end"],["origin-bottom-left","origin-bottom-start"],["origin-bottom-right","origin-bottom-end"],["origin-left","origin-start"],["origin-right","origin-end"]],B=[["-translate-x-","translate-x-"],["translate-x-","-translate-x-"]],G=[["space-x-","space-x-reverse"],["divide-x-","divide-x-reverse"]],X=[["cursor-w-resize","cursor-e-resize"],["cursor-e-resize","cursor-w-resize"]],F=[["data-[side=inline-start]","slide-in-from-right","slide-in-from-end"],["data-[side=inline-start]","slide-out-to-right","slide-out-to-end"],["data-[side=inline-end]","slide-in-from-left","slide-in-from-start"],["data-[side=inline-end]","slide-out-to-left","slide-out-to-start"]],Q="cn-rtl-flip",P=["ContextMenuContent","ContextMenuSubContent","DropdownMenuSubContent"],C={right:"inline-end",left:"inline-start"},U=["-left-","-right-","left-","right-"],pt=async({sourceFile:r,config:n})=>(n.rtl&&O(r),r);async function xt(r,n){if(!n)return r;let t=new Project({useInMemoryFileSystem:true}).createSourceFile("component.tsx",r,{scriptKind:ScriptKind.TSX,overwrite:true});return O(t),t.getText()}function L(r){return r.replace(/^["']|["']$/g,"")}function h(r){let n=L(r.getText()??"");r.replaceWithText(`"${q(n)}"`);}function q(r){return r.split(" ").flatMap(n=>{if(n.startsWith("rtl:")||n.startsWith("ltr:"))return [n];if(n===Q)return ["rtl:rotate-180"];let[e,t,i]=I(n);if(!t)return [n];for(let[s,l]of B)if(t.startsWith(s)){let d=t.replace(s,l),u=e?`rtl:${e}:${d}${i?`/${i}`:""}`:`rtl:${d}${i?`/${i}`:""}`;return [n,u]}for(let[s,l]of G)if(t.startsWith(s)){let d=e?`rtl:${e}:${l}`:`rtl:${l}`;return [n,d]}for(let[s,l]of X)if(t===s){let d=e?`rtl:${e}:${l}`:`rtl:${l}`;return [n,d]}for(let[s,l,d]of F)if(e?.includes(s)&&t.startsWith(l)){let u=t.replace(l,d);return [i?`${e}:${u}/${i}`:`${e}:${u}`]}let o=e?.includes("data-[side=left]")||e?.includes("data-[side=right]"),a=t;for(let[s,l]of V)if(!(o&&U.some(d=>s.startsWith(d)))&&t.startsWith(s)){if(!s.endsWith("-")&&t!==s)continue;a=t.replace(s,l);break}let f;return e?f=i?`${e}:${a}/${i}`:`${e}:${a}`:f=i?`${a}/${i}`:a,[f]}).join(" ")}function O(r){r.getDescendantsOfKind(SyntaxKind.CallExpression).filter(n=>n.getExpression().getText()==="cva").forEach(n=>{let e=n.getArguments()[0];e?.isKind(SyntaxKind.StringLiteral)&&h(e),n.getArguments()[1]?.isKind(SyntaxKind.ObjectLiteralExpression)&&n.getArguments()[1]?.getDescendantsOfKind(SyntaxKind.PropertyAssignment).find(t=>t.getName()==="variants")?.getDescendantsOfKind(SyntaxKind.PropertyAssignment).forEach(t=>{t.getDescendantsOfKind(SyntaxKind.PropertyAssignment).forEach(i=>{let o=i.getInitializerIfKind(SyntaxKind.StringLiteral);o&&h(o);});});}),r.getDescendantsOfKind(SyntaxKind.JsxAttribute).forEach(n=>{if(n.getNameNode().getText()==="className"){let e=n.getInitializer();if(e?.isKind(SyntaxKind.StringLiteral)&&h(e),n.getInitializer()?.isKind(SyntaxKind.JsxExpression)){let t=n.getInitializer()?.getDescendantsOfKind(SyntaxKind.CallExpression).find(i=>i.getExpression().getText()==="cn");t&&t.getArguments().forEach(i=>{(i.isKind(SyntaxKind.ConditionalExpression)||i.isKind(SyntaxKind.BinaryExpression))&&i.getChildrenOfKind(SyntaxKind.StringLiteral).forEach(h),i.isKind(SyntaxKind.StringLiteral)&&h(i);});}}n.getNameNode().getText()==="classNames"&&n.getInitializer()?.isKind(SyntaxKind.JsxExpression)&&n.getDescendantsOfKind(SyntaxKind.PropertyAssignment).forEach(e=>{if(e.getInitializer()?.isKind(SyntaxKind.CallExpression)){let i=e.getInitializerIfKind(SyntaxKind.CallExpression);i&&i.getArguments().forEach(o=>{o.isKind(SyntaxKind.ConditionalExpression)&&o.getChildrenOfKind(SyntaxKind.StringLiteral).forEach(h),o.isKind(SyntaxKind.StringLiteral)&&h(o);});}let t=e.getInitializer();t?.isKind(SyntaxKind.StringLiteral)&&e.getNameNode().getText()!=="variant"&&h(t);});}),r.getDescendantsOfKind(SyntaxKind.CallExpression).filter(n=>n.getExpression().getText()==="mergeProps").forEach(n=>{let e=n.getArguments()[0];if(e?.isKind(SyntaxKind.ObjectLiteralExpression)){let t=e.getProperties().find(i=>i.isKind(SyntaxKind.PropertyAssignment)&&i.getName()==="className");if(t?.isKind(SyntaxKind.PropertyAssignment)){let i=t.getInitializer();i?.isKind(SyntaxKind.CallExpression)&&i.getExpression().getText()==="cn"&&i.getArguments().forEach(o=>{o.isKind(SyntaxKind.StringLiteral)&&h(o),(o.isKind(SyntaxKind.ConditionalExpression)||o.isKind(SyntaxKind.BinaryExpression))&&o.getChildrenOfKind(SyntaxKind.StringLiteral).forEach(h);}),i?.isKind(SyntaxKind.StringLiteral)&&h(i);}}}),[...r.getDescendantsOfKind(SyntaxKind.JsxSelfClosingElement),...r.getDescendantsOfKind(SyntaxKind.JsxOpeningElement)].forEach(n=>{let e=n.getTagNameNode().getText();if(!P.includes(e))return;let t=n.getAttributes().find(f=>f.isKind(SyntaxKind.JsxAttribute)&&f.getNameNode().getText()==="side");if(!t?.isKind(SyntaxKind.JsxAttribute))return;let i=t.getInitializer();if(!i?.isKind(SyntaxKind.StringLiteral))return;let o=L(i.getText()??""),a=C[o];a&&i.replaceWithText(`"${a}"`);}),r.getDescendantsOfKind(SyntaxKind.BindingElement).forEach(n=>{if(n.getNameNode().getText()!=="side")return;let i=n.getFirstAncestorByKind(SyntaxKind.FunctionDeclaration)?.getName();if(!i||!P.includes(i))return;let o=n.getInitializer();if(!o?.isKind(SyntaxKind.StringLiteral))return;let a=L(o.getText()??""),f=C[a];f&&o.replaceWithText(`"${f}"`);});}var D=[{marker:"cn-font-heading",utility:"font-heading",supportToken:"--font-heading:"}],w=/\bcn-font-heading\b/,v=new Map;async function Y(r,n=[]){let e=new Set(n);if(!r)return e;let t=v.get(r);return t||(t=promises.readFile(r,"utf8").then(i=>{let o=new Set;for(let a of D)i.includes(a.supportToken)&&o.add(a.marker);return o}).catch(()=>new Set),v.set(r,t)),(await t).forEach(i=>{e.add(i);}),e}function R(r,n){let e=r;for(let t of D)e.includes(t.marker)&&(e=e.replace(new RegExp(`\\b${t.marker}\\b`,"g"),n.has(t.marker)?t.utility:""));return e.replace(/\s+/g," ").trim()}function N(r,n){let e=r.getLiteralValue();if(!w.test(e))return;let t=R(e,n);t!==e&&r.setLiteralValue(t);}function y(r,n){for(let e of r.getDescendantsOfKind(SyntaxKind.StringLiteral))N(e,n);for(let e of r.getDescendantsOfKind(SyntaxKind.NoSubstitutionTemplateLiteral))N(e,n);}var At=async({sourceFile:r,config:n,supportedFontMarkers:e})=>{let t=await Y(n.resolvedPaths.tailwindCss,e),i=[];for(let o of r.getDescendantsOfKind(SyntaxKind.JsxAttribute)){let a=o.getNameNode().getText();if(a!=="className"&&a!=="classNames")continue;let f=o.getInitializer();if(f?.isKind(SyntaxKind.StringLiteral)){let s=f.getLiteralValue();if(w.test(s)){let l=R(s,t);l===""?i.push(o):l!==s&&f.setLiteralValue(l);}}f?.isKind(SyntaxKind.JsxExpression)&&y(f,t);}for(let o of i)o.remove();for(let o of r.getDescendantsOfKind(SyntaxKind.CallExpression)){if(o.getExpression().getText()==="cva"){for(let a of o.getArguments()){if(a.isKind(SyntaxKind.StringLiteral)){N(a,t);continue}if(a.isKind(SyntaxKind.NoSubstitutionTemplateLiteral)){N(a,t);continue}y(a,t);}continue}o.getExpression().getText()==="mergeProps"&&y(o,t);}return r};var et="animate-none! relative bg-popover/70 before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit] before:backdrop-blur-2xl before:backdrop-saturate-150 **:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10 **:data-[slot$=-separator]:bg-foreground/5 **:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10! **:data-[variant=destructive]:focus:bg-foreground/10! **:data-[variant=destructive]:text-accent-foreground! **:data-[variant=destructive]:**:text-accent-foreground!",yt=async({sourceFile:r,config:n})=>{let e=n.menuColor,t=e==="default-translucent"||e==="inverted-translucent";for(let i of r.getDescendantsOfKind(SyntaxKind.JsxAttribute)){if(i.getNameNode().getText()!=="className")continue;let a=i.getInitializer();if(!a)continue;let f=a.getText();if(!f.includes("cn-menu-target")&&!f.includes("cn-menu-translucent"))continue;let s=f,l=false;e==="inverted"||e==="inverted-translucent"?s=s.replace(/cn-menu-target/g,"dark"):(s=s.replace(/cn-menu-target/g,""),l=true),t?s=s.replace(/"([^"]*cn-menu-translucent[^"]*)"/g,(d,u)=>`"${twMerge(u,et).replace(/\s*\bcn-menu-translucent\b\s*/g," ").trim()}"`):s.includes("cn-menu-translucent")&&(s=s.replace(/cn-menu-translucent/g,""),l=true),l&&(s=s.replace(/\s{2,}/g," "),s=s.replace(/"\s+/g,'"'),s=s.replace(/\s+"/g,'"'),s=s.replace(/,\s*""\s*,/g,","),s=s.replace(/\(\s*""\s*,/g,"("),s=s.replace(/,\s*""\s*\)/g,")")),i.setInitializer(s);}return r};export{ft as a,I as b,ot as c,pt as d,xt as e,At as f,yt as g};