@stacksjs/ts-css 0.3.1 → 0.3.3

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/cssx.js CHANGED
@@ -1,35 +1,35 @@
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{existsSync as Dl}from"fs";import Lr from"fs/promises";import di from"os";import Mr from"path";import Fe from"process";import{EventEmitter as jl}from"events";import Ae from"process";import hi from"process";import jr from"process";import Et from"process";import ht from"process";import yi from"tty";import Ec,{stdin as gb,stdout as mb}from"process";class bi{configPath;config=null;events=[];retryCount=0;maxRetries=3;retryDelayMs=1000;constructor(){let e=di.homedir(),t=Mr.join(e,".config","clapp");this.configPath=Mr.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:di.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(Dl(this.configPath)){let e=await Lr.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=Mr.dirname(this.configPath);await Lr.mkdir(t,{recursive:!0}),await Lr.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 tb=new bi;function Dr(e){return e.replace(/[<[].+/,"").trim()}function Bl(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 Ul(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 gi(e){return e.reduce((t,r)=>t.length>=r.length?t:r,"")}function Fr(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 Vl(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 zl(e,t){for(let r of Object.keys(t)){let n=t[r];if(n.shouldTransform){if(e[r]=Array.prototype.concat.call([],e[r]),typeof n.transformFunction==="function")e[r]=e[r].map(n.transformFunction)}}}function Wl(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}
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
4
 
5
5
  Stack trace:
6
- ${this.stack}`;return this.message}}function Kl(e){if(e instanceof mt)return!0;return!!e&&typeof e==="object"&&e.name==="ClappError"&&typeof e.message==="string"}function Gl(){let{env:e}=hi,{TERM:t,TERM_PROGRAM:r}=e;if(hi.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 mi={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 ob={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?mi.up():"");if(e)t+=mi.left;return t}},sb={screen:`${At}c`};function Hl(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 xi(e,t,r=2,n=3){return t.map((i)=>({cmd:i,distance:Hl(e,i)})).filter(({distance:i})=>i<=r).sort((i,o)=>i.distance-o.distance).slice(0,n).map(({cmd:i})=>i)}function ql(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 vi{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 lb=jr.argv,Yl=`${jr.platform}-${jr.arch} bun-v${typeof Bun<"u"?Bun.version:"unknown"}`,pi=Et.argv,Jl=`${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=Bl(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 vi(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=gi(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)=>` ${Fr(m.rawName,l.length)} ${m.description}`).join(`
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
7
  `);let h=Array.from(u.keys()).sort();for(let m of h){let p=u.get(m);if(d.length>0)d+=`
8
8
 
9
9
  `;d+=` ${m}:
10
- `,d+=p.map((g)=>` ${Fr(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=gi(a.map((u)=>u.rawName));o.push({title:"Options",body:a.map((u)=>` ${Fr(u.rawName,l.length)} ${u.description} ${u.config.default===void 0?"":`(default: ${u.config.default})`}`).join(`
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
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
13
  `)});if(i)o=i(o)||o;console.log(o.map((l)=>l.title?`${l.title}:
14
14
  ${l.body}`:l.body).join(`
15
15
 
16
- `))}outputVersion(){let{name:e}=this.cli,{versionNumber:t}=this.cli.globalCommand;if(t)console.log(`${e}/${t} ${typeof Bun<"u"?Yl:Jl}`)}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}
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
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=xi(o,i),a=`Unknown option \`${s}\``;if(c.length>0)a+=`
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
19
 
20
20
  Did you mean one of these?`,c.forEach((l)=>{let u=l.length>1?`--${l}`:`-${l}`;a+=`
21
21
  \u2022 ${u}`});throw a+=`
22
22
 
23
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
24
 
25
- Example: ${this.cli.name} ${this.rawName} ${n.rawName} <value>`,this.usageLine)}}}}class Ur extends Br{constructor(e){super("@@global@@","",{},e)}}var Xl=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 Zl(){return!0}function Ql(){let e={};e.supportsColor=Zl();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=Ql();class Vr extends jl{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(`
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
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 Xl(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(`
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
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=xi(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=pi,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]?Wl(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=Ul(r),i=[],o=e.indexOf("--");if(o>-1)i=e.slice(o+1),e=e.slice(0,o);let s=ql(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(".");Vl(l,h,c[d]),zl(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=pi){return this.parse(e,{run:!0,exitOnError:!0})}handleUsageError(e){if(!Kl(e)||e.isUsageError===!1)return;let t=e.message||"command-line error",r=this.name?`${this.name}: `:"",n=/--help/.test(t)?"":e.usage?`
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
30
  Usage: ${e.usage}`:`
31
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 wi{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 ub=new wi;function ec(){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 yi.isatty(1)&&yi.isatty(2)}var Ci=ec();function F(e,t){if(!Ci)return(r)=>r;return(r)=>e+r+t}var tc=F("\x1B[0m","\x1B[0m"),rc=F("\x1B[31m","\x1B[39m"),nc=F("\x1B[32m","\x1B[39m"),ic=F("\x1B[33m","\x1B[39m"),oc=F("\x1B[34m","\x1B[39m"),sc=F("\x1B[35m","\x1B[39m"),ac=F("\x1B[36m","\x1B[39m"),lc=F("\x1B[37m","\x1B[39m"),cc=F("\x1B[90m","\x1B[39m"),uc=F("\x1B[1m","\x1B[22m"),fc=F("\x1B[3m","\x1B[23m"),dc=F("\x1B[4m","\x1B[24m"),hc=F("\x1B[2m","\x1B[22m"),gc=F("\x1B[7m","\x1B[27m"),mc=F("\x1B[8m","\x1B[28m"),pc=F("\x1B[9m","\x1B[29m"),yc=F("\x1B[41m","\x1B[49m"),bc=F("\x1B[42m","\x1B[49m"),xc=F("\x1B[43m","\x1B[49m"),vc=F("\x1B[44m","\x1B[49m"),wc=F("\x1B[45m","\x1B[49m"),Cc=F("\x1B[46m","\x1B[49m"),$c=F("\x1B[47m","\x1B[49m"),Rc=Ci,kc={reset:tc,red:rc,green:nc,yellow:ic,blue:oc,magenta:sc,cyan:ac,white:lc,gray:cc,bold:uc,italic:fc,underline:dc,dim:hc,inverse:gc,hidden:mc,strikethrough:pc,bgRed:yc,bgGreen:bc,bgYellow:xc,bgBlue:vc,bgMagenta:wc,bgCyan:Cc,bgWhite:$c,isColorSupported:Rc},Sc=kc,Ac=["up","down","left","right","space","enter","cancel"],pb={actions:new Set(Ac),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"}};var yb=Ec.platform.startsWith("win"),bb=Symbol("clapp:cancel");var Tc=Gl();var L=(e,t)=>Tc?e:t,xb=L("\u25C6","*"),vb=L("\u25A0","x"),wb=L("\u25B2","x"),Cb=L("\u25C7","o"),$b=L("\u250C","T"),Nc=L("\u2502","|"),Rb=L("\u2514","\u2014"),kb=L("\u25CF",">"),Sb=L("\u25CB"," "),Eb=L("\u25FB","[\u2022]"),Ab=L("\u25FC","[+]"),Tb=L("\u25FB","[ ]"),Nb=L("\u25AA","\u2022"),Ob=L("\u2500","-"),Ib=L("\u256E","+"),Pb=L("\u251C","+"),_b=L("\u256F","+"),Lb=L("\u25CF","\u2022"),Mb=L("\u25C6","*"),Fb=L("\u25B2","!"),Db=L("\u25A0","x");var jb={light:L("\u2500","-"),heavy:L("\u2501","="),block:L("\u2588","#")};function Oc(){return`${Sc.gray(Nc)} `}var Bb=Oc();var zr="0.3.1";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===`
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.3";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
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(`
34
34
  `);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
35
  `;if(c)a+=`${c}
@@ -388,14 +388,14 @@ ${t.join(`
388
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 Fl(e,t){console.log("\uD83D\uDC40 Watching for changes...");let r={current:e},n=q0(t.config);if(n)try{Ml(n,async()=>{try{let c=await import(`${n}?t=${Date.now()}`);r.current=fi({...Yn,...c.default||c},t),console.log(`
389
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)||!W0(l).isDirectory())l=l.slice(0,l.lastIndexOf("/")+1)||".";while(l!=="."&&l!=="/"&&!Me(l)){let u=G0(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
390
  \uD83D\uDCDD ${c} changed, rebuilding...`),await Pr(r.current,t)},50)};for(let c of i)try{Ml(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)Fl(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),Fl(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 { TsCssOptions } from '@ts-css/core'
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)Fl(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),Fl(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}'],
395
395
  output: './dist/styles.css',
396
396
  minify: false,
397
397
  watch: false,
398
- } satisfies TsCssOptions
398
+ } satisfies CssOptions
399
399
 
400
400
  export default config
401
401
  `;try{await Bun.write("./css.config.ts",r),console.log("\u2705 Created css.config.ts"),console.log(`