shadcn-svelte 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index-DR4OXo3-.d.mts → index-Z2_wxLiz.d.mts} +1 -1
- package/dist/index.mjs +1 -1
- package/dist/preset/index.d.mts +1 -1
- package/dist/utils/transformers/index.d.mts +1 -1
- package/dist/utils/transformers/transform-icons.d.mts +1 -1
- package/dist/utils/transformers/transform-imports.d.mts +1 -1
- package/dist/utils/transformers/transform-menu.d.mts +1 -1
- package/dist/utils/transformers/transform-strip-types.d.mts +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -135,7 +135,7 @@ ${t?A(`cyan`,Gi):``}
|
|
|
135
135
|
|
|
136
136
|
This CLI version requires Tailwind v4 and Svelte v5 for the ${P(`init`)} command.\n\nYou have two options:\n1. Update Tailwind CSS to v4 and try again.\n2. Use ${P(`shadcn-svelte@1.0.0-next.10`)} that supports initializing projects with Tailwind v3.\n\nReferences:\nTailwind v4 Guide: ${M.default.underline(`${b}/docs/migration/tailwind-v4`)}\nLegacy Tailwind v3 Docs: ${M.default.underline(`${y}/docs`)}\n\n`)}:t&&r?{ok:!1,error:h(`Initializing a project with Tailwind v3 and Svelte v4 is not supported.\n\nThis CLI version requires Tailwind v4 and Svelte v5 for the ${P(`init`)} command.\n\nPlease use ${P(`shadcn-svelte@0.14`)} that supports Tailwind v3 + Svelte v4.\n\n`)}:!n||!i?{ok:!1,error:h(`This CLI version requires Tailwind CSS v4 and Svelte v5 to initialize a project.
|
|
137
137
|
`)}:{ok:!0}}let nc;function rc(){try{return D.statSync(`/.dockerenv`),!0}catch{return!1}}function ic(){try{return D.readFileSync(`/proc/self/cgroup`,`utf8`).includes(`docker`)}catch{return!1}}function ac(){return nc===void 0&&(nc=rc()||ic()),nc}let oc;const sc=()=>{try{return D.statSync(`/run/.containerenv`),!0}catch{return!1}};function cc(){return oc===void 0&&(oc=sc()||ac()),oc}const lc=()=>{if(T.platform!==`linux`)return!1;if(nt.release().toLowerCase().includes(`microsoft`))return!cc();try{if(D.readFileSync(`/proc/version`,`utf8`).toLowerCase().includes(`microsoft`))return!cc()}catch{}return D.existsSync(`/proc/sys/fs/binfmt_misc/WSLInterop`)||D.existsSync(`/run/WSL`)?!cc():!1};var uc=T.env.__IS_WSL_TEST__?lc:lc();const dc=We(et.execFile),fc=()=>`${T.env.SYSTEMROOT||T.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`,pc=async(e,t={})=>{let{powerShellPath:n,...r}=t,i=pc.encodeCommand(e);return dc(n??fc(),[...pc.argumentsPrefix,i],{encoding:`utf8`,...r})};pc.argumentsPrefix=[`-NoProfile`,`-NonInteractive`,`-ExecutionPolicy`,`Bypass`,`-EncodedCommand`],pc.encodeCommand=e=>rt.from(e,`utf16le`).toString(`base64`),pc.escapeArgument=e=>`'${String(e).replaceAll(`'`,`''`)}'`;function mc(e){for(let t of e.split(`
|
|
138
|
-
`)){if(/^\s*#/.test(t))continue;let e=/^\s*root\s*=\s*(?<mountPoint>"[^"]*"|'[^']*'|[^#]*)/.exec(t);if(e)return e.groups.mountPoint.trim().replaceAll(/^["']|["']$/g,``)}}const hc=We(et.execFile),gc=(()=>{let e=`/mnt/`,t;return async function(){if(t)return t;let n=`/etc/wsl.conf`,r=!1;try{await He.access(n,Ue.F_OK),r=!0}catch{}if(!r)return e;let i=mc(await He.readFile(n,{encoding:`utf8`}));return i===void 0?e:(t=i,t=t.endsWith(`/`)?t:`${t}/`,t)}})(),_c=uc?async()=>`${await gc()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`:fc;let vc;const yc=async()=>(vc??=(async()=>{try{let e=await _c();return await He.access(e,Ue.X_OK),!0}catch{return!1}})(),vc),bc=async()=>{let e=await _c(),{stdout:t}=await pc(String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,{powerShellPath:e});return t.trim()},xc=async e=>{if(/^[a-z]+:\/\//i.test(e))return e;try{let{stdout:t}=await hc(`wslpath`,[`-aw`,e],{encoding:`utf8`});return t.trim()}catch{return e}};function Sc(e,t,n){let r=n=>Object.defineProperty(e,t,{value:n,enumerable:!0,writable:!0});return Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){let e=n();return r(e),e},set(e){r(e)}}),e}const Cc=We(tt);async function wc(){if(T.platform!==`darwin`)throw Error(`macOS only`);let{stdout:e}=await Cc(`defaults`,[`read`,`com.apple.LaunchServices/com.apple.launchservices.secure`,`LSHandlers`]),t=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(e)?.groups.id??`com.apple.Safari`;return t===`com.apple.safari`?`com.apple.Safari`:t}const Tc=We(tt);async function Ec(e,{humanReadableOutput:t=!0,signal:n}={}){if(T.platform!==`darwin`)throw Error(`macOS only`);let r=t?[]:[`-ss`],i={};n&&(i.signal=n);let{stdout:a}=await Tc(`osascript`,[`-e`,e,r],i);return a.trim()}async function Dc(e){return Ec(`tell application "Finder" to set app_path to application file id "${e}" as string\ntell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}const Oc=We(tt),kc={MSEdgeHTM:{name:`Edge`,id:`com.microsoft.edge`},MSEdgeBHTML:{name:`Edge Beta`,id:`com.microsoft.edge.beta`},MSEdgeDHTML:{name:`Edge Dev`,id:`com.microsoft.edge.dev`},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:`Edge`,id:`com.microsoft.edge.old`},ChromeHTML:{name:`Chrome`,id:`com.google.chrome`},ChromeBHTML:{name:`Chrome Beta`,id:`com.google.chrome.beta`},ChromeDHTML:{name:`Chrome Dev`,id:`com.google.chrome.dev`},ChromiumHTM:{name:`Chromium`,id:`org.chromium.Chromium`},BraveHTML:{name:`Brave`,id:`com.brave.Browser`},BraveBHTML:{name:`Brave Beta`,id:`com.brave.Browser.beta`},BraveDHTML:{name:`Brave Dev`,id:`com.brave.Browser.dev`},BraveSSHTM:{name:`Brave Nightly`,id:`com.brave.Browser.nightly`},FirefoxURL:{name:`Firefox`,id:`org.mozilla.firefox`},OperaStable:{name:`Opera`,id:`com.operasoftware.Opera`},VivaldiHTM:{name:`Vivaldi`,id:`com.vivaldi.Vivaldi`},"IE.HTTP":{name:`Internet Explorer`,id:`com.microsoft.ie`}},Ac=new Map(Object.entries(kc));var jc=class extends Error{};async function Mc(e=Oc){let{stdout:t}=await e(`reg`,[`QUERY`,` HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice`,`/v`,`ProgId`]),n=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(t);if(!n)throw new jc(`Cannot find Windows browser in stdout: ${JSON.stringify(t)}`);let{id:r}=n.groups,i=r.lastIndexOf(`.`),a=r.lastIndexOf(`-`),o=i===-1?void 0:r.slice(0,i),s=a===-1?void 0:r.slice(0,a);return kc[r]??kc[o]??kc[s]??{name:r,id:r}}const Nc=We(tt),Pc=e=>e.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase());async function Fc(){if(T.platform===`darwin`){let e=await wc();return{name:await Dc(e),id:e}}if(T.platform===`linux`){let{stdout:e}=await Nc(`xdg-mime`,[`query`,`default`,`x-scheme-handler/http`]),t=e.trim();return{name:Pc(t.replace(/.desktop$/,``).replace(`-`,` `)),id:t}}if(T.platform===`win32`)return Mc();throw Error(`Only macOS, Linux, and Windows are supported`)}var Ic=!!(T.env.SSH_CONNECTION||T.env.SSH_CLIENT||T.env.SSH_TTY);const Lc=Symbol(`fallbackAttempt`),Rc=import.meta.url?E.dirname(Me(import.meta.url)):``,zc=E.join(Rc,`xdg-open`),{platform:Bc,arch:Vc}=T,Hc=async(e,t)=>{if(e.length===0)return;let n=[];for(let r of e)try{return await t(r)}catch(e){n.push(e)}throw AggregateError(n,`Failed to open in all supported apps`)},Uc=async e=>{e={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...e};let t=e[Lc]===!0;if(delete e[Lc],Array.isArray(e.app))return Hc(e.app,t=>Uc({...e,app:t,[Lc]:!0}));let{name:n,arguments:r=[]}=e.app??{};if(r=[...r],Array.isArray(n))return Hc(n,t=>Uc({...e,app:{name:t,arguments:r},[Lc]:!0}));if(n===`browser`||n===`browserPrivate`){let t={"com.google.chrome":`chrome`,"google-chrome.desktop":`chrome`,"com.brave.browser":`brave`,"org.mozilla.firefox":`firefox`,"firefox.desktop":`firefox`,"com.microsoft.msedge":`edge`,"com.microsoft.edge":`edge`,"com.microsoft.edgemac":`edge`,"microsoft-edge.desktop":`edge`,"com.apple.safari":`safari`},i={chrome:`--incognito`,brave:`--incognito`,firefox:`--private-window`,edge:`--inPrivate`},a;if(uc){let e=await bc();a=Ac.get(e)??{}}else a=await Fc();if(a.id in t){let o=t[a.id.toLowerCase()];if(n===`browserPrivate`){if(o===`safari`)throw Error(`Safari doesn't support opening in private mode via command line`);r.push(i[o])}return Uc({...e,app:{name:qc[o],arguments:r}})}throw Error(`${a.name} is not supported as a default browser`)}let i,a=[],o={},s=!1;if(uc&&!cc()&&!Ic&&!n&&(s=await yc()),Bc===`darwin`)i=`open`,e.wait&&a.push(`--wait-apps`),e.background&&a.push(`--background`),e.newInstance&&a.push(`--new`),n&&a.push(`-a`,n);else if(Bc===`win32`||s){i=await _c(),a.push(...pc.argumentsPrefix),uc||(o.windowsVerbatimArguments=!0),uc&&e.target&&(e.target=await xc(e.target));let t=[`$ProgressPreference = 'SilentlyContinue';`,`Start`];e.wait&&t.push(`-Wait`),n?(t.push(pc.escapeArgument(n)),e.target&&r.push(e.target)):e.target&&t.push(pc.escapeArgument(e.target)),r.length>0&&(r=r.map(e=>pc.escapeArgument(e)),t.push(`-ArgumentList`,r.join(`,`))),e.target=pc.encodeCommand(t.join(` `)),e.wait||(o.stdio=`ignore`)}else{if(n)i=n;else{let e=!Rc||Rc===`/`,t=!1;try{await He.access(zc,Ue.X_OK),t=!0}catch{}i=T.versions.electron??(Bc===`android`||e||!t)?`xdg-open`:zc}r.length>0&&a.push(...r),e.wait||(o.stdio=`ignore`,o.detached=!0)}Bc===`darwin`&&r.length>0&&a.push(`--args`,...r),e.target&&a.push(e.target);let c=et.spawn(i,a,o);return e.wait?new Promise((t,n)=>{c.once(`error`,n),c.once(`close`,r=>{if(!e.allowNonzeroExitCode&&r!==0){n(Error(`Exited with code ${r}`));return}t(c)})}):t?new Promise((e,t)=>{c.once(`error`,t),c.once(`spawn`,()=>{c.once(`close`,n=>{if(c.off(`error`,t),n!==0){t(Error(`Exited with code ${n}`));return}c.unref(),e(c)})})}):(c.unref(),new Promise((e,t)=>{c.once(`error`,t),c.once(`spawn`,()=>{c.off(`error`,t),e(c)})}))},Wc=(e,t)=>{if(typeof e!=`string`)throw TypeError("Expected a `target`");return Uc({...t,target:e})};function Gc(e){if(typeof e==`string`||Array.isArray(e))return e;let{[Vc]:t}=e;if(!t)throw Error(`${Vc} is not supported`);return t}function Kc({[Bc]:e},{wsl:t}={}){if(t&&uc)return Gc(t);if(!e)throw Error(`${Bc} is not supported`);return Gc(e)}const qc={browser:`browser`,browserPrivate:`browserPrivate`};Sc(qc,`chrome`,()=>Kc({darwin:`google chrome`,win32:`chrome`,linux:[`google-chrome`,`google-chrome-stable`,`chromium`,`chromium-browser`]},{wsl:{ia32:`/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe`,x64:[`/mnt/c/Program Files/Google/Chrome/Application/chrome.exe`,`/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe`]}})),Sc(qc,`brave`,()=>Kc({darwin:`brave browser`,win32:`brave`,linux:[`brave-browser`,`brave`]},{wsl:{ia32:`/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe`,x64:[`/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe`,`/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe`]}})),Sc(qc,`firefox`,()=>Kc({darwin:`firefox`,win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:`firefox`},{wsl:`/mnt/c/Program Files/Mozilla Firefox/firefox.exe`})),Sc(qc,`edge`,()=>Kc({darwin:`microsoft edge`,win32:`msedge`,linux:[`microsoft-edge`,`microsoft-edge-dev`]},{wsl:`/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe`})),Sc(qc,`safari`,()=>Kc({darwin:`Safari`}));var Jc=Wc;const Yc={nova:{title:`Nova`,description:`Lucide / Geist`,hint:`Reduced spacing for compact layouts.`,style:`nova`,baseColor:`neutral`,theme:`neutral`,iconLibrary:`lucide`,font:`geist`,menuAccent:`subtle`,menuColor:`default`,radius:`default`},vega:{title:`Vega`,description:`Lucide / Inter`,hint:`The classic shadcn/ui look.`,style:`vega`,baseColor:`neutral`,theme:`neutral`,iconLibrary:`lucide`,font:`inter`,menuAccent:`subtle`,menuColor:`default`,radius:`default`},maia:{title:`Maia`,description:`Hugeicons / Figtree`,hint:`Soft and rounded, with generous spacing.`,style:`maia`,baseColor:`neutral`,theme:`neutral`,iconLibrary:`hugeicons`,font:`figtree`,menuAccent:`subtle`,menuColor:`default`,radius:`default`},lyra:{title:`Lyra`,description:`Phosphor / JetBrains Mono`,hint:`Boxy and sharp. Pairs well with mono fonts.`,style:`lyra`,baseColor:`neutral`,theme:`neutral`,iconLibrary:`phosphor`,font:`jetbrains-mono`,menuAccent:`subtle`,menuColor:`default`,radius:`default`},mira:{title:`Mira`,description:`Hugeicons / Inter`,hint:`Compact. Made for dense interfaces.`,style:`mira`,baseColor:`neutral`,theme:`neutral`,iconLibrary:`hugeicons`,font:`inter`,menuAccent:`subtle`,menuColor:`default`,radius:`default`}};async function Xc(e){let t=await Ka({message:`You didn't provide a preset for the design system, how would you like to continue?`,initialValue:e?.style===void 0?`presets`:`prompt`,options:Object.entries(Zc).map(([e,t])=>({label:t.label,value:e}))});return I(t)&&B(),await Zc[t].select(e)}const Zc={presets:{label:`Choose from a list of pre-configured presets`,select:e=>$c(e)},customize:{label:`Create my own preset at ${M.default.bold(`shadcn-svelte.com/create`)}`,select:e=>Qc(e)},prompt:{label:`Prompt me for the preset`,select:e=>el(e)}};async function Qc(e){let t=go(e??ce),n=new URL(`/create`,t).toString(),r=Wa();r.start(`Opening ${M.default.bold(n)} in your browser`),await Jc(n),r.stop(`Opened ${M.default.bold(n)} in your browser`);let i=e=>(e.startsWith(`--preset `)&&(e=e.slice(9)),e),a=await Qa({message:`When you're done, paste the code back here and we'll use it to configure your project.`,placeholder:"Click on the `--preset <code>` button and paste the code here",validate:e=>{if(!ae(i(e??``)))return`Invalid preset code`}});return I(a)&&B(),ee(i(a))}async function $c(e){let t=await Ka({message:`Choose from a list of pre-configured presets`,initialValue:e?.style??`vega`,options:c(Yc).map(([e,t])=>({label:`${t.title} - ${t.description}`,value:e,hint:t.hint}))});return I(t)&&B(),Yc[t]}async function el(e){let t=await Pa({style:()=>Ka({message:`Choose a style`,initialValue:e?.style??ce.style,options:c(Yc).map(([e,t])=>({label:t.title,value:e,hint:t.hint}))}),radius:()=>Ka({message:`Choose a radius`,initialValue:`default`,options:c(w).map(([e,t])=>({label:`${t.label} ${t.value}`,value:e}))}),baseColor:()=>Ka({message:`Choose a base color`,initialValue:e?.tailwind.baseColor??ce.tailwind.baseColor,options:c(ne).map(([e,t])=>({label:`${En(t.color)(`■`)} ${t.name}`,value:e}))}),theme:({results:e})=>Ka({message:`Choose a theme`,initialValue:e.baseColor,options:c(ie).map(([e,t])=>({label:`${En(t.color)(`■`)} ${t.name}`,value:e}))}),iconLibrary:()=>Ka({message:`Choose an icon library`,initialValue:e?.iconLibrary??ce.iconLibrary,options:c(f).map(([e,t])=>({label:t.title,value:t.name,hint:t.packages.join(`, `)}))}),font:()=>Ka({message:`Choose a font`,initialValue:`inter`,options:te.map(e=>({label:s(e),value:e}))})},{onCancel:()=>B()});return{style:t.style,baseColor:t.baseColor,theme:t.theme,iconLibrary:t.iconLibrary,font:t.font,radius:t.radius,menuColor:e?.menuColor??ce.menuColor,menuAccent:e?.menuAccent??ce.menuAccent}}const tl=vo(),nl=o({cwd:m(),baseColor:m().optional(),preset:m().optional(),css:m().optional(),componentsAlias:m().optional(),utilsAlias:m().optional(),libAlias:m().optional(),hooksAlias:m().optional(),uiAlias:m().optional(),deps:a(),overwrite:a(),proxy:m().optional(),skipPreflight:a()}),rl=new Ce().command(`init`).description(`initialize your project and install dependencies`).option(`--preset <preset>`,`the preset to use`).option(`-c, --cwd <path>`,`the working directory`,T.cwd()).option(`-o, --overwrite`,`overwrite existing files`,!1).option(`--no-deps`,`disable adding & installing dependencies`).option(`--skip-preflight`,`ignore preflight checks and continue`,!1).addOption(new we(`--base-color <name>`,`the base color for the components`).choices(tl.map(e=>e.name))).addOption(new we(`--design-system-url`)).option(`--css <path>`,`path to the global CSS file`).option(`--components-alias <path>`,`import alias for components`).option(`--lib-alias <path>`,`import alias for lib`).option(`--utils-alias <path>`,`import alias for utils`).option(`--hooks-alias <path>`,`import alias for hooks`).option(`--ui-alias <path>`,`import alias for ui`).option(`--proxy <proxy>`,`fetch items from registry using a proxy`,mo()).action(async e=>{$a();let t=nl.parse(e),n=E.resolve(t.cwd);try{if(!O(n))throw h(`The path ${M.default.cyan(n)} does not exist. Please try again.`);let e=null;t.preset!==void 0&&(e=ee(t.preset),e===null&&z.warn(`${M.default.dim(`--preset ${t.preset}`)} is not a valid preset.`)),ec(n,{skipPreflight:t.skipPreflight});let r=ao(n);r&&=Ys({cwd:n,config:r,skipPreflight:t.skipPreflight});let{resolvedConfig:i,decidedPresets:a,styleChanged:o}=await al({cwd:n,presetConfig:e,existingConfig:r,options:t});await ol({cwd:n,config:i,decidedPresets:a,options:t,styleChanged:o}),La(`${M.default.green(`Success!`)} Project initialization completed.`)}catch(e){to(e)}});function il(e,t,n){if(t.css&&!O(E.resolve(e,t.css)))throw h(`The provided global CSS file path ${M.default.cyan(t.css)} does not exist. Please enter a valid path.`);for(let[r,i]of Object.entries(t)){if(!r.endsWith(`Alias`))continue;let t=co({cwd:e,importPath:i,tsconfig:n});if(t)throw h(t)}}async function al({cwd:e,presetConfig:t,existingConfig:n,options:r}){let i=n??structuredClone(ce);await Kr(e);let{cssPath:a,tsconfigPath:o}=Vs(e,{relative:!0}),s;if(n)s=po(e,n);else{if(o)i.typescript=o.includes(`tsconfig`);else{let t=await Qa({message:`Where is your ${P(`tsconfig/jsconfig`)} file?`,placeholder:`tsconfig.json`,validate:t=>{let n=E.resolve(e,t??``);if(!(t&&O(n)))return`"${M.default.bold(t)}" does not exist. Please enter a valid path.`}});I(t)&&B(),i.typescript={config:t}}s=po(e,i)}il(e,r,s);let c=t??await Xc(n),l=r.css;if(l===void 0){let t=ce.tailwind.css,r=await Qa({message:`Where is your ${P(`global CSS`)} file? ${M.default.gray(`(this file will be overwritten)`)}`,initialValue:n?.tailwind.css??a??t,placeholder:a??t,validate:t=>{if(!(t&&O(E.resolve(e,t))))return`"${M.default.bold(t)}" does not exist. Please enter a valid path.`}});I(r)&&B(),l=r}let{utilsAlias:u,libAlias:d,componentAlias:f,hooksAlias:p,uiAlias:m}=await lo({...r,tsconfig:s,cwd:e,existingConfig:n}),h=oo({...i,tailwind:{css:l,baseColor:c.baseColor},aliases:{utils:u,lib:d,components:f,hooks:p,ui:m},style:c.style,iconLibrary:c.iconLibrary,menuColor:c.menuColor,menuAccent:c.menuAccent}),g;return g=n?n.style!==c.style||n.menuColor!==c.menuColor||n.menuAccent!==c.menuAccent:!1,{resolvedConfig:await io(e,h),decidedPresets:c,styleChanged:g}}async function ol({cwd:e,config:t,decidedPresets:n,options:r,styleChanged:i}){r.proxy!==void 0&&(T.env.HTTP_PROXY=r.proxy,z.info(`You are using the provided proxy: ${M.default.green(r.proxy)}`));let a=[];a.push({title:`Creating config file`,async task(){return fo(e,t),`Config file ${P(`components.json`)} created`}}),a.push({title:`Validating alias paths`,async task(){for(let[e,n]of Object.entries(t.resolvedPaths)){let t=E.extname(n)?E.dirname(n):n;e===`utils`&&n.endsWith(`/utils`)&&(t=t.replace(/\/utils$/,``)),!O(t)&&e!==`utils`&&await k.mkdir(t,{recursive:!0})}return`Alias paths validated`}}),await Ya(a);let o=ho(t),s=re(n),c=new URL(`/init?preset=${s}`,o).toString(),l=[],u=r.overwrite;if(i&&(l=(await Gr({registryIndex:await _o(o),config:t})).filter(e=>e.name!==`utils`).map(e=>e.name),l.length>0&&!u)){z.warn(`The registry style has changed to ${M.default.bold(M.default.yellow(n.style))}.`);let e=await Na({message:`Would you like to ${M.default.bold(M.default.red(`overwrite`))} your existing components?`,initialValue:!0});I(e)&&B(),u=e}let d=await Wo({selectedItems:[c,...l],config:t,deps:r.deps,overwrite:u});if(r.deps)await qs({cwd:e,prompt:r.deps,dependencies:Array.from(d.dependencies),devDependencies:Array.from(d.devDependencies)});else if(d.skippedDeps.size){let e=eo([...d.skippedDeps],7);z.warn(`shadcn-svelte has been initialized ${M.default.bold(M.default.red(`without`))} the following ${P(`dependencies`)}:\n${M.default.gray(e)}`)}}const sl=o({all:a(),components:m().array().optional(),cwd:m(),proxy:m().optional(),yes:a(),skipPreflight:a(),deps:a()}),cl=new Ce().command(`update`,{hidden:!0}).description(`update components in your project`).argument(`[components...]`,`name of components`).option(`-c, --cwd <path>`,`the working directory`,T.cwd()).option(`--skip-preflight`,`ignore preflight checks and continue`,!1).option(`--no-deps`,`skips adding & installing package dependencies`).option(`-a, --all`,`update all existing components`,!1).option(`-y, --yes`,`skip confirmation prompt`,!1).option(`--proxy <proxy>`,`fetch components from registry using a proxy`,mo()).action(async(e,t)=>{$a();try{let n=sl.parse({components:e,...t}),r=E.resolve(n.cwd);if(!O(r))throw h(`The path ${M.default.cyan(r)} does not exist. Please try again.`);let i=await ro(r);if(!i)throw h(`Configuration file is missing. Please run ${M.default.green(`init`)} to create a ${P(`components.json`)} file.`);await ll(r,Ys({config:i,cwd:r,skipPreflight:n.skipPreflight}),n),La(`${M.default.green(`Success!`)} Component update completed.`)}catch(e){to(e)}});async function ll(e,t,n){n.proxy!==void 0&&(T.env.HTTP_PROXY=n.proxy,z.info(`You are using the provided proxy: ${M.default.green(n.proxy)}`));let i=n.components,a=ho(t),o=await _o(a),s=await Gr({registryIndex:o,config:t}),c=n.all?s:[];if(c.length===0&&i!==void 0&&(c=s.filter(e=>i.includes(e.name))),c.length===0){let e=await za({message:`Which components would you like to update?`,maxItems:10,options:s.map(e=>({label:e.name,value:e,hint:e.registryDependencies?.length?`also updates: ${e.registryDependencies.join(`, `)}`:void 0}))});I(e)&&B(),c=e}else{let e=eo(c.map(({name:e})=>e));z.step(`Components to update:\n${M.default.gray(e)}`)}if(n.yes===!1){let e=await Na({message:`Ready to update ${P(`components`)}? ${M.default.gray(`(Make sure you have committed your changes before proceeding!)`)}`,initialValue:!0});(I(e)||e===!1)&&B()}let l=[],u=await bo({baseUrl:a,items:await yo({registryUrl:a,registryIndex:o,items:c.map(e=>e.name)})});u.sort((e,t)=>e.name.localeCompare(t.name));let d={},f=new Set,p=new Set,m=[],h={},g={};for(let e of u){let i=So(t,e.type);e.dependencies?.forEach(e=>f.add(e)),e.devDependencies?.forEach(e=>p.add(e)),e.type===`registry:font`&&m.push({name:e.name,...e.font}),l.push({title:`Updating ${P(e.name)}`,async task(){for(let n of e.files??[]){let i=Co(t,e,n),{content:a,dependencies:o,devDependencies:s,filePath:c}=await ve({content:n.content,filePath:i,config:t},[ge,v,_e,t.typescript&&r]);o?.forEach(e=>f.add(e)),s?.forEach(e=>p.add(e));let l=E.parse(c).dir;O(l)||await k.mkdir(l,{recursive:!0}),await k.writeFile(c,a,`utf8`)}e.css&&(g=(0,wo.default)(g,e.css)),e.cssVars&&(h=(0,wo.default)(h,e.cssVars));let a=E.resolve(i,e.name);if(e.files&&e.files?.length>1){let n=e.files.map(n=>{let r=Co(t,e,n);return!t.typescript&&r.endsWith(`.ts`)?r.replace(`.ts`,`.js`):r}),r=(await k.readdir(a,{withFileTypes:!0})).map(e=>E.resolve(e.parentPath,e.name)).filter(e=>!n.includes(e));r.length>0&&(d[e.name]=r)}let o=E.relative(n.cwd,a);return`${P(e.name)} updated at ${M.default.gray(o)}`}})}let{css:_,cssVars:y,dependencies:b}=Ho(m);if(g=(0,wo.default)(g,_),h=(0,wo.default)(h,y),b.forEach(e=>p.add(e)),(Object.keys(h).length>0||Object.keys(g).length>0)&&l.push({title:`Updating stylesheet`,async task(){let n=t.resolvedPaths.tailwindCss,r=Vo(await k.readFile(n,`utf8`),{css:g,cssVars:h});await k.writeFile(n,r,`utf8`);let i=E.relative(e,n);return`${P(`Stylesheet`)} updated at ${M.default.dim(i)}`}}),await Ya(l),n.deps)await qs({cwd:e,dependencies:Array.from(f),devDependencies:Array.from(p),prompt:!0});else if(f.size>0||p.size>0){let e=eo([...f,...p],7);z.warn(`Components have been updated ${M.default.bold(M.default.red(`without`))} the following ${P(`dependencies`)}:\n${M.default.gray(e)}`)}for(let[t,n]of Object.entries(d))z.warn(`The ${P(t)} component does not use the following files:\n${n.map(t=>M.default.white(`- ${M.default.gray(E.relative(e,t))}`)).join(`
|
|
138
|
+
`)){if(/^\s*#/.test(t))continue;let e=/^\s*root\s*=\s*(?<mountPoint>"[^"]*"|'[^']*'|[^#]*)/.exec(t);if(e)return e.groups.mountPoint.trim().replaceAll(/^["']|["']$/g,``)}}const hc=We(et.execFile),gc=(()=>{let e=`/mnt/`,t;return async function(){if(t)return t;let n=`/etc/wsl.conf`,r=!1;try{await He.access(n,Ue.F_OK),r=!0}catch{}if(!r)return e;let i=mc(await He.readFile(n,{encoding:`utf8`}));return i===void 0?e:(t=i,t=t.endsWith(`/`)?t:`${t}/`,t)}})(),_c=uc?async()=>`${await gc()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`:fc;let vc;const yc=async()=>(vc??=(async()=>{try{let e=await _c();return await He.access(e,Ue.X_OK),!0}catch{return!1}})(),vc),bc=async()=>{let e=await _c(),{stdout:t}=await pc(String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,{powerShellPath:e});return t.trim()},xc=async e=>{if(/^[a-z]+:\/\//i.test(e))return e;try{let{stdout:t}=await hc(`wslpath`,[`-aw`,e],{encoding:`utf8`});return t.trim()}catch{return e}};function Sc(e,t,n){let r=n=>Object.defineProperty(e,t,{value:n,enumerable:!0,writable:!0});return Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){let e=n();return r(e),e},set(e){r(e)}}),e}const Cc=We(tt);async function wc(){if(T.platform!==`darwin`)throw Error(`macOS only`);let{stdout:e}=await Cc(`defaults`,[`read`,`com.apple.LaunchServices/com.apple.launchservices.secure`,`LSHandlers`]),t=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(e)?.groups.id??`com.apple.Safari`;return t===`com.apple.safari`?`com.apple.Safari`:t}const Tc=We(tt);async function Ec(e,{humanReadableOutput:t=!0,signal:n}={}){if(T.platform!==`darwin`)throw Error(`macOS only`);let r=t?[]:[`-ss`],i={};n&&(i.signal=n);let{stdout:a}=await Tc(`osascript`,[`-e`,e,r],i);return a.trim()}async function Dc(e){return Ec(`tell application "Finder" to set app_path to application file id "${e}" as string\ntell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}const Oc=We(tt),kc={MSEdgeHTM:{name:`Edge`,id:`com.microsoft.edge`},MSEdgeBHTML:{name:`Edge Beta`,id:`com.microsoft.edge.beta`},MSEdgeDHTML:{name:`Edge Dev`,id:`com.microsoft.edge.dev`},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:`Edge`,id:`com.microsoft.edge.old`},ChromeHTML:{name:`Chrome`,id:`com.google.chrome`},ChromeBHTML:{name:`Chrome Beta`,id:`com.google.chrome.beta`},ChromeDHTML:{name:`Chrome Dev`,id:`com.google.chrome.dev`},ChromiumHTM:{name:`Chromium`,id:`org.chromium.Chromium`},BraveHTML:{name:`Brave`,id:`com.brave.Browser`},BraveBHTML:{name:`Brave Beta`,id:`com.brave.Browser.beta`},BraveDHTML:{name:`Brave Dev`,id:`com.brave.Browser.dev`},BraveSSHTM:{name:`Brave Nightly`,id:`com.brave.Browser.nightly`},FirefoxURL:{name:`Firefox`,id:`org.mozilla.firefox`},OperaStable:{name:`Opera`,id:`com.operasoftware.Opera`},VivaldiHTM:{name:`Vivaldi`,id:`com.vivaldi.Vivaldi`},"IE.HTTP":{name:`Internet Explorer`,id:`com.microsoft.ie`}},Ac=new Map(Object.entries(kc));var jc=class extends Error{};async function Mc(e=Oc){let{stdout:t}=await e(`reg`,[`QUERY`,` HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice`,`/v`,`ProgId`]),n=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(t);if(!n)throw new jc(`Cannot find Windows browser in stdout: ${JSON.stringify(t)}`);let{id:r}=n.groups,i=r.lastIndexOf(`.`),a=r.lastIndexOf(`-`),o=i===-1?void 0:r.slice(0,i),s=a===-1?void 0:r.slice(0,a);return kc[r]??kc[o]??kc[s]??{name:r,id:r}}const Nc=We(tt),Pc=e=>e.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase());async function Fc(){if(T.platform===`darwin`){let e=await wc();return{name:await Dc(e),id:e}}if(T.platform===`linux`){let{stdout:e}=await Nc(`xdg-mime`,[`query`,`default`,`x-scheme-handler/http`]),t=e.trim();return{name:Pc(t.replace(/.desktop$/,``).replace(`-`,` `)),id:t}}if(T.platform===`win32`)return Mc();throw Error(`Only macOS, Linux, and Windows are supported`)}var Ic=!!(T.env.SSH_CONNECTION||T.env.SSH_CLIENT||T.env.SSH_TTY);const Lc=Symbol(`fallbackAttempt`),Rc=import.meta.url?E.dirname(Me(import.meta.url)):``,zc=E.join(Rc,`xdg-open`),{platform:Bc,arch:Vc}=T,Hc=async(e,t)=>{if(e.length===0)return;let n=[];for(let r of e)try{return await t(r)}catch(e){n.push(e)}throw AggregateError(n,`Failed to open in all supported apps`)},Uc=async e=>{e={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...e};let t=e[Lc]===!0;if(delete e[Lc],Array.isArray(e.app))return Hc(e.app,t=>Uc({...e,app:t,[Lc]:!0}));let{name:n,arguments:r=[]}=e.app??{};if(r=[...r],Array.isArray(n))return Hc(n,t=>Uc({...e,app:{name:t,arguments:r},[Lc]:!0}));if(n===`browser`||n===`browserPrivate`){let t={"com.google.chrome":`chrome`,"google-chrome.desktop":`chrome`,"com.brave.browser":`brave`,"org.mozilla.firefox":`firefox`,"firefox.desktop":`firefox`,"com.microsoft.msedge":`edge`,"com.microsoft.edge":`edge`,"com.microsoft.edgemac":`edge`,"microsoft-edge.desktop":`edge`,"com.apple.safari":`safari`},i={chrome:`--incognito`,brave:`--incognito`,firefox:`--private-window`,edge:`--inPrivate`},a;if(uc){let e=await bc();a=Ac.get(e)??{}}else a=await Fc();if(a.id in t){let o=t[a.id.toLowerCase()];if(n===`browserPrivate`){if(o===`safari`)throw Error(`Safari doesn't support opening in private mode via command line`);r.push(i[o])}return Uc({...e,app:{name:qc[o],arguments:r}})}throw Error(`${a.name} is not supported as a default browser`)}let i,a=[],o={},s=!1;if(uc&&!cc()&&!Ic&&!n&&(s=await yc()),Bc===`darwin`)i=`open`,e.wait&&a.push(`--wait-apps`),e.background&&a.push(`--background`),e.newInstance&&a.push(`--new`),n&&a.push(`-a`,n);else if(Bc===`win32`||s){i=await _c(),a.push(...pc.argumentsPrefix),uc||(o.windowsVerbatimArguments=!0),uc&&e.target&&(e.target=await xc(e.target));let t=[`$ProgressPreference = 'SilentlyContinue';`,`Start`];e.wait&&t.push(`-Wait`),n?(t.push(pc.escapeArgument(n)),e.target&&r.push(e.target)):e.target&&t.push(pc.escapeArgument(e.target)),r.length>0&&(r=r.map(e=>pc.escapeArgument(e)),t.push(`-ArgumentList`,r.join(`,`))),e.target=pc.encodeCommand(t.join(` `)),e.wait||(o.stdio=`ignore`)}else{if(n)i=n;else{let e=!Rc||Rc===`/`,t=!1;try{await He.access(zc,Ue.X_OK),t=!0}catch{}i=T.versions.electron??(Bc===`android`||e||!t)?`xdg-open`:zc}r.length>0&&a.push(...r),e.wait||(o.stdio=`ignore`,o.detached=!0)}Bc===`darwin`&&r.length>0&&a.push(`--args`,...r),e.target&&a.push(e.target);let c=et.spawn(i,a,o);return e.wait?new Promise((t,n)=>{c.once(`error`,n),c.once(`close`,r=>{if(!e.allowNonzeroExitCode&&r!==0){n(Error(`Exited with code ${r}`));return}t(c)})}):t?new Promise((e,t)=>{c.once(`error`,t),c.once(`spawn`,()=>{c.once(`close`,n=>{if(c.off(`error`,t),n!==0){t(Error(`Exited with code ${n}`));return}c.unref(),e(c)})})}):(c.unref(),new Promise((e,t)=>{c.once(`error`,t),c.once(`spawn`,()=>{c.off(`error`,t),e(c)})}))},Wc=(e,t)=>{if(typeof e!=`string`)throw TypeError("Expected a `target`");return Uc({...t,target:e})};function Gc(e){if(typeof e==`string`||Array.isArray(e))return e;let{[Vc]:t}=e;if(!t)throw Error(`${Vc} is not supported`);return t}function Kc({[Bc]:e},{wsl:t}={}){if(t&&uc)return Gc(t);if(!e)throw Error(`${Bc} is not supported`);return Gc(e)}const qc={browser:`browser`,browserPrivate:`browserPrivate`};Sc(qc,`chrome`,()=>Kc({darwin:`google chrome`,win32:`chrome`,linux:[`google-chrome`,`google-chrome-stable`,`chromium`,`chromium-browser`]},{wsl:{ia32:`/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe`,x64:[`/mnt/c/Program Files/Google/Chrome/Application/chrome.exe`,`/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe`]}})),Sc(qc,`brave`,()=>Kc({darwin:`brave browser`,win32:`brave`,linux:[`brave-browser`,`brave`]},{wsl:{ia32:`/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe`,x64:[`/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe`,`/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe`]}})),Sc(qc,`firefox`,()=>Kc({darwin:`firefox`,win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:`firefox`},{wsl:`/mnt/c/Program Files/Mozilla Firefox/firefox.exe`})),Sc(qc,`edge`,()=>Kc({darwin:`microsoft edge`,win32:`msedge`,linux:[`microsoft-edge`,`microsoft-edge-dev`]},{wsl:`/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe`})),Sc(qc,`safari`,()=>Kc({darwin:`Safari`}));var Jc=Wc;const Yc={nova:{title:`Nova`,description:`Lucide / Geist`,hint:`Reduced spacing for compact layouts.`,style:`nova`,baseColor:`neutral`,theme:`neutral`,iconLibrary:`lucide`,font:`geist`,menuAccent:`subtle`,menuColor:`default`,radius:`default`},vega:{title:`Vega`,description:`Lucide / Inter`,hint:`The classic shadcn/ui look.`,style:`vega`,baseColor:`neutral`,theme:`neutral`,iconLibrary:`lucide`,font:`inter`,menuAccent:`subtle`,menuColor:`default`,radius:`default`},maia:{title:`Maia`,description:`Hugeicons / Figtree`,hint:`Soft and rounded, with generous spacing.`,style:`maia`,baseColor:`neutral`,theme:`neutral`,iconLibrary:`hugeicons`,font:`figtree`,menuAccent:`subtle`,menuColor:`default`,radius:`default`},lyra:{title:`Lyra`,description:`Phosphor / JetBrains Mono`,hint:`Boxy and sharp. Pairs well with mono fonts.`,style:`lyra`,baseColor:`neutral`,theme:`neutral`,iconLibrary:`phosphor`,font:`jetbrains-mono`,menuAccent:`subtle`,menuColor:`default`,radius:`default`},mira:{title:`Mira`,description:`Hugeicons / Inter`,hint:`Compact. Made for dense interfaces.`,style:`mira`,baseColor:`neutral`,theme:`neutral`,iconLibrary:`hugeicons`,font:`inter`,menuAccent:`subtle`,menuColor:`default`,radius:`default`}};async function Xc(e){let t=await Ka({message:`You didn't provide a preset for the design system, how would you like to continue?`,initialValue:e?.style===void 0?`presets`:`prompt`,options:Object.entries(Zc).map(([e,t])=>({label:t.label,value:e}))});return I(t)&&B(),await Zc[t].select(e)}const Zc={presets:{label:`Choose from a list of pre-configured presets`,select:e=>$c(e)},customize:{label:`Create my own preset at ${M.default.bold(`shadcn-svelte.com/create`)}`,select:e=>Qc(e)},prompt:{label:`Prompt me for the preset`,select:e=>el(e)}};async function Qc(e){let t=go(e??ce),n=new URL(`/create`,t).toString(),r=Wa();r.start(`Opening ${M.default.bold(n)} in your browser`),await Jc(n),r.stop(`Opened ${M.default.bold(n)} in your browser`);let i=e=>(e.startsWith(`--preset `)&&(e=e.slice(9)),e),a=await Qa({message:`When you're done, paste the code back here and we'll use it to configure your project.`,placeholder:"Click on the `--preset <code>` button and paste the code here",validate:e=>{if(!ae(i(e??``)))return`Invalid preset code`}});return I(a)&&B(),ee(i(a))}async function $c(e){let t=await Ka({message:`Choose from a list of pre-configured presets`,initialValue:e?.style??`vega`,options:c(Yc).map(([e,t])=>({label:`${t.title} - ${t.description}`,value:e,hint:t.hint}))});return I(t)&&B(),Yc[t]}async function el(e){let t=await Pa({style:()=>Ka({message:`Choose a style`,initialValue:e?.style??ce.style,options:c(Yc).map(([e,t])=>({label:t.title,value:e,hint:t.hint}))}),radius:()=>Ka({message:`Choose a radius`,initialValue:`default`,options:c(w).map(([e,t])=>({label:`${t.label} ${t.value}`,value:e}))}),baseColor:()=>Ka({message:`Choose a base color`,initialValue:e?.tailwind.baseColor??ce.tailwind.baseColor,options:c(ne).map(([e,t])=>({label:`${En(t.color)(`■`)} ${t.name}`,value:e}))}),theme:({results:e})=>Ka({message:`Choose a theme`,initialValue:e.baseColor,options:c(ie).map(([e,t])=>({label:`${En(t.color)(`■`)} ${t.name}`,value:e}))}),iconLibrary:()=>Ka({message:`Choose an icon library`,initialValue:e?.iconLibrary??ce.iconLibrary,options:c(f).map(([e,t])=>({label:t.title,value:t.name,hint:t.packages.join(`, `)}))}),font:()=>Ka({message:`Choose a font`,initialValue:`inter`,options:te.map(e=>({label:s(e),value:e}))})},{onCancel:()=>B()});return{style:t.style,baseColor:t.baseColor,theme:t.theme,iconLibrary:t.iconLibrary,font:t.font,radius:t.radius,menuColor:e?.menuColor??ce.menuColor,menuAccent:e?.menuAccent??ce.menuAccent}}const tl=vo(),nl=o({cwd:m(),baseColor:m().optional(),preset:m().optional(),css:m().optional(),componentsAlias:m().optional(),utilsAlias:m().optional(),libAlias:m().optional(),hooksAlias:m().optional(),uiAlias:m().optional(),deps:a(),overwrite:a(),proxy:m().optional(),skipPreflight:a()}),rl=new Ce().command(`init`).description(`initialize your project and install dependencies`).option(`--preset <preset>`,`the preset to use`).option(`-c, --cwd <path>`,`the working directory`,T.cwd()).option(`-o, --overwrite`,`overwrite existing files`,!1).option(`--no-deps`,`disable adding & installing dependencies`).option(`--skip-preflight`,`ignore preflight checks and continue`,!1).addOption(new we(`--base-color <name>`,`the base color for the components`).choices(tl.map(e=>e.name))).addOption(new we(`--design-system-url`)).option(`--css <path>`,`path to the global CSS file`).option(`--components-alias <path>`,`import alias for components`).option(`--lib-alias <path>`,`import alias for lib`).option(`--utils-alias <path>`,`import alias for utils`).option(`--hooks-alias <path>`,`import alias for hooks`).option(`--ui-alias <path>`,`import alias for ui`).option(`--proxy <proxy>`,`fetch items from registry using a proxy`,mo()).action(async e=>{$a();let t=nl.parse(e),n=E.resolve(t.cwd);try{if(!O(n))throw h(`The path ${M.default.cyan(n)} does not exist. Please try again.`);let e=null;t.preset!==void 0&&(e=ee(t.preset),e===null&&z.warn(`${M.default.dim(`--preset ${t.preset}`)} is not a valid preset.`)),ec(n,{skipPreflight:t.skipPreflight});let r=ao(n);r&&=Ys({cwd:n,config:r,skipPreflight:t.skipPreflight});let{resolvedConfig:i,decidedPresets:a,styleChanged:o}=await al({cwd:n,presetConfig:e,existingConfig:r,options:t});await ol({cwd:n,config:i,decidedPresets:a,options:t,styleChanged:o}),La(`${M.default.green(`Success!`)} Project initialization completed.`)}catch(e){to(e)}});function il(e,t,n){if(t.css&&!O(E.resolve(e,t.css)))throw h(`The provided global CSS file path ${M.default.cyan(t.css)} does not exist. Please enter a valid path.`);for(let[r,i]of Object.entries(t)){if(!r.endsWith(`Alias`))continue;let t=co({cwd:e,importPath:i,tsconfig:n});if(t)throw h(t)}}async function al({cwd:e,presetConfig:t,existingConfig:n,options:r}){let i=n??structuredClone(ce);await Kr(e);let{cssPath:a,tsconfigPath:o}=Vs(e,{relative:!0}),s;if(n)s=po(e,n);else{if(o)i.typescript=o.includes(`tsconfig`);else{let t=await Qa({message:`Where is your ${P(`tsconfig/jsconfig`)} file?`,placeholder:`tsconfig.json`,validate:t=>{let n=E.resolve(e,t??``);if(!(t&&O(n)))return`"${M.default.bold(t)}" does not exist. Please enter a valid path.`}});I(t)&&B(),i.typescript={config:t}}s=po(e,i)}il(e,r,s);let c=t??await Xc(n),l=r.css;if(l===void 0){let t=ce.tailwind.css,r=await Qa({message:`Where is your ${P(`global CSS`)} file? ${M.default.gray(`(this file will be overwritten)`)}`,initialValue:n?.tailwind.css??a??t,placeholder:a??t,validate:t=>{if(!(t&&O(E.resolve(e,t))))return`"${M.default.bold(t)}" does not exist. Please enter a valid path.`}});I(r)&&B(),l=r}let{utilsAlias:u,libAlias:d,componentAlias:f,hooksAlias:p,uiAlias:m}=await lo({...r,tsconfig:s,cwd:e,existingConfig:n}),h=oo({...i,tailwind:{css:l,baseColor:c.baseColor},aliases:{utils:u,lib:d,components:f,hooks:p,ui:m},style:c.style,iconLibrary:c.iconLibrary,menuColor:c.menuColor,menuAccent:c.menuAccent}),g;return g=n?n.style!==c.style||n.menuColor!==c.menuColor||n.menuAccent!==c.menuAccent:!1,{resolvedConfig:await io(e,h),decidedPresets:c,styleChanged:g}}async function ol({cwd:e,config:t,decidedPresets:n,options:r,styleChanged:i}){r.proxy!==void 0&&(T.env.HTTP_PROXY=r.proxy,z.info(`You are using the provided proxy: ${M.default.green(r.proxy)}`));let a=[];a.push({title:`Creating config file`,async task(){return fo(e,t),`Config file ${P(`components.json`)} created`}}),a.push({title:`Validating alias paths`,async task(){for(let[e,n]of Object.entries(t.resolvedPaths)){let t=E.extname(n)?E.dirname(n):n;e===`utils`&&n.endsWith(`/utils`)&&(t=t.replace(/\/utils$/,``)),!O(t)&&e!==`utils`&&await k.mkdir(t,{recursive:!0})}return`Alias paths validated`}}),await Ya(a);let o=ho(t),s=re(n),c=new URL(`/init?preset=${s}`,o).toString(),l=[],u=r.overwrite;if(i&&(l=(await Gr({registryIndex:await _o(o),config:t})).filter(e=>e.name!==`utils`).map(e=>e.name),l.length>0&&!u)){z.warn(`The registry style has changed to ${M.default.bold(M.default.yellow(n.style))}.`);let e=await Na({message:`Would you like to ${M.default.bold(M.default.red(`overwrite`))} your existing components?`,initialValue:!0});I(e)&&B(),u=e}let d=await Wo({selectedItems:[c,...l],config:t,deps:r.deps,overwrite:u});if(r.deps)await qs({cwd:e,prompt:r.deps,dependencies:Array.from(d.dependencies),devDependencies:Array.from(d.devDependencies)});else if(d.skippedDeps.size){let e=eo([...d.skippedDeps],7);z.warn(`shadcn-svelte has been initialized ${M.default.bold(M.default.red(`without`))} the following ${P(`dependencies`)}:\n${M.default.gray(e)}`)}}const sl=o({all:a(),components:m().array().optional(),cwd:m(),proxy:m().optional(),yes:a(),skipPreflight:a(),deps:a()}),cl=new Ce().command(`update`,{hidden:!0}).description(`update components in your project`).argument(`[components...]`,`name of components`).option(`-c, --cwd <path>`,`the working directory`,T.cwd()).option(`--skip-preflight`,`ignore preflight checks and continue`,!1).option(`--no-deps`,`skips adding & installing package dependencies`).option(`-a, --all`,`update all existing components`,!1).option(`-y, --yes`,`skip confirmation prompt`,!1).option(`--proxy <proxy>`,`fetch components from registry using a proxy`,mo()).action(async(e,t)=>{$a();try{let n=sl.parse({components:e,...t}),r=E.resolve(n.cwd);if(!O(r))throw h(`The path ${M.default.cyan(r)} does not exist. Please try again.`);let i=await ro(r);if(!i)throw h(`Configuration file is missing. Please run ${M.default.green(`init`)} to create a ${P(`components.json`)} file.`);await ll(r,Ys({config:i,cwd:r,skipPreflight:n.skipPreflight}),n),La(`${M.default.green(`Success!`)} Component update completed.`)}catch(e){to(e)}});async function ll(e,t,n){n.proxy!==void 0&&(T.env.HTTP_PROXY=n.proxy,z.info(`You are using the provided proxy: ${M.default.green(n.proxy)}`));let i=n.components,a=ho(t),o=await _o(a),s=await Gr({registryIndex:o,config:t}),c=n.all?s:[];if(c.length===0&&i!==void 0&&(c=s.filter(e=>i.includes(e.name))),c.length===0){let e=await za({message:`Which components would you like to update?`,maxItems:10,options:s.map(e=>({label:e.name,value:e,hint:e.registryDependencies?.length?`also updates: ${e.registryDependencies.join(`, `)}`:void 0}))});I(e)&&B(),c=e}else{let e=eo(c.map(({name:e})=>e));z.step(`Components to update:\n${M.default.gray(e)}`)}if(n.yes===!1){let e=await Na({message:`Ready to update ${P(`components`)}? ${M.default.gray(`(Make sure you have committed your changes before proceeding!)`)}`,initialValue:!0});(I(e)||e===!1)&&B()}let l=[],u=await bo({baseUrl:a,items:await yo({registryUrl:a,registryIndex:o,items:c.map(e=>e.name)})});u.sort((e,t)=>e.name.localeCompare(t.name));let d={},f=new Set,p=new Set,m=[],h={},g={};for(let e of u){let i=So(t,e.type);e.dependencies?.forEach(e=>f.add(e)),e.devDependencies?.forEach(e=>p.add(e)),e.type===`registry:font`&&m.push({name:e.name,...e.font}),l.push({title:`Updating ${P(e.name)}`,async task(){for(let n of e.files??[]){let i=Co(t,e,n),{content:a,dependencies:o,devDependencies:s,filePath:c}=await ve({content:n.content,filePath:i,config:t},[ge,v,_e,!t.typescript&&r]);o?.forEach(e=>f.add(e)),s?.forEach(e=>p.add(e));let l=E.parse(c).dir;O(l)||await k.mkdir(l,{recursive:!0}),await k.writeFile(c,a,`utf8`)}e.css&&(g=(0,wo.default)(g,e.css)),e.cssVars&&(h=(0,wo.default)(h,e.cssVars));let a=E.resolve(i,e.name);if(e.files&&e.files?.length>1){let n=e.files.map(n=>{let r=Co(t,e,n);return!t.typescript&&r.endsWith(`.ts`)?r.replace(`.ts`,`.js`):r}),r=(await k.readdir(a,{withFileTypes:!0})).map(e=>E.resolve(e.parentPath,e.name)).filter(e=>!n.includes(e));r.length>0&&(d[e.name]=r)}let o=E.relative(n.cwd,a);return`${P(e.name)} updated at ${M.default.gray(o)}`}})}let{css:_,cssVars:y,dependencies:b}=Ho(m);if(g=(0,wo.default)(g,_),h=(0,wo.default)(h,y),b.forEach(e=>p.add(e)),(Object.keys(h).length>0||Object.keys(g).length>0)&&l.push({title:`Updating stylesheet`,async task(){let n=t.resolvedPaths.tailwindCss,r=Vo(await k.readFile(n,`utf8`),{css:g,cssVars:h});await k.writeFile(n,r,`utf8`);let i=E.relative(e,n);return`${P(`Stylesheet`)} updated at ${M.default.dim(i)}`}}),await Ya(l),n.deps)await qs({cwd:e,dependencies:Array.from(f),devDependencies:Array.from(p),prompt:!0});else if(f.size>0||p.size>0){let e=eo([...f,...p],7);z.warn(`Components have been updated ${M.default.bold(M.default.red(`without`))} the following ${P(`dependencies`)}:\n${M.default.gray(e)}`)}for(let[t,n]of Object.entries(d))z.warn(`The ${P(t)} component does not use the following files:\n${n.map(t=>M.default.white(`- ${M.default.gray(E.relative(e,t))}`)).join(`
|
|
139
139
|
`)}`);Object.keys(d).length>0&&z.message(M.default.bold(`You may want to delete them.`))}var ul=n({Node:()=>Pu,Parser:()=>K,Position:()=>Hl,SourceLocation:()=>Ul,TokContext:()=>Eu,Token:()=>Od,TokenType:()=>H,defaultOptions:()=>Gl,getLineInfo:()=>Wl,isIdentifierChar:()=>Cl,isIdentifierStart:()=>Sl,isNewLine:()=>Al,keywordTypes:()=>Dl,lineBreak:()=>Ol,lineBreakG:()=>kl,nonASCIIwhitespace:()=>Ml,parse:()=>Nd,parseExpressionAt:()=>Pd,tokContexts:()=>J,tokTypes:()=>W,tokenizer:()=>Fd,version:()=>Md}),dl=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,80,3,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,343,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,726,6,110,6,6,9,4759,9,787719,239],fl=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,2,60,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,42,9,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,496,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],pl=`·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・`,ml=`ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-Ა-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-Ꟑꟑꟓꟕ-ꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ`,hl={3:`abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile`,5:`class enum extends super const export import`,6:`enum`,strict:`implements interface let package private protected public static yield`,strictBind:`eval arguments`},gl=`break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this`,_l={5:gl,"5module":gl+` export import`,6:gl+` const class extends export import super`},vl=/^in(stanceof)?$/,yl=RegExp(`[`+ml+`]`),bl=RegExp(`[`+ml+pl+`]`);function xl(e,t){for(var n=65536,r=0;r<t.length;r+=2){if(n+=t[r],n>e)return!1;if(n+=t[r+1],n>=e)return!0}return!1}function Sl(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&yl.test(String.fromCharCode(e)):t===!1?!1:xl(e,fl)}function Cl(e,t){return e<48?e===36:e<58?!0:e<65?!1:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&bl.test(String.fromCharCode(e)):t===!1?!1:xl(e,fl)||xl(e,dl)}var H=function(e,t){t===void 0&&(t={}),this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop||null,this.updateContext=null};function wl(e,t){return new H(e,{beforeExpr:!0,binop:t})}var Tl={beforeExpr:!0},El={startsExpr:!0},Dl={};function U(e,t){return t===void 0&&(t={}),t.keyword=e,Dl[e]=new H(e,t)}var W={num:new H(`num`,El),regexp:new H(`regexp`,El),string:new H(`string`,El),name:new H(`name`,El),privateId:new H(`privateId`,El),eof:new H(`eof`),bracketL:new H(`[`,{beforeExpr:!0,startsExpr:!0}),bracketR:new H(`]`),braceL:new H(`{`,{beforeExpr:!0,startsExpr:!0}),braceR:new H(`}`),parenL:new H(`(`,{beforeExpr:!0,startsExpr:!0}),parenR:new H(`)`),comma:new H(`,`,Tl),semi:new H(`;`,Tl),colon:new H(`:`,Tl),dot:new H(`.`),question:new H(`?`,Tl),questionDot:new H(`?.`),arrow:new H(`=>`,Tl),template:new H(`template`),invalidTemplate:new H(`invalidTemplate`),ellipsis:new H(`...`,Tl),backQuote:new H("`",El),dollarBraceL:new H("${",{beforeExpr:!0,startsExpr:!0}),eq:new H(`=`,{beforeExpr:!0,isAssign:!0}),assign:new H(`_=`,{beforeExpr:!0,isAssign:!0}),incDec:new H(`++/--`,{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new H(`!/~`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:wl(`||`,1),logicalAND:wl(`&&`,2),bitwiseOR:wl(`|`,3),bitwiseXOR:wl(`^`,4),bitwiseAND:wl(`&`,5),equality:wl(`==/!=/===/!==`,6),relational:wl(`</>/<=/>=`,7),bitShift:wl(`<</>>/>>>`,8),plusMin:new H(`+/-`,{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:wl(`%`,10),star:wl(`*`,10),slash:wl(`/`,10),starstar:new H(`**`,{beforeExpr:!0}),coalesce:wl(`??`,1),_break:U(`break`),_case:U(`case`,Tl),_catch:U(`catch`),_continue:U(`continue`),_debugger:U(`debugger`),_default:U(`default`,Tl),_do:U(`do`,{isLoop:!0,beforeExpr:!0}),_else:U(`else`,Tl),_finally:U(`finally`),_for:U(`for`,{isLoop:!0}),_function:U(`function`,El),_if:U(`if`),_return:U(`return`,Tl),_switch:U(`switch`),_throw:U(`throw`,Tl),_try:U(`try`),_var:U(`var`),_const:U(`const`),_while:U(`while`,{isLoop:!0}),_with:U(`with`),_new:U(`new`,{beforeExpr:!0,startsExpr:!0}),_this:U(`this`,El),_super:U(`super`,El),_class:U(`class`,El),_extends:U(`extends`,Tl),_export:U(`export`),_import:U(`import`,El),_null:U(`null`,El),_true:U(`true`,El),_false:U(`false`,El),_in:U(`in`,{beforeExpr:!0,binop:7}),_instanceof:U(`instanceof`,{beforeExpr:!0,binop:7}),_typeof:U(`typeof`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:U(`void`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:U(`delete`,{beforeExpr:!0,prefix:!0,startsExpr:!0})},Ol=/\r\n?|\n|\u2028|\u2029/,kl=new RegExp(Ol.source,`g`);function Al(e){return e===10||e===13||e===8232||e===8233}function jl(e,t,n){n===void 0&&(n=e.length);for(var r=t;r<n;r++){var i=e.charCodeAt(r);if(Al(i))return r<n-1&&i===13&&e.charCodeAt(r+1)===10?r+2:r+1}return-1}var Ml=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,G=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,Nl=Object.prototype,Pl=Nl.hasOwnProperty,Fl=Nl.toString,Il=Object.hasOwn||(function(e,t){return Pl.call(e,t)}),Ll=Array.isArray||(function(e){return Fl.call(e)===`[object Array]`}),Rl=Object.create(null);function zl(e){return Rl[e]||(Rl[e]=RegExp(`^(?:`+e.replace(/ /g,`|`)+`)$`))}function Bl(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}var Vl=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,Hl=function(e,t){this.line=e,this.column=t};Hl.prototype.offset=function(e){return new Hl(this.line,this.column+e)};var Ul=function(e,t,n){this.start=t,this.end=n,e.sourceFile!==null&&(this.source=e.sourceFile)};function Wl(e,t){for(var n=1,r=0;;){var i=jl(e,r,t);if(i<0)return new Hl(n,t-r);++n,r=i}}var Gl={ecmaVersion:null,sourceType:`script`,onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},Kl=!1;function ql(e){var t={};for(var n in Gl)t[n]=e&&Il(e,n)?e[n]:Gl[n];if(t.ecmaVersion===`latest`?t.ecmaVersion=1e8:t.ecmaVersion==null?(!Kl&&typeof console==`object`&&console.warn&&(Kl=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
|
|
140
140
|
Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),t.allowReserved??=t.ecmaVersion<5,(!e||e.allowHashBang==null)&&(t.allowHashBang=t.ecmaVersion>=14),Ll(t.onToken)){var r=t.onToken;t.onToken=function(e){return r.push(e)}}return Ll(t.onComment)&&(t.onComment=Jl(t,t.onComment)),t}function Jl(e,t){return function(n,r,i,a,o,s){var c={type:n?`Block`:`Line`,value:r,start:i,end:a};e.locations&&(c.loc=new Ul(this,o,s)),e.ranges&&(c.range=[i,a]),t.push(c)}}var Yl=1,Xl=2,Zl=4,Ql=8,$l=16,eu=32,tu=64,nu=128,ru=256,iu=512,au=Yl|Xl|ru;function ou(e,t){return Xl|(e?Zl:0)|(t?Ql:0)}var su=0,cu=1,lu=2,uu=3,du=4,fu=5,K=function(e,t,n){this.options=e=ql(e),this.sourceFile=e.sourceFile,this.keywords=zl(_l[e.ecmaVersion>=6?6:e.sourceType===`module`?`5module`:5]);var r=``;e.allowReserved!==!0&&(r=hl[e.ecmaVersion>=6?6:e.ecmaVersion===5?5:3],e.sourceType===`module`&&(r+=` await`)),this.reservedWords=zl(r);var i=(r?r+` `:``)+hl.strict;this.reservedWordsStrict=zl(i),this.reservedWordsStrictBind=zl(i+` `+hl.strictBind),this.input=String(t),this.containsEsc=!1,n?(this.pos=n,this.lineStart=this.input.lastIndexOf(`
|
|
141
141
|
`,n-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(Ol).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=W.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=e.sourceType===`module`,this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&e.allowHashBang&&this.input.slice(0,2)===`#!`&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(Yl),this.regexpState=null,this.privateNameStack=[]},pu={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}};K.prototype.parse=function(){var e=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(e)},pu.inFunction.get=function(){return(this.currentVarScope().flags&Xl)>0},pu.inGenerator.get=function(){return(this.currentVarScope().flags&Ql)>0},pu.inAsync.get=function(){return(this.currentVarScope().flags&Zl)>0},pu.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(t&(ru|iu))return!1;if(t&Xl)return(t&Zl)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},pu.allowSuper.get=function(){return(this.currentThisScope().flags&tu)>0||this.options.allowSuperOutsideMethod},pu.allowDirectSuper.get=function(){return(this.currentThisScope().flags&nu)>0},pu.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},pu.allowNewDotTarget.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(t&(ru|iu)||t&Xl&&!(t&$l))return!0}return!1},pu.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&ru)>0},K.extend=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var n=this,r=0;r<e.length;r++)n=e[r](n);return n},K.parse=function(e,t){return new this(t,e).parse()},K.parseExpressionAt=function(e,t,n){var r=new this(n,e,t);return r.nextToken(),r.parseExpression()},K.tokenizer=function(e,t){return new this(t,e)},Object.defineProperties(K.prototype,pu);var mu=K.prototype,hu=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;mu.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){G.lastIndex=e,e+=G.exec(this.input)[0].length;var t=hu.exec(this.input.slice(e));if(!t)return!1;if((t[1]||t[2])===`use strict`){G.lastIndex=e+t[0].length;var n=G.exec(this.input),r=n.index+n[0].length,i=this.input.charAt(r);return i===`;`||i===`}`||Ol.test(n[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(i)||i===`!`&&this.input.charAt(r+1)===`=`)}e+=t[0].length,G.lastIndex=e,e+=G.exec(this.input)[0].length,this.input[e]===`;`&&e++}},mu.eat=function(e){return this.type===e?(this.next(),!0):!1},mu.isContextual=function(e){return this.type===W.name&&this.value===e&&!this.containsEsc},mu.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1},mu.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},mu.canInsertSemicolon=function(){return this.type===W.eof||this.type===W.braceR||Ol.test(this.input.slice(this.lastTokEnd,this.start))},mu.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},mu.semicolon=function(){!this.eat(W.semi)&&!this.insertSemicolon()&&this.unexpected()},mu.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},mu.expect=function(e){this.eat(e)||this.unexpected()},mu.unexpected=function(e){this.raise(e??this.start,`Unexpected token`)};var gu=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};mu.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,`Comma is not permitted after the rest element`);var n=t?e.parenthesizedAssign:e.parenthesizedBind;n>-1&&this.raiseRecoverable(n,t?`Assigning to rvalue`:`Parenthesized pattern`)}},mu.checkExpressionErrors=function(e,t){if(!e)return!1;var n=e.shorthandAssign,r=e.doubleProto;if(!t)return n>=0||r>=0;n>=0&&this.raise(n,`Shorthand property assignments are valid only in destructuring patterns`),r>=0&&this.raiseRecoverable(r,`Redefinition of __proto__ property`)},mu.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,`Yield expression cannot be a default value`),this.awaitPos&&this.raise(this.awaitPos,`Await expression cannot be a default value`)},mu.isSimpleAssignTarget=function(e){return e.type===`ParenthesizedExpression`?this.isSimpleAssignTarget(e.expression):e.type===`Identifier`||e.type===`MemberExpression`};var q=K.prototype;q.parseTopLevel=function(e){var t=Object.create(null);for(e.body||=[];this.type!==W.eof;){var n=this.parseStatement(null,!0,t);e.body.push(n)}if(this.inModule)for(var r=0,i=Object.keys(this.undefinedExports);r<i.length;r+=1){var a=i[r];this.raiseRecoverable(this.undefinedExports[a].start,`Export '`+a+`' is not defined`)}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType=this.options.sourceType,this.finishNode(e,`Program`)};var _u={kind:`loop`},vu={kind:`switch`};q.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual(`let`))return!1;G.lastIndex=this.pos;var t=G.exec(this.input),n=this.pos+t[0].length,r=this.input.charCodeAt(n);if(r===91||r===92)return!0;if(e)return!1;if(r===123||r>55295&&r<56320)return!0;if(Sl(r,!0)){for(var i=n+1;Cl(r=this.input.charCodeAt(i),!0);)++i;if(r===92||r>55295&&r<56320)return!0;var a=this.input.slice(n,i);if(!vl.test(a))return!0}return!1},q.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual(`async`))return!1;G.lastIndex=this.pos;var e=G.exec(this.input),t=this.pos+e[0].length,n;return!Ol.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)===`function`&&(t+8===this.input.length||!(Cl(n=this.input.charCodeAt(t+8))||n>55295&&n<56320))},q.isUsingKeyword=function(e,t){if(this.options.ecmaVersion<17||!this.isContextual(e?`await`:`using`))return!1;G.lastIndex=this.pos;var n=G.exec(this.input),r=this.pos+n[0].length;if(Ol.test(this.input.slice(this.pos,r)))return!1;if(e){var i=r+5,a;if(this.input.slice(r,i)!==`using`||i===this.input.length||Cl(a=this.input.charCodeAt(i))||a>55295&&a<56320)return!1;G.lastIndex=i;var o=G.exec(this.input);if(o&&Ol.test(this.input.slice(i,i+o[0].length)))return!1}if(t){var s=r+2,c;if(this.input.slice(r,s)===`of`&&(s===this.input.length||!Cl(c=this.input.charCodeAt(s))&&!(c>55295&&c<56320)))return!1}var l=this.input.charCodeAt(r);return Sl(l,!0)||l===92},q.isAwaitUsing=function(e){return this.isUsingKeyword(!0,e)},q.isUsing=function(e){return this.isUsingKeyword(!1,e)},q.parseStatement=function(e,t,n){var r=this.type,i=this.startNode(),a;switch(this.isLet(e)&&(r=W._var,a=`let`),r){case W._break:case W._continue:return this.parseBreakContinueStatement(i,r.keyword);case W._debugger:return this.parseDebuggerStatement(i);case W._do:return this.parseDoStatement(i);case W._for:return this.parseForStatement(i);case W._function:return e&&(this.strict||e!==`if`&&e!==`label`)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(i,!1,!e);case W._class:return e&&this.unexpected(),this.parseClass(i,!0);case W._if:return this.parseIfStatement(i);case W._return:return this.parseReturnStatement(i);case W._switch:return this.parseSwitchStatement(i);case W._throw:return this.parseThrowStatement(i);case W._try:return this.parseTryStatement(i);case W._const:case W._var:return a||=this.value,e&&a!==`var`&&this.unexpected(),this.parseVarStatement(i,a);case W._while:return this.parseWhileStatement(i);case W._with:return this.parseWithStatement(i);case W.braceL:return this.parseBlock(!0,i);case W.semi:return this.parseEmptyStatement(i);case W._export:case W._import:if(this.options.ecmaVersion>10&&r===W._import){G.lastIndex=this.pos;var o=G.exec(this.input),s=this.pos+o[0].length,c=this.input.charCodeAt(s);if(c===40||c===46)return this.parseExpressionStatement(i,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||this.raise(this.start,`'import' and 'export' may only appear at the top level`),this.inModule||this.raise(this.start,`'import' and 'export' may appear only with 'sourceType: module'`)),r===W._import?this.parseImport(i):this.parseExport(i,n);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(i,!0,!e);var l=this.isAwaitUsing(!1)?`await using`:this.isUsing(!1)?`using`:null;if(l)return t&&this.options.sourceType===`script`&&this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script`"),l===`await using`&&(this.canAwait||this.raise(this.start,`Await using cannot appear outside of async function`),this.next()),this.next(),this.parseVar(i,!1,l),this.semicolon(),this.finishNode(i,`VariableDeclaration`);var u=this.value,d=this.parseExpression();return r===W.name&&d.type===`Identifier`&&this.eat(W.colon)?this.parseLabeledStatement(i,u,d,e):this.parseExpressionStatement(i,d)}},q.parseBreakContinueStatement=function(e,t){var n=t===`break`;this.next(),this.eat(W.semi)||this.insertSemicolon()?e.label=null:this.type===W.name?(e.label=this.parseIdent(),this.semicolon()):this.unexpected();for(var r=0;r<this.labels.length;++r){var i=this.labels[r];if((e.label==null||i.name===e.label.name)&&(i.kind!=null&&(n||i.kind===`loop`)||e.label&&n))break}return r===this.labels.length&&this.raise(e.start,`Unsyntactic `+t),this.finishNode(e,n?`BreakStatement`:`ContinueStatement`)},q.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,`DebuggerStatement`)},q.parseDoStatement=function(e){return this.next(),this.labels.push(_u),e.body=this.parseStatement(`do`),this.labels.pop(),this.expect(W._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(W.semi):this.semicolon(),this.finishNode(e,`DoWhileStatement`)},q.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual(`await`)?this.lastTokStart:-1;if(this.labels.push(_u),this.enterScope(0),this.expect(W.parenL),this.type===W.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var n=this.isLet();if(this.type===W._var||this.type===W._const||n){var r=this.startNode(),i=n?`let`:this.value;return this.next(),this.parseVar(r,!0,i),this.finishNode(r,`VariableDeclaration`),this.parseForAfterInit(e,r,t)}var a=this.isContextual(`let`),o=!1,s=this.isUsing(!0)?`using`:this.isAwaitUsing(!0)?`await using`:null;if(s){var c=this.startNode();return this.next(),s===`await using`&&this.next(),this.parseVar(c,!0,s),this.finishNode(c,`VariableDeclaration`),this.parseForAfterInit(e,c,t)}var l=this.containsEsc,u=new gu,d=this.start,f=t>-1?this.parseExprSubscripts(u,`await`):this.parseExpression(!0,u);return this.type===W._in||(o=this.options.ecmaVersion>=6&&this.isContextual(`of`))?(t>-1?(this.type===W._in&&this.unexpected(t),e.await=!0):o&&this.options.ecmaVersion>=8&&(f.start===d&&!l&&f.type===`Identifier`&&f.name===`async`?this.unexpected():this.options.ecmaVersion>=9&&(e.await=!1)),a&&o&&this.raise(f.start,`The left-hand side of a for-of loop may not start with 'let'.`),this.toAssignable(f,!1,u),this.checkLValPattern(f),this.parseForIn(e,f)):(this.checkExpressionErrors(u,!0),t>-1&&this.unexpected(t),this.parseFor(e,f))},q.parseForAfterInit=function(e,t,n){return(this.type===W._in||this.options.ecmaVersion>=6&&this.isContextual(`of`))&&t.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===W._in?n>-1&&this.unexpected(n):e.await=n>-1),this.parseForIn(e,t)):(n>-1&&this.unexpected(n),this.parseFor(e,t))},q.parseFunctionStatement=function(e,t,n){return this.next(),this.parseFunction(e,bu|(n?0:xu),!1,t)},q.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement(`if`),e.alternate=this.eat(W._else)?this.parseStatement(`if`):null,this.finishNode(e,`IfStatement`)},q.parseReturnStatement=function(e){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,`'return' outside of function`),this.next(),this.eat(W.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,`ReturnStatement`)},q.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(W.braceL),this.labels.push(vu),this.enterScope(0);for(var t,n=!1;this.type!==W.braceR;)if(this.type===W._case||this.type===W._default){var r=this.type===W._case;t&&this.finishNode(t,`SwitchCase`),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),r?t.test=this.parseExpression():(n&&this.raiseRecoverable(this.lastTokStart,`Multiple default clauses`),n=!0,t.test=null),this.expect(W.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,`SwitchCase`),this.next(),this.labels.pop(),this.finishNode(e,`SwitchStatement`)},q.parseThrowStatement=function(e){return this.next(),Ol.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,`Illegal newline after throw`),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,`ThrowStatement`)};var yu=[];q.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type===`Identifier`;return this.enterScope(t?eu:0),this.checkLValPattern(e,t?du:lu),this.expect(W.parenR),e},q.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===W._catch){var t=this.startNode();this.next(),this.eat(W.parenL)?t.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0)),t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,`CatchClause`)}return e.finalizer=this.eat(W._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,`Missing catch or finally clause`),this.finishNode(e,`TryStatement`)},q.parseVarStatement=function(e,t,n){return this.next(),this.parseVar(e,!1,t,n),this.semicolon(),this.finishNode(e,`VariableDeclaration`)},q.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(_u),e.body=this.parseStatement(`while`),this.labels.pop(),this.finishNode(e,`WhileStatement`)},q.parseWithStatement=function(e){return this.strict&&this.raise(this.start,`'with' in strict mode`),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement(`with`),this.finishNode(e,`WithStatement`)},q.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,`EmptyStatement`)},q.parseLabeledStatement=function(e,t,n,r){for(var i=0,a=this.labels;i<a.length;i+=1)a[i].name===t&&this.raise(n.start,`Label '`+t+`' is already declared`);for(var o=this.type.isLoop?`loop`:this.type===W._switch?`switch`:null,s=this.labels.length-1;s>=0;s--){var c=this.labels[s];if(c.statementStart===e.start)c.statementStart=this.start,c.kind=o;else break}return this.labels.push({name:t,kind:o,statementStart:this.start}),e.body=this.parseStatement(r?r.indexOf(`label`)===-1?r+`label`:r:`label`),this.labels.pop(),e.label=n,this.finishNode(e,`LabeledStatement`)},q.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,`ExpressionStatement`)},q.parseBlock=function(e,t,n){for(e===void 0&&(e=!0),t===void 0&&(t=this.startNode()),t.body=[],this.expect(W.braceL),e&&this.enterScope(0);this.type!==W.braceR;){var r=this.parseStatement(null);t.body.push(r)}return n&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,`BlockStatement`)},q.parseFor=function(e,t){return e.init=t,this.expect(W.semi),e.test=this.type===W.semi?null:this.parseExpression(),this.expect(W.semi),e.update=this.type===W.parenR?null:this.parseExpression(),this.expect(W.parenR),e.body=this.parseStatement(`for`),this.exitScope(),this.labels.pop(),this.finishNode(e,`ForStatement`)},q.parseForIn=function(e,t){var n=this.type===W._in;return this.next(),t.type===`VariableDeclaration`&&t.declarations[0].init!=null&&(!n||this.options.ecmaVersion<8||this.strict||t.kind!==`var`||t.declarations[0].id.type!==`Identifier`)&&this.raise(t.start,(n?`for-in`:`for-of`)+` loop variable declaration may not have an initializer`),e.left=t,e.right=n?this.parseExpression():this.parseMaybeAssign(),this.expect(W.parenR),e.body=this.parseStatement(`for`),this.exitScope(),this.labels.pop(),this.finishNode(e,n?`ForInStatement`:`ForOfStatement`)},q.parseVar=function(e,t,n,r){for(e.declarations=[],e.kind=n;;){var i=this.startNode();if(this.parseVarId(i,n),this.eat(W.eq)?i.init=this.parseMaybeAssign(t):!r&&n===`const`&&!(this.type===W._in||this.options.ecmaVersion>=6&&this.isContextual(`of`))?this.unexpected():!r&&(n===`using`||n===`await using`)&&this.options.ecmaVersion>=17&&this.type!==W._in&&!this.isContextual(`of`)?this.raise(this.lastTokEnd,`Missing initializer in `+n+` declaration`):!r&&i.id.type!==`Identifier`&&!(t&&(this.type===W._in||this.isContextual(`of`)))?this.raise(this.lastTokEnd,`Complex binding patterns require an initialization value`):i.init=null,e.declarations.push(this.finishNode(i,`VariableDeclarator`)),!this.eat(W.comma))break}return e},q.parseVarId=function(e,t){e.id=t===`using`||t===`await using`?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(e.id,t===`var`?cu:lu,!1)};var bu=1,xu=2,Su=4;q.parseFunction=function(e,t,n,r,i){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!r)&&(this.type===W.star&&t&xu&&this.unexpected(),e.generator=this.eat(W.star)),this.options.ecmaVersion>=8&&(e.async=!!r),t&bu&&(e.id=t&Su&&this.type!==W.name?null:this.parseIdent(),e.id&&!(t&xu)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?cu:lu:uu));var a=this.yieldPos,o=this.awaitPos,s=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(ou(e.async,e.generator)),t&bu||(e.id=this.type===W.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,n,!1,i),this.yieldPos=a,this.awaitPos=o,this.awaitIdentPos=s,this.finishNode(e,t&bu?`FunctionDeclaration`:`FunctionExpression`)},q.parseFunctionParams=function(e){this.expect(W.parenL),e.params=this.parseBindingList(W.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},q.parseClass=function(e,t){this.next();var n=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var r=this.enterClassBody(),i=this.startNode(),a=!1;for(i.body=[],this.expect(W.braceL);this.type!==W.braceR;){var o=this.parseClassElement(e.superClass!==null);o&&(i.body.push(o),o.type===`MethodDefinition`&&o.kind===`constructor`?(a&&this.raiseRecoverable(o.start,`Duplicate constructor in the same class`),a=!0):o.key&&o.key.type===`PrivateIdentifier`&&Cu(r,o)&&this.raiseRecoverable(o.key.start,`Identifier '#`+o.key.name+`' has already been declared`))}return this.strict=n,this.next(),e.body=this.finishNode(i,`ClassBody`),this.exitClassBody(),this.finishNode(e,t?`ClassDeclaration`:`ClassExpression`)},q.parseClassElement=function(e){if(this.eat(W.semi))return null;var t=this.options.ecmaVersion,n=this.startNode(),r=``,i=!1,a=!1,o=`method`,s=!1;if(this.eatContextual(`static`)){if(t>=13&&this.eat(W.braceL))return this.parseClassStaticBlock(n),n;this.isClassElementNameStart()||this.type===W.star?s=!0:r=`static`}if(n.static=s,!r&&t>=8&&this.eatContextual(`async`)&&((this.isClassElementNameStart()||this.type===W.star)&&!this.canInsertSemicolon()?a=!0:r=`async`),!r&&(t>=9||!a)&&this.eat(W.star)&&(i=!0),!r&&!a&&!i){var c=this.value;(this.eatContextual(`get`)||this.eatContextual(`set`))&&(this.isClassElementNameStart()?o=c:r=c)}if(r?(n.computed=!1,n.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),n.key.name=r,this.finishNode(n.key,`Identifier`)):this.parseClassElementName(n),t<13||this.type===W.parenL||o!==`method`||i||a){var l=!n.static&&wu(n,`constructor`),u=l&&e;l&&o!==`method`&&this.raise(n.key.start,`Constructor can't have get/set modifier`),n.kind=l?`constructor`:o,this.parseClassMethod(n,i,a,u)}else this.parseClassField(n);return n},q.isClassElementNameStart=function(){return this.type===W.name||this.type===W.privateId||this.type===W.num||this.type===W.string||this.type===W.bracketL||this.type.keyword},q.parseClassElementName=function(e){this.type===W.privateId?(this.value===`constructor`&&this.raise(this.start,`Classes can't have an element named '#constructor'`),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)},q.parseClassMethod=function(e,t,n,r){var i=e.key;e.kind===`constructor`?(t&&this.raise(i.start,`Constructor can't be a generator`),n&&this.raise(i.start,`Constructor can't be an async method`)):e.static&&wu(e,`prototype`)&&this.raise(i.start,`Classes may not have a static property named prototype`);var a=e.value=this.parseMethod(t,n,r);return e.kind===`get`&&a.params.length!==0&&this.raiseRecoverable(a.start,`getter should have no params`),e.kind===`set`&&a.params.length!==1&&this.raiseRecoverable(a.start,`setter should have exactly one param`),e.kind===`set`&&a.params[0].type===`RestElement`&&this.raiseRecoverable(a.params[0].start,`Setter cannot use rest params`),this.finishNode(e,`MethodDefinition`)},q.parseClassField=function(e){return wu(e,`constructor`)?this.raise(e.key.start,`Classes can't have a field named 'constructor'`):e.static&&wu(e,`prototype`)&&this.raise(e.key.start,`Classes can't have a static field named 'prototype'`),this.eat(W.eq)?(this.enterScope(iu|tu),e.value=this.parseMaybeAssign(),this.exitScope()):e.value=null,this.semicolon(),this.finishNode(e,`PropertyDefinition`)},q.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(ru|tu);this.type!==W.braceR;){var n=this.parseStatement(null);e.body.push(n)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,`StaticBlock`)},q.parseClassId=function(e,t){this.type===W.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,lu,!1)):(t===!0&&this.unexpected(),e.id=null)},q.parseClassSuper=function(e){e.superClass=this.eat(W._extends)?this.parseExprSubscripts(null,!1):null},q.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared},q.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,n=e.used;if(this.options.checkPrivateFields)for(var r=this.privateNameStack.length,i=r===0?null:this.privateNameStack[r-1],a=0;a<n.length;++a){var o=n[a];Il(t,o.name)||(i?i.used.push(o):this.raiseRecoverable(o.start,`Private field '#`+o.name+`' must be declared in an enclosing class`))}};function Cu(e,t){var n=t.key.name,r=e[n],i=`true`;return t.type===`MethodDefinition`&&(t.kind===`get`||t.kind===`set`)&&(i=(t.static?`s`:`i`)+t.kind),r===`iget`&&i===`iset`||r===`iset`&&i===`iget`||r===`sget`&&i===`sset`||r===`sset`&&i===`sget`?(e[n]=`true`,!1):r?!0:(e[n]=i,!1)}function wu(e,t){var n=e.computed,r=e.key;return!n&&(r.type===`Identifier`&&r.name===t||r.type===`Literal`&&r.value===t)}q.parseExportAllDeclaration=function(e,t){return this.options.ecmaVersion>=11&&(this.eatContextual(`as`)?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual(`from`),this.type!==W.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,`ExportAllDeclaration`)},q.parseExport=function(e,t){if(this.next(),this.eat(W.star))return this.parseExportAllDeclaration(e,t);if(this.eat(W._default))return this.checkExport(t,`default`,this.lastTokStart),e.declaration=this.parseExportDefaultDeclaration(),this.finishNode(e,`ExportDefaultDeclaration`);if(this.shouldParseExportStatement())e.declaration=this.parseExportDeclaration(e),e.declaration.type===`VariableDeclaration`?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[]);else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual(`from`))this.type!==W.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause());else{for(var n=0,r=e.specifiers;n<r.length;n+=1){var i=r[n];this.checkUnreserved(i.local),this.checkLocalExport(i.local),i.local.type===`Literal`&&this.raise(i.local.start,"A string literal cannot be used as an exported binding without `from`.")}e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[])}this.semicolon()}return this.finishNode(e,`ExportNamedDeclaration`)},q.parseExportDeclaration=function(e){return this.parseStatement(null)},q.parseExportDefaultDeclaration=function(){var e;if(this.type===W._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,bu|Su,!1,e)}else if(this.type===W._class){var n=this.startNode();return this.parseClass(n,`nullableID`)}else{var r=this.parseMaybeAssign();return this.semicolon(),r}},q.checkExport=function(e,t,n){e&&(typeof t!=`string`&&(t=t.type===`Identifier`?t.name:t.value),Il(e,t)&&this.raiseRecoverable(n,`Duplicate export '`+t+`'`),e[t]=!0)},q.checkPatternExport=function(e,t){var n=t.type;if(n===`Identifier`)this.checkExport(e,t,t.start);else if(n===`ObjectPattern`)for(var r=0,i=t.properties;r<i.length;r+=1){var a=i[r];this.checkPatternExport(e,a)}else if(n===`ArrayPattern`)for(var o=0,s=t.elements;o<s.length;o+=1){var c=s[o];c&&this.checkPatternExport(e,c)}else n===`Property`?this.checkPatternExport(e,t.value):n===`AssignmentPattern`?this.checkPatternExport(e,t.left):n===`RestElement`&&this.checkPatternExport(e,t.argument)},q.checkVariableExport=function(e,t){if(e)for(var n=0,r=t;n<r.length;n+=1){var i=r[n];this.checkPatternExport(e,i.id)}},q.shouldParseExportStatement=function(){return this.type.keyword===`var`||this.type.keyword===`const`||this.type.keyword===`class`||this.type.keyword===`function`||this.isLet()||this.isAsyncFunction()},q.parseExportSpecifier=function(e){var t=this.startNode();return t.local=this.parseModuleExportName(),t.exported=this.eatContextual(`as`)?this.parseModuleExportName():t.local,this.checkExport(e,t.exported,t.exported.start),this.finishNode(t,`ExportSpecifier`)},q.parseExportSpecifiers=function(e){var t=[],n=!0;for(this.expect(W.braceL);!this.eat(W.braceR);){if(n)n=!1;else if(this.expect(W.comma),this.afterTrailingComma(W.braceR))break;t.push(this.parseExportSpecifier(e))}return t},q.parseImport=function(e){return this.next(),this.type===W.string?(e.specifiers=yu,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual(`from`),e.source=this.type===W.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,`ImportDeclaration`)},q.parseImportSpecifier=function(){var e=this.startNode();return e.imported=this.parseModuleExportName(),this.eatContextual(`as`)?e.local=this.parseIdent():(this.checkUnreserved(e.imported),e.local=e.imported),this.checkLValSimple(e.local,lu),this.finishNode(e,`ImportSpecifier`)},q.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,lu),this.finishNode(e,`ImportDefaultSpecifier`)},q.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual(`as`),e.local=this.parseIdent(),this.checkLValSimple(e.local,lu),this.finishNode(e,`ImportNamespaceSpecifier`)},q.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===W.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(W.comma)))return e;if(this.type===W.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(W.braceL);!this.eat(W.braceR);){if(t)t=!1;else if(this.expect(W.comma),this.afterTrailingComma(W.braceR))break;e.push(this.parseImportSpecifier())}return e},q.parseWithClause=function(){var e=[];if(!this.eat(W._with))return e;this.expect(W.braceL);for(var t={},n=!0;!this.eat(W.braceR);){if(n)n=!1;else if(this.expect(W.comma),this.afterTrailingComma(W.braceR))break;var r=this.parseImportAttribute(),i=r.key.type===`Identifier`?r.key.name:r.key.value;Il(t,i)&&this.raiseRecoverable(r.key.start,`Duplicate attribute key '`+i+`'`),t[i]=!0,e.push(r)}return e},q.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===W.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!==`never`),this.expect(W.colon),this.type!==W.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,`ImportAttribute`)},q.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===W.string){var e=this.parseLiteral(this.value);return Vl.test(e.value)&&this.raise(e.start,`An export name cannot include a lone surrogate.`),e}return this.parseIdent(!0)},q.adaptDirectivePrologue=function(e){for(var t=0;t<e.length&&this.isDirectiveCandidate(e[t]);++t)e[t].directive=e[t].expression.raw.slice(1,-1)},q.isDirectiveCandidate=function(e){return this.options.ecmaVersion>=5&&e.type===`ExpressionStatement`&&e.expression.type===`Literal`&&typeof e.expression.value==`string`&&(this.input[e.start]===`"`||this.input[e.start]===`'`)};var Tu=K.prototype;Tu.toAssignable=function(e,t,n){if(this.options.ecmaVersion>=6&&e)switch(e.type){case`Identifier`:this.inAsync&&e.name===`await`&&this.raise(e.start,`Cannot use 'await' as identifier inside an async function`);break;case`ObjectPattern`:case`ArrayPattern`:case`AssignmentPattern`:case`RestElement`:break;case`ObjectExpression`:e.type=`ObjectPattern`,n&&this.checkPatternErrors(n,!0);for(var r=0,i=e.properties;r<i.length;r+=1){var a=i[r];this.toAssignable(a,t),a.type===`RestElement`&&(a.argument.type===`ArrayPattern`||a.argument.type===`ObjectPattern`)&&this.raise(a.argument.start,`Unexpected token`)}break;case`Property`:e.kind!==`init`&&this.raise(e.key.start,`Object pattern can't contain getter or setter`),this.toAssignable(e.value,t);break;case`ArrayExpression`:e.type=`ArrayPattern`,n&&this.checkPatternErrors(n,!0),this.toAssignableList(e.elements,t);break;case`SpreadElement`:e.type=`RestElement`,this.toAssignable(e.argument,t),e.argument.type===`AssignmentPattern`&&this.raise(e.argument.start,`Rest elements cannot have a default value`);break;case`AssignmentExpression`:e.operator!==`=`&&this.raise(e.left.end,`Only '=' operator can be used for specifying default value.`),e.type=`AssignmentPattern`,delete e.operator,this.toAssignable(e.left,t);break;case`ParenthesizedExpression`:this.toAssignable(e.expression,t,n);break;case`ChainExpression`:this.raiseRecoverable(e.start,`Optional chaining cannot appear in left-hand side`);break;case`MemberExpression`:if(!t)break;default:this.raise(e.start,`Assigning to rvalue`)}else n&&this.checkPatternErrors(n,!0);return e},Tu.toAssignableList=function(e,t){for(var n=e.length,r=0;r<n;r++){var i=e[r];i&&this.toAssignable(i,t)}if(n){var a=e[n-1];this.options.ecmaVersion===6&&t&&a&&a.type===`RestElement`&&a.argument.type!==`Identifier`&&this.unexpected(a.argument.start)}return e},Tu.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,`SpreadElement`)},Tu.parseRestBinding=function(){var e=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==W.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,`RestElement`)},Tu.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case W.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(W.bracketR,!0,!0),this.finishNode(e,`ArrayPattern`);case W.braceL:return this.parseObj(!0)}return this.parseIdent()},Tu.parseBindingList=function(e,t,n,r){for(var i=[],a=!0;!this.eat(e);)if(a?a=!1:this.expect(W.comma),t&&this.type===W.comma)i.push(null);else if(n&&this.afterTrailingComma(e))break;else if(this.type===W.ellipsis){var o=this.parseRestBinding();this.parseBindingListItem(o),i.push(o),this.type===W.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`),this.expect(e);break}else i.push(this.parseAssignableListItem(r));return i},Tu.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t},Tu.parseBindingListItem=function(e){return e},Tu.parseMaybeDefault=function(e,t,n){if(n||=this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(W.eq))return n;var r=this.startNodeAt(e,t);return r.left=n,r.right=this.parseMaybeAssign(),this.finishNode(r,`AssignmentPattern`)},Tu.checkLValSimple=function(e,t,n){t===void 0&&(t=su);var r=t!==su;switch(e.type){case`Identifier`:this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(r?`Binding `:`Assigning to `)+e.name+` in strict mode`),r&&(t===lu&&e.name===`let`&&this.raiseRecoverable(e.start,`let is disallowed as a lexically bound name`),n&&(Il(n,e.name)&&this.raiseRecoverable(e.start,`Argument name clash`),n[e.name]=!0),t!==fu&&this.declareName(e.name,t,e.start));break;case`ChainExpression`:this.raiseRecoverable(e.start,`Optional chaining cannot appear in left-hand side`);break;case`MemberExpression`:r&&this.raiseRecoverable(e.start,`Binding member expression`);break;case`ParenthesizedExpression`:return r&&this.raiseRecoverable(e.start,`Binding parenthesized expression`),this.checkLValSimple(e.expression,t,n);default:this.raise(e.start,(r?`Binding`:`Assigning to`)+` rvalue`)}},Tu.checkLValPattern=function(e,t,n){switch(t===void 0&&(t=su),e.type){case`ObjectPattern`:for(var r=0,i=e.properties;r<i.length;r+=1){var a=i[r];this.checkLValInnerPattern(a,t,n)}break;case`ArrayPattern`:for(var o=0,s=e.elements;o<s.length;o+=1){var c=s[o];c&&this.checkLValInnerPattern(c,t,n)}break;default:this.checkLValSimple(e,t,n)}},Tu.checkLValInnerPattern=function(e,t,n){switch(t===void 0&&(t=su),e.type){case`Property`:this.checkLValInnerPattern(e.value,t,n);break;case`AssignmentPattern`:this.checkLValPattern(e.left,t,n);break;case`RestElement`:this.checkLValPattern(e.argument,t,n);break;default:this.checkLValPattern(e,t,n)}};var Eu=function(e,t,n,r,i){this.token=e,this.isExpr=!!t,this.preserveSpace=!!n,this.override=r,this.generator=!!i},J={b_stat:new Eu(`{`,!1),b_expr:new Eu(`{`,!0),b_tmpl:new Eu("${",!1),p_stat:new Eu(`(`,!1),p_expr:new Eu(`(`,!0),q_tmpl:new Eu("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new Eu(`function`,!1),f_expr:new Eu(`function`,!0),f_expr_gen:new Eu(`function`,!0,!1,null,!0),f_gen:new Eu(`function`,!1,!1,null,!0)},Du=K.prototype;Du.initialContext=function(){return[J.b_stat]},Du.curContext=function(){return this.context[this.context.length-1]},Du.braceIsBlock=function(e){var t=this.curContext();return t===J.f_expr||t===J.f_stat?!0:e===W.colon&&(t===J.b_stat||t===J.b_expr)?!t.isExpr:e===W._return||e===W.name&&this.exprAllowed?Ol.test(this.input.slice(this.lastTokEnd,this.start)):e===W._else||e===W.semi||e===W.eof||e===W.parenR||e===W.arrow?!0:e===W.braceL?t===J.b_stat:e===W._var||e===W._const||e===W.name?!1:!this.exprAllowed},Du.inGeneratorContext=function(){for(var e=this.context.length-1;e>=1;e--){var t=this.context[e];if(t.token===`function`)return t.generator}return!1},Du.updateContext=function(e){var t,n=this.type;n.keyword&&e===W.dot?this.exprAllowed=!1:(t=n.updateContext)?t.call(this,e):this.exprAllowed=n.beforeExpr},Du.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)},W.parenR.updateContext=W.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var e=this.context.pop();e===J.b_stat&&this.curContext().token===`function`&&(e=this.context.pop()),this.exprAllowed=!e.isExpr},W.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?J.b_stat:J.b_expr),this.exprAllowed=!0},W.dollarBraceL.updateContext=function(){this.context.push(J.b_tmpl),this.exprAllowed=!0},W.parenL.updateContext=function(e){var t=e===W._if||e===W._for||e===W._with||e===W._while;this.context.push(t?J.p_stat:J.p_expr),this.exprAllowed=!0},W.incDec.updateContext=function(){},W._function.updateContext=W._class.updateContext=function(e){e.beforeExpr&&e!==W._else&&!(e===W.semi&&this.curContext()!==J.p_stat)&&!(e===W._return&&Ol.test(this.input.slice(this.lastTokEnd,this.start)))&&!((e===W.colon||e===W.braceL)&&this.curContext()===J.b_stat)?this.context.push(J.f_expr):this.context.push(J.f_stat),this.exprAllowed=!1},W.colon.updateContext=function(){this.curContext().token===`function`&&this.context.pop(),this.exprAllowed=!0},W.backQuote.updateContext=function(){this.curContext()===J.q_tmpl?this.context.pop():this.context.push(J.q_tmpl),this.exprAllowed=!1},W.star.updateContext=function(e){if(e===W._function){var t=this.context.length-1;this.context[t]===J.f_expr?this.context[t]=J.f_expr_gen:this.context[t]=J.f_gen}this.exprAllowed=!0},W.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==W.dot&&(this.value===`of`&&!this.exprAllowed||this.value===`yield`&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var Y=K.prototype;Y.checkPropClash=function(e,t,n){if(!(this.options.ecmaVersion>=9&&e.type===`SpreadElement`)&&!(this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var r=e.key,i;switch(r.type){case`Identifier`:i=r.name;break;case`Literal`:i=String(r.value);break;default:return}var a=e.kind;if(this.options.ecmaVersion>=6){i===`__proto__`&&a===`init`&&(t.proto&&(n?n.doubleProto<0&&(n.doubleProto=r.start):this.raiseRecoverable(r.start,`Redefinition of __proto__ property`)),t.proto=!0);return}i=`$`+i;var o=t[i];o?(a===`init`?this.strict&&o.init||o.get||o.set:o.init||o[a])&&this.raiseRecoverable(r.start,`Redefinition of property`):o=t[i]={init:!1,get:!1,set:!1},o[a]=!0}},Y.parseExpression=function(e,t){var n=this.start,r=this.startLoc,i=this.parseMaybeAssign(e,t);if(this.type===W.comma){var a=this.startNodeAt(n,r);for(a.expressions=[i];this.eat(W.comma);)a.expressions.push(this.parseMaybeAssign(e,t));return this.finishNode(a,`SequenceExpression`)}return i},Y.parseMaybeAssign=function(e,t,n){if(this.isContextual(`yield`)){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var r=!1,i=-1,a=-1,o=-1;t?(i=t.parenthesizedAssign,a=t.trailingComma,o=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new gu,r=!0);var s=this.start,c=this.startLoc;(this.type===W.parenL||this.type===W.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=e===`await`);var l=this.parseMaybeConditional(e,t);if(n&&(l=n.call(this,l,s,c)),this.type.isAssign){var u=this.startNodeAt(s,c);return u.operator=this.value,this.type===W.eq&&(l=this.toAssignable(l,!1,t)),r||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=l.start&&(t.shorthandAssign=-1),this.type===W.eq?this.checkLValPattern(l):this.checkLValSimple(l),u.left=l,this.next(),u.right=this.parseMaybeAssign(e),o>-1&&(t.doubleProto=o),this.finishNode(u,`AssignmentExpression`)}else r&&this.checkExpressionErrors(t,!0);return i>-1&&(t.parenthesizedAssign=i),a>-1&&(t.trailingComma=a),l},Y.parseMaybeConditional=function(e,t){var n=this.start,r=this.startLoc,i=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return i;if(this.eat(W.question)){var a=this.startNodeAt(n,r);return a.test=i,a.consequent=this.parseMaybeAssign(),this.expect(W.colon),a.alternate=this.parseMaybeAssign(e),this.finishNode(a,`ConditionalExpression`)}return i},Y.parseExprOps=function(e,t){var n=this.start,r=this.startLoc,i=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||i.start===n&&i.type===`ArrowFunctionExpression`?i:this.parseExprOp(i,n,r,-1,e)},Y.parseExprOp=function(e,t,n,r,i){var a=this.type.binop;if(a!=null&&(!i||this.type!==W._in)&&a>r){var o=this.type===W.logicalOR||this.type===W.logicalAND,s=this.type===W.coalesce;s&&(a=W.logicalAND.binop);var c=this.value;this.next();var l=this.start,u=this.startLoc,d=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,i),l,u,a,i),f=this.buildBinary(t,n,e,d,c,o||s);return(o&&this.type===W.coalesce||s&&(this.type===W.logicalOR||this.type===W.logicalAND))&&this.raiseRecoverable(this.start,`Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses`),this.parseExprOp(f,t,n,r,i)}return e},Y.buildBinary=function(e,t,n,r,i,a){r.type===`PrivateIdentifier`&&this.raise(r.start,`Private identifier can only be left side of binary expression`);var o=this.startNodeAt(e,t);return o.left=n,o.operator=i,o.right=r,this.finishNode(o,a?`LogicalExpression`:`BinaryExpression`)},Y.parseMaybeUnary=function(e,t,n,r){var i=this.start,a=this.startLoc,o;if(this.isContextual(`await`)&&this.canAwait)o=this.parseAwait(r),t=!0;else if(this.type.prefix){var s=this.startNode(),c=this.type===W.incDec;s.operator=this.value,s.prefix=!0,this.next(),s.argument=this.parseMaybeUnary(null,!0,c,r),this.checkExpressionErrors(e,!0),c?this.checkLValSimple(s.argument):this.strict&&s.operator===`delete`&&Ou(s.argument)?this.raiseRecoverable(s.start,`Deleting local variable in strict mode`):s.operator===`delete`&&ku(s.argument)?this.raiseRecoverable(s.start,`Private fields can not be deleted`):t=!0,o=this.finishNode(s,c?`UpdateExpression`:`UnaryExpression`)}else if(!t&&this.type===W.privateId)(r||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),o=this.parsePrivateIdent(),this.type!==W._in&&this.unexpected();else{if(o=this.parseExprSubscripts(e,r),this.checkExpressionErrors(e))return o;for(;this.type.postfix&&!this.canInsertSemicolon();){var l=this.startNodeAt(i,a);l.operator=this.value,l.prefix=!1,l.argument=o,this.checkLValSimple(o),this.next(),o=this.finishNode(l,`UpdateExpression`)}}if(!n&&this.eat(W.starstar))if(t)this.unexpected(this.lastTokStart);else return this.buildBinary(i,a,o,this.parseMaybeUnary(null,!1,!1,r),`**`,!1);else return o};function Ou(e){return e.type===`Identifier`||e.type===`ParenthesizedExpression`&&Ou(e.expression)}function ku(e){return e.type===`MemberExpression`&&e.property.type===`PrivateIdentifier`||e.type===`ChainExpression`&&ku(e.expression)||e.type===`ParenthesizedExpression`&&ku(e.expression)}Y.parseExprSubscripts=function(e,t){var n=this.start,r=this.startLoc,i=this.parseExprAtom(e,t);if(i.type===`ArrowFunctionExpression`&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==`)`)return i;var a=this.parseSubscripts(i,n,r,!1,t);return e&&a.type===`MemberExpression`&&(e.parenthesizedAssign>=a.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=a.start&&(e.parenthesizedBind=-1),e.trailingComma>=a.start&&(e.trailingComma=-1)),a},Y.parseSubscripts=function(e,t,n,r,i){for(var a=this.options.ecmaVersion>=8&&e.type===`Identifier`&&e.name===`async`&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.potentialArrowAt===e.start,o=!1;;){var s=this.parseSubscript(e,t,n,r,a,o,i);if(s.optional&&(o=!0),s===e||s.type===`ArrowFunctionExpression`){if(o){var c=this.startNodeAt(t,n);c.expression=s,s=this.finishNode(c,`ChainExpression`)}return s}e=s}},Y.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(W.arrow)},Y.parseSubscriptAsyncArrow=function(e,t,n,r){return this.parseArrowExpression(this.startNodeAt(e,t),n,!0,r)},Y.parseSubscript=function(e,t,n,r,i,a,o){var s=this.options.ecmaVersion>=11,c=s&&this.eat(W.questionDot);r&&c&&this.raise(this.lastTokStart,`Optional chaining cannot appear in the callee of new expressions`);var l=this.eat(W.bracketL);if(l||c&&this.type!==W.parenL&&this.type!==W.backQuote||this.eat(W.dot)){var u=this.startNodeAt(t,n);u.object=e,l?(u.property=this.parseExpression(),this.expect(W.bracketR)):this.type===W.privateId&&e.type!==`Super`?u.property=this.parsePrivateIdent():u.property=this.parseIdent(this.options.allowReserved!==`never`),u.computed=!!l,s&&(u.optional=c),e=this.finishNode(u,`MemberExpression`)}else if(!r&&this.eat(W.parenL)){var d=new gu,f=this.yieldPos,p=this.awaitPos,m=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var h=this.parseExprList(W.parenR,this.options.ecmaVersion>=8,!1,d);if(i&&!c&&this.shouldParseAsyncArrow())return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,`Cannot use 'await' as identifier inside an async function`),this.yieldPos=f,this.awaitPos=p,this.awaitIdentPos=m,this.parseSubscriptAsyncArrow(t,n,h,o);this.checkExpressionErrors(d,!0),this.yieldPos=f||this.yieldPos,this.awaitPos=p||this.awaitPos,this.awaitIdentPos=m||this.awaitIdentPos;var g=this.startNodeAt(t,n);g.callee=e,g.arguments=h,s&&(g.optional=c),e=this.finishNode(g,`CallExpression`)}else if(this.type===W.backQuote){(c||a)&&this.raise(this.start,`Optional chaining cannot appear in the tag of tagged template expressions`);var _=this.startNodeAt(t,n);_.tag=e,_.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(_,`TaggedTemplateExpression`)}return e},Y.parseExprAtom=function(e,t,n){this.type===W.slash&&this.readRegexp();var r,i=this.potentialArrowAt===this.start;switch(this.type){case W._super:return this.allowSuper||this.raise(this.start,`'super' keyword outside a method`),r=this.startNode(),this.next(),this.type===W.parenL&&!this.allowDirectSuper&&this.raise(r.start,`super() call outside constructor of a subclass`),this.type!==W.dot&&this.type!==W.bracketL&&this.type!==W.parenL&&this.unexpected(),this.finishNode(r,`Super`);case W._this:return r=this.startNode(),this.next(),this.finishNode(r,`ThisExpression`);case W.name:var a=this.start,o=this.startLoc,s=this.containsEsc,c=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!s&&c.name===`async`&&!this.canInsertSemicolon()&&this.eat(W._function))return this.overrideContext(J.f_expr),this.parseFunction(this.startNodeAt(a,o),0,!1,!0,t);if(i&&!this.canInsertSemicolon()){if(this.eat(W.arrow))return this.parseArrowExpression(this.startNodeAt(a,o),[c],!1,t);if(this.options.ecmaVersion>=8&&c.name===`async`&&this.type===W.name&&!s&&(!this.potentialArrowInForAwait||this.value!==`of`||this.containsEsc))return c=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(W.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(a,o),[c],!0,t)}return c;case W.regexp:var l=this.value;return r=this.parseLiteral(l.value),r.regex={pattern:l.pattern,flags:l.flags},r;case W.num:case W.string:return this.parseLiteral(this.value);case W._null:case W._true:case W._false:return r=this.startNode(),r.value=this.type===W._null?null:this.type===W._true,r.raw=this.type.keyword,this.next(),this.finishNode(r,`Literal`);case W.parenL:var u=this.start,d=this.parseParenAndDistinguishExpression(i,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(d)&&(e.parenthesizedAssign=u),e.parenthesizedBind<0&&(e.parenthesizedBind=u)),d;case W.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(W.bracketR,!0,!0,e),this.finishNode(r,`ArrayExpression`);case W.braceL:return this.overrideContext(J.b_expr),this.parseObj(!1,e);case W._function:return r=this.startNode(),this.next(),this.parseFunction(r,0);case W._class:return this.parseClass(this.startNode(),!1);case W._new:return this.parseNew();case W.backQuote:return this.parseTemplate();case W._import:return this.options.ecmaVersion>=11?this.parseExprImport(n):this.unexpected();default:return this.parseExprAtomDefault()}},Y.parseExprAtomDefault=function(){this.unexpected()},Y.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword import`),this.next(),this.type===W.parenL&&!e)return this.parseDynamicImport(t);if(this.type===W.dot){var n=this.startNodeAt(t.start,t.loc&&t.loc.start);return n.name=`import`,t.meta=this.finishNode(n,`Identifier`),this.parseImportMeta(t)}else this.unexpected()},Y.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(W.parenR)?e.options=null:(this.expect(W.comma),this.afterTrailingComma(W.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(W.parenR)||(this.expect(W.comma),this.afterTrailingComma(W.parenR)||this.unexpected())));else if(!this.eat(W.parenR)){var t=this.start;this.eat(W.comma)&&this.eat(W.parenR)?this.raiseRecoverable(t,`Trailing comma is not allowed in import()`):this.unexpected(t)}return this.finishNode(e,`ImportExpression`)},Y.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!==`meta`&&this.raiseRecoverable(e.property.start,`The only valid meta property for import is 'import.meta'`),t&&this.raiseRecoverable(e.start,`'import.meta' must not contain escaped characters`),this.options.sourceType!==`module`&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(e.start,`Cannot use 'import.meta' outside a module`),this.finishNode(e,`MetaProperty`)},Y.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),t.raw.charCodeAt(t.raw.length-1)===110&&(t.bigint=t.value==null?t.raw.slice(0,-1).replace(/_/g,``):t.value.toString()),this.next(),this.finishNode(t,`Literal`)},Y.parseParenExpression=function(){this.expect(W.parenL);var e=this.parseExpression();return this.expect(W.parenR),e},Y.shouldParseArrow=function(e){return!this.canInsertSemicolon()},Y.parseParenAndDistinguishExpression=function(e,t){var n=this.start,r=this.startLoc,i,a=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var o=this.start,s=this.startLoc,c=[],l=!0,u=!1,d=new gu,f=this.yieldPos,p=this.awaitPos,m;for(this.yieldPos=0,this.awaitPos=0;this.type!==W.parenR;)if(l?l=!1:this.expect(W.comma),a&&this.afterTrailingComma(W.parenR,!0)){u=!0;break}else if(this.type===W.ellipsis){m=this.start,c.push(this.parseParenItem(this.parseRestBinding())),this.type===W.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`);break}else c.push(this.parseMaybeAssign(!1,d,this.parseParenItem));var h=this.lastTokEnd,g=this.lastTokEndLoc;if(this.expect(W.parenR),e&&this.shouldParseArrow(c)&&this.eat(W.arrow))return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=f,this.awaitPos=p,this.parseParenArrowList(n,r,c,t);(!c.length||u)&&this.unexpected(this.lastTokStart),m&&this.unexpected(m),this.checkExpressionErrors(d,!0),this.yieldPos=f||this.yieldPos,this.awaitPos=p||this.awaitPos,c.length>1?(i=this.startNodeAt(o,s),i.expressions=c,this.finishNodeAt(i,`SequenceExpression`,h,g)):i=c[0]}else i=this.parseParenExpression();if(this.options.preserveParens){var _=this.startNodeAt(n,r);return _.expression=i,this.finishNode(_,`ParenthesizedExpression`)}else return i},Y.parseParenItem=function(e){return e},Y.parseParenArrowList=function(e,t,n,r){return this.parseArrowExpression(this.startNodeAt(e,t),n,!1,r)};var Au=[];Y.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword new`);var e=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===W.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name=`new`,e.meta=this.finishNode(t,`Identifier`),this.next();var n=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!==`target`&&this.raiseRecoverable(e.property.start,`The only valid meta property for new is 'new.target'`),n&&this.raiseRecoverable(e.start,`'new.target' must not contain escaped characters`),this.allowNewDotTarget||this.raiseRecoverable(e.start,`'new.target' can only be used in functions and class static block`),this.finishNode(e,`MetaProperty`)}var r=this.start,i=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),r,i,!0,!1),this.eat(W.parenL)?e.arguments=this.parseExprList(W.parenR,this.options.ecmaVersion>=8,!1):e.arguments=Au,this.finishNode(e,`NewExpression`)},Y.parseTemplateElement=function(e){var t=e.isTagged,n=this.startNode();return this.type===W.invalidTemplate?(t||this.raiseRecoverable(this.start,`Bad escape sequence in untagged template literal`),n.value={raw:this.value.replace(/\r\n?/g,`
|
package/dist/preset/index.d.mts
CHANGED
|
@@ -159,7 +159,7 @@ declare const PRESET_RADII: {
|
|
|
159
159
|
readonly value: "0.875rem";
|
|
160
160
|
};
|
|
161
161
|
};
|
|
162
|
-
declare const PRESET_RADII_KEYS: ("default" | "
|
|
162
|
+
declare const PRESET_RADII_KEYS: ("default" | "none" | "small" | "medium" | "large")[];
|
|
163
163
|
declare const PRESET_MENU_ACCENTS: readonly ["subtle", "bold"];
|
|
164
164
|
declare const PRESET_MENU_COLORS: readonly ["default", "inverted", "default-translucent", "inverted-translucent"];
|
|
165
165
|
type PresetConfig = {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as transformMenu, c as transformStripTypes, i as transform, n as Transformer, o as transformImports, r as TransformerResult, s as transformIcons, t as TransformOptions } from "../../index-
|
|
1
|
+
import { a as transformMenu, c as transformStripTypes, i as transform, n as Transformer, o as transformImports, r as TransformerResult, s as transformIcons, t as TransformOptions } from "../../index-Z2_wxLiz.mjs";
|
|
2
2
|
export { TransformOptions, Transformer, TransformerResult, transform, transformIcons, transformImports, transformMenu, transformStripTypes };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { s as transformIcons } from "../../index-
|
|
1
|
+
import { s as transformIcons } from "../../index-Z2_wxLiz.mjs";
|
|
2
2
|
export { transformIcons };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { o as transformImports } from "../../index-
|
|
1
|
+
import { o as transformImports } from "../../index-Z2_wxLiz.mjs";
|
|
2
2
|
export { transformImports };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as transformMenu } from "../../index-
|
|
1
|
+
import { a as transformMenu } from "../../index-Z2_wxLiz.mjs";
|
|
2
2
|
export { transformMenu };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { c as transformStripTypes } from "../../index-
|
|
1
|
+
import { c as transformStripTypes } from "../../index-Z2_wxLiz.mjs";
|
|
2
2
|
export { transformStripTypes };
|