@unocss/runtime 0.26.2 → 0.27.0

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/core.global.js CHANGED
@@ -1,2 +1,2 @@
1
- (()=>{var gt=Object.defineProperty,mt=Object.defineProperties;var yt=Object.getOwnPropertyDescriptors;var j=Object.getOwnPropertySymbols;var N=Object.prototype.hasOwnProperty,Z=Object.prototype.propertyIsEnumerable;var W=(n,t,e)=>t in n?gt(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,$=(n,t)=>{for(var e in t||(t={}))N.call(t,e)&&W(n,e,t[e]);if(j)for(var e of j(t))Z.call(t,e)&&W(n,e,t[e]);return n},M=(n,t)=>mt(n,yt(t));var J=(n,t)=>{var e={};for(var r in n)N.call(n,r)&&t.indexOf(r)<0&&(e[r]=n[r]);if(n!=null&&j)for(var r of j(n))t.indexOf(r)<0&&Z.call(n,r)&&(e[r]=n[r]);return e};function St(n){let t=n.length,e=-1,r,s="",i=n.charCodeAt(0);for(;++e<t;){if(r=n.charCodeAt(e),r===0){s+="\uFFFD";continue}if(r===44){s+="\\2c ";continue}if(r>=1&&r<=31||r===127||e===0&&r>=48&&r<=57||e===1&&r>=48&&r<=57&&i===45){s+=`\\${r.toString(16)} `;continue}if(e===0&&t===1&&r===45){s+=`\\${n.charAt(e)}`;continue}if(r>=128||r===45||r===95||r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122){s+=n.charAt(e);continue}s+=`\\${n.charAt(e)}`}return s}var D=St;function v(n){return(Array.isArray(n)?n:Object.entries(n)).filter(t=>t[1]!=null)}function Q(n){return Array.isArray(n)?n.find(t=>!Array.isArray(t)||Array.isArray(t[0]))?n.map(t=>v(t)):[n]:[v(n)]}function xt(n){return n.filter(([t,e],r)=>{if(t.startsWith("$$"))return!1;for(let s=r-1;s>=0;s--)if(n[s][0]===t&&n[s][1]===e)return!1;return!0})}function K(n){return n==null?"":xt(n).map(([t,e])=>e!=null?`${t}:${e};`:void 0).filter(Boolean).join("")}function L(n){return n&&typeof n=="object"&&!Array.isArray(n)}function F(n,t){let e=n,r=t;if(Array.isArray(e)&&Array.isArray(r))return[...e,...r];if(Array.isArray(e))return[...e];let s=$({},e);return L(e)&&L(r)&&Object.keys(r).forEach(i=>{L(r[i])?i in e?s[i]=F(e[i],r[i]):Object.assign(s,{[i]:r[i]}):Object.assign(s,{[i]:r[i]})}),s}function V(n){let t,e,r;if(Array.isArray(n)){for(e=Array(t=n.length);t--;)e[t]=(r=n[t])&&typeof r=="object"?V(r):r;return e}if(Object.prototype.toString.call(n)==="[object Object]"){e={};for(t in n)t==="__proto__"?Object.defineProperty(e,t,{value:V(n[t]),configurable:!0,enumerable:!0,writable:!0}):e[t]=(r=n[t])&&typeof r=="object"?V(r):r;return e}return n}function X(n){return typeof n[0]=="string"}function Y(n){return typeof n[0]=="string"}function P(n=[]){return Array.isArray(n)?n:[n]}function k(n){return Array.from(new Set(n))}var Ct=/(?!\d|-{2}|-\d)[a-zA-Z0-9\u00A0-\uFFFF-_:%-?]/,z="$$shortcut-no-merge";function tt(n=""){return Ct.test(n)}function et(n){return typeof n=="function"?{match:n}:n}function B(n){return n.length===3}function rt(n){return n!=null}var G=class{_map=new Map;get(t,e){let r=this._map.get(t);if(r)return r.get(e)}getFallback(t,e,r){let s=this._map.get(t);return s||(s=new Map,this._map.set(t,s)),s.has(e)||s.set(e,r),s.get(e)}set(t,e,r){let s=this._map.get(t);return s||(s=new Map,this._map.set(t,s)),s.set(e,r),this}has(t,e){var r;return(r=this._map.get(t))==null?void 0:r.has(e)}delete(t,e){var r;return((r=this._map.get(t))==null?void 0:r.delete(e))||!1}deleteTop(t){return this._map.delete(t)}map(t){return Array.from(this._map.entries()).flatMap(([e,r])=>Array.from(r.entries()).map(([s,i])=>t(i,e,s)))}};var bt=/([!\w+:_/-]+?)([:-])\(((?:[!\w\s:/\\,%#.$-]|\[.*?\])*?)\)/gm;function nt(n){let t=[],e;for(;e=bt.exec(n);){let s=e.index,i=s+e[0].length,[,o,a,c]=e,f=c.split(/\s/g).map(u=>u.replace(/^(!?)(.*)/,`$1${o}${a}$2`)).join(" ");t.unshift([s,i,f])}let r=n;return t.forEach(([s,i,o])=>{r=r.slice(0,s)+o+r.slice(i)}),r}var st=new Set;function it(n){st.has(n)||(console.warn("[unocss]",n),st.add(n))}var Rt=n=>n.split(/[\s'"`;>=]+/g).filter(tt),H={name:"split",order:0,extract({code:n}){return new Set(Rt(n))}};function wt(n){return P(n).flatMap(t=>Array.isArray(t)?[t]:Object.entries(t))}var Ut={shortcuts:-1,default:0};function I(n={},t={}){let e=Object.assign({},t,n),r=(e.presets||[]).flatMap(P),s=[...r.filter(l=>l.enforce==="pre"),...r.filter(l=>!l.enforce),...r.filter(l=>l.enforce==="post")],i=Object.assign(Ut,...r.map(l=>l.layers),n.layers);function o(l){return k([...s.flatMap(y=>P(y[l]||[])),...P(e[l]||[])])}let a=o("extractors");a.length||a.push(H),a.sort((l,y)=>(l.order||0)-(y.order||0));let c=o("rules"),f={},u=c.length;c.forEach((l,y)=>{X(l)&&(f[l[0]]=[y,l[1],l[2]],delete c[y])});let x=V([...s.map(l=>l.theme||{}),e.theme||{}].reduce((l,y)=>F(l,y),{}));return o("extendTheme").forEach(l=>l(x)),M($({mergeSelectors:!0,warn:!0,blocklist:[],safelist:[],sortLayers:l=>l},e),{presets:s,envMode:e.envMode||"build",shortcutsLayer:e.shortcutsLayer||"shortcuts",layers:i,theme:x,rulesSize:u,rulesDynamic:c,rulesStaticMap:f,preprocess:o("preprocess"),postprocess:o("postprocess"),preflights:o("preflights"),variants:o("variants").map(et),shortcuts:wt(o("shortcuts")),extractors:a})}var ot="0.26.2";var ct=class{constructor(t={},e={}){this.userConfig=t;this.defaults=e;this.config=I(t,e)}version=ot;_cache=new Map;config;blocked=new Set;parentOrders=new Map;setConfig(t,e){!t||(e&&(this.defaults=e),this.userConfig=t,this.config=I(t,this.defaults),this.blocked.clear(),this.parentOrders.clear(),this._cache.clear())}async applyExtractors(t,e,r=new Set){let s={get original(){return t},code:t,id:e};for(let i of this.config.extractors){let o=await i.extract(s);o==null||o.forEach(a=>r.add(a))}return r}makeContext(t,e){let r={rawSelector:t,currentSelector:e[1],theme:this.config.theme,generator:this,variantHandlers:e[2],constructCSS:(...s)=>this.constructCustomCSS(r,...s),variantMatch:e};return r}async parseToken(t,e){var f;if(this.blocked.has(t))return;let r=`${t}${e?` ${e}`:""}`,s=this._cache.get(r);if(s)return s;let i=t;for(let u of this.config.preprocess)i=u(t);if(this.isBlocked(i)){this.blocked.add(t),this._cache.set(r,null);return}let o=this.matchVariants(t,i);if(!o||this.isBlocked(o[1])){this.blocked.add(t),this._cache.set(r,null);return}let a=this.makeContext(t,[e||o[0],o[1],o[2]]),c=this.expandShortcut(a.currentSelector,a);if(c){let u=await this.stringifyShortcuts(a.variantMatch,a,c[0],c[1]);if(u==null?void 0:u.length)return this._cache.set(r,u),u}else{let u=(f=await this.parseUtil(a.variantMatch,a))==null?void 0:f.map(x=>this.stringifyUtil(x)).filter(rt);if(u==null?void 0:u.length)return this._cache.set(r,u),u}this._cache.set(r,null)}async generate(t,{id:e,scope:r,preflights:s=!0,safelist:i=!0,minify:o=!1}={}){let a=typeof t=="string"?await this.applyExtractors(t,e):t;i&&this.config.safelist.forEach(p=>a.add(p));let c=o?"":`
2
- `,f=new Set(["default"]),u=new Set,x=new Map;await Promise.all(Array.from(a).map(async p=>{var g;if(u.has(p))return;let h=await this.parseToken(p);if(h!=null){u.add(p);for(let S of h){let R=S[3]||"";x.has(R)||x.set(R,[]),x.get(R).push(S),((g=S[4])==null?void 0:g.layer)&&f.add(S[4].layer)}}})),s&&this.config.preflights.forEach(p=>{p.layer&&f.add(p.layer)});let l={},y=this.config.sortLayers(Array.from(f).sort((p,h)=>{var g,S;return((g=this.config.layers[p])!=null?g:0)-((S=this.config.layers[h])!=null?S:0)||p.localeCompare(h)})),w={};s&&(w=Object.fromEntries(await Promise.all(y.map(async p=>{let g=(await Promise.all(this.config.preflights.filter(S=>(S.layer||"default")===p).map(async S=>await S.getCSS()))).filter(Boolean).join(c);return[p,g]}))));let A=p=>{if(l[p])return l[p];let h=Array.from(x).sort((g,S)=>{var R,U,d;return((R=this.parentOrders.get(g[0]))!=null?R:0)-((U=this.parentOrders.get(S[0]))!=null?U:0)||((d=g[0])==null?void 0:d.localeCompare(S[0]||""))||0}).map(([g,S])=>{let R=S.length,U=S.filter(m=>{var b;return(((b=m[4])==null?void 0:b.layer)||"default")===p}).sort((m,b)=>{var T,O,E;return m[0]-b[0]||(((T=m[4])==null?void 0:T.sort)||0)-(((O=b[4])==null?void 0:O.sort)||0)||((E=m[1])==null?void 0:E.localeCompare(b[1]||""))||0}).map(m=>{var b;return[m[1]?$t(m[1],r):m[1],m[2],!!((b=m[4])==null?void 0:b.noMerge)]}).map(m=>[m[0]==null?m[0]:[m[0]],m[1],m[2]]);if(!U.length)return;let d=U.reverse().map(([m,b,T],O)=>{if(!T&&m&&this.config.mergeSelectors)for(let E=O+1;E<R;E++){let _=U[E];if(_&&!_[2]&&_[0]&&_[1]===b)return _[0].push(...m),null}return m?`${[...new Set(m)].join(`,${c}`)}{${b}}`:b}).filter(Boolean).reverse().join(c);return g?`${g}{${c}${d}${c}}`:d}).filter(Boolean).join(c);return s&&(h=[w[p],h].filter(Boolean).join(c)),l[p]=!o&&h?`/* layer: ${p} */${c}${h}`:h},C=(p=y,h)=>p.filter(g=>!(h==null?void 0:h.includes(g))).map(g=>A(g)||"").filter(Boolean).join(c);return{get css(){return C()},layers:y,getLayers:C,getLayer:A,matched:u}}matchVariants(t,e){let r=new Set,s=[],i=e||t,o=!1,a={rawSelector:t,theme:this.config.theme,generator:this};for(;;){o=!1;for(let c of this.config.variants){if(!c.multiPass&&r.has(c))continue;let f=c.match(i,a);if(!!f&&(typeof f=="string"&&(f={matcher:f}),f)){i=f.matcher,Array.isArray(f.parent)&&this.parentOrders.set(f.parent[0],f.parent[1]),s.push(f),r.add(c),o=!0;break}}if(!o)break;if(s.length>500)throw new Error(`Too many variants applied to "${t}"`)}return[t,i,s]}applyVariants(t,e=t[4],r=t[1]){let s=[...e].sort((a,c)=>(a.order||0)-(c.order||0)),i=s.reduce((a,c)=>{var f;return((f=c.body)==null?void 0:f.call(c,a))||a},t[2]),o={selector:s.reduce((a,c)=>{var f;return((f=c.selector)==null?void 0:f.call(c,a,i))||a},Tt(r)),entries:i,parent:s.reduce((a,c)=>Array.isArray(c.parent)?c.parent[0]:c.parent||a,void 0),layer:s.reduce((a,c)=>c.layer||a,void 0),sort:s.reduce((a,c)=>c.sort||a,void 0)};for(let a of this.config.postprocess)a(o);return o}constructCustomCSS(t,e,r){e=v(e);let{selector:s,entries:i,parent:o}=this.applyVariants([0,r||t.rawSelector,e,void 0,t.variantHandlers]),a=`${s}{${K(i)}}`;return o?`${o}{${a}}`:a}async parseUtil(t,e,r=!1){var u,x;let[s,i,o]=typeof t=="string"?this.matchVariants(t):t,a=this.config.rulesStaticMap[i];if(a&&a[1]&&(r||!((u=a[2])==null?void 0:u.internal)))return[[a[0],s,v(a[1]),a[2],o]];e.variantHandlers=o;let{rulesDynamic:c,rulesSize:f}=this.config;for(let l=f;l>=0;l--){let y=c[l];if(!y||((x=y[2])==null?void 0:x.internal)&&!r)continue;let[w,A,C]=y,p=i.match(w);if(!p)continue;let h=await A(p,e);if(!h)continue;if(typeof h=="string")return[[l,h,C]];let g=Q(h).filter(S=>S.length);if(g.length)return g.map(S=>[l,s,S,C,o])}}stringifyUtil(t){var l;if(!t)return;if(B(t))return[t[0],void 0,t[1],void 0,t[2]];let{selector:e,entries:r,parent:s,layer:i,sort:o}=this.applyVariants(t),a=K(r);if(!a)return;let y=(l=t[3])!=null?l:{},{layer:c,sort:f}=y,u=J(y,["layer","sort"]),x=M($({},u),{layer:i!=null?i:c,sort:o!=null?o:f});return[t[0],e,a,s,x]}expandShortcut(t,e,r=3){if(r===0)return;let s,i;for(let o of this.config.shortcuts)if(Y(o)){if(o[0]===t){s=s||o[2],i=o[1];break}}else{let a=t.match(o[0]);if(a&&(i=o[1](a,e)),i){s=s||o[2];break}}if(typeof i=="string"&&(i=nt(i).split(/\s+/g)),!!i)return[i.flatMap(o=>{var a;return((a=this.expandShortcut(o,e,r-1))==null?void 0:a[0])||[o]}).filter(o=>o!==""),s]}async stringifyShortcuts(t,e,r,s={layer:this.config.shortcutsLayer}){var f;let i=new G,o=(await Promise.all(k(r).map(async u=>{let x=await this.parseUtil(u,e,!0);return x||it(`unmatched utility "${u}" in shortcut "${t[1]}"`),x||[]}))).flat(1).filter(Boolean).sort((u,x)=>u[0]-x[0]),[a,,c]=t;for(let u of o){if(B(u))continue;let{selector:x,entries:l,parent:y,sort:w}=this.applyVariants(u,[...u[4],...c],a);i.getFallback(x,y,[[],u[0]])[0].push([l,!!((f=u[3])==null?void 0:f.noMerge),w!=null?w:0])}return i.map(([u,x],l,y)=>{let w=(C,p,h)=>{let g=Math.max(...h.map(R=>R[1])),S=h.map(R=>R[0]);return(C?[S.flat(1)]:S).map(R=>{let U=K(R);if(U)return[x,l,U,y,M($({},s),{noMerge:p,sort:g})]})};return[[u.filter(([,C])=>C).map(([C,,p])=>[C,p]),!0],[u.filter(([,C])=>!C).map(([C,,p])=>[C,p]),!1]].map(([C,p])=>[...w(!1,p,C.filter(([h])=>h.some(g=>g[0]===z))),...w(!0,p,C.filter(([h])=>h.every(g=>g[0]!==z)))])}).flat(2).filter(Boolean)}isBlocked(t){return!t||this.config.blocklist.some(e=>typeof e=="string"?e===t:e.test(t))}};function lt(n,t){return new ct(n,t)}var ut=/ \$\$ /,At=n=>n.match(ut);function $t(n,t){return At(n)?n.replace(ut,t?` ${t} `:" "):t?`${t} ${n}`:n}var at=/^\[(.+?)(~?=)"(.*)"\]$/;function Tt(n){return at.test(n)?n.replace(at,(t,e,r,s)=>`[${D(e)}${r}"${D(s)}"]`):`.${D(n)}`}var Ot=n=>n.replace(/-(\w)/g,(t,e)=>e?e.toUpperCase():""),ft=n=>n.charAt(0).toUpperCase()+n.slice(1),pt=n=>n.replace(/(?:^|\B)([A-Z])/g,"-$1").toLowerCase(),dt=["Webkit","Moz","ms"];function ht(n){let t={};function e(r){let s=t[r];if(s)return s;let i=Ot(r);if(i!=="filter"&&i in n)return t[r]=pt(i);i=ft(i);for(let o=0;o<dt.length;o++){let a=`${dt[o]}${i}`;if(a in n)return t[r]=pt(ft(a))}return r}return({entries:r})=>r.forEach(s=>{s[0].startsWith("--")||(s[0]=e(s[0]))})}function q(n={}){var R,U;if(typeof window>"u"){console.warn("@unocss/runtime been used in non-browser environment, skipped.");return}let t=window.__unocss||{},e=t==null?void 0:t.runtime,r=Object.assign(n.defaults||{},e);if(e==null?void 0:e.autoPrefix){let d=r.postprocess;d||(d=[]),Array.isArray(d)||(d=[d]),d.unshift(ht(document.createElement("div").style)),r.postprocess=d}(R=e==null?void 0:e.configResolved)==null||R.call(e,t,r);let s,i=!0,o,a=lt(t,r),c=new Set,f,u=[],x=()=>new Promise(d=>{u.push(d),f!=null&&clearTimeout(f),f=setTimeout(()=>l().then(()=>{let m=u;u=[],m.forEach(b=>b())}),0)});async function l(){let d=await a.generate(c);s||(s=document.createElement("style"),document.documentElement.prepend(s)),s.innerHTML=d.css}async function y(d){await a.applyExtractors(d,void 0,c),await x()}async function w(){let d=document.body&&document.body.outerHTML;d&&await y(d)}let A=new MutationObserver(d=>{i||d.forEach(m=>{let b=m.target;if(b===s||o&&!o(b))return;let T=Array.from(b.attributes).map(E=>E.value?`${E.name}="${E.value}"`:E.name).join(" "),O=`<${b.tagName.toLowerCase()} ${T}>`;y(O)})}),C=!1;function p(){if(!C)return;let d=document.documentElement||document.body;!d||(A.observe(d,{childList:!0,subtree:!0,attributes:!0}),C=!0)}function h(){w(),p()}function g(){h(),window.addEventListener("load",h),window.addEventListener("DOMContentLoaded",h)}let S=window.__unocss_runtime=window.__unocss_runtime={version:a.version,uno:a,async extract(d){if(typeof d=="string")return await y(d);d.forEach(m=>c.add(m)),await l()},extractAll:w,inspect(d){o=d},toggleObserver(d){d===void 0?i=!i:i=!!d,!C&&!i&&g()}};((U=e==null?void 0:e.ready)==null?void 0:U.call(e,S))!==!1&&(i=!1,g())}q();})();
1
+ (()=>{var ht=Object.defineProperty,mt=Object.defineProperties;var yt=Object.getOwnPropertyDescriptors;var j=Object.getOwnPropertySymbols;var N=Object.prototype.hasOwnProperty,Z=Object.prototype.propertyIsEnumerable;var W=(n,t,e)=>t in n?ht(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,$=(n,t)=>{for(var e in t||(t={}))N.call(t,e)&&W(n,e,t[e]);if(j)for(var e of j(t))Z.call(t,e)&&W(n,e,t[e]);return n},M=(n,t)=>mt(n,yt(t));var J=(n,t)=>{var e={};for(var r in n)N.call(n,r)&&t.indexOf(r)<0&&(e[r]=n[r]);if(n!=null&&j)for(var r of j(n))t.indexOf(r)<0&&Z.call(n,r)&&(e[r]=n[r]);return e};function St(n){let t=n.length,e=-1,r,s="",i=n.charCodeAt(0);for(;++e<t;){if(r=n.charCodeAt(e),r===0){s+="\uFFFD";continue}if(r===44){s+="\\2c ";continue}if(r>=1&&r<=31||r===127||e===0&&r>=48&&r<=57||e===1&&r>=48&&r<=57&&i===45){s+=`\\${r.toString(16)} `;continue}if(e===0&&t===1&&r===45){s+=`\\${n.charAt(e)}`;continue}if(r>=128||r===45||r===95||r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122){s+=n.charAt(e);continue}s+=`\\${n.charAt(e)}`}return s}var D=St;function v(n){return(Array.isArray(n)?n:Object.entries(n)).filter(t=>t[1]!=null)}function Q(n){return Array.isArray(n)?n.find(t=>!Array.isArray(t)||Array.isArray(t[0]))?n.map(t=>v(t)):[n]:[v(n)]}function xt(n){return n.filter(([t,e],r)=>{if(t.startsWith("$$"))return!1;for(let s=r-1;s>=0;s--)if(n[s][0]===t&&n[s][1]===e)return!1;return!0})}function K(n){return n==null?"":xt(n).map(([t,e])=>e!=null?`${t}:${e};`:void 0).filter(Boolean).join("")}function L(n){return n&&typeof n=="object"&&!Array.isArray(n)}function F(n,t){let e=n,r=t;if(Array.isArray(e)&&Array.isArray(r))return[...e,...r];if(Array.isArray(e))return[...e];let s=$({},e);return L(e)&&L(r)&&Object.keys(r).forEach(i=>{L(r[i])?i in e?s[i]=F(e[i],r[i]):Object.assign(s,{[i]:r[i]}):Object.assign(s,{[i]:r[i]})}),s}function V(n){let t,e,r;if(Array.isArray(n)){for(e=Array(t=n.length);t--;)e[t]=(r=n[t])&&typeof r=="object"?V(r):r;return e}if(Object.prototype.toString.call(n)==="[object Object]"){e={};for(t in n)t==="__proto__"?Object.defineProperty(e,t,{value:V(n[t]),configurable:!0,enumerable:!0,writable:!0}):e[t]=(r=n[t])&&typeof r=="object"?V(r):r;return e}return n}function X(n){return typeof n[0]=="string"}function Y(n){return typeof n[0]=="string"}function P(n=[]){return Array.isArray(n)?n:[n]}function k(n){return Array.from(new Set(n))}var Ct=/(?!\d|-{2}|-\d)[a-zA-Z0-9\u00A0-\uFFFF-_:%-?]/,z="$$shortcut-no-merge";function tt(n=""){return Ct.test(n)}function et(n){return typeof n=="function"?{match:n}:n}function B(n){return n.length===3}function rt(n){return n!=null}var G=class{_map=new Map;get(t,e){let r=this._map.get(t);if(r)return r.get(e)}getFallback(t,e,r){let s=this._map.get(t);return s||(s=new Map,this._map.set(t,s)),s.has(e)||s.set(e,r),s.get(e)}set(t,e,r){let s=this._map.get(t);return s||(s=new Map,this._map.set(t,s)),s.set(e,r),this}has(t,e){var r;return(r=this._map.get(t))==null?void 0:r.has(e)}delete(t,e){var r;return((r=this._map.get(t))==null?void 0:r.delete(e))||!1}deleteTop(t){return this._map.delete(t)}map(t){return Array.from(this._map.entries()).flatMap(([e,r])=>Array.from(r.entries()).map(([s,i])=>t(i,e,s)))}};var bt=/([!\w+:_/-]+?)([:-])\(((?:[!\w\s:/\\,%#.$-]|\[.*?\])*?)\)/gm;function nt(n){let t=[],e;for(;e=bt.exec(n);){let s=e.index,i=s+e[0].length,[,o,a,c]=e,f=c.split(/\s/g).map(u=>u.replace(/^(!?)(.*)/,`$1${o}${a}$2`)).join(" ");t.unshift([s,i,f])}let r=n;return t.forEach(([s,i,o])=>{r=r.slice(0,s)+o+r.slice(i)}),r}var st=new Set;function it(n){st.has(n)||(console.warn("[unocss]",n),st.add(n))}var Rt=n=>n.split(/[\s'"`;>=]+/g).filter(tt),H={name:"split",order:0,extract({code:n}){return new Set(Rt(n))}};function wt(n){return P(n).flatMap(t=>Array.isArray(t)?[t]:Object.entries(t))}var Ut={shortcuts:-1,default:0};function I(n={},t={}){let e=Object.assign({},t,n),r=(e.presets||[]).flatMap(P),s=[...r.filter(l=>l.enforce==="pre"),...r.filter(l=>!l.enforce),...r.filter(l=>l.enforce==="post")],i=Object.assign(Ut,...r.map(l=>l.layers),n.layers);function o(l){return k([...s.flatMap(y=>P(y[l]||[])),...P(e[l]||[])])}let a=o("extractors");a.length||a.push(H),a.sort((l,y)=>(l.order||0)-(y.order||0));let c=o("rules"),f={},u=c.length;c.forEach((l,y)=>{X(l)&&(f[l[0]]=[y,l[1],l[2]],delete c[y])});let x=V([...s.map(l=>l.theme||{}),e.theme||{}].reduce((l,y)=>F(l,y),{}));return o("extendTheme").forEach(l=>l(x)),M($({mergeSelectors:!0,warn:!0,blocklist:[],safelist:[],sortLayers:l=>l},e),{presets:s,envMode:e.envMode||"build",shortcutsLayer:e.shortcutsLayer||"shortcuts",layers:i,theme:x,rulesSize:u,rulesDynamic:c,rulesStaticMap:f,preprocess:o("preprocess"),postprocess:o("postprocess"),preflights:o("preflights"),variants:o("variants").map(et),shortcuts:wt(o("shortcuts")),extractors:a})}var ot="0.27.0";var ct=class{constructor(t={},e={}){this.userConfig=t;this.defaults=e;this.config=I(t,e)}version=ot;_cache=new Map;config;blocked=new Set;parentOrders=new Map;setConfig(t,e){!t||(e&&(this.defaults=e),this.userConfig=t,this.config=I(t,this.defaults),this.blocked.clear(),this.parentOrders.clear(),this._cache.clear())}async applyExtractors(t,e,r=new Set){let s={get original(){return t},code:t,id:e};for(let i of this.config.extractors){let o=await i.extract(s);o==null||o.forEach(a=>r.add(a))}return r}makeContext(t,e){let r={rawSelector:t,currentSelector:e[1],theme:this.config.theme,generator:this,variantHandlers:e[2],constructCSS:(...s)=>this.constructCustomCSS(r,...s),variantMatch:e};return r}async parseToken(t,e){var f;if(this.blocked.has(t))return;let r=`${t}${e?` ${e}`:""}`,s=this._cache.get(r);if(s)return s;let i=t;for(let u of this.config.preprocess)i=u(t);if(this.isBlocked(i)){this.blocked.add(t),this._cache.set(r,null);return}let o=this.matchVariants(t,i);if(!o||this.isBlocked(o[1])){this.blocked.add(t),this._cache.set(r,null);return}let a=this.makeContext(t,[e||o[0],o[1],o[2]]),c=this.expandShortcut(a.currentSelector,a);if(c){let u=await this.stringifyShortcuts(a.variantMatch,a,c[0],c[1]);if(u==null?void 0:u.length)return this._cache.set(r,u),u}else{let u=(f=await this.parseUtil(a.variantMatch,a))==null?void 0:f.map(x=>this.stringifyUtil(x)).filter(rt);if(u==null?void 0:u.length)return this._cache.set(r,u),u}this._cache.set(r,null)}async generate(t,{id:e,scope:r,preflights:s=!0,safelist:i=!0,minify:o=!1}={}){let a=typeof t=="string"?await this.applyExtractors(t,e):t;i&&this.config.safelist.forEach(p=>a.add(p));let c=o?"":`
2
+ `,f=new Set(["default"]),u=new Set,x=new Map;await Promise.all(Array.from(a).map(async p=>{var h;if(u.has(p))return;let g=await this.parseToken(p);if(g!=null){u.add(p);for(let S of g){let R=S[3]||"";x.has(R)||x.set(R,[]),x.get(R).push(S),((h=S[4])==null?void 0:h.layer)&&f.add(S[4].layer)}}})),s&&this.config.preflights.forEach(p=>{p.layer&&f.add(p.layer)});let l={},y=this.config.sortLayers(Array.from(f).sort((p,g)=>{var h,S;return((h=this.config.layers[p])!=null?h:0)-((S=this.config.layers[g])!=null?S:0)||p.localeCompare(g)})),w={};s&&(w=Object.fromEntries(await Promise.all(y.map(async p=>{let h=(await Promise.all(this.config.preflights.filter(S=>(S.layer||"default")===p).map(async S=>await S.getCSS()))).filter(Boolean).join(c);return[p,h]}))));let A=p=>{if(l[p])return l[p];let g=Array.from(x).sort((h,S)=>{var R,U,d;return((R=this.parentOrders.get(h[0]))!=null?R:0)-((U=this.parentOrders.get(S[0]))!=null?U:0)||((d=h[0])==null?void 0:d.localeCompare(S[0]||""))||0}).map(([h,S])=>{let R=S.length,U=S.filter(m=>{var b;return(((b=m[4])==null?void 0:b.layer)||"default")===p}).sort((m,b)=>{var T,O,E;return m[0]-b[0]||(((T=m[4])==null?void 0:T.sort)||0)-(((O=b[4])==null?void 0:O.sort)||0)||((E=m[1])==null?void 0:E.localeCompare(b[1]||""))||0}).map(m=>{var b;return[m[1]?$t(m[1],r):m[1],m[2],!!((b=m[4])==null?void 0:b.noMerge)]}).map(m=>[m[0]==null?m[0]:[m[0]],m[1],m[2]]);if(!U.length)return;let d=U.reverse().map(([m,b,T],O)=>{if(!T&&m&&this.config.mergeSelectors)for(let E=O+1;E<R;E++){let _=U[E];if(_&&!_[2]&&_[0]&&_[1]===b)return _[0].push(...m),null}return m?`${[...new Set(m)].join(`,${c}`)}{${b}}`:b}).filter(Boolean).reverse().join(c);return h?`${h}{${c}${d}${c}}`:d}).filter(Boolean).join(c);return s&&(g=[w[p],g].filter(Boolean).join(c)),l[p]=!o&&g?`/* layer: ${p} */${c}${g}`:g},C=(p=y,g)=>p.filter(h=>!(g==null?void 0:g.includes(h))).map(h=>A(h)||"").filter(Boolean).join(c);return{get css(){return C()},layers:y,getLayers:C,getLayer:A,matched:u}}matchVariants(t,e){let r=new Set,s=[],i=e||t,o=!1,a={rawSelector:t,theme:this.config.theme,generator:this};for(;;){o=!1;for(let c of this.config.variants){if(!c.multiPass&&r.has(c))continue;let f=c.match(i,a);if(!!f&&(typeof f=="string"&&(f={matcher:f}),f)){i=f.matcher,Array.isArray(f.parent)&&this.parentOrders.set(f.parent[0],f.parent[1]),s.push(f),r.add(c),o=!0;break}}if(!o)break;if(s.length>500)throw new Error(`Too many variants applied to "${t}"`)}return[t,i,s]}applyVariants(t,e=t[4],r=t[1]){let s=[...e].sort((a,c)=>(a.order||0)-(c.order||0)),i=s.reduce((a,c)=>{var f;return((f=c.body)==null?void 0:f.call(c,a))||a},t[2]),o={selector:s.reduce((a,c)=>{var f;return((f=c.selector)==null?void 0:f.call(c,a,i))||a},Tt(r)),entries:i,parent:s.reduce((a,c)=>Array.isArray(c.parent)?c.parent[0]:c.parent||a,void 0),layer:s.reduce((a,c)=>c.layer||a,void 0),sort:s.reduce((a,c)=>c.sort||a,void 0)};for(let a of this.config.postprocess)a(o);return o}constructCustomCSS(t,e,r){e=v(e);let{selector:s,entries:i,parent:o}=this.applyVariants([0,r||t.rawSelector,e,void 0,t.variantHandlers]),a=`${s}{${K(i)}}`;return o?`${o}{${a}}`:a}async parseUtil(t,e,r=!1){var u,x;let[s,i,o]=typeof t=="string"?this.matchVariants(t):t,a=this.config.rulesStaticMap[i];if(a&&a[1]&&(r||!((u=a[2])==null?void 0:u.internal)))return[[a[0],s,v(a[1]),a[2],o]];e.variantHandlers=o;let{rulesDynamic:c,rulesSize:f}=this.config;for(let l=f;l>=0;l--){let y=c[l];if(!y||((x=y[2])==null?void 0:x.internal)&&!r)continue;let[w,A,C]=y,p=i.match(w);if(!p)continue;let g=await A(p,e);if(!g)continue;if(typeof g=="string")return[[l,g,C]];let h=Q(g).filter(S=>S.length);if(h.length)return h.map(S=>[l,s,S,C,o])}}stringifyUtil(t){var l;if(!t)return;if(B(t))return[t[0],void 0,t[1],void 0,t[2]];let{selector:e,entries:r,parent:s,layer:i,sort:o}=this.applyVariants(t),a=K(r);if(!a)return;let y=(l=t[3])!=null?l:{},{layer:c,sort:f}=y,u=J(y,["layer","sort"]),x=M($({},u),{layer:i!=null?i:c,sort:o!=null?o:f});return[t[0],e,a,s,x]}expandShortcut(t,e,r=3){if(r===0)return;let s,i;for(let o of this.config.shortcuts)if(Y(o)){if(o[0]===t){s=s||o[2],i=o[1];break}}else{let a=t.match(o[0]);if(a&&(i=o[1](a,e)),i){s=s||o[2];break}}if(typeof i=="string"&&(i=nt(i).split(/\s+/g)),!!i)return[i.flatMap(o=>{var a;return((a=this.expandShortcut(o,e,r-1))==null?void 0:a[0])||[o]}).filter(o=>o!==""),s]}async stringifyShortcuts(t,e,r,s={layer:this.config.shortcutsLayer}){var f;let i=new G,o=(await Promise.all(k(r).map(async u=>{let x=await this.parseUtil(u,e,!0);return x||it(`unmatched utility "${u}" in shortcut "${t[1]}"`),x||[]}))).flat(1).filter(Boolean).sort((u,x)=>u[0]-x[0]),[a,,c]=t;for(let u of o){if(B(u))continue;let{selector:x,entries:l,parent:y,sort:w}=this.applyVariants(u,[...u[4],...c],a);i.getFallback(x,y,[[],u[0]])[0].push([l,!!((f=u[3])==null?void 0:f.noMerge),w!=null?w:0])}return i.map(([u,x],l,y)=>{let w=(C,p,g)=>{let h=Math.max(...g.map(R=>R[1])),S=g.map(R=>R[0]);return(C?[S.flat(1)]:S).map(R=>{let U=K(R);if(U)return[x,l,U,y,M($({},s),{noMerge:p,sort:h})]})};return[[u.filter(([,C])=>C).map(([C,,p])=>[C,p]),!0],[u.filter(([,C])=>!C).map(([C,,p])=>[C,p]),!1]].map(([C,p])=>[...w(!1,p,C.filter(([g])=>g.some(h=>h[0]===z))),...w(!0,p,C.filter(([g])=>g.every(h=>h[0]!==z)))])}).flat(2).filter(Boolean)}isBlocked(t){return!t||this.config.blocklist.some(e=>typeof e=="string"?e===t:e.test(t))}};function lt(n,t){return new ct(n,t)}var ut=/ \$\$ /,At=n=>n.match(ut);function $t(n,t){return At(n)?n.replace(ut,t?` ${t} `:" "):t?`${t} ${n}`:n}var at=/^\[(.+?)(~?=)"(.*)"\]$/;function Tt(n){return at.test(n)?n.replace(at,(t,e,r,s)=>`[${D(e)}${r}"${D(s)}"]`):`.${D(n)}`}var Ot=n=>n.replace(/-(\w)/g,(t,e)=>e?e.toUpperCase():""),ft=n=>n.charAt(0).toUpperCase()+n.slice(1),pt=n=>n.replace(/(?:^|\B)([A-Z])/g,"-$1").toLowerCase(),dt=["Webkit","Moz","ms"];function gt(n){let t={};function e(r){let s=t[r];if(s)return s;let i=Ot(r);if(i!=="filter"&&i in n)return t[r]=pt(i);i=ft(i);for(let o=0;o<dt.length;o++){let a=`${dt[o]}${i}`;if(a in n)return t[r]=pt(ft(a))}return r}return({entries:r})=>r.forEach(s=>{s[0].startsWith("--")||(s[0]=e(s[0]))})}function q(n={}){var R,U;if(typeof window>"u"){console.warn("@unocss/runtime been used in non-browser environment, skipped.");return}let t=window.__unocss||{},e=t==null?void 0:t.runtime,r=Object.assign(n.defaults||{},e);if(e==null?void 0:e.autoPrefix){let d=r.postprocess;d||(d=[]),Array.isArray(d)||(d=[d]),d.unshift(gt(document.createElement("div").style)),r.postprocess=d}(R=e==null?void 0:e.configResolved)==null||R.call(e,t,r);let s,i=!0,o,a=lt(t,r),c=new Set,f,u=[],x=()=>new Promise(d=>{u.push(d),f!=null&&clearTimeout(f),f=setTimeout(()=>l().then(()=>{let m=u;u=[],m.forEach(b=>b())}),0)});async function l(){let d=await a.generate(c);s||(s=document.createElement("style"),document.documentElement.prepend(s)),s.innerHTML=d.css}async function y(d){await a.applyExtractors(d,void 0,c),await x()}async function w(){let d=document.body&&document.body.outerHTML;d&&await y(d)}let A=new MutationObserver(d=>{i||d.forEach(m=>{let b=m.target;if(b===s||o&&!o(b))return;let T=Array.from(b.attributes).map(E=>E.value?`${E.name}="${E.value}"`:E.name).join(" "),O=`<${b.tagName.toLowerCase()} ${T}>`;y(O)})}),C=!1;function p(){if(!C)return;let d=document.documentElement||document.body;!d||(A.observe(d,{childList:!0,subtree:!0,attributes:!0}),C=!0)}function g(){w(),p()}function h(){g(),window.addEventListener("load",g),window.addEventListener("DOMContentLoaded",g)}let S=window.__unocss_runtime=window.__unocss_runtime={version:a.version,uno:a,async extract(d){if(typeof d=="string")return await y(d);d.forEach(m=>c.add(m)),await l()},extractAll:w,inspect(d){o=d},toggleObserver(d){d===void 0?i=!i:i=!!d,!C&&!i&&h()}};((U=e==null?void 0:e.ready)==null?void 0:U.call(e,S))!==!1&&(i=!1,h())}q();})();