@stacksjs/ts-css 0.3.24 → 0.3.26

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,23 +1,23 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- var Ac=(e,t,r)=>()=>{if(e)try{t=e(e=0)}catch(n){r=[n]}if(r)throw r[0];return t};import{existsSync as Oo,statSync as Io}from"fs";import{resolve as Et}from"path";import Nf from"process";import{existsSync as Pf,mkdirSync as Fw,readdirSync as jw,readFileSync as _f,writeFileSync as Dw}from"fs";import{homedir as tt}from"os";import{dirname as Vw,resolve as ve}from"path";import Nr from"process";import{existsSync as Po,statSync as _o}from"fs";import{existsSync as Gn,mkdirSync as Lf,readdirSync as Mf,writeFileSync as Ff}from"fs";import{homedir as rt}from"os";import{dirname as Lo,resolve as ne}from"path";import He from"process";import{join as jf,relative as Df,resolve as Mo}from"path";import yr from"process";import{existsSync as $s,mkdirSync as Zw,readdirSync as Qw,writeFileSync as e1}from"fs";import{homedir as An}from"os";import{dirname as n1,resolve as re}from"path";import Nt from"process";import{join as Bf,relative as Uf,resolve as Fo}from"path";import br from"process";import{existsSync as Cs,mkdirSync as l1,readdirSync as c1,writeFileSync as u1}from"fs";import{dirname as d1,resolve as xr}from"path";import Hn from"process";import{Buffer as Me}from"buffer";import{createCipheriv as Vf,createDecipheriv as Wf,randomBytes as En}from"crypto";import{closeSync as Tn,createReadStream as jo,createWriteStream as zf,existsSync as Nn,fsyncSync as Do,openSync as Bo,writeFileSync as Kf}from"fs";import{access as Gf,constants as Uo,mkdir as Hf,readdir as Zt,rename as Vo,stat as nt,unlink as Qt,writeFile as On}from"fs/promises";import{join as it}from"path";import J from"process";import{pipeline as qf}from"stream/promises";import{createGzip as Wo}from"zlib";import ot from"process";import Ae from"process";import{Buffer as ke}from"buffer";import{createCipheriv as Yf,createDecipheriv as Jf,randomBytes as In}from"crypto";import{closeSync as Pn,createReadStream as zo,createWriteStream as Xf,existsSync as er,fsyncSync as Ko,openSync as Go,writeFileSync as Zf}from"fs";import{access as Qf,constants as Ho,mkdir as ed,readdir as tr,rename as qo,stat as st,unlink as rr,writeFile as _n}from"fs/promises";import{isAbsolute as td,join as at,resolve as rd}from"path";import N from"process";import{pipeline as nd}from"stream/promises";import{createGzip as Yo}from"zlib";import lt from"process";import Ee from"process";import nr from"process";import{existsSync as ir}from"fs";import{resolve as Ln}from"path";import{existsSync as id}from"fs";import{existsSync as od,readdirSync as sd}from"fs";import{extname as Mn,resolve as Jo}from"path";import ad from"process";import{join as ld,relative as cd,resolve as Xo}from"path";import vr from"process";import{Buffer as Se}from"buffer";import{createCipheriv as ud,createDecipheriv as fd,randomBytes as Fn}from"crypto";import{closeSync as jn,createReadStream as Zo,createWriteStream as dd,existsSync as or,fsyncSync as Qo,openSync as es,writeFileSync as hd}from"fs";import{access as gd,constants as ts,mkdir as md,readdir as sr,rename as rs,stat as ct,unlink as ar,writeFile as Dn}from"fs/promises";import{isAbsolute as pd,join as ut,resolve as yd}from"path";import O from"process";import{pipeline as bd}from"stream/promises";import{createGzip as ns}from"zlib";import ft from"process";import Te from"process";import cr from"process";import{existsSync as ur}from"fs";import{resolve as ys}from"path";import{existsSync as jh}from"fs";class bs{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 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=Oo(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 xs{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 ws(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 Of(e){return ws(e).flatMap((r)=>vs.map((n)=>Et(e.directory,`${r}${n}`)))}function If(e={}){let t=Et(e.cwd||Nf.cwd());return Array.from(new Set([t,Et(t,"config"),Et(t,".config"),e.configDir?Et(t,e.configDir):void 0].filter((r)=>Boolean(r))))}function wd(e,t){this[e]=vd.bind(null,t)}class oi{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(!Po(e))return!0;return _o(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=Po(r)?_o(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 si{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 Rd(e,t={}){let n=Object.keys(t).sort().map((i)=>`${i}:${t[i]}`).join("|");return n?`${e}:${n}`:e}function kd(e,t){try{return JSON.stringify(e)===JSON.stringify(t)}catch{return e===t}}function Sd(e){return e.getStats().size*2}function ai(e,t){if(Array.isArray(t)&&Array.isArray(e)&&t.length===2&&e.length===2&&L(t[0])&&"id"in t[0]&&t[0].id===3&&L(t[1])&&"id"in t[1]&&t[1].id===4)return t;if(L(t)&&L(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(L(e)&&"arr"in e&&Array.isArray(e.arr)&&L(t)&&"arr"in t&&Array.isArray(t.arr))return t;if(t.length>0&&e.length>0&&L(t[0])&&L(e[0])){let n=[...t];for(let i of e)if(L(i)&&"name"in i){if(!n.find((s)=>L(s)&&("name"in s)&&s.name===i.name))n.push(i)}else if(L(i)&&"path"in i){if(!n.find((s)=>L(s)&&("path"in s)&&s.path===i.path))n.push(i)}else if(!n.some((o)=>wr(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(!L(t)||!L(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(L(i)&&L(r[n]))r[n]=ai(r[n],i);else if(Array.isArray(i)&&Array.isArray(r[n]))if(i.length>0&&r[n].length>0&&L(i[0])&&L(r[n][0])){let o=[...i];for(let s of r[n])if(L(s)&&"name"in s){if(!o.find((a)=>L(a)&&("name"in a)&&a.name===s.name))o.push(s)}else if(L(s)&&"path"in s){if(!o.find((a)=>L(a)&&("path"in a)&&a.path===s.path))o.push(s)}else if(!o.some((l)=>wr(l,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 wr(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(!wr(e[r],t[r]))return!1;return!0}if(L(e)&&L(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(!wr(e[i],t[i]))return!1}return!0}return!1}function L(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}async function Ad(e,t){if(!Cs(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 ai(t,n)}catch{return null}}catch{return null}}async function Ed({name:e="",cwd:t,defaultConfig:r}){let n=t||Hn.cwd(),i=[".ts",".js",".mjs",".cjs",".json"],o=[`${e}.config`,`.${e}.config`,e,`.${e}`];for(let s of o)for(let l of i){let a=xr(n,`${s}${l}`),c=await Ad(a,r);if(c!==null)return c}try{let s=xr(n,"package.json");if(Cs(s)){let a=(await import(s))[e];if(a&&typeof a==="object"&&!Array.isArray(a))try{return ai(r,a)}catch{}}}catch{}return r}function Td(e,t={}){let r=br.cwd();while(r.includes("storage"))r=Fo(r,"..");let n=Fo(r,e||"");if(t?.relative)return Uf(br.cwd(),n);return n}async function Nd(){try{let e=await Ed({name:"clarity",defaultConfig:dr,cwd:br.cwd(),endpoint:"",headers:{}});return{...dr,...e}}catch{return dr}}function D(){if(Ae.env.NODE_ENV==="test"||Ae.env.BUN_ENV==="test")return!1;return typeof window<"u"}async function Od(){if(Ae.env.NODE_ENV==="test"||Ae.env.BUN_ENV==="test")return!0;if(typeof navigator<"u"&&navigator.product==="ReactNative")return!0;if(typeof Ae<"u"){let e=Ae.type;if(e==="renderer"||e==="worker")return!1;return!!(Ae.versions&&(Ae.versions.node||Ae.versions.bun))}return!1}class ks{async format(e){let t=await Od(),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:ot.pid,hostname:t(),environment:ot.env.NODE_ENV||"development",platform:ot.platform,version:ot.version}}return{userAgent:navigator.userAgent,hostname:window.location.hostname||"browser",environment:ot.env.NODE_ENV||ot.env.BUN_ENV||"development",viewport:{width:window.innerWidth,height:window.innerHeight},language:navigator.language}}}class $r{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={...Yn},this.options=this.normalizeOptions(t),this.formatter=this.options.formatter||new ks,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??J.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{...hr,...e.fingersCrossed};if(!e.fingersCrossedEnabled)return null;if(!e.fingersCrossed)return{...hr};return{...hr,...e.fingersCrossed}}normalizeOptions(e){let t={format:"json",level:"info",logDirectory:Yn.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,l=1000;while(o<s)try{try{try{await Gf(this.config.logDirectory,Uo.F_OK|Uo.W_OK)}catch(c){if(c instanceof Error&&"code"in c)if(c.code==="ENOENT")await Hf(this.config.logDirectory,{recursive:!0,mode:493});else if(c.code==="EACCES")throw Error(`No write permission for log directory: ${this.config.logDirectory}`);else throw c;else throw c}}catch(c){throw console.error("Debug: [writeToFile] Failed to create log directory:",c),c}let a=this.validateEncryptionConfig()?(await this.encrypt(e)).encrypted:Me.from(e);try{if(!Nn(this.currentLogFile))await On(this.currentLogFile,"",{mode:420});if(i=Bo(this.currentLogFile,"a",420),Kf(i,a,{flag:"a"}),Do(i),i!==void 0)Tn(i),i=void 0;if((await nt(this.currentLogFile)).size===0){if(await On(this.currentLogFile,a,{flag:"w",mode:420}),(await nt(this.currentLogFile)).size===0)throw Error("File exists but is empty after retry write")}return}catch(c){let u=c;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=l*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{Tn(i)}catch(c){console.error("Debug: [writeToFile] Error closing file descriptor:",c)}}}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 c=l*2**(o-1);await new Promise((u)=>setTimeout(u,c))}})();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 it(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 it(this.config.logDirectory,`${this.name}.log`);let e=new Date().toISOString().split("T")[0];return it(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(([,l],[,a])=>a.createdAt.getTime()-l.createdAt.getTime()),o=typeof t.maxKeys==="number"?t.maxKeys:1,s=Math.max(1,o);if(i.length>s)for(let[l]of i.slice(s))this.encryptionKeys.delete(l),this.keys.delete(l)}generateKeyId(){return En(16).toString("hex")}generateKey(){return En(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=En(16),n=Vf("aes-256-gcm",t,r),i=Me.concat([n.update(e,"utf8"),n.final()]),o=n.getAuthTag();return{encrypted:Me.concat([r,i,o]),iv:r}}async compressData(e){return new Promise((t,r)=>{let n=Wo(),i=[];n.on("data",(o)=>i.push(o)),n.on("end",()=>t(Me.from(Me.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 nt(this.currentLogFile).catch(()=>null);if(!e)return;let t=this.config.rotation;if(typeof t==="boolean")return;if(t.maxSize&&e.size>=t.maxSize){let r=this.currentLogFile,n=this.generateLogFilename();if(this.name.includes("rotation-load-test")||this.name==="failed-rotation-test"){let i=await Zt(this.config.logDirectory),o=i.filter((a)=>a.startsWith(this.name)&&/\.log\.\d+$/.test(a)).sort((a,c)=>{let u=Number.parseInt(a.match(/\.log\.(\d+)$/)?.[1]||"0");return Number.parseInt(c.match(/\.log\.(\d+)$/)?.[1]||"0")-u}),s=o.length>0?Number.parseInt(o[0].match(/\.log\.(\d+)$/)?.[1]||"0")+1:1,l=`${r}.${s}`;if(await nt(r).catch(()=>null))try{if(await Vo(r,l),t.compress)try{let a=`${l}.gz`;await this.compressLogFile(l,a),await Qt(l)}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 On(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 nt(r).catch(()=>null))await Vo(r,o)}if(this.currentLogFile=n,t.maxFiles){let o=(await Zt(this.config.logDirectory)).filter((s)=>s.startsWith(this.name)).sort((s,l)=>l.localeCompare(s));for(let s of o.slice(t.maxFiles))await Qt(it(this.config.logDirectory,s))}}}async compressLogFile(e,t){let r=jo(e),n=zf(t),i=Wo();await qf(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()})),Nn(this.currentLogFile))try{let e=Bo(this.currentLogFile,"r+");Do(e),Tn(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 Zt(this.config.logDirectory)).filter((r)=>(r.includes("temp")||r.includes(".tmp"))&&r.includes(this.name));for(let r of t)try{await Qt(it(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,l=(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=J.stdout.columns||120,c="";if(o==="warning"||o==="error")c=`${r} ${i}`;else if(o==="info"||o==="success")c=`${r} ${n} ${i}`;else c=`${r} ${n} ${P.cyan(i)}`;if(!s)return c.trim();let u=l(c).trim().length,f=l(t).length,d=Math.max(1,a-2-u-f);return`${c.trim()}${" ".repeat(d)}${t}`}formatMessage(e,t){if(t.length===1&&Array.isArray(t[0]))return e.replace(/\{(\d+)\}/g,(o,s)=>{let l=Number.parseInt(s,10);return l<t[0].length?String(t[0][l]):o});let r=/%([sdijfo%])/g,n=0,i=e.replace(r,(o,s)=>{if(s==="%")return"%";if(n>=t.length)return o;let l=t[n++];switch(s){case"s":return String(l);case"d":case"i":return Number(l).toString();case"j":case"o":return JSON.stringify(l,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,l;if(t instanceof Error)s=t.message,l=t.stack;else s=this.formatMessage(t,r);if(this.fancy&&!D()){let c=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:c,tag:u,message:P.gray(s),level:e}),console.error(f);break;case"info":f=this.formatConsoleMessage({timestamp:i,icon:c,tag:u,message:s,level:e}),console.error(f);break;case"success":f=this.formatConsoleMessage({timestamp:i,icon:c,tag:u,message:P.green(s),level:e}),console.error(f);break;case"warning":f=this.formatConsoleMessage({timestamp:i,icon:c,tag:u,message:s,level:e}),console.warn(f);break;case"error":if(f=this.formatConsoleMessage({timestamp:i,icon:c,tag:u,message:s,level:e}),console.error(f),l){let d=l.split(`
3
+ var Ec=(e,t,r)=>()=>{if(e)try{t=e(e=0)}catch(n){r=[n]}if(r)throw r[0];return t};import{existsSync as Oo,statSync as Io}from"fs";import{resolve as Et}from"path";import Of from"process";import{existsSync as _f,mkdirSync as jw,readdirSync as Dw,readFileSync as Lf,writeFileSync as Bw}from"fs";import{homedir as tt}from"os";import{dirname as Ww,resolve as ve}from"path";import Nr from"process";import{existsSync as Po,statSync as _o}from"fs";import{existsSync as Gn,mkdirSync as Mf,readdirSync as Ff,writeFileSync as jf}from"fs";import{homedir as rt}from"os";import{dirname as Lo,resolve as ne}from"path";import He from"process";import{join as Df,relative as Bf,resolve as Mo}from"path";import yr from"process";import{existsSync as $s,mkdirSync as Qw,readdirSync as e1,writeFileSync as t1}from"fs";import{homedir as An}from"os";import{dirname as i1,resolve as re}from"path";import Nt from"process";import{join as Uf,relative as Vf,resolve as Fo}from"path";import br from"process";import{existsSync as Cs,mkdirSync as c1,readdirSync as u1,writeFileSync as f1}from"fs";import{dirname as h1,resolve as xr}from"path";import Hn from"process";import{Buffer as Me}from"buffer";import{createCipheriv as Wf,createDecipheriv as zf,randomBytes as En}from"crypto";import{closeSync as Tn,createReadStream as jo,createWriteStream as Kf,existsSync as Nn,fsyncSync as Do,openSync as Bo,writeFileSync as Gf}from"fs";import{access as Hf,constants as Uo,mkdir as qf,readdir as Zt,rename as Vo,stat as nt,unlink as Qt,writeFile as On}from"fs/promises";import{join as it}from"path";import J from"process";import{pipeline as Yf}from"stream/promises";import{createGzip as Wo}from"zlib";import ot from"process";import Ae from"process";import{Buffer as ke}from"buffer";import{createCipheriv as Jf,createDecipheriv as Xf,randomBytes as In}from"crypto";import{closeSync as Pn,createReadStream as zo,createWriteStream as Zf,existsSync as er,fsyncSync as Ko,openSync as Go,writeFileSync as Qf}from"fs";import{access as ed,constants as Ho,mkdir as td,readdir as tr,rename as qo,stat as st,unlink as rr,writeFile as _n}from"fs/promises";import{isAbsolute as rd,join as at,resolve as nd}from"path";import N from"process";import{pipeline as id}from"stream/promises";import{createGzip as Yo}from"zlib";import lt from"process";import Ee from"process";import nr from"process";import{existsSync as ir}from"fs";import{resolve as Ln}from"path";import{existsSync as od}from"fs";import{existsSync as sd,readdirSync as ad}from"fs";import{extname as Mn,resolve as Jo}from"path";import ld from"process";import{join as cd,relative as ud,resolve as Xo}from"path";import vr from"process";import{Buffer as Se}from"buffer";import{createCipheriv as fd,createDecipheriv as dd,randomBytes as Fn}from"crypto";import{closeSync as jn,createReadStream as Zo,createWriteStream as hd,existsSync as or,fsyncSync as Qo,openSync as es,writeFileSync as gd}from"fs";import{access as md,constants as ts,mkdir as pd,readdir as sr,rename as rs,stat as ct,unlink as ar,writeFile as Dn}from"fs/promises";import{isAbsolute as yd,join as ut,resolve as bd}from"path";import O from"process";import{pipeline as xd}from"stream/promises";import{createGzip as ns}from"zlib";import ft from"process";import Te from"process";import cr from"process";import{existsSync as ur}from"fs";import{resolve as ys}from"path";import{existsSync as Dh}from"fs";class bs{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 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=Oo(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 xs{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 ws(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 If(e){return ws(e).flatMap((r)=>vs.map((n)=>Et(e.directory,`${r}${n}`)))}function Pf(e={}){let t=Et(e.cwd||Of.cwd());return Array.from(new Set([t,Et(t,"config"),Et(t,".config"),e.configDir?Et(t,e.configDir):void 0].filter((r)=>Boolean(r))))}function $d(e,t){this[e]=wd.bind(null,t)}class oi{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(!Po(e))return!0;return _o(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=Po(r)?_o(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 si{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 kd(e,t={}){let n=Object.keys(t).sort().map((i)=>`${i}:${t[i]}`).join("|");return n?`${e}:${n}`:e}function Sd(e,t){try{return JSON.stringify(e)===JSON.stringify(t)}catch{return e===t}}function Ad(e){return e.getStats().size*2}function ai(e,t){if(Array.isArray(t)&&Array.isArray(e)&&t.length===2&&e.length===2&&L(t[0])&&"id"in t[0]&&t[0].id===3&&L(t[1])&&"id"in t[1]&&t[1].id===4)return t;if(L(t)&&L(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(L(e)&&"arr"in e&&Array.isArray(e.arr)&&L(t)&&"arr"in t&&Array.isArray(t.arr))return t;if(t.length>0&&e.length>0&&L(t[0])&&L(e[0])){let n=[...t];for(let i of e)if(L(i)&&"name"in i){if(!n.find((s)=>L(s)&&("name"in s)&&s.name===i.name))n.push(i)}else if(L(i)&&"path"in i){if(!n.find((s)=>L(s)&&("path"in s)&&s.path===i.path))n.push(i)}else if(!n.some((o)=>wr(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(!L(t)||!L(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(L(i)&&L(r[n]))r[n]=ai(r[n],i);else if(Array.isArray(i)&&Array.isArray(r[n]))if(i.length>0&&r[n].length>0&&L(i[0])&&L(r[n][0])){let o=[...i];for(let s of r[n])if(L(s)&&"name"in s){if(!o.find((a)=>L(a)&&("name"in a)&&a.name===s.name))o.push(s)}else if(L(s)&&"path"in s){if(!o.find((a)=>L(a)&&("path"in a)&&a.path===s.path))o.push(s)}else if(!o.some((l)=>wr(l,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 wr(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(!wr(e[r],t[r]))return!1;return!0}if(L(e)&&L(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(!wr(e[i],t[i]))return!1}return!0}return!1}function L(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}async function Ed(e,t){if(!Cs(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 ai(t,n)}catch{return null}}catch{return null}}async function Td({name:e="",cwd:t,defaultConfig:r}){let n=t||Hn.cwd(),i=[".ts",".js",".mjs",".cjs",".json"],o=[`${e}.config`,`.${e}.config`,e,`.${e}`];for(let s of o)for(let l of i){let a=xr(n,`${s}${l}`),c=await Ed(a,r);if(c!==null)return c}try{let s=xr(n,"package.json");if(Cs(s)){let a=(await import(s))[e];if(a&&typeof a==="object"&&!Array.isArray(a))try{return ai(r,a)}catch{}}}catch{}return r}function Nd(e,t={}){let r=br.cwd();while(r.includes("storage"))r=Fo(r,"..");let n=Fo(r,e||"");if(t?.relative)return Vf(br.cwd(),n);return n}async function Od(){try{let e=await Td({name:"clarity",defaultConfig:dr,cwd:br.cwd(),endpoint:"",headers:{}});return{...dr,...e}}catch{return dr}}function D(){if(Ae.env.NODE_ENV==="test"||Ae.env.BUN_ENV==="test")return!1;return typeof window<"u"}async function Id(){if(Ae.env.NODE_ENV==="test"||Ae.env.BUN_ENV==="test")return!0;if(typeof navigator<"u"&&navigator.product==="ReactNative")return!0;if(typeof Ae<"u"){let e=Ae.type;if(e==="renderer"||e==="worker")return!1;return!!(Ae.versions&&(Ae.versions.node||Ae.versions.bun))}return!1}class ks{async format(e){let t=await Id(),r=await this.getMetadata(t);return JSON.stringify({timestamp:e.timestamp.toISOString(),level:e.level,name:e.name,message:e.message,metadata:r})}async getMetadata(e){if(e){let{hostname:t}=await import("os");return{pid:ot.pid,hostname:t(),environment:ot.env.NODE_ENV||"development",platform:ot.platform,version:ot.version}}return{userAgent:navigator.userAgent,hostname:window.location.hostname||"browser",environment:ot.env.NODE_ENV||ot.env.BUN_ENV||"development",viewport:{width:window.innerWidth,height:window.innerHeight},language:navigator.language}}}class $r{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={...Yn},this.options=this.normalizeOptions(t),this.formatter=this.options.formatter||new ks,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??J.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{...hr,...e.fingersCrossed};if(!e.fingersCrossedEnabled)return null;if(!e.fingersCrossed)return{...hr};return{...hr,...e.fingersCrossed}}normalizeOptions(e){let t={format:"json",level:"info",logDirectory:Yn.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,l=1000;while(o<s)try{try{try{await Hf(this.config.logDirectory,Uo.F_OK|Uo.W_OK)}catch(c){if(c instanceof Error&&"code"in c)if(c.code==="ENOENT")await qf(this.config.logDirectory,{recursive:!0,mode:493});else if(c.code==="EACCES")throw Error(`No write permission for log directory: ${this.config.logDirectory}`);else throw c;else throw c}}catch(c){throw console.error("Debug: [writeToFile] Failed to create log directory:",c),c}let a=this.validateEncryptionConfig()?(await this.encrypt(e)).encrypted:Me.from(e);try{if(!Nn(this.currentLogFile))await On(this.currentLogFile,"",{mode:420});if(i=Bo(this.currentLogFile,"a",420),Gf(i,a,{flag:"a"}),Do(i),i!==void 0)Tn(i),i=void 0;if((await nt(this.currentLogFile)).size===0){if(await On(this.currentLogFile,a,{flag:"w",mode:420}),(await nt(this.currentLogFile)).size===0)throw Error("File exists but is empty after retry write")}return}catch(c){let u=c;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=l*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{Tn(i)}catch(c){console.error("Debug: [writeToFile] Error closing file descriptor:",c)}}}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 c=l*2**(o-1);await new Promise((u)=>setTimeout(u,c))}})();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 it(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 it(this.config.logDirectory,`${this.name}.log`);let e=new Date().toISOString().split("T")[0];return it(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(([,l],[,a])=>a.createdAt.getTime()-l.createdAt.getTime()),o=typeof t.maxKeys==="number"?t.maxKeys:1,s=Math.max(1,o);if(i.length>s)for(let[l]of i.slice(s))this.encryptionKeys.delete(l),this.keys.delete(l)}generateKeyId(){return En(16).toString("hex")}generateKey(){return En(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=En(16),n=Wf("aes-256-gcm",t,r),i=Me.concat([n.update(e,"utf8"),n.final()]),o=n.getAuthTag();return{encrypted:Me.concat([r,i,o]),iv:r}}async compressData(e){return new Promise((t,r)=>{let n=Wo(),i=[];n.on("data",(o)=>i.push(o)),n.on("end",()=>t(Me.from(Me.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 nt(this.currentLogFile).catch(()=>null);if(!e)return;let t=this.config.rotation;if(typeof t==="boolean")return;if(t.maxSize&&e.size>=t.maxSize){let r=this.currentLogFile,n=this.generateLogFilename();if(this.name.includes("rotation-load-test")||this.name==="failed-rotation-test"){let i=await Zt(this.config.logDirectory),o=i.filter((a)=>a.startsWith(this.name)&&/\.log\.\d+$/.test(a)).sort((a,c)=>{let u=Number.parseInt(a.match(/\.log\.(\d+)$/)?.[1]||"0");return Number.parseInt(c.match(/\.log\.(\d+)$/)?.[1]||"0")-u}),s=o.length>0?Number.parseInt(o[0].match(/\.log\.(\d+)$/)?.[1]||"0")+1:1,l=`${r}.${s}`;if(await nt(r).catch(()=>null))try{if(await Vo(r,l),t.compress)try{let a=`${l}.gz`;await this.compressLogFile(l,a),await Qt(l)}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 On(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 nt(r).catch(()=>null))await Vo(r,o)}if(this.currentLogFile=n,t.maxFiles){let o=(await Zt(this.config.logDirectory)).filter((s)=>s.startsWith(this.name)).sort((s,l)=>l.localeCompare(s));for(let s of o.slice(t.maxFiles))await Qt(it(this.config.logDirectory,s))}}}async compressLogFile(e,t){let r=jo(e),n=Kf(t),i=Wo();await Yf(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()})),Nn(this.currentLogFile))try{let e=Bo(this.currentLogFile,"r+");Do(e),Tn(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 Zt(this.config.logDirectory)).filter((r)=>(r.includes("temp")||r.includes(".tmp"))&&r.includes(this.name));for(let r of t)try{await Qt(it(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,l=(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=J.stdout.columns||120,c="";if(o==="warning"||o==="error")c=`${r} ${i}`;else if(o==="info"||o==="success")c=`${r} ${n} ${i}`;else c=`${r} ${n} ${P.cyan(i)}`;if(!s)return c.trim();let u=l(c).trim().length,f=l(t).length,d=Math.max(1,a-2-u-f);return`${c.trim()}${" ".repeat(d)}${t}`}formatMessage(e,t){if(t.length===1&&Array.isArray(t[0]))return e.replace(/\{(\d+)\}/g,(o,s)=>{let l=Number.parseInt(s,10);return l<t[0].length?String(t[0][l]):o});let r=/%([sdijfo%])/g,n=0,i=e.replace(r,(o,s)=>{if(s==="%")return"%";if(n>=t.length)return o;let l=t[n++];switch(s){case"s":return String(l);case"d":case"i":return Number(l).toString();case"j":case"o":return JSON.stringify(l,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,l;if(t instanceof Error)s=t.message,l=t.stack;else s=this.formatMessage(t,r);if(this.fancy&&!D()){let c=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:c,tag:u,message:P.gray(s),level:e}),console.error(f);break;case"info":f=this.formatConsoleMessage({timestamp:i,icon:c,tag:u,message:s,level:e}),console.error(f);break;case"success":f=this.formatConsoleMessage({timestamp:i,icon:c,tag:u,message:P.green(s),level:e}),console.error(f);break;case"warning":f=this.formatConsoleMessage({timestamp:i,icon:c,tag:u,message:s,level:e}),console.warn(f);break;case"error":if(f=this.formatConsoleMessage({timestamp:i,icon:c,tag:u,message:s,level:e}),console.error(f),l){let d=l.split(`
4
4
  `);for(let h of d)if(h.trim()&&!h.includes(s))console.error(this.formatConsoleMessage({timestamp:i,message:P.gray(` ${h}`),level:e,showTimestamp:!1}))}break}}else if(!D()){if(console.error(`${o} ${this.environment}.${e.toUpperCase()}: ${s}`),l)console.error(l)}if(!this.shouldLog(e))return;let a=`${o} ${this.environment}.${e.toUpperCase()}: ${s}
5
5
  `;if(l)a+=`${l}
6
6
  `;a=a.replace(this.ANSI_PATTERN,""),await this.writeToFile(a)}time(e){let t=performance.now();if(this.fancy&&!D()){let r=this.options.showTags!==!1&&this.name?P.gray(this.formatTag(this.name)):"",n=this.formatConsoleTimestamp(new Date);console.error(this.formatConsoleMessage({timestamp:n,icon:P.blue("\u25D0"),tag:r,message:`${P.cyan(e)}...`}))}return async(r)=>{if(!this.enabled)return;let n=performance.now(),i=Math.round(n-t),o=`${e} completed in ${i}ms`,s=new Date,l=this.formatConsoleTimestamp(s),c=`${this.formatFileTimestamp(s)} ${this.environment}.INFO: ${o}`;if(r)c+=` ${JSON.stringify(r)}`;if(c+=`
7
- `,c=c.replace(this.ANSI_PATTERN,""),this.fancy&&!D()){let u=this.options.showTags!==!1&&this.name?P.gray(this.formatTag(this.name)):"";console.error(this.formatConsoleMessage({timestamp:l,icon:P.green("\u2713"),tag:u,message:`${o}${r?` ${JSON.stringify(r)}`:""}`}))}else if(!D())console.error(c.trim());await this.writeToFile(c)}}async debug(e,...t){await this.log("debug",e,...t)}async info(e,...t){await this.log("info",e,...t)}async success(e,...t){await this.log("success",e,...t)}async warn(e,...t){await this.log("warning",e,...t)}async error(e,...t){await this.log("error",e,...t)}validateEncryptionConfig(){if(!this.config.rotation)return!1;if(typeof this.config.rotation==="boolean")return!1;let e=this.config.rotation,{encrypt:t}=e;return!!t}async only(e){if(!this.enabled)return;return await e()}isEnabled(){return this.enabled}setEnabled(e){this.enabled=e}extend(e){let t=`${this.name}:${e}`,r=new $r(t,{...this.options,logDirectory:this.config.logDirectory,level:this.config.level,format:this.config.format,rotation:typeof this.config.rotation==="boolean"?void 0:this.config.rotation,timestamp:typeof this.config.timestamp==="boolean"?void 0:this.config.timestamp});return this.subLoggers.add(r),r}createReadStream(){if(D())throw Error("createReadStream is not supported in browser environments");if(!Nn(this.currentLogFile))throw Error(`Log file does not exist: ${this.currentLogFile}`);return jo(this.currentLogFile,{encoding:"utf8"})}async decrypt(e){if(!this.validateEncryptionConfig())throw Error("Encryption is not configured");let t=this.config.rotation;if(!t.encrypt||typeof t.encrypt==="boolean")throw Error("Invalid encryption configuration");if(!this.currentKeyId||!this.keys.has(this.currentKeyId))throw Error("No valid encryption key available");let r=this.keys.get(this.currentKeyId);try{let n=Me.isBuffer(e)?e:Me.from(e,"base64"),i=n.slice(0,16),o=n.slice(-16),s=n.slice(16,-16),l=Wf("aes-256-gcm",r,i);return l.setAuthTag(o),Me.concat([l.update(s),l.final()]).toString("utf8")}catch(n){throw Error(`Decryption failed: ${n instanceof Error?n.message:String(n)}`)}}getLevel(){return this.config.level}getLogDirectory(){return this.config.logDirectory}getFormat(){return this.config.format}getRotationConfig(){return this.config.rotation}isBrowserMode(){return D()}isServerMode(){return!D()}setTestEncryptionKey(e,t){this.currentKeyId=e,this.keys.set(e,t)}getTestCurrentKey(){if(!this.currentKeyId||!this.keys.has(this.currentKeyId))return null;return{id:this.currentKeyId,key:this.keys.get(this.currentKeyId)}}getConfig(){return this.config}async box(e){if(!this.enabled)return;let t=new Date,r=this.formatConsoleTimestamp(t),n=this.formatFileTimestamp(t);if(this.fancy&&!D()){let o=e.split(`
7
+ `,c=c.replace(this.ANSI_PATTERN,""),this.fancy&&!D()){let u=this.options.showTags!==!1&&this.name?P.gray(this.formatTag(this.name)):"";console.error(this.formatConsoleMessage({timestamp:l,icon:P.green("\u2713"),tag:u,message:`${o}${r?` ${JSON.stringify(r)}`:""}`}))}else if(!D())console.error(c.trim());await this.writeToFile(c)}}async debug(e,...t){await this.log("debug",e,...t)}async info(e,...t){await this.log("info",e,...t)}async success(e,...t){await this.log("success",e,...t)}async warn(e,...t){await this.log("warning",e,...t)}async error(e,...t){await this.log("error",e,...t)}validateEncryptionConfig(){if(!this.config.rotation)return!1;if(typeof this.config.rotation==="boolean")return!1;let e=this.config.rotation,{encrypt:t}=e;return!!t}async only(e){if(!this.enabled)return;return await e()}isEnabled(){return this.enabled}setEnabled(e){this.enabled=e}extend(e){let t=`${this.name}:${e}`,r=new $r(t,{...this.options,logDirectory:this.config.logDirectory,level:this.config.level,format:this.config.format,rotation:typeof this.config.rotation==="boolean"?void 0:this.config.rotation,timestamp:typeof this.config.timestamp==="boolean"?void 0:this.config.timestamp});return this.subLoggers.add(r),r}createReadStream(){if(D())throw Error("createReadStream is not supported in browser environments");if(!Nn(this.currentLogFile))throw Error(`Log file does not exist: ${this.currentLogFile}`);return jo(this.currentLogFile,{encoding:"utf8"})}async decrypt(e){if(!this.validateEncryptionConfig())throw Error("Encryption is not configured");let t=this.config.rotation;if(!t.encrypt||typeof t.encrypt==="boolean")throw Error("Invalid encryption configuration");if(!this.currentKeyId||!this.keys.has(this.currentKeyId))throw Error("No valid encryption key available");let r=this.keys.get(this.currentKeyId);try{let n=Me.isBuffer(e)?e:Me.from(e,"base64"),i=n.slice(0,16),o=n.slice(-16),s=n.slice(16,-16),l=zf("aes-256-gcm",r,i);return l.setAuthTag(o),Me.concat([l.update(s),l.final()]).toString("utf8")}catch(n){throw Error(`Decryption failed: ${n instanceof Error?n.message:String(n)}`)}}getLevel(){return this.config.level}getLogDirectory(){return this.config.logDirectory}getFormat(){return this.config.format}getRotationConfig(){return this.config.rotation}isBrowserMode(){return D()}isServerMode(){return!D()}setTestEncryptionKey(e,t){this.currentKeyId=e,this.keys.set(e,t)}getTestCurrentKey(){if(!this.currentKeyId||!this.keys.has(this.currentKeyId))return null;return{id:this.currentKeyId,key:this.keys.get(this.currentKeyId)}}getConfig(){return this.config}async box(e){if(!this.enabled)return;let t=new Date,r=this.formatConsoleTimestamp(t),n=this.formatFileTimestamp(t);if(this.fancy&&!D()){let o=e.split(`
8
8
  `),s=Math.max(...o.map((u)=>u.length))+2,l=`\u250C${"\u2500".repeat(s)}\u2510`,a=`\u2514${"\u2500".repeat(s)}\u2518`,c=o.map((u)=>{let f=" ".repeat(s-u.length-2);return`\u2502 ${u}${f} \u2502`});if(this.options.showTags!==!1&&this.name)console.error(this.formatConsoleMessage({timestamp:r,message:P.gray(this.formatTag(this.name)),showTimestamp:!1}));console.error(this.formatConsoleMessage({timestamp:r,message:P.cyan(l)})),c.forEach((u)=>console.error(this.formatConsoleMessage({timestamp:r,message:P.cyan(u),showTimestamp:!1}))),console.error(this.formatConsoleMessage({timestamp:r,message:P.cyan(a),showTimestamp:!1}))}else if(!D())console.error(`${n} ${this.environment}.INFO: [BOX] ${e}`);let i=`${n} ${this.environment}.INFO: [BOX] ${e}
9
9
  `.replace(this.ANSI_PATTERN,"");await this.writeToFile(i)}async prompt(e){if(D())return Promise.resolve(!0);return new Promise((t)=>{console.error(`${P.cyan("?")} ${e} (y/n) `);let r=(n)=>{let i=n.toString().trim().toLowerCase();J.stdin.removeListener("data",r);try{if(typeof J.stdin.setRawMode==="function")J.stdin.setRawMode(!1)}catch{}J.stdin.pause(),console.error(""),t(i==="y"||i==="yes")};try{if(typeof J.stdin.setRawMode==="function")J.stdin.setRawMode(!0)}catch{}J.stdin.resume(),J.stdin.once("data",r)})}setFancy(e){this.fancy=e}isFancy(){return this.fancy}pause(){this.enabled=!1}resume(){this.enabled=!0}async start(e,...t){if(!this.enabled)return;let r=e;if(t&&t.length>0){let s=/%([sdijfo%])/g,l=0;if(r=e.replace(s,(a,c)=>{if(c==="%")return"%";if(l>=t.length)return a;let u=t[l++];switch(c){case"s":return String(u);case"d":case"i":return Number(u).toString();case"j":case"o":return JSON.stringify(u,null,2);default:return a}}),l<t.length)r+=` ${t.slice(l).map((a)=>typeof a==="object"?JSON.stringify(a,null,2):String(a)).join(" ")}`}if(this.fancy&&!D()){let s=this.options.showTags!==!1&&this.name?P.gray(this.formatTag(this.name)):"",l=P.blue("\u25D0");console.error(`${l} ${s} ${P.cyan(r)}`)}let o=`[${new Date().toISOString()}] ${this.environment}.INFO: [START] ${r}
10
10
  `.replace(this.ANSI_PATTERN,"");await this.writeToFile(o)}progress(e,t=""){if(!this.enabled||!this.fancy||D()||e<=0)return{update:()=>{},finish:()=>{},interrupt:()=>{}};if(this.activeProgressBar)console.warn("Warning: Another progress bar is already active. Finishing the previous one."),this.finishProgressBar(this.activeProgressBar,"[Auto-finished]");let r=20;return this.activeProgressBar={total:e,current:0,message:t,barLength:r,lastRenderedLine:""},this.renderProgressBar(this.activeProgressBar),{update:(s,l)=>{if(!this.activeProgressBar||!this.enabled||!this.fancy||D())return;if(this.activeProgressBar.current=Math.max(0,Math.min(e,s)),l!==void 0)this.activeProgressBar.message=l;let a=this.activeProgressBar.current===this.activeProgressBar.total;this.renderProgressBar(this.activeProgressBar,a)},finish:(s)=>{if(!this.activeProgressBar||!this.enabled||!this.fancy||D())return;if(this.activeProgressBar.current=this.activeProgressBar.total,s!==void 0)this.activeProgressBar.message=s;this.renderProgressBar(this.activeProgressBar,!0),this.finishProgressBar(this.activeProgressBar)},interrupt:(s,l="info")=>{if(!this.activeProgressBar||!this.enabled||!this.fancy||D())return;J.stdout.write(`${"\r".padEnd(J.stdout.columns||80)}\r`),this.log(l,s),setTimeout(()=>{if(this.activeProgressBar)this.renderProgressBar(this.activeProgressBar)},50)}}}renderProgressBar(e,t=!1){if(!this.enabled||!this.fancy||D()||!J.stdout.isTTY)return;let r=Math.min(100,Math.max(0,Math.round(e.current/e.total*100))),n=Math.round(e.barLength*r/100),i=e.barLength-n,o=P.green("\u2501".repeat(n)),s=P.gray("\u2501".repeat(i)),l=`[${o}${s}]`,a=`${r}%`.padStart(4),c=e.message?` ${e.message}`:"",u=t||r===100?P.green("\u2713"):P.blue("\u25B6"),f=this.options.showTags!==!1&&this.name?` ${P.gray(this.formatTag(this.name))}`:"",d=`\r${u}${f} ${l} ${a}${c}`,h=J.stdout.columns||80,g=" ".repeat(Math.max(0,h-d.replace(this.ANSI_PATTERN,"").length));if(e.lastRenderedLine=`${d}${g}`,J.stdout.write(e.lastRenderedLine),t)J.stdout.write(`
11
- `)}finishProgressBar(e,t){if(!this.enabled||!this.fancy||D()||!J.stdout.isTTY){this.activeProgressBar=null;return}if(e.current<e.total)e.current=e.total;if(t)e.message=t;this.renderProgressBar(e,!0),this.activeProgressBar=null}async clear(e={}){if(D()){console.warn("Log clearing is not supported in browser environments.");return}try{console.warn("Clearing logs...",this.config.logDirectory);let t=await Zt(this.config.logDirectory),r=[];for(let n of t){if(!(e.name?new RegExp(e.name.replace("*",".*")).test(n):n.startsWith(this.name))||!n.endsWith(".log"))continue;let o=it(this.config.logDirectory,n);if(e.before)try{if((await nt(o)).mtime>=e.before)continue}catch(s){console.error(`Failed to get stats for file ${o}:`,s);continue}r.push(o)}if(r.length===0){console.warn("No log files matched the criteria for clearing.");return}console.warn(`Preparing to delete ${r.length} log file(s)...`);for(let n of r)try{await Qt(n),console.warn(`Deleted log file: ${n}`)}catch(i){console.error(`Failed to delete log file ${n}:`,i)}console.warn("Log clearing process finished.")}catch(t){console.error("Error during log clearing process:",t)}}}function fr(e,t){if(Array.isArray(t)&&Array.isArray(e)&&t.length===2&&e.length===2&&I(t[0])&&"id"in t[0]&&t[0].id===3&&I(t[1])&&"id"in t[1]&&t[1].id===4)return t;if(I(t)&&I(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(I(e)&&"arr"in e&&Array.isArray(e.arr)&&I(t)&&"arr"in t&&Array.isArray(t.arr))return t;if(t.length>0&&e.length>0&&I(t[0])&&I(e[0])){let n=[...t];for(let i of e)if(I(i)&&"name"in i){if(!n.find((s)=>I(s)&&("name"in s)&&s.name===i.name))n.push(i)}else if(I(i)&&"path"in i){if(!n.find((s)=>I(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(!I(t)||!I(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(I(i)&&I(r[n]))r[n]=fr(r[n],i);else if(Array.isArray(i)&&Array.isArray(r[n]))if(i.length>0&&r[n].length>0&&I(i[0])&&I(r[n][0])){let o=[...i];for(let s of r[n])if(I(s)&&"name"in s){if(!o.find((a)=>I(a)&&("name"in a)&&a.name===s.name))o.push(s)}else if(I(s)&&"path"in s){if(!o.find((a)=>I(a)&&("path"in a)&&a.path===s.path))o.push(s)}else if(!o.some((l)=>Cr(l,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 li(e,t,r="replace"){if(t===null||t===void 0)return e;if(Array.isArray(t))return r==="replace"?t:fr(e,t);if(Array.isArray(e))return r==="replace"?t:fr(e,t);if(!I(t)||!I(e))return t;let n={...e};for(let i of Object.keys(t)){if(!Object.prototype.hasOwnProperty.call(t,i))continue;let o=t[i],s=n[i];if(o===null||o===void 0)continue;if(Array.isArray(o)||Array.isArray(s))if(r==="replace")n[i]=o;else n[i]=fr(s,o);else if(I(o)&&I(s))n[i]=li(s,o,r);else n[i]=o}return n}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(I(e)&&I(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 I(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}async function lr(e,t,r="replace"){if(!$s(e))return null;try{let n=await import(e),i=n.default||n;if(typeof i!=="object"||i===null||Array.isArray(i))return null;try{return li(t,i,r)}catch{return null}}catch{return null}}function Id(e,t,r=!1){if(!e)return t;let n=e.toUpperCase().replace(/-/g,"_"),i={...t};function o(s,l=[]){let a={...s};for(let[c,u]of Object.entries(s)){let f=[...l,c],d=(m)=>m.replace(/([A-Z])/g,"_$1").toUpperCase(),h=`${n}_${f.map(d).join("_")}`,g=`${n}_${f.map((m)=>m.toUpperCase()).join("_")}`;if(r)Z.info(`Checking environment variable ${h} for config ${e}.${f.join(".")}`);if(typeof u==="object"&&u!==null&&!Array.isArray(u))a[c]=o(u,f);else{let m=Nt.env[h]||Nt.env[g];if(m!==void 0){if(r)Z.info(`Using environment variable ${m?h:g} for config ${e}.${f.join(".")}`);if(typeof u==="number")a[c]=Number(m);else if(typeof u==="boolean")a[c]=m.toLowerCase()==="true";else if(Array.isArray(u))try{let p=JSON.parse(m);if(Array.isArray(p))a[c]=p;else a[c]=m.split(",").map((y)=>y.trim())}catch{a[c]=m.split(",").map((p)=>p.trim())}else a[c]=m}}}return a}return o(i)}async function Pd({name:e="",alias:t,cwd:r,configDir:n,defaultConfig:i,verbose:o=!1,checkEnv:s=!0,arrayStrategy:l="replace"}){let a=s&&typeof i==="object"&&i!==null&&!Array.isArray(i)?Id(e,i,o):i,c=r||Nt.cwd(),u=[".ts",".js",".mjs",".cjs",".json"];if(o)Z.info(`Loading configuration for "${e}"${t?` (alias: "${t}")`:""} from ${c}`);let f=[e,`.${e}`].filter(Boolean),d=[`${e}.config`,`.${e}.config`].filter(Boolean),h=t?[t,`.${t}`]:[],g=t?[`${t}.config`,`.${t}.config`]:[],m=Array.from(new Set([c,re(c,"config"),re(c,".config"),n?re(c,n):void 0].filter(Boolean)));for(let p of m){if(o)Z.info(`Searching for configuration in: ${p}`);let b=[re(c,"config"),re(c,".config")].concat(n?[re(c,n)]:[]).includes(p)?[...f,...d,...h,...g]:[...d,...f,...g,...h];for(let v of b)for(let R of u){let S=re(p,`${v}${R}`),j=await lr(S,a,l);if(j!==null){if(o)Z.success(`Configuration loaded from: ${S}`);return j}}}if(e){let p=re(An(),".config",e),y=["config",`${e}.config`];if(t)y.push(`${t}.config`);if(o)Z.info(`Checking user config directory: ${p}`);for(let b of y)for(let v of u){let R=re(p,`${b}${v}`),S=await lr(R,a,l);if(S!==null){if(o)Z.success(`Configuration loaded from user config directory: ${R}`);return S}}}if(e){let p=re(An(),".config"),y=[`.${e}.config`];if(t)y.push(`.${t}.config`);if(o)Z.info(`Checking user config directory for dotfile configs: ${p}`);for(let b of y)for(let v of u){let R=re(p,`${b}${v}`),S=await lr(R,a,l);if(S!==null){if(o)Z.success(`Configuration loaded from user config directory dotfile: ${R}`);return S}}}if(e){let p=An(),y=[`.${e}.config`,`.${e}`];if(t)y.push(`.${t}.config`),y.push(`.${t}`);if(o)Z.info(`Checking user home directory for dotfile configs: ${p}`);for(let b of y)for(let v of u){let R=re(p,`${b}${v}`),S=await lr(R,a,l);if(S!==null){if(o)Z.success(`Configuration loaded from user home directory: ${R}`);return S}}}try{let p=re(c,"package.json");if($s(p)){let y=await import(p),b=y[e];if(!b&&t){if(b=y[t],b&&o)Z.success(`Using alias "${t}" configuration from package.json`)}if(b&&typeof b==="object"&&!Array.isArray(b))try{if(o)Z.success(`Configuration loaded from package.json: ${b===y[e]?e:t}`);return li(a,b,l)}catch(v){if(o)Z.warn("Failed to merge package.json config:",v)}}}catch(p){if(o)Z.warn("Failed to load package.json:",p)}if(o)Z.info(`No configuration found for "${e}"${t?` or alias "${t}"`:""}, using default configuration with environment variables`);return a}function _d(e,t={}){let r=yr.cwd();while(r.includes("storage"))r=Mo(r,"..");let n=Mo(r,e||"");if(t?.relative)return Df(yr.cwd(),n);return n}async function Ld(){try{let e=await Pd({name:"clarity",alias:"logging",defaultConfig:gr,cwd:yr.cwd()});return{...gr,...e||{}}}catch{return gr}}function G(){if(Ee.env.NODE_ENV==="test"||Ee.env.BUN_ENV==="test")return!1;return typeof window<"u"}async function Md(){if(Ee.env.NODE_ENV==="test"||Ee.env.BUN_ENV==="test")return!0;if(typeof navigator<"u"&&navigator.product==="ReactNative")return!0;if(typeof Ee<"u"){let e=Ee.type;if(e==="renderer"||e==="worker")return!1;return!!(Ee.versions&&(Ee.versions.node||Ee.versions.bun))}return!1}class Ss{async format(e){let t=await Md(),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:lt.pid,hostname:t(),environment:lt.env.NODE_ENV||"development",platform:lt.platform,version:lt.version}}return{userAgent:navigator.userAgent,hostname:window.location.hostname||"browser",environment:lt.env.NODE_ENV||lt.env.BUN_ENV||"development",viewport:{width:window.innerWidth,height:window.innerHeight},language:navigator.language}}}class Rr{name;fileLocks=new Map;currentKeyId=null;keys=new Map;fingersCrossedConfig;fingersCrossedActive=!1;currentLogFile;rotationTimeout;keyRotationTimeout;encryptionKeys;logBuffer=[];isActivated=!1;pendingOperations=[];enabled;fancy;tagFormat;timestampPosition;environment;config;options;formatter;timers=new Set;subLoggers=new Set;fingersCrossedBuffer=[];ANSI_PATTERN=/\u001B\[.*?m/g;activeProgressBar=null;constructor(e,t={}){this.name=e,this.config={...Jn},this.options=this.normalizeOptions(t),this.formatter=this.options.formatter||new Ss,this.enabled=t.enabled??!0,this.fancy=t.fancy??!0,this.tagFormat=t.tagFormat??{prefix:"[",suffix:"]"},this.timestampPosition=t.timestampPosition??"right",this.environment=t.environment??N.env.APP_ENV??"local",this.fingersCrossedConfig=this.initializeFingersCrossedConfig(t);let r={...t},n=t.timestamp!==void 0;if(n)delete r.timestamp;if(this.config={...this.config,...r,timestamp:n||this.config.timestamp},this.currentLogFile=this.generateLogFilename(),this.encryptionKeys=new Map,this.validateEncryptionConfig()){this.setupRotation();let i=this.generateKeyId(),o=this.generateKey();this.currentKeyId=i,this.keys.set(i,o),this.encryptionKeys.set(i,{key:o,createdAt:new Date}),this.setupKeyRotation()}}shouldActivateFingersCrossed(e){if(!this.fingersCrossedConfig)return!1;let t={debug:0,info:1,success:2,warning:3,error:4},r=this.fingersCrossedConfig.activationLevel??"error";return t[e]>=t[r]}initializeFingersCrossedConfig(e){if(!e.fingersCrossedEnabled&&e.fingersCrossed)return{...mr,...e.fingersCrossed};if(!e.fingersCrossedEnabled)return null;if(!e.fingersCrossed)return{...mr};return{...mr,...e.fingersCrossed}}normalizeOptions(e){let t={format:"json",level:"info",logDirectory:Jn.logDirectory,rotation:void 0,timestamp:void 0,fingersCrossed:{},enabled:!0,showTags:!1,showIcons:!0,formatter:void 0},r={...t,...Object.fromEntries(Object.entries(e).filter(([,n])=>n!==void 0))};if(!r.level||!["debug","info","success","warning","error"].includes(r.level))r.level=t.level;return r}shouldWriteToFile(){return!G()&&this.config.writeToFile===!0}async writeToFile(e){let r=(async()=>{let i,o=0,s=3,l=1000;while(o<s)try{try{try{await Qf(this.config.logDirectory,Ho.F_OK|Ho.W_OK)}catch(c){if(c instanceof Error&&"code"in c)if(c.code==="ENOENT")await ed(this.config.logDirectory,{recursive:!0,mode:493});else if(c.code==="EACCES")throw Error(`No write permission for log directory: ${this.config.logDirectory}`);else throw c;else throw c}}catch(c){throw console.error("Debug: [writeToFile] Failed to create log directory:",c),c}let a=this.validateEncryptionConfig()?(await this.encrypt(e)).encrypted:ke.from(e);try{if(!er(this.currentLogFile))await _n(this.currentLogFile,"",{mode:420});if(i=Go(this.currentLogFile,"a",420),Zf(i,a,{flag:"a"}),Ko(i),i!==void 0)Pn(i),i=void 0;if((await st(this.currentLogFile)).size===0){if(await _n(this.currentLogFile,a,{flag:"w",mode:420}),(await st(this.currentLogFile)).size===0)throw Error("File exists but is empty after retry write")}return}catch(c){let u=c;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=l*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{Pn(i)}catch(c){console.error("Debug: [writeToFile] Error closing file descriptor:",c)}}}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 c=l*2**(o-1);await new Promise((u)=>setTimeout(u,c))}})();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 at(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 at(this.config.logDirectory,`${this.name}.log`);let e=new Date().toISOString().split("T")[0];return at(this.config.logDirectory,`${this.name}-${e}.log`)}setupRotation(){if(G())return;if(!this.shouldWriteToFile())return;if(typeof this.config.rotation==="boolean")return;let e=this.config.rotation,t;switch(e.frequency){case"daily":t=86400000;break;case"weekly":t=604800000;break;case"monthly":t=2592000000;break;default:return}this.rotationTimeout=setInterval(()=>{this.rotateLog()},t)}setupKeyRotation(){if(!this.validateEncryptionConfig()){console.error("Invalid encryption configuration detected during key rotation setup");return}let t=this.config.rotation.keyRotation;if(!t?.enabled)return;let r=typeof t.interval==="number"?t.interval:60,n=Math.max(r,60)*1000;this.keyRotationTimeout=setInterval(()=>{this.rotateKeys().catch((i)=>{console.error("Error rotating keys:",i)})},n)}async rotateKeys(){if(!this.validateEncryptionConfig()){console.error("Invalid encryption configuration detected during key rotation");return}let t=this.config.rotation.keyRotation,r=this.generateKeyId(),n=this.generateKey();this.currentKeyId=r,this.keys.set(r,n),this.encryptionKeys.set(r,{key:n,createdAt:new Date});let i=Array.from(this.encryptionKeys.entries()).sort(([,l],[,a])=>a.createdAt.getTime()-l.createdAt.getTime()),o=typeof t.maxKeys==="number"?t.maxKeys:1,s=Math.max(1,o);if(i.length>s)for(let[l]of i.slice(s))this.encryptionKeys.delete(l),this.keys.delete(l)}generateKeyId(){return In(16).toString("hex")}generateKey(){return In(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=In(16),n=Yf("aes-256-gcm",t,r),i=ke.isBuffer(e)?e:ke.from(e,"utf8"),o=n.update(i),s=n.final(),l=o.length+s.length,a=n.getAuthTag(),c=ke.allocUnsafe(16+l+16);return r.copy(c,0),o.copy(c,16),s.copy(c,16+o.length),a.copy(c,16+l),{encrypted:c,iv:r}}async compressData(e){return new Promise((t,r)=>{let n=Yo(),i=[];n.on("data",(o)=>i.push(o)),n.on("end",()=>t(ke.from(ke.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(G())return;if(!this.shouldWriteToFile())return;let e=await st(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 tr(this.config.logDirectory),o=i.filter((a)=>a.startsWith(this.name)&&/\.log\.\d+$/.test(a)).sort((a,c)=>{let u=Number.parseInt(a.match(/\.log\.(\d+)$/)?.[1]||"0");return Number.parseInt(c.match(/\.log\.(\d+)$/)?.[1]||"0")-u}),s=o.length>0?Number.parseInt(o[0].match(/\.log\.(\d+)$/)?.[1]||"0")+1:1,l=`${r}.${s}`;if(await st(r).catch(()=>null))try{if(await qo(r,l),t.compress)try{let a=`${l}.gz`;await this.compressLogFile(l,a),await rr(l)}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 _n(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 st(r).catch(()=>null))await qo(r,o)}if(this.currentLogFile=n,t.maxFiles){let o=(await tr(this.config.logDirectory)).filter((s)=>s.startsWith(this.name)).sort((s,l)=>l.localeCompare(s));for(let s of o.slice(t.maxFiles))await rr(at(this.config.logDirectory,s))}}}async compressLogFile(e,t){let r=zo(e),n=Xf(t),i=Yo();await nd(r,i,n)}async handleFingersCrossedBuffer(e,t){if(!this.fingersCrossedConfig)return;if(this.shouldActivateFingersCrossed(e)&&!this.isActivated){this.isActivated=!0;for(let r of this.logBuffer){let n=await this.formatter.format(r);if(this.shouldWriteToFile())await this.writeToFile(n);console.log(n)}if(this.fingersCrossedConfig.stopBuffering)this.logBuffer=[]}if(this.isActivated){if(this.shouldWriteToFile())await this.writeToFile(t);console.log(t)}}shouldLog(e){if(!this.enabled)return!1;let t={debug:0,info:1,success:2,warning:3,error:4};return t[e]>=t[this.config.level]}async flushPendingWrites(){if(await Promise.all(this.pendingOperations.map((e)=>{if(e instanceof Promise)return e.catch((t)=>{console.error("Error in pending write operation:",t)});return Promise.resolve()})),er(this.currentLogFile))try{let e=Go(this.currentLogFile,"r+");Ko(e),Pn(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(!G()&&this.config.rotation&&typeof this.config.rotation!=="boolean"&&this.config.rotation.compress)try{let t=(await tr(this.config.logDirectory)).filter((r)=>(r.includes("temp")||r.includes(".tmp"))&&r.includes(this.name));for(let r of t)try{await rr(at(this.config.logDirectory,r))}catch(n){console.error(`Failed to delete temp file ${r}:`,n)}}catch(e){console.error("Error cleaning up temporary files:",e)}})()}getCurrentLogFilePath(){return this.currentLogFile}formatTag(e){if(!e)return"";return`${this.tagFormat.prefix}${e}${this.tagFormat.suffix}`}formatFileTimestamp(e){return`[${e.toISOString()}]`}formatConsoleTimestamp(e){return this.shouldStyleConsole()?E.gray(e.toLocaleTimeString()):e.toLocaleTimeString()}shouldStyleConsole(){if(!this.fancy||G())return!1;let e=typeof N.env.NO_COLOR<"u",t=N.env.FORCE_COLOR==="0";if(e||t)return!1;return!!(typeof N.stderr<"u"&&N.stderr.isTTY||typeof N.stdout<"u"&&N.stdout.isTTY)}formatConsoleMessage(e){let{timestamp:t,icon:r="",tag:n="",message:i,level:o,showTimestamp:s=!0}=e,l=(h)=>h.replace(this.ANSI_PATTERN,"");if(!this.fancy){let h=[];if(s)h.push(t);if(o==="warning")h.push("WARN");else if(o==="error")h.push("ERROR");else if(r)h.push(r.replace(/[^\p{L}\p{N}\p{P}\p{Z}]/gu,""));if(n)h.push(n.replace(/[[\]]/g,""));return h.push(i),h.join(" ")}let a=N.stdout.columns||120,c="";if(o==="warning"||o==="error")c=`${r} ${i}`;else if(o==="info"||o==="success")c=`${r} ${n} ${i}`;else c=`${r} ${n} ${E.cyan(i)}`;if(!s)return c.trim();let u=l(c).trim().length,f=l(t).length,d=Math.max(1,a-2-u-f);return`${c.trim()}${" ".repeat(d)}${t}`}formatMessage(e,t){if(t.length===1&&Array.isArray(t[0]))return e.replace(/\{(\d+)\}/g,(o,s)=>{let l=Number.parseInt(s,10);return l<t[0].length?String(t[0][l]):o});let r=/%([sdijfo%])/g,n=0,i=e.replace(r,(o,s)=>{if(s==="%")return"%";if(n>=t.length)return o;let l=t[n++];switch(s){case"s":return String(l);case"d":case"i":return Number(l).toString();case"j":case"o":return JSON.stringify(l,null,2);default:return o}});if(n<t.length)i+=` ${t.slice(n).map((o)=>typeof o==="object"?JSON.stringify(o,null,2):String(o)).join(" ")}`;return i}formatMarkdown(e){if(!e)return e;let t=e;return t=t.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(r,n,i)=>{let o=E.underline(E.blue(n)),s=this.toAbsoluteFilePath(i);if(s&&this.shouldStyleConsole()&&this.supportsHyperlinks()){let l=`file://${encodeURI(s)}`,a="\x1B]8;;",c="\x1B\\";return`\x1B]8;;${l}\x1B\\${o}\x1B]8;;\x1B\\`}if(this.shouldStyleConsole()&&this.supportsHyperlinks())return`\x1B]8;;${i}\x1B\\${o}\x1B]8;;\x1B\\`;return o}),t=t.replace(/`([^`]+)`/g,(r,n)=>E.bgGray(n)),t=t.replace(/\*\*([^*]+)\*\*/g,(r,n)=>E.bold(n)),t=t.replace(/(?<!\*)\*([^*]+)\*(?!\*)/g,(r,n)=>E.italic(n)),t=t.replace(/(?<!_)_([^_]+)_(?!_)/g,(r,n)=>E.italic(n)),t=t.replace(/~([^~]+)~/g,(r,n)=>E.strikethrough(n)),t}supportsHyperlinks(){if(G())return!1;let e=N.env;if(!e)return!1;if(e.TERM_PROGRAM==="iTerm.app"||e.TERM_PROGRAM==="vscode"||e.TERM_PROGRAM==="WezTerm")return!0;if(e.WT_SESSION)return!0;if(e.TERM==="xterm-kitty")return!0;let t=e.VTE_VERSION?Number.parseInt(e.VTE_VERSION,10):0;if(!Number.isNaN(t)&&t>=5000)return!0;return!1}toAbsoluteFilePath(e){try{let t=e;if(t.startsWith("file://"))t=t.replace(/^file:\/\//,"");if(t.startsWith("~")){let r=N.env.HOME||"";if(r)t=t.replace(/^~(?=$|\/)/,r)}if(td(t)||t.startsWith("./")||t.startsWith("../"))t=rd(t);else return null;return er(t)?t:null}catch{return null}}buildOutputTexts(e){let t=this.shouldStyleConsole()?this.formatMarkdown(e):e,r=e.replace(this.ANSI_PATTERN,"");return{consoleText:t,fileText:r}}async log(e,t,...r){let n=new Date,i=this.formatConsoleTimestamp(n),o=this.formatFileTimestamp(n),s,l;if(t instanceof Error)s=t.message,l=t.stack;else s=this.formatMessage(t,r);let{consoleText:a,fileText:c}=this.buildOutputTexts(s);if(this.shouldStyleConsole()){let f=this.options.showIcons===!1?"":Ms[e],d=this.options.showTags!==!1&&this.name?E.gray(this.formatTag(this.name)):"",h;switch(e){case"debug":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:E.gray(a),level:e}),console.error(h);break;case"info":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:a,level:e}),console.warn(h);break;case"success":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:E.green(a),level:e}),console.error(h);break;case"warning":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:a,level:e}),console.warn(h);break;case"error":if(h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:a,level:e}),console.error(h),l){let g=l.split(`
11
+ `)}finishProgressBar(e,t){if(!this.enabled||!this.fancy||D()||!J.stdout.isTTY){this.activeProgressBar=null;return}if(e.current<e.total)e.current=e.total;if(t)e.message=t;this.renderProgressBar(e,!0),this.activeProgressBar=null}async clear(e={}){if(D()){console.warn("Log clearing is not supported in browser environments.");return}try{console.warn("Clearing logs...",this.config.logDirectory);let t=await Zt(this.config.logDirectory),r=[];for(let n of t){if(!(e.name?new RegExp(e.name.replace("*",".*")).test(n):n.startsWith(this.name))||!n.endsWith(".log"))continue;let o=it(this.config.logDirectory,n);if(e.before)try{if((await nt(o)).mtime>=e.before)continue}catch(s){console.error(`Failed to get stats for file ${o}:`,s);continue}r.push(o)}if(r.length===0){console.warn("No log files matched the criteria for clearing.");return}console.warn(`Preparing to delete ${r.length} log file(s)...`);for(let n of r)try{await Qt(n),console.warn(`Deleted log file: ${n}`)}catch(i){console.error(`Failed to delete log file ${n}:`,i)}console.warn("Log clearing process finished.")}catch(t){console.error("Error during log clearing process:",t)}}}function fr(e,t){if(Array.isArray(t)&&Array.isArray(e)&&t.length===2&&e.length===2&&I(t[0])&&"id"in t[0]&&t[0].id===3&&I(t[1])&&"id"in t[1]&&t[1].id===4)return t;if(I(t)&&I(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(I(e)&&"arr"in e&&Array.isArray(e.arr)&&I(t)&&"arr"in t&&Array.isArray(t.arr))return t;if(t.length>0&&e.length>0&&I(t[0])&&I(e[0])){let n=[...t];for(let i of e)if(I(i)&&"name"in i){if(!n.find((s)=>I(s)&&("name"in s)&&s.name===i.name))n.push(i)}else if(I(i)&&"path"in i){if(!n.find((s)=>I(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(!I(t)||!I(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(I(i)&&I(r[n]))r[n]=fr(r[n],i);else if(Array.isArray(i)&&Array.isArray(r[n]))if(i.length>0&&r[n].length>0&&I(i[0])&&I(r[n][0])){let o=[...i];for(let s of r[n])if(I(s)&&"name"in s){if(!o.find((a)=>I(a)&&("name"in a)&&a.name===s.name))o.push(s)}else if(I(s)&&"path"in s){if(!o.find((a)=>I(a)&&("path"in a)&&a.path===s.path))o.push(s)}else if(!o.some((l)=>Cr(l,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 li(e,t,r="replace"){if(t===null||t===void 0)return e;if(Array.isArray(t))return r==="replace"?t:fr(e,t);if(Array.isArray(e))return r==="replace"?t:fr(e,t);if(!I(t)||!I(e))return t;let n={...e};for(let i of Object.keys(t)){if(!Object.prototype.hasOwnProperty.call(t,i))continue;let o=t[i],s=n[i];if(o===null||o===void 0)continue;if(Array.isArray(o)||Array.isArray(s))if(r==="replace")n[i]=o;else n[i]=fr(s,o);else if(I(o)&&I(s))n[i]=li(s,o,r);else n[i]=o}return n}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(I(e)&&I(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 I(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}async function lr(e,t,r="replace"){if(!$s(e))return null;try{let n=await import(e),i=n.default||n;if(typeof i!=="object"||i===null||Array.isArray(i))return null;try{return li(t,i,r)}catch{return null}}catch{return null}}function Pd(e,t,r=!1){if(!e)return t;let n=e.toUpperCase().replace(/-/g,"_"),i={...t};function o(s,l=[]){let a={...s};for(let[c,u]of Object.entries(s)){let f=[...l,c],d=(m)=>m.replace(/([A-Z])/g,"_$1").toUpperCase(),h=`${n}_${f.map(d).join("_")}`,g=`${n}_${f.map((m)=>m.toUpperCase()).join("_")}`;if(r)Z.info(`Checking environment variable ${h} for config ${e}.${f.join(".")}`);if(typeof u==="object"&&u!==null&&!Array.isArray(u))a[c]=o(u,f);else{let m=Nt.env[h]||Nt.env[g];if(m!==void 0){if(r)Z.info(`Using environment variable ${m?h:g} for config ${e}.${f.join(".")}`);if(typeof u==="number")a[c]=Number(m);else if(typeof u==="boolean")a[c]=m.toLowerCase()==="true";else if(Array.isArray(u))try{let p=JSON.parse(m);if(Array.isArray(p))a[c]=p;else a[c]=m.split(",").map((y)=>y.trim())}catch{a[c]=m.split(",").map((p)=>p.trim())}else a[c]=m}}}return a}return o(i)}async function _d({name:e="",alias:t,cwd:r,configDir:n,defaultConfig:i,verbose:o=!1,checkEnv:s=!0,arrayStrategy:l="replace"}){let a=s&&typeof i==="object"&&i!==null&&!Array.isArray(i)?Pd(e,i,o):i,c=r||Nt.cwd(),u=[".ts",".js",".mjs",".cjs",".json"];if(o)Z.info(`Loading configuration for "${e}"${t?` (alias: "${t}")`:""} from ${c}`);let f=[e,`.${e}`].filter(Boolean),d=[`${e}.config`,`.${e}.config`].filter(Boolean),h=t?[t,`.${t}`]:[],g=t?[`${t}.config`,`.${t}.config`]:[],m=Array.from(new Set([c,re(c,"config"),re(c,".config"),n?re(c,n):void 0].filter(Boolean)));for(let p of m){if(o)Z.info(`Searching for configuration in: ${p}`);let b=[re(c,"config"),re(c,".config")].concat(n?[re(c,n)]:[]).includes(p)?[...f,...d,...h,...g]:[...d,...f,...g,...h];for(let v of b)for(let R of u){let S=re(p,`${v}${R}`),j=await lr(S,a,l);if(j!==null){if(o)Z.success(`Configuration loaded from: ${S}`);return j}}}if(e){let p=re(An(),".config",e),y=["config",`${e}.config`];if(t)y.push(`${t}.config`);if(o)Z.info(`Checking user config directory: ${p}`);for(let b of y)for(let v of u){let R=re(p,`${b}${v}`),S=await lr(R,a,l);if(S!==null){if(o)Z.success(`Configuration loaded from user config directory: ${R}`);return S}}}if(e){let p=re(An(),".config"),y=[`.${e}.config`];if(t)y.push(`.${t}.config`);if(o)Z.info(`Checking user config directory for dotfile configs: ${p}`);for(let b of y)for(let v of u){let R=re(p,`${b}${v}`),S=await lr(R,a,l);if(S!==null){if(o)Z.success(`Configuration loaded from user config directory dotfile: ${R}`);return S}}}if(e){let p=An(),y=[`.${e}.config`,`.${e}`];if(t)y.push(`.${t}.config`),y.push(`.${t}`);if(o)Z.info(`Checking user home directory for dotfile configs: ${p}`);for(let b of y)for(let v of u){let R=re(p,`${b}${v}`),S=await lr(R,a,l);if(S!==null){if(o)Z.success(`Configuration loaded from user home directory: ${R}`);return S}}}try{let p=re(c,"package.json");if($s(p)){let y=await import(p),b=y[e];if(!b&&t){if(b=y[t],b&&o)Z.success(`Using alias "${t}" configuration from package.json`)}if(b&&typeof b==="object"&&!Array.isArray(b))try{if(o)Z.success(`Configuration loaded from package.json: ${b===y[e]?e:t}`);return li(a,b,l)}catch(v){if(o)Z.warn("Failed to merge package.json config:",v)}}}catch(p){if(o)Z.warn("Failed to load package.json:",p)}if(o)Z.info(`No configuration found for "${e}"${t?` or alias "${t}"`:""}, using default configuration with environment variables`);return a}function Ld(e,t={}){let r=yr.cwd();while(r.includes("storage"))r=Mo(r,"..");let n=Mo(r,e||"");if(t?.relative)return Bf(yr.cwd(),n);return n}async function Md(){try{let e=await _d({name:"clarity",alias:"logging",defaultConfig:gr,cwd:yr.cwd()});return{...gr,...e||{}}}catch{return gr}}function G(){if(Ee.env.NODE_ENV==="test"||Ee.env.BUN_ENV==="test")return!1;return typeof window<"u"}async function Fd(){if(Ee.env.NODE_ENV==="test"||Ee.env.BUN_ENV==="test")return!0;if(typeof navigator<"u"&&navigator.product==="ReactNative")return!0;if(typeof Ee<"u"){let e=Ee.type;if(e==="renderer"||e==="worker")return!1;return!!(Ee.versions&&(Ee.versions.node||Ee.versions.bun))}return!1}class Ss{async format(e){let t=await Fd(),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:lt.pid,hostname:t(),environment:lt.env.NODE_ENV||"development",platform:lt.platform,version:lt.version}}return{userAgent:navigator.userAgent,hostname:window.location.hostname||"browser",environment:lt.env.NODE_ENV||lt.env.BUN_ENV||"development",viewport:{width:window.innerWidth,height:window.innerHeight},language:navigator.language}}}class Rr{name;fileLocks=new Map;currentKeyId=null;keys=new Map;fingersCrossedConfig;fingersCrossedActive=!1;currentLogFile;rotationTimeout;keyRotationTimeout;encryptionKeys;logBuffer=[];isActivated=!1;pendingOperations=[];enabled;fancy;tagFormat;timestampPosition;environment;config;options;formatter;timers=new Set;subLoggers=new Set;fingersCrossedBuffer=[];ANSI_PATTERN=/\u001B\[.*?m/g;activeProgressBar=null;constructor(e,t={}){this.name=e,this.config={...Jn},this.options=this.normalizeOptions(t),this.formatter=this.options.formatter||new Ss,this.enabled=t.enabled??!0,this.fancy=t.fancy??!0,this.tagFormat=t.tagFormat??{prefix:"[",suffix:"]"},this.timestampPosition=t.timestampPosition??"right",this.environment=t.environment??N.env.APP_ENV??"local",this.fingersCrossedConfig=this.initializeFingersCrossedConfig(t);let r={...t},n=t.timestamp!==void 0;if(n)delete r.timestamp;if(this.config={...this.config,...r,timestamp:n||this.config.timestamp},this.currentLogFile=this.generateLogFilename(),this.encryptionKeys=new Map,this.validateEncryptionConfig()){this.setupRotation();let i=this.generateKeyId(),o=this.generateKey();this.currentKeyId=i,this.keys.set(i,o),this.encryptionKeys.set(i,{key:o,createdAt:new Date}),this.setupKeyRotation()}}shouldActivateFingersCrossed(e){if(!this.fingersCrossedConfig)return!1;let t={debug:0,info:1,success:2,warning:3,error:4},r=this.fingersCrossedConfig.activationLevel??"error";return t[e]>=t[r]}initializeFingersCrossedConfig(e){if(!e.fingersCrossedEnabled&&e.fingersCrossed)return{...mr,...e.fingersCrossed};if(!e.fingersCrossedEnabled)return null;if(!e.fingersCrossed)return{...mr};return{...mr,...e.fingersCrossed}}normalizeOptions(e){let t={format:"json",level:"info",logDirectory:Jn.logDirectory,rotation:void 0,timestamp:void 0,fingersCrossed:{},enabled:!0,showTags:!1,showIcons:!0,formatter:void 0},r={...t,...Object.fromEntries(Object.entries(e).filter(([,n])=>n!==void 0))};if(!r.level||!["debug","info","success","warning","error"].includes(r.level))r.level=t.level;return r}shouldWriteToFile(){return!G()&&this.config.writeToFile===!0}async writeToFile(e){let r=(async()=>{let i,o=0,s=3,l=1000;while(o<s)try{try{try{await ed(this.config.logDirectory,Ho.F_OK|Ho.W_OK)}catch(c){if(c instanceof Error&&"code"in c)if(c.code==="ENOENT")await td(this.config.logDirectory,{recursive:!0,mode:493});else if(c.code==="EACCES")throw Error(`No write permission for log directory: ${this.config.logDirectory}`);else throw c;else throw c}}catch(c){throw console.error("Debug: [writeToFile] Failed to create log directory:",c),c}let a=this.validateEncryptionConfig()?(await this.encrypt(e)).encrypted:ke.from(e);try{if(!er(this.currentLogFile))await _n(this.currentLogFile,"",{mode:420});if(i=Go(this.currentLogFile,"a",420),Qf(i,a,{flag:"a"}),Ko(i),i!==void 0)Pn(i),i=void 0;if((await st(this.currentLogFile)).size===0){if(await _n(this.currentLogFile,a,{flag:"w",mode:420}),(await st(this.currentLogFile)).size===0)throw Error("File exists but is empty after retry write")}return}catch(c){let u=c;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=l*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{Pn(i)}catch(c){console.error("Debug: [writeToFile] Error closing file descriptor:",c)}}}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 c=l*2**(o-1);await new Promise((u)=>setTimeout(u,c))}})();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 at(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 at(this.config.logDirectory,`${this.name}.log`);let e=new Date().toISOString().split("T")[0];return at(this.config.logDirectory,`${this.name}-${e}.log`)}setupRotation(){if(G())return;if(!this.shouldWriteToFile())return;if(typeof this.config.rotation==="boolean")return;let e=this.config.rotation,t;switch(e.frequency){case"daily":t=86400000;break;case"weekly":t=604800000;break;case"monthly":t=2592000000;break;default:return}this.rotationTimeout=setInterval(()=>{this.rotateLog()},t)}setupKeyRotation(){if(!this.validateEncryptionConfig()){console.error("Invalid encryption configuration detected during key rotation setup");return}let t=this.config.rotation.keyRotation;if(!t?.enabled)return;let r=typeof t.interval==="number"?t.interval:60,n=Math.max(r,60)*1000;this.keyRotationTimeout=setInterval(()=>{this.rotateKeys().catch((i)=>{console.error("Error rotating keys:",i)})},n)}async rotateKeys(){if(!this.validateEncryptionConfig()){console.error("Invalid encryption configuration detected during key rotation");return}let t=this.config.rotation.keyRotation,r=this.generateKeyId(),n=this.generateKey();this.currentKeyId=r,this.keys.set(r,n),this.encryptionKeys.set(r,{key:n,createdAt:new Date});let i=Array.from(this.encryptionKeys.entries()).sort(([,l],[,a])=>a.createdAt.getTime()-l.createdAt.getTime()),o=typeof t.maxKeys==="number"?t.maxKeys:1,s=Math.max(1,o);if(i.length>s)for(let[l]of i.slice(s))this.encryptionKeys.delete(l),this.keys.delete(l)}generateKeyId(){return In(16).toString("hex")}generateKey(){return In(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=In(16),n=Jf("aes-256-gcm",t,r),i=ke.isBuffer(e)?e:ke.from(e,"utf8"),o=n.update(i),s=n.final(),l=o.length+s.length,a=n.getAuthTag(),c=ke.allocUnsafe(16+l+16);return r.copy(c,0),o.copy(c,16),s.copy(c,16+o.length),a.copy(c,16+l),{encrypted:c,iv:r}}async compressData(e){return new Promise((t,r)=>{let n=Yo(),i=[];n.on("data",(o)=>i.push(o)),n.on("end",()=>t(ke.from(ke.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(G())return;if(!this.shouldWriteToFile())return;let e=await st(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 tr(this.config.logDirectory),o=i.filter((a)=>a.startsWith(this.name)&&/\.log\.\d+$/.test(a)).sort((a,c)=>{let u=Number.parseInt(a.match(/\.log\.(\d+)$/)?.[1]||"0");return Number.parseInt(c.match(/\.log\.(\d+)$/)?.[1]||"0")-u}),s=o.length>0?Number.parseInt(o[0].match(/\.log\.(\d+)$/)?.[1]||"0")+1:1,l=`${r}.${s}`;if(await st(r).catch(()=>null))try{if(await qo(r,l),t.compress)try{let a=`${l}.gz`;await this.compressLogFile(l,a),await rr(l)}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 _n(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 st(r).catch(()=>null))await qo(r,o)}if(this.currentLogFile=n,t.maxFiles){let o=(await tr(this.config.logDirectory)).filter((s)=>s.startsWith(this.name)).sort((s,l)=>l.localeCompare(s));for(let s of o.slice(t.maxFiles))await rr(at(this.config.logDirectory,s))}}}async compressLogFile(e,t){let r=zo(e),n=Zf(t),i=Yo();await id(r,i,n)}async handleFingersCrossedBuffer(e,t){if(!this.fingersCrossedConfig)return;if(this.shouldActivateFingersCrossed(e)&&!this.isActivated){this.isActivated=!0;for(let r of this.logBuffer){let n=await this.formatter.format(r);if(this.shouldWriteToFile())await this.writeToFile(n);console.log(n)}if(this.fingersCrossedConfig.stopBuffering)this.logBuffer=[]}if(this.isActivated){if(this.shouldWriteToFile())await this.writeToFile(t);console.log(t)}}shouldLog(e){if(!this.enabled)return!1;let t={debug:0,info:1,success:2,warning:3,error:4};return t[e]>=t[this.config.level]}async flushPendingWrites(){if(await Promise.all(this.pendingOperations.map((e)=>{if(e instanceof Promise)return e.catch((t)=>{console.error("Error in pending write operation:",t)});return Promise.resolve()})),er(this.currentLogFile))try{let e=Go(this.currentLogFile,"r+");Ko(e),Pn(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(!G()&&this.config.rotation&&typeof this.config.rotation!=="boolean"&&this.config.rotation.compress)try{let t=(await tr(this.config.logDirectory)).filter((r)=>(r.includes("temp")||r.includes(".tmp"))&&r.includes(this.name));for(let r of t)try{await rr(at(this.config.logDirectory,r))}catch(n){console.error(`Failed to delete temp file ${r}:`,n)}}catch(e){console.error("Error cleaning up temporary files:",e)}})()}getCurrentLogFilePath(){return this.currentLogFile}formatTag(e){if(!e)return"";return`${this.tagFormat.prefix}${e}${this.tagFormat.suffix}`}formatFileTimestamp(e){return`[${e.toISOString()}]`}formatConsoleTimestamp(e){return this.shouldStyleConsole()?E.gray(e.toLocaleTimeString()):e.toLocaleTimeString()}shouldStyleConsole(){if(!this.fancy||G())return!1;let e=typeof N.env.NO_COLOR<"u",t=N.env.FORCE_COLOR==="0";if(e||t)return!1;return!!(typeof N.stderr<"u"&&N.stderr.isTTY||typeof N.stdout<"u"&&N.stdout.isTTY)}formatConsoleMessage(e){let{timestamp:t,icon:r="",tag:n="",message:i,level:o,showTimestamp:s=!0}=e,l=(h)=>h.replace(this.ANSI_PATTERN,"");if(!this.fancy){let h=[];if(s)h.push(t);if(o==="warning")h.push("WARN");else if(o==="error")h.push("ERROR");else if(r)h.push(r.replace(/[^\p{L}\p{N}\p{P}\p{Z}]/gu,""));if(n)h.push(n.replace(/[[\]]/g,""));return h.push(i),h.join(" ")}let a=N.stdout.columns||120,c="";if(o==="warning"||o==="error")c=`${r} ${i}`;else if(o==="info"||o==="success")c=`${r} ${n} ${i}`;else c=`${r} ${n} ${E.cyan(i)}`;if(!s)return c.trim();let u=l(c).trim().length,f=l(t).length,d=Math.max(1,a-2-u-f);return`${c.trim()}${" ".repeat(d)}${t}`}formatMessage(e,t){if(t.length===1&&Array.isArray(t[0]))return e.replace(/\{(\d+)\}/g,(o,s)=>{let l=Number.parseInt(s,10);return l<t[0].length?String(t[0][l]):o});let r=/%([sdijfo%])/g,n=0,i=e.replace(r,(o,s)=>{if(s==="%")return"%";if(n>=t.length)return o;let l=t[n++];switch(s){case"s":return String(l);case"d":case"i":return Number(l).toString();case"j":case"o":return JSON.stringify(l,null,2);default:return o}});if(n<t.length)i+=` ${t.slice(n).map((o)=>typeof o==="object"?JSON.stringify(o,null,2):String(o)).join(" ")}`;return i}formatMarkdown(e){if(!e)return e;let t=e;return t=t.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(r,n,i)=>{let o=E.underline(E.blue(n)),s=this.toAbsoluteFilePath(i);if(s&&this.shouldStyleConsole()&&this.supportsHyperlinks()){let l=`file://${encodeURI(s)}`,a="\x1B]8;;",c="\x1B\\";return`\x1B]8;;${l}\x1B\\${o}\x1B]8;;\x1B\\`}if(this.shouldStyleConsole()&&this.supportsHyperlinks())return`\x1B]8;;${i}\x1B\\${o}\x1B]8;;\x1B\\`;return o}),t=t.replace(/`([^`]+)`/g,(r,n)=>E.bgGray(n)),t=t.replace(/\*\*([^*]+)\*\*/g,(r,n)=>E.bold(n)),t=t.replace(/(?<!\*)\*([^*]+)\*(?!\*)/g,(r,n)=>E.italic(n)),t=t.replace(/(?<!_)_([^_]+)_(?!_)/g,(r,n)=>E.italic(n)),t=t.replace(/~([^~]+)~/g,(r,n)=>E.strikethrough(n)),t}supportsHyperlinks(){if(G())return!1;let e=N.env;if(!e)return!1;if(e.TERM_PROGRAM==="iTerm.app"||e.TERM_PROGRAM==="vscode"||e.TERM_PROGRAM==="WezTerm")return!0;if(e.WT_SESSION)return!0;if(e.TERM==="xterm-kitty")return!0;let t=e.VTE_VERSION?Number.parseInt(e.VTE_VERSION,10):0;if(!Number.isNaN(t)&&t>=5000)return!0;return!1}toAbsoluteFilePath(e){try{let t=e;if(t.startsWith("file://"))t=t.replace(/^file:\/\//,"");if(t.startsWith("~")){let r=N.env.HOME||"";if(r)t=t.replace(/^~(?=$|\/)/,r)}if(rd(t)||t.startsWith("./")||t.startsWith("../"))t=nd(t);else return null;return er(t)?t:null}catch{return null}}buildOutputTexts(e){let t=this.shouldStyleConsole()?this.formatMarkdown(e):e,r=e.replace(this.ANSI_PATTERN,"");return{consoleText:t,fileText:r}}async log(e,t,...r){let n=new Date,i=this.formatConsoleTimestamp(n),o=this.formatFileTimestamp(n),s,l;if(t instanceof Error)s=t.message,l=t.stack;else s=this.formatMessage(t,r);let{consoleText:a,fileText:c}=this.buildOutputTexts(s);if(this.shouldStyleConsole()){let f=this.options.showIcons===!1?"":Ms[e],d=this.options.showTags!==!1&&this.name?E.gray(this.formatTag(this.name)):"",h;switch(e){case"debug":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:E.gray(a),level:e}),console.error(h);break;case"info":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:a,level:e}),console.warn(h);break;case"success":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:E.green(a),level:e}),console.error(h);break;case"warning":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:a,level:e}),console.warn(h);break;case"error":if(h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:a,level:e}),console.error(h),l){let g=l.split(`
12
12
  `);for(let m of g)if(m.trim()&&!m.includes(s))console.error(this.formatConsoleMessage({timestamp:i,message:E.gray(` ${m}`),level:e,showTimestamp:!1}))}break}}else if(!G()){if(console.error(`${o} ${this.environment}.${e.toUpperCase()}: ${s}`),l)console.error(l)}if(!this.shouldLog(e))return;let u=`${o} ${this.environment}.${e.toUpperCase()}: ${c}
13
13
  `;if(l)u+=`${l}
14
14
  `;if(u=u.replace(this.ANSI_PATTERN,""),this.shouldWriteToFile())await this.writeToFile(u)}progress(e,t=""){let r={update:(l,a)=>{},finish:(l)=>{},interrupt:(l,a)=>{}};if(!this.enabled)return r;let n=30;if(this.activeProgressBar={total:Math.max(1,e||1),current:0,message:t||"",barLength:n,lastRenderedLine:""},this.shouldStyleConsole()&&!G()&&N.stdout.isTTY)this.renderProgressBar(this.activeProgressBar);return{update:(l,a)=>{if(!this.enabled||!this.activeProgressBar)return;if(this.activeProgressBar.current=Math.min(Math.max(0,l),this.activeProgressBar.total),a!==void 0)this.activeProgressBar.message=a;if(this.shouldStyleConsole()&&!G()&&N.stdout.isTTY)this.renderProgressBar(this.activeProgressBar)},finish:(l)=>{if(!this.activeProgressBar)return;this.finishProgressBar(this.activeProgressBar,l)},interrupt:(l,a="info")=>{if(!G()&&N.stdout.isTTY)N.stdout.write(`
15
15
  `);if(this[a==="warning"?"warn":a](l),this.activeProgressBar&&this.shouldStyleConsole()&&!G()&&N.stdout.isTTY)this.renderProgressBar(this.activeProgressBar)}}}time(e){let t=performance.now();if(this.shouldStyleConsole()){let r=this.options.showTags!==!1&&this.name?E.gray(this.formatTag(this.name)):"",n=this.formatConsoleTimestamp(new Date);console.error(this.formatConsoleMessage({timestamp:n,icon:this.options.showIcons===!1?"":E.blue("\u25D0"),tag:r,message:`${E.cyan(e)}...`}))}return async(r)=>{if(!this.enabled)return;let n=performance.now(),i=Math.round(n-t),o=`${e} completed in ${i}ms`,s=new Date,l=this.formatConsoleTimestamp(s),c=`${this.formatFileTimestamp(s)} ${this.environment}.INFO: ${o}`;if(r)c+=` ${JSON.stringify(r)}`;if(c+=`
16
- `,c=c.replace(this.ANSI_PATTERN,""),this.shouldStyleConsole()){let u=this.options.showTags!==!1&&this.name?E.gray(this.formatTag(this.name)):"";console.error(this.formatConsoleMessage({timestamp:l,icon:this.options.showIcons===!1?"":E.green("\u2713"),tag:u,message:`${o}${r?` ${JSON.stringify(r)}`:""}`}))}else if(!G())console.error(c.trim());if(this.shouldWriteToFile())await this.writeToFile(c)}}async debug(e,...t){await this.log("debug",e,...t)}async info(e,...t){await this.log("info",e,...t)}async success(e,...t){await this.log("success",e,...t)}async warn(e,...t){await this.log("warning",e,...t)}async error(e,...t){await this.log("error",e,...t)}validateEncryptionConfig(){if(!this.config.rotation)return!1;if(typeof this.config.rotation==="boolean")return!1;let e=this.config.rotation,{encrypt:t}=e;return!!t}async only(e){if(!this.enabled)return;return await e()}isEnabled(){return this.enabled}setEnabled(e){this.enabled=e}extend(e){let t=`${this.name}:${e}`,r=new Rr(t,{...this.options,logDirectory:this.config.logDirectory,level:this.config.level,format:this.config.format,rotation:typeof this.config.rotation==="boolean"?void 0:this.config.rotation,timestamp:typeof this.config.timestamp==="boolean"?void 0:this.config.timestamp});return this.subLoggers.add(r),r}createReadStream(){if(G())throw Error("createReadStream is not supported in browser environments");if(!er(this.currentLogFile))throw Error(`Log file does not exist: ${this.currentLogFile}`);return zo(this.currentLogFile,{encoding:"utf8"})}async decrypt(e){if(!this.validateEncryptionConfig())throw Error("Encryption is not configured");let t=this.config.rotation;if(!t.encrypt||typeof t.encrypt==="boolean")throw Error("Invalid encryption configuration");if(!this.currentKeyId||!this.keys.has(this.currentKeyId))throw Error("No valid encryption key available");let r=this.keys.get(this.currentKeyId);try{let n=ke.isBuffer(e)?e:ke.from(e,"base64"),i=n.subarray(0,16),o=n.subarray(n.length-16),s=n.subarray(16,n.length-16),l=Jf("aes-256-gcm",r,i);l.setAuthTag(o);let a=l.update(s),c=l.final(),u=a.length+c.length,f=ke.allocUnsafe(u);return a.copy(f,0),c.copy(f,a.length),f.toString("utf8")}catch(n){throw Error(`Decryption failed: ${n instanceof Error?n.message:String(n)}`)}}getLevel(){return this.config.level}getLogDirectory(){return this.config.logDirectory}getFormat(){return this.config.format}getRotationConfig(){return this.config.rotation}isBrowserMode(){return G()}isServerMode(){return!G()}setTestEncryptionKey(e,t){this.currentKeyId=e,this.keys.set(e,t)}getTestCurrentKey(){if(!this.currentKeyId||!this.keys.has(this.currentKeyId))return null;return{id:this.currentKeyId,key:this.keys.get(this.currentKeyId)}}getConfig(){return this.config}async box(e){if(!this.enabled)return;let t=new Date,r=this.formatConsoleTimestamp(t),n=this.formatFileTimestamp(t),{consoleText:i,fileText:o}=this.buildOutputTexts(e);if(this.shouldStyleConsole()){let l=i.split(`
16
+ `,c=c.replace(this.ANSI_PATTERN,""),this.shouldStyleConsole()){let u=this.options.showTags!==!1&&this.name?E.gray(this.formatTag(this.name)):"";console.error(this.formatConsoleMessage({timestamp:l,icon:this.options.showIcons===!1?"":E.green("\u2713"),tag:u,message:`${o}${r?` ${JSON.stringify(r)}`:""}`}))}else if(!G())console.error(c.trim());if(this.shouldWriteToFile())await this.writeToFile(c)}}async debug(e,...t){await this.log("debug",e,...t)}async info(e,...t){await this.log("info",e,...t)}async success(e,...t){await this.log("success",e,...t)}async warn(e,...t){await this.log("warning",e,...t)}async error(e,...t){await this.log("error",e,...t)}validateEncryptionConfig(){if(!this.config.rotation)return!1;if(typeof this.config.rotation==="boolean")return!1;let e=this.config.rotation,{encrypt:t}=e;return!!t}async only(e){if(!this.enabled)return;return await e()}isEnabled(){return this.enabled}setEnabled(e){this.enabled=e}extend(e){let t=`${this.name}:${e}`,r=new Rr(t,{...this.options,logDirectory:this.config.logDirectory,level:this.config.level,format:this.config.format,rotation:typeof this.config.rotation==="boolean"?void 0:this.config.rotation,timestamp:typeof this.config.timestamp==="boolean"?void 0:this.config.timestamp});return this.subLoggers.add(r),r}createReadStream(){if(G())throw Error("createReadStream is not supported in browser environments");if(!er(this.currentLogFile))throw Error(`Log file does not exist: ${this.currentLogFile}`);return zo(this.currentLogFile,{encoding:"utf8"})}async decrypt(e){if(!this.validateEncryptionConfig())throw Error("Encryption is not configured");let t=this.config.rotation;if(!t.encrypt||typeof t.encrypt==="boolean")throw Error("Invalid encryption configuration");if(!this.currentKeyId||!this.keys.has(this.currentKeyId))throw Error("No valid encryption key available");let r=this.keys.get(this.currentKeyId);try{let n=ke.isBuffer(e)?e:ke.from(e,"base64"),i=n.subarray(0,16),o=n.subarray(n.length-16),s=n.subarray(16,n.length-16),l=Xf("aes-256-gcm",r,i);l.setAuthTag(o);let a=l.update(s),c=l.final(),u=a.length+c.length,f=ke.allocUnsafe(u);return a.copy(f,0),c.copy(f,a.length),f.toString("utf8")}catch(n){throw Error(`Decryption failed: ${n instanceof Error?n.message:String(n)}`)}}getLevel(){return this.config.level}getLogDirectory(){return this.config.logDirectory}getFormat(){return this.config.format}getRotationConfig(){return this.config.rotation}isBrowserMode(){return G()}isServerMode(){return!G()}setTestEncryptionKey(e,t){this.currentKeyId=e,this.keys.set(e,t)}getTestCurrentKey(){if(!this.currentKeyId||!this.keys.has(this.currentKeyId))return null;return{id:this.currentKeyId,key:this.keys.get(this.currentKeyId)}}getConfig(){return this.config}async box(e){if(!this.enabled)return;let t=new Date,r=this.formatConsoleTimestamp(t),n=this.formatFileTimestamp(t),{consoleText:i,fileText:o}=this.buildOutputTexts(e);if(this.shouldStyleConsole()){let l=i.split(`
17
17
  `),a=Math.max(...l.map((d)=>d.length))+2,c=`\u250C${"\u2500".repeat(a)}\u2510`,u=`\u2514${"\u2500".repeat(a)}\u2518`,f=l.map((d)=>this.formatConsoleMessage({timestamp:r,message:E.cyan(d),showTimestamp:!1}));console.error(this.formatConsoleMessage({timestamp:r,message:E.cyan(c),showTimestamp:!1})),f.forEach((d)=>console.error(d)),console.error(this.formatConsoleMessage({timestamp:r,message:E.cyan(u),showTimestamp:!1}))}else if(!G())console.error(`${n} ${this.environment}.INFO: [BOX] ${o}`);let s=`${n} ${this.environment}.INFO: [BOX] ${o}
18
18
  `.replace(this.ANSI_PATTERN,"");if(this.shouldWriteToFile())await this.writeToFile(s)}async prompt(e){if(G())return Promise.resolve(!0);return new Promise((t)=>{console.error(`${E.cyan("?")} ${e} (y/n) `);let r=(n)=>{let i=n.toString().trim().toLowerCase();N.stdin.removeListener("data",r);try{if(typeof N.stdin.setRawMode==="function")N.stdin.setRawMode(!1)}catch{}N.stdin.pause(),console.error(""),t(i==="y"||i==="yes")};try{if(typeof N.stdin.setRawMode==="function")N.stdin.setRawMode(!0)}catch{}N.stdin.resume(),N.stdin.once("data",r)})}setFancy(e){this.fancy=e}isFancy(){return this.fancy}pause(){this.enabled=!1}resume(){this.enabled=!0}async start(e,...t){if(!this.enabled)return;let r=e;if(t&&t.length>0){let a=/%([sdijfo%])/g,c=0;if(r=e.replace(a,(u,f)=>{if(f==="%")return"%";if(c>=t.length)return u;let d=t[c++];switch(f){case"s":return String(d);case"d":case"i":return Number(d).toString();case"j":case"o":return JSON.stringify(d,null,2);default:return u}}),c<t.length)r+=` ${t.slice(c).map((u)=>typeof u==="object"?JSON.stringify(u,null,2):String(u)).join(" ")}`}let{consoleText:n,fileText:i}=this.buildOutputTexts(r);if(this.shouldStyleConsole()){let a=this.options.showTags!==!1&&this.name?E.gray(this.formatTag(this.name)):"",c=this.options.showIcons===!1?"":`${E.blue("\u25D0")} `;console.error(`${c}${a} ${E.cyan(n)}`)}let l=`[${new Date().toISOString()}] ${this.environment}.INFO: [START] ${i}
19
19
  `.replace(this.ANSI_PATTERN,"");if(this.shouldWriteToFile())await this.writeToFile(l)}renderProgressBar(e,t=!1){if(!this.enabled||!this.shouldStyleConsole()||!N.stdout.isTTY)return;let r=Math.min(100,Math.max(0,Math.round(e.current/e.total*100))),n=Math.round(e.barLength*r/100),i=e.barLength-n,o=E.green("\u2501".repeat(n)),s=E.gray("\u2501".repeat(i)),l=`[${o}${s}]`,a=`${r}%`.padStart(4),c=e.message?` ${e.message}`:"",u=this.options.showIcons===!1?"":t||r===100?E.green("\u2713"):E.blue("\u25B6"),f=this.options.showTags!==!1&&this.name?` ${E.gray(this.formatTag(this.name))}`:"",d=`\r${u}${f} ${l} ${a}${c}`,h=N.stdout.columns||80,g=" ".repeat(Math.max(0,h-d.replace(this.ANSI_PATTERN,"").length));if(e.lastRenderedLine=`${d}${g}`,N.stdout.write(e.lastRenderedLine),t)N.stdout.write(`
20
- `)}finishProgressBar(e,t){if(!this.enabled||!this.fancy||G()||!N.stdout.isTTY){this.activeProgressBar=null;return}if(e.current<e.total)e.current=e.total;if(t)e.message=t;this.renderProgressBar(e,!0),this.activeProgressBar=null}async clear(e={}){if(G()){console.warn("Log clearing is not supported in browser environments.");return}try{console.warn("Clearing logs...",this.config.logDirectory);let t=await tr(this.config.logDirectory),r=[];for(let n of t){if(!(e.name?new RegExp(e.name.replace("*",".*")).test(n):n.startsWith(this.name))||!n.endsWith(".log"))continue;let o=at(this.config.logDirectory,n);if(e.before)try{if((await st(o)).mtime>=e.before)continue}catch(s){console.error(`Failed to get stats for file ${o}:`,s);continue}r.push(o)}if(r.length===0){console.warn("No log files matched the criteria for clearing.");return}console.warn(`Preparing to delete ${r.length} log file(s)...`);for(let n of r)try{await rr(n),console.warn(`Deleted log file: ${n}`)}catch(i){console.error(`Failed to delete log file ${n}:`,i)}console.warn("Log clearing process finished.")}catch(t){console.error("Error during log clearing process:",t)}}}async function As(e,t={}){let{maxRetries:r=3,retryDelay:n=1000,isRetryable:i=()=>!0,fallback:o}=t,s=Error("Unknown error occurred");for(let l=0;l<=r;l++)try{return await e()}catch(a){if(s=a instanceof Error?a:Error(String(a)),l===r||!i(s))break;if(n>0)await new Promise((c)=>setTimeout(c,n))}if(o!==void 0)return o;throw s instanceof Error?s:Error(`Unknown error: ${String(s)}`)}function Es(e){return e instanceof ae}function Fd(e){return e instanceof kr}function jd(e){if(Es(e))return e.code==="FILE_SYSTEM_ERROR"||e.code==="BROWSER_CONFIG_ERROR";return["ENOENT","EACCES","EMFILE","ENFILE","EBUSY","network","timeout","connection"].some((r)=>e.message.toLowerCase().includes(r.toLowerCase()))}class Or{defaultParsers;constructor(){this.defaultParsers=[{name:"boolean",canParse:(e,t)=>t==="boolean"||["true","false","1","0","yes","no"].includes(e.toLowerCase()),parse:(e)=>{let t=e.toLowerCase();return["true","1","yes"].includes(t)}},{name:"number",canParse:(e,t)=>t==="number"||!Number.isNaN(Number(e))&&!Number.isNaN(Number.parseFloat(e)),parse:(e)=>{let t=Number(e);if(Number.isNaN(t))throw TypeError(`Cannot parse "${e}" as number`);return t}},{name:"array",canParse:(e,t)=>t==="array"||e.startsWith("[")||e.includes(","),parse:(e)=>{try{let t=JSON.parse(e);if(Array.isArray(t))return t}catch{}return e.split(",").map((t)=>t.trim())}},{name:"json",canParse:(e,t)=>t==="object"||(e.startsWith("{")&&e.endsWith("}")||e.startsWith("[")&&e.endsWith("]")),parse:(e)=>{try{return JSON.parse(e)}catch(t){throw Error(`Cannot parse "${e}" as JSON: ${t}`)}}}]}async applyEnvironmentVariables(e,t,r={}){let{prefix:n,useCamelCase:i=!0,useBackwardCompatibility:o=!0,customParsers:s={},verbose:l=!1,trackPerformance:a=!0}=r,c=async()=>{if(!e)return{config:t,source:{type:"environment",priority:50,timestamp:new Date}};let u=n||this.generateEnvPrefix(e),f={...t};return this.processObject(f,[],u,{useCamelCase:i,useBackwardCompatibility:o,customParsers:s,verbose:l,configName:e}),{config:f,source:{type:"environment",priority:50,timestamp:new Date}}};if(a)return Pt.track("applyEnvironmentVariables",c,{configName:e});return c()}generateEnvPrefix(e){return e.toUpperCase().replace(/-/g,"_")}formatEnvKey(e,t){if(!t)return e.toUpperCase();return e.replace(/([A-Z])/g,"_$1").toUpperCase()}processObject(e,t,r,n){for(let[i,o]of Object.entries(e)){let s=[...t,i],l=s.map((u)=>this.formatEnvKey(u,n.useCamelCase)),a=`${r}_${l.join("_")}`,c=n.useBackwardCompatibility?`${r}_${s.map((u)=>u.toUpperCase()).join("_")}`:null;if(n.verbose);if(typeof o==="object"&&o!==null&&!Array.isArray(o))this.processObject(o,s,r,n);else{let u=nr.env[a]||(c?nr.env[c]:void 0);if(u!==void 0){if(n.verbose){let f=nr.env[a]?a:c}try{e[i]=this.parseEnvironmentValue(u,typeof o,a,n.customParsers,n.configName)}catch(f){if(f instanceof Sr)throw f;throw Fe.envVar(a,u,typeof o,n.configName)}}}}}parseEnvironmentValue(e,t,r,n,i){for(let[o,s]of Object.entries(n))try{return s(e)}catch{continue}for(let o of this.defaultParsers)if(o.canParse(e,t))try{return o.parse(e)}catch{throw Fe.envVar(r,e,`${t} (via ${o.name} parser)`,i)}return e}getEnvironmentVariables(e){let t={},r=e.toUpperCase();for(let[n,i]of Object.entries(nr.env))if(n.startsWith(r)&&i!==void 0)t[n]=i;return t}validateEnvironmentVariable(e,t,r){let n=[];if(!/^[A-Z_][A-Z0-9_]*$/.test(e))n.push(`Environment variable key "${e}" should only contain uppercase letters, numbers, and underscores`);if(r)try{this.parseEnvironmentValue(e,t,r,{})}catch(i){n.push(`Cannot parse value "${t}" as ${r}: ${i}`)}return{isValid:n.length===0,errors:n}}generateEnvVarDocs(e,t,r={}){let{prefix:n,format:i="text"}=r,o=n||this.generateEnvPrefix(e),s=[];switch(this.extractEnvVarInfo(t,[],o,s),i){case"markdown":return this.formatAsMarkdown(s,e);case"json":return JSON.stringify(s,null,2);default:return this.formatAsText(s,e)}}extractEnvVarInfo(e,t,r,n){for(let[i,o]of Object.entries(e)){let s=[...t,i],l=`${r}_${s.map((a)=>this.formatEnvKey(a,!0)).join("_")}`;if(typeof o==="object"&&o!==null&&!Array.isArray(o))this.extractEnvVarInfo(o,s,r,n);else n.push({key:l,type:Array.isArray(o)?"array":typeof o,description:`Configuration for ${s.join(".")}`,example:this.generateExample(o)})}}generateExample(e){if(Array.isArray(e))return JSON.stringify(e);if(typeof e==="object"&&e!==null)return JSON.stringify(e);return String(e)}formatAsText(e,t){let r=`Environment Variables for ${t}:
20
+ `)}finishProgressBar(e,t){if(!this.enabled||!this.fancy||G()||!N.stdout.isTTY){this.activeProgressBar=null;return}if(e.current<e.total)e.current=e.total;if(t)e.message=t;this.renderProgressBar(e,!0),this.activeProgressBar=null}async clear(e={}){if(G()){console.warn("Log clearing is not supported in browser environments.");return}try{console.warn("Clearing logs...",this.config.logDirectory);let t=await tr(this.config.logDirectory),r=[];for(let n of t){if(!(e.name?new RegExp(e.name.replace("*",".*")).test(n):n.startsWith(this.name))||!n.endsWith(".log"))continue;let o=at(this.config.logDirectory,n);if(e.before)try{if((await st(o)).mtime>=e.before)continue}catch(s){console.error(`Failed to get stats for file ${o}:`,s);continue}r.push(o)}if(r.length===0){console.warn("No log files matched the criteria for clearing.");return}console.warn(`Preparing to delete ${r.length} log file(s)...`);for(let n of r)try{await rr(n),console.warn(`Deleted log file: ${n}`)}catch(i){console.error(`Failed to delete log file ${n}:`,i)}console.warn("Log clearing process finished.")}catch(t){console.error("Error during log clearing process:",t)}}}async function As(e,t={}){let{maxRetries:r=3,retryDelay:n=1000,isRetryable:i=()=>!0,fallback:o}=t,s=Error("Unknown error occurred");for(let l=0;l<=r;l++)try{return await e()}catch(a){if(s=a instanceof Error?a:Error(String(a)),l===r||!i(s))break;if(n>0)await new Promise((c)=>setTimeout(c,n))}if(o!==void 0)return o;throw s instanceof Error?s:Error(`Unknown error: ${String(s)}`)}function Es(e){return e instanceof ae}function jd(e){return e instanceof kr}function Dd(e){if(Es(e))return e.code==="FILE_SYSTEM_ERROR"||e.code==="BROWSER_CONFIG_ERROR";return["ENOENT","EACCES","EMFILE","ENFILE","EBUSY","network","timeout","connection"].some((r)=>e.message.toLowerCase().includes(r.toLowerCase()))}class Or{defaultParsers;constructor(){this.defaultParsers=[{name:"boolean",canParse:(e,t)=>t==="boolean"||["true","false","1","0","yes","no"].includes(e.toLowerCase()),parse:(e)=>{let t=e.toLowerCase();return["true","1","yes"].includes(t)}},{name:"number",canParse:(e,t)=>t==="number"||!Number.isNaN(Number(e))&&!Number.isNaN(Number.parseFloat(e)),parse:(e)=>{let t=Number(e);if(Number.isNaN(t))throw TypeError(`Cannot parse "${e}" as number`);return t}},{name:"array",canParse:(e,t)=>t==="array"||e.startsWith("[")||e.includes(","),parse:(e)=>{try{let t=JSON.parse(e);if(Array.isArray(t))return t}catch{}return e.split(",").map((t)=>t.trim())}},{name:"json",canParse:(e,t)=>t==="object"||(e.startsWith("{")&&e.endsWith("}")||e.startsWith("[")&&e.endsWith("]")),parse:(e)=>{try{return JSON.parse(e)}catch(t){throw Error(`Cannot parse "${e}" as JSON: ${t}`)}}}]}async applyEnvironmentVariables(e,t,r={}){let{prefix:n,useCamelCase:i=!0,useBackwardCompatibility:o=!0,customParsers:s={},verbose:l=!1,trackPerformance:a=!0}=r,c=async()=>{if(!e)return{config:t,source:{type:"environment",priority:50,timestamp:new Date}};let u=n||this.generateEnvPrefix(e),f={...t};return this.processObject(f,[],u,{useCamelCase:i,useBackwardCompatibility:o,customParsers:s,verbose:l,configName:e}),{config:f,source:{type:"environment",priority:50,timestamp:new Date}}};if(a)return Pt.track("applyEnvironmentVariables",c,{configName:e});return c()}generateEnvPrefix(e){return e.toUpperCase().replace(/-/g,"_")}formatEnvKey(e,t){if(!t)return e.toUpperCase();return e.replace(/([A-Z])/g,"_$1").toUpperCase()}processObject(e,t,r,n){for(let[i,o]of Object.entries(e)){let s=[...t,i],l=s.map((u)=>this.formatEnvKey(u,n.useCamelCase)),a=`${r}_${l.join("_")}`,c=n.useBackwardCompatibility?`${r}_${s.map((u)=>u.toUpperCase()).join("_")}`:null;if(n.verbose);if(typeof o==="object"&&o!==null&&!Array.isArray(o))this.processObject(o,s,r,n);else{let u=nr.env[a]||(c?nr.env[c]:void 0);if(u!==void 0){if(n.verbose){let f=nr.env[a]?a:c}try{e[i]=this.parseEnvironmentValue(u,typeof o,a,n.customParsers,n.configName)}catch(f){if(f instanceof Sr)throw f;throw Fe.envVar(a,u,typeof o,n.configName)}}}}}parseEnvironmentValue(e,t,r,n,i){for(let[o,s]of Object.entries(n))try{return s(e)}catch{continue}for(let o of this.defaultParsers)if(o.canParse(e,t))try{return o.parse(e)}catch{throw Fe.envVar(r,e,`${t} (via ${o.name} parser)`,i)}return e}getEnvironmentVariables(e){let t={},r=e.toUpperCase();for(let[n,i]of Object.entries(nr.env))if(n.startsWith(r)&&i!==void 0)t[n]=i;return t}validateEnvironmentVariable(e,t,r){let n=[];if(!/^[A-Z_][A-Z0-9_]*$/.test(e))n.push(`Environment variable key "${e}" should only contain uppercase letters, numbers, and underscores`);if(r)try{this.parseEnvironmentValue(e,t,r,{})}catch(i){n.push(`Cannot parse value "${t}" as ${r}: ${i}`)}return{isValid:n.length===0,errors:n}}generateEnvVarDocs(e,t,r={}){let{prefix:n,format:i="text"}=r,o=n||this.generateEnvPrefix(e),s=[];switch(this.extractEnvVarInfo(t,[],o,s),i){case"markdown":return this.formatAsMarkdown(s,e);case"json":return JSON.stringify(s,null,2);default:return this.formatAsText(s,e)}}extractEnvVarInfo(e,t,r,n){for(let[i,o]of Object.entries(e)){let s=[...t,i],l=`${r}_${s.map((a)=>this.formatEnvKey(a,!0)).join("_")}`;if(typeof o==="object"&&o!==null&&!Array.isArray(o))this.extractEnvVarInfo(o,s,r,n);else n.push({key:l,type:Array.isArray(o)?"array":typeof o,description:`Configuration for ${s.join(".")}`,example:this.generateExample(o)})}}generateExample(e){if(Array.isArray(e))return JSON.stringify(e);if(typeof e==="object"&&e!==null)return JSON.stringify(e);return String(e)}formatAsText(e,t){let r=`Environment Variables for ${t}:
21
21
 
22
22
  `;for(let n of e)r+=`${n.key}
23
23
  `,r+=` Type: ${n.type}
@@ -29,25 +29,25 @@ var Ac=(e,t,r)=>()=>{if(e)try{t=e(e=0)}catch(n){r=[n]}if(r)throw r[0];return t};
29
29
  `;r+=`| Variable | Type | Description | Example |
30
30
  `,r+=`|----------|------|-------------|----------|
31
31
  `;for(let n of e)r+=`| \`${n.key}\` | ${n.type} | ${n.description} | \`${n.example}\` |
32
- `;return r}}function Dd(e,t){let r=Ps("process");if(typeof r>"u"||!r.env)return t;let n=r.env[e];return n!==void 0?n:t}function Ts(e,t,r={}){return Ns(e,t,r,new WeakMap)}function Ns(e,t,r,n){let{arrayMergeMode:i="replace",skipNullish:o=!1,customMerger:s}=r;if(t===null||t===void 0)return o?e:t;if(s){let l=s(e,t);if(l!==void 0)return l}if(Array.isArray(t)||Array.isArray(e))return Os(e,t,i,n);if(!ce(t)||!ce(e))return t;return Wd(e,t,r,n)}function Os(e,t,r,n){if(Array.isArray(t)&&!Array.isArray(e))return t;if(Array.isArray(e)&&!Array.isArray(t))return t;if(Array.isArray(t)&&Array.isArray(e))switch(r){case"replace":return t;case"concat":return Bd(e,t);case"smart":return Ud(e,t,n);default:return t}return t}function Bd(e,t){let r=[...t];for(let n of e)if(!r.some((i)=>qn(i,n)))r.push(n);return r}function Ud(e,t,r){if(t.length===0)return e;if(e.length===0)return t;if(ce(t[0])&&ce(e[0]))return Vd(e,t,r);if(t.every((n)=>typeof n==="string")&&e.every((n)=>typeof n==="string")){let n=[...t];for(let i of e)if(!n.includes(i))n.push(i);return n}return t}function Vd(e,t,r){let n=[...t];for(let i of e){if(!ce(i)){n.push(i);continue}let o=["id","name","key","path","type"],s=!1;for(let l of o)if(l in i){if(n.find((c)=>ce(c)&&(l in c)&&c[l]===i[l])){s=!0;break}}if(!s)n.push(i)}return n}function Wd(e,t,r,n){let i=t;if(ce(i)&&n.has(i))return n.get(i);let o={...e};if(ce(i))n.set(i,o);for(let s in i){if(!Object.prototype.hasOwnProperty.call(i,s))continue;let l=i[s],a=o[s];if(r.skipNullish&&(l===null||l===void 0))continue;if(l===null||l===void 0){o[s]=l;continue}if(ce(l)&&ce(a))o[s]=Ns(a,l,r,n);else if(Array.isArray(l)||Array.isArray(a))o[s]=Os(a,l,r.arrayMergeMode||"smart",n);else o[s]=l}return o}function ci(e,t,r="replace"){return Ts(e,t,{arrayMergeMode:r==="replace"?"replace":"smart",skipNullish:!0})}function qn(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(!qn(e[r],t[r]))return!1;return!0}if(ce(e)&&ce(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(!qn(e[i],t[i]))return!1}return!0}return!1}function ce(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}class Ir{extensions=[".ts",".js",".mjs",".cjs",".json",".mts",".cts"];async loadFromPath(e,t,r={}){let{arrayStrategy:n="replace",useCache:i=!0,cacheTtl:o,trackPerformance:s=!0,verbose:l=!1}=r;if(i){let c=dt.getWithFileCheck("file",e);if(c){if(l)console.log(`Configuration loaded from cache: ${e}`);return c}}let a=async()=>{if(!ir(e))return null;try{let c=`?t=${Date.now()}`,u=await import(e+c),f=u.default||u,d="default"in u,h=Object.keys(u).length>0;if(!d&&!h)throw new Ot(e,Error("Configuration file is empty and exports nothing"),"unknown");if(typeof f!=="object"||f===null||Array.isArray(f))throw new Ot(e,Error("Configuration must export a valid object"),"unknown");let p={config:ci(t,f,n),source:{type:"file",path:e,priority:100,timestamp:new Date}};if(i)dt.setWithFileCheck("file",p,e,o);return p}catch(c){throw c instanceof Error?Fe.configLoad(e,c):Fe.configLoad(e,Error(String(c)))}};if(s)return Pt.track("loadFromPath",a,{path:e});return a()}async tryLoadFromPaths(e,t,r={}){for(let n of e)try{let i=await this.loadFromPath(n,t,r);if(i)return i}catch(i){if(i instanceof Error&&i.name==="ConfigLoadError")throw i;if(r.verbose)console.warn(`Failed to load config from ${n}:`,i)}return null}generateConfigPaths(e,t,r){let n=this.generateNamePatterns(e,r),i=[];for(let o of n)for(let s of this.extensions)i.push(Ln(t,`${o}${s}`));return i}generateNamePatterns(e,t){let r=[];if(r.push("config",".config"),e)r.push(e,`.${e}.config`,`${e}.config`,`.${e}`);if(t){if(r.push(t,`.${t}.config`,`${t}.config`,`.${t}`),e)r.push(`${e}.${t}.config`,`.${e}.${t}.config`)}return r.filter(Boolean)}checkFileAccess(e){return As(async()=>ir(e),{maxRetries:2,retryDelay:100,fallback:!1})}async discoverConfigFiles(e,t,r){let n=[];if(!ir(e))return n;if(t||r){let i=this.generateNamePatterns(t||"",r);for(let o of i)for(let s of this.extensions){let l=Ln(e,`${o}${s}`);if(await this.checkFileAccess(l))n.push(l)}}else try{let{readdirSync:i}=await import("fs"),o=i(e);for(let s of o)if(this.looksLikeConfigFile(s)){let l=Ln(e,s);if(await this.checkFileAccess(l))n.push(l)}}catch{return[]}return n}looksLikeConfigFile(e){return[/\.config\.(ts|js|mjs|cjs|json|mts|cts)$/,/^\..*\.(ts|js|mjs|cjs|json|mts|cts)$/,/config\.(ts|js|mjs|cjs|json|mts|cts)$/].some((r)=>r.test(e))}async validateConfigFile(e){let t=[];try{if(!ir(e))return t.push("Configuration file does not exist"),t;let r=await import(e),n=r.default||r;if(n===void 0)t.push("Configuration file must export a default value or named exports");else if(typeof n!=="object"||n===null)t.push("Configuration must be an object");else if(Array.isArray(n))t.push("Configuration cannot be an array at the root level");if(e.endsWith(".json"))try{let{readFileSync:i}=await import("fs"),o=i(e,"utf8");JSON.parse(o)}catch(i){t.push(`Invalid JSON syntax: ${i}`)}}catch(r){t.push(`Failed to load configuration file: ${r}`)}return t}async getFileModificationTime(e){try{let{statSync:t}=await import("fs");return t(e).mtime}catch{return null}}async preloadConfigurations(e,t={}){let r=new Map;return await Promise.allSettled(e.map(async(n)=>{try{let i=await this.loadFromPath(n,{},t);if(i)r.set(n,i.config)}catch(i){if(t.verbose)console.warn(`Failed to preload ${n}:`,i)}})),r}}class ui{async validateConfiguration(e,t,r={}){let{stopOnFirstError:n=!1,validateRequired:i=!0,validateTypes:o=!0,customRules:s=[],trackPerformance:l=!0,verbose:a=!1}=r,c=async()=>{let u=[],f=[],d={stopOnFirstError:n,validateRequired:i,validateTypes:o,customRules:s,trackPerformance:l,verbose:a};try{if(typeof t==="string")return await this.validateWithSchemaFile(e,t,d);else if(Array.isArray(t))return this.validateWithRules(e,[...t,...s],d);else return this.validateWithJSONSchema(e,t,d)}catch(h){return u.push({path:"",message:`Validation failed: ${h}`,rule:"system"}),{isValid:!1,errors:u,warnings:f}}};if(l)return await Pt.track("validateConfiguration",c);return c()}async validateWithSchemaFile(e,t,r){try{if(!id(t))throw new It(t,[{path:"",message:"Schema file does not exist"}]);let n=await import(t),i=n.default||n;if(Array.isArray(i))return this.validateWithRules(e,i,r);else return this.validateWithJSONSchema(e,i,r)}catch(n){throw new It(t,[{path:"",message:`Failed to load schema: ${n}`}])}}validateWithJSONSchema(e,t,r){let n=[],i=[];return this.validateObjectAgainstSchema(e,t,"",n,i,r),{isValid:n.length===0,errors:n,warnings:i}}validateObjectAgainstSchema(e,t,r,n,i,o){if(o.validateTypes&&t.type){let s=Array.isArray(e)?"array":typeof e,l=Array.isArray(t.type)?t.type:[t.type];if(!l.includes(s)){if(n.push({path:r,message:`Expected type ${l.join(" or ")}, got ${s}`,expected:l.join(" or "),actual:s,rule:"type"}),o.stopOnFirstError)return}}if(t.enum&&!t.enum.includes(e)){if(n.push({path:r,message:`Value must be one of: ${t.enum.join(", ")}`,expected:t.enum.join(", "),actual:e,rule:"enum"}),o.stopOnFirstError)return}if(typeof e==="string"){if(t.minLength!==void 0&&e.length<t.minLength)n.push({path:r,message:`String length must be at least ${t.minLength}`,expected:`>= ${t.minLength}`,actual:e.length,rule:"minLength"});if(t.maxLength!==void 0&&e.length>t.maxLength)n.push({path:r,message:`String length must not exceed ${t.maxLength}`,expected:`<= ${t.maxLength}`,actual:e.length,rule:"maxLength"});if(t.pattern){if(!new RegExp(t.pattern).test(e))n.push({path:r,message:`String does not match pattern ${t.pattern}`,expected:t.pattern,actual:e,rule:"pattern"})}}if(typeof e==="number"){if(t.minimum!==void 0&&e<t.minimum)n.push({path:r,message:`Value must be at least ${t.minimum}`,expected:`>= ${t.minimum}`,actual:e,rule:"minimum"});if(t.maximum!==void 0&&e>t.maximum)n.push({path:r,message:`Value must not exceed ${t.maximum}`,expected:`<= ${t.maximum}`,actual:e,rule:"maximum"})}if(Array.isArray(e)&&t.items)for(let s=0;s<e.length;s++){let l=r?`${r}[${s}]`:`[${s}]`;if(this.validateObjectAgainstSchema(e[s],t.items,l,n,i,o),o.stopOnFirstError&&n.length>0)return}if(e&&typeof e==="object"&&!Array.isArray(e)){let s=e;if(o.validateRequired&&t.required){for(let l of t.required)if(!(l in s)){if(n.push({path:r?`${r}.${l}`:l,message:`Missing required property '${l}'`,expected:"required",rule:"required"}),o.stopOnFirstError)return}}if(t.properties){for(let[l,a]of Object.entries(t.properties))if(l in s){let c=r?`${r}.${l}`:l;if(this.validateObjectAgainstSchema(s[l],a,c,n,i,o),o.stopOnFirstError&&n.length>0)return}}if(t.additionalProperties===!1){let l=new Set(Object.keys(t.properties||{}));for(let a of Object.keys(s))if(!l.has(a))i.push({path:r?`${r}.${a}`:a,message:`Additional property '${a}' is not allowed`,rule:"additionalProperties"})}}}validateWithRules(e,t,r){let n=[],i=[];for(let o of t)try{let s=this.getValueByPath(e,o.path),l=this.validateWithRule(s,o,o.path);if(n.push(...l),r.stopOnFirstError&&n.length>0)break}catch(s){n.push({path:o.path,message:`Rule validation failed: ${s}`,rule:"system"})}return{isValid:n.length===0,errors:n,warnings:i}}validateWithRule(e,t,r){let n=[];if(t.required&&(e===void 0||e===null))return n.push({path:r,message:t.message||`Property '${r}' is required`,expected:"required",rule:"required"}),n;if(e===void 0||e===null)return n;if(t.type){let i=Array.isArray(e)?"array":typeof e;if(i!==t.type)n.push({path:r,message:t.message||`Expected type ${t.type}, got ${i}`,expected:t.type,actual:i,rule:"type"})}if(t.min!==void 0){let i=Array.isArray(e)?e.length:typeof e==="string"?e.length:typeof e==="number"?e:0;if(i<t.min)n.push({path:r,message:t.message||`Value must be at least ${t.min}`,expected:`>= ${t.min}`,actual:i,rule:"min"})}if(t.max!==void 0){let i=Array.isArray(e)?e.length:typeof e==="string"?e.length:typeof e==="number"?e:0;if(i>t.max)n.push({path:r,message:t.message||`Value must not exceed ${t.max}`,expected:`<= ${t.max}`,actual:i,rule:"max"})}if(t.pattern&&typeof e==="string"){if(!t.pattern.test(e))n.push({path:r,message:t.message||`Value does not match pattern ${t.pattern}`,expected:t.pattern.toString(),actual:e,rule:"pattern"})}if(t.enum&&!t.enum.includes(e))n.push({path:r,message:t.message||`Value must be one of: ${t.enum.join(", ")}`,expected:t.enum.join(", "),actual:e,rule:"enum"});if(t.validator){let i=t.validator(e);if(i)n.push({path:r,message:t.message||i,rule:"custom"})}return n}getValueByPath(e,t){if(!t)return e;let r=t.split("."),n=e;for(let i of r)if(n&&typeof n==="object"&&i in n)n=n[i];else return;return n}generateRulesFromInterface(e){let t=[],r=e.matchAll(/(\w+)(\?)?:\s*(\w+)/g);for(let n of r){let[,i,o,s]=n;t.push({path:i,required:!o,type:this.mapTypeScriptType(s)})}return t}mapTypeScriptType(e){switch(e.toLowerCase()){case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"array":return"array";case"object":return"object";default:return"object"}}static createCommonRules(){return{server:[{path:"port",required:!0,type:"number",min:1,max:65535},{path:"host",required:!0,type:"string",min:1},{path:"ssl",type:"boolean"}],database:[{path:"url",required:!0,type:"string",min:1},{path:"pool",type:"number",min:1,max:100},{path:"timeout",type:"number",min:0}],api:[{path:"baseUrl",required:!0,type:"string",pattern:js},{path:"timeout",type:"number",min:0},{path:"retries",type:"number",min:0,max:10}]}}}class fi{fileLoader=new Ir;envProcessor=new Or;validator=new ui;async loadConfig(e){let t=Date.now(),{cache:r,performance:n,schema:i,validate:o,...s}=e;try{if(r?.enabled){let a=this.checkCache(s.name||"",s);if(a)return a}let l;try{l=await this.loadConfigurationStrategies(s,!0,r)}catch(a){let c=s.__strictErrorHandling;if(a instanceof Error&&a.name==="ConfigNotFoundError"){if(c)throw a;l={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`No configuration file found for "${s.name||"config"}", using defaults with environment variables`]}}else if(a instanceof Error&&a.name==="ConfigLoadError"){let u=a.message.includes("EACCES")||a.message.includes("EPERM")||a.message.includes("permission denied"),f=!u&&(a.message.includes("syntax")||a.message.includes("Expected")||a.message.includes("Unexpected")||a.message.includes("BuildMessage")||a.message.includes("errors building")),d=a.message.includes("Configuration must export a valid object")||a.message.includes("Configuration file is empty and exports nothing");if(c&&(d||u))throw a;if(f&&(!c||!d))l={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:["Configuration file has syntax errors, using defaults with environment variables"]};else if(!c)l={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`Configuration loading error, using defaults: ${a.message}`]};else throw a}else l={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`Configuration loading failed, using defaults: ${a instanceof Error?a.message:String(a)}`]}}if(i||o)await this.validateConfiguration(l.config,i,o,s.name);if(r?.enabled&&l)this.cacheResult(s.name||"",l,r,s);if(n?.enabled){let a={operation:"loadConfig",duration:Date.now()-t,configName:s.name,timestamp:new Date};if(n.onMetrics)n.onMetrics(a);if(n.slowThreshold&&a.duration>n.slowThreshold)ge.warn(`Slow configuration loading detected: ${a.duration}ms for ${s.name}`);l.metrics=a}return l}catch(l){let a=Date.now()-t;throw ge.error(`Configuration loading failed after ${a}ms:`,[l instanceof Error?l:Error(String(l))]),l}}async loadConfigurationStrategies(e,t=!1,r){let{name:n="",alias:i,cwd:o,configDir:s,defaultConfig:l,checkEnv:a=!0,arrayStrategy:c="replace",verbose:u=!1}=e,f=o||He.cwd(),d=[],h=await this.loadLocalConfiguration(n,i,f,s,l,c,u,a,r);if(h)return d.push(...this.getLocalSearchPaths(n,i,f,s)),this.finalizeResult(h,d,a,n,u);let g=await this.loadHomeConfiguration(n,i,l,c,u,a);if(g)return d.push(...this.getHomeSearchPaths(n,i)),this.finalizeResult(g,d,a,n,u);let m=await this.loadPackageJsonConfiguration(n,i,f,l,c,u,a);if(m)return d.push(ne(f,"package.json")),this.finalizeResult(m,d,a,n,u);if(d.push(...this.getAllSearchPaths(n,i,f,s)),t)throw Fe.configNotFound(n,d,i);return{...await this.applyEnvironmentVariables(n,l,a,u),warnings:[`No configuration file found for "${n}"${i?` or alias "${i}"`:""}, using defaults with environment variables`]}}async loadLocalConfiguration(e,t,r,n,i,o,s,l,a){let c=l?Tt(e,i,s):i,u=this.getLocalDirectories(r,n);for(let f of u){if(s)ge.info(`Searching for configuration in: ${f}`);let d=this.fileLoader.generateConfigPaths(e,f,t),h=await this.fileLoader.tryLoadFromPaths(d,c,{arrayStrategy:o,verbose:s,cacheTtl:a?.ttl,useCache:!a?.ttl||a.ttl>100});if(h){if(s)ge.success(`Configuration loaded from: ${h.source.path}`);return h}}return null}async loadHomeConfiguration(e,t,r,n,i,o){if(!e)return null;let s=o?Tt(e,r,i):r,l=[ne(rt(),".config",e),ne(rt(),".config"),rt()];for(let a of l){if(i)ge.info(`Checking home directory: ${a}`);let c=this.fileLoader.generateConfigPaths(e,a,t),u=await this.fileLoader.tryLoadFromPaths(c,s,{arrayStrategy:n,verbose:i});if(u){if(i)ge.success(`Configuration loaded from home directory: ${u.source.path}`);return u}}return null}async loadPackageJsonConfiguration(e,t,r,n,i,o,s){let l=s?Tt(e,n,o):n;try{let a=ne(r,"package.json");if(!Gn(a))return null;let c=await import(a),u=c[e],f=e;if(!u&&t)u=c[t],f=t;if(u&&typeof u==="object"&&!Array.isArray(u)){if(o)ge.success(`Configuration loaded from package.json: ${f}`);return{config:ci(l,u,i),source:{type:"package.json",path:a,priority:30,timestamp:new Date}}}}catch(a){if(o)ge.warn("Failed to load package.json:",[a instanceof Error?a:Error(String(a))])}return null}async applyEnvironmentVariables(e,t,r,n){if(!r||!e||typeof t!=="object"||t===null||Array.isArray(t))return{config:t,source:{type:"default",priority:10,timestamp:new Date}};return{config:Tt(e,t,n),source:{type:"environment",priority:20,timestamp:new Date}}}async finalizeResult(e,t,r,n,i){return{config:e.config,source:e.source,path:e.source.path}}async validateConfiguration(e,t,r,n){let i=[];if(r){let o=r(e);if(o)i.push(...o)}if(t){let o=await this.validator.validateConfiguration(e,t);if(!o.isValid)i.push(...o.errors.map((s)=>s.path?`${s.path}: ${s.message}`:s.message))}if(i.length>0)throw Fe.configValidation(n||"unknown",i,n)}checkCache(e,t){let r=this.generateCacheKey(e,t);return dt.get(r)||null}cacheResult(e,t,r,n){let i=this.generateCacheKey(e,n);dt.set(i,t,void 0,r.ttl)}generateCacheKey(e,t){let r=[e];if(t.alias)r.push(`alias:${t.alias}`);if(t.cwd)r.push(`cwd:${t.cwd}`);if(t.configDir)r.push(`configDir:${t.configDir}`);if("checkEnv"in t)r.push(`checkEnv:${t.checkEnv}`);return r.join("|")}getLocalDirectories(e,t){return Array.from(new Set([e,ne(e,"config"),ne(e,".config"),t?ne(e,t):void 0].filter(Boolean)))}getAllSearchPaths(e,t,r,n){let i=[];return i.push(...this.getLocalSearchPaths(e,t,r,n)),i.push(...this.getHomeSearchPaths(e,t)),i.push(ne(r,"package.json")),i}getLocalSearchPaths(e,t,r,n){let i=this.getLocalDirectories(r,n),o=[];for(let s of i)o.push(...this.fileLoader.generateConfigPaths(e,s,t));return o}getHomeSearchPaths(e,t){if(!e)return[];let r=[ne(rt(),".config",e),ne(rt(),".config"),rt()],n=[];for(let i of r)n.push(...this.fileLoader.generateConfigPaths(e,i,t));return n}async loadConfigWithResult(e){return this.loadConfig(e)}}function is(e){let r=!(e.message.includes("EACCES")||e.message.includes("EPERM")||e.message.includes("permission denied"))&&(e.message.includes("syntax")||e.message.includes("Expected")||e.message.includes("Unexpected")||e.message.includes("BuildMessage")),n=e.message.includes("Configuration must export a valid object")||e.message.includes("Configuration file is empty and exports nothing");return r||n}async function zd(e){return Ne.loadConfig({...e,__strictErrorHandling:!0})}async function Is(e){let t="defaultConfig"in e&&e.defaultConfig!==void 0?e.defaultConfig:{},r="cache"in e||"performance"in e||"schema"in e||"validate"in e;try{let n;if(r)n=await Ne.loadConfig(e);else n=await Ne.loadConfig({...e,defaultConfig:t,cache:{enabled:!0},performance:{enabled:!1}});return n?.config??t}catch(n){let i=n instanceof Error?n.name:"UnknownError",o=n instanceof Error?n.message:String(n);if(!(i==="ConfigNotFoundError"||i==="ConfigLoadError"||i==="ConfigValidationError"||o.includes("config"))&&e.verbose)ge.warn("Unexpected error loading config, using defaults:",[n instanceof Error?n:Error(String(n))]);let l=r?{...e,defaultConfig:t}:{...e,defaultConfig:t,cache:{enabled:!0},performance:{enabled:!1}};if("checkEnv"in e?e.checkEnv!==!1:!0)return(await Ne.applyEnvironmentVariables(l.name||"",t,!0,l.verbose||!1))?.config??t;return t}}async function Kd(e={defaultConfig:{}}){if(typeof e==="string"){let{cwd:t}=await import("process");try{return(await Ne.loadConfig({name:e,cwd:t(),generatedDir:"./generated",configDir:"./config",defaultConfig:{},checkEnv:!0,arrayStrategy:"replace"})).config}catch(r){if(r instanceof Error&&(r.name==="ConfigNotFoundError"||r.name==="ConfigLoadError"&&is(r)))return(await Ne.applyEnvironmentVariables(e,{},!0,!1)).config;throw r}}try{return(await Ne.loadConfig({...e,cwd:e.cwd||He.cwd(),cache:{enabled:!0},performance:{enabled:!1}})).config}catch(t){if(t instanceof Error&&(t.name==="ConfigNotFoundError"||t.name==="ConfigLoadError"&&is(t)))return(await Ne.applyEnvironmentVariables(e.name||"",e.defaultConfig||{},e.checkEnv!==!1,e.verbose||!1)).config;throw t}}async function Gd(e,t,r="replace"){let n=new Ir;try{let i=await n.loadFromPath(e,t,{arrayStrategy:r,useCache:!1,trackPerformance:!1});return i?i.config:null}catch{return null}}function Tt(e,t,r=!1){let n=new Or,i=e.toUpperCase().replace(/[^A-Z0-9]/g,"_");function o(s,l=[]){let a={...s};for(let[c,u]of Object.entries(s)){let f=[...l,c],d=[`${i}_${f.join("_").toUpperCase()}`,`${i}_${f.map((m)=>m.toUpperCase()).join("")}`,`${i}_${f.map((m)=>m.replace(/([A-Z])/g,"_$1").toUpperCase()).join("")}`],h,g;for(let m of d)if(h=He.env[m],h!==void 0){g=m;break}if(h!==void 0&&g)if(typeof u==="boolean")a[c]=["true","1","yes"].includes(h.toLowerCase());else if(typeof u==="number"){let m=Number(h);if(!Number.isNaN(m))a[c]=m}else if(Array.isArray(u))try{a[c]=JSON.parse(h)}catch{a[c]=h.split(",").map((m)=>m.trim())}else a[c]=h;else if(u&&typeof u==="object"&&!Array.isArray(u))a[c]=o(u,f)}return a}return o(t)}function Hd(e){let t=ne(He.cwd(),e.configDir),r=ne(He.cwd(),e.generatedDir),n=ne(r,"config-types.ts");if(!Gn(Lo(n)))Lf(Lo(n),{recursive:!0,mode:511});let i=Gn(t)?Mf(t).map((s)=>s.replace(/\.(ts|js|mjs|cjs|mts|cts|json)$/,"")).sort():[],o=`// Generated by bunfig v${$h}
32
+ `;return r}}function Bd(e,t){let r=Ps("process");if(typeof r>"u"||!r.env)return t;let n=r.env[e];return n!==void 0?n:t}function Ts(e,t,r={}){return Ns(e,t,r,new WeakMap)}function Ns(e,t,r,n){let{arrayMergeMode:i="replace",skipNullish:o=!1,customMerger:s}=r;if(t===null||t===void 0)return o?e:t;if(s){let l=s(e,t);if(l!==void 0)return l}if(Array.isArray(t)||Array.isArray(e))return Os(e,t,i,n);if(!ce(t)||!ce(e))return t;return zd(e,t,r,n)}function Os(e,t,r,n){if(Array.isArray(t)&&!Array.isArray(e))return t;if(Array.isArray(e)&&!Array.isArray(t))return t;if(Array.isArray(t)&&Array.isArray(e))switch(r){case"replace":return t;case"concat":return Ud(e,t);case"smart":return Vd(e,t,n);default:return t}return t}function Ud(e,t){let r=[...t];for(let n of e)if(!r.some((i)=>qn(i,n)))r.push(n);return r}function Vd(e,t,r){if(t.length===0)return e;if(e.length===0)return t;if(ce(t[0])&&ce(e[0]))return Wd(e,t,r);if(t.every((n)=>typeof n==="string")&&e.every((n)=>typeof n==="string")){let n=[...t];for(let i of e)if(!n.includes(i))n.push(i);return n}return t}function Wd(e,t,r){let n=[...t];for(let i of e){if(!ce(i)){n.push(i);continue}let o=["id","name","key","path","type"],s=!1;for(let l of o)if(l in i){if(n.find((c)=>ce(c)&&(l in c)&&c[l]===i[l])){s=!0;break}}if(!s)n.push(i)}return n}function zd(e,t,r,n){let i=t;if(ce(i)&&n.has(i))return n.get(i);let o={...e};if(ce(i))n.set(i,o);for(let s in i){if(!Object.prototype.hasOwnProperty.call(i,s))continue;let l=i[s],a=o[s];if(r.skipNullish&&(l===null||l===void 0))continue;if(l===null||l===void 0){o[s]=l;continue}if(ce(l)&&ce(a))o[s]=Ns(a,l,r,n);else if(Array.isArray(l)||Array.isArray(a))o[s]=Os(a,l,r.arrayMergeMode||"smart",n);else o[s]=l}return o}function ci(e,t,r="replace"){return Ts(e,t,{arrayMergeMode:r==="replace"?"replace":"smart",skipNullish:!0})}function qn(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(!qn(e[r],t[r]))return!1;return!0}if(ce(e)&&ce(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(!qn(e[i],t[i]))return!1}return!0}return!1}function ce(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}class Ir{extensions=[".ts",".js",".mjs",".cjs",".json",".mts",".cts"];async loadFromPath(e,t,r={}){let{arrayStrategy:n="replace",useCache:i=!0,cacheTtl:o,trackPerformance:s=!0,verbose:l=!1}=r;if(i){let c=dt.getWithFileCheck("file",e);if(c){if(l)console.log(`Configuration loaded from cache: ${e}`);return c}}let a=async()=>{if(!ir(e))return null;try{let c=`?t=${Date.now()}`,u=await import(e+c),f=u.default||u,d="default"in u,h=Object.keys(u).length>0;if(!d&&!h)throw new Ot(e,Error("Configuration file is empty and exports nothing"),"unknown");if(typeof f!=="object"||f===null||Array.isArray(f))throw new Ot(e,Error("Configuration must export a valid object"),"unknown");let p={config:ci(t,f,n),source:{type:"file",path:e,priority:100,timestamp:new Date}};if(i)dt.setWithFileCheck("file",p,e,o);return p}catch(c){throw c instanceof Error?Fe.configLoad(e,c):Fe.configLoad(e,Error(String(c)))}};if(s)return Pt.track("loadFromPath",a,{path:e});return a()}async tryLoadFromPaths(e,t,r={}){for(let n of e)try{let i=await this.loadFromPath(n,t,r);if(i)return i}catch(i){if(i instanceof Error&&i.name==="ConfigLoadError")throw i;if(r.verbose)console.warn(`Failed to load config from ${n}:`,i)}return null}generateConfigPaths(e,t,r){let n=this.generateNamePatterns(e,r),i=[];for(let o of n)for(let s of this.extensions)i.push(Ln(t,`${o}${s}`));return i}generateNamePatterns(e,t){let r=[];if(r.push("config",".config"),e)r.push(e,`.${e}.config`,`${e}.config`,`.${e}`);if(t){if(r.push(t,`.${t}.config`,`${t}.config`,`.${t}`),e)r.push(`${e}.${t}.config`,`.${e}.${t}.config`)}return r.filter(Boolean)}checkFileAccess(e){return As(async()=>ir(e),{maxRetries:2,retryDelay:100,fallback:!1})}async discoverConfigFiles(e,t,r){let n=[];if(!ir(e))return n;if(t||r){let i=this.generateNamePatterns(t||"",r);for(let o of i)for(let s of this.extensions){let l=Ln(e,`${o}${s}`);if(await this.checkFileAccess(l))n.push(l)}}else try{let{readdirSync:i}=await import("fs"),o=i(e);for(let s of o)if(this.looksLikeConfigFile(s)){let l=Ln(e,s);if(await this.checkFileAccess(l))n.push(l)}}catch{return[]}return n}looksLikeConfigFile(e){return[/\.config\.(ts|js|mjs|cjs|json|mts|cts)$/,/^\..*\.(ts|js|mjs|cjs|json|mts|cts)$/,/config\.(ts|js|mjs|cjs|json|mts|cts)$/].some((r)=>r.test(e))}async validateConfigFile(e){let t=[];try{if(!ir(e))return t.push("Configuration file does not exist"),t;let r=await import(e),n=r.default||r;if(n===void 0)t.push("Configuration file must export a default value or named exports");else if(typeof n!=="object"||n===null)t.push("Configuration must be an object");else if(Array.isArray(n))t.push("Configuration cannot be an array at the root level");if(e.endsWith(".json"))try{let{readFileSync:i}=await import("fs"),o=i(e,"utf8");JSON.parse(o)}catch(i){t.push(`Invalid JSON syntax: ${i}`)}}catch(r){t.push(`Failed to load configuration file: ${r}`)}return t}async getFileModificationTime(e){try{let{statSync:t}=await import("fs");return t(e).mtime}catch{return null}}async preloadConfigurations(e,t={}){let r=new Map;return await Promise.allSettled(e.map(async(n)=>{try{let i=await this.loadFromPath(n,{},t);if(i)r.set(n,i.config)}catch(i){if(t.verbose)console.warn(`Failed to preload ${n}:`,i)}})),r}}class ui{async validateConfiguration(e,t,r={}){let{stopOnFirstError:n=!1,validateRequired:i=!0,validateTypes:o=!0,customRules:s=[],trackPerformance:l=!0,verbose:a=!1}=r,c=async()=>{let u=[],f=[],d={stopOnFirstError:n,validateRequired:i,validateTypes:o,customRules:s,trackPerformance:l,verbose:a};try{if(typeof t==="string")return await this.validateWithSchemaFile(e,t,d);else if(Array.isArray(t))return this.validateWithRules(e,[...t,...s],d);else return this.validateWithJSONSchema(e,t,d)}catch(h){return u.push({path:"",message:`Validation failed: ${h}`,rule:"system"}),{isValid:!1,errors:u,warnings:f}}};if(l)return await Pt.track("validateConfiguration",c);return c()}async validateWithSchemaFile(e,t,r){try{if(!od(t))throw new It(t,[{path:"",message:"Schema file does not exist"}]);let n=await import(t),i=n.default||n;if(Array.isArray(i))return this.validateWithRules(e,i,r);else return this.validateWithJSONSchema(e,i,r)}catch(n){throw new It(t,[{path:"",message:`Failed to load schema: ${n}`}])}}validateWithJSONSchema(e,t,r){let n=[],i=[];return this.validateObjectAgainstSchema(e,t,"",n,i,r),{isValid:n.length===0,errors:n,warnings:i}}validateObjectAgainstSchema(e,t,r,n,i,o){if(o.validateTypes&&t.type){let s=Array.isArray(e)?"array":typeof e,l=Array.isArray(t.type)?t.type:[t.type];if(!l.includes(s)){if(n.push({path:r,message:`Expected type ${l.join(" or ")}, got ${s}`,expected:l.join(" or "),actual:s,rule:"type"}),o.stopOnFirstError)return}}if(t.enum&&!t.enum.includes(e)){if(n.push({path:r,message:`Value must be one of: ${t.enum.join(", ")}`,expected:t.enum.join(", "),actual:e,rule:"enum"}),o.stopOnFirstError)return}if(typeof e==="string"){if(t.minLength!==void 0&&e.length<t.minLength)n.push({path:r,message:`String length must be at least ${t.minLength}`,expected:`>= ${t.minLength}`,actual:e.length,rule:"minLength"});if(t.maxLength!==void 0&&e.length>t.maxLength)n.push({path:r,message:`String length must not exceed ${t.maxLength}`,expected:`<= ${t.maxLength}`,actual:e.length,rule:"maxLength"});if(t.pattern){if(!new RegExp(t.pattern).test(e))n.push({path:r,message:`String does not match pattern ${t.pattern}`,expected:t.pattern,actual:e,rule:"pattern"})}}if(typeof e==="number"){if(t.minimum!==void 0&&e<t.minimum)n.push({path:r,message:`Value must be at least ${t.minimum}`,expected:`>= ${t.minimum}`,actual:e,rule:"minimum"});if(t.maximum!==void 0&&e>t.maximum)n.push({path:r,message:`Value must not exceed ${t.maximum}`,expected:`<= ${t.maximum}`,actual:e,rule:"maximum"})}if(Array.isArray(e)&&t.items)for(let s=0;s<e.length;s++){let l=r?`${r}[${s}]`:`[${s}]`;if(this.validateObjectAgainstSchema(e[s],t.items,l,n,i,o),o.stopOnFirstError&&n.length>0)return}if(e&&typeof e==="object"&&!Array.isArray(e)){let s=e;if(o.validateRequired&&t.required){for(let l of t.required)if(!(l in s)){if(n.push({path:r?`${r}.${l}`:l,message:`Missing required property '${l}'`,expected:"required",rule:"required"}),o.stopOnFirstError)return}}if(t.properties){for(let[l,a]of Object.entries(t.properties))if(l in s){let c=r?`${r}.${l}`:l;if(this.validateObjectAgainstSchema(s[l],a,c,n,i,o),o.stopOnFirstError&&n.length>0)return}}if(t.additionalProperties===!1){let l=new Set(Object.keys(t.properties||{}));for(let a of Object.keys(s))if(!l.has(a))i.push({path:r?`${r}.${a}`:a,message:`Additional property '${a}' is not allowed`,rule:"additionalProperties"})}}}validateWithRules(e,t,r){let n=[],i=[];for(let o of t)try{let s=this.getValueByPath(e,o.path),l=this.validateWithRule(s,o,o.path);if(n.push(...l),r.stopOnFirstError&&n.length>0)break}catch(s){n.push({path:o.path,message:`Rule validation failed: ${s}`,rule:"system"})}return{isValid:n.length===0,errors:n,warnings:i}}validateWithRule(e,t,r){let n=[];if(t.required&&(e===void 0||e===null))return n.push({path:r,message:t.message||`Property '${r}' is required`,expected:"required",rule:"required"}),n;if(e===void 0||e===null)return n;if(t.type){let i=Array.isArray(e)?"array":typeof e;if(i!==t.type)n.push({path:r,message:t.message||`Expected type ${t.type}, got ${i}`,expected:t.type,actual:i,rule:"type"})}if(t.min!==void 0){let i=Array.isArray(e)?e.length:typeof e==="string"?e.length:typeof e==="number"?e:0;if(i<t.min)n.push({path:r,message:t.message||`Value must be at least ${t.min}`,expected:`>= ${t.min}`,actual:i,rule:"min"})}if(t.max!==void 0){let i=Array.isArray(e)?e.length:typeof e==="string"?e.length:typeof e==="number"?e:0;if(i>t.max)n.push({path:r,message:t.message||`Value must not exceed ${t.max}`,expected:`<= ${t.max}`,actual:i,rule:"max"})}if(t.pattern&&typeof e==="string"){if(!t.pattern.test(e))n.push({path:r,message:t.message||`Value does not match pattern ${t.pattern}`,expected:t.pattern.toString(),actual:e,rule:"pattern"})}if(t.enum&&!t.enum.includes(e))n.push({path:r,message:t.message||`Value must be one of: ${t.enum.join(", ")}`,expected:t.enum.join(", "),actual:e,rule:"enum"});if(t.validator){let i=t.validator(e);if(i)n.push({path:r,message:t.message||i,rule:"custom"})}return n}getValueByPath(e,t){if(!t)return e;let r=t.split("."),n=e;for(let i of r)if(n&&typeof n==="object"&&i in n)n=n[i];else return;return n}generateRulesFromInterface(e){let t=[],r=e.matchAll(/(\w+)(\?)?:\s*(\w+)/g);for(let n of r){let[,i,o,s]=n;t.push({path:i,required:!o,type:this.mapTypeScriptType(s)})}return t}mapTypeScriptType(e){switch(e.toLowerCase()){case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"array":return"array";case"object":return"object";default:return"object"}}static createCommonRules(){return{server:[{path:"port",required:!0,type:"number",min:1,max:65535},{path:"host",required:!0,type:"string",min:1},{path:"ssl",type:"boolean"}],database:[{path:"url",required:!0,type:"string",min:1},{path:"pool",type:"number",min:1,max:100},{path:"timeout",type:"number",min:0}],api:[{path:"baseUrl",required:!0,type:"string",pattern:js},{path:"timeout",type:"number",min:0},{path:"retries",type:"number",min:0,max:10}]}}}class fi{fileLoader=new Ir;envProcessor=new Or;validator=new ui;async loadConfig(e){let t=Date.now(),{cache:r,performance:n,schema:i,validate:o,...s}=e;try{if(r?.enabled){let a=this.checkCache(s.name||"",s);if(a)return a}let l;try{l=await this.loadConfigurationStrategies(s,!0,r)}catch(a){let c=s.__strictErrorHandling;if(a instanceof Error&&a.name==="ConfigNotFoundError"){if(c)throw a;l={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`No configuration file found for "${s.name||"config"}", using defaults with environment variables`]}}else if(a instanceof Error&&a.name==="ConfigLoadError"){let u=a.message.includes("EACCES")||a.message.includes("EPERM")||a.message.includes("permission denied"),f=!u&&(a.message.includes("syntax")||a.message.includes("Expected")||a.message.includes("Unexpected")||a.message.includes("BuildMessage")||a.message.includes("errors building")),d=a.message.includes("Configuration must export a valid object")||a.message.includes("Configuration file is empty and exports nothing");if(c&&(d||u))throw a;if(f&&(!c||!d))l={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:["Configuration file has syntax errors, using defaults with environment variables"]};else if(!c)l={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`Configuration loading error, using defaults: ${a.message}`]};else throw a}else l={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`Configuration loading failed, using defaults: ${a instanceof Error?a.message:String(a)}`]}}if(i||o)await this.validateConfiguration(l.config,i,o,s.name);if(r?.enabled&&l)this.cacheResult(s.name||"",l,r,s);if(n?.enabled){let a={operation:"loadConfig",duration:Date.now()-t,configName:s.name,timestamp:new Date};if(n.onMetrics)n.onMetrics(a);if(n.slowThreshold&&a.duration>n.slowThreshold)ge.warn(`Slow configuration loading detected: ${a.duration}ms for ${s.name}`);l.metrics=a}return l}catch(l){let a=Date.now()-t;throw ge.error(`Configuration loading failed after ${a}ms:`,[l instanceof Error?l:Error(String(l))]),l}}async loadConfigurationStrategies(e,t=!1,r){let{name:n="",alias:i,cwd:o,configDir:s,defaultConfig:l,checkEnv:a=!0,arrayStrategy:c="replace",verbose:u=!1}=e,f=o||He.cwd(),d=[],h=await this.loadLocalConfiguration(n,i,f,s,l,c,u,a,r);if(h)return d.push(...this.getLocalSearchPaths(n,i,f,s)),this.finalizeResult(h,d,a,n,u);let g=await this.loadHomeConfiguration(n,i,l,c,u,a);if(g)return d.push(...this.getHomeSearchPaths(n,i)),this.finalizeResult(g,d,a,n,u);let m=await this.loadPackageJsonConfiguration(n,i,f,l,c,u,a);if(m)return d.push(ne(f,"package.json")),this.finalizeResult(m,d,a,n,u);if(d.push(...this.getAllSearchPaths(n,i,f,s)),t)throw Fe.configNotFound(n,d,i);return{...await this.applyEnvironmentVariables(n,l,a,u),warnings:[`No configuration file found for "${n}"${i?` or alias "${i}"`:""}, using defaults with environment variables`]}}async loadLocalConfiguration(e,t,r,n,i,o,s,l,a){let c=l?Tt(e,i,s):i,u=this.getLocalDirectories(r,n);for(let f of u){if(s)ge.info(`Searching for configuration in: ${f}`);let d=this.fileLoader.generateConfigPaths(e,f,t),h=await this.fileLoader.tryLoadFromPaths(d,c,{arrayStrategy:o,verbose:s,cacheTtl:a?.ttl,useCache:!a?.ttl||a.ttl>100});if(h){if(s)ge.success(`Configuration loaded from: ${h.source.path}`);return h}}return null}async loadHomeConfiguration(e,t,r,n,i,o){if(!e)return null;let s=o?Tt(e,r,i):r,l=[ne(rt(),".config",e),ne(rt(),".config"),rt()];for(let a of l){if(i)ge.info(`Checking home directory: ${a}`);let c=this.fileLoader.generateConfigPaths(e,a,t),u=await this.fileLoader.tryLoadFromPaths(c,s,{arrayStrategy:n,verbose:i});if(u){if(i)ge.success(`Configuration loaded from home directory: ${u.source.path}`);return u}}return null}async loadPackageJsonConfiguration(e,t,r,n,i,o,s){let l=s?Tt(e,n,o):n;try{let a=ne(r,"package.json");if(!Gn(a))return null;let c=await import(a),u=c[e],f=e;if(!u&&t)u=c[t],f=t;if(u&&typeof u==="object"&&!Array.isArray(u)){if(o)ge.success(`Configuration loaded from package.json: ${f}`);return{config:ci(l,u,i),source:{type:"package.json",path:a,priority:30,timestamp:new Date}}}}catch(a){if(o)ge.warn("Failed to load package.json:",[a instanceof Error?a:Error(String(a))])}return null}async applyEnvironmentVariables(e,t,r,n){if(!r||!e||typeof t!=="object"||t===null||Array.isArray(t))return{config:t,source:{type:"default",priority:10,timestamp:new Date}};return{config:Tt(e,t,n),source:{type:"environment",priority:20,timestamp:new Date}}}async finalizeResult(e,t,r,n,i){return{config:e.config,source:e.source,path:e.source.path}}async validateConfiguration(e,t,r,n){let i=[];if(r){let o=r(e);if(o)i.push(...o)}if(t){let o=await this.validator.validateConfiguration(e,t);if(!o.isValid)i.push(...o.errors.map((s)=>s.path?`${s.path}: ${s.message}`:s.message))}if(i.length>0)throw Fe.configValidation(n||"unknown",i,n)}checkCache(e,t){let r=this.generateCacheKey(e,t);return dt.get(r)||null}cacheResult(e,t,r,n){let i=this.generateCacheKey(e,n);dt.set(i,t,void 0,r.ttl)}generateCacheKey(e,t){let r=[e];if(t.alias)r.push(`alias:${t.alias}`);if(t.cwd)r.push(`cwd:${t.cwd}`);if(t.configDir)r.push(`configDir:${t.configDir}`);if("checkEnv"in t)r.push(`checkEnv:${t.checkEnv}`);return r.join("|")}getLocalDirectories(e,t){return Array.from(new Set([e,ne(e,"config"),ne(e,".config"),t?ne(e,t):void 0].filter(Boolean)))}getAllSearchPaths(e,t,r,n){let i=[];return i.push(...this.getLocalSearchPaths(e,t,r,n)),i.push(...this.getHomeSearchPaths(e,t)),i.push(ne(r,"package.json")),i}getLocalSearchPaths(e,t,r,n){let i=this.getLocalDirectories(r,n),o=[];for(let s of i)o.push(...this.fileLoader.generateConfigPaths(e,s,t));return o}getHomeSearchPaths(e,t){if(!e)return[];let r=[ne(rt(),".config",e),ne(rt(),".config"),rt()],n=[];for(let i of r)n.push(...this.fileLoader.generateConfigPaths(e,i,t));return n}async loadConfigWithResult(e){return this.loadConfig(e)}}function is(e){let r=!(e.message.includes("EACCES")||e.message.includes("EPERM")||e.message.includes("permission denied"))&&(e.message.includes("syntax")||e.message.includes("Expected")||e.message.includes("Unexpected")||e.message.includes("BuildMessage")),n=e.message.includes("Configuration must export a valid object")||e.message.includes("Configuration file is empty and exports nothing");return r||n}async function Kd(e){return Ne.loadConfig({...e,__strictErrorHandling:!0})}async function Is(e){let t="defaultConfig"in e&&e.defaultConfig!==void 0?e.defaultConfig:{},r="cache"in e||"performance"in e||"schema"in e||"validate"in e;try{let n;if(r)n=await Ne.loadConfig(e);else n=await Ne.loadConfig({...e,defaultConfig:t,cache:{enabled:!0},performance:{enabled:!1}});return n?.config??t}catch(n){let i=n instanceof Error?n.name:"UnknownError",o=n instanceof Error?n.message:String(n);if(!(i==="ConfigNotFoundError"||i==="ConfigLoadError"||i==="ConfigValidationError"||o.includes("config"))&&e.verbose)ge.warn("Unexpected error loading config, using defaults:",[n instanceof Error?n:Error(String(n))]);let l=r?{...e,defaultConfig:t}:{...e,defaultConfig:t,cache:{enabled:!0},performance:{enabled:!1}};if("checkEnv"in e?e.checkEnv!==!1:!0)return(await Ne.applyEnvironmentVariables(l.name||"",t,!0,l.verbose||!1))?.config??t;return t}}async function Gd(e={defaultConfig:{}}){if(typeof e==="string"){let{cwd:t}=await import("process");try{return(await Ne.loadConfig({name:e,cwd:t(),generatedDir:"./generated",configDir:"./config",defaultConfig:{},checkEnv:!0,arrayStrategy:"replace"})).config}catch(r){if(r instanceof Error&&(r.name==="ConfigNotFoundError"||r.name==="ConfigLoadError"&&is(r)))return(await Ne.applyEnvironmentVariables(e,{},!0,!1)).config;throw r}}try{return(await Ne.loadConfig({...e,cwd:e.cwd||He.cwd(),cache:{enabled:!0},performance:{enabled:!1}})).config}catch(t){if(t instanceof Error&&(t.name==="ConfigNotFoundError"||t.name==="ConfigLoadError"&&is(t)))return(await Ne.applyEnvironmentVariables(e.name||"",e.defaultConfig||{},e.checkEnv!==!1,e.verbose||!1)).config;throw t}}async function Hd(e,t,r="replace"){let n=new Ir;try{let i=await n.loadFromPath(e,t,{arrayStrategy:r,useCache:!1,trackPerformance:!1});return i?i.config:null}catch{return null}}function Tt(e,t,r=!1){let n=new Or,i=e.toUpperCase().replace(/[^A-Z0-9]/g,"_");function o(s,l=[]){let a={...s};for(let[c,u]of Object.entries(s)){let f=[...l,c],d=[`${i}_${f.join("_").toUpperCase()}`,`${i}_${f.map((m)=>m.toUpperCase()).join("")}`,`${i}_${f.map((m)=>m.replace(/([A-Z])/g,"_$1").toUpperCase()).join("")}`],h,g;for(let m of d)if(h=He.env[m],h!==void 0){g=m;break}if(h!==void 0&&g)if(typeof u==="boolean")a[c]=["true","1","yes"].includes(h.toLowerCase());else if(typeof u==="number"){let m=Number(h);if(!Number.isNaN(m))a[c]=m}else if(Array.isArray(u))try{a[c]=JSON.parse(h)}catch{a[c]=h.split(",").map((m)=>m.trim())}else a[c]=h;else if(u&&typeof u==="object"&&!Array.isArray(u))a[c]=o(u,f)}return a}return o(t)}function qd(e){let t=ne(He.cwd(),e.configDir),r=ne(He.cwd(),e.generatedDir),n=ne(r,"config-types.ts");if(!Gn(Lo(n)))Mf(Lo(n),{recursive:!0,mode:511});let i=Gn(t)?Ff(t).map((s)=>s.replace(/\.(ts|js|mjs|cjs|mts|cts|json)$/,"")).sort():[],o=`// Generated by bunfig v${Ch}
33
33
  export type ConfigNames = ${i.length?`'${i.join("' | '")}'`:"string"}
34
- `;Ff(n,o,{mode:438})}function qd(e){let t=null,r=null,n=()=>{if(!r)r=Is(e).then((o)=>(t=o,o),(o)=>{let s="defaultConfig"in e?e.defaultConfig:{};if(t=s,"verbose"in e&&e.verbose)ge.warn("Config loading failed, using defaults:",[o instanceof Error?o:Error(String(o))]);return s});return r},i="defaultConfig"in e?e.defaultConfig:{};return t=i,n(),new Proxy({},{get(o,s){if(t)return t[s];let l=i[s];return n(),l},has(o,s){return s in(t||i)},ownKeys(){return Object.keys(t||i)},getOwnPropertyDescriptor(o,s){return Object.getOwnPropertyDescriptor(t||i,s)},set(o,s,l){if(!t)t={...i};return t[s]=l,!0}})}function Yd(e){let t=Jo(ad.cwd(),e?.configDir||"./config");function r(){if(!od(t))return[];let i=new Set([".ts",".js",".mjs",".cjs",".mts",".cts",".json"]),o=[".ts",".mts",".cts",".js",".mjs",".cjs",".json"],s=sd(t).filter((a)=>i.has(Mn(a))).map((a)=>({base:a.replace(/\.(?:ts|js|mjs|cjs|mts|cts|json)$/i,""),file:a})),l=new Map;for(let{base:a,file:c}of s){let u=Mn(c).toLowerCase(),f=l.get(a);if(!f){l.set(a,c);continue}let d=Mn(f).toLowerCase();if(o.indexOf(u)<o.indexOf(d))l.set(a,c)}return Array.from(l.entries()).map(([a,c])=>({base:a,file:c})).sort((a,c)=>a.base.localeCompare(c.base))}function n(){let i=r(),o=i.map((c)=>c.base),s=o.length?o.map((c)=>`'${c}'`).join(" | "):"string",l=i.length?`{
34
+ `;jf(n,o,{mode:438})}function Yd(e){let t=null,r=null,n=()=>{if(!r)r=Is(e).then((o)=>(t=o,o),(o)=>{let s="defaultConfig"in e?e.defaultConfig:{};if(t=s,"verbose"in e&&e.verbose)ge.warn("Config loading failed, using defaults:",[o instanceof Error?o:Error(String(o))]);return s});return r},i="defaultConfig"in e?e.defaultConfig:{};return t=i,n(),new Proxy({},{get(o,s){if(t)return t[s];let l=i[s];return n(),l},has(o,s){return s in(t||i)},ownKeys(){return Object.keys(t||i)},getOwnPropertyDescriptor(o,s){return Object.getOwnPropertyDescriptor(t||i,s)},set(o,s,l){if(!t)t={...i};return t[s]=l,!0}})}function Jd(e){let t=Jo(ld.cwd(),e?.configDir||"./config");function r(){if(!sd(t))return[];let i=new Set([".ts",".js",".mjs",".cjs",".mts",".cts",".json"]),o=[".ts",".mts",".cts",".js",".mjs",".cjs",".json"],s=ad(t).filter((a)=>i.has(Mn(a))).map((a)=>({base:a.replace(/\.(?:ts|js|mjs|cjs|mts|cts|json)$/i,""),file:a})),l=new Map;for(let{base:a,file:c}of s){let u=Mn(c).toLowerCase(),f=l.get(a);if(!f){l.set(a,c);continue}let d=Mn(f).toLowerCase();if(o.indexOf(u)<o.indexOf(d))l.set(a,c)}return Array.from(l.entries()).map(([a,c])=>({base:a,file:c})).sort((a,c)=>a.base.localeCompare(c.base))}function n(){let i=r(),o=i.map((c)=>c.base),s=o.length?o.map((c)=>`'${c}'`).join(" | "):"string",l=i.length?`{
35
35
  ${i.map((c)=>{let u=Jo(t,c.file).replace(/\\/g,"/");return` '${c.base}': typeof import('${u}').default`}).join(`,
36
36
  `)}
37
37
  }`:"Record<string, any>";return`export type ConfigNames = ${s}
38
38
  export type ConfigByName = ${l}
39
39
  export type Config<N extends ConfigNames> = N extends keyof ConfigByName ? ConfigByName[N] : unknown
40
40
  export type ConfigOf = Config
41
- `}return{name:"bunfig-plugin",setup(i){i.onResolve({filter:/^virtual:bunfig-types$/},(o)=>({path:o.path,namespace:"bunfig-virtual"})),i.onLoad({filter:/^virtual:bunfig-types$/,namespace:"bunfig-virtual"},()=>({contents:n(),loader:"ts"}))}}}function Rh(e,t={}){let r=vr.cwd();while(r.includes("storage"))r=Xo(r,"..");let n=Xo(r,e||"");if(t?.relative)return cd(vr.cwd(),n);return n}function q(){if(Te.env.NODE_ENV==="test"||Te.env.BUN_ENV==="test")return!1;return typeof window<"u"}async function Sh(){if(Te.env.NODE_ENV==="test"||Te.env.BUN_ENV==="test")return!0;if(typeof navigator<"u"&&navigator.product==="ReactNative")return!0;if(typeof Te<"u"){let e=Te.type;if(e==="renderer"||e==="worker")return!1;return!!(Te.versions&&(Te.versions.node||Te.versions.bun))}return!1}class Vs{async format(e){let t=await Sh(),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:ft.pid,hostname:t(),environment:ft.env.NODE_ENV||"development",platform:ft.platform,version:ft.version}}return{userAgent:navigator.userAgent,hostname:window.location.hostname||"browser",environment:ft.env.NODE_ENV||ft.env.BUN_ENV||"development",viewport:{width:window.innerWidth,height:window.innerHeight},language:navigator.language}}}class Pr{name;fileLocks=new Map;currentKeyId=null;keys=new Map;fingersCrossedConfig;fingersCrossedActive=!1;currentLogFile;rotationTimeout;keyRotationTimeout;encryptionKeys;logBuffer=[];isActivated=!1;pendingOperations=[];enabled;fancy;tagFormat;timestampPosition;environment;config;options;formatter;timers=new Set;subLoggers=new Set;fingersCrossedBuffer=[];ANSI_PATTERN=/\u001B\[.*?m/g;activeProgressBar=null;constructor(e,t={}){this.name=e,this.config={...Ar},this.options=this.normalizeOptions(t),this.formatter=this.options.formatter||new Vs,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??O.env.APP_ENV??"local",this.fingersCrossedConfig=this.initializeFingersCrossedConfig(t);let r={...t},n=t.timestamp!==void 0;if(n)delete r.timestamp;if(this.config={...this.config,...r,timestamp:n||this.config.timestamp,level:this.options.level??"info"},this.currentLogFile=this.generateLogFilename(),this.encryptionKeys=new Map,this.validateEncryptionConfig()){this.setupRotation();let i=this.generateKeyId(),o=this.generateKey();this.currentKeyId=i,this.keys.set(i,o),this.encryptionKeys.set(i,{key:o,createdAt:new Date}),this.setupKeyRotation()}}shouldActivateFingersCrossed(e){if(!this.fingersCrossedConfig)return!1;let t={debug:0,info:1,success:2,warning:3,error:4},r=this.fingersCrossedConfig.activationLevel??"error";return t[e]>=t[r]}initializeFingersCrossedConfig(e){if(!e.fingersCrossedEnabled&&e.fingersCrossed)return{...zn,...e.fingersCrossed};if(!e.fingersCrossedEnabled)return null;if(!e.fingersCrossed)return{...zn};return{...zn,...e.fingersCrossed}}normalizeOptions(e){let t={format:"json",level:"info",logDirectory:Ar.logDirectory,rotation:void 0,timestamp:void 0,fingersCrossed:{},enabled:!0,showTags:!1,showIcons:!0,formatter:void 0},r={...t,...Object.fromEntries(Object.entries(e).filter(([,n])=>n!==void 0))};if(!r.level||!["debug","info","success","warning","error"].includes(r.level))r.level=t.level;return r}shouldWriteToFile(){return!q()&&this.config.writeToFile===!0}async writeToFile(e){let r=(async()=>{let i,o=0,s=3,l=1000;while(o<s)try{try{try{await gd(this.config.logDirectory,ts.F_OK|ts.W_OK)}catch(c){if(c instanceof Error&&"code"in c)if(c.code==="ENOENT")await md(this.config.logDirectory,{recursive:!0,mode:493});else if(c.code==="EACCES")throw Error(`No write permission for log directory: ${this.config.logDirectory}`);else throw c;else throw c}}catch(c){throw console.error("Debug: [writeToFile] Failed to create log directory:",c),c}let a=this.validateEncryptionConfig()?(await this.encrypt(e)).encrypted:Se.from(e);try{if(!or(this.currentLogFile))await Dn(this.currentLogFile,"",{mode:420});if(i=es(this.currentLogFile,"a",420),hd(i,a,{flag:"a"}),Qo(i),i!==void 0)jn(i),i=void 0;if((await ct(this.currentLogFile)).size===0){if(await Dn(this.currentLogFile,a,{flag:"w",mode:420}),(await ct(this.currentLogFile)).size===0)throw Error("File exists but is empty after retry write")}return}catch(c){let u=c;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=l*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{jn(i)}catch(c){console.error("Debug: [writeToFile] Error closing file descriptor:",c)}}}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 c=l*2**(o-1);await new Promise((u)=>setTimeout(u,c))}})();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 ut(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 ut(this.config.logDirectory,`${this.name}.log`);let e=new Date().toISOString().split("T")[0];return ut(this.config.logDirectory,`${this.name}-${e}.log`)}setupRotation(){if(q())return;if(!this.shouldWriteToFile())return;if(typeof this.config.rotation==="boolean")return;let e=this.config.rotation,t;switch(e.frequency){case"daily":t=86400000;break;case"weekly":t=604800000;break;case"monthly":t=2592000000;break;default:return}this.rotationTimeout=setInterval(()=>{this.rotateLog()},t)}setupKeyRotation(){if(!this.validateEncryptionConfig()){console.error("Invalid encryption configuration detected during key rotation setup");return}let t=this.config.rotation.keyRotation;if(!t?.enabled)return;let r=typeof t.interval==="number"?t.interval:60,n=Math.max(r,60)*1000;this.keyRotationTimeout=setInterval(()=>{this.rotateKeys().catch((i)=>{console.error("Error rotating keys:",i)})},n)}async rotateKeys(){if(!this.validateEncryptionConfig()){console.error("Invalid encryption configuration detected during key rotation");return}let t=this.config.rotation.keyRotation,r=this.generateKeyId(),n=this.generateKey();this.currentKeyId=r,this.keys.set(r,n),this.encryptionKeys.set(r,{key:n,createdAt:new Date});let i=Array.from(this.encryptionKeys.entries()).sort(([,l],[,a])=>a.createdAt.getTime()-l.createdAt.getTime()),o=typeof t.maxKeys==="number"?t.maxKeys:1,s=Math.max(1,o);if(i.length>s)for(let[l]of i.slice(s))this.encryptionKeys.delete(l),this.keys.delete(l)}generateKeyId(){return Fn(16).toString("hex")}generateKey(){return Fn(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=Fn(16),n=ud("aes-256-gcm",t,r),i=Se.isBuffer(e)?e:Se.from(e,"utf8"),o=n.update(i),s=n.final(),l=o.length+s.length,a=n.getAuthTag(),c=Se.allocUnsafe(16+l+16);return r.copy(c,0),o.copy(c,16),s.copy(c,16+o.length),a.copy(c,16+l),{encrypted:c,iv:r}}async compressData(e){return new Promise((t,r)=>{let n=ns(),i=[];n.on("data",(o)=>i.push(o)),n.on("end",()=>t(Se.from(Se.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(q())return;if(!this.shouldWriteToFile())return;let e=await ct(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 sr(this.config.logDirectory),o=i.filter((a)=>a.startsWith(this.name)&&/\.log\.\d+$/.test(a)).sort((a,c)=>{let u=Number.parseInt(a.match(/\.log\.(\d+)$/)?.[1]||"0");return Number.parseInt(c.match(/\.log\.(\d+)$/)?.[1]||"0")-u}),s=o.length>0?Number.parseInt(o[0].match(/\.log\.(\d+)$/)?.[1]||"0")+1:1,l=`${r}.${s}`;if(await ct(r).catch(()=>null))try{if(await rs(r,l),t.compress)try{let a=`${l}.gz`;await this.compressLogFile(l,a),await ar(l)}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 Dn(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 ct(r).catch(()=>null))await rs(r,o)}if(this.currentLogFile=n,t.maxFiles){let o=(await sr(this.config.logDirectory)).filter((s)=>s.startsWith(this.name)).sort((s,l)=>l.localeCompare(s));for(let s of o.slice(t.maxFiles))await ar(ut(this.config.logDirectory,s))}}}async compressLogFile(e,t){let r=Zo(e),n=dd(t),i=ns();await bd(r,i,n)}async handleFingersCrossedBuffer(e,t){if(!this.fingersCrossedConfig)return;if(this.shouldActivateFingersCrossed(e)&&!this.isActivated){this.isActivated=!0;for(let r of this.logBuffer){let n=await this.formatter.format(r);if(this.shouldWriteToFile())await this.writeToFile(n);console.log(n)}if(this.fingersCrossedConfig.stopBuffering)this.logBuffer=[]}if(this.isActivated){if(this.shouldWriteToFile())await this.writeToFile(t);console.log(t)}}shouldLog(e){if(!this.enabled)return!1;let t={debug:0,info:1,success:2,warning:3,error:4};return t[e]>=t[this.config.level]}async flushPendingWrites(){if(await Promise.all(this.pendingOperations.map((e)=>{if(e instanceof Promise)return e.catch((t)=>{console.error("Error in pending write operation:",t)});return Promise.resolve()})),or(this.currentLogFile))try{let e=es(this.currentLogFile,"r+");Qo(e),jn(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(!q()&&this.config.rotation&&typeof this.config.rotation!=="boolean"&&this.config.rotation.compress)try{let t=(await sr(this.config.logDirectory)).filter((r)=>(r.includes("temp")||r.includes(".tmp"))&&r.includes(this.name));for(let r of t)try{await ar(ut(this.config.logDirectory,r))}catch(n){console.error(`Failed to delete temp file ${r}:`,n)}}catch(e){console.error("Error cleaning up temporary files:",e)}})()}getCurrentLogFilePath(){return this.currentLogFile}formatTag(e){if(!e)return"";return`${this.tagFormat.prefix}${e}${this.tagFormat.suffix}`}formatFileTimestamp(e){return`[${e.toISOString()}]`}formatConsoleTimestamp(e){return this.shouldStyleConsole()?T.gray(e.toLocaleTimeString()):e.toLocaleTimeString()}shouldStyleConsole(){if(!this.fancy||q())return!1;let e=typeof O.env.NO_COLOR<"u",t=O.env.FORCE_COLOR==="0";if(e||t)return!1;return!!(typeof O.stderr<"u"&&O.stderr.isTTY||typeof O.stdout<"u"&&O.stdout.isTTY)}formatConsoleMessage(e){let{timestamp:t,icon:r="",tag:n="",message:i,level:o,showTimestamp:s=!0}=e,l=(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=O.stdout.columns||120,c="";if(o==="warning"||o==="error")c=`${r} ${i}`;else if(o==="info"||o==="success")c=`${r} ${n} ${i}`;else c=`${r} ${n} ${T.cyan(i)}`;if(!s)return c.trim();let u=l(c).trim().length,f=l(t).length,d=Math.max(1,a-2-u-f);return`${c.trim()}${" ".repeat(d)}${t}`}formatMessage(e,t){if(t.length===1&&Array.isArray(t[0]))return e.replace(/\{(\d+)\}/g,(o,s)=>{let l=Number.parseInt(s,10);return l<t[0].length?String(t[0][l]):o});let r=/%([sdijfo%])/g,n=0,i=e.replace(r,(o,s)=>{if(s==="%")return"%";if(n>=t.length)return o;let l=t[n++];switch(s){case"s":return String(l);case"d":case"i":return Number(l).toString();case"j":case"o":return JSON.stringify(l,null,2);default:return o}});if(n<t.length)i+=` ${t.slice(n).map((o)=>typeof o==="object"?JSON.stringify(o,null,2):String(o)).join(" ")}`;return i}formatMarkdown(e){if(!e)return e;let t=e;return t=t.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(r,n,i)=>{let o=T.underline(T.blue(n)),s=this.toAbsoluteFilePath(i);if(s&&this.shouldStyleConsole()&&this.supportsHyperlinks()){let l=`file://${encodeURI(s)}`,a="\x1B]8;;",c="\x1B\\";return`\x1B]8;;${l}\x1B\\${o}\x1B]8;;\x1B\\`}if(this.shouldStyleConsole()&&this.supportsHyperlinks())return`\x1B]8;;${i}\x1B\\${o}\x1B]8;;\x1B\\`;return o}),t=t.replace(/`([^`]+)`/g,(r,n)=>T.bgGray(n)),t=t.replace(/\*\*([^*]+)\*\*/g,(r,n)=>T.bold(n)),t=t.replace(/(?<!\*)\*([^*]+)\*(?!\*)/g,(r,n)=>T.italic(n)),t=t.replace(/(?<!_)_([^_]+)_(?!_)/g,(r,n)=>T.italic(n)),t=t.replace(/~([^~]+)~/g,(r,n)=>T.strikethrough(n)),t}supportsHyperlinks(){if(q())return!1;let e=O.env;if(!e)return!1;if(e.TERM_PROGRAM==="iTerm.app"||e.TERM_PROGRAM==="vscode"||e.TERM_PROGRAM==="WezTerm")return!0;if(e.WT_SESSION)return!0;if(e.TERM==="xterm-kitty")return!0;let t=e.VTE_VERSION?Number.parseInt(e.VTE_VERSION,10):0;if(!Number.isNaN(t)&&t>=5000)return!0;return!1}toAbsoluteFilePath(e){try{let t=e;if(t.startsWith("file://"))t=t.replace(/^file:\/\//,"");if(t.startsWith("~")){let r=O.env.HOME||"";if(r)t=t.replace(/^~(?=$|\/)/,r)}if(pd(t)||t.startsWith("./")||t.startsWith("../"))t=yd(t);else return null;return or(t)?t:null}catch{return null}}buildOutputTexts(e){let t=this.shouldStyleConsole()?this.formatMarkdown(e):e,r=e.replace(this.ANSI_PATTERN,"");return{consoleText:t,fileText:r}}async log(e,t,...r){if(!this.shouldLog(e))return;let n=new Date,i=this.formatConsoleTimestamp(n),o=this.formatFileTimestamp(n),s,l;if(t instanceof Error)s=t.message,l=t.stack;else s=this.formatMessage(t,r);let{consoleText:a,fileText:c}=this.buildOutputTexts(s);if(this.shouldStyleConsole()){let f=this.options.showIcons===!1?"":Oh[e],d=this.options.showTags!==!1&&this.name?T.gray(this.formatTag(this.name)):"",h;switch(e){case"debug":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:T.gray(a),level:e}),console.error(h);break;case"info":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:a,level:e}),console.warn(h);break;case"success":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:T.green(a),level:e}),console.error(h);break;case"warning":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:a,level:e}),console.warn(h);break;case"error":if(h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:a,level:e}),console.error(h),l){let g=l.split(`
41
+ `}return{name:"bunfig-plugin",setup(i){i.onResolve({filter:/^virtual:bunfig-types$/},(o)=>({path:o.path,namespace:"bunfig-virtual"})),i.onLoad({filter:/^virtual:bunfig-types$/,namespace:"bunfig-virtual"},()=>({contents:n(),loader:"ts"}))}}}function kh(e,t={}){let r=vr.cwd();while(r.includes("storage"))r=Xo(r,"..");let n=Xo(r,e||"");if(t?.relative)return ud(vr.cwd(),n);return n}function q(){if(Te.env.NODE_ENV==="test"||Te.env.BUN_ENV==="test")return!1;return typeof window<"u"}async function Ah(){if(Te.env.NODE_ENV==="test"||Te.env.BUN_ENV==="test")return!0;if(typeof navigator<"u"&&navigator.product==="ReactNative")return!0;if(typeof Te<"u"){let e=Te.type;if(e==="renderer"||e==="worker")return!1;return!!(Te.versions&&(Te.versions.node||Te.versions.bun))}return!1}class Vs{async format(e){let t=await Ah(),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:ft.pid,hostname:t(),environment:ft.env.NODE_ENV||"development",platform:ft.platform,version:ft.version}}return{userAgent:navigator.userAgent,hostname:window.location.hostname||"browser",environment:ft.env.NODE_ENV||ft.env.BUN_ENV||"development",viewport:{width:window.innerWidth,height:window.innerHeight},language:navigator.language}}}class Pr{name;fileLocks=new Map;currentKeyId=null;keys=new Map;fingersCrossedConfig;fingersCrossedActive=!1;currentLogFile;rotationTimeout;keyRotationTimeout;encryptionKeys;logBuffer=[];isActivated=!1;pendingOperations=[];enabled;fancy;tagFormat;timestampPosition;environment;config;options;formatter;timers=new Set;subLoggers=new Set;fingersCrossedBuffer=[];ANSI_PATTERN=/\u001B\[.*?m/g;activeProgressBar=null;constructor(e,t={}){this.name=e,this.config={...Ar},this.options=this.normalizeOptions(t),this.formatter=this.options.formatter||new Vs,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??O.env.APP_ENV??"local",this.fingersCrossedConfig=this.initializeFingersCrossedConfig(t);let r={...t},n=t.timestamp!==void 0;if(n)delete r.timestamp;if(this.config={...this.config,...r,timestamp:n||this.config.timestamp,level:this.options.level??"info"},this.currentLogFile=this.generateLogFilename(),this.encryptionKeys=new Map,this.validateEncryptionConfig()){this.setupRotation();let i=this.generateKeyId(),o=this.generateKey();this.currentKeyId=i,this.keys.set(i,o),this.encryptionKeys.set(i,{key:o,createdAt:new Date}),this.setupKeyRotation()}}shouldActivateFingersCrossed(e){if(!this.fingersCrossedConfig)return!1;let t={debug:0,info:1,success:2,warning:3,error:4},r=this.fingersCrossedConfig.activationLevel??"error";return t[e]>=t[r]}initializeFingersCrossedConfig(e){if(!e.fingersCrossedEnabled&&e.fingersCrossed)return{...zn,...e.fingersCrossed};if(!e.fingersCrossedEnabled)return null;if(!e.fingersCrossed)return{...zn};return{...zn,...e.fingersCrossed}}normalizeOptions(e){let t={format:"json",level:"info",logDirectory:Ar.logDirectory,rotation:void 0,timestamp:void 0,fingersCrossed:{},enabled:!0,showTags:!1,showIcons:!0,formatter:void 0},r={...t,...Object.fromEntries(Object.entries(e).filter(([,n])=>n!==void 0))};if(!r.level||!["debug","info","success","warning","error"].includes(r.level))r.level=t.level;return r}shouldWriteToFile(){return!q()&&this.config.writeToFile===!0}async writeToFile(e){let r=(async()=>{let i,o=0,s=3,l=1000;while(o<s)try{try{try{await md(this.config.logDirectory,ts.F_OK|ts.W_OK)}catch(c){if(c instanceof Error&&"code"in c)if(c.code==="ENOENT")await pd(this.config.logDirectory,{recursive:!0,mode:493});else if(c.code==="EACCES")throw Error(`No write permission for log directory: ${this.config.logDirectory}`);else throw c;else throw c}}catch(c){throw console.error("Debug: [writeToFile] Failed to create log directory:",c),c}let a=this.validateEncryptionConfig()?(await this.encrypt(e)).encrypted:Se.from(e);try{if(!or(this.currentLogFile))await Dn(this.currentLogFile,"",{mode:420});if(i=es(this.currentLogFile,"a",420),gd(i,a,{flag:"a"}),Qo(i),i!==void 0)jn(i),i=void 0;if((await ct(this.currentLogFile)).size===0){if(await Dn(this.currentLogFile,a,{flag:"w",mode:420}),(await ct(this.currentLogFile)).size===0)throw Error("File exists but is empty after retry write")}return}catch(c){let u=c;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=l*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{jn(i)}catch(c){console.error("Debug: [writeToFile] Error closing file descriptor:",c)}}}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 c=l*2**(o-1);await new Promise((u)=>setTimeout(u,c))}})();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 ut(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 ut(this.config.logDirectory,`${this.name}.log`);let e=new Date().toISOString().split("T")[0];return ut(this.config.logDirectory,`${this.name}-${e}.log`)}setupRotation(){if(q())return;if(!this.shouldWriteToFile())return;if(typeof this.config.rotation==="boolean")return;let e=this.config.rotation,t;switch(e.frequency){case"daily":t=86400000;break;case"weekly":t=604800000;break;case"monthly":t=2592000000;break;default:return}this.rotationTimeout=setInterval(()=>{this.rotateLog()},t)}setupKeyRotation(){if(!this.validateEncryptionConfig()){console.error("Invalid encryption configuration detected during key rotation setup");return}let t=this.config.rotation.keyRotation;if(!t?.enabled)return;let r=typeof t.interval==="number"?t.interval:60,n=Math.max(r,60)*1000;this.keyRotationTimeout=setInterval(()=>{this.rotateKeys().catch((i)=>{console.error("Error rotating keys:",i)})},n)}async rotateKeys(){if(!this.validateEncryptionConfig()){console.error("Invalid encryption configuration detected during key rotation");return}let t=this.config.rotation.keyRotation,r=this.generateKeyId(),n=this.generateKey();this.currentKeyId=r,this.keys.set(r,n),this.encryptionKeys.set(r,{key:n,createdAt:new Date});let i=Array.from(this.encryptionKeys.entries()).sort(([,l],[,a])=>a.createdAt.getTime()-l.createdAt.getTime()),o=typeof t.maxKeys==="number"?t.maxKeys:1,s=Math.max(1,o);if(i.length>s)for(let[l]of i.slice(s))this.encryptionKeys.delete(l),this.keys.delete(l)}generateKeyId(){return Fn(16).toString("hex")}generateKey(){return Fn(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=Fn(16),n=fd("aes-256-gcm",t,r),i=Se.isBuffer(e)?e:Se.from(e,"utf8"),o=n.update(i),s=n.final(),l=o.length+s.length,a=n.getAuthTag(),c=Se.allocUnsafe(16+l+16);return r.copy(c,0),o.copy(c,16),s.copy(c,16+o.length),a.copy(c,16+l),{encrypted:c,iv:r}}async compressData(e){return new Promise((t,r)=>{let n=ns(),i=[];n.on("data",(o)=>i.push(o)),n.on("end",()=>t(Se.from(Se.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(q())return;if(!this.shouldWriteToFile())return;let e=await ct(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 sr(this.config.logDirectory),o=i.filter((a)=>a.startsWith(this.name)&&/\.log\.\d+$/.test(a)).sort((a,c)=>{let u=Number.parseInt(a.match(/\.log\.(\d+)$/)?.[1]||"0");return Number.parseInt(c.match(/\.log\.(\d+)$/)?.[1]||"0")-u}),s=o.length>0?Number.parseInt(o[0].match(/\.log\.(\d+)$/)?.[1]||"0")+1:1,l=`${r}.${s}`;if(await ct(r).catch(()=>null))try{if(await rs(r,l),t.compress)try{let a=`${l}.gz`;await this.compressLogFile(l,a),await ar(l)}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 Dn(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 ct(r).catch(()=>null))await rs(r,o)}if(this.currentLogFile=n,t.maxFiles){let o=(await sr(this.config.logDirectory)).filter((s)=>s.startsWith(this.name)).sort((s,l)=>l.localeCompare(s));for(let s of o.slice(t.maxFiles))await ar(ut(this.config.logDirectory,s))}}}async compressLogFile(e,t){let r=Zo(e),n=hd(t),i=ns();await xd(r,i,n)}async handleFingersCrossedBuffer(e,t){if(!this.fingersCrossedConfig)return;if(this.shouldActivateFingersCrossed(e)&&!this.isActivated){this.isActivated=!0;for(let r of this.logBuffer){let n=await this.formatter.format(r);if(this.shouldWriteToFile())await this.writeToFile(n);console.log(n)}if(this.fingersCrossedConfig.stopBuffering)this.logBuffer=[]}if(this.isActivated){if(this.shouldWriteToFile())await this.writeToFile(t);console.log(t)}}shouldLog(e){if(!this.enabled)return!1;let t={debug:0,info:1,success:2,warning:3,error:4};return t[e]>=t[this.config.level]}async flushPendingWrites(){if(await Promise.all(this.pendingOperations.map((e)=>{if(e instanceof Promise)return e.catch((t)=>{console.error("Error in pending write operation:",t)});return Promise.resolve()})),or(this.currentLogFile))try{let e=es(this.currentLogFile,"r+");Qo(e),jn(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(!q()&&this.config.rotation&&typeof this.config.rotation!=="boolean"&&this.config.rotation.compress)try{let t=(await sr(this.config.logDirectory)).filter((r)=>(r.includes("temp")||r.includes(".tmp"))&&r.includes(this.name));for(let r of t)try{await ar(ut(this.config.logDirectory,r))}catch(n){console.error(`Failed to delete temp file ${r}:`,n)}}catch(e){console.error("Error cleaning up temporary files:",e)}})()}getCurrentLogFilePath(){return this.currentLogFile}formatTag(e){if(!e)return"";return`${this.tagFormat.prefix}${e}${this.tagFormat.suffix}`}formatFileTimestamp(e){return`[${e.toISOString()}]`}formatConsoleTimestamp(e){return this.shouldStyleConsole()?T.gray(e.toLocaleTimeString()):e.toLocaleTimeString()}shouldStyleConsole(){if(!this.fancy||q())return!1;let e=typeof O.env.NO_COLOR<"u",t=O.env.FORCE_COLOR==="0";if(e||t)return!1;return!!(typeof O.stderr<"u"&&O.stderr.isTTY||typeof O.stdout<"u"&&O.stdout.isTTY)}formatConsoleMessage(e){let{timestamp:t,icon:r="",tag:n="",message:i,level:o,showTimestamp:s=!0}=e,l=(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=O.stdout.columns||120,c="";if(o==="warning"||o==="error")c=`${r} ${i}`;else if(o==="info"||o==="success")c=`${r} ${n} ${i}`;else c=`${r} ${n} ${T.cyan(i)}`;if(!s)return c.trim();let u=l(c).trim().length,f=l(t).length,d=Math.max(1,a-2-u-f);return`${c.trim()}${" ".repeat(d)}${t}`}formatMessage(e,t){if(t.length===1&&Array.isArray(t[0]))return e.replace(/\{(\d+)\}/g,(o,s)=>{let l=Number.parseInt(s,10);return l<t[0].length?String(t[0][l]):o});let r=/%([sdijfo%])/g,n=0,i=e.replace(r,(o,s)=>{if(s==="%")return"%";if(n>=t.length)return o;let l=t[n++];switch(s){case"s":return String(l);case"d":case"i":return Number(l).toString();case"j":case"o":return JSON.stringify(l,null,2);default:return o}});if(n<t.length)i+=` ${t.slice(n).map((o)=>typeof o==="object"?JSON.stringify(o,null,2):String(o)).join(" ")}`;return i}formatMarkdown(e){if(!e)return e;let t=e;return t=t.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(r,n,i)=>{let o=T.underline(T.blue(n)),s=this.toAbsoluteFilePath(i);if(s&&this.shouldStyleConsole()&&this.supportsHyperlinks()){let l=`file://${encodeURI(s)}`,a="\x1B]8;;",c="\x1B\\";return`\x1B]8;;${l}\x1B\\${o}\x1B]8;;\x1B\\`}if(this.shouldStyleConsole()&&this.supportsHyperlinks())return`\x1B]8;;${i}\x1B\\${o}\x1B]8;;\x1B\\`;return o}),t=t.replace(/`([^`]+)`/g,(r,n)=>T.bgGray(n)),t=t.replace(/\*\*([^*]+)\*\*/g,(r,n)=>T.bold(n)),t=t.replace(/(?<!\*)\*([^*]+)\*(?!\*)/g,(r,n)=>T.italic(n)),t=t.replace(/(?<!_)_([^_]+)_(?!_)/g,(r,n)=>T.italic(n)),t=t.replace(/~([^~]+)~/g,(r,n)=>T.strikethrough(n)),t}supportsHyperlinks(){if(q())return!1;let e=O.env;if(!e)return!1;if(e.TERM_PROGRAM==="iTerm.app"||e.TERM_PROGRAM==="vscode"||e.TERM_PROGRAM==="WezTerm")return!0;if(e.WT_SESSION)return!0;if(e.TERM==="xterm-kitty")return!0;let t=e.VTE_VERSION?Number.parseInt(e.VTE_VERSION,10):0;if(!Number.isNaN(t)&&t>=5000)return!0;return!1}toAbsoluteFilePath(e){try{let t=e;if(t.startsWith("file://"))t=t.replace(/^file:\/\//,"");if(t.startsWith("~")){let r=O.env.HOME||"";if(r)t=t.replace(/^~(?=$|\/)/,r)}if(yd(t)||t.startsWith("./")||t.startsWith("../"))t=bd(t);else return null;return or(t)?t:null}catch{return null}}buildOutputTexts(e){let t=this.shouldStyleConsole()?this.formatMarkdown(e):e,r=e.replace(this.ANSI_PATTERN,"");return{consoleText:t,fileText:r}}async log(e,t,...r){if(!this.shouldLog(e))return;let n=new Date,i=this.formatConsoleTimestamp(n),o=this.formatFileTimestamp(n),s,l;if(t instanceof Error)s=t.message,l=t.stack;else s=this.formatMessage(t,r);let{consoleText:a,fileText:c}=this.buildOutputTexts(s);if(this.shouldStyleConsole()){let f=this.options.showIcons===!1?"":Ih[e],d=this.options.showTags!==!1&&this.name?T.gray(this.formatTag(this.name)):"",h;switch(e){case"debug":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:T.gray(a),level:e}),console.error(h);break;case"info":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:a,level:e}),console.warn(h);break;case"success":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:T.green(a),level:e}),console.error(h);break;case"warning":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:a,level:e}),console.warn(h);break;case"error":if(h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:a,level:e}),console.error(h),l){let g=l.split(`
42
42
  `);for(let m of g)if(m.trim()&&!m.includes(s))console.error(this.formatConsoleMessage({timestamp:i,message:T.gray(` ${m}`),level:e,showTimestamp:!1}))}break}}else if(!q()){if(console.error(`${o} ${this.environment}.${e.toUpperCase()}: ${s}`),l)console.error(l)}let u=`${o} ${this.environment}.${e.toUpperCase()}: ${c}
43
43
  `;if(l)u+=`${l}
44
44
  `;if(u=u.replace(this.ANSI_PATTERN,""),this.shouldWriteToFile())await this.writeToFile(u)}progress(e,t=""){let r={update:(l,a)=>{},finish:(l)=>{},interrupt:(l,a)=>{}};if(!this.enabled)return r;let n=30;if(this.activeProgressBar={total:Math.max(1,e||1),current:0,message:t||"",barLength:n,lastRenderedLine:""},this.shouldStyleConsole()&&!q()&&O.stdout.isTTY)this.renderProgressBar(this.activeProgressBar);return{update:(l,a)=>{if(!this.enabled||!this.activeProgressBar)return;if(this.activeProgressBar.current=Math.min(Math.max(0,l),this.activeProgressBar.total),a!==void 0)this.activeProgressBar.message=a;if(this.shouldStyleConsole()&&!q()&&O.stdout.isTTY)this.renderProgressBar(this.activeProgressBar)},finish:(l)=>{if(!this.activeProgressBar)return;this.finishProgressBar(this.activeProgressBar,l)},interrupt:(l,a="info")=>{if(!q()&&O.stdout.isTTY)O.stdout.write(`
45
45
  `);if(this[a==="warning"?"warn":a](l),this.activeProgressBar&&this.shouldStyleConsole()&&!q()&&O.stdout.isTTY)this.renderProgressBar(this.activeProgressBar)}}}time(e){let t=performance.now();if(this.shouldStyleConsole()){let r=this.options.showTags!==!1&&this.name?T.gray(this.formatTag(this.name)):"",n=this.formatConsoleTimestamp(new Date);console.error(this.formatConsoleMessage({timestamp:n,icon:this.options.showIcons===!1?"":T.blue("\u25D0"),tag:r,message:`${T.cyan(e)}...`}))}return async(r)=>{if(!this.enabled)return;let n=performance.now(),i=Math.round(n-t),o=`${e} completed in ${i}ms`,s=new Date,l=this.formatConsoleTimestamp(s),c=`${this.formatFileTimestamp(s)} ${this.environment}.INFO: ${o}`;if(r)c+=` ${JSON.stringify(r)}`;if(c+=`
46
- `,c=c.replace(this.ANSI_PATTERN,""),this.shouldStyleConsole()){let u=this.options.showTags!==!1&&this.name?T.gray(this.formatTag(this.name)):"";console.error(this.formatConsoleMessage({timestamp:l,icon:this.options.showIcons===!1?"":T.green("\u2713"),tag:u,message:`${o}${r?` ${JSON.stringify(r)}`:""}`}))}else if(!q())console.error(c.trim());if(this.shouldWriteToFile())await this.writeToFile(c)}}async debug(e,...t){await this.log("debug",e,...t)}async info(e,...t){await this.log("info",e,...t)}async success(e,...t){await this.log("success",e,...t)}async warn(e,...t){await this.log("warning",e,...t)}async error(e,...t){await this.log("error",e,...t)}validateEncryptionConfig(){if(!this.config.rotation)return!1;if(typeof this.config.rotation==="boolean")return!1;let e=this.config.rotation,{encrypt:t}=e;return!!t}async only(e){if(!this.enabled)return;return await e()}isEnabled(){return this.enabled}setEnabled(e){this.enabled=e}extend(e){let t=`${this.name}:${e}`,r=new Pr(t,{...this.options,logDirectory:this.config.logDirectory,level:this.config.level,format:this.config.format,rotation:typeof this.config.rotation==="boolean"?void 0:this.config.rotation,timestamp:typeof this.config.timestamp==="boolean"?void 0:this.config.timestamp});return this.subLoggers.add(r),r}createReadStream(){if(q())throw Error("createReadStream is not supported in browser environments");if(!or(this.currentLogFile))throw Error(`Log file does not exist: ${this.currentLogFile}`);return Zo(this.currentLogFile,{encoding:"utf8"})}async decrypt(e){if(!this.validateEncryptionConfig())throw Error("Encryption is not configured");let t=this.config.rotation;if(!t.encrypt||typeof t.encrypt==="boolean")throw Error("Invalid encryption configuration");if(!this.currentKeyId||!this.keys.has(this.currentKeyId))throw Error("No valid encryption key available");let r=this.keys.get(this.currentKeyId);try{let n=Se.isBuffer(e)?e:Se.from(e,"base64"),i=n.subarray(0,16),o=n.subarray(n.length-16),s=n.subarray(16,n.length-16),l=fd("aes-256-gcm",r,i);l.setAuthTag(o);let a=l.update(s),c=l.final(),u=a.length+c.length,f=Se.allocUnsafe(u);return a.copy(f,0),c.copy(f,a.length),f.toString("utf8")}catch(n){throw Error(`Decryption failed: ${n instanceof Error?n.message:String(n)}`)}}getLevel(){return this.config.level}getLogDirectory(){return this.config.logDirectory}getFormat(){return this.config.format}getRotationConfig(){return this.config.rotation}isBrowserMode(){return q()}isServerMode(){return!q()}setTestEncryptionKey(e,t){this.currentKeyId=e,this.keys.set(e,t)}getTestCurrentKey(){if(!this.currentKeyId||!this.keys.has(this.currentKeyId))return null;return{id:this.currentKeyId,key:this.keys.get(this.currentKeyId)}}getConfig(){return this.config}async box(e){if(!this.enabled)return;let t=new Date,r=this.formatConsoleTimestamp(t),n=this.formatFileTimestamp(t),{consoleText:i,fileText:o}=this.buildOutputTexts(e);if(this.shouldStyleConsole()){let l=i.split(`
46
+ `,c=c.replace(this.ANSI_PATTERN,""),this.shouldStyleConsole()){let u=this.options.showTags!==!1&&this.name?T.gray(this.formatTag(this.name)):"";console.error(this.formatConsoleMessage({timestamp:l,icon:this.options.showIcons===!1?"":T.green("\u2713"),tag:u,message:`${o}${r?` ${JSON.stringify(r)}`:""}`}))}else if(!q())console.error(c.trim());if(this.shouldWriteToFile())await this.writeToFile(c)}}async debug(e,...t){await this.log("debug",e,...t)}async info(e,...t){await this.log("info",e,...t)}async success(e,...t){await this.log("success",e,...t)}async warn(e,...t){await this.log("warning",e,...t)}async error(e,...t){await this.log("error",e,...t)}validateEncryptionConfig(){if(!this.config.rotation)return!1;if(typeof this.config.rotation==="boolean")return!1;let e=this.config.rotation,{encrypt:t}=e;return!!t}async only(e){if(!this.enabled)return;return await e()}isEnabled(){return this.enabled}setEnabled(e){this.enabled=e}extend(e){let t=`${this.name}:${e}`,r=new Pr(t,{...this.options,logDirectory:this.config.logDirectory,level:this.config.level,format:this.config.format,rotation:typeof this.config.rotation==="boolean"?void 0:this.config.rotation,timestamp:typeof this.config.timestamp==="boolean"?void 0:this.config.timestamp});return this.subLoggers.add(r),r}createReadStream(){if(q())throw Error("createReadStream is not supported in browser environments");if(!or(this.currentLogFile))throw Error(`Log file does not exist: ${this.currentLogFile}`);return Zo(this.currentLogFile,{encoding:"utf8"})}async decrypt(e){if(!this.validateEncryptionConfig())throw Error("Encryption is not configured");let t=this.config.rotation;if(!t.encrypt||typeof t.encrypt==="boolean")throw Error("Invalid encryption configuration");if(!this.currentKeyId||!this.keys.has(this.currentKeyId))throw Error("No valid encryption key available");let r=this.keys.get(this.currentKeyId);try{let n=Se.isBuffer(e)?e:Se.from(e,"base64"),i=n.subarray(0,16),o=n.subarray(n.length-16),s=n.subarray(16,n.length-16),l=dd("aes-256-gcm",r,i);l.setAuthTag(o);let a=l.update(s),c=l.final(),u=a.length+c.length,f=Se.allocUnsafe(u);return a.copy(f,0),c.copy(f,a.length),f.toString("utf8")}catch(n){throw Error(`Decryption failed: ${n instanceof Error?n.message:String(n)}`)}}getLevel(){return this.config.level}getLogDirectory(){return this.config.logDirectory}getFormat(){return this.config.format}getRotationConfig(){return this.config.rotation}isBrowserMode(){return q()}isServerMode(){return!q()}setTestEncryptionKey(e,t){this.currentKeyId=e,this.keys.set(e,t)}getTestCurrentKey(){if(!this.currentKeyId||!this.keys.has(this.currentKeyId))return null;return{id:this.currentKeyId,key:this.keys.get(this.currentKeyId)}}getConfig(){return this.config}async box(e){if(!this.enabled)return;let t=new Date,r=this.formatConsoleTimestamp(t),n=this.formatFileTimestamp(t),{consoleText:i,fileText:o}=this.buildOutputTexts(e);if(this.shouldStyleConsole()){let l=i.split(`
47
47
  `),a=Math.max(...l.map((d)=>d.length))+2,c=`\u250C${"\u2500".repeat(a)}\u2510`,u=`\u2514${"\u2500".repeat(a)}\u2518`,f=l.map((d)=>this.formatConsoleMessage({timestamp:r,message:T.cyan(d),showTimestamp:!1}));console.error(this.formatConsoleMessage({timestamp:r,message:T.cyan(c),showTimestamp:!1})),f.forEach((d)=>console.error(d)),console.error(this.formatConsoleMessage({timestamp:r,message:T.cyan(u),showTimestamp:!1}))}else if(!q())console.error(`${n} ${this.environment}.INFO: [BOX] ${o}`);let s=`${n} ${this.environment}.INFO: [BOX] ${o}
48
48
  `.replace(this.ANSI_PATTERN,"");if(this.shouldWriteToFile())await this.writeToFile(s)}async prompt(e){if(q())return Promise.resolve(!0);return new Promise((t)=>{console.error(`${T.cyan("?")} ${e} (y/n) `);let r=(n)=>{let i=n.toString().trim().toLowerCase();O.stdin.removeListener("data",r);try{if(typeof O.stdin.setRawMode==="function")O.stdin.setRawMode(!1)}catch{}O.stdin.pause(),console.error(""),t(i==="y"||i==="yes")};try{if(typeof O.stdin.setRawMode==="function")O.stdin.setRawMode(!0)}catch{}O.stdin.resume(),O.stdin.once("data",r)})}setFancy(e){this.fancy=e}isFancy(){return this.fancy}pause(){this.enabled=!1}resume(){this.enabled=!0}async start(e,...t){if(!this.enabled)return;let r=e;if(t&&t.length>0){let a=/%([sdijfo%])/g,c=0;if(r=e.replace(a,(u,f)=>{if(f==="%")return"%";if(c>=t.length)return u;let d=t[c++];switch(f){case"s":return String(d);case"d":case"i":return Number(d).toString();case"j":case"o":return JSON.stringify(d,null,2);default:return u}}),c<t.length)r+=` ${t.slice(c).map((u)=>typeof u==="object"?JSON.stringify(u,null,2):String(u)).join(" ")}`}let{consoleText:n,fileText:i}=this.buildOutputTexts(r);if(this.shouldStyleConsole()){let a=this.options.showTags!==!1&&this.name?T.gray(this.formatTag(this.name)):"",c=this.options.showIcons===!1?"":`${T.blue("\u25D0")} `;console.error(`${c}${a} ${T.cyan(n)}`)}let l=`[${new Date().toISOString()}] ${this.environment}.INFO: [START] ${i}
49
49
  `.replace(this.ANSI_PATTERN,"");if(this.shouldWriteToFile())await this.writeToFile(l)}renderProgressBar(e,t=!1){if(!this.enabled||!this.shouldStyleConsole()||!O.stdout.isTTY)return;let r=Math.min(100,Math.max(0,Math.round(e.current/e.total*100))),n=Math.round(e.barLength*r/100),i=e.barLength-n,o=T.green("\u2501".repeat(n)),s=T.gray("\u2501".repeat(i)),l=`[${o}${s}]`,a=`${r}%`.padStart(4),c=e.message?` ${e.message}`:"",u=this.options.showIcons===!1?"":t||r===100?T.green("\u2713"):T.blue("\u25B6"),f=this.options.showTags!==!1&&this.name?` ${T.gray(this.formatTag(this.name))}`:"",d=`\r${u}${f} ${l} ${a}${c}`,h=O.stdout.columns||80,g=" ".repeat(Math.max(0,h-d.replace(this.ANSI_PATTERN,"").length));if(e.lastRenderedLine=`${d}${g}`,O.stdout.write(e.lastRenderedLine),t)O.stdout.write(`
50
- `)}finishProgressBar(e,t){if(!this.enabled||!this.fancy||q()||!O.stdout.isTTY){this.activeProgressBar=null;return}if(e.current<e.total)e.current=e.total;if(t)e.message=t;this.renderProgressBar(e,!0),this.activeProgressBar=null}async clear(e={}){if(q()){console.warn("Log clearing is not supported in browser environments.");return}try{console.warn("Clearing logs...",this.config.logDirectory);let t=await sr(this.config.logDirectory),r=[];for(let n of t){if(!(e.name?new RegExp(e.name.replace("*",".*")).test(n):n.startsWith(this.name))||!n.endsWith(".log"))continue;let o=ut(this.config.logDirectory,n);if(e.before)try{if((await ct(o)).mtime>=e.before)continue}catch(s){console.error(`Failed to get stats for file ${o}:`,s);continue}r.push(o)}if(r.length===0){console.warn("No log files matched the criteria for clearing.");return}console.warn(`Preparing to delete ${r.length} log file(s)...`);for(let n of r)try{await ar(n),console.warn(`Deleted log file: ${n}`)}catch(i){console.error(`Failed to delete log file ${n}:`,i)}console.warn("Log clearing process finished.")}catch(t){console.error("Error during log clearing process:",t)}}}async function Ih(e,t={}){let{maxRetries:r=3,retryDelay:n=1000,isRetryable:i=()=>!0,fallback:o}=t,s=Error("Unknown error occurred");for(let l=0;l<=r;l++)try{return await e()}catch(a){if(s=a instanceof Error?a:Error(String(a)),l===r||!i(s))break;if(n>0)await new Promise((c)=>setTimeout(c,n))}if(o!==void 0)return o;throw s instanceof Error?s:Error(`Unknown error: ${String(s)}`)}class hi{defaultParsers;constructor(){this.defaultParsers=[{name:"boolean",canParse:(e,t)=>t==="boolean"||["true","false","1","0","yes","no"].includes(e.toLowerCase()),parse:(e)=>{let t=e.toLowerCase();return["true","1","yes"].includes(t)}},{name:"number",canParse:(e,t)=>t==="number"||!Number.isNaN(Number(e))&&!Number.isNaN(Number.parseFloat(e)),parse:(e)=>{let t=Number(e);if(Number.isNaN(t))throw TypeError(`Cannot parse "${e}" as number`);return t}},{name:"array",canParse:(e,t)=>t==="array"||e.startsWith("[")||e.includes(","),parse:(e)=>{try{let t=JSON.parse(e);if(Array.isArray(t))return t}catch{}return e.split(",").map((t)=>t.trim())}},{name:"json",canParse:(e,t)=>t==="object"||(e.startsWith("{")&&e.endsWith("}")||e.startsWith("[")&&e.endsWith("]")),parse:(e)=>{try{return JSON.parse(e)}catch(t){throw Error(`Cannot parse "${e}" as JSON: ${t}`)}}}]}async applyEnvironmentVariables(e,t,r={}){let{prefix:n,useCamelCase:i=!0,useBackwardCompatibility:o=!0,customParsers:s={},verbose:l=!1,trackPerformance:a=!0}=r,c=async()=>{if(!e)return{config:t,source:{type:"environment",priority:50,timestamp:new Date}};let u=n||this.generateEnvPrefix(e),f={...t};return this.processObject(f,[],u,{useCamelCase:i,useBackwardCompatibility:o,customParsers:s,verbose:l,configName:e}),{config:f,source:{type:"environment",priority:50,timestamp:new Date}}};if(a)return ii.track("applyEnvironmentVariables",c,{configName:e});return c()}generateEnvPrefix(e){return e.toUpperCase().replace(/-/g,"_")}formatEnvKey(e,t){if(!t)return e.toUpperCase();return e.replace(/([A-Z])/g,"_$1").toUpperCase()}processObject(e,t,r,n){for(let[i,o]of Object.entries(e)){let s=[...t,i],l=s.map((u)=>this.formatEnvKey(u,n.useCamelCase)),a=`${r}_${l.join("_")}`,c=n.useBackwardCompatibility?`${r}_${s.map((u)=>u.toUpperCase()).join("_")}`:null;if(n.verbose);if(typeof o==="object"&&o!==null&&!Array.isArray(o))this.processObject(o,s,r,n);else{let u=cr.env[a]||(c?cr.env[c]:void 0);if(u!==void 0){if(n.verbose){let f=cr.env[a]?a:c}try{e[i]=this.parseEnvironmentValue(u,typeof o,a,n.customParsers,n.configName)}catch(f){if(f instanceof di)throw f;throw Ge.envVar(a,u,typeof o,n.configName)}}}}}parseEnvironmentValue(e,t,r,n,i){for(let[o,s]of Object.entries(n))try{return s(e)}catch{continue}for(let o of this.defaultParsers)if(o.canParse(e,t))try{return o.parse(e)}catch{throw Ge.envVar(r,e,`${t} (via ${o.name} parser)`,i)}return e}getEnvironmentVariables(e){let t={},r=e.toUpperCase();for(let[n,i]of Object.entries(cr.env))if(n.startsWith(r)&&i!==void 0)t[n]=i;return t}validateEnvironmentVariable(e,t,r){let n=[];if(!/^[A-Z_][A-Z0-9_]*$/.test(e))n.push(`Environment variable key "${e}" should only contain uppercase letters, numbers, and underscores`);if(r)try{this.parseEnvironmentValue(e,t,r,{})}catch(i){n.push(`Cannot parse value "${t}" as ${r}: ${i}`)}return{isValid:n.length===0,errors:n}}generateEnvVarDocs(e,t,r={}){let{prefix:n,format:i="text"}=r,o=n||this.generateEnvPrefix(e),s=[];switch(this.extractEnvVarInfo(t,[],o,s),i){case"markdown":return this.formatAsMarkdown(s,e);case"json":return JSON.stringify(s,null,2);default:return this.formatAsText(s,e)}}extractEnvVarInfo(e,t,r,n){for(let[i,o]of Object.entries(e)){let s=[...t,i],l=`${r}_${s.map((a)=>this.formatEnvKey(a,!0)).join("_")}`;if(typeof o==="object"&&o!==null&&!Array.isArray(o))this.extractEnvVarInfo(o,s,r,n);else n.push({key:l,type:Array.isArray(o)?"array":typeof o,description:`Configuration for ${s.join(".")}`,example:this.generateExample(o)})}}generateExample(e){if(Array.isArray(e))return JSON.stringify(e);if(typeof e==="object"&&e!==null)return JSON.stringify(e);return String(e)}formatAsText(e,t){let r=`Environment Variables for ${t}:
50
+ `)}finishProgressBar(e,t){if(!this.enabled||!this.fancy||q()||!O.stdout.isTTY){this.activeProgressBar=null;return}if(e.current<e.total)e.current=e.total;if(t)e.message=t;this.renderProgressBar(e,!0),this.activeProgressBar=null}async clear(e={}){if(q()){console.warn("Log clearing is not supported in browser environments.");return}try{console.warn("Clearing logs...",this.config.logDirectory);let t=await sr(this.config.logDirectory),r=[];for(let n of t){if(!(e.name?new RegExp(e.name.replace("*",".*")).test(n):n.startsWith(this.name))||!n.endsWith(".log"))continue;let o=ut(this.config.logDirectory,n);if(e.before)try{if((await ct(o)).mtime>=e.before)continue}catch(s){console.error(`Failed to get stats for file ${o}:`,s);continue}r.push(o)}if(r.length===0){console.warn("No log files matched the criteria for clearing.");return}console.warn(`Preparing to delete ${r.length} log file(s)...`);for(let n of r)try{await ar(n),console.warn(`Deleted log file: ${n}`)}catch(i){console.error(`Failed to delete log file ${n}:`,i)}console.warn("Log clearing process finished.")}catch(t){console.error("Error during log clearing process:",t)}}}async function Ph(e,t={}){let{maxRetries:r=3,retryDelay:n=1000,isRetryable:i=()=>!0,fallback:o}=t,s=Error("Unknown error occurred");for(let l=0;l<=r;l++)try{return await e()}catch(a){if(s=a instanceof Error?a:Error(String(a)),l===r||!i(s))break;if(n>0)await new Promise((c)=>setTimeout(c,n))}if(o!==void 0)return o;throw s instanceof Error?s:Error(`Unknown error: ${String(s)}`)}class hi{defaultParsers;constructor(){this.defaultParsers=[{name:"boolean",canParse:(e,t)=>t==="boolean"||["true","false","1","0","yes","no"].includes(e.toLowerCase()),parse:(e)=>{let t=e.toLowerCase();return["true","1","yes"].includes(t)}},{name:"number",canParse:(e,t)=>t==="number"||!Number.isNaN(Number(e))&&!Number.isNaN(Number.parseFloat(e)),parse:(e)=>{let t=Number(e);if(Number.isNaN(t))throw TypeError(`Cannot parse "${e}" as number`);return t}},{name:"array",canParse:(e,t)=>t==="array"||e.startsWith("[")||e.includes(","),parse:(e)=>{try{let t=JSON.parse(e);if(Array.isArray(t))return t}catch{}return e.split(",").map((t)=>t.trim())}},{name:"json",canParse:(e,t)=>t==="object"||(e.startsWith("{")&&e.endsWith("}")||e.startsWith("[")&&e.endsWith("]")),parse:(e)=>{try{return JSON.parse(e)}catch(t){throw Error(`Cannot parse "${e}" as JSON: ${t}`)}}}]}async applyEnvironmentVariables(e,t,r={}){let{prefix:n,useCamelCase:i=!0,useBackwardCompatibility:o=!0,customParsers:s={},verbose:l=!1,trackPerformance:a=!0}=r,c=async()=>{if(!e)return{config:t,source:{type:"environment",priority:50,timestamp:new Date}};let u=n||this.generateEnvPrefix(e),f={...t};return this.processObject(f,[],u,{useCamelCase:i,useBackwardCompatibility:o,customParsers:s,verbose:l,configName:e}),{config:f,source:{type:"environment",priority:50,timestamp:new Date}}};if(a)return ii.track("applyEnvironmentVariables",c,{configName:e});return c()}generateEnvPrefix(e){return e.toUpperCase().replace(/-/g,"_")}formatEnvKey(e,t){if(!t)return e.toUpperCase();return e.replace(/([A-Z])/g,"_$1").toUpperCase()}processObject(e,t,r,n){for(let[i,o]of Object.entries(e)){let s=[...t,i],l=s.map((u)=>this.formatEnvKey(u,n.useCamelCase)),a=`${r}_${l.join("_")}`,c=n.useBackwardCompatibility?`${r}_${s.map((u)=>u.toUpperCase()).join("_")}`:null;if(n.verbose);if(typeof o==="object"&&o!==null&&!Array.isArray(o))this.processObject(o,s,r,n);else{let u=cr.env[a]||(c?cr.env[c]:void 0);if(u!==void 0){if(n.verbose){let f=cr.env[a]?a:c}try{e[i]=this.parseEnvironmentValue(u,typeof o,a,n.customParsers,n.configName)}catch(f){if(f instanceof di)throw f;throw Ge.envVar(a,u,typeof o,n.configName)}}}}}parseEnvironmentValue(e,t,r,n,i){for(let[o,s]of Object.entries(n))try{return s(e)}catch{continue}for(let o of this.defaultParsers)if(o.canParse(e,t))try{return o.parse(e)}catch{throw Ge.envVar(r,e,`${t} (via ${o.name} parser)`,i)}return e}getEnvironmentVariables(e){let t={},r=e.toUpperCase();for(let[n,i]of Object.entries(cr.env))if(n.startsWith(r)&&i!==void 0)t[n]=i;return t}validateEnvironmentVariable(e,t,r){let n=[];if(!/^[A-Z_][A-Z0-9_]*$/.test(e))n.push(`Environment variable key "${e}" should only contain uppercase letters, numbers, and underscores`);if(r)try{this.parseEnvironmentValue(e,t,r,{})}catch(i){n.push(`Cannot parse value "${t}" as ${r}: ${i}`)}return{isValid:n.length===0,errors:n}}generateEnvVarDocs(e,t,r={}){let{prefix:n,format:i="text"}=r,o=n||this.generateEnvPrefix(e),s=[];switch(this.extractEnvVarInfo(t,[],o,s),i){case"markdown":return this.formatAsMarkdown(s,e);case"json":return JSON.stringify(s,null,2);default:return this.formatAsText(s,e)}}extractEnvVarInfo(e,t,r,n){for(let[i,o]of Object.entries(e)){let s=[...t,i],l=`${r}_${s.map((a)=>this.formatEnvKey(a,!0)).join("_")}`;if(typeof o==="object"&&o!==null&&!Array.isArray(o))this.extractEnvVarInfo(o,s,r,n);else n.push({key:l,type:Array.isArray(o)?"array":typeof o,description:`Configuration for ${s.join(".")}`,example:this.generateExample(o)})}}generateExample(e){if(Array.isArray(e))return JSON.stringify(e);if(typeof e==="object"&&e!==null)return JSON.stringify(e);return String(e)}formatAsText(e,t){let r=`Environment Variables for ${t}:
51
51
 
52
52
  `;for(let n of e)r+=`${n.key}
53
53
  `,r+=` Type: ${n.type}
@@ -59,10 +59,10 @@ export type ConfigOf = Config
59
59
  `;r+=`| Variable | Type | Description | Example |
60
60
  `,r+=`|----------|------|-------------|----------|
61
61
  `;for(let n of e)r+=`| \`${n.key}\` | ${n.type} | ${n.description} | \`${n.example}\` |
62
- `;return r}}function Ph(e,t,r={}){return Js(e,t,r,new WeakMap)}function Js(e,t,r,n){let{arrayMergeMode:i="replace",skipNullish:o=!1,customMerger:s}=r;if(t===null||t===void 0)return o?e:t;if(s){let l=s(e,t);if(l!==void 0)return l}if(Array.isArray(t)||Array.isArray(e))return Xs(e,t,i,n);if(!ue(t)||!ue(e))return t;return Fh(e,t,r,n)}function Xs(e,t,r,n){if(Array.isArray(t)&&!Array.isArray(e))return t;if(Array.isArray(e)&&!Array.isArray(t))return t;if(Array.isArray(t)&&Array.isArray(e))switch(r){case"replace":return t;case"concat":return _h(e,t);case"smart":return Lh(e,t,n);default:return t}return t}function _h(e,t){let r=[...t];for(let n of e)if(!r.some((i)=>ni(i,n)))r.push(n);return r}function Lh(e,t,r){if(t.length===0)return e;if(e.length===0)return t;if(ue(t[0])&&ue(e[0]))return Mh(e,t,r);if(t.every((n)=>typeof n==="string")&&e.every((n)=>typeof n==="string")){let n=[...t];for(let i of e)if(!n.includes(i))n.push(i);return n}return t}function Mh(e,t,r){let n=[...t];for(let i of e){if(!ue(i)){n.push(i);continue}let o=["id","name","key","path","type"],s=!1;for(let l of o)if(l in i){if(n.find((c)=>ue(c)&&(l in c)&&c[l]===i[l])){s=!0;break}}if(!s)n.push(i)}return n}function Fh(e,t,r,n){let i=t;if(ue(i)&&n.has(i))return n.get(i);let o={...e};if(ue(i))n.set(i,o);for(let s in i){if(!Object.prototype.hasOwnProperty.call(i,s))continue;let l=i[s],a=o[s];if(r.skipNullish&&(l===null||l===void 0))continue;if(l===null||l===void 0){o[s]=l;continue}if(ue(l)&&ue(a))o[s]=Js(a,l,r,n);else if(Array.isArray(l)||Array.isArray(a))o[s]=Xs(a,l,r.arrayMergeMode||"smart",n);else o[s]=l}return o}function Zs(e,t,r="replace"){return Ph(e,t,{arrayMergeMode:r==="replace"?"replace":"smart",skipNullish:!0})}function ni(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(!ni(e[r],t[r]))return!1;return!0}if(ue(e)&&ue(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(!ni(e[i],t[i]))return!1}return!0}return!1}function ue(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}class Qs{extensions=vs;async loadFromPath(e,t,r={}){let{arrayStrategy:n="replace",useCache:i=!0,cacheTtl:o,trackPerformance:s=!0,verbose:l=!1}=r;if(i){let c=pr.getWithFileCheck("file",e);if(c){if(l)console.log(`Configuration loaded from cache: ${e}`);return c}}let a=async()=>{if(!ur(e))return null;try{let c=`?t=${Date.now()}`,u=await import(e+c),f=u.default||u,d="default"in u,h=Object.keys(u).length>0;if(!d&&!h)throw new Er(e,Error("Configuration file is empty and exports nothing"),"unknown");if(typeof f!=="object"||f===null||Array.isArray(f))throw new Er(e,Error("Configuration must export a valid object"),"unknown");let p={config:Zs(t,f,n),source:{type:"file",path:e,priority:100,timestamp:new Date}};if(i)pr.setWithFileCheck("file",p,e,o);return p}catch(c){throw c instanceof Error?Ge.configLoad(e,c):Ge.configLoad(e,Error(String(c)))}};if(s)return ii.track("loadFromPath",a,{path:e});return a()}async tryLoadFromPaths(e,t,r={}){for(let n of e)try{let i=await this.loadFromPath(n,t,r);if(i)return i}catch(i){if(i instanceof Error&&i.name==="ConfigLoadError")throw i;if(r.verbose)console.warn(`Failed to load config from ${n}:`,i)}return null}generateConfigPaths(e,t,r){return Of({name:e,directory:t,alias:r})}generateNamePatterns(e,t){return ws({name:e,alias:t})}checkFileAccess(e){return Ih(async()=>ur(e),{maxRetries:2,retryDelay:100,fallback:!1})}async discoverConfigFiles(e,t,r){let n=[];if(!ur(e))return n;if(t||r){let i=this.generateNamePatterns(t||"",r);for(let o of i)for(let s of this.extensions){let l=ys(e,`${o}${s}`);if(await this.checkFileAccess(l))n.push(l)}}else try{let{readdirSync:i}=await import("fs"),o=i(e);for(let s of o)if(this.looksLikeConfigFile(s)){let l=ys(e,s);if(await this.checkFileAccess(l))n.push(l)}}catch{return[]}return n}looksLikeConfigFile(e){return[/\.config\.(ts|js|mjs|cjs|json|mts|cts)$/,/^\..*\.(ts|js|mjs|cjs|json|mts|cts)$/,/config\.(ts|js|mjs|cjs|json|mts|cts)$/].some((r)=>r.test(e))}async validateConfigFile(e){let t=[];try{if(!ur(e))return t.push("Configuration file does not exist"),t;let r=await import(e),n=r.default||r;if(n===void 0)t.push("Configuration file must export a default value or named exports");else if(typeof n!=="object"||n===null)t.push("Configuration must be an object");else if(Array.isArray(n))t.push("Configuration cannot be an array at the root level");if(e.endsWith(".json"))try{let{readFileSync:i}=await import("fs"),o=i(e,"utf8");JSON.parse(o)}catch(i){t.push(`Invalid JSON syntax: ${i}`)}}catch(r){t.push(`Failed to load configuration file: ${r}`)}return t}async getFileModificationTime(e){try{let{statSync:t}=await import("fs");return t(e).mtime}catch{return null}}async preloadConfigurations(e,t={}){let r=new Map;return await Promise.allSettled(e.map(async(n)=>{try{let i=await this.loadFromPath(n,{},t);if(i)r.set(n,i.config)}catch(i){if(t.verbose)console.warn(`Failed to preload ${n}:`,i)}})),r}}class ea{async validateConfiguration(e,t,r={}){let{stopOnFirstError:n=!1,validateRequired:i=!0,validateTypes:o=!0,customRules:s=[],trackPerformance:l=!0,verbose:a=!1}=r,c=async()=>{let u=[],f=[],d={stopOnFirstError:n,validateRequired:i,validateTypes:o,customRules:s,trackPerformance:l,verbose:a};try{if(typeof t==="string")return await this.validateWithSchemaFile(e,t,d);else if(Array.isArray(t))return this.validateWithRules(e,[...t,...s],d);else return this.validateWithJSONSchema(e,t,d)}catch(h){return u.push({path:"",message:`Validation failed: ${h}`,rule:"system"}),{isValid:!1,errors:u,warnings:f}}};if(l)return await ii.track("validateConfiguration",c);return c()}async validateWithSchemaFile(e,t,r){try{if(!jh(t))throw new Tr(t,[{path:"",message:"Schema file does not exist"}]);let n=await import(t),i=n.default||n;if(Array.isArray(i))return this.validateWithRules(e,i,r);else return this.validateWithJSONSchema(e,i,r)}catch(n){throw new Tr(t,[{path:"",message:`Failed to load schema: ${n}`}])}}validateWithJSONSchema(e,t,r){let n=[],i=[];return this.validateObjectAgainstSchema(e,t,"",n,i,r),{isValid:n.length===0,errors:n,warnings:i}}validateObjectAgainstSchema(e,t,r,n,i,o){if(o.validateTypes&&t.type){let s=Array.isArray(e)?"array":typeof e,l=Array.isArray(t.type)?t.type:[t.type];if(!l.includes(s)){if(n.push({path:r,message:`Expected type ${l.join(" or ")}, got ${s}`,expected:l.join(" or "),actual:s,rule:"type"}),o.stopOnFirstError)return}}if(t.enum&&!t.enum.includes(e)){if(n.push({path:r,message:`Value must be one of: ${t.enum.join(", ")}`,expected:t.enum.join(", "),actual:e,rule:"enum"}),o.stopOnFirstError)return}if(typeof e==="string"){if(t.minLength!==void 0&&e.length<t.minLength)n.push({path:r,message:`String length must be at least ${t.minLength}`,expected:`>= ${t.minLength}`,actual:e.length,rule:"minLength"});if(t.maxLength!==void 0&&e.length>t.maxLength)n.push({path:r,message:`String length must not exceed ${t.maxLength}`,expected:`<= ${t.maxLength}`,actual:e.length,rule:"maxLength"});if(t.pattern){if(!new RegExp(t.pattern).test(e))n.push({path:r,message:`String does not match pattern ${t.pattern}`,expected:t.pattern,actual:e,rule:"pattern"})}}if(typeof e==="number"){if(t.minimum!==void 0&&e<t.minimum)n.push({path:r,message:`Value must be at least ${t.minimum}`,expected:`>= ${t.minimum}`,actual:e,rule:"minimum"});if(t.maximum!==void 0&&e>t.maximum)n.push({path:r,message:`Value must not exceed ${t.maximum}`,expected:`<= ${t.maximum}`,actual:e,rule:"maximum"})}if(Array.isArray(e)&&t.items)for(let s=0;s<e.length;s++){let l=r?`${r}[${s}]`:`[${s}]`;if(this.validateObjectAgainstSchema(e[s],t.items,l,n,i,o),o.stopOnFirstError&&n.length>0)return}if(e&&typeof e==="object"&&!Array.isArray(e)){let s=e;if(o.validateRequired&&t.required){for(let l of t.required)if(!(l in s)){if(n.push({path:r?`${r}.${l}`:l,message:`Missing required property '${l}'`,expected:"required",rule:"required"}),o.stopOnFirstError)return}}if(t.properties){for(let[l,a]of Object.entries(t.properties))if(l in s){let c=r?`${r}.${l}`:l;if(this.validateObjectAgainstSchema(s[l],a,c,n,i,o),o.stopOnFirstError&&n.length>0)return}}if(t.additionalProperties===!1){let l=new Set(Object.keys(t.properties||{}));for(let a of Object.keys(s))if(!l.has(a))i.push({path:r?`${r}.${a}`:a,message:`Additional property '${a}' is not allowed`,rule:"additionalProperties"})}}}validateWithRules(e,t,r){let n=[],i=[];for(let o of t)try{let s=this.getValueByPath(e,o.path),l=this.validateWithRule(s,o,o.path);if(n.push(...l),r.stopOnFirstError&&n.length>0)break}catch(s){n.push({path:o.path,message:`Rule validation failed: ${s}`,rule:"system"})}return{isValid:n.length===0,errors:n,warnings:i}}validateWithRule(e,t,r){let n=[];if(t.required&&(e===void 0||e===null))return n.push({path:r,message:t.message||`Property '${r}' is required`,expected:"required",rule:"required"}),n;if(e===void 0||e===null)return n;if(t.type){let i=Array.isArray(e)?"array":typeof e;if(i!==t.type)n.push({path:r,message:t.message||`Expected type ${t.type}, got ${i}`,expected:t.type,actual:i,rule:"type"})}if(t.min!==void 0){let i=Array.isArray(e)?e.length:typeof e==="string"?e.length:typeof e==="number"?e:0;if(i<t.min)n.push({path:r,message:t.message||`Value must be at least ${t.min}`,expected:`>= ${t.min}`,actual:i,rule:"min"})}if(t.max!==void 0){let i=Array.isArray(e)?e.length:typeof e==="string"?e.length:typeof e==="number"?e:0;if(i>t.max)n.push({path:r,message:t.message||`Value must not exceed ${t.max}`,expected:`<= ${t.max}`,actual:i,rule:"max"})}if(t.pattern&&typeof e==="string"){if(!t.pattern.test(e))n.push({path:r,message:t.message||`Value does not match pattern ${t.pattern}`,expected:t.pattern.toString(),actual:e,rule:"pattern"})}if(t.enum&&!t.enum.includes(e))n.push({path:r,message:t.message||`Value must be one of: ${t.enum.join(", ")}`,expected:t.enum.join(", "),actual:e,rule:"enum"});if(t.validator){let i=t.validator(e);if(i)n.push({path:r,message:t.message||i,rule:"custom"})}return n}getValueByPath(e,t){if(!t)return e;let r=t.split("."),n=e;for(let i of r)if(n&&typeof n==="object"&&i in n)n=n[i];else return;return n}generateRulesFromInterface(e){let t=[],r=e.matchAll(/(\w+)(\?)?:\s*(\w+)/g);for(let n of r){let[,i,o,s]=n;t.push({path:i,required:!o,type:this.mapTypeScriptType(s)})}return t}mapTypeScriptType(e){switch(e.toLowerCase()){case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"array":return"array";case"object":return"object";default:return"object"}}static createCommonRules(){return{server:[{path:"port",required:!0,type:"number",min:1,max:65535},{path:"host",required:!0,type:"string",min:1},{path:"ssl",type:"boolean"}],database:[{path:"url",required:!0,type:"string",min:1},{path:"pool",type:"number",min:1,max:100},{path:"timeout",type:"number",min:0}],api:[{path:"baseUrl",required:!0,type:"string",pattern:Dh},{path:"timeout",type:"number",min:0},{path:"retries",type:"number",min:0,max:10}]}}}function Bh(e){if(!e)return"";let t=Array.isArray(e)?e.filter(Boolean):[e];if(t.length===0)return"";if(t.length===1)return` or alias "${t[0]}"`;return` or aliases ${t.map((r)=>`"${r}"`).join(", ")}`}class ta{fileLoader=new Qs;envProcessor=new hi;validator=new ea;async loadConfig(e){let t=Date.now(),{cache:r,performance:n,schema:i,validate:o,...s}=e;try{if(r?.enabled){let a=this.checkCache(s.name||"",s);if(a)return a}let l;try{l=await this.loadConfigurationStrategies(s,!0,r)}catch(a){if(s.configFile)throw a;let c=s.__strictErrorHandling;if(a instanceof Error&&a.name==="ConfigNotFoundError"){if(c)throw a;l={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`No configuration file found for "${s.name||"config"}", using defaults with environment variables`]}}else if(a instanceof Error&&a.name==="ConfigLoadError"){let u=a.message.includes("EACCES")||a.message.includes("EPERM")||a.message.includes("permission denied"),f=!u&&(a.message.includes("syntax")||a.message.includes("Expected")||a.message.includes("Unexpected")||a.message.includes("BuildMessage")||a.message.includes("errors building")),d=a.message.includes("Configuration must export a valid object")||a.message.includes("Configuration file is empty and exports nothing");if(c&&(d||u))throw a;if(f&&(!c||!d))l={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:["Configuration file has syntax errors, using defaults with environment variables"]};else if(!c)l={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`Configuration loading error, using defaults: ${a.message}`]};else throw a}else l={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`Configuration loading failed, using defaults: ${a instanceof Error?a.message:String(a)}`]}}if(i||o)await this.validateConfiguration(l.config,i,o,s.name);if(r?.enabled&&l)this.cacheResult(s.name||"",l,r,s);if(n?.enabled){let a={operation:"loadConfig",duration:Date.now()-t,configName:s.name,timestamp:new Date};if(n.onMetrics)n.onMetrics(a);if(n.slowThreshold&&a.duration>n.slowThreshold)he.warn(`Slow configuration loading detected: ${a.duration}ms for ${s.name}`);l.metrics=a}return l}catch(l){if(l instanceof Error&&l.name==="ConfigNotFoundError")throw l;let a=Date.now()-t;throw he.error(`Configuration loading failed after ${a}ms:`,[l instanceof Error?l:Error(String(l))]),l}}async loadConfigurationStrategies(e,t=!1,r){let{name:n="",alias:i,configFile:o,cwd:s,configDir:l,defaultConfig:a,checkEnv:c=!0,arrayStrategy:u="replace",verbose:f=!1}=e,d=s||Nr.cwd(),h=[];if(o){let b=ve(d,o);h.push(b);let v=c?At(n,a,f):a,R=await this.fileLoader.tryLoadFromPaths([b],v,{arrayStrategy:u,verbose:f,cacheTtl:r?.ttl,useCache:!r?.ttl||r.ttl>100});if(!R)throw Ge.configNotFound(n||o,h,i);if(f)he.success(`Configuration loaded from explicit path: ${b}`);return this.finalizeResult(R,h,c,n,f)}let g=await this.loadLocalConfiguration(n,i,d,l,a,u,f,c,r);if(g)return h.push(...this.getLocalSearchPaths(n,i,d,l)),this.finalizeResult(g,h,c,n,f);let m=await this.loadHomeConfiguration(n,i,a,u,f,c);if(m)return h.push(...this.getHomeSearchPaths(n,i)),this.finalizeResult(m,h,c,n,f);let p=await this.loadPackageJsonConfiguration(n,i,d,a,u,f,c);if(p)return h.push(ve(d,"package.json")),this.finalizeResult(p,h,c,n,f);if(h.push(...this.getAllSearchPaths(n,i,d,l)),t)throw Ge.configNotFound(n,h,i);return{...await this.applyEnvironmentVariables(n,a,c,f),warnings:[`No configuration file found for "${n}"${Bh(i)}, using defaults with environment variables`]}}async loadLocalConfiguration(e,t,r,n,i,o,s,l,a){let c=l?At(e,i,s):i,u=this.getLocalDirectories(r,n);for(let f of u){if(s)he.info(`Searching for configuration in: ${f}`);let d=this.fileLoader.generateConfigPaths(e,f,t),h=await this.fileLoader.tryLoadFromPaths(d,c,{arrayStrategy:o,verbose:s,cacheTtl:a?.ttl,useCache:!a?.ttl||a.ttl>100});if(h){if(s)he.success(`Configuration loaded from: ${h.source.path}`);return h}}return null}async loadHomeConfiguration(e,t,r,n,i,o){if(!e)return null;let s=o?At(e,r,i):r,l=[ve(tt(),".config",e),ve(tt(),".config"),tt()];for(let a of l){if(i)he.info(`Checking home directory: ${a}`);let c=this.fileLoader.generateConfigPaths(e,a,t),u=await this.fileLoader.tryLoadFromPaths(c,s,{arrayStrategy:n,verbose:i});if(u){if(i)he.success(`Configuration loaded from home directory: ${u.source.path}`);return u}}return null}async loadPackageJsonConfiguration(e,t,r,n,i,o,s){let l=s?At(e,n,o):n;try{let a=ve(r,"package.json");if(!Pf(a))return null;let c={};try{c=JSON.parse(_f(a,"utf8"))}catch(d){if(o)he.warn("Failed to parse package.json:",[d instanceof Error?d:Error(String(d))]);return null}let u=c[e],f=e;if(!u&&t){let d=Array.isArray(t)?t:[t];for(let h of d){if(!h)continue;if(c[h]){u=c[h],f=h;break}}}if(u&&typeof u==="object"&&!Array.isArray(u)){if(o)he.success(`Configuration loaded from package.json: ${f}`);return{config:Zs(l,u,i),source:{type:"package.json",path:a,priority:30,timestamp:new Date}}}}catch(a){if(o)he.warn("Failed to load package.json:",[a instanceof Error?a:Error(String(a))])}return null}async applyEnvironmentVariables(e,t,r,n){if(!r||!e||typeof t!=="object"||t===null||Array.isArray(t))return{config:t,source:{type:"default",priority:10,timestamp:new Date}};return{config:At(e,t,n),source:{type:"environment",priority:20,timestamp:new Date}}}async finalizeResult(e,t,r,n,i){return{config:e.config,source:e.source,path:e.source.path}}async validateConfiguration(e,t,r,n){let i=[];if(r){let o=r(e);if(o)i.push(...o)}if(t){let o=await this.validator.validateConfiguration(e,t);if(!o.isValid)i.push(...o.errors.map((s)=>s.path?`${s.path}: ${s.message}`:s.message))}if(i.length>0)throw Ge.configValidation(n||"unknown",i,n)}checkCache(e,t){let r=this.generateCacheKey(e,t);return pr.get(r)||null}cacheResult(e,t,r,n){let i=this.generateCacheKey(e,n);pr.set(i,t,void 0,r.ttl)}generateCacheKey(e,t){let r=[e];if(t.alias){let n=Array.isArray(t.alias)?t.alias.join(","):t.alias;r.push(`alias:${n}`)}if(t.cwd)r.push(`cwd:${t.cwd}`);if(t.configFile)r.push(`configFile:${t.configFile}`);if(t.configDir)r.push(`configDir:${t.configDir}`);if("checkEnv"in t)r.push(`checkEnv:${t.checkEnv}`);return r.join("|")}getLocalDirectories(e,t){return If({cwd:e,configDir:t})}getAllSearchPaths(e,t,r,n){let i=[];return i.push(...this.getLocalSearchPaths(e,t,r,n)),i.push(...this.getHomeSearchPaths(e,t)),i.push(ve(r,"package.json")),i}getLocalSearchPaths(e,t,r,n){let i=this.getLocalDirectories(r,n),o=[];for(let s of i)o.push(...this.fileLoader.generateConfigPaths(e,s,t));return o}getHomeSearchPaths(e,t){if(!e)return[];let r=[ve(tt(),".config",e),ve(tt(),".config"),tt()],n=[];for(let i of r)n.push(...this.fileLoader.generateConfigPaths(e,i,t));return n}async loadConfigWithResult(e){return this.loadConfig(e)}}async function ra(e){let t="defaultConfig"in e&&e.defaultConfig!==void 0?e.defaultConfig:{},r="cache"in e||"performance"in e||"schema"in e||"validate"in e;try{let n;if(r)n=await Kn.loadConfig(e);else n=await Kn.loadConfig({...e,defaultConfig:t,cache:{enabled:!0},performance:{enabled:!1}});return n?.config??t}catch(n){if(e.configFile)throw n;let i=n instanceof Error?n.name:"UnknownError",o=n instanceof Error?n.message:String(n);if(!(i==="ConfigNotFoundError"||i==="ConfigLoadError"||i==="ConfigValidationError"||o.includes("config"))&&e.verbose)he.warn("Unexpected error loading config, using defaults:",[n instanceof Error?n:Error(String(n))]);let l=r?{...e,defaultConfig:t}:{...e,defaultConfig:t,cache:{enabled:!0},performance:{enabled:!1}};if("checkEnv"in e?e.checkEnv!==!1:!0)return(await Kn.applyEnvironmentVariables(l.name||"",t,!0,l.verbose||!1))?.config??t;return t}}function At(e,t,r=!1){let n=new hi,i=e.toUpperCase().replace(/[^A-Z0-9]/g,"_");function o(s,l=[]){let a={...s};for(let[c,u]of Object.entries(s)){let f=[...l,c],d=[`${i}_${f.join("_").toUpperCase()}`,`${i}_${f.map((m)=>m.toUpperCase()).join("")}`,`${i}_${f.map((m)=>m.replace(/([A-Z])/g,"_$1").toUpperCase()).join("")}`],h,g;for(let m of d)if(h=Nr.env[m],h!==void 0){g=m;break}if(h!==void 0&&g)if(typeof u==="boolean")a[c]=["true","1","yes"].includes(h.toLowerCase());else if(typeof u==="number"){let m=Number(h);if(!Number.isNaN(m))a[c]=m}else if(Array.isArray(u))try{a[c]=JSON.parse(h)}catch{a[c]=h.split(",").map((m)=>m.trim())}else a[c]=h;else if(u&&typeof u==="object"&&!Array.isArray(u))a[c]=o(u,f)}return a}return o(t)}var pr,ii,vs,xd,vd=(e)=>e,$d=(e,t)=>{for(var r in t)xd(e,r,{get:t[r],enumerable:!0,configurable:!0,set:wd.bind(t,r)})},Cd=(e,t)=>()=>(e&&(t=e(e=0)),t),Rs,Ps,dt,Pt,_s,Jd,Xd,os,dr,Yn,X,P,Zd,ss,Qd,as,eh,th,Bn,rh,ls,cs,Un,nh,ih,oh,sh,hr,Ls,ah,Z,lh,ch,us,gr,Jn,H,E,uh,fs,fh,ds,dh,hh,Vn,gh,hs,gs,mh,Wn,ph,yh,bh,xh,vh,mr,Ms,wh,$h="0.15.6",ae,kr,Ot,Xn,Zn,Sr,Qn,ei,It,ti,ri,Fe,Fs,js,ge,Ne,Ds,Bs,Ch,kh,Us,Ar,Q1,Y,T,e$,Ah,t$,Eh,r$,n$,ms,i$,Th,Nh,o$,ps,s$,a$,l$,c$,u$,zn,Oh,f$,me,Ws,Er,zs,Ks,di,Gs,Hs,Tr,qs,Ys,Ge,Dh,he,Kn,p$,y$;var na=Ac(()=>{pr=new bs,ii=new xs,vs=[".ts",".js",".mjs",".cjs",".json",".mts",".cts"];xd=Object.defineProperty;Rs={};$d(Rs,{withErrorRecovery:()=>As,tryLoadConfig:()=>Gd,loadConfigWithResult:()=>zd,loadConfig:()=>Is,isRetryableError:()=>jd,isConfigNotFoundError:()=>Fd,isBunfigError:()=>Es,globalPerformanceMonitor:()=>Pt,globalCache:()=>dt,getEnvOrDefault:()=>Dd,generateConfigTypes:()=>Hd,defaultGeneratedDir:()=>Bs,defaultConfigDir:()=>Ds,deepMergeWithArrayStrategy:()=>ci,deepMerge:()=>Ts,createLibraryConfig:()=>qd,config:()=>Kd,bunfigPlugin:()=>Yd,applyEnvVarsToConfig:()=>Tt,TypeGenerationError:()=>ei,SchemaValidationError:()=>It,PluginError:()=>ri,PerformanceMonitor:()=>si,FileSystemError:()=>Qn,ErrorFactory:()=>Fe,EnvVarError:()=>Sr,EnvProcessor:()=>Or,ConfigValidator:()=>ui,ConfigValidationError:()=>Xn,ConfigNotFoundError:()=>kr,ConfigMergeError:()=>Zn,ConfigLoader:()=>fi,ConfigLoadError:()=>Ot,ConfigFileLoader:()=>Ir,ConfigCache:()=>oi,CacheUtils:()=>_s,BunfigError:()=>ae,BrowserConfigError:()=>ti,ArrayMergeStrategies:()=>Fs});Ch=Cd(async()=>{Ps=import.meta.require,dt=new oi,Pt=new si,_s={createKey:Rd,isEquivalent:kd,estimateMemoryUsage:Sd},Jd=xr(Hn.cwd(),"config"),Xd=xr(Hn.cwd(),"src/generated"),os=br.env.CLARITY_LOG_DIR||Bf(Td(),"logs"),dr={level:"info",defaultName:"clarity",timestamp:!0,colors:!0,format:"text",maxLogSize:10485760,logDatePattern:"YYYY-MM-DD",logDirectory:os,rotation:{frequency:"daily",maxSize:10485760,maxFiles:5,compress:!1,rotateHour:0,rotateMinute:0,rotateDayOfWeek:0,rotateDayOfMonth:1,encrypt:!1},verbose:!1},Yn=await Nd(),X={red:(e)=>`\x1B[31m${e}\x1B[0m`,green:(e)=>`\x1B[32m${e}\x1B[0m`,yellow:(e)=>`\x1B[33m${e}\x1B[0m`,blue:(e)=>`\x1B[34m${e}\x1B[0m`,magenta:(e)=>`\x1B[35m${e}\x1B[0m`,cyan:(e)=>`\x1B[36m${e}\x1B[0m`,white:(e)=>`\x1B[37m${e}\x1B[0m`,gray:(e)=>`\x1B[90m${e}\x1B[0m`,bgRed:(e)=>`\x1B[41m${e}\x1B[0m`,bgYellow:(e)=>`\x1B[43m${e}\x1B[0m`,bold:(e)=>`\x1B[1m${e}\x1B[0m`,dim:(e)=>`\x1B[2m${e}\x1B[0m`,italic:(e)=>`\x1B[3m${e}\x1B[0m`,underline:(e)=>`\x1B[4m${e}\x1B[0m`,reset:"\x1B[0m"},P=X,Zd=X.red,ss=X.green,Qd=X.yellow,as=X.blue,eh=X.magenta,th=X.cyan,Bn=X.white,rh=X.gray,ls=X.bgRed,cs=X.bgYellow,Un=X.bold,nh=X.dim,ih=X.italic,oh=X.underline,sh=X.reset,hr={activationLevel:"error",bufferSize:50,flushOnDeactivation:!0,stopBuffering:!1},Ls={debug:"\uD83D\uDD0D",info:as("\u2139"),success:ss("\u2713"),warning:cs(Bn(Un(" WARN "))),error:ls(Bn(Un(" ERROR ")))},ah=new $r("stacks"),Z=new $r("bunfig",{showTags:!0}),lh=re(Nt.cwd(),"config"),ch=re(Nt.cwd(),"src/generated"),us=yr.env.CLARITY_LOG_DIR||jf(_d(),"logs"),gr={level:"info",defaultName:"clarity",timestamp:!0,colors:!0,format:"text",maxLogSize:10485760,logDatePattern:"YYYY-MM-DD",logDirectory:us,rotation:{frequency:"daily",maxSize:10485760,maxFiles:5,compress:!1,rotateHour:0,rotateMinute:0,rotateDayOfWeek:0,rotateDayOfMonth:1,encrypt:!1},verbose:!1,writeToFile:!1},Jn=await Ld(),H={red:(e)=>`\x1B[31m${e}\x1B[0m`,green:(e)=>`\x1B[32m${e}\x1B[0m`,yellow:(e)=>`\x1B[33m${e}\x1B[0m`,blue:(e)=>`\x1B[34m${e}\x1B[0m`,magenta:(e)=>`\x1B[35m${e}\x1B[0m`,cyan:(e)=>`\x1B[36m${e}\x1B[0m`,white:(e)=>`\x1B[37m${e}\x1B[0m`,gray:(e)=>`\x1B[90m${e}\x1B[0m`,bgRed:(e)=>`\x1B[41m${e}\x1B[0m`,bgYellow:(e)=>`\x1B[43m${e}\x1B[0m`,bgGray:(e)=>`\x1B[100m${e}\x1B[0m`,bold:(e)=>`\x1B[1m${e}\x1B[0m`,dim:(e)=>`\x1B[2m${e}\x1B[0m`,italic:(e)=>`\x1B[3m${e}\x1B[0m`,underline:(e)=>`\x1B[4m${e}\x1B[0m`,strikethrough:(e)=>`\x1B[9m${e}\x1B[0m`,reset:"\x1B[0m"},E=H,uh=H.red,fs=H.green,fh=H.yellow,ds=H.blue,dh=H.magenta,hh=H.cyan,Vn=H.white,gh=H.gray,hs=H.bgRed,gs=H.bgYellow,mh=H.bgGray,Wn=H.bold,ph=H.dim,yh=H.italic,bh=H.underline,xh=H.strikethrough,vh=H.reset,mr={activationLevel:"error",bufferSize:50,flushOnDeactivation:!0,stopBuffering:!1},Ms={debug:"\uD83D\uDD0D",info:ds("\u2139"),success:fs("\u2713"),warning:gs(Vn(Wn(" WARN "))),error:hs(Vn(Wn(" ERROR ")))},wh=new Rr("stacks"),ae=class extends Error{timestamp;context;constructor(t,r={}){super(t);if(this.name=this.constructor.name,this.timestamp=new Date,this.context=r,Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)}toJSON(){return{name:this.name,code:this.code,message:this.message,timestamp:this.timestamp.toISOString(),context:this.context,stack:this.stack}}toString(){let t=Object.keys(this.context).length>0?` (${Object.entries(this.context).map(([r,n])=>`${r}: ${n}`).join(", ")})`:"";return`${this.name} [${this.code}]: ${this.message}${t}`}},kr=class extends ae{code="CONFIG_NOT_FOUND";constructor(t,r,n){let i=n?` or alias "${n}"`:"";super(`Configuration "${t}"${i} not found`,{configName:t,alias:n,searchPaths:r,searchPathCount:r.length})}},Ot=class extends ae{code="CONFIG_LOAD_ERROR";constructor(t,r,n){super(`Failed to load configuration from "${t}": ${r.message}`,{configPath:t,configName:n,originalError:r.name,originalMessage:r.message});this.cause=r}},Xn=class extends ae{code="CONFIG_VALIDATION_ERROR";constructor(t,r,n){super(`Configuration validation failed for "${t}"`,{configPath:t,configName:n,validationErrors:r,errorCount:r.length})}},Zn=class extends ae{code="CONFIG_MERGE_ERROR";constructor(t,r,n,i){super(`Failed to merge configuration from "${t}" with "${r}": ${n.message}`,{sourcePath:t,targetPath:r,configName:i,originalError:n.name,originalMessage:n.message});this.cause=n}},Sr=class extends ae{code="ENV_VAR_ERROR";constructor(t,r,n,i){super(`Failed to parse environment variable "${t}" with value "${r}" as ${n}`,{envKey:t,envValue:r,expectedType:n,configName:i})}},Qn=class extends ae{code="FILE_SYSTEM_ERROR";constructor(t,r,n){super(`File system ${t} failed for "${r}": ${n.message}`,{operation:t,path:r,originalError:n.name,originalMessage:n.message});this.cause=n}},ei=class extends ae{code="TYPE_GENERATION_ERROR";constructor(t,r,n){super(`Failed to generate types from "${t}" to "${r}": ${n.message}`,{configDir:t,outputPath:r,originalError:n.name,originalMessage:n.message});this.cause=n}},It=class extends ae{code="SCHEMA_VALIDATION_ERROR";constructor(t,r,n){super(`Schema validation failed${n?` for config "${n}"`:""}`,{schemaPath:t,configName:n,validationErrors:r,errorCount:r.length})}},ti=class extends ae{code="BROWSER_CONFIG_ERROR";constructor(t,r,n,i){super(`Failed to fetch configuration from "${t}": ${r} ${n}`,{endpoint:t,status:r,statusText:n,configName:i})}},ri=class extends ae{code="PLUGIN_ERROR";constructor(t,r,n){super(`Plugin "${t}" failed during ${r}: ${n.message}`,{pluginName:t,operation:r,originalError:n.name,originalMessage:n.message});this.cause=n}},Fe={configNotFound(e,t,r){return new kr(e,t,r)},configLoad(e,t,r){return new Ot(e,t,r)},configValidation(e,t,r){return new Xn(e,t,r)},configMerge(e,t,r,n){return new Zn(e,t,r,n)},envVar(e,t,r,n){return new Sr(e,t,r,n)},fileSystem(e,t,r){return new Qn(e,t,r)},typeGeneration(e,t,r){return new ei(e,t,r)},schemaValidation(e,t,r){return new It(e,t,r)},browserConfig(e,t,r,n){return new ti(e,t,r,n)},plugin(e,t,r){return new ri(e,t,r)}},Fs={replace:"replace",concat:"concat",smart:"smart"},js=/^https?:\/\//,ge=new Rr("bunfig",{showTags:!0}),Ne=new fi,Ds=ne(He.cwd(),"config"),Bs=ne(He.cwd(),"src/generated")});kh=vr.env.CLARITY_LOG_DIR||ld(Rh(),"logs"),Us={level:"info",defaultName:"clarity",timestamp:!0,colors:!0,format:"text",maxLogSize:10485760,logDatePattern:"YYYY-MM-DD",logDirectory:kh,rotation:{frequency:"daily",maxSize:10485760,maxFiles:5,compress:!1,rotateHour:0,rotateMinute:0,rotateDayOfWeek:0,rotateDayOfMonth:1,encrypt:!1},verbose:!1,writeToFile:!1},Ar={...Us},Q1=(async()=>{try{let{loadConfig:e}=await Ch().then(()=>Rs),t=await e({name:"clarity",alias:"logging",defaultConfig:Us,cwd:vr.cwd()});if(t)Object.assign(Ar,t)}catch{}return Ar})();Y={red:(e)=>`\x1B[31m${e}\x1B[0m`,green:(e)=>`\x1B[32m${e}\x1B[0m`,yellow:(e)=>`\x1B[33m${e}\x1B[0m`,blue:(e)=>`\x1B[34m${e}\x1B[0m`,magenta:(e)=>`\x1B[35m${e}\x1B[0m`,cyan:(e)=>`\x1B[36m${e}\x1B[0m`,white:(e)=>`\x1B[37m${e}\x1B[0m`,gray:(e)=>`\x1B[90m${e}\x1B[0m`,bgRed:(e)=>`\x1B[41m${e}\x1B[0m`,bgYellow:(e)=>`\x1B[43m${e}\x1B[0m`,bgGray:(e)=>`\x1B[100m${e}\x1B[0m`,bold:(e)=>`\x1B[1m${e}\x1B[0m`,dim:(e)=>`\x1B[2m${e}\x1B[0m`,italic:(e)=>`\x1B[3m${e}\x1B[0m`,underline:(e)=>`\x1B[4m${e}\x1B[0m`,strikethrough:(e)=>`\x1B[9m${e}\x1B[0m`,reset:"\x1B[0m"},T=Y,e$=Y.red,Ah=Y.green,t$=Y.yellow,Eh=Y.blue,r$=Y.magenta,n$=Y.cyan,ms=Y.white,i$=Y.gray,Th=Y.bgRed,Nh=Y.bgYellow,o$=Y.bgGray,ps=Y.bold,s$=Y.dim,a$=Y.italic,l$=Y.underline,c$=Y.strikethrough,u$=Y.reset,zn={activationLevel:"error",bufferSize:50,flushOnDeactivation:!0,stopBuffering:!1},Oh={debug:"\uD83D\uDD0D",info:Eh("\u2139"),success:Ah("\u2713"),warning:Nh(ms(ps(" WARN "))),error:Th(ms(ps(" ERROR ")))};f$=new Pr("stacks");me=class me extends Error{timestamp;context;constructor(e,t={}){super(e);if(this.name=this.constructor.name,this.timestamp=new Date,this.context=t,Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)}toJSON(){return{name:this.name,code:this.code,message:this.message,timestamp:this.timestamp.toISOString(),context:this.context,stack:this.stack}}toString(){let e=Object.keys(this.context).length>0?` (${Object.entries(this.context).map(([t,r])=>`${t}: ${r}`).join(", ")})`:"";return`${this.name} [${this.code}]: ${this.message}${e}`}};Ws=class Ws extends me{code="CONFIG_NOT_FOUND";constructor(e,t,r){let n=r===void 0?[]:Array.isArray(r)?r.filter(Boolean):[r],i="";if(n.length===1)i=` or alias "${n[0]}"`;else if(n.length>1)i=` or aliases ${n.map((o)=>`"${o}"`).join(", ")}`;super(`Configuration "${e}"${i} not found`,{configName:e,alias:r,searchPaths:t,searchPathCount:t.length})}};Er=class Er extends me{code="CONFIG_LOAD_ERROR";constructor(e,t,r){super(`Failed to load configuration from "${e}": ${t.message}`,{configPath:e,configName:r,originalError:t.name,originalMessage:t.message});this.cause=t}};zs=class zs extends me{code="CONFIG_VALIDATION_ERROR";constructor(e,t,r){super(`Configuration validation failed for "${e}"`,{configPath:e,configName:r,validationErrors:t,errorCount:t.length})}};Ks=class Ks extends me{code="CONFIG_MERGE_ERROR";constructor(e,t,r,n){super(`Failed to merge configuration from "${e}" with "${t}": ${r.message}`,{sourcePath:e,targetPath:t,configName:n,originalError:r.name,originalMessage:r.message});this.cause=r}};di=class di extends me{code="ENV_VAR_ERROR";constructor(e,t,r,n){super(`Failed to parse environment variable "${e}" with value "${t}" as ${r}`,{envKey:e,envValue:t,expectedType:r,configName:n})}};Gs=class Gs extends me{code="FILE_SYSTEM_ERROR";constructor(e,t,r){super(`File system ${e} failed for "${t}": ${r.message}`,{operation:e,path:t,originalError:r.name,originalMessage:r.message});this.cause=r}};Hs=class Hs extends me{code="TYPE_GENERATION_ERROR";constructor(e,t,r){super(`Failed to generate types from "${e}" to "${t}": ${r.message}`,{configDir:e,outputPath:t,originalError:r.name,originalMessage:r.message});this.cause=r}};Tr=class Tr extends me{code="SCHEMA_VALIDATION_ERROR";constructor(e,t,r){super(`Schema validation failed${r?` for config "${r}"`:""}`,{schemaPath:e,configName:r,validationErrors:t,errorCount:t.length})}};qs=class qs extends me{code="BROWSER_CONFIG_ERROR";constructor(e,t,r,n){super(`Failed to fetch configuration from "${e}": ${t} ${r}`,{endpoint:e,status:t,statusText:r,configName:n})}};Ys=class Ys extends me{code="PLUGIN_ERROR";constructor(e,t,r){super(`Plugin "${e}" failed during ${t}: ${r.message}`,{pluginName:e,operation:t,originalError:r.name,originalMessage:r.message});this.cause=r}};Ge={configNotFound(e,t,r){return new Ws(e,t,r)},configLoad(e,t,r){return new Er(e,t,r)},configValidation(e,t,r){return new zs(e,t,r)},configMerge(e,t,r,n){return new Ks(e,t,r,n)},envVar(e,t,r,n){return new di(e,t,r,n)},fileSystem(e,t,r){return new Gs(e,t,r)},typeGeneration(e,t,r){return new Hs(e,t,r)},schemaValidation(e,t,r){return new Tr(e,t,r)},browserConfig(e,t,r,n){return new qs(e,t,r,n)},plugin(e,t,r){return new Ys(e,t,r)}};Dh=/^https?:\/\//;he=new Pr("bunfig",{showTags:!0});Kn=new ta;p$=ve(Nr.cwd(),"config"),y$=ve(Nr.cwd(),"src/generated")});import{existsSync as Be,statSync as Ex,watch as kc}from"fs";import{unlink as Tx}from"fs/promises";import{dirname as Nx,resolve as Fi}from"path";import ye from"process";var{Glob:Ox}=globalThis.Bun;import{EventEmitter as Ec}from"events";import Ie from"process";import Di from"process";import on from"process";import jt from"process";import wt from"process";import Wi from"tty";import pu,{stdin as Gx,stdout as Hx}from"process";import{existsSync as wu}from"fs";import tn from"fs/promises";import zi from"os";import rn from"path";import Ue from"process";function nn(e){return e.replace(/[<[].+/,"").trim()}function Tc(e){let t=/<([^>]+)>/g,r=/\[([^\]]+)\]/g,n=[],i=(l)=>{let a=!1,c=l[1];if(c.startsWith("..."))c=c.slice(3),a=!0;else if(c.endsWith("..."))c=c.slice(0,-3),a=!0;return{required:l[0].startsWith("<"),value:c.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 Nc(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((l)=>n.names.includes(l))&&typeof o.required==="boolean"))t.boolean.push(n.names[0])}else t.boolean.push(n.names[0])}return t}function Bi(e){return e.reduce((t,r)=>t.length>=r.length?t:r,"")}function en(e,t){return e.length>=t?e:`${e}${" ".repeat(t-e.length)}`}function Ft(e){return e.replace(/([a-z])-([a-z])/g,(t,r,n)=>r+n.toUpperCase())}function Oc(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 Ic(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 Pc(e){let t=/([^\\/]+)$/.exec(e);return t?t[1]:""}function $t(e){return e.split(".").map((t,r)=>r===0?Ft(t):t).join(".")}class Ct 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}
62
+ `;return r}}function _h(e,t,r={}){return Js(e,t,r,new WeakMap)}function Js(e,t,r,n){let{arrayMergeMode:i="replace",skipNullish:o=!1,customMerger:s}=r;if(t===null||t===void 0)return o?e:t;if(s){let l=s(e,t);if(l!==void 0)return l}if(Array.isArray(t)||Array.isArray(e))return Xs(e,t,i,n);if(!ue(t)||!ue(e))return t;return jh(e,t,r,n)}function Xs(e,t,r,n){if(Array.isArray(t)&&!Array.isArray(e))return t;if(Array.isArray(e)&&!Array.isArray(t))return t;if(Array.isArray(t)&&Array.isArray(e))switch(r){case"replace":return t;case"concat":return Lh(e,t);case"smart":return Mh(e,t,n);default:return t}return t}function Lh(e,t){let r=[...t];for(let n of e)if(!r.some((i)=>ni(i,n)))r.push(n);return r}function Mh(e,t,r){if(t.length===0)return e;if(e.length===0)return t;if(ue(t[0])&&ue(e[0]))return Fh(e,t,r);if(t.every((n)=>typeof n==="string")&&e.every((n)=>typeof n==="string")){let n=[...t];for(let i of e)if(!n.includes(i))n.push(i);return n}return t}function Fh(e,t,r){let n=[...t];for(let i of e){if(!ue(i)){n.push(i);continue}let o=["id","name","key","path","type"],s=!1;for(let l of o)if(l in i){if(n.find((c)=>ue(c)&&(l in c)&&c[l]===i[l])){s=!0;break}}if(!s)n.push(i)}return n}function jh(e,t,r,n){let i=t;if(ue(i)&&n.has(i))return n.get(i);let o={...e};if(ue(i))n.set(i,o);for(let s in i){if(!Object.prototype.hasOwnProperty.call(i,s))continue;let l=i[s],a=o[s];if(r.skipNullish&&(l===null||l===void 0))continue;if(l===null||l===void 0){o[s]=l;continue}if(ue(l)&&ue(a))o[s]=Js(a,l,r,n);else if(Array.isArray(l)||Array.isArray(a))o[s]=Xs(a,l,r.arrayMergeMode||"smart",n);else o[s]=l}return o}function Zs(e,t,r="replace"){return _h(e,t,{arrayMergeMode:r==="replace"?"replace":"smart",skipNullish:!0})}function ni(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(!ni(e[r],t[r]))return!1;return!0}if(ue(e)&&ue(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(!ni(e[i],t[i]))return!1}return!0}return!1}function ue(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}class Qs{extensions=vs;async loadFromPath(e,t,r={}){let{arrayStrategy:n="replace",useCache:i=!0,cacheTtl:o,trackPerformance:s=!0,verbose:l=!1}=r;if(i){let c=pr.getWithFileCheck("file",e);if(c){if(l)console.log(`Configuration loaded from cache: ${e}`);return c}}let a=async()=>{if(!ur(e))return null;try{let c=`?t=${Date.now()}`,u=await import(e+c),f=u.default||u,d="default"in u,h=Object.keys(u).length>0;if(!d&&!h)throw new Er(e,Error("Configuration file is empty and exports nothing"),"unknown");if(typeof f!=="object"||f===null||Array.isArray(f))throw new Er(e,Error("Configuration must export a valid object"),"unknown");let p={config:Zs(t,f,n),source:{type:"file",path:e,priority:100,timestamp:new Date}};if(i)pr.setWithFileCheck("file",p,e,o);return p}catch(c){throw c instanceof Error?Ge.configLoad(e,c):Ge.configLoad(e,Error(String(c)))}};if(s)return ii.track("loadFromPath",a,{path:e});return a()}async tryLoadFromPaths(e,t,r={}){for(let n of e)try{let i=await this.loadFromPath(n,t,r);if(i)return i}catch(i){if(i instanceof Error&&i.name==="ConfigLoadError")throw i;if(r.verbose)console.warn(`Failed to load config from ${n}:`,i)}return null}generateConfigPaths(e,t,r){return If({name:e,directory:t,alias:r})}generateNamePatterns(e,t){return ws({name:e,alias:t})}checkFileAccess(e){return Ph(async()=>ur(e),{maxRetries:2,retryDelay:100,fallback:!1})}async discoverConfigFiles(e,t,r){let n=[];if(!ur(e))return n;if(t||r){let i=this.generateNamePatterns(t||"",r);for(let o of i)for(let s of this.extensions){let l=ys(e,`${o}${s}`);if(await this.checkFileAccess(l))n.push(l)}}else try{let{readdirSync:i}=await import("fs"),o=i(e);for(let s of o)if(this.looksLikeConfigFile(s)){let l=ys(e,s);if(await this.checkFileAccess(l))n.push(l)}}catch{return[]}return n}looksLikeConfigFile(e){return[/\.config\.(ts|js|mjs|cjs|json|mts|cts)$/,/^\..*\.(ts|js|mjs|cjs|json|mts|cts)$/,/config\.(ts|js|mjs|cjs|json|mts|cts)$/].some((r)=>r.test(e))}async validateConfigFile(e){let t=[];try{if(!ur(e))return t.push("Configuration file does not exist"),t;let r=await import(e),n=r.default||r;if(n===void 0)t.push("Configuration file must export a default value or named exports");else if(typeof n!=="object"||n===null)t.push("Configuration must be an object");else if(Array.isArray(n))t.push("Configuration cannot be an array at the root level");if(e.endsWith(".json"))try{let{readFileSync:i}=await import("fs"),o=i(e,"utf8");JSON.parse(o)}catch(i){t.push(`Invalid JSON syntax: ${i}`)}}catch(r){t.push(`Failed to load configuration file: ${r}`)}return t}async getFileModificationTime(e){try{let{statSync:t}=await import("fs");return t(e).mtime}catch{return null}}async preloadConfigurations(e,t={}){let r=new Map;return await Promise.allSettled(e.map(async(n)=>{try{let i=await this.loadFromPath(n,{},t);if(i)r.set(n,i.config)}catch(i){if(t.verbose)console.warn(`Failed to preload ${n}:`,i)}})),r}}class ea{async validateConfiguration(e,t,r={}){let{stopOnFirstError:n=!1,validateRequired:i=!0,validateTypes:o=!0,customRules:s=[],trackPerformance:l=!0,verbose:a=!1}=r,c=async()=>{let u=[],f=[],d={stopOnFirstError:n,validateRequired:i,validateTypes:o,customRules:s,trackPerformance:l,verbose:a};try{if(typeof t==="string")return await this.validateWithSchemaFile(e,t,d);else if(Array.isArray(t))return this.validateWithRules(e,[...t,...s],d);else return this.validateWithJSONSchema(e,t,d)}catch(h){return u.push({path:"",message:`Validation failed: ${h}`,rule:"system"}),{isValid:!1,errors:u,warnings:f}}};if(l)return await ii.track("validateConfiguration",c);return c()}async validateWithSchemaFile(e,t,r){try{if(!Dh(t))throw new Tr(t,[{path:"",message:"Schema file does not exist"}]);let n=await import(t),i=n.default||n;if(Array.isArray(i))return this.validateWithRules(e,i,r);else return this.validateWithJSONSchema(e,i,r)}catch(n){throw new Tr(t,[{path:"",message:`Failed to load schema: ${n}`}])}}validateWithJSONSchema(e,t,r){let n=[],i=[];return this.validateObjectAgainstSchema(e,t,"",n,i,r),{isValid:n.length===0,errors:n,warnings:i}}validateObjectAgainstSchema(e,t,r,n,i,o){if(o.validateTypes&&t.type){let s=Array.isArray(e)?"array":typeof e,l=Array.isArray(t.type)?t.type:[t.type];if(!l.includes(s)){if(n.push({path:r,message:`Expected type ${l.join(" or ")}, got ${s}`,expected:l.join(" or "),actual:s,rule:"type"}),o.stopOnFirstError)return}}if(t.enum&&!t.enum.includes(e)){if(n.push({path:r,message:`Value must be one of: ${t.enum.join(", ")}`,expected:t.enum.join(", "),actual:e,rule:"enum"}),o.stopOnFirstError)return}if(typeof e==="string"){if(t.minLength!==void 0&&e.length<t.minLength)n.push({path:r,message:`String length must be at least ${t.minLength}`,expected:`>= ${t.minLength}`,actual:e.length,rule:"minLength"});if(t.maxLength!==void 0&&e.length>t.maxLength)n.push({path:r,message:`String length must not exceed ${t.maxLength}`,expected:`<= ${t.maxLength}`,actual:e.length,rule:"maxLength"});if(t.pattern){if(!new RegExp(t.pattern).test(e))n.push({path:r,message:`String does not match pattern ${t.pattern}`,expected:t.pattern,actual:e,rule:"pattern"})}}if(typeof e==="number"){if(t.minimum!==void 0&&e<t.minimum)n.push({path:r,message:`Value must be at least ${t.minimum}`,expected:`>= ${t.minimum}`,actual:e,rule:"minimum"});if(t.maximum!==void 0&&e>t.maximum)n.push({path:r,message:`Value must not exceed ${t.maximum}`,expected:`<= ${t.maximum}`,actual:e,rule:"maximum"})}if(Array.isArray(e)&&t.items)for(let s=0;s<e.length;s++){let l=r?`${r}[${s}]`:`[${s}]`;if(this.validateObjectAgainstSchema(e[s],t.items,l,n,i,o),o.stopOnFirstError&&n.length>0)return}if(e&&typeof e==="object"&&!Array.isArray(e)){let s=e;if(o.validateRequired&&t.required){for(let l of t.required)if(!(l in s)){if(n.push({path:r?`${r}.${l}`:l,message:`Missing required property '${l}'`,expected:"required",rule:"required"}),o.stopOnFirstError)return}}if(t.properties){for(let[l,a]of Object.entries(t.properties))if(l in s){let c=r?`${r}.${l}`:l;if(this.validateObjectAgainstSchema(s[l],a,c,n,i,o),o.stopOnFirstError&&n.length>0)return}}if(t.additionalProperties===!1){let l=new Set(Object.keys(t.properties||{}));for(let a of Object.keys(s))if(!l.has(a))i.push({path:r?`${r}.${a}`:a,message:`Additional property '${a}' is not allowed`,rule:"additionalProperties"})}}}validateWithRules(e,t,r){let n=[],i=[];for(let o of t)try{let s=this.getValueByPath(e,o.path),l=this.validateWithRule(s,o,o.path);if(n.push(...l),r.stopOnFirstError&&n.length>0)break}catch(s){n.push({path:o.path,message:`Rule validation failed: ${s}`,rule:"system"})}return{isValid:n.length===0,errors:n,warnings:i}}validateWithRule(e,t,r){let n=[];if(t.required&&(e===void 0||e===null))return n.push({path:r,message:t.message||`Property '${r}' is required`,expected:"required",rule:"required"}),n;if(e===void 0||e===null)return n;if(t.type){let i=Array.isArray(e)?"array":typeof e;if(i!==t.type)n.push({path:r,message:t.message||`Expected type ${t.type}, got ${i}`,expected:t.type,actual:i,rule:"type"})}if(t.min!==void 0){let i=Array.isArray(e)?e.length:typeof e==="string"?e.length:typeof e==="number"?e:0;if(i<t.min)n.push({path:r,message:t.message||`Value must be at least ${t.min}`,expected:`>= ${t.min}`,actual:i,rule:"min"})}if(t.max!==void 0){let i=Array.isArray(e)?e.length:typeof e==="string"?e.length:typeof e==="number"?e:0;if(i>t.max)n.push({path:r,message:t.message||`Value must not exceed ${t.max}`,expected:`<= ${t.max}`,actual:i,rule:"max"})}if(t.pattern&&typeof e==="string"){if(!t.pattern.test(e))n.push({path:r,message:t.message||`Value does not match pattern ${t.pattern}`,expected:t.pattern.toString(),actual:e,rule:"pattern"})}if(t.enum&&!t.enum.includes(e))n.push({path:r,message:t.message||`Value must be one of: ${t.enum.join(", ")}`,expected:t.enum.join(", "),actual:e,rule:"enum"});if(t.validator){let i=t.validator(e);if(i)n.push({path:r,message:t.message||i,rule:"custom"})}return n}getValueByPath(e,t){if(!t)return e;let r=t.split("."),n=e;for(let i of r)if(n&&typeof n==="object"&&i in n)n=n[i];else return;return n}generateRulesFromInterface(e){let t=[],r=e.matchAll(/(\w+)(\?)?:\s*(\w+)/g);for(let n of r){let[,i,o,s]=n;t.push({path:i,required:!o,type:this.mapTypeScriptType(s)})}return t}mapTypeScriptType(e){switch(e.toLowerCase()){case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"array":return"array";case"object":return"object";default:return"object"}}static createCommonRules(){return{server:[{path:"port",required:!0,type:"number",min:1,max:65535},{path:"host",required:!0,type:"string",min:1},{path:"ssl",type:"boolean"}],database:[{path:"url",required:!0,type:"string",min:1},{path:"pool",type:"number",min:1,max:100},{path:"timeout",type:"number",min:0}],api:[{path:"baseUrl",required:!0,type:"string",pattern:Bh},{path:"timeout",type:"number",min:0},{path:"retries",type:"number",min:0,max:10}]}}}function Uh(e){if(!e)return"";let t=Array.isArray(e)?e.filter(Boolean):[e];if(t.length===0)return"";if(t.length===1)return` or alias "${t[0]}"`;return` or aliases ${t.map((r)=>`"${r}"`).join(", ")}`}class ta{fileLoader=new Qs;envProcessor=new hi;validator=new ea;async loadConfig(e){let t=Date.now(),{cache:r,performance:n,schema:i,validate:o,...s}=e;try{if(r?.enabled){let a=this.checkCache(s.name||"",s);if(a)return a}let l;try{l=await this.loadConfigurationStrategies(s,!0,r)}catch(a){if(s.configFile)throw a;let c=s.__strictErrorHandling;if(a instanceof Error&&a.name==="ConfigNotFoundError"){if(c)throw a;l={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`No configuration file found for "${s.name||"config"}", using defaults with environment variables`]}}else if(a instanceof Error&&a.name==="ConfigLoadError"){let u=a.message.includes("EACCES")||a.message.includes("EPERM")||a.message.includes("permission denied"),f=!u&&(a.message.includes("syntax")||a.message.includes("Expected")||a.message.includes("Unexpected")||a.message.includes("BuildMessage")||a.message.includes("errors building")),d=a.message.includes("Configuration must export a valid object")||a.message.includes("Configuration file is empty and exports nothing");if(c&&(d||u))throw a;if(f&&(!c||!d))l={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:["Configuration file has syntax errors, using defaults with environment variables"]};else if(!c)l={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`Configuration loading error, using defaults: ${a.message}`]};else throw a}else l={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`Configuration loading failed, using defaults: ${a instanceof Error?a.message:String(a)}`]}}if(i||o)await this.validateConfiguration(l.config,i,o,s.name);if(r?.enabled&&l)this.cacheResult(s.name||"",l,r,s);if(n?.enabled){let a={operation:"loadConfig",duration:Date.now()-t,configName:s.name,timestamp:new Date};if(n.onMetrics)n.onMetrics(a);if(n.slowThreshold&&a.duration>n.slowThreshold)he.warn(`Slow configuration loading detected: ${a.duration}ms for ${s.name}`);l.metrics=a}return l}catch(l){if(l instanceof Error&&l.name==="ConfigNotFoundError")throw l;let a=Date.now()-t;throw he.error(`Configuration loading failed after ${a}ms:`,[l instanceof Error?l:Error(String(l))]),l}}async loadConfigurationStrategies(e,t=!1,r){let{name:n="",alias:i,configFile:o,cwd:s,configDir:l,defaultConfig:a,checkEnv:c=!0,arrayStrategy:u="replace",verbose:f=!1}=e,d=s||Nr.cwd(),h=[];if(o){let b=ve(d,o);h.push(b);let v=c?At(n,a,f):a,R=await this.fileLoader.tryLoadFromPaths([b],v,{arrayStrategy:u,verbose:f,cacheTtl:r?.ttl,useCache:!r?.ttl||r.ttl>100});if(!R)throw Ge.configNotFound(n||o,h,i);if(f)he.success(`Configuration loaded from explicit path: ${b}`);return this.finalizeResult(R,h,c,n,f)}let g=await this.loadLocalConfiguration(n,i,d,l,a,u,f,c,r);if(g)return h.push(...this.getLocalSearchPaths(n,i,d,l)),this.finalizeResult(g,h,c,n,f);let m=await this.loadHomeConfiguration(n,i,a,u,f,c);if(m)return h.push(...this.getHomeSearchPaths(n,i)),this.finalizeResult(m,h,c,n,f);let p=await this.loadPackageJsonConfiguration(n,i,d,a,u,f,c);if(p)return h.push(ve(d,"package.json")),this.finalizeResult(p,h,c,n,f);if(h.push(...this.getAllSearchPaths(n,i,d,l)),t)throw Ge.configNotFound(n,h,i);return{...await this.applyEnvironmentVariables(n,a,c,f),warnings:[`No configuration file found for "${n}"${Uh(i)}, using defaults with environment variables`]}}async loadLocalConfiguration(e,t,r,n,i,o,s,l,a){let c=l?At(e,i,s):i,u=this.getLocalDirectories(r,n);for(let f of u){if(s)he.info(`Searching for configuration in: ${f}`);let d=this.fileLoader.generateConfigPaths(e,f,t),h=await this.fileLoader.tryLoadFromPaths(d,c,{arrayStrategy:o,verbose:s,cacheTtl:a?.ttl,useCache:!a?.ttl||a.ttl>100});if(h){if(s)he.success(`Configuration loaded from: ${h.source.path}`);return h}}return null}async loadHomeConfiguration(e,t,r,n,i,o){if(!e)return null;let s=o?At(e,r,i):r,l=[ve(tt(),".config",e),ve(tt(),".config"),tt()];for(let a of l){if(i)he.info(`Checking home directory: ${a}`);let c=this.fileLoader.generateConfigPaths(e,a,t),u=await this.fileLoader.tryLoadFromPaths(c,s,{arrayStrategy:n,verbose:i});if(u){if(i)he.success(`Configuration loaded from home directory: ${u.source.path}`);return u}}return null}async loadPackageJsonConfiguration(e,t,r,n,i,o,s){let l=s?At(e,n,o):n;try{let a=ve(r,"package.json");if(!_f(a))return null;let c={};try{c=JSON.parse(Lf(a,"utf8"))}catch(d){if(o)he.warn("Failed to parse package.json:",[d instanceof Error?d:Error(String(d))]);return null}let u=c[e],f=e;if(!u&&t){let d=Array.isArray(t)?t:[t];for(let h of d){if(!h)continue;if(c[h]){u=c[h],f=h;break}}}if(u&&typeof u==="object"&&!Array.isArray(u)){if(o)he.success(`Configuration loaded from package.json: ${f}`);return{config:Zs(l,u,i),source:{type:"package.json",path:a,priority:30,timestamp:new Date}}}}catch(a){if(o)he.warn("Failed to load package.json:",[a instanceof Error?a:Error(String(a))])}return null}async applyEnvironmentVariables(e,t,r,n){if(!r||!e||typeof t!=="object"||t===null||Array.isArray(t))return{config:t,source:{type:"default",priority:10,timestamp:new Date}};return{config:At(e,t,n),source:{type:"environment",priority:20,timestamp:new Date}}}async finalizeResult(e,t,r,n,i){return{config:e.config,source:e.source,path:e.source.path}}async validateConfiguration(e,t,r,n){let i=[];if(r){let o=r(e);if(o)i.push(...o)}if(t){let o=await this.validator.validateConfiguration(e,t);if(!o.isValid)i.push(...o.errors.map((s)=>s.path?`${s.path}: ${s.message}`:s.message))}if(i.length>0)throw Ge.configValidation(n||"unknown",i,n)}checkCache(e,t){let r=this.generateCacheKey(e,t);return pr.get(r)||null}cacheResult(e,t,r,n){let i=this.generateCacheKey(e,n);pr.set(i,t,void 0,r.ttl)}generateCacheKey(e,t){let r=[e];if(t.alias){let n=Array.isArray(t.alias)?t.alias.join(","):t.alias;r.push(`alias:${n}`)}if(t.cwd)r.push(`cwd:${t.cwd}`);if(t.configFile)r.push(`configFile:${t.configFile}`);if(t.configDir)r.push(`configDir:${t.configDir}`);if("checkEnv"in t)r.push(`checkEnv:${t.checkEnv}`);return r.join("|")}getLocalDirectories(e,t){return Pf({cwd:e,configDir:t})}getAllSearchPaths(e,t,r,n){let i=[];return i.push(...this.getLocalSearchPaths(e,t,r,n)),i.push(...this.getHomeSearchPaths(e,t)),i.push(ve(r,"package.json")),i}getLocalSearchPaths(e,t,r,n){let i=this.getLocalDirectories(r,n),o=[];for(let s of i)o.push(...this.fileLoader.generateConfigPaths(e,s,t));return o}getHomeSearchPaths(e,t){if(!e)return[];let r=[ve(tt(),".config",e),ve(tt(),".config"),tt()],n=[];for(let i of r)n.push(...this.fileLoader.generateConfigPaths(e,i,t));return n}async loadConfigWithResult(e){return this.loadConfig(e)}}async function ra(e){let t="defaultConfig"in e&&e.defaultConfig!==void 0?e.defaultConfig:{},r="cache"in e||"performance"in e||"schema"in e||"validate"in e;try{let n;if(r)n=await Kn.loadConfig(e);else n=await Kn.loadConfig({...e,defaultConfig:t,cache:{enabled:!0},performance:{enabled:!1}});return n?.config??t}catch(n){if(e.configFile)throw n;let i=n instanceof Error?n.name:"UnknownError",o=n instanceof Error?n.message:String(n);if(!(i==="ConfigNotFoundError"||i==="ConfigLoadError"||i==="ConfigValidationError"||o.includes("config"))&&e.verbose)he.warn("Unexpected error loading config, using defaults:",[n instanceof Error?n:Error(String(n))]);let l=r?{...e,defaultConfig:t}:{...e,defaultConfig:t,cache:{enabled:!0},performance:{enabled:!1}};if("checkEnv"in e?e.checkEnv!==!1:!0)return(await Kn.applyEnvironmentVariables(l.name||"",t,!0,l.verbose||!1))?.config??t;return t}}function At(e,t,r=!1){let n=new hi,i=e.toUpperCase().replace(/[^A-Z0-9]/g,"_");function o(s,l=[]){let a={...s};for(let[c,u]of Object.entries(s)){let f=[...l,c],d=[`${i}_${f.join("_").toUpperCase()}`,`${i}_${f.map((m)=>m.toUpperCase()).join("")}`,`${i}_${f.map((m)=>m.replace(/([A-Z])/g,"_$1").toUpperCase()).join("")}`],h,g;for(let m of d)if(h=Nr.env[m],h!==void 0){g=m;break}if(h!==void 0&&g)if(typeof u==="boolean")a[c]=["true","1","yes"].includes(h.toLowerCase());else if(typeof u==="number"){let m=Number(h);if(!Number.isNaN(m))a[c]=m}else if(Array.isArray(u))try{a[c]=JSON.parse(h)}catch{a[c]=h.split(",").map((m)=>m.trim())}else a[c]=h;else if(u&&typeof u==="object"&&!Array.isArray(u))a[c]=o(u,f)}return a}return o(t)}var pr,ii,vs,vd,wd=(e)=>e,Cd=(e,t)=>{for(var r in t)vd(e,r,{get:t[r],enumerable:!0,configurable:!0,set:$d.bind(t,r)})},Rd=(e,t)=>()=>(e&&(t=e(e=0)),t),Rs,Ps,dt,Pt,_s,Xd,Zd,os,dr,Yn,X,P,Qd,ss,eh,as,th,rh,Bn,nh,ls,cs,Un,ih,oh,sh,ah,hr,Ls,lh,Z,ch,uh,us,gr,Jn,H,E,fh,fs,dh,ds,hh,gh,Vn,mh,hs,gs,ph,Wn,yh,bh,xh,vh,wh,mr,Ms,$h,Ch="0.15.6",ae,kr,Ot,Xn,Zn,Sr,Qn,ei,It,ti,ri,Fe,Fs,js,ge,Ne,Ds,Bs,Rh,Sh,Us,Ar,e$,Y,T,t$,Eh,r$,Th,n$,i$,ms,o$,Nh,Oh,s$,ps,a$,l$,c$,u$,f$,zn,Ih,d$,me,Ws,Er,zs,Ks,di,Gs,Hs,Tr,qs,Ys,Ge,Bh,he,Kn,y$,b$;var na=Ec(()=>{pr=new bs,ii=new xs,vs=[".ts",".js",".mjs",".cjs",".json",".mts",".cts"];vd=Object.defineProperty;Rs={};Cd(Rs,{withErrorRecovery:()=>As,tryLoadConfig:()=>Hd,loadConfigWithResult:()=>Kd,loadConfig:()=>Is,isRetryableError:()=>Dd,isConfigNotFoundError:()=>jd,isBunfigError:()=>Es,globalPerformanceMonitor:()=>Pt,globalCache:()=>dt,getEnvOrDefault:()=>Bd,generateConfigTypes:()=>qd,defaultGeneratedDir:()=>Bs,defaultConfigDir:()=>Ds,deepMergeWithArrayStrategy:()=>ci,deepMerge:()=>Ts,createLibraryConfig:()=>Yd,config:()=>Gd,bunfigPlugin:()=>Jd,applyEnvVarsToConfig:()=>Tt,TypeGenerationError:()=>ei,SchemaValidationError:()=>It,PluginError:()=>ri,PerformanceMonitor:()=>si,FileSystemError:()=>Qn,ErrorFactory:()=>Fe,EnvVarError:()=>Sr,EnvProcessor:()=>Or,ConfigValidator:()=>ui,ConfigValidationError:()=>Xn,ConfigNotFoundError:()=>kr,ConfigMergeError:()=>Zn,ConfigLoader:()=>fi,ConfigLoadError:()=>Ot,ConfigFileLoader:()=>Ir,ConfigCache:()=>oi,CacheUtils:()=>_s,BunfigError:()=>ae,BrowserConfigError:()=>ti,ArrayMergeStrategies:()=>Fs});Rh=Rd(async()=>{Ps=import.meta.require,dt=new oi,Pt=new si,_s={createKey:kd,isEquivalent:Sd,estimateMemoryUsage:Ad},Xd=xr(Hn.cwd(),"config"),Zd=xr(Hn.cwd(),"src/generated"),os=br.env.CLARITY_LOG_DIR||Uf(Nd(),"logs"),dr={level:"info",defaultName:"clarity",timestamp:!0,colors:!0,format:"text",maxLogSize:10485760,logDatePattern:"YYYY-MM-DD",logDirectory:os,rotation:{frequency:"daily",maxSize:10485760,maxFiles:5,compress:!1,rotateHour:0,rotateMinute:0,rotateDayOfWeek:0,rotateDayOfMonth:1,encrypt:!1},verbose:!1},Yn=await Od(),X={red:(e)=>`\x1B[31m${e}\x1B[0m`,green:(e)=>`\x1B[32m${e}\x1B[0m`,yellow:(e)=>`\x1B[33m${e}\x1B[0m`,blue:(e)=>`\x1B[34m${e}\x1B[0m`,magenta:(e)=>`\x1B[35m${e}\x1B[0m`,cyan:(e)=>`\x1B[36m${e}\x1B[0m`,white:(e)=>`\x1B[37m${e}\x1B[0m`,gray:(e)=>`\x1B[90m${e}\x1B[0m`,bgRed:(e)=>`\x1B[41m${e}\x1B[0m`,bgYellow:(e)=>`\x1B[43m${e}\x1B[0m`,bold:(e)=>`\x1B[1m${e}\x1B[0m`,dim:(e)=>`\x1B[2m${e}\x1B[0m`,italic:(e)=>`\x1B[3m${e}\x1B[0m`,underline:(e)=>`\x1B[4m${e}\x1B[0m`,reset:"\x1B[0m"},P=X,Qd=X.red,ss=X.green,eh=X.yellow,as=X.blue,th=X.magenta,rh=X.cyan,Bn=X.white,nh=X.gray,ls=X.bgRed,cs=X.bgYellow,Un=X.bold,ih=X.dim,oh=X.italic,sh=X.underline,ah=X.reset,hr={activationLevel:"error",bufferSize:50,flushOnDeactivation:!0,stopBuffering:!1},Ls={debug:"\uD83D\uDD0D",info:as("\u2139"),success:ss("\u2713"),warning:cs(Bn(Un(" WARN "))),error:ls(Bn(Un(" ERROR ")))},lh=new $r("stacks"),Z=new $r("bunfig",{showTags:!0}),ch=re(Nt.cwd(),"config"),uh=re(Nt.cwd(),"src/generated"),us=yr.env.CLARITY_LOG_DIR||Df(Ld(),"logs"),gr={level:"info",defaultName:"clarity",timestamp:!0,colors:!0,format:"text",maxLogSize:10485760,logDatePattern:"YYYY-MM-DD",logDirectory:us,rotation:{frequency:"daily",maxSize:10485760,maxFiles:5,compress:!1,rotateHour:0,rotateMinute:0,rotateDayOfWeek:0,rotateDayOfMonth:1,encrypt:!1},verbose:!1,writeToFile:!1},Jn=await Md(),H={red:(e)=>`\x1B[31m${e}\x1B[0m`,green:(e)=>`\x1B[32m${e}\x1B[0m`,yellow:(e)=>`\x1B[33m${e}\x1B[0m`,blue:(e)=>`\x1B[34m${e}\x1B[0m`,magenta:(e)=>`\x1B[35m${e}\x1B[0m`,cyan:(e)=>`\x1B[36m${e}\x1B[0m`,white:(e)=>`\x1B[37m${e}\x1B[0m`,gray:(e)=>`\x1B[90m${e}\x1B[0m`,bgRed:(e)=>`\x1B[41m${e}\x1B[0m`,bgYellow:(e)=>`\x1B[43m${e}\x1B[0m`,bgGray:(e)=>`\x1B[100m${e}\x1B[0m`,bold:(e)=>`\x1B[1m${e}\x1B[0m`,dim:(e)=>`\x1B[2m${e}\x1B[0m`,italic:(e)=>`\x1B[3m${e}\x1B[0m`,underline:(e)=>`\x1B[4m${e}\x1B[0m`,strikethrough:(e)=>`\x1B[9m${e}\x1B[0m`,reset:"\x1B[0m"},E=H,fh=H.red,fs=H.green,dh=H.yellow,ds=H.blue,hh=H.magenta,gh=H.cyan,Vn=H.white,mh=H.gray,hs=H.bgRed,gs=H.bgYellow,ph=H.bgGray,Wn=H.bold,yh=H.dim,bh=H.italic,xh=H.underline,vh=H.strikethrough,wh=H.reset,mr={activationLevel:"error",bufferSize:50,flushOnDeactivation:!0,stopBuffering:!1},Ms={debug:"\uD83D\uDD0D",info:ds("\u2139"),success:fs("\u2713"),warning:gs(Vn(Wn(" WARN "))),error:hs(Vn(Wn(" ERROR ")))},$h=new Rr("stacks"),ae=class extends Error{timestamp;context;constructor(t,r={}){super(t);if(this.name=this.constructor.name,this.timestamp=new Date,this.context=r,Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)}toJSON(){return{name:this.name,code:this.code,message:this.message,timestamp:this.timestamp.toISOString(),context:this.context,stack:this.stack}}toString(){let t=Object.keys(this.context).length>0?` (${Object.entries(this.context).map(([r,n])=>`${r}: ${n}`).join(", ")})`:"";return`${this.name} [${this.code}]: ${this.message}${t}`}},kr=class extends ae{code="CONFIG_NOT_FOUND";constructor(t,r,n){let i=n?` or alias "${n}"`:"";super(`Configuration "${t}"${i} not found`,{configName:t,alias:n,searchPaths:r,searchPathCount:r.length})}},Ot=class extends ae{code="CONFIG_LOAD_ERROR";constructor(t,r,n){super(`Failed to load configuration from "${t}": ${r.message}`,{configPath:t,configName:n,originalError:r.name,originalMessage:r.message});this.cause=r}},Xn=class extends ae{code="CONFIG_VALIDATION_ERROR";constructor(t,r,n){super(`Configuration validation failed for "${t}"`,{configPath:t,configName:n,validationErrors:r,errorCount:r.length})}},Zn=class extends ae{code="CONFIG_MERGE_ERROR";constructor(t,r,n,i){super(`Failed to merge configuration from "${t}" with "${r}": ${n.message}`,{sourcePath:t,targetPath:r,configName:i,originalError:n.name,originalMessage:n.message});this.cause=n}},Sr=class extends ae{code="ENV_VAR_ERROR";constructor(t,r,n,i){super(`Failed to parse environment variable "${t}" with value "${r}" as ${n}`,{envKey:t,envValue:r,expectedType:n,configName:i})}},Qn=class extends ae{code="FILE_SYSTEM_ERROR";constructor(t,r,n){super(`File system ${t} failed for "${r}": ${n.message}`,{operation:t,path:r,originalError:n.name,originalMessage:n.message});this.cause=n}},ei=class extends ae{code="TYPE_GENERATION_ERROR";constructor(t,r,n){super(`Failed to generate types from "${t}" to "${r}": ${n.message}`,{configDir:t,outputPath:r,originalError:n.name,originalMessage:n.message});this.cause=n}},It=class extends ae{code="SCHEMA_VALIDATION_ERROR";constructor(t,r,n){super(`Schema validation failed${n?` for config "${n}"`:""}`,{schemaPath:t,configName:n,validationErrors:r,errorCount:r.length})}},ti=class extends ae{code="BROWSER_CONFIG_ERROR";constructor(t,r,n,i){super(`Failed to fetch configuration from "${t}": ${r} ${n}`,{endpoint:t,status:r,statusText:n,configName:i})}},ri=class extends ae{code="PLUGIN_ERROR";constructor(t,r,n){super(`Plugin "${t}" failed during ${r}: ${n.message}`,{pluginName:t,operation:r,originalError:n.name,originalMessage:n.message});this.cause=n}},Fe={configNotFound(e,t,r){return new kr(e,t,r)},configLoad(e,t,r){return new Ot(e,t,r)},configValidation(e,t,r){return new Xn(e,t,r)},configMerge(e,t,r,n){return new Zn(e,t,r,n)},envVar(e,t,r,n){return new Sr(e,t,r,n)},fileSystem(e,t,r){return new Qn(e,t,r)},typeGeneration(e,t,r){return new ei(e,t,r)},schemaValidation(e,t,r){return new It(e,t,r)},browserConfig(e,t,r,n){return new ti(e,t,r,n)},plugin(e,t,r){return new ri(e,t,r)}},Fs={replace:"replace",concat:"concat",smart:"smart"},js=/^https?:\/\//,ge=new Rr("bunfig",{showTags:!0}),Ne=new fi,Ds=ne(He.cwd(),"config"),Bs=ne(He.cwd(),"src/generated")});Sh=vr.env.CLARITY_LOG_DIR||cd(kh(),"logs"),Us={level:"info",defaultName:"clarity",timestamp:!0,colors:!0,format:"text",maxLogSize:10485760,logDatePattern:"YYYY-MM-DD",logDirectory:Sh,rotation:{frequency:"daily",maxSize:10485760,maxFiles:5,compress:!1,rotateHour:0,rotateMinute:0,rotateDayOfWeek:0,rotateDayOfMonth:1,encrypt:!1},verbose:!1,writeToFile:!1},Ar={...Us},e$=(async()=>{try{let{loadConfig:e}=await Rh().then(()=>Rs),t=await e({name:"clarity",alias:"logging",defaultConfig:Us,cwd:vr.cwd()});if(t)Object.assign(Ar,t)}catch{}return Ar})();Y={red:(e)=>`\x1B[31m${e}\x1B[0m`,green:(e)=>`\x1B[32m${e}\x1B[0m`,yellow:(e)=>`\x1B[33m${e}\x1B[0m`,blue:(e)=>`\x1B[34m${e}\x1B[0m`,magenta:(e)=>`\x1B[35m${e}\x1B[0m`,cyan:(e)=>`\x1B[36m${e}\x1B[0m`,white:(e)=>`\x1B[37m${e}\x1B[0m`,gray:(e)=>`\x1B[90m${e}\x1B[0m`,bgRed:(e)=>`\x1B[41m${e}\x1B[0m`,bgYellow:(e)=>`\x1B[43m${e}\x1B[0m`,bgGray:(e)=>`\x1B[100m${e}\x1B[0m`,bold:(e)=>`\x1B[1m${e}\x1B[0m`,dim:(e)=>`\x1B[2m${e}\x1B[0m`,italic:(e)=>`\x1B[3m${e}\x1B[0m`,underline:(e)=>`\x1B[4m${e}\x1B[0m`,strikethrough:(e)=>`\x1B[9m${e}\x1B[0m`,reset:"\x1B[0m"},T=Y,t$=Y.red,Eh=Y.green,r$=Y.yellow,Th=Y.blue,n$=Y.magenta,i$=Y.cyan,ms=Y.white,o$=Y.gray,Nh=Y.bgRed,Oh=Y.bgYellow,s$=Y.bgGray,ps=Y.bold,a$=Y.dim,l$=Y.italic,c$=Y.underline,u$=Y.strikethrough,f$=Y.reset,zn={activationLevel:"error",bufferSize:50,flushOnDeactivation:!0,stopBuffering:!1},Ih={debug:"\uD83D\uDD0D",info:Th("\u2139"),success:Eh("\u2713"),warning:Oh(ms(ps(" WARN "))),error:Nh(ms(ps(" ERROR ")))};d$=new Pr("stacks");me=class me extends Error{timestamp;context;constructor(e,t={}){super(e);if(this.name=this.constructor.name,this.timestamp=new Date,this.context=t,Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)}toJSON(){return{name:this.name,code:this.code,message:this.message,timestamp:this.timestamp.toISOString(),context:this.context,stack:this.stack}}toString(){let e=Object.keys(this.context).length>0?` (${Object.entries(this.context).map(([t,r])=>`${t}: ${r}`).join(", ")})`:"";return`${this.name} [${this.code}]: ${this.message}${e}`}};Ws=class Ws extends me{code="CONFIG_NOT_FOUND";constructor(e,t,r){let n=r===void 0?[]:Array.isArray(r)?r.filter(Boolean):[r],i="";if(n.length===1)i=` or alias "${n[0]}"`;else if(n.length>1)i=` or aliases ${n.map((o)=>`"${o}"`).join(", ")}`;super(`Configuration "${e}"${i} not found`,{configName:e,alias:r,searchPaths:t,searchPathCount:t.length})}};Er=class Er extends me{code="CONFIG_LOAD_ERROR";constructor(e,t,r){super(`Failed to load configuration from "${e}": ${t.message}`,{configPath:e,configName:r,originalError:t.name,originalMessage:t.message});this.cause=t}};zs=class zs extends me{code="CONFIG_VALIDATION_ERROR";constructor(e,t,r){super(`Configuration validation failed for "${e}"`,{configPath:e,configName:r,validationErrors:t,errorCount:t.length})}};Ks=class Ks extends me{code="CONFIG_MERGE_ERROR";constructor(e,t,r,n){super(`Failed to merge configuration from "${e}" with "${t}": ${r.message}`,{sourcePath:e,targetPath:t,configName:n,originalError:r.name,originalMessage:r.message});this.cause=r}};di=class di extends me{code="ENV_VAR_ERROR";constructor(e,t,r,n){super(`Failed to parse environment variable "${e}" with value "${t}" as ${r}`,{envKey:e,envValue:t,expectedType:r,configName:n})}};Gs=class Gs extends me{code="FILE_SYSTEM_ERROR";constructor(e,t,r){super(`File system ${e} failed for "${t}": ${r.message}`,{operation:e,path:t,originalError:r.name,originalMessage:r.message});this.cause=r}};Hs=class Hs extends me{code="TYPE_GENERATION_ERROR";constructor(e,t,r){super(`Failed to generate types from "${e}" to "${t}": ${r.message}`,{configDir:e,outputPath:t,originalError:r.name,originalMessage:r.message});this.cause=r}};Tr=class Tr extends me{code="SCHEMA_VALIDATION_ERROR";constructor(e,t,r){super(`Schema validation failed${r?` for config "${r}"`:""}`,{schemaPath:e,configName:r,validationErrors:t,errorCount:t.length})}};qs=class qs extends me{code="BROWSER_CONFIG_ERROR";constructor(e,t,r,n){super(`Failed to fetch configuration from "${e}": ${t} ${r}`,{endpoint:e,status:t,statusText:r,configName:n})}};Ys=class Ys extends me{code="PLUGIN_ERROR";constructor(e,t,r){super(`Plugin "${e}" failed during ${t}: ${r.message}`,{pluginName:e,operation:t,originalError:r.name,originalMessage:r.message});this.cause=r}};Ge={configNotFound(e,t,r){return new Ws(e,t,r)},configLoad(e,t,r){return new Er(e,t,r)},configValidation(e,t,r){return new zs(e,t,r)},configMerge(e,t,r,n){return new Ks(e,t,r,n)},envVar(e,t,r,n){return new di(e,t,r,n)},fileSystem(e,t,r){return new Gs(e,t,r)},typeGeneration(e,t,r){return new Hs(e,t,r)},schemaValidation(e,t,r){return new Tr(e,t,r)},browserConfig(e,t,r,n){return new qs(e,t,r,n)},plugin(e,t,r){return new Ys(e,t,r)}};Bh=/^https?:\/\//;he=new Pr("bunfig",{showTags:!0});Kn=new ta;y$=ve(Nr.cwd(),"config"),b$=ve(Nr.cwd(),"src/generated")});import{existsSync as Be,statSync as Tx,watch as Sc}from"fs";import{unlink as Nx}from"fs/promises";import{dirname as Ox,resolve as Fi}from"path";import ye from"process";var{Glob:Ix}=globalThis.Bun;import{EventEmitter as Tc}from"events";import Ie from"process";import Di from"process";import on from"process";import jt from"process";import wt from"process";import Wi from"tty";import yu,{stdin as Hx,stdout as qx}from"process";import{existsSync as $u}from"fs";import tn from"fs/promises";import zi from"os";import rn from"path";import Ue from"process";function nn(e){return e.replace(/[<[].+/,"").trim()}function Nc(e){let t=/<([^>]+)>/g,r=/\[([^\]]+)\]/g,n=[],i=(l)=>{let a=!1,c=l[1];if(c.startsWith("..."))c=c.slice(3),a=!0;else if(c.endsWith("..."))c=c.slice(0,-3),a=!0;return{required:l[0].startsWith("<"),value:c.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 Oc(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((l)=>n.names.includes(l))&&typeof o.required==="boolean"))t.boolean.push(n.names[0])}else t.boolean.push(n.names[0])}return t}function Bi(e){return e.reduce((t,r)=>t.length>=r.length?t:r,"")}function en(e,t){return e.length>=t?e:`${e}${" ".repeat(t-e.length)}`}function Ft(e){return e.replace(/([a-z])-([a-z])/g,(t,r,n)=>r+n.toUpperCase())}function Ic(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 Pc(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 _c(e){let t=/([^\\/]+)$/.exec(e);return t?t[1]:""}function $t(e){return e.split(".").map((t,r)=>r===0?Ft(t):t).join(".")}class Ct extends Error{exitCode=2;isUsageError=!0;usage;constructor(e,t){super(e);if(this.name=this.constructor.name,t!==void 0)this.usage=t;if(typeof Error.captureStackTrace==="function")Error.captureStackTrace(this,this.constructor);else this.stack=Error(e).stack}format(e=!1){if(e&&this.stack)return`${this.message}
63
63
 
64
64
  Stack trace:
65
- ${this.stack}`;return this.message}}function _c(e){if(e instanceof Ct)return!0;return!!e&&typeof e==="object"&&e.name==="ClappError"&&typeof e.message==="string"}function Lc(){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 Dt="\x1B",B=`${Dt}[`;var Ui={to(e,t){if(!t)return`${B}${e+1}G`;return`${B}${t+1};${e+1}H`},move(e,t){let r="";if(e<0)r+=`${B}${-e}D`;else if(e>0)r+=`${B}${e}C`;if(t<0)r+=`${B}${-t}A`;else if(t>0)r+=`${B}${t}B`;return r},up:(e=1)=>`${B}${e}A`,down:(e=1)=>`${B}${e}B`,forward:(e=1)=>`${B}${e}C`,backward:(e=1)=>`${B}${e}D`,nextLine:(e=1)=>`${B}E`.repeat(e),prevLine:(e=1)=>`${B}F`.repeat(e),left:`${B}G`,hide:`${B}?25l`,show:`${B}?25h`,save:`${Dt}7`,restore:`${Dt}8`};var Fx={screen:`${B}2J`,up:(e=1)=>`${B}1J`.repeat(e),down:(e=1)=>`${B}J`.repeat(e),line:`${B}2K`,lineEnd:`${B}K`,lineStart:`${B}1K`,lines(e){let t="";for(let r=0;r<e;r++)t+=this.line+(r<e-1?Ui.up():"");if(e)t+=Ui.left;return t}},jx={screen:`${Dt}c`};function Mc(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 Ki(e,t,r=2,n=3){return t.map((i)=>({cmd:i,distance:Mc(e,i)})).filter(({distance:i})=>i<=r).sort((i,o)=>i.distance-o.distance).slice(0,n).map(({cmd:i})=>i)}function Fc(e,t={}){let r={_:[]},n=t.alias||{},i=new Set(t.boolean||[]),o={};for(let a of Object.keys(n))for(let c of n[a])o[c]=a;for(let a of i)if(n[a])for(let c of n[a])i.add(c);function s(a,c){if(a===void 0)return c;if(typeof c==="boolean")return c;return Array.isArray(a)?[...a,c]:[a,c]}function l(a,c){let u=o[a]||a,f=s(r[u],c);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 c=e[a];if(c==="--"){r._.push(...e.slice(a+1));break}if(c.startsWith("--")){let u=c.indexOf("=");if(u!==-1){let f=Ft(c.slice(2,u)),d=c.slice(u+1);l(f,d)}else{let f=c.slice(2);if(f.startsWith("no-")){let g=Ft(f.slice(3));l(g,!1);continue}let d=Ft(f),h=o[d]||d;if(i.has(h)||i.has(d))l(d,!0);else{let g=e[a+1];if(g!==void 0&&!g.startsWith("-"))l(d,g),a++;else l(d,!0)}}}else if(c.startsWith("-")&&c.length>1){let u=c.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 g=e[a+1];if(g!==void 0&&!g.startsWith("-"))l(d,g),a++;else l(d,!0)}else l(d,!0)}}else r._.push(c)}return r}class Gi{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=nn(e).split(",").map((n)=>{let i=n.trim().replace(/^-{1,2}/,"");if(i.startsWith("no-"))this.negated=!0,i=i.replace(/^no-/,"");return $t(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 Bx=on.argv,jc=`${on.platform}-${on.arch} bun-v${typeof Bun<"u"?Bun.version:"unknown"}`,Vi=jt.argv,Dc=`${jt.platform}-${jt.arch} node-${jt.version}`;class sn{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=nn(e);let i=nn(e),o=i.indexOf(":");if(o>0)this.namespace=i.substring(0,o),this.name=i.substring(o+1);if(this.args=Tc(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 Gi(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 an}get displayName(){return this.namespace?`${this.namespace}:${this.name}`:this.name}hasOption(e){let t=$t(e.split(".")[0]);return!!this.options.find((r)=>r.names.some((n)=>$t(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 c=Bi(t.map((g)=>g.rawName)),u=new Map,f=[];for(let g of t)if(g.namespace){if(!u.has(g.namespace))u.set(g.namespace,[]);u.get(g.namespace).push(g)}else f.push(g);let d="";if(f.sort((g,m)=>g.rawName<m.rawName?-1:g.rawName>m.rawName?1:0),f.length>0)d+=f.map((g)=>` ${en(g.rawName,c.length)} ${g.description}`).join(`
65
+ ${this.stack}`;return this.message}}function Lc(e){if(e instanceof Ct)return!0;return!!e&&typeof e==="object"&&e.name==="ClappError"&&typeof e.message==="string"}function Mc(){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 Dt="\x1B",B=`${Dt}[`;var Ui={to(e,t){if(!t)return`${B}${e+1}G`;return`${B}${t+1};${e+1}H`},move(e,t){let r="";if(e<0)r+=`${B}${-e}D`;else if(e>0)r+=`${B}${e}C`;if(t<0)r+=`${B}${-t}A`;else if(t>0)r+=`${B}${t}B`;return r},up:(e=1)=>`${B}${e}A`,down:(e=1)=>`${B}${e}B`,forward:(e=1)=>`${B}${e}C`,backward:(e=1)=>`${B}${e}D`,nextLine:(e=1)=>`${B}E`.repeat(e),prevLine:(e=1)=>`${B}F`.repeat(e),left:`${B}G`,hide:`${B}?25l`,show:`${B}?25h`,save:`${Dt}7`,restore:`${Dt}8`};var jx={screen:`${B}2J`,up:(e=1)=>`${B}1J`.repeat(e),down:(e=1)=>`${B}J`.repeat(e),line:`${B}2K`,lineEnd:`${B}K`,lineStart:`${B}1K`,lines(e){let t="";for(let r=0;r<e;r++)t+=this.line+(r<e-1?Ui.up():"");if(e)t+=Ui.left;return t}},Dx={screen:`${Dt}c`};function Fc(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 Ki(e,t,r=2,n=3){return t.map((i)=>({cmd:i,distance:Fc(e,i)})).filter(({distance:i})=>i<=r).sort((i,o)=>i.distance-o.distance).slice(0,n).map(({cmd:i})=>i)}function jc(e,t={}){let r={_:[]},n=t.alias||{},i=new Set(t.boolean||[]),o={};for(let a of Object.keys(n))for(let c of n[a])o[c]=a;for(let a of i)if(n[a])for(let c of n[a])i.add(c);function s(a,c){if(a===void 0)return c;if(typeof c==="boolean")return c;return Array.isArray(a)?[...a,c]:[a,c]}function l(a,c){let u=o[a]||a,f=s(r[u],c);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 c=e[a];if(c==="--"){r._.push(...e.slice(a+1));break}if(c.startsWith("--")){let u=c.indexOf("=");if(u!==-1){let f=Ft(c.slice(2,u)),d=c.slice(u+1);l(f,d)}else{let f=c.slice(2);if(f.startsWith("no-")){let g=Ft(f.slice(3));l(g,!1);continue}let d=Ft(f),h=o[d]||d;if(i.has(h)||i.has(d))l(d,!0);else{let g=e[a+1];if(g!==void 0&&!g.startsWith("-"))l(d,g),a++;else l(d,!0)}}}else if(c.startsWith("-")&&c.length>1){let u=c.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 g=e[a+1];if(g!==void 0&&!g.startsWith("-"))l(d,g),a++;else l(d,!0)}else l(d,!0)}}else r._.push(c)}return r}class Gi{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=nn(e).split(",").map((n)=>{let i=n.trim().replace(/^-{1,2}/,"");if(i.startsWith("no-"))this.negated=!0,i=i.replace(/^no-/,"");return $t(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 Ux=on.argv,Dc=`${on.platform}-${on.arch} bun-v${typeof Bun<"u"?Bun.version:"unknown"}`,Vi=jt.argv,Bc=`${jt.platform}-${jt.arch} node-${jt.version}`;class sn{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=nn(e);let i=nn(e),o=i.indexOf(":");if(o>0)this.namespace=i.substring(0,o),this.name=i.substring(o+1);if(this.args=Nc(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 Gi(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 an}get displayName(){return this.namespace?`${this.namespace}:${this.name}`:this.name}hasOption(e){let t=$t(e.split(".")[0]);return!!this.options.find((r)=>r.names.some((n)=>$t(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 c=Bi(t.map((g)=>g.rawName)),u=new Map,f=[];for(let g of t)if(g.namespace){if(!u.has(g.namespace))u.set(g.namespace,[]);u.get(g.namespace).push(g)}else f.push(g);let d="";if(f.sort((g,m)=>g.rawName<m.rawName?-1:g.rawName>m.rawName?1:0),f.length>0)d+=f.map((g)=>` ${en(g.rawName,c.length)} ${g.description}`).join(`
66
66
  `);let h=Array.from(u.keys()).sort();for(let g of h){let m=u.get(g);if(d.length>0)d+=`
67
67
 
68
68
  `;d+=` ${g}:
@@ -72,7 +72,7 @@ ${this.stack}`;return this.message}}function _c(e){if(e instanceof Ct)return!0;r
72
72
  `)});if(i)o=i(o)||o;console.log(o.map((c)=>c.title?`${c.title}:
73
73
  ${c.body}`:c.body).join(`
74
74
 
75
- `))}outputVersion(){let{name:e}=this.cli,{versionNumber:t}=this.cli.globalCommand;if(t)console.log(`${e}/${t} ${typeof Bun<"u"?jc:Dc}`)}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 Ct(`Missing required argument${r.length>1?"s":""}: ${n}
75
+ `))}outputVersion(){let{name:e}=this.cli,{versionNumber:t}=this.cli.globalCommand;if(t)console.log(`${e}/${t} ${typeof Bun<"u"?Dc:Bc}`)}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 Ct(`Missing required argument${r.length>1?"s":""}: ${n}
76
76
 
77
77
  Run \`${this.cli.name} ${this.rawName} --help\` for usage information.`,this.usageLine)}}checkUnknownOptions(){let{options:e,globalCommand:t}=this.cli;if(!this.config.allowUnknownOptions){for(let r of Object.keys(e))if(r!=="--"&&!this.hasOption(r)&&!t.hasOption(r)){let i=[...t.options,...this.options].flatMap((c)=>c.names),o=$t(r.split(".")[0]),s=r.length>1?`--${r}`:`-${r}`,l=Ki(o,i),a=`Unknown option \`${s}\``;if(l.length>0)a+=`
78
78
 
@@ -81,17 +81,17 @@ Did you mean one of these?`,l.forEach((c)=>{let u=c.length>1?`--${c}`:`-${c}`;a+
81
81
 
82
82
  Run \`${this.cli.name} ${this.rawName} --help\` to see available options.`,new Ct(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 Ct(`Option \`${n.rawName}\` requires a value.
83
83
 
84
- Example: ${this.cli.name} ${this.rawName} ${n.rawName} <value>`,this.usageLine)}}}}class an extends sn{constructor(e){super("@@global@@","",{},e)}}var Bc=sn,Pe={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 xt={primary:"blue",secondary:"cyan",success:"green",warning:"yellow",error:"red",info:"magenta",muted:"gray"};function Uc(){return!0}function Vc(){let e={};e.supportsColor=Uc();function t(n,i=[]){let o=n===""?[]:[...i,n],s=function(a){if(!e.supportsColor)return a;let c="",u="";for(let f of o)if(f in xt&&xt[f]in Pe){let d=xt[f];c+=Pe[d][0],u=Pe[d][1]+u}else if(f in Pe)c+=Pe[f][0],u=Pe[f][1]+u;return c+a+u},l=[...Object.keys(Pe),...Object.keys(xt)];for(let a of l)if(!(a in s))Object.defineProperty(s,a,{get(){return t(a,o)}});return s}let r=[...Object.keys(Pe),...Object.keys(xt)];for(let n of r)if(!(n in e))Object.defineProperty(e,n,{get(){return t(n)}});return e}var vt=Vc();class ln extends Ec{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 an(this),this.globalCommand.usage("<command> [options]")}handleSignals(e){if(this.signalHandlersSet)return this;let t=async(r)=>{if(console.log(`
84
+ Example: ${this.cli.name} ${this.rawName} ${n.rawName} <value>`,this.usageLine)}}}}class an extends sn{constructor(e){super("@@global@@","",{},e)}}var Uc=sn,Pe={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 xt={primary:"blue",secondary:"cyan",success:"green",warning:"yellow",error:"red",info:"magenta",muted:"gray"};function Vc(){return!0}function Wc(){let e={};e.supportsColor=Vc();function t(n,i=[]){let o=n===""?[]:[...i,n],s=function(a){if(!e.supportsColor)return a;let c="",u="";for(let f of o)if(f in xt&&xt[f]in Pe){let d=xt[f];c+=Pe[d][0],u=Pe[d][1]+u}else if(f in Pe)c+=Pe[f][0],u=Pe[f][1]+u;return c+a+u},l=[...Object.keys(Pe),...Object.keys(xt)];for(let a of l)if(!(a in s))Object.defineProperty(s,a,{get(){return t(a,o)}});return s}let r=[...Object.keys(Pe),...Object.keys(xt)];for(let n of r)if(!(n in e))Object.defineProperty(e,n,{get(){return t(n)}});return e}var vt=Wc();class ln extends Tc{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 an(this),this.globalCommand.usage("<command> [options]")}handleSignals(e){if(this.signalHandlersSet)return this;let t=async(r)=>{if(console.log(`
85
85
 
86
- Received ${r}, cleaning up...`),e)try{await e()}catch(n){console.error("Error during cleanup:",n)}Ie.exit(0)};return Ie.on("SIGINT",()=>t("SIGINT")),Ie.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 Bc(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(vt.red(`
86
+ Received ${r}, cleaning up...`),e)try{await e()}catch(n){console.error("Error during cleanup:",n)}Ie.exit(0)};return Ie.on("SIGINT",()=>t("SIGINT")),Ie.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 Uc(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(vt.red(`
87
87
  \u2717 Command "${e}" not found.
88
- `)),this.enableDidYouMean){let t=[];for(let n of this.commands){if(n.displayName)t.push(n.displayName);if(n.aliasNames)t.push(...n.aliasNames)}let r=Ki(e,t);if(r.length>0)console.log(vt.yellow("Did you mean one of these?")),r.forEach((n)=>console.log(` ${vt.dim("\u2022")} ${this.name} ${n}`)),console.log("")}console.log(vt.dim("Run"),`${this.name} --help`,vt.dim("to see all available commands")),Ie.exit(1)}async parse(e=Vi,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]?Pc(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 c=this.mri(o,a);i=!1;let u={...c,args:c.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 c=`${s}:${a}`;for(let u of this.commands)if(u.isMatched(c)){let f=this.mri(o,u);i=!1;let d={...f,args:f.args.slice(2)};this.setParsedInfo(d,u,c),this.emit(`command:${c}`,u);break}}}}if(i){for(let a of this.commands)if(a.name===""){i=!1;let c=this.mri(o,a);this.setParsedInfo(c,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 l={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 l}mri(e,t){let r=[...this.globalCommand.options,...t?t.options:[]],n=Nc(r),i=[],o=e.indexOf("--");if(o>-1)i=e.slice(o+1),e=e.slice(0,o);let s=Fc(e,n),l={_:s._};for(let d of Object.keys(s))if(d!=="_")l[$t(d)]=s[d];let a=l._,c={"--":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)c[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(l))if(d!=="_"){let h=d.split(".");Oc(c,h,l[d]),Ic(c,f)}for(let d of r){if(!d.variadic)continue;for(let h of d.names){let g=c[h];if(g===void 0||Array.isArray(g))continue;if(d.config.default!==void 0&&g===d.config.default)continue;c[h]=[g]}}return{args:a,options:c}}async run(e=Vi){return this.parse(e,{run:!0,exitOnError:!0})}handleUsageError(e){if(!_c(e)||e.isUsageError===!1)return;let t=e.message||"command-line error",r=this.name?`${this.name}: `:"",n=/--help/.test(t)?"":e.usage?`
88
+ `)),this.enableDidYouMean){let t=[];for(let n of this.commands){if(n.displayName)t.push(n.displayName);if(n.aliasNames)t.push(...n.aliasNames)}let r=Ki(e,t);if(r.length>0)console.log(vt.yellow("Did you mean one of these?")),r.forEach((n)=>console.log(` ${vt.dim("\u2022")} ${this.name} ${n}`)),console.log("")}console.log(vt.dim("Run"),`${this.name} --help`,vt.dim("to see all available commands")),Ie.exit(1)}async parse(e=Vi,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]?_c(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 c=this.mri(o,a);i=!1;let u={...c,args:c.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 c=`${s}:${a}`;for(let u of this.commands)if(u.isMatched(c)){let f=this.mri(o,u);i=!1;let d={...f,args:f.args.slice(2)};this.setParsedInfo(d,u,c),this.emit(`command:${c}`,u);break}}}}if(i){for(let a of this.commands)if(a.name===""){i=!1;let c=this.mri(o,a);this.setParsedInfo(c,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 l={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 l}mri(e,t){let r=[...this.globalCommand.options,...t?t.options:[]],n=Oc(r),i=[],o=e.indexOf("--");if(o>-1)i=e.slice(o+1),e=e.slice(0,o);let s=jc(e,n),l={_:s._};for(let d of Object.keys(s))if(d!=="_")l[$t(d)]=s[d];let a=l._,c={"--":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)c[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(l))if(d!=="_"){let h=d.split(".");Ic(c,h,l[d]),Pc(c,f)}for(let d of r){if(!d.variadic)continue;for(let h of d.names){let g=c[h];if(g===void 0||Array.isArray(g))continue;if(d.config.default!==void 0&&g===d.config.default)continue;c[h]=[g]}}return{args:a,options:c}}async run(e=Vi){return this.parse(e,{run:!0,exitOnError:!0})}handleUsageError(e){if(!Lc(e)||e.isUsageError===!1)return;let t=e.message||"command-line error",r=this.name?`${this.name}: `:"",n=/--help/.test(t)?"":e.usage?`
89
89
  Usage: ${e.usage}`:`
90
90
  Run \`${this.name??"cli"} --help\` for usage.`;Ie.stderr.write(`${r}${t}${n}
91
- `),Ie.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((l,a)=>{if(l.variadic)n.push(e.slice(a));else n.push(e[a])}),n.push(t);let i={command:r,args:n,options:t};for(let l of r.beforeHooks)await l(i);let o,s=async()=>{let l=r.commandAction.apply(this,n);if(l instanceof Promise)o=await l;else o=l;return o};if(r.middleware.length>0){let l=0,a=async()=>{if(l<r.middleware.length){let c=r.middleware[l++];await c({...i,next:a})}else await s()};await a()}else await s();for(let l of r.afterHooks)await l(i);return o}removeSignalHandlers(){if(!this.signalHandlersSet)return this;return Ie.removeAllListeners("SIGINT"),Ie.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 Hi{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 Vx=new Hi;function Wc(){if("FORCE_COLOR"in wt.env)return wt.env.FORCE_COLOR!=="0";if("NO_COLOR"in wt.env||wt.env.TERM==="dumb")return!1;if(wt.platform==="win32")return!0;return Wi.isatty(1)&&Wi.isatty(2)}var qi=Wc();function M(e,t){if(!qi)return(r)=>r;return(r)=>e+r+t}var zc=M("\x1B[0m","\x1B[0m"),Kc=M("\x1B[31m","\x1B[39m"),Gc=M("\x1B[32m","\x1B[39m"),Hc=M("\x1B[33m","\x1B[39m"),qc=M("\x1B[34m","\x1B[39m"),Yc=M("\x1B[35m","\x1B[39m"),Jc=M("\x1B[36m","\x1B[39m"),Xc=M("\x1B[37m","\x1B[39m"),Zc=M("\x1B[90m","\x1B[39m"),Qc=M("\x1B[1m","\x1B[22m"),eu=M("\x1B[3m","\x1B[23m"),tu=M("\x1B[4m","\x1B[24m"),ru=M("\x1B[2m","\x1B[22m"),nu=M("\x1B[7m","\x1B[27m"),iu=M("\x1B[8m","\x1B[28m"),ou=M("\x1B[9m","\x1B[29m"),su=M("\x1B[41m","\x1B[49m"),au=M("\x1B[42m","\x1B[49m"),lu=M("\x1B[43m","\x1B[49m"),cu=M("\x1B[44m","\x1B[49m"),uu=M("\x1B[45m","\x1B[49m"),fu=M("\x1B[46m","\x1B[49m"),du=M("\x1B[47m","\x1B[49m"),hu=qi,gu={reset:zc,red:Kc,green:Gc,yellow:Hc,blue:qc,magenta:Yc,cyan:Jc,white:Xc,gray:Zc,bold:Qc,italic:eu,underline:tu,dim:ru,inverse:nu,hidden:iu,strikethrough:ou,bgRed:su,bgGreen:au,bgYellow:lu,bgBlue:cu,bgMagenta:uu,bgCyan:fu,bgWhite:du,isColorSupported:hu},mu=gu,yu=["up","down","left","right","space","enter","cancel"],qx={actions:new Set(yu),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"}};var Yx=pu.platform.startsWith("win"),Jx=Symbol("clapp:cancel");var bu=Lc();var _=(e,t)=>bu?e:t,Xx=_("\u25C6","*"),Zx=_("\u25A0","x"),Qx=_("\u25B2","x"),ev=_("\u25C7","o"),tv=_("\u250C","T"),xu=_("\u2502","|"),rv=_("\u2514","\u2014"),nv=_("\u25CF",">"),iv=_("\u25CB"," "),ov=_("\u25FB","[\u2022]"),sv=_("\u25FC","[+]"),av=_("\u25FB","[ ]"),lv=_("\u25AA","\u2022"),cv=_("\u2500","-"),uv=_("\u256E","+"),fv=_("\u251C","+"),dv=_("\u256F","+"),hv=_("\u25CF","\u2022"),gv=_("\u25C6","*"),mv=_("\u25B2","!"),pv=_("\u25A0","x");var yv={light:_("\u2500","-"),heavy:_("\u2501","="),block:_("\u2588","#")};function vu(){return`${mu.gray(xu)} `}var bv=vu();class Yi{configPath;config=null;events=[];retryCount=0;maxRetries=3;retryDelayMs=1000;constructor(){let e=zi.homedir(),t=rn.join(e,".config","clapp");this.configPath=rn.join(t,"telemetry.json")}async isEnabled(){if(Ue.env.DO_NOT_TRACK==="1"||Ue.env.DO_NOT_TRACK==="true")return!1;if(Ue.env.NO_TELEMETRY==="1"||Ue.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:zi.platform(),nodeVersion:Ue.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:Ue.env.DO_NOT_TRACK==="1"||Ue.env.DO_NOT_TRACK==="true",eventsQueued:this.events.length,lastSent:e.lastSent}}async loadConfig(){if(this.config)return this.config;try{if(wu(this.configPath)){let e=await tn.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=rn.dirname(this.configPath);await tn.mkdir(t,{recursive:!0}),await tn.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 Rv=new Yi;var cn="0.3.24";function be(e){return{prev:null,next:null,data:e}}class le{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 be(e)}createItem(e){return be(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=be(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 le,r=null,n=0;for(let i=this.head;i!=null;i=i.next){let o=be(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 le,r=null,n=0;for(let i=this.head;i!=null;i=i.next)if(e(i.data,n++,this)){let o=be(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 le,t=null;for(let r=this.head;r!=null;r=r.next){let n=be(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(be(e),this.head)}append(e){return this.insert(e,null)}appendData(e){return this.insert(be(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(be(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(be(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 le)this.insertList(t,e),this.remove(e);else this.insert(t,e),this.remove(e)}}function Q(e){switch(e.type){case"StyleSheet":return oe(e.children,"");case"Rule":return`${Q(e.prelude)}{${Q(e.block)}}`;case"Block":return Cu(e.children);case"Atrule":{let t=`@${e.name}`;if(e.prelude){let r=Q(e.prelude);if(r)t+=` ${r}`}if(e.block)t+=`{${Q(e.block)}}`;else t+=";";return t}case"AtrulePrelude":return oe(e.children,"");case"SelectorList":return oe(e.children,",");case"Selector":return oe(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+=`"${un(e.value.value)}"`;else t+=e.value.name;if(e.flags)t+=` ${e.flags}`;return t+="]",t}case"PseudoClassSelector":return e.children?`:${e.name}(${oe(e.children,"")})`:`:${e.name}`;case"PseudoElementSelector":return e.children?`::${e.name}(${oe(e.children,"")})`:`::${e.name}`;case"Combinator":return e.name===" "?" ":e.name;case"Declaration":return`${e.property}:${Q(e.value)}${e.important?"!important":""}`;case"DeclarationList":return oe(e.children,";");case"Value":return oe(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`"${un(e.value)}"`;case"Url":return/[\s"'()\\\u0000-\u001F\u007F]/.test(e.value)?`url("${un(e.value)}")`:`url(${e.value})`;case"Hash":return`#${e.name}`;case"Operator":return e.value;case"Function":return`${e.name}(${oe(e.children,"")})`;case"Parentheses":return`(${oe(e.children,"")})`;case"Brackets":return`[${oe(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?`${Q(e.nth)} of ${Q(e.selector)}`:Q(e.nth);case"MediaQueryList":return oe(e.children,",");case"MediaQuery":return oe(e.children,"");case"MediaFeature":{let t=`(${e.name}`;if(e.value)t+=`:${Q(e.value)}`;return t+=")",t}}return""}function oe(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(Ji(i)||Ji(a)){o=o.next;continue}}let l=Q(s);if(!l){o=o.next;continue}if(!n&&t&&!ku(i))r+=t;n=!1,r+=l,i=s,o=o.next}return r}function Cu(e){let t="",r=null,n=e.head;while(n!=null){let i=n.data,o=Q(i);if(!o){n=n.next;continue}if(r&&Ru(r,i))t+=";";t+=o,r=i,n=n.next}return t}function Ru(e,t){return e.type==="Declaration"&&t.type!=="Comment"}function Ji(e){if(!e||e.type!=="Operator")return!1;let t=e.value;return t===":"||t===","||t==="/"}function ku(e){if(!e)return!1;return e.type==="Operator"||e.type==="Combinator"}function un(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 We=(()=>{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 fe(e){return e<128&&(We[e]&2)!==0}function Rt(e){return e<128&&(We[e]&4)!==0}function Xi(e){return e>=128||e<128&&(We[e]&8)!==0}function Su(e){return e===45||e>=128||e<128&&(We[e]&10)!==0}function Au(e){return e>=0&&e<=8||e===11||e>=14&&e<=31||e===127}function dn(e){return e<128&&(We[e]&16)!==0}function Re(e){return e<128&&(We[e]&1)!==0}function Ve(e,t){if(e!==92)return!1;if(dn(t))return!1;return!0}function fn(e,t,r){if(e===45)return Xi(t)||t===45||Ve(t,r);if(Xi(e))return!0;if(e===92)return Ve(e,t);return!1}function Eu(e,t,r){if(e===43||e===45){if(fe(t))return!0;if(t===46&&fe(r))return!0;return!1}if(e===46)return fe(t);return fe(e)}class Bt{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=Tu(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(Re(n)){let s=t;while(t<r&&Re(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&&(Su(e.charCodeAt(t+1))||Ve(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),l=e.charCodeAt(t+2),a=e.charCodeAt(t+3);if(fn(s,l,a)){let c=t;t++,t=this.consumeName(t),this.addToken(3,c,t);continue}this.addToken(9,t,t+1),t++;continue}let i=e.charCodeAt(t+1),o=e.charCodeAt(t+2);if(Eu(n,i,o)){t=this.consumeNumeric(t);continue}if(fn(n,i,o)){t=this.consumeIdentLike(t);continue}if(n===92){if(Ve(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(dn(o))return this.addToken(6,t,i),i;if(o===92){let s=r.charCodeAt(i+1);if(dn(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(Rt(r)){let n=1;e++;while(n<6&&e<t.length&&Rt(t.charCodeAt(e)))e++,n++;if(e<t.length&&Re(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&&(We[i]&10)!==0){n++;continue}if(i===45){n++;continue}if(i>=128){n++;continue}if(i===92&&Ve(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&&fe(t.charCodeAt(r)))r++;if(t.charCodeAt(r)===46&&fe(t.charCodeAt(r+1))){r+=2;while(r<t.length&&fe(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(fe(i)){r+=2;while(r<t.length&&fe(t.charCodeAt(r)))r++}else if((i===43||i===45)&&fe(o)){r+=3;while(r<t.length&&fe(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(fn(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 l=r+1;while(l<t.length&&Re(t.charCodeAt(l)))l++;let a=t.charCodeAt(l);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&&Re(r.charCodeAt(i)))i++;while(i<n){let o=r.charCodeAt(i);if(o===41)return i++,this.addToken(7,e,i),i;if(Re(o)){let s=i;while(i<n&&Re(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||Au(o))return this.consumeBadUrl(e,i);if(o===92){if(Ve(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&&Ve(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 Tu(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 hn(e,t,r){for(let n=t;n<r;n++)if(e.charCodeAt(n)===92)return Nu(e,t,r,n);return e.slice(t,r)}function Nu(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 l=e.charCodeAt(o+1);if(l===10){o+=2;continue}if(l===13){o+=e.charCodeAt(o+2)===10?3:2;continue}if(Rt(l)){let a=o+1,c="";while(c.length<6&&a<r&&Rt(e.charCodeAt(a)))c+=e[a],a++;let u=Number.parseInt(c,16);if(a<r&&Re(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 gn(e,t,r){for(let n=t;n<r;n++)if(e.charCodeAt(n)===92)return Ou(e,t,r,n);return e.slice(t,r)}function Ou(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 l=o+1,a="";while(a.length<6&&l<r&&Rt(e.charCodeAt(l)))a+=e[l],l++;if(a.length>0){let c=Number.parseInt(a,16);if(l<r&&Re(e.charCodeAt(l)))l++;i+=c===0||c>=55296&&c<=57343||c>1114111?String.fromCodePoint(65533):String.fromCodePoint(c),o=l;continue}if(l<r){i+=e[l],o=l+1;continue}i+=String.fromCodePoint(65533),o=l}return i}function io(e,t){let r=new Bt(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 xe(e,t){return e.source.slice(t.start,t.end)}function de(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 Zi(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 oo(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 Ut(e,t,r,n){return{type:"Raw",value:e,loc:k(n,t,r)}}function te(){return new le}function mn(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 Wt(e,t={}){let r=io(e,t);switch(t.context??"stylesheet"){case"stylesheet":return to(r);case"atrule":return zt(r)??Qi(r);case"atrulePrelude":return Lu(r);case"mediaQuery":case"mediaQueryList":return eo(r);case"rule":return yn(r);case"selectorList":return vn(r);case"selector":return co(r);case"block":return bn(r);case"declarationList":return ju(r);case"declaration":return xn(r)??Qi(r);case"value":return Du(r);case"raw":return eo(r);default:return to(r)}}function Qi(e){return{type:"StyleSheet",children:te(),loc:oo(e)}}function eo(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 to(e){let t=w(e),r=te(),{types:n,end:i}=e;while(e.pos<i){let l=n[e.pos];if(l===13){e.pos++;continue}if(l===25){let u={type:25,start:e.starts[e.pos],end:e.ends[e.pos]},f=pn(e,u);e.pos++,r.appendData(f);continue}if(l===0)break;if(l===14||l===15){e.pos++;continue}if(l===3){let u=zt(e);if(u)r.appendData(u);continue}if(l===24){e.pos++;continue}let a=e.pos,c=yn(e);if(r.appendData(c),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 pn(e,t){return{type:"Comment",value:e.source.slice(t.start+2,t.end-2),loc:k(e,t,t)}}function zt(e){let t=w(e);if(t.type!==3)return null;e.pos++;let r=Vt(e.source,t.start+1,t.end);de(e);let n=e.pos,i=w(e),{types:o,end:s}=e,l=n,a=n;while(l<s){let f=o[l];if(f===0||f===17||f===23)break;if(f!==13&&f!==25)a=l+1;l++}let c=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},g=e.source.slice(f,d).trim();if(g.length>0)if(e.parseAtrulePrelude)try{let m=e.end;e.end=a,e.pos=n;let p=te();while(x(e)!==0){let y=ze(e);if(y)p.appendData(y)}if(ao(p),e.end=m,e.pos=l,p.isEmpty)c=Ut(g,i,h,e);else c={type:"AtrulePrelude",children:p,loc:null}}catch(m){let p=Ut(g,i,h,e);mn(e,`Failed to parse @${r} prelude: ${m.message}`,i,p),c=p,e.pos=l}else c=Ut(g,i,h,e),e.pos=l;else e.pos=l}else e.pos=l;let u=null;if(x(e)===17)C(e);else if(x(e)===23)u=bn(e,_u.has(r));return{type:"Atrule",name:r,prelude:c,block:u,loc:k(e,t,w(e))}}var Pu=new Set(["is","not","where","has","matches","-moz-any","-webkit-any"]),_u=new Set(["media","supports","document","layer","container","scope","starting-style","-moz-document","keyframes","-webkit-keyframes","-moz-keyframes","-o-keyframes"]);function Lu(e){let t=w(e),r=te();while(x(e)!==0){if(w(e).type===13){e.pos++;continue}let i=ze(e);if(i)r.appendData(i)}return{type:"AtrulePrelude",children:r,loc:k(e,t,w(e))}}function yn(e){let t=w(e),r;if(e.parseRulePrelude)r=vn(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=Ut(s,i,o,e)}let n=bn(e,!0);return{type:"Rule",prelude:r,block:n,loc:k(e,t,w(e))}}function bn(e,t=!1){let r=w(e);if(x(e)!==23)return{type:"Block",children:te(),loc:oo(e)};e.pos++;let n=te(),{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(pn(e,a));continue}if(s===3){let a=zt(e);if(a)n.appendData(a);continue}if(t&&Mu(e,Fu)){let a=yn(e);n.appendData(a);continue}let l=xn(e);if(l)n.appendData(l);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 Mu(e,t){let r=e.pos,n=t(e);return e.pos=r,n}function Fu(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 ju(e){let t=w(e),r=te();while(x(e)!==0&&x(e)!==24){let n=w(e);if(n.type===13){e.pos++;continue}if(n.type===25){r.appendData(pn(e,C(e)));continue}if(n.type===17){e.pos++;continue}if(n.type===3){let o=zt(e);if(o)r.appendData(o);continue}let i=xn(e);if(i)r.appendData(i);if(x(e)===17)C(e)}return{type:"DeclarationList",children:r,loc:k(e,t,w(e))}}function xn(e){de(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{mn(e,"Expected property name",t,{type:"Raw",value:"",loc:null});let{types:S,end:j}=e;while(e.pos<j){let K=S[e.pos];if(K===0||K===17||K===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(Zi(e),x(e)!==16){mn(e,`Expected ':' after property "${i}"`,w(e),{type:"Raw",value:"",loc:null});let{types:S,end:j}=e;while(e.pos<j){let K=S[e.pos];if(K===0||K===17||K===24)break;e.pos++}return null}e.pos++,Zi(e);let{types:o,starts:s,end:l,pos:a}=e,c=a,u=a,f=-1,d=-1;while(c<l){let S=o[c];if(S===0||S===17||S===24)break;if(S===9&&e.source.charCodeAt(s[c])===33){let j=c+1;while(j<l&&o[j]===13)j++;if(j<l&&o[j]===1){let K=s[j];if(e.ends[j]-K===9&&(e.source.charCodeAt(K)|32)===105&&(e.source.charCodeAt(K+1)|32)===109&&(e.source.charCodeAt(K+2)|32)===112&&(e.source.charCodeAt(K+3)|32)===111&&(e.source.charCodeAt(K+4)|32)===114&&(e.source.charCodeAt(K+5)|32)===116&&(e.source.charCodeAt(K+6)|32)===97&&(e.source.charCodeAt(K+7)|32)===110&&(e.source.charCodeAt(K+8)|32)===116){d=c,f=j,c=j+1;continue}}}if(S!==13&&S!==25)u=c+1;c++}let h=u,g=f>=0?{type:1,start:s[f],end:e.ends[f]}:null,m=i.startsWith("--"),p,y=s[a],b=h>a?e.ends[h-1]:y,v={type:o[a],start:y,end:e.ends[a]},R=h>a?{type:o[h-1],start:s[h-1],end:b}:v;if(m&&!e.parseCustomProperty||!e.parseValue)p={type:"Raw",value:e.source.slice(y,b).trim(),loc:k(e,v,R)};else if(h===a)p={type:"Value",children:te(),loc:k(e,v,R)};else{let S=e.end;e.end=h,e.pos=a,p=so(e),e.end=S}return e.pos=c,{type:"Declaration",property:i,important:g?!0:!1,value:p,loc:k(e,t,w(e))}}function Du(e){return so(e)}function so(e){let t=w(e),r=te();while(x(e)!==0&&x(e)!==17&&x(e)!==24&&x(e)!==22&&x(e)!==20){let n=ze(e);if(n)r.appendData(n)}return lo(r),{type:"Value",children:r,loc:k(e,t,w(e))}}function ao(e){for(let t of e)if("children"in t&&t.children instanceof le)ao(t.children);lo(e)}function lo(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 ze(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:ee(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?ee(e,n,i):null};case 10:return e.pos++,{type:"Number",value:o.slice(n,i),loc:e.positions?ee(e,n,i):null};case 11:return e.pos++,{type:"Percentage",value:o.slice(n,i-1),loc:e.positions?ee(e,n,i):null};case 12:{e.pos++;let s=n,l=o.charCodeAt(s);if(l===43||l===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 c=o.charCodeAt(s);if(c===69||c===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?ee(e,n,i):null}}case 1:return e.pos++,{type:"Identifier",name:gn(o,n,i),loc:e.positions?ee(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:hn(o,s,a),loc:e.positions?ee(e,n,i):null}}case 7:{e.pos++;let s=n+4;while(s<i&&ro(o.charCodeAt(s)))s++;let l=i;if(l>s&&o.charCodeAt(l-1)===41)l--;while(l>s&&ro(o.charCodeAt(l-1)))l--;let a;if(l-s>=2){let c=o.charCodeAt(s),u=o.charCodeAt(l-1);if((c===34||c===39)&&c===u)a=o.slice(s+1,l-1);else a=o.slice(s,l)}else a=o.slice(s,l);return{type:"Url",value:a,loc:e.positions?ee(e,n,i):null}}case 4:return e.pos++,{type:"Hash",name:o.slice(n+1,i),loc:e.positions?ee(e,n,i):null};case 2:return Uu(e);case 21:return Vu(e);case 18:return e.pos++,{type:"Operator",value:",",loc:e.positions?ee(e,n,i):null};case 16:return e.pos++,{type:"Operator",value:":",loc:e.positions?ee(e,n,i):null};case 9:{e.pos++;let s=o.charCodeAt(n),l=o[n];if(Bu(s))return{type:"Operator",value:l,loc:e.positions?ee(e,n,i):null};return{type:"Identifier",name:l,loc:e.positions?ee(e,n,i):null}}case 19:{e.pos++;let s=te();while(x(e)!==0&&x(e)!==20){let a=ze(e);if(a)s.appendData(a)}let l=e.pos<e.end?e.ends[e.pos]:i;if(x(e)===20)e.pos++;return{type:"Brackets",children:s,loc:e.positions?ee(e,n,l):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?ee(e,n,i):null}}return e.pos++,null}function ro(e){return e===32||e===9||e===10||e===12||e===13}function Bu(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 Vt(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 ee(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 Uu(e){let t=C(e),r=Vt(e.source,t.start,t.end-1),n=te();while(x(e)!==0&&x(e)!==22){let i=ze(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 Vu(e){let t=C(e),r=te();while(x(e)!==0&&x(e)!==22){let n=ze(e);if(n)r.appendData(n)}if(x(e)===22)C(e);return{type:"Parentheses",children:r,loc:k(e,t,w(e))}}function vn(e){let t=w(e),r=te();while(x(e)!==0){if(de(e),x(e)===0||x(e)===23)break;let n=co(e);if(n.children.head!==null)r.appendData(n);if(de(e),x(e)===18){C(e);continue}break}return{type:"SelectorList",children:r,loc:k(e,t,w(e))}}function co(e){let t=w(e),r=te(),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&&!no(e)&&!Wu(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 l=C(e),a={type:"Combinator",name:"||",loc:k(e,s,l)};r.appendData(a),n=!0,de(e);continue}if(no(e)){let s=C(e),a={type:"Combinator",name:e.source[s.start],loc:k(e,s,s)};r.appendData(a),n=!0,de(e);continue}let o=zu(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 no(e){let t=w(e);if(t.type!==9)return!1;let r=e.source[t.start];return r===">"||r==="+"||r==="~"}function Wu(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 zu(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:`${xe(e,t)}|${xe(e,n)}`,loc:k(e,t,n)}}if(x(e)===9&&e.source[w(e).start]==="*"){let n=C(e);return{type:"TypeSelector",name:`${xe(e,t)}|*`,loc:k(e,t,n)}}}return{type:"TypeSelector",name:xe(e,t),loc:k(e,t,t)}}case 11:return C(e),{type:"TypeSelector",name:xe(e,t),loc:k(e,t,t)};case 10:return C(e),{type:"TypeSelector",name:xe(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:xe(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 Ku(e,r,t)}case 19:return Gu(e)}return null}function Ku(e,t,r){let n=w(e);if(n.type===1){C(e);let i=Vt(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=Vt(e.source,n.start,n.end-1),o=te();if(!t&&Pu.has(i)){let a=w(e),c=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}c=C(e)}if(x(e)===22)C(e);let f=e.source.slice(a.start,c.end).trim();if(f.length>0){let d=io(f,{positions:!1}),h=vn(d);o.appendData(h)}}else{while(x(e)!==0&&x(e)!==22){let a=ze(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 Gu(e){let t=C(e);de(e);let r=w(e);if(r.type!==1)return null;C(e);let n={type:"Identifier",name:xe(e,r),loc:k(e,r,r)};de(e);let i=null,o=null,s=null,l=w(e);if(l.type===9){let c=e.source[l.start],u=e.source[l.start+1];if(c==="=")i="=",C(e);else if((c==="~"||c==="|"||c==="^"||c==="$"||c==="*")&&u==="="){C(e);let h=w(e);if(h.type===9&&e.source[h.start]==="=")C(e),i=`${c}=`}de(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:hn(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:xe(e,f),loc:k(e,f,f)};de(e);let d=w(e);if(d.type===1)C(e),s=xe(e,d)}de(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 uo=Symbol("walkSkip"),U=Symbol("walkStop");function Hu(e){return{root:e,stylesheet:null,atrule:null,atrulePrelude:null,rule:null,selector:null,block:null,declaration:null,function:null}}function qu(e,t){let r=Hu(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 l(a,c,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 g=n.call(r,a,c,u);if(g===uo){if(f)r[f]=d;return}if(g===U){if(f)r[f]=d;return U}}if(h=Yu(a,s,l),h===U){if(f)r[f]=d;return U}if((o===null||o===a.type)&&i){if(i.call(r,a,c,u)===U){if(f)r[f]=d;return U}}if(f)r[f]=d;return}return l(e,null,null)}var Ke=Object.assign(qu,{skip:uo,stop:U});function Yu(e,t,r){if("children"in e&&e.children instanceof le)return Ju(e.children,t,r);if(e.type==="Rule"){if(r(e.prelude,null,null)===U)return U;if(r(e.block,null,null)===U)return U;return}if(e.type==="Atrule"){if(e.prelude){if(r(e.prelude,null,null)===U)return U}if(e.block){if(r(e.block,null,null)===U)return U}return}if(e.type==="Declaration")return r(e.value,null,null);if(e.type==="AttributeSelector"){if(r(e.name,null,null)===U)return U;if(e.value)return r(e.value,null,null);return}return}function Ju(e,t,r){let n;if(t)e.forEachRight((i,o,s)=>{if(n)return;if(r(i,o,s)===U)n=U});else e.forEach((i,o,s)=>{if(n)return;if(r(i,o,s)===U)n=U});return n}function et(e,t={}){let r=t.exclamation??!1,n=!1;Ke(e,(i,o,s)=>{if(i.type!=="Comment")return;let l=i.value.startsWith("!");if(r===!0&&l)return;if(r==="first-exclamation"&&l&&!n){n=!0;return}if(o&&s)s.remove(o)})}function Kt(e){Ke(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 l=n;l!=null;l=l.next)if(l.data.type==="Declaration"){if(i++,i>=2)break}if(i<2)return;let o=new Map,s=[];for(let l=n;l!=null;l=l.next){let a=l.data;if(a.type!=="Declaration")continue;let c=a.property,u=o.get(c);if(u){let f=!!u.decl.important,d=!!a.important;if(d||f===d)s.push(u.item),o.set(c,{item:l,decl:a});else s.push(l)}else o.set(c,{item:l,decl:a})}for(let l of s)r.remove(l)})}var Xu={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"},Zu={"#f00":"red","#ff0000":"red","#000080":"navy","#008080":"teal"};function $n(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 fo(e){let t=e.toLowerCase();return Xu[t]??null}function ho(e){let t=e.toLowerCase();return Zu[t]??null}function Qu(e,t,r){let n=(e<<16|t<<8|r).toString(16).padStart(6,"0");return $n(`#${n}`)}var ef=/^rgba?\(\s*([+-]?\d*\.?\d+%?)\s*[,\s]\s*([+-]?\d*\.?\d+%?)\s*[,\s]\s*([+-]?\d*\.?\d+%?)\s*(?:[,/]\s*([+-]?\d*\.?\d+%?)\s*)?\)$/;function go(e){let t=ef.exec(e.trim());if(!t)return e;let r=wn(t[1]),n=wn(t[2]),i=wn(t[3]);if(t[4]!==void 0&&!tf(t[4]))return e;return Qu(r,n,i)}function tf(e){if(e.endsWith("%"))return Number.parseFloat(e)>=100;return Number.parseFloat(e)>=1}function wn(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 rf=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 Gt(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 mo(e,t){let r=Gt(e);if((r==="0"||r==="-0")&&rf.has(t.toLowerCase()))return{value:"0",unit:""};return{value:r,unit:t}}function po(e){return Gt(e)}function yo(e,t){let r=Number.parseFloat(e);if(!Number.isFinite(r))return e;let n=t<0?0:t;return r.toFixed(n)}var bo=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 xo(e){if(!e||e.type!=="Operator")return!1;let t=e.value;return t===":"||t===","||t==="/"}function nf(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&&xo(r.prev.data),o=n&&xo(n.data);if(i||o)t.remove(r)}r=n}}function Cn(e,t={}){let r=t.floatPrecision??null,n=r===null?null:(i)=>yo(i,r);Ke(e,{enter(i,o,s){switch(i.type){case"Number":{let l=n?n(i.value):i.value;i.value=Gt(l);return}case"Percentage":{let l=n?n(i.value):i.value;i.value=po(l);return}case"Dimension":{let l=n?n(i.value):i.value,a=mo(l,i.unit);i.value=a.value,i.unit=a.unit;return}case"Hash":{let l=$n(`#${i.name}`).slice(1);if(i.name=l,o&&s&&this.declaration&&bo.has(this.declaration.property.toLowerCase())){let a=ho(`#${l}`);if(a&&a.length<l.length+1){let c={type:"Identifier",name:a,loc:i.loc};s.replace(o,s.createItem(c))}}return}case"Identifier":{if(!o||!s||!this.declaration)return;if(!bo.has(this.declaration.property.toLowerCase()))return;let l=fo(i.name);if(l&&l.length<i.name.length){let a={type:"Hash",name:l.slice(1),loc:i.loc};s.replace(o,s.createItem(a))}return}case"Url":return;case"Function":{let l=i.name.toLowerCase();if((l==="rgb"||l==="rgba")&&o&&s)i.__rgbReplaceCandidate=!0}}},leave(i,o,s){if(i.type==="Parentheses"||i.type==="Function"||i.type==="Value")nf(i);if(i.type==="Function"&&i.__rgbReplaceCandidate&&o&&s){let l=Q(i),a=go(l);if(a!==l&&a.startsWith("#")){let c={type:"Hash",name:a.slice(1),loc:i.loc};s.replace(o,s.createItem(c))}}}})}function of(e,t={}){let r=Wt(e,{context:"stylesheet"});return vo(r,t)}function Rn(e,t={}){let r=Wt(e,{context:"declarationList"});return vo(r,t)}function vo(e,t){if(t.comments===!1)et(e,{exclamation:!1});else if(t.comments==="first-exclamation")et(e,{exclamation:"first-exclamation"});else et(e,{exclamation:!0});return Cn(e,{floatPrecision:t.floatPrecision??null}),Kt(e),{css:Q(e),ast:e}}function Le(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 wo=new Map,_e=new Map;var kn={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"},lf=/[%#()]/,cf=/^\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"],uf=new Set(Eo);function se(e){return lf.test(e)||cf.test(e)}function $o(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 c=e.slice(a,o);if(uf.has(c))r.unshift(!0);else if(r[0]&&c==="")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(),c=a.charCodeAt(a.length-1),u=a.charCodeAt(a.length-2),f=e.charCodeAt(o+1),d=c===43||c===45||c===42||c===47,h=f===43||f===45||f===42||f===47;if((c===101||c===69)&&u>=48&&u<=57)t+=e[o];else if(d||c===40||c===44)t+=e[o];else if(e.charCodeAt(o-1)===32)t+=`${e[o]} `;else if(c>=48&&c<=57||f>=48&&f<=57||c===41||f===40||h||i!==null&&i===o-1)t+=` ${e[o]} `;else t+=e[o];continue}t+=e[o]}return t}function Ht(e){if(!e.includes("_"))return $o(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 $o(t)}function Co(e,t){if(t.length!==2)return null;let[r,n]=t;if(r!=="min"&&r!=="max")return null;return[se(n)?`${r}-${e}-[${n}]`:`${r}-${e}-${n}`]}var ff={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(se(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(se(r))return`w-[${r}]`;return`w-${r}`},multiValue:(e)=>Co("w",e)},h:{expand:(e,t)=>{let r=t[e]||e;if(se(r))return`h-[${r}]`;return`h-${r}`},multiValue:(e)=>Co("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(se(r))return`inset-[${r}]`;return`inset-${r}`}},top:{expand:(e)=>se(e)?`top-[${e}]`:`top-${e}`},right:{expand:(e)=>se(e)?`right-[${e}]`:`right-${e}`},bottom:{expand:(e)=>se(e)?`bottom-[${e}]`:`bottom-${e}`},left:{expand:(e)=>se(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)=>se(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)=>se(e)?`backdrop-hue-rotate-[${e}]`:`backdrop-hue-rotate-${e}`},animate:{expand:(e)=>`animate-${e}`},"forced-colors":{expand:(e)=>`forced-colors-${e}`}},kt=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","only-of-type","checked","indeterminate","default","required","valid","invalid","in-range","out-of-range","placeholder-shown","autofill","read-only","user-valid","user-invalid","inert","empty","before","after","selection","marker","file","first-letter","first-line","backdrop","details-content","print","motion-safe","motion-reduce","pointer-none","pointer-coarse","pointer-fine","any-pointer-none","any-pointer-coarse","any-pointer-fine","inverted-colors","noscript","starting","contrast-more","contrast-less","rtl","ltr","portrait","landscape","@sm","@md","@lg","@xl","@2xl"]),Ro=new WeakMap,ko=new WeakMap;function df(e){if(!e)return kn;let t=Ro.get(e);if(!t)t=e.aliases?{...kn,...e.aliases}:kn,Ro.set(e,t);return t}function hf(e){if(!e?.aliases)return"";let t=ko.get(e);if(t===void 0)t=JSON.stringify(e.aliases),ko.set(e,t);return t}function St(e){let t=[],r="",n=0;for(let i=0;i<e.length;i++){let o=e[i];if(o==="[")n++;else if(o==="]")n--;if(o===":"&&n===0)t.push(r),r="";else r+=o}return t.push(r),t}function gf(e,t){let r=`${e}:${t?.colonSyntax}:${hf(t)}`,n=_e.get(r);if(n)return n;let i=df(t);if(t?.colonSyntax===!0){let m=e.match(/^([a-z][a-z0-9-]*):([^[\]:]+)$/i);if(m){let[,p,y]=m;if(!kt.has(p)){if(se(y)){let v=[`${p}-[${y}]`];return Le(_e,r,v),v}let b=y.startsWith("-")?[`-${p}-${y.slice(1)}`]:[`${p}-${y}`];return Le(_e,r,b),b}}}let o="",s=e,l=!1;if(s.startsWith("-"))l=!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)=>kt.has(y)))o=a[1],s=a[2]}let c=s.match(/^([a-z][a-z0-9-]*)\[([^\]]*)\]$/i);if(!c||s.includes("-[")){let m=[e];return Le(_e,r,m),m}let[,u,f]=c,d=f.split(/\s+/).filter(Boolean);if(d.length===0)return Le(_e,r,[]),[];let h=ff[u.toLowerCase()];if(h?.multiValue){let m=h.multiValue(d,i);if(m){let p=m.map((y)=>`${o}${l?"-":""}${y}`);return Le(_e,r,p),p}}if(!h){let m=[];for(let p of d){let y=p.match(/^([a-z@][a-z0-9-]*):(.+)$/i),b="",v=p;if(y&&kt.has(y[1]))b=`${y[1]}:`,v=y[2];let R="";if(v.startsWith("-"))R="-",v=v.slice(1);let S="";if(v.endsWith("!"))S="!",v=v.slice(0,-1);let j=l?"-":"";if(se(v))m.push(`${o}${b}${S}${j}${R}${u}-[${v}]`);else m.push(`${o}${b}${S}${j}${R}${u}-${v}`)}return Le(_e,r,m),m}let g=[];for(let m of d){let p=m.match(/^([a-z@][a-z0-9-]*):(.+)$/i),y="",b=m;if(p&&kt.has(p[1]))y=`${p[1]}:`,b=p[2];let v="";if(b.startsWith("-"))v="-",b=b.slice(1);let R="";if(b.endsWith("!"))R="!",b=b.slice(0,-1);let S=h.expand(b,i);if(S){let j=l?"-":"";g.push(`${o}${y}${R}${j}${v}${S}`)}}return Le(_e,r,g),g}function mf(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=(c)=>{let u=c.includes(":")?c.split(":").pop():c;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},l=/<([a-z][a-z0-9-]*)\s([^>]*)>/gi,a;while((a=l.exec(e))!==null){let c=a[2],u=/([a-z][a-z0-9-:]*)(?:=["']([^"']*)["'])?(?=\s|$|\/?>)/gi,f;while((f=u.exec(c))!==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 g="",m=d,p=d.match(/^((?:[a-z@][a-z0-9-]*:)+)([a-z][a-z0-9-]*)$/i);if(p){if(p[1].slice(0,-1).split(":").every((v)=>kt.has(v)))g=p[1],m=p[2]}if(h!==void 0){let y=h.split(/\s+/).filter(Boolean);for(let b of y){let v=`${g}${m}-${b}`;if(So(v.replace(/^(?:[a-z@][a-z0-9-]*:)+/gi,"")))r.add(v)}}else{let y=`${g}${m}`;if(So(m))r.add(y)}}}return r}function So(e){if(!e||e.length===0)return!1;return/^[a-z][a-z0-9-/]*(?:-\[[^\]]+\])?$/i.test(e)}function Sn(e){let t=wo.get(e);if(t)return t;let r=vf(e);return r.base=xf(r),Le(wo,e,r),r}var pf=new Set(["bg","text","border","ring","placeholder","divide","accent","caret","fill","stroke","outline","decoration","shadow","ring-offset","from","via","to"]),yf=/^(.+?)\/(\d+|\[\d*\.?\d+\])$/,bf=/^(\d+)\/(\d+)$/;function Ao(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 xf(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 vf(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 h=St(r),g=h[h.length-1],m=!1;if(g.charCodeAt(0)===33&&g.length>1)m=!0,g=g.slice(1);let p=g.match(/^\[([a-z-]+):(.+)\]$/);if(p)return{raw:e,variants:h.slice(0,-1),utility:p[1],value:Ht(p[2]),important:t||m,arbitrary:!0}}let n=r.match(/^((?:[a-z-]+:)*)(-?[a-z-]+?)-\[([^\]]+)\]\/\[([^\]]+)\]$/);if(n){let[,h,g,m,p]=n,y=h?h.split(":").filter(Boolean):[],b=g.startsWith("-"),v=b?g.slice(1):g,R=Ht(m);if(b)R=R.startsWith("-")?R:`-${R}`;return{raw:e,variants:y,utility:v,value:`${R}/${p}`,important:t,arbitrary:!0,modifierArbitrary:!0}}let i=r.match(/^((?:[a-z-]+:)*)(-?[a-z-]+?)-\[(.+)\]$/);if(i){let h=i[1],g=h?h.split(":").filter(Boolean):[],m=i[2],p=m.startsWith("-");if(p)m=m.slice(1);let y=Ht(i[3]),b,v=y.match(/^(color|length|url|number|percentage|position|line-width|absolute-size|relative-size|image|angle|time|flex|string|family-name):(.*)/i);if(v)b=v[1].toLowerCase(),y=v[2];if(p)y=y.startsWith("-")?y:`-${y}`;return{raw:e,variants:g,utility:m,value:y,important:t,arbitrary:!0,typeHint:b}}let o=St(r),s=o[o.length-1],l=o.slice(0,-1);if(s.startsWith("!")&&s.length>1)t=!0,s=s.slice(1);else if(s.endsWith("!")&&s.length>1)t=!0,s=s.slice(0,-1);if(l.length>0)r=`${l.join(":")}:${s}`;else r=s;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(s))return{raw:e,variants:l,utility:s,value:void 0,important:t,arbitrary:!1};let c=s.match(/^([a-z-]+?)-\[(.+?)\]$/);if(c){let h=Ht(c[2]),g,m=h.match(/^(color|length|url|number|percentage|position|line-width|absolute-size|relative-size|image|angle|time|flex|string|family-name):(.*)/i);if(m)g=m[1].toLowerCase(),h=m[2];return{raw:e,variants:l,utility:c[1],value:h,important:t,arbitrary:!0,typeHint:g}}let u=["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(s==="divide-x"||s==="divide-y")return{raw:e,variants:l,utility:s,value:void 0,important:t,arbitrary:!1};let f=s.match(/^(divide-[xy])-(.+)$/);if(f)return{raw:e,variants:l,utility:f[1],value:f[2],important:t,arbitrary:!1};for(let h of u)if(s.startsWith(`${h}-`))return{raw:e,variants:l,utility:h,value:s.slice(h.length+1),important:t,arbitrary:!1};if(s.startsWith("-")){let h=s.slice(1);for(let m of u)if(h.startsWith(`${m}-`))return{raw:e,variants:l,utility:m,value:`-${h.slice(m.length+1)}`,important:t,arbitrary:!1};let g=Ao(h);if(g)return{raw:e,variants:l,utility:g[0],value:`-${g[1]}`,important:t,arbitrary:!1};return{raw:e,variants:l,utility:h,value:void 0,important:t,arbitrary:!1}}let d=Ao(s);if(d){let[h,g]=d,m=g.match(yf);if(m&&pf.has(h))return{raw:e,variants:l,utility:h,value:`${m[1]}/${m[2]}`,important:t,arbitrary:!1};let p=g.match(bf);if(p)return{raw:e,variants:l,utility:h,value:`${p[1]}/${p[2]}`,important:t,arbitrary:!1};return{raw:e,variants:l,utility:h,value:g,important:t,arbitrary:!1}}return{raw:e,variants:l,utility:s,value:void 0,important:t,arbitrary:!1}}function wf(e){return/^\[[a-z-]+:[^\]]+\]$/i.test(e)}function $f(e){if(!e)return!1;if(e==="*"||e==="**")return!0;if(e.startsWith("[")&&e.endsWith("]"))return e.length>2;return/^(?:@[a-z0-9]|[a-z])[a-z0-9.-]*(?:\[[^\]]+\])?(?:\/[\w-]+)?$/i.test(e)}function Cf(e,t){let r=e;if(r.startsWith("!"))r=r.slice(1);if(r.endsWith("!"))r=r.slice(0,-1);if(!r)return!1;if(wf(r))return!0;if(t?.enabled&&/^[a-z]+\[[^\]]+\]$/i.test(r))return!0;return/^[-@]?[a-z][a-z0-9.-]*(?:-\[[^\]]+\])?(?:\/(?:[\w.]+|[\w-]+|\[[^\]]+\]))?$/i.test(r)}function To(e,t){if(!e||e.length===0)return!1;if(t?.colonSyntax&&/^[a-z]+:[^[\]:]+$/i.test(e))return!0;let r=e;if(r.startsWith("!"))r=r.slice(1);if(r.endsWith("!"))r=r.slice(0,-1);if(!r)return!1;let n=St(r);for(let i=0;i<n.length-1;i++)if(!$f(n[i]))return!1;return Cf(n[n.length-1],t)}function Yt(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 l=s[1],a=l.match(/["']([^"']+)["']/g);if(a)for(let f of a){let d=f.replace(/["']/g,""),h=Yt(d);for(let g of h)qt(r,g,t)}let c=l.replace(/["'`]/g," ").replace(/\$\{[^}]+\}/g," "),u=Yt(c).filter((f)=>To(f,t?.bracketSyntax));for(let f of u)qt(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 l=s[1].match(/["'`]([^"'`]+)["'`]/g);if(l)for(let a of l){let c=a.replace(/["'`]/g,"").replace(/\$\{[^}]+\}/g," ");for(let u of Yt(c))qt(r,u,t)}}}if(t?.codeStrings?.enabled!==!1)for(let o of No(e,t?.bracketSyntax))qt(r,o,t);if(t?.attributify?.enabled){let o=mf(e,t.attributify);for(let s of o)r.add(s)}return r}function Rf(e,t){if(!/[-:/[]/.test(e))return!1;if(e.startsWith("-")&&!/^-[a-z]/i.test(e))return!1;return To(e,t)}function No(e,t){let r=new Set,n=e.length,i=0,o=/[<>]/g,s=o.exec(e),l=-1,a=-1,c="";while(i<n){let u=e[i];if(u==="/"&&e[i+1]==="/"){let p=e.indexOf(`
92
- `,i);i=p===-1?n:p;continue}if(u==="/"&&e[i+1]==="*"){let p=e.indexOf("*/",i+2);i=p===-1?n:p+2;continue}if(u==="/"&&(!/[\w$)\]]/.test(c)||Sf(e,i))){let p=Af(e,i);if(p!==-1){i=p,c=")";continue}}if(u!=='"'&&u!=="'"&&u!=="`"){if(!/\s/.test(u))c=u;i++;continue}c=")";while(s&&s.index<i){if(s[0]==="<")l=s.index;else a=s.index;s=o.exec(e)}let f=Tf(e,i,l,a),d=u==="`",h=i+1,g="",m=!1;while(h<n){let p=e[h];if(p==="\\"){g+=e[h+1]??"",h+=2;continue}if(p===u){m=!0,h++;break}if(!d&&p===`
93
- `)break;if(d&&p==="$"&&e[h+1]==="{"){let y=1;h+=2;let b=h;while(h<n&&y>0){if(e[h]==="{")y++;else if(e[h]==="}")y--;h++}for(let v of No(e.slice(b,h-1),t))r.add(v);g+=" ";continue}g+=p,h++}if(m){if(f){for(let p of g.match(Ef)??[])r.add(p);i=h;continue}for(let p of Yt(g))if(Rf(p,t))r.add(p);i=h}else i++}return r}var kf=new Set(["return","typeof","case","in","of","delete","void","throw","new","else","do","yield","await","instanceof"]);function Sf(e,t){let r=t;while(r>0&&/\s/.test(e[r-1]))r--;let n=r;while(n>0&&/[\w$]/.test(e[n-1]))n--;if(n===r||!kf.has(e.slice(n,r)))return!1;let i=n;while(i>0&&/\s/.test(e[i-1]))i--;return e[i-1]!=="."}function Af(e,t){let r=!1;for(let n=t+1;n<e.length;n++){let i=e[n];if(i===`
94
- `)return-1;if(i==="\\"){n++;continue}if(i==="[")r=!0;else if(i==="]")r=!1;else if(i==="/"&&!r){let o=n+1;while(o<e.length&&/[a-z]/i.test(e[o]))o++;return o}}return-1}var Ef=/(?<![\w-])i-[a-z0-9]+(?:-[a-z0-9]+)+(?![\w-])/gi;function Tf(e,t,r,n){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 qt(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=gf(t,r.bracketSyntax);for(let s of o)e.add(s);return}}e.add(t)}var Xt={getCSS:()=>`
91
+ `),Ie.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((l,a)=>{if(l.variadic)n.push(e.slice(a));else n.push(e[a])}),n.push(t);let i={command:r,args:n,options:t};for(let l of r.beforeHooks)await l(i);let o,s=async()=>{let l=r.commandAction.apply(this,n);if(l instanceof Promise)o=await l;else o=l;return o};if(r.middleware.length>0){let l=0,a=async()=>{if(l<r.middleware.length){let c=r.middleware[l++];await c({...i,next:a})}else await s()};await a()}else await s();for(let l of r.afterHooks)await l(i);return o}removeSignalHandlers(){if(!this.signalHandlersSet)return this;return Ie.removeAllListeners("SIGINT"),Ie.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 Hi{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 Wx=new Hi;function zc(){if("FORCE_COLOR"in wt.env)return wt.env.FORCE_COLOR!=="0";if("NO_COLOR"in wt.env||wt.env.TERM==="dumb")return!1;if(wt.platform==="win32")return!0;return Wi.isatty(1)&&Wi.isatty(2)}var qi=zc();function M(e,t){if(!qi)return(r)=>r;return(r)=>e+r+t}var Kc=M("\x1B[0m","\x1B[0m"),Gc=M("\x1B[31m","\x1B[39m"),Hc=M("\x1B[32m","\x1B[39m"),qc=M("\x1B[33m","\x1B[39m"),Yc=M("\x1B[34m","\x1B[39m"),Jc=M("\x1B[35m","\x1B[39m"),Xc=M("\x1B[36m","\x1B[39m"),Zc=M("\x1B[37m","\x1B[39m"),Qc=M("\x1B[90m","\x1B[39m"),eu=M("\x1B[1m","\x1B[22m"),tu=M("\x1B[3m","\x1B[23m"),ru=M("\x1B[4m","\x1B[24m"),nu=M("\x1B[2m","\x1B[22m"),iu=M("\x1B[7m","\x1B[27m"),ou=M("\x1B[8m","\x1B[28m"),su=M("\x1B[9m","\x1B[29m"),au=M("\x1B[41m","\x1B[49m"),lu=M("\x1B[42m","\x1B[49m"),cu=M("\x1B[43m","\x1B[49m"),uu=M("\x1B[44m","\x1B[49m"),fu=M("\x1B[45m","\x1B[49m"),du=M("\x1B[46m","\x1B[49m"),hu=M("\x1B[47m","\x1B[49m"),gu=qi,mu={reset:Kc,red:Gc,green:Hc,yellow:qc,blue:Yc,magenta:Jc,cyan:Xc,white:Zc,gray:Qc,bold:eu,italic:tu,underline:ru,dim:nu,inverse:iu,hidden:ou,strikethrough:su,bgRed:au,bgGreen:lu,bgYellow:cu,bgBlue:uu,bgMagenta:fu,bgCyan:du,bgWhite:hu,isColorSupported:gu},pu=mu,bu=["up","down","left","right","space","enter","cancel"],Yx={actions:new Set(bu),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"}};var Jx=yu.platform.startsWith("win"),Xx=Symbol("clapp:cancel");var xu=Mc();var _=(e,t)=>xu?e:t,Zx=_("\u25C6","*"),Qx=_("\u25A0","x"),ev=_("\u25B2","x"),tv=_("\u25C7","o"),rv=_("\u250C","T"),vu=_("\u2502","|"),nv=_("\u2514","\u2014"),iv=_("\u25CF",">"),ov=_("\u25CB"," "),sv=_("\u25FB","[\u2022]"),av=_("\u25FC","[+]"),lv=_("\u25FB","[ ]"),cv=_("\u25AA","\u2022"),uv=_("\u2500","-"),fv=_("\u256E","+"),dv=_("\u251C","+"),hv=_("\u256F","+"),gv=_("\u25CF","\u2022"),mv=_("\u25C6","*"),pv=_("\u25B2","!"),yv=_("\u25A0","x");var bv={light:_("\u2500","-"),heavy:_("\u2501","="),block:_("\u2588","#")};function wu(){return`${pu.gray(vu)} `}var xv=wu();class Yi{configPath;config=null;events=[];retryCount=0;maxRetries=3;retryDelayMs=1000;constructor(){let e=zi.homedir(),t=rn.join(e,".config","clapp");this.configPath=rn.join(t,"telemetry.json")}async isEnabled(){if(Ue.env.DO_NOT_TRACK==="1"||Ue.env.DO_NOT_TRACK==="true")return!1;if(Ue.env.NO_TELEMETRY==="1"||Ue.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:zi.platform(),nodeVersion:Ue.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:Ue.env.DO_NOT_TRACK==="1"||Ue.env.DO_NOT_TRACK==="true",eventsQueued:this.events.length,lastSent:e.lastSent}}async loadConfig(){if(this.config)return this.config;try{if($u(this.configPath)){let e=await tn.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=rn.dirname(this.configPath);await tn.mkdir(t,{recursive:!0}),await tn.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 kv=new Yi;var cn="0.3.26";function be(e){return{prev:null,next:null,data:e}}class le{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 be(e)}createItem(e){return be(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=be(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 le,r=null,n=0;for(let i=this.head;i!=null;i=i.next){let o=be(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 le,r=null,n=0;for(let i=this.head;i!=null;i=i.next)if(e(i.data,n++,this)){let o=be(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 le,t=null;for(let r=this.head;r!=null;r=r.next){let n=be(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(be(e),this.head)}append(e){return this.insert(e,null)}appendData(e){return this.insert(be(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(be(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(be(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 le)this.insertList(t,e),this.remove(e);else this.insert(t,e),this.remove(e)}}function Q(e){switch(e.type){case"StyleSheet":return oe(e.children,"");case"Rule":return`${Q(e.prelude)}{${Q(e.block)}}`;case"Block":return Ru(e.children);case"Atrule":{let t=`@${e.name}`;if(e.prelude){let r=Q(e.prelude);if(r)t+=` ${r}`}if(e.block)t+=`{${Q(e.block)}}`;else t+=";";return t}case"AtrulePrelude":return oe(e.children,"");case"SelectorList":return oe(e.children,",");case"Selector":return oe(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+=`"${un(e.value.value)}"`;else t+=e.value.name;if(e.flags)t+=` ${e.flags}`;return t+="]",t}case"PseudoClassSelector":return e.children?`:${e.name}(${oe(e.children,"")})`:`:${e.name}`;case"PseudoElementSelector":return e.children?`::${e.name}(${oe(e.children,"")})`:`::${e.name}`;case"Combinator":return e.name===" "?" ":e.name;case"Declaration":return`${e.property}:${Q(e.value)}${e.important?"!important":""}`;case"DeclarationList":return oe(e.children,";");case"Value":return oe(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`"${un(e.value)}"`;case"Url":return/[\s"'()\\\u0000-\u001F\u007F]/.test(e.value)?`url("${un(e.value)}")`:`url(${e.value})`;case"Hash":return`#${e.name}`;case"Operator":return e.value;case"Function":return`${e.name}(${oe(e.children,"")})`;case"Parentheses":return`(${oe(e.children,"")})`;case"Brackets":return`[${oe(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?`${Q(e.nth)} of ${Q(e.selector)}`:Q(e.nth);case"MediaQueryList":return oe(e.children,",");case"MediaQuery":return oe(e.children,"");case"MediaFeature":{let t=`(${e.name}`;if(e.value)t+=`:${Q(e.value)}`;return t+=")",t}}return""}function oe(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(Ji(i)||Ji(a)){o=o.next;continue}}let l=Q(s);if(!l){o=o.next;continue}if(!n&&t&&!Su(i))r+=t;n=!1,r+=l,i=s,o=o.next}return r}function Ru(e){let t="",r=null,n=e.head;while(n!=null){let i=n.data,o=Q(i);if(!o){n=n.next;continue}if(r&&ku(r,i))t+=";";t+=o,r=i,n=n.next}return t}function ku(e,t){return e.type==="Declaration"&&t.type!=="Comment"}function Ji(e){if(!e||e.type!=="Operator")return!1;let t=e.value;return t===":"||t===","||t==="/"}function Su(e){if(!e)return!1;return e.type==="Operator"||e.type==="Combinator"}function un(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 We=(()=>{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 fe(e){return e<128&&(We[e]&2)!==0}function Rt(e){return e<128&&(We[e]&4)!==0}function Xi(e){return e>=128||e<128&&(We[e]&8)!==0}function Au(e){return e===45||e>=128||e<128&&(We[e]&10)!==0}function Eu(e){return e>=0&&e<=8||e===11||e>=14&&e<=31||e===127}function dn(e){return e<128&&(We[e]&16)!==0}function Re(e){return e<128&&(We[e]&1)!==0}function Ve(e,t){if(e!==92)return!1;if(dn(t))return!1;return!0}function fn(e,t,r){if(e===45)return Xi(t)||t===45||Ve(t,r);if(Xi(e))return!0;if(e===92)return Ve(e,t);return!1}function Tu(e,t,r){if(e===43||e===45){if(fe(t))return!0;if(t===46&&fe(r))return!0;return!1}if(e===46)return fe(t);return fe(e)}class Bt{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=Nu(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(Re(n)){let s=t;while(t<r&&Re(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&&(Au(e.charCodeAt(t+1))||Ve(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),l=e.charCodeAt(t+2),a=e.charCodeAt(t+3);if(fn(s,l,a)){let c=t;t++,t=this.consumeName(t),this.addToken(3,c,t);continue}this.addToken(9,t,t+1),t++;continue}let i=e.charCodeAt(t+1),o=e.charCodeAt(t+2);if(Tu(n,i,o)){t=this.consumeNumeric(t);continue}if(fn(n,i,o)){t=this.consumeIdentLike(t);continue}if(n===92){if(Ve(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(dn(o))return this.addToken(6,t,i),i;if(o===92){let s=r.charCodeAt(i+1);if(dn(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(Rt(r)){let n=1;e++;while(n<6&&e<t.length&&Rt(t.charCodeAt(e)))e++,n++;if(e<t.length&&Re(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&&(We[i]&10)!==0){n++;continue}if(i===45){n++;continue}if(i>=128){n++;continue}if(i===92&&Ve(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&&fe(t.charCodeAt(r)))r++;if(t.charCodeAt(r)===46&&fe(t.charCodeAt(r+1))){r+=2;while(r<t.length&&fe(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(fe(i)){r+=2;while(r<t.length&&fe(t.charCodeAt(r)))r++}else if((i===43||i===45)&&fe(o)){r+=3;while(r<t.length&&fe(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(fn(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 l=r+1;while(l<t.length&&Re(t.charCodeAt(l)))l++;let a=t.charCodeAt(l);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&&Re(r.charCodeAt(i)))i++;while(i<n){let o=r.charCodeAt(i);if(o===41)return i++,this.addToken(7,e,i),i;if(Re(o)){let s=i;while(i<n&&Re(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||Eu(o))return this.consumeBadUrl(e,i);if(o===92){if(Ve(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&&Ve(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 Nu(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 hn(e,t,r){for(let n=t;n<r;n++)if(e.charCodeAt(n)===92)return Ou(e,t,r,n);return e.slice(t,r)}function Ou(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 l=e.charCodeAt(o+1);if(l===10){o+=2;continue}if(l===13){o+=e.charCodeAt(o+2)===10?3:2;continue}if(Rt(l)){let a=o+1,c="";while(c.length<6&&a<r&&Rt(e.charCodeAt(a)))c+=e[a],a++;let u=Number.parseInt(c,16);if(a<r&&Re(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 gn(e,t,r){for(let n=t;n<r;n++)if(e.charCodeAt(n)===92)return Iu(e,t,r,n);return e.slice(t,r)}function Iu(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 l=o+1,a="";while(a.length<6&&l<r&&Rt(e.charCodeAt(l)))a+=e[l],l++;if(a.length>0){let c=Number.parseInt(a,16);if(l<r&&Re(e.charCodeAt(l)))l++;i+=c===0||c>=55296&&c<=57343||c>1114111?String.fromCodePoint(65533):String.fromCodePoint(c),o=l;continue}if(l<r){i+=e[l],o=l+1;continue}i+=String.fromCodePoint(65533),o=l}return i}function io(e,t){let r=new Bt(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 xe(e,t){return e.source.slice(t.start,t.end)}function de(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 Zi(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 oo(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 Ut(e,t,r,n){return{type:"Raw",value:e,loc:k(n,t,r)}}function te(){return new le}function mn(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 Wt(e,t={}){let r=io(e,t);switch(t.context??"stylesheet"){case"stylesheet":return to(r);case"atrule":return zt(r)??Qi(r);case"atrulePrelude":return Mu(r);case"mediaQuery":case"mediaQueryList":return eo(r);case"rule":return yn(r);case"selectorList":return vn(r);case"selector":return co(r);case"block":return bn(r);case"declarationList":return Du(r);case"declaration":return xn(r)??Qi(r);case"value":return Bu(r);case"raw":return eo(r);default:return to(r)}}function Qi(e){return{type:"StyleSheet",children:te(),loc:oo(e)}}function eo(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 to(e){let t=w(e),r=te(),{types:n,end:i}=e;while(e.pos<i){let l=n[e.pos];if(l===13){e.pos++;continue}if(l===25){let u={type:25,start:e.starts[e.pos],end:e.ends[e.pos]},f=pn(e,u);e.pos++,r.appendData(f);continue}if(l===0)break;if(l===14||l===15){e.pos++;continue}if(l===3){let u=zt(e);if(u)r.appendData(u);continue}if(l===24){e.pos++;continue}let a=e.pos,c=yn(e);if(r.appendData(c),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 pn(e,t){return{type:"Comment",value:e.source.slice(t.start+2,t.end-2),loc:k(e,t,t)}}function zt(e){let t=w(e);if(t.type!==3)return null;e.pos++;let r=Vt(e.source,t.start+1,t.end);de(e);let n=e.pos,i=w(e),{types:o,end:s}=e,l=n,a=n;while(l<s){let f=o[l];if(f===0||f===17||f===23)break;if(f!==13&&f!==25)a=l+1;l++}let c=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},g=e.source.slice(f,d).trim();if(g.length>0)if(e.parseAtrulePrelude)try{let m=e.end;e.end=a,e.pos=n;let p=te();while(x(e)!==0){let y=ze(e);if(y)p.appendData(y)}if(ao(p),e.end=m,e.pos=l,p.isEmpty)c=Ut(g,i,h,e);else c={type:"AtrulePrelude",children:p,loc:null}}catch(m){let p=Ut(g,i,h,e);mn(e,`Failed to parse @${r} prelude: ${m.message}`,i,p),c=p,e.pos=l}else c=Ut(g,i,h,e),e.pos=l;else e.pos=l}else e.pos=l;let u=null;if(x(e)===17)C(e);else if(x(e)===23)u=bn(e,Lu.has(r));return{type:"Atrule",name:r,prelude:c,block:u,loc:k(e,t,w(e))}}var _u=new Set(["is","not","where","has","matches","-moz-any","-webkit-any"]),Lu=new Set(["media","supports","document","layer","container","scope","starting-style","-moz-document","keyframes","-webkit-keyframes","-moz-keyframes","-o-keyframes"]);function Mu(e){let t=w(e),r=te();while(x(e)!==0){if(w(e).type===13){e.pos++;continue}let i=ze(e);if(i)r.appendData(i)}return{type:"AtrulePrelude",children:r,loc:k(e,t,w(e))}}function yn(e){let t=w(e),r;if(e.parseRulePrelude)r=vn(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=Ut(s,i,o,e)}let n=bn(e,!0);return{type:"Rule",prelude:r,block:n,loc:k(e,t,w(e))}}function bn(e,t=!1){let r=w(e);if(x(e)!==23)return{type:"Block",children:te(),loc:oo(e)};e.pos++;let n=te(),{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(pn(e,a));continue}if(s===3){let a=zt(e);if(a)n.appendData(a);continue}if(t&&Fu(e,ju)){let a=yn(e);n.appendData(a);continue}let l=xn(e);if(l)n.appendData(l);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 Fu(e,t){let r=e.pos,n=t(e);return e.pos=r,n}function ju(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 Du(e){let t=w(e),r=te();while(x(e)!==0&&x(e)!==24){let n=w(e);if(n.type===13){e.pos++;continue}if(n.type===25){r.appendData(pn(e,C(e)));continue}if(n.type===17){e.pos++;continue}if(n.type===3){let o=zt(e);if(o)r.appendData(o);continue}let i=xn(e);if(i)r.appendData(i);if(x(e)===17)C(e)}return{type:"DeclarationList",children:r,loc:k(e,t,w(e))}}function xn(e){de(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{mn(e,"Expected property name",t,{type:"Raw",value:"",loc:null});let{types:S,end:j}=e;while(e.pos<j){let K=S[e.pos];if(K===0||K===17||K===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(Zi(e),x(e)!==16){mn(e,`Expected ':' after property "${i}"`,w(e),{type:"Raw",value:"",loc:null});let{types:S,end:j}=e;while(e.pos<j){let K=S[e.pos];if(K===0||K===17||K===24)break;e.pos++}return null}e.pos++,Zi(e);let{types:o,starts:s,end:l,pos:a}=e,c=a,u=a,f=-1,d=-1;while(c<l){let S=o[c];if(S===0||S===17||S===24)break;if(S===9&&e.source.charCodeAt(s[c])===33){let j=c+1;while(j<l&&o[j]===13)j++;if(j<l&&o[j]===1){let K=s[j];if(e.ends[j]-K===9&&(e.source.charCodeAt(K)|32)===105&&(e.source.charCodeAt(K+1)|32)===109&&(e.source.charCodeAt(K+2)|32)===112&&(e.source.charCodeAt(K+3)|32)===111&&(e.source.charCodeAt(K+4)|32)===114&&(e.source.charCodeAt(K+5)|32)===116&&(e.source.charCodeAt(K+6)|32)===97&&(e.source.charCodeAt(K+7)|32)===110&&(e.source.charCodeAt(K+8)|32)===116){d=c,f=j,c=j+1;continue}}}if(S!==13&&S!==25)u=c+1;c++}let h=u,g=f>=0?{type:1,start:s[f],end:e.ends[f]}:null,m=i.startsWith("--"),p,y=s[a],b=h>a?e.ends[h-1]:y,v={type:o[a],start:y,end:e.ends[a]},R=h>a?{type:o[h-1],start:s[h-1],end:b}:v;if(m&&!e.parseCustomProperty||!e.parseValue)p={type:"Raw",value:e.source.slice(y,b).trim(),loc:k(e,v,R)};else if(h===a)p={type:"Value",children:te(),loc:k(e,v,R)};else{let S=e.end;e.end=h,e.pos=a,p=so(e),e.end=S}return e.pos=c,{type:"Declaration",property:i,important:g?!0:!1,value:p,loc:k(e,t,w(e))}}function Bu(e){return so(e)}function so(e){let t=w(e),r=te();while(x(e)!==0&&x(e)!==17&&x(e)!==24&&x(e)!==22&&x(e)!==20){let n=ze(e);if(n)r.appendData(n)}return lo(r),{type:"Value",children:r,loc:k(e,t,w(e))}}function ao(e){for(let t of e)if("children"in t&&t.children instanceof le)ao(t.children);lo(e)}function lo(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 ze(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:ee(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?ee(e,n,i):null};case 10:return e.pos++,{type:"Number",value:o.slice(n,i),loc:e.positions?ee(e,n,i):null};case 11:return e.pos++,{type:"Percentage",value:o.slice(n,i-1),loc:e.positions?ee(e,n,i):null};case 12:{e.pos++;let s=n,l=o.charCodeAt(s);if(l===43||l===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 c=o.charCodeAt(s);if(c===69||c===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?ee(e,n,i):null}}case 1:return e.pos++,{type:"Identifier",name:gn(o,n,i),loc:e.positions?ee(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:hn(o,s,a),loc:e.positions?ee(e,n,i):null}}case 7:{e.pos++;let s=n+4;while(s<i&&ro(o.charCodeAt(s)))s++;let l=i;if(l>s&&o.charCodeAt(l-1)===41)l--;while(l>s&&ro(o.charCodeAt(l-1)))l--;let a;if(l-s>=2){let c=o.charCodeAt(s),u=o.charCodeAt(l-1);if((c===34||c===39)&&c===u)a=o.slice(s+1,l-1);else a=o.slice(s,l)}else a=o.slice(s,l);return{type:"Url",value:a,loc:e.positions?ee(e,n,i):null}}case 4:return e.pos++,{type:"Hash",name:o.slice(n+1,i),loc:e.positions?ee(e,n,i):null};case 2:return Vu(e);case 21:return Wu(e);case 18:return e.pos++,{type:"Operator",value:",",loc:e.positions?ee(e,n,i):null};case 16:return e.pos++,{type:"Operator",value:":",loc:e.positions?ee(e,n,i):null};case 9:{e.pos++;let s=o.charCodeAt(n),l=o[n];if(Uu(s))return{type:"Operator",value:l,loc:e.positions?ee(e,n,i):null};return{type:"Identifier",name:l,loc:e.positions?ee(e,n,i):null}}case 19:{e.pos++;let s=te();while(x(e)!==0&&x(e)!==20){let a=ze(e);if(a)s.appendData(a)}let l=e.pos<e.end?e.ends[e.pos]:i;if(x(e)===20)e.pos++;return{type:"Brackets",children:s,loc:e.positions?ee(e,n,l):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?ee(e,n,i):null}}return e.pos++,null}function ro(e){return e===32||e===9||e===10||e===12||e===13}function Uu(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 Vt(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 ee(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 Vu(e){let t=C(e),r=Vt(e.source,t.start,t.end-1),n=te();while(x(e)!==0&&x(e)!==22){let i=ze(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 Wu(e){let t=C(e),r=te();while(x(e)!==0&&x(e)!==22){let n=ze(e);if(n)r.appendData(n)}if(x(e)===22)C(e);return{type:"Parentheses",children:r,loc:k(e,t,w(e))}}function vn(e){let t=w(e),r=te();while(x(e)!==0){if(de(e),x(e)===0||x(e)===23)break;let n=co(e);if(n.children.head!==null)r.appendData(n);if(de(e),x(e)===18){C(e);continue}break}return{type:"SelectorList",children:r,loc:k(e,t,w(e))}}function co(e){let t=w(e),r=te(),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&&!no(e)&&!zu(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 l=C(e),a={type:"Combinator",name:"||",loc:k(e,s,l)};r.appendData(a),n=!0,de(e);continue}if(no(e)){let s=C(e),a={type:"Combinator",name:e.source[s.start],loc:k(e,s,s)};r.appendData(a),n=!0,de(e);continue}let o=Ku(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 no(e){let t=w(e);if(t.type!==9)return!1;let r=e.source[t.start];return r===">"||r==="+"||r==="~"}function zu(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 Ku(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:`${xe(e,t)}|${xe(e,n)}`,loc:k(e,t,n)}}if(x(e)===9&&e.source[w(e).start]==="*"){let n=C(e);return{type:"TypeSelector",name:`${xe(e,t)}|*`,loc:k(e,t,n)}}}return{type:"TypeSelector",name:xe(e,t),loc:k(e,t,t)}}case 11:return C(e),{type:"TypeSelector",name:xe(e,t),loc:k(e,t,t)};case 10:return C(e),{type:"TypeSelector",name:xe(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:xe(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 Gu(e,r,t)}case 19:return Hu(e)}return null}function Gu(e,t,r){let n=w(e);if(n.type===1){C(e);let i=Vt(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=Vt(e.source,n.start,n.end-1),o=te();if(!t&&_u.has(i)){let a=w(e),c=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}c=C(e)}if(x(e)===22)C(e);let f=e.source.slice(a.start,c.end).trim();if(f.length>0){let d=io(f,{positions:!1}),h=vn(d);o.appendData(h)}}else{while(x(e)!==0&&x(e)!==22){let a=ze(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 Hu(e){let t=C(e);de(e);let r=w(e);if(r.type!==1)return null;C(e);let n={type:"Identifier",name:xe(e,r),loc:k(e,r,r)};de(e);let i=null,o=null,s=null,l=w(e);if(l.type===9){let c=e.source[l.start],u=e.source[l.start+1];if(c==="=")i="=",C(e);else if((c==="~"||c==="|"||c==="^"||c==="$"||c==="*")&&u==="="){C(e);let h=w(e);if(h.type===9&&e.source[h.start]==="=")C(e),i=`${c}=`}de(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:hn(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:xe(e,f),loc:k(e,f,f)};de(e);let d=w(e);if(d.type===1)C(e),s=xe(e,d)}de(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 uo=Symbol("walkSkip"),U=Symbol("walkStop");function qu(e){return{root:e,stylesheet:null,atrule:null,atrulePrelude:null,rule:null,selector:null,block:null,declaration:null,function:null}}function Yu(e,t){let r=qu(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 l(a,c,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 g=n.call(r,a,c,u);if(g===uo){if(f)r[f]=d;return}if(g===U){if(f)r[f]=d;return U}}if(h=Ju(a,s,l),h===U){if(f)r[f]=d;return U}if((o===null||o===a.type)&&i){if(i.call(r,a,c,u)===U){if(f)r[f]=d;return U}}if(f)r[f]=d;return}return l(e,null,null)}var Ke=Object.assign(Yu,{skip:uo,stop:U});function Ju(e,t,r){if("children"in e&&e.children instanceof le)return Xu(e.children,t,r);if(e.type==="Rule"){if(r(e.prelude,null,null)===U)return U;if(r(e.block,null,null)===U)return U;return}if(e.type==="Atrule"){if(e.prelude){if(r(e.prelude,null,null)===U)return U}if(e.block){if(r(e.block,null,null)===U)return U}return}if(e.type==="Declaration")return r(e.value,null,null);if(e.type==="AttributeSelector"){if(r(e.name,null,null)===U)return U;if(e.value)return r(e.value,null,null);return}return}function Xu(e,t,r){let n;if(t)e.forEachRight((i,o,s)=>{if(n)return;if(r(i,o,s)===U)n=U});else e.forEach((i,o,s)=>{if(n)return;if(r(i,o,s)===U)n=U});return n}function et(e,t={}){let r=t.exclamation??!1,n=!1;Ke(e,(i,o,s)=>{if(i.type!=="Comment")return;let l=i.value.startsWith("!");if(r===!0&&l)return;if(r==="first-exclamation"&&l&&!n){n=!0;return}if(o&&s)s.remove(o)})}function Kt(e){Ke(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 l=n;l!=null;l=l.next)if(l.data.type==="Declaration"){if(i++,i>=2)break}if(i<2)return;let o=new Map,s=[];for(let l=n;l!=null;l=l.next){let a=l.data;if(a.type!=="Declaration")continue;let c=a.property,u=o.get(c);if(u){let f=!!u.decl.important,d=!!a.important;if(d||f===d)s.push(u.item),o.set(c,{item:l,decl:a});else s.push(l)}else o.set(c,{item:l,decl:a})}for(let l of s)r.remove(l)})}var Zu={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"},Qu={"#f00":"red","#ff0000":"red","#000080":"navy","#008080":"teal"};function $n(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 fo(e){let t=e.toLowerCase();return Zu[t]??null}function ho(e){let t=e.toLowerCase();return Qu[t]??null}function ef(e,t,r){let n=(e<<16|t<<8|r).toString(16).padStart(6,"0");return $n(`#${n}`)}var tf=/^rgba?\(\s*([+-]?\d*\.?\d+%?)\s*[,\s]\s*([+-]?\d*\.?\d+%?)\s*[,\s]\s*([+-]?\d*\.?\d+%?)\s*(?:[,/]\s*([+-]?\d*\.?\d+%?)\s*)?\)$/;function go(e){let t=tf.exec(e.trim());if(!t)return e;let r=wn(t[1]),n=wn(t[2]),i=wn(t[3]);if(t[4]!==void 0&&!rf(t[4]))return e;return ef(r,n,i)}function rf(e){if(e.endsWith("%"))return Number.parseFloat(e)>=100;return Number.parseFloat(e)>=1}function wn(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 nf=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 Gt(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 mo(e,t){let r=Gt(e);if((r==="0"||r==="-0")&&nf.has(t.toLowerCase()))return{value:"0",unit:""};return{value:r,unit:t}}function po(e){return Gt(e)}function yo(e,t){let r=Number.parseFloat(e);if(!Number.isFinite(r))return e;let n=t<0?0:t;return r.toFixed(n)}var bo=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 xo(e){if(!e||e.type!=="Operator")return!1;let t=e.value;return t===":"||t===","||t==="/"}function of(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&&xo(r.prev.data),o=n&&xo(n.data);if(i||o)t.remove(r)}r=n}}function Cn(e,t={}){let r=t.floatPrecision??null,n=r===null?null:(i)=>yo(i,r);Ke(e,{enter(i,o,s){switch(i.type){case"Number":{let l=n?n(i.value):i.value;i.value=Gt(l);return}case"Percentage":{let l=n?n(i.value):i.value;i.value=po(l);return}case"Dimension":{let l=n?n(i.value):i.value,a=mo(l,i.unit);i.value=a.value,i.unit=a.unit;return}case"Hash":{let l=$n(`#${i.name}`).slice(1);if(i.name=l,o&&s&&this.declaration&&bo.has(this.declaration.property.toLowerCase())){let a=ho(`#${l}`);if(a&&a.length<l.length+1){let c={type:"Identifier",name:a,loc:i.loc};s.replace(o,s.createItem(c))}}return}case"Identifier":{if(!o||!s||!this.declaration)return;if(!bo.has(this.declaration.property.toLowerCase()))return;let l=fo(i.name);if(l&&l.length<i.name.length){let a={type:"Hash",name:l.slice(1),loc:i.loc};s.replace(o,s.createItem(a))}return}case"Url":return;case"Function":{let l=i.name.toLowerCase();if((l==="rgb"||l==="rgba")&&o&&s)i.__rgbReplaceCandidate=!0}}},leave(i,o,s){if(i.type==="Parentheses"||i.type==="Function"||i.type==="Value")of(i);if(i.type==="Function"&&i.__rgbReplaceCandidate&&o&&s){let l=Q(i),a=go(l);if(a!==l&&a.startsWith("#")){let c={type:"Hash",name:a.slice(1),loc:i.loc};s.replace(o,s.createItem(c))}}}})}function sf(e,t={}){let r=Wt(e,{context:"stylesheet"});return vo(r,t)}function Rn(e,t={}){let r=Wt(e,{context:"declarationList"});return vo(r,t)}function vo(e,t){if(t.comments===!1)et(e,{exclamation:!1});else if(t.comments==="first-exclamation")et(e,{exclamation:"first-exclamation"});else et(e,{exclamation:!0});return Cn(e,{floatPrecision:t.floatPrecision??null}),Kt(e),{css:Q(e),ast:e}}function Le(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 wo=new Map,_e=new Map;var kn={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"},cf=/[%#()]/,uf=/^\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"],ff=new Set(Eo);function se(e){return cf.test(e)||uf.test(e)}function $o(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 c=e.slice(a,o);if(ff.has(c))r.unshift(!0);else if(r[0]&&c==="")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(),c=a.charCodeAt(a.length-1),u=a.charCodeAt(a.length-2),f=e.charCodeAt(o+1),d=c===43||c===45||c===42||c===47,h=f===43||f===45||f===42||f===47;if((c===101||c===69)&&u>=48&&u<=57)t+=e[o];else if(d||c===40||c===44)t+=e[o];else if(e.charCodeAt(o-1)===32)t+=`${e[o]} `;else if(c>=48&&c<=57||f>=48&&f<=57||c===41||f===40||h||i!==null&&i===o-1)t+=` ${e[o]} `;else t+=e[o];continue}t+=e[o]}return t}function Ht(e){if(!e.includes("_"))return $o(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 $o(t)}function Co(e,t){if(t.length!==2)return null;let[r,n]=t;if(r!=="min"&&r!=="max")return null;return[se(n)?`${r}-${e}-[${n}]`:`${r}-${e}-${n}`]}var df={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(se(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(se(r))return`w-[${r}]`;return`w-${r}`},multiValue:(e)=>Co("w",e)},h:{expand:(e,t)=>{let r=t[e]||e;if(se(r))return`h-[${r}]`;return`h-${r}`},multiValue:(e)=>Co("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(se(r))return`inset-[${r}]`;return`inset-${r}`}},top:{expand:(e)=>se(e)?`top-[${e}]`:`top-${e}`},right:{expand:(e)=>se(e)?`right-[${e}]`:`right-${e}`},bottom:{expand:(e)=>se(e)?`bottom-[${e}]`:`bottom-${e}`},left:{expand:(e)=>se(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)=>se(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)=>se(e)?`backdrop-hue-rotate-[${e}]`:`backdrop-hue-rotate-${e}`},animate:{expand:(e)=>`animate-${e}`},"forced-colors":{expand:(e)=>`forced-colors-${e}`}},kt=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","only-of-type","checked","indeterminate","default","required","valid","invalid","in-range","out-of-range","placeholder-shown","autofill","read-only","user-valid","user-invalid","inert","empty","before","after","selection","marker","file","first-letter","first-line","backdrop","details-content","print","motion-safe","motion-reduce","pointer-none","pointer-coarse","pointer-fine","any-pointer-none","any-pointer-coarse","any-pointer-fine","inverted-colors","noscript","starting","contrast-more","contrast-less","rtl","ltr","portrait","landscape","@sm","@md","@lg","@xl","@2xl"]),Ro=new WeakMap,ko=new WeakMap;function hf(e){if(!e)return kn;let t=Ro.get(e);if(!t)t=e.aliases?{...kn,...e.aliases}:kn,Ro.set(e,t);return t}function gf(e){if(!e?.aliases)return"";let t=ko.get(e);if(t===void 0)t=JSON.stringify(e.aliases),ko.set(e,t);return t}function St(e){let t=[],r="",n=0;for(let i=0;i<e.length;i++){let o=e[i];if(o==="[")n++;else if(o==="]")n--;if(o===":"&&n===0)t.push(r),r="";else r+=o}return t.push(r),t}function mf(e,t){let r=`${e}:${t?.colonSyntax}:${gf(t)}`,n=_e.get(r);if(n)return n;let i=hf(t);if(t?.colonSyntax===!0){let m=e.match(/^([a-z][a-z0-9-]*):([^[\]:]+)$/i);if(m){let[,p,y]=m;if(!kt.has(p)){if(se(y)){let v=[`${p}-[${y}]`];return Le(_e,r,v),v}let b=y.startsWith("-")?[`-${p}-${y.slice(1)}`]:[`${p}-${y}`];return Le(_e,r,b),b}}}let o="",s=e,l=!1;if(s.startsWith("-"))l=!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)=>kt.has(y)))o=a[1],s=a[2]}let c=s.match(/^([a-z][a-z0-9-]*)\[([^\]]*)\]$/i);if(!c||s.includes("-[")){let m=[e];return Le(_e,r,m),m}let[,u,f]=c,d=f.split(/\s+/).filter(Boolean);if(d.length===0)return Le(_e,r,[]),[];let h=df[u.toLowerCase()];if(h?.multiValue){let m=h.multiValue(d,i);if(m){let p=m.map((y)=>`${o}${l?"-":""}${y}`);return Le(_e,r,p),p}}if(!h){let m=[];for(let p of d){let y=p.match(/^([a-z@][a-z0-9-]*):(.+)$/i),b="",v=p;if(y&&kt.has(y[1]))b=`${y[1]}:`,v=y[2];let R="";if(v.startsWith("-"))R="-",v=v.slice(1);let S="";if(v.endsWith("!"))S="!",v=v.slice(0,-1);let j=l?"-":"";if(se(v))m.push(`${o}${b}${S}${j}${R}${u}-[${v}]`);else m.push(`${o}${b}${S}${j}${R}${u}-${v}`)}return Le(_e,r,m),m}let g=[];for(let m of d){let p=m.match(/^([a-z@][a-z0-9-]*):(.+)$/i),y="",b=m;if(p&&kt.has(p[1]))y=`${p[1]}:`,b=p[2];let v="";if(b.startsWith("-"))v="-",b=b.slice(1);let R="";if(b.endsWith("!"))R="!",b=b.slice(0,-1);let S=h.expand(b,i);if(S){let j=l?"-":"";g.push(`${o}${y}${R}${j}${v}${S}`)}}return Le(_e,r,g),g}function pf(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=(c)=>{let u=c.includes(":")?c.split(":").pop():c;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},l=/<([a-z][a-z0-9-]*)\s([^>]*)>/gi,a;while((a=l.exec(e))!==null){let c=a[2],u=/([a-z][a-z0-9-:]*)(?:=["']([^"']*)["'])?(?=\s|$|\/?>)/gi,f;while((f=u.exec(c))!==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 g="",m=d,p=d.match(/^((?:[a-z@][a-z0-9-]*:)+)([a-z][a-z0-9-]*)$/i);if(p){if(p[1].slice(0,-1).split(":").every((v)=>kt.has(v)))g=p[1],m=p[2]}if(h!==void 0){let y=h.split(/\s+/).filter(Boolean);for(let b of y){let v=`${g}${m}-${b}`;if(So(v.replace(/^(?:[a-z@][a-z0-9-]*:)+/gi,"")))r.add(v)}}else{let y=`${g}${m}`;if(So(m))r.add(y)}}}return r}function So(e){if(!e||e.length===0)return!1;return/^[a-z][a-z0-9-/]*(?:-\[[^\]]+\])?$/i.test(e)}function Sn(e){let t=wo.get(e);if(t)return t;let r=wf(e);return r.base=vf(r),Le(wo,e,r),r}var yf=new Set(["bg","text","border","ring","placeholder","divide","accent","caret","fill","stroke","outline","decoration","shadow","ring-offset","from","via","to"]),bf=/^(.+?)\/(\d+|\[\d*\.?\d+\])$/,xf=/^(\d+)\/(\d+)$/;function Ao(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 vf(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 wf(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 h=St(r),g=h[h.length-1],m=!1;if(g.charCodeAt(0)===33&&g.length>1)m=!0,g=g.slice(1);let p=g.match(/^\[([a-z-]+):(.+)\]$/);if(p)return{raw:e,variants:h.slice(0,-1),utility:p[1],value:Ht(p[2]),important:t||m,arbitrary:!0}}let n=r.match(/^((?:[a-z-]+:)*)(-?[a-z-]+?)-\[([^\]]+)\]\/\[([^\]]+)\]$/);if(n){let[,h,g,m,p]=n,y=h?h.split(":").filter(Boolean):[],b=g.startsWith("-"),v=b?g.slice(1):g,R=Ht(m);if(b)R=R.startsWith("-")?R:`-${R}`;return{raw:e,variants:y,utility:v,value:`${R}/${p}`,important:t,arbitrary:!0,modifierArbitrary:!0}}let i=r.match(/^((?:[a-z-]+:)*)(-?[a-z-]+?)-\[(.+)\]$/);if(i){let h=i[1],g=h?h.split(":").filter(Boolean):[],m=i[2],p=m.startsWith("-");if(p)m=m.slice(1);let y=Ht(i[3]),b,v=y.match(/^(color|length|url|number|percentage|position|line-width|absolute-size|relative-size|image|angle|time|flex|string|family-name):(.*)/i);if(v)b=v[1].toLowerCase(),y=v[2];if(p)y=y.startsWith("-")?y:`-${y}`;return{raw:e,variants:g,utility:m,value:y,important:t,arbitrary:!0,typeHint:b}}let o=St(r),s=o[o.length-1],l=o.slice(0,-1);if(s.startsWith("!")&&s.length>1)t=!0,s=s.slice(1);else if(s.endsWith("!")&&s.length>1)t=!0,s=s.slice(0,-1);if(l.length>0)r=`${l.join(":")}:${s}`;else r=s;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(s))return{raw:e,variants:l,utility:s,value:void 0,important:t,arbitrary:!1};let c=s.match(/^([a-z-]+?)-\[(.+?)\]$/);if(c){let h=Ht(c[2]),g,m=h.match(/^(color|length|url|number|percentage|position|line-width|absolute-size|relative-size|image|angle|time|flex|string|family-name):(.*)/i);if(m)g=m[1].toLowerCase(),h=m[2];return{raw:e,variants:l,utility:c[1],value:h,important:t,arbitrary:!0,typeHint:g}}let u=["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(s==="divide-x"||s==="divide-y")return{raw:e,variants:l,utility:s,value:void 0,important:t,arbitrary:!1};let f=s.match(/^(divide-[xy])-(.+)$/);if(f)return{raw:e,variants:l,utility:f[1],value:f[2],important:t,arbitrary:!1};for(let h of u)if(s.startsWith(`${h}-`))return{raw:e,variants:l,utility:h,value:s.slice(h.length+1),important:t,arbitrary:!1};if(s.startsWith("-")){let h=s.slice(1);for(let m of u)if(h.startsWith(`${m}-`))return{raw:e,variants:l,utility:m,value:`-${h.slice(m.length+1)}`,important:t,arbitrary:!1};let g=Ao(h);if(g)return{raw:e,variants:l,utility:g[0],value:`-${g[1]}`,important:t,arbitrary:!1};return{raw:e,variants:l,utility:h,value:void 0,important:t,arbitrary:!1}}let d=Ao(s);if(d){let[h,g]=d,m=g.match(bf);if(m&&yf.has(h))return{raw:e,variants:l,utility:h,value:`${m[1]}/${m[2]}`,important:t,arbitrary:!1};let p=g.match(xf);if(p)return{raw:e,variants:l,utility:h,value:`${p[1]}/${p[2]}`,important:t,arbitrary:!1};return{raw:e,variants:l,utility:h,value:g,important:t,arbitrary:!1}}return{raw:e,variants:l,utility:s,value:void 0,important:t,arbitrary:!1}}function $f(e){return/^\[[a-z-]+:[^\]]+\]$/i.test(e)}function Cf(e){if(!e)return!1;if(e==="*"||e==="**")return!0;if(e.startsWith("[")&&e.endsWith("]"))return e.length>2;return/^(?:@[a-z0-9]|[a-z]|\d+[a-z])[a-z0-9.-]*(?:\[[^\]]+\])?(?:\/[\w-]+)?$/i.test(e)}function Rf(e,t){let r=e;if(r.startsWith("!"))r=r.slice(1);if(r.endsWith("!"))r=r.slice(0,-1);if(!r)return!1;if($f(r))return!0;if(t?.enabled&&/^[a-z]+\[[^\]]+\]$/i.test(r))return!0;return/^[-@]?[a-z][a-z0-9.-]*(?:-\[[^\]]+\])?(?:\/(?:[\w.]+|[\w-]+|\[[^\]]+\]))?$/i.test(r)}function To(e,t){if(!e||e.length===0)return!1;if(t?.colonSyntax&&/^[a-z]+:[^[\]:]+$/i.test(e))return!0;let r=e;if(r.startsWith("!"))r=r.slice(1);if(r.endsWith("!"))r=r.slice(0,-1);if(!r)return!1;let n=St(r);for(let i=0;i<n.length-1;i++)if(!Cf(n[i]))return!1;return Rf(n[n.length-1],t)}function Yt(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 l=s[1],a=l.match(/["']([^"']+)["']/g);if(a)for(let f of a){let d=f.replace(/["']/g,""),h=Yt(d);for(let g of h)qt(r,g,t)}let c=l.replace(/["'`]/g," ").replace(/\$\{[^}]+\}/g," "),u=Yt(c).filter((f)=>To(f,t?.bracketSyntax));for(let f of u)qt(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 l=s[1].match(/["'`]([^"'`]*)["'`]/g);if(l)for(let a of l){let c=a.replace(/["'`]/g,"").replace(/\$\{[^}]+\}/g," ");for(let u of Yt(c))qt(r,u,t)}}}if(t?.codeStrings?.enabled!==!1)for(let o of No(e,t?.bracketSyntax))qt(r,o,t);if(t?.attributify?.enabled){let o=pf(e,t.attributify);for(let s of o)r.add(s)}return r}function kf(e,t){if(!/[-:/[]/.test(e))return!1;if(e.startsWith("-")&&!/^-[a-z]/i.test(e))return!1;return To(e,t)}function No(e,t){let r=new Set,n=e.length,i=0,o=/[<>]/g,s=o.exec(e),l=-1,a=-1,c="";while(i<n){let u=e[i];if(u==="/"&&e[i+1]==="/"){let p=e.indexOf(`
92
+ `,i);i=p===-1?n:p;continue}if(u==="/"&&e[i+1]==="*"){let p=e.indexOf("*/",i+2);i=p===-1?n:p+2;continue}if(u==="/"&&(!/[\w$)\]]/.test(c)||Af(e,i))){let p=Ef(e,i);if(p!==-1){i=p,c=")";continue}}if(u!=='"'&&u!=="'"&&u!=="`"){if(!/\s/.test(u))c=u;i++;continue}c=")";while(s&&s.index<i){if(s[0]==="<")l=s.index;else a=s.index;s=o.exec(e)}let f=Nf(e,i,l,a),d=u==="`",h=i+1,g="",m=!1;while(h<n){let p=e[h];if(p==="\\"){g+=e[h+1]??"",h+=2;continue}if(p===u){m=!0,h++;break}if(!d&&p===`
93
+ `)break;if(d&&p==="$"&&e[h+1]==="{"){let y=1;h+=2;let b=h;while(h<n&&y>0){if(e[h]==="{")y++;else if(e[h]==="}")y--;h++}for(let v of No(e.slice(b,h-1),t))r.add(v);g+=" ";continue}g+=p,h++}if(m){if(f){for(let p of g.match(Tf)??[])r.add(p);i=h;continue}for(let p of Yt(g))if(kf(p,t))r.add(p);i=h}else i++}return r}var Sf=new Set(["return","typeof","case","in","of","delete","void","throw","new","else","do","yield","await","instanceof"]);function Af(e,t){let r=t;while(r>0&&/\s/.test(e[r-1]))r--;let n=r;while(n>0&&/[\w$]/.test(e[n-1]))n--;if(n===r||!Sf.has(e.slice(n,r)))return!1;let i=n;while(i>0&&/\s/.test(e[i-1]))i--;return e[i-1]!=="."}function Ef(e,t){let r=!1;for(let n=t+1;n<e.length;n++){let i=e[n];if(i===`
94
+ `)return-1;if(i==="\\"){n++;continue}if(i==="[")r=!0;else if(i==="]")r=!1;else if(i==="/"&&!r){let o=n+1;while(o<e.length&&/[a-z]/i.test(e[o]))o++;return o}}return-1}var Tf=/(?<![\w-])i-[a-z0-9]+(?:-[a-z0-9]+)+(?![\w-])/gi;function Nf(e,t,r,n){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 qt(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=mf(t,r.bracketSyntax);for(let s of o)e.add(s);return}}e.add(t)}var Xt={getCSS:()=>`
95
95
  /*
96
96
  ! Tailwind CSS Preflight | MIT License | https://tailwindcss.com
97
97
  */
@@ -354,10 +354,10 @@ video {
354
354
  [hidden] {
355
355
  display: none;
356
356
  }
357
- `.trim()};var ht={content:["./src/**/*.{html,js,ts,jsx,tsx,stx}"],output:"./dist/styles.css",minify:!0,watch:!1,theme:{colors:{inherit:"inherit",current:"currentColor",transparent:"transparent",black:"#000",white:"#fff",slate:{50:"oklch(98.4% 0.003 247.858)",100:"oklch(96.8% 0.007 247.896)",200:"oklch(92.9% 0.013 255.508)",300:"oklch(86.9% 0.022 252.894)",400:"oklch(70.4% 0.04 256.788)",500:"oklch(55.4% 0.046 257.417)",600:"oklch(44.6% 0.043 257.281)",700:"oklch(37.2% 0.044 257.287)",800:"oklch(27.9% 0.041 260.031)",900:"oklch(20.8% 0.042 265.755)",950:"oklch(12.9% 0.042 264.695)"},gray:{50:"oklch(98.5% 0.002 247.839)",100:"oklch(96.7% 0.003 264.542)",200:"oklch(92.8% 0.006 264.531)",300:"oklch(87.2% 0.01 258.338)",400:"oklch(70.7% 0.022 261.325)",500:"oklch(55.1% 0.027 264.364)",600:"oklch(44.6% 0.03 256.802)",700:"oklch(37.3% 0.034 259.733)",800:"oklch(27.8% 0.033 256.848)",900:"oklch(21% 0.034 264.665)",950:"oklch(13% 0.028 261.692)"},zinc:{50:"oklch(98.5% 0 0)",100:"oklch(96.7% 0.001 286.375)",200:"oklch(92% 0.004 286.32)",300:"oklch(87.1% 0.006 286.286)",400:"oklch(70.5% 0.015 286.067)",500:"oklch(55.2% 0.016 285.938)",600:"oklch(44.2% 0.017 285.786)",700:"oklch(37% 0.013 285.805)",800:"oklch(27.4% 0.006 286.033)",900:"oklch(21% 0.006 285.885)",950:"oklch(14.1% 0.005 285.823)"},neutral:{50:"oklch(98.5% 0 0)",100:"oklch(97% 0 0)",200:"oklch(92.2% 0 0)",300:"oklch(87% 0 0)",400:"oklch(70.8% 0 0)",500:"oklch(55.6% 0 0)",600:"oklch(43.9% 0 0)",700:"oklch(37.1% 0 0)",800:"oklch(26.9% 0 0)",900:"oklch(20.5% 0 0)",950:"oklch(14.5% 0 0)"},stone:{50:"oklch(98.5% 0.001 106.423)",100:"oklch(97% 0.001 106.424)",200:"oklch(92.3% 0.003 48.717)",300:"oklch(86.9% 0.005 56.366)",400:"oklch(70.9% 0.01 56.259)",500:"oklch(55.3% 0.013 58.071)",600:"oklch(44.4% 0.011 73.639)",700:"oklch(37.4% 0.01 67.558)",800:"oklch(26.8% 0.007 34.298)",900:"oklch(21.6% 0.006 56.043)",950:"oklch(14.7% 0.004 49.25)"},red:{50:"oklch(97.1% 0.013 17.38)",100:"oklch(93.6% 0.032 17.717)",200:"oklch(88.5% 0.062 18.334)",300:"oklch(80.8% 0.114 19.571)",400:"oklch(70.4% 0.191 22.216)",500:"oklch(63.7% 0.237 25.331)",600:"oklch(57.7% 0.245 27.325)",700:"oklch(50.5% 0.213 27.518)",800:"oklch(44.4% 0.177 26.899)",900:"oklch(39.6% 0.141 25.723)",950:"oklch(25.8% 0.092 26.042)"},orange:{50:"oklch(98% 0.016 73.684)",100:"oklch(95.4% 0.038 75.164)",200:"oklch(90.1% 0.076 70.697)",300:"oklch(83.7% 0.128 66.29)",400:"oklch(75% 0.183 55.934)",500:"oklch(70.5% 0.213 47.604)",600:"oklch(64.6% 0.222 41.116)",700:"oklch(55.3% 0.195 38.402)",800:"oklch(47% 0.157 37.304)",900:"oklch(40.8% 0.123 38.172)",950:"oklch(26.6% 0.079 36.259)"},amber:{50:"oklch(98.7% 0.022 95.277)",100:"oklch(96.2% 0.059 95.617)",200:"oklch(92.4% 0.12 95.746)",300:"oklch(87.9% 0.169 91.605)",400:"oklch(82.8% 0.189 84.429)",500:"oklch(76.9% 0.188 70.08)",600:"oklch(66.6% 0.179 58.318)",700:"oklch(55.5% 0.163 48.998)",800:"oklch(47.3% 0.137 46.201)",900:"oklch(41.4% 0.112 45.904)",950:"oklch(27.9% 0.077 45.635)"},yellow:{50:"oklch(98.7% 0.026 102.212)",100:"oklch(97.3% 0.071 103.193)",200:"oklch(94.5% 0.129 101.54)",300:"oklch(90.5% 0.182 98.111)",400:"oklch(85.2% 0.199 91.936)",500:"oklch(79.5% 0.184 86.047)",600:"oklch(68.1% 0.162 75.834)",700:"oklch(55.4% 0.135 66.442)",800:"oklch(47.6% 0.114 61.907)",900:"oklch(42.1% 0.095 57.708)",950:"oklch(28.6% 0.066 53.813)"},lime:{50:"oklch(98.6% 0.031 120.757)",100:"oklch(96.7% 0.067 122.328)",200:"oklch(93.8% 0.127 124.321)",300:"oklch(89.7% 0.196 126.665)",400:"oklch(84.1% 0.238 128.85)",500:"oklch(76.8% 0.233 130.85)",600:"oklch(64.8% 0.2 131.684)",700:"oklch(53.2% 0.157 131.589)",800:"oklch(45.3% 0.124 130.933)",900:"oklch(40.5% 0.101 131.063)",950:"oklch(27.4% 0.072 132.109)"},green:{50:"oklch(98.2% 0.018 155.826)",100:"oklch(96.2% 0.044 156.743)",200:"oklch(92.5% 0.084 155.995)",300:"oklch(87.1% 0.15 154.449)",400:"oklch(79.2% 0.209 151.711)",500:"oklch(72.3% 0.219 149.579)",600:"oklch(62.7% 0.194 149.214)",700:"oklch(52.7% 0.154 150.069)",800:"oklch(44.8% 0.119 151.328)",900:"oklch(39.3% 0.095 152.535)",950:"oklch(26.6% 0.065 152.934)"},emerald:{50:"oklch(97.9% 0.021 166.113)",100:"oklch(95% 0.052 163.051)",200:"oklch(90.5% 0.093 164.15)",300:"oklch(84.5% 0.143 164.978)",400:"oklch(76.5% 0.177 163.223)",500:"oklch(69.6% 0.17 162.48)",600:"oklch(59.6% 0.145 163.225)",700:"oklch(50.8% 0.118 165.612)",800:"oklch(43.2% 0.095 166.913)",900:"oklch(37.8% 0.077 168.94)",950:"oklch(26.2% 0.051 172.552)"},teal:{50:"oklch(98.4% 0.014 180.72)",100:"oklch(95.3% 0.051 180.801)",200:"oklch(91% 0.096 180.426)",300:"oklch(85.5% 0.138 181.071)",400:"oklch(77.7% 0.152 181.912)",500:"oklch(70.4% 0.14 182.503)",600:"oklch(60% 0.118 184.704)",700:"oklch(51.1% 0.096 186.391)",800:"oklch(43.7% 0.078 188.216)",900:"oklch(38.6% 0.063 188.416)",950:"oklch(27.7% 0.046 192.524)"},cyan:{50:"oklch(98.4% 0.019 200.873)",100:"oklch(95.6% 0.045 203.388)",200:"oklch(91.7% 0.08 205.041)",300:"oklch(86.5% 0.127 207.078)",400:"oklch(78.9% 0.154 211.53)",500:"oklch(71.5% 0.143 215.221)",600:"oklch(60.9% 0.126 221.723)",700:"oklch(52% 0.105 223.128)",800:"oklch(45% 0.085 224.283)",900:"oklch(39.8% 0.07 227.392)",950:"oklch(30.2% 0.056 229.695)"},sky:{50:"oklch(97.7% 0.013 236.62)",100:"oklch(95.1% 0.026 236.824)",200:"oklch(90.1% 0.058 230.902)",300:"oklch(82.8% 0.111 230.318)",400:"oklch(74.6% 0.16 232.661)",500:"oklch(68.5% 0.169 237.323)",600:"oklch(58.8% 0.158 241.966)",700:"oklch(50% 0.134 242.749)",800:"oklch(44.3% 0.11 240.79)",900:"oklch(39.1% 0.09 240.876)",950:"oklch(29.3% 0.066 243.157)"},blue:{50:"oklch(97% 0.014 254.604)",100:"oklch(93.2% 0.032 255.585)",200:"oklch(88.2% 0.059 254.128)",300:"oklch(80.9% 0.105 251.813)",400:"oklch(70.7% 0.165 254.624)",500:"oklch(62.3% 0.214 259.815)",600:"oklch(54.6% 0.245 262.881)",700:"oklch(48.8% 0.243 264.376)",800:"oklch(42.4% 0.199 265.638)",900:"oklch(37.9% 0.146 265.522)",950:"oklch(28.2% 0.091 267.935)"},indigo:{50:"oklch(96.2% 0.018 272.314)",100:"oklch(93% 0.034 272.788)",200:"oklch(87% 0.065 274.039)",300:"oklch(78.5% 0.115 274.713)",400:"oklch(67.3% 0.182 276.935)",500:"oklch(58.5% 0.233 277.117)",600:"oklch(51.1% 0.262 276.966)",700:"oklch(45.7% 0.24 277.023)",800:"oklch(39.8% 0.195 277.366)",900:"oklch(35.9% 0.144 278.697)",950:"oklch(25.7% 0.09 281.288)"},violet:{50:"oklch(96.9% 0.016 293.756)",100:"oklch(94.3% 0.029 294.588)",200:"oklch(89.4% 0.057 293.283)",300:"oklch(81.1% 0.111 293.571)",400:"oklch(70.2% 0.183 293.541)",500:"oklch(60.6% 0.25 292.717)",600:"oklch(54.1% 0.281 293.009)",700:"oklch(49.1% 0.27 292.581)",800:"oklch(43.2% 0.232 292.759)",900:"oklch(38% 0.189 293.745)",950:"oklch(28.3% 0.141 291.089)"},purple:{50:"oklch(97.7% 0.014 308.299)",100:"oklch(94.6% 0.033 307.174)",200:"oklch(90.2% 0.063 306.703)",300:"oklch(82.7% 0.119 306.383)",400:"oklch(71.4% 0.203 305.504)",500:"oklch(62.7% 0.265 303.9)",600:"oklch(55.8% 0.288 302.321)",700:"oklch(49.6% 0.265 301.924)",800:"oklch(43.8% 0.218 303.724)",900:"oklch(38.1% 0.176 304.987)",950:"oklch(29.1% 0.149 302.717)"},fuchsia:{50:"oklch(97.7% 0.017 320.058)",100:"oklch(95.2% 0.037 318.852)",200:"oklch(90.3% 0.076 319.62)",300:"oklch(83.3% 0.145 321.434)",400:"oklch(74% 0.238 322.16)",500:"oklch(66.7% 0.295 322.15)",600:"oklch(59.1% 0.293 322.896)",700:"oklch(51.8% 0.253 323.949)",800:"oklch(45.2% 0.211 324.591)",900:"oklch(40.1% 0.17 325.612)",950:"oklch(29.3% 0.136 325.661)"},pink:{50:"oklch(97.1% 0.014 343.198)",100:"oklch(94.8% 0.028 342.258)",200:"oklch(89.9% 0.061 343.231)",300:"oklch(82.3% 0.12 346.018)",400:"oklch(71.8% 0.202 349.761)",500:"oklch(65.6% 0.241 354.308)",600:"oklch(59.2% 0.249 0.584)",700:"oklch(52.5% 0.223 3.958)",800:"oklch(45.9% 0.187 3.815)",900:"oklch(40.8% 0.153 2.432)",950:"oklch(28.4% 0.109 3.907)"},rose:{50:"oklch(96.9% 0.015 12.422)",100:"oklch(94.1% 0.03 12.58)",200:"oklch(89.2% 0.058 10.001)",300:"oklch(81% 0.117 11.638)",400:"oklch(71.2% 0.194 13.428)",500:"oklch(64.5% 0.246 16.439)",600:"oklch(58.6% 0.253 17.585)",700:"oklch(51.4% 0.222 16.935)",800:"oklch(45.5% 0.188 13.697)",900:"oklch(41% 0.159 10.272)",950:"oklch(27.1% 0.105 12.094)"}},spacing:{0:"0",px:"1px",0.5:"0.125rem",1:"0.25rem",1.5:"0.375rem",2:"0.5rem",2.5:"0.625rem",3:"0.75rem",3.5:"0.875rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem",11:"2.75rem",12:"3rem",14:"3.5rem",16:"4rem",20:"5rem",24:"6rem",28:"7rem",32:"8rem",36:"9rem",40:"10rem",44:"11rem",48:"12rem",52:"13rem",56:"14rem",60:"15rem",64:"16rem",72:"18rem",80:"20rem",96:"24rem"},fontSize:{xs:["0.75rem",{lineHeight:"1rem"}],sm:["0.875rem",{lineHeight:"1.25rem"}],base:["1rem",{lineHeight:"1.5rem"}],lg:["1.125rem",{lineHeight:"1.75rem"}],xl:["1.25rem",{lineHeight:"1.75rem"}],"2xl":["1.5rem",{lineHeight:"2rem"}],"3xl":["1.875rem",{lineHeight:"2.25rem"}],"4xl":["2.25rem",{lineHeight:"2.5rem"}],"5xl":["3rem",{lineHeight:"1"}],"6xl":["3.75rem",{lineHeight:"1"}],"7xl":["4.5rem",{lineHeight:"1"}],"8xl":["6rem",{lineHeight:"1"}],"9xl":["8rem",{lineHeight:"1"}]},fontFamily:{sans:["ui-sans-serif","system-ui","sans-serif"],serif:["ui-serif","Georgia","serif"],mono:["ui-monospace","monospace"]},screens:{sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},containers:{"3xs":"16rem","2xs":"18rem",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem"},borderRadius:{none:"0",xs:"0.125rem",sm:"0.25rem",DEFAULT:"0.25rem",md:"0.375rem",lg:"0.5rem",xl:"0.75rem","2xl":"1rem","3xl":"1.5rem","4xl":"2rem",full:"9999px"},boxShadow:{"2xs":"0 1px rgb(0 0 0 / 0.05)",xs:"0 1px 2px 0 rgb(0 0 0 / 0.05)",sm:"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",DEFAULT:"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",md:"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",lg:"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",xl:"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)","2xl":"0 25px 50px -12px rgb(0 0 0 / 0.25)",inner:"inset 0 2px 4px 0 rgb(0 0 0 / 0.05)",none:"none"}},shortcuts:{},rules:[],attributify:{enabled:!1,prefix:"tc-",ignoreAttributes:["class","className","style","id","name","type","value","href","src","alt","title","role","for","action","method","target","rel","placeholder","disabled","checked","selected","readonly","required","maxlength","minlength","pattern","autocomplete","autofocus","tabindex","contenteditable","draggable","spellcheck","lang","dir","hidden","slot","part","is","key","ref"]},bracketSyntax:{enabled:!1,colonSyntax:!1,aliases:{col:"col",row:"row",jc:"justify",ji:"justify-items",js:"justify-self",ai:"items",ac:"content",as:"self",wrap:"wrap",nowrap:"nowrap",c:"center",s:"start",e:"end",sb:"between",sa:"around",se:"evenly",st:"stretch"}},variants:{responsive:!0,hover:!0,focus:!0,active:!0,disabled:!0,dark:!0,light:!0,group:!0,peer:!0,"*":!0,"**":!0,in:!0,before:!0,after:!0,marker:!0,"first-letter":!0,"first-line":!0,backdrop:!0,"details-content":!0,first:!0,last:!0,odd:!0,even:!0,"first-of-type":!0,"last-of-type":!0,visited:!0,checked:!0,"focus-within":!0,"focus-visible":!0,placeholder:!0,selection:!0,file:!0,required:!0,valid:!0,invalid:!0,"read-only":!0,autofill:!0,"user-valid":!0,"user-invalid":!0,"in-range":!0,"out-of-range":!0,"placeholder-shown":!0,open:!0,closed:!0,empty:!0,enabled:!0,only:!0,target:!0,indeterminate:!0,default:!0,optional:!0,inert:!0,"only-of-type":!0,aria:!0,data:!0,has:!0,not:!0,supports:!0,print:!0,landscape:!0,portrait:!0,"forced-colors":!0,"pointer-none":!0,"pointer-coarse":!0,"pointer-fine":!0,"any-pointer-none":!0,"any-pointer-coarse":!0,"any-pointer-fine":!0,"inverted-colors":!0,noscript:!0,starting:!0,rtl:!0,ltr:!0,"motion-safe":!0,"motion-reduce":!0,"contrast-more":!0,"contrast-less":!0},safelist:[],blocklist:[],preflights:[Xt],presets:[],cssVariables:!1},gi=null;async function ia(){if(!gi){await Promise.resolve().then(() => na());gi=await ra({name:"css",defaultConfig:ht})}return gi}var mi=ht;function Oe(e){if(e.indexOf("/")===-1)return-1;let r=0,n=0,i="";for(let o=0;o<e.length;o++){let s=e[o];if(s==="\\"){o++;continue}if(i){if(s===i)i="";continue}if(s==='"'||s==="'"){i=s;continue}if(s==="(")r++;else if(s===")")r=Math.max(0,r-1);else if(s==="[")n++;else if(s==="]")n=Math.max(0,n-1);else if(s==="/"&&r===0&&n===0)return o}return-1}var _r="0 0 #0000",Uh=["inset-shadow","inset-ring-shadow","ring-offset-shadow","ring-shadow","shadow"],V=Uh.map((e)=>`var(--tc-${e}, 0 0 #0000)`).join(", ");var Lr={"0":"0",full:"100%",min:"min-content",max:"max-content",fit:"fit-content",none:"none",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem",screen:"100vw"},Vh={...Lr,prose:"65ch"};function aa(e,t,r){let n=e.value;if(t[n])return{[r]:t[n]};if(e.arbitrary)return{[r]:n};if(/^\d+$/.test(n)){let i=Number.parseInt(n,10);if(i>=0&&i<=100)return{[r]:`${i/100}`}}return}var Wh=(e,t)=>{if(e.utility==="min-w"&&e.value){let r=pe(e,t,Lr);return r!==void 0?{"min-width":r}:void 0}if(e.utility==="max-w"&&e.value){let r=pe(e,t,Vh);return r!==void 0?{"max-width":r}:void 0}if(e.utility==="min-h"&&e.value){let r={...Lr,screen:"100vh"},n=pe(e,t,r);return n!==void 0?{"min-height":n}:void 0}if(e.utility==="max-h"&&e.value){let r={...Lr,screen:"100vh"},n=pe(e,t,r);return n!==void 0?{"max-height":n}:void 0}},zh=(e,t)=>{if(e.utility==="ring"){if(e.value==="inset")return{"--tc-ring-inset":"inset"};if(e.value){let i=z(e.value,t,e.modifierArbitrary);if(i)return{"--tc-ring-color":i}}let r={0:"0",1:"1px",2:"2px",4:"4px",8:"8px",DEFAULT:"1px"},n;if(!e.value)n=r.DEFAULT;else if(r[e.value])n=r[e.value];else if(e.arbitrary)n=e.value;else if(/^\d+(?:\.\d+)?$/.test(e.value))n=`${e.value}px`;if(n===void 0)return;return{"--tc-ring-offset-shadow":"var(--tc-ring-inset,) 0 0 0 var(--tc-ring-offset-width, 0px) var(--tc-ring-offset-color, #fff)","--tc-ring-shadow":`var(--tc-ring-inset,) 0 0 0 calc(${n} + var(--tc-ring-offset-width, 0px)) var(--tc-ring-color, currentcolor)`,"box-shadow":V}}if(e.utility==="ring-offset"&&e.value){let r={0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"};if(r[e.value])return{"--tc-ring-offset-width":r[e.value]};let n=z(e.value,t,e.modifierArbitrary);if(n)return{"--tc-ring-offset-color":n}}if(e.utility==="ring-opacity"&&e.value)return aa(e,{0:"0",5:"0.05",10:"0.1",20:"0.2",25:"0.25",30:"0.3",40:"0.4",50:"0.5",60:"0.6",70:"0.7",75:"0.75",80:"0.8",90:"0.9",95:"0.95",100:"1"},"--tc-ring-opacity")},Kh=(e)=>{if(e.utility==="border-opacity"&&e.value)return aa(e,{0:"0",5:"0.05",10:"0.1",20:"0.2",25:"0.25",30:"0.3",40:"0.4",50:"0.5",60:"0.6",70:"0.7",75:"0.75",80:"0.8",90:"0.9",95:"0.95",100:"1"},"--tc-border-opacity")};function oa(e,t){let r=e.value;if(e.arbitrary)return r;let n=r.startsWith("-"),i=n?r.slice(1):r,o=t.theme.spacing[i];if(o===void 0&&/^\d+(?:\.\d+)?$/.test(i))o=`${Number.parseFloat(i)*0.25}rem`;if(o===void 0)return;return n?`-${o}`:o}var Gh=(e,t)=>{if(e.utility==="space-x"&&e.value){if(e.value==="reverse")return{properties:{"--tc-space-x-reverse":"1"},childSelector:"> :not([hidden]) ~ :not([hidden])"};let r=oa(e,t);if(r===void 0)return;return{properties:{"--tc-space-x-reverse":"0","margin-right":`calc(${r} * var(--tc-space-x-reverse))`,"margin-left":`calc(${r} * calc(1 - var(--tc-space-x-reverse)))`},childSelector:"> :not([hidden]) ~ :not([hidden])"}}if(e.utility==="space-y"&&e.value){if(e.value==="reverse")return{properties:{"--tc-space-y-reverse":"1"},childSelector:"> :not([hidden]) ~ :not([hidden])"};let r=oa(e,t);if(r===void 0)return;return{properties:{"--tc-space-y-reverse":"0","margin-top":`calc(${r} * calc(1 - var(--tc-space-y-reverse)))`,"margin-bottom":`calc(${r} * var(--tc-space-y-reverse))`},childSelector:"> :not([hidden]) ~ :not([hidden])"}}},Hh=(e)=>{if(e.utility==="border"&&e.value){let t={solid:"solid",dashed:"dashed",dotted:"dotted",double:"double",hidden:"hidden",none:"none"};if(t[e.value])return{"border-style":t[e.value]}}};function sa(e){if(!e.value)return"1px";let t={0:"0",2:"2px",4:"4px",8:"8px"};if(t[e.value])return t[e.value];if(e.arbitrary)return e.value;if(/^\d+(?:\.\d+)?$/.test(e.value))return`${e.value}px`;return}function qh(e){let t=Oe(e),r=t===-1?e:e.slice(0,t);if(r.charCodeAt(0)!==91||r.charCodeAt(r.length-1)!==93)return e;let n=r.slice(1,-1).replace(/_/g," ");return t===-1?n:n+e.slice(t)}var Yh=(e,t)=>{if(e.utility==="divide"&&e.value){let r={solid:"solid",dashed:"dashed",dotted:"dotted",double:"double",none:"none"};if(r[e.value])return{properties:{"border-style":r[e.value]},childSelector:"> :not([hidden]) ~ :not([hidden])"}}if(e.utility==="divide-x"){if(e.value==="reverse")return{properties:{"--tc-divide-x-reverse":"1"},childSelector:"> :not([hidden]) ~ :not([hidden])"};let r=sa(e);if(r===void 0)return;return{properties:{"--tc-divide-x-reverse":"0","border-right-width":`calc(${r} * var(--tc-divide-x-reverse))`,"border-left-width":`calc(${r} * calc(1 - var(--tc-divide-x-reverse)))`},childSelector:"> :not([hidden]) ~ :not([hidden])"}}if(e.utility==="divide-y"){if(e.value==="reverse")return{properties:{"--tc-divide-y-reverse":"1"},childSelector:"> :not([hidden]) ~ :not([hidden])"};let r=sa(e);if(r===void 0)return;return{properties:{"--tc-divide-y-reverse":"0","border-top-width":`calc(${r} * calc(1 - var(--tc-divide-y-reverse)))`,"border-bottom-width":`calc(${r} * var(--tc-divide-y-reverse))`},childSelector:"> :not([hidden]) ~ :not([hidden])"}}if(e.utility==="divide"&&e.value){let r=qh(e.value);if(r==="auto")return;let n=z(r,t,e.modifierArbitrary);if(n!==void 0)return{properties:{"border-color":n},childSelector:"> :not([hidden]) ~ :not([hidden])"}}},Jh=(e,t)=>{let r=(n)=>{let i=null,o=n,s=Oe(n);if(s!==-1){o=n.slice(0,s);let u=n.slice(s+1);if(u.startsWith("[")&&u.endsWith("]"))i=u.slice(1,-1);else if(e.modifierArbitrary){let f=Number.parseFloat(u);if(!Number.isNaN(f)&&f>=0&&f<=1)i=f.toString()}else{let f=Number.parseInt(u,10);if(!Number.isNaN(f))i=(f/100).toString()}}let l=(u)=>{if(!i)return u;let f=u.match(/^(oklch|rgb|hsl|oklab|lab|lch)\(([^)]+)\)$/i);if(f){let d=f[1],h=f[2].split("/")[0].trim();return`${d}(${h} / ${i})`}if(/^#[0-9a-f]{3,8}$/i.test(u)){let d=u.replace("#",""),h=(y)=>Number.parseInt(y.length===1?y+y:y,16),g=h(d.slice(0,d.length===3?1:2)),m=h(d.slice(d.length===3?1:2,d.length===3?2:4)),p=h(d.slice(d.length===3?2:4,d.length===3?3:6));return`rgb(${g} ${m} ${p} / ${i})`}return`color-mix(in srgb, ${u} ${Math.round(Number.parseFloat(i)*100)}%, transparent)`};if(o.startsWith("[")&&o.endsWith("]"))o=o.slice(1,-1);let a=t.theme.colors[o];if(typeof a==="string")return l(W(o,a,o,t.colorVariables));if(typeof a==="object"&&a!==null&&typeof a.DEFAULT==="string")return l(W(o,a.DEFAULT,o,t.colorVariables));let c=o.split("-");if(c.length>=2){let u=c.slice(0,-1).join("-"),f=c[c.length-1],d=t.theme.colors[u];if(typeof d==="object"&&d[f])return l(W(o,d[f],u,t.colorVariables))}if(e.arbitrary||o.startsWith("#")||/^(?:var|rgb|rgba|hsl|hsla|oklch|oklab|lab|lch|color|color-mix)\(/.test(o))return l(o);return};if(e.utility==="from"&&e.value){let n=r(e.value);if(n===void 0)return;return{"--tc-gradient-from":n,"--tc-gradient-to":"rgb(255 255 255 / 0)","--tc-gradient-stops":"var(--tc-gradient-from), var(--tc-gradient-to)"}}if(e.utility==="via"&&e.value){let n=r(e.value);if(n===void 0)return;return{"--tc-gradient-to":"rgb(255 255 255 / 0)","--tc-gradient-stops":`var(--tc-gradient-from), ${n}, var(--tc-gradient-to)`}}if(e.utility==="to"&&e.value){let n=r(e.value);if(n===void 0)return;return{"--tc-gradient-to":n,"--tc-gradient-stops":"var(--tc-gradient-from), var(--tc-gradient-to)"}}},Xh=(e)=>{if(e.utility==="order"&&e.value){let t={first:"-9999",last:"9999",none:"0"};if(t[e.value])return{order:t[e.value]};if(e.arbitrary||/^-?\d+$/.test(e.value))return{order:e.value};return}},Zh=(e,t)=>{if(e.utility==="basis"&&e.value){let r={auto:"auto",full:"100%",0:"0"};if(r[e.value])return{"flex-basis":r[e.value]};let n=pe(e,t,{});return n!==void 0?{"flex-basis":n}:void 0}},Qh=(e)=>{if(e.utility==="justify-self"){let t={auto:"auto",start:"start",end:"end",center:"center",stretch:"stretch"};return e.value&&t[e.value]?{"justify-self":t[e.value]}:void 0}},eg=(e)=>{if(e.utility==="self"){let t={auto:"auto",start:"flex-start",end:"flex-end",center:"center",stretch:"stretch",baseline:"baseline"};return e.value&&t[e.value]?{"align-self":t[e.value]}:void 0}},tg=(e,t)=>{if(e.utility==="container"){if(!e.value)return{width:"100%","margin-left":"auto","margin-right":"auto","max-width":t.theme.screens.xl||"1280px"};let r={sm:t.theme.screens.sm||"640px",md:t.theme.screens.md||"768px",lg:t.theme.screens.lg||"1024px",xl:t.theme.screens.xl||"1280px","2xl":t.theme.screens["2xl"]||"1536px",full:"100%",prose:"65ch","3xl":"1920px"};if(r[e.value])return{width:"100%","margin-left":"auto","margin-right":"auto","max-width":r[e.value]};if(e.arbitrary)return{width:"100%","margin-left":"auto","margin-right":"auto","max-width":e.value}}},pi=(e)=>{if(e.arbitrary&&e.utility&&e.value&&e.base.startsWith("["))return{[e.utility]:e.value}},la=[Wh,zh,Kh,Hh,Gh,Yh,Jh,Xh,Zh,Qh,eg,tg,pi];var ca={"bg-origin-border":"border-box","bg-origin-padding":"padding-box","bg-origin-content":"content-box"},ua={"bg-bottom":"bottom","bg-center":"center","bg-left":"left","bg-left-bottom":"left bottom","bg-left-top":"left top","bg-right":"right","bg-right-bottom":"right bottom","bg-right-top":"right top","bg-top":"top"},fa={"bg-repeat":"repeat","bg-no-repeat":"no-repeat","bg-repeat-x":"repeat-x","bg-repeat-y":"repeat-y","bg-repeat-round":"round","bg-repeat-space":"space"},da={"bg-auto":"auto","bg-cover":"cover","bg-contain":"contain"},yi=null,ha=null;function rg(e){let t=new Map;for(let[r,n]of Object.entries(e))if(typeof n==="string")t.set(r,n);else if(typeof n==="object"&&n!==null){for(let[i,o]of Object.entries(n))if(typeof o==="string")t.set(i==="DEFAULT"?r:`${r}-${i}`,o)}return t}function ng(e){return e.replace(/rgba?\([^)]+\)/g,"var(--tc-shadow-color)")}var ig=(e)=>{if(e.utility==="bg"&&e.value){let t={fixed:"fixed",local:"local",scroll:"scroll"};return t[e.value]?{"background-attachment":t[e.value]}:void 0}return},og=(e)=>{if(e.utility==="bg"&&e.value&&e.value.startsWith("clip-")){let t=e.value.replace("clip-",""),r={border:"border-box",padding:"padding-box",content:"content-box",text:"text"};return r[t]?{"background-clip":r[t]}:void 0}return},ga={t:"to top",tr:"to top right",r:"to right",br:"to bottom right",b:"to bottom",bl:"to bottom left",l:"to left",tl:"to top left"},sg=new Set(["srgb","srgb-linear","oklab","oklch","lab","lch","hsl","hwb","xyz","xyz-d50","xyz-d65","display-p3","a98-rgb","prophoto-rgb","rec2020"]),ag=new Set(["shorter","longer","increasing","decreasing"]);function lg(e){if(sg.has(e))return`in ${e}`;if(ag.has(e))return`in oklch ${e} hue`;return}var cg=(e)=>{if(e.utility!=="bg"||!e.value||e.arbitrary||e.typeHint)return;if(e.value.includes("("))return;let t=e.value.lastIndexOf("/"),r=t===-1?e.value:e.value.slice(0,t),n=t===-1?void 0:e.value.slice(t+1),i;if(n!==void 0){if(i=lg(n),i===void 0)return}let o=r.charCodeAt(0)===45,s=o?r.slice(1):r,l,a="";if(s==="conic")l="conic-gradient";else if(s==="radial")l="radial-gradient";else if(s.startsWith("conic-")){let u=s.slice(6);if(!/^\d+(?:\.\d+)?$/.test(u))return;l="conic-gradient",a=`from ${o?"-":""}${u}deg`}else if(s.startsWith("linear-")||s.startsWith("gradient-")){let u=s.slice(s.indexOf("-")+1);if(l="linear-gradient",u.startsWith("to-")){let f=ga[u.slice(3)];if(f===void 0)return;a=f}else if(/^\d+(?:\.\d+)?$/.test(u))a=`${o?"-":""}${u}deg`;else return}else return;if(!a&&i===void 0)return;let c=[a,i].filter(Boolean).join(" ");return{"background-image":c?`${l}(${c}, var(--tc-gradient-stops))`:`${l}(var(--tc-gradient-stops))`}},ug=(e)=>{if(!e.value)return;let t;if(e.utility==="bg-linear"||e.utility==="bg-gradient")t=e.value;else if(e.utility==="bg"){if(e.typeHint||e.value.includes("("))return;let r=e.value.startsWith("-"),i=(r?e.value.slice(1):e.value).match(/^(?:gradient|linear)-(.+)$/);if(!i)return;t=r?`-${i[1]}`:i[1]}else return;if(t.startsWith("to-")){let r=ga[t.slice(3)];return r?{"background-image":`linear-gradient(${r}, var(--tc-gradient-stops))`}:void 0}if(e.arbitrary)return{"background-image":`linear-gradient(${t}, var(--tc-gradient-stops))`};if(/^-?\d+(?:\.\d+)?$/.test(t))return{"background-image":`linear-gradient(${t}deg, var(--tc-gradient-stops))`};return},fg=(e)=>ca[e.base]?{"background-origin":ca[e.base]}:void 0,dg=(e)=>ua[e.base]?{"background-position":ua[e.base]}:void 0,hg=(e)=>fa[e.base]?{"background-repeat":fa[e.base]}:void 0,gg=(e)=>da[e.base]?{"background-size":da[e.base]}:void 0,mg=(e)=>{if(e.utility==="border"&&e.value){let t={solid:"solid",dashed:"dashed",dotted:"dotted",double:"double",hidden:"hidden",none:"none"};return t[e.value]?{"border-style":t[e.value]}:void 0}return},pg=(e,t)=>{if(e.utility==="outline-offset"&&e.value){let r={0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"};if(r[e.value])return{"outline-offset":r[e.value]};if(e.arbitrary)return{"outline-offset":e.value};if(/^\d+(?:\.\d+)?$/.test(e.value))return{"outline-offset":`${e.value}px`};return}if(e.utility==="outline"&&e.value){let r={none:"none",solid:"solid",dashed:"dashed",dotted:"dotted",double:"double"};if(r[e.value])return{"outline-style":r[e.value]};if(e.value==="hidden")return{outline:"2px solid transparent","outline-offset":"2px"}}if(e.utility==="outline"){if(!e.value)return{"outline-width":"1px"};let r=z(e.value,t,e.modifierArbitrary);if(r)return{"outline-color":r};let n={0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"};if(n[e.value])return{"outline-width":n[e.value]};if(e.arbitrary)return{"outline-width":e.value};if(/^\d+(?:\.\d+)?$/.test(e.value))return{"outline-width":`${e.value}px`};return}},yg=(e,t)=>{if(e.utility==="shadow"){let n=e.arbitrary&&!!e.value&&(/\s/.test(e.value)||e.value==="none")?e.value:e.value?t.theme.boxShadow[e.value]:t.theme.boxShadow.DEFAULT;if(!n)return;if(n==="none")return{"--tc-shadow":_r,"box-shadow":V};let i=ng(n);return{"--tc-shadow":n,"--tc-shadow-colored":i,"box-shadow":V}}},bg=(e,t)=>{if(e.utility!=="shadow"||!e.value)return;if(t.theme.boxShadow[e.value])return;if(e.arbitrary&&/\s/.test(e.value))return;if(yi===null||ha!==t.theme.colors)yi=rg(t.theme.colors),ha=t.theme.colors;let r=e.value,n=Oe(r),i,o;if(n!==-1){i=r.slice(0,n);let a=r.slice(n+1);if(a.charCodeAt(0)===91&&a.charCodeAt(a.length-1)===93){let c=Number.parseFloat(a.slice(1,-1));if(Number.isNaN(c)||c<0||c>1)return;o=c}else if(e.modifierArbitrary){let c=Number.parseFloat(a);if(Number.isNaN(c)||c<0||c>1)return;o=c}else{let c=Number.parseInt(a,10);if(Number.isNaN(c)||c<0||c>100)return;o=c/100}}else i=r;let s=yi.get(i)??(e.arbitrary?i:void 0);if(!s)return;return{"--tc-shadow-color":o!==void 0?we(s,o):s,"--tc-shadow":"var(--tc-shadow-colored)"}};function _t(e){return`${e} var(--tc-text-shadow-color, rgba(0, 0, 0, 0.05))`}var xg=(e,t)=>{if(e.utility!=="text-shadow")return;let r={sm:_t("0 1px 2px"),DEFAULT:_t("0 1px 3px"),md:_t("0 4px 6px"),lg:_t("0 10px 15px"),xl:_t("0 20px 25px"),none:"none"};if(!e.value)return{"text-shadow":r.DEFAULT};if(r[e.value])return{"text-shadow":r[e.value]};if(e.arbitrary&&e.value){if(/\s/.test(e.value))return{"text-shadow":e.value};return{"--tc-text-shadow-color":e.value}}let n=z(e.value,t,e.modifierArbitrary);return n===void 0?void 0:{"--tc-text-shadow-color":n}},vg=(e)=>{if(e.utility==="opacity"&&e.value){let t={0:"0",5:"0.05",10:"0.1",20:"0.2",25:"0.25",30:"0.3",40:"0.4",50:"0.5",60:"0.6",70:"0.7",75:"0.75",80:"0.8",90:"0.9",95:"0.95",100:"1"};if(t[e.value])return{opacity:t[e.value]};if(e.arbitrary)return{opacity:e.value};if(/^\d+$/.test(e.value)){let r=Number.parseInt(e.value,10);if(r>=0&&r<=100)return{opacity:`${r/100}`}}return}},wg=(e)=>{if(e.utility==="mix-blend"){let t=["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"];return e.value&&t.includes(e.value)?{"mix-blend-mode":e.value}:void 0}},$g=(e)=>{if(e.utility==="bg-blend"){let t=["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"];return e.value&&t.includes(e.value)?{"background-blend-mode":e.value}:void 0}},Cg=(e)=>{if(e.utility==="mask-clip"&&e.value){let t={border:"border-box",padding:"padding-box",content:"content-box",text:"text",fill:"fill-box",stroke:"stroke-box",view:"view-box","no-clip":"no-clip"};if(t[e.value])return{"mask-clip":t[e.value]};return e.arbitrary?{"mask-clip":e.value}:void 0}if(e.utility==="mask-composite"&&e.value)return["add","subtract","intersect","exclude"].includes(e.value)?{"mask-composite":e.value}:void 0;if(e.utility==="mask-image"&&e.value){if(e.value==="none")return{"mask-image":"none"};if(e.arbitrary)return{"mask-image":e.value.startsWith("url(")||e.value.includes("gradient(")?e.value:`url(${e.value})`};return}if(e.utility==="mask-mode"&&e.value)return["alpha","luminance","match-source"].includes(e.value)?{"mask-mode":e.value}:void 0;if(e.utility==="mask-origin"&&e.value){let t={border:"border-box",padding:"padding-box",content:"content-box",fill:"fill-box",stroke:"stroke-box",view:"view-box"};if(t[e.value])return{"mask-origin":t[e.value]};return e.arbitrary?{"mask-origin":e.value}:void 0}if(e.utility==="mask-position"&&e.value){let t={center:"center",top:"top",right:"right",bottom:"bottom",left:"left","top-left":"top left","top-right":"top right","bottom-left":"bottom left","bottom-right":"bottom right"};if(t[e.value])return{"mask-position":t[e.value]};return e.arbitrary?{"mask-position":e.value}:void 0}if(e.utility==="mask-repeat"&&e.value){let t={repeat:"repeat","no-repeat":"no-repeat","repeat-x":"repeat-x","repeat-y":"repeat-y",round:"round",space:"space"};if(t[e.value])return{"mask-repeat":t[e.value]};return e.arbitrary?{"mask-repeat":e.value}:void 0}if(e.utility==="mask-size"&&e.value){let t={auto:"auto",cover:"cover",contain:"contain"};if(t[e.value])return{"mask-size":t[e.value]};return e.arbitrary?{"mask-size":e.value}:void 0}if(e.utility==="mask-type"&&e.value)return["alpha","luminance"].includes(e.value)?{"mask-type":e.value}:void 0},bi=[ig,og,cg,ug,fg,dg,hg,gg,mg,pg,yg,bg,xg,vg,wg,$g,Cg];var ma={add:"add",subtract:"subtract",intersect:"intersect",exclude:"exclude"},pa={alpha:"alpha",luminance:"luminance",match:"match-source"},ya={auto:"auto",cover:"cover",contain:"contain"},ba={center:"center",top:"top",right:"right",bottom:"bottom",left:"left","top-left":"left top","top-right":"right top","bottom-left":"left bottom","bottom-right":"right bottom"},xa={repeat:"repeat","no-repeat":"no-repeat"},Rg=(e)=>{if(e.utility!=="mask"||!e.value)return;let t=e.value;if(e.arbitrary)return{"mask-image":t};if(t==="none")return{"mask-image":"none"};if(ma[t]!==void 0)return{"mask-composite":ma[t]};if(pa[t]!==void 0)return{"mask-mode":pa[t]};if(ya[t]!==void 0)return{"mask-size":ya[t]};if(ba[t]!==void 0)return{"mask-position":ba[t]};if(xa[t]!==void 0)return{"mask-repeat":xa[t]};if(t==="no-clip")return{"mask-clip":"no-clip"};return},kg=(e)=>{if(e.utility!=="mask-repeat"||e.arbitrary)return;if(e.value==="x")return{"mask-repeat":"repeat-x"};if(e.value==="y")return{"mask-repeat":"repeat-y"};return},qe="linear-gradient(#fff, #fff)";function A(e,t){return`var(--tc-mask-${e}, ${t})`}function Ye(){return{"mask-image":`${A("linear",qe)}, ${A("radial",qe)}, ${A("conic",qe)}`,"mask-composite":"intersect"}}var Sg=[A("left",qe),A("right",qe),A("bottom",qe),A("top",qe)].join(", "),Ag={t:["top"],r:["right"],b:["bottom"],l:["left"],x:["right","left"],y:["top","bottom"]};function Eg(e){let t=`${A(`${e}-from-color`,"black")} ${A(`${e}-from-position`,"0%")}`,r=`${A(`${e}-to-color`,"transparent")} ${A(`${e}-to-position`,"100%")}`;return`linear-gradient(to ${e}, ${t}, ${r})`}var Tg=[A("linear-position","0deg"),`${A("linear-from-color","black")} ${A("linear-from-position","0%")}`,`${A("linear-to-color","transparent")} ${A("linear-to-position","100%")}`].join(", "),Ng=/^(?:var|rgb|rgba|hsl|hsla|oklch|oklab|lab|lch|color|color-mix)\(/;function Mr(e,t,r){if(!e)return;if(/^\d+(?:\.\d+)?%$/.test(e))return{position:e};if(/^\d+(?:\.\d+)?$/.test(e)){let i=pe({value:e,arbitrary:!1},r,{});return i===void 0?void 0:{position:i}}if(t)return e.charCodeAt(0)===35||Ng.test(e)?{color:e}:{position:e};let n=z(e,r,!1);return n===void 0?void 0:{color:n}}function Fr(e){if(e.startsWith("from-"))return{stop:"from",token:e.slice(5)};if(e.startsWith("to-"))return{stop:"to",token:e.slice(3)};return}var Og=(e,t)=>{if(e.utility!=="mask"||!e.value||e.arbitrary)return;let r=e.value,n=r.charCodeAt(0)===45,i=n?r.slice(1):r;if(!i.startsWith("linear-"))return;let o=i.slice(7);if(/^\d+(?:\.\d+)?$/.test(o))return{...Ye(),"--tc-mask-linear":`linear-gradient(${A("linear-stops",A("linear-position","0deg"))})`,"--tc-mask-linear-position":`calc(1deg * ${n?"-":""}${o})`};if(n)return;let s=Fr(o);if(s===void 0)return;let l=Mr(s.token,e.arbitrary,t);if(l===void 0)return;let a={...Ye(),"--tc-mask-linear-stops":Tg,"--tc-mask-linear":"linear-gradient(var(--tc-mask-linear-stops))"};if(l.color!==void 0)a[`--tc-mask-linear-${s.stop}-color`]=l.color;else a[`--tc-mask-linear-${s.stop}-position`]=l.position;return a},Ig=(e,t)=>{if(e.utility!=="mask"||!e.value||e.arbitrary)return;let r=e.value,n=r.indexOf("-");if(n===-1)return;let i=Ag[r.slice(0,n)];if(i===void 0)return;let o=Fr(r.slice(n+1));if(o===void 0)return;let s=Mr(o.token,e.arbitrary,t);if(s===void 0)return;let l={...Ye(),"--tc-mask-linear":Sg};for(let a of i)if(l[`--tc-mask-${a}`]=Eg(a),s.color!==void 0)l[`--tc-mask-${a}-${o.stop}-color`]=s.color;else l[`--tc-mask-${a}-${o.stop}-position`]=s.position;return l},Pg=[`${A("radial-shape","ellipse")} ${A("radial-size","farthest-corner")} at ${A("radial-position","center")}`,`${A("radial-from-color","black")} ${A("radial-from-position","0%")}`,`${A("radial-to-color","transparent")} ${A("radial-to-position","100%")}`].join(", "),_g=new Set(["closest-side","closest-corner","farthest-side","farthest-corner"]),Lg={center:"center",top:"top",right:"right",bottom:"bottom",left:"left","top-left":"top left","top-right":"top right","bottom-left":"bottom left","bottom-right":"bottom right"},Mg=[`from ${A("conic-position","0deg")}`,`${A("conic-from-color","black")} ${A("conic-from-position","0%")}`,`${A("conic-to-color","transparent")} ${A("conic-to-position","100%")}`].join(", "),Fg=(e,t)=>{if(e.utility==="mask-radial"&&e.arbitrary&&e.value)return{...Ye(),"--tc-mask-radial":`radial-gradient(${A("radial-stops",A("radial-size","farthest-corner"))})`,"--tc-mask-radial-size":e.value};if(e.utility!=="mask"||!e.value||e.arbitrary)return;let r=e.value;if(r==="circle"||r==="ellipse")return{"--tc-mask-radial-shape":r};if(!r.startsWith("radial-"))return;let n=r.slice(7);if(n.startsWith("at-")){let l=Lg[n.slice(3)];return l===void 0?void 0:{"--tc-mask-radial-position":l}}if(_g.has(n))return{"--tc-mask-radial-size":n};let i=Fr(n);if(i===void 0)return;let o=Mr(i.token,e.arbitrary,t);if(o===void 0)return;let s={...Ye(),"--tc-mask-radial-stops":Pg,"--tc-mask-radial":"radial-gradient(var(--tc-mask-radial-stops))"};if(o.color!==void 0)s[`--tc-mask-radial-${i.stop}-color`]=o.color;else s[`--tc-mask-radial-${i.stop}-position`]=o.position;return s},jg=(e,t)=>{if(e.utility!=="mask"||!e.value||e.arbitrary)return;let r=e.value,n=r.charCodeAt(0)===45,i=n?r.slice(1):r;if(!i.startsWith("conic-"))return;let o=i.slice(6);if(/^\d+(?:\.\d+)?$/.test(o))return{...Ye(),"--tc-mask-conic":`conic-gradient(${A("conic-stops",A("conic-position","0deg"))})`,"--tc-mask-conic-position":`calc(1deg * ${n?"-":""}${o})`};if(n)return;let s=Fr(o);if(s===void 0)return;let l=Mr(s.token,e.arbitrary,t);if(l===void 0)return;let a={...Ye(),"--tc-mask-conic-stops":Mg,"--tc-mask-conic":"conic-gradient(var(--tc-mask-conic-stops))"};if(l.color!==void 0)a[`--tc-mask-conic-${s.stop}-color`]=l.color;else a[`--tc-mask-conic-${s.stop}-position`]=l.position;return a},va=[Og,Ig,Fg,jg,Rg,kg];var Dg={"2xs":"inset 0 1px",xs:"inset 0 1px 1px",sm:"inset 0 2px 4px"},Bg="rgb(0 0 0 / 0.05)",Ug=/^(?:var|rgb|rgba|hsl|hsla|oklch|oklab|lab|lch|color|color-mix)\(/;function wi(e){return e.charCodeAt(0)===35||Ug.test(e)}function Vg(e){return/^-?[\d.]+[a-z%]*$/i.test(e)||e.startsWith("calc(")||e.startsWith("var(")}function Wg(e,t){let r=e.trim().split(/\s+/),n=r[r.length-1];if(r.length>1&&!Vg(n))return`inset ${r.slice(0,-1).join(" ")} var(${t}, ${n})`;return`inset ${e} var(${t}, currentcolor)`}function xi(e){return{"--tc-inset-shadow":e,"box-shadow":V}}var zg=(e,t)=>{if(e.utility==="inset-shadow"&&e.arbitrary&&e.value){if(!/\s/.test(e.value)&&wi(e.value))return{"--tc-inset-shadow-color":e.value};return xi(Wg(e.value,"--tc-inset-shadow-color"))}if(e.utility!=="inset"||!e.value||e.arbitrary)return;if(!e.value.startsWith("shadow-"))return;let r=e.value.slice(7),n=Dg[r];if(n!==void 0)return xi(`${n} var(--tc-inset-shadow-color, ${Bg})`);if(r==="none")return xi(`inset ${_r}`);let i=z(r,t,e.modifierArbitrary);return i===void 0?void 0:{"--tc-inset-shadow-color":i}};function vi(e){return{"--tc-inset-ring-shadow":`inset 0 0 0 ${e} var(--tc-inset-ring-color, currentcolor)`,"box-shadow":V}}var Kg=(e,t)=>{if(e.utility==="inset-ring"&&e.arbitrary&&e.value){if(wi(e.value))return{"--tc-inset-ring-color":e.value};return vi(e.value)}if(e.utility!=="inset"||!e.value||e.arbitrary)return;if(e.value!=="ring"&&!e.value.startsWith("ring-"))return;if(e.value==="ring")return vi("1px");let r=e.value.slice(5);if(/^\d+(?:\.\d+)?$/.test(r))return vi(`${r}px`);let n=z(r,t,e.modifierArbitrary);return n===void 0?void 0:{"--tc-inset-ring-color":n}},Gg=(e,t)=>{if(e.utility!=="drop-shadow"||!e.value)return;if(e.arbitrary){if(/\s/.test(e.value))return;return wi(e.value)?{"--tc-drop-shadow-color":e.value}:void 0}let r=z(e.value,t,e.modifierArbitrary);return r===void 0?void 0:{"--tc-drop-shadow-color":r}},wa=[zg,Kg,Gg];var jr={appearance:"none","background-color":"#fff","border-color":"#6b7280","border-width":"1px","border-radius":"0px","padding-top":"0.5rem","padding-right":"0.75rem","padding-bottom":"0.5rem","padding-left":"0.75rem","font-size":"1rem","line-height":"1.5rem"},$a={appearance:"none",padding:"0","print-color-adjust":"exact",display:"inline-block","vertical-align":"middle","background-origin":"border-box","user-select":"none","flex-shrink":"0",height:"1rem",width:"1rem",color:"#2563eb","background-color":"#fff","border-color":"#6b7280","border-width":"1px"};function gt(e,t){return e.utility==="form"&&e.value===t||e.utility===`form-${t}`&&!e.value}var Hg=(e)=>{if(gt(e,"input"))return jr},qg=(e)=>{if(gt(e,"textarea"))return jr},Yg=(e)=>{if(gt(e,"select"))return{...jr,"background-image":`url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e")`,"background-position":"right 0.5rem center","background-repeat":"no-repeat","background-size":"1.5em 1.5em","padding-right":"2.5rem","print-color-adjust":"exact"}},Jg=(e)=>{if(gt(e,"multiselect"))return{...jr,"background-image":"initial","background-position":"initial","background-repeat":"unset","background-size":"initial","print-color-adjust":"unset"}},Xg=(e)=>{if(gt(e,"checkbox"))return{...$a,"border-radius":"0px"}},Zg=(e)=>{if(gt(e,"radio"))return{...$a,"border-radius":"100%"}},Ca=[Hg,qg,Yg,Jg,Xg,Zg];var Qg={gap:"gap","gap-x":"column-gap","gap-y":"row-gap"},mt=/^-?\d+$/,Ra=/^span-(\d+)$/,em=(e)=>{if(e.utility==="grid-cols"&&e.value){if(e.arbitrary)return{"grid-template-columns":e.value};if(e.value==="none"||e.value==="subgrid")return{"grid-template-columns":e.value};if(/^\d+$/.test(e.value))return{"grid-template-columns":`repeat(${e.value}, minmax(0, 1fr))`};return}},tm=(e)=>{if(e.utility==="col"){if(!e.value)return;if(e.arbitrary)return{"grid-column":e.value};if(e.value==="auto")return{"grid-column":"auto"};if(e.value==="span-full")return{"grid-column":"1 / -1"};let t=e.value.match(Ra);if(t)return{"grid-column":`span ${t[1]} / span ${t[1]}`};if(mt.test(e.value))return{"grid-column":e.value};return}if(e.utility==="col-span"&&e.value){if(e.arbitrary)return{"grid-column":`span ${e.value} / span ${e.value}`};if(e.value==="auto")return{"grid-column":"auto"};if(e.value==="full")return{"grid-column":"1 / -1"};if(/^\d+$/.test(e.value))return{"grid-column":`span ${e.value} / span ${e.value}`};return}if(e.utility==="col-start"&&e.value){if(e.arbitrary||e.value==="auto"||mt.test(e.value))return{"grid-column-start":e.value};return}if(e.utility==="col-end"&&e.value){if(e.arbitrary||e.value==="auto"||mt.test(e.value))return{"grid-column-end":e.value};return}},rm=(e)=>{if(e.utility==="grid-rows"&&e.value){if(e.arbitrary)return{"grid-template-rows":e.value};if(e.value==="none"||e.value==="subgrid")return{"grid-template-rows":e.value};if(/^\d+$/.test(e.value))return{"grid-template-rows":`repeat(${e.value}, minmax(0, 1fr))`};return}},nm=(e)=>{if(e.utility==="row"){if(!e.value)return;if(e.arbitrary)return{"grid-row":e.value};if(e.value==="auto")return{"grid-row":"auto"};if(e.value==="span-full")return{"grid-row":"1 / -1"};let t=e.value.match(Ra);if(t)return{"grid-row":`span ${t[1]} / span ${t[1]}`};if(mt.test(e.value))return{"grid-row":e.value};return}if(e.utility==="row-span"&&e.value){if(e.arbitrary)return{"grid-row":`span ${e.value} / span ${e.value}`};if(e.value==="auto")return{"grid-row":"auto"};if(e.value==="full")return{"grid-row":"1 / -1"};if(/^\d+$/.test(e.value))return{"grid-row":`span ${e.value} / span ${e.value}`};return}if(e.utility==="row-start"&&e.value){if(e.arbitrary||e.value==="auto"||mt.test(e.value))return{"grid-row-start":e.value};return}if(e.utility==="row-end"&&e.value){if(e.arbitrary||e.value==="auto"||mt.test(e.value))return{"grid-row-end":e.value};return}},im=(e)=>{if(e.utility==="grid-flow"&&e.value){let t={row:"row",col:"column",dense:"dense","row-dense":"row dense","col-dense":"column dense"};return t[e.value]?{"grid-auto-flow":t[e.value]}:void 0}return},om=(e)=>{if(e.utility==="auto-cols"&&e.value){let t={auto:"auto",min:"min-content",max:"max-content",fr:"minmax(0, 1fr)"};if(e.arbitrary)return{"grid-auto-columns":e.value};return t[e.value]?{"grid-auto-columns":t[e.value]}:void 0}},sm=(e)=>{if(e.utility==="auto-rows"&&e.value){let t={auto:"auto",min:"min-content",max:"max-content",fr:"minmax(0, 1fr)"};if(e.arbitrary)return{"grid-auto-rows":e.value};return t[e.value]?{"grid-auto-rows":t[e.value]}:void 0}};function am(e,t,r){let n=t.theme.spacing?.[r];if(n!==void 0)return n;if(e.arbitrary)return r;if(/^\d+(?:\.\d+)?$/.test(r)){let i=Number.parseFloat(r);if(Number.isFinite(i))return`${i*0.25}rem`}return}var lm=(e,t)=>{let r=Qg[e.utility];if(!r||!e.value)return;let n=am(e,t,e.value);return n!==void 0?{[r]:n}:void 0},cm=(e)=>{if(e.utility==="place"&&e.value&&e.value.startsWith("content-")){let t=e.value.replace("content-",""),r={center:"center",start:"start",end:"end",between:"space-between",around:"space-around",evenly:"space-evenly",stretch:"stretch"};return r[t]?{"place-content":r[t]}:void 0}return},um=(e)=>{if(e.utility==="place"&&e.value&&e.value.startsWith("items-")){let t=e.value.replace("items-",""),r={start:"start",end:"end",center:"center",stretch:"stretch"};return r[t]?{"place-items":r[t]}:void 0}return},fm=(e)=>{if(e.utility==="place"&&e.value&&e.value.startsWith("self-")){let t=e.value.replace("self-",""),r={auto:"auto",start:"start",end:"end",center:"center",stretch:"stretch"};return r[t]?{"place-self":r[t]}:void 0}return},ka=[em,tm,rm,nm,im,om,sm,lm,cm,um,fm];import{existsSync as Sa,readFileSync as dm,readdirSync as hm}from"fs";import{join as Dr}from"path";var Br=new Map;function gm(e){if(Br.has(e))return Br.get(e);let t=[Dr(process.cwd(),"node_modules","@iconify-json",e,"icons.json"),Dr(process.cwd(),"node_modules",".bun","@iconify-json",e,"icons.json")],r=Dr(process.cwd(),"node_modules",".bun");if(Sa(r))try{let n=`@iconify-json+${e}@`;for(let i of hm(r))if(i.startsWith(n))t.push(Dr(r,i,"node_modules","@iconify-json",e,"icons.json"))}catch{}for(let n of t)if(Sa(n))try{let i=JSON.parse(dm(n,"utf-8"));return Br.set(e,i),i}catch{}return Br.set(e,null),null}function mm(e,t){let r=e.icons[t];if(r)return r;let n=e.aliases?.[t];if(n)return e.icons[n.parent]??null;return null}function pm(e,t){let r=t.width??e.width??24,n=t.height??e.height??24,i=t.left??0,o=t.top??0;return`<svg xmlns='http://www.w3.org/2000/svg' viewBox='${i} ${o} ${r} ${n}' width='${r}' height='${n}'>${t.body}</svg>`}function ym(e){return`url("data:image/svg+xml;utf8,${e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\?/g,"%3F").replace(/\s+/g," ")}")`}var bm=/^i-([a-z][a-z0-9]*(?:-[a-z0-9]+)*)-(.+)$/;function xm(e){if(!e.startsWith("i-"))return;let t=e.slice(2);for(let r=t.indexOf("-");r!==-1;r=t.indexOf("-",r+1)){let n=t.slice(0,r),i=t.slice(r+1);if(!/^[a-z][a-z0-9-]*$/.test(n))continue;let o=gm(n);if(!o)continue;let s=mm(o,i);if(s)return{collection:o,icon:s}}return}var Aa=(e,t)=>{if(!bm.test(e.base))return;let r=xm(e.base);if(!r)return;let{collection:n,icon:i}=r,o=ym(pm(n,i));return{defaults:!0,properties:{display:"inline-block",width:"1em",height:"1em","background-color":"currentColor","-webkit-mask":`${o} no-repeat`,mask:`${o} no-repeat`,"-webkit-mask-size":"100% 100%","mask-size":"100% 100%","vertical-align":"-0.125em"}}};var Ea={"border-collapse":"collapse","border-separate":"separate"},Ta={"caption-top":"top","caption-bottom":"bottom"},Na={"field-sizing-content":"content","field-sizing-fixed":"fixed"},Oa={"cursor-auto":"auto","cursor-default":"default","cursor-pointer":"pointer","cursor-wait":"wait","cursor-text":"text","cursor-move":"move","cursor-help":"help","cursor-not-allowed":"not-allowed","cursor-none":"none","cursor-context-menu":"context-menu","cursor-progress":"progress","cursor-cell":"cell","cursor-crosshair":"crosshair","cursor-vertical-text":"vertical-text","cursor-alias":"alias","cursor-copy":"copy","cursor-no-drop":"no-drop","cursor-grab":"grab","cursor-grabbing":"grabbing","cursor-all-scroll":"all-scroll","cursor-col-resize":"col-resize","cursor-row-resize":"row-resize","cursor-n-resize":"n-resize","cursor-e-resize":"e-resize","cursor-s-resize":"s-resize","cursor-w-resize":"w-resize","cursor-ne-resize":"ne-resize","cursor-nw-resize":"nw-resize","cursor-se-resize":"se-resize","cursor-sw-resize":"sw-resize","cursor-ew-resize":"ew-resize","cursor-ns-resize":"ns-resize","cursor-nesw-resize":"nesw-resize","cursor-nwse-resize":"nwse-resize","cursor-zoom-in":"zoom-in","cursor-zoom-out":"zoom-out"},Ia={"pointer-events-none":"none","pointer-events-auto":"auto"},Pa={"resize-none":"none",resize:"both","resize-y":"vertical","resize-x":"horizontal"},_a={"scroll-auto":"auto","scroll-smooth":"smooth"},La={"snap-none":"none","snap-x":"x var(--tc-scroll-snap-strictness, proximity)","snap-y":"y var(--tc-scroll-snap-strictness, proximity)","snap-both":"both var(--tc-scroll-snap-strictness, proximity)"},Ma={"snap-mandatory":"mandatory","snap-proximity":"proximity"},Fa={"snap-start":"start","snap-end":"end","snap-center":"center","snap-align-none":"none"},ja={"snap-normal":"normal","snap-always":"always"},Da={"touch-auto":"auto","touch-none":"none","touch-pan-x":"pan-x","touch-pan-left":"pan-left","touch-pan-right":"pan-right","touch-pan-y":"pan-y","touch-pan-up":"pan-up","touch-pan-down":"pan-down","touch-pinch-zoom":"pinch-zoom","touch-manipulation":"manipulation"},Ba={"select-none":"none","select-text":"text","select-all":"all","select-auto":"auto"},Ua={"will-change-auto":"auto","will-change-scroll":"scroll-position","will-change-contents":"contents","will-change-transform":"transform"},Va={"stroke-linecap-butt":"butt","stroke-linecap-round":"round","stroke-linecap-square":"square"},Wa={"stroke-linejoin-miter":"miter","stroke-linejoin-round":"round","stroke-linejoin-bevel":"bevel"},za={"forced-color-adjust-auto":"auto","forced-color-adjust-none":"none"},$i={none:"0",sm:"4px",DEFAULT:"8px",md:"12px",lg:"16px",xl:"24px","2xl":"40px","3xl":"64px"};function Ha(e){if(e.arbitrary)return e.value;if(/^\d+(?:\.\d+)?$/.test(e.value))return`${Number(e.value)/100}`;return}function qa(e){if(!e.value)return $i.DEFAULT;if($i[e.value]!==void 0)return $i[e.value];if(e.arbitrary)return e.value;if(/^\d+(?:\.\d+)?$/.test(e.value))return`${e.value}px`;return}var Ya=["brightness","contrast","grayscale","invert","saturate","sepia"],vm=["blur","brightness","contrast","grayscale","hue-rotate","invert","saturate","sepia","drop-shadow"],wm=["blur","brightness","contrast","grayscale","hue-rotate","invert","opacity","saturate","sepia"],$m=vm.map((e)=>`var(--tc-${e}, )`).join(" "),Ka=wm.map((e)=>`var(--tc-backdrop-${e}, )`).join(" ");function Je(e,t){return{[`--tc-${e}`]:t,filter:$m}}function Ur(e,t){return{[`--tc-backdrop-${e}`]:t,"-webkit-backdrop-filter":Ka,"backdrop-filter":Ka}}var Cm=(e)=>{if(e.base==="filter-none")return{filter:"none"};if(e.utility==="blur"){let t=qa(e);return t!==void 0?Je("blur",`blur(${t})`):void 0}if(Ya.includes(e.utility)&&e.value){let t=Ha(e);return t!==void 0?Je(e.utility,`${e.utility}(${t})`):void 0}if(e.utility==="hue-rotate"&&e.value){if(e.arbitrary)return Je("hue-rotate",`hue-rotate(${e.value})`);if(/^-?\d+(?:\.\d+)?$/.test(e.value))return Je("hue-rotate",`hue-rotate(${e.value}deg)`);return}if(e.utility==="drop-shadow"){let t={sm:"drop-shadow(0 1px 1px rgb(0 0 0 / 0.05))",DEFAULT:"drop-shadow(0 1px 2px rgb(0 0 0 / 0.1)) drop-shadow(0 1px 1px rgb(0 0 0 / 0.06))",md:"drop-shadow(0 4px 3px rgb(0 0 0 / 0.07)) drop-shadow(0 2px 2px rgb(0 0 0 / 0.06))",lg:"drop-shadow(0 10px 8px rgb(0 0 0 / 0.04)) drop-shadow(0 4px 3px rgb(0 0 0 / 0.1))",xl:"drop-shadow(0 20px 13px rgb(0 0 0 / 0.03)) drop-shadow(0 8px 5px rgb(0 0 0 / 0.08))","2xl":"drop-shadow(0 25px 25px rgb(0 0 0 / 0.15))",none:"drop-shadow(0 0 #0000)"};if(!e.value)return Je("drop-shadow",t.DEFAULT);if(t[e.value])return Je("drop-shadow",t[e.value]);if(e.arbitrary)return Je("drop-shadow",`drop-shadow(${e.value})`);return}},Rm=(e)=>{if(e.base==="backdrop-filter-none")return{"backdrop-filter":"none"};if(e.utility==="backdrop-blur"){let t=qa(e);return t!==void 0?Ur("blur",`blur(${t})`):void 0}if(e.utility.startsWith("backdrop-")&&e.value){let t=e.utility.slice(9);if(Ya.includes(t)||t==="opacity"){let r=Ha(e);if(r===void 0)return;return Ur(t,`${t}(${r})`)}if(t==="hue-rotate"){if(e.arbitrary)return Ur(t,`hue-rotate(${e.value})`);if(/^-?\d+(?:\.\d+)?$/.test(e.value))return Ur(t,`hue-rotate(${e.value}deg)`);return}}},km=(e)=>Ea[e.base]?{"border-collapse":Ea[e.base]}:void 0,Sm=(e,t)=>{if(!e.utility.startsWith("border-spacing")||!e.value)return;let r=t.theme.spacing[e.value];if(r===void 0&&e.arbitrary)r=e.value;if(r===void 0&&/^\d+(?:\.\d+)?$/.test(e.value))r=`${Number.parseFloat(e.value)*0.25}rem`;if(r===void 0)return;if(e.utility==="border-spacing")return{"border-spacing":`${r} ${r}`};if(e.utility==="border-spacing-x")return{"border-spacing":`${r} 0`};if(e.utility==="border-spacing-y")return{"border-spacing":`0 ${r}`}},Am=(e)=>{if(e.utility==="table"&&e.value){let t={auto:"auto",fixed:"fixed"};return t[e.value]?{"table-layout":t[e.value]}:void 0}return},Em=(e)=>Ta[e.base]?{"caption-side":Ta[e.base]}:void 0,Tm=(e,t)=>{if(e.utility==="accent"&&e.value){let r=z(e.value,t,e.modifierArbitrary);if(r)return{"accent-color":r}}},Nm=(e)=>{let t={"appearance-none":"none","appearance-auto":"auto","appearance-base":"base"};return t[e.base]?{appearance:t[e.base]}:void 0},Om=(e,t)=>{if(e.utility==="caret"&&e.value){let r=z(e.value,t,e.modifierArbitrary);if(r)return{"caret-color":r}}},Im={normal:"normal",light:"light",dark:"dark","light-dark":"light dark","only-dark":"only dark","only-light":"only light"},Ga=(e)=>{let t=e.base,r=t.startsWith("scheme-")?t.slice(7):t.startsWith("color-scheme-")?t.slice(13):void 0;if(r===void 0)return;let n=Im[r];return n?{"color-scheme":n}:void 0},Pm=(e)=>Na[e.base]?{"field-sizing":Na[e.base]}:void 0,_m=(e)=>Oa[e.base]?{cursor:Oa[e.base]}:void 0,Lm=(e)=>Ia[e.base]?{"pointer-events":Ia[e.base]}:void 0,Mm=(e)=>Pa[e.base]?{resize:Pa[e.base]}:void 0,Fm=(e)=>_a[e.base]?{"scroll-behavior":_a[e.base]}:void 0,jm=(e,t)=>{let n={"scroll-m":["scroll-margin"],"scroll-mx":["scroll-margin-left","scroll-margin-right"],"scroll-my":["scroll-margin-top","scroll-margin-bottom"],"scroll-mt":["scroll-margin-top"],"scroll-mr":["scroll-margin-right"],"scroll-mb":["scroll-margin-bottom"],"scroll-ml":["scroll-margin-left"]}[e.utility];if(!n||!e.value)return;let i=t.theme.spacing[e.value];if(i===void 0&&e.arbitrary)i=e.value;if(i===void 0&&/^\d+(?:\.\d+)?$/.test(e.value))i=`${Number.parseFloat(e.value)*0.25}rem`;if(i===void 0)return;let o={};for(let s of n)o[s]=i;return o},Dm=(e,t)=>{let n={"scroll-p":["scroll-padding"],"scroll-px":["scroll-padding-left","scroll-padding-right"],"scroll-py":["scroll-padding-top","scroll-padding-bottom"],"scroll-pt":["scroll-padding-top"],"scroll-pr":["scroll-padding-right"],"scroll-pb":["scroll-padding-bottom"],"scroll-pl":["scroll-padding-left"]}[e.utility];if(!n||!e.value)return;let i=t.theme.spacing[e.value];if(i===void 0&&e.arbitrary)i=e.value;if(i===void 0&&/^\d+(?:\.\d+)?$/.test(e.value))i=`${Number.parseFloat(e.value)*0.25}rem`;if(i===void 0)return;let o={};for(let s of n)o[s]=i;return o},Bm=(e)=>{if(La[e.base])return{"scroll-snap-type":La[e.base]};if(Ma[e.base])return{"--tc-scroll-snap-strictness":Ma[e.base]};if(Fa[e.base])return{"scroll-snap-align":Fa[e.base]};if(ja[e.base])return{"scroll-snap-stop":ja[e.base]}},Um=(e)=>Da[e.base]?{"touch-action":Da[e.base]}:void 0,Vm=(e)=>Ba[e.base]?{"user-select":Ba[e.base]}:void 0,Wm=(e)=>Ua[e.base]?{"will-change":Ua[e.base]}:void 0,zm=(e,t)=>{if(e.utility==="fill"&&e.value){if(e.value==="none")return{fill:"none"};let r=z(e.value,t,e.modifierArbitrary);if(r)return{fill:r}}},Km=(e,t)=>{if(e.utility==="stroke"&&e.value){if(e.value==="none")return{stroke:"none"};let r=z(e.value,t,e.modifierArbitrary);if(r)return{stroke:r}}},Gm=(e)=>{if(e.utility==="stroke"&&e.value){if(e.arbitrary||/^\d+(?:\.\d+)?$/.test(e.value))return{"stroke-width":e.value};return}},Hm=(e)=>{if(e.utility==="stroke-dasharray"&&e.value){if(e.value==="none")return{"stroke-dasharray":"none"};if(e.arbitrary||/^\d+(?:\.\d+)?$/.test(e.value))return{"stroke-dasharray":e.value};return}},qm=(e)=>{if(e.utility==="stroke-dashoffset"&&e.value){if(e.arbitrary||/^-?\d+(?:\.\d+)?$/.test(e.value))return{"stroke-dashoffset":e.value};return}},Ym=(e)=>Va[e.base]?{"stroke-linecap":Va[e.base]}:void 0,Jm=(e)=>Wa[e.base]?{"stroke-linejoin":Wa[e.base]}:void 0,Xm=(e)=>{if(e.base==="sr-only")return{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)","white-space":"nowrap","border-width":"0"};if(e.base==="not-sr-only")return{position:"static",width:"auto",height:"auto",padding:"0",margin:"0",overflow:"visible",clip:"auto","white-space":"normal"};return},Zm=(e)=>za[e.base]?{"forced-color-adjust":za[e.base]}:void 0,Ja=[Cm,Rm,km,Sm,Am,Em,Tm,Nm,Ga,Om,Ga,Pm,_m,Lm,Mm,Fm,jm,Dm,Bm,Um,Vm,Wm,zm,Km,Gm,Hm,qm,Ym,Jm,Xm,Zm];function $e(e,t){let r=e/t*100;if(!Number.isFinite(r))return;return`${Qm(r)}%`}function Qm(e){if(Number.isInteger(e))return String(e);return e.toFixed(6).replace(/\.?0+$/,"")}var Xa={"column-fill-auto":"auto","column-fill-balance":"balance","column-fill-balance-all":"balance-all"},Za={"column-span-all":"all","column-span-none":"none"},Qa={"box-decoration-clone":"clone","box-decoration-slice":"slice"},el={"box-border":"border-box","box-content":"content-box"},tl={"float-start":"inline-start","float-end":"inline-end","float-right":"right","float-left":"left","float-none":"none"},rl={"clear-start":"inline-start","clear-end":"inline-end","clear-left":"left","clear-right":"right","clear-both":"both","clear-none":"none"},nl={isolate:"isolate","isolation-auto":"auto"},il={"object-contain":"contain","object-cover":"cover","object-fill":"fill","object-none":"none","object-scale-down":"scale-down"},ol={"object-bottom":"bottom","object-center":"center","object-left":"left","object-left-bottom":"left bottom","object-left-top":"left top","object-right":"right","object-right-bottom":"right bottom","object-right-top":"right top","object-top":"top"},sl={"overscroll-auto":"auto","overscroll-contain":"contain","overscroll-none":"none","overscroll-x-auto":"auto","overscroll-x-contain":"contain","overscroll-x-none":"none","overscroll-y-auto":"auto","overscroll-y-contain":"contain","overscroll-y-none":"none"},al={visible:"visible",invisible:"hidden",collapse:"collapse"},ep=(e)=>{if(e.utility==="aspect"&&e.value){let t={auto:"auto",square:"1 / 1",video:"16 / 9"};if(t[e.value])return{"aspect-ratio":t[e.value]};if(e.arbitrary)return{"aspect-ratio":e.value};let r=e.value.match(/^(\d+(?:\.\d+)?)\/(\d+(?:\.\d+)?)$/);if(r)return{"aspect-ratio":`${r[1]} / ${r[2]}`};if(/^\d+(?:\.\d+)?$/.test(e.value))return{"aspect-ratio":e.value};return}},tp=(e,t)=>{if(e.utility==="columns"&&e.value){let r={"1":"1","2":"2","3":"3","4":"4","5":"5","6":"6","7":"7","8":"8","9":"9","10":"10","11":"11","12":"12",auto:"auto"},n={"3xs":"16rem","2xs":"18rem",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem"};if(r[e.value])return{columns:r[e.value]};if(n[e.value])return{columns:n[e.value]};if(t.theme.spacing[e.value])return{columns:t.theme.spacing[e.value]};if(e.arbitrary||/^\d+$/.test(e.value))return{columns:e.value};return}},rp=(e)=>Xa[e.base]?{"column-fill":Xa[e.base]}:void 0,np=(e,t)=>{if(e.utility==="column-gap"&&e.value){let r=t.theme.spacing[e.value];if(r===void 0&&e.arbitrary)r=e.value;if(r===void 0&&/^\d+(?:\.\d+)?$/.test(e.value))r=`${Number.parseFloat(e.value)*0.25}rem`;return r!==void 0?{"column-gap":r}:void 0}},ip=(e,t)=>{if(e.utility==="column-rule"&&e.value){let r={"0":"0px","1":"1px","2":"2px","4":"4px","8":"8px"};if(r[e.value])return{"column-rule-width":r[e.value]};let n=e.value.split("-");if(n.length===2){let[s,l]=n,a=t.theme.colors[s];if(typeof a==="object"&&a[l])return{"column-rule-color":W(e.value,a[l],s,t.colorVariables)}}let i=t.theme.colors[e.value];if(typeof i==="string")return{"column-rule-color":W(e.value,i,e.value,t.colorVariables)};if(typeof i==="object"&&i!==null&&typeof i.DEFAULT==="string")return{"column-rule-color":W(e.value,i.DEFAULT,e.value,t.colorVariables)};let o={solid:"solid",dashed:"dashed",dotted:"dotted",double:"double",hidden:"hidden",none:"none"};if(o[e.value])return{"column-rule-style":o[e.value]}}},op=(e)=>Za[e.base]?{"column-span":Za[e.base]}:void 0,sp=(e)=>({"break-before-auto":{"break-before":"auto"},"break-before-avoid":{"break-before":"avoid"},"break-before-all":{"break-before":"all"},"break-before-avoid-page":{"break-before":"avoid-page"},"break-before-page":{"break-before":"page"},"break-after-auto":{"break-after":"auto"},"break-after-avoid":{"break-after":"avoid"},"break-after-all":{"break-after":"all"},"break-after-avoid-page":{"break-after":"avoid-page"},"break-after-page":{"break-after":"page"},"break-inside-auto":{"break-inside":"auto"},"break-inside-avoid":{"break-inside":"avoid"},"break-inside-avoid-page":{"break-inside":"avoid-page"},"break-inside-avoid-column":{"break-inside":"avoid-column"}})[e.base],ap=(e)=>Qa[e.base]?{"box-decoration-break":Qa[e.base]}:void 0,lp=(e)=>el[e.base]?{"box-sizing":el[e.base]}:void 0,cp=(e)=>tl[e.base]?{float:tl[e.base]}:void 0,up=(e)=>rl[e.base]?{clear:rl[e.base]}:void 0,fp=(e)=>nl[e.base]?{isolation:nl[e.base]}:void 0,ll=["size","inline-size","layout","paint","style"],dp=ll.map((e)=>`var(--tc-contain-${e}, )`).join(" "),hp=["none","content","strict"],gp=(e)=>{if(e.utility!=="contain"||!e.value)return;if(e.arbitrary)return{contain:e.value};if(hp.includes(e.value))return{contain:e.value};if(ll.includes(e.value))return{[`--tc-contain-${e.value}`]:e.value,contain:dp};return},mp=(e)=>il[e.base]?{"object-fit":il[e.base]}:void 0,pp=(e)=>ol[e.base]?{"object-position":ol[e.base]}:void 0,yp=(e)=>{if(e.utility==="overflow"){let t=["auto","hidden","clip","visible","scroll"];if(e.value&&t.includes(e.value))return{overflow:e.value}}if(e.utility==="overflow-x"||e.utility==="overflow-y"){let t=["auto","hidden","clip","visible","scroll"];if(e.value&&t.includes(e.value))return{[e.utility]:e.value}}},bp=(e)=>{let t=e.base.startsWith("overscroll-x")?"overscroll-behavior-x":e.base.startsWith("overscroll-y")?"overscroll-behavior-y":"overscroll-behavior";return sl[e.base]?{[t]:sl[e.base]}:void 0},xp=(e)=>{if(["static","fixed","absolute","relative","sticky"].includes(e.utility))return{position:e.utility}},vp=(e,t)=>{let n={inset:["top","right","bottom","left"],"inset-x":["left","right"],"inset-y":["top","bottom"],top:["top"],right:["right"],bottom:["bottom"],left:["left"],start:["inset-inline-start"],end:["inset-inline-end"]}[e.utility];if(!n||!e.value)return;let i=(l)=>{if(l.includes("/")&&!e.arbitrary){let[c,u]=l.split("/").map(Number);if(!Number.isNaN(c)&&!Number.isNaN(u)&&u!==0)return $e(c,u);return}if(l==="full")return"100%";if(l==="auto")return"auto";if(e.arbitrary)return l;let a=t.theme.spacing[l];if(a!==void 0)return a;if(/^\d+(?:\.\d+)?$/.test(l))return`${Number.parseFloat(l)*0.25}rem`;return},o;if(e.value.startsWith("-")){let l=e.value.slice(1),a=i(l);if(a===void 0)o=void 0;else if(a.endsWith("%"))o=`${-Number.parseFloat(a)}%`;else o=a.startsWith("-")?a:`-${a}`}else o=i(e.value);if(o===void 0)return;let s={};for(let l of n)s[l]=o;return s},wp=(e)=>al[e.utility]?{visibility:al[e.utility]}:void 0,$p=(e)=>{if(e.utility==="z"&&e.value){if(e.arbitrary||e.value==="auto"||/^-?\d+$/.test(e.value))return{"z-index":e.value};return}},cl=[ep,tp,rp,np,ip,op,sp,ap,lp,cp,up,gp,fp,mp,pp,yp,bp,xp,vp,wp,$p];var Cp={rotate:"rotate","rotate-x":"rotateX","rotate-y":"rotateY","rotate-z":"rotateZ"},Rp={"translate-x":"translateX","translate-y":"translateY","translate-z":"translateZ"},ul={"backface-visible":"visible","backface-hidden":"hidden"},fl={"transform-flat":"flat","transform-3d":"preserve-3d"},dl={"transition-none":"none","transition-all":"all",transition:"color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter","transition-colors":"color, background-color, border-color, text-decoration-color, fill, stroke","transition-opacity":"opacity","transition-shadow":"box-shadow","transition-transform":"transform"},hl={"ease-linear":"linear","ease-in":"cubic-bezier(0.4, 0, 1, 1)","ease-out":"cubic-bezier(0, 0, 0.2, 1)","ease-in-out":"cubic-bezier(0.4, 0, 0.2, 1)","ease-initial":"initial"},gl={"transition-normal":"normal","transition-discrete":"allow-discrete","transition-behavior-normal":"normal","transition-behavior-allow-discrete":"allow-discrete"},ml={none:"none",spin:"spin 1s linear infinite",ping:"ping 1s cubic-bezier(0, 0, 0.2, 1) infinite",pulse:"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",bounce:"bounce 1s infinite"},pl={"animate-running":"running","animate-paused":"paused"},yl={"animate-normal":"normal","animate-reverse":"reverse","animate-alternate":"alternate","animate-alternate-reverse":"alternate-reverse"},bl={"animate-fill-none":"none","animate-fill-forwards":"forwards","animate-fill-backwards":"backwards","animate-fill-both":"both"},xl={"animate-ease-linear":"linear","animate-ease-in":"cubic-bezier(0.4, 0, 1, 1)","animate-ease-out":"cubic-bezier(0, 0, 0.2, 1)","animate-ease-in-out":"cubic-bezier(0.4, 0, 0.2, 1)"},vl="rotate(var(--tc-rotate, 0deg)) skewX(var(--tc-skew-x, 0deg)) skewY(var(--tc-skew-y, 0deg)) scaleX(var(--tc-scale-x, 1)) scaleY(var(--tc-scale-y, 1))",Lt=`translate(var(--tc-translate-x, 0), var(--tc-translate-y, 0)) ${vl}`,Ri=`translate3d(var(--tc-translate-x, 0), var(--tc-translate-y, 0), 0) ${vl}`,kp={transform:Lt,"transform-cpu":Lt,"transform-gpu":Ri,"transform-none":"none"},Sp=(e)=>{let t=kp[e.base];return t?{transform:t}:void 0};function Vr(e,t){if(!t.value)return{transform:`${e}(1)`};if(t.arbitrary)return{transform:`${e}(${t.value})`};if(/^-?\d+(?:\.\d+)?$/.test(t.value))return{transform:`${e}(${Number(t.value)/100})`};return}function Ci(e){let t=e.value;if(e.arbitrary)return t;if(/^-?\d+(?:\.\d+)?$/.test(t))return`${t}deg`;if(/^-?\d+(?:\.\d+)?(?:deg|rad|grad|turn)$/.test(t))return t;return}var Ap=(e)=>{if(e.utility==="scale")return Vr("scale",e);if(e.utility==="scale-x")return Vr("scaleX",e);if(e.utility==="scale-y")return Vr("scaleY",e);if(e.utility==="scale-z")return Vr("scaleZ",e)},Ep=(e)=>{if(!e.value)return;let t=Cp[e.utility];if(!t)return;let r=Ci(e);return r!==void 0?{transform:`${t}(${r})`}:void 0},Tp=(e,t)=>{let r=(o)=>{if(o.includes("/")){let[l,a]=o.split("/");return $e(Number(l),Number(a))}if(o==="full")return"100%";if(o==="half")return"50%";if(e.arbitrary)return o;let s=t.theme.spacing[o];if(s!==void 0)return s;if(/^\d+(?:\.\d+)?$/.test(o))return`${Number.parseFloat(o)*0.25}rem`;return},n=Rp[e.utility];if(!n||!e.value)return;let i;if(e.value.startsWith("-")){let o=r(e.value.slice(1));i=o===void 0?void 0:`-${o}`}else i=r(e.value);return i!==void 0?{transform:`${n}(${i})`}:void 0},Np=(e)=>{if(e.utility==="skew-x"&&e.value){let t=Ci(e);return t!==void 0?{transform:`skewX(${t})`}:void 0}if(e.utility==="skew-y"&&e.value){let t=Ci(e);return t!==void 0?{transform:`skewY(${t})`}:void 0}},Op=(e)=>{if(e.utility==="origin"&&e.value){if(e.arbitrary)return{"transform-origin":e.value.replace(/_/g," ")};let t={center:"center",top:"top","top-right":"top right",right:"right","bottom-right":"bottom right",bottom:"bottom","bottom-left":"bottom left",left:"left","top-left":"top left"};return t[e.value]?{"transform-origin":t[e.value]}:void 0}return},Ip={dramatic:"100px",near:"300px",normal:"500px",midrange:"800px",distant:"1200px"},Pp=(e)=>{if(e.utility==="perspective"&&e.value){if(e.value==="none")return{perspective:"none"};if(e.arbitrary||/^\d+(?:\.\d+)?(?:px|rem|em)$/.test(e.value))return{perspective:e.value};let t=Ip[e.value];if(t)return{perspective:t};if(/^\d+(?:\.\d+)?$/.test(e.value))return{perspective:`${e.value}px`};return}return},_p=(e)=>{if(e.utility==="perspective-origin"&&e.value)return{"perspective-origin":{center:"center",top:"top","top-right":"top right",right:"right","bottom-right":"bottom right",bottom:"bottom","bottom-left":"bottom left",left:"left","top-left":"top left"}[e.value]||e.value}},Lp=(e)=>ul[e.base]?{"backface-visibility":ul[e.base]}:void 0,Mp=(e)=>fl[e.base]?{"transform-style":fl[e.base]}:void 0,Fp=(e)=>dl[e.base]?{"transition-property":dl[e.base]}:void 0;function Wr(e,t){let r=e.value;if(t[r])return t[r];if(e.arbitrary)return r;if(/^\d+(?:\.\d+)?$/.test(r))return`${r}ms`;return}var jp=(e)=>{if(e.utility==="duration"&&e.value){let r=Wr(e,{"0":"0s","75":"75ms","100":"100ms","150":"150ms","200":"200ms","300":"300ms","500":"500ms","700":"700ms","1000":"1000ms"});return r!==void 0?{"transition-duration":r}:void 0}},Dp=(e)=>hl[e.base]?{"transition-timing-function":hl[e.base]}:void 0,Bp=(e)=>{if(e.utility==="delay"&&e.value){let r=Wr(e,{"0":"0s","75":"75ms","100":"100ms","150":"150ms","200":"200ms","300":"300ms","500":"500ms","700":"700ms","1000":"1000ms"});return r!==void 0?{"transition-delay":r}:void 0}},Up=(e)=>gl[e.base]?{"transition-behavior":gl[e.base]}:void 0,Vp=(e)=>{if(e.utility!=="animate")return;if(e.arbitrary&&e.value)return{animation:e.value.replace(/_/g," ")};if(e.value&&ml[e.value])return{animation:ml[e.value]};return},Wp=(e)=>pl[e.base]?{"animation-play-state":pl[e.base]}:void 0,zp=(e)=>yl[e.base]?{"animation-direction":yl[e.base]}:void 0,Kp=(e)=>bl[e.base]?{"animation-fill-mode":bl[e.base]}:void 0,Gp=(e)=>{if(e.utility==="animate-iteration"&&e.value){if(e.value==="infinite"||e.arbitrary||/^\d+(?:\.\d+)?$/.test(e.value))return{"animation-iteration-count":e.value};return}},Hp=(e)=>{if(e.utility==="animate-duration"&&e.value){let r=Wr(e,{"75":"75ms","100":"100ms","150":"150ms","200":"200ms","300":"300ms","500":"500ms","700":"700ms","1000":"1000ms"});return r!==void 0?{"animation-duration":r}:void 0}},qp=(e)=>{if(e.utility==="animate-delay"&&e.value){let r=Wr(e,{"75":"75ms","100":"100ms","150":"150ms","200":"200ms","300":"300ms","500":"500ms","700":"700ms","1000":"1000ms"});return r!==void 0?{"animation-delay":r}:void 0}},Yp=(e)=>xl[e.base]?{"animation-timing-function":xl[e.base]}:void 0,wl=[Sp,Ap,Ep,Tp,Np,Op,Pp,_p,Lp,Mp,Fp,Up,jp,Dp,Bp,Vp,Wp,zp,Kp,Gp,Hp,qp,Yp];var $l={italic:"italic","not-italic":"normal"},Cl={"normal-nums":"normal",ordinal:"ordinal","slashed-zero":"slashed-zero","lining-nums":"lining-nums","oldstyle-nums":"oldstyle-nums","proportional-nums":"proportional-nums","tabular-nums":"tabular-nums","diagonal-fractions":"diagonal-fractions","stacked-fractions":"stacked-fractions"},Rl={"list-inside":"inside","list-outside":"outside"},kl={none:"none",disc:"disc",decimal:"decimal"},Sl={underline:"underline",overline:"overline","line-through":"line-through","no-underline":"none"},Al={uppercase:"uppercase",lowercase:"lowercase",capitalize:"capitalize","normal-case":"none"},El={"text-wrap":"wrap","text-nowrap":"nowrap","text-balance":"balance","text-pretty":"pretty"},Tl={"align-baseline":"baseline","align-top":"top","align-middle":"middle","align-bottom":"bottom","align-text-top":"text-top","align-text-bottom":"text-bottom","align-sub":"sub","align-super":"super"},Nl={"whitespace-normal":"normal","whitespace-nowrap":"nowrap","whitespace-pre":"pre","whitespace-pre-line":"pre-line","whitespace-pre-wrap":"pre-wrap","whitespace-break-spaces":"break-spaces"},Ol={"break-all":"break-all","break-keep":"keep-all"},Il={"hyphens-none":"none","hyphens-manual":"manual","hyphens-auto":"auto"},Pl={"writing-horizontal-tb":"horizontal-tb","writing-vertical-rl":"vertical-rl","writing-vertical-lr":"vertical-lr"},_l={"text-orientation-mixed":"mixed","text-orientation-upright":"upright","text-orientation-sideways":"sideways"},Ll={"direction-ltr":"ltr","direction-rtl":"rtl"},Ml={"small-caps":"small-caps","all-small-caps":"all-small-caps","petite-caps":"petite-caps","all-petite-caps":"all-petite-caps",unicase:"unicase","titling-caps":"titling-caps","normal-caps":"normal"},Fl={"ligatures-normal":"normal","ligatures-none":"none","common-ligatures":"common-ligatures","no-common-ligatures":"no-common-ligatures","discretionary-ligatures":"discretionary-ligatures","no-discretionary-ligatures":"no-discretionary-ligatures","historical-ligatures":"historical-ligatures","no-historical-ligatures":"no-historical-ligatures",contextual:"contextual","no-contextual":"no-contextual"},Jp=(e,t)=>{if(e.utility==="font"&&e.value){let r=t.theme.fontFamily[e.value];if(r)return{"font-family":r.join(", ")}}},Xp=(e)=>({antialiased:{"-webkit-font-smoothing":"antialiased","-moz-osx-font-smoothing":"grayscale"},"subpixel-antialiased":{"-webkit-font-smoothing":"auto","-moz-osx-font-smoothing":"auto"}})[e.base],Zp=(e)=>$l[e.base]?{"font-style":$l[e.base]}:void 0,Qp=(e)=>{if(e.utility==="font-stretch"&&e.value){if(["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"].includes(e.value))return{"font-stretch":e.value};if(e.arbitrary||/^\d+(?:\.\d+)?%$/.test(e.value))return{"font-stretch":e.value};return}},ey=(e)=>Cl[e.base]?{"font-variant-numeric":Cl[e.base]}:void 0,ty=(e)=>{if(e.utility==="tracking"){let t={tighter:"-0.05em",tight:"-0.025em",normal:"0em",wide:"0.025em",wider:"0.05em",widest:"0.1em"};if(!e.value)return;if(e.arbitrary)return{"letter-spacing":e.value};if(e.value.startsWith("-")){let r=e.value.slice(1);return t[r]?{"letter-spacing":`-${t[r]}`}:void 0}return t[e.value]?{"letter-spacing":t[e.value]}:void 0}},ry=(e)=>{if(e.utility==="line-clamp"&&e.value){if(e.value==="none")return{overflow:"visible",display:"block","-webkit-box-orient":"horizontal","-webkit-line-clamp":"none"};if(!e.arbitrary&&!/^\d+$/.test(e.value))return;return{overflow:"hidden",display:"-webkit-box","-webkit-box-orient":"vertical","-webkit-line-clamp":e.value}}},ny=(e)=>{if(e.utility==="list-image"&&e.value){if(e.value==="none")return{"list-style-image":"none"};if(e.arbitrary)return{"list-style-image":e.value};return{"list-style-image":`url(${e.value})`}}},iy=(e)=>Rl[e.base]?{"list-style-position":Rl[e.base]}:void 0,oy=(e)=>{if(e.utility!=="list"||!e.value)return;return kl[e.value]?{"list-style-type":kl[e.value]}:void 0},sy=(e,t)=>{if(Sl[e.base])return{"text-decoration-line":Sl[e.base]};if(e.utility==="decoration"&&e.value){let r={solid:"solid",double:"double",dotted:"dotted",dashed:"dashed",wavy:"wavy"};if(r[e.value])return{"text-decoration-style":r[e.value]};let n={auto:"auto","from-font":"from-font","0":"0px","1":"1px","2":"2px","4":"4px","8":"8px"};if(n[e.value])return{"text-decoration-thickness":n[e.value]};if(e.arbitrary)return{"text-decoration-thickness":e.value};let i=z(e.value,t,e.modifierArbitrary);if(i)return{"text-decoration-color":i};return}return},ay=(e)=>{if(e.utility==="underline-offset"&&e.value){let t={auto:"auto",0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"};if(t[e.value])return{"text-underline-offset":t[e.value]};if(e.arbitrary)return{"text-underline-offset":e.value};if(/^\d+(?:\.\d+)?$/.test(e.value))return{"text-underline-offset":`${e.value}px`};return}},ly=(e)=>Al[e.base]?{"text-transform":Al[e.base]}:void 0,cy=(e)=>({truncate:{overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"},"text-ellipsis":{"text-overflow":"ellipsis"},"text-clip":{"text-overflow":"clip"}})[e.base],uy=(e)=>El[e.base]?{"text-wrap":El[e.base]}:void 0,fy=(e,t)=>{if(e.utility==="indent"&&e.value){if(e.arbitrary)return{"text-indent":e.value};let r=(i)=>{let o=t.theme.spacing[i];if(o!==void 0)return o;if(/^\d+(?:\.\d+)?$/.test(i))return`${Number.parseFloat(i)*0.25}rem`;return};if(e.value.startsWith("-")){let i=r(e.value.slice(1));return i!==void 0?{"text-indent":`-${i}`}:void 0}let n=r(e.value);return n!==void 0?{"text-indent":n}:void 0}},dy=(e)=>Tl[e.base]?{"vertical-align":Tl[e.base]}:void 0,hy=(e)=>Nl[e.base]?{"white-space":Nl[e.base]}:void 0,gy=(e)=>{if(e.base==="break-normal")return{"overflow-wrap":"normal","word-break":"normal"};if(e.base==="break-words")return{"overflow-wrap":"break-word"};return Ol[e.base]?{"word-break":Ol[e.base]}:void 0},my=(e)=>{let t={"overflow-wrap-normal":"normal","overflow-wrap-break":"break-word","overflow-wrap-anywhere":"anywhere","wrap-normal":"normal","wrap-break-word":"break-word","wrap-anywhere":"anywhere"};return t[e.base]?{"overflow-wrap":t[e.base]}:void 0},py=(e)=>{if(e.utility!=="tab"||!e.value)return;if(e.arbitrary||/^\d+$/.test(e.value))return{"tab-size":e.value};return},yy=(e)=>Il[e.base]?{hyphens:Il[e.base]}:void 0,by=(e)=>{if(e.utility==="content"&&e.value){let t={none:"none"};if(t[e.value]||e.value.startsWith('"')||e.value.startsWith("'"))return{content:t[e.value]||e.value};if(e.arbitrary)return{content:e.value};return}},xy=(e,t)=>{if(e.utility==="leading"){if(!e.value)return;let r={none:"1",tight:"1.25",snug:"1.375",normal:"1.5",relaxed:"1.625",loose:"2",3:".75rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem"};if(r[e.value])return{"line-height":r[e.value]};if(e.arbitrary)return{"line-height":e.value};if(/^\d+(?:\.\d+)?$/.test(e.value))return{"line-height":`${Number.parseFloat(e.value)*0.25}rem`};return}},vy=(e)=>Pl[e.base]?{"writing-mode":Pl[e.base]}:void 0,wy=(e)=>_l[e.base]?{"text-orientation":_l[e.base]}:void 0,$y=(e)=>Ll[e.base]?{direction:Ll[e.base]}:void 0,Cy=(e)=>{if(e.utility==="text-emphasis"&&e.value){let t={none:"none",filled:"filled",open:"open",dot:"dot",circle:"circle","double-circle":"double-circle",triangle:"triangle",sesame:"sesame"};if(t[e.value])return{"text-emphasis":t[e.value]};return e.arbitrary?{"text-emphasis":e.value}:void 0}},Ry=(e,t)=>{if(e.utility==="text-emphasis-color"&&e.value){let r=e.value.split("-");if(r.length===2){let[i,o]=r,s=t.theme.colors[i];if(typeof s==="object"&&s[o])return{"text-emphasis-color":W(e.value,s[o],i,t.colorVariables)}}let n=t.theme.colors[e.value];if(typeof n==="string")return{"text-emphasis-color":W(e.value,n,e.value,t.colorVariables)};if(typeof n==="object"&&n!==null&&typeof n.DEFAULT==="string")return{"text-emphasis-color":W(e.value,n.DEFAULT,e.value,t.colorVariables)}}},ky=(e,t)=>{if(e.utility==="word-spacing"&&e.value){let r={tighter:"-0.05em",tight:"-0.025em",normal:"normal",wide:"0.025em",wider:"0.05em",widest:"0.1em"};if(r[e.value])return{"word-spacing":r[e.value]};if(t.theme.spacing[e.value])return{"word-spacing":t.theme.spacing[e.value]};if(e.arbitrary)return{"word-spacing":e.value};return}},Sy=(e)=>Ml[e.base]?{"font-variant-caps":Ml[e.base]}:void 0,Ay=(e)=>Fl[e.base]?{"font-variant-ligatures":Fl[e.base]}:void 0,jl=[Jp,Xp,Zp,Qp,ey,Sy,Ay,ty,xy,ry,ny,iy,oy,sy,ay,ly,cy,uy,fy,dy,hy,gy,my,py,yy,by,vy,wy,$y,Cy,Ry,ky];var Dl={"flex-row":"row","flex-row-reverse":"row-reverse","flex-col":"column","flex-col-reverse":"column-reverse"},Bl={"flex-wrap":"wrap","flex-wrap-reverse":"wrap-reverse","flex-nowrap":"nowrap"},ki={0:"0px",2:"2px",4:"4px",8:"8px"},Ey=(e)=>{if(["block","inline-block","inline","flex","inline-flex","grid","inline-grid","hidden","none","contents","flow-root","list-item"].includes(e.utility)&&!e.value)return{display:e.utility==="hidden"?"none":e.utility};if(e.utility==="table"){if(!e.value)return{display:"table"};if(new Set(["cell","row","row-group","column","column-group","header-group","footer-group","caption"]).has(e.value))return{display:`table-${e.value}`}}if(e.utility==="inline"&&e.value==="table")return{display:"inline-table"};if(e.utility==="flow"&&e.value==="root")return{display:"flow-root"};if(e.utility==="list"&&e.value==="item")return{display:"list-item"}},Ty=(e)=>{if(e.utility==="scrollbar"&&e.value){let r={auto:"auto",thin:"thin",none:"none"}[e.value];if(r)return{"scrollbar-width":r}}},Ny=(e)=>{if(e.utility==="content"){if(e.value==="none")return{content:"none"};if(e.value==="empty")return{content:'""'};if(e.arbitrary&&e.value)return{content:e.value}}},Oy=(e)=>{if(e.utility==="@container")return{"container-type":"inline-size"};if(e.utility==="@container-normal")return{"container-type":"normal"};if(e.utility.startsWith("@container/"))return{"container-type":"inline-size","container-name":e.utility.slice(11)}},Iy=(e)=>Dl[e.utility]?{"flex-direction":Dl[e.utility]}:void 0,Py=(e)=>Bl[e.utility]?{"flex-wrap":Bl[e.utility]}:void 0,_y=(e)=>{if(e.utility==="flex"||e.utility.startsWith("flex-")){let t={"flex-1":"1 1 0%","flex-auto":"1 1 auto","flex-initial":"0 1 auto","flex-none":"none"};if(t[e.utility])return{flex:t[e.utility]};if(e.utility==="flex"&&e.arbitrary&&e.value)return{flex:e.value.replace(/_/g," ")}}return},Ly=(e)=>{if(e.utility==="flex-grow"&&!e.value)return{"flex-grow":"1"};if(e.utility==="flex-grow"&&e.value)return{"flex-grow":e.value}},My=(e)=>{if(e.utility==="flex-shrink"&&!e.value)return{"flex-shrink":"1"};if(e.utility==="flex-shrink"&&e.value)return{"flex-shrink":e.value}},Fy=(e)=>{if(e.utility==="justify"&&e.value){let t={start:"flex-start",end:"flex-end",center:"center",between:"space-between",around:"space-around",evenly:"space-evenly"};if(t[e.value])return{"justify-content":t[e.value]};if(e.arbitrary)return{"justify-content":e.value}}return},jy=(e)=>{if(e.utility==="items"&&e.value){let t={start:"flex-start",end:"flex-end",center:"center",baseline:"baseline",stretch:"stretch"};if(t[e.value])return{"align-items":t[e.value]};if(e.arbitrary)return{"align-items":e.value}}return},Dy=(e)=>{if(e.utility==="justify"&&e.value&&e.value.startsWith("items-")){let t={"items-start":"start","items-end":"end","items-center":"center","items-stretch":"stretch","items-center-safe":"safe center","items-end-safe":"safe end"};return t[e.value]?{"justify-items":t[e.value]}:void 0}return},By=(e)=>{if(e.utility==="content"&&e.value){let t={normal:"normal",center:"center",start:"flex-start",end:"flex-end",between:"space-between",around:"space-around",evenly:"space-evenly",baseline:"baseline",stretch:"stretch"};return t[e.value]?{"align-content":t[e.value]}:void 0}return},Uy=(e,t)=>{let n={p:["padding"],px:["padding-left","padding-right"],py:["padding-top","padding-bottom"],pt:["padding-top"],pr:["padding-right"],pb:["padding-bottom"],pl:["padding-left"],ps:["padding-inline-start"],pe:["padding-inline-end"],m:["margin"],mx:["margin-left","margin-right"],my:["margin-top","margin-bottom"],mt:["margin-top"],mr:["margin-right"],mb:["margin-bottom"],ml:["margin-left"],ms:["margin-inline-start"],me:["margin-inline-end"]}[e.utility];if(!n||!e.value)return;let i=(l)=>{if(l==="auto")return e.utility.charCodeAt(0)===109?"auto":void 0;let a=t.theme.spacing[l];if(a!==void 0)return a;if(e.arbitrary)return l;if(/^\d+(?:\.\d+)?$/.test(l)){let c=Number.parseFloat(l);if(Number.isFinite(c))return`${c*0.25}rem`}return},o;if(e.value.startsWith("-")){if(e.utility.charCodeAt(0)===112)return;let l=e.value.slice(1);if(l==="0")o=t.theme.spacing[l]||"0";else{let a=i(l);o=a===void 0?void 0:`-${a}`}}else o=i(e.value);if(o===void 0)return;let s={};for(let l of n)s[l]=o;return s};function pe(e,t,r){let n=e.value;if(n.includes("/")&&!e.arbitrary){let[o,s]=n.split("/").map(Number);if(Number.isNaN(o)||Number.isNaN(s)||s===0)return;return $e(o,s)}let i=t.theme.spacing[n];if(i!==void 0)return i;if(r[n])return r[n];if(e.arbitrary)return n;if(/^\d+(?:\.\d+)?$/.test(n))return`${Number.parseFloat(n)*0.25}rem`;return}var Vy=(e,t)=>{if(e.utility==="w"&&e.value){let n=pe(e,t,{full:"100%",screen:"100vw",svw:"100svw",lvw:"100lvw",dvw:"100dvw",auto:"auto",min:"min-content",max:"max-content",fit:"fit-content"});return n!==void 0?{width:n}:void 0}if(e.utility==="h"&&e.value){let n=pe(e,t,{full:"100%",screen:"100vh",svh:"100svh",lvh:"100lvh",dvh:"100dvh",auto:"auto",min:"min-content",max:"max-content",fit:"fit-content"});return n!==void 0?{height:n}:void 0}if(e.utility==="size"&&e.value){let n=pe(e,t,{full:"100%",auto:"auto",min:"min-content",max:"max-content",fit:"fit-content"});return n!==void 0?{width:n,height:n}:void 0}return},je=null,zr=null,Kr,Wy={bg:"background-color",text:"color",border:"border-color"},zy={bg:{color:"background-color",image:"background-image",url:"background-image",position:"background-position",length:"background-size"},text:{color:"color",length:"font-size","absolute-size":"font-size","relative-size":"font-size","family-name":"font-family"},border:{color:"border-color",length:"border-width","line-width":"border-width"}},Ky=new Set(["length","absolute-size","relative-size","percentage","number"]),Gy=/^(?:url|(?:repeating-)?(?:linear|radial|conic)-gradient|image-set|-webkit-image-set|cross-fade|element|paint)\(/i,Vl={current:"currentColor",transparent:"transparent",inherit:"inherit"};function W(e,t,r,n){return n?.includes(r)?`var(--color-${e}, ${t})`:t}function Wl(e,t){let r=new Map;for(let[n,i]of Object.entries(e))if(typeof i==="string")r.set(n,W(n,i,n,t));else if(typeof i==="object"&&i!==null){for(let[o,s]of Object.entries(i))if(typeof s==="string"){let l=o==="DEFAULT"?n:`${n}-${o}`;r.set(l,W(l,s,n,t))}}return r}var Hy=(e,t)=>{let r=Wy[e.utility];if(!r||!e.value)return;let n=e.value;if(e.arbitrary&&e.typeHint){let c=zy[e.utility]?.[e.typeHint];return c?{[c]:n}:void 0}if(e.arbitrary&&e.utility==="bg"&&Gy.test(n))return{"background-image":n};if(je===null||zr!==t.theme.colors||Kr!==t.colorVariables)je=Wl(t.theme.colors,t.colorVariables),zr=t.theme.colors,Kr=t.colorVariables;let i=Oe(n);if(i===-1){let c=je.get(n);if(c)return{[r]:c}}let o,s=n;if(i!==-1){s=n.slice(0,i);let c=n.slice(i+1);if(c.charCodeAt(0)===91&&c.charCodeAt(c.length-1)===93){let f=Number.parseFloat(c.slice(1,-1));if(Number.isNaN(f)||f<0||f>1)return;o=f}else if(e.modifierArbitrary){let f=Number.parseFloat(c);if(Number.isNaN(f)||f<0||f>1)return;o=f}else{let f=Number.parseInt(c,10);if(Number.isNaN(f)||f<0||f>100)return;o=f/100}let u=je.get(s);if(u)return{[r]:we(u,o)}}let l=Vl[s];if(l)return{[r]:l};if((e.arbitrary||s&&s.charCodeAt(0)===91)&&s){let c=o!==void 0?we(s,o):s;return{[r]:c}}return};function we(e,t){let r=e;if(e.charCodeAt(0)===91&&e.charCodeAt(e.length-1)===93)r=e.slice(1,-1);if(r.charCodeAt(0)===35){let n=r.slice(1);if(n.length===3||n.length===4)n=n.split("").map((l)=>l+l).join("");let i=Number.parseInt(n.slice(0,2),16),o=Number.parseInt(n.slice(2,4),16),s=Number.parseInt(n.slice(4,6),16);return`rgb(${i} ${o} ${s} / ${t})`}if(r.charCodeAt(0)===114){let n=r.match(/rgb\((\d+)\s+(\d+)\s+(\d+)/);if(n)return`rgb(${n[1]} ${n[2]} ${n[3]} / ${t})`}if(r.charCodeAt(0)===111){let n=r.match(/oklch\(([^)]+)\)/);if(n)return`oklch(${n[1]} / ${t})`}if(r.charCodeAt(0)===104){let n=r.match(/hsl\(([^)]+)\)/);if(n)return`hsl(${n[1]} / ${t})`}if(r!=="inherit"&&r!=="transparent"){let n=Number((t*100).toFixed(2));return`color-mix(in srgb, ${r} ${n}%, transparent)`}return r}function z(e,t,r=!1){let n=Oe(e),i=e,o;if(n!==-1){i=e.slice(0,n);let f=e.slice(n+1);if(f.charCodeAt(0)===91&&f.charCodeAt(f.length-1)===93){if(o=Number.parseFloat(f.slice(1,-1)),Number.isNaN(o)||o<0||o>1)return}else if(r){if(o=Number.parseFloat(f),Number.isNaN(o)||o<0||o>1)return}else{let d=Number.parseInt(f,10);if(Number.isNaN(d)||d<0||d>100)return;o=d/100}}let s={current:"currentColor",transparent:"transparent",inherit:"inherit",auto:"auto"};if(s[i])return o!==void 0?we(s[i],o):s[i];let l=t.colorVariables,a=t.theme.colors[i],c=typeof a==="string"?W(i,a,i,l):a;if(typeof c==="string")return o!==void 0?we(c,o):c;if(typeof c==="object"&&c!==null&&typeof c.DEFAULT==="string"){let f=W(i,c.DEFAULT,i,l);return o!==void 0?we(f,o):f}let u=i.split("-");if(u.length>=2){let f=u[u.length-1],d=u.slice(0,-1).join("-"),h=t.theme.colors[d];if(typeof h==="object"&&h[f]){let g=W(i,h[f],d,l);return o!==void 0?we(g,o):g}}if(i.startsWith("var(")||i.startsWith("#")||i.startsWith("rgb(")||i.startsWith("rgba(")||i.startsWith("hsl(")||i.startsWith("hsla(")||i.startsWith("oklch(")||i.startsWith("oklab(")||i.startsWith("lab(")||i.startsWith("lch(")||i.startsWith("color(")||i.startsWith("color-mix(")||i.startsWith("hwb("))return o!==void 0?we(i,o):i;return}var qy=(e,t)=>{if(e.utility!=="placeholder"||!e.value)return;if(je===null||zr!==t.theme.colors||Kr!==t.colorVariables)je=Wl(t.theme.colors,t.colorVariables),zr=t.theme.colors,Kr=t.colorVariables;let r=e.value,n=Oe(r);if(n===-1){let o=je.get(r);if(o)return{properties:{color:o},pseudoElement:"::placeholder"}}else{let o=r.slice(0,n),s=r.slice(n+1),l;if(s.charCodeAt(0)===91&&s.charCodeAt(s.length-1)===93){let c=Number.parseFloat(s.slice(1,-1));if(Number.isNaN(c)||c<0||c>1)return;l=c}else if(e.modifierArbitrary){let c=Number.parseFloat(s);if(Number.isNaN(c)||c<0||c>1)return;l=c}else{let c=Number.parseInt(s,10);if(Number.isNaN(c)||c<0||c>100)return;l=c/100}let a=je.get(o);if(a)return{properties:{color:we(a,l)},pseudoElement:"::placeholder"}}let i=Vl[e.value];if(i)return{properties:{color:i},pseudoElement:"::placeholder"};return},Yy=(e,t)=>{if(e.utility==="text"&&e.value){let r=e.value,n,i=r.lastIndexOf("/");if(i!==-1&&!e.value.startsWith("[")&&!r.slice(i+1).includes("]"));if(i!==-1){let s=r.slice(0,i),l=r.slice(i+1);if(l&&(t.theme.fontSize[s]||e.arbitrary)){r=s;let a={none:"1",tight:"1.25",snug:"1.375",normal:"1.5",relaxed:"1.625",loose:"2",3:"0.75rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem"};n=t.theme.lineHeight?.[l]??a[l]??l}}if(e.arbitrary){if(e.typeHint){if(!Ky.has(e.typeHint))return;let l={"font-size":r};if(n)l["line-height"]=n;return l}if(/^#|^rgb|^hsl|^hwb|^lab|^lch|^oklch|^oklab|^color\(|^var\(--/.test(r))return;let s={"font-size":r};if(n)s["line-height"]=n;return s}let o=t.theme.fontSize[r];if(o)return{"font-size":o[0],"line-height":n??o[1].lineHeight}}},Jy=(e)=>{if(e.utility==="font"&&e.value){if(e.arbitrary){let r=e.typeHint;return r==="family-name"||r==="string"?{"font-family":e.value}:{"font-weight":e.value}}let t={thin:"100",extralight:"200",light:"300",normal:"400",medium:"500",semibold:"600",bold:"700",extrabold:"800",black:"900"};return t[e.value]?{"font-weight":t[e.value]}:void 0}return},Xy=(e)=>{if(e.utility==="leading"&&e.value){if(e.arbitrary)return{"line-height":e.value};let t={none:"1",tight:"1.25",snug:"1.375",normal:"1.5",relaxed:"1.625",loose:"2","3":"0.75rem","4":"1rem","5":"1.25rem","6":"1.5rem","7":"1.75rem","8":"2rem","9":"2.25rem","10":"2.5rem"};return t[e.value]?{"line-height":t[e.value]}:void 0}return},Zy=(e)=>{if(e.utility==="text"&&e.value){let t={left:"left",center:"center",right:"right",justify:"justify"};return t[e.value]?{"text-align":t[e.value]}:void 0}},Qy=(e)=>{if(e.utility==="border"){if(!e.value)return{"border-width":"1px"};let t={0:"0px",2:"2px",4:"4px",8:"8px"};if(t[e.value])return{"border-width":t[e.value]};let r={t:"border-top-width",r:"border-right-width",b:"border-bottom-width",l:"border-left-width",s:"border-inline-start-width",e:"border-inline-end-width"};if(e.value==="x")return{"border-left-width":"1px","border-right-width":"1px"};if(e.value==="y")return{"border-top-width":"1px","border-bottom-width":"1px"};let n=r[e.value];if(typeof n==="string")return{[n]:"1px"};return}},eb=(e,t)=>{let r={"border-t":"border-top-width","border-r":"border-right-width","border-b":"border-bottom-width","border-l":"border-left-width","border-x":["border-left-width","border-right-width"],"border-y":["border-top-width","border-bottom-width"],"border-s":"border-inline-start-width","border-e":"border-inline-end-width"},n={"border-t":"border-top-color","border-r":"border-right-color","border-b":"border-bottom-color","border-l":"border-left-color","border-x":["border-left-color","border-right-color"],"border-y":["border-top-color","border-bottom-color"],"border-s":"border-inline-start-color","border-e":"border-inline-end-color"},i=r[e.utility];if(!i)return;if(!e.value){let s=i;if(Array.isArray(s))return s.reduce((l,a)=>({...l,[a]:"1px"}),{});return{[s]:"1px"}}if(e.arbitrary){let s=e.value,c=(/^#|^(?:rgb|rgba|hsl|hsla|oklch|oklab|lab|lch)\(|^(?:currentColor|transparent|inherit)$/i.test(s)?n[e.utility]:i)??i;if(Array.isArray(c))return c.reduce((u,f)=>({...u,[f]:s}),{});return{[c]:s}}if(ki[e.value]){let s=i;if(Array.isArray(s))return s.reduce((l,a)=>({...l,[a]:ki[e.value]}),{});return{[s]:ki[e.value]}}let o=n[e.utility];if(o&&t){let s=e.value.split("-");if(s.length>=2){let a=s[s.length-1],c=s.slice(0,-1).join("-"),u=t.theme.colors[c];if(u&&typeof u==="object"&&u[a]){let f=o,d=W(e.value,u[a],c,t.colorVariables);if(Array.isArray(f))return f.reduce((h,g)=>({...h,[g]:d}),{});return{[f]:d}}}let l=t.theme.colors[e.value];if(typeof l==="string"){let a=o;if(Array.isArray(a))return a.reduce((c,u)=>({...c,[u]:l}),{});return{[a]:l}}if(l&&typeof l==="object"&&typeof l.DEFAULT==="string"){let a=o;if(Array.isArray(a))return a.reduce((c,u)=>({...c,[u]:l.DEFAULT}),{});return{[a]:l.DEFAULT}}if(e.value==="transparent"||e.value==="current"||e.value==="inherit"){let a=e.value==="current"?"currentColor":e.value,c=o;if(Array.isArray(c))return c.reduce((u,f)=>({...u,[f]:a}),{});return{[c]:a}}}return};function Xe(e,t){if(!e.value)return t.theme.borderRadius.DEFAULT;if(t.theme.borderRadius[e.value]!==void 0)return t.theme.borderRadius[e.value];if(e.arbitrary)return e.value;return}var Ul={t:["border-top-left-radius","border-top-right-radius"],r:["border-top-right-radius","border-bottom-right-radius"],b:["border-bottom-left-radius","border-bottom-right-radius"],l:["border-top-left-radius","border-bottom-left-radius"],tl:["border-top-left-radius"],tr:["border-top-right-radius"],bl:["border-bottom-left-radius"],br:["border-bottom-right-radius"],s:["border-start-start-radius","border-end-start-radius"],e:["border-start-end-radius","border-end-end-radius"],ss:["border-start-start-radius"],se:["border-start-end-radius"],es:["border-end-start-radius"],ee:["border-end-end-radius"]},tb=(e,t)=>{if(e.utility==="rounded"){if(e.arbitrary&&e.value)return{"border-radius":e.value};if(e.value&&Ul[e.value]){let o=t.theme.borderRadius.DEFAULT,s={};for(let l of Ul[e.value])s[l]=o;return s}let i=e.value?t.theme.borderRadius[e.value]:t.theme.borderRadius.DEFAULT;return i?{"border-radius":i}:void 0}if(e.utility==="rounded-s"){let i=Xe(e,t);if(i===void 0)return;return{"border-start-start-radius":i,"border-end-start-radius":i}}if(e.utility==="rounded-e"){let i=Xe(e,t);if(i===void 0)return;return{"border-start-end-radius":i,"border-end-end-radius":i}}if(e.utility==="rounded-ss"){let i=Xe(e,t);if(i===void 0)return;return{"border-start-start-radius":i}}if(e.utility==="rounded-se"){let i=Xe(e,t);if(i===void 0)return;return{"border-start-end-radius":i}}if(e.utility==="rounded-es"){let i=Xe(e,t);if(i===void 0)return;return{"border-end-start-radius":i}}if(e.utility==="rounded-ee"){let i=Xe(e,t);if(i===void 0)return;return{"border-end-end-radius":i}}let n={"rounded-t":["border-top-left-radius","border-top-right-radius"],"rounded-r":["border-top-right-radius","border-bottom-right-radius"],"rounded-b":["border-bottom-left-radius","border-bottom-right-radius"],"rounded-l":["border-top-left-radius","border-bottom-left-radius"],"rounded-tl":["border-top-left-radius"],"rounded-tr":["border-top-right-radius"],"rounded-bl":["border-bottom-left-radius"],"rounded-br":["border-bottom-right-radius"]}[e.utility];if(n){let i=Xe(e,t);if(i===void 0)return;let o={};for(let s of n)o[s]=i;return o}},Si=[pi,Aa,Uy,Vy,By,Yy,Zy,...jl,Jy,Xy,...wa,...va,...bi,qy,Hy,...la,...cl,Iy,Py,_y,Ly,My,Fy,jy,Dy,...ka,...wl,...bi,...Ja,...Ca,eb,Qy,tb,Oy,Ty,Ny,Ey];function Ni(e,t){let r={...e};for(let n in t){let i=t[n],o=r[n];if(i&&typeof i==="object"&&!Array.isArray(i)&&o&&typeof o==="object"&&!Array.isArray(o))r[n]=Ni(o,i);else if(i!==void 0)r[n]=i}return r}var rb={block:{display:"block"},"inline-block":{display:"inline-block"},inline:{display:"inline"},flex:{display:"flex"},"inline-flex":{display:"inline-flex"},grid:{display:"grid"},"inline-grid":{display:"inline-grid"},hidden:{display:"none"},none:{display:"none"}},nb={"flex-row":{"flex-direction":"row"},"flex-row-reverse":{"flex-direction":"row-reverse"},"flex-col":{"flex-direction":"column"},"flex-col-reverse":{"flex-direction":"column-reverse"}},ib={"flex-wrap":{"flex-wrap":"wrap"},"flex-wrap-reverse":{"flex-wrap":"wrap-reverse"},"flex-nowrap":{"flex-wrap":"nowrap"}},ob={"flex-1":{flex:"1 1 0%"},"flex-auto":{flex:"1 1 auto"},"flex-initial":{flex:"0 1 auto"},"flex-none":{flex:"none"}},sb={grow:{"flex-grow":"1"},"grow-0":{"flex-grow":"0"},shrink:{"flex-shrink":"1"},"shrink-0":{"flex-shrink":"0"}},ab={start:"flex-start",end:"flex-end",center:"center",between:"space-between",around:"space-around",evenly:"space-evenly","center-safe":"safe center","end-safe":"safe flex-end"},lb={start:"flex-start",end:"flex-end",center:"center",baseline:"baseline",stretch:"stretch","center-safe":"safe center","end-safe":"safe flex-end"},cb={normal:"normal",center:"center",start:"flex-start",end:"flex-end",between:"space-between",around:"space-around",evenly:"space-evenly",baseline:"baseline",stretch:"stretch","center-safe":"safe center","end-safe":"safe flex-end"},ub={auto:"auto",start:"flex-start",end:"flex-end",center:"center",stretch:"stretch",baseline:"baseline","center-safe":"safe center","end-safe":"safe flex-end"},fb={"border-solid":{"border-style":"solid"},"border-dashed":{"border-style":"dashed"},"border-dotted":{"border-style":"dotted"},"border-double":{"border-style":"double"},"border-none":{"border-style":"none"}},db={transform:{transform:Lt},"transform-cpu":{transform:Lt},"transform-gpu":{transform:Ri},"transform-none":{transform:"none"}},pt={"transition-timing-function":"cubic-bezier(0.4, 0, 0.2, 1)","transition-duration":"150ms"},hb={"transition-none":{"transition-property":"none"},"transition-all":{"transition-property":"all",...pt},transition:{"transition-property":"color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter",...pt},"transition-colors":{"transition-property":"color, background-color, border-color, text-decoration-color, fill, stroke",...pt},"transition-opacity":{"transition-property":"opacity",...pt},"transition-shadow":{"transition-property":"box-shadow",...pt},"transition-transform":{"transition-property":"transform",...pt}},gb={"ease-linear":{"transition-timing-function":"linear"},"ease-in":{"transition-timing-function":"cubic-bezier(0.4, 0, 1, 1)"},"ease-out":{"transition-timing-function":"cubic-bezier(0, 0, 0.2, 1)"},"ease-in-out":{"transition-timing-function":"cubic-bezier(0.4, 0, 0.2, 1)"}},mb={"animate-none":{animation:"none"},"animate-spin":{animation:"spin 1s linear infinite"},"animate-ping":{animation:"ping 1s cubic-bezier(0, 0, 0.2, 1) infinite"},"animate-pulse":{animation:"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite"},"animate-bounce":{animation:"bounce 1s infinite"}};function pb(e,t){let r=Object.keys(t);if(r.length===0)return{tokens:[],colors:e};let n=[];for(let[o,s]of Object.entries(e)){if(typeof s!=="object"||s===null)continue;let l=Object.keys(s);if(l.length===0)continue;if(!l.every((u)=>u==="light"||r.includes(u)))continue;if(!l.some((u)=>r.includes(u)))continue;let a=typeof s.light==="string"?s.light:s[l[0]];if(typeof a!=="string")continue;let c={};for(let u of r){let f=s[u];if(typeof f==="string")c[u]=f}n.push({name:o,base:a,byMode:c})}if(n.length===0)return{tokens:n,colors:e};let i={...e};for(let o of n)i[o.name]=o.base;return{tokens:n,colors:i}}var yb="tc-base",zl="tc-utilities";function bb(e,t){let r=Object.entries(t).map(([n,i])=>{let o=Object.entries(i).map(([s,l])=>`${s}: ${l};`).join(" ");return` ${n} { ${o} }`}).join(`
357
+ `.trim()};var ht={content:["./src/**/*.{html,js,ts,jsx,tsx,stx}"],output:"./dist/styles.css",minify:!0,watch:!1,theme:{colors:{inherit:"inherit",current:"currentColor",transparent:"transparent",black:"#000",white:"#fff",slate:{50:"oklch(98.4% 0.003 247.858)",100:"oklch(96.8% 0.007 247.896)",200:"oklch(92.9% 0.013 255.508)",300:"oklch(86.9% 0.022 252.894)",400:"oklch(70.4% 0.04 256.788)",500:"oklch(55.4% 0.046 257.417)",600:"oklch(44.6% 0.043 257.281)",700:"oklch(37.2% 0.044 257.287)",800:"oklch(27.9% 0.041 260.031)",900:"oklch(20.8% 0.042 265.755)",950:"oklch(12.9% 0.042 264.695)"},gray:{50:"oklch(98.5% 0.002 247.839)",100:"oklch(96.7% 0.003 264.542)",200:"oklch(92.8% 0.006 264.531)",300:"oklch(87.2% 0.01 258.338)",400:"oklch(70.7% 0.022 261.325)",500:"oklch(55.1% 0.027 264.364)",600:"oklch(44.6% 0.03 256.802)",700:"oklch(37.3% 0.034 259.733)",800:"oklch(27.8% 0.033 256.848)",900:"oklch(21% 0.034 264.665)",950:"oklch(13% 0.028 261.692)"},zinc:{50:"oklch(98.5% 0 0)",100:"oklch(96.7% 0.001 286.375)",200:"oklch(92% 0.004 286.32)",300:"oklch(87.1% 0.006 286.286)",400:"oklch(70.5% 0.015 286.067)",500:"oklch(55.2% 0.016 285.938)",600:"oklch(44.2% 0.017 285.786)",700:"oklch(37% 0.013 285.805)",800:"oklch(27.4% 0.006 286.033)",900:"oklch(21% 0.006 285.885)",950:"oklch(14.1% 0.005 285.823)"},neutral:{50:"oklch(98.5% 0 0)",100:"oklch(97% 0 0)",200:"oklch(92.2% 0 0)",300:"oklch(87% 0 0)",400:"oklch(70.8% 0 0)",500:"oklch(55.6% 0 0)",600:"oklch(43.9% 0 0)",700:"oklch(37.1% 0 0)",800:"oklch(26.9% 0 0)",900:"oklch(20.5% 0 0)",950:"oklch(14.5% 0 0)"},stone:{50:"oklch(98.5% 0.001 106.423)",100:"oklch(97% 0.001 106.424)",200:"oklch(92.3% 0.003 48.717)",300:"oklch(86.9% 0.005 56.366)",400:"oklch(70.9% 0.01 56.259)",500:"oklch(55.3% 0.013 58.071)",600:"oklch(44.4% 0.011 73.639)",700:"oklch(37.4% 0.01 67.558)",800:"oklch(26.8% 0.007 34.298)",900:"oklch(21.6% 0.006 56.043)",950:"oklch(14.7% 0.004 49.25)"},red:{50:"oklch(97.1% 0.013 17.38)",100:"oklch(93.6% 0.032 17.717)",200:"oklch(88.5% 0.062 18.334)",300:"oklch(80.8% 0.114 19.571)",400:"oklch(70.4% 0.191 22.216)",500:"oklch(63.7% 0.237 25.331)",600:"oklch(57.7% 0.245 27.325)",700:"oklch(50.5% 0.213 27.518)",800:"oklch(44.4% 0.177 26.899)",900:"oklch(39.6% 0.141 25.723)",950:"oklch(25.8% 0.092 26.042)"},orange:{50:"oklch(98% 0.016 73.684)",100:"oklch(95.4% 0.038 75.164)",200:"oklch(90.1% 0.076 70.697)",300:"oklch(83.7% 0.128 66.29)",400:"oklch(75% 0.183 55.934)",500:"oklch(70.5% 0.213 47.604)",600:"oklch(64.6% 0.222 41.116)",700:"oklch(55.3% 0.195 38.402)",800:"oklch(47% 0.157 37.304)",900:"oklch(40.8% 0.123 38.172)",950:"oklch(26.6% 0.079 36.259)"},amber:{50:"oklch(98.7% 0.022 95.277)",100:"oklch(96.2% 0.059 95.617)",200:"oklch(92.4% 0.12 95.746)",300:"oklch(87.9% 0.169 91.605)",400:"oklch(82.8% 0.189 84.429)",500:"oklch(76.9% 0.188 70.08)",600:"oklch(66.6% 0.179 58.318)",700:"oklch(55.5% 0.163 48.998)",800:"oklch(47.3% 0.137 46.201)",900:"oklch(41.4% 0.112 45.904)",950:"oklch(27.9% 0.077 45.635)"},yellow:{50:"oklch(98.7% 0.026 102.212)",100:"oklch(97.3% 0.071 103.193)",200:"oklch(94.5% 0.129 101.54)",300:"oklch(90.5% 0.182 98.111)",400:"oklch(85.2% 0.199 91.936)",500:"oklch(79.5% 0.184 86.047)",600:"oklch(68.1% 0.162 75.834)",700:"oklch(55.4% 0.135 66.442)",800:"oklch(47.6% 0.114 61.907)",900:"oklch(42.1% 0.095 57.708)",950:"oklch(28.6% 0.066 53.813)"},lime:{50:"oklch(98.6% 0.031 120.757)",100:"oklch(96.7% 0.067 122.328)",200:"oklch(93.8% 0.127 124.321)",300:"oklch(89.7% 0.196 126.665)",400:"oklch(84.1% 0.238 128.85)",500:"oklch(76.8% 0.233 130.85)",600:"oklch(64.8% 0.2 131.684)",700:"oklch(53.2% 0.157 131.589)",800:"oklch(45.3% 0.124 130.933)",900:"oklch(40.5% 0.101 131.063)",950:"oklch(27.4% 0.072 132.109)"},green:{50:"oklch(98.2% 0.018 155.826)",100:"oklch(96.2% 0.044 156.743)",200:"oklch(92.5% 0.084 155.995)",300:"oklch(87.1% 0.15 154.449)",400:"oklch(79.2% 0.209 151.711)",500:"oklch(72.3% 0.219 149.579)",600:"oklch(62.7% 0.194 149.214)",700:"oklch(52.7% 0.154 150.069)",800:"oklch(44.8% 0.119 151.328)",900:"oklch(39.3% 0.095 152.535)",950:"oklch(26.6% 0.065 152.934)"},emerald:{50:"oklch(97.9% 0.021 166.113)",100:"oklch(95% 0.052 163.051)",200:"oklch(90.5% 0.093 164.15)",300:"oklch(84.5% 0.143 164.978)",400:"oklch(76.5% 0.177 163.223)",500:"oklch(69.6% 0.17 162.48)",600:"oklch(59.6% 0.145 163.225)",700:"oklch(50.8% 0.118 165.612)",800:"oklch(43.2% 0.095 166.913)",900:"oklch(37.8% 0.077 168.94)",950:"oklch(26.2% 0.051 172.552)"},teal:{50:"oklch(98.4% 0.014 180.72)",100:"oklch(95.3% 0.051 180.801)",200:"oklch(91% 0.096 180.426)",300:"oklch(85.5% 0.138 181.071)",400:"oklch(77.7% 0.152 181.912)",500:"oklch(70.4% 0.14 182.503)",600:"oklch(60% 0.118 184.704)",700:"oklch(51.1% 0.096 186.391)",800:"oklch(43.7% 0.078 188.216)",900:"oklch(38.6% 0.063 188.416)",950:"oklch(27.7% 0.046 192.524)"},cyan:{50:"oklch(98.4% 0.019 200.873)",100:"oklch(95.6% 0.045 203.388)",200:"oklch(91.7% 0.08 205.041)",300:"oklch(86.5% 0.127 207.078)",400:"oklch(78.9% 0.154 211.53)",500:"oklch(71.5% 0.143 215.221)",600:"oklch(60.9% 0.126 221.723)",700:"oklch(52% 0.105 223.128)",800:"oklch(45% 0.085 224.283)",900:"oklch(39.8% 0.07 227.392)",950:"oklch(30.2% 0.056 229.695)"},sky:{50:"oklch(97.7% 0.013 236.62)",100:"oklch(95.1% 0.026 236.824)",200:"oklch(90.1% 0.058 230.902)",300:"oklch(82.8% 0.111 230.318)",400:"oklch(74.6% 0.16 232.661)",500:"oklch(68.5% 0.169 237.323)",600:"oklch(58.8% 0.158 241.966)",700:"oklch(50% 0.134 242.749)",800:"oklch(44.3% 0.11 240.79)",900:"oklch(39.1% 0.09 240.876)",950:"oklch(29.3% 0.066 243.157)"},blue:{50:"oklch(97% 0.014 254.604)",100:"oklch(93.2% 0.032 255.585)",200:"oklch(88.2% 0.059 254.128)",300:"oklch(80.9% 0.105 251.813)",400:"oklch(70.7% 0.165 254.624)",500:"oklch(62.3% 0.214 259.815)",600:"oklch(54.6% 0.245 262.881)",700:"oklch(48.8% 0.243 264.376)",800:"oklch(42.4% 0.199 265.638)",900:"oklch(37.9% 0.146 265.522)",950:"oklch(28.2% 0.091 267.935)"},indigo:{50:"oklch(96.2% 0.018 272.314)",100:"oklch(93% 0.034 272.788)",200:"oklch(87% 0.065 274.039)",300:"oklch(78.5% 0.115 274.713)",400:"oklch(67.3% 0.182 276.935)",500:"oklch(58.5% 0.233 277.117)",600:"oklch(51.1% 0.262 276.966)",700:"oklch(45.7% 0.24 277.023)",800:"oklch(39.8% 0.195 277.366)",900:"oklch(35.9% 0.144 278.697)",950:"oklch(25.7% 0.09 281.288)"},violet:{50:"oklch(96.9% 0.016 293.756)",100:"oklch(94.3% 0.029 294.588)",200:"oklch(89.4% 0.057 293.283)",300:"oklch(81.1% 0.111 293.571)",400:"oklch(70.2% 0.183 293.541)",500:"oklch(60.6% 0.25 292.717)",600:"oklch(54.1% 0.281 293.009)",700:"oklch(49.1% 0.27 292.581)",800:"oklch(43.2% 0.232 292.759)",900:"oklch(38% 0.189 293.745)",950:"oklch(28.3% 0.141 291.089)"},purple:{50:"oklch(97.7% 0.014 308.299)",100:"oklch(94.6% 0.033 307.174)",200:"oklch(90.2% 0.063 306.703)",300:"oklch(82.7% 0.119 306.383)",400:"oklch(71.4% 0.203 305.504)",500:"oklch(62.7% 0.265 303.9)",600:"oklch(55.8% 0.288 302.321)",700:"oklch(49.6% 0.265 301.924)",800:"oklch(43.8% 0.218 303.724)",900:"oklch(38.1% 0.176 304.987)",950:"oklch(29.1% 0.149 302.717)"},fuchsia:{50:"oklch(97.7% 0.017 320.058)",100:"oklch(95.2% 0.037 318.852)",200:"oklch(90.3% 0.076 319.62)",300:"oklch(83.3% 0.145 321.434)",400:"oklch(74% 0.238 322.16)",500:"oklch(66.7% 0.295 322.15)",600:"oklch(59.1% 0.293 322.896)",700:"oklch(51.8% 0.253 323.949)",800:"oklch(45.2% 0.211 324.591)",900:"oklch(40.1% 0.17 325.612)",950:"oklch(29.3% 0.136 325.661)"},pink:{50:"oklch(97.1% 0.014 343.198)",100:"oklch(94.8% 0.028 342.258)",200:"oklch(89.9% 0.061 343.231)",300:"oklch(82.3% 0.12 346.018)",400:"oklch(71.8% 0.202 349.761)",500:"oklch(65.6% 0.241 354.308)",600:"oklch(59.2% 0.249 0.584)",700:"oklch(52.5% 0.223 3.958)",800:"oklch(45.9% 0.187 3.815)",900:"oklch(40.8% 0.153 2.432)",950:"oklch(28.4% 0.109 3.907)"},rose:{50:"oklch(96.9% 0.015 12.422)",100:"oklch(94.1% 0.03 12.58)",200:"oklch(89.2% 0.058 10.001)",300:"oklch(81% 0.117 11.638)",400:"oklch(71.2% 0.194 13.428)",500:"oklch(64.5% 0.246 16.439)",600:"oklch(58.6% 0.253 17.585)",700:"oklch(51.4% 0.222 16.935)",800:"oklch(45.5% 0.188 13.697)",900:"oklch(41% 0.159 10.272)",950:"oklch(27.1% 0.105 12.094)"}},spacing:{0:"0",px:"1px",0.5:"0.125rem",1:"0.25rem",1.5:"0.375rem",2:"0.5rem",2.5:"0.625rem",3:"0.75rem",3.5:"0.875rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem",11:"2.75rem",12:"3rem",14:"3.5rem",16:"4rem",20:"5rem",24:"6rem",28:"7rem",32:"8rem",36:"9rem",40:"10rem",44:"11rem",48:"12rem",52:"13rem",56:"14rem",60:"15rem",64:"16rem",72:"18rem",80:"20rem",96:"24rem"},fontSize:{xs:["0.75rem",{lineHeight:"1rem"}],sm:["0.875rem",{lineHeight:"1.25rem"}],base:["1rem",{lineHeight:"1.5rem"}],lg:["1.125rem",{lineHeight:"1.75rem"}],xl:["1.25rem",{lineHeight:"1.75rem"}],"2xl":["1.5rem",{lineHeight:"2rem"}],"3xl":["1.875rem",{lineHeight:"2.25rem"}],"4xl":["2.25rem",{lineHeight:"2.5rem"}],"5xl":["3rem",{lineHeight:"1"}],"6xl":["3.75rem",{lineHeight:"1"}],"7xl":["4.5rem",{lineHeight:"1"}],"8xl":["6rem",{lineHeight:"1"}],"9xl":["8rem",{lineHeight:"1"}]},fontFamily:{sans:["ui-sans-serif","system-ui","sans-serif"],serif:["ui-serif","Georgia","serif"],mono:["ui-monospace","monospace"]},screens:{sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},containers:{"3xs":"16rem","2xs":"18rem",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem"},borderRadius:{none:"0",xs:"0.125rem",sm:"0.25rem",DEFAULT:"0.25rem",md:"0.375rem",lg:"0.5rem",xl:"0.75rem","2xl":"1rem","3xl":"1.5rem","4xl":"2rem",full:"9999px"},boxShadow:{"2xs":"0 1px rgb(0 0 0 / 0.05)",xs:"0 1px 2px 0 rgb(0 0 0 / 0.05)",sm:"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",DEFAULT:"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",md:"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",lg:"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",xl:"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)","2xl":"0 25px 50px -12px rgb(0 0 0 / 0.25)",inner:"inset 0 2px 4px 0 rgb(0 0 0 / 0.05)",none:"none"}},shortcuts:{},rules:[],attributify:{enabled:!1,prefix:"tc-",ignoreAttributes:["class","className","style","id","name","type","value","href","src","alt","title","role","for","action","method","target","rel","placeholder","disabled","checked","selected","readonly","required","maxlength","minlength","pattern","autocomplete","autofocus","tabindex","contenteditable","draggable","spellcheck","lang","dir","hidden","slot","part","is","key","ref"]},bracketSyntax:{enabled:!1,colonSyntax:!1,aliases:{col:"col",row:"row",jc:"justify",ji:"justify-items",js:"justify-self",ai:"items",ac:"content",as:"self",wrap:"wrap",nowrap:"nowrap",c:"center",s:"start",e:"end",sb:"between",sa:"around",se:"evenly",st:"stretch"}},variants:{responsive:!0,hover:!0,focus:!0,active:!0,disabled:!0,dark:!0,light:!0,group:!0,peer:!0,"*":!0,"**":!0,in:!0,before:!0,after:!0,marker:!0,"first-letter":!0,"first-line":!0,backdrop:!0,"details-content":!0,first:!0,last:!0,odd:!0,even:!0,"first-of-type":!0,"last-of-type":!0,visited:!0,checked:!0,"focus-within":!0,"focus-visible":!0,placeholder:!0,selection:!0,file:!0,required:!0,valid:!0,invalid:!0,"read-only":!0,autofill:!0,"user-valid":!0,"user-invalid":!0,"in-range":!0,"out-of-range":!0,"placeholder-shown":!0,open:!0,closed:!0,empty:!0,enabled:!0,only:!0,target:!0,indeterminate:!0,default:!0,optional:!0,inert:!0,"only-of-type":!0,aria:!0,data:!0,has:!0,not:!0,supports:!0,print:!0,landscape:!0,portrait:!0,"forced-colors":!0,"pointer-none":!0,"pointer-coarse":!0,"pointer-fine":!0,"any-pointer-none":!0,"any-pointer-coarse":!0,"any-pointer-fine":!0,"inverted-colors":!0,noscript:!0,starting:!0,rtl:!0,ltr:!0,"motion-safe":!0,"motion-reduce":!0,"contrast-more":!0,"contrast-less":!0},safelist:[],blocklist:[],preflights:[Xt],presets:[],cssVariables:!1},gi=null;async function ia(){if(!gi){await Promise.resolve().then(() => na());gi=await ra({name:"css",defaultConfig:ht})}return gi}var mi=ht;function Oe(e){if(e.indexOf("/")===-1)return-1;let r=0,n=0,i="";for(let o=0;o<e.length;o++){let s=e[o];if(s==="\\"){o++;continue}if(i){if(s===i)i="";continue}if(s==='"'||s==="'"){i=s;continue}if(s==="(")r++;else if(s===")")r=Math.max(0,r-1);else if(s==="[")n++;else if(s==="]")n=Math.max(0,n-1);else if(s==="/"&&r===0&&n===0)return o}return-1}var _r="0 0 #0000",Vh=["inset-shadow","inset-ring-shadow","ring-offset-shadow","ring-shadow","shadow"],V=Vh.map((e)=>`var(--tc-${e}, 0 0 #0000)`).join(", ");var Lr={"0":"0",full:"100%",min:"min-content",max:"max-content",fit:"fit-content",none:"none",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem",screen:"100vw"},Wh={...Lr,prose:"65ch"};function aa(e,t,r){let n=e.value;if(t[n])return{[r]:t[n]};if(e.arbitrary)return{[r]:n};if(/^\d+$/.test(n)){let i=Number.parseInt(n,10);if(i>=0&&i<=100)return{[r]:`${i/100}`}}return}var zh=(e,t)=>{if(e.utility==="min-w"&&e.value){let r=pe(e,t,Lr);return r!==void 0?{"min-width":r}:void 0}if(e.utility==="max-w"&&e.value){let r=pe(e,t,Wh);return r!==void 0?{"max-width":r}:void 0}if(e.utility==="min-h"&&e.value){let r={...Lr,screen:"100vh"},n=pe(e,t,r);return n!==void 0?{"min-height":n}:void 0}if(e.utility==="max-h"&&e.value){let r={...Lr,screen:"100vh"},n=pe(e,t,r);return n!==void 0?{"max-height":n}:void 0}},Kh=(e,t)=>{if(e.utility==="ring"){if(e.value==="inset")return{"--tc-ring-inset":"inset"};if(e.value){let i=z(e.value,t,e.modifierArbitrary);if(i)return{"--tc-ring-color":i}}let r={0:"0",1:"1px",2:"2px",4:"4px",8:"8px",DEFAULT:"1px"},n;if(!e.value)n=r.DEFAULT;else if(r[e.value])n=r[e.value];else if(e.arbitrary)n=e.value;else if(/^\d+(?:\.\d+)?$/.test(e.value))n=`${e.value}px`;if(n===void 0)return;return{"--tc-ring-offset-shadow":"var(--tc-ring-inset,) 0 0 0 var(--tc-ring-offset-width, 0px) var(--tc-ring-offset-color, #fff)","--tc-ring-shadow":`var(--tc-ring-inset,) 0 0 0 calc(${n} + var(--tc-ring-offset-width, 0px)) var(--tc-ring-color, currentcolor)`,"box-shadow":V}}if(e.utility==="ring-offset"&&e.value){let r={0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"};if(r[e.value])return{"--tc-ring-offset-width":r[e.value]};let n=z(e.value,t,e.modifierArbitrary);if(n)return{"--tc-ring-offset-color":n}}if(e.utility==="ring-opacity"&&e.value)return aa(e,{0:"0",5:"0.05",10:"0.1",20:"0.2",25:"0.25",30:"0.3",40:"0.4",50:"0.5",60:"0.6",70:"0.7",75:"0.75",80:"0.8",90:"0.9",95:"0.95",100:"1"},"--tc-ring-opacity")},Gh=(e)=>{if(e.utility==="border-opacity"&&e.value)return aa(e,{0:"0",5:"0.05",10:"0.1",20:"0.2",25:"0.25",30:"0.3",40:"0.4",50:"0.5",60:"0.6",70:"0.7",75:"0.75",80:"0.8",90:"0.9",95:"0.95",100:"1"},"--tc-border-opacity")};function oa(e,t){let r=e.value;if(e.arbitrary)return r;let n=r.startsWith("-"),i=n?r.slice(1):r,o=t.theme.spacing[i];if(o===void 0&&/^\d+(?:\.\d+)?$/.test(i))o=`${Number.parseFloat(i)*0.25}rem`;if(o===void 0)return;return n?`-${o}`:o}var Hh=(e,t)=>{if(e.utility==="space-x"&&e.value){if(e.value==="reverse")return{properties:{"--tc-space-x-reverse":"1"},childSelector:"> :not([hidden]) ~ :not([hidden])"};let r=oa(e,t);if(r===void 0)return;return{properties:{"--tc-space-x-reverse":"0","margin-right":`calc(${r} * var(--tc-space-x-reverse))`,"margin-left":`calc(${r} * calc(1 - var(--tc-space-x-reverse)))`},childSelector:"> :not([hidden]) ~ :not([hidden])"}}if(e.utility==="space-y"&&e.value){if(e.value==="reverse")return{properties:{"--tc-space-y-reverse":"1"},childSelector:"> :not([hidden]) ~ :not([hidden])"};let r=oa(e,t);if(r===void 0)return;return{properties:{"--tc-space-y-reverse":"0","margin-top":`calc(${r} * calc(1 - var(--tc-space-y-reverse)))`,"margin-bottom":`calc(${r} * var(--tc-space-y-reverse))`},childSelector:"> :not([hidden]) ~ :not([hidden])"}}},qh=(e)=>{if(e.utility==="border"&&e.value){let t={solid:"solid",dashed:"dashed",dotted:"dotted",double:"double",hidden:"hidden",none:"none"};if(t[e.value])return{"border-style":t[e.value]}}};function sa(e){if(!e.value)return"1px";let t={0:"0",2:"2px",4:"4px",8:"8px"};if(t[e.value])return t[e.value];if(e.arbitrary)return e.value;if(/^\d+(?:\.\d+)?$/.test(e.value))return`${e.value}px`;return}function Yh(e){let t=Oe(e),r=t===-1?e:e.slice(0,t);if(r.charCodeAt(0)!==91||r.charCodeAt(r.length-1)!==93)return e;let n=r.slice(1,-1).replace(/_/g," ");return t===-1?n:n+e.slice(t)}var Jh=(e,t)=>{if(e.utility==="divide"&&e.value){let r={solid:"solid",dashed:"dashed",dotted:"dotted",double:"double",none:"none"};if(r[e.value])return{properties:{"border-style":r[e.value]},childSelector:"> :not([hidden]) ~ :not([hidden])"}}if(e.utility==="divide-x"){if(e.value==="reverse")return{properties:{"--tc-divide-x-reverse":"1"},childSelector:"> :not([hidden]) ~ :not([hidden])"};let r=sa(e);if(r===void 0)return;return{properties:{"--tc-divide-x-reverse":"0","border-right-width":`calc(${r} * var(--tc-divide-x-reverse))`,"border-left-width":`calc(${r} * calc(1 - var(--tc-divide-x-reverse)))`},childSelector:"> :not([hidden]) ~ :not([hidden])"}}if(e.utility==="divide-y"){if(e.value==="reverse")return{properties:{"--tc-divide-y-reverse":"1"},childSelector:"> :not([hidden]) ~ :not([hidden])"};let r=sa(e);if(r===void 0)return;return{properties:{"--tc-divide-y-reverse":"0","border-top-width":`calc(${r} * calc(1 - var(--tc-divide-y-reverse)))`,"border-bottom-width":`calc(${r} * var(--tc-divide-y-reverse))`},childSelector:"> :not([hidden]) ~ :not([hidden])"}}if(e.utility==="divide"&&e.value){let r=Yh(e.value);if(r==="auto")return;let n=z(r,t,e.modifierArbitrary);if(n!==void 0)return{properties:{"border-color":n},childSelector:"> :not([hidden]) ~ :not([hidden])"}}},Xh=(e,t)=>{let r=(n)=>{let i=null,o=n,s=Oe(n);if(s!==-1){o=n.slice(0,s);let u=n.slice(s+1);if(u.startsWith("[")&&u.endsWith("]"))i=u.slice(1,-1);else if(e.modifierArbitrary){let f=Number.parseFloat(u);if(!Number.isNaN(f)&&f>=0&&f<=1)i=f.toString()}else{let f=Number.parseInt(u,10);if(!Number.isNaN(f))i=(f/100).toString()}}let l=(u)=>{if(!i)return u;let f=u.match(/^(oklch|rgb|hsl|oklab|lab|lch)\(([^)]+)\)$/i);if(f){let d=f[1],h=f[2].split("/")[0].trim();return`${d}(${h} / ${i})`}if(/^#[0-9a-f]{3,8}$/i.test(u)){let d=u.replace("#",""),h=(y)=>Number.parseInt(y.length===1?y+y:y,16),g=h(d.slice(0,d.length===3?1:2)),m=h(d.slice(d.length===3?1:2,d.length===3?2:4)),p=h(d.slice(d.length===3?2:4,d.length===3?3:6));return`rgb(${g} ${m} ${p} / ${i})`}return`color-mix(in srgb, ${u} ${Math.round(Number.parseFloat(i)*100)}%, transparent)`};if(o.startsWith("[")&&o.endsWith("]"))o=o.slice(1,-1);let a=t.theme.colors[o];if(typeof a==="string")return l(W(o,a,o,t.colorVariables));if(typeof a==="object"&&a!==null&&typeof a.DEFAULT==="string")return l(W(o,a.DEFAULT,o,t.colorVariables));let c=o.split("-");if(c.length>=2){let u=c.slice(0,-1).join("-"),f=c[c.length-1],d=t.theme.colors[u];if(typeof d==="object"&&d[f])return l(W(o,d[f],u,t.colorVariables))}if(e.arbitrary||o.startsWith("#")||/^(?:var|rgb|rgba|hsl|hsla|oklch|oklab|lab|lch|color|color-mix)\(/.test(o))return l(o);return};if(e.utility==="from"&&e.value){let n=r(e.value);if(n===void 0)return;return{"--tc-gradient-from":n,"--tc-gradient-to":"rgb(255 255 255 / 0)","--tc-gradient-stops":"var(--tc-gradient-from), var(--tc-gradient-to)"}}if(e.utility==="via"&&e.value){let n=r(e.value);if(n===void 0)return;return{"--tc-gradient-to":"rgb(255 255 255 / 0)","--tc-gradient-stops":`var(--tc-gradient-from), ${n}, var(--tc-gradient-to)`}}if(e.utility==="to"&&e.value){let n=r(e.value);if(n===void 0)return;return{"--tc-gradient-to":n,"--tc-gradient-stops":"var(--tc-gradient-from), var(--tc-gradient-to)"}}},Zh=(e)=>{if(e.utility==="order"&&e.value){let t={first:"-9999",last:"9999",none:"0"};if(t[e.value])return{order:t[e.value]};if(e.arbitrary||/^-?\d+$/.test(e.value))return{order:e.value};return}},Qh=(e,t)=>{if(e.utility==="basis"&&e.value){let r={auto:"auto",full:"100%",0:"0"};if(r[e.value])return{"flex-basis":r[e.value]};let n=pe(e,t,{});return n!==void 0?{"flex-basis":n}:void 0}},eg=(e)=>{if(e.utility==="justify-self"){let t={auto:"auto",start:"start",end:"end",center:"center",stretch:"stretch"};return e.value&&t[e.value]?{"justify-self":t[e.value]}:void 0}},tg=(e)=>{if(e.utility==="self"){let t={auto:"auto",start:"flex-start",end:"flex-end",center:"center",stretch:"stretch",baseline:"baseline"};return e.value&&t[e.value]?{"align-self":t[e.value]}:void 0}},rg=(e,t)=>{if(e.utility==="container"){if(!e.value)return{width:"100%","margin-left":"auto","margin-right":"auto","max-width":t.theme.screens.xl||"1280px"};let r={sm:t.theme.screens.sm||"640px",md:t.theme.screens.md||"768px",lg:t.theme.screens.lg||"1024px",xl:t.theme.screens.xl||"1280px","2xl":t.theme.screens["2xl"]||"1536px",full:"100%",prose:"65ch","3xl":"1920px"};if(r[e.value])return{width:"100%","margin-left":"auto","margin-right":"auto","max-width":r[e.value]};if(e.arbitrary)return{width:"100%","margin-left":"auto","margin-right":"auto","max-width":e.value}}},pi=(e)=>{if(e.arbitrary&&e.utility&&e.value&&e.base.startsWith("["))return{[e.utility]:e.value}},la=[zh,Kh,Gh,qh,Hh,Jh,Xh,Zh,Qh,eg,tg,rg,pi];var ca={"bg-origin-border":"border-box","bg-origin-padding":"padding-box","bg-origin-content":"content-box"},ua={"bg-bottom":"bottom","bg-center":"center","bg-left":"left","bg-left-bottom":"left bottom","bg-left-top":"left top","bg-right":"right","bg-right-bottom":"right bottom","bg-right-top":"right top","bg-top":"top"},fa={"bg-repeat":"repeat","bg-no-repeat":"no-repeat","bg-repeat-x":"repeat-x","bg-repeat-y":"repeat-y","bg-repeat-round":"round","bg-repeat-space":"space"},da={"bg-auto":"auto","bg-cover":"cover","bg-contain":"contain"},yi=null,ha=null;function ng(e){let t=new Map;for(let[r,n]of Object.entries(e))if(typeof n==="string")t.set(r,n);else if(typeof n==="object"&&n!==null){for(let[i,o]of Object.entries(n))if(typeof o==="string")t.set(i==="DEFAULT"?r:`${r}-${i}`,o)}return t}function ig(e){return e.replace(/rgba?\([^)]+\)/g,"var(--tc-shadow-color)")}var og=(e)=>{if(e.utility==="bg"&&e.value){let t={fixed:"fixed",local:"local",scroll:"scroll"};return t[e.value]?{"background-attachment":t[e.value]}:void 0}return},sg=(e)=>{if(e.utility==="bg"&&e.value&&e.value.startsWith("clip-")){let t=e.value.replace("clip-",""),r={border:"border-box",padding:"padding-box",content:"content-box",text:"text"};return r[t]?{"background-clip":r[t]}:void 0}return},ga={t:"to top",tr:"to top right",r:"to right",br:"to bottom right",b:"to bottom",bl:"to bottom left",l:"to left",tl:"to top left"},ag=new Set(["srgb","srgb-linear","oklab","oklch","lab","lch","hsl","hwb","xyz","xyz-d50","xyz-d65","display-p3","a98-rgb","prophoto-rgb","rec2020"]),lg=new Set(["shorter","longer","increasing","decreasing"]);function cg(e){if(ag.has(e))return`in ${e}`;if(lg.has(e))return`in oklch ${e} hue`;return}var ug=(e)=>{if(e.utility!=="bg"||!e.value||e.arbitrary||e.typeHint)return;if(e.value.includes("("))return;let t=e.value.lastIndexOf("/"),r=t===-1?e.value:e.value.slice(0,t),n=t===-1?void 0:e.value.slice(t+1),i;if(n!==void 0){if(i=cg(n),i===void 0)return}let o=r.charCodeAt(0)===45,s=o?r.slice(1):r,l,a="";if(s==="conic")l="conic-gradient";else if(s==="radial")l="radial-gradient";else if(s.startsWith("conic-")){let u=s.slice(6);if(!/^\d+(?:\.\d+)?$/.test(u))return;l="conic-gradient",a=`from ${o?"-":""}${u}deg`}else if(s.startsWith("linear-")||s.startsWith("gradient-")){let u=s.slice(s.indexOf("-")+1);if(l="linear-gradient",u.startsWith("to-")){let f=ga[u.slice(3)];if(f===void 0)return;a=f}else if(/^\d+(?:\.\d+)?$/.test(u))a=`${o?"-":""}${u}deg`;else return}else return;if(!a&&i===void 0)return;let c=[a,i].filter(Boolean).join(" ");return{"background-image":c?`${l}(${c}, var(--tc-gradient-stops))`:`${l}(var(--tc-gradient-stops))`}},fg=(e)=>{if(!e.value)return;let t;if(e.utility==="bg-linear"||e.utility==="bg-gradient")t=e.value;else if(e.utility==="bg"){if(e.typeHint||e.value.includes("("))return;let r=e.value.startsWith("-"),i=(r?e.value.slice(1):e.value).match(/^(?:gradient|linear)-(.+)$/);if(!i)return;t=r?`-${i[1]}`:i[1]}else return;if(t.startsWith("to-")){let r=ga[t.slice(3)];return r?{"background-image":`linear-gradient(${r}, var(--tc-gradient-stops))`}:void 0}if(e.arbitrary)return{"background-image":`linear-gradient(${t}, var(--tc-gradient-stops))`};if(/^-?\d+(?:\.\d+)?$/.test(t))return{"background-image":`linear-gradient(${t}deg, var(--tc-gradient-stops))`};return},dg=(e)=>ca[e.base]?{"background-origin":ca[e.base]}:void 0,hg=(e)=>ua[e.base]?{"background-position":ua[e.base]}:void 0,gg=(e)=>fa[e.base]?{"background-repeat":fa[e.base]}:void 0,mg=(e)=>da[e.base]?{"background-size":da[e.base]}:void 0,pg=(e)=>{if(e.utility==="border"&&e.value){let t={solid:"solid",dashed:"dashed",dotted:"dotted",double:"double",hidden:"hidden",none:"none"};return t[e.value]?{"border-style":t[e.value]}:void 0}return},yg=(e,t)=>{if(e.utility==="outline-offset"&&e.value){let r={0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"};if(r[e.value])return{"outline-offset":r[e.value]};if(e.arbitrary)return{"outline-offset":e.value};if(/^\d+(?:\.\d+)?$/.test(e.value))return{"outline-offset":`${e.value}px`};return}if(e.utility==="outline"&&e.value){let r={none:"none",solid:"solid",dashed:"dashed",dotted:"dotted",double:"double"};if(r[e.value])return{"outline-style":r[e.value]};if(e.value==="hidden")return{outline:"2px solid transparent","outline-offset":"2px"}}if(e.utility==="outline"){if(!e.value)return{"outline-width":"1px"};let r=z(e.value,t,e.modifierArbitrary);if(r)return{"outline-color":r};let n={0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"};if(n[e.value])return{"outline-width":n[e.value]};if(e.arbitrary)return{"outline-width":e.value};if(/^\d+(?:\.\d+)?$/.test(e.value))return{"outline-width":`${e.value}px`};return}},bg=(e,t)=>{if(e.utility==="shadow"){let n=e.arbitrary&&!!e.value&&(/\s/.test(e.value)||e.value==="none")?e.value:e.value?t.theme.boxShadow[e.value]:t.theme.boxShadow.DEFAULT;if(!n)return;if(n==="none")return{"--tc-shadow":_r,"box-shadow":V};let i=ig(n);return{"--tc-shadow":n,"--tc-shadow-colored":i,"box-shadow":V}}},xg=(e,t)=>{if(e.utility!=="shadow"||!e.value)return;if(t.theme.boxShadow[e.value])return;if(e.arbitrary&&/\s/.test(e.value))return;if(yi===null||ha!==t.theme.colors)yi=ng(t.theme.colors),ha=t.theme.colors;let r=e.value,n=Oe(r),i,o;if(n!==-1){i=r.slice(0,n);let a=r.slice(n+1);if(a.charCodeAt(0)===91&&a.charCodeAt(a.length-1)===93){let c=Number.parseFloat(a.slice(1,-1));if(Number.isNaN(c)||c<0||c>1)return;o=c}else if(e.modifierArbitrary){let c=Number.parseFloat(a);if(Number.isNaN(c)||c<0||c>1)return;o=c}else{let c=Number.parseInt(a,10);if(Number.isNaN(c)||c<0||c>100)return;o=c/100}}else i=r;let s=yi.get(i)??(e.arbitrary?i:void 0);if(!s)return;return{"--tc-shadow-color":o!==void 0?we(s,o):s,"--tc-shadow":"var(--tc-shadow-colored)"}};function _t(e){return`${e} var(--tc-text-shadow-color, rgba(0, 0, 0, 0.05))`}var vg=(e,t)=>{if(e.utility!=="text-shadow")return;let r={sm:_t("0 1px 2px"),DEFAULT:_t("0 1px 3px"),md:_t("0 4px 6px"),lg:_t("0 10px 15px"),xl:_t("0 20px 25px"),none:"none"};if(!e.value)return{"text-shadow":r.DEFAULT};if(r[e.value])return{"text-shadow":r[e.value]};if(e.arbitrary&&e.value){if(/\s/.test(e.value))return{"text-shadow":e.value};return{"--tc-text-shadow-color":e.value}}let n=z(e.value,t,e.modifierArbitrary);return n===void 0?void 0:{"--tc-text-shadow-color":n}},wg=(e)=>{if(e.utility==="opacity"&&e.value){let t={0:"0",5:"0.05",10:"0.1",20:"0.2",25:"0.25",30:"0.3",40:"0.4",50:"0.5",60:"0.6",70:"0.7",75:"0.75",80:"0.8",90:"0.9",95:"0.95",100:"1"};if(t[e.value])return{opacity:t[e.value]};if(e.arbitrary)return{opacity:e.value};if(/^\d+$/.test(e.value)){let r=Number.parseInt(e.value,10);if(r>=0&&r<=100)return{opacity:`${r/100}`}}return}},$g=(e)=>{if(e.utility==="mix-blend"){let t=["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"];return e.value&&t.includes(e.value)?{"mix-blend-mode":e.value}:void 0}},Cg=(e)=>{if(e.utility==="bg-blend"){let t=["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"];return e.value&&t.includes(e.value)?{"background-blend-mode":e.value}:void 0}},Rg=(e)=>{if(e.utility==="mask-clip"&&e.value){let t={border:"border-box",padding:"padding-box",content:"content-box",text:"text",fill:"fill-box",stroke:"stroke-box",view:"view-box","no-clip":"no-clip"};if(t[e.value])return{"mask-clip":t[e.value]};return e.arbitrary?{"mask-clip":e.value}:void 0}if(e.utility==="mask-composite"&&e.value)return["add","subtract","intersect","exclude"].includes(e.value)?{"mask-composite":e.value}:void 0;if(e.utility==="mask-image"&&e.value){if(e.value==="none")return{"mask-image":"none"};if(e.arbitrary)return{"mask-image":e.value.startsWith("url(")||e.value.includes("gradient(")?e.value:`url(${e.value})`};return}if(e.utility==="mask-mode"&&e.value)return["alpha","luminance","match-source"].includes(e.value)?{"mask-mode":e.value}:void 0;if(e.utility==="mask-origin"&&e.value){let t={border:"border-box",padding:"padding-box",content:"content-box",fill:"fill-box",stroke:"stroke-box",view:"view-box"};if(t[e.value])return{"mask-origin":t[e.value]};return e.arbitrary?{"mask-origin":e.value}:void 0}if(e.utility==="mask-position"&&e.value){let t={center:"center",top:"top",right:"right",bottom:"bottom",left:"left","top-left":"top left","top-right":"top right","bottom-left":"bottom left","bottom-right":"bottom right"};if(t[e.value])return{"mask-position":t[e.value]};return e.arbitrary?{"mask-position":e.value}:void 0}if(e.utility==="mask-repeat"&&e.value){let t={repeat:"repeat","no-repeat":"no-repeat","repeat-x":"repeat-x","repeat-y":"repeat-y",round:"round",space:"space"};if(t[e.value])return{"mask-repeat":t[e.value]};return e.arbitrary?{"mask-repeat":e.value}:void 0}if(e.utility==="mask-size"&&e.value){let t={auto:"auto",cover:"cover",contain:"contain"};if(t[e.value])return{"mask-size":t[e.value]};return e.arbitrary?{"mask-size":e.value}:void 0}if(e.utility==="mask-type"&&e.value)return["alpha","luminance"].includes(e.value)?{"mask-type":e.value}:void 0},bi=[og,sg,ug,fg,dg,hg,gg,mg,pg,yg,bg,xg,vg,wg,$g,Cg,Rg];var ma={add:"add",subtract:"subtract",intersect:"intersect",exclude:"exclude"},pa={alpha:"alpha",luminance:"luminance",match:"match-source"},ya={auto:"auto",cover:"cover",contain:"contain"},ba={center:"center",top:"top",right:"right",bottom:"bottom",left:"left","top-left":"left top","top-right":"right top","bottom-left":"left bottom","bottom-right":"right bottom"},xa={repeat:"repeat","no-repeat":"no-repeat"},kg=(e)=>{if(e.utility!=="mask"||!e.value)return;let t=e.value;if(e.arbitrary)return{"mask-image":t};if(t==="none")return{"mask-image":"none"};if(ma[t]!==void 0)return{"mask-composite":ma[t]};if(pa[t]!==void 0)return{"mask-mode":pa[t]};if(ya[t]!==void 0)return{"mask-size":ya[t]};if(ba[t]!==void 0)return{"mask-position":ba[t]};if(xa[t]!==void 0)return{"mask-repeat":xa[t]};if(t==="no-clip")return{"mask-clip":"no-clip"};return},Sg=(e)=>{if(e.utility!=="mask-repeat"||e.arbitrary)return;if(e.value==="x")return{"mask-repeat":"repeat-x"};if(e.value==="y")return{"mask-repeat":"repeat-y"};return},qe="linear-gradient(#fff, #fff)";function A(e,t){return`var(--tc-mask-${e}, ${t})`}function Ye(){return{"mask-image":`${A("linear",qe)}, ${A("radial",qe)}, ${A("conic",qe)}`,"mask-composite":"intersect"}}var Ag=[A("left",qe),A("right",qe),A("bottom",qe),A("top",qe)].join(", "),Eg={t:["top"],r:["right"],b:["bottom"],l:["left"],x:["right","left"],y:["top","bottom"]};function Tg(e){let t=`${A(`${e}-from-color`,"black")} ${A(`${e}-from-position`,"0%")}`,r=`${A(`${e}-to-color`,"transparent")} ${A(`${e}-to-position`,"100%")}`;return`linear-gradient(to ${e}, ${t}, ${r})`}var Ng=[A("linear-position","0deg"),`${A("linear-from-color","black")} ${A("linear-from-position","0%")}`,`${A("linear-to-color","transparent")} ${A("linear-to-position","100%")}`].join(", "),Og=/^(?:var|rgb|rgba|hsl|hsla|oklch|oklab|lab|lch|color|color-mix)\(/;function Mr(e,t,r){if(!e)return;if(/^\d+(?:\.\d+)?%$/.test(e))return{position:e};if(/^\d+(?:\.\d+)?$/.test(e)){let i=pe({value:e,arbitrary:!1},r,{});return i===void 0?void 0:{position:i}}if(t)return e.charCodeAt(0)===35||Og.test(e)?{color:e}:{position:e};let n=z(e,r,!1);return n===void 0?void 0:{color:n}}function Fr(e){if(e.startsWith("from-"))return{stop:"from",token:e.slice(5)};if(e.startsWith("to-"))return{stop:"to",token:e.slice(3)};return}var Ig=(e,t)=>{if(e.utility!=="mask"||!e.value||e.arbitrary)return;let r=e.value,n=r.charCodeAt(0)===45,i=n?r.slice(1):r;if(!i.startsWith("linear-"))return;let o=i.slice(7);if(/^\d+(?:\.\d+)?$/.test(o))return{...Ye(),"--tc-mask-linear":`linear-gradient(${A("linear-stops",A("linear-position","0deg"))})`,"--tc-mask-linear-position":`calc(1deg * ${n?"-":""}${o})`};if(n)return;let s=Fr(o);if(s===void 0)return;let l=Mr(s.token,e.arbitrary,t);if(l===void 0)return;let a={...Ye(),"--tc-mask-linear-stops":Ng,"--tc-mask-linear":"linear-gradient(var(--tc-mask-linear-stops))"};if(l.color!==void 0)a[`--tc-mask-linear-${s.stop}-color`]=l.color;else a[`--tc-mask-linear-${s.stop}-position`]=l.position;return a},Pg=(e,t)=>{if(e.utility!=="mask"||!e.value||e.arbitrary)return;let r=e.value,n=r.indexOf("-");if(n===-1)return;let i=Eg[r.slice(0,n)];if(i===void 0)return;let o=Fr(r.slice(n+1));if(o===void 0)return;let s=Mr(o.token,e.arbitrary,t);if(s===void 0)return;let l={...Ye(),"--tc-mask-linear":Ag};for(let a of i)if(l[`--tc-mask-${a}`]=Tg(a),s.color!==void 0)l[`--tc-mask-${a}-${o.stop}-color`]=s.color;else l[`--tc-mask-${a}-${o.stop}-position`]=s.position;return l},_g=[`${A("radial-shape","ellipse")} ${A("radial-size","farthest-corner")} at ${A("radial-position","center")}`,`${A("radial-from-color","black")} ${A("radial-from-position","0%")}`,`${A("radial-to-color","transparent")} ${A("radial-to-position","100%")}`].join(", "),Lg=new Set(["closest-side","closest-corner","farthest-side","farthest-corner"]),Mg={center:"center",top:"top",right:"right",bottom:"bottom",left:"left","top-left":"top left","top-right":"top right","bottom-left":"bottom left","bottom-right":"bottom right"},Fg=[`from ${A("conic-position","0deg")}`,`${A("conic-from-color","black")} ${A("conic-from-position","0%")}`,`${A("conic-to-color","transparent")} ${A("conic-to-position","100%")}`].join(", "),jg=(e,t)=>{if(e.utility==="mask-radial"&&e.arbitrary&&e.value)return{...Ye(),"--tc-mask-radial":`radial-gradient(${A("radial-stops",A("radial-size","farthest-corner"))})`,"--tc-mask-radial-size":e.value};if(e.utility!=="mask"||!e.value||e.arbitrary)return;let r=e.value;if(r==="circle"||r==="ellipse")return{"--tc-mask-radial-shape":r};if(!r.startsWith("radial-"))return;let n=r.slice(7);if(n.startsWith("at-")){let l=Mg[n.slice(3)];return l===void 0?void 0:{"--tc-mask-radial-position":l}}if(Lg.has(n))return{"--tc-mask-radial-size":n};let i=Fr(n);if(i===void 0)return;let o=Mr(i.token,e.arbitrary,t);if(o===void 0)return;let s={...Ye(),"--tc-mask-radial-stops":_g,"--tc-mask-radial":"radial-gradient(var(--tc-mask-radial-stops))"};if(o.color!==void 0)s[`--tc-mask-radial-${i.stop}-color`]=o.color;else s[`--tc-mask-radial-${i.stop}-position`]=o.position;return s},Dg=(e,t)=>{if(e.utility!=="mask"||!e.value||e.arbitrary)return;let r=e.value,n=r.charCodeAt(0)===45,i=n?r.slice(1):r;if(!i.startsWith("conic-"))return;let o=i.slice(6);if(/^\d+(?:\.\d+)?$/.test(o))return{...Ye(),"--tc-mask-conic":`conic-gradient(${A("conic-stops",A("conic-position","0deg"))})`,"--tc-mask-conic-position":`calc(1deg * ${n?"-":""}${o})`};if(n)return;let s=Fr(o);if(s===void 0)return;let l=Mr(s.token,e.arbitrary,t);if(l===void 0)return;let a={...Ye(),"--tc-mask-conic-stops":Fg,"--tc-mask-conic":"conic-gradient(var(--tc-mask-conic-stops))"};if(l.color!==void 0)a[`--tc-mask-conic-${s.stop}-color`]=l.color;else a[`--tc-mask-conic-${s.stop}-position`]=l.position;return a},va=[Ig,Pg,jg,Dg,kg,Sg];var Bg={"2xs":"inset 0 1px",xs:"inset 0 1px 1px",sm:"inset 0 2px 4px"},Ug="rgb(0 0 0 / 0.05)",Vg=/^(?:var|rgb|rgba|hsl|hsla|oklch|oklab|lab|lch|color|color-mix)\(/;function wi(e){return e.charCodeAt(0)===35||Vg.test(e)}function Wg(e){return/^-?[\d.]+[a-z%]*$/i.test(e)||e.startsWith("calc(")||e.startsWith("var(")}function zg(e,t){let r=e.trim().split(/\s+/),n=r[r.length-1];if(r.length>1&&!Wg(n))return`inset ${r.slice(0,-1).join(" ")} var(${t}, ${n})`;return`inset ${e} var(${t}, currentcolor)`}function xi(e){return{"--tc-inset-shadow":e,"box-shadow":V}}var Kg=(e,t)=>{if(e.utility==="inset-shadow"&&e.arbitrary&&e.value){if(!/\s/.test(e.value)&&wi(e.value))return{"--tc-inset-shadow-color":e.value};return xi(zg(e.value,"--tc-inset-shadow-color"))}if(e.utility!=="inset"||!e.value||e.arbitrary)return;if(!e.value.startsWith("shadow-"))return;let r=e.value.slice(7),n=Bg[r];if(n!==void 0)return xi(`${n} var(--tc-inset-shadow-color, ${Ug})`);if(r==="none")return xi(`inset ${_r}`);let i=z(r,t,e.modifierArbitrary);return i===void 0?void 0:{"--tc-inset-shadow-color":i}};function vi(e){return{"--tc-inset-ring-shadow":`inset 0 0 0 ${e} var(--tc-inset-ring-color, currentcolor)`,"box-shadow":V}}var Gg=(e,t)=>{if(e.utility==="inset-ring"&&e.arbitrary&&e.value){if(wi(e.value))return{"--tc-inset-ring-color":e.value};return vi(e.value)}if(e.utility!=="inset"||!e.value||e.arbitrary)return;if(e.value!=="ring"&&!e.value.startsWith("ring-"))return;if(e.value==="ring")return vi("1px");let r=e.value.slice(5);if(/^\d+(?:\.\d+)?$/.test(r))return vi(`${r}px`);let n=z(r,t,e.modifierArbitrary);return n===void 0?void 0:{"--tc-inset-ring-color":n}},Hg=(e,t)=>{if(e.utility!=="drop-shadow"||!e.value)return;if(e.arbitrary){if(/\s/.test(e.value))return;return wi(e.value)?{"--tc-drop-shadow-color":e.value}:void 0}let r=z(e.value,t,e.modifierArbitrary);return r===void 0?void 0:{"--tc-drop-shadow-color":r}},wa=[Kg,Gg,Hg];var jr={appearance:"none","background-color":"#fff","border-color":"#6b7280","border-width":"1px","border-radius":"0px","padding-top":"0.5rem","padding-right":"0.75rem","padding-bottom":"0.5rem","padding-left":"0.75rem","font-size":"1rem","line-height":"1.5rem"},$a={appearance:"none",padding:"0","print-color-adjust":"exact",display:"inline-block","vertical-align":"middle","background-origin":"border-box","user-select":"none","flex-shrink":"0",height:"1rem",width:"1rem",color:"#2563eb","background-color":"#fff","border-color":"#6b7280","border-width":"1px"};function gt(e,t){return e.utility==="form"&&e.value===t||e.utility===`form-${t}`&&!e.value}var qg=(e)=>{if(gt(e,"input"))return jr},Yg=(e)=>{if(gt(e,"textarea"))return jr},Jg=(e)=>{if(gt(e,"select"))return{...jr,"background-image":`url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e")`,"background-position":"right 0.5rem center","background-repeat":"no-repeat","background-size":"1.5em 1.5em","padding-right":"2.5rem","print-color-adjust":"exact"}},Xg=(e)=>{if(gt(e,"multiselect"))return{...jr,"background-image":"initial","background-position":"initial","background-repeat":"unset","background-size":"initial","print-color-adjust":"unset"}},Zg=(e)=>{if(gt(e,"checkbox"))return{...$a,"border-radius":"0px"}},Qg=(e)=>{if(gt(e,"radio"))return{...$a,"border-radius":"100%"}},Ca=[qg,Yg,Jg,Xg,Zg,Qg];var em={gap:"gap","gap-x":"column-gap","gap-y":"row-gap"},mt=/^-?\d+$/,Ra=/^span-(\d+)$/,tm=(e)=>{if(e.utility==="grid-cols"&&e.value){if(e.arbitrary)return{"grid-template-columns":e.value};if(e.value==="none"||e.value==="subgrid")return{"grid-template-columns":e.value};if(/^\d+$/.test(e.value))return{"grid-template-columns":`repeat(${e.value}, minmax(0, 1fr))`};return}},rm=(e)=>{if(e.utility==="col"){if(!e.value)return;if(e.arbitrary)return{"grid-column":e.value};if(e.value==="auto")return{"grid-column":"auto"};if(e.value==="span-full")return{"grid-column":"1 / -1"};let t=e.value.match(Ra);if(t)return{"grid-column":`span ${t[1]} / span ${t[1]}`};if(mt.test(e.value))return{"grid-column":e.value};return}if(e.utility==="col-span"&&e.value){if(e.arbitrary)return{"grid-column":`span ${e.value} / span ${e.value}`};if(e.value==="auto")return{"grid-column":"auto"};if(e.value==="full")return{"grid-column":"1 / -1"};if(/^\d+$/.test(e.value))return{"grid-column":`span ${e.value} / span ${e.value}`};return}if(e.utility==="col-start"&&e.value){if(e.arbitrary||e.value==="auto"||mt.test(e.value))return{"grid-column-start":e.value};return}if(e.utility==="col-end"&&e.value){if(e.arbitrary||e.value==="auto"||mt.test(e.value))return{"grid-column-end":e.value};return}},nm=(e)=>{if(e.utility==="grid-rows"&&e.value){if(e.arbitrary)return{"grid-template-rows":e.value};if(e.value==="none"||e.value==="subgrid")return{"grid-template-rows":e.value};if(/^\d+$/.test(e.value))return{"grid-template-rows":`repeat(${e.value}, minmax(0, 1fr))`};return}},im=(e)=>{if(e.utility==="row"){if(!e.value)return;if(e.arbitrary)return{"grid-row":e.value};if(e.value==="auto")return{"grid-row":"auto"};if(e.value==="span-full")return{"grid-row":"1 / -1"};let t=e.value.match(Ra);if(t)return{"grid-row":`span ${t[1]} / span ${t[1]}`};if(mt.test(e.value))return{"grid-row":e.value};return}if(e.utility==="row-span"&&e.value){if(e.arbitrary)return{"grid-row":`span ${e.value} / span ${e.value}`};if(e.value==="auto")return{"grid-row":"auto"};if(e.value==="full")return{"grid-row":"1 / -1"};if(/^\d+$/.test(e.value))return{"grid-row":`span ${e.value} / span ${e.value}`};return}if(e.utility==="row-start"&&e.value){if(e.arbitrary||e.value==="auto"||mt.test(e.value))return{"grid-row-start":e.value};return}if(e.utility==="row-end"&&e.value){if(e.arbitrary||e.value==="auto"||mt.test(e.value))return{"grid-row-end":e.value};return}},om=(e)=>{if(e.utility==="grid-flow"&&e.value){let t={row:"row",col:"column",dense:"dense","row-dense":"row dense","col-dense":"column dense"};return t[e.value]?{"grid-auto-flow":t[e.value]}:void 0}return},sm=(e)=>{if(e.utility==="auto-cols"&&e.value){let t={auto:"auto",min:"min-content",max:"max-content",fr:"minmax(0, 1fr)"};if(e.arbitrary)return{"grid-auto-columns":e.value};return t[e.value]?{"grid-auto-columns":t[e.value]}:void 0}},am=(e)=>{if(e.utility==="auto-rows"&&e.value){let t={auto:"auto",min:"min-content",max:"max-content",fr:"minmax(0, 1fr)"};if(e.arbitrary)return{"grid-auto-rows":e.value};return t[e.value]?{"grid-auto-rows":t[e.value]}:void 0}};function lm(e,t,r){let n=t.theme.spacing?.[r];if(n!==void 0)return n;if(e.arbitrary)return r;if(/^\d+(?:\.\d+)?$/.test(r)){let i=Number.parseFloat(r);if(Number.isFinite(i))return`${i*0.25}rem`}return}var cm=(e,t)=>{let r=em[e.utility];if(!r||!e.value)return;let n=lm(e,t,e.value);return n!==void 0?{[r]:n}:void 0},um=(e)=>{if(e.utility==="place"&&e.value&&e.value.startsWith("content-")){let t=e.value.replace("content-",""),r={center:"center",start:"start",end:"end",between:"space-between",around:"space-around",evenly:"space-evenly",stretch:"stretch"};return r[t]?{"place-content":r[t]}:void 0}return},fm=(e)=>{if(e.utility==="place"&&e.value&&e.value.startsWith("items-")){let t=e.value.replace("items-",""),r={start:"start",end:"end",center:"center",stretch:"stretch"};return r[t]?{"place-items":r[t]}:void 0}return},dm=(e)=>{if(e.utility==="place"&&e.value&&e.value.startsWith("self-")){let t=e.value.replace("self-",""),r={auto:"auto",start:"start",end:"end",center:"center",stretch:"stretch"};return r[t]?{"place-self":r[t]}:void 0}return},ka=[tm,rm,nm,im,om,sm,am,cm,um,fm,dm];import{existsSync as Sa,readFileSync as hm,readdirSync as gm}from"fs";import{join as Dr}from"path";var Br=new Map;function mm(e){if(Br.has(e))return Br.get(e);let t=[Dr(process.cwd(),"node_modules","@iconify-json",e,"icons.json"),Dr(process.cwd(),"node_modules",".bun","@iconify-json",e,"icons.json")],r=Dr(process.cwd(),"node_modules",".bun");if(Sa(r))try{let n=`@iconify-json+${e}@`;for(let i of gm(r))if(i.startsWith(n))t.push(Dr(r,i,"node_modules","@iconify-json",e,"icons.json"))}catch{}for(let n of t)if(Sa(n))try{let i=JSON.parse(hm(n,"utf-8"));return Br.set(e,i),i}catch{}return Br.set(e,null),null}function pm(e,t){let r=e.icons[t];if(r)return r;let n=e.aliases?.[t];if(n)return e.icons[n.parent]??null;return null}function ym(e,t){let r=t.width??e.width??24,n=t.height??e.height??24,i=t.left??0,o=t.top??0;return`<svg xmlns='http://www.w3.org/2000/svg' viewBox='${i} ${o} ${r} ${n}' width='${r}' height='${n}'>${t.body}</svg>`}function bm(e){return`url("data:image/svg+xml;utf8,${e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\?/g,"%3F").replace(/\s+/g," ")}")`}var xm=/^i-([a-z][a-z0-9]*(?:-[a-z0-9]+)*)-(.+)$/;function vm(e){if(!e.startsWith("i-"))return;let t=e.slice(2);for(let r=t.indexOf("-");r!==-1;r=t.indexOf("-",r+1)){let n=t.slice(0,r),i=t.slice(r+1);if(!/^[a-z][a-z0-9-]*$/.test(n))continue;let o=mm(n);if(!o)continue;let s=pm(o,i);if(s)return{collection:o,icon:s}}return}var Aa=(e,t)=>{if(!xm.test(e.base))return;let r=vm(e.base);if(!r)return;let{collection:n,icon:i}=r,o=bm(ym(n,i));return{defaults:!0,properties:{display:"inline-block",width:"1em",height:"1em","background-color":"currentColor","-webkit-mask":`${o} no-repeat`,mask:`${o} no-repeat`,"-webkit-mask-size":"100% 100%","mask-size":"100% 100%","vertical-align":"-0.125em"}}};var Ea={"border-collapse":"collapse","border-separate":"separate"},Ta={"caption-top":"top","caption-bottom":"bottom"},Na={"field-sizing-content":"content","field-sizing-fixed":"fixed"},Oa={"cursor-auto":"auto","cursor-default":"default","cursor-pointer":"pointer","cursor-wait":"wait","cursor-text":"text","cursor-move":"move","cursor-help":"help","cursor-not-allowed":"not-allowed","cursor-none":"none","cursor-context-menu":"context-menu","cursor-progress":"progress","cursor-cell":"cell","cursor-crosshair":"crosshair","cursor-vertical-text":"vertical-text","cursor-alias":"alias","cursor-copy":"copy","cursor-no-drop":"no-drop","cursor-grab":"grab","cursor-grabbing":"grabbing","cursor-all-scroll":"all-scroll","cursor-col-resize":"col-resize","cursor-row-resize":"row-resize","cursor-n-resize":"n-resize","cursor-e-resize":"e-resize","cursor-s-resize":"s-resize","cursor-w-resize":"w-resize","cursor-ne-resize":"ne-resize","cursor-nw-resize":"nw-resize","cursor-se-resize":"se-resize","cursor-sw-resize":"sw-resize","cursor-ew-resize":"ew-resize","cursor-ns-resize":"ns-resize","cursor-nesw-resize":"nesw-resize","cursor-nwse-resize":"nwse-resize","cursor-zoom-in":"zoom-in","cursor-zoom-out":"zoom-out"},Ia={"pointer-events-none":"none","pointer-events-auto":"auto"},Pa={"resize-none":"none",resize:"both","resize-y":"vertical","resize-x":"horizontal"},_a={"scroll-auto":"auto","scroll-smooth":"smooth"},La={"snap-none":"none","snap-x":"x var(--tc-scroll-snap-strictness, proximity)","snap-y":"y var(--tc-scroll-snap-strictness, proximity)","snap-both":"both var(--tc-scroll-snap-strictness, proximity)"},Ma={"snap-mandatory":"mandatory","snap-proximity":"proximity"},Fa={"snap-start":"start","snap-end":"end","snap-center":"center","snap-align-none":"none"},ja={"snap-normal":"normal","snap-always":"always"},Da={"touch-auto":"auto","touch-none":"none","touch-pan-x":"pan-x","touch-pan-left":"pan-left","touch-pan-right":"pan-right","touch-pan-y":"pan-y","touch-pan-up":"pan-up","touch-pan-down":"pan-down","touch-pinch-zoom":"pinch-zoom","touch-manipulation":"manipulation"},Ba={"select-none":"none","select-text":"text","select-all":"all","select-auto":"auto"},Ua={"will-change-auto":"auto","will-change-scroll":"scroll-position","will-change-contents":"contents","will-change-transform":"transform"},Va={"stroke-linecap-butt":"butt","stroke-linecap-round":"round","stroke-linecap-square":"square"},Wa={"stroke-linejoin-miter":"miter","stroke-linejoin-round":"round","stroke-linejoin-bevel":"bevel"},za={"forced-color-adjust-auto":"auto","forced-color-adjust-none":"none"},$i={none:"0",sm:"4px",DEFAULT:"8px",md:"12px",lg:"16px",xl:"24px","2xl":"40px","3xl":"64px"};function Ha(e){if(e.arbitrary)return e.value;if(/^\d+(?:\.\d+)?$/.test(e.value))return`${Number(e.value)/100}`;return}function qa(e){if(!e.value)return $i.DEFAULT;if($i[e.value]!==void 0)return $i[e.value];if(e.arbitrary)return e.value;if(/^\d+(?:\.\d+)?$/.test(e.value))return`${e.value}px`;return}var Ya=["brightness","contrast","grayscale","invert","saturate","sepia"],wm=["blur","brightness","contrast","grayscale","hue-rotate","invert","saturate","sepia","drop-shadow"],$m=["blur","brightness","contrast","grayscale","hue-rotate","invert","opacity","saturate","sepia"],Cm=wm.map((e)=>`var(--tc-${e}, )`).join(" "),Ka=$m.map((e)=>`var(--tc-backdrop-${e}, )`).join(" ");function Je(e,t){return{[`--tc-${e}`]:t,filter:Cm}}function Ur(e,t){return{[`--tc-backdrop-${e}`]:t,"-webkit-backdrop-filter":Ka,"backdrop-filter":Ka}}var Rm=(e)=>{if(e.base==="filter-none")return{filter:"none"};if(e.utility==="blur"){let t=qa(e);return t!==void 0?Je("blur",`blur(${t})`):void 0}if(Ya.includes(e.utility)&&e.value){let t=Ha(e);return t!==void 0?Je(e.utility,`${e.utility}(${t})`):void 0}if(e.utility==="hue-rotate"&&e.value){if(e.arbitrary)return Je("hue-rotate",`hue-rotate(${e.value})`);if(/^-?\d+(?:\.\d+)?$/.test(e.value))return Je("hue-rotate",`hue-rotate(${e.value}deg)`);return}if(e.utility==="drop-shadow"){let t={sm:"drop-shadow(0 1px 1px rgb(0 0 0 / 0.05))",DEFAULT:"drop-shadow(0 1px 2px rgb(0 0 0 / 0.1)) drop-shadow(0 1px 1px rgb(0 0 0 / 0.06))",md:"drop-shadow(0 4px 3px rgb(0 0 0 / 0.07)) drop-shadow(0 2px 2px rgb(0 0 0 / 0.06))",lg:"drop-shadow(0 10px 8px rgb(0 0 0 / 0.04)) drop-shadow(0 4px 3px rgb(0 0 0 / 0.1))",xl:"drop-shadow(0 20px 13px rgb(0 0 0 / 0.03)) drop-shadow(0 8px 5px rgb(0 0 0 / 0.08))","2xl":"drop-shadow(0 25px 25px rgb(0 0 0 / 0.15))",none:"drop-shadow(0 0 #0000)"};if(!e.value)return Je("drop-shadow",t.DEFAULT);if(t[e.value])return Je("drop-shadow",t[e.value]);if(e.arbitrary)return Je("drop-shadow",`drop-shadow(${e.value})`);return}},km=(e)=>{if(e.base==="backdrop-filter-none")return{"backdrop-filter":"none"};if(e.utility==="backdrop-blur"){let t=qa(e);return t!==void 0?Ur("blur",`blur(${t})`):void 0}if(e.utility.startsWith("backdrop-")&&e.value){let t=e.utility.slice(9);if(Ya.includes(t)||t==="opacity"){let r=Ha(e);if(r===void 0)return;return Ur(t,`${t}(${r})`)}if(t==="hue-rotate"){if(e.arbitrary)return Ur(t,`hue-rotate(${e.value})`);if(/^-?\d+(?:\.\d+)?$/.test(e.value))return Ur(t,`hue-rotate(${e.value}deg)`);return}}},Sm=(e)=>Ea[e.base]?{"border-collapse":Ea[e.base]}:void 0,Am=(e,t)=>{if(!e.utility.startsWith("border-spacing")||!e.value)return;let r=t.theme.spacing[e.value];if(r===void 0&&e.arbitrary)r=e.value;if(r===void 0&&/^\d+(?:\.\d+)?$/.test(e.value))r=`${Number.parseFloat(e.value)*0.25}rem`;if(r===void 0)return;if(e.utility==="border-spacing")return{"border-spacing":`${r} ${r}`};if(e.utility==="border-spacing-x")return{"border-spacing":`${r} 0`};if(e.utility==="border-spacing-y")return{"border-spacing":`0 ${r}`}},Em=(e)=>{if(e.utility==="table"&&e.value){let t={auto:"auto",fixed:"fixed"};return t[e.value]?{"table-layout":t[e.value]}:void 0}return},Tm=(e)=>Ta[e.base]?{"caption-side":Ta[e.base]}:void 0,Nm=(e,t)=>{if(e.utility==="accent"&&e.value){let r=z(e.value,t,e.modifierArbitrary);if(r)return{"accent-color":r}}},Om=(e)=>{let t={"appearance-none":"none","appearance-auto":"auto","appearance-base":"base"};return t[e.base]?{appearance:t[e.base]}:void 0},Im=(e,t)=>{if(e.utility==="caret"&&e.value){let r=z(e.value,t,e.modifierArbitrary);if(r)return{"caret-color":r}}},Pm={normal:"normal",light:"light",dark:"dark","light-dark":"light dark","only-dark":"only dark","only-light":"only light"},Ga=(e)=>{let t=e.base,r=t.startsWith("scheme-")?t.slice(7):t.startsWith("color-scheme-")?t.slice(13):void 0;if(r===void 0)return;let n=Pm[r];return n?{"color-scheme":n}:void 0},_m=(e)=>Na[e.base]?{"field-sizing":Na[e.base]}:void 0,Lm=(e)=>Oa[e.base]?{cursor:Oa[e.base]}:void 0,Mm=(e)=>Ia[e.base]?{"pointer-events":Ia[e.base]}:void 0,Fm=(e)=>Pa[e.base]?{resize:Pa[e.base]}:void 0,jm=(e)=>_a[e.base]?{"scroll-behavior":_a[e.base]}:void 0,Dm=(e,t)=>{let n={"scroll-m":["scroll-margin"],"scroll-mx":["scroll-margin-left","scroll-margin-right"],"scroll-my":["scroll-margin-top","scroll-margin-bottom"],"scroll-mt":["scroll-margin-top"],"scroll-mr":["scroll-margin-right"],"scroll-mb":["scroll-margin-bottom"],"scroll-ml":["scroll-margin-left"]}[e.utility];if(!n||!e.value)return;let i=t.theme.spacing[e.value];if(i===void 0&&e.arbitrary)i=e.value;if(i===void 0&&/^\d+(?:\.\d+)?$/.test(e.value))i=`${Number.parseFloat(e.value)*0.25}rem`;if(i===void 0)return;let o={};for(let s of n)o[s]=i;return o},Bm=(e,t)=>{let n={"scroll-p":["scroll-padding"],"scroll-px":["scroll-padding-left","scroll-padding-right"],"scroll-py":["scroll-padding-top","scroll-padding-bottom"],"scroll-pt":["scroll-padding-top"],"scroll-pr":["scroll-padding-right"],"scroll-pb":["scroll-padding-bottom"],"scroll-pl":["scroll-padding-left"]}[e.utility];if(!n||!e.value)return;let i=t.theme.spacing[e.value];if(i===void 0&&e.arbitrary)i=e.value;if(i===void 0&&/^\d+(?:\.\d+)?$/.test(e.value))i=`${Number.parseFloat(e.value)*0.25}rem`;if(i===void 0)return;let o={};for(let s of n)o[s]=i;return o},Um=(e)=>{if(La[e.base])return{"scroll-snap-type":La[e.base]};if(Ma[e.base])return{"--tc-scroll-snap-strictness":Ma[e.base]};if(Fa[e.base])return{"scroll-snap-align":Fa[e.base]};if(ja[e.base])return{"scroll-snap-stop":ja[e.base]}},Vm=(e)=>Da[e.base]?{"touch-action":Da[e.base]}:void 0,Wm=(e)=>Ba[e.base]?{"user-select":Ba[e.base]}:void 0,zm=(e)=>Ua[e.base]?{"will-change":Ua[e.base]}:void 0,Km=(e,t)=>{if(e.utility==="fill"&&e.value){if(e.value==="none")return{fill:"none"};let r=z(e.value,t,e.modifierArbitrary);if(r)return{fill:r}}},Gm=(e,t)=>{if(e.utility==="stroke"&&e.value){if(e.value==="none")return{stroke:"none"};let r=z(e.value,t,e.modifierArbitrary);if(r)return{stroke:r}}},Hm=(e)=>{if(e.utility==="stroke"&&e.value){if(e.arbitrary||/^\d+(?:\.\d+)?$/.test(e.value))return{"stroke-width":e.value};return}},qm=(e)=>{if(e.utility==="stroke-dasharray"&&e.value){if(e.value==="none")return{"stroke-dasharray":"none"};if(e.arbitrary||/^\d+(?:\.\d+)?$/.test(e.value))return{"stroke-dasharray":e.value};return}},Ym=(e)=>{if(e.utility==="stroke-dashoffset"&&e.value){if(e.arbitrary||/^-?\d+(?:\.\d+)?$/.test(e.value))return{"stroke-dashoffset":e.value};return}},Jm=(e)=>Va[e.base]?{"stroke-linecap":Va[e.base]}:void 0,Xm=(e)=>Wa[e.base]?{"stroke-linejoin":Wa[e.base]}:void 0,Zm=(e)=>{if(e.base==="sr-only")return{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)","white-space":"nowrap","border-width":"0"};if(e.base==="not-sr-only")return{position:"static",width:"auto",height:"auto",padding:"0",margin:"0",overflow:"visible",clip:"auto","white-space":"normal"};return},Qm=(e)=>za[e.base]?{"forced-color-adjust":za[e.base]}:void 0,Ja=[Rm,km,Sm,Am,Em,Tm,Nm,Om,Ga,Im,Ga,_m,Lm,Mm,Fm,jm,Dm,Bm,Um,Vm,Wm,zm,Km,Gm,Hm,qm,Ym,Jm,Xm,Zm,Qm];function $e(e,t){let r=e/t*100;if(!Number.isFinite(r))return;return`${ep(r)}%`}function ep(e){if(Number.isInteger(e))return String(e);return e.toFixed(6).replace(/\.?0+$/,"")}var Xa={"column-fill-auto":"auto","column-fill-balance":"balance","column-fill-balance-all":"balance-all"},Za={"column-span-all":"all","column-span-none":"none"},Qa={"box-decoration-clone":"clone","box-decoration-slice":"slice"},el={"box-border":"border-box","box-content":"content-box"},tl={"float-start":"inline-start","float-end":"inline-end","float-right":"right","float-left":"left","float-none":"none"},rl={"clear-start":"inline-start","clear-end":"inline-end","clear-left":"left","clear-right":"right","clear-both":"both","clear-none":"none"},nl={isolate:"isolate","isolation-auto":"auto"},il={"object-contain":"contain","object-cover":"cover","object-fill":"fill","object-none":"none","object-scale-down":"scale-down"},ol={"object-bottom":"bottom","object-center":"center","object-left":"left","object-left-bottom":"left bottom","object-left-top":"left top","object-right":"right","object-right-bottom":"right bottom","object-right-top":"right top","object-top":"top"},sl={"overscroll-auto":"auto","overscroll-contain":"contain","overscroll-none":"none","overscroll-x-auto":"auto","overscroll-x-contain":"contain","overscroll-x-none":"none","overscroll-y-auto":"auto","overscroll-y-contain":"contain","overscroll-y-none":"none"},al={visible:"visible",invisible:"hidden",collapse:"collapse"},tp=(e)=>{if(e.utility==="aspect"&&e.value){let t={auto:"auto",square:"1 / 1",video:"16 / 9"};if(t[e.value])return{"aspect-ratio":t[e.value]};if(e.arbitrary)return{"aspect-ratio":e.value};let r=e.value.match(/^(\d+(?:\.\d+)?)\/(\d+(?:\.\d+)?)$/);if(r)return{"aspect-ratio":`${r[1]} / ${r[2]}`};if(/^\d+(?:\.\d+)?$/.test(e.value))return{"aspect-ratio":e.value};return}},rp=(e,t)=>{if(e.utility==="columns"&&e.value){let r={"1":"1","2":"2","3":"3","4":"4","5":"5","6":"6","7":"7","8":"8","9":"9","10":"10","11":"11","12":"12",auto:"auto"},n={"3xs":"16rem","2xs":"18rem",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem"};if(r[e.value])return{columns:r[e.value]};if(n[e.value])return{columns:n[e.value]};if(t.theme.spacing[e.value])return{columns:t.theme.spacing[e.value]};if(e.arbitrary||/^\d+$/.test(e.value))return{columns:e.value};return}},np=(e)=>Xa[e.base]?{"column-fill":Xa[e.base]}:void 0,ip=(e,t)=>{if(e.utility==="column-gap"&&e.value){let r=t.theme.spacing[e.value];if(r===void 0&&e.arbitrary)r=e.value;if(r===void 0&&/^\d+(?:\.\d+)?$/.test(e.value))r=`${Number.parseFloat(e.value)*0.25}rem`;return r!==void 0?{"column-gap":r}:void 0}},op=(e,t)=>{if(e.utility==="column-rule"&&e.value){let r={"0":"0px","1":"1px","2":"2px","4":"4px","8":"8px"};if(r[e.value])return{"column-rule-width":r[e.value]};let n=e.value.split("-");if(n.length===2){let[s,l]=n,a=t.theme.colors[s];if(typeof a==="object"&&a[l])return{"column-rule-color":W(e.value,a[l],s,t.colorVariables)}}let i=t.theme.colors[e.value];if(typeof i==="string")return{"column-rule-color":W(e.value,i,e.value,t.colorVariables)};if(typeof i==="object"&&i!==null&&typeof i.DEFAULT==="string")return{"column-rule-color":W(e.value,i.DEFAULT,e.value,t.colorVariables)};let o={solid:"solid",dashed:"dashed",dotted:"dotted",double:"double",hidden:"hidden",none:"none"};if(o[e.value])return{"column-rule-style":o[e.value]}}},sp=(e)=>Za[e.base]?{"column-span":Za[e.base]}:void 0,ap=(e)=>({"break-before-auto":{"break-before":"auto"},"break-before-avoid":{"break-before":"avoid"},"break-before-all":{"break-before":"all"},"break-before-avoid-page":{"break-before":"avoid-page"},"break-before-page":{"break-before":"page"},"break-after-auto":{"break-after":"auto"},"break-after-avoid":{"break-after":"avoid"},"break-after-all":{"break-after":"all"},"break-after-avoid-page":{"break-after":"avoid-page"},"break-after-page":{"break-after":"page"},"break-inside-auto":{"break-inside":"auto"},"break-inside-avoid":{"break-inside":"avoid"},"break-inside-avoid-page":{"break-inside":"avoid-page"},"break-inside-avoid-column":{"break-inside":"avoid-column"}})[e.base],lp=(e)=>Qa[e.base]?{"box-decoration-break":Qa[e.base]}:void 0,cp=(e)=>el[e.base]?{"box-sizing":el[e.base]}:void 0,up=(e)=>tl[e.base]?{float:tl[e.base]}:void 0,fp=(e)=>rl[e.base]?{clear:rl[e.base]}:void 0,dp=(e)=>nl[e.base]?{isolation:nl[e.base]}:void 0,ll=["size","inline-size","layout","paint","style"],hp=ll.map((e)=>`var(--tc-contain-${e}, )`).join(" "),gp=["none","content","strict"],mp=(e)=>{if(e.utility!=="contain"||!e.value)return;if(e.arbitrary)return{contain:e.value};if(gp.includes(e.value))return{contain:e.value};if(ll.includes(e.value))return{[`--tc-contain-${e.value}`]:e.value,contain:hp};return},pp=(e)=>il[e.base]?{"object-fit":il[e.base]}:void 0,yp=(e)=>ol[e.base]?{"object-position":ol[e.base]}:void 0,bp=(e)=>{if(e.utility==="overflow"){let t=["auto","hidden","clip","visible","scroll"];if(e.value&&t.includes(e.value))return{overflow:e.value}}if(e.utility==="overflow-x"||e.utility==="overflow-y"){let t=["auto","hidden","clip","visible","scroll"];if(e.value&&t.includes(e.value))return{[e.utility]:e.value}}},xp=(e)=>{let t=e.base.startsWith("overscroll-x")?"overscroll-behavior-x":e.base.startsWith("overscroll-y")?"overscroll-behavior-y":"overscroll-behavior";return sl[e.base]?{[t]:sl[e.base]}:void 0},vp=(e)=>{if(["static","fixed","absolute","relative","sticky"].includes(e.utility))return{position:e.utility}},wp=(e,t)=>{let n={inset:["top","right","bottom","left"],"inset-x":["left","right"],"inset-y":["top","bottom"],top:["top"],right:["right"],bottom:["bottom"],left:["left"],start:["inset-inline-start"],end:["inset-inline-end"]}[e.utility];if(!n||!e.value)return;let i=(l)=>{if(l.includes("/")&&!e.arbitrary){let[c,u]=l.split("/").map(Number);if(!Number.isNaN(c)&&!Number.isNaN(u)&&u!==0)return $e(c,u);return}if(l==="full")return"100%";if(l==="auto")return"auto";if(e.arbitrary)return l;let a=t.theme.spacing[l];if(a!==void 0)return a;if(/^\d+(?:\.\d+)?$/.test(l))return`${Number.parseFloat(l)*0.25}rem`;return},o;if(e.value.startsWith("-")){let l=e.value.slice(1),a=i(l);if(a===void 0)o=void 0;else if(a.endsWith("%"))o=`${-Number.parseFloat(a)}%`;else o=a.startsWith("-")?a:`-${a}`}else o=i(e.value);if(o===void 0)return;let s={};for(let l of n)s[l]=o;return s},$p=(e)=>al[e.utility]?{visibility:al[e.utility]}:void 0,Cp=(e)=>{if(e.utility==="z"&&e.value){if(e.arbitrary||e.value==="auto"||/^-?\d+$/.test(e.value))return{"z-index":e.value};return}},cl=[tp,rp,np,ip,op,sp,ap,lp,cp,up,fp,mp,dp,pp,yp,bp,xp,vp,wp,$p,Cp];var Rp={rotate:"rotate","rotate-x":"rotateX","rotate-y":"rotateY","rotate-z":"rotateZ"},kp={"translate-x":"translateX","translate-y":"translateY","translate-z":"translateZ"},ul={"backface-visible":"visible","backface-hidden":"hidden"},fl={"transform-flat":"flat","transform-3d":"preserve-3d"},dl={"transition-none":"none","transition-all":"all",transition:"color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter","transition-colors":"color, background-color, border-color, text-decoration-color, fill, stroke","transition-opacity":"opacity","transition-shadow":"box-shadow","transition-transform":"transform"},hl={"ease-linear":"linear","ease-in":"cubic-bezier(0.4, 0, 1, 1)","ease-out":"cubic-bezier(0, 0, 0.2, 1)","ease-in-out":"cubic-bezier(0.4, 0, 0.2, 1)","ease-initial":"initial"},gl={"transition-normal":"normal","transition-discrete":"allow-discrete","transition-behavior-normal":"normal","transition-behavior-allow-discrete":"allow-discrete"},ml={none:"none",spin:"spin 1s linear infinite",ping:"ping 1s cubic-bezier(0, 0, 0.2, 1) infinite",pulse:"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",bounce:"bounce 1s infinite"},pl={"animate-running":"running","animate-paused":"paused"},yl={"animate-normal":"normal","animate-reverse":"reverse","animate-alternate":"alternate","animate-alternate-reverse":"alternate-reverse"},bl={"animate-fill-none":"none","animate-fill-forwards":"forwards","animate-fill-backwards":"backwards","animate-fill-both":"both"},xl={"animate-ease-linear":"linear","animate-ease-in":"cubic-bezier(0.4, 0, 1, 1)","animate-ease-out":"cubic-bezier(0, 0, 0.2, 1)","animate-ease-in-out":"cubic-bezier(0.4, 0, 0.2, 1)"},vl="rotate(var(--tc-rotate, 0deg)) skewX(var(--tc-skew-x, 0deg)) skewY(var(--tc-skew-y, 0deg)) scaleX(var(--tc-scale-x, 1)) scaleY(var(--tc-scale-y, 1))",Lt=`translate(var(--tc-translate-x, 0), var(--tc-translate-y, 0)) ${vl}`,Ri=`translate3d(var(--tc-translate-x, 0), var(--tc-translate-y, 0), 0) ${vl}`,Sp={transform:Lt,"transform-cpu":Lt,"transform-gpu":Ri,"transform-none":"none"},Ap=(e)=>{let t=Sp[e.base];return t?{transform:t}:void 0};function Vr(e,t){if(!t.value)return{transform:`${e}(1)`};if(t.arbitrary)return{transform:`${e}(${t.value})`};if(/^-?\d+(?:\.\d+)?$/.test(t.value))return{transform:`${e}(${Number(t.value)/100})`};return}function Ci(e){let t=e.value;if(e.arbitrary)return t;if(/^-?\d+(?:\.\d+)?$/.test(t))return`${t}deg`;if(/^-?\d+(?:\.\d+)?(?:deg|rad|grad|turn)$/.test(t))return t;return}var Ep=(e)=>{if(e.utility==="scale")return Vr("scale",e);if(e.utility==="scale-x")return Vr("scaleX",e);if(e.utility==="scale-y")return Vr("scaleY",e);if(e.utility==="scale-z")return Vr("scaleZ",e)},Tp=(e)=>{if(!e.value)return;let t=Rp[e.utility];if(!t)return;let r=Ci(e);return r!==void 0?{transform:`${t}(${r})`}:void 0},Np=(e,t)=>{let r=(o)=>{if(o.includes("/")){let[l,a]=o.split("/");return $e(Number(l),Number(a))}if(o==="full")return"100%";if(o==="half")return"50%";if(e.arbitrary)return o;let s=t.theme.spacing[o];if(s!==void 0)return s;if(/^\d+(?:\.\d+)?$/.test(o))return`${Number.parseFloat(o)*0.25}rem`;return},n=kp[e.utility];if(!n||!e.value)return;let i;if(e.value.startsWith("-")){let o=r(e.value.slice(1));i=o===void 0?void 0:`-${o}`}else i=r(e.value);return i!==void 0?{transform:`${n}(${i})`}:void 0},Op=(e)=>{if(e.utility==="skew-x"&&e.value){let t=Ci(e);return t!==void 0?{transform:`skewX(${t})`}:void 0}if(e.utility==="skew-y"&&e.value){let t=Ci(e);return t!==void 0?{transform:`skewY(${t})`}:void 0}},Ip=(e)=>{if(e.utility==="origin"&&e.value){if(e.arbitrary)return{"transform-origin":e.value.replace(/_/g," ")};let t={center:"center",top:"top","top-right":"top right",right:"right","bottom-right":"bottom right",bottom:"bottom","bottom-left":"bottom left",left:"left","top-left":"top left"};return t[e.value]?{"transform-origin":t[e.value]}:void 0}return},Pp={dramatic:"100px",near:"300px",normal:"500px",midrange:"800px",distant:"1200px"},_p=(e)=>{if(e.utility==="perspective"&&e.value){if(e.value==="none")return{perspective:"none"};if(e.arbitrary||/^\d+(?:\.\d+)?(?:px|rem|em)$/.test(e.value))return{perspective:e.value};let t=Pp[e.value];if(t)return{perspective:t};if(/^\d+(?:\.\d+)?$/.test(e.value))return{perspective:`${e.value}px`};return}return},Lp=(e)=>{if(e.utility==="perspective-origin"&&e.value)return{"perspective-origin":{center:"center",top:"top","top-right":"top right",right:"right","bottom-right":"bottom right",bottom:"bottom","bottom-left":"bottom left",left:"left","top-left":"top left"}[e.value]||e.value}},Mp=(e)=>ul[e.base]?{"backface-visibility":ul[e.base]}:void 0,Fp=(e)=>fl[e.base]?{"transform-style":fl[e.base]}:void 0,jp=(e)=>dl[e.base]?{"transition-property":dl[e.base]}:void 0;function Wr(e,t){let r=e.value;if(t[r])return t[r];if(e.arbitrary)return r;if(/^\d+(?:\.\d+)?$/.test(r))return`${r}ms`;return}var Dp=(e)=>{if(e.utility==="duration"&&e.value){let r=Wr(e,{"0":"0s","75":"75ms","100":"100ms","150":"150ms","200":"200ms","300":"300ms","500":"500ms","700":"700ms","1000":"1000ms"});return r!==void 0?{"transition-duration":r}:void 0}},Bp=(e)=>hl[e.base]?{"transition-timing-function":hl[e.base]}:void 0,Up=(e)=>{if(e.utility==="delay"&&e.value){let r=Wr(e,{"0":"0s","75":"75ms","100":"100ms","150":"150ms","200":"200ms","300":"300ms","500":"500ms","700":"700ms","1000":"1000ms"});return r!==void 0?{"transition-delay":r}:void 0}},Vp=(e)=>gl[e.base]?{"transition-behavior":gl[e.base]}:void 0,Wp=(e)=>{if(e.utility!=="animate")return;if(e.arbitrary&&e.value)return{animation:e.value.replace(/_/g," ")};if(e.value&&ml[e.value])return{animation:ml[e.value]};return},zp=(e)=>pl[e.base]?{"animation-play-state":pl[e.base]}:void 0,Kp=(e)=>yl[e.base]?{"animation-direction":yl[e.base]}:void 0,Gp=(e)=>bl[e.base]?{"animation-fill-mode":bl[e.base]}:void 0,Hp=(e)=>{if(e.utility==="animate-iteration"&&e.value){if(e.value==="infinite"||e.arbitrary||/^\d+(?:\.\d+)?$/.test(e.value))return{"animation-iteration-count":e.value};return}},qp=(e)=>{if(e.utility==="animate-duration"&&e.value){let r=Wr(e,{"75":"75ms","100":"100ms","150":"150ms","200":"200ms","300":"300ms","500":"500ms","700":"700ms","1000":"1000ms"});return r!==void 0?{"animation-duration":r}:void 0}},Yp=(e)=>{if(e.utility==="animate-delay"&&e.value){let r=Wr(e,{"75":"75ms","100":"100ms","150":"150ms","200":"200ms","300":"300ms","500":"500ms","700":"700ms","1000":"1000ms"});return r!==void 0?{"animation-delay":r}:void 0}},Jp=(e)=>xl[e.base]?{"animation-timing-function":xl[e.base]}:void 0,wl=[Ap,Ep,Tp,Np,Op,Ip,_p,Lp,Mp,Fp,jp,Vp,Dp,Bp,Up,Wp,zp,Kp,Gp,Hp,qp,Yp,Jp];var $l={italic:"italic","not-italic":"normal"},Cl={"normal-nums":"normal",ordinal:"ordinal","slashed-zero":"slashed-zero","lining-nums":"lining-nums","oldstyle-nums":"oldstyle-nums","proportional-nums":"proportional-nums","tabular-nums":"tabular-nums","diagonal-fractions":"diagonal-fractions","stacked-fractions":"stacked-fractions"},Rl={"list-inside":"inside","list-outside":"outside"},kl={none:"none",disc:"disc",decimal:"decimal"},Sl={underline:"underline",overline:"overline","line-through":"line-through","no-underline":"none"},Al={uppercase:"uppercase",lowercase:"lowercase",capitalize:"capitalize","normal-case":"none"},El={"text-wrap":"wrap","text-nowrap":"nowrap","text-balance":"balance","text-pretty":"pretty"},Tl={"align-baseline":"baseline","align-top":"top","align-middle":"middle","align-bottom":"bottom","align-text-top":"text-top","align-text-bottom":"text-bottom","align-sub":"sub","align-super":"super"},Nl={"whitespace-normal":"normal","whitespace-nowrap":"nowrap","whitespace-pre":"pre","whitespace-pre-line":"pre-line","whitespace-pre-wrap":"pre-wrap","whitespace-break-spaces":"break-spaces"},Ol={"break-all":"break-all","break-keep":"keep-all"},Il={"hyphens-none":"none","hyphens-manual":"manual","hyphens-auto":"auto"},Pl={"writing-horizontal-tb":"horizontal-tb","writing-vertical-rl":"vertical-rl","writing-vertical-lr":"vertical-lr"},_l={"text-orientation-mixed":"mixed","text-orientation-upright":"upright","text-orientation-sideways":"sideways"},Ll={"direction-ltr":"ltr","direction-rtl":"rtl"},Ml={"small-caps":"small-caps","all-small-caps":"all-small-caps","petite-caps":"petite-caps","all-petite-caps":"all-petite-caps",unicase:"unicase","titling-caps":"titling-caps","normal-caps":"normal"},Fl={"ligatures-normal":"normal","ligatures-none":"none","common-ligatures":"common-ligatures","no-common-ligatures":"no-common-ligatures","discretionary-ligatures":"discretionary-ligatures","no-discretionary-ligatures":"no-discretionary-ligatures","historical-ligatures":"historical-ligatures","no-historical-ligatures":"no-historical-ligatures",contextual:"contextual","no-contextual":"no-contextual"},Xp=(e,t)=>{if(e.utility==="font"&&e.value){let r=t.theme.fontFamily[e.value];if(r)return{"font-family":r.join(", ")}}},Zp=(e)=>({antialiased:{"-webkit-font-smoothing":"antialiased","-moz-osx-font-smoothing":"grayscale"},"subpixel-antialiased":{"-webkit-font-smoothing":"auto","-moz-osx-font-smoothing":"auto"}})[e.base],Qp=(e)=>$l[e.base]?{"font-style":$l[e.base]}:void 0,ey=(e)=>{if(e.utility==="font-stretch"&&e.value){if(["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"].includes(e.value))return{"font-stretch":e.value};if(e.arbitrary||/^\d+(?:\.\d+)?%$/.test(e.value))return{"font-stretch":e.value};return}},ty=(e)=>Cl[e.base]?{"font-variant-numeric":Cl[e.base]}:void 0,ry=(e)=>{if(e.utility==="tracking"){let t={tighter:"-0.05em",tight:"-0.025em",normal:"0em",wide:"0.025em",wider:"0.05em",widest:"0.1em"};if(!e.value)return;if(e.arbitrary)return{"letter-spacing":e.value};if(e.value.startsWith("-")){let r=e.value.slice(1);return t[r]?{"letter-spacing":`-${t[r]}`}:void 0}return t[e.value]?{"letter-spacing":t[e.value]}:void 0}},ny=(e)=>{if(e.utility==="line-clamp"&&e.value){if(e.value==="none")return{overflow:"visible",display:"block","-webkit-box-orient":"horizontal","-webkit-line-clamp":"none"};if(!e.arbitrary&&!/^\d+$/.test(e.value))return;return{overflow:"hidden",display:"-webkit-box","-webkit-box-orient":"vertical","-webkit-line-clamp":e.value}}},iy=(e)=>{if(e.utility==="list-image"&&e.value){if(e.value==="none")return{"list-style-image":"none"};if(e.arbitrary)return{"list-style-image":e.value};return{"list-style-image":`url(${e.value})`}}},oy=(e)=>Rl[e.base]?{"list-style-position":Rl[e.base]}:void 0,sy=(e)=>{if(e.utility!=="list"||!e.value)return;return kl[e.value]?{"list-style-type":kl[e.value]}:void 0},ay=(e,t)=>{if(Sl[e.base])return{"text-decoration-line":Sl[e.base]};if(e.utility==="decoration"&&e.value){let r={solid:"solid",double:"double",dotted:"dotted",dashed:"dashed",wavy:"wavy"};if(r[e.value])return{"text-decoration-style":r[e.value]};let n={auto:"auto","from-font":"from-font","0":"0px","1":"1px","2":"2px","4":"4px","8":"8px"};if(n[e.value])return{"text-decoration-thickness":n[e.value]};if(e.arbitrary)return{"text-decoration-thickness":e.value};let i=z(e.value,t,e.modifierArbitrary);if(i)return{"text-decoration-color":i};return}return},ly=(e)=>{if(e.utility==="underline-offset"&&e.value){let t={auto:"auto",0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"};if(t[e.value])return{"text-underline-offset":t[e.value]};if(e.arbitrary)return{"text-underline-offset":e.value};if(/^\d+(?:\.\d+)?$/.test(e.value))return{"text-underline-offset":`${e.value}px`};return}},cy=(e)=>Al[e.base]?{"text-transform":Al[e.base]}:void 0,uy=(e)=>({truncate:{overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"},"text-ellipsis":{"text-overflow":"ellipsis"},"text-clip":{"text-overflow":"clip"}})[e.base],fy=(e)=>El[e.base]?{"text-wrap":El[e.base]}:void 0,dy=(e,t)=>{if(e.utility==="indent"&&e.value){if(e.arbitrary)return{"text-indent":e.value};let r=(i)=>{let o=t.theme.spacing[i];if(o!==void 0)return o;if(/^\d+(?:\.\d+)?$/.test(i))return`${Number.parseFloat(i)*0.25}rem`;return};if(e.value.startsWith("-")){let i=r(e.value.slice(1));return i!==void 0?{"text-indent":`-${i}`}:void 0}let n=r(e.value);return n!==void 0?{"text-indent":n}:void 0}},hy=(e)=>Tl[e.base]?{"vertical-align":Tl[e.base]}:void 0,gy=(e)=>Nl[e.base]?{"white-space":Nl[e.base]}:void 0,my=(e)=>{if(e.base==="break-normal")return{"overflow-wrap":"normal","word-break":"normal"};if(e.base==="break-words")return{"overflow-wrap":"break-word"};return Ol[e.base]?{"word-break":Ol[e.base]}:void 0},py=(e)=>{let t={"overflow-wrap-normal":"normal","overflow-wrap-break":"break-word","overflow-wrap-anywhere":"anywhere","wrap-normal":"normal","wrap-break-word":"break-word","wrap-anywhere":"anywhere"};return t[e.base]?{"overflow-wrap":t[e.base]}:void 0},yy=(e)=>{if(e.utility!=="tab"||!e.value)return;if(e.arbitrary||/^\d+$/.test(e.value))return{"tab-size":e.value};return},by=(e)=>Il[e.base]?{hyphens:Il[e.base]}:void 0,xy=(e)=>{if(e.utility==="content"&&e.value){let t={none:"none"};if(t[e.value]||e.value.startsWith('"')||e.value.startsWith("'"))return{content:t[e.value]||e.value};if(e.arbitrary)return{content:e.value};return}},vy=(e,t)=>{if(e.utility==="leading"){if(!e.value)return;let r={none:"1",tight:"1.25",snug:"1.375",normal:"1.5",relaxed:"1.625",loose:"2",3:".75rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem"};if(r[e.value])return{"line-height":r[e.value]};if(e.arbitrary)return{"line-height":e.value};if(/^\d+(?:\.\d+)?$/.test(e.value))return{"line-height":`${Number.parseFloat(e.value)*0.25}rem`};return}},wy=(e)=>Pl[e.base]?{"writing-mode":Pl[e.base]}:void 0,$y=(e)=>_l[e.base]?{"text-orientation":_l[e.base]}:void 0,Cy=(e)=>Ll[e.base]?{direction:Ll[e.base]}:void 0,Ry=(e)=>{if(e.utility==="text-emphasis"&&e.value){let t={none:"none",filled:"filled",open:"open",dot:"dot",circle:"circle","double-circle":"double-circle",triangle:"triangle",sesame:"sesame"};if(t[e.value])return{"text-emphasis":t[e.value]};return e.arbitrary?{"text-emphasis":e.value}:void 0}},ky=(e,t)=>{if(e.utility==="text-emphasis-color"&&e.value){let r=e.value.split("-");if(r.length===2){let[i,o]=r,s=t.theme.colors[i];if(typeof s==="object"&&s[o])return{"text-emphasis-color":W(e.value,s[o],i,t.colorVariables)}}let n=t.theme.colors[e.value];if(typeof n==="string")return{"text-emphasis-color":W(e.value,n,e.value,t.colorVariables)};if(typeof n==="object"&&n!==null&&typeof n.DEFAULT==="string")return{"text-emphasis-color":W(e.value,n.DEFAULT,e.value,t.colorVariables)}}},Sy=(e,t)=>{if(e.utility==="word-spacing"&&e.value){let r={tighter:"-0.05em",tight:"-0.025em",normal:"normal",wide:"0.025em",wider:"0.05em",widest:"0.1em"};if(r[e.value])return{"word-spacing":r[e.value]};if(t.theme.spacing[e.value])return{"word-spacing":t.theme.spacing[e.value]};if(e.arbitrary)return{"word-spacing":e.value};return}},Ay=(e)=>Ml[e.base]?{"font-variant-caps":Ml[e.base]}:void 0,Ey=(e)=>Fl[e.base]?{"font-variant-ligatures":Fl[e.base]}:void 0,jl=[Xp,Zp,Qp,ey,ty,Ay,Ey,ry,vy,ny,iy,oy,sy,ay,ly,cy,uy,fy,dy,hy,gy,my,py,yy,by,xy,wy,$y,Cy,Ry,ky,Sy];var Dl={"flex-row":"row","flex-row-reverse":"row-reverse","flex-col":"column","flex-col-reverse":"column-reverse"},Bl={"flex-wrap":"wrap","flex-wrap-reverse":"wrap-reverse","flex-nowrap":"nowrap"},ki={0:"0px",2:"2px",4:"4px",8:"8px"},Ty=(e)=>{if(["block","inline-block","inline","flex","inline-flex","grid","inline-grid","hidden","none","contents","flow-root","list-item"].includes(e.utility)&&!e.value)return{display:e.utility==="hidden"?"none":e.utility};if(e.utility==="table"){if(!e.value)return{display:"table"};if(new Set(["cell","row","row-group","column","column-group","header-group","footer-group","caption"]).has(e.value))return{display:`table-${e.value}`}}if(e.utility==="inline"&&e.value==="table")return{display:"inline-table"};if(e.utility==="flow"&&e.value==="root")return{display:"flow-root"};if(e.utility==="list"&&e.value==="item")return{display:"list-item"}},Ny=(e)=>{if(e.utility==="scrollbar"&&e.value){let r={auto:"auto",thin:"thin",none:"none"}[e.value];if(r)return{"scrollbar-width":r}}},Oy=(e)=>{if(e.utility==="content"){if(e.value==="none")return{content:"none"};if(e.value==="empty")return{content:'""'};if(e.arbitrary&&e.value)return{content:e.value}}},Iy=(e)=>{if(e.utility==="@container")return{"container-type":"inline-size"};if(e.utility==="@container-normal")return{"container-type":"normal"};if(e.utility.startsWith("@container/"))return{"container-type":"inline-size","container-name":e.utility.slice(11)}},Py=(e)=>Dl[e.utility]?{"flex-direction":Dl[e.utility]}:void 0,_y=(e)=>Bl[e.utility]?{"flex-wrap":Bl[e.utility]}:void 0,Ly=(e)=>{if(e.utility==="flex"||e.utility.startsWith("flex-")){let t={"flex-1":"1 1 0%","flex-auto":"1 1 auto","flex-initial":"0 1 auto","flex-none":"none"};if(t[e.utility])return{flex:t[e.utility]};if(e.utility==="flex"&&e.arbitrary&&e.value)return{flex:e.value.replace(/_/g," ")}}return},My=(e)=>{if(e.utility==="flex-grow"&&!e.value)return{"flex-grow":"1"};if(e.utility==="flex-grow"&&e.value)return{"flex-grow":e.value}},Fy=(e)=>{if(e.utility==="flex-shrink"&&!e.value)return{"flex-shrink":"1"};if(e.utility==="flex-shrink"&&e.value)return{"flex-shrink":e.value}},jy=(e)=>{if(e.utility==="justify"&&e.value){let t={start:"flex-start",end:"flex-end",center:"center",between:"space-between",around:"space-around",evenly:"space-evenly"};if(t[e.value])return{"justify-content":t[e.value]};if(e.arbitrary)return{"justify-content":e.value}}return},Dy=(e)=>{if(e.utility==="items"&&e.value){let t={start:"flex-start",end:"flex-end",center:"center",baseline:"baseline",stretch:"stretch"};if(t[e.value])return{"align-items":t[e.value]};if(e.arbitrary)return{"align-items":e.value}}return},By=(e)=>{if(e.utility==="justify"&&e.value&&e.value.startsWith("items-")){let t={"items-start":"start","items-end":"end","items-center":"center","items-stretch":"stretch","items-center-safe":"safe center","items-end-safe":"safe end"};return t[e.value]?{"justify-items":t[e.value]}:void 0}return},Uy=(e)=>{if(e.utility==="content"&&e.value){let t={normal:"normal",center:"center",start:"flex-start",end:"flex-end",between:"space-between",around:"space-around",evenly:"space-evenly",baseline:"baseline",stretch:"stretch"};return t[e.value]?{"align-content":t[e.value]}:void 0}return},Vy=(e,t)=>{let n={p:["padding"],px:["padding-left","padding-right"],py:["padding-top","padding-bottom"],pt:["padding-top"],pr:["padding-right"],pb:["padding-bottom"],pl:["padding-left"],ps:["padding-inline-start"],pe:["padding-inline-end"],m:["margin"],mx:["margin-left","margin-right"],my:["margin-top","margin-bottom"],mt:["margin-top"],mr:["margin-right"],mb:["margin-bottom"],ml:["margin-left"],ms:["margin-inline-start"],me:["margin-inline-end"]}[e.utility];if(!n||!e.value)return;let i=(l)=>{if(l==="auto")return e.utility.charCodeAt(0)===109?"auto":void 0;let a=t.theme.spacing[l];if(a!==void 0)return a;if(e.arbitrary)return l;if(/^\d+(?:\.\d+)?$/.test(l)){let c=Number.parseFloat(l);if(Number.isFinite(c))return`${c*0.25}rem`}return},o;if(e.value.startsWith("-")){if(e.utility.charCodeAt(0)===112)return;let l=e.value.slice(1);if(l==="0")o=t.theme.spacing[l]||"0";else{let a=i(l);o=a===void 0?void 0:`-${a}`}}else o=i(e.value);if(o===void 0)return;let s={};for(let l of n)s[l]=o;return s};function pe(e,t,r){let n=e.value;if(n.includes("/")&&!e.arbitrary){let[o,s]=n.split("/").map(Number);if(Number.isNaN(o)||Number.isNaN(s)||s===0)return;return $e(o,s)}let i=t.theme.spacing[n];if(i!==void 0)return i;if(r[n])return r[n];if(e.arbitrary)return n;if(/^\d+(?:\.\d+)?$/.test(n))return`${Number.parseFloat(n)*0.25}rem`;return}var Wy=(e,t)=>{if(e.utility==="w"&&e.value){let n=pe(e,t,{full:"100%",screen:"100vw",svw:"100svw",lvw:"100lvw",dvw:"100dvw",auto:"auto",min:"min-content",max:"max-content",fit:"fit-content"});return n!==void 0?{width:n}:void 0}if(e.utility==="h"&&e.value){let n=pe(e,t,{full:"100%",screen:"100vh",svh:"100svh",lvh:"100lvh",dvh:"100dvh",auto:"auto",min:"min-content",max:"max-content",fit:"fit-content"});return n!==void 0?{height:n}:void 0}if(e.utility==="size"&&e.value){let n=pe(e,t,{full:"100%",auto:"auto",min:"min-content",max:"max-content",fit:"fit-content"});return n!==void 0?{width:n,height:n}:void 0}return},je=null,zr=null,Kr,zy={bg:"background-color",text:"color",border:"border-color"},Ky={bg:{color:"background-color",image:"background-image",url:"background-image",position:"background-position",length:"background-size"},text:{color:"color",length:"font-size","absolute-size":"font-size","relative-size":"font-size","family-name":"font-family"},border:{color:"border-color",length:"border-width","line-width":"border-width"}},Gy=new Set(["length","absolute-size","relative-size","percentage","number"]),Hy=/^(?:url|(?:repeating-)?(?:linear|radial|conic)-gradient|image-set|-webkit-image-set|cross-fade|element|paint)\(/i,Vl={current:"currentColor",transparent:"transparent",inherit:"inherit"};function W(e,t,r,n){return n?.includes(r)?`var(--color-${e}, ${t})`:t}function Wl(e,t){let r=new Map;for(let[n,i]of Object.entries(e))if(typeof i==="string")r.set(n,W(n,i,n,t));else if(typeof i==="object"&&i!==null){for(let[o,s]of Object.entries(i))if(typeof s==="string"){let l=o==="DEFAULT"?n:`${n}-${o}`;r.set(l,W(l,s,n,t))}}return r}var qy=(e,t)=>{let r=zy[e.utility];if(!r||!e.value)return;let n=e.value;if(e.arbitrary&&e.typeHint){let c=Ky[e.utility]?.[e.typeHint];return c?{[c]:n}:void 0}if(e.arbitrary&&e.utility==="bg"&&Hy.test(n))return{"background-image":n};if(je===null||zr!==t.theme.colors||Kr!==t.colorVariables)je=Wl(t.theme.colors,t.colorVariables),zr=t.theme.colors,Kr=t.colorVariables;let i=Oe(n);if(i===-1){let c=je.get(n);if(c)return{[r]:c}}let o,s=n;if(i!==-1){s=n.slice(0,i);let c=n.slice(i+1);if(c.charCodeAt(0)===91&&c.charCodeAt(c.length-1)===93){let f=Number.parseFloat(c.slice(1,-1));if(Number.isNaN(f)||f<0||f>1)return;o=f}else if(e.modifierArbitrary){let f=Number.parseFloat(c);if(Number.isNaN(f)||f<0||f>1)return;o=f}else{let f=Number.parseInt(c,10);if(Number.isNaN(f)||f<0||f>100)return;o=f/100}let u=je.get(s);if(u)return{[r]:we(u,o)}}let l=Vl[s];if(l)return{[r]:l};if((e.arbitrary||s&&s.charCodeAt(0)===91)&&s){let c=o!==void 0?we(s,o):s;return{[r]:c}}return};function we(e,t){let r=e;if(e.charCodeAt(0)===91&&e.charCodeAt(e.length-1)===93)r=e.slice(1,-1);if(r.charCodeAt(0)===35){let n=r.slice(1);if(n.length===3||n.length===4)n=n.split("").map((l)=>l+l).join("");let i=Number.parseInt(n.slice(0,2),16),o=Number.parseInt(n.slice(2,4),16),s=Number.parseInt(n.slice(4,6),16);return`rgb(${i} ${o} ${s} / ${t})`}if(r.charCodeAt(0)===114){let n=r.match(/rgb\((\d+)\s+(\d+)\s+(\d+)/);if(n)return`rgb(${n[1]} ${n[2]} ${n[3]} / ${t})`}if(r.charCodeAt(0)===111){let n=r.match(/oklch\(([^)]+)\)/);if(n)return`oklch(${n[1]} / ${t})`}if(r.charCodeAt(0)===104){let n=r.match(/hsl\(([^)]+)\)/);if(n)return`hsl(${n[1]} / ${t})`}if(r!=="inherit"&&r!=="transparent"){let n=Number((t*100).toFixed(2));return`color-mix(in srgb, ${r} ${n}%, transparent)`}return r}function z(e,t,r=!1){let n=Oe(e),i=e,o;if(n!==-1){i=e.slice(0,n);let f=e.slice(n+1);if(f.charCodeAt(0)===91&&f.charCodeAt(f.length-1)===93){if(o=Number.parseFloat(f.slice(1,-1)),Number.isNaN(o)||o<0||o>1)return}else if(r){if(o=Number.parseFloat(f),Number.isNaN(o)||o<0||o>1)return}else{let d=Number.parseInt(f,10);if(Number.isNaN(d)||d<0||d>100)return;o=d/100}}let s={current:"currentColor",transparent:"transparent",inherit:"inherit",auto:"auto"};if(s[i])return o!==void 0?we(s[i],o):s[i];let l=t.colorVariables,a=t.theme.colors[i],c=typeof a==="string"?W(i,a,i,l):a;if(typeof c==="string")return o!==void 0?we(c,o):c;if(typeof c==="object"&&c!==null&&typeof c.DEFAULT==="string"){let f=W(i,c.DEFAULT,i,l);return o!==void 0?we(f,o):f}let u=i.split("-");for(let f=u.length-1;f>=1;f--){let d=u.slice(f).join("-"),h=u.slice(0,f).join("-"),g=t.theme.colors[h];if(typeof g==="object"&&g!==null&&typeof g[d]==="string"){let m=W(i,g[d],h,l);return o!==void 0?we(m,o):m}}if(i.startsWith("var(")||i.startsWith("#")||i.startsWith("rgb(")||i.startsWith("rgba(")||i.startsWith("hsl(")||i.startsWith("hsla(")||i.startsWith("oklch(")||i.startsWith("oklab(")||i.startsWith("lab(")||i.startsWith("lch(")||i.startsWith("color(")||i.startsWith("color-mix(")||i.startsWith("hwb("))return o!==void 0?we(i,o):i;return}var Yy=(e,t)=>{if(e.utility!=="placeholder"||!e.value)return;if(je===null||zr!==t.theme.colors||Kr!==t.colorVariables)je=Wl(t.theme.colors,t.colorVariables),zr=t.theme.colors,Kr=t.colorVariables;let r=e.value,n=Oe(r);if(n===-1){let o=je.get(r);if(o)return{properties:{color:o},pseudoElement:"::placeholder"}}else{let o=r.slice(0,n),s=r.slice(n+1),l;if(s.charCodeAt(0)===91&&s.charCodeAt(s.length-1)===93){let c=Number.parseFloat(s.slice(1,-1));if(Number.isNaN(c)||c<0||c>1)return;l=c}else if(e.modifierArbitrary){let c=Number.parseFloat(s);if(Number.isNaN(c)||c<0||c>1)return;l=c}else{let c=Number.parseInt(s,10);if(Number.isNaN(c)||c<0||c>100)return;l=c/100}let a=je.get(o);if(a)return{properties:{color:we(a,l)},pseudoElement:"::placeholder"}}let i=Vl[e.value];if(i)return{properties:{color:i},pseudoElement:"::placeholder"};return},Jy=(e,t)=>{if(e.utility==="text"&&e.value){let r=e.value,n,i=r.lastIndexOf("/");if(i!==-1&&!e.value.startsWith("[")&&!r.slice(i+1).includes("]"));if(i!==-1){let s=r.slice(0,i),l=r.slice(i+1);if(l&&(t.theme.fontSize[s]||e.arbitrary)){r=s;let a={none:"1",tight:"1.25",snug:"1.375",normal:"1.5",relaxed:"1.625",loose:"2",3:"0.75rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem"};n=t.theme.lineHeight?.[l]??a[l]??l}}if(e.arbitrary){if(e.typeHint){if(!Gy.has(e.typeHint))return;let l={"font-size":r};if(n)l["line-height"]=n;return l}if(/^#|^rgb|^hsl|^hwb|^lab|^lch|^oklch|^oklab|^color\(|^var\(--/.test(r))return;let s={"font-size":r};if(n)s["line-height"]=n;return s}let o=t.theme.fontSize[r];if(o)return{"font-size":o[0],"line-height":n??o[1].lineHeight}}},Xy=(e)=>{if(e.utility==="font"&&e.value){if(e.arbitrary){let r=e.typeHint;return r==="family-name"||r==="string"?{"font-family":e.value}:{"font-weight":e.value}}let t={thin:"100",extralight:"200",light:"300",normal:"400",medium:"500",semibold:"600",bold:"700",extrabold:"800",black:"900"};return t[e.value]?{"font-weight":t[e.value]}:void 0}return},Zy=(e)=>{if(e.utility==="leading"&&e.value){if(e.arbitrary)return{"line-height":e.value};let t={none:"1",tight:"1.25",snug:"1.375",normal:"1.5",relaxed:"1.625",loose:"2","3":"0.75rem","4":"1rem","5":"1.25rem","6":"1.5rem","7":"1.75rem","8":"2rem","9":"2.25rem","10":"2.5rem"};return t[e.value]?{"line-height":t[e.value]}:void 0}return},Qy=(e)=>{if(e.utility==="text"&&e.value){let t={left:"left",center:"center",right:"right",justify:"justify"};return t[e.value]?{"text-align":t[e.value]}:void 0}},eb=(e)=>{if(e.utility==="border"){if(!e.value)return{"border-width":"1px"};let t={0:"0px",2:"2px",4:"4px",8:"8px"};if(t[e.value])return{"border-width":t[e.value]};let r={t:"border-top-width",r:"border-right-width",b:"border-bottom-width",l:"border-left-width",s:"border-inline-start-width",e:"border-inline-end-width"};if(e.value==="x")return{"border-left-width":"1px","border-right-width":"1px"};if(e.value==="y")return{"border-top-width":"1px","border-bottom-width":"1px"};let n=r[e.value];if(typeof n==="string")return{[n]:"1px"};return}},tb=(e,t)=>{let r={"border-t":"border-top-width","border-r":"border-right-width","border-b":"border-bottom-width","border-l":"border-left-width","border-x":["border-left-width","border-right-width"],"border-y":["border-top-width","border-bottom-width"],"border-s":"border-inline-start-width","border-e":"border-inline-end-width"},n={"border-t":"border-top-color","border-r":"border-right-color","border-b":"border-bottom-color","border-l":"border-left-color","border-x":["border-left-color","border-right-color"],"border-y":["border-top-color","border-bottom-color"],"border-s":"border-inline-start-color","border-e":"border-inline-end-color"},i=r[e.utility];if(!i)return;if(!e.value){let s=i;if(Array.isArray(s))return s.reduce((l,a)=>({...l,[a]:"1px"}),{});return{[s]:"1px"}}if(e.arbitrary){let s=e.value,c=(/^#|^(?:rgb|rgba|hsl|hsla|oklch|oklab|lab|lch)\(|^(?:currentColor|transparent|inherit)$/i.test(s)?n[e.utility]:i)??i;if(Array.isArray(c))return c.reduce((u,f)=>({...u,[f]:s}),{});return{[c]:s}}if(ki[e.value]){let s=i;if(Array.isArray(s))return s.reduce((l,a)=>({...l,[a]:ki[e.value]}),{});return{[s]:ki[e.value]}}let o=n[e.utility];if(o&&t){let s=e.value.split("-");if(s.length>=2){let a=s[s.length-1],c=s.slice(0,-1).join("-"),u=t.theme.colors[c];if(u&&typeof u==="object"&&u[a]){let f=o,d=W(e.value,u[a],c,t.colorVariables);if(Array.isArray(f))return f.reduce((h,g)=>({...h,[g]:d}),{});return{[f]:d}}}let l=t.theme.colors[e.value];if(typeof l==="string"){let a=o;if(Array.isArray(a))return a.reduce((c,u)=>({...c,[u]:l}),{});return{[a]:l}}if(l&&typeof l==="object"&&typeof l.DEFAULT==="string"){let a=o;if(Array.isArray(a))return a.reduce((c,u)=>({...c,[u]:l.DEFAULT}),{});return{[a]:l.DEFAULT}}if(e.value==="transparent"||e.value==="current"||e.value==="inherit"){let a=e.value==="current"?"currentColor":e.value,c=o;if(Array.isArray(c))return c.reduce((u,f)=>({...u,[f]:a}),{});return{[c]:a}}}return};function Xe(e,t){if(!e.value)return t.theme.borderRadius.DEFAULT;if(t.theme.borderRadius[e.value]!==void 0)return t.theme.borderRadius[e.value];if(e.arbitrary)return e.value;return}var Ul={t:["border-top-left-radius","border-top-right-radius"],r:["border-top-right-radius","border-bottom-right-radius"],b:["border-bottom-left-radius","border-bottom-right-radius"],l:["border-top-left-radius","border-bottom-left-radius"],tl:["border-top-left-radius"],tr:["border-top-right-radius"],bl:["border-bottom-left-radius"],br:["border-bottom-right-radius"],s:["border-start-start-radius","border-end-start-radius"],e:["border-start-end-radius","border-end-end-radius"],ss:["border-start-start-radius"],se:["border-start-end-radius"],es:["border-end-start-radius"],ee:["border-end-end-radius"]},rb=(e,t)=>{if(e.utility==="rounded"){if(e.arbitrary&&e.value)return{"border-radius":e.value};if(e.value&&Ul[e.value]){let o=t.theme.borderRadius.DEFAULT,s={};for(let l of Ul[e.value])s[l]=o;return s}let i=e.value?t.theme.borderRadius[e.value]:t.theme.borderRadius.DEFAULT;return i?{"border-radius":i}:void 0}if(e.utility==="rounded-s"){let i=Xe(e,t);if(i===void 0)return;return{"border-start-start-radius":i,"border-end-start-radius":i}}if(e.utility==="rounded-e"){let i=Xe(e,t);if(i===void 0)return;return{"border-start-end-radius":i,"border-end-end-radius":i}}if(e.utility==="rounded-ss"){let i=Xe(e,t);if(i===void 0)return;return{"border-start-start-radius":i}}if(e.utility==="rounded-se"){let i=Xe(e,t);if(i===void 0)return;return{"border-start-end-radius":i}}if(e.utility==="rounded-es"){let i=Xe(e,t);if(i===void 0)return;return{"border-end-start-radius":i}}if(e.utility==="rounded-ee"){let i=Xe(e,t);if(i===void 0)return;return{"border-end-end-radius":i}}let n={"rounded-t":["border-top-left-radius","border-top-right-radius"],"rounded-r":["border-top-right-radius","border-bottom-right-radius"],"rounded-b":["border-bottom-left-radius","border-bottom-right-radius"],"rounded-l":["border-top-left-radius","border-bottom-left-radius"],"rounded-tl":["border-top-left-radius"],"rounded-tr":["border-top-right-radius"],"rounded-bl":["border-bottom-left-radius"],"rounded-br":["border-bottom-right-radius"]}[e.utility];if(n){let i=Xe(e,t);if(i===void 0)return;let o={};for(let s of n)o[s]=i;return o}},Si=[pi,Aa,Vy,Wy,Uy,Jy,Qy,...jl,Xy,Zy,...wa,...va,...bi,Yy,qy,...la,...cl,Py,_y,Ly,My,Fy,jy,Dy,By,...ka,...wl,...bi,...Ja,...Ca,tb,eb,rb,Iy,Ny,Oy,Ty];function Ni(e,t){let r={...e};for(let n in t){let i=t[n],o=r[n];if(i&&typeof i==="object"&&!Array.isArray(i)&&o&&typeof o==="object"&&!Array.isArray(o))r[n]=Ni(o,i);else if(i!==void 0)r[n]=i}return r}var nb={block:{display:"block"},"inline-block":{display:"inline-block"},inline:{display:"inline"},flex:{display:"flex"},"inline-flex":{display:"inline-flex"},grid:{display:"grid"},"inline-grid":{display:"inline-grid"},hidden:{display:"none"},none:{display:"none"}},ib={"flex-row":{"flex-direction":"row"},"flex-row-reverse":{"flex-direction":"row-reverse"},"flex-col":{"flex-direction":"column"},"flex-col-reverse":{"flex-direction":"column-reverse"}},ob={"flex-wrap":{"flex-wrap":"wrap"},"flex-wrap-reverse":{"flex-wrap":"wrap-reverse"},"flex-nowrap":{"flex-wrap":"nowrap"}},sb={"flex-1":{flex:"1 1 0%"},"flex-auto":{flex:"1 1 auto"},"flex-initial":{flex:"0 1 auto"},"flex-none":{flex:"none"}},ab={grow:{"flex-grow":"1"},"grow-0":{"flex-grow":"0"},shrink:{"flex-shrink":"1"},"shrink-0":{"flex-shrink":"0"}},lb={start:"flex-start",end:"flex-end",center:"center",between:"space-between",around:"space-around",evenly:"space-evenly","center-safe":"safe center","end-safe":"safe flex-end"},cb={start:"flex-start",end:"flex-end",center:"center",baseline:"baseline",stretch:"stretch","center-safe":"safe center","end-safe":"safe flex-end"},ub={normal:"normal",center:"center",start:"flex-start",end:"flex-end",between:"space-between",around:"space-around",evenly:"space-evenly",baseline:"baseline",stretch:"stretch","center-safe":"safe center","end-safe":"safe flex-end"},fb={auto:"auto",start:"flex-start",end:"flex-end",center:"center",stretch:"stretch",baseline:"baseline","center-safe":"safe center","end-safe":"safe flex-end"},db={"border-solid":{"border-style":"solid"},"border-dashed":{"border-style":"dashed"},"border-dotted":{"border-style":"dotted"},"border-double":{"border-style":"double"},"border-none":{"border-style":"none"}},hb={transform:{transform:Lt},"transform-cpu":{transform:Lt},"transform-gpu":{transform:Ri},"transform-none":{transform:"none"}},pt={"transition-timing-function":"cubic-bezier(0.4, 0, 0.2, 1)","transition-duration":"150ms"},gb={"transition-none":{"transition-property":"none"},"transition-all":{"transition-property":"all",...pt},transition:{"transition-property":"color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter",...pt},"transition-colors":{"transition-property":"color, background-color, border-color, text-decoration-color, fill, stroke",...pt},"transition-opacity":{"transition-property":"opacity",...pt},"transition-shadow":{"transition-property":"box-shadow",...pt},"transition-transform":{"transition-property":"transform",...pt}},mb={"ease-linear":{"transition-timing-function":"linear"},"ease-in":{"transition-timing-function":"cubic-bezier(0.4, 0, 1, 1)"},"ease-out":{"transition-timing-function":"cubic-bezier(0, 0, 0.2, 1)"},"ease-in-out":{"transition-timing-function":"cubic-bezier(0.4, 0, 0.2, 1)"}},pb={"animate-none":{animation:"none"},"animate-spin":{animation:"spin 1s linear infinite"},"animate-ping":{animation:"ping 1s cubic-bezier(0, 0, 0.2, 1) infinite"},"animate-pulse":{animation:"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite"},"animate-bounce":{animation:"bounce 1s infinite"}};function yb(e,t){let r=Object.keys(t);if(r.length===0)return{tokens:[],colors:e};let n=[];for(let[o,s]of Object.entries(e)){if(typeof s!=="object"||s===null)continue;let l=Object.keys(s);if(l.length===0)continue;if(!l.every((u)=>u==="light"||r.includes(u)))continue;if(!l.some((u)=>r.includes(u)))continue;let a=typeof s.light==="string"?s.light:s[l[0]];if(typeof a!=="string")continue;let c={};for(let u of r){let f=s[u];if(typeof f==="string")c[u]=f}n.push({name:o,base:a,byMode:c})}if(n.length===0)return{tokens:n,colors:e};let i={...e};for(let o of n)i[o.name]=o.base;return{tokens:n,colors:i}}var bb="tc-base",zl="tc-utilities";function xb(e,t){let r=Object.entries(t).map(([n,i])=>{let o=Object.entries(i).map(([s,l])=>`${s}: ${l};`).join(" ");return` ${n} { ${o} }`}).join(`
358
358
  `);return`@keyframes ${e} {
359
359
  ${r}
360
- }`}var xb={spin:`@keyframes spin {
360
+ }`}var vb={spin:`@keyframes spin {
361
361
  from { transform: rotate(0deg); }
362
362
  to { transform: rotate(360deg); }
363
363
  }`,ping:`@keyframes ping {
@@ -368,8 +368,8 @@ ${r}
368
368
  }`,bounce:`@keyframes bounce {
369
369
  0%, 100% { transform: translateY(-25%); animation-timing-function: cubic-bezier(0.8, 0, 1, 1); }
370
370
  50% { transform: translateY(0); animation-timing-function: cubic-bezier(0, 0, 0.2, 1); }
371
- }`},vb={center:"center",top:"top","top-right":"top right",right:"right","bottom-right":"bottom right",bottom:"bottom","bottom-left":"bottom left",left:"left","top-left":"top left"},wb={"1":"repeat(1, minmax(0, 1fr))","2":"repeat(2, minmax(0, 1fr))","3":"repeat(3, minmax(0, 1fr))","4":"repeat(4, minmax(0, 1fr))","5":"repeat(5, minmax(0, 1fr))","6":"repeat(6, minmax(0, 1fr))","7":"repeat(7, minmax(0, 1fr))","8":"repeat(8, minmax(0, 1fr))","9":"repeat(9, minmax(0, 1fr))","10":"repeat(10, minmax(0, 1fr))","11":"repeat(11, minmax(0, 1fr))","12":"repeat(12, minmax(0, 1fr))",none:"none",subgrid:"subgrid"},$b={"1":"repeat(1, minmax(0, 1fr))","2":"repeat(2, minmax(0, 1fr))","3":"repeat(3, minmax(0, 1fr))","4":"repeat(4, minmax(0, 1fr))","5":"repeat(5, minmax(0, 1fr))","6":"repeat(6, minmax(0, 1fr))",none:"none",subgrid:"subgrid"},Cb={auto:"auto","span-1":"span 1 / span 1","span-2":"span 2 / span 2","span-3":"span 3 / span 3","span-4":"span 4 / span 4","span-5":"span 5 / span 5","span-6":"span 6 / span 6","span-7":"span 7 / span 7","span-8":"span 8 / span 8","span-9":"span 9 / span 9","span-10":"span 10 / span 10","span-11":"span 11 / span 11","span-12":"span 12 / span 12","span-full":"1 / -1"},Rb={auto:"auto","span-1":"span 1 / span 1","span-2":"span 2 / span 2","span-3":"span 3 / span 3","span-4":"span 4 / span 4","span-5":"span 5 / span 5","span-6":"span 6 / span 6","span-full":"1 / -1"},kb={row:"row",col:"column",dense:"dense","row-dense":"row dense","col-dense":"column dense"},Kl={auto:"auto",min:"min-content",max:"max-content",fr:"minmax(0, 1fr)"},Ai={center:"center",start:"start",end:"end",between:"space-between",around:"space-around",evenly:"space-evenly",stretch:"stretch","center-safe":"safe center","end-safe":"safe end"};function yt(e){return{"--tc-ring-offset-shadow":"var(--tc-ring-inset,) 0 0 0 var(--tc-ring-offset-width, 0px) var(--tc-ring-offset-color, #fff)","--tc-ring-shadow":`var(--tc-ring-inset,) 0 0 0 calc(${e} + var(--tc-ring-offset-width, 0px)) var(--tc-ring-color, currentcolor)`,"box-shadow":V}}var Sb={ring:yt("1px"),"ring-0":yt("0px"),"ring-1":yt("1px"),"ring-2":yt("2px"),"ring-4":yt("4px"),"ring-8":yt("8px"),"ring-inset":{"--tc-ring-inset":"inset"}},lc={"shadow-2xs":{"--tc-shadow":"0 1px rgb(0 0 0 / 0.05)","--tc-shadow-colored":"0 1px var(--tc-shadow-color)","box-shadow":V},"shadow-xs":{"--tc-shadow":"0 1px 2px 0 rgb(0 0 0 / 0.05)","--tc-shadow-colored":"0 1px 2px 0 var(--tc-shadow-color)","box-shadow":V},"shadow-sm":{"--tc-shadow":"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)","--tc-shadow-colored":"0 1px 3px 0 var(--tc-shadow-color), 0 1px 2px -1px var(--tc-shadow-color)","box-shadow":V},shadow:{"--tc-shadow":"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)","--tc-shadow-colored":"0 1px 3px 0 var(--tc-shadow-color), 0 1px 2px -1px var(--tc-shadow-color)","box-shadow":V},"shadow-md":{"--tc-shadow":"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)","--tc-shadow-colored":"0 4px 6px -1px var(--tc-shadow-color), 0 2px 4px -2px var(--tc-shadow-color)","box-shadow":V},"shadow-lg":{"--tc-shadow":"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)","--tc-shadow-colored":"0 10px 15px -3px var(--tc-shadow-color), 0 4px 6px -4px var(--tc-shadow-color)","box-shadow":V},"shadow-xl":{"--tc-shadow":"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)","--tc-shadow-colored":"0 20px 25px -5px var(--tc-shadow-color), 0 8px 10px -6px var(--tc-shadow-color)","box-shadow":V},"shadow-2xl":{"--tc-shadow":"0 25px 50px -12px rgb(0 0 0 / 0.25)","--tc-shadow-colored":"0 25px 50px -12px var(--tc-shadow-color)","box-shadow":V},"shadow-inner":{"--tc-shadow":"inset 0 2px 4px 0 rgb(0 0 0 / 0.05)","--tc-shadow-colored":"inset 0 2px 4px 0 var(--tc-shadow-color)","box-shadow":V},"shadow-none":{"--tc-shadow":"0 0 #0000","box-shadow":V}},cc={"rounded-none":{"border-radius":"0px"},"rounded-xs":{"border-radius":"0.125rem"},"rounded-sm":{"border-radius":"0.25rem"},rounded:{"border-radius":"0.25rem"},"rounded-md":{"border-radius":"0.375rem"},"rounded-lg":{"border-radius":"0.5rem"},"rounded-xl":{"border-radius":"0.75rem"},"rounded-2xl":{"border-radius":"1rem"},"rounded-3xl":{"border-radius":"1.5rem"},"rounded-4xl":{"border-radius":"2rem"},"rounded-full":{"border-radius":"9999px"},"rounded-t-none":{"border-top-left-radius":"0px","border-top-right-radius":"0px"},"rounded-t-sm":{"border-top-left-radius":"0.25rem","border-top-right-radius":"0.25rem"},"rounded-t-lg":{"border-top-left-radius":"0.5rem","border-top-right-radius":"0.5rem"},"rounded-r-lg":{"border-top-right-radius":"0.5rem","border-bottom-right-radius":"0.5rem"},"rounded-b-lg":{"border-bottom-left-radius":"0.5rem","border-bottom-right-radius":"0.5rem"},"rounded-l-lg":{"border-top-left-radius":"0.5rem","border-bottom-left-radius":"0.5rem"},"rounded-tl-lg":{"border-top-left-radius":"0.5rem"},"rounded-tr-lg":{"border-top-right-radius":"0.5rem"},"rounded-br-lg":{"border-bottom-right-radius":"0.5rem"},"rounded-bl-lg":{"border-bottom-left-radius":"0.5rem"}},Ab={border:{"border-width":"1px"},"border-0":{"border-width":"0px"},"border-2":{"border-width":"2px"},"border-4":{"border-width":"4px"},"border-8":{"border-width":"8px"},"border-t":{"border-top-width":"1px"},"border-r":{"border-right-width":"1px"},"border-b":{"border-bottom-width":"1px"},"border-l":{"border-left-width":"1px"},"border-t-0":{"border-top-width":"0px"},"border-r-0":{"border-right-width":"0px"},"border-b-0":{"border-bottom-width":"0px"},"border-l-0":{"border-left-width":"0px"},"border-t-2":{"border-top-width":"2px"},"border-r-2":{"border-right-width":"2px"},"border-b-2":{"border-bottom-width":"2px"},"border-l-2":{"border-left-width":"2px"},"border-t-4":{"border-top-width":"4px"},"border-r-4":{"border-right-width":"4px"},"border-b-4":{"border-bottom-width":"4px"},"border-l-4":{"border-left-width":"4px"},"border-x":{"border-left-width":"1px","border-right-width":"1px"},"border-y":{"border-top-width":"1px","border-bottom-width":"1px"},"border-x-0":{"border-left-width":"0px","border-right-width":"0px"},"border-y-0":{"border-top-width":"0px","border-bottom-width":"0px"},"border-x-2":{"border-left-width":"2px","border-right-width":"2px"},"border-y-2":{"border-top-width":"2px","border-bottom-width":"2px"}},Eb={"ring-offset-0":{"--tc-ring-offset-width":"0px"},"ring-offset-1":{"--tc-ring-offset-width":"1px"},"ring-offset-2":{"--tc-ring-offset-width":"2px"},"ring-offset-4":{"--tc-ring-offset-width":"4px"},"ring-offset-8":{"--tc-ring-offset-width":"8px"}},Tb={"opacity-0":{opacity:"0"},"opacity-5":{opacity:"0.05"},"opacity-10":{opacity:"0.1"},"opacity-20":{opacity:"0.2"},"opacity-25":{opacity:"0.25"},"opacity-30":{opacity:"0.3"},"opacity-40":{opacity:"0.4"},"opacity-50":{opacity:"0.5"},"opacity-60":{opacity:"0.6"},"opacity-70":{opacity:"0.7"},"opacity-75":{opacity:"0.75"},"opacity-80":{opacity:"0.8"},"opacity-90":{opacity:"0.9"},"opacity-95":{opacity:"0.95"},"opacity-100":{opacity:"1"}},Yr={"0":"0",px:"1px","0.5":"0.125rem","1":"0.25rem","1.5":"0.375rem","2":"0.5rem","2.5":"0.625rem","3":"0.75rem","3.5":"0.875rem","4":"1rem","5":"1.25rem","6":"1.5rem","7":"1.75rem","8":"2rem","9":"2.25rem","10":"2.5rem","11":"2.75rem","12":"3rem","14":"3.5rem","16":"4rem","20":"5rem","24":"6rem","28":"7rem","32":"8rem","36":"9rem","40":"10rem","44":"11rem","48":"12rem","52":"13rem","56":"14rem","60":"15rem","64":"16rem","72":"18rem","80":"20rem","96":"24rem"},Gl={...Yr,auto:"auto",full:"100%",screen:"100vw",min:"min-content",max:"max-content",fit:"fit-content",...Nb(6)};function Nb(e){let t={};for(let r=2;r<=e;r++)for(let n=1;n<r;n++)t[`${n}/${r}`]=$e(n,r);return t}var bt={"gray-50":"oklch(98.5% 0.002 247.839)","gray-100":"oklch(96.7% 0.003 264.542)","gray-200":"oklch(92.8% 0.006 264.531)","gray-300":"oklch(87.2% 0.01 258.338)","gray-400":"oklch(70.7% 0.022 261.325)","gray-500":"oklch(55.1% 0.027 264.364)","gray-600":"oklch(44.6% 0.03 256.802)","gray-700":"oklch(37.3% 0.034 259.733)","gray-800":"oklch(27.8% 0.033 256.848)","gray-900":"oklch(21% 0.034 264.665)","gray-950":"oklch(13% 0.028 261.692)","red-50":"oklch(97.1% 0.013 17.38)","red-100":"oklch(93.6% 0.032 17.717)","red-200":"oklch(88.5% 0.062 18.334)","red-300":"oklch(80.8% 0.114 19.571)","red-400":"oklch(70.4% 0.191 22.216)","red-500":"oklch(63.7% 0.237 25.331)","red-600":"oklch(57.7% 0.245 27.325)","red-700":"oklch(50.5% 0.213 27.518)","red-800":"oklch(44.4% 0.177 26.899)","red-900":"oklch(39.6% 0.141 25.723)","red-950":"oklch(25.8% 0.092 26.042)","blue-50":"oklch(97% 0.014 254.604)","blue-100":"oklch(93.2% 0.032 255.585)","blue-200":"oklch(88.2% 0.059 254.128)","blue-300":"oklch(80.9% 0.105 251.813)","blue-400":"oklch(70.7% 0.165 254.624)","blue-500":"oklch(62.3% 0.214 259.815)","blue-600":"oklch(54.6% 0.245 262.881)","blue-700":"oklch(48.8% 0.243 264.376)","blue-800":"oklch(42.4% 0.199 265.638)","blue-900":"oklch(37.9% 0.146 265.522)","blue-950":"oklch(28.2% 0.091 267.935)","green-50":"oklch(98.2% 0.018 155.826)","green-100":"oklch(96.2% 0.044 156.743)","green-200":"oklch(92.5% 0.084 155.995)","green-300":"oklch(87.1% 0.15 154.449)","green-400":"oklch(79.2% 0.209 151.711)","green-500":"oklch(72.3% 0.219 149.579)","green-600":"oklch(62.7% 0.194 149.214)","green-700":"oklch(52.7% 0.154 150.069)","green-800":"oklch(44.8% 0.119 151.328)","green-900":"oklch(39.3% 0.095 152.535)","green-950":"oklch(26.6% 0.065 152.934)","yellow-50":"oklch(98.7% 0.026 102.212)","yellow-100":"oklch(97.3% 0.071 103.193)","yellow-200":"oklch(94.5% 0.129 101.54)","yellow-300":"oklch(90.5% 0.182 98.111)","yellow-400":"oklch(85.2% 0.199 91.936)","yellow-500":"oklch(79.5% 0.184 86.047)","yellow-600":"oklch(68.1% 0.162 75.834)","yellow-700":"oklch(55.4% 0.135 66.442)","yellow-800":"oklch(47.6% 0.114 61.907)","yellow-900":"oklch(42.1% 0.095 57.708)","yellow-950":"oklch(28.6% 0.066 53.813)","purple-50":"oklch(97.7% 0.014 308.299)","purple-100":"oklch(94.6% 0.033 307.174)","purple-200":"oklch(90.2% 0.063 306.703)","purple-300":"oklch(82.7% 0.119 306.383)","purple-400":"oklch(71.4% 0.203 305.504)","purple-500":"oklch(62.7% 0.265 303.9)","purple-600":"oklch(55.8% 0.288 302.321)","purple-700":"oklch(49.6% 0.265 301.924)","purple-800":"oklch(43.8% 0.218 303.724)","purple-900":"oklch(38.1% 0.176 304.987)","purple-950":"oklch(29.1% 0.149 302.717)","pink-50":"oklch(97.1% 0.014 343.198)","pink-100":"oklch(94.8% 0.028 342.258)","pink-200":"oklch(89.9% 0.061 343.231)","pink-300":"oklch(82.3% 0.12 346.018)","pink-400":"oklch(71.8% 0.202 349.761)","pink-500":"oklch(65.6% 0.241 354.308)","pink-600":"oklch(59.2% 0.249 0.584)","pink-700":"oklch(52.5% 0.223 3.958)","pink-800":"oklch(45.9% 0.187 3.815)","pink-900":"oklch(40.8% 0.153 2.432)","pink-950":"oklch(28.4% 0.109 3.907)","indigo-50":"oklch(96.2% 0.018 272.314)","indigo-100":"oklch(93% 0.034 272.788)","indigo-200":"oklch(87% 0.065 274.039)","indigo-300":"oklch(78.5% 0.115 274.713)","indigo-400":"oklch(67.3% 0.182 276.935)","indigo-500":"oklch(58.5% 0.233 277.117)","indigo-600":"oklch(51.1% 0.262 276.966)","indigo-700":"oklch(45.7% 0.24 277.023)","indigo-800":"oklch(39.8% 0.195 277.366)","indigo-900":"oklch(35.9% 0.144 278.697)","indigo-950":"oklch(25.7% 0.09 281.288)","cyan-50":"oklch(98.4% 0.019 200.873)","cyan-100":"oklch(95.6% 0.045 203.388)","cyan-200":"oklch(91.7% 0.08 205.041)","cyan-300":"oklch(86.5% 0.127 207.078)","cyan-400":"oklch(78.9% 0.154 211.53)","cyan-500":"oklch(71.5% 0.143 215.221)","cyan-600":"oklch(60.9% 0.126 221.723)","cyan-700":"oklch(52% 0.105 223.128)","cyan-800":"oklch(45% 0.085 224.283)","cyan-900":"oklch(39.8% 0.07 227.392)","cyan-950":"oklch(30.2% 0.056 229.695)","emerald-50":"oklch(97.9% 0.021 166.113)","emerald-100":"oklch(95% 0.052 163.051)","emerald-200":"oklch(90.5% 0.093 164.15)","emerald-300":"oklch(84.5% 0.143 164.978)","emerald-400":"oklch(76.5% 0.177 163.223)","emerald-500":"oklch(69.6% 0.17 162.48)","emerald-600":"oklch(59.6% 0.145 163.225)","emerald-700":"oklch(50.8% 0.118 165.612)","emerald-800":"oklch(43.2% 0.095 166.913)","emerald-900":"oklch(37.8% 0.077 168.94)","emerald-950":"oklch(26.2% 0.051 172.552)",white:"#fff",black:"#000",transparent:"transparent",current:"currentColor"},Ob={"font-thin":{"font-weight":"100"},"font-extralight":{"font-weight":"200"},"font-light":{"font-weight":"300"},"font-normal":{"font-weight":"400"},"font-medium":{"font-weight":"500"},"font-semibold":{"font-weight":"600"},"font-bold":{"font-weight":"700"},"font-extrabold":{"font-weight":"800"},"font-black":{"font-weight":"900"}},Ib={italic:{"font-style":"italic"},"not-italic":{"font-style":"normal"}},Pb={uppercase:{"text-transform":"uppercase"},lowercase:{"text-transform":"lowercase"},capitalize:{"text-transform":"capitalize"},"normal-case":{"text-transform":"none"}},_b={underline:{"text-decoration-line":"underline"},overline:{"text-decoration-line":"overline"},"line-through":{"text-decoration-line":"line-through"},"no-underline":{"text-decoration-line":"none"}},Lb={"decoration-solid":{"text-decoration-style":"solid"},"decoration-double":{"text-decoration-style":"double"},"decoration-dotted":{"text-decoration-style":"dotted"},"decoration-dashed":{"text-decoration-style":"dashed"},"decoration-wavy":{"text-decoration-style":"wavy"}},Mb={"text-left":{"text-align":"left"},"text-center":{"text-align":"center"},"text-right":{"text-align":"right"},"text-justify":{"text-align":"justify"},"text-start":{"text-align":"start"},"text-end":{"text-align":"end"}},Fb={truncate:{overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"},"text-ellipsis":{"text-overflow":"ellipsis"},"text-clip":{"text-overflow":"clip"}},jb={"text-wrap":{"text-wrap":"wrap"},"text-nowrap":{"text-wrap":"nowrap"},"text-balance":{"text-wrap":"balance"},"text-pretty":{"text-wrap":"pretty"}},Db={"whitespace-normal":{"white-space":"normal"},"whitespace-nowrap":{"white-space":"nowrap"},"whitespace-pre":{"white-space":"pre"},"whitespace-pre-line":{"white-space":"pre-line"},"whitespace-pre-wrap":{"white-space":"pre-wrap"},"whitespace-break-spaces":{"white-space":"break-spaces"}},Bb={"break-normal":{"overflow-wrap":"normal","word-break":"normal"},"break-words":{"overflow-wrap":"break-word"},"break-all":{"word-break":"break-all"},"break-keep":{"word-break":"keep-all"}},Ub={"align-baseline":{"vertical-align":"baseline"},"align-top":{"vertical-align":"top"},"align-middle":{"vertical-align":"middle"},"align-bottom":{"vertical-align":"bottom"},"align-text-top":{"vertical-align":"text-top"},"align-text-bottom":{"vertical-align":"text-bottom"},"align-sub":{"vertical-align":"sub"},"align-super":{"vertical-align":"super"}},Vb={"list-none":{"list-style-type":"none"},"list-disc":{"list-style-type":"disc"},"list-decimal":{"list-style-type":"decimal"},"list-inside":{"list-style-position":"inside"},"list-outside":{"list-style-position":"outside"}},Wb={"hyphens-none":{hyphens:"none"},"hyphens-manual":{hyphens:"manual"},"hyphens-auto":{hyphens:"auto"}},zb={static:{position:"static"},fixed:{position:"fixed"},absolute:{position:"absolute"},relative:{position:"relative"},sticky:{position:"sticky"}},Kb={visible:{visibility:"visible"},invisible:{visibility:"hidden"},collapse:{visibility:"collapse"}},Gb={"float-left":{float:"left"},"float-right":{float:"right"},"float-none":{float:"none"},"float-start":{float:"inline-start"},"float-end":{float:"inline-end"}},Hb={"clear-left":{clear:"left"},"clear-right":{clear:"right"},"clear-both":{clear:"both"},"clear-none":{clear:"none"},"clear-start":{clear:"inline-start"},"clear-end":{clear:"inline-end"}},qb={isolate:{isolation:"isolate"},"isolation-auto":{isolation:"auto"}},Yb={"object-contain":{"object-fit":"contain"},"object-cover":{"object-fit":"cover"},"object-fill":{"object-fit":"fill"},"object-none":{"object-fit":"none"},"object-scale-down":{"object-fit":"scale-down"}},Jb={"object-bottom":{"object-position":"bottom"},"object-center":{"object-position":"center"},"object-left":{"object-position":"left"},"object-left-bottom":{"object-position":"left bottom"},"object-left-top":{"object-position":"left top"},"object-right":{"object-position":"right"},"object-right-bottom":{"object-position":"right bottom"},"object-right-top":{"object-position":"right top"},"object-top":{"object-position":"top"}},Xb={"overflow-auto":{overflow:"auto"},"overflow-hidden":{overflow:"hidden"},"overflow-clip":{overflow:"clip"},"overflow-ellipsis":{"text-overflow":"ellipsis"},"overflow-visible":{overflow:"visible"},"overflow-scroll":{overflow:"scroll"},"overflow-x-auto":{"overflow-x":"auto"},"overflow-x-hidden":{"overflow-x":"hidden"},"overflow-x-clip":{"overflow-x":"clip"},"overflow-x-visible":{"overflow-x":"visible"},"overflow-x-scroll":{"overflow-x":"scroll"},"overflow-y-auto":{"overflow-y":"auto"},"overflow-y-hidden":{"overflow-y":"hidden"},"overflow-y-clip":{"overflow-y":"clip"},"overflow-y-visible":{"overflow-y":"visible"},"overflow-y-scroll":{"overflow-y":"scroll"}},Zb={"overscroll-auto":{"overscroll-behavior":"auto"},"overscroll-contain":{"overscroll-behavior":"contain"},"overscroll-none":{"overscroll-behavior":"none"},"overscroll-x-auto":{"overscroll-behavior-x":"auto"},"overscroll-x-contain":{"overscroll-behavior-x":"contain"},"overscroll-x-none":{"overscroll-behavior-x":"none"},"overscroll-y-auto":{"overscroll-behavior-y":"auto"},"overscroll-y-contain":{"overscroll-behavior-y":"contain"},"overscroll-y-none":{"overscroll-behavior-y":"none"}},Qb={"z-0":{"z-index":"0"},"z-10":{"z-index":"10"},"z-20":{"z-index":"20"},"z-30":{"z-index":"30"},"z-40":{"z-index":"40"},"z-50":{"z-index":"50"},"z-auto":{"z-index":"auto"}},e0={"aspect-auto":{"aspect-ratio":"auto"},"aspect-square":{"aspect-ratio":"1 / 1"},"aspect-video":{"aspect-ratio":"16 / 9"}},t0={"box-border":{"box-sizing":"border-box"},"box-content":{"box-sizing":"content-box"}},r0={"box-decoration-clone":{"box-decoration-break":"clone"},"box-decoration-slice":{"box-decoration-break":"slice"}},n0={"bg-fixed":{"background-attachment":"fixed"},"bg-local":{"background-attachment":"local"},"bg-scroll":{"background-attachment":"scroll"}},i0={"bg-clip-border":{"background-clip":"border-box"},"bg-clip-padding":{"background-clip":"padding-box"},"bg-clip-content":{"background-clip":"content-box"},"bg-clip-text":{"background-clip":"text","-webkit-background-clip":"text"}},o0={"bg-origin-border":{"background-origin":"border-box"},"bg-origin-padding":{"background-origin":"padding-box"},"bg-origin-content":{"background-origin":"content-box"}},s0={"bg-bottom":{"background-position":"bottom"},"bg-center":{"background-position":"center"},"bg-left":{"background-position":"left"},"bg-left-bottom":{"background-position":"left bottom"},"bg-left-top":{"background-position":"left top"},"bg-right":{"background-position":"right"},"bg-right-bottom":{"background-position":"right bottom"},"bg-right-top":{"background-position":"right top"},"bg-top":{"background-position":"top"}},a0={"bg-repeat":{"background-repeat":"repeat"},"bg-no-repeat":{"background-repeat":"no-repeat"},"bg-repeat-x":{"background-repeat":"repeat-x"},"bg-repeat-y":{"background-repeat":"repeat-y"},"bg-repeat-round":{"background-repeat":"round"},"bg-repeat-space":{"background-repeat":"space"}},l0={"bg-auto":{"background-size":"auto"},"bg-cover":{"background-size":"cover"},"bg-contain":{"background-size":"contain"}},c0={"bg-none":{"background-image":"none"},"bg-gradient-to-t":{"background-image":"linear-gradient(to top, var(--tc-gradient-stops))"},"bg-gradient-to-tr":{"background-image":"linear-gradient(to top right, var(--tc-gradient-stops))"},"bg-gradient-to-r":{"background-image":"linear-gradient(to right, var(--tc-gradient-stops))"},"bg-gradient-to-br":{"background-image":"linear-gradient(to bottom right, var(--tc-gradient-stops))"},"bg-gradient-to-b":{"background-image":"linear-gradient(to bottom, var(--tc-gradient-stops))"},"bg-gradient-to-bl":{"background-image":"linear-gradient(to bottom left, var(--tc-gradient-stops))"},"bg-gradient-to-l":{"background-image":"linear-gradient(to left, var(--tc-gradient-stops))"},"bg-gradient-to-tl":{"background-image":"linear-gradient(to top left, var(--tc-gradient-stops))"},"bg-radial":{"background-image":"radial-gradient(var(--tc-gradient-stops))"},"bg-radial-at-t":{"background-image":"radial-gradient(at top, var(--tc-gradient-stops))"},"bg-radial-at-tr":{"background-image":"radial-gradient(at top right, var(--tc-gradient-stops))"},"bg-radial-at-r":{"background-image":"radial-gradient(at right, var(--tc-gradient-stops))"},"bg-radial-at-br":{"background-image":"radial-gradient(at bottom right, var(--tc-gradient-stops))"},"bg-radial-at-b":{"background-image":"radial-gradient(at bottom, var(--tc-gradient-stops))"},"bg-radial-at-bl":{"background-image":"radial-gradient(at bottom left, var(--tc-gradient-stops))"},"bg-radial-at-l":{"background-image":"radial-gradient(at left, var(--tc-gradient-stops))"},"bg-radial-at-tl":{"background-image":"radial-gradient(at top left, var(--tc-gradient-stops))"},"bg-radial-at-c":{"background-image":"radial-gradient(at center, var(--tc-gradient-stops))"},"bg-conic":{"background-image":"conic-gradient(var(--tc-gradient-stops))"},"bg-conic-from-t":{"background-image":"conic-gradient(from 0deg at center, var(--tc-gradient-stops))"},"bg-conic-from-tr":{"background-image":"conic-gradient(from 45deg at center, var(--tc-gradient-stops))"},"bg-conic-from-r":{"background-image":"conic-gradient(from 90deg at center, var(--tc-gradient-stops))"},"bg-conic-from-br":{"background-image":"conic-gradient(from 135deg at center, var(--tc-gradient-stops))"},"bg-conic-from-b":{"background-image":"conic-gradient(from 180deg at center, var(--tc-gradient-stops))"},"bg-conic-from-bl":{"background-image":"conic-gradient(from 225deg at center, var(--tc-gradient-stops))"},"bg-conic-from-l":{"background-image":"conic-gradient(from 270deg at center, var(--tc-gradient-stops))"},"bg-conic-from-tl":{"background-image":"conic-gradient(from 315deg at center, var(--tc-gradient-stops))"}},u0={"content-none":{content:"none"},"content-empty":{content:'""'}},f0={"scrollbar-auto":{"scrollbar-width":"auto"},"scrollbar-thin":{"scrollbar-width":"thin"},"scrollbar-none":{"scrollbar-width":"none"}},d0={"cursor-auto":{cursor:"auto"},"cursor-default":{cursor:"default"},"cursor-pointer":{cursor:"pointer"},"cursor-wait":{cursor:"wait"},"cursor-text":{cursor:"text"},"cursor-move":{cursor:"move"},"cursor-help":{cursor:"help"},"cursor-not-allowed":{cursor:"not-allowed"},"cursor-none":{cursor:"none"},"cursor-context-menu":{cursor:"context-menu"},"cursor-progress":{cursor:"progress"},"cursor-cell":{cursor:"cell"},"cursor-crosshair":{cursor:"crosshair"},"cursor-vertical-text":{cursor:"vertical-text"},"cursor-alias":{cursor:"alias"},"cursor-copy":{cursor:"copy"},"cursor-no-drop":{cursor:"no-drop"},"cursor-grab":{cursor:"grab"},"cursor-grabbing":{cursor:"grabbing"},"cursor-all-scroll":{cursor:"all-scroll"},"cursor-col-resize":{cursor:"col-resize"},"cursor-row-resize":{cursor:"row-resize"},"cursor-n-resize":{cursor:"n-resize"},"cursor-e-resize":{cursor:"e-resize"},"cursor-s-resize":{cursor:"s-resize"},"cursor-w-resize":{cursor:"w-resize"},"cursor-ne-resize":{cursor:"ne-resize"},"cursor-nw-resize":{cursor:"nw-resize"},"cursor-se-resize":{cursor:"se-resize"},"cursor-sw-resize":{cursor:"sw-resize"},"cursor-ew-resize":{cursor:"ew-resize"},"cursor-ns-resize":{cursor:"ns-resize"},"cursor-nesw-resize":{cursor:"nesw-resize"},"cursor-nwse-resize":{cursor:"nwse-resize"},"cursor-zoom-in":{cursor:"zoom-in"},"cursor-zoom-out":{cursor:"zoom-out"}},h0={"pointer-events-none":{"pointer-events":"none"},"pointer-events-auto":{"pointer-events":"auto"}},g0={"resize-none":{resize:"none"},"resize-y":{resize:"vertical"},"resize-x":{resize:"horizontal"},resize:{resize:"both"}},m0={"select-none":{"user-select":"none"},"select-text":{"user-select":"text"},"select-all":{"user-select":"all"},"select-auto":{"user-select":"auto"}},p0={"scroll-auto":{"scroll-behavior":"auto"},"scroll-smooth":{"scroll-behavior":"smooth"}},y0={"snap-none":{"scroll-snap-type":"none"},"snap-x":{"scroll-snap-type":"x var(--tc-scroll-snap-strictness, proximity)"},"snap-y":{"scroll-snap-type":"y var(--tc-scroll-snap-strictness, proximity)"},"snap-both":{"scroll-snap-type":"both var(--tc-scroll-snap-strictness, proximity)"},"snap-mandatory":{"--tc-scroll-snap-strictness":"mandatory"},"snap-proximity":{"--tc-scroll-snap-strictness":"proximity"},"snap-start":{"scroll-snap-align":"start"},"snap-end":{"scroll-snap-align":"end"},"snap-center":{"scroll-snap-align":"center"},"snap-align-none":{"scroll-snap-align":"none"},"snap-normal":{"scroll-snap-stop":"normal"},"snap-always":{"scroll-snap-stop":"always"}},Ze="var(--tc-pan-x,) var(--tc-pan-y,) var(--tc-pinch-zoom,)",b0={"touch-auto":{"touch-action":"auto"},"touch-none":{"touch-action":"none"},"touch-pan-x":{"--tc-pan-x":"pan-x","touch-action":Ze},"touch-pan-left":{"--tc-pan-x":"pan-left","touch-action":Ze},"touch-pan-right":{"--tc-pan-x":"pan-right","touch-action":Ze},"touch-pan-y":{"--tc-pan-y":"pan-y","touch-action":Ze},"touch-pan-up":{"--tc-pan-y":"pan-up","touch-action":Ze},"touch-pan-down":{"--tc-pan-y":"pan-down","touch-action":Ze},"touch-pinch-zoom":{"--tc-pinch-zoom":"pinch-zoom","touch-action":Ze},"touch-manipulation":{"touch-action":"manipulation"}},x0={"will-change-auto":{"will-change":"auto"},"will-change-scroll":{"will-change":"scroll-position"},"will-change-contents":{"will-change":"contents"},"will-change-transform":{"will-change":"transform"}},v0={"appearance-none":{appearance:"none"},"appearance-auto":{appearance:"auto"}},w0={"border-collapse":{"border-collapse":"collapse"},"border-separate":{"border-collapse":"separate"}},$0={"table-auto":{"table-layout":"auto"},"table-fixed":{"table-layout":"fixed"}},C0={"caption-top":{"caption-side":"top"},"caption-bottom":{"caption-side":"bottom"}},R0={"sr-only":{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)","white-space":"nowrap","border-width":"0"},"not-sr-only":{position:"static",width:"auto",height:"auto",padding:"0",margin:"0",overflow:"visible",clip:"auto","white-space":"normal"}},k0={"forced-color-adjust-auto":{"forced-color-adjust":"auto"},"forced-color-adjust-none":{"forced-color-adjust":"none"}},S0={"fill-none":{fill:"none"},"fill-current":{fill:"currentColor"},"fill-inherit":{fill:"inherit"}},A0={"stroke-none":{stroke:"none"},"stroke-current":{stroke:"currentColor"},"stroke-inherit":{stroke:"inherit"},"stroke-0":{"stroke-width":"0"},"stroke-1":{"stroke-width":"1"},"stroke-2":{"stroke-width":"2"}},E0={"stroke-linecap-butt":{"stroke-linecap":"butt"},"stroke-linecap-round":{"stroke-linecap":"round"},"stroke-linecap-square":{"stroke-linecap":"square"}},T0={"stroke-linejoin-miter":{"stroke-linejoin":"miter"},"stroke-linejoin-round":{"stroke-linejoin":"round"},"stroke-linejoin-bevel":{"stroke-linejoin":"bevel"}},N0=["blur","brightness","contrast","grayscale","hue-rotate","invert","saturate","sepia","drop-shadow"],O0=["blur","brightness","contrast","grayscale","hue-rotate","invert","opacity","saturate","sepia"],I0=N0.map((e)=>`var(--tc-${e}, )`).join(" "),Hl=O0.map((e)=>`var(--tc-backdrop-${e}, )`).join(" ");function De(e){return`var(--tc-drop-shadow-color, ${e})`}function F(e,t){return{[`--tc-${e}`]:t,filter:I0}}function ie(e,t){return{[`--tc-backdrop-${e}`]:t,"-webkit-backdrop-filter":Hl,"backdrop-filter":Hl}}var P0={"blur-none":F("blur","blur(0)"),"blur-xs":F("blur","blur(4px)"),"blur-sm":F("blur","blur(8px)"),blur:F("blur","blur(8px)"),"blur-md":F("blur","blur(12px)"),"blur-lg":F("blur","blur(16px)"),"blur-xl":F("blur","blur(24px)"),"blur-2xl":F("blur","blur(40px)"),"blur-3xl":F("blur","blur(64px)")},_0={"backdrop-blur-none":ie("blur","blur(0)"),"backdrop-blur-xs":ie("blur","blur(4px)"),"backdrop-blur-sm":ie("blur","blur(8px)"),"backdrop-blur":ie("blur","blur(8px)"),"backdrop-blur-md":ie("blur","blur(12px)"),"backdrop-blur-lg":ie("blur","blur(16px)"),"backdrop-blur-xl":ie("blur","blur(24px)"),"backdrop-blur-2xl":ie("blur","blur(40px)"),"backdrop-blur-3xl":ie("blur","blur(64px)")},L0={"grayscale-0":F("grayscale","grayscale(0)"),grayscale:F("grayscale","grayscale(100%)"),"invert-0":F("invert","invert(0)"),invert:F("invert","invert(100%)"),"sepia-0":F("sepia","sepia(0)"),sepia:F("sepia","sepia(100%)")},M0={"backdrop-grayscale-0":ie("grayscale","grayscale(0)"),"backdrop-grayscale":ie("grayscale","grayscale(100%)"),"backdrop-invert-0":ie("invert","invert(0)"),"backdrop-invert":ie("invert","invert(100%)"),"backdrop-sepia-0":ie("sepia","sepia(0)"),"backdrop-sepia":ie("sepia","sepia(100%)")},F0={"drop-shadow-xs":F("drop-shadow",`drop-shadow(0 1px 1px ${De("rgb(0 0 0 / 0.05)")})`),"drop-shadow-sm":F("drop-shadow",`drop-shadow(0 1px 2px ${De("rgb(0 0 0 / 0.15)")})`),"drop-shadow":F("drop-shadow",`drop-shadow(0 1px 2px ${De("rgb(0 0 0 / 0.1)")}) drop-shadow(0 1px 1px ${De("rgb(0 0 0 / 0.06)")})`),"drop-shadow-md":F("drop-shadow",`drop-shadow(0 3px 3px ${De("rgb(0 0 0 / 0.12)")})`),"drop-shadow-lg":F("drop-shadow",`drop-shadow(0 4px 4px ${De("rgb(0 0 0 / 0.15)")})`),"drop-shadow-xl":F("drop-shadow",`drop-shadow(0 9px 7px ${De("rgb(0 0 0 / 0.1)")})`),"drop-shadow-2xl":F("drop-shadow",`drop-shadow(0 25px 25px ${De("rgb(0 0 0 / 0.15)")})`),"drop-shadow-none":F("drop-shadow","drop-shadow(0 0 #0000)")},j0={"mix-blend-normal":{"mix-blend-mode":"normal"},"mix-blend-multiply":{"mix-blend-mode":"multiply"},"mix-blend-screen":{"mix-blend-mode":"screen"},"mix-blend-overlay":{"mix-blend-mode":"overlay"},"mix-blend-darken":{"mix-blend-mode":"darken"},"mix-blend-lighten":{"mix-blend-mode":"lighten"},"mix-blend-color-dodge":{"mix-blend-mode":"color-dodge"},"mix-blend-color-burn":{"mix-blend-mode":"color-burn"},"mix-blend-hard-light":{"mix-blend-mode":"hard-light"},"mix-blend-soft-light":{"mix-blend-mode":"soft-light"},"mix-blend-difference":{"mix-blend-mode":"difference"},"mix-blend-exclusion":{"mix-blend-mode":"exclusion"},"mix-blend-hue":{"mix-blend-mode":"hue"},"mix-blend-saturation":{"mix-blend-mode":"saturation"},"mix-blend-color":{"mix-blend-mode":"color"},"mix-blend-luminosity":{"mix-blend-mode":"luminosity"},"mix-blend-plus-darker":{"mix-blend-mode":"plus-darker"},"mix-blend-plus-lighter":{"mix-blend-mode":"plus-lighter"}},D0={"bg-blend-normal":{"background-blend-mode":"normal"},"bg-blend-multiply":{"background-blend-mode":"multiply"},"bg-blend-screen":{"background-blend-mode":"screen"},"bg-blend-overlay":{"background-blend-mode":"overlay"},"bg-blend-darken":{"background-blend-mode":"darken"},"bg-blend-lighten":{"background-blend-mode":"lighten"},"bg-blend-color-dodge":{"background-blend-mode":"color-dodge"},"bg-blend-color-burn":{"background-blend-mode":"color-burn"},"bg-blend-hard-light":{"background-blend-mode":"hard-light"},"bg-blend-soft-light":{"background-blend-mode":"soft-light"},"bg-blend-difference":{"background-blend-mode":"difference"},"bg-blend-exclusion":{"background-blend-mode":"exclusion"},"bg-blend-hue":{"background-blend-mode":"hue"},"bg-blend-saturation":{"background-blend-mode":"saturation"},"bg-blend-color":{"background-blend-mode":"color"},"bg-blend-luminosity":{"background-blend-mode":"luminosity"}},B0={...rb,...nb,...ib,...ob,...sb,...fb,...db,...hb,...gb,...mb,...Sb,...lc,...cc,...Ab,...Eb,...Tb,...Ob,...Ib,...Pb,..._b,...Lb,...Mb,...Fb,...jb,...Db,...Bb,...Ub,...Vb,...Wb,...zb,...Kb,...Gb,...Hb,...qb,...Yb,...Jb,...Xb,...Zb,...Qb,...e0,...t0,...r0,...n0,...i0,...o0,...s0,...a0,...l0,...c0,...d0,...h0,...g0,...m0,...p0,...y0,...b0,...x0,...v0,...w0,...$0,...C0,...R0,...k0,...S0,...A0,...E0,...T0,...P0,..._0,...L0,...M0,...F0,...j0,...D0,...u0,...f0},Mt={hover:":hover",focus:":focus",active:":active",disabled:":disabled",visited:":visited",checked:":checked","focus-within":":focus-within","focus-visible":":focus-visible",first:":first-child",last:":last-child",odd:":nth-child(odd)",even:":nth-child(even)","first-of-type":":first-of-type","last-of-type":":last-of-type",before:"::before",after:"::after",marker:"::marker",placeholder:"::placeholder",selection:"::selection",file:"::file-selector-button","first-letter":"::first-letter","first-line":"::first-line",backdrop:"::backdrop","details-content":"::details-content",required:":required",valid:":valid",invalid:":invalid","read-only":":read-only",autofill:":autofill","user-valid":":user-valid","user-invalid":":user-invalid","in-range":":in-range","out-of-range":":out-of-range","placeholder-shown":":placeholder-shown",open:":is([open], :popover-open, :open)",closed:":not(:is([open], :popover-open, :open))",empty:":empty",enabled:":enabled",only:":only-child","only-of-type":":only-of-type",target:":target",indeterminate:":indeterminate",default:":default",optional:":optional",inert:":is([inert], [inert] *)"};function ql(e){if(!e)return;if(e.charCodeAt(0)===91&&e.charCodeAt(e.length-1)===93){let n=e.slice(1,-1).replace(/_/g," ").trim();return n?`:is(${n})`:void 0}let t=Mt[e];if(t!==void 0)return t.startsWith("::")?void 0:t;let r=Oi(e);if(r!==void 0)return r;if(e.startsWith("has-")){let n=e.slice(4);if(!n)return;return n.charCodeAt(0)===91&&n.charCodeAt(n.length-1)===93?`:has(${n.slice(1,-1)})`:`:has(:${n})`}if(e.startsWith("aria-")||e.startsWith("data-"))return Qe(e.slice(0,4),e.slice(5));if(e.startsWith("in-")){let n=Ii(e.slice(3));return n===void 0?void 0:`:where(${n}) *`}return}var Ei=[["nth-last-of-type-","nth-last-of-type"],["nth-of-type-","nth-of-type"],["nth-last-","nth-last-child"],["nth-","nth-child"]];function Oi(e){for(let t=0;t<Ei.length;t++){let r=Ei[t][0];if(!e.startsWith(r))continue;let n=Ei[t][1],i=e.slice(r.length);if(i.charCodeAt(0)===91&&i.charCodeAt(i.length-1)===93){let o=i.slice(1,-1).replace(/_/g," ").trim();return o?`:${n}(${o})`:void 0}return/^\d+$/.test(i)?`:${n}(${i})`:void 0}return}function Ii(e){if(!e)return;if(e.charCodeAt(0)===91&&e.charCodeAt(e.length-1)===93){let r=e.slice(1,-1).replace(/_/g," ").trim();if(!r)return;return r.includes("&")?r.replace(/&/g,"*"):`:is(${r})`}if(e.startsWith("data-"))return Qe("data",e.slice(5));if(e.startsWith("aria-"))return Qe("aria",e.slice(5));let t=Mt[e];return t!==void 0&&!t.startsWith("::")?t:void 0}var U0=/^([^~|^$*=\s]+)([~|^$*]?=)([\s\S]*)$/,V0=/\s+([is])$/i;function W0(e){let t=U0.exec(e);if(t===null)return e;let r=t[1],n=t[2],i=t[3],o="",s=V0.exec(i);if(s!==null)o=` ${s[1]}`,i=i.slice(0,s.index);let l=i.length>1&&(i.charCodeAt(0)===34||i.charCodeAt(0)===39)&&i.charCodeAt(i.length-1)===i.charCodeAt(0)?i:`"${i.replace(/["\\]/g,"\\$&")}"`;return`${r}${n}${l}${o}`}function Qe(e,t){if(!t)return;if(t.charCodeAt(0)===91&&t.charCodeAt(t.length-1)===93){let r=t.slice(1,-1).replace(/_/g," ").trim();return r?`[${e}-${W0(r)}]`:void 0}return e==="aria"?`[aria-${t}="true"]`:`[data-${t}]`}function Gr(e){if(!e)return;if(e.startsWith("has-")){let r=e.slice(4);if(!r)return;return r.charCodeAt(0)===91&&r.charCodeAt(r.length-1)===93?`:has(${r.slice(1,-1)})`:`:has(:${r})`}if(e.charCodeAt(0)===91&&e.charCodeAt(e.length-1)===93){let r=e.slice(1,-1).replace(/_/g," ").trim();if(!r)return;return r.includes("&")?r.replace(/&/g,""):`:is(${r})`}if(e.startsWith("data-"))return Qe("data",e.slice(5));if(e.startsWith("aria-"))return Qe("aria",e.slice(5));let t=Mt[e];return t!==void 0&&!t.startsWith("::")?t:void 0}function Hr(e){let t=0,r=-1;for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);if(i===91||i===40)t++;else if(i===93||i===41)t--;else if(i===47&&t===0)r=n}if(r===-1)return{base:e,name:""};return{base:e.slice(0,r),name:e.slice(r+1)}}function qr(e){return Rn(e).css}var Ti={"pointer-none":"(pointer: none)","pointer-coarse":"(pointer: coarse)","pointer-fine":"(pointer: fine)","any-pointer-none":"(any-pointer: none)","any-pointer-coarse":"(any-pointer: coarse)","any-pointer-fine":"(any-pointer: fine)","inverted-colors":"(inverted-colors: inverted)",noscript:"(scripting: none)"},Yl={print:"print","motion-safe":"(prefers-reduced-motion: no-preference)","motion-reduce":"(prefers-reduced-motion: reduce)","contrast-more":"(prefers-contrast: more)","contrast-less":"(prefers-contrast: less)",landscape:"(orientation: landscape)",portrait:"(orientation: portrait)","forced-colors":"(forced-colors: active)"};function Jl(e){if(e.charCodeAt(0)===91&&e.charCodeAt(e.length-1)===93){let t=e.slice(1,-1).replace(/_/g," "),r=t.indexOf(":");if(r!==-1)return`(${t.slice(0,r).trim()}: ${t.slice(r+1).trim()})`;return`(${t})`}return`(${e})`}function z0(e){let t=0;for(let r=e.length-1;r>=0;r--){let n=e.charCodeAt(r);if(n===93)t++;else if(n===91)t--;else if(n===47&&t===0)return{size:e.slice(0,r),name:e.slice(r+1)}}return{size:e}}var Xl="\x01",Zl={dark:".dark ",light:".light "},Ql={rtl:':is([dir="rtl"], [dir="rtl"] *)',ltr:':is([dir="ltr"], [dir="ltr"] *)'},ec=new WeakMap,tc=new WeakMap,rc=new WeakMap,nc=new WeakMap,ic=new WeakMap,oc=new WeakMap,sc=new WeakMap;function K0(e){let t=tc.get(e);if(t)return t;let r=!1;for(let i in e)if(Yr[i]!==e[i]){r=!0;break}let n=r?{...Yr,...e}:Yr;return tc.set(e,n),n}function G0(e){let t=e.lastIndexOf("-");return t>0&&/^\d+$/.test(e.slice(t+1))?e.slice(0,t):e}function H0(e,t){let r=t?.length?t.join("\x00"):"",n=rc.get(e),i=n?.get(r);if(i)return i;let o=null;for(let l in e){let a=e[l];if(typeof a==="string"){if(bt[l]!==void 0&&bt[l]!==a)o??={},o[l]=a;continue}if(!a||typeof a!=="object")continue;for(let c in a){let u=a[c];if(typeof u!=="string")continue;let f=c==="DEFAULT"?l:`${l}-${c}`;if(bt[f]!==void 0&&bt[f]!==u)o??={},o[f]=u}}let s=o?{...bt,...o}:bt;if(r){let l=null;for(let a in s){let c=G0(a);if(!t.includes(c))continue;l??={...s},l[a]=W(a,s[a],c,t)}if(l)s=l}if(!n)n=new Map,rc.set(e,n);return n.set(r,s),s}function q0(e){let t=nc.get(e);if(t!==void 0)return t;let r=!1;for(let n in e){let i=n==="DEFAULT"?"rounded":`rounded-${n}`;if(cc[i]?.["border-radius"]!==e[n]){r=!0;break}}return nc.set(e,r),r}function Y0(e){let t=ic.get(e);if(t!==void 0)return t;let r=!1;for(let n in e){let i=n==="DEFAULT"?"shadow":`shadow-${n}`,o=lc[i];if(o!==void 0&&o["--tc-shadow"]!==e[n]){r=!0;break}}return ic.set(e,r),r}function J0(e){let t=e??ht.theme.screens,r=oc.get(t);if(r)return r;let n=new Map(Object.entries(t));return oc.set(t,n),n}function X0(e){let t=e??ht.theme.containers,r=sc.get(t);if(r)return r;let n=new Map(Object.entries(t));return sc.set(t,n),n}function Z0(e){let t=ec.get(e);if(t)return t;if(e.presets&&e.presets.length>0)for(let g of e.presets){if(g.theme)e.theme=Ni(e.theme,g.theme);if(g.rules&&g.rules.length>0)e.rules=[...g.rules,...e.rules];if(g.shortcuts)e.shortcuts={...g.shortcuts,...e.shortcuts};if(g.variants)e.variants={...g.variants,...e.variants};if(g.preflights&&g.preflights.length>0)e.preflights=[...g.preflights,...e.preflights]}let r=e.theme.extend?.colors?e.theme.extend.colors:null;if(e.theme.extend){let{extend:g,...m}=e.theme;if(g)e.theme=Ni(m,g)}let n=pb(e.theme.colors,e.theme.modes??{}),i=n.tokens;if(i.length>0){e.theme={...e.theme,colors:n.colors};let g=i.map((m)=>m.name);if(e.colorVariables=[...new Set([...e.colorVariables??[],...g])],r){r={...r};for(let m of i)if(m.name in r)r[m.name]=m.base}}let o=[],s=new Set;for(let g of e.blocklist)if(g.includes("*"))o.push(new RegExp(`^${g.replace(/\*/g,".*")}$`));else s.add(g);let l=K0(e.theme.spacing),a=H0(e.theme.colors,e.colorVariables),c=q0(e.theme.borderRadius),u=Y0(e.theme.boxShadow),f={};for(let[g,m]of Object.entries(e.theme.animation??{}))f[`animate-${g}`]={animation:m};let d={...xb};for(let[g,m]of Object.entries(e.theme.keyframes??{}))d[g]=bb(g,m);let h={config:e,variantEnabled:e.variants,spacingValues:l,commonColors:a,skipStaticRadius:c,skipStaticShadow:u,screenBreakpoints:J0(e.theme.screens),containerBreakpoints:X0(e.theme.containers),blocklistRegexCache:o,blocklistExact:s,extendColors:r,hasBlocklist:o.length>0||s.size>0,hasShortcuts:Object.keys(e.shortcuts).length>0,themeAnimations:f,keyframes:d,modeTokens:i};return ec.set(e,h),h}function ac(e){return e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57||e===45||e===95}function Q0(e){let t=e.indexOf(".");if(t===-1)return;t++;let r=()=>{if(e.charCodeAt(t)===92&&e.charCodeAt(t+1)===33)t+=2};r();for(;;){let i=t;while(i<e.length&&ac(e.charCodeAt(i)))i++;if(e.charCodeAt(i)!==92||e.charCodeAt(i+1)!==58)break;t=i+2}r();let n=t;while(n<e.length&&ac(e.charCodeAt(n)))n++;return n>t?e.slice(t,n):void 0}var ex=/^(?:mx|my|px|py|inset-x|inset-y|border-x|border-y|scroll-mx|scroll-my|scroll-px|scroll-py|space-x|space-y|gap-x|gap-y)-/,tx=/^rounded-[tlbr](?:-|$)/,rx=/^(?:mt|mr|mb|ml|pt|pr|pb|pl|top|right|bottom|left|border-t|border-r|border-b|border-l|scroll-mt|scroll-mr|scroll-mb|scroll-ml|scroll-pt|scroll-pr|scroll-pb|scroll-pl)-/,nx=/^rounded-(?:tl|tr|bl|br)(?:-|$)/,ix=/^i-[a-z][a-z0-9]*(?:-[a-z0-9]+)*-.+/;function ox(e){let t=Q0(e);if(!t)return 0;if(ix.test(t))return-1;if(ex.test(t)||tx.test(t))return 1;if(rx.test(t)||nx.test(t))return 2;return 0}class Jr{config;rules=new Map;classCache=new Set;selectorCache=new Map;mediaQueryCache=new Map;ruleCache=new Map;variantEnabled;screenBreakpoints;containerBreakpoints;noMatchCache=new Set;usedKeyframes=new Set;variantHandledCache=new Map;utilityRankCache=new Map;compiledGenerated=new Set;darkStrategy;spacingValues;commonColors;skipStaticRadius;skipStaticShadow;shortcutSelectorRaw=null;extendColors=null;processed;revision=0;cssCache=null;cssCacheRevision=-1;cssCachePreflight=!1;cssCacheMinify=!1;constructor(e){this.config=e;this.processed=Z0(e),this.variantEnabled=this.processed.variantEnabled,this.screenBreakpoints=this.processed.screenBreakpoints,this.containerBreakpoints=this.processed.containerBreakpoints,this.extendColors=this.processed.extendColors,this.darkStrategy=e.darkMode==="media"?"media":"class",this.spacingValues=this.processed.spacingValues,this.commonColors=this.processed.commonColors,this.skipStaticRadius=this.processed.skipStaticRadius,this.skipStaticShadow=this.processed.skipStaticShadow}buildRuleLookup(){}generateBatch(e){for(let t=0;t<e.length;t++)this.generate(e[t])}generate(e){if(this.classCache.has(e))return;if(this.classCache.add(e),this.processed.hasShortcuts){let t=this.config.shortcuts[e];if(t){this.expandShortcut(e,t,new Set([e]));return}let r=this.resolveVariantShortcut(e);if(r){let{base:n,prefix:i,important:o}=r;this.expandShortcut(e,this.config.shortcuts[n],new Set([n]),i,o);return}}this.generateUtility(e)}resolveVariantShortcut(e){if(!e.includes(":")&&!e.includes("!"))return;let t=!1,r=e;if(r.charCodeAt(0)===33)t=!0,r=r.slice(1);else if(r.length>1&&r.charCodeAt(r.length-1)===33)t=!0,r=r.slice(0,-1);let n=St(r),i=n[n.length-1];if(!t&&i.length>1&&i.charCodeAt(0)===33)t=!0,i=i.slice(1);if(i===e||!Object.hasOwn(this.config.shortcuts,i))return;let o=n.slice(0,-1);return{base:i,prefix:o.length>0?`${o.join(":")}:`:"",important:t}}expandShortcut(e,t,r,n="",i=!1){let o=Array.isArray(t)?t:t.split(/\s+/),s=this.shortcutSelectorRaw;this.shortcutSelectorRaw=e;for(let l of o){if(!l)continue;let a=this.config.shortcuts[l];if(a){if(!r.has(l))r.add(l),this.expandShortcut(e,a,r,n,i);continue}let c=this.resolveVariantShortcut(l);if(c){if(!r.has(c.base))r.add(c.base),this.expandShortcut(e,this.config.shortcuts[c.base],r,n+c.prefix,i||c.important),r.delete(c.base);continue}let u=n===""?l:n+l;if(i&&!Sn(u).important)u+="!";this.generateUtility(u)}this.shortcutSelectorRaw=s}generateCompiledClass(e,t){if(this.compiledGenerated.has(e))return;this.compiledGenerated.add(e),this.classCache.add(e),this.expandShortcut(e,t,new Set([e]))}generateUtility(e){if(this.processed.hasBlocklist){if(this.processed.blocklistExact.has(e))return;let c=this.processed.blocklistRegexCache;for(let u=0;u<c.length;u++)if(c[u].test(e))return}let t=Sn(e),r=t.base,n=B0[r]??this.processed.themeAnimations[r];if(n&&(this.skipStaticRadius&&r.startsWith("rounded")||this.skipStaticShadow&&(r==="shadow"||r.startsWith("shadow-"))))n=void 0;if(n){if(this.addRule(t,n),n.animation){let c=n.animation.split(" ")[0];if(c&&c!=="none")this.usedKeyframes.add(c),this.revision++}return}let{utility:i,value:o}=t;if(i==="w"&&o){let c=Gl[o]||this.config.theme.spacing[o];if(c){this.addRule(t,{width:c});return}if(t.arbitrary){let u=o.match(/^(\d+)\/(\d+)$/);if(u){let f=Number(u[1]),d=Number(u[2]);if(!Number.isNaN(f)&&!Number.isNaN(d)&&d!==0){this.addRule(t,{width:$e(f,d)});return}}this.addRule(t,{width:o});return}}if(i==="h"&&o){let c=Gl[o]||this.config.theme.spacing[o];if(c){this.addRule(t,{height:o==="screen"?"100vh":c});return}if(t.arbitrary){let u=o.match(/^(\d+)\/(\d+)$/);if(u){let f=Number(u[1]),d=Number(u[2]);if(!Number.isNaN(f)&&!Number.isNaN(d)&&d!==0){this.addRule(t,{height:$e(f,d)});return}}this.addRule(t,{height:o});return}}if(i==="p"&&o){let c=this.spacingValues[o];if(c){this.addRule(t,{padding:c});return}}if(i==="px"&&o){let c=this.spacingValues[o];if(c){this.addRule(t,{"padding-left":c,"padding-right":c});return}}if(i==="py"&&o){let c=this.spacingValues[o];if(c){this.addRule(t,{"padding-top":c,"padding-bottom":c});return}}if((i==="pt"||i==="pr"||i==="pb"||i==="pl")&&o){let c=this.spacingValues[o];if(c){let u={pt:"padding-top",pr:"padding-right",pb:"padding-bottom",pl:"padding-left"};this.addRule(t,{[u[i]]:c});return}}if(i==="m"&&o){let c=this.spacingValues[o];if(c){this.addRule(t,{margin:c});return}}if(i==="mx"&&o){let c=this.spacingValues[o];if(c){this.addRule(t,{"margin-left":c,"margin-right":c});return}}if(i==="my"&&o){let c=this.spacingValues[o];if(c){this.addRule(t,{"margin-top":c,"margin-bottom":c});return}}if((i==="mt"||i==="mr"||i==="mb"||i==="ml")&&o){let c=this.spacingValues[o];if(c){let u={mt:"margin-top",mr:"margin-right",mb:"margin-bottom",ml:"margin-left"};this.addRule(t,{[u[i]]:c});return}}if((i==="top"||i==="right"||i==="bottom"||i==="left")&&o){let c=this.spacingValues[o];if(c){this.addRule(t,{[i]:c});return}}if(i==="inset"&&o){let c=this.spacingValues[o];if(c){this.addRule(t,{top:c,right:c,bottom:c,left:c});return}}if(i==="inset-x"&&o){let c=this.spacingValues[o];if(c){this.addRule(t,{left:c,right:c});return}}if(i==="inset-y"&&o){let c=this.spacingValues[o];if(c){this.addRule(t,{top:c,bottom:c});return}}if(i==="bg"&&o){let c=this.commonColors[o];if(c){this.addRule(t,{"background-color":c});return}}if(i==="text"&&o){let c=this.commonColors[o];if(c){this.addRule(t,{color:c});return}}if(i==="border"&&o){let c=this.commonColors[o];if(c){this.addRule(t,{"border-color":c});return}}if(i==="justify"&&o){let c=ab[o];if(c){this.addRule(t,{"justify-content":c});return}}if(i==="items"&&o){let c=lb[o];if(c){this.addRule(t,{"align-items":c});return}}if(i==="content"&&o){let c=cb[o];if(c){this.addRule(t,{"align-content":c});return}if(t.arbitrary){this.addRule(t,{content:o});return}}if(i==="self"&&o){let c=ub[o];if(c){this.addRule(t,{"align-self":c});return}}if(i==="grid-cols"&&o){let c=wb[o];if(c){this.addRule(t,{"grid-template-columns":c});return}}if(i==="grid-rows"&&o){let c=$b[o];if(c){this.addRule(t,{"grid-template-rows":c});return}}if(i==="col"&&o){let c=Cb[o];if(c){this.addRule(t,{"grid-column":c});return}}if(i==="row"&&o){let c=Rb[o];if(c){this.addRule(t,{"grid-row":c});return}}if(i==="grid-flow"&&o){let c=kb[o];if(c){this.addRule(t,{"grid-auto-flow":c});return}}if(i==="auto-cols"&&o){let c=Kl[o];if(c){this.addRule(t,{"grid-auto-columns":c});return}}if(i==="auto-rows"&&o){let c=Kl[o];if(c){this.addRule(t,{"grid-auto-rows":c});return}}if(i==="origin"&&o){let c=vb[o];if(c){this.addRule(t,{"transform-origin":c});return}}if(i==="scale"&&o&&!t.arbitrary){let c=Number(o)/100;if(!Number.isNaN(c)){this.addRule(t,{transform:`scale(${c})`});return}}if(i==="scale-x"&&o&&!t.arbitrary){let c=Number(o)/100;if(!Number.isNaN(c)){this.addRule(t,{transform:`scaleX(${c})`});return}}if(i==="scale-y"&&o&&!t.arbitrary){let c=Number(o)/100;if(!Number.isNaN(c)){this.addRule(t,{transform:`scaleY(${c})`});return}}if(i==="rotate"&&o&&!t.arbitrary&&/^-?\d+(?:\.\d+)?$/.test(o)){this.addRule(t,{transform:`rotate(${o}deg)`});return}if(i==="duration"&&o&&o!=="0"&&!t.arbitrary&&/^\d+(?:\.\d+)?$/.test(o)){this.addRule(t,{"transition-duration":`${o}ms`});return}if(i==="delay"&&o&&o!=="0"&&!t.arbitrary&&/^\d+(?:\.\d+)?$/.test(o)){this.addRule(t,{"transition-delay":`${o}ms`});return}let s=(c)=>{let u=this.config.theme.spacing[c];if(u!==void 0)return u;if(t.arbitrary)return c;if(/^\d+(?:\.\d+)?$/.test(c)){let f=Number.parseFloat(c);if(Number.isFinite(f))return`${f*0.25}rem`}return};if(i==="gap"&&o){let c=s(o);if(c!==void 0)this.addRule(t,{gap:c});return}if(i==="gap-x"&&o){let c=s(o);if(c!==void 0)this.addRule(t,{"column-gap":c});return}if(i==="gap-y"&&o){let c=s(o);if(c!==void 0)this.addRule(t,{"row-gap":c});return}if(i==="place"&&o){if(o.startsWith("content-")){let c=Ai[o.slice(8)];if(c){this.addRule(t,{"place-content":c});return}}if(o.startsWith("items-")){let c=Ai[o.slice(6)];if(c){this.addRule(t,{"place-items":c});return}}if(o.startsWith("self-")){let c=Ai[o.slice(5)];if(c){this.addRule(t,{"place-self":c});return}}}let l=`${t.utility}:${t.value||""}`;if(this.noMatchCache.has(l))return;if(this.config.rules.length>0)for(let[c,u]of this.config.rules){let f=e.match(c);if(f){let d=u(f);if(d){this.addRule(t,d);return}}}let a=Si.length;for(let c=0;c<a;c++){let u=Si[c](t,this.config);if(u){if("properties"in u&&typeof u.properties==="object")this.addRule(t,u.properties,u.childSelector,u.pseudoElement,u.defaults);else this.addRule(t,u);return}}this.noMatchCache.add(l)}isVariantHandled(e){let t=this.variantHandledCache.get(e);if(t!==void 0)return t;let r=Mt[e]!==void 0||Zl[e]!==void 0||Ql[e]!==void 0||e.startsWith("not-")&&this.isNegationResolvable(e.slice(4))||this.screenBreakpoints.has(e)||e.startsWith("max-")&&this.screenBreakpoints.has(e.slice(4))||e.charCodeAt(0)===64&&this.containerQuery(e.slice(1))!==void 0||e==="*"||e==="**"||Oi(e)!==void 0||e.startsWith("in-")&&Ii(e.slice(3))!==void 0||e.startsWith("group-")&&Gr(Hr(e.slice(6)).base)!==void 0||e.startsWith("peer-")&&Gr(Hr(e.slice(5)).base)!==void 0||e.startsWith("group/")||e.startsWith("peer/")||e.startsWith("has-")||e.startsWith("aria-")||e.startsWith("data-")||e.startsWith("supports-")||e.startsWith("[")&&e.endsWith("]")||Ti[e]!==void 0||e==="starting"||["print","motion-safe","motion-reduce","contrast-more","contrast-less","landscape","portrait","forced-colors"].includes(e);return this.variantHandledCache.set(e,r),r}containerQuery(e){if(!e)return;let{size:t,name:r}=z0(e);if(!t||r!==void 0&&!r)return;let n=t,i=!0;if(t.startsWith("max-"))n=t.slice(4),i=!1;else if(t.startsWith("min-"))n=t.slice(4);let o;if(n.charCodeAt(0)===91&&n.charCodeAt(n.length-1)===93)o=n.slice(1,-1).replace(/_/g," ").trim()||void 0;else o=this.containerBreakpoints.get(n);if(o===void 0)return;let s=i?`(width >= ${o})`:`(width < ${o})`;return r===void 0?`@container ${s}`:`@container ${r} ${s}`}negatableAtRule(e){if(!e)return;let t=Yl[e];if(t!==void 0)return{media:t};let r=Ti[e];if(r!==void 0)return{media:r};let n=this.screenBreakpoints.get(e);if(n!==void 0)return{media:`(min-width: ${n})`};if(this.darkStrategy==="media"&&(e==="dark"||e==="light"))return{media:`(prefers-color-scheme: ${e})`};if(e.startsWith("supports-")){let i=e.slice(9);return i?{supports:Jl(i)}:void 0}return}isNegationResolvable(e){return ql(e)!==void 0||this.negatableAtRule(e)!==void 0}addRule(e,t,r,n,i){for(let c=0;c<e.variants.length;c++)if(!this.isVariantHandled(e.variants[c]))return;let o=this.shortcutSelectorRaw===null?r===void 0&&n===void 0?e.raw:`${e.raw}${r||""}${n||""}`:`${this.shortcutSelectorRaw}>${e.raw}${r||""}${n||""}`,s=this.selectorCache.get(o);if(!s){if(s=this.buildSelector(e),n)s+=n;if(r)s+=` ${r}`;if(i&&!s.includes("::"))s=`:where(${s})`;this.selectorCache.set(o,s)}let l=this.getMediaQuery(e);if(e.important){let c={};for(let u in t)c[u]=`${t[u]} !important`;t=c}let a=l||"base";if(!this.rules.has(a))this.rules.set(a,[]);this.revision++,this.rules.get(a).push({selector:s,properties:t,mediaQuery:l,childSelector:r})}buildSelector(e){let t=`.${this.escapeSelector(this.shortcutSelectorRaw??e.raw)}`,r="",n=e.variants,i=n.length;if(i===0)return t;for(let o=0;o<i;o++){let s=n[o];if(s.charCodeAt(0)===91&&s.charCodeAt(s.length-1)===93){let u=s.slice(1,-1).replace(/_/g," ");if(u.includes("&"))t=u.replace(/&/g,t);continue}if(s==="*"||s==="**"){if(this.variantEnabled[s])t=s==="*"?`:is(${t} > *)`:`:is(${t} *)`;continue}let l=Mt[s];if(l!==void 0){if(this.variantEnabled[s])t+=l;continue}let a=Ql[s];if(a!==void 0){if(this.variantEnabled[s]){let u=t.indexOf("::");t=u===-1?t+a:t.slice(0,u)+a+t.slice(u)}continue}let c=Zl[s];if(c!==void 0){if(this.darkStrategy==="media"&&(s==="dark"||s==="light"))continue;if(this.variantEnabled[s])r=c;continue}if(s.charCodeAt(0)===110&&s.startsWith("not-")){if(this.variantEnabled.not){let u=ql(s.slice(4));if(u!==void 0)t+=`:not(${u})`}continue}if(s.charCodeAt(0)===110&&s.startsWith("nth-")){let u=Oi(s);if(u!==void 0)t+=u;continue}if(s.charCodeAt(0)===105&&s.startsWith("in-")){if(this.variantEnabled.in){let u=Ii(s.slice(3));if(u!==void 0)r=`:where(${u}) `}continue}if(s.charCodeAt(0)===103&&s.startsWith("group-")){if(this.variantEnabled.group){let{base:u,name:f}=Hr(s.slice(6)),d=f?`.group\\/${f}`:".group",h=Gr(u);if(h!==void 0)r=`${d}${h} `}continue}if(s.charCodeAt(0)===103&&s.startsWith("group/")){if(this.variantEnabled.group)r=`.group\\/${s.slice(6)} `;continue}if(s.charCodeAt(0)===112&&s.startsWith("peer-")){if(this.variantEnabled.peer){let{base:u,name:f}=Hr(s.slice(5)),d=f?`.peer\\/${f}`:".peer",h=Gr(u);if(h!==void 0)r=`${d}${h} ~ `}continue}if(s.charCodeAt(0)===112&&s.startsWith("peer/")){if(this.variantEnabled.peer)r=`.peer\\/${s.slice(5)} ~ `;continue}if(s.charCodeAt(0)===104&&s.startsWith("has-")){if(this.variantEnabled.has){let u=s.slice(4);if(u.charCodeAt(0)===91&&u.charCodeAt(u.length-1)===93){let f=u.slice(1,-1);t+=`:has(${f})`}else t+=`:has(:${u})`}continue}if(s.charCodeAt(0)===97&&s.startsWith("aria-")){if(this.variantEnabled.aria){let u=Qe("aria",s.slice(5));if(u!==void 0)t+=u}continue}if(s.charCodeAt(0)===100&&s.startsWith("data-")){if(this.variantEnabled.data){let u=Qe("data",s.slice(5));if(u!==void 0)t+=u}continue}}return r+t}getMediaQuery(e){let t=e.variants,r=t.length;if(r===0)return;let n=r===1?t[0]:t.join(":"),i=this.mediaQueryCache.get(n);if(i!==void 0)return i||void 0;let o=[],s=[],l=[],a=!1;for(let u=0;u<r;u++){let f=t[u],d=f.charCodeAt(0);if(d===91&&f.startsWith("[@media")&&f.endsWith("]")){let m=f.slice(1,-1).replace(/_/g," ").slice(6).trim();if(m)o.push(m);continue}if(d===64){let m=this.containerQuery(f.slice(1));if(m!==void 0)l.push(m);continue}if(d===110&&f.startsWith("not-")){if(this.variantEnabled.not){let m=this.negatableAtRule(f.slice(4));if(m!==void 0)if(m.supports!==void 0)s.push(`@supports not ${m.supports}`);else o.push(`not ${m.media}`)}continue}if(this.darkStrategy==="media"&&(f==="dark"||f==="light")){o.push(`(prefers-color-scheme: ${f})`);continue}if(this.variantEnabled.responsive){let m=this.screenBreakpoints.get(f);if(m){o.push(`(min-width: ${m})`);continue}if(f.startsWith("max-")){let p=this.screenBreakpoints.get(f.slice(4));if(p){let y=p.match(/^([\d.]+)px$/);o.push(y?`(max-width: ${Number.parseFloat(y[1])-0.02}px)`:`not all and (min-width: ${p})`);continue}}}if(f==="starting"){if(this.variantEnabled.starting)a=!0;continue}let h=Ti[f];if(h!==void 0){if(this.variantEnabled[f])o.push(h);continue}let g=Yl[f];if(g!==void 0){if(this.variantEnabled[f])o.push(g);continue}if(f.charCodeAt(0)===115&&f.startsWith("supports-")){if(this.variantEnabled.supports)s.push(`@supports ${Jl(f.slice(9))}`)}}let c=[];if(o.length>0)o.sort((u,f)=>Number(u.charCodeAt(0)===40)-Number(f.charCodeAt(0)===40)),c.push(`@media ${o.join(" and ")}`);if(c.push(...s,...l),a)c.push("@starting-style");if(c.length>0){let u=c.join(Xl);return this.mediaQueryCache.set(n,u),u}this.mediaQueryCache.set(n,"");return}escapeSelector(e){let t=!1;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(!(n>=97&&n<=122||n>=65&&n<=90||n>=48&&n<=57||n===45||n===95||n>127)){t=!0;break}}if(!t)return e;return e.replace(/[\x00-\x2C\x2E\x2F\x3A-\x40\x5B-\x5E\x60\x7B-\x7F]/g,"\\$&")}buildFontCSS(){let e=this.config.fonts;if(!e)return"";let t=[],r=e.google?.filter(Boolean)??[];if(r.length>0){let n=r.map((o)=>`family=${o.trim().replace(/\s+/g,"+")}`).join("&"),i=e.display??"swap";t.push(`@import url('https://fonts.googleapis.com/css2?${n}&display=${i}');`)}if(e.faces?.length)t.push(...e.faces.map((n)=>n.trim()).filter(Boolean));return t.join(`
372
- `)}toCSS(e=!0,t=!1){if(this.cssCache!==null&&this.cssCacheRevision===this.revision&&this.cssCachePreflight===e&&this.cssCacheMinify===t)return this.cssCache;let r=[],n=this.buildFontCSS();if(n)r.push(t?n.replace(/\s*\n\s*/g,""):n);let i=this.config.layers,o=Array.isArray(i)&&i.length>0;if(o)r.push(`@layer ${i.join(", ")};`);if(e)for(let d of this.config.preflights){let h=d.getCSS(),g=this.config.theme?.fontFamily?.sans;if(g&&Array.isArray(g)){let p=g.join(", ");h=h.replace(/font-family:\s*ui-sans-serif[^;]+;/g,`font-family: ${p};`)}let m=`@layer ${d.layer??yb} {
371
+ }`},wb={center:"center",top:"top","top-right":"top right",right:"right","bottom-right":"bottom right",bottom:"bottom","bottom-left":"bottom left",left:"left","top-left":"top left"},$b={"1":"repeat(1, minmax(0, 1fr))","2":"repeat(2, minmax(0, 1fr))","3":"repeat(3, minmax(0, 1fr))","4":"repeat(4, minmax(0, 1fr))","5":"repeat(5, minmax(0, 1fr))","6":"repeat(6, minmax(0, 1fr))","7":"repeat(7, minmax(0, 1fr))","8":"repeat(8, minmax(0, 1fr))","9":"repeat(9, minmax(0, 1fr))","10":"repeat(10, minmax(0, 1fr))","11":"repeat(11, minmax(0, 1fr))","12":"repeat(12, minmax(0, 1fr))",none:"none",subgrid:"subgrid"},Cb={"1":"repeat(1, minmax(0, 1fr))","2":"repeat(2, minmax(0, 1fr))","3":"repeat(3, minmax(0, 1fr))","4":"repeat(4, minmax(0, 1fr))","5":"repeat(5, minmax(0, 1fr))","6":"repeat(6, minmax(0, 1fr))",none:"none",subgrid:"subgrid"},Rb={auto:"auto","span-1":"span 1 / span 1","span-2":"span 2 / span 2","span-3":"span 3 / span 3","span-4":"span 4 / span 4","span-5":"span 5 / span 5","span-6":"span 6 / span 6","span-7":"span 7 / span 7","span-8":"span 8 / span 8","span-9":"span 9 / span 9","span-10":"span 10 / span 10","span-11":"span 11 / span 11","span-12":"span 12 / span 12","span-full":"1 / -1"},kb={auto:"auto","span-1":"span 1 / span 1","span-2":"span 2 / span 2","span-3":"span 3 / span 3","span-4":"span 4 / span 4","span-5":"span 5 / span 5","span-6":"span 6 / span 6","span-full":"1 / -1"},Sb={row:"row",col:"column",dense:"dense","row-dense":"row dense","col-dense":"column dense"},Kl={auto:"auto",min:"min-content",max:"max-content",fr:"minmax(0, 1fr)"},Ai={center:"center",start:"start",end:"end",between:"space-between",around:"space-around",evenly:"space-evenly",stretch:"stretch","center-safe":"safe center","end-safe":"safe end"};function yt(e){return{"--tc-ring-offset-shadow":"var(--tc-ring-inset,) 0 0 0 var(--tc-ring-offset-width, 0px) var(--tc-ring-offset-color, #fff)","--tc-ring-shadow":`var(--tc-ring-inset,) 0 0 0 calc(${e} + var(--tc-ring-offset-width, 0px)) var(--tc-ring-color, currentcolor)`,"box-shadow":V}}var Ab={ring:yt("1px"),"ring-0":yt("0px"),"ring-1":yt("1px"),"ring-2":yt("2px"),"ring-4":yt("4px"),"ring-8":yt("8px"),"ring-inset":{"--tc-ring-inset":"inset"}},cc={"shadow-2xs":{"--tc-shadow":"0 1px rgb(0 0 0 / 0.05)","--tc-shadow-colored":"0 1px var(--tc-shadow-color)","box-shadow":V},"shadow-xs":{"--tc-shadow":"0 1px 2px 0 rgb(0 0 0 / 0.05)","--tc-shadow-colored":"0 1px 2px 0 var(--tc-shadow-color)","box-shadow":V},"shadow-sm":{"--tc-shadow":"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)","--tc-shadow-colored":"0 1px 3px 0 var(--tc-shadow-color), 0 1px 2px -1px var(--tc-shadow-color)","box-shadow":V},shadow:{"--tc-shadow":"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)","--tc-shadow-colored":"0 1px 3px 0 var(--tc-shadow-color), 0 1px 2px -1px var(--tc-shadow-color)","box-shadow":V},"shadow-md":{"--tc-shadow":"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)","--tc-shadow-colored":"0 4px 6px -1px var(--tc-shadow-color), 0 2px 4px -2px var(--tc-shadow-color)","box-shadow":V},"shadow-lg":{"--tc-shadow":"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)","--tc-shadow-colored":"0 10px 15px -3px var(--tc-shadow-color), 0 4px 6px -4px var(--tc-shadow-color)","box-shadow":V},"shadow-xl":{"--tc-shadow":"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)","--tc-shadow-colored":"0 20px 25px -5px var(--tc-shadow-color), 0 8px 10px -6px var(--tc-shadow-color)","box-shadow":V},"shadow-2xl":{"--tc-shadow":"0 25px 50px -12px rgb(0 0 0 / 0.25)","--tc-shadow-colored":"0 25px 50px -12px var(--tc-shadow-color)","box-shadow":V},"shadow-inner":{"--tc-shadow":"inset 0 2px 4px 0 rgb(0 0 0 / 0.05)","--tc-shadow-colored":"inset 0 2px 4px 0 var(--tc-shadow-color)","box-shadow":V},"shadow-none":{"--tc-shadow":"0 0 #0000","box-shadow":V}},uc={"rounded-none":{"border-radius":"0px"},"rounded-xs":{"border-radius":"0.125rem"},"rounded-sm":{"border-radius":"0.25rem"},rounded:{"border-radius":"0.25rem"},"rounded-md":{"border-radius":"0.375rem"},"rounded-lg":{"border-radius":"0.5rem"},"rounded-xl":{"border-radius":"0.75rem"},"rounded-2xl":{"border-radius":"1rem"},"rounded-3xl":{"border-radius":"1.5rem"},"rounded-4xl":{"border-radius":"2rem"},"rounded-full":{"border-radius":"9999px"},"rounded-t-none":{"border-top-left-radius":"0px","border-top-right-radius":"0px"},"rounded-t-sm":{"border-top-left-radius":"0.25rem","border-top-right-radius":"0.25rem"},"rounded-t-lg":{"border-top-left-radius":"0.5rem","border-top-right-radius":"0.5rem"},"rounded-r-lg":{"border-top-right-radius":"0.5rem","border-bottom-right-radius":"0.5rem"},"rounded-b-lg":{"border-bottom-left-radius":"0.5rem","border-bottom-right-radius":"0.5rem"},"rounded-l-lg":{"border-top-left-radius":"0.5rem","border-bottom-left-radius":"0.5rem"},"rounded-tl-lg":{"border-top-left-radius":"0.5rem"},"rounded-tr-lg":{"border-top-right-radius":"0.5rem"},"rounded-br-lg":{"border-bottom-right-radius":"0.5rem"},"rounded-bl-lg":{"border-bottom-left-radius":"0.5rem"}},Eb={border:{"border-width":"1px"},"border-0":{"border-width":"0px"},"border-2":{"border-width":"2px"},"border-4":{"border-width":"4px"},"border-8":{"border-width":"8px"},"border-t":{"border-top-width":"1px"},"border-r":{"border-right-width":"1px"},"border-b":{"border-bottom-width":"1px"},"border-l":{"border-left-width":"1px"},"border-t-0":{"border-top-width":"0px"},"border-r-0":{"border-right-width":"0px"},"border-b-0":{"border-bottom-width":"0px"},"border-l-0":{"border-left-width":"0px"},"border-t-2":{"border-top-width":"2px"},"border-r-2":{"border-right-width":"2px"},"border-b-2":{"border-bottom-width":"2px"},"border-l-2":{"border-left-width":"2px"},"border-t-4":{"border-top-width":"4px"},"border-r-4":{"border-right-width":"4px"},"border-b-4":{"border-bottom-width":"4px"},"border-l-4":{"border-left-width":"4px"},"border-x":{"border-left-width":"1px","border-right-width":"1px"},"border-y":{"border-top-width":"1px","border-bottom-width":"1px"},"border-x-0":{"border-left-width":"0px","border-right-width":"0px"},"border-y-0":{"border-top-width":"0px","border-bottom-width":"0px"},"border-x-2":{"border-left-width":"2px","border-right-width":"2px"},"border-y-2":{"border-top-width":"2px","border-bottom-width":"2px"}},Tb={"ring-offset-0":{"--tc-ring-offset-width":"0px"},"ring-offset-1":{"--tc-ring-offset-width":"1px"},"ring-offset-2":{"--tc-ring-offset-width":"2px"},"ring-offset-4":{"--tc-ring-offset-width":"4px"},"ring-offset-8":{"--tc-ring-offset-width":"8px"}},Nb={"opacity-0":{opacity:"0"},"opacity-5":{opacity:"0.05"},"opacity-10":{opacity:"0.1"},"opacity-20":{opacity:"0.2"},"opacity-25":{opacity:"0.25"},"opacity-30":{opacity:"0.3"},"opacity-40":{opacity:"0.4"},"opacity-50":{opacity:"0.5"},"opacity-60":{opacity:"0.6"},"opacity-70":{opacity:"0.7"},"opacity-75":{opacity:"0.75"},"opacity-80":{opacity:"0.8"},"opacity-90":{opacity:"0.9"},"opacity-95":{opacity:"0.95"},"opacity-100":{opacity:"1"}},Yr={"0":"0",px:"1px","0.5":"0.125rem","1":"0.25rem","1.5":"0.375rem","2":"0.5rem","2.5":"0.625rem","3":"0.75rem","3.5":"0.875rem","4":"1rem","5":"1.25rem","6":"1.5rem","7":"1.75rem","8":"2rem","9":"2.25rem","10":"2.5rem","11":"2.75rem","12":"3rem","14":"3.5rem","16":"4rem","20":"5rem","24":"6rem","28":"7rem","32":"8rem","36":"9rem","40":"10rem","44":"11rem","48":"12rem","52":"13rem","56":"14rem","60":"15rem","64":"16rem","72":"18rem","80":"20rem","96":"24rem"},Gl={...Yr,auto:"auto",full:"100%",screen:"100vw",min:"min-content",max:"max-content",fit:"fit-content",...Ob(6)};function Ob(e){let t={};for(let r=2;r<=e;r++)for(let n=1;n<r;n++)t[`${n}/${r}`]=$e(n,r);return t}var bt={"gray-50":"oklch(98.5% 0.002 247.839)","gray-100":"oklch(96.7% 0.003 264.542)","gray-200":"oklch(92.8% 0.006 264.531)","gray-300":"oklch(87.2% 0.01 258.338)","gray-400":"oklch(70.7% 0.022 261.325)","gray-500":"oklch(55.1% 0.027 264.364)","gray-600":"oklch(44.6% 0.03 256.802)","gray-700":"oklch(37.3% 0.034 259.733)","gray-800":"oklch(27.8% 0.033 256.848)","gray-900":"oklch(21% 0.034 264.665)","gray-950":"oklch(13% 0.028 261.692)","red-50":"oklch(97.1% 0.013 17.38)","red-100":"oklch(93.6% 0.032 17.717)","red-200":"oklch(88.5% 0.062 18.334)","red-300":"oklch(80.8% 0.114 19.571)","red-400":"oklch(70.4% 0.191 22.216)","red-500":"oklch(63.7% 0.237 25.331)","red-600":"oklch(57.7% 0.245 27.325)","red-700":"oklch(50.5% 0.213 27.518)","red-800":"oklch(44.4% 0.177 26.899)","red-900":"oklch(39.6% 0.141 25.723)","red-950":"oklch(25.8% 0.092 26.042)","blue-50":"oklch(97% 0.014 254.604)","blue-100":"oklch(93.2% 0.032 255.585)","blue-200":"oklch(88.2% 0.059 254.128)","blue-300":"oklch(80.9% 0.105 251.813)","blue-400":"oklch(70.7% 0.165 254.624)","blue-500":"oklch(62.3% 0.214 259.815)","blue-600":"oklch(54.6% 0.245 262.881)","blue-700":"oklch(48.8% 0.243 264.376)","blue-800":"oklch(42.4% 0.199 265.638)","blue-900":"oklch(37.9% 0.146 265.522)","blue-950":"oklch(28.2% 0.091 267.935)","green-50":"oklch(98.2% 0.018 155.826)","green-100":"oklch(96.2% 0.044 156.743)","green-200":"oklch(92.5% 0.084 155.995)","green-300":"oklch(87.1% 0.15 154.449)","green-400":"oklch(79.2% 0.209 151.711)","green-500":"oklch(72.3% 0.219 149.579)","green-600":"oklch(62.7% 0.194 149.214)","green-700":"oklch(52.7% 0.154 150.069)","green-800":"oklch(44.8% 0.119 151.328)","green-900":"oklch(39.3% 0.095 152.535)","green-950":"oklch(26.6% 0.065 152.934)","yellow-50":"oklch(98.7% 0.026 102.212)","yellow-100":"oklch(97.3% 0.071 103.193)","yellow-200":"oklch(94.5% 0.129 101.54)","yellow-300":"oklch(90.5% 0.182 98.111)","yellow-400":"oklch(85.2% 0.199 91.936)","yellow-500":"oklch(79.5% 0.184 86.047)","yellow-600":"oklch(68.1% 0.162 75.834)","yellow-700":"oklch(55.4% 0.135 66.442)","yellow-800":"oklch(47.6% 0.114 61.907)","yellow-900":"oklch(42.1% 0.095 57.708)","yellow-950":"oklch(28.6% 0.066 53.813)","purple-50":"oklch(97.7% 0.014 308.299)","purple-100":"oklch(94.6% 0.033 307.174)","purple-200":"oklch(90.2% 0.063 306.703)","purple-300":"oklch(82.7% 0.119 306.383)","purple-400":"oklch(71.4% 0.203 305.504)","purple-500":"oklch(62.7% 0.265 303.9)","purple-600":"oklch(55.8% 0.288 302.321)","purple-700":"oklch(49.6% 0.265 301.924)","purple-800":"oklch(43.8% 0.218 303.724)","purple-900":"oklch(38.1% 0.176 304.987)","purple-950":"oklch(29.1% 0.149 302.717)","pink-50":"oklch(97.1% 0.014 343.198)","pink-100":"oklch(94.8% 0.028 342.258)","pink-200":"oklch(89.9% 0.061 343.231)","pink-300":"oklch(82.3% 0.12 346.018)","pink-400":"oklch(71.8% 0.202 349.761)","pink-500":"oklch(65.6% 0.241 354.308)","pink-600":"oklch(59.2% 0.249 0.584)","pink-700":"oklch(52.5% 0.223 3.958)","pink-800":"oklch(45.9% 0.187 3.815)","pink-900":"oklch(40.8% 0.153 2.432)","pink-950":"oklch(28.4% 0.109 3.907)","indigo-50":"oklch(96.2% 0.018 272.314)","indigo-100":"oklch(93% 0.034 272.788)","indigo-200":"oklch(87% 0.065 274.039)","indigo-300":"oklch(78.5% 0.115 274.713)","indigo-400":"oklch(67.3% 0.182 276.935)","indigo-500":"oklch(58.5% 0.233 277.117)","indigo-600":"oklch(51.1% 0.262 276.966)","indigo-700":"oklch(45.7% 0.24 277.023)","indigo-800":"oklch(39.8% 0.195 277.366)","indigo-900":"oklch(35.9% 0.144 278.697)","indigo-950":"oklch(25.7% 0.09 281.288)","cyan-50":"oklch(98.4% 0.019 200.873)","cyan-100":"oklch(95.6% 0.045 203.388)","cyan-200":"oklch(91.7% 0.08 205.041)","cyan-300":"oklch(86.5% 0.127 207.078)","cyan-400":"oklch(78.9% 0.154 211.53)","cyan-500":"oklch(71.5% 0.143 215.221)","cyan-600":"oklch(60.9% 0.126 221.723)","cyan-700":"oklch(52% 0.105 223.128)","cyan-800":"oklch(45% 0.085 224.283)","cyan-900":"oklch(39.8% 0.07 227.392)","cyan-950":"oklch(30.2% 0.056 229.695)","emerald-50":"oklch(97.9% 0.021 166.113)","emerald-100":"oklch(95% 0.052 163.051)","emerald-200":"oklch(90.5% 0.093 164.15)","emerald-300":"oklch(84.5% 0.143 164.978)","emerald-400":"oklch(76.5% 0.177 163.223)","emerald-500":"oklch(69.6% 0.17 162.48)","emerald-600":"oklch(59.6% 0.145 163.225)","emerald-700":"oklch(50.8% 0.118 165.612)","emerald-800":"oklch(43.2% 0.095 166.913)","emerald-900":"oklch(37.8% 0.077 168.94)","emerald-950":"oklch(26.2% 0.051 172.552)",white:"#fff",black:"#000",transparent:"transparent",current:"currentColor"},Ib={"font-thin":{"font-weight":"100"},"font-extralight":{"font-weight":"200"},"font-light":{"font-weight":"300"},"font-normal":{"font-weight":"400"},"font-medium":{"font-weight":"500"},"font-semibold":{"font-weight":"600"},"font-bold":{"font-weight":"700"},"font-extrabold":{"font-weight":"800"},"font-black":{"font-weight":"900"}},Pb={italic:{"font-style":"italic"},"not-italic":{"font-style":"normal"}},_b={uppercase:{"text-transform":"uppercase"},lowercase:{"text-transform":"lowercase"},capitalize:{"text-transform":"capitalize"},"normal-case":{"text-transform":"none"}},Lb={underline:{"text-decoration-line":"underline"},overline:{"text-decoration-line":"overline"},"line-through":{"text-decoration-line":"line-through"},"no-underline":{"text-decoration-line":"none"}},Mb={"decoration-solid":{"text-decoration-style":"solid"},"decoration-double":{"text-decoration-style":"double"},"decoration-dotted":{"text-decoration-style":"dotted"},"decoration-dashed":{"text-decoration-style":"dashed"},"decoration-wavy":{"text-decoration-style":"wavy"}},Fb={"text-left":{"text-align":"left"},"text-center":{"text-align":"center"},"text-right":{"text-align":"right"},"text-justify":{"text-align":"justify"},"text-start":{"text-align":"start"},"text-end":{"text-align":"end"}},jb={truncate:{overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"},"text-ellipsis":{"text-overflow":"ellipsis"},"text-clip":{"text-overflow":"clip"}},Db={"text-wrap":{"text-wrap":"wrap"},"text-nowrap":{"text-wrap":"nowrap"},"text-balance":{"text-wrap":"balance"},"text-pretty":{"text-wrap":"pretty"}},Bb={"whitespace-normal":{"white-space":"normal"},"whitespace-nowrap":{"white-space":"nowrap"},"whitespace-pre":{"white-space":"pre"},"whitespace-pre-line":{"white-space":"pre-line"},"whitespace-pre-wrap":{"white-space":"pre-wrap"},"whitespace-break-spaces":{"white-space":"break-spaces"}},Ub={"break-normal":{"overflow-wrap":"normal","word-break":"normal"},"break-words":{"overflow-wrap":"break-word"},"break-all":{"word-break":"break-all"},"break-keep":{"word-break":"keep-all"}},Vb={"align-baseline":{"vertical-align":"baseline"},"align-top":{"vertical-align":"top"},"align-middle":{"vertical-align":"middle"},"align-bottom":{"vertical-align":"bottom"},"align-text-top":{"vertical-align":"text-top"},"align-text-bottom":{"vertical-align":"text-bottom"},"align-sub":{"vertical-align":"sub"},"align-super":{"vertical-align":"super"}},Wb={"list-none":{"list-style-type":"none"},"list-disc":{"list-style-type":"disc"},"list-decimal":{"list-style-type":"decimal"},"list-inside":{"list-style-position":"inside"},"list-outside":{"list-style-position":"outside"}},zb={"hyphens-none":{hyphens:"none"},"hyphens-manual":{hyphens:"manual"},"hyphens-auto":{hyphens:"auto"}},Kb={static:{position:"static"},fixed:{position:"fixed"},absolute:{position:"absolute"},relative:{position:"relative"},sticky:{position:"sticky"}},Gb={visible:{visibility:"visible"},invisible:{visibility:"hidden"},collapse:{visibility:"collapse"}},Hb={"float-left":{float:"left"},"float-right":{float:"right"},"float-none":{float:"none"},"float-start":{float:"inline-start"},"float-end":{float:"inline-end"}},qb={"clear-left":{clear:"left"},"clear-right":{clear:"right"},"clear-both":{clear:"both"},"clear-none":{clear:"none"},"clear-start":{clear:"inline-start"},"clear-end":{clear:"inline-end"}},Yb={isolate:{isolation:"isolate"},"isolation-auto":{isolation:"auto"}},Jb={"object-contain":{"object-fit":"contain"},"object-cover":{"object-fit":"cover"},"object-fill":{"object-fit":"fill"},"object-none":{"object-fit":"none"},"object-scale-down":{"object-fit":"scale-down"}},Xb={"object-bottom":{"object-position":"bottom"},"object-center":{"object-position":"center"},"object-left":{"object-position":"left"},"object-left-bottom":{"object-position":"left bottom"},"object-left-top":{"object-position":"left top"},"object-right":{"object-position":"right"},"object-right-bottom":{"object-position":"right bottom"},"object-right-top":{"object-position":"right top"},"object-top":{"object-position":"top"}},Zb={"overflow-auto":{overflow:"auto"},"overflow-hidden":{overflow:"hidden"},"overflow-clip":{overflow:"clip"},"overflow-ellipsis":{"text-overflow":"ellipsis"},"overflow-visible":{overflow:"visible"},"overflow-scroll":{overflow:"scroll"},"overflow-x-auto":{"overflow-x":"auto"},"overflow-x-hidden":{"overflow-x":"hidden"},"overflow-x-clip":{"overflow-x":"clip"},"overflow-x-visible":{"overflow-x":"visible"},"overflow-x-scroll":{"overflow-x":"scroll"},"overflow-y-auto":{"overflow-y":"auto"},"overflow-y-hidden":{"overflow-y":"hidden"},"overflow-y-clip":{"overflow-y":"clip"},"overflow-y-visible":{"overflow-y":"visible"},"overflow-y-scroll":{"overflow-y":"scroll"}},Qb={"overscroll-auto":{"overscroll-behavior":"auto"},"overscroll-contain":{"overscroll-behavior":"contain"},"overscroll-none":{"overscroll-behavior":"none"},"overscroll-x-auto":{"overscroll-behavior-x":"auto"},"overscroll-x-contain":{"overscroll-behavior-x":"contain"},"overscroll-x-none":{"overscroll-behavior-x":"none"},"overscroll-y-auto":{"overscroll-behavior-y":"auto"},"overscroll-y-contain":{"overscroll-behavior-y":"contain"},"overscroll-y-none":{"overscroll-behavior-y":"none"}},e0={"z-0":{"z-index":"0"},"z-10":{"z-index":"10"},"z-20":{"z-index":"20"},"z-30":{"z-index":"30"},"z-40":{"z-index":"40"},"z-50":{"z-index":"50"},"z-auto":{"z-index":"auto"}},t0={"aspect-auto":{"aspect-ratio":"auto"},"aspect-square":{"aspect-ratio":"1 / 1"},"aspect-video":{"aspect-ratio":"16 / 9"}},r0={"box-border":{"box-sizing":"border-box"},"box-content":{"box-sizing":"content-box"}},n0={"box-decoration-clone":{"box-decoration-break":"clone"},"box-decoration-slice":{"box-decoration-break":"slice"}},i0={"bg-fixed":{"background-attachment":"fixed"},"bg-local":{"background-attachment":"local"},"bg-scroll":{"background-attachment":"scroll"}},o0={"bg-clip-border":{"background-clip":"border-box"},"bg-clip-padding":{"background-clip":"padding-box"},"bg-clip-content":{"background-clip":"content-box"},"bg-clip-text":{"background-clip":"text","-webkit-background-clip":"text"}},s0={"bg-origin-border":{"background-origin":"border-box"},"bg-origin-padding":{"background-origin":"padding-box"},"bg-origin-content":{"background-origin":"content-box"}},a0={"bg-bottom":{"background-position":"bottom"},"bg-center":{"background-position":"center"},"bg-left":{"background-position":"left"},"bg-left-bottom":{"background-position":"left bottom"},"bg-left-top":{"background-position":"left top"},"bg-right":{"background-position":"right"},"bg-right-bottom":{"background-position":"right bottom"},"bg-right-top":{"background-position":"right top"},"bg-top":{"background-position":"top"}},l0={"bg-repeat":{"background-repeat":"repeat"},"bg-no-repeat":{"background-repeat":"no-repeat"},"bg-repeat-x":{"background-repeat":"repeat-x"},"bg-repeat-y":{"background-repeat":"repeat-y"},"bg-repeat-round":{"background-repeat":"round"},"bg-repeat-space":{"background-repeat":"space"}},c0={"bg-auto":{"background-size":"auto"},"bg-cover":{"background-size":"cover"},"bg-contain":{"background-size":"contain"}},u0={"bg-none":{"background-image":"none"},"bg-gradient-to-t":{"background-image":"linear-gradient(to top, var(--tc-gradient-stops))"},"bg-gradient-to-tr":{"background-image":"linear-gradient(to top right, var(--tc-gradient-stops))"},"bg-gradient-to-r":{"background-image":"linear-gradient(to right, var(--tc-gradient-stops))"},"bg-gradient-to-br":{"background-image":"linear-gradient(to bottom right, var(--tc-gradient-stops))"},"bg-gradient-to-b":{"background-image":"linear-gradient(to bottom, var(--tc-gradient-stops))"},"bg-gradient-to-bl":{"background-image":"linear-gradient(to bottom left, var(--tc-gradient-stops))"},"bg-gradient-to-l":{"background-image":"linear-gradient(to left, var(--tc-gradient-stops))"},"bg-gradient-to-tl":{"background-image":"linear-gradient(to top left, var(--tc-gradient-stops))"},"bg-radial":{"background-image":"radial-gradient(var(--tc-gradient-stops))"},"bg-radial-at-t":{"background-image":"radial-gradient(at top, var(--tc-gradient-stops))"},"bg-radial-at-tr":{"background-image":"radial-gradient(at top right, var(--tc-gradient-stops))"},"bg-radial-at-r":{"background-image":"radial-gradient(at right, var(--tc-gradient-stops))"},"bg-radial-at-br":{"background-image":"radial-gradient(at bottom right, var(--tc-gradient-stops))"},"bg-radial-at-b":{"background-image":"radial-gradient(at bottom, var(--tc-gradient-stops))"},"bg-radial-at-bl":{"background-image":"radial-gradient(at bottom left, var(--tc-gradient-stops))"},"bg-radial-at-l":{"background-image":"radial-gradient(at left, var(--tc-gradient-stops))"},"bg-radial-at-tl":{"background-image":"radial-gradient(at top left, var(--tc-gradient-stops))"},"bg-radial-at-c":{"background-image":"radial-gradient(at center, var(--tc-gradient-stops))"},"bg-conic":{"background-image":"conic-gradient(var(--tc-gradient-stops))"},"bg-conic-from-t":{"background-image":"conic-gradient(from 0deg at center, var(--tc-gradient-stops))"},"bg-conic-from-tr":{"background-image":"conic-gradient(from 45deg at center, var(--tc-gradient-stops))"},"bg-conic-from-r":{"background-image":"conic-gradient(from 90deg at center, var(--tc-gradient-stops))"},"bg-conic-from-br":{"background-image":"conic-gradient(from 135deg at center, var(--tc-gradient-stops))"},"bg-conic-from-b":{"background-image":"conic-gradient(from 180deg at center, var(--tc-gradient-stops))"},"bg-conic-from-bl":{"background-image":"conic-gradient(from 225deg at center, var(--tc-gradient-stops))"},"bg-conic-from-l":{"background-image":"conic-gradient(from 270deg at center, var(--tc-gradient-stops))"},"bg-conic-from-tl":{"background-image":"conic-gradient(from 315deg at center, var(--tc-gradient-stops))"}},f0={"content-none":{content:"none"},"content-empty":{content:'""'}},d0={"scrollbar-auto":{"scrollbar-width":"auto"},"scrollbar-thin":{"scrollbar-width":"thin"},"scrollbar-none":{"scrollbar-width":"none"}},h0={"cursor-auto":{cursor:"auto"},"cursor-default":{cursor:"default"},"cursor-pointer":{cursor:"pointer"},"cursor-wait":{cursor:"wait"},"cursor-text":{cursor:"text"},"cursor-move":{cursor:"move"},"cursor-help":{cursor:"help"},"cursor-not-allowed":{cursor:"not-allowed"},"cursor-none":{cursor:"none"},"cursor-context-menu":{cursor:"context-menu"},"cursor-progress":{cursor:"progress"},"cursor-cell":{cursor:"cell"},"cursor-crosshair":{cursor:"crosshair"},"cursor-vertical-text":{cursor:"vertical-text"},"cursor-alias":{cursor:"alias"},"cursor-copy":{cursor:"copy"},"cursor-no-drop":{cursor:"no-drop"},"cursor-grab":{cursor:"grab"},"cursor-grabbing":{cursor:"grabbing"},"cursor-all-scroll":{cursor:"all-scroll"},"cursor-col-resize":{cursor:"col-resize"},"cursor-row-resize":{cursor:"row-resize"},"cursor-n-resize":{cursor:"n-resize"},"cursor-e-resize":{cursor:"e-resize"},"cursor-s-resize":{cursor:"s-resize"},"cursor-w-resize":{cursor:"w-resize"},"cursor-ne-resize":{cursor:"ne-resize"},"cursor-nw-resize":{cursor:"nw-resize"},"cursor-se-resize":{cursor:"se-resize"},"cursor-sw-resize":{cursor:"sw-resize"},"cursor-ew-resize":{cursor:"ew-resize"},"cursor-ns-resize":{cursor:"ns-resize"},"cursor-nesw-resize":{cursor:"nesw-resize"},"cursor-nwse-resize":{cursor:"nwse-resize"},"cursor-zoom-in":{cursor:"zoom-in"},"cursor-zoom-out":{cursor:"zoom-out"}},g0={"pointer-events-none":{"pointer-events":"none"},"pointer-events-auto":{"pointer-events":"auto"}},m0={"resize-none":{resize:"none"},"resize-y":{resize:"vertical"},"resize-x":{resize:"horizontal"},resize:{resize:"both"}},p0={"select-none":{"user-select":"none"},"select-text":{"user-select":"text"},"select-all":{"user-select":"all"},"select-auto":{"user-select":"auto"}},y0={"scroll-auto":{"scroll-behavior":"auto"},"scroll-smooth":{"scroll-behavior":"smooth"}},b0={"snap-none":{"scroll-snap-type":"none"},"snap-x":{"scroll-snap-type":"x var(--tc-scroll-snap-strictness, proximity)"},"snap-y":{"scroll-snap-type":"y var(--tc-scroll-snap-strictness, proximity)"},"snap-both":{"scroll-snap-type":"both var(--tc-scroll-snap-strictness, proximity)"},"snap-mandatory":{"--tc-scroll-snap-strictness":"mandatory"},"snap-proximity":{"--tc-scroll-snap-strictness":"proximity"},"snap-start":{"scroll-snap-align":"start"},"snap-end":{"scroll-snap-align":"end"},"snap-center":{"scroll-snap-align":"center"},"snap-align-none":{"scroll-snap-align":"none"},"snap-normal":{"scroll-snap-stop":"normal"},"snap-always":{"scroll-snap-stop":"always"}},Ze="var(--tc-pan-x,) var(--tc-pan-y,) var(--tc-pinch-zoom,)",x0={"touch-auto":{"touch-action":"auto"},"touch-none":{"touch-action":"none"},"touch-pan-x":{"--tc-pan-x":"pan-x","touch-action":Ze},"touch-pan-left":{"--tc-pan-x":"pan-left","touch-action":Ze},"touch-pan-right":{"--tc-pan-x":"pan-right","touch-action":Ze},"touch-pan-y":{"--tc-pan-y":"pan-y","touch-action":Ze},"touch-pan-up":{"--tc-pan-y":"pan-up","touch-action":Ze},"touch-pan-down":{"--tc-pan-y":"pan-down","touch-action":Ze},"touch-pinch-zoom":{"--tc-pinch-zoom":"pinch-zoom","touch-action":Ze},"touch-manipulation":{"touch-action":"manipulation"}},v0={"will-change-auto":{"will-change":"auto"},"will-change-scroll":{"will-change":"scroll-position"},"will-change-contents":{"will-change":"contents"},"will-change-transform":{"will-change":"transform"}},w0={"appearance-none":{appearance:"none"},"appearance-auto":{appearance:"auto"}},$0={"border-collapse":{"border-collapse":"collapse"},"border-separate":{"border-collapse":"separate"}},C0={"table-auto":{"table-layout":"auto"},"table-fixed":{"table-layout":"fixed"}},R0={"caption-top":{"caption-side":"top"},"caption-bottom":{"caption-side":"bottom"}},k0={"sr-only":{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)","white-space":"nowrap","border-width":"0"},"not-sr-only":{position:"static",width:"auto",height:"auto",padding:"0",margin:"0",overflow:"visible",clip:"auto","white-space":"normal"}},S0={"forced-color-adjust-auto":{"forced-color-adjust":"auto"},"forced-color-adjust-none":{"forced-color-adjust":"none"}},A0={"fill-none":{fill:"none"},"fill-current":{fill:"currentColor"},"fill-inherit":{fill:"inherit"}},E0={"stroke-none":{stroke:"none"},"stroke-current":{stroke:"currentColor"},"stroke-inherit":{stroke:"inherit"},"stroke-0":{"stroke-width":"0"},"stroke-1":{"stroke-width":"1"},"stroke-2":{"stroke-width":"2"}},T0={"stroke-linecap-butt":{"stroke-linecap":"butt"},"stroke-linecap-round":{"stroke-linecap":"round"},"stroke-linecap-square":{"stroke-linecap":"square"}},N0={"stroke-linejoin-miter":{"stroke-linejoin":"miter"},"stroke-linejoin-round":{"stroke-linejoin":"round"},"stroke-linejoin-bevel":{"stroke-linejoin":"bevel"}},O0=["blur","brightness","contrast","grayscale","hue-rotate","invert","saturate","sepia","drop-shadow"],I0=["blur","brightness","contrast","grayscale","hue-rotate","invert","opacity","saturate","sepia"],P0=O0.map((e)=>`var(--tc-${e}, )`).join(" "),Hl=I0.map((e)=>`var(--tc-backdrop-${e}, )`).join(" ");function De(e){return`var(--tc-drop-shadow-color, ${e})`}function F(e,t){return{[`--tc-${e}`]:t,filter:P0}}function ie(e,t){return{[`--tc-backdrop-${e}`]:t,"-webkit-backdrop-filter":Hl,"backdrop-filter":Hl}}var _0={"blur-none":F("blur","blur(0)"),"blur-xs":F("blur","blur(4px)"),"blur-sm":F("blur","blur(8px)"),blur:F("blur","blur(8px)"),"blur-md":F("blur","blur(12px)"),"blur-lg":F("blur","blur(16px)"),"blur-xl":F("blur","blur(24px)"),"blur-2xl":F("blur","blur(40px)"),"blur-3xl":F("blur","blur(64px)")},L0={"backdrop-blur-none":ie("blur","blur(0)"),"backdrop-blur-xs":ie("blur","blur(4px)"),"backdrop-blur-sm":ie("blur","blur(8px)"),"backdrop-blur":ie("blur","blur(8px)"),"backdrop-blur-md":ie("blur","blur(12px)"),"backdrop-blur-lg":ie("blur","blur(16px)"),"backdrop-blur-xl":ie("blur","blur(24px)"),"backdrop-blur-2xl":ie("blur","blur(40px)"),"backdrop-blur-3xl":ie("blur","blur(64px)")},M0={"grayscale-0":F("grayscale","grayscale(0)"),grayscale:F("grayscale","grayscale(100%)"),"invert-0":F("invert","invert(0)"),invert:F("invert","invert(100%)"),"sepia-0":F("sepia","sepia(0)"),sepia:F("sepia","sepia(100%)")},F0={"backdrop-grayscale-0":ie("grayscale","grayscale(0)"),"backdrop-grayscale":ie("grayscale","grayscale(100%)"),"backdrop-invert-0":ie("invert","invert(0)"),"backdrop-invert":ie("invert","invert(100%)"),"backdrop-sepia-0":ie("sepia","sepia(0)"),"backdrop-sepia":ie("sepia","sepia(100%)")},j0={"drop-shadow-xs":F("drop-shadow",`drop-shadow(0 1px 1px ${De("rgb(0 0 0 / 0.05)")})`),"drop-shadow-sm":F("drop-shadow",`drop-shadow(0 1px 2px ${De("rgb(0 0 0 / 0.15)")})`),"drop-shadow":F("drop-shadow",`drop-shadow(0 1px 2px ${De("rgb(0 0 0 / 0.1)")}) drop-shadow(0 1px 1px ${De("rgb(0 0 0 / 0.06)")})`),"drop-shadow-md":F("drop-shadow",`drop-shadow(0 3px 3px ${De("rgb(0 0 0 / 0.12)")})`),"drop-shadow-lg":F("drop-shadow",`drop-shadow(0 4px 4px ${De("rgb(0 0 0 / 0.15)")})`),"drop-shadow-xl":F("drop-shadow",`drop-shadow(0 9px 7px ${De("rgb(0 0 0 / 0.1)")})`),"drop-shadow-2xl":F("drop-shadow",`drop-shadow(0 25px 25px ${De("rgb(0 0 0 / 0.15)")})`),"drop-shadow-none":F("drop-shadow","drop-shadow(0 0 #0000)")},D0={"mix-blend-normal":{"mix-blend-mode":"normal"},"mix-blend-multiply":{"mix-blend-mode":"multiply"},"mix-blend-screen":{"mix-blend-mode":"screen"},"mix-blend-overlay":{"mix-blend-mode":"overlay"},"mix-blend-darken":{"mix-blend-mode":"darken"},"mix-blend-lighten":{"mix-blend-mode":"lighten"},"mix-blend-color-dodge":{"mix-blend-mode":"color-dodge"},"mix-blend-color-burn":{"mix-blend-mode":"color-burn"},"mix-blend-hard-light":{"mix-blend-mode":"hard-light"},"mix-blend-soft-light":{"mix-blend-mode":"soft-light"},"mix-blend-difference":{"mix-blend-mode":"difference"},"mix-blend-exclusion":{"mix-blend-mode":"exclusion"},"mix-blend-hue":{"mix-blend-mode":"hue"},"mix-blend-saturation":{"mix-blend-mode":"saturation"},"mix-blend-color":{"mix-blend-mode":"color"},"mix-blend-luminosity":{"mix-blend-mode":"luminosity"},"mix-blend-plus-darker":{"mix-blend-mode":"plus-darker"},"mix-blend-plus-lighter":{"mix-blend-mode":"plus-lighter"}},B0={"bg-blend-normal":{"background-blend-mode":"normal"},"bg-blend-multiply":{"background-blend-mode":"multiply"},"bg-blend-screen":{"background-blend-mode":"screen"},"bg-blend-overlay":{"background-blend-mode":"overlay"},"bg-blend-darken":{"background-blend-mode":"darken"},"bg-blend-lighten":{"background-blend-mode":"lighten"},"bg-blend-color-dodge":{"background-blend-mode":"color-dodge"},"bg-blend-color-burn":{"background-blend-mode":"color-burn"},"bg-blend-hard-light":{"background-blend-mode":"hard-light"},"bg-blend-soft-light":{"background-blend-mode":"soft-light"},"bg-blend-difference":{"background-blend-mode":"difference"},"bg-blend-exclusion":{"background-blend-mode":"exclusion"},"bg-blend-hue":{"background-blend-mode":"hue"},"bg-blend-saturation":{"background-blend-mode":"saturation"},"bg-blend-color":{"background-blend-mode":"color"},"bg-blend-luminosity":{"background-blend-mode":"luminosity"}},U0={...nb,...ib,...ob,...sb,...ab,...db,...hb,...gb,...mb,...pb,...Ab,...cc,...uc,...Eb,...Tb,...Nb,...Ib,...Pb,..._b,...Lb,...Mb,...Fb,...jb,...Db,...Bb,...Ub,...Vb,...Wb,...zb,...Kb,...Gb,...Hb,...qb,...Yb,...Jb,...Xb,...Zb,...Qb,...e0,...t0,...r0,...n0,...i0,...o0,...s0,...a0,...l0,...c0,...u0,...h0,...g0,...m0,...p0,...y0,...b0,...x0,...v0,...w0,...$0,...C0,...R0,...k0,...S0,...A0,...E0,...T0,...N0,..._0,...L0,...M0,...F0,...j0,...D0,...B0,...f0,...d0},Mt={hover:":hover",focus:":focus",active:":active",disabled:":disabled",visited:":visited",checked:":checked","focus-within":":focus-within","focus-visible":":focus-visible",first:":first-child",last:":last-child",odd:":nth-child(odd)",even:":nth-child(even)","first-of-type":":first-of-type","last-of-type":":last-of-type",before:"::before",after:"::after",marker:"::marker",placeholder:"::placeholder",selection:"::selection",file:"::file-selector-button","first-letter":"::first-letter","first-line":"::first-line",backdrop:"::backdrop","details-content":"::details-content",required:":required",valid:":valid",invalid:":invalid","read-only":":read-only",autofill:":autofill","user-valid":":user-valid","user-invalid":":user-invalid","in-range":":in-range","out-of-range":":out-of-range","placeholder-shown":":placeholder-shown",open:":is([open], :popover-open, :open)",closed:":not(:is([open], :popover-open, :open))",empty:":empty",enabled:":enabled",only:":only-child","only-of-type":":only-of-type",target:":target",indeterminate:":indeterminate",default:":default",optional:":optional",inert:":is([inert], [inert] *)"};function ql(e){if(!e)return;if(e.charCodeAt(0)===91&&e.charCodeAt(e.length-1)===93){let n=e.slice(1,-1).replace(/_/g," ").trim();return n?`:is(${n})`:void 0}let t=Mt[e];if(t!==void 0)return t.startsWith("::")?void 0:t;let r=Oi(e);if(r!==void 0)return r;if(e.startsWith("has-")){let n=e.slice(4);if(!n)return;return n.charCodeAt(0)===91&&n.charCodeAt(n.length-1)===93?`:has(${n.slice(1,-1)})`:`:has(:${n})`}if(e.startsWith("aria-")||e.startsWith("data-"))return Qe(e.slice(0,4),e.slice(5));if(e.startsWith("in-")){let n=Ii(e.slice(3));return n===void 0?void 0:`:where(${n}) *`}return}var Ei=[["nth-last-of-type-","nth-last-of-type"],["nth-of-type-","nth-of-type"],["nth-last-","nth-last-child"],["nth-","nth-child"]];function Oi(e){for(let t=0;t<Ei.length;t++){let r=Ei[t][0];if(!e.startsWith(r))continue;let n=Ei[t][1],i=e.slice(r.length);if(i.charCodeAt(0)===91&&i.charCodeAt(i.length-1)===93){let o=i.slice(1,-1).replace(/_/g," ").trim();return o?`:${n}(${o})`:void 0}return/^\d+$/.test(i)?`:${n}(${i})`:void 0}return}function Ii(e){if(!e)return;if(e.charCodeAt(0)===91&&e.charCodeAt(e.length-1)===93){let r=e.slice(1,-1).replace(/_/g," ").trim();if(!r)return;return r.includes("&")?r.replace(/&/g,"*"):`:is(${r})`}if(e.startsWith("data-"))return Qe("data",e.slice(5));if(e.startsWith("aria-"))return Qe("aria",e.slice(5));let t=Mt[e];return t!==void 0&&!t.startsWith("::")?t:void 0}var V0=/^([^~|^$*=\s]+)([~|^$*]?=)([\s\S]*)$/,W0=/\s+([is])$/i;function z0(e){let t=V0.exec(e);if(t===null)return e;let r=t[1],n=t[2],i=t[3],o="",s=W0.exec(i);if(s!==null)o=` ${s[1]}`,i=i.slice(0,s.index);let l=i.length>1&&(i.charCodeAt(0)===34||i.charCodeAt(0)===39)&&i.charCodeAt(i.length-1)===i.charCodeAt(0)?i:`"${i.replace(/["\\]/g,"\\$&")}"`;return`${r}${n}${l}${o}`}function Qe(e,t){if(!t)return;if(t.charCodeAt(0)===91&&t.charCodeAt(t.length-1)===93){let r=t.slice(1,-1).replace(/_/g," ").trim();return r?`[${e}-${z0(r)}]`:void 0}return e==="aria"?`[aria-${t}="true"]`:`[data-${t}]`}function Gr(e){if(!e)return;if(e.startsWith("has-")){let r=e.slice(4);if(!r)return;return r.charCodeAt(0)===91&&r.charCodeAt(r.length-1)===93?`:has(${r.slice(1,-1)})`:`:has(:${r})`}if(e.charCodeAt(0)===91&&e.charCodeAt(e.length-1)===93){let r=e.slice(1,-1).replace(/_/g," ").trim();if(!r)return;return r.includes("&")?r.replace(/&/g,""):`:is(${r})`}if(e.startsWith("data-"))return Qe("data",e.slice(5));if(e.startsWith("aria-"))return Qe("aria",e.slice(5));let t=Mt[e];return t!==void 0&&!t.startsWith("::")?t:void 0}function Hr(e){let t=0,r=-1;for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);if(i===91||i===40)t++;else if(i===93||i===41)t--;else if(i===47&&t===0)r=n}if(r===-1)return{base:e,name:""};return{base:e.slice(0,r),name:e.slice(r+1)}}function qr(e){return Rn(e).css}var Ti={"pointer-none":"(pointer: none)","pointer-coarse":"(pointer: coarse)","pointer-fine":"(pointer: fine)","any-pointer-none":"(any-pointer: none)","any-pointer-coarse":"(any-pointer: coarse)","any-pointer-fine":"(any-pointer: fine)","inverted-colors":"(inverted-colors: inverted)",noscript:"(scripting: none)"},Yl={print:"print","motion-safe":"(prefers-reduced-motion: no-preference)","motion-reduce":"(prefers-reduced-motion: reduce)","contrast-more":"(prefers-contrast: more)","contrast-less":"(prefers-contrast: less)",landscape:"(orientation: landscape)",portrait:"(orientation: portrait)","forced-colors":"(forced-colors: active)"};function Jl(e){if(e.charCodeAt(0)===91&&e.charCodeAt(e.length-1)===93){let t=e.slice(1,-1).replace(/_/g," "),r=t.indexOf(":");if(r!==-1)return`(${t.slice(0,r).trim()}: ${t.slice(r+1).trim()})`;return`(${t})`}return`(${e})`}function K0(e){let t=0;for(let r=e.length-1;r>=0;r--){let n=e.charCodeAt(r);if(n===93)t++;else if(n===91)t--;else if(n===47&&t===0)return{size:e.slice(0,r),name:e.slice(r+1)}}return{size:e}}var Xl="\x01",Zl={dark:".dark ",light:".light "},Ql={rtl:':is([dir="rtl"], [dir="rtl"] *)',ltr:':is([dir="ltr"], [dir="ltr"] *)'},ec=new WeakMap,tc=new WeakMap,rc=new WeakMap,nc=new WeakMap,ic=new WeakMap,oc=new WeakMap,sc=new WeakMap;function G0(e){let t=tc.get(e);if(t)return t;let r=!1;for(let i in e)if(Yr[i]!==e[i]){r=!0;break}let n=r?{...Yr,...e}:Yr;return tc.set(e,n),n}function H0(e){let t=e.lastIndexOf("-");return t>0&&/^\d+$/.test(e.slice(t+1))?e.slice(0,t):e}function q0(e,t){let r=t?.length?t.join("\x00"):"",n=rc.get(e),i=n?.get(r);if(i)return i;let o=null;for(let l in e){let a=e[l];if(typeof a==="string"){if(bt[l]!==void 0&&bt[l]!==a)o??={},o[l]=a;continue}if(!a||typeof a!=="object")continue;for(let c in a){let u=a[c];if(typeof u!=="string")continue;let f=c==="DEFAULT"?l:`${l}-${c}`;if(bt[f]!==void 0&&bt[f]!==u)o??={},o[f]=u}}let s=o?{...bt,...o}:bt;if(r){let l=null;for(let a in s){let c=H0(a);if(!t.includes(c))continue;l??={...s},l[a]=W(a,s[a],c,t)}if(l)s=l}if(!n)n=new Map,rc.set(e,n);return n.set(r,s),s}function Y0(e){let t=nc.get(e);if(t!==void 0)return t;let r=!1;for(let n in e){let i=n==="DEFAULT"?"rounded":`rounded-${n}`;if(uc[i]?.["border-radius"]!==e[n]){r=!0;break}}return nc.set(e,r),r}function J0(e){let t=ic.get(e);if(t!==void 0)return t;let r=!1;for(let n in e){let i=n==="DEFAULT"?"shadow":`shadow-${n}`,o=cc[i];if(o!==void 0&&o["--tc-shadow"]!==e[n]){r=!0;break}}return ic.set(e,r),r}function X0(e){let t=e??ht.theme.screens,r=oc.get(t);if(r)return r;let n=new Map(Object.entries(t));return oc.set(t,n),n}function Z0(e){let t=e??ht.theme.containers,r=sc.get(t);if(r)return r;let n=new Map(Object.entries(t));return sc.set(t,n),n}function Q0(e){let t=ec.get(e);if(t)return t;if(e.presets&&e.presets.length>0)for(let g of e.presets){if(g.theme)e.theme=Ni(e.theme,g.theme);if(g.rules&&g.rules.length>0)e.rules=[...g.rules,...e.rules];if(g.shortcuts)e.shortcuts={...g.shortcuts,...e.shortcuts};if(g.variants)e.variants={...g.variants,...e.variants};if(g.preflights&&g.preflights.length>0)e.preflights=[...g.preflights,...e.preflights]}let r=e.theme.extend?.colors?e.theme.extend.colors:null;if(e.theme.extend){let{extend:g,...m}=e.theme;if(g)e.theme=Ni(m,g)}let n=yb(e.theme.colors,e.theme.modes??{}),i=n.tokens;if(i.length>0){e.theme={...e.theme,colors:n.colors};let g=i.map((m)=>m.name);if(e.colorVariables=[...new Set([...e.colorVariables??[],...g])],r){r={...r};for(let m of i)if(m.name in r)r[m.name]=m.base}}let o=[],s=new Set;for(let g of e.blocklist)if(g.includes("*"))o.push(new RegExp(`^${g.replace(/\*/g,".*")}$`));else s.add(g);let l=G0(e.theme.spacing),a=q0(e.theme.colors,e.colorVariables),c=Y0(e.theme.borderRadius),u=J0(e.theme.boxShadow),f={};for(let[g,m]of Object.entries(e.theme.animation??{}))f[`animate-${g}`]={animation:m};let d={...vb};for(let[g,m]of Object.entries(e.theme.keyframes??{}))d[g]=xb(g,m);let h={config:e,variantEnabled:e.variants,spacingValues:l,commonColors:a,skipStaticRadius:c,skipStaticShadow:u,screenBreakpoints:X0(e.theme.screens),containerBreakpoints:Z0(e.theme.containers),blocklistRegexCache:o,blocklistExact:s,extendColors:r,hasBlocklist:o.length>0||s.size>0,hasShortcuts:Object.keys(e.shortcuts).length>0,themeAnimations:f,keyframes:d,modeTokens:i};return ec.set(e,h),h}function ac(e){return e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57||e===45||e===95}function ex(e){let t=e.indexOf(".");if(t===-1)return;t++;let r=()=>{if(e.charCodeAt(t)===92&&e.charCodeAt(t+1)===33)t+=2};if(r(),e.charCodeAt(t)===45&&e.charCodeAt(t+1)===92)t++;if(e.charCodeAt(t)===92&&e.charCodeAt(t+1)===51&&e.charCodeAt(t+3)===32)t+=4;for(;;){let i=t;while(i<e.length&&ac(e.charCodeAt(i)))i++;if(e.charCodeAt(i)!==92||e.charCodeAt(i+1)!==58)break;t=i+2}r();let n=t;while(n<e.length&&ac(e.charCodeAt(n)))n++;return n>t?e.slice(t,n):void 0}var tx=/^(?:mx|my|px|py|inset-x|inset-y|border-x|border-y|scroll-mx|scroll-my|scroll-px|scroll-py|space-x|space-y|gap-x|gap-y)-/,rx=/^rounded-[tlbr](?:-|$)/,nx=/^(?:mt|mr|mb|ml|pt|pr|pb|pl|top|right|bottom|left|border-t|border-r|border-b|border-l|scroll-mt|scroll-mr|scroll-mb|scroll-ml|scroll-pt|scroll-pr|scroll-pb|scroll-pl)-/,ix=/^rounded-(?:tl|tr|bl|br)(?:-|$)/,ox=/^i-[a-z][a-z0-9]*(?:-[a-z0-9]+)*-.+/;function sx(e){let t=ex(e);if(!t)return 0;if(ox.test(t))return-1;if(tx.test(t)||rx.test(t))return 1;if(nx.test(t)||ix.test(t))return 2;return 0}function lc(e){let t=/^(min|max)-\[([^\]]+)\]$/.exec(e);if(!t)return;let r=t[2].replace(/_/g," ").trim();if(!/^(?:\d*\.?\d+(?:px|r?em|ch|ex|vw|vh|vmin|vmax|svw|lvw|dvw|cm|mm|in|pt|pc)|(?:calc|var|min|max|clamp)\(.+\))$/i.test(r))return;return`(${t[1]}-width: ${r})`}class Jr{config;rules=new Map;classCache=new Set;selectorCache=new Map;mediaQueryCache=new Map;ruleCache=new Map;variantEnabled;screenBreakpoints;containerBreakpoints;noMatchCache=new Set;usedKeyframes=new Set;variantHandledCache=new Map;utilityRankCache=new Map;compiledGenerated=new Set;darkStrategy;spacingValues;commonColors;skipStaticRadius;skipStaticShadow;shortcutSelectorRaw=null;extendColors=null;processed;revision=0;cssCache=null;cssCacheRevision=-1;cssCachePreflight=!1;cssCacheMinify=!1;constructor(e){this.config=e;this.processed=Q0(e),this.variantEnabled=this.processed.variantEnabled,this.screenBreakpoints=this.processed.screenBreakpoints,this.containerBreakpoints=this.processed.containerBreakpoints,this.extendColors=this.processed.extendColors,this.darkStrategy=e.darkMode==="media"?"media":"class",this.spacingValues=this.processed.spacingValues,this.commonColors=this.processed.commonColors,this.skipStaticRadius=this.processed.skipStaticRadius,this.skipStaticShadow=this.processed.skipStaticShadow}buildRuleLookup(){}generateBatch(e){for(let t=0;t<e.length;t++)this.generate(e[t])}generate(e){if(this.classCache.has(e))return;if(this.classCache.add(e),this.processed.hasShortcuts){let t=this.config.shortcuts[e];if(t){this.expandShortcut(e,t,new Set([e]));return}let r=this.resolveVariantShortcut(e);if(r){let{base:n,prefix:i,important:o}=r;this.expandShortcut(e,this.config.shortcuts[n],new Set([n]),i,o);return}}this.generateUtility(e)}resolveVariantShortcut(e){if(!e.includes(":")&&!e.includes("!"))return;let t=!1,r=e;if(r.charCodeAt(0)===33)t=!0,r=r.slice(1);else if(r.length>1&&r.charCodeAt(r.length-1)===33)t=!0,r=r.slice(0,-1);let n=St(r),i=n[n.length-1];if(!t&&i.length>1&&i.charCodeAt(0)===33)t=!0,i=i.slice(1);if(i===e||!Object.hasOwn(this.config.shortcuts,i))return;let o=n.slice(0,-1);return{base:i,prefix:o.length>0?`${o.join(":")}:`:"",important:t}}expandShortcut(e,t,r,n="",i=!1){let o=Array.isArray(t)?t:t.split(/\s+/),s=this.shortcutSelectorRaw;this.shortcutSelectorRaw=e;for(let l of o){if(!l)continue;let a=this.config.shortcuts[l];if(a){if(!r.has(l))r.add(l),this.expandShortcut(e,a,r,n,i);continue}let c=this.resolveVariantShortcut(l);if(c){if(!r.has(c.base))r.add(c.base),this.expandShortcut(e,this.config.shortcuts[c.base],r,n+c.prefix,i||c.important),r.delete(c.base);continue}let u=n===""?l:n+l;if(i&&!Sn(u).important)u+="!";this.generateUtility(u)}this.shortcutSelectorRaw=s}generateCompiledClass(e,t){if(this.compiledGenerated.has(e))return;this.compiledGenerated.add(e),this.classCache.add(e),this.expandShortcut(e,t,new Set([e]))}generateUtility(e){if(this.processed.hasBlocklist){if(this.processed.blocklistExact.has(e))return;let c=this.processed.blocklistRegexCache;for(let u=0;u<c.length;u++)if(c[u].test(e))return}let t=Sn(e),r=t.base,n=U0[r]??this.processed.themeAnimations[r];if(n&&(this.skipStaticRadius&&r.startsWith("rounded")||this.skipStaticShadow&&(r==="shadow"||r.startsWith("shadow-"))))n=void 0;if(n){if(this.addRule(t,n),n.animation){let c=n.animation.split(" ")[0];if(c&&c!=="none")this.usedKeyframes.add(c),this.revision++}return}let{utility:i,value:o}=t;if(i==="w"&&o){let c=Gl[o]||this.config.theme.spacing[o];if(c){this.addRule(t,{width:c});return}if(t.arbitrary){let u=o.match(/^(\d+)\/(\d+)$/);if(u){let f=Number(u[1]),d=Number(u[2]);if(!Number.isNaN(f)&&!Number.isNaN(d)&&d!==0){this.addRule(t,{width:$e(f,d)});return}}this.addRule(t,{width:o});return}}if(i==="h"&&o){let c=Gl[o]||this.config.theme.spacing[o];if(c){this.addRule(t,{height:o==="screen"?"100vh":c});return}if(t.arbitrary){let u=o.match(/^(\d+)\/(\d+)$/);if(u){let f=Number(u[1]),d=Number(u[2]);if(!Number.isNaN(f)&&!Number.isNaN(d)&&d!==0){this.addRule(t,{height:$e(f,d)});return}}this.addRule(t,{height:o});return}}if(i==="p"&&o){let c=this.spacingValues[o];if(c){this.addRule(t,{padding:c});return}}if(i==="px"&&o){let c=this.spacingValues[o];if(c){this.addRule(t,{"padding-left":c,"padding-right":c});return}}if(i==="py"&&o){let c=this.spacingValues[o];if(c){this.addRule(t,{"padding-top":c,"padding-bottom":c});return}}if((i==="pt"||i==="pr"||i==="pb"||i==="pl")&&o){let c=this.spacingValues[o];if(c){let u={pt:"padding-top",pr:"padding-right",pb:"padding-bottom",pl:"padding-left"};this.addRule(t,{[u[i]]:c});return}}if(i==="m"&&o){let c=this.spacingValues[o];if(c){this.addRule(t,{margin:c});return}}if(i==="mx"&&o){let c=this.spacingValues[o];if(c){this.addRule(t,{"margin-left":c,"margin-right":c});return}}if(i==="my"&&o){let c=this.spacingValues[o];if(c){this.addRule(t,{"margin-top":c,"margin-bottom":c});return}}if((i==="mt"||i==="mr"||i==="mb"||i==="ml")&&o){let c=this.spacingValues[o];if(c){let u={mt:"margin-top",mr:"margin-right",mb:"margin-bottom",ml:"margin-left"};this.addRule(t,{[u[i]]:c});return}}if((i==="top"||i==="right"||i==="bottom"||i==="left")&&o){let c=this.spacingValues[o];if(c){this.addRule(t,{[i]:c});return}}if(i==="inset"&&o){let c=this.spacingValues[o];if(c){this.addRule(t,{top:c,right:c,bottom:c,left:c});return}}if(i==="inset-x"&&o){let c=this.spacingValues[o];if(c){this.addRule(t,{left:c,right:c});return}}if(i==="inset-y"&&o){let c=this.spacingValues[o];if(c){this.addRule(t,{top:c,bottom:c});return}}if(i==="bg"&&o){let c=this.commonColors[o];if(c){this.addRule(t,{"background-color":c});return}}if(i==="text"&&o){let c=this.commonColors[o];if(c){this.addRule(t,{color:c});return}}if(i==="border"&&o){let c=this.commonColors[o];if(c){this.addRule(t,{"border-color":c});return}}if(i==="justify"&&o){let c=lb[o];if(c){this.addRule(t,{"justify-content":c});return}}if(i==="items"&&o){let c=cb[o];if(c){this.addRule(t,{"align-items":c});return}}if(i==="content"&&o){let c=ub[o];if(c){this.addRule(t,{"align-content":c});return}if(t.arbitrary){this.addRule(t,{content:o});return}}if(i==="self"&&o){let c=fb[o];if(c){this.addRule(t,{"align-self":c});return}}if(i==="grid-cols"&&o){let c=$b[o];if(c){this.addRule(t,{"grid-template-columns":c});return}}if(i==="grid-rows"&&o){let c=Cb[o];if(c){this.addRule(t,{"grid-template-rows":c});return}}if(i==="col"&&o){let c=Rb[o];if(c){this.addRule(t,{"grid-column":c});return}}if(i==="row"&&o){let c=kb[o];if(c){this.addRule(t,{"grid-row":c});return}}if(i==="grid-flow"&&o){let c=Sb[o];if(c){this.addRule(t,{"grid-auto-flow":c});return}}if(i==="auto-cols"&&o){let c=Kl[o];if(c){this.addRule(t,{"grid-auto-columns":c});return}}if(i==="auto-rows"&&o){let c=Kl[o];if(c){this.addRule(t,{"grid-auto-rows":c});return}}if(i==="origin"&&o){let c=wb[o];if(c){this.addRule(t,{"transform-origin":c});return}}if(i==="scale"&&o&&!t.arbitrary){let c=Number(o)/100;if(!Number.isNaN(c)){this.addRule(t,{transform:`scale(${c})`});return}}if(i==="scale-x"&&o&&!t.arbitrary){let c=Number(o)/100;if(!Number.isNaN(c)){this.addRule(t,{transform:`scaleX(${c})`});return}}if(i==="scale-y"&&o&&!t.arbitrary){let c=Number(o)/100;if(!Number.isNaN(c)){this.addRule(t,{transform:`scaleY(${c})`});return}}if(i==="rotate"&&o&&!t.arbitrary&&/^-?\d+(?:\.\d+)?$/.test(o)){this.addRule(t,{transform:`rotate(${o}deg)`});return}if(i==="duration"&&o&&o!=="0"&&!t.arbitrary&&/^\d+(?:\.\d+)?$/.test(o)){this.addRule(t,{"transition-duration":`${o}ms`});return}if(i==="delay"&&o&&o!=="0"&&!t.arbitrary&&/^\d+(?:\.\d+)?$/.test(o)){this.addRule(t,{"transition-delay":`${o}ms`});return}let s=(c)=>{let u=this.config.theme.spacing[c];if(u!==void 0)return u;if(t.arbitrary)return c;if(/^\d+(?:\.\d+)?$/.test(c)){let f=Number.parseFloat(c);if(Number.isFinite(f))return`${f*0.25}rem`}return};if(i==="gap"&&o){let c=s(o);if(c!==void 0)this.addRule(t,{gap:c});return}if(i==="gap-x"&&o){let c=s(o);if(c!==void 0)this.addRule(t,{"column-gap":c});return}if(i==="gap-y"&&o){let c=s(o);if(c!==void 0)this.addRule(t,{"row-gap":c});return}if(i==="place"&&o){if(o.startsWith("content-")){let c=Ai[o.slice(8)];if(c){this.addRule(t,{"place-content":c});return}}if(o.startsWith("items-")){let c=Ai[o.slice(6)];if(c){this.addRule(t,{"place-items":c});return}}if(o.startsWith("self-")){let c=Ai[o.slice(5)];if(c){this.addRule(t,{"place-self":c});return}}}let l=`${t.utility}:${t.value||""}`;if(this.noMatchCache.has(l))return;if(this.config.rules.length>0)for(let[c,u]of this.config.rules){let f=e.match(c);if(f){let d=u(f);if(d){this.addRule(t,d);return}}}let a=Si.length;for(let c=0;c<a;c++){let u=Si[c](t,this.config);if(u){if("properties"in u&&typeof u.properties==="object")this.addRule(t,u.properties,u.childSelector,u.pseudoElement,u.defaults);else this.addRule(t,u);return}}this.noMatchCache.add(l)}isVariantHandled(e){let t=this.variantHandledCache.get(e);if(t!==void 0)return t;let r=Mt[e]!==void 0||Zl[e]!==void 0||Ql[e]!==void 0||e.startsWith("not-")&&this.isNegationResolvable(e.slice(4))||this.screenBreakpoints.has(e)||e.startsWith("max-")&&this.screenBreakpoints.has(e.slice(4))||e.startsWith("min-")&&this.screenBreakpoints.has(e.slice(4))||lc(e)!==void 0||e.charCodeAt(0)===64&&this.containerQuery(e.slice(1))!==void 0||e==="*"||e==="**"||Oi(e)!==void 0||e.startsWith("in-")&&Ii(e.slice(3))!==void 0||e.startsWith("group-")&&Gr(Hr(e.slice(6)).base)!==void 0||e.startsWith("peer-")&&Gr(Hr(e.slice(5)).base)!==void 0||e.startsWith("group/")||e.startsWith("peer/")||e.startsWith("has-")||e.startsWith("aria-")||e.startsWith("data-")||e.startsWith("supports-")||e.startsWith("[")&&e.endsWith("]")||Ti[e]!==void 0||e==="starting"||["print","motion-safe","motion-reduce","contrast-more","contrast-less","landscape","portrait","forced-colors"].includes(e);return this.variantHandledCache.set(e,r),r}containerQuery(e){if(!e)return;let{size:t,name:r}=K0(e);if(!t||r!==void 0&&!r)return;let n=t,i=!0;if(t.startsWith("max-"))n=t.slice(4),i=!1;else if(t.startsWith("min-"))n=t.slice(4);let o;if(n.charCodeAt(0)===91&&n.charCodeAt(n.length-1)===93)o=n.slice(1,-1).replace(/_/g," ").trim()||void 0;else o=this.containerBreakpoints.get(n);if(o===void 0)return;let s=i?`(width >= ${o})`:`(width < ${o})`;return r===void 0?`@container ${s}`:`@container ${r} ${s}`}negatableAtRule(e){if(!e)return;let t=Yl[e];if(t!==void 0)return{media:t};let r=Ti[e];if(r!==void 0)return{media:r};let n=this.screenBreakpoints.get(e);if(n!==void 0)return{media:`(min-width: ${n})`};if(this.darkStrategy==="media"&&(e==="dark"||e==="light"))return{media:`(prefers-color-scheme: ${e})`};if(e.startsWith("supports-")){let i=e.slice(9);return i?{supports:Jl(i)}:void 0}return}isNegationResolvable(e){return ql(e)!==void 0||this.negatableAtRule(e)!==void 0}addRule(e,t,r,n,i){for(let c=0;c<e.variants.length;c++)if(!this.isVariantHandled(e.variants[c]))return;let o=this.shortcutSelectorRaw===null?r===void 0&&n===void 0?e.raw:`${e.raw}${r||""}${n||""}`:`${this.shortcutSelectorRaw}>${e.raw}${r||""}${n||""}`,s=this.selectorCache.get(o);if(!s){if(s=this.buildSelector(e),n)s+=n;if(r)s+=` ${r}`;if(i&&!s.includes("::"))s=`:where(${s})`;this.selectorCache.set(o,s)}let l=this.getMediaQuery(e);if(e.important){let c={};for(let u in t)c[u]=`${t[u]} !important`;t=c}let a=l||"base";if(!this.rules.has(a))this.rules.set(a,[]);this.revision++,this.rules.get(a).push({selector:s,properties:t,mediaQuery:l,childSelector:r})}buildSelector(e){let t=`.${this.escapeSelector(this.shortcutSelectorRaw??e.raw)}`,r="",n=e.variants,i=n.length;if(i===0)return t;for(let o=0;o<i;o++){let s=n[o];if(s.charCodeAt(0)===91&&s.charCodeAt(s.length-1)===93){let u=s.slice(1,-1).replace(/_/g," ");if(u.includes("&"))t=u.replace(/&/g,t);continue}if(s==="*"||s==="**"){if(this.variantEnabled[s])t=s==="*"?`:is(${t} > *)`:`:is(${t} *)`;continue}let l=Mt[s];if(l!==void 0){if(this.variantEnabled[s])t+=l;continue}let a=Ql[s];if(a!==void 0){if(this.variantEnabled[s]){let u=t.indexOf("::");t=u===-1?t+a:t.slice(0,u)+a+t.slice(u)}continue}let c=Zl[s];if(c!==void 0){if(this.darkStrategy==="media"&&(s==="dark"||s==="light"))continue;if(this.variantEnabled[s])r=c;continue}if(s.charCodeAt(0)===110&&s.startsWith("not-")){if(this.variantEnabled.not){let u=ql(s.slice(4));if(u!==void 0)t+=`:not(${u})`}continue}if(s.charCodeAt(0)===110&&s.startsWith("nth-")){let u=Oi(s);if(u!==void 0)t+=u;continue}if(s.charCodeAt(0)===105&&s.startsWith("in-")){if(this.variantEnabled.in){let u=Ii(s.slice(3));if(u!==void 0)r=`:where(${u}) `}continue}if(s.charCodeAt(0)===103&&s.startsWith("group-")){if(this.variantEnabled.group){let{base:u,name:f}=Hr(s.slice(6)),d=f?`.group\\/${f}`:".group",h=Gr(u);if(h!==void 0)r=`${d}${h} `}continue}if(s.charCodeAt(0)===103&&s.startsWith("group/")){if(this.variantEnabled.group)r=`.group\\/${s.slice(6)} `;continue}if(s.charCodeAt(0)===112&&s.startsWith("peer-")){if(this.variantEnabled.peer){let{base:u,name:f}=Hr(s.slice(5)),d=f?`.peer\\/${f}`:".peer",h=Gr(u);if(h!==void 0)r=`${d}${h} ~ `}continue}if(s.charCodeAt(0)===112&&s.startsWith("peer/")){if(this.variantEnabled.peer)r=`.peer\\/${s.slice(5)} ~ `;continue}if(s.charCodeAt(0)===104&&s.startsWith("has-")){if(this.variantEnabled.has){let u=s.slice(4);if(u.charCodeAt(0)===91&&u.charCodeAt(u.length-1)===93){let f=u.slice(1,-1);t+=`:has(${f})`}else t+=`:has(:${u})`}continue}if(s.charCodeAt(0)===97&&s.startsWith("aria-")){if(this.variantEnabled.aria){let u=Qe("aria",s.slice(5));if(u!==void 0)t+=u}continue}if(s.charCodeAt(0)===100&&s.startsWith("data-")){if(this.variantEnabled.data){let u=Qe("data",s.slice(5));if(u!==void 0)t+=u}continue}}return r+t}getMediaQuery(e){let t=e.variants,r=t.length;if(r===0)return;let n=r===1?t[0]:t.join(":"),i=this.mediaQueryCache.get(n);if(i!==void 0)return i||void 0;let o=[],s=[],l=[],a=!1;for(let u=0;u<r;u++){let f=t[u],d=f.charCodeAt(0);if(d===91&&f.startsWith("[@media")&&f.endsWith("]")){let m=f.slice(1,-1).replace(/_/g," ").slice(6).trim();if(m)o.push(m);continue}if(d===64){let m=this.containerQuery(f.slice(1));if(m!==void 0)l.push(m);continue}if(d===110&&f.startsWith("not-")){if(this.variantEnabled.not){let m=this.negatableAtRule(f.slice(4));if(m!==void 0)if(m.supports!==void 0)s.push(`@supports not ${m.supports}`);else o.push(`not ${m.media}`)}continue}if(this.darkStrategy==="media"&&(f==="dark"||f==="light")){o.push(`(prefers-color-scheme: ${f})`);continue}if(this.variantEnabled.responsive){let m=this.screenBreakpoints.get(f);if(m){o.push(`(min-width: ${m})`);continue}let p=lc(f);if(p){o.push(p);continue}if(f.startsWith("min-")){let y=this.screenBreakpoints.get(f.slice(4));if(y){o.push(`(min-width: ${y})`);continue}}if(f.startsWith("max-")){let y=this.screenBreakpoints.get(f.slice(4));if(y){let b=y.match(/^([\d.]+)px$/);o.push(b?`(max-width: ${Number.parseFloat(b[1])-0.02}px)`:`not all and (min-width: ${y})`);continue}}}if(f==="starting"){if(this.variantEnabled.starting)a=!0;continue}let h=Ti[f];if(h!==void 0){if(this.variantEnabled[f])o.push(h);continue}let g=Yl[f];if(g!==void 0){if(this.variantEnabled[f])o.push(g);continue}if(f.charCodeAt(0)===115&&f.startsWith("supports-")){if(this.variantEnabled.supports)s.push(`@supports ${Jl(f.slice(9))}`)}}let c=[];if(o.length>0)o.sort((u,f)=>Number(u.charCodeAt(0)===40)-Number(f.charCodeAt(0)===40)),c.push(`@media ${o.join(" and ")}`);if(c.push(...s,...l),a)c.push("@starting-style");if(c.length>0){let u=c.join(Xl);return this.mediaQueryCache.set(n,u),u}this.mediaQueryCache.set(n,"");return}escapeSelector(e){let t=!1;for(let l=0;l<e.length;l++){let a=e.charCodeAt(l);if(!(a>=97&&a<=122||a>=65&&a<=90||a>=48&&a<=57||a===45||a===95||a>127)){t=!0;break}}let r=e.charCodeAt(0),n=e.charCodeAt(1),i=r>=48&&r<=57,o=r===45&&n>=48&&n<=57;if(!t&&!i&&!o)return e;let s=e.replace(/[\x00-\x2C\x2E\x2F\x3A-\x40\x5B-\x5E\x60\x7B-\x7F]/g,"\\$&");if(i)return`\\3${e[0]} ${s.slice(1)}`;if(o)return`-\\3${e[1]} ${s.slice(2)}`;return s}buildFontCSS(){let e=this.config.fonts;if(!e)return"";let t=[],r=e.google?.filter(Boolean)??[];if(r.length>0){let n=r.map((o)=>`family=${o.trim().replace(/\s+/g,"+")}`).join("&"),i=e.display??"swap";t.push(`@import url('https://fonts.googleapis.com/css2?${n}&display=${i}');`)}if(e.faces?.length)t.push(...e.faces.map((n)=>n.trim()).filter(Boolean));return t.join(`
372
+ `)}toCSS(e=!0,t=!1){if(this.cssCache!==null&&this.cssCacheRevision===this.revision&&this.cssCachePreflight===e&&this.cssCacheMinify===t)return this.cssCache;let r=[],n=this.buildFontCSS();if(n)r.push(t?n.replace(/\s*\n\s*/g,""):n);let i=this.config.layers,o=Array.isArray(i)&&i.length>0;if(o)r.push(`@layer ${i.join(", ")};`);if(e)for(let d of this.config.preflights){let h=d.getCSS(),g=this.config.theme?.fontFamily?.sans;if(g&&Array.isArray(g)){let p=g.join(", ");h=h.replace(/font-family:\s*ui-sans-serif[^;]+;/g,`font-family: ${p};`)}let m=`@layer ${d.layer??bb} {
373
373
  ${h}
374
374
  }`;r.push(t?qr(m):m)}let s=this.processed.modeTokens;if(s.length>0){let h=`:root {
375
375
  ${s.map((g)=>` --color-${g.name}: ${g.base};`).join(`
@@ -385,7 +385,7 @@ ${g}
385
385
  ${d}
386
386
  }`)}let f=t?r.join(""):r.join(`
387
387
 
388
- `);return this.cssCache=f,this.cssCacheRevision=this.revision,this.cssCachePreflight=e,this.cssCacheMinify=t,f}getUtilityRank(e){let t=this.utilityRankCache.get(e);if(t!==void 0)return t;let r=ox(e);return this.utilityRankCache.set(e,r),r}rulesToCSS(e,t){let r=e.length,n=Array.from({length:r}),i=Array.from({length:r});for(let l=0;l<r;l++)n[l]=this.getUtilityRank(e[l].selector),i[l]=l;i.sort((l,a)=>n[l]-n[a]||l-a);let o=new Map;for(let l=0;l<r;l++){let a=e[i[l]],c=o.get(a.selector);if(c===void 0)c=new Map,o.set(a.selector,c);let u=a.properties;for(let f in u)c.set(f,u[f])}let s=[];for(let[l,a]of o){let c="",u=!0;for(let[f,d]of a){if(t){if(!u)c+=";";c+=`${f}:${d}`}else{if(!u)c+=`
388
+ `);return this.cssCache=f,this.cssCacheRevision=this.revision,this.cssCachePreflight=e,this.cssCacheMinify=t,f}getUtilityRank(e){let t=this.utilityRankCache.get(e);if(t!==void 0)return t;let r=sx(e);return this.utilityRankCache.set(e,r),r}rulesToCSS(e,t){let r=e.length,n=Array.from({length:r}),i=Array.from({length:r});for(let l=0;l<r;l++)n[l]=this.getUtilityRank(e[l].selector),i[l]=l;i.sort((l,a)=>n[l]-n[a]||l-a);let o=new Map;for(let l=0;l<r;l++){let a=e[i[l]],c=o.get(a.selector);if(c===void 0)c=new Map,o.set(a.selector,c);let u=a.properties;for(let f in u)c.set(f,u[f])}let s=[];for(let[l,a]of o){let c="",u=!0;for(let[f,d]of a){if(t){if(!u)c+=";";c+=`${f}:${d}`}else{if(!u)c+=`
389
389
  `;c+=` ${f}: ${d};`}u=!1}s.push(t?`${l}{${c}}`:`${l} {
390
390
  ${c}
391
391
  }`)}return t?s.join(""):s.join(`
@@ -393,10 +393,10 @@ ${c}
393
393
  `)}generateCSSVariables(){let e=this.extendColors;if(!e){let r=ht.theme.colors,n={};for(let[i,o]of Object.entries(this.config.theme.colors)){let s=r[i];if(typeof o==="string"){if(s!==o)n[i]=o}else if(o&&typeof o==="object")if(!s||typeof s!=="object")n[i]=o;else{let l={};for(let[a,c]of Object.entries(o))if(typeof c==="string"&&s[a]!==c)l[a]=c;if(Object.keys(l).length>0)n[i]=l}}e=n}if(!e||Object.keys(e).length===0)return null;let t=[];for(let[r,n]of Object.entries(e))if(typeof n==="string")t.push(` --${r}: ${n};`);else if(typeof n==="object"&&n!==null){for(let[i,o]of Object.entries(n))if(typeof o==="string")t.push(i==="DEFAULT"?` --${r}: ${o};`:` --${r}-${i}: ${o};`)}if(t.length===0)return null;return`:root {
394
394
  ${t.join(`
395
395
  `)}
396
- }`}rulesFor(e){if(!this.probe)this.probe=new Jr(this.config);this.probe.reset(),this.probe.generate(e);let t=[];for(let r of this.probe.rules.values())t.push(...r);return t}probe=null;reset(){this.revision++,this.rules.clear(),this.classCache.clear(),this.selectorCache.clear(),this.mediaQueryCache.clear(),this.noMatchCache.clear(),this.usedKeyframes.clear(),this.compiledGenerated.clear(),this.utilityRankCache.clear()}}function uc(e){let t=e.indexOf("{");if(t===-1)return[e];let r=e.indexOf("}",t);if(r===-1)return[e];let n=e.slice(t+1,r).split(",");if(n.length<2)return[e];let i=e.slice(0,t),o=e.slice(r+1),s=[];for(let l of n)for(let a of uc(o))s.push(`${i}${l.trim()}${a}`);return s}function sx(e,t){if(!t||t.length===0)return[e];return[e,...t.map((r)=>`${r}:${e}`)]}function fc(e,t=new Set){let r=new Set,n=[];for(let o of e)if(typeof o==="string")for(let s of uc(o))n.push(s),r.add(s);let i=[...new Set([...n,...t])];for(let o of e){if(typeof o==="string")continue;let s=o instanceof RegExp?o:o.pattern,l=o instanceof RegExp?void 0:o.variants;if(!(s instanceof RegExp))continue;for(let a of i)if(s.lastIndex=0,s.test(a))for(let c of sx(a,l))r.add(c)}return r}var{Glob:ax}=globalThis.Bun;var lx=32;class Pi{patterns;transformer;extractOptions;constructor(e,t=void 0,r=void 0){this.patterns=e;this.transformer=t;this.extractOptions=r}async scan(){let e=new Set,t=new Map,r=new Set,n=Array.from({length:this.patterns.length},()=>!1),i=[];await Promise.all(this.patterns.map(async(c,u)=>{try{let f=new ax(c);for await(let d of f.scan(".")){if(n[u]=!0,r.has(d))continue;r.add(d),i.push(d)}}catch{}}));let o=Math.min(i.length,lx),s=0;await Promise.all(Array.from({length:o},async()=>{while(s<i.length){let c=i[s++];try{let u=await Bun.file(c).text();if(this.transformer){let f=this.transformer.processFile(u);if(f.hasChanges)t.set(c,f.content),u=f.content}for(let f of Jt(u,this.extractOptions))e.add(f)}catch{}}}));let a=this.patterns.filter((c,u)=>!n[u]);return{classes:e,transformedFiles:t,unmatchedPatterns:a}}async scanFile(e){try{let t=await Bun.file(e).text();return Jt(t,this.extractOptions)}catch{return new Set}}scanContent(e){return Jt(e,this.extractOptions)}}var cx=/\btheme\(\s*(['"]?)([^'")]+)\1\s*\)/g,ux=/@apply\s+([^;}]+);?/g;function fx(e,t){let r=e;for(let n of t.split(".")){if(r===null||typeof r!=="object")return;r=r[n]}if(typeof r==="string")return r;if(Array.isArray(r)&&typeof r[0]==="string")return r[0];return}function dx(e,t){let r=[];return{css:e.replace(cx,(i,o,s)=>{let l=fx(t,s.trim());if(l===void 0)return r.push(s.trim()),i;return l}),unknown:r}}function hx(e,t,r){let n=`.${r}`;if(!t.startsWith(n))return t.includes("&")?t.replace(/&/g,e):e;let i=t.slice(n.length);return`${e}${i}`}function dc(e,t){return Object.entries(e).map(([r,n])=>`${r}: ${n};`).join(`
397
- ${t}`)}function gx(e,t){let r=[],n=[],i=e.replace(ux,(o,s,l)=>{let a=e.slice(0,l),c=a.lastIndexOf("{");if(c===-1)return o;let u=Math.max(a.lastIndexOf("}",c),a.lastIndexOf(";",c),a.lastIndexOf("{",c-1))+1,f=a.slice(u,c).trim();if(!f)return o;let d=a.lastIndexOf(`
398
- `)+1,h=/^[ \t]*/.exec(a.slice(d))?.[0]??"",g=0;for(let y of a)if(y==="{")g++;else if(y==="}")g--;let m=g>1,p=[];for(let y of s.trim().split(/\s+/)){if(!y)continue;let b=t.rulesFor(y);if(b.length===0){r.push(y);continue}let v=t.escapeSelector(y);for(let R of b){let S=hx(f,R.selector,v);if(S===f&&!R.mediaQuery&&!R.childSelector){p.push(dc(R.properties,h));continue}if(m){r.push(y);continue}let Qr=`${R.childSelector?`${S} ${R.childSelector}`:S} {
399
- ${dc(R.properties," ")}
396
+ }`}rulesFor(e){if(!this.probe)this.probe=new Jr(this.config);this.probe.reset(),this.probe.generate(e);let t=[];for(let r of this.probe.rules.values())t.push(...r);return t}probe=null;reset(){this.revision++,this.rules.clear(),this.classCache.clear(),this.selectorCache.clear(),this.mediaQueryCache.clear(),this.noMatchCache.clear(),this.usedKeyframes.clear(),this.compiledGenerated.clear(),this.utilityRankCache.clear()}}function fc(e){let t=e.indexOf("{");if(t===-1)return[e];let r=e.indexOf("}",t);if(r===-1)return[e];let n=e.slice(t+1,r).split(",");if(n.length<2)return[e];let i=e.slice(0,t),o=e.slice(r+1),s=[];for(let l of n)for(let a of fc(o))s.push(`${i}${l.trim()}${a}`);return s}function ax(e,t){if(!t||t.length===0)return[e];return[e,...t.map((r)=>`${r}:${e}`)]}function dc(e,t=new Set){let r=new Set,n=[];for(let o of e)if(typeof o==="string")for(let s of fc(o))n.push(s),r.add(s);let i=[...new Set([...n,...t])];for(let o of e){if(typeof o==="string")continue;let s=o instanceof RegExp?o:o.pattern,l=o instanceof RegExp?void 0:o.variants;if(!(s instanceof RegExp))continue;for(let a of i)if(s.lastIndex=0,s.test(a))for(let c of ax(a,l))r.add(c)}return r}var{Glob:lx}=globalThis.Bun;var cx=32;class Pi{patterns;transformer;extractOptions;constructor(e,t=void 0,r=void 0){this.patterns=e;this.transformer=t;this.extractOptions=r}async scan(){let e=new Set,t=new Map,r=new Set,n=Array.from({length:this.patterns.length},()=>!1),i=[];await Promise.all(this.patterns.map(async(c,u)=>{try{let f=new lx(c);for await(let d of f.scan(".")){if(n[u]=!0,r.has(d))continue;r.add(d),i.push(d)}}catch{}}));let o=Math.min(i.length,cx),s=0;await Promise.all(Array.from({length:o},async()=>{while(s<i.length){let c=i[s++];try{let u=await Bun.file(c).text();if(this.transformer){let f=this.transformer.processFile(u);if(f.hasChanges)t.set(c,f.content),u=f.content}for(let f of Jt(u,this.extractOptions))e.add(f)}catch{}}}));let a=this.patterns.filter((c,u)=>!n[u]);return{classes:e,transformedFiles:t,unmatchedPatterns:a}}async scanFile(e){try{let t=await Bun.file(e).text();return Jt(t,this.extractOptions)}catch{return new Set}}scanContent(e){return Jt(e,this.extractOptions)}}var ux=/\btheme\(\s*(['"]?)([^'")]+)\1\s*\)/g,fx=/@apply\s+([^;}]+);?/g;function dx(e,t){let r=e;for(let n of t.split(".")){if(r===null||typeof r!=="object")return;r=r[n]}if(typeof r==="string")return r;if(Array.isArray(r)&&typeof r[0]==="string")return r[0];return}function hx(e,t){let r=[];return{css:e.replace(ux,(i,o,s)=>{let l=dx(t,s.trim());if(l===void 0)return r.push(s.trim()),i;return l}),unknown:r}}function gx(e,t,r){let n=`.${r}`;if(!t.startsWith(n))return t.includes("&")?t.replace(/&/g,e):e;let i=t.slice(n.length);return`${e}${i}`}function hc(e,t){return Object.entries(e).map(([r,n])=>`${r}: ${n};`).join(`
397
+ ${t}`)}function mx(e,t){let r=[],n=[],i=e.replace(fx,(o,s,l)=>{let a=e.slice(0,l),c=a.lastIndexOf("{");if(c===-1)return o;let u=Math.max(a.lastIndexOf("}",c),a.lastIndexOf(";",c),a.lastIndexOf("{",c-1))+1,f=a.slice(u,c).trim();if(!f)return o;let d=a.lastIndexOf(`
398
+ `)+1,h=/^[ \t]*/.exec(a.slice(d))?.[0]??"",g=0;for(let y of a)if(y==="{")g++;else if(y==="}")g--;let m=g>1,p=[];for(let y of s.trim().split(/\s+/)){if(!y)continue;let b=t.rulesFor(y);if(b.length===0){r.push(y);continue}let v=t.escapeSelector(y);for(let R of b){let S=gx(f,R.selector,v);if(S===f&&!R.mediaQuery&&!R.childSelector){p.push(hc(R.properties,h));continue}if(m){r.push(y);continue}let Qr=`${R.childSelector?`${S} ${R.childSelector}`:S} {
399
+ ${hc(R.properties," ")}
400
400
  }`;n.push(R.mediaQuery?`${R.mediaQuery} {
401
401
  ${Qr}
402
402
  }`:Qr)}}return p.join(`
@@ -404,18 +404,18 @@ ${h}`)});return{css:n.length>0?`${i}
404
404
 
405
405
  ${n.join(`
406
406
 
407
- `)}`:i,unknown:r}}function hc(e,t,r){let n=dx(e,r),i=gx(n.css,t);return{css:i.css,unknownUtilities:i.unknown,unknownThemePaths:n.unknown}}function gc(e){return/@apply\b/.test(e)}import{resolve as vx}from"path";var{Glob:wx}=globalThis.Bun;import{statSync as bx}from"fs";var mc=new Map;function pc(e){let t=mc.get(e);if(t!==void 0)return t;let r;if(e.startsWith("--"))r=e;else r=e.replace(/[A-Z]/g,(n)=>`-${n.toLowerCase()}`);return mc.set(e,r),r}class yc{rules=new Map;keyframes=new Map;vars=[];varKeys=new Set;insertionOrder=new Map;nextIndex=0;generation=0;addRule(e){if(this.rules.has(e.className))return;this.rules.set(e.className,e),this.insertionOrder.set(e.className,this.nextIndex++)}addKeyframes(e){if(!this.keyframes.has(e.name))this.keyframes.set(e.name,e)}addVars(e){let t=`${e.atRule??""}|${e.selector}|${Object.keys(e.declarations).join(",")}`;if(this.varKeys.has(t))return;this.varKeys.add(t),this.vars.push(e)}has(e){return this.rules.has(e)}get size(){return this.rules.size}clear(){this.rules.clear(),this.keyframes.clear(),this.vars=[],this.varKeys.clear(),this.insertionOrder.clear(),this.nextIndex=0,this.generation++}get currentGeneration(){return this.generation}toCSS(e=!1){let t=e?"":`
408
- `,r=[];for(let i of this.vars)r.push(yx(i,e));for(let i of this.keyframes.values())r.push(i.css);let n=[...this.rules.values()].sort((i,o)=>{if(i.priority!==o.priority)return i.priority-o.priority;return(this.insertionOrder.get(i.className)??0)-(this.insertionOrder.get(o.className)??0)});for(let i of n)r.push(px(i,e));return r.join(t)}}function mx(e,t){let r=pc(e.property),n=t?"":" ";return e.values.map((i)=>`${r}:${n}${i}`).join(t?";":"; ")}function px(e,t){let r=e.conditions.filter((s)=>s.startsWith("@")),n=e.conditions.filter((s)=>!s.startsWith("@")),i=`.${e.className}`;for(let s of n)i=s.includes("&")?s.replace(/&/g,i):`${i}${s}`;let o=`${i}${t?"":" "}{${t?"":" "}${mx(e,t)}${t?"":" "}}`;return bc(o,r,t)}function yx(e,t){let r=t?"":" ",n=Object.entries(e.declarations).map(([o,s])=>`${o}:${r}${s}`).join(t?";":"; "),i=`${e.selector}${t?"":" "}{${r}${n}${r}}`;return bc(i,e.atRule?[e.atRule]:[],t)}function bc(e,t,r){let n=e;for(let i=t.length-1;i>=0;i--)n=`${t[i]}${r?"":" "}{${r?"":" "}${n}${r?"":" "}}`;return n}var _i=new yc;function xc(e=!1){return _i.toCSS(e)}function vc(){_i.clear()}function wc(){return _i.currentGeneration}async function $c(e){try{await import(`${e}?mtime=${xx(e)}&gen=${wc()}`)}catch(t){throw Error(`Failed to evaluate style module ${e}: ${t.message}`,{cause:t})}}function xx(e){try{return bx(e).mtimeMs}catch{return 0}}async function Cc(e,t={}){let r=t.cwd??process.cwd(),n=new Set,i=Array.from({length:e.length},()=>!1);await Promise.all(e.map(async(s,l)=>{try{let a=new wx(s);for await(let c of a.scan(r))i[l]=!0,n.add(vx(r,c))}catch{}}));let o=[...n].sort();for(let s of o)await $c(s);return{css:xc(t.minify??!1),modules:o,unmatchedPatterns:e.filter((s,l)=>!i[l])}}function $x(e){let t=0;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);t=(t<<5)-t+n,t=t&t}return Math.abs(t).toString(36)}function Cx(e,t={}){let r=t.trigger||":tc:",n=new Map,i=/(?:class|className)=["']([^"']*)["']/g,o;while((o=i.exec(e))!==null){let s=o[1];if(s.trim().startsWith(r)){let l=s.replace(r,"").trim().split(/\s+/).filter(Boolean);if(l.length>0){let a=l.sort().join(" ");if(!n.has(a))n.set(a,l)}}}return n}function Rx(e,t,r={}){let n=r.trigger||":tc:",i=e,o=/(?:class|className)=["']([^"']*)["']/g,s,l=[];while((s=o.exec(e))!==null){let a=s[1];if(a.trim().startsWith(n)){let u=a.replace(n,"").trim().split(/\s+/).filter(Boolean).sort().join(" "),f=t.get(u);if(f){let d=s[0].startsWith("class=")?"class":"className",h=s[0].includes('"')?'"':"'",g=`${d}=${h}${f}${h}`;l.push({start:s.index,end:s.index+s[0].length,replacement:g})}}}for(let a=l.length-1;a>=0;a--){let{start:c,end:u,replacement:f}=l[a];i=i.substring(0,c)+f+i.substring(u)}return i}function kx(e,t={}){let r=t.classPrefix||"tc-",n=t.hashFn||$x,i=new Map;for(let[o]of e){let s=n(o),l=`${r}${s}`;i.set(o,l)}return i}class Li{compiledClasses=new Map;classNameMap=new Map;options;constructor(e={}){this.options={trigger:":tc:",classPrefix:"tc-",layer:"shortcuts",...e}}processFile(e){let t=Cx(e,this.options);if(t.size===0)return{content:e,hasChanges:!1};let r=!1;for(let[i,o]of t)if(!this.compiledClasses.has(i))this.compiledClasses.set(i,o),r=!0;if(r||this.classNameMap.size!==this.compiledClasses.size)this.classNameMap=kx(this.compiledClasses,this.options);let n=Rx(e,this.classNameMap,this.options);return{content:n,hasChanges:n!==e}}getCompiledClasses(){let e=new Map;for(let[t,r]of this.compiledClasses){let n=this.classNameMap.get(t);if(n)e.set(t,{className:n,utilities:r})}return e}generateCSS(e,t){let r=this.getCompiledClasses(),n="";for(let[,{className:i,utilities:o}]of r){for(let l of o)t.generate(l);let s=t.toCSS(!1);n+=`
407
+ `)}`:i,unknown:r}}function gc(e,t,r){let n=hx(e,r),i=mx(n.css,t);return{css:i.css,unknownUtilities:i.unknown,unknownThemePaths:n.unknown}}function mc(e){return/@apply\b/.test(e)}import{resolve as wx}from"path";var{Glob:$x}=globalThis.Bun;import{statSync as xx}from"fs";var pc=new Map;function yc(e){let t=pc.get(e);if(t!==void 0)return t;let r;if(e.startsWith("--"))r=e;else r=e.replace(/[A-Z]/g,(n)=>`-${n.toLowerCase()}`);return pc.set(e,r),r}class bc{rules=new Map;keyframes=new Map;vars=[];varKeys=new Set;insertionOrder=new Map;nextIndex=0;generation=0;addRule(e){if(this.rules.has(e.className))return;this.rules.set(e.className,e),this.insertionOrder.set(e.className,this.nextIndex++)}addKeyframes(e){if(!this.keyframes.has(e.name))this.keyframes.set(e.name,e)}addVars(e){let t=`${e.atRule??""}|${e.selector}|${Object.keys(e.declarations).join(",")}`;if(this.varKeys.has(t))return;this.varKeys.add(t),this.vars.push(e)}has(e){return this.rules.has(e)}get size(){return this.rules.size}clear(){this.rules.clear(),this.keyframes.clear(),this.vars=[],this.varKeys.clear(),this.insertionOrder.clear(),this.nextIndex=0,this.generation++}get currentGeneration(){return this.generation}toCSS(e=!1){let t=e?"":`
408
+ `,r=[];for(let i of this.vars)r.push(bx(i,e));for(let i of this.keyframes.values())r.push(i.css);let n=[...this.rules.values()].sort((i,o)=>{if(i.priority!==o.priority)return i.priority-o.priority;return(this.insertionOrder.get(i.className)??0)-(this.insertionOrder.get(o.className)??0)});for(let i of n)r.push(yx(i,e));return r.join(t)}}function px(e,t){let r=yc(e.property),n=t?"":" ";return e.values.map((i)=>`${r}:${n}${i}`).join(t?";":"; ")}function yx(e,t){let r=e.conditions.filter((s)=>s.startsWith("@")),n=e.conditions.filter((s)=>!s.startsWith("@")),i=`.${e.className}`;for(let s of n)i=s.includes("&")?s.replace(/&/g,i):`${i}${s}`;let o=`${i}${t?"":" "}{${t?"":" "}${px(e,t)}${t?"":" "}}`;return xc(o,r,t)}function bx(e,t){let r=t?"":" ",n=Object.entries(e.declarations).map(([o,s])=>`${o}:${r}${s}`).join(t?";":"; "),i=`${e.selector}${t?"":" "}{${r}${n}${r}}`;return xc(i,e.atRule?[e.atRule]:[],t)}function xc(e,t,r){let n=e;for(let i=t.length-1;i>=0;i--)n=`${t[i]}${r?"":" "}{${r?"":" "}${n}${r?"":" "}}`;return n}var _i=new bc;function vc(e=!1){return _i.toCSS(e)}function wc(){_i.clear()}function $c(){return _i.currentGeneration}async function Cc(e){try{await import(`${e}?mtime=${vx(e)}&gen=${$c()}`)}catch(t){throw Error(`Failed to evaluate style module ${e}: ${t.message}`,{cause:t})}}function vx(e){try{return xx(e).mtimeMs}catch{return 0}}async function Rc(e,t={}){let r=t.cwd??process.cwd(),n=new Set,i=Array.from({length:e.length},()=>!1);await Promise.all(e.map(async(s,l)=>{try{let a=new $x(s);for await(let c of a.scan(r))i[l]=!0,n.add(wx(r,c))}catch{}}));let o=[...n].sort();for(let s of o)await Cc(s);return{css:vc(t.minify??!1),modules:o,unmatchedPatterns:e.filter((s,l)=>!i[l])}}function Cx(e){let t=0;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);t=(t<<5)-t+n,t=t&t}return Math.abs(t).toString(36)}function Rx(e,t={}){let r=t.trigger||":tc:",n=new Map,i=/(?:class|className)=["']([^"']*)["']/g,o;while((o=i.exec(e))!==null){let s=o[1];if(s.trim().startsWith(r)){let l=s.replace(r,"").trim().split(/\s+/).filter(Boolean);if(l.length>0){let a=l.sort().join(" ");if(!n.has(a))n.set(a,l)}}}return n}function kx(e,t,r={}){let n=r.trigger||":tc:",i=e,o=/(?:class|className)=["']([^"']*)["']/g,s,l=[];while((s=o.exec(e))!==null){let a=s[1];if(a.trim().startsWith(n)){let u=a.replace(n,"").trim().split(/\s+/).filter(Boolean).sort().join(" "),f=t.get(u);if(f){let d=s[0].startsWith("class=")?"class":"className",h=s[0].includes('"')?'"':"'",g=`${d}=${h}${f}${h}`;l.push({start:s.index,end:s.index+s[0].length,replacement:g})}}}for(let a=l.length-1;a>=0;a--){let{start:c,end:u,replacement:f}=l[a];i=i.substring(0,c)+f+i.substring(u)}return i}function Sx(e,t={}){let r=t.classPrefix||"tc-",n=t.hashFn||Cx,i=new Map;for(let[o]of e){let s=n(o),l=`${r}${s}`;i.set(o,l)}return i}class Li{compiledClasses=new Map;classNameMap=new Map;options;constructor(e={}){this.options={trigger:":tc:",classPrefix:"tc-",layer:"shortcuts",...e}}processFile(e){let t=Rx(e,this.options);if(t.size===0)return{content:e,hasChanges:!1};let r=!1;for(let[i,o]of t)if(!this.compiledClasses.has(i))this.compiledClasses.set(i,o),r=!0;if(r||this.classNameMap.size!==this.compiledClasses.size)this.classNameMap=Sx(this.compiledClasses,this.options);let n=kx(e,this.classNameMap,this.options);return{content:n,hasChanges:n!==e}}getCompiledClasses(){let e=new Map;for(let[t,r]of this.compiledClasses){let n=this.classNameMap.get(t);if(n)e.set(t,{className:n,utilities:r})}return e}generateCSS(e,t){let r=this.getCompiledClasses(),n="";for(let[,{className:i,utilities:o}]of r){for(let l of o)t.generate(l);let s=t.toCSS(!1);n+=`
409
409
  /* Compiled class: ${i} */
410
410
  `,n+=`/* Original utilities: ${o.join(" ")} */
411
- `}return n}reset(){this.compiledClasses.clear(),this.classNameMap.clear()}getStats(){let e=0;for(let[,t]of this.compiledClasses)e+=t.length;return{totalGroups:this.compiledClasses.size,totalUtilities:e,averageUtilitiesPerGroup:this.compiledClasses.size>0?e/this.compiledClasses.size:0}}}async function Mi(e){let t=performance.now(),r=e.compileClass?.enabled?new Li({trigger:e.compileClass.trigger,classPrefix:e.compileClass.classPrefix,layer:e.compileClass.layer}):null,n=new Pi(e.content,r,{attributify:e.attributify,bracketSyntax:e.bracketSyntax,codeStrings:e.codeStrings}),{classes:i,transformedFiles:o,unmatchedPatterns:s}=await n.scan();for(let f of fc(e.safelist,i))i.add(f);let l=new Jr(e);for(let f of i)l.generate(f);if(r){let f=r.getCompiledClasses();for(let[,{className:d,utilities:h}]of f)l.generateCompiledClass(d,h)}if(e.includePreflight!==!1){for(let f of e.preflights)if(gc(f.getCSS())){console.warn("\u26A0\uFE0F @apply in a preflight is not expanded and will not reach the browser. Put the CSS in the `input` stylesheet instead.");break}}let a=l.toCSS(e.includePreflight!==!1,e.minify);if(e.input){let f=await Bun.file(e.input).text(),d=hc(f,l,e.theme);for(let h of d.unknownUtilities)console.warn(`\u26A0\uFE0F @apply ${h}: not a utility this config generates (${e.input})`);for(let h of d.unknownThemePaths)console.warn(`\u26A0\uFE0F theme(${h}): no such value in the theme (${e.input})`);a+=`
412
- ${d.css}`}let c;if(e.styles&&e.styles.length>0){vc();let f=await Cc(e.styles,{minify:e.minify});if(c=f.modules,f.css)a+=(e.minify?"":`
413
- `)+f.css;s.push(...f.unmatchedPatterns)}let u=performance.now()-t;return{css:a,classes:i,duration:u,compiledClasses:r?.getCompiledClasses(),transformedFiles:o,unmatchedPatterns:s,styleModules:c}}async function Sx(e,t){await Bun.write(t,e)}async function Ax(e){let t=Array.from(e.entries()).map(([r,n])=>Bun.write(r,n));await Promise.all(t)}async function Rc(e){let t=await Mi(e);if(await Sx(t.css,e.output),t.transformedFiles&&t.transformedFiles.size>0)await Ax(t.transformedFiles);return t}var Ce=new ln("cssx");async function Zr(e){if(e){let t=Fi(ye.cwd(),e);if(!Be(t))console.error(`\u274C Config file not found: ${t}`),ye.exit(1);try{let r=await import(t);return{...mi,...r.default||r}}catch(r){console.error(`\u274C Failed to load config file: ${t}`),console.error(r),ye.exit(1)}}return ia()}function Ix(e){if(e)return Fi(ye.cwd(),e);for(let t of["css.config.ts","css.config.js","css.config.mjs"]){let r=Fi(ye.cwd(),t);if(Be(r))return r}return null}function ji(e,t){return{...e,output:t.output||e.output,minify:t.minify??e.minify,content:t.content?[t.content]:e.content,verbose:t.verbose??e.verbose,includePreflight:t.noPreflight===!0||t.preflight===!1?!1:e.includePreflight}}async function Xr(e,t){let r=t.verbose??e.verbose??!1;try{if(console.log(r?"\uD83D\uDE80 Building CSS (verbose mode)...":"\uD83D\uDE80 Building CSS..."),r)console.log(`\uD83D\uDCC2 Content patterns: ${e.content.join(", ")}`),console.log(`\uD83D\uDCDD Output: ${e.output}`),console.log(`\uD83D\uDDDC\uFE0F Minify: ${e.minify?"Yes":"No"}`);let i=await Rc(e);if(i.unmatchedPatterns&&i.unmatchedPatterns.length>0)for(let o of i.unmatchedPatterns)console.warn(`\u26A0\uFE0F Content pattern matched no files: ${o}`);if(console.log(`\u2705 Built ${i.classes.size} classes in ${i.duration.toFixed(2)}ms`),console.log(`\uD83D\uDCDD Output: ${e.output}`),i.compiledClasses&&i.compiledClasses.size>0){if(console.log(`\uD83D\uDD28 Compiled ${i.compiledClasses.size} class groups`),i.transformedFiles)console.log(`\uD83D\uDCDD Transformed ${i.transformedFiles.size} files`);if(r){console.log(`
411
+ `}return n}reset(){this.compiledClasses.clear(),this.classNameMap.clear()}getStats(){let e=0;for(let[,t]of this.compiledClasses)e+=t.length;return{totalGroups:this.compiledClasses.size,totalUtilities:e,averageUtilitiesPerGroup:this.compiledClasses.size>0?e/this.compiledClasses.size:0}}}async function Mi(e){let t=performance.now(),r=e.compileClass?.enabled?new Li({trigger:e.compileClass.trigger,classPrefix:e.compileClass.classPrefix,layer:e.compileClass.layer}):null,n=new Pi(e.content,r,{attributify:e.attributify,bracketSyntax:e.bracketSyntax,codeStrings:e.codeStrings}),{classes:i,transformedFiles:o,unmatchedPatterns:s}=await n.scan();for(let f of dc(e.safelist,i))i.add(f);let l=new Jr(e);for(let f of i)l.generate(f);if(r){let f=r.getCompiledClasses();for(let[,{className:d,utilities:h}]of f)l.generateCompiledClass(d,h)}if(e.includePreflight!==!1){for(let f of e.preflights)if(mc(f.getCSS())){console.warn("\u26A0\uFE0F @apply in a preflight is not expanded and will not reach the browser. Put the CSS in the `input` stylesheet instead.");break}}let a=l.toCSS(e.includePreflight!==!1,e.minify);if(e.input){let f=await Bun.file(e.input).text(),d=gc(f,l,e.theme);for(let h of d.unknownUtilities)console.warn(`\u26A0\uFE0F @apply ${h}: not a utility this config generates (${e.input})`);for(let h of d.unknownThemePaths)console.warn(`\u26A0\uFE0F theme(${h}): no such value in the theme (${e.input})`);a+=`
412
+ ${d.css}`}let c;if(e.styles&&e.styles.length>0){wc();let f=await Rc(e.styles,{minify:e.minify});if(c=f.modules,f.css)a+=(e.minify?"":`
413
+ `)+f.css;s.push(...f.unmatchedPatterns)}let u=performance.now()-t;return{css:a,classes:i,duration:u,compiledClasses:r?.getCompiledClasses(),transformedFiles:o,unmatchedPatterns:s,styleModules:c}}async function Ax(e,t){await Bun.write(t,e)}async function Ex(e){let t=Array.from(e.entries()).map(([r,n])=>Bun.write(r,n));await Promise.all(t)}async function kc(e){let t=await Mi(e);if(await Ax(t.css,e.output),t.transformedFiles&&t.transformedFiles.size>0)await Ex(t.transformedFiles);return t}var Ce=new ln("cssx");async function Zr(e){if(e){let t=Fi(ye.cwd(),e);if(!Be(t))console.error(`\u274C Config file not found: ${t}`),ye.exit(1);try{let r=await import(t);return{...mi,...r.default||r}}catch(r){console.error(`\u274C Failed to load config file: ${t}`),console.error(r),ye.exit(1)}}return ia()}function Px(e){if(e)return Fi(ye.cwd(),e);for(let t of["css.config.ts","css.config.js","css.config.mjs"]){let r=Fi(ye.cwd(),t);if(Be(r))return r}return null}function ji(e,t){return{...e,output:t.output||e.output,minify:t.minify??e.minify,content:t.content?[t.content]:e.content,verbose:t.verbose??e.verbose,includePreflight:t.noPreflight===!0||t.preflight===!1?!1:e.includePreflight}}async function Xr(e,t){let r=t.verbose??e.verbose??!1;try{if(console.log(r?"\uD83D\uDE80 Building CSS (verbose mode)...":"\uD83D\uDE80 Building CSS..."),r)console.log(`\uD83D\uDCC2 Content patterns: ${e.content.join(", ")}`),console.log(`\uD83D\uDCDD Output: ${e.output}`),console.log(`\uD83D\uDDDC\uFE0F Minify: ${e.minify?"Yes":"No"}`);let i=await kc(e);if(i.unmatchedPatterns&&i.unmatchedPatterns.length>0)for(let o of i.unmatchedPatterns)console.warn(`\u26A0\uFE0F Content pattern matched no files: ${o}`);if(console.log(`\u2705 Built ${i.classes.size} classes in ${i.duration.toFixed(2)}ms`),console.log(`\uD83D\uDCDD Output: ${e.output}`),i.compiledClasses&&i.compiledClasses.size>0){if(console.log(`\uD83D\uDD28 Compiled ${i.compiledClasses.size} class groups`),i.transformedFiles)console.log(`\uD83D\uDCDD Transformed ${i.transformedFiles.size} files`);if(r){console.log(`
414
414
  \uD83D\uDCE6 Compiled classes:`);for(let[,{className:o,utilities:s}]of i.compiledClasses)console.log(` ${o} \u2190 ${s.join(" ")}`)}}if(r&&i.classes.size>0){let o=Array.from(i.classes).sort();console.log(`
415
- \uD83D\uDCCB Classes found (${i.classes.size}):`),o.forEach((s)=>console.log(` - ${s}`))}if(Be(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);ye.exit(1)}}function Sc(e,t){console.log("\uD83D\uDC40 Watching for changes...");let r={current:e},n=Ix(t.config);if(n)try{kc(n,async()=>{try{let l=await import(`${n}?t=${Date.now()}`);r.current=ji({...mi,...l.default||l},t),console.log(`
416
- \u2699\uFE0F ${n} changed, rebuilding with fresh config...`),await Xr(r.current,t)}catch(l){console.warn("\u26A0\uFE0F Failed to reload config:",l instanceof Error?l.message:l)}})}catch{}let i=new Set;for(let l of e.content){let a=l.search(/[*?[{]/),c=a===-1?l:l.slice(0,a);if(a!==-1||!Be(c)||!Ex(c).isDirectory())c=c.slice(0,c.lastIndexOf("/")+1)||".";while(c!=="."&&c!=="/"&&!Be(c)){let u=Nx(c);if(u===c)break;c=u}if(Be(c))i.add(c);else console.warn(`\u26A0\uFE0F Skipping watch for missing path: ${l}`)}let o=null,s=(l)=>{if(o)clearTimeout(o);o=setTimeout(async()=>{o=null,console.log(`
417
- \uD83D\uDCDD ${l} changed, rebuilding...`),await Xr(r.current,t)},50)};for(let l of i)try{kc(l,{recursive:!0},(a,c)=>{if(c&&/\.(?:html|js|ts|jsx|tsx|stx)$/.test(c))s(c)})}catch(a){console.warn(`\u26A0\uFE0F Could not watch ${l}:`,a instanceof Error?a.message:a)}console.log(`
418
- \uD83D\uDC40 Watching: ${Array.from(i).join(", ")}`)}Ce.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 Zr(e.config),r=ji(t,e);if(await Xr(r,e),e.watch||r.watch)Sc(r,e)});Ce.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 Zr(e.config),r=ji(t,e);await Xr(r,e),Sc(r,e)});Ce.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(Be("./css.config.ts")&&!e.force)console.error("\u274C Config file already exists. Use --force to overwrite."),ye.exit(1);let r=`import type { CssOptions } from '@stacksjs/ts-css/engine'
415
+ \uD83D\uDCCB Classes found (${i.classes.size}):`),o.forEach((s)=>console.log(` - ${s}`))}if(Be(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);ye.exit(1)}}function Ac(e,t){console.log("\uD83D\uDC40 Watching for changes...");let r={current:e},n=Px(t.config);if(n)try{Sc(n,async()=>{try{let l=await import(`${n}?t=${Date.now()}`);r.current=ji({...mi,...l.default||l},t),console.log(`
416
+ \u2699\uFE0F ${n} changed, rebuilding with fresh config...`),await Xr(r.current,t)}catch(l){console.warn("\u26A0\uFE0F Failed to reload config:",l instanceof Error?l.message:l)}})}catch{}let i=new Set;for(let l of e.content){let a=l.search(/[*?[{]/),c=a===-1?l:l.slice(0,a);if(a!==-1||!Be(c)||!Tx(c).isDirectory())c=c.slice(0,c.lastIndexOf("/")+1)||".";while(c!=="."&&c!=="/"&&!Be(c)){let u=Ox(c);if(u===c)break;c=u}if(Be(c))i.add(c);else console.warn(`\u26A0\uFE0F Skipping watch for missing path: ${l}`)}let o=null,s=(l)=>{if(o)clearTimeout(o);o=setTimeout(async()=>{o=null,console.log(`
417
+ \uD83D\uDCDD ${l} changed, rebuilding...`),await Xr(r.current,t)},50)};for(let l of i)try{Sc(l,{recursive:!0},(a,c)=>{if(c&&/\.(?:html|js|ts|jsx|tsx|stx)$/.test(c))s(c)})}catch(a){console.warn(`\u26A0\uFE0F Could not watch ${l}:`,a instanceof Error?a.message:a)}console.log(`
418
+ \uD83D\uDC40 Watching: ${Array.from(i).join(", ")}`)}Ce.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 Zr(e.config),r=ji(t,e);if(await Xr(r,e),e.watch||r.watch)Ac(r,e)});Ce.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 Zr(e.config),r=ji(t,e);await Xr(r,e),Ac(r,e)});Ce.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(Be("./css.config.ts")&&!e.force)console.error("\u274C Config file already exists. Use --force to overwrite."),ye.exit(1);let r=`import type { CssOptions } from '@stacksjs/ts-css/engine'
419
419
 
420
420
  const config = {
421
421
  content: ['./src/**/*.{html,js,ts,jsx,tsx,stx}'],
@@ -427,6 +427,6 @@ const config = {
427
427
  export default config
428
428
  `;try{await Bun.write("./css.config.ts",r),console.log("\u2705 Created css.config.ts"),console.log(`
429
429
  Next steps:`),console.log(" 1. Update the content paths in css.config.ts"),console.log(" 2. Run: cssx build")}catch(n){console.error("\u274C Failed to create config file:",n),ye.exit(1)}});Ce.command("analyze","Analyze utility class usage").option("--config <path>","Path to config file").option("--verbose","Show detailed output").option("--json","Output as JSON").option("--top <n>","Show top N most used classes",{default:10}).example("cssx analyze").example("cssx analyze --top 20").example("cssx analyze --json").action(async(e)=>{try{let t=await Zr(e.config);if(!e.json)console.log(`\uD83D\uDD0D Analyzing utility classes...
430
- `);let r=await Mi(t),n=new Map;for(let l of r.classes)n.set(l,0);for(let l of t.content){let a=new Ox(l);for await(let c of a.scan(".")){let u;try{u=await Bun.file(c).text()}catch{continue}for(let f of r.classes){let d=u.indexOf(f);while(d!==-1)n.set(f,n.get(f)+1),d=u.indexOf(f,d+f.length)}}}let i=(l)=>{let a=l,c=a.indexOf("["),u=a.lastIndexOf(":",c===-1?a.length:c);if(u!==-1)a=a.slice(u+1);if(a.startsWith("!"))a=a.slice(1);if(a.endsWith("!"))a=a.slice(0,-1);if(a.startsWith("-"))a=a.slice(1);if(a.startsWith("["))return"arbitrary";return a.split("-")[0]||"other"},o=new Map;for(let l of r.classes){let a=i(l);if(!o.has(a))o.set(a,[]);o.get(a).push(l)}let s={totalClasses:r.classes.size,buildTime:r.duration,outputSize:Buffer.byteLength(r.css),utilityGroups:Object.fromEntries(Array.from(o.entries()).map(([l,a])=>[l,a.length]).sort((l,a)=>a[1]-l[1])),topClasses:[...n.entries()].sort((l,a)=>a[1]-l[1]).slice(0,e.top||10).map(([l,a])=>({class:l,count:a}))};if(e.json)console.log(JSON.stringify(s,null,2));else{console.log(`\uD83D\uDCCA Total classes: ${s.totalClasses}`),console.log(`\u23F1\uFE0F Build time: ${s.buildTime.toFixed(2)}ms`),console.log(`\uD83D\uDCE6 Output size: ${(s.outputSize/1024).toFixed(2)} KB
430
+ `);let r=await Mi(t),n=new Map;for(let l of r.classes)n.set(l,0);for(let l of t.content){let a=new Ix(l);for await(let c of a.scan(".")){let u;try{u=await Bun.file(c).text()}catch{continue}for(let f of r.classes){let d=u.indexOf(f);while(d!==-1)n.set(f,n.get(f)+1),d=u.indexOf(f,d+f.length)}}}let i=(l)=>{let a=l,c=a.indexOf("["),u=a.lastIndexOf(":",c===-1?a.length:c);if(u!==-1)a=a.slice(u+1);if(a.startsWith("!"))a=a.slice(1);if(a.endsWith("!"))a=a.slice(0,-1);if(a.startsWith("-"))a=a.slice(1);if(a.startsWith("["))return"arbitrary";return a.split("-")[0]||"other"},o=new Map;for(let l of r.classes){let a=i(l);if(!o.has(a))o.set(a,[]);o.get(a).push(l)}let s={totalClasses:r.classes.size,buildTime:r.duration,outputSize:Buffer.byteLength(r.css),utilityGroups:Object.fromEntries(Array.from(o.entries()).map(([l,a])=>[l,a.length]).sort((l,a)=>a[1]-l[1])),topClasses:[...n.entries()].sort((l,a)=>a[1]-l[1]).slice(0,e.top||10).map(([l,a])=>({class:l,count:a}))};if(e.json)console.log(JSON.stringify(s,null,2));else{console.log(`\uD83D\uDCCA Total classes: ${s.totalClasses}`),console.log(`\u23F1\uFE0F Build time: ${s.buildTime.toFixed(2)}ms`),console.log(`\uD83D\uDCE6 Output size: ${(s.outputSize/1024).toFixed(2)} KB
431
431
  `),console.log(`\uD83C\uDFF7\uFE0F Utility groups (top ${e.top}):`);let l=Object.entries(s.utilityGroups).slice(0,e.top||10);for(let[a,c]of l)console.log(` ${a.padEnd(20)} ${c} classes`);if(e.verbose){console.log(`
432
- \uD83D\uDCCB All classes:`);for(let a of Array.from(r.classes).sort())console.log(` - ${a}`)}}}catch(t){console.error("\u274C Analysis failed:",t),ye.exit(1)}});Ce.command("clean","Remove the output CSS file").option("--config <path>","Path to config file").option("--output <path>","Output CSS file path (defaults to the config output)").example("cssx clean").action(async(e)=>{try{let t=await Zr(e.config);if(e.output)t.output=e.output;if(!Be(t.output)){console.log("\u2139\uFE0F Output file does not exist");return}await Tx(t.output),console.log(`\u2705 Removed ${t.output}`)}catch(t){console.error("\u274C Failed to remove output file:",t),ye.exit(1)}});Ce.command("preflight","Generate preflight CSS only").option("--output <path>","Output CSS file path",{default:"./preflight.css"}).example("cssx preflight").example("cssx preflight --output ./reset.css").action(async(e)=>{try{let t=e.output||"./preflight.css",r=Xt.getCSS();await Bun.write(t,r),console.log("\u2705 Generated preflight CSS"),console.log(`\uD83D\uDCDD Output: ${t}`);let i=(Bun.file(t).size/1024).toFixed(2);console.log(`\uD83D\uDCE6 File size: ${i} KB`)}catch(t){console.error("\u274C Failed to generate preflight CSS:",t),ye.exit(1)}});Ce.command("version","Show the version of ts-css").action(()=>{console.log(cn)});Ce.version(cn);Ce.help();Ce.parse();
432
+ \uD83D\uDCCB All classes:`);for(let a of Array.from(r.classes).sort())console.log(` - ${a}`)}}}catch(t){console.error("\u274C Analysis failed:",t),ye.exit(1)}});Ce.command("clean","Remove the output CSS file").option("--config <path>","Path to config file").option("--output <path>","Output CSS file path (defaults to the config output)").example("cssx clean").action(async(e)=>{try{let t=await Zr(e.config);if(e.output)t.output=e.output;if(!Be(t.output)){console.log("\u2139\uFE0F Output file does not exist");return}await Nx(t.output),console.log(`\u2705 Removed ${t.output}`)}catch(t){console.error("\u274C Failed to remove output file:",t),ye.exit(1)}});Ce.command("preflight","Generate preflight CSS only").option("--output <path>","Output CSS file path",{default:"./preflight.css"}).example("cssx preflight").example("cssx preflight --output ./reset.css").action(async(e)=>{try{let t=e.output||"./preflight.css",r=Xt.getCSS();await Bun.write(t,r),console.log("\u2705 Generated preflight CSS"),console.log(`\uD83D\uDCDD Output: ${t}`);let i=(Bun.file(t).size/1024).toFixed(2);console.log(`\uD83D\uDCE6 File size: ${i} KB`)}catch(t){console.error("\u274C Failed to generate preflight CSS:",t),ye.exit(1)}});Ce.command("version","Show the version of ts-css").action(()=>{console.log(cn)});Ce.version(cn);Ce.help();Ce.parse();