@master/css-runtime 2.0.0-rc.15 → 2.0.0-rc.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/global.min.js +1 -0
- package/dist/index.cjs +399 -0
- package/dist/index.mjs +393 -0
- package/package.json +1 -1
- package/dist/iife.bundle.js +0 -1
- package/dist/index.bundle.js +0 -1
- package/dist/index.bundle.mjs +0 -1
- /package/dist/{iife.d.ts → global.min.d.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(){var e,t={},r={},a={"::scrollbar":"::-webkit-scrollbar","::scrollbar-button":"::-webkit-scrollbar-button","::scrollbar-thumb":"::-webkit-scrollbar-thumb","::scrollbar-track":"::-webkit-scrollbar-track","::scrollbar-track-piece":"::-webkit-scrollbar-track-piece","::scrollbar-corner":"::-webkit-scrollbar-corner","::slider-thumb":["::-webkit-slider-thumb","::-moz-range-thumb"],"::slider-runnable-track":["::-webkit-slider-runnable-track","::-moz-range-track"],"::meter":"::-webkit-meter","::resizer":"::-webkit-resizer","::progress":"::-webkit-progress",":first":":first-child",":last":":last-child",":even":":nth-child(2n)",":odd":":nth-child(odd)",":nth(":":nth-child(",":only":":only-child"},i={square:{"aspect-ratio":"1/1"},video:{"aspect-ratio":"16/9"},rounded:{"border-radius":"1e9em"},round:{"border-radius":"50%"},hidden:{display:"none"},hide:{display:"none"},block:{display:"block"},table:{display:"table"},flex:{display:"flex"},grid:{display:"grid"},contents:{display:"contents"},inline:{display:"inline"},"inline-block":{display:"inline-block"},"inline-flex":{display:"inline-flex"},"inline-grid":{display:"inline-grid"},"inline-table":{display:"inline-table"},"table-cell":{display:"table-cell"},"table-caption":{display:"table-caption"},"flow-root":{display:"flow-root"},"list-item":{display:"list-item"},"table-row":{display:"table-row"},"table-column":{display:"table-column"},"table-row-group":{display:"table-row-group"},"table-column-group":{display:"table-column-group"},"table-header-group":{display:"table-header-group"},"table-footer-group":{display:"table-footer-group"},italic:{"font-style":"italic"},oblique:{"font-style":"oblique"},isolate:{isolation:"isolate"},overflowed:{overflow:"visible"},untouchable:{"pointer-events":"none"},static:{position:"static"},fixed:{position:"fixed"},abs:{position:"absolute"},rel:{position:"relative"},sticky:{position:"sticky"},uppercase:{"text-transform":"uppercase"},lowercase:{"text-transform":"lowercase"},capitalize:{"text-transform":"capitalize"},visible:{visibility:"visible"},invisible:{visibility:"hidden"},vw:{width:"100vw"},vh:{height:"100vh"},"max-vw":{"max-width":"100vw"},"max-vh":{"max-height":"100vh"},"min-vw":{"min-width":"100vw"},"min-vh":{"min-height":"100vh"},"center-content":{"justify-content":"center","align-items":"center"},"sr-only":{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0,0,0,0)","white-space":"nowrap","border-width":"0"},full:{width:"100%",height:"100%"},center:{left:0,right:0,"margin-left":"auto","margin-right":"auto"},middle:{top:0,bottom:0,"margin-top":"auto","margin-bottom":"auto"},"break-spaces":{"white-space":"break-spaces"},"break-word":{"overflow-wrap":"break-word",overflow:"hidden"},"gradient-text":{"-webkit-text-fill-color":"transparent","-webkit-background-clip":"text","background-clip":"text"},fit:{width:"fit-content",height:"fit-content"}},l={fade:{"0%":{opacity:0},to:{opacity:1}},flash:{"0%,50%,to":{opacity:1},"25%,75%":{opacity:0}},float:{"0%":{transform:"none"},"50%":{transform:"translateY(-1.25rem)"},to:{transform:"none"}},heart:{"0%":{transform:"scale(1)"},"14%":{transform:"scale(1.3)"},"28%":{transform:"scale(1)"},"42%":{transform:"scale(1.3)"},"70%":{transform:"scale(1)"}},jump:{"0%,to":{transform:"translateY(-25%)","animation-timing-function":"cubic-bezier(.8,0,1,1)"},"50%":{transform:"translateY(0)","animation-timing-function":"cubic-bezier(0,0,.2,1)"}},ping:{"75%,to":{transform:"scale(2)",opacity:0}},pulse:{"0%":{transform:"none"},"50%":{transform:"scale(1.05)"},to:{transform:"none"}},rotate:{"0%":{transform:"rotate(-360deg)"},to:{transform:"none"}},shake:{"0%":{transform:"none"},"6.5%":{transform:"translateX(-6px) rotateY(-9deg)"},"18.5%":{transform:"translateX(5px) rotateY(7deg)"},"31.5%":{transform:"translateX(-3px) rotateY(-5deg)"},"43.5%":{transform:"translateX(2px) rotateY(3deg)"},"50%":{transform:"none"}},zoom:{"0%":{transform:"scale(0)"},to:{transform:"none"}}},s={"4xs":360,"3xs":480,"2xs":600,xs:768,sm:834,md:1024,lg:1280,xl:1440,"2xl":1600,"3xl":1920,"4xl":2560},o={full:"100%",fit:"fit-content",max:"max-content",min:"min-content","font-family":{mono:["ui-monospace","SFMono-Regular","Menlo","Monaco","Consolas","Liberation Mono","Courier New","monospace"],sans:["ui-sans-serif","system-ui","-apple-system","BlinkMacSystemFont","Segoe UI","Roboto","Helvetica Neue","Arial","Noto Sans","sans-serif","Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"],serif:["ui-serif","Georgia","Cambria","Times New Roman","Times","serif"]},screen:s,"font-weight":{thin:100,extralight:200,light:300,regular:400,medium:500,semibold:600,bold:700,extrabold:800,heavy:900},"flex-direction":{col:"column","col-reverse":"column-reverse"},"box-sizing":{content:"content-box",border:"border-box"},position:{abs:"absolute",rel:"relative"},"transform-box":{content:"content-box",border:"border-box",padding:"padding-box",fill:"fill-box",stroke:"stroke-box",view:"view-box"},"animation-direction":{alt:"alternate","alt-reverse":"alternate-reverse"},"background-clip":{content:"content-box",border:"border-box",padding:"padding-box"},"background-origin":{content:"content-box",border:"border-box",padding:"padding-box"},order:{first:-999999,last:999999},"shape-outside":{content:"content-box",border:"border-box",padding:"padding-box",margin:"margin-box"},"clip-path":{content:"content-box",border:"border-box",padding:"padding-box",margin:"margin-box",fill:"fill-box",stroke:"stroke-box",view:"view-box",black:"#000000"},current:"currentColor",text:{invert:{"@light":"#ffffff","@dark":"#000000"},strong:{"@light":"$(slate-95)","@dark":"$(gray-10)"},neutral:{"@light":"$(slate-70)","@dark":"$(gray-30)"},lightest:{"@light":"$(slate-30)","@dark":"$(gray-60)"},lighter:{"@light":"$(slate-40)","@dark":"$(gray-50)"},light:{"@light":"$(slate-50)","@dark":"$(gray-40)"},gray:{"@light":"$(gray-60)","@dark":"$(gray-30)"},slate:{"@light":"$(slate-60)","@dark":"$(slate-30)"},brown:{"@light":"$(brown-60)","@dark":"$(brown-30)"},orange:{"@light":"$(orange-60)","@dark":"$(orange-30)"},amber:{"@light":"$(amber-60)","@dark":"$(amber-40)"},yellow:{"@light":"$(yellow-60)","@dark":"$(yellow-40)"},lime:{"@light":"$(lime-70)","@dark":"$(lime-40)"},green:{"@light":"$(green-70)","@dark":"$(green-40)"},beryl:{"@light":"$(beryl-70)","@dark":"$(beryl-40)"},teal:{"@light":"$(teal-70)","@dark":"$(teal-40)"},cyan:{"@light":"$(cyan-70)","@dark":"$(cyan-40)"},sky:{"@light":"$(sky-70)","@dark":"$(sky-30)"},blue:{"@light":"$(blue-60)","@dark":"$(blue-30)"},indigo:{"@light":"$(indigo-60)","@dark":"$(indigo-30)"},violet:{"@light":"$(violet-60)","@dark":"$(violet-30)"},purple:{"@light":"$(purple-60)","@dark":"$(purple-30)"},fuchsia:{"@light":"$(fuchsia-60)","@dark":"$(fuchsia-30)"},pink:{"@light":"$(pink-60)","@dark":"$(pink-30)"},crimson:{"@light":"$(crimson-60)","@dark":"$(crimson-30)"},red:{"@light":"$(red-60)","@dark":"$(red-30)"}},base:{"@light":"$(white)","@dark":"$(gray-95)"},canvas:{"@light":"$(slate-5)","@dark":"$(gray-90)"},surface:{"@light":"$(white)","@dark":"$(gray-80)"},invert:{"@light":"#000000","@dark":"#ffffff"},white:"#ffffff",black:"#000000",frame:{"@light":"$(slate-60)","@dark":"$(gray-30)"},gray:{5:"#f6f5f7",10:"#efeef0",20:"#cdccce",30:"#a2a1a3",40:"#89888a",50:"#737274",60:"#585759",70:"#444345",80:"#323133",90:"#29282a",95:"#222123","":{"@light":"$(gray-30)","@dark":"$(gray-40)"}},slate:{5:"#f8f9fb",10:"#eff2f9",20:"#c8d0e3",30:"#9fabc6",40:"#7c8cab",50:"#5f7395",60:"#455572",70:"#37455d",80:"#283348",90:"#1d273a",95:"#182030","":{"@light":"$(slate-30)","@dark":"$(slate-40)"}},brown:{5:"#fff6f0",10:"#feefe3",20:"#f3bea4",30:"#e7976e",40:"#da7c4d",50:"#cc6633",60:"#b65325",70:"#9d4119",80:"#833111",90:"#692007",95:"#431304","":{"@light":"$(brown-40)","@dark":"$(brown-50)"}},orange:{5:"#fff5ea",10:"#fff5df",20:"#ffcb9e",30:"#ff9b47",40:"#ff8528",50:"#ff6c0a",60:"#e05200",70:"#bc3e00",80:"#992d00",90:"#701d00",95:"#471100","":{"@light":"$(orange-40)","@dark":"$(orange-50)"}},amber:{5:"#fff9eb",10:"#fff4db",20:"#ffe099",30:"#ffc133",40:"#ffb10a",50:"#f99e00",60:"#e57e00",70:"#c15d00",80:"#a34900",90:"#753200",95:"#4c1f00","":{"@light":"$(amber-40)","@dark":"$(amber-50)"}},yellow:{5:"#fffae5",10:"#fffed1",20:"#ffe993",30:"#ffd233",40:"#ffc300",50:"#efaf00",60:"#d69200",70:"#b77400",80:"#9e5c00",90:"#753c00",95:"#4c2600","":{"@light":"$(yellow-40)","@dark":"$(yellow-50)"}},lime:{5:"#f5ffe5",10:"#f5ffd6",20:"#d1fb8d",30:"#acec46",40:"#91d91a",50:"#77c012",60:"#61a60c",70:"#4c8d07",80:"#367604",90:"#256000",95:"#1b3d00","":{"@light":"$(lime-40)","@dark":"$(lime-50)"}},green:{5:"#e7fdea",10:"#dbfee4",20:"#a5f7b8",30:"#35ed66",40:"#00d655",50:"#00c147",60:"#00ad3f",70:"#008e34",80:"#007a2c",90:"#006023",95:"#003d16","":{"@light":"$(green-40)","@dark":"$(green-50)"}},beryl:{5:"#e0fef2",10:"#d2fff7",20:"#6cffd4",30:"#0fefa4",40:"#04e09e",50:"#04cb8f",60:"#00b277",70:"#009360",80:"#007f50",90:"#00663e",95:"#003d24","":{"@light":"$(beryl-40)","@dark":"$(beryl-50)"}},teal:{5:"#dbfefd",10:"#cfffff",20:"#7ffff6",30:"#00f4e4",40:"#00e4d4",50:"#00ccc8",60:"#00aeb7",70:"#0092a3",80:"#00798e",90:"#005d75",95:"#003747","":{"@light":"$(teal-40)","@dark":"$(teal-50)"}},cyan:{5:"#e0ffff",10:"#d1ffff",20:"#7ff6ff",30:"#1ee1ff",40:"#00ccf9",50:"#00b3ea",60:"#0099d6",70:"#007dbc",80:"#0067a8",90:"#005089",95:"#003156","":{"@light":"$(cyan-40)","@dark":"$(cyan-50)"}},sky:{5:"#e5f5ff",10:"#d9f8ff",20:"#a3deff",30:"#6bc6ff",40:"#34b2fd",50:"#059fff",60:"#008df9",70:"#0073e0",80:"#005cc6",90:"#0041a3",95:"#002566","":{"@light":"$(sky-60)","@dark":"$(sky-50)"}},blue:{5:"#e5f3fe",10:"#dbf2fe",20:"#add7ff",30:"#70b0ff",40:"#4c93fd",50:"#3a7cff",60:"#2563fd",70:"#1b53ec",80:"#1947d1",90:"#1735a2",95:"#102069","":{"@light":"$(blue-60)","@dark":"$(blue-50)"}},indigo:{5:"#f0f1fe",10:"#e9ecfe",20:"#c8cdfe",30:"#939eff",40:"#7e81fe",50:"#7068ff",60:"#5b4cfd",70:"#4e39ed",80:"#4732d2",90:"#3623a3",95:"#26176c","":{"@light":"$(indigo-60)","@dark":"$(indigo-50)"}},violet:{5:"#f2efff",10:"#efe8ff",20:"#d7c5ff",30:"#b198fe",40:"#9a70ff",50:"#8e56fe",60:"#812fff",70:"#7407f2",80:"#6405d1",90:"#4f05a3",95:"#35036e","":{"@light":"$(violet-60)","@dark":"$(violet-50)"}},purple:{5:"#f6f0ff",10:"#f6e8fe",20:"#e2bffe",30:"#c492fd",40:"#b266ff",50:"#a849fe",60:"#9514ff",70:"#8200e5",80:"#7100c1",90:"#58008e",95:"#3e0060","":{"@light":"$(purple-60)","@dark":"$(purple-50)"}},fuchsia:{5:"#faf0ff",10:"#fde8fe",20:"#f0baff",30:"#dd89fe",40:"#d760fe",50:"#cf33ff",60:"#b700e5",70:"#a200c6",80:"#8700a3",90:"#660175",95:"#480051","":{"@light":"$(fuchsia-60)","@dark":"$(fuchsia-50)"}},pink:{5:"#fef1f9",10:"#fee9f8",20:"#ffb8df",30:"#f986c1",40:"#fa65b2",50:"#f747a2",60:"#ef2188",70:"#d61673",80:"#b80c5c",90:"#8f0543",95:"#64032f","":{"@light":"$(pink-60)","@dark":"$(pink-50)"}},crimson:{5:"#ffeff2",10:"#ffe8ec",20:"#ffbac7",30:"#ff849d",40:"#ff6684",50:"#fc4065",60:"#ed2a51",70:"#d7173e",80:"#bb1536",90:"#8f132c",95:"#620e1f","":{"@light":"$(crimson-60)","@dark":"$(crimson-50)"}},red:{5:"#ffefef",10:"#fee8e8",20:"#ffbcbc",30:"#ff8787",40:"#fd5f5f",50:"#f73f3f",60:"#e52e2e",70:"#d01b1b",80:"#b81919",90:"#921515",95:"#650f0f","":{"@light":"$(red-60)","@dark":"$(red-50)"}}},n={},c=function(e){let t;if("undefined"!=typeof CSS)return CSS.escape(e);if(0==arguments.length)throw TypeError("`CSS.escape` requires an argument.");let r=String(e),a=r.length,i=-1,l="",s=r.charCodeAt(0);if(1==a&&45==s)return"\\"+r;for(;++i<a;){if(0==(t=r.charCodeAt(i))){l+="�";continue}if(t>=1&&t<=31||127==t||0==i&&t>=48&&t<=57||1==i&&t>=48&&t<=57&&45==s){l+="\\"+t.toString(16)+" ";continue}if(t>=128||45==t||95==t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122){l+=r.charAt(i);continue}l+="\\"+r.charAt(i)}return l},h={};h.START_SYMBOLS={"(":")","'":"'",'"':'"',"{":"}"};var d={};d.Layer=void 0,(e=d.Layer||(d.Layer={}))[e.Semantic=-8]="Semantic",e[e.CoreNativeShorthand=-7]="CoreNativeShorthand",e[e.NativeShorthand=-6]="NativeShorthand",e[e.CoreShorthand=-5]="CoreShorthand",e[e.Shorthand=-4]="Shorthand",e[e.CoreNative=-3]="CoreNative",e[e.Native=-2]="Native",e[e.Core=-1]="Core",e[e.Normal=0]="Normal",Object.defineProperty(n,"__esModule",{value:!0});let f=["none","auto","hidden","dotted","dashed","solid","double","groove","ridge","inset","outset"],m=function(e){return e.length<2||e.find(e=>"string"===e.type&&f.includes(e.value)||"variable"===e.type&&f.includes(e.variable?.value))||e.push({type:"separator",value:" "},{type:"string",value:"solid"}),e},u={group:{match:/^(?:.+?[*_>~+])?\{.+?\}/,layer:d.Layer.Core,analyze(e){let t=0;for(;t<e.length&&("{"!==e[t]||"\\"===e[t-1]);t++);return[e.slice(t),e.slice(0,t)]},declare(e){let t={},r=e=>{let r=e.indexOf(":");-1!==r&&(t[e.slice(0,r)]=e.slice(r+1))},a=e=>{let t=t=>{let a=t.slice(c(e.className).length).match(/\{(.*)\}/)?.[1].split(";");if(a)for(let e of a)r(e)};for(let r of e.natives)t(r.text);if(e.animationNames)for(let t of(this.animationNames||(this.animationNames=[]),e.animationNames))this.animationNames.includes(t)||this.animationNames.push(t);if(e.variableNames)for(let t of(this.variableNames||(this.variableNames=[]),e.variableNames))this.variableNames.includes(t)||this.variableNames.push(t)},i=[],l="",s=()=>{l&&(i.push(l.replace(/ /g,"|")),l="")},o=1;for(let t of(!function t(r){for(;o<e.length;o++){let a=e[o];if(!r){if(";"===a){s();continue}if("}"===a)break}if(l+=a,r===a){if("'"===r||'"'===r){let e=0;for(let t=l.length-2;"\\"===l[t];t--)e++;if(e%2)continue}break}a in h.START_SYMBOLS&&"'"!==r&&'"'!==r&&(o++,t(h.START_SYMBOLS[a]))}}(""),s(),i)){let e=this.css.generate(t);if(e.length)for(let t of e)a(t);else r(t)}return t}},variable:{match:/^\$[\w-]+:/,colored:!0,layer:d.Layer.Core,declare(e){return{["--"+this.prefix.slice(1,-1)]:e}}},"font-size":{match:["f(?:ont)?"],numeric:!0,unit:"rem",layer:d.Layer.CoreNative},"font-weight":{match:["f(?:ont)?",["bolder"]],layer:d.Layer.CoreNative},"font-family":{match:["f(?:ont)?"],layer:d.Layer.CoreNative},"font-smoothing":{match:["f(?:ont)?",["antialiased","subpixel-antialiased"]],layer:d.Layer.CoreNative,declare(e){switch(e){case"subpixel-antialiased":return{"-webkit-font-smoothing":"auto","-moz-osx-font-smoothing":"auto"};case"antialiased":return{"-webkit-font-smoothing":"antialiased","-moz-osx-font-smoothing":"grayscale"}}}},"font-style":{match:["f(?:ont)?",["normal","italic","oblique"]],layer:d.Layer.CoreNative,unit:"deg"},"font-variant-numeric":{match:["f(?:ont)?",["ordinal","slashed-zero","lining-nums","oldstyle-nums","proportional-nums","tabular-nums","diagonal-fractions","stacked-fractions"]],layer:d.Layer.CoreNative},"font-variant":{layer:d.Layer.CoreNativeShorthand},"font-feature-settings":{match:/^font-feature:/,layer:d.Layer.CoreNative},font:{match:/^f:/,layer:d.Layer.CoreNativeShorthand,variables:["font-family","font-variant","font-weight","font-size","font-style","line-height"]},color:{match:/^(?:color|fg):/,layer:d.Layer.CoreNative,colored:!0,variables:["text"]},"margin-left":{match:/^ml:/,layer:d.Layer.CoreNative,unit:"rem",variables:["spacing"]},"margin-right":{match:/^mr:/,layer:d.Layer.CoreNative,unit:"rem",variables:["spacing"]},"margin-top":{match:/^mt:/,layer:d.Layer.CoreNative,unit:"rem",variables:["spacing"]},"margin-bottom":{match:/^mb:/,layer:d.Layer.CoreNative,unit:"rem",variables:["spacing"]},"margin-x":{match:/^(?:mx|margin-x):/,unit:"rem",layer:d.Layer.CoreShorthand,declare:e=>({"margin-left":e,"margin-right":e}),variables:["spacing"]},"margin-y":{match:/^(?:my|margin-y):/,unit:"rem",layer:d.Layer.CoreShorthand,declare:e=>({"margin-top":e,"margin-bottom":e}),variables:["spacing"]},margin:{match:/^m:/,unit:"rem",layer:d.Layer.CoreNativeShorthand,variables:["spacing"]},"margin-inline-start":{match:/^mis:/,layer:d.Layer.CoreNative,unit:"rem",variables:["spacing"]},"margin-inline-end":{match:/^mie:/,layer:d.Layer.CoreNative,unit:"rem",variables:["spacing"]},"margin-inline":{match:/^mi:/,unit:"rem",layer:d.Layer.CoreNativeShorthand,variables:["spacing"]},"padding-left":{match:/^pl:/,layer:d.Layer.CoreNative,unit:"rem",variables:["spacing"]},"padding-right":{match:/^pr:/,layer:d.Layer.CoreNative,unit:"rem",variables:["spacing"]},"padding-top":{match:/^pt:/,layer:d.Layer.CoreNative,unit:"rem",variables:["spacing"]},"padding-bottom":{match:/^pb:/,layer:d.Layer.CoreNative,unit:"rem",variables:["spacing"]},"padding-x":{match:/^(?:px|padding-x):/,unit:"rem",layer:d.Layer.CoreShorthand,declare:e=>({"padding-left":e,"padding-right":e}),variables:["spacing"]},"padding-y":{match:/^(?:py|padding-y):/,unit:"rem",layer:d.Layer.CoreShorthand,declare:e=>({"padding-top":e,"padding-bottom":e}),variables:["spacing"]},padding:{match:/^p:/,unit:"rem",layer:d.Layer.CoreNativeShorthand,variables:["spacing"]},"padding-inline-start":{match:/^pis:/,layer:d.Layer.CoreNative,unit:"rem",variables:["spacing"]},"padding-inline-end":{match:/^pie:/,layer:d.Layer.CoreNative,unit:"rem",variables:["spacing"]},"padding-inline":{match:/^pi:/,unit:"rem",layer:d.Layer.CoreNativeShorthand,variables:["spacing"]},"flex-basis":{unit:"rem",layer:d.Layer.CoreNative},"flex-wrap":{match:["flex",["wrap","nowrap","wrap-reverse"]],layer:d.Layer.CoreNative},"flex-grow":{layer:d.Layer.CoreNative},"flex-shrink":{layer:d.Layer.CoreNative},"flex-direction":{match:["flex",["row","row-reverse","column","column-reverse"]],layer:d.Layer.CoreNative},flex:{layer:d.Layer.CoreNativeShorthand},display:{match:/^d:/,layer:d.Layer.CoreNative},width:{match:/^w:/,unit:"rem",layer:d.Layer.CoreNative},height:{match:/^h:/,unit:"rem",layer:d.Layer.CoreNative},"min-width":{match:/^min-w:/,unit:"rem",layer:d.Layer.CoreNative},"min-height":{match:/^min-h:/,unit:"rem",layer:d.Layer.CoreNative},size:{match:/^size:/,layer:d.Layer.CoreShorthand,unit:"rem",declare(e,t){let r=t.length;return{width:t[0].text,height:1===r?t[0].text:t[2].text}}},"min-size":{match:/^min:/,layer:d.Layer.CoreShorthand,unit:"rem",declare(e,t){let r=t.length;return{"min-width":t[0].text,"min-height":1===r?t[0].text:t[2].text}}},"max-size":{match:/^max:/,layer:d.Layer.CoreShorthand,unit:"rem",declare(e,t){let r=t.length;return{"max-width":t[0].text,"max-height":1===r?t[0].text:t[2].text}}},"box-sizing":{match:/^box:/,layer:d.Layer.CoreNative},"box-decoration-break":{match:["box-decoration",["slice","clone"]],layer:d.Layer.CoreNative,declare:e=>({"box-decoration-break":e,"-webkit-box-decoration-break":e})},contain:{layer:d.Layer.CoreNative},content:{layer:d.Layer.CoreNative},"counter-increment":{layer:d.Layer.CoreNative},"counter-reset":{layer:d.Layer.CoreNative},"letter-spacing":{match:/^ls:/,layer:d.Layer.CoreNative,unit:"em"},"line-height":{match:/^lh:/,layer:d.Layer.CoreNative},"object-fit":{match:["(?:object|obj)",["contain","cover","fill","scale-down"]],layer:d.Layer.CoreNative},"object-position":{match:["(?:object|obj)",["top","bottom","right","left","center"]],layer:d.Layer.CoreNative},"text-align":{match:["t(?:ext)?",["justify","center","left","right","start","end"]],layer:d.Layer.CoreNative},"text-decoration-color":{match:["text-decoration"],layer:d.Layer.CoreNative,colored:!0,variables:["text"]},"text-decoration-style":{match:["t(?:ext)?",["solid","double","dotted","dashed","wavy"]],layer:d.Layer.CoreNative},"text-decoration-thickness":{match:["text-decoration",["from-font"]],numeric:!0,layer:d.Layer.CoreNative,unit:"em"},"text-decoration-line":{match:["t(?:ext)?",["none","underline","overline","line-through"]],layer:d.Layer.CoreNative},"text-decoration":{match:["t(?:ext)?",["underline","overline","line-through"]],unit:"rem",colored:!0,layer:d.Layer.CoreNativeShorthand,variables:["text"]},"text-underline-offset":{unit:"rem",layer:d.Layer.CoreNative,variables:["spacing"]},"text-overflow":{match:["t(?:ext)?",["ellipsis","clip"]],layer:d.Layer.CoreNative},"text-orientation":{match:["t(?:ext)?",["mixed","upright","sideways-right","sideways","use-glyph-orientation"]],layer:d.Layer.CoreNative},"text-transform":{match:["t(?:ext)?",["uppercase","lowercase","capitalize"]],layer:d.Layer.CoreNative},"text-rendering":{match:["t(?:ext)?",["optimizeSpeed","optimizeLegibility","geometricPrecision"]],layer:d.Layer.CoreNative},"text-indent":{unit:"rem",layer:d.Layer.CoreNative},"vertical-align":{match:/^(?:v|vertical):/,layer:d.Layer.CoreNative},columns:{match:/^(?:columns|cols):/,layer:d.Layer.CoreNativeShorthand},"white-space":{layer:d.Layer.CoreNative},top:{layer:d.Layer.CoreNative,unit:"rem",variables:["spacing"]},bottom:{layer:d.Layer.CoreNative,unit:"rem",variables:["spacing"]},left:{layer:d.Layer.CoreNative,unit:"rem",variables:["spacing"]},right:{layer:d.Layer.CoreNative,unit:"rem",variables:["spacing"]},inset:{unit:"rem",layer:d.Layer.CoreNativeShorthand,variables:["spacing"]},lines:{match:/^lines:/,declare:e=>({overflow:"hidden",display:"-webkit-box","overflow-wrap":"break-word","text-overflow":"ellipsis","-webkit-box-orient":"vertical","-webkit-line-clamp":e})},"max-height":{match:/^max-h:/,unit:"rem",layer:d.Layer.CoreNative},"max-width":{match:/^max-w:/,unit:"rem",layer:d.Layer.CoreNative},opacity:{layer:d.Layer.CoreNative},visibility:{layer:d.Layer.CoreNative},clear:{layer:d.Layer.CoreNative},float:{layer:d.Layer.CoreNative},isolation:{layer:d.Layer.CoreNative},"overflow-x":{layer:d.Layer.CoreNative,declare:e=>"overlay"===e?{"overflow-x":["auto",e]}:{"overflow-x":e}},"overflow-y":{layer:d.Layer.CoreNative,declare:e=>"overlay"===e?{"overflow-y":["auto",e]}:{"overflow-y":e}},overflow:{layer:d.Layer.CoreNativeShorthand,declare:e=>"overlay"===e?{overflow:["auto",e]}:{overflow:e}},"overscroll-behavior-x":{layer:d.Layer.CoreNative},"overscroll-behavior-y":{layer:d.Layer.CoreNative},"overscroll-behavior":{layer:d.Layer.CoreNativeShorthand},"z-index":{match:/^z:/,layer:d.Layer.CoreNative},position:{layer:d.Layer.CoreNative},cursor:{layer:d.Layer.CoreNative},"pointer-events":{layer:d.Layer.CoreNative},resize:{layer:d.Layer.CoreNative},"touch-action":{layer:d.Layer.CoreNative},"word-break":{layer:d.Layer.CoreNative},"word-spacing":{layer:d.Layer.CoreNative,unit:"em"},"user-drag":{layer:d.Layer.CoreNative,declare:e=>({"user-drag":e,"-webkit-user-drag":e})},"user-select":{layer:d.Layer.CoreNative,declare:e=>({"user-select":e,"-webkit-user-select":e})},"text-shadow":{unit:"rem",layer:d.Layer.CoreNative,colored:!0},"text-size":{match:["t(?:ext)?"],numeric:!0,unit:"rem",declare:e=>({"font-size":e,"line-height":`calc(${e} + 0.875em)`})},"text-fill-color":{match:["(?:text-fill|text|t)"],layer:d.Layer.CoreNative,colored:!0,variables:["text"],declare:e=>({"-webkit-text-fill-color":e})},"text-stroke-width":{match:["text-stroke",["thin","medium","thick"]],numeric:!0,unit:"rem",layer:d.Layer.CoreNative,declare:e=>({"-webkit-text-stroke-width":e})},"text-stroke-color":{match:["text-stroke"],layer:d.Layer.CoreNative,colored:!0,variables:["text"],declare:e=>({"-webkit-text-stroke-color":e})},"text-stroke":{unit:"rem",layer:d.Layer.CoreNative,declare:e=>({"-webkit-text-stroke":e})},"box-shadow":{match:/^s(?:hadow)?:/,unit:"rem",layer:d.Layer.CoreNative,colored:!0},"table-layout":{layer:d.Layer.CoreNative},"transform-box":{match:["transform"],layer:d.Layer.CoreNative},"transform-style":{match:["transform",["flat","preserve-3d"]],layer:d.Layer.CoreNative},"transform-origin":{match:["transform",["top","bottom","right","left","center"]],numeric:!0,unit:"px",layer:d.Layer.CoreNative},transform:{match:/^(?:translate|scale|skew|rotate|perspective|matrix)(?:3d|[XYZ])?\(/,layer:d.Layer.CoreNative,analyze:e=>[e.startsWith("transform")?e.slice(10):e],variables:["spacing"]},"transition-property":{match:/^~property:/,layer:d.Layer.CoreNative},"transition-timing-function":{match:/^~easing:/,layer:d.Layer.CoreNative},"transition-duration":{match:/^~duration:/,layer:d.Layer.CoreNative,unit:"ms"},"transition-delay":{match:/^~delay:/,layer:d.Layer.CoreNative,unit:"ms"},transition:{match:/^~[^!*>+~:[@_]+\|/,analyze(e){if(e.startsWith("~"))return[e.slice(1)];{let t=e.indexOf(":");return this.prefix=e.slice(0,t+1),[e.slice(t+1)]}},layer:d.Layer.CoreNativeShorthand},"animation-delay":{match:/^@delay:/,layer:d.Layer.CoreNative,unit:"ms"},"animation-direction":{match:/^@direction:/,layer:d.Layer.CoreNative},"animation-duration":{match:/^@duration:/,layer:d.Layer.CoreNative,unit:"ms"},"animation-fill-mode":{match:/^@fill:/,layer:d.Layer.CoreNative},"animation-iteration-count":{match:/^@iteration:/,layer:d.Layer.CoreNative},"animation-name":{match:/^@name:/,layer:d.Layer.CoreNative},"animation-play-state":{match:/^@play:/,layer:d.Layer.CoreNative},"animation-timing-function":{match:/^@easing:/,layer:d.Layer.CoreNative},animation:{match:/^@[^!*>+~:[@_]+\|/,layer:d.Layer.CoreNativeShorthand,analyze(e){if(e.startsWith("@"))return[e.slice(1)];{let t=e.indexOf(":");return this.prefix=e.slice(0,t+1),[e.slice(t+1)]}}},"border-collapse":{match:["b(?:order)?",["collapse","separate"]],layer:d.Layer.CoreNative},"border-spacing":{unit:"rem",layer:d.Layer.CoreNative},"border-top-color":{match:["b(?:t|order-top(?:-color)?)"],layer:d.Layer.CoreNative,colored:!0},"border-bottom-color":{match:["b(?:b|order-bottom(?:-color)?)"],layer:d.Layer.CoreNative,colored:!0},"border-left-color":{match:["b(?:l|order-left(?:-color)?)"],layer:d.Layer.CoreNative,colored:!0},"border-right-color":{match:["b(?:r|order-right(?:-color)?)"],layer:d.Layer.CoreNative,colored:!0},"border-x-color":{match:["b(?:x|order-x(?:-color)?)"],layer:d.Layer.CoreShorthand,colored:!0,declare:e=>({"border-left-color":e,"border-right-color":e})},"border-y-color":{match:["b(?:y|order-y(?:-color)?)"],layer:d.Layer.CoreShorthand,colored:!0,declare:e=>({"border-top-color":e,"border-bottom-color":e})},"border-color":{match:["b(?:order)?(?:-color)?"],layer:d.Layer.CoreNativeShorthand,colored:!0},"border-top-left-radius":{match:/^r(?:tl|lt):/,unit:"rem",layer:d.Layer.CoreNative},"border-top-right-radius":{match:/^r(?:tr|rt):/,unit:"rem",layer:d.Layer.CoreNative},"border-bottom-left-radius":{match:/^r(?:bl|lb):/,unit:"rem",layer:d.Layer.CoreNative},"border-bottom-right-radius":{match:/^r(?:br|rb):/,unit:"rem",layer:d.Layer.CoreNative},"border-top-radius":{match:/^rt:/,unit:"rem",layer:d.Layer.CoreShorthand,declare:e=>({"border-top-left-radius":e,"border-top-right-radius":e})},"border-bottom-radius":{match:/^rb:/,unit:"rem",layer:d.Layer.CoreShorthand,declare:e=>({"border-bottom-left-radius":e,"border-bottom-right-radius":e})},"border-left-radius":{match:/^rl:/,unit:"rem",layer:d.Layer.CoreShorthand,declare:e=>({"border-top-left-radius":e,"border-bottom-left-radius":e})},"border-right-radius":{match:/^rr:/,unit:"rem",layer:d.Layer.CoreShorthand,declare:e=>({"border-top-right-radius":e,"border-bottom-right-radius":e})},"border-radius":{match:/^r:/,unit:"rem",layer:d.Layer.CoreNativeShorthand},"border-top-style":{match:["b(?:t|order-top(?:-style)?)",f],layer:d.Layer.CoreNative},"border-bottom-style":{match:["b(?:b|order-bottom(?:-style)?)",f],layer:d.Layer.CoreNative},"border-left-style":{match:["b(?:l|order-left(?:-style)?)",f],layer:d.Layer.CoreNative},"border-right-style":{match:["b(?:r|order-right(?:-style)?)",f],layer:d.Layer.CoreNative},"border-x-style":{match:["b(?:x|order-x(?:-style)?)",f],layer:d.Layer.CoreShorthand,declare:e=>({"border-left-style":e,"border-right-style":e})},"border-y-style":{match:["b(?:y|order-y(?:-style)?)",f],layer:d.Layer.CoreShorthand,declare:e=>({"border-top-style":e,"border-bottom-style":e})},"border-style":{match:["b(?:order)?(?:-style)?",f],layer:d.Layer.CoreNativeShorthand},"border-top-width":{match:["b(?:t|order-top(?:-width)?)"],numeric:!0,unit:"rem",layer:d.Layer.CoreNative},"border-bottom-width":{match:["b(?:b|order-bottom(?:-width)?)"],numeric:!0,unit:"rem",layer:d.Layer.CoreNative},"border-left-width":{match:["b(?:l|order-left(?:-width)?)"],numeric:!0,unit:"rem",layer:d.Layer.CoreNative},"border-right-width":{match:["b(?:r|order-right(?:-width)?)"],numeric:!0,unit:"rem",layer:d.Layer.CoreNative},"border-x-width":{match:["b(?:x|order-x(?:-width)?)"],numeric:!0,unit:"rem",layer:d.Layer.CoreShorthand,declare:e=>({"border-left-width":e,"border-right-width":e})},"border-y-width":{match:["b(?:y|order-y(?:-width)?)"],numeric:!0,unit:"rem",layer:d.Layer.CoreShorthand,declare:e=>({"border-top-width":e,"border-bottom-width":e})},"border-width":{match:["b(?:order)?(?:-width)?"],numeric:!0,unit:"rem",layer:d.Layer.CoreNativeShorthand},"border-image-outset":{unit:"rem",layer:d.Layer.CoreNative},"border-image-repeat":{match:["border-image",["stretch","repeat","round","space"]],layer:d.Layer.CoreNative},"border-image-slice":{layer:d.Layer.CoreNative},"border-image-source":{match:["border-image",["url","linear-gradient","radial-gradient","repeating-linear-gradient","repeating-radial-gradient","conic-gradient"]],layer:d.Layer.CoreNative},"border-image-width":{match:["border-image",["auto"]],numeric:!0,unit:"rem",layer:d.Layer.CoreNative},"border-image":{layer:d.Layer.CoreNativeShorthand},"border-top":{match:/^bt:/,layer:d.Layer.CoreNativeShorthand,unit:"rem",colored:!0,transformValueComponents:m},"border-bottom":{match:/^bb:/,layer:d.Layer.CoreNativeShorthand,unit:"rem",colored:!0,transformValueComponents:m},"border-left":{match:/^bl:/,layer:d.Layer.CoreNativeShorthand,unit:"rem",colored:!0,transformValueComponents:m},"border-right":{match:/^br:/,layer:d.Layer.CoreNativeShorthand,unit:"rem",colored:!0,transformValueComponents:m},"border-x":{match:/^(?:bx|border-x):/,unit:"rem",colored:!0,layer:d.Layer.CoreShorthand,transformValueComponents:m,declare:e=>({"border-left":e,"border-right":e})},"border-y":{match:/^(?:by|border-y):/,unit:"rem",colored:!0,layer:d.Layer.CoreShorthand,transformValueComponents:m,declare:e=>({"border-top":e,"border-bottom":e})},border:{match:/^b:/,unit:"rem",colored:!0,layer:d.Layer.CoreNativeShorthand,transformValueComponents:m},"background-attachment":{match:["(?:bg|background)",["fixed","local","scroll"]],layer:d.Layer.CoreNative},"background-blend-mode":{layer:d.Layer.CoreNative},"background-color":{match:["(?:bg|background)"],layer:d.Layer.CoreNative,colored:!0},"background-clip":{match:["(?:bg|background)",["text"]],layer:d.Layer.CoreNative,declare:e=>({"-webkit-background-clip":e,"background-clip":e})},"background-origin":{match:["(?:bg|background)"],layer:d.Layer.CoreNative},"background-position":{match:["(?:bg|background)",["top","bottom","right","left","center"]],layer:d.Layer.CoreNative,unit:"px"},"background-repeat":{match:["(?:bg|background)",["space","round","repeat","no-repeat","repeat-x","repeat-y"]],layer:d.Layer.CoreNative},"background-size":{match:["(?:bg|background)",["auto","cover","contain"]],numeric:!0,unit:"rem",layer:d.Layer.CoreNative},"background-image":{match:["(?:bg|background)",["(?:url|linear-gradient|radial-gradient|repeating-linear-gradient|repeating-radial-gradient|conic-gradient)\\(.*\\)"]],layer:d.Layer.CoreNative},background:{match:/^bg:/,colored:!0,layer:d.Layer.CoreNativeShorthand},gradient:{match:/^gradient\(/,layer:d.Layer.CoreNative,colored:!0,declare:e=>({"background-image":"linear-"+e})},"mix-blend-mode":{match:/^blend:/,layer:d.Layer.CoreNative},"backdrop-filter":{match:/^bd:/,layer:d.Layer.CoreNative,colored:!0,declare:e=>({"backdrop-filter":e,"-webkit-backdrop-filter":e})},filter:{match:/^(?:blur|brightness|contrast|drop-shadow|grayscale|hue-rotate|invert|opacity|saturate|sepia)\(/,layer:d.Layer.CoreNative,colored:!0},fill:{match:/^fill:/,layer:d.Layer.CoreNative,colored:!0},"stroke-dasharray":{layer:d.Layer.CoreNative},"stroke-dashoffset":{layer:d.Layer.CoreNative,variables:["spacing"]},"stroke-width":{match:["stroke(?:-width)?"],numeric:!0,layer:d.Layer.CoreNative},stroke:{match:["stroke"],layer:d.Layer.CoreNative,colored:!0},x:{layer:d.Layer.CoreNative,variables:["spacing"]},y:{layer:d.Layer.CoreNative,variables:["spacing"]},cx:{layer:d.Layer.CoreNative,variables:["spacing"]},cy:{layer:d.Layer.CoreNative,variables:["spacing"]},rx:{layer:d.Layer.CoreNative},ry:{layer:d.Layer.CoreNative},"grid-column-start":{match:/^grid-col(?:umn)?-start:/,layer:d.Layer.CoreNative},"grid-column-end":{match:/^grid-col(?:umn)?-end:/,layer:d.Layer.CoreNative},"grid-column":{match:/^grid-col(?:umn)?(?:-span)?:/,layer:d.Layer.CoreNativeShorthand,transformValue(e){return"span"===this.prefix.slice(-5,-1)&&"auto"!==e?"span "+e+"/span "+e:e}},"grid-columns":{match:/^grid-col(?:umn)?s:/,declare:e=>({display:"grid","grid-template-columns":"repeat("+e+",minmax(0,1fr))"}),layer:d.Layer.Core},"grid-row-start":{layer:d.Layer.CoreNative},"grid-row-end":{layer:d.Layer.CoreNative},"grid-row":{match:/^grid-row-span:/,layer:d.Layer.CoreNativeShorthand,transformValue(e){return"span"===this.prefix.slice(-5,-1)&&"auto"!==e?"span "+e+"/span "+e:e}},"grid-rows":{match:/^grid-rows:/,declare:e=>({display:"grid","grid-auto-flow":"column","grid-template-rows":"repeat("+e+",minmax(0,1fr))"}),layer:d.Layer.Core},"grid-auto-columns":{match:/^grid-auto-cols:/,layer:d.Layer.CoreNative},"grid-auto-flow":{match:/^grid-flow:/,layer:d.Layer.CoreNative},"grid-auto-rows":{layer:d.Layer.CoreNative},"grid-template-areas":{layer:d.Layer.CoreNative},"grid-template-columns":{match:/^grid-template-cols:/,layer:d.Layer.CoreNative,unit:"rem"},"grid-template-rows":{layer:d.Layer.CoreNative,unit:"rem"},"grid-template":{layer:d.Layer.CoreNativeShorthand},"grid-area":{layer:d.Layer.CoreNativeShorthand},grid:{layer:d.Layer.CoreNativeShorthand},"column-gap":{match:/^gap-x:/,unit:"rem",layer:d.Layer.CoreNative,variables:["spacing"]},"row-gap":{match:/^gap-y:/,unit:"rem",layer:d.Layer.CoreNative,variables:["spacing"]},gap:{unit:"rem",layer:d.Layer.CoreNativeShorthand,variables:["spacing"]},order:{match:/^o:/,layer:d.Layer.CoreNative},"break-inside":{layer:d.Layer.CoreNative},"break-before":{layer:d.Layer.CoreNative},"break-after":{layer:d.Layer.CoreNative},"aspect-ratio":{match:/^aspect:/,layer:d.Layer.CoreNative},"column-span":{match:/^col-span:/,layer:d.Layer.CoreNative},"align-content":{match:/^ac:/,layer:d.Layer.CoreNative},"align-items":{match:/^ai:/,layer:d.Layer.CoreNative},"align-self":{match:/^as:/,layer:d.Layer.CoreNative},"justify-content":{match:/^jc:/,layer:d.Layer.CoreNative},"justify-items":{match:/^ji:/,layer:d.Layer.CoreNative},"justify-self":{match:/^js:/,layer:d.Layer.CoreNative},"place-content":{layer:d.Layer.CoreNativeShorthand},"place-items":{layer:d.Layer.CoreNativeShorthand},"place-self":{layer:d.Layer.CoreNativeShorthand},"list-style-position":{match:["list-style",["inside","outside"]],layer:d.Layer.CoreNative},"list-style-type":{match:["list-style",["disc","decimal"]],layer:d.Layer.CoreNative},"list-style-image":{match:["list-style",["(?:url|linear-gradient|radial-gradient|repeating-linear-gradient|repeating-radial-gradient|conic-gradient)\\(.*\\)"]],layer:d.Layer.CoreNative},"list-style":{layer:d.Layer.CoreNativeShorthand},"outline-color":{match:["outline"],layer:d.Layer.CoreNative,colored:!0},"outline-offset":{unit:"rem",layer:d.Layer.CoreNative,variables:["spacing"]},"outline-style":{match:["outline",f],layer:d.Layer.CoreNative},"outline-width":{match:["outline",["medium","thick","thin"]],numeric:!0,unit:"rem",layer:d.Layer.CoreNative},outline:{unit:"rem",layer:d.Layer.CoreNativeShorthand,colored:!0,variables:["outline-width","outline-style","outline-offset","outline-color"],transformValueComponents:m},"accent-color":{match:/^accent:/,layer:d.Layer.CoreNative,colored:!0},appearance:{layer:d.Layer.CoreNative},"caret-color":{match:/^caret:/,layer:d.Layer.CoreNative,colored:!0,variables:["text"]},"scroll-behavior":{layer:d.Layer.CoreNative},"scroll-margin-left":{match:/^scroll-ml:/,layer:d.Layer.CoreNative,unit:"rem",variables:["spacing"]},"scroll-margin-right":{match:/^scroll-mr:/,layer:d.Layer.CoreNative,unit:"rem",variables:["spacing"]},"scroll-margin-top":{match:/^scroll-mt:/,layer:d.Layer.CoreNative,unit:"rem",variables:["spacing"]},"scroll-margin-bottom":{match:/^scroll-mb:/,layer:d.Layer.CoreNative,unit:"rem",variables:["spacing"]},"scroll-margin-x":{match:/^(?:scroll-margin-x|scroll-mx):/,unit:"rem",layer:d.Layer.CoreShorthand,declare:e=>({"scroll-margin-left":e,"scroll-margin-right":e}),variables:["spacing"]},"scroll-margin-y":{match:/^(?:scroll-margin-y|scroll-my):/,unit:"rem",layer:d.Layer.CoreShorthand,declare:e=>({"scroll-margin-top":e,"scroll-margin-bottom":e}),variables:["spacing"]},"scroll-margin":{match:/^scroll-m:/,unit:"rem",layer:d.Layer.CoreNativeShorthand,variables:["spacing"]},"scroll-padding-left":{match:/^scroll-pl:/,layer:d.Layer.CoreNative,unit:"rem",variables:["spacing"]},"scroll-padding-right":{match:/^scroll-pr:/,layer:d.Layer.CoreNative,unit:"rem",variables:["spacing"]},"scroll-padding-top":{match:/^scroll-pt:/,layer:d.Layer.CoreNative,unit:"rem",variables:["spacing"]},"scroll-padding-bottom":{match:/^scroll-pb:/,layer:d.Layer.CoreNative,unit:"rem",variables:["spacing"]},"scroll-padding-x":{match:/^(?:scroll-padding-x|scroll-px):/,unit:"rem",layer:d.Layer.CoreShorthand,declare:e=>({"scroll-padding-left":e,"scroll-padding-right":e}),variables:["spacing"]},"scroll-padding-y":{match:/^(?:scroll-padding-y|scroll-py):/,unit:"rem",layer:d.Layer.CoreShorthand,declare:e=>({"scroll-padding-top":e,"scroll-padding-bottom":e}),variables:["spacing"]},"scroll-padding":{match:/^scroll-p:/,unit:"rem",layer:d.Layer.CoreNativeShorthand,variables:["spacing"]},"scroll-snap-align":{match:["scroll-snap",["start","end","center"]],layer:d.Layer.CoreNative},"scroll-snap-stop":{match:["scroll-snap",["normal","always"]],layer:d.Layer.CoreNative},"scroll-snap-type":{match:["scroll-snap",["x","y","block","inline","both"]],layer:d.Layer.CoreNative},"will-change":{layer:d.Layer.CoreNative},"writing-mode":{match:/^writing:/,layer:d.Layer.CoreNative},direction:{layer:d.Layer.CoreNative},"shape-outside":{match:["shape",["(?:inset|circle|ellipse|polygon|url|linear-gradient)\\(.*\\)"]],layer:d.Layer.CoreNative},"shape-margin":{match:["shape"],numeric:!0,unit:"rem",layer:d.Layer.CoreNative,variables:["spacing"]},"shape-image-threshold":{layer:d.Layer.CoreNative},"clip-path":{match:/^clip:/,layer:d.Layer.CoreNative},quotes:{layer:d.Layer.CoreNative},"mask-image":{layer:d.Layer.CoreNative,declare:e=>({"mask-image":e,"-webkit-mask-image":e})}};n.BORDER_STYLES=f,n.autofillSolidToValueComponent=m,n.default=u;var y={};y.BASE_UNIT_REGEX=/^([+-]?(?:\d+(?:\.?\d+)?|\.\d+))x$/m;let p={$:{colored:!0,transform(e){let t,r;let a=e.indexOf(",");return -1!==a?(t=e.slice(0,a),r=e.slice(a+1)):t=e,[{type:"variable",name:t,fallback:r}]}},calc:{transform(e,t){let r=[],a=0,i=(t,l,s,o,n)=>{let c;let h=r!==t,d=[],f=!1,m=!1,u=!1,b=!1,v="",g=(r,i="",o="")=>{if(!1===c&&" "!==r&&this.definition.unit&&(c=void 0,b||C()),v){if(!n){let e=y.BASE_UNIT_REGEX.exec(v);e&&(v=(+e[1]*(this.css.config.baseUnit??1)).toString())}if(f||s)t.push({type:"string",value:v});else{let e=this.parseValueComponent(v);if(!m&&isNaN(+v)&&"number"===e.type&&(m=!0),b)isNaN(+v)?"number"===e.type?(t.push(e),u=!0):t.push(e):t.push({type:"number",value:+v});else if(h){let e={type:"string",value:v};d.push(e),t.push(e)}else t.push(e)}v=""}r&&(("+"===r||"-"===r)&&N(),i&&" "===e[a-1]&&(i=""),o&&" "===e[a+1]&&(o=""),l?t.push({type:"separator",value:r,text:r}):t.push({type:"separator",value:r,text:i+r+o})),f=!1},C=()=>{("rem"===this.definition.unit||"em"===this.definition.unit)&&t.push({type:"separator",value:"/",text:" / "},{type:"number",value:this.css.config.rootSize}),t.push({type:"separator",value:"*",text:" * "},{type:"number",value:1,unit:this.definition.unit})},N=()=>{!b||u||o||h&&!m||C(),b=!1,u=!1};for(;a<e.length;a++){let r=e[a];if("("===r){let e=/^([+-])/.exec(v);e&&t.push({type:"string",value:e[1]});let l=e?v.slice(1):v,s={type:"function",name:l,symbol:r,children:[],bypassTransform:"calc"===l};t.push(s),v="",a++;let o="$"===l||"var"===l;if(!(c=i(s.children,""!==l&&"calc"!==l&&(o||Object.prototype.hasOwnProperty.call(p,l)),f||o||b&&u,b,o)||"var"===l)&&"$"===l){let e=this.css.variables[s.children[0].value]?.type;c=!e||"string"===e}c&&(m=!0,u=!0)}else if(")"===r){if(g(""),m)for(let e of d)Object.assign(e,this.parseValueComponent(e.value));return m}else if(","===r)g(r,""," ");else if(" "===r)g(r);else{let t=e[a-1];switch(r){case"+":case"-":v||")"===t?g(r," "," "):v+=r;break;case"*":this.definition.unit&&(b=!0),g(r," "," ");break;case"/":this.definition.unit&&(b=!0),g(r," "," "),f=!0;break;default:v+=r}}}g(""),N()};return i(r,!1,!1,!1,!1),"calc("+this.resolveValue(r,p.calc.unit??this.definition.unit,t,!0)+")"}},translate:{unit:"rem"},translateX:{unit:"rem"},translateY:{unit:"rem"},translateZ:{unit:"rem"},translate3d:{unit:"rem"},skew:{unit:"deg"},skewX:{unit:"deg"},skewY:{unit:"deg"},skewZ:{unit:"deg"},skew3d:{unit:"deg"},rotate:{unit:"deg"},rotateX:{unit:"deg"},rotateY:{unit:"deg"},rotateZ:{unit:"deg"},rotate3d:{unit:"deg"},blur:{unit:"rem"},"drop-shadow":{unit:"rem"},"hue-rotate":{unit:"deg"},rgb:{unit:""},rgba:{unit:""},hsl:{unit:""},hsla:{unit:""},color:{unit:"",colored:!0},"color-contrast":{unit:"",colored:!0},"color-mix":{unit:"",colored:!0},hwb:{unit:""},lab:{unit:""},lch:{unit:""},oklab:{unit:""},oklch:{unit:""},clamp:{unit:""},repeat:{unit:""},"linear-gradient":{colored:!0},"radial-gradient":{colored:!0},"conic-gradient":{colored:!0},"repeating-linear-gradient":{colored:!0},"repeating-radial-gradient":{colored:!0},"repeating-conic-gradient":{colored:!0}},b={mediaQueries:s,selectors:a,semantics:i,rules:n.default,functions:p,animations:l,variables:o,scope:"",rootSize:16,baseUnit:4,override:!1,important:!1,themeDriver:"class"};r.selectors=a,r.semantics=i,r.animations=l,r.variables=o,r.rules=n.default,r.functions=p,r.mediaQueries=s,r.config=b;var v={};let g=/^(media|supports|page|font-face|keyframes|counter-style|font-feature-values|property|layer)(?=\||{|\(|$)/;function C(e){let t="undefined"!=typeof Buffer?Buffer:null;return!!t&&e instanceof t||e instanceof Date||e instanceof RegExp}function N(e){if(("undefined"!=typeof Buffer?Buffer:null)&&e instanceof Buffer){let t=Buffer.alloc(e.length);return e.copy(t),t}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e);throw Error("Unexpected situation")}function x(e,t){return"__proto__"===t?void 0:e[t]}function L(...e){let t,r;let a={};return e.forEach(function(e){"object"!=typeof e||null===e||Array.isArray(e)||Object.keys(e).forEach(function(i){if(r=x(a,i),(t=x(e,i))!==a){if("object"!=typeof t||null===t){a[i]=t;return}if(Array.isArray(t)){a[i]=function e(t){let r=[];return t.forEach(function(t,a){"object"==typeof t&&null!==t?Array.isArray(t)?r[a]=e(t):C(t)?r[a]=N(t):r[a]=L({},t):r[a]=t}),r}(t);return}if(C(t)){a[i]=N(t);return}if("object"!=typeof r||null===r||Array.isArray(r)){a[i]=L({},t);return}else{a[i]=L(r,t);return}}})}),a}v.Rule=class{className;css;at;priority;natives;order;layer;stateToken;declarations;animationNames;variableNames;constructor(e,t,r){let a,i,l;this.className=e,this.css=r,this.at={},this.priority=-1,this.natives=[],this.order=0,this.layer=0,this.resolveValue=(e,t,r,a)=>{let{functions:i}=this.css.config,l="";for(let s of e)switch(s.type){case"function":let e=i&&i[s.name];if(e?.transform&&!s.bypassTransform){let i=e.transform.call(this,this.resolveValue(s.children,e.unit??t,r,a||"calc"===s.name),r);l+=s.text="string"==typeof i?i:this.resolveValue(i,e?.unit??t,r,a)}else l+=s.text=s.name+s.symbol+this.resolveValue(s.children,e?.unit??t,r,a)+h.START_SYMBOLS[s.symbol];break;case"variable":let o=this.css.variables[s.name];if(o){let e=(e,t)=>{if(o.themes){if(this.theme){let t=o.themes[this.theme]??o;t?.value&&e(t)}else this.variableNames||(this.variableNames=[]),this.variableNames.includes(s.name)||this.variableNames.push(s.name),t()}else e(o)};switch(o.type){case"string":e(e=>{let i=[];this.parseValue(i,0,e.value,t,"",void 0,a,[...r,s.name]),l+=s.text=this.resolveValue(i,t,[...r,s.name],a)},()=>{l+=s.text=`var(--${s.name})`});break;case"number":e(e=>{if(a)l+=s.text=e.value;else{let r=this.parseValueComponent(e.value,t);l+=s.text=r.value+(r.unit??"")}},()=>{l+=s.text=t?`calc(var(--${s.name}) / 16 * 1rem)`:`var(--${s.name})`});break;case"color":let i=s.alpha?"/"+s.alpha:"";e(e=>{l+=s.text=`${e.space}(${e.value}${i})`},()=>{l+=s.text=`${o.space}(var(--${s.name})${i})`})}}else l+=s.text=`var(--${s.name}${s.fallback?","+s.fallback:""})`;break;case"separator":l+=s.text?s.text:s.text=s.value;break;case"number":l+=s.text=s.value+(s.unit||"");break;default:l+=s.text=s.value}return l},this.parseValue=(e,t,r,a,i,l,s=!1,o=[])=>{let n=void 0===l,c=!n&&(l.endsWith("$")||l.endsWith("var")),d="'"===i||'"'===i,f=[","];this.definition.separators?.length&&f.push(...this.definition.separators);let m="",u=()=>{if(m){let t=!1;if(!c||e.length){let r=(r,a)=>{let i=Object.prototype.hasOwnProperty.call(this.variables,r)?this.variables[r]:Object.prototype.hasOwnProperty.call(this.css.variables,r)?this.css.variables[r]:void 0;if(i){let l=i.name??r;if(!o.includes(l)){t=!0;let r={type:"variable",name:l,variable:this.css.variables[l]};a&&(r.alpha=a),e.push(r)}}};if(r(m),!t&&this.colored){let[e,t]=m.split("/");r(e,t)}}if(!t){if(!c){let e=y.BASE_UNIT_REGEX.exec(m);e&&(m=String(+e[1]*(this.css.config.baseUnit??1)))}s?e.push({type:"string",value:m}):e.push(this.parseValueComponent(m,a))}m=""}};for(;t<r.length;t++){let o=r[t];if(o===i){if(d){let e=0;for(let t=m.length-1;"\\"===m[t];t--)e++;if(e%2){m+=o;continue}u()}else u();return t}if(!d&&o in h.START_SYMBOLS){let i=m,n={type:"function",name:i,symbol:o,children:[]};e.push(n),m="";let c="("===o?this.css.config.functions?.[i]:void 0;!this.colored&&c?.colored&&(this.colored=!0),t=this.parseValue(n.children,++t,r,c?.unit??a,h.START_SYMBOLS[o],i||l||"",s||"calc"===i)}else if("|"!==o&&" "!==o||"}"===i||d&&"path"!==l){if(!d){if("."===o){if(isNaN(+r[t+1])){if(n)break}else"-"===r[t-1]&&(m+="0")}else if(f.includes(o)){u(),e.push({type:"separator",value:o,text:(","===o?"":" ")+o+(","===o?"":" ")});continue}else if(n&&("#"===o&&(m||e.length&&"separator"!==e[e.length-1].type)||["!","*",">","+","~",":","[","@","_"].includes(o)))break}m+=o}else u(),e.push({type:"separator",value:" "})}return u(),t},Object.assign(this,t);let{id:s,definition:o}=t,{analyze:n,transformValue:f,declare:m,transformValueComponents:u,create:p,layer:b,unit:v,colored:C}=o;this.layer=b,this.colored=!!C,o.unit||(o.unit=""),o.separators||(o.separators=[","]);let{scope:N,important:x,themeDriver:L}=r.config,{selectors:w,mediaQueries:k,stylesBy:S,animations:$}=r,R=S[e];if(p&&p.call(this,e),this.declarations=o.declarations,b===d.Layer.Semantic)a=e.slice(s.length-1);else{let t;if(n)[t,i]=n.call(this,e);else{let r=e.indexOf(":");this.prefix=e.slice(0,r+1),t=e.slice(r+1)}this.valueComponents=[],a=t.slice(this.parseValue(this.valueComponents,0,t,v,"",void 0,!1,"animation"===s||"animation-name"===s?Object.keys(this.css.animations):[]))}"!"===a[0]&&(this.important=!0,a=a.slice(1)),this.stateToken=a;let O=(e,t)=>{let r=(e,t,a,i)=>{for(let[i,l]of t)if(i.test(e)){for(let s of l)r(e.replace(i,s),t,a,!0);return}i&&a.push(e)},a=e=>{let t=e.split(/(\\'(?:.*?)[^\\]\\')(?=[*_>~+,)])|(\[[^=]+='(?:.*?)[^\\]'\])/).map((e,t)=>t%3?e:e.replace(/(^|[^_])_(?!_)/g,"$1 ")).join(""),r=[],a="",i=0;for(let e=0;e<t.length;e++){let l=t[e];if("\\"===l){a+=l+t[++e];continue}i||","!==l?(a+=l,i&&")"===l?i--:"("===l&&i++):(r.push(a),a="")}return a&&r.push(a),r},i=[];""in w?r(e,w[""],i,!0):i.push(e);let l={};for(let[e,t]of Object.entries(w)){if(!e)continue;let a=[];for(let e of i)r(e,t,a,!1);a.length&&(l[e]=a)}let s=(e,r)=>{let i=r.reduce((e,t)=>(e.push(...a(t)),e),[]);e in t?t[e].push(...i):t[e]=i},o=Object.keys(l);if(o.length)for(let e of o)s(e,l[e]);else s("",i)};i?(this.vendorPrefixSelectors={},O(i,this.vendorPrefixSelectors)):this.vendorPrefixSelectors={"":[""]};let j=a.split("@"),P=j[0];if(P)for(let e of(this.vendorSuffixSelectors={},O(P,this.vendorSuffixSelectors),Object.values(this.vendorSuffixSelectors)))for(let t of e){!1!==this.hasWhere&&(this.hasWhere=t.includes(":where("));let e=[":disabled",":active",":focus",":hover"];for(let r=0;r<e.length;r++)if(t.includes(e[r])){(-1===this.priority||this.priority>r)&&(this.priority=r);break}}else this.vendorSuffixSelectors={"":[""]};let A={},z=Object.prototype.hasOwnProperty.call(this.vendorPrefixSelectors,""),V=Object.prototype.hasOwnProperty.call(this.vendorSuffixSelectors,"");if(z)A[""]=V?[""]:Object.keys(this.vendorSuffixSelectors);else if(V)for(let e in this.vendorPrefixSelectors)A[e]=[""];else for(let e in this.vendorPrefixSelectors){let t=A[e]=[];if(Object.prototype.hasOwnProperty.call(this.vendorSuffixSelectors,e))t.push(e);else for(let e in this.vendorSuffixSelectors)t.push(e)}for(let e=1;e<j.length;e++){let t=j[e];if(t){if("rtl"===t||"ltr"===t)this.direction=t;else{let e,r="",a=g.exec(t);if(a)r=a[1],e=t.slice(r.length);else{this.media={token:t,features:{}};let a=[],i=e=>{if("all"===e||"print"===e||"screen"===e||"speech"===e)this.media.type=e;else if("🖨"===e)this.media.type="print";else if("landscape"===e||"portrait"===e)a.push("(orientation:"+e+")");else if("motion"===e||"reduced-motion"===e)a.push("(prefers-reduced-motion:"+("motion"===e?"no-preference":"reduce")+")");else{let t=k[e];if(t&&"string"==typeof t)a.push(t);else{let r="",i="",l=0;e.startsWith("<=")?(i="<=",r="max-width"):e.startsWith(">=")||t?(i=">=",r="min-width"):e.startsWith(">")?(i=">",r="min-width",l=.02):e.startsWith("<")&&(i="<",r="max-width",l=-.02);let s=i?e.replace(i,""):e,o=k[s];switch(r){case"max-width":case"min-width":let n={};"number"==typeof o?n={type:"number",value:o+l,unit:"px"}:"number"===(n=this.parseValueComponent(s,"px")).type&&"px"===n.unit&&(n.value+=l),this.media.features[r]=n,"number"===n.type?a.push("("+r+":"+(n.value+n.unit)+")"):a.push("("+r+":"+n.value+")")}}}},l=t.includes("&");if(l)for(let e of t.split("&"))i(e);else i(t);if(this.media.type&&(e=this.media.type),a.length&&(e=a.join(" and ")),e)r="media";else if(!l){this.theme=t;continue}}e&&(this.at[r]=(r in this.at?this.at[r]+" and ":"")+e.replace(/\|/g," "))}}}this.valueComponents&&(u&&(this.valueComponents=u.call(this,this.valueComponents)),l=this.resolveValue(this.valueComponents,v,[],!1),f&&(l=f.call(this,l)),m?this.declarations=m.call(this,l,this.valueComponents):s&&(this.declarations={[s]:l}));let T=[];for(let e in this.declarations){let t=e=>{if($&&(e.startsWith("animation")||e.startsWith("animation-name"))){let t=e.split(":")[1].split("!important")[0].split(" ").filter(e=>e in this.css.animations&&(!this.animationNames||!this.animationNames.includes(e)));t.length&&(this.animationNames||(this.animationNames=[]),this.animationNames=t)}T.push(e+((this.important||x)&&!e.endsWith("!important")?"!important":""))},r=e+":",a=this.declarations[e];if(Array.isArray(a))for(let e of a)t(r+String(e));else t(r+String(a))}if(T.length)for(let t in A)for(let r of A[t]){let a="";this.direction&&(a+="[dir="+this.direction+"] ");let i=this.vendorPrefixSelectors[t],l=this.vendorSuffixSelectors[r],s=i.map(e=>e+a),o=e=>s.map(e=>(this.theme&&"media"!==L?"host"===L?`:host(.${this.theme}) `:`.${this.theme} `:"")+(N?N+" ":"")+e).reduce((t,r)=>(t.push(l.reduce((t,a)=>(t.push(r+"."+c(e)+a),t),[]).join(",")),t),[]).join(","),n=o(e)+(R?R.reduce((e,t)=>e+","+o(t),""):"")+"{"+T.join(";")+"}";for(let e of Object.keys(this.at).sort((e,t)=>"supports"===t?-1:1))n="@"+e+(e.includes(" ")?"":" ")+this.at[e]+"{"+n+"}";this.theme&&"media"===L&&(n=`@media(prefers-color-scheme:${this.theme}){`+n+"}"),this.natives.push({text:n})}}resolveValue;get text(){return this.natives.map(e=>e.text).join("")}parseValue;parseValueComponent(e,t=this.definition.unit){let r;let a=t??this.definition.unit,i="";if("number"==typeof e)return a&&!i?(("rem"===a||"em"===a)&&(r=e/(this.css.config.rootSize||1)),i=a||""):r=e,{value:r,unit:i,type:"number"};if(a){if(/^\d+\/\d+/.test(e)){let[t,r]=e.split("/");return{value:+t/+r*100,unit:"%",type:"number"}}let t=e.match(/^([+-.]?\d+(\.?\d+)?)(%|cm|mm|q|in|pt|pc|px|em|rem|ex|rex|cap|rcap|ch|rch|ic|ric|lh|rlh|vw|svw|lvw|dvw|vh|svh|lvh|dvh|vi|svi|lvi|dvi|vb|svb|lvb|dvb|vmin|svmin|lvmin|dvmin|vmax|svmax|lvmax|dvmax|cqw|cqh|cqi|cqb|cqmin|cqmax|deg|grad|rad|turn|s|ms|hz|khz|dpi|dpcm|dppx|x|fr|db|st)?$/);if(t)return r=+t[1],(i=t[3]||"")||(("rem"===a||"em"===a)&&(r/=this.css.config.rootSize||1),i=a||""),{value:r,unit:i,type:"number"}}return{value:e,type:"string"}}};var w={},k={};k.hexToRgb=function(e){let t,r,a,i;return e.startsWith("#")&&(e=e.slice(1)),3===e.length||4===e.length?(t=parseInt(e[0]+e[0],16),r=parseInt(e[1]+e[1],16),a=parseInt(e[2]+e[2],16),i=4===e.length?Math.round(parseInt(e[3]+e[3],16)/255*100)/100:1):(6===e.length||8===e.length)&&(t=parseInt(e.slice(0,2),16),r=parseInt(e.slice(2,4),16),a=parseInt(e.slice(4,6),16),i=8===e.length?Math.round(parseInt(e.slice(6,8),16)/255*100)/100:1),[t,r,a,i]};var S={};S.flattenObject=function e(t,r=""){return Object.entries(t).reduce((t,[a,i])=>{let l=r?`${r}${a?"-"+a:""}`:a;return"object"!=typeof i||Array.isArray(i)?t[l]=i:Object.assign(t,e(i,l)),t},{})};var $={};$.extendConfig=function(...e){let t=e=>{let t=L({},e),r=e=>{for(let t in e){let a=e[t];"object"!=typeof a||Array.isArray(a)?t&&!t.startsWith("@")&&(e[t]={"":a}):r(a)}};return t.styles?r(t.styles):t.styles={},t.mediaQueries?r(t.mediaQueries):t.mediaQueries={},t.variables?r(t.variables):t.variables={},t},r=[];for(let a of e)!function e(a){if(a.extends?.length)for(let t of a.extends)e("config"in t?t.config:t);r.push(t(a))}(a);let a=r[0];for(let e=1;e<r.length;e++){let t=r[e];a=L(a,t),Object.prototype.hasOwnProperty.call(t,"animations")&&a.animations&&Object.assign(a.animations,t.animations)}return a},Object.defineProperty(w,"__esModule",{value:!0});class R{customConfig;static config=r.config;rules;ruleBy;classesUsage;config;RegisteredSemanticRules;RegisteredRules;constructor(e=r.config){this.customConfig=e,this.rules=[],this.ruleBy={},this.classesUsage={},this.RegisteredSemanticRules=[],this.RegisteredRules=[],e?.override?this.config=$.extendConfig(e):this.config=$.extendConfig(r.config,e),this.resolve(),this.constructor===R&&O.push(this)}resolve(){this.styles={},this.stylesBy={},this.selectors={},this.variables={},this.mediaQueries={},this.animations={},this.RegisteredRules.length=0,this.RegisteredSemanticRules.length=0,this.variablesNativeRules={},this.hasKeyframesRule=!1;let e={current:void 0,currentColor:void 0,transparent:void 0},{styles:t,selectors:r,variables:a,semantics:i,mediaQueries:l,rules:s,animations:o}=this.config;function n(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}if(r){let e=S.flattenObject(r);for(let t in e){let r=e[t],a=RegExp(n(t)+"(?![a-z-])");for(let e of Array.isArray(r)?r:[r]){let t=e.match(/^::-[a-z]+-/m)?.[0]??"",r=this.selectors[t];r||(r=this.selectors[t]=[]);let i=r.find(([e])=>e===a);i||(i=[a,[]],r.push(i)),i[1].push(e)}}}if(a){let t={},r=(a,i,l)=>{if(!a)return;let s=(t,r,a,i)=>{if(void 0===r)return;if("color"===r.type){if(i){let e=r.value.indexOf("/");r={...r,value:-1===e?r.value+" / "+(i.startsWith("0.")?i.slice(1):i):r.value.slice(0,e+2)+String(+r.value.slice(e+2)*+i).slice(1)}}e[t]=void 0}let s=a??l;if(void 0!==s){if(Object.prototype.hasOwnProperty.call(this.variables,t)){let e=this.variables[t];s?(e.themes||(e.themes={}),e.themes[s]=r):(e.value=r.value,"color"===r.type&&(e.space=r.space))}else if(s){let e={type:r.type,themes:{[s]:r}};"color"===r.type&&(e.space=r.space),this.variables[t]=e}else this.variables[t]=r}else this.variables[t]=r},o=typeof a;if("object"===o){if(Array.isArray(a))s(i,{type:"string",value:a.join(",")});else{let e=Object.keys(a);for(let t of e)""===t||t.startsWith("@")?r(a[t],i,t||e.some(e=>e.startsWith("@"))?t.slice(1):void 0):r(a[t],i+"-"+t,void 0)}}else if("number"===o)s(i,{type:"number",value:a}),s("-"+i,{type:"number",value:-1*a});else if("string"===o){let e=/^\$\((.*?)\)(?: ?\/ ?(.+?))?$/.exec(a);if(e)Object.prototype.hasOwnProperty.call(t,i)||(t[i]={}),t[i][l]=()=>{delete t[i][l];let[r,a]=e[1].split("@");if(r){if(Object.prototype.hasOwnProperty.call(t,r))for(let e of Object.keys(t[r]))t[r][e]?.();let l=this.variables[r];if(l){if(void 0===a&&l.themes)for(let t in s(i,{type:l.type,value:l.value,space:l.space},"",e[2]),l.themes)s(i,l.themes[t],t,e[2]);else{let t=void 0!==a?l.themes?.[a]:l;if(t){let r={type:t.type,value:t.value};"color"===t.type&&(r.space=t.space),s(i,r,void 0,e[2])}}}}};else{let e=/^#([A-Fa-f0-9]{3,4}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})$/.exec(a);if(e){let[t,r,a,l]=k.hexToRgb(e[1]);s(i,{type:"color",value:`${t} ${r} ${a}${1===l?"":" / "+l}`,space:"rgb"})}else{let e=/^rgb\( *([0-9]{1,3})(?: *, *| +)([0-9]{1,3})(?: *, *| +)([0-9]{1,3}) *(?:(?:,|\/) *(.*?) *)?\)$/.exec(a);if(e)s(i,{type:"color",value:e[1]+" "+e[2]+" "+e[3]+(e[4]?" / "+(e[4].startsWith("0.")?e[4].slice(1):e[4]):""),space:"rgb"});else{let e=/^hsl\((.*?)\)$/.exec(a);e?s(i,{type:"color",value:e[1],space:"hsl"}):s(i,{type:"string",value:a})}}}}};for(let e in a)r(a[e],e);for(let e of Object.keys(t))for(let r of Object.keys(t[e]))t[e][r]?.()}if(l&&(this.mediaQueries=S.flattenObject(l)),o)for(let e in o){let t=this.animations[e]={},r=o[e];for(let e in r){let a=t[e]={},i=r[e];for(let e in i)a[e]=i[e]}}let c=t?S.flattenObject(t):{},h=Object.keys(c),f=e=>{if(Object.prototype.hasOwnProperty.call(this.styles,e))return;let t=this.styles[e]=[],r=c[e];if(r)for(let a of r.replace(/(?:\n(?:\s*))+/g," ").trim().split(" ")){let r=r=>{if(Object.prototype.hasOwnProperty.call(this.stylesBy,r)){let t=this.stylesBy[r];t.includes(e)||t.push(e)}else this.stylesBy[r]=[e];t.includes(r)||t.push(r)};if(h.includes(a))for(let e of(f(a),this.styles[a]))r(e);else r(a)}};for(let e of h)f(e);if(i&&Object.entries(i).sort((e,t)=>e[0].localeCompare(t[0])).forEach(([e,t],r)=>{this.RegisteredSemanticRules.push({id:"."+e,match:RegExp("^"+n(e)+"(?=!|\\*|>|\\+|~|:|\\[|@|_|\\.|$)","m"),order:r,definition:{declarations:t,layer:d.Layer.Semantic}})}),s){let t=Object.entries(s).sort((e,t)=>e[1].layer!==t[1].layer?(t[1].layer||0)-(e[1].layer||0):t[0].localeCompare(e[0])),r=t.length,a=Object.keys(e);t.forEach(([e,t],i)=>{let l={id:e,variables:{},order:this.RegisteredSemanticRules.length+r-1-i,definition:t};this.RegisteredRules.push(l);let s=t.match,o=e=>{for(let t in this.variables)if(t.startsWith(e+"-")||t.startsWith("-"+e+"-")){let r=t.slice(e.length+(e.startsWith("-")?0:1));l.variables[r]={...this.variables[t],name:t}}};if(t.variables)for(let e of t.variables)o(e);if(o(e),s){if(Array.isArray(s)){let[e,r=[]]=s,i=[];r.length&&i.push(`(?:${r.join("|")})(?![a-zA-Z0-9-])`),Object.keys(l.variables).length&&i.push(`(?:${Object.keys(l.variables).join("|")})(?![a-zA-Z0-9-])`),t.colored&&i.push("#","(?:color|color-contrast|color-mix|hwb|lab|lch|oklab|oklch|rgb|rgba|hsl|hsla)\\(.*\\)",`(?:${a.join("|")})(?![a-zA-Z0-9-])`),t.numeric&&i.push("[\\d\\.]","(?:max|min|calc|clamp)\\(.*\\)"),i.length&&(l.match=RegExp(`^${e}:(?:${i.join("|")})[^|]*?(?:@|$)`))}else l.match=s}})}}match(e){for(let t of this.RegisteredRules)if(t.match?.test(e)||(t.definition.layer===d.Layer.Native||t.definition.layer===d.Layer.NativeShorthand||t.definition.layer===d.Layer.CoreNative||t.definition.layer===d.Layer.CoreNativeShorthand)&&e.startsWith(t.id+":"))return t;for(let t of this.RegisteredSemanticRules)if(t.match?.test(e))return t}generate(e){return(Object.prototype.hasOwnProperty.call(this.styles,e)?this.styles[e].map(e=>this.create(e)):[this.create(e)]).filter(e=>e&&e.text)}create(e){if(Object.prototype.hasOwnProperty.call(this.ruleBy,e))return this.ruleBy[e];let t=this.match(e);if(t)return new v.Rule(e,t,this)}refresh(e=this.customConfig){for(let t in e?.override?this.config=$.extendConfig(e):this.config=$.extendConfig(r.config,e),this.resolve(),this.rules.length=0,this.ruleBy={},this.classesUsage)this.add(t);return this}reset(){for(let e in this.ruleBy={},this.classesUsage={},this.rules.length=0,this.hasKeyframesRule=!1,this.variablesNativeRules={},this.animations){let t=this.animations[e];t.usage=0,t.native=void 0}for(let e in this.variables)this.variables[e].usage=0;return this}destroy(){return this.reset(),O.splice(O.indexOf(this),1),this}add(...e){for(let t of e){let e=this.generate(t);if(e.length)for(let t of e)this.insert(t)}return this}delete(...e){let t=this.style?.sheet,r=e=>{let r=this.ruleBy[e];if(!(!r||Object.prototype.hasOwnProperty.call(this.stylesBy,e)&&this.stylesBy[e].some(e=>Object.prototype.hasOwnProperty.call(this.classesUsage,e)))){if(t&&r.natives.length){let e=r.natives[0];for(let a=0;a<t.cssRules.length;a++)if(t.cssRules[a]===e.cssRule){for(let e=0;e<r.natives.length;e++)t.deleteRule(a);break}}if(this.rules.splice(this.rules.indexOf(r),1),delete this.ruleBy[e],r.variableNames)for(let e of r.variableNames){let r=this.variables[e];if(r.usage||(r.usage=0),!--r.usage){let a=r=>{let a=this.variablesNativeRules[r];if(a.cssRule.style.removeProperty("--"+e),!a.cssRule.style.length){let e=this.rules[0],i=e.natives.indexOf(a);t?.deleteRule(i),e.natives.splice(i,1),delete this.variablesNativeRules[r],e.natives.length||(this.rules.splice(0,1),this.variablesNativeRules={})}};if(r.value&&a(""),r.themes)for(let e in r.themes)a(e)}}if(r.animationNames){let e=Object.keys(this.variablesNativeRules).length?1:0,t=this.rules[e];for(let e of r.animationNames){let r=this.animations[e];if(r.usage||(r.usage=0),!--r.usage&&r.native){let e=t.natives.indexOf(r.native);this.style.sheet?.deleteRule(Object.keys(this.variablesNativeRules).length+e),t.natives.splice(e,1),r.native=void 0}}t.natives.length||(this.rules.splice(e,1),this.hasKeyframesRule=!1)}r.definition.delete?.call(r,e)}};for(let t of e)if(Object.prototype.hasOwnProperty.call(this.styles,t)){for(let e of this.styles[t])Object.prototype.hasOwnProperty.call(this.classesUsage,e)||r(e);delete this.ruleBy[t]}else r(t)}insert(e){let t,r,a;if(this.ruleBy[e.className])return;let i=this.rules.length-1,{media:l,order:s,priority:o,hasWhere:n,className:c}=e,h=(e,t,r)=>{let a=e;for(;a<=i;a++){let e=this.rules[a];if(t?.(e))break;if(r?.(e))return a}return r?-1:a-1};if(l){let e=this.rules.findIndex(e=>e.media);if(-1===e)t=i+1;else{let{"max-width":s,"min-width":n}=l.features;if(s||n){let e=this.rules.findIndex(e=>e.media?.features["max-width"]||e.media?.features["min-width"]);if(-1===e)t=i+1;else if(s&&n){if(-1===o?(r=h(e,e=>-1!==e.priority,e=>e.media.features["max-width"]&&e.media.features["min-width"]),a=h(e,e=>-1!==e.priority)):(r=h(e,void 0,e=>e.media.features["max-width"]&&e.media.features["min-width"]&&-1!==e.priority),a=i),-1!==r){let e=s.value-n.value,t=a,i=r;for(r=void 0;t>=i;t--){let{"max-width":i,"min-width":l}=this.rules[t].media.features,s=i.value-l.value;if(s<e)a=t-1;else if(s===e)r=t;else break}}if(-1!==r&&void 0!==r){let e=s.value-n.value;for(let t=a;t>=r;t--){let{"max-width":i,"min-width":l}=this.rules[t].media.features,s=i.value-l.value;if(s<e)a=t-1;else if(s>e){r=t+1;break}}}}else if(n){if(-1===o?(r=h(e,e=>e.media.features["max-width"]&&e.media.features["min-width"]||-1!==e.priority,e=>!e.media.features["max-width"]&&e.media.features["min-width"]),a=h(e,e=>e.media.features["max-width"]&&e.media.features["min-width"]||-1!==e.priority)):(r=h(e,e=>e.media.features["max-width"]&&e.media.features["min-width"]&&-1!==e.priority,e=>!e.media.features["max-width"]&&e.media.features["min-width"]&&-1!==e.priority),a=h(e,e=>e.media.features["max-width"]&&e.media.features["min-width"]&&-1!==e.priority)),-1!==r)for(let e=a;e>=r;e--){let t=this.rules[e].media.features["min-width"].value;if(t>n.value)a=e-1;else if(t<n.value){r=e+1;break}}}else if(-1===o?(r=h(e,e=>e.media.features["min-width"]||-1!==e.priority,e=>e.media.features["max-width"]),a=h(e,e=>e.media.features["min-width"]||-1!==e.priority)):(r=h(e,e=>e.media.features["min-width"]&&-1!==e.priority,e=>e.media.features["max-width"]&&-1!==e.priority),a=h(e,e=>e.media.features["min-width"]&&-1!==e.priority)),-1!==r)for(let e=a;e>=r;e--){let t=this.rules[e].media.features["max-width"].value;if(t<s.value)a=e-1;else if(t>s.value){r=e+1;break}}}else -1===o?(r=e,a=h(e,e=>e.media?.features["max-width"]||e.media?.features["min-width"]||-1!==e.priority)):(r=h(e,e=>e.media?.features["max-width"]||e.media?.features["min-width"],e=>-1!==e.priority),a=h(e,e=>e.media?.features["max-width"]||e.media?.features["min-width"]))}}else{let e=Object.keys(this.variablesNativeRules).length?this.hasKeyframesRule?2:1:this.hasKeyframesRule?1:0;-1===o?(r=e,a=h(e,e=>e.media||-1!==e.priority)):(r=h(e,e=>e.media,e=>-1!==e.priority),a=h(e,e=>e.media))}if(void 0===t&&void 0!==a&&void 0!==r){if(-1===r)t=a+1;else{if(-1===o)for(let e=r;e<=a;e++){let r=this.rules[e];if((n||!r.hasWhere)&&(n&&!r.hasWhere||r.order>=s)){t=e;break}}else for(let e=r;e<=a;e++){let r=this.rules[e];if(n||!r.hasWhere){if(n&&!r.hasWhere||r.priority<o){t=e;break}if(r.priority===o){if(r.order>=s){t=e;break}}else t=e+1}}void 0===t&&(t=a+1)}}if(this.rules.splice(t,0,e),this.ruleBy[c]=e,this.style){let r=this.style.sheet,a=0,i=e=>{let t=this.rules[e];if(t){if(!t.natives.length)return i(e-1);let l=t.natives[t.natives.length-1],s=l.cssRule?.parentRule??l.cssRule;if(r){for(let e=0;e<r.cssRules.length;e++)if(r.cssRules[e]===s){a=e+1;break}}}};i(t-1);for(let t=0;t<e.natives.length;)try{let i=e.natives[t];r?.insertRule(i.text,a),i.cssRule=r?.cssRules[a++],t++}catch(r){console.error(r),e.natives.splice(t,1)}}this.handleRuleWithVariableNames(e),this.handleRuleWithAnimationNames(e),e.definition.insert?.call(e)}get text(){return this.rules.map(e=>e.text).join("")}handleRuleWithAnimationNames(e,t=!1){if(e.animationNames){let r=this.style?.sheet;for(let a of e.animationNames){let e=this.animations[a];if(e.usage)e.usage++;else{let i;let l={text:`@keyframes ${a}{`+Object.entries(e).filter(([e])=>"usage"!==e&&"native"!==e).map(([e,t])=>`${e}{${Object.entries(t).map(([e,t])=>e+":"+t).join(";")}}`).join("")+"}"},s=Object.keys(this.variablesNativeRules).length?1:0;if(this.hasKeyframesRule?(i=this.rules[s]).natives.push(l):(this.rules.splice(s,0,i={natives:[l],get text(){return this.natives.map(e=>e.text).join("")}}),this.hasKeyframesRule=!0),r){let e;if(t)for(let t=0;t<r.cssRules.length;t++){let i=r.cssRules[t];if("CSSKeyframesRule"===i.constructor.name&&i.name===a){e=i;break}}if(e)l.cssRule=e;else{let e=Object.keys(this.variablesNativeRules).length+i.natives.length-1;r.insertRule(l.text,e),l.cssRule=r.cssRules[e]}}e.usage=1,e.native=l}}}}handleRuleWithVariableNames(e,t=!1){if(e.variableNames){let r=this.style?.sheet;for(let a of e.variableNames){let e=this.variables[a];if(e.usage)e.usage++;else{let i=(e,i)=>{let l=this.variablesNativeRules[e];if(!l){let t,a,i;if(e)switch(this.config.themeDriver){case"media":a=`@media(prefers-color-scheme:${e})`,i=":root";break;case"host":i=`:host(.${e})`;break;default:i=`.${e}`}else i=":root";if(r){let e=Object.keys(this.variablesNativeRules).length?this.rules[0].natives.length:0;r.insertRule((a?a+"{":"")+i+"{}"+(a?a+"}":""),e),t=a?r.cssRules[e].cssRules[0]:r.cssRules[e]}else{let e=new Map,r=Object.defineProperties({},{getPropertyValue:{value:t=>e.get(t)},removeProperty:{value:t=>{e.delete(t);for(let e=0;e<r.length;e++)r[e]===t&&delete r[e]}},setProperty:{value:(t,a)=>{r[r.length]=t,e.set(t,a)}},length:{get:()=>Object.keys(r).length}});t={selectorText:i,style:r,styleMap:e},a&&(t.parentRule={conditionText:a})}l=this.pushVariableNativeRule(e,t)}let s="--"+a;t&&l.cssRule.style.getPropertyValue(s)||l.cssRule.style.setProperty(s,String(i.value))};if(e.value&&i("",e),e.themes)for(let t in e.themes)i(t,e.themes[t]);e.usage=1}}}}pushVariableNativeRule(e,t){Object.keys(this.variablesNativeRules).length||(this.variablesNativeRules={},this.rules.splice(0,0,{natives:[],get text(){return this.natives.map(e=>e.text).join("")}}));let r="",a="}";t.parentRule&&(r+=t.parentRule.conditionText.replace(/ /g,"")+"{",a+="}"),r+=t.selectorText+"{";let i={cssRule:t,get text(){let e=[];for(let r=0;r<t.style.length;r++){let a=t.style[r];e.push(a+":"+t.style.getPropertyValue(a))}return r+e.join(";")+a}};return this.rules[0].natives.push(this.variablesNativeRules[e]=i),i}}let O=[];globalThis.MasterCSS=R,globalThis.masterCSSs=O,w.default=R,w.masterCSSs=O,Object.defineProperty(t,"__esModule",{value:!0}),t.config=r.config,t.Rule=v.Rule,Object.defineProperty(t,"Layer",{enumerable:!0,get:function(){return d.Layer}}),t.extend=L,t.reorderForReadableClasses=function(e,t){let r;for(let a of(r=t?.css?t?.css:new w.default(t?.config),e))r.add(a);return r.rules.filter(e=>e.layer).sort((e,t)=>{if(e.layer===d.Layer.Semantic&&t.layer!==d.Layer.Semantic)return -1;if(e.layer!==d.Layer.Semantic&&t.layer===d.Layer.Semantic)return 1;if(e.id!==t.id)return e.className.localeCompare(t.className);{let r=e.vendorSuffixSelectors?.[""]?.[0],a=t.vendorSuffixSelectors?.[""]?.[0],i=e.media?.token,l=t.media?.token;if(-1===e.priority&&-1===t.priority){if(r&&a)return r.localeCompare(a);if(i&&l&&!Object.keys(e.media.features||{}).length&&!Object.keys(t.media.features||{}).length)return i.localeCompare(l);if(r&&!a)return 1;if(!r&&a)return -1;if(i&&!l)return 1;if(!i&&l)return -1}return e.id===t.id&&e.stateToken===t.stateToken?e.className.localeCompare(t.className):e.order-t.order}}).map(e=>e.className)},t.MasterCSS=w.default,t.default=w.default,t.selectors=a,t.semantics=i,t.rules=n.default,t.functions=p,t.animations=l,t.variables=o,t.mediaQueries=s;class j extends t.MasterCSS{root;customConfig;host;observing;progressive;container;observer;constructor(e=document,r=t.config){super(r),this.root=e,this.customConfig=r,this.observing=!1,this.progressive=!1,e||(this.root=document),this.root===document?(globalThis.runtimeCSS=this,this.container=document.head,this.host=document.documentElement):(this.container=this.root,this.host=this.root.host),P.push(this)}observe(e={subtree:!0,childList:!0}){if(this.observing||!this.root)return this;if(P.find(e=>e!==this&&e.root===this.root))return console.warn("Cannot observe the same root element repeatedly."),this;if(this.root?.styleSheets)for(let e of this.root.styleSheets){let{ownerNode:t}=e;if(t&&"master"===t.id){this.style=t,this.progressive=!0;break}}if(this.style?.sheet){let e=0;for(;e<this.style.sheet.cssRules.length;e++){let t=this.style.sheet.cssRules[e];switch(t.constructor.name){case"CSSKeyframesRule":continue;case"CSSMeidaRule":if("media"===this.config.themeDriver){let e=/\(prefers-color-scheme: (.*?)\)/.exec(t.conditionText);if(e){let r=t.cssRules[0];if(r?.constructor.name==="CSSStyleRule"&&":root"===r.selectorText){this.pushVariableNativeRule(e[1],r);continue}}}break;case"CSSStyleRule":let r=t.selectorText;if(t.style.length){let e=!0;for(let r=0;r<t.style.length;r++)if(!t.style[r]?.startsWith("--")){e=!1;break}if(e){if(":root"===r){this.pushVariableNativeRule("",t);continue}if("host"===this.config.themeDriver){let e=/:host(.*?)/.exec(r);if(e){this.pushVariableNativeRule(e[1],t);continue}}else if(!r.startsWith(".\\$")){this.pushVariableNativeRule(r.slice(1),t);continue}}}}break}for(;e<this.style.sheet.cssRules.length;e++){let t=e=>{if(e.selectorText){let t=e.selectorText.split(", ")[0].split(" ");for(let e=0;e<t.length;e++){let r=t[e];if("."===r[0]){let e=r.slice(1),t="";for(let r=0;r<e.length;r++){let a=e[r],i=e[r+1];if("\\"===a){if(r++,"\\"!==i){t+=i;continue}}else if([",",".","#","[","!","*",">","+","~",":","@"].includes(a))break;t+=a}if(!Object.prototype.hasOwnProperty.call(this.ruleBy,t)&&!Object.prototype.hasOwnProperty.call(this.styles,t)){let e=this.generate(t)[0];if(e)return e}}}}else if(e.cssRules)for(let r=0;r<e.cssRules.length;r++){let a=t(e.cssRules[r]);if(a)return a}},r=t(this.style.sheet.cssRules[e]);if(r){this.rules.push(r),this.ruleBy[r.className]=r;for(let t=0;t<r.natives.length;t++)r.natives[t].cssRule=this.style.sheet.cssRules[e+t];e+=r.natives.length-1,this.handleRuleWithVariableNames(r,!0),this.handleRuleWithAnimationNames(r,!0),r.definition.insert?.call(r)}}}else this.style=document.createElement("style"),this.style.id="master",this.container.append(this.style);let t=e=>{e.forEach(e=>{Object.prototype.hasOwnProperty.call(this.classesUsage,e)?this.classesUsage[e]++:(this.classesUsage[e]=1,this.add(e))})};return t(this.host.classList),e.subtree&&(this.root===document?this.host:this.container).querySelectorAll("[class]").forEach(e=>t(e.classList)),this.observer=new MutationObserver(e=>{let t={},r=[],a=[],i=[],l=(e,t)=>{t?e.classList.forEach(o):e.classList.forEach(s);let r=e.children;for(let e=0;e<r.length;e++){let i=r[e];i.classList&&(a.push(i),l(i,t))}},s=e=>{Object.prototype.hasOwnProperty.call(t,e)?t[e]++:t[e]=1},o=e=>{Object.prototype.hasOwnProperty.call(t,e)?t[e]--:Object.prototype.hasOwnProperty.call(this.classesUsage,e)&&(t[e]=-1)},n=(e,t)=>{for(let r=0;r<e.length;r++){let s=e[r];!s.classList||a.includes(s)||i.includes(s)||(s.isConnected!==t?(a.push(s),l(s,t)):i.push(s))}};for(let t=0;t<e.length;t++){let i=e[t],{addedNodes:l,removedNodes:s,type:o,target:c}=i;if("attributes"===o){if(r.find(e=>e.target===c))continue;r.push(i)}else n(l,!1),c.isConnected&&a.includes(c)||n(s,!0)}if(r.length||Object.keys(t).length){for(let{oldValue:e,target:t}of r){let r=a.includes(t),i=t.classList,l=e?e.split(" "):[];if(r){if(t.isConnected)continue;for(let e of l)i.contains(e)||o(e)}else if(t.isConnected)for(let e of(i.forEach(e=>{l.includes(e)||s(e)}),l))i.contains(e)||o(e)}for(let e in t){let r=t[e],a=(this.classesUsage[e]||0)+r;0===a?(delete this.classesUsage[e],this.delete(e)):(Object.prototype.hasOwnProperty.call(this.classesUsage,e)||this.add(e),this.classesUsage[e]=a)}}}),this.observer.observe(this.root,{...e,attributes:!0,attributeOldValue:!0,attributeFilter:["class"]}),this.host.style.removeProperty("display"),this.observing=!0,this}refresh(e=this.customConfig){let t=document.createElement("style");return t.id="master",this.style.replaceWith(t),this.style=t,super.refresh(e),this}reset(){super.reset();let e=this.style?.sheet;if(e?.cssRules)for(let t=e.cssRules.length-1;t>=0;t--)e.deleteRule(t);return this.progressive||(this.style?.remove(),this.style=null),this}disconnect(){return this.observer&&(this.observer.disconnect(),this.observer=null),this.observing=!1,this.reset(),this}destroy(){return this.disconnect(),P.splice(P.indexOf(this),1),this}}let P=[];globalThis.RuntimeCSS=j,globalThis.runtimeCSSs=P,new j(document,window.masterCSSConfig).observe()}();
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var css = require('@master/css');
|
|
6
|
+
|
|
7
|
+
class RuntimeCSS extends css.MasterCSS {
|
|
8
|
+
root;
|
|
9
|
+
customConfig;
|
|
10
|
+
host;
|
|
11
|
+
observing;
|
|
12
|
+
progressive;
|
|
13
|
+
container;
|
|
14
|
+
observer;
|
|
15
|
+
constructor(root = document, customConfig = css.config){
|
|
16
|
+
super(customConfig);
|
|
17
|
+
this.root = root;
|
|
18
|
+
this.customConfig = customConfig;
|
|
19
|
+
this.observing = false;
|
|
20
|
+
this.progressive = false;
|
|
21
|
+
if (!root) this.root = document;
|
|
22
|
+
if (this.root === document) {
|
|
23
|
+
globalThis.runtimeCSS = this;
|
|
24
|
+
this.container = document.head;
|
|
25
|
+
this.host = document.documentElement;
|
|
26
|
+
} else {
|
|
27
|
+
this.container = this.root;
|
|
28
|
+
this.host = this.root.host;
|
|
29
|
+
}
|
|
30
|
+
runtimeCSSs.push(this);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Observe the DOM for changes and update the running stylesheet. (browser only)
|
|
34
|
+
* @param options mutation observer options
|
|
35
|
+
* @returns this
|
|
36
|
+
*/ observe(options = {
|
|
37
|
+
subtree: true,
|
|
38
|
+
childList: true
|
|
39
|
+
}) {
|
|
40
|
+
if (this.observing || !this.root) return this;
|
|
41
|
+
if (runtimeCSSs.find((eachRuntimeCSS)=>eachRuntimeCSS !== this && eachRuntimeCSS.root === this.root)) {
|
|
42
|
+
console.warn('Cannot observe the same root element repeatedly.');
|
|
43
|
+
return this;
|
|
44
|
+
}
|
|
45
|
+
if (this.root?.styleSheets) for (const sheet of this.root.styleSheets){
|
|
46
|
+
const { ownerNode } = sheet;
|
|
47
|
+
if (ownerNode && ownerNode.id === 'master') {
|
|
48
|
+
// @ts-ignore
|
|
49
|
+
this.style = ownerNode;
|
|
50
|
+
// @ts-ignore
|
|
51
|
+
this.progressive = true;
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (this.style?.sheet) {
|
|
56
|
+
let index = 0;
|
|
57
|
+
for(; index < this.style.sheet.cssRules.length; index++){
|
|
58
|
+
const eachCSSRule = this.style.sheet.cssRules[index];
|
|
59
|
+
switch(eachCSSRule.constructor.name){
|
|
60
|
+
case 'CSSKeyframesRule':
|
|
61
|
+
continue;
|
|
62
|
+
case 'CSSMeidaRule':
|
|
63
|
+
if (this.config.themeDriver === 'media') {
|
|
64
|
+
const result = /\(prefers-color-scheme: (.*?)\)/.exec(eachCSSRule.conditionText);
|
|
65
|
+
if (result) {
|
|
66
|
+
const firstCSSRule = eachCSSRule.cssRules[0];
|
|
67
|
+
if (firstCSSRule?.constructor.name === 'CSSStyleRule' && firstCSSRule.selectorText === ':root') {
|
|
68
|
+
this.pushVariableNativeRule(result[1], firstCSSRule);
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
break;
|
|
74
|
+
case 'CSSStyleRule':
|
|
75
|
+
// eslint-disable-next-line no-case-declarations
|
|
76
|
+
const selectorText = eachCSSRule.selectorText;
|
|
77
|
+
if (eachCSSRule.style.length) {
|
|
78
|
+
let isVariablesRule = true;
|
|
79
|
+
for(let i = 0; i < eachCSSRule.style.length; i++){
|
|
80
|
+
if (!eachCSSRule.style[i]?.startsWith('--')) {
|
|
81
|
+
isVariablesRule = false;
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (isVariablesRule) {
|
|
86
|
+
if (selectorText === ':root') {
|
|
87
|
+
this.pushVariableNativeRule('', eachCSSRule);
|
|
88
|
+
continue;
|
|
89
|
+
} else {
|
|
90
|
+
if (this.config.themeDriver === 'host') {
|
|
91
|
+
const result = /:host(.*?)/.exec(selectorText);
|
|
92
|
+
if (result) {
|
|
93
|
+
this.pushVariableNativeRule(result[1], eachCSSRule);
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
} else if (!selectorText.startsWith('.\\$')) {
|
|
97
|
+
this.pushVariableNativeRule(selectorText.slice(1), eachCSSRule);
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
for(; index < this.style.sheet.cssRules.length; index++){
|
|
108
|
+
const getRule = (cssRule)=>{
|
|
109
|
+
if (cssRule.selectorText) {
|
|
110
|
+
const selectorTexts = cssRule.selectorText.split(', ');
|
|
111
|
+
const escapedClassNames = selectorTexts[0].split(' ');
|
|
112
|
+
for(let i = 0; i < escapedClassNames.length; i++){
|
|
113
|
+
const eachSelectorText = escapedClassNames[i];
|
|
114
|
+
if (eachSelectorText[0] === '.') {
|
|
115
|
+
const escapedClassName = eachSelectorText.slice(1);
|
|
116
|
+
let className = '';
|
|
117
|
+
for(let j = 0; j < escapedClassName.length; j++){
|
|
118
|
+
const char = escapedClassName[j];
|
|
119
|
+
const nextChar = escapedClassName[j + 1];
|
|
120
|
+
if (char === '\\') {
|
|
121
|
+
j++;
|
|
122
|
+
if (nextChar !== '\\') {
|
|
123
|
+
className += nextChar;
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
} else if ([
|
|
127
|
+
',',
|
|
128
|
+
'.',
|
|
129
|
+
'#',
|
|
130
|
+
'[',
|
|
131
|
+
'!',
|
|
132
|
+
'*',
|
|
133
|
+
'>',
|
|
134
|
+
'+',
|
|
135
|
+
'~',
|
|
136
|
+
':',
|
|
137
|
+
'@'
|
|
138
|
+
].includes(char)) {
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
className += char;
|
|
142
|
+
}
|
|
143
|
+
if (!Object.prototype.hasOwnProperty.call(this.ruleBy, className) && !Object.prototype.hasOwnProperty.call(this.styles, className)) {
|
|
144
|
+
const currentRule = this.generate(className)[0];
|
|
145
|
+
if (currentRule) return currentRule;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
} else if (cssRule.cssRules) {
|
|
150
|
+
for(let index = 0; index < cssRule.cssRules.length; index++){
|
|
151
|
+
const currentRule = getRule(cssRule.cssRules[index]);
|
|
152
|
+
if (currentRule) return currentRule;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
const rule = getRule(this.style.sheet.cssRules[index]);
|
|
157
|
+
if (rule) {
|
|
158
|
+
this.rules.push(rule);
|
|
159
|
+
this.ruleBy[rule.className] = rule;
|
|
160
|
+
for(let i = 0; i < rule.natives.length; i++){
|
|
161
|
+
rule.natives[i].cssRule = this.style.sheet.cssRules[index + i];
|
|
162
|
+
}
|
|
163
|
+
index += rule.natives.length - 1;
|
|
164
|
+
// variables
|
|
165
|
+
this.handleRuleWithVariableNames(rule, true);
|
|
166
|
+
// animations
|
|
167
|
+
this.handleRuleWithAnimationNames(rule, true);
|
|
168
|
+
rule.definition.insert?.call(rule);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
} else {
|
|
172
|
+
// @ts-ignore
|
|
173
|
+
this.style = document.createElement('style');
|
|
174
|
+
this.style.id = 'master';
|
|
175
|
+
this.container.append(this.style);
|
|
176
|
+
}
|
|
177
|
+
const handleClassList = (classList)=>{
|
|
178
|
+
classList.forEach((className)=>{
|
|
179
|
+
if (Object.prototype.hasOwnProperty.call(this.classesUsage, className)) {
|
|
180
|
+
this.classesUsage[className]++;
|
|
181
|
+
} else {
|
|
182
|
+
this.classesUsage[className] = 1;
|
|
183
|
+
this.add(className);
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
};
|
|
187
|
+
handleClassList(this.host.classList);
|
|
188
|
+
if (options.subtree) {
|
|
189
|
+
/**
|
|
190
|
+
* 待所有 DOM 結構完成解析後,開始繪製 Rule 樣式
|
|
191
|
+
*/ (this.root === document ? this.host : this.container).querySelectorAll('[class]').forEach((element)=>handleClassList(element.classList));
|
|
192
|
+
}
|
|
193
|
+
this.observer = new MutationObserver((mutationRecords)=>{
|
|
194
|
+
// console.time('css engine');
|
|
195
|
+
const correctionOfClassName = {};
|
|
196
|
+
const attributeMutationRecords = [];
|
|
197
|
+
const updatedElements = [];
|
|
198
|
+
const unchangedElements = [];
|
|
199
|
+
/**
|
|
200
|
+
* 取得所有深層後代的 class names
|
|
201
|
+
*/ const handleClassNameDeeply = (element, remove)=>{
|
|
202
|
+
if (remove) {
|
|
203
|
+
element.classList.forEach(removeClassName);
|
|
204
|
+
} else {
|
|
205
|
+
element.classList.forEach(addClassName);
|
|
206
|
+
}
|
|
207
|
+
const children = element.children;
|
|
208
|
+
for(let i = 0; i < children.length; i++){
|
|
209
|
+
const eachChildren = children[i];
|
|
210
|
+
if (eachChildren.classList) {
|
|
211
|
+
updatedElements.push(eachChildren);
|
|
212
|
+
handleClassNameDeeply(eachChildren, remove);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
const addClassName = (className)=>{
|
|
217
|
+
if (Object.prototype.hasOwnProperty.call(correctionOfClassName, className)) {
|
|
218
|
+
correctionOfClassName[className]++;
|
|
219
|
+
} else {
|
|
220
|
+
correctionOfClassName[className] = 1;
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
const removeClassName = (className)=>{
|
|
224
|
+
if (Object.prototype.hasOwnProperty.call(correctionOfClassName, className)) {
|
|
225
|
+
correctionOfClassName[className]--;
|
|
226
|
+
} else if (Object.prototype.hasOwnProperty.call(this.classesUsage, className)) {
|
|
227
|
+
correctionOfClassName[className] = -1;
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
const handleNodes = (nodes, remove)=>{
|
|
231
|
+
for(let i = 0; i < nodes.length; i++){
|
|
232
|
+
const eachNode = nodes[i];
|
|
233
|
+
if (eachNode.classList && !updatedElements.includes(eachNode) && !unchangedElements.includes(eachNode)) {
|
|
234
|
+
if (eachNode.isConnected !== remove) {
|
|
235
|
+
updatedElements.push(eachNode);
|
|
236
|
+
handleClassNameDeeply(eachNode, remove);
|
|
237
|
+
} else {
|
|
238
|
+
unchangedElements.push(eachNode);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
for(let i = 0; i < mutationRecords.length; i++){
|
|
244
|
+
const mutationRecord = mutationRecords[i];
|
|
245
|
+
const { addedNodes, removedNodes, type, target } = mutationRecord;
|
|
246
|
+
if (type === 'attributes') {
|
|
247
|
+
/**
|
|
248
|
+
* 防止同樣的 MutationRecord 重複執行
|
|
249
|
+
* According to this history,
|
|
250
|
+
* MutationObserver was designed to work that way.
|
|
251
|
+
* Any call to setAttribute triggers a mutation,
|
|
252
|
+
* regardless of whether the value is being changed or set to the current value
|
|
253
|
+
*/ if (attributeMutationRecords.find((eachAttributeMutationRecord)=>eachAttributeMutationRecord.target === target)) {
|
|
254
|
+
continue;
|
|
255
|
+
} else {
|
|
256
|
+
/**
|
|
257
|
+
* 第一個匹配到的 oldValue 一定是該批變動前的原始狀態值
|
|
258
|
+
*/ attributeMutationRecords.push(mutationRecord);
|
|
259
|
+
}
|
|
260
|
+
} else {
|
|
261
|
+
// 先判斷節點新增或移除
|
|
262
|
+
handleNodes(addedNodes, false);
|
|
263
|
+
// 忽略處理新元素的已刪除子節點
|
|
264
|
+
if (!target.isConnected || !updatedElements.includes(target)) {
|
|
265
|
+
handleNodes(removedNodes, true);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
if (!attributeMutationRecords.length && !Object.keys(correctionOfClassName).length) {
|
|
270
|
+
// console.timeEnd('css engine');
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
for (const { oldValue, target } of attributeMutationRecords){
|
|
274
|
+
/**
|
|
275
|
+
* 如果被操作的元素中包含了屬性變更的目標,
|
|
276
|
+
* 則將該目標從 existedAttributeMutationTargets 中移除,
|
|
277
|
+
* 以防止執行接下來的屬性變更處理
|
|
278
|
+
*
|
|
279
|
+
* 該批 mutationRecords 中,某個 target 同時有 attribute 及 childList 的變更,
|
|
280
|
+
* 則以 childList 節點插入及移除的 target.className 為主
|
|
281
|
+
*/ const updated = updatedElements.includes(target);
|
|
282
|
+
const classNames = target.classList;
|
|
283
|
+
const oldClassNames = oldValue ? oldValue.split(' ') : [];
|
|
284
|
+
if (updated) {
|
|
285
|
+
if (target.isConnected) {
|
|
286
|
+
continue;
|
|
287
|
+
} else {
|
|
288
|
+
for (const oldClassName of oldClassNames){
|
|
289
|
+
if (!classNames.contains(oldClassName)) {
|
|
290
|
+
removeClassName(oldClassName);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
} else if (target.isConnected) {
|
|
295
|
+
classNames.forEach((className)=>{
|
|
296
|
+
if (!oldClassNames.includes(className)) {
|
|
297
|
+
addClassName(className);
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
for (const oldClassName of oldClassNames){
|
|
301
|
+
if (!classNames.contains(oldClassName)) {
|
|
302
|
+
removeClassName(oldClassName);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
for(const className in correctionOfClassName){
|
|
308
|
+
const correction = correctionOfClassName[className];
|
|
309
|
+
const count = (this.classesUsage[className] || 0) + correction;
|
|
310
|
+
if (count === 0) {
|
|
311
|
+
// remove
|
|
312
|
+
delete this.classesUsage[className];
|
|
313
|
+
/**
|
|
314
|
+
* class name 從 DOM tree 中被移除,
|
|
315
|
+
* 匹配並刪除對應的 rule
|
|
316
|
+
*/ this.delete(className);
|
|
317
|
+
} else {
|
|
318
|
+
if (!Object.prototype.hasOwnProperty.call(this.classesUsage, className)) {
|
|
319
|
+
// add
|
|
320
|
+
/**
|
|
321
|
+
* 新 class name 被 connected 至 DOM tree,
|
|
322
|
+
* 匹配並創建對應的 Rule
|
|
323
|
+
*/ this.add(className);
|
|
324
|
+
}
|
|
325
|
+
this.classesUsage[className] = count;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
this.observer.observe(this.root, {
|
|
330
|
+
...options,
|
|
331
|
+
attributes: true,
|
|
332
|
+
attributeOldValue: true,
|
|
333
|
+
attributeFilter: [
|
|
334
|
+
'class'
|
|
335
|
+
]
|
|
336
|
+
});
|
|
337
|
+
this.host.style.removeProperty('display');
|
|
338
|
+
// @ts-ignore
|
|
339
|
+
this.observing = true;
|
|
340
|
+
return this;
|
|
341
|
+
}
|
|
342
|
+
refresh(customConfig = this.customConfig) {
|
|
343
|
+
const newStyle = document.createElement('style');
|
|
344
|
+
newStyle.id = 'master';
|
|
345
|
+
this.style.replaceWith(newStyle);
|
|
346
|
+
// @ts-ignore
|
|
347
|
+
this.style = newStyle;
|
|
348
|
+
super.refresh(customConfig);
|
|
349
|
+
return this;
|
|
350
|
+
}
|
|
351
|
+
reset() {
|
|
352
|
+
super.reset();
|
|
353
|
+
const sheet = this.style?.sheet;
|
|
354
|
+
if (sheet?.cssRules) {
|
|
355
|
+
for(let i = sheet.cssRules.length - 1; i >= 0; i--){
|
|
356
|
+
sheet.deleteRule(i);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
if (!this.progressive) {
|
|
360
|
+
this.style?.remove();
|
|
361
|
+
// @ts-ignore
|
|
362
|
+
this.style = null;
|
|
363
|
+
}
|
|
364
|
+
return this;
|
|
365
|
+
}
|
|
366
|
+
disconnect() {
|
|
367
|
+
if (this.observer) {
|
|
368
|
+
this.observer.disconnect();
|
|
369
|
+
this.observer = null;
|
|
370
|
+
}
|
|
371
|
+
// @ts-ignore
|
|
372
|
+
this.observing = false;
|
|
373
|
+
this.reset();
|
|
374
|
+
return this;
|
|
375
|
+
}
|
|
376
|
+
destroy() {
|
|
377
|
+
this.disconnect();
|
|
378
|
+
runtimeCSSs.splice(runtimeCSSs.indexOf(this), 1);
|
|
379
|
+
return this;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
const runtimeCSSs = [];
|
|
383
|
+
(()=>{
|
|
384
|
+
globalThis.RuntimeCSS = RuntimeCSS;
|
|
385
|
+
globalThis.runtimeCSSs = runtimeCSSs;
|
|
386
|
+
})();
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Initialize a new RuntimeCSS instance and observe the target root
|
|
390
|
+
* @param config master css config
|
|
391
|
+
* @param targetRoot target root to observe
|
|
392
|
+
* @returns master css instance
|
|
393
|
+
*/ function initCSSRuntime(config) {
|
|
394
|
+
return new RuntimeCSS(document, config).observe();
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
exports.RuntimeCSS = RuntimeCSS;
|
|
398
|
+
exports.default = RuntimeCSS;
|
|
399
|
+
exports.initCSSRuntime = initCSSRuntime;
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
import { MasterCSS, config } from '@master/css';
|
|
2
|
+
|
|
3
|
+
class RuntimeCSS extends MasterCSS {
|
|
4
|
+
root;
|
|
5
|
+
customConfig;
|
|
6
|
+
host;
|
|
7
|
+
observing;
|
|
8
|
+
progressive;
|
|
9
|
+
container;
|
|
10
|
+
observer;
|
|
11
|
+
constructor(root = document, customConfig = config){
|
|
12
|
+
super(customConfig);
|
|
13
|
+
this.root = root;
|
|
14
|
+
this.customConfig = customConfig;
|
|
15
|
+
this.observing = false;
|
|
16
|
+
this.progressive = false;
|
|
17
|
+
if (!root) this.root = document;
|
|
18
|
+
if (this.root === document) {
|
|
19
|
+
globalThis.runtimeCSS = this;
|
|
20
|
+
this.container = document.head;
|
|
21
|
+
this.host = document.documentElement;
|
|
22
|
+
} else {
|
|
23
|
+
this.container = this.root;
|
|
24
|
+
this.host = this.root.host;
|
|
25
|
+
}
|
|
26
|
+
runtimeCSSs.push(this);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Observe the DOM for changes and update the running stylesheet. (browser only)
|
|
30
|
+
* @param options mutation observer options
|
|
31
|
+
* @returns this
|
|
32
|
+
*/ observe(options = {
|
|
33
|
+
subtree: true,
|
|
34
|
+
childList: true
|
|
35
|
+
}) {
|
|
36
|
+
if (this.observing || !this.root) return this;
|
|
37
|
+
if (runtimeCSSs.find((eachRuntimeCSS)=>eachRuntimeCSS !== this && eachRuntimeCSS.root === this.root)) {
|
|
38
|
+
console.warn('Cannot observe the same root element repeatedly.');
|
|
39
|
+
return this;
|
|
40
|
+
}
|
|
41
|
+
if (this.root?.styleSheets) for (const sheet of this.root.styleSheets){
|
|
42
|
+
const { ownerNode } = sheet;
|
|
43
|
+
if (ownerNode && ownerNode.id === 'master') {
|
|
44
|
+
// @ts-ignore
|
|
45
|
+
this.style = ownerNode;
|
|
46
|
+
// @ts-ignore
|
|
47
|
+
this.progressive = true;
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (this.style?.sheet) {
|
|
52
|
+
let index = 0;
|
|
53
|
+
for(; index < this.style.sheet.cssRules.length; index++){
|
|
54
|
+
const eachCSSRule = this.style.sheet.cssRules[index];
|
|
55
|
+
switch(eachCSSRule.constructor.name){
|
|
56
|
+
case 'CSSKeyframesRule':
|
|
57
|
+
continue;
|
|
58
|
+
case 'CSSMeidaRule':
|
|
59
|
+
if (this.config.themeDriver === 'media') {
|
|
60
|
+
const result = /\(prefers-color-scheme: (.*?)\)/.exec(eachCSSRule.conditionText);
|
|
61
|
+
if (result) {
|
|
62
|
+
const firstCSSRule = eachCSSRule.cssRules[0];
|
|
63
|
+
if (firstCSSRule?.constructor.name === 'CSSStyleRule' && firstCSSRule.selectorText === ':root') {
|
|
64
|
+
this.pushVariableNativeRule(result[1], firstCSSRule);
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
break;
|
|
70
|
+
case 'CSSStyleRule':
|
|
71
|
+
// eslint-disable-next-line no-case-declarations
|
|
72
|
+
const selectorText = eachCSSRule.selectorText;
|
|
73
|
+
if (eachCSSRule.style.length) {
|
|
74
|
+
let isVariablesRule = true;
|
|
75
|
+
for(let i = 0; i < eachCSSRule.style.length; i++){
|
|
76
|
+
if (!eachCSSRule.style[i]?.startsWith('--')) {
|
|
77
|
+
isVariablesRule = false;
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (isVariablesRule) {
|
|
82
|
+
if (selectorText === ':root') {
|
|
83
|
+
this.pushVariableNativeRule('', eachCSSRule);
|
|
84
|
+
continue;
|
|
85
|
+
} else {
|
|
86
|
+
if (this.config.themeDriver === 'host') {
|
|
87
|
+
const result = /:host(.*?)/.exec(selectorText);
|
|
88
|
+
if (result) {
|
|
89
|
+
this.pushVariableNativeRule(result[1], eachCSSRule);
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
} else if (!selectorText.startsWith('.\\$')) {
|
|
93
|
+
this.pushVariableNativeRule(selectorText.slice(1), eachCSSRule);
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
for(; index < this.style.sheet.cssRules.length; index++){
|
|
104
|
+
const getRule = (cssRule)=>{
|
|
105
|
+
if (cssRule.selectorText) {
|
|
106
|
+
const selectorTexts = cssRule.selectorText.split(', ');
|
|
107
|
+
const escapedClassNames = selectorTexts[0].split(' ');
|
|
108
|
+
for(let i = 0; i < escapedClassNames.length; i++){
|
|
109
|
+
const eachSelectorText = escapedClassNames[i];
|
|
110
|
+
if (eachSelectorText[0] === '.') {
|
|
111
|
+
const escapedClassName = eachSelectorText.slice(1);
|
|
112
|
+
let className = '';
|
|
113
|
+
for(let j = 0; j < escapedClassName.length; j++){
|
|
114
|
+
const char = escapedClassName[j];
|
|
115
|
+
const nextChar = escapedClassName[j + 1];
|
|
116
|
+
if (char === '\\') {
|
|
117
|
+
j++;
|
|
118
|
+
if (nextChar !== '\\') {
|
|
119
|
+
className += nextChar;
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
} else if ([
|
|
123
|
+
',',
|
|
124
|
+
'.',
|
|
125
|
+
'#',
|
|
126
|
+
'[',
|
|
127
|
+
'!',
|
|
128
|
+
'*',
|
|
129
|
+
'>',
|
|
130
|
+
'+',
|
|
131
|
+
'~',
|
|
132
|
+
':',
|
|
133
|
+
'@'
|
|
134
|
+
].includes(char)) {
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
className += char;
|
|
138
|
+
}
|
|
139
|
+
if (!Object.prototype.hasOwnProperty.call(this.ruleBy, className) && !Object.prototype.hasOwnProperty.call(this.styles, className)) {
|
|
140
|
+
const currentRule = this.generate(className)[0];
|
|
141
|
+
if (currentRule) return currentRule;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
} else if (cssRule.cssRules) {
|
|
146
|
+
for(let index = 0; index < cssRule.cssRules.length; index++){
|
|
147
|
+
const currentRule = getRule(cssRule.cssRules[index]);
|
|
148
|
+
if (currentRule) return currentRule;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
const rule = getRule(this.style.sheet.cssRules[index]);
|
|
153
|
+
if (rule) {
|
|
154
|
+
this.rules.push(rule);
|
|
155
|
+
this.ruleBy[rule.className] = rule;
|
|
156
|
+
for(let i = 0; i < rule.natives.length; i++){
|
|
157
|
+
rule.natives[i].cssRule = this.style.sheet.cssRules[index + i];
|
|
158
|
+
}
|
|
159
|
+
index += rule.natives.length - 1;
|
|
160
|
+
// variables
|
|
161
|
+
this.handleRuleWithVariableNames(rule, true);
|
|
162
|
+
// animations
|
|
163
|
+
this.handleRuleWithAnimationNames(rule, true);
|
|
164
|
+
rule.definition.insert?.call(rule);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
} else {
|
|
168
|
+
// @ts-ignore
|
|
169
|
+
this.style = document.createElement('style');
|
|
170
|
+
this.style.id = 'master';
|
|
171
|
+
this.container.append(this.style);
|
|
172
|
+
}
|
|
173
|
+
const handleClassList = (classList)=>{
|
|
174
|
+
classList.forEach((className)=>{
|
|
175
|
+
if (Object.prototype.hasOwnProperty.call(this.classesUsage, className)) {
|
|
176
|
+
this.classesUsage[className]++;
|
|
177
|
+
} else {
|
|
178
|
+
this.classesUsage[className] = 1;
|
|
179
|
+
this.add(className);
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
};
|
|
183
|
+
handleClassList(this.host.classList);
|
|
184
|
+
if (options.subtree) {
|
|
185
|
+
/**
|
|
186
|
+
* 待所有 DOM 結構完成解析後,開始繪製 Rule 樣式
|
|
187
|
+
*/ (this.root === document ? this.host : this.container).querySelectorAll('[class]').forEach((element)=>handleClassList(element.classList));
|
|
188
|
+
}
|
|
189
|
+
this.observer = new MutationObserver((mutationRecords)=>{
|
|
190
|
+
// console.time('css engine');
|
|
191
|
+
const correctionOfClassName = {};
|
|
192
|
+
const attributeMutationRecords = [];
|
|
193
|
+
const updatedElements = [];
|
|
194
|
+
const unchangedElements = [];
|
|
195
|
+
/**
|
|
196
|
+
* 取得所有深層後代的 class names
|
|
197
|
+
*/ const handleClassNameDeeply = (element, remove)=>{
|
|
198
|
+
if (remove) {
|
|
199
|
+
element.classList.forEach(removeClassName);
|
|
200
|
+
} else {
|
|
201
|
+
element.classList.forEach(addClassName);
|
|
202
|
+
}
|
|
203
|
+
const children = element.children;
|
|
204
|
+
for(let i = 0; i < children.length; i++){
|
|
205
|
+
const eachChildren = children[i];
|
|
206
|
+
if (eachChildren.classList) {
|
|
207
|
+
updatedElements.push(eachChildren);
|
|
208
|
+
handleClassNameDeeply(eachChildren, remove);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
const addClassName = (className)=>{
|
|
213
|
+
if (Object.prototype.hasOwnProperty.call(correctionOfClassName, className)) {
|
|
214
|
+
correctionOfClassName[className]++;
|
|
215
|
+
} else {
|
|
216
|
+
correctionOfClassName[className] = 1;
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
const removeClassName = (className)=>{
|
|
220
|
+
if (Object.prototype.hasOwnProperty.call(correctionOfClassName, className)) {
|
|
221
|
+
correctionOfClassName[className]--;
|
|
222
|
+
} else if (Object.prototype.hasOwnProperty.call(this.classesUsage, className)) {
|
|
223
|
+
correctionOfClassName[className] = -1;
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
const handleNodes = (nodes, remove)=>{
|
|
227
|
+
for(let i = 0; i < nodes.length; i++){
|
|
228
|
+
const eachNode = nodes[i];
|
|
229
|
+
if (eachNode.classList && !updatedElements.includes(eachNode) && !unchangedElements.includes(eachNode)) {
|
|
230
|
+
if (eachNode.isConnected !== remove) {
|
|
231
|
+
updatedElements.push(eachNode);
|
|
232
|
+
handleClassNameDeeply(eachNode, remove);
|
|
233
|
+
} else {
|
|
234
|
+
unchangedElements.push(eachNode);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
for(let i = 0; i < mutationRecords.length; i++){
|
|
240
|
+
const mutationRecord = mutationRecords[i];
|
|
241
|
+
const { addedNodes, removedNodes, type, target } = mutationRecord;
|
|
242
|
+
if (type === 'attributes') {
|
|
243
|
+
/**
|
|
244
|
+
* 防止同樣的 MutationRecord 重複執行
|
|
245
|
+
* According to this history,
|
|
246
|
+
* MutationObserver was designed to work that way.
|
|
247
|
+
* Any call to setAttribute triggers a mutation,
|
|
248
|
+
* regardless of whether the value is being changed or set to the current value
|
|
249
|
+
*/ if (attributeMutationRecords.find((eachAttributeMutationRecord)=>eachAttributeMutationRecord.target === target)) {
|
|
250
|
+
continue;
|
|
251
|
+
} else {
|
|
252
|
+
/**
|
|
253
|
+
* 第一個匹配到的 oldValue 一定是該批變動前的原始狀態值
|
|
254
|
+
*/ attributeMutationRecords.push(mutationRecord);
|
|
255
|
+
}
|
|
256
|
+
} else {
|
|
257
|
+
// 先判斷節點新增或移除
|
|
258
|
+
handleNodes(addedNodes, false);
|
|
259
|
+
// 忽略處理新元素的已刪除子節點
|
|
260
|
+
if (!target.isConnected || !updatedElements.includes(target)) {
|
|
261
|
+
handleNodes(removedNodes, true);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
if (!attributeMutationRecords.length && !Object.keys(correctionOfClassName).length) {
|
|
266
|
+
// console.timeEnd('css engine');
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
for (const { oldValue, target } of attributeMutationRecords){
|
|
270
|
+
/**
|
|
271
|
+
* 如果被操作的元素中包含了屬性變更的目標,
|
|
272
|
+
* 則將該目標從 existedAttributeMutationTargets 中移除,
|
|
273
|
+
* 以防止執行接下來的屬性變更處理
|
|
274
|
+
*
|
|
275
|
+
* 該批 mutationRecords 中,某個 target 同時有 attribute 及 childList 的變更,
|
|
276
|
+
* 則以 childList 節點插入及移除的 target.className 為主
|
|
277
|
+
*/ const updated = updatedElements.includes(target);
|
|
278
|
+
const classNames = target.classList;
|
|
279
|
+
const oldClassNames = oldValue ? oldValue.split(' ') : [];
|
|
280
|
+
if (updated) {
|
|
281
|
+
if (target.isConnected) {
|
|
282
|
+
continue;
|
|
283
|
+
} else {
|
|
284
|
+
for (const oldClassName of oldClassNames){
|
|
285
|
+
if (!classNames.contains(oldClassName)) {
|
|
286
|
+
removeClassName(oldClassName);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
} else if (target.isConnected) {
|
|
291
|
+
classNames.forEach((className)=>{
|
|
292
|
+
if (!oldClassNames.includes(className)) {
|
|
293
|
+
addClassName(className);
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
for (const oldClassName of oldClassNames){
|
|
297
|
+
if (!classNames.contains(oldClassName)) {
|
|
298
|
+
removeClassName(oldClassName);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
for(const className in correctionOfClassName){
|
|
304
|
+
const correction = correctionOfClassName[className];
|
|
305
|
+
const count = (this.classesUsage[className] || 0) + correction;
|
|
306
|
+
if (count === 0) {
|
|
307
|
+
// remove
|
|
308
|
+
delete this.classesUsage[className];
|
|
309
|
+
/**
|
|
310
|
+
* class name 從 DOM tree 中被移除,
|
|
311
|
+
* 匹配並刪除對應的 rule
|
|
312
|
+
*/ this.delete(className);
|
|
313
|
+
} else {
|
|
314
|
+
if (!Object.prototype.hasOwnProperty.call(this.classesUsage, className)) {
|
|
315
|
+
// add
|
|
316
|
+
/**
|
|
317
|
+
* 新 class name 被 connected 至 DOM tree,
|
|
318
|
+
* 匹配並創建對應的 Rule
|
|
319
|
+
*/ this.add(className);
|
|
320
|
+
}
|
|
321
|
+
this.classesUsage[className] = count;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
this.observer.observe(this.root, {
|
|
326
|
+
...options,
|
|
327
|
+
attributes: true,
|
|
328
|
+
attributeOldValue: true,
|
|
329
|
+
attributeFilter: [
|
|
330
|
+
'class'
|
|
331
|
+
]
|
|
332
|
+
});
|
|
333
|
+
this.host.style.removeProperty('display');
|
|
334
|
+
// @ts-ignore
|
|
335
|
+
this.observing = true;
|
|
336
|
+
return this;
|
|
337
|
+
}
|
|
338
|
+
refresh(customConfig = this.customConfig) {
|
|
339
|
+
const newStyle = document.createElement('style');
|
|
340
|
+
newStyle.id = 'master';
|
|
341
|
+
this.style.replaceWith(newStyle);
|
|
342
|
+
// @ts-ignore
|
|
343
|
+
this.style = newStyle;
|
|
344
|
+
super.refresh(customConfig);
|
|
345
|
+
return this;
|
|
346
|
+
}
|
|
347
|
+
reset() {
|
|
348
|
+
super.reset();
|
|
349
|
+
const sheet = this.style?.sheet;
|
|
350
|
+
if (sheet?.cssRules) {
|
|
351
|
+
for(let i = sheet.cssRules.length - 1; i >= 0; i--){
|
|
352
|
+
sheet.deleteRule(i);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
if (!this.progressive) {
|
|
356
|
+
this.style?.remove();
|
|
357
|
+
// @ts-ignore
|
|
358
|
+
this.style = null;
|
|
359
|
+
}
|
|
360
|
+
return this;
|
|
361
|
+
}
|
|
362
|
+
disconnect() {
|
|
363
|
+
if (this.observer) {
|
|
364
|
+
this.observer.disconnect();
|
|
365
|
+
this.observer = null;
|
|
366
|
+
}
|
|
367
|
+
// @ts-ignore
|
|
368
|
+
this.observing = false;
|
|
369
|
+
this.reset();
|
|
370
|
+
return this;
|
|
371
|
+
}
|
|
372
|
+
destroy() {
|
|
373
|
+
this.disconnect();
|
|
374
|
+
runtimeCSSs.splice(runtimeCSSs.indexOf(this), 1);
|
|
375
|
+
return this;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
const runtimeCSSs = [];
|
|
379
|
+
(()=>{
|
|
380
|
+
globalThis.RuntimeCSS = RuntimeCSS;
|
|
381
|
+
globalThis.runtimeCSSs = runtimeCSSs;
|
|
382
|
+
})();
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* Initialize a new RuntimeCSS instance and observe the target root
|
|
386
|
+
* @param config master css config
|
|
387
|
+
* @param targetRoot target root to observe
|
|
388
|
+
* @returns master css instance
|
|
389
|
+
*/ function initCSSRuntime(config) {
|
|
390
|
+
return new RuntimeCSS(document, config).observe();
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
export { RuntimeCSS, RuntimeCSS as default, initCSSRuntime };
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@master/css-runtime","
|
|
1
|
+
{"name":"@master/css-runtime","type":"module","scripts":{"build":"techor build","dev":"pnpm build --watch","e2e":"playwright test","type-check":"tsc --noEmit","lint":"eslint src"},"license":"MIT","description":"Run Master CSS right in the browser","author":"Aoyue Design LLC.","funding":"https://css.master.co/docs/donate","homepage":"https://css.master.co","bugs":{"url":"https://github.com/master-co/css/issues"},"repository":{"type":"git","url":"https://github.com/master-co/css.git","directory":"packages/runtime"},"keywords":["utility","css","lightweight","mastercss","master","runtime","cdn"],"sideEffects":false,"main":"./dist/index.cjs","jsnext:main":"./dist/index.mjs","esnext":"./dist/index.mjs","module":"./dist/index.mjs","browser":"./dist/global.min.js","types":"./dist/index.d.ts","exports":{".":{"require":"./dist/index.cjs","import":"./dist/index.mjs","types":"./dist/index.d.ts"}},"files":["dist"],"publishConfig":{"access":"public"},"dependencies":{"@master/css":"^2.0.0-rc.16"},"devDependencies":{"@playwright/test":"^1.41.2","@types/node":"^20.11.20"},"version":"2.0.0-rc.16"}
|
package/dist/iife.bundle.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(()=>{var Q={"(":")","'":"'",'"':'"',"{":"}"};function se(e){if(typeof CSS<"u")return CSS.escape(e);if(arguments.length==0)throw new TypeError("`CSS.escape` requires an argument.");let a=String(e),i=a.length,n=-1,c="",r,o=a.charCodeAt(0);if(i==1&&o==45)return"\\"+a;for(;++n<i;){if(r=a.charCodeAt(n),r==0){c+="\uFFFD";continue}if(r>=1&&r<=31||r==127||n==0&&r>=48&&r<=57||n==1&&r>=48&&r<=57&&o==45){c+="\\"+r.toString(16)+" ";continue}if(r>=128||r==45||r==95||r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122){c+=a.charAt(n);continue}c+="\\"+a.charAt(n)}return c}var me=(e=>(e[e.Semantic=-8]="Semantic",e[e.CoreNativeShorthand=-7]="CoreNativeShorthand",e[e.NativeShorthand=-6]="NativeShorthand",e[e.CoreShorthand=-5]="CoreShorthand",e[e.Shorthand=-4]="Shorthand",e[e.CoreNative=-3]="CoreNative",e[e.Native=-2]="Native",e[e.Core=-1]="Core",e[e.Normal=0]="Normal",e))(me||{}),oe=/^([+-]?(?:\d+(?:\.?\d+)?|\.\d+))x$/m,pe=/^(media|supports|page|font-face|keyframes|counter-style|font-feature-values|property|layer)(?=\||{|\(|$)/,ye=class{constructor(e,a,i){this.className=e,this.css=i,Object.assign(this,a);let{id:n,definition:c}=a,{analyze:r,transformValue:o,declare:u,transformValueComponents:y,create:f,layer:d,unit:g,colored:m}=c;this.layer=d,this.colored=!!m,c.unit||(c.unit=""),c.separators||(c.separators=[","]);let{scope:l,important:h,themeDriver:s}=i.config,{selectors:t,mediaQueries:p,stylesBy:v,animations:w}=i,R=v[e];f&&f.call(this,e),this.declarations=c.declarations;let b,S;if(d===-8)b=e.slice(n.length-1);else{let N;if(r)[N,S]=r.call(this,e);else{let C=e.indexOf(":");this.prefix=e.slice(0,C+1),N=e.slice(C+1)}this.valueComponents=[],b=N.slice(this.parseValue(this.valueComponents,0,N,g,"",void 0,!1,n==="animation"||n==="animation-name"?Object.keys(this.css.animations):[]))}b[0]==="!"&&(this.important=!0,b=b.slice(1)),this.stateToken=b;let k=(N,C)=>{let z=(x,V,O,P)=>{for(let[T,B]of V)if(T.test(x)){for(let M of B)z(x.replace(T,M),V,O,!0);return}P&&O.push(x)},A=x=>{let V=x.split(/(\\'(?:.*?)[^\\]\\')(?=[*_>~+,)])|(\[[^=]+='(?:.*?)[^\\]'\])/).map((B,M)=>M%3?B:B.replace(/(^|[^_])_(?!_)/g,"$1 ")).join(""),O=[],P="",T=0;for(let B=0;B<V.length;B++){let M=V[B];if(M==="\\"){P+=M+V[++B];continue}!T&&M===","?(O.push(P),P=""):(P+=M,T&&M===")"?T--:M==="("&&T++)}return P&&O.push(P),O},W=[];""in t?z(N,t[""],W,!0):W.push(N);let E={};for(let[x,V]of Object.entries(t)){if(!x)continue;let O=[];for(let P of W)z(P,V,O,!1);O.length&&(E[x]=O)}let D=(x,V)=>{let O=V.reduce((P,T)=>(P.push(...A(T)),P),[]);x in C?C[x].push(...O):C[x]=O},U=Object.keys(E);if(U.length)for(let x of U)D(x,E[x]);else D("",W)};S?(this.vendorPrefixSelectors={},k(S,this.vendorPrefixSelectors)):this.vendorPrefixSelectors={"":[""]};let $=b.split("@"),j=$[0];if(j){this.vendorSuffixSelectors={},k(j,this.vendorSuffixSelectors);for(let N of Object.values(this.vendorSuffixSelectors))for(let C of N){this.hasWhere!==!1&&(this.hasWhere=C.includes(":where("));let z=[":disabled",":active",":focus",":hover"];for(let A=0;A<z.length;A++)if(C.includes(z[A])){(this.priority===-1||this.priority>A)&&(this.priority=A);break}}}else this.vendorSuffixSelectors={"":[""]};let q={},ue=Object.prototype.hasOwnProperty.call(this.vendorPrefixSelectors,""),ie=Object.prototype.hasOwnProperty.call(this.vendorSuffixSelectors,"");if(ue)q[""]=ie?[""]:Object.keys(this.vendorSuffixSelectors);else if(ie)for(let N in this.vendorPrefixSelectors)q[N]=[""];else for(let N in this.vendorPrefixSelectors){let C=q[N]=[];if(Object.prototype.hasOwnProperty.call(this.vendorSuffixSelectors,N))C.push(N);else for(let z in this.vendorSuffixSelectors)C.push(z)}for(let N=1;N<$.length;N++){let C=$[N];if(C)if(C==="rtl"||C==="ltr")this.direction=C;else{let z="",A,W=pe.exec(C);if(W)z=W[1],A=C.slice(z.length);else{this.media={token:C,features:{}};let E=[],D=x=>{if(x==="all"||x==="print"||x==="screen"||x==="speech")this.media.type=x;else if(x==="\u{1F5A8}")this.media.type="print";else if(x==="landscape"||x==="portrait")E.push("(orientation:"+x+")");else if(x==="motion"||x==="reduced-motion")E.push("(prefers-reduced-motion:"+(x==="motion"?"no-preference":"reduce")+")");else{let V=p[x];if(V&&typeof V=="string")E.push(V);else{let O="",P="",T=0;x.startsWith("<=")?(P="<=",O="max-width"):x.startsWith(">=")||V?(P=">=",O="min-width"):x.startsWith(">")?(P=">",O="min-width",T=.02):x.startsWith("<")&&(P="<",O="max-width",T=-.02);let B=P?x.replace(P,""):x,M=p[B];switch(O){case"max-width":case"min-width":let L={};typeof M=="number"?L={type:"number",value:M+T,unit:"px"}:(L=this.parseValueComponent(B,"px"),L.type==="number"&&L.unit==="px"&&(L.value+=T)),this.media.features[O]=L,L.type==="number"?E.push("("+O+":"+(L.value+L.unit)+")"):E.push("("+O+":"+L.value+")");break}}}},U=C.includes("&");if(U){let x=C.split("&");for(let V of x)D(V)}else D(C);if(this.media.type&&(A=this.media.type),E.length&&(A=E.join(" and ")),A)z="media";else if(!U){this.theme=C;continue}}A&&(this.at[z]=(z in this.at?this.at[z]+" and ":"")+A.replace(/\|/g," "))}}let Y;this.valueComponents&&(y&&(this.valueComponents=y.call(this,this.valueComponents)),Y=this.resolveValue(this.valueComponents,g,[],!1),o&&(Y=o.call(this,Y)),u?this.declarations=u.call(this,Y,this.valueComponents):n&&(this.declarations={[n]:Y}));let ee=[];for(let N in this.declarations){let C=W=>{if(w&&(W.startsWith("animation")||W.startsWith("animation-name"))){let E=W.split(":")[1].split("!important")[0].split(" ").filter(D=>D in this.css.animations&&(!this.animationNames||!this.animationNames.includes(D)));E.length&&(this.animationNames||(this.animationNames=[]),this.animationNames=E)}ee.push(W+((this.important||h)&&!W.endsWith("!important")?"!important":""))},z=N+":",A=this.declarations[N];if(Array.isArray(A))for(let W of A)C(z+String(W));else C(z+String(A))}if(ee.length)for(let N in q)for(let C of q[N]){let z="";this.direction&&(z+="[dir="+this.direction+"] ");let A=this.vendorPrefixSelectors[N],W=this.vendorSuffixSelectors[C],E=A.map(x=>x+z),D=x=>E.map(V=>(this.theme&&s!=="media"?s==="host"?`:host(.${this.theme}) `:`.${this.theme} `:"")+(l?l+" ":"")+V).reduce((V,O)=>(V.push(W.reduce((P,T)=>(P.push(O+"."+se(x)+T),P),[]).join(",")),V),[]).join(","),U=D(e)+(R?R.reduce((x,V)=>x+","+D(V),""):"")+"{"+ee.join(";")+"}";for(let x of Object.keys(this.at).sort((V,O)=>O==="supports"?-1:1))U="@"+x+(x.includes(" ")?"":" ")+this.at[x]+"{"+U+"}";this.theme&&s==="media"&&(U=`@media(prefers-color-scheme:${this.theme}){`+U+"}"),this.natives.push({text:U})}}at={};priority=-1;natives=[];order=0;layer=0;stateToken;declarations;animationNames;variableNames;resolveValue=(e,a,i,n)=>{let{functions:c}=this.css.config,r="";for(let o of e)switch(o.type){case"function":let u=c&&c[o.name];if(u?.transform&&!o.bypassTransform){let f=u.transform.call(this,this.resolveValue(o.children,u.unit??a,i,n||o.name==="calc"),i);r+=o.text=typeof f=="string"?f:this.resolveValue(f,u?.unit??a,i,n)}else r+=o.text=o.name+o.symbol+this.resolveValue(o.children,u?.unit??a,i,n)+Q[o.symbol];break;case"variable":let y=this.css.variables[o.name];if(y){let f=(d,g)=>{if(y.themes)if(this.theme){let m=y.themes[this.theme]??y;m?.value&&d(m)}else this.variableNames||(this.variableNames=[]),this.variableNames.includes(o.name)||this.variableNames.push(o.name),g();else d(y)};switch(y.type){case"string":f(g=>{let m=[];this.parseValue(m,0,g.value,a,"",void 0,n,[...i,o.name]),r+=o.text=this.resolveValue(m,a,[...i,o.name],n)},()=>{r+=o.text=`var(--${o.name})`});break;case"number":f(g=>{if(n)r+=o.text=g.value;else{let m=this.parseValueComponent(g.value,a);r+=o.text=m.value+(m.unit??"")}},()=>{r+=o.text=a?`calc(var(--${o.name}) / 16 * 1rem)`:`var(--${o.name})`});break;case"color":let d=o.alpha?"/"+o.alpha:"";f(g=>{r+=o.text=`${g.space}(${g.value}${d})`},()=>{r+=o.text=`${y.space}(var(--${o.name})${d})`});break}}else r+=o.text=`var(--${o.name}${o.fallback?","+o.fallback:""})`;break;case"separator":r+=o.text?o.text:o.text=o.value;break;case"number":r+=o.text=o.value+(o.unit||"");break;default:r+=o.text=o.value;break}return r};get text(){return this.natives.map(e=>e.text).join("")}parseValue=(e,a,i,n,c,r,o=!1,u=[])=>{let y=r===void 0,f=!y&&(r.endsWith("$")||r.endsWith("var")),d=(h=>h==="'"||h==='"')(c),g=[","];this.definition.separators?.length&&g.push(...this.definition.separators);let m="",l=()=>{if(m){let h=!1;if(!f||e.length){let s=(t,p)=>{let v=Object.prototype.hasOwnProperty.call(this.variables,t)?this.variables[t]:Object.prototype.hasOwnProperty.call(this.css.variables,t)?this.css.variables[t]:void 0;if(v){let w=v.name??t;if(!u.includes(w)){h=!0;let R={type:"variable",name:w,variable:this.css.variables[w]};p&&(R.alpha=p),e.push(R)}}};if(s(m),!h&&this.colored){let[t,p]=m.split("/");s(t,p)}}if(!h){if(!f){let s=oe.exec(m);s&&(m=String(+s[1]*(this.css.config.baseUnit??1)))}o?e.push({type:"string",value:m}):e.push(this.parseValueComponent(m,n))}m=""}};for(;a<i.length;a++){let h=i[a];if(h===c){if(d){let s=0;for(let t=m.length-1;m[t]==="\\";t--)s++;if(s%2){m+=h;continue}else l()}else l();return a}else if(!d&&h in Q){let s=m,t={type:"function",name:s,symbol:h,children:[]};e.push(t),m="";let p=h==="("?this.css.config.functions?.[s]:void 0;!this.colored&&p?.colored&&(this.colored=!0),a=this.parseValue(t.children,++a,i,p?.unit??n,Q[h],s||r||"",o||s==="calc")}else if((h==="|"||h===" ")&&c!=="}"&&(!d||r==="path"))l(),e.push({type:"separator",value:" "});else{if(!d){if(h===".")if(isNaN(+i[a+1])){if(y)break}else i[a-1]==="-"&&(m+="0");else if(g.includes(h)){l(),e.push({type:"separator",value:h,text:(h===","?"":" ")+h+(h===","?"":" ")});continue}else if(y&&(h==="#"&&(m||e.length&&e[e.length-1].type!=="separator")||["!","*",">","+","~",":","[","@","_"].includes(h)))break}m+=h}}return l(),a};parseValueComponent(e,a=this.definition.unit){let i=a??this.definition.unit,n="",c;if(typeof e=="number")return i&&!n?((i==="rem"||i==="em")&&(c=e/(this.css.config.rootSize||1)),n=i||""):c=e,{value:c,unit:n,type:"number"};if(i){if(/^\d+\/\d+/.test(e)){let[o,u]=e.split("/");return{value:+o/+u*100,unit:"%",type:"number"}}let r=e.match(/^([+-.]?\d+(\.?\d+)?)(%|cm|mm|q|in|pt|pc|px|em|rem|ex|rex|cap|rcap|ch|rch|ic|ric|lh|rlh|vw|svw|lvw|dvw|vh|svh|lvh|dvh|vi|svi|lvi|dvi|vb|svb|lvb|dvb|vmin|svmin|lvmin|dvmin|vmax|svmax|lvmax|dvmax|cqw|cqh|cqi|cqb|cqmin|cqmax|deg|grad|rad|turn|s|ms|hz|khz|dpi|dpcm|dppx|x|fr|db|st)?$/);if(r)return c=+r[1],n=r[3]||"",n||((i==="rem"||i==="em")&&(c=c/(this.css.config.rootSize||1)),n=i||""),{value:c,unit:n,type:"number"}}return{value:e,type:"string"}}},ne={"4xs":360,"3xs":480,"2xs":600,xs:768,sm:834,md:1024,lg:1280,xl:1440,"2xl":1600,"3xl":1920,"4xl":2560},be={"::scrollbar":"::-webkit-scrollbar","::scrollbar-button":"::-webkit-scrollbar-button","::scrollbar-thumb":"::-webkit-scrollbar-thumb","::scrollbar-track":"::-webkit-scrollbar-track","::scrollbar-track-piece":"::-webkit-scrollbar-track-piece","::scrollbar-corner":"::-webkit-scrollbar-corner","::slider-thumb":["::-webkit-slider-thumb","::-moz-range-thumb"],"::slider-runnable-track":["::-webkit-slider-runnable-track","::-moz-range-track"],"::meter":"::-webkit-meter","::resizer":"::-webkit-resizer","::progress":"::-webkit-progress",":first":":first-child",":last":":last-child",":even":":nth-child(2n)",":odd":":nth-child(odd)",":nth(":":nth-child(",":only":":only-child"},ge=be,ve={square:{"aspect-ratio":"1/1"},video:{"aspect-ratio":"16/9"},rounded:{"border-radius":"1e9em"},round:{"border-radius":"50%"},hidden:{display:"none"},hide:{display:"none"},block:{display:"block"},table:{display:"table"},flex:{display:"flex"},grid:{display:"grid"},contents:{display:"contents"},inline:{display:"inline"},"inline-block":{display:"inline-block"},"inline-flex":{display:"inline-flex"},"inline-grid":{display:"inline-grid"},"inline-table":{display:"inline-table"},"table-cell":{display:"table-cell"},"table-caption":{display:"table-caption"},"flow-root":{display:"flow-root"},"list-item":{display:"list-item"},"table-row":{display:"table-row"},"table-column":{display:"table-column"},"table-row-group":{display:"table-row-group"},"table-column-group":{display:"table-column-group"},"table-header-group":{display:"table-header-group"},"table-footer-group":{display:"table-footer-group"},italic:{"font-style":"italic"},oblique:{"font-style":"oblique"},isolate:{isolation:"isolate"},overflowed:{overflow:"visible"},untouchable:{"pointer-events":"none"},static:{position:"static"},fixed:{position:"fixed"},abs:{position:"absolute"},rel:{position:"relative"},sticky:{position:"sticky"},uppercase:{"text-transform":"uppercase"},lowercase:{"text-transform":"lowercase"},capitalize:{"text-transform":"capitalize"},visible:{visibility:"visible"},invisible:{visibility:"hidden"},vw:{width:"100vw"},vh:{height:"100vh"},"max-vw":{"max-width":"100vw"},"max-vh":{"max-height":"100vh"},"min-vw":{"min-width":"100vw"},"min-vh":{"min-height":"100vh"},"center-content":{"justify-content":"center","align-items":"center"},"sr-only":{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0,0,0,0)","white-space":"nowrap","border-width":"0"},full:{width:"100%",height:"100%"},center:{left:0,right:0,"margin-left":"auto","margin-right":"auto"},middle:{top:0,bottom:0,"margin-top":"auto","margin-bottom":"auto"},"break-spaces":{"white-space":"break-spaces"},"break-word":{"overflow-wrap":"break-word",overflow:"hidden"},"gradient-text":{"-webkit-text-fill-color":"transparent","-webkit-background-clip":"text","background-clip":"text"},fit:{width:"fit-content",height:"fit-content"}},xe=ve,we={fade:{"0%":{opacity:0},to:{opacity:1}},flash:{"0%,50%,to":{opacity:1},"25%,75%":{opacity:0}},float:{"0%":{transform:"none"},"50%":{transform:"translateY(-1.25rem)"},to:{transform:"none"}},heart:{"0%":{transform:"scale(1)"},"14%":{transform:"scale(1.3)"},"28%":{transform:"scale(1)"},"42%":{transform:"scale(1.3)"},"70%":{transform:"scale(1)"}},jump:{"0%,to":{transform:"translateY(-25%)","animation-timing-function":"cubic-bezier(.8,0,1,1)"},"50%":{transform:"translateY(0)","animation-timing-function":"cubic-bezier(0,0,.2,1)"}},ping:{"75%,to":{transform:"scale(2)",opacity:0}},pulse:{"0%":{transform:"none"},"50%":{transform:"scale(1.05)"},to:{transform:"none"}},rotate:{"0%":{transform:"rotate(-360deg)"},to:{transform:"none"}},shake:{"0%":{transform:"none"},"6.5%":{transform:"translateX(-6px) rotateY(-9deg)"},"18.5%":{transform:"translateX(5px) rotateY(7deg)"},"31.5%":{transform:"translateX(-3px) rotateY(-5deg)"},"43.5%":{transform:"translateX(2px) rotateY(3deg)"},"50%":{transform:"none"}},zoom:{"0%":{transform:"scale(0)"},to:{transform:"none"}}},ke=we,Se={full:"100%",fit:"fit-content",max:"max-content",min:"min-content","font-family":{mono:["ui-monospace","SFMono-Regular","Menlo","Monaco","Consolas","Liberation Mono","Courier New","monospace"],sans:["ui-sans-serif","system-ui","-apple-system","BlinkMacSystemFont","Segoe UI","Roboto","Helvetica Neue","Arial","Noto Sans","sans-serif","Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"],serif:["ui-serif","Georgia","Cambria","Times New Roman","Times","serif"]},screen:ne,"font-weight":{thin:100,extralight:200,light:300,regular:400,medium:500,semibold:600,bold:700,extrabold:800,heavy:900},"flex-direction":{col:"column","col-reverse":"column-reverse"},"box-sizing":{content:"content-box",border:"border-box"},position:{abs:"absolute",rel:"relative"},"transform-box":{content:"content-box",border:"border-box",padding:"padding-box",fill:"fill-box",stroke:"stroke-box",view:"view-box"},"animation-direction":{alt:"alternate","alt-reverse":"alternate-reverse"},"background-clip":{content:"content-box",border:"border-box",padding:"padding-box"},"background-origin":{content:"content-box",border:"border-box",padding:"padding-box"},order:{first:-999999,last:999999},"shape-outside":{content:"content-box",border:"border-box",padding:"padding-box",margin:"margin-box"},"clip-path":{content:"content-box",border:"border-box",padding:"padding-box",margin:"margin-box",fill:"fill-box",stroke:"stroke-box",view:"view-box",black:"#000000"},current:"currentColor",text:{invert:{"@light":"#ffffff","@dark":"#000000"},strong:{"@light":"$(slate-95)","@dark":"$(gray-10)"},neutral:{"@light":"$(slate-70)","@dark":"$(gray-30)"},lightest:{"@light":"$(slate-30)","@dark":"$(gray-60)"},lighter:{"@light":"$(slate-40)","@dark":"$(gray-50)"},light:{"@light":"$(slate-50)","@dark":"$(gray-40)"},gray:{"@light":"$(gray-60)","@dark":"$(gray-30)"},slate:{"@light":"$(slate-60)","@dark":"$(slate-30)"},brown:{"@light":"$(brown-60)","@dark":"$(brown-30)"},orange:{"@light":"$(orange-60)","@dark":"$(orange-30)"},amber:{"@light":"$(amber-60)","@dark":"$(amber-40)"},yellow:{"@light":"$(yellow-60)","@dark":"$(yellow-40)"},lime:{"@light":"$(lime-70)","@dark":"$(lime-40)"},green:{"@light":"$(green-70)","@dark":"$(green-40)"},beryl:{"@light":"$(beryl-70)","@dark":"$(beryl-40)"},teal:{"@light":"$(teal-70)","@dark":"$(teal-40)"},cyan:{"@light":"$(cyan-70)","@dark":"$(cyan-40)"},sky:{"@light":"$(sky-70)","@dark":"$(sky-30)"},blue:{"@light":"$(blue-60)","@dark":"$(blue-30)"},indigo:{"@light":"$(indigo-60)","@dark":"$(indigo-30)"},violet:{"@light":"$(violet-60)","@dark":"$(violet-30)"},purple:{"@light":"$(purple-60)","@dark":"$(purple-30)"},fuchsia:{"@light":"$(fuchsia-60)","@dark":"$(fuchsia-30)"},pink:{"@light":"$(pink-60)","@dark":"$(pink-30)"},crimson:{"@light":"$(crimson-60)","@dark":"$(crimson-30)"},red:{"@light":"$(red-60)","@dark":"$(red-30)"}},base:{"@light":"$(white)","@dark":"$(gray-95)"},canvas:{"@light":"$(slate-5)","@dark":"$(gray-90)"},surface:{"@light":"$(white)","@dark":"$(gray-80)"},invert:{"@light":"#000000","@dark":"#ffffff"},white:"#ffffff",black:"#000000",frame:{"@light":"$(slate-60)","@dark":"$(gray-30)"},gray:{5:"#f6f5f7",10:"#efeef0",20:"#cdccce",30:"#a2a1a3",40:"#89888a",50:"#737274",60:"#585759",70:"#444345",80:"#323133",90:"#29282a",95:"#222123","":{"@light":"$(gray-30)","@dark":"$(gray-40)"}},slate:{5:"#f8f9fb",10:"#eff2f9",20:"#c8d0e3",30:"#9fabc6",40:"#7c8cab",50:"#5f7395",60:"#455572",70:"#37455d",80:"#283348",90:"#1d273a",95:"#182030","":{"@light":"$(slate-30)","@dark":"$(slate-40)"}},brown:{5:"#fff6f0",10:"#feefe3",20:"#f3bea4",30:"#e7976e",40:"#da7c4d",50:"#cc6633",60:"#b65325",70:"#9d4119",80:"#833111",90:"#692007",95:"#431304","":{"@light":"$(brown-40)","@dark":"$(brown-50)"}},orange:{5:"#fff5ea",10:"#fff5df",20:"#ffcb9e",30:"#ff9b47",40:"#ff8528",50:"#ff6c0a",60:"#e05200",70:"#bc3e00",80:"#992d00",90:"#701d00",95:"#471100","":{"@light":"$(orange-40)","@dark":"$(orange-50)"}},amber:{5:"#fff9eb",10:"#fff4db",20:"#ffe099",30:"#ffc133",40:"#ffb10a",50:"#f99e00",60:"#e57e00",70:"#c15d00",80:"#a34900",90:"#753200",95:"#4c1f00","":{"@light":"$(amber-40)","@dark":"$(amber-50)"}},yellow:{5:"#fffae5",10:"#fffed1",20:"#ffe993",30:"#ffd233",40:"#ffc300",50:"#efaf00",60:"#d69200",70:"#b77400",80:"#9e5c00",90:"#753c00",95:"#4c2600","":{"@light":"$(yellow-40)","@dark":"$(yellow-50)"}},lime:{5:"#f5ffe5",10:"#f5ffd6",20:"#d1fb8d",30:"#acec46",40:"#91d91a",50:"#77c012",60:"#61a60c",70:"#4c8d07",80:"#367604",90:"#256000",95:"#1b3d00","":{"@light":"$(lime-40)","@dark":"$(lime-50)"}},green:{5:"#e7fdea",10:"#dbfee4",20:"#a5f7b8",30:"#35ed66",40:"#00d655",50:"#00c147",60:"#00ad3f",70:"#008e34",80:"#007a2c",90:"#006023",95:"#003d16","":{"@light":"$(green-40)","@dark":"$(green-50)"}},beryl:{5:"#e0fef2",10:"#d2fff7",20:"#6cffd4",30:"#0fefa4",40:"#04e09e",50:"#04cb8f",60:"#00b277",70:"#009360",80:"#007f50",90:"#00663e",95:"#003d24","":{"@light":"$(beryl-40)","@dark":"$(beryl-50)"}},teal:{5:"#dbfefd",10:"#cfffff",20:"#7ffff6",30:"#00f4e4",40:"#00e4d4",50:"#00ccc8",60:"#00aeb7",70:"#0092a3",80:"#00798e",90:"#005d75",95:"#003747","":{"@light":"$(teal-40)","@dark":"$(teal-50)"}},cyan:{5:"#e0ffff",10:"#d1ffff",20:"#7ff6ff",30:"#1ee1ff",40:"#00ccf9",50:"#00b3ea",60:"#0099d6",70:"#007dbc",80:"#0067a8",90:"#005089",95:"#003156","":{"@light":"$(cyan-40)","@dark":"$(cyan-50)"}},sky:{5:"#e5f5ff",10:"#d9f8ff",20:"#a3deff",30:"#6bc6ff",40:"#34b2fd",50:"#059fff",60:"#008df9",70:"#0073e0",80:"#005cc6",90:"#0041a3",95:"#002566","":{"@light":"$(sky-60)","@dark":"$(sky-50)"}},blue:{5:"#e5f3fe",10:"#dbf2fe",20:"#add7ff",30:"#70b0ff",40:"#4c93fd",50:"#3a7cff",60:"#2563fd",70:"#1b53ec",80:"#1947d1",90:"#1735a2",95:"#102069","":{"@light":"$(blue-60)","@dark":"$(blue-50)"}},indigo:{5:"#f0f1fe",10:"#e9ecfe",20:"#c8cdfe",30:"#939eff",40:"#7e81fe",50:"#7068ff",60:"#5b4cfd",70:"#4e39ed",80:"#4732d2",90:"#3623a3",95:"#26176c","":{"@light":"$(indigo-60)","@dark":"$(indigo-50)"}},violet:{5:"#f2efff",10:"#efe8ff",20:"#d7c5ff",30:"#b198fe",40:"#9a70ff",50:"#8e56fe",60:"#812fff",70:"#7407f2",80:"#6405d1",90:"#4f05a3",95:"#35036e","":{"@light":"$(violet-60)","@dark":"$(violet-50)"}},purple:{5:"#f6f0ff",10:"#f6e8fe",20:"#e2bffe",30:"#c492fd",40:"#b266ff",50:"#a849fe",60:"#9514ff",70:"#8200e5",80:"#7100c1",90:"#58008e",95:"#3e0060","":{"@light":"$(purple-60)","@dark":"$(purple-50)"}},fuchsia:{5:"#faf0ff",10:"#fde8fe",20:"#f0baff",30:"#dd89fe",40:"#d760fe",50:"#cf33ff",60:"#b700e5",70:"#a200c6",80:"#8700a3",90:"#660175",95:"#480051","":{"@light":"$(fuchsia-60)","@dark":"$(fuchsia-50)"}},pink:{5:"#fef1f9",10:"#fee9f8",20:"#ffb8df",30:"#f986c1",40:"#fa65b2",50:"#f747a2",60:"#ef2188",70:"#d61673",80:"#b80c5c",90:"#8f0543",95:"#64032f","":{"@light":"$(pink-60)","@dark":"$(pink-50)"}},crimson:{5:"#ffeff2",10:"#ffe8ec",20:"#ffbac7",30:"#ff849d",40:"#ff6684",50:"#fc4065",60:"#ed2a51",70:"#d7173e",80:"#bb1536",90:"#8f132c",95:"#620e1f","":{"@light":"$(crimson-60)","@dark":"$(crimson-50)"}},red:{5:"#ffefef",10:"#fee8e8",20:"#ffbcbc",30:"#ff8787",40:"#fd5f5f",50:"#f73f3f",60:"#e52e2e",70:"#d01b1b",80:"#b81919",90:"#921515",95:"#650f0f","":{"@light":"$(red-60)","@dark":"$(red-50)"}}},$e=Se,I=["none","auto","hidden","dotted","dashed","solid","double","groove","ridge","inset","outset"],_=function(e){return e.length<2||e.find(a=>a.type==="string"&&I.includes(a.value)||a.type==="variable"&&I.includes(a.variable?.value))||e.push({type:"separator",value:" "},{type:"string",value:"solid"}),e},Re={group:{match:/^(?:.+?[*_>~+])?\{.+?\}/,layer:-1,analyze(e){let a=0;for(;a<e.length&&!(e[a]==="{"&&e[a-1]!=="\\");a++);return[e.slice(a),e.slice(0,a)]},declare(e){let a={},i=y=>{let f=y.indexOf(":");if(f!==-1){let d=y.slice(0,f);a[d]=y.slice(f+1)}},n=y=>{let f=d=>{let g=d.slice(se(y.className).length).match(/\{(.*)\}/)?.[1].split(";");if(g)for(let m of g)i(m)};for(let d of y.natives)f(d.text);if(y.animationNames){this.animationNames||(this.animationNames=[]);for(let d of y.animationNames)this.animationNames.includes(d)||this.animationNames.push(d)}if(y.variableNames){this.variableNames||(this.variableNames=[]);for(let d of y.variableNames)this.variableNames.includes(d)||this.variableNames.push(d)}},c=[],r="",o=()=>{r&&(c.push(r.replace(/ /g,"|")),r="")},u=1;(function y(f){for(;u<e.length;u++){let d=e[u];if(!f){if(d===";"){o();continue}if(d==="}")break}if(r+=d,f===d){if(f==="'"||f==='"'){let g=0;for(let m=r.length-2;r[m]==="\\";m--)g++;if(g%2)continue}break}else d in Q&&f!=="'"&&f!=='"'&&(u++,y(Q[d]))}})(""),o();for(let y of c){let f=this.css.generate(y);if(f.length)for(let d of f)n(d);else i(y)}return a}},variable:{match:/^\$[\w-]+:/,colored:!0,layer:-1,declare(e){return{["--"+this.prefix.slice(1,-1)]:e}}},"font-size":{match:["f(?:ont)?"],numeric:!0,unit:"rem",layer:-3},"font-weight":{match:["f(?:ont)?",["bolder"]],layer:-3},"font-family":{match:["f(?:ont)?"],layer:-3},"font-smoothing":{match:["f(?:ont)?",["antialiased","subpixel-antialiased"]],layer:-3,declare(e){switch(e){case"subpixel-antialiased":return{"-webkit-font-smoothing":"auto","-moz-osx-font-smoothing":"auto"};case"antialiased":return{"-webkit-font-smoothing":"antialiased","-moz-osx-font-smoothing":"grayscale"}}}},"font-style":{match:["f(?:ont)?",["normal","italic","oblique"]],layer:-3,unit:"deg"},"font-variant-numeric":{match:["f(?:ont)?",["ordinal","slashed-zero","lining-nums","oldstyle-nums","proportional-nums","tabular-nums","diagonal-fractions","stacked-fractions"]],layer:-3},"font-variant":{layer:-7},"font-feature-settings":{match:/^font-feature:/,layer:-3},font:{match:/^f:/,layer:-7,variables:["font-family","font-variant","font-weight","font-size","font-style","line-height"]},color:{match:/^(?:color|fg):/,layer:-3,colored:!0,variables:["text"]},"margin-left":{match:/^ml:/,layer:-3,unit:"rem",variables:["spacing"]},"margin-right":{match:/^mr:/,layer:-3,unit:"rem",variables:["spacing"]},"margin-top":{match:/^mt:/,layer:-3,unit:"rem",variables:["spacing"]},"margin-bottom":{match:/^mb:/,layer:-3,unit:"rem",variables:["spacing"]},"margin-x":{match:/^(?:mx|margin-x):/,unit:"rem",layer:-5,declare(e){return{"margin-left":e,"margin-right":e}},variables:["spacing"]},"margin-y":{match:/^(?:my|margin-y):/,unit:"rem",layer:-5,declare(e){return{"margin-top":e,"margin-bottom":e}},variables:["spacing"]},margin:{match:/^m:/,unit:"rem",layer:-7,variables:["spacing"]},"margin-inline-start":{match:/^mis:/,layer:-3,unit:"rem",variables:["spacing"]},"margin-inline-end":{match:/^mie:/,layer:-3,unit:"rem",variables:["spacing"]},"margin-inline":{match:/^mi:/,unit:"rem",layer:-7,variables:["spacing"]},"padding-left":{match:/^pl:/,layer:-3,unit:"rem",variables:["spacing"]},"padding-right":{match:/^pr:/,layer:-3,unit:"rem",variables:["spacing"]},"padding-top":{match:/^pt:/,layer:-3,unit:"rem",variables:["spacing"]},"padding-bottom":{match:/^pb:/,layer:-3,unit:"rem",variables:["spacing"]},"padding-x":{match:/^(?:px|padding-x):/,unit:"rem",layer:-5,declare(e){return{"padding-left":e,"padding-right":e}},variables:["spacing"]},"padding-y":{match:/^(?:py|padding-y):/,unit:"rem",layer:-5,declare(e){return{"padding-top":e,"padding-bottom":e}},variables:["spacing"]},padding:{match:/^p:/,unit:"rem",layer:-7,variables:["spacing"]},"padding-inline-start":{match:/^pis:/,layer:-3,unit:"rem",variables:["spacing"]},"padding-inline-end":{match:/^pie:/,layer:-3,unit:"rem",variables:["spacing"]},"padding-inline":{match:/^pi:/,unit:"rem",layer:-7,variables:["spacing"]},"flex-basis":{unit:"rem",layer:-3},"flex-wrap":{match:["flex",["wrap","nowrap","wrap-reverse"]],layer:-3},"flex-grow":{layer:-3},"flex-shrink":{layer:-3},"flex-direction":{match:["flex",["row","row-reverse","column","column-reverse"]],layer:-3},flex:{layer:-7},display:{match:/^d:/,layer:-3},width:{match:/^w:/,unit:"rem",layer:-3},height:{match:/^h:/,unit:"rem",layer:-3},"min-width":{match:/^min-w:/,unit:"rem",layer:-3},"min-height":{match:/^min-h:/,unit:"rem",layer:-3},size:{match:/^size:/,layer:-5,unit:"rem",declare(e,a){let i=a.length;return{width:a[0].text,height:i===1?a[0].text:a[2].text}}},"min-size":{match:/^min:/,layer:-5,unit:"rem",declare(e,a){let i=a.length;return{"min-width":a[0].text,"min-height":i===1?a[0].text:a[2].text}}},"max-size":{match:/^max:/,layer:-5,unit:"rem",declare(e,a){let i=a.length;return{"max-width":a[0].text,"max-height":i===1?a[0].text:a[2].text}}},"box-sizing":{match:/^box:/,layer:-3},"box-decoration-break":{match:["box-decoration",["slice","clone"]],layer:-3,declare(e){return{"box-decoration-break":e,"-webkit-box-decoration-break":e}}},contain:{layer:-3},content:{layer:-3},"counter-increment":{layer:-3},"counter-reset":{layer:-3},"letter-spacing":{match:/^ls:/,layer:-3,unit:"em"},"line-height":{match:/^lh:/,layer:-3},"object-fit":{match:["(?:object|obj)",["contain","cover","fill","scale-down"]],layer:-3},"object-position":{match:["(?:object|obj)",["top","bottom","right","left","center"]],layer:-3},"text-align":{match:["t(?:ext)?",["justify","center","left","right","start","end"]],layer:-3},"text-decoration-color":{match:["text-decoration"],layer:-3,colored:!0,variables:["text"]},"text-decoration-style":{match:["t(?:ext)?",["solid","double","dotted","dashed","wavy"]],layer:-3},"text-decoration-thickness":{match:["text-decoration",["from-font"]],numeric:!0,layer:-3,unit:"em"},"text-decoration-line":{match:["t(?:ext)?",["none","underline","overline","line-through"]],layer:-3},"text-decoration":{match:["t(?:ext)?",["underline","overline","line-through"]],unit:"rem",colored:!0,layer:-7,variables:["text"]},"text-underline-offset":{unit:"rem",layer:-3,variables:["spacing"]},"text-overflow":{match:["t(?:ext)?",["ellipsis","clip"]],layer:-3},"text-orientation":{match:["t(?:ext)?",["mixed","upright","sideways-right","sideways","use-glyph-orientation"]],layer:-3},"text-transform":{match:["t(?:ext)?",["uppercase","lowercase","capitalize"]],layer:-3},"text-rendering":{match:["t(?:ext)?",["optimizeSpeed","optimizeLegibility","geometricPrecision"]],layer:-3},"text-indent":{unit:"rem",layer:-3},"vertical-align":{match:/^(?:v|vertical):/,layer:-3},columns:{match:/^(?:columns|cols):/,layer:-7},"white-space":{layer:-3},top:{layer:-3,unit:"rem",variables:["spacing"]},bottom:{layer:-3,unit:"rem",variables:["spacing"]},left:{layer:-3,unit:"rem",variables:["spacing"]},right:{layer:-3,unit:"rem",variables:["spacing"]},inset:{unit:"rem",layer:-7,variables:["spacing"]},lines:{match:/^lines:/,declare(e){return{overflow:"hidden",display:"-webkit-box","overflow-wrap":"break-word","text-overflow":"ellipsis","-webkit-box-orient":"vertical","-webkit-line-clamp":e}}},"max-height":{match:/^max-h:/,unit:"rem",layer:-3},"max-width":{match:/^max-w:/,unit:"rem",layer:-3},opacity:{layer:-3},visibility:{layer:-3},clear:{layer:-3},float:{layer:-3},isolation:{layer:-3},"overflow-x":{layer:-3,declare(e){return e==="overlay"?{"overflow-x":["auto",e]}:{"overflow-x":e}}},"overflow-y":{layer:-3,declare(e){return e==="overlay"?{"overflow-y":["auto",e]}:{"overflow-y":e}}},overflow:{layer:-7,declare(e){return e==="overlay"?{overflow:["auto",e]}:{overflow:e}}},"overscroll-behavior-x":{layer:-3},"overscroll-behavior-y":{layer:-3},"overscroll-behavior":{layer:-7},"z-index":{match:/^z:/,layer:-3},position:{layer:-3},cursor:{layer:-3},"pointer-events":{layer:-3},resize:{layer:-3},"touch-action":{layer:-3},"word-break":{layer:-3},"word-spacing":{layer:-3,unit:"em"},"user-drag":{layer:-3,declare(e){return{"user-drag":e,"-webkit-user-drag":e}}},"user-select":{layer:-3,declare(e){return{"user-select":e,"-webkit-user-select":e}}},"text-shadow":{unit:"rem",layer:-3,colored:!0},"text-size":{match:["t(?:ext)?"],numeric:!0,unit:"rem",declare(e){return{"font-size":e,"line-height":`calc(${e} + ${.875}em)`}}},"text-fill-color":{match:["(?:text-fill|text|t)"],layer:-3,colored:!0,variables:["text"],declare(e){return{"-webkit-text-fill-color":e}}},"text-stroke-width":{match:["text-stroke",["thin","medium","thick"]],numeric:!0,unit:"rem",layer:-3,declare(e){return{"-webkit-text-stroke-width":e}}},"text-stroke-color":{match:["text-stroke"],layer:-3,colored:!0,variables:["text"],declare(e){return{"-webkit-text-stroke-color":e}}},"text-stroke":{unit:"rem",layer:-3,declare(e){return{"-webkit-text-stroke":e}}},"box-shadow":{match:/^s(?:hadow)?:/,unit:"rem",layer:-3,colored:!0},"table-layout":{layer:-3},"transform-box":{match:["transform"],layer:-3},"transform-style":{match:["transform",["flat","preserve-3d"]],layer:-3},"transform-origin":{match:["transform",["top","bottom","right","left","center"]],numeric:!0,unit:"px",layer:-3},transform:{match:/^(?:translate|scale|skew|rotate|perspective|matrix)(?:3d|[XYZ])?\(/,layer:-3,analyze(e){return[e.startsWith("transform")?e.slice(10):e]},variables:["spacing"]},"transition-property":{match:/^~property:/,layer:-3},"transition-timing-function":{match:/^~easing:/,layer:-3},"transition-duration":{match:/^~duration:/,layer:-3,unit:"ms"},"transition-delay":{match:/^~delay:/,layer:-3,unit:"ms"},transition:{match:/^~[^!*>+~:[@_]+\|/,analyze(e){if(e.startsWith("~"))return[e.slice(1)];{let a=e.indexOf(":");return this.prefix=e.slice(0,a+1),[e.slice(a+1)]}},layer:-7},"animation-delay":{match:/^@delay:/,layer:-3,unit:"ms"},"animation-direction":{match:/^@direction:/,layer:-3},"animation-duration":{match:/^@duration:/,layer:-3,unit:"ms"},"animation-fill-mode":{match:/^@fill:/,layer:-3},"animation-iteration-count":{match:/^@iteration:/,layer:-3},"animation-name":{match:/^@name:/,layer:-3},"animation-play-state":{match:/^@play:/,layer:-3},"animation-timing-function":{match:/^@easing:/,layer:-3},animation:{match:/^@[^!*>+~:[@_]+\|/,layer:-7,analyze(e){if(e.startsWith("@"))return[e.slice(1)];{let a=e.indexOf(":");return this.prefix=e.slice(0,a+1),[e.slice(a+1)]}}},"border-collapse":{match:["b(?:order)?",["collapse","separate"]],layer:-3},"border-spacing":{unit:"rem",layer:-3},"border-top-color":{match:["b(?:t|order-top(?:-color)?)"],layer:-3,colored:!0},"border-bottom-color":{match:["b(?:b|order-bottom(?:-color)?)"],layer:-3,colored:!0},"border-left-color":{match:["b(?:l|order-left(?:-color)?)"],layer:-3,colored:!0},"border-right-color":{match:["b(?:r|order-right(?:-color)?)"],layer:-3,colored:!0},"border-x-color":{match:["b(?:x|order-x(?:-color)?)"],layer:-5,colored:!0,declare(e){return{"border-left-color":e,"border-right-color":e}}},"border-y-color":{match:["b(?:y|order-y(?:-color)?)"],layer:-5,colored:!0,declare(e){return{"border-top-color":e,"border-bottom-color":e}}},"border-color":{match:["b(?:order)?(?:-color)?"],layer:-7,colored:!0},"border-top-left-radius":{match:/^r(?:tl|lt):/,unit:"rem",layer:-3},"border-top-right-radius":{match:/^r(?:tr|rt):/,unit:"rem",layer:-3},"border-bottom-left-radius":{match:/^r(?:bl|lb):/,unit:"rem",layer:-3},"border-bottom-right-radius":{match:/^r(?:br|rb):/,unit:"rem",layer:-3},"border-top-radius":{match:/^rt:/,unit:"rem",layer:-5,declare(e){return{"border-top-left-radius":e,"border-top-right-radius":e}}},"border-bottom-radius":{match:/^rb:/,unit:"rem",layer:-5,declare(e){return{"border-bottom-left-radius":e,"border-bottom-right-radius":e}}},"border-left-radius":{match:/^rl:/,unit:"rem",layer:-5,declare(e){return{"border-top-left-radius":e,"border-bottom-left-radius":e}}},"border-right-radius":{match:/^rr:/,unit:"rem",layer:-5,declare(e){return{"border-top-right-radius":e,"border-bottom-right-radius":e}}},"border-radius":{match:/^r:/,unit:"rem",layer:-7},"border-top-style":{match:["b(?:t|order-top(?:-style)?)",I],layer:-3},"border-bottom-style":{match:["b(?:b|order-bottom(?:-style)?)",I],layer:-3},"border-left-style":{match:["b(?:l|order-left(?:-style)?)",I],layer:-3},"border-right-style":{match:["b(?:r|order-right(?:-style)?)",I],layer:-3},"border-x-style":{match:["b(?:x|order-x(?:-style)?)",I],layer:-5,declare(e){return{"border-left-style":e,"border-right-style":e}}},"border-y-style":{match:["b(?:y|order-y(?:-style)?)",I],layer:-5,declare(e){return{"border-top-style":e,"border-bottom-style":e}}},"border-style":{match:["b(?:order)?(?:-style)?",I],layer:-7},"border-top-width":{match:["b(?:t|order-top(?:-width)?)"],numeric:!0,unit:"rem",layer:-3},"border-bottom-width":{match:["b(?:b|order-bottom(?:-width)?)"],numeric:!0,unit:"rem",layer:-3},"border-left-width":{match:["b(?:l|order-left(?:-width)?)"],numeric:!0,unit:"rem",layer:-3},"border-right-width":{match:["b(?:r|order-right(?:-width)?)"],numeric:!0,unit:"rem",layer:-3},"border-x-width":{match:["b(?:x|order-x(?:-width)?)"],numeric:!0,unit:"rem",layer:-5,declare(e){return{"border-left-width":e,"border-right-width":e}}},"border-y-width":{match:["b(?:y|order-y(?:-width)?)"],numeric:!0,unit:"rem",layer:-5,declare(e){return{"border-top-width":e,"border-bottom-width":e}}},"border-width":{match:["b(?:order)?(?:-width)?"],numeric:!0,unit:"rem",layer:-7},"border-image-outset":{unit:"rem",layer:-3},"border-image-repeat":{match:["border-image",["stretch","repeat","round","space"]],layer:-3},"border-image-slice":{layer:-3},"border-image-source":{match:["border-image",["url","linear-gradient","radial-gradient","repeating-linear-gradient","repeating-radial-gradient","conic-gradient"]],layer:-3},"border-image-width":{match:["border-image",["auto"]],numeric:!0,unit:"rem",layer:-3},"border-image":{layer:-7},"border-top":{match:/^bt:/,layer:-7,unit:"rem",colored:!0,transformValueComponents:_},"border-bottom":{match:/^bb:/,layer:-7,unit:"rem",colored:!0,transformValueComponents:_},"border-left":{match:/^bl:/,layer:-7,unit:"rem",colored:!0,transformValueComponents:_},"border-right":{match:/^br:/,layer:-7,unit:"rem",colored:!0,transformValueComponents:_},"border-x":{match:/^(?:bx|border-x):/,unit:"rem",colored:!0,layer:-5,transformValueComponents:_,declare(e){return{"border-left":e,"border-right":e}}},"border-y":{match:/^(?:by|border-y):/,unit:"rem",colored:!0,layer:-5,transformValueComponents:_,declare(e){return{"border-top":e,"border-bottom":e}}},border:{match:/^b:/,unit:"rem",colored:!0,layer:-7,transformValueComponents:_},"background-attachment":{match:["(?:bg|background)",["fixed","local","scroll"]],layer:-3},"background-blend-mode":{layer:-3},"background-color":{match:["(?:bg|background)"],layer:-3,colored:!0},"background-clip":{match:["(?:bg|background)",["text"]],layer:-3,declare(e){return{"-webkit-background-clip":e,"background-clip":e}}},"background-origin":{match:["(?:bg|background)"],layer:-3},"background-position":{match:["(?:bg|background)",["top","bottom","right","left","center"]],layer:-3,unit:"px"},"background-repeat":{match:["(?:bg|background)",["space","round","repeat","no-repeat","repeat-x","repeat-y"]],layer:-3},"background-size":{match:["(?:bg|background)",["auto","cover","contain"]],numeric:!0,unit:"rem",layer:-3},"background-image":{match:["(?:bg|background)",["(?:url|linear-gradient|radial-gradient|repeating-linear-gradient|repeating-radial-gradient|conic-gradient)\\(.*\\)"]],layer:-3},background:{match:/^bg:/,colored:!0,layer:-7},gradient:{match:/^gradient\(/,layer:-3,colored:!0,declare(e){return{"background-image":"linear-"+e}}},"mix-blend-mode":{match:/^blend:/,layer:-3},"backdrop-filter":{match:/^bd:/,layer:-3,colored:!0,declare(e){return{"backdrop-filter":e,"-webkit-backdrop-filter":e}}},filter:{match:/^(?:blur|brightness|contrast|drop-shadow|grayscale|hue-rotate|invert|opacity|saturate|sepia)\(/,layer:-3,colored:!0},fill:{match:/^fill:/,layer:-3,colored:!0},"stroke-dasharray":{layer:-3},"stroke-dashoffset":{layer:-3,variables:["spacing"]},"stroke-width":{match:["stroke(?:-width)?"],numeric:!0,layer:-3},stroke:{match:["stroke"],layer:-3,colored:!0},x:{layer:-3,variables:["spacing"]},y:{layer:-3,variables:["spacing"]},cx:{layer:-3,variables:["spacing"]},cy:{layer:-3,variables:["spacing"]},rx:{layer:-3},ry:{layer:-3},"grid-column-start":{match:/^grid-col(?:umn)?-start:/,layer:-3},"grid-column-end":{match:/^grid-col(?:umn)?-end:/,layer:-3},"grid-column":{match:/^grid-col(?:umn)?(?:-span)?:/,layer:-7,transformValue(e){return this.prefix.slice(-5,-1)==="span"&&e!=="auto"?"span "+e+"/span "+e:e}},"grid-columns":{match:/^grid-col(?:umn)?s:/,declare(e){return{display:"grid","grid-template-columns":"repeat("+e+",minmax(0,1fr))"}},layer:-1},"grid-row-start":{layer:-3},"grid-row-end":{layer:-3},"grid-row":{match:/^grid-row-span:/,layer:-7,transformValue(e){return this.prefix.slice(-5,-1)==="span"&&e!=="auto"?"span "+e+"/span "+e:e}},"grid-rows":{match:/^grid-rows:/,declare(e){return{display:"grid","grid-auto-flow":"column","grid-template-rows":"repeat("+e+",minmax(0,1fr))"}},layer:-1},"grid-auto-columns":{match:/^grid-auto-cols:/,layer:-3},"grid-auto-flow":{match:/^grid-flow:/,layer:-3},"grid-auto-rows":{layer:-3},"grid-template-areas":{layer:-3},"grid-template-columns":{match:/^grid-template-cols:/,layer:-3,unit:"rem"},"grid-template-rows":{layer:-3,unit:"rem"},"grid-template":{layer:-7},"grid-area":{layer:-7},grid:{layer:-7},"column-gap":{match:/^gap-x:/,unit:"rem",layer:-3,variables:["spacing"]},"row-gap":{match:/^gap-y:/,unit:"rem",layer:-3,variables:["spacing"]},gap:{unit:"rem",layer:-7,variables:["spacing"]},order:{match:/^o:/,layer:-3},"break-inside":{layer:-3},"break-before":{layer:-3},"break-after":{layer:-3},"aspect-ratio":{match:/^aspect:/,layer:-3},"column-span":{match:/^col-span:/,layer:-3},"align-content":{match:/^ac:/,layer:-3},"align-items":{match:/^ai:/,layer:-3},"align-self":{match:/^as:/,layer:-3},"justify-content":{match:/^jc:/,layer:-3},"justify-items":{match:/^ji:/,layer:-3},"justify-self":{match:/^js:/,layer:-3},"place-content":{layer:-7},"place-items":{layer:-7},"place-self":{layer:-7},"list-style-position":{match:["list-style",["inside","outside"]],layer:-3},"list-style-type":{match:["list-style",["disc","decimal"]],layer:-3},"list-style-image":{match:["list-style",["(?:url|linear-gradient|radial-gradient|repeating-linear-gradient|repeating-radial-gradient|conic-gradient)\\(.*\\)"]],layer:-3},"list-style":{layer:-7},"outline-color":{match:["outline"],layer:-3,colored:!0},"outline-offset":{unit:"rem",layer:-3,variables:["spacing"]},"outline-style":{match:["outline",I],layer:-3},"outline-width":{match:["outline",["medium","thick","thin"]],numeric:!0,unit:"rem",layer:-3},outline:{unit:"rem",layer:-7,colored:!0,variables:["outline-width","outline-style","outline-offset","outline-color"],transformValueComponents:_},"accent-color":{match:/^accent:/,layer:-3,colored:!0},appearance:{layer:-3},"caret-color":{match:/^caret:/,layer:-3,colored:!0,variables:["text"]},"scroll-behavior":{layer:-3},"scroll-margin-left":{match:/^scroll-ml:/,layer:-3,unit:"rem",variables:["spacing"]},"scroll-margin-right":{match:/^scroll-mr:/,layer:-3,unit:"rem",variables:["spacing"]},"scroll-margin-top":{match:/^scroll-mt:/,layer:-3,unit:"rem",variables:["spacing"]},"scroll-margin-bottom":{match:/^scroll-mb:/,layer:-3,unit:"rem",variables:["spacing"]},"scroll-margin-x":{match:/^(?:scroll-margin-x|scroll-mx):/,unit:"rem",layer:-5,declare(e){return{"scroll-margin-left":e,"scroll-margin-right":e}},variables:["spacing"]},"scroll-margin-y":{match:/^(?:scroll-margin-y|scroll-my):/,unit:"rem",layer:-5,declare(e){return{"scroll-margin-top":e,"scroll-margin-bottom":e}},variables:["spacing"]},"scroll-margin":{match:/^scroll-m:/,unit:"rem",layer:-7,variables:["spacing"]},"scroll-padding-left":{match:/^scroll-pl:/,layer:-3,unit:"rem",variables:["spacing"]},"scroll-padding-right":{match:/^scroll-pr:/,layer:-3,unit:"rem",variables:["spacing"]},"scroll-padding-top":{match:/^scroll-pt:/,layer:-3,unit:"rem",variables:["spacing"]},"scroll-padding-bottom":{match:/^scroll-pb:/,layer:-3,unit:"rem",variables:["spacing"]},"scroll-padding-x":{match:/^(?:scroll-padding-x|scroll-px):/,unit:"rem",layer:-5,declare(e){return{"scroll-padding-left":e,"scroll-padding-right":e}},variables:["spacing"]},"scroll-padding-y":{match:/^(?:scroll-padding-y|scroll-py):/,unit:"rem",layer:-5,declare(e){return{"scroll-padding-top":e,"scroll-padding-bottom":e}},variables:["spacing"]},"scroll-padding":{match:/^scroll-p:/,unit:"rem",layer:-7,variables:["spacing"]},"scroll-snap-align":{match:["scroll-snap",["start","end","center"]],layer:-3},"scroll-snap-stop":{match:["scroll-snap",["normal","always"]],layer:-3},"scroll-snap-type":{match:["scroll-snap",["x","y","block","inline","both"]],layer:-3},"will-change":{layer:-3},"writing-mode":{match:/^writing:/,layer:-3},direction:{layer:-3},"shape-outside":{match:["shape",["(?:inset|circle|ellipse|polygon|url|linear-gradient)\\(.*\\)"]],layer:-3},"shape-margin":{match:["shape"],numeric:!0,unit:"rem",layer:-3,variables:["spacing"]},"shape-image-threshold":{layer:-3},"clip-path":{match:/^clip:/,layer:-3},quotes:{layer:-3},"mask-image":{layer:-3,declare(e){return{"mask-image":e,"-webkit-mask-image":e}}}},Ce=Re,te={$:{colored:!0,transform(e){let a,i,n=e.indexOf(",");return n!==-1?(a=e.slice(0,n),i=e.slice(n+1)):a=e,[{type:"variable",name:a,fallback:i}]}},calc:{transform(e,a){let i=[],n=0,c=(r,o,u,y,f)=>{let d=i!==r,g=[],m=!1,l=!1,h=!1,s=!1,t,p="",v=(b,S="",k="")=>{if(t===!1&&b!==" "&&this.definition.unit&&(t=void 0,s||w()),p){if(!f){let $=oe.exec(p);$&&(p=(+$[1]*(this.css.config.baseUnit??1)).toString())}if(!m&&!u){let $=this.parseValueComponent(p);if(!l&&isNaN(+p)&&$.type==="number"&&(l=!0),s)isNaN(+p)?$.type==="number"?(r.push($),h=!0):r.push($):r.push({type:"number",value:+p});else if(d){let j={type:"string",value:p};g.push(j),r.push(j)}else r.push($)}else r.push({type:"string",value:p});p=""}b&&((b==="+"||b==="-")&&R(),S&&e[n-1]===" "&&(S=""),k&&e[n+1]===" "&&(k=""),o?r.push({type:"separator",value:b,text:b}):r.push({type:"separator",value:b,text:S+b+k})),m=!1},w=()=>{(this.definition.unit==="rem"||this.definition.unit==="em")&&r.push({type:"separator",value:"/",text:" / "},{type:"number",value:this.css.config.rootSize}),r.push({type:"separator",value:"*",text:" * "},{type:"number",value:1,unit:this.definition.unit})},R=()=>{s&&!h&&!y&&(!d||l)&&w(),s=!1,h=!1};for(;n<e.length;n++){let b=e[n];if(b==="("){let S=/^([+-])/.exec(p);S&&r.push({type:"string",value:S[1]});let k=S?p.slice(1):p,$={type:"function",name:k,symbol:b,children:[],bypassTransform:k==="calc"};r.push($),p="",n++;let j=k==="$"||k==="var";if(t=c($.children,k!==""&&k!=="calc"&&(j||Object.prototype.hasOwnProperty.call(te,k)),m||j||s&&h,s,j)||k==="var",!t&&k==="$"){let q=this.css.variables[$.children[0].value]?.type;t=!q||q==="string"}t&&(l=!0,h=!0)}else if(b===")"){if(v(""),l)for(let S of g)Object.assign(S,this.parseValueComponent(S.value));return l}else if(b===",")v(b,""," ");else if(b===" ")v(b);else{let S=e[n-1];switch(b){case"+":!p&&S!==")"?p+=b:v(b," "," ");break;case"-":!p&&S!==")"?p+=b:v(b," "," ");break;case"*":this.definition.unit&&(s=!0),v(b," "," ");break;case"/":this.definition.unit&&(s=!0),v(b," "," "),m=!0;break;default:p+=b;break}}}v(""),R()};return c(i,!1,!1,!1,!1),"calc("+this.resolveValue(i,te.calc.unit??this.definition.unit,a,!0)+")"}},translate:{unit:"rem"},translateX:{unit:"rem"},translateY:{unit:"rem"},translateZ:{unit:"rem"},translate3d:{unit:"rem"},skew:{unit:"deg"},skewX:{unit:"deg"},skewY:{unit:"deg"},skewZ:{unit:"deg"},skew3d:{unit:"deg"},rotate:{unit:"deg"},rotateX:{unit:"deg"},rotateY:{unit:"deg"},rotateZ:{unit:"deg"},rotate3d:{unit:"deg"},blur:{unit:"rem"},"drop-shadow":{unit:"rem"},"hue-rotate":{unit:"deg"},rgb:{unit:""},rgba:{unit:""},hsl:{unit:""},hsla:{unit:""},color:{unit:"",colored:!0},"color-contrast":{unit:"",colored:!0},"color-mix":{unit:"",colored:!0},hwb:{unit:""},lab:{unit:""},lch:{unit:""},oklab:{unit:""},oklch:{unit:""},clamp:{unit:""},repeat:{unit:""},"linear-gradient":{colored:!0},"radial-gradient":{colored:!0},"conic-gradient":{colored:!0},"repeating-linear-gradient":{colored:!0},"repeating-radial-gradient":{colored:!0},"repeating-conic-gradient":{colored:!0}},je=te,F={mediaQueries:ne,selectors:ge,semantics:xe,rules:Ce,functions:je,animations:ke,variables:$e,scope:"",rootSize:16,baseUnit:4,override:!1,important:!1,themeDriver:"class"};function Oe(e){e.startsWith("#")&&(e=e.slice(1));let a,i,n,c;return e.length===3||e.length===4?(a=parseInt(e[0]+e[0],16),i=parseInt(e[1]+e[1],16),n=parseInt(e[2]+e[2],16),c=e.length===4?Math.round(parseInt(e[3]+e[3],16)/255*100)/100:1):(e.length===6||e.length===8)&&(a=parseInt(e.slice(0,2),16),i=parseInt(e.slice(2,4),16),n=parseInt(e.slice(4,6),16),c=e.length===8?Math.round(parseInt(e.slice(6,8),16)/255*100)/100:1),[a,i,n,c]}function G(e,a=""){return Object.entries(e).reduce((i,[n,c])=>{let r=a?`${a}${n?"-"+n:""}`:n;return typeof c=="object"&&!Array.isArray(c)?Object.assign(i,G(c,r)):i[r]=c,i},{})}function ce(e){let a=typeof Buffer<"u"?Buffer:null;return!!(a&&e instanceof a||e instanceof Date||e instanceof RegExp)}function he(e){if(typeof Buffer<"u"&&Buffer&&e instanceof Buffer){let a=Buffer.alloc(e.length);return e.copy(a),a}else{if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e);throw new Error("Unexpected situation")}}function de(e){let a=[];return e.forEach(function(i,n){typeof i=="object"&&i!==null?Array.isArray(i)?a[n]=de(i):ce(i)?a[n]=he(i):a[n]=K({},i):a[n]=i}),a}function le(e,a){return a==="__proto__"?void 0:e[a]}function K(...e){let a={},i,n;return e.forEach(function(c){typeof c!="object"||c===null||Array.isArray(c)||Object.keys(c).forEach(function(r){if(n=le(a,r),i=le(c,r),i!==a)if(typeof i!="object"||i===null){a[r]=i;return}else if(Array.isArray(i)){a[r]=de(i);return}else if(ce(i)){a[r]=he(i);return}else if(typeof n!="object"||n===null||Array.isArray(n)){a[r]=K({},i);return}else{a[r]=K(n,i);return}})}),a}function H(...e){let a=c=>{let r=K({},c),o=u=>{for(let y in u){let f=u[y];typeof f=="object"&&!Array.isArray(f)?o(f):y&&!y.startsWith("@")&&(u[y]={"":f})}};return r.styles?o(r.styles):r.styles={},r.mediaQueries?o(r.mediaQueries):r.mediaQueries={},r.variables?o(r.variables):r.variables={},r},i=[];for(let c of e)(function r(o){if(o.extends?.length)for(let u of o.extends)r("config"in u?u.config:u);i.push(a(o))})(c);let n=i[0];for(let c=1;c<i.length;c++){let r=i[c];n=K(n,r),Object.prototype.hasOwnProperty.call(r,"animations")&&n.animations&&Object.assign(n.animations,r.animations)}return n}var re=class fe{constructor(a=F){this.customConfig=a,a?.override?this.config=H(a):this.config=H(F,a),this.resolve(),this.constructor===fe&&J.push(this)}static config=F;rules=[];ruleBy={};classesUsage={};config;RegisteredSemanticRules=[];RegisteredRules=[];resolve(){this.styles={},this.stylesBy={},this.selectors={},this.variables={},this.mediaQueries={},this.animations={},this.RegisteredRules.length=0,this.RegisteredSemanticRules.length=0,this.variablesNativeRules={},this.hasKeyframesRule=!1;let a={current:void 0,currentColor:void 0,transparent:void 0},{styles:i,selectors:n,variables:c,semantics:r,mediaQueries:o,rules:u,animations:y}=this.config;function f(l){return l.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}if(n){let l=G(n);for(let h in l){let s=l[h],t=new RegExp(f(h)+"(?![a-z-])");for(let p of Array.isArray(s)?s:[s]){let v=p.match(/^::-[a-z]+-/m)?.[0]??"",w=this.selectors[v];w||(w=this.selectors[v]=[]);let R=w.find(([b])=>b===t);R||(R=[t,[]],w.push(R)),R[1].push(p)}}}if(c){let l={},h=(s,t,p)=>{if(!s)return;let v=(R,b,S,k)=>{if(b===void 0)return;if(b.type==="color"){if(k){let j=b.value.indexOf("/");b={...b,value:j===-1?b.value+" / "+(k.startsWith("0.")?k.slice(1):k):b.value.slice(0,j+2)+String(+b.value.slice(j+2)*+k).slice(1)}}a[R]=void 0}let $=S??p;if($!==void 0)if(Object.prototype.hasOwnProperty.call(this.variables,R)){let j=this.variables[R];$?(j.themes||(j.themes={}),j.themes[$]=b):(j.value=b.value,b.type==="color"&&(j.space=b.space))}else if($){let j={type:b.type,themes:{[$]:b}};b.type==="color"&&(j.space=b.space),this.variables[R]=j}else this.variables[R]=b;else this.variables[R]=b},w=typeof s;if(w==="object")if(Array.isArray(s))v(t,{type:"string",value:s.join(",")});else{let R=Object.keys(s);for(let b of R)b===""||b.startsWith("@")?h(s[b],t,b||R.some(S=>S.startsWith("@"))?b.slice(1):void 0):h(s[b],t+"-"+b,void 0)}else if(w==="number")v(t,{type:"number",value:s}),v("-"+t,{type:"number",value:s*-1});else if(w==="string"){let R=/^\$\((.*?)\)(?: ?\/ ?(.+?))?$/.exec(s);if(R)Object.prototype.hasOwnProperty.call(l,t)||(l[t]={}),l[t][p]=()=>{delete l[t][p];let[b,S]=R[1].split("@");if(b){if(Object.prototype.hasOwnProperty.call(l,b))for(let $ of Object.keys(l[b]))l[b][$]?.();let k=this.variables[b];if(k)if(S===void 0&&k.themes){v(t,{type:k.type,value:k.value,space:k.space},"",R[2]);for(let $ in k.themes)v(t,k.themes[$],$,R[2])}else{let $=S!==void 0?k.themes?.[S]:k;if($){let j={type:$.type,value:$.value};$.type==="color"&&(j.space=$.space),v(t,j,void 0,R[2])}}}};else{let b=/^#([A-Fa-f0-9]{3,4}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})$/.exec(s);if(b){let[S,k,$,j]=Oe(b[1]);v(t,{type:"color",value:`${S} ${k} ${$}${j===1?"":" / "+j}`,space:"rgb"})}else{let S=/^rgb\( *([0-9]{1,3})(?: *, *| +)([0-9]{1,3})(?: *, *| +)([0-9]{1,3}) *(?:(?:,|\/) *(.*?) *)?\)$/.exec(s);if(S)v(t,{type:"color",value:S[1]+" "+S[2]+" "+S[3]+(S[4]?" / "+(S[4].startsWith("0.")?S[4].slice(1):S[4]):""),space:"rgb"});else{let k=/^hsl\((.*?)\)$/.exec(s);k?v(t,{type:"color",value:k[1],space:"hsl"}):v(t,{type:"string",value:s})}}}}};for(let s in c)h(c[s],s);for(let s of Object.keys(l))for(let t of Object.keys(l[s]))l[s][t]?.()}if(o&&(this.mediaQueries=G(o)),y)for(let l in y){let h=this.animations[l]={},s=y[l];for(let t in s){let p=h[t]={},v=s[t];for(let w in v)p[w]=v[w]}}let d=i?G(i):{},g=Object.keys(d),m=l=>{if(Object.prototype.hasOwnProperty.call(this.styles,l))return;let h=this.styles[l]=[],s=d[l];if(!s)return;let t=s.replace(/(?:\n(?:\s*))+/g," ").trim().split(" ");for(let p of t){let v=w=>{if(Object.prototype.hasOwnProperty.call(this.stylesBy,w)){let R=this.stylesBy[w];R.includes(l)||R.push(l)}else this.stylesBy[w]=[l];h.includes(w)||h.push(w)};if(g.includes(p)){m(p);for(let w of this.styles[p])v(w)}else v(p)}};for(let l of g)m(l);if(r&&Object.entries(r).sort((l,h)=>l[0].localeCompare(h[0])).forEach(([l,h],s)=>{this.RegisteredSemanticRules.push({id:"."+l,match:new RegExp("^"+f(l)+"(?=!|\\*|>|\\+|~|:|\\[|@|_|\\.|$)","m"),order:s,definition:{declarations:h,layer:-8}})}),u){let l=Object.entries(u).sort((t,p)=>t[1].layer!==p[1].layer?(p[1].layer||0)-(t[1].layer||0):p[0].localeCompare(t[0])),h=l.length,s=Object.keys(a);l.forEach(([t,p],v)=>{let w={id:t,variables:{},order:this.RegisteredSemanticRules.length+h-1-v,definition:p};this.RegisteredRules.push(w);let R=p.match,b=S=>{for(let k in this.variables)if(k.startsWith(S+"-")||k.startsWith("-"+S+"-")){let $=k.slice(S.length+(S.startsWith("-")?0:1));w.variables[$]={...this.variables[k],name:k}}};if(p.variables)for(let S of p.variables)b(S);if(b(t),R)if(Array.isArray(R)){let[S,k=[]]=R,$=[];k.length&&$.push(`(?:${k.join("|")})(?![a-zA-Z0-9-])`),Object.keys(w.variables).length&&$.push(`(?:${Object.keys(w.variables).join("|")})(?![a-zA-Z0-9-])`),p.colored&&$.push("#","(?:color|color-contrast|color-mix|hwb|lab|lch|oklab|oklch|rgb|rgba|hsl|hsla)\\(.*\\)",`(?:${s.join("|")})(?![a-zA-Z0-9-])`),p.numeric&&$.push("[\\d\\.]","(?:max|min|calc|clamp)\\(.*\\)"),$.length&&(w.match=new RegExp(`^${S}:(?:${$.join("|")})[^|]*?(?:@|$)`))}else w.match=R})}}match(a){for(let i of this.RegisteredRules)if(i.match?.test(a)||(i.definition.layer===-2||i.definition.layer===-6||i.definition.layer===-3||i.definition.layer===-7)&&a.startsWith(i.id+":"))return i;for(let i of this.RegisteredSemanticRules)if(i.match?.test(a))return i}generate(a){return(Object.prototype.hasOwnProperty.call(this.styles,a)?this.styles[a].map(i=>this.create(i)):[this.create(a)]).filter(i=>i&&i.text)}create(a){if(Object.prototype.hasOwnProperty.call(this.ruleBy,a))return this.ruleBy[a];let i=this.match(a);if(i)return new ye(a,i,this)}refresh(a=this.customConfig){a?.override?this.config=H(a):this.config=H(F,a),this.resolve(),this.rules.length=0,this.ruleBy={};for(let i in this.classesUsage)this.add(i);return this}reset(){this.ruleBy={},this.classesUsage={},this.rules.length=0,this.hasKeyframesRule=!1,this.variablesNativeRules={};for(let a in this.animations){let i=this.animations[a];i.usage=0,i.native=void 0}for(let a in this.variables){let i=this.variables[a];i.usage=0}return this}destroy(){return this.reset(),J.splice(J.indexOf(this),1),this}add(...a){for(let i of a){let n=this.generate(i);if(n.length)for(let c of n)this.insert(c)}return this}delete(...a){let i=this.style?.sheet,n=c=>{let r=this.ruleBy[c];if(!(!r||Object.prototype.hasOwnProperty.call(this.stylesBy,c)&&this.stylesBy[c].some(o=>Object.prototype.hasOwnProperty.call(this.classesUsage,o)))){if(i&&r.natives.length){let o=r.natives[0];for(let u=0;u<i.cssRules.length;u++)if(i.cssRules[u]===o.cssRule){for(let y=0;y<r.natives.length;y++)i.deleteRule(u);break}}if(this.rules.splice(this.rules.indexOf(r),1),delete this.ruleBy[c],r.variableNames)for(let o of r.variableNames){let u=this.variables[o];if(u.usage||(u.usage=0),!--u.usage){let y=f=>{let d=this.variablesNativeRules[f];if(d.cssRule.style.removeProperty("--"+o),!d.cssRule.style.length){let g=this.rules[0],m=g.natives.indexOf(d);i?.deleteRule(m),g.natives.splice(m,1),delete this.variablesNativeRules[f],g.natives.length||(this.rules.splice(0,1),this.variablesNativeRules={})}};if(u.value&&y(""),u.themes)for(let f in u.themes)y(f)}}if(r.animationNames){let o=Object.keys(this.variablesNativeRules).length?1:0,u=this.rules[o];for(let y of r.animationNames){let f=this.animations[y];if(f.usage||(f.usage=0),!--f.usage&&f.native){let d=u.natives.indexOf(f.native);this.style.sheet?.deleteRule(Object.keys(this.variablesNativeRules).length+d),u.natives.splice(d,1),f.native=void 0}}u.natives.length||(this.rules.splice(o,1),this.hasKeyframesRule=!1)}r.definition.delete?.call(r,c)}};for(let c of a)if(Object.prototype.hasOwnProperty.call(this.styles,c)){for(let r of this.styles[c])Object.prototype.hasOwnProperty.call(this.classesUsage,r)||n(r);delete this.ruleBy[c]}else n(c)}insert(a){if(this.ruleBy[a.className])return;let i,n=this.rules.length-1,{media:c,order:r,priority:o,hasWhere:u,className:y}=a,f=(m,l,h)=>{let s=m;for(;s<=n;s++){let t=this.rules[s];if(l?.(t))return h?-1:s-1;if(h?.(t))return s}return h?-1:s-1},d,g;if(c){let m=this.rules.findIndex(l=>l.media);if(m===-1)i=n+1;else{let{"max-width":l,"min-width":h}=c.features;if(l||h){let s=this.rules.findIndex(t=>t.media?.features["max-width"]||t.media?.features["min-width"]);if(s===-1)i=n+1;else if(l&&h){if(o===-1?(d=f(s,t=>t.priority!==-1,t=>t.media.features["max-width"]&&t.media.features["min-width"]),g=f(s,t=>t.priority!==-1)):(d=f(s,void 0,t=>t.media.features["max-width"]&&t.media.features["min-width"]&&t.priority!==-1),g=n),d!==-1){let t=l.value-h.value,p=g,v=d;for(d=void 0;p>=v;p--){let{"max-width":w,"min-width":R}=this.rules[p].media.features,b=w.value-R.value;if(b<t)g=p-1;else if(b===t)d=p;else break}}if(d!==-1&&d!==void 0){let t=l.value-h.value;for(let p=g;p>=d;p--){let{"max-width":v,"min-width":w}=this.rules[p].media.features,R=v.value-w.value;if(R<t)g=p-1;else if(R>t){d=p+1;break}}}}else if(h){if(o===-1?(d=f(s,t=>t.media.features["max-width"]&&t.media.features["min-width"]||t.priority!==-1,t=>!t.media.features["max-width"]&&t.media.features["min-width"]),g=f(s,t=>t.media.features["max-width"]&&t.media.features["min-width"]||t.priority!==-1)):(d=f(s,t=>t.media.features["max-width"]&&t.media.features["min-width"]&&t.priority!==-1,t=>!t.media.features["max-width"]&&t.media.features["min-width"]&&t.priority!==-1),g=f(s,t=>t.media.features["max-width"]&&t.media.features["min-width"]&&t.priority!==-1)),d!==-1)for(let t=g;t>=d;t--){let p=this.rules[t].media.features["min-width"].value;if(p>h.value)g=t-1;else if(p<h.value){d=t+1;break}}}else if(o===-1?(d=f(s,t=>t.media.features["min-width"]||t.priority!==-1,t=>t.media.features["max-width"]),g=f(s,t=>t.media.features["min-width"]||t.priority!==-1)):(d=f(s,t=>t.media.features["min-width"]&&t.priority!==-1,t=>t.media.features["max-width"]&&t.priority!==-1),g=f(s,t=>t.media.features["min-width"]&&t.priority!==-1)),d!==-1)for(let t=g;t>=d;t--){let p=this.rules[t].media.features["max-width"].value;if(p<l.value)g=t-1;else if(p>l.value){d=t+1;break}}}else o===-1?(d=m,g=f(m,s=>s.media?.features["max-width"]||s.media?.features["min-width"]||s.priority!==-1)):(d=f(m,s=>s.media?.features["max-width"]||s.media?.features["min-width"],s=>s.priority!==-1),g=f(m,s=>s.media?.features["max-width"]||s.media?.features["min-width"]))}}else{let m=Object.keys(this.variablesNativeRules).length?this.hasKeyframesRule?2:1:this.hasKeyframesRule?1:0;o===-1?(d=m,g=f(m,l=>l.media||l.priority!==-1)):(d=f(m,l=>l.media,l=>l.priority!==-1),g=f(m,l=>l.media))}if(i===void 0&&g!==void 0&&d!==void 0)if(d===-1)i=g+1;else{if(o===-1)for(let m=d;m<=g;m++){let l=this.rules[m];if(!(!u&&l.hasWhere)&&(u&&!l.hasWhere||l.order>=r)){i=m;break}}else for(let m=d;m<=g;m++){let l=this.rules[m];if(!(!u&&l.hasWhere)){if(u&&!l.hasWhere){i=m;break}if(l.priority<o){i=m;break}else if(l.priority===o){if(l.order>=r){i=m;break}}else i=m+1}}i===void 0&&(i=g+1)}if(this.rules.splice(i,0,a),this.ruleBy[y]=a,this.style){let m=this.style.sheet,l=0,h=s=>{let t=this.rules[s];if(t){if(!t.natives.length)return h(s-1);let p=t.natives[t.natives.length-1],v=p.cssRule?.parentRule??p.cssRule;if(m){for(let w=0;w<m.cssRules.length;w++)if(m.cssRules[w]===v){l=w+1;break}}}};h(i-1);for(let s=0;s<a.natives.length;)try{let t=a.natives[s];m?.insertRule(t.text,l),t.cssRule=m?.cssRules[l++],s++}catch(t){console.error(t),a.natives.splice(s,1)}}this.handleRuleWithVariableNames(a),this.handleRuleWithAnimationNames(a),a.definition.insert?.call(a)}get text(){return this.rules.map(a=>a.text).join("")}handleRuleWithAnimationNames(a,i=!1){if(a.animationNames){let n=this.style?.sheet;for(let c of a.animationNames){let r=this.animations[c];if(r.usage)r.usage++;else{let o={text:`@keyframes ${c}{`+Object.entries(r).filter(([f])=>f!=="usage"&&f!=="native").map(([f,d])=>`${f}{${Object.entries(d).map(([g,m])=>g+":"+m).join(";")}}`).join("")+"}"},u=Object.keys(this.variablesNativeRules).length?1:0,y;if(this.hasKeyframesRule?(y=this.rules[u]).natives.push(o):(this.rules.splice(u,0,y={natives:[o],get text(){return this.natives.map(f=>f.text).join("")}}),this.hasKeyframesRule=!0),n){let f;if(i)for(let d=0;d<n.cssRules.length;d++){let g=n.cssRules[d];if(g.constructor.name==="CSSKeyframesRule"&&g.name===c){f=g;break}}if(f)o.cssRule=f;else{let d=Object.keys(this.variablesNativeRules).length+y.natives.length-1;n.insertRule(o.text,d),o.cssRule=n.cssRules[d]}}r.usage=1,r.native=o}}}}handleRuleWithVariableNames(a,i=!1){if(a.variableNames){let n=this.style?.sheet;for(let c of a.variableNames){let r=this.variables[c];if(r.usage)r.usage++;else{let o=(u,y)=>{let f=this.variablesNativeRules[u];if(!f){let g,m,l;if(u)switch(this.config.themeDriver){case"media":m=`@media(prefers-color-scheme:${u})`,l=":root";break;case"host":l=`:host(.${u})`;break;default:l=`.${u}`;break}else l=":root";if(n){let h=Object.keys(this.variablesNativeRules).length?this.rules[0].natives.length:0;n.insertRule((m?m+"{":"")+l+"{}"+(m?m+"}":""),h),g=m?n.cssRules[h].cssRules[0]:n.cssRules[h]}else{let h=new Map,s=Object.defineProperties({},{getPropertyValue:{value:t=>h.get(t)},removeProperty:{value:t=>{h.delete(t);for(let p=0;p<s.length;p++)s[p]===t&&delete s[p]}},setProperty:{value:(t,p)=>{s[s.length]=t,h.set(t,p)}},length:{get(){return Object.keys(s).length}}});g={selectorText:l,style:s,styleMap:h},m&&(g.parentRule={conditionText:m})}f=this.pushVariableNativeRule(u,g)}let d="--"+c;(!i||!f.cssRule.style.getPropertyValue(d))&&f.cssRule.style.setProperty(d,String(y.value))};if(r.value&&o("",r),r.themes)for(let u in r.themes)o(u,r.themes[u]);r.usage=1}}}}pushVariableNativeRule(a,i){if(!Object.keys(this.variablesNativeRules).length){this.variablesNativeRules={};let o={natives:[],get text(){return this.natives.map(u=>u.text).join("")}};this.rules.splice(0,0,o)}let n="",c="}";i.parentRule&&(n+=i.parentRule.conditionText.replace(/ /g,"")+"{",c+="}"),n+=i.selectorText+"{";let r={cssRule:i,get text(){let o=[];for(let u=0;u<i.style.length;u++){let y=i.style[u];o.push(y+":"+i.style.getPropertyValue(y))}return n+o.join(";")+c}};return this.rules[0].natives.push(this.variablesNativeRules[a]=r),r}},J=[];globalThis.MasterCSS=re,globalThis.masterCSSs=J;var Z=class extends re{constructor(i=document,n=F){super(n);this.root=i;this.customConfig=n;i||(this.root=document),this.root===document?(globalThis.runtimeCSS=this,this.container=document.head,this.host=document.documentElement):(this.container=this.root,this.host=this.root.host),X.push(this)}host;observing=!1;progressive=!1;container;observer;observe(i={subtree:!0,childList:!0}){if(this.observing||!this.root)return this;if(X.find(c=>c!==this&&c.root===this.root))return console.warn("Cannot observe the same root element repeatedly."),this;if(this.root?.styleSheets)for(let c of this.root.styleSheets){let{ownerNode:r}=c;if(r&&r.id==="master"){this.style=r,this.progressive=!0;break}}if(this.style?.sheet){let c=0;for(;c<this.style.sheet.cssRules.length;c++){let r=this.style.sheet.cssRules[c];switch(r.constructor.name){case"CSSKeyframesRule":continue;case"CSSMeidaRule":if(this.config.themeDriver==="media"){let u=/\(prefers-color-scheme: (.*?)\)/.exec(r.conditionText);if(u){let y=r.cssRules[0];if(y?.constructor.name==="CSSStyleRule"&&y.selectorText===":root"){this.pushVariableNativeRule(u[1],y);continue}}}break;case"CSSStyleRule":let o=r.selectorText;if(r.style.length){let u=!0;for(let y=0;y<r.style.length;y++)if(!r.style[y]?.startsWith("--")){u=!1;break}if(u){if(o===":root"){this.pushVariableNativeRule("",r);continue}else if(this.config.themeDriver==="host"){let y=/:host(.*?)/.exec(o);if(y){this.pushVariableNativeRule(y[1],r);continue}}else if(!o.startsWith(".\\$")){this.pushVariableNativeRule(o.slice(1),r);continue}}}break}break}for(;c<this.style.sheet.cssRules.length;c++){let r=u=>{if(u.selectorText){let f=u.selectorText.split(", ")[0].split(" ");for(let d=0;d<f.length;d++){let g=f[d];if(g[0]==="."){let m=g.slice(1),l="";for(let h=0;h<m.length;h++){let s=m[h],t=m[h+1];if(s==="\\"){if(h++,t!=="\\"){l+=t;continue}}else if([",",".","#","[","!","*",">","+","~",":","@"].includes(s))break;l+=s}if(!Object.prototype.hasOwnProperty.call(this.ruleBy,l)&&!Object.prototype.hasOwnProperty.call(this.styles,l)){let h=this.generate(l)[0];if(h)return h}}}}else if(u.cssRules)for(let y=0;y<u.cssRules.length;y++){let f=r(u.cssRules[y]);if(f)return f}},o=r(this.style.sheet.cssRules[c]);if(o){this.rules.push(o),this.ruleBy[o.className]=o;for(let u=0;u<o.natives.length;u++)o.natives[u].cssRule=this.style.sheet.cssRules[c+u];c+=o.natives.length-1,this.handleRuleWithVariableNames(o,!0),this.handleRuleWithAnimationNames(o,!0),o.definition.insert?.call(o)}}}else this.style=document.createElement("style"),this.style.id="master",this.container.append(this.style);let n=c=>{c.forEach(r=>{Object.prototype.hasOwnProperty.call(this.classesUsage,r)?this.classesUsage[r]++:(this.classesUsage[r]=1,this.add(r))})};return n(this.host.classList),i.subtree&&(this.root===document?this.host:this.container).querySelectorAll("[class]").forEach(c=>n(c.classList)),this.observer=new MutationObserver(c=>{let r={},o=[],u=[],y=[],f=(l,h)=>{h?l.classList.forEach(g):l.classList.forEach(d);let s=l.children;for(let t=0;t<s.length;t++){let p=s[t];p.classList&&(u.push(p),f(p,h))}},d=l=>{Object.prototype.hasOwnProperty.call(r,l)?r[l]++:r[l]=1},g=l=>{Object.prototype.hasOwnProperty.call(r,l)?r[l]--:Object.prototype.hasOwnProperty.call(this.classesUsage,l)&&(r[l]=-1)},m=(l,h)=>{for(let s=0;s<l.length;s++){let t=l[s];t.classList&&!u.includes(t)&&!y.includes(t)&&(t.isConnected!==h?(u.push(t),f(t,h)):y.push(t))}};for(let l=0;l<c.length;l++){let h=c[l],{addedNodes:s,removedNodes:t,type:p,target:v}=h;if(p==="attributes"){if(o.find(w=>w.target===v))continue;o.push(h)}else m(s,!1),(!v.isConnected||!u.includes(v))&&m(t,!0)}if(!(!o.length&&!Object.keys(r).length)){for(let{oldValue:l,target:h}of o){let s=u.includes(h),t=h.classList,p=l?l.split(" "):[];if(s){if(h.isConnected)continue;for(let v of p)t.contains(v)||g(v)}else if(h.isConnected){t.forEach(v=>{p.includes(v)||d(v)});for(let v of p)t.contains(v)||g(v)}}for(let l in r){let h=r[l],s=(this.classesUsage[l]||0)+h;s===0?(delete this.classesUsage[l],this.delete(l)):(Object.prototype.hasOwnProperty.call(this.classesUsage,l)||this.add(l),this.classesUsage[l]=s)}}}),this.observer.observe(this.root,{...i,attributes:!0,attributeOldValue:!0,attributeFilter:["class"]}),this.host.style.removeProperty("display"),this.observing=!0,this}refresh(i=this.customConfig){let n=document.createElement("style");return n.id="master",this.style.replaceWith(n),this.style=n,super.refresh(i),this}reset(){super.reset();let i=this.style?.sheet;if(i?.cssRules)for(let n=i.cssRules.length-1;n>=0;n--)i.deleteRule(n);return this.progressive||(this.style?.remove(),this.style=null),this}disconnect(){return this.observer&&(this.observer.disconnect(),this.observer=null),this.observing=!1,this.reset(),this}destroy(){return this.disconnect(),X.splice(X.indexOf(this),1),this}},X=[];globalThis.RuntimeCSS=Z,globalThis.runtimeCSSs=X;function ae(e){return new Z(document,e).observe()}ae(window.masterCSSConfig);})();
|
package/dist/index.bundle.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var v=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var N=(f,d)=>{for(var c in d)v(f,c,{get:d[c],enumerable:!0})},L=(f,d,c,h)=>{if(d&&typeof d=="object"||typeof d=="function")for(let s of T(d))!w.call(f,s)&&s!==c&&v(f,s,{get:()=>d[s],enumerable:!(h=E(d,s))||h.enumerable});return f};var M=f=>L(v({},"__esModule",{value:!0}),f);var j={};N(j,{RuntimeCSS:()=>m,default:()=>m,initCSSRuntime:()=>O});module.exports=M(j);var R=require("@master/css");var m=class extends R.MasterCSS{constructor(c=document,h=R.config){super(h);this.root=c;this.customConfig=h;c||(this.root=document),this.root===document?(globalThis.runtimeCSS=this,this.container=document.head,this.host=document.documentElement):(this.container=this.root,this.host=this.root.host),g.push(this)}host;observing=!1;progressive=!1;container;observer;observe(c={subtree:!0,childList:!0}){if(this.observing||!this.root)return this;if(g.find(s=>s!==this&&s.root===this.root))return console.warn("Cannot observe the same root element repeatedly."),this;if(this.root?.styleSheets)for(let s of this.root.styleSheets){let{ownerNode:t}=s;if(t&&t.id==="master"){this.style=t,this.progressive=!0;break}}if(this.style?.sheet){let s=0;for(;s<this.style.sheet.cssRules.length;s++){let t=this.style.sheet.cssRules[s];switch(t.constructor.name){case"CSSKeyframesRule":continue;case"CSSMeidaRule":if(this.config.themeDriver==="media"){let o=/\(prefers-color-scheme: (.*?)\)/.exec(t.conditionText);if(o){let r=t.cssRules[0];if(r?.constructor.name==="CSSStyleRule"&&r.selectorText===":root"){this.pushVariableNativeRule(o[1],r);continue}}}break;case"CSSStyleRule":let l=t.selectorText;if(t.style.length){let o=!0;for(let r=0;r<t.style.length;r++)if(!t.style[r]?.startsWith("--")){o=!1;break}if(o){if(l===":root"){this.pushVariableNativeRule("",t);continue}else if(this.config.themeDriver==="host"){let r=/:host(.*?)/.exec(l);if(r){this.pushVariableNativeRule(r[1],t);continue}}else if(!l.startsWith(".\\$")){this.pushVariableNativeRule(l.slice(1),t);continue}}}break}break}for(;s<this.style.sheet.cssRules.length;s++){let t=o=>{if(o.selectorText){let y=o.selectorText.split(", ")[0].split(" ");for(let p=0;p<y.length;p++){let C=y[p];if(C[0]==="."){let b=C.slice(1),e="";for(let i=0;i<b.length;i++){let a=b[i],n=b[i+1];if(a==="\\"){if(i++,n!=="\\"){e+=n;continue}}else if([",",".","#","[","!","*",">","+","~",":","@"].includes(a))break;e+=a}if(!Object.prototype.hasOwnProperty.call(this.ruleBy,e)&&!Object.prototype.hasOwnProperty.call(this.styles,e)){let i=this.generate(e)[0];if(i)return i}}}}else if(o.cssRules)for(let r=0;r<o.cssRules.length;r++){let y=t(o.cssRules[r]);if(y)return y}},l=t(this.style.sheet.cssRules[s]);if(l){this.rules.push(l),this.ruleBy[l.className]=l;for(let o=0;o<l.natives.length;o++)l.natives[o].cssRule=this.style.sheet.cssRules[s+o];s+=l.natives.length-1,this.handleRuleWithVariableNames(l,!0),this.handleRuleWithAnimationNames(l,!0),l.definition.insert?.call(l)}}}else this.style=document.createElement("style"),this.style.id="master",this.container.append(this.style);let h=s=>{s.forEach(t=>{Object.prototype.hasOwnProperty.call(this.classesUsage,t)?this.classesUsage[t]++:(this.classesUsage[t]=1,this.add(t))})};return h(this.host.classList),c.subtree&&(this.root===document?this.host:this.container).querySelectorAll("[class]").forEach(s=>h(s.classList)),this.observer=new MutationObserver(s=>{let t={},l=[],o=[],r=[],y=(e,i)=>{i?e.classList.forEach(C):e.classList.forEach(p);let a=e.children;for(let n=0;n<a.length;n++){let S=a[n];S.classList&&(o.push(S),y(S,i))}},p=e=>{Object.prototype.hasOwnProperty.call(t,e)?t[e]++:t[e]=1},C=e=>{Object.prototype.hasOwnProperty.call(t,e)?t[e]--:Object.prototype.hasOwnProperty.call(this.classesUsage,e)&&(t[e]=-1)},b=(e,i)=>{for(let a=0;a<e.length;a++){let n=e[a];n.classList&&!o.includes(n)&&!r.includes(n)&&(n.isConnected!==i?(o.push(n),y(n,i)):r.push(n))}};for(let e=0;e<s.length;e++){let i=s[e],{addedNodes:a,removedNodes:n,type:S,target:u}=i;if(S==="attributes"){if(l.find(x=>x.target===u))continue;l.push(i)}else b(a,!1),(!u.isConnected||!o.includes(u))&&b(n,!0)}if(!(!l.length&&!Object.keys(t).length)){for(let{oldValue:e,target:i}of l){let a=o.includes(i),n=i.classList,S=e?e.split(" "):[];if(a){if(i.isConnected)continue;for(let u of S)n.contains(u)||C(u)}else if(i.isConnected){n.forEach(u=>{S.includes(u)||p(u)});for(let u of S)n.contains(u)||C(u)}}for(let e in t){let i=t[e],a=(this.classesUsage[e]||0)+i;a===0?(delete this.classesUsage[e],this.delete(e)):(Object.prototype.hasOwnProperty.call(this.classesUsage,e)||this.add(e),this.classesUsage[e]=a)}}}),this.observer.observe(this.root,{...c,attributes:!0,attributeOldValue:!0,attributeFilter:["class"]}),this.host.style.removeProperty("display"),this.observing=!0,this}refresh(c=this.customConfig){let h=document.createElement("style");return h.id="master",this.style.replaceWith(h),this.style=h,super.refresh(c),this}reset(){super.reset();let c=this.style?.sheet;if(c?.cssRules)for(let h=c.cssRules.length-1;h>=0;h--)c.deleteRule(h);return this.progressive||(this.style?.remove(),this.style=null),this}disconnect(){return this.observer&&(this.observer.disconnect(),this.observer=null),this.observing=!1,this.reset(),this}destroy(){return this.disconnect(),g.splice(g.indexOf(this),1),this}},g=[];globalThis.RuntimeCSS=m,globalThis.runtimeCSSs=g;function O(f){return new m(document,f).observe()}
|
package/dist/index.bundle.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{MasterCSS as v,config as O}from"@master/css";var S=class extends v{constructor(u=document,c=O){super(c);this.root=u;this.customConfig=c;u||(this.root=document),this.root===document?(globalThis.runtimeCSS=this,this.container=document.head,this.host=document.documentElement):(this.container=this.root,this.host=this.root.host),C.push(this)}host;observing=!1;progressive=!1;container;observer;observe(u={subtree:!0,childList:!0}){if(this.observing||!this.root)return this;if(C.find(l=>l!==this&&l.root===this.root))return console.warn("Cannot observe the same root element repeatedly."),this;if(this.root?.styleSheets)for(let l of this.root.styleSheets){let{ownerNode:t}=l;if(t&&t.id==="master"){this.style=t,this.progressive=!0;break}}if(this.style?.sheet){let l=0;for(;l<this.style.sheet.cssRules.length;l++){let t=this.style.sheet.cssRules[l];switch(t.constructor.name){case"CSSKeyframesRule":continue;case"CSSMeidaRule":if(this.config.themeDriver==="media"){let i=/\(prefers-color-scheme: (.*?)\)/.exec(t.conditionText);if(i){let r=t.cssRules[0];if(r?.constructor.name==="CSSStyleRule"&&r.selectorText===":root"){this.pushVariableNativeRule(i[1],r);continue}}}break;case"CSSStyleRule":let o=t.selectorText;if(t.style.length){let i=!0;for(let r=0;r<t.style.length;r++)if(!t.style[r]?.startsWith("--")){i=!1;break}if(i){if(o===":root"){this.pushVariableNativeRule("",t);continue}else if(this.config.themeDriver==="host"){let r=/:host(.*?)/.exec(o);if(r){this.pushVariableNativeRule(r[1],t);continue}}else if(!o.startsWith(".\\$")){this.pushVariableNativeRule(o.slice(1),t);continue}}}break}break}for(;l<this.style.sheet.cssRules.length;l++){let t=i=>{if(i.selectorText){let d=i.selectorText.split(", ")[0].split(" ");for(let y=0;y<d.length;y++){let m=d[y];if(m[0]==="."){let p=m.slice(1),e="";for(let s=0;s<p.length;s++){let a=p[s],n=p[s+1];if(a==="\\"){if(s++,n!=="\\"){e+=n;continue}}else if([",",".","#","[","!","*",">","+","~",":","@"].includes(a))break;e+=a}if(!Object.prototype.hasOwnProperty.call(this.ruleBy,e)&&!Object.prototype.hasOwnProperty.call(this.styles,e)){let s=this.generate(e)[0];if(s)return s}}}}else if(i.cssRules)for(let r=0;r<i.cssRules.length;r++){let d=t(i.cssRules[r]);if(d)return d}},o=t(this.style.sheet.cssRules[l]);if(o){this.rules.push(o),this.ruleBy[o.className]=o;for(let i=0;i<o.natives.length;i++)o.natives[i].cssRule=this.style.sheet.cssRules[l+i];l+=o.natives.length-1,this.handleRuleWithVariableNames(o,!0),this.handleRuleWithAnimationNames(o,!0),o.definition.insert?.call(o)}}}else this.style=document.createElement("style"),this.style.id="master",this.container.append(this.style);let c=l=>{l.forEach(t=>{Object.prototype.hasOwnProperty.call(this.classesUsage,t)?this.classesUsage[t]++:(this.classesUsage[t]=1,this.add(t))})};return c(this.host.classList),u.subtree&&(this.root===document?this.host:this.container).querySelectorAll("[class]").forEach(l=>c(l.classList)),this.observer=new MutationObserver(l=>{let t={},o=[],i=[],r=[],d=(e,s)=>{s?e.classList.forEach(m):e.classList.forEach(y);let a=e.children;for(let n=0;n<a.length;n++){let f=a[n];f.classList&&(i.push(f),d(f,s))}},y=e=>{Object.prototype.hasOwnProperty.call(t,e)?t[e]++:t[e]=1},m=e=>{Object.prototype.hasOwnProperty.call(t,e)?t[e]--:Object.prototype.hasOwnProperty.call(this.classesUsage,e)&&(t[e]=-1)},p=(e,s)=>{for(let a=0;a<e.length;a++){let n=e[a];n.classList&&!i.includes(n)&&!r.includes(n)&&(n.isConnected!==s?(i.push(n),d(n,s)):r.push(n))}};for(let e=0;e<l.length;e++){let s=l[e],{addedNodes:a,removedNodes:n,type:f,target:h}=s;if(f==="attributes"){if(o.find(R=>R.target===h))continue;o.push(s)}else p(a,!1),(!h.isConnected||!i.includes(h))&&p(n,!0)}if(!(!o.length&&!Object.keys(t).length)){for(let{oldValue:e,target:s}of o){let a=i.includes(s),n=s.classList,f=e?e.split(" "):[];if(a){if(s.isConnected)continue;for(let h of f)n.contains(h)||m(h)}else if(s.isConnected){n.forEach(h=>{f.includes(h)||y(h)});for(let h of f)n.contains(h)||m(h)}}for(let e in t){let s=t[e],a=(this.classesUsage[e]||0)+s;a===0?(delete this.classesUsage[e],this.delete(e)):(Object.prototype.hasOwnProperty.call(this.classesUsage,e)||this.add(e),this.classesUsage[e]=a)}}}),this.observer.observe(this.root,{...u,attributes:!0,attributeOldValue:!0,attributeFilter:["class"]}),this.host.style.removeProperty("display"),this.observing=!0,this}refresh(u=this.customConfig){let c=document.createElement("style");return c.id="master",this.style.replaceWith(c),this.style=c,super.refresh(u),this}reset(){super.reset();let u=this.style?.sheet;if(u?.cssRules)for(let c=u.cssRules.length-1;c>=0;c--)u.deleteRule(c);return this.progressive||(this.style?.remove(),this.style=null),this}disconnect(){return this.observer&&(this.observer.disconnect(),this.observer=null),this.observing=!1,this.reset(),this}destroy(){return this.disconnect(),C.splice(C.indexOf(this),1),this}},C=[];globalThis.RuntimeCSS=S,globalThis.runtimeCSSs=C;function g(b){return new S(document,b).observe()}export{S as RuntimeCSS,S as default,g as initCSSRuntime};
|
|
File without changes
|