@designid/tokens 1.2.2 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,7 +10,16 @@ The tokens are defined in a JSON file according to the [Design Tokens Community
10
10
 
11
11
  The build tokens can be used in various ways, such as in CSS files, CSS-in-JS libraries, CSS preprocessors, or even directly in your JavaScript or TypeScript code.
12
12
 
13
- You can also use the tokens in your design tools, like Figma, Sketch, Adobe XD, etc., to ensure that your design system is consistent across all platforms.
13
+ You can also use the tokens in your design tools, like Figma, Sketch, Adobe XD, etc., to ensure that your design system is consistent across all platforms.
14
+
15
+ ## ✨ Features
16
+
17
+ - 🎨 **W3C Design Token Format** - Full compliance with the W3C standard
18
+ - 🔄 **Figma Plugin** - Bidirectional sync between tokens and Figma variables/styles
19
+ - 📝 **Token Editor** - Web-based editor for managing tokens with CRUD operations
20
+ - 🎯 **Multiple Outputs** - Generate CSS, TypeScript, JSON, and more
21
+ - 🔧 **Watch Mode** - Auto-rebuild on file changes
22
+ - 📦 **Type-Safe** - Full TypeScript support with comprehensive types
14
23
 
15
24
  ## Get started
16
25
 
@@ -47,6 +56,62 @@ To build the design system tokens in development mode, you can use the `tokens-w
47
56
  bun tokens-watch
48
57
  ```
49
58
 
59
+ ## Figma Plugin
60
+
61
+ Synchronize design tokens between your codebase and Figma with bidirectional sync support.
62
+
63
+ ### Quick Start
64
+
65
+ 1. **Build the plugin:**
66
+ ```bash
67
+ bun ./scripts/build-figma-plugin.ts
68
+ ```
69
+
70
+ 2. **Install in Figma:**
71
+ - Open Figma Desktop App
72
+ - Go to **Menu → Plugins → Development → Import plugin from manifest...**
73
+ - Select `dist/figma/manifest.json`
74
+
75
+ 3. **Use the plugin:**
76
+ - Open any Figma file
77
+ - Run **Plugins → Development → @DesignID/tokens - Figma Sync**
78
+ - Import JSON tokens or load from Figma
79
+ - Click "Sync to Figma" to synchronize
80
+
81
+ ### Features
82
+
83
+ - ✅ **Bidirectional Sync** - Import from Figma or export to Figma
84
+ - 🎨 **Variables** - Colors, dimensions, typography properties
85
+ - 📝 **Styles** - Paint styles, text styles, effect styles
86
+ - 🌲 **Tree View** - Hierarchical token organization
87
+ - ✏️ **Live Editing** - Edit, add, delete tokens in real-time
88
+ - 📦 **JSON Import/Export** - Work with W3C Design Token Format files
89
+
90
+ ### Supported Token Types
91
+
92
+ | Token Type | Figma Output |
93
+ |------------|--------------|
94
+ | `color` | Variable + Paint Style |
95
+ | `dimension` | Variable (FLOAT) |
96
+ | `fontFamily`, `fontWeight`, `fontSize`, `lineHeight`, `letterSpacing` | Variables |
97
+ | `typography` | Text Style |
98
+ | `shadow` | Effect Style |
99
+ | `duration` | Variable (FLOAT) |
100
+
101
+ ### Documentation
102
+
103
+ - [Quick Start Guide](docs/FIGMA_PLUGIN_QUICKSTART.md) - Get started in 5 minutes
104
+ - [Integration Guide](docs/FIGMA_PLUGIN_INTEGRATION.md) - Detailed workflows and best practices
105
+ - [Plugin README](src/figma/README.md) - Technical documentation
106
+ - [Sample Tokens](docs/sample-tokens-for-figma.json) - Example token file for testing
107
+
108
+ ### Development
109
+
110
+ ```bash
111
+ # Watch mode for plugin development
112
+ bun ./scripts/watch-figma-plugin.ts
113
+ ```
114
+
50
115
  ## Token Editor
51
116
 
52
117
  A web-based editor for managing W3C Design Tokens with full CRUD operations, token references, and mode support.
@@ -137,6 +202,61 @@ The editor will be available at `http://localhost:3002` (or your custom port).
137
202
 
138
203
  For detailed documentation, see [src/editor/README.md](src/editor/README.md).
139
204
 
205
+ ## Figma Plugin
206
+
207
+ Synchronize your design tokens with Figma variables, styles, and effects.
208
+
209
+ ### Features
210
+
211
+ - 🔄 **Bidirectional Sync** - Push tokens to Figma or pull from Figma
212
+ - 📦 **Variable Support** - Colors, dimensions, typography primitives
213
+ - 🎨 **Style Support** - Paint styles, text styles, effect styles
214
+ - 📝 **Token Editor UI** - Full CRUD operations within Figma
215
+ - 📥 **Import/Export** - Work with JSON token files
216
+ - ✅ **W3C Compliant** - Uses W3C Design Token Format standard
217
+
218
+ ### Quick Start
219
+
220
+ 1. **Build the plugin:**
221
+ ```bash
222
+ bun run build:figma
223
+ ```
224
+
225
+ 2. **Install in Figma:**
226
+ - Open Figma Desktop App
227
+ - Go to **Menu → Plugins → Development → Import plugin from manifest...**
228
+ - Select `dist/figma/manifest.json`
229
+
230
+ 3. **Use the plugin:**
231
+ - Open plugin: **Plugins → Development → @DesignID/tokens - Figma Sync**
232
+ - Import your token JSON file
233
+ - Click "Sync to Figma"
234
+
235
+ ### Watch Mode for Development
236
+
237
+ ```bash
238
+ bun run watch:figma
239
+ ```
240
+
241
+ This watches `src/figma/` for changes and automatically rebuilds the plugin.
242
+
243
+ ### Supported Token Types
244
+
245
+ | Token Type | Figma Output |
246
+ |------------|-------------|
247
+ | `color` | Variable + Paint Style |
248
+ | `dimension`, `number` | Variable (FLOAT) |
249
+ | `fontFamily` | Variable (STRING) |
250
+ | `fontWeight`, `fontSize`, `lineHeight`, `letterSpacing` | Variable (FLOAT) |
251
+ | `typography` | Text Style |
252
+ | `shadow` | Effect Style |
253
+ | `duration` | Variable (FLOAT) |
254
+
255
+ ### Documentation
256
+
257
+ - [Figma Plugin README](src/figma/README.md) - Plugin usage and features
258
+ - [Integration Guide](docs/FIGMA_PLUGIN_INTEGRATION.md) - Detailed workflow and best practices
259
+
140
260
  ### File structure
141
261
  The file structure of the design system tokens is as follows in a typical web application project:
142
262
 
package/bin/build.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{createRequire as HY}from"node:module";var GY=Object.create;var{getPrototypeOf:zY,defineProperty:m$,getOwnPropertyNames:AY}=Object;var EY=Object.prototype.hasOwnProperty;var LY=($,X,Y)=>{Y=$!=null?GY(zY($)):{};let Z=X||!$||!$.__esModule?m$(Y,"default",{value:$,enumerable:!0}):Y;for(let q of AY($))if(!EY.call(Z,q))m$(Z,q,{get:()=>$[q],enumerable:!0});return Z};var d$=($,X)=>{for(var Y in X)m$($,Y,{get:X[Y],enumerable:!0,configurable:!0,set:(Z)=>X[Y]=()=>Z})};var P=($,X)=>()=>($&&(X=$($=0)),X);var u$=HY(import.meta.url);var d0={};d$(d0,{transformColorValueAsync:()=>BY,transformColorValue:()=>F,transformColorToken:()=>M$,setAlpha:()=>U$,isColor:()=>p,initializeColorspace:()=>QY});import k$ from"colorjs.io";async function p0(){if(R$===null){let{colorspace:$}=await C();R$=$||"hex"}return R$}function _Y(){return R$||"hex"}async function QY(){await p0()}function U$($,X){let Y=new k$($);if(X||X===0)Y.alpha=X/100;return F(Y)}function m0($,X){if(!$)return $;if(X&&X.type!=="color")return $;if(typeof $==="string")$=new k$($);if(typeof $?.to!=="function")return $;let Y=_Y();try{switch(Y){case"hex":return $.to("srgb").toString({format:"hex"});case"rgb":case"srgb":return $.to("srgb").toString();case"srgb-linear":return $.to("srgb-linear").toString();case"display-p3":case"p3":return $.to("p3").toString();case"a98rgb":case"a98-rgb":return $.to("a98rgb").toString();case"prophoto":case"prophoto-rgb":return $.to("prophoto").toString();case"rec2020":case"rec-2020":return $.to("rec2020").toString();case"xyz":case"xyz-d65":return $.to("xyz-d65").toString();case"xyz-d50":return $.to("xyz-d50").toString();case"lab":case"cielab":return $.to("lab").toString();case"lab-d65":return $.to("lab-d65").toString();case"oklab":return $.to("oklab").toString();case"lch":case"cielch":return $.to("lch").toString();case"oklch":return $.to("oklch").toString();case"hsl":return $.to("hsl").toString();case"hsv":case"hsb":return $.to("hsv").toString();case"hwb":return $.to("hwb").toString();case"luv":return $.to("luv").toString();case"lchuv":return $.to("lchuv").toString();case"jzazbz":return $.to("jzazbz").toString();case"jzczhz":return $.to("jzczhz").toString();case"ictcp":return $.to("ictcp").toString();default:return $.to(Y).toString()}}catch(Z){return console.warn(`Unsupported colorspace '${Y}', falling back to hex. Error:`,Z),$.to("srgb").toString({format:"hex"})}}async function BY($,X){return await p0(),m0($,X)}function F($,X){return m0($,X)}function M$($,X,Y,Z){try{if($=T(X,Z),X.$type==="color"&&X.original?.$value&&X.original?.$value!==X.$value){if(S(X.original.$value))$=y(X.original.$value,Y,Z,X);else $=D(X);if(!j(Z)&&X.original?.$extensions?.mode?.[Z])$=X.original.$extensions.mode[Z]}if(S($))$=y($,Y,Z,X);return F($)}catch{return $=T(X,Z),F($)}}function p($){try{if($)return new k$($),!0;return!1}catch{return!1}}var R$=null;var W$=P(()=>{g()});function u0($,X){let Y=$.$extensions?.delimiter?.character||" ",Z=T($,X)??{},q=$.$extensions?.sort??[],U=D($)??{};if(q.length>0)U=Object.keys(U).sort((K,W)=>{let z=q.indexOf(K),G=q.indexOf(W);return z-G}).reduce((K,W)=>{return K[W]=Z[W],K},{});return Object.keys(U).reduce((K,W)=>{let z=D(Z[W]);if(Z[W]?.$type==="color"||Z[W].$property==="color")z=F(z,Z[W]);return[...Array.isArray(K)?K:[K],z]},[]).join(Y).trim()}function OY($,X,Y,Z){return Object.keys(X??{}).reduce((U,K)=>{let W=X[K];if(typeof W==="string"||typeof W==="number")W={$value:W,$type:typeof W,value:W};if(W.$type=W.type||$?.original?.$value?.[K]?.type||W.$type||$.$type,!j(Z)&&u(W,"mode",{isIncludedOriginalValue:!0}))W.$value=T(W,Z);if(W?.$type==="composition"&&(typeof W.$value!=="string"||typeof W.$value!=="number"||S(W.$value))&&Object.keys(W).length>0){if(S(W.$value))return W.$value=y(W.$value,Y,Z,W),{...U,[K]:{...W,$property:K,$type:W.$type,$value:t(W,Y,Z)}};return{...U,[K]:{...W,$property:K,$type:W.$type,$value:t(W,Y,Z)}}}if(W?.$value){let G=y(W.$value,Y,Z,W);return{...U,[K]:{...W,$property:K,$type:W.$type,$value:G}}}return U},{})}function t($,X,Y){let Z=D($,{isIncludedOriginalValue:!0});if(typeof Z==="string"){if(S(Z)){if(Z=l$(Z,X,Y,$),!j(Y)&&u(Z,"mode",{isIncludedOriginalValue:!0}))Z.$value=T(Z,Y)}let q=e(Z);if(q&&(q?.length??0)>1)Z=o(Z,q,X,Y)}else if(Array.isArray(Z))Z=Z.map((q)=>{if(typeof q==="string"&&S(q))return y(q,X,Y,$);return q});if(!$.name)return Z;return $.$value=OY($,Z,X,Y),u0($,Y)}var c$=P(()=>{g()});function D($,X){let{isIncludedOriginalValue:Y=!1,fallbackValue:Z=null}=X??{};if(Y)return $?.original?.$value??$?.$value??$.value??Z;return $?.$value??$?.value??Z}function T($,X){return X&&($?.$extensions?.mode?.[X]||typeof $?.$extensions?.mode?.[X]==="number")?$.$extensions.mode[X]:D($,{fallbackValue:$?.original?.$value??$?.$value??$?.value})??null}function u($,X,{isIncludedOriginalValue:Y=!1}={}){let Z=!1;if(Y&&$?.original?.$extensions?.[X])Z=!0;if($?.$extensions?.[X])Z=!0;return Z}function r$($,X,Y){let Z=D($,{isIncludedOriginalValue:!0});if(!j(Y)&&u($,"mode",{isIncludedOriginalValue:!0}))Z=T($,Y);if(S(Z))return s$(Z,X,Y,$);return Z}function o($,X,Y,Z){let q=X.reduce((U,K)=>{let W=i$(K,Y);if(!W)return U;let z=D(W,{isIncludedOriginalValue:!0});if(S(z))z=y(`{${K}}`,Y,Z,W);return{...U,[K]:N$(W,z,Y,Z)}},{});return $?.replace(/\{([^}]+)\}/g,(U,K)=>{return q[K]!==void 0?q[K]:U})??null}function l$($,X,Y,Z){if(S($))return y($,X,Y,Z);return $}function i$($,X){return X.allTokens.find((Y)=>Y.path.join(".")===$)??null}function y($,X,Y,Z){let q=S($),U=null,K=$??D(Z),W=null;if(q){if(U=i$(q,X),Y&&U&&U?.$extensions?.mode?.[Y]!==U.original?.$extensions?.mode?.[Y])K=U.original?.$extensions?.mode?.[Y],W=U.original?.$extensions?.alpha??W;else if(U?.$extensions?.mode?.[Y])K=U.$extensions.mode[Y],W=U.$extensions?.alpha??W;else if(U?.original?.$value)K=U?.original.$value??U?.$value,W=U?.original.$extensions?.alpha??W}if(K!==$&&S(K))K=y(K,X,Y,Z);if(K&&(W||Z?.$extensions?.alpha||W===0||Z?.original?.$extensions?.alpha===0))W=W??Z?.$extensions?.alpha??null,K=U$(K,W);return K=F(K,U??Z),K??$}function s$($,X,Y,Z){let q=Z?.original?.$extensions?.mode?.[Y]??Z?.original?.$value,U=S(q);if(Y&&U){let K=X.allTokens.find((z)=>z.path.join(".")===U);if(!K)return $;let W=D(K);if(S(W))return s$(W,X,Y,K);if(K?.$extensions?.mode?.[Y])W=K.$extensions.mode[Y];if(W&&K?.$extensions?.alpha)W=U$(K.$value,K.$extensions.alpha);return F(W,K)??$}else if(q)return F(q,Z);return $}function S($){if(typeof $!=="string")return null;let X=/{[^}]+}/g,Y=$.match(X);if(Y?.length!==1)return null;return Y[0].slice(1,-1)}function e($){if(typeof $!=="string")return null;return[...$.matchAll(/\{([^}]+)\}/g)].map(([,Y])=>Y)??null}function $$($){return $}function K$($){return $}var a$=P(()=>{g()});var H2={};d$(H2,{wrapThemeValue:()=>E0,wrapFormatCSSFile:()=>z2,typographyFileName:()=>o0,tokensFileName:()=>n0,removeDirectoryContents:()=>K0,readConfigFile:()=>Z$,namespaceUUID:()=>Y2,iconsFileName:()=>e0,getTokenfileName:()=>X2,getRelativePath:()=>L2,getRelativeCSSPath:()=>E2,getRawTokensFileName:()=>W2,getProjectPaths:()=>i,getProjectModes:()=>z0,getProjectMetaData:()=>C,getProjectFonts:()=>xY,getLazyTokensConfig:()=>n$,getLazyProjectPaths:()=>A0,getLazyProjectModes:()=>G$,getLazyProjectMetaData:()=>H$,getLazyProjectFonts:()=>FY,getLazyProjectData:()=>k,getLazyIcons:()=>S$,getJSDocHeader:()=>K2,getIconDestinationFileName:()=>X$,getFiles:()=>P$,getFileHeader:()=>G0,getDistThemeFileDelimeter:()=>Z2,getDistConfigFile:()=>x$,getDestinationFileName:()=>q2,getDefaultIconObjectPath:()=>$2,getCSSDestinationFileName:()=>U2,getBaseDirectory:()=>A$,getBaseConfigFile:()=>E$,generatedFileHeader:()=>Y$,filterTokensByType:()=>F$,createFileHeaderTitle:()=>z$,compileConfigFile:()=>W0,combineCSSFiles:()=>A2,checkAndCreateDirectory:()=>r,breakpointFileName:()=>t0});import{spawnSync as wY}from"child_process";import{existsSync as h,mkdirSync as IY,readFileSync as JY,unlinkSync as k0,writeFileSync as RY}from"fs";import{readdir as i0,rmdir as MY,unlink as NY}from"fs/promises";import{resolve as s0,join as N,basename as a0,normalize as c0,relative as l0,sep as t$,dirname as r0}from"path";async function $2(){return`${(await L$()).$metaData?.tokenNamespace||"tokens"}.icons`}async function W0($){let Y=N($,"designid.config.ts");if(h(N($,"designid.config.mjs")))k0(N($,"designid.config.mjs"));let Z=N($,"designid.config.js");if(h(Z))k0(Z);if(h(Y)){let q=wY("bun",["build",Y,"--outfile ./designid.config.mjs","--minify","--target","node","--packages","external","--no-bundle"],{stdio:"inherit",cwd:$,shell:!0});if(q.status!==0)console.error("Failed to compile designid.config.mjs with bun."),process.exit(q.status??1);if(q.status===0)return new Promise((U)=>U(!0))}}async function K0($){try{if(h($)){let X=await i0($,{withFileTypes:!0});for(let Y of X){let Z=N($,Y.name);if(Y.isDirectory())await K0(Z),await MY(Z);else await NY(Z)}}}catch(X){console.error(`Error removing contents of ${$}:`,X)}}async function P$($){let X=await i0($,{withFileTypes:!0}),Y=await Promise.all(X.map((Z)=>{let q=s0($,Z.name);return Z.isDirectory()?P$(q):q}));return Array.prototype.concat(...Y)}async function Y2($){let{dsNamespace:X,tokenNamespace:Y}=await C();return`${(X??Y).toUpperCase()}DesignSystem${$.charAt(0).toUpperCase()+$.slice(1)}Tokens`}function X2($,X="d.ts",Y){if(!$)return`tokens.${Y}.config.${X}`;return N($,`tokens.${Y}.config.${X}`)}function Z2($,X){return $.length>1?`.${X}`:""}async function q2($="d.ts",X){let{tokenNamespace:Y}=await C();if(X)return`${Y}-design-system.${X}.tokens.config.${$}`;return`${Y}-design-system.tokens.config.${$}`}async function X$($="json"){let{tokenNamespace:X}=await C();return`${X}-design-system.tokens.svg${$==="d.ts"||$==="js"?".config":""}.${$}`}async function U2(){let{tokenNamespace:$}=await C();return`${$}-design-system.tokens.css`}async function W2(){let{tokenNamespace:$}=await C();return`${$}-design-system-raw.tokens.json`}async function G0($){let{tokenNamespace:X}=await C();return`${X} | ${$}`}function K2($,X){return`/** @type {import("./${$}").${X}} */`}function z$($){return`/* ${G0($)} */`}function r($){if(!h($))IY($,{recursive:!0})}async function Z$($,X=!1){let Y=E$(),Z;if(Y.endsWith(".json"))Z=JSON.parse(JY(Y,"utf8").trim()??"{}");else if(Y.endsWith(".ts"))if(typeof globalThis.Bun<"u"){if(Z=await import(Y),Z.default)Z=Z.default}else{$=$??r0(Y)+"/";let U=x$($);if(U&&(X||!h(U)))await W0($);if(Z=await import(U),Z.default)Z=Z.default}else{$=$??r0(Y)+"/";let q=x$($);if(q&&(X||!h(q)))await W0($);if(Z=await import(q),Z.default)Z=Z.default}return Z}async function A$($=!1){let{baseDir:X}=await i(),Y=process.cwd(),q=N(Y,X),{buildDir:U,distDir:K}=await i();if($)try{r(N(q,U)),r(N(q,K))}catch(W){console.error("Error creating directories:",W)}return q}function x$($){return $?N($,"designid.config.mjs"):N(process.cwd(),"designid.config.mjs")}function E$(){let $=process.argv.find((W)=>W.startsWith("--config=")),[,X]=$?.split("=")??[];if(X)return X;let Y=process.cwd(),Z=x$(Y),q=N(Y,"designid.config.ts"),U=h(Z),K=h(q);if(U)return Z;else if(K)return q;throw console.error("Config file not found"),Error("Config file not found")}async function i($=!1){let X=E$(),Z=(await Z$(process.cwd(),$)).$paths;if(!Z)throw console.error("Project paths not found"),Error("Project paths not found");return{configFile:X,...Z}}async function C(){let X=(await Z$(process.cwd())).$metaData;if(!X)throw console.error("Project metaData not found"),Error("Project metaData not found");if(!X.colorspace)X.colorspace="hex";if(!X.fontNamespace)X.fontNamespace=`${X.dsNamespace}.font`;if(!X?.tokens?.css?.mediaQuery?.match)X={...X??{},tokens:{...X.tokens??{},css:{...X.tokens?.css??{},mediaQuery:{...X.tokens?.css?.mediaQuery??{},match:"[data-theme]"}}}};if(X?.tokens?.css?.mediaQuery&&typeof X.tokens.css.mediaQuery.separateThemeFiles!=="boolean")X.tokens.css.mediaQuery.separateThemeFiles=!1;if(!X.dsNamespace)X.dsNamespace=X.tokenNamespace;let Y=await $2();return{...X,icons:X.icons??{objectPath:Y},dsNamespace:X.dsNamespace}}async function z0(){return(await Z$(process.cwd())).$modes??{default:"light"}}async function L$(){if(!o$){let $=E$();o$=await Z$(process.cwd()),G2=$}return o$}async function G$(){if(!e$)e$=(await L$()).$modes??{default:"light"};return e$}async function H$(){if(!$0){let X=(await L$()).$metaData;if(!X)throw console.error("Project metaData not found"),Error("Project metaData not found");if(!X.dsNamespace)X.dsNamespace=X.tokenNamespace;let Z=`${X.tokenNamespace||"tokens"}.icons`;$0={...X,icons:X.icons??{objectPath:Z},dsNamespace:X.dsNamespace}}return $0}async function A0($=!1){if(!Y0){let Y=(await L$()).$paths;if(!Y)throw console.error("Project paths not found"),Error("Project paths not found");Y0={configFile:G2,...Y}}return Y0}async function k(){if(!X0){let{distDir:$,assets:X,buildDir:Y}=await A0(!0),{fontNamespace:Z,tokenNamespace:q,icons:U}=await H$(),K=await A$(),W=process.cwd(),z=N(W,$,"css");X0={distDir:$,assets:X,fontNamespace:Z,__dirname:K,workspaceRoot:W,distCSSPath:z,buildDir:Y,tokenNamespace:q,icons:U}}return X0}async function S$(){if(!Z0){let{icons:$}=await H$();Z0=$}return Z0}async function n$(){if(!q0){let{tokens:$}=await H$();q0=$}return q0}async function xY(){return(await Z$(process.cwd())).$fonts??[]}async function FY(){if(!U0)U0=(await L$()).$fonts??[];return U0}async function E0($){if(j($))return":root";let Y=(await C())?.tokens?.css?.mediaQuery?.match??"[data-theme]";if(Y.startsWith("[")&&Y.endsWith("]"))return`${Y.replace("]",`="${$}"]`)}`;else if(Y.startsWith(".")||Y.startsWith("#"))return`${Y}${$}`;else return`${Y}${$}`}async function z2($,X,Y,Z,q,U={}){let K;if(j(Y))K=X.allTokens;else K=$(X,Y);let z=(await C())?.tokens?.css?.mediaQuery?.separateThemeFiles?"Theme: "+Y:U.headerTitle??"",G=`${z$(z)}
2
+ import{createRequire as HY}from"node:module";var GY=Object.create;var{getPrototypeOf:zY,defineProperty:m$,getOwnPropertyNames:AY}=Object;var EY=Object.prototype.hasOwnProperty;var LY=($,X,Y)=>{Y=$!=null?GY(zY($)):{};let Z=X||!$||!$.__esModule?m$(Y,"default",{value:$,enumerable:!0}):Y;for(let q of AY($))if(!EY.call(Z,q))m$(Z,q,{get:()=>$[q],enumerable:!0});return Z};var d$=($,X)=>{for(var Y in X)m$($,Y,{get:X[Y],enumerable:!0,configurable:!0,set:(Z)=>X[Y]=()=>Z})};var P=($,X)=>()=>($&&(X=$($=0)),X);var u$=HY(import.meta.url);var d0={};d$(d0,{transformColorValueAsync:()=>BY,transformColorValue:()=>F,transformColorToken:()=>M$,setAlpha:()=>U$,isColor:()=>p,initializeColorspace:()=>QY});import k$ from"colorjs.io";async function p0(){if(R$===null){let{colorspace:$}=await C();R$=$||"hex"}return R$}function _Y(){return R$||"hex"}async function QY(){await p0()}function U$($,X){let Y=new k$($);if(X||X===0)Y.alpha=X/100;return F(Y)}function m0($,X){if(!$)return $;if(X&&X.type!=="color")return $;if(typeof $==="string")$=new k$($);if(typeof $?.to!=="function")return $;let Y=_Y();try{switch(Y){case"hex":return $.to("srgb").toString({format:"hex"});case"rgb":case"srgb":return $.to("srgb").toString();case"srgb-linear":return $.to("srgb-linear").toString();case"display-p3":case"p3":return $.to("p3").toString();case"a98rgb":case"a98-rgb":return $.to("a98rgb").toString();case"prophoto":case"prophoto-rgb":return $.to("prophoto").toString();case"rec2020":case"rec-2020":return $.to("rec2020").toString();case"xyz":case"xyz-d65":return $.to("xyz-d65").toString();case"xyz-d50":return $.to("xyz-d50").toString();case"lab":case"cielab":return $.to("lab").toString();case"lab-d65":return $.to("lab-d65").toString();case"oklab":return $.to("oklab").toString();case"lch":case"cielch":return $.to("lch").toString();case"oklch":return $.to("oklch").toString();case"hsl":return $.to("hsl").toString();case"hsv":case"hsb":return $.to("hsv").toString();case"hwb":return $.to("hwb").toString();case"luv":return $.to("luv").toString();case"lchuv":return $.to("lchuv").toString();case"jzazbz":return $.to("jzazbz").toString();case"jzczhz":return $.to("jzczhz").toString();case"ictcp":return $.to("ictcp").toString();default:return $.to(Y).toString()}}catch(Z){return console.warn(`Unsupported colorspace '${Y}', falling back to hex. Error:`,Z),$.to("srgb").toString({format:"hex"})}}async function BY($,X){return await p0(),m0($,X)}function F($,X){return m0($,X)}function M$($,X,Y,Z){try{if($=T(X,Z),X.$type==="color"&&X.original?.$value&&X.original?.$value!==X.$value){if(S(X.original.$value))$=y(X.original.$value,Y,Z,X);else $=D(X);if(!j(Z)&&X.original?.$extensions?.mode?.[Z])$=X.original.$extensions.mode[Z]}if(S($))$=y($,Y,Z,X);return F($)}catch{return $=T(X,Z),F($)}}function p($){try{if($)return new k$($),!0;return!1}catch{return!1}}var R$=null;var W$=P(()=>{g()});function u0($,X){let Y=$.$extensions?.delimiter?.character||" ",Z=T($,X)??{},q=$.$extensions?.sort??[],U=D($)??{};if(q.length>0)U=Object.keys(U).sort((K,W)=>{let z=q.indexOf(K),G=q.indexOf(W);return z-G}).reduce((K,W)=>{return K[W]=Z[W],K},{});return Object.keys(U).reduce((K,W)=>{let z=D(Z[W]);if(Z[W]?.$type==="color"||Z[W].$property==="color")z=F(z,Z[W]);return[...Array.isArray(K)?K:[K],z]},[]).join(Y).trim()}function OY($,X,Y,Z){return Object.keys(X??{}).reduce((U,K)=>{let W=X[K];if(typeof W==="string"||typeof W==="number")W={$value:W,$type:typeof W,value:W};if(W.$type=W.type||$?.original?.$value?.[K]?.type||W.$type||$.$type,!j(Z)&&u(W,"mode",{isIncludedOriginalValue:!0}))W.$value=T(W,Z);if(W?.$type==="composition"&&(typeof W.$value!=="string"||typeof W.$value!=="number"||S(W.$value))&&Object.keys(W).length>0){if(S(W.$value))return W.$value=y(W.$value,Y,Z,W),{...U,[K]:{...W,$property:K,$type:W.$type,$value:t(W,Y,Z)}};return{...U,[K]:{...W,$property:K,$type:W.$type,$value:t(W,Y,Z)}}}if(W?.$value){let G=y(W.$value,Y,Z,W);return{...U,[K]:{...W,$property:K,$type:W.$type,$value:G}}}return U},{})}function t($,X,Y){let Z=D($,{isIncludedOriginalValue:!0});if(typeof Z==="string"){if(S(Z)){if(Z=l$(Z,X,Y,$),!j(Y)&&u(Z,"mode",{isIncludedOriginalValue:!0}))Z.$value=T(Z,Y)}let q=e(Z);if(q&&(q?.length??0)>1)Z=o(Z,q,X,Y)}else if(Array.isArray(Z))Z=Z.map((q)=>{if(typeof q==="string"&&S(q))return y(q,X,Y,$);return q});if(!$.name)return Z;return $.$value=OY($,Z,X,Y),u0($,Y)}var c$=P(()=>{g()});function D($,X){let{isIncludedOriginalValue:Y=!1,fallbackValue:Z=null}=X??{};if(Y)return $?.original?.$value??$?.$value??$.value??Z;return $?.$value??$?.value??Z}function T($,X){return X&&($?.$extensions?.mode?.[X]||typeof $?.$extensions?.mode?.[X]==="number")?$.$extensions.mode[X]:D($,{fallbackValue:$?.original?.$value??$?.$value??$?.value})??null}function u($,X,{isIncludedOriginalValue:Y=!1}={}){let Z=!1;if(Y&&$?.original?.$extensions?.[X])Z=!0;if($?.$extensions?.[X])Z=!0;return Z}function r$($,X,Y){let Z=D($,{isIncludedOriginalValue:!0});if(!j(Y)&&u($,"mode",{isIncludedOriginalValue:!0}))Z=T($,Y);if(S(Z))return s$(Z,X,Y,$);return Z}function o($,X,Y,Z){let q=X.reduce((U,K)=>{let W=i$(K,Y);if(!W)return U;let z=D(W,{isIncludedOriginalValue:!0});if(S(z))z=y(`{${K}}`,Y,Z,W);return{...U,[K]:N$(W,z,Y,Z)}},{});return $?.replace(/\{([^}]+)\}/g,(U,K)=>{return q[K]!==void 0?q[K]:U})??null}function l$($,X,Y,Z){if(S($))return y($,X,Y,Z);return $}function i$($,X){return X.allTokens.find((Y)=>Y.path.join(".")===$)??null}function y($,X,Y,Z){let q=S($),U=null,K=$??D(Z),W=null;if(q){if(U=i$(q,X),Y&&U&&U?.$extensions?.mode?.[Y]!==U.original?.$extensions?.mode?.[Y])K=U.original?.$extensions?.mode?.[Y],W=U.original?.$extensions?.alpha??W;else if(U?.$extensions?.mode?.[Y])K=U.$extensions.mode[Y],W=U.$extensions?.alpha??W;else if(U?.original?.$value)K=U?.original.$value??U?.$value,W=U?.original.$extensions?.alpha??W}if(K!==$&&S(K))K=y(K,X,Y,Z);if(K&&(W||Z?.$extensions?.alpha||W===0||Z?.original?.$extensions?.alpha===0))W=W??Z?.$extensions?.alpha??null,K=U$(K,W);return K=F(K,U??Z),K??$}function s$($,X,Y,Z){let q=Z?.original?.$extensions?.mode?.[Y]??Z?.original?.$value,U=S(q);if(Y&&U){let K=X.allTokens.find((z)=>z.path.join(".")===U);if(!K)return $;let W=D(K);if(S(W))return s$(W,X,Y,K);if(K?.$extensions?.mode?.[Y])W=K.$extensions.mode[Y];if(W&&K?.$extensions?.alpha)W=U$(K.$value,K.$extensions.alpha);return F(W,K)??$}else if(q)return F(q,Z);return $}function S($){if(typeof $!=="string")return null;let X=/{[^}]+}/g,Y=$.match(X);if(Y?.length!==1)return null;return Y[0].slice(1,-1)}function e($){if(typeof $!=="string")return null;return[...$.matchAll(/\{([^}]+)\}/g)].map(([,Y])=>Y)??null}function $$($){return $}function K$($){return $}var a$=P(()=>{g()});var H2={};d$(H2,{wrapThemeValue:()=>E0,wrapFormatCSSFile:()=>z2,typographyFileName:()=>o0,tokensFileName:()=>n0,removeDirectoryContents:()=>K0,readConfigFile:()=>Z$,namespaceUUID:()=>Y2,iconsFileName:()=>e0,getTokenfileName:()=>X2,getRelativePath:()=>L2,getRelativeCSSPath:()=>E2,getRawTokensFileName:()=>W2,getProjectPaths:()=>i,getProjectModes:()=>z0,getProjectMetaData:()=>C,getProjectFonts:()=>xY,getLazyTokensConfig:()=>n$,getLazyProjectPaths:()=>A0,getLazyProjectModes:()=>G$,getLazyProjectMetaData:()=>H$,getLazyProjectFonts:()=>FY,getLazyProjectData:()=>k,getLazyIcons:()=>S$,getJSDocHeader:()=>K2,getIconDestinationFileName:()=>X$,getFiles:()=>P$,getFileHeader:()=>G0,getDistThemeFileDelimeter:()=>Z2,getDistConfigFile:()=>x$,getDestinationFileName:()=>q2,getDefaultIconObjectPath:()=>$2,getCSSDestinationFileName:()=>U2,getBaseDirectory:()=>A$,getBaseConfigFile:()=>E$,generatedFileHeader:()=>Y$,filterTokensByType:()=>F$,createFileHeaderTitle:()=>z$,compileConfigFile:()=>W0,combineCSSFiles:()=>A2,checkAndCreateDirectory:()=>r,breakpointFileName:()=>t0});import{spawnSync as wY}from"child_process";import{existsSync as h,mkdirSync as IY,readFileSync as JY,unlinkSync as k0,writeFileSync as RY}from"fs";import{readdir as i0,rmdir as MY,unlink as NY}from"fs/promises";import{resolve as s0,join as N,basename as a0,normalize as c0,relative as l0,sep as t$,dirname as r0}from"path";async function $2(){return`${(await L$()).$metaData?.tokenNamespace||"tokens"}.icons`}async function W0($){let Y=N($,"designid.config.ts");if(h(N($,"designid.config.mjs")))k0(N($,"designid.config.mjs"));let Z=N($,"designid.config.js");if(h(Z))k0(Z);if(h(Y)){let q=wY("bun",["build",Y,"--outfile ./designid.config.mjs","--minify","--target","node","--packages","external","--no-bundle"],{stdio:"inherit",cwd:$,shell:!0});if(q.status!==0)console.error("Failed to compile designid.config.mjs with bun."),process.exit(q.status??1);if(q.status===0)return new Promise((U)=>U(!0))}}async function K0($){try{if(h($)){let X=await i0($,{withFileTypes:!0});for(let Y of X){let Z=N($,Y.name);if(Y.isDirectory())await K0(Z),await MY(Z);else await NY(Z)}}}catch(X){console.error(`Error removing contents of ${$}:`,X)}}async function P$($){let X=await i0($,{withFileTypes:!0}),Y=await Promise.all(X.map((Z)=>{let q=s0($,Z.name);return Z.isDirectory()?P$(q):q}));return Array.prototype.concat(...Y)}async function Y2($){let{dsNamespace:X,tokenNamespace:Y}=await C();return`${(X??Y).toUpperCase()}DesignSystem${$.charAt(0).toUpperCase()+$.slice(1)}Tokens`}function X2($,X="d.ts",Y){if(!$)return`tokens.${Y}.config.${X}`;return N($,`tokens.${Y}.config.${X}`)}function Z2($,X){return $.length>1?`.${X}`:""}async function q2($="d.ts",X){let{tokenNamespace:Y}=await C();if(X)return`${Y}-design-system.${X}.tokens.config.${$}`;return`${Y}-design-system.tokens.config.${$}`}async function X$($="json"){let{tokenNamespace:X}=await C();return`${X}-design-system.tokens.svg${$==="d.ts"||$==="js"?".config":""}.${$}`}async function U2(){let{tokenNamespace:$}=await C();return`${$}-design-system.tokens.css`}async function W2(){let{tokenNamespace:$}=await C();return`${$}-design-system-raw.tokens.json`}async function G0($){let{tokenNamespace:X}=await C();return`${X} | ${$}`}function K2($,X){return`/** @type {import("./${$}").${X}} */`}function z$($){return`/* ${G0($)} */`}function r($){if(!h($))IY($,{recursive:!0})}async function Z$($,X=!1){let Y=E$(),Z;if(Y.endsWith(".json"))Z=JSON.parse(JY(Y,"utf8").trim()??"{}");else if(Y.endsWith(".ts"))if(typeof globalThis.Bun!=="undefined"){if(Z=await import(Y),Z.default)Z=Z.default}else{$=$??r0(Y)+"/";let U=x$($);if(U&&(X||!h(U)))await W0($);if(Z=await import(U),Z.default)Z=Z.default}else{$=$??r0(Y)+"/";let q=x$($);if(q&&(X||!h(q)))await W0($);if(Z=await import(q),Z.default)Z=Z.default}return Z}async function A$($=!1){let{baseDir:X}=await i(),Y=process.cwd(),q=N(Y,X),{buildDir:U,distDir:K}=await i();if($)try{r(N(q,U)),r(N(q,K))}catch(W){console.error("Error creating directories:",W)}return q}function x$($){return $?N($,"designid.config.mjs"):N(process.cwd(),"designid.config.mjs")}function E$(){let $=process.argv.find((W)=>W.startsWith("--config=")),[,X]=$?.split("=")??[];if(X)return X;let Y=process.cwd(),Z=x$(Y),q=N(Y,"designid.config.ts"),U=h(Z),K=h(q);if(U)return Z;else if(K)return q;throw console.error("Config file not found"),new Error("Config file not found")}async function i($=!1){let X=E$(),Z=(await Z$(process.cwd(),$)).$paths;if(!Z)throw console.error("Project paths not found"),new Error("Project paths not found");return{configFile:X,...Z}}async function C(){let X=(await Z$(process.cwd())).$metaData;if(!X)throw console.error("Project metaData not found"),new Error("Project metaData not found");if(!X.colorspace)X.colorspace="hex";if(!X.fontNamespace)X.fontNamespace=`${X.dsNamespace}.font`;if(!X?.tokens?.css?.mediaQuery?.match)X={...X??{},tokens:{...X.tokens??{},css:{...X.tokens?.css??{},mediaQuery:{...X.tokens?.css?.mediaQuery??{},match:"[data-theme]"}}}};if(X?.tokens?.css?.mediaQuery&&typeof X.tokens.css.mediaQuery.separateThemeFiles!=="boolean")X.tokens.css.mediaQuery.separateThemeFiles=!1;if(!X.dsNamespace)X.dsNamespace=X.tokenNamespace;let Y=await $2();return{...X,icons:X.icons??{objectPath:Y},dsNamespace:X.dsNamespace}}async function z0(){return(await Z$(process.cwd())).$modes??{default:"light"}}async function L$(){if(!o$){let $=E$();o$=await Z$(process.cwd()),G2=$}return o$}async function G$(){if(!e$)e$=(await L$()).$modes??{default:"light"};return e$}async function H$(){if(!$0){let X=(await L$()).$metaData;if(!X)throw console.error("Project metaData not found"),new Error("Project metaData not found");if(!X.dsNamespace)X.dsNamespace=X.tokenNamespace;let Z=`${X.tokenNamespace||"tokens"}.icons`;$0={...X,icons:X.icons??{objectPath:Z},dsNamespace:X.dsNamespace}}return $0}async function A0($=!1){if(!Y0){let Y=(await L$()).$paths;if(!Y)throw console.error("Project paths not found"),new Error("Project paths not found");Y0={configFile:G2,...Y}}return Y0}async function k(){if(!X0){let{distDir:$,assets:X,buildDir:Y}=await A0(!0),{fontNamespace:Z,tokenNamespace:q,icons:U}=await H$(),K=await A$(),W=process.cwd(),z=N(W,$,"css");X0={distDir:$,assets:X,fontNamespace:Z,__dirname:K,workspaceRoot:W,distCSSPath:z,buildDir:Y,tokenNamespace:q,icons:U}}return X0}async function S$(){if(!Z0){let{icons:$}=await H$();Z0=$}return Z0}async function n$(){if(!q0){let{tokens:$}=await H$();q0=$}return q0}async function xY(){return(await Z$(process.cwd())).$fonts??[]}async function FY(){if(!U0)U0=(await L$()).$fonts??[];return U0}async function E0($){if(j($))return":root";let Y=(await C())?.tokens?.css?.mediaQuery?.match??"[data-theme]";if(Y.startsWith("[")&&Y.endsWith("]"))return`${Y.replace("]",`="${$}"]`)}`;else if(Y.startsWith(".")||Y.startsWith("#"))return`${Y}${$}`;else return`${Y}${$}`}async function z2($,X,Y,Z,q,U={}){let K;if(j(Y))K=X.allTokens;else K=$(X,Y);let z=(await C())?.tokens?.css?.mediaQuery?.separateThemeFiles?"Theme: "+Y:U.headerTitle??"",G=`${z$(z)}
3
3
  ${Y$}`,E=j(Y)?`:root {
4
4
  `:`@media (123prefers-color-scheme: ${Y}) {
5
5
  :root {
@@ -17,7 +17,7 @@ ${E}`;if(K.forEach((L)=>{if(F$(L,U,q))return;let _=j$(L,X,Y);if(U.transformValue
17
17
  `:"",A}function F$($,X,Y){let{namespace:Z}=X.filter??{};if(!$.$type)return!0;if(Z?.length&&$.path){let q=$.path.join("."),U=Z.some((W)=>q.startsWith(W)),K=X.filter?.isInclusion!==void 0&&X.filter.isInclusion;return U&&!K||!U&&K}if(X.filter?.isInclusion!==void 0&&X.filter.isInclusion===!1){if($.$type&&!Y.includes($.$type))return!0}else if(!$.$type||Y.includes($.$type))return!0;return!1}async function A2(){let $=await z0(),{baseDir:X,distDir:Y}=await i(),Z=await P$(N(X,Y,"css")),q=N(X,Y,await U2()),U=Y$+`
18
18
 
19
19
  `,K=[{name:e0,order:100},{name:n0,order:200},{name:o0,order:300},{name:t0,order:400}];if(Z=Z.sort((W,z)=>{let G=(E)=>{let A=a0(E,".css"),L=K.find((_)=>A.includes(_.name));for(let _ in $)if(A.includes(_)){let H=$[_]===$.default?1:2;return L?L.order+H:0}return L?L.order:0};return G(W)-G(z)}),Z.forEach((W)=>{if(W.endsWith(".css")){let G=`@import url("${E2(W,X,Y)}");`;U+=G+`
20
- `}}),!h(N(X,Y)))r(N(X,Y));RY(q,U)}function E2($,X,Y){let Z=s0(X,Y);return $.startsWith(Z)?$.slice(Z.length+1):$}function L2($,X,Y,Z){let q=c0($),U=a0(c0(X)),K=q.split(t$),W=K.lastIndexOf(U);if(U===".")return l0(Y,Z).split(t$).join("/");else if(W===-1)throw Error(`Base directory '${U}' not found in '${q}'`);let z=N(...K.slice(0,W+1)),G=N(z,Y),E=N(z,Z);return l0(G,E).split(t$).join("/")}var n0="tokens",t0="breakpoints",o0="typography",e0="icons",Y$=`/*
20
+ `}}),!h(N(X,Y)))r(N(X,Y));RY(q,U)}function E2($,X,Y){let Z=s0(X,Y);return $.startsWith(Z)?$.slice(Z.length+1):$}function L2($,X,Y,Z){let q=c0($),U=a0(c0(X)),K=q.split(t$),W=K.lastIndexOf(U);if(U===".")return l0(Y,Z).split(t$).join("/");else if(W===-1)throw new Error(`Base directory '${U}' not found in '${q}'`);let z=N(...K.slice(0,W+1)),G=N(z,Y),E=N(z,Z);return l0(G,E).split(t$).join("/")}var n0="tokens",t0="breakpoints",o0="typography",e0="icons",Y$=`/*
21
21
  * This file is automatically generated.
22
22
  * DO NOT EDIT THIS FILE DIRECTLY.
23
23
  * Changes will be overwritten. Please update the source design tokens instead.
@@ -31,7 +31,7 @@ ${E}`;if(K.forEach((L)=>{if(F$(L,U,q))return;let _=j$(L,X,Y);if(U.transformValue
31
31
  }
32
32
  `}}let{distCSSPath:L}=await k(),_=X?V(X,"css"):L,H=`${_}/fonts.css`;O2(_,{recursive:!0}),await CY(H,E,{flag:"w",encoding:"utf-8"})}catch(Y){console.error("Error appending typography tokens:",Y)}}var Q0=P(()=>{g()});function Q$($){if(typeof $!=="string"||!$.startsWith("{")||!$.endsWith("}"))return!1;let X=$.slice(1,-1);return!X.includes("{")&&!X.includes("}")&&X.trim()!==""}function B$($){if(typeof $!=="string")return!1;let X=/\{[^}]+\}/g,Y=$.match(X);return!!(Y&&Y.length>0&&$.length>Y.join("").length)}function D$($){let X=[],Y=/\{[^}]+\}/g,Z=0,q;while((q=Y.exec($))!==null){if(q.index>Z){let K=$.slice(Z,q.index);if(K)X.push({type:"literal",value:K})}let U=q[0];if(U.startsWith("{#/"))X.push({type:"reference",value:U,ref:{$ref:U.slice(2,-1)}});else X.push({type:"reference",value:U,ref:U});Z=q.index+q[0].length}if(Z<$.length){let U=$.slice(Z);if(U)X.push({type:"literal",value:U})}return X}function w2($){return!!$.$extensions?.$mode}function I2($){return!!($.$extensions?.$generators&&Array.isArray($.$extensions.$generators))}function J2($){return!!($.$extensions?.$breakpoints&&typeof $.$extensions.$breakpoints==="object")}function R2($,X){return`${$}${X}`}function M2($){return typeof $==="object"&&$!==null&&"$value"in $}function N2($){return typeof $==="object"&&$!==null&&!("$value"in $)}var x2=()=>{};function F2($){if(typeof $!=="string")return!1;let X=$.trim();return X.startsWith("<svg")&&X.includes("</svg>")}function j2($){if(typeof $!=="string")return!1;return $.startsWith("data:image/png;base64,")||$.startsWith("iVBORw0KGgo")}function P2($){if(typeof $!=="string")return!1;return $.startsWith("data:image/jpeg;base64,")||$.startsWith("data:image/jpg;base64,")||$.startsWith("/9j/")}function gY($){let X=$.trim();return X=X.replace(/\s+/g," ").replace(/>\s+</g,"><").trim(),`data:image/svg+xml;base64,${Buffer.from(X,"utf-8").toString("base64")}`}function yY($){if($.startsWith("data:image/png;base64,"))return $;return`data:image/png;base64,${$}`}function hY($){if($.startsWith("data:image/jpeg;base64,")||$.startsWith("data:image/jpg;base64,"))return $;return`data:image/jpeg;base64,${$}`}function O$($){if(!$||typeof $!=="string")return $;if($.startsWith("data:"))return $;if(F2($))return gY($);else if(j2($))return yY($);else if(P2($))return hY($);return $}function vY($){if(typeof $!=="string")return!1;return $.startsWith("data:image/svg+xml;")||$.startsWith("data:image/png;")||$.startsWith("data:image/jpeg;")||$.startsWith("data:image/jpg;")||$.startsWith("data:image/gif;")||$.startsWith("data:image/webp;")}function m($){return F2($)||j2($)||P2($)||vY($)}import{readFileSync as fY,readdirSync as pY,statSync as mY}from"fs";import{join as dY}from"path";import D2 from"colorjs.io";function O0($){let X={};function Y(Z){let q=pY(Z);for(let U of q){let K=dY(Z,U);if(mY(K).isDirectory())Y(K);else if(U.endsWith(".tokens.json"))try{let z=fY(K,"utf-8");if(!z.trim())continue;let G=JSON.parse(z);b2(X,G)}catch(z){console.warn(`Failed to load token file: ${K}`,z)}}}return Y($),X}function b2($,X){for(let Y in X)if(X[Y]&&typeof X[Y]==="object"&&!Array.isArray(X[Y])){if(!$[Y])$[Y]={};b2($[Y],X[Y])}else $[Y]=X[Y]}function w0($,X={}){let Y=[];function Z(q,U=[]){for(let[K,W]of Object.entries(q)){if(K.startsWith("$"))continue;let z=[...U,K],G=z.join(".");if(M2(W)){let E={path:z,name:G,type:W.$type,value:W.$value,description:W.$description,extensions:W.$extensions?{mode:w2(W)?W.$extensions.$mode:W.$extensions.mode?W.$extensions.mode:void 0,generators:I2(W)?W.$extensions.$generators:W.$extensions.generators?W.$extensions.generators:void 0,breakpoints:J2(W)?W.$extensions.$breakpoints:W.$extensions.breakpoint?W.$extensions.breakpoint:void 0,...Object.fromEntries(Object.entries(W.$extensions).filter(([A])=>!["$mode","$generators","$breakpoints","mode","generators","breakpoint"].includes(A)))}:void 0,original:W};if(!X.namespace||G.startsWith(X.namespace))Y.push(E)}else if(N2(W))Z(W,z)}}return Z($),Y}function I0($,X={}){let Y=[...$],Z=new Map($.map((G)=>[G.name,G]));if(X.generateModes||X.generateDerivedTokens||X.generateBreakpointTokens)for(let G of $){let E=S2(G,X,Z);if(Y.push(...E),X.generateModes){for(let A of E)if(A.extensions?.mode&&!A.name.includes("#")){let L=S2(A,X,Z);Y.push(...L)}}}let q=X.modes||[],U=q.length>0?q[0]:void 0,K={tokens:new Map(Y.map((G)=>[G.name,G])),mode:X.generateModes?U:void 0,options:X,brokenReferences:[]},W=[];for(let G of Y){let E=void 0;for(let _ of q)if(G.name.endsWith(`#${_}`)){E=_;break}if(!E&&X.generateModes)E=U;let A={...K,mode:E},L=uY(G,A);W.push(L)}if(X.failOnBrokenReferences!==!1&&K.brokenReferences.length>0){let G=[...new Set(K.brokenReferences)],E=`Token reference${G.length>1?"s":""} not found:
33
33
  ${G.map((A)=>` - ${A}`).join(`
34
- `)}`;throw Error(E)}return W}function S2($,X,Y){let Z=[];if(X.generateModes&&$.extensions?.mode){for(let[q,U]of Object.entries($.extensions.mode))if(U!==void 0)Z.push({...$,name:`${$.name}#${q}`,value:U,path:[...$.path,`#${q}`]})}if(X.generateModes&&!$.extensions?.mode&&(Array.isArray($.value)||typeof $.value==="object"&&$.value!==null)){let q=!1,U=!1,K=(W)=>{if(typeof W!=="object"||W===null)return!1;if(W.$extensions?.mode)return!0;return Object.values(W).some((z)=>{if(typeof z==="object"&&z!==null)return K(z);return!1})};if(Array.isArray($.value))q=$.value.some((W)=>typeof W==="string"&&W.includes("{")||typeof W==="object"&&W!==null&&Object.values(W).some((z)=>typeof z==="string"&&z.includes("{"))),U=$.value.some((W)=>K(W));else q=Object.values($.value).some((W)=>typeof W==="string"&&W.includes("{")),U=K($.value);if(q||U){if(["color","shadow","border","background","surface","composition"].includes($.type)){let G;if(Array.isArray($.value))G=$.value.map((E)=>{if(typeof E==="string"&&E.startsWith("{")&&E.endsWith("}")){let A=E.slice(1,-1);if(!A.includes("#dark")&&!A.includes("@dark"))return`{${A}#dark}`;return E}else if(typeof E==="object"&&E!==null){let A={};for(let[L,_]of Object.entries(E))if(typeof _==="string"&&_.startsWith("{")&&_.endsWith("}")){let H=_.slice(1,-1),Q=`${H}#dark`,O=Y?.get(H),w=Y?.has(Q)||O?.extensions?.mode?.dark!==void 0||O&&(Array.isArray(O.value)||typeof O.value==="object"&&O.value!==null);if(!H.includes("#dark")&&!H.includes("@dark")&&w)A[L]=`{${Q}}`;else A[L]=_}else A[L]=_;return A}return E});else if(typeof $.value==="object"&&$.value!==null){G={};let E=(A)=>{if(typeof A==="string"){if(A.startsWith("{")&&A.endsWith("}")){let L=A.slice(1,-1),_=`${L}#dark`,H=(O,w=new Set)=>{if(w.has(O))return!1;w.add(O);let B=Y?.get(O);if(!B){let I=O.match(/^(.+)@([^@]+)$/);if(I){let[,J,R]=I,f=Y?.get(J);if(f){if(f.extensions?.mode?.dark!==void 0)return!0;if(f.extensions?.generators)return!0;return H(J,w)}}return!1}if(B.extensions?.mode?.dark!==void 0)return!0;if(Y?.has(`${O}#dark`))return!0;if(typeof B.value==="string"&&B.value.startsWith("{")&&B.value.endsWith("}")){let I=B.value.slice(1,-1);return H(I,w)}if(Array.isArray(B.value)||typeof B.value==="object"&&B.value!==null){let I=(J)=>{if(typeof J!=="object"||J===null)return!1;if(J.$extensions?.mode)return!0;return Object.values(J).some((R)=>{if(typeof R==="object"&&R!==null)return I(R);return!1})};if(Array.isArray(B.value))return B.value.some((J)=>typeof J==="string"&&J.includes("{")&&H(J.slice(1,-1),new Set(w))||typeof J==="object"&&J!==null&&(Object.values(J).some((R)=>typeof R==="string"&&R.includes("{")&&H(R.slice(1,-1),new Set(w)))||I(J)));else if(typeof B.value==="object")return Object.values(B.value).some((J)=>typeof J==="string"&&J.includes("{")&&H(J.slice(1,-1),new Set(w)))||I(B.value)}return!1},Q=H(L);if(!L.includes("#dark")&&!L.includes("@dark")&&Q)return`{${_}}`}return A}if(typeof A==="object"&&A!==null){if(A.$extensions?.mode?.dark)return A.$extensions.mode.dark;let L={};for(let[_,H]of Object.entries(A))L[_]=E(H);return L}return A};for(let[A,L]of Object.entries($.value))G[A]=E(L)}Z.push({...$,name:`${$.name}#dark`,value:G,path:[...$.path,"#dark"],extensions:{...$.extensions,autoGenerated:!0}})}}}if(X.generateModes&&!$.extensions?.mode&&typeof $.value==="string"&&$.value.startsWith("{")&&$.value.endsWith("}")){let q=$.value.slice(1,-1),U=(E,A=new Set)=>{if(A.has(E))return!1;A.add(E);let L=Y?.get(E);if(!L){let _=E.match(/^(.+)@([^@]+)$/);if(_){let[,H,Q]=_,O=Y?.get(H);if(O){if(O.extensions?.mode?.dark!==void 0)return!0;if(O.extensions?.generators)return!0;return U(H,A)}}return!1}if(L.extensions?.mode?.dark!==void 0)return!0;if(Y?.has(`${E}#dark`))return!0;if(typeof L.value==="string"&&L.value.startsWith("{")&&L.value.endsWith("}")){let _=L.value.slice(1,-1);return U(_,A)}if(Array.isArray(L.value)||typeof L.value==="object"&&L.value!==null){let _=(H)=>{if(typeof H!=="object"||H===null)return!1;if(H.$extensions?.mode)return!0;return Object.values(H).some((Q)=>{if(typeof Q==="object"&&Q!==null)return _(Q);return!1})};if(Array.isArray(L.value))return L.value.some((H)=>typeof H==="string"&&H.includes("{")&&U(H.slice(1,-1),new Set(A))||typeof H==="object"&&H!==null&&(Object.values(H).some((Q)=>typeof Q==="string"&&Q.includes("{")&&U(Q.slice(1,-1),new Set(A)))||_(H)));else if(typeof L.value==="object")return Object.values(L.value).some((H)=>typeof H==="string"&&H.includes("{")&&U(H.slice(1,-1),new Set(A)))||_(L.value)}return!1},K=U(q);if(["color","shadow","border","background","surface","composition"].includes($.type)&&K&&K&&!q.includes("#dark")&&!q.includes("@dark")){let E=`{${q}#dark}`;Z.push({...$,name:`${$.name}#dark`,value:E,path:[...$.path,"#dark"],extensions:{...$.extensions,autoGenerated:!0}})}}if(X.generateDerivedTokens&&$.extensions?.generators)for(let q of $.extensions.generators)for(let[U,K]of Object.entries(q.value)){let W=R2($.name,U),{generators:z,...G}=$.extensions;Z.push({...$,name:W,value:$.value,path:[...$.path,U],extensions:{...G,generator:{type:q.type,value:K}}})}if(X.generateBreakpointTokens&&$.extensions?.breakpoints)for(let[q,U]of Object.entries($.extensions.breakpoints)){let K=`${$.name}@${q.replace(/[^a-zA-Z0-9]/g,"_")}`,W=U.$value||U.value;if(W&&typeof W==="object"&&"$value"in W)W=W.$value;else if(!W&&typeof U==="object"){let{...E}=U;if(Object.keys(E).length>0)W=E}let z=U.$extensions||U.$extensions,G=U.$type;if(!G&&U.value&&typeof U.value==="object")G=U.value.$type;Z.push({...$,name:K,value:W,path:[...$.path,`@${q}`],type:G||$.type,extensions:{mediaQuery:q,...z?{mode:z.mode||z.$mode,generators:z.generators||z.$generators,...Object.fromEntries(Object.entries(z).filter(([E])=>!["mode","$mode","generators","$generators"].includes(E)))}:{}}})}return Z}function uY($,X){let Y=s($.value,X),Z=$.type;if(typeof $.value==="string"&&Q$($.value)){let U=$.value.slice(1,-1),K=X.tokens.get(U);if(K){if(["border","shadow","typography","composition"].includes(K.type))Z=K.type;else if(typeof K.value==="string"&&B$(K.value)){let W=D$(K.value),z=new Set;for(let G of W)if(G.type==="reference"&&G.ref&&typeof G.ref==="string"){let E=G.ref.slice(1,-1),A=X.tokens.get(E);if(A&&["border","shadow","typography","composition"].includes(A.type))z.add(A.type)}if(z.size===1)Z=Array.from(z)[0]}}}if(typeof $.value==="string"&&B$($.value)){let U=D$($.value),K=new Set;for(let W of U)if(W.type==="reference"&&W.ref&&typeof W.ref==="string"){let z=W.ref.slice(1,-1),G=X.tokens.get(z);if(G&&["border","shadow","typography","composition"].includes(G.type))K.add(G.type)}if(K.size===1)Z=Array.from(K)[0]}if(typeof Y==="object"&&Y!==null&&["border","shadow","typography","composition"].includes(Z))Y=c(Y,X);if($.extensions?.generator&&typeof $.extensions.generator==="object"&&"type"in $.extensions.generator&&"value"in $.extensions.generator)Y=b$($.value,$.extensions.generator.type,$.extensions.generator.value,X);let q=kY($.name,X.options);if(Z==="color"&&typeof Y==="string"&&p(Y))Y=F(Y,$);if(typeof Y==="string"&&m(Y))Y=O$(Y);return{...$,type:Z,value:Y,cssVar:q}}function c($,X){if(typeof $==="string"){if(Q$($))return J0($,X);else if(B$($))return V2($,X)}if(Array.isArray($))return $.map((Y)=>c(Y,X));if(typeof $==="object"&&$!==null){if("$value"in $&&typeof $.$value==="string")return c($.$value,X);if("value"in $&&typeof $.value==="string"&&"$type"in $){if(X.mode&&$.$extensions?.mode?.[X.mode])return c($.$extensions.mode[X.mode],X);return c($.value,X)}if("value"in $&&typeof $.value==="object"&&"$type"in $){let Z=$.value,q=$.$extensions?.delimiter?.character||" ";if($.$type==="composition"&&Z&&typeof Z==="object")return Object.values(Z).map((K)=>c(K,X)).join(q);return c($.value,X)}let Y={};for(let[Z,q]of Object.entries($))Y[Z]=c(q,X);return Y}return $}function s($,X){if(typeof $==="string"){if(B$($))return V2($,X);else if(Q$($))return J0($,X)}else if(typeof $==="object"&&$!==null&&"$ref"in $)return C2($,X);return $}function J0($,X){let Y=$.slice(1,-1),Z=X.tokens.get(Y),q=X.options.modes||[];if(!Z){if(q.length>0){for(let W of q)if(Y.endsWith(`@${W}`)){let z=Y.slice(0,-W.length-1)+`#${W}`;if(Z=X.tokens.get(z),Z)return B0(Z,X);break}}let K=Y.match(/#([^#@]+)$/);if(K){let W=Y.substring(0,K.index),z=K[1];if(Z=X.tokens.get(W),Z){if(Z.extensions?.mode?.[z]){let G=Z.extensions.mode[z],E=s(G,{...X,mode:z});if(Z.extensions?.generator&&typeof Z.extensions.generator==="object"&&"type"in Z.extensions.generator&&"value"in Z.extensions.generator)E=b$(E,Z.extensions.generator.type,Z.extensions.generator.value,X);if(Z.type==="color"&&typeof E==="string"&&p(E))E=F(E,Z);if(typeof E==="string"&&m(E))E=O$(E);return E}}}if(q.length>0)for(let W of q){let z=new RegExp(`(@[^@]+)@${W}$`);if(z.test(Y)){let G=Y.replace(z,`$1#${W}`);if(Z=X.tokens.get(G),!Z){let E=G.match(/#([^#@]+)$/);if(E){let A=G.substring(0,E.index),L=E[1];if(Z=X.tokens.get(A),Z&&Z.extensions?.mode?.[L]){let _=Z.extensions.mode[L],H=s(_,{...X,mode:L});if(Z.extensions?.generator&&typeof Z.extensions.generator==="object"&&"type"in Z.extensions.generator&&"value"in Z.extensions.generator)H=b$(H,Z.extensions.generator.type,Z.extensions.generator.value,X);if(Z.type==="color"&&typeof H==="string"&&p(H))H=F(H,Z);if(typeof H==="string"&&m(H))H=O$(H);return H}}}else return B0(Z,X);break}}}if(!Z)return console.warn(`Token reference not found: ${$}`),X.brokenReferences.push($),$;return B0(Z,X)}function B0($,X){let Y;if($.extensions?.generator&&typeof $.extensions.generator==="object"&&"type"in $.extensions.generator&&"value"in $.extensions.generator)Y=b$($.value,$.extensions.generator.type,$.extensions.generator.value,X);else if(X.mode&&$.extensions?.mode?.[X.mode])Y=s($.extensions.mode[X.mode],X);else Y=s($.value,X);if($.type==="color"&&typeof Y==="string"&&p(Y))Y=F(Y,$);if(typeof Y==="string"&&m(Y))Y=O$(Y);return Y}function C2($,X){let Z=$.$ref.slice(2).replace(/\//g,"."),q=X.tokens.get(Z);if(!q)return console.warn(`JSON Pointer reference not found: ${$.$ref}`),X.brokenReferences.push($.$ref),$.$ref;return s(q.value,X)}function V2($,X){let Y=D$($),Z=Y.some((K)=>K.value.includes(",")),q=!0,U=[];for(let K of Y){let W;if(K.type==="reference"&&K.ref){if(typeof K.ref==="string"&&Q$(K.ref)){W=J0(K.ref,X);let z=K.ref.slice(1,-1),G=X.tokens.get(z);if(!G||!["border","shadow","typography","composition"].includes(G.type))q=!1}else if(typeof K.ref==="object"&&"$ref"in K.ref)W=C2(K.ref,X)}else if(W=K.value,K.value.trim()&&K.value.trim()!==",")q=!1;U.push(W)}if(Z&&q)return U.filter((K)=>typeof K==="object"&&K!==null&&typeof K!=="string");return U.map((K)=>String(K)).join("")}function b$($,X,Y,Z){let q=s($,Z);switch(X){case"alpha":if(typeof q==="string")return cY(q,Number(Y)/100);break;case"scale":if(typeof q==="string"&&q.match(/[\d.]+/))return lY(q,Number(Y));break;case"hue":if(typeof q==="string")return rY(q,Number(Y));break;default:return console.warn(`Unknown generator type: ${X}`),q}return q}function kY($,X,Y){let Z=$.replace(/\./g,"-");Z=Z.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),Z=Z.replace(/@[^@#]*(?:screen|width|height|min|max|orientation).*$/i,""),Z=Z.replace(/#[^#]*$/,""),Z=Z.replace(/-@/g,"-").replace(/@/g,"-");let q=Z,U=!0,K=X.prefix||"";if(X.transformName){if(q=X.transformName(Z),q=q.replace(/-+$/,""),q!==Z)U=!1}let W=U&&K?`${K}-${q}`:q,z=Y?`-${Y}`:"";return`--${W}${z}`.replace(/[^a-zA-Z0-9-_]/g,"-")}function cY($,X){try{if(!p($))return $;let Y=new D2($);return Y.alpha=X,F(Y)}catch(Y){return console.warn(`Failed to apply alpha to color "${$}": ${Y}`),$}}function lY($,X){let Y=$.match(/([\d.]+)(\w+)/);if(Y){let[,Z,q]=Y;return`${parseFloat(Z)*X}${q}`}return $}function rY($,X){try{if(!p($))return $;let Z=new D2($).to("oklch");return Z.h=(Z.h+X)%360,F(Z)}catch(Y){return console.warn(`Failed to shift hue for color "${$}": ${Y}`),$}}var R0=P(()=>{x2();W$()});function M0($){if($.type==="typography"||$.type==="fontWeight"||$.type==="fontFamily")return!0;if($.type==="dimension"&&$.name.includes("typography"))return!0;if($.name.includes("typography")||$.name.includes("font"))return!0;return!1}function a($,X,Y){if(Y){if($===X)return":host";return`:host([data-theme="${$}"])`}if($===X)return":root";return`[data-theme="${$}"]`}function C$($,X={}){let{rootSelector:Y=":root",separateThemeFiles:Z=!1,generateMediaQueries:q=!1,customHeader:U,modes:K=["light","dark"]}=X;if(Z)return sY($,X);let W=new Map,z=new Map;for(let B of K)W.set(B,[]);let G=K.join("|"),E=new RegExp(`#(${G})$`);for(let B of $){if(typeof B.value==="string"&&m(B.value))continue;if(M0(B))continue;let I=` ${B.cssVar}: ${v(B.value,B.type)};`;if(q&&B.name.includes("@media")){let R=T$(B);if(R){if(!z.has(R))z.set(R,[]);z.get(R).push(I);continue}}let J=B.name.match(E);if(J){let R=J[1];if(!W.has(R))W.set(R,[]);W.get(R).push(I)}else{let R=K[0]||"light";W.get(R).push(I)}}let A="";if(U)A+=`${U}
34
+ `)}`;throw new Error(E)}return W}function S2($,X,Y){let Z=[];if(X.generateModes&&$.extensions?.mode){for(let[q,U]of Object.entries($.extensions.mode))if(U!==void 0)Z.push({...$,name:`${$.name}#${q}`,value:U,path:[...$.path,`#${q}`]})}if(X.generateModes&&!$.extensions?.mode&&(Array.isArray($.value)||typeof $.value==="object"&&$.value!==null)){let q=!1,U=!1,K=(W)=>{if(typeof W!=="object"||W===null)return!1;if(W.$extensions?.mode)return!0;return Object.values(W).some((z)=>{if(typeof z==="object"&&z!==null)return K(z);return!1})};if(Array.isArray($.value))q=$.value.some((W)=>typeof W==="string"&&W.includes("{")||typeof W==="object"&&W!==null&&Object.values(W).some((z)=>typeof z==="string"&&z.includes("{"))),U=$.value.some((W)=>K(W));else q=Object.values($.value).some((W)=>typeof W==="string"&&W.includes("{")),U=K($.value);if(q||U){if(["color","shadow","border","background","surface","composition"].includes($.type)){let G;if(Array.isArray($.value))G=$.value.map((E)=>{if(typeof E==="string"&&E.startsWith("{")&&E.endsWith("}")){let A=E.slice(1,-1);if(!A.includes("#dark")&&!A.includes("@dark"))return`{${A}#dark}`;return E}else if(typeof E==="object"&&E!==null){let A={};for(let[L,_]of Object.entries(E))if(typeof _==="string"&&_.startsWith("{")&&_.endsWith("}")){let H=_.slice(1,-1),Q=`${H}#dark`,O=Y?.get(H),w=Y?.has(Q)||O?.extensions?.mode?.dark!==void 0||O&&(Array.isArray(O.value)||typeof O.value==="object"&&O.value!==null);if(!H.includes("#dark")&&!H.includes("@dark")&&w)A[L]=`{${Q}}`;else A[L]=_}else A[L]=_;return A}return E});else if(typeof $.value==="object"&&$.value!==null){G={};let E=(A)=>{if(typeof A==="string"){if(A.startsWith("{")&&A.endsWith("}")){let L=A.slice(1,-1),_=`${L}#dark`,H=(O,w=new Set)=>{if(w.has(O))return!1;w.add(O);let B=Y?.get(O);if(!B){let I=O.match(/^(.+)@([^@]+)$/);if(I){let[,J,R]=I,f=Y?.get(J);if(f){if(f.extensions?.mode?.dark!==void 0)return!0;if(f.extensions?.generators)return!0;return H(J,w)}}return!1}if(B.extensions?.mode?.dark!==void 0)return!0;if(Y?.has(`${O}#dark`))return!0;if(typeof B.value==="string"&&B.value.startsWith("{")&&B.value.endsWith("}")){let I=B.value.slice(1,-1);return H(I,w)}if(Array.isArray(B.value)||typeof B.value==="object"&&B.value!==null){let I=(J)=>{if(typeof J!=="object"||J===null)return!1;if(J.$extensions?.mode)return!0;return Object.values(J).some((R)=>{if(typeof R==="object"&&R!==null)return I(R);return!1})};if(Array.isArray(B.value))return B.value.some((J)=>typeof J==="string"&&J.includes("{")&&H(J.slice(1,-1),new Set(w))||typeof J==="object"&&J!==null&&(Object.values(J).some((R)=>typeof R==="string"&&R.includes("{")&&H(R.slice(1,-1),new Set(w)))||I(J)));else if(typeof B.value==="object")return Object.values(B.value).some((J)=>typeof J==="string"&&J.includes("{")&&H(J.slice(1,-1),new Set(w)))||I(B.value)}return!1},Q=H(L);if(!L.includes("#dark")&&!L.includes("@dark")&&Q)return`{${_}}`}return A}if(typeof A==="object"&&A!==null){if(A.$extensions?.mode?.dark)return A.$extensions.mode.dark;let L={};for(let[_,H]of Object.entries(A))L[_]=E(H);return L}return A};for(let[A,L]of Object.entries($.value))G[A]=E(L)}Z.push({...$,name:`${$.name}#dark`,value:G,path:[...$.path,"#dark"],extensions:{...$.extensions,autoGenerated:!0}})}}}if(X.generateModes&&!$.extensions?.mode&&typeof $.value==="string"&&$.value.startsWith("{")&&$.value.endsWith("}")){let q=$.value.slice(1,-1),U=(E,A=new Set)=>{if(A.has(E))return!1;A.add(E);let L=Y?.get(E);if(!L){let _=E.match(/^(.+)@([^@]+)$/);if(_){let[,H,Q]=_,O=Y?.get(H);if(O){if(O.extensions?.mode?.dark!==void 0)return!0;if(O.extensions?.generators)return!0;return U(H,A)}}return!1}if(L.extensions?.mode?.dark!==void 0)return!0;if(Y?.has(`${E}#dark`))return!0;if(typeof L.value==="string"&&L.value.startsWith("{")&&L.value.endsWith("}")){let _=L.value.slice(1,-1);return U(_,A)}if(Array.isArray(L.value)||typeof L.value==="object"&&L.value!==null){let _=(H)=>{if(typeof H!=="object"||H===null)return!1;if(H.$extensions?.mode)return!0;return Object.values(H).some((Q)=>{if(typeof Q==="object"&&Q!==null)return _(Q);return!1})};if(Array.isArray(L.value))return L.value.some((H)=>typeof H==="string"&&H.includes("{")&&U(H.slice(1,-1),new Set(A))||typeof H==="object"&&H!==null&&(Object.values(H).some((Q)=>typeof Q==="string"&&Q.includes("{")&&U(Q.slice(1,-1),new Set(A)))||_(H)));else if(typeof L.value==="object")return Object.values(L.value).some((H)=>typeof H==="string"&&H.includes("{")&&U(H.slice(1,-1),new Set(A)))||_(L.value)}return!1},K=U(q);if(["color","shadow","border","background","surface","composition"].includes($.type)&&K&&K&&!q.includes("#dark")&&!q.includes("@dark")){let E=`{${q}#dark}`;Z.push({...$,name:`${$.name}#dark`,value:E,path:[...$.path,"#dark"],extensions:{...$.extensions,autoGenerated:!0}})}}if(X.generateDerivedTokens&&$.extensions?.generators)for(let q of $.extensions.generators)for(let[U,K]of Object.entries(q.value)){let W=R2($.name,U),{generators:z,...G}=$.extensions;Z.push({...$,name:W,value:$.value,path:[...$.path,U],extensions:{...G,generator:{type:q.type,value:K}}})}if(X.generateBreakpointTokens&&$.extensions?.breakpoints)for(let[q,U]of Object.entries($.extensions.breakpoints)){let K=`${$.name}@${q.replace(/[^a-zA-Z0-9]/g,"_")}`,W=U.$value||U.value;if(W&&typeof W==="object"&&"$value"in W)W=W.$value;else if(!W&&typeof U==="object"){let{...E}=U;if(Object.keys(E).length>0)W=E}let z=U.$extensions||U.$extensions,G=U.$type;if(!G&&U.value&&typeof U.value==="object")G=U.value.$type;Z.push({...$,name:K,value:W,path:[...$.path,`@${q}`],type:G||$.type,extensions:{mediaQuery:q,...z?{mode:z.mode||z.$mode,generators:z.generators||z.$generators,...Object.fromEntries(Object.entries(z).filter(([E])=>!["mode","$mode","generators","$generators"].includes(E)))}:{}}})}return Z}function uY($,X){let Y=s($.value,X),Z=$.type;if(typeof $.value==="string"&&Q$($.value)){let U=$.value.slice(1,-1),K=X.tokens.get(U);if(K){if(["border","shadow","typography","composition"].includes(K.type))Z=K.type;else if(typeof K.value==="string"&&B$(K.value)){let W=D$(K.value),z=new Set;for(let G of W)if(G.type==="reference"&&G.ref&&typeof G.ref==="string"){let E=G.ref.slice(1,-1),A=X.tokens.get(E);if(A&&["border","shadow","typography","composition"].includes(A.type))z.add(A.type)}if(z.size===1)Z=Array.from(z)[0]}}}if(typeof $.value==="string"&&B$($.value)){let U=D$($.value),K=new Set;for(let W of U)if(W.type==="reference"&&W.ref&&typeof W.ref==="string"){let z=W.ref.slice(1,-1),G=X.tokens.get(z);if(G&&["border","shadow","typography","composition"].includes(G.type))K.add(G.type)}if(K.size===1)Z=Array.from(K)[0]}if(typeof Y==="object"&&Y!==null&&["border","shadow","typography","composition"].includes(Z))Y=c(Y,X);if($.extensions?.generator&&typeof $.extensions.generator==="object"&&"type"in $.extensions.generator&&"value"in $.extensions.generator)Y=b$($.value,$.extensions.generator.type,$.extensions.generator.value,X);let q=kY($.name,X.options);if(Z==="color"&&typeof Y==="string"&&p(Y))Y=F(Y,$);if(typeof Y==="string"&&m(Y))Y=O$(Y);return{...$,type:Z,value:Y,cssVar:q}}function c($,X){if(typeof $==="string"){if(Q$($))return J0($,X);else if(B$($))return V2($,X)}if(Array.isArray($))return $.map((Y)=>c(Y,X));if(typeof $==="object"&&$!==null){if("$value"in $&&typeof $.$value==="string")return c($.$value,X);if("value"in $&&typeof $.value==="string"&&"$type"in $){if(X.mode&&$.$extensions?.mode?.[X.mode])return c($.$extensions.mode[X.mode],X);return c($.value,X)}if("value"in $&&typeof $.value==="object"&&"$type"in $){let Z=$.value,q=$.$extensions?.delimiter?.character||" ";if($.$type==="composition"&&Z&&typeof Z==="object")return Object.values(Z).map((K)=>c(K,X)).join(q);return c($.value,X)}let Y={};for(let[Z,q]of Object.entries($))Y[Z]=c(q,X);return Y}return $}function s($,X){if(typeof $==="string"){if(B$($))return V2($,X);else if(Q$($))return J0($,X)}else if(typeof $==="object"&&$!==null&&"$ref"in $)return C2($,X);return $}function J0($,X){let Y=$.slice(1,-1),Z=X.tokens.get(Y),q=X.options.modes||[];if(!Z){if(q.length>0){for(let W of q)if(Y.endsWith(`@${W}`)){let z=Y.slice(0,-W.length-1)+`#${W}`;if(Z=X.tokens.get(z),Z)return B0(Z,X);break}}let K=Y.match(/#([^#@]+)$/);if(K){let W=Y.substring(0,K.index),z=K[1];if(Z=X.tokens.get(W),Z){if(Z.extensions?.mode?.[z]){let G=Z.extensions.mode[z],E=s(G,{...X,mode:z});if(Z.extensions?.generator&&typeof Z.extensions.generator==="object"&&"type"in Z.extensions.generator&&"value"in Z.extensions.generator)E=b$(E,Z.extensions.generator.type,Z.extensions.generator.value,X);if(Z.type==="color"&&typeof E==="string"&&p(E))E=F(E,Z);if(typeof E==="string"&&m(E))E=O$(E);return E}}}if(q.length>0)for(let W of q){let z=new RegExp(`(@[^@]+)@${W}$`);if(z.test(Y)){let G=Y.replace(z,`$1#${W}`);if(Z=X.tokens.get(G),!Z){let E=G.match(/#([^#@]+)$/);if(E){let A=G.substring(0,E.index),L=E[1];if(Z=X.tokens.get(A),Z&&Z.extensions?.mode?.[L]){let _=Z.extensions.mode[L],H=s(_,{...X,mode:L});if(Z.extensions?.generator&&typeof Z.extensions.generator==="object"&&"type"in Z.extensions.generator&&"value"in Z.extensions.generator)H=b$(H,Z.extensions.generator.type,Z.extensions.generator.value,X);if(Z.type==="color"&&typeof H==="string"&&p(H))H=F(H,Z);if(typeof H==="string"&&m(H))H=O$(H);return H}}}else return B0(Z,X);break}}}if(!Z)return console.warn(`Token reference not found: ${$}`),X.brokenReferences.push($),$;return B0(Z,X)}function B0($,X){let Y;if($.extensions?.generator&&typeof $.extensions.generator==="object"&&"type"in $.extensions.generator&&"value"in $.extensions.generator)Y=b$($.value,$.extensions.generator.type,$.extensions.generator.value,X);else if(X.mode&&$.extensions?.mode?.[X.mode])Y=s($.extensions.mode[X.mode],X);else Y=s($.value,X);if($.type==="color"&&typeof Y==="string"&&p(Y))Y=F(Y,$);if(typeof Y==="string"&&m(Y))Y=O$(Y);return Y}function C2($,X){let Z=$.$ref.slice(2).replace(/\//g,"."),q=X.tokens.get(Z);if(!q)return console.warn(`JSON Pointer reference not found: ${$.$ref}`),X.brokenReferences.push($.$ref),$.$ref;return s(q.value,X)}function V2($,X){let Y=D$($),Z=Y.some((K)=>K.value.includes(",")),q=!0,U=[];for(let K of Y){let W;if(K.type==="reference"&&K.ref){if(typeof K.ref==="string"&&Q$(K.ref)){W=J0(K.ref,X);let z=K.ref.slice(1,-1),G=X.tokens.get(z);if(!G||!["border","shadow","typography","composition"].includes(G.type))q=!1}else if(typeof K.ref==="object"&&"$ref"in K.ref)W=C2(K.ref,X)}else if(W=K.value,K.value.trim()&&K.value.trim()!==",")q=!1;U.push(W)}if(Z&&q)return U.filter((K)=>typeof K==="object"&&K!==null&&typeof K!=="string");return U.map((K)=>String(K)).join("")}function b$($,X,Y,Z){let q=s($,Z);switch(X){case"alpha":if(typeof q==="string")return cY(q,Number(Y)/100);break;case"scale":if(typeof q==="string"&&q.match(/[\d.]+/))return lY(q,Number(Y));break;case"hue":if(typeof q==="string")return rY(q,Number(Y));break;default:return console.warn(`Unknown generator type: ${X}`),q}return q}function kY($,X,Y){let Z=$.replace(/\./g,"-");Z=Z.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),Z=Z.replace(/@[^@#]*(?:screen|width|height|min|max|orientation).*$/i,""),Z=Z.replace(/#[^#]*$/,""),Z=Z.replace(/-@/g,"-").replace(/@/g,"-");let q=Z,U=!0,K=X.prefix||"";if(X.transformName){if(q=X.transformName(Z),q=q.replace(/-+$/,""),q!==Z)U=!1}let W=U&&K?`${K}-${q}`:q,z=Y?`-${Y}`:"";return`--${W}${z}`.replace(/[^a-zA-Z0-9-_]/g,"-")}function cY($,X){try{if(!p($))return $;let Y=new D2($);return Y.alpha=X,F(Y)}catch(Y){return console.warn(`Failed to apply alpha to color "${$}": ${Y}`),$}}function lY($,X){let Y=$.match(/([\d.]+)(\w+)/);if(Y){let[,Z,q]=Y;return`${parseFloat(Z)*X}${q}`}return $}function rY($,X){try{if(!p($))return $;let Z=new D2($).to("oklch");return Z.h=(Z.h+X)%360,F(Z)}catch(Y){return console.warn(`Failed to shift hue for color "${$}": ${Y}`),$}}var R0=P(()=>{x2();W$()});function M0($){if($.type==="typography"||$.type==="fontWeight"||$.type==="fontFamily")return!0;if($.type==="dimension"&&$.name.includes("typography"))return!0;if($.name.includes("typography")||$.name.includes("font"))return!0;return!1}function a($,X,Y){if(Y){if($===X)return":host";return`:host([data-theme="${$}"])`}if($===X)return":root";return`[data-theme="${$}"]`}function C$($,X={}){let{rootSelector:Y=":root",separateThemeFiles:Z=!1,generateMediaQueries:q=!1,customHeader:U,modes:K=["light","dark"]}=X;if(Z)return sY($,X);let W=new Map,z=new Map;for(let B of K)W.set(B,[]);let G=K.join("|"),E=new RegExp(`#(${G})$`);for(let B of $){if(typeof B.value==="string"&&m(B.value))continue;if(M0(B))continue;let I=` ${B.cssVar}: ${v(B.value,B.type)};`;if(q&&B.name.includes("@media")){let R=T$(B);if(R){if(!z.has(R))z.set(R,[]);z.get(R).push(I);continue}}let J=B.name.match(E);if(J){let R=J[1];if(!W.has(R))W.set(R,[]);W.get(R).push(I)}else{let R=K[0]||"light";W.get(R).push(I)}}let A="";if(U)A+=`${U}
35
35
 
36
36
  `;let L=X.defaultMode||K[0]||"light",_=X.isHost||!1,H=W.get(L)||[];if(H.length>0){H.sort();let B=a(L,L,_);A+=`${B} {
37
37
  ${H.join(`
@@ -133,7 +133,7 @@ ${z.sort().map((_)=>` ${_}`).join(`
133
133
  `;U+=`:root {
134
134
  `;let K=[...$].sort((W,z)=>W.name.localeCompare(z.name));for(let W of K){let z=W.name.replace(/([A-Z])/g,"-$1").toLowerCase().replace(/^-/,""),G=`${q}-${W.category}-${z}`;if(X.hooks?.shortenName?.enabled)G=N0(G,X.hooks);let E=z1(W.value);U+=` ${G}: url("${E}");
135
135
  `}return U+=`}
136
- `,{fileName:"tokens.icons.css",content:U.trim()}}var y$=P(()=>{g()});import{readFileSync as A1,existsSync as E1}from"fs";import{join as p2,relative as L1}from"path";async function j0(){try{let{assets:$}=await i(!0),{icons:X}=await C(),Y=await A$(),Z=$?.icons?.distDir??"build",q=p2(Y,Z),U=p2(q,"tokens",await X$("json"));if(!E1(U)){let A=L1(process.cwd(),U);return console.log(`ℹ️ Icon data not found (skipping icon types): ${A}`),console.log(" Run icon build first if you need icon types generated."),[]}let K=JSON.parse(A1(U,"utf8")),W=X?.objectPath??"universe.icons",z=W.split("."),G=K;for(let A of z)if(G&&typeof G==="object"&&A in G)G=G[A];else throw Error(`Icon path ${W} not found in icons file`);let E=[];for(let[A,L]of Object.entries(G))if(typeof L==="object"&&L!==null){for(let[_,H]of Object.entries(L))if(typeof H==="object"&&H!==null){let Q=H;E.push({name:_,category:A,value:Q.$value||"",description:Q.$description||"",style:Q.$style||"",dimensions:Q.$dimensions})}}return E}catch($){if($ instanceof Error){if("code"in $&&$.code!=="ENOENT")console.warn(`⚠️ Could not load icon data: ${$.message}`)}return[]}}async function P0($,X={}){let{generateTypes:Y=!0,generateConsts:Z=!0}=X,q=X.icons;if(!q)q=await j0();let U={...X,icons:q},K=[];if(Y)K.push({fileName:"tokens.types.ts",content:H1($,U),type:"types"});if(Z)K.push({fileName:"tokens.constants.ts",content:_1($,U),type:"constants"});return K.push({fileName:"index.ts",content:Q1(K),type:"index"}),K}function H1($,X){let{tokenInterface:Y="DesignTokens",includeJSDoc:Z=!0,icons:q=[]}=X,U=S0("Type Definitions");if(U+=B1($,Z),U+=O1($,Z),q.length>0)U+=w1(q,Z);return U+=I1($,Y,Z),U+=R1($,Z),U}function _1($,X){let{includeJSDoc:Y=!0,icons:Z=[]}=X,q=S0("Token Constants"),U="TokenPaths, CSSVariableNames";if(Z.length>0)U+=", IconNames, IconCategories, Icon";if(q+=`import type { ${U} } from './tokens.types';
136
+ `,{fileName:"tokens.icons.css",content:U.trim()}}var y$=P(()=>{g()});import{readFileSync as A1,existsSync as E1}from"fs";import{join as p2,relative as L1}from"path";async function j0(){try{let{assets:$}=await i(!0),{icons:X}=await C(),Y=await A$(),Z=$?.icons?.distDir??"build",q=p2(Y,Z),U=p2(q,"tokens",await X$("json"));if(!E1(U)){let A=L1(process.cwd(),U);return console.log(`ℹ️ Icon data not found (skipping icon types): ${A}`),console.log(" Run icon build first if you need icon types generated."),[]}let K=JSON.parse(A1(U,"utf8")),W=X?.objectPath??"universe.icons",z=W.split("."),G=K;for(let A of z)if(G&&typeof G==="object"&&A in G)G=G[A];else throw new Error(`Icon path ${W} not found in icons file`);let E=[];for(let[A,L]of Object.entries(G))if(typeof L==="object"&&L!==null){for(let[_,H]of Object.entries(L))if(typeof H==="object"&&H!==null){let Q=H;E.push({name:_,category:A,value:Q.$value||"",description:Q.$description||"",style:Q.$style||"",dimensions:Q.$dimensions})}}return E}catch($){if($ instanceof Error){if("code"in $&&$.code!=="ENOENT")console.warn(`⚠️ Could not load icon data: ${$.message}`)}return[]}}async function P0($,X={}){let{generateTypes:Y=!0,generateConsts:Z=!0}=X,q=X.icons;if(!q)q=await j0();let U={...X,icons:q},K=[];if(Y)K.push({fileName:"tokens.types.ts",content:H1($,U),type:"types"});if(Z)K.push({fileName:"tokens.constants.ts",content:_1($,U),type:"constants"});return K.push({fileName:"index.ts",content:Q1(K),type:"index"}),K}function H1($,X){let{tokenInterface:Y="DesignTokens",includeJSDoc:Z=!0,icons:q=[]}=X,U=S0("Type Definitions");if(U+=B1($,Z),U+=O1($,Z),q.length>0)U+=w1(q,Z);return U+=I1($,Y,Z),U+=R1($,Z),U}function _1($,X){let{includeJSDoc:Y=!0,icons:Z=[]}=X,q=S0("Token Constants"),U="TokenPaths, CSSVariableNames";if(Z.length>0)U+=", IconNames, IconCategories, Icon";if(q+=`import type { ${U} } from './tokens.types';
137
137
 
138
138
  `,q+=M1($,Y),q+=x1($,Y),Z.length>0)q+=N1(Z,Y);return q+=F1($,Y),q}function Q1($){let X=S0("Main Export");if($.some((Y)=>Y.type==="types"))X+=`export type * from './tokens.types';
139
139
  `;if($.some((Y)=>Y.type==="constants"))X+=`export * from './tokens.constants';
@@ -435,7 +435,7 @@ Build completed in ${Y.duration}ms`,$.verbose)}catch(Z){let q=Z instanceof Error
435
435
  Validating build output...`,$.verbose);let{validateCSSFiles:Z,printValidationResults:q}=await Promise.resolve().then(() => (e2(),o2)),U=Z($.outputDir,$.config);if($.verbose||!U.isValid)q(U);if(!U.isValid)Y.errors.push(...U.errors)}return Y}function q4($){let X=$.$metaData,Y=$.$modes?[...Object.values($.$modes)]:[];return{prefix:X.dsNamespace||X.tokenNamespace,namespace:X.tokenNamespace,generateModes:!0,modes:Y,generateDerivedTokens:!0,generateBreakpointTokens:!0,failOnBrokenReferences:!0,transformName:(Z)=>{let q=X.tokens?.css?.hooks?.shortenName;if(q?.enabled){let U=Z;if(q.prefix)for(let{find:K,replace:W}of q.prefix){let z=K.replace(/\./g,"-").replace(/-$/,""),G=W.replace(/\./g,"-").replace(/-$/,"");U=U.replace(z,G)}if(q.suffix){for(let{find:K,replace:W}of q.suffix)if(U.endsWith(K))U=U.substring(0,U.length-K.length)+W}return U}return Z}}}function XY($,X){let Y=$.$metaData,Z=Y.tokens?.css,q=$.$modes?[...Object.values($.$modes)]:["light","dark"],U=q.length>0?q[0]:"light",K=Y.modes?.isHost??!1;return{...X,separateThemeFiles:Z?.mediaQuery?.separateThemeFiles??!1,rootSelector:":root",generateMediaQueries:!0,customHeader:g$($),themeSelector:Z?.mediaQuery?.match||"[data-theme]",modes:q,defaultMode:U,isHost:K,hooks:Z?.hooks}}function U4($,X){let Y=$.$metaData;return{...X,tokenInterface:"DesignTokens",exportNamespace:Y.dsNamespace||Y.tokenNamespace,generateTypes:!0,generateConsts:!0,generateCSSVarMappings:!0,includeJSDoc:!0}}function W4($,X){let Y=$.$modes?[...Object.values($.$modes)]:["light","dark"];return{...X,modes:Y,typescript:!0,separateThemeFiles:!0,includeJSDoc:!1,moduleType:"es",customHeader:`/**
436
436
  * ${$.$name}
437
437
  * Generated: ${new Date().toISOString()}
438
- */`}}function K4($,X,Y){let Z=[],q=JSON.stringify({$schema:"https://schemas.designtokens.org/design-tokens.schema.json",$name:Y.$name,$version:Y.$version,tokens:X.reduce((W,z)=>{return W[z.name]={$type:z.type,$value:z.value,$description:z.description,$extensions:z.extensions},W},{})},null,2);Z.push({fileName:"tokens.raw.json",content:q});let U=JSON.stringify({$name:Y.$name,$version:Y.$version,tokens:$.reduce((W,z)=>{return W[z.name]={$type:z.type,$value:z.value,$description:z.description,cssVar:z.cssVar},W},{})},null,2);Z.push({fileName:"tokens.resolved.json",content:U});let K=JSON.stringify({$name:`${Y.$name} - CSS Variables`,$version:Y.$version,variables:$.reduce((W,z)=>{return W[z.cssVar]=z.value,W},{})},null,2);return Z.push({fileName:"css-variables.json",content:K}),Z}function l($,X){let Y=J$($);if(!v0(Y))n1(Y,{recursive:!0});a1($,X,"utf-8")}function M($,X){if(X!==!1)console.log($)}async function b0($,X){let Y=typeof globalThis.Bun<"u",Z=$,q=null;if($.endsWith(".ts")&&!Y){let{compileConfigFile:A,getDistConfigFile:L}=await Promise.resolve().then(() => (_$(),H2)),_=J$($);await A(_),Z=L(_),q=Z}let K=(await import(Z)).default,W=J$($),z=(A)=>{if(A.startsWith("../"))return b(W,A);return b(W,K.$paths.baseDir,A)},G=b(W,K.$paths.baseDir,K.$paths.tokensDir),E=X||z(K.$paths.distDir);try{return await d2({config:K,tokensDir:G,outputDir:E,verbose:!0})}finally{if(q){let{existsSync:A,unlinkSync:L}=await import("fs");if(A(q))try{L(q)}catch(_){}}}}var C0=P(()=>{l2();y$();t2();R0();D0();Q0()});C0();import{existsSync as z4}from"fs";import{resolve as A4}from"path";import{existsSync as f$,statSync as ZY}from"fs";import{resolve as qY}from"path";import{execSync as G4}from"child_process";async function UY($,X=!1){let Y=process.cwd(),Z=$||qY(Y,"designid.config.ts"),q=qY(Y,"designid.config.mjs");if(!f$(Z))return!1;if(!(!f$(q)||f$(Z)&&f$(q)&&ZY(Z).mtimeMs>ZY(q).mtimeMs)){if(X)console.log("✓ Config file is up to date");return!1}if(X)console.log("\uD83D\uDD04 Compiling config file...");try{if(G4(`bun build ${Z} --outfile ${q} --minify --target node --packages external --no-bundle`,{stdio:X?"inherit":"pipe"}),X)console.log(`✅ Config compiled successfully
438
+ */`}}function K4($,X,Y){let Z=[],q=JSON.stringify({$schema:"https://schemas.designtokens.org/design-tokens.schema.json",$name:Y.$name,$version:Y.$version,tokens:X.reduce((W,z)=>{return W[z.name]={$type:z.type,$value:z.value,$description:z.description,$extensions:z.extensions},W},{})},null,2);Z.push({fileName:"tokens.raw.json",content:q});let U=JSON.stringify({$name:Y.$name,$version:Y.$version,tokens:$.reduce((W,z)=>{return W[z.name]={$type:z.type,$value:z.value,$description:z.description,cssVar:z.cssVar},W},{})},null,2);Z.push({fileName:"tokens.resolved.json",content:U});let K=JSON.stringify({$name:`${Y.$name} - CSS Variables`,$version:Y.$version,variables:$.reduce((W,z)=>{return W[z.cssVar]=z.value,W},{})},null,2);return Z.push({fileName:"css-variables.json",content:K}),Z}function l($,X){let Y=J$($);if(!v0(Y))n1(Y,{recursive:!0});a1($,X,"utf-8")}function M($,X){if(X!==!1)console.log($)}async function b0($,X){let Y=typeof globalThis.Bun!=="undefined",Z=$,q=null;if($.endsWith(".ts")&&!Y){let{compileConfigFile:A,getDistConfigFile:L}=await Promise.resolve().then(() => (_$(),H2)),_=J$($);await A(_),Z=L(_),q=Z}let K=(await import(Z)).default,W=J$($),z=(A)=>{if(A.startsWith("../"))return b(W,A);return b(W,K.$paths.baseDir,A)},G=b(W,K.$paths.baseDir,K.$paths.tokensDir),E=X||z(K.$paths.distDir);try{return await d2({config:K,tokensDir:G,outputDir:E,verbose:!0})}finally{if(q){let{existsSync:A,unlinkSync:L}=await import("fs");if(A(q))try{L(q)}catch(_){}}}}var C0=P(()=>{l2();y$();t2();R0();D0();Q0()});C0();import{existsSync as z4}from"fs";import{resolve as A4}from"path";import{existsSync as f$,statSync as ZY}from"fs";import{resolve as qY}from"path";import{execSync as G4}from"child_process";async function UY($,X=!1){let Y=process.cwd(),Z=$||qY(Y,"designid.config.ts"),q=qY(Y,"designid.config.mjs");if(!f$(Z))return!1;if(!(!f$(q)||f$(Z)&&f$(q)&&ZY(Z).mtimeMs>ZY(q).mtimeMs)){if(X)console.log("✓ Config file is up to date");return!1}if(X)console.log("\uD83D\uDD04 Compiling config file...");try{if(G4(`bun build ${Z} --outfile ${q} --minify --target node --packages external --no-bundle`,{stdio:X?"inherit":"pipe"}),X)console.log(`✅ Config compiled successfully
439
439
  `);return!0}catch(K){if(console.error("❌ Failed to compile config file"),K instanceof Error)console.error(K.message);throw K}}function E4($){let X={};for(let Y=0;Y<$.length;Y++){let Z=$[Y];switch(Z){case"--config":case"-c":X.config=$[++Y];break;case"--input":case"-i":X.input=$[++Y];break;case"--output":case"-o":X.output=$[++Y];break;case"--verbose":case"-v":X.verbose=!0;break;case"--no-css":X.css=!1;break;case"--no-typescript":X.typescript=!1;break;case"--no-json":X.json=!1;break;case"--help":case"-h":X.help=!0;break;default:if(Z.startsWith("-"))console.warn(`Unknown option: ${Z}`);break}}return X}function L4(){console.log(`
440
440
  Design Tokens Builder - W3C compliant token processor
441
441
 
@@ -470,7 +470,7 @@ Token Files:
470
470
  - Include $type and $value properties
471
471
  - Support token references with {token.path} syntax
472
472
  - Support extensions for modes, generators, and breakpoints
473
- `)}function H4($){let X=[$,"./designid.config.ts","./designid.config.mjs","./designid.config.js","./tokens.config.ts","./tokens.config.js"].filter(Boolean);for(let Y of X){let Z=A4(Y);if(z4(Z))return Z}throw Error(`Config file not found. Tried: ${X.join(", ")}`)}async function _4(){let $=E4(process.argv.slice(2));if($.help){L4();return}try{await UY($.config,$.verbose);let X=H4($.config);console.log(`Using config: ${X}`);let Y=await b0(X,$.output);if(Y.errors.length>0)console.log(`
473
+ `)}function H4($){let X=[$,"./designid.config.ts","./designid.config.mjs","./designid.config.js","./tokens.config.ts","./tokens.config.js"].filter(Boolean);for(let Y of X){let Z=A4(Y);if(z4(Z))return Z}throw new Error(`Config file not found. Tried: ${X.join(", ")}`)}async function _4(){let $=E4(process.argv.slice(2));if($.help){L4();return}try{await UY($.config,$.verbose);let X=H4($.config);console.log(`Using config: ${X}`);let Y=await b0(X,$.output);if(Y.errors.length>0)console.log(`
474
474
  ❌ Build failed with ${Y.errors.length} error${Y.errors.length>1?"s":""}:`),Y.errors.forEach((Z)=>console.log(` - ${Z}`)),process.exit(1);if(console.log(`Processed ${Y.tokenCount} tokens`),console.log(`Duration: ${Y.duration}ms`),console.log(`Build completed successfully!
475
475
  `),Y.cssFiles.length>0)console.log(`
476
476
  Generated ${Y.cssFiles.length} CSS files:`),Y.cssFiles.forEach((Z)=>console.log(` - ${Z.fileName}`));if(Y.typescriptFiles.length>0)console.log(`