@unocss/runtime 0.37.4 → 0.38.2

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