@stacksjs/ts-css 0.3.11 → 0.3.13

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 dc=(e,t,r)=>()=>{if(e)try{t=e(e=0)}catch(n){r=[n]}if(r)throw r[0];return t};import{existsSync as wo,statSync as $o}from"fs";import{resolve as Rt}from"path";import uf from"process";import{existsSync as hf,mkdirSync as ow,readdirSync as sw,readFileSync as gf,writeFileSync as aw}from"fs";import{homedir as Qe}from"os";import{dirname as uw,resolve as xe}from"path";import kr from"process";import{existsSync as Co,statSync as Ro}from"fs";import{existsSync as Mn,mkdirSync as mf,readdirSync as pf,writeFileSync as yf}from"fs";import{homedir as et}from"os";import{dirname as ko,resolve as re}from"path";import He from"process";import{join as bf,relative as xf,resolve as So}from"path";import dr from"process";import{existsSync as ds,mkdirSync as vw,readdirSync as ww,writeFileSync as $w}from"fs";import{homedir as yn}from"os";import{dirname as kw,resolve as te}from"path";import St from"process";import{join as vf,relative as wf,resolve as Ao}from"path";import hr from"process";import{existsSync as hs,mkdirSync as Nw,readdirSync as Ow,writeFileSync as Iw}from"fs";import{dirname as _w,resolve as gr}from"path";import Fn from"process";import{Buffer as Le}from"buffer";import{createCipheriv as $f,createDecipheriv as Cf,randomBytes as bn}from"crypto";import{closeSync as xn,createReadStream as Eo,createWriteStream as Rf,existsSync as vn,fsyncSync as To,openSync as No,writeFileSync as kf}from"fs";import{access as Sf,constants as Oo,mkdir as Af,readdir as Gt,rename as Io,stat as tt,unlink as qt,writeFile as wn}from"fs/promises";import{join as rt}from"path";import Y from"process";import{pipeline as Ef}from"stream/promises";import{createGzip as Po}from"zlib";import nt from"process";import Se from"process";import{Buffer as Re}from"buffer";import{createCipheriv as Tf,createDecipheriv as Nf,randomBytes as $n}from"crypto";import{closeSync as Cn,createReadStream as _o,createWriteStream as Of,existsSync as Yt,fsyncSync as Lo,openSync as Mo,writeFileSync as If}from"fs";import{access as Pf,constants as Fo,mkdir as _f,readdir as Jt,rename as Do,stat as it,unlink as Xt,writeFile as Rn}from"fs/promises";import{isAbsolute as Lf,join as ot,resolve as Mf}from"path";import N from"process";import{pipeline as Ff}from"stream/promises";import{createGzip as jo}from"zlib";import st from"process";import Ae from"process";import Zt from"process";import{existsSync as Qt}from"fs";import{resolve as kn}from"path";import{existsSync as Df}from"fs";import{existsSync as jf,readdirSync as Bf}from"fs";import{extname as Sn,resolve as Bo}from"path";import Uf from"process";import{join as Wf,relative as Vf,resolve as Uo}from"path";import mr from"process";import{Buffer as ke}from"buffer";import{createCipheriv as zf,createDecipheriv as Kf,randomBytes as An}from"crypto";import{closeSync as En,createReadStream as Wo,createWriteStream as Hf,existsSync as er,fsyncSync as Vo,openSync as zo,writeFileSync as Gf}from"fs";import{access as qf,constants as Ko,mkdir as Yf,readdir as tr,rename as Ho,stat as at,unlink as rr,writeFile as Tn}from"fs/promises";import{isAbsolute as Jf,join as lt,resolve as Xf}from"path";import O from"process";import{pipeline as Zf}from"stream/promises";import{createGzip as Go}from"zlib";import ct from"process";import Ee from"process";import ir from"process";import{existsSync as or}from"fs";import{resolve as as}from"path";import{existsSync as bh}from"fs";class ls{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(!wo(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=wo(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 cs{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 fs(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 ff(e){return fs(e).flatMap((r)=>us.map((n)=>Rt(e.directory,`${r}${n}`)))}function df(e={}){let t=Rt(e.cwd||uf.cwd());return Array.from(new Set([t,Rt(t,"config"),Rt(t,".config"),e.configDir?Rt(t,e.configDir):void 0].filter((r)=>Boolean(r))))}function td(e,t){this[e]=ed.bind(null,t)}class Yn{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(!Co(e))return!0;return Ro(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=Co(r)?Ro(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 Jn{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 id(e,t={}){let n=Object.keys(t).sort().map((i)=>`${i}:${t[i]}`).join("|");return n?`${e}:${n}`:e}function od(e,t){try{return JSON.stringify(e)===JSON.stringify(t)}catch{return e===t}}function sd(e){return e.getStats().size*2}function Xn(e,t){if(Array.isArray(t)&&Array.isArray(e)&&t.length===2&&e.length===2&&F(t[0])&&"id"in t[0]&&t[0].id===3&&F(t[1])&&"id"in t[1]&&t[1].id===4)return t;if(F(t)&&F(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(F(e)&&"arr"in e&&Array.isArray(e.arr)&&F(t)&&"arr"in t&&Array.isArray(t.arr))return t;if(t.length>0&&e.length>0&&F(t[0])&&F(e[0])){let n=[...t];for(let i of e)if(F(i)&&"name"in i){if(!n.find((s)=>F(s)&&("name"in s)&&s.name===i.name))n.push(i)}else if(F(i)&&"path"in i){if(!n.find((s)=>F(s)&&("path"in s)&&s.path===i.path))n.push(i)}else if(!n.some((o)=>pr(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(!F(t)||!F(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(F(i)&&F(r[n]))r[n]=Xn(r[n],i);else if(Array.isArray(i)&&Array.isArray(r[n]))if(i.length>0&&r[n].length>0&&F(i[0])&&F(r[n][0])){let o=[...i];for(let s of r[n])if(F(s)&&"name"in s){if(!o.find((l)=>F(l)&&("name"in l)&&l.name===s.name))o.push(s)}else if(F(s)&&"path"in s){if(!o.find((l)=>F(l)&&("path"in l)&&l.path===s.path))o.push(s)}else if(!o.some((c)=>pr(c,s)))o.push(s);r[n]=o}else if(i.every((o)=>typeof o==="string")&&r[n].every((o)=>typeof o==="string")){let o=[...i];for(let s of r[n])if(!o.includes(s))o.push(s);r[n]=o}else r[n]=i;else r[n]=i}return r}function pr(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(!pr(e[r],t[r]))return!1;return!0}if(F(e)&&F(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(!pr(e[i],t[i]))return!1}return!0}return!1}function F(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}async function ad(e,t){if(!hs(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 Xn(t,n)}catch{return null}}catch{return null}}async function ld({name:e="",cwd:t,defaultConfig:r}){let n=t||Fn.cwd(),i=[".ts",".js",".mjs",".cjs",".json"],o=[`${e}.config`,`.${e}.config`,e,`.${e}`];for(let s of o)for(let c of i){let l=gr(n,`${s}${c}`),a=await ad(l,r);if(a!==null)return a}try{let s=gr(n,"package.json");if(hs(s)){let l=(await import(s))[e];if(l&&typeof l==="object"&&!Array.isArray(l))try{return Xn(r,l)}catch{}}}catch{}return r}function cd(e,t={}){let r=hr.cwd();while(r.includes("storage"))r=Ao(r,"..");let n=Ao(r,e||"");if(t?.relative)return wf(hr.cwd(),n);return n}async function ud(){try{let e=await ld({name:"clarity",defaultConfig:ar,cwd:hr.cwd(),endpoint:"",headers:{}});return{...ar,...e}}catch{return ar}}function B(){if(Se.env.NODE_ENV==="test"||Se.env.BUN_ENV==="test")return!1;return typeof window<"u"}async function fd(){if(Se.env.NODE_ENV==="test"||Se.env.BUN_ENV==="test")return!0;if(typeof navigator<"u"&&navigator.product==="ReactNative")return!0;if(typeof Se<"u"){let e=Se.type;if(e==="renderer"||e==="worker")return!1;return!!(Se.versions&&(Se.versions.node||Se.versions.bun))}return!1}class ms{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:nt.pid,hostname:t(),environment:nt.env.NODE_ENV||"development",platform:nt.platform,version:nt.version}}return{userAgent:navigator.userAgent,hostname:window.location.hostname||"browser",environment:nt.env.NODE_ENV||nt.env.BUN_ENV||"development",viewport:{width:window.innerWidth,height:window.innerHeight},language:navigator.language}}}class yr{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={...jn},this.options=this.normalizeOptions(t),this.formatter=this.options.formatter||new ms,this.enabled=t.enabled??!0,this.fancy=t.fancy??!0,this.tagFormat=t.tagFormat??{prefix:"[",suffix:"]"},this.timestampPosition=t.timestampPosition??"right",this.environment=t.environment??Y.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{...lr,...e.fingersCrossed};if(!e.fingersCrossedEnabled)return null;if(!e.fingersCrossed)return{...lr};return{...lr,...e.fingersCrossed}}normalizeOptions(e){let t={format:"json",level:"info",logDirectory:jn.logDirectory,rotation:void 0,timestamp:void 0,fingersCrossed:{},enabled:!0,showTags:!1,formatter:void 0},r={...t,...Object.fromEntries(Object.entries(e).filter(([,n])=>n!==void 0))};if(!r.level||!["debug","info","success","warning","error"].includes(r.level))r.level=t.level;return r}async writeToFile(e){let r=(async()=>{let i,o=0,s=3,c=1000;while(o<s)try{try{try{await Sf(this.config.logDirectory,Oo.F_OK|Oo.W_OK)}catch(a){if(a instanceof Error&&"code"in a)if(a.code==="ENOENT")await Af(this.config.logDirectory,{recursive:!0,mode:493});else if(a.code==="EACCES")throw Error(`No write permission for log directory: ${this.config.logDirectory}`);else throw a;else throw a}}catch(a){throw console.error("Debug: [writeToFile] Failed to create log directory:",a),a}let l=this.validateEncryptionConfig()?(await this.encrypt(e)).encrypted:Le.from(e);try{if(!vn(this.currentLogFile))await wn(this.currentLogFile,"",{mode:420});if(i=No(this.currentLogFile,"a",420),kf(i,l,{flag:"a"}),To(i),i!==void 0)xn(i),i=void 0;if((await tt(this.currentLogFile)).size===0){if(await wn(this.currentLogFile,l,{flag:"w",mode:420}),(await tt(this.currentLogFile)).size===0)throw Error("File exists but is empty after retry write")}return}catch(a){let u=a;if(u.code&&["ENETDOWN","ENETUNREACH","ENOTFOUND","ETIMEDOUT"].includes(u.code)){if(o<s-1){let f=typeof u.message==="string"?u.message:"Unknown error";console.error(`Network error during write attempt ${o+1}/${s}:`,f);let d=c*2**o;await new Promise((h)=>setTimeout(h,d)),o++;continue}}if(u?.code&&["ENOSPC","EDQUOT"].includes(u.code))throw Error(`Disk quota exceeded or no space left on device: ${u.message}`);throw console.error("Debug: [writeToFile] Error writing to file:",u),u}finally{if(i!==void 0)try{xn(i)}catch(a){console.error("Debug: [writeToFile] Error closing file descriptor:",a)}}}catch(l){if(o===s-1){let u=l,f=typeof u.message==="string"?u.message:"Unknown error";throw console.error("Debug: [writeToFile] Max retries reached. Final error:",f),l}o++;let a=c*2**(o-1);await new Promise((u)=>setTimeout(u,a))}})();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 rt(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 rt(this.config.logDirectory,`${this.name}.log`);let e=new Date().toISOString().split("T")[0];return rt(this.config.logDirectory,`${this.name}-${e}.log`)}setupRotation(){if(B())return;if(typeof this.config.rotation==="boolean")return;let e=this.config.rotation,t;switch(e.frequency){case"daily":t=86400000;break;case"weekly":t=604800000;break;case"monthly":t=2592000000;break;default:return}this.rotationTimeout=setInterval(()=>{this.rotateLog()},t)}setupKeyRotation(){if(!this.validateEncryptionConfig()){console.error("Invalid encryption configuration detected during key rotation setup");return}let t=this.config.rotation.keyRotation;if(!t?.enabled)return;let r=typeof t.interval==="number"?t.interval:60,n=Math.max(r,60)*1000;this.keyRotationTimeout=setInterval(()=>{this.rotateKeys().catch((i)=>{console.error("Error rotating keys:",i)})},n)}async rotateKeys(){if(!this.validateEncryptionConfig()){console.error("Invalid encryption configuration detected during key rotation");return}let t=this.config.rotation.keyRotation,r=this.generateKeyId(),n=this.generateKey();this.currentKeyId=r,this.keys.set(r,n),this.encryptionKeys.set(r,{key:n,createdAt:new Date});let i=Array.from(this.encryptionKeys.entries()).sort(([,c],[,l])=>l.createdAt.getTime()-c.createdAt.getTime()),o=typeof t.maxKeys==="number"?t.maxKeys:1,s=Math.max(1,o);if(i.length>s)for(let[c]of i.slice(s))this.encryptionKeys.delete(c),this.keys.delete(c)}generateKeyId(){return bn(16).toString("hex")}generateKey(){return bn(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=bn(16),n=$f("aes-256-gcm",t,r),i=Le.concat([n.update(e,"utf8"),n.final()]),o=n.getAuthTag();return{encrypted:Le.concat([r,i,o]),iv:r}}async compressData(e){return new Promise((t,r)=>{let n=Po(),i=[];n.on("data",(o)=>i.push(o)),n.on("end",()=>t(Le.from(Le.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(B())return;let e=await tt(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 Gt(this.config.logDirectory),o=i.filter((l)=>l.startsWith(this.name)&&/\.log\.\d+$/.test(l)).sort((l,a)=>{let u=Number.parseInt(l.match(/\.log\.(\d+)$/)?.[1]||"0");return Number.parseInt(a.match(/\.log\.(\d+)$/)?.[1]||"0")-u}),s=o.length>0?Number.parseInt(o[0].match(/\.log\.(\d+)$/)?.[1]||"0")+1:1,c=`${r}.${s}`;if(await tt(r).catch(()=>null))try{if(await Io(r,c),t.compress)try{let l=`${c}.gz`;await this.compressLogFile(c,l),await qt(c)}catch(l){console.error("Error compressing rotated file:",l)}if(o.length===0&&!i.some((l)=>l.endsWith(".log.1")))try{let l=`${r}.1`;await wn(l,"")}catch(l){console.error("Error creating backup file:",l)}}catch(l){console.error(`Error during rotation: ${l instanceof Error?l.message:String(l)}`)}}else{let i=new Date().toISOString().replace(/[:.]/g,"-"),o=r.replace(/\.log$/,`-${i}.log`);if(await tt(r).catch(()=>null))await Io(r,o)}if(this.currentLogFile=n,t.maxFiles){let o=(await Gt(this.config.logDirectory)).filter((s)=>s.startsWith(this.name)).sort((s,c)=>c.localeCompare(s));for(let s of o.slice(t.maxFiles))await qt(rt(this.config.logDirectory,s))}}}async compressLogFile(e,t){let r=Eo(e),n=Rf(t),i=Po();await Ef(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()})),vn(this.currentLogFile))try{let e=No(this.currentLogFile,"r+");To(e),xn(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(!B()&&this.config.rotation&&typeof this.config.rotation!=="boolean"&&this.config.rotation.compress)try{let t=(await Gt(this.config.logDirectory)).filter((r)=>(r.includes("temp")||r.includes(".tmp"))&&r.includes(this.name));for(let r of t)try{await qt(rt(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?_.gray(e.toLocaleTimeString()):e.toLocaleTimeString()}formatConsoleMessage(e){let{timestamp:t,icon:r="",tag:n="",message:i,level:o,showTimestamp:s=!0}=e,c=(h)=>h.replace(this.ANSI_PATTERN,"");if(!this.fancy){let h=[];if(s)h.push(t);if(o==="warning")h.push("WARN");else if(o==="error")h.push("ERROR");else if(r)h.push(r.replace(/[^\p{L}\p{N}\p{P}\p{Z}]/gu,""));if(n)h.push(n.replace(/[[\]]/g,""));return h.push(i),h.join(" ")}let l=Y.stdout.columns||120,a="";if(o==="warning"||o==="error")a=`${r} ${i}`;else if(o==="info"||o==="success")a=`${r} ${n} ${i}`;else a=`${r} ${n} ${_.cyan(i)}`;if(!s)return a.trim();let u=c(a).trim().length,f=c(t).length,d=Math.max(1,l-2-u-f);return`${a.trim()}${" ".repeat(d)}${t}`}formatMessage(e,t){if(t.length===1&&Array.isArray(t[0]))return e.replace(/\{(\d+)\}/g,(o,s)=>{let c=Number.parseInt(s,10);return c<t[0].length?String(t[0][c]):o});let r=/%([sdijfo%])/g,n=0,i=e.replace(r,(o,s)=>{if(s==="%")return"%";if(n>=t.length)return o;let c=t[n++];switch(s){case"s":return String(c);case"d":case"i":return Number(c).toString();case"j":case"o":return JSON.stringify(c,null,2);default:return o}});if(n<t.length)i+=` ${t.slice(n).map((o)=>typeof o==="object"?JSON.stringify(o,null,2):String(o)).join(" ")}`;return i}async log(e,t,...r){let n=new Date,i=this.formatConsoleTimestamp(n),o=this.formatFileTimestamp(n),s,c;if(t instanceof Error)s=t.message,c=t.stack;else s=this.formatMessage(t,r);if(this.fancy&&!B()){let a=ks[e],u=this.options.showTags!==!1&&this.name?_.gray(this.formatTag(this.name)):"",f;switch(e){case"debug":f=this.formatConsoleMessage({timestamp:i,icon:a,tag:u,message:_.gray(s),level:e}),console.error(f);break;case"info":f=this.formatConsoleMessage({timestamp:i,icon:a,tag:u,message:s,level:e}),console.error(f);break;case"success":f=this.formatConsoleMessage({timestamp:i,icon:a,tag:u,message:_.green(s),level:e}),console.error(f);break;case"warning":f=this.formatConsoleMessage({timestamp:i,icon:a,tag:u,message:s,level:e}),console.warn(f);break;case"error":if(f=this.formatConsoleMessage({timestamp:i,icon:a,tag:u,message:s,level:e}),console.error(f),c){let d=c.split(`
3
+ var gc=(e,t,r)=>()=>{if(e)try{t=e(e=0)}catch(n){r=[n]}if(r)throw r[0];return t};import{existsSync as Co,statSync as Ro}from"fs";import{resolve as St}from"path";import df from"process";import{existsSync as mf,mkdirSync as aw,readdirSync as lw,readFileSync as pf,writeFileSync as cw}from"fs";import{homedir as et}from"os";import{dirname as dw,resolve as ve}from"path";import Ar from"process";import{existsSync as ko,statSync as So}from"fs";import{existsSync as Dn,mkdirSync as yf,readdirSync as bf,writeFileSync as xf}from"fs";import{homedir as tt}from"os";import{dirname as Ao,resolve as ne}from"path";import Ge from"process";import{join as vf,relative as wf,resolve as Eo}from"path";import gr from"process";import{existsSync as gs,mkdirSync as $w,readdirSync as Cw,writeFileSync as Rw}from"fs";import{homedir as xn}from"os";import{dirname as Aw,resolve as re}from"path";import Et from"process";import{join as $f,relative as Cf,resolve as To}from"path";import mr from"process";import{existsSync as ms,mkdirSync as Iw,readdirSync as Pw,writeFileSync as _w}from"fs";import{dirname as Mw,resolve as pr}from"path";import jn from"process";import{Buffer as Me}from"buffer";import{createCipheriv as Rf,createDecipheriv as kf,randomBytes as vn}from"crypto";import{closeSync as wn,createReadStream as No,createWriteStream as Sf,existsSync as $n,fsyncSync as Oo,openSync as Io,writeFileSync as Af}from"fs";import{access as Ef,constants as Po,mkdir as Tf,readdir as Yt,rename as _o,stat as rt,unlink as Jt,writeFile as Cn}from"fs/promises";import{join as nt}from"path";import J from"process";import{pipeline as Nf}from"stream/promises";import{createGzip as Lo}from"zlib";import it from"process";import Ae from"process";import{Buffer as ke}from"buffer";import{createCipheriv as Of,createDecipheriv as If,randomBytes as Rn}from"crypto";import{closeSync as kn,createReadStream as Mo,createWriteStream as Pf,existsSync as Xt,fsyncSync as Fo,openSync as Do,writeFileSync as _f}from"fs";import{access as Lf,constants as jo,mkdir as Mf,readdir as Zt,rename as Bo,stat as ot,unlink as Qt,writeFile as Sn}from"fs/promises";import{isAbsolute as Ff,join as st,resolve as Df}from"path";import N from"process";import{pipeline as jf}from"stream/promises";import{createGzip as Uo}from"zlib";import at from"process";import Ee from"process";import er from"process";import{existsSync as tr}from"fs";import{resolve as An}from"path";import{existsSync as Bf}from"fs";import{existsSync as Uf,readdirSync as Vf}from"fs";import{extname as En,resolve as Vo}from"path";import Wf from"process";import{join as zf,relative as Kf,resolve as Wo}from"path";import yr from"process";import{Buffer as Se}from"buffer";import{createCipheriv as Hf,createDecipheriv as Gf,randomBytes as Tn}from"crypto";import{closeSync as Nn,createReadStream as zo,createWriteStream as qf,existsSync as rr,fsyncSync as Ko,openSync as Ho,writeFileSync as Yf}from"fs";import{access as Jf,constants as Go,mkdir as Xf,readdir as nr,rename as qo,stat as lt,unlink as ir,writeFile as On}from"fs/promises";import{isAbsolute as Zf,join as ct,resolve as Qf}from"path";import O from"process";import{pipeline as ed}from"stream/promises";import{createGzip as Yo}from"zlib";import ut from"process";import Te from"process";import sr from"process";import{existsSync as ar}from"fs";import{resolve as cs}from"path";import{existsSync as vh}from"fs";class us{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(!Co(e))return!0;return Ro(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=Co(r)?Ro(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 fs{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 hs(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 hf(e){return hs(e).flatMap((r)=>ds.map((n)=>St(e.directory,`${r}${n}`)))}function gf(e={}){let t=St(e.cwd||df.cwd());return Array.from(new Set([t,St(t,"config"),St(t,".config"),e.configDir?St(t,e.configDir):void 0].filter((r)=>Boolean(r))))}function nd(e,t){this[e]=rd.bind(null,t)}class Xn{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(!ko(e))return!0;return So(e).mtime>t}catch{return!0}}getWithFileCheck(e,t){let r=this.get(e,t);if(!r)return;if(this.isFileModified(t,r.fileTimestamp)){this.delete(e,t);return}return r.value}setWithFileCheck(e,t,r,n){try{let i=ko(r)?So(r):null,o=i?i.mtime:new Date;this.set(e,{value:t,fileTimestamp:o},r,n)}catch{this.set(e,t,r,n)}}delete(e,t){let r=this.generateKey(e,t);return this.cache.delete(r)}clear(){this.cache.clear(),this.totalHits=0,this.totalMisses=0}cleanup(){let e=0;for(let[t,r]of this.cache.entries())if(this.isExpired(r))this.cache.delete(t),e++;return e}getStats(){let e=Array.from(this.cache.values()),t=e.reduce((n,i)=>n+i.size,0),r=e.map((n)=>n.timestamp).sort();return{size:t,maxSize:this.options.maxSize,hitRate:this.totalHits+this.totalMisses>0?this.totalHits/(this.totalHits+this.totalMisses):0,totalHits:this.totalHits,totalMisses:this.totalMisses,entries:this.cache.size,oldestEntry:r[0],newestEntry:r[r.length-1]}}export(){let e={};for(let[t,r]of this.cache.entries())e[t]={value:r.value,timestamp:r.timestamp.toISOString(),ttl:r.ttl,hits:r.hits,size:r.size};return e}import(e){this.cache.clear();for(let[t,r]of Object.entries(e))if(typeof r==="object"&&r!==null){let n=r;this.cache.set(t,{value:n.value,timestamp:new Date(n.timestamp),ttl:n.ttl,hits:n.hits,size:n.size})}}}class Zn{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 sd(e,t={}){let n=Object.keys(t).sort().map((i)=>`${i}:${t[i]}`).join("|");return n?`${e}:${n}`:e}function ad(e,t){try{return JSON.stringify(e)===JSON.stringify(t)}catch{return e===t}}function ld(e){return e.getStats().size*2}function Qn(e,t){if(Array.isArray(t)&&Array.isArray(e)&&t.length===2&&e.length===2&&F(t[0])&&"id"in t[0]&&t[0].id===3&&F(t[1])&&"id"in t[1]&&t[1].id===4)return t;if(F(t)&&F(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(F(e)&&"arr"in e&&Array.isArray(e.arr)&&F(t)&&"arr"in t&&Array.isArray(t.arr))return t;if(t.length>0&&e.length>0&&F(t[0])&&F(e[0])){let n=[...t];for(let i of e)if(F(i)&&"name"in i){if(!n.find((s)=>F(s)&&("name"in s)&&s.name===i.name))n.push(i)}else if(F(i)&&"path"in i){if(!n.find((s)=>F(s)&&("path"in s)&&s.path===i.path))n.push(i)}else if(!n.some((o)=>br(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(!F(t)||!F(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(F(i)&&F(r[n]))r[n]=Qn(r[n],i);else if(Array.isArray(i)&&Array.isArray(r[n]))if(i.length>0&&r[n].length>0&&F(i[0])&&F(r[n][0])){let o=[...i];for(let s of r[n])if(F(s)&&"name"in s){if(!o.find((l)=>F(l)&&("name"in l)&&l.name===s.name))o.push(s)}else if(F(s)&&"path"in s){if(!o.find((l)=>F(l)&&("path"in l)&&l.path===s.path))o.push(s)}else if(!o.some((c)=>br(c,s)))o.push(s);r[n]=o}else if(i.every((o)=>typeof o==="string")&&r[n].every((o)=>typeof o==="string")){let o=[...i];for(let s of r[n])if(!o.includes(s))o.push(s);r[n]=o}else r[n]=i;else r[n]=i}return r}function br(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(!br(e[r],t[r]))return!1;return!0}if(F(e)&&F(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(!br(e[i],t[i]))return!1}return!0}return!1}function F(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}async function cd(e,t){if(!ms(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 Qn(t,n)}catch{return null}}catch{return null}}async function ud({name:e="",cwd:t,defaultConfig:r}){let n=t||jn.cwd(),i=[".ts",".js",".mjs",".cjs",".json"],o=[`${e}.config`,`.${e}.config`,e,`.${e}`];for(let s of o)for(let c of i){let l=pr(n,`${s}${c}`),a=await cd(l,r);if(a!==null)return a}try{let s=pr(n,"package.json");if(ms(s)){let l=(await import(s))[e];if(l&&typeof l==="object"&&!Array.isArray(l))try{return Qn(r,l)}catch{}}}catch{}return r}function fd(e,t={}){let r=mr.cwd();while(r.includes("storage"))r=To(r,"..");let n=To(r,e||"");if(t?.relative)return Cf(mr.cwd(),n);return n}async function dd(){try{let e=await ud({name:"clarity",defaultConfig:cr,cwd:mr.cwd(),endpoint:"",headers:{}});return{...cr,...e}}catch{return cr}}function B(){if(Ae.env.NODE_ENV==="test"||Ae.env.BUN_ENV==="test")return!1;return typeof window<"u"}async function hd(){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 ys{async format(e){let t=await hd(),r=await this.getMetadata(t);return JSON.stringify({timestamp:e.timestamp.toISOString(),level:e.level,name:e.name,message:e.message,metadata:r})}async getMetadata(e){if(e){let{hostname:t}=await import("os");return{pid:it.pid,hostname:t(),environment:it.env.NODE_ENV||"development",platform:it.platform,version:it.version}}return{userAgent:navigator.userAgent,hostname:window.location.hostname||"browser",environment:it.env.NODE_ENV||it.env.BUN_ENV||"development",viewport:{width:window.innerWidth,height:window.innerHeight},language:navigator.language}}}class xr{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={...Un},this.options=this.normalizeOptions(t),this.formatter=this.options.formatter||new ys,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{...ur,...e.fingersCrossed};if(!e.fingersCrossedEnabled)return null;if(!e.fingersCrossed)return{...ur};return{...ur,...e.fingersCrossed}}normalizeOptions(e){let t={format:"json",level:"info",logDirectory:Un.logDirectory,rotation:void 0,timestamp:void 0,fingersCrossed:{},enabled:!0,showTags:!1,formatter:void 0},r={...t,...Object.fromEntries(Object.entries(e).filter(([,n])=>n!==void 0))};if(!r.level||!["debug","info","success","warning","error"].includes(r.level))r.level=t.level;return r}async writeToFile(e){let r=(async()=>{let i,o=0,s=3,c=1000;while(o<s)try{try{try{await Ef(this.config.logDirectory,Po.F_OK|Po.W_OK)}catch(a){if(a instanceof Error&&"code"in a)if(a.code==="ENOENT")await Tf(this.config.logDirectory,{recursive:!0,mode:493});else if(a.code==="EACCES")throw Error(`No write permission for log directory: ${this.config.logDirectory}`);else throw a;else throw a}}catch(a){throw console.error("Debug: [writeToFile] Failed to create log directory:",a),a}let l=this.validateEncryptionConfig()?(await this.encrypt(e)).encrypted:Me.from(e);try{if(!$n(this.currentLogFile))await Cn(this.currentLogFile,"",{mode:420});if(i=Io(this.currentLogFile,"a",420),Af(i,l,{flag:"a"}),Oo(i),i!==void 0)wn(i),i=void 0;if((await rt(this.currentLogFile)).size===0){if(await Cn(this.currentLogFile,l,{flag:"w",mode:420}),(await rt(this.currentLogFile)).size===0)throw Error("File exists but is empty after retry write")}return}catch(a){let u=a;if(u.code&&["ENETDOWN","ENETUNREACH","ENOTFOUND","ETIMEDOUT"].includes(u.code)){if(o<s-1){let f=typeof u.message==="string"?u.message:"Unknown error";console.error(`Network error during write attempt ${o+1}/${s}:`,f);let d=c*2**o;await new Promise((h)=>setTimeout(h,d)),o++;continue}}if(u?.code&&["ENOSPC","EDQUOT"].includes(u.code))throw Error(`Disk quota exceeded or no space left on device: ${u.message}`);throw console.error("Debug: [writeToFile] Error writing to file:",u),u}finally{if(i!==void 0)try{wn(i)}catch(a){console.error("Debug: [writeToFile] Error closing file descriptor:",a)}}}catch(l){if(o===s-1){let u=l,f=typeof u.message==="string"?u.message:"Unknown error";throw console.error("Debug: [writeToFile] Max retries reached. Final error:",f),l}o++;let a=c*2**(o-1);await new Promise((u)=>setTimeout(u,a))}})();this.pendingOperations.push(r);let n=this.pendingOperations.length-1;try{await r}catch(i){throw console.error("Debug: [writeToFile] Error in operation:",i),i}finally{this.pendingOperations.splice(n,1)}}generateLogFilename(){if(this.name.includes("stream-throughput")||this.name.includes("decompress-perf-test")||this.name.includes("decompression-latency")||this.name.includes("concurrent-read-test")||this.name.includes("clock-change-test"))return nt(this.config.logDirectory,`${this.name}.log`);if(this.name.includes("pending-test")||this.name.includes("temp-file-test")||this.name==="crash-test"||this.name==="corrupt-test"||this.name.includes("rotation-load-test")||this.name==="sigterm-test"||this.name==="sigint-test"||this.name==="failed-rotation-test"||this.name==="integration-test")return nt(this.config.logDirectory,`${this.name}.log`);let e=new Date().toISOString().split("T")[0];return nt(this.config.logDirectory,`${this.name}-${e}.log`)}setupRotation(){if(B())return;if(typeof this.config.rotation==="boolean")return;let e=this.config.rotation,t;switch(e.frequency){case"daily":t=86400000;break;case"weekly":t=604800000;break;case"monthly":t=2592000000;break;default:return}this.rotationTimeout=setInterval(()=>{this.rotateLog()},t)}setupKeyRotation(){if(!this.validateEncryptionConfig()){console.error("Invalid encryption configuration detected during key rotation setup");return}let t=this.config.rotation.keyRotation;if(!t?.enabled)return;let r=typeof t.interval==="number"?t.interval:60,n=Math.max(r,60)*1000;this.keyRotationTimeout=setInterval(()=>{this.rotateKeys().catch((i)=>{console.error("Error rotating keys:",i)})},n)}async rotateKeys(){if(!this.validateEncryptionConfig()){console.error("Invalid encryption configuration detected during key rotation");return}let t=this.config.rotation.keyRotation,r=this.generateKeyId(),n=this.generateKey();this.currentKeyId=r,this.keys.set(r,n),this.encryptionKeys.set(r,{key:n,createdAt:new Date});let i=Array.from(this.encryptionKeys.entries()).sort(([,c],[,l])=>l.createdAt.getTime()-c.createdAt.getTime()),o=typeof t.maxKeys==="number"?t.maxKeys:1,s=Math.max(1,o);if(i.length>s)for(let[c]of i.slice(s))this.encryptionKeys.delete(c),this.keys.delete(c)}generateKeyId(){return vn(16).toString("hex")}generateKey(){return vn(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=vn(16),n=Rf("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=Lo(),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(B())return;let e=await rt(this.currentLogFile).catch(()=>null);if(!e)return;let t=this.config.rotation;if(typeof t==="boolean")return;if(t.maxSize&&e.size>=t.maxSize){let r=this.currentLogFile,n=this.generateLogFilename();if(this.name.includes("rotation-load-test")||this.name==="failed-rotation-test"){let i=await Yt(this.config.logDirectory),o=i.filter((l)=>l.startsWith(this.name)&&/\.log\.\d+$/.test(l)).sort((l,a)=>{let u=Number.parseInt(l.match(/\.log\.(\d+)$/)?.[1]||"0");return Number.parseInt(a.match(/\.log\.(\d+)$/)?.[1]||"0")-u}),s=o.length>0?Number.parseInt(o[0].match(/\.log\.(\d+)$/)?.[1]||"0")+1:1,c=`${r}.${s}`;if(await rt(r).catch(()=>null))try{if(await _o(r,c),t.compress)try{let l=`${c}.gz`;await this.compressLogFile(c,l),await Jt(c)}catch(l){console.error("Error compressing rotated file:",l)}if(o.length===0&&!i.some((l)=>l.endsWith(".log.1")))try{let l=`${r}.1`;await Cn(l,"")}catch(l){console.error("Error creating backup file:",l)}}catch(l){console.error(`Error during rotation: ${l instanceof Error?l.message:String(l)}`)}}else{let i=new Date().toISOString().replace(/[:.]/g,"-"),o=r.replace(/\.log$/,`-${i}.log`);if(await rt(r).catch(()=>null))await _o(r,o)}if(this.currentLogFile=n,t.maxFiles){let o=(await Yt(this.config.logDirectory)).filter((s)=>s.startsWith(this.name)).sort((s,c)=>c.localeCompare(s));for(let s of o.slice(t.maxFiles))await Jt(nt(this.config.logDirectory,s))}}}async compressLogFile(e,t){let r=No(e),n=Sf(t),i=Lo();await Nf(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()})),$n(this.currentLogFile))try{let e=Io(this.currentLogFile,"r+");Oo(e),wn(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(!B()&&this.config.rotation&&typeof this.config.rotation!=="boolean"&&this.config.rotation.compress)try{let t=(await Yt(this.config.logDirectory)).filter((r)=>(r.includes("temp")||r.includes(".tmp"))&&r.includes(this.name));for(let r of t)try{await Jt(nt(this.config.logDirectory,r))}catch(n){console.error(`Failed to delete temp file ${r}:`,n)}}catch(e){console.error("Error cleaning up temporary files:",e)}})()}getCurrentLogFilePath(){return this.currentLogFile}formatTag(e){if(!e)return"";return`${this.tagFormat.prefix}${e}${this.tagFormat.suffix}`}formatFileTimestamp(e){return`[${e.toISOString()}]`}formatConsoleTimestamp(e){return this.fancy?_.gray(e.toLocaleTimeString()):e.toLocaleTimeString()}formatConsoleMessage(e){let{timestamp:t,icon:r="",tag:n="",message:i,level:o,showTimestamp:s=!0}=e,c=(h)=>h.replace(this.ANSI_PATTERN,"");if(!this.fancy){let h=[];if(s)h.push(t);if(o==="warning")h.push("WARN");else if(o==="error")h.push("ERROR");else if(r)h.push(r.replace(/[^\p{L}\p{N}\p{P}\p{Z}]/gu,""));if(n)h.push(n.replace(/[[\]]/g,""));return h.push(i),h.join(" ")}let l=J.stdout.columns||120,a="";if(o==="warning"||o==="error")a=`${r} ${i}`;else if(o==="info"||o==="success")a=`${r} ${n} ${i}`;else a=`${r} ${n} ${_.cyan(i)}`;if(!s)return a.trim();let u=c(a).trim().length,f=c(t).length,d=Math.max(1,l-2-u-f);return`${a.trim()}${" ".repeat(d)}${t}`}formatMessage(e,t){if(t.length===1&&Array.isArray(t[0]))return e.replace(/\{(\d+)\}/g,(o,s)=>{let c=Number.parseInt(s,10);return c<t[0].length?String(t[0][c]):o});let r=/%([sdijfo%])/g,n=0,i=e.replace(r,(o,s)=>{if(s==="%")return"%";if(n>=t.length)return o;let c=t[n++];switch(s){case"s":return String(c);case"d":case"i":return Number(c).toString();case"j":case"o":return JSON.stringify(c,null,2);default:return o}});if(n<t.length)i+=` ${t.slice(n).map((o)=>typeof o==="object"?JSON.stringify(o,null,2):String(o)).join(" ")}`;return i}async log(e,t,...r){let n=new Date,i=this.formatConsoleTimestamp(n),o=this.formatFileTimestamp(n),s,c;if(t instanceof Error)s=t.message,c=t.stack;else s=this.formatMessage(t,r);if(this.fancy&&!B()){let a=As[e],u=this.options.showTags!==!1&&this.name?_.gray(this.formatTag(this.name)):"",f;switch(e){case"debug":f=this.formatConsoleMessage({timestamp:i,icon:a,tag:u,message:_.gray(s),level:e}),console.error(f);break;case"info":f=this.formatConsoleMessage({timestamp:i,icon:a,tag:u,message:s,level:e}),console.error(f);break;case"success":f=this.formatConsoleMessage({timestamp:i,icon:a,tag:u,message:_.green(s),level:e}),console.error(f);break;case"warning":f=this.formatConsoleMessage({timestamp:i,icon:a,tag:u,message:s,level:e}),console.warn(f);break;case"error":if(f=this.formatConsoleMessage({timestamp:i,icon:a,tag:u,message:s,level:e}),console.error(f),c){let d=c.split(`
4
4
  `);for(let h of d)if(h.trim()&&!h.includes(s))console.error(this.formatConsoleMessage({timestamp:i,message:_.gray(` ${h}`),level:e,showTimestamp:!1}))}break}}else if(!B()){if(console.error(`${o} ${this.environment}.${e.toUpperCase()}: ${s}`),c)console.error(c)}if(!this.shouldLog(e))return;let l=`${o} ${this.environment}.${e.toUpperCase()}: ${s}
5
5
  `;if(c)l+=`${c}
6
6
  `;l=l.replace(this.ANSI_PATTERN,""),await this.writeToFile(l)}time(e){let t=performance.now();if(this.fancy&&!B()){let r=this.options.showTags!==!1&&this.name?_.gray(this.formatTag(this.name)):"",n=this.formatConsoleTimestamp(new Date);console.error(this.formatConsoleMessage({timestamp:n,icon:_.blue("\u25D0"),tag:r,message:`${_.cyan(e)}...`}))}return async(r)=>{if(!this.enabled)return;let n=performance.now(),i=Math.round(n-t),o=`${e} completed in ${i}ms`,s=new Date,c=this.formatConsoleTimestamp(s),a=`${this.formatFileTimestamp(s)} ${this.environment}.INFO: ${o}`;if(r)a+=` ${JSON.stringify(r)}`;if(a+=`
7
- `,a=a.replace(this.ANSI_PATTERN,""),this.fancy&&!B()){let u=this.options.showTags!==!1&&this.name?_.gray(this.formatTag(this.name)):"";console.error(this.formatConsoleMessage({timestamp:c,icon:_.green("\u2713"),tag:u,message:`${o}${r?` ${JSON.stringify(r)}`:""}`}))}else if(!B())console.error(a.trim());await this.writeToFile(a)}}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 yr(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(B())throw Error("createReadStream is not supported in browser environments");if(!vn(this.currentLogFile))throw Error(`Log file does not exist: ${this.currentLogFile}`);return Eo(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=Le.isBuffer(e)?e:Le.from(e,"base64"),i=n.slice(0,16),o=n.slice(-16),s=n.slice(16,-16),c=Cf("aes-256-gcm",r,i);return c.setAuthTag(o),Le.concat([c.update(s),c.final()]).toString("utf8")}catch(n){throw Error(`Decryption failed: ${n instanceof Error?n.message:String(n)}`)}}getLevel(){return this.config.level}getLogDirectory(){return this.config.logDirectory}getFormat(){return this.config.format}getRotationConfig(){return this.config.rotation}isBrowserMode(){return B()}isServerMode(){return!B()}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&&!B()){let o=e.split(`
7
+ `,a=a.replace(this.ANSI_PATTERN,""),this.fancy&&!B()){let u=this.options.showTags!==!1&&this.name?_.gray(this.formatTag(this.name)):"";console.error(this.formatConsoleMessage({timestamp:c,icon:_.green("\u2713"),tag:u,message:`${o}${r?` ${JSON.stringify(r)}`:""}`}))}else if(!B())console.error(a.trim());await this.writeToFile(a)}}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 xr(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(B())throw Error("createReadStream is not supported in browser environments");if(!$n(this.currentLogFile))throw Error(`Log file does not exist: ${this.currentLogFile}`);return No(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),c=kf("aes-256-gcm",r,i);return c.setAuthTag(o),Me.concat([c.update(s),c.final()]).toString("utf8")}catch(n){throw Error(`Decryption failed: ${n instanceof Error?n.message:String(n)}`)}}getLevel(){return this.config.level}getLogDirectory(){return this.config.logDirectory}getFormat(){return this.config.format}getRotationConfig(){return this.config.rotation}isBrowserMode(){return B()}isServerMode(){return!B()}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&&!B()){let o=e.split(`
8
8
  `),s=Math.max(...o.map((u)=>u.length))+2,c=`\u250C${"\u2500".repeat(s)}\u2510`,l=`\u2514${"\u2500".repeat(s)}\u2518`,a=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:_.gray(this.formatTag(this.name)),showTimestamp:!1}));console.error(this.formatConsoleMessage({timestamp:r,message:_.cyan(c)})),a.forEach((u)=>console.error(this.formatConsoleMessage({timestamp:r,message:_.cyan(u),showTimestamp:!1}))),console.error(this.formatConsoleMessage({timestamp:r,message:_.cyan(l),showTimestamp:!1}))}else if(!B())console.error(`${n} ${this.environment}.INFO: [BOX] ${e}`);let i=`${n} ${this.environment}.INFO: [BOX] ${e}
9
- `.replace(this.ANSI_PATTERN,"");await this.writeToFile(i)}async prompt(e){if(B())return Promise.resolve(!0);return new Promise((t)=>{console.error(`${_.cyan("?")} ${e} (y/n) `);let r=(n)=>{let i=n.toString().trim().toLowerCase();Y.stdin.removeListener("data",r);try{if(typeof Y.stdin.setRawMode==="function")Y.stdin.setRawMode(!1)}catch{}Y.stdin.pause(),console.error(""),t(i==="y"||i==="yes")};try{if(typeof Y.stdin.setRawMode==="function")Y.stdin.setRawMode(!0)}catch{}Y.stdin.resume(),Y.stdin.once("data",r)})}setFancy(e){this.fancy=e}isFancy(){return this.fancy}pause(){this.enabled=!1}resume(){this.enabled=!0}async start(e,...t){if(!this.enabled)return;let r=e;if(t&&t.length>0){let s=/%([sdijfo%])/g,c=0;if(r=e.replace(s,(l,a)=>{if(a==="%")return"%";if(c>=t.length)return l;let u=t[c++];switch(a){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 l}}),c<t.length)r+=` ${t.slice(c).map((l)=>typeof l==="object"?JSON.stringify(l,null,2):String(l)).join(" ")}`}if(this.fancy&&!B()){let s=this.options.showTags!==!1&&this.name?_.gray(this.formatTag(this.name)):"",c=_.blue("\u25D0");console.error(`${c} ${s} ${_.cyan(r)}`)}let o=`[${new Date().toISOString()}] ${this.environment}.INFO: [START] ${r}
10
- `.replace(this.ANSI_PATTERN,"");await this.writeToFile(o)}progress(e,t=""){if(!this.enabled||!this.fancy||B()||e<=0)return{update:()=>{},finish:()=>{},interrupt:()=>{}};if(this.activeProgressBar)console.warn("Warning: Another progress bar is already active. Finishing the previous one."),this.finishProgressBar(this.activeProgressBar,"[Auto-finished]");let r=20;return this.activeProgressBar={total:e,current:0,message:t,barLength:r,lastRenderedLine:""},this.renderProgressBar(this.activeProgressBar),{update:(s,c)=>{if(!this.activeProgressBar||!this.enabled||!this.fancy||B())return;if(this.activeProgressBar.current=Math.max(0,Math.min(e,s)),c!==void 0)this.activeProgressBar.message=c;let l=this.activeProgressBar.current===this.activeProgressBar.total;this.renderProgressBar(this.activeProgressBar,l)},finish:(s)=>{if(!this.activeProgressBar||!this.enabled||!this.fancy||B())return;if(this.activeProgressBar.current=this.activeProgressBar.total,s!==void 0)this.activeProgressBar.message=s;this.renderProgressBar(this.activeProgressBar,!0),this.finishProgressBar(this.activeProgressBar)},interrupt:(s,c="info")=>{if(!this.activeProgressBar||!this.enabled||!this.fancy||B())return;Y.stdout.write(`${"\r".padEnd(Y.stdout.columns||80)}\r`),this.log(c,s),setTimeout(()=>{if(this.activeProgressBar)this.renderProgressBar(this.activeProgressBar)},50)}}}renderProgressBar(e,t=!1){if(!this.enabled||!this.fancy||B()||!Y.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=_.green("\u2501".repeat(n)),s=_.gray("\u2501".repeat(i)),c=`[${o}${s}]`,l=`${r}%`.padStart(4),a=e.message?` ${e.message}`:"",u=t||r===100?_.green("\u2713"):_.blue("\u25B6"),f=this.options.showTags!==!1&&this.name?` ${_.gray(this.formatTag(this.name))}`:"",d=`\r${u}${f} ${c} ${l}${a}`,h=Y.stdout.columns||80,p=" ".repeat(Math.max(0,h-d.replace(this.ANSI_PATTERN,"").length));if(e.lastRenderedLine=`${d}${p}`,Y.stdout.write(e.lastRenderedLine),t)Y.stdout.write(`
11
- `)}finishProgressBar(e,t){if(!this.enabled||!this.fancy||B()||!Y.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(B()){console.warn("Log clearing is not supported in browser environments.");return}try{console.warn("Clearing logs...",this.config.logDirectory);let t=await Gt(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=rt(this.config.logDirectory,n);if(e.before)try{if((await tt(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 sr(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)=>br(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]=sr(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((l)=>I(l)&&("name"in l)&&l.name===s.name))o.push(s)}else if(I(s)&&"path"in s){if(!o.find((l)=>I(l)&&("path"in l)&&l.path===s.path))o.push(s)}else if(!o.some((c)=>br(c,s)))o.push(s);r[n]=o}else if(i.every((o)=>typeof o==="string")&&r[n].every((o)=>typeof o==="string")){let o=[...i];for(let s of r[n])if(!o.includes(s))o.push(s);r[n]=o}else r[n]=i;else r[n]=i}return r}function Zn(e,t,r="replace"){if(t===null||t===void 0)return e;if(Array.isArray(t))return r==="replace"?t:sr(e,t);if(Array.isArray(e))return r==="replace"?t:sr(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]=sr(s,o);else if(I(o)&&I(s))n[i]=Zn(s,o,r);else n[i]=o}return n}function br(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(!br(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(!br(e[i],t[i]))return!1}return!0}return!1}function I(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}async function nr(e,t,r="replace"){if(!ds(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 Zn(t,i,r)}catch{return null}}catch{return null}}function dd(e,t,r=!1){if(!e)return t;let n=e.toUpperCase().replace(/-/g,"_"),i={...t};function o(s,c=[]){let l={...s};for(let[a,u]of Object.entries(s)){let f=[...c,a],d=(g)=>g.replace(/([A-Z])/g,"_$1").toUpperCase(),h=`${n}_${f.map(d).join("_")}`,p=`${n}_${f.map((g)=>g.toUpperCase()).join("_")}`;if(r)X.info(`Checking environment variable ${h} for config ${e}.${f.join(".")}`);if(typeof u==="object"&&u!==null&&!Array.isArray(u))l[a]=o(u,f);else{let g=St.env[h]||St.env[p];if(g!==void 0){if(r)X.info(`Using environment variable ${g?h:p} for config ${e}.${f.join(".")}`);if(typeof u==="number")l[a]=Number(g);else if(typeof u==="boolean")l[a]=g.toLowerCase()==="true";else if(Array.isArray(u))try{let m=JSON.parse(g);if(Array.isArray(m))l[a]=m;else l[a]=g.split(",").map((y)=>y.trim())}catch{l[a]=g.split(",").map((m)=>m.trim())}else l[a]=g}}}return l}return o(i)}async function hd({name:e="",alias:t,cwd:r,configDir:n,defaultConfig:i,verbose:o=!1,checkEnv:s=!0,arrayStrategy:c="replace"}){let l=s&&typeof i==="object"&&i!==null&&!Array.isArray(i)?dd(e,i,o):i,a=r||St.cwd(),u=[".ts",".js",".mjs",".cjs",".json"];if(o)X.info(`Loading configuration for "${e}"${t?` (alias: "${t}")`:""} from ${a}`);let f=[e,`.${e}`].filter(Boolean),d=[`${e}.config`,`.${e}.config`].filter(Boolean),h=t?[t,`.${t}`]:[],p=t?[`${t}.config`,`.${t}.config`]:[],g=Array.from(new Set([a,te(a,"config"),te(a,".config"),n?te(a,n):void 0].filter(Boolean)));for(let m of g){if(o)X.info(`Searching for configuration in: ${m}`);let b=[te(a,"config"),te(a,".config")].concat(n?[te(a,n)]:[]).includes(m)?[...f,...d,...h,...p]:[...d,...f,...p,...h];for(let v of b)for(let A of u){let R=te(m,`${v}${A}`),P=await nr(R,l,c);if(P!==null){if(o)X.success(`Configuration loaded from: ${R}`);return P}}}if(e){let m=te(yn(),".config",e),y=["config",`${e}.config`];if(t)y.push(`${t}.config`);if(o)X.info(`Checking user config directory: ${m}`);for(let b of y)for(let v of u){let A=te(m,`${b}${v}`),R=await nr(A,l,c);if(R!==null){if(o)X.success(`Configuration loaded from user config directory: ${A}`);return R}}}if(e){let m=te(yn(),".config"),y=[`.${e}.config`];if(t)y.push(`.${t}.config`);if(o)X.info(`Checking user config directory for dotfile configs: ${m}`);for(let b of y)for(let v of u){let A=te(m,`${b}${v}`),R=await nr(A,l,c);if(R!==null){if(o)X.success(`Configuration loaded from user config directory dotfile: ${A}`);return R}}}if(e){let m=yn(),y=[`.${e}.config`,`.${e}`];if(t)y.push(`.${t}.config`),y.push(`.${t}`);if(o)X.info(`Checking user home directory for dotfile configs: ${m}`);for(let b of y)for(let v of u){let A=te(m,`${b}${v}`),R=await nr(A,l,c);if(R!==null){if(o)X.success(`Configuration loaded from user home directory: ${A}`);return R}}}try{let m=te(a,"package.json");if(ds(m)){let y=await import(m),b=y[e];if(!b&&t){if(b=y[t],b&&o)X.success(`Using alias "${t}" configuration from package.json`)}if(b&&typeof b==="object"&&!Array.isArray(b))try{if(o)X.success(`Configuration loaded from package.json: ${b===y[e]?e:t}`);return Zn(l,b,c)}catch(v){if(o)X.warn("Failed to merge package.json config:",v)}}}catch(m){if(o)X.warn("Failed to load package.json:",m)}if(o)X.info(`No configuration found for "${e}"${t?` or alias "${t}"`:""}, using default configuration with environment variables`);return l}function gd(e,t={}){let r=dr.cwd();while(r.includes("storage"))r=So(r,"..");let n=So(r,e||"");if(t?.relative)return xf(dr.cwd(),n);return n}async function md(){try{let e=await hd({name:"clarity",alias:"logging",defaultConfig:cr,cwd:dr.cwd()});return{...cr,...e||{}}}catch{return cr}}function K(){if(Ae.env.NODE_ENV==="test"||Ae.env.BUN_ENV==="test")return!1;return typeof window<"u"}async function pd(){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 ps{async format(e){let t=await pd(),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:st.pid,hostname:t(),environment:st.env.NODE_ENV||"development",platform:st.platform,version:st.version}}return{userAgent:navigator.userAgent,hostname:window.location.hostname||"browser",environment:st.env.NODE_ENV||st.env.BUN_ENV||"development",viewport:{width:window.innerWidth,height:window.innerHeight},language:navigator.language}}}class xr{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={...Bn},this.options=this.normalizeOptions(t),this.formatter=this.options.formatter||new ps,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{...ur,...e.fingersCrossed};if(!e.fingersCrossedEnabled)return null;if(!e.fingersCrossed)return{...ur};return{...ur,...e.fingersCrossed}}normalizeOptions(e){let t={format:"json",level:"info",logDirectory:Bn.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!K()&&this.config.writeToFile===!0}async writeToFile(e){let r=(async()=>{let i,o=0,s=3,c=1000;while(o<s)try{try{try{await Pf(this.config.logDirectory,Fo.F_OK|Fo.W_OK)}catch(a){if(a instanceof Error&&"code"in a)if(a.code==="ENOENT")await _f(this.config.logDirectory,{recursive:!0,mode:493});else if(a.code==="EACCES")throw Error(`No write permission for log directory: ${this.config.logDirectory}`);else throw a;else throw a}}catch(a){throw console.error("Debug: [writeToFile] Failed to create log directory:",a),a}let l=this.validateEncryptionConfig()?(await this.encrypt(e)).encrypted:Re.from(e);try{if(!Yt(this.currentLogFile))await Rn(this.currentLogFile,"",{mode:420});if(i=Mo(this.currentLogFile,"a",420),If(i,l,{flag:"a"}),Lo(i),i!==void 0)Cn(i),i=void 0;if((await it(this.currentLogFile)).size===0){if(await Rn(this.currentLogFile,l,{flag:"w",mode:420}),(await it(this.currentLogFile)).size===0)throw Error("File exists but is empty after retry write")}return}catch(a){let u=a;if(u.code&&["ENETDOWN","ENETUNREACH","ENOTFOUND","ETIMEDOUT"].includes(u.code)){if(o<s-1){let f=typeof u.message==="string"?u.message:"Unknown error";console.error(`Network error during write attempt ${o+1}/${s}:`,f);let d=c*2**o;await new Promise((h)=>setTimeout(h,d)),o++;continue}}if(u?.code&&["ENOSPC","EDQUOT"].includes(u.code))throw Error(`Disk quota exceeded or no space left on device: ${u.message}`);throw console.error("Debug: [writeToFile] Error writing to file:",u),u}finally{if(i!==void 0)try{Cn(i)}catch(a){console.error("Debug: [writeToFile] Error closing file descriptor:",a)}}}catch(l){if(o===s-1){let u=l,f=typeof u.message==="string"?u.message:"Unknown error";throw console.error("Debug: [writeToFile] Max retries reached. Final error:",f),l}o++;let a=c*2**(o-1);await new Promise((u)=>setTimeout(u,a))}})();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 ot(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 ot(this.config.logDirectory,`${this.name}.log`);let e=new Date().toISOString().split("T")[0];return ot(this.config.logDirectory,`${this.name}-${e}.log`)}setupRotation(){if(K())return;if(!this.shouldWriteToFile())return;if(typeof this.config.rotation==="boolean")return;let e=this.config.rotation,t;switch(e.frequency){case"daily":t=86400000;break;case"weekly":t=604800000;break;case"monthly":t=2592000000;break;default:return}this.rotationTimeout=setInterval(()=>{this.rotateLog()},t)}setupKeyRotation(){if(!this.validateEncryptionConfig()){console.error("Invalid encryption configuration detected during key rotation setup");return}let t=this.config.rotation.keyRotation;if(!t?.enabled)return;let r=typeof t.interval==="number"?t.interval:60,n=Math.max(r,60)*1000;this.keyRotationTimeout=setInterval(()=>{this.rotateKeys().catch((i)=>{console.error("Error rotating keys:",i)})},n)}async rotateKeys(){if(!this.validateEncryptionConfig()){console.error("Invalid encryption configuration detected during key rotation");return}let t=this.config.rotation.keyRotation,r=this.generateKeyId(),n=this.generateKey();this.currentKeyId=r,this.keys.set(r,n),this.encryptionKeys.set(r,{key:n,createdAt:new Date});let i=Array.from(this.encryptionKeys.entries()).sort(([,c],[,l])=>l.createdAt.getTime()-c.createdAt.getTime()),o=typeof t.maxKeys==="number"?t.maxKeys:1,s=Math.max(1,o);if(i.length>s)for(let[c]of i.slice(s))this.encryptionKeys.delete(c),this.keys.delete(c)}generateKeyId(){return $n(16).toString("hex")}generateKey(){return $n(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=$n(16),n=Tf("aes-256-gcm",t,r),i=Re.isBuffer(e)?e:Re.from(e,"utf8"),o=n.update(i),s=n.final(),c=o.length+s.length,l=n.getAuthTag(),a=Re.allocUnsafe(16+c+16);return r.copy(a,0),o.copy(a,16),s.copy(a,16+o.length),l.copy(a,16+c),{encrypted:a,iv:r}}async compressData(e){return new Promise((t,r)=>{let n=jo(),i=[];n.on("data",(o)=>i.push(o)),n.on("end",()=>t(Re.from(Re.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(K())return;if(!this.shouldWriteToFile())return;let e=await it(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 Jt(this.config.logDirectory),o=i.filter((l)=>l.startsWith(this.name)&&/\.log\.\d+$/.test(l)).sort((l,a)=>{let u=Number.parseInt(l.match(/\.log\.(\d+)$/)?.[1]||"0");return Number.parseInt(a.match(/\.log\.(\d+)$/)?.[1]||"0")-u}),s=o.length>0?Number.parseInt(o[0].match(/\.log\.(\d+)$/)?.[1]||"0")+1:1,c=`${r}.${s}`;if(await it(r).catch(()=>null))try{if(await Do(r,c),t.compress)try{let l=`${c}.gz`;await this.compressLogFile(c,l),await Xt(c)}catch(l){console.error("Error compressing rotated file:",l)}if(o.length===0&&!i.some((l)=>l.endsWith(".log.1")))try{let l=`${r}.1`;await Rn(l,"")}catch(l){console.error("Error creating backup file:",l)}}catch(l){console.error(`Error during rotation: ${l instanceof Error?l.message:String(l)}`)}}else{let i=new Date().toISOString().replace(/[:.]/g,"-"),o=r.replace(/\.log$/,`-${i}.log`);if(await it(r).catch(()=>null))await Do(r,o)}if(this.currentLogFile=n,t.maxFiles){let o=(await Jt(this.config.logDirectory)).filter((s)=>s.startsWith(this.name)).sort((s,c)=>c.localeCompare(s));for(let s of o.slice(t.maxFiles))await Xt(ot(this.config.logDirectory,s))}}}async compressLogFile(e,t){let r=_o(e),n=Of(t),i=jo();await Ff(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()})),Yt(this.currentLogFile))try{let e=Mo(this.currentLogFile,"r+");Lo(e),Cn(e)}catch(e){console.error(`Error flushing file: ${e}`)}}async destroy(){if(this.rotationTimeout)clearInterval(this.rotationTimeout);if(this.keyRotationTimeout)clearInterval(this.keyRotationTimeout);this.timers.clear();for(let e of this.pendingOperations)if(typeof e.cancel==="function")e.cancel();return(async()=>{if(this.pendingOperations.length>0)try{await Promise.allSettled(this.pendingOperations)}catch(e){console.error("Error waiting for pending operations:",e)}if(!K()&&this.config.rotation&&typeof this.config.rotation!=="boolean"&&this.config.rotation.compress)try{let t=(await Jt(this.config.logDirectory)).filter((r)=>(r.includes("temp")||r.includes(".tmp"))&&r.includes(this.name));for(let r of t)try{await Xt(ot(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||K())return!1;let e=typeof N.env.NO_COLOR<"u",t=N.env.FORCE_COLOR==="0";if(e||t)return!1;return!!(typeof N.stderr<"u"&&N.stderr.isTTY||typeof N.stdout<"u"&&N.stdout.isTTY)}formatConsoleMessage(e){let{timestamp:t,icon:r="",tag:n="",message:i,level:o,showTimestamp:s=!0}=e,c=(h)=>h.replace(this.ANSI_PATTERN,"");if(!this.fancy){let h=[];if(s)h.push(t);if(o==="warning")h.push("WARN");else if(o==="error")h.push("ERROR");else if(r)h.push(r.replace(/[^\p{L}\p{N}\p{P}\p{Z}]/gu,""));if(n)h.push(n.replace(/[[\]]/g,""));return h.push(i),h.join(" ")}let l=N.stdout.columns||120,a="";if(o==="warning"||o==="error")a=`${r} ${i}`;else if(o==="info"||o==="success")a=`${r} ${n} ${i}`;else a=`${r} ${n} ${E.cyan(i)}`;if(!s)return a.trim();let u=c(a).trim().length,f=c(t).length,d=Math.max(1,l-2-u-f);return`${a.trim()}${" ".repeat(d)}${t}`}formatMessage(e,t){if(t.length===1&&Array.isArray(t[0]))return e.replace(/\{(\d+)\}/g,(o,s)=>{let c=Number.parseInt(s,10);return c<t[0].length?String(t[0][c]):o});let r=/%([sdijfo%])/g,n=0,i=e.replace(r,(o,s)=>{if(s==="%")return"%";if(n>=t.length)return o;let c=t[n++];switch(s){case"s":return String(c);case"d":case"i":return Number(c).toString();case"j":case"o":return JSON.stringify(c,null,2);default:return o}});if(n<t.length)i+=` ${t.slice(n).map((o)=>typeof o==="object"?JSON.stringify(o,null,2):String(o)).join(" ")}`;return i}formatMarkdown(e){if(!e)return e;let t=e;return t=t.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(r,n,i)=>{let o=E.underline(E.blue(n)),s=this.toAbsoluteFilePath(i);if(s&&this.shouldStyleConsole()&&this.supportsHyperlinks()){let c=`file://${encodeURI(s)}`,l="\x1B]8;;",a="\x1B\\";return`\x1B]8;;${c}\x1B\\${o}\x1B]8;;\x1B\\`}if(this.shouldStyleConsole()&&this.supportsHyperlinks())return`\x1B]8;;${i}\x1B\\${o}\x1B]8;;\x1B\\`;return o}),t=t.replace(/`([^`]+)`/g,(r,n)=>E.bgGray(n)),t=t.replace(/\*\*([^*]+)\*\*/g,(r,n)=>E.bold(n)),t=t.replace(/(?<!\*)\*([^*]+)\*(?!\*)/g,(r,n)=>E.italic(n)),t=t.replace(/(?<!_)_([^_]+)_(?!_)/g,(r,n)=>E.italic(n)),t=t.replace(/~([^~]+)~/g,(r,n)=>E.strikethrough(n)),t}supportsHyperlinks(){if(K())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(Lf(t)||t.startsWith("./")||t.startsWith("../"))t=Mf(t);else return null;return Yt(t)?t:null}catch{return null}}buildOutputTexts(e){let t=this.shouldStyleConsole()?this.formatMarkdown(e):e,r=e.replace(this.ANSI_PATTERN,"");return{consoleText:t,fileText:r}}async log(e,t,...r){let n=new Date,i=this.formatConsoleTimestamp(n),o=this.formatFileTimestamp(n),s,c;if(t instanceof Error)s=t.message,c=t.stack;else s=this.formatMessage(t,r);let{consoleText:l,fileText:a}=this.buildOutputTexts(s);if(this.shouldStyleConsole()){let f=this.options.showIcons===!1?"":Ss[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(l),level:e}),console.error(h);break;case"info":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:l,level:e}),console.warn(h);break;case"success":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:E.green(l),level:e}),console.error(h);break;case"warning":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:l,level:e}),console.warn(h);break;case"error":if(h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:l,level:e}),console.error(h),c){let p=c.split(`
9
+ `.replace(this.ANSI_PATTERN,"");await this.writeToFile(i)}async prompt(e){if(B())return Promise.resolve(!0);return new Promise((t)=>{console.error(`${_.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,c=0;if(r=e.replace(s,(l,a)=>{if(a==="%")return"%";if(c>=t.length)return l;let u=t[c++];switch(a){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 l}}),c<t.length)r+=` ${t.slice(c).map((l)=>typeof l==="object"?JSON.stringify(l,null,2):String(l)).join(" ")}`}if(this.fancy&&!B()){let s=this.options.showTags!==!1&&this.name?_.gray(this.formatTag(this.name)):"",c=_.blue("\u25D0");console.error(`${c} ${s} ${_.cyan(r)}`)}let o=`[${new Date().toISOString()}] ${this.environment}.INFO: [START] ${r}
10
+ `.replace(this.ANSI_PATTERN,"");await this.writeToFile(o)}progress(e,t=""){if(!this.enabled||!this.fancy||B()||e<=0)return{update:()=>{},finish:()=>{},interrupt:()=>{}};if(this.activeProgressBar)console.warn("Warning: Another progress bar is already active. Finishing the previous one."),this.finishProgressBar(this.activeProgressBar,"[Auto-finished]");let r=20;return this.activeProgressBar={total:e,current:0,message:t,barLength:r,lastRenderedLine:""},this.renderProgressBar(this.activeProgressBar),{update:(s,c)=>{if(!this.activeProgressBar||!this.enabled||!this.fancy||B())return;if(this.activeProgressBar.current=Math.max(0,Math.min(e,s)),c!==void 0)this.activeProgressBar.message=c;let l=this.activeProgressBar.current===this.activeProgressBar.total;this.renderProgressBar(this.activeProgressBar,l)},finish:(s)=>{if(!this.activeProgressBar||!this.enabled||!this.fancy||B())return;if(this.activeProgressBar.current=this.activeProgressBar.total,s!==void 0)this.activeProgressBar.message=s;this.renderProgressBar(this.activeProgressBar,!0),this.finishProgressBar(this.activeProgressBar)},interrupt:(s,c="info")=>{if(!this.activeProgressBar||!this.enabled||!this.fancy||B())return;J.stdout.write(`${"\r".padEnd(J.stdout.columns||80)}\r`),this.log(c,s),setTimeout(()=>{if(this.activeProgressBar)this.renderProgressBar(this.activeProgressBar)},50)}}}renderProgressBar(e,t=!1){if(!this.enabled||!this.fancy||B()||!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=_.green("\u2501".repeat(n)),s=_.gray("\u2501".repeat(i)),c=`[${o}${s}]`,l=`${r}%`.padStart(4),a=e.message?` ${e.message}`:"",u=t||r===100?_.green("\u2713"):_.blue("\u25B6"),f=this.options.showTags!==!1&&this.name?` ${_.gray(this.formatTag(this.name))}`:"",d=`\r${u}${f} ${c} ${l}${a}`,h=J.stdout.columns||80,p=" ".repeat(Math.max(0,h-d.replace(this.ANSI_PATTERN,"").length));if(e.lastRenderedLine=`${d}${p}`,J.stdout.write(e.lastRenderedLine),t)J.stdout.write(`
11
+ `)}finishProgressBar(e,t){if(!this.enabled||!this.fancy||B()||!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(B()){console.warn("Log clearing is not supported in browser environments.");return}try{console.warn("Clearing logs...",this.config.logDirectory);let t=await Yt(this.config.logDirectory),r=[];for(let n of t){if(!(e.name?new RegExp(e.name.replace("*",".*")).test(n):n.startsWith(this.name))||!n.endsWith(".log"))continue;let o=nt(this.config.logDirectory,n);if(e.before)try{if((await rt(o)).mtime>=e.before)continue}catch(s){console.error(`Failed to get stats for file ${o}:`,s);continue}r.push(o)}if(r.length===0){console.warn("No log files matched the criteria for clearing.");return}console.warn(`Preparing to delete ${r.length} log file(s)...`);for(let n of r)try{await Jt(n),console.warn(`Deleted log file: ${n}`)}catch(i){console.error(`Failed to delete log file ${n}:`,i)}console.warn("Log clearing process finished.")}catch(t){console.error("Error during log clearing process:",t)}}}function lr(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)=>vr(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]=lr(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((l)=>I(l)&&("name"in l)&&l.name===s.name))o.push(s)}else if(I(s)&&"path"in s){if(!o.find((l)=>I(l)&&("path"in l)&&l.path===s.path))o.push(s)}else if(!o.some((c)=>vr(c,s)))o.push(s);r[n]=o}else if(i.every((o)=>typeof o==="string")&&r[n].every((o)=>typeof o==="string")){let o=[...i];for(let s of r[n])if(!o.includes(s))o.push(s);r[n]=o}else r[n]=i;else r[n]=i}return r}function ei(e,t,r="replace"){if(t===null||t===void 0)return e;if(Array.isArray(t))return r==="replace"?t:lr(e,t);if(Array.isArray(e))return r==="replace"?t:lr(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]=lr(s,o);else if(I(o)&&I(s))n[i]=ei(s,o,r);else n[i]=o}return n}function vr(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(!vr(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(!vr(e[i],t[i]))return!1}return!0}return!1}function I(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}async function or(e,t,r="replace"){if(!gs(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 ei(t,i,r)}catch{return null}}catch{return null}}function gd(e,t,r=!1){if(!e)return t;let n=e.toUpperCase().replace(/-/g,"_"),i={...t};function o(s,c=[]){let l={...s};for(let[a,u]of Object.entries(s)){let f=[...c,a],d=(g)=>g.replace(/([A-Z])/g,"_$1").toUpperCase(),h=`${n}_${f.map(d).join("_")}`,p=`${n}_${f.map((g)=>g.toUpperCase()).join("_")}`;if(r)Z.info(`Checking environment variable ${h} for config ${e}.${f.join(".")}`);if(typeof u==="object"&&u!==null&&!Array.isArray(u))l[a]=o(u,f);else{let g=Et.env[h]||Et.env[p];if(g!==void 0){if(r)Z.info(`Using environment variable ${g?h:p} for config ${e}.${f.join(".")}`);if(typeof u==="number")l[a]=Number(g);else if(typeof u==="boolean")l[a]=g.toLowerCase()==="true";else if(Array.isArray(u))try{let m=JSON.parse(g);if(Array.isArray(m))l[a]=m;else l[a]=g.split(",").map((y)=>y.trim())}catch{l[a]=g.split(",").map((m)=>m.trim())}else l[a]=g}}}return l}return o(i)}async function md({name:e="",alias:t,cwd:r,configDir:n,defaultConfig:i,verbose:o=!1,checkEnv:s=!0,arrayStrategy:c="replace"}){let l=s&&typeof i==="object"&&i!==null&&!Array.isArray(i)?gd(e,i,o):i,a=r||Et.cwd(),u=[".ts",".js",".mjs",".cjs",".json"];if(o)Z.info(`Loading configuration for "${e}"${t?` (alias: "${t}")`:""} from ${a}`);let f=[e,`.${e}`].filter(Boolean),d=[`${e}.config`,`.${e}.config`].filter(Boolean),h=t?[t,`.${t}`]:[],p=t?[`${t}.config`,`.${t}.config`]:[],g=Array.from(new Set([a,re(a,"config"),re(a,".config"),n?re(a,n):void 0].filter(Boolean)));for(let m of g){if(o)Z.info(`Searching for configuration in: ${m}`);let b=[re(a,"config"),re(a,".config")].concat(n?[re(a,n)]:[]).includes(m)?[...f,...d,...h,...p]:[...d,...f,...p,...h];for(let v of b)for(let A of u){let R=re(m,`${v}${A}`),P=await or(R,l,c);if(P!==null){if(o)Z.success(`Configuration loaded from: ${R}`);return P}}}if(e){let m=re(xn(),".config",e),y=["config",`${e}.config`];if(t)y.push(`${t}.config`);if(o)Z.info(`Checking user config directory: ${m}`);for(let b of y)for(let v of u){let A=re(m,`${b}${v}`),R=await or(A,l,c);if(R!==null){if(o)Z.success(`Configuration loaded from user config directory: ${A}`);return R}}}if(e){let m=re(xn(),".config"),y=[`.${e}.config`];if(t)y.push(`.${t}.config`);if(o)Z.info(`Checking user config directory for dotfile configs: ${m}`);for(let b of y)for(let v of u){let A=re(m,`${b}${v}`),R=await or(A,l,c);if(R!==null){if(o)Z.success(`Configuration loaded from user config directory dotfile: ${A}`);return R}}}if(e){let m=xn(),y=[`.${e}.config`,`.${e}`];if(t)y.push(`.${t}.config`),y.push(`.${t}`);if(o)Z.info(`Checking user home directory for dotfile configs: ${m}`);for(let b of y)for(let v of u){let A=re(m,`${b}${v}`),R=await or(A,l,c);if(R!==null){if(o)Z.success(`Configuration loaded from user home directory: ${A}`);return R}}}try{let m=re(a,"package.json");if(gs(m)){let y=await import(m),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 ei(l,b,c)}catch(v){if(o)Z.warn("Failed to merge package.json config:",v)}}}catch(m){if(o)Z.warn("Failed to load package.json:",m)}if(o)Z.info(`No configuration found for "${e}"${t?` or alias "${t}"`:""}, using default configuration with environment variables`);return l}function pd(e,t={}){let r=gr.cwd();while(r.includes("storage"))r=Eo(r,"..");let n=Eo(r,e||"");if(t?.relative)return wf(gr.cwd(),n);return n}async function yd(){try{let e=await md({name:"clarity",alias:"logging",defaultConfig:fr,cwd:gr.cwd()});return{...fr,...e||{}}}catch{return fr}}function K(){if(Ee.env.NODE_ENV==="test"||Ee.env.BUN_ENV==="test")return!1;return typeof window<"u"}async function bd(){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 bs{async format(e){let t=await bd(),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:at.pid,hostname:t(),environment:at.env.NODE_ENV||"development",platform:at.platform,version:at.version}}return{userAgent:navigator.userAgent,hostname:window.location.hostname||"browser",environment:at.env.NODE_ENV||at.env.BUN_ENV||"development",viewport:{width:window.innerWidth,height:window.innerHeight},language:navigator.language}}}class wr{name;fileLocks=new Map;currentKeyId=null;keys=new Map;fingersCrossedConfig;fingersCrossedActive=!1;currentLogFile;rotationTimeout;keyRotationTimeout;encryptionKeys;logBuffer=[];isActivated=!1;pendingOperations=[];enabled;fancy;tagFormat;timestampPosition;environment;config;options;formatter;timers=new Set;subLoggers=new Set;fingersCrossedBuffer=[];ANSI_PATTERN=/\u001B\[.*?m/g;activeProgressBar=null;constructor(e,t={}){this.name=e,this.config={...Vn},this.options=this.normalizeOptions(t),this.formatter=this.options.formatter||new bs,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{...dr,...e.fingersCrossed};if(!e.fingersCrossedEnabled)return null;if(!e.fingersCrossed)return{...dr};return{...dr,...e.fingersCrossed}}normalizeOptions(e){let t={format:"json",level:"info",logDirectory:Vn.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!K()&&this.config.writeToFile===!0}async writeToFile(e){let r=(async()=>{let i,o=0,s=3,c=1000;while(o<s)try{try{try{await Lf(this.config.logDirectory,jo.F_OK|jo.W_OK)}catch(a){if(a instanceof Error&&"code"in a)if(a.code==="ENOENT")await Mf(this.config.logDirectory,{recursive:!0,mode:493});else if(a.code==="EACCES")throw Error(`No write permission for log directory: ${this.config.logDirectory}`);else throw a;else throw a}}catch(a){throw console.error("Debug: [writeToFile] Failed to create log directory:",a),a}let l=this.validateEncryptionConfig()?(await this.encrypt(e)).encrypted:ke.from(e);try{if(!Xt(this.currentLogFile))await Sn(this.currentLogFile,"",{mode:420});if(i=Do(this.currentLogFile,"a",420),_f(i,l,{flag:"a"}),Fo(i),i!==void 0)kn(i),i=void 0;if((await ot(this.currentLogFile)).size===0){if(await Sn(this.currentLogFile,l,{flag:"w",mode:420}),(await ot(this.currentLogFile)).size===0)throw Error("File exists but is empty after retry write")}return}catch(a){let u=a;if(u.code&&["ENETDOWN","ENETUNREACH","ENOTFOUND","ETIMEDOUT"].includes(u.code)){if(o<s-1){let f=typeof u.message==="string"?u.message:"Unknown error";console.error(`Network error during write attempt ${o+1}/${s}:`,f);let d=c*2**o;await new Promise((h)=>setTimeout(h,d)),o++;continue}}if(u?.code&&["ENOSPC","EDQUOT"].includes(u.code))throw Error(`Disk quota exceeded or no space left on device: ${u.message}`);throw console.error("Debug: [writeToFile] Error writing to file:",u),u}finally{if(i!==void 0)try{kn(i)}catch(a){console.error("Debug: [writeToFile] Error closing file descriptor:",a)}}}catch(l){if(o===s-1){let u=l,f=typeof u.message==="string"?u.message:"Unknown error";throw console.error("Debug: [writeToFile] Max retries reached. Final error:",f),l}o++;let a=c*2**(o-1);await new Promise((u)=>setTimeout(u,a))}})();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 st(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 st(this.config.logDirectory,`${this.name}.log`);let e=new Date().toISOString().split("T")[0];return st(this.config.logDirectory,`${this.name}-${e}.log`)}setupRotation(){if(K())return;if(!this.shouldWriteToFile())return;if(typeof this.config.rotation==="boolean")return;let e=this.config.rotation,t;switch(e.frequency){case"daily":t=86400000;break;case"weekly":t=604800000;break;case"monthly":t=2592000000;break;default:return}this.rotationTimeout=setInterval(()=>{this.rotateLog()},t)}setupKeyRotation(){if(!this.validateEncryptionConfig()){console.error("Invalid encryption configuration detected during key rotation setup");return}let t=this.config.rotation.keyRotation;if(!t?.enabled)return;let r=typeof t.interval==="number"?t.interval:60,n=Math.max(r,60)*1000;this.keyRotationTimeout=setInterval(()=>{this.rotateKeys().catch((i)=>{console.error("Error rotating keys:",i)})},n)}async rotateKeys(){if(!this.validateEncryptionConfig()){console.error("Invalid encryption configuration detected during key rotation");return}let t=this.config.rotation.keyRotation,r=this.generateKeyId(),n=this.generateKey();this.currentKeyId=r,this.keys.set(r,n),this.encryptionKeys.set(r,{key:n,createdAt:new Date});let i=Array.from(this.encryptionKeys.entries()).sort(([,c],[,l])=>l.createdAt.getTime()-c.createdAt.getTime()),o=typeof t.maxKeys==="number"?t.maxKeys:1,s=Math.max(1,o);if(i.length>s)for(let[c]of i.slice(s))this.encryptionKeys.delete(c),this.keys.delete(c)}generateKeyId(){return Rn(16).toString("hex")}generateKey(){return Rn(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=Rn(16),n=Of("aes-256-gcm",t,r),i=ke.isBuffer(e)?e:ke.from(e,"utf8"),o=n.update(i),s=n.final(),c=o.length+s.length,l=n.getAuthTag(),a=ke.allocUnsafe(16+c+16);return r.copy(a,0),o.copy(a,16),s.copy(a,16+o.length),l.copy(a,16+c),{encrypted:a,iv:r}}async compressData(e){return new Promise((t,r)=>{let n=Uo(),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(K())return;if(!this.shouldWriteToFile())return;let e=await ot(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((l)=>l.startsWith(this.name)&&/\.log\.\d+$/.test(l)).sort((l,a)=>{let u=Number.parseInt(l.match(/\.log\.(\d+)$/)?.[1]||"0");return Number.parseInt(a.match(/\.log\.(\d+)$/)?.[1]||"0")-u}),s=o.length>0?Number.parseInt(o[0].match(/\.log\.(\d+)$/)?.[1]||"0")+1:1,c=`${r}.${s}`;if(await ot(r).catch(()=>null))try{if(await Bo(r,c),t.compress)try{let l=`${c}.gz`;await this.compressLogFile(c,l),await Qt(c)}catch(l){console.error("Error compressing rotated file:",l)}if(o.length===0&&!i.some((l)=>l.endsWith(".log.1")))try{let l=`${r}.1`;await Sn(l,"")}catch(l){console.error("Error creating backup file:",l)}}catch(l){console.error(`Error during rotation: ${l instanceof Error?l.message:String(l)}`)}}else{let i=new Date().toISOString().replace(/[:.]/g,"-"),o=r.replace(/\.log$/,`-${i}.log`);if(await ot(r).catch(()=>null))await Bo(r,o)}if(this.currentLogFile=n,t.maxFiles){let o=(await Zt(this.config.logDirectory)).filter((s)=>s.startsWith(this.name)).sort((s,c)=>c.localeCompare(s));for(let s of o.slice(t.maxFiles))await Qt(st(this.config.logDirectory,s))}}}async compressLogFile(e,t){let r=Mo(e),n=Pf(t),i=Uo();await jf(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()})),Xt(this.currentLogFile))try{let e=Do(this.currentLogFile,"r+");Fo(e),kn(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(!K()&&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(st(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||K())return!1;let e=typeof N.env.NO_COLOR<"u",t=N.env.FORCE_COLOR==="0";if(e||t)return!1;return!!(typeof N.stderr<"u"&&N.stderr.isTTY||typeof N.stdout<"u"&&N.stdout.isTTY)}formatConsoleMessage(e){let{timestamp:t,icon:r="",tag:n="",message:i,level:o,showTimestamp:s=!0}=e,c=(h)=>h.replace(this.ANSI_PATTERN,"");if(!this.fancy){let h=[];if(s)h.push(t);if(o==="warning")h.push("WARN");else if(o==="error")h.push("ERROR");else if(r)h.push(r.replace(/[^\p{L}\p{N}\p{P}\p{Z}]/gu,""));if(n)h.push(n.replace(/[[\]]/g,""));return h.push(i),h.join(" ")}let l=N.stdout.columns||120,a="";if(o==="warning"||o==="error")a=`${r} ${i}`;else if(o==="info"||o==="success")a=`${r} ${n} ${i}`;else a=`${r} ${n} ${E.cyan(i)}`;if(!s)return a.trim();let u=c(a).trim().length,f=c(t).length,d=Math.max(1,l-2-u-f);return`${a.trim()}${" ".repeat(d)}${t}`}formatMessage(e,t){if(t.length===1&&Array.isArray(t[0]))return e.replace(/\{(\d+)\}/g,(o,s)=>{let c=Number.parseInt(s,10);return c<t[0].length?String(t[0][c]):o});let r=/%([sdijfo%])/g,n=0,i=e.replace(r,(o,s)=>{if(s==="%")return"%";if(n>=t.length)return o;let c=t[n++];switch(s){case"s":return String(c);case"d":case"i":return Number(c).toString();case"j":case"o":return JSON.stringify(c,null,2);default:return o}});if(n<t.length)i+=` ${t.slice(n).map((o)=>typeof o==="object"?JSON.stringify(o,null,2):String(o)).join(" ")}`;return i}formatMarkdown(e){if(!e)return e;let t=e;return t=t.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(r,n,i)=>{let o=E.underline(E.blue(n)),s=this.toAbsoluteFilePath(i);if(s&&this.shouldStyleConsole()&&this.supportsHyperlinks()){let c=`file://${encodeURI(s)}`,l="\x1B]8;;",a="\x1B\\";return`\x1B]8;;${c}\x1B\\${o}\x1B]8;;\x1B\\`}if(this.shouldStyleConsole()&&this.supportsHyperlinks())return`\x1B]8;;${i}\x1B\\${o}\x1B]8;;\x1B\\`;return o}),t=t.replace(/`([^`]+)`/g,(r,n)=>E.bgGray(n)),t=t.replace(/\*\*([^*]+)\*\*/g,(r,n)=>E.bold(n)),t=t.replace(/(?<!\*)\*([^*]+)\*(?!\*)/g,(r,n)=>E.italic(n)),t=t.replace(/(?<!_)_([^_]+)_(?!_)/g,(r,n)=>E.italic(n)),t=t.replace(/~([^~]+)~/g,(r,n)=>E.strikethrough(n)),t}supportsHyperlinks(){if(K())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(Ff(t)||t.startsWith("./")||t.startsWith("../"))t=Df(t);else return null;return Xt(t)?t:null}catch{return null}}buildOutputTexts(e){let t=this.shouldStyleConsole()?this.formatMarkdown(e):e,r=e.replace(this.ANSI_PATTERN,"");return{consoleText:t,fileText:r}}async log(e,t,...r){let n=new Date,i=this.formatConsoleTimestamp(n),o=this.formatFileTimestamp(n),s,c;if(t instanceof Error)s=t.message,c=t.stack;else s=this.formatMessage(t,r);let{consoleText:l,fileText:a}=this.buildOutputTexts(s);if(this.shouldStyleConsole()){let f=this.options.showIcons===!1?"":Es[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(l),level:e}),console.error(h);break;case"info":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:l,level:e}),console.warn(h);break;case"success":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:E.green(l),level:e}),console.error(h);break;case"warning":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:l,level:e}),console.warn(h);break;case"error":if(h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:l,level:e}),console.error(h),c){let p=c.split(`
12
12
  `);for(let g of p)if(g.trim()&&!g.includes(s))console.error(this.formatConsoleMessage({timestamp:i,message:E.gray(` ${g}`),level:e,showTimestamp:!1}))}break}}else if(!K()){if(console.error(`${o} ${this.environment}.${e.toUpperCase()}: ${s}`),c)console.error(c)}if(!this.shouldLog(e))return;let u=`${o} ${this.environment}.${e.toUpperCase()}: ${a}
13
13
  `;if(c)u+=`${c}
14
14
  `;if(u=u.replace(this.ANSI_PATTERN,""),this.shouldWriteToFile())await this.writeToFile(u)}progress(e,t=""){let r={update:(c,l)=>{},finish:(c)=>{},interrupt:(c,l)=>{}};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()&&!K()&&N.stdout.isTTY)this.renderProgressBar(this.activeProgressBar);return{update:(c,l)=>{if(!this.enabled||!this.activeProgressBar)return;if(this.activeProgressBar.current=Math.min(Math.max(0,c),this.activeProgressBar.total),l!==void 0)this.activeProgressBar.message=l;if(this.shouldStyleConsole()&&!K()&&N.stdout.isTTY)this.renderProgressBar(this.activeProgressBar)},finish:(c)=>{if(!this.activeProgressBar)return;this.finishProgressBar(this.activeProgressBar,c)},interrupt:(c,l="info")=>{if(!K()&&N.stdout.isTTY)N.stdout.write(`
15
15
  `);if(this[l==="warning"?"warn":l](c),this.activeProgressBar&&this.shouldStyleConsole()&&!K()&&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,c=this.formatConsoleTimestamp(s),a=`${this.formatFileTimestamp(s)} ${this.environment}.INFO: ${o}`;if(r)a+=` ${JSON.stringify(r)}`;if(a+=`
16
- `,a=a.replace(this.ANSI_PATTERN,""),this.shouldStyleConsole()){let u=this.options.showTags!==!1&&this.name?E.gray(this.formatTag(this.name)):"";console.error(this.formatConsoleMessage({timestamp:c,icon:this.options.showIcons===!1?"":E.green("\u2713"),tag:u,message:`${o}${r?` ${JSON.stringify(r)}`:""}`}))}else if(!K())console.error(a.trim());if(this.shouldWriteToFile())await this.writeToFile(a)}}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 xr(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(K())throw Error("createReadStream is not supported in browser environments");if(!Yt(this.currentLogFile))throw Error(`Log file does not exist: ${this.currentLogFile}`);return _o(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=Re.isBuffer(e)?e:Re.from(e,"base64"),i=n.subarray(0,16),o=n.subarray(n.length-16),s=n.subarray(16,n.length-16),c=Nf("aes-256-gcm",r,i);c.setAuthTag(o);let l=c.update(s),a=c.final(),u=l.length+a.length,f=Re.allocUnsafe(u);return l.copy(f,0),a.copy(f,l.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 K()}isServerMode(){return!K()}setTestEncryptionKey(e,t){this.currentKeyId=e,this.keys.set(e,t)}getTestCurrentKey(){if(!this.currentKeyId||!this.keys.has(this.currentKeyId))return null;return{id:this.currentKeyId,key:this.keys.get(this.currentKeyId)}}getConfig(){return this.config}async box(e){if(!this.enabled)return;let t=new Date,r=this.formatConsoleTimestamp(t),n=this.formatFileTimestamp(t),{consoleText:i,fileText:o}=this.buildOutputTexts(e);if(this.shouldStyleConsole()){let c=i.split(`
16
+ `,a=a.replace(this.ANSI_PATTERN,""),this.shouldStyleConsole()){let u=this.options.showTags!==!1&&this.name?E.gray(this.formatTag(this.name)):"";console.error(this.formatConsoleMessage({timestamp:c,icon:this.options.showIcons===!1?"":E.green("\u2713"),tag:u,message:`${o}${r?` ${JSON.stringify(r)}`:""}`}))}else if(!K())console.error(a.trim());if(this.shouldWriteToFile())await this.writeToFile(a)}}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 wr(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(K())throw Error("createReadStream is not supported in browser environments");if(!Xt(this.currentLogFile))throw Error(`Log file does not exist: ${this.currentLogFile}`);return Mo(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),c=If("aes-256-gcm",r,i);c.setAuthTag(o);let l=c.update(s),a=c.final(),u=l.length+a.length,f=ke.allocUnsafe(u);return l.copy(f,0),a.copy(f,l.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 K()}isServerMode(){return!K()}setTestEncryptionKey(e,t){this.currentKeyId=e,this.keys.set(e,t)}getTestCurrentKey(){if(!this.currentKeyId||!this.keys.has(this.currentKeyId))return null;return{id:this.currentKeyId,key:this.keys.get(this.currentKeyId)}}getConfig(){return this.config}async box(e){if(!this.enabled)return;let t=new Date,r=this.formatConsoleTimestamp(t),n=this.formatFileTimestamp(t),{consoleText:i,fileText:o}=this.buildOutputTexts(e);if(this.shouldStyleConsole()){let c=i.split(`
17
17
  `),l=Math.max(...c.map((d)=>d.length))+2,a=`\u250C${"\u2500".repeat(l)}\u2510`,u=`\u2514${"\u2500".repeat(l)}\u2518`,f=c.map((d)=>this.formatConsoleMessage({timestamp:r,message:E.cyan(d),showTimestamp:!1}));console.error(this.formatConsoleMessage({timestamp:r,message:E.cyan(a),showTimestamp:!1})),f.forEach((d)=>console.error(d)),console.error(this.formatConsoleMessage({timestamp:r,message:E.cyan(u),showTimestamp:!1}))}else if(!K())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(K())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 l=/%([sdijfo%])/g,a=0;if(r=e.replace(l,(u,f)=>{if(f==="%")return"%";if(a>=t.length)return u;let d=t[a++];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}}),a<t.length)r+=` ${t.slice(a).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 l=this.options.showTags!==!1&&this.name?E.gray(this.formatTag(this.name)):"",a=this.options.showIcons===!1?"":`${E.blue("\u25D0")} `;console.error(`${a}${l} ${E.cyan(n)}`)}let c=`[${new Date().toISOString()}] ${this.environment}.INFO: [START] ${i}
19
19
  `.replace(this.ANSI_PATTERN,"");if(this.shouldWriteToFile())await this.writeToFile(c)}renderProgressBar(e,t=!1){if(!this.enabled||!this.shouldStyleConsole()||!N.stdout.isTTY)return;let r=Math.min(100,Math.max(0,Math.round(e.current/e.total*100))),n=Math.round(e.barLength*r/100),i=e.barLength-n,o=E.green("\u2501".repeat(n)),s=E.gray("\u2501".repeat(i)),c=`[${o}${s}]`,l=`${r}%`.padStart(4),a=e.message?` ${e.message}`:"",u=this.options.showIcons===!1?"":t||r===100?E.green("\u2713"):E.blue("\u25B6"),f=this.options.showTags!==!1&&this.name?` ${E.gray(this.formatTag(this.name))}`:"",d=`\r${u}${f} ${c} ${l}${a}`,h=N.stdout.columns||80,p=" ".repeat(Math.max(0,h-d.replace(this.ANSI_PATTERN,"").length));if(e.lastRenderedLine=`${d}${p}`,N.stdout.write(e.lastRenderedLine),t)N.stdout.write(`
20
- `)}finishProgressBar(e,t){if(!this.enabled||!this.fancy||K()||!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(K()){console.warn("Log clearing is not supported in browser environments.");return}try{console.warn("Clearing logs...",this.config.logDirectory);let t=await Jt(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=ot(this.config.logDirectory,n);if(e.before)try{if((await it(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 Xt(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 ys(e,t={}){let{maxRetries:r=3,retryDelay:n=1000,isRetryable:i=()=>!0,fallback:o}=t,s=Error("Unknown error occurred");for(let c=0;c<=r;c++)try{return await e()}catch(l){if(s=l instanceof Error?l:Error(String(l)),c===r||!i(s))break;if(n>0)await new Promise((a)=>setTimeout(a,n))}if(o!==void 0)return o;throw s instanceof Error?s:Error(`Unknown error: ${String(s)}`)}function bs(e){return e instanceof se}function yd(e){return e instanceof vr}function bd(e){if(bs(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 Sr{defaultParsers;constructor(){this.defaultParsers=[{name:"boolean",canParse:(e,t)=>t==="boolean"||["true","false","1","0","yes","no"].includes(e.toLowerCase()),parse:(e)=>{let t=e.toLowerCase();return["true","1","yes"].includes(t)}},{name:"number",canParse:(e,t)=>t==="number"||!Number.isNaN(Number(e))&&!Number.isNaN(Number.parseFloat(e)),parse:(e)=>{let t=Number(e);if(Number.isNaN(t))throw TypeError(`Cannot parse "${e}" as number`);return t}},{name:"array",canParse:(e,t)=>t==="array"||e.startsWith("[")||e.includes(","),parse:(e)=>{try{let t=JSON.parse(e);if(Array.isArray(t))return t}catch{}return e.split(",").map((t)=>t.trim())}},{name:"json",canParse:(e,t)=>t==="object"||(e.startsWith("{")&&e.endsWith("}")||e.startsWith("[")&&e.endsWith("]")),parse:(e)=>{try{return JSON.parse(e)}catch(t){throw Error(`Cannot parse "${e}" as JSON: ${t}`)}}}]}async applyEnvironmentVariables(e,t,r={}){let{prefix:n,useCamelCase:i=!0,useBackwardCompatibility:o=!0,customParsers:s={},verbose:c=!1,trackPerformance:l=!0}=r,a=async()=>{if(!e)return{config:t,source:{type:"environment",priority:50,timestamp:new Date}};let u=n||this.generateEnvPrefix(e),f={...t};return this.processObject(f,[],u,{useCamelCase:i,useBackwardCompatibility:o,customParsers:s,verbose:c,configName:e}),{config:f,source:{type:"environment",priority:50,timestamp:new Date}}};if(l)return Tt.track("applyEnvironmentVariables",a,{configName:e});return a()}generateEnvPrefix(e){return e.toUpperCase().replace(/-/g,"_")}formatEnvKey(e,t){if(!t)return e.toUpperCase();return e.replace(/([A-Z])/g,"_$1").toUpperCase()}processObject(e,t,r,n){for(let[i,o]of Object.entries(e)){let s=[...t,i],c=s.map((u)=>this.formatEnvKey(u,n.useCamelCase)),l=`${r}_${c.join("_")}`,a=n.useBackwardCompatibility?`${r}_${s.map((u)=>u.toUpperCase()).join("_")}`:null;if(n.verbose);if(typeof o==="object"&&o!==null&&!Array.isArray(o))this.processObject(o,s,r,n);else{let u=Zt.env[l]||(a?Zt.env[a]:void 0);if(u!==void 0){if(n.verbose){let f=Zt.env[l]?l:a}try{e[i]=this.parseEnvironmentValue(u,typeof o,l,n.customParsers,n.configName)}catch(f){if(f instanceof wr)throw f;throw Me.envVar(l,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 Me.envVar(r,e,`${t} (via ${o.name} parser)`,i)}return e}getEnvironmentVariables(e){let t={},r=e.toUpperCase();for(let[n,i]of Object.entries(Zt.env))if(n.startsWith(r)&&i!==void 0)t[n]=i;return t}validateEnvironmentVariable(e,t,r){let n=[];if(!/^[A-Z_][A-Z0-9_]*$/.test(e))n.push(`Environment variable key "${e}" should only contain uppercase letters, numbers, and underscores`);if(r)try{this.parseEnvironmentValue(e,t,r,{})}catch(i){n.push(`Cannot parse value "${t}" as ${r}: ${i}`)}return{isValid:n.length===0,errors:n}}generateEnvVarDocs(e,t,r={}){let{prefix:n,format:i="text"}=r,o=n||this.generateEnvPrefix(e),s=[];switch(this.extractEnvVarInfo(t,[],o,s),i){case"markdown":return this.formatAsMarkdown(s,e);case"json":return JSON.stringify(s,null,2);default:return this.formatAsText(s,e)}}extractEnvVarInfo(e,t,r,n){for(let[i,o]of Object.entries(e)){let s=[...t,i],c=`${r}_${s.map((l)=>this.formatEnvKey(l,!0)).join("_")}`;if(typeof o==="object"&&o!==null&&!Array.isArray(o))this.extractEnvVarInfo(o,s,r,n);else n.push({key:c,type:Array.isArray(o)?"array":typeof o,description:`Configuration for ${s.join(".")}`,example:this.generateExample(o)})}}generateExample(e){if(Array.isArray(e))return JSON.stringify(e);if(typeof e==="object"&&e!==null)return JSON.stringify(e);return String(e)}formatAsText(e,t){let r=`Environment Variables for ${t}:
20
+ `)}finishProgressBar(e,t){if(!this.enabled||!this.fancy||K()||!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(K()){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=st(this.config.logDirectory,n);if(e.before)try{if((await ot(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)}}}async function xs(e,t={}){let{maxRetries:r=3,retryDelay:n=1000,isRetryable:i=()=>!0,fallback:o}=t,s=Error("Unknown error occurred");for(let c=0;c<=r;c++)try{return await e()}catch(l){if(s=l instanceof Error?l:Error(String(l)),c===r||!i(s))break;if(n>0)await new Promise((a)=>setTimeout(a,n))}if(o!==void 0)return o;throw s instanceof Error?s:Error(`Unknown error: ${String(s)}`)}function vs(e){return e instanceof ae}function xd(e){return e instanceof $r}function vd(e){if(vs(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 Er{defaultParsers;constructor(){this.defaultParsers=[{name:"boolean",canParse:(e,t)=>t==="boolean"||["true","false","1","0","yes","no"].includes(e.toLowerCase()),parse:(e)=>{let t=e.toLowerCase();return["true","1","yes"].includes(t)}},{name:"number",canParse:(e,t)=>t==="number"||!Number.isNaN(Number(e))&&!Number.isNaN(Number.parseFloat(e)),parse:(e)=>{let t=Number(e);if(Number.isNaN(t))throw TypeError(`Cannot parse "${e}" as number`);return t}},{name:"array",canParse:(e,t)=>t==="array"||e.startsWith("[")||e.includes(","),parse:(e)=>{try{let t=JSON.parse(e);if(Array.isArray(t))return t}catch{}return e.split(",").map((t)=>t.trim())}},{name:"json",canParse:(e,t)=>t==="object"||(e.startsWith("{")&&e.endsWith("}")||e.startsWith("[")&&e.endsWith("]")),parse:(e)=>{try{return JSON.parse(e)}catch(t){throw Error(`Cannot parse "${e}" as JSON: ${t}`)}}}]}async applyEnvironmentVariables(e,t,r={}){let{prefix:n,useCamelCase:i=!0,useBackwardCompatibility:o=!0,customParsers:s={},verbose:c=!1,trackPerformance:l=!0}=r,a=async()=>{if(!e)return{config:t,source:{type:"environment",priority:50,timestamp:new Date}};let u=n||this.generateEnvPrefix(e),f={...t};return this.processObject(f,[],u,{useCamelCase:i,useBackwardCompatibility:o,customParsers:s,verbose:c,configName:e}),{config:f,source:{type:"environment",priority:50,timestamp:new Date}}};if(l)return Ot.track("applyEnvironmentVariables",a,{configName:e});return a()}generateEnvPrefix(e){return e.toUpperCase().replace(/-/g,"_")}formatEnvKey(e,t){if(!t)return e.toUpperCase();return e.replace(/([A-Z])/g,"_$1").toUpperCase()}processObject(e,t,r,n){for(let[i,o]of Object.entries(e)){let s=[...t,i],c=s.map((u)=>this.formatEnvKey(u,n.useCamelCase)),l=`${r}_${c.join("_")}`,a=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=er.env[l]||(a?er.env[a]:void 0);if(u!==void 0){if(n.verbose){let f=er.env[l]?l:a}try{e[i]=this.parseEnvironmentValue(u,typeof o,l,n.customParsers,n.configName)}catch(f){if(f instanceof Cr)throw f;throw Fe.envVar(l,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(er.env))if(n.startsWith(r)&&i!==void 0)t[n]=i;return t}validateEnvironmentVariable(e,t,r){let n=[];if(!/^[A-Z_][A-Z0-9_]*$/.test(e))n.push(`Environment variable key "${e}" should only contain uppercase letters, numbers, and underscores`);if(r)try{this.parseEnvironmentValue(e,t,r,{})}catch(i){n.push(`Cannot parse value "${t}" as ${r}: ${i}`)}return{isValid:n.length===0,errors:n}}generateEnvVarDocs(e,t,r={}){let{prefix:n,format:i="text"}=r,o=n||this.generateEnvPrefix(e),s=[];switch(this.extractEnvVarInfo(t,[],o,s),i){case"markdown":return this.formatAsMarkdown(s,e);case"json":return JSON.stringify(s,null,2);default:return this.formatAsText(s,e)}}extractEnvVarInfo(e,t,r,n){for(let[i,o]of Object.entries(e)){let s=[...t,i],c=`${r}_${s.map((l)=>this.formatEnvKey(l,!0)).join("_")}`;if(typeof o==="object"&&o!==null&&!Array.isArray(o))this.extractEnvVarInfo(o,s,r,n);else n.push({key:c,type:Array.isArray(o)?"array":typeof o,description:`Configuration for ${s.join(".")}`,example:this.generateExample(o)})}}generateExample(e){if(Array.isArray(e))return JSON.stringify(e);if(typeof e==="object"&&e!==null)return JSON.stringify(e);return String(e)}formatAsText(e,t){let r=`Environment Variables for ${t}:
21
21
 
22
22
  `;for(let n of e)r+=`${n.key}
23
23
  `,r+=` Type: ${n.type}
@@ -29,25 +29,25 @@ var dc=(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 xd(e,t){let r=Cs("process");if(typeof r>"u"||!r.env)return t;let n=r.env[e];return n!==void 0?n:t}function xs(e,t,r={}){return vs(e,t,r,new WeakMap)}function vs(e,t,r,n){let{arrayMergeMode:i="replace",skipNullish:o=!1,customMerger:s}=r;if(t===null||t===void 0)return o?e:t;if(s){let c=s(e,t);if(c!==void 0)return c}if(Array.isArray(t)||Array.isArray(e))return ws(e,t,i,n);if(!le(t)||!le(e))return t;return Cd(e,t,r,n)}function ws(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 vd(e,t);case"smart":return wd(e,t,n);default:return t}return t}function vd(e,t){let r=[...t];for(let n of e)if(!r.some((i)=>Dn(i,n)))r.push(n);return r}function wd(e,t,r){if(t.length===0)return e;if(e.length===0)return t;if(le(t[0])&&le(e[0]))return $d(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 $d(e,t,r){let n=[...t];for(let i of e){if(!le(i)){n.push(i);continue}let o=["id","name","key","path","type"],s=!1;for(let c of o)if(c in i){if(n.find((a)=>le(a)&&(c in a)&&a[c]===i[c])){s=!0;break}}if(!s)n.push(i)}return n}function Cd(e,t,r,n){let i=t;if(le(i)&&n.has(i))return n.get(i);let o={...e};if(le(i))n.set(i,o);for(let s in i){if(!Object.prototype.hasOwnProperty.call(i,s))continue;let c=i[s],l=o[s];if(r.skipNullish&&(c===null||c===void 0))continue;if(c===null||c===void 0){o[s]=c;continue}if(le(c)&&le(l))o[s]=vs(l,c,r,n);else if(Array.isArray(c)||Array.isArray(l))o[s]=ws(l,c,r.arrayMergeMode||"smart",n);else o[s]=c}return o}function Qn(e,t,r="replace"){return xs(e,t,{arrayMergeMode:r==="replace"?"replace":"smart",skipNullish:!0})}function Dn(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(!Dn(e[r],t[r]))return!1;return!0}if(le(e)&&le(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(!Dn(e[i],t[i]))return!1}return!0}return!1}function le(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}class Ar{extensions=[".ts",".js",".mjs",".cjs",".json",".mts",".cts"];async loadFromPath(e,t,r={}){let{arrayStrategy:n="replace",useCache:i=!0,cacheTtl:o,trackPerformance:s=!0,verbose:c=!1}=r;if(i){let a=ut.getWithFileCheck("file",e);if(a){if(c)console.log(`Configuration loaded from cache: ${e}`);return a}}let l=async()=>{if(!Qt(e))return null;try{let a=`?t=${Date.now()}`,u=await import(e+a),f=u.default||u,d="default"in u,h=Object.keys(u).length>0;if(!d&&!h)throw new At(e,Error("Configuration file is empty and exports nothing"),"unknown");if(typeof f!=="object"||f===null||Array.isArray(f))throw new At(e,Error("Configuration must export a valid object"),"unknown");let m={config:Qn(t,f,n),source:{type:"file",path:e,priority:100,timestamp:new Date}};if(i)ut.setWithFileCheck("file",m,e,o);return m}catch(a){throw a instanceof Error?Me.configLoad(e,a):Me.configLoad(e,Error(String(a)))}};if(s)return Tt.track("loadFromPath",l,{path:e});return l()}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(kn(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 ys(async()=>Qt(e),{maxRetries:2,retryDelay:100,fallback:!1})}async discoverConfigFiles(e,t,r){let n=[];if(!Qt(e))return n;if(t||r){let i=this.generateNamePatterns(t||"",r);for(let o of i)for(let s of this.extensions){let c=kn(e,`${o}${s}`);if(await this.checkFileAccess(c))n.push(c)}}else try{let{readdirSync:i}=await import("fs"),o=i(e);for(let s of o)if(this.looksLikeConfigFile(s)){let c=kn(e,s);if(await this.checkFileAccess(c))n.push(c)}}catch{return[]}return n}looksLikeConfigFile(e){return[/\.config\.(ts|js|mjs|cjs|json|mts|cts)$/,/^\..*\.(ts|js|mjs|cjs|json|mts|cts)$/,/config\.(ts|js|mjs|cjs|json|mts|cts)$/].some((r)=>r.test(e))}async validateConfigFile(e){let t=[];try{if(!Qt(e))return t.push("Configuration file does not exist"),t;let r=await import(e),n=r.default||r;if(n===void 0)t.push("Configuration file must export a default value or named exports");else if(typeof n!=="object"||n===null)t.push("Configuration must be an object");else if(Array.isArray(n))t.push("Configuration cannot be an array at the root level");if(e.endsWith(".json"))try{let{readFileSync:i}=await import("fs"),o=i(e,"utf8");JSON.parse(o)}catch(i){t.push(`Invalid JSON syntax: ${i}`)}}catch(r){t.push(`Failed to load configuration file: ${r}`)}return t}async getFileModificationTime(e){try{let{statSync:t}=await import("fs");return t(e).mtime}catch{return null}}async preloadConfigurations(e,t={}){let r=new Map;return await Promise.allSettled(e.map(async(n)=>{try{let i=await this.loadFromPath(n,{},t);if(i)r.set(n,i.config)}catch(i){if(t.verbose)console.warn(`Failed to preload ${n}:`,i)}})),r}}class ei{async validateConfiguration(e,t,r={}){let{stopOnFirstError:n=!1,validateRequired:i=!0,validateTypes:o=!0,customRules:s=[],trackPerformance:c=!0,verbose:l=!1}=r,a=async()=>{let u=[],f=[],d={stopOnFirstError:n,validateRequired:i,validateTypes:o,customRules:s,trackPerformance:c,verbose:l};try{if(typeof t==="string")return await this.validateWithSchemaFile(e,t,d);else if(Array.isArray(t))return this.validateWithRules(e,[...t,...s],d);else return this.validateWithJSONSchema(e,t,d)}catch(h){return u.push({path:"",message:`Validation failed: ${h}`,rule:"system"}),{isValid:!1,errors:u,warnings:f}}};if(c)return await Tt.track("validateConfiguration",a);return a()}async validateWithSchemaFile(e,t,r){try{if(!Df(t))throw new Et(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 Et(t,[{path:"",message:`Failed to load schema: ${n}`}])}}validateWithJSONSchema(e,t,r){let n=[],i=[];return this.validateObjectAgainstSchema(e,t,"",n,i,r),{isValid:n.length===0,errors:n,warnings:i}}validateObjectAgainstSchema(e,t,r,n,i,o){if(o.validateTypes&&t.type){let s=Array.isArray(e)?"array":typeof e,c=Array.isArray(t.type)?t.type:[t.type];if(!c.includes(s)){if(n.push({path:r,message:`Expected type ${c.join(" or ")}, got ${s}`,expected:c.join(" or "),actual:s,rule:"type"}),o.stopOnFirstError)return}}if(t.enum&&!t.enum.includes(e)){if(n.push({path:r,message:`Value must be one of: ${t.enum.join(", ")}`,expected:t.enum.join(", "),actual:e,rule:"enum"}),o.stopOnFirstError)return}if(typeof e==="string"){if(t.minLength!==void 0&&e.length<t.minLength)n.push({path:r,message:`String length must be at least ${t.minLength}`,expected:`>= ${t.minLength}`,actual:e.length,rule:"minLength"});if(t.maxLength!==void 0&&e.length>t.maxLength)n.push({path:r,message:`String length must not exceed ${t.maxLength}`,expected:`<= ${t.maxLength}`,actual:e.length,rule:"maxLength"});if(t.pattern){if(!new RegExp(t.pattern).test(e))n.push({path:r,message:`String does not match pattern ${t.pattern}`,expected:t.pattern,actual:e,rule:"pattern"})}}if(typeof e==="number"){if(t.minimum!==void 0&&e<t.minimum)n.push({path:r,message:`Value must be at least ${t.minimum}`,expected:`>= ${t.minimum}`,actual:e,rule:"minimum"});if(t.maximum!==void 0&&e>t.maximum)n.push({path:r,message:`Value must not exceed ${t.maximum}`,expected:`<= ${t.maximum}`,actual:e,rule:"maximum"})}if(Array.isArray(e)&&t.items)for(let s=0;s<e.length;s++){let c=r?`${r}[${s}]`:`[${s}]`;if(this.validateObjectAgainstSchema(e[s],t.items,c,n,i,o),o.stopOnFirstError&&n.length>0)return}if(e&&typeof e==="object"&&!Array.isArray(e)){let s=e;if(o.validateRequired&&t.required){for(let c of t.required)if(!(c in s)){if(n.push({path:r?`${r}.${c}`:c,message:`Missing required property '${c}'`,expected:"required",rule:"required"}),o.stopOnFirstError)return}}if(t.properties){for(let[c,l]of Object.entries(t.properties))if(c in s){let a=r?`${r}.${c}`:c;if(this.validateObjectAgainstSchema(s[c],l,a,n,i,o),o.stopOnFirstError&&n.length>0)return}}if(t.additionalProperties===!1){let c=new Set(Object.keys(t.properties||{}));for(let l of Object.keys(s))if(!c.has(l))i.push({path:r?`${r}.${l}`:l,message:`Additional property '${l}' is not allowed`,rule:"additionalProperties"})}}}validateWithRules(e,t,r){let n=[],i=[];for(let o of t)try{let s=this.getValueByPath(e,o.path),c=this.validateWithRule(s,o,o.path);if(n.push(...c),r.stopOnFirstError&&n.length>0)break}catch(s){n.push({path:o.path,message:`Rule validation failed: ${s}`,rule:"system"})}return{isValid:n.length===0,errors:n,warnings:i}}validateWithRule(e,t,r){let n=[];if(t.required&&(e===void 0||e===null))return n.push({path:r,message:t.message||`Property '${r}' is required`,expected:"required",rule:"required"}),n;if(e===void 0||e===null)return n;if(t.type){let i=Array.isArray(e)?"array":typeof e;if(i!==t.type)n.push({path:r,message:t.message||`Expected type ${t.type}, got ${i}`,expected:t.type,actual:i,rule:"type"})}if(t.min!==void 0){let i=Array.isArray(e)?e.length:typeof e==="string"?e.length:typeof e==="number"?e:0;if(i<t.min)n.push({path:r,message:t.message||`Value must be at least ${t.min}`,expected:`>= ${t.min}`,actual:i,rule:"min"})}if(t.max!==void 0){let i=Array.isArray(e)?e.length:typeof e==="string"?e.length:typeof e==="number"?e:0;if(i>t.max)n.push({path:r,message:t.message||`Value must not exceed ${t.max}`,expected:`<= ${t.max}`,actual:i,rule:"max"})}if(t.pattern&&typeof e==="string"){if(!t.pattern.test(e))n.push({path:r,message:t.message||`Value does not match pattern ${t.pattern}`,expected:t.pattern.toString(),actual:e,rule:"pattern"})}if(t.enum&&!t.enum.includes(e))n.push({path:r,message:t.message||`Value must be one of: ${t.enum.join(", ")}`,expected:t.enum.join(", "),actual:e,rule:"enum"});if(t.validator){let i=t.validator(e);if(i)n.push({path:r,message:t.message||i,rule:"custom"})}return n}getValueByPath(e,t){if(!t)return e;let r=t.split("."),n=e;for(let i of r)if(n&&typeof n==="object"&&i in n)n=n[i];else return;return n}generateRulesFromInterface(e){let t=[],r=e.matchAll(/(\w+)(\?)?:\s*(\w+)/g);for(let n of r){let[,i,o,s]=n;t.push({path:i,required:!o,type:this.mapTypeScriptType(s)})}return t}mapTypeScriptType(e){switch(e.toLowerCase()){case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"array":return"array";case"object":return"object";default:return"object"}}static createCommonRules(){return{server:[{path:"port",required:!0,type:"number",min:1,max:65535},{path:"host",required:!0,type:"string",min:1},{path:"ssl",type:"boolean"}],database:[{path:"url",required:!0,type:"string",min:1},{path:"pool",type:"number",min:1,max:100},{path:"timeout",type:"number",min:0}],api:[{path:"baseUrl",required:!0,type:"string",pattern:Es},{path:"timeout",type:"number",min:0},{path:"retries",type:"number",min:0,max:10}]}}}class ti{fileLoader=new Ar;envProcessor=new Sr;validator=new ei;async loadConfig(e){let t=Date.now(),{cache:r,performance:n,schema:i,validate:o,...s}=e;try{if(r?.enabled){let l=this.checkCache(s.name||"",s);if(l)return l}let c;try{c=await this.loadConfigurationStrategies(s,!0,r)}catch(l){let a=s.__strictErrorHandling;if(l instanceof Error&&l.name==="ConfigNotFoundError"){if(a)throw l;c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`No configuration file found for "${s.name||"config"}", using defaults with environment variables`]}}else if(l instanceof Error&&l.name==="ConfigLoadError"){let u=l.message.includes("EACCES")||l.message.includes("EPERM")||l.message.includes("permission denied"),f=!u&&(l.message.includes("syntax")||l.message.includes("Expected")||l.message.includes("Unexpected")||l.message.includes("BuildMessage")||l.message.includes("errors building")),d=l.message.includes("Configuration must export a valid object")||l.message.includes("Configuration file is empty and exports nothing");if(a&&(d||u))throw l;if(f&&(!a||!d))c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:["Configuration file has syntax errors, using defaults with environment variables"]};else if(!a)c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`Configuration loading error, using defaults: ${l.message}`]};else throw l}else c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`Configuration loading failed, using defaults: ${l instanceof Error?l.message:String(l)}`]}}if(i||o)await this.validateConfiguration(c.config,i,o,s.name);if(r?.enabled&&c)this.cacheResult(s.name||"",c,r,s);if(n?.enabled){let l={operation:"loadConfig",duration:Date.now()-t,configName:s.name,timestamp:new Date};if(n.onMetrics)n.onMetrics(l);if(n.slowThreshold&&l.duration>n.slowThreshold)he.warn(`Slow configuration loading detected: ${l.duration}ms for ${s.name}`);c.metrics=l}return c}catch(c){let l=Date.now()-t;throw he.error(`Configuration loading failed after ${l}ms:`,[c instanceof Error?c:Error(String(c))]),c}}async loadConfigurationStrategies(e,t=!1,r){let{name:n="",alias:i,cwd:o,configDir:s,defaultConfig:c,checkEnv:l=!0,arrayStrategy:a="replace",verbose:u=!1}=e,f=o||He.cwd(),d=[],h=await this.loadLocalConfiguration(n,i,f,s,c,a,u,l,r);if(h)return d.push(...this.getLocalSearchPaths(n,i,f,s)),this.finalizeResult(h,d,l,n,u);let p=await this.loadHomeConfiguration(n,i,c,a,u,l);if(p)return d.push(...this.getHomeSearchPaths(n,i)),this.finalizeResult(p,d,l,n,u);let g=await this.loadPackageJsonConfiguration(n,i,f,c,a,u,l);if(g)return d.push(re(f,"package.json")),this.finalizeResult(g,d,l,n,u);if(d.push(...this.getAllSearchPaths(n,i,f,s)),t)throw Me.configNotFound(n,d,i);return{...await this.applyEnvironmentVariables(n,c,l,u),warnings:[`No configuration file found for "${n}"${i?` or alias "${i}"`:""}, using defaults with environment variables`]}}async loadLocalConfiguration(e,t,r,n,i,o,s,c,l){let a=c?kt(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,a,{arrayStrategy:o,verbose:s,cacheTtl:l?.ttl,useCache:!l?.ttl||l.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?kt(e,r,i):r,c=[re(et(),".config",e),re(et(),".config"),et()];for(let l of c){if(i)he.info(`Checking home directory: ${l}`);let a=this.fileLoader.generateConfigPaths(e,l,t),u=await this.fileLoader.tryLoadFromPaths(a,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 c=s?kt(e,n,o):n;try{let l=re(r,"package.json");if(!Mn(l))return null;let a=await import(l),u=a[e],f=e;if(!u&&t)u=a[t],f=t;if(u&&typeof u==="object"&&!Array.isArray(u)){if(o)he.success(`Configuration loaded from package.json: ${f}`);return{config:Qn(c,u,i),source:{type:"package.json",path:l,priority:30,timestamp:new Date}}}}catch(l){if(o)he.warn("Failed to load package.json:",[l instanceof Error?l:Error(String(l))])}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:kt(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 Me.configValidation(n||"unknown",i,n)}checkCache(e,t){let r=this.generateCacheKey(e,t);return ut.get(r)||null}cacheResult(e,t,r,n){let i=this.generateCacheKey(e,n);ut.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,re(e,"config"),re(e,".config"),t?re(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(re(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=[re(et(),".config",e),re(et(),".config"),et()],n=[];for(let i of r)n.push(...this.fileLoader.generateConfigPaths(e,i,t));return n}async loadConfigWithResult(e){return this.loadConfig(e)}}function qo(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 Rd(e){return Te.loadConfig({...e,__strictErrorHandling:!0})}async function $s(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 Te.loadConfig(e);else n=await Te.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)he.warn("Unexpected error loading config, using defaults:",[n instanceof Error?n:Error(String(n))]);let c=r?{...e,defaultConfig:t}:{...e,defaultConfig:t,cache:{enabled:!0},performance:{enabled:!1}};if("checkEnv"in e?e.checkEnv!==!1:!0)return(await Te.applyEnvironmentVariables(c.name||"",t,!0,c.verbose||!1))?.config??t;return t}}async function kd(e={defaultConfig:{}}){if(typeof e==="string"){let{cwd:t}=await import("process");try{return(await Te.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"&&qo(r)))return(await Te.applyEnvironmentVariables(e,{},!0,!1)).config;throw r}}try{return(await Te.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"&&qo(t)))return(await Te.applyEnvironmentVariables(e.name||"",e.defaultConfig||{},e.checkEnv!==!1,e.verbose||!1)).config;throw t}}async function Sd(e,t,r="replace"){let n=new Ar;try{let i=await n.loadFromPath(e,t,{arrayStrategy:r,useCache:!1,trackPerformance:!1});return i?i.config:null}catch{return null}}function kt(e,t,r=!1){let n=new Sr,i=e.toUpperCase().replace(/[^A-Z0-9]/g,"_");function o(s,c=[]){let l={...s};for(let[a,u]of Object.entries(s)){let f=[...c,a],d=[`${i}_${f.join("_").toUpperCase()}`,`${i}_${f.map((g)=>g.toUpperCase()).join("")}`,`${i}_${f.map((g)=>g.replace(/([A-Z])/g,"_$1").toUpperCase()).join("")}`],h,p;for(let g of d)if(h=He.env[g],h!==void 0){p=g;break}if(h!==void 0&&p)if(typeof u==="boolean")l[a]=["true","1","yes"].includes(h.toLowerCase());else if(typeof u==="number"){let g=Number(h);if(!Number.isNaN(g))l[a]=g}else if(Array.isArray(u))try{l[a]=JSON.parse(h)}catch{l[a]=h.split(",").map((g)=>g.trim())}else l[a]=h;else if(u&&typeof u==="object"&&!Array.isArray(u))l[a]=o(u,f)}return l}return o(t)}function Ad(e){let t=re(He.cwd(),e.configDir),r=re(He.cwd(),e.generatedDir),n=re(r,"config-types.ts");if(!Mn(ko(n)))mf(ko(n),{recursive:!0,mode:511});let i=Mn(t)?pf(t).map((s)=>s.replace(/\.(ts|js|mjs|cjs|mts|cts|json)$/,"")).sort():[],o=`// Generated by bunfig v${rh}
32
+ `;return r}}function wd(e,t){let r=ks("process");if(typeof r>"u"||!r.env)return t;let n=r.env[e];return n!==void 0?n:t}function ws(e,t,r={}){return $s(e,t,r,new WeakMap)}function $s(e,t,r,n){let{arrayMergeMode:i="replace",skipNullish:o=!1,customMerger:s}=r;if(t===null||t===void 0)return o?e:t;if(s){let c=s(e,t);if(c!==void 0)return c}if(Array.isArray(t)||Array.isArray(e))return Cs(e,t,i,n);if(!ce(t)||!ce(e))return t;return kd(e,t,r,n)}function Cs(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 $d(e,t);case"smart":return Cd(e,t,n);default:return t}return t}function $d(e,t){let r=[...t];for(let n of e)if(!r.some((i)=>Bn(i,n)))r.push(n);return r}function Cd(e,t,r){if(t.length===0)return e;if(e.length===0)return t;if(ce(t[0])&&ce(e[0]))return Rd(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 Rd(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 c of o)if(c in i){if(n.find((a)=>ce(a)&&(c in a)&&a[c]===i[c])){s=!0;break}}if(!s)n.push(i)}return n}function kd(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 c=i[s],l=o[s];if(r.skipNullish&&(c===null||c===void 0))continue;if(c===null||c===void 0){o[s]=c;continue}if(ce(c)&&ce(l))o[s]=$s(l,c,r,n);else if(Array.isArray(c)||Array.isArray(l))o[s]=Cs(l,c,r.arrayMergeMode||"smart",n);else o[s]=c}return o}function ti(e,t,r="replace"){return ws(e,t,{arrayMergeMode:r==="replace"?"replace":"smart",skipNullish:!0})}function Bn(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(!Bn(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(!Bn(e[i],t[i]))return!1}return!0}return!1}function ce(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}class Tr{extensions=[".ts",".js",".mjs",".cjs",".json",".mts",".cts"];async loadFromPath(e,t,r={}){let{arrayStrategy:n="replace",useCache:i=!0,cacheTtl:o,trackPerformance:s=!0,verbose:c=!1}=r;if(i){let a=ft.getWithFileCheck("file",e);if(a){if(c)console.log(`Configuration loaded from cache: ${e}`);return a}}let l=async()=>{if(!tr(e))return null;try{let a=`?t=${Date.now()}`,u=await import(e+a),f=u.default||u,d="default"in u,h=Object.keys(u).length>0;if(!d&&!h)throw new Tt(e,Error("Configuration file is empty and exports nothing"),"unknown");if(typeof f!=="object"||f===null||Array.isArray(f))throw new Tt(e,Error("Configuration must export a valid object"),"unknown");let m={config:ti(t,f,n),source:{type:"file",path:e,priority:100,timestamp:new Date}};if(i)ft.setWithFileCheck("file",m,e,o);return m}catch(a){throw a instanceof Error?Fe.configLoad(e,a):Fe.configLoad(e,Error(String(a)))}};if(s)return Ot.track("loadFromPath",l,{path:e});return l()}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(An(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 xs(async()=>tr(e),{maxRetries:2,retryDelay:100,fallback:!1})}async discoverConfigFiles(e,t,r){let n=[];if(!tr(e))return n;if(t||r){let i=this.generateNamePatterns(t||"",r);for(let o of i)for(let s of this.extensions){let c=An(e,`${o}${s}`);if(await this.checkFileAccess(c))n.push(c)}}else try{let{readdirSync:i}=await import("fs"),o=i(e);for(let s of o)if(this.looksLikeConfigFile(s)){let c=An(e,s);if(await this.checkFileAccess(c))n.push(c)}}catch{return[]}return n}looksLikeConfigFile(e){return[/\.config\.(ts|js|mjs|cjs|json|mts|cts)$/,/^\..*\.(ts|js|mjs|cjs|json|mts|cts)$/,/config\.(ts|js|mjs|cjs|json|mts|cts)$/].some((r)=>r.test(e))}async validateConfigFile(e){let t=[];try{if(!tr(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 ri{async validateConfiguration(e,t,r={}){let{stopOnFirstError:n=!1,validateRequired:i=!0,validateTypes:o=!0,customRules:s=[],trackPerformance:c=!0,verbose:l=!1}=r,a=async()=>{let u=[],f=[],d={stopOnFirstError:n,validateRequired:i,validateTypes:o,customRules:s,trackPerformance:c,verbose:l};try{if(typeof t==="string")return await this.validateWithSchemaFile(e,t,d);else if(Array.isArray(t))return this.validateWithRules(e,[...t,...s],d);else return this.validateWithJSONSchema(e,t,d)}catch(h){return u.push({path:"",message:`Validation failed: ${h}`,rule:"system"}),{isValid:!1,errors:u,warnings:f}}};if(c)return await Ot.track("validateConfiguration",a);return a()}async validateWithSchemaFile(e,t,r){try{if(!Bf(t))throw new Nt(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 Nt(t,[{path:"",message:`Failed to load schema: ${n}`}])}}validateWithJSONSchema(e,t,r){let n=[],i=[];return this.validateObjectAgainstSchema(e,t,"",n,i,r),{isValid:n.length===0,errors:n,warnings:i}}validateObjectAgainstSchema(e,t,r,n,i,o){if(o.validateTypes&&t.type){let s=Array.isArray(e)?"array":typeof e,c=Array.isArray(t.type)?t.type:[t.type];if(!c.includes(s)){if(n.push({path:r,message:`Expected type ${c.join(" or ")}, got ${s}`,expected:c.join(" or "),actual:s,rule:"type"}),o.stopOnFirstError)return}}if(t.enum&&!t.enum.includes(e)){if(n.push({path:r,message:`Value must be one of: ${t.enum.join(", ")}`,expected:t.enum.join(", "),actual:e,rule:"enum"}),o.stopOnFirstError)return}if(typeof e==="string"){if(t.minLength!==void 0&&e.length<t.minLength)n.push({path:r,message:`String length must be at least ${t.minLength}`,expected:`>= ${t.minLength}`,actual:e.length,rule:"minLength"});if(t.maxLength!==void 0&&e.length>t.maxLength)n.push({path:r,message:`String length must not exceed ${t.maxLength}`,expected:`<= ${t.maxLength}`,actual:e.length,rule:"maxLength"});if(t.pattern){if(!new RegExp(t.pattern).test(e))n.push({path:r,message:`String does not match pattern ${t.pattern}`,expected:t.pattern,actual:e,rule:"pattern"})}}if(typeof e==="number"){if(t.minimum!==void 0&&e<t.minimum)n.push({path:r,message:`Value must be at least ${t.minimum}`,expected:`>= ${t.minimum}`,actual:e,rule:"minimum"});if(t.maximum!==void 0&&e>t.maximum)n.push({path:r,message:`Value must not exceed ${t.maximum}`,expected:`<= ${t.maximum}`,actual:e,rule:"maximum"})}if(Array.isArray(e)&&t.items)for(let s=0;s<e.length;s++){let c=r?`${r}[${s}]`:`[${s}]`;if(this.validateObjectAgainstSchema(e[s],t.items,c,n,i,o),o.stopOnFirstError&&n.length>0)return}if(e&&typeof e==="object"&&!Array.isArray(e)){let s=e;if(o.validateRequired&&t.required){for(let c of t.required)if(!(c in s)){if(n.push({path:r?`${r}.${c}`:c,message:`Missing required property '${c}'`,expected:"required",rule:"required"}),o.stopOnFirstError)return}}if(t.properties){for(let[c,l]of Object.entries(t.properties))if(c in s){let a=r?`${r}.${c}`:c;if(this.validateObjectAgainstSchema(s[c],l,a,n,i,o),o.stopOnFirstError&&n.length>0)return}}if(t.additionalProperties===!1){let c=new Set(Object.keys(t.properties||{}));for(let l of Object.keys(s))if(!c.has(l))i.push({path:r?`${r}.${l}`:l,message:`Additional property '${l}' is not allowed`,rule:"additionalProperties"})}}}validateWithRules(e,t,r){let n=[],i=[];for(let o of t)try{let s=this.getValueByPath(e,o.path),c=this.validateWithRule(s,o,o.path);if(n.push(...c),r.stopOnFirstError&&n.length>0)break}catch(s){n.push({path:o.path,message:`Rule validation failed: ${s}`,rule:"system"})}return{isValid:n.length===0,errors:n,warnings:i}}validateWithRule(e,t,r){let n=[];if(t.required&&(e===void 0||e===null))return n.push({path:r,message:t.message||`Property '${r}' is required`,expected:"required",rule:"required"}),n;if(e===void 0||e===null)return n;if(t.type){let i=Array.isArray(e)?"array":typeof e;if(i!==t.type)n.push({path:r,message:t.message||`Expected type ${t.type}, got ${i}`,expected:t.type,actual:i,rule:"type"})}if(t.min!==void 0){let i=Array.isArray(e)?e.length:typeof e==="string"?e.length:typeof e==="number"?e:0;if(i<t.min)n.push({path:r,message:t.message||`Value must be at least ${t.min}`,expected:`>= ${t.min}`,actual:i,rule:"min"})}if(t.max!==void 0){let i=Array.isArray(e)?e.length:typeof e==="string"?e.length:typeof e==="number"?e:0;if(i>t.max)n.push({path:r,message:t.message||`Value must not exceed ${t.max}`,expected:`<= ${t.max}`,actual:i,rule:"max"})}if(t.pattern&&typeof e==="string"){if(!t.pattern.test(e))n.push({path:r,message:t.message||`Value does not match pattern ${t.pattern}`,expected:t.pattern.toString(),actual:e,rule:"pattern"})}if(t.enum&&!t.enum.includes(e))n.push({path:r,message:t.message||`Value must be one of: ${t.enum.join(", ")}`,expected:t.enum.join(", "),actual:e,rule:"enum"});if(t.validator){let i=t.validator(e);if(i)n.push({path:r,message:t.message||i,rule:"custom"})}return n}getValueByPath(e,t){if(!t)return e;let r=t.split("."),n=e;for(let i of r)if(n&&typeof n==="object"&&i in n)n=n[i];else return;return n}generateRulesFromInterface(e){let t=[],r=e.matchAll(/(\w+)(\?)?:\s*(\w+)/g);for(let n of r){let[,i,o,s]=n;t.push({path:i,required:!o,type:this.mapTypeScriptType(s)})}return t}mapTypeScriptType(e){switch(e.toLowerCase()){case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"array":return"array";case"object":return"object";default:return"object"}}static createCommonRules(){return{server:[{path:"port",required:!0,type:"number",min:1,max:65535},{path:"host",required:!0,type:"string",min:1},{path:"ssl",type:"boolean"}],database:[{path:"url",required:!0,type:"string",min:1},{path:"pool",type:"number",min:1,max:100},{path:"timeout",type:"number",min:0}],api:[{path:"baseUrl",required:!0,type:"string",pattern:Ns},{path:"timeout",type:"number",min:0},{path:"retries",type:"number",min:0,max:10}]}}}class ni{fileLoader=new Tr;envProcessor=new Er;validator=new ri;async loadConfig(e){let t=Date.now(),{cache:r,performance:n,schema:i,validate:o,...s}=e;try{if(r?.enabled){let l=this.checkCache(s.name||"",s);if(l)return l}let c;try{c=await this.loadConfigurationStrategies(s,!0,r)}catch(l){let a=s.__strictErrorHandling;if(l instanceof Error&&l.name==="ConfigNotFoundError"){if(a)throw l;c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`No configuration file found for "${s.name||"config"}", using defaults with environment variables`]}}else if(l instanceof Error&&l.name==="ConfigLoadError"){let u=l.message.includes("EACCES")||l.message.includes("EPERM")||l.message.includes("permission denied"),f=!u&&(l.message.includes("syntax")||l.message.includes("Expected")||l.message.includes("Unexpected")||l.message.includes("BuildMessage")||l.message.includes("errors building")),d=l.message.includes("Configuration must export a valid object")||l.message.includes("Configuration file is empty and exports nothing");if(a&&(d||u))throw l;if(f&&(!a||!d))c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:["Configuration file has syntax errors, using defaults with environment variables"]};else if(!a)c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`Configuration loading error, using defaults: ${l.message}`]};else throw l}else c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`Configuration loading failed, using defaults: ${l instanceof Error?l.message:String(l)}`]}}if(i||o)await this.validateConfiguration(c.config,i,o,s.name);if(r?.enabled&&c)this.cacheResult(s.name||"",c,r,s);if(n?.enabled){let l={operation:"loadConfig",duration:Date.now()-t,configName:s.name,timestamp:new Date};if(n.onMetrics)n.onMetrics(l);if(n.slowThreshold&&l.duration>n.slowThreshold)ge.warn(`Slow configuration loading detected: ${l.duration}ms for ${s.name}`);c.metrics=l}return c}catch(c){let l=Date.now()-t;throw ge.error(`Configuration loading failed after ${l}ms:`,[c instanceof Error?c:Error(String(c))]),c}}async loadConfigurationStrategies(e,t=!1,r){let{name:n="",alias:i,cwd:o,configDir:s,defaultConfig:c,checkEnv:l=!0,arrayStrategy:a="replace",verbose:u=!1}=e,f=o||Ge.cwd(),d=[],h=await this.loadLocalConfiguration(n,i,f,s,c,a,u,l,r);if(h)return d.push(...this.getLocalSearchPaths(n,i,f,s)),this.finalizeResult(h,d,l,n,u);let p=await this.loadHomeConfiguration(n,i,c,a,u,l);if(p)return d.push(...this.getHomeSearchPaths(n,i)),this.finalizeResult(p,d,l,n,u);let g=await this.loadPackageJsonConfiguration(n,i,f,c,a,u,l);if(g)return d.push(ne(f,"package.json")),this.finalizeResult(g,d,l,n,u);if(d.push(...this.getAllSearchPaths(n,i,f,s)),t)throw Fe.configNotFound(n,d,i);return{...await this.applyEnvironmentVariables(n,c,l,u),warnings:[`No configuration file found for "${n}"${i?` or alias "${i}"`:""}, using defaults with environment variables`]}}async loadLocalConfiguration(e,t,r,n,i,o,s,c,l){let a=c?At(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,a,{arrayStrategy:o,verbose:s,cacheTtl:l?.ttl,useCache:!l?.ttl||l.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?At(e,r,i):r,c=[ne(tt(),".config",e),ne(tt(),".config"),tt()];for(let l of c){if(i)ge.info(`Checking home directory: ${l}`);let a=this.fileLoader.generateConfigPaths(e,l,t),u=await this.fileLoader.tryLoadFromPaths(a,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 c=s?At(e,n,o):n;try{let l=ne(r,"package.json");if(!Dn(l))return null;let a=await import(l),u=a[e],f=e;if(!u&&t)u=a[t],f=t;if(u&&typeof u==="object"&&!Array.isArray(u)){if(o)ge.success(`Configuration loaded from package.json: ${f}`);return{config:ti(c,u,i),source:{type:"package.json",path:l,priority:30,timestamp:new Date}}}}catch(l){if(o)ge.warn("Failed to load package.json:",[l instanceof Error?l:Error(String(l))])}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 Fe.configValidation(n||"unknown",i,n)}checkCache(e,t){let r=this.generateCacheKey(e,t);return ft.get(r)||null}cacheResult(e,t,r,n){let i=this.generateCacheKey(e,n);ft.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(tt(),".config",e),ne(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)}}function Jo(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 Sd(e){return Ne.loadConfig({...e,__strictErrorHandling:!0})}async function Rs(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 c=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(c.name||"",t,!0,c.verbose||!1))?.config??t;return t}}async function Ad(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"&&Jo(r)))return(await Ne.applyEnvironmentVariables(e,{},!0,!1)).config;throw r}}try{return(await Ne.loadConfig({...e,cwd:e.cwd||Ge.cwd(),cache:{enabled:!0},performance:{enabled:!1}})).config}catch(t){if(t instanceof Error&&(t.name==="ConfigNotFoundError"||t.name==="ConfigLoadError"&&Jo(t)))return(await Ne.applyEnvironmentVariables(e.name||"",e.defaultConfig||{},e.checkEnv!==!1,e.verbose||!1)).config;throw t}}async function Ed(e,t,r="replace"){let n=new Tr;try{let i=await n.loadFromPath(e,t,{arrayStrategy:r,useCache:!1,trackPerformance:!1});return i?i.config:null}catch{return null}}function At(e,t,r=!1){let n=new Er,i=e.toUpperCase().replace(/[^A-Z0-9]/g,"_");function o(s,c=[]){let l={...s};for(let[a,u]of Object.entries(s)){let f=[...c,a],d=[`${i}_${f.join("_").toUpperCase()}`,`${i}_${f.map((g)=>g.toUpperCase()).join("")}`,`${i}_${f.map((g)=>g.replace(/([A-Z])/g,"_$1").toUpperCase()).join("")}`],h,p;for(let g of d)if(h=Ge.env[g],h!==void 0){p=g;break}if(h!==void 0&&p)if(typeof u==="boolean")l[a]=["true","1","yes"].includes(h.toLowerCase());else if(typeof u==="number"){let g=Number(h);if(!Number.isNaN(g))l[a]=g}else if(Array.isArray(u))try{l[a]=JSON.parse(h)}catch{l[a]=h.split(",").map((g)=>g.trim())}else l[a]=h;else if(u&&typeof u==="object"&&!Array.isArray(u))l[a]=o(u,f)}return l}return o(t)}function Td(e){let t=ne(Ge.cwd(),e.configDir),r=ne(Ge.cwd(),e.generatedDir),n=ne(r,"config-types.ts");if(!Dn(Ao(n)))yf(Ao(n),{recursive:!0,mode:511});let i=Dn(t)?bf(t).map((s)=>s.replace(/\.(ts|js|mjs|cjs|mts|cts|json)$/,"")).sort():[],o=`// Generated by bunfig v${ih}
33
33
  export type ConfigNames = ${i.length?`'${i.join("' | '")}'`:"string"}
34
- `;yf(n,o,{mode:438})}function Ed(e){let t=null,r=null,n=()=>{if(!r)r=$s(e).then((o)=>(t=o,o),(o)=>{let s="defaultConfig"in e?e.defaultConfig:{};if(t=s,"verbose"in e&&e.verbose)he.warn("Config loading failed, using defaults:",[o instanceof Error?o:Error(String(o))]);return s});return r},i="defaultConfig"in e?e.defaultConfig:{};return t=i,n(),new Proxy({},{get(o,s){if(t)return t[s];let c=i[s];return n(),c},has(o,s){return s in(t||i)},ownKeys(){return Object.keys(t||i)},getOwnPropertyDescriptor(o,s){return Object.getOwnPropertyDescriptor(t||i,s)},set(o,s,c){if(!t)t={...i};return t[s]=c,!0}})}function Td(e){let t=Bo(Uf.cwd(),e?.configDir||"./config");function r(){if(!jf(t))return[];let i=new Set([".ts",".js",".mjs",".cjs",".mts",".cts",".json"]),o=[".ts",".mts",".cts",".js",".mjs",".cjs",".json"],s=Bf(t).filter((l)=>i.has(Sn(l))).map((l)=>({base:l.replace(/\.(?:ts|js|mjs|cjs|mts|cts|json)$/i,""),file:l})),c=new Map;for(let{base:l,file:a}of s){let u=Sn(a).toLowerCase(),f=c.get(l);if(!f){c.set(l,a);continue}let d=Sn(f).toLowerCase();if(o.indexOf(u)<o.indexOf(d))c.set(l,a)}return Array.from(c.entries()).map(([l,a])=>({base:l,file:a})).sort((l,a)=>l.base.localeCompare(a.base))}function n(){let i=r(),o=i.map((a)=>a.base),s=o.length?o.map((a)=>`'${a}'`).join(" | "):"string",c=i.length?`{
35
- ${i.map((a)=>{let u=Bo(t,a.file).replace(/\\/g,"/");return` '${a.base}': typeof import('${u}').default`}).join(`,
34
+ `;xf(n,o,{mode:438})}function Nd(e){let t=null,r=null,n=()=>{if(!r)r=Rs(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 c=i[s];return n(),c},has(o,s){return s in(t||i)},ownKeys(){return Object.keys(t||i)},getOwnPropertyDescriptor(o,s){return Object.getOwnPropertyDescriptor(t||i,s)},set(o,s,c){if(!t)t={...i};return t[s]=c,!0}})}function Od(e){let t=Vo(Wf.cwd(),e?.configDir||"./config");function r(){if(!Uf(t))return[];let i=new Set([".ts",".js",".mjs",".cjs",".mts",".cts",".json"]),o=[".ts",".mts",".cts",".js",".mjs",".cjs",".json"],s=Vf(t).filter((l)=>i.has(En(l))).map((l)=>({base:l.replace(/\.(?:ts|js|mjs|cjs|mts|cts|json)$/i,""),file:l})),c=new Map;for(let{base:l,file:a}of s){let u=En(a).toLowerCase(),f=c.get(l);if(!f){c.set(l,a);continue}let d=En(f).toLowerCase();if(o.indexOf(u)<o.indexOf(d))c.set(l,a)}return Array.from(c.entries()).map(([l,a])=>({base:l,file:a})).sort((l,a)=>l.base.localeCompare(a.base))}function n(){let i=r(),o=i.map((a)=>a.base),s=o.length?o.map((a)=>`'${a}'`).join(" | "):"string",c=i.length?`{
35
+ ${i.map((a)=>{let u=Vo(t,a.file).replace(/\\/g,"/");return` '${a.base}': typeof import('${u}').default`}).join(`,
36
36
  `)}
37
37
  }`:"Record<string, any>";return`export type ConfigNames = ${s}
38
38
  export type ConfigByName = ${c}
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 ih(e,t={}){let r=mr.cwd();while(r.includes("storage"))r=Uo(r,"..");let n=Uo(r,e||"");if(t?.relative)return Vf(mr.cwd(),n);return n}function G(){if(Ee.env.NODE_ENV==="test"||Ee.env.BUN_ENV==="test")return!1;return typeof window<"u"}async function sh(){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 Is{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:ct.pid,hostname:t(),environment:ct.env.NODE_ENV||"development",platform:ct.platform,version:ct.version}}return{userAgent:navigator.userAgent,hostname:window.location.hostname||"browser",environment:ct.env.NODE_ENV||ct.env.BUN_ENV||"development",viewport:{width:window.innerWidth,height:window.innerHeight},language:navigator.language}}}class Er{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={...$r},this.options=this.normalizeOptions(t),this.formatter=this.options.formatter||new Is,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{..._n,...e.fingersCrossed};if(!e.fingersCrossedEnabled)return null;if(!e.fingersCrossed)return{..._n};return{..._n,...e.fingersCrossed}}normalizeOptions(e){let t={format:"json",level:"info",logDirectory:$r.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,c=1000;while(o<s)try{try{try{await qf(this.config.logDirectory,Ko.F_OK|Ko.W_OK)}catch(a){if(a instanceof Error&&"code"in a)if(a.code==="ENOENT")await Yf(this.config.logDirectory,{recursive:!0,mode:493});else if(a.code==="EACCES")throw Error(`No write permission for log directory: ${this.config.logDirectory}`);else throw a;else throw a}}catch(a){throw console.error("Debug: [writeToFile] Failed to create log directory:",a),a}let l=this.validateEncryptionConfig()?(await this.encrypt(e)).encrypted:ke.from(e);try{if(!er(this.currentLogFile))await Tn(this.currentLogFile,"",{mode:420});if(i=zo(this.currentLogFile,"a",420),Gf(i,l,{flag:"a"}),Vo(i),i!==void 0)En(i),i=void 0;if((await at(this.currentLogFile)).size===0){if(await Tn(this.currentLogFile,l,{flag:"w",mode:420}),(await at(this.currentLogFile)).size===0)throw Error("File exists but is empty after retry write")}return}catch(a){let u=a;if(u.code&&["ENETDOWN","ENETUNREACH","ENOTFOUND","ETIMEDOUT"].includes(u.code)){if(o<s-1){let f=typeof u.message==="string"?u.message:"Unknown error";console.error(`Network error during write attempt ${o+1}/${s}:`,f);let d=c*2**o;await new Promise((h)=>setTimeout(h,d)),o++;continue}}if(u?.code&&["ENOSPC","EDQUOT"].includes(u.code))throw Error(`Disk quota exceeded or no space left on device: ${u.message}`);throw console.error("Debug: [writeToFile] Error writing to file:",u),u}finally{if(i!==void 0)try{En(i)}catch(a){console.error("Debug: [writeToFile] Error closing file descriptor:",a)}}}catch(l){if(o===s-1){let u=l,f=typeof u.message==="string"?u.message:"Unknown error";throw console.error("Debug: [writeToFile] Max retries reached. Final error:",f),l}o++;let a=c*2**(o-1);await new Promise((u)=>setTimeout(u,a))}})();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 lt(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 lt(this.config.logDirectory,`${this.name}.log`);let e=new Date().toISOString().split("T")[0];return lt(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(([,c],[,l])=>l.createdAt.getTime()-c.createdAt.getTime()),o=typeof t.maxKeys==="number"?t.maxKeys:1,s=Math.max(1,o);if(i.length>s)for(let[c]of i.slice(s))this.encryptionKeys.delete(c),this.keys.delete(c)}generateKeyId(){return An(16).toString("hex")}generateKey(){return An(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=An(16),n=zf("aes-256-gcm",t,r),i=ke.isBuffer(e)?e:ke.from(e,"utf8"),o=n.update(i),s=n.final(),c=o.length+s.length,l=n.getAuthTag(),a=ke.allocUnsafe(16+c+16);return r.copy(a,0),o.copy(a,16),s.copy(a,16+o.length),l.copy(a,16+c),{encrypted:a,iv:r}}async compressData(e){return new Promise((t,r)=>{let n=Go(),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 at(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((l)=>l.startsWith(this.name)&&/\.log\.\d+$/.test(l)).sort((l,a)=>{let u=Number.parseInt(l.match(/\.log\.(\d+)$/)?.[1]||"0");return Number.parseInt(a.match(/\.log\.(\d+)$/)?.[1]||"0")-u}),s=o.length>0?Number.parseInt(o[0].match(/\.log\.(\d+)$/)?.[1]||"0")+1:1,c=`${r}.${s}`;if(await at(r).catch(()=>null))try{if(await Ho(r,c),t.compress)try{let l=`${c}.gz`;await this.compressLogFile(c,l),await rr(c)}catch(l){console.error("Error compressing rotated file:",l)}if(o.length===0&&!i.some((l)=>l.endsWith(".log.1")))try{let l=`${r}.1`;await Tn(l,"")}catch(l){console.error("Error creating backup file:",l)}}catch(l){console.error(`Error during rotation: ${l instanceof Error?l.message:String(l)}`)}}else{let i=new Date().toISOString().replace(/[:.]/g,"-"),o=r.replace(/\.log$/,`-${i}.log`);if(await at(r).catch(()=>null))await Ho(r,o)}if(this.currentLogFile=n,t.maxFiles){let o=(await tr(this.config.logDirectory)).filter((s)=>s.startsWith(this.name)).sort((s,c)=>c.localeCompare(s));for(let s of o.slice(t.maxFiles))await rr(lt(this.config.logDirectory,s))}}}async compressLogFile(e,t){let r=Wo(e),n=Hf(t),i=Go();await Zf(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=zo(this.currentLogFile,"r+");Vo(e),En(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(lt(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||G())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,c=(h)=>h.replace(this.ANSI_PATTERN,"");if(!this.fancy){let h=[];if(s)h.push(t);if(o==="warning")h.push("WARN");else if(o==="error")h.push("ERROR");else if(r)h.push(r.replace(/[^\p{L}\p{N}\p{P}\p{Z}]/gu,""));if(n)h.push(n.replace(/[[\]]/g,""));return h.push(i),h.join(" ")}let l=O.stdout.columns||120,a="";if(o==="warning"||o==="error")a=`${r} ${i}`;else if(o==="info"||o==="success")a=`${r} ${n} ${i}`;else a=`${r} ${n} ${T.cyan(i)}`;if(!s)return a.trim();let u=c(a).trim().length,f=c(t).length,d=Math.max(1,l-2-u-f);return`${a.trim()}${" ".repeat(d)}${t}`}formatMessage(e,t){if(t.length===1&&Array.isArray(t[0]))return e.replace(/\{(\d+)\}/g,(o,s)=>{let c=Number.parseInt(s,10);return c<t[0].length?String(t[0][c]):o});let r=/%([sdijfo%])/g,n=0,i=e.replace(r,(o,s)=>{if(s==="%")return"%";if(n>=t.length)return o;let c=t[n++];switch(s){case"s":return String(c);case"d":case"i":return Number(c).toString();case"j":case"o":return JSON.stringify(c,null,2);default:return o}});if(n<t.length)i+=` ${t.slice(n).map((o)=>typeof o==="object"?JSON.stringify(o,null,2):String(o)).join(" ")}`;return i}formatMarkdown(e){if(!e)return e;let t=e;return t=t.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(r,n,i)=>{let o=T.underline(T.blue(n)),s=this.toAbsoluteFilePath(i);if(s&&this.shouldStyleConsole()&&this.supportsHyperlinks()){let c=`file://${encodeURI(s)}`,l="\x1B]8;;",a="\x1B\\";return`\x1B]8;;${c}\x1B\\${o}\x1B]8;;\x1B\\`}if(this.shouldStyleConsole()&&this.supportsHyperlinks())return`\x1B]8;;${i}\x1B\\${o}\x1B]8;;\x1B\\`;return o}),t=t.replace(/`([^`]+)`/g,(r,n)=>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(G())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(Jf(t)||t.startsWith("./")||t.startsWith("../"))t=Xf(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){if(!this.shouldLog(e))return;let n=new Date,i=this.formatConsoleTimestamp(n),o=this.formatFileTimestamp(n),s,c;if(t instanceof Error)s=t.message,c=t.stack;else s=this.formatMessage(t,r);let{consoleText:l,fileText:a}=this.buildOutputTexts(s);if(this.shouldStyleConsole()){let f=this.options.showIcons===!1?"":fh[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(l),level:e}),console.error(h);break;case"info":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:l,level:e}),console.warn(h);break;case"success":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:T.green(l),level:e}),console.error(h);break;case"warning":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:l,level:e}),console.warn(h);break;case"error":if(h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:l,level:e}),console.error(h),c){let p=c.split(`
41
+ `}return{name:"bunfig-plugin",setup(i){i.onResolve({filter:/^virtual:bunfig-types$/},(o)=>({path:o.path,namespace:"bunfig-virtual"})),i.onLoad({filter:/^virtual:bunfig-types$/,namespace:"bunfig-virtual"},()=>({contents:n(),loader:"ts"}))}}}function sh(e,t={}){let r=yr.cwd();while(r.includes("storage"))r=Wo(r,"..");let n=Wo(r,e||"");if(t?.relative)return Kf(yr.cwd(),n);return n}function G(){if(Te.env.NODE_ENV==="test"||Te.env.BUN_ENV==="test")return!1;return typeof window<"u"}async function lh(){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 _s{async format(e){let t=await lh(),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:ut.pid,hostname:t(),environment:ut.env.NODE_ENV||"development",platform:ut.platform,version:ut.version}}return{userAgent:navigator.userAgent,hostname:window.location.hostname||"browser",environment:ut.env.NODE_ENV||ut.env.BUN_ENV||"development",viewport:{width:window.innerWidth,height:window.innerHeight},language:navigator.language}}}class Nr{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={...Rr},this.options=this.normalizeOptions(t),this.formatter=this.options.formatter||new _s,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{...Mn,...e.fingersCrossed};if(!e.fingersCrossedEnabled)return null;if(!e.fingersCrossed)return{...Mn};return{...Mn,...e.fingersCrossed}}normalizeOptions(e){let t={format:"json",level:"info",logDirectory:Rr.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,c=1000;while(o<s)try{try{try{await Jf(this.config.logDirectory,Go.F_OK|Go.W_OK)}catch(a){if(a instanceof Error&&"code"in a)if(a.code==="ENOENT")await Xf(this.config.logDirectory,{recursive:!0,mode:493});else if(a.code==="EACCES")throw Error(`No write permission for log directory: ${this.config.logDirectory}`);else throw a;else throw a}}catch(a){throw console.error("Debug: [writeToFile] Failed to create log directory:",a),a}let l=this.validateEncryptionConfig()?(await this.encrypt(e)).encrypted:Se.from(e);try{if(!rr(this.currentLogFile))await On(this.currentLogFile,"",{mode:420});if(i=Ho(this.currentLogFile,"a",420),Yf(i,l,{flag:"a"}),Ko(i),i!==void 0)Nn(i),i=void 0;if((await lt(this.currentLogFile)).size===0){if(await On(this.currentLogFile,l,{flag:"w",mode:420}),(await lt(this.currentLogFile)).size===0)throw Error("File exists but is empty after retry write")}return}catch(a){let u=a;if(u.code&&["ENETDOWN","ENETUNREACH","ENOTFOUND","ETIMEDOUT"].includes(u.code)){if(o<s-1){let f=typeof u.message==="string"?u.message:"Unknown error";console.error(`Network error during write attempt ${o+1}/${s}:`,f);let d=c*2**o;await new Promise((h)=>setTimeout(h,d)),o++;continue}}if(u?.code&&["ENOSPC","EDQUOT"].includes(u.code))throw Error(`Disk quota exceeded or no space left on device: ${u.message}`);throw console.error("Debug: [writeToFile] Error writing to file:",u),u}finally{if(i!==void 0)try{Nn(i)}catch(a){console.error("Debug: [writeToFile] Error closing file descriptor:",a)}}}catch(l){if(o===s-1){let u=l,f=typeof u.message==="string"?u.message:"Unknown error";throw console.error("Debug: [writeToFile] Max retries reached. Final error:",f),l}o++;let a=c*2**(o-1);await new Promise((u)=>setTimeout(u,a))}})();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 ct(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 ct(this.config.logDirectory,`${this.name}.log`);let e=new Date().toISOString().split("T")[0];return ct(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(([,c],[,l])=>l.createdAt.getTime()-c.createdAt.getTime()),o=typeof t.maxKeys==="number"?t.maxKeys:1,s=Math.max(1,o);if(i.length>s)for(let[c]of i.slice(s))this.encryptionKeys.delete(c),this.keys.delete(c)}generateKeyId(){return Tn(16).toString("hex")}generateKey(){return Tn(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=Tn(16),n=Hf("aes-256-gcm",t,r),i=Se.isBuffer(e)?e:Se.from(e,"utf8"),o=n.update(i),s=n.final(),c=o.length+s.length,l=n.getAuthTag(),a=Se.allocUnsafe(16+c+16);return r.copy(a,0),o.copy(a,16),s.copy(a,16+o.length),l.copy(a,16+c),{encrypted:a,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(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(G())return;if(!this.shouldWriteToFile())return;let e=await lt(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 nr(this.config.logDirectory),o=i.filter((l)=>l.startsWith(this.name)&&/\.log\.\d+$/.test(l)).sort((l,a)=>{let u=Number.parseInt(l.match(/\.log\.(\d+)$/)?.[1]||"0");return Number.parseInt(a.match(/\.log\.(\d+)$/)?.[1]||"0")-u}),s=o.length>0?Number.parseInt(o[0].match(/\.log\.(\d+)$/)?.[1]||"0")+1:1,c=`${r}.${s}`;if(await lt(r).catch(()=>null))try{if(await qo(r,c),t.compress)try{let l=`${c}.gz`;await this.compressLogFile(c,l),await ir(c)}catch(l){console.error("Error compressing rotated file:",l)}if(o.length===0&&!i.some((l)=>l.endsWith(".log.1")))try{let l=`${r}.1`;await On(l,"")}catch(l){console.error("Error creating backup file:",l)}}catch(l){console.error(`Error during rotation: ${l instanceof Error?l.message:String(l)}`)}}else{let i=new Date().toISOString().replace(/[:.]/g,"-"),o=r.replace(/\.log$/,`-${i}.log`);if(await lt(r).catch(()=>null))await qo(r,o)}if(this.currentLogFile=n,t.maxFiles){let o=(await nr(this.config.logDirectory)).filter((s)=>s.startsWith(this.name)).sort((s,c)=>c.localeCompare(s));for(let s of o.slice(t.maxFiles))await ir(ct(this.config.logDirectory,s))}}}async compressLogFile(e,t){let r=zo(e),n=qf(t),i=Yo();await ed(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()})),rr(this.currentLogFile))try{let e=Ho(this.currentLogFile,"r+");Ko(e),Nn(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 nr(this.config.logDirectory)).filter((r)=>(r.includes("temp")||r.includes(".tmp"))&&r.includes(this.name));for(let r of t)try{await ir(ct(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||G())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,c=(h)=>h.replace(this.ANSI_PATTERN,"");if(!this.fancy){let h=[];if(s)h.push(t);if(o==="warning")h.push("WARN");else if(o==="error")h.push("ERROR");else if(r)h.push(r.replace(/[^\p{L}\p{N}\p{P}\p{Z}]/gu,""));if(n)h.push(n.replace(/[[\]]/g,""));return h.push(i),h.join(" ")}let l=O.stdout.columns||120,a="";if(o==="warning"||o==="error")a=`${r} ${i}`;else if(o==="info"||o==="success")a=`${r} ${n} ${i}`;else a=`${r} ${n} ${T.cyan(i)}`;if(!s)return a.trim();let u=c(a).trim().length,f=c(t).length,d=Math.max(1,l-2-u-f);return`${a.trim()}${" ".repeat(d)}${t}`}formatMessage(e,t){if(t.length===1&&Array.isArray(t[0]))return e.replace(/\{(\d+)\}/g,(o,s)=>{let c=Number.parseInt(s,10);return c<t[0].length?String(t[0][c]):o});let r=/%([sdijfo%])/g,n=0,i=e.replace(r,(o,s)=>{if(s==="%")return"%";if(n>=t.length)return o;let c=t[n++];switch(s){case"s":return String(c);case"d":case"i":return Number(c).toString();case"j":case"o":return JSON.stringify(c,null,2);default:return o}});if(n<t.length)i+=` ${t.slice(n).map((o)=>typeof o==="object"?JSON.stringify(o,null,2):String(o)).join(" ")}`;return i}formatMarkdown(e){if(!e)return e;let t=e;return t=t.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(r,n,i)=>{let o=T.underline(T.blue(n)),s=this.toAbsoluteFilePath(i);if(s&&this.shouldStyleConsole()&&this.supportsHyperlinks()){let c=`file://${encodeURI(s)}`,l="\x1B]8;;",a="\x1B\\";return`\x1B]8;;${c}\x1B\\${o}\x1B]8;;\x1B\\`}if(this.shouldStyleConsole()&&this.supportsHyperlinks())return`\x1B]8;;${i}\x1B\\${o}\x1B]8;;\x1B\\`;return o}),t=t.replace(/`([^`]+)`/g,(r,n)=>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(G())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(Zf(t)||t.startsWith("./")||t.startsWith("../"))t=Qf(t);else return null;return rr(t)?t:null}catch{return null}}buildOutputTexts(e){let t=this.shouldStyleConsole()?this.formatMarkdown(e):e,r=e.replace(this.ANSI_PATTERN,"");return{consoleText:t,fileText:r}}async log(e,t,...r){if(!this.shouldLog(e))return;let n=new Date,i=this.formatConsoleTimestamp(n),o=this.formatFileTimestamp(n),s,c;if(t instanceof Error)s=t.message,c=t.stack;else s=this.formatMessage(t,r);let{consoleText:l,fileText:a}=this.buildOutputTexts(s);if(this.shouldStyleConsole()){let f=this.options.showIcons===!1?"":hh[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(l),level:e}),console.error(h);break;case"info":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:l,level:e}),console.warn(h);break;case"success":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:T.green(l),level:e}),console.error(h);break;case"warning":h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:l,level:e}),console.warn(h);break;case"error":if(h=this.formatConsoleMessage({timestamp:i,icon:f,tag:d,message:l,level:e}),console.error(h),c){let p=c.split(`
42
42
  `);for(let g of p)if(g.trim()&&!g.includes(s))console.error(this.formatConsoleMessage({timestamp:i,message:T.gray(` ${g}`),level:e,showTimestamp:!1}))}break}}else if(!G()){if(console.error(`${o} ${this.environment}.${e.toUpperCase()}: ${s}`),c)console.error(c)}let u=`${o} ${this.environment}.${e.toUpperCase()}: ${a}
43
43
  `;if(c)u+=`${c}
44
44
  `;if(u=u.replace(this.ANSI_PATTERN,""),this.shouldWriteToFile())await this.writeToFile(u)}progress(e,t=""){let r={update:(c,l)=>{},finish:(c)=>{},interrupt:(c,l)=>{}};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()&&O.stdout.isTTY)this.renderProgressBar(this.activeProgressBar);return{update:(c,l)=>{if(!this.enabled||!this.activeProgressBar)return;if(this.activeProgressBar.current=Math.min(Math.max(0,c),this.activeProgressBar.total),l!==void 0)this.activeProgressBar.message=l;if(this.shouldStyleConsole()&&!G()&&O.stdout.isTTY)this.renderProgressBar(this.activeProgressBar)},finish:(c)=>{if(!this.activeProgressBar)return;this.finishProgressBar(this.activeProgressBar,c)},interrupt:(c,l="info")=>{if(!G()&&O.stdout.isTTY)O.stdout.write(`
45
45
  `);if(this[l==="warning"?"warn":l](c),this.activeProgressBar&&this.shouldStyleConsole()&&!G()&&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,c=this.formatConsoleTimestamp(s),a=`${this.formatFileTimestamp(s)} ${this.environment}.INFO: ${o}`;if(r)a+=` ${JSON.stringify(r)}`;if(a+=`
46
- `,a=a.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:c,icon:this.options.showIcons===!1?"":T.green("\u2713"),tag:u,message:`${o}${r?` ${JSON.stringify(r)}`:""}`}))}else if(!G())console.error(a.trim());if(this.shouldWriteToFile())await this.writeToFile(a)}}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 Er(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 Wo(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),c=Kf("aes-256-gcm",r,i);c.setAuthTag(o);let l=c.update(s),a=c.final(),u=l.length+a.length,f=ke.allocUnsafe(u);return l.copy(f,0),a.copy(f,l.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 c=i.split(`
46
+ `,a=a.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:c,icon:this.options.showIcons===!1?"":T.green("\u2713"),tag:u,message:`${o}${r?` ${JSON.stringify(r)}`:""}`}))}else if(!G())console.error(a.trim());if(this.shouldWriteToFile())await this.writeToFile(a)}}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 Nr(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(!rr(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),c=Gf("aes-256-gcm",r,i);c.setAuthTag(o);let l=c.update(s),a=c.final(),u=l.length+a.length,f=Se.allocUnsafe(u);return l.copy(f,0),a.copy(f,l.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 c=i.split(`
47
47
  `),l=Math.max(...c.map((d)=>d.length))+2,a=`\u250C${"\u2500".repeat(l)}\u2510`,u=`\u2514${"\u2500".repeat(l)}\u2518`,f=c.map((d)=>this.formatConsoleMessage({timestamp:r,message:T.cyan(d),showTimestamp:!1}));console.error(this.formatConsoleMessage({timestamp:r,message:T.cyan(a),showTimestamp:!1})),f.forEach((d)=>console.error(d)),console.error(this.formatConsoleMessage({timestamp:r,message:T.cyan(u),showTimestamp:!1}))}else if(!G())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(G())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 l=/%([sdijfo%])/g,a=0;if(r=e.replace(l,(u,f)=>{if(f==="%")return"%";if(a>=t.length)return u;let d=t[a++];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}}),a<t.length)r+=` ${t.slice(a).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 l=this.options.showTags!==!1&&this.name?T.gray(this.formatTag(this.name)):"",a=this.options.showIcons===!1?"":`${T.blue("\u25D0")} `;console.error(`${a}${l} ${T.cyan(n)}`)}let c=`[${new Date().toISOString()}] ${this.environment}.INFO: [START] ${i}
49
49
  `.replace(this.ANSI_PATTERN,"");if(this.shouldWriteToFile())await this.writeToFile(c)}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)),c=`[${o}${s}]`,l=`${r}%`.padStart(4),a=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} ${c} ${l}${a}`,h=O.stdout.columns||80,p=" ".repeat(Math.max(0,h-d.replace(this.ANSI_PATTERN,"").length));if(e.lastRenderedLine=`${d}${p}`,O.stdout.write(e.lastRenderedLine),t)O.stdout.write(`
50
- `)}finishProgressBar(e,t){if(!this.enabled||!this.fancy||G()||!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(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=lt(this.config.logDirectory,n);if(e.before)try{if((await at(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 dh(e,t={}){let{maxRetries:r=3,retryDelay:n=1000,isRetryable:i=()=>!0,fallback:o}=t,s=Error("Unknown error occurred");for(let c=0;c<=r;c++)try{return await e()}catch(l){if(s=l instanceof Error?l:Error(String(l)),c===r||!i(s))break;if(n>0)await new Promise((a)=>setTimeout(a,n))}if(o!==void 0)return o;throw s instanceof Error?s:Error(`Unknown error: ${String(s)}`)}class ni{defaultParsers;constructor(){this.defaultParsers=[{name:"boolean",canParse:(e,t)=>t==="boolean"||["true","false","1","0","yes","no"].includes(e.toLowerCase()),parse:(e)=>{let t=e.toLowerCase();return["true","1","yes"].includes(t)}},{name:"number",canParse:(e,t)=>t==="number"||!Number.isNaN(Number(e))&&!Number.isNaN(Number.parseFloat(e)),parse:(e)=>{let t=Number(e);if(Number.isNaN(t))throw TypeError(`Cannot parse "${e}" as number`);return t}},{name:"array",canParse:(e,t)=>t==="array"||e.startsWith("[")||e.includes(","),parse:(e)=>{try{let t=JSON.parse(e);if(Array.isArray(t))return t}catch{}return e.split(",").map((t)=>t.trim())}},{name:"json",canParse:(e,t)=>t==="object"||(e.startsWith("{")&&e.endsWith("}")||e.startsWith("[")&&e.endsWith("]")),parse:(e)=>{try{return JSON.parse(e)}catch(t){throw Error(`Cannot parse "${e}" as JSON: ${t}`)}}}]}async applyEnvironmentVariables(e,t,r={}){let{prefix:n,useCamelCase:i=!0,useBackwardCompatibility:o=!0,customParsers:s={},verbose:c=!1,trackPerformance:l=!0}=r,a=async()=>{if(!e)return{config:t,source:{type:"environment",priority:50,timestamp:new Date}};let u=n||this.generateEnvPrefix(e),f={...t};return this.processObject(f,[],u,{useCamelCase:i,useBackwardCompatibility:o,customParsers:s,verbose:c,configName:e}),{config:f,source:{type:"environment",priority:50,timestamp:new Date}}};if(l)return qn.track("applyEnvironmentVariables",a,{configName:e});return a()}generateEnvPrefix(e){return e.toUpperCase().replace(/-/g,"_")}formatEnvKey(e,t){if(!t)return e.toUpperCase();return e.replace(/([A-Z])/g,"_$1").toUpperCase()}processObject(e,t,r,n){for(let[i,o]of Object.entries(e)){let s=[...t,i],c=s.map((u)=>this.formatEnvKey(u,n.useCamelCase)),l=`${r}_${c.join("_")}`,a=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=ir.env[l]||(a?ir.env[a]:void 0);if(u!==void 0){if(n.verbose){let f=ir.env[l]?l:a}try{e[i]=this.parseEnvironmentValue(u,typeof o,l,n.customParsers,n.configName)}catch(f){if(f instanceof ri)throw f;throw Ke.envVar(l,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 Ke.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(ir.env))if(n.startsWith(r)&&i!==void 0)t[n]=i;return t}validateEnvironmentVariable(e,t,r){let n=[];if(!/^[A-Z_][A-Z0-9_]*$/.test(e))n.push(`Environment variable key "${e}" should only contain uppercase letters, numbers, and underscores`);if(r)try{this.parseEnvironmentValue(e,t,r,{})}catch(i){n.push(`Cannot parse value "${t}" as ${r}: ${i}`)}return{isValid:n.length===0,errors:n}}generateEnvVarDocs(e,t,r={}){let{prefix:n,format:i="text"}=r,o=n||this.generateEnvPrefix(e),s=[];switch(this.extractEnvVarInfo(t,[],o,s),i){case"markdown":return this.formatAsMarkdown(s,e);case"json":return JSON.stringify(s,null,2);default:return this.formatAsText(s,e)}}extractEnvVarInfo(e,t,r,n){for(let[i,o]of Object.entries(e)){let s=[...t,i],c=`${r}_${s.map((l)=>this.formatEnvKey(l,!0)).join("_")}`;if(typeof o==="object"&&o!==null&&!Array.isArray(o))this.extractEnvVarInfo(o,s,r,n);else n.push({key:c,type:Array.isArray(o)?"array":typeof o,description:`Configuration for ${s.join(".")}`,example:this.generateExample(o)})}}generateExample(e){if(Array.isArray(e))return JSON.stringify(e);if(typeof e==="object"&&e!==null)return JSON.stringify(e);return String(e)}formatAsText(e,t){let r=`Environment Variables for ${t}:
50
+ `)}finishProgressBar(e,t){if(!this.enabled||!this.fancy||G()||!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(G()){console.warn("Log clearing is not supported in browser environments.");return}try{console.warn("Clearing logs...",this.config.logDirectory);let t=await nr(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=ct(this.config.logDirectory,n);if(e.before)try{if((await lt(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 ir(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 gh(e,t={}){let{maxRetries:r=3,retryDelay:n=1000,isRetryable:i=()=>!0,fallback:o}=t,s=Error("Unknown error occurred");for(let c=0;c<=r;c++)try{return await e()}catch(l){if(s=l instanceof Error?l:Error(String(l)),c===r||!i(s))break;if(n>0)await new Promise((a)=>setTimeout(a,n))}if(o!==void 0)return o;throw s instanceof Error?s:Error(`Unknown error: ${String(s)}`)}class oi{defaultParsers;constructor(){this.defaultParsers=[{name:"boolean",canParse:(e,t)=>t==="boolean"||["true","false","1","0","yes","no"].includes(e.toLowerCase()),parse:(e)=>{let t=e.toLowerCase();return["true","1","yes"].includes(t)}},{name:"number",canParse:(e,t)=>t==="number"||!Number.isNaN(Number(e))&&!Number.isNaN(Number.parseFloat(e)),parse:(e)=>{let t=Number(e);if(Number.isNaN(t))throw TypeError(`Cannot parse "${e}" as number`);return t}},{name:"array",canParse:(e,t)=>t==="array"||e.startsWith("[")||e.includes(","),parse:(e)=>{try{let t=JSON.parse(e);if(Array.isArray(t))return t}catch{}return e.split(",").map((t)=>t.trim())}},{name:"json",canParse:(e,t)=>t==="object"||(e.startsWith("{")&&e.endsWith("}")||e.startsWith("[")&&e.endsWith("]")),parse:(e)=>{try{return JSON.parse(e)}catch(t){throw Error(`Cannot parse "${e}" as JSON: ${t}`)}}}]}async applyEnvironmentVariables(e,t,r={}){let{prefix:n,useCamelCase:i=!0,useBackwardCompatibility:o=!0,customParsers:s={},verbose:c=!1,trackPerformance:l=!0}=r,a=async()=>{if(!e)return{config:t,source:{type:"environment",priority:50,timestamp:new Date}};let u=n||this.generateEnvPrefix(e),f={...t};return this.processObject(f,[],u,{useCamelCase:i,useBackwardCompatibility:o,customParsers:s,verbose:c,configName:e}),{config:f,source:{type:"environment",priority:50,timestamp:new Date}}};if(l)return Jn.track("applyEnvironmentVariables",a,{configName:e});return a()}generateEnvPrefix(e){return e.toUpperCase().replace(/-/g,"_")}formatEnvKey(e,t){if(!t)return e.toUpperCase();return e.replace(/([A-Z])/g,"_$1").toUpperCase()}processObject(e,t,r,n){for(let[i,o]of Object.entries(e)){let s=[...t,i],c=s.map((u)=>this.formatEnvKey(u,n.useCamelCase)),l=`${r}_${c.join("_")}`,a=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=sr.env[l]||(a?sr.env[a]:void 0);if(u!==void 0){if(n.verbose){let f=sr.env[l]?l:a}try{e[i]=this.parseEnvironmentValue(u,typeof o,l,n.customParsers,n.configName)}catch(f){if(f instanceof ii)throw f;throw He.envVar(l,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 He.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(sr.env))if(n.startsWith(r)&&i!==void 0)t[n]=i;return t}validateEnvironmentVariable(e,t,r){let n=[];if(!/^[A-Z_][A-Z0-9_]*$/.test(e))n.push(`Environment variable key "${e}" should only contain uppercase letters, numbers, and underscores`);if(r)try{this.parseEnvironmentValue(e,t,r,{})}catch(i){n.push(`Cannot parse value "${t}" as ${r}: ${i}`)}return{isValid:n.length===0,errors:n}}generateEnvVarDocs(e,t,r={}){let{prefix:n,format:i="text"}=r,o=n||this.generateEnvPrefix(e),s=[];switch(this.extractEnvVarInfo(t,[],o,s),i){case"markdown":return this.formatAsMarkdown(s,e);case"json":return JSON.stringify(s,null,2);default:return this.formatAsText(s,e)}}extractEnvVarInfo(e,t,r,n){for(let[i,o]of Object.entries(e)){let s=[...t,i],c=`${r}_${s.map((l)=>this.formatEnvKey(l,!0)).join("_")}`;if(typeof o==="object"&&o!==null&&!Array.isArray(o))this.extractEnvVarInfo(o,s,r,n);else n.push({key:c,type:Array.isArray(o)?"array":typeof o,description:`Configuration for ${s.join(".")}`,example:this.generateExample(o)})}}generateExample(e){if(Array.isArray(e))return JSON.stringify(e);if(typeof e==="object"&&e!==null)return JSON.stringify(e);return String(e)}formatAsText(e,t){let r=`Environment Variables for ${t}:
51
51
 
52
52
  `;for(let n of e)r+=`${n.key}
53
53
  `,r+=` Type: ${n.type}
@@ -59,39 +59,39 @@ 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 hh(e,t,r={}){return Bs(e,t,r,new WeakMap)}function Bs(e,t,r,n){let{arrayMergeMode:i="replace",skipNullish:o=!1,customMerger:s}=r;if(t===null||t===void 0)return o?e:t;if(s){let c=s(e,t);if(c!==void 0)return c}if(Array.isArray(t)||Array.isArray(e))return Us(e,t,i,n);if(!ce(t)||!ce(e))return t;return yh(e,t,r,n)}function Us(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 gh(e,t);case"smart":return mh(e,t,n);default:return t}return t}function gh(e,t){let r=[...t];for(let n of e)if(!r.some((i)=>Gn(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(ce(t[0])&&ce(e[0]))return ph(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 ph(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 c of o)if(c in i){if(n.find((a)=>ce(a)&&(c in a)&&a[c]===i[c])){s=!0;break}}if(!s)n.push(i)}return n}function yh(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 c=i[s],l=o[s];if(r.skipNullish&&(c===null||c===void 0))continue;if(c===null||c===void 0){o[s]=c;continue}if(ce(c)&&ce(l))o[s]=Bs(l,c,r,n);else if(Array.isArray(c)||Array.isArray(l))o[s]=Us(l,c,r.arrayMergeMode||"smart",n);else o[s]=c}return o}function Ws(e,t,r="replace"){return hh(e,t,{arrayMergeMode:r==="replace"?"replace":"smart",skipNullish:!0})}function Gn(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(!Gn(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(!Gn(e[i],t[i]))return!1}return!0}return!1}function ce(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}class Vs{extensions=us;async loadFromPath(e,t,r={}){let{arrayStrategy:n="replace",useCache:i=!0,cacheTtl:o,trackPerformance:s=!0,verbose:c=!1}=r;if(i){let a=fr.getWithFileCheck("file",e);if(a){if(c)console.log(`Configuration loaded from cache: ${e}`);return a}}let l=async()=>{if(!or(e))return null;try{let a=`?t=${Date.now()}`,u=await import(e+a),f=u.default||u,d="default"in u,h=Object.keys(u).length>0;if(!d&&!h)throw new Cr(e,Error("Configuration file is empty and exports nothing"),"unknown");if(typeof f!=="object"||f===null||Array.isArray(f))throw new Cr(e,Error("Configuration must export a valid object"),"unknown");let m={config:Ws(t,f,n),source:{type:"file",path:e,priority:100,timestamp:new Date}};if(i)fr.setWithFileCheck("file",m,e,o);return m}catch(a){throw a instanceof Error?Ke.configLoad(e,a):Ke.configLoad(e,Error(String(a)))}};if(s)return qn.track("loadFromPath",l,{path:e});return l()}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 ff({name:e,directory:t,alias:r})}generateNamePatterns(e,t){return fs({name:e,alias:t})}checkFileAccess(e){return dh(async()=>or(e),{maxRetries:2,retryDelay:100,fallback:!1})}async discoverConfigFiles(e,t,r){let n=[];if(!or(e))return n;if(t||r){let i=this.generateNamePatterns(t||"",r);for(let o of i)for(let s of this.extensions){let c=as(e,`${o}${s}`);if(await this.checkFileAccess(c))n.push(c)}}else try{let{readdirSync:i}=await import("fs"),o=i(e);for(let s of o)if(this.looksLikeConfigFile(s)){let c=as(e,s);if(await this.checkFileAccess(c))n.push(c)}}catch{return[]}return n}looksLikeConfigFile(e){return[/\.config\.(ts|js|mjs|cjs|json|mts|cts)$/,/^\..*\.(ts|js|mjs|cjs|json|mts|cts)$/,/config\.(ts|js|mjs|cjs|json|mts|cts)$/].some((r)=>r.test(e))}async validateConfigFile(e){let t=[];try{if(!or(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 zs{async validateConfiguration(e,t,r={}){let{stopOnFirstError:n=!1,validateRequired:i=!0,validateTypes:o=!0,customRules:s=[],trackPerformance:c=!0,verbose:l=!1}=r,a=async()=>{let u=[],f=[],d={stopOnFirstError:n,validateRequired:i,validateTypes:o,customRules:s,trackPerformance:c,verbose:l};try{if(typeof t==="string")return await this.validateWithSchemaFile(e,t,d);else if(Array.isArray(t))return this.validateWithRules(e,[...t,...s],d);else return this.validateWithJSONSchema(e,t,d)}catch(h){return u.push({path:"",message:`Validation failed: ${h}`,rule:"system"}),{isValid:!1,errors:u,warnings:f}}};if(c)return await qn.track("validateConfiguration",a);return a()}async validateWithSchemaFile(e,t,r){try{if(!bh(t))throw new Rr(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 Rr(t,[{path:"",message:`Failed to load schema: ${n}`}])}}validateWithJSONSchema(e,t,r){let n=[],i=[];return this.validateObjectAgainstSchema(e,t,"",n,i,r),{isValid:n.length===0,errors:n,warnings:i}}validateObjectAgainstSchema(e,t,r,n,i,o){if(o.validateTypes&&t.type){let s=Array.isArray(e)?"array":typeof e,c=Array.isArray(t.type)?t.type:[t.type];if(!c.includes(s)){if(n.push({path:r,message:`Expected type ${c.join(" or ")}, got ${s}`,expected:c.join(" or "),actual:s,rule:"type"}),o.stopOnFirstError)return}}if(t.enum&&!t.enum.includes(e)){if(n.push({path:r,message:`Value must be one of: ${t.enum.join(", ")}`,expected:t.enum.join(", "),actual:e,rule:"enum"}),o.stopOnFirstError)return}if(typeof e==="string"){if(t.minLength!==void 0&&e.length<t.minLength)n.push({path:r,message:`String length must be at least ${t.minLength}`,expected:`>= ${t.minLength}`,actual:e.length,rule:"minLength"});if(t.maxLength!==void 0&&e.length>t.maxLength)n.push({path:r,message:`String length must not exceed ${t.maxLength}`,expected:`<= ${t.maxLength}`,actual:e.length,rule:"maxLength"});if(t.pattern){if(!new RegExp(t.pattern).test(e))n.push({path:r,message:`String does not match pattern ${t.pattern}`,expected:t.pattern,actual:e,rule:"pattern"})}}if(typeof e==="number"){if(t.minimum!==void 0&&e<t.minimum)n.push({path:r,message:`Value must be at least ${t.minimum}`,expected:`>= ${t.minimum}`,actual:e,rule:"minimum"});if(t.maximum!==void 0&&e>t.maximum)n.push({path:r,message:`Value must not exceed ${t.maximum}`,expected:`<= ${t.maximum}`,actual:e,rule:"maximum"})}if(Array.isArray(e)&&t.items)for(let s=0;s<e.length;s++){let c=r?`${r}[${s}]`:`[${s}]`;if(this.validateObjectAgainstSchema(e[s],t.items,c,n,i,o),o.stopOnFirstError&&n.length>0)return}if(e&&typeof e==="object"&&!Array.isArray(e)){let s=e;if(o.validateRequired&&t.required){for(let c of t.required)if(!(c in s)){if(n.push({path:r?`${r}.${c}`:c,message:`Missing required property '${c}'`,expected:"required",rule:"required"}),o.stopOnFirstError)return}}if(t.properties){for(let[c,l]of Object.entries(t.properties))if(c in s){let a=r?`${r}.${c}`:c;if(this.validateObjectAgainstSchema(s[c],l,a,n,i,o),o.stopOnFirstError&&n.length>0)return}}if(t.additionalProperties===!1){let c=new Set(Object.keys(t.properties||{}));for(let l of Object.keys(s))if(!c.has(l))i.push({path:r?`${r}.${l}`:l,message:`Additional property '${l}' is not allowed`,rule:"additionalProperties"})}}}validateWithRules(e,t,r){let n=[],i=[];for(let o of t)try{let s=this.getValueByPath(e,o.path),c=this.validateWithRule(s,o,o.path);if(n.push(...c),r.stopOnFirstError&&n.length>0)break}catch(s){n.push({path:o.path,message:`Rule validation failed: ${s}`,rule:"system"})}return{isValid:n.length===0,errors:n,warnings:i}}validateWithRule(e,t,r){let n=[];if(t.required&&(e===void 0||e===null))return n.push({path:r,message:t.message||`Property '${r}' is required`,expected:"required",rule:"required"}),n;if(e===void 0||e===null)return n;if(t.type){let i=Array.isArray(e)?"array":typeof e;if(i!==t.type)n.push({path:r,message:t.message||`Expected type ${t.type}, got ${i}`,expected:t.type,actual:i,rule:"type"})}if(t.min!==void 0){let i=Array.isArray(e)?e.length:typeof e==="string"?e.length:typeof e==="number"?e:0;if(i<t.min)n.push({path:r,message:t.message||`Value must be at least ${t.min}`,expected:`>= ${t.min}`,actual:i,rule:"min"})}if(t.max!==void 0){let i=Array.isArray(e)?e.length:typeof e==="string"?e.length:typeof e==="number"?e:0;if(i>t.max)n.push({path:r,message:t.message||`Value must not exceed ${t.max}`,expected:`<= ${t.max}`,actual:i,rule:"max"})}if(t.pattern&&typeof e==="string"){if(!t.pattern.test(e))n.push({path:r,message:t.message||`Value does not match pattern ${t.pattern}`,expected:t.pattern.toString(),actual:e,rule:"pattern"})}if(t.enum&&!t.enum.includes(e))n.push({path:r,message:t.message||`Value must be one of: ${t.enum.join(", ")}`,expected:t.enum.join(", "),actual:e,rule:"enum"});if(t.validator){let i=t.validator(e);if(i)n.push({path:r,message:t.message||i,rule:"custom"})}return n}getValueByPath(e,t){if(!t)return e;let r=t.split("."),n=e;for(let i of r)if(n&&typeof n==="object"&&i in n)n=n[i];else return;return n}generateRulesFromInterface(e){let t=[],r=e.matchAll(/(\w+)(\?)?:\s*(\w+)/g);for(let n of r){let[,i,o,s]=n;t.push({path:i,required:!o,type:this.mapTypeScriptType(s)})}return t}mapTypeScriptType(e){switch(e.toLowerCase()){case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"array":return"array";case"object":return"object";default:return"object"}}static createCommonRules(){return{server:[{path:"port",required:!0,type:"number",min:1,max:65535},{path:"host",required:!0,type:"string",min:1},{path:"ssl",type:"boolean"}],database:[{path:"url",required:!0,type:"string",min:1},{path:"pool",type:"number",min:1,max:100},{path:"timeout",type:"number",min:0}],api:[{path:"baseUrl",required:!0,type:"string",pattern:xh},{path:"timeout",type:"number",min:0},{path:"retries",type:"number",min:0,max:10}]}}}function vh(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 Ks{fileLoader=new Vs;envProcessor=new ni;validator=new zs;async loadConfig(e){let t=Date.now(),{cache:r,performance:n,schema:i,validate:o,...s}=e;try{if(r?.enabled){let l=this.checkCache(s.name||"",s);if(l)return l}let c;try{c=await this.loadConfigurationStrategies(s,!0,r)}catch(l){if(s.configFile)throw l;let a=s.__strictErrorHandling;if(l instanceof Error&&l.name==="ConfigNotFoundError"){if(a)throw l;c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`No configuration file found for "${s.name||"config"}", using defaults with environment variables`]}}else if(l instanceof Error&&l.name==="ConfigLoadError"){let u=l.message.includes("EACCES")||l.message.includes("EPERM")||l.message.includes("permission denied"),f=!u&&(l.message.includes("syntax")||l.message.includes("Expected")||l.message.includes("Unexpected")||l.message.includes("BuildMessage")||l.message.includes("errors building")),d=l.message.includes("Configuration must export a valid object")||l.message.includes("Configuration file is empty and exports nothing");if(a&&(d||u))throw l;if(f&&(!a||!d))c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:["Configuration file has syntax errors, using defaults with environment variables"]};else if(!a)c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`Configuration loading error, using defaults: ${l.message}`]};else throw l}else c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`Configuration loading failed, using defaults: ${l instanceof Error?l.message:String(l)}`]}}if(i||o)await this.validateConfiguration(c.config,i,o,s.name);if(r?.enabled&&c)this.cacheResult(s.name||"",c,r,s);if(n?.enabled){let l={operation:"loadConfig",duration:Date.now()-t,configName:s.name,timestamp:new Date};if(n.onMetrics)n.onMetrics(l);if(n.slowThreshold&&l.duration>n.slowThreshold)de.warn(`Slow configuration loading detected: ${l.duration}ms for ${s.name}`);c.metrics=l}return c}catch(c){if(c instanceof Error&&c.name==="ConfigNotFoundError")throw c;let l=Date.now()-t;throw de.error(`Configuration loading failed after ${l}ms:`,[c instanceof Error?c:Error(String(c))]),c}}async loadConfigurationStrategies(e,t=!1,r){let{name:n="",alias:i,configFile:o,cwd:s,configDir:c,defaultConfig:l,checkEnv:a=!0,arrayStrategy:u="replace",verbose:f=!1}=e,d=s||kr.cwd(),h=[];if(o){let b=xe(d,o);h.push(b);let v=a?Ct(n,l,f):l,A=await this.fileLoader.tryLoadFromPaths([b],v,{arrayStrategy:u,verbose:f,cacheTtl:r?.ttl,useCache:!r?.ttl||r.ttl>100});if(!A)throw Ke.configNotFound(n||o,h,i);if(f)de.success(`Configuration loaded from explicit path: ${b}`);return this.finalizeResult(A,h,a,n,f)}let p=await this.loadLocalConfiguration(n,i,d,c,l,u,f,a,r);if(p)return h.push(...this.getLocalSearchPaths(n,i,d,c)),this.finalizeResult(p,h,a,n,f);let g=await this.loadHomeConfiguration(n,i,l,u,f,a);if(g)return h.push(...this.getHomeSearchPaths(n,i)),this.finalizeResult(g,h,a,n,f);let m=await this.loadPackageJsonConfiguration(n,i,d,l,u,f,a);if(m)return h.push(xe(d,"package.json")),this.finalizeResult(m,h,a,n,f);if(h.push(...this.getAllSearchPaths(n,i,d,c)),t)throw Ke.configNotFound(n,h,i);return{...await this.applyEnvironmentVariables(n,l,a,f),warnings:[`No configuration file found for "${n}"${vh(i)}, using defaults with environment variables`]}}async loadLocalConfiguration(e,t,r,n,i,o,s,c,l){let a=c?Ct(e,i,s):i,u=this.getLocalDirectories(r,n);for(let f of u){if(s)de.info(`Searching for configuration in: ${f}`);let d=this.fileLoader.generateConfigPaths(e,f,t),h=await this.fileLoader.tryLoadFromPaths(d,a,{arrayStrategy:o,verbose:s,cacheTtl:l?.ttl,useCache:!l?.ttl||l.ttl>100});if(h){if(s)de.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?Ct(e,r,i):r,c=[xe(Qe(),".config",e),xe(Qe(),".config"),Qe()];for(let l of c){if(i)de.info(`Checking home directory: ${l}`);let a=this.fileLoader.generateConfigPaths(e,l,t),u=await this.fileLoader.tryLoadFromPaths(a,s,{arrayStrategy:n,verbose:i});if(u){if(i)de.success(`Configuration loaded from home directory: ${u.source.path}`);return u}}return null}async loadPackageJsonConfiguration(e,t,r,n,i,o,s){let c=s?Ct(e,n,o):n;try{let l=xe(r,"package.json");if(!hf(l))return null;let a={};try{a=JSON.parse(gf(l,"utf8"))}catch(d){if(o)de.warn("Failed to parse package.json:",[d instanceof Error?d:Error(String(d))]);return null}let u=a[e],f=e;if(!u&&t){let d=Array.isArray(t)?t:[t];for(let h of d){if(!h)continue;if(a[h]){u=a[h],f=h;break}}}if(u&&typeof u==="object"&&!Array.isArray(u)){if(o)de.success(`Configuration loaded from package.json: ${f}`);return{config:Ws(c,u,i),source:{type:"package.json",path:l,priority:30,timestamp:new Date}}}}catch(l){if(o)de.warn("Failed to load package.json:",[l instanceof Error?l:Error(String(l))])}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:Ct(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 Ke.configValidation(n||"unknown",i,n)}checkCache(e,t){let r=this.generateCacheKey(e,t);return fr.get(r)||null}cacheResult(e,t,r,n){let i=this.generateCacheKey(e,n);fr.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 df({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(xe(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=[xe(Qe(),".config",e),xe(Qe(),".config"),Qe()],n=[];for(let i of r)n.push(...this.fileLoader.generateConfigPaths(e,i,t));return n}async loadConfigWithResult(e){return this.loadConfig(e)}}async function Hs(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 Ln.loadConfig(e);else n=await Ln.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)de.warn("Unexpected error loading config, using defaults:",[n instanceof Error?n:Error(String(n))]);let c=r?{...e,defaultConfig:t}:{...e,defaultConfig:t,cache:{enabled:!0},performance:{enabled:!1}};if("checkEnv"in e?e.checkEnv!==!1:!0)return(await Ln.applyEnvironmentVariables(c.name||"",t,!0,c.verbose||!1))?.config??t;return t}}function Ct(e,t,r=!1){let n=new ni,i=e.toUpperCase().replace(/[^A-Z0-9]/g,"_");function o(s,c=[]){let l={...s};for(let[a,u]of Object.entries(s)){let f=[...c,a],d=[`${i}_${f.join("_").toUpperCase()}`,`${i}_${f.map((g)=>g.toUpperCase()).join("")}`,`${i}_${f.map((g)=>g.replace(/([A-Z])/g,"_$1").toUpperCase()).join("")}`],h,p;for(let g of d)if(h=kr.env[g],h!==void 0){p=g;break}if(h!==void 0&&p)if(typeof u==="boolean")l[a]=["true","1","yes"].includes(h.toLowerCase());else if(typeof u==="number"){let g=Number(h);if(!Number.isNaN(g))l[a]=g}else if(Array.isArray(u))try{l[a]=JSON.parse(h)}catch{l[a]=h.split(",").map((g)=>g.trim())}else l[a]=h;else if(u&&typeof u==="object"&&!Array.isArray(u))l[a]=o(u,f)}return l}return o(t)}var fr,qn,us,Qf,ed=(e)=>e,rd=(e,t)=>{for(var r in t)Qf(e,r,{get:t[r],enumerable:!0,configurable:!0,set:td.bind(t,r)})},nd=(e,t)=>()=>(e&&(t=e(e=0)),t),gs,Cs,ut,Tt,Rs,Nd,Od,Yo,ar,jn,J,_,Id,Jo,Pd,Xo,_d,Ld,Nn,Md,Zo,Qo,On,Fd,Dd,jd,Bd,lr,ks,Ud,X,Wd,Vd,es,cr,Bn,H,E,zd,ts,Kd,rs,Hd,Gd,In,qd,ns,is,Yd,Pn,Jd,Xd,Zd,Qd,eh,ur,Ss,th,rh="0.15.6",se,vr,At,Un,Wn,wr,Vn,zn,Et,Kn,Hn,Me,As,Es,he,Te,Ts,Ns,nh,oh,Os,$r,w1,q,T,$1,ah,C1,lh,R1,k1,os,S1,ch,uh,A1,ss,E1,T1,N1,O1,I1,_n,fh,P1,ge,Ps,Cr,_s,Ls,ri,Ms,Fs,Rr,Ds,js,Ke,xh,de,Ln,D1,j1;var Gs=dc(()=>{fr=new ls,qn=new cs,us=[".ts",".js",".mjs",".cjs",".json",".mts",".cts"];Qf=Object.defineProperty;gs={};rd(gs,{withErrorRecovery:()=>ys,tryLoadConfig:()=>Sd,loadConfigWithResult:()=>Rd,loadConfig:()=>$s,isRetryableError:()=>bd,isConfigNotFoundError:()=>yd,isBunfigError:()=>bs,globalPerformanceMonitor:()=>Tt,globalCache:()=>ut,getEnvOrDefault:()=>xd,generateConfigTypes:()=>Ad,defaultGeneratedDir:()=>Ns,defaultConfigDir:()=>Ts,deepMergeWithArrayStrategy:()=>Qn,deepMerge:()=>xs,createLibraryConfig:()=>Ed,config:()=>kd,bunfigPlugin:()=>Td,applyEnvVarsToConfig:()=>kt,TypeGenerationError:()=>zn,SchemaValidationError:()=>Et,PluginError:()=>Hn,PerformanceMonitor:()=>Jn,FileSystemError:()=>Vn,ErrorFactory:()=>Me,EnvVarError:()=>wr,EnvProcessor:()=>Sr,ConfigValidator:()=>ei,ConfigValidationError:()=>Un,ConfigNotFoundError:()=>vr,ConfigMergeError:()=>Wn,ConfigLoader:()=>ti,ConfigLoadError:()=>At,ConfigFileLoader:()=>Ar,ConfigCache:()=>Yn,CacheUtils:()=>Rs,BunfigError:()=>se,BrowserConfigError:()=>Kn,ArrayMergeStrategies:()=>As});nh=nd(async()=>{Cs=import.meta.require,ut=new Yn,Tt=new Jn,Rs={createKey:id,isEquivalent:od,estimateMemoryUsage:sd},Nd=gr(Fn.cwd(),"config"),Od=gr(Fn.cwd(),"src/generated"),Yo=hr.env.CLARITY_LOG_DIR||vf(cd(),"logs"),ar={level:"info",defaultName:"clarity",timestamp:!0,colors:!0,format:"text",maxLogSize:10485760,logDatePattern:"YYYY-MM-DD",logDirectory:Yo,rotation:{frequency:"daily",maxSize:10485760,maxFiles:5,compress:!1,rotateHour:0,rotateMinute:0,rotateDayOfWeek:0,rotateDayOfMonth:1,encrypt:!1},verbose:!1},jn=await ud(),J={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"},_=J,Id=J.red,Jo=J.green,Pd=J.yellow,Xo=J.blue,_d=J.magenta,Ld=J.cyan,Nn=J.white,Md=J.gray,Zo=J.bgRed,Qo=J.bgYellow,On=J.bold,Fd=J.dim,Dd=J.italic,jd=J.underline,Bd=J.reset,lr={activationLevel:"error",bufferSize:50,flushOnDeactivation:!0,stopBuffering:!1},ks={debug:"\uD83D\uDD0D",info:Xo("\u2139"),success:Jo("\u2713"),warning:Qo(Nn(On(" WARN "))),error:Zo(Nn(On(" ERROR ")))},Ud=new yr("stacks"),X=new yr("bunfig",{showTags:!0}),Wd=te(St.cwd(),"config"),Vd=te(St.cwd(),"src/generated"),es=dr.env.CLARITY_LOG_DIR||bf(gd(),"logs"),cr={level:"info",defaultName:"clarity",timestamp:!0,colors:!0,format:"text",maxLogSize:10485760,logDatePattern:"YYYY-MM-DD",logDirectory:es,rotation:{frequency:"daily",maxSize:10485760,maxFiles:5,compress:!1,rotateHour:0,rotateMinute:0,rotateDayOfWeek:0,rotateDayOfMonth:1,encrypt:!1},verbose:!1,writeToFile:!1},Bn=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,zd=H.red,ts=H.green,Kd=H.yellow,rs=H.blue,Hd=H.magenta,Gd=H.cyan,In=H.white,qd=H.gray,ns=H.bgRed,is=H.bgYellow,Yd=H.bgGray,Pn=H.bold,Jd=H.dim,Xd=H.italic,Zd=H.underline,Qd=H.strikethrough,eh=H.reset,ur={activationLevel:"error",bufferSize:50,flushOnDeactivation:!0,stopBuffering:!1},Ss={debug:"\uD83D\uDD0D",info:rs("\u2139"),success:ts("\u2713"),warning:is(In(Pn(" WARN "))),error:ns(In(Pn(" ERROR ")))},th=new xr("stacks"),se=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}`}},vr=class extends se{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})}},At=class extends se{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}},Un=class extends se{code="CONFIG_VALIDATION_ERROR";constructor(t,r,n){super(`Configuration validation failed for "${t}"`,{configPath:t,configName:n,validationErrors:r,errorCount:r.length})}},Wn=class extends se{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}},wr=class extends se{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})}},Vn=class extends se{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}},zn=class extends se{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}},Et=class extends se{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})}},Kn=class extends se{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})}},Hn=class extends se{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}},Me={configNotFound(e,t,r){return new vr(e,t,r)},configLoad(e,t,r){return new At(e,t,r)},configValidation(e,t,r){return new Un(e,t,r)},configMerge(e,t,r,n){return new Wn(e,t,r,n)},envVar(e,t,r,n){return new wr(e,t,r,n)},fileSystem(e,t,r){return new Vn(e,t,r)},typeGeneration(e,t,r){return new zn(e,t,r)},schemaValidation(e,t,r){return new Et(e,t,r)},browserConfig(e,t,r,n){return new Kn(e,t,r,n)},plugin(e,t,r){return new Hn(e,t,r)}},As={replace:"replace",concat:"concat",smart:"smart"},Es=/^https?:\/\//,he=new xr("bunfig",{showTags:!0}),Te=new ti,Ts=re(He.cwd(),"config"),Ns=re(He.cwd(),"src/generated")});oh=mr.env.CLARITY_LOG_DIR||Wf(ih(),"logs"),Os={level:"info",defaultName:"clarity",timestamp:!0,colors:!0,format:"text",maxLogSize:10485760,logDatePattern:"YYYY-MM-DD",logDirectory:oh,rotation:{frequency:"daily",maxSize:10485760,maxFiles:5,compress:!1,rotateHour:0,rotateMinute:0,rotateDayOfWeek:0,rotateDayOfMonth:1,encrypt:!1},verbose:!1,writeToFile:!1},$r={...Os},w1=(async()=>{try{let{loadConfig:e}=await nh().then(()=>gs),t=await e({name:"clarity",alias:"logging",defaultConfig:Os,cwd:mr.cwd()});if(t)Object.assign($r,t)}catch{}return $r})();q={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=q,$1=q.red,ah=q.green,C1=q.yellow,lh=q.blue,R1=q.magenta,k1=q.cyan,os=q.white,S1=q.gray,ch=q.bgRed,uh=q.bgYellow,A1=q.bgGray,ss=q.bold,E1=q.dim,T1=q.italic,N1=q.underline,O1=q.strikethrough,I1=q.reset,_n={activationLevel:"error",bufferSize:50,flushOnDeactivation:!0,stopBuffering:!1},fh={debug:"\uD83D\uDD0D",info:lh("\u2139"),success:ah("\u2713"),warning:uh(os(ss(" WARN "))),error:ch(os(ss(" ERROR ")))};P1=new Er("stacks");ge=class ge extends Error{timestamp;context;constructor(e,t={}){super(e);if(this.name=this.constructor.name,this.timestamp=new Date,this.context=t,Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)}toJSON(){return{name:this.name,code:this.code,message:this.message,timestamp:this.timestamp.toISOString(),context:this.context,stack:this.stack}}toString(){let e=Object.keys(this.context).length>0?` (${Object.entries(this.context).map(([t,r])=>`${t}: ${r}`).join(", ")})`:"";return`${this.name} [${this.code}]: ${this.message}${e}`}};Ps=class Ps extends ge{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})}};Cr=class Cr extends ge{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}};_s=class _s extends ge{code="CONFIG_VALIDATION_ERROR";constructor(e,t,r){super(`Configuration validation failed for "${e}"`,{configPath:e,configName:r,validationErrors:t,errorCount:t.length})}};Ls=class Ls extends ge{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}};ri=class ri extends ge{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})}};Ms=class Ms extends ge{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}};Fs=class Fs extends ge{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}};Rr=class Rr extends ge{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})}};Ds=class Ds extends ge{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})}};js=class js extends ge{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}};Ke={configNotFound(e,t,r){return new Ps(e,t,r)},configLoad(e,t,r){return new Cr(e,t,r)},configValidation(e,t,r){return new _s(e,t,r)},configMerge(e,t,r,n){return new Ls(e,t,r,n)},envVar(e,t,r,n){return new ri(e,t,r,n)},fileSystem(e,t,r){return new Ms(e,t,r)},typeGeneration(e,t,r){return new Fs(e,t,r)},schemaValidation(e,t,r){return new Rr(e,t,r)},browserConfig(e,t,r,n){return new Ds(e,t,r,n)},plugin(e,t,r){return new js(e,t,r)}};xh=/^https?:\/\//;de=new Er("bunfig",{showTags:!0});Ln=new Ks;D1=xe(kr.cwd(),"config"),j1=xe(kr.cwd(),"src/generated")});import{existsSync as je,statSync as Y0,watch as uc}from"fs";import{unlink as J0}from"fs/promises";import{dirname as X0,resolve as Ai}from"path";import pe from"process";var{Glob:Z0}=globalThis.Bun;import{EventEmitter as hc}from"events";import Oe from"process";import Ti from"process";import Yr from"process";import Pt from"process";import bt from"process";import Pi from"tty";import tu,{stdin as gx,stdout as mx}from"process";import{existsSync as su}from"fs";import Hr from"fs/promises";import _i from"os";import Gr from"path";import Be from"process";function qr(e){return e.replace(/[<[].+/,"").trim()}function gc(e){let t=/<([^>]+)>/g,r=/\[([^\]]+)\]/g,n=[],i=(c)=>{let l=!1,a=c[1];if(a.startsWith("..."))a=a.slice(3),l=!0;else if(a.endsWith("..."))a=a.slice(0,-3),l=!0;return{required:c[0].startsWith("<"),value:a.trim(),variadic:l}},o;while(o=t.exec(e))n.push(i(o));let s;while(s=r.exec(e))n.push(i(s));return n}function mc(e){let t={alias:{},boolean:[]};for(let[r,n]of e.entries()){if(n.names.length>1)t.alias[n.names[0]]=n.names.slice(1);if(n.isBoolean)if(n.negated){if(!e.some((o,s)=>s!==r&&o.names.some((c)=>n.names.includes(c))&&typeof o.required==="boolean"))t.boolean.push(n.names[0])}else t.boolean.push(n.names[0])}return t}function Ni(e){return e.reduce((t,r)=>t.length>=r.length?t:r,"")}function Kr(e,t){return e.length>=t?e:`${e}${" ".repeat(t-e.length)}`}function It(e){return e.replace(/([a-z])-([a-z])/g,(t,r,n)=>r+n.toUpperCase())}function pc(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 yc(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 bc(e){let t=/([^\\/]+)$/.exec(e);return t?t[1]:""}function xt(e){return e.split(".").map((t,r)=>r===0?It(t):t).join(".")}class vt 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 mh(e,t,r={}){return Vs(e,t,r,new WeakMap)}function Vs(e,t,r,n){let{arrayMergeMode:i="replace",skipNullish:o=!1,customMerger:s}=r;if(t===null||t===void 0)return o?e:t;if(s){let c=s(e,t);if(c!==void 0)return c}if(Array.isArray(t)||Array.isArray(e))return Ws(e,t,i,n);if(!ue(t)||!ue(e))return t;return xh(e,t,r,n)}function Ws(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 ph(e,t);case"smart":return yh(e,t,n);default:return t}return t}function ph(e,t){let r=[...t];for(let n of e)if(!r.some((i)=>Yn(i,n)))r.push(n);return r}function yh(e,t,r){if(t.length===0)return e;if(e.length===0)return t;if(ue(t[0])&&ue(e[0]))return bh(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 bh(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 c of o)if(c in i){if(n.find((a)=>ue(a)&&(c in a)&&a[c]===i[c])){s=!0;break}}if(!s)n.push(i)}return n}function xh(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 c=i[s],l=o[s];if(r.skipNullish&&(c===null||c===void 0))continue;if(c===null||c===void 0){o[s]=c;continue}if(ue(c)&&ue(l))o[s]=Vs(l,c,r,n);else if(Array.isArray(c)||Array.isArray(l))o[s]=Ws(l,c,r.arrayMergeMode||"smart",n);else o[s]=c}return o}function zs(e,t,r="replace"){return mh(e,t,{arrayMergeMode:r==="replace"?"replace":"smart",skipNullish:!0})}function Yn(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(!Yn(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(!Yn(e[i],t[i]))return!1}return!0}return!1}function ue(e){return Boolean(e&&typeof e==="object"&&!Array.isArray(e))}class Ks{extensions=ds;async loadFromPath(e,t,r={}){let{arrayStrategy:n="replace",useCache:i=!0,cacheTtl:o,trackPerformance:s=!0,verbose:c=!1}=r;if(i){let a=hr.getWithFileCheck("file",e);if(a){if(c)console.log(`Configuration loaded from cache: ${e}`);return a}}let l=async()=>{if(!ar(e))return null;try{let a=`?t=${Date.now()}`,u=await import(e+a),f=u.default||u,d="default"in u,h=Object.keys(u).length>0;if(!d&&!h)throw new kr(e,Error("Configuration file is empty and exports nothing"),"unknown");if(typeof f!=="object"||f===null||Array.isArray(f))throw new kr(e,Error("Configuration must export a valid object"),"unknown");let m={config:zs(t,f,n),source:{type:"file",path:e,priority:100,timestamp:new Date}};if(i)hr.setWithFileCheck("file",m,e,o);return m}catch(a){throw a instanceof Error?He.configLoad(e,a):He.configLoad(e,Error(String(a)))}};if(s)return Jn.track("loadFromPath",l,{path:e});return l()}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 hf({name:e,directory:t,alias:r})}generateNamePatterns(e,t){return hs({name:e,alias:t})}checkFileAccess(e){return gh(async()=>ar(e),{maxRetries:2,retryDelay:100,fallback:!1})}async discoverConfigFiles(e,t,r){let n=[];if(!ar(e))return n;if(t||r){let i=this.generateNamePatterns(t||"",r);for(let o of i)for(let s of this.extensions){let c=cs(e,`${o}${s}`);if(await this.checkFileAccess(c))n.push(c)}}else try{let{readdirSync:i}=await import("fs"),o=i(e);for(let s of o)if(this.looksLikeConfigFile(s)){let c=cs(e,s);if(await this.checkFileAccess(c))n.push(c)}}catch{return[]}return n}looksLikeConfigFile(e){return[/\.config\.(ts|js|mjs|cjs|json|mts|cts)$/,/^\..*\.(ts|js|mjs|cjs|json|mts|cts)$/,/config\.(ts|js|mjs|cjs|json|mts|cts)$/].some((r)=>r.test(e))}async validateConfigFile(e){let t=[];try{if(!ar(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 Hs{async validateConfiguration(e,t,r={}){let{stopOnFirstError:n=!1,validateRequired:i=!0,validateTypes:o=!0,customRules:s=[],trackPerformance:c=!0,verbose:l=!1}=r,a=async()=>{let u=[],f=[],d={stopOnFirstError:n,validateRequired:i,validateTypes:o,customRules:s,trackPerformance:c,verbose:l};try{if(typeof t==="string")return await this.validateWithSchemaFile(e,t,d);else if(Array.isArray(t))return this.validateWithRules(e,[...t,...s],d);else return this.validateWithJSONSchema(e,t,d)}catch(h){return u.push({path:"",message:`Validation failed: ${h}`,rule:"system"}),{isValid:!1,errors:u,warnings:f}}};if(c)return await Jn.track("validateConfiguration",a);return a()}async validateWithSchemaFile(e,t,r){try{if(!vh(t))throw new Sr(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 Sr(t,[{path:"",message:`Failed to load schema: ${n}`}])}}validateWithJSONSchema(e,t,r){let n=[],i=[];return this.validateObjectAgainstSchema(e,t,"",n,i,r),{isValid:n.length===0,errors:n,warnings:i}}validateObjectAgainstSchema(e,t,r,n,i,o){if(o.validateTypes&&t.type){let s=Array.isArray(e)?"array":typeof e,c=Array.isArray(t.type)?t.type:[t.type];if(!c.includes(s)){if(n.push({path:r,message:`Expected type ${c.join(" or ")}, got ${s}`,expected:c.join(" or "),actual:s,rule:"type"}),o.stopOnFirstError)return}}if(t.enum&&!t.enum.includes(e)){if(n.push({path:r,message:`Value must be one of: ${t.enum.join(", ")}`,expected:t.enum.join(", "),actual:e,rule:"enum"}),o.stopOnFirstError)return}if(typeof e==="string"){if(t.minLength!==void 0&&e.length<t.minLength)n.push({path:r,message:`String length must be at least ${t.minLength}`,expected:`>= ${t.minLength}`,actual:e.length,rule:"minLength"});if(t.maxLength!==void 0&&e.length>t.maxLength)n.push({path:r,message:`String length must not exceed ${t.maxLength}`,expected:`<= ${t.maxLength}`,actual:e.length,rule:"maxLength"});if(t.pattern){if(!new RegExp(t.pattern).test(e))n.push({path:r,message:`String does not match pattern ${t.pattern}`,expected:t.pattern,actual:e,rule:"pattern"})}}if(typeof e==="number"){if(t.minimum!==void 0&&e<t.minimum)n.push({path:r,message:`Value must be at least ${t.minimum}`,expected:`>= ${t.minimum}`,actual:e,rule:"minimum"});if(t.maximum!==void 0&&e>t.maximum)n.push({path:r,message:`Value must not exceed ${t.maximum}`,expected:`<= ${t.maximum}`,actual:e,rule:"maximum"})}if(Array.isArray(e)&&t.items)for(let s=0;s<e.length;s++){let c=r?`${r}[${s}]`:`[${s}]`;if(this.validateObjectAgainstSchema(e[s],t.items,c,n,i,o),o.stopOnFirstError&&n.length>0)return}if(e&&typeof e==="object"&&!Array.isArray(e)){let s=e;if(o.validateRequired&&t.required){for(let c of t.required)if(!(c in s)){if(n.push({path:r?`${r}.${c}`:c,message:`Missing required property '${c}'`,expected:"required",rule:"required"}),o.stopOnFirstError)return}}if(t.properties){for(let[c,l]of Object.entries(t.properties))if(c in s){let a=r?`${r}.${c}`:c;if(this.validateObjectAgainstSchema(s[c],l,a,n,i,o),o.stopOnFirstError&&n.length>0)return}}if(t.additionalProperties===!1){let c=new Set(Object.keys(t.properties||{}));for(let l of Object.keys(s))if(!c.has(l))i.push({path:r?`${r}.${l}`:l,message:`Additional property '${l}' is not allowed`,rule:"additionalProperties"})}}}validateWithRules(e,t,r){let n=[],i=[];for(let o of t)try{let s=this.getValueByPath(e,o.path),c=this.validateWithRule(s,o,o.path);if(n.push(...c),r.stopOnFirstError&&n.length>0)break}catch(s){n.push({path:o.path,message:`Rule validation failed: ${s}`,rule:"system"})}return{isValid:n.length===0,errors:n,warnings:i}}validateWithRule(e,t,r){let n=[];if(t.required&&(e===void 0||e===null))return n.push({path:r,message:t.message||`Property '${r}' is required`,expected:"required",rule:"required"}),n;if(e===void 0||e===null)return n;if(t.type){let i=Array.isArray(e)?"array":typeof e;if(i!==t.type)n.push({path:r,message:t.message||`Expected type ${t.type}, got ${i}`,expected:t.type,actual:i,rule:"type"})}if(t.min!==void 0){let i=Array.isArray(e)?e.length:typeof e==="string"?e.length:typeof e==="number"?e:0;if(i<t.min)n.push({path:r,message:t.message||`Value must be at least ${t.min}`,expected:`>= ${t.min}`,actual:i,rule:"min"})}if(t.max!==void 0){let i=Array.isArray(e)?e.length:typeof e==="string"?e.length:typeof e==="number"?e:0;if(i>t.max)n.push({path:r,message:t.message||`Value must not exceed ${t.max}`,expected:`<= ${t.max}`,actual:i,rule:"max"})}if(t.pattern&&typeof e==="string"){if(!t.pattern.test(e))n.push({path:r,message:t.message||`Value does not match pattern ${t.pattern}`,expected:t.pattern.toString(),actual:e,rule:"pattern"})}if(t.enum&&!t.enum.includes(e))n.push({path:r,message:t.message||`Value must be one of: ${t.enum.join(", ")}`,expected:t.enum.join(", "),actual:e,rule:"enum"});if(t.validator){let i=t.validator(e);if(i)n.push({path:r,message:t.message||i,rule:"custom"})}return n}getValueByPath(e,t){if(!t)return e;let r=t.split("."),n=e;for(let i of r)if(n&&typeof n==="object"&&i in n)n=n[i];else return;return n}generateRulesFromInterface(e){let t=[],r=e.matchAll(/(\w+)(\?)?:\s*(\w+)/g);for(let n of r){let[,i,o,s]=n;t.push({path:i,required:!o,type:this.mapTypeScriptType(s)})}return t}mapTypeScriptType(e){switch(e.toLowerCase()){case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"array":return"array";case"object":return"object";default:return"object"}}static createCommonRules(){return{server:[{path:"port",required:!0,type:"number",min:1,max:65535},{path:"host",required:!0,type:"string",min:1},{path:"ssl",type:"boolean"}],database:[{path:"url",required:!0,type:"string",min:1},{path:"pool",type:"number",min:1,max:100},{path:"timeout",type:"number",min:0}],api:[{path:"baseUrl",required:!0,type:"string",pattern:wh},{path:"timeout",type:"number",min:0},{path:"retries",type:"number",min:0,max:10}]}}}function $h(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 Gs{fileLoader=new Ks;envProcessor=new oi;validator=new Hs;async loadConfig(e){let t=Date.now(),{cache:r,performance:n,schema:i,validate:o,...s}=e;try{if(r?.enabled){let l=this.checkCache(s.name||"",s);if(l)return l}let c;try{c=await this.loadConfigurationStrategies(s,!0,r)}catch(l){if(s.configFile)throw l;let a=s.__strictErrorHandling;if(l instanceof Error&&l.name==="ConfigNotFoundError"){if(a)throw l;c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`No configuration file found for "${s.name||"config"}", using defaults with environment variables`]}}else if(l instanceof Error&&l.name==="ConfigLoadError"){let u=l.message.includes("EACCES")||l.message.includes("EPERM")||l.message.includes("permission denied"),f=!u&&(l.message.includes("syntax")||l.message.includes("Expected")||l.message.includes("Unexpected")||l.message.includes("BuildMessage")||l.message.includes("errors building")),d=l.message.includes("Configuration must export a valid object")||l.message.includes("Configuration file is empty and exports nothing");if(a&&(d||u))throw l;if(f&&(!a||!d))c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:["Configuration file has syntax errors, using defaults with environment variables"]};else if(!a)c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`Configuration loading error, using defaults: ${l.message}`]};else throw l}else c={...await this.applyEnvironmentVariables(s.name||"",s.defaultConfig,s.checkEnv!==!1,s.verbose||!1),warnings:[`Configuration loading failed, using defaults: ${l instanceof Error?l.message:String(l)}`]}}if(i||o)await this.validateConfiguration(c.config,i,o,s.name);if(r?.enabled&&c)this.cacheResult(s.name||"",c,r,s);if(n?.enabled){let l={operation:"loadConfig",duration:Date.now()-t,configName:s.name,timestamp:new Date};if(n.onMetrics)n.onMetrics(l);if(n.slowThreshold&&l.duration>n.slowThreshold)he.warn(`Slow configuration loading detected: ${l.duration}ms for ${s.name}`);c.metrics=l}return c}catch(c){if(c instanceof Error&&c.name==="ConfigNotFoundError")throw c;let l=Date.now()-t;throw he.error(`Configuration loading failed after ${l}ms:`,[c instanceof Error?c:Error(String(c))]),c}}async loadConfigurationStrategies(e,t=!1,r){let{name:n="",alias:i,configFile:o,cwd:s,configDir:c,defaultConfig:l,checkEnv:a=!0,arrayStrategy:u="replace",verbose:f=!1}=e,d=s||Ar.cwd(),h=[];if(o){let b=ve(d,o);h.push(b);let v=a?kt(n,l,f):l,A=await this.fileLoader.tryLoadFromPaths([b],v,{arrayStrategy:u,verbose:f,cacheTtl:r?.ttl,useCache:!r?.ttl||r.ttl>100});if(!A)throw He.configNotFound(n||o,h,i);if(f)he.success(`Configuration loaded from explicit path: ${b}`);return this.finalizeResult(A,h,a,n,f)}let p=await this.loadLocalConfiguration(n,i,d,c,l,u,f,a,r);if(p)return h.push(...this.getLocalSearchPaths(n,i,d,c)),this.finalizeResult(p,h,a,n,f);let g=await this.loadHomeConfiguration(n,i,l,u,f,a);if(g)return h.push(...this.getHomeSearchPaths(n,i)),this.finalizeResult(g,h,a,n,f);let m=await this.loadPackageJsonConfiguration(n,i,d,l,u,f,a);if(m)return h.push(ve(d,"package.json")),this.finalizeResult(m,h,a,n,f);if(h.push(...this.getAllSearchPaths(n,i,d,c)),t)throw He.configNotFound(n,h,i);return{...await this.applyEnvironmentVariables(n,l,a,f),warnings:[`No configuration file found for "${n}"${$h(i)}, using defaults with environment variables`]}}async loadLocalConfiguration(e,t,r,n,i,o,s,c,l){let a=c?kt(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,a,{arrayStrategy:o,verbose:s,cacheTtl:l?.ttl,useCache:!l?.ttl||l.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?kt(e,r,i):r,c=[ve(et(),".config",e),ve(et(),".config"),et()];for(let l of c){if(i)he.info(`Checking home directory: ${l}`);let a=this.fileLoader.generateConfigPaths(e,l,t),u=await this.fileLoader.tryLoadFromPaths(a,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 c=s?kt(e,n,o):n;try{let l=ve(r,"package.json");if(!mf(l))return null;let a={};try{a=JSON.parse(pf(l,"utf8"))}catch(d){if(o)he.warn("Failed to parse package.json:",[d instanceof Error?d:Error(String(d))]);return null}let u=a[e],f=e;if(!u&&t){let d=Array.isArray(t)?t:[t];for(let h of d){if(!h)continue;if(a[h]){u=a[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(c,u,i),source:{type:"package.json",path:l,priority:30,timestamp:new Date}}}}catch(l){if(o)he.warn("Failed to load package.json:",[l instanceof Error?l:Error(String(l))])}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:kt(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 He.configValidation(n||"unknown",i,n)}checkCache(e,t){let r=this.generateCacheKey(e,t);return hr.get(r)||null}cacheResult(e,t,r,n){let i=this.generateCacheKey(e,n);hr.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 gf({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(et(),".config",e),ve(et(),".config"),et()],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 qs(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 Fn.loadConfig(e);else n=await Fn.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 c=r?{...e,defaultConfig:t}:{...e,defaultConfig:t,cache:{enabled:!0},performance:{enabled:!1}};if("checkEnv"in e?e.checkEnv!==!1:!0)return(await Fn.applyEnvironmentVariables(c.name||"",t,!0,c.verbose||!1))?.config??t;return t}}function kt(e,t,r=!1){let n=new oi,i=e.toUpperCase().replace(/[^A-Z0-9]/g,"_");function o(s,c=[]){let l={...s};for(let[a,u]of Object.entries(s)){let f=[...c,a],d=[`${i}_${f.join("_").toUpperCase()}`,`${i}_${f.map((g)=>g.toUpperCase()).join("")}`,`${i}_${f.map((g)=>g.replace(/([A-Z])/g,"_$1").toUpperCase()).join("")}`],h,p;for(let g of d)if(h=Ar.env[g],h!==void 0){p=g;break}if(h!==void 0&&p)if(typeof u==="boolean")l[a]=["true","1","yes"].includes(h.toLowerCase());else if(typeof u==="number"){let g=Number(h);if(!Number.isNaN(g))l[a]=g}else if(Array.isArray(u))try{l[a]=JSON.parse(h)}catch{l[a]=h.split(",").map((g)=>g.trim())}else l[a]=h;else if(u&&typeof u==="object"&&!Array.isArray(u))l[a]=o(u,f)}return l}return o(t)}var hr,Jn,ds,td,rd=(e)=>e,id=(e,t)=>{for(var r in t)td(e,r,{get:t[r],enumerable:!0,configurable:!0,set:nd.bind(t,r)})},od=(e,t)=>()=>(e&&(t=e(e=0)),t),ps,ks,ft,Ot,Ss,Id,Pd,Xo,cr,Un,X,_,_d,Zo,Ld,Qo,Md,Fd,In,Dd,es,ts,Pn,jd,Bd,Ud,Vd,ur,As,Wd,Z,zd,Kd,rs,fr,Vn,H,E,Hd,ns,Gd,is,qd,Yd,_n,Jd,os,ss,Xd,Ln,Zd,Qd,eh,th,rh,dr,Es,nh,ih="0.15.6",ae,$r,Tt,Wn,zn,Cr,Kn,Hn,Nt,Gn,qn,Fe,Ts,Ns,ge,Ne,Os,Is,oh,ah,Ps,Rr,C1,q,T,R1,ch,k1,uh,S1,A1,as,E1,fh,dh,T1,ls,N1,O1,I1,P1,_1,Mn,hh,L1,me,Ls,kr,Ms,Fs,ii,Ds,js,Sr,Bs,Us,He,wh,he,Fn,B1,U1;var Ys=gc(()=>{hr=new us,Jn=new fs,ds=[".ts",".js",".mjs",".cjs",".json",".mts",".cts"];td=Object.defineProperty;ps={};id(ps,{withErrorRecovery:()=>xs,tryLoadConfig:()=>Ed,loadConfigWithResult:()=>Sd,loadConfig:()=>Rs,isRetryableError:()=>vd,isConfigNotFoundError:()=>xd,isBunfigError:()=>vs,globalPerformanceMonitor:()=>Ot,globalCache:()=>ft,getEnvOrDefault:()=>wd,generateConfigTypes:()=>Td,defaultGeneratedDir:()=>Is,defaultConfigDir:()=>Os,deepMergeWithArrayStrategy:()=>ti,deepMerge:()=>ws,createLibraryConfig:()=>Nd,config:()=>Ad,bunfigPlugin:()=>Od,applyEnvVarsToConfig:()=>At,TypeGenerationError:()=>Hn,SchemaValidationError:()=>Nt,PluginError:()=>qn,PerformanceMonitor:()=>Zn,FileSystemError:()=>Kn,ErrorFactory:()=>Fe,EnvVarError:()=>Cr,EnvProcessor:()=>Er,ConfigValidator:()=>ri,ConfigValidationError:()=>Wn,ConfigNotFoundError:()=>$r,ConfigMergeError:()=>zn,ConfigLoader:()=>ni,ConfigLoadError:()=>Tt,ConfigFileLoader:()=>Tr,ConfigCache:()=>Xn,CacheUtils:()=>Ss,BunfigError:()=>ae,BrowserConfigError:()=>Gn,ArrayMergeStrategies:()=>Ts});oh=od(async()=>{ks=import.meta.require,ft=new Xn,Ot=new Zn,Ss={createKey:sd,isEquivalent:ad,estimateMemoryUsage:ld},Id=pr(jn.cwd(),"config"),Pd=pr(jn.cwd(),"src/generated"),Xo=mr.env.CLARITY_LOG_DIR||$f(fd(),"logs"),cr={level:"info",defaultName:"clarity",timestamp:!0,colors:!0,format:"text",maxLogSize:10485760,logDatePattern:"YYYY-MM-DD",logDirectory:Xo,rotation:{frequency:"daily",maxSize:10485760,maxFiles:5,compress:!1,rotateHour:0,rotateMinute:0,rotateDayOfWeek:0,rotateDayOfMonth:1,encrypt:!1},verbose:!1},Un=await dd(),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"},_=X,_d=X.red,Zo=X.green,Ld=X.yellow,Qo=X.blue,Md=X.magenta,Fd=X.cyan,In=X.white,Dd=X.gray,es=X.bgRed,ts=X.bgYellow,Pn=X.bold,jd=X.dim,Bd=X.italic,Ud=X.underline,Vd=X.reset,ur={activationLevel:"error",bufferSize:50,flushOnDeactivation:!0,stopBuffering:!1},As={debug:"\uD83D\uDD0D",info:Qo("\u2139"),success:Zo("\u2713"),warning:ts(In(Pn(" WARN "))),error:es(In(Pn(" ERROR ")))},Wd=new xr("stacks"),Z=new xr("bunfig",{showTags:!0}),zd=re(Et.cwd(),"config"),Kd=re(Et.cwd(),"src/generated"),rs=gr.env.CLARITY_LOG_DIR||vf(pd(),"logs"),fr={level:"info",defaultName:"clarity",timestamp:!0,colors:!0,format:"text",maxLogSize:10485760,logDatePattern:"YYYY-MM-DD",logDirectory:rs,rotation:{frequency:"daily",maxSize:10485760,maxFiles:5,compress:!1,rotateHour:0,rotateMinute:0,rotateDayOfWeek:0,rotateDayOfMonth:1,encrypt:!1},verbose:!1,writeToFile:!1},Vn=await yd(),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,Hd=H.red,ns=H.green,Gd=H.yellow,is=H.blue,qd=H.magenta,Yd=H.cyan,_n=H.white,Jd=H.gray,os=H.bgRed,ss=H.bgYellow,Xd=H.bgGray,Ln=H.bold,Zd=H.dim,Qd=H.italic,eh=H.underline,th=H.strikethrough,rh=H.reset,dr={activationLevel:"error",bufferSize:50,flushOnDeactivation:!0,stopBuffering:!1},Es={debug:"\uD83D\uDD0D",info:is("\u2139"),success:ns("\u2713"),warning:ss(_n(Ln(" WARN "))),error:os(_n(Ln(" ERROR ")))},nh=new wr("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}`}},$r=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})}},Tt=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}},Wn=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}},Cr=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})}},Kn=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}},Hn=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}},Nt=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})}},Gn=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})}},qn=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 $r(e,t,r)},configLoad(e,t,r){return new Tt(e,t,r)},configValidation(e,t,r){return new Wn(e,t,r)},configMerge(e,t,r,n){return new zn(e,t,r,n)},envVar(e,t,r,n){return new Cr(e,t,r,n)},fileSystem(e,t,r){return new Kn(e,t,r)},typeGeneration(e,t,r){return new Hn(e,t,r)},schemaValidation(e,t,r){return new Nt(e,t,r)},browserConfig(e,t,r,n){return new Gn(e,t,r,n)},plugin(e,t,r){return new qn(e,t,r)}},Ts={replace:"replace",concat:"concat",smart:"smart"},Ns=/^https?:\/\//,ge=new wr("bunfig",{showTags:!0}),Ne=new ni,Os=ne(Ge.cwd(),"config"),Is=ne(Ge.cwd(),"src/generated")});ah=yr.env.CLARITY_LOG_DIR||zf(sh(),"logs"),Ps={level:"info",defaultName:"clarity",timestamp:!0,colors:!0,format:"text",maxLogSize:10485760,logDatePattern:"YYYY-MM-DD",logDirectory:ah,rotation:{frequency:"daily",maxSize:10485760,maxFiles:5,compress:!1,rotateHour:0,rotateMinute:0,rotateDayOfWeek:0,rotateDayOfMonth:1,encrypt:!1},verbose:!1,writeToFile:!1},Rr={...Ps},C1=(async()=>{try{let{loadConfig:e}=await oh().then(()=>ps),t=await e({name:"clarity",alias:"logging",defaultConfig:Ps,cwd:yr.cwd()});if(t)Object.assign(Rr,t)}catch{}return Rr})();q={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=q,R1=q.red,ch=q.green,k1=q.yellow,uh=q.blue,S1=q.magenta,A1=q.cyan,as=q.white,E1=q.gray,fh=q.bgRed,dh=q.bgYellow,T1=q.bgGray,ls=q.bold,N1=q.dim,O1=q.italic,I1=q.underline,P1=q.strikethrough,_1=q.reset,Mn={activationLevel:"error",bufferSize:50,flushOnDeactivation:!0,stopBuffering:!1},hh={debug:"\uD83D\uDD0D",info:uh("\u2139"),success:ch("\u2713"),warning:dh(as(ls(" WARN "))),error:fh(as(ls(" ERROR ")))};L1=new Nr("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}`}};Ls=class Ls 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})}};kr=class kr 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}};Ms=class Ms 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})}};Fs=class Fs 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}};ii=class ii 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})}};Ds=class Ds 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}};js=class js 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}};Sr=class Sr 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})}};Bs=class Bs 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})}};Us=class Us 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}};He={configNotFound(e,t,r){return new Ls(e,t,r)},configLoad(e,t,r){return new kr(e,t,r)},configValidation(e,t,r){return new Ms(e,t,r)},configMerge(e,t,r,n){return new Fs(e,t,r,n)},envVar(e,t,r,n){return new ii(e,t,r,n)},fileSystem(e,t,r){return new Ds(e,t,r)},typeGeneration(e,t,r){return new js(e,t,r)},schemaValidation(e,t,r){return new Sr(e,t,r)},browserConfig(e,t,r,n){return new Bs(e,t,r,n)},plugin(e,t,r){return new Us(e,t,r)}};wh=/^https?:\/\//;he=new Nr("bunfig",{showTags:!0});Fn=new Gs;B1=ve(Ar.cwd(),"config"),U1=ve(Ar.cwd(),"src/generated")});import{existsSync as Be,statSync as X0,watch as dc}from"fs";import{unlink as Z0}from"fs/promises";import{dirname as Q0,resolve as Ti}from"path";import ye from"process";var{Glob:ex}=globalThis.Bun;import{EventEmitter as mc}from"events";import Ie from"process";import Oi from"process";import Xr from"process";import Lt from"process";import vt from"process";import Li from"tty";import nu,{stdin as px,stdout as yx}from"process";import{existsSync as lu}from"fs";import qr from"fs/promises";import Mi from"os";import Yr from"path";import Ue from"process";function Jr(e){return e.replace(/[<[].+/,"").trim()}function pc(e){let t=/<([^>]+)>/g,r=/\[([^\]]+)\]/g,n=[],i=(c)=>{let l=!1,a=c[1];if(a.startsWith("..."))a=a.slice(3),l=!0;else if(a.endsWith("..."))a=a.slice(0,-3),l=!0;return{required:c[0].startsWith("<"),value:a.trim(),variadic:l}},o;while(o=t.exec(e))n.push(i(o));let s;while(s=r.exec(e))n.push(i(s));return n}function yc(e){let t={alias:{},boolean:[]};for(let[r,n]of e.entries()){if(n.names.length>1)t.alias[n.names[0]]=n.names.slice(1);if(n.isBoolean)if(n.negated){if(!e.some((o,s)=>s!==r&&o.names.some((c)=>n.names.includes(c))&&typeof o.required==="boolean"))t.boolean.push(n.names[0])}else t.boolean.push(n.names[0])}return t}function Ii(e){return e.reduce((t,r)=>t.length>=r.length?t:r,"")}function Gr(e,t){return e.length>=t?e:`${e}${" ".repeat(t-e.length)}`}function _t(e){return e.replace(/([a-z])-([a-z])/g,(t,r,n)=>r+n.toUpperCase())}function bc(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 xc(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 vc(e){let t=/([^\\/]+)$/.exec(e);return t?t[1]:""}function wt(e){return e.split(".").map((t,r)=>r===0?_t(t):t).join(".")}class $t 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 xc(e){if(e instanceof vt)return!0;return!!e&&typeof e==="object"&&e.name==="ClappError"&&typeof e.message==="string"}function vc(){let{env:e}=Ti,{TERM:t,TERM_PROGRAM:r}=e;if(Ti.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 _t="\x1B",U=`${_t}[`;var Oi={to(e,t){if(!t)return`${U}${e+1}G`;return`${U}${t+1};${e+1}H`},move(e,t){let r="";if(e<0)r+=`${U}${-e}D`;else if(e>0)r+=`${U}${e}C`;if(t<0)r+=`${U}${-t}A`;else if(t>0)r+=`${U}${t}B`;return r},up:(e=1)=>`${U}${e}A`,down:(e=1)=>`${U}${e}B`,forward:(e=1)=>`${U}${e}C`,backward:(e=1)=>`${U}${e}D`,nextLine:(e=1)=>`${U}E`.repeat(e),prevLine:(e=1)=>`${U}F`.repeat(e),left:`${U}G`,hide:`${U}?25l`,show:`${U}?25h`,save:`${_t}7`,restore:`${_t}8`};var ox={screen:`${U}2J`,up:(e=1)=>`${U}1J`.repeat(e),down:(e=1)=>`${U}J`.repeat(e),line:`${U}2K`,lineEnd:`${U}K`,lineStart:`${U}1K`,lines(e){let t="";for(let r=0;r<e;r++)t+=this.line+(r<e-1?Oi.up():"");if(e)t+=Oi.left;return t}},sx={screen:`${_t}c`};function wc(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 Li(e,t,r=2,n=3){return t.map((i)=>({cmd:i,distance:wc(e,i)})).filter(({distance:i})=>i<=r).sort((i,o)=>i.distance-o.distance).slice(0,n).map(({cmd:i})=>i)}function $c(e,t={}){let r={_:[]},n=t.alias||{},i=new Set(t.boolean||[]),o={};for(let l of Object.keys(n))for(let a of n[l])o[a]=l;for(let l of i)if(n[l])for(let a of n[l])i.add(a);function s(l,a){if(l===void 0)return a;if(typeof a==="boolean")return a;return Array.isArray(l)?[...l,a]:[l,a]}function c(l,a){let u=o[l]||l,f=s(r[u],a);if(r[u]=f,n[u])for(let d of n[u])r[d]=f;if(o[l]&&n[o[l]])for(let d of n[o[l]])r[d]=f;r[l]=f}for(let l=0;l<e.length;l++){let a=e[l];if(a==="--"){r._.push(...e.slice(l+1));break}if(a.startsWith("--")){let u=a.indexOf("=");if(u!==-1){let f=It(a.slice(2,u)),d=a.slice(u+1);c(f,d)}else{let f=a.slice(2);if(f.startsWith("no-")){let p=It(f.slice(3));c(p,!1);continue}let d=It(f),h=o[d]||d;if(i.has(h)||i.has(d))c(d,!0);else{let p=e[l+1];if(p!==void 0&&!p.startsWith("-"))c(d,p),l++;else c(d,!0)}}}else if(a.startsWith("-")&&a.length>1){let u=a.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 p=e[l+1];if(p!==void 0&&!p.startsWith("-"))c(d,p),l++;else c(d,!0)}else c(d,!0)}}else r._.push(a)}return r}class Mi{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=qr(e).split(",").map((n)=>{let i=n.trim().replace(/^-{1,2}/,"");if(i.startsWith("no-"))this.negated=!0,i=i.replace(/^no-/,"");return xt(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 lx=Yr.argv,Cc=`${Yr.platform}-${Yr.arch} bun-v${typeof Bun<"u"?Bun.version:"unknown"}`,Ii=Pt.argv,Rc=`${Pt.platform}-${Pt.arch} node-${Pt.version}`;class Jr{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=qr(e);let i=qr(e),o=i.indexOf(":");if(o>0)this.namespace=i.substring(0,o),this.name=i.substring(o+1);if(this.args=gc(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 Mi(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 Xr}get displayName(){return this.namespace?`${this.namespace}:${this.name}`:this.name}hasOption(e){let t=xt(e.split(".")[0]);return!!this.options.find((r)=>r.names.some((n)=>xt(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 a=Ni(t.map((p)=>p.rawName)),u=new Map,f=[];for(let p of t)if(p.namespace){if(!u.has(p.namespace))u.set(p.namespace,[]);u.get(p.namespace).push(p)}else f.push(p);let d="";if(f.sort((p,g)=>p.rawName<g.rawName?-1:p.rawName>g.rawName?1:0),f.length>0)d+=f.map((p)=>` ${Kr(p.rawName,a.length)} ${p.description}`).join(`
65
+ ${this.stack}`;return this.message}}function wc(e){if(e instanceof $t)return!0;return!!e&&typeof e==="object"&&e.name==="ClappError"&&typeof e.message==="string"}function $c(){let{env:e}=Oi,{TERM:t,TERM_PROGRAM:r}=e;if(Oi.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 Mt="\x1B",U=`${Mt}[`;var Pi={to(e,t){if(!t)return`${U}${e+1}G`;return`${U}${t+1};${e+1}H`},move(e,t){let r="";if(e<0)r+=`${U}${-e}D`;else if(e>0)r+=`${U}${e}C`;if(t<0)r+=`${U}${-t}A`;else if(t>0)r+=`${U}${t}B`;return r},up:(e=1)=>`${U}${e}A`,down:(e=1)=>`${U}${e}B`,forward:(e=1)=>`${U}${e}C`,backward:(e=1)=>`${U}${e}D`,nextLine:(e=1)=>`${U}E`.repeat(e),prevLine:(e=1)=>`${U}F`.repeat(e),left:`${U}G`,hide:`${U}?25l`,show:`${U}?25h`,save:`${Mt}7`,restore:`${Mt}8`};var ax={screen:`${U}2J`,up:(e=1)=>`${U}1J`.repeat(e),down:(e=1)=>`${U}J`.repeat(e),line:`${U}2K`,lineEnd:`${U}K`,lineStart:`${U}1K`,lines(e){let t="";for(let r=0;r<e;r++)t+=this.line+(r<e-1?Pi.up():"");if(e)t+=Pi.left;return t}},lx={screen:`${Mt}c`};function Cc(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 Fi(e,t,r=2,n=3){return t.map((i)=>({cmd:i,distance:Cc(e,i)})).filter(({distance:i})=>i<=r).sort((i,o)=>i.distance-o.distance).slice(0,n).map(({cmd:i})=>i)}function Rc(e,t={}){let r={_:[]},n=t.alias||{},i=new Set(t.boolean||[]),o={};for(let l of Object.keys(n))for(let a of n[l])o[a]=l;for(let l of i)if(n[l])for(let a of n[l])i.add(a);function s(l,a){if(l===void 0)return a;if(typeof a==="boolean")return a;return Array.isArray(l)?[...l,a]:[l,a]}function c(l,a){let u=o[l]||l,f=s(r[u],a);if(r[u]=f,n[u])for(let d of n[u])r[d]=f;if(o[l]&&n[o[l]])for(let d of n[o[l]])r[d]=f;r[l]=f}for(let l=0;l<e.length;l++){let a=e[l];if(a==="--"){r._.push(...e.slice(l+1));break}if(a.startsWith("--")){let u=a.indexOf("=");if(u!==-1){let f=_t(a.slice(2,u)),d=a.slice(u+1);c(f,d)}else{let f=a.slice(2);if(f.startsWith("no-")){let p=_t(f.slice(3));c(p,!1);continue}let d=_t(f),h=o[d]||d;if(i.has(h)||i.has(d))c(d,!0);else{let p=e[l+1];if(p!==void 0&&!p.startsWith("-"))c(d,p),l++;else c(d,!0)}}}else if(a.startsWith("-")&&a.length>1){let u=a.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 p=e[l+1];if(p!==void 0&&!p.startsWith("-"))c(d,p),l++;else c(d,!0)}else c(d,!0)}}else r._.push(a)}return r}class Di{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=Jr(e).split(",").map((n)=>{let i=n.trim().replace(/^-{1,2}/,"");if(i.startsWith("no-"))this.negated=!0,i=i.replace(/^no-/,"");return wt(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=Xr.argv,kc=`${Xr.platform}-${Xr.arch} bun-v${typeof Bun<"u"?Bun.version:"unknown"}`,_i=Lt.argv,Sc=`${Lt.platform}-${Lt.arch} node-${Lt.version}`;class Zr{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=Jr(e);let i=Jr(e),o=i.indexOf(":");if(o>0)this.namespace=i.substring(0,o),this.name=i.substring(o+1);if(this.args=pc(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 Di(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 Qr}get displayName(){return this.namespace?`${this.namespace}:${this.name}`:this.name}hasOption(e){let t=wt(e.split(".")[0]);return!!this.options.find((r)=>r.names.some((n)=>wt(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 a=Ii(t.map((p)=>p.rawName)),u=new Map,f=[];for(let p of t)if(p.namespace){if(!u.has(p.namespace))u.set(p.namespace,[]);u.get(p.namespace).push(p)}else f.push(p);let d="";if(f.sort((p,g)=>p.rawName<g.rawName?-1:p.rawName>g.rawName?1:0),f.length>0)d+=f.map((p)=>` ${Gr(p.rawName,a.length)} ${p.description}`).join(`
66
66
  `);let h=Array.from(u.keys()).sort();for(let p of h){let g=u.get(p);if(d.length>0)d+=`
67
67
 
68
68
  `;d+=` ${p}:
69
- `,d+=g.map((m)=>` ${Kr(m.rawName,a.length-2)} ${m.description}`).join(`
70
- `)}o.push({title:"Commands",body:d}),o.push({body:`Run \`${e} <command> --help\` for command details.`})}let c=new Set(this.options.flatMap((a)=>a.names)),l=this.isGlobalCommand?n:[...this.options,...(n||[]).filter((a)=>!a.names.some((u)=>c.has(u)))];if(!this.isGlobalCommand&&!this.isDefaultCommand)l=l.filter((a)=>a.name!=="version");if(l.length>0){let a=Ni(l.map((u)=>u.rawName));o.push({title:"Options",body:l.map((u)=>` ${Kr(u.rawName,a.length)} ${u.description} ${u.config.default===void 0?"":`(default: ${u.config.default})`}`).join(`
69
+ `,d+=g.map((m)=>` ${Gr(m.rawName,a.length-2)} ${m.description}`).join(`
70
+ `)}o.push({title:"Commands",body:d}),o.push({body:`Run \`${e} <command> --help\` for command details.`})}let c=new Set(this.options.flatMap((a)=>a.names)),l=this.isGlobalCommand?n:[...this.options,...(n||[]).filter((a)=>!a.names.some((u)=>c.has(u)))];if(!this.isGlobalCommand&&!this.isDefaultCommand)l=l.filter((a)=>a.name!=="version");if(l.length>0){let a=Ii(l.map((u)=>u.rawName));o.push({title:"Options",body:l.map((u)=>` ${Gr(u.rawName,a.length)} ${u.description} ${u.config.default===void 0?"":`(default: ${u.config.default})`}`).join(`
71
71
  `)})}if(this.examples.length>0)o.push({title:"Examples",body:this.examples.map((a)=>{if(typeof a==="function")return a(e);return a}).join(`
72
72
  `)});if(i)o=i(o)||o;console.log(o.map((a)=>a.title?`${a.title}:
73
73
  ${a.body}`:a.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"?Cc:Rc}`)}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 vt(`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"?kc:Sc}`)}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 $t(`Missing required argument${r.length>1?"s":""}: ${n}
76
76
 
77
- Run \`${this.cli.name} ${this.rawName} --help\` for usage information.`,this.usageLine)}}checkUnknownOptions(){let{options:e,globalCommand:t}=this.cli;if(!this.config.allowUnknownOptions){for(let r of Object.keys(e))if(r!=="--"&&!this.hasOption(r)&&!t.hasOption(r)){let i=[...t.options,...this.options].flatMap((a)=>a.names),o=xt(r.split(".")[0]),s=r.length>1?`--${r}`:`-${r}`,c=Li(o,i),l=`Unknown option \`${s}\``;if(c.length>0)l+=`
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((a)=>a.names),o=wt(r.split(".")[0]),s=r.length>1?`--${r}`:`-${r}`,c=Fi(o,i),l=`Unknown option \`${s}\``;if(c.length>0)l+=`
78
78
 
79
79
  Did you mean one of these?`,c.forEach((a)=>{let u=a.length>1?`--${a}`:`-${a}`;l+=`
80
80
  \u2022 ${u}`});throw l+=`
81
81
 
82
- Run \`${this.cli.name} ${this.rawName} --help\` to see available options.`,new vt(l,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 vt(`Option \`${n.rawName}\` requires a value.
82
+ Run \`${this.cli.name} ${this.rawName} --help\` to see available options.`,new $t(l,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 $t(`Option \`${n.rawName}\` requires a value.
83
83
 
84
- Example: ${this.cli.name} ${this.rawName} ${n.rawName} <value>`,this.usageLine)}}}}class Xr extends Jr{constructor(e){super("@@global@@","",{},e)}}var kc=Jr,Ie={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 pt={primary:"blue",secondary:"cyan",success:"green",warning:"yellow",error:"red",info:"magenta",muted:"gray"};function Sc(){return!0}function Ac(){let e={};e.supportsColor=Sc();function t(n,i=[]){let o=n===""?[]:[...i,n],s=function(l){if(!e.supportsColor)return l;let a="",u="";for(let f of o)if(f in pt&&pt[f]in Ie){let d=pt[f];a+=Ie[d][0],u=Ie[d][1]+u}else if(f in Ie)a+=Ie[f][0],u=Ie[f][1]+u;return a+l+u},c=[...Object.keys(Ie),...Object.keys(pt)];for(let l of c)if(!(l in s))Object.defineProperty(s,l,{get(){return t(l,o)}});return s}let r=[...Object.keys(Ie),...Object.keys(pt)];for(let n of r)if(!(n in e))Object.defineProperty(e,n,{get(){return t(n)}});return e}var yt=Ac();class Zr extends hc{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 Xr(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 Qr extends Zr{constructor(e){super("@@global@@","",{},e)}}var Ac=Zr,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 bt={primary:"blue",secondary:"cyan",success:"green",warning:"yellow",error:"red",info:"magenta",muted:"gray"};function Ec(){return!0}function Tc(){let e={};e.supportsColor=Ec();function t(n,i=[]){let o=n===""?[]:[...i,n],s=function(l){if(!e.supportsColor)return l;let a="",u="";for(let f of o)if(f in bt&&bt[f]in Pe){let d=bt[f];a+=Pe[d][0],u=Pe[d][1]+u}else if(f in Pe)a+=Pe[f][0],u=Pe[f][1]+u;return a+l+u},c=[...Object.keys(Pe),...Object.keys(bt)];for(let l of c)if(!(l in s))Object.defineProperty(s,l,{get(){return t(l,o)}});return s}let r=[...Object.keys(Pe),...Object.keys(bt)];for(let n of r)if(!(n in e))Object.defineProperty(e,n,{get(){return t(n)}});return e}var xt=Tc();class en extends mc{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 Qr(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)}Oe.exit(0)};return Oe.on("SIGINT",()=>t("SIGINT")),Oe.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 kc(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(yt.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 Ac(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(xt.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=Li(e,t);if(r.length>0)console.log(yt.yellow("Did you mean one of these?")),r.forEach((n)=>console.log(` ${yt.dim("\u2022")} ${this.name} ${n}`)),console.log("")}console.log(yt.dim("Run"),`${this.name} --help`,yt.dim("to see all available commands")),Oe.exit(1)}async parse(e=Ii,t={}){let{run:r=!0,exitOnError:n=!1}=t;if(n)try{return await this.parse(e,{run:r})}catch(l){throw this.handleUsageError(l),l}if(this.rawArgs=e,!this.name)this.name=e[1]?bc(e[1]):"cli";let i=!0,o=e.slice(2),s=o[0];if(s&&!s.startsWith("-")){for(let l of this.commands)if(l.isMatched(s)){let a=this.mri(o,l);i=!1;let u={...a,args:a.args.slice(1)};this.setParsedInfo(u,l,s),this.emit(`command:${s}`,l);break}if(i){let l=o[1];if(l&&!l.startsWith("-")){let a=`${s}:${l}`;for(let u of this.commands)if(u.isMatched(a)){let f=this.mri(o,u);i=!1;let d={...f,args:f.args.slice(2)};this.setParsedInfo(d,u,a),this.emit(`command:${a}`,u);break}}}}if(i){for(let l of this.commands)if(l.name===""){i=!1;let a=this.mri(o,l);this.setParsedInfo(a,l),this.emit("command:!",l);break}}if(i){let l=this.mri(e.slice(2));this.setParsedInfo(l)}if(this.options.verbose)this.isVerbose=!0;if(this.options.quiet)this.isQuiet=!0;if(this.options.debug)this.isDebug=!0;if(this.options.noInteraction||this.options.interaction===!1)this.isNoInteraction=!0;if(this.options.env)this.environment=String(this.options.env);if(this.options.dryRun)this.isDryRun=!0;if(this.options.force)this.isForce=!0;if(this.options.noEmoji||this.options.emoji===!1)this.useEmoji=!1;if(this.options.theme)this.theme=String(this.options.theme);if(this.options.noCache||this.options.cache===!1)this.isNoCache=!0;if(this.options.help&&this.showHelpOnExit)this.outputHelp(),r=!1,this.unsetMatchedCommand();if(this.options.version&&this.showVersionOnExit&&this.matchedCommandName==null)this.outputVersion(),r=!1,this.unsetMatchedCommand();let c={args:this.args,options:this.options};if(r)await this.runMatchedCommand();if(!this.matchedCommand&&this.args[0]){if(this.emit("command:*"),!(this.listenerCount("command:*")>0))this.showCommandNotFound(this.args[0])}return c}mri(e,t){let r=[...this.globalCommand.options,...t?t.options:[]],n=mc(r),i=[],o=e.indexOf("--");if(o>-1)i=e.slice(o+1),e=e.slice(0,o);let s=$c(e,n),c={_:s._};for(let d of Object.keys(s))if(d!=="_")c[xt(d)]=s[d];let l=c._,a={"--":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)a[h]=d.config.default;if(Array.isArray(d.config.type)){if(f[d.name]===void 0)f[d.name]={shouldTransform:!0,transformFunction:d.config.type[0]}}}for(let d of Object.keys(c))if(d!=="_"){let h=d.split(".");pc(a,h,c[d]),yc(a,f)}for(let d of r){if(!d.variadic)continue;for(let h of d.names){let p=a[h];if(p===void 0||Array.isArray(p))continue;if(d.config.default!==void 0&&p===d.config.default)continue;a[h]=[p]}}return{args:l,options:a}}async run(e=Ii){return this.parse(e,{run:!0,exitOnError:!0})}handleUsageError(e){if(!xc(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=Fi(e,t);if(r.length>0)console.log(xt.yellow("Did you mean one of these?")),r.forEach((n)=>console.log(` ${xt.dim("\u2022")} ${this.name} ${n}`)),console.log("")}console.log(xt.dim("Run"),`${this.name} --help`,xt.dim("to see all available commands")),Ie.exit(1)}async parse(e=_i,t={}){let{run:r=!0,exitOnError:n=!1}=t;if(n)try{return await this.parse(e,{run:r})}catch(l){throw this.handleUsageError(l),l}if(this.rawArgs=e,!this.name)this.name=e[1]?vc(e[1]):"cli";let i=!0,o=e.slice(2),s=o[0];if(s&&!s.startsWith("-")){for(let l of this.commands)if(l.isMatched(s)){let a=this.mri(o,l);i=!1;let u={...a,args:a.args.slice(1)};this.setParsedInfo(u,l,s),this.emit(`command:${s}`,l);break}if(i){let l=o[1];if(l&&!l.startsWith("-")){let a=`${s}:${l}`;for(let u of this.commands)if(u.isMatched(a)){let f=this.mri(o,u);i=!1;let d={...f,args:f.args.slice(2)};this.setParsedInfo(d,u,a),this.emit(`command:${a}`,u);break}}}}if(i){for(let l of this.commands)if(l.name===""){i=!1;let a=this.mri(o,l);this.setParsedInfo(a,l),this.emit("command:!",l);break}}if(i){let l=this.mri(e.slice(2));this.setParsedInfo(l)}if(this.options.verbose)this.isVerbose=!0;if(this.options.quiet)this.isQuiet=!0;if(this.options.debug)this.isDebug=!0;if(this.options.noInteraction||this.options.interaction===!1)this.isNoInteraction=!0;if(this.options.env)this.environment=String(this.options.env);if(this.options.dryRun)this.isDryRun=!0;if(this.options.force)this.isForce=!0;if(this.options.noEmoji||this.options.emoji===!1)this.useEmoji=!1;if(this.options.theme)this.theme=String(this.options.theme);if(this.options.noCache||this.options.cache===!1)this.isNoCache=!0;if(this.options.help&&this.showHelpOnExit)this.outputHelp(),r=!1,this.unsetMatchedCommand();if(this.options.version&&this.showVersionOnExit&&this.matchedCommandName==null)this.outputVersion(),r=!1,this.unsetMatchedCommand();let c={args:this.args,options:this.options};if(r)await this.runMatchedCommand();if(!this.matchedCommand&&this.args[0]){if(this.emit("command:*"),!(this.listenerCount("command:*")>0))this.showCommandNotFound(this.args[0])}return c}mri(e,t){let r=[...this.globalCommand.options,...t?t.options:[]],n=yc(r),i=[],o=e.indexOf("--");if(o>-1)i=e.slice(o+1),e=e.slice(0,o);let s=Rc(e,n),c={_:s._};for(let d of Object.keys(s))if(d!=="_")c[wt(d)]=s[d];let l=c._,a={"--":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)a[h]=d.config.default;if(Array.isArray(d.config.type)){if(f[d.name]===void 0)f[d.name]={shouldTransform:!0,transformFunction:d.config.type[0]}}}for(let d of Object.keys(c))if(d!=="_"){let h=d.split(".");bc(a,h,c[d]),xc(a,f)}for(let d of r){if(!d.variadic)continue;for(let h of d.names){let p=a[h];if(p===void 0||Array.isArray(p))continue;if(d.config.default!==void 0&&p===d.config.default)continue;a[h]=[p]}}return{args:l,options:a}}async run(e=_i){return this.parse(e,{run:!0,exitOnError:!0})}handleUsageError(e){if(!wc(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
- Run \`${this.name??"cli"} --help\` for usage.`;Oe.stderr.write(`${r}${t}${n}
91
- `),Oe.exit(e.exitCode??2)}async runMatchedCommand(){let{args:e,options:t,matchedCommand:r}=this;if(!r||!r.commandAction)return;r.checkUnknownOptions(),r.checkOptionValue(),r.checkRequiredArgs();let n=[];r.args.forEach((c,l)=>{if(c.variadic)n.push(e.slice(l));else n.push(e[l])}),n.push(t);let i={command:r,args:n,options:t};for(let c of r.beforeHooks)await c(i);let o,s=async()=>{let c=r.commandAction.apply(this,n);if(c instanceof Promise)o=await c;else o=c;return o};if(r.middleware.length>0){let c=0,l=async()=>{if(c<r.middleware.length){let a=r.middleware[c++];await a({...i,next:l})}else await s()};await l()}else await s();for(let c of r.afterHooks)await c(i);return o}removeSignalHandlers(){if(!this.signalHandlersSet)return this;return Oe.removeAllListeners("SIGINT"),Oe.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 Fi{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 ux=new Fi;function Ec(){if("FORCE_COLOR"in bt.env)return bt.env.FORCE_COLOR!=="0";if("NO_COLOR"in bt.env||bt.env.TERM==="dumb")return!1;if(bt.platform==="win32")return!0;return Pi.isatty(1)&&Pi.isatty(2)}var Di=Ec();function D(e,t){if(!Di)return(r)=>r;return(r)=>e+r+t}var Tc=D("\x1B[0m","\x1B[0m"),Nc=D("\x1B[31m","\x1B[39m"),Oc=D("\x1B[32m","\x1B[39m"),Ic=D("\x1B[33m","\x1B[39m"),Pc=D("\x1B[34m","\x1B[39m"),_c=D("\x1B[35m","\x1B[39m"),Lc=D("\x1B[36m","\x1B[39m"),Mc=D("\x1B[37m","\x1B[39m"),Fc=D("\x1B[90m","\x1B[39m"),Dc=D("\x1B[1m","\x1B[22m"),jc=D("\x1B[3m","\x1B[23m"),Bc=D("\x1B[4m","\x1B[24m"),Uc=D("\x1B[2m","\x1B[22m"),Wc=D("\x1B[7m","\x1B[27m"),Vc=D("\x1B[8m","\x1B[28m"),zc=D("\x1B[9m","\x1B[29m"),Kc=D("\x1B[41m","\x1B[49m"),Hc=D("\x1B[42m","\x1B[49m"),Gc=D("\x1B[43m","\x1B[49m"),qc=D("\x1B[44m","\x1B[49m"),Yc=D("\x1B[45m","\x1B[49m"),Jc=D("\x1B[46m","\x1B[49m"),Xc=D("\x1B[47m","\x1B[49m"),Zc=Di,Qc={reset:Tc,red:Nc,green:Oc,yellow:Ic,blue:Pc,magenta:_c,cyan:Lc,white:Mc,gray:Fc,bold:Dc,italic:jc,underline:Bc,dim:Uc,inverse:Wc,hidden:Vc,strikethrough:zc,bgRed:Kc,bgGreen:Hc,bgYellow:Gc,bgBlue:qc,bgMagenta:Yc,bgCyan:Jc,bgWhite:Xc,isColorSupported:Zc},eu=Qc,ru=["up","down","left","right","space","enter","cancel"],px={actions:new Set(ru),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"}};var yx=tu.platform.startsWith("win"),bx=Symbol("clapp:cancel");var nu=vc();var M=(e,t)=>nu?e:t,xx=M("\u25C6","*"),vx=M("\u25A0","x"),wx=M("\u25B2","x"),$x=M("\u25C7","o"),Cx=M("\u250C","T"),iu=M("\u2502","|"),Rx=M("\u2514","\u2014"),kx=M("\u25CF",">"),Sx=M("\u25CB"," "),Ax=M("\u25FB","[\u2022]"),Ex=M("\u25FC","[+]"),Tx=M("\u25FB","[ ]"),Nx=M("\u25AA","\u2022"),Ox=M("\u2500","-"),Ix=M("\u256E","+"),Px=M("\u251C","+"),_x=M("\u256F","+"),Lx=M("\u25CF","\u2022"),Mx=M("\u25C6","*"),Fx=M("\u25B2","!"),Dx=M("\u25A0","x");var jx={light:M("\u2500","-"),heavy:M("\u2501","="),block:M("\u2588","#")};function ou(){return`${eu.gray(iu)} `}var Bx=ou();class ji{configPath;config=null;events=[];retryCount=0;maxRetries=3;retryDelayMs=1000;constructor(){let e=_i.homedir(),t=Gr.join(e,".config","clapp");this.configPath=Gr.join(t,"telemetry.json")}async isEnabled(){if(Be.env.DO_NOT_TRACK==="1"||Be.env.DO_NOT_TRACK==="true")return!1;if(Be.env.NO_TELEMETRY==="1"||Be.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:_i.platform(),nodeVersion:Be.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:Be.env.DO_NOT_TRACK==="1"||Be.env.DO_NOT_TRACK==="true",eventsQueued:this.events.length,lastSent:e.lastSent}}async loadConfig(){if(this.config)return this.config;try{if(su(this.configPath)){let e=await Hr.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=Gr.dirname(this.configPath);await Hr.mkdir(t,{recursive:!0}),await Hr.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 Hx=new ji;var Qr="0.3.11";function ye(e){return{prev:null,next:null,data:e}}class ae{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 ye(e)}createItem(e){return ye(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=ye(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 ae,r=null,n=0;for(let i=this.head;i!=null;i=i.next){let o=ye(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 ae,r=null,n=0;for(let i=this.head;i!=null;i=i.next)if(e(i.data,n++,this)){let o=ye(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 ae,t=null;for(let r=this.head;r!=null;r=r.next){let n=ye(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(ye(e),this.head)}append(e){return this.insert(e,null)}appendData(e){return this.insert(ye(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(ye(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(ye(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 ae)this.insertList(t,e),this.remove(e);else this.insert(t,e),this.remove(e)}}function Z(e){switch(e.type){case"StyleSheet":return ie(e.children,"");case"Rule":return`${Z(e.prelude)}{${Z(e.block)}}`;case"Block":return lu(e.children);case"Atrule":{let t=`@${e.name}`;if(e.prelude){let r=Z(e.prelude);if(r)t+=` ${r}`}if(e.block)t+=`{${Z(e.block)}}`;else t+=";";return t}case"AtrulePrelude":return ie(e.children,"");case"SelectorList":return ie(e.children,",");case"Selector":return ie(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+=`"${en(e.value.value)}"`;else t+=e.value.name;if(e.flags)t+=` ${e.flags}`;return t+="]",t}case"PseudoClassSelector":return e.children?`:${e.name}(${ie(e.children,"")})`:`:${e.name}`;case"PseudoElementSelector":return e.children?`::${e.name}(${ie(e.children,"")})`:`::${e.name}`;case"Combinator":return e.name===" "?" ":e.name;case"Declaration":return`${e.property}:${Z(e.value)}${e.important?"!important":""}`;case"DeclarationList":return ie(e.children,";");case"Value":return ie(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`"${en(e.value)}"`;case"Url":return/[\s"'()\\\u0000-\u001F\u007F]/.test(e.value)?`url("${en(e.value)}")`:`url(${e.value})`;case"Hash":return`#${e.name}`;case"Operator":return e.value;case"Function":return`${e.name}(${ie(e.children,"")})`;case"Parentheses":return`(${ie(e.children,"")})`;case"Brackets":return`[${ie(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?`${Z(e.nth)} of ${Z(e.selector)}`:Z(e.nth);case"MediaQueryList":return ie(e.children,",");case"MediaQuery":return ie(e.children,"");case"MediaFeature":{let t=`(${e.name}`;if(e.value)t+=`:${Z(e.value)}`;return t+=")",t}}return""}function ie(e,t){let r="",n=!0,i=null,o=e.head;while(o!=null){let s=o.data;if(s.type==="WhiteSpace"){let l=o.next?o.next.data:null;if(Bi(i)||Bi(l)){o=o.next;continue}}let c=Z(s);if(!c){o=o.next;continue}if(!n&&t&&!uu(i))r+=t;n=!1,r+=c,i=s,o=o.next}return r}function lu(e){let t="",r=null,n=e.head;while(n!=null){let i=n.data,o=Z(i);if(!o){n=n.next;continue}if(r&&cu(r,i))t+=";";t+=o,r=i,n=n.next}return t}function cu(e,t){return e.type==="Declaration"&&t.type!=="Comment"}function Bi(e){if(!e||e.type!=="Operator")return!1;let t=e.value;return t===":"||t===","||t==="/"}function uu(e){if(!e)return!1;return e.type==="Operator"||e.type==="Combinator"}function en(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 ue(e){return e<128&&(We[e]&2)!==0}function wt(e){return e<128&&(We[e]&4)!==0}function Ui(e){return e>=128||e<128&&(We[e]&8)!==0}function fu(e){return e===45||e>=128||e<128&&(We[e]&10)!==0}function du(e){return e>=0&&e<=8||e===11||e>=14&&e<=31||e===127}function rn(e){return e<128&&(We[e]&16)!==0}function Ce(e){return e<128&&(We[e]&1)!==0}function Ue(e,t){if(e!==92)return!1;if(rn(t))return!1;return!0}function tn(e,t,r){if(e===45)return Ui(t)||t===45||Ue(t,r);if(Ui(e))return!0;if(e===92)return Ue(e,t);return!1}function hu(e,t,r){if(e===43||e===45){if(ue(t))return!0;if(t===46&&ue(r))return!0;return!1}if(e===46)return ue(t);return ue(e)}class Lt{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=gu(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(Ce(n)){let s=t;while(t<r&&Ce(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&&(fu(e.charCodeAt(t+1))||Ue(e.charCodeAt(t+1),e.charCodeAt(t+2)))){let s=t;t++,t=this.consumeName(t),this.addToken(4,s,t);continue}this.addToken(9,t,t+1),t++;continue}switch(n){case 40:this.addToken(21,t,t+1),t++;continue;case 41:this.addToken(22,t,t+1),t++;continue;case 91:this.addToken(19,t,t+1),t++;continue;case 93:this.addToken(20,t,t+1),t++;continue;case 123:this.addToken(23,t,t+1),t++;continue;case 125:this.addToken(24,t,t+1),t++;continue;case 44:this.addToken(18,t,t+1),t++;continue;case 58:this.addToken(16,t,t+1),t++;continue;case 59:this.addToken(17,t,t+1),t++;continue}if(n===60&&e.startsWith("!--",t+1)){this.addToken(14,t,t+4),t+=4;continue}if(n===45&&e.startsWith("->",t+1)){this.addToken(15,t,t+3),t+=3;continue}if(n===64){let s=e.charCodeAt(t+1),c=e.charCodeAt(t+2),l=e.charCodeAt(t+3);if(tn(s,c,l)){let a=t;t++,t=this.consumeName(t),this.addToken(3,a,t);continue}this.addToken(9,t,t+1),t++;continue}let i=e.charCodeAt(t+1),o=e.charCodeAt(t+2);if(hu(n,i,o)){t=this.consumeNumeric(t);continue}if(tn(n,i,o)){t=this.consumeIdentLike(t);continue}if(n===92){if(Ue(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(rn(o))return this.addToken(6,t,i),i;if(o===92){let s=r.charCodeAt(i+1);if(rn(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(wt(r)){let n=1;e++;while(n<6&&e<t.length&&wt(t.charCodeAt(e)))e++,n++;if(e<t.length&&Ce(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&&Ue(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&&ue(t.charCodeAt(r)))r++;if(t.charCodeAt(r)===46&&ue(t.charCodeAt(r+1))){r+=2;while(r<t.length&&ue(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(ue(i)){r+=2;while(r<t.length&&ue(t.charCodeAt(r)))r++}else if((i===43||i===45)&&ue(o)){r+=3;while(r<t.length&&ue(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(tn(n,i,o)){let s=this.consumeName(r);return this.addToken(12,e,s),s}if(n===37)return this.addToken(11,e,r+1),r+1;return this.addToken(10,e,r),r}consumeIdentLike(e){let t=this.source,r=this.consumeName(e),n=t.charCodeAt(r);if(n===40&&r-e===3){let i=t.charCodeAt(e)|32,o=t.charCodeAt(e+1)|32,s=t.charCodeAt(e+2)|32;if(i===117&&o===114&&s===108){let c=r+1;while(c<t.length&&Ce(t.charCodeAt(c)))c++;let l=t.charCodeAt(c);if(l===34||l===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&&Ce(r.charCodeAt(i)))i++;while(i<n){let o=r.charCodeAt(i);if(o===41)return i++,this.addToken(7,e,i),i;if(Ce(o)){let s=i;while(i<n&&Ce(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||du(o))return this.consumeBadUrl(e,i);if(o===92){if(Ue(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&&Ue(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 gu(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 nn(e,t,r){for(let n=t;n<r;n++)if(e.charCodeAt(n)===92)return mu(e,t,r,n);return e.slice(t,r)}function mu(e,t,r,n){let i=e.slice(t,n),o=n;while(o<r){if(e.charCodeAt(o)!==92){i+=e[o],o++;continue}if(o+1>=r){o++;continue}let c=e.charCodeAt(o+1);if(c===10){o+=2;continue}if(c===13){o+=e.charCodeAt(o+2)===10?3:2;continue}if(wt(c)){let l=o+1,a="";while(a.length<6&&l<r&&wt(e.charCodeAt(l)))a+=e[l],l++;let u=Number.parseInt(a,16);if(l<r&&Ce(e.charCodeAt(l)))l++;i+=u===0||u>=55296&&u<=57343||u>1114111?String.fromCodePoint(65533):String.fromCodePoint(u),o=l;continue}i+=e[o+1],o+=2}return i}function on(e,t,r){for(let n=t;n<r;n++)if(e.charCodeAt(n)===92)return pu(e,t,r,n);return e.slice(t,r)}function pu(e,t,r,n){let i=e.slice(t,n),o=n;while(o<r){if(e.charCodeAt(o)!==92){i+=e[o],o++;continue}let c=o+1,l="";while(l.length<6&&c<r&&wt(e.charCodeAt(c)))l+=e[c],c++;if(l.length>0){let a=Number.parseInt(l,16);if(c<r&&Ce(e.charCodeAt(c)))c++;i+=a===0||a>=55296&&a<=57343||a>1114111?String.fromCodePoint(65533):String.fromCodePoint(a),o=c;continue}if(c<r){i+=e[c],o=c+1;continue}i+=String.fromCodePoint(65533),o=c}return i}function qi(e,t){let r=new Lt(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 be(e,t){return e.source.slice(t.start,t.end)}function fe(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 Wi(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 Yi(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 Mt(e,t,r,n){return{type:"Raw",value:e,loc:k(n,t,r)}}function ee(){return new ae}function sn(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 Dt(e,t={}){let r=qi(e,t);switch(t.context??"stylesheet"){case"stylesheet":return Ki(r);case"atrule":return jt(r)??Vi(r);case"atrulePrelude":return vu(r);case"mediaQuery":case"mediaQueryList":return zi(r);case"rule":return ln(r);case"selectorList":return fn(r);case"selector":return Qi(r);case"block":return cn(r);case"declarationList":return Cu(r);case"declaration":return un(r)??Vi(r);case"value":return Ru(r);case"raw":return zi(r);default:return Ki(r)}}function Vi(e){return{type:"StyleSheet",children:ee(),loc:Yi(e)}}function zi(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 Ki(e){let t=w(e),r=ee(),{types:n,end:i}=e;while(e.pos<i){let c=n[e.pos];if(c===13){e.pos++;continue}if(c===25){let u={type:25,start:e.starts[e.pos],end:e.ends[e.pos]},f=an(e,u);e.pos++,r.appendData(f);continue}if(c===0)break;if(c===14||c===15){e.pos++;continue}if(c===3){let u=jt(e);if(u)r.appendData(u);continue}if(c===24){e.pos++;continue}let l=e.pos,a=ln(e);if(r.appendData(a),e.pos===l)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 an(e,t){return{type:"Comment",value:e.source.slice(t.start+2,t.end-2),loc:k(e,t,t)}}function jt(e){let t=w(e);if(t.type!==3)return null;e.pos++;let r=Ft(e.source,t.start+1,t.end);fe(e);let n=e.pos,i=w(e),{types:o,end:s}=e,c=n,l=n;while(c<s){let f=o[c];if(f===0||f===17||f===23)break;if(f!==13&&f!==25)l=c+1;c++}let a=null;if(l>n){let f=e.starts[n],d=e.ends[l-1],h={type:o[l-1],start:e.starts[l-1],end:d},p=e.source.slice(f,d).trim();if(p.length>0)if(e.parseAtrulePrelude)try{let g=e.end;e.end=l,e.pos=n;let m=ee();while(x(e)!==0){let y=Ve(e);if(y)m.appendData(y)}if(Xi(m),e.end=g,e.pos=c,m.isEmpty)a=Mt(p,i,h,e);else a={type:"AtrulePrelude",children:m,loc:null}}catch(g){let m=Mt(p,i,h,e);sn(e,`Failed to parse @${r} prelude: ${g.message}`,i,m),a=m,e.pos=c}else a=Mt(p,i,h,e),e.pos=c;else e.pos=c}else e.pos=c;let u=null;if(x(e)===17)C(e);else if(x(e)===23)u=cn(e,xu.has(r));return{type:"Atrule",name:r,prelude:a,block:u,loc:k(e,t,w(e))}}var bu=new Set(["is","not","where","has","matches","-moz-any","-webkit-any"]),xu=new Set(["media","supports","document","layer","container","scope","starting-style","-moz-document","keyframes","-webkit-keyframes","-moz-keyframes","-o-keyframes"]);function vu(e){let t=w(e),r=ee();while(x(e)!==0){if(w(e).type===13){e.pos++;continue}let i=Ve(e);if(i)r.appendData(i)}return{type:"AtrulePrelude",children:r,loc:k(e,t,w(e))}}function ln(e){let t=w(e),r;if(e.parseRulePrelude)r=fn(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=Mt(s,i,o,e)}let n=cn(e,!0);return{type:"Rule",prelude:r,block:n,loc:k(e,t,w(e))}}function cn(e,t=!1){let r=w(e);if(x(e)!==23)return{type:"Block",children:ee(),loc:Yi(e)};e.pos++;let n=ee(),{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 l={type:25,start:e.starts[e.pos],end:e.ends[e.pos]};e.pos++,n.appendData(an(e,l));continue}if(s===3){let l=jt(e);if(l)n.appendData(l);continue}if(t&&wu(e,$u)){let l=ln(e);n.appendData(l);continue}let c=un(e);if(c)n.appendData(c);if(e.pos<o&&i[e.pos]===17)e.pos++}if(x(e)===24)e.pos++;return{type:"Block",children:n,loc:k(e,r,w(e))}}function wu(e,t){let r=e.pos,n=t(e);return e.pos=r,n}function $u(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 Cu(e){let t=w(e),r=ee();while(x(e)!==0&&x(e)!==24){let n=w(e);if(n.type===13){e.pos++;continue}if(n.type===25){r.appendData(an(e,C(e)));continue}if(n.type===17){e.pos++;continue}if(n.type===3){let o=jt(e);if(o)r.appendData(o);continue}let i=un(e);if(i)r.appendData(i);if(x(e)===17)C(e)}return{type:"DeclarationList",children:r,loc:k(e,t,w(e))}}function un(e){fe(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{sn(e,"Expected property name",t,{type:"Raw",value:"",loc:null});let{types:R,end:P}=e;while(e.pos<P){let L=R[e.pos];if(L===0||L===17||L===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(Wi(e),x(e)!==16){sn(e,`Expected ':' after property "${i}"`,w(e),{type:"Raw",value:"",loc:null});let{types:R,end:P}=e;while(e.pos<P){let L=R[e.pos];if(L===0||L===17||L===24)break;e.pos++}return null}e.pos++,Wi(e);let{types:o,starts:s,end:c,pos:l}=e,a=l,u=l,f=-1,d=-1;while(a<c){let R=o[a];if(R===0||R===17||R===24)break;if(R===9&&e.source.charCodeAt(s[a])===33){let P=a+1;while(P<c&&o[P]===13)P++;if(P<c&&o[P]===1){let L=s[P];if(e.ends[P]-L===9&&(e.source.charCodeAt(L)|32)===105&&(e.source.charCodeAt(L+1)|32)===109&&(e.source.charCodeAt(L+2)|32)===112&&(e.source.charCodeAt(L+3)|32)===111&&(e.source.charCodeAt(L+4)|32)===114&&(e.source.charCodeAt(L+5)|32)===116&&(e.source.charCodeAt(L+6)|32)===97&&(e.source.charCodeAt(L+7)|32)===110&&(e.source.charCodeAt(L+8)|32)===116){d=a,f=P,a=P+1;continue}}}if(R!==13&&R!==25)u=a+1;a++}let h=u,p=f>=0?{type:1,start:s[f],end:e.ends[f]}:null,g=i.startsWith("--"),m,y=s[l],b=h>l?e.ends[h-1]:y,v={type:o[l],start:y,end:e.ends[l]},A=h>l?{type:o[h-1],start:s[h-1],end:b}:v;if(g&&!e.parseCustomProperty||!e.parseValue)m={type:"Raw",value:e.source.slice(y,b).trim(),loc:k(e,v,A)};else if(h===l)m={type:"Value",children:ee(),loc:k(e,v,A)};else{let R=e.end;e.end=h,e.pos=l,m=Ji(e),e.end=R}return e.pos=a,{type:"Declaration",property:i,important:p?!0:!1,value:m,loc:k(e,t,w(e))}}function Ru(e){return Ji(e)}function Ji(e){let t=w(e),r=ee();while(x(e)!==0&&x(e)!==17&&x(e)!==24&&x(e)!==22&&x(e)!==20){let n=Ve(e);if(n)r.appendData(n)}return Zi(r),{type:"Value",children:r,loc:k(e,t,w(e))}}function Xi(e){for(let t of e)if("children"in t&&t.children instanceof ae)Xi(t.children);Zi(e)}function Zi(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 Ve(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:Q(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?Q(e,n,i):null};case 10:return e.pos++,{type:"Number",value:o.slice(n,i),loc:e.positions?Q(e,n,i):null};case 11:return e.pos++,{type:"Percentage",value:o.slice(n,i-1),loc:e.positions?Q(e,n,i):null};case 12:{e.pos++;let s=n,c=o.charCodeAt(s);if(c===43||c===45)s++;let l=!1;while(s<i){let u=o.charCodeAt(s);if(u>=48&&u<=57){s++;continue}if(u===46&&!l){l=!0,s++;continue}break}let a=o.charCodeAt(s);if(a===69||a===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?Q(e,n,i):null}}case 1:return e.pos++,{type:"Identifier",name:on(o,n,i),loc:e.positions?Q(e,n,i):null};case 5:{e.pos++;let s=n+1,l=i-n>=2&&o.charCodeAt(i-1)===o.charCodeAt(n)?i-1:i;return{type:"String",value:nn(o,s,l),loc:e.positions?Q(e,n,i):null}}case 7:{e.pos++;let s=n+4;while(s<i&&Hi(o.charCodeAt(s)))s++;let c=i;if(c>s&&o.charCodeAt(c-1)===41)c--;while(c>s&&Hi(o.charCodeAt(c-1)))c--;let l;if(c-s>=2){let a=o.charCodeAt(s),u=o.charCodeAt(c-1);if((a===34||a===39)&&a===u)l=o.slice(s+1,c-1);else l=o.slice(s,c)}else l=o.slice(s,c);return{type:"Url",value:l,loc:e.positions?Q(e,n,i):null}}case 4:return e.pos++,{type:"Hash",name:o.slice(n+1,i),loc:e.positions?Q(e,n,i):null};case 2:return Su(e);case 21:return Au(e);case 18:return e.pos++,{type:"Operator",value:",",loc:e.positions?Q(e,n,i):null};case 16:return e.pos++,{type:"Operator",value:":",loc:e.positions?Q(e,n,i):null};case 9:{e.pos++;let s=o.charCodeAt(n),c=o[n];if(ku(s))return{type:"Operator",value:c,loc:e.positions?Q(e,n,i):null};return{type:"Identifier",name:c,loc:e.positions?Q(e,n,i):null}}case 19:{e.pos++;let s=ee();while(x(e)!==0&&x(e)!==20){let l=Ve(e);if(l)s.appendData(l)}let c=e.pos<e.end?e.ends[e.pos]:i;if(x(e)===20)e.pos++;return{type:"Brackets",children:s,loc:e.positions?Q(e,n,c):null}}case 3:case 23:case 24:case 22:case 20:case 17:case 0:case 14:case 15:case 6:case 8:return e.pos++,{type:"Raw",value:o.slice(n,i),loc:e.positions?Q(e,n,i):null}}return e.pos++,null}function Hi(e){return e===32||e===9||e===10||e===12||e===13}function ku(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 Ft(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 Q(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 Su(e){let t=C(e),r=Ft(e.source,t.start,t.end-1),n=ee();while(x(e)!==0&&x(e)!==22){let i=Ve(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 Au(e){let t=C(e),r=ee();while(x(e)!==0&&x(e)!==22){let n=Ve(e);if(n)r.appendData(n)}if(x(e)===22)C(e);return{type:"Parentheses",children:r,loc:k(e,t,w(e))}}function fn(e){let t=w(e),r=ee();while(x(e)!==0){if(fe(e),x(e)===0||x(e)===23)break;let n=Qi(e);if(n.children.head!==null)r.appendData(n);if(fe(e),x(e)===18){C(e);continue}break}return{type:"SelectorList",children:r,loc:k(e,t,w(e))}}function Qi(e){let t=w(e),r=ee(),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&&!Gi(e)&&!Eu(e)){let s={type:"Combinator",name:" ",loc:k(e,i,i)};r.appendData(s),n=!0}continue}if(i.type===9&&e.source.charCodeAt(i.start)===124&&e.types[e.pos+1]===9&&e.source.charCodeAt(e.starts[e.pos+1])===124){let s=w(e);C(e);let c=C(e),l={type:"Combinator",name:"||",loc:k(e,s,c)};r.appendData(l),n=!0,fe(e);continue}if(Gi(e)){let s=C(e),l={type:"Combinator",name:e.source[s.start],loc:k(e,s,s)};r.appendData(l),n=!0,fe(e);continue}let o=Tu(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 Gi(e){let t=w(e);if(t.type!==9)return!1;let r=e.source[t.start];return r===">"||r==="+"||r==="~"}function Eu(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 Tu(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:`${be(e,t)}|${be(e,n)}`,loc:k(e,t,n)}}if(x(e)===9&&e.source[w(e).start]==="*"){let n=C(e);return{type:"TypeSelector",name:`${be(e,t)}|*`,loc:k(e,t,n)}}}return{type:"TypeSelector",name:be(e,t),loc:k(e,t,t)}}case 11:return C(e),{type:"TypeSelector",name:be(e,t),loc:k(e,t,t)};case 10:return C(e),{type:"TypeSelector",name:be(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:be(e,n),loc:k(e,t,n)}}return null}if(r==="&")return C(e),{type:"NestingSelector",loc:k(e,t,t)};return C(e),null}case 4:return C(e),{type:"IdSelector",name:e.source.slice(t.start+1,t.end),loc:k(e,t,t)};case 16:{C(e);let r=x(e)===16;if(r)C(e);return Nu(e,r,t)}case 19:return Ou(e)}return null}function Nu(e,t,r){let n=w(e);if(n.type===1){C(e);let i=Ft(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=Ft(e.source,n.start,n.end-1),o=ee();if(!t&&bu.has(i)){let l=w(e),a=l,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}a=C(e)}if(x(e)===22)C(e);let f=e.source.slice(l.start,a.end).trim();if(f.length>0){let d=qi(f,{positions:!1}),h=fn(d);o.appendData(h)}}else{while(x(e)!==0&&x(e)!==22){let l=Ve(e);if(l)o.appendData(l)}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 Ou(e){let t=C(e);fe(e);let r=w(e);if(r.type!==1)return null;C(e);let n={type:"Identifier",name:be(e,r),loc:k(e,r,r)};fe(e);let i=null,o=null,s=null,c=w(e);if(c.type===9){let a=e.source[c.start],u=e.source[c.start+1];if(a==="=")i="=",C(e);else if((a==="~"||a==="|"||a==="^"||a==="$"||a==="*")&&u==="="){C(e);let h=w(e);if(h.type===9&&e.source[h.start]==="=")C(e),i=`${a}=`}fe(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:nn(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:be(e,f),loc:k(e,f,f)};fe(e);let d=w(e);if(d.type===1)C(e),s=be(e,d)}fe(e);let l=w(e);if(x(e)===20)l=C(e);return{type:"AttributeSelector",name:n,matcher:i,value:o,flags:s,loc:k(e,t,l)}}var eo=Symbol("walkSkip"),W=Symbol("walkStop");function Iu(e){return{root:e,stylesheet:null,atrule:null,atrulePrelude:null,rule:null,selector:null,block:null,declaration:null,function:null}}function Pu(e,t){let r=Iu(e),n=typeof t==="function"?t:t.enter,i=typeof t==="function"?null:t.leave??null,o=typeof t==="function"?null:t.visit??null,s=typeof t==="function"?!1:t.reverse??!1;function c(l,a,u){let f=null,d;switch(l.type){case"StyleSheet":f="stylesheet",d=r.stylesheet,r.stylesheet=l;break;case"Atrule":f="atrule",d=r.atrule,r.atrule=l;break;case"AtrulePrelude":f="atrulePrelude",d=r.atrulePrelude,r.atrulePrelude=l;break;case"Rule":f="rule",d=r.rule,r.rule=l;break;case"Selector":f="selector",d=r.selector,r.selector=l;break;case"Block":f="block",d=r.block,r.block=l;break;case"Declaration":f="declaration",d=r.declaration,r.declaration=l;break;case"Function":f="function",d=r.function,r.function=l;break}let h;if((o===null||o===l.type)&&n){let p=n.call(r,l,a,u);if(p===eo){if(f)r[f]=d;return}if(p===W){if(f)r[f]=d;return W}}if(h=_u(l,s,c),h===W){if(f)r[f]=d;return W}if((o===null||o===l.type)&&i){if(i.call(r,l,a,u)===W){if(f)r[f]=d;return W}}if(f)r[f]=d;return}return c(e,null,null)}var ze=Object.assign(Pu,{skip:eo,stop:W});function _u(e,t,r){if("children"in e&&e.children instanceof ae)return Lu(e.children,t,r);if(e.type==="Rule"){if(r(e.prelude,null,null)===W)return W;if(r(e.block,null,null)===W)return W;return}if(e.type==="Atrule"){if(e.prelude){if(r(e.prelude,null,null)===W)return W}if(e.block){if(r(e.block,null,null)===W)return W}return}if(e.type==="Declaration")return r(e.value,null,null);if(e.type==="AttributeSelector"){if(r(e.name,null,null)===W)return W;if(e.value)return r(e.value,null,null);return}return}function Lu(e,t,r){let n;if(t)e.forEachRight((i,o,s)=>{if(n)return;if(r(i,o,s)===W)n=W});else e.forEach((i,o,s)=>{if(n)return;if(r(i,o,s)===W)n=W});return n}function Ze(e,t={}){let r=t.exclamation??!1,n=!1;ze(e,(i,o,s)=>{if(i.type!=="Comment")return;let c=i.value.startsWith("!");if(r===!0&&c)return;if(r==="first-exclamation"&&c&&!n){n=!0;return}if(o&&s)s.remove(o)})}function Bt(e){ze(e,(t)=>{if(t.type!=="Block"&&t.type!=="DeclarationList")return;if(!("children"in t)||!t.children)return;let r=t.children,n=r.head;if(n==null||n.next==null)return;let i=0;for(let c=n;c!=null;c=c.next)if(c.data.type==="Declaration"){if(i++,i>=2)break}if(i<2)return;let o=new Map,s=[];for(let c=n;c!=null;c=c.next){let l=c.data;if(l.type!=="Declaration")continue;let a=l.property,u=o.get(a);if(u){let f=!!u.decl.important,d=!!l.important;if(d||f===d)s.push(u.item),o.set(a,{item:c,decl:l});else s.push(c)}else o.set(a,{item:c,decl:l})}for(let c of s)r.remove(c)})}var Mu={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"},Fu={"#f00":"red","#ff0000":"red","#000080":"navy","#008080":"teal"};function hn(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 to(e){let t=e.toLowerCase();return Mu[t]??null}function ro(e){let t=e.toLowerCase();return Fu[t]??null}function Du(e,t,r){let n=(e<<16|t<<8|r).toString(16).padStart(6,"0");return hn(`#${n}`)}var ju=/^rgba?\(\s*([+-]?\d*\.?\d+%?)\s*[,\s]\s*([+-]?\d*\.?\d+%?)\s*[,\s]\s*([+-]?\d*\.?\d+%?)\s*(?:[,/]\s*([+-]?\d*\.?\d+%?)\s*)?\)$/;function no(e){let t=ju.exec(e.trim());if(!t)return e;let r=dn(t[1]),n=dn(t[2]),i=dn(t[3]);if(t[4]!==void 0&&!Bu(t[4]))return e;return Du(r,n,i)}function Bu(e){if(e.endsWith("%"))return Number.parseFloat(e)>=100;return Number.parseFloat(e)>=1}function dn(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 Uu=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 Ut(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 io(e,t){let r=Ut(e);if((r==="0"||r==="-0")&&Uu.has(t.toLowerCase()))return{value:"0",unit:""};return{value:r,unit:t}}function oo(e){return Ut(e)}function so(e,t){let r=Number.parseFloat(e);if(!Number.isFinite(r))return e;let n=t<0?0:t;return r.toFixed(n)}var ao=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 lo(e){if(!e||e.type!=="Operator")return!1;let t=e.value;return t===":"||t===","||t==="/"}function Wu(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&&lo(r.prev.data),o=n&&lo(n.data);if(i||o)t.remove(r)}r=n}}function gn(e,t={}){let r=t.floatPrecision??null,n=r===null?null:(i)=>so(i,r);ze(e,{enter(i,o,s){switch(i.type){case"Number":{let c=n?n(i.value):i.value;i.value=Ut(c);return}case"Percentage":{let c=n?n(i.value):i.value;i.value=oo(c);return}case"Dimension":{let c=n?n(i.value):i.value,l=io(c,i.unit);i.value=l.value,i.unit=l.unit;return}case"Hash":{let c=hn(`#${i.name}`).slice(1);if(i.name=c,o&&s&&this.declaration&&ao.has(this.declaration.property.toLowerCase())){let l=ro(`#${c}`);if(l&&l.length<c.length+1){let a={type:"Identifier",name:l,loc:i.loc};s.replace(o,s.createItem(a))}}return}case"Identifier":{if(!o||!s||!this.declaration)return;if(!ao.has(this.declaration.property.toLowerCase()))return;let c=to(i.name);if(c&&c.length<i.name.length){let l={type:"Hash",name:c.slice(1),loc:i.loc};s.replace(o,s.createItem(l))}return}case"Url":return;case"Function":{let c=i.name.toLowerCase();if((c==="rgb"||c==="rgba")&&o&&s)i.__rgbReplaceCandidate=!0}}},leave(i,o,s){if(i.type==="Parentheses"||i.type==="Function"||i.type==="Value")Wu(i);if(i.type==="Function"&&i.__rgbReplaceCandidate&&o&&s){let c=Z(i),l=no(c);if(l!==c&&l.startsWith("#")){let a={type:"Hash",name:l.slice(1),loc:i.loc};s.replace(o,s.createItem(a))}}}})}function Vu(e,t={}){let r=Dt(e,{context:"stylesheet"});return co(r,t)}function mn(e,t={}){let r=Dt(e,{context:"declarationList"});return co(r,t)}function co(e,t){if(t.comments===!1)Ze(e,{exclamation:!1});else if(t.comments==="first-exclamation")Ze(e,{exclamation:"first-exclamation"});else Ze(e,{exclamation:!0});return gn(e,{floatPrecision:t.floatPrecision??null}),Bt(e),{css:Z(e),ast:e}}function _e(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 uo=new Map,Pe=new Map;var pn={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"},Hu=/[%#()]/,Gu=/^\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)$/,bo=["calc","min","max","clamp","mod","rem","sin","cos","tan","asin","acos","atan","atan2","pow","sqrt","hypot","log","exp","round"],qu=new Set(bo);function oe(e){return Hu.test(e)||Gu.test(e)}function fo(e){if(!bo.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 l=o;for(let u=o-1;u>=0;u--){let f=e.charCodeAt(u);if(f>=48&&f<=57||f>=97&&f<=122)l=u;else break}let a=e.slice(l,o);if(qu.has(a))r.unshift(!0);else if(r[0]&&a==="")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 l=t.trimEnd(),a=l.charCodeAt(l.length-1),u=l.charCodeAt(l.length-2),f=e.charCodeAt(o+1),d=a===43||a===45||a===42||a===47,h=f===43||f===45||f===42||f===47;if((a===101||a===69)&&u>=48&&u<=57)t+=e[o];else if(d||a===40||a===44)t+=e[o];else if(e.charCodeAt(o-1)===32)t+=`${e[o]} `;else if(a>=48&&a<=57||f>=48&&f<=57||a===41||f===40||h||i!==null&&i===o-1)t+=` ${e[o]} `;else t+=e[o];continue}t+=e[o]}return t}function Wt(e){if(!e.includes("_"))return fo(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 fo(t)}function ho(e,t){if(t.length!==2)return null;let[r,n]=t;if(r!=="min"&&r!=="max")return null;return[oe(n)?`${r}-${e}-[${n}]`:`${r}-${e}-${n}`]}var Yu={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(oe(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(oe(r))return`w-[${r}]`;return`w-${r}`},multiValue:(e)=>ho("w",e)},h:{expand:(e,t)=>{let r=t[e]||e;if(oe(r))return`h-[${r}]`;return`h-${r}`},multiValue:(e)=>ho("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(oe(r))return`inset-[${r}]`;return`inset-${r}`}},top:{expand:(e)=>oe(e)?`top-[${e}]`:`top-${e}`},right:{expand:(e)=>oe(e)?`right-[${e}]`:`right-${e}`},bottom:{expand:(e)=>oe(e)?`bottom-[${e}]`:`bottom-${e}`},left:{expand:(e)=>oe(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)=>oe(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)=>oe(e)?`backdrop-hue-rotate-[${e}]`:`backdrop-hue-rotate-${e}`},animate:{expand:(e)=>`animate-${e}`},"forced-colors":{expand:(e)=>`forced-colors-${e}`}},$t=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"]),go=new WeakMap,mo=new WeakMap;function Ju(e){if(!e)return pn;let t=go.get(e);if(!t)t=e.aliases?{...pn,...e.aliases}:pn,go.set(e,t);return t}function Xu(e){if(!e?.aliases)return"";let t=mo.get(e);if(t===void 0)t=JSON.stringify(e.aliases),mo.set(e,t);return t}function Zu(e,t){let r=`${e}:${t?.colonSyntax}:${Xu(t)}`,n=Pe.get(r);if(n)return n;let i=Ju(t);if(t?.colonSyntax===!0){let g=e.match(/^([a-z][a-z0-9-]*):([^[\]:]+)$/i);if(g){let[,m,y]=g;if(!$t.has(m)){if(oe(y)){let v=[`${m}-[${y}]`];return _e(Pe,r,v),v}let b=y.startsWith("-")?[`-${m}-${y.slice(1)}`]:[`${m}-${y}`];return _e(Pe,r,b),b}}}let o="",s=e,c=!1;if(s.startsWith("-"))c=!0,s=s.slice(1);let l=s.match(/^((?:[a-z@][a-z0-9-]*:)+)(.+)$/i);if(l){if(l[1].slice(0,-1).split(":").every((y)=>$t.has(y)))o=l[1],s=l[2]}let a=s.match(/^([a-z][a-z0-9-]*)\[([^\]]*)\]$/i);if(!a||s.includes("-[")){let g=[e];return _e(Pe,r,g),g}let[,u,f]=a,d=f.split(/\s+/).filter(Boolean);if(d.length===0)return _e(Pe,r,[]),[];let h=Yu[u.toLowerCase()];if(h?.multiValue){let g=h.multiValue(d,i);if(g){let m=g.map((y)=>`${o}${c?"-":""}${y}`);return _e(Pe,r,m),m}}if(!h){let g=[];for(let m of d){let y=m.match(/^([a-z@][a-z0-9-]*):(.+)$/i),b="",v=m;if(y&&$t.has(y[1]))b=`${y[1]}:`,v=y[2];let A="";if(v.startsWith("-"))A="-",v=v.slice(1);let R="";if(v.endsWith("!"))R="!",v=v.slice(0,-1);let P=c?"-":"";if(oe(v))g.push(`${o}${b}${R}${P}${A}${u}-[${v}]`);else g.push(`${o}${b}${R}${P}${A}${u}-${v}`)}return _e(Pe,r,g),g}let p=[];for(let g of d){let m=g.match(/^([a-z@][a-z0-9-]*):(.+)$/i),y="",b=g;if(m&&$t.has(m[1]))y=`${m[1]}:`,b=m[2];let v="";if(b.startsWith("-"))v="-",b=b.slice(1);let A="";if(b.endsWith("!"))A="!",b=b.slice(0,-1);let R=h.expand(b,i);if(R){let P=c?"-":"";p.push(`${o}${y}${A}${P}${v}${R}`)}}return _e(Pe,r,p),p}function Qu(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=(a)=>{let u=a.includes(":")?a.split(":").pop():a;for(let f of o)if(f.endsWith("*")){if(u.startsWith(f.slice(0,-1)))return!0}else if(u===f)return!0;if(u.startsWith("on"))return!0;if(u.startsWith("data-")||u.startsWith("aria-"))return!0;return!1},c=/<([a-z][a-z0-9-]*)\s([^>]*)>/gi,l;while((l=c.exec(e))!==null){let a=l[2],u=/([a-z][a-z0-9-:]*)(?:=["']([^"']*)["'])?(?=\s|$|\/?>)/gi,f;while((f=u.exec(a))!==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 p="",g=d,m=d.match(/^((?:[a-z@][a-z0-9-]*:)+)([a-z][a-z0-9-]*)$/i);if(m){if(m[1].slice(0,-1).split(":").every((v)=>$t.has(v)))p=m[1],g=m[2]}if(h!==void 0){let y=h.split(/\s+/).filter(Boolean);for(let b of y){let v=`${p}${g}-${b}`;if(po(v.replace(/^(?:[a-z@][a-z0-9-]*:)+/gi,"")))r.add(v)}}else{let y=`${p}${g}`;if(po(g))r.add(y)}}}return r}function po(e){if(!e||e.length===0)return!1;return/^[a-z][a-z0-9-/]*(?:-\[[^\]]+\])?$/i.test(e)}function xo(e){let t=uo.get(e);if(t)return t;let r=of(e);return r.base=nf(r),_e(uo,e,r),r}var ef=new Set(["bg","text","border","ring","placeholder","divide","accent","caret","fill","stroke","outline","decoration","shadow","ring-offset","from","via","to"]),tf=/^(.+?)\/(\d+|\[\d*\.?\d+\])$/,rf=/^(\d+)\/(\d+)$/;function yo(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 nf(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 of(e){let t=!1,r=e;if(e.startsWith("!"))t=!0,r=e.slice(1);else if(e.endsWith("!")&&e.length>1)t=!0,r=e.slice(0,-1);let n=r.match(/^\[([a-z-]+):(.+)\]$/);if(n)return{raw:e,variants:[],utility:n[1],value:Wt(n[2]),important:t,arbitrary:!0};let i=r.match(/^((?:[a-z-]+:)*)(-?[a-z-]+?)-\[([^\]]+)\]\/\[([^\]]+)\]$/);if(i){let[,m,y,b,v]=i,A=m?m.split(":").filter(Boolean):[],R=y.startsWith("-"),P=R?y.slice(1):y,L=Wt(b);if(R)L=L.startsWith("-")?L:`-${L}`;return{raw:e,variants:A,utility:P,value:`${L}/${v}`,important:t,arbitrary:!0,modifierArbitrary:!0}}let o=r.match(/^((?:[a-z-]+:)*)(-?[a-z-]+?)-\[(.+)\]$/);if(o){let m=o[1],y=m?m.split(":").filter(Boolean):[],b=o[2],v=b.startsWith("-");if(v)b=b.slice(1);let A=Wt(o[3]),R,P=A.match(/^(color|length|url|number|percentage|position|line-width|absolute-size|relative-size|image|angle|time|flex|string|family-name):(.*)/i);if(P)R=P[1].toLowerCase(),A=P[2];if(v)A=A.startsWith("-")?A:`-${A}`;return{raw:e,variants:y,utility:b,value:A,important:t,arbitrary:!0,typeHint:R}}let s=[],c="",l=0;for(let m=0;m<r.length;m++){let y=r[m];if(y==="[")l++;else if(y==="]")l--;if(y===":"&&l===0)s.push(c),c="";else c+=y}s.push(c);let a=s[s.length-1],u=s.slice(0,-1);if(a.startsWith("!")&&a.length>1)t=!0,a=a.slice(1);else if(a.endsWith("!")&&a.length>1)t=!0,a=a.slice(0,-1);if(u.length>0)r=`${u.join(":")}:${a}`;else r=a;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(a))return{raw:e,variants:u,utility:a,value:void 0,important:t,arbitrary:!1};let d=a.match(/^([a-z-]+?)-\[(.+?)\]$/);if(d){let m=Wt(d[2]),y,b=m.match(/^(color|length|url|number|percentage|position|line-width|absolute-size|relative-size|image|angle|time|flex|string|family-name):(.*)/i);if(b)y=b[1].toLowerCase(),m=b[2];return{raw:e,variants:u,utility:d[1],value:m,important:t,arbitrary:!0,typeHint:y}}let h=["inset-x","inset-y","border-t","border-r","border-b","border-l","border-x","border-y","border-s","border-e","grid-cols","grid-rows","grid-flow","auto-cols","auto-rows","col-span","row-span","col-start","col-end","row-start","row-end","translate-x","translate-y","translate-z","scale-x","scale-y","scale-z","rotate-x","rotate-y","rotate-z","skew-x","skew-y","scroll-m","scroll-mx","scroll-my","scroll-mt","scroll-mr","scroll-mb","scroll-ml","scroll-p","scroll-px","scroll-py","scroll-pt","scroll-pr","scroll-pb","scroll-pl","gap-x","gap-y","overflow-x","overflow-y","min-w","max-w","min-h","max-h","space-x","space-y","ring-offset","underline-offset","outline-offset","backdrop-blur","backdrop-brightness","backdrop-contrast","backdrop-grayscale","backdrop-invert","backdrop-saturate","backdrop-sepia","hue-rotate","drop-shadow","mask-clip","flex-grow","flex-shrink","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","perspective-origin","justify-self","form-input","form-textarea","form-select","form-multiselect","form-checkbox","form-radio","mix-blend","bg-blend","line-clamp","border-spacing","border-spacing-x","border-spacing-y","rounded-s","rounded-e","rounded-ss","rounded-se","rounded-es","rounded-ee","rounded-t","rounded-r","rounded-b","rounded-l","rounded-tl","rounded-tr","rounded-bl","rounded-br","border-opacity","ring-opacity","stroke-dasharray","stroke-dashoffset","animate-iteration","animate-duration","animate-delay","text-emphasis-color","text-emphasis","text-shadow","word-spacing","column-gap","column-rule","font-stretch","list-image"];if(a==="divide-x"||a==="divide-y")return{raw:e,variants:u,utility:a,value:void 0,important:t,arbitrary:!1};let p=a.match(/^(divide-[xy])-(.+)$/);if(p)return{raw:e,variants:u,utility:p[1],value:p[2],important:t,arbitrary:!1};for(let m of h)if(a.startsWith(`${m}-`))return{raw:e,variants:u,utility:m,value:a.slice(m.length+1),important:t,arbitrary:!1};if(a.startsWith("-")){let m=a.slice(1);for(let b of h)if(m.startsWith(`${b}-`))return{raw:e,variants:u,utility:b,value:`-${m.slice(b.length+1)}`,important:t,arbitrary:!1};let y=yo(m);if(y)return{raw:e,variants:u,utility:y[0],value:`-${y[1]}`,important:t,arbitrary:!1};return{raw:e,variants:u,utility:m,value:void 0,important:t,arbitrary:!1}}let g=yo(a);if(g){let[m,y]=g,b=y.match(tf);if(b&&ef.has(m))return{raw:e,variants:u,utility:m,value:`${b[1]}/${b[2]}`,important:t,arbitrary:!1};let v=y.match(rf);if(v)return{raw:e,variants:u,utility:m,value:`${v[1]}/${v[2]}`,important:t,arbitrary:!1};return{raw:e,variants:u,utility:m,value:y,important:t,arbitrary:!1}}return{raw:e,variants:u,utility:a,value:void 0,important:t,arbitrary:!1}}function vo(e,t){if(!e||e.length===0)return!1;if(/^\[[a-z-]+:[^\]]+\]$/i.test(e))return!0;if(t?.enabled&&/^[a-z]+\[[^\]]+\]$/i.test(e))return!0;if(t?.colonSyntax&&/^[a-z]+:[^[\]:]+$/i.test(e))return!0;let r=String.raw`!?-?[a-z][a-z0-9.-]*(?:-\[[^\]]+\])?(?:\/(?:[\w.]+|\[[^\]]+\]))?`;return new RegExp(`^${r}(?::${r})*$`,"i").test(e)}function zt(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 Kt(e,t){let r=new Set,n=[/class(?:Name)?=["']([^"']+)["']/g,/class(?:Name)?=\{["']([^"']+)["']\}/g,/class(?:Name)?=\{`([^`]+)`\}/g];for(let o of n){let s;while((s=o.exec(e))!==null){let c=s[1],l=c.match(/["']([^"']+)["']/g);if(l)for(let f of l){let d=f.replace(/["']/g,""),h=zt(d);for(let p of h)Vt(r,p,t)}let a=c.replace(/["'`]/g," ").replace(/\$\{[^}]+\}/g," "),u=zt(a).filter((f)=>vo(f,t?.bracketSyntax));for(let f of u)Vt(r,f,t)}}let i=[/class(?:Name|:list)?=\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,/:class="([^"]*)"/g,/:class='([^']*)'/g,/\bx-class="([^"]*)"/g,/\bx-class='([^']*)'/g];for(let o of i){let s;while((s=o.exec(e))!==null){let c=s[1].match(/["'`]([^"'`]+)["'`]/g);if(c)for(let l of c){let a=l.replace(/["'`]/g,"").replace(/\$\{[^}]+\}/g," ");for(let u of zt(a))Vt(r,u,t)}}}if(t?.codeStrings?.enabled!==!1)for(let o of af(e,t?.bracketSyntax))Vt(r,o,t);if(t?.attributify?.enabled){let o=Qu(e,t.attributify);for(let s of o)r.add(s)}return r}function sf(e,t){if(!/[-:/[]/.test(e))return!1;if(e.startsWith("-")&&!/^-[a-z]/i.test(e))return!1;return vo(e,t)}function af(e,t){let r=new Set,n=e.length,i=0,o="";while(i<n){let s=e[i];if(s==="/"&&e[i+1]==="/"){let d=e.indexOf(`
92
- `,i);i=d===-1?n:d;continue}if(s==="/"&&e[i+1]==="*"){let d=e.indexOf("*/",i+2);i=d===-1?n:d+2;continue}if(s==="/"&&!/[\w$)\]]/.test(o)){let d=lf(e,i);if(d!==-1){i=d,o=")";continue}}if(s!=='"'&&s!=="'"&&s!=="`"){if(!/\s/.test(s))o=s;i++;continue}o=")";let c=cf(e,i),l=s==="`",a=i+1,u="",f=!1;while(a<n){let d=e[a];if(d==="\\"){u+=e[a+1]??"",a+=2;continue}if(d===s){f=!0,a++;break}if(!l&&d===`
93
- `)break;if(l&&d==="$"&&e[a+1]==="{"){let h=1;a+=2;while(a<n&&h>0){if(e[a]==="{")h++;else if(e[a]==="}")h--;a++}u+=" ";continue}u+=d,a++}if(f){if(c){i=a;continue}for(let d of zt(u))if(sf(d,t))r.add(d);i=a}else i++}return r}function lf(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}function cf(e,t){let r=e.lastIndexOf("<",t),n=e.lastIndexOf(">",t);if(r<=n)return!1;let i=e[r+1];if(!i||!/[A-Za-z!/]/.test(i))return!1;let o=t-1;while(o>r&&/\s/.test(e[o]))o--;if(e[o]==="=")return!0;if(e[o]==="{"){o--;while(o>r&&/\s/.test(e[o]))o--;return e[o]==="="}return!1}function Vt(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=Zu(t,r.bracketSyntax);for(let s of o)e.add(s);return}}e.add(t)}var Ht={getCSS:()=>`
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((c,l)=>{if(c.variadic)n.push(e.slice(l));else n.push(e[l])}),n.push(t);let i={command:r,args:n,options:t};for(let c of r.beforeHooks)await c(i);let o,s=async()=>{let c=r.commandAction.apply(this,n);if(c instanceof Promise)o=await c;else o=c;return o};if(r.middleware.length>0){let c=0,l=async()=>{if(c<r.middleware.length){let a=r.middleware[c++];await a({...i,next:l})}else await s()};await l()}else await s();for(let c of r.afterHooks)await c(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 ji{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 dx=new ji;function Nc(){if("FORCE_COLOR"in vt.env)return vt.env.FORCE_COLOR!=="0";if("NO_COLOR"in vt.env||vt.env.TERM==="dumb")return!1;if(vt.platform==="win32")return!0;return Li.isatty(1)&&Li.isatty(2)}var Bi=Nc();function D(e,t){if(!Bi)return(r)=>r;return(r)=>e+r+t}var Oc=D("\x1B[0m","\x1B[0m"),Ic=D("\x1B[31m","\x1B[39m"),Pc=D("\x1B[32m","\x1B[39m"),_c=D("\x1B[33m","\x1B[39m"),Lc=D("\x1B[34m","\x1B[39m"),Mc=D("\x1B[35m","\x1B[39m"),Fc=D("\x1B[36m","\x1B[39m"),Dc=D("\x1B[37m","\x1B[39m"),jc=D("\x1B[90m","\x1B[39m"),Bc=D("\x1B[1m","\x1B[22m"),Uc=D("\x1B[3m","\x1B[23m"),Vc=D("\x1B[4m","\x1B[24m"),Wc=D("\x1B[2m","\x1B[22m"),zc=D("\x1B[7m","\x1B[27m"),Kc=D("\x1B[8m","\x1B[28m"),Hc=D("\x1B[9m","\x1B[29m"),Gc=D("\x1B[41m","\x1B[49m"),qc=D("\x1B[42m","\x1B[49m"),Yc=D("\x1B[43m","\x1B[49m"),Jc=D("\x1B[44m","\x1B[49m"),Xc=D("\x1B[45m","\x1B[49m"),Zc=D("\x1B[46m","\x1B[49m"),Qc=D("\x1B[47m","\x1B[49m"),eu=Bi,tu={reset:Oc,red:Ic,green:Pc,yellow:_c,blue:Lc,magenta:Mc,cyan:Fc,white:Dc,gray:jc,bold:Bc,italic:Uc,underline:Vc,dim:Wc,inverse:zc,hidden:Kc,strikethrough:Hc,bgRed:Gc,bgGreen:qc,bgYellow:Yc,bgBlue:Jc,bgMagenta:Xc,bgCyan:Zc,bgWhite:Qc,isColorSupported:eu},ru=tu,iu=["up","down","left","right","space","enter","cancel"],bx={actions:new Set(iu),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"}};var xx=nu.platform.startsWith("win"),vx=Symbol("clapp:cancel");var ou=$c();var M=(e,t)=>ou?e:t,wx=M("\u25C6","*"),$x=M("\u25A0","x"),Cx=M("\u25B2","x"),Rx=M("\u25C7","o"),kx=M("\u250C","T"),su=M("\u2502","|"),Sx=M("\u2514","\u2014"),Ax=M("\u25CF",">"),Ex=M("\u25CB"," "),Tx=M("\u25FB","[\u2022]"),Nx=M("\u25FC","[+]"),Ox=M("\u25FB","[ ]"),Ix=M("\u25AA","\u2022"),Px=M("\u2500","-"),_x=M("\u256E","+"),Lx=M("\u251C","+"),Mx=M("\u256F","+"),Fx=M("\u25CF","\u2022"),Dx=M("\u25C6","*"),jx=M("\u25B2","!"),Bx=M("\u25A0","x");var Ux={light:M("\u2500","-"),heavy:M("\u2501","="),block:M("\u2588","#")};function au(){return`${ru.gray(su)} `}var Vx=au();class Ui{configPath;config=null;events=[];retryCount=0;maxRetries=3;retryDelayMs=1000;constructor(){let e=Mi.homedir(),t=Yr.join(e,".config","clapp");this.configPath=Yr.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:Mi.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(lu(this.configPath)){let e=await qr.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=Yr.dirname(this.configPath);await qr.mkdir(t,{recursive:!0}),await qr.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 qx=new Ui;var tn="0.3.13";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 uu(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+=`"${rn(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`"${rn(e.value)}"`;case"Url":return/[\s"'()\\\u0000-\u001F\u007F]/.test(e.value)?`url("${rn(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 l=o.next?o.next.data:null;if(Vi(i)||Vi(l)){o=o.next;continue}}let c=Q(s);if(!c){o=o.next;continue}if(!n&&t&&!du(i))r+=t;n=!1,r+=c,i=s,o=o.next}return r}function uu(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&&fu(r,i))t+=";";t+=o,r=i,n=n.next}return t}function fu(e,t){return e.type==="Declaration"&&t.type!=="Comment"}function Vi(e){if(!e||e.type!=="Operator")return!1;let t=e.value;return t===":"||t===","||t==="/"}function du(e){if(!e)return!1;return e.type==="Operator"||e.type==="Combinator"}function rn(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 Ct(e){return e<128&&(We[e]&4)!==0}function Wi(e){return e>=128||e<128&&(We[e]&8)!==0}function hu(e){return e===45||e>=128||e<128&&(We[e]&10)!==0}function gu(e){return e>=0&&e<=8||e===11||e>=14&&e<=31||e===127}function on(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(on(t))return!1;return!0}function nn(e,t,r){if(e===45)return Wi(t)||t===45||Ve(t,r);if(Wi(e))return!0;if(e===92)return Ve(e,t);return!1}function mu(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 Ft{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=pu(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&&(hu(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),c=e.charCodeAt(t+2),l=e.charCodeAt(t+3);if(nn(s,c,l)){let a=t;t++,t=this.consumeName(t),this.addToken(3,a,t);continue}this.addToken(9,t,t+1),t++;continue}let i=e.charCodeAt(t+1),o=e.charCodeAt(t+2);if(mu(n,i,o)){t=this.consumeNumeric(t);continue}if(nn(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(on(o))return this.addToken(6,t,i),i;if(o===92){let s=r.charCodeAt(i+1);if(on(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(Ct(r)){let n=1;e++;while(n<6&&e<t.length&&Ct(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(nn(n,i,o)){let s=this.consumeName(r);return this.addToken(12,e,s),s}if(n===37)return this.addToken(11,e,r+1),r+1;return this.addToken(10,e,r),r}consumeIdentLike(e){let t=this.source,r=this.consumeName(e),n=t.charCodeAt(r);if(n===40&&r-e===3){let i=t.charCodeAt(e)|32,o=t.charCodeAt(e+1)|32,s=t.charCodeAt(e+2)|32;if(i===117&&o===114&&s===108){let c=r+1;while(c<t.length&&Re(t.charCodeAt(c)))c++;let l=t.charCodeAt(c);if(l===34||l===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||gu(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 pu(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 sn(e,t,r){for(let n=t;n<r;n++)if(e.charCodeAt(n)===92)return yu(e,t,r,n);return e.slice(t,r)}function yu(e,t,r,n){let i=e.slice(t,n),o=n;while(o<r){if(e.charCodeAt(o)!==92){i+=e[o],o++;continue}if(o+1>=r){o++;continue}let c=e.charCodeAt(o+1);if(c===10){o+=2;continue}if(c===13){o+=e.charCodeAt(o+2)===10?3:2;continue}if(Ct(c)){let l=o+1,a="";while(a.length<6&&l<r&&Ct(e.charCodeAt(l)))a+=e[l],l++;let u=Number.parseInt(a,16);if(l<r&&Re(e.charCodeAt(l)))l++;i+=u===0||u>=55296&&u<=57343||u>1114111?String.fromCodePoint(65533):String.fromCodePoint(u),o=l;continue}i+=e[o+1],o+=2}return i}function an(e,t,r){for(let n=t;n<r;n++)if(e.charCodeAt(n)===92)return bu(e,t,r,n);return e.slice(t,r)}function bu(e,t,r,n){let i=e.slice(t,n),o=n;while(o<r){if(e.charCodeAt(o)!==92){i+=e[o],o++;continue}let c=o+1,l="";while(l.length<6&&c<r&&Ct(e.charCodeAt(c)))l+=e[c],c++;if(l.length>0){let a=Number.parseInt(l,16);if(c<r&&Re(e.charCodeAt(c)))c++;i+=a===0||a>=55296&&a<=57343||a>1114111?String.fromCodePoint(65533):String.fromCodePoint(a),o=c;continue}if(c<r){i+=e[c],o=c+1;continue}i+=String.fromCodePoint(65533),o=c}return i}function Ji(e,t){let r=new Ft(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 Xi(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 Dt(e,t,r,n){return{type:"Raw",value:e,loc:k(n,t,r)}}function te(){return new le}function ln(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 Bt(e,t={}){let r=Ji(e,t);switch(t.context??"stylesheet"){case"stylesheet":return Gi(r);case"atrule":return Ut(r)??Ki(r);case"atrulePrelude":return $u(r);case"mediaQuery":case"mediaQueryList":return Hi(r);case"rule":return un(r);case"selectorList":return hn(r);case"selector":return to(r);case"block":return fn(r);case"declarationList":return ku(r);case"declaration":return dn(r)??Ki(r);case"value":return Su(r);case"raw":return Hi(r);default:return Gi(r)}}function Ki(e){return{type:"StyleSheet",children:te(),loc:Xi(e)}}function Hi(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 Gi(e){let t=w(e),r=te(),{types:n,end:i}=e;while(e.pos<i){let c=n[e.pos];if(c===13){e.pos++;continue}if(c===25){let u={type:25,start:e.starts[e.pos],end:e.ends[e.pos]},f=cn(e,u);e.pos++,r.appendData(f);continue}if(c===0)break;if(c===14||c===15){e.pos++;continue}if(c===3){let u=Ut(e);if(u)r.appendData(u);continue}if(c===24){e.pos++;continue}let l=e.pos,a=un(e);if(r.appendData(a),e.pos===l)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 cn(e,t){return{type:"Comment",value:e.source.slice(t.start+2,t.end-2),loc:k(e,t,t)}}function Ut(e){let t=w(e);if(t.type!==3)return null;e.pos++;let r=jt(e.source,t.start+1,t.end);de(e);let n=e.pos,i=w(e),{types:o,end:s}=e,c=n,l=n;while(c<s){let f=o[c];if(f===0||f===17||f===23)break;if(f!==13&&f!==25)l=c+1;c++}let a=null;if(l>n){let f=e.starts[n],d=e.ends[l-1],h={type:o[l-1],start:e.starts[l-1],end:d},p=e.source.slice(f,d).trim();if(p.length>0)if(e.parseAtrulePrelude)try{let g=e.end;e.end=l,e.pos=n;let m=te();while(x(e)!==0){let y=ze(e);if(y)m.appendData(y)}if(Qi(m),e.end=g,e.pos=c,m.isEmpty)a=Dt(p,i,h,e);else a={type:"AtrulePrelude",children:m,loc:null}}catch(g){let m=Dt(p,i,h,e);ln(e,`Failed to parse @${r} prelude: ${g.message}`,i,m),a=m,e.pos=c}else a=Dt(p,i,h,e),e.pos=c;else e.pos=c}else e.pos=c;let u=null;if(x(e)===17)C(e);else if(x(e)===23)u=fn(e,wu.has(r));return{type:"Atrule",name:r,prelude:a,block:u,loc:k(e,t,w(e))}}var vu=new Set(["is","not","where","has","matches","-moz-any","-webkit-any"]),wu=new Set(["media","supports","document","layer","container","scope","starting-style","-moz-document","keyframes","-webkit-keyframes","-moz-keyframes","-o-keyframes"]);function $u(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 un(e){let t=w(e),r;if(e.parseRulePrelude)r=hn(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=Dt(s,i,o,e)}let n=fn(e,!0);return{type:"Rule",prelude:r,block:n,loc:k(e,t,w(e))}}function fn(e,t=!1){let r=w(e);if(x(e)!==23)return{type:"Block",children:te(),loc:Xi(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 l={type:25,start:e.starts[e.pos],end:e.ends[e.pos]};e.pos++,n.appendData(cn(e,l));continue}if(s===3){let l=Ut(e);if(l)n.appendData(l);continue}if(t&&Cu(e,Ru)){let l=un(e);n.appendData(l);continue}let c=dn(e);if(c)n.appendData(c);if(e.pos<o&&i[e.pos]===17)e.pos++}if(x(e)===24)e.pos++;return{type:"Block",children:n,loc:k(e,r,w(e))}}function Cu(e,t){let r=e.pos,n=t(e);return e.pos=r,n}function Ru(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 ku(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(cn(e,C(e)));continue}if(n.type===17){e.pos++;continue}if(n.type===3){let o=Ut(e);if(o)r.appendData(o);continue}let i=dn(e);if(i)r.appendData(i);if(x(e)===17)C(e)}return{type:"DeclarationList",children:r,loc:k(e,t,w(e))}}function dn(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{ln(e,"Expected property name",t,{type:"Raw",value:"",loc:null});let{types:R,end:P}=e;while(e.pos<P){let L=R[e.pos];if(L===0||L===17||L===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){ln(e,`Expected ':' after property "${i}"`,w(e),{type:"Raw",value:"",loc:null});let{types:R,end:P}=e;while(e.pos<P){let L=R[e.pos];if(L===0||L===17||L===24)break;e.pos++}return null}e.pos++,zi(e);let{types:o,starts:s,end:c,pos:l}=e,a=l,u=l,f=-1,d=-1;while(a<c){let R=o[a];if(R===0||R===17||R===24)break;if(R===9&&e.source.charCodeAt(s[a])===33){let P=a+1;while(P<c&&o[P]===13)P++;if(P<c&&o[P]===1){let L=s[P];if(e.ends[P]-L===9&&(e.source.charCodeAt(L)|32)===105&&(e.source.charCodeAt(L+1)|32)===109&&(e.source.charCodeAt(L+2)|32)===112&&(e.source.charCodeAt(L+3)|32)===111&&(e.source.charCodeAt(L+4)|32)===114&&(e.source.charCodeAt(L+5)|32)===116&&(e.source.charCodeAt(L+6)|32)===97&&(e.source.charCodeAt(L+7)|32)===110&&(e.source.charCodeAt(L+8)|32)===116){d=a,f=P,a=P+1;continue}}}if(R!==13&&R!==25)u=a+1;a++}let h=u,p=f>=0?{type:1,start:s[f],end:e.ends[f]}:null,g=i.startsWith("--"),m,y=s[l],b=h>l?e.ends[h-1]:y,v={type:o[l],start:y,end:e.ends[l]},A=h>l?{type:o[h-1],start:s[h-1],end:b}:v;if(g&&!e.parseCustomProperty||!e.parseValue)m={type:"Raw",value:e.source.slice(y,b).trim(),loc:k(e,v,A)};else if(h===l)m={type:"Value",children:te(),loc:k(e,v,A)};else{let R=e.end;e.end=h,e.pos=l,m=Zi(e),e.end=R}return e.pos=a,{type:"Declaration",property:i,important:p?!0:!1,value:m,loc:k(e,t,w(e))}}function Su(e){return Zi(e)}function Zi(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 eo(r),{type:"Value",children:r,loc:k(e,t,w(e))}}function Qi(e){for(let t of e)if("children"in t&&t.children instanceof le)Qi(t.children);eo(e)}function eo(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,c=o.charCodeAt(s);if(c===43||c===45)s++;let l=!1;while(s<i){let u=o.charCodeAt(s);if(u>=48&&u<=57){s++;continue}if(u===46&&!l){l=!0,s++;continue}break}let a=o.charCodeAt(s);if(a===69||a===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:an(o,n,i),loc:e.positions?ee(e,n,i):null};case 5:{e.pos++;let s=n+1,l=i-n>=2&&o.charCodeAt(i-1)===o.charCodeAt(n)?i-1:i;return{type:"String",value:sn(o,s,l),loc:e.positions?ee(e,n,i):null}}case 7:{e.pos++;let s=n+4;while(s<i&&qi(o.charCodeAt(s)))s++;let c=i;if(c>s&&o.charCodeAt(c-1)===41)c--;while(c>s&&qi(o.charCodeAt(c-1)))c--;let l;if(c-s>=2){let a=o.charCodeAt(s),u=o.charCodeAt(c-1);if((a===34||a===39)&&a===u)l=o.slice(s+1,c-1);else l=o.slice(s,c)}else l=o.slice(s,c);return{type:"Url",value:l,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 Eu(e);case 21:return Tu(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),c=o[n];if(Au(s))return{type:"Operator",value:c,loc:e.positions?ee(e,n,i):null};return{type:"Identifier",name:c,loc:e.positions?ee(e,n,i):null}}case 19:{e.pos++;let s=te();while(x(e)!==0&&x(e)!==20){let l=ze(e);if(l)s.appendData(l)}let c=e.pos<e.end?e.ends[e.pos]:i;if(x(e)===20)e.pos++;return{type:"Brackets",children:s,loc:e.positions?ee(e,n,c):null}}case 3:case 23:case 24:case 22:case 20:case 17:case 0:case 14:case 15:case 6:case 8:return e.pos++,{type:"Raw",value:o.slice(n,i),loc:e.positions?ee(e,n,i):null}}return e.pos++,null}function qi(e){return e===32||e===9||e===10||e===12||e===13}function Au(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 jt(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 Eu(e){let t=C(e),r=jt(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 Tu(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 hn(e){let t=w(e),r=te();while(x(e)!==0){if(de(e),x(e)===0||x(e)===23)break;let n=to(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 to(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&&!Yi(e)&&!Nu(e)){let s={type:"Combinator",name:" ",loc:k(e,i,i)};r.appendData(s),n=!0}continue}if(i.type===9&&e.source.charCodeAt(i.start)===124&&e.types[e.pos+1]===9&&e.source.charCodeAt(e.starts[e.pos+1])===124){let s=w(e);C(e);let c=C(e),l={type:"Combinator",name:"||",loc:k(e,s,c)};r.appendData(l),n=!0,de(e);continue}if(Yi(e)){let s=C(e),l={type:"Combinator",name:e.source[s.start],loc:k(e,s,s)};r.appendData(l),n=!0,de(e);continue}let o=Ou(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 Yi(e){let t=w(e);if(t.type!==9)return!1;let r=e.source[t.start];return r===">"||r==="+"||r==="~"}function Nu(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 Ou(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 Iu(e,r,t)}case 19:return Pu(e)}return null}function Iu(e,t,r){let n=w(e);if(n.type===1){C(e);let i=jt(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=jt(e.source,n.start,n.end-1),o=te();if(!t&&vu.has(i)){let l=w(e),a=l,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}a=C(e)}if(x(e)===22)C(e);let f=e.source.slice(l.start,a.end).trim();if(f.length>0){let d=Ji(f,{positions:!1}),h=hn(d);o.appendData(h)}}else{while(x(e)!==0&&x(e)!==22){let l=ze(e);if(l)o.appendData(l)}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 Pu(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,c=w(e);if(c.type===9){let a=e.source[c.start],u=e.source[c.start+1];if(a==="=")i="=",C(e);else if((a==="~"||a==="|"||a==="^"||a==="$"||a==="*")&&u==="="){C(e);let h=w(e);if(h.type===9&&e.source[h.start]==="=")C(e),i=`${a}=`}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:sn(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 l=w(e);if(x(e)===20)l=C(e);return{type:"AttributeSelector",name:n,matcher:i,value:o,flags:s,loc:k(e,t,l)}}var ro=Symbol("walkSkip"),V=Symbol("walkStop");function _u(e){return{root:e,stylesheet:null,atrule:null,atrulePrelude:null,rule:null,selector:null,block:null,declaration:null,function:null}}function Lu(e,t){let r=_u(e),n=typeof t==="function"?t:t.enter,i=typeof t==="function"?null:t.leave??null,o=typeof t==="function"?null:t.visit??null,s=typeof t==="function"?!1:t.reverse??!1;function c(l,a,u){let f=null,d;switch(l.type){case"StyleSheet":f="stylesheet",d=r.stylesheet,r.stylesheet=l;break;case"Atrule":f="atrule",d=r.atrule,r.atrule=l;break;case"AtrulePrelude":f="atrulePrelude",d=r.atrulePrelude,r.atrulePrelude=l;break;case"Rule":f="rule",d=r.rule,r.rule=l;break;case"Selector":f="selector",d=r.selector,r.selector=l;break;case"Block":f="block",d=r.block,r.block=l;break;case"Declaration":f="declaration",d=r.declaration,r.declaration=l;break;case"Function":f="function",d=r.function,r.function=l;break}let h;if((o===null||o===l.type)&&n){let p=n.call(r,l,a,u);if(p===ro){if(f)r[f]=d;return}if(p===V){if(f)r[f]=d;return V}}if(h=Mu(l,s,c),h===V){if(f)r[f]=d;return V}if((o===null||o===l.type)&&i){if(i.call(r,l,a,u)===V){if(f)r[f]=d;return V}}if(f)r[f]=d;return}return c(e,null,null)}var Ke=Object.assign(Lu,{skip:ro,stop:V});function Mu(e,t,r){if("children"in e&&e.children instanceof le)return Fu(e.children,t,r);if(e.type==="Rule"){if(r(e.prelude,null,null)===V)return V;if(r(e.block,null,null)===V)return V;return}if(e.type==="Atrule"){if(e.prelude){if(r(e.prelude,null,null)===V)return V}if(e.block){if(r(e.block,null,null)===V)return V}return}if(e.type==="Declaration")return r(e.value,null,null);if(e.type==="AttributeSelector"){if(r(e.name,null,null)===V)return V;if(e.value)return r(e.value,null,null);return}return}function Fu(e,t,r){let n;if(t)e.forEachRight((i,o,s)=>{if(n)return;if(r(i,o,s)===V)n=V});else e.forEach((i,o,s)=>{if(n)return;if(r(i,o,s)===V)n=V});return n}function Qe(e,t={}){let r=t.exclamation??!1,n=!1;Ke(e,(i,o,s)=>{if(i.type!=="Comment")return;let c=i.value.startsWith("!");if(r===!0&&c)return;if(r==="first-exclamation"&&c&&!n){n=!0;return}if(o&&s)s.remove(o)})}function Vt(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 c=n;c!=null;c=c.next)if(c.data.type==="Declaration"){if(i++,i>=2)break}if(i<2)return;let o=new Map,s=[];for(let c=n;c!=null;c=c.next){let l=c.data;if(l.type!=="Declaration")continue;let a=l.property,u=o.get(a);if(u){let f=!!u.decl.important,d=!!l.important;if(d||f===d)s.push(u.item),o.set(a,{item:c,decl:l});else s.push(c)}else o.set(a,{item:c,decl:l})}for(let c of s)r.remove(c)})}var Du={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"},ju={"#f00":"red","#ff0000":"red","#000080":"navy","#008080":"teal"};function mn(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 no(e){let t=e.toLowerCase();return Du[t]??null}function io(e){let t=e.toLowerCase();return ju[t]??null}function Bu(e,t,r){let n=(e<<16|t<<8|r).toString(16).padStart(6,"0");return mn(`#${n}`)}var Uu=/^rgba?\(\s*([+-]?\d*\.?\d+%?)\s*[,\s]\s*([+-]?\d*\.?\d+%?)\s*[,\s]\s*([+-]?\d*\.?\d+%?)\s*(?:[,/]\s*([+-]?\d*\.?\d+%?)\s*)?\)$/;function oo(e){let t=Uu.exec(e.trim());if(!t)return e;let r=gn(t[1]),n=gn(t[2]),i=gn(t[3]);if(t[4]!==void 0&&!Vu(t[4]))return e;return Bu(r,n,i)}function Vu(e){if(e.endsWith("%"))return Number.parseFloat(e)>=100;return Number.parseFloat(e)>=1}function gn(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 Wu=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 Wt(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 so(e,t){let r=Wt(e);if((r==="0"||r==="-0")&&Wu.has(t.toLowerCase()))return{value:"0",unit:""};return{value:r,unit:t}}function ao(e){return Wt(e)}function lo(e,t){let r=Number.parseFloat(e);if(!Number.isFinite(r))return e;let n=t<0?0:t;return r.toFixed(n)}var co=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 uo(e){if(!e||e.type!=="Operator")return!1;let t=e.value;return t===":"||t===","||t==="/"}function zu(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&&uo(r.prev.data),o=n&&uo(n.data);if(i||o)t.remove(r)}r=n}}function pn(e,t={}){let r=t.floatPrecision??null,n=r===null?null:(i)=>lo(i,r);Ke(e,{enter(i,o,s){switch(i.type){case"Number":{let c=n?n(i.value):i.value;i.value=Wt(c);return}case"Percentage":{let c=n?n(i.value):i.value;i.value=ao(c);return}case"Dimension":{let c=n?n(i.value):i.value,l=so(c,i.unit);i.value=l.value,i.unit=l.unit;return}case"Hash":{let c=mn(`#${i.name}`).slice(1);if(i.name=c,o&&s&&this.declaration&&co.has(this.declaration.property.toLowerCase())){let l=io(`#${c}`);if(l&&l.length<c.length+1){let a={type:"Identifier",name:l,loc:i.loc};s.replace(o,s.createItem(a))}}return}case"Identifier":{if(!o||!s||!this.declaration)return;if(!co.has(this.declaration.property.toLowerCase()))return;let c=no(i.name);if(c&&c.length<i.name.length){let l={type:"Hash",name:c.slice(1),loc:i.loc};s.replace(o,s.createItem(l))}return}case"Url":return;case"Function":{let c=i.name.toLowerCase();if((c==="rgb"||c==="rgba")&&o&&s)i.__rgbReplaceCandidate=!0}}},leave(i,o,s){if(i.type==="Parentheses"||i.type==="Function"||i.type==="Value")zu(i);if(i.type==="Function"&&i.__rgbReplaceCandidate&&o&&s){let c=Q(i),l=oo(c);if(l!==c&&l.startsWith("#")){let a={type:"Hash",name:l.slice(1),loc:i.loc};s.replace(o,s.createItem(a))}}}})}function Ku(e,t={}){let r=Bt(e,{context:"stylesheet"});return fo(r,t)}function yn(e,t={}){let r=Bt(e,{context:"declarationList"});return fo(r,t)}function fo(e,t){if(t.comments===!1)Qe(e,{exclamation:!1});else if(t.comments==="first-exclamation")Qe(e,{exclamation:"first-exclamation"});else Qe(e,{exclamation:!0});return pn(e,{floatPrecision:t.floatPrecision??null}),Vt(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 ho=new Map,_e=new Map;var bn={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"},qu=/[%#()]/,Yu=/^\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)$/,vo=["calc","min","max","clamp","mod","rem","sin","cos","tan","asin","acos","atan","atan2","pow","sqrt","hypot","log","exp","round"],Ju=new Set(vo);function se(e){return qu.test(e)||Yu.test(e)}function go(e){if(!vo.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 l=o;for(let u=o-1;u>=0;u--){let f=e.charCodeAt(u);if(f>=48&&f<=57||f>=97&&f<=122)l=u;else break}let a=e.slice(l,o);if(Ju.has(a))r.unshift(!0);else if(r[0]&&a==="")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 l=t.trimEnd(),a=l.charCodeAt(l.length-1),u=l.charCodeAt(l.length-2),f=e.charCodeAt(o+1),d=a===43||a===45||a===42||a===47,h=f===43||f===45||f===42||f===47;if((a===101||a===69)&&u>=48&&u<=57)t+=e[o];else if(d||a===40||a===44)t+=e[o];else if(e.charCodeAt(o-1)===32)t+=`${e[o]} `;else if(a>=48&&a<=57||f>=48&&f<=57||a===41||f===40||h||i!==null&&i===o-1)t+=` ${e[o]} `;else t+=e[o];continue}t+=e[o]}return t}function zt(e){if(!e.includes("_"))return go(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 go(t)}function mo(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 Xu={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)=>mo("w",e)},h:{expand:(e,t)=>{let r=t[e]||e;if(se(r))return`h-[${r}]`;return`h-${r}`},multiValue:(e)=>mo("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}`}},Rt=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"]),po=new WeakMap,yo=new WeakMap;function Zu(e){if(!e)return bn;let t=po.get(e);if(!t)t=e.aliases?{...bn,...e.aliases}:bn,po.set(e,t);return t}function Qu(e){if(!e?.aliases)return"";let t=yo.get(e);if(t===void 0)t=JSON.stringify(e.aliases),yo.set(e,t);return t}function ef(e,t){let r=`${e}:${t?.colonSyntax}:${Qu(t)}`,n=_e.get(r);if(n)return n;let i=Zu(t);if(t?.colonSyntax===!0){let g=e.match(/^([a-z][a-z0-9-]*):([^[\]:]+)$/i);if(g){let[,m,y]=g;if(!Rt.has(m)){if(se(y)){let v=[`${m}-[${y}]`];return Le(_e,r,v),v}let b=y.startsWith("-")?[`-${m}-${y.slice(1)}`]:[`${m}-${y}`];return Le(_e,r,b),b}}}let o="",s=e,c=!1;if(s.startsWith("-"))c=!0,s=s.slice(1);let l=s.match(/^((?:[a-z@][a-z0-9-]*:)+)(.+)$/i);if(l){if(l[1].slice(0,-1).split(":").every((y)=>Rt.has(y)))o=l[1],s=l[2]}let a=s.match(/^([a-z][a-z0-9-]*)\[([^\]]*)\]$/i);if(!a||s.includes("-[")){let g=[e];return Le(_e,r,g),g}let[,u,f]=a,d=f.split(/\s+/).filter(Boolean);if(d.length===0)return Le(_e,r,[]),[];let h=Xu[u.toLowerCase()];if(h?.multiValue){let g=h.multiValue(d,i);if(g){let m=g.map((y)=>`${o}${c?"-":""}${y}`);return Le(_e,r,m),m}}if(!h){let g=[];for(let m of d){let y=m.match(/^([a-z@][a-z0-9-]*):(.+)$/i),b="",v=m;if(y&&Rt.has(y[1]))b=`${y[1]}:`,v=y[2];let A="";if(v.startsWith("-"))A="-",v=v.slice(1);let R="";if(v.endsWith("!"))R="!",v=v.slice(0,-1);let P=c?"-":"";if(se(v))g.push(`${o}${b}${R}${P}${A}${u}-[${v}]`);else g.push(`${o}${b}${R}${P}${A}${u}-${v}`)}return Le(_e,r,g),g}let p=[];for(let g of d){let m=g.match(/^([a-z@][a-z0-9-]*):(.+)$/i),y="",b=g;if(m&&Rt.has(m[1]))y=`${m[1]}:`,b=m[2];let v="";if(b.startsWith("-"))v="-",b=b.slice(1);let A="";if(b.endsWith("!"))A="!",b=b.slice(0,-1);let R=h.expand(b,i);if(R){let P=c?"-":"";p.push(`${o}${y}${A}${P}${v}${R}`)}}return Le(_e,r,p),p}function tf(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=(a)=>{let u=a.includes(":")?a.split(":").pop():a;for(let f of o)if(f.endsWith("*")){if(u.startsWith(f.slice(0,-1)))return!0}else if(u===f)return!0;if(u.startsWith("on"))return!0;if(u.startsWith("data-")||u.startsWith("aria-"))return!0;return!1},c=/<([a-z][a-z0-9-]*)\s([^>]*)>/gi,l;while((l=c.exec(e))!==null){let a=l[2],u=/([a-z][a-z0-9-:]*)(?:=["']([^"']*)["'])?(?=\s|$|\/?>)/gi,f;while((f=u.exec(a))!==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 p="",g=d,m=d.match(/^((?:[a-z@][a-z0-9-]*:)+)([a-z][a-z0-9-]*)$/i);if(m){if(m[1].slice(0,-1).split(":").every((v)=>Rt.has(v)))p=m[1],g=m[2]}if(h!==void 0){let y=h.split(/\s+/).filter(Boolean);for(let b of y){let v=`${p}${g}-${b}`;if(bo(v.replace(/^(?:[a-z@][a-z0-9-]*:)+/gi,"")))r.add(v)}}else{let y=`${p}${g}`;if(bo(g))r.add(y)}}}return r}function bo(e){if(!e||e.length===0)return!1;return/^[a-z][a-z0-9-/]*(?:-\[[^\]]+\])?$/i.test(e)}function wo(e){let t=ho.get(e);if(t)return t;let r=af(e);return r.base=sf(r),Le(ho,e,r),r}var rf=new Set(["bg","text","border","ring","placeholder","divide","accent","caret","fill","stroke","outline","decoration","shadow","ring-offset","from","via","to"]),nf=/^(.+?)\/(\d+|\[\d*\.?\d+\])$/,of=/^(\d+)\/(\d+)$/;function xo(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 sf(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 af(e){let t=!1,r=e;if(e.startsWith("!"))t=!0,r=e.slice(1);else if(e.endsWith("!")&&e.length>1)t=!0,r=e.slice(0,-1);let n=r.match(/^\[([a-z-]+):(.+)\]$/);if(n)return{raw:e,variants:[],utility:n[1],value:zt(n[2]),important:t,arbitrary:!0};let i=r.match(/^((?:[a-z-]+:)*)(-?[a-z-]+?)-\[([^\]]+)\]\/\[([^\]]+)\]$/);if(i){let[,m,y,b,v]=i,A=m?m.split(":").filter(Boolean):[],R=y.startsWith("-"),P=R?y.slice(1):y,L=zt(b);if(R)L=L.startsWith("-")?L:`-${L}`;return{raw:e,variants:A,utility:P,value:`${L}/${v}`,important:t,arbitrary:!0,modifierArbitrary:!0}}let o=r.match(/^((?:[a-z-]+:)*)(-?[a-z-]+?)-\[(.+)\]$/);if(o){let m=o[1],y=m?m.split(":").filter(Boolean):[],b=o[2],v=b.startsWith("-");if(v)b=b.slice(1);let A=zt(o[3]),R,P=A.match(/^(color|length|url|number|percentage|position|line-width|absolute-size|relative-size|image|angle|time|flex|string|family-name):(.*)/i);if(P)R=P[1].toLowerCase(),A=P[2];if(v)A=A.startsWith("-")?A:`-${A}`;return{raw:e,variants:y,utility:b,value:A,important:t,arbitrary:!0,typeHint:R}}let s=[],c="",l=0;for(let m=0;m<r.length;m++){let y=r[m];if(y==="[")l++;else if(y==="]")l--;if(y===":"&&l===0)s.push(c),c="";else c+=y}s.push(c);let a=s[s.length-1],u=s.slice(0,-1);if(a.startsWith("!")&&a.length>1)t=!0,a=a.slice(1);else if(a.endsWith("!")&&a.length>1)t=!0,a=a.slice(0,-1);if(u.length>0)r=`${u.join(":")}:${a}`;else r=a;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(a))return{raw:e,variants:u,utility:a,value:void 0,important:t,arbitrary:!1};let d=a.match(/^([a-z-]+?)-\[(.+?)\]$/);if(d){let m=zt(d[2]),y,b=m.match(/^(color|length|url|number|percentage|position|line-width|absolute-size|relative-size|image|angle|time|flex|string|family-name):(.*)/i);if(b)y=b[1].toLowerCase(),m=b[2];return{raw:e,variants:u,utility:d[1],value:m,important:t,arbitrary:!0,typeHint:y}}let h=["inset-x","inset-y","border-t","border-r","border-b","border-l","border-x","border-y","border-s","border-e","grid-cols","grid-rows","grid-flow","auto-cols","auto-rows","col-span","row-span","col-start","col-end","row-start","row-end","translate-x","translate-y","translate-z","scale-x","scale-y","scale-z","rotate-x","rotate-y","rotate-z","skew-x","skew-y","scroll-m","scroll-mx","scroll-my","scroll-mt","scroll-mr","scroll-mb","scroll-ml","scroll-p","scroll-px","scroll-py","scroll-pt","scroll-pr","scroll-pb","scroll-pl","gap-x","gap-y","overflow-x","overflow-y","min-w","max-w","min-h","max-h","space-x","space-y","ring-offset","underline-offset","outline-offset","backdrop-blur","backdrop-brightness","backdrop-contrast","backdrop-grayscale","backdrop-invert","backdrop-saturate","backdrop-sepia","hue-rotate","drop-shadow","mask-clip","flex-grow","flex-shrink","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","perspective-origin","justify-self","form-input","form-textarea","form-select","form-multiselect","form-checkbox","form-radio","mix-blend","bg-blend","line-clamp","border-spacing","border-spacing-x","border-spacing-y","rounded-s","rounded-e","rounded-ss","rounded-se","rounded-es","rounded-ee","rounded-t","rounded-r","rounded-b","rounded-l","rounded-tl","rounded-tr","rounded-bl","rounded-br","border-opacity","ring-opacity","stroke-dasharray","stroke-dashoffset","animate-iteration","animate-duration","animate-delay","text-emphasis-color","text-emphasis","text-shadow","word-spacing","column-gap","column-rule","font-stretch","list-image"];if(a==="divide-x"||a==="divide-y")return{raw:e,variants:u,utility:a,value:void 0,important:t,arbitrary:!1};let p=a.match(/^(divide-[xy])-(.+)$/);if(p)return{raw:e,variants:u,utility:p[1],value:p[2],important:t,arbitrary:!1};for(let m of h)if(a.startsWith(`${m}-`))return{raw:e,variants:u,utility:m,value:a.slice(m.length+1),important:t,arbitrary:!1};if(a.startsWith("-")){let m=a.slice(1);for(let b of h)if(m.startsWith(`${b}-`))return{raw:e,variants:u,utility:b,value:`-${m.slice(b.length+1)}`,important:t,arbitrary:!1};let y=xo(m);if(y)return{raw:e,variants:u,utility:y[0],value:`-${y[1]}`,important:t,arbitrary:!1};return{raw:e,variants:u,utility:m,value:void 0,important:t,arbitrary:!1}}let g=xo(a);if(g){let[m,y]=g,b=y.match(nf);if(b&&rf.has(m))return{raw:e,variants:u,utility:m,value:`${b[1]}/${b[2]}`,important:t,arbitrary:!1};let v=y.match(of);if(v)return{raw:e,variants:u,utility:m,value:`${v[1]}/${v[2]}`,important:t,arbitrary:!1};return{raw:e,variants:u,utility:m,value:y,important:t,arbitrary:!1}}return{raw:e,variants:u,utility:a,value:void 0,important:t,arbitrary:!1}}function $o(e,t){if(!e||e.length===0)return!1;if(/^\[[a-z-]+:[^\]]+\]$/i.test(e))return!0;if(t?.enabled&&/^[a-z]+\[[^\]]+\]$/i.test(e))return!0;if(t?.colonSyntax&&/^[a-z]+:[^[\]:]+$/i.test(e))return!0;let r=String.raw`!?-?[a-z][a-z0-9.-]*(?:-\[[^\]]+\])?(?:\/(?:[\w.]+|\[[^\]]+\]))?`;return new RegExp(`^${r}(?::${r})*$`,"i").test(e)}function Ht(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 Gt(e,t){let r=new Set,n=[/class(?:Name)?=["']([^"']+)["']/g,/class(?:Name)?=\{["']([^"']+)["']\}/g,/class(?:Name)?=\{`([^`]+)`\}/g];for(let o of n){let s;while((s=o.exec(e))!==null){let c=s[1],l=c.match(/["']([^"']+)["']/g);if(l)for(let f of l){let d=f.replace(/["']/g,""),h=Ht(d);for(let p of h)Kt(r,p,t)}let a=c.replace(/["'`]/g," ").replace(/\$\{[^}]+\}/g," "),u=Ht(a).filter((f)=>$o(f,t?.bracketSyntax));for(let f of u)Kt(r,f,t)}}let i=[/class(?:Name|:list)?=\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,/:class="([^"]*)"/g,/:class='([^']*)'/g,/\bx-class="([^"]*)"/g,/\bx-class='([^']*)'/g];for(let o of i){let s;while((s=o.exec(e))!==null){let c=s[1].match(/["'`]([^"'`]+)["'`]/g);if(c)for(let l of c){let a=l.replace(/["'`]/g,"").replace(/\$\{[^}]+\}/g," ");for(let u of Ht(a))Kt(r,u,t)}}}if(t?.codeStrings?.enabled!==!1)for(let o of cf(e,t?.bracketSyntax))Kt(r,o,t);if(t?.attributify?.enabled){let o=tf(e,t.attributify);for(let s of o)r.add(s)}return r}function lf(e,t){if(!/[-:/[]/.test(e))return!1;if(e.startsWith("-")&&!/^-[a-z]/i.test(e))return!1;return $o(e,t)}function cf(e,t){let r=new Set,n=e.length,i=0,o="";while(i<n){let s=e[i];if(s==="/"&&e[i+1]==="/"){let d=e.indexOf(`
92
+ `,i);i=d===-1?n:d;continue}if(s==="/"&&e[i+1]==="*"){let d=e.indexOf("*/",i+2);i=d===-1?n:d+2;continue}if(s==="/"&&!/[\w$)\]]/.test(o)){let d=uf(e,i);if(d!==-1){i=d,o=")";continue}}if(s!=='"'&&s!=="'"&&s!=="`"){if(!/\s/.test(s))o=s;i++;continue}o=")";let c=ff(e,i),l=s==="`",a=i+1,u="",f=!1;while(a<n){let d=e[a];if(d==="\\"){u+=e[a+1]??"",a+=2;continue}if(d===s){f=!0,a++;break}if(!l&&d===`
93
+ `)break;if(l&&d==="$"&&e[a+1]==="{"){let h=1;a+=2;while(a<n&&h>0){if(e[a]==="{")h++;else if(e[a]==="}")h--;a++}u+=" ";continue}u+=d,a++}if(f){if(c){i=a;continue}for(let d of Ht(u))if(lf(d,t))r.add(d);i=a}else i++}return r}function uf(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}function ff(e,t){let r=e.lastIndexOf("<",t),n=e.lastIndexOf(">",t);if(r<=n)return!1;let i=e[r+1];if(!i||!/[A-Za-z!/]/.test(i))return!1;let o=t-1;while(o>r&&/\s/.test(e[o]))o--;if(e[o]==="=")return!0;if(e[o]==="{"){o--;while(o>r&&/\s/.test(e[o]))o--;return e[o]==="="}return!1}function Kt(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=ef(t,r.bracketSyntax);for(let s of o)e.add(s);return}}e.add(t)}var qt={getCSS:()=>`
95
95
  /*
96
96
  ! Tailwind CSS Preflight | MIT License | https://tailwindcss.com
97
97
  */
@@ -354,7 +354,7 @@ video {
354
354
  [hidden] {
355
355
  display: none;
356
356
  }
357
- `.trim()};var Tr={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:[Ht],presets:[],cssVariables:!1},ii=null;async function qs(){if(!ii){await Promise.resolve().then(() => Gs());ii=await Hs({name:"css",defaultConfig:Tr})}return ii}var oi=Tr;function Ne(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 Nr="0 0 #0000",wh=["inset-shadow","inset-ring-shadow","ring-offset-shadow","ring-shadow","shadow"],V=wh.map((e)=>`var(--tc-${e}, 0 0 #0000)`).join(", ");var Or={"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"},$h={...Or,prose:"65ch"};function Xs(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 Ch=(e,t)=>{if(e.utility==="min-w"&&e.value){let r=me(e,t,Or);return r!==void 0?{"min-width":r}:void 0}if(e.utility==="max-w"&&e.value){let r=me(e,t,$h);return r!==void 0?{"max-width":r}:void 0}if(e.utility==="min-h"&&e.value){let r={...Or,screen:"100vh"},n=me(e,t,r);return n!==void 0?{"min-height":n}:void 0}if(e.utility==="max-h"&&e.value){let r={...Or,screen:"100vh"},n=me(e,t,r);return n!==void 0?{"max-height":n}:void 0}},Rh=(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 Xs(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 Xs(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 Ys(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 Sh=(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=Ys(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=Ys(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])"}}},Ah=(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 Js(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 Eh(e){let t=Ne(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 Th=(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=Js(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=Js(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=Eh(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])"}}},Nh=(e,t)=>{let r=(n)=>{let i=null,o=n,s=Ne(n);if(s!==-1){o=n.slice(0,s);let u=n.slice(s+1);if(u.startsWith("[")&&u.endsWith("]"))i=u.slice(1,-1);else if(e.modifierArbitrary){let f=Number.parseFloat(u);if(!Number.isNaN(f)&&f>=0&&f<=1)i=f.toString()}else{let f=Number.parseInt(u,10);if(!Number.isNaN(f))i=(f/100).toString()}}let c=(u)=>{if(!i)return u;let f=u.match(/^(oklch|rgb|hsl|oklab|lab|lch)\(([^)]+)\)$/i);if(f){let d=f[1],h=f[2].split("/")[0].trim();return`${d}(${h} / ${i})`}if(/^#[0-9a-f]{3,8}$/i.test(u)){let d=u.replace("#",""),h=(y)=>Number.parseInt(y.length===1?y+y:y,16),p=h(d.slice(0,d.length===3?1:2)),g=h(d.slice(d.length===3?1:2,d.length===3?2:4)),m=h(d.slice(d.length===3?2:4,d.length===3?3:6));return`rgb(${p} ${g} ${m} / ${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 l=t.theme.colors[o];if(typeof l==="string")return c(l);if(typeof l==="object"&&l!==null&&typeof l.DEFAULT==="string")return c(l.DEFAULT);let a=o.split("-");if(a.length>=2){let u=a.slice(0,-1).join("-"),f=a[a.length-1],d=t.theme.colors[u];if(typeof d==="object"&&d[f])return c(d[f])}if(e.arbitrary||o.startsWith("#")||/^(?:var|rgb|rgba|hsl|hsla|oklch|oklab|lab|lch|color|color-mix)\(/.test(o))return c(o);return};if(e.utility==="from"&&e.value){let n=r(e.value);if(n===void 0)return;return{"--tc-gradient-from":n,"--tc-gradient-to":"rgb(255 255 255 / 0)","--tc-gradient-stops":"var(--tc-gradient-from), var(--tc-gradient-to)"}}if(e.utility==="via"&&e.value){let n=r(e.value);if(n===void 0)return;return{"--tc-gradient-to":"rgb(255 255 255 / 0)","--tc-gradient-stops":`var(--tc-gradient-from), ${n}, var(--tc-gradient-to)`}}if(e.utility==="to"&&e.value){let n=r(e.value);if(n===void 0)return;return{"--tc-gradient-to":n,"--tc-gradient-stops":"var(--tc-gradient-from), var(--tc-gradient-to)"}}},Oh=(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}},Ih=(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=me(e,t,{});return n!==void 0?{"flex-basis":n}:void 0}},Ph=(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}},_h=(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}},Lh=(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}}},Mh=(e)=>{if(e.arbitrary&&e.utility&&e.value&&e.base.startsWith("["))return{[e.utility]:e.value}},Zs=[Ch,Rh,kh,Ah,Sh,Th,Nh,Oh,Ih,Ph,_h,Lh,Mh];var Qs={"bg-origin-border":"border-box","bg-origin-padding":"padding-box","bg-origin-content":"content-box"},ea={"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"},ta={"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"},ra={"bg-auto":"auto","bg-cover":"cover","bg-contain":"contain"},si=null,na=null;function Fh(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 Dh(e){return e.replace(/rgba?\([^)]+\)/g,"var(--tc-shadow-color)")}var jh=(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},Bh=(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},ia={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"},Uh=new Set(["srgb","srgb-linear","oklab","oklch","lab","lch","hsl","hwb","xyz","xyz-d50","xyz-d65","display-p3","a98-rgb","prophoto-rgb","rec2020"]),Wh=new Set(["shorter","longer","increasing","decreasing"]);function Vh(e){if(Uh.has(e))return`in ${e}`;if(Wh.has(e))return`in oklch ${e} hue`;return}var zh=(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=Vh(n),i===void 0)return}let o=r.charCodeAt(0)===45,s=o?r.slice(1):r,c,l="";if(s==="conic")c="conic-gradient";else if(s==="radial")c="radial-gradient";else if(s.startsWith("conic-")){let u=s.slice(6);if(!/^\d+(?:\.\d+)?$/.test(u))return;c="conic-gradient",l=`from ${o?"-":""}${u}deg`}else if(s.startsWith("linear-")||s.startsWith("gradient-")){let u=s.slice(s.indexOf("-")+1);if(c="linear-gradient",u.startsWith("to-")){let f=ia[u.slice(3)];if(f===void 0)return;l=f}else if(/^\d+(?:\.\d+)?$/.test(u))l=`${o?"-":""}${u}deg`;else return}else return;if(!l&&i===void 0)return;let a=[l,i].filter(Boolean).join(" ");return{"background-image":a?`${c}(${a}, var(--tc-gradient-stops))`:`${c}(var(--tc-gradient-stops))`}},Kh=(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=ia[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},Hh=(e)=>Qs[e.base]?{"background-origin":Qs[e.base]}:void 0,Gh=(e)=>ea[e.base]?{"background-position":ea[e.base]}:void 0,qh=(e)=>ta[e.base]?{"background-repeat":ta[e.base]}:void 0,Yh=(e)=>ra[e.base]?{"background-size":ra[e.base]}:void 0,Jh=(e)=>{if(e.utility==="border"&&e.value){let t={solid:"solid",dashed:"dashed",dotted:"dotted",double:"double",hidden:"hidden",none:"none"};return t[e.value]?{"border-style":t[e.value]}:void 0}return},Xh=(e,t)=>{if(e.utility==="outline-offset"&&e.value){let r={0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"};if(r[e.value])return{"outline-offset":r[e.value]};if(e.arbitrary)return{"outline-offset":e.value};if(/^\d+(?:\.\d+)?$/.test(e.value))return{"outline-offset":`${e.value}px`};return}if(e.utility==="outline"&&e.value){let r={none:"none",solid:"solid",dashed:"dashed",dotted:"dotted",double:"double"};if(r[e.value])return{"outline-style":r[e.value]};if(e.value==="hidden")return{outline:"2px solid transparent","outline-offset":"2px"}}if(e.utility==="outline"){if(!e.value)return{"outline-width":"1px"};let r=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}},Zh=(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":Nr,"box-shadow":V};let i=Dh(n);return{"--tc-shadow":n,"--tc-shadow-colored":i,"box-shadow":V}}},Qh=(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(si===null||na!==t.theme.colors)si=Fh(t.theme.colors),na=t.theme.colors;let r=e.value,n=Ne(r),i,o;if(n!==-1){i=r.slice(0,n);let l=r.slice(n+1);if(l.charCodeAt(0)===91&&l.charCodeAt(l.length-1)===93){let a=Number.parseFloat(l.slice(1,-1));if(Number.isNaN(a)||a<0||a>1)return;o=a}else if(e.modifierArbitrary){let a=Number.parseFloat(l);if(Number.isNaN(a)||a<0||a>1)return;o=a}else{let a=Number.parseInt(l,10);if(Number.isNaN(a)||a<0||a>100)return;o=a/100}}else i=r;let s=si.get(i)??(e.arbitrary?i:void 0);if(!s)return;return{"--tc-shadow-color":o!==void 0?ve(s,o):s,"--tc-shadow":"var(--tc-shadow-colored)"}};function Nt(e){return`${e} var(--tc-text-shadow-color, rgba(0, 0, 0, 0.05))`}var eg=(e,t)=>{if(e.utility!=="text-shadow")return;let r={sm:Nt("0 1px 2px"),DEFAULT:Nt("0 1px 3px"),md:Nt("0 4px 6px"),lg:Nt("0 10px 15px"),xl:Nt("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}},tg=(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}},rg=(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}},ng=(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}},ig=(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},ai=[jh,Bh,zh,Kh,Hh,Gh,qh,Yh,Jh,Xh,Zh,Qh,eg,tg,rg,ng,ig];var oa={add:"add",subtract:"subtract",intersect:"intersect",exclude:"exclude"},sa={alpha:"alpha",luminance:"luminance",match:"match-source"},aa={auto:"auto",cover:"cover",contain:"contain"},la={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"},ca={repeat:"repeat","no-repeat":"no-repeat"},og=(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(oa[t]!==void 0)return{"mask-composite":oa[t]};if(sa[t]!==void 0)return{"mask-mode":sa[t]};if(aa[t]!==void 0)return{"mask-size":aa[t]};if(la[t]!==void 0)return{"mask-position":la[t]};if(ca[t]!==void 0)return{"mask-repeat":ca[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},Ge="linear-gradient(#fff, #fff)";function S(e,t){return`var(--tc-mask-${e}, ${t})`}function qe(){return{"mask-image":`${S("linear",Ge)}, ${S("radial",Ge)}, ${S("conic",Ge)}`,"mask-composite":"intersect"}}var ag=[S("left",Ge),S("right",Ge),S("bottom",Ge),S("top",Ge)].join(", "),lg={t:["top"],r:["right"],b:["bottom"],l:["left"],x:["right","left"],y:["top","bottom"]};function cg(e){let t=`${S(`${e}-from-color`,"black")} ${S(`${e}-from-position`,"0%")}`,r=`${S(`${e}-to-color`,"transparent")} ${S(`${e}-to-position`,"100%")}`;return`linear-gradient(to ${e}, ${t}, ${r})`}var ug=[S("linear-position","0deg"),`${S("linear-from-color","black")} ${S("linear-from-position","0%")}`,`${S("linear-to-color","transparent")} ${S("linear-to-position","100%")}`].join(", "),fg=/^(?:var|rgb|rgba|hsl|hsla|oklch|oklab|lab|lch|color|color-mix)\(/;function Ir(e,t,r){if(!e)return;if(/^\d+(?:\.\d+)?%$/.test(e))return{position:e};if(/^\d+(?:\.\d+)?$/.test(e)){let i=me({value:e,arbitrary:!1},r,{});return i===void 0?void 0:{position:i}}if(t)return e.charCodeAt(0)===35||fg.test(e)?{color:e}:{position:e};let n=z(e,r,!1);return n===void 0?void 0:{color:n}}function Pr(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 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("linear-"))return;let o=i.slice(7);if(/^\d+(?:\.\d+)?$/.test(o))return{...qe(),"--tc-mask-linear":`linear-gradient(${S("linear-stops",S("linear-position","0deg"))})`,"--tc-mask-linear-position":`calc(1deg * ${n?"-":""}${o})`};if(n)return;let s=Pr(o);if(s===void 0)return;let c=Ir(s.token,e.arbitrary,t);if(c===void 0)return;let l={...qe(),"--tc-mask-linear-stops":ug,"--tc-mask-linear":"linear-gradient(var(--tc-mask-linear-stops))"};if(c.color!==void 0)l[`--tc-mask-linear-${s.stop}-color`]=c.color;else l[`--tc-mask-linear-${s.stop}-position`]=c.position;return l},hg=(e,t)=>{if(e.utility!=="mask"||!e.value||e.arbitrary)return;let r=e.value,n=r.indexOf("-");if(n===-1)return;let i=lg[r.slice(0,n)];if(i===void 0)return;let o=Pr(r.slice(n+1));if(o===void 0)return;let s=Ir(o.token,e.arbitrary,t);if(s===void 0)return;let c={...qe(),"--tc-mask-linear":ag};for(let l of i)if(c[`--tc-mask-${l}`]=cg(l),s.color!==void 0)c[`--tc-mask-${l}-${o.stop}-color`]=s.color;else c[`--tc-mask-${l}-${o.stop}-position`]=s.position;return c},gg=[`${S("radial-shape","ellipse")} ${S("radial-size","farthest-corner")} at ${S("radial-position","center")}`,`${S("radial-from-color","black")} ${S("radial-from-position","0%")}`,`${S("radial-to-color","transparent")} ${S("radial-to-position","100%")}`].join(", "),mg=new Set(["closest-side","closest-corner","farthest-side","farthest-corner"]),pg={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"},yg=[`from ${S("conic-position","0deg")}`,`${S("conic-from-color","black")} ${S("conic-from-position","0%")}`,`${S("conic-to-color","transparent")} ${S("conic-to-position","100%")}`].join(", "),bg=(e,t)=>{if(e.utility==="mask-radial"&&e.arbitrary&&e.value)return{...qe(),"--tc-mask-radial":`radial-gradient(${S("radial-stops",S("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 c=pg[n.slice(3)];return c===void 0?void 0:{"--tc-mask-radial-position":c}}if(mg.has(n))return{"--tc-mask-radial-size":n};let i=Pr(n);if(i===void 0)return;let o=Ir(i.token,e.arbitrary,t);if(o===void 0)return;let s={...qe(),"--tc-mask-radial-stops":gg,"--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},xg=(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{...qe(),"--tc-mask-conic":`conic-gradient(${S("conic-stops",S("conic-position","0deg"))})`,"--tc-mask-conic-position":`calc(1deg * ${n?"-":""}${o})`};if(n)return;let s=Pr(o);if(s===void 0)return;let c=Ir(s.token,e.arbitrary,t);if(c===void 0)return;let l={...qe(),"--tc-mask-conic-stops":yg,"--tc-mask-conic":"conic-gradient(var(--tc-mask-conic-stops))"};if(c.color!==void 0)l[`--tc-mask-conic-${s.stop}-color`]=c.color;else l[`--tc-mask-conic-${s.stop}-position`]=c.position;return l},ua=[dg,hg,bg,xg,og,sg];var vg={"2xs":"inset 0 1px",xs:"inset 0 1px 1px",sm:"inset 0 2px 4px"},wg="rgb(0 0 0 / 0.05)",$g=/^(?:var|rgb|rgba|hsl|hsla|oklch|oklab|lab|lch|color|color-mix)\(/;function ui(e){return e.charCodeAt(0)===35||$g.test(e)}function Cg(e){return/^-?[\d.]+[a-z%]*$/i.test(e)||e.startsWith("calc(")||e.startsWith("var(")}function Rg(e,t){let r=e.trim().split(/\s+/),n=r[r.length-1];if(r.length>1&&!Cg(n))return`inset ${r.slice(0,-1).join(" ")} var(${t}, ${n})`;return`inset ${e} var(${t}, currentcolor)`}function li(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)&&ui(e.value))return{"--tc-inset-shadow-color":e.value};return li(Rg(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=vg[r];if(n!==void 0)return li(`${n} var(--tc-inset-shadow-color, ${wg})`);if(r==="none")return li(`inset ${Nr}`);let i=z(r,t,e.modifierArbitrary);return i===void 0?void 0:{"--tc-inset-shadow-color":i}};function ci(e){return{"--tc-inset-ring-shadow":`inset 0 0 0 ${e} var(--tc-inset-ring-color, currentcolor)`,"box-shadow":V}}var Sg=(e,t)=>{if(e.utility==="inset-ring"&&e.arbitrary&&e.value){if(ui(e.value))return{"--tc-inset-ring-color":e.value};return ci(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 ci("1px");let r=e.value.slice(5);if(/^\d+(?:\.\d+)?$/.test(r))return ci(`${r}px`);let n=z(r,t,e.modifierArbitrary);return n===void 0?void 0:{"--tc-inset-ring-color":n}},Ag=(e,t)=>{if(e.utility!=="drop-shadow"||!e.value)return;if(e.arbitrary){if(/\s/.test(e.value))return;return ui(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}},fa=[kg,Sg,Ag];var _r={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"},da={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 ft(e,t){return e.utility==="form"&&e.value===t||e.utility===`form-${t}`&&!e.value}var Eg=(e)=>{if(ft(e,"input"))return _r},Tg=(e)=>{if(ft(e,"textarea"))return _r},Ng=(e)=>{if(ft(e,"select"))return{..._r,"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"}},Og=(e)=>{if(ft(e,"multiselect"))return{..._r,"background-image":"initial","background-position":"initial","background-repeat":"unset","background-size":"initial","print-color-adjust":"unset"}},Ig=(e)=>{if(ft(e,"checkbox"))return{...da,"border-radius":"0px"}},Pg=(e)=>{if(ft(e,"radio"))return{...da,"border-radius":"100%"}},ha=[Eg,Tg,Ng,Og,Ig,Pg];var _g={gap:"gap","gap-x":"column-gap","gap-y":"row-gap"},dt=/^-?\d+$/,ga=/^span-(\d+)$/,Lg=(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}},Mg=(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(ga);if(t)return{"grid-column":`span ${t[1]} / span ${t[1]}`};if(dt.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"||dt.test(e.value))return{"grid-column-start":e.value};return}if(e.utility==="col-end"&&e.value){if(e.arbitrary||e.value==="auto"||dt.test(e.value))return{"grid-column-end":e.value};return}},Fg=(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}},Dg=(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(ga);if(t)return{"grid-row":`span ${t[1]} / span ${t[1]}`};if(dt.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"||dt.test(e.value))return{"grid-row-start":e.value};return}if(e.utility==="row-end"&&e.value){if(e.arbitrary||e.value==="auto"||dt.test(e.value))return{"grid-row-end":e.value};return}},jg=(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},Bg=(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}},Ug=(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 Wg(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 Vg=(e,t)=>{let r=_g[e.utility];if(!r||!e.value)return;let n=Wg(e,t,e.value);return n!==void 0?{[r]:n}:void 0},zg=(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},Kg=(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},Hg=(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},ma=[Lg,Mg,Fg,Dg,jg,Bg,Ug,Vg,zg,Kg,Hg];import{existsSync as pa,readFileSync as Gg,readdirSync as qg}from"fs";import{join as Lr}from"path";var Mr=new Map;function Yg(e){if(Mr.has(e))return Mr.get(e);let t=[Lr(process.cwd(),"node_modules","@iconify-json",e,"icons.json"),Lr(process.cwd(),"node_modules",".bun","@iconify-json",e,"icons.json")],r=Lr(process.cwd(),"node_modules",".bun");if(pa(r))try{let n=`@iconify-json+${e}@`;for(let i of qg(r))if(i.startsWith(n))t.push(Lr(r,i,"node_modules","@iconify-json",e,"icons.json"))}catch{}for(let n of t)if(pa(n))try{let i=JSON.parse(Gg(n,"utf-8"));return Mr.set(e,i),i}catch{}return Mr.set(e,null),null}function Jg(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 Xg(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 Zg(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 Qg=/^i-([a-z][a-z0-9]*(?:-[a-z0-9]+)*)-(.+)$/;function em(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=Yg(n);if(!o)continue;let s=Jg(o,i);if(s)return{collection:o,icon:s}}return}var ya=(e,t)=>{if(!Qg.test(e.base))return;let r=em(e.base);if(!r)return;let{collection:n,icon:i}=r,o=Zg(Xg(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 ba={"border-collapse":"collapse","border-separate":"separate"},xa={"caption-top":"top","caption-bottom":"bottom"},va={"field-sizing-content":"content","field-sizing-fixed":"fixed"},wa={"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"},$a={"pointer-events-none":"none","pointer-events-auto":"auto"},Ca={"resize-none":"none",resize:"both","resize-y":"vertical","resize-x":"horizontal"},Ra={"scroll-auto":"auto","scroll-smooth":"smooth"},ka={"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)"},Sa={"snap-mandatory":"mandatory","snap-proximity":"proximity"},Aa={"snap-start":"start","snap-end":"end","snap-center":"center","snap-align-none":"none"},Ea={"snap-normal":"normal","snap-always":"always"},Ta={"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"},Na={"select-none":"none","select-text":"text","select-all":"all","select-auto":"auto"},Oa={"will-change-auto":"auto","will-change-scroll":"scroll-position","will-change-contents":"contents","will-change-transform":"transform"},Ia={"stroke-linecap-butt":"butt","stroke-linecap-round":"round","stroke-linecap-square":"square"},Pa={"stroke-linejoin-miter":"miter","stroke-linejoin-round":"round","stroke-linejoin-bevel":"bevel"},_a={"forced-color-adjust-auto":"auto","forced-color-adjust-none":"none"},fi={none:"0",sm:"4px",DEFAULT:"8px",md:"12px",lg:"16px",xl:"24px","2xl":"40px","3xl":"64px"};function Fa(e){if(e.arbitrary)return e.value;if(/^\d+(?:\.\d+)?$/.test(e.value))return`${Number(e.value)/100}`;return}function Da(e){if(!e.value)return fi.DEFAULT;if(fi[e.value]!==void 0)return fi[e.value];if(e.arbitrary)return e.value;if(/^\d+(?:\.\d+)?$/.test(e.value))return`${e.value}px`;return}var ja=["brightness","contrast","grayscale","invert","saturate","sepia"],tm=["blur","brightness","contrast","grayscale","hue-rotate","invert","saturate","sepia","drop-shadow"],rm=["blur","brightness","contrast","grayscale","hue-rotate","invert","opacity","saturate","sepia"],nm=tm.map((e)=>`var(--tc-${e}, )`).join(" "),La=rm.map((e)=>`var(--tc-backdrop-${e}, )`).join(" ");function Ye(e,t){return{[`--tc-${e}`]:t,filter:nm}}function Fr(e,t){return{[`--tc-backdrop-${e}`]:t,"-webkit-backdrop-filter":La,"backdrop-filter":La}}var im=(e)=>{if(e.base==="filter-none")return{filter:"none"};if(e.utility==="blur"){let t=Da(e);return t!==void 0?Ye("blur",`blur(${t})`):void 0}if(ja.includes(e.utility)&&e.value){let t=Fa(e);return t!==void 0?Ye(e.utility,`${e.utility}(${t})`):void 0}if(e.utility==="hue-rotate"&&e.value){if(e.arbitrary)return Ye("hue-rotate",`hue-rotate(${e.value})`);if(/^-?\d+(?:\.\d+)?$/.test(e.value))return Ye("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 Ye("drop-shadow",t.DEFAULT);if(t[e.value])return Ye("drop-shadow",t[e.value]);if(e.arbitrary)return Ye("drop-shadow",`drop-shadow(${e.value})`);return}},om=(e)=>{if(e.base==="backdrop-filter-none")return{"backdrop-filter":"none"};if(e.utility==="backdrop-blur"){let t=Da(e);return t!==void 0?Fr("blur",`blur(${t})`):void 0}if(e.utility.startsWith("backdrop-")&&e.value){let t=e.utility.slice(9);if(ja.includes(t)||t==="opacity"){let r=Fa(e);if(r===void 0)return;return Fr(t,`${t}(${r})`)}if(t==="hue-rotate"){if(e.arbitrary)return Fr(t,`hue-rotate(${e.value})`);if(/^-?\d+(?:\.\d+)?$/.test(e.value))return Fr(t,`hue-rotate(${e.value}deg)`);return}}},sm=(e)=>ba[e.base]?{"border-collapse":ba[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}`}},lm=(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},cm=(e)=>xa[e.base]?{"caption-side":xa[e.base]}:void 0,um=(e,t)=>{if(e.utility==="accent"&&e.value){let r=z(e.value,t,e.modifierArbitrary);if(r)return{"accent-color":r}}},fm=(e)=>{let t={"appearance-none":"none","appearance-auto":"auto","appearance-base":"base"};return t[e.base]?{appearance:t[e.base]}:void 0},dm=(e,t)=>{if(e.utility==="caret"&&e.value){let r=z(e.value,t,e.modifierArbitrary);if(r)return{"caret-color":r}}},hm={normal:"normal",light:"light",dark:"dark","light-dark":"light dark","only-dark":"only dark","only-light":"only light"},Ma=(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=hm[r];return n?{"color-scheme":n}:void 0},gm=(e)=>va[e.base]?{"field-sizing":va[e.base]}:void 0,mm=(e)=>wa[e.base]?{cursor:wa[e.base]}:void 0,pm=(e)=>$a[e.base]?{"pointer-events":$a[e.base]}:void 0,ym=(e)=>Ca[e.base]?{resize:Ca[e.base]}:void 0,bm=(e)=>Ra[e.base]?{"scroll-behavior":Ra[e.base]}:void 0,xm=(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},vm=(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},wm=(e)=>{if(ka[e.base])return{"scroll-snap-type":ka[e.base]};if(Sa[e.base])return{"--tc-scroll-snap-strictness":Sa[e.base]};if(Aa[e.base])return{"scroll-snap-align":Aa[e.base]};if(Ea[e.base])return{"scroll-snap-stop":Ea[e.base]}},$m=(e)=>Ta[e.base]?{"touch-action":Ta[e.base]}:void 0,Cm=(e)=>Na[e.base]?{"user-select":Na[e.base]}:void 0,Rm=(e)=>Oa[e.base]?{"will-change":Oa[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}}},Sm=(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}}},Am=(e)=>{if(e.utility==="stroke"&&e.value){if(e.arbitrary||/^\d+(?:\.\d+)?$/.test(e.value))return{"stroke-width":e.value};return}},Em=(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}},Tm=(e)=>{if(e.utility==="stroke-dashoffset"&&e.value){if(e.arbitrary||/^-?\d+(?:\.\d+)?$/.test(e.value))return{"stroke-dashoffset":e.value};return}},Nm=(e)=>Ia[e.base]?{"stroke-linecap":Ia[e.base]}:void 0,Om=(e)=>Pa[e.base]?{"stroke-linejoin":Pa[e.base]}:void 0,Im=(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},Pm=(e)=>_a[e.base]?{"forced-color-adjust":_a[e.base]}:void 0,Ba=[im,om,sm,am,lm,cm,um,fm,Ma,dm,Ma,gm,mm,pm,ym,bm,xm,vm,wm,$m,Cm,Rm,km,Sm,Am,Em,Tm,Nm,Om,Im,Pm];function we(e,t){let r=e/t*100;if(!Number.isFinite(r))return;return`${_m(r)}%`}function _m(e){if(Number.isInteger(e))return String(e);return e.toFixed(6).replace(/\.?0+$/,"")}var Ua={"column-fill-auto":"auto","column-fill-balance":"balance","column-fill-balance-all":"balance-all"},Wa={"column-span-all":"all","column-span-none":"none"},Va={"box-decoration-clone":"clone","box-decoration-slice":"slice"},za={"box-border":"border-box","box-content":"content-box"},Ka={"float-start":"inline-start","float-end":"inline-end","float-right":"right","float-left":"left","float-none":"none"},Ha={"clear-start":"inline-start","clear-end":"inline-end","clear-left":"left","clear-right":"right","clear-both":"both","clear-none":"none"},Ga={isolate:"isolate","isolation-auto":"auto"},qa={"object-contain":"contain","object-cover":"cover","object-fill":"fill","object-none":"none","object-scale-down":"scale-down"},Ya={"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"},Ja={"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"},Xa={visible:"visible",invisible:"hidden",collapse:"collapse"},Lm=(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}},Mm=(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}},Fm=(e)=>Ua[e.base]?{"column-fill":Ua[e.base]}:void 0,Dm=(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}},jm=(e,t)=>{if(e.utility==="column-rule"&&e.value){let r={"0":"0px","1":"1px","2":"2px","4":"4px","8":"8px"};if(r[e.value])return{"column-rule-width":r[e.value]};let n=e.value.split("-");if(n.length===2){let[s,c]=n,l=t.theme.colors[s];if(typeof l==="object"&&l[c])return{"column-rule-color":l[c]}}let i=t.theme.colors[e.value];if(typeof i==="string")return{"column-rule-color":i};if(typeof i==="object"&&i!==null&&typeof i.DEFAULT==="string")return{"column-rule-color":i.DEFAULT};let o={solid:"solid",dashed:"dashed",dotted:"dotted",double:"double",hidden:"hidden",none:"none"};if(o[e.value])return{"column-rule-style":o[e.value]}}},Bm=(e)=>Wa[e.base]?{"column-span":Wa[e.base]}:void 0,Um=(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],Wm=(e)=>Va[e.base]?{"box-decoration-break":Va[e.base]}:void 0,Vm=(e)=>za[e.base]?{"box-sizing":za[e.base]}:void 0,zm=(e)=>Ka[e.base]?{float:Ka[e.base]}:void 0,Km=(e)=>Ha[e.base]?{clear:Ha[e.base]}:void 0,Hm=(e)=>Ga[e.base]?{isolation:Ga[e.base]}:void 0,Za=["size","inline-size","layout","paint","style"],Gm=Za.map((e)=>`var(--tc-contain-${e}, )`).join(" "),qm=["none","content","strict"],Ym=(e)=>{if(e.utility!=="contain"||!e.value)return;if(e.arbitrary)return{contain:e.value};if(qm.includes(e.value))return{contain:e.value};if(Za.includes(e.value))return{[`--tc-contain-${e.value}`]:e.value,contain:Gm};return},Jm=(e)=>qa[e.base]?{"object-fit":qa[e.base]}:void 0,Xm=(e)=>Ya[e.base]?{"object-position":Ya[e.base]}:void 0,Zm=(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}}},Qm=(e)=>{let t=e.base.startsWith("overscroll-x")?"overscroll-behavior-x":e.base.startsWith("overscroll-y")?"overscroll-behavior-y":"overscroll-behavior";return Ja[e.base]?{[t]:Ja[e.base]}:void 0},ep=(e)=>{if(["static","fixed","absolute","relative","sticky"].includes(e.utility))return{position:e.utility}},tp=(e,t)=>{let n={inset:["top","right","bottom","left"],"inset-x":["left","right"],"inset-y":["top","bottom"],top:["top"],right:["right"],bottom:["bottom"],left:["left"],start:["inset-inline-start"],end:["inset-inline-end"]}[e.utility];if(!n||!e.value)return;let i=(c)=>{if(c.includes("/")&&!e.arbitrary){let[a,u]=c.split("/").map(Number);if(!Number.isNaN(a)&&!Number.isNaN(u)&&u!==0)return we(a,u);return}if(c==="full")return"100%";if(c==="auto")return"auto";if(e.arbitrary)return c;let l=t.theme.spacing[c];if(l!==void 0)return l;if(/^\d+(?:\.\d+)?$/.test(c))return`${Number.parseFloat(c)*0.25}rem`;return},o;if(e.value.startsWith("-")){let c=e.value.slice(1),l=i(c);if(l===void 0)o=void 0;else if(l.endsWith("%"))o=`${-Number.parseFloat(l)}%`;else o=l.startsWith("-")?l:`-${l}`}else o=i(e.value);if(o===void 0)return;let s={};for(let c of n)s[c]=o;return s},rp=(e)=>Xa[e.utility]?{visibility:Xa[e.utility]}:void 0,np=(e)=>{if(e.utility==="z"&&e.value){if(e.arbitrary||e.value==="auto"||/^-?\d+$/.test(e.value))return{"z-index":e.value};return}},Qa=[Lm,Mm,Fm,Dm,jm,Bm,Um,Wm,Vm,zm,Km,Ym,Hm,Jm,Xm,Zm,Qm,ep,tp,rp,np];var ip={rotate:"rotate","rotate-x":"rotateX","rotate-y":"rotateY","rotate-z":"rotateZ"},op={"translate-x":"translateX","translate-y":"translateY","translate-z":"translateZ"},el={"backface-visible":"visible","backface-hidden":"hidden"},tl={"transform-flat":"flat","transform-3d":"preserve-3d"},rl={"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"},nl={"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"},il={"transition-normal":"normal","transition-discrete":"allow-discrete","transition-behavior-normal":"normal","transition-behavior-allow-discrete":"allow-discrete"},ol={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"},sl={"animate-running":"running","animate-paused":"paused"},al={"animate-normal":"normal","animate-reverse":"reverse","animate-alternate":"alternate","animate-alternate-reverse":"alternate-reverse"},ll={"animate-fill-none":"none","animate-fill-forwards":"forwards","animate-fill-backwards":"backwards","animate-fill-both":"both"},cl={"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)"},ul="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))",Ot=`translate(var(--tc-translate-x, 0), var(--tc-translate-y, 0)) ${ul}`,hi=`translate3d(var(--tc-translate-x, 0), var(--tc-translate-y, 0), 0) ${ul}`,sp={transform:Ot,"transform-cpu":Ot,"transform-gpu":hi,"transform-none":"none"},ap=(e)=>{let t=sp[e.base];return t?{transform:t}:void 0};function Dr(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 di(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 lp=(e)=>{if(e.utility==="scale")return Dr("scale",e);if(e.utility==="scale-x")return Dr("scaleX",e);if(e.utility==="scale-y")return Dr("scaleY",e);if(e.utility==="scale-z")return Dr("scaleZ",e)},cp=(e)=>{if(!e.value)return;let t=ip[e.utility];if(!t)return;let r=di(e);return r!==void 0?{transform:`${t}(${r})`}:void 0},up=(e,t)=>{let r=(o)=>{if(o.includes("/")){let[c,l]=o.split("/");return we(Number(c),Number(l))}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=op[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},fp=(e)=>{if(e.utility==="skew-x"&&e.value){let t=di(e);return t!==void 0?{transform:`skewX(${t})`}:void 0}if(e.utility==="skew-y"&&e.value){let t=di(e);return t!==void 0?{transform:`skewY(${t})`}:void 0}},dp=(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},hp={dramatic:"100px",near:"300px",normal:"500px",midrange:"800px",distant:"1200px"},gp=(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=hp[e.value];if(t)return{perspective:t};if(/^\d+(?:\.\d+)?$/.test(e.value))return{perspective:`${e.value}px`};return}return},mp=(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}},pp=(e)=>el[e.base]?{"backface-visibility":el[e.base]}:void 0,yp=(e)=>tl[e.base]?{"transform-style":tl[e.base]}:void 0,bp=(e)=>rl[e.base]?{"transition-property":rl[e.base]}:void 0;function jr(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 xp=(e)=>{if(e.utility==="duration"&&e.value){let r=jr(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}},vp=(e)=>nl[e.base]?{"transition-timing-function":nl[e.base]}:void 0,wp=(e)=>{if(e.utility==="delay"&&e.value){let r=jr(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}},$p=(e)=>il[e.base]?{"transition-behavior":il[e.base]}:void 0,Cp=(e)=>{if(e.utility!=="animate")return;if(e.arbitrary&&e.value)return{animation:e.value.replace(/_/g," ")};if(e.value&&ol[e.value])return{animation:ol[e.value]};return},Rp=(e)=>sl[e.base]?{"animation-play-state":sl[e.base]}:void 0,kp=(e)=>al[e.base]?{"animation-direction":al[e.base]}:void 0,Sp=(e)=>ll[e.base]?{"animation-fill-mode":ll[e.base]}:void 0,Ap=(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}},Ep=(e)=>{if(e.utility==="animate-duration"&&e.value){let r=jr(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}},Tp=(e)=>{if(e.utility==="animate-delay"&&e.value){let r=jr(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}},Np=(e)=>cl[e.base]?{"animation-timing-function":cl[e.base]}:void 0,fl=[ap,lp,cp,up,fp,dp,gp,mp,pp,yp,bp,$p,xp,vp,wp,Cp,Rp,kp,Sp,Ap,Ep,Tp,Np];var dl={italic:"italic","not-italic":"normal"},hl={"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"},gl={"list-inside":"inside","list-outside":"outside"},ml={none:"none",disc:"disc",decimal:"decimal"},pl={underline:"underline",overline:"overline","line-through":"line-through","no-underline":"none"},yl={uppercase:"uppercase",lowercase:"lowercase",capitalize:"capitalize","normal-case":"none"},bl={"text-wrap":"wrap","text-nowrap":"nowrap","text-balance":"balance","text-pretty":"pretty"},xl={"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"},vl={"whitespace-normal":"normal","whitespace-nowrap":"nowrap","whitespace-pre":"pre","whitespace-pre-line":"pre-line","whitespace-pre-wrap":"pre-wrap","whitespace-break-spaces":"break-spaces"},wl={"break-all":"break-all","break-keep":"keep-all"},$l={"hyphens-none":"none","hyphens-manual":"manual","hyphens-auto":"auto"},Cl={"writing-horizontal-tb":"horizontal-tb","writing-vertical-rl":"vertical-rl","writing-vertical-lr":"vertical-lr"},Rl={"text-orientation-mixed":"mixed","text-orientation-upright":"upright","text-orientation-sideways":"sideways"},kl={"direction-ltr":"ltr","direction-rtl":"rtl"},Sl={"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"},Al={"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"},Op=(e,t)=>{if(e.utility==="font"&&e.value){let r=t.theme.fontFamily[e.value];if(r)return{"font-family":r.join(", ")}}},Ip=(e)=>({antialiased:{"-webkit-font-smoothing":"antialiased","-moz-osx-font-smoothing":"grayscale"},"subpixel-antialiased":{"-webkit-font-smoothing":"auto","-moz-osx-font-smoothing":"auto"}})[e.base],Pp=(e)=>dl[e.base]?{"font-style":dl[e.base]}:void 0,_p=(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}},Lp=(e)=>hl[e.base]?{"font-variant-numeric":hl[e.base]}:void 0,Mp=(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}},Fp=(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}}},Dp=(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})`}}},jp=(e)=>gl[e.base]?{"list-style-position":gl[e.base]}:void 0,Bp=(e)=>{if(e.utility!=="list"||!e.value)return;return ml[e.value]?{"list-style-type":ml[e.value]}:void 0},Up=(e,t)=>{if(pl[e.base])return{"text-decoration-line":pl[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},Wp=(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}},Vp=(e)=>yl[e.base]?{"text-transform":yl[e.base]}:void 0,zp=(e)=>({truncate:{overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"},"text-ellipsis":{"text-overflow":"ellipsis"},"text-clip":{"text-overflow":"clip"}})[e.base],Kp=(e)=>bl[e.base]?{"text-wrap":bl[e.base]}:void 0,Hp=(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}},Gp=(e)=>xl[e.base]?{"vertical-align":xl[e.base]}:void 0,qp=(e)=>vl[e.base]?{"white-space":vl[e.base]}:void 0,Yp=(e)=>{if(e.base==="break-normal")return{"overflow-wrap":"normal","word-break":"normal"};if(e.base==="break-words")return{"overflow-wrap":"break-word"};return wl[e.base]?{"word-break":wl[e.base]}:void 0},Jp=(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},Xp=(e)=>{if(e.utility!=="tab"||!e.value)return;if(e.arbitrary||/^\d+$/.test(e.value))return{"tab-size":e.value};return},Zp=(e)=>$l[e.base]?{hyphens:$l[e.base]}:void 0,Qp=(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}},ey=(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}},ty=(e)=>Cl[e.base]?{"writing-mode":Cl[e.base]}:void 0,ry=(e)=>Rl[e.base]?{"text-orientation":Rl[e.base]}:void 0,ny=(e)=>kl[e.base]?{direction:kl[e.base]}:void 0,iy=(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}},oy=(e,t)=>{if(e.utility==="text-emphasis-color"&&e.value){let r=e.value.split("-");if(r.length===2){let[i,o]=r,s=t.theme.colors[i];if(typeof s==="object"&&s[o])return{"text-emphasis-color":s[o]}}let n=t.theme.colors[e.value];if(typeof n==="string")return{"text-emphasis-color":n};if(typeof n==="object"&&n!==null&&typeof n.DEFAULT==="string")return{"text-emphasis-color":n.DEFAULT}}},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)=>Sl[e.base]?{"font-variant-caps":Sl[e.base]}:void 0,ly=(e)=>Al[e.base]?{"font-variant-ligatures":Al[e.base]}:void 0,El=[Op,Ip,Pp,_p,Lp,ay,ly,Mp,ey,Fp,Dp,jp,Bp,Up,Wp,Vp,zp,Kp,Hp,Gp,qp,Yp,Jp,Xp,Zp,Qp,ty,ry,ny,iy,oy,sy];var Tl={"flex-row":"row","flex-row-reverse":"row-reverse","flex-col":"column","flex-col-reverse":"column-reverse"},Nl={"flex-wrap":"wrap","flex-wrap-reverse":"wrap-reverse","flex-nowrap":"nowrap"},gi={0:"0px",2:"2px",4:"4px",8:"8px"},cy=(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"}},uy=(e)=>{if(e.utility==="scrollbar"&&e.value){let r={auto:"auto",thin:"thin",none:"none"}[e.value];if(r)return{"scrollbar-width":r}}},fy=(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}}},dy=(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)}},hy=(e)=>Tl[e.utility]?{"flex-direction":Tl[e.utility]}:void 0,gy=(e)=>Nl[e.utility]?{"flex-wrap":Nl[e.utility]}:void 0,my=(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},py=(e)=>{if(e.utility==="flex-grow"&&!e.value)return{"flex-grow":"1"};if(e.utility==="flex-grow"&&e.value)return{"flex-grow":e.value}},yy=(e)=>{if(e.utility==="flex-shrink"&&!e.value)return{"flex-shrink":"1"};if(e.utility==="flex-shrink"&&e.value)return{"flex-shrink":e.value}},by=(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},xy=(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},vy=(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},wy=(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},$y=(e,t)=>{let n={p:["padding"],px:["padding-left","padding-right"],py:["padding-top","padding-bottom"],pt:["padding-top"],pr:["padding-right"],pb:["padding-bottom"],pl:["padding-left"],ps:["padding-inline-start"],pe:["padding-inline-end"],m:["margin"],mx:["margin-left","margin-right"],my:["margin-top","margin-bottom"],mt:["margin-top"],mr:["margin-right"],mb:["margin-bottom"],ml:["margin-left"],ms:["margin-inline-start"],me:["margin-inline-end"]}[e.utility];if(!n||!e.value)return;let i=(c)=>{if(c==="auto")return e.utility.charCodeAt(0)===109?"auto":void 0;let l=t.theme.spacing[c];if(l!==void 0)return l;if(e.arbitrary)return c;if(/^\d+(?:\.\d+)?$/.test(c)){let a=Number.parseFloat(c);if(Number.isFinite(a))return`${a*0.25}rem`}return},o;if(e.value.startsWith("-")){if(e.utility.charCodeAt(0)===112)return;let c=e.value.slice(1);if(c==="0")o=t.theme.spacing[c]||"0";else{let l=i(c);o=l===void 0?void 0:`-${l}`}}else o=i(e.value);if(o===void 0)return;let s={};for(let c of n)s[c]=o;return s};function me(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 we(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 Cy=(e,t)=>{if(e.utility==="w"&&e.value){let n=me(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=me(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=me(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},Fe=null,Br=null,Ry={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"}},Sy=new Set(["length","absolute-size","relative-size","percentage","number"]),Ay=/^(?:url|(?:repeating-)?(?:linear|radial|conic)-gradient|image-set|-webkit-image-set|cross-fade|element|paint)\(/i,Il={current:"currentColor",transparent:"transparent",inherit:"inherit"};function Pl(e){let t=new Map;for(let[r,n]of Object.entries(e))if(typeof n==="string")t.set(r,n);else if(typeof n==="object"&&n!==null){for(let[i,o]of Object.entries(n))if(typeof o==="string")t.set(i==="DEFAULT"?r:`${r}-${i}`,o)}return t}var Ey=(e,t)=>{let r=Ry[e.utility];if(!r||!e.value)return;let n=e.value;if(e.arbitrary&&e.typeHint){let a=ky[e.utility]?.[e.typeHint];return a?{[a]:n}:void 0}if(e.arbitrary&&e.utility==="bg"&&Ay.test(n))return{"background-image":n};if(Fe===null||Br!==t.theme.colors)Fe=Pl(t.theme.colors),Br=t.theme.colors;let i=Ne(n);if(i===-1){let a=Fe.get(n);if(a)return{[r]:a}}let o,s=n;if(i!==-1){s=n.slice(0,i);let a=n.slice(i+1);if(a.charCodeAt(0)===91&&a.charCodeAt(a.length-1)===93){let f=Number.parseFloat(a.slice(1,-1));if(Number.isNaN(f)||f<0||f>1)return;o=f}else if(e.modifierArbitrary){let f=Number.parseFloat(a);if(Number.isNaN(f)||f<0||f>1)return;o=f}else{let f=Number.parseInt(a,10);if(Number.isNaN(f)||f<0||f>100)return;o=f/100}let u=Fe.get(s);if(u)return{[r]:ve(u,o)}}let c=Il[s];if(c)return{[r]:c};if((e.arbitrary||s&&s.charCodeAt(0)===91)&&s){let a=o!==void 0?ve(s,o):s;return{[r]:a}}return};function ve(e,t){let r=e;if(e.charCodeAt(0)===91&&e.charCodeAt(e.length-1)===93)r=e.slice(1,-1);if(r.charCodeAt(0)===35){let n=r.slice(1);if(n.length===3||n.length===4)n=n.split("").map((c)=>c+c).join("");let i=Number.parseInt(n.slice(0,2),16),o=Number.parseInt(n.slice(2,4),16),s=Number.parseInt(n.slice(4,6),16);return`rgb(${i} ${o} ${s} / ${t})`}if(r.charCodeAt(0)===114){let n=r.match(/rgb\((\d+)\s+(\d+)\s+(\d+)/);if(n)return`rgb(${n[1]} ${n[2]} ${n[3]} / ${t})`}if(r.charCodeAt(0)===111){let n=r.match(/oklch\(([^)]+)\)/);if(n)return`oklch(${n[1]} / ${t})`}if(r.charCodeAt(0)===104){let n=r.match(/hsl\(([^)]+)\)/);if(n)return`hsl(${n[1]} / ${t})`}if(r!=="inherit"&&r!=="transparent"){let n=Number((t*100).toFixed(2));return`color-mix(in srgb, ${r} ${n}%, transparent)`}return r}function z(e,t,r=!1){let n=Ne(e),i=e,o;if(n!==-1){i=e.slice(0,n);let a=e.slice(n+1);if(a.charCodeAt(0)===91&&a.charCodeAt(a.length-1)===93){if(o=Number.parseFloat(a.slice(1,-1)),Number.isNaN(o)||o<0||o>1)return}else if(r){if(o=Number.parseFloat(a),Number.isNaN(o)||o<0||o>1)return}else{let u=Number.parseInt(a,10);if(Number.isNaN(u)||u<0||u>100)return;o=u/100}}let s={current:"currentColor",transparent:"transparent",inherit:"inherit",auto:"auto"};if(s[i])return o!==void 0?ve(s[i],o):s[i];let c=t.theme.colors[i];if(typeof c==="string")return o!==void 0?ve(c,o):c;if(typeof c==="object"&&c!==null&&typeof c.DEFAULT==="string")return o!==void 0?ve(c.DEFAULT,o):c.DEFAULT;let l=i.split("-");if(l.length>=2){let a=l[l.length-1],u=l.slice(0,-1).join("-"),f=t.theme.colors[u];if(typeof f==="object"&&f[a])return o!==void 0?ve(f[a],o):f[a]}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?ve(i,o):i;return}var Ty=(e,t)=>{if(e.utility!=="placeholder"||!e.value)return;if(Fe===null||Br!==t.theme.colors)Fe=Pl(t.theme.colors),Br=t.theme.colors;let r=e.value,n=Ne(r);if(n===-1){let o=Fe.get(r);if(o)return{properties:{color:o},pseudoElement:"::placeholder"}}else{let o=r.slice(0,n),s=r.slice(n+1),c;if(s.charCodeAt(0)===91&&s.charCodeAt(s.length-1)===93){let a=Number.parseFloat(s.slice(1,-1));if(Number.isNaN(a)||a<0||a>1)return;c=a}else if(e.modifierArbitrary){let a=Number.parseFloat(s);if(Number.isNaN(a)||a<0||a>1)return;c=a}else{let a=Number.parseInt(s,10);if(Number.isNaN(a)||a<0||a>100)return;c=a/100}let l=Fe.get(o);if(l)return{properties:{color:ve(l,c)},pseudoElement:"::placeholder"}}let i=Il[e.value];if(i)return{properties:{color:i},pseudoElement:"::placeholder"};return},Ny=(e,t)=>{if(e.utility==="text"&&e.value){let r=e.value,n,i=r.lastIndexOf("/");if(i!==-1&&!e.value.startsWith("[")&&!r.slice(i+1).includes("]"));if(i!==-1){let s=r.slice(0,i),c=r.slice(i+1);if(c&&(t.theme.fontSize[s]||e.arbitrary)){r=s;let l={none:"1",tight:"1.25",snug:"1.375",normal:"1.5",relaxed:"1.625",loose:"2",3:"0.75rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem"};n=t.theme.lineHeight?.[c]??l[c]??c}}if(e.arbitrary){if(e.typeHint){if(!Sy.has(e.typeHint))return;let c={"font-size":r};if(n)c["line-height"]=n;return c}if(/^#|^rgb|^hsl|^hwb|^lab|^lch|^oklch|^oklab|^color\(|^var\(--/.test(r))return;let s={"font-size":r};if(n)s["line-height"]=n;return s}let o=t.theme.fontSize[r];if(o)return{"font-size":o[0],"line-height":n??o[1].lineHeight}}},Oy=(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},Iy=(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},Py=(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}},_y=(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}},Ly=(e,t)=>{let r={"border-t":"border-top-width","border-r":"border-right-width","border-b":"border-bottom-width","border-l":"border-left-width","border-x":["border-left-width","border-right-width"],"border-y":["border-top-width","border-bottom-width"],"border-s":"border-inline-start-width","border-e":"border-inline-end-width"},n={"border-t":"border-top-color","border-r":"border-right-color","border-b":"border-bottom-color","border-l":"border-left-color","border-x":["border-left-color","border-right-color"],"border-y":["border-top-color","border-bottom-color"],"border-s":"border-inline-start-color","border-e":"border-inline-end-color"},i=r[e.utility];if(!i)return;if(!e.value){let s=i;if(Array.isArray(s))return s.reduce((c,l)=>({...c,[l]:"1px"}),{});return{[s]:"1px"}}if(e.arbitrary){let s=e.value,a=(/^#|^(?:rgb|rgba|hsl|hsla|oklch|oklab|lab|lch)\(|^(?:currentColor|transparent|inherit)$/i.test(s)?n[e.utility]:i)??i;if(Array.isArray(a))return a.reduce((u,f)=>({...u,[f]:s}),{});return{[a]:s}}if(gi[e.value]){let s=i;if(Array.isArray(s))return s.reduce((c,l)=>({...c,[l]:gi[e.value]}),{});return{[s]:gi[e.value]}}let o=n[e.utility];if(o&&t){let s=e.value.split("-");if(s.length>=2){let l=s[s.length-1],a=s.slice(0,-1).join("-"),u=t.theme.colors[a];if(u&&typeof u==="object"&&u[l]){let f=o;if(Array.isArray(f))return f.reduce((d,h)=>({...d,[h]:u[l]}),{});return{[f]:u[l]}}}let c=t.theme.colors[e.value];if(typeof c==="string"){let l=o;if(Array.isArray(l))return l.reduce((a,u)=>({...a,[u]:c}),{});return{[l]:c}}if(c&&typeof c==="object"&&typeof c.DEFAULT==="string"){let l=o;if(Array.isArray(l))return l.reduce((a,u)=>({...a,[u]:c.DEFAULT}),{});return{[l]:c.DEFAULT}}if(e.value==="transparent"||e.value==="current"||e.value==="inherit"){let l=e.value==="current"?"currentColor":e.value,a=o;if(Array.isArray(a))return a.reduce((u,f)=>({...u,[f]:l}),{});return{[a]:l}}}return};function Je(e,t){if(!e.value)return t.theme.borderRadius.DEFAULT;if(t.theme.borderRadius[e.value]!==void 0)return t.theme.borderRadius[e.value];if(e.arbitrary)return e.value;return}var Ol={t:["border-top-left-radius","border-top-right-radius"],r:["border-top-right-radius","border-bottom-right-radius"],b:["border-bottom-left-radius","border-bottom-right-radius"],l:["border-top-left-radius","border-bottom-left-radius"],tl:["border-top-left-radius"],tr:["border-top-right-radius"],bl:["border-bottom-left-radius"],br:["border-bottom-right-radius"],s:["border-start-start-radius","border-end-start-radius"],e:["border-start-end-radius","border-end-end-radius"],ss:["border-start-start-radius"],se:["border-start-end-radius"],es:["border-end-start-radius"],ee:["border-end-end-radius"]},My=(e,t)=>{if(e.utility==="rounded"){if(e.arbitrary&&e.value)return{"border-radius":e.value};if(e.value&&Ol[e.value]){let o=t.theme.borderRadius.DEFAULT,s={};for(let c of Ol[e.value])s[c]=o;return s}let i=e.value?t.theme.borderRadius[e.value]:t.theme.borderRadius.DEFAULT;return i?{"border-radius":i}:void 0}if(e.utility==="rounded-s"){let i=Je(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=Je(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=Je(e,t);if(i===void 0)return;return{"border-start-start-radius":i}}if(e.utility==="rounded-se"){let i=Je(e,t);if(i===void 0)return;return{"border-start-end-radius":i}}if(e.utility==="rounded-es"){let i=Je(e,t);if(i===void 0)return;return{"border-end-start-radius":i}}if(e.utility==="rounded-ee"){let i=Je(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=Je(e,t);if(i===void 0)return;let o={};for(let s of n)o[s]=i;return o}},mi=[ya,$y,Cy,wy,Ny,Py,...El,Oy,Iy,...fa,...ua,...ai,Ty,Ey,...Zs,...Qa,hy,gy,my,py,yy,by,xy,vy,...ma,...fl,...ai,...Ba,...ha,Ly,_y,My,dy,uy,fy,cy];function xi(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]=xi(o,i);else if(i!==void 0)r[n]=i}return r}var Fy={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"}},Dy={"flex-row":{"flex-direction":"row"},"flex-row-reverse":{"flex-direction":"row-reverse"},"flex-col":{"flex-direction":"column"},"flex-col-reverse":{"flex-direction":"column-reverse"}},jy={"flex-wrap":{"flex-wrap":"wrap"},"flex-wrap-reverse":{"flex-wrap":"wrap-reverse"},"flex-nowrap":{"flex-wrap":"nowrap"}},By={"flex-1":{flex:"1 1 0%"},"flex-auto":{flex:"1 1 auto"},"flex-initial":{flex:"0 1 auto"},"flex-none":{flex:"none"}},Uy={grow:{"flex-grow":"1"},"grow-0":{"flex-grow":"0"},shrink:{"flex-shrink":"1"},"shrink-0":{"flex-shrink":"0"}},Wy={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"},Vy={start:"flex-start",end:"flex-end",center:"center",baseline:"baseline",stretch:"stretch","center-safe":"safe center","end-safe":"safe flex-end"},zy={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"},Ky={auto:"auto",start:"flex-start",end:"flex-end",center:"center",stretch:"stretch",baseline:"baseline","center-safe":"safe center","end-safe":"safe flex-end"},Hy={"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"}},Gy={transform:{transform:Ot},"transform-cpu":{transform:Ot},"transform-gpu":{transform:hi},"transform-none":{transform:"none"}},ht={"transition-timing-function":"cubic-bezier(0.4, 0, 0.2, 1)","transition-duration":"150ms"},qy={"transition-none":{"transition-property":"none"},"transition-all":{"transition-property":"all",...ht},transition:{"transition-property":"color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter",...ht},"transition-colors":{"transition-property":"color, background-color, border-color, text-decoration-color, fill, stroke",...ht},"transition-opacity":{"transition-property":"opacity",...ht},"transition-shadow":{"transition-property":"box-shadow",...ht},"transition-transform":{"transition-property":"transform",...ht}},Yy={"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)"}},Jy={"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"}},Xy={spin:`@keyframes spin {
357
+ `.trim()};var dt={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:[qt],presets:[],cssVariables:!1},si=null;async function Js(){if(!si){await Promise.resolve().then(() => Ys());si=await qs({name:"css",defaultConfig:dt})}return si}var ai=dt;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 Or="0 0 #0000",Ch=["inset-shadow","inset-ring-shadow","ring-offset-shadow","ring-shadow","shadow"],W=Ch.map((e)=>`var(--tc-${e}, 0 0 #0000)`).join(", ");var Ir={"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"},Rh={...Ir,prose:"65ch"};function Qs(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 kh=(e,t)=>{if(e.utility==="min-w"&&e.value){let r=pe(e,t,Ir);return r!==void 0?{"min-width":r}:void 0}if(e.utility==="max-w"&&e.value){let r=pe(e,t,Rh);return r!==void 0?{"max-width":r}:void 0}if(e.utility==="min-h"&&e.value){let r={...Ir,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={...Ir,screen:"100vh"},n=pe(e,t,r);return n!==void 0?{"max-height":n}:void 0}},Sh=(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":W}}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 Qs(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")},Ah=(e)=>{if(e.utility==="border-opacity"&&e.value)return Qs(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 Xs(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 Eh=(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=Xs(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=Xs(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])"}}},Th=(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 Zs(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 Nh(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 Oh=(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=Zs(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=Zs(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=Nh(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])"}}},Ih=(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 c=(u)=>{if(!i)return u;let f=u.match(/^(oklch|rgb|hsl|oklab|lab|lch)\(([^)]+)\)$/i);if(f){let d=f[1],h=f[2].split("/")[0].trim();return`${d}(${h} / ${i})`}if(/^#[0-9a-f]{3,8}$/i.test(u)){let d=u.replace("#",""),h=(y)=>Number.parseInt(y.length===1?y+y:y,16),p=h(d.slice(0,d.length===3?1:2)),g=h(d.slice(d.length===3?1:2,d.length===3?2:4)),m=h(d.slice(d.length===3?2:4,d.length===3?3:6));return`rgb(${p} ${g} ${m} / ${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 l=t.theme.colors[o];if(typeof l==="string")return c(Y(o,l,o,t.colorVariables));if(typeof l==="object"&&l!==null&&typeof l.DEFAULT==="string")return c(Y(o,l.DEFAULT,o,t.colorVariables));let a=o.split("-");if(a.length>=2){let u=a.slice(0,-1).join("-"),f=a[a.length-1],d=t.theme.colors[u];if(typeof d==="object"&&d[f])return c(Y(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 c(o);return};if(e.utility==="from"&&e.value){let n=r(e.value);if(n===void 0)return;return{"--tc-gradient-from":n,"--tc-gradient-to":"rgb(255 255 255 / 0)","--tc-gradient-stops":"var(--tc-gradient-from), var(--tc-gradient-to)"}}if(e.utility==="via"&&e.value){let n=r(e.value);if(n===void 0)return;return{"--tc-gradient-to":"rgb(255 255 255 / 0)","--tc-gradient-stops":`var(--tc-gradient-from), ${n}, var(--tc-gradient-to)`}}if(e.utility==="to"&&e.value){let n=r(e.value);if(n===void 0)return;return{"--tc-gradient-to":n,"--tc-gradient-stops":"var(--tc-gradient-from), var(--tc-gradient-to)"}}},Ph=(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}},_h=(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}},Lh=(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}},Mh=(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}},Fh=(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}}},Dh=(e)=>{if(e.arbitrary&&e.utility&&e.value&&e.base.startsWith("["))return{[e.utility]:e.value}},ea=[kh,Sh,Ah,Th,Eh,Oh,Ih,Ph,_h,Lh,Mh,Fh,Dh];var ta={"bg-origin-border":"border-box","bg-origin-padding":"padding-box","bg-origin-content":"content-box"},ra={"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"},na={"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"},ia={"bg-auto":"auto","bg-cover":"cover","bg-contain":"contain"},li=null,oa=null;function jh(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 Bh(e){return e.replace(/rgba?\([^)]+\)/g,"var(--tc-shadow-color)")}var Uh=(e)=>{if(e.utility==="bg"&&e.value){let t={fixed:"fixed",local:"local",scroll:"scroll"};return t[e.value]?{"background-attachment":t[e.value]}:void 0}return},Vh=(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},sa={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"},Wh=new Set(["srgb","srgb-linear","oklab","oklch","lab","lch","hsl","hwb","xyz","xyz-d50","xyz-d65","display-p3","a98-rgb","prophoto-rgb","rec2020"]),zh=new Set(["shorter","longer","increasing","decreasing"]);function Kh(e){if(Wh.has(e))return`in ${e}`;if(zh.has(e))return`in oklch ${e} hue`;return}var Hh=(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=Kh(n),i===void 0)return}let o=r.charCodeAt(0)===45,s=o?r.slice(1):r,c,l="";if(s==="conic")c="conic-gradient";else if(s==="radial")c="radial-gradient";else if(s.startsWith("conic-")){let u=s.slice(6);if(!/^\d+(?:\.\d+)?$/.test(u))return;c="conic-gradient",l=`from ${o?"-":""}${u}deg`}else if(s.startsWith("linear-")||s.startsWith("gradient-")){let u=s.slice(s.indexOf("-")+1);if(c="linear-gradient",u.startsWith("to-")){let f=sa[u.slice(3)];if(f===void 0)return;l=f}else if(/^\d+(?:\.\d+)?$/.test(u))l=`${o?"-":""}${u}deg`;else return}else return;if(!l&&i===void 0)return;let a=[l,i].filter(Boolean).join(" ");return{"background-image":a?`${c}(${a}, var(--tc-gradient-stops))`:`${c}(var(--tc-gradient-stops))`}},Gh=(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=sa[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},qh=(e)=>ta[e.base]?{"background-origin":ta[e.base]}:void 0,Yh=(e)=>ra[e.base]?{"background-position":ra[e.base]}:void 0,Jh=(e)=>na[e.base]?{"background-repeat":na[e.base]}:void 0,Xh=(e)=>ia[e.base]?{"background-size":ia[e.base]}:void 0,Zh=(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},Qh=(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}},eg=(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":Or,"box-shadow":W};let i=Bh(n);return{"--tc-shadow":n,"--tc-shadow-colored":i,"box-shadow":W}}},tg=(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(li===null||oa!==t.theme.colors)li=jh(t.theme.colors),oa=t.theme.colors;let r=e.value,n=Oe(r),i,o;if(n!==-1){i=r.slice(0,n);let l=r.slice(n+1);if(l.charCodeAt(0)===91&&l.charCodeAt(l.length-1)===93){let a=Number.parseFloat(l.slice(1,-1));if(Number.isNaN(a)||a<0||a>1)return;o=a}else if(e.modifierArbitrary){let a=Number.parseFloat(l);if(Number.isNaN(a)||a<0||a>1)return;o=a}else{let a=Number.parseInt(l,10);if(Number.isNaN(a)||a<0||a>100)return;o=a/100}}else i=r;let s=li.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 It(e){return`${e} var(--tc-text-shadow-color, rgba(0, 0, 0, 0.05))`}var rg=(e,t)=>{if(e.utility!=="text-shadow")return;let r={sm:It("0 1px 2px"),DEFAULT:It("0 1px 3px"),md:It("0 4px 6px"),lg:It("0 10px 15px"),xl:It("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}},ng=(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}},ig=(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}},og=(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}},sg=(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},ci=[Uh,Vh,Hh,Gh,qh,Yh,Jh,Xh,Zh,Qh,eg,tg,rg,ng,ig,og,sg];var aa={add:"add",subtract:"subtract",intersect:"intersect",exclude:"exclude"},la={alpha:"alpha",luminance:"luminance",match:"match-source"},ca={auto:"auto",cover:"cover",contain:"contain"},ua={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"},fa={repeat:"repeat","no-repeat":"no-repeat"},ag=(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(aa[t]!==void 0)return{"mask-composite":aa[t]};if(la[t]!==void 0)return{"mask-mode":la[t]};if(ca[t]!==void 0)return{"mask-size":ca[t]};if(ua[t]!==void 0)return{"mask-position":ua[t]};if(fa[t]!==void 0)return{"mask-repeat":fa[t]};if(t==="no-clip")return{"mask-clip":"no-clip"};return},lg=(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 S(e,t){return`var(--tc-mask-${e}, ${t})`}function Ye(){return{"mask-image":`${S("linear",qe)}, ${S("radial",qe)}, ${S("conic",qe)}`,"mask-composite":"intersect"}}var cg=[S("left",qe),S("right",qe),S("bottom",qe),S("top",qe)].join(", "),ug={t:["top"],r:["right"],b:["bottom"],l:["left"],x:["right","left"],y:["top","bottom"]};function fg(e){let t=`${S(`${e}-from-color`,"black")} ${S(`${e}-from-position`,"0%")}`,r=`${S(`${e}-to-color`,"transparent")} ${S(`${e}-to-position`,"100%")}`;return`linear-gradient(to ${e}, ${t}, ${r})`}var dg=[S("linear-position","0deg"),`${S("linear-from-color","black")} ${S("linear-from-position","0%")}`,`${S("linear-to-color","transparent")} ${S("linear-to-position","100%")}`].join(", "),hg=/^(?:var|rgb|rgba|hsl|hsla|oklch|oklab|lab|lch|color|color-mix)\(/;function Pr(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||hg.test(e)?{color:e}:{position:e};let n=z(e,r,!1);return n===void 0?void 0:{color:n}}function _r(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 gg=(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(${S("linear-stops",S("linear-position","0deg"))})`,"--tc-mask-linear-position":`calc(1deg * ${n?"-":""}${o})`};if(n)return;let s=_r(o);if(s===void 0)return;let c=Pr(s.token,e.arbitrary,t);if(c===void 0)return;let l={...Ye(),"--tc-mask-linear-stops":dg,"--tc-mask-linear":"linear-gradient(var(--tc-mask-linear-stops))"};if(c.color!==void 0)l[`--tc-mask-linear-${s.stop}-color`]=c.color;else l[`--tc-mask-linear-${s.stop}-position`]=c.position;return l},mg=(e,t)=>{if(e.utility!=="mask"||!e.value||e.arbitrary)return;let r=e.value,n=r.indexOf("-");if(n===-1)return;let i=ug[r.slice(0,n)];if(i===void 0)return;let o=_r(r.slice(n+1));if(o===void 0)return;let s=Pr(o.token,e.arbitrary,t);if(s===void 0)return;let c={...Ye(),"--tc-mask-linear":cg};for(let l of i)if(c[`--tc-mask-${l}`]=fg(l),s.color!==void 0)c[`--tc-mask-${l}-${o.stop}-color`]=s.color;else c[`--tc-mask-${l}-${o.stop}-position`]=s.position;return c},pg=[`${S("radial-shape","ellipse")} ${S("radial-size","farthest-corner")} at ${S("radial-position","center")}`,`${S("radial-from-color","black")} ${S("radial-from-position","0%")}`,`${S("radial-to-color","transparent")} ${S("radial-to-position","100%")}`].join(", "),yg=new Set(["closest-side","closest-corner","farthest-side","farthest-corner"]),bg={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"},xg=[`from ${S("conic-position","0deg")}`,`${S("conic-from-color","black")} ${S("conic-from-position","0%")}`,`${S("conic-to-color","transparent")} ${S("conic-to-position","100%")}`].join(", "),vg=(e,t)=>{if(e.utility==="mask-radial"&&e.arbitrary&&e.value)return{...Ye(),"--tc-mask-radial":`radial-gradient(${S("radial-stops",S("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 c=bg[n.slice(3)];return c===void 0?void 0:{"--tc-mask-radial-position":c}}if(yg.has(n))return{"--tc-mask-radial-size":n};let i=_r(n);if(i===void 0)return;let o=Pr(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},wg=(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(${S("conic-stops",S("conic-position","0deg"))})`,"--tc-mask-conic-position":`calc(1deg * ${n?"-":""}${o})`};if(n)return;let s=_r(o);if(s===void 0)return;let c=Pr(s.token,e.arbitrary,t);if(c===void 0)return;let l={...Ye(),"--tc-mask-conic-stops":xg,"--tc-mask-conic":"conic-gradient(var(--tc-mask-conic-stops))"};if(c.color!==void 0)l[`--tc-mask-conic-${s.stop}-color`]=c.color;else l[`--tc-mask-conic-${s.stop}-position`]=c.position;return l},da=[gg,mg,vg,wg,ag,lg];var $g={"2xs":"inset 0 1px",xs:"inset 0 1px 1px",sm:"inset 0 2px 4px"},Cg="rgb(0 0 0 / 0.05)",Rg=/^(?:var|rgb|rgba|hsl|hsla|oklch|oklab|lab|lch|color|color-mix)\(/;function di(e){return e.charCodeAt(0)===35||Rg.test(e)}function kg(e){return/^-?[\d.]+[a-z%]*$/i.test(e)||e.startsWith("calc(")||e.startsWith("var(")}function Sg(e,t){let r=e.trim().split(/\s+/),n=r[r.length-1];if(r.length>1&&!kg(n))return`inset ${r.slice(0,-1).join(" ")} var(${t}, ${n})`;return`inset ${e} var(${t}, currentcolor)`}function ui(e){return{"--tc-inset-shadow":e,"box-shadow":W}}var Ag=(e,t)=>{if(e.utility==="inset-shadow"&&e.arbitrary&&e.value){if(!/\s/.test(e.value)&&di(e.value))return{"--tc-inset-shadow-color":e.value};return ui(Sg(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=$g[r];if(n!==void 0)return ui(`${n} var(--tc-inset-shadow-color, ${Cg})`);if(r==="none")return ui(`inset ${Or}`);let i=z(r,t,e.modifierArbitrary);return i===void 0?void 0:{"--tc-inset-shadow-color":i}};function fi(e){return{"--tc-inset-ring-shadow":`inset 0 0 0 ${e} var(--tc-inset-ring-color, currentcolor)`,"box-shadow":W}}var Eg=(e,t)=>{if(e.utility==="inset-ring"&&e.arbitrary&&e.value){if(di(e.value))return{"--tc-inset-ring-color":e.value};return fi(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 fi("1px");let r=e.value.slice(5);if(/^\d+(?:\.\d+)?$/.test(r))return fi(`${r}px`);let n=z(r,t,e.modifierArbitrary);return n===void 0?void 0:{"--tc-inset-ring-color":n}},Tg=(e,t)=>{if(e.utility!=="drop-shadow"||!e.value)return;if(e.arbitrary){if(/\s/.test(e.value))return;return di(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}},ha=[Ag,Eg,Tg];var Lr={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"},ga={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 ht(e,t){return e.utility==="form"&&e.value===t||e.utility===`form-${t}`&&!e.value}var Ng=(e)=>{if(ht(e,"input"))return Lr},Og=(e)=>{if(ht(e,"textarea"))return Lr},Ig=(e)=>{if(ht(e,"select"))return{...Lr,"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"}},Pg=(e)=>{if(ht(e,"multiselect"))return{...Lr,"background-image":"initial","background-position":"initial","background-repeat":"unset","background-size":"initial","print-color-adjust":"unset"}},_g=(e)=>{if(ht(e,"checkbox"))return{...ga,"border-radius":"0px"}},Lg=(e)=>{if(ht(e,"radio"))return{...ga,"border-radius":"100%"}},ma=[Ng,Og,Ig,Pg,_g,Lg];var Mg={gap:"gap","gap-x":"column-gap","gap-y":"row-gap"},gt=/^-?\d+$/,pa=/^span-(\d+)$/,Fg=(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}},Dg=(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(pa);if(t)return{"grid-column":`span ${t[1]} / span ${t[1]}`};if(gt.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"||gt.test(e.value))return{"grid-column-start":e.value};return}if(e.utility==="col-end"&&e.value){if(e.arbitrary||e.value==="auto"||gt.test(e.value))return{"grid-column-end":e.value};return}},jg=(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}},Bg=(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(pa);if(t)return{"grid-row":`span ${t[1]} / span ${t[1]}`};if(gt.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"||gt.test(e.value))return{"grid-row-start":e.value};return}if(e.utility==="row-end"&&e.value){if(e.arbitrary||e.value==="auto"||gt.test(e.value))return{"grid-row-end":e.value};return}},Ug=(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},Vg=(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}},Wg=(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 zg(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 Kg=(e,t)=>{let r=Mg[e.utility];if(!r||!e.value)return;let n=zg(e,t,e.value);return n!==void 0?{[r]:n}:void 0},Hg=(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},Gg=(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},qg=(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},ya=[Fg,Dg,jg,Bg,Ug,Vg,Wg,Kg,Hg,Gg,qg];import{existsSync as ba,readFileSync as Yg,readdirSync as Jg}from"fs";import{join as Mr}from"path";var Fr=new Map;function Xg(e){if(Fr.has(e))return Fr.get(e);let t=[Mr(process.cwd(),"node_modules","@iconify-json",e,"icons.json"),Mr(process.cwd(),"node_modules",".bun","@iconify-json",e,"icons.json")],r=Mr(process.cwd(),"node_modules",".bun");if(ba(r))try{let n=`@iconify-json+${e}@`;for(let i of Jg(r))if(i.startsWith(n))t.push(Mr(r,i,"node_modules","@iconify-json",e,"icons.json"))}catch{}for(let n of t)if(ba(n))try{let i=JSON.parse(Yg(n,"utf-8"));return Fr.set(e,i),i}catch{}return Fr.set(e,null),null}function Zg(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 Qg(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 em(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 tm=/^i-([a-z][a-z0-9]*(?:-[a-z0-9]+)*)-(.+)$/;function rm(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=Xg(n);if(!o)continue;let s=Zg(o,i);if(s)return{collection:o,icon:s}}return}var xa=(e,t)=>{if(!tm.test(e.base))return;let r=rm(e.base);if(!r)return;let{collection:n,icon:i}=r,o=em(Qg(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 va={"border-collapse":"collapse","border-separate":"separate"},wa={"caption-top":"top","caption-bottom":"bottom"},$a={"field-sizing-content":"content","field-sizing-fixed":"fixed"},Ca={"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"},Ra={"pointer-events-none":"none","pointer-events-auto":"auto"},ka={"resize-none":"none",resize:"both","resize-y":"vertical","resize-x":"horizontal"},Sa={"scroll-auto":"auto","scroll-smooth":"smooth"},Aa={"snap-none":"none","snap-x":"x var(--tc-scroll-snap-strictness, proximity)","snap-y":"y var(--tc-scroll-snap-strictness, proximity)","snap-both":"both var(--tc-scroll-snap-strictness, proximity)"},Ea={"snap-mandatory":"mandatory","snap-proximity":"proximity"},Ta={"snap-start":"start","snap-end":"end","snap-center":"center","snap-align-none":"none"},Na={"snap-normal":"normal","snap-always":"always"},Oa={"touch-auto":"auto","touch-none":"none","touch-pan-x":"pan-x","touch-pan-left":"pan-left","touch-pan-right":"pan-right","touch-pan-y":"pan-y","touch-pan-up":"pan-up","touch-pan-down":"pan-down","touch-pinch-zoom":"pinch-zoom","touch-manipulation":"manipulation"},Ia={"select-none":"none","select-text":"text","select-all":"all","select-auto":"auto"},Pa={"will-change-auto":"auto","will-change-scroll":"scroll-position","will-change-contents":"contents","will-change-transform":"transform"},_a={"stroke-linecap-butt":"butt","stroke-linecap-round":"round","stroke-linecap-square":"square"},La={"stroke-linejoin-miter":"miter","stroke-linejoin-round":"round","stroke-linejoin-bevel":"bevel"},Ma={"forced-color-adjust-auto":"auto","forced-color-adjust-none":"none"},hi={none:"0",sm:"4px",DEFAULT:"8px",md:"12px",lg:"16px",xl:"24px","2xl":"40px","3xl":"64px"};function ja(e){if(e.arbitrary)return e.value;if(/^\d+(?:\.\d+)?$/.test(e.value))return`${Number(e.value)/100}`;return}function Ba(e){if(!e.value)return hi.DEFAULT;if(hi[e.value]!==void 0)return hi[e.value];if(e.arbitrary)return e.value;if(/^\d+(?:\.\d+)?$/.test(e.value))return`${e.value}px`;return}var Ua=["brightness","contrast","grayscale","invert","saturate","sepia"],nm=["blur","brightness","contrast","grayscale","hue-rotate","invert","saturate","sepia","drop-shadow"],im=["blur","brightness","contrast","grayscale","hue-rotate","invert","opacity","saturate","sepia"],om=nm.map((e)=>`var(--tc-${e}, )`).join(" "),Fa=im.map((e)=>`var(--tc-backdrop-${e}, )`).join(" ");function Je(e,t){return{[`--tc-${e}`]:t,filter:om}}function Dr(e,t){return{[`--tc-backdrop-${e}`]:t,"-webkit-backdrop-filter":Fa,"backdrop-filter":Fa}}var sm=(e)=>{if(e.base==="filter-none")return{filter:"none"};if(e.utility==="blur"){let t=Ba(e);return t!==void 0?Je("blur",`blur(${t})`):void 0}if(Ua.includes(e.utility)&&e.value){let t=ja(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}},am=(e)=>{if(e.base==="backdrop-filter-none")return{"backdrop-filter":"none"};if(e.utility==="backdrop-blur"){let t=Ba(e);return t!==void 0?Dr("blur",`blur(${t})`):void 0}if(e.utility.startsWith("backdrop-")&&e.value){let t=e.utility.slice(9);if(Ua.includes(t)||t==="opacity"){let r=ja(e);if(r===void 0)return;return Dr(t,`${t}(${r})`)}if(t==="hue-rotate"){if(e.arbitrary)return Dr(t,`hue-rotate(${e.value})`);if(/^-?\d+(?:\.\d+)?$/.test(e.value))return Dr(t,`hue-rotate(${e.value}deg)`);return}}},lm=(e)=>va[e.base]?{"border-collapse":va[e.base]}:void 0,cm=(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}`}},um=(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},fm=(e)=>wa[e.base]?{"caption-side":wa[e.base]}:void 0,dm=(e,t)=>{if(e.utility==="accent"&&e.value){let r=z(e.value,t,e.modifierArbitrary);if(r)return{"accent-color":r}}},hm=(e)=>{let t={"appearance-none":"none","appearance-auto":"auto","appearance-base":"base"};return t[e.base]?{appearance:t[e.base]}:void 0},gm=(e,t)=>{if(e.utility==="caret"&&e.value){let r=z(e.value,t,e.modifierArbitrary);if(r)return{"caret-color":r}}},mm={normal:"normal",light:"light",dark:"dark","light-dark":"light dark","only-dark":"only dark","only-light":"only light"},Da=(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=mm[r];return n?{"color-scheme":n}:void 0},pm=(e)=>$a[e.base]?{"field-sizing":$a[e.base]}:void 0,ym=(e)=>Ca[e.base]?{cursor:Ca[e.base]}:void 0,bm=(e)=>Ra[e.base]?{"pointer-events":Ra[e.base]}:void 0,xm=(e)=>ka[e.base]?{resize:ka[e.base]}:void 0,vm=(e)=>Sa[e.base]?{"scroll-behavior":Sa[e.base]}:void 0,wm=(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},$m=(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},Cm=(e)=>{if(Aa[e.base])return{"scroll-snap-type":Aa[e.base]};if(Ea[e.base])return{"--tc-scroll-snap-strictness":Ea[e.base]};if(Ta[e.base])return{"scroll-snap-align":Ta[e.base]};if(Na[e.base])return{"scroll-snap-stop":Na[e.base]}},Rm=(e)=>Oa[e.base]?{"touch-action":Oa[e.base]}:void 0,km=(e)=>Ia[e.base]?{"user-select":Ia[e.base]}:void 0,Sm=(e)=>Pa[e.base]?{"will-change":Pa[e.base]}:void 0,Am=(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}}},Em=(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}}},Tm=(e)=>{if(e.utility==="stroke"&&e.value){if(e.arbitrary||/^\d+(?:\.\d+)?$/.test(e.value))return{"stroke-width":e.value};return}},Nm=(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}},Om=(e)=>{if(e.utility==="stroke-dashoffset"&&e.value){if(e.arbitrary||/^-?\d+(?:\.\d+)?$/.test(e.value))return{"stroke-dashoffset":e.value};return}},Im=(e)=>_a[e.base]?{"stroke-linecap":_a[e.base]}:void 0,Pm=(e)=>La[e.base]?{"stroke-linejoin":La[e.base]}:void 0,_m=(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},Lm=(e)=>Ma[e.base]?{"forced-color-adjust":Ma[e.base]}:void 0,Va=[sm,am,lm,cm,um,fm,dm,hm,Da,gm,Da,pm,ym,bm,xm,vm,wm,$m,Cm,Rm,km,Sm,Am,Em,Tm,Nm,Om,Im,Pm,_m,Lm];function $e(e,t){let r=e/t*100;if(!Number.isFinite(r))return;return`${Mm(r)}%`}function Mm(e){if(Number.isInteger(e))return String(e);return e.toFixed(6).replace(/\.?0+$/,"")}var Wa={"column-fill-auto":"auto","column-fill-balance":"balance","column-fill-balance-all":"balance-all"},za={"column-span-all":"all","column-span-none":"none"},Ka={"box-decoration-clone":"clone","box-decoration-slice":"slice"},Ha={"box-border":"border-box","box-content":"content-box"},Ga={"float-start":"inline-start","float-end":"inline-end","float-right":"right","float-left":"left","float-none":"none"},qa={"clear-start":"inline-start","clear-end":"inline-end","clear-left":"left","clear-right":"right","clear-both":"both","clear-none":"none"},Ya={isolate:"isolate","isolation-auto":"auto"},Ja={"object-contain":"contain","object-cover":"cover","object-fill":"fill","object-none":"none","object-scale-down":"scale-down"},Xa={"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"},Za={"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"},Qa={visible:"visible",invisible:"hidden",collapse:"collapse"},Fm=(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}},Dm=(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}},jm=(e)=>Wa[e.base]?{"column-fill":Wa[e.base]}:void 0,Bm=(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}},Um=(e,t)=>{if(e.utility==="column-rule"&&e.value){let r={"0":"0px","1":"1px","2":"2px","4":"4px","8":"8px"};if(r[e.value])return{"column-rule-width":r[e.value]};let n=e.value.split("-");if(n.length===2){let[s,c]=n,l=t.theme.colors[s];if(typeof l==="object"&&l[c])return{"column-rule-color":Y(e.value,l[c],s,t.colorVariables)}}let i=t.theme.colors[e.value];if(typeof i==="string")return{"column-rule-color":Y(e.value,i,e.value,t.colorVariables)};if(typeof i==="object"&&i!==null&&typeof i.DEFAULT==="string")return{"column-rule-color":Y(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]}}},Vm=(e)=>za[e.base]?{"column-span":za[e.base]}:void 0,Wm=(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],zm=(e)=>Ka[e.base]?{"box-decoration-break":Ka[e.base]}:void 0,Km=(e)=>Ha[e.base]?{"box-sizing":Ha[e.base]}:void 0,Hm=(e)=>Ga[e.base]?{float:Ga[e.base]}:void 0,Gm=(e)=>qa[e.base]?{clear:qa[e.base]}:void 0,qm=(e)=>Ya[e.base]?{isolation:Ya[e.base]}:void 0,el=["size","inline-size","layout","paint","style"],Ym=el.map((e)=>`var(--tc-contain-${e}, )`).join(" "),Jm=["none","content","strict"],Xm=(e)=>{if(e.utility!=="contain"||!e.value)return;if(e.arbitrary)return{contain:e.value};if(Jm.includes(e.value))return{contain:e.value};if(el.includes(e.value))return{[`--tc-contain-${e.value}`]:e.value,contain:Ym};return},Zm=(e)=>Ja[e.base]?{"object-fit":Ja[e.base]}:void 0,Qm=(e)=>Xa[e.base]?{"object-position":Xa[e.base]}:void 0,ep=(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}}},tp=(e)=>{let t=e.base.startsWith("overscroll-x")?"overscroll-behavior-x":e.base.startsWith("overscroll-y")?"overscroll-behavior-y":"overscroll-behavior";return Za[e.base]?{[t]:Za[e.base]}:void 0},rp=(e)=>{if(["static","fixed","absolute","relative","sticky"].includes(e.utility))return{position:e.utility}},np=(e,t)=>{let n={inset:["top","right","bottom","left"],"inset-x":["left","right"],"inset-y":["top","bottom"],top:["top"],right:["right"],bottom:["bottom"],left:["left"],start:["inset-inline-start"],end:["inset-inline-end"]}[e.utility];if(!n||!e.value)return;let i=(c)=>{if(c.includes("/")&&!e.arbitrary){let[a,u]=c.split("/").map(Number);if(!Number.isNaN(a)&&!Number.isNaN(u)&&u!==0)return $e(a,u);return}if(c==="full")return"100%";if(c==="auto")return"auto";if(e.arbitrary)return c;let l=t.theme.spacing[c];if(l!==void 0)return l;if(/^\d+(?:\.\d+)?$/.test(c))return`${Number.parseFloat(c)*0.25}rem`;return},o;if(e.value.startsWith("-")){let c=e.value.slice(1),l=i(c);if(l===void 0)o=void 0;else if(l.endsWith("%"))o=`${-Number.parseFloat(l)}%`;else o=l.startsWith("-")?l:`-${l}`}else o=i(e.value);if(o===void 0)return;let s={};for(let c of n)s[c]=o;return s},ip=(e)=>Qa[e.utility]?{visibility:Qa[e.utility]}:void 0,op=(e)=>{if(e.utility==="z"&&e.value){if(e.arbitrary||e.value==="auto"||/^-?\d+$/.test(e.value))return{"z-index":e.value};return}},tl=[Fm,Dm,jm,Bm,Um,Vm,Wm,zm,Km,Hm,Gm,Xm,qm,Zm,Qm,ep,tp,rp,np,ip,op];var sp={rotate:"rotate","rotate-x":"rotateX","rotate-y":"rotateY","rotate-z":"rotateZ"},ap={"translate-x":"translateX","translate-y":"translateY","translate-z":"translateZ"},rl={"backface-visible":"visible","backface-hidden":"hidden"},nl={"transform-flat":"flat","transform-3d":"preserve-3d"},il={"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"},ol={"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"},sl={"transition-normal":"normal","transition-discrete":"allow-discrete","transition-behavior-normal":"normal","transition-behavior-allow-discrete":"allow-discrete"},al={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"},ll={"animate-running":"running","animate-paused":"paused"},cl={"animate-normal":"normal","animate-reverse":"reverse","animate-alternate":"alternate","animate-alternate-reverse":"alternate-reverse"},ul={"animate-fill-none":"none","animate-fill-forwards":"forwards","animate-fill-backwards":"backwards","animate-fill-both":"both"},fl={"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)"},dl="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))",Pt=`translate(var(--tc-translate-x, 0), var(--tc-translate-y, 0)) ${dl}`,mi=`translate3d(var(--tc-translate-x, 0), var(--tc-translate-y, 0), 0) ${dl}`,lp={transform:Pt,"transform-cpu":Pt,"transform-gpu":mi,"transform-none":"none"},cp=(e)=>{let t=lp[e.base];return t?{transform:t}:void 0};function jr(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 gi(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 up=(e)=>{if(e.utility==="scale")return jr("scale",e);if(e.utility==="scale-x")return jr("scaleX",e);if(e.utility==="scale-y")return jr("scaleY",e);if(e.utility==="scale-z")return jr("scaleZ",e)},fp=(e)=>{if(!e.value)return;let t=sp[e.utility];if(!t)return;let r=gi(e);return r!==void 0?{transform:`${t}(${r})`}:void 0},dp=(e,t)=>{let r=(o)=>{if(o.includes("/")){let[c,l]=o.split("/");return $e(Number(c),Number(l))}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=ap[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},hp=(e)=>{if(e.utility==="skew-x"&&e.value){let t=gi(e);return t!==void 0?{transform:`skewX(${t})`}:void 0}if(e.utility==="skew-y"&&e.value){let t=gi(e);return t!==void 0?{transform:`skewY(${t})`}:void 0}},gp=(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},mp={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=mp[e.value];if(t)return{perspective:t};if(/^\d+(?:\.\d+)?$/.test(e.value))return{perspective:`${e.value}px`};return}return},yp=(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}},bp=(e)=>rl[e.base]?{"backface-visibility":rl[e.base]}:void 0,xp=(e)=>nl[e.base]?{"transform-style":nl[e.base]}:void 0,vp=(e)=>il[e.base]?{"transition-property":il[e.base]}:void 0;function Br(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 wp=(e)=>{if(e.utility==="duration"&&e.value){let r=Br(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}},$p=(e)=>ol[e.base]?{"transition-timing-function":ol[e.base]}:void 0,Cp=(e)=>{if(e.utility==="delay"&&e.value){let r=Br(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}},Rp=(e)=>sl[e.base]?{"transition-behavior":sl[e.base]}:void 0,kp=(e)=>{if(e.utility!=="animate")return;if(e.arbitrary&&e.value)return{animation:e.value.replace(/_/g," ")};if(e.value&&al[e.value])return{animation:al[e.value]};return},Sp=(e)=>ll[e.base]?{"animation-play-state":ll[e.base]}:void 0,Ap=(e)=>cl[e.base]?{"animation-direction":cl[e.base]}:void 0,Ep=(e)=>ul[e.base]?{"animation-fill-mode":ul[e.base]}:void 0,Tp=(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}},Np=(e)=>{if(e.utility==="animate-duration"&&e.value){let r=Br(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}},Op=(e)=>{if(e.utility==="animate-delay"&&e.value){let r=Br(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}},Ip=(e)=>fl[e.base]?{"animation-timing-function":fl[e.base]}:void 0,hl=[cp,up,fp,dp,hp,gp,pp,yp,bp,xp,vp,Rp,wp,$p,Cp,kp,Sp,Ap,Ep,Tp,Np,Op,Ip];var gl={italic:"italic","not-italic":"normal"},ml={"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"},pl={"list-inside":"inside","list-outside":"outside"},yl={none:"none",disc:"disc",decimal:"decimal"},bl={underline:"underline",overline:"overline","line-through":"line-through","no-underline":"none"},xl={uppercase:"uppercase",lowercase:"lowercase",capitalize:"capitalize","normal-case":"none"},vl={"text-wrap":"wrap","text-nowrap":"nowrap","text-balance":"balance","text-pretty":"pretty"},wl={"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"},$l={"whitespace-normal":"normal","whitespace-nowrap":"nowrap","whitespace-pre":"pre","whitespace-pre-line":"pre-line","whitespace-pre-wrap":"pre-wrap","whitespace-break-spaces":"break-spaces"},Cl={"break-all":"break-all","break-keep":"keep-all"},Rl={"hyphens-none":"none","hyphens-manual":"manual","hyphens-auto":"auto"},kl={"writing-horizontal-tb":"horizontal-tb","writing-vertical-rl":"vertical-rl","writing-vertical-lr":"vertical-lr"},Sl={"text-orientation-mixed":"mixed","text-orientation-upright":"upright","text-orientation-sideways":"sideways"},Al={"direction-ltr":"ltr","direction-rtl":"rtl"},El={"small-caps":"small-caps","all-small-caps":"all-small-caps","petite-caps":"petite-caps","all-petite-caps":"all-petite-caps",unicase:"unicase","titling-caps":"titling-caps","normal-caps":"normal"},Tl={"ligatures-normal":"normal","ligatures-none":"none","common-ligatures":"common-ligatures","no-common-ligatures":"no-common-ligatures","discretionary-ligatures":"discretionary-ligatures","no-discretionary-ligatures":"no-discretionary-ligatures","historical-ligatures":"historical-ligatures","no-historical-ligatures":"no-historical-ligatures",contextual:"contextual","no-contextual":"no-contextual"},Pp=(e,t)=>{if(e.utility==="font"&&e.value){let r=t.theme.fontFamily[e.value];if(r)return{"font-family":r.join(", ")}}},_p=(e)=>({antialiased:{"-webkit-font-smoothing":"antialiased","-moz-osx-font-smoothing":"grayscale"},"subpixel-antialiased":{"-webkit-font-smoothing":"auto","-moz-osx-font-smoothing":"auto"}})[e.base],Lp=(e)=>gl[e.base]?{"font-style":gl[e.base]}:void 0,Mp=(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}},Fp=(e)=>ml[e.base]?{"font-variant-numeric":ml[e.base]}:void 0,Dp=(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}},jp=(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}}},Bp=(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})`}}},Up=(e)=>pl[e.base]?{"list-style-position":pl[e.base]}:void 0,Vp=(e)=>{if(e.utility!=="list"||!e.value)return;return yl[e.value]?{"list-style-type":yl[e.value]}:void 0},Wp=(e,t)=>{if(bl[e.base])return{"text-decoration-line":bl[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},zp=(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}},Kp=(e)=>xl[e.base]?{"text-transform":xl[e.base]}:void 0,Hp=(e)=>({truncate:{overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"},"text-ellipsis":{"text-overflow":"ellipsis"},"text-clip":{"text-overflow":"clip"}})[e.base],Gp=(e)=>vl[e.base]?{"text-wrap":vl[e.base]}:void 0,qp=(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}},Yp=(e)=>wl[e.base]?{"vertical-align":wl[e.base]}:void 0,Jp=(e)=>$l[e.base]?{"white-space":$l[e.base]}:void 0,Xp=(e)=>{if(e.base==="break-normal")return{"overflow-wrap":"normal","word-break":"normal"};if(e.base==="break-words")return{"overflow-wrap":"break-word"};return Cl[e.base]?{"word-break":Cl[e.base]}:void 0},Zp=(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},Qp=(e)=>{if(e.utility!=="tab"||!e.value)return;if(e.arbitrary||/^\d+$/.test(e.value))return{"tab-size":e.value};return},ey=(e)=>Rl[e.base]?{hyphens:Rl[e.base]}:void 0,ty=(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}},ry=(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}},ny=(e)=>kl[e.base]?{"writing-mode":kl[e.base]}:void 0,iy=(e)=>Sl[e.base]?{"text-orientation":Sl[e.base]}:void 0,oy=(e)=>Al[e.base]?{direction:Al[e.base]}:void 0,sy=(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}},ay=(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":Y(e.value,s[o],i,t.colorVariables)}}let n=t.theme.colors[e.value];if(typeof n==="string")return{"text-emphasis-color":Y(e.value,n,e.value,t.colorVariables)};if(typeof n==="object"&&n!==null&&typeof n.DEFAULT==="string")return{"text-emphasis-color":Y(e.value,n.DEFAULT,e.value,t.colorVariables)}}},ly=(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}},cy=(e)=>El[e.base]?{"font-variant-caps":El[e.base]}:void 0,uy=(e)=>Tl[e.base]?{"font-variant-ligatures":Tl[e.base]}:void 0,Nl=[Pp,_p,Lp,Mp,Fp,cy,uy,Dp,ry,jp,Bp,Up,Vp,Wp,zp,Kp,Hp,Gp,qp,Yp,Jp,Xp,Zp,Qp,ey,ty,ny,iy,oy,sy,ay,ly];var Ol={"flex-row":"row","flex-row-reverse":"row-reverse","flex-col":"column","flex-col-reverse":"column-reverse"},Il={"flex-wrap":"wrap","flex-wrap-reverse":"wrap-reverse","flex-nowrap":"nowrap"},pi={0:"0px",2:"2px",4:"4px",8:"8px"},fy=(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"}},dy=(e)=>{if(e.utility==="scrollbar"&&e.value){let r={auto:"auto",thin:"thin",none:"none"}[e.value];if(r)return{"scrollbar-width":r}}},hy=(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}}},gy=(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)}},my=(e)=>Ol[e.utility]?{"flex-direction":Ol[e.utility]}:void 0,py=(e)=>Il[e.utility]?{"flex-wrap":Il[e.utility]}:void 0,yy=(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},by=(e)=>{if(e.utility==="flex-grow"&&!e.value)return{"flex-grow":"1"};if(e.utility==="flex-grow"&&e.value)return{"flex-grow":e.value}},xy=(e)=>{if(e.utility==="flex-shrink"&&!e.value)return{"flex-shrink":"1"};if(e.utility==="flex-shrink"&&e.value)return{"flex-shrink":e.value}},vy=(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},wy=(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},$y=(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},Cy=(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},Ry=(e,t)=>{let n={p:["padding"],px:["padding-left","padding-right"],py:["padding-top","padding-bottom"],pt:["padding-top"],pr:["padding-right"],pb:["padding-bottom"],pl:["padding-left"],ps:["padding-inline-start"],pe:["padding-inline-end"],m:["margin"],mx:["margin-left","margin-right"],my:["margin-top","margin-bottom"],mt:["margin-top"],mr:["margin-right"],mb:["margin-bottom"],ml:["margin-left"],ms:["margin-inline-start"],me:["margin-inline-end"]}[e.utility];if(!n||!e.value)return;let i=(c)=>{if(c==="auto")return e.utility.charCodeAt(0)===109?"auto":void 0;let l=t.theme.spacing[c];if(l!==void 0)return l;if(e.arbitrary)return c;if(/^\d+(?:\.\d+)?$/.test(c)){let a=Number.parseFloat(c);if(Number.isFinite(a))return`${a*0.25}rem`}return},o;if(e.value.startsWith("-")){if(e.utility.charCodeAt(0)===112)return;let c=e.value.slice(1);if(c==="0")o=t.theme.spacing[c]||"0";else{let l=i(c);o=l===void 0?void 0:`-${l}`}}else o=i(e.value);if(o===void 0)return;let s={};for(let c of n)s[c]=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 ky=(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},De=null,Ur=null,Vr,Sy={bg:"background-color",text:"color",border:"border-color"},Ay={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"}},Ey=new Set(["length","absolute-size","relative-size","percentage","number"]),Ty=/^(?:url|(?:repeating-)?(?:linear|radial|conic)-gradient|image-set|-webkit-image-set|cross-fade|element|paint)\(/i,_l={current:"currentColor",transparent:"transparent",inherit:"inherit"};function Y(e,t,r,n){return n?.includes(r)?`var(--color-${e}, ${t})`:t}function Ll(e,t){let r=new Map;for(let[n,i]of Object.entries(e))if(typeof i==="string")r.set(n,Y(n,i,n,t));else if(typeof i==="object"&&i!==null){for(let[o,s]of Object.entries(i))if(typeof s==="string"){let c=o==="DEFAULT"?n:`${n}-${o}`;r.set(c,Y(c,s,n,t))}}return r}var Ny=(e,t)=>{let r=Sy[e.utility];if(!r||!e.value)return;let n=e.value;if(e.arbitrary&&e.typeHint){let a=Ay[e.utility]?.[e.typeHint];return a?{[a]:n}:void 0}if(e.arbitrary&&e.utility==="bg"&&Ty.test(n))return{"background-image":n};if(De===null||Ur!==t.theme.colors||Vr!==t.colorVariables)De=Ll(t.theme.colors,t.colorVariables),Ur=t.theme.colors,Vr=t.colorVariables;let i=Oe(n);if(i===-1){let a=De.get(n);if(a)return{[r]:a}}let o,s=n;if(i!==-1){s=n.slice(0,i);let a=n.slice(i+1);if(a.charCodeAt(0)===91&&a.charCodeAt(a.length-1)===93){let f=Number.parseFloat(a.slice(1,-1));if(Number.isNaN(f)||f<0||f>1)return;o=f}else if(e.modifierArbitrary){let f=Number.parseFloat(a);if(Number.isNaN(f)||f<0||f>1)return;o=f}else{let f=Number.parseInt(a,10);if(Number.isNaN(f)||f<0||f>100)return;o=f/100}let u=De.get(s);if(u)return{[r]:we(u,o)}}let c=_l[s];if(c)return{[r]:c};if((e.arbitrary||s&&s.charCodeAt(0)===91)&&s){let a=o!==void 0?we(s,o):s;return{[r]:a}}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((c)=>c+c).join("");let i=Number.parseInt(n.slice(0,2),16),o=Number.parseInt(n.slice(2,4),16),s=Number.parseInt(n.slice(4,6),16);return`rgb(${i} ${o} ${s} / ${t})`}if(r.charCodeAt(0)===114){let n=r.match(/rgb\((\d+)\s+(\d+)\s+(\d+)/);if(n)return`rgb(${n[1]} ${n[2]} ${n[3]} / ${t})`}if(r.charCodeAt(0)===111){let n=r.match(/oklch\(([^)]+)\)/);if(n)return`oklch(${n[1]} / ${t})`}if(r.charCodeAt(0)===104){let n=r.match(/hsl\(([^)]+)\)/);if(n)return`hsl(${n[1]} / ${t})`}if(r!=="inherit"&&r!=="transparent"){let n=Number((t*100).toFixed(2));return`color-mix(in srgb, ${r} ${n}%, transparent)`}return r}function 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 c=t.colorVariables,l=t.theme.colors[i],a=typeof l==="string"?Y(i,l,i,c):l;if(typeof a==="string")return o!==void 0?we(a,o):a;if(typeof a==="object"&&a!==null&&typeof a.DEFAULT==="string"){let f=Y(i,a.DEFAULT,i,c);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 p=Y(i,h[f],d,c);return o!==void 0?we(p,o):p}}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 Oy=(e,t)=>{if(e.utility!=="placeholder"||!e.value)return;if(De===null||Ur!==t.theme.colors||Vr!==t.colorVariables)De=Ll(t.theme.colors,t.colorVariables),Ur=t.theme.colors,Vr=t.colorVariables;let r=e.value,n=Oe(r);if(n===-1){let o=De.get(r);if(o)return{properties:{color:o},pseudoElement:"::placeholder"}}else{let o=r.slice(0,n),s=r.slice(n+1),c;if(s.charCodeAt(0)===91&&s.charCodeAt(s.length-1)===93){let a=Number.parseFloat(s.slice(1,-1));if(Number.isNaN(a)||a<0||a>1)return;c=a}else if(e.modifierArbitrary){let a=Number.parseFloat(s);if(Number.isNaN(a)||a<0||a>1)return;c=a}else{let a=Number.parseInt(s,10);if(Number.isNaN(a)||a<0||a>100)return;c=a/100}let l=De.get(o);if(l)return{properties:{color:we(l,c)},pseudoElement:"::placeholder"}}let i=_l[e.value];if(i)return{properties:{color:i},pseudoElement:"::placeholder"};return},Iy=(e,t)=>{if(e.utility==="text"&&e.value){let r=e.value,n,i=r.lastIndexOf("/");if(i!==-1&&!e.value.startsWith("[")&&!r.slice(i+1).includes("]"));if(i!==-1){let s=r.slice(0,i),c=r.slice(i+1);if(c&&(t.theme.fontSize[s]||e.arbitrary)){r=s;let l={none:"1",tight:"1.25",snug:"1.375",normal:"1.5",relaxed:"1.625",loose:"2",3:"0.75rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem"};n=t.theme.lineHeight?.[c]??l[c]??c}}if(e.arbitrary){if(e.typeHint){if(!Ey.has(e.typeHint))return;let c={"font-size":r};if(n)c["line-height"]=n;return c}if(/^#|^rgb|^hsl|^hwb|^lab|^lch|^oklch|^oklab|^color\(|^var\(--/.test(r))return;let s={"font-size":r};if(n)s["line-height"]=n;return s}let o=t.theme.fontSize[r];if(o)return{"font-size":o[0],"line-height":n??o[1].lineHeight}}},Py=(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},_y=(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},Ly=(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}},My=(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}},Fy=(e,t)=>{let r={"border-t":"border-top-width","border-r":"border-right-width","border-b":"border-bottom-width","border-l":"border-left-width","border-x":["border-left-width","border-right-width"],"border-y":["border-top-width","border-bottom-width"],"border-s":"border-inline-start-width","border-e":"border-inline-end-width"},n={"border-t":"border-top-color","border-r":"border-right-color","border-b":"border-bottom-color","border-l":"border-left-color","border-x":["border-left-color","border-right-color"],"border-y":["border-top-color","border-bottom-color"],"border-s":"border-inline-start-color","border-e":"border-inline-end-color"},i=r[e.utility];if(!i)return;if(!e.value){let s=i;if(Array.isArray(s))return s.reduce((c,l)=>({...c,[l]:"1px"}),{});return{[s]:"1px"}}if(e.arbitrary){let s=e.value,a=(/^#|^(?:rgb|rgba|hsl|hsla|oklch|oklab|lab|lch)\(|^(?:currentColor|transparent|inherit)$/i.test(s)?n[e.utility]:i)??i;if(Array.isArray(a))return a.reduce((u,f)=>({...u,[f]:s}),{});return{[a]:s}}if(pi[e.value]){let s=i;if(Array.isArray(s))return s.reduce((c,l)=>({...c,[l]:pi[e.value]}),{});return{[s]:pi[e.value]}}let o=n[e.utility];if(o&&t){let s=e.value.split("-");if(s.length>=2){let l=s[s.length-1],a=s.slice(0,-1).join("-"),u=t.theme.colors[a];if(u&&typeof u==="object"&&u[l]){let f=o,d=Y(e.value,u[l],a,t.colorVariables);if(Array.isArray(f))return f.reduce((h,p)=>({...h,[p]:d}),{});return{[f]:d}}}let c=t.theme.colors[e.value];if(typeof c==="string"){let l=o;if(Array.isArray(l))return l.reduce((a,u)=>({...a,[u]:c}),{});return{[l]:c}}if(c&&typeof c==="object"&&typeof c.DEFAULT==="string"){let l=o;if(Array.isArray(l))return l.reduce((a,u)=>({...a,[u]:c.DEFAULT}),{});return{[l]:c.DEFAULT}}if(e.value==="transparent"||e.value==="current"||e.value==="inherit"){let l=e.value==="current"?"currentColor":e.value,a=o;if(Array.isArray(a))return a.reduce((u,f)=>({...u,[f]:l}),{});return{[a]:l}}}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 Pl={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"]},Dy=(e,t)=>{if(e.utility==="rounded"){if(e.arbitrary&&e.value)return{"border-radius":e.value};if(e.value&&Pl[e.value]){let o=t.theme.borderRadius.DEFAULT,s={};for(let c of Pl[e.value])s[c]=o;return s}let i=e.value?t.theme.borderRadius[e.value]:t.theme.borderRadius.DEFAULT;return i?{"border-radius":i}:void 0}if(e.utility==="rounded-s"){let i=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}},yi=[xa,Ry,ky,Cy,Iy,Ly,...Nl,Py,_y,...ha,...da,...ci,Oy,Ny,...ea,...tl,my,py,yy,by,xy,vy,wy,$y,...ya,...hl,...ci,...Va,...ma,Fy,My,Dy,gy,dy,hy,fy];function wi(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]=wi(o,i);else if(i!==void 0)r[n]=i}return r}var jy={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"}},By={"flex-row":{"flex-direction":"row"},"flex-row-reverse":{"flex-direction":"row-reverse"},"flex-col":{"flex-direction":"column"},"flex-col-reverse":{"flex-direction":"column-reverse"}},Uy={"flex-wrap":{"flex-wrap":"wrap"},"flex-wrap-reverse":{"flex-wrap":"wrap-reverse"},"flex-nowrap":{"flex-wrap":"nowrap"}},Vy={"flex-1":{flex:"1 1 0%"},"flex-auto":{flex:"1 1 auto"},"flex-initial":{flex:"0 1 auto"},"flex-none":{flex:"none"}},Wy={grow:{"flex-grow":"1"},"grow-0":{"flex-grow":"0"},shrink:{"flex-shrink":"1"},"shrink-0":{"flex-shrink":"0"}},zy={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"},Ky={start:"flex-start",end:"flex-end",center:"center",baseline:"baseline",stretch:"stretch","center-safe":"safe center","end-safe":"safe flex-end"},Hy={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"},Gy={auto:"auto",start:"flex-start",end:"flex-end",center:"center",stretch:"stretch",baseline:"baseline","center-safe":"safe center","end-safe":"safe flex-end"},qy={"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"}},Yy={transform:{transform:Pt},"transform-cpu":{transform:Pt},"transform-gpu":{transform:mi},"transform-none":{transform:"none"}},mt={"transition-timing-function":"cubic-bezier(0.4, 0, 0.2, 1)","transition-duration":"150ms"},Jy={"transition-none":{"transition-property":"none"},"transition-all":{"transition-property":"all",...mt},transition:{"transition-property":"color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter",...mt},"transition-colors":{"transition-property":"color, background-color, border-color, text-decoration-color, fill, stroke",...mt},"transition-opacity":{"transition-property":"opacity",...mt},"transition-shadow":{"transition-property":"box-shadow",...mt},"transition-transform":{"transition-property":"transform",...mt}},Xy={"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)"}},Zy={"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"}},Qy={spin:`@keyframes spin {
358
358
  from { transform: rotate(0deg); }
359
359
  to { transform: rotate(360deg); }
360
360
  }`,ping:`@keyframes ping {
@@ -365,32 +365,32 @@ video {
365
365
  }`,bounce:`@keyframes bounce {
366
366
  0%, 100% { transform: translateY(-25%); animation-timing-function: cubic-bezier(0.8, 0, 1, 1); }
367
367
  50% { transform: translateY(0); animation-timing-function: cubic-bezier(0, 0, 0.2, 1); }
368
- }`},Zy={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"},Qy={"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"},eb={"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"},tb={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"},nb={row:"row",col:"column",dense:"dense","row-dense":"row dense","col-dense":"column dense"},_l={auto:"auto",min:"min-content",max:"max-content",fr:"minmax(0, 1fr)"},pi={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 gt(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 ib={ring:gt("1px"),"ring-0":gt("0px"),"ring-1":gt("1px"),"ring-2":gt("2px"),"ring-4":gt("4px"),"ring-8":gt("8px"),"ring-inset":{"--tc-ring-inset":"inset"}},Zl={"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}},Ql={"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"}},ob={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"}},sb={"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"}},ab={"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"}},Ur={"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"},Ll={...Ur,auto:"auto",full:"100%",screen:"100vw",min:"min-content",max:"max-content",fit:"fit-content",...lb(6)};function lb(e){let t={};for(let r=2;r<=e;r++)for(let n=1;n<r;n++)t[`${n}/${r}`]=we(n,r);return t}var mt={"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"},cb={"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"}},ub={italic:{"font-style":"italic"},"not-italic":{"font-style":"normal"}},fb={uppercase:{"text-transform":"uppercase"},lowercase:{"text-transform":"lowercase"},capitalize:{"text-transform":"capitalize"},"normal-case":{"text-transform":"none"}},db={underline:{"text-decoration-line":"underline"},overline:{"text-decoration-line":"overline"},"line-through":{"text-decoration-line":"line-through"},"no-underline":{"text-decoration-line":"none"}},hb={"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"}},gb={"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"}},mb={truncate:{overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"},"text-ellipsis":{"text-overflow":"ellipsis"},"text-clip":{"text-overflow":"clip"}},pb={"text-wrap":{"text-wrap":"wrap"},"text-nowrap":{"text-wrap":"nowrap"},"text-balance":{"text-wrap":"balance"},"text-pretty":{"text-wrap":"pretty"}},yb={"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"}},xb={"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"}},$b={static:{position:"static"},fixed:{position:"fixed"},absolute:{position:"absolute"},relative:{position:"relative"},sticky:{position:"sticky"}},Cb={visible:{visibility:"visible"},invisible:{visibility:"hidden"},collapse:{visibility:"collapse"}},Rb={"float-left":{float:"left"},"float-right":{float:"right"},"float-none":{float:"none"},"float-start":{float:"inline-start"},"float-end":{float:"inline-end"}},kb={"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"}},Sb={isolate:{isolation:"isolate"},"isolation-auto":{isolation:"auto"}},Ab={"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"}},Eb={"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"}},Tb={"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"}},Nb={"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"}},Ob={"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"}},Ib={"aspect-auto":{"aspect-ratio":"auto"},"aspect-square":{"aspect-ratio":"1 / 1"},"aspect-video":{"aspect-ratio":"16 / 9"}},Pb={"box-border":{"box-sizing":"border-box"},"box-content":{"box-sizing":"content-box"}},_b={"box-decoration-clone":{"box-decoration-break":"clone"},"box-decoration-slice":{"box-decoration-break":"slice"}},Lb={"bg-fixed":{"background-attachment":"fixed"},"bg-local":{"background-attachment":"local"},"bg-scroll":{"background-attachment":"scroll"}},Mb={"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"}},Fb={"bg-origin-border":{"background-origin":"border-box"},"bg-origin-padding":{"background-origin":"padding-box"},"bg-origin-content":{"background-origin":"content-box"}},Db={"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"}},jb={"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"}},Bb={"bg-auto":{"background-size":"auto"},"bg-cover":{"background-size":"cover"},"bg-contain":{"background-size":"contain"}},Ub={"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))"}},Wb={"content-none":{content:"none"},"content-empty":{content:'""'}},Vb={"scrollbar-auto":{"scrollbar-width":"auto"},"scrollbar-thin":{"scrollbar-width":"thin"},"scrollbar-none":{"scrollbar-width":"none"}},zb={"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"}},Kb={"pointer-events-none":{"pointer-events":"none"},"pointer-events-auto":{"pointer-events":"auto"}},Hb={"resize-none":{resize:"none"},"resize-y":{resize:"vertical"},"resize-x":{resize:"horizontal"},resize:{resize:"both"}},Gb={"select-none":{"user-select":"none"},"select-text":{"user-select":"text"},"select-all":{"user-select":"all"},"select-auto":{"user-select":"auto"}},qb={"scroll-auto":{"scroll-behavior":"auto"},"scroll-smooth":{"scroll-behavior":"smooth"}},Yb={"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"}},Xe="var(--tc-pan-x,) var(--tc-pan-y,) var(--tc-pinch-zoom,)",Jb={"touch-auto":{"touch-action":"auto"},"touch-none":{"touch-action":"none"},"touch-pan-x":{"--tc-pan-x":"pan-x","touch-action":Xe},"touch-pan-left":{"--tc-pan-x":"pan-left","touch-action":Xe},"touch-pan-right":{"--tc-pan-x":"pan-right","touch-action":Xe},"touch-pan-y":{"--tc-pan-y":"pan-y","touch-action":Xe},"touch-pan-up":{"--tc-pan-y":"pan-up","touch-action":Xe},"touch-pan-down":{"--tc-pan-y":"pan-down","touch-action":Xe},"touch-pinch-zoom":{"--tc-pinch-zoom":"pinch-zoom","touch-action":Xe},"touch-manipulation":{"touch-action":"manipulation"}},Xb={"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"}},Zb={"appearance-none":{appearance:"none"},"appearance-auto":{appearance:"auto"}},Qb={"border-collapse":{"border-collapse":"collapse"},"border-separate":{"border-collapse":"separate"}},e0={"table-auto":{"table-layout":"auto"},"table-fixed":{"table-layout":"fixed"}},t0={"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"}},n0={"forced-color-adjust-auto":{"forced-color-adjust":"auto"},"forced-color-adjust-none":{"forced-color-adjust":"none"}},i0={"fill-none":{fill:"none"},"fill-current":{fill:"currentColor"},"fill-inherit":{fill:"inherit"}},o0={"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"}},s0={"stroke-linecap-butt":{"stroke-linecap":"butt"},"stroke-linecap-round":{"stroke-linecap":"round"},"stroke-linecap-square":{"stroke-linecap":"square"}},a0={"stroke-linejoin-miter":{"stroke-linejoin":"miter"},"stroke-linejoin-round":{"stroke-linejoin":"round"},"stroke-linejoin-bevel":{"stroke-linejoin":"bevel"}},l0=["blur","brightness","contrast","grayscale","hue-rotate","invert","saturate","sepia","drop-shadow"],c0=["blur","brightness","contrast","grayscale","hue-rotate","invert","opacity","saturate","sepia"],u0=l0.map((e)=>`var(--tc-${e}, )`).join(" "),Ml=c0.map((e)=>`var(--tc-backdrop-${e}, )`).join(" ");function De(e){return`var(--tc-drop-shadow-color, ${e})`}function j(e,t){return{[`--tc-${e}`]:t,filter:u0}}function ne(e,t){return{[`--tc-backdrop-${e}`]:t,"-webkit-backdrop-filter":Ml,"backdrop-filter":Ml}}var f0={"blur-none":j("blur","blur(0)"),"blur-xs":j("blur","blur(4px)"),"blur-sm":j("blur","blur(8px)"),blur:j("blur","blur(8px)"),"blur-md":j("blur","blur(12px)"),"blur-lg":j("blur","blur(16px)"),"blur-xl":j("blur","blur(24px)"),"blur-2xl":j("blur","blur(40px)"),"blur-3xl":j("blur","blur(64px)")},d0={"backdrop-blur-none":ne("blur","blur(0)"),"backdrop-blur-xs":ne("blur","blur(4px)"),"backdrop-blur-sm":ne("blur","blur(8px)"),"backdrop-blur":ne("blur","blur(8px)"),"backdrop-blur-md":ne("blur","blur(12px)"),"backdrop-blur-lg":ne("blur","blur(16px)"),"backdrop-blur-xl":ne("blur","blur(24px)"),"backdrop-blur-2xl":ne("blur","blur(40px)"),"backdrop-blur-3xl":ne("blur","blur(64px)")},h0={"grayscale-0":j("grayscale","grayscale(0)"),grayscale:j("grayscale","grayscale(100%)"),"invert-0":j("invert","invert(0)"),invert:j("invert","invert(100%)"),"sepia-0":j("sepia","sepia(0)"),sepia:j("sepia","sepia(100%)")},g0={"backdrop-grayscale-0":ne("grayscale","grayscale(0)"),"backdrop-grayscale":ne("grayscale","grayscale(100%)"),"backdrop-invert-0":ne("invert","invert(0)"),"backdrop-invert":ne("invert","invert(100%)"),"backdrop-sepia-0":ne("sepia","sepia(0)"),"backdrop-sepia":ne("sepia","sepia(100%)")},m0={"drop-shadow-xs":j("drop-shadow",`drop-shadow(0 1px 1px ${De("rgb(0 0 0 / 0.05)")})`),"drop-shadow-sm":j("drop-shadow",`drop-shadow(0 1px 2px ${De("rgb(0 0 0 / 0.15)")})`),"drop-shadow":j("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":j("drop-shadow",`drop-shadow(0 3px 3px ${De("rgb(0 0 0 / 0.12)")})`),"drop-shadow-lg":j("drop-shadow",`drop-shadow(0 4px 4px ${De("rgb(0 0 0 / 0.15)")})`),"drop-shadow-xl":j("drop-shadow",`drop-shadow(0 9px 7px ${De("rgb(0 0 0 / 0.1)")})`),"drop-shadow-2xl":j("drop-shadow",`drop-shadow(0 25px 25px ${De("rgb(0 0 0 / 0.15)")})`),"drop-shadow-none":j("drop-shadow","drop-shadow(0 0 #0000)")},p0={"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"}},y0={"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={...Fy,...Dy,...jy,...By,...Uy,...Hy,...Gy,...qy,...Yy,...Jy,...ib,...Zl,...Ql,...ob,...sb,...ab,...cb,...ub,...fb,...db,...hb,...gb,...mb,...pb,...yb,...bb,...xb,...vb,...wb,...$b,...Cb,...Rb,...kb,...Sb,...Ab,...Eb,...Tb,...Nb,...Ob,...Ib,...Pb,..._b,...Lb,...Mb,...Fb,...Db,...jb,...Bb,...Ub,...zb,...Kb,...Hb,...Gb,...qb,...Yb,...Jb,...Xb,...Zb,...Qb,...e0,...t0,...r0,...n0,...i0,...o0,...s0,...a0,...f0,...d0,...h0,...g0,...m0,...p0,...y0,...Wb,...Vb},Wr={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 Fl(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=Wr[e];if(t!==void 0)return t.startsWith("::")?void 0:t;let r=vi(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-")){let n=e.slice(0,4),i=e.slice(5);if(!i)return;if(i.charCodeAt(0)===91&&i.charCodeAt(i.length-1)===93)return`[${n}-${i.slice(1,-1)}]`;return n==="aria"?`[aria-${i}="true"]`:`[data-${i}]`}if(e.startsWith("in-")){let n=wi(e.slice(3));return n===void 0?void 0:`:where(${n}) *`}return}var yi=[["nth-last-of-type-","nth-last-of-type"],["nth-of-type-","nth-of-type"],["nth-last-","nth-last-child"],["nth-","nth-child"]];function vi(e){for(let t=0;t<yi.length;t++){let r=yi[t][0];if(!e.startsWith(r))continue;let n=yi[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 wi(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-")){let r=e.slice(5);return r.charCodeAt(0)===91&&r.charCodeAt(r.length-1)===93?`[data-${r.slice(1,-1)}]`:`[data-${r}]`}if(e.startsWith("aria-")){let r=e.slice(5);return r.charCodeAt(0)===91&&r.charCodeAt(r.length-1)===93?`[aria-${r.slice(1,-1)}]`:`[aria-${r}="true"]`}let t=Wr[e];return t!==void 0&&!t.startsWith("::")?t:void 0}function Dl(e){return mn(e).css}var bi={"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)"},jl={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 Bl(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 x0(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 Ul="\x01",Wl={dark:".dark ",light:".light "},Vl={rtl:':is([dir="rtl"], [dir="rtl"] *)',ltr:':is([dir="ltr"], [dir="ltr"] *)'},zl=new WeakMap,Kl=new WeakMap,Hl=new WeakMap,Gl=new WeakMap,ql=new WeakMap,Yl=new WeakMap,Jl=new WeakMap;function v0(e){let t=Kl.get(e);if(t)return t;let r=!1;for(let i in e)if(Ur[i]!==e[i]){r=!0;break}let n=r?{...Ur,...e}:Ur;return Kl.set(e,n),n}function w0(e){let t=Hl.get(e);if(t)return t;let r=null;for(let i in e){let o=e[i];if(typeof o==="string"){if(mt[i]!==void 0&&mt[i]!==o)r??={},r[i]=o;continue}if(!o||typeof o!=="object")continue;for(let s in o){let c=o[s];if(typeof c!=="string")continue;let l=s==="DEFAULT"?i:`${i}-${s}`;if(mt[l]!==void 0&&mt[l]!==c)r??={},r[l]=c}}let n=r?{...mt,...r}:mt;return Hl.set(e,n),n}function $0(e){let t=Gl.get(e);if(t!==void 0)return t;let r=!1;for(let n in e){let i=n==="DEFAULT"?"rounded":`rounded-${n}`;if(Ql[i]?.["border-radius"]!==e[n]){r=!0;break}}return Gl.set(e,r),r}function C0(e){let t=ql.get(e);if(t!==void 0)return t;let r=!1;for(let n in e){let i=n==="DEFAULT"?"shadow":`shadow-${n}`,o=Zl[i];if(o!==void 0&&o["--tc-shadow"]!==e[n]){r=!0;break}}return ql.set(e,r),r}function R0(e){let t=Yl.get(e);if(t)return t;let r=new Map(Object.entries(e));return Yl.set(e,r),r}function k0(e){let t=Jl.get(e);if(t)return t;let r=new Map(Object.entries(e));return Jl.set(e,r),r}function S0(e){let t=zl.get(e);if(t)return t;if(e.presets&&e.presets.length>0)for(let u of e.presets){if(u.theme)e.theme=xi(e.theme,u.theme);if(u.rules&&u.rules.length>0)e.rules=[...u.rules,...e.rules];if(u.shortcuts)e.shortcuts={...u.shortcuts,...e.shortcuts};if(u.variants)e.variants={...u.variants,...e.variants};if(u.preflights&&u.preflights.length>0)e.preflights=[...u.preflights,...e.preflights]}let r=e.theme.extend?.colors?e.theme.extend.colors:null;if(e.theme.extend){let{extend:u,...f}=e.theme;if(u)e.theme=xi(f,u)}let n=[],i=new Set;for(let u of e.blocklist)if(u.includes("*"))n.push(new RegExp(`^${u.replace(/\*/g,".*")}$`));else i.add(u);let o=v0(e.theme.spacing),s=w0(e.theme.colors),c=$0(e.theme.borderRadius),l=C0(e.theme.boxShadow),a={config:e,variantEnabled:e.variants,spacingValues:o,commonColors:s,skipStaticRadius:c,skipStaticShadow:l,screenBreakpoints:R0(e.theme.screens),containerBreakpoints:k0(e.theme.containers),blocklistRegexCache:n,blocklistExact:i,extendColors:r,hasBlocklist:n.length>0||i.size>0,hasShortcuts:Object.keys(e.shortcuts).length>0};return zl.set(e,a),a}function Xl(e){return e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57||e===45||e===95}function A0(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&&Xl(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&&Xl(e.charCodeAt(n)))n++;return n>t?e.slice(t,n):void 0}var E0=/^(?: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)-/,T0=/^rounded-[tlbr](?:-|$)/,N0=/^(?: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)-/,O0=/^rounded-(?:tl|tr|bl|br)(?:-|$)/,I0=/^i-[a-z][a-z0-9]*(?:-[a-z0-9]+)*-.+/;function P0(e){let t=A0(e);if(!t)return 0;if(I0.test(t))return-1;if(E0.test(t)||T0.test(t))return 1;if(N0.test(t)||O0.test(t))return 2;return 0}class $i{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=S0(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}}this.generateUtility(e)}expandShortcut(e,t,r){let n=Array.isArray(t)?t:t.split(/\s+/),i=this.shortcutSelectorRaw;this.shortcutSelectorRaw=e;for(let o of n){if(!o)continue;let s=this.config.shortcuts[o];if(s){if(!r.has(o))r.add(o),this.expandShortcut(e,s,r);continue}this.generateUtility(o)}this.shortcutSelectorRaw=i}generateCompiledClass(e,t){if(this.compiledGenerated.has(e))return;this.compiledGenerated.add(e),this.classCache.add(e),this.expandShortcut(e,t,new Set([e]))}generateUtility(e){if(this.processed.hasBlocklist){if(this.processed.blocklistExact.has(e))return;let a=this.processed.blocklistRegexCache;for(let u=0;u<a.length;u++)if(a[u].test(e))return}let t=xo(e),r=t.base,n=b0[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 a=n.animation.split(" ")[0];if(a&&a!=="none")this.usedKeyframes.add(a),this.revision++}return}let{utility:i,value:o}=t;if(i==="w"&&o){let a=Ll[o]||this.config.theme.spacing[o];if(a){this.addRule(t,{width:a});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:we(f,d)});return}}this.addRule(t,{width:o});return}}if(i==="h"&&o){let a=Ll[o]||this.config.theme.spacing[o];if(a){this.addRule(t,{height:o==="screen"?"100vh":a});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:we(f,d)});return}}this.addRule(t,{height:o});return}}if(i==="p"&&o){let a=this.spacingValues[o];if(a){this.addRule(t,{padding:a});return}}if(i==="px"&&o){let a=this.spacingValues[o];if(a){this.addRule(t,{"padding-left":a,"padding-right":a});return}}if(i==="py"&&o){let a=this.spacingValues[o];if(a){this.addRule(t,{"padding-top":a,"padding-bottom":a});return}}if((i==="pt"||i==="pr"||i==="pb"||i==="pl")&&o){let a=this.spacingValues[o];if(a){let u={pt:"padding-top",pr:"padding-right",pb:"padding-bottom",pl:"padding-left"};this.addRule(t,{[u[i]]:a});return}}if(i==="m"&&o){let a=this.spacingValues[o];if(a){this.addRule(t,{margin:a});return}}if(i==="mx"&&o){let a=this.spacingValues[o];if(a){this.addRule(t,{"margin-left":a,"margin-right":a});return}}if(i==="my"&&o){let a=this.spacingValues[o];if(a){this.addRule(t,{"margin-top":a,"margin-bottom":a});return}}if((i==="mt"||i==="mr"||i==="mb"||i==="ml")&&o){let a=this.spacingValues[o];if(a){let u={mt:"margin-top",mr:"margin-right",mb:"margin-bottom",ml:"margin-left"};this.addRule(t,{[u[i]]:a});return}}if((i==="top"||i==="right"||i==="bottom"||i==="left")&&o){let a=this.spacingValues[o];if(a){this.addRule(t,{[i]:a});return}}if(i==="inset"&&o){let a=this.spacingValues[o];if(a){this.addRule(t,{top:a,right:a,bottom:a,left:a});return}}if(i==="inset-x"&&o){let a=this.spacingValues[o];if(a){this.addRule(t,{left:a,right:a});return}}if(i==="inset-y"&&o){let a=this.spacingValues[o];if(a){this.addRule(t,{top:a,bottom:a});return}}if(i==="bg"&&o){let a=this.commonColors[o];if(a){this.addRule(t,{"background-color":a});return}}if(i==="text"&&o){let a=this.commonColors[o];if(a){this.addRule(t,{color:a});return}}if(i==="border"&&o){let a=this.commonColors[o];if(a){this.addRule(t,{"border-color":a});return}}if(i==="justify"&&o){let a=Wy[o];if(a){this.addRule(t,{"justify-content":a});return}}if(i==="items"&&o){let a=Vy[o];if(a){this.addRule(t,{"align-items":a});return}}if(i==="content"&&o){let a=zy[o];if(a){this.addRule(t,{"align-content":a});return}if(t.arbitrary){this.addRule(t,{content:o});return}}if(i==="self"&&o){let a=Ky[o];if(a){this.addRule(t,{"align-self":a});return}}if(i==="grid-cols"&&o){let a=Qy[o];if(a){this.addRule(t,{"grid-template-columns":a});return}}if(i==="grid-rows"&&o){let a=eb[o];if(a){this.addRule(t,{"grid-template-rows":a});return}}if(i==="col"&&o){let a=tb[o];if(a){this.addRule(t,{"grid-column":a});return}}if(i==="row"&&o){let a=rb[o];if(a){this.addRule(t,{"grid-row":a});return}}if(i==="grid-flow"&&o){let a=nb[o];if(a){this.addRule(t,{"grid-auto-flow":a});return}}if(i==="auto-cols"&&o){let a=_l[o];if(a){this.addRule(t,{"grid-auto-columns":a});return}}if(i==="auto-rows"&&o){let a=_l[o];if(a){this.addRule(t,{"grid-auto-rows":a});return}}if(i==="origin"&&o){let a=Zy[o];if(a){this.addRule(t,{"transform-origin":a});return}}if(i==="scale"&&o&&!t.arbitrary){let a=Number(o)/100;if(!Number.isNaN(a)){this.addRule(t,{transform:`scale(${a})`});return}}if(i==="scale-x"&&o&&!t.arbitrary){let a=Number(o)/100;if(!Number.isNaN(a)){this.addRule(t,{transform:`scaleX(${a})`});return}}if(i==="scale-y"&&o&&!t.arbitrary){let a=Number(o)/100;if(!Number.isNaN(a)){this.addRule(t,{transform:`scaleY(${a})`});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=(a)=>{let u=this.config.theme.spacing[a];if(u!==void 0)return u;if(t.arbitrary)return a;if(/^\d+(?:\.\d+)?$/.test(a)){let f=Number.parseFloat(a);if(Number.isFinite(f))return`${f*0.25}rem`}return};if(i==="gap"&&o){let a=s(o);if(a!==void 0)this.addRule(t,{gap:a});return}if(i==="gap-x"&&o){let a=s(o);if(a!==void 0)this.addRule(t,{"column-gap":a});return}if(i==="gap-y"&&o){let a=s(o);if(a!==void 0)this.addRule(t,{"row-gap":a});return}if(i==="place"&&o){if(o.startsWith("content-")){let a=pi[o.slice(8)];if(a){this.addRule(t,{"place-content":a});return}}if(o.startsWith("items-")){let a=pi[o.slice(6)];if(a){this.addRule(t,{"place-items":a});return}}if(o.startsWith("self-")){let a=pi[o.slice(5)];if(a){this.addRule(t,{"place-self":a});return}}}let c=`${t.utility}:${t.value||""}`;if(this.noMatchCache.has(c))return;if(this.config.rules.length>0)for(let[a,u]of this.config.rules){let f=e.match(a);if(f){let d=u(f);if(d){this.addRule(t,d);return}}}let l=mi.length;for(let a=0;a<l;a++){let u=mi[a](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(c)}isVariantHandled(e){let t=this.variantHandledCache.get(e);if(t!==void 0)return t;let r=Wr[e]!==void 0||Wl[e]!==void 0||Vl[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==="**"||vi(e)!==void 0||e.startsWith("in-")&&wi(e.slice(3))!==void 0||e.startsWith("group-")||e.startsWith("group/")||e.startsWith("peer-")||e.startsWith("peer/")||e.startsWith("has-")||e.startsWith("aria-")||e.startsWith("data-")||e.startsWith("supports-")||e.startsWith("[")&&e.endsWith("]")||bi[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}=x0(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=jl[e];if(t!==void 0)return{media:t};let r=bi[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:Bl(i)}:void 0}return}isNegationResolvable(e){return Fl(e)!==void 0||this.negatableAtRule(e)!==void 0}addRule(e,t,r,n,i){for(let a=0;a<e.variants.length;a++)if(!this.isVariantHandled(e.variants[a]))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 c=this.getMediaQuery(e);if(e.important){let a={};for(let u in t)a[u]=`${t[u]} !important`;t=a}let l=c||"base";if(!this.rules.has(l))this.rules.set(l,[]);this.revision++,this.rules.get(l).push({selector:s,properties:t,mediaQuery:c,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 c=Wr[s];if(c!==void 0){if(this.variantEnabled[s])t+=c;continue}let l=Vl[s];if(l!==void 0){if(this.variantEnabled[s]){let u=t.indexOf("::");t=u===-1?t+l:t.slice(0,u)+l+t.slice(u)}continue}let a=Wl[s];if(a!==void 0){if(this.darkStrategy==="media"&&(s==="dark"||s==="light"))continue;if(this.variantEnabled[s])r=a;continue}if(s.charCodeAt(0)===110&&s.startsWith("not-")){if(this.variantEnabled.not){let u=Fl(s.slice(4));if(u!==void 0)t+=`:not(${u})`}continue}if(s.charCodeAt(0)===110&&s.startsWith("nth-")){let u=vi(s);if(u!==void 0)t+=u;continue}if(s.charCodeAt(0)===105&&s.startsWith("in-")){if(this.variantEnabled.in){let u=wi(s.slice(3));if(u!==void 0)r=`:where(${u}) `}continue}if(s.charCodeAt(0)===103&&s.startsWith("group-")){if(this.variantEnabled.group){let u=s.slice(6);if(u.startsWith("has-")){let f=u.slice(4);if(f.charCodeAt(0)===91&&f.charCodeAt(f.length-1)===93)r=`.group:has(${f.slice(1,-1)}) `;else r=`.group:has(:${f}) `}else r=`.group:${u} `}continue}if(s.charCodeAt(0)===103&&s.startsWith("group/")){if(this.variantEnabled.group)r=`.group\\/${s.slice(6)} `;continue}if(s.charCodeAt(0)===112&&s.startsWith("peer-")){if(this.variantEnabled.peer){let u=s.slice(5);if(u.startsWith("has-")){let f=u.slice(4);if(f.charCodeAt(0)===91&&f.charCodeAt(f.length-1)===93)r=`.peer:has(${f.slice(1,-1)}) ~ `;else r=`.peer:has(:${f}) ~ `}else r=`.peer:${u} ~ `}continue}if(s.charCodeAt(0)===112&&s.startsWith("peer/")){if(this.variantEnabled.peer)r=`.peer\\/${s.slice(5)} ~ `;continue}if(s.charCodeAt(0)===104&&s.startsWith("has-")){if(this.variantEnabled.has){let u=s.slice(4);if(u.charCodeAt(0)===91&&u.charCodeAt(u.length-1)===93){let f=u.slice(1,-1);t+=`:has(${f})`}else t+=`:has(:${u})`}continue}if(s.charCodeAt(0)===97&&s.startsWith("aria-")){if(this.variantEnabled.aria){let u=s.slice(5);if(u.charCodeAt(0)===91&&u.charCodeAt(u.length-1)===93){let f=u.slice(1,-1);t+=`[aria-${f}]`}else t+=`[aria-${u}="true"]`}continue}if(s.charCodeAt(0)===100&&s.startsWith("data-")){if(this.variantEnabled.data){let u=s.slice(5);if(u.charCodeAt(0)===91&&u.charCodeAt(u.length-1)===93){let f=u.slice(1,-1);t+=`[data-${f}]`}else t+=`[data-${u}]`}continue}}return r+t}getMediaQuery(e){let t=e.variants,r=t.length;if(r===0)return;let n=r===1?t[0]:t.join(":"),i=this.mediaQueryCache.get(n);if(i!==void 0)return i||void 0;let o=[],s=[],c=[],l=!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 g=f.slice(1,-1).replace(/_/g," ").slice(6).trim();if(g)o.push(g);continue}if(d===64){let g=this.containerQuery(f.slice(1));if(g!==void 0)c.push(g);continue}if(d===110&&f.startsWith("not-")){if(this.variantEnabled.not){let g=this.negatableAtRule(f.slice(4));if(g!==void 0)if(g.supports!==void 0)s.push(`@supports not ${g.supports}`);else o.push(`not ${g.media}`)}continue}if(this.darkStrategy==="media"&&(f==="dark"||f==="light")){o.push(`(prefers-color-scheme: ${f})`);continue}if(this.variantEnabled.responsive){let g=this.screenBreakpoints.get(f);if(g){o.push(`(min-width: ${g})`);continue}if(f.startsWith("max-")){let m=this.screenBreakpoints.get(f.slice(4));if(m){let y=m.match(/^([\d.]+)px$/);o.push(y?`(max-width: ${Number.parseFloat(y[1])-0.02}px)`:`not all and (min-width: ${m})`);continue}}}if(f==="starting"){if(this.variantEnabled.starting)l=!0;continue}let h=bi[f];if(h!==void 0){if(this.variantEnabled[f])o.push(h);continue}let p=jl[f];if(p!==void 0){if(this.variantEnabled[f])o.push(p);continue}if(f.charCodeAt(0)===115&&f.startsWith("supports-")){if(this.variantEnabled.supports)s.push(`@supports ${Bl(f.slice(9))}`)}}let a=[];if(o.length>0)o.sort((u,f)=>Number(u.charCodeAt(0)===40)-Number(f.charCodeAt(0)===40)),a.push(`@media ${o.join(" and ")}`);if(a.push(...s,...c),l)a.push("@starting-style");if(a.length>0){let u=a.join(Ul);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(`
368
+ }`},eb={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"},tb={"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"},rb={"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"},nb={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"},ib={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"},ob={row:"row",col:"column",dense:"dense","row-dense":"row dense","col-dense":"column dense"},Ml={auto:"auto",min:"min-content",max:"max-content",fr:"minmax(0, 1fr)"},bi={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 pt(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":W}}var sb={ring:pt("1px"),"ring-0":pt("0px"),"ring-1":pt("1px"),"ring-2":pt("2px"),"ring-4":pt("4px"),"ring-8":pt("8px"),"ring-inset":{"--tc-ring-inset":"inset"}},ec={"shadow-2xs":{"--tc-shadow":"0 1px rgb(0 0 0 / 0.05)","--tc-shadow-colored":"0 1px var(--tc-shadow-color)","box-shadow":W},"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":W},"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":W},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":W},"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":W},"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":W},"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":W},"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":W},"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":W},"shadow-none":{"--tc-shadow":"0 0 #0000","box-shadow":W}},tc={"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"}},lb={"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"}},cb={"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"}},Wr={"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"},Fl={...Wr,auto:"auto",full:"100%",screen:"100vw",min:"min-content",max:"max-content",fit:"fit-content",...ub(6)};function ub(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 yt={"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"},fb={"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"}},db={italic:{"font-style":"italic"},"not-italic":{"font-style":"normal"}},hb={uppercase:{"text-transform":"uppercase"},lowercase:{"text-transform":"lowercase"},capitalize:{"text-transform":"capitalize"},"normal-case":{"text-transform":"none"}},gb={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"}},pb={"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"}},yb={truncate:{overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"},"text-ellipsis":{"text-overflow":"ellipsis"},"text-clip":{"text-overflow":"clip"}},bb={"text-wrap":{"text-wrap":"wrap"},"text-nowrap":{"text-wrap":"nowrap"},"text-balance":{"text-wrap":"balance"},"text-pretty":{"text-wrap":"pretty"}},xb={"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"}},vb={"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"}},wb={"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"}},$b={"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"}},Cb={"hyphens-none":{hyphens:"none"},"hyphens-manual":{hyphens:"manual"},"hyphens-auto":{hyphens:"auto"}},Rb={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"}},Sb={"float-left":{float:"left"},"float-right":{float:"right"},"float-none":{float:"none"},"float-start":{float:"inline-start"},"float-end":{float:"inline-end"}},Ab={"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"}},Eb={isolate:{isolation:"isolate"},"isolation-auto":{isolation:"auto"}},Tb={"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"}},Nb={"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"}},Ob={"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"}},Ib={"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"}},Pb={"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"}},_b={"aspect-auto":{"aspect-ratio":"auto"},"aspect-square":{"aspect-ratio":"1 / 1"},"aspect-video":{"aspect-ratio":"16 / 9"}},Lb={"box-border":{"box-sizing":"border-box"},"box-content":{"box-sizing":"content-box"}},Mb={"box-decoration-clone":{"box-decoration-break":"clone"},"box-decoration-slice":{"box-decoration-break":"slice"}},Fb={"bg-fixed":{"background-attachment":"fixed"},"bg-local":{"background-attachment":"local"},"bg-scroll":{"background-attachment":"scroll"}},Db={"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"}},jb={"bg-origin-border":{"background-origin":"border-box"},"bg-origin-padding":{"background-origin":"padding-box"},"bg-origin-content":{"background-origin":"content-box"}},Bb={"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"}},Ub={"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"}},Vb={"bg-auto":{"background-size":"auto"},"bg-cover":{"background-size":"cover"},"bg-contain":{"background-size":"contain"}},Wb={"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))"}},zb={"content-none":{content:"none"},"content-empty":{content:'""'}},Kb={"scrollbar-auto":{"scrollbar-width":"auto"},"scrollbar-thin":{"scrollbar-width":"thin"},"scrollbar-none":{"scrollbar-width":"none"}},Hb={"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"}},Gb={"pointer-events-none":{"pointer-events":"none"},"pointer-events-auto":{"pointer-events":"auto"}},qb={"resize-none":{resize:"none"},"resize-y":{resize:"vertical"},"resize-x":{resize:"horizontal"},resize:{resize:"both"}},Yb={"select-none":{"user-select":"none"},"select-text":{"user-select":"text"},"select-all":{"user-select":"all"},"select-auto":{"user-select":"auto"}},Jb={"scroll-auto":{"scroll-behavior":"auto"},"scroll-smooth":{"scroll-behavior":"smooth"}},Xb={"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,)",Zb={"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"}},Qb={"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"}},e0={"appearance-none":{appearance:"none"},"appearance-auto":{appearance:"auto"}},t0={"border-collapse":{"border-collapse":"collapse"},"border-separate":{"border-collapse":"separate"}},r0={"table-auto":{"table-layout":"auto"},"table-fixed":{"table-layout":"fixed"}},n0={"caption-top":{"caption-side":"top"},"caption-bottom":{"caption-side":"bottom"}},i0={"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"}},o0={"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"}},l0={"stroke-linecap-butt":{"stroke-linecap":"butt"},"stroke-linecap-round":{"stroke-linecap":"round"},"stroke-linecap-square":{"stroke-linecap":"square"}},c0={"stroke-linejoin-miter":{"stroke-linejoin":"miter"},"stroke-linejoin-round":{"stroke-linejoin":"round"},"stroke-linejoin-bevel":{"stroke-linejoin":"bevel"}},u0=["blur","brightness","contrast","grayscale","hue-rotate","invert","saturate","sepia","drop-shadow"],f0=["blur","brightness","contrast","grayscale","hue-rotate","invert","opacity","saturate","sepia"],d0=u0.map((e)=>`var(--tc-${e}, )`).join(" "),Dl=f0.map((e)=>`var(--tc-backdrop-${e}, )`).join(" ");function je(e){return`var(--tc-drop-shadow-color, ${e})`}function j(e,t){return{[`--tc-${e}`]:t,filter:d0}}function ie(e,t){return{[`--tc-backdrop-${e}`]:t,"-webkit-backdrop-filter":Dl,"backdrop-filter":Dl}}var h0={"blur-none":j("blur","blur(0)"),"blur-xs":j("blur","blur(4px)"),"blur-sm":j("blur","blur(8px)"),blur:j("blur","blur(8px)"),"blur-md":j("blur","blur(12px)"),"blur-lg":j("blur","blur(16px)"),"blur-xl":j("blur","blur(24px)"),"blur-2xl":j("blur","blur(40px)"),"blur-3xl":j("blur","blur(64px)")},g0={"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":j("grayscale","grayscale(0)"),grayscale:j("grayscale","grayscale(100%)"),"invert-0":j("invert","invert(0)"),invert:j("invert","invert(100%)"),"sepia-0":j("sepia","sepia(0)"),sepia:j("sepia","sepia(100%)")},p0={"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%)")},y0={"drop-shadow-xs":j("drop-shadow",`drop-shadow(0 1px 1px ${je("rgb(0 0 0 / 0.05)")})`),"drop-shadow-sm":j("drop-shadow",`drop-shadow(0 1px 2px ${je("rgb(0 0 0 / 0.15)")})`),"drop-shadow":j("drop-shadow",`drop-shadow(0 1px 2px ${je("rgb(0 0 0 / 0.1)")}) drop-shadow(0 1px 1px ${je("rgb(0 0 0 / 0.06)")})`),"drop-shadow-md":j("drop-shadow",`drop-shadow(0 3px 3px ${je("rgb(0 0 0 / 0.12)")})`),"drop-shadow-lg":j("drop-shadow",`drop-shadow(0 4px 4px ${je("rgb(0 0 0 / 0.15)")})`),"drop-shadow-xl":j("drop-shadow",`drop-shadow(0 9px 7px ${je("rgb(0 0 0 / 0.1)")})`),"drop-shadow-2xl":j("drop-shadow",`drop-shadow(0 25px 25px ${je("rgb(0 0 0 / 0.15)")})`),"drop-shadow-none":j("drop-shadow","drop-shadow(0 0 #0000)")},b0={"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"}},x0={"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"}},v0={...jy,...By,...Uy,...Vy,...Wy,...qy,...Yy,...Jy,...Xy,...Zy,...sb,...ec,...tc,...ab,...lb,...cb,...fb,...db,...hb,...gb,...mb,...pb,...yb,...bb,...xb,...vb,...wb,...$b,...Cb,...Rb,...kb,...Sb,...Ab,...Eb,...Tb,...Nb,...Ob,...Ib,...Pb,..._b,...Lb,...Mb,...Fb,...Db,...jb,...Bb,...Ub,...Vb,...Wb,...Hb,...Gb,...qb,...Yb,...Jb,...Xb,...Zb,...Qb,...e0,...t0,...r0,...n0,...i0,...o0,...s0,...a0,...l0,...c0,...h0,...g0,...m0,...p0,...y0,...b0,...x0,...zb,...Kb},zr={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 jl(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=zr[e];if(t!==void 0)return t.startsWith("::")?void 0:t;let r=$i(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-")){let n=e.slice(0,4),i=e.slice(5);if(!i)return;if(i.charCodeAt(0)===91&&i.charCodeAt(i.length-1)===93)return`[${n}-${i.slice(1,-1)}]`;return n==="aria"?`[aria-${i}="true"]`:`[data-${i}]`}if(e.startsWith("in-")){let n=Ci(e.slice(3));return n===void 0?void 0:`:where(${n}) *`}return}var xi=[["nth-last-of-type-","nth-last-of-type"],["nth-of-type-","nth-of-type"],["nth-last-","nth-last-child"],["nth-","nth-child"]];function $i(e){for(let t=0;t<xi.length;t++){let r=xi[t][0];if(!e.startsWith(r))continue;let n=xi[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 Ci(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-")){let r=e.slice(5);return r.charCodeAt(0)===91&&r.charCodeAt(r.length-1)===93?`[data-${r.slice(1,-1)}]`:`[data-${r}]`}if(e.startsWith("aria-")){let r=e.slice(5);return r.charCodeAt(0)===91&&r.charCodeAt(r.length-1)===93?`[aria-${r.slice(1,-1)}]`:`[aria-${r}="true"]`}let t=zr[e];return t!==void 0&&!t.startsWith("::")?t:void 0}function Bl(e){return yn(e).css}var vi={"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)"},Ul={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 Vl(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 w0(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 Wl="\x01",zl={dark:".dark ",light:".light "},Kl={rtl:':is([dir="rtl"], [dir="rtl"] *)',ltr:':is([dir="ltr"], [dir="ltr"] *)'},Hl=new WeakMap,Gl=new WeakMap,ql=new WeakMap,Yl=new WeakMap,Jl=new WeakMap,Xl=new WeakMap,Zl=new WeakMap;function $0(e){let t=Gl.get(e);if(t)return t;let r=!1;for(let i in e)if(Wr[i]!==e[i]){r=!0;break}let n=r?{...Wr,...e}:Wr;return Gl.set(e,n),n}function C0(e){let t=ql.get(e);if(t)return t;let r=null;for(let i in e){let o=e[i];if(typeof o==="string"){if(yt[i]!==void 0&&yt[i]!==o)r??={},r[i]=o;continue}if(!o||typeof o!=="object")continue;for(let s in o){let c=o[s];if(typeof c!=="string")continue;let l=s==="DEFAULT"?i:`${i}-${s}`;if(yt[l]!==void 0&&yt[l]!==c)r??={},r[l]=c}}let n=r?{...yt,...r}:yt;return ql.set(e,n),n}function R0(e){let t=Yl.get(e);if(t!==void 0)return t;let r=!1;for(let n in e){let i=n==="DEFAULT"?"rounded":`rounded-${n}`;if(tc[i]?.["border-radius"]!==e[n]){r=!0;break}}return Yl.set(e,r),r}function k0(e){let t=Jl.get(e);if(t!==void 0)return t;let r=!1;for(let n in e){let i=n==="DEFAULT"?"shadow":`shadow-${n}`,o=ec[i];if(o!==void 0&&o["--tc-shadow"]!==e[n]){r=!0;break}}return Jl.set(e,r),r}function S0(e){let t=e??dt.theme.screens,r=Xl.get(t);if(r)return r;let n=new Map(Object.entries(t));return Xl.set(t,n),n}function A0(e){let t=e??dt.theme.containers,r=Zl.get(t);if(r)return r;let n=new Map(Object.entries(t));return Zl.set(t,n),n}function E0(e){let t=Hl.get(e);if(t)return t;if(e.presets&&e.presets.length>0)for(let u of e.presets){if(u.theme)e.theme=wi(e.theme,u.theme);if(u.rules&&u.rules.length>0)e.rules=[...u.rules,...e.rules];if(u.shortcuts)e.shortcuts={...u.shortcuts,...e.shortcuts};if(u.variants)e.variants={...u.variants,...e.variants};if(u.preflights&&u.preflights.length>0)e.preflights=[...u.preflights,...e.preflights]}let r=e.theme.extend?.colors?e.theme.extend.colors:null;if(e.theme.extend){let{extend:u,...f}=e.theme;if(u)e.theme=wi(f,u)}let n=[],i=new Set;for(let u of e.blocklist)if(u.includes("*"))n.push(new RegExp(`^${u.replace(/\*/g,".*")}$`));else i.add(u);let o=$0(e.theme.spacing),s=C0(e.theme.colors),c=R0(e.theme.borderRadius),l=k0(e.theme.boxShadow),a={config:e,variantEnabled:e.variants,spacingValues:o,commonColors:s,skipStaticRadius:c,skipStaticShadow:l,screenBreakpoints:S0(e.theme.screens),containerBreakpoints:A0(e.theme.containers),blocklistRegexCache:n,blocklistExact:i,extendColors:r,hasBlocklist:n.length>0||i.size>0,hasShortcuts:Object.keys(e.shortcuts).length>0};return Hl.set(e,a),a}function Ql(e){return e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57||e===45||e===95}function T0(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&&Ql(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&&Ql(e.charCodeAt(n)))n++;return n>t?e.slice(t,n):void 0}var N0=/^(?: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)-/,O0=/^rounded-[tlbr](?:-|$)/,I0=/^(?: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)-/,P0=/^rounded-(?:tl|tr|bl|br)(?:-|$)/,_0=/^i-[a-z][a-z0-9]*(?:-[a-z0-9]+)*-.+/;function L0(e){let t=T0(e);if(!t)return 0;if(_0.test(t))return-1;if(N0.test(t)||O0.test(t))return 1;if(I0.test(t)||P0.test(t))return 2;return 0}class Ri{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=E0(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}}this.generateUtility(e)}expandShortcut(e,t,r){let n=Array.isArray(t)?t:t.split(/\s+/),i=this.shortcutSelectorRaw;this.shortcutSelectorRaw=e;for(let o of n){if(!o)continue;let s=this.config.shortcuts[o];if(s){if(!r.has(o))r.add(o),this.expandShortcut(e,s,r);continue}this.generateUtility(o)}this.shortcutSelectorRaw=i}generateCompiledClass(e,t){if(this.compiledGenerated.has(e))return;this.compiledGenerated.add(e),this.classCache.add(e),this.expandShortcut(e,t,new Set([e]))}generateUtility(e){if(this.processed.hasBlocklist){if(this.processed.blocklistExact.has(e))return;let a=this.processed.blocklistRegexCache;for(let u=0;u<a.length;u++)if(a[u].test(e))return}let t=wo(e),r=t.base,n=v0[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 a=n.animation.split(" ")[0];if(a&&a!=="none")this.usedKeyframes.add(a),this.revision++}return}let{utility:i,value:o}=t;if(i==="w"&&o){let a=Fl[o]||this.config.theme.spacing[o];if(a){this.addRule(t,{width:a});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 a=Fl[o]||this.config.theme.spacing[o];if(a){this.addRule(t,{height:o==="screen"?"100vh":a});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 a=this.spacingValues[o];if(a){this.addRule(t,{padding:a});return}}if(i==="px"&&o){let a=this.spacingValues[o];if(a){this.addRule(t,{"padding-left":a,"padding-right":a});return}}if(i==="py"&&o){let a=this.spacingValues[o];if(a){this.addRule(t,{"padding-top":a,"padding-bottom":a});return}}if((i==="pt"||i==="pr"||i==="pb"||i==="pl")&&o){let a=this.spacingValues[o];if(a){let u={pt:"padding-top",pr:"padding-right",pb:"padding-bottom",pl:"padding-left"};this.addRule(t,{[u[i]]:a});return}}if(i==="m"&&o){let a=this.spacingValues[o];if(a){this.addRule(t,{margin:a});return}}if(i==="mx"&&o){let a=this.spacingValues[o];if(a){this.addRule(t,{"margin-left":a,"margin-right":a});return}}if(i==="my"&&o){let a=this.spacingValues[o];if(a){this.addRule(t,{"margin-top":a,"margin-bottom":a});return}}if((i==="mt"||i==="mr"||i==="mb"||i==="ml")&&o){let a=this.spacingValues[o];if(a){let u={mt:"margin-top",mr:"margin-right",mb:"margin-bottom",ml:"margin-left"};this.addRule(t,{[u[i]]:a});return}}if((i==="top"||i==="right"||i==="bottom"||i==="left")&&o){let a=this.spacingValues[o];if(a){this.addRule(t,{[i]:a});return}}if(i==="inset"&&o){let a=this.spacingValues[o];if(a){this.addRule(t,{top:a,right:a,bottom:a,left:a});return}}if(i==="inset-x"&&o){let a=this.spacingValues[o];if(a){this.addRule(t,{left:a,right:a});return}}if(i==="inset-y"&&o){let a=this.spacingValues[o];if(a){this.addRule(t,{top:a,bottom:a});return}}if(i==="bg"&&o){let a=this.commonColors[o];if(a){this.addRule(t,{"background-color":a});return}}if(i==="text"&&o){let a=this.commonColors[o];if(a){this.addRule(t,{color:a});return}}if(i==="border"&&o){let a=this.commonColors[o];if(a){this.addRule(t,{"border-color":a});return}}if(i==="justify"&&o){let a=zy[o];if(a){this.addRule(t,{"justify-content":a});return}}if(i==="items"&&o){let a=Ky[o];if(a){this.addRule(t,{"align-items":a});return}}if(i==="content"&&o){let a=Hy[o];if(a){this.addRule(t,{"align-content":a});return}if(t.arbitrary){this.addRule(t,{content:o});return}}if(i==="self"&&o){let a=Gy[o];if(a){this.addRule(t,{"align-self":a});return}}if(i==="grid-cols"&&o){let a=tb[o];if(a){this.addRule(t,{"grid-template-columns":a});return}}if(i==="grid-rows"&&o){let a=rb[o];if(a){this.addRule(t,{"grid-template-rows":a});return}}if(i==="col"&&o){let a=nb[o];if(a){this.addRule(t,{"grid-column":a});return}}if(i==="row"&&o){let a=ib[o];if(a){this.addRule(t,{"grid-row":a});return}}if(i==="grid-flow"&&o){let a=ob[o];if(a){this.addRule(t,{"grid-auto-flow":a});return}}if(i==="auto-cols"&&o){let a=Ml[o];if(a){this.addRule(t,{"grid-auto-columns":a});return}}if(i==="auto-rows"&&o){let a=Ml[o];if(a){this.addRule(t,{"grid-auto-rows":a});return}}if(i==="origin"&&o){let a=eb[o];if(a){this.addRule(t,{"transform-origin":a});return}}if(i==="scale"&&o&&!t.arbitrary){let a=Number(o)/100;if(!Number.isNaN(a)){this.addRule(t,{transform:`scale(${a})`});return}}if(i==="scale-x"&&o&&!t.arbitrary){let a=Number(o)/100;if(!Number.isNaN(a)){this.addRule(t,{transform:`scaleX(${a})`});return}}if(i==="scale-y"&&o&&!t.arbitrary){let a=Number(o)/100;if(!Number.isNaN(a)){this.addRule(t,{transform:`scaleY(${a})`});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=(a)=>{let u=this.config.theme.spacing[a];if(u!==void 0)return u;if(t.arbitrary)return a;if(/^\d+(?:\.\d+)?$/.test(a)){let f=Number.parseFloat(a);if(Number.isFinite(f))return`${f*0.25}rem`}return};if(i==="gap"&&o){let a=s(o);if(a!==void 0)this.addRule(t,{gap:a});return}if(i==="gap-x"&&o){let a=s(o);if(a!==void 0)this.addRule(t,{"column-gap":a});return}if(i==="gap-y"&&o){let a=s(o);if(a!==void 0)this.addRule(t,{"row-gap":a});return}if(i==="place"&&o){if(o.startsWith("content-")){let a=bi[o.slice(8)];if(a){this.addRule(t,{"place-content":a});return}}if(o.startsWith("items-")){let a=bi[o.slice(6)];if(a){this.addRule(t,{"place-items":a});return}}if(o.startsWith("self-")){let a=bi[o.slice(5)];if(a){this.addRule(t,{"place-self":a});return}}}let c=`${t.utility}:${t.value||""}`;if(this.noMatchCache.has(c))return;if(this.config.rules.length>0)for(let[a,u]of this.config.rules){let f=e.match(a);if(f){let d=u(f);if(d){this.addRule(t,d);return}}}let l=yi.length;for(let a=0;a<l;a++){let u=yi[a](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(c)}isVariantHandled(e){let t=this.variantHandledCache.get(e);if(t!==void 0)return t;let r=zr[e]!==void 0||zl[e]!==void 0||Kl[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==="**"||$i(e)!==void 0||e.startsWith("in-")&&Ci(e.slice(3))!==void 0||e.startsWith("group-")||e.startsWith("group/")||e.startsWith("peer-")||e.startsWith("peer/")||e.startsWith("has-")||e.startsWith("aria-")||e.startsWith("data-")||e.startsWith("supports-")||e.startsWith("[")&&e.endsWith("]")||vi[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}=w0(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=Ul[e];if(t!==void 0)return{media:t};let r=vi[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:Vl(i)}:void 0}return}isNegationResolvable(e){return jl(e)!==void 0||this.negatableAtRule(e)!==void 0}addRule(e,t,r,n,i){for(let a=0;a<e.variants.length;a++)if(!this.isVariantHandled(e.variants[a]))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 c=this.getMediaQuery(e);if(e.important){let a={};for(let u in t)a[u]=`${t[u]} !important`;t=a}let l=c||"base";if(!this.rules.has(l))this.rules.set(l,[]);this.revision++,this.rules.get(l).push({selector:s,properties:t,mediaQuery:c,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 c=zr[s];if(c!==void 0){if(this.variantEnabled[s])t+=c;continue}let l=Kl[s];if(l!==void 0){if(this.variantEnabled[s]){let u=t.indexOf("::");t=u===-1?t+l:t.slice(0,u)+l+t.slice(u)}continue}let a=zl[s];if(a!==void 0){if(this.darkStrategy==="media"&&(s==="dark"||s==="light"))continue;if(this.variantEnabled[s])r=a;continue}if(s.charCodeAt(0)===110&&s.startsWith("not-")){if(this.variantEnabled.not){let u=jl(s.slice(4));if(u!==void 0)t+=`:not(${u})`}continue}if(s.charCodeAt(0)===110&&s.startsWith("nth-")){let u=$i(s);if(u!==void 0)t+=u;continue}if(s.charCodeAt(0)===105&&s.startsWith("in-")){if(this.variantEnabled.in){let u=Ci(s.slice(3));if(u!==void 0)r=`:where(${u}) `}continue}if(s.charCodeAt(0)===103&&s.startsWith("group-")){if(this.variantEnabled.group){let u=s.slice(6);if(u.startsWith("has-")){let f=u.slice(4);if(f.charCodeAt(0)===91&&f.charCodeAt(f.length-1)===93)r=`.group:has(${f.slice(1,-1)}) `;else r=`.group:has(:${f}) `}else r=`.group:${u} `}continue}if(s.charCodeAt(0)===103&&s.startsWith("group/")){if(this.variantEnabled.group)r=`.group\\/${s.slice(6)} `;continue}if(s.charCodeAt(0)===112&&s.startsWith("peer-")){if(this.variantEnabled.peer){let u=s.slice(5);if(u.startsWith("has-")){let f=u.slice(4);if(f.charCodeAt(0)===91&&f.charCodeAt(f.length-1)===93)r=`.peer:has(${f.slice(1,-1)}) ~ `;else r=`.peer:has(:${f}) ~ `}else r=`.peer:${u} ~ `}continue}if(s.charCodeAt(0)===112&&s.startsWith("peer/")){if(this.variantEnabled.peer)r=`.peer\\/${s.slice(5)} ~ `;continue}if(s.charCodeAt(0)===104&&s.startsWith("has-")){if(this.variantEnabled.has){let u=s.slice(4);if(u.charCodeAt(0)===91&&u.charCodeAt(u.length-1)===93){let f=u.slice(1,-1);t+=`:has(${f})`}else t+=`:has(:${u})`}continue}if(s.charCodeAt(0)===97&&s.startsWith("aria-")){if(this.variantEnabled.aria){let u=s.slice(5);if(u.charCodeAt(0)===91&&u.charCodeAt(u.length-1)===93){let f=u.slice(1,-1);t+=`[aria-${f}]`}else t+=`[aria-${u}="true"]`}continue}if(s.charCodeAt(0)===100&&s.startsWith("data-")){if(this.variantEnabled.data){let u=s.slice(5);if(u.charCodeAt(0)===91&&u.charCodeAt(u.length-1)===93){let f=u.slice(1,-1);t+=`[data-${f}]`}else t+=`[data-${u}]`}continue}}return r+t}getMediaQuery(e){let t=e.variants,r=t.length;if(r===0)return;let n=r===1?t[0]:t.join(":"),i=this.mediaQueryCache.get(n);if(i!==void 0)return i||void 0;let o=[],s=[],c=[],l=!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 g=f.slice(1,-1).replace(/_/g," ").slice(6).trim();if(g)o.push(g);continue}if(d===64){let g=this.containerQuery(f.slice(1));if(g!==void 0)c.push(g);continue}if(d===110&&f.startsWith("not-")){if(this.variantEnabled.not){let g=this.negatableAtRule(f.slice(4));if(g!==void 0)if(g.supports!==void 0)s.push(`@supports not ${g.supports}`);else o.push(`not ${g.media}`)}continue}if(this.darkStrategy==="media"&&(f==="dark"||f==="light")){o.push(`(prefers-color-scheme: ${f})`);continue}if(this.variantEnabled.responsive){let g=this.screenBreakpoints.get(f);if(g){o.push(`(min-width: ${g})`);continue}if(f.startsWith("max-")){let m=this.screenBreakpoints.get(f.slice(4));if(m){let y=m.match(/^([\d.]+)px$/);o.push(y?`(max-width: ${Number.parseFloat(y[1])-0.02}px)`:`not all and (min-width: ${m})`);continue}}}if(f==="starting"){if(this.variantEnabled.starting)l=!0;continue}let h=vi[f];if(h!==void 0){if(this.variantEnabled[f])o.push(h);continue}let p=Ul[f];if(p!==void 0){if(this.variantEnabled[f])o.push(p);continue}if(f.charCodeAt(0)===115&&f.startsWith("supports-")){if(this.variantEnabled.supports)s.push(`@supports ${Vl(f.slice(9))}`)}}let a=[];if(o.length>0)o.sort((u,f)=>Number(u.charCodeAt(0)===40)-Number(f.charCodeAt(0)===40)),a.push(`@media ${o.join(" and ")}`);if(a.push(...s,...c),l)a.push("@starting-style");if(a.length>0){let u=a.join(Wl);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(`
369
369
  `)}toCSS(e=!0,t=!1){if(this.cssCache!==null&&this.cssCacheRevision===this.revision&&this.cssCachePreflight===e&&this.cssCacheMinify===t)return this.cssCache;let r=[],n=this.buildFontCSS();if(n)r.push(t?n.replace(/\s*\n\s*/g,""):n);if(e)for(let l of this.config.preflights){let a=l.getCSS(),u=this.config.theme?.fontFamily?.sans;if(u&&Array.isArray(u)){let d=u.join(", ");a=a.replace(/font-family:\s*ui-sans-serif[^;]+;/g,`font-family: ${d};`)}let f=`@layer tc-base {
370
370
  ${a}
371
- }`;r.push(t?Dl(f):f)}if(this.config.cssVariables){let l=this.generateCSSVariables();if(l)r.push(t?l.replace(/\s+/g," ").trim():l)}let i=this.rules.get("base")||[];if(i.length>0)r.push(this.rulesToCSS(i,t));if(this.usedKeyframes.size>0)for(let l of this.usedKeyframes){let a=Xy[l];if(a)r.push(t?Dl(a):a)}let o=[...this.rules.entries()].filter(([l,a])=>l!=="base"&&a.length>0),s=(l)=>{let a=l.match(/min-width:\s*([\d.]+)(px|rem|em)/);if(!a)return Number.MAX_SAFE_INTEGER;let u=Number.parseFloat(a[1]);return a[2]==="px"?u:u*16};o.sort((l,a)=>s(l[1][0].mediaQuery)-s(a[1][0].mediaQuery));for(let[,l]of o){let a=l[0].mediaQuery.split(Ul),u=this.rulesToCSS(l,t);for(let f=a.length-1;f>=0;f--)u=t?`${a[f]}{${u}}`:`${a[f]} {
371
+ }`;r.push(t?Bl(f):f)}if(this.config.cssVariables){let l=this.generateCSSVariables();if(l)r.push(t?l.replace(/\s+/g," ").trim():l)}let i=this.rules.get("base")||[];if(i.length>0)r.push(this.rulesToCSS(i,t));if(this.usedKeyframes.size>0)for(let l of this.usedKeyframes){let a=Qy[l];if(a)r.push(t?Bl(a):a)}let o=[...this.rules.entries()].filter(([l,a])=>l!=="base"&&a.length>0),s=(l)=>{let a=l.match(/min-width:\s*([\d.]+)(px|rem|em)/);if(!a)return Number.MAX_SAFE_INTEGER;let u=Number.parseFloat(a[1]);return a[2]==="px"?u:u*16};o.sort((l,a)=>s(l[1][0].mediaQuery)-s(a[1][0].mediaQuery));for(let[,l]of o){let a=l[0].mediaQuery.split(Wl),u=this.rulesToCSS(l,t);for(let f=a.length-1;f>=0;f--)u=t?`${a[f]}{${u}}`:`${a[f]} {
372
372
  ${u}
373
373
  }`;r.push(u)}let c=t?r.join(""):r.join(`
374
374
 
375
- `);return this.cssCache=c,this.cssCacheRevision=this.revision,this.cssCachePreflight=e,this.cssCacheMinify=t,c}getUtilityRank(e){let t=this.utilityRankCache.get(e);if(t!==void 0)return t;let r=P0(e);return this.utilityRankCache.set(e,r),r}rulesToCSS(e,t){let r=e.length,n=Array.from({length:r}),i=Array.from({length:r});for(let c=0;c<r;c++)n[c]=this.getUtilityRank(e[c].selector),i[c]=c;i.sort((c,l)=>n[c]-n[l]||c-l);let o=new Map;for(let c=0;c<r;c++){let l=e[i[c]],a=o.get(l.selector);if(a===void 0)a=new Map,o.set(l.selector,a);let u=l.properties;for(let f in u)a.set(f,u[f])}let s=[];for(let[c,l]of o){let a="",u=!0;for(let[f,d]of l){if(t){if(!u)a+=";";a+=`${f}:${d}`}else{if(!u)a+=`
375
+ `);return this.cssCache=c,this.cssCacheRevision=this.revision,this.cssCachePreflight=e,this.cssCacheMinify=t,c}getUtilityRank(e){let t=this.utilityRankCache.get(e);if(t!==void 0)return t;let r=L0(e);return this.utilityRankCache.set(e,r),r}rulesToCSS(e,t){let r=e.length,n=Array.from({length:r}),i=Array.from({length:r});for(let c=0;c<r;c++)n[c]=this.getUtilityRank(e[c].selector),i[c]=c;i.sort((c,l)=>n[c]-n[l]||c-l);let o=new Map;for(let c=0;c<r;c++){let l=e[i[c]],a=o.get(l.selector);if(a===void 0)a=new Map,o.set(l.selector,a);let u=l.properties;for(let f in u)a.set(f,u[f])}let s=[];for(let[c,l]of o){let a="",u=!0;for(let[f,d]of l){if(t){if(!u)a+=";";a+=`${f}:${d}`}else{if(!u)a+=`
376
376
  `;a+=` ${f}: ${d};`}u=!1}s.push(t?`${c}{${a}}`:`${c} {
377
377
  ${a}
378
378
  }`)}return t?s.join(""):s.join(`
379
379
 
380
- `)}generateCSSVariables(){let e=this.extendColors;if(!e){let r=Tr.theme.colors,n={};for(let[i,o]of Object.entries(this.config.theme.colors)){let s=r[i];if(typeof o==="string"){if(s!==o)n[i]=o}else if(o&&typeof o==="object")if(!s||typeof s!=="object")n[i]=o;else{let c={};for(let[l,a]of Object.entries(o))if(typeof a==="string"&&s[l]!==a)c[l]=a;if(Object.keys(c).length>0)n[i]=c}}e=n}if(!e||Object.keys(e).length===0)return null;let t=[];for(let[r,n]of Object.entries(e))if(typeof n==="string")t.push(` --${r}: ${n};`);else if(typeof n==="object"&&n!==null){for(let[i,o]of Object.entries(n))if(typeof o==="string")t.push(i==="DEFAULT"?` --${r}: ${o};`:` --${r}-${i}: ${o};`)}if(t.length===0)return null;return`:root {
380
+ `)}generateCSSVariables(){let e=this.extendColors;if(!e){let r=dt.theme.colors,n={};for(let[i,o]of Object.entries(this.config.theme.colors)){let s=r[i];if(typeof o==="string"){if(s!==o)n[i]=o}else if(o&&typeof o==="object")if(!s||typeof s!=="object")n[i]=o;else{let c={};for(let[l,a]of Object.entries(o))if(typeof a==="string"&&s[l]!==a)c[l]=a;if(Object.keys(c).length>0)n[i]=c}}e=n}if(!e||Object.keys(e).length===0)return null;let t=[];for(let[r,n]of Object.entries(e))if(typeof n==="string")t.push(` --${r}: ${n};`);else if(typeof n==="object"&&n!==null){for(let[i,o]of Object.entries(n))if(typeof o==="string")t.push(i==="DEFAULT"?` --${r}: ${o};`:` --${r}-${i}: ${o};`)}if(t.length===0)return null;return`:root {
381
381
  ${t.join(`
382
382
  `)}
383
- }`}reset(){this.revision++,this.rules.clear(),this.classCache.clear(),this.selectorCache.clear(),this.mediaQueryCache.clear(),this.noMatchCache.clear(),this.usedKeyframes.clear(),this.compiledGenerated.clear(),this.utilityRankCache.clear()}}var{Glob:_0}=globalThis.Bun;var L0=32;class Ci{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(a,u)=>{try{let f=new _0(a);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,L0),s=0;await Promise.all(Array.from({length:o},async()=>{while(s<i.length){let a=i[s++];try{let u=await Bun.file(a).text();if(this.transformer){let f=this.transformer.processFile(u);if(f.hasChanges)t.set(a,f.content),u=f.content}for(let f of Kt(u,this.extractOptions))e.add(f)}catch{}}}));let l=this.patterns.filter((a,u)=>!n[u]);return{classes:e,transformedFiles:t,unmatchedPatterns:l}}async scanFile(e){try{let t=await Bun.file(e).text();return Kt(t,this.extractOptions)}catch{return new Set}}scanContent(e){return Kt(e,this.extractOptions)}}import{resolve as U0}from"path";var{Glob:W0}=globalThis.Bun;import{statSync as j0}from"fs";var ec=new Map;function tc(e){let t=ec.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 ec.set(e,r),r}class rc{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?"":`
384
- `,r=[];for(let i of this.vars)r.push(D0(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(F0(i,e));return r.join(t)}}function M0(e,t){let r=tc(e.property),n=t?"":" ";return e.values.map((i)=>`${r}:${n}${i}`).join(t?";":"; ")}function F0(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?"":" "}${M0(e,t)}${t?"":" "}}`;return nc(o,r,t)}function D0(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 nc(i,e.atRule?[e.atRule]:[],t)}function nc(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 Ri=new rc;function ic(e=!1){return Ri.toCSS(e)}function oc(){Ri.clear()}function sc(){return Ri.currentGeneration}async function ac(e){try{await import(`${e}?mtime=${B0(e)}&gen=${sc()}`)}catch(t){throw Error(`Failed to evaluate style module ${e}: ${t.message}`,{cause:t})}}function B0(e){try{return j0(e).mtimeMs}catch{return 0}}async function lc(e,t={}){let r=t.cwd??process.cwd(),n=new Set,i=Array.from({length:e.length},()=>!1);await Promise.all(e.map(async(s,c)=>{try{let l=new W0(s);for await(let a of l.scan(r))i[c]=!0,n.add(U0(r,a))}catch{}}));let o=[...n].sort();for(let s of o)await ac(s);return{css:ic(t.minify??!1),modules:o,unmatchedPatterns:e.filter((s,c)=>!i[c])}}function V0(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 z0(e,t={}){let r=t.trigger||":tc:",n=new Map,i=/(?:class|className)=["']([^"']*)["']/g,o;while((o=i.exec(e))!==null){let s=o[1];if(s.trim().startsWith(r)){let c=s.replace(r,"").trim().split(/\s+/).filter(Boolean);if(c.length>0){let l=c.sort().join(" ");if(!n.has(l))n.set(l,c)}}}return n}function K0(e,t,r={}){let n=r.trigger||":tc:",i=e,o=/(?:class|className)=["']([^"']*)["']/g,s,c=[];while((s=o.exec(e))!==null){let l=s[1];if(l.trim().startsWith(n)){let u=l.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('"')?'"':"'",p=`${d}=${h}${f}${h}`;c.push({start:s.index,end:s.index+s[0].length,replacement:p})}}}for(let l=c.length-1;l>=0;l--){let{start:a,end:u,replacement:f}=c[l];i=i.substring(0,a)+f+i.substring(u)}return i}function H0(e,t={}){let r=t.classPrefix||"tc-",n=t.hashFn||V0,i=new Map;for(let[o]of e){let s=n(o),c=`${r}${s}`;i.set(o,c)}return i}class ki{compiledClasses=new Map;classNameMap=new Map;options;constructor(e={}){this.options={trigger:":tc:",classPrefix:"tc-",layer:"shortcuts",...e}}processFile(e){let t=z0(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=H0(this.compiledClasses,this.options);let n=K0(e,this.classNameMap,this.options);return{content:n,hasChanges:n!==e}}getCompiledClasses(){let e=new Map;for(let[t,r]of this.compiledClasses){let n=this.classNameMap.get(t);if(n)e.set(t,{className:n,utilities:r})}return e}generateCSS(e,t){let r=this.getCompiledClasses(),n="";for(let[,{className:i,utilities:o}]of r){for(let c of o)t.generate(c);let s=t.toCSS(!1);n+=`
383
+ }`}reset(){this.revision++,this.rules.clear(),this.classCache.clear(),this.selectorCache.clear(),this.mediaQueryCache.clear(),this.noMatchCache.clear(),this.usedKeyframes.clear(),this.compiledGenerated.clear(),this.utilityRankCache.clear()}}var{Glob:M0}=globalThis.Bun;var F0=32;class ki{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(a,u)=>{try{let f=new M0(a);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,F0),s=0;await Promise.all(Array.from({length:o},async()=>{while(s<i.length){let a=i[s++];try{let u=await Bun.file(a).text();if(this.transformer){let f=this.transformer.processFile(u);if(f.hasChanges)t.set(a,f.content),u=f.content}for(let f of Gt(u,this.extractOptions))e.add(f)}catch{}}}));let l=this.patterns.filter((a,u)=>!n[u]);return{classes:e,transformedFiles:t,unmatchedPatterns:l}}async scanFile(e){try{let t=await Bun.file(e).text();return Gt(t,this.extractOptions)}catch{return new Set}}scanContent(e){return Gt(e,this.extractOptions)}}import{resolve as W0}from"path";var{Glob:z0}=globalThis.Bun;import{statSync as U0}from"fs";var rc=new Map;function nc(e){let t=rc.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 rc.set(e,r),r}class ic{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?"":`
384
+ `,r=[];for(let i of this.vars)r.push(B0(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(j0(i,e));return r.join(t)}}function D0(e,t){let r=nc(e.property),n=t?"":" ";return e.values.map((i)=>`${r}:${n}${i}`).join(t?";":"; ")}function j0(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?"":" "}${D0(e,t)}${t?"":" "}}`;return oc(o,r,t)}function B0(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 oc(i,e.atRule?[e.atRule]:[],t)}function oc(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 Si=new ic;function sc(e=!1){return Si.toCSS(e)}function ac(){Si.clear()}function lc(){return Si.currentGeneration}async function cc(e){try{await import(`${e}?mtime=${V0(e)}&gen=${lc()}`)}catch(t){throw Error(`Failed to evaluate style module ${e}: ${t.message}`,{cause:t})}}function V0(e){try{return U0(e).mtimeMs}catch{return 0}}async function uc(e,t={}){let r=t.cwd??process.cwd(),n=new Set,i=Array.from({length:e.length},()=>!1);await Promise.all(e.map(async(s,c)=>{try{let l=new z0(s);for await(let a of l.scan(r))i[c]=!0,n.add(W0(r,a))}catch{}}));let o=[...n].sort();for(let s of o)await cc(s);return{css:sc(t.minify??!1),modules:o,unmatchedPatterns:e.filter((s,c)=>!i[c])}}function K0(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 H0(e,t={}){let r=t.trigger||":tc:",n=new Map,i=/(?:class|className)=["']([^"']*)["']/g,o;while((o=i.exec(e))!==null){let s=o[1];if(s.trim().startsWith(r)){let c=s.replace(r,"").trim().split(/\s+/).filter(Boolean);if(c.length>0){let l=c.sort().join(" ");if(!n.has(l))n.set(l,c)}}}return n}function G0(e,t,r={}){let n=r.trigger||":tc:",i=e,o=/(?:class|className)=["']([^"']*)["']/g,s,c=[];while((s=o.exec(e))!==null){let l=s[1];if(l.trim().startsWith(n)){let u=l.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('"')?'"':"'",p=`${d}=${h}${f}${h}`;c.push({start:s.index,end:s.index+s[0].length,replacement:p})}}}for(let l=c.length-1;l>=0;l--){let{start:a,end:u,replacement:f}=c[l];i=i.substring(0,a)+f+i.substring(u)}return i}function q0(e,t={}){let r=t.classPrefix||"tc-",n=t.hashFn||K0,i=new Map;for(let[o]of e){let s=n(o),c=`${r}${s}`;i.set(o,c)}return i}class Ai{compiledClasses=new Map;classNameMap=new Map;options;constructor(e={}){this.options={trigger:":tc:",classPrefix:"tc-",layer:"shortcuts",...e}}processFile(e){let t=H0(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=q0(this.compiledClasses,this.options);let n=G0(e,this.classNameMap,this.options);return{content:n,hasChanges:n!==e}}getCompiledClasses(){let e=new Map;for(let[t,r]of this.compiledClasses){let n=this.classNameMap.get(t);if(n)e.set(t,{className:n,utilities:r})}return e}generateCSS(e,t){let r=this.getCompiledClasses(),n="";for(let[,{className:i,utilities:o}]of r){for(let c of o)t.generate(c);let s=t.toCSS(!1);n+=`
385
385
  /* Compiled class: ${i} */
386
386
  `,n+=`/* Original utilities: ${o.join(" ")} */
387
- `}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 Si(e){let t=performance.now(),r=e.compileClass?.enabled?new ki({trigger:e.compileClass.trigger,classPrefix:e.compileClass.classPrefix,layer:e.compileClass.layer}):null,n=new Ci(e.content,r,{attributify:e.attributify,bracketSyntax:e.bracketSyntax,codeStrings:e.codeStrings}),{classes:i,transformedFiles:o,unmatchedPatterns:s}=await n.scan();for(let f of e.safelist)if(typeof f==="string")i.add(f);else console.warn(`\u26A0\uFE0F Ignoring non-string safelist entry (patterns are not supported): ${JSON.stringify(f)}`);let c=new $i(e);for(let f of i)c.generate(f);if(r){let f=r.getCompiledClasses();for(let[,{className:d,utilities:h}]of f)c.generateCompiledClass(d,h)}let l=c.toCSS(e.includePreflight!==!1,e.minify),a;if(e.styles&&e.styles.length>0){oc();let f=await lc(e.styles,{minify:e.minify});if(a=f.modules,f.css)l+=(e.minify?"":`
388
- `)+f.css;s.push(...f.unmatchedPatterns)}let u=performance.now()-t;return{css:l,classes:i,duration:u,compiledClasses:r?.getCompiledClasses(),transformedFiles:o,unmatchedPatterns:s,styleModules:a}}async function G0(e,t){await Bun.write(t,e)}async function q0(e){let t=Array.from(e.entries()).map(([r,n])=>Bun.write(r,n));await Promise.all(t)}async function cc(e){let t=await Si(e);if(await G0(t.css,e.output),t.transformedFiles&&t.transformedFiles.size>0)await q0(t.transformedFiles);return t}var $e=new Zr("cssx");async function zr(e){if(e){let t=Ai(pe.cwd(),e);if(!je(t))console.error(`\u274C Config file not found: ${t}`),pe.exit(1);try{let r=await import(t);return{...oi,...r.default||r}}catch(r){console.error(`\u274C Failed to load config file: ${t}`),console.error(r),pe.exit(1)}}return qs()}function Q0(e){if(e)return Ai(pe.cwd(),e);for(let t of["css.config.ts","css.config.js","css.config.mjs"]){let r=Ai(pe.cwd(),t);if(je(r))return r}return null}function Ei(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 Vr(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 cc(e);if(i.unmatchedPatterns&&i.unmatchedPatterns.length>0)for(let o of i.unmatchedPatterns)console.warn(`\u26A0\uFE0F Content pattern matched no files: ${o}`);if(console.log(`\u2705 Built ${i.classes.size} classes in ${i.duration.toFixed(2)}ms`),console.log(`\uD83D\uDCDD Output: ${e.output}`),i.compiledClasses&&i.compiledClasses.size>0){if(console.log(`\uD83D\uDD28 Compiled ${i.compiledClasses.size} class groups`),i.transformedFiles)console.log(`\uD83D\uDCDD Transformed ${i.transformedFiles.size} files`);if(r){console.log(`
387
+ `}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 Ei(e){let t=performance.now(),r=e.compileClass?.enabled?new Ai({trigger:e.compileClass.trigger,classPrefix:e.compileClass.classPrefix,layer:e.compileClass.layer}):null,n=new ki(e.content,r,{attributify:e.attributify,bracketSyntax:e.bracketSyntax,codeStrings:e.codeStrings}),{classes:i,transformedFiles:o,unmatchedPatterns:s}=await n.scan();for(let f of e.safelist)if(typeof f==="string")i.add(f);else console.warn(`\u26A0\uFE0F Ignoring non-string safelist entry (patterns are not supported): ${JSON.stringify(f)}`);let c=new Ri(e);for(let f of i)c.generate(f);if(r){let f=r.getCompiledClasses();for(let[,{className:d,utilities:h}]of f)c.generateCompiledClass(d,h)}let l=c.toCSS(e.includePreflight!==!1,e.minify),a;if(e.styles&&e.styles.length>0){ac();let f=await uc(e.styles,{minify:e.minify});if(a=f.modules,f.css)l+=(e.minify?"":`
388
+ `)+f.css;s.push(...f.unmatchedPatterns)}let u=performance.now()-t;return{css:l,classes:i,duration:u,compiledClasses:r?.getCompiledClasses(),transformedFiles:o,unmatchedPatterns:s,styleModules:a}}async function Y0(e,t){await Bun.write(t,e)}async function J0(e){let t=Array.from(e.entries()).map(([r,n])=>Bun.write(r,n));await Promise.all(t)}async function fc(e){let t=await Ei(e);if(await Y0(t.css,e.output),t.transformedFiles&&t.transformedFiles.size>0)await J0(t.transformedFiles);return t}var Ce=new en("cssx");async function Hr(e){if(e){let t=Ti(ye.cwd(),e);if(!Be(t))console.error(`\u274C Config file not found: ${t}`),ye.exit(1);try{let r=await import(t);return{...ai,...r.default||r}}catch(r){console.error(`\u274C Failed to load config file: ${t}`),console.error(r),ye.exit(1)}}return Js()}function tx(e){if(e)return Ti(ye.cwd(),e);for(let t of["css.config.ts","css.config.js","css.config.mjs"]){let r=Ti(ye.cwd(),t);if(Be(r))return r}return null}function Ni(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 Kr(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 fc(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(`
389
389
  \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(`
390
- \uD83D\uDCCB Classes found (${i.classes.size}):`),o.forEach((s)=>console.log(` - ${s}`))}if(je(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);pe.exit(1)}}function fc(e,t){console.log("\uD83D\uDC40 Watching for changes...");let r={current:e},n=Q0(t.config);if(n)try{uc(n,async()=>{try{let c=await import(`${n}?t=${Date.now()}`);r.current=Ei({...oi,...c.default||c},t),console.log(`
391
- \u2699\uFE0F ${n} changed, rebuilding with fresh config...`),await Vr(r.current,t)}catch(c){console.warn("\u26A0\uFE0F Failed to reload config:",c instanceof Error?c.message:c)}})}catch{}let i=new Set;for(let c of e.content){let l=c.search(/[*?[{]/),a=l===-1?c:c.slice(0,l);if(l!==-1||!je(a)||!Y0(a).isDirectory())a=a.slice(0,a.lastIndexOf("/")+1)||".";while(a!=="."&&a!=="/"&&!je(a)){let u=X0(a);if(u===a)break;a=u}if(je(a))i.add(a);else console.warn(`\u26A0\uFE0F Skipping watch for missing path: ${c}`)}let o=null,s=(c)=>{if(o)clearTimeout(o);o=setTimeout(async()=>{o=null,console.log(`
392
- \uD83D\uDCDD ${c} changed, rebuilding...`),await Vr(r.current,t)},50)};for(let c of i)try{uc(c,{recursive:!0},(l,a)=>{if(a&&/\.(?:html|js|ts|jsx|tsx|stx)$/.test(a))s(a)})}catch(l){console.warn(`\u26A0\uFE0F Could not watch ${c}:`,l instanceof Error?l.message:l)}console.log(`
393
- \uD83D\uDC40 Watching: ${Array.from(i).join(", ")}`)}$e.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=Ei(t,e);if(await Vr(r,e),e.watch||r.watch)fc(r,e)});$e.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=Ei(t,e);await Vr(r,e),fc(r,e)});$e.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(je("./css.config.ts")&&!e.force)console.error("\u274C Config file already exists. Use --force to overwrite."),pe.exit(1);let r=`import type { CssOptions } from '@ts-css/core'
390
+ \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 hc(e,t){console.log("\uD83D\uDC40 Watching for changes...");let r={current:e},n=tx(t.config);if(n)try{dc(n,async()=>{try{let c=await import(`${n}?t=${Date.now()}`);r.current=Ni({...ai,...c.default||c},t),console.log(`
391
+ \u2699\uFE0F ${n} changed, rebuilding with fresh config...`),await Kr(r.current,t)}catch(c){console.warn("\u26A0\uFE0F Failed to reload config:",c instanceof Error?c.message:c)}})}catch{}let i=new Set;for(let c of e.content){let l=c.search(/[*?[{]/),a=l===-1?c:c.slice(0,l);if(l!==-1||!Be(a)||!X0(a).isDirectory())a=a.slice(0,a.lastIndexOf("/")+1)||".";while(a!=="."&&a!=="/"&&!Be(a)){let u=Q0(a);if(u===a)break;a=u}if(Be(a))i.add(a);else console.warn(`\u26A0\uFE0F Skipping watch for missing path: ${c}`)}let o=null,s=(c)=>{if(o)clearTimeout(o);o=setTimeout(async()=>{o=null,console.log(`
392
+ \uD83D\uDCDD ${c} changed, rebuilding...`),await Kr(r.current,t)},50)};for(let c of i)try{dc(c,{recursive:!0},(l,a)=>{if(a&&/\.(?:html|js|ts|jsx|tsx|stx)$/.test(a))s(a)})}catch(l){console.warn(`\u26A0\uFE0F Could not watch ${c}:`,l instanceof Error?l.message:l)}console.log(`
393
+ \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 Hr(e.config),r=Ni(t,e);if(await Kr(r,e),e.watch||r.watch)hc(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 Hr(e.config),r=Ni(t,e);await Kr(r,e),hc(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 '@ts-css/core'
394
394
 
395
395
  const config = {
396
396
  content: ['./src/**/*.{html,js,ts,jsx,tsx,stx}'],
@@ -401,7 +401,7 @@ const config = {
401
401
 
402
402
  export default config
403
403
  `;try{await Bun.write("./css.config.ts",r),console.log("\u2705 Created css.config.ts"),console.log(`
404
- 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),pe.exit(1)}});$e.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...
405
- `);let r=await Si(t),n=new Map;for(let c of r.classes)n.set(c,0);for(let c of t.content){let l=new Z0(c);for await(let a of l.scan(".")){let u;try{u=await Bun.file(a).text()}catch{continue}for(let f of r.classes){let d=u.indexOf(f);while(d!==-1)n.set(f,n.get(f)+1),d=u.indexOf(f,d+f.length)}}}let i=(c)=>{let l=c,a=l.indexOf("["),u=l.lastIndexOf(":",a===-1?l.length:a);if(u!==-1)l=l.slice(u+1);if(l.startsWith("!"))l=l.slice(1);if(l.endsWith("!"))l=l.slice(0,-1);if(l.startsWith("-"))l=l.slice(1);if(l.startsWith("["))return"arbitrary";return l.split("-")[0]||"other"},o=new Map;for(let c of r.classes){let l=i(c);if(!o.has(l))o.set(l,[]);o.get(l).push(c)}let s={totalClasses:r.classes.size,buildTime:r.duration,outputSize:Buffer.byteLength(r.css),utilityGroups:Object.fromEntries(Array.from(o.entries()).map(([c,l])=>[c,l.length]).sort((c,l)=>l[1]-c[1])),topClasses:[...n.entries()].sort((c,l)=>l[1]-c[1]).slice(0,e.top||10).map(([c,l])=>({class:c,count:l}))};if(e.json)console.log(JSON.stringify(s,null,2));else{console.log(`\uD83D\uDCCA Total classes: ${s.totalClasses}`),console.log(`\u23F1\uFE0F Build time: ${s.buildTime.toFixed(2)}ms`),console.log(`\uD83D\uDCE6 Output size: ${(s.outputSize/1024).toFixed(2)} KB
404
+ 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 Hr(e.config);if(!e.json)console.log(`\uD83D\uDD0D Analyzing utility classes...
405
+ `);let r=await Ei(t),n=new Map;for(let c of r.classes)n.set(c,0);for(let c of t.content){let l=new ex(c);for await(let a of l.scan(".")){let u;try{u=await Bun.file(a).text()}catch{continue}for(let f of r.classes){let d=u.indexOf(f);while(d!==-1)n.set(f,n.get(f)+1),d=u.indexOf(f,d+f.length)}}}let i=(c)=>{let l=c,a=l.indexOf("["),u=l.lastIndexOf(":",a===-1?l.length:a);if(u!==-1)l=l.slice(u+1);if(l.startsWith("!"))l=l.slice(1);if(l.endsWith("!"))l=l.slice(0,-1);if(l.startsWith("-"))l=l.slice(1);if(l.startsWith("["))return"arbitrary";return l.split("-")[0]||"other"},o=new Map;for(let c of r.classes){let l=i(c);if(!o.has(l))o.set(l,[]);o.get(l).push(c)}let s={totalClasses:r.classes.size,buildTime:r.duration,outputSize:Buffer.byteLength(r.css),utilityGroups:Object.fromEntries(Array.from(o.entries()).map(([c,l])=>[c,l.length]).sort((c,l)=>l[1]-c[1])),topClasses:[...n.entries()].sort((c,l)=>l[1]-c[1]).slice(0,e.top||10).map(([c,l])=>({class:c,count:l}))};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
406
406
  `),console.log(`\uD83C\uDFF7\uFE0F Utility groups (top ${e.top}):`);let c=Object.entries(s.utilityGroups).slice(0,e.top||10);for(let[l,a]of c)console.log(` ${l.padEnd(20)} ${a} classes`);if(e.verbose){console.log(`
407
- \uD83D\uDCCB All classes:`);for(let l of Array.from(r.classes).sort())console.log(` - ${l}`)}}}catch(t){console.error("\u274C Analysis failed:",t),pe.exit(1)}});$e.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(!je(t.output)){console.log("\u2139\uFE0F Output file does not exist");return}await J0(t.output),console.log(`\u2705 Removed ${t.output}`)}catch(t){console.error("\u274C Failed to remove output file:",t),pe.exit(1)}});$e.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=Ht.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),pe.exit(1)}});$e.command("version","Show the version of Crosswind").action(()=>{console.log(Qr)});$e.version(Qr);$e.help();$e.parse();
407
+ \uD83D\uDCCB All classes:`);for(let l of Array.from(r.classes).sort())console.log(` - ${l}`)}}}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 Hr(e.config);if(e.output)t.output=e.output;if(!Be(t.output)){console.log("\u2139\uFE0F Output file does not exist");return}await Z0(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=qt.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 Crosswind").action(()=>{console.log(tn)});Ce.version(tn);Ce.help();Ce.parse();