@thi.ng/meta-css 0.8.1 → 0.9.1

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/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2024-03-18T08:40:00Z
3
+ - **Last updated**: 2024-03-21T16:11:49Z
4
4
  - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
5
5
 
6
6
  All notable changes to this project will be documented in this file.
@@ -9,6 +9,14 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
9
9
  **Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
10
10
  and/or version bumps of transitive dependencies.
11
11
 
12
+ ## [0.9.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/meta-css@0.9.0) (2024-03-21)
13
+
14
+ #### 🚀 Features
15
+
16
+ - check for invalid template IDs ([ceb8bb2](https://github.com/thi-ng/umbrella/commit/ceb8bb2))
17
+ - add/update CSS specs/templates ([468877b](https://github.com/thi-ng/umbrella/commit/468877b))
18
+ - add CSS specs/templates, update readme ([febe609](https://github.com/thi-ng/umbrella/commit/febe609))
19
+
12
20
  ### [0.8.1](https://github.com/thi-ng/umbrella/tree/@thi.ng/meta-css@0.8.1) (2024-03-18)
13
21
 
14
22
  #### 🩹 Bug fixes
package/README.md CHANGED
@@ -62,6 +62,7 @@
62
62
  - [Line heights](#line-heights)
63
63
  - [Lists](#lists)
64
64
  - [Margin](#margin)
65
+ - [Mask](#mask)
65
66
  - [Max. height](#max-height)
66
67
  - [Max. width](#max-width)
67
68
  - [Min. height](#min-height)
@@ -86,11 +87,16 @@
86
87
  - [Templates by category](#templates-by-category)
87
88
  - [Animation / transition](#animation--transition)
88
89
  - [Aspect ratios](#aspect-ratios)
90
+ - [Background](#background)
89
91
  - [Border color](#border-color)
90
92
  - [Color adjustment](#color-adjustment)
91
93
  - [Color definitions](#color-definitions)
92
94
  - [Colors](#colors)
95
+ - [Dimensions](#dimensions)
93
96
  - [Grid layout](#grid-layout)
97
+ - [Margin](#margin)
98
+ - [Mask](#mask)
99
+ - [Padding](#padding)
94
100
  - [Positions](#positions)
95
101
  - [Svg](#svg)
96
102
  - [Media queries](#media-queries)
@@ -967,7 +973,7 @@ These are readily usable (and used by a growing number of example projects in
967
973
  this repo), but also are provided as starting point to define your own custom
968
974
  framework(s)...
969
975
 
970
- Currently, there are 862 CSS utility classes (incl. 29 templates) defined in "MetaCSS base" (v0.8.0):
976
+ Currently, there are 932 CSS utility classes (incl. 61 templates) defined in "MetaCSS base" (v0.8.0):
971
977
 
972
978
  ### Classes by category
973
979
 
@@ -989,6 +995,17 @@ Currently, there are 862 CSS utility classes (incl. 29 templates) defined in "Me
989
995
  - `anim-pause`
990
996
  - `anim-play`
991
997
  - `anim-reverse` (direction)
998
+ - `transition-all` (all)
999
+ - `transition-bg` (background-color)
1000
+ - `transition-color` (color)
1001
+ - `transition-ease` (timing function)
1002
+ - `transition-ease-in` (timing function)
1003
+ - `transition-ease-in-out` (timing function)
1004
+ - `transition-ease-out` (timing function)
1005
+ - `transition-height` (height)
1006
+ - `transition-linear` (timing function)
1007
+ - `transition-none` (none)
1008
+ - `transition-width` (width)
992
1009
 
993
1010
  #### Aspect ratios
994
1011
 
@@ -1007,6 +1024,12 @@ Currently, there are 862 CSS utility classes (incl. 29 templates) defined in "Me
1007
1024
  - `bg-pos-se` (bottom right)
1008
1025
  - `bg-pos-sw` (bottom left)
1009
1026
  - `bg-pos-w` (left)
1027
+ - `bg-repeat` (repeat)
1028
+ - `bg-repeat-none` (no-repeat)
1029
+ - `bg-repeat-round` (round)
1030
+ - `bg-repeat-space` (space)
1031
+ - `bg-repeat-x` (repeat-x)
1032
+ - `bg-repeat-y` (repeat-y)
1010
1033
 
1011
1034
  #### Border color
1012
1035
 
@@ -1262,7 +1285,11 @@ Currently, there are 862 CSS utility classes (incl. 29 templates) defined in "Me
1262
1285
 
1263
1286
  - `align-content-center`
1264
1287
  - `align-content-end`
1288
+ - `align-content-space-around`
1289
+ - `align-content-space-between`
1290
+ - `align-content-space-evenly`
1265
1291
  - `align-content-start`
1292
+ - `align-content-stretch`
1266
1293
  - `flex-column`
1267
1294
  - `flex-column-reverse`
1268
1295
  - `flex-grow0`
@@ -1276,7 +1303,11 @@ Currently, there are 862 CSS utility classes (incl. 29 templates) defined in "Me
1276
1303
  - `flex-wrap-reverse`
1277
1304
  - `justify-content-center`
1278
1305
  - `justify-content-end`
1306
+ - `justify-content-space-around`
1307
+ - `justify-content-space-between`
1308
+ - `justify-content-space-evenly`
1279
1309
  - `justify-content-start`
1310
+ - `justify-content-stretch`
1280
1311
 
1281
1312
  #### Font families
1282
1313
 
@@ -1493,6 +1524,22 @@ Currently, there are 862 CSS utility classes (incl. 29 templates) defined in "Me
1493
1524
  - `mv4` (top 2rem)
1494
1525
  - `mv5` (top 4rem)
1495
1526
 
1527
+ #### Mask
1528
+
1529
+ - `mask-clip-border` (border-box)
1530
+ - `mask-clip-content` (content-box)
1531
+ - `mask-clip-fill` (fill-box)
1532
+ - `mask-clip-none` (no-clip)
1533
+ - `mask-clip-padding` (padding-box)
1534
+ - `mask-clip-stroke` (stroke-box)
1535
+ - `mask-clip-view` (view-box)
1536
+ - `mask-mode-alpha` (alpha)
1537
+ - `mask-mode-luminance` (luminance)
1538
+ - `mask-mode-match-source` (match-source)
1539
+ - `mask-type-alpha` (alpha)
1540
+ - `mask-type-luminance` (luminance)
1541
+ - `mask-type-match-source` (match-source)
1542
+
1496
1543
  #### Max. height
1497
1544
 
1498
1545
  - `maxh1` (1rem)
@@ -1943,17 +1990,27 @@ Currently, there are 862 CSS utility classes (incl. 29 templates) defined in "Me
1943
1990
 
1944
1991
  #### Animation / transition
1945
1992
 
1993
+ ##### `anim(body)`
1994
+
1995
+ - **body**: CSS value/definition
1996
+
1946
1997
  ##### `anim-delay(delay)`
1947
1998
 
1948
1999
  - **delay**: time (in seconds)
1949
2000
 
2001
+ ##### `anim-duration(duration)`
2002
+
2003
+ - **duration**: time (in seconds)
2004
+
1950
2005
  ##### `anim-iter(iter)`
1951
2006
 
1952
2007
  - **iter**: number of iterations
1953
2008
 
1954
- ##### `anim-steps(steps)`
2009
+ ##### `anim-steps(num)`
2010
+
2011
+ - **num**: number of steps
1955
2012
 
1956
- - **steps**: number of steps
2013
+ Sets animation-timing-function to `steps(num)`
1957
2014
 
1958
2015
  ##### `bg-anim(duration)`
1959
2016
 
@@ -1986,6 +2043,28 @@ Animation which shrinks the height from given initial value to zero. Target elem
1986
2043
 
1987
2044
  Animation which rotates element a full turn, looping indefinitely
1988
2045
 
2046
+ ##### `transition(body)`
2047
+
2048
+ - **body**: CSS value/definition
2049
+
2050
+ ##### `transition-delay(delay)`
2051
+
2052
+ - **delay**: time (in seconds)
2053
+
2054
+ ##### `transition-duration(duration)`
2055
+
2056
+ - **duration**: time (in seconds)
2057
+
2058
+ ##### `transition-property(prop)`
2059
+
2060
+ - **prop**: CSS value/definition
2061
+
2062
+ ##### `transition-steps(num)`
2063
+
2064
+ - **num**: number of steps
2065
+
2066
+ Sets transition-timing-function to `steps(num)`
2067
+
1989
2068
  #### Aspect ratios
1990
2069
 
1991
2070
  ##### `aspect-ratio(width, height)`
@@ -2002,6 +2081,24 @@ Sets `aspect-ratio` CSS property
2002
2081
 
2003
2082
  Sets aspect ratio of background. Use with `bg-aspect-ratio-object` on child element.
2004
2083
 
2084
+ #### Background
2085
+
2086
+ ##### `bg-blur(radius)`
2087
+
2088
+ - **radius**: incl. units
2089
+
2090
+ ##### `bg-image(url)`
2091
+
2092
+ - **url**: image URL
2093
+
2094
+ ##### `bg-pos(body)`
2095
+
2096
+ - **body**: CSS value/definition
2097
+
2098
+ ##### `bg-size(body)`
2099
+
2100
+ - **body**: CSS value/definition
2101
+
2005
2102
  #### Border color
2006
2103
 
2007
2104
  ##### `border-color(name)`
@@ -2106,6 +2203,44 @@ Defines a rgb() color variable with given name and additional derived vars for e
2106
2203
 
2107
2204
  - **name**: variable name (without `--` prefix)
2108
2205
 
2206
+ #### Dimensions
2207
+
2208
+ ##### `height(height)`
2209
+
2210
+ - **height**: incl. units
2211
+
2212
+ Sets height to given value
2213
+
2214
+ ##### `max-height(height)`
2215
+
2216
+ - **height**: incl. units
2217
+
2218
+ Sets max-height to given value
2219
+
2220
+ ##### `max-width(width)`
2221
+
2222
+ - **width**: incl. units
2223
+
2224
+ Sets max-width to given value
2225
+
2226
+ ##### `min-height(height)`
2227
+
2228
+ - **height**: incl. units
2229
+
2230
+ Sets min-height to given value
2231
+
2232
+ ##### `min-width(width)`
2233
+
2234
+ - **width**: incl. units
2235
+
2236
+ Sets min-width to given value
2237
+
2238
+ ##### `width(width)`
2239
+
2240
+ - **width**: incl. units
2241
+
2242
+ Sets width to given value
2243
+
2109
2244
  #### Grid layout
2110
2245
 
2111
2246
  ##### `grid-cols(cols)`
@@ -2116,6 +2251,100 @@ Defines a rgb() color variable with given name and additional derived vars for e
2116
2251
 
2117
2252
  - **rows**: CSS rows definitions
2118
2253
 
2254
+ #### Margin
2255
+
2256
+ ##### `ma(size)`
2257
+
2258
+ - **size**: incl. units
2259
+
2260
+ Sets margin to custom size
2261
+
2262
+ ##### `mb(size)`
2263
+
2264
+ - **size**: incl. units
2265
+
2266
+ Sets margin to custom size
2267
+
2268
+ ##### `mh(size)`
2269
+
2270
+ - **size**: incl. units
2271
+
2272
+ Sets margin to custom size
2273
+
2274
+ ##### `ml(size)`
2275
+
2276
+ - **size**: incl. units
2277
+
2278
+ Sets margin to custom size
2279
+
2280
+ ##### `mr(size)`
2281
+
2282
+ - **size**: incl. units
2283
+
2284
+ Sets margin to custom size
2285
+
2286
+ ##### `mt(size)`
2287
+
2288
+ - **size**: incl. units
2289
+
2290
+ Sets margin to custom size
2291
+
2292
+ ##### `mv(size)`
2293
+
2294
+ - **size**: incl. units
2295
+
2296
+ Sets margin to custom size
2297
+
2298
+ #### Mask
2299
+
2300
+ ##### `mask-image(body)`
2301
+
2302
+ - **body**: definition (e.g. url or gradient)
2303
+
2304
+ #### Padding
2305
+
2306
+ ##### `pa(size)`
2307
+
2308
+ - **size**: incl. units
2309
+
2310
+ Sets padding to custom size
2311
+
2312
+ ##### `pb(size)`
2313
+
2314
+ - **size**: incl. units
2315
+
2316
+ Sets padding to custom size
2317
+
2318
+ ##### `ph(size)`
2319
+
2320
+ - **size**: incl. units
2321
+
2322
+ Sets padding to custom size
2323
+
2324
+ ##### `pl(size)`
2325
+
2326
+ - **size**: incl. units
2327
+
2328
+ Sets padding to custom size
2329
+
2330
+ ##### `pr(size)`
2331
+
2332
+ - **size**: incl. units
2333
+
2334
+ Sets padding to custom size
2335
+
2336
+ ##### `pt(size)`
2337
+
2338
+ - **size**: incl. units
2339
+
2340
+ Sets padding to custom size
2341
+
2342
+ ##### `pv(size)`
2343
+
2344
+ - **size**: incl. units
2345
+
2346
+ Sets padding to custom size
2347
+
2119
2348
  #### Positions
2120
2349
 
2121
2350
  ##### `bottom(coordinate)`
@@ -2176,7 +2405,7 @@ distributed as CLI bundle with **no runtime dependencies**. The following
2176
2405
  dependencies are only shown for informational purposes and are (partially)
2177
2406
  included in the bundle.
2178
2407
 
2179
- Package sizes (brotli'd, pre-treeshake): ESM: 12.83 KB
2408
+ Package sizes (brotli'd, pre-treeshake): ESM: 12.85 KB
2180
2409
 
2181
2410
  ## Dependencies
2182
2411
 
package/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  // @bun
2
- var r1={default:95,hint:90,multi:90,param:96,required:33};var c1=(Z)=>Z;var s=function(Z,X){return!X&&(X={}),(...J)=>{const W=JSON.stringify(J);if(W!==void 0)return W in X?X[W]:X[W]=Z.apply(null,J);return Z.apply(null,J)}};var e=s((Z,X)=>Z.repeat(X));var T0=(Z)=>/^[a-f0-9]+$/i.test(Z);var b0=(Z)=>/^[-+]?\d+$/.test(Z),I0=(Z)=>/^[-+]?\d*\.?\d+(e[-+]?\d+)?$/i.test(Z);var E=(Z,X=(J)=>J!==void 0?": "+J:"")=>class extends Error{origMessage;constructor(J){super(Z(J)+X(J));this.origMessage=J!==void 0?String(J):""}};var B5=E(()=>"illegal argument(s)"),$=(Z)=>{throw new B5(Z)};var s1=(Z)=>I0(Z)?parseFloat(Z):$(`not a numeric value: ${Z}`),R0=(Z)=>Z.map(s1),e1=(Z)=>T0(Z)?parseInt(Z,16):$(`not a hex value: ${Z}`),E0=(Z)=>Z.map(e1),Z0=(Z)=>b0(Z)?parseInt(Z):$(`not an integer: ${Z}`),L0=(Z)=>Z.map(Z0);var G1=(Z,X)=>(J)=>({coerce:Z,hint:X,group:"main",...J}),k1=(Z,X)=>(J)=>({hint:Y5(X,J.delim),multi:!0,coerce:Z,group:"main",...J}),Y5=(Z,X)=>Z+(X?`[${X}..]`:""),I=(Z)=>({flag:!0,default:!1,group:"flags",...Z}),d=G1(c1,"STR"),T1=k1(c1,"STR"),u8=G1(s1,"NUM"),g8=G1(e1,"HEX"),S0=G1(Z0,"INT"),x8=k1(R0,"NUM"),d8=k1(E0,"HEX"),n8=k1(L0,"INT");var w=((Z)=>{return Z[Z.FINE=0]="FINE",Z[Z.DEBUG=1]="DEBUG",Z[Z.INFO=2]="INFO",Z[Z.WARN=3]="WARN",Z[Z.SEVERE=4]="SEVERE",Z[Z.NONE=5]="NONE",Z})(w||{});var z5=0;class $1{constructor(Z,X=w.FINE,J){this.parent=J,this.id=Z||`logger-${z5++}`,this.level=typeof X==="string"?w[X]:X}id;level;addChild(Z){return Z.parent=this,Z}enabled(Z){return this.level<=Z}fine(...Z){this.log(w.FINE,Z)}debug(...Z){this.log(w.DEBUG,Z)}info(...Z){this.log(w.INFO,Z)}warn(...Z){this.log(w.WARN,Z)}severe(...Z){this.log(w.SEVERE,Z)}log(Z,X){this.level<=Z&&this.logEntry([Z,this.id,Date.now(),...X])}}var A0=(Z)=>Z.map((X)=>{if(typeof X==="function")X=X();if(!(typeof X==="string"||typeof X==="number"))X=JSON.stringify(X);return X}).join(" ");class b1 extends $1{constructor(Z,X,J,W){super(X,J,W);this.target=Z}childLogger(Z,X){return new b1(this.target,Z,X??this.level,this)}logEntry(Z){if(Z[0]<this.level)return;this.target.write(`[${w[Z[0]]}] ${Z[1]}: ${A0(Z.slice(3))}
3
- `),this.parent&&this.parent.logEntry(Z)}}var I1=s((Z,X=" ")=>{const J=e(String(X),Z);return(W,B)=>{if(W==null)return J;return W=W.toString(),B=B!==void 0?B:W.length,B<Z?W+J.substring(B):W}});var v0=(Z,X)=>{return!X&&(X=new Map),(J)=>{let W;return X.has(J)?X.get(J):(X.set(J,W=Z(J)),W)}};var X0={black:1,blue:5,cyan:7,gray:17,green:3,magenta:6,red:2,white:24,yellow:4,lightBlue:21,lightCyan:23,lightGray:8,lightGreen:19,lightMagenta:22,lightRed:18,lightYellow:20,bgBlack:32,bgBlue:160,bgCyan:224,bgGray:544,bgGreen:96,bgMagenta:192,bgRed:64,bgWhite:768,bgYellow:128,bgLightBlue:672,bgLightCyan:736,bgLightGray:256,bgLightGreen:608,bgLightMagenta:704,bgLightRed:576,bgLightYellow:640};var Q5=(Z,X)=>(J)=>Z.format(X,J),J0=(Z)=>Object.keys(X0).reduce((X,J)=>(X[J]=Q5(Z,X0[J]),X),{format:Z});var _0="\x1B[0m";var V5=["","1","2","1;2","4","1;4","2;4","1;2;4"],R1={format:(Z,X)=>R1.start(Z)+X+R1.end,start:v0((Z)=>{let X=[],J=Z&15;return J&&X.push(29+(Z>>4&1)*60+J),J=Z>>5&15,J&&X.push(39+(Z>>9&1)*60+J),J=Z>>10,J&&X.push(V5[J]),"\x1B["+X.join(";")+"m"}),end:_0,prefix:_0,suffix:"\n"};var y0={format:(Z,X)=>String(X),prefix:"",suffix:"\n",start:()=>"",end:""};var E1=J0(R1),h0=J0(y0);var O=Array.isArray;var U5=(Z)=>Z.toUpperCase(),m0=(Z)=>Z.toLowerCase(),f0=(Z)=>Z.length?Z[0].toUpperCase()+Z.substring(1):Z,u0=(Z,X="-")=>m0(Z.replace(/([a-z0-9\u00e0-\u00fd])([A-Z\u00c0-\u00dd])/g,(J,W,B)=>W+X+B));var g0=(Z,X="-")=>m0(Z).replace(new RegExp(`\\${X}+(\\w)`,"g"),(J,W)=>U5(W));var x0=Object.getPrototypeOf,L=(Z)=>{let X;return Z!=null&&typeof Z==="object"&&((X=x0(Z))===null||x0(X)===null)};var q5=/\x1b\[[0-9;]+m/g,K5=(Z)=>Z.replace(q5,"");var L1=(Z)=>K5(Z).length;var d0=(Z=!1,X)=>(J)=>Z||typeof J!=="string"&&typeof J!=="number"?JSON.stringify(J,null,X):String(J);function*Z1(Z,X=/\r?\n/g,J=!1){let W=0;const B=Z.length,Y=~~J;let Q;if(typeof X==="string")Q=new RegExp(X,"g");else if(!X.flags.includes("g"))Q=new RegExp(X,X.flags+"g");else Q=X;for(;W<B;){const z=Q.exec(Z);if(!z){yield Z.substring(W);return}const V=z[0].length;yield Z.substring(W,z.index+Y*V),W=z.index+V}}class W0{n=0;w=[];constructor(Z,X){Z!=null&&this.add(Z,X)}add(Z,X=Z.length){return this.w.push(Z),this.n+=X+~~(this.n>0),this}toString(){return this.w.join(" ")}}var H5={length:(Z)=>Z.length,split:(Z,X)=>X},l0={length:L1,split:(Z,X)=>{const J=/\x1b\[[0-9;]+m/g;let W=X,B;while(B=J.exec(Z)){if(B.index>=X)break;const Y=B[0].length;W+=Y,X+=Y}return W}},n0=(Z,X,J,W)=>{const B=Z[Z.length-1];B&&W-B.n>J?B.add(X,J):Z.push(new W0(X,J))},$5=(Z,{width:X,min:J,hard:W,splitter:B},Y=0,Q=[])=>{let z=B.length(Z),V=X-Y;if(V<J&&V<z)V=X;while(W&&z>V){const U=B.split(Z,V),q=Z.substring(0,U);n0(Q,q,V,X),Z=Z.substring(U),V=X,z=B.length(Z)}return n0(Q,Z,z,X),Q},C5=(Z,X,J=[])=>{if(!Z.length)return J.push(new W0),J;const W={width:80,min:4,hard:!1,splitter:H5,...X};for(let B of Z1(Z,X.delimWord||/\s/g)){const Y=J[J.length-1];$5(B,W,Y&&Y.n>0?Y.n+1:0,J)}return J},p0=(Z,X)=>{let J=[];for(let W of Z1(Z,X.delimLine))J=J.concat(C5(W,X));return J};var C1=(Z,X={})=>{X={lineWidth:80,paramWidth:32,showDefaults:!0,prefix:"",suffix:"",groups:["flags","main"],...X};const J=L(X.color)?{...r1,...X.color}:X.color?r1:{},W=e(" ",X.paramWidth),B=(z)=>z.map((V)=>M5(V,Z[V],X,J,W)),Y=Object.keys(Z).sort(),Q=X.groups?X.groups.map((z)=>[z,Y.filter((V)=>Z[V].group===z)]).filter((z)=>!!z[1].length):[["options",Y]];return[...B0(X.prefix,X.lineWidth),...Q.map(([z,V])=>[...X.showGroupNames?[`${f0(z)}:
4
- `]:[],...B(V),""].join("\n")),...B0(X.suffix,X.lineWidth)].join("\n")},M5=(Z,X,J,W,B)=>{const Y=F5(X,W),Q=w5(X,W,Y),z=M1(`--${u0(Z)}`,W.param),V=`${Q}${z}${Y}`,U=X.optional===!1&&X.default===void 0,q=[];U&&q.push("required"),X.multi&&q.push("multiple");const K=P5(q,W,U)+(X.desc||"")+O5(X,J,W);return I1(J.paramWidth)(V,L1(V))+B0(K,J.lineWidth-J.paramWidth).map((H,F)=>F>0?B+H:H).join("\n")},F5=(Z,X)=>Z.hint?M1(" "+Z.hint,X.hint):"",w5=(Z,X,J)=>Z.alias?`${M1("-"+Z.alias,X.param)}${J}, `:"",P5=(Z,X,J)=>Z.length?M1(`[${Z.join(", ")}] `,J?X.required:X.multi):"",O5=(Z,X,J)=>X.showDefaults&&Z.default!=null&&Z.default!==!1?M1(` (default: ${d0(!0)(Z.defaultHint!=null?Z.defaultHint:Z.default)})`,J.default):"",M1=(Z,X)=>X!=null?`\x1B[${X}m${Z}\x1B[0m`:Z,B0=(Z,X)=>Z?p0(Z,{width:X,splitter:l0,hard:!1}):[];var N5=E(()=>"parse error"),o0=(Z,X,J)=>{J={start:2,showUsage:!0,help:["--help","-h"],...J};try{return j5(Z,X,J)}catch(W){if(J.showUsage)console.log(W.message+"\n\n"+C1(Z,J.usageOpts));throw new N5(W.message)}},j5=(Z,X,J)=>{const W=D5(Z),B={};let Y,Q,z=J.start;for(;z<X.length;){const V=X[z];if(!Y){if(J.help.includes(V)){console.log(C1(Z,J.usageOpts));return}const U=G5(Z,W,B,V);if(Y=U.id,Q=U.spec,z=z+~~(U.state<2),U.state)break}else{if(k5(Q,B,Y,V))break;Y=null,z++}}return Y&&$(`missing value for: --${Y}`),{result:T5(Z,B),index:z,rest:X.slice(z),done:z>=X.length}},D5=(Z)=>Object.entries(Z).reduce((X,[J,W])=>W.alias?(X[W.alias]=J,X):X,{}),G5=(Z,X,J,W)=>{if(W[0]==="-"){let B;if(W[1]==="-"){if(W==="--")return{state:1};B=g0(W.substring(2))}else B=X[W.substring(1)],!B&&$(`unknown option: ${W}`);const Y=Z[B];if(!Y&&$(B),Y.flag){if(J[B]=!0,B=void 0,Y.fn&&!Y.fn("true"))return{state:1,spec:Y}}return{state:0,id:B,spec:Y}}return{state:2}},k5=(Z,X,J,W)=>{if(/^-[a-z]/i.test(W)&&$(`missing value for: --${J}`),Z.multi)O(X[J])?X[J].push(W):X[J]=[W];else X[J]=W;return Z.fn&&!Z.fn(W)},T5=(Z,X)=>{let J;for(let W in Z)if(J=Z[W],X[W]===void 0){if(J.default!==void 0)X[W]=J.default;else if(J.optional===!1)$(`missing arg: --${W}`)}else if(J.coerce)b5(J,X,W);return X},b5=(Z,X,J)=>{try{if(Z.multi&&Z.delim)X[J]=X[J].reduce((W,B)=>(W.push(...B.split(Z.delim)),W),[]);X[J]=Z.coerce(X[J])}catch(W){throw new Error(`arg --${J}: ${W.message}`)}};var a0=async(Z)=>{const X=Z.argv||process.argv,J=!process.env.NO_COLOR,W={prefix:"",color:J,...Z.usage};try{let B,Y,Q=Z.start??2;if(Z.single){if(B=Object.keys(Z.commands)[0],!B)$("no command provided");Y=Z.commands[B]}else{if(B=X[Q],Y=Z.commands[B],W.prefix+=I5(Z.commands),!Y)i0(Z,W);Q++}let z;try{z=o0({...Z.opts,...Y.opts},X,{showUsage:!0,usageOpts:W,start:Q})}catch(U){}if(!z)process.exit(1);if(Y.inputs!==void 0&&Y.inputs!==z.rest.length)process.stderr.write(`expected ${Y.inputs||0} input(s)
5
- `),i0(Z,W);const V=await Z.ctx({logger:new b1(process.stderr,Z.name,"INFO"),format:J?E1:h0,opts:z.result,inputs:z.rest},Y);if(await Y.fn(V),Z.post)await Z.post(V,Y)}catch(B){process.stderr.write(B.message+"\n\n"),process.exit(1)}},i0=(Z,X)=>{process.stderr.write(C1(Z.opts,X)),process.exit(1)},I5=(Z)=>["\nAvailable commands:\n",...Object.keys(Z).map((X)=>`${I1(16)(X)}: ${Z[X].desc}`),"\n"].join("\n");import{existsSync as R5,mkdirSync as E5,statSync as pZ} from"fs";import{dirname as L5} from"path";var S5=(Z)=>Z.length>0&&!R5(Z)?(E5(Z,{recursive:!0}),!0):!1,t0=(Z)=>S5(L5(Z));var v=(Z)=>typeof Z==="function";var M=(Z)=>typeof Z==="string";import{readFileSync as v5} from"fs";import{writeFileSync as A5} from"fs";var r0=(Z,X,J,W,B=!1)=>{if(W&&W.info(`${B?"[dryrun] ":""}writing file: ${Z}`),B)return;t0(Z),A5(Z,X,!J&&M(X)?"utf-8":J)};var N=(Z,X,J="utf-8")=>{return X&&X.debug("reading file:",Z),v5(Z,J)},Y0=(Z,X,J,W=!1)=>r0(Z,O(X)?X.join("\n"):X,"utf-8",J,W);var n=(Z,X)=>JSON.parse(N(Z,X));var y=Symbol(),z0=()=>{};var F1=Object.freeze({level:w.NONE,addChild(Z){return Z},childLogger:()=>F1,enabled:()=>!1,fine(){},debug(){},info(){},warn(){},severe(){},logEntry(){}});class Q0 extends $1{set(Z){this.parent=Z}childLogger(Z,X){return new Q0(Z,X??this.level,this)}logEntry(Z){this.parent.logEntry(Z)}}var c0=new Q0("root",w.FINE,F1);import{join as w8} from"path";var _5=E(()=>"Assertion failed"),S1=(typeof process!=="undefined"&&process.env!==void 0?!0:import.meta.env?import.meta.env.MODE!=="production"||!!import.meta.env.UMBRELLA_ASSERTS||!!import.meta.env.VITE_UMBRELLA_ASSERTS:!0)?(Z,X)=>{if(typeof Z==="function"&&!Z()||!Z)throw new _5(typeof X==="function"?X():X)}:()=>{};var A1=(Z)=>Z!=null&&typeof Z!=="function"&&Z.length!==void 0;var s0=(Z)=>{return(Z==null||!Z[Symbol.iterator])&&$(`value is not iterable: ${Z}`),Z};var e0=(Z)=>A1(Z)?Z:[...s0(Z)];var w1=(Z)=>Z[Z.length-1];var y5=E(()=>"illegal arity"),X1=(Z)=>{throw new y5(Z)};var h5=E(()=>"illegal state"),J1=(Z)=>{throw new h5(Z)};var v1=(Z,X)=>Z!=null&&typeof Z[X]==="function";var T=(Z)=>Z!=null&&typeof Z[Symbol.iterator]==="function";var _1=(Z)=>Z!=null&&typeof Z!=="string"&&typeof Z[Symbol.iterator]==="function";var Z4=["-moz-","-ms-","-o-","-webkit-"],l={rules:"",ruleSep:",",valSep:"",decls:"",declStart:"{",declEnd:"}",indent:"",comments:!1},P1={rules:"\n",ruleSep:", ",valSep:" ",decls:"\n",declStart:" {\n",declEnd:"}\n",indent:" ",comments:!0};var V0=function(...Z){let[X,J,W,B,Y,Q,z,V,U,q]=Z;switch(Z.length){case 0:X1(0);case 1:return X;case 2:return(...H)=>X(J(...H));case 3:return(...H)=>X(J(W(...H)));case 4:return(...H)=>X(J(W(B(...H))));case 5:return(...H)=>X(J(W(B(Y(...H)))));case 6:return(...H)=>X(J(W(B(Y(Q(...H))))));case 7:return(...H)=>X(J(W(B(Y(Q(z(...H)))))));case 8:return(...H)=>X(J(W(B(Y(Q(z(V(...H))))))));case 9:return(...H)=>X(J(W(B(Y(Q(z(V(U(...H)))))))));case 10:default:const K=(...H)=>X(J(W(B(Y(Q(z(V(U(q(...H))))))))));return Z.length===10?K:V0(K,...Z.slice(10))}};var p=(Z)=>v1(Z,"xform")?Z.xform():Z;var h=function(...Z){return Z=Z.map(p),V0.apply(null,Z)};var W1=(Z,X)=>[Z[0],Z[1],X];class U0{value;constructor(Z){this.value=Z}deref(){return this.value}}var b=(Z)=>Z instanceof U0;var m=(Z)=>Z instanceof U0?Z.deref():Z;var y1=function(...Z){const X=Z[0],J=X[0],W=X[1],B=X[2];Z=m5(Z);const Y=Z[0]==null?J():Z[0],Q=Z[1];return m(W(v1(Q,"$reduce")?Q.$reduce(B,Y):A1(Q)?f5(B,Y,Q):u5(B,Y,Q)))};var m5=(Z)=>Z.length===2?[void 0,Z[1]]:Z.length===3?[Z[1],Z[2]]:X1(Z.length),f5=(Z,X,J)=>{for(let W=0,B=J.length;W<B;W++)if(X=Z(X,J[W]),b(X)){X=X.deref();break}return X},u5=(Z,X,J)=>{for(let W of J)if(X=Z(X,W),b(X)){X=X.deref();break}return X},B1=(Z,X)=>[Z,(J)=>J,X];var h1=function(Z){return Z?[...Z]:B1(()=>[],(X,J)=>(X.push(J),X))};function*m1(Z,X){const J=p(Z)(h1()),W=J[1],B=J[2];for(let Y of X){const Q=B([],Y);if(b(Q)){yield*m(W(Q.deref()));return}if(Q.length)yield*Q}yield*m(W([]))}function*o(Z,X){const J=p(Z)([z0,z0,(W,B)=>B])[2];for(let W of X){let B=J(y,W);if(b(B)){if(B=m(B.deref()),B!==y)yield B;return}if(B!==y)yield B}}var f1=(Z,X,J=o)=>{const W=X.length-1;return T(X[W])?X.length>1?J(Z.apply(null,X.slice(0,W)),X[W]):J(Z(),X[0]):void 0};var q0=function(Z,X){return T(X)?m1(q0(Z),M(X)?[X]:X):(J)=>{const W=J[2],B=(Y,Q)=>{const z=Z(Q);if(z){for(let V of z)if(Y=B(Y,V),b(Y))break;return Y}return W(Y,Q)};return W1(J,B)}};var X4=function(Z){return q0((X)=>_1(X)?X:void 0,Z)};var P=function(Z,X){return T(X)?o(P(Z),X):(J)=>{const W=J[2];return W1(J,(B,Y)=>W(B,Z(Y)))}};function*u1(...Z){const X=Z.length-1;if(X<0)return;const J=new Array(X+1).fill(0),W=Z.map(e0),B=W.reduce((Y,Q)=>Y*Q.length,1);for(let Y=0;Y<B;Y++){const Q=[];for(let z=X;z>=0;z--){const V=W[z];let U=J[z];if(U===V.length)J[z]=U=0,z>0&&J[z-1]++;Q[z]=V[U]}J[X]++,yield Q}}function*J4(Z,X=Infinity){while(X-- >0)yield Z}var K0=function(Z,X){Z=Z||"";let J=!0;return X?[...X].join(Z):B1(()=>"",(W,B)=>(W=J?W+B:W+Z+B,J=!1,W))};var g1=function(...Z){return g5(g1,y1,Z)};var g5=(Z,X,J)=>{let W,B;switch(J.length){case 4:B=J[3],W=J[2];break;case 3:B=J[2];break;case 2:return P((Y)=>Z(J[0],J[1],Y));default:X1(J.length)}return X(p(J[0])(J[1]),W,B)};var x5=new Set,d5=":[",W4=h(X4(),P((Z)=>d5.indexOf(Z.charAt(0))>=0?Z:" "+Z)),n5=(Z,X)=>h(Z,P((J)=>M(J)&&J.indexOf(" .")==0?J+X:J)),Y1=(Z,X,J,W)=>{const B=J.length,Y=[];let Q,z;const V=(U,q)=>{let K=null;if(O(q))Y1(Z,H0(X,Y),q,W);else if(T(q)&&!M(q))Y1(Z,H0(X,Y),[...q],W);else if((z=v(q))||(K=W.fns[q]))if(!X.length){if(K)return K.apply(null,J.slice(U+1))(Z,W),!0;q(Z,W)}else if(z)V(U,q());else $(`quoted fn ('${q}') only allowed at head position`);else if(L(q))Q=Object.assign(Q||{},q);else if(q!=null)Y.push(q)};for(let U=0;U<B;U++)if(V(U,J[U]))return Z;return Q&&Z.push(l5(X,Y,Q,W)),Z},H0=(Z,X)=>Z.length?[...u1(Z,X)]:X,l5=(Z,X,J,W)=>{const B=W.format,Y=S(W),Q=W.scope?n5(W4,W.scope):W4;return[Y,g1(P((z)=>g1(Q,K0(),O(z)?z:[z]).trim()),K0(B.ruleSep),H0(Z,X)),B.declStart,O1(J,W),Y,B.declEnd].join("")},O1=(Z,X)=>{const J=X.format,W=X.autoprefix||x5,B=S(X,X.depth+1),Y=[];for(let Q in Z)if(Z.hasOwnProperty(Q)){let z=Z[Q];if(v(z))z=z(Z);if(O(z))z=z.map((V)=>O(V)?V.join(" "):V).join(J.ruleSep);if(W.has(Q))for(let V of X.vendors)Y.push(`${B}${V}${Q}:${J.valSep}${z};`);Y.push(`${B}${Q}:${J.valSep}${z};`)}return Y.join(J.decls)+J.decls},S=(Z,X=Z.depth)=>X>1?[...J4(Z.format.indent,X)].join(""):X>0?Z.format.indent:"";var B4=function(Z,...X){const J=X.length===1?X[0]:X.reduce((W,B,Y)=>{return W[Y/(X.length-1)*100|0]=B,W},{});return(W,B)=>{const Y=S(B);B.depth++;const Q=S(B);W.push(`${Y}@keyframes ${Z}${B.format.declStart}`);for(let z in J)if(J.hasOwnProperty(z))W.push([Q,z+"%",B.format.declStart,O1(J[z],B),Q,B.format.declEnd].join(""));return B.depth--,W.push(Y+B.format.declEnd),W}};var Y4=(Z,X=!1)=>(J,W)=>{const B=S(W),Y=S(W,W.depth+1);if(W.format.comments||X)J.push(B+"/*",Z.split("\n").map((Q)=>Y+Q).join("\n"),B+"*/");return J};var x1=(Z,X,J)=>(W,B)=>{const Y=S(B);return W.push(`${Y}${Z} ${p5(X)}${B.format.declStart}`),B.depth++,Y1(W,[],J,B),B.depth--,W.push(Y+B.format.declEnd),W},p5=(Z)=>{if(M(Z))return Z;const X=[];for(let J in Z)if(Z.hasOwnProperty(J)){let W=Z[J];if(W===!0)W=z4.has(J)?J:`(${J})`;else if(W===!1)W=`(not ${z4.has(J)?J:`(${J})`})`;else if(W==="only")W+=" "+J;else W=`(${J}:${W})`;X.push(W)}return X.join(" and ")},z4=new Set(["all","print","screen"]);var i=(Z,X)=>{return X={format:l,vendors:Z4,fns:{},depth:0,...X},O(X.autoprefix)&&(X.autoprefix=new Set(X.autoprefix)),L(Z)?O1(Z,X):v(Z)?Z([],X).join(X.format.rules):Y1([],[],O(Z)?Z:_1(Z)?[...Z]:$("invalid rules"),X).join(X.format.rules)};var Q4=(Z,...X)=>(J,W)=>(J.push(X.length?`@import url(${Z}) ${X.join(W.format.ruleSep)};`:`@import url(${Z});`),J);var z1=(Z,X)=>x1("@media",Z,X);var V4=function(...Z){return(X,J)=>(X.push(Z.length>1?`@namespace ${Z[0]} url(${Z[1]});`:`@namespace url(${Z[0]});`),X)};var U4=(Z,X)=>x1("@supports",Z,X);var a={"@comment":Y4,"@import":Q4,"@keyframes":B4,"@media":z1,"@namespace":V4,"@supports":U4};var q4=4,K4=(Z)=>q4=Z,k=(Z)=>Z===(Z|0)?String(Z):Z.toFixed(q4).replace(/^0./,".").replace(/^-0./,"-.").replace(/0+$/,"");var H4=(Z)=>`${k(Z)}em`,$4=(Z)=>`${k(Z)}ex`;var C4=(Z)=>`${k(Z)}rem`,$0=(Z)=>`${k(Z)}%`,M4=(Z)=>`${k(Z)}px`,F4=(Z)=>`${k(Z)}vh`,w4=(Z)=>`${k(Z)}vw`,P4=(Z)=>`${k(Z)}vmin`,O4=(Z)=>`${k(Z)}vmax`,N4=(Z)=>`${Z|0}ms`,j4=(Z)=>`${k(Z)}s`;var D4=(Z)=>`${k(Z)}deg`,G4=(Z)=>`${k(Z)}rad`,k4=(Z)=>`${k(Z)}turn`,T4=(Z)=>`url(${Z})`;var j=((Z)=>{return Z[Z.IDLE=0]="IDLE",Z[Z.ACTIVE=1]="ACTIVE",Z[Z.DONE=2]="DONE",Z[Z.UNSUBSCRIBED=3]="UNSUBSCRIBED",Z[Z.ERROR=4]="ERROR",Z})(j||{}),R=((Z)=>{return Z[Z.NEVER=0]="NEVER",Z[Z.FIRST=1]="FIRST",Z[Z.LAST=2]="LAST",Z})(R||{});var o5=0,i5=()=>o5++,t=(Z,X)=>!X||!X.id?{...X,id:Z+"-"+i5()}:X;var D=c0.childLogger("rstream");class f{constructor(Z,X){this.wrapped=Z,X=t("sub",{closeIn:R.LAST,closeOut:R.LAST,cache:!0,...X}),this.parent=X.parent,this.id=X.id,this.closeIn=X.closeIn,this.closeOut=X.closeOut,this.cacheLast=X.cache,X.xform&&(this.xform=X.xform(h1()))}id;closeIn;closeOut;parent;__owner;xform;cacheLast;last=y;state=j.IDLE;subs=[];deref(){return this.last!==y?this.last:void 0}getState(){return this.state}setState(Z){this.state=Z}subscribe(Z,X={}){this.ensureState();let J;if(Z instanceof f&&!X.xform)Z.ensureState(),S1(!Z.parent,`sub '${Z.id}' already has a parent`),Z.parent=this,J=Z;else J=new f(Z,{...X,parent:this});return this.subs.push(J),this.setState(j.ACTIVE),J.setState(j.ACTIVE),this.last!=y&&J.next(this.last),J}transform(...Z){let X,J;if(L(w1(Z)))J=Z.pop(),X={error:J.error};return this.subscribe(X,t("xform",Z.length>0?{...J,xform:h(...Z)}:J))}map(Z,X){return this.transform(P(Z),X||{})}unsubscribe(Z){return Z?this.unsubscribeChild(Z):this.unsubscribeSelf()}unsubscribeSelf(){return D.debug(this.id,"unsub self"),this.parent&&this.parent.unsubscribe(this),this.state<j.UNSUBSCRIBED&&(this.state=j.UNSUBSCRIBED),this.release(),!0}unsubscribeChild(Z){D.debug(this.id,"unsub child",Z.id);const X=this.subs.indexOf(Z);if(X>=0){if(this.subs.splice(X,1),this.closeOut===R.FIRST||!this.subs.length&&this.closeOut!==R.NEVER)this.unsubscribe();return!0}return!1}next(Z){if(this.state>=j.DONE)return;this.xform?this.dispatchXform(Z):this.dispatch(Z)}done(){if(D.debug(this.id,"entering done()"),this.state>=j.DONE)return;if(this.xform){if(!this.dispatchXformDone())return}if(this.state=j.DONE,this.dispatchTo("done"))this.state<j.UNSUBSCRIBED&&this.unsubscribe();D.debug(this.id,"exiting done()")}error(Z){const X=this.wrapped,J=X&&X.error;return J&&D.debug(this.id,"attempting wrapped error handler"),J&&X.error(Z)||this.unhandledError(Z)}unhandledError(Z){return(D.parent!==F1?D:console).warn(this.id,"unhandled error:",Z),this.unsubscribe(),this.state=j.ERROR,!1}dispatchTo(Z,X){let J=this.wrapped;if(J)try{J[Z]&&J[Z](X)}catch(B){if(!this.error(B))return!1}const W=Z==="next"?this.subs:[...this.subs];for(let B=W.length;B-- >0;){J=W[B];try{J[Z]&&J[Z](X)}catch(Y){if(Z==="error"||!J.error||!J.error(Y))return this.unhandledError(Y)}}return!0}dispatch(Z){D.debug(this.id,"dispatch",Z),this.cacheLast&&(this.last=Z),this.dispatchTo("next",Z)}dispatchXform(Z){let X;try{X=this.xform[2]([],Z)}catch(J){this.error(J);return}if(this.dispatchXformVals(X))b(X)&&this.done()}dispatchXformDone(){let Z;try{Z=this.xform[1]([])}catch(X){return this.error(X)}return this.dispatchXformVals(Z)}dispatchXformVals(Z){const X=m(Z);for(let J=0,W=X.length;J<W&&this.state<j.DONE;J++)this.dispatch(X[J]);return this.state<j.ERROR}ensureState(){if(this.state>=j.DONE)J1(`operation not allowed in state ${this.state}`)}release(){this.subs.length=0,delete this.parent,delete this.xform,delete this.last}}var b4=(Z,X)=>{const J=new I4(X);return J.next(Z),J};class I4 extends f{src;_cancel;_inited;constructor(Z,X){const[J,W]=v(Z)?[Z,X||{}]:[void 0,Z||{}];super(W.error?{error:W.error}:void 0,t("stream",W));this.src=J,this._inited=!1}subscribe(Z,X={}){const J=super.subscribe(Z,X);if(!this._inited){if(this.src)try{this._cancel=this.src(this)||(()=>{return})}catch(W){let B=this.wrapped;if(!B||!B.error||!B.error(W))this.unhandledError(W)}this._inited=!0}return J}unsubscribe(Z){const X=super.unsubscribe(Z);if(X&&(!Z||(!this.subs||!this.subs.length)&&this.closeOut!==R.NEVER))this.cancel();return X}done(){this.cancel(),super.done(),delete this.src,delete this._cancel}error(Z){if(super.error(Z))return!0;return this.cancel(),!1}cancel(){if(this._cancel){D.debug(this.id,"cancel");const Z=this._cancel;delete this._cancel,Z()}}}var R4=(Z,X)=>Z===R.FIRST||Z===R.LAST&&!X;var C0=function(Z){return Z?y1(C0(),Z):B1(()=>({}),(X,[J,W])=>(X[J]=W,X))};var M0=function(Z,X){return T(X)?o(M0(Z),X):P(v(Z)?(J)=>[Z(J),J]:(J)=>[Z,J])};var F0=function(...Z){const X=f1(F0,Z);if(X)return X;const J=Z[0],W=Z[1]!==!1;return P((B)=>{const Y=W?{}:B;for(let Q in B)Y[Q]=J(B[Q]);return Y})};var E4=(Z)=>Z;var w0=function(...Z){const X=f1(w0,Z,m1);if(X)return X;const{key:J=E4,mergeOnly:W=!1,reset:B=!0,all:Y=!0,backPressure:Q=0}=Z[1],z=O(Z[0])?new Set(Z[0]):Z[0],V=new Set,U=new Map;let q={};const K=([H,F,A])=>{let g=!0;if(W||Q<1)return[H,(C)=>{if(B&&Y&&V.size>0||!B&&g)C=A(C,q),q={},V.clear(),g=!1;return F(C)},(C,x)=>{const G=J(x);if(z.has(G)){if(q[G]=x,V.add(G),W||L4(z,V))if(C=A(C,q),g=!1,B)q={},V.clear();else q={...q}}return C}];else return[H,(C)=>{if(Y&&V.size>0)C=A(C,S4(U,V)),U.clear(),V.clear();return F(C)},(C,x)=>{const G=J(x);if(z.has(G)){let _=U.get(G);!_&&U.set(G,_=[]),_.length>=Q&&J1(`max back pressure (${Q}) exceeded for input: ${String(G)}`),_.push(x),V.add(G);while(L4(z,V))if(C=A(C,S4(U,V)),g=!1,b(C))break}return C}]};return K.keys=()=>z,K.clear=()=>{U.clear(),z.clear(),V.clear(),q={}},K.add=(H)=>{z.add(H)},K.delete=(H,F=!0)=>{if(U.delete(H),z.delete(H),F)V.delete(H),delete q[H]},K},L4=(Z,X)=>{if(X.size<Z.size)return!1;for(let J of Z)if(!X.has(J))return!1;return!0},S4=(Z,X)=>{const J={};for(let W of X){const B=Z.get(W);J[W]=B.shift(),!B.length&&X.delete(W)}return J};var A4=(Z,X)=>{let J=!0;for(let W of X)J=Z.removeID(W)&&J;return J};var d1=(Z)=>new v4(Z);class v4 extends f{sources;idSources;realSourceIDs;invRealSourceIDs;psync;clean;constructor(Z){const X=w0(new Set,{key:(W)=>W[0],mergeOnly:Z.mergeOnly===!0,reset:Z.reset===!0,all:Z.all!==!1,backPressure:Z.backPressure||0}),J=F0((W)=>W[1]);super(void 0,t("streamsync",{...Z,xform:Z.xform?h(X,J,Z.xform):h(X,J)}));this.sources=new Map,this.realSourceIDs=new Map,this.invRealSourceIDs=new Map,this.idSources=new Map,this.psync=X,this.clean=!!Z.clean,Z.src&&this.addAll(Z.src)}add(Z,X){X||(X=Z.id),this.ensureState(),this.psync.add(X),this.realSourceIDs.set(X,Z.id),this.invRealSourceIDs.set(Z.id,X),this.idSources.set(Z.id,Z),this.sources.set(Z,Z.subscribe({next:(J)=>J[1]instanceof f?this.add(J[1]):this.next(J),done:()=>this.markDone(Z),__owner:this},{xform:M0(X),id:`in-${X}`}))}addAll(Z){for(let X in Z)this.psync.add(X);for(let X in Z)this.add(Z[X],X)}remove(Z){const X=this.sources.get(Z);if(X){const J=this.invRealSourceIDs.get(Z.id);return D.info(`removing src: ${Z.id} (${J})`),this.psync.delete(J,this.clean),this.realSourceIDs.delete(J),this.invRealSourceIDs.delete(Z.id),this.idSources.delete(Z.id),this.sources.delete(Z),X.unsubscribe(),!0}return!1}removeID(Z){const X=this.getSourceForID(Z);return X?this.remove(X):!1}removeAll(Z){for(let J of Z)this.psync.delete(this.invRealSourceIDs.get(J.id));let X=!0;for(let J of Z)X=this.remove(J)&&X;return X}removeAllIDs(Z){return A4(this,Z)}getSourceForID(Z){return this.idSources.get(this.realSourceIDs.get(Z))}getSources(){const Z={};for(let[X,J]of this.idSources)Z[this.invRealSourceIDs.get(X)]=J;return Z}unsubscribe(Z){if(!Z){D.debug(this.id,"unsub sources");for(let X of this.sources.values())X.unsubscribe();this.sources.clear(),this.psync.clear(),this.realSourceIDs.clear(),this.invRealSourceIDs.clear(),this.idSources.clear()}return super.unsubscribe(Z)}markDone(Z){this.remove(Z),R4(this.closeIn,this.sources.size)&&this.done()}}var P0=s((Z,X=" ")=>{const J=e(String(X),Z);return(W,B)=>{if(W==null)return J;return W=W.toString(),B=B!==void 0?B:W.length,B<Z?J.substring(B)+W:W}}),$J=P0(2,"0"),CJ=P0(3,"0"),_4=P0(4,"0");var a5=/\{(\d+)\}/g;var O0=(Z,...X)=>X.length>0?Z.replace(a5,(J,W)=>String(X[parseInt(W,10)])):Z;var N0=function(Z,X){return T(X)?o(N0(Z),X):(J)=>{const W=J[2];return W1(J,(B,Y)=>Z(Y)?W(B,Y):B)}};import{watch as u4} from"fs";import{resolve as r} from"path";var y4={specs:d({alias:"s",optional:!1,desc:"Path to generated JSON defs"})},n1={bundle:I({alias:"b",desc:"Bundle inputs (see `out` option)"})},Q1={include:T1({alias:"I",desc:"Include CSS files (prepend)"})},l1={eval:d({alias:"e",desc:"eval meta stylesheet in given string (ignores other inputs & includes)"})},p1={force:T1({alias:"f",hint:"STR",desc:"CSS classes to force include (wildcards are supported, @-prefix will read from file)",delim:","})},h4={media:T1({alias:"m",hint:"ID",desc:"Media query IDs (use 'ALL' for all)",delim:","})},m4={onlyDecls:I({desc:"Only emit framework decls"})},V1={out:d({alias:"o",desc:"Output file (or stdout)"})},o1={prec:S0({default:3,desc:"Number of fractional digits"})},u={pretty:I({alias:"p",desc:"Pretty print output"})},U1={noDecls:I({alias:"d",desc:"Don't emit framework decls"})},q1={noHeader:I({desc:"Don't emit generated header comment"})},K1={watch:I({alias:"w",desc:"Watch input files for changes"})};import{watch as t5} from"fs";import{resolve as f4} from"path";var H1=(Z,X,J)=>{X=M(X)?X:X.join("\n"),Z?Y0(f4(Z),X,J):process.stdout.write(X+"\n")},i1=({info:{name:Z,version:X}})=>`/*! ${Z} v${X} - generated by thi.ng/meta-css @ ${(new Date()).toISOString()} */`,N1=(Z,X)=>{const J=()=>{X.info("closing watchers..."),W.forEach((B)=>B.watcher.close())},W=Z.map((B,Y)=>{B=f4(B);const Q=b4(N(B,X),{id:`in${_4(Y)}`});return{input:Q,watcher:t5(B,{},(z)=>{if(z==="change")try{Q.next(N(B,X))}catch(V){X.warn(V.message),J()}else X.warn("input removed:",B),J()})}});return process.on("SIGINT",J),d1({src:C0(P(({input:B})=>[B.id,B],W))})},a1=(Z)=>Object.keys(Z).reduce((X,J)=>{if(!J.startsWith("__"))X[J]=Z[J];return X},{});async function D0(Z){const X=n(r(Z.opts.specs),Z.logger),J=Z8(X,Z.opts.force||[],Z.logger);if(Z.opts.bundle)if(Z.opts.watch)await c5(Z,J);else j1(Z,X,J,Z.opts.eval?[Z.opts.eval]:Z.inputs.map((W)=>N(r(W),Z.logger)),Z.opts.out);else if(Z.opts.watch)await r5(Z,X,J);else if(Z.opts.eval)try{j1(Z,X,J,[Z.opts.eval])}catch(W){Z.logger.warn(W.message)}else for(let W of Z.inputs)try{W=r(W);const B=!Z.opts.noWrite?W.replace(/\.mcss$/,".css"):void 0;j1(Z,X,J,[N(W,Z.logger)],B)}catch(B){Z.logger.warn(B.message)}}function*J8(Z){let X=-1,J=Z.length,W=0;for(let B=0;B<J;B++){const Y=Z[B];if(Y===" "||Y==="\t"){if(!W&&X>=0)yield Z.substring(X,B),X=-1}else if(Y==="{"||Y==="}"){if(X>=0)yield Z.substring(X,B);yield Y,X=-1}else if(Y==="(")W++;else if(Y===")"){if(--W<0)$(`invalid nesting in line: '${Z}'`)}else if(X<0)X=B}if(W)$("template calls must be fully on a single line");if(X>=0)yield Z.substring(X,J)}var x4={desc:"Transpile (and optionally bundle) meta stylesheets to CSS",opts:{...n1,...l1,...U1,...p1,...Q1,...q1,...V1,...u,...y4,...K1,noWrite:I({desc:"Don't write files, use stdout only"})},fn:D0},r5=async(Z,X,J)=>{const W=r(Z.opts.specs);let B,Y={process:()=>{try{return X=n(W,Z.logger),B.forEach((z)=>z.process()),!0}catch(z){return Z.logger.warn(z.message+": "+W),!1}},watcher:u4(W,{},(z)=>{if(z==="change")Y.process();else Z.logger.warn("specs file removed:",W),Q()})};const Q=()=>{Z.logger.info("closing watchers..."),Y.watcher.close(),B.forEach((z)=>z.watcher.close())};B=Z.inputs.map((z)=>{z=r(z);const V=!Z.opts.noWrite?z.replace(/\.mcss$/,".css"):void 0,U=()=>{try{return j1(Z,X,J,[N(z,Z.logger)],V),!0}catch(q){if(Z.logger.warn(q.message+": "+z),B)Q();return!1}};if(!U())process.exit(1);return{process:U,watcher:u4(z,{},(q)=>{if(q==="change")U();else Z.logger.warn("input removed:",z),Q()})}}),Z.logger.info("waiting for changes, press ctrl+c to cancel..."),process.on("SIGINT",Q)},c5=async(Z,X)=>{d1({src:{styles:N1(Z.inputs,Z.logger),specs:N1([Z.opts.specs],Z.logger).map((J)=>JSON.parse(Object.values(J)[0]))}}).subscribe({next({styles:J,specs:W}){try{j1(Z,W,X,Object.keys(J).sort().map((B)=>J[B]),Z.opts.out)}catch(B){Z.logger.warn(B.message)}}})},j1=({logger:Z,opts:{include:X,noDecls:J,noHeader:W,pretty:B}},Y,Q,z,V)=>{const U={logger:Z,specs:Y,format:B?P1:l,mediaQueryIDs:new Set(Object.keys(Y.media)),mediaQueryRules:{...Q.mediaQueryRules},plainRules:{...Q.plainRules}},q=X?X.map((K)=>N(r(K),Z).trim()):[];if(!W)q.push(i1(Y));if(!J&&Y.decls.length)q.push(i(Y.decls,{format:U.format,fns:a}));z.forEach((K)=>X8(K,U)),e5(q,U),s5(q,U),H1(V,q,Z)},s5=(Z,{logger:X,specs:J,format:W,mediaQueryRules:B})=>{for(let Y in B){const Q=n4(B[Y],J);X.debug("mediaquery rules",Y,Q),Z.push(i(z1(Y8(J.media,Y),Q),{format:W,fns:a}))}},e5=(Z,{logger:X,specs:J,format:W,plainRules:B})=>{const Y=n4(B,J);X.debug("plain rules",Y),Z.push(i(Y,{format:W,fns:a}))},Z8=(Z,X,J)=>{const W=new Set(Object.keys(Z.media)),B=new Set(Object.keys(Z.classes)),Y={},Q={};if(X.length&&X[0][0]==="@")X=[...Z1(N(r(X[0].substring(1)),J))];for(let z of X){if(!z||z.startsWith("//"))continue;const{token:V,query:U}=l4(z,W);let q;if(V.includes("*")){const K=new RegExp(`^${V.replace("*",".*")}\$`);q=[...N0((H)=>K.test(H),B)]}else if(B.has(V))q=[V];else{J.warn(`unknown include rule ID: ${z}, skipping...`);continue}for(let K of q)J.debug("including class:",K),U?p4(Y,U,`.${K}`,K):o4(Q,`.${K}`,K)}return{mediaQueryRules:Y,plainRules:Q}},X8=(Z,{specs:X,mediaQueryIDs:J,mediaQueryRules:W,plainRules:B})=>{const Y=D1(),Q=D1(Y),z={root:Y,curr:Q,scopes:[Q]};for(let V of Z1(Z)){if(!V||/^\s*\/\//.test(V))continue;for(let U of J8(V)){if(!U)continue;let q=z.curr;switch(q.state){case"sel":case"nest":if(U==="{"){if(q.state==="sel")q.sel=q.sel.map((K)=>K.replace(",","")),q.path=W8(z.scopes);q.state="class"}else if(U==="}")g4(z);else{const K=w1(q.sel);if(!K||K.endsWith(","))q.sel.push(U);else q.sel[q.sel.length-1]+=" "+U}break;case"class":if(U==="{")q.state="nest",z.scopes.push(z.curr=D1(q));else if(U==="}")g4(z);else{let{token:K,query:H}=l4(U,J);if(!X.classes[K]&&!(i4(K)||a4(K)))$(`unknown class ID: ${K}`);if(H)p4(W,H,q.path,K);else o4(B,q.path,K)}break;default:J1(q.state)}}}},j0=":",d4="///",D1=(Z)=>({state:"sel",sel:Z?[]:["<root>"],path:"",parent:Z}),g4=(Z)=>{const X=!Z.curr.sel.length;if(S1(!!Z.curr.parent,"stack underflow"),Z.scopes.pop(),Z.scopes.length>0){if(Z.curr=w1(Z.scopes),!X&&Z.curr.state==="nest")Z.scopes.push(Z.curr=D1(Z.curr))}else Z.scopes.push(Z.curr=D1(Z.root))},W8=(Z)=>Z.map((X)=>X.sel.join(",")).join(d4),n4=(Z,X)=>Object.entries(Z).map(([J,W])=>B8(J,W,X)),B8=(Z,X,J)=>{const W=[];let B=W;const Y=Z.split(d4);for(let Q=0;Q<Y.length;Q++){const z=Y[Q].split(",");if(Q==Y.length-1){const V=Object.assign({},...P((U)=>a4(U)?Q8(J,U):i4(U)?z8(U):a1(J.classes[U]),X));z.push(V)}B.push(z),B=z}return W[0]},l4=(Z,X)=>{if(/^::?/.test(Z))return{token:Z};const J=Z.lastIndexOf(j0);if(J<0)return{token:Z};const W=Z.substring(0,J);if(!W.split(j0).every((Y)=>X.has(Y)))$(`invalid media query in token: ${Z}`);return{token:Z.substring(J+1),query:W}},Y8=(Z,X)=>X.split(j0).reduce((J,W)=>Object.assign(J,Z[W]),{}),p4=(Z,X,J,W)=>{if(!Z[X])Z[X]={};(Z[X][J]||(Z[X][J]=new Set)).add(W)},o4=(Z,X,J)=>(Z[X]||(Z[X]=new Set)).add(J),z8=(Z)=>{const X=Z.indexOf("=");return{[`--${Z.substring(0,X)}`]:Z.substring(X+1)}},Q8=(Z,X)=>{const J=X.indexOf("("),W=X.substring(0,J),B=X.substring(J+1,X.length-1).split(/(?<!\\),/g).map((Q)=>Q.trim().replace("\\,",",")),Y=Z.templates[W];if(B.length!==Y.__arity)$(`template "${W}" expected ${Y.__arity} arguments`);return Object.entries(Y).reduce((Q,[z,V])=>{if(!z.startsWith("__")){if(z=O0(z,...B),M(V))V=O0(V,...B);Q[z]=V}return Q},{})},i4=(Z)=>Z.includes("="),a4=(Z)=>Z.includes("(");async function G0(Z){if(Z.opts.watch)await q8(Z);else await s4(Z.inputs.map((X)=>N(X,Z.logger)),Z.opts,Z.logger)}var r4={deg:D4,em:H4,ex:$4,ms:N4,percent:$0,px:M4,rad:G4,rem:C4,second:j4,turn:k4,url:T4,vh:F4,vmax:O4,vmin:P4,vw:w4,"%":$0},V8={percent:"{0}%",second:"{0}s",url:"url({0})"},U8={"":[""],a:[""],h:["-left","-right"],v:["-top","-bottom"],t:["-top"],top:["top"],b:["-bottom"],bottom:["bottom"],r:["-right"],right:["right"],l:["-left"],left:["left"],x:["-x"],y:["-y"],in:[""],out:[""]},c4={desc:"Generate framework rules from specs",opts:{...V1,...o1,...u,...K1},fn:G0},q8=async(Z)=>{N1(Z.inputs,Z.logger).subscribe({next(X){try{s4(Object.keys(X).sort().map((J)=>X[J]),Z.opts,Z.logger)}catch(J){Z.logger.warn(J.message)}}})},s4=async(Z,X,J)=>{const W={info:{name:"TODO",version:"0.0.0"},media:{},classes:{},templates:{},decls:[]};K4(X.prec);for(let B of Z){const Y=JSON.parse(B);if(Object.assign(W.info,Y.info),Object.assign(W.media,Y.media),Y.decls)W.decls.push(...Y.decls);if(Y.specs)for(let Q of Y.specs)try{e4(Y,Q,W.classes,J)}catch(z){J.warn(`error processing spec: ${Q.name}`,z,", skipping...")}if(Y.templates)for(let Q of Y.templates)K8(Y,Q,W.templates,J)}return H1(X.out,JSON.stringify(W,null,X.pretty?4:0),J),W},e4=(Z,X,J,W,B=!1)=>{const Y=O(X.vars)?X.vars:[""],Q=M(X.props)?{[X.props]:"<v>"}:X.props,z=H8(X,Z),V=new Set;for(let U of Y){const q=Z.vars?.[U]||U8[U];if(!q)$(`unknown variation ID: ${U}`);for(let[K,H]of u1(q,Object.keys(z))){const F=c(X.name,U,K,H,z[H]),A=X.unit?c(X.unit,U,K,H,z[H]):void 0,g=B?C8(A):$8(z[H],A);if(!J[F]){if(J[F]={},X.user!=null)J[F].__user=X.user;if(X.doc!=null)J[F].__doc=M8(X.doc,U,K,H,g)}else if(!V.has(F))$(`duplicate class ID: ${F}`);V.add(F);let C=-1;for(let[x,G]of Object.entries(Q)){const _=c(x,U,K,H,z[H]),t1=c(!A||M(G)?String(G):r4[A](G),U,K,H,g);if(J[F][_]=t1,W.debug(F,_,t1),B)C=t4(t1,t4(_,C))}if(B)J[F].__arity=C+1}}return J},K8=(Z,X,J,W)=>e4(Z,{...X,values:[""]},J,W,!0),t4=(Z,X)=>{const J=/\{(\d+)\}/g;let W;while(W=J.exec(Z))X=Math.max(X,+W[1]);return X},H8=(Z,X)=>{const J=M(Z.values)?X.tables?.[Z.values]||$(`invalid table ID: ${Z.values}`):Z.values;if(L(J))return J;const W=Z.key==="v"?(B)=>String(B):Z.key==="i+1"?(B,Y)=>String(Y+1):Z.key===void 0?(B,Y)=>String(Y):$(`invalid key type: ${Z.key}`);return J.reduce((B,Y,Q)=>{return B[W(Y,Q)]=Y,B},{})},$8=(Z,X)=>{if(!X||M(Z))return Z;const J=r4[X];if(!J)$(`invalid unit: ${X}`);return J(Z)},C8=(Z)=>Z?V8[Z]||"{0}"+Z:"{0}",c=(Z,X,J,W,B)=>Z.replace(/<vid>/g,X).replace(/<var>/g,J).replace(/<k>/g,W).replace(/<v>/g,String(B)),M8=({group:Z,desc:X,args:J},W,B,Y,Q)=>({group:Z?c(Z,W,B,Y,Q):"TODO",desc:X?c(X,W,B,Y,Q):void 0,args:J?J.map((z)=>c(z,W,B,Y,Q)):void 0});var Z5={desc:"Combination of the generate & convert commands",opts:{...n1,...l1,...p1,...Q1,...U1,...q1,...o1,...u,...K1,outCss:d({desc:"Output file for CSS bundle",optional:!1}),outSpecs:d({desc:"Output file for framework",optional:!1})},fn:async(Z)=>{const{opts:X,inputs:J}=Z,[W,B]=J.reduce((z,V)=>(z[V.endsWith(".json")?0:1].push(V),z),[[],[]]),Y={inputs:W,format:Z.format,logger:Z.logger,opts:{...X,out:X.outSpecs}},Q={inputs:B,format:Z.format,logger:Z.logger,opts:{...X,noWrite:!1,out:X.outCss,specs:X.outSpecs}};await G0(Y),await D0(Q)}};import{resolve as X5} from"path";var W5={desc:"Export entire generated framework as CSS",opts:{...Q1,...U1,...m4,...V1,...u,...q1,...h4},inputs:1,fn:async(Z)=>{const{logger:X,opts:{include:J,media:W,noDecls:B,noHeader:Y,onlyDecls:Q,pretty:z,out:V},inputs:U}=Z,q=n(X5(U[0]),X),K=J?J.map((H)=>N(X5(H),X).trim()):[];if(!Y)K.push(i1(q));if(!B&&q.decls.length)K.push(i(q.decls,{format:z?P1:l,fns:a}));if(!Q)K.push(F8(q,W,z,X));H1(V,K,X)}},F8=(Z,X,J,W)=>{const B=J5("",Z);if(X){const Y=X[0]==="ALL"?Object.keys(Z.media):X;for(let Q of Y)if(Z.media[Q])B.push(z1(Z.media[Q],J5("-"+Q,Z)));else W.warn(`invalid media query ID: ${Q}, skipping...`)}return i(B,{format:J?P1:l,fns:a})},J5=(Z,X)=>Object.entries(X.classes).map(([J,W])=>[`.${J}${Z}`,a1(W)]);var k0=n(w8(import.meta.dir,"package.json"));a0({name:"metacss",opts:{verbose:I({alias:"v",desc:"Display extra process information"})},commands:{convert:x4,develop:Z5,export:W5,generate:c4},ctx:async(Z)=>{if(Z.opts.verbose)Z.logger.level=w.DEBUG;return{...Z,format:E1}},usage:{prefix:`
2
+ var r1={default:95,hint:90,multi:90,param:96,required:33};var c1=(Z)=>Z;var s=function(Z,X){return!X&&(X={}),(...J)=>{const W=JSON.stringify(J);if(W!==void 0)return W in X?X[W]:X[W]=Z.apply(null,J);return Z.apply(null,J)}};var e=s((Z,X)=>Z.repeat(X));var T0=(Z)=>/^[a-f0-9]+$/i.test(Z);var b0=(Z)=>/^[-+]?\d+$/.test(Z),I0=(Z)=>/^[-+]?\d*\.?\d+(e[-+]?\d+)?$/i.test(Z);var E=(Z,X=(J)=>J!==void 0?": "+J:"")=>class extends Error{origMessage;constructor(J){super(Z(J)+X(J));this.origMessage=J!==void 0?String(J):""}};var B5=E(()=>"illegal argument(s)"),$=(Z)=>{throw new B5(Z)};var s1=(Z)=>I0(Z)?parseFloat(Z):$(`not a numeric value: ${Z}`),R0=(Z)=>Z.map(s1),e1=(Z)=>T0(Z)?parseInt(Z,16):$(`not a hex value: ${Z}`),E0=(Z)=>Z.map(e1),Z0=(Z)=>b0(Z)?parseInt(Z):$(`not an integer: ${Z}`),S0=(Z)=>Z.map(Z0);var G1=(Z,X)=>(J)=>({coerce:Z,hint:X,group:"main",...J}),k1=(Z,X)=>(J)=>({hint:Y5(X,J.delim),multi:!0,coerce:Z,group:"main",...J}),Y5=(Z,X)=>Z+(X?`[${X}..]`:""),I=(Z)=>({flag:!0,default:!1,group:"flags",...Z}),d=G1(c1,"STR"),T1=k1(c1,"STR"),u8=G1(s1,"NUM"),g8=G1(e1,"HEX"),L0=G1(Z0,"INT"),x8=k1(R0,"NUM"),d8=k1(E0,"HEX"),n8=k1(S0,"INT");var w=((Z)=>{return Z[Z.FINE=0]="FINE",Z[Z.DEBUG=1]="DEBUG",Z[Z.INFO=2]="INFO",Z[Z.WARN=3]="WARN",Z[Z.SEVERE=4]="SEVERE",Z[Z.NONE=5]="NONE",Z})(w||{});var z5=0;class $1{constructor(Z,X=w.FINE,J){this.parent=J,this.id=Z||`logger-${z5++}`,this.level=typeof X==="string"?w[X]:X}id;level;addChild(Z){return Z.parent=this,Z}enabled(Z){return this.level<=Z}fine(...Z){this.log(w.FINE,Z)}debug(...Z){this.log(w.DEBUG,Z)}info(...Z){this.log(w.INFO,Z)}warn(...Z){this.log(w.WARN,Z)}severe(...Z){this.log(w.SEVERE,Z)}log(Z,X){this.level<=Z&&this.logEntry([Z,this.id,Date.now(),...X])}}var A0=(Z)=>Z.map((X)=>{if(typeof X==="function")X=X();if(!(typeof X==="string"||typeof X==="number"))X=JSON.stringify(X);return X}).join(" ");class b1 extends $1{constructor(Z,X,J,W){super(X,J,W);this.target=Z}childLogger(Z,X){return new b1(this.target,Z,X??this.level,this)}logEntry(Z){if(Z[0]<this.level)return;this.target.write(`[${w[Z[0]]}] ${Z[1]}: ${A0(Z.slice(3))}
3
+ `),this.parent&&this.parent.logEntry(Z)}}var I1=s((Z,X=" ")=>{const J=e(String(X),Z);return(W,B)=>{if(W==null)return J;return W=W.toString(),B=B!==void 0?B:W.length,B<Z?W+J.substring(B):W}});var v0=(Z,X)=>{return!X&&(X=new Map),(J)=>{let W;return X.has(J)?X.get(J):(X.set(J,W=Z(J)),W)}};var X0={black:1,blue:5,cyan:7,gray:17,green:3,magenta:6,red:2,white:24,yellow:4,lightBlue:21,lightCyan:23,lightGray:8,lightGreen:19,lightMagenta:22,lightRed:18,lightYellow:20,bgBlack:32,bgBlue:160,bgCyan:224,bgGray:544,bgGreen:96,bgMagenta:192,bgRed:64,bgWhite:768,bgYellow:128,bgLightBlue:672,bgLightCyan:736,bgLightGray:256,bgLightGreen:608,bgLightMagenta:704,bgLightRed:576,bgLightYellow:640};var Q5=(Z,X)=>(J)=>Z.format(X,J),J0=(Z)=>Object.keys(X0).reduce((X,J)=>(X[J]=Q5(Z,X0[J]),X),{format:Z});var _0="\x1B[0m";var V5=["","1","2","1;2","4","1;4","2;4","1;2;4"],R1={format:(Z,X)=>R1.start(Z)+X+R1.end,start:v0((Z)=>{let X=[],J=Z&15;return J&&X.push(29+(Z>>4&1)*60+J),J=Z>>5&15,J&&X.push(39+(Z>>9&1)*60+J),J=Z>>10,J&&X.push(V5[J]),"\x1B["+X.join(";")+"m"}),end:_0,prefix:_0,suffix:"\n"};var y0={format:(Z,X)=>String(X),prefix:"",suffix:"\n",start:()=>"",end:""};var E1=J0(R1),h0=J0(y0);var O=Array.isArray;var U5=(Z)=>Z.toUpperCase(),m0=(Z)=>Z.toLowerCase(),f0=(Z)=>Z.length?Z[0].toUpperCase()+Z.substring(1):Z,u0=(Z,X="-")=>m0(Z.replace(/([a-z0-9\u00e0-\u00fd])([A-Z\u00c0-\u00dd])/g,(J,W,B)=>W+X+B));var g0=(Z,X="-")=>m0(Z).replace(new RegExp(`\\${X}+(\\w)`,"g"),(J,W)=>U5(W));var x0=Object.getPrototypeOf,S=(Z)=>{let X;return Z!=null&&typeof Z==="object"&&((X=x0(Z))===null||x0(X)===null)};var q5=/\x1b\[[0-9;]+m/g,K5=(Z)=>Z.replace(q5,"");var S1=(Z)=>K5(Z).length;var d0=(Z=!1,X)=>(J)=>Z||typeof J!=="string"&&typeof J!=="number"?JSON.stringify(J,null,X):String(J);function*Z1(Z,X=/\r?\n/g,J=!1){let W=0;const B=Z.length,Y=~~J;let Q;if(typeof X==="string")Q=new RegExp(X,"g");else if(!X.flags.includes("g"))Q=new RegExp(X,X.flags+"g");else Q=X;for(;W<B;){const z=Q.exec(Z);if(!z){yield Z.substring(W);return}const V=z[0].length;yield Z.substring(W,z.index+Y*V),W=z.index+V}}class W0{n=0;w=[];constructor(Z,X){Z!=null&&this.add(Z,X)}add(Z,X=Z.length){return this.w.push(Z),this.n+=X+~~(this.n>0),this}toString(){return this.w.join(" ")}}var H5={length:(Z)=>Z.length,split:(Z,X)=>X},l0={length:S1,split:(Z,X)=>{const J=/\x1b\[[0-9;]+m/g;let W=X,B;while(B=J.exec(Z)){if(B.index>=X)break;const Y=B[0].length;W+=Y,X+=Y}return W}},n0=(Z,X,J,W)=>{const B=Z[Z.length-1];B&&W-B.n>J?B.add(X,J):Z.push(new W0(X,J))},$5=(Z,{width:X,min:J,hard:W,splitter:B},Y=0,Q=[])=>{let z=B.length(Z),V=X-Y;if(V<J&&V<z)V=X;while(W&&z>V){const U=B.split(Z,V),q=Z.substring(0,U);n0(Q,q,V,X),Z=Z.substring(U),V=X,z=B.length(Z)}return n0(Q,Z,z,X),Q},C5=(Z,X,J=[])=>{if(!Z.length)return J.push(new W0),J;const W={width:80,min:4,hard:!1,splitter:H5,...X};for(let B of Z1(Z,X.delimWord||/\s/g)){const Y=J[J.length-1];$5(B,W,Y&&Y.n>0?Y.n+1:0,J)}return J},p0=(Z,X)=>{let J=[];for(let W of Z1(Z,X.delimLine))J=J.concat(C5(W,X));return J};var C1=(Z,X={})=>{X={lineWidth:80,paramWidth:32,showDefaults:!0,prefix:"",suffix:"",groups:["flags","main"],...X};const J=S(X.color)?{...r1,...X.color}:X.color?r1:{},W=e(" ",X.paramWidth),B=(z)=>z.map((V)=>M5(V,Z[V],X,J,W)),Y=Object.keys(Z).sort(),Q=X.groups?X.groups.map((z)=>[z,Y.filter((V)=>Z[V].group===z)]).filter((z)=>!!z[1].length):[["options",Y]];return[...B0(X.prefix,X.lineWidth),...Q.map(([z,V])=>[...X.showGroupNames?[`${f0(z)}:
4
+ `]:[],...B(V),""].join("\n")),...B0(X.suffix,X.lineWidth)].join("\n")},M5=(Z,X,J,W,B)=>{const Y=F5(X,W),Q=w5(X,W,Y),z=M1(`--${u0(Z)}`,W.param),V=`${Q}${z}${Y}`,U=X.optional===!1&&X.default===void 0,q=[];U&&q.push("required"),X.multi&&q.push("multiple");const K=P5(q,W,U)+(X.desc||"")+O5(X,J,W);return I1(J.paramWidth)(V,S1(V))+B0(K,J.lineWidth-J.paramWidth).map((H,F)=>F>0?B+H:H).join("\n")},F5=(Z,X)=>Z.hint?M1(" "+Z.hint,X.hint):"",w5=(Z,X,J)=>Z.alias?`${M1("-"+Z.alias,X.param)}${J}, `:"",P5=(Z,X,J)=>Z.length?M1(`[${Z.join(", ")}] `,J?X.required:X.multi):"",O5=(Z,X,J)=>X.showDefaults&&Z.default!=null&&Z.default!==!1?M1(` (default: ${d0(!0)(Z.defaultHint!=null?Z.defaultHint:Z.default)})`,J.default):"",M1=(Z,X)=>X!=null?`\x1B[${X}m${Z}\x1B[0m`:Z,B0=(Z,X)=>Z?p0(Z,{width:X,splitter:l0,hard:!1}):[];var N5=E(()=>"parse error"),o0=(Z,X,J)=>{J={start:2,showUsage:!0,help:["--help","-h"],...J};try{return j5(Z,X,J)}catch(W){if(J.showUsage)console.log(W.message+"\n\n"+C1(Z,J.usageOpts));throw new N5(W.message)}},j5=(Z,X,J)=>{const W=D5(Z),B={};let Y,Q,z=J.start;for(;z<X.length;){const V=X[z];if(!Y){if(J.help.includes(V)){console.log(C1(Z,J.usageOpts));return}const U=G5(Z,W,B,V);if(Y=U.id,Q=U.spec,z=z+~~(U.state<2),U.state)break}else{if(k5(Q,B,Y,V))break;Y=null,z++}}return Y&&$(`missing value for: --${Y}`),{result:T5(Z,B),index:z,rest:X.slice(z),done:z>=X.length}},D5=(Z)=>Object.entries(Z).reduce((X,[J,W])=>W.alias?(X[W.alias]=J,X):X,{}),G5=(Z,X,J,W)=>{if(W[0]==="-"){let B;if(W[1]==="-"){if(W==="--")return{state:1};B=g0(W.substring(2))}else B=X[W.substring(1)],!B&&$(`unknown option: ${W}`);const Y=Z[B];if(!Y&&$(B),Y.flag){if(J[B]=!0,B=void 0,Y.fn&&!Y.fn("true"))return{state:1,spec:Y}}return{state:0,id:B,spec:Y}}return{state:2}},k5=(Z,X,J,W)=>{if(/^-[a-z]/i.test(W)&&$(`missing value for: --${J}`),Z.multi)O(X[J])?X[J].push(W):X[J]=[W];else X[J]=W;return Z.fn&&!Z.fn(W)},T5=(Z,X)=>{let J;for(let W in Z)if(J=Z[W],X[W]===void 0){if(J.default!==void 0)X[W]=J.default;else if(J.optional===!1)$(`missing arg: --${W}`)}else if(J.coerce)b5(J,X,W);return X},b5=(Z,X,J)=>{try{if(Z.multi&&Z.delim)X[J]=X[J].reduce((W,B)=>(W.push(...B.split(Z.delim)),W),[]);X[J]=Z.coerce(X[J])}catch(W){throw new Error(`arg --${J}: ${W.message}`)}};var a0=async(Z)=>{const X=Z.argv||process.argv,J=!process.env.NO_COLOR,W={prefix:"",color:J,...Z.usage};try{let B,Y,Q=Z.start??2;if(Z.single){if(B=Object.keys(Z.commands)[0],!B)$("no command provided");Y=Z.commands[B]}else{if(B=X[Q],Y=Z.commands[B],W.prefix+=I5(Z.commands),!Y)i0(Z,W);Q++}let z;try{z=o0({...Z.opts,...Y.opts},X,{showUsage:!0,usageOpts:W,start:Q})}catch(U){}if(!z)process.exit(1);if(Y.inputs!==void 0&&Y.inputs!==z.rest.length)process.stderr.write(`expected ${Y.inputs||0} input(s)
5
+ `),i0(Z,W);const V=await Z.ctx({logger:new b1(process.stderr,Z.name,"INFO"),format:J?E1:h0,opts:z.result,inputs:z.rest},Y);if(await Y.fn(V),Z.post)await Z.post(V,Y)}catch(B){process.stderr.write(B.message+"\n\n"),process.exit(1)}},i0=(Z,X)=>{process.stderr.write(C1(Z.opts,X)),process.exit(1)},I5=(Z)=>["\nAvailable commands:\n",...Object.keys(Z).map((X)=>`${I1(16)(X)}: ${Z[X].desc}`),"\n"].join("\n");import{existsSync as R5,mkdirSync as E5,statSync as pZ} from"fs";import{dirname as S5} from"path";var L5=(Z)=>Z.length>0&&!R5(Z)?(E5(Z,{recursive:!0}),!0):!1,t0=(Z)=>L5(S5(Z));var v=(Z)=>typeof Z==="function";var M=(Z)=>typeof Z==="string";import{readFileSync as v5} from"fs";import{writeFileSync as A5} from"fs";var r0=(Z,X,J,W,B=!1)=>{if(W&&W.info(`${B?"[dryrun] ":""}writing file: ${Z}`),B)return;t0(Z),A5(Z,X,!J&&M(X)?"utf-8":J)};var N=(Z,X,J="utf-8")=>{return X&&X.debug("reading file:",Z),v5(Z,J)},Y0=(Z,X,J,W=!1)=>r0(Z,O(X)?X.join("\n"):X,"utf-8",J,W);var n=(Z,X)=>JSON.parse(N(Z,X));var y=Symbol(),z0=()=>{};var F1=Object.freeze({level:w.NONE,addChild(Z){return Z},childLogger:()=>F1,enabled:()=>!1,fine(){},debug(){},info(){},warn(){},severe(){},logEntry(){}});class Q0 extends $1{set(Z){this.parent=Z}childLogger(Z,X){return new Q0(Z,X??this.level,this)}logEntry(Z){this.parent.logEntry(Z)}}var c0=new Q0("root",w.FINE,F1);import{join as w8} from"path";var _5=E(()=>"Assertion failed"),L1=(typeof process!=="undefined"&&process.env!==void 0?!0:import.meta.env?import.meta.env.MODE!=="production"||!!import.meta.env.UMBRELLA_ASSERTS||!!import.meta.env.VITE_UMBRELLA_ASSERTS:!0)?(Z,X)=>{if(typeof Z==="function"&&!Z()||!Z)throw new _5(typeof X==="function"?X():X)}:()=>{};var A1=(Z)=>Z!=null&&typeof Z!=="function"&&Z.length!==void 0;var s0=(Z)=>{return(Z==null||!Z[Symbol.iterator])&&$(`value is not iterable: ${Z}`),Z};var e0=(Z)=>A1(Z)?Z:[...s0(Z)];var w1=(Z)=>Z[Z.length-1];var y5=E(()=>"illegal arity"),X1=(Z)=>{throw new y5(Z)};var h5=E(()=>"illegal state"),J1=(Z)=>{throw new h5(Z)};var v1=(Z,X)=>Z!=null&&typeof Z[X]==="function";var T=(Z)=>Z!=null&&typeof Z[Symbol.iterator]==="function";var _1=(Z)=>Z!=null&&typeof Z!=="string"&&typeof Z[Symbol.iterator]==="function";var Z4=["-moz-","-ms-","-o-","-webkit-"],l={rules:"",ruleSep:",",valSep:"",decls:"",declStart:"{",declEnd:"}",indent:"",comments:!1},P1={rules:"\n",ruleSep:", ",valSep:" ",decls:"\n",declStart:" {\n",declEnd:"}\n",indent:" ",comments:!0};var V0=function(...Z){let[X,J,W,B,Y,Q,z,V,U,q]=Z;switch(Z.length){case 0:X1(0);case 1:return X;case 2:return(...H)=>X(J(...H));case 3:return(...H)=>X(J(W(...H)));case 4:return(...H)=>X(J(W(B(...H))));case 5:return(...H)=>X(J(W(B(Y(...H)))));case 6:return(...H)=>X(J(W(B(Y(Q(...H))))));case 7:return(...H)=>X(J(W(B(Y(Q(z(...H)))))));case 8:return(...H)=>X(J(W(B(Y(Q(z(V(...H))))))));case 9:return(...H)=>X(J(W(B(Y(Q(z(V(U(...H)))))))));case 10:default:const K=(...H)=>X(J(W(B(Y(Q(z(V(U(q(...H))))))))));return Z.length===10?K:V0(K,...Z.slice(10))}};var p=(Z)=>v1(Z,"xform")?Z.xform():Z;var h=function(...Z){return Z=Z.map(p),V0.apply(null,Z)};var W1=(Z,X)=>[Z[0],Z[1],X];class U0{value;constructor(Z){this.value=Z}deref(){return this.value}}var b=(Z)=>Z instanceof U0;var m=(Z)=>Z instanceof U0?Z.deref():Z;var y1=function(...Z){const X=Z[0],J=X[0],W=X[1],B=X[2];Z=m5(Z);const Y=Z[0]==null?J():Z[0],Q=Z[1];return m(W(v1(Q,"$reduce")?Q.$reduce(B,Y):A1(Q)?f5(B,Y,Q):u5(B,Y,Q)))};var m5=(Z)=>Z.length===2?[void 0,Z[1]]:Z.length===3?[Z[1],Z[2]]:X1(Z.length),f5=(Z,X,J)=>{for(let W=0,B=J.length;W<B;W++)if(X=Z(X,J[W]),b(X)){X=X.deref();break}return X},u5=(Z,X,J)=>{for(let W of J)if(X=Z(X,W),b(X)){X=X.deref();break}return X},B1=(Z,X)=>[Z,(J)=>J,X];var h1=function(Z){return Z?[...Z]:B1(()=>[],(X,J)=>(X.push(J),X))};function*m1(Z,X){const J=p(Z)(h1()),W=J[1],B=J[2];for(let Y of X){const Q=B([],Y);if(b(Q)){yield*m(W(Q.deref()));return}if(Q.length)yield*Q}yield*m(W([]))}function*o(Z,X){const J=p(Z)([z0,z0,(W,B)=>B])[2];for(let W of X){let B=J(y,W);if(b(B)){if(B=m(B.deref()),B!==y)yield B;return}if(B!==y)yield B}}var f1=(Z,X,J=o)=>{const W=X.length-1;return T(X[W])?X.length>1?J(Z.apply(null,X.slice(0,W)),X[W]):J(Z(),X[0]):void 0};var q0=function(Z,X){return T(X)?m1(q0(Z),M(X)?[X]:X):(J)=>{const W=J[2],B=(Y,Q)=>{const z=Z(Q);if(z){for(let V of z)if(Y=B(Y,V),b(Y))break;return Y}return W(Y,Q)};return W1(J,B)}};var X4=function(Z){return q0((X)=>_1(X)?X:void 0,Z)};var P=function(Z,X){return T(X)?o(P(Z),X):(J)=>{const W=J[2];return W1(J,(B,Y)=>W(B,Z(Y)))}};function*u1(...Z){const X=Z.length-1;if(X<0)return;const J=new Array(X+1).fill(0),W=Z.map(e0),B=W.reduce((Y,Q)=>Y*Q.length,1);for(let Y=0;Y<B;Y++){const Q=[];for(let z=X;z>=0;z--){const V=W[z];let U=J[z];if(U===V.length)J[z]=U=0,z>0&&J[z-1]++;Q[z]=V[U]}J[X]++,yield Q}}function*J4(Z,X=Infinity){while(X-- >0)yield Z}var K0=function(Z,X){Z=Z||"";let J=!0;return X?[...X].join(Z):B1(()=>"",(W,B)=>(W=J?W+B:W+Z+B,J=!1,W))};var g1=function(...Z){return g5(g1,y1,Z)};var g5=(Z,X,J)=>{let W,B;switch(J.length){case 4:B=J[3],W=J[2];break;case 3:B=J[2];break;case 2:return P((Y)=>Z(J[0],J[1],Y));default:X1(J.length)}return X(p(J[0])(J[1]),W,B)};var x5=new Set,d5=":[",W4=h(X4(),P((Z)=>Z[0]==="&"?Z.substring(1):d5.includes(Z[0])?Z:" "+Z)),n5=(Z,X)=>h(Z,P((J)=>M(J)&&J.startsWith(" .")?J+X:J)),Y1=(Z,X,J,W)=>{const B=J.length,Y=[];let Q,z;const V=(U,q)=>{let K=null;if(O(q))Y1(Z,H0(X,Y),q,W);else if(T(q)&&!M(q))Y1(Z,H0(X,Y),[...q],W);else if((z=v(q))||(K=W.fns[q]))if(!X.length){if(K)return K.apply(null,J.slice(U+1))(Z,W),!0;q(Z,W)}else if(z)V(U,q());else $(`quoted fn ('${q}') only allowed at head position`);else if(S(q))Q=Object.assign(Q||{},q);else if(q!=null)Y.push(q)};for(let U=0;U<B;U++)if(V(U,J[U]))return Z;return Q&&Z.push(l5(X,Y,Q,W)),Z},H0=(Z,X)=>Z.length?[...u1(Z,X)]:X,l5=(Z,X,J,W)=>{const B=W.format,Y=L(W),Q=W.scope?n5(W4,W.scope):W4;return[Y,g1(P((z)=>g1(Q,K0(),O(z)?z:[z]).trim()),K0(B.ruleSep),H0(Z,X)),B.declStart,O1(J,W),Y,B.declEnd].join("")},O1=(Z,X)=>{const J=X.format,W=X.autoprefix||x5,B=L(X,X.depth+1),Y=[];for(let Q in Z)if(Z.hasOwnProperty(Q)){let z=Z[Q];if(v(z))z=z(Z);if(O(z))z=z.map((V)=>O(V)?V.join(" "):V).join(J.ruleSep);if(W.has(Q))for(let V of X.vendors)Y.push(`${B}${V}${Q}:${J.valSep}${z};`);Y.push(`${B}${Q}:${J.valSep}${z};`)}return Y.join(J.decls)+J.decls},L=(Z,X=Z.depth)=>X>1?[...J4(Z.format.indent,X)].join(""):X>0?Z.format.indent:"";var B4=function(Z,...X){const J=X.length===1?X[0]:X.reduce((W,B,Y)=>{return W[Y/(X.length-1)*100|0]=B,W},{});return(W,B)=>{const Y=L(B);B.depth++;const Q=L(B);W.push(`${Y}@keyframes ${Z}${B.format.declStart}`);for(let z in J)if(J.hasOwnProperty(z))W.push([Q,z+"%",B.format.declStart,O1(J[z],B),Q,B.format.declEnd].join(""));return B.depth--,W.push(Y+B.format.declEnd),W}};var Y4=(Z,X=!1)=>(J,W)=>{const B=L(W),Y=L(W,W.depth+1);if(W.format.comments||X)J.push(B+"/*",Z.split("\n").map((Q)=>Y+Q).join("\n"),B+"*/");return J};var x1=(Z,X,J)=>(W,B)=>{const Y=L(B);return W.push(`${Y}${Z} ${p5(X)}${B.format.declStart}`),B.depth++,Y1(W,[],J,B),B.depth--,W.push(Y+B.format.declEnd),W},p5=(Z)=>{if(M(Z))return Z;const X=[];for(let J in Z)if(Z.hasOwnProperty(J)){let W=Z[J];if(W===!0)W=z4.has(J)?J:`(${J})`;else if(W===!1)W=`(not ${z4.has(J)?J:`(${J})`})`;else if(W==="only")W+=" "+J;else W=`(${J}:${W})`;X.push(W)}return X.join(" and ")},z4=new Set(["all","print","screen"]);var i=(Z,X)=>{return X={format:l,vendors:Z4,fns:{},depth:0,...X},O(X.autoprefix)&&(X.autoprefix=new Set(X.autoprefix)),S(Z)?O1(Z,X):v(Z)?Z([],X).join(X.format.rules):Y1([],[],O(Z)?Z:_1(Z)?[...Z]:$("invalid rules"),X).join(X.format.rules)};var Q4=(Z,...X)=>(J,W)=>(J.push(X.length?`@import url(${Z}) ${X.join(W.format.ruleSep)};`:`@import url(${Z});`),J);var z1=(Z,X)=>x1("@media",Z,X);var V4=function(...Z){return(X,J)=>(X.push(Z.length>1?`@namespace ${Z[0]} url(${Z[1]});`:`@namespace url(${Z[0]});`),X)};var U4=(Z,X)=>x1("@supports",Z,X);var a={"@comment":Y4,"@import":Q4,"@keyframes":B4,"@media":z1,"@namespace":V4,"@supports":U4};var q4=4,K4=(Z)=>q4=Z,k=(Z)=>Z===(Z|0)?String(Z):Z.toFixed(q4).replace(/^0./,".").replace(/^-0./,"-.").replace(/0+$/,"");var H4=(Z)=>`${k(Z)}em`,$4=(Z)=>`${k(Z)}ex`;var C4=(Z)=>`${k(Z)}rem`,$0=(Z)=>`${k(Z)}%`,M4=(Z)=>`${k(Z)}px`,F4=(Z)=>`${k(Z)}vh`,w4=(Z)=>`${k(Z)}vw`,P4=(Z)=>`${k(Z)}vmin`,O4=(Z)=>`${k(Z)}vmax`,N4=(Z)=>`${Z|0}ms`,j4=(Z)=>`${k(Z)}s`;var D4=(Z)=>`${k(Z)}deg`,G4=(Z)=>`${k(Z)}rad`,k4=(Z)=>`${k(Z)}turn`,T4=(Z)=>`url(${Z})`;var j=((Z)=>{return Z[Z.IDLE=0]="IDLE",Z[Z.ACTIVE=1]="ACTIVE",Z[Z.DONE=2]="DONE",Z[Z.UNSUBSCRIBED=3]="UNSUBSCRIBED",Z[Z.ERROR=4]="ERROR",Z})(j||{}),R=((Z)=>{return Z[Z.NEVER=0]="NEVER",Z[Z.FIRST=1]="FIRST",Z[Z.LAST=2]="LAST",Z})(R||{});var o5=0,i5=()=>o5++,t=(Z,X)=>!X||!X.id?{...X,id:Z+"-"+i5()}:X;var D=c0.childLogger("rstream");class f{constructor(Z,X){this.wrapped=Z,X=t("sub",{closeIn:R.LAST,closeOut:R.LAST,cache:!0,...X}),this.parent=X.parent,this.id=X.id,this.closeIn=X.closeIn,this.closeOut=X.closeOut,this.cacheLast=X.cache,X.xform&&(this.xform=X.xform(h1()))}id;closeIn;closeOut;parent;__owner;xform;cacheLast;last=y;state=j.IDLE;subs=[];deref(){return this.last!==y?this.last:void 0}getState(){return this.state}setState(Z){this.state=Z}subscribe(Z,X={}){this.ensureState();let J;if(Z instanceof f&&!X.xform)Z.ensureState(),L1(!Z.parent,`sub '${Z.id}' already has a parent`),Z.parent=this,J=Z;else J=new f(Z,{...X,parent:this});return this.subs.push(J),this.setState(j.ACTIVE),J.setState(j.ACTIVE),this.last!=y&&J.next(this.last),J}transform(...Z){let X,J;if(S(w1(Z)))J=Z.pop(),X={error:J.error};return this.subscribe(X,t("xform",Z.length>0?{...J,xform:h(...Z)}:J))}map(Z,X){return this.transform(P(Z),X||{})}unsubscribe(Z){return Z?this.unsubscribeChild(Z):this.unsubscribeSelf()}unsubscribeSelf(){return D.debug(this.id,"unsub self"),this.parent&&this.parent.unsubscribe(this),this.state<j.UNSUBSCRIBED&&(this.state=j.UNSUBSCRIBED),this.release(),!0}unsubscribeChild(Z){D.debug(this.id,"unsub child",Z.id);const X=this.subs.indexOf(Z);if(X>=0){if(this.subs.splice(X,1),this.closeOut===R.FIRST||!this.subs.length&&this.closeOut!==R.NEVER)this.unsubscribe();return!0}return!1}next(Z){if(this.state>=j.DONE)return;this.xform?this.dispatchXform(Z):this.dispatch(Z)}done(){if(D.debug(this.id,"entering done()"),this.state>=j.DONE)return;if(this.xform){if(!this.dispatchXformDone())return}if(this.state=j.DONE,this.dispatchTo("done"))this.state<j.UNSUBSCRIBED&&this.unsubscribe();D.debug(this.id,"exiting done()")}error(Z){const X=this.wrapped,J=X&&X.error;return J&&D.debug(this.id,"attempting wrapped error handler"),J&&X.error(Z)||this.unhandledError(Z)}unhandledError(Z){return(D.parent!==F1?D:console).warn(this.id,"unhandled error:",Z),this.unsubscribe(),this.state=j.ERROR,!1}dispatchTo(Z,X){let J=this.wrapped;if(J)try{J[Z]&&J[Z](X)}catch(B){if(!this.error(B))return!1}const W=Z==="next"?this.subs:[...this.subs];for(let B=W.length;B-- >0;){J=W[B];try{J[Z]&&J[Z](X)}catch(Y){if(Z==="error"||!J.error||!J.error(Y))return this.unhandledError(Y)}}return!0}dispatch(Z){D.debug(this.id,"dispatch",Z),this.cacheLast&&(this.last=Z),this.dispatchTo("next",Z)}dispatchXform(Z){let X;try{X=this.xform[2]([],Z)}catch(J){this.error(J);return}if(this.dispatchXformVals(X))b(X)&&this.done()}dispatchXformDone(){let Z;try{Z=this.xform[1]([])}catch(X){return this.error(X)}return this.dispatchXformVals(Z)}dispatchXformVals(Z){const X=m(Z);for(let J=0,W=X.length;J<W&&this.state<j.DONE;J++)this.dispatch(X[J]);return this.state<j.ERROR}ensureState(){if(this.state>=j.DONE)J1(`operation not allowed in state ${this.state}`)}release(){this.subs.length=0,delete this.parent,delete this.xform,delete this.last}}var b4=(Z,X)=>{const J=new I4(X);return J.next(Z),J};class I4 extends f{src;_cancel;_inited;constructor(Z,X){const[J,W]=v(Z)?[Z,X||{}]:[void 0,Z||{}];super(W.error?{error:W.error}:void 0,t("stream",W));this.src=J,this._inited=!1}subscribe(Z,X={}){const J=super.subscribe(Z,X);if(!this._inited){if(this.src)try{this._cancel=this.src(this)||(()=>{return})}catch(W){let B=this.wrapped;if(!B||!B.error||!B.error(W))this.unhandledError(W)}this._inited=!0}return J}unsubscribe(Z){const X=super.unsubscribe(Z);if(X&&(!Z||(!this.subs||!this.subs.length)&&this.closeOut!==R.NEVER))this.cancel();return X}done(){this.cancel(),super.done(),delete this.src,delete this._cancel}error(Z){if(super.error(Z))return!0;return this.cancel(),!1}cancel(){if(this._cancel){D.debug(this.id,"cancel");const Z=this._cancel;delete this._cancel,Z()}}}var R4=(Z,X)=>Z===R.FIRST||Z===R.LAST&&!X;var C0=function(Z){return Z?y1(C0(),Z):B1(()=>({}),(X,[J,W])=>(X[J]=W,X))};var M0=function(Z,X){return T(X)?o(M0(Z),X):P(v(Z)?(J)=>[Z(J),J]:(J)=>[Z,J])};var F0=function(...Z){const X=f1(F0,Z);if(X)return X;const J=Z[0],W=Z[1]!==!1;return P((B)=>{const Y=W?{}:B;for(let Q in B)Y[Q]=J(B[Q]);return Y})};var E4=(Z)=>Z;var w0=function(...Z){const X=f1(w0,Z,m1);if(X)return X;const{key:J=E4,mergeOnly:W=!1,reset:B=!0,all:Y=!0,backPressure:Q=0}=Z[1],z=O(Z[0])?new Set(Z[0]):Z[0],V=new Set,U=new Map;let q={};const K=([H,F,A])=>{let g=!0;if(W||Q<1)return[H,(C)=>{if(B&&Y&&V.size>0||!B&&g)C=A(C,q),q={},V.clear(),g=!1;return F(C)},(C,x)=>{const G=J(x);if(z.has(G)){if(q[G]=x,V.add(G),W||S4(z,V))if(C=A(C,q),g=!1,B)q={},V.clear();else q={...q}}return C}];else return[H,(C)=>{if(Y&&V.size>0)C=A(C,L4(U,V)),U.clear(),V.clear();return F(C)},(C,x)=>{const G=J(x);if(z.has(G)){let _=U.get(G);!_&&U.set(G,_=[]),_.length>=Q&&J1(`max back pressure (${Q}) exceeded for input: ${String(G)}`),_.push(x),V.add(G);while(S4(z,V))if(C=A(C,L4(U,V)),g=!1,b(C))break}return C}]};return K.keys=()=>z,K.clear=()=>{U.clear(),z.clear(),V.clear(),q={}},K.add=(H)=>{z.add(H)},K.delete=(H,F=!0)=>{if(U.delete(H),z.delete(H),F)V.delete(H),delete q[H]},K},S4=(Z,X)=>{if(X.size<Z.size)return!1;for(let J of Z)if(!X.has(J))return!1;return!0},L4=(Z,X)=>{const J={};for(let W of X){const B=Z.get(W);J[W]=B.shift(),!B.length&&X.delete(W)}return J};var A4=(Z,X)=>{let J=!0;for(let W of X)J=Z.removeID(W)&&J;return J};var d1=(Z)=>new v4(Z);class v4 extends f{sources;idSources;realSourceIDs;invRealSourceIDs;psync;clean;constructor(Z){const X=w0(new Set,{key:(W)=>W[0],mergeOnly:Z.mergeOnly===!0,reset:Z.reset===!0,all:Z.all!==!1,backPressure:Z.backPressure||0}),J=F0((W)=>W[1]);super(void 0,t("streamsync",{...Z,xform:Z.xform?h(X,J,Z.xform):h(X,J)}));this.sources=new Map,this.realSourceIDs=new Map,this.invRealSourceIDs=new Map,this.idSources=new Map,this.psync=X,this.clean=!!Z.clean,Z.src&&this.addAll(Z.src)}add(Z,X){X||(X=Z.id),this.ensureState(),this.psync.add(X),this.realSourceIDs.set(X,Z.id),this.invRealSourceIDs.set(Z.id,X),this.idSources.set(Z.id,Z),this.sources.set(Z,Z.subscribe({next:(J)=>J[1]instanceof f?this.add(J[1]):this.next(J),done:()=>this.markDone(Z),__owner:this},{xform:M0(X),id:`in-${X}`}))}addAll(Z){for(let X in Z)this.psync.add(X);for(let X in Z)this.add(Z[X],X)}remove(Z){const X=this.sources.get(Z);if(X){const J=this.invRealSourceIDs.get(Z.id);return D.info(`removing src: ${Z.id} (${J})`),this.psync.delete(J,this.clean),this.realSourceIDs.delete(J),this.invRealSourceIDs.delete(Z.id),this.idSources.delete(Z.id),this.sources.delete(Z),X.unsubscribe(),!0}return!1}removeID(Z){const X=this.getSourceForID(Z);return X?this.remove(X):!1}removeAll(Z){for(let J of Z)this.psync.delete(this.invRealSourceIDs.get(J.id));let X=!0;for(let J of Z)X=this.remove(J)&&X;return X}removeAllIDs(Z){return A4(this,Z)}getSourceForID(Z){return this.idSources.get(this.realSourceIDs.get(Z))}getSources(){const Z={};for(let[X,J]of this.idSources)Z[this.invRealSourceIDs.get(X)]=J;return Z}unsubscribe(Z){if(!Z){D.debug(this.id,"unsub sources");for(let X of this.sources.values())X.unsubscribe();this.sources.clear(),this.psync.clear(),this.realSourceIDs.clear(),this.invRealSourceIDs.clear(),this.idSources.clear()}return super.unsubscribe(Z)}markDone(Z){this.remove(Z),R4(this.closeIn,this.sources.size)&&this.done()}}var P0=s((Z,X=" ")=>{const J=e(String(X),Z);return(W,B)=>{if(W==null)return J;return W=W.toString(),B=B!==void 0?B:W.length,B<Z?J.substring(B)+W:W}}),$J=P0(2,"0"),CJ=P0(3,"0"),_4=P0(4,"0");var a5=/\{(\d+)\}/g;var O0=(Z,...X)=>X.length>0?Z.replace(a5,(J,W)=>String(X[parseInt(W,10)])):Z;var N0=function(Z,X){return T(X)?o(N0(Z),X):(J)=>{const W=J[2];return W1(J,(B,Y)=>Z(Y)?W(B,Y):B)}};import{watch as u4} from"fs";import{resolve as r} from"path";var y4={specs:d({alias:"s",optional:!1,desc:"Path to generated JSON defs"})},n1={bundle:I({alias:"b",desc:"Bundle inputs (see `out` option)"})},Q1={include:T1({alias:"I",desc:"Include CSS files (prepend)"})},l1={eval:d({alias:"e",desc:"eval meta stylesheet in given string (ignores other inputs & includes)"})},p1={force:T1({alias:"f",hint:"STR",desc:"CSS classes to force include (wildcards are supported, @-prefix will read from file)",delim:","})},h4={media:T1({alias:"m",hint:"ID",desc:"Media query IDs (use 'ALL' for all)",delim:","})},m4={onlyDecls:I({desc:"Only emit framework decls"})},V1={out:d({alias:"o",desc:"Output file (or stdout)"})},o1={prec:L0({default:3,desc:"Number of fractional digits"})},u={pretty:I({alias:"p",desc:"Pretty print output"})},U1={noDecls:I({alias:"d",desc:"Don't emit framework decls"})},q1={noHeader:I({desc:"Don't emit generated header comment"})},K1={watch:I({alias:"w",desc:"Watch input files for changes"})};import{watch as t5} from"fs";import{resolve as f4} from"path";var H1=(Z,X,J)=>{X=M(X)?X:X.join("\n"),Z?Y0(f4(Z),X,J):process.stdout.write(X+"\n")},i1=({info:{name:Z,version:X}})=>`/*! ${Z} v${X} - generated by thi.ng/meta-css @ ${(new Date()).toISOString()} */`,N1=(Z,X)=>{const J=()=>{X.info("closing watchers..."),W.forEach((B)=>B.watcher.close())},W=Z.map((B,Y)=>{B=f4(B);const Q=b4(N(B,X),{id:`in${_4(Y)}`});return{input:Q,watcher:t5(B,{},(z)=>{if(z==="change")try{Q.next(N(B,X))}catch(V){X.warn(V.message),J()}else X.warn("input removed:",B),J()})}});return process.on("SIGINT",J),d1({src:C0(P(({input:B})=>[B.id,B],W))})},a1=(Z)=>Object.keys(Z).reduce((X,J)=>{if(!J.startsWith("__"))X[J]=Z[J];return X},{});async function D0(Z){const X=n(r(Z.opts.specs),Z.logger),J=Z8(X,Z.opts.force||[],Z.logger);if(Z.opts.bundle)if(Z.opts.watch)await c5(Z,J);else j1(Z,X,J,Z.opts.eval?[Z.opts.eval]:Z.inputs.map((W)=>N(r(W),Z.logger)),Z.opts.out);else if(Z.opts.watch)await r5(Z,X,J);else if(Z.opts.eval)try{j1(Z,X,J,[Z.opts.eval])}catch(W){Z.logger.warn(W.message)}else for(let W of Z.inputs)try{W=r(W);const B=!Z.opts.noWrite?W.replace(/\.mcss$/,".css"):void 0;j1(Z,X,J,[N(W,Z.logger)],B)}catch(B){Z.logger.warn(B.message)}}function*J8(Z){let X=-1,J=Z.length,W=0;for(let B=0;B<J;B++){const Y=Z[B];if(Y===" "||Y==="\t"){if(!W&&X>=0)yield Z.substring(X,B),X=-1}else if(Y==="{"||Y==="}"){if(X>=0)yield Z.substring(X,B);yield Y,X=-1}else if(Y==="(")W++;else if(Y===")"){if(--W<0)$(`invalid nesting in line: '${Z}'`)}else if(X<0)X=B}if(W)$("template calls must be fully on a single line");if(X>=0)yield Z.substring(X,J)}var x4={desc:"Transpile (and optionally bundle) meta stylesheets to CSS",opts:{...n1,...l1,...U1,...p1,...Q1,...q1,...V1,...u,...y4,...K1,noWrite:I({desc:"Don't write files, use stdout only"})},fn:D0},r5=async(Z,X,J)=>{const W=r(Z.opts.specs);let B,Y={process:()=>{try{return X=n(W,Z.logger),B.forEach((z)=>z.process()),!0}catch(z){return Z.logger.warn(z.message+": "+W),!1}},watcher:u4(W,{},(z)=>{if(z==="change")Y.process();else Z.logger.warn("specs file removed:",W),Q()})};const Q=()=>{Z.logger.info("closing watchers..."),Y.watcher.close(),B.forEach((z)=>z.watcher.close())};B=Z.inputs.map((z)=>{z=r(z);const V=!Z.opts.noWrite?z.replace(/\.mcss$/,".css"):void 0,U=()=>{try{return j1(Z,X,J,[N(z,Z.logger)],V),!0}catch(q){if(Z.logger.warn(q.message+": "+z),B)Q();return!1}};if(!U())process.exit(1);return{process:U,watcher:u4(z,{},(q)=>{if(q==="change")U();else Z.logger.warn("input removed:",z),Q()})}}),Z.logger.info("waiting for changes, press ctrl+c to cancel..."),process.on("SIGINT",Q)},c5=async(Z,X)=>{d1({src:{styles:N1(Z.inputs,Z.logger),specs:N1([Z.opts.specs],Z.logger).map((J)=>JSON.parse(Object.values(J)[0]))}}).subscribe({next({styles:J,specs:W}){try{j1(Z,W,X,Object.keys(J).sort().map((B)=>J[B]),Z.opts.out)}catch(B){Z.logger.warn(B.message)}}})},j1=({logger:Z,opts:{include:X,noDecls:J,noHeader:W,pretty:B}},Y,Q,z,V)=>{const U={logger:Z,specs:Y,format:B?P1:l,mediaQueryIDs:new Set(Object.keys(Y.media)),mediaQueryRules:{...Q.mediaQueryRules},plainRules:{...Q.plainRules}},q=X?X.map((K)=>N(r(K),Z).trim()):[];if(!W)q.push(i1(Y));if(!J&&Y.decls.length)q.push(i(Y.decls,{format:U.format,fns:a}));z.forEach((K)=>X8(K,U)),e5(q,U),s5(q,U),H1(V,q,Z)},s5=(Z,{logger:X,specs:J,format:W,mediaQueryRules:B})=>{for(let Y in B){const Q=n4(B[Y],J);X.debug("mediaquery rules",Y,Q),Z.push(i(z1(Y8(J.media,Y),Q),{format:W,fns:a}))}},e5=(Z,{logger:X,specs:J,format:W,plainRules:B})=>{const Y=n4(B,J);X.debug("plain rules",Y),Z.push(i(Y,{format:W,fns:a}))},Z8=(Z,X,J)=>{const W=new Set(Object.keys(Z.media)),B=new Set(Object.keys(Z.classes)),Y={},Q={};if(X.length&&X[0][0]==="@")X=[...Z1(N(r(X[0].substring(1)),J))];for(let z of X){if(!z||z.startsWith("//"))continue;const{token:V,query:U}=l4(z,W);let q;if(V.includes("*")){const K=new RegExp(`^${V.replace("*",".*")}\$`);q=[...N0((H)=>K.test(H),B)]}else if(B.has(V))q=[V];else{J.warn(`unknown include rule ID: ${z}, skipping...`);continue}for(let K of q)J.debug("including class:",K),U?p4(Y,U,`.${K}`,K):o4(Q,`.${K}`,K)}return{mediaQueryRules:Y,plainRules:Q}},X8=(Z,{specs:X,mediaQueryIDs:J,mediaQueryRules:W,plainRules:B})=>{const Y=D1(),Q=D1(Y),z={root:Y,curr:Q,scopes:[Q]};for(let V of Z1(Z)){if(!V||/^\s*\/\//.test(V))continue;for(let U of J8(V)){if(!U)continue;let q=z.curr;switch(q.state){case"sel":case"nest":if(U==="{"){if(q.state==="sel")q.sel=q.sel.map((K)=>K.replace(",","")),q.path=W8(z.scopes);q.state="class"}else if(U==="}")g4(z);else{const K=w1(q.sel);if(!K||K.endsWith(","))q.sel.push(U);else q.sel[q.sel.length-1]+=" "+U}break;case"class":if(U==="{")q.state="nest",z.scopes.push(z.curr=D1(q));else if(U==="}")g4(z);else{let{token:K,query:H}=l4(U,J);if(!X.classes[K]&&!(i4(K)||a4(K)))$(`unknown class ID: ${K}`);if(H)p4(W,H,q.path,K);else o4(B,q.path,K)}break;default:J1(q.state)}}}},j0=":",d4="///",D1=(Z)=>({state:"sel",sel:Z?[]:["<root>"],path:"",parent:Z}),g4=(Z)=>{const X=!Z.curr.sel.length;if(L1(!!Z.curr.parent,"stack underflow"),Z.scopes.pop(),Z.scopes.length>0){if(Z.curr=w1(Z.scopes),!X&&Z.curr.state==="nest")Z.scopes.push(Z.curr=D1(Z.curr))}else Z.scopes.push(Z.curr=D1(Z.root))},W8=(Z)=>Z.map((X)=>X.sel.join(",")).join(d4),n4=(Z,X)=>Object.entries(Z).map(([J,W])=>B8(J,W,X)),B8=(Z,X,J)=>{const W=[];let B=W;const Y=Z.split(d4);for(let Q=0;Q<Y.length;Q++){const z=Y[Q].split(",");if(Q==Y.length-1){const V=Object.assign({},...P((U)=>a4(U)?Q8(J,U):i4(U)?z8(U):a1(J.classes[U]),X));z.push(V)}B.push(z),B=z}return W[0]},l4=(Z,X)=>{if(/^::?/.test(Z))return{token:Z};const J=Z.lastIndexOf(j0);if(J<0)return{token:Z};const W=Z.substring(0,J);if(!W.split(j0).every((Y)=>X.has(Y)))$(`invalid media query in token: ${Z}`);return{token:Z.substring(J+1),query:W}},Y8=(Z,X)=>X.split(j0).reduce((J,W)=>Object.assign(J,Z[W]),{}),p4=(Z,X,J,W)=>{if(!Z[X])Z[X]={};(Z[X][J]||(Z[X][J]=new Set)).add(W)},o4=(Z,X,J)=>(Z[X]||(Z[X]=new Set)).add(J),z8=(Z)=>{const X=Z.indexOf("=");return{[`--${Z.substring(0,X)}`]:Z.substring(X+1)}},Q8=(Z,X)=>{const J=X.indexOf("("),W=X.substring(0,J),B=X.substring(J+1,X.length-1).split(/(?<!\\),/g).map((Q)=>Q.trim().replace("\\,",",")),Y=Z.templates[W];if(!Y)$(`unknown template: ${W}`);if(B.length!==Y.__arity)$(`template "${W}" expected ${Y.__arity} arguments`);return Object.entries(Y).reduce((Q,[z,V])=>{if(!z.startsWith("__")){if(z=O0(z,...B),M(V))V=O0(V,...B);Q[z]=V}return Q},{})},i4=(Z)=>Z.includes("="),a4=(Z)=>Z.includes("(");async function G0(Z){if(Z.opts.watch)await q8(Z);else await s4(Z.inputs.map((X)=>N(X,Z.logger)),Z.opts,Z.logger)}var r4={deg:D4,em:H4,ex:$4,ms:N4,percent:$0,px:M4,rad:G4,rem:C4,second:j4,turn:k4,url:T4,vh:F4,vmax:O4,vmin:P4,vw:w4,"%":$0},V8={percent:"{0}%",second:"{0}s",url:"url({0})"},U8={"":[""],a:[""],h:["-left","-right"],v:["-top","-bottom"],t:["-top"],top:["top"],b:["-bottom"],bottom:["bottom"],r:["-right"],right:["right"],l:["-left"],left:["left"],x:["-x"],y:["-y"],in:[""],out:[""]},c4={desc:"Generate framework rules from specs",opts:{...V1,...o1,...u,...K1},fn:G0},q8=async(Z)=>{N1(Z.inputs,Z.logger).subscribe({next(X){try{s4(Object.keys(X).sort().map((J)=>X[J]),Z.opts,Z.logger)}catch(J){Z.logger.warn(J.message)}}})},s4=async(Z,X,J)=>{const W={info:{name:"TODO",version:"0.0.0"},media:{},classes:{},templates:{},decls:[]};K4(X.prec);for(let B of Z){const Y=JSON.parse(B);if(Object.assign(W.info,Y.info),Object.assign(W.media,Y.media),Y.decls)W.decls.push(...Y.decls);if(Y.specs)for(let Q of Y.specs)try{e4(Y,Q,W.classes,J)}catch(z){J.warn(`error processing spec: ${Q.name}`,z,", skipping...")}if(Y.templates)for(let Q of Y.templates)K8(Y,Q,W.templates,J)}return H1(X.out,JSON.stringify(W,null,X.pretty?4:0),J),W},e4=(Z,X,J,W,B=!1)=>{const Y=O(X.vars)?X.vars:[""],Q=M(X.props)?{[X.props]:"<v>"}:X.props,z=H8(X,Z),V=new Set;for(let U of Y){const q=Z.vars?.[U]||U8[U];if(!q)$(`unknown variation ID: ${U}`);for(let[K,H]of u1(q,Object.keys(z))){const F=c(X.name,U,K,H,z[H]),A=X.unit?c(X.unit,U,K,H,z[H]):void 0,g=B?C8(A):$8(z[H],A);if(!J[F]){if(J[F]={},X.user!=null)J[F].__user=X.user;if(X.doc!=null)J[F].__doc=M8(X.doc,U,K,H,g)}else if(!V.has(F))$(`duplicate class ID: ${F}`);V.add(F);let C=-1;for(let[x,G]of Object.entries(Q)){const _=c(x,U,K,H,z[H]),t1=c(!A||M(G)?String(G):r4[A](G),U,K,H,g);if(J[F][_]=t1,W.debug(F,_,t1),B)C=t4(t1,t4(_,C))}if(B)J[F].__arity=C+1}}return J},K8=(Z,X,J,W)=>e4(Z,{...X,values:[""]},J,W,!0),t4=(Z,X)=>{const J=/\{(\d+)\}/g;let W;while(W=J.exec(Z))X=Math.max(X,+W[1]);return X},H8=(Z,X)=>{const J=M(Z.values)?X.tables?.[Z.values]||$(`invalid table ID: ${Z.values}`):Z.values;if(S(J))return J;const W=Z.key==="v"?(B)=>String(B):Z.key==="i+1"?(B,Y)=>String(Y+1):Z.key===void 0?(B,Y)=>String(Y):$(`invalid key type: ${Z.key}`);return J.reduce((B,Y,Q)=>{return B[W(Y,Q)]=Y,B},{})},$8=(Z,X)=>{if(!X||M(Z))return Z;const J=r4[X];if(!J)$(`invalid unit: ${X}`);return J(Z)},C8=(Z)=>Z?V8[Z]||"{0}"+Z:"{0}",c=(Z,X,J,W,B)=>Z.replace(/<vid>/g,X).replace(/<var>/g,J).replace(/<k>/g,W).replace(/<v>/g,String(B)),M8=({group:Z,desc:X,args:J},W,B,Y,Q)=>({group:Z?c(Z,W,B,Y,Q):"TODO",desc:X?c(X,W,B,Y,Q):void 0,args:J?J.map((z)=>c(z,W,B,Y,Q)):void 0});var Z5={desc:"Combination of the generate & convert commands",opts:{...n1,...l1,...p1,...Q1,...U1,...q1,...o1,...u,...K1,outCss:d({desc:"Output file for CSS bundle",optional:!1}),outSpecs:d({desc:"Output file for framework",optional:!1})},fn:async(Z)=>{const{opts:X,inputs:J}=Z,[W,B]=J.reduce((z,V)=>(z[V.endsWith(".json")?0:1].push(V),z),[[],[]]),Y={inputs:W,format:Z.format,logger:Z.logger,opts:{...X,out:X.outSpecs}},Q={inputs:B,format:Z.format,logger:Z.logger,opts:{...X,noWrite:!1,out:X.outCss,specs:X.outSpecs}};await G0(Y),await D0(Q)}};import{resolve as X5} from"path";var W5={desc:"Export entire generated framework as CSS",opts:{...Q1,...U1,...m4,...V1,...u,...q1,...h4},inputs:1,fn:async(Z)=>{const{logger:X,opts:{include:J,media:W,noDecls:B,noHeader:Y,onlyDecls:Q,pretty:z,out:V},inputs:U}=Z,q=n(X5(U[0]),X),K=J?J.map((H)=>N(X5(H),X).trim()):[];if(!Y)K.push(i1(q));if(!B&&q.decls.length)K.push(i(q.decls,{format:z?P1:l,fns:a}));if(!Q)K.push(F8(q,W,z,X));H1(V,K,X)}},F8=(Z,X,J,W)=>{const B=J5("",Z);if(X){const Y=X[0]==="ALL"?Object.keys(Z.media):X;for(let Q of Y)if(Z.media[Q])B.push(z1(Z.media[Q],J5("-"+Q,Z)));else W.warn(`invalid media query ID: ${Q}, skipping...`)}return i(B,{format:J?P1:l,fns:a})},J5=(Z,X)=>Object.entries(X.classes).map(([J,W])=>[`.${J}${Z}`,a1(W)]);var k0=n(w8(import.meta.dir,"package.json"));a0({name:"metacss",opts:{verbose:I({alias:"v",desc:"Display extra process information"})},commands:{convert:x4,develop:Z5,export:W5,generate:c4},ctx:async(Z)=>{if(Z.opts.verbose)Z.logger.level=w.DEBUG;return{...Z,format:E1}},usage:{prefix:`
6
6
  \u2588 \u2588 \u2588 \u2502
7
7
  \u2588\u2588 \u2588 \u2502
8
8
  \u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2502 ${k0.name} ${k0.version}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/meta-css",
3
- "version": "0.8.1",
3
+ "version": "0.9.1",
4
4
  "description": "Data-driven CSS framework codegen, transpiler & bundler",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -40,17 +40,17 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@thi.ng/api": "^8.9.30",
43
- "@thi.ng/args": "^2.3.25",
44
- "@thi.ng/arrays": "^2.8.10",
43
+ "@thi.ng/args": "^2.3.27",
44
+ "@thi.ng/arrays": "^2.8.11",
45
45
  "@thi.ng/checks": "^3.5.4",
46
46
  "@thi.ng/errors": "^2.5.1",
47
- "@thi.ng/file-io": "^1.3.10",
48
- "@thi.ng/hiccup-css": "^2.6.13",
47
+ "@thi.ng/file-io": "^1.3.11",
48
+ "@thi.ng/hiccup-css": "^2.7.0",
49
49
  "@thi.ng/logger": "^3.0.6",
50
- "@thi.ng/rstream": "^8.3.15",
51
- "@thi.ng/strings": "^3.7.25",
50
+ "@thi.ng/rstream": "^8.3.16",
51
+ "@thi.ng/strings": "^3.7.27",
52
52
  "@thi.ng/text-format": "^2.1.8",
53
- "@thi.ng/transducers": "^8.9.14"
53
+ "@thi.ng/transducers": "^8.9.15"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@microsoft/api-extractor": "^7.42.3",
@@ -107,5 +107,5 @@
107
107
  "status": "alpha",
108
108
  "year": 2023
109
109
  },
110
- "gitHead": "4b3d4ab6ce373ca817ad780f679572169a9ed733\n"
110
+ "gitHead": "16686bb40f7bd7a14a5d1304e353a82cb0069a1a\n"
111
111
  }
@@ -10,6 +10,10 @@
10
10
  { "height": 0 }
11
11
  ]
12
12
  ],
13
+ "vars": {
14
+ "anim": ["animation"],
15
+ "transition": ["transition"]
16
+ },
13
17
  "specs": [
14
18
  {
15
19
  "doc": {
@@ -31,9 +35,26 @@
31
35
  "group": "animation / transition",
32
36
  "desc": "timing function"
33
37
  },
34
- "name": "anim-<v>",
35
- "props": "animation-timing-function",
36
- "values": ["ease", "ease-in", "ease-out", "ease-in-out", "linear"]
38
+ "name": "<vid>-<v>",
39
+ "props": "<var>-timing-function",
40
+ "values": ["ease", "ease-in", "ease-out", "ease-in-out", "linear"],
41
+ "vars": ["anim", "transition"]
42
+ },
43
+ {
44
+ "doc": {
45
+ "group": "animation / transition",
46
+ "desc": "<v>"
47
+ },
48
+ "name": "transition-<k>",
49
+ "props": "transition-property",
50
+ "values": {
51
+ "all": "all",
52
+ "bg": "background-color",
53
+ "color": "color",
54
+ "none": "none",
55
+ "width": "width",
56
+ "height": "height"
57
+ }
37
58
  }
38
59
  ],
39
60
  "templates": [
@@ -80,22 +101,35 @@
80
101
  "animation": "shrink {0}s ease-out forwards"
81
102
  }
82
103
  },
104
+ {
105
+ "doc": {
106
+ "group": "animation / transition",
107
+ "args": ["duration: time (in seconds)"]
108
+ },
109
+ "name": "<vid>-duration",
110
+ "props": "<var>-duration",
111
+ "unit": "second",
112
+ "vars": ["anim", "transition"]
113
+ },
83
114
  {
84
115
  "doc": {
85
116
  "group": "animation / transition",
86
117
  "args": ["delay: time (in seconds)"]
87
118
  },
88
- "name": "anim-delay",
89
- "props": "animation-delay",
90
- "unit": "second"
119
+ "name": "<vid>-delay",
120
+ "props": "<var>-delay",
121
+ "unit": "second",
122
+ "vars": ["anim", "transition"]
91
123
  },
92
124
  {
93
125
  "doc": {
94
126
  "group": "animation / transition",
95
- "args": ["steps: number of steps"]
127
+ "desc": "Sets <var>-timing-function to `steps(num)`",
128
+ "args": ["num: number of steps"]
96
129
  },
97
- "name": "anim-steps",
98
- "props": { "animation-timing-function": "steps({0})" }
130
+ "name": "<vid>-steps",
131
+ "props": { "<var>-timing-function": "steps({0})" },
132
+ "vars": ["anim", "transition"]
99
133
  },
100
134
  {
101
135
  "doc": {
@@ -104,6 +138,23 @@
104
138
  },
105
139
  "name": "anim-iter",
106
140
  "props": "animation-iteration-count"
141
+ },
142
+ {
143
+ "doc": {
144
+ "group": "animation / transition",
145
+ "args": ["body: CSS value/definition"]
146
+ },
147
+ "name": "<vid>",
148
+ "props": "<var>",
149
+ "vars": ["anim", "transition"]
150
+ },
151
+ {
152
+ "doc": {
153
+ "group": "animation / transition",
154
+ "args": ["prop: CSS value/definition"]
155
+ },
156
+ "name": "transition-property",
157
+ "props": "transition-property"
107
158
  }
108
159
  ]
109
160
  }
@@ -21,6 +21,51 @@
21
21
  "nw": "top left",
22
22
  "center": "center"
23
23
  }
24
+ },
25
+ {
26
+ "doc": { "group": "background", "desc": "<v>" },
27
+ "name": "bg-repeat<k>",
28
+ "props": "background-repeat<k>",
29
+ "values": {
30
+ "-x": "repeat-x",
31
+ "-y": "repeat-y",
32
+ "": "repeat",
33
+ "-space": "space",
34
+ "-round": "round",
35
+ "-none": "no-repeat"
36
+ }
37
+ }
38
+ ],
39
+ "templates": [
40
+ {
41
+ "doc": { "group": "background", "args": ["url: image URL"] },
42
+ "name": "bg-image",
43
+ "props": "background-image",
44
+ "unit": "url"
45
+ },
46
+ {
47
+ "doc": {
48
+ "group": "background",
49
+ "args": ["body: CSS value/definition"]
50
+ },
51
+ "name": "bg-pos",
52
+ "props": "background-position"
53
+ },
54
+ {
55
+ "doc": {
56
+ "group": "background",
57
+ "args": ["body: CSS value/definition"]
58
+ },
59
+ "name": "bg-size",
60
+ "props": "background-size"
61
+ },
62
+ {
63
+ "doc": { "group": "background", "args": ["radius: incl. units"] },
64
+ "name": "bg-blur",
65
+ "props": {
66
+ "backdrop-filter": "blur({0})",
67
+ "-webkit-backdrop-filter": "blur({0})"
68
+ }
24
69
  }
25
70
  ]
26
71
  }
@@ -70,5 +70,37 @@
70
70
  "unit": "v<vid>",
71
71
  "vars": ["w", "h"]
72
72
  }
73
+ ],
74
+ "templates": [
75
+ {
76
+ "doc": {
77
+ "group": "dimensions",
78
+ "desc": "Sets <var> to given value",
79
+ "args": ["<var>: incl. units"]
80
+ },
81
+ "name": "<var>",
82
+ "props": "<var>",
83
+ "vars": ["w", "h"]
84
+ },
85
+ {
86
+ "doc": {
87
+ "group": "dimensions",
88
+ "desc": "Sets min-<var> to given value",
89
+ "args": ["<var>: incl. units"]
90
+ },
91
+ "name": "min-<var>",
92
+ "props": "min-<var>",
93
+ "vars": ["w", "h"]
94
+ },
95
+ {
96
+ "doc": {
97
+ "group": "dimensions",
98
+ "desc": "Sets max-<var> to given value",
99
+ "args": ["<var>: incl. units"]
100
+ },
101
+ "name": "max-<var>",
102
+ "props": "max-<var>",
103
+ "vars": ["w", "h"]
104
+ }
73
105
  ]
74
106
  }
@@ -1,6 +1,14 @@
1
1
  {
2
2
  "tables": {
3
- "align": ["start", "end", "center"]
3
+ "align": [
4
+ "start",
5
+ "end",
6
+ "center",
7
+ "space-around",
8
+ "space-between",
9
+ "space-evenly",
10
+ "stretch"
11
+ ]
4
12
  },
5
13
  "vars": {
6
14
  "align": [""],
@@ -48,5 +48,27 @@
48
48
  "unit": "rem",
49
49
  "vars": ["s", "e"]
50
50
  }
51
+ ],
52
+ "templates": [
53
+ {
54
+ "doc": {
55
+ "group": "padding",
56
+ "desc": "Sets padding to custom size",
57
+ "args": ["size: incl. units"]
58
+ },
59
+ "name": "p<vid>",
60
+ "props": "padding<var>",
61
+ "vars": ["a", "h", "v", "t", "r", "b", "l"]
62
+ },
63
+ {
64
+ "doc": {
65
+ "group": "margin",
66
+ "desc": "Sets margin to custom size",
67
+ "args": ["size: incl. units"]
68
+ },
69
+ "name": "m<vid>",
70
+ "props": "margin<var>",
71
+ "vars": ["a", "h", "v", "t", "r", "b", "l"]
72
+ }
51
73
  ]
52
74
  }
@@ -0,0 +1,39 @@
1
+ {
2
+ "vars": {
3
+ "mode": [""],
4
+ "type": [""]
5
+ },
6
+ "specs": [
7
+ {
8
+ "doc": { "group": "mask", "desc": "<v>" },
9
+ "name": "mask-clip-<k>",
10
+ "props": "mask-clip",
11
+ "values": {
12
+ "content": "content-box",
13
+ "padding": "padding-box",
14
+ "border": "border-box",
15
+ "fill": "fill-box",
16
+ "stroke": "stroke-box",
17
+ "view": "view-box",
18
+ "none": "no-clip"
19
+ }
20
+ },
21
+ {
22
+ "doc": { "group": "mask", "desc": "<v>" },
23
+ "name": "mask-<vid>-<v>",
24
+ "props": "mask-<vid>",
25
+ "values": ["alpha", "luminance", "match-source"],
26
+ "vars": ["mode", "type"]
27
+ }
28
+ ],
29
+ "templates": [
30
+ {
31
+ "doc": {
32
+ "group": "mask",
33
+ "args": ["body: definition (e.g. url or gradient)"]
34
+ },
35
+ "name": "mask-image",
36
+ "props": "mask-image"
37
+ }
38
+ ]
39
+ }