@stacksjs/ts-css 0.3.5 → 0.3.7
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/bin/cli.js +5 -5
- package/dist/bin/cssx.js +55 -55
- package/dist/chunk-1kmkypmr.js +3 -0
- package/dist/chunk-2wsah70r.js +2 -0
- package/dist/{chunk-mz87cw2e.js → chunk-8h5zg4ad.js} +1 -1
- package/dist/chunk-9ep6bwwb.js +2 -0
- package/dist/{chunk-br9jax0b.js → chunk-b44sfqdn.js} +1 -1
- package/dist/chunk-edwg811g.js +2 -0
- package/dist/chunk-exnx4hfp.js +2 -0
- package/dist/chunk-thy3p95k.js +3 -0
- package/dist/chunk-vbjv9wf0.js +3 -0
- package/dist/chunk-y79srf7m.js +3 -0
- package/dist/engine/index.js +23 -23
- package/dist/index.js +1 -1
- package/dist/optimize/index.js +1 -1
- package/dist/parse/index.js +1 -1
- package/dist/select/index.js +1 -1
- package/dist/what/index.js +1 -1
- package/package.json +6 -6
- package/dist/chunk-0h48763m.js +0 -2
- package/dist/chunk-f9gzb0a5.js +0 -3
- package/dist/chunk-genwkevp.js +0 -3
- package/dist/chunk-jj3s4ctf.js +0 -62
package/dist/bin/cssx.js
CHANGED
|
@@ -1,53 +1,23 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
import{existsSync as Me,statSync as W0,watch as Ml}from"fs";import{unlink as K0}from"fs/promises";import{dirname as G0,resolve as ui}from"path";import he from"process";var{Glob:H0}=globalThis.Bun;import{EventEmitter as Dl}from"events";import Ae from"process";import di from"process";import jr from"process";import Et from"process";import ht from"process";import pi from"tty";import Sc,{stdin as lb,stdout as cb}from"process";import{existsSync as Oc}from"fs";import Mr from"fs/promises";import yi from"os";import Fr from"path";import Fe from"process";function Dr(e){return e.replace(/[<[].+/,"").trim()}function jl(e){let t=/<([^>]+)>/g,r=/\[([^\]]+)\]/g,n=[],i=(c)=>{let a=!1,l=c[1];if(l.startsWith("..."))l=l.slice(3),a=!0;else if(l.endsWith("..."))l=l.slice(0,-3),a=!0;return{required:c[0].startsWith("<"),value:l.trim(),variadic:a}},o;while(o=t.exec(e))n.push(i(o));let s;while(s=r.exec(e))n.push(i(s));return n}function Bl(e){let t={alias:{},boolean:[]};for(let[r,n]of e.entries()){if(n.names.length>1)t.alias[n.names[0]]=n.names.slice(1);if(n.isBoolean)if(n.negated){if(!e.some((o,s)=>s!==r&&o.names.some((c)=>n.names.includes(c))&&typeof o.required==="boolean"))t.boolean.push(n.names[0])}else t.boolean.push(n.names[0])}return t}function hi(e){return e.reduce((t,r)=>t.length>=r.length?t:r,"")}function Lr(e,t){return e.length>=t?e:`${e}${" ".repeat(t-e.length)}`}function St(e){return e.replace(/([a-z])-([a-z])/g,(t,r,n)=>r+n.toUpperCase())}function Ul(e,t,r){let n=0,i=t.length,o=e,s;for(;n<i;++n)s=o[t[n]],o=o[t[n]]=n===i-1?r:s!=null?s:!!~t[n+1].indexOf(".")||!(+t[n+1]>-1)?{}:[]}function Vl(e,t){for(let r of Object.keys(t)){let n=t[r];if(e[r]===void 0)continue;if(n.shouldTransform){if(e[r]=Array.prototype.concat.call([],e[r]),typeof n.transformFunction==="function")e[r]=e[r].map(n.transformFunction)}}}function zl(e){let t=/([^\\/]+)$/.exec(e);return t?t[1]:""}function gt(e){return e.split(".").map((t,r)=>r===0?St(t):t).join(".")}class mt extends Error{exitCode=2;isUsageError=!0;usage;constructor(e,t){super(e);if(this.name=this.constructor.name,t!==void 0)this.usage=t;if(typeof Error.captureStackTrace==="function")Error.captureStackTrace(this,this.constructor);else this.stack=Error(e).stack}format(e=!1){if(e&&this.stack)return`${this.message}
|
|
4
|
-
|
|
5
|
-
Stack trace:
|
|
6
|
-
${this.stack}`;return this.message}}function Wl(e){if(e instanceof mt)return!0;return!!e&&typeof e==="object"&&e.name==="ClappError"&&typeof e.message==="string"}function Kl(){let{env:e}=di,{TERM:t,TERM_PROGRAM:r}=e;if(di.platform!=="win32")return t!=="linux";return Boolean(e.WT_SESSION)||Boolean(e.TERMINUS_SUBLIME)||e.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||t==="xterm-256color"||t==="alacritty"||t==="rxvt-unicode"||t==="rxvt-unicode-256color"||e.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var At="\x1B",j=`${At}[`;var gi={to(e,t){if(!t)return`${j}${e+1}G`;return`${j}${t+1};${e+1}H`},move(e,t){let r="";if(e<0)r+=`${j}${-e}D`;else if(e>0)r+=`${j}${e}C`;if(t<0)r+=`${j}${-t}A`;else if(t>0)r+=`${j}${t}B`;return r},up:(e=1)=>`${j}${e}A`,down:(e=1)=>`${j}${e}B`,forward:(e=1)=>`${j}${e}C`,backward:(e=1)=>`${j}${e}D`,nextLine:(e=1)=>`${j}E`.repeat(e),prevLine:(e=1)=>`${j}F`.repeat(e),left:`${j}G`,hide:`${j}?25l`,show:`${j}?25h`,save:`${At}7`,restore:`${At}8`};var Q0={screen:`${j}2J`,up:(e=1)=>`${j}1J`.repeat(e),down:(e=1)=>`${j}J`.repeat(e),line:`${j}2K`,lineEnd:`${j}K`,lineStart:`${j}1K`,lines(e){let t="";for(let r=0;r<e;r++)t+=this.line+(r<e-1?gi.up():"");if(e)t+=gi.left;return t}},eb={screen:`${At}c`};function Gl(e,t){let r=[];for(let n=0;n<=t.length;n++)r[n]=[n];for(let n=0;n<=e.length;n++)r[0][n]=n;for(let n=1;n<=t.length;n++)for(let i=1;i<=e.length;i++)if(t.charAt(n-1)===e.charAt(i-1))r[n][i]=r[n-1][i-1];else r[n][i]=Math.min(r[n-1][i-1]+1,r[n][i-1]+1,r[n-1][i]+1);return r[t.length][e.length]}function bi(e,t,r=2,n=3){return t.map((i)=>({cmd:i,distance:Gl(e,i)})).filter(({distance:i})=>i<=r).sort((i,o)=>i.distance-o.distance).slice(0,n).map(({cmd:i})=>i)}function Hl(e,t={}){let r={_:[]},n=t.alias||{},i=new Set(t.boolean||[]),o={};for(let a of Object.keys(n))for(let l of n[a])o[l]=a;for(let a of i)if(n[a])for(let l of n[a])i.add(l);function s(a,l){if(a===void 0)return l;if(typeof l==="boolean")return l;return Array.isArray(a)?[...a,l]:[a,l]}function c(a,l){let u=o[a]||a,f=s(r[u],l);if(r[u]=f,n[u])for(let d of n[u])r[d]=f;if(o[a]&&n[o[a]])for(let d of n[o[a]])r[d]=f;r[a]=f}for(let a=0;a<e.length;a++){let l=e[a];if(l==="--"){r._.push(...e.slice(a+1));break}if(l.startsWith("--")){let u=l.indexOf("=");if(u!==-1){let f=St(l.slice(2,u)),d=l.slice(u+1);c(f,d)}else{let f=l.slice(2);if(f.startsWith("no-")){let m=St(f.slice(3));c(m,!1);continue}let d=St(f),h=o[d]||d;if(i.has(h)||i.has(d))c(d,!0);else{let m=e[a+1];if(m!==void 0&&!m.startsWith("-"))c(d,m),a++;else c(d,!0)}}}else if(l.startsWith("-")&&l.length>1){let u=l.slice(1);for(let f=0;f<u.length;f++){let d=u[f],h=o[d]||d;if(f===u.length-1&&!i.has(h)&&!i.has(d)){let m=e[a+1];if(m!==void 0&&!m.startsWith("-"))c(d,m),a++;else c(d,!0)}else c(d,!0)}}else r._.push(l)}return r}class xi{rawName;description;name;names;isBoolean;required;config;negated;variadic;constructor(e,t,r){if(this.rawName=e,this.description=t,this.config=Object.assign({},r),e=e.replace(/\.\*/g,""),this.negated=!1,this.variadic=/[<[](?:\.\.\.[^\]>]+|[^\]>]+\.\.\.)[\]>]/.test(e),this.names=Dr(e).split(",").map((n)=>{let i=n.trim().replace(/^-{1,2}/,"");if(i.startsWith("no-"))this.negated=!0,i=i.replace(/^no-/,"");return gt(i)}).sort((n,i)=>n.length>i.length?1:-1),this.name=this.names[this.names.length-1],this.negated&&this.config.default==null)this.config.default=!0;if(e.includes("<"))this.required=!0;else if(e.includes("["))this.required=!1;else this.isBoolean=!0}}var rb=jr.argv,ql=`${jr.platform}-${jr.arch} bun-v${typeof Bun<"u"?Bun.version:"unknown"}`,mi=Et.argv,Yl=`${Et.platform}-${Et.arch} node-${Et.version}`;class Br{rawName;description;config;cli;options;aliasNames;name;namespace;args;commandAction;usageText;versionNumber;examples;helpCallback;globalCommand;beforeHooks;afterHooks;middleware;constructor(e,t,r,n){this.rawName=e,this.description=t,this.config=r,this.cli=n,this.options=[],this.aliasNames=[],this.name=Dr(e);let i=Dr(e),o=i.indexOf(":");if(o>0)this.namespace=i.substring(0,o),this.name=i.substring(o+1);if(this.args=jl(e),this.examples=[],this.beforeHooks=[],this.afterHooks=[],this.middleware=[],!r)this.config={}}usage(e){return this.usageText=e,this}allowUnknownOptions(){return this.config.allowUnknownOptions=!0,this}ignoreOptionDefaultValue(){return this.config.ignoreOptionDefaultValue=!0,this}version(e,t="-v, --version"){return this.versionNumber=e,this.option(t,"Display version number"),this}example(e){return this.examples.push(e),this}option(e,t,r){let n=new xi(e,t,r);return this.options.push(n),this}alias(e){return this.aliasNames.push(e),this}action(e){return this.commandAction=e,this}before(e){return this.beforeHooks.push(e),this}after(e){return this.afterHooks.push(e),this}use(e){return this.middleware.push(e),this}isMatched(e){if(this.aliasNames.includes(e))return!0;if(this.namespace)return`${this.namespace}:${this.name}`===e;return this.name===e}get isDefaultCommand(){return this.name===""||this.aliasNames.includes("!")}get isGlobalCommand(){return this instanceof Ur}get displayName(){return this.namespace?`${this.namespace}:${this.name}`:this.name}hasOption(e){let t=gt(e.split(".")[0]);return!!this.options.find((r)=>r.names.some((n)=>gt(n)===t))}outputHelp(){let{name:e,commands:t}=this.cli,{versionNumber:r,options:n,helpCallback:i}=this.cli.globalCommand,o=[{body:`${e}${r?`/${r}`:""}`}];if(o.push({title:"Usage",body:` $ ${e} ${this.usageText||this.rawName}`}),(this.isGlobalCommand||this.isDefaultCommand)&&t.length>0){let l=hi(t.map((m)=>m.rawName)),u=new Map,f=[];for(let m of t)if(m.namespace){if(!u.has(m.namespace))u.set(m.namespace,[]);u.get(m.namespace).push(m)}else f.push(m);let d="";if(f.sort((m,p)=>m.rawName<p.rawName?-1:m.rawName>p.rawName?1:0),f.length>0)d+=f.map((m)=>` ${Lr(m.rawName,l.length)} ${m.description}`).join(`
|
|
7
|
-
`);let h=Array.from(u.keys()).sort();for(let m of h){let p=u.get(m);if(d.length>0)d+=`
|
|
8
|
-
|
|
9
|
-
`;d+=` ${m}:
|
|
10
|
-
`,d+=p.map((g)=>` ${Lr(g.rawName,l.length-2)} ${g.description}`).join(`
|
|
11
|
-
`)}o.push({title:"Commands",body:d}),o.push({body:`Run \`${e} <command> --help\` for command details.`})}let c=new Set(this.options.flatMap((l)=>l.names)),a=this.isGlobalCommand?n:[...this.options,...(n||[]).filter((l)=>!l.names.some((u)=>c.has(u)))];if(!this.isGlobalCommand&&!this.isDefaultCommand)a=a.filter((l)=>l.name!=="version");if(a.length>0){let l=hi(a.map((u)=>u.rawName));o.push({title:"Options",body:a.map((u)=>` ${Lr(u.rawName,l.length)} ${u.description} ${u.config.default===void 0?"":`(default: ${u.config.default})`}`).join(`
|
|
12
|
-
`)})}if(this.examples.length>0)o.push({title:"Examples",body:this.examples.map((l)=>{if(typeof l==="function")return l(e);return l}).join(`
|
|
13
|
-
`)});if(i)o=i(o)||o;console.log(o.map((l)=>l.title?`${l.title}:
|
|
14
|
-
${l.body}`:l.body).join(`
|
|
15
|
-
|
|
16
|
-
`))}outputVersion(){let{name:e}=this.cli,{versionNumber:t}=this.cli.globalCommand;if(t)console.log(`${e}/${t} ${typeof Bun<"u"?ql:Yl}`)}get usageLine(){return`$ ${this.cli.name} ${this.usageText||this.rawName}`}checkRequiredArgs(){let e=this.args.filter((t)=>t.required).length;if(this.cli.args.length<e){let r=this.args.filter((i)=>i.required).slice(this.cli.args.length),n=r.map((i)=>`<${i.value}>`).join(" ");throw new mt(`Missing required argument${r.length>1?"s":""}: ${n}
|
|
17
|
-
|
|
18
|
-
Run \`${this.cli.name} ${this.rawName} --help\` for usage information.`,this.usageLine)}}checkUnknownOptions(){let{options:e,globalCommand:t}=this.cli;if(!this.config.allowUnknownOptions){for(let r of Object.keys(e))if(r!=="--"&&!this.hasOption(r)&&!t.hasOption(r)){let i=[...t.options,...this.options].flatMap((l)=>l.names),o=gt(r.split(".")[0]),s=r.length>1?`--${r}`:`-${r}`,c=bi(o,i),a=`Unknown option \`${s}\``;if(c.length>0)a+=`
|
|
19
|
-
|
|
20
|
-
Did you mean one of these?`,c.forEach((l)=>{let u=l.length>1?`--${l}`:`-${l}`;a+=`
|
|
21
|
-
\u2022 ${u}`});throw a+=`
|
|
22
|
-
|
|
23
|
-
Run \`${this.cli.name} ${this.rawName} --help\` to see available options.`,new mt(a,this.usageLine)}}}checkOptionValue(){let{options:e,globalCommand:t}=this.cli,r=[...t.options,...this.options];for(let n of r){let i=e[n.name.split(".")[0]];if(n.required){let o=r.some((s)=>s.negated&&s.names.includes(n.name));if(i===!0||i===!1&&!o)throw new mt(`Option \`${n.rawName}\` requires a value.
|
|
24
|
-
|
|
25
|
-
Example: ${this.cli.name} ${this.rawName} ${n.rawName} <value>`,this.usageLine)}}}}class Ur extends Br{constructor(e){super("@@global@@","",{},e)}}var Jl=Br,Te={red:["\x1B[31m","\x1B[39m"],green:["\x1B[32m","\x1B[39m"],blue:["\x1B[34m","\x1B[39m"],yellow:["\x1B[33m","\x1B[39m"],cyan:["\x1B[36m","\x1B[39m"],magenta:["\x1B[35m","\x1B[39m"],white:["\x1B[37m","\x1B[39m"],gray:["\x1B[90m","\x1B[39m"],bgRed:["\x1B[41m","\x1B[49m"],bgGreen:["\x1B[42m","\x1B[49m"],bgBlue:["\x1B[44m","\x1B[49m"],bgYellow:["\x1B[43m","\x1B[49m"],bgCyan:["\x1B[46m","\x1B[49m"],bgMagenta:["\x1B[45m","\x1B[49m"],bold:["\x1B[1m","\x1B[22m"],italic:["\x1B[3m","\x1B[23m"],underline:["\x1B[4m","\x1B[24m"],dim:["\x1B[2m","\x1B[22m"],inverse:["\x1B[7m","\x1B[27m"],hidden:["\x1B[8m","\x1B[28m"],strikethrough:["\x1B[9m","\x1B[29m"]};var ft={primary:"blue",secondary:"cyan",success:"green",warning:"yellow",error:"red",info:"magenta",muted:"gray"};function Xl(){return!0}function Zl(){let e={};e.supportsColor=Xl();function t(n,i=[]){let o=n===""?[]:[...i,n],s=function(a){if(!e.supportsColor)return a;let l="",u="";for(let f of o)if(f in ft&&ft[f]in Te){let d=ft[f];l+=Te[d][0],u=Te[d][1]+u}else if(f in Te)l+=Te[f][0],u=Te[f][1]+u;return l+a+u},c=[...Object.keys(Te),...Object.keys(ft)];for(let a of c)if(!(a in s))Object.defineProperty(s,a,{get(){return t(a,o)}});return s}let r=[...Object.keys(Te),...Object.keys(ft)];for(let n of r)if(!(n in e))Object.defineProperty(e,n,{get(){return t(n)}});return e}var dt=Zl();class Vr extends Dl{name;commands;globalCommand;matchedCommand;matchedCommandName;rawArgs;args;options;showHelpOnExit;showVersionOnExit;enableDidYouMean=!0;signalHandlersSet=!1;isVerbose=!1;isQuiet=!1;isDebug=!1;isNoInteraction=!1;environment;isDryRun=!1;isForce=!1;useEmoji=!0;theme;isNoCache=!1;constructor(e=""){super();this.name=e,this.commands=[],this.rawArgs=[],this.args=[],this.options={},this.globalCommand=new Ur(this),this.globalCommand.usage("<command> [options]")}handleSignals(e){if(this.signalHandlersSet)return this;let t=async(r)=>{if(console.log(`
|
|
26
|
-
|
|
27
|
-
Received ${r}, cleaning up...`),e)try{await e()}catch(n){console.error("Error during cleanup:",n)}Ae.exit(0)};return Ae.on("SIGINT",()=>t("SIGINT")),Ae.on("SIGTERM",()=>t("SIGTERM")),this.signalHandlersSet=!0,this}didYouMean(e=!0){return this.enableDidYouMean=e,this}verbose(){return this.globalCommand.option("-v, --verbose","Enable verbose output"),this}quiet(){return this.globalCommand.option("-q, --quiet","Suppress non-essential output"),this}debug(){return this.globalCommand.option("--debug","Enable debug mode with detailed error information"),this}noInteraction(){return this.globalCommand.option("-n, --no-interaction","Do not ask any interactive questions (for CI/CD)"),this}env(){return this.globalCommand.option("--env <environment>","Target environment (e.g., production, staging, local)"),this}dryRun(){return this.globalCommand.option("--dry-run","Preview actions without executing them"),this}force(){return this.globalCommand.option("-f, --force","Skip confirmation prompts"),this}emoji(){return this.globalCommand.option("--no-emoji","Disable emoji in output"),this}themes(){return this.globalCommand.option("--theme <theme>","Color theme (default, dracula, nord, solarized, monokai)"),this}cache(){return this.globalCommand.option("--no-cache","Disable caching"),this}usage(e){return this.globalCommand.usage(e),this}command(e,t,r){if(!r)r={};let n=new Jl(e,t||"",r,this);return n.globalCommand=this.globalCommand,this.commands.push(n),n}option(e,t,r){return this.globalCommand.option(e,t,r),this}help(e){return this.globalCommand.option("-h, --help","Display this message"),this.globalCommand.helpCallback=e,this.showHelpOnExit=!0,this}version(e,t="-v, --version"){return this.globalCommand.version(e,t),this.showVersionOnExit=!0,this}example(e){return this.globalCommand.example(e),this}outputHelp(){if(this.matchedCommand)this.matchedCommand.outputHelp();else this.globalCommand.outputHelp()}outputVersion(){this.globalCommand.outputVersion()}setParsedInfo({args:e,options:t},r,n){if(this.args=e,this.options=t,r)this.matchedCommand=r;if(n)this.matchedCommandName=n;return this}unsetMatchedCommand(){this.matchedCommand=void 0,this.matchedCommandName=void 0}showCommandNotFound(e){if(console.log(dt.red(`
|
|
28
|
-
\u2717 Command "${e}" not found.
|
|
29
|
-
`)),this.enableDidYouMean){let t=[];for(let n of this.commands){if(n.displayName)t.push(n.displayName);if(n.aliasNames)t.push(...n.aliasNames)}let r=bi(e,t);if(r.length>0)console.log(dt.yellow("Did you mean one of these?")),r.forEach((n)=>console.log(` ${dt.dim("\u2022")} ${this.name} ${n}`)),console.log("")}console.log(dt.dim("Run"),`${this.name} --help`,dt.dim("to see all available commands")),Ae.exit(1)}async parse(e=mi,t={}){let{run:r=!0,exitOnError:n=!1}=t;if(n)try{return await this.parse(e,{run:r})}catch(a){throw this.handleUsageError(a),a}if(this.rawArgs=e,!this.name)this.name=e[1]?zl(e[1]):"cli";let i=!0,o=e.slice(2),s=o[0];if(s&&!s.startsWith("-")){for(let a of this.commands)if(a.isMatched(s)){let l=this.mri(o,a);i=!1;let u={...l,args:l.args.slice(1)};this.setParsedInfo(u,a,s),this.emit(`command:${s}`,a);break}if(i){let a=o[1];if(a&&!a.startsWith("-")){let l=`${s}:${a}`;for(let u of this.commands)if(u.isMatched(l)){let f=this.mri(o,u);i=!1;let d={...f,args:f.args.slice(2)};this.setParsedInfo(d,u,l),this.emit(`command:${l}`,u);break}}}}if(i){for(let a of this.commands)if(a.name===""){i=!1;let l=this.mri(o,a);this.setParsedInfo(l,a),this.emit("command:!",a);break}}if(i){let a=this.mri(e.slice(2));this.setParsedInfo(a)}if(this.options.verbose)this.isVerbose=!0;if(this.options.quiet)this.isQuiet=!0;if(this.options.debug)this.isDebug=!0;if(this.options.noInteraction||this.options.interaction===!1)this.isNoInteraction=!0;if(this.options.env)this.environment=String(this.options.env);if(this.options.dryRun)this.isDryRun=!0;if(this.options.force)this.isForce=!0;if(this.options.noEmoji||this.options.emoji===!1)this.useEmoji=!1;if(this.options.theme)this.theme=String(this.options.theme);if(this.options.noCache||this.options.cache===!1)this.isNoCache=!0;if(this.options.help&&this.showHelpOnExit)this.outputHelp(),r=!1,this.unsetMatchedCommand();if(this.options.version&&this.showVersionOnExit&&this.matchedCommandName==null)this.outputVersion(),r=!1,this.unsetMatchedCommand();let c={args:this.args,options:this.options};if(r)await this.runMatchedCommand();if(!this.matchedCommand&&this.args[0]){if(this.emit("command:*"),!(this.listenerCount("command:*")>0))this.showCommandNotFound(this.args[0])}return c}mri(e,t){let r=[...this.globalCommand.options,...t?t.options:[]],n=Bl(r),i=[],o=e.indexOf("--");if(o>-1)i=e.slice(o+1),e=e.slice(0,o);let s=Hl(e,n),c={_:s._};for(let d of Object.keys(s))if(d!=="_")c[gt(d)]=s[d];let a=c._,l={"--":i},u=t&&t.config.ignoreOptionDefaultValue?t.config.ignoreOptionDefaultValue:this.globalCommand.config.ignoreOptionDefaultValue,f=Object.create(null);for(let d of r){if(!u&&d.config.default!==void 0)for(let h of d.names)l[h]=d.config.default;if(Array.isArray(d.config.type)){if(f[d.name]===void 0)f[d.name]={shouldTransform:!0,transformFunction:d.config.type[0]}}}for(let d of Object.keys(c))if(d!=="_"){let h=d.split(".");Ul(l,h,c[d]),Vl(l,f)}for(let d of r){if(!d.variadic)continue;for(let h of d.names){let m=l[h];if(m===void 0||Array.isArray(m))continue;if(d.config.default!==void 0&&m===d.config.default)continue;l[h]=[m]}}return{args:a,options:l}}async run(e=mi){return this.parse(e,{run:!0,exitOnError:!0})}handleUsageError(e){if(!Wl(e)||e.isUsageError===!1)return;let t=e.message||"command-line error",r=this.name?`${this.name}: `:"",n=/--help/.test(t)?"":e.usage?`
|
|
30
|
-
Usage: ${e.usage}`:`
|
|
31
|
-
Run \`${this.name??"cli"} --help\` for usage.`;Ae.stderr.write(`${r}${t}${n}
|
|
32
|
-
`),Ae.exit(e.exitCode??2)}async runMatchedCommand(){let{args:e,options:t,matchedCommand:r}=this;if(!r||!r.commandAction)return;r.checkUnknownOptions(),r.checkOptionValue(),r.checkRequiredArgs();let n=[];r.args.forEach((c,a)=>{if(c.variadic)n.push(e.slice(a));else n.push(e[a])}),n.push(t);let i={command:r,args:n,options:t};for(let c of r.beforeHooks)await c(i);let o,s=async()=>{let c=r.commandAction.apply(this,n);if(c instanceof Promise)o=await c;else o=c;return o};if(r.middleware.length>0){let c=0,a=async()=>{if(c<r.middleware.length){let l=r.middleware[c++];await l({...i,next:a})}else await s()};await a()}else await s();for(let c of r.afterHooks)await c(i);return o}removeSignalHandlers(){if(!this.signalHandlersSet)return this;return Ae.removeAllListeners("SIGINT"),Ae.removeAllListeners("SIGTERM"),this.signalHandlersSet=!1,this}destroy(){this.removeSignalHandlers(),this.commands=[],this.rawArgs=[],this.args=[],this.options={},this.matchedCommand=void 0,this.matchedCommandName=void 0,this.removeAllListeners()}}class vi{cache;enabled;cleanupInterval=null;hits=0;misses=0;constructor(){this.cache=new Map,this.enabled=!0,this.startCleanupInterval()}startCleanupInterval(){if(this.cleanupInterval)return;this.cleanupInterval=setInterval(()=>{this.cleanup()},30000),this.cleanupInterval.unref()}stopCleanup(){if(this.cleanupInterval)clearInterval(this.cleanupInterval),this.cleanupInterval=null}isEnabled(){return this.enabled}get(e){if(!this.enabled){this.misses++;return}let t=this.cache.get(e);if(!t){this.misses++;return}if(Date.now()-t.timestamp>t.ttl){this.cache.delete(e),this.misses++;return}return this.hits++,t.value}set(e,t,r=5000){if(!this.enabled)return;this.cache.set(e,{value:t,timestamp:Date.now(),ttl:r})}has(e){if(!this.enabled)return!1;let t=this.cache.get(e);if(!t)return!1;if(Date.now()-t.timestamp>t.ttl)return this.cache.delete(e),!1;return!0}delete(e){this.cache.delete(e)}clear(){this.cache.clear()}disable(){this.enabled=!1,this.clear()}enable(){this.enabled=!0}stats(){return{size:this.cache.size,enabled:this.enabled,hits:this.hits,misses:this.misses}}resetStats(){this.hits=0,this.misses=0}keys(){return Array.from(this.cache.keys())}cleanup(){let e=Date.now();for(let[t,r]of this.cache.entries())if(e-r.timestamp>r.ttl)this.cache.delete(t)}destroy(){this.stopCleanup(),this.clear(),this.resetStats()}}var ib=new vi;function Ql(){if("FORCE_COLOR"in ht.env)return ht.env.FORCE_COLOR!=="0";if("NO_COLOR"in ht.env||ht.env.TERM==="dumb")return!1;if(ht.platform==="win32")return!0;return pi.isatty(1)&&pi.isatty(2)}var wi=Ql();function F(e,t){if(!wi)return(r)=>r;return(r)=>e+r+t}var ec=F("\x1B[0m","\x1B[0m"),tc=F("\x1B[31m","\x1B[39m"),rc=F("\x1B[32m","\x1B[39m"),nc=F("\x1B[33m","\x1B[39m"),ic=F("\x1B[34m","\x1B[39m"),oc=F("\x1B[35m","\x1B[39m"),sc=F("\x1B[36m","\x1B[39m"),ac=F("\x1B[37m","\x1B[39m"),lc=F("\x1B[90m","\x1B[39m"),cc=F("\x1B[1m","\x1B[22m"),uc=F("\x1B[3m","\x1B[23m"),fc=F("\x1B[4m","\x1B[24m"),dc=F("\x1B[2m","\x1B[22m"),hc=F("\x1B[7m","\x1B[27m"),gc=F("\x1B[8m","\x1B[28m"),mc=F("\x1B[9m","\x1B[29m"),pc=F("\x1B[41m","\x1B[49m"),yc=F("\x1B[42m","\x1B[49m"),bc=F("\x1B[43m","\x1B[49m"),xc=F("\x1B[44m","\x1B[49m"),vc=F("\x1B[45m","\x1B[49m"),wc=F("\x1B[46m","\x1B[49m"),Cc=F("\x1B[47m","\x1B[49m"),$c=wi,Rc={reset:ec,red:tc,green:rc,yellow:nc,blue:ic,magenta:oc,cyan:sc,white:ac,gray:lc,bold:cc,italic:uc,underline:fc,dim:dc,inverse:hc,hidden:gc,strikethrough:mc,bgRed:pc,bgGreen:yc,bgYellow:bc,bgBlue:xc,bgMagenta:vc,bgCyan:wc,bgWhite:Cc,isColorSupported:$c},kc=Rc,Ec=["up","down","left","right","space","enter","cancel"],ub={actions:new Set(Ec),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"}};var fb=Sc.platform.startsWith("win"),db=Symbol("clapp:cancel");var Ac=Kl();var L=(e,t)=>Ac?e:t,hb=L("\u25C6","*"),gb=L("\u25A0","x"),mb=L("\u25B2","x"),pb=L("\u25C7","o"),yb=L("\u250C","T"),Tc=L("\u2502","|"),bb=L("\u2514","\u2014"),xb=L("\u25CF",">"),vb=L("\u25CB"," "),wb=L("\u25FB","[\u2022]"),Cb=L("\u25FC","[+]"),$b=L("\u25FB","[ ]"),Rb=L("\u25AA","\u2022"),kb=L("\u2500","-"),Sb=L("\u256E","+"),Eb=L("\u251C","+"),Ab=L("\u256F","+"),Tb=L("\u25CF","\u2022"),Nb=L("\u25C6","*"),Ob=L("\u25B2","!"),Ib=L("\u25A0","x");var Pb={light:L("\u2500","-"),heavy:L("\u2501","="),block:L("\u2588","#")};function Nc(){return`${kc.gray(Tc)} `}var _b=Nc();class Ci{configPath;config=null;events=[];retryCount=0;maxRetries=3;retryDelayMs=1000;constructor(){let e=yi.homedir(),t=Fr.join(e,".config","clapp");this.configPath=Fr.join(t,"telemetry.json")}async isEnabled(){if(Fe.env.DO_NOT_TRACK==="1"||Fe.env.DO_NOT_TRACK==="true")return!1;if(Fe.env.NO_TELEMETRY==="1"||Fe.env.NO_TELEMETRY==="true")return!1;return(await this.loadConfig()).enabled}async enable(){let e=await this.loadConfig();if(e.enabled=!0,!e.userId)e.userId=this.generateUserId();await this.saveConfig(e)}async disable(){let e=await this.loadConfig();e.enabled=!1,await this.saveConfig(e)}async track(e,t){if(!await this.isEnabled())return;let n={event:e,...t,timestamp:Date.now(),platform:yi.platform(),nodeVersion:Fe.version};if(this.events.push(n),this.events.length>=10)await this.send()}async trackCommand(e,t){await this.track("command",{command:e,duration:t})}async trackError(e,t){await this.track("error",{error:e,command:t})}async send(){if(!await this.isEnabled()||this.events.length===0)return!0;try{this.events=[],this.retryCount=0;let t=await this.loadConfig();return t.lastSent=Date.now(),await this.saveConfig(t),!0}catch{if(this.retryCount<this.maxRetries){this.retryCount++;let t=this.retryDelayMs*2**(this.retryCount-1);return await this.sleep(t),this.send()}return this.events=[],this.retryCount=0,!1}}async flush(){if(this.events.length===0)return!0;return this.send()}sleep(e){return new Promise((t)=>setTimeout(t,e))}async status(){let e=await this.loadConfig();return{enabled:e.enabled,doNotTrack:Fe.env.DO_NOT_TRACK==="1"||Fe.env.DO_NOT_TRACK==="true",eventsQueued:this.events.length,lastSent:e.lastSent}}async loadConfig(){if(this.config)return this.config;try{if(Oc(this.configPath)){let e=await Mr.readFile(this.configPath,"utf-8");return this.config=JSON.parse(e),this.config}}catch{}return this.config={enabled:!1},this.config}async saveConfig(e){this.config=e;try{let t=Fr.dirname(this.configPath);await Mr.mkdir(t,{recursive:!0}),await Mr.writeFile(this.configPath,JSON.stringify(e,null,2),"utf-8")}catch{}}generateUserId(){let e=Math.random().toString(36).substring(2,15),t=Date.now().toString(36);return`${e}-${t}`}}var Bb=new Ci;var zr="0.3.5";function ge(e){return{prev:null,next:null,data:e}}class oe{head=null;tail=null;cursors=[];allocateCursor(e,t){let r={prev:e,next:t};return this.cursors.push(r),r}releaseCursor(){this.cursors.pop()}updateCursors(e,t,r,n){for(let i of this.cursors){if(i.prev===e)i.prev=t;if(i.next===r)i.next=n}}static createItem(e){return ge(e)}createItem(e){return ge(e)}get isEmpty(){return this.head===null}get first(){return this.head?.data??null}get last(){return this.tail?.data??null}*[Symbol.iterator](){for(let e=this.head;e!=null;e=e.next)yield e.data}fromArray(e){let t=null;this.head=null;for(let r of e){let n=ge(r);if(n.prev=t,t)t.next=n;else this.head=n;t=n}return this.tail=t,this}toArray(){let e=[];for(let t=this.head;t!=null;t=t.next)e.push(t.data);return e}toJSON(){return this.toArray()}forEach(e,t){let r=this.allocateCursor(null,this.head);while(r.next!==null){let n=r.next;r.prev=n,r.next=n.next,e.call(t,n.data,n,this)}this.releaseCursor()}forEachRight(e,t){let r=this.allocateCursor(this.tail,null);while(r.prev!==null){let n=r.prev;r.next=n,r.prev=n.prev,e.call(t,n.data,n,this)}this.releaseCursor()}reduce(e,t){let r=t,n=0;for(let i=this.head;i!=null;i=i.next)r=e(r,i.data,n++,this);return r}some(e){let t=0;for(let r=this.head;r!=null;r=r.next)if(e(r.data,t++,this))return!0;return!1}map(e){let t=new oe,r=null,n=0;for(let i=this.head;i!=null;i=i.next){let o=ge(e(i.data,n++,this));if(o.prev=r,r)r.next=o;else t.head=o;r=o}return t.tail=r,t}filter(e){let t=new oe,r=null,n=0;for(let i=this.head;i!=null;i=i.next)if(e(i.data,n++,this)){let o=ge(i.data);if(o.prev=r,r)r.next=o;else t.head=o;r=o}return t.tail=r,t}clear(){let e=this.head;while(e){let t=e.next;e.prev=null,e.next=null,e=t}this.head=null,this.tail=null}copy(){let e=new oe,t=null;for(let r=this.head;r!=null;r=r.next){let n=ge(r.data);if(n.prev=t,t)t.next=n;else e.head=n;t=n}return e.tail=t,e}prepend(e){return this.insert(e,this.head)}prependData(e){return this.insert(ge(e),this.head)}append(e){return this.insert(e,null)}appendData(e){return this.insert(ge(e),null)}insert(e,t=null){if(t!=null)if(this.updateCursors(t.prev,e,t,e),t.prev===null){if(this.head!==t)throw Error("before doesn't belong to list");this.head=e,t.prev=e,e.next=t,this.updateCursors(null,e,null,null)}else t.prev.next=e,e.prev=t.prev,t.prev=e,e.next=t;else if(this.updateCursors(this.tail,e,null,e),this.tail!==null)this.tail.next=e,e.prev=this.tail,this.tail=e;else this.head=e,this.tail=e;return this}insertData(e,t=null){return this.insert(ge(e),t)}remove(e){if(this.updateCursors(e,e.prev,e,e.next),e.prev!==null)e.prev.next=e.next;else if(this.head===e)this.head=e.next;else throw Error("item doesn't belong to list");if(e.next!==null)e.next.prev=e.prev;else if(this.tail===e)this.tail=e.prev;else throw Error("item doesn't belong to list");return e.prev=null,e.next=null,e}push(e){this.insert(ge(e),null)}pop(){if(this.tail===null)return null;return this.remove(this.tail)}unshift(e){this.prependData(e)}shift(){if(this.head===null)return null;return this.remove(this.head)}prependList(e){return this.insertList(e,this.head)}appendList(e){return this.insertList(e,null)}insertList(e,t=null){if(e.head===null)return this;if(t!==null){if(this.updateCursors(t.prev,e.tail,t,e.head),t.prev!==null)t.prev.next=e.head,e.head.prev=t.prev;else this.head=e.head;t.prev=e.tail,e.tail.next=t}else{if(this.updateCursors(this.tail,e.tail,null,e.head),this.tail!==null)this.tail.next=e.head,e.head.prev=this.tail;else this.head=e.head;this.tail=e.tail}return e.head=null,e.tail=null,this}replace(e,t){if(t instanceof oe)this.insertList(t,e),this.remove(e);else this.insert(t,e),this.remove(e)}}function Y(e){switch(e.type){case"StyleSheet":return te(e.children,"");case"Rule":return`${Y(e.prelude)}{${Y(e.block)}}`;case"Block":return Pc(e.children);case"Atrule":{let t=`@${e.name}`;if(e.prelude){let r=Y(e.prelude);if(r)t+=` ${r}`}if(e.block)t+=`{${Y(e.block)}}`;else t+=";";return t}case"AtrulePrelude":return te(e.children,"");case"SelectorList":return te(e.children,",");case"Selector":return te(e.children,"");case"TypeSelector":return e.name;case"IdSelector":return`#${e.name}`;case"ClassSelector":return`.${e.name}`;case"NestingSelector":return"&";case"AttributeSelector":{let t=`[${e.name.name}`;if(e.matcher&&e.value)if(t+=e.matcher,e.value.type==="String")t+=`"${Wr(e.value.value)}"`;else t+=e.value.name;if(e.flags)t+=` ${e.flags}`;return t+="]",t}case"PseudoClassSelector":return e.children?`:${e.name}(${te(e.children,"")})`:`:${e.name}`;case"PseudoElementSelector":return e.children?`::${e.name}(${te(e.children,"")})`:`::${e.name}`;case"Combinator":return e.name===" "?" ":e.name;case"Declaration":return`${e.property}:${Y(e.value)}${e.important?"!important":""}`;case"DeclarationList":return te(e.children,";");case"Value":return te(e.children,"");case"Identifier":return e.name;case"Number":return e.value;case"Percentage":return`${e.value}%`;case"Dimension":return e.value+e.unit;case"String":return`"${Wr(e.value)}"`;case"Url":return/[\s"'()\\\u0000-\u001F\u007F]/.test(e.value)?`url("${Wr(e.value)}")`:`url(${e.value})`;case"Hash":return`#${e.name}`;case"Operator":return e.value;case"Function":return`${e.name}(${te(e.children,"")})`;case"Parentheses":return`(${te(e.children,"")})`;case"Brackets":return`[${te(e.children,"")}]`;case"Raw":return e.value;case"Comment":return e.value.startsWith("!")?`/*${e.value}*/`:"";case"WhiteSpace":return" ";case"CDO":return"<!--";case"CDC":return"-->";case"AnPlusB":{let t=e.a??"",r=e.b??"";if(t&&r){let n=Number(r);return`${t==="1"?"":t==="-1"?"-":t}n${n>=0?`+${r}`:r}`}if(t)return`${t==="1"?"":t==="-1"?"-":t}n`;return r}case"Ratio":return`${e.left.value}/${e.right.value}`;case"UnicodeRange":return e.value;case"Nth":return e.selector?`${Y(e.nth)} of ${Y(e.selector)}`:Y(e.nth);case"MediaQueryList":return te(e.children,",");case"MediaQuery":return te(e.children,"");case"MediaFeature":{let t=`(${e.name}`;if(e.value)t+=`:${Y(e.value)}`;return t+=")",t}}return""}function te(e,t){let r="",n=!0,i=null,o=e.head;while(o!=null){let s=o.data;if(s.type==="WhiteSpace"){let a=o.next?o.next.data:null;if($i(i)||$i(a)){o=o.next;continue}}let c=Y(s);if(!c){o=o.next;continue}if(!n&&t&&!Lc(i))r+=t;n=!1,r+=c,i=s,o=o.next}return r}function Pc(e){let t="",r=null,n=e.head;while(n!=null){let i=n.data,o=Y(i);if(!o){n=n.next;continue}if(r&&_c(r,i))t+=";";t+=o,r=i,n=n.next}return t}function _c(e,t){return e.type==="Declaration"&&t.type!=="Comment"}function $i(e){if(!e||e.type!=="Operator")return!1;let t=e.value;return t===":"||t===","||t==="/"}function Lc(e){if(!e)return!1;return e.type==="Operator"||e.type==="Combinator"}function Wr(e){let t="";for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(n===92)t+="\\\\";else if(n===34)t+="\\\"";else if(n<32||n===127){let i=n.toString(16),o=r+1<e.length?e.charCodeAt(r+1):-1,s=o===32||o===9||o===10||o===12||o===13||o>=48&&o<=57||o>=65&&o<=70||o>=97&&o<=102;t+=`\\${i}${s?" ":""}`}else t+=e[r]}return t}var je=(()=>{let e=new Uint8Array(128);for(let t=0;t<128;t++){let r=0;if(t===32||t===9||t===10||t===12||t===13)r|=1;if(t>=48&&t<=57)r|=2;if(t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102)r|=4;if(t>=65&&t<=90||t>=97&&t<=122||t===95)r|=8;if(t===10||t===12||t===13)r|=16;e[t]=r}return e})();function le(e){return e<128&&(je[e]&2)!==0}function pt(e){return e<128&&(je[e]&4)!==0}function Ri(e){return e>=128||e<128&&(je[e]&8)!==0}function Mc(e){return e===45||e>=128||e<128&&(je[e]&10)!==0}function Fc(e){return e>=0&&e<=8||e===11||e>=14&&e<=31||e===127}function Gr(e){return e<128&&(je[e]&16)!==0}function xe(e){return e<128&&(je[e]&1)!==0}function De(e,t){if(e!==92)return!1;if(Gr(t))return!1;return!0}function Kr(e,t,r){if(e===45)return Ri(t)||t===45||De(t,r);if(Ri(e))return!0;if(e===92)return De(e,t);return!1}function Dc(e,t,r){if(e===43||e===45){if(le(t))return!0;if(t===46&&le(r))return!0;return!1}if(e===46)return le(t);return le(e)}class Tt{source;offset=0;types;starts;ends;count=0;_tokens=null;_lineStarts=null;constructor(e){this.source=e;let t=Math.max(64,Math.ceil(e.length/3));this.types=new Uint8Array(t),this.starts=new Uint32Array(t),this.ends=new Uint32Array(t),this.tokenize()}get lineStarts(){if(this._lineStarts==null)this._lineStarts=jc(this.source);return this._lineStarts}get tokens(){if(this._tokens!=null)return this._tokens;let e=Array.from({length:this.count});for(let t=0;t<this.count;t++)e[t]={type:this.types[t],start:this.starts[t],end:this.ends[t]};return this._tokens=e,e}addToken(e,t,r){if(this.count>=this.types.length)this.grow();this.types[this.count]=e,this.starts[this.count]=t,this.ends[this.count]=r,this.count++}grow(){let t=this.types.length*2,r=new Uint8Array(t);r.set(this.types),this.types=r;let n=new Uint32Array(t);n.set(this.starts),this.starts=n;let i=new Uint32Array(t);i.set(this.ends),this.ends=i}tokenize(){let e=this.source,t=0,r=e.length;while(t<r){let n=e.charCodeAt(t);if(n===47&&e.charCodeAt(t+1)===42){let s=t;t+=2;while(t<r&&!(e.charCodeAt(t)===42&&e.charCodeAt(t+1)===47))t++;t=t<r?t+2:r,this.addToken(25,s,t);continue}if(xe(n)){let s=t;while(t<r&&xe(e.charCodeAt(t)))t++;this.addToken(13,s,t);continue}if(n===34||n===39){t=this.consumeString(n,t);continue}if(n===35){if(t+1<r&&(Mc(e.charCodeAt(t+1))||De(e.charCodeAt(t+1),e.charCodeAt(t+2)))){let s=t;t++,t=this.consumeName(t),this.addToken(4,s,t);continue}this.addToken(9,t,t+1),t++;continue}switch(n){case 40:this.addToken(21,t,t+1),t++;continue;case 41:this.addToken(22,t,t+1),t++;continue;case 91:this.addToken(19,t,t+1),t++;continue;case 93:this.addToken(20,t,t+1),t++;continue;case 123:this.addToken(23,t,t+1),t++;continue;case 125:this.addToken(24,t,t+1),t++;continue;case 44:this.addToken(18,t,t+1),t++;continue;case 58:this.addToken(16,t,t+1),t++;continue;case 59:this.addToken(17,t,t+1),t++;continue}if(n===60&&e.startsWith("!--",t+1)){this.addToken(14,t,t+4),t+=4;continue}if(n===45&&e.startsWith("->",t+1)){this.addToken(15,t,t+3),t+=3;continue}if(n===64){let s=e.charCodeAt(t+1),c=e.charCodeAt(t+2),a=e.charCodeAt(t+3);if(Kr(s,c,a)){let l=t;t++,t=this.consumeName(t),this.addToken(3,l,t);continue}this.addToken(9,t,t+1),t++;continue}let i=e.charCodeAt(t+1),o=e.charCodeAt(t+2);if(Dc(n,i,o)){t=this.consumeNumeric(t);continue}if(Kr(n,i,o)){t=this.consumeIdentLike(t);continue}if(n===92){if(De(n,i)){t=this.consumeIdentLike(t);continue}this.addToken(9,t,t+1),t++;continue}this.addToken(9,t,t+1),t++}this.addToken(0,r,r)}consumeString(e,t){let r=this.source,n=r.length,i=t+1;while(i<n){let o=r.charCodeAt(i);if(o===e)return i++,this.addToken(5,t,i),i;if(Gr(o))return this.addToken(6,t,i),i;if(o===92){let s=r.charCodeAt(i+1);if(Gr(s)){i+=2;continue}if(i+1<n){i=this.consumeEscapeSkip(i+1);continue}}i++}return this.addToken(5,t,i),i}consumeEscapeSkip(e){let t=this.source;if(e>=t.length)return e;let r=t.charCodeAt(e);if(pt(r)){let n=1;e++;while(n<6&&e<t.length&&pt(t.charCodeAt(e)))e++,n++;if(e<t.length&&xe(t.charCodeAt(e)))e++;return e}return e+1}consumeName(e){let t=this.source,r=t.length,n=e;while(n<r){let i=t.charCodeAt(n);if(i<128&&(je[i]&10)!==0){n++;continue}if(i===45){n++;continue}if(i>=128){n++;continue}if(i===92&&De(i,t.charCodeAt(n+1))){n=this.consumeEscapeSkip(n+1);continue}break}return n}consumeNumber(e){let t=this.source,r=e;if(t.charCodeAt(r)===43||t.charCodeAt(r)===45)r++;while(r<t.length&&le(t.charCodeAt(r)))r++;if(t.charCodeAt(r)===46&&le(t.charCodeAt(r+1))){r+=2;while(r<t.length&&le(t.charCodeAt(r)))r++}let n=t.charCodeAt(r);if(n===69||n===101){let i=t.charCodeAt(r+1),o=t.charCodeAt(r+2);if(le(i)){r+=2;while(r<t.length&&le(t.charCodeAt(r)))r++}else if((i===43||i===45)&&le(o)){r+=3;while(r<t.length&&le(t.charCodeAt(r)))r++}}return r}consumeNumeric(e){let t=this.source,r=this.consumeNumber(e),n=t.charCodeAt(r),i=t.charCodeAt(r+1),o=t.charCodeAt(r+2);if(Kr(n,i,o)){let s=this.consumeName(r);return this.addToken(12,e,s),s}if(n===37)return this.addToken(11,e,r+1),r+1;return this.addToken(10,e,r),r}consumeIdentLike(e){let t=this.source,r=this.consumeName(e),n=t.charCodeAt(r);if(n===40&&r-e===3){let i=t.charCodeAt(e)|32,o=t.charCodeAt(e+1)|32,s=t.charCodeAt(e+2)|32;if(i===117&&o===114&&s===108){let c=r+1;while(c<t.length&&xe(t.charCodeAt(c)))c++;let a=t.charCodeAt(c);if(a===34||a===39)return this.addToken(2,e,r+1),r+1;return this.consumeUrl(e,r)}}if(n===40)return this.addToken(2,e,r+1),r+1;return this.addToken(1,e,r),r}consumeUrl(e,t){let r=this.source,n=r.length,i=t+1;while(i<n&&xe(r.charCodeAt(i)))i++;while(i<n){let o=r.charCodeAt(i);if(o===41)return i++,this.addToken(7,e,i),i;if(xe(o)){let s=i;while(i<n&&xe(r.charCodeAt(i)))i++;if(i>=n)return this.addToken(7,e,i),i;if(r.charCodeAt(i)===41)return i++,this.addToken(7,e,i),i;return this.consumeBadUrl(e,s)}if(o===34||o===39||o===40||Fc(o))return this.consumeBadUrl(e,i);if(o===92){if(De(o,r.charCodeAt(i+1))){i=this.consumeEscapeSkip(i+1);continue}return this.consumeBadUrl(e,i)}i++}return this.addToken(7,e,i),i}consumeBadUrl(e,t){let r=this.source,n=t;while(n<r.length){let i=r.charCodeAt(n);if(i===41){n++;break}if(i===92&&De(i,r.charCodeAt(n+1))){n=this.consumeEscapeSkip(n+1);continue}n++}return this.addToken(8,e,n),n}locate(e){let t=this.lineStarts,r=0,n=t.length-1;while(r<n){let o=r+n+1>>1;if(t[o]<=e)r=o;else n=o-1}let i=t[r];return{line:r+1,column:e-i+1}}}function jc(e){let t=[0],r=e.length;for(let n=0;n<r;n++){let i=e.charCodeAt(n);if(i===10)t.push(n+1);else if(i===13){if(e.charCodeAt(n+1)!==10)t.push(n+1)}}return t}function Hr(e,t,r){for(let n=t;n<r;n++)if(e.charCodeAt(n)===92)return Bc(e,t,r,n);return e.slice(t,r)}function Bc(e,t,r,n){let i=e.slice(t,n),o=n;while(o<r){if(e.charCodeAt(o)!==92){i+=e[o],o++;continue}if(o+1>=r){o++;continue}let c=e.charCodeAt(o+1);if(c===10){o+=2;continue}if(c===13){o+=e.charCodeAt(o+2)===10?3:2;continue}if(pt(c)){let a=o+1,l="";while(l.length<6&&a<r&&pt(e.charCodeAt(a)))l+=e[a],a++;let u=Number.parseInt(l,16);if(a<r&&xe(e.charCodeAt(a)))a++;i+=u===0||u>=55296&&u<=57343||u>1114111?String.fromCodePoint(65533):String.fromCodePoint(u),o=a;continue}i+=e[o+1],o+=2}return i}function qr(e,t,r){for(let n=t;n<r;n++)if(e.charCodeAt(n)===92)return Uc(e,t,r,n);return e.slice(t,r)}function Uc(e,t,r,n){let i=e.slice(t,n),o=n;while(o<r){if(e.charCodeAt(o)!==92){i+=e[o],o++;continue}let c=o+1,a="";while(a.length<6&&c<r&&pt(e.charCodeAt(c)))a+=e[c],c++;if(a.length>0){let l=Number.parseInt(a,16);if(c<r&&xe(e.charCodeAt(c)))c++;i+=l===0||l>=55296&&l<=57343||l>1114111?String.fromCodePoint(65533):String.fromCodePoint(l),o=c;continue}if(c<r){i+=e[c],o=c+1;continue}i+=String.fromCodePoint(65533),o=c}return i}function Oi(e,t){let r=new Tt(e);return{source:e,types:r.types,starts:r.starts,ends:r.ends,count:r.count,end:r.count,pos:0,positions:t.positions??!1,filename:t.filename,parseValue:t.parseValue??!0,parseAtrulePrelude:t.parseAtrulePrelude??!0,parseCustomProperty:t.parseCustomProperty??!1,parseRulePrelude:t.parseRulePrelude??!0,onParseError:t.onParseError,tokenizer:r}}function x(e){return e.pos<e.end?e.types[e.pos]:0}function w(e){let t=e.pos;if(t>=e.end)return{type:0,start:e.starts[t]??e.source.length,end:e.ends[t]??e.source.length};return{type:e.types[t],start:e.starts[t],end:e.ends[t]}}function C(e){let t=e.pos++;if(t>=e.end)return{type:0,start:e.starts[t]??e.source.length,end:e.ends[t]??e.source.length};return{type:e.types[t],start:e.starts[t],end:e.ends[t]}}function me(e,t){return e.source.slice(t.start,t.end)}function ce(e){let{types:t,end:r}=e;while(e.pos<r){let n=t[e.pos];if(n===13||n===25)e.pos++;else break}}function ki(e){let{types:t,end:r}=e;while(e.pos<r&&t[e.pos]===13)e.pos++}function k(e,t,r){if(!e.positions)return null;let n=e.tokenizer.locate(t.start),i=e.tokenizer.locate(r.end);return{source:e.filename??"<unknown>",start:{offset:t.start,line:n.line,column:n.column},end:{offset:r.end,line:i.line,column:i.column}}}function Ii(e){if(!e.positions)return null;let t=w(e),r=e.tokenizer.locate(t.start);return{source:e.filename??"<unknown>",start:{offset:t.start,line:r.line,column:r.column},end:{offset:t.start,line:r.line,column:r.column}}}function Nt(e,t,r,n){return{type:"Raw",value:e,loc:k(n,t,r)}}function X(){return new oe}function Yr(e,t,r,n){if(e.onParseError){let{line:i,column:o}=e.tokenizer.locate(r.start),s=SyntaxError(`${e.filename??"<input>"}:${i}:${o}: ${t}`);s.line=i,s.column=o,s.offset=r.start,e.onParseError(s,n)}return n}function It(e,t={}){let r=Oi(e,t);switch(t.context??"stylesheet"){case"stylesheet":return Ai(r);case"atrule":return Pt(r)??Si(r);case"atrulePrelude":return Kc(r);case"mediaQuery":case"mediaQueryList":return Ei(r);case"rule":return Xr(r);case"selectorList":return en(r);case"selector":return Mi(r);case"block":return Zr(r);case"declarationList":return qc(r);case"declaration":return Qr(r)??Si(r);case"value":return Yc(r);case"raw":return Ei(r);default:return Ai(r)}}function Si(e){return{type:"StyleSheet",children:X(),loc:Ii(e)}}function Ei(e){let t=w(e),r=t;while(x(e)!==0)r=C(e);return{type:"Raw",value:e.source.slice(t.start,r.end),loc:k(e,t,r)}}function Ai(e){let t=w(e),r=X(),{types:n,end:i}=e;while(e.pos<i){let c=n[e.pos];if(c===13){e.pos++;continue}if(c===25){let u={type:25,start:e.starts[e.pos],end:e.ends[e.pos]},f=Jr(e,u);e.pos++,r.appendData(f);continue}if(c===0)break;if(c===14||c===15){e.pos++;continue}if(c===3){let u=Pt(e);if(u)r.appendData(u);continue}if(c===24){e.pos++;continue}let a=e.pos,l=Xr(e);if(r.appendData(l),e.pos===a)e.pos++}let o=e.end-1,s=o>=0?{type:e.types[o],start:e.starts[o],end:e.ends[o]}:{type:0,start:0,end:0};return{type:"StyleSheet",children:r,loc:k(e,t,s)}}function Jr(e,t){return{type:"Comment",value:e.source.slice(t.start+2,t.end-2),loc:k(e,t,t)}}function Pt(e){let t=w(e);if(t.type!==3)return null;e.pos++;let r=Ot(e.source,t.start+1,t.end);ce(e);let n=e.pos,i=w(e),{types:o,end:s}=e,c=n,a=n;while(c<s){let f=o[c];if(f===0||f===17||f===23)break;if(f!==13&&f!==25)a=c+1;c++}let l=null;if(a>n){let f=e.starts[n],d=e.ends[a-1],h={type:o[a-1],start:e.starts[a-1],end:d},m=e.source.slice(f,d).trim();if(m.length>0)if(e.parseAtrulePrelude)try{let p=e.end;e.end=a,e.pos=n;let g=X();while(x(e)!==0){let y=Be(e);if(y)g.appendData(y)}if(_i(g),e.end=p,e.pos=c,g.isEmpty)l=Nt(m,i,h,e);else l={type:"AtrulePrelude",children:g,loc:null}}catch(p){let g=Nt(m,i,h,e);Yr(e,`Failed to parse @${r} prelude: ${p.message}`,i,g),l=g,e.pos=c}else l=Nt(m,i,h,e),e.pos=c;else e.pos=c}else e.pos=c;let u=null;if(x(e)===17)C(e);else if(x(e)===23)u=Zr(e,Wc.has(r));return{type:"Atrule",name:r,prelude:l,block:u,loc:k(e,t,w(e))}}var zc=new Set(["is","not","where","has","matches","-moz-any","-webkit-any"]),Wc=new Set(["media","supports","document","layer","container","scope","starting-style","-moz-document","keyframes","-webkit-keyframes","-moz-keyframes","-o-keyframes"]);function Kc(e){let t=w(e),r=X();while(x(e)!==0){if(w(e).type===13){e.pos++;continue}let i=Be(e);if(i)r.appendData(i)}return{type:"AtrulePrelude",children:r,loc:k(e,t,w(e))}}function Xr(e){let t=w(e),r;if(e.parseRulePrelude)r=en(e);else{let i=w(e),o=i;while(x(e)!==0&&x(e)!==23)o=C(e);let s=e.source.slice(i.start,o.end).trim();r=Nt(s,i,o,e)}let n=Zr(e,!0);return{type:"Rule",prelude:r,block:n,loc:k(e,t,w(e))}}function Zr(e,t=!1){let r=w(e);if(x(e)!==23)return{type:"Block",children:X(),loc:Ii(e)};e.pos++;let n=X(),{types:i,end:o}=e;while(e.pos<o){let s=i[e.pos];if(s===24||s===0)break;if(s===13){e.pos++;continue}if(s===25){let a={type:25,start:e.starts[e.pos],end:e.ends[e.pos]};e.pos++,n.appendData(Jr(e,a));continue}if(s===3){let a=Pt(e);if(a)n.appendData(a);continue}if(t&&Gc(e,Hc)){let a=Xr(e);n.appendData(a);continue}let c=Qr(e);if(c)n.appendData(c);if(e.pos<o&&i[e.pos]===17)e.pos++}if(x(e)===24)e.pos++;return{type:"Block",children:n,loc:k(e,r,w(e))}}function Gc(e,t){let r=e.pos,n=t(e);return e.pos=r,n}function Hc(e){let{types:t,end:r}=e;while(e.pos<r){let n=t[e.pos];if(n===23)return!0;if(n===17||n===24||n===0)return!1;e.pos++}return!1}function qc(e){let t=w(e),r=X();while(x(e)!==0&&x(e)!==24){let n=w(e);if(n.type===13){e.pos++;continue}if(n.type===25){r.appendData(Jr(e,C(e)));continue}if(n.type===17){e.pos++;continue}if(n.type===3){let o=Pt(e);if(o)r.appendData(o);continue}let i=Qr(e);if(i)r.appendData(i);if(x(e)===17)C(e)}return{type:"DeclarationList",children:r,loc:k(e,t,w(e))}}function Qr(e){ce(e);let t=w(e);if(t.type!==1&&t.type!==4&&!(t.type===9&&e.source[t.start]==="*"&&e.source[t.start+1]===" "))if(t.type===9&&e.source[t.start]==="*")e.pos++;else{Yr(e,"Expected property name",t,{type:"Raw",value:"",loc:null});let{types:R,end:I}=e;while(e.pos<I){let _=R[e.pos];if(_===0||_===17||_===24)break;e.pos++}return null}let r=e.starts[e.pos],n=e.ends[e.pos];e.pos++;let i=e.source.slice(r,n);if(ki(e),x(e)!==16){Yr(e,`Expected ':' after property "${i}"`,w(e),{type:"Raw",value:"",loc:null});let{types:R,end:I}=e;while(e.pos<I){let _=R[e.pos];if(_===0||_===17||_===24)break;e.pos++}return null}e.pos++,ki(e);let{types:o,starts:s,end:c,pos:a}=e,l=a,u=a,f=-1,d=-1;while(l<c){let R=o[l];if(R===0||R===17||R===24)break;if(R===9&&e.source.charCodeAt(s[l])===33){let I=l+1;while(I<c&&o[I]===13)I++;if(I<c&&o[I]===1){let _=s[I];if(e.ends[I]-_===9&&(e.source.charCodeAt(_)|32)===105&&(e.source.charCodeAt(_+1)|32)===109&&(e.source.charCodeAt(_+2)|32)===112&&(e.source.charCodeAt(_+3)|32)===111&&(e.source.charCodeAt(_+4)|32)===114&&(e.source.charCodeAt(_+5)|32)===116&&(e.source.charCodeAt(_+6)|32)===97&&(e.source.charCodeAt(_+7)|32)===110&&(e.source.charCodeAt(_+8)|32)===116){d=l,f=I,l=I+1;continue}}}if(R!==13&&R!==25)u=l+1;l++}let h=u,m=f>=0?{type:1,start:s[f],end:e.ends[f]}:null,p=i.startsWith("--"),g,y=s[a],b=h>a?e.ends[h-1]:y,v={type:o[a],start:y,end:e.ends[a]},S=h>a?{type:o[h-1],start:s[h-1],end:b}:v;if(p&&!e.parseCustomProperty||!e.parseValue)g={type:"Raw",value:e.source.slice(y,b).trim(),loc:k(e,v,S)};else if(h===a)g={type:"Value",children:X(),loc:k(e,v,S)};else{let R=e.end;e.end=h,e.pos=a,g=Pi(e),e.end=R}return e.pos=l,{type:"Declaration",property:i,important:m?!0:!1,value:g,loc:k(e,t,w(e))}}function Yc(e){return Pi(e)}function Pi(e){let t=w(e),r=X();while(x(e)!==0&&x(e)!==17&&x(e)!==24&&x(e)!==22&&x(e)!==20){let n=Be(e);if(n)r.appendData(n)}return Li(r),{type:"Value",children:r,loc:k(e,t,w(e))}}function _i(e){for(let t of e)if("children"in t&&t.children instanceof oe)_i(t.children);Li(e)}function Li(e){let t=e.head;while(t){if(t.data.type==="Number"){let r=t.next;while(r&&r.data.type==="WhiteSpace")r=r.next;if(r&&r.data.type==="Operator"&&r.data.value==="/"){let n=r.next;while(n&&n.data.type==="WhiteSpace")n=n.next;if(n&&n.data.type==="Number"){let i={type:"Ratio",left:t.data,right:n.data,loc:null},o=t.next;while(o&&o!==n.next){let s=o.next;e.remove(o),o=s}e.replace(t,e.createItem(i)),t=e.head;continue}}}t=t.next}}function Be(e){let t=e.pos;if(t>=e.end)return null;let r=e.types[t],n=e.starts[t],i=e.ends[t],o=e.source;switch(r){case 13:return e.pos++,e.positions?{type:"WhiteSpace",value:" ",loc:J(e,n,i)}:{type:"WhiteSpace",value:" ",loc:null};case 25:return e.pos++,{type:"Comment",value:o.slice(n+2,i-2),loc:e.positions?J(e,n,i):null};case 10:return e.pos++,{type:"Number",value:o.slice(n,i),loc:e.positions?J(e,n,i):null};case 11:return e.pos++,{type:"Percentage",value:o.slice(n,i-1),loc:e.positions?J(e,n,i):null};case 12:{e.pos++;let s=n,c=o.charCodeAt(s);if(c===43||c===45)s++;let a=!1;while(s<i){let u=o.charCodeAt(s);if(u>=48&&u<=57){s++;continue}if(u===46&&!a){a=!0,s++;continue}break}let l=o.charCodeAt(s);if(l===69||l===101){let u=s+1,f=o.charCodeAt(u);if(f===43||f===45)u++;let d=!1;while(u<i){let h=o.charCodeAt(u);if(h>=48&&h<=57){u++,d=!0;continue}break}if(d)s=u}return{type:"Dimension",value:o.slice(n,s),unit:o.slice(s,i),loc:e.positions?J(e,n,i):null}}case 1:return e.pos++,{type:"Identifier",name:qr(o,n,i),loc:e.positions?J(e,n,i):null};case 5:{e.pos++;let s=n+1,a=i-n>=2&&o.charCodeAt(i-1)===o.charCodeAt(n)?i-1:i;return{type:"String",value:Hr(o,s,a),loc:e.positions?J(e,n,i):null}}case 7:{e.pos++;let s=n+4;while(s<i&&Ti(o.charCodeAt(s)))s++;let c=i;if(c>s&&o.charCodeAt(c-1)===41)c--;while(c>s&&Ti(o.charCodeAt(c-1)))c--;let a;if(c-s>=2){let l=o.charCodeAt(s),u=o.charCodeAt(c-1);if((l===34||l===39)&&l===u)a=o.slice(s+1,c-1);else a=o.slice(s,c)}else a=o.slice(s,c);return{type:"Url",value:a,loc:e.positions?J(e,n,i):null}}case 4:return e.pos++,{type:"Hash",name:o.slice(n+1,i),loc:e.positions?J(e,n,i):null};case 2:return Xc(e);case 21:return Zc(e);case 18:return e.pos++,{type:"Operator",value:",",loc:e.positions?J(e,n,i):null};case 16:return e.pos++,{type:"Operator",value:":",loc:e.positions?J(e,n,i):null};case 9:{e.pos++;let s=o.charCodeAt(n),c=o[n];if(Jc(s))return{type:"Operator",value:c,loc:e.positions?J(e,n,i):null};return{type:"Identifier",name:c,loc:e.positions?J(e,n,i):null}}case 19:{e.pos++;let s=X();while(x(e)!==0&&x(e)!==20){let a=Be(e);if(a)s.appendData(a)}let c=e.pos<e.end?e.ends[e.pos]:i;if(x(e)===20)e.pos++;return{type:"Brackets",children:s,loc:e.positions?J(e,n,c):null}}case 3:case 23:case 24:case 22:case 20:case 17:case 0:case 14:case 15:case 6:case 8:return e.pos++,{type:"Raw",value:o.slice(n,i),loc:e.positions?J(e,n,i):null}}return e.pos++,null}function Ti(e){return e===32||e===9||e===10||e===12||e===13}function Jc(e){return e===47||e===43||e===45||e===42||e===61||e===62||e===60||e===126||e===124||e===36||e===94||e===33||e===38}function Ot(e,t,r){for(let n=t;n<r;n++){let i=e.charCodeAt(n);if(i>=65&&i<=90)return e.slice(t,r).toLowerCase()}return e.slice(t,r)}function J(e,t,r){let n=e.tokenizer.locate(t),i=e.tokenizer.locate(r);return{source:e.filename??"<unknown>",start:{offset:t,line:n.line,column:n.column},end:{offset:r,line:i.line,column:i.column}}}function Xc(e){let t=C(e),r=Ot(e.source,t.start,t.end-1),n=X();while(x(e)!==0&&x(e)!==22){let i=Be(e);if(i)n.appendData(i)}if(x(e)===22)C(e);if(r==="url"){for(let i=n.head;i!=null;i=i.next)if(i.data.type==="String")return{type:"Url",value:i.data.value,loc:k(e,t,w(e))}}return{type:"Function",name:r,children:n,loc:k(e,t,w(e))}}function Zc(e){let t=C(e),r=X();while(x(e)!==0&&x(e)!==22){let n=Be(e);if(n)r.appendData(n)}if(x(e)===22)C(e);return{type:"Parentheses",children:r,loc:k(e,t,w(e))}}function en(e){let t=w(e),r=X();while(x(e)!==0){if(ce(e),x(e)===0||x(e)===23)break;let n=Mi(e);if(n.children.head!==null)r.appendData(n);if(ce(e),x(e)===18){C(e);continue}break}return{type:"SelectorList",children:r,loc:k(e,t,w(e))}}function Mi(e){let t=w(e),r=X(),n=!0;while(x(e)!==0&&x(e)!==18&&x(e)!==23){let i=w(e);if(i.type===13){if(C(e),!n&&x(e)!==0&&x(e)!==18&&x(e)!==23&&!Ni(e)&&!Qc(e)){let s={type:"Combinator",name:" ",loc:k(e,i,i)};r.appendData(s),n=!0}continue}if(i.type===9&&e.source.charCodeAt(i.start)===124&&e.types[e.pos+1]===9&&e.source.charCodeAt(e.starts[e.pos+1])===124){let s=w(e);C(e);let c=C(e),a={type:"Combinator",name:"||",loc:k(e,s,c)};r.appendData(a),n=!0,ce(e);continue}if(Ni(e)){let s=C(e),a={type:"Combinator",name:e.source[s.start],loc:k(e,s,s)};r.appendData(a),n=!0,ce(e);continue}let o=eu(e);if(!o)break;r.appendData(o),n=!1}while(r.tail&&r.tail.data.type==="Combinator")r.remove(r.tail);return{type:"Selector",children:r,loc:k(e,t,w(e))}}function Ni(e){let t=w(e);if(t.type!==9)return!1;let r=e.source[t.start];return r===">"||r==="+"||r==="~"}function Qc(e){if(e.types[e.pos]!==9)return!1;if(e.source.charCodeAt(e.starts[e.pos])!==124)return!1;if(e.types[e.pos+1]!==9)return!1;return e.source.charCodeAt(e.starts[e.pos+1])===124}function eu(e){let t=w(e);switch(t.type){case 1:{if(C(e),x(e)===9&&e.source[w(e).start]==="|"&&e.source[w(e).start+1]!=="="&&!(e.types[e.pos+1]===9&&e.source.charCodeAt(e.starts[e.pos+1])===124)){if(C(e),x(e)===1){let n=C(e);return{type:"TypeSelector",name:`${me(e,t)}|${me(e,n)}`,loc:k(e,t,n)}}if(x(e)===9&&e.source[w(e).start]==="*"){let n=C(e);return{type:"TypeSelector",name:`${me(e,t)}|*`,loc:k(e,t,n)}}}return{type:"TypeSelector",name:me(e,t),loc:k(e,t,t)}}case 11:return C(e),{type:"TypeSelector",name:me(e,t),loc:k(e,t,t)};case 10:return C(e),{type:"TypeSelector",name:me(e,t),loc:k(e,t,t)};case 9:{let r=e.source[t.start];if(r==="*")return C(e),{type:"TypeSelector",name:"*",loc:k(e,t,t)};if(r==="."){if(C(e),x(e)===1){let n=C(e);return{type:"ClassSelector",name:me(e,n),loc:k(e,t,n)}}return null}if(r==="&")return C(e),{type:"NestingSelector",loc:k(e,t,t)};return C(e),null}case 4:return C(e),{type:"IdSelector",name:e.source.slice(t.start+1,t.end),loc:k(e,t,t)};case 16:{C(e);let r=x(e)===16;if(r)C(e);return tu(e,r,t)}case 19:return ru(e)}return null}function tu(e,t,r){let n=w(e);if(n.type===1){C(e);let i=Ot(e.source,n.start,n.end);return t?{type:"PseudoElementSelector",name:i,children:null,loc:k(e,r,n)}:{type:"PseudoClassSelector",name:i,children:null,loc:k(e,r,n)}}if(n.type===2){C(e);let i=Ot(e.source,n.start,n.end-1),o=X();if(!t&&zc.has(i)){let a=w(e),l=a,u=1;while(x(e)!==0&&u>0){if(x(e)===21||x(e)===2)u++;else if(x(e)===22){if(u--,u===0)break}l=C(e)}if(x(e)===22)C(e);let f=e.source.slice(a.start,l.end).trim();if(f.length>0){let d=Oi(f,{positions:!1}),h=en(d);o.appendData(h)}}else{while(x(e)!==0&&x(e)!==22){let a=Be(e);if(a)o.appendData(a)}if(x(e)===22)C(e)}if(t)return{type:"PseudoElementSelector",name:i,children:o,loc:k(e,r,w(e))};return{type:"PseudoClassSelector",name:i,children:o,loc:k(e,r,w(e))}}return null}function ru(e){let t=C(e);ce(e);let r=w(e);if(r.type!==1)return null;C(e);let n={type:"Identifier",name:me(e,r),loc:k(e,r,r)};ce(e);let i=null,o=null,s=null,c=w(e);if(c.type===9){let l=e.source[c.start],u=e.source[c.start+1];if(l==="=")i="=",C(e);else if((l==="~"||l==="|"||l==="^"||l==="$"||l==="*")&&u==="="){C(e);let h=w(e);if(h.type===9&&e.source[h.start]==="=")C(e),i=`${l}=`}ce(e);let f=w(e);if(f.type===5){C(e);let h=f.end-f.start>=2&&e.source.charCodeAt(f.end-1)===e.source.charCodeAt(f.start);o={type:"String",value:Hr(e.source,f.start+1,h?f.end-1:f.end),loc:k(e,f,f)}}else if(f.type===1)C(e),o={type:"Identifier",name:me(e,f),loc:k(e,f,f)};ce(e);let d=w(e);if(d.type===1)C(e),s=me(e,d)}ce(e);let a=w(e);if(x(e)===20)a=C(e);return{type:"AttributeSelector",name:n,matcher:i,value:o,flags:s,loc:k(e,t,a)}}var Fi=Symbol("walkSkip"),B=Symbol("walkStop");function nu(e){return{root:e,stylesheet:null,atrule:null,atrulePrelude:null,rule:null,selector:null,block:null,declaration:null,function:null}}function iu(e,t){let r=nu(e),n=typeof t==="function"?t:t.enter,i=typeof t==="function"?null:t.leave??null,o=typeof t==="function"?null:t.visit??null,s=typeof t==="function"?!1:t.reverse??!1;function c(a,l,u){let f=null,d;switch(a.type){case"StyleSheet":f="stylesheet",d=r.stylesheet,r.stylesheet=a;break;case"Atrule":f="atrule",d=r.atrule,r.atrule=a;break;case"AtrulePrelude":f="atrulePrelude",d=r.atrulePrelude,r.atrulePrelude=a;break;case"Rule":f="rule",d=r.rule,r.rule=a;break;case"Selector":f="selector",d=r.selector,r.selector=a;break;case"Block":f="block",d=r.block,r.block=a;break;case"Declaration":f="declaration",d=r.declaration,r.declaration=a;break;case"Function":f="function",d=r.function,r.function=a;break}let h;if((o===null||o===a.type)&&n){let m=n.call(r,a,l,u);if(m===Fi){if(f)r[f]=d;return}if(m===B){if(f)r[f]=d;return B}}if(h=ou(a,s,c),h===B){if(f)r[f]=d;return B}if((o===null||o===a.type)&&i){if(i.call(r,a,l,u)===B){if(f)r[f]=d;return B}}if(f)r[f]=d;return}return c(e,null,null)}var Ue=Object.assign(iu,{skip:Fi,stop:B});function ou(e,t,r){if("children"in e&&e.children instanceof oe)return su(e.children,t,r);if(e.type==="Rule"){if(r(e.prelude,null,null)===B)return B;if(r(e.block,null,null)===B)return B;return}if(e.type==="Atrule"){if(e.prelude){if(r(e.prelude,null,null)===B)return B}if(e.block){if(r(e.block,null,null)===B)return B}return}if(e.type==="Declaration")return r(e.value,null,null);if(e.type==="AttributeSelector"){if(r(e.name,null,null)===B)return B;if(e.value)return r(e.value,null,null);return}return}function su(e,t,r){let n;if(t)e.forEachRight((i,o,s)=>{if(n)return;if(r(i,o,s)===B)n=B});else e.forEach((i,o,s)=>{if(n)return;if(r(i,o,s)===B)n=B});return n}function He(e,t={}){let r=t.exclamation??!1,n=!1;Ue(e,(i,o,s)=>{if(i.type!=="Comment")return;let c=i.value.startsWith("!");if(r===!0&&c)return;if(r==="first-exclamation"&&c&&!n){n=!0;return}if(o&&s)s.remove(o)})}function _t(e){Ue(e,(t)=>{if(t.type!=="Block"&&t.type!=="DeclarationList")return;if(!("children"in t)||!t.children)return;let r=t.children,n=r.head;if(n==null||n.next==null)return;let i=0;for(let c=n;c!=null;c=c.next)if(c.data.type==="Declaration"){if(i++,i>=2)break}if(i<2)return;let o=new Map,s=[];for(let c=n;c!=null;c=c.next){let a=c.data;if(a.type!=="Declaration")continue;let l=a.property,u=o.get(l);if(u){let f=!!u.decl.important,d=!!a.important;if(d||f===d)s.push(u.item),o.set(l,{item:c,decl:a});else s.push(c)}else o.set(l,{item:c,decl:a})}for(let c of s)r.remove(c)})}var au={black:"#000",fuchsia:"#f0f",white:"#fff",red:"#f00",cyan:"#0ff",blue:"#00f",yellow:"#ff0",magenta:"#f0f",lime:"#0f0",silver:"#c0c0c0",gray:"#808080",maroon:"#800000",olive:"#808000",green:"#008000",purple:"#800080",teal:"#008080",navy:"#000080"},lu={"#f00":"red","#ff0000":"red","#000080":"navy","#008080":"teal"};function rn(e){if(!e.startsWith("#"))return e;let t=e.slice(1);if(t.length===6){if(t[0]===t[1]&&t[2]===t[3]&&t[4]===t[5])return`#${t[0]}${t[2]}${t[4]}`}if(t.length===8){if(t[0]===t[1]&&t[2]===t[3]&&t[4]===t[5]&&t[6]===t[7])return`#${t[0]}${t[2]}${t[4]}${t[6]}`}return e}function Di(e){let t=e.toLowerCase();return au[t]??null}function ji(e){let t=e.toLowerCase();return lu[t]??null}function cu(e,t,r){let n=(e<<16|t<<8|r).toString(16).padStart(6,"0");return rn(`#${n}`)}var uu=/^rgba?\(\s*([+-]?\d*\.?\d+%?)\s*[,\s]\s*([+-]?\d*\.?\d+%?)\s*[,\s]\s*([+-]?\d*\.?\d+%?)\s*(?:[,/]\s*([+-]?\d*\.?\d+%?)\s*)?\)$/;function Bi(e){let t=uu.exec(e.trim());if(!t)return e;let r=tn(t[1]),n=tn(t[2]),i=tn(t[3]);if(t[4]!==void 0&&!fu(t[4]))return e;return cu(r,n,i)}function fu(e){if(e.endsWith("%"))return Number.parseFloat(e)>=100;return Number.parseFloat(e)>=1}function tn(e){if(e.endsWith("%"))return Math.max(0,Math.min(255,Math.round(Number.parseFloat(e)*2.55)));return Math.max(0,Math.min(255,Math.round(Number.parseFloat(e))))}var du=new Set(["px","pt","pc","in","cm","mm","q","em","rem","ex","ch","cap","ic","lh","rlh","vw","vh","vi","vb","vmin","vmax","svw","svh","svi","svb","svmin","svmax","lvw","lvh","lvi","lvb","lvmin","lvmax","dvw","dvh","dvi","dvb","dvmin","dvmax","cqw","cqh","cqi","cqb","cqmin","cqmax"]);function Lt(e){if(e.charCodeAt(0)===43)e=e.slice(1);if(e.includes(".")){let t=e.replace(/(\.\d*?)0+($|[eE])/,"$1$2");t=t.replace(/\.($|[eE])/,"$1"),e=t}if(e.startsWith("0.")&&e.length>2)e=e.slice(1);else if(e.startsWith("-0.")&&e.length>3)e=`-${e.slice(2)}`;if(e==="-0"||e==="-.0"||e==="-0.0")e="0";return e}function Ui(e,t){let r=Lt(e);if((r==="0"||r==="-0")&&du.has(t.toLowerCase()))return{value:"0",unit:""};return{value:r,unit:t}}function Vi(e){return Lt(e)}function zi(e,t){let r=Number.parseFloat(e);if(!Number.isFinite(r))return e;let n=t<0?0:t;return r.toFixed(n)}var Wi=new Set(["color","background","background-color","border","border-color","border-top","border-top-color","border-right","border-right-color","border-bottom","border-bottom-color","border-left","border-left-color","border-block","border-block-color","border-block-start-color","border-block-end-color","border-inline","border-inline-color","border-inline-start-color","border-inline-end-color","outline","outline-color","caret-color","fill","stroke","flood-color","lighting-color","stop-color","column-rule","column-rule-color","text-decoration","text-decoration-color","text-emphasis","text-emphasis-color","text-shadow","box-shadow","accent-color","scrollbar-color"]);function Ki(e){if(!e||e.type!=="Operator")return!1;let t=e.value;return t===":"||t===","||t==="/"}function hu(e){let t=e.children;if(!t)return;while(t.head&&t.head.data.type==="WhiteSpace")t.remove(t.head);while(t.tail&&t.tail.data.type==="WhiteSpace")t.remove(t.tail);let r=t.head;while(r){let n=r.next;if(r.data.type==="WhiteSpace"){let i=r.prev&&Ki(r.prev.data),o=n&&Ki(n.data);if(i||o)t.remove(r)}r=n}}function nn(e,t={}){let r=t.floatPrecision??null,n=r===null?null:(i)=>zi(i,r);Ue(e,{enter(i,o,s){switch(i.type){case"Number":{let c=n?n(i.value):i.value;i.value=Lt(c);return}case"Percentage":{let c=n?n(i.value):i.value;i.value=Vi(c);return}case"Dimension":{let c=n?n(i.value):i.value,a=Ui(c,i.unit);i.value=a.value,i.unit=a.unit;return}case"Hash":{let c=rn(`#${i.name}`).slice(1);if(i.name=c,o&&s&&this.declaration&&Wi.has(this.declaration.property.toLowerCase())){let a=ji(`#${c}`);if(a&&a.length<c.length+1){let l={type:"Identifier",name:a,loc:i.loc};s.replace(o,s.createItem(l))}}return}case"Identifier":{if(!o||!s||!this.declaration)return;if(!Wi.has(this.declaration.property.toLowerCase()))return;let c=Di(i.name);if(c&&c.length<i.name.length){let a={type:"Hash",name:c.slice(1),loc:i.loc};s.replace(o,s.createItem(a))}return}case"Url":return;case"Function":{let c=i.name.toLowerCase();if((c==="rgb"||c==="rgba")&&o&&s)i.__rgbReplaceCandidate=!0}}},leave(i,o,s){if(i.type==="Parentheses"||i.type==="Function"||i.type==="Value")hu(i);if(i.type==="Function"&&i.__rgbReplaceCandidate&&o&&s){let c=Y(i),a=Bi(c);if(a!==c&&a.startsWith("#")){let l={type:"Hash",name:a.slice(1),loc:i.loc};s.replace(o,s.createItem(l))}}}})}function gu(e,t={}){let r=It(e,{context:"stylesheet"});return Gi(r,t)}function on(e,t={}){let r=It(e,{context:"declarationList"});return Gi(r,t)}function Gi(e,t){if(t.comments===!1)He(e,{exclamation:!1});else if(t.comments==="first-exclamation")He(e,{exclamation:"first-exclamation"});else He(e,{exclamation:!0});return nn(e,{floatPrecision:t.floatPrecision??null}),_t(e),{css:Y(e),ast:e}}function Oe(e,t,r){if(e.size>=1e4){let n=e.keys().next().value;if(n!==void 0)e.delete(n)}return e.set(t,r),r}var Hi=new Map,Ne=new Map;var sn={col:"col",row:"row",jc:"justify",ji:"justify-items",js:"justify-self",ai:"items",ac:"content",as:"self",wrap:"wrap",nowrap:"nowrap",c:"center",s:"start",e:"end",sb:"between",sa:"around",se:"evenly",st:"stretch",thin:"thin",extralight:"extralight",light:"light",normal:"normal",medium:"medium",semibold:"semibold",bold:"bold",extrabold:"extrabold",black:"black",t:"top",r:"right",b:"bottom",l:"left"},yu=/[%#()]/,bu=/^\d+(?:\.\d+)?(?:px|rem|em|vh|vw|dvh|dvw|svh|svw|lvh|lvw|ch|ex|lh|cap|ic|rlh|vi|vb|vmin|vmax|cqw|cqh|cqi|cqb|cqmin|cqmax|cm|mm|in|pt|pc|Q)$/,eo=["calc","min","max","clamp","mod","rem","sin","cos","tan","asin","acos","atan","atan2","pow","sqrt","hypot","log","exp","round"],xu=new Set(eo);function re(e){return yu.test(e)||bu.test(e)}function qi(e){if(!eo.some((o)=>e.includes(`${o}(`)))return e;let t="",r=[],n=null,i=null;for(let o=0;o<e.length;o++){let s=e.charCodeAt(o);if(s>=48&&s<=57)n=o;else if(n!==null&&(s===37||s>=97&&s<=122||s>=65&&s<=90))n=o;else i=n,n=null;if(s===40){t+=e[o];let a=o;for(let u=o-1;u>=0;u--){let f=e.charCodeAt(u);if(f>=48&&f<=57||f>=97&&f<=122)a=u;else break}let l=e.slice(a,o);if(xu.has(l))r.unshift(!0);else if(r[0]&&l==="")r.unshift(!0);else r.unshift(!1);continue}if(s===41){t+=e[o],r.shift();continue}if(s===44&&r[0]){t+=", ";continue}if(s===32&&r[0]&&t.charCodeAt(t.length-1)===32)continue;if((s===43||s===45||s===42||s===47)&&r[0]){let a=t.trimEnd(),l=a.charCodeAt(a.length-1),u=a.charCodeAt(a.length-2),f=e.charCodeAt(o+1),d=l===43||l===45||l===42||l===47,h=f===43||f===45||f===42||f===47;if((l===101||l===69)&&u>=48&&u<=57)t+=e[o];else if(d||l===40||l===44)t+=e[o];else if(e.charCodeAt(o-1)===32)t+=`${e[o]} `;else if(l>=48&&l<=57||f>=48&&f<=57||l===41||f===40||h||i!==null&&i===o-1)t+=` ${e[o]} `;else t+=e[o];continue}t+=e[o]}return t}function Mt(e){if(!e.includes("_"))return qi(e);let t="",r=0;while(r<e.length){let n=e[r];if(n==="\\"&&e[r+1]==="_"){t+="_",r+=2;continue}if(n==="u"&&e.slice(r,r+4)==="url("){let i=r,o=1;r+=4;while(r<e.length&&o>0){if(e[r]==="(")o++;else if(e[r]===")")o--;r++}t+=e.slice(i,r);continue}t+=n==="_"?" ":n,r++}return qi(t)}function Yi(e,t){if(t.length!==2)return null;let[r,n]=t;if(r!=="min"&&r!=="max")return null;return[re(n)?`${r}-${e}-[${n}]`:`${r}-${e}-${n}`]}var vu={flex:{expand:(e,t)=>{let r=t[e]||e;if(["col","row","col-reverse","row-reverse","wrap","nowrap","wrap-reverse"].includes(r))return`flex-${r}`;let n=e.match(/^(jc|ji|js|ai|ac|as)-(.+)$/);if(n){let i=t[n[1]]||n[1],o=t[n[2]]||n[2];return`${i}-${o}`}if(/^\d+$/.test(r)||["grow","shrink","auto","initial","none"].includes(r))return`flex-${r}`;return null}},grid:{expand:(e,t)=>{let r=t[e]||e;if(e.startsWith("cols-")||e.startsWith("rows-"))return`grid-${e}`;if(e.startsWith("flow-"))return`grid-${e}`;if(e.startsWith("gap-"))return e;return null}},text:{expand:(e,t)=>{let r=t[e]||e;if(re(r))return`text-[${r}]`;if(/^\d{3}$/.test(r))return{"100":"font-thin","200":"font-extralight","300":"font-light","400":"font-normal","500":"font-medium","600":"font-semibold","700":"font-bold","800":"font-extrabold","900":"font-black"}[r]||`font-[${r}]`;if(/^[a-z-]+$/i.test(r)&&!["xs","sm","base","lg","xl","2xl","3xl","4xl","5xl","6xl","7xl","8xl","9xl"].includes(r)){if(["white","black","inherit","current","transparent"].includes(r.toLowerCase()))return`text-${r}`;if(["red","blue","green","yellow","purple","pink","gray","slate","zinc","neutral","stone","orange","amber","lime","emerald","teal","cyan","sky","indigo","violet","fuchsia","rose"].includes(r.toLowerCase()))return`text-${r}-500`;return`font-[${r}]`}return`text-${r}`}},font:{expand:(e,t)=>{let r=t[e]||e,n=["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],i=["sans","serif","mono"];if(n.includes(r)||i.includes(r))return`font-${r}`;if(/^\d{3}$/.test(r))return{"100":"font-thin","200":"font-extralight","300":"font-light","400":"font-normal","500":"font-medium","600":"font-semibold","700":"font-bold","800":"font-extrabold","900":"font-black"}[r]||`font-[${r}]`;return`font-[${r}]`}},bg:{expand:(e,t)=>`bg-${t[e]||e}`},w:{expand:(e,t)=>{let r=t[e]||e;if(re(r))return`w-[${r}]`;return`w-${r}`},multiValue:(e)=>Yi("w",e)},h:{expand:(e,t)=>{let r=t[e]||e;if(re(r))return`h-[${r}]`;return`h-${r}`},multiValue:(e)=>Yi("h",e)},p:{expand:(e)=>`p-${e}`},px:{expand:(e)=>`px-${e}`},py:{expand:(e)=>`py-${e}`},pt:{expand:(e)=>`pt-${e}`},pr:{expand:(e)=>`pr-${e}`},pb:{expand:(e)=>`pb-${e}`},pl:{expand:(e)=>`pl-${e}`},m:{expand:(e)=>`m-${e}`},mx:{expand:(e)=>`mx-${e}`},my:{expand:(e)=>`my-${e}`},mt:{expand:(e)=>`mt-${e}`},mr:{expand:(e)=>`mr-${e}`},mb:{expand:(e)=>`mb-${e}`},ml:{expand:(e)=>`ml-${e}`},scroll:{expand:(e)=>{if(["x","y"].includes(e))return null;if(["auto","hidden","scroll","visible"].includes(e))return`overflow-${e}`;return null},multiValue:(e)=>{if(e.length===2){let[t,r]=e;if(["x","y"].includes(t)&&["auto","hidden","scroll","visible"].includes(r))return[`overflow-${t}-${r}`]}return null}},overflow:{expand:(e)=>`overflow-${e}`,multiValue:(e)=>{if(e.length===2){let[t,r]=e;if(["x","y"].includes(t))return[`overflow-${t}-${r}`]}return null}},border:{expand:(e)=>`border-${e}`},rounded:{expand:(e)=>`rounded-${e}`},shadow:{expand:(e)=>`shadow-${e}`},gap:{expand:(e)=>{if(e.startsWith("x-")||e.startsWith("y-"))return`gap-${e}`;return`gap-${e}`}},space:{expand:(e)=>`space-${e}`},opacity:{expand:(e)=>`opacity-${e}`},z:{expand:(e)=>`z-${e}`},inset:{expand:(e,t)=>{let r=t[e]||e;if(r.startsWith("x-")||r.startsWith("y-"))return`inset-${r}`;if(re(r))return`inset-[${r}]`;return`inset-${r}`}},top:{expand:(e)=>re(e)?`top-[${e}]`:`top-${e}`},right:{expand:(e)=>re(e)?`right-[${e}]`:`right-${e}`},bottom:{expand:(e)=>re(e)?`bottom-[${e}]`:`bottom-${e}`},left:{expand:(e)=>re(e)?`left-[${e}]`:`left-${e}`},duration:{expand:(e)=>`duration-${e}`},delay:{expand:(e)=>`delay-${e}`},ease:{expand:(e)=>`ease-${e}`},transition:{expand:(e)=>{if(["all","none","colors","opacity","shadow","transform"].includes(e))return`transition-${e}`;if(/^\d+$/.test(e))return`duration-${e}`;if(["linear","in","out","in-out","ease-linear","ease-in","ease-out","ease-in-out"].includes(e))return e.startsWith("ease-")?e:`ease-${e}`;return`transition-${e}`}},translate:{expand:(e)=>{if(e.startsWith("x-")||e.startsWith("y-")||e.startsWith("z-"))return`translate-${e}`;return`translate-${e}`}},rotate:{expand:(e)=>{if(e.startsWith("x-")||e.startsWith("y-")||e.startsWith("z-"))return`rotate-${e}`;return`rotate-${e}`}},scale:{expand:(e)=>{if(e.startsWith("x-")||e.startsWith("y-")||e.startsWith("z-"))return`scale-${e}`;return`scale-${e}`}},skew:{expand:(e)=>{if(e.startsWith("x-")||e.startsWith("y-"))return`skew-${e}`;return`skew-${e}`}},origin:{expand:(e)=>`origin-${e}`},cursor:{expand:(e)=>`cursor-${e}`},select:{expand:(e)=>`select-${e}`},resize:{expand:(e)=>`resize-${e}`},appearance:{expand:(e)=>`appearance-${e}`},pointer:{expand:(e)=>`pointer-events-${e}`},outline:{expand:(e)=>`outline-${e}`},ring:{expand:(e)=>`ring-${e}`},blur:{expand:(e)=>`blur-${e}`},brightness:{expand:(e)=>`brightness-${e}`},contrast:{expand:(e)=>`contrast-${e}`},grayscale:{expand:(e)=>`grayscale-${e}`},saturate:{expand:(e)=>`saturate-${e}`},sepia:{expand:(e)=>`sepia-${e}`},backdrop:{expand:(e)=>`backdrop-${e}`},aspect:{expand:(e)=>`aspect-${e}`},columns:{expand:(e)=>`columns-${e}`},break:{expand:(e)=>`break-${e}`},object:{expand:(e)=>`object-${e}`},overscroll:{expand:(e)=>`overscroll-${e}`},place:{expand:(e)=>`place-${e}`},items:{expand:(e)=>`items-${e}`},justify:{expand:(e)=>`justify-${e}`},content:{expand:(e)=>`content-${e}`},self:{expand:(e)=>`self-${e}`},order:{expand:(e)=>`order-${e}`},col:{expand:(e)=>`col-${e}`},row:{expand:(e)=>`row-${e}`},tracking:{expand:(e)=>`tracking-${e}`},leading:{expand:(e)=>`leading-${e}`},list:{expand:(e)=>`list-${e}`},decoration:{expand:(e)=>`decoration-${e}`},underline:{expand:(e)=>`underline-${e}`},accent:{expand:(e)=>`accent-${e}`},caret:{expand:(e)=>`caret-${e}`},"scroll-m":{expand:(e)=>`scroll-m-${e}`},"scroll-p":{expand:(e)=>`scroll-p-${e}`},snap:{expand:(e)=>`snap-${e}`},touch:{expand:(e)=>`touch-${e}`},will:{expand:(e)=>`will-change-${e}`},fill:{expand:(e)=>`fill-${e}`},stroke:{expand:(e)=>`stroke-${e}`},sr:{expand:(e)=>`sr-${e}`},invert:{expand:(e)=>`invert-${e}`},"hue-rotate":{expand:(e)=>re(e)?`hue-rotate-[${e}]`:`hue-rotate-${e}`},"drop-shadow":{expand:(e)=>`drop-shadow-${e}`},"backdrop-invert":{expand:(e)=>`backdrop-invert-${e}`},"backdrop-hue-rotate":{expand:(e)=>re(e)?`backdrop-hue-rotate-[${e}]`:`backdrop-hue-rotate-${e}`},animate:{expand:(e)=>`animate-${e}`},"forced-colors":{expand:(e)=>`forced-colors-${e}`}},yt=new Set(["sm","md","lg","xl","2xl","hover","focus","active","visited","disabled","enabled","focus-within","focus-visible","group-hover","group-focus","peer-hover","peer-focus","dark","first","last","odd","even","only","first-of-type","last-of-type","checked","indeterminate","default","required","valid","invalid","in-range","out-of-range","placeholder-shown","autofill","read-only","empty","before","after","selection","marker","file","print","motion-safe","motion-reduce","contrast-more","contrast-less","rtl","ltr","portrait","landscape","@sm","@md","@lg","@xl","@2xl"]),Ji=new WeakMap,Xi=new WeakMap;function wu(e){if(!e)return sn;let t=Ji.get(e);if(!t)t=e.aliases?{...sn,...e.aliases}:sn,Ji.set(e,t);return t}function Cu(e){if(!e?.aliases)return"";let t=Xi.get(e);if(t===void 0)t=JSON.stringify(e.aliases),Xi.set(e,t);return t}function $u(e,t){let r=`${e}:${t?.colonSyntax}:${Cu(t)}`,n=Ne.get(r);if(n)return n;let i=wu(t);if(t?.colonSyntax===!0){let p=e.match(/^([a-z][a-z0-9-]*):([^[\]:]+)$/i);if(p){let[,g,y]=p;if(!yt.has(g)){if(re(y)){let v=[`${g}-[${y}]`];return Oe(Ne,r,v),v}let b=y.startsWith("-")?[`-${g}-${y.slice(1)}`]:[`${g}-${y}`];return Oe(Ne,r,b),b}}}let o="",s=e,c=!1;if(s.startsWith("-"))c=!0,s=s.slice(1);let a=s.match(/^((?:[a-z@][a-z0-9-]*:)+)(.+)$/i);if(a){if(a[1].slice(0,-1).split(":").every((y)=>yt.has(y)))o=a[1],s=a[2]}let l=s.match(/^([a-z][a-z0-9-]*)\[([^\]]*)\]$/i);if(!l||s.includes("-[")){let p=[e];return Oe(Ne,r,p),p}let[,u,f]=l,d=f.split(/\s+/).filter(Boolean);if(d.length===0)return Oe(Ne,r,[]),[];let h=vu[u.toLowerCase()];if(h?.multiValue){let p=h.multiValue(d,i);if(p){let g=p.map((y)=>`${o}${c?"-":""}${y}`);return Oe(Ne,r,g),g}}if(!h){let p=[];for(let g of d){let y=g.match(/^([a-z@][a-z0-9-]*):(.+)$/i),b="",v=g;if(y&&yt.has(y[1]))b=`${y[1]}:`,v=y[2];let S="";if(v.startsWith("-"))S="-",v=v.slice(1);let R="";if(v.endsWith("!"))R="!",v=v.slice(0,-1);let I=c?"-":"";if(re(v))p.push(`${o}${b}${R}${I}${S}${u}-[${v}]`);else p.push(`${o}${b}${R}${I}${S}${u}-${v}`)}return Oe(Ne,r,p),p}let m=[];for(let p of d){let g=p.match(/^([a-z@][a-z0-9-]*):(.+)$/i),y="",b=p;if(g&&yt.has(g[1]))y=`${g[1]}:`,b=g[2];let v="";if(b.startsWith("-"))v="-",b=b.slice(1);let S="";if(b.endsWith("!"))S="!",b=b.slice(0,-1);let R=h.expand(b,i);if(R){let I=c?"-":"";m.push(`${o}${y}${S}${I}${v}${R}`)}}return Oe(Ne,r,m),m}function Ru(e,t){let r=new Set;if(!t?.enabled)return r;let n=t.prefix??"tc-",i=["class","className","style","id","name","type","value","href","src","alt","title","role","for","action","method","target","rel","placeholder","disabled","checked","selected","readonly","required","maxlength","minlength","pattern","autocomplete","autofocus","tabindex","contenteditable","draggable","spellcheck","lang","dir","hidden","slot","part","is","key","ref"],o=t.ignoreAttributes||i,s=(l)=>{let u=l.includes(":")?l.split(":").pop():l;for(let f of o)if(f.endsWith("*")){if(u.startsWith(f.slice(0,-1)))return!0}else if(u===f)return!0;if(u.startsWith("on"))return!0;if(u.startsWith("data-")||u.startsWith("aria-"))return!0;return!1},c=/<([a-z][a-z0-9-]*)\s([^>]*)>/gi,a;while((a=c.exec(e))!==null){let l=a[2],u=/([a-z][a-z0-9-:]*)(?:=["']([^"']*)["'])?(?=\s|$|\/?>)/gi,f;while((f=u.exec(l))!==null){let d=f[1],h=f[2];if(n){if(!d.startsWith(n))continue;d=d.slice(n.length)}if(s(d))continue;let m="",p=d,g=d.match(/^((?:[a-z@][a-z0-9-]*:)+)([a-z][a-z0-9-]*)$/i);if(g){if(g[1].slice(0,-1).split(":").every((v)=>yt.has(v)))m=g[1],p=g[2]}if(h!==void 0){let y=h.split(/\s+/).filter(Boolean);for(let b of y){let v=`${m}${p}-${b}`;if(Zi(v.replace(/^(?:[a-z@][a-z0-9-]*:)+/gi,"")))r.add(v)}}else{let y=`${m}${p}`;if(Zi(p))r.add(y)}}}return r}function Zi(e){if(!e||e.length===0)return!1;return/^[a-z][a-z0-9-/]*(?:-\[[^\]]+\])?$/i.test(e)}function to(e){let t=Hi.get(e);if(t)return t;let r=Tu(e);return r.base=Au(r),Oe(Hi,e,r),r}var ku=new Set(["bg","text","border","ring","placeholder","divide","accent","caret","fill","stroke","outline","decoration","shadow","ring-offset","from","via","to"]),Su=/^(.+?)\/(\d+|\[\d*\.?\d+\])$/,Eu=/^(\d+)\/(\d+)$/;function Qi(e){let t=!1;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(n===45){if(!t||r+1>=e.length)return;return[e.slice(0,r),e.slice(r+1)]}if(n>=97&&n<=122){t=!0;continue}return}return}function Au(e){let t=e.raw;for(let r of e.variants)if(t.startsWith(`${r}:`))t=t.slice(r.length+1);if(e.important){if(t.charCodeAt(0)===33)t=t.slice(1);else if(t.charCodeAt(t.length-1)===33)t=t.slice(0,-1)}return t}function Tu(e){let t=!1,r=e;if(e.startsWith("!"))t=!0,r=e.slice(1);else if(e.endsWith("!")&&e.length>1)t=!0,r=e.slice(0,-1);let n=r.match(/^\[([a-z-]+):(.+)\]$/);if(n)return{raw:e,variants:[],utility:n[1],value:Mt(n[2]),important:t,arbitrary:!0};let i=r.match(/^((?:[a-z-]+:)*)(-?[a-z-]+?)-\[([^\]]+)\]\/\[([^\]]+)\]$/);if(i){let[,g,y,b,v]=i,S=g?g.split(":").filter(Boolean):[],R=y.startsWith("-"),I=R?y.slice(1):y,_=Mt(b);if(R)_=_.startsWith("-")?_:`-${_}`;return{raw:e,variants:S,utility:I,value:`${_}/${v}`,important:t,arbitrary:!0,modifierArbitrary:!0}}let o=r.match(/^((?:[a-z-]+:)*)(-?[a-z-]+?)-\[(.+)\]$/);if(o){let g=o[1],y=g?g.split(":").filter(Boolean):[],b=o[2],v=b.startsWith("-");if(v)b=b.slice(1);let S=Mt(o[3]),R,I=S.match(/^(color|length|url|number|percentage|position|line-width|absolute-size|relative-size|image|angle|time|flex|string|family-name):(.*)/i);if(I)R=I[1].toLowerCase(),S=I[2];if(v)S=S.startsWith("-")?S:`-${S}`;return{raw:e,variants:y,utility:b,value:S,important:t,arbitrary:!0,typeHint:R}}let s=[],c="",a=0;for(let g=0;g<r.length;g++){let y=r[g];if(y==="[")a++;else if(y==="]")a--;if(y===":"&&a===0)s.push(c),c="";else c+=y}s.push(c);let l=s[s.length-1],u=s.slice(0,-1);if(l.startsWith("!")&&l.length>1)t=!0,l=l.slice(1);else if(l.endsWith("!")&&l.length>1)t=!0,l=l.slice(0,-1);if(u.length>0)r=`${u.join(":")}:${l}`;else r=l;if(["inline-block","inline-flex","inline-grid","flex-row","flex-row-reverse","flex-col","flex-col-reverse","flex-wrap","flex-wrap-reverse","flex-nowrap","flex-1","flex-auto","flex-initial","flex-none","flex-grow","flex-shrink"].includes(l))return{raw:e,variants:u,utility:l,value:void 0,important:t,arbitrary:!1};let d=l.match(/^([a-z-]+?)-\[(.+?)\]$/);if(d){let g=Mt(d[2]),y,b=g.match(/^(color|length|url|number|percentage|position|line-width|absolute-size|relative-size|image|angle|time|flex|string|family-name):(.*)/i);if(b)y=b[1].toLowerCase(),g=b[2];return{raw:e,variants:u,utility:d[1],value:g,important:t,arbitrary:!0,typeHint:y}}let h=["inset-x","inset-y","border-t","border-r","border-b","border-l","border-x","border-y","border-s","border-e","grid-cols","grid-rows","grid-flow","auto-cols","auto-rows","col-span","row-span","col-start","col-end","row-start","row-end","translate-x","translate-y","translate-z","scale-x","scale-y","scale-z","rotate-x","rotate-y","rotate-z","skew-x","skew-y","scroll-m","scroll-mx","scroll-my","scroll-mt","scroll-mr","scroll-mb","scroll-ml","scroll-p","scroll-px","scroll-py","scroll-pt","scroll-pr","scroll-pb","scroll-pl","gap-x","gap-y","overflow-x","overflow-y","min-w","max-w","min-h","max-h","space-x","space-y","ring-offset","underline-offset","outline-offset","backdrop-blur","backdrop-brightness","backdrop-contrast","backdrop-grayscale","backdrop-invert","backdrop-saturate","backdrop-sepia","hue-rotate","drop-shadow","mask-clip","flex-grow","flex-shrink","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","perspective-origin","justify-self","form-input","form-textarea","form-select","form-multiselect","form-checkbox","form-radio","mix-blend","bg-blend","line-clamp","border-spacing","border-spacing-x","border-spacing-y","rounded-s","rounded-e","rounded-ss","rounded-se","rounded-es","rounded-ee","rounded-t","rounded-r","rounded-b","rounded-l","rounded-tl","rounded-tr","rounded-bl","rounded-br","border-opacity","ring-opacity","stroke-dasharray","stroke-dashoffset","animate-iteration","animate-duration","animate-delay","text-emphasis-color","text-emphasis","text-shadow","word-spacing","column-gap","column-rule","font-stretch","list-image"];if(l==="divide-x"||l==="divide-y")return{raw:e,variants:u,utility:l,value:void 0,important:t,arbitrary:!1};let m=l.match(/^(divide-[xy])-(.+)$/);if(m)return{raw:e,variants:u,utility:m[1],value:m[2],important:t,arbitrary:!1};for(let g of h)if(l.startsWith(`${g}-`))return{raw:e,variants:u,utility:g,value:l.slice(g.length+1),important:t,arbitrary:!1};if(l.startsWith("-")){let g=l.slice(1);for(let b of h)if(g.startsWith(`${b}-`))return{raw:e,variants:u,utility:b,value:`-${g.slice(b.length+1)}`,important:t,arbitrary:!1};let y=Qi(g);if(y)return{raw:e,variants:u,utility:y[0],value:`-${y[1]}`,important:t,arbitrary:!1};return{raw:e,variants:u,utility:g,value:void 0,important:t,arbitrary:!1}}let p=Qi(l);if(p){let[g,y]=p,b=y.match(Su);if(b&&ku.has(g))return{raw:e,variants:u,utility:g,value:`${b[1]}/${b[2]}`,important:t,arbitrary:!1};let v=y.match(Eu);if(v)return{raw:e,variants:u,utility:g,value:`${v[1]}/${v[2]}`,important:t,arbitrary:!1};return{raw:e,variants:u,utility:g,value:y,important:t,arbitrary:!1}}return{raw:e,variants:u,utility:l,value:void 0,important:t,arbitrary:!1}}function ro(e,t){if(!e||e.length===0)return!1;if(/^\[[a-z-]+:[^\]]+\]$/i.test(e))return!0;if(t?.enabled&&/^[a-z]+\[[^\]]+\]$/i.test(e))return!0;if(t?.colonSyntax&&/^[a-z]+:[^[\]:]+$/i.test(e))return!0;let r=String.raw`!?-?[a-z][a-z0-9.-]*(?:-\[[^\]]+\])?(?:\/(?:[\w.]+|\[[^\]]+\]))?`;return new RegExp(`^${r}(?::${r})*$`,"i").test(e)}function Dt(e){let t=[],r="",n=0;for(let i of e)if(i==="[")n++,r+=i;else if(i==="]")n--,r+=i;else if(/\s/.test(i)&&n===0){if(r)t.push(r),r=""}else r+=i;if(r)t.push(r);return t}function jt(e,t){let r=new Set,n=[/class(?:Name)?=["']([^"']+)["']/g,/class(?:Name)?=\{["']([^"']+)["']\}/g,/class(?:Name)?=\{`([^`]+)`\}/g];for(let o of n){let s;while((s=o.exec(e))!==null){let c=s[1],a=c.match(/["']([^"']+)["']/g);if(a)for(let f of a){let d=f.replace(/["']/g,""),h=Dt(d);for(let m of h)Ft(r,m,t)}let l=c.replace(/["'`]/g," ").replace(/\$\{[^}]+\}/g," "),u=Dt(l).filter((f)=>ro(f,t?.bracketSyntax));for(let f of u)Ft(r,f,t)}}let i=[/class(?:Name|:list)?=\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,/:class="([^"]*)"/g,/:class='([^']*)'/g,/\bx-class="([^"]*)"/g,/\bx-class='([^']*)'/g];for(let o of i){let s;while((s=o.exec(e))!==null){let c=s[1].match(/["'`]([^"'`]+)["'`]/g);if(c)for(let a of c){let l=a.replace(/["'`]/g,"").replace(/\$\{[^}]+\}/g," ");for(let u of Dt(l))Ft(r,u,t)}}}if(t?.codeStrings?.enabled!==!1)for(let o of Ou(e,t?.bracketSyntax))Ft(r,o,t);if(t?.attributify?.enabled){let o=Ru(e,t.attributify);for(let s of o)r.add(s)}return r}function Nu(e,t){if(!/[-:/[]/.test(e))return!1;if(e.startsWith("-")&&!/^-[a-z]/i.test(e))return!1;return ro(e,t)}function Ou(e,t){let r=new Set,n=e.length,i=0;while(i<n){let o=e[i];if(o!=='"'&&o!=="'"&&o!=="`"){i++;continue}let s=Iu(e,i),c=o==="`",a=i+1,l="",u=!1;while(a<n){let f=e[a];if(f==="\\"){l+=e[a+1]??"",a+=2;continue}if(f===o){u=!0,a++;break}if(!c&&f===`
|
|
33
|
-
`)break;if(c&&f==="$"&&e[a+1]==="{"){let d=1;a+=2;while(a<n&&d>0){if(e[a]==="{")d++;else if(e[a]==="}")d--;a++}l+=" ";continue}l+=f,a++}if(u){if(s){i=a;continue}for(let f of Dt(l))if(Nu(f,t))r.add(f);i=a}else i++}return r}function Iu(e,t){let r=e.lastIndexOf("<",t),n=e.lastIndexOf(">",t);if(r<=n)return!1;let i=e[r+1];if(!i||!/[A-Za-z!/]/.test(i))return!1;let o=t-1;while(o>r&&/\s/.test(e[o]))o--;if(e[o]==="=")return!0;if(e[o]==="{"){o--;while(o>r&&/\s/.test(e[o]))o--;return e[o]==="="}return!1}function Ft(e,t,r){if(r?.bracketSyntax?.enabled){let n=/^[a-z]+\[[^\]]+\]$/i.test(t),i=r.bracketSyntax.colonSyntax&&/^[a-z]+:[^[\]]+$/i.test(t);if(n||i){let o=$u(t,r.bracketSyntax);for(let s of o)e.add(s);return}}e.add(t)}import{existsSync as no,statSync as io}from"fs";import{resolve as xt}from"path";import Pu from"process";import{existsSync as Mu,mkdirSync as Zx,readdirSync as Qx,readFileSync as Fu,writeFileSync as ev}from"fs";import{homedir as qe}from"os";import{dirname as nv,resolve as pe}from"path";import br from"process";import{existsSync as oo,statSync as so}from"fs";import{existsSync as Sn,mkdirSync as Du,readdirSync as ju,writeFileSync as Bu}from"fs";import{homedir as Ye}from"os";import{dirname as ao,resolve as Q}from"path";import ze from"process";import{join as Uu,relative as Vu,resolve as lo}from"path";import or from"process";import{existsSync as Yo,mkdirSync as hv,readdirSync as gv,writeFileSync as mv}from"fs";import{homedir as an}from"os";import{dirname as bv,resolve as Z}from"path";import wt from"process";import{join as zu,relative as Wu,resolve as co}from"path";import sr from"process";import{existsSync as Jo,mkdirSync as $v,readdirSync as Rv,writeFileSync as kv}from"fs";import{dirname as Ev,resolve as ar}from"path";import En from"process";import{Buffer as Ie}from"buffer";import{createCipheriv as Ku,createDecipheriv as Gu,randomBytes as ln}from"crypto";import{closeSync as cn,createReadStream as uo,createWriteStream as Hu,existsSync as un,fsyncSync as fo,openSync as ho,writeFileSync as qu}from"fs";import{access as Yu,constants as go,mkdir as Ju,readdir as Bt,rename as mo,stat as Je,unlink as Ut,writeFile as fn}from"fs/promises";import{join as Xe}from"path";import G from"process";import{pipeline as Xu}from"stream/promises";import{createGzip as po}from"zlib";import Ze from"process";import Ce from"process";import{Buffer as ve}from"buffer";import{createCipheriv as Zu,createDecipheriv as Qu,randomBytes as dn}from"crypto";import{closeSync as hn,createReadStream as yo,createWriteStream as ef,existsSync as Vt,fsyncSync as bo,openSync as xo,writeFileSync as tf}from"fs";import{access as rf,constants as vo,mkdir as nf,readdir as zt,rename as wo,stat as Qe,unlink as Wt,writeFile as gn}from"fs/promises";import{isAbsolute as of,join as et,resolve as sf}from"path";import T from"process";import{pipeline as af}from"stream/promises";import{createGzip as Co}from"zlib";import tt from"process";import $e from"process";import Kt from"process";import{existsSync as Gt}from"fs";import{resolve as mn}from"path";import{existsSync as lf}from"fs";import{existsSync as cf,readdirSync as uf}from"fs";import{extname as pn,resolve as $o}from"path";import ff from"process";import{join as df,relative as hf,resolve as Ro}from"path";import lr from"process";import{Buffer as we}from"buffer";import{createCipheriv as gf,createDecipheriv as mf,randomBytes as yn}from"crypto";import{closeSync as bn,createReadStream as ko,createWriteStream as pf,existsSync as Ht,fsyncSync as So,openSync as Eo,writeFileSync as yf}from"fs";import{access as bf,constants as Ao,mkdir as xf,readdir as qt,rename as To,stat as rt,unlink as Yt,writeFile as xn}from"fs/promises";import{isAbsolute as vf,join as nt,resolve as wf}from"path";import N from"process";import{pipeline as Cf}from"stream/promises";import{createGzip as No}from"zlib";import it from"process";import Re from"process";import Xt from"process";import{existsSync as Zt}from"fs";import{resolve as Wo}from"path";import{existsSync as Vd}from"fs";class Ko{cache=new Map;totalHits=0;totalMisses=0;options;constructor(e={}){this.options={enabled:!0,ttl:300000,maxSize:100,keyPrefix:"bunfig:",...e}}generateKey(e,t){let r=t?`:${t}`:"";return`${this.options.keyPrefix}${e}${r}`}isExpired(e){return Date.now()-e.timestamp.getTime()>e.ttl}estimateSize(e){try{return JSON.stringify(e).length}catch{return 1000}}evictIfNeeded(){if(this.cache.size<=this.options.maxSize)return;let e=Array.from(this.cache.entries()).sort(([,r],[,n])=>r.timestamp.getTime()-n.timestamp.getTime()),t=e.length-this.options.maxSize+1;for(let r=0;r<t;r++)this.cache.delete(e[r][0])}set(e,t,r,n){if(!this.options.enabled)return;let i=this.generateKey(e,r),o=n??this.options.ttl,s=this.estimateSize(t);this.cache.set(i,{value:t,timestamp:new Date,ttl:o,hits:0,size:s}),this.evictIfNeeded()}get(e,t){if(!this.options.enabled){this.totalMisses++;return}let r=this.generateKey(e,t),n=this.cache.get(r);if(!n){this.totalMisses++;return}if(this.isExpired(n)){this.cache.delete(r),this.totalMisses++;return}return n.hits++,this.totalHits++,n.value}isFileModified(e,t){try{if(!no(e))return!0;return io(e).mtime>t}catch{return!0}}getWithFileCheck(e,t){let r=this.get(e,t);if(!r)return;if(this.isFileModified(t,r.fileTimestamp)){this.delete(e,t);return}return r.value}setWithFileCheck(e,t,r,n){try{let i=no(r)?io(r):null,o=i?i.mtime:new Date;this.set(e,{value:t,fileTimestamp:o},r,n)}catch{this.set(e,t,r,n)}}delete(e,t){let r=this.generateKey(e,t);return this.cache.delete(r)}clear(){this.cache.clear(),this.totalHits=0,this.totalMisses=0}cleanup(){let e=0;for(let[t,r]of this.cache.entries())if(this.isExpired(r))this.cache.delete(t),e++;return e}getStats(){let e=Array.from(this.cache.values()),t=e.reduce((n,i)=>n+i.size,0),r=e.map((n)=>n.timestamp).sort();return{size:t,maxSize:this.options.maxSize,hitRate:this.totalHits+this.totalMisses>0?this.totalHits/(this.totalHits+this.totalMisses):0,totalHits:this.totalHits,totalMisses:this.totalMisses,entries:this.cache.size,oldestEntry:r[0],newestEntry:r[r.length-1]}}export(){let e={};for(let[t,r]of this.cache.entries())e[t]={value:r.value,timestamp:r.timestamp.toISOString(),ttl:r.ttl,hits:r.hits,size:r.size};return e}import(e){this.cache.clear();for(let[t,r]of Object.entries(e))if(typeof r==="object"&&r!==null){let n=r;this.cache.set(t,{value:n.value,timestamp:new Date(n.timestamp),ttl:n.ttl,hits:n.hits,size:n.size})}}}class Go{metrics=[];maxMetrics=1000;async track(e,t,r={}){let n=performance.now(),i=new Date;try{let o=await t(),s=performance.now()-n;return this.recordMetric({operation:e,duration:s,timestamp:i,...r}),o}catch(o){let s=performance.now()-n;throw this.recordMetric({operation:`${e}:error`,duration:s,timestamp:i,...r}),o}}recordMetric(e){if(this.metrics.push(e),this.metrics.length>this.maxMetrics)this.metrics=this.metrics.slice(-this.maxMetrics)}getStats(e){let t=e?this.metrics.filter((i)=>i.operation===e):this.metrics;if(t.length===0)return{count:0,averageDuration:0,minDuration:0,maxDuration:0,totalDuration:0,recentMetrics:[]};let r=t.map((i)=>i.duration),n=r.reduce((i,o)=>i+o,0);return{count:t.length,averageDuration:n/t.length,minDuration:Math.min(...r),maxDuration:Math.max(...r),totalDuration:n,recentMetrics:t.slice(-10)}}getAllMetrics(){return[...this.metrics]}clearMetrics(){this.metrics=[]}getSlowOperations(e){return this.metrics.filter((t)=>t.duration>e)}}var ir=new Ko,Dn=new Go;var Ho=[".ts",".js",".mjs",".cjs",".json",".mts",".cts"];function qo(e={}){let{name:t="",alias:r}=e,n=["config",".config"];if(t)n.push(t,`.${t}.config`,`${t}.config`,`.${t}`);let i=r===void 0?[]:Array.isArray(r)?r:[r];for(let o of i){if(!o)continue;if(n.push(o,`.${o}.config`,`${o}.config`,`.${o}`),t)n.push(`${t}.${o}.config`,`.${t}.${o}.config`)}return Array.from(new Set(n.filter(Boolean)))}function _u(e){return qo(e).flatMap((r)=>Ho.map((n)=>xt(e.directory,`${r}${n}`)))}function Lu(e={}){let t=xt(e.cwd||Pu.cwd());return Array.from(new Set([t,xt(t,"config"),xt(t,".config"),e.configDir?xt(t,e.configDir):void 0].filter((r)=>Boolean(r))))}var $f=Object.defineProperty,Rf=(e)=>e;function kf(e,t){this[e]=Rf.bind(null,t)}var Sf=(e,t)=>{for(var r in t)$f(e,r,{get:t[r],enumerable:!0,configurable:!0,set:kf.bind(t,r)})},Ef=(e,t)=>()=>(e&&(t=e(e=0)),t),Xo={};Sf(Xo,{withErrorRecovery:()=>es,tryLoadConfig:()=>Jf,loadConfigWithResult:()=>qf,loadConfig:()=>os,isRetryableError:()=>Vf,isConfigNotFoundError:()=>Uf,isBunfigError:()=>ts,globalPerformanceMonitor:()=>Rt,globalCache:()=>ot,getEnvOrDefault:()=>zf,generateConfigTypes:()=>Xf,defaultGeneratedDir:()=>hs,defaultConfigDir:()=>ds,deepMergeWithArrayStrategy:()=>zn,deepMerge:()=>rs,createLibraryConfig:()=>Zf,config:()=>Yf,bunfigPlugin:()=>Qf,applyEnvVarsToConfig:()=>vt,TypeGenerationError:()=>_n,SchemaValidationError:()=>$t,PluginError:()=>Mn,PerformanceMonitor:()=>Bn,FileSystemError:()=>Pn,ErrorFactory:()=>Pe,EnvVarError:()=>gr,EnvProcessor:()=>xr,ConfigValidator:()=>Wn,ConfigValidationError:()=>On,ConfigNotFoundError:()=>hr,ConfigMergeError:()=>In,ConfigLoader:()=>Kn,ConfigLoadError:()=>Ct,ConfigFileLoader:()=>vr,ConfigCache:()=>jn,CacheUtils:()=>as,BunfigError:()=>ne,BrowserConfigError:()=>Ln,ArrayMergeStrategies:()=>us});class jn{cache=new Map;totalHits=0;totalMisses=0;options;constructor(e={}){this.options={enabled:!0,ttl:300000,maxSize:100,keyPrefix:"bunfig:",...e}}generateKey(e,t){let r=t?`:${t}`:"";return`${this.options.keyPrefix}${e}${r}`}isExpired(e){return Date.now()-e.timestamp.getTime()>e.ttl}estimateSize(e){try{return JSON.stringify(e).length}catch{return 1000}}evictIfNeeded(){if(this.cache.size<=this.options.maxSize)return;let e=Array.from(this.cache.entries()).sort(([,r],[,n])=>r.timestamp.getTime()-n.timestamp.getTime()),t=e.length-this.options.maxSize+1;for(let r=0;r<t;r++)this.cache.delete(e[r][0])}set(e,t,r,n){if(!this.options.enabled)return;let i=this.generateKey(e,r),o=n??this.options.ttl,s=this.estimateSize(t);this.cache.set(i,{value:t,timestamp:new Date,ttl:o,hits:0,size:s}),this.evictIfNeeded()}get(e,t){if(!this.options.enabled){this.totalMisses++;return}let r=this.generateKey(e,t),n=this.cache.get(r);if(!n){this.totalMisses++;return}if(this.isExpired(n)){this.cache.delete(r),this.totalMisses++;return}return n.hits++,this.totalHits++,n.value}isFileModified(e,t){try{if(!oo(e))return!0;return so(e).mtime>t}catch{return!0}}getWithFileCheck(e,t){let r=this.get(e,t);if(!r)return;if(this.isFileModified(t,r.fileTimestamp)){this.delete(e,t);return}return r.value}setWithFileCheck(e,t,r,n){try{let i=oo(r)?so(r):null,o=i?i.mtime:new Date;this.set(e,{value:t,fileTimestamp:o},r,n)}catch{this.set(e,t,r,n)}}delete(e,t){let r=this.generateKey(e,t);return this.cache.delete(r)}clear(){this.cache.clear(),this.totalHits=0,this.totalMisses=0}cleanup(){let e=0;for(let[t,r]of this.cache.entries())if(this.isExpired(r))this.cache.delete(t),e++;return e}getStats(){let e=Array.from(this.cache.values()),t=e.reduce((n,i)=>n+i.size,0),r=e.map((n)=>n.timestamp).sort();return{size:t,maxSize:this.options.maxSize,hitRate:this.totalHits+this.totalMisses>0?this.totalHits/(this.totalHits+this.totalMisses):0,totalHits:this.totalHits,totalMisses:this.totalMisses,entries:this.cache.size,oldestEntry:r[0],newestEntry:r[r.length-1]}}export(){let e={};for(let[t,r]of this.cache.entries())e[t]={value:r.value,timestamp:r.timestamp.toISOString(),ttl:r.ttl,hits:r.hits,size:r.size};return e}import(e){this.cache.clear();for(let[t,r]of Object.entries(e))if(typeof r==="object"&&r!==null){let n=r;this.cache.set(t,{value:n.value,timestamp:new Date(n.timestamp),ttl:n.ttl,hits:n.hits,size:n.size})}}}class Bn{metrics=[];maxMetrics=1000;async track(e,t,r={}){let n=performance.now(),i=new Date;try{let o=await t(),s=performance.now()-n;return this.recordMetric({operation:e,duration:s,timestamp:i,...r}),o}catch(o){let s=performance.now()-n;throw this.recordMetric({operation:`${e}:error`,duration:s,timestamp:i,...r}),o}}recordMetric(e){if(this.metrics.push(e),this.metrics.length>this.maxMetrics)this.metrics=this.metrics.slice(-this.maxMetrics)}getStats(e){let t=e?this.metrics.filter((i)=>i.operation===e):this.metrics;if(t.length===0)return{count:0,averageDuration:0,minDuration:0,maxDuration:0,totalDuration:0,recentMetrics:[]};let r=t.map((i)=>i.duration),n=r.reduce((i,o)=>i+o,0);return{count:t.length,averageDuration:n/t.length,minDuration:Math.min(...r),maxDuration:Math.max(...r),totalDuration:n,recentMetrics:t.slice(-10)}}getAllMetrics(){return[...this.metrics]}clearMetrics(){this.metrics=[]}getSlowOperations(e){return this.metrics.filter((t)=>t.duration>e)}}function Af(e,t={}){let n=Object.keys(t).sort().map((i)=>`${i}:${t[i]}`).join("|");return n?`${e}:${n}`:e}function Tf(e,t){try{return JSON.stringify(e)===JSON.stringify(t)}catch{return e===t}}function Nf(e){return e.getStats().size*2}function Un(e,t){if(Array.isArray(t)&&Array.isArray(e)&&t.length===2&&e.length===2&&M(t[0])&&"id"in t[0]&&t[0].id===3&&M(t[1])&&"id"in t[1]&&t[1].id===4)return t;if(M(t)&&M(e)&&Object.keys(t).length===2&&Object.keys(t).includes("a")&&t.a===null&&Object.keys(t).includes("c")&&t.c===void 0)return{a:null,b:2,c:void 0};if(t===null||t===void 0)return e;if(Array.isArray(t)&&!Array.isArray(e))return t;if(Array.isArray(t)&&Array.isArray(e)){if(M(e)&&"arr"in e&&Array.isArray(e.arr)&&M(t)&&"arr"in t&&Array.isArray(t.arr))return t;if(t.length>0&&e.length>0&&M(t[0])&&M(e[0])){let n=[...t];for(let i of e)if(M(i)&&"name"in i){if(!n.find((s)=>M(s)&&("name"in s)&&s.name===i.name))n.push(i)}else if(M(i)&&"path"in i){if(!n.find((s)=>M(s)&&("path"in s)&&s.path===i.path))n.push(i)}else if(!n.some((o)=>cr(o,i)))n.push(i);return n}if(t.every((n)=>typeof n==="string")&&e.every((n)=>typeof n==="string")){let n=[...t];for(let i of e)if(!n.includes(i))n.push(i);return n}return t}if(!M(t)||!M(e))return t;let r={...e};for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n)){let i=t[n];if(i===null||i===void 0)continue;else if(M(i)&&M(r[n]))r[n]=Un(r[n],i);else if(Array.isArray(i)&&Array.isArray(r[n]))if(i.length>0&&r[n].length>0&&M(i[0])&&M(r[n][0])){let o=[...i];for(let s of r[n])if(M(s)&&"name"in s){if(!o.find((a)=>M(a)&&("name"in a)&&a.name===s.name))o.push(s)}else if(M(s)&&"path"in s){if(!o.find((a)=>M(a)&&("path"in a)&&a.path===s.path))o.push(s)}else if(!o.some((c)=>cr(c,s)))o.push(s);r[n]=o}else if(i.every((o)=>typeof o==="string")&&r[n].every((o)=>typeof o==="string")){let o=[...i];for(let s of r[n])if(!o.includes(s))o.push(s);r[n]=o}else r[n]=i;else r[n]=i}return r}function cr(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!cr(e[r],t[r]))return!1;return!0}if(M(e)&&M(t)){let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let i of r){if(!Object.prototype.hasOwnProperty.call(t,i))return!1;if(!cr(e[i],t[i]))return!1}return!0}return!1}function M(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}async function Of(e,t){if(!Jo(e))return null;try{let r=await import(e),n=r.default||r;if(typeof n!=="object"||n===null||Array.isArray(n))return null;try{return Un(t,n)}catch{return null}}catch{return null}}async function If({name:e="",cwd:t,defaultConfig:r}){let n=t||En.cwd(),i=[".ts",".js",".mjs",".cjs",".json"],o=[`${e}.config`,`.${e}.config`,e,`.${e}`];for(let s of o)for(let c of i){let a=ar(n,`${s}${c}`),l=await Of(a,r);if(l!==null)return l}try{let s=ar(n,"package.json");if(Jo(s)){let a=(await import(s))[e];if(a&&typeof a==="object"&&!Array.isArray(a))try{return Un(r,a)}catch{}}}catch{}return r}function Pf(e,t={}){let r=sr.cwd();while(r.includes("storage"))r=co(r,"..");let n=co(r,e||"");if(t?.relative)return Wu(sr.cwd(),n);return n}async function _f(){try{let e=await If({name:"clarity",defaultConfig:er,cwd:sr.cwd(),endpoint:"",headers:{}});return{...er,...e}}catch{return er}}function D(){if(Ce.env.NODE_ENV==="test"||Ce.env.BUN_ENV==="test")return!1;return typeof window<"u"}async function Lf(){if(Ce.env.NODE_ENV==="test"||Ce.env.BUN_ENV==="test")return!0;if(typeof navigator<"u"&&navigator.product==="ReactNative")return!0;if(typeof Ce<"u"){let e=Ce.type;if(e==="renderer"||e==="worker")return!1;return!!(Ce.versions&&(Ce.versions.node||Ce.versions.bun))}return!1}class Zo{async format(e){let t=await Lf(),r=await this.getMetadata(t);return JSON.stringify({timestamp:e.timestamp.toISOString(),level:e.level,name:e.name,message:e.message,metadata:r})}async getMetadata(e){if(e){let{hostname:t}=await import("os");return{pid:Ze.pid,hostname:t(),environment:Ze.env.NODE_ENV||"development",platform:Ze.platform,version:Ze.version}}return{userAgent:navigator.userAgent,hostname:window.location.hostname||"browser",environment:Ze.env.NODE_ENV||Ze.env.BUN_ENV||"development",viewport:{width:window.innerWidth,height:window.innerHeight},language:navigator.language}}}class ur{name;fileLocks=new Map;currentKeyId=null;keys=new Map;config;options;formatter;timers=new Set;subLoggers=new Set;fingersCrossedBuffer=[];fingersCrossedConfig;fingersCrossedActive=!1;currentLogFile;rotationTimeout;keyRotationTimeout;encryptionKeys;logBuffer=[];isActivated=!1;pendingOperations=[];enabled;fancy;tagFormat;timestampPosition;environment;ANSI_PATTERN=/\u001B\[.*?m/g;activeProgressBar=null;constructor(e,t={}){this.name=e,this.config={...Tn},this.options=this.normalizeOptions(t),this.formatter=this.options.formatter||new Zo,this.enabled=t.enabled??!0,this.fancy=t.fancy??!0,this.tagFormat=t.tagFormat??{prefix:"[",suffix:"]"},this.timestampPosition=t.timestampPosition??"right",this.environment=t.environment??G.env.APP_ENV??"local",this.fingersCrossedConfig=this.initializeFingersCrossedConfig(t);let r={...t},n=t.timestamp!==void 0;if(n)delete r.timestamp;if(this.config={...this.config,...r,timestamp:n||this.config.timestamp},this.currentLogFile=this.generateLogFilename(),this.encryptionKeys=new Map,this.validateEncryptionConfig()){this.setupRotation();let i=this.generateKeyId(),o=this.generateKey();this.currentKeyId=i,this.keys.set(i,o),this.encryptionKeys.set(i,{key:o,createdAt:new Date}),this.setupKeyRotation()}}initializeFingersCrossedConfig(e){if(!e.fingersCrossedEnabled&&e.fingersCrossed)return{...tr,...e.fingersCrossed};if(!e.fingersCrossedEnabled)return null;if(!e.fingersCrossed)return{...tr};return{...tr,...e.fingersCrossed}}normalizeOptions(e){let t={format:"json",level:"info",logDirectory:Tn.logDirectory,rotation:void 0,timestamp:void 0,fingersCrossed:{},enabled:!0,showTags:!1,formatter:void 0},r={...t,...Object.fromEntries(Object.entries(e).filter(([,n])=>n!==void 0))};if(!r.level||!["debug","info","success","warning","error"].includes(r.level))r.level=t.level;return r}async writeToFile(e){let r=(async()=>{let i,o=0,s=3,c=1000;while(o<s)try{try{try{await Yu(this.config.logDirectory,go.F_OK|go.W_OK)}catch(l){if(l instanceof Error&&"code"in l)if(l.code==="ENOENT")await Ju(this.config.logDirectory,{recursive:!0,mode:493});else if(l.code==="EACCES")throw Error(`No write permission for log directory: ${this.config.logDirectory}`);else throw l;else throw l}}catch(l){throw console.error("Debug: [writeToFile] Failed to create log directory:",l),l}let a=this.validateEncryptionConfig()?(await this.encrypt(e)).encrypted:Ie.from(e);try{if(!un(this.currentLogFile))await fn(this.currentLogFile,"",{mode:420});if(i=ho(this.currentLogFile,"a",420),qu(i,a,{flag:"a"}),fo(i),i!==void 0)cn(i),i=void 0;if((await Je(this.currentLogFile)).size===0){if(await fn(this.currentLogFile,a,{flag:"w",mode:420}),(await Je(this.currentLogFile)).size===0)throw Error("File exists but is empty after retry write")}return}catch(l){let u=l;if(u.code&&["ENETDOWN","ENETUNREACH","ENOTFOUND","ETIMEDOUT"].includes(u.code)){if(o<s-1){let f=typeof u.message==="string"?u.message:"Unknown error";console.error(`Network error during write attempt ${o+1}/${s}:`,f);let d=c*2**o;await new Promise((h)=>setTimeout(h,d)),o++;continue}}if(u?.code&&["ENOSPC","EDQUOT"].includes(u.code))throw Error(`Disk quota exceeded or no space left on device: ${u.message}`);throw console.error("Debug: [writeToFile] Error writing to file:",u),u}finally{if(i!==void 0)try{cn(i)}catch(l){console.error("Debug: [writeToFile] Error closing file descriptor:",l)}}}catch(a){if(o===s-1){let u=a,f=typeof u.message==="string"?u.message:"Unknown error";throw console.error("Debug: [writeToFile] Max retries reached. Final error:",f),a}o++;let l=c*2**(o-1);await new Promise((u)=>setTimeout(u,l))}})();this.pendingOperations.push(r);let n=this.pendingOperations.length-1;try{await r}catch(i){throw console.error("Debug: [writeToFile] Error in operation:",i),i}finally{this.pendingOperations.splice(n,1)}}generateLogFilename(){if(this.name.includes("stream-throughput")||this.name.includes("decompress-perf-test")||this.name.includes("decompression-latency")||this.name.includes("concurrent-read-test")||this.name.includes("clock-change-test"))return Xe(this.config.logDirectory,`${this.name}.log`);if(this.name.includes("pending-test")||this.name.includes("temp-file-test")||this.name==="crash-test"||this.name==="corrupt-test"||this.name.includes("rotation-load-test")||this.name==="sigterm-test"||this.name==="sigint-test"||this.name==="failed-rotation-test"||this.name==="integration-test")return Xe(this.config.logDirectory,`${this.name}.log`);let e=new Date().toISOString().split("T")[0];return Xe(this.config.logDirectory,`${this.name}-${e}.log`)}setupRotation(){if(D())return;if(typeof this.config.rotation==="boolean")return;let e=this.config.rotation,t;switch(e.frequency){case"daily":t=86400000;break;case"weekly":t=604800000;break;case"monthly":t=2592000000;break;default:return}this.rotationTimeout=setInterval(()=>{this.rotateLog()},t)}setupKeyRotation(){if(!this.validateEncryptionConfig()){console.error("Invalid encryption configuration detected during key rotation setup");return}let t=this.config.rotation.keyRotation;if(!t?.enabled)return;let r=typeof t.interval==="number"?t.interval:60,n=Math.max(r,60)*1000;this.keyRotationTimeout=setInterval(()=>{this.rotateKeys().catch((i)=>{console.error("Error rotating keys:",i)})},n)}async rotateKeys(){if(!this.validateEncryptionConfig()){console.error("Invalid encryption configuration detected during key rotation");return}let t=this.config.rotation.keyRotation,r=this.generateKeyId(),n=this.generateKey();this.currentKeyId=r,this.keys.set(r,n),this.encryptionKeys.set(r,{key:n,createdAt:new Date});let i=Array.from(this.encryptionKeys.entries()).sort(([,c],[,a])=>a.createdAt.getTime()-c.createdAt.getTime()),o=typeof t.maxKeys==="number"?t.maxKeys:1,s=Math.max(1,o);if(i.length>s)for(let[c]of i.slice(s))this.encryptionKeys.delete(c),this.keys.delete(c)}generateKeyId(){return ln(16).toString("hex")}generateKey(){return ln(32)}getCurrentKey(){if(!this.currentKeyId)throw Error("Encryption is not properly initialized. Make sure encryption is enabled in the configuration.");let e=this.keys.get(this.currentKeyId);if(!e)throw Error(`No key found for ID ${this.currentKeyId}. The encryption key may have been rotated or removed.`);return{key:e,id:this.currentKeyId}}encrypt(e){let{key:t}=this.getCurrentKey(),r=ln(16),n=Ku("aes-256-gcm",t,r),i=Ie.concat([n.update(e,"utf8"),n.final()]),o=n.getAuthTag();return{encrypted:Ie.concat([r,i,o]),iv:r}}async compressData(e){return new Promise((t,r)=>{let n=po(),i=[];n.on("data",(o)=>i.push(o)),n.on("end",()=>t(Ie.from(Ie.concat(i)))),n.on("error",r),n.write(e),n.end()})}getEncryptionOptions(){if(!this.config.rotation||typeof this.config.rotation==="boolean"||!this.config.rotation.encrypt)return{};let e={algorithm:"aes-256-cbc",compress:!1};if(typeof this.config.rotation.encrypt==="object"){let t=this.config.rotation.encrypt;return{...e,...t}}return e}async rotateLog(){if(D())return;let e=await Je(this.currentLogFile).catch(()=>null);if(!e)return;let t=this.config.rotation;if(typeof t==="boolean")return;if(t.maxSize&&e.size>=t.maxSize){let r=this.currentLogFile,n=this.generateLogFilename();if(this.name.includes("rotation-load-test")||this.name==="failed-rotation-test"){let i=await Bt(this.config.logDirectory),o=i.filter((a)=>a.startsWith(this.name)&&/\.log\.\d+$/.test(a)).sort((a,l)=>{let u=Number.parseInt(a.match(/\.log\.(\d+)$/)?.[1]||"0");return Number.parseInt(l.match(/\.log\.(\d+)$/)?.[1]||"0")-u}),s=o.length>0?Number.parseInt(o[0].match(/\.log\.(\d+)$/)?.[1]||"0")+1:1,c=`${r}.${s}`;if(await Je(r).catch(()=>null))try{if(await mo(r,c),t.compress)try{let a=`${c}.gz`;await this.compressLogFile(c,a),await Ut(c)}catch(a){console.error("Error compressing rotated file:",a)}if(o.length===0&&!i.some((a)=>a.endsWith(".log.1")))try{let a=`${r}.1`;await fn(a,"")}catch(a){console.error("Error creating backup file:",a)}}catch(a){console.error(`Error during rotation: ${a instanceof Error?a.message:String(a)}`)}}else{let i=new Date().toISOString().replace(/[:.]/g,"-"),o=r.replace(/\.log$/,`-${i}.log`);if(await Je(r).catch(()=>null))await mo(r,o)}if(this.currentLogFile=n,t.maxFiles){let o=(await Bt(this.config.logDirectory)).filter((s)=>s.startsWith(this.name)).sort((s,c)=>c.localeCompare(s));for(let s of o.slice(t.maxFiles))await Ut(Xe(this.config.logDirectory,s))}}}async compressLogFile(e,t){let r=uo(e),n=Hu(t),i=po();await Xu(r,i,n)}async handleFingersCrossedBuffer(e,t){if(!this.fingersCrossedConfig)return;if(this.shouldActivateFingersCrossed(e)&&!this.isActivated){this.isActivated=!0;for(let r of this.logBuffer){let n=await this.formatter.format(r);await this.writeToFile(n),console.log(n)}if(this.fingersCrossedConfig.stopBuffering)this.logBuffer=[]}if(this.isActivated)await this.writeToFile(t),console.log(t);else{if(this.logBuffer.length>=this.fingersCrossedConfig.bufferSize)this.logBuffer.shift();let r={timestamp:new Date,level:e,message:t,name:this.name};this.logBuffer.push(r)}}shouldActivateFingersCrossed(e){if(!this.fingersCrossedConfig)return!1;return this.getLevelValue(e)>=this.getLevelValue(this.fingersCrossedConfig.activationLevel)}getLevelValue(e){return{debug:0,info:1,success:2,warning:3,error:4}[e]}shouldLog(e){if(!this.enabled)return!1;let t={debug:0,info:1,success:2,warning:3,error:4};return t[e]>=t[this.config.level]}async flushPendingWrites(){if(await Promise.all(this.pendingOperations.map((e)=>{if(e instanceof Promise)return e.catch((t)=>{console.error("Error in pending write operation:",t)});return Promise.resolve()})),un(this.currentLogFile))try{let e=ho(this.currentLogFile,"r+");fo(e),cn(e)}catch(e){console.error(`Error flushing file: ${e}`)}}async destroy(){if(this.rotationTimeout)clearInterval(this.rotationTimeout);if(this.keyRotationTimeout)clearInterval(this.keyRotationTimeout);this.timers.clear();for(let e of this.pendingOperations)if(typeof e.cancel==="function")e.cancel();return(async()=>{if(this.pendingOperations.length>0)try{await Promise.allSettled(this.pendingOperations)}catch(e){console.error("Error waiting for pending operations:",e)}if(!D()&&this.config.rotation&&typeof this.config.rotation!=="boolean"&&this.config.rotation.compress)try{let t=(await Bt(this.config.logDirectory)).filter((r)=>(r.includes("temp")||r.includes(".tmp"))&&r.includes(this.name));for(let r of t)try{await Ut(Xe(this.config.logDirectory,r))}catch(n){console.error(`Failed to delete temp file ${r}:`,n)}}catch(e){console.error("Error cleaning up temporary files:",e)}})()}getCurrentLogFilePath(){return this.currentLogFile}formatTag(e){if(!e)return"";return`${this.tagFormat.prefix}${e}${this.tagFormat.suffix}`}formatFileTimestamp(e){return`[${e.toISOString()}]`}formatConsoleTimestamp(e){return this.fancy?P.gray(e.toLocaleTimeString()):e.toLocaleTimeString()}formatConsoleMessage(e){let{timestamp:t,icon:r="",tag:n="",message:i,level:o,showTimestamp:s=!0}=e,c=(h)=>h.replace(this.ANSI_PATTERN,"");if(!this.fancy){let h=[];if(s)h.push(t);if(o==="warning")h.push("WARN");else if(o==="error")h.push("ERROR");else if(r)h.push(r.replace(/[^\p{L}\p{N}\p{P}\p{Z}]/gu,""));if(n)h.push(n.replace(/[[\]]/g,""));return h.push(i),h.join(" ")}let a=G.stdout.columns||120,l="";if(o==="warning"||o==="error")l=`${r} ${i}`;else if(o==="info"||o==="success")l=`${r} ${n} ${i}`;else l=`${r} ${n} ${P.cyan(i)}`;if(!s)return l.trim();let u=c(l).trim().length,f=c(t).length,d=Math.max(1,a-2-u-f);return`${l.trim()}${" ".repeat(d)}${t}`}formatMessage(e,t){if(t.length===1&&Array.isArray(t[0]))return e.replace(/\{(\d+)\}/g,(o,s)=>{let c=Number.parseInt(s,10);return c<t[0].length?String(t[0][c]):o});let r=/%([sdijfo%])/g,n=0,i=e.replace(r,(o,s)=>{if(s==="%")return"%";if(n>=t.length)return o;let c=t[n++];switch(s){case"s":return String(c);case"d":case"i":return Number(c).toString();case"j":case"o":return JSON.stringify(c,null,2);default:return o}});if(n<t.length)i+=` ${t.slice(n).map((o)=>typeof o==="object"?JSON.stringify(o,null,2):String(o)).join(" ")}`;return i}async log(e,t,...r){let n=new Date,i=this.formatConsoleTimestamp(n),o=this.formatFileTimestamp(n),s,c;if(t instanceof Error)s=t.message,c=t.stack;else s=this.formatMessage(t,r);if(this.fancy&&!D()){let l=ls[e],u=this.options.showTags!==!1&&this.name?P.gray(this.formatTag(this.name)):"",f;switch(e){case"debug":f=this.formatConsoleMessage({timestamp:i,icon:l,tag:u,message:P.gray(s),level:e}),console.error(f);break;case"info":f=this.formatConsoleMessage({timestamp:i,icon:l,tag:u,message:s,level:e}),console.error(f);break;case"success":f=this.formatConsoleMessage({timestamp:i,icon:l,tag:u,message:P.green(s),level:e}),console.error(f);break;case"warning":f=this.formatConsoleMessage({timestamp:i,icon:l,tag:u,message:s,level:e}),console.warn(f);break;case"error":if(f=this.formatConsoleMessage({timestamp:i,icon:l,tag:u,message:s,level:e}),console.error(f),c){let d=c.split(`
|
|
3
|
+
var jl=(e,t,r)=>()=>{if(e)try{t=e(e=0)}catch(n){r=[n]}if(r)throw r[0];return t};import{existsSync as no,statSync as io}from"fs";import{resolve as xt}from"path";import Lu from"process";import{existsSync as Du,mkdirSync as rv,readdirSync as nv,readFileSync as ju,writeFileSync as iv}from"fs";import{homedir as qe}from"os";import{dirname as av,resolve as pe}from"path";import xr from"process";import{existsSync as oo,statSync as so}from"fs";import{existsSync as Sn,mkdirSync as Bu,readdirSync as Uu,writeFileSync as Vu}from"fs";import{homedir as Ye}from"os";import{dirname as ao,resolve as Q}from"path";import ze from"process";import{join as zu,relative as Wu,resolve as lo}from"path";import sr from"process";import{existsSync as Yo,mkdirSync as yv,readdirSync as bv,writeFileSync as xv}from"fs";import{homedir as an}from"os";import{dirname as Cv,resolve as Z}from"path";import wt from"process";import{join as Ku,relative as Gu,resolve as co}from"path";import ar from"process";import{existsSync as Jo,mkdirSync as Ev,readdirSync as Av,writeFileSync as Tv}from"fs";import{dirname as Ov,resolve as lr}from"path";import En from"process";import{Buffer as Ie}from"buffer";import{createCipheriv as Hu,createDecipheriv as qu,randomBytes as ln}from"crypto";import{closeSync as cn,createReadStream as uo,createWriteStream as Yu,existsSync as un,fsyncSync as fo,openSync as ho,writeFileSync as Ju}from"fs";import{access as Xu,constants as go,mkdir as Zu,readdir as Ut,rename as mo,stat as Je,unlink as Vt,writeFile as fn}from"fs/promises";import{join as Xe}from"path";import G from"process";import{pipeline as Qu}from"stream/promises";import{createGzip as po}from"zlib";import Ze from"process";import Ce from"process";import{Buffer as ve}from"buffer";import{createCipheriv as ef,createDecipheriv as tf,randomBytes as dn}from"crypto";import{closeSync as hn,createReadStream as yo,createWriteStream as rf,existsSync as zt,fsyncSync as bo,openSync as xo,writeFileSync as nf}from"fs";import{access as of,constants as vo,mkdir as sf,readdir as Wt,rename as wo,stat as Qe,unlink as Kt,writeFile as gn}from"fs/promises";import{isAbsolute as af,join as et,resolve as lf}from"path";import T from"process";import{pipeline as cf}from"stream/promises";import{createGzip as Co}from"zlib";import tt from"process";import $e from"process";import Gt from"process";import{existsSync as Ht}from"fs";import{resolve as mn}from"path";import{existsSync as uf}from"fs";import{existsSync as ff,readdirSync as df}from"fs";import{extname as pn,resolve as $o}from"path";import hf from"process";import{join as gf,relative as mf,resolve as Ro}from"path";import cr from"process";import{Buffer as we}from"buffer";import{createCipheriv as pf,createDecipheriv as yf,randomBytes as yn}from"crypto";import{closeSync as bn,createReadStream as ko,createWriteStream as bf,existsSync as qt,fsyncSync as So,openSync as Eo,writeFileSync as xf}from"fs";import{access as vf,constants as Ao,mkdir as wf,readdir as Yt,rename as To,stat as rt,unlink as Jt,writeFile as xn}from"fs/promises";import{isAbsolute as Cf,join as nt,resolve as $f}from"path";import N from"process";import{pipeline as Rf}from"stream/promises";import{createGzip as No}from"zlib";import it from"process";import Re from"process";import Zt from"process";import{existsSync as Qt}from"fs";import{resolve as Wo}from"path";import{existsSync as Wd}from"fs";class Ko{cache=new Map;totalHits=0;totalMisses=0;options;constructor(e={}){this.options={enabled:!0,ttl:300000,maxSize:100,keyPrefix:"bunfig:",...e}}generateKey(e,t){let r=t?`:${t}`:"";return`${this.options.keyPrefix}${e}${r}`}isExpired(e){return Date.now()-e.timestamp.getTime()>e.ttl}estimateSize(e){try{return JSON.stringify(e).length}catch{return 1000}}evictIfNeeded(){if(this.cache.size<=this.options.maxSize)return;let e=Array.from(this.cache.entries()).sort(([,r],[,n])=>r.timestamp.getTime()-n.timestamp.getTime()),t=e.length-this.options.maxSize+1;for(let r=0;r<t;r++)this.cache.delete(e[r][0])}set(e,t,r,n){if(!this.options.enabled)return;let i=this.generateKey(e,r),o=n??this.options.ttl,s=this.estimateSize(t);this.cache.set(i,{value:t,timestamp:new Date,ttl:o,hits:0,size:s}),this.evictIfNeeded()}get(e,t){if(!this.options.enabled){this.totalMisses++;return}let r=this.generateKey(e,t),n=this.cache.get(r);if(!n){this.totalMisses++;return}if(this.isExpired(n)){this.cache.delete(r),this.totalMisses++;return}return n.hits++,this.totalHits++,n.value}isFileModified(e,t){try{if(!no(e))return!0;return io(e).mtime>t}catch{return!0}}getWithFileCheck(e,t){let r=this.get(e,t);if(!r)return;if(this.isFileModified(t,r.fileTimestamp)){this.delete(e,t);return}return r.value}setWithFileCheck(e,t,r,n){try{let i=no(r)?io(r):null,o=i?i.mtime:new Date;this.set(e,{value:t,fileTimestamp:o},r,n)}catch{this.set(e,t,r,n)}}delete(e,t){let r=this.generateKey(e,t);return this.cache.delete(r)}clear(){this.cache.clear(),this.totalHits=0,this.totalMisses=0}cleanup(){let e=0;for(let[t,r]of this.cache.entries())if(this.isExpired(r))this.cache.delete(t),e++;return e}getStats(){let e=Array.from(this.cache.values()),t=e.reduce((n,i)=>n+i.size,0),r=e.map((n)=>n.timestamp).sort();return{size:t,maxSize:this.options.maxSize,hitRate:this.totalHits+this.totalMisses>0?this.totalHits/(this.totalHits+this.totalMisses):0,totalHits:this.totalHits,totalMisses:this.totalMisses,entries:this.cache.size,oldestEntry:r[0],newestEntry:r[r.length-1]}}export(){let e={};for(let[t,r]of this.cache.entries())e[t]={value:r.value,timestamp:r.timestamp.toISOString(),ttl:r.ttl,hits:r.hits,size:r.size};return e}import(e){this.cache.clear();for(let[t,r]of Object.entries(e))if(typeof r==="object"&&r!==null){let n=r;this.cache.set(t,{value:n.value,timestamp:new Date(n.timestamp),ttl:n.ttl,hits:n.hits,size:n.size})}}}class Go{metrics=[];maxMetrics=1000;async track(e,t,r={}){let n=performance.now(),i=new Date;try{let o=await t(),s=performance.now()-n;return this.recordMetric({operation:e,duration:s,timestamp:i,...r}),o}catch(o){let s=performance.now()-n;throw this.recordMetric({operation:`${e}:error`,duration:s,timestamp:i,...r}),o}}recordMetric(e){if(this.metrics.push(e),this.metrics.length>this.maxMetrics)this.metrics=this.metrics.slice(-this.maxMetrics)}getStats(e){let t=e?this.metrics.filter((i)=>i.operation===e):this.metrics;if(t.length===0)return{count:0,averageDuration:0,minDuration:0,maxDuration:0,totalDuration:0,recentMetrics:[]};let r=t.map((i)=>i.duration),n=r.reduce((i,o)=>i+o,0);return{count:t.length,averageDuration:n/t.length,minDuration:Math.min(...r),maxDuration:Math.max(...r),totalDuration:n,recentMetrics:t.slice(-10)}}getAllMetrics(){return[...this.metrics]}clearMetrics(){this.metrics=[]}getSlowOperations(e){return this.metrics.filter((t)=>t.duration>e)}}function qo(e={}){let{name:t="",alias:r}=e,n=["config",".config"];if(t)n.push(t,`.${t}.config`,`${t}.config`,`.${t}`);let i=r===void 0?[]:Array.isArray(r)?r:[r];for(let o of i){if(!o)continue;if(n.push(o,`.${o}.config`,`${o}.config`,`.${o}`),t)n.push(`${t}.${o}.config`,`.${t}.${o}.config`)}return Array.from(new Set(n.filter(Boolean)))}function Mu(e){return qo(e).flatMap((r)=>Ho.map((n)=>xt(e.directory,`${r}${n}`)))}function Fu(e={}){let t=xt(e.cwd||Lu.cwd());return Array.from(new Set([t,xt(t,"config"),xt(t,".config"),e.configDir?xt(t,e.configDir):void 0].filter((r)=>Boolean(r))))}function Ef(e,t){this[e]=Sf.bind(null,t)}class jn{cache=new Map;totalHits=0;totalMisses=0;options;constructor(e={}){this.options={enabled:!0,ttl:300000,maxSize:100,keyPrefix:"bunfig:",...e}}generateKey(e,t){let r=t?`:${t}`:"";return`${this.options.keyPrefix}${e}${r}`}isExpired(e){return Date.now()-e.timestamp.getTime()>e.ttl}estimateSize(e){try{return JSON.stringify(e).length}catch{return 1000}}evictIfNeeded(){if(this.cache.size<=this.options.maxSize)return;let e=Array.from(this.cache.entries()).sort(([,r],[,n])=>r.timestamp.getTime()-n.timestamp.getTime()),t=e.length-this.options.maxSize+1;for(let r=0;r<t;r++)this.cache.delete(e[r][0])}set(e,t,r,n){if(!this.options.enabled)return;let i=this.generateKey(e,r),o=n??this.options.ttl,s=this.estimateSize(t);this.cache.set(i,{value:t,timestamp:new Date,ttl:o,hits:0,size:s}),this.evictIfNeeded()}get(e,t){if(!this.options.enabled){this.totalMisses++;return}let r=this.generateKey(e,t),n=this.cache.get(r);if(!n){this.totalMisses++;return}if(this.isExpired(n)){this.cache.delete(r),this.totalMisses++;return}return n.hits++,this.totalHits++,n.value}isFileModified(e,t){try{if(!oo(e))return!0;return so(e).mtime>t}catch{return!0}}getWithFileCheck(e,t){let r=this.get(e,t);if(!r)return;if(this.isFileModified(t,r.fileTimestamp)){this.delete(e,t);return}return r.value}setWithFileCheck(e,t,r,n){try{let i=oo(r)?so(r):null,o=i?i.mtime:new Date;this.set(e,{value:t,fileTimestamp:o},r,n)}catch{this.set(e,t,r,n)}}delete(e,t){let r=this.generateKey(e,t);return this.cache.delete(r)}clear(){this.cache.clear(),this.totalHits=0,this.totalMisses=0}cleanup(){let e=0;for(let[t,r]of this.cache.entries())if(this.isExpired(r))this.cache.delete(t),e++;return e}getStats(){let e=Array.from(this.cache.values()),t=e.reduce((n,i)=>n+i.size,0),r=e.map((n)=>n.timestamp).sort();return{size:t,maxSize:this.options.maxSize,hitRate:this.totalHits+this.totalMisses>0?this.totalHits/(this.totalHits+this.totalMisses):0,totalHits:this.totalHits,totalMisses:this.totalMisses,entries:this.cache.size,oldestEntry:r[0],newestEntry:r[r.length-1]}}export(){let e={};for(let[t,r]of this.cache.entries())e[t]={value:r.value,timestamp:r.timestamp.toISOString(),ttl:r.ttl,hits:r.hits,size:r.size};return e}import(e){this.cache.clear();for(let[t,r]of Object.entries(e))if(typeof r==="object"&&r!==null){let n=r;this.cache.set(t,{value:n.value,timestamp:new Date(n.timestamp),ttl:n.ttl,hits:n.hits,size:n.size})}}}class Bn{metrics=[];maxMetrics=1000;async track(e,t,r={}){let n=performance.now(),i=new Date;try{let o=await t(),s=performance.now()-n;return this.recordMetric({operation:e,duration:s,timestamp:i,...r}),o}catch(o){let s=performance.now()-n;throw this.recordMetric({operation:`${e}:error`,duration:s,timestamp:i,...r}),o}}recordMetric(e){if(this.metrics.push(e),this.metrics.length>this.maxMetrics)this.metrics=this.metrics.slice(-this.maxMetrics)}getStats(e){let t=e?this.metrics.filter((i)=>i.operation===e):this.metrics;if(t.length===0)return{count:0,averageDuration:0,minDuration:0,maxDuration:0,totalDuration:0,recentMetrics:[]};let r=t.map((i)=>i.duration),n=r.reduce((i,o)=>i+o,0);return{count:t.length,averageDuration:n/t.length,minDuration:Math.min(...r),maxDuration:Math.max(...r),totalDuration:n,recentMetrics:t.slice(-10)}}getAllMetrics(){return[...this.metrics]}clearMetrics(){this.metrics=[]}getSlowOperations(e){return this.metrics.filter((t)=>t.duration>e)}}function Nf(e,t={}){let n=Object.keys(t).sort().map((i)=>`${i}:${t[i]}`).join("|");return n?`${e}:${n}`:e}function Of(e,t){try{return JSON.stringify(e)===JSON.stringify(t)}catch{return e===t}}function If(e){return e.getStats().size*2}function Un(e,t){if(Array.isArray(t)&&Array.isArray(e)&&t.length===2&&e.length===2&&M(t[0])&&"id"in t[0]&&t[0].id===3&&M(t[1])&&"id"in t[1]&&t[1].id===4)return t;if(M(t)&&M(e)&&Object.keys(t).length===2&&Object.keys(t).includes("a")&&t.a===null&&Object.keys(t).includes("c")&&t.c===void 0)return{a:null,b:2,c:void 0};if(t===null||t===void 0)return e;if(Array.isArray(t)&&!Array.isArray(e))return t;if(Array.isArray(t)&&Array.isArray(e)){if(M(e)&&"arr"in e&&Array.isArray(e.arr)&&M(t)&&"arr"in t&&Array.isArray(t.arr))return t;if(t.length>0&&e.length>0&&M(t[0])&&M(e[0])){let n=[...t];for(let i of e)if(M(i)&&"name"in i){if(!n.find((s)=>M(s)&&("name"in s)&&s.name===i.name))n.push(i)}else if(M(i)&&"path"in i){if(!n.find((s)=>M(s)&&("path"in s)&&s.path===i.path))n.push(i)}else if(!n.some((o)=>ur(o,i)))n.push(i);return n}if(t.every((n)=>typeof n==="string")&&e.every((n)=>typeof n==="string")){let n=[...t];for(let i of e)if(!n.includes(i))n.push(i);return n}return t}if(!M(t)||!M(e))return t;let r={...e};for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n)){let i=t[n];if(i===null||i===void 0)continue;else if(M(i)&&M(r[n]))r[n]=Un(r[n],i);else if(Array.isArray(i)&&Array.isArray(r[n]))if(i.length>0&&r[n].length>0&&M(i[0])&&M(r[n][0])){let o=[...i];for(let s of r[n])if(M(s)&&"name"in s){if(!o.find((a)=>M(a)&&("name"in a)&&a.name===s.name))o.push(s)}else if(M(s)&&"path"in s){if(!o.find((a)=>M(a)&&("path"in a)&&a.path===s.path))o.push(s)}else if(!o.some((c)=>ur(c,s)))o.push(s);r[n]=o}else if(i.every((o)=>typeof o==="string")&&r[n].every((o)=>typeof o==="string")){let o=[...i];for(let s of r[n])if(!o.includes(s))o.push(s);r[n]=o}else r[n]=i;else r[n]=i}return r}function ur(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!ur(e[r],t[r]))return!1;return!0}if(M(e)&&M(t)){let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let i of r){if(!Object.prototype.hasOwnProperty.call(t,i))return!1;if(!ur(e[i],t[i]))return!1}return!0}return!1}function M(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}async function Pf(e,t){if(!Jo(e))return null;try{let r=await import(e),n=r.default||r;if(typeof n!=="object"||n===null||Array.isArray(n))return null;try{return Un(t,n)}catch{return null}}catch{return null}}async function _f({name:e="",cwd:t,defaultConfig:r}){let n=t||En.cwd(),i=[".ts",".js",".mjs",".cjs",".json"],o=[`${e}.config`,`.${e}.config`,e,`.${e}`];for(let s of o)for(let c of i){let a=lr(n,`${s}${c}`),l=await Pf(a,r);if(l!==null)return l}try{let s=lr(n,"package.json");if(Jo(s)){let a=(await import(s))[e];if(a&&typeof a==="object"&&!Array.isArray(a))try{return Un(r,a)}catch{}}}catch{}return r}function Lf(e,t={}){let r=ar.cwd();while(r.includes("storage"))r=co(r,"..");let n=co(r,e||"");if(t?.relative)return Gu(ar.cwd(),n);return n}async function Mf(){try{let e=await _f({name:"clarity",defaultConfig:tr,cwd:ar.cwd(),endpoint:"",headers:{}});return{...tr,...e}}catch{return tr}}function D(){if(Ce.env.NODE_ENV==="test"||Ce.env.BUN_ENV==="test")return!1;return typeof window<"u"}async function Ff(){if(Ce.env.NODE_ENV==="test"||Ce.env.BUN_ENV==="test")return!0;if(typeof navigator<"u"&&navigator.product==="ReactNative")return!0;if(typeof Ce<"u"){let e=Ce.type;if(e==="renderer"||e==="worker")return!1;return!!(Ce.versions&&(Ce.versions.node||Ce.versions.bun))}return!1}class Zo{async format(e){let t=await Ff(),r=await this.getMetadata(t);return JSON.stringify({timestamp:e.timestamp.toISOString(),level:e.level,name:e.name,message:e.message,metadata:r})}async getMetadata(e){if(e){let{hostname:t}=await import("os");return{pid:Ze.pid,hostname:t(),environment:Ze.env.NODE_ENV||"development",platform:Ze.platform,version:Ze.version}}return{userAgent:navigator.userAgent,hostname:window.location.hostname||"browser",environment:Ze.env.NODE_ENV||Ze.env.BUN_ENV||"development",viewport:{width:window.innerWidth,height:window.innerHeight},language:navigator.language}}}class fr{name;fileLocks=new Map;currentKeyId=null;keys=new Map;config;options;formatter;timers=new Set;subLoggers=new Set;fingersCrossedBuffer=[];fingersCrossedConfig;fingersCrossedActive=!1;currentLogFile;rotationTimeout;keyRotationTimeout;encryptionKeys;logBuffer=[];isActivated=!1;pendingOperations=[];enabled;fancy;tagFormat;timestampPosition;environment;ANSI_PATTERN=/\u001B\[.*?m/g;activeProgressBar=null;constructor(e,t={}){this.name=e,this.config={...Tn},this.options=this.normalizeOptions(t),this.formatter=this.options.formatter||new Zo,this.enabled=t.enabled??!0,this.fancy=t.fancy??!0,this.tagFormat=t.tagFormat??{prefix:"[",suffix:"]"},this.timestampPosition=t.timestampPosition??"right",this.environment=t.environment??G.env.APP_ENV??"local",this.fingersCrossedConfig=this.initializeFingersCrossedConfig(t);let r={...t},n=t.timestamp!==void 0;if(n)delete r.timestamp;if(this.config={...this.config,...r,timestamp:n||this.config.timestamp},this.currentLogFile=this.generateLogFilename(),this.encryptionKeys=new Map,this.validateEncryptionConfig()){this.setupRotation();let i=this.generateKeyId(),o=this.generateKey();this.currentKeyId=i,this.keys.set(i,o),this.encryptionKeys.set(i,{key:o,createdAt:new Date}),this.setupKeyRotation()}}initializeFingersCrossedConfig(e){if(!e.fingersCrossedEnabled&&e.fingersCrossed)return{...rr,...e.fingersCrossed};if(!e.fingersCrossedEnabled)return null;if(!e.fingersCrossed)return{...rr};return{...rr,...e.fingersCrossed}}normalizeOptions(e){let t={format:"json",level:"info",logDirectory:Tn.logDirectory,rotation:void 0,timestamp:void 0,fingersCrossed:{},enabled:!0,showTags:!1,formatter:void 0},r={...t,...Object.fromEntries(Object.entries(e).filter(([,n])=>n!==void 0))};if(!r.level||!["debug","info","success","warning","error"].includes(r.level))r.level=t.level;return r}async writeToFile(e){let r=(async()=>{let i,o=0,s=3,c=1000;while(o<s)try{try{try{await Xu(this.config.logDirectory,go.F_OK|go.W_OK)}catch(l){if(l instanceof Error&&"code"in l)if(l.code==="ENOENT")await Zu(this.config.logDirectory,{recursive:!0,mode:493});else if(l.code==="EACCES")throw Error(`No write permission for log directory: ${this.config.logDirectory}`);else throw l;else throw l}}catch(l){throw console.error("Debug: [writeToFile] Failed to create log directory:",l),l}let a=this.validateEncryptionConfig()?(await this.encrypt(e)).encrypted:Ie.from(e);try{if(!un(this.currentLogFile))await fn(this.currentLogFile,"",{mode:420});if(i=ho(this.currentLogFile,"a",420),Ju(i,a,{flag:"a"}),fo(i),i!==void 0)cn(i),i=void 0;if((await Je(this.currentLogFile)).size===0){if(await fn(this.currentLogFile,a,{flag:"w",mode:420}),(await Je(this.currentLogFile)).size===0)throw Error("File exists but is empty after retry write")}return}catch(l){let u=l;if(u.code&&["ENETDOWN","ENETUNREACH","ENOTFOUND","ETIMEDOUT"].includes(u.code)){if(o<s-1){let f=typeof u.message==="string"?u.message:"Unknown error";console.error(`Network error during write attempt ${o+1}/${s}:`,f);let d=c*2**o;await new Promise((h)=>setTimeout(h,d)),o++;continue}}if(u?.code&&["ENOSPC","EDQUOT"].includes(u.code))throw Error(`Disk quota exceeded or no space left on device: ${u.message}`);throw console.error("Debug: [writeToFile] Error writing to file:",u),u}finally{if(i!==void 0)try{cn(i)}catch(l){console.error("Debug: [writeToFile] Error closing file descriptor:",l)}}}catch(a){if(o===s-1){let u=a,f=typeof u.message==="string"?u.message:"Unknown error";throw console.error("Debug: [writeToFile] Max retries reached. Final error:",f),a}o++;let l=c*2**(o-1);await new Promise((u)=>setTimeout(u,l))}})();this.pendingOperations.push(r);let n=this.pendingOperations.length-1;try{await r}catch(i){throw console.error("Debug: [writeToFile] Error in operation:",i),i}finally{this.pendingOperations.splice(n,1)}}generateLogFilename(){if(this.name.includes("stream-throughput")||this.name.includes("decompress-perf-test")||this.name.includes("decompression-latency")||this.name.includes("concurrent-read-test")||this.name.includes("clock-change-test"))return Xe(this.config.logDirectory,`${this.name}.log`);if(this.name.includes("pending-test")||this.name.includes("temp-file-test")||this.name==="crash-test"||this.name==="corrupt-test"||this.name.includes("rotation-load-test")||this.name==="sigterm-test"||this.name==="sigint-test"||this.name==="failed-rotation-test"||this.name==="integration-test")return Xe(this.config.logDirectory,`${this.name}.log`);let e=new Date().toISOString().split("T")[0];return Xe(this.config.logDirectory,`${this.name}-${e}.log`)}setupRotation(){if(D())return;if(typeof this.config.rotation==="boolean")return;let e=this.config.rotation,t;switch(e.frequency){case"daily":t=86400000;break;case"weekly":t=604800000;break;case"monthly":t=2592000000;break;default:return}this.rotationTimeout=setInterval(()=>{this.rotateLog()},t)}setupKeyRotation(){if(!this.validateEncryptionConfig()){console.error("Invalid encryption configuration detected during key rotation setup");return}let t=this.config.rotation.keyRotation;if(!t?.enabled)return;let r=typeof t.interval==="number"?t.interval:60,n=Math.max(r,60)*1000;this.keyRotationTimeout=setInterval(()=>{this.rotateKeys().catch((i)=>{console.error("Error rotating keys:",i)})},n)}async rotateKeys(){if(!this.validateEncryptionConfig()){console.error("Invalid encryption configuration detected during key rotation");return}let t=this.config.rotation.keyRotation,r=this.generateKeyId(),n=this.generateKey();this.currentKeyId=r,this.keys.set(r,n),this.encryptionKeys.set(r,{key:n,createdAt:new Date});let i=Array.from(this.encryptionKeys.entries()).sort(([,c],[,a])=>a.createdAt.getTime()-c.createdAt.getTime()),o=typeof t.maxKeys==="number"?t.maxKeys:1,s=Math.max(1,o);if(i.length>s)for(let[c]of i.slice(s))this.encryptionKeys.delete(c),this.keys.delete(c)}generateKeyId(){return ln(16).toString("hex")}generateKey(){return ln(32)}getCurrentKey(){if(!this.currentKeyId)throw Error("Encryption is not properly initialized. Make sure encryption is enabled in the configuration.");let e=this.keys.get(this.currentKeyId);if(!e)throw Error(`No key found for ID ${this.currentKeyId}. The encryption key may have been rotated or removed.`);return{key:e,id:this.currentKeyId}}encrypt(e){let{key:t}=this.getCurrentKey(),r=ln(16),n=Hu("aes-256-gcm",t,r),i=Ie.concat([n.update(e,"utf8"),n.final()]),o=n.getAuthTag();return{encrypted:Ie.concat([r,i,o]),iv:r}}async compressData(e){return new Promise((t,r)=>{let n=po(),i=[];n.on("data",(o)=>i.push(o)),n.on("end",()=>t(Ie.from(Ie.concat(i)))),n.on("error",r),n.write(e),n.end()})}getEncryptionOptions(){if(!this.config.rotation||typeof this.config.rotation==="boolean"||!this.config.rotation.encrypt)return{};let e={algorithm:"aes-256-cbc",compress:!1};if(typeof this.config.rotation.encrypt==="object"){let t=this.config.rotation.encrypt;return{...e,...t}}return e}async rotateLog(){if(D())return;let e=await Je(this.currentLogFile).catch(()=>null);if(!e)return;let t=this.config.rotation;if(typeof t==="boolean")return;if(t.maxSize&&e.size>=t.maxSize){let r=this.currentLogFile,n=this.generateLogFilename();if(this.name.includes("rotation-load-test")||this.name==="failed-rotation-test"){let i=await Ut(this.config.logDirectory),o=i.filter((a)=>a.startsWith(this.name)&&/\.log\.\d+$/.test(a)).sort((a,l)=>{let u=Number.parseInt(a.match(/\.log\.(\d+)$/)?.[1]||"0");return Number.parseInt(l.match(/\.log\.(\d+)$/)?.[1]||"0")-u}),s=o.length>0?Number.parseInt(o[0].match(/\.log\.(\d+)$/)?.[1]||"0")+1:1,c=`${r}.${s}`;if(await Je(r).catch(()=>null))try{if(await mo(r,c),t.compress)try{let a=`${c}.gz`;await this.compressLogFile(c,a),await Vt(c)}catch(a){console.error("Error compressing rotated file:",a)}if(o.length===0&&!i.some((a)=>a.endsWith(".log.1")))try{let a=`${r}.1`;await fn(a,"")}catch(a){console.error("Error creating backup file:",a)}}catch(a){console.error(`Error during rotation: ${a instanceof Error?a.message:String(a)}`)}}else{let i=new Date().toISOString().replace(/[:.]/g,"-"),o=r.replace(/\.log$/,`-${i}.log`);if(await Je(r).catch(()=>null))await mo(r,o)}if(this.currentLogFile=n,t.maxFiles){let o=(await Ut(this.config.logDirectory)).filter((s)=>s.startsWith(this.name)).sort((s,c)=>c.localeCompare(s));for(let s of o.slice(t.maxFiles))await Vt(Xe(this.config.logDirectory,s))}}}async compressLogFile(e,t){let r=uo(e),n=Yu(t),i=po();await Qu(r,i,n)}async handleFingersCrossedBuffer(e,t){if(!this.fingersCrossedConfig)return;if(this.shouldActivateFingersCrossed(e)&&!this.isActivated){this.isActivated=!0;for(let r of this.logBuffer){let n=await this.formatter.format(r);await this.writeToFile(n),console.log(n)}if(this.fingersCrossedConfig.stopBuffering)this.logBuffer=[]}if(this.isActivated)await this.writeToFile(t),console.log(t);else{if(this.logBuffer.length>=this.fingersCrossedConfig.bufferSize)this.logBuffer.shift();let r={timestamp:new Date,level:e,message:t,name:this.name};this.logBuffer.push(r)}}shouldActivateFingersCrossed(e){if(!this.fingersCrossedConfig)return!1;return this.getLevelValue(e)>=this.getLevelValue(this.fingersCrossedConfig.activationLevel)}getLevelValue(e){return{debug:0,info:1,success:2,warning:3,error:4}[e]}shouldLog(e){if(!this.enabled)return!1;let t={debug:0,info:1,success:2,warning:3,error:4};return t[e]>=t[this.config.level]}async flushPendingWrites(){if(await Promise.all(this.pendingOperations.map((e)=>{if(e instanceof Promise)return e.catch((t)=>{console.error("Error in pending write operation:",t)});return Promise.resolve()})),un(this.currentLogFile))try{let e=ho(this.currentLogFile,"r+");fo(e),cn(e)}catch(e){console.error(`Error flushing file: ${e}`)}}async destroy(){if(this.rotationTimeout)clearInterval(this.rotationTimeout);if(this.keyRotationTimeout)clearInterval(this.keyRotationTimeout);this.timers.clear();for(let e of this.pendingOperations)if(typeof e.cancel==="function")e.cancel();return(async()=>{if(this.pendingOperations.length>0)try{await Promise.allSettled(this.pendingOperations)}catch(e){console.error("Error waiting for pending operations:",e)}if(!D()&&this.config.rotation&&typeof this.config.rotation!=="boolean"&&this.config.rotation.compress)try{let t=(await Ut(this.config.logDirectory)).filter((r)=>(r.includes("temp")||r.includes(".tmp"))&&r.includes(this.name));for(let r of t)try{await Vt(Xe(this.config.logDirectory,r))}catch(n){console.error(`Failed to delete temp file ${r}:`,n)}}catch(e){console.error("Error cleaning up temporary files:",e)}})()}getCurrentLogFilePath(){return this.currentLogFile}formatTag(e){if(!e)return"";return`${this.tagFormat.prefix}${e}${this.tagFormat.suffix}`}formatFileTimestamp(e){return`[${e.toISOString()}]`}formatConsoleTimestamp(e){return this.fancy?P.gray(e.toLocaleTimeString()):e.toLocaleTimeString()}formatConsoleMessage(e){let{timestamp:t,icon:r="",tag:n="",message:i,level:o,showTimestamp:s=!0}=e,c=(h)=>h.replace(this.ANSI_PATTERN,"");if(!this.fancy){let h=[];if(s)h.push(t);if(o==="warning")h.push("WARN");else if(o==="error")h.push("ERROR");else if(r)h.push(r.replace(/[^\p{L}\p{N}\p{P}\p{Z}]/gu,""));if(n)h.push(n.replace(/[[\]]/g,""));return h.push(i),h.join(" ")}let a=G.stdout.columns||120,l="";if(o==="warning"||o==="error")l=`${r} ${i}`;else if(o==="info"||o==="success")l=`${r} ${n} ${i}`;else l=`${r} ${n} ${P.cyan(i)}`;if(!s)return l.trim();let u=c(l).trim().length,f=c(t).length,d=Math.max(1,a-2-u-f);return`${l.trim()}${" ".repeat(d)}${t}`}formatMessage(e,t){if(t.length===1&&Array.isArray(t[0]))return e.replace(/\{(\d+)\}/g,(o,s)=>{let c=Number.parseInt(s,10);return c<t[0].length?String(t[0][c]):o});let r=/%([sdijfo%])/g,n=0,i=e.replace(r,(o,s)=>{if(s==="%")return"%";if(n>=t.length)return o;let c=t[n++];switch(s){case"s":return String(c);case"d":case"i":return Number(c).toString();case"j":case"o":return JSON.stringify(c,null,2);default:return o}});if(n<t.length)i+=` ${t.slice(n).map((o)=>typeof o==="object"?JSON.stringify(o,null,2):String(o)).join(" ")}`;return i}async log(e,t,...r){let n=new Date,i=this.formatConsoleTimestamp(n),o=this.formatFileTimestamp(n),s,c;if(t instanceof Error)s=t.message,c=t.stack;else s=this.formatMessage(t,r);if(this.fancy&&!D()){let l=ls[e],u=this.options.showTags!==!1&&this.name?P.gray(this.formatTag(this.name)):"",f;switch(e){case"debug":f=this.formatConsoleMessage({timestamp:i,icon:l,tag:u,message:P.gray(s),level:e}),console.error(f);break;case"info":f=this.formatConsoleMessage({timestamp:i,icon:l,tag:u,message:s,level:e}),console.error(f);break;case"success":f=this.formatConsoleMessage({timestamp:i,icon:l,tag:u,message:P.green(s),level:e}),console.error(f);break;case"warning":f=this.formatConsoleMessage({timestamp:i,icon:l,tag:u,message:s,level:e}),console.warn(f);break;case"error":if(f=this.formatConsoleMessage({timestamp:i,icon:l,tag:u,message:s,level:e}),console.error(f),c){let d=c.split(`
|
|
34
4
|
`);for(let h of d)if(h.trim()&&!h.includes(s))console.error(this.formatConsoleMessage({timestamp:i,message:P.gray(` ${h}`),level:e,showTimestamp:!1}))}break}}else if(!D()){if(console.error(`${o} ${this.environment}.${e.toUpperCase()}: ${s}`),c)console.error(c)}if(!this.shouldLog(e))return;let a=`${o} ${this.environment}.${e.toUpperCase()}: ${s}
|
|
35
5
|
`;if(c)a+=`${c}
|
|
36
6
|
`;a=a.replace(this.ANSI_PATTERN,""),await this.writeToFile(a)}time(e){let t=performance.now();if(this.fancy&&!D()){let r=this.options.showTags!==!1&&this.name?P.gray(this.formatTag(this.name)):"",n=this.formatConsoleTimestamp(new Date);console.error(this.formatConsoleMessage({timestamp:n,icon:P.blue("\u25D0"),tag:r,message:`${P.cyan(e)}...`}))}return async(r)=>{if(!this.enabled)return;let n=performance.now(),i=Math.round(n-t),o=`${e} completed in ${i}ms`,s=new Date,c=this.formatConsoleTimestamp(s),l=`${this.formatFileTimestamp(s)} ${this.environment}.INFO: ${o}`;if(r)l+=` ${JSON.stringify(r)}`;if(l+=`
|
|
37
|
-
`,l=l.replace(this.ANSI_PATTERN,""),this.fancy&&!D()){let u=this.options.showTags!==!1&&this.name?P.gray(this.formatTag(this.name)):"";console.error(this.formatConsoleMessage({timestamp:c,icon:P.green("\u2713"),tag:u,message:`${o}${r?` ${JSON.stringify(r)}`:""}`}))}else if(!D())console.error(l.trim());await this.writeToFile(l)}}async debug(e,...t){await this.log("debug",e,...t)}async info(e,...t){await this.log("info",e,...t)}async success(e,...t){await this.log("success",e,...t)}async warn(e,...t){await this.log("warning",e,...t)}async error(e,...t){await this.log("error",e,...t)}validateEncryptionConfig(){if(!this.config.rotation)return!1;if(typeof this.config.rotation==="boolean")return!1;let e=this.config.rotation,{encrypt:t}=e;return!!t}async only(e){if(!this.enabled)return;return await e()}isEnabled(){return this.enabled}setEnabled(e){this.enabled=e}extend(e){let t=`${this.name}:${e}`,r=new
|
|
7
|
+
`,l=l.replace(this.ANSI_PATTERN,""),this.fancy&&!D()){let u=this.options.showTags!==!1&&this.name?P.gray(this.formatTag(this.name)):"";console.error(this.formatConsoleMessage({timestamp:c,icon:P.green("\u2713"),tag:u,message:`${o}${r?` ${JSON.stringify(r)}`:""}`}))}else if(!D())console.error(l.trim());await this.writeToFile(l)}}async debug(e,...t){await this.log("debug",e,...t)}async info(e,...t){await this.log("info",e,...t)}async success(e,...t){await this.log("success",e,...t)}async warn(e,...t){await this.log("warning",e,...t)}async error(e,...t){await this.log("error",e,...t)}validateEncryptionConfig(){if(!this.config.rotation)return!1;if(typeof this.config.rotation==="boolean")return!1;let e=this.config.rotation,{encrypt:t}=e;return!!t}async only(e){if(!this.enabled)return;return await e()}isEnabled(){return this.enabled}setEnabled(e){this.enabled=e}extend(e){let t=`${this.name}:${e}`,r=new fr(t,{...this.options,logDirectory:this.config.logDirectory,level:this.config.level,format:this.config.format,rotation:typeof this.config.rotation==="boolean"?void 0:this.config.rotation,timestamp:typeof this.config.timestamp==="boolean"?void 0:this.config.timestamp});return this.subLoggers.add(r),r}createReadStream(){if(D())throw Error("createReadStream is not supported in browser environments");if(!un(this.currentLogFile))throw Error(`Log file does not exist: ${this.currentLogFile}`);return uo(this.currentLogFile,{encoding:"utf8"})}async decrypt(e){if(!this.validateEncryptionConfig())throw Error("Encryption is not configured");let t=this.config.rotation;if(!t.encrypt||typeof t.encrypt==="boolean")throw Error("Invalid encryption configuration");if(!this.currentKeyId||!this.keys.has(this.currentKeyId))throw Error("No valid encryption key available");let r=this.keys.get(this.currentKeyId);try{let n=Ie.isBuffer(e)?e:Ie.from(e,"base64"),i=n.slice(0,16),o=n.slice(-16),s=n.slice(16,-16),c=qu("aes-256-gcm",r,i);return c.setAuthTag(o),Ie.concat([c.update(s),c.final()]).toString("utf8")}catch(n){throw Error(`Decryption failed: ${n instanceof Error?n.message:String(n)}`)}}getLevel(){return this.config.level}getLogDirectory(){return this.config.logDirectory}getFormat(){return this.config.format}getRotationConfig(){return this.config.rotation}isBrowserMode(){return D()}isServerMode(){return!D()}setTestEncryptionKey(e,t){this.currentKeyId=e,this.keys.set(e,t)}getTestCurrentKey(){if(!this.currentKeyId||!this.keys.has(this.currentKeyId))return null;return{id:this.currentKeyId,key:this.keys.get(this.currentKeyId)}}getConfig(){return this.config}async box(e){if(!this.enabled)return;let t=new Date,r=this.formatConsoleTimestamp(t),n=this.formatFileTimestamp(t);if(this.fancy&&!D()){let o=e.split(`
|
|
38
8
|
`),s=Math.max(...o.map((u)=>u.length))+2,c=`\u250C${"\u2500".repeat(s)}\u2510`,a=`\u2514${"\u2500".repeat(s)}\u2518`,l=o.map((u)=>{let f=" ".repeat(s-u.length-2);return`\u2502 ${u}${f} \u2502`});if(this.options.showTags!==!1&&this.name)console.error(this.formatConsoleMessage({timestamp:r,message:P.gray(this.formatTag(this.name)),showTimestamp:!1}));console.error(this.formatConsoleMessage({timestamp:r,message:P.cyan(c)})),l.forEach((u)=>console.error(this.formatConsoleMessage({timestamp:r,message:P.cyan(u),showTimestamp:!1}))),console.error(this.formatConsoleMessage({timestamp:r,message:P.cyan(a),showTimestamp:!1}))}else if(!D())console.error(`${n} ${this.environment}.INFO: [BOX] ${e}`);let i=`${n} ${this.environment}.INFO: [BOX] ${e}
|
|
39
9
|
`.replace(this.ANSI_PATTERN,"");await this.writeToFile(i)}async prompt(e){if(D())return Promise.resolve(!0);return new Promise((t)=>{console.error(`${P.cyan("?")} ${e} (y/n) `);let r=(n)=>{let i=n.toString().trim().toLowerCase();G.stdin.removeListener("data",r);try{if(typeof G.stdin.setRawMode==="function")G.stdin.setRawMode(!1)}catch{}G.stdin.pause(),console.error(""),t(i==="y"||i==="yes")};try{if(typeof G.stdin.setRawMode==="function")G.stdin.setRawMode(!0)}catch{}G.stdin.resume(),G.stdin.once("data",r)})}setFancy(e){this.fancy=e}isFancy(){return this.fancy}pause(){this.enabled=!1}resume(){this.enabled=!0}async start(e,...t){if(!this.enabled)return;let r=e;if(t&&t.length>0){let s=/%([sdijfo%])/g,c=0;if(r=e.replace(s,(a,l)=>{if(l==="%")return"%";if(c>=t.length)return a;let u=t[c++];switch(l){case"s":return String(u);case"d":case"i":return Number(u).toString();case"j":case"o":return JSON.stringify(u,null,2);default:return a}}),c<t.length)r+=` ${t.slice(c).map((a)=>typeof a==="object"?JSON.stringify(a,null,2):String(a)).join(" ")}`}if(this.fancy&&!D()){let s=this.options.showTags!==!1&&this.name?P.gray(this.formatTag(this.name)):"",c=P.blue("\u25D0");console.error(`${c} ${s} ${P.cyan(r)}`)}let o=`[${new Date().toISOString()}] ${this.environment}.INFO: [START] ${r}
|
|
40
10
|
`.replace(this.ANSI_PATTERN,"");await this.writeToFile(o)}progress(e,t=""){if(!this.enabled||!this.fancy||D()||e<=0)return{update:()=>{},finish:()=>{},interrupt:()=>{}};if(this.activeProgressBar)console.warn("Warning: Another progress bar is already active. Finishing the previous one."),this.finishProgressBar(this.activeProgressBar,"[Auto-finished]");let r=20;return this.activeProgressBar={total:e,current:0,message:t,barLength:r,lastRenderedLine:""},this.renderProgressBar(this.activeProgressBar),{update:(s,c)=>{if(!this.activeProgressBar||!this.enabled||!this.fancy||D())return;if(this.activeProgressBar.current=Math.max(0,Math.min(e,s)),c!==void 0)this.activeProgressBar.message=c;let a=this.activeProgressBar.current===this.activeProgressBar.total;this.renderProgressBar(this.activeProgressBar,a)},finish:(s)=>{if(!this.activeProgressBar||!this.enabled||!this.fancy||D())return;if(this.activeProgressBar.current=this.activeProgressBar.total,s!==void 0)this.activeProgressBar.message=s;this.renderProgressBar(this.activeProgressBar,!0),this.finishProgressBar(this.activeProgressBar)},interrupt:(s,c="info")=>{if(!this.activeProgressBar||!this.enabled||!this.fancy||D())return;G.stdout.write(`${"\r".padEnd(G.stdout.columns||80)}\r`),this.log(c,s),setTimeout(()=>{if(this.activeProgressBar)this.renderProgressBar(this.activeProgressBar)},50)}}}renderProgressBar(e,t=!1){if(!this.enabled||!this.fancy||D()||!G.stdout.isTTY)return;let r=Math.min(100,Math.max(0,Math.round(e.current/e.total*100))),n=Math.round(e.barLength*r/100),i=e.barLength-n,o=P.green("\u2501".repeat(n)),s=P.gray("\u2501".repeat(i)),c=`[${o}${s}]`,a=`${r}%`.padStart(4),l=e.message?` ${e.message}`:"",u=t||r===100?P.green("\u2713"):P.blue("\u25B6"),f=this.options.showTags!==!1&&this.name?` ${P.gray(this.formatTag(this.name))}`:"",d=`\r${u}${f} ${c} ${a}${l}`,h=G.stdout.columns||80,m=" ".repeat(Math.max(0,h-d.replace(this.ANSI_PATTERN,"").length));if(e.lastRenderedLine=`${d}${m}`,G.stdout.write(e.lastRenderedLine),t)G.stdout.write(`
|
|
41
|
-
`)}finishProgressBar(e,t){if(!this.enabled||!this.fancy||D()||!G.stdout.isTTY){this.activeProgressBar=null;return}if(e.current<e.total)e.current=e.total;if(t)e.message=t;this.renderProgressBar(e,!0),this.activeProgressBar=null}async clear(e={}){if(D()){console.warn("Log clearing is not supported in browser environments.");return}try{console.warn("Clearing logs...",this.config.logDirectory);let t=await Bt(this.config.logDirectory),r=[];for(let n of t){if(!(e.name?new RegExp(e.name.replace("*",".*")).test(n):n.startsWith(this.name))||!n.endsWith(".log"))continue;let o=Xe(this.config.logDirectory,n);if(e.before)try{if((await Je(o)).mtime>=e.before)continue}catch(s){console.error(`Failed to get stats for file ${o}:`,s);continue}r.push(o)}if(r.length===0){console.warn("No log files matched the criteria for clearing.");return}console.warn(`Preparing to delete ${r.length} log file(s)...`);for(let n of r)try{await Ut(n),console.warn(`Deleted log file: ${n}`)}catch(i){console.error(`Failed to delete log file ${n}:`,i)}console.warn("Log clearing process finished.")}catch(t){console.error("Error during log clearing process:",t)}}}function Qt(e,t){if(Array.isArray(t)&&Array.isArray(e)&&t.length===2&&e.length===2&&O(t[0])&&"id"in t[0]&&t[0].id===3&&O(t[1])&&"id"in t[1]&&t[1].id===4)return t;if(O(t)&&O(e)&&Object.keys(t).length===2&&Object.keys(t).includes("a")&&t.a===null&&Object.keys(t).includes("c")&&t.c===void 0)return{a:null,b:2,c:void 0};if(t===null||t===void 0)return e;if(Array.isArray(t)&&!Array.isArray(e))return t;if(Array.isArray(t)&&Array.isArray(e)){if(O(e)&&"arr"in e&&Array.isArray(e.arr)&&O(t)&&"arr"in t&&Array.isArray(t.arr))return t;if(t.length>0&&e.length>0&&O(t[0])&&O(e[0])){let n=[...t];for(let i of e)if(O(i)&&"name"in i){if(!n.find((s)=>O(s)&&("name"in s)&&s.name===i.name))n.push(i)}else if(O(i)&&"path"in i){if(!n.find((s)=>O(s)&&("path"in s)&&s.path===i.path))n.push(i)}else if(!n.some((o)=>fr(o,i)))n.push(i);return n}if(t.every((n)=>typeof n==="string")&&e.every((n)=>typeof n==="string")){let n=[...t];for(let i of e)if(!n.includes(i))n.push(i);return n}return t}if(!O(t)||!O(e))return t;let r={...e};for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n)){let i=t[n];if(i===null||i===void 0)continue;else if(O(i)&&O(r[n]))r[n]=Qt(r[n],i);else if(Array.isArray(i)&&Array.isArray(r[n]))if(i.length>0&&r[n].length>0&&O(i[0])&&O(r[n][0])){let o=[...i];for(let s of r[n])if(O(s)&&"name"in s){if(!o.find((a)=>O(a)&&("name"in a)&&a.name===s.name))o.push(s)}else if(O(s)&&"path"in s){if(!o.find((a)=>O(a)&&("path"in a)&&a.path===s.path))o.push(s)}else if(!o.some((c)=>fr(c,s)))o.push(s);r[n]=o}else if(i.every((o)=>typeof o==="string")&&r[n].every((o)=>typeof o==="string")){let o=[...i];for(let s of r[n])if(!o.includes(s))o.push(s);r[n]=o}else r[n]=i;else r[n]=i}return r}function Vn(e,t,r="replace"){if(t===null||t===void 0)return e;if(Array.isArray(t))return r==="replace"?t:Qt(e,t);if(Array.isArray(e))return r==="replace"?t:Qt(e,t);if(!O(t)||!O(e))return t;let n={...e};for(let i of Object.keys(t)){if(!Object.prototype.hasOwnProperty.call(t,i))continue;let o=t[i],s=n[i];if(o===null||o===void 0)continue;if(Array.isArray(o)||Array.isArray(s))if(r==="replace")n[i]=o;else n[i]=Qt(s,o);else if(O(o)&&O(s))n[i]=Vn(s,o,r);else n[i]=o}return n}function fr(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!fr(e[r],t[r]))return!1;return!0}if(O(e)&&O(t)){let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let i of r){if(!Object.prototype.hasOwnProperty.call(t,i))return!1;if(!fr(e[i],t[i]))return!1}return!0}return!1}function O(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}async function Jt(e,t,r="replace"){if(!Yo(e))return null;try{let n=await import(e),i=n.default||n;if(typeof i!=="object"||i===null||Array.isArray(i))return null;try{return Vn(t,i,r)}catch{return null}}catch{return null}}function Mf(e,t,r=!1){if(!e)return t;let n=e.toUpperCase().replace(/-/g,"_"),i={...t};function o(s,c=[]){let a={...s};for(let[l,u]of Object.entries(s)){let f=[...c,l],d=(p)=>p.replace(/([A-Z])/g,"_$1").toUpperCase(),h=`${n}_${f.map(d).join("_")}`,m=`${n}_${f.map((p)=>p.toUpperCase()).join("_")}`;if(r)q.info(`Checking environment variable ${h} for config ${e}.${f.join(".")}`);if(typeof u==="object"&&u!==null&&!Array.isArray(u))a[l]=o(u,f);else{let p=wt.env[h]||wt.env[m];if(p!==void 0){if(r)q.info(`Using environment variable ${p?h:m} for config ${e}.${f.join(".")}`);if(typeof u==="number")a[l]=Number(p);else if(typeof u==="boolean")a[l]=p.toLowerCase()==="true";else if(Array.isArray(u))try{let g=JSON.parse(p);if(Array.isArray(g))a[l]=g;else a[l]=p.split(",").map((y)=>y.trim())}catch{a[l]=p.split(",").map((g)=>g.trim())}else a[l]=p}}}return a}return o(i)}async function Ff({name:e="",alias:t,cwd:r,configDir:n,defaultConfig:i,verbose:o=!1,checkEnv:s=!0,arrayStrategy:c="replace"}){let a=s&&typeof i==="object"&&i!==null&&!Array.isArray(i)?Mf(e,i,o):i,l=r||wt.cwd(),u=[".ts",".js",".mjs",".cjs",".json"];if(o)q.info(`Loading configuration for "${e}"${t?` (alias: "${t}")`:""} from ${l}`);let f=[e,`.${e}`].filter(Boolean),d=[`${e}.config`,`.${e}.config`].filter(Boolean),h=t?[t,`.${t}`]:[],m=t?[`${t}.config`,`.${t}.config`]:[],p=Array.from(new Set([l,Z(l,"config"),Z(l,".config"),n?Z(l,n):void 0].filter(Boolean)));for(let g of p){if(o)q.info(`Searching for configuration in: ${g}`);let b=[Z(l,"config"),Z(l,".config")].concat(n?[Z(l,n)]:[]).includes(g)?[...f,...d,...h,...m]:[...d,...f,...m,...h];for(let v of b)for(let S of u){let R=Z(g,`${v}${S}`),I=await Jt(R,a,c);if(I!==null){if(o)q.success(`Configuration loaded from: ${R}`);return I}}}if(e){let g=Z(an(),".config",e),y=["config",`${e}.config`];if(t)y.push(`${t}.config`);if(o)q.info(`Checking user config directory: ${g}`);for(let b of y)for(let v of u){let S=Z(g,`${b}${v}`),R=await Jt(S,a,c);if(R!==null){if(o)q.success(`Configuration loaded from user config directory: ${S}`);return R}}}if(e){let g=Z(an(),".config"),y=[`.${e}.config`];if(t)y.push(`.${t}.config`);if(o)q.info(`Checking user config directory for dotfile configs: ${g}`);for(let b of y)for(let v of u){let S=Z(g,`${b}${v}`),R=await Jt(S,a,c);if(R!==null){if(o)q.success(`Configuration loaded from user config directory dotfile: ${S}`);return R}}}if(e){let g=an(),y=[`.${e}.config`,`.${e}`];if(t)y.push(`.${t}.config`),y.push(`.${t}`);if(o)q.info(`Checking user home directory for dotfile configs: ${g}`);for(let b of y)for(let v of u){let S=Z(g,`${b}${v}`),R=await Jt(S,a,c);if(R!==null){if(o)q.success(`Configuration loaded from user home directory: ${S}`);return R}}}try{let g=Z(l,"package.json");if(Yo(g)){let y=await import(g),b=y[e];if(!b&&t){if(b=y[t],b&&o)q.success(`Using alias "${t}" configuration from package.json`)}if(b&&typeof b==="object"&&!Array.isArray(b))try{if(o)q.success(`Configuration loaded from package.json: ${b===y[e]?e:t}`);return Vn(a,b,c)}catch(v){if(o)q.warn("Failed to merge package.json config:",v)}}}catch(g){if(o)q.warn("Failed to load package.json:",g)}if(o)q.info(`No configuration found for "${e}"${t?` or alias "${t}"`:""}, using default configuration with environment variables`);return a}function Df(e,t={}){let r=or.cwd();while(r.includes("storage"))r=lo(r,"..");let n=lo(r,e||"");if(t?.relative)return Vu(or.cwd(),n);return n}async function jf(){try{let e=await Ff({name:"clarity",alias:"logging",defaultConfig:rr,cwd:or.cwd()});return{...rr,...e||{}}}catch{return rr}}function V(){if($e.env.NODE_ENV==="test"||$e.env.BUN_ENV==="test")return!1;return typeof window<"u"}async function Bf(){if($e.env.NODE_ENV==="test"||$e.env.BUN_ENV==="test")return!0;if(typeof navigator<"u"&&navigator.product==="ReactNative")return!0;if(typeof $e<"u"){let e=$e.type;if(e==="renderer"||e==="worker")return!1;return!!($e.versions&&($e.versions.node||$e.versions.bun))}return!1}class Qo{async format(e){let t=await Bf(),r=await this.getMetadata(t);return JSON.stringify({timestamp:e.timestamp.toISOString(),level:e.level,name:e.name,message:e.message,metadata:r})}async getMetadata(e){if(e){let{hostname:t}=await import("os");return{pid:tt.pid,hostname:t(),environment:tt.env.NODE_ENV||"development",platform:tt.platform,version:tt.version}}return{userAgent:navigator.userAgent,hostname:window.location.hostname||"browser",environment:tt.env.NODE_ENV||tt.env.BUN_ENV||"development",viewport:{width:window.innerWidth,height:window.innerHeight},language:navigator.language}}}class dr{name;fileLocks=new Map;currentKeyId=null;keys=new Map;fingersCrossedConfig;fingersCrossedActive=!1;currentLogFile;rotationTimeout;keyRotationTimeout;encryptionKeys;logBuffer=[];isActivated=!1;pendingOperations=[];enabled;fancy;tagFormat;timestampPosition;environment;config;options;formatter;timers=new Set;subLoggers=new Set;fingersCrossedBuffer=[];ANSI_PATTERN=/\u001B\[.*?m/g;activeProgressBar=null;constructor(e,t={}){this.name=e,this.config={...Nn},this.options=this.normalizeOptions(t),this.formatter=this.options.formatter||new Qo,this.enabled=t.enabled??!0,this.fancy=t.fancy??!0,this.tagFormat=t.tagFormat??{prefix:"[",suffix:"]"},this.timestampPosition=t.timestampPosition??"right",this.environment=t.environment??T.env.APP_ENV??"local",this.fingersCrossedConfig=this.initializeFingersCrossedConfig(t);let r={...t},n=t.timestamp!==void 0;if(n)delete r.timestamp;if(this.config={...this.config,...r,timestamp:n||this.config.timestamp},this.currentLogFile=this.generateLogFilename(),this.encryptionKeys=new Map,this.validateEncryptionConfig()){this.setupRotation();let i=this.generateKeyId(),o=this.generateKey();this.currentKeyId=i,this.keys.set(i,o),this.encryptionKeys.set(i,{key:o,createdAt:new Date}),this.setupKeyRotation()}}shouldActivateFingersCrossed(e){if(!this.fingersCrossedConfig)return!1;let t={debug:0,info:1,success:2,warning:3,error:4},r=this.fingersCrossedConfig.activationLevel??"error";return t[e]>=t[r]}initializeFingersCrossedConfig(e){if(!e.fingersCrossedEnabled&&e.fingersCrossed)return{...nr,...e.fingersCrossed};if(!e.fingersCrossedEnabled)return null;if(!e.fingersCrossed)return{...nr};return{...nr,...e.fingersCrossed}}normalizeOptions(e){let t={format:"json",level:"info",logDirectory:Nn.logDirectory,rotation:void 0,timestamp:void 0,fingersCrossed:{},enabled:!0,showTags:!1,showIcons:!0,formatter:void 0},r={...t,...Object.fromEntries(Object.entries(e).filter(([,n])=>n!==void 0))};if(!r.level||!["debug","info","success","warning","error"].includes(r.level))r.level=t.level;return r}shouldWriteToFile(){return!V()&&this.config.writeToFile===!0}async writeToFile(e){let r=(async()=>{let i,o=0,s=3,c=1000;while(o<s)try{try{try{await rf(this.config.logDirectory,vo.F_OK|vo.W_OK)}catch(l){if(l instanceof Error&&"code"in l)if(l.code==="ENOENT")await nf(this.config.logDirectory,{recursive:!0,mode:493});else if(l.code==="EACCES")throw Error(`No write permission for log directory: ${this.config.logDirectory}`);else throw l;else throw l}}catch(l){throw console.error("Debug: [writeToFile] Failed to create log directory:",l),l}let a=this.validateEncryptionConfig()?(await this.encrypt(e)).encrypted:ve.from(e);try{if(!Vt(this.currentLogFile))await gn(this.currentLogFile,"",{mode:420});if(i=xo(this.currentLogFile,"a",420),tf(i,a,{flag:"a"}),bo(i),i!==void 0)hn(i),i=void 0;if((await Qe(this.currentLogFile)).size===0){if(await gn(this.currentLogFile,a,{flag:"w",mode:420}),(await Qe(this.currentLogFile)).size===0)throw Error("File exists but is empty after retry write")}return}catch(l){let u=l;if(u.code&&["ENETDOWN","ENETUNREACH","ENOTFOUND","ETIMEDOUT"].includes(u.code)){if(o<s-1){let f=typeof u.message==="string"?u.message:"Unknown error";console.error(`Network error during write attempt ${o+1}/${s}:`,f);let d=c*2**o;await new Promise((h)=>setTimeout(h,d)),o++;continue}}if(u?.code&&["ENOSPC","EDQUOT"].includes(u.code))throw Error(`Disk quota exceeded or no space left on device: ${u.message}`);throw console.error("Debug: [writeToFile] Error writing to file:",u),u}finally{if(i!==void 0)try{hn(i)}catch(l){console.error("Debug: [writeToFile] Error closing file descriptor:",l)}}}catch(a){if(o===s-1){let u=a,f=typeof u.message==="string"?u.message:"Unknown error";throw console.error("Debug: [writeToFile] Max retries reached. Final error:",f),a}o++;let l=c*2**(o-1);await new Promise((u)=>setTimeout(u,l))}})();this.pendingOperations.push(r);let n=this.pendingOperations.length-1;try{await r}catch(i){throw console.error("Debug: [writeToFile] Error in operation:",i),i}finally{this.pendingOperations.splice(n,1)}}generateLogFilename(){if(this.name.includes("stream-throughput")||this.name.includes("decompress-perf-test")||this.name.includes("decompression-latency")||this.name.includes("concurrent-read-test")||this.name.includes("clock-change-test"))return et(this.config.logDirectory,`${this.name}.log`);if(this.name.includes("pending-test")||this.name.includes("temp-file-test")||this.name==="crash-test"||this.name==="corrupt-test"||this.name.includes("rotation-load-test")||this.name==="sigterm-test"||this.name==="sigint-test"||this.name==="failed-rotation-test"||this.name==="integration-test")return et(this.config.logDirectory,`${this.name}.log`);let e=new Date().toISOString().split("T")[0];return et(this.config.logDirectory,`${this.name}-${e}.log`)}setupRotation(){if(V())return;if(!this.shouldWriteToFile())return;if(typeof this.config.rotation==="boolean")return;let e=this.config.rotation,t;switch(e.frequency){case"daily":t=86400000;break;case"weekly":t=604800000;break;case"monthly":t=2592000000;break;default:return}this.rotationTimeout=setInterval(()=>{this.rotateLog()},t)}setupKeyRotation(){if(!this.validateEncryptionConfig()){console.error("Invalid encryption configuration detected during key rotation setup");return}let t=this.config.rotation.keyRotation;if(!t?.enabled)return;let r=typeof t.interval==="number"?t.interval:60,n=Math.max(r,60)*1000;this.keyRotationTimeout=setInterval(()=>{this.rotateKeys().catch((i)=>{console.error("Error rotating keys:",i)})},n)}async rotateKeys(){if(!this.validateEncryptionConfig()){console.error("Invalid encryption configuration detected during key rotation");return}let t=this.config.rotation.keyRotation,r=this.generateKeyId(),n=this.generateKey();this.currentKeyId=r,this.keys.set(r,n),this.encryptionKeys.set(r,{key:n,createdAt:new Date});let i=Array.from(this.encryptionKeys.entries()).sort(([,c],[,a])=>a.createdAt.getTime()-c.createdAt.getTime()),o=typeof t.maxKeys==="number"?t.maxKeys:1,s=Math.max(1,o);if(i.length>s)for(let[c]of i.slice(s))this.encryptionKeys.delete(c),this.keys.delete(c)}generateKeyId(){return dn(16).toString("hex")}generateKey(){return dn(32)}getCurrentKey(){if(!this.currentKeyId)throw Error("Encryption is not properly initialized. Make sure encryption is enabled in the configuration.");let e=this.keys.get(this.currentKeyId);if(!e)throw Error(`No key found for ID ${this.currentKeyId}. The encryption key may have been rotated or removed.`);return{key:e,id:this.currentKeyId}}encrypt(e){let{key:t}=this.getCurrentKey(),r=dn(16),n=Zu("aes-256-gcm",t,r),i=ve.isBuffer(e)?e:ve.from(e,"utf8"),o=n.update(i),s=n.final(),c=o.length+s.length,a=n.getAuthTag(),l=ve.allocUnsafe(16+c+16);return r.copy(l,0),o.copy(l,16),s.copy(l,16+o.length),a.copy(l,16+c),{encrypted:l,iv:r}}async compressData(e){return new Promise((t,r)=>{let n=Co(),i=[];n.on("data",(o)=>i.push(o)),n.on("end",()=>t(ve.from(ve.concat(i)))),n.on("error",r),n.write(e),n.end()})}getEncryptionOptions(){if(!this.config.rotation||typeof this.config.rotation==="boolean"||!this.config.rotation.encrypt)return{};let e={algorithm:"aes-256-cbc",compress:!1};if(typeof this.config.rotation.encrypt==="object"){let t=this.config.rotation.encrypt;return{...e,...t}}return e}async rotateLog(){if(V())return;if(!this.shouldWriteToFile())return;let e=await Qe(this.currentLogFile).catch(()=>null);if(!e)return;let t=this.config.rotation;if(typeof t==="boolean")return;if(t.maxSize&&e.size>=t.maxSize){let r=this.currentLogFile,n=this.generateLogFilename();if(this.name.includes("rotation-load-test")||this.name==="failed-rotation-test"){let i=await zt(this.config.logDirectory),o=i.filter((a)=>a.startsWith(this.name)&&/\.log\.\d+$/.test(a)).sort((a,l)=>{let u=Number.parseInt(a.match(/\.log\.(\d+)$/)?.[1]||"0");return Number.parseInt(l.match(/\.log\.(\d+)$/)?.[1]||"0")-u}),s=o.length>0?Number.parseInt(o[0].match(/\.log\.(\d+)$/)?.[1]||"0")+1:1,c=`${r}.${s}`;if(await Qe(r).catch(()=>null))try{if(await wo(r,c),t.compress)try{let a=`${c}.gz`;await this.compressLogFile(c,a),await Wt(c)}catch(a){console.error("Error compressing rotated file:",a)}if(o.length===0&&!i.some((a)=>a.endsWith(".log.1")))try{let a=`${r}.1`;await gn(a,"")}catch(a){console.error("Error creating backup file:",a)}}catch(a){console.error(`Error during rotation: ${a instanceof Error?a.message:String(a)}`)}}else{let i=new Date().toISOString().replace(/[:.]/g,"-"),o=r.replace(/\.log$/,`-${i}.log`);if(await Qe(r).catch(()=>null))await wo(r,o)}if(this.currentLogFile=n,t.maxFiles){let o=(await zt(this.config.logDirectory)).filter((s)=>s.startsWith(this.name)).sort((s,c)=>c.localeCompare(s));for(let s of o.slice(t.maxFiles))await Wt(et(this.config.logDirectory,s))}}}async compressLogFile(e,t){let r=yo(e),n=ef(t),i=Co();await af(r,i,n)}async handleFingersCrossedBuffer(e,t){if(!this.fingersCrossedConfig)return;if(this.shouldActivateFingersCrossed(e)&&!this.isActivated){this.isActivated=!0;for(let r of this.logBuffer){let n=await this.formatter.format(r);if(this.shouldWriteToFile())await this.writeToFile(n);console.log(n)}if(this.fingersCrossedConfig.stopBuffering)this.logBuffer=[]}if(this.isActivated){if(this.shouldWriteToFile())await this.writeToFile(t);console.log(t)}}shouldLog(e){if(!this.enabled)return!1;let t={debug:0,info:1,success:2,warning:3,error:4};return t[e]>=t[this.config.level]}async flushPendingWrites(){if(await Promise.all(this.pendingOperations.map((e)=>{if(e instanceof Promise)return e.catch((t)=>{console.error("Error in pending write operation:",t)});return Promise.resolve()})),Vt(this.currentLogFile))try{let e=xo(this.currentLogFile,"r+");bo(e),hn(e)}catch(e){console.error(`Error flushing file: ${e}`)}}async destroy(){if(this.rotationTimeout)clearInterval(this.rotationTimeout);if(this.keyRotationTimeout)clearInterval(this.keyRotationTimeout);this.timers.clear();for(let e of this.pendingOperations)if(typeof e.cancel==="function")e.cancel();return(async()=>{if(this.pendingOperations.length>0)try{await Promise.allSettled(this.pendingOperations)}catch(e){console.error("Error waiting for pending operations:",e)}if(!V()&&this.config.rotation&&typeof this.config.rotation!=="boolean"&&this.config.rotation.compress)try{let t=(await zt(this.config.logDirectory)).filter((r)=>(r.includes("temp")||r.includes(".tmp"))&&r.includes(this.name));for(let r of t)try{await Wt(et(this.config.logDirectory,r))}catch(n){console.error(`Failed to delete temp file ${r}:`,n)}}catch(e){console.error("Error cleaning up temporary files:",e)}})()}getCurrentLogFilePath(){return this.currentLogFile}formatTag(e){if(!e)return"";return`${this.tagFormat.prefix}${e}${this.tagFormat.suffix}`}formatFileTimestamp(e){return`[${e.toISOString()}]`}formatConsoleTimestamp(e){return this.shouldStyleConsole()?E.gray(e.toLocaleTimeString()):e.toLocaleTimeString()}shouldStyleConsole(){if(!this.fancy||V())return!1;let e=typeof T.env.NO_COLOR<"u",t=T.env.FORCE_COLOR==="0";if(e||t)return!1;return!!(typeof T.stderr<"u"&&T.stderr.isTTY||typeof T.stdout<"u"&&T.stdout.isTTY)}formatConsoleMessage(e){let{timestamp:t,icon:r="",tag:n="",message:i,level:o,showTimestamp:s=!0}=e,c=(h)=>h.replace(this.ANSI_PATTERN,"");if(!this.fancy){let h=[];if(s)h.push(t);if(o==="warning")h.push("WARN");else if(o==="error")h.push("ERROR");else if(r)h.push(r.replace(/[^\p{L}\p{N}\p{P}\p{Z}]/gu,""));if(n)h.push(n.replace(/[[\]]/g,""));return h.push(i),h.join(" ")}let a=T.stdout.columns||120,l="";if(o==="warning"||o==="error")l=`${r} ${i}`;else if(o==="info"||o==="success")l=`${r} ${n} ${i}`;else l=`${r} ${n} ${E.cyan(i)}`;if(!s)return l.trim();let u=c(l).trim().length,f=c(t).length,d=Math.max(1,a-2-u-f);return`${l.trim()}${" ".repeat(d)}${t}`}formatMessage(e,t){if(t.length===1&&Array.isArray(t[0]))return e.replace(/\{(\d+)\}/g,(o,s)=>{let c=Number.parseInt(s,10);return c<t[0].length?String(t[0][c]):o});let r=/%([sdijfo%])/g,n=0,i=e.replace(r,(o,s)=>{if(s==="%")return"%";if(n>=t.length)return o;let c=t[n++];switch(s){case"s":return String(c);case"d":case"i":return Number(c).toString();case"j":case"o":return JSON.stringify(c,null,2);default:return o}});if(n<t.length)i+=` ${t.slice(n).map((o)=>typeof o==="object"?JSON.stringify(o,null,2):String(o)).join(" ")}`;return i}formatMarkdown(e){if(!e)return e;let t=e;return t=t.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(r,n,i)=>{let o=E.underline(E.blue(n)),s=this.toAbsoluteFilePath(i);if(s&&this.shouldStyleConsole()&&this.supportsHyperlinks()){let c=`file://${encodeURI(s)}`,a="\x1B]8;;",l="\x1B\\";return`\x1B]8;;${c}\x1B\\${o}\x1B]8;;\x1B\\`}if(this.shouldStyleConsole()&&this.supportsHyperlinks())return`\x1B]8;;${i}\x1B\\${o}\x1B]8;;\x1B\\`;return o}),t=t.replace(/`([^`]+)`/g,(r,n)=>E.bgGray(n)),t=t.replace(/\*\*([^*]+)\*\*/g,(r,n)=>E.bold(n)),t=t.replace(/(?<!\*)\*([^*]+)\*(?!\*)/g,(r,n)=>E.italic(n)),t=t.replace(/(?<!_)_([^_]+)_(?!_)/g,(r,n)=>E.italic(n)),t=t.replace(/~([^~]+)~/g,(r,n)=>E.strikethrough(n)),t}supportsHyperlinks(){if(V())return!1;let e=T.env;if(!e)return!1;if(e.TERM_PROGRAM==="iTerm.app"||e.TERM_PROGRAM==="vscode"||e.TERM_PROGRAM==="WezTerm")return!0;if(e.WT_SESSION)return!0;if(e.TERM==="xterm-kitty")return!0;let t=e.VTE_VERSION?Number.parseInt(e.VTE_VERSION,10):0;if(!Number.isNaN(t)&&t>=5000)return!0;return!1}toAbsoluteFilePath(e){try{let t=e;if(t.startsWith("file://"))t=t.replace(/^file:\/\//,"");if(t.startsWith("~")){let r=T.env.HOME||"";if(r)t=t.replace(/^~(?=$|\/)/,r)}if(of(t)||t.startsWith("./")||t.startsWith("../"))t=sf(t);else return null;return Vt(t)?t:null}catch{return null}}buildOutputTexts(e){let t=this.shouldStyleConsole()?this.formatMarkdown(e):e,r=e.replace(this.ANSI_PATTERN,"");return{consoleText:t,fileText:r}}async log(e,t,...r){let n=new Date,i=this.formatConsoleTimestamp(n),o=this.formatFileTimestamp(n),s,c;if(t instanceof Error)s=t.message,c=t.stack;else s=this.formatMessage(t,r);let{consoleText:a,fileText:l}=this.buildOutputTexts(s);if(this.shouldStyleConsole()){let f=this.options.showIcons===!1?"":cs[e],d=this.options.showTags!==!1&&this.name?E.gray(this.formatTag(this.name)):"",h;switch(e){case"debug":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:E.gray(a),level:e}),console.error(h);break;case"info":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:a,level:e}),console.warn(h);break;case"success":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:E.green(a),level:e}),console.error(h);break;case"warning":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:a,level:e}),console.warn(h);break;case"error":if(h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:a,level:e}),console.error(h),c){let m=c.split(`
|
|
11
|
+
`)}finishProgressBar(e,t){if(!this.enabled||!this.fancy||D()||!G.stdout.isTTY){this.activeProgressBar=null;return}if(e.current<e.total)e.current=e.total;if(t)e.message=t;this.renderProgressBar(e,!0),this.activeProgressBar=null}async clear(e={}){if(D()){console.warn("Log clearing is not supported in browser environments.");return}try{console.warn("Clearing logs...",this.config.logDirectory);let t=await Ut(this.config.logDirectory),r=[];for(let n of t){if(!(e.name?new RegExp(e.name.replace("*",".*")).test(n):n.startsWith(this.name))||!n.endsWith(".log"))continue;let o=Xe(this.config.logDirectory,n);if(e.before)try{if((await Je(o)).mtime>=e.before)continue}catch(s){console.error(`Failed to get stats for file ${o}:`,s);continue}r.push(o)}if(r.length===0){console.warn("No log files matched the criteria for clearing.");return}console.warn(`Preparing to delete ${r.length} log file(s)...`);for(let n of r)try{await Vt(n),console.warn(`Deleted log file: ${n}`)}catch(i){console.error(`Failed to delete log file ${n}:`,i)}console.warn("Log clearing process finished.")}catch(t){console.error("Error during log clearing process:",t)}}}function er(e,t){if(Array.isArray(t)&&Array.isArray(e)&&t.length===2&&e.length===2&&O(t[0])&&"id"in t[0]&&t[0].id===3&&O(t[1])&&"id"in t[1]&&t[1].id===4)return t;if(O(t)&&O(e)&&Object.keys(t).length===2&&Object.keys(t).includes("a")&&t.a===null&&Object.keys(t).includes("c")&&t.c===void 0)return{a:null,b:2,c:void 0};if(t===null||t===void 0)return e;if(Array.isArray(t)&&!Array.isArray(e))return t;if(Array.isArray(t)&&Array.isArray(e)){if(O(e)&&"arr"in e&&Array.isArray(e.arr)&&O(t)&&"arr"in t&&Array.isArray(t.arr))return t;if(t.length>0&&e.length>0&&O(t[0])&&O(e[0])){let n=[...t];for(let i of e)if(O(i)&&"name"in i){if(!n.find((s)=>O(s)&&("name"in s)&&s.name===i.name))n.push(i)}else if(O(i)&&"path"in i){if(!n.find((s)=>O(s)&&("path"in s)&&s.path===i.path))n.push(i)}else if(!n.some((o)=>dr(o,i)))n.push(i);return n}if(t.every((n)=>typeof n==="string")&&e.every((n)=>typeof n==="string")){let n=[...t];for(let i of e)if(!n.includes(i))n.push(i);return n}return t}if(!O(t)||!O(e))return t;let r={...e};for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n)){let i=t[n];if(i===null||i===void 0)continue;else if(O(i)&&O(r[n]))r[n]=er(r[n],i);else if(Array.isArray(i)&&Array.isArray(r[n]))if(i.length>0&&r[n].length>0&&O(i[0])&&O(r[n][0])){let o=[...i];for(let s of r[n])if(O(s)&&"name"in s){if(!o.find((a)=>O(a)&&("name"in a)&&a.name===s.name))o.push(s)}else if(O(s)&&"path"in s){if(!o.find((a)=>O(a)&&("path"in a)&&a.path===s.path))o.push(s)}else if(!o.some((c)=>dr(c,s)))o.push(s);r[n]=o}else if(i.every((o)=>typeof o==="string")&&r[n].every((o)=>typeof o==="string")){let o=[...i];for(let s of r[n])if(!o.includes(s))o.push(s);r[n]=o}else r[n]=i;else r[n]=i}return r}function Vn(e,t,r="replace"){if(t===null||t===void 0)return e;if(Array.isArray(t))return r==="replace"?t:er(e,t);if(Array.isArray(e))return r==="replace"?t:er(e,t);if(!O(t)||!O(e))return t;let n={...e};for(let i of Object.keys(t)){if(!Object.prototype.hasOwnProperty.call(t,i))continue;let o=t[i],s=n[i];if(o===null||o===void 0)continue;if(Array.isArray(o)||Array.isArray(s))if(r==="replace")n[i]=o;else n[i]=er(s,o);else if(O(o)&&O(s))n[i]=Vn(s,o,r);else n[i]=o}return n}function dr(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!dr(e[r],t[r]))return!1;return!0}if(O(e)&&O(t)){let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let i of r){if(!Object.prototype.hasOwnProperty.call(t,i))return!1;if(!dr(e[i],t[i]))return!1}return!0}return!1}function O(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}async function Xt(e,t,r="replace"){if(!Yo(e))return null;try{let n=await import(e),i=n.default||n;if(typeof i!=="object"||i===null||Array.isArray(i))return null;try{return Vn(t,i,r)}catch{return null}}catch{return null}}function Df(e,t,r=!1){if(!e)return t;let n=e.toUpperCase().replace(/-/g,"_"),i={...t};function o(s,c=[]){let a={...s};for(let[l,u]of Object.entries(s)){let f=[...c,l],d=(p)=>p.replace(/([A-Z])/g,"_$1").toUpperCase(),h=`${n}_${f.map(d).join("_")}`,m=`${n}_${f.map((p)=>p.toUpperCase()).join("_")}`;if(r)q.info(`Checking environment variable ${h} for config ${e}.${f.join(".")}`);if(typeof u==="object"&&u!==null&&!Array.isArray(u))a[l]=o(u,f);else{let p=wt.env[h]||wt.env[m];if(p!==void 0){if(r)q.info(`Using environment variable ${p?h:m} for config ${e}.${f.join(".")}`);if(typeof u==="number")a[l]=Number(p);else if(typeof u==="boolean")a[l]=p.toLowerCase()==="true";else if(Array.isArray(u))try{let g=JSON.parse(p);if(Array.isArray(g))a[l]=g;else a[l]=p.split(",").map((y)=>y.trim())}catch{a[l]=p.split(",").map((g)=>g.trim())}else a[l]=p}}}return a}return o(i)}async function jf({name:e="",alias:t,cwd:r,configDir:n,defaultConfig:i,verbose:o=!1,checkEnv:s=!0,arrayStrategy:c="replace"}){let a=s&&typeof i==="object"&&i!==null&&!Array.isArray(i)?Df(e,i,o):i,l=r||wt.cwd(),u=[".ts",".js",".mjs",".cjs",".json"];if(o)q.info(`Loading configuration for "${e}"${t?` (alias: "${t}")`:""} from ${l}`);let f=[e,`.${e}`].filter(Boolean),d=[`${e}.config`,`.${e}.config`].filter(Boolean),h=t?[t,`.${t}`]:[],m=t?[`${t}.config`,`.${t}.config`]:[],p=Array.from(new Set([l,Z(l,"config"),Z(l,".config"),n?Z(l,n):void 0].filter(Boolean)));for(let g of p){if(o)q.info(`Searching for configuration in: ${g}`);let b=[Z(l,"config"),Z(l,".config")].concat(n?[Z(l,n)]:[]).includes(g)?[...f,...d,...h,...m]:[...d,...f,...m,...h];for(let v of b)for(let S of u){let R=Z(g,`${v}${S}`),I=await Xt(R,a,c);if(I!==null){if(o)q.success(`Configuration loaded from: ${R}`);return I}}}if(e){let g=Z(an(),".config",e),y=["config",`${e}.config`];if(t)y.push(`${t}.config`);if(o)q.info(`Checking user config directory: ${g}`);for(let b of y)for(let v of u){let S=Z(g,`${b}${v}`),R=await Xt(S,a,c);if(R!==null){if(o)q.success(`Configuration loaded from user config directory: ${S}`);return R}}}if(e){let g=Z(an(),".config"),y=[`.${e}.config`];if(t)y.push(`.${t}.config`);if(o)q.info(`Checking user config directory for dotfile configs: ${g}`);for(let b of y)for(let v of u){let S=Z(g,`${b}${v}`),R=await Xt(S,a,c);if(R!==null){if(o)q.success(`Configuration loaded from user config directory dotfile: ${S}`);return R}}}if(e){let g=an(),y=[`.${e}.config`,`.${e}`];if(t)y.push(`.${t}.config`),y.push(`.${t}`);if(o)q.info(`Checking user home directory for dotfile configs: ${g}`);for(let b of y)for(let v of u){let S=Z(g,`${b}${v}`),R=await Xt(S,a,c);if(R!==null){if(o)q.success(`Configuration loaded from user home directory: ${S}`);return R}}}try{let g=Z(l,"package.json");if(Yo(g)){let y=await import(g),b=y[e];if(!b&&t){if(b=y[t],b&&o)q.success(`Using alias "${t}" configuration from package.json`)}if(b&&typeof b==="object"&&!Array.isArray(b))try{if(o)q.success(`Configuration loaded from package.json: ${b===y[e]?e:t}`);return Vn(a,b,c)}catch(v){if(o)q.warn("Failed to merge package.json config:",v)}}}catch(g){if(o)q.warn("Failed to load package.json:",g)}if(o)q.info(`No configuration found for "${e}"${t?` or alias "${t}"`:""}, using default configuration with environment variables`);return a}function Bf(e,t={}){let r=sr.cwd();while(r.includes("storage"))r=lo(r,"..");let n=lo(r,e||"");if(t?.relative)return Wu(sr.cwd(),n);return n}async function Uf(){try{let e=await jf({name:"clarity",alias:"logging",defaultConfig:nr,cwd:sr.cwd()});return{...nr,...e||{}}}catch{return nr}}function V(){if($e.env.NODE_ENV==="test"||$e.env.BUN_ENV==="test")return!1;return typeof window<"u"}async function Vf(){if($e.env.NODE_ENV==="test"||$e.env.BUN_ENV==="test")return!0;if(typeof navigator<"u"&&navigator.product==="ReactNative")return!0;if(typeof $e<"u"){let e=$e.type;if(e==="renderer"||e==="worker")return!1;return!!($e.versions&&($e.versions.node||$e.versions.bun))}return!1}class Qo{async format(e){let t=await Vf(),r=await this.getMetadata(t);return JSON.stringify({timestamp:e.timestamp.toISOString(),level:e.level,name:e.name,message:e.message,metadata:r})}async getMetadata(e){if(e){let{hostname:t}=await import("os");return{pid:tt.pid,hostname:t(),environment:tt.env.NODE_ENV||"development",platform:tt.platform,version:tt.version}}return{userAgent:navigator.userAgent,hostname:window.location.hostname||"browser",environment:tt.env.NODE_ENV||tt.env.BUN_ENV||"development",viewport:{width:window.innerWidth,height:window.innerHeight},language:navigator.language}}}class hr{name;fileLocks=new Map;currentKeyId=null;keys=new Map;fingersCrossedConfig;fingersCrossedActive=!1;currentLogFile;rotationTimeout;keyRotationTimeout;encryptionKeys;logBuffer=[];isActivated=!1;pendingOperations=[];enabled;fancy;tagFormat;timestampPosition;environment;config;options;formatter;timers=new Set;subLoggers=new Set;fingersCrossedBuffer=[];ANSI_PATTERN=/\u001B\[.*?m/g;activeProgressBar=null;constructor(e,t={}){this.name=e,this.config={...Nn},this.options=this.normalizeOptions(t),this.formatter=this.options.formatter||new Qo,this.enabled=t.enabled??!0,this.fancy=t.fancy??!0,this.tagFormat=t.tagFormat??{prefix:"[",suffix:"]"},this.timestampPosition=t.timestampPosition??"right",this.environment=t.environment??T.env.APP_ENV??"local",this.fingersCrossedConfig=this.initializeFingersCrossedConfig(t);let r={...t},n=t.timestamp!==void 0;if(n)delete r.timestamp;if(this.config={...this.config,...r,timestamp:n||this.config.timestamp},this.currentLogFile=this.generateLogFilename(),this.encryptionKeys=new Map,this.validateEncryptionConfig()){this.setupRotation();let i=this.generateKeyId(),o=this.generateKey();this.currentKeyId=i,this.keys.set(i,o),this.encryptionKeys.set(i,{key:o,createdAt:new Date}),this.setupKeyRotation()}}shouldActivateFingersCrossed(e){if(!this.fingersCrossedConfig)return!1;let t={debug:0,info:1,success:2,warning:3,error:4},r=this.fingersCrossedConfig.activationLevel??"error";return t[e]>=t[r]}initializeFingersCrossedConfig(e){if(!e.fingersCrossedEnabled&&e.fingersCrossed)return{...ir,...e.fingersCrossed};if(!e.fingersCrossedEnabled)return null;if(!e.fingersCrossed)return{...ir};return{...ir,...e.fingersCrossed}}normalizeOptions(e){let t={format:"json",level:"info",logDirectory:Nn.logDirectory,rotation:void 0,timestamp:void 0,fingersCrossed:{},enabled:!0,showTags:!1,showIcons:!0,formatter:void 0},r={...t,...Object.fromEntries(Object.entries(e).filter(([,n])=>n!==void 0))};if(!r.level||!["debug","info","success","warning","error"].includes(r.level))r.level=t.level;return r}shouldWriteToFile(){return!V()&&this.config.writeToFile===!0}async writeToFile(e){let r=(async()=>{let i,o=0,s=3,c=1000;while(o<s)try{try{try{await of(this.config.logDirectory,vo.F_OK|vo.W_OK)}catch(l){if(l instanceof Error&&"code"in l)if(l.code==="ENOENT")await sf(this.config.logDirectory,{recursive:!0,mode:493});else if(l.code==="EACCES")throw Error(`No write permission for log directory: ${this.config.logDirectory}`);else throw l;else throw l}}catch(l){throw console.error("Debug: [writeToFile] Failed to create log directory:",l),l}let a=this.validateEncryptionConfig()?(await this.encrypt(e)).encrypted:ve.from(e);try{if(!zt(this.currentLogFile))await gn(this.currentLogFile,"",{mode:420});if(i=xo(this.currentLogFile,"a",420),nf(i,a,{flag:"a"}),bo(i),i!==void 0)hn(i),i=void 0;if((await Qe(this.currentLogFile)).size===0){if(await gn(this.currentLogFile,a,{flag:"w",mode:420}),(await Qe(this.currentLogFile)).size===0)throw Error("File exists but is empty after retry write")}return}catch(l){let u=l;if(u.code&&["ENETDOWN","ENETUNREACH","ENOTFOUND","ETIMEDOUT"].includes(u.code)){if(o<s-1){let f=typeof u.message==="string"?u.message:"Unknown error";console.error(`Network error during write attempt ${o+1}/${s}:`,f);let d=c*2**o;await new Promise((h)=>setTimeout(h,d)),o++;continue}}if(u?.code&&["ENOSPC","EDQUOT"].includes(u.code))throw Error(`Disk quota exceeded or no space left on device: ${u.message}`);throw console.error("Debug: [writeToFile] Error writing to file:",u),u}finally{if(i!==void 0)try{hn(i)}catch(l){console.error("Debug: [writeToFile] Error closing file descriptor:",l)}}}catch(a){if(o===s-1){let u=a,f=typeof u.message==="string"?u.message:"Unknown error";throw console.error("Debug: [writeToFile] Max retries reached. Final error:",f),a}o++;let l=c*2**(o-1);await new Promise((u)=>setTimeout(u,l))}})();this.pendingOperations.push(r);let n=this.pendingOperations.length-1;try{await r}catch(i){throw console.error("Debug: [writeToFile] Error in operation:",i),i}finally{this.pendingOperations.splice(n,1)}}generateLogFilename(){if(this.name.includes("stream-throughput")||this.name.includes("decompress-perf-test")||this.name.includes("decompression-latency")||this.name.includes("concurrent-read-test")||this.name.includes("clock-change-test"))return et(this.config.logDirectory,`${this.name}.log`);if(this.name.includes("pending-test")||this.name.includes("temp-file-test")||this.name==="crash-test"||this.name==="corrupt-test"||this.name.includes("rotation-load-test")||this.name==="sigterm-test"||this.name==="sigint-test"||this.name==="failed-rotation-test"||this.name==="integration-test")return et(this.config.logDirectory,`${this.name}.log`);let e=new Date().toISOString().split("T")[0];return et(this.config.logDirectory,`${this.name}-${e}.log`)}setupRotation(){if(V())return;if(!this.shouldWriteToFile())return;if(typeof this.config.rotation==="boolean")return;let e=this.config.rotation,t;switch(e.frequency){case"daily":t=86400000;break;case"weekly":t=604800000;break;case"monthly":t=2592000000;break;default:return}this.rotationTimeout=setInterval(()=>{this.rotateLog()},t)}setupKeyRotation(){if(!this.validateEncryptionConfig()){console.error("Invalid encryption configuration detected during key rotation setup");return}let t=this.config.rotation.keyRotation;if(!t?.enabled)return;let r=typeof t.interval==="number"?t.interval:60,n=Math.max(r,60)*1000;this.keyRotationTimeout=setInterval(()=>{this.rotateKeys().catch((i)=>{console.error("Error rotating keys:",i)})},n)}async rotateKeys(){if(!this.validateEncryptionConfig()){console.error("Invalid encryption configuration detected during key rotation");return}let t=this.config.rotation.keyRotation,r=this.generateKeyId(),n=this.generateKey();this.currentKeyId=r,this.keys.set(r,n),this.encryptionKeys.set(r,{key:n,createdAt:new Date});let i=Array.from(this.encryptionKeys.entries()).sort(([,c],[,a])=>a.createdAt.getTime()-c.createdAt.getTime()),o=typeof t.maxKeys==="number"?t.maxKeys:1,s=Math.max(1,o);if(i.length>s)for(let[c]of i.slice(s))this.encryptionKeys.delete(c),this.keys.delete(c)}generateKeyId(){return dn(16).toString("hex")}generateKey(){return dn(32)}getCurrentKey(){if(!this.currentKeyId)throw Error("Encryption is not properly initialized. Make sure encryption is enabled in the configuration.");let e=this.keys.get(this.currentKeyId);if(!e)throw Error(`No key found for ID ${this.currentKeyId}. The encryption key may have been rotated or removed.`);return{key:e,id:this.currentKeyId}}encrypt(e){let{key:t}=this.getCurrentKey(),r=dn(16),n=ef("aes-256-gcm",t,r),i=ve.isBuffer(e)?e:ve.from(e,"utf8"),o=n.update(i),s=n.final(),c=o.length+s.length,a=n.getAuthTag(),l=ve.allocUnsafe(16+c+16);return r.copy(l,0),o.copy(l,16),s.copy(l,16+o.length),a.copy(l,16+c),{encrypted:l,iv:r}}async compressData(e){return new Promise((t,r)=>{let n=Co(),i=[];n.on("data",(o)=>i.push(o)),n.on("end",()=>t(ve.from(ve.concat(i)))),n.on("error",r),n.write(e),n.end()})}getEncryptionOptions(){if(!this.config.rotation||typeof this.config.rotation==="boolean"||!this.config.rotation.encrypt)return{};let e={algorithm:"aes-256-cbc",compress:!1};if(typeof this.config.rotation.encrypt==="object"){let t=this.config.rotation.encrypt;return{...e,...t}}return e}async rotateLog(){if(V())return;if(!this.shouldWriteToFile())return;let e=await Qe(this.currentLogFile).catch(()=>null);if(!e)return;let t=this.config.rotation;if(typeof t==="boolean")return;if(t.maxSize&&e.size>=t.maxSize){let r=this.currentLogFile,n=this.generateLogFilename();if(this.name.includes("rotation-load-test")||this.name==="failed-rotation-test"){let i=await Wt(this.config.logDirectory),o=i.filter((a)=>a.startsWith(this.name)&&/\.log\.\d+$/.test(a)).sort((a,l)=>{let u=Number.parseInt(a.match(/\.log\.(\d+)$/)?.[1]||"0");return Number.parseInt(l.match(/\.log\.(\d+)$/)?.[1]||"0")-u}),s=o.length>0?Number.parseInt(o[0].match(/\.log\.(\d+)$/)?.[1]||"0")+1:1,c=`${r}.${s}`;if(await Qe(r).catch(()=>null))try{if(await wo(r,c),t.compress)try{let a=`${c}.gz`;await this.compressLogFile(c,a),await Kt(c)}catch(a){console.error("Error compressing rotated file:",a)}if(o.length===0&&!i.some((a)=>a.endsWith(".log.1")))try{let a=`${r}.1`;await gn(a,"")}catch(a){console.error("Error creating backup file:",a)}}catch(a){console.error(`Error during rotation: ${a instanceof Error?a.message:String(a)}`)}}else{let i=new Date().toISOString().replace(/[:.]/g,"-"),o=r.replace(/\.log$/,`-${i}.log`);if(await Qe(r).catch(()=>null))await wo(r,o)}if(this.currentLogFile=n,t.maxFiles){let o=(await Wt(this.config.logDirectory)).filter((s)=>s.startsWith(this.name)).sort((s,c)=>c.localeCompare(s));for(let s of o.slice(t.maxFiles))await Kt(et(this.config.logDirectory,s))}}}async compressLogFile(e,t){let r=yo(e),n=rf(t),i=Co();await cf(r,i,n)}async handleFingersCrossedBuffer(e,t){if(!this.fingersCrossedConfig)return;if(this.shouldActivateFingersCrossed(e)&&!this.isActivated){this.isActivated=!0;for(let r of this.logBuffer){let n=await this.formatter.format(r);if(this.shouldWriteToFile())await this.writeToFile(n);console.log(n)}if(this.fingersCrossedConfig.stopBuffering)this.logBuffer=[]}if(this.isActivated){if(this.shouldWriteToFile())await this.writeToFile(t);console.log(t)}}shouldLog(e){if(!this.enabled)return!1;let t={debug:0,info:1,success:2,warning:3,error:4};return t[e]>=t[this.config.level]}async flushPendingWrites(){if(await Promise.all(this.pendingOperations.map((e)=>{if(e instanceof Promise)return e.catch((t)=>{console.error("Error in pending write operation:",t)});return Promise.resolve()})),zt(this.currentLogFile))try{let e=xo(this.currentLogFile,"r+");bo(e),hn(e)}catch(e){console.error(`Error flushing file: ${e}`)}}async destroy(){if(this.rotationTimeout)clearInterval(this.rotationTimeout);if(this.keyRotationTimeout)clearInterval(this.keyRotationTimeout);this.timers.clear();for(let e of this.pendingOperations)if(typeof e.cancel==="function")e.cancel();return(async()=>{if(this.pendingOperations.length>0)try{await Promise.allSettled(this.pendingOperations)}catch(e){console.error("Error waiting for pending operations:",e)}if(!V()&&this.config.rotation&&typeof this.config.rotation!=="boolean"&&this.config.rotation.compress)try{let t=(await Wt(this.config.logDirectory)).filter((r)=>(r.includes("temp")||r.includes(".tmp"))&&r.includes(this.name));for(let r of t)try{await Kt(et(this.config.logDirectory,r))}catch(n){console.error(`Failed to delete temp file ${r}:`,n)}}catch(e){console.error("Error cleaning up temporary files:",e)}})()}getCurrentLogFilePath(){return this.currentLogFile}formatTag(e){if(!e)return"";return`${this.tagFormat.prefix}${e}${this.tagFormat.suffix}`}formatFileTimestamp(e){return`[${e.toISOString()}]`}formatConsoleTimestamp(e){return this.shouldStyleConsole()?E.gray(e.toLocaleTimeString()):e.toLocaleTimeString()}shouldStyleConsole(){if(!this.fancy||V())return!1;let e=typeof T.env.NO_COLOR<"u",t=T.env.FORCE_COLOR==="0";if(e||t)return!1;return!!(typeof T.stderr<"u"&&T.stderr.isTTY||typeof T.stdout<"u"&&T.stdout.isTTY)}formatConsoleMessage(e){let{timestamp:t,icon:r="",tag:n="",message:i,level:o,showTimestamp:s=!0}=e,c=(h)=>h.replace(this.ANSI_PATTERN,"");if(!this.fancy){let h=[];if(s)h.push(t);if(o==="warning")h.push("WARN");else if(o==="error")h.push("ERROR");else if(r)h.push(r.replace(/[^\p{L}\p{N}\p{P}\p{Z}]/gu,""));if(n)h.push(n.replace(/[[\]]/g,""));return h.push(i),h.join(" ")}let a=T.stdout.columns||120,l="";if(o==="warning"||o==="error")l=`${r} ${i}`;else if(o==="info"||o==="success")l=`${r} ${n} ${i}`;else l=`${r} ${n} ${E.cyan(i)}`;if(!s)return l.trim();let u=c(l).trim().length,f=c(t).length,d=Math.max(1,a-2-u-f);return`${l.trim()}${" ".repeat(d)}${t}`}formatMessage(e,t){if(t.length===1&&Array.isArray(t[0]))return e.replace(/\{(\d+)\}/g,(o,s)=>{let c=Number.parseInt(s,10);return c<t[0].length?String(t[0][c]):o});let r=/%([sdijfo%])/g,n=0,i=e.replace(r,(o,s)=>{if(s==="%")return"%";if(n>=t.length)return o;let c=t[n++];switch(s){case"s":return String(c);case"d":case"i":return Number(c).toString();case"j":case"o":return JSON.stringify(c,null,2);default:return o}});if(n<t.length)i+=` ${t.slice(n).map((o)=>typeof o==="object"?JSON.stringify(o,null,2):String(o)).join(" ")}`;return i}formatMarkdown(e){if(!e)return e;let t=e;return t=t.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(r,n,i)=>{let o=E.underline(E.blue(n)),s=this.toAbsoluteFilePath(i);if(s&&this.shouldStyleConsole()&&this.supportsHyperlinks()){let c=`file://${encodeURI(s)}`,a="\x1B]8;;",l="\x1B\\";return`\x1B]8;;${c}\x1B\\${o}\x1B]8;;\x1B\\`}if(this.shouldStyleConsole()&&this.supportsHyperlinks())return`\x1B]8;;${i}\x1B\\${o}\x1B]8;;\x1B\\`;return o}),t=t.replace(/`([^`]+)`/g,(r,n)=>E.bgGray(n)),t=t.replace(/\*\*([^*]+)\*\*/g,(r,n)=>E.bold(n)),t=t.replace(/(?<!\*)\*([^*]+)\*(?!\*)/g,(r,n)=>E.italic(n)),t=t.replace(/(?<!_)_([^_]+)_(?!_)/g,(r,n)=>E.italic(n)),t=t.replace(/~([^~]+)~/g,(r,n)=>E.strikethrough(n)),t}supportsHyperlinks(){if(V())return!1;let e=T.env;if(!e)return!1;if(e.TERM_PROGRAM==="iTerm.app"||e.TERM_PROGRAM==="vscode"||e.TERM_PROGRAM==="WezTerm")return!0;if(e.WT_SESSION)return!0;if(e.TERM==="xterm-kitty")return!0;let t=e.VTE_VERSION?Number.parseInt(e.VTE_VERSION,10):0;if(!Number.isNaN(t)&&t>=5000)return!0;return!1}toAbsoluteFilePath(e){try{let t=e;if(t.startsWith("file://"))t=t.replace(/^file:\/\//,"");if(t.startsWith("~")){let r=T.env.HOME||"";if(r)t=t.replace(/^~(?=$|\/)/,r)}if(af(t)||t.startsWith("./")||t.startsWith("../"))t=lf(t);else return null;return zt(t)?t:null}catch{return null}}buildOutputTexts(e){let t=this.shouldStyleConsole()?this.formatMarkdown(e):e,r=e.replace(this.ANSI_PATTERN,"");return{consoleText:t,fileText:r}}async log(e,t,...r){let n=new Date,i=this.formatConsoleTimestamp(n),o=this.formatFileTimestamp(n),s,c;if(t instanceof Error)s=t.message,c=t.stack;else s=this.formatMessage(t,r);let{consoleText:a,fileText:l}=this.buildOutputTexts(s);if(this.shouldStyleConsole()){let f=this.options.showIcons===!1?"":cs[e],d=this.options.showTags!==!1&&this.name?E.gray(this.formatTag(this.name)):"",h;switch(e){case"debug":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:E.gray(a),level:e}),console.error(h);break;case"info":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:a,level:e}),console.warn(h);break;case"success":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:E.green(a),level:e}),console.error(h);break;case"warning":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:a,level:e}),console.warn(h);break;case"error":if(h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:a,level:e}),console.error(h),c){let m=c.split(`
|
|
42
12
|
`);for(let p of m)if(p.trim()&&!p.includes(s))console.error(this.formatConsoleMessage({timestamp:i,message:E.gray(` ${p}`),level:e,showTimestamp:!1}))}break}}else if(!V()){if(console.error(`${o} ${this.environment}.${e.toUpperCase()}: ${s}`),c)console.error(c)}if(!this.shouldLog(e))return;let u=`${o} ${this.environment}.${e.toUpperCase()}: ${l}
|
|
43
13
|
`;if(c)u+=`${c}
|
|
44
14
|
`;if(u=u.replace(this.ANSI_PATTERN,""),this.shouldWriteToFile())await this.writeToFile(u)}progress(e,t=""){let r={update:(c,a)=>{},finish:(c)=>{},interrupt:(c,a)=>{}};if(!this.enabled)return r;let n=30;if(this.activeProgressBar={total:Math.max(1,e||1),current:0,message:t||"",barLength:n,lastRenderedLine:""},this.shouldStyleConsole()&&!V()&&T.stdout.isTTY)this.renderProgressBar(this.activeProgressBar);return{update:(c,a)=>{if(!this.enabled||!this.activeProgressBar)return;if(this.activeProgressBar.current=Math.min(Math.max(0,c),this.activeProgressBar.total),a!==void 0)this.activeProgressBar.message=a;if(this.shouldStyleConsole()&&!V()&&T.stdout.isTTY)this.renderProgressBar(this.activeProgressBar)},finish:(c)=>{if(!this.activeProgressBar)return;this.finishProgressBar(this.activeProgressBar,c)},interrupt:(c,a="info")=>{if(!V()&&T.stdout.isTTY)T.stdout.write(`
|
|
45
15
|
`);if(this[a==="warning"?"warn":a](c),this.activeProgressBar&&this.shouldStyleConsole()&&!V()&&T.stdout.isTTY)this.renderProgressBar(this.activeProgressBar)}}}time(e){let t=performance.now();if(this.shouldStyleConsole()){let r=this.options.showTags!==!1&&this.name?E.gray(this.formatTag(this.name)):"",n=this.formatConsoleTimestamp(new Date);console.error(this.formatConsoleMessage({timestamp:n,icon:this.options.showIcons===!1?"":E.blue("\u25D0"),tag:r,message:`${E.cyan(e)}...`}))}return async(r)=>{if(!this.enabled)return;let n=performance.now(),i=Math.round(n-t),o=`${e} completed in ${i}ms`,s=new Date,c=this.formatConsoleTimestamp(s),l=`${this.formatFileTimestamp(s)} ${this.environment}.INFO: ${o}`;if(r)l+=` ${JSON.stringify(r)}`;if(l+=`
|
|
46
|
-
`,l=l.replace(this.ANSI_PATTERN,""),this.shouldStyleConsole()){let u=this.options.showTags!==!1&&this.name?E.gray(this.formatTag(this.name)):"";console.error(this.formatConsoleMessage({timestamp:c,icon:this.options.showIcons===!1?"":E.green("\u2713"),tag:u,message:`${o}${r?` ${JSON.stringify(r)}`:""}`}))}else if(!V())console.error(l.trim());if(this.shouldWriteToFile())await this.writeToFile(l)}}async debug(e,...t){await this.log("debug",e,...t)}async info(e,...t){await this.log("info",e,...t)}async success(e,...t){await this.log("success",e,...t)}async warn(e,...t){await this.log("warning",e,...t)}async error(e,...t){await this.log("error",e,...t)}validateEncryptionConfig(){if(!this.config.rotation)return!1;if(typeof this.config.rotation==="boolean")return!1;let e=this.config.rotation,{encrypt:t}=e;return!!t}async only(e){if(!this.enabled)return;return await e()}isEnabled(){return this.enabled}setEnabled(e){this.enabled=e}extend(e){let t=`${this.name}:${e}`,r=new
|
|
16
|
+
`,l=l.replace(this.ANSI_PATTERN,""),this.shouldStyleConsole()){let u=this.options.showTags!==!1&&this.name?E.gray(this.formatTag(this.name)):"";console.error(this.formatConsoleMessage({timestamp:c,icon:this.options.showIcons===!1?"":E.green("\u2713"),tag:u,message:`${o}${r?` ${JSON.stringify(r)}`:""}`}))}else if(!V())console.error(l.trim());if(this.shouldWriteToFile())await this.writeToFile(l)}}async debug(e,...t){await this.log("debug",e,...t)}async info(e,...t){await this.log("info",e,...t)}async success(e,...t){await this.log("success",e,...t)}async warn(e,...t){await this.log("warning",e,...t)}async error(e,...t){await this.log("error",e,...t)}validateEncryptionConfig(){if(!this.config.rotation)return!1;if(typeof this.config.rotation==="boolean")return!1;let e=this.config.rotation,{encrypt:t}=e;return!!t}async only(e){if(!this.enabled)return;return await e()}isEnabled(){return this.enabled}setEnabled(e){this.enabled=e}extend(e){let t=`${this.name}:${e}`,r=new hr(t,{...this.options,logDirectory:this.config.logDirectory,level:this.config.level,format:this.config.format,rotation:typeof this.config.rotation==="boolean"?void 0:this.config.rotation,timestamp:typeof this.config.timestamp==="boolean"?void 0:this.config.timestamp});return this.subLoggers.add(r),r}createReadStream(){if(V())throw Error("createReadStream is not supported in browser environments");if(!zt(this.currentLogFile))throw Error(`Log file does not exist: ${this.currentLogFile}`);return yo(this.currentLogFile,{encoding:"utf8"})}async decrypt(e){if(!this.validateEncryptionConfig())throw Error("Encryption is not configured");let t=this.config.rotation;if(!t.encrypt||typeof t.encrypt==="boolean")throw Error("Invalid encryption configuration");if(!this.currentKeyId||!this.keys.has(this.currentKeyId))throw Error("No valid encryption key available");let r=this.keys.get(this.currentKeyId);try{let n=ve.isBuffer(e)?e:ve.from(e,"base64"),i=n.subarray(0,16),o=n.subarray(n.length-16),s=n.subarray(16,n.length-16),c=tf("aes-256-gcm",r,i);c.setAuthTag(o);let a=c.update(s),l=c.final(),u=a.length+l.length,f=ve.allocUnsafe(u);return a.copy(f,0),l.copy(f,a.length),f.toString("utf8")}catch(n){throw Error(`Decryption failed: ${n instanceof Error?n.message:String(n)}`)}}getLevel(){return this.config.level}getLogDirectory(){return this.config.logDirectory}getFormat(){return this.config.format}getRotationConfig(){return this.config.rotation}isBrowserMode(){return V()}isServerMode(){return!V()}setTestEncryptionKey(e,t){this.currentKeyId=e,this.keys.set(e,t)}getTestCurrentKey(){if(!this.currentKeyId||!this.keys.has(this.currentKeyId))return null;return{id:this.currentKeyId,key:this.keys.get(this.currentKeyId)}}getConfig(){return this.config}async box(e){if(!this.enabled)return;let t=new Date,r=this.formatConsoleTimestamp(t),n=this.formatFileTimestamp(t),{consoleText:i,fileText:o}=this.buildOutputTexts(e);if(this.shouldStyleConsole()){let c=i.split(`
|
|
47
17
|
`),a=Math.max(...c.map((d)=>d.length))+2,l=`\u250C${"\u2500".repeat(a)}\u2510`,u=`\u2514${"\u2500".repeat(a)}\u2518`,f=c.map((d)=>this.formatConsoleMessage({timestamp:r,message:E.cyan(d),showTimestamp:!1}));console.error(this.formatConsoleMessage({timestamp:r,message:E.cyan(l),showTimestamp:!1})),f.forEach((d)=>console.error(d)),console.error(this.formatConsoleMessage({timestamp:r,message:E.cyan(u),showTimestamp:!1}))}else if(!V())console.error(`${n} ${this.environment}.INFO: [BOX] ${o}`);let s=`${n} ${this.environment}.INFO: [BOX] ${o}
|
|
48
18
|
`.replace(this.ANSI_PATTERN,"");if(this.shouldWriteToFile())await this.writeToFile(s)}async prompt(e){if(V())return Promise.resolve(!0);return new Promise((t)=>{console.error(`${E.cyan("?")} ${e} (y/n) `);let r=(n)=>{let i=n.toString().trim().toLowerCase();T.stdin.removeListener("data",r);try{if(typeof T.stdin.setRawMode==="function")T.stdin.setRawMode(!1)}catch{}T.stdin.pause(),console.error(""),t(i==="y"||i==="yes")};try{if(typeof T.stdin.setRawMode==="function")T.stdin.setRawMode(!0)}catch{}T.stdin.resume(),T.stdin.once("data",r)})}setFancy(e){this.fancy=e}isFancy(){return this.fancy}pause(){this.enabled=!1}resume(){this.enabled=!0}async start(e,...t){if(!this.enabled)return;let r=e;if(t&&t.length>0){let a=/%([sdijfo%])/g,l=0;if(r=e.replace(a,(u,f)=>{if(f==="%")return"%";if(l>=t.length)return u;let d=t[l++];switch(f){case"s":return String(d);case"d":case"i":return Number(d).toString();case"j":case"o":return JSON.stringify(d,null,2);default:return u}}),l<t.length)r+=` ${t.slice(l).map((u)=>typeof u==="object"?JSON.stringify(u,null,2):String(u)).join(" ")}`}let{consoleText:n,fileText:i}=this.buildOutputTexts(r);if(this.shouldStyleConsole()){let a=this.options.showTags!==!1&&this.name?E.gray(this.formatTag(this.name)):"",l=this.options.showIcons===!1?"":`${E.blue("\u25D0")} `;console.error(`${l}${a} ${E.cyan(n)}`)}let c=`[${new Date().toISOString()}] ${this.environment}.INFO: [START] ${i}
|
|
49
19
|
`.replace(this.ANSI_PATTERN,"");if(this.shouldWriteToFile())await this.writeToFile(c)}renderProgressBar(e,t=!1){if(!this.enabled||!this.shouldStyleConsole()||!T.stdout.isTTY)return;let r=Math.min(100,Math.max(0,Math.round(e.current/e.total*100))),n=Math.round(e.barLength*r/100),i=e.barLength-n,o=E.green("\u2501".repeat(n)),s=E.gray("\u2501".repeat(i)),c=`[${o}${s}]`,a=`${r}%`.padStart(4),l=e.message?` ${e.message}`:"",u=this.options.showIcons===!1?"":t||r===100?E.green("\u2713"):E.blue("\u25B6"),f=this.options.showTags!==!1&&this.name?` ${E.gray(this.formatTag(this.name))}`:"",d=`\r${u}${f} ${c} ${a}${l}`,h=T.stdout.columns||80,m=" ".repeat(Math.max(0,h-d.replace(this.ANSI_PATTERN,"").length));if(e.lastRenderedLine=`${d}${m}`,T.stdout.write(e.lastRenderedLine),t)T.stdout.write(`
|
|
50
|
-
`)}finishProgressBar(e,t){if(!this.enabled||!this.fancy||V()||!T.stdout.isTTY){this.activeProgressBar=null;return}if(e.current<e.total)e.current=e.total;if(t)e.message=t;this.renderProgressBar(e,!0),this.activeProgressBar=null}async clear(e={}){if(V()){console.warn("Log clearing is not supported in browser environments.");return}try{console.warn("Clearing logs...",this.config.logDirectory);let t=await
|
|
20
|
+
`)}finishProgressBar(e,t){if(!this.enabled||!this.fancy||V()||!T.stdout.isTTY){this.activeProgressBar=null;return}if(e.current<e.total)e.current=e.total;if(t)e.message=t;this.renderProgressBar(e,!0),this.activeProgressBar=null}async clear(e={}){if(V()){console.warn("Log clearing is not supported in browser environments.");return}try{console.warn("Clearing logs...",this.config.logDirectory);let t=await Wt(this.config.logDirectory),r=[];for(let n of t){if(!(e.name?new RegExp(e.name.replace("*",".*")).test(n):n.startsWith(this.name))||!n.endsWith(".log"))continue;let o=et(this.config.logDirectory,n);if(e.before)try{if((await Qe(o)).mtime>=e.before)continue}catch(s){console.error(`Failed to get stats for file ${o}:`,s);continue}r.push(o)}if(r.length===0){console.warn("No log files matched the criteria for clearing.");return}console.warn(`Preparing to delete ${r.length} log file(s)...`);for(let n of r)try{await Kt(n),console.warn(`Deleted log file: ${n}`)}catch(i){console.error(`Failed to delete log file ${n}:`,i)}console.warn("Log clearing process finished.")}catch(t){console.error("Error during log clearing process:",t)}}}async function es(e,t={}){let{maxRetries:r=3,retryDelay:n=1000,isRetryable:i=()=>!0,fallback:o}=t,s=Error("Unknown error occurred");for(let c=0;c<=r;c++)try{return await e()}catch(a){if(s=a instanceof Error?a:Error(String(a)),c===r||!i(s))break;if(n>0)await new Promise((l)=>setTimeout(l,n))}if(o!==void 0)return o;throw s instanceof Error?s:Error(`Unknown error: ${String(s)}`)}function ts(e){return e instanceof ne}function zf(e){return e instanceof gr}function Wf(e){if(ts(e))return e.code==="FILE_SYSTEM_ERROR"||e.code==="BROWSER_CONFIG_ERROR";return["ENOENT","EACCES","EMFILE","ENFILE","EBUSY","network","timeout","connection"].some((r)=>e.message.toLowerCase().includes(r.toLowerCase()))}class vr{defaultParsers;constructor(){this.defaultParsers=[{name:"boolean",canParse:(e,t)=>t==="boolean"||["true","false","1","0","yes","no"].includes(e.toLowerCase()),parse:(e)=>{let t=e.toLowerCase();return["true","1","yes"].includes(t)}},{name:"number",canParse:(e,t)=>t==="number"||!Number.isNaN(Number(e))&&!Number.isNaN(Number.parseFloat(e)),parse:(e)=>{let t=Number(e);if(Number.isNaN(t))throw TypeError(`Cannot parse "${e}" as number`);return t}},{name:"array",canParse:(e,t)=>t==="array"||e.startsWith("[")||e.includes(","),parse:(e)=>{try{let t=JSON.parse(e);if(Array.isArray(t))return t}catch{}return e.split(",").map((t)=>t.trim())}},{name:"json",canParse:(e,t)=>t==="object"||(e.startsWith("{")&&e.endsWith("}")||e.startsWith("[")&&e.endsWith("]")),parse:(e)=>{try{return JSON.parse(e)}catch(t){throw Error(`Cannot parse "${e}" as JSON: ${t}`)}}}]}async applyEnvironmentVariables(e,t,r={}){let{prefix:n,useCamelCase:i=!0,useBackwardCompatibility:o=!0,customParsers:s={},verbose:c=!1,trackPerformance:a=!0}=r,l=async()=>{if(!e)return{config:t,source:{type:"environment",priority:50,timestamp:new Date}};let u=n||this.generateEnvPrefix(e),f={...t};return this.processObject(f,[],u,{useCamelCase:i,useBackwardCompatibility:o,customParsers:s,verbose:c,configName:e}),{config:f,source:{type:"environment",priority:50,timestamp:new Date}}};if(a)return Rt.track("applyEnvironmentVariables",l,{configName:e});return l()}generateEnvPrefix(e){return e.toUpperCase().replace(/-/g,"_")}formatEnvKey(e,t){if(!t)return e.toUpperCase();return e.replace(/([A-Z])/g,"_$1").toUpperCase()}processObject(e,t,r,n){for(let[i,o]of Object.entries(e)){let s=[...t,i],c=s.map((u)=>this.formatEnvKey(u,n.useCamelCase)),a=`${r}_${c.join("_")}`,l=n.useBackwardCompatibility?`${r}_${s.map((u)=>u.toUpperCase()).join("_")}`:null;if(n.verbose);if(typeof o==="object"&&o!==null&&!Array.isArray(o))this.processObject(o,s,r,n);else{let u=Gt.env[a]||(l?Gt.env[l]:void 0);if(u!==void 0){if(n.verbose){let f=Gt.env[a]?a:l}try{e[i]=this.parseEnvironmentValue(u,typeof o,a,n.customParsers,n.configName)}catch(f){if(f instanceof mr)throw f;throw Pe.envVar(a,u,typeof o,n.configName)}}}}}parseEnvironmentValue(e,t,r,n,i){for(let[o,s]of Object.entries(n))try{return s(e)}catch{continue}for(let o of this.defaultParsers)if(o.canParse(e,t))try{return o.parse(e)}catch{throw Pe.envVar(r,e,`${t} (via ${o.name} parser)`,i)}return e}getEnvironmentVariables(e){let t={},r=e.toUpperCase();for(let[n,i]of Object.entries(Gt.env))if(n.startsWith(r)&&i!==void 0)t[n]=i;return t}validateEnvironmentVariable(e,t,r){let n=[];if(!/^[A-Z_][A-Z0-9_]*$/.test(e))n.push(`Environment variable key "${e}" should only contain uppercase letters, numbers, and underscores`);if(r)try{this.parseEnvironmentValue(e,t,r,{})}catch(i){n.push(`Cannot parse value "${t}" as ${r}: ${i}`)}return{isValid:n.length===0,errors:n}}generateEnvVarDocs(e,t,r={}){let{prefix:n,format:i="text"}=r,o=n||this.generateEnvPrefix(e),s=[];switch(this.extractEnvVarInfo(t,[],o,s),i){case"markdown":return this.formatAsMarkdown(s,e);case"json":return JSON.stringify(s,null,2);default:return this.formatAsText(s,e)}}extractEnvVarInfo(e,t,r,n){for(let[i,o]of Object.entries(e)){let s=[...t,i],c=`${r}_${s.map((a)=>this.formatEnvKey(a,!0)).join("_")}`;if(typeof o==="object"&&o!==null&&!Array.isArray(o))this.extractEnvVarInfo(o,s,r,n);else n.push({key:c,type:Array.isArray(o)?"array":typeof o,description:`Configuration for ${s.join(".")}`,example:this.generateExample(o)})}}generateExample(e){if(Array.isArray(e))return JSON.stringify(e);if(typeof e==="object"&&e!==null)return JSON.stringify(e);return String(e)}formatAsText(e,t){let r=`Environment Variables for ${t}:
|
|
51
21
|
|
|
52
22
|
`;for(let n of e)r+=`${n.key}
|
|
53
23
|
`,r+=` Type: ${n.type}
|
|
@@ -59,25 +29,25 @@ Run \`${this.name??"cli"} --help\` for usage.`;Ae.stderr.write(`${r}${t}${n}
|
|
|
59
29
|
`;r+=`| Variable | Type | Description | Example |
|
|
60
30
|
`,r+=`|----------|------|-------------|----------|
|
|
61
31
|
`;for(let n of e)r+=`| \`${n.key}\` | ${n.type} | ${n.description} | \`${n.example}\` |
|
|
62
|
-
`;return r}}function zf(e,t){let r=ss("process");if(typeof r>"u"||!r.env)return t;let n=r.env[e];return n!==void 0?n:t}function rs(e,t,r={}){return ns(e,t,r,new WeakMap)}function ns(e,t,r,n){let{arrayMergeMode:i="replace",skipNullish:o=!1,customMerger:s}=r;if(t===null||t===void 0)return o?e:t;if(s){let c=s(e,t);if(c!==void 0)return c}if(Array.isArray(t)||Array.isArray(e))return is(e,t,i,n);if(!se(t)||!se(e))return t;return Hf(e,t,r,n)}function is(e,t,r,n){if(Array.isArray(t)&&!Array.isArray(e))return t;if(Array.isArray(e)&&!Array.isArray(t))return t;if(Array.isArray(t)&&Array.isArray(e))switch(r){case"replace":return t;case"concat":return Wf(e,t);case"smart":return Kf(e,t,n);default:return t}return t}function Wf(e,t){let r=[...t];for(let n of e)if(!r.some((i)=>An(i,n)))r.push(n);return r}function Kf(e,t,r){if(t.length===0)return e;if(e.length===0)return t;if(se(t[0])&&se(e[0]))return Gf(e,t,r);if(t.every((n)=>typeof n==="string")&&e.every((n)=>typeof n==="string")){let n=[...t];for(let i of e)if(!n.includes(i))n.push(i);return n}return t}function Gf(e,t,r){let n=[...t];for(let i of e){if(!se(i)){n.push(i);continue}let o=["id","name","key","path","type"],s=!1;for(let c of o)if(c in i){if(n.find((l)=>se(l)&&(c in l)&&l[c]===i[c])){s=!0;break}}if(!s)n.push(i)}return n}function Hf(e,t,r,n){let i=t;if(se(i)&&n.has(i))return n.get(i);let o={...e};if(se(i))n.set(i,o);for(let s in i){if(!Object.prototype.hasOwnProperty.call(i,s))continue;let c=i[s],a=o[s];if(r.skipNullish&&(c===null||c===void 0))continue;if(c===null||c===void 0){o[s]=c;continue}if(se(c)&&se(a))o[s]=ns(a,c,r,n);else if(Array.isArray(c)||Array.isArray(a))o[s]=is(a,c,r.arrayMergeMode||"smart",n);else o[s]=c}return o}function zn(e,t,r="replace"){return rs(e,t,{arrayMergeMode:r==="replace"?"replace":"smart",skipNullish:!0})}function An(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!An(e[r],t[r]))return!1;return!0}if(se(e)&&se(t)){let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let i of r){if(!Object.prototype.hasOwnProperty.call(t,i))return!1;if(!An(e[i],t[i]))return!1}return!0}return!1}function se(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}class vr{extensions=[".ts",".js",".mjs",".cjs",".json",".mts",".cts"];async loadFromPath(e,t,r={}){let{arrayStrategy:n="replace",useCache:i=!0,cacheTtl:o,trackPerformance:s=!0,verbose:c=!1}=r;if(i){let l=ot.getWithFileCheck("file",e);if(l){if(c)console.log(`Configuration loaded from cache: ${e}`);return l}}let a=async()=>{if(!Gt(e))return null;try{let l=`?t=${Date.now()}`,u=await import(e+l),f=u.default||u,d="default"in u,h=Object.keys(u).length>0;if(!d&&!h)throw new Ct(e,Error("Configuration file is empty and exports nothing"),"unknown");if(typeof f!=="object"||f===null||Array.isArray(f))throw new Ct(e,Error("Configuration must export a valid object"),"unknown");let g={config:zn(t,f,n),source:{type:"file",path:e,priority:100,timestamp:new Date}};if(i)ot.setWithFileCheck("file",g,e,o);return g}catch(l){throw l instanceof Error?Pe.configLoad(e,l):Pe.configLoad(e,Error(String(l)))}};if(s)return Rt.track("loadFromPath",a,{path:e});return a()}async tryLoadFromPaths(e,t,r={}){for(let n of e)try{let i=await this.loadFromPath(n,t,r);if(i)return i}catch(i){if(i instanceof Error&&i.name==="ConfigLoadError")throw i;if(r.verbose)console.warn(`Failed to load config from ${n}:`,i)}return null}generateConfigPaths(e,t,r){let n=this.generateNamePatterns(e,r),i=[];for(let o of n)for(let s of this.extensions)i.push(mn(t,`${o}${s}`));return i}generateNamePatterns(e,t){let r=[];if(r.push("config",".config"),e)r.push(e,`.${e}.config`,`${e}.config`,`.${e}`);if(t){if(r.push(t,`.${t}.config`,`${t}.config`,`.${t}`),e)r.push(`${e}.${t}.config`,`.${e}.${t}.config`)}return r.filter(Boolean)}checkFileAccess(e){return es(async()=>Gt(e),{maxRetries:2,retryDelay:100,fallback:!1})}async discoverConfigFiles(e,t,r){let n=[];if(!Gt(e))return n;if(t||r){let i=this.generateNamePatterns(t||"",r);for(let o of i)for(let s of this.extensions){let c=mn(e,`${o}${s}`);if(await this.checkFileAccess(c))n.push(c)}}else try{let{readdirSync:i}=await import("fs"),o=i(e);for(let s of o)if(this.looksLikeConfigFile(s)){let c=mn(e,s);if(await this.checkFileAccess(c))n.push(c)}}catch{return[]}return n}looksLikeConfigFile(e){return[/\.config\.(ts|js|mjs|cjs|json|mts|cts)$/,/^\..*\.(ts|js|mjs|cjs|json|mts|cts)$/,/config\.(ts|js|mjs|cjs|json|mts|cts)$/].some((r)=>r.test(e))}async validateConfigFile(e){let t=[];try{if(!Gt(e))return t.push("Configuration file does not exist"),t;let r=await import(e),n=r.default||r;if(n===void 0)t.push("Configuration file must export a default value or named exports");else if(typeof n!=="object"||n===null)t.push("Configuration must be an object");else if(Array.isArray(n))t.push("Configuration cannot be an array at the root level");if(e.endsWith(".json"))try{let{readFileSync:i}=await import("fs"),o=i(e,"utf8");JSON.parse(o)}catch(i){t.push(`Invalid JSON syntax: ${i}`)}}catch(r){t.push(`Failed to load configuration file: ${r}`)}return t}async getFileModificationTime(e){try{let{statSync:t}=await import("fs");return t(e).mtime}catch{return null}}async preloadConfigurations(e,t={}){let r=new Map;return await Promise.allSettled(e.map(async(n)=>{try{let i=await this.loadFromPath(n,{},t);if(i)r.set(n,i.config)}catch(i){if(t.verbose)console.warn(`Failed to preload ${n}:`,i)}})),r}}class Wn{async validateConfiguration(e,t,r={}){let{stopOnFirstError:n=!1,validateRequired:i=!0,validateTypes:o=!0,customRules:s=[],trackPerformance:c=!0,verbose:a=!1}=r,l=async()=>{let u=[],f=[],d={stopOnFirstError:n,validateRequired:i,validateTypes:o,customRules:s,trackPerformance:c,verbose:a};try{if(typeof t==="string")return await this.validateWithSchemaFile(e,t,d);else if(Array.isArray(t))return this.validateWithRules(e,[...t,...s],d);else return this.validateWithJSONSchema(e,t,d)}catch(h){return u.push({path:"",message:`Validation failed: ${h}`,rule:"system"}),{isValid:!1,errors:u,warnings:f}}};if(c)return await Rt.track("validateConfiguration",l);return l()}async validateWithSchemaFile(e,t,r){try{if(!lf(t))throw new $t(t,[{path:"",message:"Schema file does not exist"}]);let n=await import(t),i=n.default||n;if(Array.isArray(i))return this.validateWithRules(e,i,r);else return this.validateWithJSONSchema(e,i,r)}catch(n){throw new $t(t,[{path:"",message:`Failed to load schema: ${n}`}])}}validateWithJSONSchema(e,t,r){let n=[],i=[];return this.validateObjectAgainstSchema(e,t,"",n,i,r),{isValid:n.length===0,errors:n,warnings:i}}validateObjectAgainstSchema(e,t,r,n,i,o){if(o.validateTypes&&t.type){let s=Array.isArray(e)?"array":typeof e,c=Array.isArray(t.type)?t.type:[t.type];if(!c.includes(s)){if(n.push({path:r,message:`Expected type ${c.join(" or ")}, got ${s}`,expected:c.join(" or "),actual:s,rule:"type"}),o.stopOnFirstError)return}}if(t.enum&&!t.enum.includes(e)){if(n.push({path:r,message:`Value must be one of: ${t.enum.join(", ")}`,expected:t.enum.join(", "),actual:e,rule:"enum"}),o.stopOnFirstError)return}if(typeof e==="string"){if(t.minLength!==void 0&&e.length<t.minLength)n.push({path:r,message:`String length must be at least ${t.minLength}`,expected:`>= ${t.minLength}`,actual:e.length,rule:"minLength"});if(t.maxLength!==void 0&&e.length>t.maxLength)n.push({path:r,message:`String length must not exceed ${t.maxLength}`,expected:`<= ${t.maxLength}`,actual:e.length,rule:"maxLength"});if(t.pattern){if(!new RegExp(t.pattern).test(e))n.push({path:r,message:`String does not match pattern ${t.pattern}`,expected:t.pattern,actual:e,rule:"pattern"})}}if(typeof e==="number"){if(t.minimum!==void 0&&e<t.minimum)n.push({path:r,message:`Value must be at least ${t.minimum}`,expected:`>= ${t.minimum}`,actual:e,rule:"minimum"});if(t.maximum!==void 0&&e>t.maximum)n.push({path:r,message:`Value must not exceed ${t.maximum}`,expected:`<= ${t.maximum}`,actual:e,rule:"maximum"})}if(Array.isArray(e)&&t.items)for(let s=0;s<e.length;s++){let c=r?`${r}[${s}]`:`[${s}]`;if(this.validateObjectAgainstSchema(e[s],t.items,c,n,i,o),o.stopOnFirstError&&n.length>0)return}if(e&&typeof e==="object"&&!Array.isArray(e)){let s=e;if(o.validateRequired&&t.required){for(let c of t.required)if(!(c in s)){if(n.push({path:r?`${r}.${c}`:c,message:`Missing required property '${c}'`,expected:"required",rule:"required"}),o.stopOnFirstError)return}}if(t.properties){for(let[c,a]of Object.entries(t.properties))if(c in s){let l=r?`${r}.${c}`:c;if(this.validateObjectAgainstSchema(s[c],a,l,n,i,o),o.stopOnFirstError&&n.length>0)return}}if(t.additionalProperties===!1){let c=new Set(Object.keys(t.properties||{}));for(let a of Object.keys(s))if(!c.has(a))i.push({path:r?`${r}.${a}`:a,message:`Additional property '${a}' is not allowed`,rule:"additionalProperties"})}}}validateWithRules(e,t,r){let n=[],i=[];for(let o of t)try{let s=this.getValueByPath(e,o.path),c=this.validateWithRule(s,o,o.path);if(n.push(...c),r.stopOnFirstError&&n.length>0)break}catch(s){n.push({path:o.path,message:`Rule validation failed: ${s}`,rule:"system"})}return{isValid:n.length===0,errors:n,warnings:i}}validateWithRule(e,t,r){let n=[];if(t.required&&(e===void 0||e===null))return n.push({path:r,message:t.message||`Property '${r}' is required`,expected:"required",rule:"required"}),n;if(e===void 0||e===null)return n;if(t.type){let i=Array.isArray(e)?"array":typeof e;if(i!==t.type)n.push({path:r,message:t.message||`Expected type ${t.type}, got ${i}`,expected:t.type,actual:i,rule:"type"})}if(t.min!==void 0){let i=Array.isArray(e)?e.length:typeof e==="string"?e.length:typeof e==="number"?e:0;if(i<t.min)n.push({path:r,message:t.message||`Value must be at least ${t.min}`,expected:`>= ${t.min}`,actual:i,rule:"min"})}if(t.max!==void 0){let i=Array.isArray(e)?e.length:typeof e==="string"?e.length:typeof e==="number"?e:0;if(i>t.max)n.push({path:r,message:t.message||`Value must not exceed ${t.max}`,expected:`<= ${t.max}`,actual:i,rule:"max"})}if(t.pattern&&typeof e==="string"){if(!t.pattern.test(e))n.push({path:r,message:t.message||`Value does not match pattern ${t.pattern}`,expected:t.pattern.toString(),actual:e,rule:"pattern"})}if(t.enum&&!t.enum.includes(e))n.push({path:r,message:t.message||`Value must be one of: ${t.enum.join(", ")}`,expected:t.enum.join(", "),actual:e,rule:"enum"});if(t.validator){let i=t.validator(e);if(i)n.push({path:r,message:t.message||i,rule:"custom"})}return n}getValueByPath(e,t){if(!t)return e;let r=t.split("."),n=e;for(let i of r)if(n&&typeof n==="object"&&i in n)n=n[i];else return;return n}generateRulesFromInterface(e){let t=[],r=e.matchAll(/(\w+)(\?)?:\s*(\w+)/g);for(let n of r){let[,i,o,s]=n;t.push({path:i,required:!o,type:this.mapTypeScriptType(s)})}return t}mapTypeScriptType(e){switch(e.toLowerCase()){case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"array":return"array";case"object":return"object";default:return"object"}}static createCommonRules(){return{server:[{path:"port",required:!0,type:"number",min:1,max:65535},{path:"host",required:!0,type:"string",min:1},{path:"ssl",type:"boolean"}],database:[{path:"url",required:!0,type:"string",min:1},{path:"pool",type:"number",min:1,max:100},{path:"timeout",type:"number",min:0}],api:[{path:"baseUrl",required:!0,type:"string",pattern:fs},{path:"timeout",type:"number",min:0},{path:"retries",type:"number",min:0,max:10}]}}}class Kn{fileLoader=new vr;envProcessor=new xr;validator=new Wn;async loadConfig(e){let t=Date.now(),{cache:r,performance:n,schema:i,validate:o,...s}=e;try{if(r?.enabled){let a=this.checkCache(s.name||"",s);if(a)return a}let c;try{c=await this.loadConfigurationStrategies(s,!0,r)}catch(a){let l=s.__strictErrorHandling;if(a instanceof Error&&a.name==="ConfigNotFoundError"){if(l)throw a;c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`No configuration file found for "${s.name||"config"}", using defaults with environment variables`]}}else if(a instanceof Error&&a.name==="ConfigLoadError"){let u=a.message.includes("EACCES")||a.message.includes("EPERM")||a.message.includes("permission denied"),f=!u&&(a.message.includes("syntax")||a.message.includes("Expected")||a.message.includes("Unexpected")||a.message.includes("BuildMessage")||a.message.includes("errors building")),d=a.message.includes("Configuration must export a valid object")||a.message.includes("Configuration file is empty and exports nothing");if(l&&(d||u))throw a;if(f&&(!l||!d))c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:["Configuration file has syntax errors, using defaults with environment variables"]};else if(!l)c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`Configuration loading error, using defaults: ${a.message}`]};else throw a}else c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`Configuration loading failed, using defaults: ${a instanceof Error?a.message:String(a)}`]}}if(i||o)await this.validateConfiguration(c.config,i,o,s.name);if(r?.enabled&&c)this.cacheResult(s.name||"",c,r,s);if(n?.enabled){let a={operation:"loadConfig",duration:Date.now()-t,configName:s.name,timestamp:new Date};if(n.onMetrics)n.onMetrics(a);if(n.slowThreshold&&a.duration>n.slowThreshold)fe.warn(`Slow configuration loading detected: ${a.duration}ms for ${s.name}`);c.metrics=a}return c}catch(c){let a=Date.now()-t;throw fe.error(`Configuration loading failed after ${a}ms:`,[c instanceof Error?c:Error(String(c))]),c}}async loadConfigurationStrategies(e,t=!1,r){let{name:n="",alias:i,cwd:o,configDir:s,defaultConfig:c,checkEnv:a=!0,arrayStrategy:l="replace",verbose:u=!1}=e,f=o||ze.cwd(),d=[],h=await this.loadLocalConfiguration(n,i,f,s,c,l,u,a,r);if(h)return d.push(...this.getLocalSearchPaths(n,i,f,s)),this.finalizeResult(h,d,a,n,u);let m=await this.loadHomeConfiguration(n,i,c,l,u,a);if(m)return d.push(...this.getHomeSearchPaths(n,i)),this.finalizeResult(m,d,a,n,u);let p=await this.loadPackageJsonConfiguration(n,i,f,c,l,u,a);if(p)return d.push(Q(f,"package.json")),this.finalizeResult(p,d,a,n,u);if(d.push(...this.getAllSearchPaths(n,i,f,s)),t)throw Pe.configNotFound(n,d,i);return{...await this.applyEnvironmentVariables(n,c,a,u),warnings:[`No configuration file found for "${n}"${i?` or alias "${i}"`:""}, using defaults with environment variables`]}}async loadLocalConfiguration(e,t,r,n,i,o,s,c,a){let l=c?vt(e,i,s):i,u=this.getLocalDirectories(r,n);for(let f of u){if(s)fe.info(`Searching for configuration in: ${f}`);let d=this.fileLoader.generateConfigPaths(e,f,t),h=await this.fileLoader.tryLoadFromPaths(d,l,{arrayStrategy:o,verbose:s,cacheTtl:a?.ttl,useCache:!a?.ttl||a.ttl>100});if(h){if(s)fe.success(`Configuration loaded from: ${h.source.path}`);return h}}return null}async loadHomeConfiguration(e,t,r,n,i,o){if(!e)return null;let s=o?vt(e,r,i):r,c=[Q(Ye(),".config",e),Q(Ye(),".config"),Ye()];for(let a of c){if(i)fe.info(`Checking home directory: ${a}`);let l=this.fileLoader.generateConfigPaths(e,a,t),u=await this.fileLoader.tryLoadFromPaths(l,s,{arrayStrategy:n,verbose:i});if(u){if(i)fe.success(`Configuration loaded from home directory: ${u.source.path}`);return u}}return null}async loadPackageJsonConfiguration(e,t,r,n,i,o,s){let c=s?vt(e,n,o):n;try{let a=Q(r,"package.json");if(!Sn(a))return null;let l=await import(a),u=l[e],f=e;if(!u&&t)u=l[t],f=t;if(u&&typeof u==="object"&&!Array.isArray(u)){if(o)fe.success(`Configuration loaded from package.json: ${f}`);return{config:zn(c,u,i),source:{type:"package.json",path:a,priority:30,timestamp:new Date}}}}catch(a){if(o)fe.warn("Failed to load package.json:",[a instanceof Error?a:Error(String(a))])}return null}async applyEnvironmentVariables(e,t,r,n){if(!r||!e||typeof t!=="object"||t===null||Array.isArray(t))return{config:t,source:{type:"default",priority:10,timestamp:new Date}};return{config:vt(e,t,n),source:{type:"environment",priority:20,timestamp:new Date}}}async finalizeResult(e,t,r,n,i){return{config:e.config,source:e.source,path:e.source.path}}async validateConfiguration(e,t,r,n){let i=[];if(r){let o=r(e);if(o)i.push(...o)}if(t){let o=await this.validator.validateConfiguration(e,t);if(!o.isValid)i.push(...o.errors.map((s)=>s.path?`${s.path}: ${s.message}`:s.message))}if(i.length>0)throw Pe.configValidation(n||"unknown",i,n)}checkCache(e,t){let r=this.generateCacheKey(e,t);return ot.get(r)||null}cacheResult(e,t,r,n){let i=this.generateCacheKey(e,n);ot.set(i,t,void 0,r.ttl)}generateCacheKey(e,t){let r=[e];if(t.alias)r.push(`alias:${t.alias}`);if(t.cwd)r.push(`cwd:${t.cwd}`);if(t.configDir)r.push(`configDir:${t.configDir}`);if("checkEnv"in t)r.push(`checkEnv:${t.checkEnv}`);return r.join("|")}getLocalDirectories(e,t){return Array.from(new Set([e,Q(e,"config"),Q(e,".config"),t?Q(e,t):void 0].filter(Boolean)))}getAllSearchPaths(e,t,r,n){let i=[];return i.push(...this.getLocalSearchPaths(e,t,r,n)),i.push(...this.getHomeSearchPaths(e,t)),i.push(Q(r,"package.json")),i}getLocalSearchPaths(e,t,r,n){let i=this.getLocalDirectories(r,n),o=[];for(let s of i)o.push(...this.fileLoader.generateConfigPaths(e,s,t));return o}getHomeSearchPaths(e,t){if(!e)return[];let r=[Q(Ye(),".config",e),Q(Ye(),".config"),Ye()],n=[];for(let i of r)n.push(...this.fileLoader.generateConfigPaths(e,i,t));return n}async loadConfigWithResult(e){return this.loadConfig(e)}}function Oo(e){let r=!(e.message.includes("EACCES")||e.message.includes("EPERM")||e.message.includes("permission denied"))&&(e.message.includes("syntax")||e.message.includes("Expected")||e.message.includes("Unexpected")||e.message.includes("BuildMessage")),n=e.message.includes("Configuration must export a valid object")||e.message.includes("Configuration file is empty and exports nothing");return r||n}async function qf(e){return ke.loadConfig({...e,__strictErrorHandling:!0})}async function os(e){let t="defaultConfig"in e&&e.defaultConfig!==void 0?e.defaultConfig:{},r="cache"in e||"performance"in e||"schema"in e||"validate"in e;try{let n;if(r)n=await ke.loadConfig(e);else n=await ke.loadConfig({...e,defaultConfig:t,cache:{enabled:!0},performance:{enabled:!1}});return n?.config??t}catch(n){let i=n instanceof Error?n.name:"UnknownError",o=n instanceof Error?n.message:String(n);if(!(i==="ConfigNotFoundError"||i==="ConfigLoadError"||i==="ConfigValidationError"||o.includes("config"))&&e.verbose)fe.warn("Unexpected error loading config, using defaults:",[n instanceof Error?n:Error(String(n))]);let c=r?{...e,defaultConfig:t}:{...e,defaultConfig:t,cache:{enabled:!0},performance:{enabled:!1}};if("checkEnv"in e?e.checkEnv!==!1:!0)return(await ke.applyEnvironmentVariables(c.name||"",t,!0,c.verbose||!1))?.config??t;return t}}async function Yf(e={defaultConfig:{}}){if(typeof e==="string"){let{cwd:t}=await import("process");try{return(await ke.loadConfig({name:e,cwd:t(),generatedDir:"./generated",configDir:"./config",defaultConfig:{},checkEnv:!0,arrayStrategy:"replace"})).config}catch(r){if(r instanceof Error&&(r.name==="ConfigNotFoundError"||r.name==="ConfigLoadError"&&Oo(r)))return(await ke.applyEnvironmentVariables(e,{},!0,!1)).config;throw r}}try{return(await ke.loadConfig({...e,cwd:e.cwd||ze.cwd(),cache:{enabled:!0},performance:{enabled:!1}})).config}catch(t){if(t instanceof Error&&(t.name==="ConfigNotFoundError"||t.name==="ConfigLoadError"&&Oo(t)))return(await ke.applyEnvironmentVariables(e.name||"",e.defaultConfig||{},e.checkEnv!==!1,e.verbose||!1)).config;throw t}}async function Jf(e,t,r="replace"){let n=new vr;try{let i=await n.loadFromPath(e,t,{arrayStrategy:r,useCache:!1,trackPerformance:!1});return i?i.config:null}catch{return null}}function vt(e,t,r=!1){let n=new xr,i=e.toUpperCase().replace(/[^A-Z0-9]/g,"_");function o(s,c=[]){let a={...s};for(let[l,u]of Object.entries(s)){let f=[...c,l],d=[`${i}_${f.join("_").toUpperCase()}`,`${i}_${f.map((p)=>p.toUpperCase()).join("")}`,`${i}_${f.map((p)=>p.replace(/([A-Z])/g,"_$1").toUpperCase()).join("")}`],h,m;for(let p of d)if(h=ze.env[p],h!==void 0){m=p;break}if(h!==void 0&&m)if(typeof u==="boolean")a[l]=["true","1","yes"].includes(h.toLowerCase());else if(typeof u==="number"){let p=Number(h);if(!Number.isNaN(p))a[l]=p}else if(Array.isArray(u))try{a[l]=JSON.parse(h)}catch{a[l]=h.split(",").map((p)=>p.trim())}else a[l]=h;else if(u&&typeof u==="object"&&!Array.isArray(u))a[l]=o(u,f)}return a}return o(t)}function Xf(e){let t=Q(ze.cwd(),e.configDir),r=Q(ze.cwd(),e.generatedDir),n=Q(r,"config-types.ts");if(!Sn(ao(n)))Du(ao(n),{recursive:!0,mode:511});let i=Sn(t)?ju(t).map((s)=>s.replace(/\.(ts|js|mjs|cjs|mts|cts|json)$/,"")).sort():[],o=`// Generated by bunfig v${Sd}
|
|
32
|
+
`;return r}}function Kf(e,t){let r=ss("process");if(typeof r>"u"||!r.env)return t;let n=r.env[e];return n!==void 0?n:t}function rs(e,t,r={}){return ns(e,t,r,new WeakMap)}function ns(e,t,r,n){let{arrayMergeMode:i="replace",skipNullish:o=!1,customMerger:s}=r;if(t===null||t===void 0)return o?e:t;if(s){let c=s(e,t);if(c!==void 0)return c}if(Array.isArray(t)||Array.isArray(e))return is(e,t,i,n);if(!se(t)||!se(e))return t;return Yf(e,t,r,n)}function is(e,t,r,n){if(Array.isArray(t)&&!Array.isArray(e))return t;if(Array.isArray(e)&&!Array.isArray(t))return t;if(Array.isArray(t)&&Array.isArray(e))switch(r){case"replace":return t;case"concat":return Gf(e,t);case"smart":return Hf(e,t,n);default:return t}return t}function Gf(e,t){let r=[...t];for(let n of e)if(!r.some((i)=>An(i,n)))r.push(n);return r}function Hf(e,t,r){if(t.length===0)return e;if(e.length===0)return t;if(se(t[0])&&se(e[0]))return qf(e,t,r);if(t.every((n)=>typeof n==="string")&&e.every((n)=>typeof n==="string")){let n=[...t];for(let i of e)if(!n.includes(i))n.push(i);return n}return t}function qf(e,t,r){let n=[...t];for(let i of e){if(!se(i)){n.push(i);continue}let o=["id","name","key","path","type"],s=!1;for(let c of o)if(c in i){if(n.find((l)=>se(l)&&(c in l)&&l[c]===i[c])){s=!0;break}}if(!s)n.push(i)}return n}function Yf(e,t,r,n){let i=t;if(se(i)&&n.has(i))return n.get(i);let o={...e};if(se(i))n.set(i,o);for(let s in i){if(!Object.prototype.hasOwnProperty.call(i,s))continue;let c=i[s],a=o[s];if(r.skipNullish&&(c===null||c===void 0))continue;if(c===null||c===void 0){o[s]=c;continue}if(se(c)&&se(a))o[s]=ns(a,c,r,n);else if(Array.isArray(c)||Array.isArray(a))o[s]=is(a,c,r.arrayMergeMode||"smart",n);else o[s]=c}return o}function zn(e,t,r="replace"){return rs(e,t,{arrayMergeMode:r==="replace"?"replace":"smart",skipNullish:!0})}function An(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!An(e[r],t[r]))return!1;return!0}if(se(e)&&se(t)){let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let i of r){if(!Object.prototype.hasOwnProperty.call(t,i))return!1;if(!An(e[i],t[i]))return!1}return!0}return!1}function se(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}class wr{extensions=[".ts",".js",".mjs",".cjs",".json",".mts",".cts"];async loadFromPath(e,t,r={}){let{arrayStrategy:n="replace",useCache:i=!0,cacheTtl:o,trackPerformance:s=!0,verbose:c=!1}=r;if(i){let l=ot.getWithFileCheck("file",e);if(l){if(c)console.log(`Configuration loaded from cache: ${e}`);return l}}let a=async()=>{if(!Ht(e))return null;try{let l=`?t=${Date.now()}`,u=await import(e+l),f=u.default||u,d="default"in u,h=Object.keys(u).length>0;if(!d&&!h)throw new Ct(e,Error("Configuration file is empty and exports nothing"),"unknown");if(typeof f!=="object"||f===null||Array.isArray(f))throw new Ct(e,Error("Configuration must export a valid object"),"unknown");let g={config:zn(t,f,n),source:{type:"file",path:e,priority:100,timestamp:new Date}};if(i)ot.setWithFileCheck("file",g,e,o);return g}catch(l){throw l instanceof Error?Pe.configLoad(e,l):Pe.configLoad(e,Error(String(l)))}};if(s)return Rt.track("loadFromPath",a,{path:e});return a()}async tryLoadFromPaths(e,t,r={}){for(let n of e)try{let i=await this.loadFromPath(n,t,r);if(i)return i}catch(i){if(i instanceof Error&&i.name==="ConfigLoadError")throw i;if(r.verbose)console.warn(`Failed to load config from ${n}:`,i)}return null}generateConfigPaths(e,t,r){let n=this.generateNamePatterns(e,r),i=[];for(let o of n)for(let s of this.extensions)i.push(mn(t,`${o}${s}`));return i}generateNamePatterns(e,t){let r=[];if(r.push("config",".config"),e)r.push(e,`.${e}.config`,`${e}.config`,`.${e}`);if(t){if(r.push(t,`.${t}.config`,`${t}.config`,`.${t}`),e)r.push(`${e}.${t}.config`,`.${e}.${t}.config`)}return r.filter(Boolean)}checkFileAccess(e){return es(async()=>Ht(e),{maxRetries:2,retryDelay:100,fallback:!1})}async discoverConfigFiles(e,t,r){let n=[];if(!Ht(e))return n;if(t||r){let i=this.generateNamePatterns(t||"",r);for(let o of i)for(let s of this.extensions){let c=mn(e,`${o}${s}`);if(await this.checkFileAccess(c))n.push(c)}}else try{let{readdirSync:i}=await import("fs"),o=i(e);for(let s of o)if(this.looksLikeConfigFile(s)){let c=mn(e,s);if(await this.checkFileAccess(c))n.push(c)}}catch{return[]}return n}looksLikeConfigFile(e){return[/\.config\.(ts|js|mjs|cjs|json|mts|cts)$/,/^\..*\.(ts|js|mjs|cjs|json|mts|cts)$/,/config\.(ts|js|mjs|cjs|json|mts|cts)$/].some((r)=>r.test(e))}async validateConfigFile(e){let t=[];try{if(!Ht(e))return t.push("Configuration file does not exist"),t;let r=await import(e),n=r.default||r;if(n===void 0)t.push("Configuration file must export a default value or named exports");else if(typeof n!=="object"||n===null)t.push("Configuration must be an object");else if(Array.isArray(n))t.push("Configuration cannot be an array at the root level");if(e.endsWith(".json"))try{let{readFileSync:i}=await import("fs"),o=i(e,"utf8");JSON.parse(o)}catch(i){t.push(`Invalid JSON syntax: ${i}`)}}catch(r){t.push(`Failed to load configuration file: ${r}`)}return t}async getFileModificationTime(e){try{let{statSync:t}=await import("fs");return t(e).mtime}catch{return null}}async preloadConfigurations(e,t={}){let r=new Map;return await Promise.allSettled(e.map(async(n)=>{try{let i=await this.loadFromPath(n,{},t);if(i)r.set(n,i.config)}catch(i){if(t.verbose)console.warn(`Failed to preload ${n}:`,i)}})),r}}class Wn{async validateConfiguration(e,t,r={}){let{stopOnFirstError:n=!1,validateRequired:i=!0,validateTypes:o=!0,customRules:s=[],trackPerformance:c=!0,verbose:a=!1}=r,l=async()=>{let u=[],f=[],d={stopOnFirstError:n,validateRequired:i,validateTypes:o,customRules:s,trackPerformance:c,verbose:a};try{if(typeof t==="string")return await this.validateWithSchemaFile(e,t,d);else if(Array.isArray(t))return this.validateWithRules(e,[...t,...s],d);else return this.validateWithJSONSchema(e,t,d)}catch(h){return u.push({path:"",message:`Validation failed: ${h}`,rule:"system"}),{isValid:!1,errors:u,warnings:f}}};if(c)return await Rt.track("validateConfiguration",l);return l()}async validateWithSchemaFile(e,t,r){try{if(!uf(t))throw new $t(t,[{path:"",message:"Schema file does not exist"}]);let n=await import(t),i=n.default||n;if(Array.isArray(i))return this.validateWithRules(e,i,r);else return this.validateWithJSONSchema(e,i,r)}catch(n){throw new $t(t,[{path:"",message:`Failed to load schema: ${n}`}])}}validateWithJSONSchema(e,t,r){let n=[],i=[];return this.validateObjectAgainstSchema(e,t,"",n,i,r),{isValid:n.length===0,errors:n,warnings:i}}validateObjectAgainstSchema(e,t,r,n,i,o){if(o.validateTypes&&t.type){let s=Array.isArray(e)?"array":typeof e,c=Array.isArray(t.type)?t.type:[t.type];if(!c.includes(s)){if(n.push({path:r,message:`Expected type ${c.join(" or ")}, got ${s}`,expected:c.join(" or "),actual:s,rule:"type"}),o.stopOnFirstError)return}}if(t.enum&&!t.enum.includes(e)){if(n.push({path:r,message:`Value must be one of: ${t.enum.join(", ")}`,expected:t.enum.join(", "),actual:e,rule:"enum"}),o.stopOnFirstError)return}if(typeof e==="string"){if(t.minLength!==void 0&&e.length<t.minLength)n.push({path:r,message:`String length must be at least ${t.minLength}`,expected:`>= ${t.minLength}`,actual:e.length,rule:"minLength"});if(t.maxLength!==void 0&&e.length>t.maxLength)n.push({path:r,message:`String length must not exceed ${t.maxLength}`,expected:`<= ${t.maxLength}`,actual:e.length,rule:"maxLength"});if(t.pattern){if(!new RegExp(t.pattern).test(e))n.push({path:r,message:`String does not match pattern ${t.pattern}`,expected:t.pattern,actual:e,rule:"pattern"})}}if(typeof e==="number"){if(t.minimum!==void 0&&e<t.minimum)n.push({path:r,message:`Value must be at least ${t.minimum}`,expected:`>= ${t.minimum}`,actual:e,rule:"minimum"});if(t.maximum!==void 0&&e>t.maximum)n.push({path:r,message:`Value must not exceed ${t.maximum}`,expected:`<= ${t.maximum}`,actual:e,rule:"maximum"})}if(Array.isArray(e)&&t.items)for(let s=0;s<e.length;s++){let c=r?`${r}[${s}]`:`[${s}]`;if(this.validateObjectAgainstSchema(e[s],t.items,c,n,i,o),o.stopOnFirstError&&n.length>0)return}if(e&&typeof e==="object"&&!Array.isArray(e)){let s=e;if(o.validateRequired&&t.required){for(let c of t.required)if(!(c in s)){if(n.push({path:r?`${r}.${c}`:c,message:`Missing required property '${c}'`,expected:"required",rule:"required"}),o.stopOnFirstError)return}}if(t.properties){for(let[c,a]of Object.entries(t.properties))if(c in s){let l=r?`${r}.${c}`:c;if(this.validateObjectAgainstSchema(s[c],a,l,n,i,o),o.stopOnFirstError&&n.length>0)return}}if(t.additionalProperties===!1){let c=new Set(Object.keys(t.properties||{}));for(let a of Object.keys(s))if(!c.has(a))i.push({path:r?`${r}.${a}`:a,message:`Additional property '${a}' is not allowed`,rule:"additionalProperties"})}}}validateWithRules(e,t,r){let n=[],i=[];for(let o of t)try{let s=this.getValueByPath(e,o.path),c=this.validateWithRule(s,o,o.path);if(n.push(...c),r.stopOnFirstError&&n.length>0)break}catch(s){n.push({path:o.path,message:`Rule validation failed: ${s}`,rule:"system"})}return{isValid:n.length===0,errors:n,warnings:i}}validateWithRule(e,t,r){let n=[];if(t.required&&(e===void 0||e===null))return n.push({path:r,message:t.message||`Property '${r}' is required`,expected:"required",rule:"required"}),n;if(e===void 0||e===null)return n;if(t.type){let i=Array.isArray(e)?"array":typeof e;if(i!==t.type)n.push({path:r,message:t.message||`Expected type ${t.type}, got ${i}`,expected:t.type,actual:i,rule:"type"})}if(t.min!==void 0){let i=Array.isArray(e)?e.length:typeof e==="string"?e.length:typeof e==="number"?e:0;if(i<t.min)n.push({path:r,message:t.message||`Value must be at least ${t.min}`,expected:`>= ${t.min}`,actual:i,rule:"min"})}if(t.max!==void 0){let i=Array.isArray(e)?e.length:typeof e==="string"?e.length:typeof e==="number"?e:0;if(i>t.max)n.push({path:r,message:t.message||`Value must not exceed ${t.max}`,expected:`<= ${t.max}`,actual:i,rule:"max"})}if(t.pattern&&typeof e==="string"){if(!t.pattern.test(e))n.push({path:r,message:t.message||`Value does not match pattern ${t.pattern}`,expected:t.pattern.toString(),actual:e,rule:"pattern"})}if(t.enum&&!t.enum.includes(e))n.push({path:r,message:t.message||`Value must be one of: ${t.enum.join(", ")}`,expected:t.enum.join(", "),actual:e,rule:"enum"});if(t.validator){let i=t.validator(e);if(i)n.push({path:r,message:t.message||i,rule:"custom"})}return n}getValueByPath(e,t){if(!t)return e;let r=t.split("."),n=e;for(let i of r)if(n&&typeof n==="object"&&i in n)n=n[i];else return;return n}generateRulesFromInterface(e){let t=[],r=e.matchAll(/(\w+)(\?)?:\s*(\w+)/g);for(let n of r){let[,i,o,s]=n;t.push({path:i,required:!o,type:this.mapTypeScriptType(s)})}return t}mapTypeScriptType(e){switch(e.toLowerCase()){case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"array":return"array";case"object":return"object";default:return"object"}}static createCommonRules(){return{server:[{path:"port",required:!0,type:"number",min:1,max:65535},{path:"host",required:!0,type:"string",min:1},{path:"ssl",type:"boolean"}],database:[{path:"url",required:!0,type:"string",min:1},{path:"pool",type:"number",min:1,max:100},{path:"timeout",type:"number",min:0}],api:[{path:"baseUrl",required:!0,type:"string",pattern:fs},{path:"timeout",type:"number",min:0},{path:"retries",type:"number",min:0,max:10}]}}}class Kn{fileLoader=new wr;envProcessor=new vr;validator=new Wn;async loadConfig(e){let t=Date.now(),{cache:r,performance:n,schema:i,validate:o,...s}=e;try{if(r?.enabled){let a=this.checkCache(s.name||"",s);if(a)return a}let c;try{c=await this.loadConfigurationStrategies(s,!0,r)}catch(a){let l=s.__strictErrorHandling;if(a instanceof Error&&a.name==="ConfigNotFoundError"){if(l)throw a;c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`No configuration file found for "${s.name||"config"}", using defaults with environment variables`]}}else if(a instanceof Error&&a.name==="ConfigLoadError"){let u=a.message.includes("EACCES")||a.message.includes("EPERM")||a.message.includes("permission denied"),f=!u&&(a.message.includes("syntax")||a.message.includes("Expected")||a.message.includes("Unexpected")||a.message.includes("BuildMessage")||a.message.includes("errors building")),d=a.message.includes("Configuration must export a valid object")||a.message.includes("Configuration file is empty and exports nothing");if(l&&(d||u))throw a;if(f&&(!l||!d))c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:["Configuration file has syntax errors, using defaults with environment variables"]};else if(!l)c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`Configuration loading error, using defaults: ${a.message}`]};else throw a}else c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`Configuration loading failed, using defaults: ${a instanceof Error?a.message:String(a)}`]}}if(i||o)await this.validateConfiguration(c.config,i,o,s.name);if(r?.enabled&&c)this.cacheResult(s.name||"",c,r,s);if(n?.enabled){let a={operation:"loadConfig",duration:Date.now()-t,configName:s.name,timestamp:new Date};if(n.onMetrics)n.onMetrics(a);if(n.slowThreshold&&a.duration>n.slowThreshold)fe.warn(`Slow configuration loading detected: ${a.duration}ms for ${s.name}`);c.metrics=a}return c}catch(c){let a=Date.now()-t;throw fe.error(`Configuration loading failed after ${a}ms:`,[c instanceof Error?c:Error(String(c))]),c}}async loadConfigurationStrategies(e,t=!1,r){let{name:n="",alias:i,cwd:o,configDir:s,defaultConfig:c,checkEnv:a=!0,arrayStrategy:l="replace",verbose:u=!1}=e,f=o||ze.cwd(),d=[],h=await this.loadLocalConfiguration(n,i,f,s,c,l,u,a,r);if(h)return d.push(...this.getLocalSearchPaths(n,i,f,s)),this.finalizeResult(h,d,a,n,u);let m=await this.loadHomeConfiguration(n,i,c,l,u,a);if(m)return d.push(...this.getHomeSearchPaths(n,i)),this.finalizeResult(m,d,a,n,u);let p=await this.loadPackageJsonConfiguration(n,i,f,c,l,u,a);if(p)return d.push(Q(f,"package.json")),this.finalizeResult(p,d,a,n,u);if(d.push(...this.getAllSearchPaths(n,i,f,s)),t)throw Pe.configNotFound(n,d,i);return{...await this.applyEnvironmentVariables(n,c,a,u),warnings:[`No configuration file found for "${n}"${i?` or alias "${i}"`:""}, using defaults with environment variables`]}}async loadLocalConfiguration(e,t,r,n,i,o,s,c,a){let l=c?vt(e,i,s):i,u=this.getLocalDirectories(r,n);for(let f of u){if(s)fe.info(`Searching for configuration in: ${f}`);let d=this.fileLoader.generateConfigPaths(e,f,t),h=await this.fileLoader.tryLoadFromPaths(d,l,{arrayStrategy:o,verbose:s,cacheTtl:a?.ttl,useCache:!a?.ttl||a.ttl>100});if(h){if(s)fe.success(`Configuration loaded from: ${h.source.path}`);return h}}return null}async loadHomeConfiguration(e,t,r,n,i,o){if(!e)return null;let s=o?vt(e,r,i):r,c=[Q(Ye(),".config",e),Q(Ye(),".config"),Ye()];for(let a of c){if(i)fe.info(`Checking home directory: ${a}`);let l=this.fileLoader.generateConfigPaths(e,a,t),u=await this.fileLoader.tryLoadFromPaths(l,s,{arrayStrategy:n,verbose:i});if(u){if(i)fe.success(`Configuration loaded from home directory: ${u.source.path}`);return u}}return null}async loadPackageJsonConfiguration(e,t,r,n,i,o,s){let c=s?vt(e,n,o):n;try{let a=Q(r,"package.json");if(!Sn(a))return null;let l=await import(a),u=l[e],f=e;if(!u&&t)u=l[t],f=t;if(u&&typeof u==="object"&&!Array.isArray(u)){if(o)fe.success(`Configuration loaded from package.json: ${f}`);return{config:zn(c,u,i),source:{type:"package.json",path:a,priority:30,timestamp:new Date}}}}catch(a){if(o)fe.warn("Failed to load package.json:",[a instanceof Error?a:Error(String(a))])}return null}async applyEnvironmentVariables(e,t,r,n){if(!r||!e||typeof t!=="object"||t===null||Array.isArray(t))return{config:t,source:{type:"default",priority:10,timestamp:new Date}};return{config:vt(e,t,n),source:{type:"environment",priority:20,timestamp:new Date}}}async finalizeResult(e,t,r,n,i){return{config:e.config,source:e.source,path:e.source.path}}async validateConfiguration(e,t,r,n){let i=[];if(r){let o=r(e);if(o)i.push(...o)}if(t){let o=await this.validator.validateConfiguration(e,t);if(!o.isValid)i.push(...o.errors.map((s)=>s.path?`${s.path}: ${s.message}`:s.message))}if(i.length>0)throw Pe.configValidation(n||"unknown",i,n)}checkCache(e,t){let r=this.generateCacheKey(e,t);return ot.get(r)||null}cacheResult(e,t,r,n){let i=this.generateCacheKey(e,n);ot.set(i,t,void 0,r.ttl)}generateCacheKey(e,t){let r=[e];if(t.alias)r.push(`alias:${t.alias}`);if(t.cwd)r.push(`cwd:${t.cwd}`);if(t.configDir)r.push(`configDir:${t.configDir}`);if("checkEnv"in t)r.push(`checkEnv:${t.checkEnv}`);return r.join("|")}getLocalDirectories(e,t){return Array.from(new Set([e,Q(e,"config"),Q(e,".config"),t?Q(e,t):void 0].filter(Boolean)))}getAllSearchPaths(e,t,r,n){let i=[];return i.push(...this.getLocalSearchPaths(e,t,r,n)),i.push(...this.getHomeSearchPaths(e,t)),i.push(Q(r,"package.json")),i}getLocalSearchPaths(e,t,r,n){let i=this.getLocalDirectories(r,n),o=[];for(let s of i)o.push(...this.fileLoader.generateConfigPaths(e,s,t));return o}getHomeSearchPaths(e,t){if(!e)return[];let r=[Q(Ye(),".config",e),Q(Ye(),".config"),Ye()],n=[];for(let i of r)n.push(...this.fileLoader.generateConfigPaths(e,i,t));return n}async loadConfigWithResult(e){return this.loadConfig(e)}}function Oo(e){let r=!(e.message.includes("EACCES")||e.message.includes("EPERM")||e.message.includes("permission denied"))&&(e.message.includes("syntax")||e.message.includes("Expected")||e.message.includes("Unexpected")||e.message.includes("BuildMessage")),n=e.message.includes("Configuration must export a valid object")||e.message.includes("Configuration file is empty and exports nothing");return r||n}async function Jf(e){return ke.loadConfig({...e,__strictErrorHandling:!0})}async function os(e){let t="defaultConfig"in e&&e.defaultConfig!==void 0?e.defaultConfig:{},r="cache"in e||"performance"in e||"schema"in e||"validate"in e;try{let n;if(r)n=await ke.loadConfig(e);else n=await ke.loadConfig({...e,defaultConfig:t,cache:{enabled:!0},performance:{enabled:!1}});return n?.config??t}catch(n){let i=n instanceof Error?n.name:"UnknownError",o=n instanceof Error?n.message:String(n);if(!(i==="ConfigNotFoundError"||i==="ConfigLoadError"||i==="ConfigValidationError"||o.includes("config"))&&e.verbose)fe.warn("Unexpected error loading config, using defaults:",[n instanceof Error?n:Error(String(n))]);let c=r?{...e,defaultConfig:t}:{...e,defaultConfig:t,cache:{enabled:!0},performance:{enabled:!1}};if("checkEnv"in e?e.checkEnv!==!1:!0)return(await ke.applyEnvironmentVariables(c.name||"",t,!0,c.verbose||!1))?.config??t;return t}}async function Xf(e={defaultConfig:{}}){if(typeof e==="string"){let{cwd:t}=await import("process");try{return(await ke.loadConfig({name:e,cwd:t(),generatedDir:"./generated",configDir:"./config",defaultConfig:{},checkEnv:!0,arrayStrategy:"replace"})).config}catch(r){if(r instanceof Error&&(r.name==="ConfigNotFoundError"||r.name==="ConfigLoadError"&&Oo(r)))return(await ke.applyEnvironmentVariables(e,{},!0,!1)).config;throw r}}try{return(await ke.loadConfig({...e,cwd:e.cwd||ze.cwd(),cache:{enabled:!0},performance:{enabled:!1}})).config}catch(t){if(t instanceof Error&&(t.name==="ConfigNotFoundError"||t.name==="ConfigLoadError"&&Oo(t)))return(await ke.applyEnvironmentVariables(e.name||"",e.defaultConfig||{},e.checkEnv!==!1,e.verbose||!1)).config;throw t}}async function Zf(e,t,r="replace"){let n=new wr;try{let i=await n.loadFromPath(e,t,{arrayStrategy:r,useCache:!1,trackPerformance:!1});return i?i.config:null}catch{return null}}function vt(e,t,r=!1){let n=new vr,i=e.toUpperCase().replace(/[^A-Z0-9]/g,"_");function o(s,c=[]){let a={...s};for(let[l,u]of Object.entries(s)){let f=[...c,l],d=[`${i}_${f.join("_").toUpperCase()}`,`${i}_${f.map((p)=>p.toUpperCase()).join("")}`,`${i}_${f.map((p)=>p.replace(/([A-Z])/g,"_$1").toUpperCase()).join("")}`],h,m;for(let p of d)if(h=ze.env[p],h!==void 0){m=p;break}if(h!==void 0&&m)if(typeof u==="boolean")a[l]=["true","1","yes"].includes(h.toLowerCase());else if(typeof u==="number"){let p=Number(h);if(!Number.isNaN(p))a[l]=p}else if(Array.isArray(u))try{a[l]=JSON.parse(h)}catch{a[l]=h.split(",").map((p)=>p.trim())}else a[l]=h;else if(u&&typeof u==="object"&&!Array.isArray(u))a[l]=o(u,f)}return a}return o(t)}function Qf(e){let t=Q(ze.cwd(),e.configDir),r=Q(ze.cwd(),e.generatedDir),n=Q(r,"config-types.ts");if(!Sn(ao(n)))Bu(ao(n),{recursive:!0,mode:511});let i=Sn(t)?Uu(t).map((s)=>s.replace(/\.(ts|js|mjs|cjs|mts|cts|json)$/,"")).sort():[],o=`// Generated by bunfig v${Ad}
|
|
63
33
|
export type ConfigNames = ${i.length?`'${i.join("' | '")}'`:"string"}
|
|
64
|
-
`;
|
|
34
|
+
`;Vu(n,o,{mode:438})}function ed(e){let t=null,r=null,n=()=>{if(!r)r=os(e).then((o)=>(t=o,o),(o)=>{let s="defaultConfig"in e?e.defaultConfig:{};if(t=s,"verbose"in e&&e.verbose)fe.warn("Config loading failed, using defaults:",[o instanceof Error?o:Error(String(o))]);return s});return r},i="defaultConfig"in e?e.defaultConfig:{};return t=i,n(),new Proxy({},{get(o,s){if(t)return t[s];let c=i[s];return n(),c},has(o,s){return s in(t||i)},ownKeys(){return Object.keys(t||i)},getOwnPropertyDescriptor(o,s){return Object.getOwnPropertyDescriptor(t||i,s)},set(o,s,c){if(!t)t={...i};return t[s]=c,!0}})}function td(e){let t=$o(hf.cwd(),e?.configDir||"./config");function r(){if(!ff(t))return[];let i=new Set([".ts",".js",".mjs",".cjs",".mts",".cts",".json"]),o=[".ts",".mts",".cts",".js",".mjs",".cjs",".json"],s=df(t).filter((a)=>i.has(pn(a))).map((a)=>({base:a.replace(/\.(?:ts|js|mjs|cjs|mts|cts|json)$/i,""),file:a})),c=new Map;for(let{base:a,file:l}of s){let u=pn(l).toLowerCase(),f=c.get(a);if(!f){c.set(a,l);continue}let d=pn(f).toLowerCase();if(o.indexOf(u)<o.indexOf(d))c.set(a,l)}return Array.from(c.entries()).map(([a,l])=>({base:a,file:l})).sort((a,l)=>a.base.localeCompare(l.base))}function n(){let i=r(),o=i.map((l)=>l.base),s=o.length?o.map((l)=>`'${l}'`).join(" | "):"string",c=i.length?`{
|
|
65
35
|
${i.map((l)=>{let u=$o(t,l.file).replace(/\\/g,"/");return` '${l.base}': typeof import('${u}').default`}).join(`,
|
|
66
36
|
`)}
|
|
67
37
|
}`:"Record<string, any>";return`export type ConfigNames = ${s}
|
|
68
38
|
export type ConfigByName = ${c}
|
|
69
39
|
export type Config<N extends ConfigNames> = N extends keyof ConfigByName ? ConfigByName[N] : unknown
|
|
70
40
|
export type ConfigOf = Config
|
|
71
|
-
`}return{name:"bunfig-plugin",setup(i){i.onResolve({filter:/^virtual:bunfig-types$/},(o)=>({path:o.path,namespace:"bunfig-virtual"})),i.onLoad({filter:/^virtual:bunfig-types$/,namespace:"bunfig-virtual"},()=>({contents:n(),loader:"ts"}))}}}var ss,ot,Rt,as,ed,td,Io,er,Tn,H,P,rd,Po,nd,_o,id,od,vn,sd,Lo,Mo,wn,ad,ld,cd,ud,tr,ls,fd,q,dd,hd,Fo,rr,Nn,z,E,gd,Do,md,jo,pd,yd,Cn,bd,Bo,Uo,xd,$n,vd,wd,Cd,$d,Rd,nr,cs,kd,Sd="0.15.6",ne,hr,Ct,On,In,gr,Pn,_n,$t,Ln,Mn,Pe,us,fs,fe,ke,ds,hs,Ed=Ef(async()=>{ss=import.meta.require,ot=new jn,Rt=new Bn,as={createKey:Af,isEquivalent:Tf,estimateMemoryUsage:Nf},ed=ar(En.cwd(),"config"),td=ar(En.cwd(),"src/generated"),Io=sr.env.CLARITY_LOG_DIR||zu(Pf(),"logs"),er={level:"info",defaultName:"clarity",timestamp:!0,colors:!0,format:"text",maxLogSize:10485760,logDatePattern:"YYYY-MM-DD",logDirectory:Io,rotation:{frequency:"daily",maxSize:10485760,maxFiles:5,compress:!1,rotateHour:0,rotateMinute:0,rotateDayOfWeek:0,rotateDayOfMonth:1,encrypt:!1},verbose:!1},Tn=await _f(),H={red:(e)=>`\x1B[31m${e}\x1B[0m`,green:(e)=>`\x1B[32m${e}\x1B[0m`,yellow:(e)=>`\x1B[33m${e}\x1B[0m`,blue:(e)=>`\x1B[34m${e}\x1B[0m`,magenta:(e)=>`\x1B[35m${e}\x1B[0m`,cyan:(e)=>`\x1B[36m${e}\x1B[0m`,white:(e)=>`\x1B[37m${e}\x1B[0m`,gray:(e)=>`\x1B[90m${e}\x1B[0m`,bgRed:(e)=>`\x1B[41m${e}\x1B[0m`,bgYellow:(e)=>`\x1B[43m${e}\x1B[0m`,bold:(e)=>`\x1B[1m${e}\x1B[0m`,dim:(e)=>`\x1B[2m${e}\x1B[0m`,italic:(e)=>`\x1B[3m${e}\x1B[0m`,underline:(e)=>`\x1B[4m${e}\x1B[0m`,reset:"\x1B[0m"},P=H,rd=H.red,Po=H.green,nd=H.yellow,_o=H.blue,id=H.magenta,od=H.cyan,vn=H.white,sd=H.gray,Lo=H.bgRed,Mo=H.bgYellow,wn=H.bold,ad=H.dim,ld=H.italic,cd=H.underline,ud=H.reset,tr={activationLevel:"error",bufferSize:50,flushOnDeactivation:!0,stopBuffering:!1},ls={debug:"\uD83D\uDD0D",info:_o("\u2139"),success:Po("\u2713"),warning:Mo(vn(wn(" WARN "))),error:Lo(vn(wn(" ERROR ")))},fd=new ur("stacks"),q=new ur("bunfig",{showTags:!0}),dd=Z(wt.cwd(),"config"),hd=Z(wt.cwd(),"src/generated"),Fo=or.env.CLARITY_LOG_DIR||Uu(Df(),"logs"),rr={level:"info",defaultName:"clarity",timestamp:!0,colors:!0,format:"text",maxLogSize:10485760,logDatePattern:"YYYY-MM-DD",logDirectory:Fo,rotation:{frequency:"daily",maxSize:10485760,maxFiles:5,compress:!1,rotateHour:0,rotateMinute:0,rotateDayOfWeek:0,rotateDayOfMonth:1,encrypt:!1},verbose:!1,writeToFile:!1},Nn=await jf(),z={red:(e)=>`\x1B[31m${e}\x1B[0m`,green:(e)=>`\x1B[32m${e}\x1B[0m`,yellow:(e)=>`\x1B[33m${e}\x1B[0m`,blue:(e)=>`\x1B[34m${e}\x1B[0m`,magenta:(e)=>`\x1B[35m${e}\x1B[0m`,cyan:(e)=>`\x1B[36m${e}\x1B[0m`,white:(e)=>`\x1B[37m${e}\x1B[0m`,gray:(e)=>`\x1B[90m${e}\x1B[0m`,bgRed:(e)=>`\x1B[41m${e}\x1B[0m`,bgYellow:(e)=>`\x1B[43m${e}\x1B[0m`,bgGray:(e)=>`\x1B[100m${e}\x1B[0m`,bold:(e)=>`\x1B[1m${e}\x1B[0m`,dim:(e)=>`\x1B[2m${e}\x1B[0m`,italic:(e)=>`\x1B[3m${e}\x1B[0m`,underline:(e)=>`\x1B[4m${e}\x1B[0m`,strikethrough:(e)=>`\x1B[9m${e}\x1B[0m`,reset:"\x1B[0m"},E=z,gd=z.red,Do=z.green,md=z.yellow,jo=z.blue,pd=z.magenta,yd=z.cyan,Cn=z.white,bd=z.gray,Bo=z.bgRed,Uo=z.bgYellow,xd=z.bgGray,$n=z.bold,vd=z.dim,wd=z.italic,Cd=z.underline,$d=z.strikethrough,Rd=z.reset,nr={activationLevel:"error",bufferSize:50,flushOnDeactivation:!0,stopBuffering:!1},cs={debug:"\uD83D\uDD0D",info:jo("\u2139"),success:Do("\u2713"),warning:Uo(Cn($n(" WARN "))),error:Bo(Cn($n(" ERROR ")))},kd=new dr("stacks"),ne=class extends Error{timestamp;context;constructor(t,r={}){super(t);if(this.name=this.constructor.name,this.timestamp=new Date,this.context=r,Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)}toJSON(){return{name:this.name,code:this.code,message:this.message,timestamp:this.timestamp.toISOString(),context:this.context,stack:this.stack}}toString(){let t=Object.keys(this.context).length>0?` (${Object.entries(this.context).map(([r,n])=>`${r}: ${n}`).join(", ")})`:"";return`${this.name} [${this.code}]: ${this.message}${t}`}},hr=class extends ne{code="CONFIG_NOT_FOUND";constructor(t,r,n){let i=n?` or alias "${n}"`:"";super(`Configuration "${t}"${i} not found`,{configName:t,alias:n,searchPaths:r,searchPathCount:r.length})}},Ct=class extends ne{code="CONFIG_LOAD_ERROR";constructor(t,r,n){super(`Failed to load configuration from "${t}": ${r.message}`,{configPath:t,configName:n,originalError:r.name,originalMessage:r.message});this.cause=r}},On=class extends ne{code="CONFIG_VALIDATION_ERROR";constructor(t,r,n){super(`Configuration validation failed for "${t}"`,{configPath:t,configName:n,validationErrors:r,errorCount:r.length})}},In=class extends ne{code="CONFIG_MERGE_ERROR";constructor(t,r,n,i){super(`Failed to merge configuration from "${t}" with "${r}": ${n.message}`,{sourcePath:t,targetPath:r,configName:i,originalError:n.name,originalMessage:n.message});this.cause=n}},gr=class extends ne{code="ENV_VAR_ERROR";constructor(t,r,n,i){super(`Failed to parse environment variable "${t}" with value "${r}" as ${n}`,{envKey:t,envValue:r,expectedType:n,configName:i})}},Pn=class extends ne{code="FILE_SYSTEM_ERROR";constructor(t,r,n){super(`File system ${t} failed for "${r}": ${n.message}`,{operation:t,path:r,originalError:n.name,originalMessage:n.message});this.cause=n}},_n=class extends ne{code="TYPE_GENERATION_ERROR";constructor(t,r,n){super(`Failed to generate types from "${t}" to "${r}": ${n.message}`,{configDir:t,outputPath:r,originalError:n.name,originalMessage:n.message});this.cause=n}},$t=class extends ne{code="SCHEMA_VALIDATION_ERROR";constructor(t,r,n){super(`Schema validation failed${n?` for config "${n}"`:""}`,{schemaPath:t,configName:n,validationErrors:r,errorCount:r.length})}},Ln=class extends ne{code="BROWSER_CONFIG_ERROR";constructor(t,r,n,i){super(`Failed to fetch configuration from "${t}": ${r} ${n}`,{endpoint:t,status:r,statusText:n,configName:i})}},Mn=class extends ne{code="PLUGIN_ERROR";constructor(t,r,n){super(`Plugin "${t}" failed during ${r}: ${n.message}`,{pluginName:t,operation:r,originalError:n.name,originalMessage:n.message});this.cause=n}},Pe={configNotFound(e,t,r){return new hr(e,t,r)},configLoad(e,t,r){return new Ct(e,t,r)},configValidation(e,t,r){return new On(e,t,r)},configMerge(e,t,r,n){return new In(e,t,r,n)},envVar(e,t,r,n){return new gr(e,t,r,n)},fileSystem(e,t,r){return new Pn(e,t,r)},typeGeneration(e,t,r){return new _n(e,t,r)},schemaValidation(e,t,r){return new $t(e,t,r)},browserConfig(e,t,r,n){return new Ln(e,t,r,n)},plugin(e,t,r){return new Mn(e,t,r)}},us={replace:"replace",concat:"concat",smart:"smart"},fs=/^https?:\/\//,fe=new dr("bunfig",{showTags:!0}),ke=new Kn,ds=Q(ze.cwd(),"config"),hs=Q(ze.cwd(),"src/generated")});function Ad(e,t={}){let r=lr.cwd();while(r.includes("storage"))r=Ro(r,"..");let n=Ro(r,e||"");if(t?.relative)return hf(lr.cwd(),n);return n}var Td=lr.env.CLARITY_LOG_DIR||df(Ad(),"logs"),gs={level:"info",defaultName:"clarity",timestamp:!0,colors:!0,format:"text",maxLogSize:10485760,logDatePattern:"YYYY-MM-DD",logDirectory:Td,rotation:{frequency:"daily",maxSize:10485760,maxFiles:5,compress:!1,rotateHour:0,rotateMinute:0,rotateDayOfWeek:0,rotateDayOfMonth:1,encrypt:!1},verbose:!1,writeToFile:!1},mr={...gs},gw=(async()=>{try{let{loadConfig:e}=await Ed().then(()=>Xo),t=await e({name:"clarity",alias:"logging",defaultConfig:gs,cwd:lr.cwd()});if(t)Object.assign(mr,t)}catch{}return mr})();function W(){if(Re.env.NODE_ENV==="test"||Re.env.BUN_ENV==="test")return!1;return typeof window<"u"}async function Nd(){if(Re.env.NODE_ENV==="test"||Re.env.BUN_ENV==="test")return!0;if(typeof navigator<"u"&&navigator.product==="ReactNative")return!0;if(typeof Re<"u"){let e=Re.type;if(e==="renderer"||e==="worker")return!1;return!!(Re.versions&&(Re.versions.node||Re.versions.bun))}return!1}class ms{async format(e){let t=await Nd(),r=await this.getMetadata(t);return JSON.stringify({timestamp:e.timestamp.toISOString(),level:e.level,name:e.name,message:e.message,metadata:r})}async getMetadata(e){if(e){let{hostname:t}=await import("os");return{pid:it.pid,hostname:t(),environment:it.env.NODE_ENV||"development",platform:it.platform,version:it.version}}return{userAgent:navigator.userAgent,hostname:window.location.hostname||"browser",environment:it.env.NODE_ENV||it.env.BUN_ENV||"development",viewport:{width:window.innerWidth,height:window.innerHeight},language:navigator.language}}}var K={red:(e)=>`\x1B[31m${e}\x1B[0m`,green:(e)=>`\x1B[32m${e}\x1B[0m`,yellow:(e)=>`\x1B[33m${e}\x1B[0m`,blue:(e)=>`\x1B[34m${e}\x1B[0m`,magenta:(e)=>`\x1B[35m${e}\x1B[0m`,cyan:(e)=>`\x1B[36m${e}\x1B[0m`,white:(e)=>`\x1B[37m${e}\x1B[0m`,gray:(e)=>`\x1B[90m${e}\x1B[0m`,bgRed:(e)=>`\x1B[41m${e}\x1B[0m`,bgYellow:(e)=>`\x1B[43m${e}\x1B[0m`,bgGray:(e)=>`\x1B[100m${e}\x1B[0m`,bold:(e)=>`\x1B[1m${e}\x1B[0m`,dim:(e)=>`\x1B[2m${e}\x1B[0m`,italic:(e)=>`\x1B[3m${e}\x1B[0m`,underline:(e)=>`\x1B[4m${e}\x1B[0m`,strikethrough:(e)=>`\x1B[9m${e}\x1B[0m`,reset:"\x1B[0m"},A=K,{red:mw,green:Od,yellow:pw,blue:Id,magenta:yw,cyan:bw,white:Vo,gray:xw,bgRed:Pd,bgYellow:_d,bgGray:vw,bold:zo,dim:ww,italic:Cw,underline:$w,strikethrough:Rw,reset:kw}=K,Rn={activationLevel:"error",bufferSize:50,flushOnDeactivation:!0,stopBuffering:!1},Ld={debug:"\uD83D\uDD0D",info:Id("\u2139"),success:Od("\u2713"),warning:_d(Vo(zo(" WARN "))),error:Pd(Vo(zo(" ERROR ")))};class wr{name;fileLocks=new Map;currentKeyId=null;keys=new Map;fingersCrossedConfig;fingersCrossedActive=!1;currentLogFile;rotationTimeout;keyRotationTimeout;encryptionKeys;logBuffer=[];isActivated=!1;pendingOperations=[];enabled;fancy;tagFormat;timestampPosition;environment;config;options;formatter;timers=new Set;subLoggers=new Set;fingersCrossedBuffer=[];ANSI_PATTERN=/\u001B\[.*?m/g;activeProgressBar=null;constructor(e,t={}){this.name=e,this.config={...mr},this.options=this.normalizeOptions(t),this.formatter=this.options.formatter||new ms,this.enabled=t.enabled??!0,this.fancy=t.fancy??!0,this.tagFormat=t.tagFormat??{prefix:"[",suffix:"]"},this.timestampPosition=t.timestampPosition??"right",this.environment=t.environment??N.env.APP_ENV??"local",this.fingersCrossedConfig=this.initializeFingersCrossedConfig(t);let r={...t},n=t.timestamp!==void 0;if(n)delete r.timestamp;if(this.config={...this.config,...r,timestamp:n||this.config.timestamp,level:this.options.level??"info"},this.currentLogFile=this.generateLogFilename(),this.encryptionKeys=new Map,this.validateEncryptionConfig()){this.setupRotation();let i=this.generateKeyId(),o=this.generateKey();this.currentKeyId=i,this.keys.set(i,o),this.encryptionKeys.set(i,{key:o,createdAt:new Date}),this.setupKeyRotation()}}shouldActivateFingersCrossed(e){if(!this.fingersCrossedConfig)return!1;let t={debug:0,info:1,success:2,warning:3,error:4},r=this.fingersCrossedConfig.activationLevel??"error";return t[e]>=t[r]}initializeFingersCrossedConfig(e){if(!e.fingersCrossedEnabled&&e.fingersCrossed)return{...Rn,...e.fingersCrossed};if(!e.fingersCrossedEnabled)return null;if(!e.fingersCrossed)return{...Rn};return{...Rn,...e.fingersCrossed}}normalizeOptions(e){let t={format:"json",level:"info",logDirectory:mr.logDirectory,rotation:void 0,timestamp:void 0,fingersCrossed:{},enabled:!0,showTags:!1,showIcons:!0,formatter:void 0},r={...t,...Object.fromEntries(Object.entries(e).filter(([,n])=>n!==void 0))};if(!r.level||!["debug","info","success","warning","error"].includes(r.level))r.level=t.level;return r}shouldWriteToFile(){return!W()&&this.config.writeToFile===!0}async writeToFile(e){let r=(async()=>{let i,o=0,s=3,c=1000;while(o<s)try{try{try{await bf(this.config.logDirectory,Ao.F_OK|Ao.W_OK)}catch(l){if(l instanceof Error&&"code"in l)if(l.code==="ENOENT")await xf(this.config.logDirectory,{recursive:!0,mode:493});else if(l.code==="EACCES")throw Error(`No write permission for log directory: ${this.config.logDirectory}`);else throw l;else throw l}}catch(l){throw console.error("Debug: [writeToFile] Failed to create log directory:",l),l}let a=this.validateEncryptionConfig()?(await this.encrypt(e)).encrypted:we.from(e);try{if(!Ht(this.currentLogFile))await xn(this.currentLogFile,"",{mode:420});if(i=Eo(this.currentLogFile,"a",420),yf(i,a,{flag:"a"}),So(i),i!==void 0)bn(i),i=void 0;if((await rt(this.currentLogFile)).size===0){if(await xn(this.currentLogFile,a,{flag:"w",mode:420}),(await rt(this.currentLogFile)).size===0)throw Error("File exists but is empty after retry write")}return}catch(l){let u=l;if(u.code&&["ENETDOWN","ENETUNREACH","ENOTFOUND","ETIMEDOUT"].includes(u.code)){if(o<s-1){let f=typeof u.message==="string"?u.message:"Unknown error";console.error(`Network error during write attempt ${o+1}/${s}:`,f);let d=c*2**o;await new Promise((h)=>setTimeout(h,d)),o++;continue}}if(u?.code&&["ENOSPC","EDQUOT"].includes(u.code))throw Error(`Disk quota exceeded or no space left on device: ${u.message}`);throw console.error("Debug: [writeToFile] Error writing to file:",u),u}finally{if(i!==void 0)try{bn(i)}catch(l){console.error("Debug: [writeToFile] Error closing file descriptor:",l)}}}catch(a){if(o===s-1){let u=a,f=typeof u.message==="string"?u.message:"Unknown error";throw console.error("Debug: [writeToFile] Max retries reached. Final error:",f),a}o++;let l=c*2**(o-1);await new Promise((u)=>setTimeout(u,l))}})();this.pendingOperations.push(r);let n=this.pendingOperations.length-1;try{await r}catch(i){throw console.error("Debug: [writeToFile] Error in operation:",i),i}finally{this.pendingOperations.splice(n,1)}}generateLogFilename(){if(this.name.includes("stream-throughput")||this.name.includes("decompress-perf-test")||this.name.includes("decompression-latency")||this.name.includes("concurrent-read-test")||this.name.includes("clock-change-test"))return nt(this.config.logDirectory,`${this.name}.log`);if(this.name.includes("pending-test")||this.name.includes("temp-file-test")||this.name==="crash-test"||this.name==="corrupt-test"||this.name.includes("rotation-load-test")||this.name==="sigterm-test"||this.name==="sigint-test"||this.name==="failed-rotation-test"||this.name==="integration-test")return nt(this.config.logDirectory,`${this.name}.log`);let e=new Date().toISOString().split("T")[0];return nt(this.config.logDirectory,`${this.name}-${e}.log`)}setupRotation(){if(W())return;if(!this.shouldWriteToFile())return;if(typeof this.config.rotation==="boolean")return;let e=this.config.rotation,t;switch(e.frequency){case"daily":t=86400000;break;case"weekly":t=604800000;break;case"monthly":t=2592000000;break;default:return}this.rotationTimeout=setInterval(()=>{this.rotateLog()},t)}setupKeyRotation(){if(!this.validateEncryptionConfig()){console.error("Invalid encryption configuration detected during key rotation setup");return}let t=this.config.rotation.keyRotation;if(!t?.enabled)return;let r=typeof t.interval==="number"?t.interval:60,n=Math.max(r,60)*1000;this.keyRotationTimeout=setInterval(()=>{this.rotateKeys().catch((i)=>{console.error("Error rotating keys:",i)})},n)}async rotateKeys(){if(!this.validateEncryptionConfig()){console.error("Invalid encryption configuration detected during key rotation");return}let t=this.config.rotation.keyRotation,r=this.generateKeyId(),n=this.generateKey();this.currentKeyId=r,this.keys.set(r,n),this.encryptionKeys.set(r,{key:n,createdAt:new Date});let i=Array.from(this.encryptionKeys.entries()).sort(([,c],[,a])=>a.createdAt.getTime()-c.createdAt.getTime()),o=typeof t.maxKeys==="number"?t.maxKeys:1,s=Math.max(1,o);if(i.length>s)for(let[c]of i.slice(s))this.encryptionKeys.delete(c),this.keys.delete(c)}generateKeyId(){return yn(16).toString("hex")}generateKey(){return yn(32)}getCurrentKey(){if(!this.currentKeyId)throw Error("Encryption is not properly initialized. Make sure encryption is enabled in the configuration.");let e=this.keys.get(this.currentKeyId);if(!e)throw Error(`No key found for ID ${this.currentKeyId}. The encryption key may have been rotated or removed.`);return{key:e,id:this.currentKeyId}}encrypt(e){let{key:t}=this.getCurrentKey(),r=yn(16),n=gf("aes-256-gcm",t,r),i=we.isBuffer(e)?e:we.from(e,"utf8"),o=n.update(i),s=n.final(),c=o.length+s.length,a=n.getAuthTag(),l=we.allocUnsafe(16+c+16);return r.copy(l,0),o.copy(l,16),s.copy(l,16+o.length),a.copy(l,16+c),{encrypted:l,iv:r}}async compressData(e){return new Promise((t,r)=>{let n=No(),i=[];n.on("data",(o)=>i.push(o)),n.on("end",()=>t(we.from(we.concat(i)))),n.on("error",r),n.write(e),n.end()})}getEncryptionOptions(){if(!this.config.rotation||typeof this.config.rotation==="boolean"||!this.config.rotation.encrypt)return{};let e={algorithm:"aes-256-cbc",compress:!1};if(typeof this.config.rotation.encrypt==="object"){let t=this.config.rotation.encrypt;return{...e,...t}}return e}async rotateLog(){if(W())return;if(!this.shouldWriteToFile())return;let e=await rt(this.currentLogFile).catch(()=>null);if(!e)return;let t=this.config.rotation;if(typeof t==="boolean")return;if(t.maxSize&&e.size>=t.maxSize){let r=this.currentLogFile,n=this.generateLogFilename();if(this.name.includes("rotation-load-test")||this.name==="failed-rotation-test"){let i=await qt(this.config.logDirectory),o=i.filter((a)=>a.startsWith(this.name)&&/\.log\.\d+$/.test(a)).sort((a,l)=>{let u=Number.parseInt(a.match(/\.log\.(\d+)$/)?.[1]||"0");return Number.parseInt(l.match(/\.log\.(\d+)$/)?.[1]||"0")-u}),s=o.length>0?Number.parseInt(o[0].match(/\.log\.(\d+)$/)?.[1]||"0")+1:1,c=`${r}.${s}`;if(await rt(r).catch(()=>null))try{if(await To(r,c),t.compress)try{let a=`${c}.gz`;await this.compressLogFile(c,a),await Yt(c)}catch(a){console.error("Error compressing rotated file:",a)}if(o.length===0&&!i.some((a)=>a.endsWith(".log.1")))try{let a=`${r}.1`;await xn(a,"")}catch(a){console.error("Error creating backup file:",a)}}catch(a){console.error(`Error during rotation: ${a instanceof Error?a.message:String(a)}`)}}else{let i=new Date().toISOString().replace(/[:.]/g,"-"),o=r.replace(/\.log$/,`-${i}.log`);if(await rt(r).catch(()=>null))await To(r,o)}if(this.currentLogFile=n,t.maxFiles){let o=(await qt(this.config.logDirectory)).filter((s)=>s.startsWith(this.name)).sort((s,c)=>c.localeCompare(s));for(let s of o.slice(t.maxFiles))await Yt(nt(this.config.logDirectory,s))}}}async compressLogFile(e,t){let r=ko(e),n=pf(t),i=No();await Cf(r,i,n)}async handleFingersCrossedBuffer(e,t){if(!this.fingersCrossedConfig)return;if(this.shouldActivateFingersCrossed(e)&&!this.isActivated){this.isActivated=!0;for(let r of this.logBuffer){let n=await this.formatter.format(r);if(this.shouldWriteToFile())await this.writeToFile(n);console.log(n)}if(this.fingersCrossedConfig.stopBuffering)this.logBuffer=[]}if(this.isActivated){if(this.shouldWriteToFile())await this.writeToFile(t);console.log(t)}}shouldLog(e){if(!this.enabled)return!1;let t={debug:0,info:1,success:2,warning:3,error:4};return t[e]>=t[this.config.level]}async flushPendingWrites(){if(await Promise.all(this.pendingOperations.map((e)=>{if(e instanceof Promise)return e.catch((t)=>{console.error("Error in pending write operation:",t)});return Promise.resolve()})),Ht(this.currentLogFile))try{let e=Eo(this.currentLogFile,"r+");So(e),bn(e)}catch(e){console.error(`Error flushing file: ${e}`)}}async destroy(){if(this.rotationTimeout)clearInterval(this.rotationTimeout);if(this.keyRotationTimeout)clearInterval(this.keyRotationTimeout);this.timers.clear();for(let e of this.pendingOperations)if(typeof e.cancel==="function")e.cancel();return(async()=>{if(this.pendingOperations.length>0)try{await Promise.allSettled(this.pendingOperations)}catch(e){console.error("Error waiting for pending operations:",e)}if(!W()&&this.config.rotation&&typeof this.config.rotation!=="boolean"&&this.config.rotation.compress)try{let t=(await qt(this.config.logDirectory)).filter((r)=>(r.includes("temp")||r.includes(".tmp"))&&r.includes(this.name));for(let r of t)try{await Yt(nt(this.config.logDirectory,r))}catch(n){console.error(`Failed to delete temp file ${r}:`,n)}}catch(e){console.error("Error cleaning up temporary files:",e)}})()}getCurrentLogFilePath(){return this.currentLogFile}formatTag(e){if(!e)return"";return`${this.tagFormat.prefix}${e}${this.tagFormat.suffix}`}formatFileTimestamp(e){return`[${e.toISOString()}]`}formatConsoleTimestamp(e){return this.shouldStyleConsole()?A.gray(e.toLocaleTimeString()):e.toLocaleTimeString()}shouldStyleConsole(){if(!this.fancy||W())return!1;let e=typeof N.env.NO_COLOR<"u",t=N.env.FORCE_COLOR==="0";if(e||t)return!1;return!!(typeof N.stderr<"u"&&N.stderr.isTTY||typeof N.stdout<"u"&&N.stdout.isTTY)}formatConsoleMessage(e){let{timestamp:t,icon:r="",tag:n="",message:i,level:o,showTimestamp:s=!0}=e,c=(h)=>h.replace(this.ANSI_PATTERN,"");if(!this.fancy){let h=[];if(s)h.push(t);if(o==="warning")h.push("WARN");else if(o==="error")h.push("ERROR");else if(r)h.push(r.replace(/[^\p{L}\p{N}\p{P}\p{Z}]/gu,""));if(n)h.push(n.replace(/[[\]]/g,""));return h.push(i),h.join(" ")}let a=N.stdout.columns||120,l="";if(o==="warning"||o==="error")l=`${r} ${i}`;else if(o==="info"||o==="success")l=`${r} ${n} ${i}`;else l=`${r} ${n} ${A.cyan(i)}`;if(!s)return l.trim();let u=c(l).trim().length,f=c(t).length,d=Math.max(1,a-2-u-f);return`${l.trim()}${" ".repeat(d)}${t}`}formatMessage(e,t){if(t.length===1&&Array.isArray(t[0]))return e.replace(/\{(\d+)\}/g,(o,s)=>{let c=Number.parseInt(s,10);return c<t[0].length?String(t[0][c]):o});let r=/%([sdijfo%])/g,n=0,i=e.replace(r,(o,s)=>{if(s==="%")return"%";if(n>=t.length)return o;let c=t[n++];switch(s){case"s":return String(c);case"d":case"i":return Number(c).toString();case"j":case"o":return JSON.stringify(c,null,2);default:return o}});if(n<t.length)i+=` ${t.slice(n).map((o)=>typeof o==="object"?JSON.stringify(o,null,2):String(o)).join(" ")}`;return i}formatMarkdown(e){if(!e)return e;let t=e;return t=t.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(r,n,i)=>{let o=A.underline(A.blue(n)),s=this.toAbsoluteFilePath(i);if(s&&this.shouldStyleConsole()&&this.supportsHyperlinks()){let c=`file://${encodeURI(s)}`,a="\x1B]8;;",l="\x1B\\";return`\x1B]8;;${c}\x1B\\${o}\x1B]8;;\x1B\\`}if(this.shouldStyleConsole()&&this.supportsHyperlinks())return`\x1B]8;;${i}\x1B\\${o}\x1B]8;;\x1B\\`;return o}),t=t.replace(/`([^`]+)`/g,(r,n)=>A.bgGray(n)),t=t.replace(/\*\*([^*]+)\*\*/g,(r,n)=>A.bold(n)),t=t.replace(/(?<!\*)\*([^*]+)\*(?!\*)/g,(r,n)=>A.italic(n)),t=t.replace(/(?<!_)_([^_]+)_(?!_)/g,(r,n)=>A.italic(n)),t=t.replace(/~([^~]+)~/g,(r,n)=>A.strikethrough(n)),t}supportsHyperlinks(){if(W())return!1;let e=N.env;if(!e)return!1;if(e.TERM_PROGRAM==="iTerm.app"||e.TERM_PROGRAM==="vscode"||e.TERM_PROGRAM==="WezTerm")return!0;if(e.WT_SESSION)return!0;if(e.TERM==="xterm-kitty")return!0;let t=e.VTE_VERSION?Number.parseInt(e.VTE_VERSION,10):0;if(!Number.isNaN(t)&&t>=5000)return!0;return!1}toAbsoluteFilePath(e){try{let t=e;if(t.startsWith("file://"))t=t.replace(/^file:\/\//,"");if(t.startsWith("~")){let r=N.env.HOME||"";if(r)t=t.replace(/^~(?=$|\/)/,r)}if(vf(t)||t.startsWith("./")||t.startsWith("../"))t=wf(t);else return null;return Ht(t)?t:null}catch{return null}}buildOutputTexts(e){let t=this.shouldStyleConsole()?this.formatMarkdown(e):e,r=e.replace(this.ANSI_PATTERN,"");return{consoleText:t,fileText:r}}async log(e,t,...r){if(!this.shouldLog(e))return;let n=new Date,i=this.formatConsoleTimestamp(n),o=this.formatFileTimestamp(n),s,c;if(t instanceof Error)s=t.message,c=t.stack;else s=this.formatMessage(t,r);let{consoleText:a,fileText:l}=this.buildOutputTexts(s);if(this.shouldStyleConsole()){let f=this.options.showIcons===!1?"":Ld[e],d=this.options.showTags!==!1&&this.name?A.gray(this.formatTag(this.name)):"",h;switch(e){case"debug":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:A.gray(a),level:e}),console.error(h);break;case"info":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:a,level:e}),console.warn(h);break;case"success":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:A.green(a),level:e}),console.error(h);break;case"warning":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:a,level:e}),console.warn(h);break;case"error":if(h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:a,level:e}),console.error(h),c){let m=c.split(`
|
|
41
|
+
`}return{name:"bunfig-plugin",setup(i){i.onResolve({filter:/^virtual:bunfig-types$/},(o)=>({path:o.path,namespace:"bunfig-virtual"})),i.onLoad({filter:/^virtual:bunfig-types$/,namespace:"bunfig-virtual"},()=>({contents:n(),loader:"ts"}))}}}function Nd(e,t={}){let r=cr.cwd();while(r.includes("storage"))r=Ro(r,"..");let n=Ro(r,e||"");if(t?.relative)return mf(cr.cwd(),n);return n}function W(){if(Re.env.NODE_ENV==="test"||Re.env.BUN_ENV==="test")return!1;return typeof window<"u"}async function Id(){if(Re.env.NODE_ENV==="test"||Re.env.BUN_ENV==="test")return!0;if(typeof navigator<"u"&&navigator.product==="ReactNative")return!0;if(typeof Re<"u"){let e=Re.type;if(e==="renderer"||e==="worker")return!1;return!!(Re.versions&&(Re.versions.node||Re.versions.bun))}return!1}class ms{async format(e){let t=await Id(),r=await this.getMetadata(t);return JSON.stringify({timestamp:e.timestamp.toISOString(),level:e.level,name:e.name,message:e.message,metadata:r})}async getMetadata(e){if(e){let{hostname:t}=await import("os");return{pid:it.pid,hostname:t(),environment:it.env.NODE_ENV||"development",platform:it.platform,version:it.version}}return{userAgent:navigator.userAgent,hostname:window.location.hostname||"browser",environment:it.env.NODE_ENV||it.env.BUN_ENV||"development",viewport:{width:window.innerWidth,height:window.innerHeight},language:navigator.language}}}class Cr{name;fileLocks=new Map;currentKeyId=null;keys=new Map;fingersCrossedConfig;fingersCrossedActive=!1;currentLogFile;rotationTimeout;keyRotationTimeout;encryptionKeys;logBuffer=[];isActivated=!1;pendingOperations=[];enabled;fancy;tagFormat;timestampPosition;environment;config;options;formatter;timers=new Set;subLoggers=new Set;fingersCrossedBuffer=[];ANSI_PATTERN=/\u001B\[.*?m/g;activeProgressBar=null;constructor(e,t={}){this.name=e,this.config={...pr},this.options=this.normalizeOptions(t),this.formatter=this.options.formatter||new ms,this.enabled=t.enabled??!0,this.fancy=t.fancy??!0,this.tagFormat=t.tagFormat??{prefix:"[",suffix:"]"},this.timestampPosition=t.timestampPosition??"right",this.environment=t.environment??N.env.APP_ENV??"local",this.fingersCrossedConfig=this.initializeFingersCrossedConfig(t);let r={...t},n=t.timestamp!==void 0;if(n)delete r.timestamp;if(this.config={...this.config,...r,timestamp:n||this.config.timestamp,level:this.options.level??"info"},this.currentLogFile=this.generateLogFilename(),this.encryptionKeys=new Map,this.validateEncryptionConfig()){this.setupRotation();let i=this.generateKeyId(),o=this.generateKey();this.currentKeyId=i,this.keys.set(i,o),this.encryptionKeys.set(i,{key:o,createdAt:new Date}),this.setupKeyRotation()}}shouldActivateFingersCrossed(e){if(!this.fingersCrossedConfig)return!1;let t={debug:0,info:1,success:2,warning:3,error:4},r=this.fingersCrossedConfig.activationLevel??"error";return t[e]>=t[r]}initializeFingersCrossedConfig(e){if(!e.fingersCrossedEnabled&&e.fingersCrossed)return{...Rn,...e.fingersCrossed};if(!e.fingersCrossedEnabled)return null;if(!e.fingersCrossed)return{...Rn};return{...Rn,...e.fingersCrossed}}normalizeOptions(e){let t={format:"json",level:"info",logDirectory:pr.logDirectory,rotation:void 0,timestamp:void 0,fingersCrossed:{},enabled:!0,showTags:!1,showIcons:!0,formatter:void 0},r={...t,...Object.fromEntries(Object.entries(e).filter(([,n])=>n!==void 0))};if(!r.level||!["debug","info","success","warning","error"].includes(r.level))r.level=t.level;return r}shouldWriteToFile(){return!W()&&this.config.writeToFile===!0}async writeToFile(e){let r=(async()=>{let i,o=0,s=3,c=1000;while(o<s)try{try{try{await vf(this.config.logDirectory,Ao.F_OK|Ao.W_OK)}catch(l){if(l instanceof Error&&"code"in l)if(l.code==="ENOENT")await wf(this.config.logDirectory,{recursive:!0,mode:493});else if(l.code==="EACCES")throw Error(`No write permission for log directory: ${this.config.logDirectory}`);else throw l;else throw l}}catch(l){throw console.error("Debug: [writeToFile] Failed to create log directory:",l),l}let a=this.validateEncryptionConfig()?(await this.encrypt(e)).encrypted:we.from(e);try{if(!qt(this.currentLogFile))await xn(this.currentLogFile,"",{mode:420});if(i=Eo(this.currentLogFile,"a",420),xf(i,a,{flag:"a"}),So(i),i!==void 0)bn(i),i=void 0;if((await rt(this.currentLogFile)).size===0){if(await xn(this.currentLogFile,a,{flag:"w",mode:420}),(await rt(this.currentLogFile)).size===0)throw Error("File exists but is empty after retry write")}return}catch(l){let u=l;if(u.code&&["ENETDOWN","ENETUNREACH","ENOTFOUND","ETIMEDOUT"].includes(u.code)){if(o<s-1){let f=typeof u.message==="string"?u.message:"Unknown error";console.error(`Network error during write attempt ${o+1}/${s}:`,f);let d=c*2**o;await new Promise((h)=>setTimeout(h,d)),o++;continue}}if(u?.code&&["ENOSPC","EDQUOT"].includes(u.code))throw Error(`Disk quota exceeded or no space left on device: ${u.message}`);throw console.error("Debug: [writeToFile] Error writing to file:",u),u}finally{if(i!==void 0)try{bn(i)}catch(l){console.error("Debug: [writeToFile] Error closing file descriptor:",l)}}}catch(a){if(o===s-1){let u=a,f=typeof u.message==="string"?u.message:"Unknown error";throw console.error("Debug: [writeToFile] Max retries reached. Final error:",f),a}o++;let l=c*2**(o-1);await new Promise((u)=>setTimeout(u,l))}})();this.pendingOperations.push(r);let n=this.pendingOperations.length-1;try{await r}catch(i){throw console.error("Debug: [writeToFile] Error in operation:",i),i}finally{this.pendingOperations.splice(n,1)}}generateLogFilename(){if(this.name.includes("stream-throughput")||this.name.includes("decompress-perf-test")||this.name.includes("decompression-latency")||this.name.includes("concurrent-read-test")||this.name.includes("clock-change-test"))return nt(this.config.logDirectory,`${this.name}.log`);if(this.name.includes("pending-test")||this.name.includes("temp-file-test")||this.name==="crash-test"||this.name==="corrupt-test"||this.name.includes("rotation-load-test")||this.name==="sigterm-test"||this.name==="sigint-test"||this.name==="failed-rotation-test"||this.name==="integration-test")return nt(this.config.logDirectory,`${this.name}.log`);let e=new Date().toISOString().split("T")[0];return nt(this.config.logDirectory,`${this.name}-${e}.log`)}setupRotation(){if(W())return;if(!this.shouldWriteToFile())return;if(typeof this.config.rotation==="boolean")return;let e=this.config.rotation,t;switch(e.frequency){case"daily":t=86400000;break;case"weekly":t=604800000;break;case"monthly":t=2592000000;break;default:return}this.rotationTimeout=setInterval(()=>{this.rotateLog()},t)}setupKeyRotation(){if(!this.validateEncryptionConfig()){console.error("Invalid encryption configuration detected during key rotation setup");return}let t=this.config.rotation.keyRotation;if(!t?.enabled)return;let r=typeof t.interval==="number"?t.interval:60,n=Math.max(r,60)*1000;this.keyRotationTimeout=setInterval(()=>{this.rotateKeys().catch((i)=>{console.error("Error rotating keys:",i)})},n)}async rotateKeys(){if(!this.validateEncryptionConfig()){console.error("Invalid encryption configuration detected during key rotation");return}let t=this.config.rotation.keyRotation,r=this.generateKeyId(),n=this.generateKey();this.currentKeyId=r,this.keys.set(r,n),this.encryptionKeys.set(r,{key:n,createdAt:new Date});let i=Array.from(this.encryptionKeys.entries()).sort(([,c],[,a])=>a.createdAt.getTime()-c.createdAt.getTime()),o=typeof t.maxKeys==="number"?t.maxKeys:1,s=Math.max(1,o);if(i.length>s)for(let[c]of i.slice(s))this.encryptionKeys.delete(c),this.keys.delete(c)}generateKeyId(){return yn(16).toString("hex")}generateKey(){return yn(32)}getCurrentKey(){if(!this.currentKeyId)throw Error("Encryption is not properly initialized. Make sure encryption is enabled in the configuration.");let e=this.keys.get(this.currentKeyId);if(!e)throw Error(`No key found for ID ${this.currentKeyId}. The encryption key may have been rotated or removed.`);return{key:e,id:this.currentKeyId}}encrypt(e){let{key:t}=this.getCurrentKey(),r=yn(16),n=pf("aes-256-gcm",t,r),i=we.isBuffer(e)?e:we.from(e,"utf8"),o=n.update(i),s=n.final(),c=o.length+s.length,a=n.getAuthTag(),l=we.allocUnsafe(16+c+16);return r.copy(l,0),o.copy(l,16),s.copy(l,16+o.length),a.copy(l,16+c),{encrypted:l,iv:r}}async compressData(e){return new Promise((t,r)=>{let n=No(),i=[];n.on("data",(o)=>i.push(o)),n.on("end",()=>t(we.from(we.concat(i)))),n.on("error",r),n.write(e),n.end()})}getEncryptionOptions(){if(!this.config.rotation||typeof this.config.rotation==="boolean"||!this.config.rotation.encrypt)return{};let e={algorithm:"aes-256-cbc",compress:!1};if(typeof this.config.rotation.encrypt==="object"){let t=this.config.rotation.encrypt;return{...e,...t}}return e}async rotateLog(){if(W())return;if(!this.shouldWriteToFile())return;let e=await rt(this.currentLogFile).catch(()=>null);if(!e)return;let t=this.config.rotation;if(typeof t==="boolean")return;if(t.maxSize&&e.size>=t.maxSize){let r=this.currentLogFile,n=this.generateLogFilename();if(this.name.includes("rotation-load-test")||this.name==="failed-rotation-test"){let i=await Yt(this.config.logDirectory),o=i.filter((a)=>a.startsWith(this.name)&&/\.log\.\d+$/.test(a)).sort((a,l)=>{let u=Number.parseInt(a.match(/\.log\.(\d+)$/)?.[1]||"0");return Number.parseInt(l.match(/\.log\.(\d+)$/)?.[1]||"0")-u}),s=o.length>0?Number.parseInt(o[0].match(/\.log\.(\d+)$/)?.[1]||"0")+1:1,c=`${r}.${s}`;if(await rt(r).catch(()=>null))try{if(await To(r,c),t.compress)try{let a=`${c}.gz`;await this.compressLogFile(c,a),await Jt(c)}catch(a){console.error("Error compressing rotated file:",a)}if(o.length===0&&!i.some((a)=>a.endsWith(".log.1")))try{let a=`${r}.1`;await xn(a,"")}catch(a){console.error("Error creating backup file:",a)}}catch(a){console.error(`Error during rotation: ${a instanceof Error?a.message:String(a)}`)}}else{let i=new Date().toISOString().replace(/[:.]/g,"-"),o=r.replace(/\.log$/,`-${i}.log`);if(await rt(r).catch(()=>null))await To(r,o)}if(this.currentLogFile=n,t.maxFiles){let o=(await Yt(this.config.logDirectory)).filter((s)=>s.startsWith(this.name)).sort((s,c)=>c.localeCompare(s));for(let s of o.slice(t.maxFiles))await Jt(nt(this.config.logDirectory,s))}}}async compressLogFile(e,t){let r=ko(e),n=bf(t),i=No();await Rf(r,i,n)}async handleFingersCrossedBuffer(e,t){if(!this.fingersCrossedConfig)return;if(this.shouldActivateFingersCrossed(e)&&!this.isActivated){this.isActivated=!0;for(let r of this.logBuffer){let n=await this.formatter.format(r);if(this.shouldWriteToFile())await this.writeToFile(n);console.log(n)}if(this.fingersCrossedConfig.stopBuffering)this.logBuffer=[]}if(this.isActivated){if(this.shouldWriteToFile())await this.writeToFile(t);console.log(t)}}shouldLog(e){if(!this.enabled)return!1;let t={debug:0,info:1,success:2,warning:3,error:4};return t[e]>=t[this.config.level]}async flushPendingWrites(){if(await Promise.all(this.pendingOperations.map((e)=>{if(e instanceof Promise)return e.catch((t)=>{console.error("Error in pending write operation:",t)});return Promise.resolve()})),qt(this.currentLogFile))try{let e=Eo(this.currentLogFile,"r+");So(e),bn(e)}catch(e){console.error(`Error flushing file: ${e}`)}}async destroy(){if(this.rotationTimeout)clearInterval(this.rotationTimeout);if(this.keyRotationTimeout)clearInterval(this.keyRotationTimeout);this.timers.clear();for(let e of this.pendingOperations)if(typeof e.cancel==="function")e.cancel();return(async()=>{if(this.pendingOperations.length>0)try{await Promise.allSettled(this.pendingOperations)}catch(e){console.error("Error waiting for pending operations:",e)}if(!W()&&this.config.rotation&&typeof this.config.rotation!=="boolean"&&this.config.rotation.compress)try{let t=(await Yt(this.config.logDirectory)).filter((r)=>(r.includes("temp")||r.includes(".tmp"))&&r.includes(this.name));for(let r of t)try{await Jt(nt(this.config.logDirectory,r))}catch(n){console.error(`Failed to delete temp file ${r}:`,n)}}catch(e){console.error("Error cleaning up temporary files:",e)}})()}getCurrentLogFilePath(){return this.currentLogFile}formatTag(e){if(!e)return"";return`${this.tagFormat.prefix}${e}${this.tagFormat.suffix}`}formatFileTimestamp(e){return`[${e.toISOString()}]`}formatConsoleTimestamp(e){return this.shouldStyleConsole()?A.gray(e.toLocaleTimeString()):e.toLocaleTimeString()}shouldStyleConsole(){if(!this.fancy||W())return!1;let e=typeof N.env.NO_COLOR<"u",t=N.env.FORCE_COLOR==="0";if(e||t)return!1;return!!(typeof N.stderr<"u"&&N.stderr.isTTY||typeof N.stdout<"u"&&N.stdout.isTTY)}formatConsoleMessage(e){let{timestamp:t,icon:r="",tag:n="",message:i,level:o,showTimestamp:s=!0}=e,c=(h)=>h.replace(this.ANSI_PATTERN,"");if(!this.fancy){let h=[];if(s)h.push(t);if(o==="warning")h.push("WARN");else if(o==="error")h.push("ERROR");else if(r)h.push(r.replace(/[^\p{L}\p{N}\p{P}\p{Z}]/gu,""));if(n)h.push(n.replace(/[[\]]/g,""));return h.push(i),h.join(" ")}let a=N.stdout.columns||120,l="";if(o==="warning"||o==="error")l=`${r} ${i}`;else if(o==="info"||o==="success")l=`${r} ${n} ${i}`;else l=`${r} ${n} ${A.cyan(i)}`;if(!s)return l.trim();let u=c(l).trim().length,f=c(t).length,d=Math.max(1,a-2-u-f);return`${l.trim()}${" ".repeat(d)}${t}`}formatMessage(e,t){if(t.length===1&&Array.isArray(t[0]))return e.replace(/\{(\d+)\}/g,(o,s)=>{let c=Number.parseInt(s,10);return c<t[0].length?String(t[0][c]):o});let r=/%([sdijfo%])/g,n=0,i=e.replace(r,(o,s)=>{if(s==="%")return"%";if(n>=t.length)return o;let c=t[n++];switch(s){case"s":return String(c);case"d":case"i":return Number(c).toString();case"j":case"o":return JSON.stringify(c,null,2);default:return o}});if(n<t.length)i+=` ${t.slice(n).map((o)=>typeof o==="object"?JSON.stringify(o,null,2):String(o)).join(" ")}`;return i}formatMarkdown(e){if(!e)return e;let t=e;return t=t.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(r,n,i)=>{let o=A.underline(A.blue(n)),s=this.toAbsoluteFilePath(i);if(s&&this.shouldStyleConsole()&&this.supportsHyperlinks()){let c=`file://${encodeURI(s)}`,a="\x1B]8;;",l="\x1B\\";return`\x1B]8;;${c}\x1B\\${o}\x1B]8;;\x1B\\`}if(this.shouldStyleConsole()&&this.supportsHyperlinks())return`\x1B]8;;${i}\x1B\\${o}\x1B]8;;\x1B\\`;return o}),t=t.replace(/`([^`]+)`/g,(r,n)=>A.bgGray(n)),t=t.replace(/\*\*([^*]+)\*\*/g,(r,n)=>A.bold(n)),t=t.replace(/(?<!\*)\*([^*]+)\*(?!\*)/g,(r,n)=>A.italic(n)),t=t.replace(/(?<!_)_([^_]+)_(?!_)/g,(r,n)=>A.italic(n)),t=t.replace(/~([^~]+)~/g,(r,n)=>A.strikethrough(n)),t}supportsHyperlinks(){if(W())return!1;let e=N.env;if(!e)return!1;if(e.TERM_PROGRAM==="iTerm.app"||e.TERM_PROGRAM==="vscode"||e.TERM_PROGRAM==="WezTerm")return!0;if(e.WT_SESSION)return!0;if(e.TERM==="xterm-kitty")return!0;let t=e.VTE_VERSION?Number.parseInt(e.VTE_VERSION,10):0;if(!Number.isNaN(t)&&t>=5000)return!0;return!1}toAbsoluteFilePath(e){try{let t=e;if(t.startsWith("file://"))t=t.replace(/^file:\/\//,"");if(t.startsWith("~")){let r=N.env.HOME||"";if(r)t=t.replace(/^~(?=$|\/)/,r)}if(Cf(t)||t.startsWith("./")||t.startsWith("../"))t=$f(t);else return null;return qt(t)?t:null}catch{return null}}buildOutputTexts(e){let t=this.shouldStyleConsole()?this.formatMarkdown(e):e,r=e.replace(this.ANSI_PATTERN,"");return{consoleText:t,fileText:r}}async log(e,t,...r){if(!this.shouldLog(e))return;let n=new Date,i=this.formatConsoleTimestamp(n),o=this.formatFileTimestamp(n),s,c;if(t instanceof Error)s=t.message,c=t.stack;else s=this.formatMessage(t,r);let{consoleText:a,fileText:l}=this.buildOutputTexts(s);if(this.shouldStyleConsole()){let f=this.options.showIcons===!1?"":Fd[e],d=this.options.showTags!==!1&&this.name?A.gray(this.formatTag(this.name)):"",h;switch(e){case"debug":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:A.gray(a),level:e}),console.error(h);break;case"info":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:a,level:e}),console.warn(h);break;case"success":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:A.green(a),level:e}),console.error(h);break;case"warning":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:a,level:e}),console.warn(h);break;case"error":if(h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:a,level:e}),console.error(h),c){let m=c.split(`
|
|
72
42
|
`);for(let p of m)if(p.trim()&&!p.includes(s))console.error(this.formatConsoleMessage({timestamp:i,message:A.gray(` ${p}`),level:e,showTimestamp:!1}))}break}}else if(!W()){if(console.error(`${o} ${this.environment}.${e.toUpperCase()}: ${s}`),c)console.error(c)}let u=`${o} ${this.environment}.${e.toUpperCase()}: ${l}
|
|
73
43
|
`;if(c)u+=`${c}
|
|
74
44
|
`;if(u=u.replace(this.ANSI_PATTERN,""),this.shouldWriteToFile())await this.writeToFile(u)}progress(e,t=""){let r={update:(c,a)=>{},finish:(c)=>{},interrupt:(c,a)=>{}};if(!this.enabled)return r;let n=30;if(this.activeProgressBar={total:Math.max(1,e||1),current:0,message:t||"",barLength:n,lastRenderedLine:""},this.shouldStyleConsole()&&!W()&&N.stdout.isTTY)this.renderProgressBar(this.activeProgressBar);return{update:(c,a)=>{if(!this.enabled||!this.activeProgressBar)return;if(this.activeProgressBar.current=Math.min(Math.max(0,c),this.activeProgressBar.total),a!==void 0)this.activeProgressBar.message=a;if(this.shouldStyleConsole()&&!W()&&N.stdout.isTTY)this.renderProgressBar(this.activeProgressBar)},finish:(c)=>{if(!this.activeProgressBar)return;this.finishProgressBar(this.activeProgressBar,c)},interrupt:(c,a="info")=>{if(!W()&&N.stdout.isTTY)N.stdout.write(`
|
|
75
45
|
`);if(this[a==="warning"?"warn":a](c),this.activeProgressBar&&this.shouldStyleConsole()&&!W()&&N.stdout.isTTY)this.renderProgressBar(this.activeProgressBar)}}}time(e){let t=performance.now();if(this.shouldStyleConsole()){let r=this.options.showTags!==!1&&this.name?A.gray(this.formatTag(this.name)):"",n=this.formatConsoleTimestamp(new Date);console.error(this.formatConsoleMessage({timestamp:n,icon:this.options.showIcons===!1?"":A.blue("\u25D0"),tag:r,message:`${A.cyan(e)}...`}))}return async(r)=>{if(!this.enabled)return;let n=performance.now(),i=Math.round(n-t),o=`${e} completed in ${i}ms`,s=new Date,c=this.formatConsoleTimestamp(s),l=`${this.formatFileTimestamp(s)} ${this.environment}.INFO: ${o}`;if(r)l+=` ${JSON.stringify(r)}`;if(l+=`
|
|
76
|
-
`,l=l.replace(this.ANSI_PATTERN,""),this.shouldStyleConsole()){let u=this.options.showTags!==!1&&this.name?A.gray(this.formatTag(this.name)):"";console.error(this.formatConsoleMessage({timestamp:c,icon:this.options.showIcons===!1?"":A.green("\u2713"),tag:u,message:`${o}${r?` ${JSON.stringify(r)}`:""}`}))}else if(!W())console.error(l.trim());if(this.shouldWriteToFile())await this.writeToFile(l)}}async debug(e,...t){await this.log("debug",e,...t)}async info(e,...t){await this.log("info",e,...t)}async success(e,...t){await this.log("success",e,...t)}async warn(e,...t){await this.log("warning",e,...t)}async error(e,...t){await this.log("error",e,...t)}validateEncryptionConfig(){if(!this.config.rotation)return!1;if(typeof this.config.rotation==="boolean")return!1;let e=this.config.rotation,{encrypt:t}=e;return!!t}async only(e){if(!this.enabled)return;return await e()}isEnabled(){return this.enabled}setEnabled(e){this.enabled=e}extend(e){let t=`${this.name}:${e}`,r=new
|
|
46
|
+
`,l=l.replace(this.ANSI_PATTERN,""),this.shouldStyleConsole()){let u=this.options.showTags!==!1&&this.name?A.gray(this.formatTag(this.name)):"";console.error(this.formatConsoleMessage({timestamp:c,icon:this.options.showIcons===!1?"":A.green("\u2713"),tag:u,message:`${o}${r?` ${JSON.stringify(r)}`:""}`}))}else if(!W())console.error(l.trim());if(this.shouldWriteToFile())await this.writeToFile(l)}}async debug(e,...t){await this.log("debug",e,...t)}async info(e,...t){await this.log("info",e,...t)}async success(e,...t){await this.log("success",e,...t)}async warn(e,...t){await this.log("warning",e,...t)}async error(e,...t){await this.log("error",e,...t)}validateEncryptionConfig(){if(!this.config.rotation)return!1;if(typeof this.config.rotation==="boolean")return!1;let e=this.config.rotation,{encrypt:t}=e;return!!t}async only(e){if(!this.enabled)return;return await e()}isEnabled(){return this.enabled}setEnabled(e){this.enabled=e}extend(e){let t=`${this.name}:${e}`,r=new Cr(t,{...this.options,logDirectory:this.config.logDirectory,level:this.config.level,format:this.config.format,rotation:typeof this.config.rotation==="boolean"?void 0:this.config.rotation,timestamp:typeof this.config.timestamp==="boolean"?void 0:this.config.timestamp});return this.subLoggers.add(r),r}createReadStream(){if(W())throw Error("createReadStream is not supported in browser environments");if(!qt(this.currentLogFile))throw Error(`Log file does not exist: ${this.currentLogFile}`);return ko(this.currentLogFile,{encoding:"utf8"})}async decrypt(e){if(!this.validateEncryptionConfig())throw Error("Encryption is not configured");let t=this.config.rotation;if(!t.encrypt||typeof t.encrypt==="boolean")throw Error("Invalid encryption configuration");if(!this.currentKeyId||!this.keys.has(this.currentKeyId))throw Error("No valid encryption key available");let r=this.keys.get(this.currentKeyId);try{let n=we.isBuffer(e)?e:we.from(e,"base64"),i=n.subarray(0,16),o=n.subarray(n.length-16),s=n.subarray(16,n.length-16),c=yf("aes-256-gcm",r,i);c.setAuthTag(o);let a=c.update(s),l=c.final(),u=a.length+l.length,f=we.allocUnsafe(u);return a.copy(f,0),l.copy(f,a.length),f.toString("utf8")}catch(n){throw Error(`Decryption failed: ${n instanceof Error?n.message:String(n)}`)}}getLevel(){return this.config.level}getLogDirectory(){return this.config.logDirectory}getFormat(){return this.config.format}getRotationConfig(){return this.config.rotation}isBrowserMode(){return W()}isServerMode(){return!W()}setTestEncryptionKey(e,t){this.currentKeyId=e,this.keys.set(e,t)}getTestCurrentKey(){if(!this.currentKeyId||!this.keys.has(this.currentKeyId))return null;return{id:this.currentKeyId,key:this.keys.get(this.currentKeyId)}}getConfig(){return this.config}async box(e){if(!this.enabled)return;let t=new Date,r=this.formatConsoleTimestamp(t),n=this.formatFileTimestamp(t),{consoleText:i,fileText:o}=this.buildOutputTexts(e);if(this.shouldStyleConsole()){let c=i.split(`
|
|
77
47
|
`),a=Math.max(...c.map((d)=>d.length))+2,l=`\u250C${"\u2500".repeat(a)}\u2510`,u=`\u2514${"\u2500".repeat(a)}\u2518`,f=c.map((d)=>this.formatConsoleMessage({timestamp:r,message:A.cyan(d),showTimestamp:!1}));console.error(this.formatConsoleMessage({timestamp:r,message:A.cyan(l),showTimestamp:!1})),f.forEach((d)=>console.error(d)),console.error(this.formatConsoleMessage({timestamp:r,message:A.cyan(u),showTimestamp:!1}))}else if(!W())console.error(`${n} ${this.environment}.INFO: [BOX] ${o}`);let s=`${n} ${this.environment}.INFO: [BOX] ${o}
|
|
78
48
|
`.replace(this.ANSI_PATTERN,"");if(this.shouldWriteToFile())await this.writeToFile(s)}async prompt(e){if(W())return Promise.resolve(!0);return new Promise((t)=>{console.error(`${A.cyan("?")} ${e} (y/n) `);let r=(n)=>{let i=n.toString().trim().toLowerCase();N.stdin.removeListener("data",r);try{if(typeof N.stdin.setRawMode==="function")N.stdin.setRawMode(!1)}catch{}N.stdin.pause(),console.error(""),t(i==="y"||i==="yes")};try{if(typeof N.stdin.setRawMode==="function")N.stdin.setRawMode(!0)}catch{}N.stdin.resume(),N.stdin.once("data",r)})}setFancy(e){this.fancy=e}isFancy(){return this.fancy}pause(){this.enabled=!1}resume(){this.enabled=!0}async start(e,...t){if(!this.enabled)return;let r=e;if(t&&t.length>0){let a=/%([sdijfo%])/g,l=0;if(r=e.replace(a,(u,f)=>{if(f==="%")return"%";if(l>=t.length)return u;let d=t[l++];switch(f){case"s":return String(d);case"d":case"i":return Number(d).toString();case"j":case"o":return JSON.stringify(d,null,2);default:return u}}),l<t.length)r+=` ${t.slice(l).map((u)=>typeof u==="object"?JSON.stringify(u,null,2):String(u)).join(" ")}`}let{consoleText:n,fileText:i}=this.buildOutputTexts(r);if(this.shouldStyleConsole()){let a=this.options.showTags!==!1&&this.name?A.gray(this.formatTag(this.name)):"",l=this.options.showIcons===!1?"":`${A.blue("\u25D0")} `;console.error(`${l}${a} ${A.cyan(n)}`)}let c=`[${new Date().toISOString()}] ${this.environment}.INFO: [START] ${i}
|
|
79
49
|
`.replace(this.ANSI_PATTERN,"");if(this.shouldWriteToFile())await this.writeToFile(c)}renderProgressBar(e,t=!1){if(!this.enabled||!this.shouldStyleConsole()||!N.stdout.isTTY)return;let r=Math.min(100,Math.max(0,Math.round(e.current/e.total*100))),n=Math.round(e.barLength*r/100),i=e.barLength-n,o=A.green("\u2501".repeat(n)),s=A.gray("\u2501".repeat(i)),c=`[${o}${s}]`,a=`${r}%`.padStart(4),l=e.message?` ${e.message}`:"",u=this.options.showIcons===!1?"":t||r===100?A.green("\u2713"):A.blue("\u25B6"),f=this.options.showTags!==!1&&this.name?` ${A.gray(this.formatTag(this.name))}`:"",d=`\r${u}${f} ${c} ${a}${l}`,h=N.stdout.columns||80,m=" ".repeat(Math.max(0,h-d.replace(this.ANSI_PATTERN,"").length));if(e.lastRenderedLine=`${d}${m}`,N.stdout.write(e.lastRenderedLine),t)N.stdout.write(`
|
|
80
|
-
`)}finishProgressBar(e,t){if(!this.enabled||!this.fancy||W()||!N.stdout.isTTY){this.activeProgressBar=null;return}if(e.current<e.total)e.current=e.total;if(t)e.message=t;this.renderProgressBar(e,!0),this.activeProgressBar=null}async clear(e={}){if(W()){console.warn("Log clearing is not supported in browser environments.");return}try{console.warn("Clearing logs...",this.config.logDirectory);let t=await
|
|
50
|
+
`)}finishProgressBar(e,t){if(!this.enabled||!this.fancy||W()||!N.stdout.isTTY){this.activeProgressBar=null;return}if(e.current<e.total)e.current=e.total;if(t)e.message=t;this.renderProgressBar(e,!0),this.activeProgressBar=null}async clear(e={}){if(W()){console.warn("Log clearing is not supported in browser environments.");return}try{console.warn("Clearing logs...",this.config.logDirectory);let t=await Yt(this.config.logDirectory),r=[];for(let n of t){if(!(e.name?new RegExp(e.name.replace("*",".*")).test(n):n.startsWith(this.name))||!n.endsWith(".log"))continue;let o=nt(this.config.logDirectory,n);if(e.before)try{if((await rt(o)).mtime>=e.before)continue}catch(s){console.error(`Failed to get stats for file ${o}:`,s);continue}r.push(o)}if(r.length===0){console.warn("No log files matched the criteria for clearing.");return}console.warn(`Preparing to delete ${r.length} log file(s)...`);for(let n of r)try{await Jt(n),console.warn(`Deleted log file: ${n}`)}catch(i){console.error(`Failed to delete log file ${n}:`,i)}console.warn("Log clearing process finished.")}catch(t){console.error("Error during log clearing process:",t)}}}async function Dd(e,t={}){let{maxRetries:r=3,retryDelay:n=1000,isRetryable:i=()=>!0,fallback:o}=t,s=Error("Unknown error occurred");for(let c=0;c<=r;c++)try{return await e()}catch(a){if(s=a instanceof Error?a:Error(String(a)),c===r||!i(s))break;if(n>0)await new Promise((l)=>setTimeout(l,n))}if(o!==void 0)return o;throw s instanceof Error?s:Error(`Unknown error: ${String(s)}`)}class Hn{defaultParsers;constructor(){this.defaultParsers=[{name:"boolean",canParse:(e,t)=>t==="boolean"||["true","false","1","0","yes","no"].includes(e.toLowerCase()),parse:(e)=>{let t=e.toLowerCase();return["true","1","yes"].includes(t)}},{name:"number",canParse:(e,t)=>t==="number"||!Number.isNaN(Number(e))&&!Number.isNaN(Number.parseFloat(e)),parse:(e)=>{let t=Number(e);if(Number.isNaN(t))throw TypeError(`Cannot parse "${e}" as number`);return t}},{name:"array",canParse:(e,t)=>t==="array"||e.startsWith("[")||e.includes(","),parse:(e)=>{try{let t=JSON.parse(e);if(Array.isArray(t))return t}catch{}return e.split(",").map((t)=>t.trim())}},{name:"json",canParse:(e,t)=>t==="object"||(e.startsWith("{")&&e.endsWith("}")||e.startsWith("[")&&e.endsWith("]")),parse:(e)=>{try{return JSON.parse(e)}catch(t){throw Error(`Cannot parse "${e}" as JSON: ${t}`)}}}]}async applyEnvironmentVariables(e,t,r={}){let{prefix:n,useCamelCase:i=!0,useBackwardCompatibility:o=!0,customParsers:s={},verbose:c=!1,trackPerformance:a=!0}=r,l=async()=>{if(!e)return{config:t,source:{type:"environment",priority:50,timestamp:new Date}};let u=n||this.generateEnvPrefix(e),f={...t};return this.processObject(f,[],u,{useCamelCase:i,useBackwardCompatibility:o,customParsers:s,verbose:c,configName:e}),{config:f,source:{type:"environment",priority:50,timestamp:new Date}}};if(a)return Dn.track("applyEnvironmentVariables",l,{configName:e});return l()}generateEnvPrefix(e){return e.toUpperCase().replace(/-/g,"_")}formatEnvKey(e,t){if(!t)return e.toUpperCase();return e.replace(/([A-Z])/g,"_$1").toUpperCase()}processObject(e,t,r,n){for(let[i,o]of Object.entries(e)){let s=[...t,i],c=s.map((u)=>this.formatEnvKey(u,n.useCamelCase)),a=`${r}_${c.join("_")}`,l=n.useBackwardCompatibility?`${r}_${s.map((u)=>u.toUpperCase()).join("_")}`:null;if(n.verbose);if(typeof o==="object"&&o!==null&&!Array.isArray(o))this.processObject(o,s,r,n);else{let u=Zt.env[a]||(l?Zt.env[l]:void 0);if(u!==void 0){if(n.verbose){let f=Zt.env[a]?a:l}try{e[i]=this.parseEnvironmentValue(u,typeof o,a,n.customParsers,n.configName)}catch(f){if(f instanceof Gn)throw f;throw Ve.envVar(a,u,typeof o,n.configName)}}}}}parseEnvironmentValue(e,t,r,n,i){for(let[o,s]of Object.entries(n))try{return s(e)}catch{continue}for(let o of this.defaultParsers)if(o.canParse(e,t))try{return o.parse(e)}catch{throw Ve.envVar(r,e,`${t} (via ${o.name} parser)`,i)}return e}getEnvironmentVariables(e){let t={},r=e.toUpperCase();for(let[n,i]of Object.entries(Zt.env))if(n.startsWith(r)&&i!==void 0)t[n]=i;return t}validateEnvironmentVariable(e,t,r){let n=[];if(!/^[A-Z_][A-Z0-9_]*$/.test(e))n.push(`Environment variable key "${e}" should only contain uppercase letters, numbers, and underscores`);if(r)try{this.parseEnvironmentValue(e,t,r,{})}catch(i){n.push(`Cannot parse value "${t}" as ${r}: ${i}`)}return{isValid:n.length===0,errors:n}}generateEnvVarDocs(e,t,r={}){let{prefix:n,format:i="text"}=r,o=n||this.generateEnvPrefix(e),s=[];switch(this.extractEnvVarInfo(t,[],o,s),i){case"markdown":return this.formatAsMarkdown(s,e);case"json":return JSON.stringify(s,null,2);default:return this.formatAsText(s,e)}}extractEnvVarInfo(e,t,r,n){for(let[i,o]of Object.entries(e)){let s=[...t,i],c=`${r}_${s.map((a)=>this.formatEnvKey(a,!0)).join("_")}`;if(typeof o==="object"&&o!==null&&!Array.isArray(o))this.extractEnvVarInfo(o,s,r,n);else n.push({key:c,type:Array.isArray(o)?"array":typeof o,description:`Configuration for ${s.join(".")}`,example:this.generateExample(o)})}}generateExample(e){if(Array.isArray(e))return JSON.stringify(e);if(typeof e==="object"&&e!==null)return JSON.stringify(e);return String(e)}formatAsText(e,t){let r=`Environment Variables for ${t}:
|
|
81
51
|
|
|
82
52
|
`;for(let n of e)r+=`${n.key}
|
|
83
53
|
`,r+=` Type: ${n.type}
|
|
@@ -89,7 +59,37 @@ export type ConfigOf = Config
|
|
|
89
59
|
`;r+=`| Variable | Type | Description | Example |
|
|
90
60
|
`,r+=`|----------|------|-------------|----------|
|
|
91
61
|
`;for(let n of e)r+=`| \`${n.key}\` | ${n.type} | ${n.description} | \`${n.example}\` |
|
|
92
|
-
`;return r}}function Fd(e,t,r={}){return $s(e,t,r,new WeakMap)}function $s(e,t,r,n){let{arrayMergeMode:i="replace",skipNullish:o=!1,customMerger:s}=r;if(t===null||t===void 0)return o?e:t;if(s){let c=s(e,t);if(c!==void 0)return c}if(Array.isArray(t)||Array.isArray(e))return Rs(e,t,i,n);if(!ae(t)||!ae(e))return t;return Ud(e,t,r,n)}function Rs(e,t,r,n){if(Array.isArray(t)&&!Array.isArray(e))return t;if(Array.isArray(e)&&!Array.isArray(t))return t;if(Array.isArray(t)&&Array.isArray(e))switch(r){case"replace":return t;case"concat":return Dd(e,t);case"smart":return jd(e,t,n);default:return t}return t}function Dd(e,t){let r=[...t];for(let n of e)if(!r.some((i)=>Fn(i,n)))r.push(n);return r}function jd(e,t,r){if(t.length===0)return e;if(e.length===0)return t;if(ae(t[0])&&ae(e[0]))return Bd(e,t,r);if(t.every((n)=>typeof n==="string")&&e.every((n)=>typeof n==="string")){let n=[...t];for(let i of e)if(!n.includes(i))n.push(i);return n}return t}function Bd(e,t,r){let n=[...t];for(let i of e){if(!ae(i)){n.push(i);continue}let o=["id","name","key","path","type"],s=!1;for(let c of o)if(c in i){if(n.find((l)=>ae(l)&&(c in l)&&l[c]===i[c])){s=!0;break}}if(!s)n.push(i)}return n}function Ud(e,t,r,n){let i=t;if(ae(i)&&n.has(i))return n.get(i);let o={...e};if(ae(i))n.set(i,o);for(let s in i){if(!Object.prototype.hasOwnProperty.call(i,s))continue;let c=i[s],a=o[s];if(r.skipNullish&&(c===null||c===void 0))continue;if(c===null||c===void 0){o[s]=c;continue}if(ae(c)&&ae(a))o[s]=$s(a,c,r,n);else if(Array.isArray(c)||Array.isArray(a))o[s]=Rs(a,c,r.arrayMergeMode||"smart",n);else o[s]=c}return o}function ks(e,t,r="replace"){return Fd(e,t,{arrayMergeMode:r==="replace"?"replace":"smart",skipNullish:!0})}function Fn(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!Fn(e[r],t[r]))return!1;return!0}if(ae(e)&&ae(t)){let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let i of r){if(!Object.prototype.hasOwnProperty.call(t,i))return!1;if(!Fn(e[i],t[i]))return!1}return!0}return!1}function ae(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}class Ss{extensions=Ho;async loadFromPath(e,t,r={}){let{arrayStrategy:n="replace",useCache:i=!0,cacheTtl:o,trackPerformance:s=!0,verbose:c=!1}=r;if(i){let l=ir.getWithFileCheck("file",e);if(l){if(c)console.log(`Configuration loaded from cache: ${e}`);return l}}let a=async()=>{if(!Zt(e))return null;try{let l=`?t=${Date.now()}`,u=await import(e+l),f=u.default||u,d="default"in u,h=Object.keys(u).length>0;if(!d&&!h)throw new pr(e,Error("Configuration file is empty and exports nothing"),"unknown");if(typeof f!=="object"||f===null||Array.isArray(f))throw new pr(e,Error("Configuration must export a valid object"),"unknown");let g={config:ks(t,f,n),source:{type:"file",path:e,priority:100,timestamp:new Date}};if(i)ir.setWithFileCheck("file",g,e,o);return g}catch(l){throw l instanceof Error?Ve.configLoad(e,l):Ve.configLoad(e,Error(String(l)))}};if(s)return Dn.track("loadFromPath",a,{path:e});return a()}async tryLoadFromPaths(e,t,r={}){for(let n of e)try{let i=await this.loadFromPath(n,t,r);if(i)return i}catch(i){if(i instanceof Error&&i.name==="ConfigLoadError")throw i;if(r.verbose)console.warn(`Failed to load config from ${n}:`,i)}return null}generateConfigPaths(e,t,r){return _u({name:e,directory:t,alias:r})}generateNamePatterns(e,t){return qo({name:e,alias:t})}checkFileAccess(e){return Md(async()=>Zt(e),{maxRetries:2,retryDelay:100,fallback:!1})}async discoverConfigFiles(e,t,r){let n=[];if(!Zt(e))return n;if(t||r){let i=this.generateNamePatterns(t||"",r);for(let o of i)for(let s of this.extensions){let c=Wo(e,`${o}${s}`);if(await this.checkFileAccess(c))n.push(c)}}else try{let{readdirSync:i}=await import("fs"),o=i(e);for(let s of o)if(this.looksLikeConfigFile(s)){let c=Wo(e,s);if(await this.checkFileAccess(c))n.push(c)}}catch{return[]}return n}looksLikeConfigFile(e){return[/\.config\.(ts|js|mjs|cjs|json|mts|cts)$/,/^\..*\.(ts|js|mjs|cjs|json|mts|cts)$/,/config\.(ts|js|mjs|cjs|json|mts|cts)$/].some((r)=>r.test(e))}async validateConfigFile(e){let t=[];try{if(!Zt(e))return t.push("Configuration file does not exist"),t;let r=await import(e),n=r.default||r;if(n===void 0)t.push("Configuration file must export a default value or named exports");else if(typeof n!=="object"||n===null)t.push("Configuration must be an object");else if(Array.isArray(n))t.push("Configuration cannot be an array at the root level");if(e.endsWith(".json"))try{let{readFileSync:i}=await import("fs"),o=i(e,"utf8");JSON.parse(o)}catch(i){t.push(`Invalid JSON syntax: ${i}`)}}catch(r){t.push(`Failed to load configuration file: ${r}`)}return t}async getFileModificationTime(e){try{let{statSync:t}=await import("fs");return t(e).mtime}catch{return null}}async preloadConfigurations(e,t={}){let r=new Map;return await Promise.allSettled(e.map(async(n)=>{try{let i=await this.loadFromPath(n,{},t);if(i)r.set(n,i.config)}catch(i){if(t.verbose)console.warn(`Failed to preload ${n}:`,i)}})),r}}var zd=/^https?:\/\//;class Es{async validateConfiguration(e,t,r={}){let{stopOnFirstError:n=!1,validateRequired:i=!0,validateTypes:o=!0,customRules:s=[],trackPerformance:c=!0,verbose:a=!1}=r,l=async()=>{let u=[],f=[],d={stopOnFirstError:n,validateRequired:i,validateTypes:o,customRules:s,trackPerformance:c,verbose:a};try{if(typeof t==="string")return await this.validateWithSchemaFile(e,t,d);else if(Array.isArray(t))return this.validateWithRules(e,[...t,...s],d);else return this.validateWithJSONSchema(e,t,d)}catch(h){return u.push({path:"",message:`Validation failed: ${h}`,rule:"system"}),{isValid:!1,errors:u,warnings:f}}};if(c)return await Dn.track("validateConfiguration",l);return l()}async validateWithSchemaFile(e,t,r){try{if(!Vd(t))throw new yr(t,[{path:"",message:"Schema file does not exist"}]);let n=await import(t),i=n.default||n;if(Array.isArray(i))return this.validateWithRules(e,i,r);else return this.validateWithJSONSchema(e,i,r)}catch(n){throw new yr(t,[{path:"",message:`Failed to load schema: ${n}`}])}}validateWithJSONSchema(e,t,r){let n=[],i=[];return this.validateObjectAgainstSchema(e,t,"",n,i,r),{isValid:n.length===0,errors:n,warnings:i}}validateObjectAgainstSchema(e,t,r,n,i,o){if(o.validateTypes&&t.type){let s=Array.isArray(e)?"array":typeof e,c=Array.isArray(t.type)?t.type:[t.type];if(!c.includes(s)){if(n.push({path:r,message:`Expected type ${c.join(" or ")}, got ${s}`,expected:c.join(" or "),actual:s,rule:"type"}),o.stopOnFirstError)return}}if(t.enum&&!t.enum.includes(e)){if(n.push({path:r,message:`Value must be one of: ${t.enum.join(", ")}`,expected:t.enum.join(", "),actual:e,rule:"enum"}),o.stopOnFirstError)return}if(typeof e==="string"){if(t.minLength!==void 0&&e.length<t.minLength)n.push({path:r,message:`String length must be at least ${t.minLength}`,expected:`>= ${t.minLength}`,actual:e.length,rule:"minLength"});if(t.maxLength!==void 0&&e.length>t.maxLength)n.push({path:r,message:`String length must not exceed ${t.maxLength}`,expected:`<= ${t.maxLength}`,actual:e.length,rule:"maxLength"});if(t.pattern){if(!new RegExp(t.pattern).test(e))n.push({path:r,message:`String does not match pattern ${t.pattern}`,expected:t.pattern,actual:e,rule:"pattern"})}}if(typeof e==="number"){if(t.minimum!==void 0&&e<t.minimum)n.push({path:r,message:`Value must be at least ${t.minimum}`,expected:`>= ${t.minimum}`,actual:e,rule:"minimum"});if(t.maximum!==void 0&&e>t.maximum)n.push({path:r,message:`Value must not exceed ${t.maximum}`,expected:`<= ${t.maximum}`,actual:e,rule:"maximum"})}if(Array.isArray(e)&&t.items)for(let s=0;s<e.length;s++){let c=r?`${r}[${s}]`:`[${s}]`;if(this.validateObjectAgainstSchema(e[s],t.items,c,n,i,o),o.stopOnFirstError&&n.length>0)return}if(e&&typeof e==="object"&&!Array.isArray(e)){let s=e;if(o.validateRequired&&t.required){for(let c of t.required)if(!(c in s)){if(n.push({path:r?`${r}.${c}`:c,message:`Missing required property '${c}'`,expected:"required",rule:"required"}),o.stopOnFirstError)return}}if(t.properties){for(let[c,a]of Object.entries(t.properties))if(c in s){let l=r?`${r}.${c}`:c;if(this.validateObjectAgainstSchema(s[c],a,l,n,i,o),o.stopOnFirstError&&n.length>0)return}}if(t.additionalProperties===!1){let c=new Set(Object.keys(t.properties||{}));for(let a of Object.keys(s))if(!c.has(a))i.push({path:r?`${r}.${a}`:a,message:`Additional property '${a}' is not allowed`,rule:"additionalProperties"})}}}validateWithRules(e,t,r){let n=[],i=[];for(let o of t)try{let s=this.getValueByPath(e,o.path),c=this.validateWithRule(s,o,o.path);if(n.push(...c),r.stopOnFirstError&&n.length>0)break}catch(s){n.push({path:o.path,message:`Rule validation failed: ${s}`,rule:"system"})}return{isValid:n.length===0,errors:n,warnings:i}}validateWithRule(e,t,r){let n=[];if(t.required&&(e===void 0||e===null))return n.push({path:r,message:t.message||`Property '${r}' is required`,expected:"required",rule:"required"}),n;if(e===void 0||e===null)return n;if(t.type){let i=Array.isArray(e)?"array":typeof e;if(i!==t.type)n.push({path:r,message:t.message||`Expected type ${t.type}, got ${i}`,expected:t.type,actual:i,rule:"type"})}if(t.min!==void 0){let i=Array.isArray(e)?e.length:typeof e==="string"?e.length:typeof e==="number"?e:0;if(i<t.min)n.push({path:r,message:t.message||`Value must be at least ${t.min}`,expected:`>= ${t.min}`,actual:i,rule:"min"})}if(t.max!==void 0){let i=Array.isArray(e)?e.length:typeof e==="string"?e.length:typeof e==="number"?e:0;if(i>t.max)n.push({path:r,message:t.message||`Value must not exceed ${t.max}`,expected:`<= ${t.max}`,actual:i,rule:"max"})}if(t.pattern&&typeof e==="string"){if(!t.pattern.test(e))n.push({path:r,message:t.message||`Value does not match pattern ${t.pattern}`,expected:t.pattern.toString(),actual:e,rule:"pattern"})}if(t.enum&&!t.enum.includes(e))n.push({path:r,message:t.message||`Value must be one of: ${t.enum.join(", ")}`,expected:t.enum.join(", "),actual:e,rule:"enum"});if(t.validator){let i=t.validator(e);if(i)n.push({path:r,message:t.message||i,rule:"custom"})}return n}getValueByPath(e,t){if(!t)return e;let r=t.split("."),n=e;for(let i of r)if(n&&typeof n==="object"&&i in n)n=n[i];else return;return n}generateRulesFromInterface(e){let t=[],r=e.matchAll(/(\w+)(\?)?:\s*(\w+)/g);for(let n of r){let[,i,o,s]=n;t.push({path:i,required:!o,type:this.mapTypeScriptType(s)})}return t}mapTypeScriptType(e){switch(e.toLowerCase()){case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"array":return"array";case"object":return"object";default:return"object"}}static createCommonRules(){return{server:[{path:"port",required:!0,type:"number",min:1,max:65535},{path:"host",required:!0,type:"string",min:1},{path:"ssl",type:"boolean"}],database:[{path:"url",required:!0,type:"string",min:1},{path:"pool",type:"number",min:1,max:100},{path:"timeout",type:"number",min:0}],api:[{path:"baseUrl",required:!0,type:"string",pattern:zd},{path:"timeout",type:"number",min:0},{path:"retries",type:"number",min:0,max:10}]}}}var ue=new wr("bunfig",{showTags:!0});function Wd(e){if(!e)return"";let t=Array.isArray(e)?e.filter(Boolean):[e];if(t.length===0)return"";if(t.length===1)return` or alias "${t[0]}"`;return` or aliases ${t.map((r)=>`"${r}"`).join(", ")}`}class As{fileLoader=new Ss;envProcessor=new Hn;validator=new Es;async loadConfig(e){let t=Date.now(),{cache:r,performance:n,schema:i,validate:o,...s}=e;try{if(r?.enabled){let a=this.checkCache(s.name||"",s);if(a)return a}let c;try{c=await this.loadConfigurationStrategies(s,!0,r)}catch(a){if(s.configFile)throw a;let l=s.__strictErrorHandling;if(a instanceof Error&&a.name==="ConfigNotFoundError"){if(l)throw a;c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`No configuration file found for "${s.name||"config"}", using defaults with environment variables`]}}else if(a instanceof Error&&a.name==="ConfigLoadError"){let u=a.message.includes("EACCES")||a.message.includes("EPERM")||a.message.includes("permission denied"),f=!u&&(a.message.includes("syntax")||a.message.includes("Expected")||a.message.includes("Unexpected")||a.message.includes("BuildMessage")||a.message.includes("errors building")),d=a.message.includes("Configuration must export a valid object")||a.message.includes("Configuration file is empty and exports nothing");if(l&&(d||u))throw a;if(f&&(!l||!d))c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:["Configuration file has syntax errors, using defaults with environment variables"]};else if(!l)c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`Configuration loading error, using defaults: ${a.message}`]};else throw a}else c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`Configuration loading failed, using defaults: ${a instanceof Error?a.message:String(a)}`]}}if(i||o)await this.validateConfiguration(c.config,i,o,s.name);if(r?.enabled&&c)this.cacheResult(s.name||"",c,r,s);if(n?.enabled){let a={operation:"loadConfig",duration:Date.now()-t,configName:s.name,timestamp:new Date};if(n.onMetrics)n.onMetrics(a);if(n.slowThreshold&&a.duration>n.slowThreshold)ue.warn(`Slow configuration loading detected: ${a.duration}ms for ${s.name}`);c.metrics=a}return c}catch(c){if(c instanceof Error&&c.name==="ConfigNotFoundError")throw c;let a=Date.now()-t;throw ue.error(`Configuration loading failed after ${a}ms:`,[c instanceof Error?c:Error(String(c))]),c}}async loadConfigurationStrategies(e,t=!1,r){let{name:n="",alias:i,configFile:o,cwd:s,configDir:c,defaultConfig:a,checkEnv:l=!0,arrayStrategy:u="replace",verbose:f=!1}=e,d=s||br.cwd(),h=[];if(o){let b=pe(d,o);h.push(b);let v=l?bt(n,a,f):a,S=await this.fileLoader.tryLoadFromPaths([b],v,{arrayStrategy:u,verbose:f,cacheTtl:r?.ttl,useCache:!r?.ttl||r.ttl>100});if(!S)throw Ve.configNotFound(n||o,h,i);if(f)ue.success(`Configuration loaded from explicit path: ${b}`);return this.finalizeResult(S,h,l,n,f)}let m=await this.loadLocalConfiguration(n,i,d,c,a,u,f,l,r);if(m)return h.push(...this.getLocalSearchPaths(n,i,d,c)),this.finalizeResult(m,h,l,n,f);let p=await this.loadHomeConfiguration(n,i,a,u,f,l);if(p)return h.push(...this.getHomeSearchPaths(n,i)),this.finalizeResult(p,h,l,n,f);let g=await this.loadPackageJsonConfiguration(n,i,d,a,u,f,l);if(g)return h.push(pe(d,"package.json")),this.finalizeResult(g,h,l,n,f);if(h.push(...this.getAllSearchPaths(n,i,d,c)),t)throw Ve.configNotFound(n,h,i);return{...await this.applyEnvironmentVariables(n,a,l,f),warnings:[`No configuration file found for "${n}"${Wd(i)}, using defaults with environment variables`]}}async loadLocalConfiguration(e,t,r,n,i,o,s,c,a){let l=c?bt(e,i,s):i,u=this.getLocalDirectories(r,n);for(let f of u){if(s)ue.info(`Searching for configuration in: ${f}`);let d=this.fileLoader.generateConfigPaths(e,f,t),h=await this.fileLoader.tryLoadFromPaths(d,l,{arrayStrategy:o,verbose:s,cacheTtl:a?.ttl,useCache:!a?.ttl||a.ttl>100});if(h){if(s)ue.success(`Configuration loaded from: ${h.source.path}`);return h}}return null}async loadHomeConfiguration(e,t,r,n,i,o){if(!e)return null;let s=o?bt(e,r,i):r,c=[pe(qe(),".config",e),pe(qe(),".config"),qe()];for(let a of c){if(i)ue.info(`Checking home directory: ${a}`);let l=this.fileLoader.generateConfigPaths(e,a,t),u=await this.fileLoader.tryLoadFromPaths(l,s,{arrayStrategy:n,verbose:i});if(u){if(i)ue.success(`Configuration loaded from home directory: ${u.source.path}`);return u}}return null}async loadPackageJsonConfiguration(e,t,r,n,i,o,s){let c=s?bt(e,n,o):n;try{let a=pe(r,"package.json");if(!Mu(a))return null;let l={};try{l=JSON.parse(Fu(a,"utf8"))}catch(d){if(o)ue.warn("Failed to parse package.json:",[d instanceof Error?d:Error(String(d))]);return null}let u=l[e],f=e;if(!u&&t){let d=Array.isArray(t)?t:[t];for(let h of d){if(!h)continue;if(l[h]){u=l[h],f=h;break}}}if(u&&typeof u==="object"&&!Array.isArray(u)){if(o)ue.success(`Configuration loaded from package.json: ${f}`);return{config:ks(c,u,i),source:{type:"package.json",path:a,priority:30,timestamp:new Date}}}}catch(a){if(o)ue.warn("Failed to load package.json:",[a instanceof Error?a:Error(String(a))])}return null}async applyEnvironmentVariables(e,t,r,n){if(!r||!e||typeof t!=="object"||t===null||Array.isArray(t))return{config:t,source:{type:"default",priority:10,timestamp:new Date}};return{config:bt(e,t,n),source:{type:"environment",priority:20,timestamp:new Date}}}async finalizeResult(e,t,r,n,i){return{config:e.config,source:e.source,path:e.source.path}}async validateConfiguration(e,t,r,n){let i=[];if(r){let o=r(e);if(o)i.push(...o)}if(t){let o=await this.validator.validateConfiguration(e,t);if(!o.isValid)i.push(...o.errors.map((s)=>s.path?`${s.path}: ${s.message}`:s.message))}if(i.length>0)throw Ve.configValidation(n||"unknown",i,n)}checkCache(e,t){let r=this.generateCacheKey(e,t);return ir.get(r)||null}cacheResult(e,t,r,n){let i=this.generateCacheKey(e,n);ir.set(i,t,void 0,r.ttl)}generateCacheKey(e,t){let r=[e];if(t.alias){let n=Array.isArray(t.alias)?t.alias.join(","):t.alias;r.push(`alias:${n}`)}if(t.cwd)r.push(`cwd:${t.cwd}`);if(t.configFile)r.push(`configFile:${t.configFile}`);if(t.configDir)r.push(`configDir:${t.configDir}`);if("checkEnv"in t)r.push(`checkEnv:${t.checkEnv}`);return r.join("|")}getLocalDirectories(e,t){return Lu({cwd:e,configDir:t})}getAllSearchPaths(e,t,r,n){let i=[];return i.push(...this.getLocalSearchPaths(e,t,r,n)),i.push(...this.getHomeSearchPaths(e,t)),i.push(pe(r,"package.json")),i}getLocalSearchPaths(e,t,r,n){let i=this.getLocalDirectories(r,n),o=[];for(let s of i)o.push(...this.fileLoader.generateConfigPaths(e,s,t));return o}getHomeSearchPaths(e,t){if(!e)return[];let r=[pe(qe(),".config",e),pe(qe(),".config"),qe()],n=[];for(let i of r)n.push(...this.fileLoader.generateConfigPaths(e,i,t));return n}async loadConfigWithResult(e){return this.loadConfig(e)}}var kn=new As;async function Ts(e){let t="defaultConfig"in e&&e.defaultConfig!==void 0?e.defaultConfig:{},r="cache"in e||"performance"in e||"schema"in e||"validate"in e;try{let n;if(r)n=await kn.loadConfig(e);else n=await kn.loadConfig({...e,defaultConfig:t,cache:{enabled:!0},performance:{enabled:!1}});return n?.config??t}catch(n){if(e.configFile)throw n;let i=n instanceof Error?n.name:"UnknownError",o=n instanceof Error?n.message:String(n);if(!(i==="ConfigNotFoundError"||i==="ConfigLoadError"||i==="ConfigValidationError"||o.includes("config"))&&e.verbose)ue.warn("Unexpected error loading config, using defaults:",[n instanceof Error?n:Error(String(n))]);let c=r?{...e,defaultConfig:t}:{...e,defaultConfig:t,cache:{enabled:!0},performance:{enabled:!1}};if("checkEnv"in e?e.checkEnv!==!1:!0)return(await kn.applyEnvironmentVariables(c.name||"",t,!0,c.verbose||!1))?.config??t;return t}}function bt(e,t,r=!1){let n=new Hn,i=e.toUpperCase().replace(/[^A-Z0-9]/g,"_");function o(s,c=[]){let a={...s};for(let[l,u]of Object.entries(s)){let f=[...c,l],d=[`${i}_${f.join("_").toUpperCase()}`,`${i}_${f.map((p)=>p.toUpperCase()).join("")}`,`${i}_${f.map((p)=>p.replace(/([A-Z])/g,"_$1").toUpperCase()).join("")}`],h,m;for(let p of d)if(h=br.env[p],h!==void 0){m=p;break}if(h!==void 0&&m)if(typeof u==="boolean")a[l]=["true","1","yes"].includes(h.toLowerCase());else if(typeof u==="number"){let p=Number(h);if(!Number.isNaN(p))a[l]=p}else if(Array.isArray(u))try{a[l]=JSON.parse(h)}catch{a[l]=h.split(",").map((p)=>p.trim())}else a[l]=h;else if(u&&typeof u==="object"&&!Array.isArray(u))a[l]=o(u,f)}return a}return o(t)}var Ow=pe(br.cwd(),"config"),Iw=pe(br.cwd(),"src/generated");var Cr={getCSS:()=>`
|
|
62
|
+
`;return r}}function jd(e,t,r={}){return $s(e,t,r,new WeakMap)}function $s(e,t,r,n){let{arrayMergeMode:i="replace",skipNullish:o=!1,customMerger:s}=r;if(t===null||t===void 0)return o?e:t;if(s){let c=s(e,t);if(c!==void 0)return c}if(Array.isArray(t)||Array.isArray(e))return Rs(e,t,i,n);if(!ae(t)||!ae(e))return t;return zd(e,t,r,n)}function Rs(e,t,r,n){if(Array.isArray(t)&&!Array.isArray(e))return t;if(Array.isArray(e)&&!Array.isArray(t))return t;if(Array.isArray(t)&&Array.isArray(e))switch(r){case"replace":return t;case"concat":return Bd(e,t);case"smart":return Ud(e,t,n);default:return t}return t}function Bd(e,t){let r=[...t];for(let n of e)if(!r.some((i)=>Fn(i,n)))r.push(n);return r}function Ud(e,t,r){if(t.length===0)return e;if(e.length===0)return t;if(ae(t[0])&&ae(e[0]))return Vd(e,t,r);if(t.every((n)=>typeof n==="string")&&e.every((n)=>typeof n==="string")){let n=[...t];for(let i of e)if(!n.includes(i))n.push(i);return n}return t}function Vd(e,t,r){let n=[...t];for(let i of e){if(!ae(i)){n.push(i);continue}let o=["id","name","key","path","type"],s=!1;for(let c of o)if(c in i){if(n.find((l)=>ae(l)&&(c in l)&&l[c]===i[c])){s=!0;break}}if(!s)n.push(i)}return n}function zd(e,t,r,n){let i=t;if(ae(i)&&n.has(i))return n.get(i);let o={...e};if(ae(i))n.set(i,o);for(let s in i){if(!Object.prototype.hasOwnProperty.call(i,s))continue;let c=i[s],a=o[s];if(r.skipNullish&&(c===null||c===void 0))continue;if(c===null||c===void 0){o[s]=c;continue}if(ae(c)&&ae(a))o[s]=$s(a,c,r,n);else if(Array.isArray(c)||Array.isArray(a))o[s]=Rs(a,c,r.arrayMergeMode||"smart",n);else o[s]=c}return o}function ks(e,t,r="replace"){return jd(e,t,{arrayMergeMode:r==="replace"?"replace":"smart",skipNullish:!0})}function Fn(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!Fn(e[r],t[r]))return!1;return!0}if(ae(e)&&ae(t)){let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let i of r){if(!Object.prototype.hasOwnProperty.call(t,i))return!1;if(!Fn(e[i],t[i]))return!1}return!0}return!1}function ae(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}class Ss{extensions=Ho;async loadFromPath(e,t,r={}){let{arrayStrategy:n="replace",useCache:i=!0,cacheTtl:o,trackPerformance:s=!0,verbose:c=!1}=r;if(i){let l=or.getWithFileCheck("file",e);if(l){if(c)console.log(`Configuration loaded from cache: ${e}`);return l}}let a=async()=>{if(!Qt(e))return null;try{let l=`?t=${Date.now()}`,u=await import(e+l),f=u.default||u,d="default"in u,h=Object.keys(u).length>0;if(!d&&!h)throw new yr(e,Error("Configuration file is empty and exports nothing"),"unknown");if(typeof f!=="object"||f===null||Array.isArray(f))throw new yr(e,Error("Configuration must export a valid object"),"unknown");let g={config:ks(t,f,n),source:{type:"file",path:e,priority:100,timestamp:new Date}};if(i)or.setWithFileCheck("file",g,e,o);return g}catch(l){throw l instanceof Error?Ve.configLoad(e,l):Ve.configLoad(e,Error(String(l)))}};if(s)return Dn.track("loadFromPath",a,{path:e});return a()}async tryLoadFromPaths(e,t,r={}){for(let n of e)try{let i=await this.loadFromPath(n,t,r);if(i)return i}catch(i){if(i instanceof Error&&i.name==="ConfigLoadError")throw i;if(r.verbose)console.warn(`Failed to load config from ${n}:`,i)}return null}generateConfigPaths(e,t,r){return Mu({name:e,directory:t,alias:r})}generateNamePatterns(e,t){return qo({name:e,alias:t})}checkFileAccess(e){return Dd(async()=>Qt(e),{maxRetries:2,retryDelay:100,fallback:!1})}async discoverConfigFiles(e,t,r){let n=[];if(!Qt(e))return n;if(t||r){let i=this.generateNamePatterns(t||"",r);for(let o of i)for(let s of this.extensions){let c=Wo(e,`${o}${s}`);if(await this.checkFileAccess(c))n.push(c)}}else try{let{readdirSync:i}=await import("fs"),o=i(e);for(let s of o)if(this.looksLikeConfigFile(s)){let c=Wo(e,s);if(await this.checkFileAccess(c))n.push(c)}}catch{return[]}return n}looksLikeConfigFile(e){return[/\.config\.(ts|js|mjs|cjs|json|mts|cts)$/,/^\..*\.(ts|js|mjs|cjs|json|mts|cts)$/,/config\.(ts|js|mjs|cjs|json|mts|cts)$/].some((r)=>r.test(e))}async validateConfigFile(e){let t=[];try{if(!Qt(e))return t.push("Configuration file does not exist"),t;let r=await import(e),n=r.default||r;if(n===void 0)t.push("Configuration file must export a default value or named exports");else if(typeof n!=="object"||n===null)t.push("Configuration must be an object");else if(Array.isArray(n))t.push("Configuration cannot be an array at the root level");if(e.endsWith(".json"))try{let{readFileSync:i}=await import("fs"),o=i(e,"utf8");JSON.parse(o)}catch(i){t.push(`Invalid JSON syntax: ${i}`)}}catch(r){t.push(`Failed to load configuration file: ${r}`)}return t}async getFileModificationTime(e){try{let{statSync:t}=await import("fs");return t(e).mtime}catch{return null}}async preloadConfigurations(e,t={}){let r=new Map;return await Promise.allSettled(e.map(async(n)=>{try{let i=await this.loadFromPath(n,{},t);if(i)r.set(n,i.config)}catch(i){if(t.verbose)console.warn(`Failed to preload ${n}:`,i)}})),r}}class Es{async validateConfiguration(e,t,r={}){let{stopOnFirstError:n=!1,validateRequired:i=!0,validateTypes:o=!0,customRules:s=[],trackPerformance:c=!0,verbose:a=!1}=r,l=async()=>{let u=[],f=[],d={stopOnFirstError:n,validateRequired:i,validateTypes:o,customRules:s,trackPerformance:c,verbose:a};try{if(typeof t==="string")return await this.validateWithSchemaFile(e,t,d);else if(Array.isArray(t))return this.validateWithRules(e,[...t,...s],d);else return this.validateWithJSONSchema(e,t,d)}catch(h){return u.push({path:"",message:`Validation failed: ${h}`,rule:"system"}),{isValid:!1,errors:u,warnings:f}}};if(c)return await Dn.track("validateConfiguration",l);return l()}async validateWithSchemaFile(e,t,r){try{if(!Wd(t))throw new br(t,[{path:"",message:"Schema file does not exist"}]);let n=await import(t),i=n.default||n;if(Array.isArray(i))return this.validateWithRules(e,i,r);else return this.validateWithJSONSchema(e,i,r)}catch(n){throw new br(t,[{path:"",message:`Failed to load schema: ${n}`}])}}validateWithJSONSchema(e,t,r){let n=[],i=[];return this.validateObjectAgainstSchema(e,t,"",n,i,r),{isValid:n.length===0,errors:n,warnings:i}}validateObjectAgainstSchema(e,t,r,n,i,o){if(o.validateTypes&&t.type){let s=Array.isArray(e)?"array":typeof e,c=Array.isArray(t.type)?t.type:[t.type];if(!c.includes(s)){if(n.push({path:r,message:`Expected type ${c.join(" or ")}, got ${s}`,expected:c.join(" or "),actual:s,rule:"type"}),o.stopOnFirstError)return}}if(t.enum&&!t.enum.includes(e)){if(n.push({path:r,message:`Value must be one of: ${t.enum.join(", ")}`,expected:t.enum.join(", "),actual:e,rule:"enum"}),o.stopOnFirstError)return}if(typeof e==="string"){if(t.minLength!==void 0&&e.length<t.minLength)n.push({path:r,message:`String length must be at least ${t.minLength}`,expected:`>= ${t.minLength}`,actual:e.length,rule:"minLength"});if(t.maxLength!==void 0&&e.length>t.maxLength)n.push({path:r,message:`String length must not exceed ${t.maxLength}`,expected:`<= ${t.maxLength}`,actual:e.length,rule:"maxLength"});if(t.pattern){if(!new RegExp(t.pattern).test(e))n.push({path:r,message:`String does not match pattern ${t.pattern}`,expected:t.pattern,actual:e,rule:"pattern"})}}if(typeof e==="number"){if(t.minimum!==void 0&&e<t.minimum)n.push({path:r,message:`Value must be at least ${t.minimum}`,expected:`>= ${t.minimum}`,actual:e,rule:"minimum"});if(t.maximum!==void 0&&e>t.maximum)n.push({path:r,message:`Value must not exceed ${t.maximum}`,expected:`<= ${t.maximum}`,actual:e,rule:"maximum"})}if(Array.isArray(e)&&t.items)for(let s=0;s<e.length;s++){let c=r?`${r}[${s}]`:`[${s}]`;if(this.validateObjectAgainstSchema(e[s],t.items,c,n,i,o),o.stopOnFirstError&&n.length>0)return}if(e&&typeof e==="object"&&!Array.isArray(e)){let s=e;if(o.validateRequired&&t.required){for(let c of t.required)if(!(c in s)){if(n.push({path:r?`${r}.${c}`:c,message:`Missing required property '${c}'`,expected:"required",rule:"required"}),o.stopOnFirstError)return}}if(t.properties){for(let[c,a]of Object.entries(t.properties))if(c in s){let l=r?`${r}.${c}`:c;if(this.validateObjectAgainstSchema(s[c],a,l,n,i,o),o.stopOnFirstError&&n.length>0)return}}if(t.additionalProperties===!1){let c=new Set(Object.keys(t.properties||{}));for(let a of Object.keys(s))if(!c.has(a))i.push({path:r?`${r}.${a}`:a,message:`Additional property '${a}' is not allowed`,rule:"additionalProperties"})}}}validateWithRules(e,t,r){let n=[],i=[];for(let o of t)try{let s=this.getValueByPath(e,o.path),c=this.validateWithRule(s,o,o.path);if(n.push(...c),r.stopOnFirstError&&n.length>0)break}catch(s){n.push({path:o.path,message:`Rule validation failed: ${s}`,rule:"system"})}return{isValid:n.length===0,errors:n,warnings:i}}validateWithRule(e,t,r){let n=[];if(t.required&&(e===void 0||e===null))return n.push({path:r,message:t.message||`Property '${r}' is required`,expected:"required",rule:"required"}),n;if(e===void 0||e===null)return n;if(t.type){let i=Array.isArray(e)?"array":typeof e;if(i!==t.type)n.push({path:r,message:t.message||`Expected type ${t.type}, got ${i}`,expected:t.type,actual:i,rule:"type"})}if(t.min!==void 0){let i=Array.isArray(e)?e.length:typeof e==="string"?e.length:typeof e==="number"?e:0;if(i<t.min)n.push({path:r,message:t.message||`Value must be at least ${t.min}`,expected:`>= ${t.min}`,actual:i,rule:"min"})}if(t.max!==void 0){let i=Array.isArray(e)?e.length:typeof e==="string"?e.length:typeof e==="number"?e:0;if(i>t.max)n.push({path:r,message:t.message||`Value must not exceed ${t.max}`,expected:`<= ${t.max}`,actual:i,rule:"max"})}if(t.pattern&&typeof e==="string"){if(!t.pattern.test(e))n.push({path:r,message:t.message||`Value does not match pattern ${t.pattern}`,expected:t.pattern.toString(),actual:e,rule:"pattern"})}if(t.enum&&!t.enum.includes(e))n.push({path:r,message:t.message||`Value must be one of: ${t.enum.join(", ")}`,expected:t.enum.join(", "),actual:e,rule:"enum"});if(t.validator){let i=t.validator(e);if(i)n.push({path:r,message:t.message||i,rule:"custom"})}return n}getValueByPath(e,t){if(!t)return e;let r=t.split("."),n=e;for(let i of r)if(n&&typeof n==="object"&&i in n)n=n[i];else return;return n}generateRulesFromInterface(e){let t=[],r=e.matchAll(/(\w+)(\?)?:\s*(\w+)/g);for(let n of r){let[,i,o,s]=n;t.push({path:i,required:!o,type:this.mapTypeScriptType(s)})}return t}mapTypeScriptType(e){switch(e.toLowerCase()){case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"array":return"array";case"object":return"object";default:return"object"}}static createCommonRules(){return{server:[{path:"port",required:!0,type:"number",min:1,max:65535},{path:"host",required:!0,type:"string",min:1},{path:"ssl",type:"boolean"}],database:[{path:"url",required:!0,type:"string",min:1},{path:"pool",type:"number",min:1,max:100},{path:"timeout",type:"number",min:0}],api:[{path:"baseUrl",required:!0,type:"string",pattern:Kd},{path:"timeout",type:"number",min:0},{path:"retries",type:"number",min:0,max:10}]}}}function Gd(e){if(!e)return"";let t=Array.isArray(e)?e.filter(Boolean):[e];if(t.length===0)return"";if(t.length===1)return` or alias "${t[0]}"`;return` or aliases ${t.map((r)=>`"${r}"`).join(", ")}`}class As{fileLoader=new Ss;envProcessor=new Hn;validator=new Es;async loadConfig(e){let t=Date.now(),{cache:r,performance:n,schema:i,validate:o,...s}=e;try{if(r?.enabled){let a=this.checkCache(s.name||"",s);if(a)return a}let c;try{c=await this.loadConfigurationStrategies(s,!0,r)}catch(a){if(s.configFile)throw a;let l=s.__strictErrorHandling;if(a instanceof Error&&a.name==="ConfigNotFoundError"){if(l)throw a;c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`No configuration file found for "${s.name||"config"}", using defaults with environment variables`]}}else if(a instanceof Error&&a.name==="ConfigLoadError"){let u=a.message.includes("EACCES")||a.message.includes("EPERM")||a.message.includes("permission denied"),f=!u&&(a.message.includes("syntax")||a.message.includes("Expected")||a.message.includes("Unexpected")||a.message.includes("BuildMessage")||a.message.includes("errors building")),d=a.message.includes("Configuration must export a valid object")||a.message.includes("Configuration file is empty and exports nothing");if(l&&(d||u))throw a;if(f&&(!l||!d))c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:["Configuration file has syntax errors, using defaults with environment variables"]};else if(!l)c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`Configuration loading error, using defaults: ${a.message}`]};else throw a}else c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`Configuration loading failed, using defaults: ${a instanceof Error?a.message:String(a)}`]}}if(i||o)await this.validateConfiguration(c.config,i,o,s.name);if(r?.enabled&&c)this.cacheResult(s.name||"",c,r,s);if(n?.enabled){let a={operation:"loadConfig",duration:Date.now()-t,configName:s.name,timestamp:new Date};if(n.onMetrics)n.onMetrics(a);if(n.slowThreshold&&a.duration>n.slowThreshold)ue.warn(`Slow configuration loading detected: ${a.duration}ms for ${s.name}`);c.metrics=a}return c}catch(c){if(c instanceof Error&&c.name==="ConfigNotFoundError")throw c;let a=Date.now()-t;throw ue.error(`Configuration loading failed after ${a}ms:`,[c instanceof Error?c:Error(String(c))]),c}}async loadConfigurationStrategies(e,t=!1,r){let{name:n="",alias:i,configFile:o,cwd:s,configDir:c,defaultConfig:a,checkEnv:l=!0,arrayStrategy:u="replace",verbose:f=!1}=e,d=s||xr.cwd(),h=[];if(o){let b=pe(d,o);h.push(b);let v=l?bt(n,a,f):a,S=await this.fileLoader.tryLoadFromPaths([b],v,{arrayStrategy:u,verbose:f,cacheTtl:r?.ttl,useCache:!r?.ttl||r.ttl>100});if(!S)throw Ve.configNotFound(n||o,h,i);if(f)ue.success(`Configuration loaded from explicit path: ${b}`);return this.finalizeResult(S,h,l,n,f)}let m=await this.loadLocalConfiguration(n,i,d,c,a,u,f,l,r);if(m)return h.push(...this.getLocalSearchPaths(n,i,d,c)),this.finalizeResult(m,h,l,n,f);let p=await this.loadHomeConfiguration(n,i,a,u,f,l);if(p)return h.push(...this.getHomeSearchPaths(n,i)),this.finalizeResult(p,h,l,n,f);let g=await this.loadPackageJsonConfiguration(n,i,d,a,u,f,l);if(g)return h.push(pe(d,"package.json")),this.finalizeResult(g,h,l,n,f);if(h.push(...this.getAllSearchPaths(n,i,d,c)),t)throw Ve.configNotFound(n,h,i);return{...await this.applyEnvironmentVariables(n,a,l,f),warnings:[`No configuration file found for "${n}"${Gd(i)}, using defaults with environment variables`]}}async loadLocalConfiguration(e,t,r,n,i,o,s,c,a){let l=c?bt(e,i,s):i,u=this.getLocalDirectories(r,n);for(let f of u){if(s)ue.info(`Searching for configuration in: ${f}`);let d=this.fileLoader.generateConfigPaths(e,f,t),h=await this.fileLoader.tryLoadFromPaths(d,l,{arrayStrategy:o,verbose:s,cacheTtl:a?.ttl,useCache:!a?.ttl||a.ttl>100});if(h){if(s)ue.success(`Configuration loaded from: ${h.source.path}`);return h}}return null}async loadHomeConfiguration(e,t,r,n,i,o){if(!e)return null;let s=o?bt(e,r,i):r,c=[pe(qe(),".config",e),pe(qe(),".config"),qe()];for(let a of c){if(i)ue.info(`Checking home directory: ${a}`);let l=this.fileLoader.generateConfigPaths(e,a,t),u=await this.fileLoader.tryLoadFromPaths(l,s,{arrayStrategy:n,verbose:i});if(u){if(i)ue.success(`Configuration loaded from home directory: ${u.source.path}`);return u}}return null}async loadPackageJsonConfiguration(e,t,r,n,i,o,s){let c=s?bt(e,n,o):n;try{let a=pe(r,"package.json");if(!Du(a))return null;let l={};try{l=JSON.parse(ju(a,"utf8"))}catch(d){if(o)ue.warn("Failed to parse package.json:",[d instanceof Error?d:Error(String(d))]);return null}let u=l[e],f=e;if(!u&&t){let d=Array.isArray(t)?t:[t];for(let h of d){if(!h)continue;if(l[h]){u=l[h],f=h;break}}}if(u&&typeof u==="object"&&!Array.isArray(u)){if(o)ue.success(`Configuration loaded from package.json: ${f}`);return{config:ks(c,u,i),source:{type:"package.json",path:a,priority:30,timestamp:new Date}}}}catch(a){if(o)ue.warn("Failed to load package.json:",[a instanceof Error?a:Error(String(a))])}return null}async applyEnvironmentVariables(e,t,r,n){if(!r||!e||typeof t!=="object"||t===null||Array.isArray(t))return{config:t,source:{type:"default",priority:10,timestamp:new Date}};return{config:bt(e,t,n),source:{type:"environment",priority:20,timestamp:new Date}}}async finalizeResult(e,t,r,n,i){return{config:e.config,source:e.source,path:e.source.path}}async validateConfiguration(e,t,r,n){let i=[];if(r){let o=r(e);if(o)i.push(...o)}if(t){let o=await this.validator.validateConfiguration(e,t);if(!o.isValid)i.push(...o.errors.map((s)=>s.path?`${s.path}: ${s.message}`:s.message))}if(i.length>0)throw Ve.configValidation(n||"unknown",i,n)}checkCache(e,t){let r=this.generateCacheKey(e,t);return or.get(r)||null}cacheResult(e,t,r,n){let i=this.generateCacheKey(e,n);or.set(i,t,void 0,r.ttl)}generateCacheKey(e,t){let r=[e];if(t.alias){let n=Array.isArray(t.alias)?t.alias.join(","):t.alias;r.push(`alias:${n}`)}if(t.cwd)r.push(`cwd:${t.cwd}`);if(t.configFile)r.push(`configFile:${t.configFile}`);if(t.configDir)r.push(`configDir:${t.configDir}`);if("checkEnv"in t)r.push(`checkEnv:${t.checkEnv}`);return r.join("|")}getLocalDirectories(e,t){return Fu({cwd:e,configDir:t})}getAllSearchPaths(e,t,r,n){let i=[];return i.push(...this.getLocalSearchPaths(e,t,r,n)),i.push(...this.getHomeSearchPaths(e,t)),i.push(pe(r,"package.json")),i}getLocalSearchPaths(e,t,r,n){let i=this.getLocalDirectories(r,n),o=[];for(let s of i)o.push(...this.fileLoader.generateConfigPaths(e,s,t));return o}getHomeSearchPaths(e,t){if(!e)return[];let r=[pe(qe(),".config",e),pe(qe(),".config"),qe()],n=[];for(let i of r)n.push(...this.fileLoader.generateConfigPaths(e,i,t));return n}async loadConfigWithResult(e){return this.loadConfig(e)}}async function Ts(e){let t="defaultConfig"in e&&e.defaultConfig!==void 0?e.defaultConfig:{},r="cache"in e||"performance"in e||"schema"in e||"validate"in e;try{let n;if(r)n=await kn.loadConfig(e);else n=await kn.loadConfig({...e,defaultConfig:t,cache:{enabled:!0},performance:{enabled:!1}});return n?.config??t}catch(n){if(e.configFile)throw n;let i=n instanceof Error?n.name:"UnknownError",o=n instanceof Error?n.message:String(n);if(!(i==="ConfigNotFoundError"||i==="ConfigLoadError"||i==="ConfigValidationError"||o.includes("config"))&&e.verbose)ue.warn("Unexpected error loading config, using defaults:",[n instanceof Error?n:Error(String(n))]);let c=r?{...e,defaultConfig:t}:{...e,defaultConfig:t,cache:{enabled:!0},performance:{enabled:!1}};if("checkEnv"in e?e.checkEnv!==!1:!0)return(await kn.applyEnvironmentVariables(c.name||"",t,!0,c.verbose||!1))?.config??t;return t}}function bt(e,t,r=!1){let n=new Hn,i=e.toUpperCase().replace(/[^A-Z0-9]/g,"_");function o(s,c=[]){let a={...s};for(let[l,u]of Object.entries(s)){let f=[...c,l],d=[`${i}_${f.join("_").toUpperCase()}`,`${i}_${f.map((p)=>p.toUpperCase()).join("")}`,`${i}_${f.map((p)=>p.replace(/([A-Z])/g,"_$1").toUpperCase()).join("")}`],h,m;for(let p of d)if(h=xr.env[p],h!==void 0){m=p;break}if(h!==void 0&&m)if(typeof u==="boolean")a[l]=["true","1","yes"].includes(h.toLowerCase());else if(typeof u==="number"){let p=Number(h);if(!Number.isNaN(p))a[l]=p}else if(Array.isArray(u))try{a[l]=JSON.parse(h)}catch{a[l]=h.split(",").map((p)=>p.trim())}else a[l]=h;else if(u&&typeof u==="object"&&!Array.isArray(u))a[l]=o(u,f)}return a}return o(t)}var or,Dn,Ho,kf,Sf=(e)=>e,Af=(e,t)=>{for(var r in t)kf(e,r,{get:t[r],enumerable:!0,configurable:!0,set:Ef.bind(t,r)})},Tf=(e,t)=>()=>(e&&(t=e(e=0)),t),Xo,ss,ot,Rt,as,rd,nd,Io,tr,Tn,H,P,id,Po,od,_o,sd,ad,vn,ld,Lo,Mo,wn,cd,ud,fd,dd,rr,ls,hd,q,gd,md,Fo,nr,Nn,z,E,pd,Do,yd,jo,bd,xd,Cn,vd,Bo,Uo,wd,$n,Cd,$d,Rd,kd,Sd,ir,cs,Ed,Ad="0.15.6",ne,gr,Ct,On,In,mr,Pn,_n,$t,Ln,Mn,Pe,us,fs,fe,ke,ds,hs,Td,Od,gs,pr,bw,K,A,xw,Pd,vw,_d,ww,Cw,Vo,$w,Ld,Md,Rw,zo,kw,Sw,Ew,Aw,Tw,Rn,Fd,Nw,de,ps,yr,ys,bs,Gn,xs,vs,br,ws,Cs,Ve,Kd,ue,kn,Lw,Mw;var Ns=jl(()=>{or=new Ko,Dn=new Go,Ho=[".ts",".js",".mjs",".cjs",".json",".mts",".cts"];kf=Object.defineProperty;Xo={};Af(Xo,{withErrorRecovery:()=>es,tryLoadConfig:()=>Zf,loadConfigWithResult:()=>Jf,loadConfig:()=>os,isRetryableError:()=>Wf,isConfigNotFoundError:()=>zf,isBunfigError:()=>ts,globalPerformanceMonitor:()=>Rt,globalCache:()=>ot,getEnvOrDefault:()=>Kf,generateConfigTypes:()=>Qf,defaultGeneratedDir:()=>hs,defaultConfigDir:()=>ds,deepMergeWithArrayStrategy:()=>zn,deepMerge:()=>rs,createLibraryConfig:()=>ed,config:()=>Xf,bunfigPlugin:()=>td,applyEnvVarsToConfig:()=>vt,TypeGenerationError:()=>_n,SchemaValidationError:()=>$t,PluginError:()=>Mn,PerformanceMonitor:()=>Bn,FileSystemError:()=>Pn,ErrorFactory:()=>Pe,EnvVarError:()=>mr,EnvProcessor:()=>vr,ConfigValidator:()=>Wn,ConfigValidationError:()=>On,ConfigNotFoundError:()=>gr,ConfigMergeError:()=>In,ConfigLoader:()=>Kn,ConfigLoadError:()=>Ct,ConfigFileLoader:()=>wr,ConfigCache:()=>jn,CacheUtils:()=>as,BunfigError:()=>ne,BrowserConfigError:()=>Ln,ArrayMergeStrategies:()=>us});Td=Tf(async()=>{ss=import.meta.require,ot=new jn,Rt=new Bn,as={createKey:Nf,isEquivalent:Of,estimateMemoryUsage:If},rd=lr(En.cwd(),"config"),nd=lr(En.cwd(),"src/generated"),Io=ar.env.CLARITY_LOG_DIR||Ku(Lf(),"logs"),tr={level:"info",defaultName:"clarity",timestamp:!0,colors:!0,format:"text",maxLogSize:10485760,logDatePattern:"YYYY-MM-DD",logDirectory:Io,rotation:{frequency:"daily",maxSize:10485760,maxFiles:5,compress:!1,rotateHour:0,rotateMinute:0,rotateDayOfWeek:0,rotateDayOfMonth:1,encrypt:!1},verbose:!1},Tn=await Mf(),H={red:(e)=>`\x1B[31m${e}\x1B[0m`,green:(e)=>`\x1B[32m${e}\x1B[0m`,yellow:(e)=>`\x1B[33m${e}\x1B[0m`,blue:(e)=>`\x1B[34m${e}\x1B[0m`,magenta:(e)=>`\x1B[35m${e}\x1B[0m`,cyan:(e)=>`\x1B[36m${e}\x1B[0m`,white:(e)=>`\x1B[37m${e}\x1B[0m`,gray:(e)=>`\x1B[90m${e}\x1B[0m`,bgRed:(e)=>`\x1B[41m${e}\x1B[0m`,bgYellow:(e)=>`\x1B[43m${e}\x1B[0m`,bold:(e)=>`\x1B[1m${e}\x1B[0m`,dim:(e)=>`\x1B[2m${e}\x1B[0m`,italic:(e)=>`\x1B[3m${e}\x1B[0m`,underline:(e)=>`\x1B[4m${e}\x1B[0m`,reset:"\x1B[0m"},P=H,id=H.red,Po=H.green,od=H.yellow,_o=H.blue,sd=H.magenta,ad=H.cyan,vn=H.white,ld=H.gray,Lo=H.bgRed,Mo=H.bgYellow,wn=H.bold,cd=H.dim,ud=H.italic,fd=H.underline,dd=H.reset,rr={activationLevel:"error",bufferSize:50,flushOnDeactivation:!0,stopBuffering:!1},ls={debug:"\uD83D\uDD0D",info:_o("\u2139"),success:Po("\u2713"),warning:Mo(vn(wn(" WARN "))),error:Lo(vn(wn(" ERROR ")))},hd=new fr("stacks"),q=new fr("bunfig",{showTags:!0}),gd=Z(wt.cwd(),"config"),md=Z(wt.cwd(),"src/generated"),Fo=sr.env.CLARITY_LOG_DIR||zu(Bf(),"logs"),nr={level:"info",defaultName:"clarity",timestamp:!0,colors:!0,format:"text",maxLogSize:10485760,logDatePattern:"YYYY-MM-DD",logDirectory:Fo,rotation:{frequency:"daily",maxSize:10485760,maxFiles:5,compress:!1,rotateHour:0,rotateMinute:0,rotateDayOfWeek:0,rotateDayOfMonth:1,encrypt:!1},verbose:!1,writeToFile:!1},Nn=await Uf(),z={red:(e)=>`\x1B[31m${e}\x1B[0m`,green:(e)=>`\x1B[32m${e}\x1B[0m`,yellow:(e)=>`\x1B[33m${e}\x1B[0m`,blue:(e)=>`\x1B[34m${e}\x1B[0m`,magenta:(e)=>`\x1B[35m${e}\x1B[0m`,cyan:(e)=>`\x1B[36m${e}\x1B[0m`,white:(e)=>`\x1B[37m${e}\x1B[0m`,gray:(e)=>`\x1B[90m${e}\x1B[0m`,bgRed:(e)=>`\x1B[41m${e}\x1B[0m`,bgYellow:(e)=>`\x1B[43m${e}\x1B[0m`,bgGray:(e)=>`\x1B[100m${e}\x1B[0m`,bold:(e)=>`\x1B[1m${e}\x1B[0m`,dim:(e)=>`\x1B[2m${e}\x1B[0m`,italic:(e)=>`\x1B[3m${e}\x1B[0m`,underline:(e)=>`\x1B[4m${e}\x1B[0m`,strikethrough:(e)=>`\x1B[9m${e}\x1B[0m`,reset:"\x1B[0m"},E=z,pd=z.red,Do=z.green,yd=z.yellow,jo=z.blue,bd=z.magenta,xd=z.cyan,Cn=z.white,vd=z.gray,Bo=z.bgRed,Uo=z.bgYellow,wd=z.bgGray,$n=z.bold,Cd=z.dim,$d=z.italic,Rd=z.underline,kd=z.strikethrough,Sd=z.reset,ir={activationLevel:"error",bufferSize:50,flushOnDeactivation:!0,stopBuffering:!1},cs={debug:"\uD83D\uDD0D",info:jo("\u2139"),success:Do("\u2713"),warning:Uo(Cn($n(" WARN "))),error:Bo(Cn($n(" ERROR ")))},Ed=new hr("stacks"),ne=class extends Error{timestamp;context;constructor(t,r={}){super(t);if(this.name=this.constructor.name,this.timestamp=new Date,this.context=r,Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)}toJSON(){return{name:this.name,code:this.code,message:this.message,timestamp:this.timestamp.toISOString(),context:this.context,stack:this.stack}}toString(){let t=Object.keys(this.context).length>0?` (${Object.entries(this.context).map(([r,n])=>`${r}: ${n}`).join(", ")})`:"";return`${this.name} [${this.code}]: ${this.message}${t}`}},gr=class extends ne{code="CONFIG_NOT_FOUND";constructor(t,r,n){let i=n?` or alias "${n}"`:"";super(`Configuration "${t}"${i} not found`,{configName:t,alias:n,searchPaths:r,searchPathCount:r.length})}},Ct=class extends ne{code="CONFIG_LOAD_ERROR";constructor(t,r,n){super(`Failed to load configuration from "${t}": ${r.message}`,{configPath:t,configName:n,originalError:r.name,originalMessage:r.message});this.cause=r}},On=class extends ne{code="CONFIG_VALIDATION_ERROR";constructor(t,r,n){super(`Configuration validation failed for "${t}"`,{configPath:t,configName:n,validationErrors:r,errorCount:r.length})}},In=class extends ne{code="CONFIG_MERGE_ERROR";constructor(t,r,n,i){super(`Failed to merge configuration from "${t}" with "${r}": ${n.message}`,{sourcePath:t,targetPath:r,configName:i,originalError:n.name,originalMessage:n.message});this.cause=n}},mr=class extends ne{code="ENV_VAR_ERROR";constructor(t,r,n,i){super(`Failed to parse environment variable "${t}" with value "${r}" as ${n}`,{envKey:t,envValue:r,expectedType:n,configName:i})}},Pn=class extends ne{code="FILE_SYSTEM_ERROR";constructor(t,r,n){super(`File system ${t} failed for "${r}": ${n.message}`,{operation:t,path:r,originalError:n.name,originalMessage:n.message});this.cause=n}},_n=class extends ne{code="TYPE_GENERATION_ERROR";constructor(t,r,n){super(`Failed to generate types from "${t}" to "${r}": ${n.message}`,{configDir:t,outputPath:r,originalError:n.name,originalMessage:n.message});this.cause=n}},$t=class extends ne{code="SCHEMA_VALIDATION_ERROR";constructor(t,r,n){super(`Schema validation failed${n?` for config "${n}"`:""}`,{schemaPath:t,configName:n,validationErrors:r,errorCount:r.length})}},Ln=class extends ne{code="BROWSER_CONFIG_ERROR";constructor(t,r,n,i){super(`Failed to fetch configuration from "${t}": ${r} ${n}`,{endpoint:t,status:r,statusText:n,configName:i})}},Mn=class extends ne{code="PLUGIN_ERROR";constructor(t,r,n){super(`Plugin "${t}" failed during ${r}: ${n.message}`,{pluginName:t,operation:r,originalError:n.name,originalMessage:n.message});this.cause=n}},Pe={configNotFound(e,t,r){return new gr(e,t,r)},configLoad(e,t,r){return new Ct(e,t,r)},configValidation(e,t,r){return new On(e,t,r)},configMerge(e,t,r,n){return new In(e,t,r,n)},envVar(e,t,r,n){return new mr(e,t,r,n)},fileSystem(e,t,r){return new Pn(e,t,r)},typeGeneration(e,t,r){return new _n(e,t,r)},schemaValidation(e,t,r){return new $t(e,t,r)},browserConfig(e,t,r,n){return new Ln(e,t,r,n)},plugin(e,t,r){return new Mn(e,t,r)}},us={replace:"replace",concat:"concat",smart:"smart"},fs=/^https?:\/\//,fe=new hr("bunfig",{showTags:!0}),ke=new Kn,ds=Q(ze.cwd(),"config"),hs=Q(ze.cwd(),"src/generated")});Od=cr.env.CLARITY_LOG_DIR||gf(Nd(),"logs"),gs={level:"info",defaultName:"clarity",timestamp:!0,colors:!0,format:"text",maxLogSize:10485760,logDatePattern:"YYYY-MM-DD",logDirectory:Od,rotation:{frequency:"daily",maxSize:10485760,maxFiles:5,compress:!1,rotateHour:0,rotateMinute:0,rotateDayOfWeek:0,rotateDayOfMonth:1,encrypt:!1},verbose:!1,writeToFile:!1},pr={...gs},bw=(async()=>{try{let{loadConfig:e}=await Td().then(()=>Xo),t=await e({name:"clarity",alias:"logging",defaultConfig:gs,cwd:cr.cwd()});if(t)Object.assign(pr,t)}catch{}return pr})();K={red:(e)=>`\x1B[31m${e}\x1B[0m`,green:(e)=>`\x1B[32m${e}\x1B[0m`,yellow:(e)=>`\x1B[33m${e}\x1B[0m`,blue:(e)=>`\x1B[34m${e}\x1B[0m`,magenta:(e)=>`\x1B[35m${e}\x1B[0m`,cyan:(e)=>`\x1B[36m${e}\x1B[0m`,white:(e)=>`\x1B[37m${e}\x1B[0m`,gray:(e)=>`\x1B[90m${e}\x1B[0m`,bgRed:(e)=>`\x1B[41m${e}\x1B[0m`,bgYellow:(e)=>`\x1B[43m${e}\x1B[0m`,bgGray:(e)=>`\x1B[100m${e}\x1B[0m`,bold:(e)=>`\x1B[1m${e}\x1B[0m`,dim:(e)=>`\x1B[2m${e}\x1B[0m`,italic:(e)=>`\x1B[3m${e}\x1B[0m`,underline:(e)=>`\x1B[4m${e}\x1B[0m`,strikethrough:(e)=>`\x1B[9m${e}\x1B[0m`,reset:"\x1B[0m"},A=K,xw=K.red,Pd=K.green,vw=K.yellow,_d=K.blue,ww=K.magenta,Cw=K.cyan,Vo=K.white,$w=K.gray,Ld=K.bgRed,Md=K.bgYellow,Rw=K.bgGray,zo=K.bold,kw=K.dim,Sw=K.italic,Ew=K.underline,Aw=K.strikethrough,Tw=K.reset,Rn={activationLevel:"error",bufferSize:50,flushOnDeactivation:!0,stopBuffering:!1},Fd={debug:"\uD83D\uDD0D",info:_d("\u2139"),success:Pd("\u2713"),warning:Md(Vo(zo(" WARN "))),error:Ld(Vo(zo(" ERROR ")))};Nw=new Cr("stacks");de=class de extends Error{timestamp;context;constructor(e,t={}){super(e);if(this.name=this.constructor.name,this.timestamp=new Date,this.context=t,Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)}toJSON(){return{name:this.name,code:this.code,message:this.message,timestamp:this.timestamp.toISOString(),context:this.context,stack:this.stack}}toString(){let e=Object.keys(this.context).length>0?` (${Object.entries(this.context).map(([t,r])=>`${t}: ${r}`).join(", ")})`:"";return`${this.name} [${this.code}]: ${this.message}${e}`}};ps=class ps extends de{code="CONFIG_NOT_FOUND";constructor(e,t,r){let n=r===void 0?[]:Array.isArray(r)?r.filter(Boolean):[r],i="";if(n.length===1)i=` or alias "${n[0]}"`;else if(n.length>1)i=` or aliases ${n.map((o)=>`"${o}"`).join(", ")}`;super(`Configuration "${e}"${i} not found`,{configName:e,alias:r,searchPaths:t,searchPathCount:t.length})}};yr=class yr extends de{code="CONFIG_LOAD_ERROR";constructor(e,t,r){super(`Failed to load configuration from "${e}": ${t.message}`,{configPath:e,configName:r,originalError:t.name,originalMessage:t.message});this.cause=t}};ys=class ys extends de{code="CONFIG_VALIDATION_ERROR";constructor(e,t,r){super(`Configuration validation failed for "${e}"`,{configPath:e,configName:r,validationErrors:t,errorCount:t.length})}};bs=class bs extends de{code="CONFIG_MERGE_ERROR";constructor(e,t,r,n){super(`Failed to merge configuration from "${e}" with "${t}": ${r.message}`,{sourcePath:e,targetPath:t,configName:n,originalError:r.name,originalMessage:r.message});this.cause=r}};Gn=class Gn extends de{code="ENV_VAR_ERROR";constructor(e,t,r,n){super(`Failed to parse environment variable "${e}" with value "${t}" as ${r}`,{envKey:e,envValue:t,expectedType:r,configName:n})}};xs=class xs extends de{code="FILE_SYSTEM_ERROR";constructor(e,t,r){super(`File system ${e} failed for "${t}": ${r.message}`,{operation:e,path:t,originalError:r.name,originalMessage:r.message});this.cause=r}};vs=class vs extends de{code="TYPE_GENERATION_ERROR";constructor(e,t,r){super(`Failed to generate types from "${e}" to "${t}": ${r.message}`,{configDir:e,outputPath:t,originalError:r.name,originalMessage:r.message});this.cause=r}};br=class br extends de{code="SCHEMA_VALIDATION_ERROR";constructor(e,t,r){super(`Schema validation failed${r?` for config "${r}"`:""}`,{schemaPath:e,configName:r,validationErrors:t,errorCount:t.length})}};ws=class ws extends de{code="BROWSER_CONFIG_ERROR";constructor(e,t,r,n){super(`Failed to fetch configuration from "${e}": ${t} ${r}`,{endpoint:e,status:t,statusText:r,configName:n})}};Cs=class Cs extends de{code="PLUGIN_ERROR";constructor(e,t,r){super(`Plugin "${e}" failed during ${t}: ${r.message}`,{pluginName:e,operation:t,originalError:r.name,originalMessage:r.message});this.cause=r}};Ve={configNotFound(e,t,r){return new ps(e,t,r)},configLoad(e,t,r){return new yr(e,t,r)},configValidation(e,t,r){return new ys(e,t,r)},configMerge(e,t,r,n){return new bs(e,t,r,n)},envVar(e,t,r,n){return new Gn(e,t,r,n)},fileSystem(e,t,r){return new xs(e,t,r)},typeGeneration(e,t,r){return new vs(e,t,r)},schemaValidation(e,t,r){return new br(e,t,r)},browserConfig(e,t,r,n){return new ws(e,t,r,n)},plugin(e,t,r){return new Cs(e,t,r)}};Kd=/^https?:\/\//;ue=new Cr("bunfig",{showTags:!0});kn=new As;Lw=pe(xr.cwd(),"config"),Mw=pe(xr.cwd(),"src/generated")});import{existsSync as Me,statSync as G0,watch as Fl}from"fs";import{unlink as H0}from"fs/promises";import{dirname as q0,resolve as ui}from"path";import he from"process";var{Glob:Y0}=globalThis.Bun;import{EventEmitter as Bl}from"events";import Ae from"process";import di from"process";import jr from"process";import Et from"process";import ht from"process";import pi from"tty";import Ac,{stdin as fb,stdout as db}from"process";import{existsSync as Pc}from"fs";import Mr from"fs/promises";import yi from"os";import Fr from"path";import Fe from"process";function Dr(e){return e.replace(/[<[].+/,"").trim()}function Ul(e){let t=/<([^>]+)>/g,r=/\[([^\]]+)\]/g,n=[],i=(c)=>{let a=!1,l=c[1];if(l.startsWith("..."))l=l.slice(3),a=!0;else if(l.endsWith("..."))l=l.slice(0,-3),a=!0;return{required:c[0].startsWith("<"),value:l.trim(),variadic:a}},o;while(o=t.exec(e))n.push(i(o));let s;while(s=r.exec(e))n.push(i(s));return n}function Vl(e){let t={alias:{},boolean:[]};for(let[r,n]of e.entries()){if(n.names.length>1)t.alias[n.names[0]]=n.names.slice(1);if(n.isBoolean)if(n.negated){if(!e.some((o,s)=>s!==r&&o.names.some((c)=>n.names.includes(c))&&typeof o.required==="boolean"))t.boolean.push(n.names[0])}else t.boolean.push(n.names[0])}return t}function hi(e){return e.reduce((t,r)=>t.length>=r.length?t:r,"")}function Lr(e,t){return e.length>=t?e:`${e}${" ".repeat(t-e.length)}`}function St(e){return e.replace(/([a-z])-([a-z])/g,(t,r,n)=>r+n.toUpperCase())}function zl(e,t,r){let n=0,i=t.length,o=e,s;for(;n<i;++n)s=o[t[n]],o=o[t[n]]=n===i-1?r:s!=null?s:!!~t[n+1].indexOf(".")||!(+t[n+1]>-1)?{}:[]}function Wl(e,t){for(let r of Object.keys(t)){let n=t[r];if(e[r]===void 0)continue;if(n.shouldTransform){if(e[r]=Array.prototype.concat.call([],e[r]),typeof n.transformFunction==="function")e[r]=e[r].map(n.transformFunction)}}}function Kl(e){let t=/([^\\/]+)$/.exec(e);return t?t[1]:""}function gt(e){return e.split(".").map((t,r)=>r===0?St(t):t).join(".")}class mt extends Error{exitCode=2;isUsageError=!0;usage;constructor(e,t){super(e);if(this.name=this.constructor.name,t!==void 0)this.usage=t;if(typeof Error.captureStackTrace==="function")Error.captureStackTrace(this,this.constructor);else this.stack=Error(e).stack}format(e=!1){if(e&&this.stack)return`${this.message}
|
|
63
|
+
|
|
64
|
+
Stack trace:
|
|
65
|
+
${this.stack}`;return this.message}}function Gl(e){if(e instanceof mt)return!0;return!!e&&typeof e==="object"&&e.name==="ClappError"&&typeof e.message==="string"}function Hl(){let{env:e}=di,{TERM:t,TERM_PROGRAM:r}=e;if(di.platform!=="win32")return t!=="linux";return Boolean(e.WT_SESSION)||Boolean(e.TERMINUS_SUBLIME)||e.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||t==="xterm-256color"||t==="alacritty"||t==="rxvt-unicode"||t==="rxvt-unicode-256color"||e.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var At="\x1B",j=`${At}[`;var gi={to(e,t){if(!t)return`${j}${e+1}G`;return`${j}${t+1};${e+1}H`},move(e,t){let r="";if(e<0)r+=`${j}${-e}D`;else if(e>0)r+=`${j}${e}C`;if(t<0)r+=`${j}${-t}A`;else if(t>0)r+=`${j}${t}B`;return r},up:(e=1)=>`${j}${e}A`,down:(e=1)=>`${j}${e}B`,forward:(e=1)=>`${j}${e}C`,backward:(e=1)=>`${j}${e}D`,nextLine:(e=1)=>`${j}E`.repeat(e),prevLine:(e=1)=>`${j}F`.repeat(e),left:`${j}G`,hide:`${j}?25l`,show:`${j}?25h`,save:`${At}7`,restore:`${At}8`};var rb={screen:`${j}2J`,up:(e=1)=>`${j}1J`.repeat(e),down:(e=1)=>`${j}J`.repeat(e),line:`${j}2K`,lineEnd:`${j}K`,lineStart:`${j}1K`,lines(e){let t="";for(let r=0;r<e;r++)t+=this.line+(r<e-1?gi.up():"");if(e)t+=gi.left;return t}},nb={screen:`${At}c`};function ql(e,t){let r=[];for(let n=0;n<=t.length;n++)r[n]=[n];for(let n=0;n<=e.length;n++)r[0][n]=n;for(let n=1;n<=t.length;n++)for(let i=1;i<=e.length;i++)if(t.charAt(n-1)===e.charAt(i-1))r[n][i]=r[n-1][i-1];else r[n][i]=Math.min(r[n-1][i-1]+1,r[n][i-1]+1,r[n-1][i]+1);return r[t.length][e.length]}function bi(e,t,r=2,n=3){return t.map((i)=>({cmd:i,distance:ql(e,i)})).filter(({distance:i})=>i<=r).sort((i,o)=>i.distance-o.distance).slice(0,n).map(({cmd:i})=>i)}function Yl(e,t={}){let r={_:[]},n=t.alias||{},i=new Set(t.boolean||[]),o={};for(let a of Object.keys(n))for(let l of n[a])o[l]=a;for(let a of i)if(n[a])for(let l of n[a])i.add(l);function s(a,l){if(a===void 0)return l;if(typeof l==="boolean")return l;return Array.isArray(a)?[...a,l]:[a,l]}function c(a,l){let u=o[a]||a,f=s(r[u],l);if(r[u]=f,n[u])for(let d of n[u])r[d]=f;if(o[a]&&n[o[a]])for(let d of n[o[a]])r[d]=f;r[a]=f}for(let a=0;a<e.length;a++){let l=e[a];if(l==="--"){r._.push(...e.slice(a+1));break}if(l.startsWith("--")){let u=l.indexOf("=");if(u!==-1){let f=St(l.slice(2,u)),d=l.slice(u+1);c(f,d)}else{let f=l.slice(2);if(f.startsWith("no-")){let m=St(f.slice(3));c(m,!1);continue}let d=St(f),h=o[d]||d;if(i.has(h)||i.has(d))c(d,!0);else{let m=e[a+1];if(m!==void 0&&!m.startsWith("-"))c(d,m),a++;else c(d,!0)}}}else if(l.startsWith("-")&&l.length>1){let u=l.slice(1);for(let f=0;f<u.length;f++){let d=u[f],h=o[d]||d;if(f===u.length-1&&!i.has(h)&&!i.has(d)){let m=e[a+1];if(m!==void 0&&!m.startsWith("-"))c(d,m),a++;else c(d,!0)}else c(d,!0)}}else r._.push(l)}return r}class xi{rawName;description;name;names;isBoolean;required;config;negated;variadic;constructor(e,t,r){if(this.rawName=e,this.description=t,this.config=Object.assign({},r),e=e.replace(/\.\*/g,""),this.negated=!1,this.variadic=/[<[](?:\.\.\.[^\]>]+|[^\]>]+\.\.\.)[\]>]/.test(e),this.names=Dr(e).split(",").map((n)=>{let i=n.trim().replace(/^-{1,2}/,"");if(i.startsWith("no-"))this.negated=!0,i=i.replace(/^no-/,"");return gt(i)}).sort((n,i)=>n.length>i.length?1:-1),this.name=this.names[this.names.length-1],this.negated&&this.config.default==null)this.config.default=!0;if(e.includes("<"))this.required=!0;else if(e.includes("["))this.required=!1;else this.isBoolean=!0}}var ob=jr.argv,Jl=`${jr.platform}-${jr.arch} bun-v${typeof Bun<"u"?Bun.version:"unknown"}`,mi=Et.argv,Xl=`${Et.platform}-${Et.arch} node-${Et.version}`;class Br{rawName;description;config;cli;options;aliasNames;name;namespace;args;commandAction;usageText;versionNumber;examples;helpCallback;globalCommand;beforeHooks;afterHooks;middleware;constructor(e,t,r,n){this.rawName=e,this.description=t,this.config=r,this.cli=n,this.options=[],this.aliasNames=[],this.name=Dr(e);let i=Dr(e),o=i.indexOf(":");if(o>0)this.namespace=i.substring(0,o),this.name=i.substring(o+1);if(this.args=Ul(e),this.examples=[],this.beforeHooks=[],this.afterHooks=[],this.middleware=[],!r)this.config={}}usage(e){return this.usageText=e,this}allowUnknownOptions(){return this.config.allowUnknownOptions=!0,this}ignoreOptionDefaultValue(){return this.config.ignoreOptionDefaultValue=!0,this}version(e,t="-v, --version"){return this.versionNumber=e,this.option(t,"Display version number"),this}example(e){return this.examples.push(e),this}option(e,t,r){let n=new xi(e,t,r);return this.options.push(n),this}alias(e){return this.aliasNames.push(e),this}action(e){return this.commandAction=e,this}before(e){return this.beforeHooks.push(e),this}after(e){return this.afterHooks.push(e),this}use(e){return this.middleware.push(e),this}isMatched(e){if(this.aliasNames.includes(e))return!0;if(this.namespace)return`${this.namespace}:${this.name}`===e;return this.name===e}get isDefaultCommand(){return this.name===""||this.aliasNames.includes("!")}get isGlobalCommand(){return this instanceof Ur}get displayName(){return this.namespace?`${this.namespace}:${this.name}`:this.name}hasOption(e){let t=gt(e.split(".")[0]);return!!this.options.find((r)=>r.names.some((n)=>gt(n)===t))}outputHelp(){let{name:e,commands:t}=this.cli,{versionNumber:r,options:n,helpCallback:i}=this.cli.globalCommand,o=[{body:`${e}${r?`/${r}`:""}`}];if(o.push({title:"Usage",body:` $ ${e} ${this.usageText||this.rawName}`}),(this.isGlobalCommand||this.isDefaultCommand)&&t.length>0){let l=hi(t.map((m)=>m.rawName)),u=new Map,f=[];for(let m of t)if(m.namespace){if(!u.has(m.namespace))u.set(m.namespace,[]);u.get(m.namespace).push(m)}else f.push(m);let d="";if(f.sort((m,p)=>m.rawName<p.rawName?-1:m.rawName>p.rawName?1:0),f.length>0)d+=f.map((m)=>` ${Lr(m.rawName,l.length)} ${m.description}`).join(`
|
|
66
|
+
`);let h=Array.from(u.keys()).sort();for(let m of h){let p=u.get(m);if(d.length>0)d+=`
|
|
67
|
+
|
|
68
|
+
`;d+=` ${m}:
|
|
69
|
+
`,d+=p.map((g)=>` ${Lr(g.rawName,l.length-2)} ${g.description}`).join(`
|
|
70
|
+
`)}o.push({title:"Commands",body:d}),o.push({body:`Run \`${e} <command> --help\` for command details.`})}let c=new Set(this.options.flatMap((l)=>l.names)),a=this.isGlobalCommand?n:[...this.options,...(n||[]).filter((l)=>!l.names.some((u)=>c.has(u)))];if(!this.isGlobalCommand&&!this.isDefaultCommand)a=a.filter((l)=>l.name!=="version");if(a.length>0){let l=hi(a.map((u)=>u.rawName));o.push({title:"Options",body:a.map((u)=>` ${Lr(u.rawName,l.length)} ${u.description} ${u.config.default===void 0?"":`(default: ${u.config.default})`}`).join(`
|
|
71
|
+
`)})}if(this.examples.length>0)o.push({title:"Examples",body:this.examples.map((l)=>{if(typeof l==="function")return l(e);return l}).join(`
|
|
72
|
+
`)});if(i)o=i(o)||o;console.log(o.map((l)=>l.title?`${l.title}:
|
|
73
|
+
${l.body}`:l.body).join(`
|
|
74
|
+
|
|
75
|
+
`))}outputVersion(){let{name:e}=this.cli,{versionNumber:t}=this.cli.globalCommand;if(t)console.log(`${e}/${t} ${typeof Bun<"u"?Jl:Xl}`)}get usageLine(){return`$ ${this.cli.name} ${this.usageText||this.rawName}`}checkRequiredArgs(){let e=this.args.filter((t)=>t.required).length;if(this.cli.args.length<e){let r=this.args.filter((i)=>i.required).slice(this.cli.args.length),n=r.map((i)=>`<${i.value}>`).join(" ");throw new mt(`Missing required argument${r.length>1?"s":""}: ${n}
|
|
76
|
+
|
|
77
|
+
Run \`${this.cli.name} ${this.rawName} --help\` for usage information.`,this.usageLine)}}checkUnknownOptions(){let{options:e,globalCommand:t}=this.cli;if(!this.config.allowUnknownOptions){for(let r of Object.keys(e))if(r!=="--"&&!this.hasOption(r)&&!t.hasOption(r)){let i=[...t.options,...this.options].flatMap((l)=>l.names),o=gt(r.split(".")[0]),s=r.length>1?`--${r}`:`-${r}`,c=bi(o,i),a=`Unknown option \`${s}\``;if(c.length>0)a+=`
|
|
78
|
+
|
|
79
|
+
Did you mean one of these?`,c.forEach((l)=>{let u=l.length>1?`--${l}`:`-${l}`;a+=`
|
|
80
|
+
\u2022 ${u}`});throw a+=`
|
|
81
|
+
|
|
82
|
+
Run \`${this.cli.name} ${this.rawName} --help\` to see available options.`,new mt(a,this.usageLine)}}}checkOptionValue(){let{options:e,globalCommand:t}=this.cli,r=[...t.options,...this.options];for(let n of r){let i=e[n.name.split(".")[0]];if(n.required){let o=r.some((s)=>s.negated&&s.names.includes(n.name));if(i===!0||i===!1&&!o)throw new mt(`Option \`${n.rawName}\` requires a value.
|
|
83
|
+
|
|
84
|
+
Example: ${this.cli.name} ${this.rawName} ${n.rawName} <value>`,this.usageLine)}}}}class Ur extends Br{constructor(e){super("@@global@@","",{},e)}}var Zl=Br,Te={red:["\x1B[31m","\x1B[39m"],green:["\x1B[32m","\x1B[39m"],blue:["\x1B[34m","\x1B[39m"],yellow:["\x1B[33m","\x1B[39m"],cyan:["\x1B[36m","\x1B[39m"],magenta:["\x1B[35m","\x1B[39m"],white:["\x1B[37m","\x1B[39m"],gray:["\x1B[90m","\x1B[39m"],bgRed:["\x1B[41m","\x1B[49m"],bgGreen:["\x1B[42m","\x1B[49m"],bgBlue:["\x1B[44m","\x1B[49m"],bgYellow:["\x1B[43m","\x1B[49m"],bgCyan:["\x1B[46m","\x1B[49m"],bgMagenta:["\x1B[45m","\x1B[49m"],bold:["\x1B[1m","\x1B[22m"],italic:["\x1B[3m","\x1B[23m"],underline:["\x1B[4m","\x1B[24m"],dim:["\x1B[2m","\x1B[22m"],inverse:["\x1B[7m","\x1B[27m"],hidden:["\x1B[8m","\x1B[28m"],strikethrough:["\x1B[9m","\x1B[29m"]};var ft={primary:"blue",secondary:"cyan",success:"green",warning:"yellow",error:"red",info:"magenta",muted:"gray"};function Ql(){return!0}function ec(){let e={};e.supportsColor=Ql();function t(n,i=[]){let o=n===""?[]:[...i,n],s=function(a){if(!e.supportsColor)return a;let l="",u="";for(let f of o)if(f in ft&&ft[f]in Te){let d=ft[f];l+=Te[d][0],u=Te[d][1]+u}else if(f in Te)l+=Te[f][0],u=Te[f][1]+u;return l+a+u},c=[...Object.keys(Te),...Object.keys(ft)];for(let a of c)if(!(a in s))Object.defineProperty(s,a,{get(){return t(a,o)}});return s}let r=[...Object.keys(Te),...Object.keys(ft)];for(let n of r)if(!(n in e))Object.defineProperty(e,n,{get(){return t(n)}});return e}var dt=ec();class Vr extends Bl{name;commands;globalCommand;matchedCommand;matchedCommandName;rawArgs;args;options;showHelpOnExit;showVersionOnExit;enableDidYouMean=!0;signalHandlersSet=!1;isVerbose=!1;isQuiet=!1;isDebug=!1;isNoInteraction=!1;environment;isDryRun=!1;isForce=!1;useEmoji=!0;theme;isNoCache=!1;constructor(e=""){super();this.name=e,this.commands=[],this.rawArgs=[],this.args=[],this.options={},this.globalCommand=new Ur(this),this.globalCommand.usage("<command> [options]")}handleSignals(e){if(this.signalHandlersSet)return this;let t=async(r)=>{if(console.log(`
|
|
85
|
+
|
|
86
|
+
Received ${r}, cleaning up...`),e)try{await e()}catch(n){console.error("Error during cleanup:",n)}Ae.exit(0)};return Ae.on("SIGINT",()=>t("SIGINT")),Ae.on("SIGTERM",()=>t("SIGTERM")),this.signalHandlersSet=!0,this}didYouMean(e=!0){return this.enableDidYouMean=e,this}verbose(){return this.globalCommand.option("-v, --verbose","Enable verbose output"),this}quiet(){return this.globalCommand.option("-q, --quiet","Suppress non-essential output"),this}debug(){return this.globalCommand.option("--debug","Enable debug mode with detailed error information"),this}noInteraction(){return this.globalCommand.option("-n, --no-interaction","Do not ask any interactive questions (for CI/CD)"),this}env(){return this.globalCommand.option("--env <environment>","Target environment (e.g., production, staging, local)"),this}dryRun(){return this.globalCommand.option("--dry-run","Preview actions without executing them"),this}force(){return this.globalCommand.option("-f, --force","Skip confirmation prompts"),this}emoji(){return this.globalCommand.option("--no-emoji","Disable emoji in output"),this}themes(){return this.globalCommand.option("--theme <theme>","Color theme (default, dracula, nord, solarized, monokai)"),this}cache(){return this.globalCommand.option("--no-cache","Disable caching"),this}usage(e){return this.globalCommand.usage(e),this}command(e,t,r){if(!r)r={};let n=new Zl(e,t||"",r,this);return n.globalCommand=this.globalCommand,this.commands.push(n),n}option(e,t,r){return this.globalCommand.option(e,t,r),this}help(e){return this.globalCommand.option("-h, --help","Display this message"),this.globalCommand.helpCallback=e,this.showHelpOnExit=!0,this}version(e,t="-v, --version"){return this.globalCommand.version(e,t),this.showVersionOnExit=!0,this}example(e){return this.globalCommand.example(e),this}outputHelp(){if(this.matchedCommand)this.matchedCommand.outputHelp();else this.globalCommand.outputHelp()}outputVersion(){this.globalCommand.outputVersion()}setParsedInfo({args:e,options:t},r,n){if(this.args=e,this.options=t,r)this.matchedCommand=r;if(n)this.matchedCommandName=n;return this}unsetMatchedCommand(){this.matchedCommand=void 0,this.matchedCommandName=void 0}showCommandNotFound(e){if(console.log(dt.red(`
|
|
87
|
+
\u2717 Command "${e}" not found.
|
|
88
|
+
`)),this.enableDidYouMean){let t=[];for(let n of this.commands){if(n.displayName)t.push(n.displayName);if(n.aliasNames)t.push(...n.aliasNames)}let r=bi(e,t);if(r.length>0)console.log(dt.yellow("Did you mean one of these?")),r.forEach((n)=>console.log(` ${dt.dim("\u2022")} ${this.name} ${n}`)),console.log("")}console.log(dt.dim("Run"),`${this.name} --help`,dt.dim("to see all available commands")),Ae.exit(1)}async parse(e=mi,t={}){let{run:r=!0,exitOnError:n=!1}=t;if(n)try{return await this.parse(e,{run:r})}catch(a){throw this.handleUsageError(a),a}if(this.rawArgs=e,!this.name)this.name=e[1]?Kl(e[1]):"cli";let i=!0,o=e.slice(2),s=o[0];if(s&&!s.startsWith("-")){for(let a of this.commands)if(a.isMatched(s)){let l=this.mri(o,a);i=!1;let u={...l,args:l.args.slice(1)};this.setParsedInfo(u,a,s),this.emit(`command:${s}`,a);break}if(i){let a=o[1];if(a&&!a.startsWith("-")){let l=`${s}:${a}`;for(let u of this.commands)if(u.isMatched(l)){let f=this.mri(o,u);i=!1;let d={...f,args:f.args.slice(2)};this.setParsedInfo(d,u,l),this.emit(`command:${l}`,u);break}}}}if(i){for(let a of this.commands)if(a.name===""){i=!1;let l=this.mri(o,a);this.setParsedInfo(l,a),this.emit("command:!",a);break}}if(i){let a=this.mri(e.slice(2));this.setParsedInfo(a)}if(this.options.verbose)this.isVerbose=!0;if(this.options.quiet)this.isQuiet=!0;if(this.options.debug)this.isDebug=!0;if(this.options.noInteraction||this.options.interaction===!1)this.isNoInteraction=!0;if(this.options.env)this.environment=String(this.options.env);if(this.options.dryRun)this.isDryRun=!0;if(this.options.force)this.isForce=!0;if(this.options.noEmoji||this.options.emoji===!1)this.useEmoji=!1;if(this.options.theme)this.theme=String(this.options.theme);if(this.options.noCache||this.options.cache===!1)this.isNoCache=!0;if(this.options.help&&this.showHelpOnExit)this.outputHelp(),r=!1,this.unsetMatchedCommand();if(this.options.version&&this.showVersionOnExit&&this.matchedCommandName==null)this.outputVersion(),r=!1,this.unsetMatchedCommand();let c={args:this.args,options:this.options};if(r)await this.runMatchedCommand();if(!this.matchedCommand&&this.args[0]){if(this.emit("command:*"),!(this.listenerCount("command:*")>0))this.showCommandNotFound(this.args[0])}return c}mri(e,t){let r=[...this.globalCommand.options,...t?t.options:[]],n=Vl(r),i=[],o=e.indexOf("--");if(o>-1)i=e.slice(o+1),e=e.slice(0,o);let s=Yl(e,n),c={_:s._};for(let d of Object.keys(s))if(d!=="_")c[gt(d)]=s[d];let a=c._,l={"--":i},u=t&&t.config.ignoreOptionDefaultValue?t.config.ignoreOptionDefaultValue:this.globalCommand.config.ignoreOptionDefaultValue,f=Object.create(null);for(let d of r){if(!u&&d.config.default!==void 0)for(let h of d.names)l[h]=d.config.default;if(Array.isArray(d.config.type)){if(f[d.name]===void 0)f[d.name]={shouldTransform:!0,transformFunction:d.config.type[0]}}}for(let d of Object.keys(c))if(d!=="_"){let h=d.split(".");zl(l,h,c[d]),Wl(l,f)}for(let d of r){if(!d.variadic)continue;for(let h of d.names){let m=l[h];if(m===void 0||Array.isArray(m))continue;if(d.config.default!==void 0&&m===d.config.default)continue;l[h]=[m]}}return{args:a,options:l}}async run(e=mi){return this.parse(e,{run:!0,exitOnError:!0})}handleUsageError(e){if(!Gl(e)||e.isUsageError===!1)return;let t=e.message||"command-line error",r=this.name?`${this.name}: `:"",n=/--help/.test(t)?"":e.usage?`
|
|
89
|
+
Usage: ${e.usage}`:`
|
|
90
|
+
Run \`${this.name??"cli"} --help\` for usage.`;Ae.stderr.write(`${r}${t}${n}
|
|
91
|
+
`),Ae.exit(e.exitCode??2)}async runMatchedCommand(){let{args:e,options:t,matchedCommand:r}=this;if(!r||!r.commandAction)return;r.checkUnknownOptions(),r.checkOptionValue(),r.checkRequiredArgs();let n=[];r.args.forEach((c,a)=>{if(c.variadic)n.push(e.slice(a));else n.push(e[a])}),n.push(t);let i={command:r,args:n,options:t};for(let c of r.beforeHooks)await c(i);let o,s=async()=>{let c=r.commandAction.apply(this,n);if(c instanceof Promise)o=await c;else o=c;return o};if(r.middleware.length>0){let c=0,a=async()=>{if(c<r.middleware.length){let l=r.middleware[c++];await l({...i,next:a})}else await s()};await a()}else await s();for(let c of r.afterHooks)await c(i);return o}removeSignalHandlers(){if(!this.signalHandlersSet)return this;return Ae.removeAllListeners("SIGINT"),Ae.removeAllListeners("SIGTERM"),this.signalHandlersSet=!1,this}destroy(){this.removeSignalHandlers(),this.commands=[],this.rawArgs=[],this.args=[],this.options={},this.matchedCommand=void 0,this.matchedCommandName=void 0,this.removeAllListeners()}}class vi{cache;enabled;cleanupInterval=null;hits=0;misses=0;constructor(){this.cache=new Map,this.enabled=!0,this.startCleanupInterval()}startCleanupInterval(){if(this.cleanupInterval)return;this.cleanupInterval=setInterval(()=>{this.cleanup()},30000),this.cleanupInterval.unref()}stopCleanup(){if(this.cleanupInterval)clearInterval(this.cleanupInterval),this.cleanupInterval=null}isEnabled(){return this.enabled}get(e){if(!this.enabled){this.misses++;return}let t=this.cache.get(e);if(!t){this.misses++;return}if(Date.now()-t.timestamp>t.ttl){this.cache.delete(e),this.misses++;return}return this.hits++,t.value}set(e,t,r=5000){if(!this.enabled)return;this.cache.set(e,{value:t,timestamp:Date.now(),ttl:r})}has(e){if(!this.enabled)return!1;let t=this.cache.get(e);if(!t)return!1;if(Date.now()-t.timestamp>t.ttl)return this.cache.delete(e),!1;return!0}delete(e){this.cache.delete(e)}clear(){this.cache.clear()}disable(){this.enabled=!1,this.clear()}enable(){this.enabled=!0}stats(){return{size:this.cache.size,enabled:this.enabled,hits:this.hits,misses:this.misses}}resetStats(){this.hits=0,this.misses=0}keys(){return Array.from(this.cache.keys())}cleanup(){let e=Date.now();for(let[t,r]of this.cache.entries())if(e-r.timestamp>r.ttl)this.cache.delete(t)}destroy(){this.stopCleanup(),this.clear(),this.resetStats()}}var ab=new vi;function tc(){if("FORCE_COLOR"in ht.env)return ht.env.FORCE_COLOR!=="0";if("NO_COLOR"in ht.env||ht.env.TERM==="dumb")return!1;if(ht.platform==="win32")return!0;return pi.isatty(1)&&pi.isatty(2)}var wi=tc();function F(e,t){if(!wi)return(r)=>r;return(r)=>e+r+t}var rc=F("\x1B[0m","\x1B[0m"),nc=F("\x1B[31m","\x1B[39m"),ic=F("\x1B[32m","\x1B[39m"),oc=F("\x1B[33m","\x1B[39m"),sc=F("\x1B[34m","\x1B[39m"),ac=F("\x1B[35m","\x1B[39m"),lc=F("\x1B[36m","\x1B[39m"),cc=F("\x1B[37m","\x1B[39m"),uc=F("\x1B[90m","\x1B[39m"),fc=F("\x1B[1m","\x1B[22m"),dc=F("\x1B[3m","\x1B[23m"),hc=F("\x1B[4m","\x1B[24m"),gc=F("\x1B[2m","\x1B[22m"),mc=F("\x1B[7m","\x1B[27m"),pc=F("\x1B[8m","\x1B[28m"),yc=F("\x1B[9m","\x1B[29m"),bc=F("\x1B[41m","\x1B[49m"),xc=F("\x1B[42m","\x1B[49m"),vc=F("\x1B[43m","\x1B[49m"),wc=F("\x1B[44m","\x1B[49m"),Cc=F("\x1B[45m","\x1B[49m"),$c=F("\x1B[46m","\x1B[49m"),Rc=F("\x1B[47m","\x1B[49m"),kc=wi,Sc={reset:rc,red:nc,green:ic,yellow:oc,blue:sc,magenta:ac,cyan:lc,white:cc,gray:uc,bold:fc,italic:dc,underline:hc,dim:gc,inverse:mc,hidden:pc,strikethrough:yc,bgRed:bc,bgGreen:xc,bgYellow:vc,bgBlue:wc,bgMagenta:Cc,bgCyan:$c,bgWhite:Rc,isColorSupported:kc},Ec=Sc,Tc=["up","down","left","right","space","enter","cancel"],hb={actions:new Set(Tc),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"}};var gb=Ac.platform.startsWith("win"),mb=Symbol("clapp:cancel");var Nc=Hl();var L=(e,t)=>Nc?e:t,pb=L("\u25C6","*"),yb=L("\u25A0","x"),bb=L("\u25B2","x"),xb=L("\u25C7","o"),vb=L("\u250C","T"),Oc=L("\u2502","|"),wb=L("\u2514","\u2014"),Cb=L("\u25CF",">"),$b=L("\u25CB"," "),Rb=L("\u25FB","[\u2022]"),kb=L("\u25FC","[+]"),Sb=L("\u25FB","[ ]"),Eb=L("\u25AA","\u2022"),Ab=L("\u2500","-"),Tb=L("\u256E","+"),Nb=L("\u251C","+"),Ob=L("\u256F","+"),Ib=L("\u25CF","\u2022"),Pb=L("\u25C6","*"),_b=L("\u25B2","!"),Lb=L("\u25A0","x");var Mb={light:L("\u2500","-"),heavy:L("\u2501","="),block:L("\u2588","#")};function Ic(){return`${Ec.gray(Oc)} `}var Fb=Ic();class Ci{configPath;config=null;events=[];retryCount=0;maxRetries=3;retryDelayMs=1000;constructor(){let e=yi.homedir(),t=Fr.join(e,".config","clapp");this.configPath=Fr.join(t,"telemetry.json")}async isEnabled(){if(Fe.env.DO_NOT_TRACK==="1"||Fe.env.DO_NOT_TRACK==="true")return!1;if(Fe.env.NO_TELEMETRY==="1"||Fe.env.NO_TELEMETRY==="true")return!1;return(await this.loadConfig()).enabled}async enable(){let e=await this.loadConfig();if(e.enabled=!0,!e.userId)e.userId=this.generateUserId();await this.saveConfig(e)}async disable(){let e=await this.loadConfig();e.enabled=!1,await this.saveConfig(e)}async track(e,t){if(!await this.isEnabled())return;let n={event:e,...t,timestamp:Date.now(),platform:yi.platform(),nodeVersion:Fe.version};if(this.events.push(n),this.events.length>=10)await this.send()}async trackCommand(e,t){await this.track("command",{command:e,duration:t})}async trackError(e,t){await this.track("error",{error:e,command:t})}async send(){if(!await this.isEnabled()||this.events.length===0)return!0;try{this.events=[],this.retryCount=0;let t=await this.loadConfig();return t.lastSent=Date.now(),await this.saveConfig(t),!0}catch{if(this.retryCount<this.maxRetries){this.retryCount++;let t=this.retryDelayMs*2**(this.retryCount-1);return await this.sleep(t),this.send()}return this.events=[],this.retryCount=0,!1}}async flush(){if(this.events.length===0)return!0;return this.send()}sleep(e){return new Promise((t)=>setTimeout(t,e))}async status(){let e=await this.loadConfig();return{enabled:e.enabled,doNotTrack:Fe.env.DO_NOT_TRACK==="1"||Fe.env.DO_NOT_TRACK==="true",eventsQueued:this.events.length,lastSent:e.lastSent}}async loadConfig(){if(this.config)return this.config;try{if(Pc(this.configPath)){let e=await Mr.readFile(this.configPath,"utf-8");return this.config=JSON.parse(e),this.config}}catch{}return this.config={enabled:!1},this.config}async saveConfig(e){this.config=e;try{let t=Fr.dirname(this.configPath);await Mr.mkdir(t,{recursive:!0}),await Mr.writeFile(this.configPath,JSON.stringify(e,null,2),"utf-8")}catch{}}generateUserId(){let e=Math.random().toString(36).substring(2,15),t=Date.now().toString(36);return`${e}-${t}`}}var zb=new Ci;var zr="0.3.7";function ge(e){return{prev:null,next:null,data:e}}class oe{head=null;tail=null;cursors=[];allocateCursor(e,t){let r={prev:e,next:t};return this.cursors.push(r),r}releaseCursor(){this.cursors.pop()}updateCursors(e,t,r,n){for(let i of this.cursors){if(i.prev===e)i.prev=t;if(i.next===r)i.next=n}}static createItem(e){return ge(e)}createItem(e){return ge(e)}get isEmpty(){return this.head===null}get first(){return this.head?.data??null}get last(){return this.tail?.data??null}*[Symbol.iterator](){for(let e=this.head;e!=null;e=e.next)yield e.data}fromArray(e){let t=null;this.head=null;for(let r of e){let n=ge(r);if(n.prev=t,t)t.next=n;else this.head=n;t=n}return this.tail=t,this}toArray(){let e=[];for(let t=this.head;t!=null;t=t.next)e.push(t.data);return e}toJSON(){return this.toArray()}forEach(e,t){let r=this.allocateCursor(null,this.head);while(r.next!==null){let n=r.next;r.prev=n,r.next=n.next,e.call(t,n.data,n,this)}this.releaseCursor()}forEachRight(e,t){let r=this.allocateCursor(this.tail,null);while(r.prev!==null){let n=r.prev;r.next=n,r.prev=n.prev,e.call(t,n.data,n,this)}this.releaseCursor()}reduce(e,t){let r=t,n=0;for(let i=this.head;i!=null;i=i.next)r=e(r,i.data,n++,this);return r}some(e){let t=0;for(let r=this.head;r!=null;r=r.next)if(e(r.data,t++,this))return!0;return!1}map(e){let t=new oe,r=null,n=0;for(let i=this.head;i!=null;i=i.next){let o=ge(e(i.data,n++,this));if(o.prev=r,r)r.next=o;else t.head=o;r=o}return t.tail=r,t}filter(e){let t=new oe,r=null,n=0;for(let i=this.head;i!=null;i=i.next)if(e(i.data,n++,this)){let o=ge(i.data);if(o.prev=r,r)r.next=o;else t.head=o;r=o}return t.tail=r,t}clear(){let e=this.head;while(e){let t=e.next;e.prev=null,e.next=null,e=t}this.head=null,this.tail=null}copy(){let e=new oe,t=null;for(let r=this.head;r!=null;r=r.next){let n=ge(r.data);if(n.prev=t,t)t.next=n;else e.head=n;t=n}return e.tail=t,e}prepend(e){return this.insert(e,this.head)}prependData(e){return this.insert(ge(e),this.head)}append(e){return this.insert(e,null)}appendData(e){return this.insert(ge(e),null)}insert(e,t=null){if(t!=null)if(this.updateCursors(t.prev,e,t,e),t.prev===null){if(this.head!==t)throw Error("before doesn't belong to list");this.head=e,t.prev=e,e.next=t,this.updateCursors(null,e,null,null)}else t.prev.next=e,e.prev=t.prev,t.prev=e,e.next=t;else if(this.updateCursors(this.tail,e,null,e),this.tail!==null)this.tail.next=e,e.prev=this.tail,this.tail=e;else this.head=e,this.tail=e;return this}insertData(e,t=null){return this.insert(ge(e),t)}remove(e){if(this.updateCursors(e,e.prev,e,e.next),e.prev!==null)e.prev.next=e.next;else if(this.head===e)this.head=e.next;else throw Error("item doesn't belong to list");if(e.next!==null)e.next.prev=e.prev;else if(this.tail===e)this.tail=e.prev;else throw Error("item doesn't belong to list");return e.prev=null,e.next=null,e}push(e){this.insert(ge(e),null)}pop(){if(this.tail===null)return null;return this.remove(this.tail)}unshift(e){this.prependData(e)}shift(){if(this.head===null)return null;return this.remove(this.head)}prependList(e){return this.insertList(e,this.head)}appendList(e){return this.insertList(e,null)}insertList(e,t=null){if(e.head===null)return this;if(t!==null){if(this.updateCursors(t.prev,e.tail,t,e.head),t.prev!==null)t.prev.next=e.head,e.head.prev=t.prev;else this.head=e.head;t.prev=e.tail,e.tail.next=t}else{if(this.updateCursors(this.tail,e.tail,null,e.head),this.tail!==null)this.tail.next=e.head,e.head.prev=this.tail;else this.head=e.head;this.tail=e.tail}return e.head=null,e.tail=null,this}replace(e,t){if(t instanceof oe)this.insertList(t,e),this.remove(e);else this.insert(t,e),this.remove(e)}}function Y(e){switch(e.type){case"StyleSheet":return te(e.children,"");case"Rule":return`${Y(e.prelude)}{${Y(e.block)}}`;case"Block":return Lc(e.children);case"Atrule":{let t=`@${e.name}`;if(e.prelude){let r=Y(e.prelude);if(r)t+=` ${r}`}if(e.block)t+=`{${Y(e.block)}}`;else t+=";";return t}case"AtrulePrelude":return te(e.children,"");case"SelectorList":return te(e.children,",");case"Selector":return te(e.children,"");case"TypeSelector":return e.name;case"IdSelector":return`#${e.name}`;case"ClassSelector":return`.${e.name}`;case"NestingSelector":return"&";case"AttributeSelector":{let t=`[${e.name.name}`;if(e.matcher&&e.value)if(t+=e.matcher,e.value.type==="String")t+=`"${Wr(e.value.value)}"`;else t+=e.value.name;if(e.flags)t+=` ${e.flags}`;return t+="]",t}case"PseudoClassSelector":return e.children?`:${e.name}(${te(e.children,"")})`:`:${e.name}`;case"PseudoElementSelector":return e.children?`::${e.name}(${te(e.children,"")})`:`::${e.name}`;case"Combinator":return e.name===" "?" ":e.name;case"Declaration":return`${e.property}:${Y(e.value)}${e.important?"!important":""}`;case"DeclarationList":return te(e.children,";");case"Value":return te(e.children,"");case"Identifier":return e.name;case"Number":return e.value;case"Percentage":return`${e.value}%`;case"Dimension":return e.value+e.unit;case"String":return`"${Wr(e.value)}"`;case"Url":return/[\s"'()\\\u0000-\u001F\u007F]/.test(e.value)?`url("${Wr(e.value)}")`:`url(${e.value})`;case"Hash":return`#${e.name}`;case"Operator":return e.value;case"Function":return`${e.name}(${te(e.children,"")})`;case"Parentheses":return`(${te(e.children,"")})`;case"Brackets":return`[${te(e.children,"")}]`;case"Raw":return e.value;case"Comment":return e.value.startsWith("!")?`/*${e.value}*/`:"";case"WhiteSpace":return" ";case"CDO":return"<!--";case"CDC":return"-->";case"AnPlusB":{let t=e.a??"",r=e.b??"";if(t&&r){let n=Number(r);return`${t==="1"?"":t==="-1"?"-":t}n${n>=0?`+${r}`:r}`}if(t)return`${t==="1"?"":t==="-1"?"-":t}n`;return r}case"Ratio":return`${e.left.value}/${e.right.value}`;case"UnicodeRange":return e.value;case"Nth":return e.selector?`${Y(e.nth)} of ${Y(e.selector)}`:Y(e.nth);case"MediaQueryList":return te(e.children,",");case"MediaQuery":return te(e.children,"");case"MediaFeature":{let t=`(${e.name}`;if(e.value)t+=`:${Y(e.value)}`;return t+=")",t}}return""}function te(e,t){let r="",n=!0,i=null,o=e.head;while(o!=null){let s=o.data;if(s.type==="WhiteSpace"){let a=o.next?o.next.data:null;if($i(i)||$i(a)){o=o.next;continue}}let c=Y(s);if(!c){o=o.next;continue}if(!n&&t&&!Fc(i))r+=t;n=!1,r+=c,i=s,o=o.next}return r}function Lc(e){let t="",r=null,n=e.head;while(n!=null){let i=n.data,o=Y(i);if(!o){n=n.next;continue}if(r&&Mc(r,i))t+=";";t+=o,r=i,n=n.next}return t}function Mc(e,t){return e.type==="Declaration"&&t.type!=="Comment"}function $i(e){if(!e||e.type!=="Operator")return!1;let t=e.value;return t===":"||t===","||t==="/"}function Fc(e){if(!e)return!1;return e.type==="Operator"||e.type==="Combinator"}function Wr(e){let t="";for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(n===92)t+="\\\\";else if(n===34)t+="\\\"";else if(n<32||n===127){let i=n.toString(16),o=r+1<e.length?e.charCodeAt(r+1):-1,s=o===32||o===9||o===10||o===12||o===13||o>=48&&o<=57||o>=65&&o<=70||o>=97&&o<=102;t+=`\\${i}${s?" ":""}`}else t+=e[r]}return t}var je=(()=>{let e=new Uint8Array(128);for(let t=0;t<128;t++){let r=0;if(t===32||t===9||t===10||t===12||t===13)r|=1;if(t>=48&&t<=57)r|=2;if(t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102)r|=4;if(t>=65&&t<=90||t>=97&&t<=122||t===95)r|=8;if(t===10||t===12||t===13)r|=16;e[t]=r}return e})();function le(e){return e<128&&(je[e]&2)!==0}function pt(e){return e<128&&(je[e]&4)!==0}function Ri(e){return e>=128||e<128&&(je[e]&8)!==0}function Dc(e){return e===45||e>=128||e<128&&(je[e]&10)!==0}function jc(e){return e>=0&&e<=8||e===11||e>=14&&e<=31||e===127}function Gr(e){return e<128&&(je[e]&16)!==0}function xe(e){return e<128&&(je[e]&1)!==0}function De(e,t){if(e!==92)return!1;if(Gr(t))return!1;return!0}function Kr(e,t,r){if(e===45)return Ri(t)||t===45||De(t,r);if(Ri(e))return!0;if(e===92)return De(e,t);return!1}function Bc(e,t,r){if(e===43||e===45){if(le(t))return!0;if(t===46&&le(r))return!0;return!1}if(e===46)return le(t);return le(e)}class Tt{source;offset=0;types;starts;ends;count=0;_tokens=null;_lineStarts=null;constructor(e){this.source=e;let t=Math.max(64,Math.ceil(e.length/3));this.types=new Uint8Array(t),this.starts=new Uint32Array(t),this.ends=new Uint32Array(t),this.tokenize()}get lineStarts(){if(this._lineStarts==null)this._lineStarts=Uc(this.source);return this._lineStarts}get tokens(){if(this._tokens!=null)return this._tokens;let e=Array.from({length:this.count});for(let t=0;t<this.count;t++)e[t]={type:this.types[t],start:this.starts[t],end:this.ends[t]};return this._tokens=e,e}addToken(e,t,r){if(this.count>=this.types.length)this.grow();this.types[this.count]=e,this.starts[this.count]=t,this.ends[this.count]=r,this.count++}grow(){let t=this.types.length*2,r=new Uint8Array(t);r.set(this.types),this.types=r;let n=new Uint32Array(t);n.set(this.starts),this.starts=n;let i=new Uint32Array(t);i.set(this.ends),this.ends=i}tokenize(){let e=this.source,t=0,r=e.length;while(t<r){let n=e.charCodeAt(t);if(n===47&&e.charCodeAt(t+1)===42){let s=t;t+=2;while(t<r&&!(e.charCodeAt(t)===42&&e.charCodeAt(t+1)===47))t++;t=t<r?t+2:r,this.addToken(25,s,t);continue}if(xe(n)){let s=t;while(t<r&&xe(e.charCodeAt(t)))t++;this.addToken(13,s,t);continue}if(n===34||n===39){t=this.consumeString(n,t);continue}if(n===35){if(t+1<r&&(Dc(e.charCodeAt(t+1))||De(e.charCodeAt(t+1),e.charCodeAt(t+2)))){let s=t;t++,t=this.consumeName(t),this.addToken(4,s,t);continue}this.addToken(9,t,t+1),t++;continue}switch(n){case 40:this.addToken(21,t,t+1),t++;continue;case 41:this.addToken(22,t,t+1),t++;continue;case 91:this.addToken(19,t,t+1),t++;continue;case 93:this.addToken(20,t,t+1),t++;continue;case 123:this.addToken(23,t,t+1),t++;continue;case 125:this.addToken(24,t,t+1),t++;continue;case 44:this.addToken(18,t,t+1),t++;continue;case 58:this.addToken(16,t,t+1),t++;continue;case 59:this.addToken(17,t,t+1),t++;continue}if(n===60&&e.startsWith("!--",t+1)){this.addToken(14,t,t+4),t+=4;continue}if(n===45&&e.startsWith("->",t+1)){this.addToken(15,t,t+3),t+=3;continue}if(n===64){let s=e.charCodeAt(t+1),c=e.charCodeAt(t+2),a=e.charCodeAt(t+3);if(Kr(s,c,a)){let l=t;t++,t=this.consumeName(t),this.addToken(3,l,t);continue}this.addToken(9,t,t+1),t++;continue}let i=e.charCodeAt(t+1),o=e.charCodeAt(t+2);if(Bc(n,i,o)){t=this.consumeNumeric(t);continue}if(Kr(n,i,o)){t=this.consumeIdentLike(t);continue}if(n===92){if(De(n,i)){t=this.consumeIdentLike(t);continue}this.addToken(9,t,t+1),t++;continue}this.addToken(9,t,t+1),t++}this.addToken(0,r,r)}consumeString(e,t){let r=this.source,n=r.length,i=t+1;while(i<n){let o=r.charCodeAt(i);if(o===e)return i++,this.addToken(5,t,i),i;if(Gr(o))return this.addToken(6,t,i),i;if(o===92){let s=r.charCodeAt(i+1);if(Gr(s)){i+=2;continue}if(i+1<n){i=this.consumeEscapeSkip(i+1);continue}}i++}return this.addToken(5,t,i),i}consumeEscapeSkip(e){let t=this.source;if(e>=t.length)return e;let r=t.charCodeAt(e);if(pt(r)){let n=1;e++;while(n<6&&e<t.length&&pt(t.charCodeAt(e)))e++,n++;if(e<t.length&&xe(t.charCodeAt(e)))e++;return e}return e+1}consumeName(e){let t=this.source,r=t.length,n=e;while(n<r){let i=t.charCodeAt(n);if(i<128&&(je[i]&10)!==0){n++;continue}if(i===45){n++;continue}if(i>=128){n++;continue}if(i===92&&De(i,t.charCodeAt(n+1))){n=this.consumeEscapeSkip(n+1);continue}break}return n}consumeNumber(e){let t=this.source,r=e;if(t.charCodeAt(r)===43||t.charCodeAt(r)===45)r++;while(r<t.length&&le(t.charCodeAt(r)))r++;if(t.charCodeAt(r)===46&&le(t.charCodeAt(r+1))){r+=2;while(r<t.length&&le(t.charCodeAt(r)))r++}let n=t.charCodeAt(r);if(n===69||n===101){let i=t.charCodeAt(r+1),o=t.charCodeAt(r+2);if(le(i)){r+=2;while(r<t.length&&le(t.charCodeAt(r)))r++}else if((i===43||i===45)&&le(o)){r+=3;while(r<t.length&&le(t.charCodeAt(r)))r++}}return r}consumeNumeric(e){let t=this.source,r=this.consumeNumber(e),n=t.charCodeAt(r),i=t.charCodeAt(r+1),o=t.charCodeAt(r+2);if(Kr(n,i,o)){let s=this.consumeName(r);return this.addToken(12,e,s),s}if(n===37)return this.addToken(11,e,r+1),r+1;return this.addToken(10,e,r),r}consumeIdentLike(e){let t=this.source,r=this.consumeName(e),n=t.charCodeAt(r);if(n===40&&r-e===3){let i=t.charCodeAt(e)|32,o=t.charCodeAt(e+1)|32,s=t.charCodeAt(e+2)|32;if(i===117&&o===114&&s===108){let c=r+1;while(c<t.length&&xe(t.charCodeAt(c)))c++;let a=t.charCodeAt(c);if(a===34||a===39)return this.addToken(2,e,r+1),r+1;return this.consumeUrl(e,r)}}if(n===40)return this.addToken(2,e,r+1),r+1;return this.addToken(1,e,r),r}consumeUrl(e,t){let r=this.source,n=r.length,i=t+1;while(i<n&&xe(r.charCodeAt(i)))i++;while(i<n){let o=r.charCodeAt(i);if(o===41)return i++,this.addToken(7,e,i),i;if(xe(o)){let s=i;while(i<n&&xe(r.charCodeAt(i)))i++;if(i>=n)return this.addToken(7,e,i),i;if(r.charCodeAt(i)===41)return i++,this.addToken(7,e,i),i;return this.consumeBadUrl(e,s)}if(o===34||o===39||o===40||jc(o))return this.consumeBadUrl(e,i);if(o===92){if(De(o,r.charCodeAt(i+1))){i=this.consumeEscapeSkip(i+1);continue}return this.consumeBadUrl(e,i)}i++}return this.addToken(7,e,i),i}consumeBadUrl(e,t){let r=this.source,n=t;while(n<r.length){let i=r.charCodeAt(n);if(i===41){n++;break}if(i===92&&De(i,r.charCodeAt(n+1))){n=this.consumeEscapeSkip(n+1);continue}n++}return this.addToken(8,e,n),n}locate(e){let t=this.lineStarts,r=0,n=t.length-1;while(r<n){let o=r+n+1>>1;if(t[o]<=e)r=o;else n=o-1}let i=t[r];return{line:r+1,column:e-i+1}}}function Uc(e){let t=[0],r=e.length;for(let n=0;n<r;n++){let i=e.charCodeAt(n);if(i===10)t.push(n+1);else if(i===13){if(e.charCodeAt(n+1)!==10)t.push(n+1)}}return t}function Hr(e,t,r){for(let n=t;n<r;n++)if(e.charCodeAt(n)===92)return Vc(e,t,r,n);return e.slice(t,r)}function Vc(e,t,r,n){let i=e.slice(t,n),o=n;while(o<r){if(e.charCodeAt(o)!==92){i+=e[o],o++;continue}if(o+1>=r){o++;continue}let c=e.charCodeAt(o+1);if(c===10){o+=2;continue}if(c===13){o+=e.charCodeAt(o+2)===10?3:2;continue}if(pt(c)){let a=o+1,l="";while(l.length<6&&a<r&&pt(e.charCodeAt(a)))l+=e[a],a++;let u=Number.parseInt(l,16);if(a<r&&xe(e.charCodeAt(a)))a++;i+=u===0||u>=55296&&u<=57343||u>1114111?String.fromCodePoint(65533):String.fromCodePoint(u),o=a;continue}i+=e[o+1],o+=2}return i}function qr(e,t,r){for(let n=t;n<r;n++)if(e.charCodeAt(n)===92)return zc(e,t,r,n);return e.slice(t,r)}function zc(e,t,r,n){let i=e.slice(t,n),o=n;while(o<r){if(e.charCodeAt(o)!==92){i+=e[o],o++;continue}let c=o+1,a="";while(a.length<6&&c<r&&pt(e.charCodeAt(c)))a+=e[c],c++;if(a.length>0){let l=Number.parseInt(a,16);if(c<r&&xe(e.charCodeAt(c)))c++;i+=l===0||l>=55296&&l<=57343||l>1114111?String.fromCodePoint(65533):String.fromCodePoint(l),o=c;continue}if(c<r){i+=e[c],o=c+1;continue}i+=String.fromCodePoint(65533),o=c}return i}function Oi(e,t){let r=new Tt(e);return{source:e,types:r.types,starts:r.starts,ends:r.ends,count:r.count,end:r.count,pos:0,positions:t.positions??!1,filename:t.filename,parseValue:t.parseValue??!0,parseAtrulePrelude:t.parseAtrulePrelude??!0,parseCustomProperty:t.parseCustomProperty??!1,parseRulePrelude:t.parseRulePrelude??!0,onParseError:t.onParseError,tokenizer:r}}function x(e){return e.pos<e.end?e.types[e.pos]:0}function w(e){let t=e.pos;if(t>=e.end)return{type:0,start:e.starts[t]??e.source.length,end:e.ends[t]??e.source.length};return{type:e.types[t],start:e.starts[t],end:e.ends[t]}}function C(e){let t=e.pos++;if(t>=e.end)return{type:0,start:e.starts[t]??e.source.length,end:e.ends[t]??e.source.length};return{type:e.types[t],start:e.starts[t],end:e.ends[t]}}function me(e,t){return e.source.slice(t.start,t.end)}function ce(e){let{types:t,end:r}=e;while(e.pos<r){let n=t[e.pos];if(n===13||n===25)e.pos++;else break}}function ki(e){let{types:t,end:r}=e;while(e.pos<r&&t[e.pos]===13)e.pos++}function k(e,t,r){if(!e.positions)return null;let n=e.tokenizer.locate(t.start),i=e.tokenizer.locate(r.end);return{source:e.filename??"<unknown>",start:{offset:t.start,line:n.line,column:n.column},end:{offset:r.end,line:i.line,column:i.column}}}function Ii(e){if(!e.positions)return null;let t=w(e),r=e.tokenizer.locate(t.start);return{source:e.filename??"<unknown>",start:{offset:t.start,line:r.line,column:r.column},end:{offset:t.start,line:r.line,column:r.column}}}function Nt(e,t,r,n){return{type:"Raw",value:e,loc:k(n,t,r)}}function X(){return new oe}function Yr(e,t,r,n){if(e.onParseError){let{line:i,column:o}=e.tokenizer.locate(r.start),s=SyntaxError(`${e.filename??"<input>"}:${i}:${o}: ${t}`);s.line=i,s.column=o,s.offset=r.start,e.onParseError(s,n)}return n}function It(e,t={}){let r=Oi(e,t);switch(t.context??"stylesheet"){case"stylesheet":return Ai(r);case"atrule":return Pt(r)??Si(r);case"atrulePrelude":return Hc(r);case"mediaQuery":case"mediaQueryList":return Ei(r);case"rule":return Xr(r);case"selectorList":return en(r);case"selector":return Mi(r);case"block":return Zr(r);case"declarationList":return Jc(r);case"declaration":return Qr(r)??Si(r);case"value":return Xc(r);case"raw":return Ei(r);default:return Ai(r)}}function Si(e){return{type:"StyleSheet",children:X(),loc:Ii(e)}}function Ei(e){let t=w(e),r=t;while(x(e)!==0)r=C(e);return{type:"Raw",value:e.source.slice(t.start,r.end),loc:k(e,t,r)}}function Ai(e){let t=w(e),r=X(),{types:n,end:i}=e;while(e.pos<i){let c=n[e.pos];if(c===13){e.pos++;continue}if(c===25){let u={type:25,start:e.starts[e.pos],end:e.ends[e.pos]},f=Jr(e,u);e.pos++,r.appendData(f);continue}if(c===0)break;if(c===14||c===15){e.pos++;continue}if(c===3){let u=Pt(e);if(u)r.appendData(u);continue}if(c===24){e.pos++;continue}let a=e.pos,l=Xr(e);if(r.appendData(l),e.pos===a)e.pos++}let o=e.end-1,s=o>=0?{type:e.types[o],start:e.starts[o],end:e.ends[o]}:{type:0,start:0,end:0};return{type:"StyleSheet",children:r,loc:k(e,t,s)}}function Jr(e,t){return{type:"Comment",value:e.source.slice(t.start+2,t.end-2),loc:k(e,t,t)}}function Pt(e){let t=w(e);if(t.type!==3)return null;e.pos++;let r=Ot(e.source,t.start+1,t.end);ce(e);let n=e.pos,i=w(e),{types:o,end:s}=e,c=n,a=n;while(c<s){let f=o[c];if(f===0||f===17||f===23)break;if(f!==13&&f!==25)a=c+1;c++}let l=null;if(a>n){let f=e.starts[n],d=e.ends[a-1],h={type:o[a-1],start:e.starts[a-1],end:d},m=e.source.slice(f,d).trim();if(m.length>0)if(e.parseAtrulePrelude)try{let p=e.end;e.end=a,e.pos=n;let g=X();while(x(e)!==0){let y=Be(e);if(y)g.appendData(y)}if(_i(g),e.end=p,e.pos=c,g.isEmpty)l=Nt(m,i,h,e);else l={type:"AtrulePrelude",children:g,loc:null}}catch(p){let g=Nt(m,i,h,e);Yr(e,`Failed to parse @${r} prelude: ${p.message}`,i,g),l=g,e.pos=c}else l=Nt(m,i,h,e),e.pos=c;else e.pos=c}else e.pos=c;let u=null;if(x(e)===17)C(e);else if(x(e)===23)u=Zr(e,Gc.has(r));return{type:"Atrule",name:r,prelude:l,block:u,loc:k(e,t,w(e))}}var Kc=new Set(["is","not","where","has","matches","-moz-any","-webkit-any"]),Gc=new Set(["media","supports","document","layer","container","scope","starting-style","-moz-document","keyframes","-webkit-keyframes","-moz-keyframes","-o-keyframes"]);function Hc(e){let t=w(e),r=X();while(x(e)!==0){if(w(e).type===13){e.pos++;continue}let i=Be(e);if(i)r.appendData(i)}return{type:"AtrulePrelude",children:r,loc:k(e,t,w(e))}}function Xr(e){let t=w(e),r;if(e.parseRulePrelude)r=en(e);else{let i=w(e),o=i;while(x(e)!==0&&x(e)!==23)o=C(e);let s=e.source.slice(i.start,o.end).trim();r=Nt(s,i,o,e)}let n=Zr(e,!0);return{type:"Rule",prelude:r,block:n,loc:k(e,t,w(e))}}function Zr(e,t=!1){let r=w(e);if(x(e)!==23)return{type:"Block",children:X(),loc:Ii(e)};e.pos++;let n=X(),{types:i,end:o}=e;while(e.pos<o){let s=i[e.pos];if(s===24||s===0)break;if(s===13){e.pos++;continue}if(s===25){let a={type:25,start:e.starts[e.pos],end:e.ends[e.pos]};e.pos++,n.appendData(Jr(e,a));continue}if(s===3){let a=Pt(e);if(a)n.appendData(a);continue}if(t&&qc(e,Yc)){let a=Xr(e);n.appendData(a);continue}let c=Qr(e);if(c)n.appendData(c);if(e.pos<o&&i[e.pos]===17)e.pos++}if(x(e)===24)e.pos++;return{type:"Block",children:n,loc:k(e,r,w(e))}}function qc(e,t){let r=e.pos,n=t(e);return e.pos=r,n}function Yc(e){let{types:t,end:r}=e;while(e.pos<r){let n=t[e.pos];if(n===23)return!0;if(n===17||n===24||n===0)return!1;e.pos++}return!1}function Jc(e){let t=w(e),r=X();while(x(e)!==0&&x(e)!==24){let n=w(e);if(n.type===13){e.pos++;continue}if(n.type===25){r.appendData(Jr(e,C(e)));continue}if(n.type===17){e.pos++;continue}if(n.type===3){let o=Pt(e);if(o)r.appendData(o);continue}let i=Qr(e);if(i)r.appendData(i);if(x(e)===17)C(e)}return{type:"DeclarationList",children:r,loc:k(e,t,w(e))}}function Qr(e){ce(e);let t=w(e);if(t.type!==1&&t.type!==4&&!(t.type===9&&e.source[t.start]==="*"&&e.source[t.start+1]===" "))if(t.type===9&&e.source[t.start]==="*")e.pos++;else{Yr(e,"Expected property name",t,{type:"Raw",value:"",loc:null});let{types:R,end:I}=e;while(e.pos<I){let _=R[e.pos];if(_===0||_===17||_===24)break;e.pos++}return null}let r=e.starts[e.pos],n=e.ends[e.pos];e.pos++;let i=e.source.slice(r,n);if(ki(e),x(e)!==16){Yr(e,`Expected ':' after property "${i}"`,w(e),{type:"Raw",value:"",loc:null});let{types:R,end:I}=e;while(e.pos<I){let _=R[e.pos];if(_===0||_===17||_===24)break;e.pos++}return null}e.pos++,ki(e);let{types:o,starts:s,end:c,pos:a}=e,l=a,u=a,f=-1,d=-1;while(l<c){let R=o[l];if(R===0||R===17||R===24)break;if(R===9&&e.source.charCodeAt(s[l])===33){let I=l+1;while(I<c&&o[I]===13)I++;if(I<c&&o[I]===1){let _=s[I];if(e.ends[I]-_===9&&(e.source.charCodeAt(_)|32)===105&&(e.source.charCodeAt(_+1)|32)===109&&(e.source.charCodeAt(_+2)|32)===112&&(e.source.charCodeAt(_+3)|32)===111&&(e.source.charCodeAt(_+4)|32)===114&&(e.source.charCodeAt(_+5)|32)===116&&(e.source.charCodeAt(_+6)|32)===97&&(e.source.charCodeAt(_+7)|32)===110&&(e.source.charCodeAt(_+8)|32)===116){d=l,f=I,l=I+1;continue}}}if(R!==13&&R!==25)u=l+1;l++}let h=u,m=f>=0?{type:1,start:s[f],end:e.ends[f]}:null,p=i.startsWith("--"),g,y=s[a],b=h>a?e.ends[h-1]:y,v={type:o[a],start:y,end:e.ends[a]},S=h>a?{type:o[h-1],start:s[h-1],end:b}:v;if(p&&!e.parseCustomProperty||!e.parseValue)g={type:"Raw",value:e.source.slice(y,b).trim(),loc:k(e,v,S)};else if(h===a)g={type:"Value",children:X(),loc:k(e,v,S)};else{let R=e.end;e.end=h,e.pos=a,g=Pi(e),e.end=R}return e.pos=l,{type:"Declaration",property:i,important:m?!0:!1,value:g,loc:k(e,t,w(e))}}function Xc(e){return Pi(e)}function Pi(e){let t=w(e),r=X();while(x(e)!==0&&x(e)!==17&&x(e)!==24&&x(e)!==22&&x(e)!==20){let n=Be(e);if(n)r.appendData(n)}return Li(r),{type:"Value",children:r,loc:k(e,t,w(e))}}function _i(e){for(let t of e)if("children"in t&&t.children instanceof oe)_i(t.children);Li(e)}function Li(e){let t=e.head;while(t){if(t.data.type==="Number"){let r=t.next;while(r&&r.data.type==="WhiteSpace")r=r.next;if(r&&r.data.type==="Operator"&&r.data.value==="/"){let n=r.next;while(n&&n.data.type==="WhiteSpace")n=n.next;if(n&&n.data.type==="Number"){let i={type:"Ratio",left:t.data,right:n.data,loc:null},o=t.next;while(o&&o!==n.next){let s=o.next;e.remove(o),o=s}e.replace(t,e.createItem(i)),t=e.head;continue}}}t=t.next}}function Be(e){let t=e.pos;if(t>=e.end)return null;let r=e.types[t],n=e.starts[t],i=e.ends[t],o=e.source;switch(r){case 13:return e.pos++,e.positions?{type:"WhiteSpace",value:" ",loc:J(e,n,i)}:{type:"WhiteSpace",value:" ",loc:null};case 25:return e.pos++,{type:"Comment",value:o.slice(n+2,i-2),loc:e.positions?J(e,n,i):null};case 10:return e.pos++,{type:"Number",value:o.slice(n,i),loc:e.positions?J(e,n,i):null};case 11:return e.pos++,{type:"Percentage",value:o.slice(n,i-1),loc:e.positions?J(e,n,i):null};case 12:{e.pos++;let s=n,c=o.charCodeAt(s);if(c===43||c===45)s++;let a=!1;while(s<i){let u=o.charCodeAt(s);if(u>=48&&u<=57){s++;continue}if(u===46&&!a){a=!0,s++;continue}break}let l=o.charCodeAt(s);if(l===69||l===101){let u=s+1,f=o.charCodeAt(u);if(f===43||f===45)u++;let d=!1;while(u<i){let h=o.charCodeAt(u);if(h>=48&&h<=57){u++,d=!0;continue}break}if(d)s=u}return{type:"Dimension",value:o.slice(n,s),unit:o.slice(s,i),loc:e.positions?J(e,n,i):null}}case 1:return e.pos++,{type:"Identifier",name:qr(o,n,i),loc:e.positions?J(e,n,i):null};case 5:{e.pos++;let s=n+1,a=i-n>=2&&o.charCodeAt(i-1)===o.charCodeAt(n)?i-1:i;return{type:"String",value:Hr(o,s,a),loc:e.positions?J(e,n,i):null}}case 7:{e.pos++;let s=n+4;while(s<i&&Ti(o.charCodeAt(s)))s++;let c=i;if(c>s&&o.charCodeAt(c-1)===41)c--;while(c>s&&Ti(o.charCodeAt(c-1)))c--;let a;if(c-s>=2){let l=o.charCodeAt(s),u=o.charCodeAt(c-1);if((l===34||l===39)&&l===u)a=o.slice(s+1,c-1);else a=o.slice(s,c)}else a=o.slice(s,c);return{type:"Url",value:a,loc:e.positions?J(e,n,i):null}}case 4:return e.pos++,{type:"Hash",name:o.slice(n+1,i),loc:e.positions?J(e,n,i):null};case 2:return Qc(e);case 21:return eu(e);case 18:return e.pos++,{type:"Operator",value:",",loc:e.positions?J(e,n,i):null};case 16:return e.pos++,{type:"Operator",value:":",loc:e.positions?J(e,n,i):null};case 9:{e.pos++;let s=o.charCodeAt(n),c=o[n];if(Zc(s))return{type:"Operator",value:c,loc:e.positions?J(e,n,i):null};return{type:"Identifier",name:c,loc:e.positions?J(e,n,i):null}}case 19:{e.pos++;let s=X();while(x(e)!==0&&x(e)!==20){let a=Be(e);if(a)s.appendData(a)}let c=e.pos<e.end?e.ends[e.pos]:i;if(x(e)===20)e.pos++;return{type:"Brackets",children:s,loc:e.positions?J(e,n,c):null}}case 3:case 23:case 24:case 22:case 20:case 17:case 0:case 14:case 15:case 6:case 8:return e.pos++,{type:"Raw",value:o.slice(n,i),loc:e.positions?J(e,n,i):null}}return e.pos++,null}function Ti(e){return e===32||e===9||e===10||e===12||e===13}function Zc(e){return e===47||e===43||e===45||e===42||e===61||e===62||e===60||e===126||e===124||e===36||e===94||e===33||e===38}function Ot(e,t,r){for(let n=t;n<r;n++){let i=e.charCodeAt(n);if(i>=65&&i<=90)return e.slice(t,r).toLowerCase()}return e.slice(t,r)}function J(e,t,r){let n=e.tokenizer.locate(t),i=e.tokenizer.locate(r);return{source:e.filename??"<unknown>",start:{offset:t,line:n.line,column:n.column},end:{offset:r,line:i.line,column:i.column}}}function Qc(e){let t=C(e),r=Ot(e.source,t.start,t.end-1),n=X();while(x(e)!==0&&x(e)!==22){let i=Be(e);if(i)n.appendData(i)}if(x(e)===22)C(e);if(r==="url"){for(let i=n.head;i!=null;i=i.next)if(i.data.type==="String")return{type:"Url",value:i.data.value,loc:k(e,t,w(e))}}return{type:"Function",name:r,children:n,loc:k(e,t,w(e))}}function eu(e){let t=C(e),r=X();while(x(e)!==0&&x(e)!==22){let n=Be(e);if(n)r.appendData(n)}if(x(e)===22)C(e);return{type:"Parentheses",children:r,loc:k(e,t,w(e))}}function en(e){let t=w(e),r=X();while(x(e)!==0){if(ce(e),x(e)===0||x(e)===23)break;let n=Mi(e);if(n.children.head!==null)r.appendData(n);if(ce(e),x(e)===18){C(e);continue}break}return{type:"SelectorList",children:r,loc:k(e,t,w(e))}}function Mi(e){let t=w(e),r=X(),n=!0;while(x(e)!==0&&x(e)!==18&&x(e)!==23){let i=w(e);if(i.type===13){if(C(e),!n&&x(e)!==0&&x(e)!==18&&x(e)!==23&&!Ni(e)&&!tu(e)){let s={type:"Combinator",name:" ",loc:k(e,i,i)};r.appendData(s),n=!0}continue}if(i.type===9&&e.source.charCodeAt(i.start)===124&&e.types[e.pos+1]===9&&e.source.charCodeAt(e.starts[e.pos+1])===124){let s=w(e);C(e);let c=C(e),a={type:"Combinator",name:"||",loc:k(e,s,c)};r.appendData(a),n=!0,ce(e);continue}if(Ni(e)){let s=C(e),a={type:"Combinator",name:e.source[s.start],loc:k(e,s,s)};r.appendData(a),n=!0,ce(e);continue}let o=ru(e);if(!o)break;r.appendData(o),n=!1}while(r.tail&&r.tail.data.type==="Combinator")r.remove(r.tail);return{type:"Selector",children:r,loc:k(e,t,w(e))}}function Ni(e){let t=w(e);if(t.type!==9)return!1;let r=e.source[t.start];return r===">"||r==="+"||r==="~"}function tu(e){if(e.types[e.pos]!==9)return!1;if(e.source.charCodeAt(e.starts[e.pos])!==124)return!1;if(e.types[e.pos+1]!==9)return!1;return e.source.charCodeAt(e.starts[e.pos+1])===124}function ru(e){let t=w(e);switch(t.type){case 1:{if(C(e),x(e)===9&&e.source[w(e).start]==="|"&&e.source[w(e).start+1]!=="="&&!(e.types[e.pos+1]===9&&e.source.charCodeAt(e.starts[e.pos+1])===124)){if(C(e),x(e)===1){let n=C(e);return{type:"TypeSelector",name:`${me(e,t)}|${me(e,n)}`,loc:k(e,t,n)}}if(x(e)===9&&e.source[w(e).start]==="*"){let n=C(e);return{type:"TypeSelector",name:`${me(e,t)}|*`,loc:k(e,t,n)}}}return{type:"TypeSelector",name:me(e,t),loc:k(e,t,t)}}case 11:return C(e),{type:"TypeSelector",name:me(e,t),loc:k(e,t,t)};case 10:return C(e),{type:"TypeSelector",name:me(e,t),loc:k(e,t,t)};case 9:{let r=e.source[t.start];if(r==="*")return C(e),{type:"TypeSelector",name:"*",loc:k(e,t,t)};if(r==="."){if(C(e),x(e)===1){let n=C(e);return{type:"ClassSelector",name:me(e,n),loc:k(e,t,n)}}return null}if(r==="&")return C(e),{type:"NestingSelector",loc:k(e,t,t)};return C(e),null}case 4:return C(e),{type:"IdSelector",name:e.source.slice(t.start+1,t.end),loc:k(e,t,t)};case 16:{C(e);let r=x(e)===16;if(r)C(e);return nu(e,r,t)}case 19:return iu(e)}return null}function nu(e,t,r){let n=w(e);if(n.type===1){C(e);let i=Ot(e.source,n.start,n.end);return t?{type:"PseudoElementSelector",name:i,children:null,loc:k(e,r,n)}:{type:"PseudoClassSelector",name:i,children:null,loc:k(e,r,n)}}if(n.type===2){C(e);let i=Ot(e.source,n.start,n.end-1),o=X();if(!t&&Kc.has(i)){let a=w(e),l=a,u=1;while(x(e)!==0&&u>0){if(x(e)===21||x(e)===2)u++;else if(x(e)===22){if(u--,u===0)break}l=C(e)}if(x(e)===22)C(e);let f=e.source.slice(a.start,l.end).trim();if(f.length>0){let d=Oi(f,{positions:!1}),h=en(d);o.appendData(h)}}else{while(x(e)!==0&&x(e)!==22){let a=Be(e);if(a)o.appendData(a)}if(x(e)===22)C(e)}if(t)return{type:"PseudoElementSelector",name:i,children:o,loc:k(e,r,w(e))};return{type:"PseudoClassSelector",name:i,children:o,loc:k(e,r,w(e))}}return null}function iu(e){let t=C(e);ce(e);let r=w(e);if(r.type!==1)return null;C(e);let n={type:"Identifier",name:me(e,r),loc:k(e,r,r)};ce(e);let i=null,o=null,s=null,c=w(e);if(c.type===9){let l=e.source[c.start],u=e.source[c.start+1];if(l==="=")i="=",C(e);else if((l==="~"||l==="|"||l==="^"||l==="$"||l==="*")&&u==="="){C(e);let h=w(e);if(h.type===9&&e.source[h.start]==="=")C(e),i=`${l}=`}ce(e);let f=w(e);if(f.type===5){C(e);let h=f.end-f.start>=2&&e.source.charCodeAt(f.end-1)===e.source.charCodeAt(f.start);o={type:"String",value:Hr(e.source,f.start+1,h?f.end-1:f.end),loc:k(e,f,f)}}else if(f.type===1)C(e),o={type:"Identifier",name:me(e,f),loc:k(e,f,f)};ce(e);let d=w(e);if(d.type===1)C(e),s=me(e,d)}ce(e);let a=w(e);if(x(e)===20)a=C(e);return{type:"AttributeSelector",name:n,matcher:i,value:o,flags:s,loc:k(e,t,a)}}var Fi=Symbol("walkSkip"),B=Symbol("walkStop");function ou(e){return{root:e,stylesheet:null,atrule:null,atrulePrelude:null,rule:null,selector:null,block:null,declaration:null,function:null}}function su(e,t){let r=ou(e),n=typeof t==="function"?t:t.enter,i=typeof t==="function"?null:t.leave??null,o=typeof t==="function"?null:t.visit??null,s=typeof t==="function"?!1:t.reverse??!1;function c(a,l,u){let f=null,d;switch(a.type){case"StyleSheet":f="stylesheet",d=r.stylesheet,r.stylesheet=a;break;case"Atrule":f="atrule",d=r.atrule,r.atrule=a;break;case"AtrulePrelude":f="atrulePrelude",d=r.atrulePrelude,r.atrulePrelude=a;break;case"Rule":f="rule",d=r.rule,r.rule=a;break;case"Selector":f="selector",d=r.selector,r.selector=a;break;case"Block":f="block",d=r.block,r.block=a;break;case"Declaration":f="declaration",d=r.declaration,r.declaration=a;break;case"Function":f="function",d=r.function,r.function=a;break}let h;if((o===null||o===a.type)&&n){let m=n.call(r,a,l,u);if(m===Fi){if(f)r[f]=d;return}if(m===B){if(f)r[f]=d;return B}}if(h=au(a,s,c),h===B){if(f)r[f]=d;return B}if((o===null||o===a.type)&&i){if(i.call(r,a,l,u)===B){if(f)r[f]=d;return B}}if(f)r[f]=d;return}return c(e,null,null)}var Ue=Object.assign(su,{skip:Fi,stop:B});function au(e,t,r){if("children"in e&&e.children instanceof oe)return lu(e.children,t,r);if(e.type==="Rule"){if(r(e.prelude,null,null)===B)return B;if(r(e.block,null,null)===B)return B;return}if(e.type==="Atrule"){if(e.prelude){if(r(e.prelude,null,null)===B)return B}if(e.block){if(r(e.block,null,null)===B)return B}return}if(e.type==="Declaration")return r(e.value,null,null);if(e.type==="AttributeSelector"){if(r(e.name,null,null)===B)return B;if(e.value)return r(e.value,null,null);return}return}function lu(e,t,r){let n;if(t)e.forEachRight((i,o,s)=>{if(n)return;if(r(i,o,s)===B)n=B});else e.forEach((i,o,s)=>{if(n)return;if(r(i,o,s)===B)n=B});return n}function He(e,t={}){let r=t.exclamation??!1,n=!1;Ue(e,(i,o,s)=>{if(i.type!=="Comment")return;let c=i.value.startsWith("!");if(r===!0&&c)return;if(r==="first-exclamation"&&c&&!n){n=!0;return}if(o&&s)s.remove(o)})}function _t(e){Ue(e,(t)=>{if(t.type!=="Block"&&t.type!=="DeclarationList")return;if(!("children"in t)||!t.children)return;let r=t.children,n=r.head;if(n==null||n.next==null)return;let i=0;for(let c=n;c!=null;c=c.next)if(c.data.type==="Declaration"){if(i++,i>=2)break}if(i<2)return;let o=new Map,s=[];for(let c=n;c!=null;c=c.next){let a=c.data;if(a.type!=="Declaration")continue;let l=a.property,u=o.get(l);if(u){let f=!!u.decl.important,d=!!a.important;if(d||f===d)s.push(u.item),o.set(l,{item:c,decl:a});else s.push(c)}else o.set(l,{item:c,decl:a})}for(let c of s)r.remove(c)})}var cu={black:"#000",fuchsia:"#f0f",white:"#fff",red:"#f00",cyan:"#0ff",blue:"#00f",yellow:"#ff0",magenta:"#f0f",lime:"#0f0",silver:"#c0c0c0",gray:"#808080",maroon:"#800000",olive:"#808000",green:"#008000",purple:"#800080",teal:"#008080",navy:"#000080"},uu={"#f00":"red","#ff0000":"red","#000080":"navy","#008080":"teal"};function rn(e){if(!e.startsWith("#"))return e;let t=e.slice(1);if(t.length===6){if(t[0]===t[1]&&t[2]===t[3]&&t[4]===t[5])return`#${t[0]}${t[2]}${t[4]}`}if(t.length===8){if(t[0]===t[1]&&t[2]===t[3]&&t[4]===t[5]&&t[6]===t[7])return`#${t[0]}${t[2]}${t[4]}${t[6]}`}return e}function Di(e){let t=e.toLowerCase();return cu[t]??null}function ji(e){let t=e.toLowerCase();return uu[t]??null}function fu(e,t,r){let n=(e<<16|t<<8|r).toString(16).padStart(6,"0");return rn(`#${n}`)}var du=/^rgba?\(\s*([+-]?\d*\.?\d+%?)\s*[,\s]\s*([+-]?\d*\.?\d+%?)\s*[,\s]\s*([+-]?\d*\.?\d+%?)\s*(?:[,/]\s*([+-]?\d*\.?\d+%?)\s*)?\)$/;function Bi(e){let t=du.exec(e.trim());if(!t)return e;let r=tn(t[1]),n=tn(t[2]),i=tn(t[3]);if(t[4]!==void 0&&!hu(t[4]))return e;return fu(r,n,i)}function hu(e){if(e.endsWith("%"))return Number.parseFloat(e)>=100;return Number.parseFloat(e)>=1}function tn(e){if(e.endsWith("%"))return Math.max(0,Math.min(255,Math.round(Number.parseFloat(e)*2.55)));return Math.max(0,Math.min(255,Math.round(Number.parseFloat(e))))}var gu=new Set(["px","pt","pc","in","cm","mm","q","em","rem","ex","ch","cap","ic","lh","rlh","vw","vh","vi","vb","vmin","vmax","svw","svh","svi","svb","svmin","svmax","lvw","lvh","lvi","lvb","lvmin","lvmax","dvw","dvh","dvi","dvb","dvmin","dvmax","cqw","cqh","cqi","cqb","cqmin","cqmax"]);function Lt(e){if(e.charCodeAt(0)===43)e=e.slice(1);if(e.includes(".")){let t=e.replace(/(\.\d*?)0+($|[eE])/,"$1$2");t=t.replace(/\.($|[eE])/,"$1"),e=t}if(e.startsWith("0.")&&e.length>2)e=e.slice(1);else if(e.startsWith("-0.")&&e.length>3)e=`-${e.slice(2)}`;if(e==="-0"||e==="-.0"||e==="-0.0")e="0";return e}function Ui(e,t){let r=Lt(e);if((r==="0"||r==="-0")&&gu.has(t.toLowerCase()))return{value:"0",unit:""};return{value:r,unit:t}}function Vi(e){return Lt(e)}function zi(e,t){let r=Number.parseFloat(e);if(!Number.isFinite(r))return e;let n=t<0?0:t;return r.toFixed(n)}var Wi=new Set(["color","background","background-color","border","border-color","border-top","border-top-color","border-right","border-right-color","border-bottom","border-bottom-color","border-left","border-left-color","border-block","border-block-color","border-block-start-color","border-block-end-color","border-inline","border-inline-color","border-inline-start-color","border-inline-end-color","outline","outline-color","caret-color","fill","stroke","flood-color","lighting-color","stop-color","column-rule","column-rule-color","text-decoration","text-decoration-color","text-emphasis","text-emphasis-color","text-shadow","box-shadow","accent-color","scrollbar-color"]);function Ki(e){if(!e||e.type!=="Operator")return!1;let t=e.value;return t===":"||t===","||t==="/"}function mu(e){let t=e.children;if(!t)return;while(t.head&&t.head.data.type==="WhiteSpace")t.remove(t.head);while(t.tail&&t.tail.data.type==="WhiteSpace")t.remove(t.tail);let r=t.head;while(r){let n=r.next;if(r.data.type==="WhiteSpace"){let i=r.prev&&Ki(r.prev.data),o=n&&Ki(n.data);if(i||o)t.remove(r)}r=n}}function nn(e,t={}){let r=t.floatPrecision??null,n=r===null?null:(i)=>zi(i,r);Ue(e,{enter(i,o,s){switch(i.type){case"Number":{let c=n?n(i.value):i.value;i.value=Lt(c);return}case"Percentage":{let c=n?n(i.value):i.value;i.value=Vi(c);return}case"Dimension":{let c=n?n(i.value):i.value,a=Ui(c,i.unit);i.value=a.value,i.unit=a.unit;return}case"Hash":{let c=rn(`#${i.name}`).slice(1);if(i.name=c,o&&s&&this.declaration&&Wi.has(this.declaration.property.toLowerCase())){let a=ji(`#${c}`);if(a&&a.length<c.length+1){let l={type:"Identifier",name:a,loc:i.loc};s.replace(o,s.createItem(l))}}return}case"Identifier":{if(!o||!s||!this.declaration)return;if(!Wi.has(this.declaration.property.toLowerCase()))return;let c=Di(i.name);if(c&&c.length<i.name.length){let a={type:"Hash",name:c.slice(1),loc:i.loc};s.replace(o,s.createItem(a))}return}case"Url":return;case"Function":{let c=i.name.toLowerCase();if((c==="rgb"||c==="rgba")&&o&&s)i.__rgbReplaceCandidate=!0}}},leave(i,o,s){if(i.type==="Parentheses"||i.type==="Function"||i.type==="Value")mu(i);if(i.type==="Function"&&i.__rgbReplaceCandidate&&o&&s){let c=Y(i),a=Bi(c);if(a!==c&&a.startsWith("#")){let l={type:"Hash",name:a.slice(1),loc:i.loc};s.replace(o,s.createItem(l))}}}})}function pu(e,t={}){let r=It(e,{context:"stylesheet"});return Gi(r,t)}function on(e,t={}){let r=It(e,{context:"declarationList"});return Gi(r,t)}function Gi(e,t){if(t.comments===!1)He(e,{exclamation:!1});else if(t.comments==="first-exclamation")He(e,{exclamation:"first-exclamation"});else He(e,{exclamation:!0});return nn(e,{floatPrecision:t.floatPrecision??null}),_t(e),{css:Y(e),ast:e}}function Oe(e,t,r){if(e.size>=1e4){let n=e.keys().next().value;if(n!==void 0)e.delete(n)}return e.set(t,r),r}var Hi=new Map,Ne=new Map;var sn={col:"col",row:"row",jc:"justify",ji:"justify-items",js:"justify-self",ai:"items",ac:"content",as:"self",wrap:"wrap",nowrap:"nowrap",c:"center",s:"start",e:"end",sb:"between",sa:"around",se:"evenly",st:"stretch",thin:"thin",extralight:"extralight",light:"light",normal:"normal",medium:"medium",semibold:"semibold",bold:"bold",extrabold:"extrabold",black:"black",t:"top",r:"right",b:"bottom",l:"left"},xu=/[%#()]/,vu=/^\d+(?:\.\d+)?(?:px|rem|em|vh|vw|dvh|dvw|svh|svw|lvh|lvw|ch|ex|lh|cap|ic|rlh|vi|vb|vmin|vmax|cqw|cqh|cqi|cqb|cqmin|cqmax|cm|mm|in|pt|pc|Q)$/,eo=["calc","min","max","clamp","mod","rem","sin","cos","tan","asin","acos","atan","atan2","pow","sqrt","hypot","log","exp","round"],wu=new Set(eo);function re(e){return xu.test(e)||vu.test(e)}function qi(e){if(!eo.some((o)=>e.includes(`${o}(`)))return e;let t="",r=[],n=null,i=null;for(let o=0;o<e.length;o++){let s=e.charCodeAt(o);if(s>=48&&s<=57)n=o;else if(n!==null&&(s===37||s>=97&&s<=122||s>=65&&s<=90))n=o;else i=n,n=null;if(s===40){t+=e[o];let a=o;for(let u=o-1;u>=0;u--){let f=e.charCodeAt(u);if(f>=48&&f<=57||f>=97&&f<=122)a=u;else break}let l=e.slice(a,o);if(wu.has(l))r.unshift(!0);else if(r[0]&&l==="")r.unshift(!0);else r.unshift(!1);continue}if(s===41){t+=e[o],r.shift();continue}if(s===44&&r[0]){t+=", ";continue}if(s===32&&r[0]&&t.charCodeAt(t.length-1)===32)continue;if((s===43||s===45||s===42||s===47)&&r[0]){let a=t.trimEnd(),l=a.charCodeAt(a.length-1),u=a.charCodeAt(a.length-2),f=e.charCodeAt(o+1),d=l===43||l===45||l===42||l===47,h=f===43||f===45||f===42||f===47;if((l===101||l===69)&&u>=48&&u<=57)t+=e[o];else if(d||l===40||l===44)t+=e[o];else if(e.charCodeAt(o-1)===32)t+=`${e[o]} `;else if(l>=48&&l<=57||f>=48&&f<=57||l===41||f===40||h||i!==null&&i===o-1)t+=` ${e[o]} `;else t+=e[o];continue}t+=e[o]}return t}function Mt(e){if(!e.includes("_"))return qi(e);let t="",r=0;while(r<e.length){let n=e[r];if(n==="\\"&&e[r+1]==="_"){t+="_",r+=2;continue}if(n==="u"&&e.slice(r,r+4)==="url("){let i=r,o=1;r+=4;while(r<e.length&&o>0){if(e[r]==="(")o++;else if(e[r]===")")o--;r++}t+=e.slice(i,r);continue}t+=n==="_"?" ":n,r++}return qi(t)}function Yi(e,t){if(t.length!==2)return null;let[r,n]=t;if(r!=="min"&&r!=="max")return null;return[re(n)?`${r}-${e}-[${n}]`:`${r}-${e}-${n}`]}var Cu={flex:{expand:(e,t)=>{let r=t[e]||e;if(["col","row","col-reverse","row-reverse","wrap","nowrap","wrap-reverse"].includes(r))return`flex-${r}`;let n=e.match(/^(jc|ji|js|ai|ac|as)-(.+)$/);if(n){let i=t[n[1]]||n[1],o=t[n[2]]||n[2];return`${i}-${o}`}if(/^\d+$/.test(r)||["grow","shrink","auto","initial","none"].includes(r))return`flex-${r}`;return null}},grid:{expand:(e,t)=>{let r=t[e]||e;if(e.startsWith("cols-")||e.startsWith("rows-"))return`grid-${e}`;if(e.startsWith("flow-"))return`grid-${e}`;if(e.startsWith("gap-"))return e;return null}},text:{expand:(e,t)=>{let r=t[e]||e;if(re(r))return`text-[${r}]`;if(/^\d{3}$/.test(r))return{"100":"font-thin","200":"font-extralight","300":"font-light","400":"font-normal","500":"font-medium","600":"font-semibold","700":"font-bold","800":"font-extrabold","900":"font-black"}[r]||`font-[${r}]`;if(/^[a-z-]+$/i.test(r)&&!["xs","sm","base","lg","xl","2xl","3xl","4xl","5xl","6xl","7xl","8xl","9xl"].includes(r)){if(["white","black","inherit","current","transparent"].includes(r.toLowerCase()))return`text-${r}`;if(["red","blue","green","yellow","purple","pink","gray","slate","zinc","neutral","stone","orange","amber","lime","emerald","teal","cyan","sky","indigo","violet","fuchsia","rose"].includes(r.toLowerCase()))return`text-${r}-500`;return`font-[${r}]`}return`text-${r}`}},font:{expand:(e,t)=>{let r=t[e]||e,n=["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],i=["sans","serif","mono"];if(n.includes(r)||i.includes(r))return`font-${r}`;if(/^\d{3}$/.test(r))return{"100":"font-thin","200":"font-extralight","300":"font-light","400":"font-normal","500":"font-medium","600":"font-semibold","700":"font-bold","800":"font-extrabold","900":"font-black"}[r]||`font-[${r}]`;return`font-[${r}]`}},bg:{expand:(e,t)=>`bg-${t[e]||e}`},w:{expand:(e,t)=>{let r=t[e]||e;if(re(r))return`w-[${r}]`;return`w-${r}`},multiValue:(e)=>Yi("w",e)},h:{expand:(e,t)=>{let r=t[e]||e;if(re(r))return`h-[${r}]`;return`h-${r}`},multiValue:(e)=>Yi("h",e)},p:{expand:(e)=>`p-${e}`},px:{expand:(e)=>`px-${e}`},py:{expand:(e)=>`py-${e}`},pt:{expand:(e)=>`pt-${e}`},pr:{expand:(e)=>`pr-${e}`},pb:{expand:(e)=>`pb-${e}`},pl:{expand:(e)=>`pl-${e}`},m:{expand:(e)=>`m-${e}`},mx:{expand:(e)=>`mx-${e}`},my:{expand:(e)=>`my-${e}`},mt:{expand:(e)=>`mt-${e}`},mr:{expand:(e)=>`mr-${e}`},mb:{expand:(e)=>`mb-${e}`},ml:{expand:(e)=>`ml-${e}`},scroll:{expand:(e)=>{if(["x","y"].includes(e))return null;if(["auto","hidden","scroll","visible"].includes(e))return`overflow-${e}`;return null},multiValue:(e)=>{if(e.length===2){let[t,r]=e;if(["x","y"].includes(t)&&["auto","hidden","scroll","visible"].includes(r))return[`overflow-${t}-${r}`]}return null}},overflow:{expand:(e)=>`overflow-${e}`,multiValue:(e)=>{if(e.length===2){let[t,r]=e;if(["x","y"].includes(t))return[`overflow-${t}-${r}`]}return null}},border:{expand:(e)=>`border-${e}`},rounded:{expand:(e)=>`rounded-${e}`},shadow:{expand:(e)=>`shadow-${e}`},gap:{expand:(e)=>{if(e.startsWith("x-")||e.startsWith("y-"))return`gap-${e}`;return`gap-${e}`}},space:{expand:(e)=>`space-${e}`},opacity:{expand:(e)=>`opacity-${e}`},z:{expand:(e)=>`z-${e}`},inset:{expand:(e,t)=>{let r=t[e]||e;if(r.startsWith("x-")||r.startsWith("y-"))return`inset-${r}`;if(re(r))return`inset-[${r}]`;return`inset-${r}`}},top:{expand:(e)=>re(e)?`top-[${e}]`:`top-${e}`},right:{expand:(e)=>re(e)?`right-[${e}]`:`right-${e}`},bottom:{expand:(e)=>re(e)?`bottom-[${e}]`:`bottom-${e}`},left:{expand:(e)=>re(e)?`left-[${e}]`:`left-${e}`},duration:{expand:(e)=>`duration-${e}`},delay:{expand:(e)=>`delay-${e}`},ease:{expand:(e)=>`ease-${e}`},transition:{expand:(e)=>{if(["all","none","colors","opacity","shadow","transform"].includes(e))return`transition-${e}`;if(/^\d+$/.test(e))return`duration-${e}`;if(["linear","in","out","in-out","ease-linear","ease-in","ease-out","ease-in-out"].includes(e))return e.startsWith("ease-")?e:`ease-${e}`;return`transition-${e}`}},translate:{expand:(e)=>{if(e.startsWith("x-")||e.startsWith("y-")||e.startsWith("z-"))return`translate-${e}`;return`translate-${e}`}},rotate:{expand:(e)=>{if(e.startsWith("x-")||e.startsWith("y-")||e.startsWith("z-"))return`rotate-${e}`;return`rotate-${e}`}},scale:{expand:(e)=>{if(e.startsWith("x-")||e.startsWith("y-")||e.startsWith("z-"))return`scale-${e}`;return`scale-${e}`}},skew:{expand:(e)=>{if(e.startsWith("x-")||e.startsWith("y-"))return`skew-${e}`;return`skew-${e}`}},origin:{expand:(e)=>`origin-${e}`},cursor:{expand:(e)=>`cursor-${e}`},select:{expand:(e)=>`select-${e}`},resize:{expand:(e)=>`resize-${e}`},appearance:{expand:(e)=>`appearance-${e}`},pointer:{expand:(e)=>`pointer-events-${e}`},outline:{expand:(e)=>`outline-${e}`},ring:{expand:(e)=>`ring-${e}`},blur:{expand:(e)=>`blur-${e}`},brightness:{expand:(e)=>`brightness-${e}`},contrast:{expand:(e)=>`contrast-${e}`},grayscale:{expand:(e)=>`grayscale-${e}`},saturate:{expand:(e)=>`saturate-${e}`},sepia:{expand:(e)=>`sepia-${e}`},backdrop:{expand:(e)=>`backdrop-${e}`},aspect:{expand:(e)=>`aspect-${e}`},columns:{expand:(e)=>`columns-${e}`},break:{expand:(e)=>`break-${e}`},object:{expand:(e)=>`object-${e}`},overscroll:{expand:(e)=>`overscroll-${e}`},place:{expand:(e)=>`place-${e}`},items:{expand:(e)=>`items-${e}`},justify:{expand:(e)=>`justify-${e}`},content:{expand:(e)=>`content-${e}`},self:{expand:(e)=>`self-${e}`},order:{expand:(e)=>`order-${e}`},col:{expand:(e)=>`col-${e}`},row:{expand:(e)=>`row-${e}`},tracking:{expand:(e)=>`tracking-${e}`},leading:{expand:(e)=>`leading-${e}`},list:{expand:(e)=>`list-${e}`},decoration:{expand:(e)=>`decoration-${e}`},underline:{expand:(e)=>`underline-${e}`},accent:{expand:(e)=>`accent-${e}`},caret:{expand:(e)=>`caret-${e}`},"scroll-m":{expand:(e)=>`scroll-m-${e}`},"scroll-p":{expand:(e)=>`scroll-p-${e}`},snap:{expand:(e)=>`snap-${e}`},touch:{expand:(e)=>`touch-${e}`},will:{expand:(e)=>`will-change-${e}`},fill:{expand:(e)=>`fill-${e}`},stroke:{expand:(e)=>`stroke-${e}`},sr:{expand:(e)=>`sr-${e}`},invert:{expand:(e)=>`invert-${e}`},"hue-rotate":{expand:(e)=>re(e)?`hue-rotate-[${e}]`:`hue-rotate-${e}`},"drop-shadow":{expand:(e)=>`drop-shadow-${e}`},"backdrop-invert":{expand:(e)=>`backdrop-invert-${e}`},"backdrop-hue-rotate":{expand:(e)=>re(e)?`backdrop-hue-rotate-[${e}]`:`backdrop-hue-rotate-${e}`},animate:{expand:(e)=>`animate-${e}`},"forced-colors":{expand:(e)=>`forced-colors-${e}`}},yt=new Set(["sm","md","lg","xl","2xl","hover","focus","active","visited","disabled","enabled","focus-within","focus-visible","group-hover","group-focus","peer-hover","peer-focus","dark","first","last","odd","even","only","first-of-type","last-of-type","checked","indeterminate","default","required","valid","invalid","in-range","out-of-range","placeholder-shown","autofill","read-only","empty","before","after","selection","marker","file","print","motion-safe","motion-reduce","contrast-more","contrast-less","rtl","ltr","portrait","landscape","@sm","@md","@lg","@xl","@2xl"]),Ji=new WeakMap,Xi=new WeakMap;function $u(e){if(!e)return sn;let t=Ji.get(e);if(!t)t=e.aliases?{...sn,...e.aliases}:sn,Ji.set(e,t);return t}function Ru(e){if(!e?.aliases)return"";let t=Xi.get(e);if(t===void 0)t=JSON.stringify(e.aliases),Xi.set(e,t);return t}function ku(e,t){let r=`${e}:${t?.colonSyntax}:${Ru(t)}`,n=Ne.get(r);if(n)return n;let i=$u(t);if(t?.colonSyntax===!0){let p=e.match(/^([a-z][a-z0-9-]*):([^[\]:]+)$/i);if(p){let[,g,y]=p;if(!yt.has(g)){if(re(y)){let v=[`${g}-[${y}]`];return Oe(Ne,r,v),v}let b=y.startsWith("-")?[`-${g}-${y.slice(1)}`]:[`${g}-${y}`];return Oe(Ne,r,b),b}}}let o="",s=e,c=!1;if(s.startsWith("-"))c=!0,s=s.slice(1);let a=s.match(/^((?:[a-z@][a-z0-9-]*:)+)(.+)$/i);if(a){if(a[1].slice(0,-1).split(":").every((y)=>yt.has(y)))o=a[1],s=a[2]}let l=s.match(/^([a-z][a-z0-9-]*)\[([^\]]*)\]$/i);if(!l||s.includes("-[")){let p=[e];return Oe(Ne,r,p),p}let[,u,f]=l,d=f.split(/\s+/).filter(Boolean);if(d.length===0)return Oe(Ne,r,[]),[];let h=Cu[u.toLowerCase()];if(h?.multiValue){let p=h.multiValue(d,i);if(p){let g=p.map((y)=>`${o}${c?"-":""}${y}`);return Oe(Ne,r,g),g}}if(!h){let p=[];for(let g of d){let y=g.match(/^([a-z@][a-z0-9-]*):(.+)$/i),b="",v=g;if(y&&yt.has(y[1]))b=`${y[1]}:`,v=y[2];let S="";if(v.startsWith("-"))S="-",v=v.slice(1);let R="";if(v.endsWith("!"))R="!",v=v.slice(0,-1);let I=c?"-":"";if(re(v))p.push(`${o}${b}${R}${I}${S}${u}-[${v}]`);else p.push(`${o}${b}${R}${I}${S}${u}-${v}`)}return Oe(Ne,r,p),p}let m=[];for(let p of d){let g=p.match(/^([a-z@][a-z0-9-]*):(.+)$/i),y="",b=p;if(g&&yt.has(g[1]))y=`${g[1]}:`,b=g[2];let v="";if(b.startsWith("-"))v="-",b=b.slice(1);let S="";if(b.endsWith("!"))S="!",b=b.slice(0,-1);let R=h.expand(b,i);if(R){let I=c?"-":"";m.push(`${o}${y}${S}${I}${v}${R}`)}}return Oe(Ne,r,m),m}function Su(e,t){let r=new Set;if(!t?.enabled)return r;let n=t.prefix??"tc-",i=["class","className","style","id","name","type","value","href","src","alt","title","role","for","action","method","target","rel","placeholder","disabled","checked","selected","readonly","required","maxlength","minlength","pattern","autocomplete","autofocus","tabindex","contenteditable","draggable","spellcheck","lang","dir","hidden","slot","part","is","key","ref"],o=t.ignoreAttributes||i,s=(l)=>{let u=l.includes(":")?l.split(":").pop():l;for(let f of o)if(f.endsWith("*")){if(u.startsWith(f.slice(0,-1)))return!0}else if(u===f)return!0;if(u.startsWith("on"))return!0;if(u.startsWith("data-")||u.startsWith("aria-"))return!0;return!1},c=/<([a-z][a-z0-9-]*)\s([^>]*)>/gi,a;while((a=c.exec(e))!==null){let l=a[2],u=/([a-z][a-z0-9-:]*)(?:=["']([^"']*)["'])?(?=\s|$|\/?>)/gi,f;while((f=u.exec(l))!==null){let d=f[1],h=f[2];if(n){if(!d.startsWith(n))continue;d=d.slice(n.length)}if(s(d))continue;let m="",p=d,g=d.match(/^((?:[a-z@][a-z0-9-]*:)+)([a-z][a-z0-9-]*)$/i);if(g){if(g[1].slice(0,-1).split(":").every((v)=>yt.has(v)))m=g[1],p=g[2]}if(h!==void 0){let y=h.split(/\s+/).filter(Boolean);for(let b of y){let v=`${m}${p}-${b}`;if(Zi(v.replace(/^(?:[a-z@][a-z0-9-]*:)+/gi,"")))r.add(v)}}else{let y=`${m}${p}`;if(Zi(p))r.add(y)}}}return r}function Zi(e){if(!e||e.length===0)return!1;return/^[a-z][a-z0-9-/]*(?:-\[[^\]]+\])?$/i.test(e)}function to(e){let t=Hi.get(e);if(t)return t;let r=Ou(e);return r.base=Nu(r),Oe(Hi,e,r),r}var Eu=new Set(["bg","text","border","ring","placeholder","divide","accent","caret","fill","stroke","outline","decoration","shadow","ring-offset","from","via","to"]),Au=/^(.+?)\/(\d+|\[\d*\.?\d+\])$/,Tu=/^(\d+)\/(\d+)$/;function Qi(e){let t=!1;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(n===45){if(!t||r+1>=e.length)return;return[e.slice(0,r),e.slice(r+1)]}if(n>=97&&n<=122){t=!0;continue}return}return}function Nu(e){let t=e.raw;for(let r of e.variants)if(t.startsWith(`${r}:`))t=t.slice(r.length+1);if(e.important){if(t.charCodeAt(0)===33)t=t.slice(1);else if(t.charCodeAt(t.length-1)===33)t=t.slice(0,-1)}return t}function Ou(e){let t=!1,r=e;if(e.startsWith("!"))t=!0,r=e.slice(1);else if(e.endsWith("!")&&e.length>1)t=!0,r=e.slice(0,-1);let n=r.match(/^\[([a-z-]+):(.+)\]$/);if(n)return{raw:e,variants:[],utility:n[1],value:Mt(n[2]),important:t,arbitrary:!0};let i=r.match(/^((?:[a-z-]+:)*)(-?[a-z-]+?)-\[([^\]]+)\]\/\[([^\]]+)\]$/);if(i){let[,g,y,b,v]=i,S=g?g.split(":").filter(Boolean):[],R=y.startsWith("-"),I=R?y.slice(1):y,_=Mt(b);if(R)_=_.startsWith("-")?_:`-${_}`;return{raw:e,variants:S,utility:I,value:`${_}/${v}`,important:t,arbitrary:!0,modifierArbitrary:!0}}let o=r.match(/^((?:[a-z-]+:)*)(-?[a-z-]+?)-\[(.+)\]$/);if(o){let g=o[1],y=g?g.split(":").filter(Boolean):[],b=o[2],v=b.startsWith("-");if(v)b=b.slice(1);let S=Mt(o[3]),R,I=S.match(/^(color|length|url|number|percentage|position|line-width|absolute-size|relative-size|image|angle|time|flex|string|family-name):(.*)/i);if(I)R=I[1].toLowerCase(),S=I[2];if(v)S=S.startsWith("-")?S:`-${S}`;return{raw:e,variants:y,utility:b,value:S,important:t,arbitrary:!0,typeHint:R}}let s=[],c="",a=0;for(let g=0;g<r.length;g++){let y=r[g];if(y==="[")a++;else if(y==="]")a--;if(y===":"&&a===0)s.push(c),c="";else c+=y}s.push(c);let l=s[s.length-1],u=s.slice(0,-1);if(l.startsWith("!")&&l.length>1)t=!0,l=l.slice(1);else if(l.endsWith("!")&&l.length>1)t=!0,l=l.slice(0,-1);if(u.length>0)r=`${u.join(":")}:${l}`;else r=l;if(["inline-block","inline-flex","inline-grid","flex-row","flex-row-reverse","flex-col","flex-col-reverse","flex-wrap","flex-wrap-reverse","flex-nowrap","flex-1","flex-auto","flex-initial","flex-none","flex-grow","flex-shrink"].includes(l))return{raw:e,variants:u,utility:l,value:void 0,important:t,arbitrary:!1};let d=l.match(/^([a-z-]+?)-\[(.+?)\]$/);if(d){let g=Mt(d[2]),y,b=g.match(/^(color|length|url|number|percentage|position|line-width|absolute-size|relative-size|image|angle|time|flex|string|family-name):(.*)/i);if(b)y=b[1].toLowerCase(),g=b[2];return{raw:e,variants:u,utility:d[1],value:g,important:t,arbitrary:!0,typeHint:y}}let h=["inset-x","inset-y","border-t","border-r","border-b","border-l","border-x","border-y","border-s","border-e","grid-cols","grid-rows","grid-flow","auto-cols","auto-rows","col-span","row-span","col-start","col-end","row-start","row-end","translate-x","translate-y","translate-z","scale-x","scale-y","scale-z","rotate-x","rotate-y","rotate-z","skew-x","skew-y","scroll-m","scroll-mx","scroll-my","scroll-mt","scroll-mr","scroll-mb","scroll-ml","scroll-p","scroll-px","scroll-py","scroll-pt","scroll-pr","scroll-pb","scroll-pl","gap-x","gap-y","overflow-x","overflow-y","min-w","max-w","min-h","max-h","space-x","space-y","ring-offset","underline-offset","outline-offset","backdrop-blur","backdrop-brightness","backdrop-contrast","backdrop-grayscale","backdrop-invert","backdrop-saturate","backdrop-sepia","hue-rotate","drop-shadow","mask-clip","flex-grow","flex-shrink","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","perspective-origin","justify-self","form-input","form-textarea","form-select","form-multiselect","form-checkbox","form-radio","mix-blend","bg-blend","line-clamp","border-spacing","border-spacing-x","border-spacing-y","rounded-s","rounded-e","rounded-ss","rounded-se","rounded-es","rounded-ee","rounded-t","rounded-r","rounded-b","rounded-l","rounded-tl","rounded-tr","rounded-bl","rounded-br","border-opacity","ring-opacity","stroke-dasharray","stroke-dashoffset","animate-iteration","animate-duration","animate-delay","text-emphasis-color","text-emphasis","text-shadow","word-spacing","column-gap","column-rule","font-stretch","list-image"];if(l==="divide-x"||l==="divide-y")return{raw:e,variants:u,utility:l,value:void 0,important:t,arbitrary:!1};let m=l.match(/^(divide-[xy])-(.+)$/);if(m)return{raw:e,variants:u,utility:m[1],value:m[2],important:t,arbitrary:!1};for(let g of h)if(l.startsWith(`${g}-`))return{raw:e,variants:u,utility:g,value:l.slice(g.length+1),important:t,arbitrary:!1};if(l.startsWith("-")){let g=l.slice(1);for(let b of h)if(g.startsWith(`${b}-`))return{raw:e,variants:u,utility:b,value:`-${g.slice(b.length+1)}`,important:t,arbitrary:!1};let y=Qi(g);if(y)return{raw:e,variants:u,utility:y[0],value:`-${y[1]}`,important:t,arbitrary:!1};return{raw:e,variants:u,utility:g,value:void 0,important:t,arbitrary:!1}}let p=Qi(l);if(p){let[g,y]=p,b=y.match(Au);if(b&&Eu.has(g))return{raw:e,variants:u,utility:g,value:`${b[1]}/${b[2]}`,important:t,arbitrary:!1};let v=y.match(Tu);if(v)return{raw:e,variants:u,utility:g,value:`${v[1]}/${v[2]}`,important:t,arbitrary:!1};return{raw:e,variants:u,utility:g,value:y,important:t,arbitrary:!1}}return{raw:e,variants:u,utility:l,value:void 0,important:t,arbitrary:!1}}function ro(e,t){if(!e||e.length===0)return!1;if(/^\[[a-z-]+:[^\]]+\]$/i.test(e))return!0;if(t?.enabled&&/^[a-z]+\[[^\]]+\]$/i.test(e))return!0;if(t?.colonSyntax&&/^[a-z]+:[^[\]:]+$/i.test(e))return!0;let r=String.raw`!?-?[a-z][a-z0-9.-]*(?:-\[[^\]]+\])?(?:\/(?:[\w.]+|\[[^\]]+\]))?`;return new RegExp(`^${r}(?::${r})*$`,"i").test(e)}function Dt(e){let t=[],r="",n=0;for(let i of e)if(i==="[")n++,r+=i;else if(i==="]")n--,r+=i;else if(/\s/.test(i)&&n===0){if(r)t.push(r),r=""}else r+=i;if(r)t.push(r);return t}function jt(e,t){let r=new Set,n=[/class(?:Name)?=["']([^"']+)["']/g,/class(?:Name)?=\{["']([^"']+)["']\}/g,/class(?:Name)?=\{`([^`]+)`\}/g];for(let o of n){let s;while((s=o.exec(e))!==null){let c=s[1],a=c.match(/["']([^"']+)["']/g);if(a)for(let f of a){let d=f.replace(/["']/g,""),h=Dt(d);for(let m of h)Ft(r,m,t)}let l=c.replace(/["'`]/g," ").replace(/\$\{[^}]+\}/g," "),u=Dt(l).filter((f)=>ro(f,t?.bracketSyntax));for(let f of u)Ft(r,f,t)}}let i=[/class(?:Name|:list)?=\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,/:class="([^"]*)"/g,/:class='([^']*)'/g,/\bx-class="([^"]*)"/g,/\bx-class='([^']*)'/g];for(let o of i){let s;while((s=o.exec(e))!==null){let c=s[1].match(/["'`]([^"'`]+)["'`]/g);if(c)for(let a of c){let l=a.replace(/["'`]/g,"").replace(/\$\{[^}]+\}/g," ");for(let u of Dt(l))Ft(r,u,t)}}}if(t?.codeStrings?.enabled!==!1)for(let o of Pu(e,t?.bracketSyntax))Ft(r,o,t);if(t?.attributify?.enabled){let o=Su(e,t.attributify);for(let s of o)r.add(s)}return r}function Iu(e,t){if(!/[-:/[]/.test(e))return!1;if(e.startsWith("-")&&!/^-[a-z]/i.test(e))return!1;return ro(e,t)}function Pu(e,t){let r=new Set,n=e.length,i=0;while(i<n){let o=e[i];if(o!=='"'&&o!=="'"&&o!=="`"){i++;continue}let s=_u(e,i),c=o==="`",a=i+1,l="",u=!1;while(a<n){let f=e[a];if(f==="\\"){l+=e[a+1]??"",a+=2;continue}if(f===o){u=!0,a++;break}if(!c&&f===`
|
|
92
|
+
`)break;if(c&&f==="$"&&e[a+1]==="{"){let d=1;a+=2;while(a<n&&d>0){if(e[a]==="{")d++;else if(e[a]==="}")d--;a++}l+=" ";continue}l+=f,a++}if(u){if(s){i=a;continue}for(let f of Dt(l))if(Iu(f,t))r.add(f);i=a}else i++}return r}function _u(e,t){let r=e.lastIndexOf("<",t),n=e.lastIndexOf(">",t);if(r<=n)return!1;let i=e[r+1];if(!i||!/[A-Za-z!/]/.test(i))return!1;let o=t-1;while(o>r&&/\s/.test(e[o]))o--;if(e[o]==="=")return!0;if(e[o]==="{"){o--;while(o>r&&/\s/.test(e[o]))o--;return e[o]==="="}return!1}function Ft(e,t,r){if(r?.bracketSyntax?.enabled){let n=/^[a-z]+\[[^\]]+\]$/i.test(t),i=r.bracketSyntax.colonSyntax&&/^[a-z]+:[^[\]]+$/i.test(t);if(n||i){let o=ku(t,r.bracketSyntax);for(let s of o)e.add(s);return}}e.add(t)}var Bt={getCSS:()=>`
|
|
93
93
|
/*
|
|
94
94
|
! Tailwind CSS Preflight | MIT License | https://tailwindcss.com
|
|
95
95
|
*/
|
|
@@ -352,7 +352,7 @@ video {
|
|
|
352
352
|
[hidden] {
|
|
353
353
|
display: none;
|
|
354
354
|
}
|
|
355
|
-
`.trim()};var $r={content:["./src/**/*.{html,js,ts,jsx,tsx,stx}"],output:"./dist/styles.css",minify:!0,watch:!1,theme:{colors:{inherit:"inherit",current:"currentColor",transparent:"transparent",black:"#000",white:"#fff",slate:{50:"oklch(98.4% 0.003 247.858)",100:"oklch(96.8% 0.007 247.896)",200:"oklch(92.9% 0.013 255.508)",300:"oklch(86.9% 0.022 252.894)",400:"oklch(70.4% 0.04 256.788)",500:"oklch(55.4% 0.046 257.417)",600:"oklch(44.6% 0.043 257.281)",700:"oklch(37.2% 0.044 257.287)",800:"oklch(27.9% 0.041 260.031)",900:"oklch(20.8% 0.042 265.755)",950:"oklch(12.9% 0.042 264.695)"},gray:{50:"oklch(98.5% 0.002 247.839)",100:"oklch(96.7% 0.003 264.542)",200:"oklch(92.8% 0.006 264.531)",300:"oklch(87.2% 0.01 258.338)",400:"oklch(70.7% 0.022 261.325)",500:"oklch(55.1% 0.027 264.364)",600:"oklch(44.6% 0.03 256.802)",700:"oklch(37.3% 0.034 259.733)",800:"oklch(27.8% 0.033 256.848)",900:"oklch(21% 0.034 264.665)",950:"oklch(13% 0.028 261.692)"},zinc:{50:"oklch(98.5% 0 0)",100:"oklch(96.7% 0.001 286.375)",200:"oklch(92% 0.004 286.32)",300:"oklch(87.1% 0.006 286.286)",400:"oklch(70.5% 0.015 286.067)",500:"oklch(55.2% 0.016 285.938)",600:"oklch(44.2% 0.017 285.786)",700:"oklch(37% 0.013 285.805)",800:"oklch(27.4% 0.006 286.033)",900:"oklch(21% 0.006 285.885)",950:"oklch(14.1% 0.005 285.823)"},neutral:{50:"oklch(98.5% 0 0)",100:"oklch(97% 0 0)",200:"oklch(92.2% 0 0)",300:"oklch(87% 0 0)",400:"oklch(70.8% 0 0)",500:"oklch(55.6% 0 0)",600:"oklch(43.9% 0 0)",700:"oklch(37.1% 0 0)",800:"oklch(26.9% 0 0)",900:"oklch(20.5% 0 0)",950:"oklch(14.5% 0 0)"},stone:{50:"oklch(98.5% 0.001 106.423)",100:"oklch(97% 0.001 106.424)",200:"oklch(92.3% 0.003 48.717)",300:"oklch(86.9% 0.005 56.366)",400:"oklch(70.9% 0.01 56.259)",500:"oklch(55.3% 0.013 58.071)",600:"oklch(44.4% 0.011 73.639)",700:"oklch(37.4% 0.01 67.558)",800:"oklch(26.8% 0.007 34.298)",900:"oklch(21.6% 0.006 56.043)",950:"oklch(14.7% 0.004 49.25)"},red:{50:"oklch(97.1% 0.013 17.38)",100:"oklch(93.6% 0.032 17.717)",200:"oklch(88.5% 0.062 18.334)",300:"oklch(80.8% 0.114 19.571)",400:"oklch(70.4% 0.191 22.216)",500:"oklch(63.7% 0.237 25.331)",600:"oklch(57.7% 0.245 27.325)",700:"oklch(50.5% 0.213 27.518)",800:"oklch(44.4% 0.177 26.899)",900:"oklch(39.6% 0.141 25.723)",950:"oklch(25.8% 0.092 26.042)"},orange:{50:"oklch(98% 0.016 73.684)",100:"oklch(95.4% 0.038 75.164)",200:"oklch(90.1% 0.076 70.697)",300:"oklch(83.7% 0.128 66.29)",400:"oklch(75% 0.183 55.934)",500:"oklch(70.5% 0.213 47.604)",600:"oklch(64.6% 0.222 41.116)",700:"oklch(55.3% 0.195 38.402)",800:"oklch(47% 0.157 37.304)",900:"oklch(40.8% 0.123 38.172)",950:"oklch(26.6% 0.079 36.259)"},amber:{50:"oklch(98.7% 0.022 95.277)",100:"oklch(96.2% 0.059 95.617)",200:"oklch(92.4% 0.12 95.746)",300:"oklch(87.9% 0.169 91.605)",400:"oklch(82.8% 0.189 84.429)",500:"oklch(76.9% 0.188 70.08)",600:"oklch(66.6% 0.179 58.318)",700:"oklch(55.5% 0.163 48.998)",800:"oklch(47.3% 0.137 46.201)",900:"oklch(41.4% 0.112 45.904)",950:"oklch(27.9% 0.077 45.635)"},yellow:{50:"oklch(98.7% 0.026 102.212)",100:"oklch(97.3% 0.071 103.193)",200:"oklch(94.5% 0.129 101.54)",300:"oklch(90.5% 0.182 98.111)",400:"oklch(85.2% 0.199 91.936)",500:"oklch(79.5% 0.184 86.047)",600:"oklch(68.1% 0.162 75.834)",700:"oklch(55.4% 0.135 66.442)",800:"oklch(47.6% 0.114 61.907)",900:"oklch(42.1% 0.095 57.708)",950:"oklch(28.6% 0.066 53.813)"},lime:{50:"oklch(98.6% 0.031 120.757)",100:"oklch(96.7% 0.067 122.328)",200:"oklch(93.8% 0.127 124.321)",300:"oklch(89.7% 0.196 126.665)",400:"oklch(84.1% 0.238 128.85)",500:"oklch(76.8% 0.233 130.85)",600:"oklch(64.8% 0.2 131.684)",700:"oklch(53.2% 0.157 131.589)",800:"oklch(45.3% 0.124 130.933)",900:"oklch(40.5% 0.101 131.063)",950:"oklch(27.4% 0.072 132.109)"},green:{50:"oklch(98.2% 0.018 155.826)",100:"oklch(96.2% 0.044 156.743)",200:"oklch(92.5% 0.084 155.995)",300:"oklch(87.1% 0.15 154.449)",400:"oklch(79.2% 0.209 151.711)",500:"oklch(72.3% 0.219 149.579)",600:"oklch(62.7% 0.194 149.214)",700:"oklch(52.7% 0.154 150.069)",800:"oklch(44.8% 0.119 151.328)",900:"oklch(39.3% 0.095 152.535)",950:"oklch(26.6% 0.065 152.934)"},emerald:{50:"oklch(97.9% 0.021 166.113)",100:"oklch(95% 0.052 163.051)",200:"oklch(90.5% 0.093 164.15)",300:"oklch(84.5% 0.143 164.978)",400:"oklch(76.5% 0.177 163.223)",500:"oklch(69.6% 0.17 162.48)",600:"oklch(59.6% 0.145 163.225)",700:"oklch(50.8% 0.118 165.612)",800:"oklch(43.2% 0.095 166.913)",900:"oklch(37.8% 0.077 168.94)",950:"oklch(26.2% 0.051 172.552)"},teal:{50:"oklch(98.4% 0.014 180.72)",100:"oklch(95.3% 0.051 180.801)",200:"oklch(91% 0.096 180.426)",300:"oklch(85.5% 0.138 181.071)",400:"oklch(77.7% 0.152 181.912)",500:"oklch(70.4% 0.14 182.503)",600:"oklch(60% 0.118 184.704)",700:"oklch(51.1% 0.096 186.391)",800:"oklch(43.7% 0.078 188.216)",900:"oklch(38.6% 0.063 188.416)",950:"oklch(27.7% 0.046 192.524)"},cyan:{50:"oklch(98.4% 0.019 200.873)",100:"oklch(95.6% 0.045 203.388)",200:"oklch(91.7% 0.08 205.041)",300:"oklch(86.5% 0.127 207.078)",400:"oklch(78.9% 0.154 211.53)",500:"oklch(71.5% 0.143 215.221)",600:"oklch(60.9% 0.126 221.723)",700:"oklch(52% 0.105 223.128)",800:"oklch(45% 0.085 224.283)",900:"oklch(39.8% 0.07 227.392)",950:"oklch(30.2% 0.056 229.695)"},sky:{50:"oklch(97.7% 0.013 236.62)",100:"oklch(95.1% 0.026 236.824)",200:"oklch(90.1% 0.058 230.902)",300:"oklch(82.8% 0.111 230.318)",400:"oklch(74.6% 0.16 232.661)",500:"oklch(68.5% 0.169 237.323)",600:"oklch(58.8% 0.158 241.966)",700:"oklch(50% 0.134 242.749)",800:"oklch(44.3% 0.11 240.79)",900:"oklch(39.1% 0.09 240.876)",950:"oklch(29.3% 0.066 243.157)"},blue:{50:"oklch(97% 0.014 254.604)",100:"oklch(93.2% 0.032 255.585)",200:"oklch(88.2% 0.059 254.128)",300:"oklch(80.9% 0.105 251.813)",400:"oklch(70.7% 0.165 254.624)",500:"oklch(62.3% 0.214 259.815)",600:"oklch(54.6% 0.245 262.881)",700:"oklch(48.8% 0.243 264.376)",800:"oklch(42.4% 0.199 265.638)",900:"oklch(37.9% 0.146 265.522)",950:"oklch(28.2% 0.091 267.935)"},indigo:{50:"oklch(96.2% 0.018 272.314)",100:"oklch(93% 0.034 272.788)",200:"oklch(87% 0.065 274.039)",300:"oklch(78.5% 0.115 274.713)",400:"oklch(67.3% 0.182 276.935)",500:"oklch(58.5% 0.233 277.117)",600:"oklch(51.1% 0.262 276.966)",700:"oklch(45.7% 0.24 277.023)",800:"oklch(39.8% 0.195 277.366)",900:"oklch(35.9% 0.144 278.697)",950:"oklch(25.7% 0.09 281.288)"},violet:{50:"oklch(96.9% 0.016 293.756)",100:"oklch(94.3% 0.029 294.588)",200:"oklch(89.4% 0.057 293.283)",300:"oklch(81.1% 0.111 293.571)",400:"oklch(70.2% 0.183 293.541)",500:"oklch(60.6% 0.25 292.717)",600:"oklch(54.1% 0.281 293.009)",700:"oklch(49.1% 0.27 292.581)",800:"oklch(43.2% 0.232 292.759)",900:"oklch(38% 0.189 293.745)",950:"oklch(28.3% 0.141 291.089)"},purple:{50:"oklch(97.7% 0.014 308.299)",100:"oklch(94.6% 0.033 307.174)",200:"oklch(90.2% 0.063 306.703)",300:"oklch(82.7% 0.119 306.383)",400:"oklch(71.4% 0.203 305.504)",500:"oklch(62.7% 0.265 303.9)",600:"oklch(55.8% 0.288 302.321)",700:"oklch(49.6% 0.265 301.924)",800:"oklch(43.8% 0.218 303.724)",900:"oklch(38.1% 0.176 304.987)",950:"oklch(29.1% 0.149 302.717)"},fuchsia:{50:"oklch(97.7% 0.017 320.058)",100:"oklch(95.2% 0.037 318.852)",200:"oklch(90.3% 0.076 319.62)",300:"oklch(83.3% 0.145 321.434)",400:"oklch(74% 0.238 322.16)",500:"oklch(66.7% 0.295 322.15)",600:"oklch(59.1% 0.293 322.896)",700:"oklch(51.8% 0.253 323.949)",800:"oklch(45.2% 0.211 324.591)",900:"oklch(40.1% 0.17 325.612)",950:"oklch(29.3% 0.136 325.661)"},pink:{50:"oklch(97.1% 0.014 343.198)",100:"oklch(94.8% 0.028 342.258)",200:"oklch(89.9% 0.061 343.231)",300:"oklch(82.3% 0.12 346.018)",400:"oklch(71.8% 0.202 349.761)",500:"oklch(65.6% 0.241 354.308)",600:"oklch(59.2% 0.249 0.584)",700:"oklch(52.5% 0.223 3.958)",800:"oklch(45.9% 0.187 3.815)",900:"oklch(40.8% 0.153 2.432)",950:"oklch(28.4% 0.109 3.907)"},rose:{50:"oklch(96.9% 0.015 12.422)",100:"oklch(94.1% 0.03 12.58)",200:"oklch(89.2% 0.058 10.001)",300:"oklch(81% 0.117 11.638)",400:"oklch(71.2% 0.194 13.428)",500:"oklch(64.5% 0.246 16.439)",600:"oklch(58.6% 0.253 17.585)",700:"oklch(51.4% 0.222 16.935)",800:"oklch(45.5% 0.188 13.697)",900:"oklch(41% 0.159 10.272)",950:"oklch(27.1% 0.105 12.094)"}},spacing:{0:"0",px:"1px",0.5:"0.125rem",1:"0.25rem",1.5:"0.375rem",2:"0.5rem",2.5:"0.625rem",3:"0.75rem",3.5:"0.875rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem",11:"2.75rem",12:"3rem",14:"3.5rem",16:"4rem",20:"5rem",24:"6rem",28:"7rem",32:"8rem",36:"9rem",40:"10rem",44:"11rem",48:"12rem",52:"13rem",56:"14rem",60:"15rem",64:"16rem",72:"18rem",80:"20rem",96:"24rem"},fontSize:{xs:["0.75rem",{lineHeight:"1rem"}],sm:["0.875rem",{lineHeight:"1.25rem"}],base:["1rem",{lineHeight:"1.5rem"}],lg:["1.125rem",{lineHeight:"1.75rem"}],xl:["1.25rem",{lineHeight:"1.75rem"}],"2xl":["1.5rem",{lineHeight:"2rem"}],"3xl":["1.875rem",{lineHeight:"2.25rem"}],"4xl":["2.25rem",{lineHeight:"2.5rem"}],"5xl":["3rem",{lineHeight:"1"}],"6xl":["3.75rem",{lineHeight:"1"}],"7xl":["4.5rem",{lineHeight:"1"}],"8xl":["6rem",{lineHeight:"1"}],"9xl":["8rem",{lineHeight:"1"}]},fontFamily:{sans:["ui-sans-serif","system-ui","sans-serif"],serif:["ui-serif","Georgia","serif"],mono:["ui-monospace","monospace"]},screens:{sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},borderRadius:{none:"0",xs:"0.125rem",sm:"0.25rem",DEFAULT:"0.25rem",md:"0.375rem",lg:"0.5rem",xl:"0.75rem","2xl":"1rem","3xl":"1.5rem","4xl":"2rem",full:"9999px"},boxShadow:{"2xs":"0 1px rgb(0 0 0 / 0.05)",xs:"0 1px 2px 0 rgb(0 0 0 / 0.05)",sm:"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",DEFAULT:"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",md:"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",lg:"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",xl:"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)",none:"none"}},shortcuts:{},rules:[],attributify:{enabled:!1,prefix:"tc-",ignoreAttributes:["class","className","style","id","name","type","value","href","src","alt","title","role","for","action","method","target","rel","placeholder","disabled","checked","selected","readonly","required","maxlength","minlength","pattern","autocomplete","autofocus","tabindex","contenteditable","draggable","spellcheck","lang","dir","hidden","slot","part","is","key","ref"]},bracketSyntax:{enabled:!1,colonSyntax:!1,aliases:{col:"col",row:"row",jc:"justify",ji:"justify-items",js:"justify-self",ai:"items",ac:"content",as:"self",wrap:"wrap",nowrap:"nowrap",c:"center",s:"start",e:"end",sb:"between",sa:"around",se:"evenly",st:"stretch"}},variants:{responsive:!0,hover:!0,focus:!0,active:!0,disabled:!0,dark:!0,light:!0,group:!0,peer:!0,before:!0,after:!0,marker:!0,first:!0,last:!0,odd:!0,even:!0,"first-of-type":!0,"last-of-type":!0,visited:!0,checked:!0,"focus-within":!0,"focus-visible":!0,placeholder:!0,selection:!0,file:!0,required:!0,valid:!0,invalid:!0,"read-only":!0,autofill:!0,open:!0,closed:!0,empty:!0,enabled:!0,only:!0,target:!0,indeterminate:!0,default:!0,optional:!0,aria:!0,data:!0,has:!0,not:!0,supports:!0,print:!0,landscape:!0,portrait:!0,"forced-colors":!0,rtl:!0,ltr:!0,"motion-safe":!0,"motion-reduce":!0,"contrast-more":!0,"contrast-less":!0},safelist:[],blocklist:[],preflights:[Cr],presets:[],cssVariables:!1},qn=null;async function Ns(){if(!qn)qn=await Ts({name:"css",defaultConfig:$r});return qn}var Yn=$r;function Se(e){if(e.indexOf("/")===-1)return-1;let r=0,n=0,i="";for(let o=0;o<e.length;o++){let s=e[o];if(s==="\\"){o++;continue}if(i){if(s===i)i="";continue}if(s==='"'||s==="'"){i=s;continue}if(s==="(")r++;else if(s===")")r=Math.max(0,r-1);else if(s==="[")n++;else if(s==="]")n=Math.max(0,n-1);else if(s==="/"&&r===0&&n===0)return o}return-1}var Rr={"0":"0",full:"100%",min:"min-content",max:"max-content",fit:"fit-content",none:"none",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem",screen:"100vw"};function Ps(e,t,r){let n=e.value;if(t[n])return{[r]:t[n]};if(e.arbitrary)return{[r]:n};if(/^\d+$/.test(n)){let i=Number.parseInt(n,10);if(i>=0&&i<=100)return{[r]:`${i/100}`}}return}var Kd=(e,t)=>{if(e.utility==="min-w"&&e.value){let r=Ee(e,t,Rr);return r!==void 0?{"min-width":r}:void 0}if(e.utility==="max-w"&&e.value){let r=Ee(e,t,Rr);return r!==void 0?{"max-width":r}:void 0}if(e.utility==="min-h"&&e.value){let r={...Rr,screen:"100vh"},n=Ee(e,t,r);return n!==void 0?{"min-height":n}:void 0}if(e.utility==="max-h"&&e.value){let r={...Rr,screen:"100vh"},n=Ee(e,t,r);return n!==void 0?{"max-height":n}:void 0}},Gd=(e,t)=>{if(e.utility==="ring"){if(e.value==="inset")return{"--tc-ring-inset":"inset"};if(e.value){let i=ie(e.value,t,e.modifierArbitrary);if(i)return{"--tc-ring-color":i}}let r={0:"0",1:"1px",2:"2px",4:"4px",8:"8px",DEFAULT:"3px"},n;if(!e.value)n=r.DEFAULT;else if(r[e.value])n=r[e.value];else if(e.arbitrary)n=e.value;else if(/^\d+(?:\.\d+)?$/.test(e.value))n=`${e.value}px`;if(n===void 0)return;return{"--tc-ring-offset-shadow":"var(--tc-ring-inset,) 0 0 0 var(--tc-ring-offset-width, 0px) var(--tc-ring-offset-color, #fff)","--tc-ring-shadow":`var(--tc-ring-inset,) 0 0 0 calc(${n} + var(--tc-ring-offset-width, 0px)) var(--tc-ring-color, rgba(59, 130, 246, 0.5))`,"box-shadow":"var(--tc-ring-offset-shadow), var(--tc-ring-shadow), var(--tc-shadow, 0 0 #0000)"}}if(e.utility==="ring-offset"&&e.value){let r={0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"};if(r[e.value])return{"--tc-ring-offset-width":r[e.value]};let n=ie(e.value,t,e.modifierArbitrary);if(n)return{"--tc-ring-offset-color":n}}if(e.utility==="ring-opacity"&&e.value)return Ps(e,{0:"0",5:"0.05",10:"0.1",20:"0.2",25:"0.25",30:"0.3",40:"0.4",50:"0.5",60:"0.6",70:"0.7",75:"0.75",80:"0.8",90:"0.9",95:"0.95",100:"1"},"--tc-ring-opacity")},Hd=(e)=>{if(e.utility==="border-opacity"&&e.value)return Ps(e,{0:"0",5:"0.05",10:"0.1",20:"0.2",25:"0.25",30:"0.3",40:"0.4",50:"0.5",60:"0.6",70:"0.7",75:"0.75",80:"0.8",90:"0.9",95:"0.95",100:"1"},"--tc-border-opacity")};function Os(e,t){let r=e.value;if(e.arbitrary)return r;let n=r.startsWith("-"),i=n?r.slice(1):r,o=t.theme.spacing[i];if(o===void 0&&/^\d+(?:\.\d+)?$/.test(i))o=`${Number.parseFloat(i)*0.25}rem`;if(o===void 0)return;return n?`-${o}`:o}var qd=(e,t)=>{if(e.utility==="space-x"&&e.value){if(e.value==="reverse")return{properties:{"--tc-space-x-reverse":"1"},childSelector:"> :not([hidden]) ~ :not([hidden])"};let r=Os(e,t);if(r===void 0)return;return{properties:{"--tc-space-x-reverse":"0","margin-right":`calc(${r} * var(--tc-space-x-reverse))`,"margin-left":`calc(${r} * calc(1 - var(--tc-space-x-reverse)))`},childSelector:"> :not([hidden]) ~ :not([hidden])"}}if(e.utility==="space-y"&&e.value){if(e.value==="reverse")return{properties:{"--tc-space-y-reverse":"1"},childSelector:"> :not([hidden]) ~ :not([hidden])"};let r=Os(e,t);if(r===void 0)return;return{properties:{"--tc-space-y-reverse":"0","margin-top":`calc(${r} * calc(1 - var(--tc-space-y-reverse)))`,"margin-bottom":`calc(${r} * var(--tc-space-y-reverse))`},childSelector:"> :not([hidden]) ~ :not([hidden])"}}},Yd=(e)=>{if(e.utility==="border"&&e.value){let t={solid:"solid",dashed:"dashed",dotted:"dotted",double:"double",hidden:"hidden",none:"none"};if(t[e.value])return{"border-style":t[e.value]}}};function Is(e){if(!e.value)return"1px";let t={0:"0",2:"2px",4:"4px",8:"8px"};if(t[e.value])return t[e.value];if(e.arbitrary)return e.value;if(/^\d+(?:\.\d+)?$/.test(e.value))return`${e.value}px`;return}function Jd(e){let t=Se(e),r=t===-1?e:e.slice(0,t);if(r.charCodeAt(0)!==91||r.charCodeAt(r.length-1)!==93)return e;let n=r.slice(1,-1).replace(/_/g," ");return t===-1?n:n+e.slice(t)}var Xd=(e,t)=>{if(e.utility==="divide"&&e.value){let r={solid:"solid",dashed:"dashed",dotted:"dotted",double:"double",none:"none"};if(r[e.value])return{properties:{"border-style":r[e.value]},childSelector:"> :not([hidden]) ~ :not([hidden])"}}if(e.utility==="divide-x"){if(e.value==="reverse")return{properties:{"--tc-divide-x-reverse":"1"},childSelector:"> :not([hidden]) ~ :not([hidden])"};let r=Is(e);if(r===void 0)return;return{properties:{"--tc-divide-x-reverse":"0","border-right-width":`calc(${r} * var(--tc-divide-x-reverse))`,"border-left-width":`calc(${r} * calc(1 - var(--tc-divide-x-reverse)))`},childSelector:"> :not([hidden]) ~ :not([hidden])"}}if(e.utility==="divide-y"){if(e.value==="reverse")return{properties:{"--tc-divide-y-reverse":"1"},childSelector:"> :not([hidden]) ~ :not([hidden])"};let r=Is(e);if(r===void 0)return;return{properties:{"--tc-divide-y-reverse":"0","border-top-width":`calc(${r} * calc(1 - var(--tc-divide-y-reverse)))`,"border-bottom-width":`calc(${r} * var(--tc-divide-y-reverse))`},childSelector:"> :not([hidden]) ~ :not([hidden])"}}if(e.utility==="divide"&&e.value){let r=Jd(e.value);if(r==="auto")return;let n=ie(r,t,e.modifierArbitrary);if(n!==void 0)return{properties:{"border-color":n},childSelector:"> :not([hidden]) ~ :not([hidden])"}}},Zd=(e,t)=>{let r=(n)=>{let i=null,o=n,s=Se(n);if(s!==-1){o=n.slice(0,s);let u=n.slice(s+1);if(u.startsWith("[")&&u.endsWith("]"))i=u.slice(1,-1);else if(e.modifierArbitrary){let f=Number.parseFloat(u);if(!Number.isNaN(f)&&f>=0&&f<=1)i=f.toString()}else{let f=Number.parseInt(u,10);if(!Number.isNaN(f))i=(f/100).toString()}}let c=(u)=>{if(!i)return u;let f=u.match(/^(oklch|rgb|hsl|oklab|lab|lch)\(([^)]+)\)$/i);if(f){let d=f[1],h=f[2].split("/")[0].trim();return`${d}(${h} / ${i})`}if(/^#[0-9a-f]{3,8}$/i.test(u)){let d=u.replace("#",""),h=(y)=>Number.parseInt(y.length===1?y+y:y,16),m=h(d.slice(0,d.length===3?1:2)),p=h(d.slice(d.length===3?1:2,d.length===3?2:4)),g=h(d.slice(d.length===3?2:4,d.length===3?3:6));return`rgb(${m} ${p} ${g} / ${i})`}return`color-mix(in srgb, ${u} ${Math.round(Number.parseFloat(i)*100)}%, transparent)`};if(o.startsWith("[")&&o.endsWith("]"))o=o.slice(1,-1);let a=t.theme.colors[o];if(typeof a==="string")return c(a);if(typeof a==="object"&&a!==null&&typeof a.DEFAULT==="string")return c(a.DEFAULT);let l=o.split("-");if(l.length>=2){let u=l.slice(0,-1).join("-"),f=l[l.length-1],d=t.theme.colors[u];if(typeof d==="object"&&d[f])return c(d[f])}if(e.arbitrary||o.startsWith("#")||/^(?:var|rgb|rgba|hsl|hsla|oklch|oklab|lab|lch|color|color-mix)\(/.test(o))return c(o);return};if(e.utility==="from"&&e.value){let n=r(e.value);if(n===void 0)return;return{"--tc-gradient-from":n,"--tc-gradient-to":"rgb(255 255 255 / 0)","--tc-gradient-stops":"var(--tc-gradient-from), var(--tc-gradient-to)"}}if(e.utility==="via"&&e.value){let n=r(e.value);if(n===void 0)return;return{"--tc-gradient-to":"rgb(255 255 255 / 0)","--tc-gradient-stops":`var(--tc-gradient-from), ${n}, var(--tc-gradient-to)`}}if(e.utility==="to"&&e.value){let n=r(e.value);if(n===void 0)return;return{"--tc-gradient-to":n,"--tc-gradient-stops":"var(--tc-gradient-from), var(--tc-gradient-to)"}}},Qd=(e)=>{if(e.utility==="order"&&e.value){let t={first:"-9999",last:"9999",none:"0"};if(t[e.value])return{order:t[e.value]};if(e.arbitrary||/^-?\d+$/.test(e.value))return{order:e.value};return}},eh=(e,t)=>{if(e.utility==="basis"&&e.value){let r={auto:"auto",full:"100%",0:"0"};if(r[e.value])return{"flex-basis":r[e.value]};let n=Ee(e,t,{});return n!==void 0?{"flex-basis":n}:void 0}},th=(e)=>{if(e.utility==="justify-self"){let t={auto:"auto",start:"start",end:"end",center:"center",stretch:"stretch"};return e.value&&t[e.value]?{"justify-self":t[e.value]}:void 0}},rh=(e)=>{if(e.utility==="self"){let t={auto:"auto",start:"flex-start",end:"flex-end",center:"center",stretch:"stretch",baseline:"baseline"};return e.value&&t[e.value]?{"align-self":t[e.value]}:void 0}},nh=(e,t)=>{if(e.utility==="container"){if(!e.value)return{width:"100%","margin-left":"auto","margin-right":"auto","max-width":t.theme.screens.xl||"1280px"};let r={sm:t.theme.screens.sm||"640px",md:t.theme.screens.md||"768px",lg:t.theme.screens.lg||"1024px",xl:t.theme.screens.xl||"1280px","2xl":t.theme.screens["2xl"]||"1536px",full:"100%",prose:"65ch","3xl":"1920px"};if(r[e.value])return{width:"100%","margin-left":"auto","margin-right":"auto","max-width":r[e.value]};if(e.arbitrary)return{width:"100%","margin-left":"auto","margin-right":"auto","max-width":e.value}}},ih=(e)=>{if(e.arbitrary&&e.utility&&e.value&&e.base.startsWith("["))return{[e.utility]:e.value}},_s=[Kd,Gd,Hd,Yd,qd,Xd,Zd,Qd,eh,th,rh,nh,ih];var Ls={"bg-origin-border":"border-box","bg-origin-padding":"padding-box","bg-origin-content":"content-box"},Ms={"bg-bottom":"bottom","bg-center":"center","bg-left":"left","bg-left-bottom":"left bottom","bg-left-top":"left top","bg-right":"right","bg-right-bottom":"right bottom","bg-right-top":"right top","bg-top":"top"},Fs={"bg-repeat":"repeat","bg-no-repeat":"no-repeat","bg-repeat-x":"repeat-x","bg-repeat-y":"repeat-y","bg-repeat-round":"round","bg-repeat-space":"space"},Ds={"bg-auto":"auto","bg-cover":"cover","bg-contain":"contain"},Jn=null,js=null;function oh(e){let t=new Map;for(let[r,n]of Object.entries(e))if(typeof n==="string")t.set(r,n);else if(typeof n==="object"&&n!==null){for(let[i,o]of Object.entries(n))if(typeof o==="string")t.set(i==="DEFAULT"?r:`${r}-${i}`,o)}return t}function sh(e,t){if(e.charCodeAt(0)===35){let r=e.slice(1);if(r.length===3)r=r[0]+r[0]+r[1]+r[1]+r[2]+r[2];let n=Number.parseInt(r.slice(0,2),16),i=Number.parseInt(r.slice(2,4),16),o=Number.parseInt(r.slice(4,6),16);return`rgb(${n} ${i} ${o} / ${t})`}return e}function ah(e){return e.replace(/rgba?\([^)]+\)/g,"var(--tc-shadow-color)")}var lh=(e)=>{if(e.utility==="bg"&&e.value){let t={fixed:"fixed",local:"local",scroll:"scroll"};return t[e.value]?{"background-attachment":t[e.value]}:void 0}return},ch=(e)=>{if(e.utility==="bg"&&e.value&&e.value.startsWith("clip-")){let t=e.value.replace("clip-",""),r={border:"border-box",padding:"padding-box",content:"content-box",text:"text"};return r[t]?{"background-clip":r[t]}:void 0}return},uh={t:"to top",tr:"to top right",r:"to right",br:"to bottom right",b:"to bottom",bl:"to bottom left",l:"to left",tl:"to top left"},fh=(e)=>{if(!e.value)return;let t;if(e.utility==="bg-linear"||e.utility==="bg-gradient")t=e.value;else if(e.utility==="bg"){if(e.typeHint||e.value.includes("("))return;let r=e.value.startsWith("-"),i=(r?e.value.slice(1):e.value).match(/^(?:gradient|linear)-(.+)$/);if(!i)return;t=r?`-${i[1]}`:i[1]}else return;if(t.startsWith("to-")){let r=uh[t.slice(3)];return r?{"background-image":`linear-gradient(${r}, var(--tc-gradient-stops))`}:void 0}if(e.arbitrary)return{"background-image":`linear-gradient(${t}, var(--tc-gradient-stops))`};if(/^-?\d+(?:\.\d+)?$/.test(t))return{"background-image":`linear-gradient(${t}deg, var(--tc-gradient-stops))`};return},dh=(e)=>Ls[e.base]?{"background-origin":Ls[e.base]}:void 0,hh=(e)=>Ms[e.base]?{"background-position":Ms[e.base]}:void 0,gh=(e)=>Fs[e.base]?{"background-repeat":Fs[e.base]}:void 0,mh=(e)=>Ds[e.base]?{"background-size":Ds[e.base]}:void 0,ph=(e)=>{if(e.utility==="border"&&e.value){let t={solid:"solid",dashed:"dashed",dotted:"dotted",double:"double",hidden:"hidden",none:"none"};return t[e.value]?{"border-style":t[e.value]}:void 0}return},yh=(e,t)=>{if(e.utility==="outline-offset"&&e.value){let r={0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"};if(r[e.value])return{"outline-offset":r[e.value]};if(e.arbitrary)return{"outline-offset":e.value};if(/^\d+(?:\.\d+)?$/.test(e.value))return{"outline-offset":`${e.value}px`};return}if(e.utility==="outline"&&e.value){let r={none:"none",solid:"solid",dashed:"dashed",dotted:"dotted",double:"double"};if(r[e.value])return{"outline-style":r[e.value]};if(e.value==="hidden")return{outline:"2px solid transparent","outline-offset":"2px"}}if(e.utility==="outline"){if(!e.value)return{"outline-width":"1px"};let r=ie(e.value,t,e.modifierArbitrary);if(r)return{"outline-color":r};let n={0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"};if(n[e.value])return{"outline-width":n[e.value]};if(e.arbitrary)return{"outline-width":e.value};if(/^\d+(?:\.\d+)?$/.test(e.value))return{"outline-width":`${e.value}px`};return}},bh=(e,t)=>{if(e.utility==="shadow"){let n=e.arbitrary&&!!e.value&&(/\s/.test(e.value)||e.value==="none")?e.value:e.value?t.theme.boxShadow[e.value]:t.theme.boxShadow.DEFAULT;if(!n)return;if(n==="none")return{"--tc-shadow":"0 0 #0000","box-shadow":"var(--tc-ring-offset-shadow, 0 0 #0000), var(--tc-ring-shadow, 0 0 #0000), var(--tc-shadow)"};let i=ah(n);return{"--tc-shadow":n,"--tc-shadow-colored":i,"box-shadow":"var(--tc-ring-offset-shadow, 0 0 #0000), var(--tc-ring-shadow, 0 0 #0000), var(--tc-shadow)"}}},xh=(e,t)=>{if(e.utility!=="shadow"||!e.value)return;if(t.theme.boxShadow[e.value])return;if(e.arbitrary&&/\s/.test(e.value))return;if(Jn===null||js!==t.theme.colors)Jn=oh(t.theme.colors),js=t.theme.colors;let r=e.value,n=Se(r),i,o;if(n!==-1){i=r.slice(0,n);let a=r.slice(n+1);if(a.charCodeAt(0)===91&&a.charCodeAt(a.length-1)===93){let l=Number.parseFloat(a.slice(1,-1));if(Number.isNaN(l)||l<0||l>1)return;o=l}else if(e.modifierArbitrary){let l=Number.parseFloat(a);if(Number.isNaN(l)||l<0||l>1)return;o=l}else{let l=Number.parseInt(a,10);if(Number.isNaN(l)||l<0||l>100)return;o=l/100}}else i=r;let s=Jn.get(i)??(e.arbitrary?i:void 0);if(!s)return;return{"--tc-shadow-color":o!==void 0?sh(s,o):s,"--tc-shadow":"var(--tc-shadow-colored)"}},vh=(e)=>{if(e.utility==="text-shadow"){let t={sm:"0 1px 2px rgba(0, 0, 0, 0.05)",DEFAULT:"0 1px 3px rgba(0, 0, 0, 0.1)",md:"0 4px 6px rgba(0, 0, 0, 0.1)",lg:"0 10px 15px rgba(0, 0, 0, 0.1)",xl:"0 20px 25px rgba(0, 0, 0, 0.1)",none:"none"};if(!e.value)return{"text-shadow":t.DEFAULT};if(t[e.value])return{"text-shadow":t[e.value]};return e.arbitrary?{"text-shadow":e.value}:void 0}},wh=(e)=>{if(e.utility==="opacity"&&e.value){let t={0:"0",5:"0.05",10:"0.1",20:"0.2",25:"0.25",30:"0.3",40:"0.4",50:"0.5",60:"0.6",70:"0.7",75:"0.75",80:"0.8",90:"0.9",95:"0.95",100:"1"};if(t[e.value])return{opacity:t[e.value]};if(e.arbitrary)return{opacity:e.value};if(/^\d+$/.test(e.value)){let r=Number.parseInt(e.value,10);if(r>=0&&r<=100)return{opacity:`${r/100}`}}return}},Ch=(e)=>{if(e.utility==="mix-blend"){let t=["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"];return e.value&&t.includes(e.value)?{"mix-blend-mode":e.value}:void 0}},$h=(e)=>{if(e.utility==="bg-blend"){let t=["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"];return e.value&&t.includes(e.value)?{"background-blend-mode":e.value}:void 0}},Rh=(e)=>{if(e.utility==="mask-clip"&&e.value){let t={border:"border-box",padding:"padding-box",content:"content-box",text:"text",fill:"fill-box",stroke:"stroke-box",view:"view-box","no-clip":"no-clip"};if(t[e.value])return{"mask-clip":t[e.value]};return e.arbitrary?{"mask-clip":e.value}:void 0}if(e.utility==="mask-composite"&&e.value)return["add","subtract","intersect","exclude"].includes(e.value)?{"mask-composite":e.value}:void 0;if(e.utility==="mask-image"&&e.value){if(e.value==="none")return{"mask-image":"none"};if(e.arbitrary)return{"mask-image":e.value.startsWith("url(")||e.value.includes("gradient(")?e.value:`url(${e.value})`};return}if(e.utility==="mask-mode"&&e.value)return["alpha","luminance","match-source"].includes(e.value)?{"mask-mode":e.value}:void 0;if(e.utility==="mask-origin"&&e.value){let t={border:"border-box",padding:"padding-box",content:"content-box",fill:"fill-box",stroke:"stroke-box",view:"view-box"};if(t[e.value])return{"mask-origin":t[e.value]};return e.arbitrary?{"mask-origin":e.value}:void 0}if(e.utility==="mask-position"&&e.value){let t={center:"center",top:"top",right:"right",bottom:"bottom",left:"left","top-left":"top left","top-right":"top right","bottom-left":"bottom left","bottom-right":"bottom right"};if(t[e.value])return{"mask-position":t[e.value]};return e.arbitrary?{"mask-position":e.value}:void 0}if(e.utility==="mask-repeat"&&e.value){let t={repeat:"repeat","no-repeat":"no-repeat","repeat-x":"repeat-x","repeat-y":"repeat-y",round:"round",space:"space"};if(t[e.value])return{"mask-repeat":t[e.value]};return e.arbitrary?{"mask-repeat":e.value}:void 0}if(e.utility==="mask-size"&&e.value){let t={auto:"auto",cover:"cover",contain:"contain"};if(t[e.value])return{"mask-size":t[e.value]};return e.arbitrary?{"mask-size":e.value}:void 0}if(e.utility==="mask-type"&&e.value)return["alpha","luminance"].includes(e.value)?{"mask-type":e.value}:void 0},Xn=[lh,ch,fh,dh,hh,gh,mh,ph,yh,bh,xh,vh,wh,Ch,$h,Rh];var kr={appearance:"none","background-color":"#fff","border-color":"#6b7280","border-width":"1px","border-radius":"0px","padding-top":"0.5rem","padding-right":"0.75rem","padding-bottom":"0.5rem","padding-left":"0.75rem","font-size":"1rem","line-height":"1.5rem"},Bs={appearance:"none",padding:"0","print-color-adjust":"exact",display:"inline-block","vertical-align":"middle","background-origin":"border-box","user-select":"none","flex-shrink":"0",height:"1rem",width:"1rem",color:"#2563eb","background-color":"#fff","border-color":"#6b7280","border-width":"1px"};function st(e,t){return e.utility==="form"&&e.value===t||e.utility===`form-${t}`&&!e.value}var kh=(e)=>{if(st(e,"input"))return kr},Sh=(e)=>{if(st(e,"textarea"))return kr},Eh=(e)=>{if(st(e,"select"))return{...kr,"background-image":`url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e")`,"background-position":"right 0.5rem center","background-repeat":"no-repeat","background-size":"1.5em 1.5em","padding-right":"2.5rem","print-color-adjust":"exact"}},Ah=(e)=>{if(st(e,"multiselect"))return{...kr,"background-image":"initial","background-position":"initial","background-repeat":"unset","background-size":"initial","print-color-adjust":"unset"}},Th=(e)=>{if(st(e,"checkbox"))return{...Bs,"border-radius":"0px"}},Nh=(e)=>{if(st(e,"radio"))return{...Bs,"border-radius":"100%"}},Us=[kh,Sh,Eh,Ah,Th,Nh];var Oh={gap:"gap","gap-x":"column-gap","gap-y":"row-gap"},at=/^-?\d+$/,Vs=/^span-(\d+)$/,Ih=(e)=>{if(e.utility==="grid-cols"&&e.value){if(e.arbitrary)return{"grid-template-columns":e.value};if(e.value==="none"||e.value==="subgrid")return{"grid-template-columns":e.value};if(/^\d+$/.test(e.value))return{"grid-template-columns":`repeat(${e.value}, minmax(0, 1fr))`};return}},Ph=(e)=>{if(e.utility==="col"){if(!e.value)return;if(e.arbitrary)return{"grid-column":e.value};if(e.value==="auto")return{"grid-column":"auto"};if(e.value==="span-full")return{"grid-column":"1 / -1"};let t=e.value.match(Vs);if(t)return{"grid-column":`span ${t[1]} / span ${t[1]}`};if(at.test(e.value))return{"grid-column":e.value};return}if(e.utility==="col-span"&&e.value){if(e.arbitrary)return{"grid-column":`span ${e.value} / span ${e.value}`};if(e.value==="auto")return{"grid-column":"auto"};if(e.value==="full")return{"grid-column":"1 / -1"};if(/^\d+$/.test(e.value))return{"grid-column":`span ${e.value} / span ${e.value}`};return}if(e.utility==="col-start"&&e.value){if(e.arbitrary||e.value==="auto"||at.test(e.value))return{"grid-column-start":e.value};return}if(e.utility==="col-end"&&e.value){if(e.arbitrary||e.value==="auto"||at.test(e.value))return{"grid-column-end":e.value};return}},_h=(e)=>{if(e.utility==="grid-rows"&&e.value){if(e.arbitrary)return{"grid-template-rows":e.value};if(e.value==="none"||e.value==="subgrid")return{"grid-template-rows":e.value};if(/^\d+$/.test(e.value))return{"grid-template-rows":`repeat(${e.value}, minmax(0, 1fr))`};return}},Lh=(e)=>{if(e.utility==="row"){if(!e.value)return;if(e.arbitrary)return{"grid-row":e.value};if(e.value==="auto")return{"grid-row":"auto"};if(e.value==="span-full")return{"grid-row":"1 / -1"};let t=e.value.match(Vs);if(t)return{"grid-row":`span ${t[1]} / span ${t[1]}`};if(at.test(e.value))return{"grid-row":e.value};return}if(e.utility==="row-span"&&e.value){if(e.arbitrary)return{"grid-row":`span ${e.value} / span ${e.value}`};if(e.value==="auto")return{"grid-row":"auto"};if(e.value==="full")return{"grid-row":"1 / -1"};if(/^\d+$/.test(e.value))return{"grid-row":`span ${e.value} / span ${e.value}`};return}if(e.utility==="row-start"&&e.value){if(e.arbitrary||e.value==="auto"||at.test(e.value))return{"grid-row-start":e.value};return}if(e.utility==="row-end"&&e.value){if(e.arbitrary||e.value==="auto"||at.test(e.value))return{"grid-row-end":e.value};return}},Mh=(e)=>{if(e.utility==="grid-flow"&&e.value){let t={row:"row",col:"column",dense:"dense","row-dense":"row dense","col-dense":"column dense"};return t[e.value]?{"grid-auto-flow":t[e.value]}:void 0}return},Fh=(e)=>{if(e.utility==="auto-cols"&&e.value){let t={auto:"auto",min:"min-content",max:"max-content",fr:"minmax(0, 1fr)"};if(e.arbitrary)return{"grid-auto-columns":e.value};return t[e.value]?{"grid-auto-columns":t[e.value]}:void 0}},Dh=(e)=>{if(e.utility==="auto-rows"&&e.value){let t={auto:"auto",min:"min-content",max:"max-content",fr:"minmax(0, 1fr)"};if(e.arbitrary)return{"grid-auto-rows":e.value};return t[e.value]?{"grid-auto-rows":t[e.value]}:void 0}};function jh(e,t,r){let n=t.theme.spacing?.[r];if(n!==void 0)return n;if(e.arbitrary)return r;if(/^\d+(?:\.\d+)?$/.test(r)){let i=Number.parseFloat(r);if(Number.isFinite(i))return`${i*0.25}rem`}return}var Bh=(e,t)=>{let r=Oh[e.utility];if(!r||!e.value)return;let n=jh(e,t,e.value);return n!==void 0?{[r]:n}:void 0},Uh=(e)=>{if(e.utility==="place"&&e.value&&e.value.startsWith("content-")){let t=e.value.replace("content-",""),r={center:"center",start:"start",end:"end",between:"space-between",around:"space-around",evenly:"space-evenly",stretch:"stretch"};return r[t]?{"place-content":r[t]}:void 0}return},Vh=(e)=>{if(e.utility==="place"&&e.value&&e.value.startsWith("items-")){let t=e.value.replace("items-",""),r={start:"start",end:"end",center:"center",stretch:"stretch"};return r[t]?{"place-items":r[t]}:void 0}return},zh=(e)=>{if(e.utility==="place"&&e.value&&e.value.startsWith("self-")){let t=e.value.replace("self-",""),r={auto:"auto",start:"start",end:"end",center:"center",stretch:"stretch"};return r[t]?{"place-self":r[t]}:void 0}return},zs=[Ih,Ph,_h,Lh,Mh,Fh,Dh,Bh,Uh,Vh,zh];import{existsSync as Ws,readFileSync as Wh,readdirSync as Kh}from"fs";import{join as Sr}from"path";var Er=new Map;function Gh(e){if(Er.has(e))return Er.get(e);let t=[Sr(process.cwd(),"node_modules","@iconify-json",e,"icons.json"),Sr(process.cwd(),"node_modules",".bun","@iconify-json",e,"icons.json")],r=Sr(process.cwd(),"node_modules",".bun");if(Ws(r))try{let n=`@iconify-json+${e}@`;for(let i of Kh(r))if(i.startsWith(n))t.push(Sr(r,i,"node_modules","@iconify-json",e,"icons.json"))}catch{}for(let n of t)if(Ws(n))try{let i=JSON.parse(Wh(n,"utf-8"));return Er.set(e,i),i}catch{}return Er.set(e,null),null}function Hh(e,t){let r=e.icons[t];if(r)return r;let n=e.aliases?.[t];if(n)return e.icons[n.parent]??null;return null}function qh(e,t){let r=t.width??e.width??24,n=t.height??e.height??24,i=t.left??0,o=t.top??0;return`<svg xmlns='http://www.w3.org/2000/svg' viewBox='${i} ${o} ${r} ${n}' width='${r}' height='${n}'>${t.body}</svg>`}function Yh(e){return`url("data:image/svg+xml;utf8,${e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\?/g,"%3F").replace(/\s+/g," ")}")`}var Jh=/^i-([a-z][a-z0-9]*(?:-[a-z0-9]+)*)-(.+)$/;function Xh(e){if(!e.startsWith("i-"))return;let t=e.slice(2);for(let r=t.indexOf("-");r!==-1;r=t.indexOf("-",r+1)){let n=t.slice(0,r),i=t.slice(r+1);if(!/^[a-z][a-z0-9-]*$/.test(n))continue;let o=Gh(n);if(!o)continue;let s=Hh(o,i);if(s)return{collection:o,icon:s}}return}var Ks=(e,t)=>{if(!Jh.test(e.base))return;let r=Xh(e.base);if(!r)return;let{collection:n,icon:i}=r,o=Yh(qh(n,i));return{display:"inline-block",width:"1em",height:"1em","background-color":"currentColor","-webkit-mask":`${o} no-repeat`,mask:`${o} no-repeat`,"-webkit-mask-size":"100% 100%","mask-size":"100% 100%","vertical-align":"-0.125em"}};var Gs={"border-collapse":"collapse","border-separate":"separate"},Hs={"caption-top":"top","caption-bottom":"bottom"},qs={"field-sizing-content":"content","field-sizing-fixed":"fixed"},Ys={"cursor-auto":"auto","cursor-default":"default","cursor-pointer":"pointer","cursor-wait":"wait","cursor-text":"text","cursor-move":"move","cursor-help":"help","cursor-not-allowed":"not-allowed","cursor-none":"none","cursor-context-menu":"context-menu","cursor-progress":"progress","cursor-cell":"cell","cursor-crosshair":"crosshair","cursor-vertical-text":"vertical-text","cursor-alias":"alias","cursor-copy":"copy","cursor-no-drop":"no-drop","cursor-grab":"grab","cursor-grabbing":"grabbing","cursor-all-scroll":"all-scroll","cursor-col-resize":"col-resize","cursor-row-resize":"row-resize","cursor-n-resize":"n-resize","cursor-e-resize":"e-resize","cursor-s-resize":"s-resize","cursor-w-resize":"w-resize","cursor-ne-resize":"ne-resize","cursor-nw-resize":"nw-resize","cursor-se-resize":"se-resize","cursor-sw-resize":"sw-resize","cursor-ew-resize":"ew-resize","cursor-ns-resize":"ns-resize","cursor-nesw-resize":"nesw-resize","cursor-nwse-resize":"nwse-resize","cursor-zoom-in":"zoom-in","cursor-zoom-out":"zoom-out"},Js={"pointer-events-none":"none","pointer-events-auto":"auto"},Xs={"resize-none":"none",resize:"both","resize-y":"vertical","resize-x":"horizontal"},Zs={"scroll-auto":"auto","scroll-smooth":"smooth"},Qs={"snap-none":"none","snap-x":"x var(--tc-scroll-snap-strictness, proximity)","snap-y":"y var(--tc-scroll-snap-strictness, proximity)","snap-both":"both var(--tc-scroll-snap-strictness, proximity)"},ea={"snap-mandatory":"mandatory","snap-proximity":"proximity"},ta={"snap-start":"start","snap-end":"end","snap-center":"center","snap-align-none":"none"},ra={"snap-normal":"normal","snap-always":"always"},na={"touch-auto":"auto","touch-none":"none","touch-pan-x":"pan-x","touch-pan-left":"pan-left","touch-pan-right":"pan-right","touch-pan-y":"pan-y","touch-pan-up":"pan-up","touch-pan-down":"pan-down","touch-pinch-zoom":"pinch-zoom","touch-manipulation":"manipulation"},ia={"select-none":"none","select-text":"text","select-all":"all","select-auto":"auto"},oa={"will-change-auto":"auto","will-change-scroll":"scroll-position","will-change-contents":"contents","will-change-transform":"transform"},sa={"stroke-linecap-butt":"butt","stroke-linecap-round":"round","stroke-linecap-square":"square"},aa={"stroke-linejoin-miter":"miter","stroke-linejoin-round":"round","stroke-linejoin-bevel":"bevel"},la={"forced-color-adjust-auto":"auto","forced-color-adjust-none":"none"},Zn={none:"0",sm:"4px",DEFAULT:"8px",md:"12px",lg:"16px",xl:"24px","2xl":"40px","3xl":"64px"};function fa(e){if(e.arbitrary)return e.value;if(/^\d+(?:\.\d+)?$/.test(e.value))return`${Number(e.value)/100}`;return}function da(e){if(!e.value)return Zn.DEFAULT;if(Zn[e.value]!==void 0)return Zn[e.value];if(e.arbitrary)return e.value;if(/^\d+(?:\.\d+)?$/.test(e.value))return`${e.value}px`;return}var ha=["brightness","contrast","grayscale","invert","saturate","sepia"],Zh=["blur","brightness","contrast","grayscale","hue-rotate","invert","saturate","sepia","drop-shadow"],Qh=["blur","brightness","contrast","grayscale","hue-rotate","invert","opacity","saturate","sepia"],eg=Zh.map((e)=>`var(--tc-${e}, )`).join(" "),ca=Qh.map((e)=>`var(--tc-backdrop-${e}, )`).join(" ");function We(e,t){return{[`--tc-${e}`]:t,filter:eg}}function Ar(e,t){return{[`--tc-backdrop-${e}`]:t,"-webkit-backdrop-filter":ca,"backdrop-filter":ca}}var tg=(e)=>{if(e.base==="filter-none")return{filter:"none"};if(e.utility==="blur"){let t=da(e);return t!==void 0?We("blur",`blur(${t})`):void 0}if(ha.includes(e.utility)&&e.value){let t=fa(e);return t!==void 0?We(e.utility,`${e.utility}(${t})`):void 0}if(e.utility==="hue-rotate"&&e.value){if(e.arbitrary)return We("hue-rotate",`hue-rotate(${e.value})`);if(/^-?\d+(?:\.\d+)?$/.test(e.value))return We("hue-rotate",`hue-rotate(${e.value}deg)`);return}if(e.utility==="drop-shadow"){let t={sm:"drop-shadow(0 1px 1px rgb(0 0 0 / 0.05))",DEFAULT:"drop-shadow(0 1px 2px rgb(0 0 0 / 0.1)) drop-shadow(0 1px 1px rgb(0 0 0 / 0.06))",md:"drop-shadow(0 4px 3px rgb(0 0 0 / 0.07)) drop-shadow(0 2px 2px rgb(0 0 0 / 0.06))",lg:"drop-shadow(0 10px 8px rgb(0 0 0 / 0.04)) drop-shadow(0 4px 3px rgb(0 0 0 / 0.1))",xl:"drop-shadow(0 20px 13px rgb(0 0 0 / 0.03)) drop-shadow(0 8px 5px rgb(0 0 0 / 0.08))","2xl":"drop-shadow(0 25px 25px rgb(0 0 0 / 0.15))",none:"drop-shadow(0 0 #0000)"};if(!e.value)return We("drop-shadow",t.DEFAULT);if(t[e.value])return We("drop-shadow",t[e.value]);if(e.arbitrary)return We("drop-shadow",`drop-shadow(${e.value})`);return}},rg=(e)=>{if(e.base==="backdrop-filter-none")return{"backdrop-filter":"none"};if(e.utility==="backdrop-blur"){let t=da(e);return t!==void 0?Ar("blur",`blur(${t})`):void 0}if(e.utility.startsWith("backdrop-")&&e.value){let t=e.utility.slice(9);if(ha.includes(t)||t==="opacity"){let r=fa(e);if(r===void 0)return;return Ar(t,`${t}(${r})`)}if(t==="hue-rotate"){if(e.arbitrary)return Ar(t,`hue-rotate(${e.value})`);if(/^-?\d+(?:\.\d+)?$/.test(e.value))return Ar(t,`hue-rotate(${e.value}deg)`);return}}},ng=(e)=>Gs[e.base]?{"border-collapse":Gs[e.base]}:void 0,ig=(e,t)=>{if(!e.utility.startsWith("border-spacing")||!e.value)return;let r=t.theme.spacing[e.value];if(r===void 0&&e.arbitrary)r=e.value;if(r===void 0&&/^\d+(?:\.\d+)?$/.test(e.value))r=`${Number.parseFloat(e.value)*0.25}rem`;if(r===void 0)return;if(e.utility==="border-spacing")return{"border-spacing":`${r} ${r}`};if(e.utility==="border-spacing-x")return{"border-spacing":`${r} 0`};if(e.utility==="border-spacing-y")return{"border-spacing":`0 ${r}`}},og=(e)=>{if(e.utility==="table"&&e.value){let t={auto:"auto",fixed:"fixed"};return t[e.value]?{"table-layout":t[e.value]}:void 0}return},sg=(e)=>Hs[e.base]?{"caption-side":Hs[e.base]}:void 0,ag=(e,t)=>{if(e.utility==="accent"&&e.value){let r=ie(e.value,t,e.modifierArbitrary);if(r)return{"accent-color":r}}},lg=(e)=>{let t={"appearance-none":"none","appearance-auto":"auto","appearance-base":"base"};return t[e.base]?{appearance:t[e.base]}:void 0},cg=(e,t)=>{if(e.utility==="caret"&&e.value){let r=ie(e.value,t,e.modifierArbitrary);if(r)return{"caret-color":r}}},ug={normal:"normal",light:"light",dark:"dark","light-dark":"light dark","only-dark":"only dark","only-light":"only light"},ua=(e)=>{let t=e.base,r=t.startsWith("scheme-")?t.slice(7):t.startsWith("color-scheme-")?t.slice(13):void 0;if(r===void 0)return;let n=ug[r];return n?{"color-scheme":n}:void 0},fg=(e)=>qs[e.base]?{"field-sizing":qs[e.base]}:void 0,dg=(e)=>Ys[e.base]?{cursor:Ys[e.base]}:void 0,hg=(e)=>Js[e.base]?{"pointer-events":Js[e.base]}:void 0,gg=(e)=>Xs[e.base]?{resize:Xs[e.base]}:void 0,mg=(e)=>Zs[e.base]?{"scroll-behavior":Zs[e.base]}:void 0,pg=(e,t)=>{let n={"scroll-m":["scroll-margin"],"scroll-mx":["scroll-margin-left","scroll-margin-right"],"scroll-my":["scroll-margin-top","scroll-margin-bottom"],"scroll-mt":["scroll-margin-top"],"scroll-mr":["scroll-margin-right"],"scroll-mb":["scroll-margin-bottom"],"scroll-ml":["scroll-margin-left"]}[e.utility];if(!n||!e.value)return;let i=t.theme.spacing[e.value];if(i===void 0&&e.arbitrary)i=e.value;if(i===void 0&&/^\d+(?:\.\d+)?$/.test(e.value))i=`${Number.parseFloat(e.value)*0.25}rem`;if(i===void 0)return;let o={};for(let s of n)o[s]=i;return o},yg=(e,t)=>{let n={"scroll-p":["scroll-padding"],"scroll-px":["scroll-padding-left","scroll-padding-right"],"scroll-py":["scroll-padding-top","scroll-padding-bottom"],"scroll-pt":["scroll-padding-top"],"scroll-pr":["scroll-padding-right"],"scroll-pb":["scroll-padding-bottom"],"scroll-pl":["scroll-padding-left"]}[e.utility];if(!n||!e.value)return;let i=t.theme.spacing[e.value];if(i===void 0&&e.arbitrary)i=e.value;if(i===void 0&&/^\d+(?:\.\d+)?$/.test(e.value))i=`${Number.parseFloat(e.value)*0.25}rem`;if(i===void 0)return;let o={};for(let s of n)o[s]=i;return o},bg=(e)=>{if(Qs[e.base])return{"scroll-snap-type":Qs[e.base]};if(ea[e.base])return{"--tc-scroll-snap-strictness":ea[e.base]};if(ta[e.base])return{"scroll-snap-align":ta[e.base]};if(ra[e.base])return{"scroll-snap-stop":ra[e.base]}},xg=(e)=>na[e.base]?{"touch-action":na[e.base]}:void 0,vg=(e)=>ia[e.base]?{"user-select":ia[e.base]}:void 0,wg=(e)=>oa[e.base]?{"will-change":oa[e.base]}:void 0,Cg=(e,t)=>{if(e.utility==="fill"&&e.value){if(e.value==="none")return{fill:"none"};let r=ie(e.value,t,e.modifierArbitrary);if(r)return{fill:r}}},$g=(e,t)=>{if(e.utility==="stroke"&&e.value){if(e.value==="none")return{stroke:"none"};let r=ie(e.value,t,e.modifierArbitrary);if(r)return{stroke:r}}},Rg=(e)=>{if(e.utility==="stroke"&&e.value){if(e.arbitrary||/^\d+(?:\.\d+)?$/.test(e.value))return{"stroke-width":e.value};return}},kg=(e)=>{if(e.utility==="stroke-dasharray"&&e.value){if(e.value==="none")return{"stroke-dasharray":"none"};if(e.arbitrary||/^\d+(?:\.\d+)?$/.test(e.value))return{"stroke-dasharray":e.value};return}},Sg=(e)=>{if(e.utility==="stroke-dashoffset"&&e.value){if(e.arbitrary||/^-?\d+(?:\.\d+)?$/.test(e.value))return{"stroke-dashoffset":e.value};return}},Eg=(e)=>sa[e.base]?{"stroke-linecap":sa[e.base]}:void 0,Ag=(e)=>aa[e.base]?{"stroke-linejoin":aa[e.base]}:void 0,Tg=(e)=>{if(e.base==="sr-only")return{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)","white-space":"nowrap","border-width":"0"};if(e.base==="not-sr-only")return{position:"static",width:"auto",height:"auto",padding:"0",margin:"0",overflow:"visible",clip:"auto","white-space":"normal"};return},Ng=(e)=>la[e.base]?{"forced-color-adjust":la[e.base]}:void 0,ga=[tg,rg,ng,ig,og,sg,ag,lg,ua,cg,ua,fg,dg,hg,gg,mg,pg,yg,bg,xg,vg,wg,Cg,$g,Rg,kg,Sg,Eg,Ag,Tg,Ng];function ye(e,t){let r=e/t*100;if(!Number.isFinite(r))return;return`${Og(r)}%`}function Og(e){if(Number.isInteger(e))return String(e);return e.toFixed(6).replace(/\.?0+$/,"")}var ma={"column-fill-auto":"auto","column-fill-balance":"balance","column-fill-balance-all":"balance-all"},pa={"column-span-all":"all","column-span-none":"none"},ya={"box-decoration-clone":"clone","box-decoration-slice":"slice"},ba={"box-border":"border-box","box-content":"content-box"},xa={"float-start":"inline-start","float-end":"inline-end","float-right":"right","float-left":"left","float-none":"none"},va={"clear-start":"inline-start","clear-end":"inline-end","clear-left":"left","clear-right":"right","clear-both":"both","clear-none":"none"},wa={isolate:"isolate","isolation-auto":"auto"},Ca={"object-contain":"contain","object-cover":"cover","object-fill":"fill","object-none":"none","object-scale-down":"scale-down"},$a={"object-bottom":"bottom","object-center":"center","object-left":"left","object-left-bottom":"left bottom","object-left-top":"left top","object-right":"right","object-right-bottom":"right bottom","object-right-top":"right top","object-top":"top"},Ra={"overscroll-auto":"auto","overscroll-contain":"contain","overscroll-none":"none","overscroll-x-auto":"auto","overscroll-x-contain":"contain","overscroll-x-none":"none","overscroll-y-auto":"auto","overscroll-y-contain":"contain","overscroll-y-none":"none"},ka={visible:"visible",invisible:"hidden",collapse:"collapse"},Ig=(e)=>{if(e.utility==="aspect"&&e.value){let t={auto:"auto",square:"1 / 1",video:"16 / 9"};if(t[e.value])return{"aspect-ratio":t[e.value]};if(e.arbitrary)return{"aspect-ratio":e.value};let r=e.value.match(/^(\d+(?:\.\d+)?)\/(\d+(?:\.\d+)?)$/);if(r)return{"aspect-ratio":`${r[1]} / ${r[2]}`};if(/^\d+(?:\.\d+)?$/.test(e.value))return{"aspect-ratio":e.value};return}},Pg=(e,t)=>{if(e.utility==="columns"&&e.value){let r={"1":"1","2":"2","3":"3","4":"4","5":"5","6":"6","7":"7","8":"8","9":"9","10":"10","11":"11","12":"12",auto:"auto"},n={"3xs":"16rem","2xs":"18rem",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem"};if(r[e.value])return{columns:r[e.value]};if(n[e.value])return{columns:n[e.value]};if(t.theme.spacing[e.value])return{columns:t.theme.spacing[e.value]};if(e.arbitrary||/^\d+$/.test(e.value))return{columns:e.value};return}},_g=(e)=>ma[e.base]?{"column-fill":ma[e.base]}:void 0,Lg=(e,t)=>{if(e.utility==="column-gap"&&e.value){let r=t.theme.spacing[e.value];if(r===void 0&&e.arbitrary)r=e.value;if(r===void 0&&/^\d+(?:\.\d+)?$/.test(e.value))r=`${Number.parseFloat(e.value)*0.25}rem`;return r!==void 0?{"column-gap":r}:void 0}},Mg=(e,t)=>{if(e.utility==="column-rule"&&e.value){let r={"0":"0px","1":"1px","2":"2px","4":"4px","8":"8px"};if(r[e.value])return{"column-rule-width":r[e.value]};let n=e.value.split("-");if(n.length===2){let[s,c]=n,a=t.theme.colors[s];if(typeof a==="object"&&a[c])return{"column-rule-color":a[c]}}let i=t.theme.colors[e.value];if(typeof i==="string")return{"column-rule-color":i};if(typeof i==="object"&&i!==null&&typeof i.DEFAULT==="string")return{"column-rule-color":i.DEFAULT};let o={solid:"solid",dashed:"dashed",dotted:"dotted",double:"double",hidden:"hidden",none:"none"};if(o[e.value])return{"column-rule-style":o[e.value]}}},Fg=(e)=>pa[e.base]?{"column-span":pa[e.base]}:void 0,Dg=(e)=>({"break-before-auto":{"break-before":"auto"},"break-before-avoid":{"break-before":"avoid"},"break-before-all":{"break-before":"all"},"break-before-avoid-page":{"break-before":"avoid-page"},"break-before-page":{"break-before":"page"},"break-after-auto":{"break-after":"auto"},"break-after-avoid":{"break-after":"avoid"},"break-after-all":{"break-after":"all"},"break-after-avoid-page":{"break-after":"avoid-page"},"break-after-page":{"break-after":"page"},"break-inside-auto":{"break-inside":"auto"},"break-inside-avoid":{"break-inside":"avoid"},"break-inside-avoid-page":{"break-inside":"avoid-page"},"break-inside-avoid-column":{"break-inside":"avoid-column"}})[e.base],jg=(e)=>ya[e.base]?{"box-decoration-break":ya[e.base]}:void 0,Bg=(e)=>ba[e.base]?{"box-sizing":ba[e.base]}:void 0,Ug=(e)=>xa[e.base]?{float:xa[e.base]}:void 0,Vg=(e)=>va[e.base]?{clear:va[e.base]}:void 0,zg=(e)=>wa[e.base]?{isolation:wa[e.base]}:void 0,Sa=["size","inline-size","layout","paint","style"],Wg=Sa.map((e)=>`var(--tc-contain-${e}, )`).join(" "),Kg=["none","content","strict"],Gg=(e)=>{if(e.utility!=="contain"||!e.value)return;if(e.arbitrary)return{contain:e.value};if(Kg.includes(e.value))return{contain:e.value};if(Sa.includes(e.value))return{[`--tc-contain-${e.value}`]:e.value,contain:Wg};return},Hg=(e)=>Ca[e.base]?{"object-fit":Ca[e.base]}:void 0,qg=(e)=>$a[e.base]?{"object-position":$a[e.base]}:void 0,Yg=(e)=>{if(e.utility==="overflow"){let t=["auto","hidden","clip","visible","scroll"];if(e.value&&t.includes(e.value))return{overflow:e.value}}if(e.utility==="overflow-x"||e.utility==="overflow-y"){let t=["auto","hidden","clip","visible","scroll"];if(e.value&&t.includes(e.value))return{[e.utility]:e.value}}},Jg=(e)=>{let t=e.base.startsWith("overscroll-x")?"overscroll-behavior-x":e.base.startsWith("overscroll-y")?"overscroll-behavior-y":"overscroll-behavior";return Ra[e.base]?{[t]:Ra[e.base]}:void 0},Xg=(e)=>{if(["static","fixed","absolute","relative","sticky"].includes(e.utility))return{position:e.utility}},Zg=(e,t)=>{let n={inset:["top","right","bottom","left"],"inset-x":["left","right"],"inset-y":["top","bottom"],top:["top"],right:["right"],bottom:["bottom"],left:["left"],start:["inset-inline-start"],end:["inset-inline-end"]}[e.utility];if(!n||!e.value)return;let i=(c)=>{if(c.includes("/")&&!e.arbitrary){let[l,u]=c.split("/").map(Number);if(!Number.isNaN(l)&&!Number.isNaN(u)&&u!==0)return ye(l,u);return}if(c==="full")return"100%";if(c==="auto")return"auto";if(e.arbitrary)return c;let a=t.theme.spacing[c];if(a!==void 0)return a;if(/^\d+(?:\.\d+)?$/.test(c))return`${Number.parseFloat(c)*0.25}rem`;return},o;if(e.value.startsWith("-")){let c=e.value.slice(1),a=i(c);if(a===void 0)o=void 0;else if(a.endsWith("%"))o=`${-Number.parseFloat(a)}%`;else o=a.startsWith("-")?a:`-${a}`}else o=i(e.value);if(o===void 0)return;let s={};for(let c of n)s[c]=o;return s},Qg=(e)=>ka[e.utility]?{visibility:ka[e.utility]}:void 0,em=(e)=>{if(e.utility==="z"&&e.value){if(e.arbitrary||e.value==="auto"||/^-?\d+$/.test(e.value))return{"z-index":e.value};return}},Ea=[Ig,Pg,_g,Lg,Mg,Fg,Dg,jg,Bg,Ug,Vg,Gg,zg,Hg,qg,Yg,Jg,Xg,Zg,Qg,em];var tm={rotate:"rotate","rotate-x":"rotateX","rotate-y":"rotateY","rotate-z":"rotateZ"},rm={"translate-x":"translateX","translate-y":"translateY","translate-z":"translateZ"},Aa={"backface-visible":"visible","backface-hidden":"hidden"},Ta={"transform-flat":"flat","transform-3d":"preserve-3d"},Na={"transition-none":"none","transition-all":"all",transition:"color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter","transition-colors":"color, background-color, border-color, text-decoration-color, fill, stroke","transition-opacity":"opacity","transition-shadow":"box-shadow","transition-transform":"transform"},Oa={"ease-linear":"linear","ease-in":"cubic-bezier(0.4, 0, 1, 1)","ease-out":"cubic-bezier(0, 0, 0.2, 1)","ease-in-out":"cubic-bezier(0.4, 0, 0.2, 1)"},Ia={"transition-behavior-normal":"normal","transition-behavior-allow-discrete":"allow-discrete"},Pa={none:"none",spin:"spin 1s linear infinite",ping:"ping 1s cubic-bezier(0, 0, 0.2, 1) infinite",pulse:"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",bounce:"bounce 1s infinite"},_a={"animate-running":"running","animate-paused":"paused"},La={"animate-normal":"normal","animate-reverse":"reverse","animate-alternate":"alternate","animate-alternate-reverse":"alternate-reverse"},Ma={"animate-fill-none":"none","animate-fill-forwards":"forwards","animate-fill-backwards":"backwards","animate-fill-both":"both"},Fa={"animate-ease-linear":"linear","animate-ease-in":"cubic-bezier(0.4, 0, 1, 1)","animate-ease-out":"cubic-bezier(0, 0, 0.2, 1)","animate-ease-in-out":"cubic-bezier(0.4, 0, 0.2, 1)"},Da="rotate(var(--tc-rotate, 0deg)) skewX(var(--tc-skew-x, 0deg)) skewY(var(--tc-skew-y, 0deg)) scaleX(var(--tc-scale-x, 1)) scaleY(var(--tc-scale-y, 1))",kt=`translate(var(--tc-translate-x, 0), var(--tc-translate-y, 0)) ${Da}`,ei=`translate3d(var(--tc-translate-x, 0), var(--tc-translate-y, 0), 0) ${Da}`,nm={transform:kt,"transform-cpu":kt,"transform-gpu":ei,"transform-none":"none"},im=(e)=>{let t=nm[e.base];return t?{transform:t}:void 0};function Tr(e,t){if(!t.value)return{transform:`${e}(1)`};if(t.arbitrary)return{transform:`${e}(${t.value})`};if(/^-?\d+(?:\.\d+)?$/.test(t.value))return{transform:`${e}(${Number(t.value)/100})`};return}function Qn(e){let t=e.value;if(e.arbitrary)return t;if(/^-?\d+(?:\.\d+)?$/.test(t))return`${t}deg`;if(/^-?\d+(?:\.\d+)?(?:deg|rad|grad|turn)$/.test(t))return t;return}var om=(e)=>{if(e.utility==="scale")return Tr("scale",e);if(e.utility==="scale-x")return Tr("scaleX",e);if(e.utility==="scale-y")return Tr("scaleY",e);if(e.utility==="scale-z")return Tr("scaleZ",e)},sm=(e)=>{if(!e.value)return;let t=tm[e.utility];if(!t)return;let r=Qn(e);return r!==void 0?{transform:`${t}(${r})`}:void 0},am=(e,t)=>{let r=(o)=>{if(o.includes("/")){let[c,a]=o.split("/");return ye(Number(c),Number(a))}if(o==="full")return"100%";if(o==="half")return"50%";if(e.arbitrary)return o;let s=t.theme.spacing[o];if(s!==void 0)return s;if(/^\d+(?:\.\d+)?$/.test(o))return`${Number.parseFloat(o)*0.25}rem`;return},n=rm[e.utility];if(!n||!e.value)return;let i;if(e.value.startsWith("-")){let o=r(e.value.slice(1));i=o===void 0?void 0:`-${o}`}else i=r(e.value);return i!==void 0?{transform:`${n}(${i})`}:void 0},lm=(e)=>{if(e.utility==="skew-x"&&e.value){let t=Qn(e);return t!==void 0?{transform:`skewX(${t})`}:void 0}if(e.utility==="skew-y"&&e.value){let t=Qn(e);return t!==void 0?{transform:`skewY(${t})`}:void 0}},cm=(e)=>{if(e.utility==="origin"&&e.value){if(e.arbitrary)return{"transform-origin":e.value.replace(/_/g," ")};let t={center:"center",top:"top","top-right":"top right",right:"right","bottom-right":"bottom right",bottom:"bottom","bottom-left":"bottom left",left:"left","top-left":"top left"};return t[e.value]?{"transform-origin":t[e.value]}:void 0}return},um={dramatic:"100px",near:"300px",normal:"500px",midrange:"800px",distant:"1200px"},fm=(e)=>{if(e.utility==="perspective"&&e.value){if(e.value==="none")return{perspective:"none"};if(e.arbitrary||/^\d+(?:\.\d+)?(?:px|rem|em)$/.test(e.value))return{perspective:e.value};let t=um[e.value];if(t)return{perspective:t};if(/^\d+(?:\.\d+)?$/.test(e.value))return{perspective:`${e.value}px`};return}return},dm=(e)=>{if(e.utility==="perspective-origin"&&e.value)return{"perspective-origin":{center:"center",top:"top","top-right":"top right",right:"right","bottom-right":"bottom right",bottom:"bottom","bottom-left":"bottom left",left:"left","top-left":"top left"}[e.value]||e.value}},hm=(e)=>Aa[e.base]?{"backface-visibility":Aa[e.base]}:void 0,gm=(e)=>Ta[e.base]?{"transform-style":Ta[e.base]}:void 0,mm=(e)=>Na[e.base]?{"transition-property":Na[e.base]}:void 0;function Nr(e,t){let r=e.value;if(t[r])return t[r];if(e.arbitrary)return r;if(/^\d+(?:\.\d+)?$/.test(r))return`${r}ms`;return}var pm=(e)=>{if(e.utility==="duration"&&e.value){let r=Nr(e,{"0":"0s","75":"75ms","100":"100ms","150":"150ms","200":"200ms","300":"300ms","500":"500ms","700":"700ms","1000":"1000ms"});return r!==void 0?{"transition-duration":r}:void 0}},ym=(e)=>Oa[e.base]?{"transition-timing-function":Oa[e.base]}:void 0,bm=(e)=>{if(e.utility==="delay"&&e.value){let r=Nr(e,{"0":"0s","75":"75ms","100":"100ms","150":"150ms","200":"200ms","300":"300ms","500":"500ms","700":"700ms","1000":"1000ms"});return r!==void 0?{"transition-delay":r}:void 0}},xm=(e)=>Ia[e.base]?{"transition-behavior":Ia[e.base]}:void 0,vm=(e)=>{if(e.utility!=="animate")return;if(e.arbitrary&&e.value)return{animation:e.value.replace(/_/g," ")};if(e.value&&Pa[e.value])return{animation:Pa[e.value]};return},wm=(e)=>_a[e.base]?{"animation-play-state":_a[e.base]}:void 0,Cm=(e)=>La[e.base]?{"animation-direction":La[e.base]}:void 0,$m=(e)=>Ma[e.base]?{"animation-fill-mode":Ma[e.base]}:void 0,Rm=(e)=>{if(e.utility==="animate-iteration"&&e.value){if(e.value==="infinite"||e.arbitrary||/^\d+(?:\.\d+)?$/.test(e.value))return{"animation-iteration-count":e.value};return}},km=(e)=>{if(e.utility==="animate-duration"&&e.value){let r=Nr(e,{"75":"75ms","100":"100ms","150":"150ms","200":"200ms","300":"300ms","500":"500ms","700":"700ms","1000":"1000ms"});return r!==void 0?{"animation-duration":r}:void 0}},Sm=(e)=>{if(e.utility==="animate-delay"&&e.value){let r=Nr(e,{"75":"75ms","100":"100ms","150":"150ms","200":"200ms","300":"300ms","500":"500ms","700":"700ms","1000":"1000ms"});return r!==void 0?{"animation-delay":r}:void 0}},Em=(e)=>Fa[e.base]?{"animation-timing-function":Fa[e.base]}:void 0,ja=[im,om,sm,am,lm,cm,fm,dm,hm,gm,mm,xm,pm,ym,bm,vm,wm,Cm,$m,Rm,km,Sm,Em];var Ba={italic:"italic","not-italic":"normal"},Ua={"normal-nums":"normal",ordinal:"ordinal","slashed-zero":"slashed-zero","lining-nums":"lining-nums","oldstyle-nums":"oldstyle-nums","proportional-nums":"proportional-nums","tabular-nums":"tabular-nums","diagonal-fractions":"diagonal-fractions","stacked-fractions":"stacked-fractions"},Va={"list-inside":"inside","list-outside":"outside"},za={none:"none",disc:"disc",decimal:"decimal"},Wa={underline:"underline",overline:"overline","line-through":"line-through","no-underline":"none"},Ka={uppercase:"uppercase",lowercase:"lowercase",capitalize:"capitalize","normal-case":"none"},Ga={"text-wrap":"wrap","text-nowrap":"nowrap","text-balance":"balance","text-pretty":"pretty"},Ha={"align-baseline":"baseline","align-top":"top","align-middle":"middle","align-bottom":"bottom","align-text-top":"text-top","align-text-bottom":"text-bottom","align-sub":"sub","align-super":"super"},qa={"whitespace-normal":"normal","whitespace-nowrap":"nowrap","whitespace-pre":"pre","whitespace-pre-line":"pre-line","whitespace-pre-wrap":"pre-wrap","whitespace-break-spaces":"break-spaces"},Ya={"break-all":"break-all","break-keep":"keep-all"},Ja={"hyphens-none":"none","hyphens-manual":"manual","hyphens-auto":"auto"},Xa={"writing-horizontal-tb":"horizontal-tb","writing-vertical-rl":"vertical-rl","writing-vertical-lr":"vertical-lr"},Za={"text-orientation-mixed":"mixed","text-orientation-upright":"upright","text-orientation-sideways":"sideways"},Qa={"direction-ltr":"ltr","direction-rtl":"rtl"},el={"small-caps":"small-caps","all-small-caps":"all-small-caps","petite-caps":"petite-caps","all-petite-caps":"all-petite-caps",unicase:"unicase","titling-caps":"titling-caps","normal-caps":"normal"},tl={"ligatures-normal":"normal","ligatures-none":"none","common-ligatures":"common-ligatures","no-common-ligatures":"no-common-ligatures","discretionary-ligatures":"discretionary-ligatures","no-discretionary-ligatures":"no-discretionary-ligatures","historical-ligatures":"historical-ligatures","no-historical-ligatures":"no-historical-ligatures",contextual:"contextual","no-contextual":"no-contextual"},Am=(e,t)=>{if(e.utility==="font"&&e.value){let r=t.theme.fontFamily[e.value];if(r)return{"font-family":r.join(", ")}}},Tm=(e)=>({antialiased:{"-webkit-font-smoothing":"antialiased","-moz-osx-font-smoothing":"grayscale"},"subpixel-antialiased":{"-webkit-font-smoothing":"auto","-moz-osx-font-smoothing":"auto"}})[e.base],Nm=(e)=>Ba[e.base]?{"font-style":Ba[e.base]}:void 0,Om=(e)=>{if(e.utility==="font-stretch"&&e.value){if(["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"].includes(e.value))return{"font-stretch":e.value};if(e.arbitrary||/^\d+(?:\.\d+)?%$/.test(e.value))return{"font-stretch":e.value};return}},Im=(e)=>Ua[e.base]?{"font-variant-numeric":Ua[e.base]}:void 0,Pm=(e)=>{if(e.utility==="tracking"){let t={tighter:"-0.05em",tight:"-0.025em",normal:"0em",wide:"0.025em",wider:"0.05em",widest:"0.1em"};if(!e.value)return;if(e.arbitrary)return{"letter-spacing":e.value};if(e.value.startsWith("-")){let r=e.value.slice(1);return t[r]?{"letter-spacing":`-${t[r]}`}:void 0}return t[e.value]?{"letter-spacing":t[e.value]}:void 0}},_m=(e)=>{if(e.utility==="line-clamp"&&e.value){if(e.value==="none")return{overflow:"visible",display:"block","-webkit-box-orient":"horizontal","-webkit-line-clamp":"none"};if(!e.arbitrary&&!/^\d+$/.test(e.value))return;return{overflow:"hidden",display:"-webkit-box","-webkit-box-orient":"vertical","-webkit-line-clamp":e.value}}},Lm=(e)=>{if(e.utility==="list-image"&&e.value){if(e.value==="none")return{"list-style-image":"none"};if(e.arbitrary)return{"list-style-image":e.value};return{"list-style-image":`url(${e.value})`}}},Mm=(e)=>Va[e.base]?{"list-style-position":Va[e.base]}:void 0,Fm=(e)=>{if(e.utility!=="list"||!e.value)return;return za[e.value]?{"list-style-type":za[e.value]}:void 0},Dm=(e,t)=>{if(Wa[e.base])return{"text-decoration-line":Wa[e.base]};if(e.utility==="decoration"&&e.value){let r={solid:"solid",double:"double",dotted:"dotted",dashed:"dashed",wavy:"wavy"};if(r[e.value])return{"text-decoration-style":r[e.value]};let n={auto:"auto","from-font":"from-font","0":"0px","1":"1px","2":"2px","4":"4px","8":"8px"};if(n[e.value])return{"text-decoration-thickness":n[e.value]};if(e.arbitrary)return{"text-decoration-thickness":e.value};let i=ie(e.value,t,e.modifierArbitrary);if(i)return{"text-decoration-color":i};return}return},jm=(e)=>{if(e.utility==="underline-offset"&&e.value){let t={auto:"auto",0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"};if(t[e.value])return{"text-underline-offset":t[e.value]};if(e.arbitrary)return{"text-underline-offset":e.value};if(/^\d+(?:\.\d+)?$/.test(e.value))return{"text-underline-offset":`${e.value}px`};return}},Bm=(e)=>Ka[e.base]?{"text-transform":Ka[e.base]}:void 0,Um=(e)=>({truncate:{overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"},"text-ellipsis":{"text-overflow":"ellipsis"},"text-clip":{"text-overflow":"clip"}})[e.base],Vm=(e)=>Ga[e.base]?{"text-wrap":Ga[e.base]}:void 0,zm=(e,t)=>{if(e.utility==="indent"&&e.value){if(e.arbitrary)return{"text-indent":e.value};let r=(i)=>{let o=t.theme.spacing[i];if(o!==void 0)return o;if(/^\d+(?:\.\d+)?$/.test(i))return`${Number.parseFloat(i)*0.25}rem`;return};if(e.value.startsWith("-")){let i=r(e.value.slice(1));return i!==void 0?{"text-indent":`-${i}`}:void 0}let n=r(e.value);return n!==void 0?{"text-indent":n}:void 0}},Wm=(e)=>Ha[e.base]?{"vertical-align":Ha[e.base]}:void 0,Km=(e)=>qa[e.base]?{"white-space":qa[e.base]}:void 0,Gm=(e)=>{if(e.base==="break-normal")return{"overflow-wrap":"normal","word-break":"normal"};if(e.base==="break-words")return{"overflow-wrap":"break-word"};return Ya[e.base]?{"word-break":Ya[e.base]}:void 0},Hm=(e)=>{let t={"overflow-wrap-normal":"normal","overflow-wrap-break":"break-word","overflow-wrap-anywhere":"anywhere","wrap-normal":"normal","wrap-break-word":"break-word","wrap-anywhere":"anywhere"};return t[e.base]?{"overflow-wrap":t[e.base]}:void 0},qm=(e)=>{if(e.utility!=="tab"||!e.value)return;if(e.arbitrary||/^\d+$/.test(e.value))return{"tab-size":e.value};return},Ym=(e)=>Ja[e.base]?{hyphens:Ja[e.base]}:void 0,Jm=(e)=>{if(e.utility==="content"&&e.value){let t={none:"none"};if(t[e.value]||e.value.startsWith('"')||e.value.startsWith("'"))return{content:t[e.value]||e.value};if(e.arbitrary)return{content:e.value};return}},Xm=(e,t)=>{if(e.utility==="leading"){if(!e.value)return;let r={none:"1",tight:"1.25",snug:"1.375",normal:"1.5",relaxed:"1.625",loose:"2",3:".75rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem"};if(r[e.value])return{"line-height":r[e.value]};if(e.arbitrary)return{"line-height":e.value};if(/^\d+(?:\.\d+)?$/.test(e.value))return{"line-height":`${Number.parseFloat(e.value)*0.25}rem`};return}},Zm=(e)=>Xa[e.base]?{"writing-mode":Xa[e.base]}:void 0,Qm=(e)=>Za[e.base]?{"text-orientation":Za[e.base]}:void 0,ep=(e)=>Qa[e.base]?{direction:Qa[e.base]}:void 0,tp=(e)=>{if(e.utility==="text-emphasis"&&e.value){let t={none:"none",filled:"filled",open:"open",dot:"dot",circle:"circle","double-circle":"double-circle",triangle:"triangle",sesame:"sesame"};if(t[e.value])return{"text-emphasis":t[e.value]};return e.arbitrary?{"text-emphasis":e.value}:void 0}},rp=(e,t)=>{if(e.utility==="text-emphasis-color"&&e.value){let r=e.value.split("-");if(r.length===2){let[i,o]=r,s=t.theme.colors[i];if(typeof s==="object"&&s[o])return{"text-emphasis-color":s[o]}}let n=t.theme.colors[e.value];if(typeof n==="string")return{"text-emphasis-color":n};if(typeof n==="object"&&n!==null&&typeof n.DEFAULT==="string")return{"text-emphasis-color":n.DEFAULT}}},np=(e,t)=>{if(e.utility==="word-spacing"&&e.value){let r={tighter:"-0.05em",tight:"-0.025em",normal:"normal",wide:"0.025em",wider:"0.05em",widest:"0.1em"};if(r[e.value])return{"word-spacing":r[e.value]};if(t.theme.spacing[e.value])return{"word-spacing":t.theme.spacing[e.value]};if(e.arbitrary)return{"word-spacing":e.value};return}},ip=(e)=>el[e.base]?{"font-variant-caps":el[e.base]}:void 0,op=(e)=>tl[e.base]?{"font-variant-ligatures":tl[e.base]}:void 0,rl=[Am,Tm,Nm,Om,Im,ip,op,Pm,Xm,_m,Lm,Mm,Fm,Dm,jm,Bm,Um,Vm,zm,Wm,Km,Gm,Hm,qm,Ym,Jm,Zm,Qm,ep,tp,rp,np];var nl={"flex-row":"row","flex-row-reverse":"row-reverse","flex-col":"column","flex-col-reverse":"column-reverse"},il={"flex-wrap":"wrap","flex-wrap-reverse":"wrap-reverse","flex-nowrap":"nowrap"},ti={0:"0px",2:"2px",4:"4px",8:"8px"},sp=(e)=>{if(["block","inline-block","inline","flex","inline-flex","grid","inline-grid","hidden","none","contents","flow-root","list-item"].includes(e.utility)&&!e.value)return{display:e.utility==="hidden"?"none":e.utility};if(e.utility==="table"){if(!e.value)return{display:"table"};if(new Set(["cell","row","row-group","column","column-group","header-group","footer-group","caption"]).has(e.value))return{display:`table-${e.value}`}}if(e.utility==="inline"&&e.value==="table")return{display:"inline-table"};if(e.utility==="flow"&&e.value==="root")return{display:"flow-root"};if(e.utility==="list"&&e.value==="item")return{display:"list-item"}},ap=(e)=>{if(e.utility==="scrollbar"&&e.value){let r={auto:"auto",thin:"thin",none:"none"}[e.value];if(r)return{"scrollbar-width":r}}},lp=(e)=>{if(e.utility==="content"){if(e.value==="none")return{content:"none"};if(e.value==="empty")return{content:'""'};if(e.arbitrary&&e.value)return{content:e.value}}},cp=(e)=>{if(e.utility==="@container")return{"container-type":"inline-size"};if(e.utility==="@container-normal")return{"container-type":"normal"};if(e.utility.startsWith("@container/"))return{"container-type":"inline-size","container-name":e.utility.slice(11)}},up=(e)=>nl[e.utility]?{"flex-direction":nl[e.utility]}:void 0,fp=(e)=>il[e.utility]?{"flex-wrap":il[e.utility]}:void 0,dp=(e)=>{if(e.utility==="flex"||e.utility.startsWith("flex-")){let t={"flex-1":"1 1 0%","flex-auto":"1 1 auto","flex-initial":"0 1 auto","flex-none":"none"};if(t[e.utility])return{flex:t[e.utility]};if(e.utility==="flex"&&e.arbitrary&&e.value)return{flex:e.value.replace(/_/g," ")}}return},hp=(e)=>{if(e.utility==="flex-grow"&&!e.value)return{"flex-grow":"1"};if(e.utility==="flex-grow"&&e.value)return{"flex-grow":e.value}},gp=(e)=>{if(e.utility==="flex-shrink"&&!e.value)return{"flex-shrink":"1"};if(e.utility==="flex-shrink"&&e.value)return{"flex-shrink":e.value}},mp=(e)=>{if(e.utility==="justify"&&e.value){let t={start:"flex-start",end:"flex-end",center:"center",between:"space-between",around:"space-around",evenly:"space-evenly"};if(t[e.value])return{"justify-content":t[e.value]};if(e.arbitrary)return{"justify-content":e.value}}return},pp=(e)=>{if(e.utility==="items"&&e.value){let t={start:"flex-start",end:"flex-end",center:"center",baseline:"baseline",stretch:"stretch"};if(t[e.value])return{"align-items":t[e.value]};if(e.arbitrary)return{"align-items":e.value}}return},yp=(e)=>{if(e.utility==="justify"&&e.value&&e.value.startsWith("items-")){let t={"items-start":"start","items-end":"end","items-center":"center","items-stretch":"stretch"};return t[e.value]?{"justify-items":t[e.value]}:void 0}return},bp=(e)=>{if(e.utility==="content"&&e.value){let t={normal:"normal",center:"center",start:"flex-start",end:"flex-end",between:"space-between",around:"space-around",evenly:"space-evenly",baseline:"baseline",stretch:"stretch"};return t[e.value]?{"align-content":t[e.value]}:void 0}return},xp=(e,t)=>{let n={p:["padding"],px:["padding-left","padding-right"],py:["padding-top","padding-bottom"],pt:["padding-top"],pr:["padding-right"],pb:["padding-bottom"],pl:["padding-left"],ps:["padding-inline-start"],pe:["padding-inline-end"],m:["margin"],mx:["margin-left","margin-right"],my:["margin-top","margin-bottom"],mt:["margin-top"],mr:["margin-right"],mb:["margin-bottom"],ml:["margin-left"],ms:["margin-inline-start"],me:["margin-inline-end"]}[e.utility];if(!n||!e.value)return;let i=(c)=>{if(c==="auto")return e.utility.charCodeAt(0)===109?"auto":void 0;let a=t.theme.spacing[c];if(a!==void 0)return a;if(e.arbitrary)return c;if(/^\d+(?:\.\d+)?$/.test(c)){let l=Number.parseFloat(c);if(Number.isFinite(l))return`${l*0.25}rem`}return},o;if(e.value.startsWith("-")){if(e.utility.charCodeAt(0)===112)return;let c=e.value.slice(1);if(c==="0")o=t.theme.spacing[c]||"0";else{let a=i(c);o=a===void 0?void 0:`-${a}`}}else o=i(e.value);if(o===void 0)return;let s={};for(let c of n)s[c]=o;return s};function Ee(e,t,r){let n=e.value;if(n.includes("/")&&!e.arbitrary){let[o,s]=n.split("/").map(Number);if(Number.isNaN(o)||Number.isNaN(s)||s===0)return;return ye(o,s)}let i=t.theme.spacing[n];if(i!==void 0)return i;if(r[n])return r[n];if(e.arbitrary)return n;if(/^\d+(?:\.\d+)?$/.test(n))return`${Number.parseFloat(n)*0.25}rem`;return}var vp=(e,t)=>{if(e.utility==="w"&&e.value){let n=Ee(e,t,{full:"100%",screen:"100vw",svw:"100svw",lvw:"100lvw",dvw:"100dvw",auto:"auto",min:"min-content",max:"max-content",fit:"fit-content"});return n!==void 0?{width:n}:void 0}if(e.utility==="h"&&e.value){let n=Ee(e,t,{full:"100%",screen:"100vh",svh:"100svh",lvh:"100lvh",dvh:"100dvh",auto:"auto",min:"min-content",max:"max-content",fit:"fit-content"});return n!==void 0?{height:n}:void 0}if(e.utility==="size"&&e.value){let n=Ee(e,t,{full:"100%",auto:"auto",min:"min-content",max:"max-content",fit:"fit-content"});return n!==void 0?{width:n,height:n}:void 0}return},Le=null,Or=null,wp={bg:"background-color",text:"color",border:"border-color"},Cp={bg:{color:"background-color",image:"background-image",url:"background-image",position:"background-position",length:"background-size"},text:{color:"color",length:"font-size","absolute-size":"font-size","relative-size":"font-size","family-name":"font-family"},border:{color:"border-color",length:"border-width","line-width":"border-width"}},$p=new Set(["length","absolute-size","relative-size","percentage","number"]),Rp=/^(?:url|(?:repeating-)?(?:linear|radial|conic)-gradient|image-set|-webkit-image-set|cross-fade|element|paint)\(/i,sl={current:"currentColor",transparent:"transparent",inherit:"inherit"};function al(e){let t=new Map;for(let[r,n]of Object.entries(e))if(typeof n==="string")t.set(r,n);else if(typeof n==="object"&&n!==null){for(let[i,o]of Object.entries(n))if(typeof o==="string")t.set(i==="DEFAULT"?r:`${r}-${i}`,o)}return t}var kp=(e,t)=>{let r=wp[e.utility];if(!r||!e.value)return;let n=e.value;if(e.arbitrary&&e.typeHint){let l=Cp[e.utility]?.[e.typeHint];return l?{[l]:n}:void 0}if(e.arbitrary&&e.utility==="bg"&&Rp.test(n))return{"background-image":n};if(Le===null||Or!==t.theme.colors)Le=al(t.theme.colors),Or=t.theme.colors;let i=Se(n);if(i===-1){let l=Le.get(n);if(l)return{[r]:l}}let o,s=n;if(i!==-1){s=n.slice(0,i);let l=n.slice(i+1);if(l.charCodeAt(0)===91&&l.charCodeAt(l.length-1)===93){let f=Number.parseFloat(l.slice(1,-1));if(Number.isNaN(f)||f<0||f>1)return;o=f}else if(e.modifierArbitrary){let f=Number.parseFloat(l);if(Number.isNaN(f)||f<0||f>1)return;o=f}else{let f=Number.parseInt(l,10);if(Number.isNaN(f)||f<0||f>100)return;o=f/100}let u=Le.get(s);if(u)return{[r]:_e(u,o)}}let c=sl[s];if(c)return{[r]:c};if((e.arbitrary||s&&s.charCodeAt(0)===91)&&s){let l=o!==void 0?_e(s,o):s;return{[r]:l}}return};function _e(e,t){let r=e;if(e.charCodeAt(0)===91&&e.charCodeAt(e.length-1)===93)r=e.slice(1,-1);if(r.charCodeAt(0)===35){let n=r.slice(1);if(n.length===3||n.length===4)n=n.split("").map((c)=>c+c).join("");let i=Number.parseInt(n.slice(0,2),16),o=Number.parseInt(n.slice(2,4),16),s=Number.parseInt(n.slice(4,6),16);return`rgb(${i} ${o} ${s} / ${t})`}if(r.charCodeAt(0)===114){let n=r.match(/rgb\((\d+)\s+(\d+)\s+(\d+)/);if(n)return`rgb(${n[1]} ${n[2]} ${n[3]} / ${t})`}if(r.charCodeAt(0)===111){let n=r.match(/oklch\(([^)]+)\)/);if(n)return`oklch(${n[1]} / ${t})`}if(r.charCodeAt(0)===104){let n=r.match(/hsl\(([^)]+)\)/);if(n)return`hsl(${n[1]} / ${t})`}if(r!=="inherit"&&r!=="transparent"){let n=Number((t*100).toFixed(2));return`color-mix(in srgb, ${r} ${n}%, transparent)`}return r}function ie(e,t,r=!1){let n=Se(e),i=e,o;if(n!==-1){i=e.slice(0,n);let l=e.slice(n+1);if(l.charCodeAt(0)===91&&l.charCodeAt(l.length-1)===93){if(o=Number.parseFloat(l.slice(1,-1)),Number.isNaN(o)||o<0||o>1)return}else if(r){if(o=Number.parseFloat(l),Number.isNaN(o)||o<0||o>1)return}else{let u=Number.parseInt(l,10);if(Number.isNaN(u)||u<0||u>100)return;o=u/100}}let s={current:"currentColor",transparent:"transparent",inherit:"inherit",auto:"auto"};if(s[i])return o!==void 0?_e(s[i],o):s[i];let c=t.theme.colors[i];if(typeof c==="string")return o!==void 0?_e(c,o):c;if(typeof c==="object"&&c!==null&&typeof c.DEFAULT==="string")return o!==void 0?_e(c.DEFAULT,o):c.DEFAULT;let a=i.split("-");if(a.length>=2){let l=a[a.length-1],u=a.slice(0,-1).join("-"),f=t.theme.colors[u];if(typeof f==="object"&&f[l])return o!==void 0?_e(f[l],o):f[l]}if(i.startsWith("var(")||i.startsWith("#")||i.startsWith("rgb(")||i.startsWith("rgba(")||i.startsWith("hsl(")||i.startsWith("hsla(")||i.startsWith("oklch(")||i.startsWith("oklab(")||i.startsWith("lab(")||i.startsWith("lch(")||i.startsWith("color(")||i.startsWith("color-mix(")||i.startsWith("hwb("))return o!==void 0?_e(i,o):i;return}var Sp=(e,t)=>{if(e.utility!=="placeholder"||!e.value)return;if(Le===null||Or!==t.theme.colors)Le=al(t.theme.colors),Or=t.theme.colors;let r=e.value,n=Se(r);if(n===-1){let o=Le.get(r);if(o)return{properties:{color:o},pseudoElement:"::placeholder"}}else{let o=r.slice(0,n),s=r.slice(n+1),c;if(s.charCodeAt(0)===91&&s.charCodeAt(s.length-1)===93){let l=Number.parseFloat(s.slice(1,-1));if(Number.isNaN(l)||l<0||l>1)return;c=l}else if(e.modifierArbitrary){let l=Number.parseFloat(s);if(Number.isNaN(l)||l<0||l>1)return;c=l}else{let l=Number.parseInt(s,10);if(Number.isNaN(l)||l<0||l>100)return;c=l/100}let a=Le.get(o);if(a)return{properties:{color:_e(a,c)},pseudoElement:"::placeholder"}}let i=sl[e.value];if(i)return{properties:{color:i},pseudoElement:"::placeholder"};return},Ep=(e,t)=>{if(e.utility==="text"&&e.value){let r=e.value,n,i=r.lastIndexOf("/");if(i!==-1&&!e.value.startsWith("[")&&!r.slice(i+1).includes("]"));if(i!==-1){let s=r.slice(0,i),c=r.slice(i+1);if(c&&(t.theme.fontSize[s]||e.arbitrary)){r=s;let a={none:"1",tight:"1.25",snug:"1.375",normal:"1.5",relaxed:"1.625",loose:"2",3:"0.75rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem"};n=t.theme.lineHeight?.[c]??a[c]??c}}if(e.arbitrary){if(e.typeHint){if(!$p.has(e.typeHint))return;let c={"font-size":r};if(n)c["line-height"]=n;return c}if(/^#|^rgb|^hsl|^hwb|^lab|^lch|^oklch|^oklab|^color\(|^var\(--/.test(r))return;let s={"font-size":r};if(n)s["line-height"]=n;return s}let o=t.theme.fontSize[r];if(o)return{"font-size":o[0],"line-height":n??o[1].lineHeight}}},Ap=(e)=>{if(e.utility==="font"&&e.value){if(e.arbitrary){let r=e.typeHint;return r==="family-name"||r==="string"?{"font-family":e.value}:{"font-weight":e.value}}let t={thin:"100",extralight:"200",light:"300",normal:"400",medium:"500",semibold:"600",bold:"700",extrabold:"800",black:"900"};return t[e.value]?{"font-weight":t[e.value]}:void 0}return},Tp=(e)=>{if(e.utility==="leading"&&e.value){if(e.arbitrary)return{"line-height":e.value};let t={none:"1",tight:"1.25",snug:"1.375",normal:"1.5",relaxed:"1.625",loose:"2","3":"0.75rem","4":"1rem","5":"1.25rem","6":"1.5rem","7":"1.75rem","8":"2rem","9":"2.25rem","10":"2.5rem"};return t[e.value]?{"line-height":t[e.value]}:void 0}return},Np=(e)=>{if(e.utility==="text"&&e.value){let t={left:"left",center:"center",right:"right",justify:"justify"};return t[e.value]?{"text-align":t[e.value]}:void 0}},Op=(e)=>{if(e.utility==="border"){if(!e.value)return{"border-width":"1px"};let t={0:"0px",2:"2px",4:"4px",8:"8px"};if(t[e.value])return{"border-width":t[e.value]};let r={t:"border-top-width",r:"border-right-width",b:"border-bottom-width",l:"border-left-width",s:"border-inline-start-width",e:"border-inline-end-width"};if(e.value==="x")return{"border-left-width":"1px","border-right-width":"1px"};if(e.value==="y")return{"border-top-width":"1px","border-bottom-width":"1px"};let n=r[e.value];if(typeof n==="string")return{[n]:"1px"};return}},Ip=(e,t)=>{let r={"border-t":"border-top-width","border-r":"border-right-width","border-b":"border-bottom-width","border-l":"border-left-width","border-x":["border-left-width","border-right-width"],"border-y":["border-top-width","border-bottom-width"],"border-s":"border-inline-start-width","border-e":"border-inline-end-width"},n={"border-t":"border-top-color","border-r":"border-right-color","border-b":"border-bottom-color","border-l":"border-left-color","border-x":["border-left-color","border-right-color"],"border-y":["border-top-color","border-bottom-color"],"border-s":"border-inline-start-color","border-e":"border-inline-end-color"},i=r[e.utility];if(!i)return;if(!e.value){let s=i;if(Array.isArray(s))return s.reduce((c,a)=>({...c,[a]:"1px"}),{});return{[s]:"1px"}}if(e.arbitrary){let s=e.value,l=(/^#|^(?:rgb|rgba|hsl|hsla|oklch|oklab|lab|lch)\(|^(?:currentColor|transparent|inherit)$/i.test(s)?n[e.utility]:i)??i;if(Array.isArray(l))return l.reduce((u,f)=>({...u,[f]:s}),{});return{[l]:s}}if(ti[e.value]){let s=i;if(Array.isArray(s))return s.reduce((c,a)=>({...c,[a]:ti[e.value]}),{});return{[s]:ti[e.value]}}let o=n[e.utility];if(o&&t){let s=e.value.split("-");if(s.length>=2){let a=s[s.length-1],l=s.slice(0,-1).join("-"),u=t.theme.colors[l];if(u&&typeof u==="object"&&u[a]){let f=o;if(Array.isArray(f))return f.reduce((d,h)=>({...d,[h]:u[a]}),{});return{[f]:u[a]}}}let c=t.theme.colors[e.value];if(typeof c==="string"){let a=o;if(Array.isArray(a))return a.reduce((l,u)=>({...l,[u]:c}),{});return{[a]:c}}if(c&&typeof c==="object"&&typeof c.DEFAULT==="string"){let a=o;if(Array.isArray(a))return a.reduce((l,u)=>({...l,[u]:c.DEFAULT}),{});return{[a]:c.DEFAULT}}if(e.value==="transparent"||e.value==="current"||e.value==="inherit"){let a=e.value==="current"?"currentColor":e.value,l=o;if(Array.isArray(l))return l.reduce((u,f)=>({...u,[f]:a}),{});return{[l]:a}}}return};function Ke(e,t){if(!e.value)return t.theme.borderRadius.DEFAULT;if(t.theme.borderRadius[e.value]!==void 0)return t.theme.borderRadius[e.value];if(e.arbitrary)return e.value;return}var ol={t:["border-top-left-radius","border-top-right-radius"],r:["border-top-right-radius","border-bottom-right-radius"],b:["border-bottom-left-radius","border-bottom-right-radius"],l:["border-top-left-radius","border-bottom-left-radius"],tl:["border-top-left-radius"],tr:["border-top-right-radius"],bl:["border-bottom-left-radius"],br:["border-bottom-right-radius"],s:["border-start-start-radius","border-end-start-radius"],e:["border-start-end-radius","border-end-end-radius"],ss:["border-start-start-radius"],se:["border-start-end-radius"],es:["border-end-start-radius"],ee:["border-end-end-radius"]},Pp=(e,t)=>{if(e.utility==="rounded"){if(e.arbitrary&&e.value)return{"border-radius":e.value};if(e.value&&ol[e.value]){let o=t.theme.borderRadius.DEFAULT,s={};for(let c of ol[e.value])s[c]=o;return s}let i=e.value?t.theme.borderRadius[e.value]:t.theme.borderRadius.DEFAULT;return i?{"border-radius":i}:void 0}if(e.utility==="rounded-s"){let i=Ke(e,t);if(i===void 0)return;return{"border-start-start-radius":i,"border-end-start-radius":i}}if(e.utility==="rounded-e"){let i=Ke(e,t);if(i===void 0)return;return{"border-start-end-radius":i,"border-end-end-radius":i}}if(e.utility==="rounded-ss"){let i=Ke(e,t);if(i===void 0)return;return{"border-start-start-radius":i}}if(e.utility==="rounded-se"){let i=Ke(e,t);if(i===void 0)return;return{"border-start-end-radius":i}}if(e.utility==="rounded-es"){let i=Ke(e,t);if(i===void 0)return;return{"border-end-start-radius":i}}if(e.utility==="rounded-ee"){let i=Ke(e,t);if(i===void 0)return;return{"border-end-end-radius":i}}let n={"rounded-t":["border-top-left-radius","border-top-right-radius"],"rounded-r":["border-top-right-radius","border-bottom-right-radius"],"rounded-b":["border-bottom-left-radius","border-bottom-right-radius"],"rounded-l":["border-top-left-radius","border-bottom-left-radius"],"rounded-tl":["border-top-left-radius"],"rounded-tr":["border-top-right-radius"],"rounded-bl":["border-bottom-left-radius"],"rounded-br":["border-bottom-right-radius"]}[e.utility];if(n){let i=Ke(e,t);if(i===void 0)return;let o={};for(let s of n)o[s]=i;return o}},ri=[Ks,xp,vp,bp,Ep,Np,...rl,Ap,Tp,...Xn,Sp,kp,..._s,...Ea,up,fp,dp,hp,gp,mp,pp,yp,...zs,...ja,...Xn,...ga,...Us,Ip,Op,Pp,cp,ap,lp,sp];function ii(e,t){let r={...e};for(let n in t){let i=t[n],o=r[n];if(i&&typeof i==="object"&&!Array.isArray(i)&&o&&typeof o==="object"&&!Array.isArray(o))r[n]=ii(o,i);else if(i!==void 0)r[n]=i}return r}var _p={block:{display:"block"},"inline-block":{display:"inline-block"},inline:{display:"inline"},flex:{display:"flex"},"inline-flex":{display:"inline-flex"},grid:{display:"grid"},"inline-grid":{display:"inline-grid"},hidden:{display:"none"},none:{display:"none"}},Lp={"flex-row":{"flex-direction":"row"},"flex-row-reverse":{"flex-direction":"row-reverse"},"flex-col":{"flex-direction":"column"},"flex-col-reverse":{"flex-direction":"column-reverse"}},Mp={"flex-wrap":{"flex-wrap":"wrap"},"flex-wrap-reverse":{"flex-wrap":"wrap-reverse"},"flex-nowrap":{"flex-wrap":"nowrap"}},Fp={"flex-1":{flex:"1 1 0%"},"flex-auto":{flex:"1 1 auto"},"flex-initial":{flex:"0 1 auto"},"flex-none":{flex:"none"}},Dp={grow:{"flex-grow":"1"},"grow-0":{"flex-grow":"0"},shrink:{"flex-shrink":"1"},"shrink-0":{"flex-shrink":"0"}},jp={start:"flex-start",end:"flex-end",center:"center",between:"space-between",around:"space-around",evenly:"space-evenly"},Bp={start:"flex-start",end:"flex-end",center:"center",baseline:"baseline",stretch:"stretch"},Up={normal:"normal",center:"center",start:"flex-start",end:"flex-end",between:"space-between",around:"space-around",evenly:"space-evenly",baseline:"baseline",stretch:"stretch"},Vp={auto:"auto",start:"flex-start",end:"flex-end",center:"center",stretch:"stretch",baseline:"baseline"},zp={"border-solid":{"border-style":"solid"},"border-dashed":{"border-style":"dashed"},"border-dotted":{"border-style":"dotted"},"border-double":{"border-style":"double"},"border-none":{"border-style":"none"}},Wp={transform:{transform:kt},"transform-cpu":{transform:kt},"transform-gpu":{transform:ei},"transform-none":{transform:"none"}},lt={"transition-timing-function":"cubic-bezier(0.4, 0, 0.2, 1)","transition-duration":"150ms"},Kp={"transition-none":{"transition-property":"none"},"transition-all":{"transition-property":"all",...lt},transition:{"transition-property":"color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter",...lt},"transition-colors":{"transition-property":"color, background-color, border-color, text-decoration-color, fill, stroke",...lt},"transition-opacity":{"transition-property":"opacity",...lt},"transition-shadow":{"transition-property":"box-shadow",...lt},"transition-transform":{"transition-property":"transform",...lt}},Gp={"ease-linear":{"transition-timing-function":"linear"},"ease-in":{"transition-timing-function":"cubic-bezier(0.4, 0, 1, 1)"},"ease-out":{"transition-timing-function":"cubic-bezier(0, 0, 0.2, 1)"},"ease-in-out":{"transition-timing-function":"cubic-bezier(0.4, 0, 0.2, 1)"}},Hp={"animate-none":{animation:"none"},"animate-spin":{animation:"spin 1s linear infinite"},"animate-ping":{animation:"ping 1s cubic-bezier(0, 0, 0.2, 1) infinite"},"animate-pulse":{animation:"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite"},"animate-bounce":{animation:"bounce 1s infinite"}},qp={spin:`@keyframes spin {
|
|
355
|
+
`.trim()};var $r={content:["./src/**/*.{html,js,ts,jsx,tsx,stx}"],output:"./dist/styles.css",minify:!0,watch:!1,theme:{colors:{inherit:"inherit",current:"currentColor",transparent:"transparent",black:"#000",white:"#fff",slate:{50:"oklch(98.4% 0.003 247.858)",100:"oklch(96.8% 0.007 247.896)",200:"oklch(92.9% 0.013 255.508)",300:"oklch(86.9% 0.022 252.894)",400:"oklch(70.4% 0.04 256.788)",500:"oklch(55.4% 0.046 257.417)",600:"oklch(44.6% 0.043 257.281)",700:"oklch(37.2% 0.044 257.287)",800:"oklch(27.9% 0.041 260.031)",900:"oklch(20.8% 0.042 265.755)",950:"oklch(12.9% 0.042 264.695)"},gray:{50:"oklch(98.5% 0.002 247.839)",100:"oklch(96.7% 0.003 264.542)",200:"oklch(92.8% 0.006 264.531)",300:"oklch(87.2% 0.01 258.338)",400:"oklch(70.7% 0.022 261.325)",500:"oklch(55.1% 0.027 264.364)",600:"oklch(44.6% 0.03 256.802)",700:"oklch(37.3% 0.034 259.733)",800:"oklch(27.8% 0.033 256.848)",900:"oklch(21% 0.034 264.665)",950:"oklch(13% 0.028 261.692)"},zinc:{50:"oklch(98.5% 0 0)",100:"oklch(96.7% 0.001 286.375)",200:"oklch(92% 0.004 286.32)",300:"oklch(87.1% 0.006 286.286)",400:"oklch(70.5% 0.015 286.067)",500:"oklch(55.2% 0.016 285.938)",600:"oklch(44.2% 0.017 285.786)",700:"oklch(37% 0.013 285.805)",800:"oklch(27.4% 0.006 286.033)",900:"oklch(21% 0.006 285.885)",950:"oklch(14.1% 0.005 285.823)"},neutral:{50:"oklch(98.5% 0 0)",100:"oklch(97% 0 0)",200:"oklch(92.2% 0 0)",300:"oklch(87% 0 0)",400:"oklch(70.8% 0 0)",500:"oklch(55.6% 0 0)",600:"oklch(43.9% 0 0)",700:"oklch(37.1% 0 0)",800:"oklch(26.9% 0 0)",900:"oklch(20.5% 0 0)",950:"oklch(14.5% 0 0)"},stone:{50:"oklch(98.5% 0.001 106.423)",100:"oklch(97% 0.001 106.424)",200:"oklch(92.3% 0.003 48.717)",300:"oklch(86.9% 0.005 56.366)",400:"oklch(70.9% 0.01 56.259)",500:"oklch(55.3% 0.013 58.071)",600:"oklch(44.4% 0.011 73.639)",700:"oklch(37.4% 0.01 67.558)",800:"oklch(26.8% 0.007 34.298)",900:"oklch(21.6% 0.006 56.043)",950:"oklch(14.7% 0.004 49.25)"},red:{50:"oklch(97.1% 0.013 17.38)",100:"oklch(93.6% 0.032 17.717)",200:"oklch(88.5% 0.062 18.334)",300:"oklch(80.8% 0.114 19.571)",400:"oklch(70.4% 0.191 22.216)",500:"oklch(63.7% 0.237 25.331)",600:"oklch(57.7% 0.245 27.325)",700:"oklch(50.5% 0.213 27.518)",800:"oklch(44.4% 0.177 26.899)",900:"oklch(39.6% 0.141 25.723)",950:"oklch(25.8% 0.092 26.042)"},orange:{50:"oklch(98% 0.016 73.684)",100:"oklch(95.4% 0.038 75.164)",200:"oklch(90.1% 0.076 70.697)",300:"oklch(83.7% 0.128 66.29)",400:"oklch(75% 0.183 55.934)",500:"oklch(70.5% 0.213 47.604)",600:"oklch(64.6% 0.222 41.116)",700:"oklch(55.3% 0.195 38.402)",800:"oklch(47% 0.157 37.304)",900:"oklch(40.8% 0.123 38.172)",950:"oklch(26.6% 0.079 36.259)"},amber:{50:"oklch(98.7% 0.022 95.277)",100:"oklch(96.2% 0.059 95.617)",200:"oklch(92.4% 0.12 95.746)",300:"oklch(87.9% 0.169 91.605)",400:"oklch(82.8% 0.189 84.429)",500:"oklch(76.9% 0.188 70.08)",600:"oklch(66.6% 0.179 58.318)",700:"oklch(55.5% 0.163 48.998)",800:"oklch(47.3% 0.137 46.201)",900:"oklch(41.4% 0.112 45.904)",950:"oklch(27.9% 0.077 45.635)"},yellow:{50:"oklch(98.7% 0.026 102.212)",100:"oklch(97.3% 0.071 103.193)",200:"oklch(94.5% 0.129 101.54)",300:"oklch(90.5% 0.182 98.111)",400:"oklch(85.2% 0.199 91.936)",500:"oklch(79.5% 0.184 86.047)",600:"oklch(68.1% 0.162 75.834)",700:"oklch(55.4% 0.135 66.442)",800:"oklch(47.6% 0.114 61.907)",900:"oklch(42.1% 0.095 57.708)",950:"oklch(28.6% 0.066 53.813)"},lime:{50:"oklch(98.6% 0.031 120.757)",100:"oklch(96.7% 0.067 122.328)",200:"oklch(93.8% 0.127 124.321)",300:"oklch(89.7% 0.196 126.665)",400:"oklch(84.1% 0.238 128.85)",500:"oklch(76.8% 0.233 130.85)",600:"oklch(64.8% 0.2 131.684)",700:"oklch(53.2% 0.157 131.589)",800:"oklch(45.3% 0.124 130.933)",900:"oklch(40.5% 0.101 131.063)",950:"oklch(27.4% 0.072 132.109)"},green:{50:"oklch(98.2% 0.018 155.826)",100:"oklch(96.2% 0.044 156.743)",200:"oklch(92.5% 0.084 155.995)",300:"oklch(87.1% 0.15 154.449)",400:"oklch(79.2% 0.209 151.711)",500:"oklch(72.3% 0.219 149.579)",600:"oklch(62.7% 0.194 149.214)",700:"oklch(52.7% 0.154 150.069)",800:"oklch(44.8% 0.119 151.328)",900:"oklch(39.3% 0.095 152.535)",950:"oklch(26.6% 0.065 152.934)"},emerald:{50:"oklch(97.9% 0.021 166.113)",100:"oklch(95% 0.052 163.051)",200:"oklch(90.5% 0.093 164.15)",300:"oklch(84.5% 0.143 164.978)",400:"oklch(76.5% 0.177 163.223)",500:"oklch(69.6% 0.17 162.48)",600:"oklch(59.6% 0.145 163.225)",700:"oklch(50.8% 0.118 165.612)",800:"oklch(43.2% 0.095 166.913)",900:"oklch(37.8% 0.077 168.94)",950:"oklch(26.2% 0.051 172.552)"},teal:{50:"oklch(98.4% 0.014 180.72)",100:"oklch(95.3% 0.051 180.801)",200:"oklch(91% 0.096 180.426)",300:"oklch(85.5% 0.138 181.071)",400:"oklch(77.7% 0.152 181.912)",500:"oklch(70.4% 0.14 182.503)",600:"oklch(60% 0.118 184.704)",700:"oklch(51.1% 0.096 186.391)",800:"oklch(43.7% 0.078 188.216)",900:"oklch(38.6% 0.063 188.416)",950:"oklch(27.7% 0.046 192.524)"},cyan:{50:"oklch(98.4% 0.019 200.873)",100:"oklch(95.6% 0.045 203.388)",200:"oklch(91.7% 0.08 205.041)",300:"oklch(86.5% 0.127 207.078)",400:"oklch(78.9% 0.154 211.53)",500:"oklch(71.5% 0.143 215.221)",600:"oklch(60.9% 0.126 221.723)",700:"oklch(52% 0.105 223.128)",800:"oklch(45% 0.085 224.283)",900:"oklch(39.8% 0.07 227.392)",950:"oklch(30.2% 0.056 229.695)"},sky:{50:"oklch(97.7% 0.013 236.62)",100:"oklch(95.1% 0.026 236.824)",200:"oklch(90.1% 0.058 230.902)",300:"oklch(82.8% 0.111 230.318)",400:"oklch(74.6% 0.16 232.661)",500:"oklch(68.5% 0.169 237.323)",600:"oklch(58.8% 0.158 241.966)",700:"oklch(50% 0.134 242.749)",800:"oklch(44.3% 0.11 240.79)",900:"oklch(39.1% 0.09 240.876)",950:"oklch(29.3% 0.066 243.157)"},blue:{50:"oklch(97% 0.014 254.604)",100:"oklch(93.2% 0.032 255.585)",200:"oklch(88.2% 0.059 254.128)",300:"oklch(80.9% 0.105 251.813)",400:"oklch(70.7% 0.165 254.624)",500:"oklch(62.3% 0.214 259.815)",600:"oklch(54.6% 0.245 262.881)",700:"oklch(48.8% 0.243 264.376)",800:"oklch(42.4% 0.199 265.638)",900:"oklch(37.9% 0.146 265.522)",950:"oklch(28.2% 0.091 267.935)"},indigo:{50:"oklch(96.2% 0.018 272.314)",100:"oklch(93% 0.034 272.788)",200:"oklch(87% 0.065 274.039)",300:"oklch(78.5% 0.115 274.713)",400:"oklch(67.3% 0.182 276.935)",500:"oklch(58.5% 0.233 277.117)",600:"oklch(51.1% 0.262 276.966)",700:"oklch(45.7% 0.24 277.023)",800:"oklch(39.8% 0.195 277.366)",900:"oklch(35.9% 0.144 278.697)",950:"oklch(25.7% 0.09 281.288)"},violet:{50:"oklch(96.9% 0.016 293.756)",100:"oklch(94.3% 0.029 294.588)",200:"oklch(89.4% 0.057 293.283)",300:"oklch(81.1% 0.111 293.571)",400:"oklch(70.2% 0.183 293.541)",500:"oklch(60.6% 0.25 292.717)",600:"oklch(54.1% 0.281 293.009)",700:"oklch(49.1% 0.27 292.581)",800:"oklch(43.2% 0.232 292.759)",900:"oklch(38% 0.189 293.745)",950:"oklch(28.3% 0.141 291.089)"},purple:{50:"oklch(97.7% 0.014 308.299)",100:"oklch(94.6% 0.033 307.174)",200:"oklch(90.2% 0.063 306.703)",300:"oklch(82.7% 0.119 306.383)",400:"oklch(71.4% 0.203 305.504)",500:"oklch(62.7% 0.265 303.9)",600:"oklch(55.8% 0.288 302.321)",700:"oklch(49.6% 0.265 301.924)",800:"oklch(43.8% 0.218 303.724)",900:"oklch(38.1% 0.176 304.987)",950:"oklch(29.1% 0.149 302.717)"},fuchsia:{50:"oklch(97.7% 0.017 320.058)",100:"oklch(95.2% 0.037 318.852)",200:"oklch(90.3% 0.076 319.62)",300:"oklch(83.3% 0.145 321.434)",400:"oklch(74% 0.238 322.16)",500:"oklch(66.7% 0.295 322.15)",600:"oklch(59.1% 0.293 322.896)",700:"oklch(51.8% 0.253 323.949)",800:"oklch(45.2% 0.211 324.591)",900:"oklch(40.1% 0.17 325.612)",950:"oklch(29.3% 0.136 325.661)"},pink:{50:"oklch(97.1% 0.014 343.198)",100:"oklch(94.8% 0.028 342.258)",200:"oklch(89.9% 0.061 343.231)",300:"oklch(82.3% 0.12 346.018)",400:"oklch(71.8% 0.202 349.761)",500:"oklch(65.6% 0.241 354.308)",600:"oklch(59.2% 0.249 0.584)",700:"oklch(52.5% 0.223 3.958)",800:"oklch(45.9% 0.187 3.815)",900:"oklch(40.8% 0.153 2.432)",950:"oklch(28.4% 0.109 3.907)"},rose:{50:"oklch(96.9% 0.015 12.422)",100:"oklch(94.1% 0.03 12.58)",200:"oklch(89.2% 0.058 10.001)",300:"oklch(81% 0.117 11.638)",400:"oklch(71.2% 0.194 13.428)",500:"oklch(64.5% 0.246 16.439)",600:"oklch(58.6% 0.253 17.585)",700:"oklch(51.4% 0.222 16.935)",800:"oklch(45.5% 0.188 13.697)",900:"oklch(41% 0.159 10.272)",950:"oklch(27.1% 0.105 12.094)"}},spacing:{0:"0",px:"1px",0.5:"0.125rem",1:"0.25rem",1.5:"0.375rem",2:"0.5rem",2.5:"0.625rem",3:"0.75rem",3.5:"0.875rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem",11:"2.75rem",12:"3rem",14:"3.5rem",16:"4rem",20:"5rem",24:"6rem",28:"7rem",32:"8rem",36:"9rem",40:"10rem",44:"11rem",48:"12rem",52:"13rem",56:"14rem",60:"15rem",64:"16rem",72:"18rem",80:"20rem",96:"24rem"},fontSize:{xs:["0.75rem",{lineHeight:"1rem"}],sm:["0.875rem",{lineHeight:"1.25rem"}],base:["1rem",{lineHeight:"1.5rem"}],lg:["1.125rem",{lineHeight:"1.75rem"}],xl:["1.25rem",{lineHeight:"1.75rem"}],"2xl":["1.5rem",{lineHeight:"2rem"}],"3xl":["1.875rem",{lineHeight:"2.25rem"}],"4xl":["2.25rem",{lineHeight:"2.5rem"}],"5xl":["3rem",{lineHeight:"1"}],"6xl":["3.75rem",{lineHeight:"1"}],"7xl":["4.5rem",{lineHeight:"1"}],"8xl":["6rem",{lineHeight:"1"}],"9xl":["8rem",{lineHeight:"1"}]},fontFamily:{sans:["ui-sans-serif","system-ui","sans-serif"],serif:["ui-serif","Georgia","serif"],mono:["ui-monospace","monospace"]},screens:{sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},borderRadius:{none:"0",xs:"0.125rem",sm:"0.25rem",DEFAULT:"0.25rem",md:"0.375rem",lg:"0.5rem",xl:"0.75rem","2xl":"1rem","3xl":"1.5rem","4xl":"2rem",full:"9999px"},boxShadow:{"2xs":"0 1px rgb(0 0 0 / 0.05)",xs:"0 1px 2px 0 rgb(0 0 0 / 0.05)",sm:"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",DEFAULT:"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",md:"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",lg:"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",xl:"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)",none:"none"}},shortcuts:{},rules:[],attributify:{enabled:!1,prefix:"tc-",ignoreAttributes:["class","className","style","id","name","type","value","href","src","alt","title","role","for","action","method","target","rel","placeholder","disabled","checked","selected","readonly","required","maxlength","minlength","pattern","autocomplete","autofocus","tabindex","contenteditable","draggable","spellcheck","lang","dir","hidden","slot","part","is","key","ref"]},bracketSyntax:{enabled:!1,colonSyntax:!1,aliases:{col:"col",row:"row",jc:"justify",ji:"justify-items",js:"justify-self",ai:"items",ac:"content",as:"self",wrap:"wrap",nowrap:"nowrap",c:"center",s:"start",e:"end",sb:"between",sa:"around",se:"evenly",st:"stretch"}},variants:{responsive:!0,hover:!0,focus:!0,active:!0,disabled:!0,dark:!0,light:!0,group:!0,peer:!0,before:!0,after:!0,marker:!0,first:!0,last:!0,odd:!0,even:!0,"first-of-type":!0,"last-of-type":!0,visited:!0,checked:!0,"focus-within":!0,"focus-visible":!0,placeholder:!0,selection:!0,file:!0,required:!0,valid:!0,invalid:!0,"read-only":!0,autofill:!0,open:!0,closed:!0,empty:!0,enabled:!0,only:!0,target:!0,indeterminate:!0,default:!0,optional:!0,aria:!0,data:!0,has:!0,not:!0,supports:!0,print:!0,landscape:!0,portrait:!0,"forced-colors":!0,rtl:!0,ltr:!0,"motion-safe":!0,"motion-reduce":!0,"contrast-more":!0,"contrast-less":!0},safelist:[],blocklist:[],preflights:[Bt],presets:[],cssVariables:!1},qn=null;async function Os(){if(!qn){await Promise.resolve().then(() => Ns());qn=await Ts({name:"css",defaultConfig:$r})}return qn}var Yn=$r;function Se(e){if(e.indexOf("/")===-1)return-1;let r=0,n=0,i="";for(let o=0;o<e.length;o++){let s=e[o];if(s==="\\"){o++;continue}if(i){if(s===i)i="";continue}if(s==='"'||s==="'"){i=s;continue}if(s==="(")r++;else if(s===")")r=Math.max(0,r-1);else if(s==="[")n++;else if(s==="]")n=Math.max(0,n-1);else if(s==="/"&&r===0&&n===0)return o}return-1}var Rr={"0":"0",full:"100%",min:"min-content",max:"max-content",fit:"fit-content",none:"none",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem",screen:"100vw"};function _s(e,t,r){let n=e.value;if(t[n])return{[r]:t[n]};if(e.arbitrary)return{[r]:n};if(/^\d+$/.test(n)){let i=Number.parseInt(n,10);if(i>=0&&i<=100)return{[r]:`${i/100}`}}return}var Hd=(e,t)=>{if(e.utility==="min-w"&&e.value){let r=Ee(e,t,Rr);return r!==void 0?{"min-width":r}:void 0}if(e.utility==="max-w"&&e.value){let r=Ee(e,t,Rr);return r!==void 0?{"max-width":r}:void 0}if(e.utility==="min-h"&&e.value){let r={...Rr,screen:"100vh"},n=Ee(e,t,r);return n!==void 0?{"min-height":n}:void 0}if(e.utility==="max-h"&&e.value){let r={...Rr,screen:"100vh"},n=Ee(e,t,r);return n!==void 0?{"max-height":n}:void 0}},qd=(e,t)=>{if(e.utility==="ring"){if(e.value==="inset")return{"--tc-ring-inset":"inset"};if(e.value){let i=ie(e.value,t,e.modifierArbitrary);if(i)return{"--tc-ring-color":i}}let r={0:"0",1:"1px",2:"2px",4:"4px",8:"8px",DEFAULT:"3px"},n;if(!e.value)n=r.DEFAULT;else if(r[e.value])n=r[e.value];else if(e.arbitrary)n=e.value;else if(/^\d+(?:\.\d+)?$/.test(e.value))n=`${e.value}px`;if(n===void 0)return;return{"--tc-ring-offset-shadow":"var(--tc-ring-inset,) 0 0 0 var(--tc-ring-offset-width, 0px) var(--tc-ring-offset-color, #fff)","--tc-ring-shadow":`var(--tc-ring-inset,) 0 0 0 calc(${n} + var(--tc-ring-offset-width, 0px)) var(--tc-ring-color, rgba(59, 130, 246, 0.5))`,"box-shadow":"var(--tc-ring-offset-shadow), var(--tc-ring-shadow), var(--tc-shadow, 0 0 #0000)"}}if(e.utility==="ring-offset"&&e.value){let r={0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"};if(r[e.value])return{"--tc-ring-offset-width":r[e.value]};let n=ie(e.value,t,e.modifierArbitrary);if(n)return{"--tc-ring-offset-color":n}}if(e.utility==="ring-opacity"&&e.value)return _s(e,{0:"0",5:"0.05",10:"0.1",20:"0.2",25:"0.25",30:"0.3",40:"0.4",50:"0.5",60:"0.6",70:"0.7",75:"0.75",80:"0.8",90:"0.9",95:"0.95",100:"1"},"--tc-ring-opacity")},Yd=(e)=>{if(e.utility==="border-opacity"&&e.value)return _s(e,{0:"0",5:"0.05",10:"0.1",20:"0.2",25:"0.25",30:"0.3",40:"0.4",50:"0.5",60:"0.6",70:"0.7",75:"0.75",80:"0.8",90:"0.9",95:"0.95",100:"1"},"--tc-border-opacity")};function Is(e,t){let r=e.value;if(e.arbitrary)return r;let n=r.startsWith("-"),i=n?r.slice(1):r,o=t.theme.spacing[i];if(o===void 0&&/^\d+(?:\.\d+)?$/.test(i))o=`${Number.parseFloat(i)*0.25}rem`;if(o===void 0)return;return n?`-${o}`:o}var Jd=(e,t)=>{if(e.utility==="space-x"&&e.value){if(e.value==="reverse")return{properties:{"--tc-space-x-reverse":"1"},childSelector:"> :not([hidden]) ~ :not([hidden])"};let r=Is(e,t);if(r===void 0)return;return{properties:{"--tc-space-x-reverse":"0","margin-right":`calc(${r} * var(--tc-space-x-reverse))`,"margin-left":`calc(${r} * calc(1 - var(--tc-space-x-reverse)))`},childSelector:"> :not([hidden]) ~ :not([hidden])"}}if(e.utility==="space-y"&&e.value){if(e.value==="reverse")return{properties:{"--tc-space-y-reverse":"1"},childSelector:"> :not([hidden]) ~ :not([hidden])"};let r=Is(e,t);if(r===void 0)return;return{properties:{"--tc-space-y-reverse":"0","margin-top":`calc(${r} * calc(1 - var(--tc-space-y-reverse)))`,"margin-bottom":`calc(${r} * var(--tc-space-y-reverse))`},childSelector:"> :not([hidden]) ~ :not([hidden])"}}},Xd=(e)=>{if(e.utility==="border"&&e.value){let t={solid:"solid",dashed:"dashed",dotted:"dotted",double:"double",hidden:"hidden",none:"none"};if(t[e.value])return{"border-style":t[e.value]}}};function Ps(e){if(!e.value)return"1px";let t={0:"0",2:"2px",4:"4px",8:"8px"};if(t[e.value])return t[e.value];if(e.arbitrary)return e.value;if(/^\d+(?:\.\d+)?$/.test(e.value))return`${e.value}px`;return}function Zd(e){let t=Se(e),r=t===-1?e:e.slice(0,t);if(r.charCodeAt(0)!==91||r.charCodeAt(r.length-1)!==93)return e;let n=r.slice(1,-1).replace(/_/g," ");return t===-1?n:n+e.slice(t)}var Qd=(e,t)=>{if(e.utility==="divide"&&e.value){let r={solid:"solid",dashed:"dashed",dotted:"dotted",double:"double",none:"none"};if(r[e.value])return{properties:{"border-style":r[e.value]},childSelector:"> :not([hidden]) ~ :not([hidden])"}}if(e.utility==="divide-x"){if(e.value==="reverse")return{properties:{"--tc-divide-x-reverse":"1"},childSelector:"> :not([hidden]) ~ :not([hidden])"};let r=Ps(e);if(r===void 0)return;return{properties:{"--tc-divide-x-reverse":"0","border-right-width":`calc(${r} * var(--tc-divide-x-reverse))`,"border-left-width":`calc(${r} * calc(1 - var(--tc-divide-x-reverse)))`},childSelector:"> :not([hidden]) ~ :not([hidden])"}}if(e.utility==="divide-y"){if(e.value==="reverse")return{properties:{"--tc-divide-y-reverse":"1"},childSelector:"> :not([hidden]) ~ :not([hidden])"};let r=Ps(e);if(r===void 0)return;return{properties:{"--tc-divide-y-reverse":"0","border-top-width":`calc(${r} * calc(1 - var(--tc-divide-y-reverse)))`,"border-bottom-width":`calc(${r} * var(--tc-divide-y-reverse))`},childSelector:"> :not([hidden]) ~ :not([hidden])"}}if(e.utility==="divide"&&e.value){let r=Zd(e.value);if(r==="auto")return;let n=ie(r,t,e.modifierArbitrary);if(n!==void 0)return{properties:{"border-color":n},childSelector:"> :not([hidden]) ~ :not([hidden])"}}},eh=(e,t)=>{let r=(n)=>{let i=null,o=n,s=Se(n);if(s!==-1){o=n.slice(0,s);let u=n.slice(s+1);if(u.startsWith("[")&&u.endsWith("]"))i=u.slice(1,-1);else if(e.modifierArbitrary){let f=Number.parseFloat(u);if(!Number.isNaN(f)&&f>=0&&f<=1)i=f.toString()}else{let f=Number.parseInt(u,10);if(!Number.isNaN(f))i=(f/100).toString()}}let c=(u)=>{if(!i)return u;let f=u.match(/^(oklch|rgb|hsl|oklab|lab|lch)\(([^)]+)\)$/i);if(f){let d=f[1],h=f[2].split("/")[0].trim();return`${d}(${h} / ${i})`}if(/^#[0-9a-f]{3,8}$/i.test(u)){let d=u.replace("#",""),h=(y)=>Number.parseInt(y.length===1?y+y:y,16),m=h(d.slice(0,d.length===3?1:2)),p=h(d.slice(d.length===3?1:2,d.length===3?2:4)),g=h(d.slice(d.length===3?2:4,d.length===3?3:6));return`rgb(${m} ${p} ${g} / ${i})`}return`color-mix(in srgb, ${u} ${Math.round(Number.parseFloat(i)*100)}%, transparent)`};if(o.startsWith("[")&&o.endsWith("]"))o=o.slice(1,-1);let a=t.theme.colors[o];if(typeof a==="string")return c(a);if(typeof a==="object"&&a!==null&&typeof a.DEFAULT==="string")return c(a.DEFAULT);let l=o.split("-");if(l.length>=2){let u=l.slice(0,-1).join("-"),f=l[l.length-1],d=t.theme.colors[u];if(typeof d==="object"&&d[f])return c(d[f])}if(e.arbitrary||o.startsWith("#")||/^(?:var|rgb|rgba|hsl|hsla|oklch|oklab|lab|lch|color|color-mix)\(/.test(o))return c(o);return};if(e.utility==="from"&&e.value){let n=r(e.value);if(n===void 0)return;return{"--tc-gradient-from":n,"--tc-gradient-to":"rgb(255 255 255 / 0)","--tc-gradient-stops":"var(--tc-gradient-from), var(--tc-gradient-to)"}}if(e.utility==="via"&&e.value){let n=r(e.value);if(n===void 0)return;return{"--tc-gradient-to":"rgb(255 255 255 / 0)","--tc-gradient-stops":`var(--tc-gradient-from), ${n}, var(--tc-gradient-to)`}}if(e.utility==="to"&&e.value){let n=r(e.value);if(n===void 0)return;return{"--tc-gradient-to":n,"--tc-gradient-stops":"var(--tc-gradient-from), var(--tc-gradient-to)"}}},th=(e)=>{if(e.utility==="order"&&e.value){let t={first:"-9999",last:"9999",none:"0"};if(t[e.value])return{order:t[e.value]};if(e.arbitrary||/^-?\d+$/.test(e.value))return{order:e.value};return}},rh=(e,t)=>{if(e.utility==="basis"&&e.value){let r={auto:"auto",full:"100%",0:"0"};if(r[e.value])return{"flex-basis":r[e.value]};let n=Ee(e,t,{});return n!==void 0?{"flex-basis":n}:void 0}},nh=(e)=>{if(e.utility==="justify-self"){let t={auto:"auto",start:"start",end:"end",center:"center",stretch:"stretch"};return e.value&&t[e.value]?{"justify-self":t[e.value]}:void 0}},ih=(e)=>{if(e.utility==="self"){let t={auto:"auto",start:"flex-start",end:"flex-end",center:"center",stretch:"stretch",baseline:"baseline"};return e.value&&t[e.value]?{"align-self":t[e.value]}:void 0}},oh=(e,t)=>{if(e.utility==="container"){if(!e.value)return{width:"100%","margin-left":"auto","margin-right":"auto","max-width":t.theme.screens.xl||"1280px"};let r={sm:t.theme.screens.sm||"640px",md:t.theme.screens.md||"768px",lg:t.theme.screens.lg||"1024px",xl:t.theme.screens.xl||"1280px","2xl":t.theme.screens["2xl"]||"1536px",full:"100%",prose:"65ch","3xl":"1920px"};if(r[e.value])return{width:"100%","margin-left":"auto","margin-right":"auto","max-width":r[e.value]};if(e.arbitrary)return{width:"100%","margin-left":"auto","margin-right":"auto","max-width":e.value}}},sh=(e)=>{if(e.arbitrary&&e.utility&&e.value&&e.base.startsWith("["))return{[e.utility]:e.value}},Ls=[Hd,qd,Yd,Xd,Jd,Qd,eh,th,rh,nh,ih,oh,sh];var Ms={"bg-origin-border":"border-box","bg-origin-padding":"padding-box","bg-origin-content":"content-box"},Fs={"bg-bottom":"bottom","bg-center":"center","bg-left":"left","bg-left-bottom":"left bottom","bg-left-top":"left top","bg-right":"right","bg-right-bottom":"right bottom","bg-right-top":"right top","bg-top":"top"},Ds={"bg-repeat":"repeat","bg-no-repeat":"no-repeat","bg-repeat-x":"repeat-x","bg-repeat-y":"repeat-y","bg-repeat-round":"round","bg-repeat-space":"space"},js={"bg-auto":"auto","bg-cover":"cover","bg-contain":"contain"},Jn=null,Bs=null;function ah(e){let t=new Map;for(let[r,n]of Object.entries(e))if(typeof n==="string")t.set(r,n);else if(typeof n==="object"&&n!==null){for(let[i,o]of Object.entries(n))if(typeof o==="string")t.set(i==="DEFAULT"?r:`${r}-${i}`,o)}return t}function lh(e,t){if(e.charCodeAt(0)===35){let r=e.slice(1);if(r.length===3)r=r[0]+r[0]+r[1]+r[1]+r[2]+r[2];let n=Number.parseInt(r.slice(0,2),16),i=Number.parseInt(r.slice(2,4),16),o=Number.parseInt(r.slice(4,6),16);return`rgb(${n} ${i} ${o} / ${t})`}return e}function ch(e){return e.replace(/rgba?\([^)]+\)/g,"var(--tc-shadow-color)")}var uh=(e)=>{if(e.utility==="bg"&&e.value){let t={fixed:"fixed",local:"local",scroll:"scroll"};return t[e.value]?{"background-attachment":t[e.value]}:void 0}return},fh=(e)=>{if(e.utility==="bg"&&e.value&&e.value.startsWith("clip-")){let t=e.value.replace("clip-",""),r={border:"border-box",padding:"padding-box",content:"content-box",text:"text"};return r[t]?{"background-clip":r[t]}:void 0}return},dh={t:"to top",tr:"to top right",r:"to right",br:"to bottom right",b:"to bottom",bl:"to bottom left",l:"to left",tl:"to top left"},hh=(e)=>{if(!e.value)return;let t;if(e.utility==="bg-linear"||e.utility==="bg-gradient")t=e.value;else if(e.utility==="bg"){if(e.typeHint||e.value.includes("("))return;let r=e.value.startsWith("-"),i=(r?e.value.slice(1):e.value).match(/^(?:gradient|linear)-(.+)$/);if(!i)return;t=r?`-${i[1]}`:i[1]}else return;if(t.startsWith("to-")){let r=dh[t.slice(3)];return r?{"background-image":`linear-gradient(${r}, var(--tc-gradient-stops))`}:void 0}if(e.arbitrary)return{"background-image":`linear-gradient(${t}, var(--tc-gradient-stops))`};if(/^-?\d+(?:\.\d+)?$/.test(t))return{"background-image":`linear-gradient(${t}deg, var(--tc-gradient-stops))`};return},gh=(e)=>Ms[e.base]?{"background-origin":Ms[e.base]}:void 0,mh=(e)=>Fs[e.base]?{"background-position":Fs[e.base]}:void 0,ph=(e)=>Ds[e.base]?{"background-repeat":Ds[e.base]}:void 0,yh=(e)=>js[e.base]?{"background-size":js[e.base]}:void 0,bh=(e)=>{if(e.utility==="border"&&e.value){let t={solid:"solid",dashed:"dashed",dotted:"dotted",double:"double",hidden:"hidden",none:"none"};return t[e.value]?{"border-style":t[e.value]}:void 0}return},xh=(e,t)=>{if(e.utility==="outline-offset"&&e.value){let r={0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"};if(r[e.value])return{"outline-offset":r[e.value]};if(e.arbitrary)return{"outline-offset":e.value};if(/^\d+(?:\.\d+)?$/.test(e.value))return{"outline-offset":`${e.value}px`};return}if(e.utility==="outline"&&e.value){let r={none:"none",solid:"solid",dashed:"dashed",dotted:"dotted",double:"double"};if(r[e.value])return{"outline-style":r[e.value]};if(e.value==="hidden")return{outline:"2px solid transparent","outline-offset":"2px"}}if(e.utility==="outline"){if(!e.value)return{"outline-width":"1px"};let r=ie(e.value,t,e.modifierArbitrary);if(r)return{"outline-color":r};let n={0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"};if(n[e.value])return{"outline-width":n[e.value]};if(e.arbitrary)return{"outline-width":e.value};if(/^\d+(?:\.\d+)?$/.test(e.value))return{"outline-width":`${e.value}px`};return}},vh=(e,t)=>{if(e.utility==="shadow"){let n=e.arbitrary&&!!e.value&&(/\s/.test(e.value)||e.value==="none")?e.value:e.value?t.theme.boxShadow[e.value]:t.theme.boxShadow.DEFAULT;if(!n)return;if(n==="none")return{"--tc-shadow":"0 0 #0000","box-shadow":"var(--tc-ring-offset-shadow, 0 0 #0000), var(--tc-ring-shadow, 0 0 #0000), var(--tc-shadow)"};let i=ch(n);return{"--tc-shadow":n,"--tc-shadow-colored":i,"box-shadow":"var(--tc-ring-offset-shadow, 0 0 #0000), var(--tc-ring-shadow, 0 0 #0000), var(--tc-shadow)"}}},wh=(e,t)=>{if(e.utility!=="shadow"||!e.value)return;if(t.theme.boxShadow[e.value])return;if(e.arbitrary&&/\s/.test(e.value))return;if(Jn===null||Bs!==t.theme.colors)Jn=ah(t.theme.colors),Bs=t.theme.colors;let r=e.value,n=Se(r),i,o;if(n!==-1){i=r.slice(0,n);let a=r.slice(n+1);if(a.charCodeAt(0)===91&&a.charCodeAt(a.length-1)===93){let l=Number.parseFloat(a.slice(1,-1));if(Number.isNaN(l)||l<0||l>1)return;o=l}else if(e.modifierArbitrary){let l=Number.parseFloat(a);if(Number.isNaN(l)||l<0||l>1)return;o=l}else{let l=Number.parseInt(a,10);if(Number.isNaN(l)||l<0||l>100)return;o=l/100}}else i=r;let s=Jn.get(i)??(e.arbitrary?i:void 0);if(!s)return;return{"--tc-shadow-color":o!==void 0?lh(s,o):s,"--tc-shadow":"var(--tc-shadow-colored)"}},Ch=(e)=>{if(e.utility==="text-shadow"){let t={sm:"0 1px 2px rgba(0, 0, 0, 0.05)",DEFAULT:"0 1px 3px rgba(0, 0, 0, 0.1)",md:"0 4px 6px rgba(0, 0, 0, 0.1)",lg:"0 10px 15px rgba(0, 0, 0, 0.1)",xl:"0 20px 25px rgba(0, 0, 0, 0.1)",none:"none"};if(!e.value)return{"text-shadow":t.DEFAULT};if(t[e.value])return{"text-shadow":t[e.value]};return e.arbitrary?{"text-shadow":e.value}:void 0}},$h=(e)=>{if(e.utility==="opacity"&&e.value){let t={0:"0",5:"0.05",10:"0.1",20:"0.2",25:"0.25",30:"0.3",40:"0.4",50:"0.5",60:"0.6",70:"0.7",75:"0.75",80:"0.8",90:"0.9",95:"0.95",100:"1"};if(t[e.value])return{opacity:t[e.value]};if(e.arbitrary)return{opacity:e.value};if(/^\d+$/.test(e.value)){let r=Number.parseInt(e.value,10);if(r>=0&&r<=100)return{opacity:`${r/100}`}}return}},Rh=(e)=>{if(e.utility==="mix-blend"){let t=["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"];return e.value&&t.includes(e.value)?{"mix-blend-mode":e.value}:void 0}},kh=(e)=>{if(e.utility==="bg-blend"){let t=["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"];return e.value&&t.includes(e.value)?{"background-blend-mode":e.value}:void 0}},Sh=(e)=>{if(e.utility==="mask-clip"&&e.value){let t={border:"border-box",padding:"padding-box",content:"content-box",text:"text",fill:"fill-box",stroke:"stroke-box",view:"view-box","no-clip":"no-clip"};if(t[e.value])return{"mask-clip":t[e.value]};return e.arbitrary?{"mask-clip":e.value}:void 0}if(e.utility==="mask-composite"&&e.value)return["add","subtract","intersect","exclude"].includes(e.value)?{"mask-composite":e.value}:void 0;if(e.utility==="mask-image"&&e.value){if(e.value==="none")return{"mask-image":"none"};if(e.arbitrary)return{"mask-image":e.value.startsWith("url(")||e.value.includes("gradient(")?e.value:`url(${e.value})`};return}if(e.utility==="mask-mode"&&e.value)return["alpha","luminance","match-source"].includes(e.value)?{"mask-mode":e.value}:void 0;if(e.utility==="mask-origin"&&e.value){let t={border:"border-box",padding:"padding-box",content:"content-box",fill:"fill-box",stroke:"stroke-box",view:"view-box"};if(t[e.value])return{"mask-origin":t[e.value]};return e.arbitrary?{"mask-origin":e.value}:void 0}if(e.utility==="mask-position"&&e.value){let t={center:"center",top:"top",right:"right",bottom:"bottom",left:"left","top-left":"top left","top-right":"top right","bottom-left":"bottom left","bottom-right":"bottom right"};if(t[e.value])return{"mask-position":t[e.value]};return e.arbitrary?{"mask-position":e.value}:void 0}if(e.utility==="mask-repeat"&&e.value){let t={repeat:"repeat","no-repeat":"no-repeat","repeat-x":"repeat-x","repeat-y":"repeat-y",round:"round",space:"space"};if(t[e.value])return{"mask-repeat":t[e.value]};return e.arbitrary?{"mask-repeat":e.value}:void 0}if(e.utility==="mask-size"&&e.value){let t={auto:"auto",cover:"cover",contain:"contain"};if(t[e.value])return{"mask-size":t[e.value]};return e.arbitrary?{"mask-size":e.value}:void 0}if(e.utility==="mask-type"&&e.value)return["alpha","luminance"].includes(e.value)?{"mask-type":e.value}:void 0},Xn=[uh,fh,hh,gh,mh,ph,yh,bh,xh,vh,wh,Ch,$h,Rh,kh,Sh];var kr={appearance:"none","background-color":"#fff","border-color":"#6b7280","border-width":"1px","border-radius":"0px","padding-top":"0.5rem","padding-right":"0.75rem","padding-bottom":"0.5rem","padding-left":"0.75rem","font-size":"1rem","line-height":"1.5rem"},Us={appearance:"none",padding:"0","print-color-adjust":"exact",display:"inline-block","vertical-align":"middle","background-origin":"border-box","user-select":"none","flex-shrink":"0",height:"1rem",width:"1rem",color:"#2563eb","background-color":"#fff","border-color":"#6b7280","border-width":"1px"};function st(e,t){return e.utility==="form"&&e.value===t||e.utility===`form-${t}`&&!e.value}var Eh=(e)=>{if(st(e,"input"))return kr},Ah=(e)=>{if(st(e,"textarea"))return kr},Th=(e)=>{if(st(e,"select"))return{...kr,"background-image":`url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e")`,"background-position":"right 0.5rem center","background-repeat":"no-repeat","background-size":"1.5em 1.5em","padding-right":"2.5rem","print-color-adjust":"exact"}},Nh=(e)=>{if(st(e,"multiselect"))return{...kr,"background-image":"initial","background-position":"initial","background-repeat":"unset","background-size":"initial","print-color-adjust":"unset"}},Oh=(e)=>{if(st(e,"checkbox"))return{...Us,"border-radius":"0px"}},Ih=(e)=>{if(st(e,"radio"))return{...Us,"border-radius":"100%"}},Vs=[Eh,Ah,Th,Nh,Oh,Ih];var Ph={gap:"gap","gap-x":"column-gap","gap-y":"row-gap"},at=/^-?\d+$/,zs=/^span-(\d+)$/,_h=(e)=>{if(e.utility==="grid-cols"&&e.value){if(e.arbitrary)return{"grid-template-columns":e.value};if(e.value==="none"||e.value==="subgrid")return{"grid-template-columns":e.value};if(/^\d+$/.test(e.value))return{"grid-template-columns":`repeat(${e.value}, minmax(0, 1fr))`};return}},Lh=(e)=>{if(e.utility==="col"){if(!e.value)return;if(e.arbitrary)return{"grid-column":e.value};if(e.value==="auto")return{"grid-column":"auto"};if(e.value==="span-full")return{"grid-column":"1 / -1"};let t=e.value.match(zs);if(t)return{"grid-column":`span ${t[1]} / span ${t[1]}`};if(at.test(e.value))return{"grid-column":e.value};return}if(e.utility==="col-span"&&e.value){if(e.arbitrary)return{"grid-column":`span ${e.value} / span ${e.value}`};if(e.value==="auto")return{"grid-column":"auto"};if(e.value==="full")return{"grid-column":"1 / -1"};if(/^\d+$/.test(e.value))return{"grid-column":`span ${e.value} / span ${e.value}`};return}if(e.utility==="col-start"&&e.value){if(e.arbitrary||e.value==="auto"||at.test(e.value))return{"grid-column-start":e.value};return}if(e.utility==="col-end"&&e.value){if(e.arbitrary||e.value==="auto"||at.test(e.value))return{"grid-column-end":e.value};return}},Mh=(e)=>{if(e.utility==="grid-rows"&&e.value){if(e.arbitrary)return{"grid-template-rows":e.value};if(e.value==="none"||e.value==="subgrid")return{"grid-template-rows":e.value};if(/^\d+$/.test(e.value))return{"grid-template-rows":`repeat(${e.value}, minmax(0, 1fr))`};return}},Fh=(e)=>{if(e.utility==="row"){if(!e.value)return;if(e.arbitrary)return{"grid-row":e.value};if(e.value==="auto")return{"grid-row":"auto"};if(e.value==="span-full")return{"grid-row":"1 / -1"};let t=e.value.match(zs);if(t)return{"grid-row":`span ${t[1]} / span ${t[1]}`};if(at.test(e.value))return{"grid-row":e.value};return}if(e.utility==="row-span"&&e.value){if(e.arbitrary)return{"grid-row":`span ${e.value} / span ${e.value}`};if(e.value==="auto")return{"grid-row":"auto"};if(e.value==="full")return{"grid-row":"1 / -1"};if(/^\d+$/.test(e.value))return{"grid-row":`span ${e.value} / span ${e.value}`};return}if(e.utility==="row-start"&&e.value){if(e.arbitrary||e.value==="auto"||at.test(e.value))return{"grid-row-start":e.value};return}if(e.utility==="row-end"&&e.value){if(e.arbitrary||e.value==="auto"||at.test(e.value))return{"grid-row-end":e.value};return}},Dh=(e)=>{if(e.utility==="grid-flow"&&e.value){let t={row:"row",col:"column",dense:"dense","row-dense":"row dense","col-dense":"column dense"};return t[e.value]?{"grid-auto-flow":t[e.value]}:void 0}return},jh=(e)=>{if(e.utility==="auto-cols"&&e.value){let t={auto:"auto",min:"min-content",max:"max-content",fr:"minmax(0, 1fr)"};if(e.arbitrary)return{"grid-auto-columns":e.value};return t[e.value]?{"grid-auto-columns":t[e.value]}:void 0}},Bh=(e)=>{if(e.utility==="auto-rows"&&e.value){let t={auto:"auto",min:"min-content",max:"max-content",fr:"minmax(0, 1fr)"};if(e.arbitrary)return{"grid-auto-rows":e.value};return t[e.value]?{"grid-auto-rows":t[e.value]}:void 0}};function Uh(e,t,r){let n=t.theme.spacing?.[r];if(n!==void 0)return n;if(e.arbitrary)return r;if(/^\d+(?:\.\d+)?$/.test(r)){let i=Number.parseFloat(r);if(Number.isFinite(i))return`${i*0.25}rem`}return}var Vh=(e,t)=>{let r=Ph[e.utility];if(!r||!e.value)return;let n=Uh(e,t,e.value);return n!==void 0?{[r]:n}:void 0},zh=(e)=>{if(e.utility==="place"&&e.value&&e.value.startsWith("content-")){let t=e.value.replace("content-",""),r={center:"center",start:"start",end:"end",between:"space-between",around:"space-around",evenly:"space-evenly",stretch:"stretch"};return r[t]?{"place-content":r[t]}:void 0}return},Wh=(e)=>{if(e.utility==="place"&&e.value&&e.value.startsWith("items-")){let t=e.value.replace("items-",""),r={start:"start",end:"end",center:"center",stretch:"stretch"};return r[t]?{"place-items":r[t]}:void 0}return},Kh=(e)=>{if(e.utility==="place"&&e.value&&e.value.startsWith("self-")){let t=e.value.replace("self-",""),r={auto:"auto",start:"start",end:"end",center:"center",stretch:"stretch"};return r[t]?{"place-self":r[t]}:void 0}return},Ws=[_h,Lh,Mh,Fh,Dh,jh,Bh,Vh,zh,Wh,Kh];import{existsSync as Ks,readFileSync as Gh,readdirSync as Hh}from"fs";import{join as Sr}from"path";var Er=new Map;function qh(e){if(Er.has(e))return Er.get(e);let t=[Sr(process.cwd(),"node_modules","@iconify-json",e,"icons.json"),Sr(process.cwd(),"node_modules",".bun","@iconify-json",e,"icons.json")],r=Sr(process.cwd(),"node_modules",".bun");if(Ks(r))try{let n=`@iconify-json+${e}@`;for(let i of Hh(r))if(i.startsWith(n))t.push(Sr(r,i,"node_modules","@iconify-json",e,"icons.json"))}catch{}for(let n of t)if(Ks(n))try{let i=JSON.parse(Gh(n,"utf-8"));return Er.set(e,i),i}catch{}return Er.set(e,null),null}function Yh(e,t){let r=e.icons[t];if(r)return r;let n=e.aliases?.[t];if(n)return e.icons[n.parent]??null;return null}function Jh(e,t){let r=t.width??e.width??24,n=t.height??e.height??24,i=t.left??0,o=t.top??0;return`<svg xmlns='http://www.w3.org/2000/svg' viewBox='${i} ${o} ${r} ${n}' width='${r}' height='${n}'>${t.body}</svg>`}function Xh(e){return`url("data:image/svg+xml;utf8,${e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\?/g,"%3F").replace(/\s+/g," ")}")`}var Zh=/^i-([a-z][a-z0-9]*(?:-[a-z0-9]+)*)-(.+)$/;function Qh(e){if(!e.startsWith("i-"))return;let t=e.slice(2);for(let r=t.indexOf("-");r!==-1;r=t.indexOf("-",r+1)){let n=t.slice(0,r),i=t.slice(r+1);if(!/^[a-z][a-z0-9-]*$/.test(n))continue;let o=qh(n);if(!o)continue;let s=Yh(o,i);if(s)return{collection:o,icon:s}}return}var Gs=(e,t)=>{if(!Zh.test(e.base))return;let r=Qh(e.base);if(!r)return;let{collection:n,icon:i}=r,o=Xh(Jh(n,i));return{display:"inline-block",width:"1em",height:"1em","background-color":"currentColor","-webkit-mask":`${o} no-repeat`,mask:`${o} no-repeat`,"-webkit-mask-size":"100% 100%","mask-size":"100% 100%","vertical-align":"-0.125em"}};var Hs={"border-collapse":"collapse","border-separate":"separate"},qs={"caption-top":"top","caption-bottom":"bottom"},Ys={"field-sizing-content":"content","field-sizing-fixed":"fixed"},Js={"cursor-auto":"auto","cursor-default":"default","cursor-pointer":"pointer","cursor-wait":"wait","cursor-text":"text","cursor-move":"move","cursor-help":"help","cursor-not-allowed":"not-allowed","cursor-none":"none","cursor-context-menu":"context-menu","cursor-progress":"progress","cursor-cell":"cell","cursor-crosshair":"crosshair","cursor-vertical-text":"vertical-text","cursor-alias":"alias","cursor-copy":"copy","cursor-no-drop":"no-drop","cursor-grab":"grab","cursor-grabbing":"grabbing","cursor-all-scroll":"all-scroll","cursor-col-resize":"col-resize","cursor-row-resize":"row-resize","cursor-n-resize":"n-resize","cursor-e-resize":"e-resize","cursor-s-resize":"s-resize","cursor-w-resize":"w-resize","cursor-ne-resize":"ne-resize","cursor-nw-resize":"nw-resize","cursor-se-resize":"se-resize","cursor-sw-resize":"sw-resize","cursor-ew-resize":"ew-resize","cursor-ns-resize":"ns-resize","cursor-nesw-resize":"nesw-resize","cursor-nwse-resize":"nwse-resize","cursor-zoom-in":"zoom-in","cursor-zoom-out":"zoom-out"},Xs={"pointer-events-none":"none","pointer-events-auto":"auto"},Zs={"resize-none":"none",resize:"both","resize-y":"vertical","resize-x":"horizontal"},Qs={"scroll-auto":"auto","scroll-smooth":"smooth"},ea={"snap-none":"none","snap-x":"x var(--tc-scroll-snap-strictness, proximity)","snap-y":"y var(--tc-scroll-snap-strictness, proximity)","snap-both":"both var(--tc-scroll-snap-strictness, proximity)"},ta={"snap-mandatory":"mandatory","snap-proximity":"proximity"},ra={"snap-start":"start","snap-end":"end","snap-center":"center","snap-align-none":"none"},na={"snap-normal":"normal","snap-always":"always"},ia={"touch-auto":"auto","touch-none":"none","touch-pan-x":"pan-x","touch-pan-left":"pan-left","touch-pan-right":"pan-right","touch-pan-y":"pan-y","touch-pan-up":"pan-up","touch-pan-down":"pan-down","touch-pinch-zoom":"pinch-zoom","touch-manipulation":"manipulation"},oa={"select-none":"none","select-text":"text","select-all":"all","select-auto":"auto"},sa={"will-change-auto":"auto","will-change-scroll":"scroll-position","will-change-contents":"contents","will-change-transform":"transform"},aa={"stroke-linecap-butt":"butt","stroke-linecap-round":"round","stroke-linecap-square":"square"},la={"stroke-linejoin-miter":"miter","stroke-linejoin-round":"round","stroke-linejoin-bevel":"bevel"},ca={"forced-color-adjust-auto":"auto","forced-color-adjust-none":"none"},Zn={none:"0",sm:"4px",DEFAULT:"8px",md:"12px",lg:"16px",xl:"24px","2xl":"40px","3xl":"64px"};function da(e){if(e.arbitrary)return e.value;if(/^\d+(?:\.\d+)?$/.test(e.value))return`${Number(e.value)/100}`;return}function ha(e){if(!e.value)return Zn.DEFAULT;if(Zn[e.value]!==void 0)return Zn[e.value];if(e.arbitrary)return e.value;if(/^\d+(?:\.\d+)?$/.test(e.value))return`${e.value}px`;return}var ga=["brightness","contrast","grayscale","invert","saturate","sepia"],eg=["blur","brightness","contrast","grayscale","hue-rotate","invert","saturate","sepia","drop-shadow"],tg=["blur","brightness","contrast","grayscale","hue-rotate","invert","opacity","saturate","sepia"],rg=eg.map((e)=>`var(--tc-${e}, )`).join(" "),ua=tg.map((e)=>`var(--tc-backdrop-${e}, )`).join(" ");function We(e,t){return{[`--tc-${e}`]:t,filter:rg}}function Ar(e,t){return{[`--tc-backdrop-${e}`]:t,"-webkit-backdrop-filter":ua,"backdrop-filter":ua}}var ng=(e)=>{if(e.base==="filter-none")return{filter:"none"};if(e.utility==="blur"){let t=ha(e);return t!==void 0?We("blur",`blur(${t})`):void 0}if(ga.includes(e.utility)&&e.value){let t=da(e);return t!==void 0?We(e.utility,`${e.utility}(${t})`):void 0}if(e.utility==="hue-rotate"&&e.value){if(e.arbitrary)return We("hue-rotate",`hue-rotate(${e.value})`);if(/^-?\d+(?:\.\d+)?$/.test(e.value))return We("hue-rotate",`hue-rotate(${e.value}deg)`);return}if(e.utility==="drop-shadow"){let t={sm:"drop-shadow(0 1px 1px rgb(0 0 0 / 0.05))",DEFAULT:"drop-shadow(0 1px 2px rgb(0 0 0 / 0.1)) drop-shadow(0 1px 1px rgb(0 0 0 / 0.06))",md:"drop-shadow(0 4px 3px rgb(0 0 0 / 0.07)) drop-shadow(0 2px 2px rgb(0 0 0 / 0.06))",lg:"drop-shadow(0 10px 8px rgb(0 0 0 / 0.04)) drop-shadow(0 4px 3px rgb(0 0 0 / 0.1))",xl:"drop-shadow(0 20px 13px rgb(0 0 0 / 0.03)) drop-shadow(0 8px 5px rgb(0 0 0 / 0.08))","2xl":"drop-shadow(0 25px 25px rgb(0 0 0 / 0.15))",none:"drop-shadow(0 0 #0000)"};if(!e.value)return We("drop-shadow",t.DEFAULT);if(t[e.value])return We("drop-shadow",t[e.value]);if(e.arbitrary)return We("drop-shadow",`drop-shadow(${e.value})`);return}},ig=(e)=>{if(e.base==="backdrop-filter-none")return{"backdrop-filter":"none"};if(e.utility==="backdrop-blur"){let t=ha(e);return t!==void 0?Ar("blur",`blur(${t})`):void 0}if(e.utility.startsWith("backdrop-")&&e.value){let t=e.utility.slice(9);if(ga.includes(t)||t==="opacity"){let r=da(e);if(r===void 0)return;return Ar(t,`${t}(${r})`)}if(t==="hue-rotate"){if(e.arbitrary)return Ar(t,`hue-rotate(${e.value})`);if(/^-?\d+(?:\.\d+)?$/.test(e.value))return Ar(t,`hue-rotate(${e.value}deg)`);return}}},og=(e)=>Hs[e.base]?{"border-collapse":Hs[e.base]}:void 0,sg=(e,t)=>{if(!e.utility.startsWith("border-spacing")||!e.value)return;let r=t.theme.spacing[e.value];if(r===void 0&&e.arbitrary)r=e.value;if(r===void 0&&/^\d+(?:\.\d+)?$/.test(e.value))r=`${Number.parseFloat(e.value)*0.25}rem`;if(r===void 0)return;if(e.utility==="border-spacing")return{"border-spacing":`${r} ${r}`};if(e.utility==="border-spacing-x")return{"border-spacing":`${r} 0`};if(e.utility==="border-spacing-y")return{"border-spacing":`0 ${r}`}},ag=(e)=>{if(e.utility==="table"&&e.value){let t={auto:"auto",fixed:"fixed"};return t[e.value]?{"table-layout":t[e.value]}:void 0}return},lg=(e)=>qs[e.base]?{"caption-side":qs[e.base]}:void 0,cg=(e,t)=>{if(e.utility==="accent"&&e.value){let r=ie(e.value,t,e.modifierArbitrary);if(r)return{"accent-color":r}}},ug=(e)=>{let t={"appearance-none":"none","appearance-auto":"auto","appearance-base":"base"};return t[e.base]?{appearance:t[e.base]}:void 0},fg=(e,t)=>{if(e.utility==="caret"&&e.value){let r=ie(e.value,t,e.modifierArbitrary);if(r)return{"caret-color":r}}},dg={normal:"normal",light:"light",dark:"dark","light-dark":"light dark","only-dark":"only dark","only-light":"only light"},fa=(e)=>{let t=e.base,r=t.startsWith("scheme-")?t.slice(7):t.startsWith("color-scheme-")?t.slice(13):void 0;if(r===void 0)return;let n=dg[r];return n?{"color-scheme":n}:void 0},hg=(e)=>Ys[e.base]?{"field-sizing":Ys[e.base]}:void 0,gg=(e)=>Js[e.base]?{cursor:Js[e.base]}:void 0,mg=(e)=>Xs[e.base]?{"pointer-events":Xs[e.base]}:void 0,pg=(e)=>Zs[e.base]?{resize:Zs[e.base]}:void 0,yg=(e)=>Qs[e.base]?{"scroll-behavior":Qs[e.base]}:void 0,bg=(e,t)=>{let n={"scroll-m":["scroll-margin"],"scroll-mx":["scroll-margin-left","scroll-margin-right"],"scroll-my":["scroll-margin-top","scroll-margin-bottom"],"scroll-mt":["scroll-margin-top"],"scroll-mr":["scroll-margin-right"],"scroll-mb":["scroll-margin-bottom"],"scroll-ml":["scroll-margin-left"]}[e.utility];if(!n||!e.value)return;let i=t.theme.spacing[e.value];if(i===void 0&&e.arbitrary)i=e.value;if(i===void 0&&/^\d+(?:\.\d+)?$/.test(e.value))i=`${Number.parseFloat(e.value)*0.25}rem`;if(i===void 0)return;let o={};for(let s of n)o[s]=i;return o},xg=(e,t)=>{let n={"scroll-p":["scroll-padding"],"scroll-px":["scroll-padding-left","scroll-padding-right"],"scroll-py":["scroll-padding-top","scroll-padding-bottom"],"scroll-pt":["scroll-padding-top"],"scroll-pr":["scroll-padding-right"],"scroll-pb":["scroll-padding-bottom"],"scroll-pl":["scroll-padding-left"]}[e.utility];if(!n||!e.value)return;let i=t.theme.spacing[e.value];if(i===void 0&&e.arbitrary)i=e.value;if(i===void 0&&/^\d+(?:\.\d+)?$/.test(e.value))i=`${Number.parseFloat(e.value)*0.25}rem`;if(i===void 0)return;let o={};for(let s of n)o[s]=i;return o},vg=(e)=>{if(ea[e.base])return{"scroll-snap-type":ea[e.base]};if(ta[e.base])return{"--tc-scroll-snap-strictness":ta[e.base]};if(ra[e.base])return{"scroll-snap-align":ra[e.base]};if(na[e.base])return{"scroll-snap-stop":na[e.base]}},wg=(e)=>ia[e.base]?{"touch-action":ia[e.base]}:void 0,Cg=(e)=>oa[e.base]?{"user-select":oa[e.base]}:void 0,$g=(e)=>sa[e.base]?{"will-change":sa[e.base]}:void 0,Rg=(e,t)=>{if(e.utility==="fill"&&e.value){if(e.value==="none")return{fill:"none"};let r=ie(e.value,t,e.modifierArbitrary);if(r)return{fill:r}}},kg=(e,t)=>{if(e.utility==="stroke"&&e.value){if(e.value==="none")return{stroke:"none"};let r=ie(e.value,t,e.modifierArbitrary);if(r)return{stroke:r}}},Sg=(e)=>{if(e.utility==="stroke"&&e.value){if(e.arbitrary||/^\d+(?:\.\d+)?$/.test(e.value))return{"stroke-width":e.value};return}},Eg=(e)=>{if(e.utility==="stroke-dasharray"&&e.value){if(e.value==="none")return{"stroke-dasharray":"none"};if(e.arbitrary||/^\d+(?:\.\d+)?$/.test(e.value))return{"stroke-dasharray":e.value};return}},Ag=(e)=>{if(e.utility==="stroke-dashoffset"&&e.value){if(e.arbitrary||/^-?\d+(?:\.\d+)?$/.test(e.value))return{"stroke-dashoffset":e.value};return}},Tg=(e)=>aa[e.base]?{"stroke-linecap":aa[e.base]}:void 0,Ng=(e)=>la[e.base]?{"stroke-linejoin":la[e.base]}:void 0,Og=(e)=>{if(e.base==="sr-only")return{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)","white-space":"nowrap","border-width":"0"};if(e.base==="not-sr-only")return{position:"static",width:"auto",height:"auto",padding:"0",margin:"0",overflow:"visible",clip:"auto","white-space":"normal"};return},Ig=(e)=>ca[e.base]?{"forced-color-adjust":ca[e.base]}:void 0,ma=[ng,ig,og,sg,ag,lg,cg,ug,fa,fg,fa,hg,gg,mg,pg,yg,bg,xg,vg,wg,Cg,$g,Rg,kg,Sg,Eg,Ag,Tg,Ng,Og,Ig];function ye(e,t){let r=e/t*100;if(!Number.isFinite(r))return;return`${Pg(r)}%`}function Pg(e){if(Number.isInteger(e))return String(e);return e.toFixed(6).replace(/\.?0+$/,"")}var pa={"column-fill-auto":"auto","column-fill-balance":"balance","column-fill-balance-all":"balance-all"},ya={"column-span-all":"all","column-span-none":"none"},ba={"box-decoration-clone":"clone","box-decoration-slice":"slice"},xa={"box-border":"border-box","box-content":"content-box"},va={"float-start":"inline-start","float-end":"inline-end","float-right":"right","float-left":"left","float-none":"none"},wa={"clear-start":"inline-start","clear-end":"inline-end","clear-left":"left","clear-right":"right","clear-both":"both","clear-none":"none"},Ca={isolate:"isolate","isolation-auto":"auto"},$a={"object-contain":"contain","object-cover":"cover","object-fill":"fill","object-none":"none","object-scale-down":"scale-down"},Ra={"object-bottom":"bottom","object-center":"center","object-left":"left","object-left-bottom":"left bottom","object-left-top":"left top","object-right":"right","object-right-bottom":"right bottom","object-right-top":"right top","object-top":"top"},ka={"overscroll-auto":"auto","overscroll-contain":"contain","overscroll-none":"none","overscroll-x-auto":"auto","overscroll-x-contain":"contain","overscroll-x-none":"none","overscroll-y-auto":"auto","overscroll-y-contain":"contain","overscroll-y-none":"none"},Sa={visible:"visible",invisible:"hidden",collapse:"collapse"},_g=(e)=>{if(e.utility==="aspect"&&e.value){let t={auto:"auto",square:"1 / 1",video:"16 / 9"};if(t[e.value])return{"aspect-ratio":t[e.value]};if(e.arbitrary)return{"aspect-ratio":e.value};let r=e.value.match(/^(\d+(?:\.\d+)?)\/(\d+(?:\.\d+)?)$/);if(r)return{"aspect-ratio":`${r[1]} / ${r[2]}`};if(/^\d+(?:\.\d+)?$/.test(e.value))return{"aspect-ratio":e.value};return}},Lg=(e,t)=>{if(e.utility==="columns"&&e.value){let r={"1":"1","2":"2","3":"3","4":"4","5":"5","6":"6","7":"7","8":"8","9":"9","10":"10","11":"11","12":"12",auto:"auto"},n={"3xs":"16rem","2xs":"18rem",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem"};if(r[e.value])return{columns:r[e.value]};if(n[e.value])return{columns:n[e.value]};if(t.theme.spacing[e.value])return{columns:t.theme.spacing[e.value]};if(e.arbitrary||/^\d+$/.test(e.value))return{columns:e.value};return}},Mg=(e)=>pa[e.base]?{"column-fill":pa[e.base]}:void 0,Fg=(e,t)=>{if(e.utility==="column-gap"&&e.value){let r=t.theme.spacing[e.value];if(r===void 0&&e.arbitrary)r=e.value;if(r===void 0&&/^\d+(?:\.\d+)?$/.test(e.value))r=`${Number.parseFloat(e.value)*0.25}rem`;return r!==void 0?{"column-gap":r}:void 0}},Dg=(e,t)=>{if(e.utility==="column-rule"&&e.value){let r={"0":"0px","1":"1px","2":"2px","4":"4px","8":"8px"};if(r[e.value])return{"column-rule-width":r[e.value]};let n=e.value.split("-");if(n.length===2){let[s,c]=n,a=t.theme.colors[s];if(typeof a==="object"&&a[c])return{"column-rule-color":a[c]}}let i=t.theme.colors[e.value];if(typeof i==="string")return{"column-rule-color":i};if(typeof i==="object"&&i!==null&&typeof i.DEFAULT==="string")return{"column-rule-color":i.DEFAULT};let o={solid:"solid",dashed:"dashed",dotted:"dotted",double:"double",hidden:"hidden",none:"none"};if(o[e.value])return{"column-rule-style":o[e.value]}}},jg=(e)=>ya[e.base]?{"column-span":ya[e.base]}:void 0,Bg=(e)=>({"break-before-auto":{"break-before":"auto"},"break-before-avoid":{"break-before":"avoid"},"break-before-all":{"break-before":"all"},"break-before-avoid-page":{"break-before":"avoid-page"},"break-before-page":{"break-before":"page"},"break-after-auto":{"break-after":"auto"},"break-after-avoid":{"break-after":"avoid"},"break-after-all":{"break-after":"all"},"break-after-avoid-page":{"break-after":"avoid-page"},"break-after-page":{"break-after":"page"},"break-inside-auto":{"break-inside":"auto"},"break-inside-avoid":{"break-inside":"avoid"},"break-inside-avoid-page":{"break-inside":"avoid-page"},"break-inside-avoid-column":{"break-inside":"avoid-column"}})[e.base],Ug=(e)=>ba[e.base]?{"box-decoration-break":ba[e.base]}:void 0,Vg=(e)=>xa[e.base]?{"box-sizing":xa[e.base]}:void 0,zg=(e)=>va[e.base]?{float:va[e.base]}:void 0,Wg=(e)=>wa[e.base]?{clear:wa[e.base]}:void 0,Kg=(e)=>Ca[e.base]?{isolation:Ca[e.base]}:void 0,Ea=["size","inline-size","layout","paint","style"],Gg=Ea.map((e)=>`var(--tc-contain-${e}, )`).join(" "),Hg=["none","content","strict"],qg=(e)=>{if(e.utility!=="contain"||!e.value)return;if(e.arbitrary)return{contain:e.value};if(Hg.includes(e.value))return{contain:e.value};if(Ea.includes(e.value))return{[`--tc-contain-${e.value}`]:e.value,contain:Gg};return},Yg=(e)=>$a[e.base]?{"object-fit":$a[e.base]}:void 0,Jg=(e)=>Ra[e.base]?{"object-position":Ra[e.base]}:void 0,Xg=(e)=>{if(e.utility==="overflow"){let t=["auto","hidden","clip","visible","scroll"];if(e.value&&t.includes(e.value))return{overflow:e.value}}if(e.utility==="overflow-x"||e.utility==="overflow-y"){let t=["auto","hidden","clip","visible","scroll"];if(e.value&&t.includes(e.value))return{[e.utility]:e.value}}},Zg=(e)=>{let t=e.base.startsWith("overscroll-x")?"overscroll-behavior-x":e.base.startsWith("overscroll-y")?"overscroll-behavior-y":"overscroll-behavior";return ka[e.base]?{[t]:ka[e.base]}:void 0},Qg=(e)=>{if(["static","fixed","absolute","relative","sticky"].includes(e.utility))return{position:e.utility}},em=(e,t)=>{let n={inset:["top","right","bottom","left"],"inset-x":["left","right"],"inset-y":["top","bottom"],top:["top"],right:["right"],bottom:["bottom"],left:["left"],start:["inset-inline-start"],end:["inset-inline-end"]}[e.utility];if(!n||!e.value)return;let i=(c)=>{if(c.includes("/")&&!e.arbitrary){let[l,u]=c.split("/").map(Number);if(!Number.isNaN(l)&&!Number.isNaN(u)&&u!==0)return ye(l,u);return}if(c==="full")return"100%";if(c==="auto")return"auto";if(e.arbitrary)return c;let a=t.theme.spacing[c];if(a!==void 0)return a;if(/^\d+(?:\.\d+)?$/.test(c))return`${Number.parseFloat(c)*0.25}rem`;return},o;if(e.value.startsWith("-")){let c=e.value.slice(1),a=i(c);if(a===void 0)o=void 0;else if(a.endsWith("%"))o=`${-Number.parseFloat(a)}%`;else o=a.startsWith("-")?a:`-${a}`}else o=i(e.value);if(o===void 0)return;let s={};for(let c of n)s[c]=o;return s},tm=(e)=>Sa[e.utility]?{visibility:Sa[e.utility]}:void 0,rm=(e)=>{if(e.utility==="z"&&e.value){if(e.arbitrary||e.value==="auto"||/^-?\d+$/.test(e.value))return{"z-index":e.value};return}},Aa=[_g,Lg,Mg,Fg,Dg,jg,Bg,Ug,Vg,zg,Wg,qg,Kg,Yg,Jg,Xg,Zg,Qg,em,tm,rm];var nm={rotate:"rotate","rotate-x":"rotateX","rotate-y":"rotateY","rotate-z":"rotateZ"},im={"translate-x":"translateX","translate-y":"translateY","translate-z":"translateZ"},Ta={"backface-visible":"visible","backface-hidden":"hidden"},Na={"transform-flat":"flat","transform-3d":"preserve-3d"},Oa={"transition-none":"none","transition-all":"all",transition:"color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter","transition-colors":"color, background-color, border-color, text-decoration-color, fill, stroke","transition-opacity":"opacity","transition-shadow":"box-shadow","transition-transform":"transform"},Ia={"ease-linear":"linear","ease-in":"cubic-bezier(0.4, 0, 1, 1)","ease-out":"cubic-bezier(0, 0, 0.2, 1)","ease-in-out":"cubic-bezier(0.4, 0, 0.2, 1)"},Pa={"transition-behavior-normal":"normal","transition-behavior-allow-discrete":"allow-discrete"},_a={none:"none",spin:"spin 1s linear infinite",ping:"ping 1s cubic-bezier(0, 0, 0.2, 1) infinite",pulse:"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",bounce:"bounce 1s infinite"},La={"animate-running":"running","animate-paused":"paused"},Ma={"animate-normal":"normal","animate-reverse":"reverse","animate-alternate":"alternate","animate-alternate-reverse":"alternate-reverse"},Fa={"animate-fill-none":"none","animate-fill-forwards":"forwards","animate-fill-backwards":"backwards","animate-fill-both":"both"},Da={"animate-ease-linear":"linear","animate-ease-in":"cubic-bezier(0.4, 0, 1, 1)","animate-ease-out":"cubic-bezier(0, 0, 0.2, 1)","animate-ease-in-out":"cubic-bezier(0.4, 0, 0.2, 1)"},ja="rotate(var(--tc-rotate, 0deg)) skewX(var(--tc-skew-x, 0deg)) skewY(var(--tc-skew-y, 0deg)) scaleX(var(--tc-scale-x, 1)) scaleY(var(--tc-scale-y, 1))",kt=`translate(var(--tc-translate-x, 0), var(--tc-translate-y, 0)) ${ja}`,ei=`translate3d(var(--tc-translate-x, 0), var(--tc-translate-y, 0), 0) ${ja}`,om={transform:kt,"transform-cpu":kt,"transform-gpu":ei,"transform-none":"none"},sm=(e)=>{let t=om[e.base];return t?{transform:t}:void 0};function Tr(e,t){if(!t.value)return{transform:`${e}(1)`};if(t.arbitrary)return{transform:`${e}(${t.value})`};if(/^-?\d+(?:\.\d+)?$/.test(t.value))return{transform:`${e}(${Number(t.value)/100})`};return}function Qn(e){let t=e.value;if(e.arbitrary)return t;if(/^-?\d+(?:\.\d+)?$/.test(t))return`${t}deg`;if(/^-?\d+(?:\.\d+)?(?:deg|rad|grad|turn)$/.test(t))return t;return}var am=(e)=>{if(e.utility==="scale")return Tr("scale",e);if(e.utility==="scale-x")return Tr("scaleX",e);if(e.utility==="scale-y")return Tr("scaleY",e);if(e.utility==="scale-z")return Tr("scaleZ",e)},lm=(e)=>{if(!e.value)return;let t=nm[e.utility];if(!t)return;let r=Qn(e);return r!==void 0?{transform:`${t}(${r})`}:void 0},cm=(e,t)=>{let r=(o)=>{if(o.includes("/")){let[c,a]=o.split("/");return ye(Number(c),Number(a))}if(o==="full")return"100%";if(o==="half")return"50%";if(e.arbitrary)return o;let s=t.theme.spacing[o];if(s!==void 0)return s;if(/^\d+(?:\.\d+)?$/.test(o))return`${Number.parseFloat(o)*0.25}rem`;return},n=im[e.utility];if(!n||!e.value)return;let i;if(e.value.startsWith("-")){let o=r(e.value.slice(1));i=o===void 0?void 0:`-${o}`}else i=r(e.value);return i!==void 0?{transform:`${n}(${i})`}:void 0},um=(e)=>{if(e.utility==="skew-x"&&e.value){let t=Qn(e);return t!==void 0?{transform:`skewX(${t})`}:void 0}if(e.utility==="skew-y"&&e.value){let t=Qn(e);return t!==void 0?{transform:`skewY(${t})`}:void 0}},fm=(e)=>{if(e.utility==="origin"&&e.value){if(e.arbitrary)return{"transform-origin":e.value.replace(/_/g," ")};let t={center:"center",top:"top","top-right":"top right",right:"right","bottom-right":"bottom right",bottom:"bottom","bottom-left":"bottom left",left:"left","top-left":"top left"};return t[e.value]?{"transform-origin":t[e.value]}:void 0}return},dm={dramatic:"100px",near:"300px",normal:"500px",midrange:"800px",distant:"1200px"},hm=(e)=>{if(e.utility==="perspective"&&e.value){if(e.value==="none")return{perspective:"none"};if(e.arbitrary||/^\d+(?:\.\d+)?(?:px|rem|em)$/.test(e.value))return{perspective:e.value};let t=dm[e.value];if(t)return{perspective:t};if(/^\d+(?:\.\d+)?$/.test(e.value))return{perspective:`${e.value}px`};return}return},gm=(e)=>{if(e.utility==="perspective-origin"&&e.value)return{"perspective-origin":{center:"center",top:"top","top-right":"top right",right:"right","bottom-right":"bottom right",bottom:"bottom","bottom-left":"bottom left",left:"left","top-left":"top left"}[e.value]||e.value}},mm=(e)=>Ta[e.base]?{"backface-visibility":Ta[e.base]}:void 0,pm=(e)=>Na[e.base]?{"transform-style":Na[e.base]}:void 0,ym=(e)=>Oa[e.base]?{"transition-property":Oa[e.base]}:void 0;function Nr(e,t){let r=e.value;if(t[r])return t[r];if(e.arbitrary)return r;if(/^\d+(?:\.\d+)?$/.test(r))return`${r}ms`;return}var bm=(e)=>{if(e.utility==="duration"&&e.value){let r=Nr(e,{"0":"0s","75":"75ms","100":"100ms","150":"150ms","200":"200ms","300":"300ms","500":"500ms","700":"700ms","1000":"1000ms"});return r!==void 0?{"transition-duration":r}:void 0}},xm=(e)=>Ia[e.base]?{"transition-timing-function":Ia[e.base]}:void 0,vm=(e)=>{if(e.utility==="delay"&&e.value){let r=Nr(e,{"0":"0s","75":"75ms","100":"100ms","150":"150ms","200":"200ms","300":"300ms","500":"500ms","700":"700ms","1000":"1000ms"});return r!==void 0?{"transition-delay":r}:void 0}},wm=(e)=>Pa[e.base]?{"transition-behavior":Pa[e.base]}:void 0,Cm=(e)=>{if(e.utility!=="animate")return;if(e.arbitrary&&e.value)return{animation:e.value.replace(/_/g," ")};if(e.value&&_a[e.value])return{animation:_a[e.value]};return},$m=(e)=>La[e.base]?{"animation-play-state":La[e.base]}:void 0,Rm=(e)=>Ma[e.base]?{"animation-direction":Ma[e.base]}:void 0,km=(e)=>Fa[e.base]?{"animation-fill-mode":Fa[e.base]}:void 0,Sm=(e)=>{if(e.utility==="animate-iteration"&&e.value){if(e.value==="infinite"||e.arbitrary||/^\d+(?:\.\d+)?$/.test(e.value))return{"animation-iteration-count":e.value};return}},Em=(e)=>{if(e.utility==="animate-duration"&&e.value){let r=Nr(e,{"75":"75ms","100":"100ms","150":"150ms","200":"200ms","300":"300ms","500":"500ms","700":"700ms","1000":"1000ms"});return r!==void 0?{"animation-duration":r}:void 0}},Am=(e)=>{if(e.utility==="animate-delay"&&e.value){let r=Nr(e,{"75":"75ms","100":"100ms","150":"150ms","200":"200ms","300":"300ms","500":"500ms","700":"700ms","1000":"1000ms"});return r!==void 0?{"animation-delay":r}:void 0}},Tm=(e)=>Da[e.base]?{"animation-timing-function":Da[e.base]}:void 0,Ba=[sm,am,lm,cm,um,fm,hm,gm,mm,pm,ym,wm,bm,xm,vm,Cm,$m,Rm,km,Sm,Em,Am,Tm];var Ua={italic:"italic","not-italic":"normal"},Va={"normal-nums":"normal",ordinal:"ordinal","slashed-zero":"slashed-zero","lining-nums":"lining-nums","oldstyle-nums":"oldstyle-nums","proportional-nums":"proportional-nums","tabular-nums":"tabular-nums","diagonal-fractions":"diagonal-fractions","stacked-fractions":"stacked-fractions"},za={"list-inside":"inside","list-outside":"outside"},Wa={none:"none",disc:"disc",decimal:"decimal"},Ka={underline:"underline",overline:"overline","line-through":"line-through","no-underline":"none"},Ga={uppercase:"uppercase",lowercase:"lowercase",capitalize:"capitalize","normal-case":"none"},Ha={"text-wrap":"wrap","text-nowrap":"nowrap","text-balance":"balance","text-pretty":"pretty"},qa={"align-baseline":"baseline","align-top":"top","align-middle":"middle","align-bottom":"bottom","align-text-top":"text-top","align-text-bottom":"text-bottom","align-sub":"sub","align-super":"super"},Ya={"whitespace-normal":"normal","whitespace-nowrap":"nowrap","whitespace-pre":"pre","whitespace-pre-line":"pre-line","whitespace-pre-wrap":"pre-wrap","whitespace-break-spaces":"break-spaces"},Ja={"break-all":"break-all","break-keep":"keep-all"},Xa={"hyphens-none":"none","hyphens-manual":"manual","hyphens-auto":"auto"},Za={"writing-horizontal-tb":"horizontal-tb","writing-vertical-rl":"vertical-rl","writing-vertical-lr":"vertical-lr"},Qa={"text-orientation-mixed":"mixed","text-orientation-upright":"upright","text-orientation-sideways":"sideways"},el={"direction-ltr":"ltr","direction-rtl":"rtl"},tl={"small-caps":"small-caps","all-small-caps":"all-small-caps","petite-caps":"petite-caps","all-petite-caps":"all-petite-caps",unicase:"unicase","titling-caps":"titling-caps","normal-caps":"normal"},rl={"ligatures-normal":"normal","ligatures-none":"none","common-ligatures":"common-ligatures","no-common-ligatures":"no-common-ligatures","discretionary-ligatures":"discretionary-ligatures","no-discretionary-ligatures":"no-discretionary-ligatures","historical-ligatures":"historical-ligatures","no-historical-ligatures":"no-historical-ligatures",contextual:"contextual","no-contextual":"no-contextual"},Nm=(e,t)=>{if(e.utility==="font"&&e.value){let r=t.theme.fontFamily[e.value];if(r)return{"font-family":r.join(", ")}}},Om=(e)=>({antialiased:{"-webkit-font-smoothing":"antialiased","-moz-osx-font-smoothing":"grayscale"},"subpixel-antialiased":{"-webkit-font-smoothing":"auto","-moz-osx-font-smoothing":"auto"}})[e.base],Im=(e)=>Ua[e.base]?{"font-style":Ua[e.base]}:void 0,Pm=(e)=>{if(e.utility==="font-stretch"&&e.value){if(["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"].includes(e.value))return{"font-stretch":e.value};if(e.arbitrary||/^\d+(?:\.\d+)?%$/.test(e.value))return{"font-stretch":e.value};return}},_m=(e)=>Va[e.base]?{"font-variant-numeric":Va[e.base]}:void 0,Lm=(e)=>{if(e.utility==="tracking"){let t={tighter:"-0.05em",tight:"-0.025em",normal:"0em",wide:"0.025em",wider:"0.05em",widest:"0.1em"};if(!e.value)return;if(e.arbitrary)return{"letter-spacing":e.value};if(e.value.startsWith("-")){let r=e.value.slice(1);return t[r]?{"letter-spacing":`-${t[r]}`}:void 0}return t[e.value]?{"letter-spacing":t[e.value]}:void 0}},Mm=(e)=>{if(e.utility==="line-clamp"&&e.value){if(e.value==="none")return{overflow:"visible",display:"block","-webkit-box-orient":"horizontal","-webkit-line-clamp":"none"};if(!e.arbitrary&&!/^\d+$/.test(e.value))return;return{overflow:"hidden",display:"-webkit-box","-webkit-box-orient":"vertical","-webkit-line-clamp":e.value}}},Fm=(e)=>{if(e.utility==="list-image"&&e.value){if(e.value==="none")return{"list-style-image":"none"};if(e.arbitrary)return{"list-style-image":e.value};return{"list-style-image":`url(${e.value})`}}},Dm=(e)=>za[e.base]?{"list-style-position":za[e.base]}:void 0,jm=(e)=>{if(e.utility!=="list"||!e.value)return;return Wa[e.value]?{"list-style-type":Wa[e.value]}:void 0},Bm=(e,t)=>{if(Ka[e.base])return{"text-decoration-line":Ka[e.base]};if(e.utility==="decoration"&&e.value){let r={solid:"solid",double:"double",dotted:"dotted",dashed:"dashed",wavy:"wavy"};if(r[e.value])return{"text-decoration-style":r[e.value]};let n={auto:"auto","from-font":"from-font","0":"0px","1":"1px","2":"2px","4":"4px","8":"8px"};if(n[e.value])return{"text-decoration-thickness":n[e.value]};if(e.arbitrary)return{"text-decoration-thickness":e.value};let i=ie(e.value,t,e.modifierArbitrary);if(i)return{"text-decoration-color":i};return}return},Um=(e)=>{if(e.utility==="underline-offset"&&e.value){let t={auto:"auto",0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"};if(t[e.value])return{"text-underline-offset":t[e.value]};if(e.arbitrary)return{"text-underline-offset":e.value};if(/^\d+(?:\.\d+)?$/.test(e.value))return{"text-underline-offset":`${e.value}px`};return}},Vm=(e)=>Ga[e.base]?{"text-transform":Ga[e.base]}:void 0,zm=(e)=>({truncate:{overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"},"text-ellipsis":{"text-overflow":"ellipsis"},"text-clip":{"text-overflow":"clip"}})[e.base],Wm=(e)=>Ha[e.base]?{"text-wrap":Ha[e.base]}:void 0,Km=(e,t)=>{if(e.utility==="indent"&&e.value){if(e.arbitrary)return{"text-indent":e.value};let r=(i)=>{let o=t.theme.spacing[i];if(o!==void 0)return o;if(/^\d+(?:\.\d+)?$/.test(i))return`${Number.parseFloat(i)*0.25}rem`;return};if(e.value.startsWith("-")){let i=r(e.value.slice(1));return i!==void 0?{"text-indent":`-${i}`}:void 0}let n=r(e.value);return n!==void 0?{"text-indent":n}:void 0}},Gm=(e)=>qa[e.base]?{"vertical-align":qa[e.base]}:void 0,Hm=(e)=>Ya[e.base]?{"white-space":Ya[e.base]}:void 0,qm=(e)=>{if(e.base==="break-normal")return{"overflow-wrap":"normal","word-break":"normal"};if(e.base==="break-words")return{"overflow-wrap":"break-word"};return Ja[e.base]?{"word-break":Ja[e.base]}:void 0},Ym=(e)=>{let t={"overflow-wrap-normal":"normal","overflow-wrap-break":"break-word","overflow-wrap-anywhere":"anywhere","wrap-normal":"normal","wrap-break-word":"break-word","wrap-anywhere":"anywhere"};return t[e.base]?{"overflow-wrap":t[e.base]}:void 0},Jm=(e)=>{if(e.utility!=="tab"||!e.value)return;if(e.arbitrary||/^\d+$/.test(e.value))return{"tab-size":e.value};return},Xm=(e)=>Xa[e.base]?{hyphens:Xa[e.base]}:void 0,Zm=(e)=>{if(e.utility==="content"&&e.value){let t={none:"none"};if(t[e.value]||e.value.startsWith('"')||e.value.startsWith("'"))return{content:t[e.value]||e.value};if(e.arbitrary)return{content:e.value};return}},Qm=(e,t)=>{if(e.utility==="leading"){if(!e.value)return;let r={none:"1",tight:"1.25",snug:"1.375",normal:"1.5",relaxed:"1.625",loose:"2",3:".75rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem"};if(r[e.value])return{"line-height":r[e.value]};if(e.arbitrary)return{"line-height":e.value};if(/^\d+(?:\.\d+)?$/.test(e.value))return{"line-height":`${Number.parseFloat(e.value)*0.25}rem`};return}},ep=(e)=>Za[e.base]?{"writing-mode":Za[e.base]}:void 0,tp=(e)=>Qa[e.base]?{"text-orientation":Qa[e.base]}:void 0,rp=(e)=>el[e.base]?{direction:el[e.base]}:void 0,np=(e)=>{if(e.utility==="text-emphasis"&&e.value){let t={none:"none",filled:"filled",open:"open",dot:"dot",circle:"circle","double-circle":"double-circle",triangle:"triangle",sesame:"sesame"};if(t[e.value])return{"text-emphasis":t[e.value]};return e.arbitrary?{"text-emphasis":e.value}:void 0}},ip=(e,t)=>{if(e.utility==="text-emphasis-color"&&e.value){let r=e.value.split("-");if(r.length===2){let[i,o]=r,s=t.theme.colors[i];if(typeof s==="object"&&s[o])return{"text-emphasis-color":s[o]}}let n=t.theme.colors[e.value];if(typeof n==="string")return{"text-emphasis-color":n};if(typeof n==="object"&&n!==null&&typeof n.DEFAULT==="string")return{"text-emphasis-color":n.DEFAULT}}},op=(e,t)=>{if(e.utility==="word-spacing"&&e.value){let r={tighter:"-0.05em",tight:"-0.025em",normal:"normal",wide:"0.025em",wider:"0.05em",widest:"0.1em"};if(r[e.value])return{"word-spacing":r[e.value]};if(t.theme.spacing[e.value])return{"word-spacing":t.theme.spacing[e.value]};if(e.arbitrary)return{"word-spacing":e.value};return}},sp=(e)=>tl[e.base]?{"font-variant-caps":tl[e.base]}:void 0,ap=(e)=>rl[e.base]?{"font-variant-ligatures":rl[e.base]}:void 0,nl=[Nm,Om,Im,Pm,_m,sp,ap,Lm,Qm,Mm,Fm,Dm,jm,Bm,Um,Vm,zm,Wm,Km,Gm,Hm,qm,Ym,Jm,Xm,Zm,ep,tp,rp,np,ip,op];var il={"flex-row":"row","flex-row-reverse":"row-reverse","flex-col":"column","flex-col-reverse":"column-reverse"},ol={"flex-wrap":"wrap","flex-wrap-reverse":"wrap-reverse","flex-nowrap":"nowrap"},ti={0:"0px",2:"2px",4:"4px",8:"8px"},lp=(e)=>{if(["block","inline-block","inline","flex","inline-flex","grid","inline-grid","hidden","none","contents","flow-root","list-item"].includes(e.utility)&&!e.value)return{display:e.utility==="hidden"?"none":e.utility};if(e.utility==="table"){if(!e.value)return{display:"table"};if(new Set(["cell","row","row-group","column","column-group","header-group","footer-group","caption"]).has(e.value))return{display:`table-${e.value}`}}if(e.utility==="inline"&&e.value==="table")return{display:"inline-table"};if(e.utility==="flow"&&e.value==="root")return{display:"flow-root"};if(e.utility==="list"&&e.value==="item")return{display:"list-item"}},cp=(e)=>{if(e.utility==="scrollbar"&&e.value){let r={auto:"auto",thin:"thin",none:"none"}[e.value];if(r)return{"scrollbar-width":r}}},up=(e)=>{if(e.utility==="content"){if(e.value==="none")return{content:"none"};if(e.value==="empty")return{content:'""'};if(e.arbitrary&&e.value)return{content:e.value}}},fp=(e)=>{if(e.utility==="@container")return{"container-type":"inline-size"};if(e.utility==="@container-normal")return{"container-type":"normal"};if(e.utility.startsWith("@container/"))return{"container-type":"inline-size","container-name":e.utility.slice(11)}},dp=(e)=>il[e.utility]?{"flex-direction":il[e.utility]}:void 0,hp=(e)=>ol[e.utility]?{"flex-wrap":ol[e.utility]}:void 0,gp=(e)=>{if(e.utility==="flex"||e.utility.startsWith("flex-")){let t={"flex-1":"1 1 0%","flex-auto":"1 1 auto","flex-initial":"0 1 auto","flex-none":"none"};if(t[e.utility])return{flex:t[e.utility]};if(e.utility==="flex"&&e.arbitrary&&e.value)return{flex:e.value.replace(/_/g," ")}}return},mp=(e)=>{if(e.utility==="flex-grow"&&!e.value)return{"flex-grow":"1"};if(e.utility==="flex-grow"&&e.value)return{"flex-grow":e.value}},pp=(e)=>{if(e.utility==="flex-shrink"&&!e.value)return{"flex-shrink":"1"};if(e.utility==="flex-shrink"&&e.value)return{"flex-shrink":e.value}},yp=(e)=>{if(e.utility==="justify"&&e.value){let t={start:"flex-start",end:"flex-end",center:"center",between:"space-between",around:"space-around",evenly:"space-evenly"};if(t[e.value])return{"justify-content":t[e.value]};if(e.arbitrary)return{"justify-content":e.value}}return},bp=(e)=>{if(e.utility==="items"&&e.value){let t={start:"flex-start",end:"flex-end",center:"center",baseline:"baseline",stretch:"stretch"};if(t[e.value])return{"align-items":t[e.value]};if(e.arbitrary)return{"align-items":e.value}}return},xp=(e)=>{if(e.utility==="justify"&&e.value&&e.value.startsWith("items-")){let t={"items-start":"start","items-end":"end","items-center":"center","items-stretch":"stretch"};return t[e.value]?{"justify-items":t[e.value]}:void 0}return},vp=(e)=>{if(e.utility==="content"&&e.value){let t={normal:"normal",center:"center",start:"flex-start",end:"flex-end",between:"space-between",around:"space-around",evenly:"space-evenly",baseline:"baseline",stretch:"stretch"};return t[e.value]?{"align-content":t[e.value]}:void 0}return},wp=(e,t)=>{let n={p:["padding"],px:["padding-left","padding-right"],py:["padding-top","padding-bottom"],pt:["padding-top"],pr:["padding-right"],pb:["padding-bottom"],pl:["padding-left"],ps:["padding-inline-start"],pe:["padding-inline-end"],m:["margin"],mx:["margin-left","margin-right"],my:["margin-top","margin-bottom"],mt:["margin-top"],mr:["margin-right"],mb:["margin-bottom"],ml:["margin-left"],ms:["margin-inline-start"],me:["margin-inline-end"]}[e.utility];if(!n||!e.value)return;let i=(c)=>{if(c==="auto")return e.utility.charCodeAt(0)===109?"auto":void 0;let a=t.theme.spacing[c];if(a!==void 0)return a;if(e.arbitrary)return c;if(/^\d+(?:\.\d+)?$/.test(c)){let l=Number.parseFloat(c);if(Number.isFinite(l))return`${l*0.25}rem`}return},o;if(e.value.startsWith("-")){if(e.utility.charCodeAt(0)===112)return;let c=e.value.slice(1);if(c==="0")o=t.theme.spacing[c]||"0";else{let a=i(c);o=a===void 0?void 0:`-${a}`}}else o=i(e.value);if(o===void 0)return;let s={};for(let c of n)s[c]=o;return s};function Ee(e,t,r){let n=e.value;if(n.includes("/")&&!e.arbitrary){let[o,s]=n.split("/").map(Number);if(Number.isNaN(o)||Number.isNaN(s)||s===0)return;return ye(o,s)}let i=t.theme.spacing[n];if(i!==void 0)return i;if(r[n])return r[n];if(e.arbitrary)return n;if(/^\d+(?:\.\d+)?$/.test(n))return`${Number.parseFloat(n)*0.25}rem`;return}var Cp=(e,t)=>{if(e.utility==="w"&&e.value){let n=Ee(e,t,{full:"100%",screen:"100vw",svw:"100svw",lvw:"100lvw",dvw:"100dvw",auto:"auto",min:"min-content",max:"max-content",fit:"fit-content"});return n!==void 0?{width:n}:void 0}if(e.utility==="h"&&e.value){let n=Ee(e,t,{full:"100%",screen:"100vh",svh:"100svh",lvh:"100lvh",dvh:"100dvh",auto:"auto",min:"min-content",max:"max-content",fit:"fit-content"});return n!==void 0?{height:n}:void 0}if(e.utility==="size"&&e.value){let n=Ee(e,t,{full:"100%",auto:"auto",min:"min-content",max:"max-content",fit:"fit-content"});return n!==void 0?{width:n,height:n}:void 0}return},Le=null,Or=null,$p={bg:"background-color",text:"color",border:"border-color"},Rp={bg:{color:"background-color",image:"background-image",url:"background-image",position:"background-position",length:"background-size"},text:{color:"color",length:"font-size","absolute-size":"font-size","relative-size":"font-size","family-name":"font-family"},border:{color:"border-color",length:"border-width","line-width":"border-width"}},kp=new Set(["length","absolute-size","relative-size","percentage","number"]),Sp=/^(?:url|(?:repeating-)?(?:linear|radial|conic)-gradient|image-set|-webkit-image-set|cross-fade|element|paint)\(/i,al={current:"currentColor",transparent:"transparent",inherit:"inherit"};function ll(e){let t=new Map;for(let[r,n]of Object.entries(e))if(typeof n==="string")t.set(r,n);else if(typeof n==="object"&&n!==null){for(let[i,o]of Object.entries(n))if(typeof o==="string")t.set(i==="DEFAULT"?r:`${r}-${i}`,o)}return t}var Ep=(e,t)=>{let r=$p[e.utility];if(!r||!e.value)return;let n=e.value;if(e.arbitrary&&e.typeHint){let l=Rp[e.utility]?.[e.typeHint];return l?{[l]:n}:void 0}if(e.arbitrary&&e.utility==="bg"&&Sp.test(n))return{"background-image":n};if(Le===null||Or!==t.theme.colors)Le=ll(t.theme.colors),Or=t.theme.colors;let i=Se(n);if(i===-1){let l=Le.get(n);if(l)return{[r]:l}}let o,s=n;if(i!==-1){s=n.slice(0,i);let l=n.slice(i+1);if(l.charCodeAt(0)===91&&l.charCodeAt(l.length-1)===93){let f=Number.parseFloat(l.slice(1,-1));if(Number.isNaN(f)||f<0||f>1)return;o=f}else if(e.modifierArbitrary){let f=Number.parseFloat(l);if(Number.isNaN(f)||f<0||f>1)return;o=f}else{let f=Number.parseInt(l,10);if(Number.isNaN(f)||f<0||f>100)return;o=f/100}let u=Le.get(s);if(u)return{[r]:_e(u,o)}}let c=al[s];if(c)return{[r]:c};if((e.arbitrary||s&&s.charCodeAt(0)===91)&&s){let l=o!==void 0?_e(s,o):s;return{[r]:l}}return};function _e(e,t){let r=e;if(e.charCodeAt(0)===91&&e.charCodeAt(e.length-1)===93)r=e.slice(1,-1);if(r.charCodeAt(0)===35){let n=r.slice(1);if(n.length===3||n.length===4)n=n.split("").map((c)=>c+c).join("");let i=Number.parseInt(n.slice(0,2),16),o=Number.parseInt(n.slice(2,4),16),s=Number.parseInt(n.slice(4,6),16);return`rgb(${i} ${o} ${s} / ${t})`}if(r.charCodeAt(0)===114){let n=r.match(/rgb\((\d+)\s+(\d+)\s+(\d+)/);if(n)return`rgb(${n[1]} ${n[2]} ${n[3]} / ${t})`}if(r.charCodeAt(0)===111){let n=r.match(/oklch\(([^)]+)\)/);if(n)return`oklch(${n[1]} / ${t})`}if(r.charCodeAt(0)===104){let n=r.match(/hsl\(([^)]+)\)/);if(n)return`hsl(${n[1]} / ${t})`}if(r!=="inherit"&&r!=="transparent"){let n=Number((t*100).toFixed(2));return`color-mix(in srgb, ${r} ${n}%, transparent)`}return r}function ie(e,t,r=!1){let n=Se(e),i=e,o;if(n!==-1){i=e.slice(0,n);let l=e.slice(n+1);if(l.charCodeAt(0)===91&&l.charCodeAt(l.length-1)===93){if(o=Number.parseFloat(l.slice(1,-1)),Number.isNaN(o)||o<0||o>1)return}else if(r){if(o=Number.parseFloat(l),Number.isNaN(o)||o<0||o>1)return}else{let u=Number.parseInt(l,10);if(Number.isNaN(u)||u<0||u>100)return;o=u/100}}let s={current:"currentColor",transparent:"transparent",inherit:"inherit",auto:"auto"};if(s[i])return o!==void 0?_e(s[i],o):s[i];let c=t.theme.colors[i];if(typeof c==="string")return o!==void 0?_e(c,o):c;if(typeof c==="object"&&c!==null&&typeof c.DEFAULT==="string")return o!==void 0?_e(c.DEFAULT,o):c.DEFAULT;let a=i.split("-");if(a.length>=2){let l=a[a.length-1],u=a.slice(0,-1).join("-"),f=t.theme.colors[u];if(typeof f==="object"&&f[l])return o!==void 0?_e(f[l],o):f[l]}if(i.startsWith("var(")||i.startsWith("#")||i.startsWith("rgb(")||i.startsWith("rgba(")||i.startsWith("hsl(")||i.startsWith("hsla(")||i.startsWith("oklch(")||i.startsWith("oklab(")||i.startsWith("lab(")||i.startsWith("lch(")||i.startsWith("color(")||i.startsWith("color-mix(")||i.startsWith("hwb("))return o!==void 0?_e(i,o):i;return}var Ap=(e,t)=>{if(e.utility!=="placeholder"||!e.value)return;if(Le===null||Or!==t.theme.colors)Le=ll(t.theme.colors),Or=t.theme.colors;let r=e.value,n=Se(r);if(n===-1){let o=Le.get(r);if(o)return{properties:{color:o},pseudoElement:"::placeholder"}}else{let o=r.slice(0,n),s=r.slice(n+1),c;if(s.charCodeAt(0)===91&&s.charCodeAt(s.length-1)===93){let l=Number.parseFloat(s.slice(1,-1));if(Number.isNaN(l)||l<0||l>1)return;c=l}else if(e.modifierArbitrary){let l=Number.parseFloat(s);if(Number.isNaN(l)||l<0||l>1)return;c=l}else{let l=Number.parseInt(s,10);if(Number.isNaN(l)||l<0||l>100)return;c=l/100}let a=Le.get(o);if(a)return{properties:{color:_e(a,c)},pseudoElement:"::placeholder"}}let i=al[e.value];if(i)return{properties:{color:i},pseudoElement:"::placeholder"};return},Tp=(e,t)=>{if(e.utility==="text"&&e.value){let r=e.value,n,i=r.lastIndexOf("/");if(i!==-1&&!e.value.startsWith("[")&&!r.slice(i+1).includes("]"));if(i!==-1){let s=r.slice(0,i),c=r.slice(i+1);if(c&&(t.theme.fontSize[s]||e.arbitrary)){r=s;let a={none:"1",tight:"1.25",snug:"1.375",normal:"1.5",relaxed:"1.625",loose:"2",3:"0.75rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem"};n=t.theme.lineHeight?.[c]??a[c]??c}}if(e.arbitrary){if(e.typeHint){if(!kp.has(e.typeHint))return;let c={"font-size":r};if(n)c["line-height"]=n;return c}if(/^#|^rgb|^hsl|^hwb|^lab|^lch|^oklch|^oklab|^color\(|^var\(--/.test(r))return;let s={"font-size":r};if(n)s["line-height"]=n;return s}let o=t.theme.fontSize[r];if(o)return{"font-size":o[0],"line-height":n??o[1].lineHeight}}},Np=(e)=>{if(e.utility==="font"&&e.value){if(e.arbitrary){let r=e.typeHint;return r==="family-name"||r==="string"?{"font-family":e.value}:{"font-weight":e.value}}let t={thin:"100",extralight:"200",light:"300",normal:"400",medium:"500",semibold:"600",bold:"700",extrabold:"800",black:"900"};return t[e.value]?{"font-weight":t[e.value]}:void 0}return},Op=(e)=>{if(e.utility==="leading"&&e.value){if(e.arbitrary)return{"line-height":e.value};let t={none:"1",tight:"1.25",snug:"1.375",normal:"1.5",relaxed:"1.625",loose:"2","3":"0.75rem","4":"1rem","5":"1.25rem","6":"1.5rem","7":"1.75rem","8":"2rem","9":"2.25rem","10":"2.5rem"};return t[e.value]?{"line-height":t[e.value]}:void 0}return},Ip=(e)=>{if(e.utility==="text"&&e.value){let t={left:"left",center:"center",right:"right",justify:"justify"};return t[e.value]?{"text-align":t[e.value]}:void 0}},Pp=(e)=>{if(e.utility==="border"){if(!e.value)return{"border-width":"1px"};let t={0:"0px",2:"2px",4:"4px",8:"8px"};if(t[e.value])return{"border-width":t[e.value]};let r={t:"border-top-width",r:"border-right-width",b:"border-bottom-width",l:"border-left-width",s:"border-inline-start-width",e:"border-inline-end-width"};if(e.value==="x")return{"border-left-width":"1px","border-right-width":"1px"};if(e.value==="y")return{"border-top-width":"1px","border-bottom-width":"1px"};let n=r[e.value];if(typeof n==="string")return{[n]:"1px"};return}},_p=(e,t)=>{let r={"border-t":"border-top-width","border-r":"border-right-width","border-b":"border-bottom-width","border-l":"border-left-width","border-x":["border-left-width","border-right-width"],"border-y":["border-top-width","border-bottom-width"],"border-s":"border-inline-start-width","border-e":"border-inline-end-width"},n={"border-t":"border-top-color","border-r":"border-right-color","border-b":"border-bottom-color","border-l":"border-left-color","border-x":["border-left-color","border-right-color"],"border-y":["border-top-color","border-bottom-color"],"border-s":"border-inline-start-color","border-e":"border-inline-end-color"},i=r[e.utility];if(!i)return;if(!e.value){let s=i;if(Array.isArray(s))return s.reduce((c,a)=>({...c,[a]:"1px"}),{});return{[s]:"1px"}}if(e.arbitrary){let s=e.value,l=(/^#|^(?:rgb|rgba|hsl|hsla|oklch|oklab|lab|lch)\(|^(?:currentColor|transparent|inherit)$/i.test(s)?n[e.utility]:i)??i;if(Array.isArray(l))return l.reduce((u,f)=>({...u,[f]:s}),{});return{[l]:s}}if(ti[e.value]){let s=i;if(Array.isArray(s))return s.reduce((c,a)=>({...c,[a]:ti[e.value]}),{});return{[s]:ti[e.value]}}let o=n[e.utility];if(o&&t){let s=e.value.split("-");if(s.length>=2){let a=s[s.length-1],l=s.slice(0,-1).join("-"),u=t.theme.colors[l];if(u&&typeof u==="object"&&u[a]){let f=o;if(Array.isArray(f))return f.reduce((d,h)=>({...d,[h]:u[a]}),{});return{[f]:u[a]}}}let c=t.theme.colors[e.value];if(typeof c==="string"){let a=o;if(Array.isArray(a))return a.reduce((l,u)=>({...l,[u]:c}),{});return{[a]:c}}if(c&&typeof c==="object"&&typeof c.DEFAULT==="string"){let a=o;if(Array.isArray(a))return a.reduce((l,u)=>({...l,[u]:c.DEFAULT}),{});return{[a]:c.DEFAULT}}if(e.value==="transparent"||e.value==="current"||e.value==="inherit"){let a=e.value==="current"?"currentColor":e.value,l=o;if(Array.isArray(l))return l.reduce((u,f)=>({...u,[f]:a}),{});return{[l]:a}}}return};function Ke(e,t){if(!e.value)return t.theme.borderRadius.DEFAULT;if(t.theme.borderRadius[e.value]!==void 0)return t.theme.borderRadius[e.value];if(e.arbitrary)return e.value;return}var sl={t:["border-top-left-radius","border-top-right-radius"],r:["border-top-right-radius","border-bottom-right-radius"],b:["border-bottom-left-radius","border-bottom-right-radius"],l:["border-top-left-radius","border-bottom-left-radius"],tl:["border-top-left-radius"],tr:["border-top-right-radius"],bl:["border-bottom-left-radius"],br:["border-bottom-right-radius"],s:["border-start-start-radius","border-end-start-radius"],e:["border-start-end-radius","border-end-end-radius"],ss:["border-start-start-radius"],se:["border-start-end-radius"],es:["border-end-start-radius"],ee:["border-end-end-radius"]},Lp=(e,t)=>{if(e.utility==="rounded"){if(e.arbitrary&&e.value)return{"border-radius":e.value};if(e.value&&sl[e.value]){let o=t.theme.borderRadius.DEFAULT,s={};for(let c of sl[e.value])s[c]=o;return s}let i=e.value?t.theme.borderRadius[e.value]:t.theme.borderRadius.DEFAULT;return i?{"border-radius":i}:void 0}if(e.utility==="rounded-s"){let i=Ke(e,t);if(i===void 0)return;return{"border-start-start-radius":i,"border-end-start-radius":i}}if(e.utility==="rounded-e"){let i=Ke(e,t);if(i===void 0)return;return{"border-start-end-radius":i,"border-end-end-radius":i}}if(e.utility==="rounded-ss"){let i=Ke(e,t);if(i===void 0)return;return{"border-start-start-radius":i}}if(e.utility==="rounded-se"){let i=Ke(e,t);if(i===void 0)return;return{"border-start-end-radius":i}}if(e.utility==="rounded-es"){let i=Ke(e,t);if(i===void 0)return;return{"border-end-start-radius":i}}if(e.utility==="rounded-ee"){let i=Ke(e,t);if(i===void 0)return;return{"border-end-end-radius":i}}let n={"rounded-t":["border-top-left-radius","border-top-right-radius"],"rounded-r":["border-top-right-radius","border-bottom-right-radius"],"rounded-b":["border-bottom-left-radius","border-bottom-right-radius"],"rounded-l":["border-top-left-radius","border-bottom-left-radius"],"rounded-tl":["border-top-left-radius"],"rounded-tr":["border-top-right-radius"],"rounded-bl":["border-bottom-left-radius"],"rounded-br":["border-bottom-right-radius"]}[e.utility];if(n){let i=Ke(e,t);if(i===void 0)return;let o={};for(let s of n)o[s]=i;return o}},ri=[Gs,wp,Cp,vp,Tp,Ip,...nl,Np,Op,...Xn,Ap,Ep,...Ls,...Aa,dp,hp,gp,mp,pp,yp,bp,xp,...Ws,...Ba,...Xn,...ma,...Vs,_p,Pp,Lp,fp,cp,up,lp];function ii(e,t){let r={...e};for(let n in t){let i=t[n],o=r[n];if(i&&typeof i==="object"&&!Array.isArray(i)&&o&&typeof o==="object"&&!Array.isArray(o))r[n]=ii(o,i);else if(i!==void 0)r[n]=i}return r}var Mp={block:{display:"block"},"inline-block":{display:"inline-block"},inline:{display:"inline"},flex:{display:"flex"},"inline-flex":{display:"inline-flex"},grid:{display:"grid"},"inline-grid":{display:"inline-grid"},hidden:{display:"none"},none:{display:"none"}},Fp={"flex-row":{"flex-direction":"row"},"flex-row-reverse":{"flex-direction":"row-reverse"},"flex-col":{"flex-direction":"column"},"flex-col-reverse":{"flex-direction":"column-reverse"}},Dp={"flex-wrap":{"flex-wrap":"wrap"},"flex-wrap-reverse":{"flex-wrap":"wrap-reverse"},"flex-nowrap":{"flex-wrap":"nowrap"}},jp={"flex-1":{flex:"1 1 0%"},"flex-auto":{flex:"1 1 auto"},"flex-initial":{flex:"0 1 auto"},"flex-none":{flex:"none"}},Bp={grow:{"flex-grow":"1"},"grow-0":{"flex-grow":"0"},shrink:{"flex-shrink":"1"},"shrink-0":{"flex-shrink":"0"}},Up={start:"flex-start",end:"flex-end",center:"center",between:"space-between",around:"space-around",evenly:"space-evenly"},Vp={start:"flex-start",end:"flex-end",center:"center",baseline:"baseline",stretch:"stretch"},zp={normal:"normal",center:"center",start:"flex-start",end:"flex-end",between:"space-between",around:"space-around",evenly:"space-evenly",baseline:"baseline",stretch:"stretch"},Wp={auto:"auto",start:"flex-start",end:"flex-end",center:"center",stretch:"stretch",baseline:"baseline"},Kp={"border-solid":{"border-style":"solid"},"border-dashed":{"border-style":"dashed"},"border-dotted":{"border-style":"dotted"},"border-double":{"border-style":"double"},"border-none":{"border-style":"none"}},Gp={transform:{transform:kt},"transform-cpu":{transform:kt},"transform-gpu":{transform:ei},"transform-none":{transform:"none"}},lt={"transition-timing-function":"cubic-bezier(0.4, 0, 0.2, 1)","transition-duration":"150ms"},Hp={"transition-none":{"transition-property":"none"},"transition-all":{"transition-property":"all",...lt},transition:{"transition-property":"color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter",...lt},"transition-colors":{"transition-property":"color, background-color, border-color, text-decoration-color, fill, stroke",...lt},"transition-opacity":{"transition-property":"opacity",...lt},"transition-shadow":{"transition-property":"box-shadow",...lt},"transition-transform":{"transition-property":"transform",...lt}},qp={"ease-linear":{"transition-timing-function":"linear"},"ease-in":{"transition-timing-function":"cubic-bezier(0.4, 0, 1, 1)"},"ease-out":{"transition-timing-function":"cubic-bezier(0, 0, 0.2, 1)"},"ease-in-out":{"transition-timing-function":"cubic-bezier(0.4, 0, 0.2, 1)"}},Yp={"animate-none":{animation:"none"},"animate-spin":{animation:"spin 1s linear infinite"},"animate-ping":{animation:"ping 1s cubic-bezier(0, 0, 0.2, 1) infinite"},"animate-pulse":{animation:"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite"},"animate-bounce":{animation:"bounce 1s infinite"}},Jp={spin:`@keyframes spin {
|
|
356
356
|
from { transform: rotate(0deg); }
|
|
357
357
|
to { transform: rotate(360deg); }
|
|
358
358
|
}`,ping:`@keyframes ping {
|
|
@@ -363,14 +363,14 @@ video {
|
|
|
363
363
|
}`,bounce:`@keyframes bounce {
|
|
364
364
|
0%, 100% { transform: translateY(-25%); animation-timing-function: cubic-bezier(0.8, 0, 1, 1); }
|
|
365
365
|
50% { transform: translateY(0); animation-timing-function: cubic-bezier(0, 0, 0.2, 1); }
|
|
366
|
-
}`},Yp={center:"center",top:"top","top-right":"top right",right:"right","bottom-right":"bottom right",bottom:"bottom","bottom-left":"bottom left",left:"left","top-left":"top left"},Jp={"1":"repeat(1, minmax(0, 1fr))","2":"repeat(2, minmax(0, 1fr))","3":"repeat(3, minmax(0, 1fr))","4":"repeat(4, minmax(0, 1fr))","5":"repeat(5, minmax(0, 1fr))","6":"repeat(6, minmax(0, 1fr))","7":"repeat(7, minmax(0, 1fr))","8":"repeat(8, minmax(0, 1fr))","9":"repeat(9, minmax(0, 1fr))","10":"repeat(10, minmax(0, 1fr))","11":"repeat(11, minmax(0, 1fr))","12":"repeat(12, minmax(0, 1fr))",none:"none",subgrid:"subgrid"},Xp={"1":"repeat(1, minmax(0, 1fr))","2":"repeat(2, minmax(0, 1fr))","3":"repeat(3, minmax(0, 1fr))","4":"repeat(4, minmax(0, 1fr))","5":"repeat(5, minmax(0, 1fr))","6":"repeat(6, minmax(0, 1fr))",none:"none",subgrid:"subgrid"},Zp={auto:"auto","span-1":"span 1 / span 1","span-2":"span 2 / span 2","span-3":"span 3 / span 3","span-4":"span 4 / span 4","span-5":"span 5 / span 5","span-6":"span 6 / span 6","span-7":"span 7 / span 7","span-8":"span 8 / span 8","span-9":"span 9 / span 9","span-10":"span 10 / span 10","span-11":"span 11 / span 11","span-12":"span 12 / span 12","span-full":"1 / -1"},Qp={auto:"auto","span-1":"span 1 / span 1","span-2":"span 2 / span 2","span-3":"span 3 / span 3","span-4":"span 4 / span 4","span-5":"span 5 / span 5","span-6":"span 6 / span 6","span-full":"1 / -1"},ey={row:"row",col:"column",dense:"dense","row-dense":"row dense","col-dense":"column dense"},ll={auto:"auto",min:"min-content",max:"max-content",fr:"minmax(0, 1fr)"},ni={center:"center",start:"start",end:"end",between:"space-between",around:"space-around",evenly:"space-evenly",stretch:"stretch"};function ct(e){return{"--tc-ring-offset-shadow":"var(--tc-ring-inset,) 0 0 0 var(--tc-ring-offset-width, 0px) var(--tc-ring-offset-color, #fff)","--tc-ring-shadow":`var(--tc-ring-inset,) 0 0 0 calc(${e} + var(--tc-ring-offset-width, 0px)) var(--tc-ring-color, rgba(59, 130, 246, 0.5))`,"box-shadow":"var(--tc-ring-offset-shadow), var(--tc-ring-shadow), var(--tc-shadow, 0 0 #0000)"}}var ty={ring:ct("3px"),"ring-0":ct("0px"),"ring-1":ct("1px"),"ring-2":ct("2px"),"ring-4":ct("4px"),"ring-8":ct("8px"),"ring-inset":{"--tc-ring-inset":"inset"}},Rl={"shadow-2xs":{"--tc-shadow":"0 1px rgb(0 0 0 / 0.05)","--tc-shadow-colored":"0 1px var(--tc-shadow-color)","box-shadow":"var(--tc-ring-offset-shadow, 0 0 #0000), var(--tc-ring-shadow, 0 0 #0000), var(--tc-shadow)"},"shadow-xs":{"--tc-shadow":"0 1px 2px 0 rgb(0 0 0 / 0.05)","--tc-shadow-colored":"0 1px 2px 0 var(--tc-shadow-color)","box-shadow":"var(--tc-ring-offset-shadow, 0 0 #0000), var(--tc-ring-shadow, 0 0 #0000), var(--tc-shadow)"},"shadow-sm":{"--tc-shadow":"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)","--tc-shadow-colored":"0 1px 3px 0 var(--tc-shadow-color), 0 1px 2px -1px var(--tc-shadow-color)","box-shadow":"var(--tc-ring-offset-shadow, 0 0 #0000), var(--tc-ring-shadow, 0 0 #0000), var(--tc-shadow)"},shadow:{"--tc-shadow":"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)","--tc-shadow-colored":"0 1px 3px 0 var(--tc-shadow-color), 0 1px 2px -1px var(--tc-shadow-color)","box-shadow":"var(--tc-ring-offset-shadow, 0 0 #0000), var(--tc-ring-shadow, 0 0 #0000), var(--tc-shadow)"},"shadow-md":{"--tc-shadow":"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)","--tc-shadow-colored":"0 4px 6px -1px var(--tc-shadow-color), 0 2px 4px -2px var(--tc-shadow-color)","box-shadow":"var(--tc-ring-offset-shadow, 0 0 #0000), var(--tc-ring-shadow, 0 0 #0000), var(--tc-shadow)"},"shadow-lg":{"--tc-shadow":"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)","--tc-shadow-colored":"0 10px 15px -3px var(--tc-shadow-color), 0 4px 6px -4px var(--tc-shadow-color)","box-shadow":"var(--tc-ring-offset-shadow, 0 0 #0000), var(--tc-ring-shadow, 0 0 #0000), var(--tc-shadow)"},"shadow-xl":{"--tc-shadow":"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)","--tc-shadow-colored":"0 20px 25px -5px var(--tc-shadow-color), 0 8px 10px -6px var(--tc-shadow-color)","box-shadow":"var(--tc-ring-offset-shadow, 0 0 #0000), var(--tc-ring-shadow, 0 0 #0000), var(--tc-shadow)"},"shadow-2xl":{"--tc-shadow":"0 25px 50px -12px rgb(0 0 0 / 0.25)","--tc-shadow-colored":"0 25px 50px -12px var(--tc-shadow-color)","box-shadow":"var(--tc-ring-offset-shadow, 0 0 #0000), var(--tc-ring-shadow, 0 0 #0000), var(--tc-shadow)"},"shadow-inner":{"--tc-shadow":"inset 0 2px 4px 0 rgb(0 0 0 / 0.05)","--tc-shadow-colored":"inset 0 2px 4px 0 var(--tc-shadow-color)","box-shadow":"var(--tc-ring-offset-shadow, 0 0 #0000), var(--tc-ring-shadow, 0 0 #0000), var(--tc-shadow)"},"shadow-none":{"--tc-shadow":"0 0 #0000","box-shadow":"var(--tc-ring-offset-shadow, 0 0 #0000), var(--tc-ring-shadow, 0 0 #0000), var(--tc-shadow)"}},kl={"rounded-none":{"border-radius":"0px"},"rounded-xs":{"border-radius":"0.125rem"},"rounded-sm":{"border-radius":"0.25rem"},rounded:{"border-radius":"0.25rem"},"rounded-md":{"border-radius":"0.375rem"},"rounded-lg":{"border-radius":"0.5rem"},"rounded-xl":{"border-radius":"0.75rem"},"rounded-2xl":{"border-radius":"1rem"},"rounded-3xl":{"border-radius":"1.5rem"},"rounded-4xl":{"border-radius":"2rem"},"rounded-full":{"border-radius":"9999px"},"rounded-t-none":{"border-top-left-radius":"0px","border-top-right-radius":"0px"},"rounded-t-sm":{"border-top-left-radius":"0.25rem","border-top-right-radius":"0.25rem"},"rounded-t-lg":{"border-top-left-radius":"0.5rem","border-top-right-radius":"0.5rem"},"rounded-r-lg":{"border-top-right-radius":"0.5rem","border-bottom-right-radius":"0.5rem"},"rounded-b-lg":{"border-bottom-left-radius":"0.5rem","border-bottom-right-radius":"0.5rem"},"rounded-l-lg":{"border-top-left-radius":"0.5rem","border-bottom-left-radius":"0.5rem"},"rounded-tl-lg":{"border-top-left-radius":"0.5rem"},"rounded-tr-lg":{"border-top-right-radius":"0.5rem"},"rounded-br-lg":{"border-bottom-right-radius":"0.5rem"},"rounded-bl-lg":{"border-bottom-left-radius":"0.5rem"}},ry={border:{"border-width":"1px"},"border-0":{"border-width":"0px"},"border-2":{"border-width":"2px"},"border-4":{"border-width":"4px"},"border-8":{"border-width":"8px"},"border-t":{"border-top-width":"1px"},"border-r":{"border-right-width":"1px"},"border-b":{"border-bottom-width":"1px"},"border-l":{"border-left-width":"1px"},"border-t-0":{"border-top-width":"0px"},"border-r-0":{"border-right-width":"0px"},"border-b-0":{"border-bottom-width":"0px"},"border-l-0":{"border-left-width":"0px"},"border-t-2":{"border-top-width":"2px"},"border-r-2":{"border-right-width":"2px"},"border-b-2":{"border-bottom-width":"2px"},"border-l-2":{"border-left-width":"2px"},"border-t-4":{"border-top-width":"4px"},"border-r-4":{"border-right-width":"4px"},"border-b-4":{"border-bottom-width":"4px"},"border-l-4":{"border-left-width":"4px"},"border-x":{"border-left-width":"1px","border-right-width":"1px"},"border-y":{"border-top-width":"1px","border-bottom-width":"1px"},"border-x-0":{"border-left-width":"0px","border-right-width":"0px"},"border-y-0":{"border-top-width":"0px","border-bottom-width":"0px"},"border-x-2":{"border-left-width":"2px","border-right-width":"2px"},"border-y-2":{"border-top-width":"2px","border-bottom-width":"2px"}},ny={"ring-offset-0":{"--tc-ring-offset-width":"0px"},"ring-offset-1":{"--tc-ring-offset-width":"1px"},"ring-offset-2":{"--tc-ring-offset-width":"2px"},"ring-offset-4":{"--tc-ring-offset-width":"4px"},"ring-offset-8":{"--tc-ring-offset-width":"8px"}},iy={"opacity-0":{opacity:"0"},"opacity-5":{opacity:"0.05"},"opacity-10":{opacity:"0.1"},"opacity-20":{opacity:"0.2"},"opacity-25":{opacity:"0.25"},"opacity-30":{opacity:"0.3"},"opacity-40":{opacity:"0.4"},"opacity-50":{opacity:"0.5"},"opacity-60":{opacity:"0.6"},"opacity-70":{opacity:"0.7"},"opacity-75":{opacity:"0.75"},"opacity-80":{opacity:"0.8"},"opacity-90":{opacity:"0.9"},"opacity-95":{opacity:"0.95"},"opacity-100":{opacity:"1"}},Ir={"0":"0",px:"1px","0.5":"0.125rem","1":"0.25rem","1.5":"0.375rem","2":"0.5rem","2.5":"0.625rem","3":"0.75rem","3.5":"0.875rem","4":"1rem","5":"1.25rem","6":"1.5rem","7":"1.75rem","8":"2rem","9":"2.25rem","10":"2.5rem","11":"2.75rem","12":"3rem","14":"3.5rem","16":"4rem","20":"5rem","24":"6rem","28":"7rem","32":"8rem","36":"9rem","40":"10rem","44":"11rem","48":"12rem","52":"13rem","56":"14rem","60":"15rem","64":"16rem","72":"18rem","80":"20rem","96":"24rem"},cl={...Ir,auto:"auto",full:"100%",screen:"100vw",min:"min-content",max:"max-content",fit:"fit-content",...oy(6)};function oy(e){let t={};for(let r=2;r<=e;r++)for(let n=1;n<r;n++)t[`${n}/${r}`]=ye(n,r);return t}var ut={"gray-50":"oklch(98.5% 0.002 247.839)","gray-100":"oklch(96.7% 0.003 264.542)","gray-200":"oklch(92.8% 0.006 264.531)","gray-300":"oklch(87.2% 0.01 258.338)","gray-400":"oklch(70.7% 0.022 261.325)","gray-500":"oklch(55.1% 0.027 264.364)","gray-600":"oklch(44.6% 0.03 256.802)","gray-700":"oklch(37.3% 0.034 259.733)","gray-800":"oklch(27.8% 0.033 256.848)","gray-900":"oklch(21% 0.034 264.665)","gray-950":"oklch(13% 0.028 261.692)","red-50":"oklch(97.1% 0.013 17.38)","red-100":"oklch(93.6% 0.032 17.717)","red-200":"oklch(88.5% 0.062 18.334)","red-300":"oklch(80.8% 0.114 19.571)","red-400":"oklch(70.4% 0.191 22.216)","red-500":"oklch(63.7% 0.237 25.331)","red-600":"oklch(57.7% 0.245 27.325)","red-700":"oklch(50.5% 0.213 27.518)","red-800":"oklch(44.4% 0.177 26.899)","red-900":"oklch(39.6% 0.141 25.723)","red-950":"oklch(25.8% 0.092 26.042)","blue-50":"oklch(97% 0.014 254.604)","blue-100":"oklch(93.2% 0.032 255.585)","blue-200":"oklch(88.2% 0.059 254.128)","blue-300":"oklch(80.9% 0.105 251.813)","blue-400":"oklch(70.7% 0.165 254.624)","blue-500":"oklch(62.3% 0.214 259.815)","blue-600":"oklch(54.6% 0.245 262.881)","blue-700":"oklch(48.8% 0.243 264.376)","blue-800":"oklch(42.4% 0.199 265.638)","blue-900":"oklch(37.9% 0.146 265.522)","blue-950":"oklch(28.2% 0.091 267.935)","green-50":"oklch(98.2% 0.018 155.826)","green-100":"oklch(96.2% 0.044 156.743)","green-200":"oklch(92.5% 0.084 155.995)","green-300":"oklch(87.1% 0.15 154.449)","green-400":"oklch(79.2% 0.209 151.711)","green-500":"oklch(72.3% 0.219 149.579)","green-600":"oklch(62.7% 0.194 149.214)","green-700":"oklch(52.7% 0.154 150.069)","green-800":"oklch(44.8% 0.119 151.328)","green-900":"oklch(39.3% 0.095 152.535)","green-950":"oklch(26.6% 0.065 152.934)","yellow-50":"oklch(98.7% 0.026 102.212)","yellow-100":"oklch(97.3% 0.071 103.193)","yellow-200":"oklch(94.5% 0.129 101.54)","yellow-300":"oklch(90.5% 0.182 98.111)","yellow-400":"oklch(85.2% 0.199 91.936)","yellow-500":"oklch(79.5% 0.184 86.047)","yellow-600":"oklch(68.1% 0.162 75.834)","yellow-700":"oklch(55.4% 0.135 66.442)","yellow-800":"oklch(47.6% 0.114 61.907)","yellow-900":"oklch(42.1% 0.095 57.708)","yellow-950":"oklch(28.6% 0.066 53.813)","purple-50":"oklch(97.7% 0.014 308.299)","purple-100":"oklch(94.6% 0.033 307.174)","purple-200":"oklch(90.2% 0.063 306.703)","purple-300":"oklch(82.7% 0.119 306.383)","purple-400":"oklch(71.4% 0.203 305.504)","purple-500":"oklch(62.7% 0.265 303.9)","purple-600":"oklch(55.8% 0.288 302.321)","purple-700":"oklch(49.6% 0.265 301.924)","purple-800":"oklch(43.8% 0.218 303.724)","purple-900":"oklch(38.1% 0.176 304.987)","purple-950":"oklch(29.1% 0.149 302.717)","pink-50":"oklch(97.1% 0.014 343.198)","pink-100":"oklch(94.8% 0.028 342.258)","pink-200":"oklch(89.9% 0.061 343.231)","pink-300":"oklch(82.3% 0.12 346.018)","pink-400":"oklch(71.8% 0.202 349.761)","pink-500":"oklch(65.6% 0.241 354.308)","pink-600":"oklch(59.2% 0.249 0.584)","pink-700":"oklch(52.5% 0.223 3.958)","pink-800":"oklch(45.9% 0.187 3.815)","pink-900":"oklch(40.8% 0.153 2.432)","pink-950":"oklch(28.4% 0.109 3.907)","indigo-50":"oklch(96.2% 0.018 272.314)","indigo-100":"oklch(93% 0.034 272.788)","indigo-200":"oklch(87% 0.065 274.039)","indigo-300":"oklch(78.5% 0.115 274.713)","indigo-400":"oklch(67.3% 0.182 276.935)","indigo-500":"oklch(58.5% 0.233 277.117)","indigo-600":"oklch(51.1% 0.262 276.966)","indigo-700":"oklch(45.7% 0.24 277.023)","indigo-800":"oklch(39.8% 0.195 277.366)","indigo-900":"oklch(35.9% 0.144 278.697)","indigo-950":"oklch(25.7% 0.09 281.288)","cyan-50":"oklch(98.4% 0.019 200.873)","cyan-100":"oklch(95.6% 0.045 203.388)","cyan-200":"oklch(91.7% 0.08 205.041)","cyan-300":"oklch(86.5% 0.127 207.078)","cyan-400":"oklch(78.9% 0.154 211.53)","cyan-500":"oklch(71.5% 0.143 215.221)","cyan-600":"oklch(60.9% 0.126 221.723)","cyan-700":"oklch(52% 0.105 223.128)","cyan-800":"oklch(45% 0.085 224.283)","cyan-900":"oklch(39.8% 0.07 227.392)","cyan-950":"oklch(30.2% 0.056 229.695)","emerald-50":"oklch(97.9% 0.021 166.113)","emerald-100":"oklch(95% 0.052 163.051)","emerald-200":"oklch(90.5% 0.093 164.15)","emerald-300":"oklch(84.5% 0.143 164.978)","emerald-400":"oklch(76.5% 0.177 163.223)","emerald-500":"oklch(69.6% 0.17 162.48)","emerald-600":"oklch(59.6% 0.145 163.225)","emerald-700":"oklch(50.8% 0.118 165.612)","emerald-800":"oklch(43.2% 0.095 166.913)","emerald-900":"oklch(37.8% 0.077 168.94)","emerald-950":"oklch(26.2% 0.051 172.552)",white:"#fff",black:"#000",transparent:"transparent",current:"currentColor"},sy={"font-thin":{"font-weight":"100"},"font-extralight":{"font-weight":"200"},"font-light":{"font-weight":"300"},"font-normal":{"font-weight":"400"},"font-medium":{"font-weight":"500"},"font-semibold":{"font-weight":"600"},"font-bold":{"font-weight":"700"},"font-extrabold":{"font-weight":"800"},"font-black":{"font-weight":"900"}},ay={italic:{"font-style":"italic"},"not-italic":{"font-style":"normal"}},ly={uppercase:{"text-transform":"uppercase"},lowercase:{"text-transform":"lowercase"},capitalize:{"text-transform":"capitalize"},"normal-case":{"text-transform":"none"}},cy={underline:{"text-decoration-line":"underline"},overline:{"text-decoration-line":"overline"},"line-through":{"text-decoration-line":"line-through"},"no-underline":{"text-decoration-line":"none"}},uy={"decoration-solid":{"text-decoration-style":"solid"},"decoration-double":{"text-decoration-style":"double"},"decoration-dotted":{"text-decoration-style":"dotted"},"decoration-dashed":{"text-decoration-style":"dashed"},"decoration-wavy":{"text-decoration-style":"wavy"}},fy={"text-left":{"text-align":"left"},"text-center":{"text-align":"center"},"text-right":{"text-align":"right"},"text-justify":{"text-align":"justify"},"text-start":{"text-align":"start"},"text-end":{"text-align":"end"}},dy={truncate:{overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"},"text-ellipsis":{"text-overflow":"ellipsis"},"text-clip":{"text-overflow":"clip"}},hy={"text-wrap":{"text-wrap":"wrap"},"text-nowrap":{"text-wrap":"nowrap"},"text-balance":{"text-wrap":"balance"},"text-pretty":{"text-wrap":"pretty"}},gy={"whitespace-normal":{"white-space":"normal"},"whitespace-nowrap":{"white-space":"nowrap"},"whitespace-pre":{"white-space":"pre"},"whitespace-pre-line":{"white-space":"pre-line"},"whitespace-pre-wrap":{"white-space":"pre-wrap"},"whitespace-break-spaces":{"white-space":"break-spaces"}},my={"break-normal":{"overflow-wrap":"normal","word-break":"normal"},"break-words":{"overflow-wrap":"break-word"},"break-all":{"word-break":"break-all"},"break-keep":{"word-break":"keep-all"}},py={"align-baseline":{"vertical-align":"baseline"},"align-top":{"vertical-align":"top"},"align-middle":{"vertical-align":"middle"},"align-bottom":{"vertical-align":"bottom"},"align-text-top":{"vertical-align":"text-top"},"align-text-bottom":{"vertical-align":"text-bottom"},"align-sub":{"vertical-align":"sub"},"align-super":{"vertical-align":"super"}},yy={"list-none":{"list-style-type":"none"},"list-disc":{"list-style-type":"disc"},"list-decimal":{"list-style-type":"decimal"},"list-inside":{"list-style-position":"inside"},"list-outside":{"list-style-position":"outside"}},by={"hyphens-none":{hyphens:"none"},"hyphens-manual":{hyphens:"manual"},"hyphens-auto":{hyphens:"auto"}},xy={static:{position:"static"},fixed:{position:"fixed"},absolute:{position:"absolute"},relative:{position:"relative"},sticky:{position:"sticky"}},vy={visible:{visibility:"visible"},invisible:{visibility:"hidden"},collapse:{visibility:"collapse"}},wy={"float-left":{float:"left"},"float-right":{float:"right"},"float-none":{float:"none"},"float-start":{float:"inline-start"},"float-end":{float:"inline-end"}},Cy={"clear-left":{clear:"left"},"clear-right":{clear:"right"},"clear-both":{clear:"both"},"clear-none":{clear:"none"},"clear-start":{clear:"inline-start"},"clear-end":{clear:"inline-end"}},$y={isolate:{isolation:"isolate"},"isolation-auto":{isolation:"auto"}},Ry={"object-contain":{"object-fit":"contain"},"object-cover":{"object-fit":"cover"},"object-fill":{"object-fit":"fill"},"object-none":{"object-fit":"none"},"object-scale-down":{"object-fit":"scale-down"}},ky={"object-bottom":{"object-position":"bottom"},"object-center":{"object-position":"center"},"object-left":{"object-position":"left"},"object-left-bottom":{"object-position":"left bottom"},"object-left-top":{"object-position":"left top"},"object-right":{"object-position":"right"},"object-right-bottom":{"object-position":"right bottom"},"object-right-top":{"object-position":"right top"},"object-top":{"object-position":"top"}},Sy={"overflow-auto":{overflow:"auto"},"overflow-hidden":{overflow:"hidden"},"overflow-clip":{overflow:"clip"},"overflow-visible":{overflow:"visible"},"overflow-scroll":{overflow:"scroll"},"overflow-x-auto":{"overflow-x":"auto"},"overflow-x-hidden":{"overflow-x":"hidden"},"overflow-x-clip":{"overflow-x":"clip"},"overflow-x-visible":{"overflow-x":"visible"},"overflow-x-scroll":{"overflow-x":"scroll"},"overflow-y-auto":{"overflow-y":"auto"},"overflow-y-hidden":{"overflow-y":"hidden"},"overflow-y-clip":{"overflow-y":"clip"},"overflow-y-visible":{"overflow-y":"visible"},"overflow-y-scroll":{"overflow-y":"scroll"}},Ey={"overscroll-auto":{"overscroll-behavior":"auto"},"overscroll-contain":{"overscroll-behavior":"contain"},"overscroll-none":{"overscroll-behavior":"none"},"overscroll-x-auto":{"overscroll-behavior-x":"auto"},"overscroll-x-contain":{"overscroll-behavior-x":"contain"},"overscroll-x-none":{"overscroll-behavior-x":"none"},"overscroll-y-auto":{"overscroll-behavior-y":"auto"},"overscroll-y-contain":{"overscroll-behavior-y":"contain"},"overscroll-y-none":{"overscroll-behavior-y":"none"}},Ay={"z-0":{"z-index":"0"},"z-10":{"z-index":"10"},"z-20":{"z-index":"20"},"z-30":{"z-index":"30"},"z-40":{"z-index":"40"},"z-50":{"z-index":"50"},"z-auto":{"z-index":"auto"}},Ty={"aspect-auto":{"aspect-ratio":"auto"},"aspect-square":{"aspect-ratio":"1 / 1"},"aspect-video":{"aspect-ratio":"16 / 9"}},Ny={"box-border":{"box-sizing":"border-box"},"box-content":{"box-sizing":"content-box"}},Oy={"box-decoration-clone":{"box-decoration-break":"clone"},"box-decoration-slice":{"box-decoration-break":"slice"}},Iy={"bg-fixed":{"background-attachment":"fixed"},"bg-local":{"background-attachment":"local"},"bg-scroll":{"background-attachment":"scroll"}},Py={"bg-clip-border":{"background-clip":"border-box"},"bg-clip-padding":{"background-clip":"padding-box"},"bg-clip-content":{"background-clip":"content-box"},"bg-clip-text":{"background-clip":"text","-webkit-background-clip":"text"}},_y={"bg-origin-border":{"background-origin":"border-box"},"bg-origin-padding":{"background-origin":"padding-box"},"bg-origin-content":{"background-origin":"content-box"}},Ly={"bg-bottom":{"background-position":"bottom"},"bg-center":{"background-position":"center"},"bg-left":{"background-position":"left"},"bg-left-bottom":{"background-position":"left bottom"},"bg-left-top":{"background-position":"left top"},"bg-right":{"background-position":"right"},"bg-right-bottom":{"background-position":"right bottom"},"bg-right-top":{"background-position":"right top"},"bg-top":{"background-position":"top"}},My={"bg-repeat":{"background-repeat":"repeat"},"bg-no-repeat":{"background-repeat":"no-repeat"},"bg-repeat-x":{"background-repeat":"repeat-x"},"bg-repeat-y":{"background-repeat":"repeat-y"},"bg-repeat-round":{"background-repeat":"round"},"bg-repeat-space":{"background-repeat":"space"}},Fy={"bg-auto":{"background-size":"auto"},"bg-cover":{"background-size":"cover"},"bg-contain":{"background-size":"contain"}},Dy={"bg-none":{"background-image":"none"},"bg-gradient-to-t":{"background-image":"linear-gradient(to top, var(--tc-gradient-stops))"},"bg-gradient-to-tr":{"background-image":"linear-gradient(to top right, var(--tc-gradient-stops))"},"bg-gradient-to-r":{"background-image":"linear-gradient(to right, var(--tc-gradient-stops))"},"bg-gradient-to-br":{"background-image":"linear-gradient(to bottom right, var(--tc-gradient-stops))"},"bg-gradient-to-b":{"background-image":"linear-gradient(to bottom, var(--tc-gradient-stops))"},"bg-gradient-to-bl":{"background-image":"linear-gradient(to bottom left, var(--tc-gradient-stops))"},"bg-gradient-to-l":{"background-image":"linear-gradient(to left, var(--tc-gradient-stops))"},"bg-gradient-to-tl":{"background-image":"linear-gradient(to top left, var(--tc-gradient-stops))"},"bg-radial":{"background-image":"radial-gradient(var(--tc-gradient-stops))"},"bg-radial-at-t":{"background-image":"radial-gradient(at top, var(--tc-gradient-stops))"},"bg-radial-at-tr":{"background-image":"radial-gradient(at top right, var(--tc-gradient-stops))"},"bg-radial-at-r":{"background-image":"radial-gradient(at right, var(--tc-gradient-stops))"},"bg-radial-at-br":{"background-image":"radial-gradient(at bottom right, var(--tc-gradient-stops))"},"bg-radial-at-b":{"background-image":"radial-gradient(at bottom, var(--tc-gradient-stops))"},"bg-radial-at-bl":{"background-image":"radial-gradient(at bottom left, var(--tc-gradient-stops))"},"bg-radial-at-l":{"background-image":"radial-gradient(at left, var(--tc-gradient-stops))"},"bg-radial-at-tl":{"background-image":"radial-gradient(at top left, var(--tc-gradient-stops))"},"bg-radial-at-c":{"background-image":"radial-gradient(at center, var(--tc-gradient-stops))"},"bg-conic":{"background-image":"conic-gradient(var(--tc-gradient-stops))"},"bg-conic-from-t":{"background-image":"conic-gradient(from 0deg at center, var(--tc-gradient-stops))"},"bg-conic-from-tr":{"background-image":"conic-gradient(from 45deg at center, var(--tc-gradient-stops))"},"bg-conic-from-r":{"background-image":"conic-gradient(from 90deg at center, var(--tc-gradient-stops))"},"bg-conic-from-br":{"background-image":"conic-gradient(from 135deg at center, var(--tc-gradient-stops))"},"bg-conic-from-b":{"background-image":"conic-gradient(from 180deg at center, var(--tc-gradient-stops))"},"bg-conic-from-bl":{"background-image":"conic-gradient(from 225deg at center, var(--tc-gradient-stops))"},"bg-conic-from-l":{"background-image":"conic-gradient(from 270deg at center, var(--tc-gradient-stops))"},"bg-conic-from-tl":{"background-image":"conic-gradient(from 315deg at center, var(--tc-gradient-stops))"}},jy={"content-none":{content:"none"},"content-empty":{content:'""'}},By={"scrollbar-auto":{"scrollbar-width":"auto"},"scrollbar-thin":{"scrollbar-width":"thin"},"scrollbar-none":{"scrollbar-width":"none"}},Uy={"cursor-auto":{cursor:"auto"},"cursor-default":{cursor:"default"},"cursor-pointer":{cursor:"pointer"},"cursor-wait":{cursor:"wait"},"cursor-text":{cursor:"text"},"cursor-move":{cursor:"move"},"cursor-help":{cursor:"help"},"cursor-not-allowed":{cursor:"not-allowed"},"cursor-none":{cursor:"none"},"cursor-context-menu":{cursor:"context-menu"},"cursor-progress":{cursor:"progress"},"cursor-cell":{cursor:"cell"},"cursor-crosshair":{cursor:"crosshair"},"cursor-vertical-text":{cursor:"vertical-text"},"cursor-alias":{cursor:"alias"},"cursor-copy":{cursor:"copy"},"cursor-no-drop":{cursor:"no-drop"},"cursor-grab":{cursor:"grab"},"cursor-grabbing":{cursor:"grabbing"},"cursor-all-scroll":{cursor:"all-scroll"},"cursor-col-resize":{cursor:"col-resize"},"cursor-row-resize":{cursor:"row-resize"},"cursor-n-resize":{cursor:"n-resize"},"cursor-e-resize":{cursor:"e-resize"},"cursor-s-resize":{cursor:"s-resize"},"cursor-w-resize":{cursor:"w-resize"},"cursor-ne-resize":{cursor:"ne-resize"},"cursor-nw-resize":{cursor:"nw-resize"},"cursor-se-resize":{cursor:"se-resize"},"cursor-sw-resize":{cursor:"sw-resize"},"cursor-ew-resize":{cursor:"ew-resize"},"cursor-ns-resize":{cursor:"ns-resize"},"cursor-nesw-resize":{cursor:"nesw-resize"},"cursor-nwse-resize":{cursor:"nwse-resize"},"cursor-zoom-in":{cursor:"zoom-in"},"cursor-zoom-out":{cursor:"zoom-out"}},Vy={"pointer-events-none":{"pointer-events":"none"},"pointer-events-auto":{"pointer-events":"auto"}},zy={"resize-none":{resize:"none"},"resize-y":{resize:"vertical"},"resize-x":{resize:"horizontal"},resize:{resize:"both"}},Wy={"select-none":{"user-select":"none"},"select-text":{"user-select":"text"},"select-all":{"user-select":"all"},"select-auto":{"user-select":"auto"}},Ky={"scroll-auto":{"scroll-behavior":"auto"},"scroll-smooth":{"scroll-behavior":"smooth"}},Gy={"snap-none":{"scroll-snap-type":"none"},"snap-x":{"scroll-snap-type":"x var(--tc-scroll-snap-strictness, proximity)"},"snap-y":{"scroll-snap-type":"y var(--tc-scroll-snap-strictness, proximity)"},"snap-both":{"scroll-snap-type":"both var(--tc-scroll-snap-strictness, proximity)"},"snap-mandatory":{"--tc-scroll-snap-strictness":"mandatory"},"snap-proximity":{"--tc-scroll-snap-strictness":"proximity"},"snap-start":{"scroll-snap-align":"start"},"snap-end":{"scroll-snap-align":"end"},"snap-center":{"scroll-snap-align":"center"},"snap-align-none":{"scroll-snap-align":"none"},"snap-normal":{"scroll-snap-stop":"normal"},"snap-always":{"scroll-snap-stop":"always"}},Ge="var(--tc-pan-x,) var(--tc-pan-y,) var(--tc-pinch-zoom,)",Hy={"touch-auto":{"touch-action":"auto"},"touch-none":{"touch-action":"none"},"touch-pan-x":{"--tc-pan-x":"pan-x","touch-action":Ge},"touch-pan-left":{"--tc-pan-x":"pan-left","touch-action":Ge},"touch-pan-right":{"--tc-pan-x":"pan-right","touch-action":Ge},"touch-pan-y":{"--tc-pan-y":"pan-y","touch-action":Ge},"touch-pan-up":{"--tc-pan-y":"pan-up","touch-action":Ge},"touch-pan-down":{"--tc-pan-y":"pan-down","touch-action":Ge},"touch-pinch-zoom":{"--tc-pinch-zoom":"pinch-zoom","touch-action":Ge},"touch-manipulation":{"touch-action":"manipulation"}},qy={"will-change-auto":{"will-change":"auto"},"will-change-scroll":{"will-change":"scroll-position"},"will-change-contents":{"will-change":"contents"},"will-change-transform":{"will-change":"transform"}},Yy={"appearance-none":{appearance:"none"},"appearance-auto":{appearance:"auto"}},Jy={"border-collapse":{"border-collapse":"collapse"},"border-separate":{"border-collapse":"separate"}},Xy={"table-auto":{"table-layout":"auto"},"table-fixed":{"table-layout":"fixed"}},Zy={"caption-top":{"caption-side":"top"},"caption-bottom":{"caption-side":"bottom"}},Qy={"sr-only":{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)","white-space":"nowrap","border-width":"0"},"not-sr-only":{position:"static",width:"auto",height:"auto",padding:"0",margin:"0",overflow:"visible",clip:"auto","white-space":"normal"}},e0={"forced-color-adjust-auto":{"forced-color-adjust":"auto"},"forced-color-adjust-none":{"forced-color-adjust":"none"}},t0={"fill-none":{fill:"none"},"fill-current":{fill:"currentColor"},"fill-inherit":{fill:"inherit"}},r0={"stroke-none":{stroke:"none"},"stroke-current":{stroke:"currentColor"},"stroke-inherit":{stroke:"inherit"},"stroke-0":{"stroke-width":"0"},"stroke-1":{"stroke-width":"1"},"stroke-2":{"stroke-width":"2"}},n0={"stroke-linecap-butt":{"stroke-linecap":"butt"},"stroke-linecap-round":{"stroke-linecap":"round"},"stroke-linecap-square":{"stroke-linecap":"square"}},i0={"stroke-linejoin-miter":{"stroke-linejoin":"miter"},"stroke-linejoin-round":{"stroke-linejoin":"round"},"stroke-linejoin-bevel":{"stroke-linejoin":"bevel"}},o0=["blur","brightness","contrast","grayscale","hue-rotate","invert","saturate","sepia","drop-shadow"],s0=["blur","brightness","contrast","grayscale","hue-rotate","invert","opacity","saturate","sepia"],a0=o0.map((e)=>`var(--tc-${e}, )`).join(" "),ul=s0.map((e)=>`var(--tc-backdrop-${e}, )`).join(" ");function U(e,t){return{[`--tc-${e}`]:t,filter:a0}}function ee(e,t){return{[`--tc-backdrop-${e}`]:t,"-webkit-backdrop-filter":ul,"backdrop-filter":ul}}var l0={"blur-none":U("blur","blur(0)"),"blur-sm":U("blur","blur(4px)"),blur:U("blur","blur(8px)"),"blur-md":U("blur","blur(12px)"),"blur-lg":U("blur","blur(16px)"),"blur-xl":U("blur","blur(24px)"),"blur-2xl":U("blur","blur(40px)"),"blur-3xl":U("blur","blur(64px)")},c0={"backdrop-blur-none":ee("blur","blur(0)"),"backdrop-blur-sm":ee("blur","blur(4px)"),"backdrop-blur":ee("blur","blur(8px)"),"backdrop-blur-md":ee("blur","blur(12px)"),"backdrop-blur-lg":ee("blur","blur(16px)"),"backdrop-blur-xl":ee("blur","blur(24px)"),"backdrop-blur-2xl":ee("blur","blur(40px)"),"backdrop-blur-3xl":ee("blur","blur(64px)")},u0={"grayscale-0":U("grayscale","grayscale(0)"),grayscale:U("grayscale","grayscale(100%)"),"invert-0":U("invert","invert(0)"),invert:U("invert","invert(100%)"),"sepia-0":U("sepia","sepia(0)"),sepia:U("sepia","sepia(100%)")},f0={"backdrop-grayscale-0":ee("grayscale","grayscale(0)"),"backdrop-grayscale":ee("grayscale","grayscale(100%)"),"backdrop-invert-0":ee("invert","invert(0)"),"backdrop-invert":ee("invert","invert(100%)"),"backdrop-sepia-0":ee("sepia","sepia(0)"),"backdrop-sepia":ee("sepia","sepia(100%)")},d0={"drop-shadow-sm":U("drop-shadow","drop-shadow(0 1px 1px rgb(0 0 0 / 0.05))"),"drop-shadow":U("drop-shadow","drop-shadow(0 1px 2px rgb(0 0 0 / 0.1)) drop-shadow(0 1px 1px rgb(0 0 0 / 0.06))"),"drop-shadow-md":U("drop-shadow","drop-shadow(0 4px 3px rgb(0 0 0 / 0.07)) drop-shadow(0 2px 2px rgb(0 0 0 / 0.06))"),"drop-shadow-lg":U("drop-shadow","drop-shadow(0 10px 8px rgb(0 0 0 / 0.04)) drop-shadow(0 4px 3px rgb(0 0 0 / 0.1))"),"drop-shadow-xl":U("drop-shadow","drop-shadow(0 20px 13px rgb(0 0 0 / 0.03)) drop-shadow(0 8px 5px rgb(0 0 0 / 0.08))"),"drop-shadow-2xl":U("drop-shadow","drop-shadow(0 25px 25px rgb(0 0 0 / 0.15))"),"drop-shadow-none":U("drop-shadow","drop-shadow(0 0 #0000)")},h0={"mix-blend-normal":{"mix-blend-mode":"normal"},"mix-blend-multiply":{"mix-blend-mode":"multiply"},"mix-blend-screen":{"mix-blend-mode":"screen"},"mix-blend-overlay":{"mix-blend-mode":"overlay"},"mix-blend-darken":{"mix-blend-mode":"darken"},"mix-blend-lighten":{"mix-blend-mode":"lighten"},"mix-blend-color-dodge":{"mix-blend-mode":"color-dodge"},"mix-blend-color-burn":{"mix-blend-mode":"color-burn"},"mix-blend-hard-light":{"mix-blend-mode":"hard-light"},"mix-blend-soft-light":{"mix-blend-mode":"soft-light"},"mix-blend-difference":{"mix-blend-mode":"difference"},"mix-blend-exclusion":{"mix-blend-mode":"exclusion"},"mix-blend-hue":{"mix-blend-mode":"hue"},"mix-blend-saturation":{"mix-blend-mode":"saturation"},"mix-blend-color":{"mix-blend-mode":"color"},"mix-blend-luminosity":{"mix-blend-mode":"luminosity"},"mix-blend-plus-darker":{"mix-blend-mode":"plus-darker"},"mix-blend-plus-lighter":{"mix-blend-mode":"plus-lighter"}},g0={"bg-blend-normal":{"background-blend-mode":"normal"},"bg-blend-multiply":{"background-blend-mode":"multiply"},"bg-blend-screen":{"background-blend-mode":"screen"},"bg-blend-overlay":{"background-blend-mode":"overlay"},"bg-blend-darken":{"background-blend-mode":"darken"},"bg-blend-lighten":{"background-blend-mode":"lighten"},"bg-blend-color-dodge":{"background-blend-mode":"color-dodge"},"bg-blend-color-burn":{"background-blend-mode":"color-burn"},"bg-blend-hard-light":{"background-blend-mode":"hard-light"},"bg-blend-soft-light":{"background-blend-mode":"soft-light"},"bg-blend-difference":{"background-blend-mode":"difference"},"bg-blend-exclusion":{"background-blend-mode":"exclusion"},"bg-blend-hue":{"background-blend-mode":"hue"},"bg-blend-saturation":{"background-blend-mode":"saturation"},"bg-blend-color":{"background-blend-mode":"color"},"bg-blend-luminosity":{"background-blend-mode":"luminosity"}},m0={..._p,...Lp,...Mp,...Fp,...Dp,...zp,...Wp,...Kp,...Gp,...Hp,...ty,...Rl,...kl,...ry,...ny,...iy,...sy,...ay,...ly,...cy,...uy,...fy,...dy,...hy,...gy,...my,...py,...yy,...by,...xy,...vy,...wy,...Cy,...$y,...Ry,...ky,...Sy,...Ey,...Ay,...Ty,...Ny,...Oy,...Iy,...Py,..._y,...Ly,...My,...Fy,...Dy,...Uy,...Vy,...zy,...Wy,...Ky,...Gy,...Hy,...qy,...Yy,...Jy,...Xy,...Zy,...Qy,...e0,...t0,...r0,...n0,...i0,...l0,...c0,...u0,...f0,...d0,...h0,...g0,...jy,...By},fl={hover:":hover",focus:":focus",active:":active",disabled:":disabled",visited:":visited",checked:":checked","focus-within":":focus-within","focus-visible":":focus-visible",first:":first-child",last:":last-child",odd:":nth-child(odd)",even:":nth-child(even)","first-of-type":":first-of-type","last-of-type":":last-of-type",before:"::before",after:"::after",marker:"::marker",placeholder:"::placeholder",selection:"::selection",file:"::file-selector-button",required:":required",valid:":valid",invalid:":invalid","read-only":":read-only",autofill:":autofill",open:"[open]",closed:":not([open])",empty:":empty",enabled:":enabled",only:":only-child",target:":target",indeterminate:":indeterminate",default:":default",optional:":optional"},dl={"not-first":":not(:first-child)","not-last":":not(:last-child)","not-only":":not(:only-child)","not-empty":":not(:empty)","not-disabled":":not(:disabled)","not-checked":":not(:checked)","not-first-of-type":":not(:first-of-type)","not-last-of-type":":not(:last-of-type)"};function hl(e){return on(e).css}var gl="\x01",ml={dark:".dark ",light:".light "},pl={rtl:':is([dir="rtl"], [dir="rtl"] *)',ltr:':is([dir="ltr"], [dir="ltr"] *)'},yl=new WeakMap,bl=new WeakMap,xl=new WeakMap,vl=new WeakMap,wl=new WeakMap,Cl=new WeakMap;function p0(e){let t=bl.get(e);if(t)return t;let r=!1;for(let i in e)if(Ir[i]!==e[i]){r=!0;break}let n=r?{...Ir,...e}:Ir;return bl.set(e,n),n}function y0(e){let t=xl.get(e);if(t)return t;let r=null;for(let i in e){let o=e[i];if(typeof o==="string"){if(ut[i]!==void 0&&ut[i]!==o)r??={},r[i]=o;continue}if(!o||typeof o!=="object")continue;for(let s in o){let c=o[s];if(typeof c!=="string")continue;let a=s==="DEFAULT"?i:`${i}-${s}`;if(ut[a]!==void 0&&ut[a]!==c)r??={},r[a]=c}}let n=r?{...ut,...r}:ut;return xl.set(e,n),n}function b0(e){let t=vl.get(e);if(t!==void 0)return t;let r=!1;for(let n in e){let i=n==="DEFAULT"?"rounded":`rounded-${n}`;if(kl[i]?.["border-radius"]!==e[n]){r=!0;break}}return vl.set(e,r),r}function x0(e){let t=wl.get(e);if(t!==void 0)return t;let r=!1;for(let n in e){let i=n==="DEFAULT"?"shadow":`shadow-${n}`,o=Rl[i];if(o!==void 0&&o["--tc-shadow"]!==e[n]){r=!0;break}}return wl.set(e,r),r}function v0(e){let t=Cl.get(e);if(t)return t;let r=new Map(Object.entries(e));return Cl.set(e,r),r}function w0(e){let t=yl.get(e);if(t)return t;if(e.presets&&e.presets.length>0)for(let u of e.presets){if(u.theme)e.theme=ii(e.theme,u.theme);if(u.rules&&u.rules.length>0)e.rules=[...u.rules,...e.rules];if(u.shortcuts)e.shortcuts={...u.shortcuts,...e.shortcuts};if(u.variants)e.variants={...u.variants,...e.variants};if(u.preflights&&u.preflights.length>0)e.preflights=[...u.preflights,...e.preflights]}let r=e.theme.extend?.colors?e.theme.extend.colors:null;if(e.theme.extend){let{extend:u,...f}=e.theme;if(u)e.theme=ii(f,u)}let n=[],i=new Set;for(let u of e.blocklist)if(u.includes("*"))n.push(new RegExp(`^${u.replace(/\*/g,".*")}$`));else i.add(u);let o=p0(e.theme.spacing),s=y0(e.theme.colors),c=b0(e.theme.borderRadius),a=x0(e.theme.boxShadow),l={config:e,variantEnabled:e.variants,spacingValues:o,commonColors:s,skipStaticRadius:c,skipStaticShadow:a,screenBreakpoints:v0(e.theme.screens),blocklistRegexCache:n,blocklistExact:i,extendColors:r,hasBlocklist:n.length>0||i.size>0,hasShortcuts:Object.keys(e.shortcuts).length>0};return yl.set(e,l),l}function $l(e){return e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57||e===45||e===95}function C0(e){let t=e.indexOf(".");if(t===-1)return;t++;let r=()=>{if(e.charCodeAt(t)===92&&e.charCodeAt(t+1)===33)t+=2};r();for(;;){let i=t;while(i<e.length&&$l(e.charCodeAt(i)))i++;if(e.charCodeAt(i)!==92||e.charCodeAt(i+1)!==58)break;t=i+2}r();let n=t;while(n<e.length&&$l(e.charCodeAt(n)))n++;return n>t?e.slice(t,n):void 0}var $0=/^(?:mx|my|px|py|inset-x|inset-y|border-x|border-y|scroll-mx|scroll-my|scroll-px|scroll-py|space-x|space-y|gap-x|gap-y)-/,R0=/^rounded-[tlbr](?:-|$)/,k0=/^(?:mt|mr|mb|ml|pt|pr|pb|pl|top|right|bottom|left|border-t|border-r|border-b|border-l|scroll-mt|scroll-mr|scroll-mb|scroll-ml|scroll-pt|scroll-pr|scroll-pb|scroll-pl)-/,S0=/^rounded-(?:tl|tr|bl|br)(?:-|$)/,E0=/^i-[a-z][a-z0-9]*(?:-[a-z0-9]+)*-.+/;function A0(e){let t=C0(e);if(!t)return 0;if(E0.test(t))return-1;if($0.test(t)||R0.test(t))return 1;if(k0.test(t)||S0.test(t))return 2;return 0}class oi{config;rules=new Map;classCache=new Set;selectorCache=new Map;mediaQueryCache=new Map;ruleCache=new Map;variantEnabled;screenBreakpoints;noMatchCache=new Set;usedKeyframes=new Set;variantHandledCache=new Map;utilityRankCache=new Map;compiledGenerated=new Set;darkStrategy;spacingValues;commonColors;skipStaticRadius;skipStaticShadow;shortcutSelectorRaw=null;extendColors=null;processed;revision=0;cssCache=null;cssCacheRevision=-1;cssCachePreflight=!1;cssCacheMinify=!1;constructor(e){this.config=e;this.processed=w0(e),this.variantEnabled=this.processed.variantEnabled,this.screenBreakpoints=this.processed.screenBreakpoints,this.extendColors=this.processed.extendColors,this.darkStrategy=e.darkMode==="media"?"media":"class",this.spacingValues=this.processed.spacingValues,this.commonColors=this.processed.commonColors,this.skipStaticRadius=this.processed.skipStaticRadius,this.skipStaticShadow=this.processed.skipStaticShadow}buildRuleLookup(){}generateBatch(e){for(let t=0;t<e.length;t++)this.generate(e[t])}generate(e){if(this.classCache.has(e))return;if(this.classCache.add(e),this.processed.hasShortcuts){let t=this.config.shortcuts[e];if(t){this.expandShortcut(e,t,new Set([e]));return}}this.generateUtility(e)}expandShortcut(e,t,r){let n=Array.isArray(t)?t:t.split(/\s+/),i=this.shortcutSelectorRaw;this.shortcutSelectorRaw=e;for(let o of n){if(!o)continue;let s=this.config.shortcuts[o];if(s){if(!r.has(o))r.add(o),this.expandShortcut(e,s,r);continue}this.generateUtility(o)}this.shortcutSelectorRaw=i}generateCompiledClass(e,t){if(this.compiledGenerated.has(e))return;this.compiledGenerated.add(e),this.classCache.add(e),this.expandShortcut(e,t,new Set([e]))}generateUtility(e){if(this.processed.hasBlocklist){if(this.processed.blocklistExact.has(e))return;let l=this.processed.blocklistRegexCache;for(let u=0;u<l.length;u++)if(l[u].test(e))return}let t=to(e),r=t.base,n=m0[r];if(n&&(this.skipStaticRadius&&r.startsWith("rounded")||this.skipStaticShadow&&(r==="shadow"||r.startsWith("shadow-"))))n=void 0;if(n){if(this.addRule(t,n),n.animation){let l=n.animation.split(" ")[0];if(l&&l!=="none")this.usedKeyframes.add(l),this.revision++}return}let{utility:i,value:o}=t;if(i==="w"&&o){let l=cl[o]||this.config.theme.spacing[o];if(l){this.addRule(t,{width:l});return}if(t.arbitrary){let u=o.match(/^(\d+)\/(\d+)$/);if(u){let f=Number(u[1]),d=Number(u[2]);if(!Number.isNaN(f)&&!Number.isNaN(d)&&d!==0){this.addRule(t,{width:ye(f,d)});return}}this.addRule(t,{width:o});return}}if(i==="h"&&o){let l=cl[o]||this.config.theme.spacing[o];if(l){this.addRule(t,{height:o==="screen"?"100vh":l});return}if(t.arbitrary){let u=o.match(/^(\d+)\/(\d+)$/);if(u){let f=Number(u[1]),d=Number(u[2]);if(!Number.isNaN(f)&&!Number.isNaN(d)&&d!==0){this.addRule(t,{height:ye(f,d)});return}}this.addRule(t,{height:o});return}}if(i==="p"&&o){let l=this.spacingValues[o];if(l){this.addRule(t,{padding:l});return}}if(i==="px"&&o){let l=this.spacingValues[o];if(l){this.addRule(t,{"padding-left":l,"padding-right":l});return}}if(i==="py"&&o){let l=this.spacingValues[o];if(l){this.addRule(t,{"padding-top":l,"padding-bottom":l});return}}if((i==="pt"||i==="pr"||i==="pb"||i==="pl")&&o){let l=this.spacingValues[o];if(l){let u={pt:"padding-top",pr:"padding-right",pb:"padding-bottom",pl:"padding-left"};this.addRule(t,{[u[i]]:l});return}}if(i==="m"&&o){let l=this.spacingValues[o];if(l){this.addRule(t,{margin:l});return}}if(i==="mx"&&o){let l=this.spacingValues[o];if(l){this.addRule(t,{"margin-left":l,"margin-right":l});return}}if(i==="my"&&o){let l=this.spacingValues[o];if(l){this.addRule(t,{"margin-top":l,"margin-bottom":l});return}}if((i==="mt"||i==="mr"||i==="mb"||i==="ml")&&o){let l=this.spacingValues[o];if(l){let u={mt:"margin-top",mr:"margin-right",mb:"margin-bottom",ml:"margin-left"};this.addRule(t,{[u[i]]:l});return}}if((i==="top"||i==="right"||i==="bottom"||i==="left")&&o){let l=this.spacingValues[o];if(l){this.addRule(t,{[i]:l});return}}if(i==="inset"&&o){let l=this.spacingValues[o];if(l){this.addRule(t,{top:l,right:l,bottom:l,left:l});return}}if(i==="inset-x"&&o){let l=this.spacingValues[o];if(l){this.addRule(t,{left:l,right:l});return}}if(i==="inset-y"&&o){let l=this.spacingValues[o];if(l){this.addRule(t,{top:l,bottom:l});return}}if(i==="bg"&&o){let l=this.commonColors[o];if(l){this.addRule(t,{"background-color":l});return}}if(i==="text"&&o){let l=this.commonColors[o];if(l){this.addRule(t,{color:l});return}}if(i==="border"&&o){let l=this.commonColors[o];if(l){this.addRule(t,{"border-color":l});return}}if(i==="justify"&&o){let l=jp[o];if(l){this.addRule(t,{"justify-content":l});return}}if(i==="items"&&o){let l=Bp[o];if(l){this.addRule(t,{"align-items":l});return}}if(i==="content"&&o){let l=Up[o];if(l){this.addRule(t,{"align-content":l});return}if(t.arbitrary){this.addRule(t,{content:o});return}}if(i==="self"&&o){let l=Vp[o];if(l){this.addRule(t,{"align-self":l});return}}if(i==="grid-cols"&&o){let l=Jp[o];if(l){this.addRule(t,{"grid-template-columns":l});return}}if(i==="grid-rows"&&o){let l=Xp[o];if(l){this.addRule(t,{"grid-template-rows":l});return}}if(i==="col"&&o){let l=Zp[o];if(l){this.addRule(t,{"grid-column":l});return}}if(i==="row"&&o){let l=Qp[o];if(l){this.addRule(t,{"grid-row":l});return}}if(i==="grid-flow"&&o){let l=ey[o];if(l){this.addRule(t,{"grid-auto-flow":l});return}}if(i==="auto-cols"&&o){let l=ll[o];if(l){this.addRule(t,{"grid-auto-columns":l});return}}if(i==="auto-rows"&&o){let l=ll[o];if(l){this.addRule(t,{"grid-auto-rows":l});return}}if(i==="origin"&&o){let l=Yp[o];if(l){this.addRule(t,{"transform-origin":l});return}}if(i==="scale"&&o&&!t.arbitrary){let l=Number(o)/100;if(!Number.isNaN(l)){this.addRule(t,{transform:`scale(${l})`});return}}if(i==="scale-x"&&o&&!t.arbitrary){let l=Number(o)/100;if(!Number.isNaN(l)){this.addRule(t,{transform:`scaleX(${l})`});return}}if(i==="scale-y"&&o&&!t.arbitrary){let l=Number(o)/100;if(!Number.isNaN(l)){this.addRule(t,{transform:`scaleY(${l})`});return}}if(i==="rotate"&&o&&!t.arbitrary&&/^-?\d+(?:\.\d+)?$/.test(o)){this.addRule(t,{transform:`rotate(${o}deg)`});return}if(i==="duration"&&o&&o!=="0"&&!t.arbitrary&&/^\d+(?:\.\d+)?$/.test(o)){this.addRule(t,{"transition-duration":`${o}ms`});return}if(i==="delay"&&o&&o!=="0"&&!t.arbitrary&&/^\d+(?:\.\d+)?$/.test(o)){this.addRule(t,{"transition-delay":`${o}ms`});return}let s=(l)=>{let u=this.config.theme.spacing[l];if(u!==void 0)return u;if(t.arbitrary)return l;if(/^\d+(?:\.\d+)?$/.test(l)){let f=Number.parseFloat(l);if(Number.isFinite(f))return`${f*0.25}rem`}return};if(i==="gap"&&o){let l=s(o);if(l!==void 0)this.addRule(t,{gap:l});return}if(i==="gap-x"&&o){let l=s(o);if(l!==void 0)this.addRule(t,{"column-gap":l});return}if(i==="gap-y"&&o){let l=s(o);if(l!==void 0)this.addRule(t,{"row-gap":l});return}if(i==="place"&&o){if(o.startsWith("content-")){let l=ni[o.slice(8)];if(l){this.addRule(t,{"place-content":l});return}}if(o.startsWith("items-")){let l=ni[o.slice(6)];if(l){this.addRule(t,{"place-items":l});return}}if(o.startsWith("self-")){let l=ni[o.slice(5)];if(l){this.addRule(t,{"place-self":l});return}}}let c=`${t.utility}:${t.value||""}`;if(this.noMatchCache.has(c))return;if(this.config.rules.length>0)for(let[l,u]of this.config.rules){let f=e.match(l);if(f){let d=u(f);if(d){this.addRule(t,d);return}}}let a=ri.length;for(let l=0;l<a;l++){let u=ri[l](t,this.config);if(u){if("properties"in u&&typeof u.properties==="object")this.addRule(t,u.properties,u.childSelector,u.pseudoElement);else this.addRule(t,u);return}}this.noMatchCache.add(c)}isVariantHandled(e){let t=this.variantHandledCache.get(e);if(t!==void 0)return t;let r=fl[e]!==void 0||ml[e]!==void 0||pl[e]!==void 0||dl[e]!==void 0||this.screenBreakpoints.has(e)||e.startsWith("max-")&&this.screenBreakpoints.has(e.slice(4))||e.startsWith("@")&&this.screenBreakpoints.has(e.slice(1))||e.startsWith("group-")||e.startsWith("group/")||e.startsWith("peer-")||e.startsWith("peer/")||e.startsWith("has-")||e.startsWith("aria-")||e.startsWith("data-")||e.startsWith("supports-")||e.startsWith("[")&&e.endsWith("]")||["print","motion-safe","motion-reduce","contrast-more","contrast-less","landscape","portrait","forced-colors"].includes(e);return this.variantHandledCache.set(e,r),r}addRule(e,t,r,n){for(let a=0;a<e.variants.length;a++)if(!this.isVariantHandled(e.variants[a]))return;let i=this.shortcutSelectorRaw===null?r===void 0&&n===void 0?e.raw:`${e.raw}${r||""}${n||""}`:`${this.shortcutSelectorRaw}>${e.raw}${r||""}${n||""}`,o=this.selectorCache.get(i);if(!o){if(o=this.buildSelector(e),n)o+=n;if(r)o+=` ${r}`;this.selectorCache.set(i,o)}let s=this.getMediaQuery(e);if(e.important){let a={};for(let l in t)a[l]=`${t[l]} !important`;t=a}let c=s||"base";if(!this.rules.has(c))this.rules.set(c,[]);this.revision++,this.rules.get(c).push({selector:o,properties:t,mediaQuery:s,childSelector:r})}buildSelector(e){let t=`.${this.escapeSelector(this.shortcutSelectorRaw??e.raw)}`,r="",n=e.variants,i=n.length;if(i===0)return t;for(let o=0;o<i;o++){let s=n[o];if(s.charCodeAt(0)===91&&s.charCodeAt(s.length-1)===93){let u=s.slice(1,-1).replace(/_/g," ");if(u.includes("&"))t=u.replace(/&/g,t);continue}let c=fl[s];if(c!==void 0){if(this.variantEnabled[s])t+=c;continue}let a=pl[s];if(a!==void 0){if(this.variantEnabled[s]){let u=t.indexOf("::");t=u===-1?t+a:t.slice(0,u)+a+t.slice(u)}continue}let l=ml[s];if(l!==void 0){if(this.darkStrategy==="media"&&(s==="dark"||s==="light"))continue;if(this.variantEnabled[s])r=l;continue}if(s.charCodeAt(0)===110&&s.startsWith("not-")){if(this.variantEnabled.not){let u=dl[s];if(u)t+=u}continue}if(s.charCodeAt(0)===103&&s.startsWith("group-")){if(this.variantEnabled.group){let u=s.slice(6);if(u.startsWith("has-")){let f=u.slice(4);if(f.charCodeAt(0)===91&&f.charCodeAt(f.length-1)===93)r=`.group:has(${f.slice(1,-1)}) `;else r=`.group:has(:${f}) `}else r=`.group:${u} `}continue}if(s.charCodeAt(0)===103&&s.startsWith("group/")){if(this.variantEnabled.group)r=`.group\\/${s.slice(6)} `;continue}if(s.charCodeAt(0)===112&&s.startsWith("peer-")){if(this.variantEnabled.peer){let u=s.slice(5);if(u.startsWith("has-")){let f=u.slice(4);if(f.charCodeAt(0)===91&&f.charCodeAt(f.length-1)===93)r=`.peer:has(${f.slice(1,-1)}) ~ `;else r=`.peer:has(:${f}) ~ `}else r=`.peer:${u} ~ `}continue}if(s.charCodeAt(0)===112&&s.startsWith("peer/")){if(this.variantEnabled.peer)r=`.peer\\/${s.slice(5)} ~ `;continue}if(s.charCodeAt(0)===104&&s.startsWith("has-")){if(this.variantEnabled.has){let u=s.slice(4);if(u.charCodeAt(0)===91&&u.charCodeAt(u.length-1)===93){let f=u.slice(1,-1);t+=`:has(${f})`}else t+=`:has(:${u})`}continue}if(s.charCodeAt(0)===97&&s.startsWith("aria-")){if(this.variantEnabled.aria){let u=s.slice(5);if(u.charCodeAt(0)===91&&u.charCodeAt(u.length-1)===93){let f=u.slice(1,-1);t+=`[aria-${f}]`}else t+=`[aria-${u}="true"]`}continue}if(s.charCodeAt(0)===100&&s.startsWith("data-")){if(this.variantEnabled.data){let u=s.slice(5);if(u.charCodeAt(0)===91&&u.charCodeAt(u.length-1)===93){let f=u.slice(1,-1);t+=`[data-${f}]`}else t+=`[data-${u}]`}continue}}return r+t}getMediaQuery(e){let t=e.variants,r=t.length;if(r===0)return;let n=r===1?t[0]:t.join(":"),i=this.mediaQueryCache.get(n);if(i!==void 0)return i||void 0;let o=[],s=[],c=[];for(let l=0;l<r;l++){let u=t[l],f=u.charCodeAt(0);if(f===91&&u.startsWith("[@media")&&u.endsWith("]")){let d=u.slice(1,-1).replace(/_/g," ").slice(6).trim();if(d)o.push(d);continue}if(f===64){let d=u.slice(1),h=this.screenBreakpoints.get(d);if(h)c.push(`@container (min-width: ${h})`);continue}if(this.darkStrategy==="media"&&(u==="dark"||u==="light")){o.push(`(prefers-color-scheme: ${u})`);continue}if(this.variantEnabled.responsive){let d=this.screenBreakpoints.get(u);if(d){o.push(`(min-width: ${d})`);continue}if(u.startsWith("max-")){let h=this.screenBreakpoints.get(u.slice(4));if(h){let m=h.match(/^([\d.]+)px$/);o.push(m?`(max-width: ${Number.parseFloat(m[1])-0.02}px)`:`not all and (min-width: ${h})`);continue}}}switch(u){case"print":if(this.variantEnabled.print)o.push("print");break;case"motion-safe":if(this.variantEnabled["motion-safe"])o.push("(prefers-reduced-motion: no-preference)");break;case"motion-reduce":if(this.variantEnabled["motion-reduce"])o.push("(prefers-reduced-motion: reduce)");break;case"contrast-more":if(this.variantEnabled["contrast-more"])o.push("(prefers-contrast: more)");break;case"contrast-less":if(this.variantEnabled["contrast-less"])o.push("(prefers-contrast: less)");break;case"landscape":if(this.variantEnabled.landscape)o.push("(orientation: landscape)");break;case"portrait":if(this.variantEnabled.portrait)o.push("(orientation: portrait)");break;case"forced-colors":if(this.variantEnabled["forced-colors"])o.push("(forced-colors: active)");break}if(u.charCodeAt(0)===115&&u.startsWith("supports-")){if(this.variantEnabled.supports){let d=u.slice(9),h;if(d.charCodeAt(0)===91&&d.charCodeAt(d.length-1)===93){let m=d.slice(1,-1).replace(/_/g," "),p=m.indexOf(":");if(p!==-1){let g=m.slice(0,p).trim(),y=m.slice(p+1).trim();h=`@supports (${g}: ${y})`}else h=`@supports (${m})`}else h=`@supports (${d})`;s.push(h)}}}let a=[];if(o.length>0)o.sort((l,u)=>Number(l.charCodeAt(0)===40)-Number(u.charCodeAt(0)===40)),a.push(`@media ${o.join(" and ")}`);if(a.push(...s,...c),a.length>0){let l=a.join(gl);return this.mediaQueryCache.set(n,l),l}this.mediaQueryCache.set(n,"");return}escapeSelector(e){let t=!1;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(!(n>=97&&n<=122||n>=65&&n<=90||n>=48&&n<=57||n===45||n===95||n>127)){t=!0;break}}if(!t)return e;return e.replace(/[\x00-\x2C\x2E\x2F\x3A-\x40\x5B-\x5E\x60\x7B-\x7F]/g,"\\$&")}buildFontCSS(){let e=this.config.fonts;if(!e)return"";let t=[],r=e.google?.filter(Boolean)??[];if(r.length>0){let n=r.map((o)=>`family=${o.trim().replace(/\s+/g,"+")}`).join("&"),i=e.display??"swap";t.push(`@import url('https://fonts.googleapis.com/css2?${n}&display=${i}');`)}if(e.faces?.length)t.push(...e.faces.map((n)=>n.trim()).filter(Boolean));return t.join(`
|
|
366
|
+
}`},Xp={center:"center",top:"top","top-right":"top right",right:"right","bottom-right":"bottom right",bottom:"bottom","bottom-left":"bottom left",left:"left","top-left":"top left"},Zp={"1":"repeat(1, minmax(0, 1fr))","2":"repeat(2, minmax(0, 1fr))","3":"repeat(3, minmax(0, 1fr))","4":"repeat(4, minmax(0, 1fr))","5":"repeat(5, minmax(0, 1fr))","6":"repeat(6, minmax(0, 1fr))","7":"repeat(7, minmax(0, 1fr))","8":"repeat(8, minmax(0, 1fr))","9":"repeat(9, minmax(0, 1fr))","10":"repeat(10, minmax(0, 1fr))","11":"repeat(11, minmax(0, 1fr))","12":"repeat(12, minmax(0, 1fr))",none:"none",subgrid:"subgrid"},Qp={"1":"repeat(1, minmax(0, 1fr))","2":"repeat(2, minmax(0, 1fr))","3":"repeat(3, minmax(0, 1fr))","4":"repeat(4, minmax(0, 1fr))","5":"repeat(5, minmax(0, 1fr))","6":"repeat(6, minmax(0, 1fr))",none:"none",subgrid:"subgrid"},ey={auto:"auto","span-1":"span 1 / span 1","span-2":"span 2 / span 2","span-3":"span 3 / span 3","span-4":"span 4 / span 4","span-5":"span 5 / span 5","span-6":"span 6 / span 6","span-7":"span 7 / span 7","span-8":"span 8 / span 8","span-9":"span 9 / span 9","span-10":"span 10 / span 10","span-11":"span 11 / span 11","span-12":"span 12 / span 12","span-full":"1 / -1"},ty={auto:"auto","span-1":"span 1 / span 1","span-2":"span 2 / span 2","span-3":"span 3 / span 3","span-4":"span 4 / span 4","span-5":"span 5 / span 5","span-6":"span 6 / span 6","span-full":"1 / -1"},ry={row:"row",col:"column",dense:"dense","row-dense":"row dense","col-dense":"column dense"},cl={auto:"auto",min:"min-content",max:"max-content",fr:"minmax(0, 1fr)"},ni={center:"center",start:"start",end:"end",between:"space-between",around:"space-around",evenly:"space-evenly",stretch:"stretch"};function ct(e){return{"--tc-ring-offset-shadow":"var(--tc-ring-inset,) 0 0 0 var(--tc-ring-offset-width, 0px) var(--tc-ring-offset-color, #fff)","--tc-ring-shadow":`var(--tc-ring-inset,) 0 0 0 calc(${e} + var(--tc-ring-offset-width, 0px)) var(--tc-ring-color, rgba(59, 130, 246, 0.5))`,"box-shadow":"var(--tc-ring-offset-shadow), var(--tc-ring-shadow), var(--tc-shadow, 0 0 #0000)"}}var ny={ring:ct("3px"),"ring-0":ct("0px"),"ring-1":ct("1px"),"ring-2":ct("2px"),"ring-4":ct("4px"),"ring-8":ct("8px"),"ring-inset":{"--tc-ring-inset":"inset"}},kl={"shadow-2xs":{"--tc-shadow":"0 1px rgb(0 0 0 / 0.05)","--tc-shadow-colored":"0 1px var(--tc-shadow-color)","box-shadow":"var(--tc-ring-offset-shadow, 0 0 #0000), var(--tc-ring-shadow, 0 0 #0000), var(--tc-shadow)"},"shadow-xs":{"--tc-shadow":"0 1px 2px 0 rgb(0 0 0 / 0.05)","--tc-shadow-colored":"0 1px 2px 0 var(--tc-shadow-color)","box-shadow":"var(--tc-ring-offset-shadow, 0 0 #0000), var(--tc-ring-shadow, 0 0 #0000), var(--tc-shadow)"},"shadow-sm":{"--tc-shadow":"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)","--tc-shadow-colored":"0 1px 3px 0 var(--tc-shadow-color), 0 1px 2px -1px var(--tc-shadow-color)","box-shadow":"var(--tc-ring-offset-shadow, 0 0 #0000), var(--tc-ring-shadow, 0 0 #0000), var(--tc-shadow)"},shadow:{"--tc-shadow":"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)","--tc-shadow-colored":"0 1px 3px 0 var(--tc-shadow-color), 0 1px 2px -1px var(--tc-shadow-color)","box-shadow":"var(--tc-ring-offset-shadow, 0 0 #0000), var(--tc-ring-shadow, 0 0 #0000), var(--tc-shadow)"},"shadow-md":{"--tc-shadow":"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)","--tc-shadow-colored":"0 4px 6px -1px var(--tc-shadow-color), 0 2px 4px -2px var(--tc-shadow-color)","box-shadow":"var(--tc-ring-offset-shadow, 0 0 #0000), var(--tc-ring-shadow, 0 0 #0000), var(--tc-shadow)"},"shadow-lg":{"--tc-shadow":"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)","--tc-shadow-colored":"0 10px 15px -3px var(--tc-shadow-color), 0 4px 6px -4px var(--tc-shadow-color)","box-shadow":"var(--tc-ring-offset-shadow, 0 0 #0000), var(--tc-ring-shadow, 0 0 #0000), var(--tc-shadow)"},"shadow-xl":{"--tc-shadow":"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)","--tc-shadow-colored":"0 20px 25px -5px var(--tc-shadow-color), 0 8px 10px -6px var(--tc-shadow-color)","box-shadow":"var(--tc-ring-offset-shadow, 0 0 #0000), var(--tc-ring-shadow, 0 0 #0000), var(--tc-shadow)"},"shadow-2xl":{"--tc-shadow":"0 25px 50px -12px rgb(0 0 0 / 0.25)","--tc-shadow-colored":"0 25px 50px -12px var(--tc-shadow-color)","box-shadow":"var(--tc-ring-offset-shadow, 0 0 #0000), var(--tc-ring-shadow, 0 0 #0000), var(--tc-shadow)"},"shadow-inner":{"--tc-shadow":"inset 0 2px 4px 0 rgb(0 0 0 / 0.05)","--tc-shadow-colored":"inset 0 2px 4px 0 var(--tc-shadow-color)","box-shadow":"var(--tc-ring-offset-shadow, 0 0 #0000), var(--tc-ring-shadow, 0 0 #0000), var(--tc-shadow)"},"shadow-none":{"--tc-shadow":"0 0 #0000","box-shadow":"var(--tc-ring-offset-shadow, 0 0 #0000), var(--tc-ring-shadow, 0 0 #0000), var(--tc-shadow)"}},Sl={"rounded-none":{"border-radius":"0px"},"rounded-xs":{"border-radius":"0.125rem"},"rounded-sm":{"border-radius":"0.25rem"},rounded:{"border-radius":"0.25rem"},"rounded-md":{"border-radius":"0.375rem"},"rounded-lg":{"border-radius":"0.5rem"},"rounded-xl":{"border-radius":"0.75rem"},"rounded-2xl":{"border-radius":"1rem"},"rounded-3xl":{"border-radius":"1.5rem"},"rounded-4xl":{"border-radius":"2rem"},"rounded-full":{"border-radius":"9999px"},"rounded-t-none":{"border-top-left-radius":"0px","border-top-right-radius":"0px"},"rounded-t-sm":{"border-top-left-radius":"0.25rem","border-top-right-radius":"0.25rem"},"rounded-t-lg":{"border-top-left-radius":"0.5rem","border-top-right-radius":"0.5rem"},"rounded-r-lg":{"border-top-right-radius":"0.5rem","border-bottom-right-radius":"0.5rem"},"rounded-b-lg":{"border-bottom-left-radius":"0.5rem","border-bottom-right-radius":"0.5rem"},"rounded-l-lg":{"border-top-left-radius":"0.5rem","border-bottom-left-radius":"0.5rem"},"rounded-tl-lg":{"border-top-left-radius":"0.5rem"},"rounded-tr-lg":{"border-top-right-radius":"0.5rem"},"rounded-br-lg":{"border-bottom-right-radius":"0.5rem"},"rounded-bl-lg":{"border-bottom-left-radius":"0.5rem"}},iy={border:{"border-width":"1px"},"border-0":{"border-width":"0px"},"border-2":{"border-width":"2px"},"border-4":{"border-width":"4px"},"border-8":{"border-width":"8px"},"border-t":{"border-top-width":"1px"},"border-r":{"border-right-width":"1px"},"border-b":{"border-bottom-width":"1px"},"border-l":{"border-left-width":"1px"},"border-t-0":{"border-top-width":"0px"},"border-r-0":{"border-right-width":"0px"},"border-b-0":{"border-bottom-width":"0px"},"border-l-0":{"border-left-width":"0px"},"border-t-2":{"border-top-width":"2px"},"border-r-2":{"border-right-width":"2px"},"border-b-2":{"border-bottom-width":"2px"},"border-l-2":{"border-left-width":"2px"},"border-t-4":{"border-top-width":"4px"},"border-r-4":{"border-right-width":"4px"},"border-b-4":{"border-bottom-width":"4px"},"border-l-4":{"border-left-width":"4px"},"border-x":{"border-left-width":"1px","border-right-width":"1px"},"border-y":{"border-top-width":"1px","border-bottom-width":"1px"},"border-x-0":{"border-left-width":"0px","border-right-width":"0px"},"border-y-0":{"border-top-width":"0px","border-bottom-width":"0px"},"border-x-2":{"border-left-width":"2px","border-right-width":"2px"},"border-y-2":{"border-top-width":"2px","border-bottom-width":"2px"}},oy={"ring-offset-0":{"--tc-ring-offset-width":"0px"},"ring-offset-1":{"--tc-ring-offset-width":"1px"},"ring-offset-2":{"--tc-ring-offset-width":"2px"},"ring-offset-4":{"--tc-ring-offset-width":"4px"},"ring-offset-8":{"--tc-ring-offset-width":"8px"}},sy={"opacity-0":{opacity:"0"},"opacity-5":{opacity:"0.05"},"opacity-10":{opacity:"0.1"},"opacity-20":{opacity:"0.2"},"opacity-25":{opacity:"0.25"},"opacity-30":{opacity:"0.3"},"opacity-40":{opacity:"0.4"},"opacity-50":{opacity:"0.5"},"opacity-60":{opacity:"0.6"},"opacity-70":{opacity:"0.7"},"opacity-75":{opacity:"0.75"},"opacity-80":{opacity:"0.8"},"opacity-90":{opacity:"0.9"},"opacity-95":{opacity:"0.95"},"opacity-100":{opacity:"1"}},Ir={"0":"0",px:"1px","0.5":"0.125rem","1":"0.25rem","1.5":"0.375rem","2":"0.5rem","2.5":"0.625rem","3":"0.75rem","3.5":"0.875rem","4":"1rem","5":"1.25rem","6":"1.5rem","7":"1.75rem","8":"2rem","9":"2.25rem","10":"2.5rem","11":"2.75rem","12":"3rem","14":"3.5rem","16":"4rem","20":"5rem","24":"6rem","28":"7rem","32":"8rem","36":"9rem","40":"10rem","44":"11rem","48":"12rem","52":"13rem","56":"14rem","60":"15rem","64":"16rem","72":"18rem","80":"20rem","96":"24rem"},ul={...Ir,auto:"auto",full:"100%",screen:"100vw",min:"min-content",max:"max-content",fit:"fit-content",...ay(6)};function ay(e){let t={};for(let r=2;r<=e;r++)for(let n=1;n<r;n++)t[`${n}/${r}`]=ye(n,r);return t}var ut={"gray-50":"oklch(98.5% 0.002 247.839)","gray-100":"oklch(96.7% 0.003 264.542)","gray-200":"oklch(92.8% 0.006 264.531)","gray-300":"oklch(87.2% 0.01 258.338)","gray-400":"oklch(70.7% 0.022 261.325)","gray-500":"oklch(55.1% 0.027 264.364)","gray-600":"oklch(44.6% 0.03 256.802)","gray-700":"oklch(37.3% 0.034 259.733)","gray-800":"oklch(27.8% 0.033 256.848)","gray-900":"oklch(21% 0.034 264.665)","gray-950":"oklch(13% 0.028 261.692)","red-50":"oklch(97.1% 0.013 17.38)","red-100":"oklch(93.6% 0.032 17.717)","red-200":"oklch(88.5% 0.062 18.334)","red-300":"oklch(80.8% 0.114 19.571)","red-400":"oklch(70.4% 0.191 22.216)","red-500":"oklch(63.7% 0.237 25.331)","red-600":"oklch(57.7% 0.245 27.325)","red-700":"oklch(50.5% 0.213 27.518)","red-800":"oklch(44.4% 0.177 26.899)","red-900":"oklch(39.6% 0.141 25.723)","red-950":"oklch(25.8% 0.092 26.042)","blue-50":"oklch(97% 0.014 254.604)","blue-100":"oklch(93.2% 0.032 255.585)","blue-200":"oklch(88.2% 0.059 254.128)","blue-300":"oklch(80.9% 0.105 251.813)","blue-400":"oklch(70.7% 0.165 254.624)","blue-500":"oklch(62.3% 0.214 259.815)","blue-600":"oklch(54.6% 0.245 262.881)","blue-700":"oklch(48.8% 0.243 264.376)","blue-800":"oklch(42.4% 0.199 265.638)","blue-900":"oklch(37.9% 0.146 265.522)","blue-950":"oklch(28.2% 0.091 267.935)","green-50":"oklch(98.2% 0.018 155.826)","green-100":"oklch(96.2% 0.044 156.743)","green-200":"oklch(92.5% 0.084 155.995)","green-300":"oklch(87.1% 0.15 154.449)","green-400":"oklch(79.2% 0.209 151.711)","green-500":"oklch(72.3% 0.219 149.579)","green-600":"oklch(62.7% 0.194 149.214)","green-700":"oklch(52.7% 0.154 150.069)","green-800":"oklch(44.8% 0.119 151.328)","green-900":"oklch(39.3% 0.095 152.535)","green-950":"oklch(26.6% 0.065 152.934)","yellow-50":"oklch(98.7% 0.026 102.212)","yellow-100":"oklch(97.3% 0.071 103.193)","yellow-200":"oklch(94.5% 0.129 101.54)","yellow-300":"oklch(90.5% 0.182 98.111)","yellow-400":"oklch(85.2% 0.199 91.936)","yellow-500":"oklch(79.5% 0.184 86.047)","yellow-600":"oklch(68.1% 0.162 75.834)","yellow-700":"oklch(55.4% 0.135 66.442)","yellow-800":"oklch(47.6% 0.114 61.907)","yellow-900":"oklch(42.1% 0.095 57.708)","yellow-950":"oklch(28.6% 0.066 53.813)","purple-50":"oklch(97.7% 0.014 308.299)","purple-100":"oklch(94.6% 0.033 307.174)","purple-200":"oklch(90.2% 0.063 306.703)","purple-300":"oklch(82.7% 0.119 306.383)","purple-400":"oklch(71.4% 0.203 305.504)","purple-500":"oklch(62.7% 0.265 303.9)","purple-600":"oklch(55.8% 0.288 302.321)","purple-700":"oklch(49.6% 0.265 301.924)","purple-800":"oklch(43.8% 0.218 303.724)","purple-900":"oklch(38.1% 0.176 304.987)","purple-950":"oklch(29.1% 0.149 302.717)","pink-50":"oklch(97.1% 0.014 343.198)","pink-100":"oklch(94.8% 0.028 342.258)","pink-200":"oklch(89.9% 0.061 343.231)","pink-300":"oklch(82.3% 0.12 346.018)","pink-400":"oklch(71.8% 0.202 349.761)","pink-500":"oklch(65.6% 0.241 354.308)","pink-600":"oklch(59.2% 0.249 0.584)","pink-700":"oklch(52.5% 0.223 3.958)","pink-800":"oklch(45.9% 0.187 3.815)","pink-900":"oklch(40.8% 0.153 2.432)","pink-950":"oklch(28.4% 0.109 3.907)","indigo-50":"oklch(96.2% 0.018 272.314)","indigo-100":"oklch(93% 0.034 272.788)","indigo-200":"oklch(87% 0.065 274.039)","indigo-300":"oklch(78.5% 0.115 274.713)","indigo-400":"oklch(67.3% 0.182 276.935)","indigo-500":"oklch(58.5% 0.233 277.117)","indigo-600":"oklch(51.1% 0.262 276.966)","indigo-700":"oklch(45.7% 0.24 277.023)","indigo-800":"oklch(39.8% 0.195 277.366)","indigo-900":"oklch(35.9% 0.144 278.697)","indigo-950":"oklch(25.7% 0.09 281.288)","cyan-50":"oklch(98.4% 0.019 200.873)","cyan-100":"oklch(95.6% 0.045 203.388)","cyan-200":"oklch(91.7% 0.08 205.041)","cyan-300":"oklch(86.5% 0.127 207.078)","cyan-400":"oklch(78.9% 0.154 211.53)","cyan-500":"oklch(71.5% 0.143 215.221)","cyan-600":"oklch(60.9% 0.126 221.723)","cyan-700":"oklch(52% 0.105 223.128)","cyan-800":"oklch(45% 0.085 224.283)","cyan-900":"oklch(39.8% 0.07 227.392)","cyan-950":"oklch(30.2% 0.056 229.695)","emerald-50":"oklch(97.9% 0.021 166.113)","emerald-100":"oklch(95% 0.052 163.051)","emerald-200":"oklch(90.5% 0.093 164.15)","emerald-300":"oklch(84.5% 0.143 164.978)","emerald-400":"oklch(76.5% 0.177 163.223)","emerald-500":"oklch(69.6% 0.17 162.48)","emerald-600":"oklch(59.6% 0.145 163.225)","emerald-700":"oklch(50.8% 0.118 165.612)","emerald-800":"oklch(43.2% 0.095 166.913)","emerald-900":"oklch(37.8% 0.077 168.94)","emerald-950":"oklch(26.2% 0.051 172.552)",white:"#fff",black:"#000",transparent:"transparent",current:"currentColor"},ly={"font-thin":{"font-weight":"100"},"font-extralight":{"font-weight":"200"},"font-light":{"font-weight":"300"},"font-normal":{"font-weight":"400"},"font-medium":{"font-weight":"500"},"font-semibold":{"font-weight":"600"},"font-bold":{"font-weight":"700"},"font-extrabold":{"font-weight":"800"},"font-black":{"font-weight":"900"}},cy={italic:{"font-style":"italic"},"not-italic":{"font-style":"normal"}},uy={uppercase:{"text-transform":"uppercase"},lowercase:{"text-transform":"lowercase"},capitalize:{"text-transform":"capitalize"},"normal-case":{"text-transform":"none"}},fy={underline:{"text-decoration-line":"underline"},overline:{"text-decoration-line":"overline"},"line-through":{"text-decoration-line":"line-through"},"no-underline":{"text-decoration-line":"none"}},dy={"decoration-solid":{"text-decoration-style":"solid"},"decoration-double":{"text-decoration-style":"double"},"decoration-dotted":{"text-decoration-style":"dotted"},"decoration-dashed":{"text-decoration-style":"dashed"},"decoration-wavy":{"text-decoration-style":"wavy"}},hy={"text-left":{"text-align":"left"},"text-center":{"text-align":"center"},"text-right":{"text-align":"right"},"text-justify":{"text-align":"justify"},"text-start":{"text-align":"start"},"text-end":{"text-align":"end"}},gy={truncate:{overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"},"text-ellipsis":{"text-overflow":"ellipsis"},"text-clip":{"text-overflow":"clip"}},my={"text-wrap":{"text-wrap":"wrap"},"text-nowrap":{"text-wrap":"nowrap"},"text-balance":{"text-wrap":"balance"},"text-pretty":{"text-wrap":"pretty"}},py={"whitespace-normal":{"white-space":"normal"},"whitespace-nowrap":{"white-space":"nowrap"},"whitespace-pre":{"white-space":"pre"},"whitespace-pre-line":{"white-space":"pre-line"},"whitespace-pre-wrap":{"white-space":"pre-wrap"},"whitespace-break-spaces":{"white-space":"break-spaces"}},yy={"break-normal":{"overflow-wrap":"normal","word-break":"normal"},"break-words":{"overflow-wrap":"break-word"},"break-all":{"word-break":"break-all"},"break-keep":{"word-break":"keep-all"}},by={"align-baseline":{"vertical-align":"baseline"},"align-top":{"vertical-align":"top"},"align-middle":{"vertical-align":"middle"},"align-bottom":{"vertical-align":"bottom"},"align-text-top":{"vertical-align":"text-top"},"align-text-bottom":{"vertical-align":"text-bottom"},"align-sub":{"vertical-align":"sub"},"align-super":{"vertical-align":"super"}},xy={"list-none":{"list-style-type":"none"},"list-disc":{"list-style-type":"disc"},"list-decimal":{"list-style-type":"decimal"},"list-inside":{"list-style-position":"inside"},"list-outside":{"list-style-position":"outside"}},vy={"hyphens-none":{hyphens:"none"},"hyphens-manual":{hyphens:"manual"},"hyphens-auto":{hyphens:"auto"}},wy={static:{position:"static"},fixed:{position:"fixed"},absolute:{position:"absolute"},relative:{position:"relative"},sticky:{position:"sticky"}},Cy={visible:{visibility:"visible"},invisible:{visibility:"hidden"},collapse:{visibility:"collapse"}},$y={"float-left":{float:"left"},"float-right":{float:"right"},"float-none":{float:"none"},"float-start":{float:"inline-start"},"float-end":{float:"inline-end"}},Ry={"clear-left":{clear:"left"},"clear-right":{clear:"right"},"clear-both":{clear:"both"},"clear-none":{clear:"none"},"clear-start":{clear:"inline-start"},"clear-end":{clear:"inline-end"}},ky={isolate:{isolation:"isolate"},"isolation-auto":{isolation:"auto"}},Sy={"object-contain":{"object-fit":"contain"},"object-cover":{"object-fit":"cover"},"object-fill":{"object-fit":"fill"},"object-none":{"object-fit":"none"},"object-scale-down":{"object-fit":"scale-down"}},Ey={"object-bottom":{"object-position":"bottom"},"object-center":{"object-position":"center"},"object-left":{"object-position":"left"},"object-left-bottom":{"object-position":"left bottom"},"object-left-top":{"object-position":"left top"},"object-right":{"object-position":"right"},"object-right-bottom":{"object-position":"right bottom"},"object-right-top":{"object-position":"right top"},"object-top":{"object-position":"top"}},Ay={"overflow-auto":{overflow:"auto"},"overflow-hidden":{overflow:"hidden"},"overflow-clip":{overflow:"clip"},"overflow-visible":{overflow:"visible"},"overflow-scroll":{overflow:"scroll"},"overflow-x-auto":{"overflow-x":"auto"},"overflow-x-hidden":{"overflow-x":"hidden"},"overflow-x-clip":{"overflow-x":"clip"},"overflow-x-visible":{"overflow-x":"visible"},"overflow-x-scroll":{"overflow-x":"scroll"},"overflow-y-auto":{"overflow-y":"auto"},"overflow-y-hidden":{"overflow-y":"hidden"},"overflow-y-clip":{"overflow-y":"clip"},"overflow-y-visible":{"overflow-y":"visible"},"overflow-y-scroll":{"overflow-y":"scroll"}},Ty={"overscroll-auto":{"overscroll-behavior":"auto"},"overscroll-contain":{"overscroll-behavior":"contain"},"overscroll-none":{"overscroll-behavior":"none"},"overscroll-x-auto":{"overscroll-behavior-x":"auto"},"overscroll-x-contain":{"overscroll-behavior-x":"contain"},"overscroll-x-none":{"overscroll-behavior-x":"none"},"overscroll-y-auto":{"overscroll-behavior-y":"auto"},"overscroll-y-contain":{"overscroll-behavior-y":"contain"},"overscroll-y-none":{"overscroll-behavior-y":"none"}},Ny={"z-0":{"z-index":"0"},"z-10":{"z-index":"10"},"z-20":{"z-index":"20"},"z-30":{"z-index":"30"},"z-40":{"z-index":"40"},"z-50":{"z-index":"50"},"z-auto":{"z-index":"auto"}},Oy={"aspect-auto":{"aspect-ratio":"auto"},"aspect-square":{"aspect-ratio":"1 / 1"},"aspect-video":{"aspect-ratio":"16 / 9"}},Iy={"box-border":{"box-sizing":"border-box"},"box-content":{"box-sizing":"content-box"}},Py={"box-decoration-clone":{"box-decoration-break":"clone"},"box-decoration-slice":{"box-decoration-break":"slice"}},_y={"bg-fixed":{"background-attachment":"fixed"},"bg-local":{"background-attachment":"local"},"bg-scroll":{"background-attachment":"scroll"}},Ly={"bg-clip-border":{"background-clip":"border-box"},"bg-clip-padding":{"background-clip":"padding-box"},"bg-clip-content":{"background-clip":"content-box"},"bg-clip-text":{"background-clip":"text","-webkit-background-clip":"text"}},My={"bg-origin-border":{"background-origin":"border-box"},"bg-origin-padding":{"background-origin":"padding-box"},"bg-origin-content":{"background-origin":"content-box"}},Fy={"bg-bottom":{"background-position":"bottom"},"bg-center":{"background-position":"center"},"bg-left":{"background-position":"left"},"bg-left-bottom":{"background-position":"left bottom"},"bg-left-top":{"background-position":"left top"},"bg-right":{"background-position":"right"},"bg-right-bottom":{"background-position":"right bottom"},"bg-right-top":{"background-position":"right top"},"bg-top":{"background-position":"top"}},Dy={"bg-repeat":{"background-repeat":"repeat"},"bg-no-repeat":{"background-repeat":"no-repeat"},"bg-repeat-x":{"background-repeat":"repeat-x"},"bg-repeat-y":{"background-repeat":"repeat-y"},"bg-repeat-round":{"background-repeat":"round"},"bg-repeat-space":{"background-repeat":"space"}},jy={"bg-auto":{"background-size":"auto"},"bg-cover":{"background-size":"cover"},"bg-contain":{"background-size":"contain"}},By={"bg-none":{"background-image":"none"},"bg-gradient-to-t":{"background-image":"linear-gradient(to top, var(--tc-gradient-stops))"},"bg-gradient-to-tr":{"background-image":"linear-gradient(to top right, var(--tc-gradient-stops))"},"bg-gradient-to-r":{"background-image":"linear-gradient(to right, var(--tc-gradient-stops))"},"bg-gradient-to-br":{"background-image":"linear-gradient(to bottom right, var(--tc-gradient-stops))"},"bg-gradient-to-b":{"background-image":"linear-gradient(to bottom, var(--tc-gradient-stops))"},"bg-gradient-to-bl":{"background-image":"linear-gradient(to bottom left, var(--tc-gradient-stops))"},"bg-gradient-to-l":{"background-image":"linear-gradient(to left, var(--tc-gradient-stops))"},"bg-gradient-to-tl":{"background-image":"linear-gradient(to top left, var(--tc-gradient-stops))"},"bg-radial":{"background-image":"radial-gradient(var(--tc-gradient-stops))"},"bg-radial-at-t":{"background-image":"radial-gradient(at top, var(--tc-gradient-stops))"},"bg-radial-at-tr":{"background-image":"radial-gradient(at top right, var(--tc-gradient-stops))"},"bg-radial-at-r":{"background-image":"radial-gradient(at right, var(--tc-gradient-stops))"},"bg-radial-at-br":{"background-image":"radial-gradient(at bottom right, var(--tc-gradient-stops))"},"bg-radial-at-b":{"background-image":"radial-gradient(at bottom, var(--tc-gradient-stops))"},"bg-radial-at-bl":{"background-image":"radial-gradient(at bottom left, var(--tc-gradient-stops))"},"bg-radial-at-l":{"background-image":"radial-gradient(at left, var(--tc-gradient-stops))"},"bg-radial-at-tl":{"background-image":"radial-gradient(at top left, var(--tc-gradient-stops))"},"bg-radial-at-c":{"background-image":"radial-gradient(at center, var(--tc-gradient-stops))"},"bg-conic":{"background-image":"conic-gradient(var(--tc-gradient-stops))"},"bg-conic-from-t":{"background-image":"conic-gradient(from 0deg at center, var(--tc-gradient-stops))"},"bg-conic-from-tr":{"background-image":"conic-gradient(from 45deg at center, var(--tc-gradient-stops))"},"bg-conic-from-r":{"background-image":"conic-gradient(from 90deg at center, var(--tc-gradient-stops))"},"bg-conic-from-br":{"background-image":"conic-gradient(from 135deg at center, var(--tc-gradient-stops))"},"bg-conic-from-b":{"background-image":"conic-gradient(from 180deg at center, var(--tc-gradient-stops))"},"bg-conic-from-bl":{"background-image":"conic-gradient(from 225deg at center, var(--tc-gradient-stops))"},"bg-conic-from-l":{"background-image":"conic-gradient(from 270deg at center, var(--tc-gradient-stops))"},"bg-conic-from-tl":{"background-image":"conic-gradient(from 315deg at center, var(--tc-gradient-stops))"}},Uy={"content-none":{content:"none"},"content-empty":{content:'""'}},Vy={"scrollbar-auto":{"scrollbar-width":"auto"},"scrollbar-thin":{"scrollbar-width":"thin"},"scrollbar-none":{"scrollbar-width":"none"}},zy={"cursor-auto":{cursor:"auto"},"cursor-default":{cursor:"default"},"cursor-pointer":{cursor:"pointer"},"cursor-wait":{cursor:"wait"},"cursor-text":{cursor:"text"},"cursor-move":{cursor:"move"},"cursor-help":{cursor:"help"},"cursor-not-allowed":{cursor:"not-allowed"},"cursor-none":{cursor:"none"},"cursor-context-menu":{cursor:"context-menu"},"cursor-progress":{cursor:"progress"},"cursor-cell":{cursor:"cell"},"cursor-crosshair":{cursor:"crosshair"},"cursor-vertical-text":{cursor:"vertical-text"},"cursor-alias":{cursor:"alias"},"cursor-copy":{cursor:"copy"},"cursor-no-drop":{cursor:"no-drop"},"cursor-grab":{cursor:"grab"},"cursor-grabbing":{cursor:"grabbing"},"cursor-all-scroll":{cursor:"all-scroll"},"cursor-col-resize":{cursor:"col-resize"},"cursor-row-resize":{cursor:"row-resize"},"cursor-n-resize":{cursor:"n-resize"},"cursor-e-resize":{cursor:"e-resize"},"cursor-s-resize":{cursor:"s-resize"},"cursor-w-resize":{cursor:"w-resize"},"cursor-ne-resize":{cursor:"ne-resize"},"cursor-nw-resize":{cursor:"nw-resize"},"cursor-se-resize":{cursor:"se-resize"},"cursor-sw-resize":{cursor:"sw-resize"},"cursor-ew-resize":{cursor:"ew-resize"},"cursor-ns-resize":{cursor:"ns-resize"},"cursor-nesw-resize":{cursor:"nesw-resize"},"cursor-nwse-resize":{cursor:"nwse-resize"},"cursor-zoom-in":{cursor:"zoom-in"},"cursor-zoom-out":{cursor:"zoom-out"}},Wy={"pointer-events-none":{"pointer-events":"none"},"pointer-events-auto":{"pointer-events":"auto"}},Ky={"resize-none":{resize:"none"},"resize-y":{resize:"vertical"},"resize-x":{resize:"horizontal"},resize:{resize:"both"}},Gy={"select-none":{"user-select":"none"},"select-text":{"user-select":"text"},"select-all":{"user-select":"all"},"select-auto":{"user-select":"auto"}},Hy={"scroll-auto":{"scroll-behavior":"auto"},"scroll-smooth":{"scroll-behavior":"smooth"}},qy={"snap-none":{"scroll-snap-type":"none"},"snap-x":{"scroll-snap-type":"x var(--tc-scroll-snap-strictness, proximity)"},"snap-y":{"scroll-snap-type":"y var(--tc-scroll-snap-strictness, proximity)"},"snap-both":{"scroll-snap-type":"both var(--tc-scroll-snap-strictness, proximity)"},"snap-mandatory":{"--tc-scroll-snap-strictness":"mandatory"},"snap-proximity":{"--tc-scroll-snap-strictness":"proximity"},"snap-start":{"scroll-snap-align":"start"},"snap-end":{"scroll-snap-align":"end"},"snap-center":{"scroll-snap-align":"center"},"snap-align-none":{"scroll-snap-align":"none"},"snap-normal":{"scroll-snap-stop":"normal"},"snap-always":{"scroll-snap-stop":"always"}},Ge="var(--tc-pan-x,) var(--tc-pan-y,) var(--tc-pinch-zoom,)",Yy={"touch-auto":{"touch-action":"auto"},"touch-none":{"touch-action":"none"},"touch-pan-x":{"--tc-pan-x":"pan-x","touch-action":Ge},"touch-pan-left":{"--tc-pan-x":"pan-left","touch-action":Ge},"touch-pan-right":{"--tc-pan-x":"pan-right","touch-action":Ge},"touch-pan-y":{"--tc-pan-y":"pan-y","touch-action":Ge},"touch-pan-up":{"--tc-pan-y":"pan-up","touch-action":Ge},"touch-pan-down":{"--tc-pan-y":"pan-down","touch-action":Ge},"touch-pinch-zoom":{"--tc-pinch-zoom":"pinch-zoom","touch-action":Ge},"touch-manipulation":{"touch-action":"manipulation"}},Jy={"will-change-auto":{"will-change":"auto"},"will-change-scroll":{"will-change":"scroll-position"},"will-change-contents":{"will-change":"contents"},"will-change-transform":{"will-change":"transform"}},Xy={"appearance-none":{appearance:"none"},"appearance-auto":{appearance:"auto"}},Zy={"border-collapse":{"border-collapse":"collapse"},"border-separate":{"border-collapse":"separate"}},Qy={"table-auto":{"table-layout":"auto"},"table-fixed":{"table-layout":"fixed"}},e0={"caption-top":{"caption-side":"top"},"caption-bottom":{"caption-side":"bottom"}},t0={"sr-only":{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)","white-space":"nowrap","border-width":"0"},"not-sr-only":{position:"static",width:"auto",height:"auto",padding:"0",margin:"0",overflow:"visible",clip:"auto","white-space":"normal"}},r0={"forced-color-adjust-auto":{"forced-color-adjust":"auto"},"forced-color-adjust-none":{"forced-color-adjust":"none"}},n0={"fill-none":{fill:"none"},"fill-current":{fill:"currentColor"},"fill-inherit":{fill:"inherit"}},i0={"stroke-none":{stroke:"none"},"stroke-current":{stroke:"currentColor"},"stroke-inherit":{stroke:"inherit"},"stroke-0":{"stroke-width":"0"},"stroke-1":{"stroke-width":"1"},"stroke-2":{"stroke-width":"2"}},o0={"stroke-linecap-butt":{"stroke-linecap":"butt"},"stroke-linecap-round":{"stroke-linecap":"round"},"stroke-linecap-square":{"stroke-linecap":"square"}},s0={"stroke-linejoin-miter":{"stroke-linejoin":"miter"},"stroke-linejoin-round":{"stroke-linejoin":"round"},"stroke-linejoin-bevel":{"stroke-linejoin":"bevel"}},a0=["blur","brightness","contrast","grayscale","hue-rotate","invert","saturate","sepia","drop-shadow"],l0=["blur","brightness","contrast","grayscale","hue-rotate","invert","opacity","saturate","sepia"],c0=a0.map((e)=>`var(--tc-${e}, )`).join(" "),fl=l0.map((e)=>`var(--tc-backdrop-${e}, )`).join(" ");function U(e,t){return{[`--tc-${e}`]:t,filter:c0}}function ee(e,t){return{[`--tc-backdrop-${e}`]:t,"-webkit-backdrop-filter":fl,"backdrop-filter":fl}}var u0={"blur-none":U("blur","blur(0)"),"blur-sm":U("blur","blur(4px)"),blur:U("blur","blur(8px)"),"blur-md":U("blur","blur(12px)"),"blur-lg":U("blur","blur(16px)"),"blur-xl":U("blur","blur(24px)"),"blur-2xl":U("blur","blur(40px)"),"blur-3xl":U("blur","blur(64px)")},f0={"backdrop-blur-none":ee("blur","blur(0)"),"backdrop-blur-sm":ee("blur","blur(4px)"),"backdrop-blur":ee("blur","blur(8px)"),"backdrop-blur-md":ee("blur","blur(12px)"),"backdrop-blur-lg":ee("blur","blur(16px)"),"backdrop-blur-xl":ee("blur","blur(24px)"),"backdrop-blur-2xl":ee("blur","blur(40px)"),"backdrop-blur-3xl":ee("blur","blur(64px)")},d0={"grayscale-0":U("grayscale","grayscale(0)"),grayscale:U("grayscale","grayscale(100%)"),"invert-0":U("invert","invert(0)"),invert:U("invert","invert(100%)"),"sepia-0":U("sepia","sepia(0)"),sepia:U("sepia","sepia(100%)")},h0={"backdrop-grayscale-0":ee("grayscale","grayscale(0)"),"backdrop-grayscale":ee("grayscale","grayscale(100%)"),"backdrop-invert-0":ee("invert","invert(0)"),"backdrop-invert":ee("invert","invert(100%)"),"backdrop-sepia-0":ee("sepia","sepia(0)"),"backdrop-sepia":ee("sepia","sepia(100%)")},g0={"drop-shadow-sm":U("drop-shadow","drop-shadow(0 1px 1px rgb(0 0 0 / 0.05))"),"drop-shadow":U("drop-shadow","drop-shadow(0 1px 2px rgb(0 0 0 / 0.1)) drop-shadow(0 1px 1px rgb(0 0 0 / 0.06))"),"drop-shadow-md":U("drop-shadow","drop-shadow(0 4px 3px rgb(0 0 0 / 0.07)) drop-shadow(0 2px 2px rgb(0 0 0 / 0.06))"),"drop-shadow-lg":U("drop-shadow","drop-shadow(0 10px 8px rgb(0 0 0 / 0.04)) drop-shadow(0 4px 3px rgb(0 0 0 / 0.1))"),"drop-shadow-xl":U("drop-shadow","drop-shadow(0 20px 13px rgb(0 0 0 / 0.03)) drop-shadow(0 8px 5px rgb(0 0 0 / 0.08))"),"drop-shadow-2xl":U("drop-shadow","drop-shadow(0 25px 25px rgb(0 0 0 / 0.15))"),"drop-shadow-none":U("drop-shadow","drop-shadow(0 0 #0000)")},m0={"mix-blend-normal":{"mix-blend-mode":"normal"},"mix-blend-multiply":{"mix-blend-mode":"multiply"},"mix-blend-screen":{"mix-blend-mode":"screen"},"mix-blend-overlay":{"mix-blend-mode":"overlay"},"mix-blend-darken":{"mix-blend-mode":"darken"},"mix-blend-lighten":{"mix-blend-mode":"lighten"},"mix-blend-color-dodge":{"mix-blend-mode":"color-dodge"},"mix-blend-color-burn":{"mix-blend-mode":"color-burn"},"mix-blend-hard-light":{"mix-blend-mode":"hard-light"},"mix-blend-soft-light":{"mix-blend-mode":"soft-light"},"mix-blend-difference":{"mix-blend-mode":"difference"},"mix-blend-exclusion":{"mix-blend-mode":"exclusion"},"mix-blend-hue":{"mix-blend-mode":"hue"},"mix-blend-saturation":{"mix-blend-mode":"saturation"},"mix-blend-color":{"mix-blend-mode":"color"},"mix-blend-luminosity":{"mix-blend-mode":"luminosity"},"mix-blend-plus-darker":{"mix-blend-mode":"plus-darker"},"mix-blend-plus-lighter":{"mix-blend-mode":"plus-lighter"}},p0={"bg-blend-normal":{"background-blend-mode":"normal"},"bg-blend-multiply":{"background-blend-mode":"multiply"},"bg-blend-screen":{"background-blend-mode":"screen"},"bg-blend-overlay":{"background-blend-mode":"overlay"},"bg-blend-darken":{"background-blend-mode":"darken"},"bg-blend-lighten":{"background-blend-mode":"lighten"},"bg-blend-color-dodge":{"background-blend-mode":"color-dodge"},"bg-blend-color-burn":{"background-blend-mode":"color-burn"},"bg-blend-hard-light":{"background-blend-mode":"hard-light"},"bg-blend-soft-light":{"background-blend-mode":"soft-light"},"bg-blend-difference":{"background-blend-mode":"difference"},"bg-blend-exclusion":{"background-blend-mode":"exclusion"},"bg-blend-hue":{"background-blend-mode":"hue"},"bg-blend-saturation":{"background-blend-mode":"saturation"},"bg-blend-color":{"background-blend-mode":"color"},"bg-blend-luminosity":{"background-blend-mode":"luminosity"}},y0={...Mp,...Fp,...Dp,...jp,...Bp,...Kp,...Gp,...Hp,...qp,...Yp,...ny,...kl,...Sl,...iy,...oy,...sy,...ly,...cy,...uy,...fy,...dy,...hy,...gy,...my,...py,...yy,...by,...xy,...vy,...wy,...Cy,...$y,...Ry,...ky,...Sy,...Ey,...Ay,...Ty,...Ny,...Oy,...Iy,...Py,..._y,...Ly,...My,...Fy,...Dy,...jy,...By,...zy,...Wy,...Ky,...Gy,...Hy,...qy,...Yy,...Jy,...Xy,...Zy,...Qy,...e0,...t0,...r0,...n0,...i0,...o0,...s0,...u0,...f0,...d0,...h0,...g0,...m0,...p0,...Uy,...Vy},dl={hover:":hover",focus:":focus",active:":active",disabled:":disabled",visited:":visited",checked:":checked","focus-within":":focus-within","focus-visible":":focus-visible",first:":first-child",last:":last-child",odd:":nth-child(odd)",even:":nth-child(even)","first-of-type":":first-of-type","last-of-type":":last-of-type",before:"::before",after:"::after",marker:"::marker",placeholder:"::placeholder",selection:"::selection",file:"::file-selector-button",required:":required",valid:":valid",invalid:":invalid","read-only":":read-only",autofill:":autofill",open:"[open]",closed:":not([open])",empty:":empty",enabled:":enabled",only:":only-child",target:":target",indeterminate:":indeterminate",default:":default",optional:":optional"},hl={"not-first":":not(:first-child)","not-last":":not(:last-child)","not-only":":not(:only-child)","not-empty":":not(:empty)","not-disabled":":not(:disabled)","not-checked":":not(:checked)","not-first-of-type":":not(:first-of-type)","not-last-of-type":":not(:last-of-type)"};function gl(e){return on(e).css}var ml="\x01",pl={dark:".dark ",light:".light "},yl={rtl:':is([dir="rtl"], [dir="rtl"] *)',ltr:':is([dir="ltr"], [dir="ltr"] *)'},bl=new WeakMap,xl=new WeakMap,vl=new WeakMap,wl=new WeakMap,Cl=new WeakMap,$l=new WeakMap;function b0(e){let t=xl.get(e);if(t)return t;let r=!1;for(let i in e)if(Ir[i]!==e[i]){r=!0;break}let n=r?{...Ir,...e}:Ir;return xl.set(e,n),n}function x0(e){let t=vl.get(e);if(t)return t;let r=null;for(let i in e){let o=e[i];if(typeof o==="string"){if(ut[i]!==void 0&&ut[i]!==o)r??={},r[i]=o;continue}if(!o||typeof o!=="object")continue;for(let s in o){let c=o[s];if(typeof c!=="string")continue;let a=s==="DEFAULT"?i:`${i}-${s}`;if(ut[a]!==void 0&&ut[a]!==c)r??={},r[a]=c}}let n=r?{...ut,...r}:ut;return vl.set(e,n),n}function v0(e){let t=wl.get(e);if(t!==void 0)return t;let r=!1;for(let n in e){let i=n==="DEFAULT"?"rounded":`rounded-${n}`;if(Sl[i]?.["border-radius"]!==e[n]){r=!0;break}}return wl.set(e,r),r}function w0(e){let t=Cl.get(e);if(t!==void 0)return t;let r=!1;for(let n in e){let i=n==="DEFAULT"?"shadow":`shadow-${n}`,o=kl[i];if(o!==void 0&&o["--tc-shadow"]!==e[n]){r=!0;break}}return Cl.set(e,r),r}function C0(e){let t=$l.get(e);if(t)return t;let r=new Map(Object.entries(e));return $l.set(e,r),r}function $0(e){let t=bl.get(e);if(t)return t;if(e.presets&&e.presets.length>0)for(let u of e.presets){if(u.theme)e.theme=ii(e.theme,u.theme);if(u.rules&&u.rules.length>0)e.rules=[...u.rules,...e.rules];if(u.shortcuts)e.shortcuts={...u.shortcuts,...e.shortcuts};if(u.variants)e.variants={...u.variants,...e.variants};if(u.preflights&&u.preflights.length>0)e.preflights=[...u.preflights,...e.preflights]}let r=e.theme.extend?.colors?e.theme.extend.colors:null;if(e.theme.extend){let{extend:u,...f}=e.theme;if(u)e.theme=ii(f,u)}let n=[],i=new Set;for(let u of e.blocklist)if(u.includes("*"))n.push(new RegExp(`^${u.replace(/\*/g,".*")}$`));else i.add(u);let o=b0(e.theme.spacing),s=x0(e.theme.colors),c=v0(e.theme.borderRadius),a=w0(e.theme.boxShadow),l={config:e,variantEnabled:e.variants,spacingValues:o,commonColors:s,skipStaticRadius:c,skipStaticShadow:a,screenBreakpoints:C0(e.theme.screens),blocklistRegexCache:n,blocklistExact:i,extendColors:r,hasBlocklist:n.length>0||i.size>0,hasShortcuts:Object.keys(e.shortcuts).length>0};return bl.set(e,l),l}function Rl(e){return e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57||e===45||e===95}function R0(e){let t=e.indexOf(".");if(t===-1)return;t++;let r=()=>{if(e.charCodeAt(t)===92&&e.charCodeAt(t+1)===33)t+=2};r();for(;;){let i=t;while(i<e.length&&Rl(e.charCodeAt(i)))i++;if(e.charCodeAt(i)!==92||e.charCodeAt(i+1)!==58)break;t=i+2}r();let n=t;while(n<e.length&&Rl(e.charCodeAt(n)))n++;return n>t?e.slice(t,n):void 0}var k0=/^(?:mx|my|px|py|inset-x|inset-y|border-x|border-y|scroll-mx|scroll-my|scroll-px|scroll-py|space-x|space-y|gap-x|gap-y)-/,S0=/^rounded-[tlbr](?:-|$)/,E0=/^(?:mt|mr|mb|ml|pt|pr|pb|pl|top|right|bottom|left|border-t|border-r|border-b|border-l|scroll-mt|scroll-mr|scroll-mb|scroll-ml|scroll-pt|scroll-pr|scroll-pb|scroll-pl)-/,A0=/^rounded-(?:tl|tr|bl|br)(?:-|$)/,T0=/^i-[a-z][a-z0-9]*(?:-[a-z0-9]+)*-.+/;function N0(e){let t=R0(e);if(!t)return 0;if(T0.test(t))return-1;if(k0.test(t)||S0.test(t))return 1;if(E0.test(t)||A0.test(t))return 2;return 0}class oi{config;rules=new Map;classCache=new Set;selectorCache=new Map;mediaQueryCache=new Map;ruleCache=new Map;variantEnabled;screenBreakpoints;noMatchCache=new Set;usedKeyframes=new Set;variantHandledCache=new Map;utilityRankCache=new Map;compiledGenerated=new Set;darkStrategy;spacingValues;commonColors;skipStaticRadius;skipStaticShadow;shortcutSelectorRaw=null;extendColors=null;processed;revision=0;cssCache=null;cssCacheRevision=-1;cssCachePreflight=!1;cssCacheMinify=!1;constructor(e){this.config=e;this.processed=$0(e),this.variantEnabled=this.processed.variantEnabled,this.screenBreakpoints=this.processed.screenBreakpoints,this.extendColors=this.processed.extendColors,this.darkStrategy=e.darkMode==="media"?"media":"class",this.spacingValues=this.processed.spacingValues,this.commonColors=this.processed.commonColors,this.skipStaticRadius=this.processed.skipStaticRadius,this.skipStaticShadow=this.processed.skipStaticShadow}buildRuleLookup(){}generateBatch(e){for(let t=0;t<e.length;t++)this.generate(e[t])}generate(e){if(this.classCache.has(e))return;if(this.classCache.add(e),this.processed.hasShortcuts){let t=this.config.shortcuts[e];if(t){this.expandShortcut(e,t,new Set([e]));return}}this.generateUtility(e)}expandShortcut(e,t,r){let n=Array.isArray(t)?t:t.split(/\s+/),i=this.shortcutSelectorRaw;this.shortcutSelectorRaw=e;for(let o of n){if(!o)continue;let s=this.config.shortcuts[o];if(s){if(!r.has(o))r.add(o),this.expandShortcut(e,s,r);continue}this.generateUtility(o)}this.shortcutSelectorRaw=i}generateCompiledClass(e,t){if(this.compiledGenerated.has(e))return;this.compiledGenerated.add(e),this.classCache.add(e),this.expandShortcut(e,t,new Set([e]))}generateUtility(e){if(this.processed.hasBlocklist){if(this.processed.blocklistExact.has(e))return;let l=this.processed.blocklistRegexCache;for(let u=0;u<l.length;u++)if(l[u].test(e))return}let t=to(e),r=t.base,n=y0[r];if(n&&(this.skipStaticRadius&&r.startsWith("rounded")||this.skipStaticShadow&&(r==="shadow"||r.startsWith("shadow-"))))n=void 0;if(n){if(this.addRule(t,n),n.animation){let l=n.animation.split(" ")[0];if(l&&l!=="none")this.usedKeyframes.add(l),this.revision++}return}let{utility:i,value:o}=t;if(i==="w"&&o){let l=ul[o]||this.config.theme.spacing[o];if(l){this.addRule(t,{width:l});return}if(t.arbitrary){let u=o.match(/^(\d+)\/(\d+)$/);if(u){let f=Number(u[1]),d=Number(u[2]);if(!Number.isNaN(f)&&!Number.isNaN(d)&&d!==0){this.addRule(t,{width:ye(f,d)});return}}this.addRule(t,{width:o});return}}if(i==="h"&&o){let l=ul[o]||this.config.theme.spacing[o];if(l){this.addRule(t,{height:o==="screen"?"100vh":l});return}if(t.arbitrary){let u=o.match(/^(\d+)\/(\d+)$/);if(u){let f=Number(u[1]),d=Number(u[2]);if(!Number.isNaN(f)&&!Number.isNaN(d)&&d!==0){this.addRule(t,{height:ye(f,d)});return}}this.addRule(t,{height:o});return}}if(i==="p"&&o){let l=this.spacingValues[o];if(l){this.addRule(t,{padding:l});return}}if(i==="px"&&o){let l=this.spacingValues[o];if(l){this.addRule(t,{"padding-left":l,"padding-right":l});return}}if(i==="py"&&o){let l=this.spacingValues[o];if(l){this.addRule(t,{"padding-top":l,"padding-bottom":l});return}}if((i==="pt"||i==="pr"||i==="pb"||i==="pl")&&o){let l=this.spacingValues[o];if(l){let u={pt:"padding-top",pr:"padding-right",pb:"padding-bottom",pl:"padding-left"};this.addRule(t,{[u[i]]:l});return}}if(i==="m"&&o){let l=this.spacingValues[o];if(l){this.addRule(t,{margin:l});return}}if(i==="mx"&&o){let l=this.spacingValues[o];if(l){this.addRule(t,{"margin-left":l,"margin-right":l});return}}if(i==="my"&&o){let l=this.spacingValues[o];if(l){this.addRule(t,{"margin-top":l,"margin-bottom":l});return}}if((i==="mt"||i==="mr"||i==="mb"||i==="ml")&&o){let l=this.spacingValues[o];if(l){let u={mt:"margin-top",mr:"margin-right",mb:"margin-bottom",ml:"margin-left"};this.addRule(t,{[u[i]]:l});return}}if((i==="top"||i==="right"||i==="bottom"||i==="left")&&o){let l=this.spacingValues[o];if(l){this.addRule(t,{[i]:l});return}}if(i==="inset"&&o){let l=this.spacingValues[o];if(l){this.addRule(t,{top:l,right:l,bottom:l,left:l});return}}if(i==="inset-x"&&o){let l=this.spacingValues[o];if(l){this.addRule(t,{left:l,right:l});return}}if(i==="inset-y"&&o){let l=this.spacingValues[o];if(l){this.addRule(t,{top:l,bottom:l});return}}if(i==="bg"&&o){let l=this.commonColors[o];if(l){this.addRule(t,{"background-color":l});return}}if(i==="text"&&o){let l=this.commonColors[o];if(l){this.addRule(t,{color:l});return}}if(i==="border"&&o){let l=this.commonColors[o];if(l){this.addRule(t,{"border-color":l});return}}if(i==="justify"&&o){let l=Up[o];if(l){this.addRule(t,{"justify-content":l});return}}if(i==="items"&&o){let l=Vp[o];if(l){this.addRule(t,{"align-items":l});return}}if(i==="content"&&o){let l=zp[o];if(l){this.addRule(t,{"align-content":l});return}if(t.arbitrary){this.addRule(t,{content:o});return}}if(i==="self"&&o){let l=Wp[o];if(l){this.addRule(t,{"align-self":l});return}}if(i==="grid-cols"&&o){let l=Zp[o];if(l){this.addRule(t,{"grid-template-columns":l});return}}if(i==="grid-rows"&&o){let l=Qp[o];if(l){this.addRule(t,{"grid-template-rows":l});return}}if(i==="col"&&o){let l=ey[o];if(l){this.addRule(t,{"grid-column":l});return}}if(i==="row"&&o){let l=ty[o];if(l){this.addRule(t,{"grid-row":l});return}}if(i==="grid-flow"&&o){let l=ry[o];if(l){this.addRule(t,{"grid-auto-flow":l});return}}if(i==="auto-cols"&&o){let l=cl[o];if(l){this.addRule(t,{"grid-auto-columns":l});return}}if(i==="auto-rows"&&o){let l=cl[o];if(l){this.addRule(t,{"grid-auto-rows":l});return}}if(i==="origin"&&o){let l=Xp[o];if(l){this.addRule(t,{"transform-origin":l});return}}if(i==="scale"&&o&&!t.arbitrary){let l=Number(o)/100;if(!Number.isNaN(l)){this.addRule(t,{transform:`scale(${l})`});return}}if(i==="scale-x"&&o&&!t.arbitrary){let l=Number(o)/100;if(!Number.isNaN(l)){this.addRule(t,{transform:`scaleX(${l})`});return}}if(i==="scale-y"&&o&&!t.arbitrary){let l=Number(o)/100;if(!Number.isNaN(l)){this.addRule(t,{transform:`scaleY(${l})`});return}}if(i==="rotate"&&o&&!t.arbitrary&&/^-?\d+(?:\.\d+)?$/.test(o)){this.addRule(t,{transform:`rotate(${o}deg)`});return}if(i==="duration"&&o&&o!=="0"&&!t.arbitrary&&/^\d+(?:\.\d+)?$/.test(o)){this.addRule(t,{"transition-duration":`${o}ms`});return}if(i==="delay"&&o&&o!=="0"&&!t.arbitrary&&/^\d+(?:\.\d+)?$/.test(o)){this.addRule(t,{"transition-delay":`${o}ms`});return}let s=(l)=>{let u=this.config.theme.spacing[l];if(u!==void 0)return u;if(t.arbitrary)return l;if(/^\d+(?:\.\d+)?$/.test(l)){let f=Number.parseFloat(l);if(Number.isFinite(f))return`${f*0.25}rem`}return};if(i==="gap"&&o){let l=s(o);if(l!==void 0)this.addRule(t,{gap:l});return}if(i==="gap-x"&&o){let l=s(o);if(l!==void 0)this.addRule(t,{"column-gap":l});return}if(i==="gap-y"&&o){let l=s(o);if(l!==void 0)this.addRule(t,{"row-gap":l});return}if(i==="place"&&o){if(o.startsWith("content-")){let l=ni[o.slice(8)];if(l){this.addRule(t,{"place-content":l});return}}if(o.startsWith("items-")){let l=ni[o.slice(6)];if(l){this.addRule(t,{"place-items":l});return}}if(o.startsWith("self-")){let l=ni[o.slice(5)];if(l){this.addRule(t,{"place-self":l});return}}}let c=`${t.utility}:${t.value||""}`;if(this.noMatchCache.has(c))return;if(this.config.rules.length>0)for(let[l,u]of this.config.rules){let f=e.match(l);if(f){let d=u(f);if(d){this.addRule(t,d);return}}}let a=ri.length;for(let l=0;l<a;l++){let u=ri[l](t,this.config);if(u){if("properties"in u&&typeof u.properties==="object")this.addRule(t,u.properties,u.childSelector,u.pseudoElement);else this.addRule(t,u);return}}this.noMatchCache.add(c)}isVariantHandled(e){let t=this.variantHandledCache.get(e);if(t!==void 0)return t;let r=dl[e]!==void 0||pl[e]!==void 0||yl[e]!==void 0||hl[e]!==void 0||this.screenBreakpoints.has(e)||e.startsWith("max-")&&this.screenBreakpoints.has(e.slice(4))||e.startsWith("@")&&this.screenBreakpoints.has(e.slice(1))||e.startsWith("group-")||e.startsWith("group/")||e.startsWith("peer-")||e.startsWith("peer/")||e.startsWith("has-")||e.startsWith("aria-")||e.startsWith("data-")||e.startsWith("supports-")||e.startsWith("[")&&e.endsWith("]")||["print","motion-safe","motion-reduce","contrast-more","contrast-less","landscape","portrait","forced-colors"].includes(e);return this.variantHandledCache.set(e,r),r}addRule(e,t,r,n){for(let a=0;a<e.variants.length;a++)if(!this.isVariantHandled(e.variants[a]))return;let i=this.shortcutSelectorRaw===null?r===void 0&&n===void 0?e.raw:`${e.raw}${r||""}${n||""}`:`${this.shortcutSelectorRaw}>${e.raw}${r||""}${n||""}`,o=this.selectorCache.get(i);if(!o){if(o=this.buildSelector(e),n)o+=n;if(r)o+=` ${r}`;this.selectorCache.set(i,o)}let s=this.getMediaQuery(e);if(e.important){let a={};for(let l in t)a[l]=`${t[l]} !important`;t=a}let c=s||"base";if(!this.rules.has(c))this.rules.set(c,[]);this.revision++,this.rules.get(c).push({selector:o,properties:t,mediaQuery:s,childSelector:r})}buildSelector(e){let t=`.${this.escapeSelector(this.shortcutSelectorRaw??e.raw)}`,r="",n=e.variants,i=n.length;if(i===0)return t;for(let o=0;o<i;o++){let s=n[o];if(s.charCodeAt(0)===91&&s.charCodeAt(s.length-1)===93){let u=s.slice(1,-1).replace(/_/g," ");if(u.includes("&"))t=u.replace(/&/g,t);continue}let c=dl[s];if(c!==void 0){if(this.variantEnabled[s])t+=c;continue}let a=yl[s];if(a!==void 0){if(this.variantEnabled[s]){let u=t.indexOf("::");t=u===-1?t+a:t.slice(0,u)+a+t.slice(u)}continue}let l=pl[s];if(l!==void 0){if(this.darkStrategy==="media"&&(s==="dark"||s==="light"))continue;if(this.variantEnabled[s])r=l;continue}if(s.charCodeAt(0)===110&&s.startsWith("not-")){if(this.variantEnabled.not){let u=hl[s];if(u)t+=u}continue}if(s.charCodeAt(0)===103&&s.startsWith("group-")){if(this.variantEnabled.group){let u=s.slice(6);if(u.startsWith("has-")){let f=u.slice(4);if(f.charCodeAt(0)===91&&f.charCodeAt(f.length-1)===93)r=`.group:has(${f.slice(1,-1)}) `;else r=`.group:has(:${f}) `}else r=`.group:${u} `}continue}if(s.charCodeAt(0)===103&&s.startsWith("group/")){if(this.variantEnabled.group)r=`.group\\/${s.slice(6)} `;continue}if(s.charCodeAt(0)===112&&s.startsWith("peer-")){if(this.variantEnabled.peer){let u=s.slice(5);if(u.startsWith("has-")){let f=u.slice(4);if(f.charCodeAt(0)===91&&f.charCodeAt(f.length-1)===93)r=`.peer:has(${f.slice(1,-1)}) ~ `;else r=`.peer:has(:${f}) ~ `}else r=`.peer:${u} ~ `}continue}if(s.charCodeAt(0)===112&&s.startsWith("peer/")){if(this.variantEnabled.peer)r=`.peer\\/${s.slice(5)} ~ `;continue}if(s.charCodeAt(0)===104&&s.startsWith("has-")){if(this.variantEnabled.has){let u=s.slice(4);if(u.charCodeAt(0)===91&&u.charCodeAt(u.length-1)===93){let f=u.slice(1,-1);t+=`:has(${f})`}else t+=`:has(:${u})`}continue}if(s.charCodeAt(0)===97&&s.startsWith("aria-")){if(this.variantEnabled.aria){let u=s.slice(5);if(u.charCodeAt(0)===91&&u.charCodeAt(u.length-1)===93){let f=u.slice(1,-1);t+=`[aria-${f}]`}else t+=`[aria-${u}="true"]`}continue}if(s.charCodeAt(0)===100&&s.startsWith("data-")){if(this.variantEnabled.data){let u=s.slice(5);if(u.charCodeAt(0)===91&&u.charCodeAt(u.length-1)===93){let f=u.slice(1,-1);t+=`[data-${f}]`}else t+=`[data-${u}]`}continue}}return r+t}getMediaQuery(e){let t=e.variants,r=t.length;if(r===0)return;let n=r===1?t[0]:t.join(":"),i=this.mediaQueryCache.get(n);if(i!==void 0)return i||void 0;let o=[],s=[],c=[];for(let l=0;l<r;l++){let u=t[l],f=u.charCodeAt(0);if(f===91&&u.startsWith("[@media")&&u.endsWith("]")){let d=u.slice(1,-1).replace(/_/g," ").slice(6).trim();if(d)o.push(d);continue}if(f===64){let d=u.slice(1),h=this.screenBreakpoints.get(d);if(h)c.push(`@container (min-width: ${h})`);continue}if(this.darkStrategy==="media"&&(u==="dark"||u==="light")){o.push(`(prefers-color-scheme: ${u})`);continue}if(this.variantEnabled.responsive){let d=this.screenBreakpoints.get(u);if(d){o.push(`(min-width: ${d})`);continue}if(u.startsWith("max-")){let h=this.screenBreakpoints.get(u.slice(4));if(h){let m=h.match(/^([\d.]+)px$/);o.push(m?`(max-width: ${Number.parseFloat(m[1])-0.02}px)`:`not all and (min-width: ${h})`);continue}}}switch(u){case"print":if(this.variantEnabled.print)o.push("print");break;case"motion-safe":if(this.variantEnabled["motion-safe"])o.push("(prefers-reduced-motion: no-preference)");break;case"motion-reduce":if(this.variantEnabled["motion-reduce"])o.push("(prefers-reduced-motion: reduce)");break;case"contrast-more":if(this.variantEnabled["contrast-more"])o.push("(prefers-contrast: more)");break;case"contrast-less":if(this.variantEnabled["contrast-less"])o.push("(prefers-contrast: less)");break;case"landscape":if(this.variantEnabled.landscape)o.push("(orientation: landscape)");break;case"portrait":if(this.variantEnabled.portrait)o.push("(orientation: portrait)");break;case"forced-colors":if(this.variantEnabled["forced-colors"])o.push("(forced-colors: active)");break}if(u.charCodeAt(0)===115&&u.startsWith("supports-")){if(this.variantEnabled.supports){let d=u.slice(9),h;if(d.charCodeAt(0)===91&&d.charCodeAt(d.length-1)===93){let m=d.slice(1,-1).replace(/_/g," "),p=m.indexOf(":");if(p!==-1){let g=m.slice(0,p).trim(),y=m.slice(p+1).trim();h=`@supports (${g}: ${y})`}else h=`@supports (${m})`}else h=`@supports (${d})`;s.push(h)}}}let a=[];if(o.length>0)o.sort((l,u)=>Number(l.charCodeAt(0)===40)-Number(u.charCodeAt(0)===40)),a.push(`@media ${o.join(" and ")}`);if(a.push(...s,...c),a.length>0){let l=a.join(ml);return this.mediaQueryCache.set(n,l),l}this.mediaQueryCache.set(n,"");return}escapeSelector(e){let t=!1;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(!(n>=97&&n<=122||n>=65&&n<=90||n>=48&&n<=57||n===45||n===95||n>127)){t=!0;break}}if(!t)return e;return e.replace(/[\x00-\x2C\x2E\x2F\x3A-\x40\x5B-\x5E\x60\x7B-\x7F]/g,"\\$&")}buildFontCSS(){let e=this.config.fonts;if(!e)return"";let t=[],r=e.google?.filter(Boolean)??[];if(r.length>0){let n=r.map((o)=>`family=${o.trim().replace(/\s+/g,"+")}`).join("&"),i=e.display??"swap";t.push(`@import url('https://fonts.googleapis.com/css2?${n}&display=${i}');`)}if(e.faces?.length)t.push(...e.faces.map((n)=>n.trim()).filter(Boolean));return t.join(`
|
|
367
367
|
`)}toCSS(e=!0,t=!1){if(this.cssCache!==null&&this.cssCacheRevision===this.revision&&this.cssCachePreflight===e&&this.cssCacheMinify===t)return this.cssCache;let r=[],n=this.buildFontCSS();if(n)r.push(t?n.replace(/\s*\n\s*/g,""):n);if(e)for(let a of this.config.preflights){let l=a.getCSS(),u=this.config.theme?.fontFamily?.sans;if(u&&Array.isArray(u)){let d=u.join(", ");l=l.replace(/font-family:\s*ui-sans-serif[^;]+;/g,`font-family: ${d};`)}let f=`@layer tc-base {
|
|
368
368
|
${l}
|
|
369
|
-
}`;r.push(t?
|
|
369
|
+
}`;r.push(t?gl(f):f)}if(this.config.cssVariables){let a=this.generateCSSVariables();if(a)r.push(t?a.replace(/\s+/g," ").trim():a)}let i=this.rules.get("base")||[];if(i.length>0)r.push(this.rulesToCSS(i,t));if(this.usedKeyframes.size>0)for(let a of this.usedKeyframes){let l=Jp[a];if(l)r.push(t?gl(l):l)}let o=[...this.rules.entries()].filter(([a,l])=>a!=="base"&&l.length>0),s=(a)=>{let l=a.match(/min-width:\s*([\d.]+)(px|rem|em)/);if(!l)return Number.MAX_SAFE_INTEGER;let u=Number.parseFloat(l[1]);return l[2]==="px"?u:u*16};o.sort((a,l)=>s(a[1][0].mediaQuery)-s(l[1][0].mediaQuery));for(let[,a]of o){let l=a[0].mediaQuery.split(ml),u=this.rulesToCSS(a,t);for(let f=l.length-1;f>=0;f--)u=t?`${l[f]}{${u}}`:`${l[f]} {
|
|
370
370
|
${u}
|
|
371
371
|
}`;r.push(u)}let c=t?r.join(""):r.join(`
|
|
372
372
|
|
|
373
|
-
`);return this.cssCache=c,this.cssCacheRevision=this.revision,this.cssCachePreflight=e,this.cssCacheMinify=t,c}getUtilityRank(e){let t=this.utilityRankCache.get(e);if(t!==void 0)return t;let r=
|
|
373
|
+
`);return this.cssCache=c,this.cssCacheRevision=this.revision,this.cssCachePreflight=e,this.cssCacheMinify=t,c}getUtilityRank(e){let t=this.utilityRankCache.get(e);if(t!==void 0)return t;let r=N0(e);return this.utilityRankCache.set(e,r),r}rulesToCSS(e,t){let r=e.length,n=Array.from({length:r}),i=Array.from({length:r});for(let c=0;c<r;c++)n[c]=this.getUtilityRank(e[c].selector),i[c]=c;i.sort((c,a)=>n[c]-n[a]||c-a);let o=new Map;for(let c=0;c<r;c++){let a=e[i[c]],l=o.get(a.selector);if(l===void 0)l=new Map,o.set(a.selector,l);let u=a.properties;for(let f in u)l.set(f,u[f])}let s=[];for(let[c,a]of o){let l="",u=!0;for(let[f,d]of a){if(t){if(!u)l+=";";l+=`${f}:${d}`}else{if(!u)l+=`
|
|
374
374
|
`;l+=` ${f}: ${d};`}u=!1}s.push(t?`${c}{${l}}`:`${c} {
|
|
375
375
|
${l}
|
|
376
376
|
}`)}return t?s.join(""):s.join(`
|
|
@@ -378,17 +378,17 @@ ${l}
|
|
|
378
378
|
`)}generateCSSVariables(){let e=this.extendColors;if(!e){let r=$r.theme.colors,n={};for(let[i,o]of Object.entries(this.config.theme.colors)){let s=r[i];if(typeof o==="string"){if(s!==o)n[i]=o}else if(o&&typeof o==="object")if(!s||typeof s!=="object")n[i]=o;else{let c={};for(let[a,l]of Object.entries(o))if(typeof l==="string"&&s[a]!==l)c[a]=l;if(Object.keys(c).length>0)n[i]=c}}e=n}if(!e||Object.keys(e).length===0)return null;let t=[];for(let[r,n]of Object.entries(e))if(typeof n==="string")t.push(` --${r}: ${n};`);else if(typeof n==="object"&&n!==null){for(let[i,o]of Object.entries(n))if(typeof o==="string")t.push(i==="DEFAULT"?` --${r}: ${o};`:` --${r}-${i}: ${o};`)}if(t.length===0)return null;return`:root {
|
|
379
379
|
${t.join(`
|
|
380
380
|
`)}
|
|
381
|
-
}`}reset(){this.revision++,this.rules.clear(),this.classCache.clear(),this.selectorCache.clear(),this.mediaQueryCache.clear(),this.noMatchCache.clear(),this.usedKeyframes.clear(),this.compiledGenerated.clear(),this.utilityRankCache.clear()}}var{Glob:
|
|
382
|
-
`,r=[];for(let i of this.vars)r.push(
|
|
381
|
+
}`}reset(){this.revision++,this.rules.clear(),this.classCache.clear(),this.selectorCache.clear(),this.mediaQueryCache.clear(),this.noMatchCache.clear(),this.usedKeyframes.clear(),this.compiledGenerated.clear(),this.utilityRankCache.clear()}}var{Glob:O0}=globalThis.Bun;var I0=32;class si{patterns;transformer;extractOptions;constructor(e,t=void 0,r=void 0){this.patterns=e;this.transformer=t;this.extractOptions=r}async scan(){let e=new Set,t=new Map,r=new Set,n=Array.from({length:this.patterns.length},()=>!1),i=[];await Promise.all(this.patterns.map(async(l,u)=>{try{let f=new O0(l);for await(let d of f.scan(".")){if(n[u]=!0,r.has(d))continue;r.add(d),i.push(d)}}catch{}}));let o=Math.min(i.length,I0),s=0;await Promise.all(Array.from({length:o},async()=>{while(s<i.length){let l=i[s++];try{let u=await Bun.file(l).text();if(this.transformer){let f=this.transformer.processFile(u);if(f.hasChanges)t.set(l,f.content),u=f.content}for(let f of jt(u,this.extractOptions))e.add(f)}catch{}}}));let a=this.patterns.filter((l,u)=>!n[u]);return{classes:e,transformedFiles:t,unmatchedPatterns:a}}async scanFile(e){try{let t=await Bun.file(e).text();return jt(t,this.extractOptions)}catch{return new Set}}scanContent(e){return jt(e,this.extractOptions)}}import{resolve as D0}from"path";var{Glob:j0}=globalThis.Bun;import{statSync as M0}from"fs";var El=new Map;function Al(e){let t=El.get(e);if(t!==void 0)return t;let r;if(e.startsWith("--"))r=e;else r=e.replace(/[A-Z]/g,(n)=>`-${n.toLowerCase()}`);return El.set(e,r),r}class Tl{rules=new Map;keyframes=new Map;vars=[];varKeys=new Set;insertionOrder=new Map;nextIndex=0;generation=0;addRule(e){if(this.rules.has(e.className))return;this.rules.set(e.className,e),this.insertionOrder.set(e.className,this.nextIndex++)}addKeyframes(e){if(!this.keyframes.has(e.name))this.keyframes.set(e.name,e)}addVars(e){let t=`${e.atRule??""}|${e.selector}|${Object.keys(e.declarations).join(",")}`;if(this.varKeys.has(t))return;this.varKeys.add(t),this.vars.push(e)}has(e){return this.rules.has(e)}get size(){return this.rules.size}clear(){this.rules.clear(),this.keyframes.clear(),this.vars=[],this.varKeys.clear(),this.insertionOrder.clear(),this.nextIndex=0,this.generation++}get currentGeneration(){return this.generation}toCSS(e=!1){let t=e?"":`
|
|
382
|
+
`,r=[];for(let i of this.vars)r.push(L0(i,e));for(let i of this.keyframes.values())r.push(i.css);let n=[...this.rules.values()].sort((i,o)=>{if(i.priority!==o.priority)return i.priority-o.priority;return(this.insertionOrder.get(i.className)??0)-(this.insertionOrder.get(o.className)??0)});for(let i of n)r.push(_0(i,e));return r.join(t)}}function P0(e,t){let r=Al(e.property),n=t?"":" ";return e.values.map((i)=>`${r}:${n}${i}`).join(t?";":"; ")}function _0(e,t){let r=e.conditions.filter((s)=>s.startsWith("@")),n=e.conditions.filter((s)=>!s.startsWith("@")),i=`.${e.className}`;for(let s of n)i=s.includes("&")?s.replace(/&/g,i):`${i}${s}`;let o=`${i}${t?"":" "}{${t?"":" "}${P0(e,t)}${t?"":" "}}`;return Nl(o,r,t)}function L0(e,t){let r=t?"":" ",n=Object.entries(e.declarations).map(([o,s])=>`${o}:${r}${s}`).join(t?";":"; "),i=`${e.selector}${t?"":" "}{${r}${n}${r}}`;return Nl(i,e.atRule?[e.atRule]:[],t)}function Nl(e,t,r){let n=e;for(let i=t.length-1;i>=0;i--)n=`${t[i]}${r?"":" "}{${r?"":" "}${n}${r?"":" "}}`;return n}var ai=new Tl;function Ol(e=!1){return ai.toCSS(e)}function Il(){ai.clear()}function Pl(){return ai.currentGeneration}async function _l(e){try{await import(`${e}?mtime=${F0(e)}&gen=${Pl()}`)}catch(t){throw Error(`Failed to evaluate style module ${e}: ${t.message}`,{cause:t})}}function F0(e){try{return M0(e).mtimeMs}catch{return 0}}async function Ll(e,t={}){let r=t.cwd??process.cwd(),n=new Set,i=Array.from({length:e.length},()=>!1);await Promise.all(e.map(async(s,c)=>{try{let a=new j0(s);for await(let l of a.scan(r))i[c]=!0,n.add(D0(r,l))}catch{}}));let o=[...n].sort();for(let s of o)await _l(s);return{css:Ol(t.minify??!1),modules:o,unmatchedPatterns:e.filter((s,c)=>!i[c])}}function B0(e){let t=0;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);t=(t<<5)-t+n,t=t&t}return Math.abs(t).toString(36)}function U0(e,t={}){let r=t.trigger||":tc:",n=new Map,i=/(?:class|className)=["']([^"']*)["']/g,o;while((o=i.exec(e))!==null){let s=o[1];if(s.trim().startsWith(r)){let c=s.replace(r,"").trim().split(/\s+/).filter(Boolean);if(c.length>0){let a=c.sort().join(" ");if(!n.has(a))n.set(a,c)}}}return n}function V0(e,t,r={}){let n=r.trigger||":tc:",i=e,o=/(?:class|className)=["']([^"']*)["']/g,s,c=[];while((s=o.exec(e))!==null){let a=s[1];if(a.trim().startsWith(n)){let u=a.replace(n,"").trim().split(/\s+/).filter(Boolean).sort().join(" "),f=t.get(u);if(f){let d=s[0].startsWith("class=")?"class":"className",h=s[0].includes('"')?'"':"'",m=`${d}=${h}${f}${h}`;c.push({start:s.index,end:s.index+s[0].length,replacement:m})}}}for(let a=c.length-1;a>=0;a--){let{start:l,end:u,replacement:f}=c[a];i=i.substring(0,l)+f+i.substring(u)}return i}function z0(e,t={}){let r=t.classPrefix||"tc-",n=t.hashFn||B0,i=new Map;for(let[o]of e){let s=n(o),c=`${r}${s}`;i.set(o,c)}return i}class li{compiledClasses=new Map;classNameMap=new Map;options;constructor(e={}){this.options={trigger:":tc:",classPrefix:"tc-",layer:"shortcuts",...e}}processFile(e){let t=U0(e,this.options);if(t.size===0)return{content:e,hasChanges:!1};let r=!1;for(let[i,o]of t)if(!this.compiledClasses.has(i))this.compiledClasses.set(i,o),r=!0;if(r||this.classNameMap.size!==this.compiledClasses.size)this.classNameMap=z0(this.compiledClasses,this.options);let n=V0(e,this.classNameMap,this.options);return{content:n,hasChanges:n!==e}}getCompiledClasses(){let e=new Map;for(let[t,r]of this.compiledClasses){let n=this.classNameMap.get(t);if(n)e.set(t,{className:n,utilities:r})}return e}generateCSS(e,t){let r=this.getCompiledClasses(),n="";for(let[,{className:i,utilities:o}]of r){for(let c of o)t.generate(c);let s=t.toCSS(!1);n+=`
|
|
383
383
|
/* Compiled class: ${i} */
|
|
384
384
|
`,n+=`/* Original utilities: ${o.join(" ")} */
|
|
385
|
-
`}return n}reset(){this.compiledClasses.clear(),this.classNameMap.clear()}getStats(){let e=0;for(let[,t]of this.compiledClasses)e+=t.length;return{totalGroups:this.compiledClasses.size,totalUtilities:e,averageUtilitiesPerGroup:this.compiledClasses.size>0?e/this.compiledClasses.size:0}}}async function ci(e){let t=performance.now(),r=e.compileClass?.enabled?new li({trigger:e.compileClass.trigger,classPrefix:e.compileClass.classPrefix,layer:e.compileClass.layer}):null,n=new si(e.content,r,{attributify:e.attributify,bracketSyntax:e.bracketSyntax,codeStrings:e.codeStrings}),{classes:i,transformedFiles:o,unmatchedPatterns:s}=await n.scan();for(let f of e.safelist)if(typeof f==="string")i.add(f);else console.warn(`\u26A0\uFE0F Ignoring non-string safelist entry (patterns are not supported): ${JSON.stringify(f)}`);let c=new oi(e);for(let f of i)c.generate(f);if(r){let f=r.getCompiledClasses();for(let[,{className:d,utilities:h}]of f)c.generateCompiledClass(d,h)}let a=c.toCSS(e.includePreflight!==!1,e.minify),l;if(e.styles&&e.styles.length>0){
|
|
386
|
-
`)+f.css;s.push(...f.unmatchedPatterns)}let u=performance.now()-t;return{css:a,classes:i,duration:u,compiledClasses:r?.getCompiledClasses(),transformedFiles:o,unmatchedPatterns:s,styleModules:l}}async function
|
|
385
|
+
`}return n}reset(){this.compiledClasses.clear(),this.classNameMap.clear()}getStats(){let e=0;for(let[,t]of this.compiledClasses)e+=t.length;return{totalGroups:this.compiledClasses.size,totalUtilities:e,averageUtilitiesPerGroup:this.compiledClasses.size>0?e/this.compiledClasses.size:0}}}async function ci(e){let t=performance.now(),r=e.compileClass?.enabled?new li({trigger:e.compileClass.trigger,classPrefix:e.compileClass.classPrefix,layer:e.compileClass.layer}):null,n=new si(e.content,r,{attributify:e.attributify,bracketSyntax:e.bracketSyntax,codeStrings:e.codeStrings}),{classes:i,transformedFiles:o,unmatchedPatterns:s}=await n.scan();for(let f of e.safelist)if(typeof f==="string")i.add(f);else console.warn(`\u26A0\uFE0F Ignoring non-string safelist entry (patterns are not supported): ${JSON.stringify(f)}`);let c=new oi(e);for(let f of i)c.generate(f);if(r){let f=r.getCompiledClasses();for(let[,{className:d,utilities:h}]of f)c.generateCompiledClass(d,h)}let a=c.toCSS(e.includePreflight!==!1,e.minify),l;if(e.styles&&e.styles.length>0){Il();let f=await Ll(e.styles,{minify:e.minify});if(l=f.modules,f.css)a+=(e.minify?"":`
|
|
386
|
+
`)+f.css;s.push(...f.unmatchedPatterns)}let u=performance.now()-t;return{css:a,classes:i,duration:u,compiledClasses:r?.getCompiledClasses(),transformedFiles:o,unmatchedPatterns:s,styleModules:l}}async function W0(e,t){await Bun.write(t,e)}async function K0(e){let t=Array.from(e.entries()).map(([r,n])=>Bun.write(r,n));await Promise.all(t)}async function Ml(e){let t=await ci(e);if(await W0(t.css,e.output),t.transformedFiles&&t.transformedFiles.size>0)await K0(t.transformedFiles);return t}var be=new Vr("cssx");async function _r(e){if(e){let t=ui(he.cwd(),e);if(!Me(t))console.error(`\u274C Config file not found: ${t}`),he.exit(1);try{let r=await import(t);return{...Yn,...r.default||r}}catch(r){console.error(`\u274C Failed to load config file: ${t}`),console.error(r),he.exit(1)}}return Os()}function J0(e){if(e)return ui(he.cwd(),e);for(let t of["css.config.ts","css.config.js","css.config.mjs"]){let r=ui(he.cwd(),t);if(Me(r))return r}return null}function fi(e,t){return{...e,output:t.output||e.output,minify:t.minify??e.minify,content:t.content?[t.content]:e.content,verbose:t.verbose??e.verbose,includePreflight:t.noPreflight===!0||t.preflight===!1?!1:e.includePreflight}}async function Pr(e,t){let r=t.verbose??e.verbose??!1;try{if(console.log(r?"\uD83D\uDE80 Building CSS (verbose mode)...":"\uD83D\uDE80 Building CSS..."),r)console.log(`\uD83D\uDCC2 Content patterns: ${e.content.join(", ")}`),console.log(`\uD83D\uDCDD Output: ${e.output}`),console.log(`\uD83D\uDDDC\uFE0F Minify: ${e.minify?"Yes":"No"}`);let i=await Ml(e);if(i.unmatchedPatterns&&i.unmatchedPatterns.length>0)for(let o of i.unmatchedPatterns)console.warn(`\u26A0\uFE0F Content pattern matched no files: ${o}`);if(console.log(`\u2705 Built ${i.classes.size} classes in ${i.duration.toFixed(2)}ms`),console.log(`\uD83D\uDCDD Output: ${e.output}`),i.compiledClasses&&i.compiledClasses.size>0){if(console.log(`\uD83D\uDD28 Compiled ${i.compiledClasses.size} class groups`),i.transformedFiles)console.log(`\uD83D\uDCDD Transformed ${i.transformedFiles.size} files`);if(r){console.log(`
|
|
387
387
|
\uD83D\uDCE6 Compiled classes:`);for(let[,{className:o,utilities:s}]of i.compiledClasses)console.log(` ${o} \u2190 ${s.join(" ")}`)}}if(r&&i.classes.size>0){let o=Array.from(i.classes).sort();console.log(`
|
|
388
|
-
\uD83D\uDCCB Classes found (${i.classes.size}):`),o.forEach((s)=>console.log(` - ${s}`))}if(Me(e.output)){let s=(Bun.file(e.output).size/1024).toFixed(2);console.log(`\uD83D\uDCE6 File size: ${s} KB`)}}catch(n){if(console.error("\u274C Build failed:",n),r&&n instanceof Error)console.error(n.stack);he.exit(1)}}function
|
|
389
|
-
\u2699\uFE0F ${n} changed, rebuilding with fresh config...`),await Pr(r.current,t)}catch(c){console.warn("\u26A0\uFE0F Failed to reload config:",c instanceof Error?c.message:c)}})}catch{}let i=new Set;for(let c of e.content){let a=c.search(/[*?[{]/),l=a===-1?c:c.slice(0,a);if(a!==-1||!Me(l)||!
|
|
390
|
-
\uD83D\uDCDD ${c} changed, rebuilding...`),await Pr(r.current,t)},50)};for(let c of i)try{
|
|
391
|
-
\uD83D\uDC40 Watching: ${Array.from(i).join(", ")}`)}be.command("build","Build CSS from content files").option("--output <path>","Output CSS file path").option("--minify","Minify CSS output").option("--watch","Watch for file changes").option("--content <pattern>","Content file pattern (can override config)").option("--config <path>","Path to config file").option("--verbose","Show detailed output").option("--no-preflight","Skip preflight CSS").example("cssx build").example("cssx build --output ./dist/styles.css").example("cssx build --minify --watch").example("cssx build --verbose").example("cssx build --config ./custom.config.ts").action(async(e)=>{let t=await _r(e.config),r=fi(t,e);if(await Pr(r,e),e.watch||r.watch)
|
|
388
|
+
\uD83D\uDCCB Classes found (${i.classes.size}):`),o.forEach((s)=>console.log(` - ${s}`))}if(Me(e.output)){let s=(Bun.file(e.output).size/1024).toFixed(2);console.log(`\uD83D\uDCE6 File size: ${s} KB`)}}catch(n){if(console.error("\u274C Build failed:",n),r&&n instanceof Error)console.error(n.stack);he.exit(1)}}function Dl(e,t){console.log("\uD83D\uDC40 Watching for changes...");let r={current:e},n=J0(t.config);if(n)try{Fl(n,async()=>{try{let c=await import(`${n}?t=${Date.now()}`);r.current=fi({...Yn,...c.default||c},t),console.log(`
|
|
389
|
+
\u2699\uFE0F ${n} changed, rebuilding with fresh config...`),await Pr(r.current,t)}catch(c){console.warn("\u26A0\uFE0F Failed to reload config:",c instanceof Error?c.message:c)}})}catch{}let i=new Set;for(let c of e.content){let a=c.search(/[*?[{]/),l=a===-1?c:c.slice(0,a);if(a!==-1||!Me(l)||!G0(l).isDirectory())l=l.slice(0,l.lastIndexOf("/")+1)||".";while(l!=="."&&l!=="/"&&!Me(l)){let u=q0(l);if(u===l)break;l=u}if(Me(l))i.add(l);else console.warn(`\u26A0\uFE0F Skipping watch for missing path: ${c}`)}let o=null,s=(c)=>{if(o)clearTimeout(o);o=setTimeout(async()=>{o=null,console.log(`
|
|
390
|
+
\uD83D\uDCDD ${c} changed, rebuilding...`),await Pr(r.current,t)},50)};for(let c of i)try{Fl(c,{recursive:!0},(a,l)=>{if(l&&/\.(?:html|js|ts|jsx|tsx|stx)$/.test(l))s(l)})}catch(a){console.warn(`\u26A0\uFE0F Could not watch ${c}:`,a instanceof Error?a.message:a)}console.log(`
|
|
391
|
+
\uD83D\uDC40 Watching: ${Array.from(i).join(", ")}`)}be.command("build","Build CSS from content files").option("--output <path>","Output CSS file path").option("--minify","Minify CSS output").option("--watch","Watch for file changes").option("--content <pattern>","Content file pattern (can override config)").option("--config <path>","Path to config file").option("--verbose","Show detailed output").option("--no-preflight","Skip preflight CSS").example("cssx build").example("cssx build --output ./dist/styles.css").example("cssx build --minify --watch").example("cssx build --verbose").example("cssx build --config ./custom.config.ts").action(async(e)=>{let t=await _r(e.config),r=fi(t,e);if(await Pr(r,e),e.watch||r.watch)Dl(r,e)});be.command("watch","Build and watch for changes").option("--output <path>","Output CSS file path").option("--minify","Minify CSS output").option("--content <pattern>","Content file pattern").option("--config <path>","Path to config file").option("--verbose","Show detailed output").example("cssx watch").example("cssx watch --output ./dist/styles.css").example("cssx watch --verbose").action(async(e)=>{let t=await _r(e.config),r=fi(t,e);await Pr(r,e),Dl(r,e)});be.command("init","Create a css.config.ts file").option("--force","Overwrite existing config file").example("cssx init").example("cssx init --force").action(async(e)=>{if(Me("./css.config.ts")&&!e.force)console.error("\u274C Config file already exists. Use --force to overwrite."),he.exit(1);let r=`import type { CssOptions } from '@ts-css/core'
|
|
392
392
|
|
|
393
393
|
const config = {
|
|
394
394
|
content: ['./src/**/*.{html,js,ts,jsx,tsx,stx}'],
|
|
@@ -400,6 +400,6 @@ const config = {
|
|
|
400
400
|
export default config
|
|
401
401
|
`;try{await Bun.write("./css.config.ts",r),console.log("\u2705 Created css.config.ts"),console.log(`
|
|
402
402
|
Next steps:`),console.log(" 1. Update the content paths in css.config.ts"),console.log(" 2. Run: cssx build")}catch(n){console.error("\u274C Failed to create config file:",n),he.exit(1)}});be.command("analyze","Analyze utility class usage").option("--config <path>","Path to config file").option("--verbose","Show detailed output").option("--json","Output as JSON").option("--top <n>","Show top N most used classes",{default:10}).example("cssx analyze").example("cssx analyze --top 20").example("cssx analyze --json").action(async(e)=>{try{let t=await _r(e.config);if(!e.json)console.log(`\uD83D\uDD0D Analyzing utility classes...
|
|
403
|
-
`);let r=await ci(t),n=new Map;for(let c of r.classes)n.set(c,0);for(let c of t.content){let a=new
|
|
403
|
+
`);let r=await ci(t),n=new Map;for(let c of r.classes)n.set(c,0);for(let c of t.content){let a=new Y0(c);for await(let l of a.scan(".")){let u;try{u=await Bun.file(l).text()}catch{continue}for(let f of r.classes){let d=u.indexOf(f);while(d!==-1)n.set(f,n.get(f)+1),d=u.indexOf(f,d+f.length)}}}let i=(c)=>{let a=c,l=a.indexOf("["),u=a.lastIndexOf(":",l===-1?a.length:l);if(u!==-1)a=a.slice(u+1);if(a.startsWith("!"))a=a.slice(1);if(a.endsWith("!"))a=a.slice(0,-1);if(a.startsWith("-"))a=a.slice(1);if(a.startsWith("["))return"arbitrary";return a.split("-")[0]||"other"},o=new Map;for(let c of r.classes){let a=i(c);if(!o.has(a))o.set(a,[]);o.get(a).push(c)}let s={totalClasses:r.classes.size,buildTime:r.duration,outputSize:Buffer.byteLength(r.css),utilityGroups:Object.fromEntries(Array.from(o.entries()).map(([c,a])=>[c,a.length]).sort((c,a)=>a[1]-c[1])),topClasses:[...n.entries()].sort((c,a)=>a[1]-c[1]).slice(0,e.top||10).map(([c,a])=>({class:c,count:a}))};if(e.json)console.log(JSON.stringify(s,null,2));else{console.log(`\uD83D\uDCCA Total classes: ${s.totalClasses}`),console.log(`\u23F1\uFE0F Build time: ${s.buildTime.toFixed(2)}ms`),console.log(`\uD83D\uDCE6 Output size: ${(s.outputSize/1024).toFixed(2)} KB
|
|
404
404
|
`),console.log(`\uD83C\uDFF7\uFE0F Utility groups (top ${e.top}):`);let c=Object.entries(s.utilityGroups).slice(0,e.top||10);for(let[a,l]of c)console.log(` ${a.padEnd(20)} ${l} classes`);if(e.verbose){console.log(`
|
|
405
|
-
\uD83D\uDCCB All classes:`);for(let a of Array.from(r.classes).sort())console.log(` - ${a}`)}}}catch(t){console.error("\u274C Analysis failed:",t),he.exit(1)}});be.command("clean","Remove the output CSS file").option("--config <path>","Path to config file").option("--output <path>","Output CSS file path (defaults to the config output)").example("cssx clean").action(async(e)=>{try{let t=await _r(e.config);if(e.output)t.output=e.output;if(!Me(t.output)){console.log("\u2139\uFE0F Output file does not exist");return}await
|
|
405
|
+
\uD83D\uDCCB All classes:`);for(let a of Array.from(r.classes).sort())console.log(` - ${a}`)}}}catch(t){console.error("\u274C Analysis failed:",t),he.exit(1)}});be.command("clean","Remove the output CSS file").option("--config <path>","Path to config file").option("--output <path>","Output CSS file path (defaults to the config output)").example("cssx clean").action(async(e)=>{try{let t=await _r(e.config);if(e.output)t.output=e.output;if(!Me(t.output)){console.log("\u2139\uFE0F Output file does not exist");return}await H0(t.output),console.log(`\u2705 Removed ${t.output}`)}catch(t){console.error("\u274C Failed to remove output file:",t),he.exit(1)}});be.command("preflight","Generate preflight CSS only").option("--output <path>","Output CSS file path",{default:"./preflight.css"}).example("cssx preflight").example("cssx preflight --output ./reset.css").action(async(e)=>{try{let t=e.output||"./preflight.css",r=Bt.getCSS();await Bun.write(t,r),console.log("\u2705 Generated preflight CSS"),console.log(`\uD83D\uDCDD Output: ${t}`);let i=(Bun.file(t).size/1024).toFixed(2);console.log(`\uD83D\uDCE6 File size: ${i} KB`)}catch(t){console.error("\u274C Failed to generate preflight CSS:",t),he.exit(1)}});be.command("version","Show the version of Crosswind").action(()=>{console.log(zr)});be.version(zr);be.help();be.parse();
|