astro-ghostcms/.pnpm-store/v3/files/97/2bd45144421730c6c57f8fa9864...

2 lines
6.1 KiB
Plaintext

import{s as U,t as N,d as W,x as Z,y as q,r as R,u as G,z as H,A as K,B as J,h as s,c as P,g as A,w as k,q as I,C as z,_ as L,D as Q,o as S,e as f,k as w,E as C,i as M,F as B,n as F,j as X,v as Y,M as ee,G as te,H as re,m as le,l as se,I as ne}from"./index-44yCo4Ah.js";const j=/^(?!.*\[(?:[^:]+):(?:.+)\]$)((?:.+:)?!?)?(.*)$/;function ae(e={}){const m=e.prefix??"un-",r=e.prefixedOnly??!1,v=e.trueToNonValued??!1;let c;return{name:"attributify",match(n,{generator:b}){var h,a;const o=U(n);if(!o)return;let t=o[1];if(t.startsWith(m))t=t.slice(m.length);else if(r)return;const i=o[2],[,_="",x=i]=i.match(j)||[];if(x==="~"||v&&x==="true"||!x)return`${_}${t}`;if(c==null){const l=(a=(h=b==null?void 0:b.config)==null?void 0:h.separators)==null?void 0:a.join("|");l?c=new RegExp(`^(.*\\](?:${l}))(\\[[^\\]]+?\\])$`):c=!1}if(c){const[,l,u]=i.match(c)||[];if(u)return`${l}${_}${t}-${u}`}return`${_}${t}-${x}`}}}const ce=/(<\w[\w:\.$-]*\s)((?:'[^>]*?'|"[^>]*?"|`[^>]*?`|\{[^>]*?\}|[^>]*?)*)/g,oe=/([?]|(?!\d|-{2}|-\d)[a-zA-Z0-9\u00A0-\uFFFF-_:%-]+)(?:=("[^"]*|'[^']*))?/g,O=/[\s'"`;>]+/;function ie(e){return{name:"attributify",extract:({content:m,cursor:r})=>{const v=m.matchAll(ce);let c,n=0;for(const d of v){const[,y,g]=d,$=d.index+y.length;if(r>$&&r<=$+g.length){n=$,c=g;break}}if(!c)return null;const b=c.matchAll(oe);let o=0,t,i;for(const d of b){const[y,g,$]=d,E=n+d.index;if(r>E&&r<=E+y.length){o=E,t=g,i=$==null?void 0:$.slice(1);break}}if(!t||t==="class"||t==="className"||t===":class")return null;const _=!!(e!=null&&e.prefix)&&t.startsWith(e.prefix);if(e!=null&&e.prefixedOnly&&!_)return null;const x=_?t.slice(e.prefix.length):t;if(i===void 0)return{extracted:x,resolveReplacement(d){const y=_?e.prefix.length:0;return{start:o+y,end:o+t.length,replacement:d}}};const h=o+t.length+2;let a=O.exec(i),l=0,u;for(;a;){const[d]=a;if(r>h+l&&r<=h+l+a.index){u=i.slice(l,l+a.index);break}l+=a.index+d.length,a=O.exec(i.slice(l))}u===void 0&&(u=i.slice(l));const[,p="",V]=u.match(j)||[];return{extracted:`${p}${x}-${V}`,transformSuggestions(d){return d.filter(y=>y.startsWith(`${p}${x}-`)).map(y=>p+y.slice(p.length+x.length+1))},resolveReplacement(d){return{start:l+h,end:l+h+u.length,replacement:p+d.slice(p.length+x.length+1)}}}}}}const ue=["v-bind:",":"],T=/[\s'"`;]+/g,de=/<[^>\s]*\s((?:'.*?'|".*?"|`.*?`|\{.*?\}|[^>]*?)*)/g,fe=/([?]|(?!\d|-{2}|-\d)[a-zA-Z0-9\u00A0-\uFFFF-_:!%-.~<]+)=?(?:["]([^"]*)["]|[']([^']*)[']|[{]([^}]*)[}])?/gms,D=["placeholder","fill","opacity","stroke-opacity"];function me(e){const m=(e==null?void 0:e.ignoreAttributes)??D,r=(e==null?void 0:e.nonValuedAttribute)??!0,v=(e==null?void 0:e.trueToNonValued)??!1;return{name:"@unocss/preset-attributify/extractor",extract({code:c}){return Array.from(c.matchAll(de)).flatMap(n=>Array.from((n[1]||"").matchAll(fe))).flatMap(([,n,...b])=>{const o=b.filter(Boolean).join("");if(m.includes(n))return[];for(const t of ue)if(n.startsWith(t)){n=n.slice(t.length);break}if(!o){if(N(n)&&r!==!1){const t=[`[${n}=""]`];return v&&t.push(`[${n}="true"]`),t}return[]}return["class","className"].includes(n)?o.split(T).filter(N):e!=null&&e.prefixedOnly&&e.prefix&&!n.startsWith(e.prefix)?[]:o.split(T).filter(t=>!!t&&t!==":").map(t=>`[${n}~="${t}"]`)})}}}const he=(e={})=>{e.strict=e.strict??!1,e.prefix=e.prefix??"un-",e.prefixedOnly=e.prefixedOnly??!1,e.nonValuedAttribute=e.nonValuedAttribute??!0,e.ignoreAttributes=e.ignoreAttributes??D;const m=[ae(e)],r=[me(e)],v=[ie(e)];return{name:"@unocss/preset-attributify",enforce:"post",variants:m,extractors:r,options:e,autocomplete:{extractors:v},extractorDefault:e.strict?!1:void 0}},_e={key:0,"h-full":"","of-hidden":"",flex:"","flex-col":""},xe={p:"4",grid:"~ cols-4 gap-4"},pe=f("div",{op50:""}," Module ",-1),ye=f("div",{"i-carbon-launch":""},null,-1),ve=f("div",{op50:""}," Matched Rules ",-1),be=f("div",{op50:""}," CSS Size ",-1),ge=f("span",{op50:""},"gzipped",-1),$e={key:0,"row-span-3":""},Ae=f("div",{op50:""}," Potentially Unmatched ",-1),Ve={key:0,"h-full":"","of-hidden":""},ke=W({__name:"ModuleInfo",props:{id:{}},setup(e){const m=e,{data:r}=Z(q(m,"id")),v=m.id.split(/\./g).pop(),c=R(null),n=G(c,"module-scrolls");function b(){fetch(`/__open-in-editor?file=${encodeURIComponent(m.id)}`)}const{extractors:o}=he({strict:!0}),t=H(async()=>{var a;const h=new Set;if(o){const l={code:((a=r.value)==null?void 0:a.code)||""};for(const u of o){const p=await u.extract(l);p==null||p.forEach(V=>h.add(V))}}return Array.from(h).filter(l=>!l.startsWith("[")).filter(l=>{var u;return!((u=r.value)!=null&&u.matched.includes(l))})}),i=R(!1),_=R("source"),x=K(J(()=>{var h;return(h=r.value)==null?void 0:h.css}),i);return(h,a)=>{const l=te,u=re,p=L,V=le,d=se,y=Q;return s(r)?(S(),P("div",_e,[A(p,{ref_key:"status",ref:c,p0:""},{default:k(()=>{var g;return[f("div",xe,[f("div",null,[pe,f("a",{"cursor-pointer":"",op80:"","hover:op100":"",onClick:b},[A(l,{id:s(r).id,"mr-1":""},null,8,["id"]),ye])]),f("div",null,[ve,w(" "+C(s(r).matched.length),1)]),f("div",null,[be,w(" "+C(((((g=s(r))==null?void 0:g.gzipSize)||0)/1024).toFixed(2))+" KiB ",1),ge]),s(t).length?(S(),P("div",$e,[Ae,f("code",null,C(s(t).join(", ")),1)])):z("",!0)]),A(u,{modelValue:s(_),"onUpdate:modelValue":a[0]||(a[0]=$=>M(_)?_.value=$:null)},null,8,["modelValue"])]}),_:1},512),s(_)==="source"?(S(),P("div",Ve,[A(s(ee),null,{default:k(()=>[A(s(B),{size:"50"},{default:k(()=>[A(V,{"h-full":"","model-value":s(r).code,"read-only":!0,mode:s(v),matched:s(r).matched,class:"scrolls module-scrolls",style:F(s(n))},null,8,["model-value","mode","matched","style"])]),_:1}),A(s(B),{size:"50"},{default:k(()=>[f("div",null,[A(d,{border:"l b gray-400/20",title:"Output CSS"},{default:k(()=>[f("label",null,[X(f("input",{"onUpdate:modelValue":a[1]||(a[1]=g=>M(i)?i.value=g:null),type:"checkbox"},null,512),[[Y,s(i)]]),w(" Prettify ")])]),_:1}),A(V,{"h-full":"",border:"l main","model-value":s(x),"read-only":!0,mode:"css",class:"scrolls module-scrolls",style:F(s(n))},null,8,["model-value","style"])])]),_:1})]),_:1})])):(S(),I(y,{key:1,"flex-grow":"","overflow-y-auto":"",selectors:s(r).matched,colors:s(r).colors},null,8,["selectors","colors"]))])):z("",!0)}}}),Ee=W({__name:"[id]",setup(e){const m=ne();return(r,v)=>{const c=ke;return S(),I(c,{id:s(m).params.id},null,8,["id"])}}});export{Ee as default};