@gruum/cli 0.1.1 → 0.1.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/gruum.mjs +91 -60
- package/package.json +1 -1
package/gruum.mjs
CHANGED
|
@@ -1,56 +1,85 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{chmodSync as bl,existsSync as pt,rmSync as pn}from"node:fs";import P from"node:path";import{createInterface as xl}from"node:readline";var jr=["style.new","state.changed","state.missing","token.unknown","value.hardcoded","native.element","style.removed","guidance.rule"],ht={"style.new":"block","state.changed":"block","state.missing":"block","token.unknown":"block","value.hardcoded":"block","native.element":"block","style.removed":"warn","guidance.rule":"warn"};function bt(e){let t=0;for(let n=0;n<e.length;n++)t=t*33+e.charCodeAt(n)>>>0;return t.toString(36)}function hn(e){let t=`${e.path}::${e.selector}`;return`v2-style-${t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,48)}-${bt(t)}`}function te(e){return e.context?`${e.state} @ ${e.context}`:e.state}var Dr=/var\(\s*(--[\w-]+)/g;function Or(e){let t=new Set;for(let n of e)for(let s of n.declarations)for(let r of s.value.matchAll(Dr))t.add(r[1]);return[...t].sort()}function Tr(e){let t=new Map;for(let n of e)t.set(n.property,n.value.trim());return[...t].map(([n,s])=>({property:n,value:s})).sort((n,s)=>n.property.localeCompare(s.property))}function Nr(e){let t=new Map;for(let n of e){let s=te(n),r=t.get(s),o=Tr([...r?.declarations??[],...n.declarations]);t.set(s,{state:n.state,context:n.context,declarations:o})}return[...t.values()]}function xn(e){let t=new Map,n=(s,r,o)=>{let i=hn(s),a=t.get(i),l=Nr([...a?Pr(a.states):[],...r]),c=a?.stateLines??new Map;for(let u of r)c.has(te(u))||c.set(te(u),u.line);t.set(i,{...a??s,id:i,states:l,tokens:Or(l),line:a?.line??o,stateLines:c})};for(let s of e){let r=hn(s);n({kind:"look",title:s.title,selector:s.selector,path:s.path,axis:s.axis,...s.usage.via?{selectedBy:s.usage.via}:{},...s.element?{element:s.element.tag}:{}},s.states,s.line);for(let o of s.modifiers??[])n({kind:"modifier",title:`${s.title} \xB7 ${o.title}`,selector:o.selector,path:o.path,hostId:r,...o.usage.via?{selectedBy:o.usage.via}:{},...o.element?{element:o.element.tag}:{}},o.states,o.line);for(let o of s.contexts??[])n({kind:"context",title:`${s.title} in ${o.selector}`,selector:o.selector,path:o.path,hostId:r,role:o.role,...o.element?{element:o.element.tag}:{}},o.states,o.line)}return t}function Pr(e){return e.map(t=>({state:t.state,context:t.context,line:0,declarations:t.declarations}))}function Vr(e){let t=new Map,n=/^:root\{([^}]*)\}/.exec(e);if(!n)return t;for(let s of n[1].split(";")){let r=s.indexOf(":");if(r<=0)continue;let o=s.slice(0,r).trim();o.startsWith("--")&&t.set(o,s.slice(r+1).trim())}return t}var bn=/^(\d+) native /;function Fr(e,t){if(e==="native")return`native:${t.refs[0]?.path??""}`;if(t.styles?.length){let n=[...new Set(t.refs.map(s=>s.path))].sort().join(",");return`${e}:${[...t.styles].sort().join(",")}:${n}`}return`${e}:${t.refs.map(n=>n.path).join(",")}:${t.message}`}var gt={hardcoded:"value.hardcoded",native:"native.element"};function yn(e){let t=[];for(let n of e.audit)if(n.status==="attention")for(let s of n.findings)t.push({check:n.id,finding:s,key:Fr(n.id,s)});return t}function dt(e){return`${e.path}#${bt(e.text.replace(/\s+/g," ").trim())}`}function wn(e,t={}){let n=Vr(e.previewCss),s=[...xn(e.variants).values()].map(({line:o,stateLines:i,...a})=>a),r=[];for(let o of e.guidance.files)if(o.kind!=="record")for(let i of o.passages)i.rule&&r.push({path:i.path,headings:i.headings,text:i.text,styles:i.styles});return{schema:1,concept:e.concept,label:e.label,version:t.version??0,sourceRef:e.repo.ref,publishedAt:t.publishedAt??null,components:[...e.components].sort(),tokens:e.tokens.map(o=>{let i=n.get(o.name);return i===void 0?{name:o.name}:{name:o.name,value:i}}).sort((o,i)=>o.name.localeCompare(i.name)),styles:s,rules:r,content:e.content.map(o=>o.id),acceptedFindings:yn(e).filter(({check:o})=>o in gt).map(({check:o,finding:i,key:a})=>({check:o,key:a,message:i.message})),settings:{severity:{...ht,...t.settings?.severity??{}}}}}function Br(e,t){let n=new Map(e.map(o=>[o.property,o.value])),s=new Map(t.map(o=>[o.property,o.value])),r=[];for(let[o,i]of s){let a=n.get(o);a===void 0?r.push(`added ${o}: ${i}`):a!==i&&r.push(`${o}: ${a} \u2192 ${i}`)}for(let[o,i]of n)s.has(o)||r.push(`removed ${o}: ${i}`);return r}function mt(e){return e.map(t=>`${t.property}: ${t.value}`).join("; ")}function zr(e,t){return e.length>t?`${e.slice(0,t).join(", ")}, and ${e.length-t} more`:e.join(", ")}function Wr(e,t){let n=e.replace(/^--/,"").split("-")[0]??"",s=n?t.filter(r=>r.startsWith(`--${n}`)):[];return(s.length?s:t).slice(0,3)}function kn(e,t){let n={...ht,...t.settings.severity},s=[],r=(d,y="")=>{s.push({id:`${d.kind}:${bt(`${d.styleId??""}|${d.state??""}|${y}`)}`,severity:n[d.kind],...d})},o=xn(e.variants),i=new Map(t.styles.map(d=>[d.id,d])),a=t.styles.filter(d=>d.kind==="look"),l=new Set(t.tokens.map(d=>d.name)),c=[...l];for(let d of o.values()){if(i.has(d.id))continue;let y=d.hostId?i.get(d.hostId):void 0,k=a.filter(m=>m.path===d.path),p=(k.length?k:a).map(m=>m.selector);r({kind:"style.new",styleId:d.id,title:`${d.title} is not in the spec`,baseline:null,observed:{declarations:d.states[0]?.declarations??[]},refs:[{path:d.path,line:d.line}],fix:`${d.selector} is not in the spec; ${y?`restyle ${y.selector} only through spec modifiers`:p.length?`use ${zr(p,3)},`:"use a spec style,"} or ask for an exception.`},d.selector)}for(let d of o.values()){let y=i.get(d.id);if(!y)continue;let k=new Map(y.states.map(p=>[te(p),p]));for(let p of d.states){let m=te(p),g=k.get(m),w=Br(g?.declarations??[],p.declarations);w.length!==0&&r({kind:"state.changed",styleId:d.id,title:g?`${d.title}: ${m} changed`:`${d.title}: new ${m} state`,state:m,baseline:g?{declarations:g.declarations}:null,observed:{declarations:p.declarations},refs:[{path:d.path,line:d.stateLines.get(m)??d.line}],fix:g?`Restore ${d.selector} ${m} to the spec (${w.slice(0,3).join("; ")}), or ask for an exception.`:`${m} is not a spec state of ${d.selector}; remove it, or ask for an exception.`},mt(p.declarations))}}for(let d of o.values()){let y=i.get(d.id);if(!y)continue;let k=new Set(d.states.map(te));for(let p of y.states){let m=te(p);k.has(m)||r({kind:"state.missing",styleId:d.id,title:`${d.title}: ${m} state is missing`,state:m,baseline:{declarations:p.declarations},observed:null,refs:[{path:d.path,line:d.line}],fix:`Define ${d.selector} ${m} again: ${mt(p.declarations)||"as in the spec"}.`})}}for(let d of o.values())for(let y of d.tokens){if(l.has(y))continue;let k=Wr(y,c);r({kind:"token.unknown",styleId:d.id,title:`${d.title} reads ${y}, which is not a spec token`,baseline:null,observed:{token:y},refs:[{path:d.path,line:d.line}],fix:k.length?`Use a spec token such as ${k.join(", ")} instead of ${y}, or ask for an exception.`:`${y} is not a spec token; ask for an exception to add it.`},y)}let u=new Map;for(let d of t.acceptedFindings)u.set(d.key,[...u.get(d.key)??[],d]);let f=yn(e).filter(({check:d})=>d in gt);for(let d of["value.hardcoded","native.element"])for(let{check:y,finding:k,key:p}of f){if(gt[y]!==d)continue;let m=u.get(p)??[];if(m.some(v=>!Gr(y,v.message,k.message)))continue;let g=m[0],w=k.styles?.[0],$=w?[...o.values()].find(v=>v.title===w):void 0;r({kind:d,styleId:$?.id??null,title:k.message,baseline:g?{message:g.message}:null,observed:{message:k.message,...d==="native.element"?{element:"button"}:{}},refs:k.refs.map(({path:v,line:C})=>({path:v,line:C})),fix:d==="value.hardcoded"?"Replace each literal with the spec token named, or with a spec token for that property.":`Render ${t.components[0]??"the shared component"} instead of a raw <button>, or ask for an exception.`},p)}for(let d of t.styles)o.has(d.id)||r({kind:"style.removed",styleId:d.id,title:`${d.title} is in the spec but no longer in CSS`,baseline:{declarations:d.states[0]?.declarations??[]},observed:null,refs:[{path:d.path,line:0}],fix:`Restore ${d.selector} in ${d.path}, or ask the designer to retire it from the spec.`});let b=new Map(e.guidance.files.map(d=>[d.path,d])),x=new Set;for(let d of e.guidance.files)for(let y of d.passages)y.rule&&x.add(dt(y));for(let d of t.rules){if(x.has(dt(d)))continue;let y=b.get(d.path);y&&y.total>y.passages.length||r({kind:"guidance.rule",styleId:null,title:`A written rule in ${d.path} changed or was removed`,baseline:{text:d.text},observed:null,refs:[{path:d.path,line:0}],fix:`Restore the rule under ${d.headings.join(" \u203A ")||d.path}, or publish a new spec.`},dt(d))}return s}function Gr(e,t,n){if(t===n)return!1;if(e==="native"){let s=bn.exec(t)?.[1],r=bn.exec(n)?.[1];if(s&&r)return Number(r)>Number(s)}return!0}function vn(e){return e.filter(t=>t.severity==="block")}var Ur={product:"Gruum button spec",what:"The designer-published spec for this repository's buttons. Write buttons against it; drift from it is checked deterministically.",howToUse:["Use the components listed in `components`; do not render a raw <button> where a component exists.","Pick a look from `looks`. `selectedBy` says which prop or attribute value selects it.","Use only the tokens listed in `tokens`. Do not write a literal color or size a token already has.","Follow `rules`; they are the repository's written rules, quoted.","Do not add a look, modifier, or state, and do not change a state's declarations.","If the spec has no button for the job, ask for an exception with a reason instead of inventing one. Never edit generated Gruum files to make a check pass."]};function xt(e){let t=(n,s)=>e.styles.filter(r=>r.hostId===n&&r.kind===s).map(r=>r.selector);return{about:{...Ur,drift:jr.map(n=>({kind:n,severity:e.settings.severity[n]??ht[n]}))},spec:{concept:e.concept,version:e.version,sourceRef:e.sourceRef,components:e.components,looks:e.styles.filter(n=>n.kind==="look").map(n=>({title:n.title,selector:n.selector,path:n.path,...n.selectedBy?{selectedBy:n.selectedBy}:{},tokens:n.tokens,states:Object.fromEntries(n.states.map(s=>[te(s),mt(s.declarations)])),modifiers:t(n.id,"modifier"),contexts:t(n.id,"context")})),tokens:e.tokens,rules:e.rules.map(n=>({path:n.path,under:n.headings.join(" \u203A "),text:n.text}))}}}function $n(e){if(!e||typeof e!="object")return null;let t=e;return t.schema!==1||typeof t.concept!="string"||!Array.isArray(t.styles)||!Array.isArray(t.tokens)||!Array.isArray(t.acceptedFindings)||!Array.isArray(t.rules)||!t.settings?.severity?null:t}function Hr(e){let t=new Map;for(let n of e){let s=n.refs[0]?.path??"(no file)";t.set(s,[...t.get(s)??[],n])}return[...t].sort(([n],[s])=>n.localeCompare(s))}function yt(e,t){if(t.length===0)return e;let n=new Set(t.map(s=>s.replace(/^\.\//,"")));return e.filter(s=>s.refs.some(r=>n.has(r.path)))}function Cn(e,t,n={}){let s=[];if(e.length===0)return s.push(`No drift against spec v${t.baselineVersion} (${t.files} files indexed, ${t.skipped} skipped).`),s.join(`
|
|
3
|
-
`);for(let[o,i]of
|
|
4
|
-
`)}function
|
|
5
|
-
`)}function
|
|
6
|
-
${
|
|
2
|
+
import{chmodSync as ec,existsSync as _e,rmSync as En}from"node:fs";import N from"node:path";import{createInterface as nc}from"node:readline";var oo=new Set(["display","position","inset","top","right","bottom","left","z-index","order","flex","flex-grow","flex-shrink","flex-basis","align-self","justify-self","align-items","justify-content","place-items","place-content","gap","text-align","min-width","max-width","overflow","white-space","cursor"]),io=new Set(["page","index","layout","route","default"]);function ao(t){return oo.has(t.property)||/^(margin|transition|grid-)/.test(t.property)?!0:(t.property==="width"||t.property==="height")&&/^(100%|auto)$/.test(t.value)}function Lt(t){return t.flatMap(e=>e.declarations.filter(n=>!ao(n)).map(n=>`${e.state}|${e.context}|${n.property}:${n.value}`)).sort().join(";")}function lo(t){return Lt(t.states)}function co(t){return t.states.filter(e=>e.state==="default"&&e.context==="").flatMap(e=>e.declarations)}function On(t){return t.charAt(0).toUpperCase()+t.slice(1)}function uo(t){let e=t.via?/^bg-([\w-]+?)(?:\/(\d+))?$/.exec(t.via):null;if(e){let s=e[1].replace(/-/g," ");return On(e[2]?`${s} ${e[2]}%`:s)}let n=/var\(\s*--(?:color-)?([\w-]+)/.exec(t.value)?.[1];return On((n??t.value).replace(/-/g," "))}function po(t){let e=co(t),n=u=>e.findLast(f=>f.property===u),s=n("background-color")??n("background"),r=s!==void 0&&!/^(transparent|none|initial|inherit)\b/.test(s.value),o=n("border-width")?.value,i=o!==void 0&&!/^0(px)?$/.test(o)&&n("border-style")?.value!=="none",a=n("width")?.value,l=a!==void 0&&a===n("height")?.value&&!/^(auto|100%|fit-content)$/.test(a);return n("inset")?.value==="0"?"Overlay":i?l?"Outline icon":"Outline":r?`${uo(s)} ${l?"icon":"fill"}`:l?"Icon":e.some(u=>u.property.startsWith("padding")||u.property==="border-radius"||u.property==="height"&&u.value!=="auto")?"Ghost":"Text"}function fo(t){let e=t.split("/"),n=(e.pop()??t).replace(/\.[^.]+$/,""),s=e.pop();return io.has(n)&&s?`${s}/${n}`:n}function go(t){let e=[...new Set(t.map(s=>fo(s.path)))],n=e.slice(0,2).join(", ");return e.length>2?`${n} +${e.length-2}`:n}var Ln=(t,e)=>t.path.localeCompare(e.path)||t.line-e.line;function Pn(t){let e=new Map;for(let r of t){let o=po(r.variant),i=e.get(o)??new Map,a=lo(r.variant),l=i.get(a)??{looks:[],sites:[]};l.looks.push(r.variant),l.sites.push(...r.sites),i.set(a,l),e.set(o,i)}let n=[],s=new Map;for(let[r,o]of e){let i=[...o.values()];for(let y of i)y.sites.sort(Ln);i.sort((y,$)=>$.sites.length-y.sites.length||Ln(y.sites[0],$.sites[0]));let[a,...l]=i,c=a.looks[0],u=l.map(y=>go(y.sites)),f=l.map((y,$)=>{let C=y.looks[0],g={title:u.filter(p=>p===u[$]).length>1?`${u[$]} \xB7 line ${y.sites[0].line}`:u[$],selector:C.selector,path:y.sites[0].path,line:y.sites[0].line,element:C.element,usage:C.usage,states:C.states,alike:!0};return s.set(g,y.sites),g}),m={...c,title:r,axis:null,base:!1,path:a.sites[0].path,line:a.sites[0].line,markup:!0,...f.length?{modifiers:f}:{}};s.set(m,a.sites),n.push(m)}return{variants:n,sites:s}}var Vn=1,Bn=["style.new","state.changed","state.missing","token.unknown","value.hardcoded","native.element","prop.unknown","style.removed","guidance.rule"],Me={"style.new":"block","state.changed":"block","state.missing":"block","token.unknown":"block","value.hardcoded":"block","native.element":"block","prop.unknown":"block","style.removed":"warn","guidance.rule":"warn"};function De(t){let e=0;for(let n=0;n<t.length;n++)e=e*33+t.charCodeAt(n)>>>0;return e.toString(36)}function Tn(t){let e=`${t.path}::${t.selector}`;return`v2-style-${e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,48)}-${De(e)}`}function st(t){return t.context?`${t.state} @ ${t.context}`:t.state}var mo=/var\(\s*(--[\w-]+)/g;function ho(t){let e=new Set;for(let n of t)for(let s of n.declarations)for(let r of s.value.matchAll(mo))e.add(r[1]);return[...e].sort()}function yo(t){let e=new Map;for(let n of t)e.set(n.property,n.value.trim());return[...e].map(([n,s])=>({property:n,value:s})).sort((n,s)=>n.property.localeCompare(s.property))}function bo(t){let e=new Map;for(let n of t){let s=st(n),r=e.get(s),o=yo([...r?.declarations??[],...n.declarations]);e.set(s,{state:n.state,context:n.context,declarations:o})}return[...e.values()]}function Fn(t){let e=new Map,n=(s,r,o)=>{let i=Tn(s),a=e.get(i),l=bo([...a?xo(a.states):[],...r]),c=a?.stateLines??new Map;for(let u of r)c.has(st(u))||c.set(st(u),u.line);e.set(i,{...a??s,id:i,states:l,tokens:ho(l),line:a?.line??o,stateLines:c})};for(let s of t){let r=Tn(s);n({kind:"look",title:s.title,selector:s.selector,path:s.path,axis:s.axis,...s.usage.via?{selectedBy:s.usage.via}:{},...s.element?{element:s.element.tag}:{},...s.markup?{markup:!0}:{}},s.states,s.line);for(let o of s.modifiers??[])n({kind:"modifier",title:`${s.title} \xB7 ${o.title}`,selector:o.selector,path:o.path,hostId:r,...o.usage.via?{selectedBy:o.usage.via}:{},...o.element?{element:o.element.tag}:{},...o.alike?{markup:!0}:{}},o.states,o.line);for(let o of s.contexts??[])n({kind:"context",title:`${s.title} in ${o.selector}`,selector:o.selector,path:o.path,hostId:r,role:o.role,...o.element?{element:o.element.tag}:{}},o.states,o.line)}return e}function xo(t){return t.map(e=>({state:e.state,context:e.context,line:0,declarations:e.declarations}))}function ko(t){let e=new Map,n=/^:root\{([^}]*)\}/.exec(t);if(!n)return e;for(let s of n[1].split(";")){let r=s.indexOf(":");if(r<=0)continue;let o=s.slice(0,r).trim();o.startsWith("--")&&e.set(o,s.slice(r+1).trim())}return e}var Nn=/^(\d+) native /;function wo(t,e){if(t==="native")return`native:${e.refs[0]?.path??""}`;if(e.styles?.length){let n=[...new Set(e.refs.map(s=>s.path))].sort().join(",");return`${t}:${[...e.styles].sort().join(",")}:${n}`}return`${t}:${e.refs.map(n=>n.path).join(",")}:${e.message}`}var Jt={hardcoded:"value.hardcoded",native:"native.element",props:"prop.unknown"},vo=new Set(Object.values(Jt));var $o={"value.hardcoded":()=>"Replace each literal with the spec token named, or with a spec token for that property.","native.element":t=>`Render ${t.components[0]??"the shared component"} instead of a raw <button>, or ask for an exception.`,"prop.unknown":()=>"Use one of the values listed, or ask for an exception to add the look."};function zn(t){let e=[];for(let n of t.audit)if(n.status==="attention")for(let s of n.findings)e.push({check:n.id,finding:s,key:wo(n.id,s)});return e}function Ee(t){return`${t.path}#${De(t.text.replace(/\s+/g," ").trim())}`}function Wn(t,e={}){let n=ko(t.previewCss),s=[...Fn(t.variants).values()].map(({line:o,stateLines:i,...a})=>a),r=[];for(let o of t.guidance.files)if(o.kind!=="record")for(let i of o.passages)i.rule&&r.push({path:i.path,headings:i.headings,text:i.text,styles:i.styles});return{schema:Vn,concept:t.concept,label:t.label,version:e.version??0,sourceRef:t.repo.ref,publishedAt:e.publishedAt??null,components:[...t.components].sort(),tokens:t.tokens.map(o=>{let i=n.get(o.name);return i===void 0?{name:o.name}:{name:o.name,value:i}}).sort((o,i)=>o.name.localeCompare(i.name)),styles:s,rules:r,content:t.content.map(o=>o.id),acceptedFindings:zn(t).filter(({check:o})=>o in Jt).map(({check:o,finding:i,key:a})=>({check:o,key:a,message:i.message})),settings:{severity:{...Me,...e.settings?.severity??{}}}}}function Co(t,e){let n=new Map(t.map(o=>[o.property,o.value])),s=new Map(e.map(o=>[o.property,o.value])),r=[];for(let[o,i]of s){let a=n.get(o);a===void 0?r.push(`added ${o}: ${i}`):a!==i&&r.push(`${o}: ${a} \u2192 ${i}`)}for(let[o,i]of n)s.has(o)||r.push(`removed ${o}: ${i}`);return r}function je(t){return t.map(e=>`${e.property}: ${e.value}`).join("; ")}function Ie(t,e){return t.length>e?`${t.slice(0,e).join(", ")}, and ${t.length-e} more`:t.join(", ")}function So(t,e){let n=t.replace(/^--/,"").split("-")[0]??"",s=n?e.filter(r=>r.startsWith(`--${n}`)):[];return(s.length?s:e).slice(0,3)}function Un(t,e){let n={...Me,...e.settings.severity},s=[],r=(p,d="")=>{s.push({id:`${p.kind}:${De(`${p.styleId??""}|${p.state??""}|${d}`)}`,severity:n[p.kind],...p})},o=Fn(t.variants),i=new Map(e.styles.map(p=>[p.id,p])),a=e.styles.filter(p=>p.kind==="look"),l=new Set(e.tokens.map(p=>p.name)),c=[...l],u=new Map;for(let p of e.styles)p.markup&&u.set(Lt(p.states),p);let f=new Map;for(let p of o.values()){if(!p.markup)continue;let d=u.get(Lt(p.states));d&&f.set(p.id,d)}let m=new Set([...f.values()].map(p=>p.id)),y=p=>p.markup?`${p.title} (as in ${p.path})`:p.selector;for(let p of o.values()){if(i.has(p.id)||f.has(p.id))continue;let d=p.hostId?i.get(p.hostId):void 0,b=p.markup?a.filter(I=>I.markup):a,k=b.filter(I=>I.path===p.path),x=(k.length?k:b).map(y),w=p.markup?`This one-off ${p.element??"button"} (${Ie((p.states[0]?.declarations??[]).map(I=>`${I.property}: ${I.value}`),3)})`:p.selector,j=p.markup?e.components.length?`render ${e.components[0]} with a spec look,`:x.length?`copy ${Ie(x,3)},`:"use a spec style,":d?`restyle ${d.selector} only through spec modifiers`:x.length?`use ${Ie(x,3)},`:"use a spec style,";r({kind:"style.new",styleId:p.id,title:`${p.title} is not in the spec`,baseline:null,observed:{declarations:p.states[0]?.declarations??[],states:p.states,...p.markup?{markup:!0}:{}},refs:[{path:p.path,line:p.line}],fix:`${w} is not in the spec; ${j} or ask for an exception.`},p.markup?Lt(p.states):p.selector)}for(let p of o.values()){let d=i.get(p.id);if(!d)continue;let b=new Map(d.states.map(k=>[st(k),k]));for(let k of p.states){let x=st(k),w=b.get(x),j=Co(w?.declarations??[],k.declarations);j.length!==0&&r({kind:"state.changed",styleId:p.id,title:w?`${p.title}: ${x} changed`:`${p.title}: new ${x} state`,state:x,baseline:w?{declarations:w.declarations}:null,observed:{declarations:k.declarations},refs:[{path:p.path,line:p.stateLines.get(x)??p.line}],fix:w?`Restore ${p.selector} ${x} to the spec (${j.slice(0,3).join("; ")}), or ask for an exception.`:`${x} is not a spec state of ${p.selector}; remove it, or ask for an exception.`},je(k.declarations))}}for(let p of o.values()){let d=i.get(p.id);if(!d)continue;let b=new Set(p.states.map(st));for(let k of d.states){let x=st(k);b.has(x)||r({kind:"state.missing",styleId:p.id,title:`${p.title}: ${x} state is missing`,state:x,baseline:{declarations:k.declarations},observed:null,refs:[{path:p.path,line:p.line}],fix:`Define ${p.selector} ${x} again: ${je(k.declarations)||"as in the spec"}.`})}}for(let p of o.values())for(let d of p.tokens){if(l.has(d))continue;let b=So(d,c);r({kind:"token.unknown",styleId:p.id,title:`${p.title} reads ${d}, which is not a spec token`,baseline:null,observed:{token:d},refs:[{path:p.path,line:p.line}],fix:b.length?`Use a spec token such as ${b.join(", ")} instead of ${d}, or ask for an exception.`:`${d} is not a spec token; ask for an exception to add it.`},d)}let $=new Map;for(let p of e.acceptedFindings)$.set(p.key,[...$.get(p.key)??[],p]);let C=zn(t).filter(({check:p})=>p in Jt);for(let p of Bn)if(vo.has(p))for(let{check:d,finding:b,key:k}of C){if(Jt[d]!==p)continue;let x=$.get(k)??[];if(x.some(R=>!Ao(d,R.message,b.message)))continue;let w=x[0],j=b.styles?.[0],I=j?[...o.values()].find(R=>R.title===j):void 0;r({kind:p,styleId:I?.id??null,title:b.message,baseline:w?{message:w.message}:null,observed:{message:b.message,...p==="native.element"?{element:"button"}:{}},waiverKey:k,refs:b.refs.map(({path:R,line:A})=>({path:R,line:A})),fix:$o[p](e)},k)}for(let p of e.styles)o.has(p.id)||m.has(p.id)||r({kind:"style.removed",styleId:p.id,title:p.markup?`${p.title} is in the spec but no longer written anywhere`:`${p.title} is in the spec but no longer in CSS`,baseline:{declarations:p.states[0]?.declarations??[]},observed:null,refs:[{path:p.path,line:0}],fix:p.markup?`Nothing renders ${p.title} any more; ask the designer to retire it from the spec if that is intended.`:`Restore ${p.selector} in ${p.path}, or ask the designer to retire it from the spec.`});let v=new Map(t.guidance.files.map(p=>[p.path,p])),g=new Set;for(let p of t.guidance.files)for(let d of p.passages)d.rule&&g.add(Ee(d));for(let p of e.rules){if(g.has(Ee(p)))continue;let d=v.get(p.path);d&&d.total>d.passages.length||r({kind:"guidance.rule",styleId:null,title:`A written rule in ${p.path} changed or was removed`,baseline:{text:p.text},observed:null,refs:[{path:p.path,line:0}],fix:`Restore the rule under ${p.headings.join(" \u203A ")||p.path}, or publish a new spec.`},Ee(p))}return s}function Ao(t,e,n){if(e===n)return!1;if(t==="native"){let s=Nn.exec(e)?.[1],r=Nn.exec(n)?.[1];if(s&&r)return Number(r)>Number(s)}return!0}var Ro={product:"Gruum button spec",what:"The designer-published spec for this repository's buttons. Write buttons against it; drift from it is checked deterministically.",howToUse:["Use the components listed in `components`; do not render a raw <button> where a component exists.","Pick a look from `looks`. `selectedBy` says which prop or attribute value selects it.","Use only the tokens listed in `tokens`. Do not write a literal color or size a token already has.","Follow `rules`; they are the repository's written rules, quoted.","Do not add a look, modifier, or state, and do not change a state's declarations.","If the spec has no button for the job, ask for an exception with a reason instead of inventing one. Never edit generated Gruum files to make a check pass."]};function Oe(t){let e=(n,s)=>t.styles.filter(r=>r.hostId===n&&r.kind===s).map(r=>r.selector);return{about:{...Ro,drift:Bn.map(n=>({kind:n,severity:t.settings.severity[n]??Me[n]}))},spec:{concept:t.concept,version:t.version,sourceRef:t.sourceRef,components:t.components,looks:t.styles.filter(n=>n.kind==="look").map(n=>({title:n.title,selector:n.selector,path:n.path,...n.selectedBy?{selectedBy:n.selectedBy}:{},tokens:n.tokens,states:Object.fromEntries(n.states.map(s=>[st(s),je(s.declarations)])),modifiers:e(n.id,"modifier"),contexts:e(n.id,"context")})),tokens:t.tokens,rules:t.rules.map(n=>({path:n.path,under:n.headings.join(" \u203A "),text:n.text}))}}}function Zt(t){if(!t||typeof t!="object")return null;let e=t;return e.schema!==Vn||typeof e.concept!="string"||!Array.isArray(e.styles)||!Array.isArray(e.tokens)||!Array.isArray(e.acceptedFindings)||!Array.isArray(e.rules)||!e.settings?.severity?null:e}function _o(t){let e=new Map;for(let n of t){let s=n.refs[0]?.path??"(no file)";e.set(s,[...e.get(s)??[],n])}return[...e].sort(([n],[s])=>n.localeCompare(s))}function Le(t,e){if(e.length===0)return t;let n=new Set(e.map(s=>s.replace(/^\.\//,"")));return t.filter(s=>s.refs.some(r=>n.has(r.path)))}function Gn(t,e,n={}){let s=[];if(t.length===0)return s.push(`No drift against spec v${e.baselineVersion} (${e.files} files indexed, ${e.skipped} skipped).`),s.join(`
|
|
3
|
+
`);for(let[o,i]of _o(t)){s.push(o);for(let a of i){let l=a.refs[0]?.line,c=n[a.id],u=c?`${a.severity}, exception ${c}`:a.severity;s.push(` ${l?`${l}: `:""}[${u}] ${a.kind} ${a.title}`),s.push(` fix: ${a.fix}`)}s.push("")}let r=t.filter(o=>o.severity==="block").length;return s.push(`${t.length} drift item${t.length===1?"":"s"} against spec v${e.baselineVersion}: ${r} block, ${t.length-r} warn (${e.files} files indexed, ${e.skipped} skipped).`),s.join(`
|
|
4
|
+
`)}function Kn(t){return{schema:1,checkedAt:t,baselineVersion:null,items:[],followups:{}}}function Hn(t,e){if(!t||typeof t!="object")return Kn(e);let n=t;return n.schema!==1||!Array.isArray(n.items)?Kn(e):{schema:1,checkedAt:typeof n.checkedAt=="string"?n.checkedAt:e,baselineVersion:typeof n.baselineVersion=="number"?n.baselineVersion:null,items:n.items,followups:n.followups&&typeof n.followups=="object"?n.followups:{}}}function Pt(t,e={}){return t.filter(n=>{if(n.severity!=="block")return!1;let s=e[n.id];return s!=="pending"&&s!=="accepted"})}var Ct={exceptions:!1,denyGit:["commit","push"],maxFollowups:2},Pe=8;function Jn(t){let e=t.slice(0,Pe).map(n=>{let s=n.refs[0],r=s?` (${s.path}${s.line?`:${s.line}`:""})`:"";return`- ${n.title}${r}. ${n.fix}`});return t.length>Pe&&e.push(`- and ${t.length-Pe} more; run \`gruum check\`.`),e.join(`
|
|
5
|
+
`)}function Zn(t){return t.exceptions?"Fix each to the spec (call gruum_button_spec), or call gruum_request_exception with a reason when the spec has no button for the job.":"Fix each to the spec (call gruum_button_spec). If the spec has no button for the job, stop and tell the developer which exception you need; do not invent a style."}function Xn(t,e,n=Ct,s={}){let r=Pt(t.items,s),o=e.conversation_id??"",i=typeof e.loop_count=="number"?e.loop_count:t.followups[o]??0;return r.length===0||e.status==="aborted"?{output:{},ledger:t}:i>=n.maxFollowups?{output:{},ledger:t}:{output:{followup_message:`Gruum found ${r.length} button${r.length===1?"":"s"} that drift from the published spec:
|
|
6
|
+
${Jn(r)}
|
|
7
7
|
|
|
8
|
-
${
|
|
9
|
-
${
|
|
8
|
+
${Zn(n)}`},ledger:{...t,followups:{...t.followups,[o]:i+1}}}}function Te(t){let e=[];for(let n of t.split(/&&|\|\||[;|\n]/)){let s=n.trim().split(/\s+/).filter(Boolean),r=0;for(;r<s.length&&/^[A-Za-z_][A-Za-z0-9_]*=/.test(s[r]);)r++;if((s[r]==="command"||s[r]==="exec")&&r++,!!/(^|\/)git$/.test(s[r]??"")){for(r++;r<s.length&&s[r].startsWith("-");){let o=s[r];r+=/^(-C|-c|--git-dir|--work-tree|--namespace)$/.test(o)?2:1}s[r]&&e.push(s[r])}}return e}function Yn(t,e,n=Ct,s={}){let r=Te(e.command??"").filter(i=>n.denyGit.includes(i));if(r.length===0)return{permission:"allow"};let o=Pt(t.items,s);return o.length===0?{permission:"allow"}:{permission:"deny",user_message:`Gruum blocked git ${r[0]}: ${o.length} button drift item${o.length===1?"":"s"} against the spec. Run \`gruum check\` for details.`,agent_message:`git ${r[0]} is blocked until button drift is resolved:
|
|
9
|
+
${Jn(o)}
|
|
10
10
|
|
|
11
|
-
${
|
|
12
|
-
`}function
|
|
13
|
-
`)}function
|
|
11
|
+
${Zn(n)}`}}var Tt="npx --no-install @gruum/cli",qn={afterFileEdit:"after-file-edit",stop:"stop",beforeShellExecution:"before-shell"},Eo=/(^|[\s/])(?:@gruum\/cli|gruum(?:\.m?js)?)\s+hook\s+(after-file-edit|stop|before-shell)\s*$/;function Ne(t){return typeof t=="string"&&Eo.test(t)}function Xt(t,e){if(t===null||t.trim()==="")return{ok:!0,value:{}};try{let n=JSON.parse(t);return!n||typeof n!="object"||Array.isArray(n)?{ok:!1,error:`${e} is not a JSON object; fix it or move it aside, then run init again.`}:{ok:!0,value:n}}catch{return{ok:!1,error:`${e} is not valid JSON; fix it or move it aside, then run init again.`}}}function Yt(t){return`${JSON.stringify(t,null,2)}
|
|
12
|
+
`}function Qn(t,e=Tt){let n=".cursor/hooks.json",s=Xt(t,n);if(!s.ok)return s;let r=s.value;if(r.hooks!==void 0&&(typeof r.hooks!="object"||Array.isArray(r.hooks)||r.hooks===null))return{ok:!1,error:`${n} has a "hooks" value that is not an object.`};let o={...r.hooks??{}},i=t===null||t.trim()==="";for(let a of Object.keys(qn)){let l=o[a]??[];if(!Array.isArray(l))return{ok:!1,error:`${n} has a "${a}" value that is not an array.`};let c=`${e} hook ${qn[a]}`,u=l.filter(f=>Ne(f?.command));u.length===1&&u[0].command===c||(o[a]=[...l.filter(f=>!Ne(f?.command)),{command:c}],i=!0)}return i?{ok:!0,text:Yt({version:r.version??1,...r,hooks:o}),changed:!0}:{ok:!0,text:t,changed:!1}}function ts(t){let e=".cursor/hooks.json";if(t===null)return{ok:!0,text:"",changed:!1};let n=Xt(t,e);if(!n.ok)return n;let s=n.value,r={...s.hooks??{}},o=!1;for(let a of Object.keys(r)){let l=r[a];if(!Array.isArray(l))continue;let c=l.filter(u=>!Ne(u?.command));c.length!==l.length&&(o=!0,c.length?r[a]=c:delete r[a])}if(!o)return{ok:!0,text:t,changed:!1};let i=Object.keys(s).every(a=>a==="version"||a==="hooks");return Object.keys(r).length===0&&i?{ok:!0,text:"",changed:!0}:{ok:!0,text:Yt({...s,hooks:r}),changed:!0}}function Io(t){let[e,...n]=t.trim().split(/\s+/);return{command:e,args:[...n,"mcp"]}}function es(t,e=Tt){let n=".cursor/mcp.json",s=Xt(t,n);if(!s.ok)return s;let r=s.value,o=r.mcpServers??{};if(typeof o!="object"||Array.isArray(o)||o===null)return{ok:!1,error:`${n} has an "mcpServers" value that is not an object.`};let i=Io(e),a=o.gruum;return JSON.stringify(a)===JSON.stringify(i)?{ok:!0,text:t,changed:!1}:{ok:!0,text:Yt({...r,mcpServers:{...o,gruum:i}}),changed:!0}}function ns(t){let e=".cursor/mcp.json";if(t===null)return{ok:!0,text:"",changed:!1};let n=Xt(t,e);if(!n.ok)return n;let s=n.value,r={...s.mcpServers??{}};return"gruum"in r?(delete r.gruum,Object.keys(r).length===0&&Object.keys(s).every(o=>o==="mcpServers")?{ok:!0,text:"",changed:!0}:{ok:!0,text:Yt({...s,mcpServers:r}),changed:!0}):{ok:!0,text:t,changed:!1}}var pt=".cursor/rules/gruum-buttons.mdc",ss="<!-- written by gruum init cursor -->",jo=20,Mo=["**/*.css","**/*.scss","**/*.tsx","**/*.jsx"];function rs(t){let e=(t?.findings??[]).filter(s=>s.role==="implements"||s.role==="styles").map(s=>s.path).filter(s=>!/[,"\n]/.test(s)),n=[...new Set(e)].sort().slice(0,jo);return n.length?n:Mo}function os(t){return["---","description: Buttons in this repository follow a spec published in Gruum.",`globs: ${t.join(",")}`,"alwaysApply: false","---",ss,"","The button spec for this repository lives in Gruum; call the `gruum_button_spec` tool before writing or restyling a button.","Run `gruum_check_buttons` before you stop, and fix every drift item it reports to the spec.","When the spec has no button for the job, ask for an exception with a reason rather than inventing a style, and never edit Gruum's generated files to make a check pass.",""].join(`
|
|
13
|
+
`)}function is(t){return t.includes(ss)}function as(t){let e=t??"";if(e.split(/\r?\n/).some(r=>/^\/?\.gruum\/?(\*\*?)?$/.test(r.trim())))return{text:e,changed:!1};let s=e===""||e.endsWith(`
|
|
14
14
|
`)?"":`
|
|
15
|
-
`;return{text:`${
|
|
15
|
+
`;return{text:`${e}${s}# Gruum local state
|
|
16
16
|
.gruum/
|
|
17
|
-
`,changed:!0}}function
|
|
17
|
+
`,changed:!0}}function ls(t){if(t===null)return{text:"",changed:!1};let e=t.replace(/(^|\n)# Gruum local state\n\.gruum\/\n/,"$1");return{text:e,changed:e!==t}}var Do=t=>`${t} check --staged`;function cs(t,e=Tt){let n=Do(e);if(t.lefthook)return{kind:"print",reason:"lefthook config found; add this to the pre-commit commands",snippet:`pre-commit:
|
|
18
18
|
commands:
|
|
19
19
|
gruum:
|
|
20
20
|
run: ${n}
|
|
21
|
-
`};let s=
|
|
22
|
-
`};let r=
|
|
21
|
+
`};let s=t.husky?"husky":t.gitHooksDir?"git":null;if(!s)return{kind:"print",reason:"no hook directory found; add this to your pre-commit hook",snippet:`${n}
|
|
22
|
+
`};let r=t.husky?".husky/pre-commit":`${t.gitHooksDir}/pre-commit`,o=t.hookText;if(o!==null&&o.split(/\r?\n/).some(l=>us(l)))return{kind:s,path:r,text:o,changed:!1};let i=o===null?s==="git"?`#!/bin/sh
|
|
23
23
|
`:"":o,a=i===""||i.endsWith(`
|
|
24
24
|
`)?"":`
|
|
25
25
|
`;return{kind:s,path:r,text:`${i}${a}${n}
|
|
26
|
-
`,changed:!0}}function
|
|
27
|
-
`),n=
|
|
28
|
-
`);return s&&/^(#!\/bin\/sh)?\s*$/.test(r)?{text:"",changed:s}:{text:r,changed:s}}var Yr="2025-06-18",Un="Check before you finish, fix to the spec when you can, ask for an exception with a reason when you cannot, and never edit Gruum's generated files to make a check pass.",Hn={gruum_button_spec:`The designer-published button spec for this repository: components, looks and how to select them, tokens, and written rules. Read it before writing or restyling a button. ${Un}`,gruum_check_buttons:`Check the working tree's buttons against the spec and list drift items with a one-line fix each. Run it before you stop. ${Un}`};function Kn(e){return[{name:"gruum_button_spec",description:Hn.gruum_button_spec,inputSchema:{type:"object",properties:{},additionalProperties:!1},run:()=>e.spec()},{name:"gruum_check_buttons",description:Hn.gruum_check_buttons,inputSchema:{type:"object",properties:{paths:{type:"array",items:{type:"string"},description:"Only report drift in these files (relative to the repository root). Omit to check everything."}},additionalProperties:!1},run:t=>{let n=Array.isArray(t.paths)?t.paths.filter(s=>typeof s=="string"):[];return e.check(n)}}]}function Le(e,t){return{jsonrpc:"2.0",id:e,result:t}}function Ue(e,t,n){return{jsonrpc:"2.0",id:e,error:{code:t,message:n}}}async function Jn(e,t,n){if(!e||typeof e!="object")return Ue(null,-32600,"Invalid request");let s=e,r=!("id"in s),o=s.id??null;if(typeof s.method!="string")return r?null:Ue(o,-32600,"Invalid request");let i=s.params??{};switch(s.method){case"initialize":{let a=i.protocolVersion;return Le(o,{protocolVersion:typeof a=="string"?a:Yr,capabilities:{tools:{listChanged:!1}},serverInfo:n})}case"ping":return Le(o,{});case"tools/list":return Le(o,{tools:t.map(({name:a,description:l,inputSchema:c})=>({name:a,description:l,inputSchema:c}))});case"tools/call":{let a=t.find(c=>c.name===i.name);if(!a)return Ue(o,-32602,`Unknown tool: ${String(i.name)}`);let l=i.arguments&&typeof i.arguments=="object"?i.arguments:{};try{let c=await a.run(l);return Le(o,{content:[{type:"text",text:c.text}],isError:c.isError??!1})}catch(c){return Le(o,{content:[{type:"text",text:c instanceof Error?c.message:String(c)}],isError:!0})}}default:return r?null:Ue(o,-32601,`Method not found: ${s.method}`)}}var Qr=/(^|\/)(node_modules|\.git|\.next|dist|build|out|coverage|vendor|\.turbo|\.cache|__pycache__|target|\.venv|venv)\//,eo=/(^|\/)(package-lock\.json|pnpm-lock\.yaml|yarn\.lock|bun\.lockb|Cargo\.lock|poetry\.lock|composer\.lock|Gemfile\.lock)$/,to=/\.(png|jpe?g|gif|webp|avif|ico|icns|bmp|tiff?|svgz|woff2?|ttf|otf|eot|mp[34]|wav|ogg|webm|mov|zip|gz|tgz|bz2|7z|rar|jar|pdf|docx?|xlsx?|pptx?|exe|dll|so|dylib|wasm|bin|dat|sqlite|db|psd|ai|sketch|fig)$/i,no=/(^|\/)\.gruum\//;function $t(e){return!Qr.test(`${e}/`)&&!no.test(`${e}/`)}function Ct(e,t){return eo.test(e)||to.test(e)?!1:t<=3e5}function Zn(e){let t=Math.min(e.length,8e3);for(let n=0;n<t;n++)if(e[n]===0)return!0;return!1}var so=/\.(css|scss|sass|less|styl|tsx?|jsx?|mjs|cjs|vue|svelte|astro|html?|mdx?|erb|php|hbs|njk|liquid|twig|ejs|pug|cshtml|razor|jinja2?|j2|json)$/i;function Xn(e){return so.test(e)}function St(e){return e.replace(/\\/g,"/").replace(/^\.\/?/,"").replace(/^\/+|\/+$/g,"")}function At(e,t){let n=St(t),s=e.replace(/\\/g,"/");return n?s.startsWith(`${n}/`)?s.slice(n.length+1):null:s}function qn(e,t,n){let s=new Map(e);for(let r of t){let o=At(r.path,n);o===null||!$t(o.split("/").slice(0,-1).join("/")||".")||(r.content===null?s.delete(o):Ct(o,r.content.length)&&s.set(o,r.content))}return s}function Yn(e){let t=e.split("\0").filter(Boolean),n=[];for(let s=0;s<t.length;s++){let r=t[s];if(/^[RC]/.test(r)){let i=t[++s],a=t[++s];r.startsWith("R")&&i&&n.push({path:i,deleted:!0}),a&&n.push({path:a,deleted:!1});continue}let o=t[++s];o&&n.push({path:o,deleted:r.startsWith("D")})}return n}function Qn(e){let t=/^(?:git@|ssh:\/\/git@|https?:\/\/(?:[^@/]+@)?)github\.com[:/]([^/\s]+)\/([^/\s]+?)(?:\.git)?\/?$/i.exec(e.trim());return t?`${t[1]}/${t[2]}`:null}var es=e=>e.replace(/\\(.)/g,"$1");function ro(e){let t=e;for(;;){let n=/:(?:global|local)\(/i.exec(t);if(!n)break;let s=0,r=-1;for(let i=n.index+n[0].length-1;i<t.length;i++){let a=t[i];if(a==="(")s++;else if(a===")"&&--s===0){r=i;break}}if(r<0)break;let o=t.slice(n.index+n[0].length,r).trim();t=`${t.slice(0,n.index)}${o}${t.slice(r+1)}`}return t.replace(/:(?:global|local)(?=\s|$)/gi,"").trim()}var Rt=/\*|[a-z][\w-]*|\.((?:\\.|[\w-])+)|#((?:\\.|[\w-])+)|\[\s*([\w-]+)\s*(?:([~|^$*]?=)\s*(?:"([^"]*)"|'([^']*)'|([^\]\s]*)))?\s*[is]?\s*\]|::([\w-]+)|:([\w-]+)(\((?:[^()]|\([^()]*\))*\))?/giy;function ss(e){let t=[];Rt.lastIndex=0;let n=0;for(;n<e.length;){Rt.lastIndex=n;let s=Rt.exec(e);if(!s||s.index!==n)return null;let r=s[0];if(n+=r.length,r==="*")t.push({kind:"universal",raw:r});else if(s[1]!==void 0)t.push({kind:"class",raw:r,name:es(s[1])});else if(s[2]!==void 0)t.push({kind:"id",raw:r,name:es(s[2])});else if(s[3]!==void 0)t.push({kind:"attr",raw:r,name:s[3],op:s[4]??null,value:s[4]?s[5]??s[6]??s[7]??"":null});else if(s[8]!==void 0)t.push({kind:"pseudoElement",raw:r,name:s[8].toLowerCase()});else if(s[9]!==void 0){let o=s[9].toLowerCase();/^(?:before|after|first-line|first-letter)$/.test(o)?t.push({kind:"pseudoElement",raw:r,name:o}):t.push({kind:"pseudo",raw:r,name:o,args:s[10]?s[10].slice(1,-1).trim():null})}else if(t.length===0)t.push({kind:"tag",raw:r,name:r.toLowerCase()});else return null}return t.length?t:null}function J(e){let t=ro(e),n=[],s=0,r=0,o=null,i=!0,a=l=>{let c=t.slice(r,l).trim();if(!c)return!0;let u=ss(c);return u?(n.push({combinator:i?null:o??" ",simples:u}),i=!1,o=null,!0):!1};for(let l=0;l<t.length;l++){let c=t[l];if(c==="("||c==="[")s++;else if(c===")"||c==="]")s=Math.max(0,s-1);else if(s===0&&(c===">"||c==="+"||c==="~")){if(!a(l)||o)return null;o=c,r=l+1}else if(s===0&&/\s/.test(c)){if(!a(l))return null;r=l+1}}return!a(t.length)||o?null:n.length?n:null}function je(e){return e.map(t=>t.raw).join("")}function De(e){return e.map((t,n)=>{let s=je(t.simples);return n===0?s:t.combinator===" "?` ${s}`:` ${t.combinator} ${s}`}).join("")}function V(e){let t=[],n=0,s=0;for(let r=0;r<e.length;r++){let o=e[r];o==="("||o==="["?n++:o===")"||o==="]"?n=Math.max(0,n-1):o===","&&n===0&&(t.push(e.slice(s,r).trim()),s=r+1)}return t.push(e.slice(s).trim()),t.filter(Boolean)}var rs=e=>e.replace(/([a-z\d])([A-Z])/g,"$1-$2").split(/[^a-z0-9]+/i).filter(Boolean).map(t=>t.toLowerCase());function ts(e,t){let n=e.toLowerCase();return t.some(s=>n.includes(s.toLowerCase()))}function _t(e,t){let n=t.excludeClassKeywords;if(!n?.length)return!1;let s=new Set(n.flatMap(r=>[r.toLowerCase(),`${r.toLowerCase()}s`]));return e.some(r=>r.kind==="class"&&rs(r.name).some(o=>s.has(o)))}var oo=new Set(["html","body"]),io=new Set(["svg","path","use","img","picture","video","i","em","strong","b","small","kbd","sup","sub"]);function Ke(e,t){for(let n of e)switch(n.kind){case"tag":if(t.elements.includes(n.name))return!0;break;case"class":if(ts(n.name,t.classKeywords))return!0;break;case"attr":if(n.name==="role"&&n.value!==null&&t.roles.includes(n.value.toLowerCase())||n.name==="data-component"&&n.value!==null&&ts(n.value,t.classKeywords))return!0;break;case"pseudo":if((n.name==="is"||n.name==="where")&&n.args){let s=V(n.args).map(J);if(s.length>0&&s.every(r=>r!==null&&Ke(r[r.length-1].simples,t)))return!0}break;default:break}return!1}function os(e){return e.some(n=>n.kind==="universal")?e.length===1:e.some(n=>n.kind==="tag"&&oo.has(n.name))?!0:!e.some(n=>n.kind==="tag"||n.kind==="class"||n.kind==="attr"||n.kind==="id"||n.kind==="pseudo"&&(n.name==="is"||n.name==="where"))}function is(e){return e.some(t=>t.kind==="tag"&&io.has(t.name))}var He=["hover","focus","active","selected","current","loading","disabled"],ao={hover:"hover",hovered:"hover",focus:"focus",focused:"focus","focus-visible":"focus","focus-within":"focus",active:"selected",pressed:"selected",selected:"selected",checked:"selected",on:"selected",current:"current",loading:"loading",busy:"loading",pending:"loading",disabled:"disabled"},lo={hover:"hover",focus:"focus","focus-visible":"focus","focus-within":"focus",active:"active",checked:"selected",disabled:"disabled"},co={disabled:"disabled","aria-disabled":"disabled","data-disabled":"disabled","aria-pressed":"selected","aria-selected":"selected","aria-expanded":"selected","aria-checked":"selected","data-active":"selected","data-selected":"selected","data-pressed":"selected","data-checked":"selected","data-highlighted":"selected","aria-current":"current","aria-busy":"loading","data-loading":"loading","data-busy":"loading","data-hover":"hover","data-hovered":"hover","data-focus":"focus","data-focused":"focus","data-focus-visible":"focus","data-open":"open","data-expanded":"open"},uo=new Set(["active","selected","pressed","checked","loading","busy","disabled","open","current","hover","focus","show","expanded","collapsed"]),ns=e=>ao[e.toLowerCase()]??e.toLowerCase(),ne={hover:"__gs-hover",focus:"__gs-focus",active:"__gs-active"};function as(e){if(e.kind==="pseudo"){let t=lo[e.name];if(!t)return null;let n=ne[t];return{state:t,marker:n?{classes:[n],attrs:{}}:{classes:[],attrs:{[e.name==="checked"?"checked":"disabled"]:""}}}}if(e.kind==="attr"){if(e.name==="data-state"&&e.value!==null)return{state:ns(e.value),marker:{classes:[],attrs:{"data-state":e.value}}};let t=co[e.name];if(!t||e.value!==null&&/^(?:false|off|0)$/i.test(e.value))return null;let n=e.value??(e.name.startsWith("aria-")?"true":"");return{state:t,marker:{classes:[],attrs:{[e.name]:n}}}}if(e.kind==="class"){let t=/^(?:is|has)-(.+)$/i.exec(e.name),n=t?t[1]:uo.has(e.name.toLowerCase())?e.name:null;return n?{state:ns(n),marker:{classes:[e.name],attrs:{}}}:null}return null}function fo(e){return e.kind!=="pseudo"||e.name!=="not"||!e.args?!1:V(e.args).every(t=>{let n=ss(t);return n!==null&&n.every(s=>as(s)!==null)})}function Je(e){let t=[],n=new Map;for(let o of e){if(fo(o))continue;let i=as(o);if(!i){t.push(o);continue}let a=n.get(i.state)??{classes:[],attrs:{}};for(let l of i.marker.classes)a.classes.includes(l)||a.classes.push(l);Object.assign(a.attrs,i.marker.attrs),n.set(i.state,a)}let s=[...n.keys()].sort((o,i)=>W(o)-W(i)||o.localeCompare(i)),r={classes:[],attrs:{}};for(let o of s){let i=n.get(o);r.classes.push(...i.classes),Object.assign(r.attrs,i.attrs)}return{identity:t,states:s,marker:r}}function W(e){if(e==="default")return-1;let t=He.indexOf(e);return t===-1?He.length:t}function ue(e){return e.length?e.join(" + "):"default"}function Et(e){return e.replace(/:hover\b/g,`.${ne.hover}`).replace(/:focus(?:-visible|-within)?\b/g,`.${ne.focus}`).replace(/:active\b/g,`.${ne.active}`)}var po=new Set(["background","background-color","background-image","background-position","background-size","background-repeat","background-clip","background-origin","background-attachment","color","border-color","border-top-color","border-right-color","border-bottom-color","border-left-color","outline","outline-color","outline-offset","box-shadow","filter","backdrop-filter","opacity","fill","stroke","caret-color","accent-color","text-decoration-color","mix-blend-mode"]),go=new Set(["width","min-width","max-width","flex","flex-grow","flex-shrink","flex-basis","align-self","justify-self","order","margin","margin-top","margin-right","margin-bottom","margin-left","margin-inline","margin-block","margin-inline-start","margin-inline-end","margin-block-start","margin-block-end","position","inset","inset-inline","inset-block","top","right","bottom","left","z-index","float","clear","grid-column","grid-row","grid-area","place-self"]),mo=new Set(["cursor","user-select","pointer-events","transition","transition-property","transition-duration","transition-timing-function","transition-delay","will-change","touch-action","-webkit-tap-highlight-color","appearance","-webkit-appearance","scroll-margin","scroll-margin-top"]);function Oe(e){let t=e.toLowerCase();return po.has(t)?"paint":go.has(t)?"layout":mo.has(t)?"hint":"box"}var ho={shadow:/^box-shadow$/,cursor:/^cursor$/,rounded:/^border(?:-[a-z]+)*-radius$/,radius:/^border(?:-[a-z]+)*-radius$/};function ls(e,t){let n=e.filter(o=>o.kind==="class");if(n.length!==1||e.length!==1)return!1;let s=rs(n[0].name)[0],r=s?ho[s]:void 0;return r?t.length>0&&t.every(o=>r.test(o.property.toLowerCase())):!1}var Vl={hover:{classes:[ne.hover],attrs:{}},focus:{classes:[ne.focus],attrs:{}},active:{classes:[ne.active],attrs:{}},selected:{classes:[],attrs:{"aria-pressed":"true"}},current:{classes:[],attrs:{"aria-current":"true"}},loading:{classes:[],attrs:{"aria-busy":"true"}},disabled:{classes:[],attrs:{disabled:""}}};var bo="data-gs-sheet";function us(e){return`[${bo}="${e.replace(/["\\]/g,"")}"]`}function cs(e){return/\.module\.[a-z]+$/i.test(e)}var xo=new Set(["button","a","div","span","input","summary","label"]);function fe(e){let t=0,n=0;for(let s=0;s<e.length;s++){let r=e[s];r==="("||r==="["?t++:r===")"||r==="]"?t=Math.max(0,t-1):t===0&&/[\s>+~]/.test(r)&&(n=s+1)}return n}function yo(e){let t={tag:"",classes:[],attrs:{}};for(let n of e)switch(n.kind){case"pseudoElement":return null;case"tag":t.tag=n.name;break;case"class":t.classes.push(n.name);break;case"attr":t.attrs[n.name]=n.value??"";break;default:break}return t}function Ze(e,t){let n=J(e);if(!n||n.some(c=>c.combinator==="+"||c.combinator==="~"))return null;let s=n.map(c=>yo(c.simples));if(s.some(c=>c===null))return null;let r=s,o=r[r.length-1],i=o.tag&&o.tag!=="*"?o.tag:"button";if(!xo.has(i)||o.classes.length===0&&Object.keys(o.attrs).length===0&&!o.tag)return null;let a=[...new Set([...t,...o.classes])],l=r.slice(0,-1).filter(c=>c.tag||c.classes.length||Object.keys(c.attrs).length).map(c=>({...c,tag:c.tag&&c.tag!=="*"?c.tag:"div"}));return{tag:i,classes:a,attrs:o.attrs,ancestors:l}}function Mt(e,t){let n="";for(let s of e)s.property.toLowerCase()===t&&(n=s.value.replace(/!important\s*$/i,"").trim());return n}function Xe(e){let t=Mt(e,"display");if(/^none\b/i.test(t))return"display: none";let n=Mt(e,"visibility");if(/^(hidden|collapse)\b/i.test(n))return`visibility: ${n.split(/\s+/)[0].toLowerCase()}`;let s=Mt(e,"opacity");return/^(0|0\.0+)$/.test(s)?"opacity: 0":null}function fs(e,t){return e===t||!cs(e)&&!cs(t)}function q(e,t){if(/[<>]|@import|expression\(|javascript:|behavior\s*:/i.test(t))return!1;for(let n of t.matchAll(/url\(\s*(['"]?)([^'")]*)\1\s*\)/gi))if(!/^data:image\//i.test(n[2]))return!1;return/^-{0,2}[a-z][\w-]*$/i.test(e)}var wo=40,Y=(e,t)=>({path:e,line:t});function Q(e,t,n,s){return{...e,status:t.length===0?"ok":"attention",summary:t.length===0?n:s(t.length),findings:t.slice(0,wo)}}function be(e,t){return{...e,status:"na",summary:t,findings:[]}}var It=e=>e.state.split(" + ");function hs(e,t){if(!e.element||!t.element||e!==t&&!fs(e.path,t.path)||e.element.ancestors.length>0||e.element.tag!==t.element.tag)return!1;let n=new Set(t.element.classes);return e.element.classes.every(s=>n.has(s))?Object.entries(e.element.attrs).every(([s,r])=>t.element.attrs[s]===r):!1}function bs(e,t){return t.filter(n=>hs(n,e)).flatMap(n=>n.states)}function ko(e,t,n){return bs(e,t).some(s=>It(s).includes(n))||t.filter(s=>hs(s,e)).some(s=>(s.parts??[]).some(r=>r.state.split(" + ").includes(n)))}var vo=[{state:"hover",severity:"issue"},{state:"focus",severity:"issue"},{state:"disabled",severity:"issue"},{state:"active",severity:"note"}];function $o(e){let t={id:"states",title:"Missing states",description:"Styles with no hover, focus, disabled, or active rule, counting rules they inherit from a shared base class."},n=e.variants.filter(r=>r.element&&r.element.ancestors.length===0);if(n.length===0)return be(t,"No styles that can be drawn on their own.");let s=[];for(let{state:r,severity:o}of vo){let i=n.filter(a=>!ko(a,e.variants,r));i.length!==0&&s.push({severity:o,message:i.length===n.length?`No style defines a ${r} state.`:`${i.length} of ${n.length} styles have no ${r} state.`,styles:i.length===n.length?void 0:i.map(a=>a.title),refs:i.slice(0,6).map(a=>Y(a.path,a.line))})}return Q(t,s,"Every style has hover, focus, disabled, and active rules.",r=>`${r} state${r===1?"":"s"} missing on some styles.`)}var ps=new Set(["outline","outline-style","outline-width"]),ds=/^(?:none|0|0px)(?:\s+(?:none|0|0px))*$/i,Co=/^(?:outline(?:-color|-width|-style)?|box-shadow|border(?:-[a-z]+)*|background(?:-color)?|text-decoration(?:-[a-z]+)?|color)$/;function So(e){let t={id:"focus",title:"Focus indicator removed",description:"Styles that remove the outline and give keyboard focus nothing in its place."},n=e.variants.filter(r=>r.element&&r.element.ancestors.length===0);if(n.length===0)return be(t,"No styles that can be drawn on their own.");let s=[];for(let r of n){let o=bs(r,e.variants),i=o.filter(l=>{let c=It(l);return c.includes("default")||c.includes("focus")}).flatMap(l=>l.declarations.map(c=>({s:l,d:c}))).find(({d:l})=>ps.has(l.property)&&ds.test(l.value.replace(/\s*!important/i,"")));!i||o.filter(l=>It(l).includes("focus")).some(l=>l.declarations.some(c=>Co.test(c.property)&&!(ps.has(c.property)&&ds.test(c.value))&&!/^(?:none|0|0px)$/i.test(c.value)&&!(c.property==="box-shadow"&&/^none$/i.test(c.value))))||s.push({severity:"issue",message:`${r.title} removes the outline (${i.d.property}: ${i.d.value}) and no focus rule replaces it.`,styles:[r.title],refs:[Y(r.path,i.s.line)]})}return Q(t,s,"No style removes the outline without a focus replacement.",r=>`${r} style${r===1?"":"s"} lose the focus indicator.`)}function Ao(e){let t={id:"tokens",title:"Undefined tokens",description:`Custom properties the ${e.noun} styles read that no scanned stylesheet defines.`};if(e.tokens.length===0)return be(t,`The ${e.noun} styles read no custom properties.`);let s=e.tokens.filter(r=>r.definedIn.length===0&&!r.name.startsWith("--tw-")).map(r=>{let o=e.variants.filter(i=>i.states.some(a=>a.declarations.some(l=>l.value.includes(`var(${r.name}`)||new RegExp(`var\\(\\s*${r.name}\\b`).test(l.value))));return{severity:"note",message:`${r.name} is read but never defined here. It may be set outside the scanned files (a framework, a theme provider).`,styles:o.slice(0,8).map(i=>i.title),refs:o.slice(0,3).map(i=>Y(i.path,i.line))}});return Q(t,s,`All ${e.tokens.length} tokens read are defined.`,r=>`${r} token${r===1?"":"s"} with no definition.`)}var Ro=/var\((?:[^()]|\([^()]*\))*\)/g,gs=/#[0-9a-f]{3,8}\b|\b(?:rgba?|hsla?)\([^)]*\)/gi,_o=/^(?:padding|margin|gap|row-gap|column-gap|height|min-height|max-height|border-radius|font-size|letter-spacing)(?:-[a-z]+)*$/,Eo=/(?<![\w.-])(\d+(?:\.\d+)?)px\b/g;function ms(e){let t=e.trim().toLowerCase().replace(/\s+/g,""),n=/^#([0-9a-f]{3})$/.exec(t);return n?`#${[...n[1]].map(s=>s+s).join("")}`:t}function Lt(e,t,n=0){return n>6?e:e.replace(/var\(\s*(--[\w-]+)\s*(?:,\s*([^)]*))?\)/g,(s,r,o)=>{let i=t.get(r);return i!==void 0?Lt(i,t,n+1):o!==void 0?Lt(o.trim(),t,n+1):s})}var Mo=[[/^(?:padding|margin|gap|row-gap|column-gap)/,/space|spacing|gap|pad|inset|gutter/i],[/height$/,/height|control|size/i],[/^border-radius/,/radius|round|corner/i],[/^font-size$/,/text|font|size|type/i],[/^letter-spacing$/,/tracking|letter|spacing/i]];function Io(e,t){if(!t)return null;let n=Mo.find(([s])=>s.test(e))?.[1];return t.find(s=>!n||n.test(s))??null}function Lo(e){let t={id:"hardcoded",title:"Hard-coded values",description:`Raw colors, and pixel sizes that exactly match a token, written into ${e.noun} styles instead of using the token.`},n=new Map,s=new Map;for(let[o,i]of e.tokenValues){let a=Lt(i,e.tokenValues).trim();if(new RegExp(`^(?:${gs.source})$`,"i").test(a)){let l=ms(a);n.set(l,[...n.get(l)??[],o])}else/^\d+(?:\.\d+)?px$/.test(a)&&s.set(a,[...s.get(a)??[],o])}if(n.size===0&&s.size===0)return be(t,"No color or size tokens were found to compare against.");let r=[];for(let o of e.variants){let i=[],a=null;for(let c of o.states)for(let u of c.declarations){if(u.via)continue;let f=u.value.replace(Ro," ");for(let b of f.matchAll(gs)){let x=n.get(ms(b[0]));i.push(x?`${b[0]} in ${u.property} is the value of ${x[0]}`:`${b[0]} in ${u.property} is not a token`),a??=c}if(_o.test(u.property))for(let b of f.matchAll(Eo)){let x=Io(u.property,s.get(`${b[1]}px`));!x||Number(b[1])<=1||(i.push(`${b[1]}px in ${u.property} is the value of ${x}`),a??=c)}}if(i.length===0||!a)continue;let l=[...new Set(i)];r.push({severity:"issue",message:`${o.title}: ${l.slice(0,4).join("; ")}${l.length>4?`; and ${l.length-4} more`:""}.`,styles:[o.title],refs:[Y(o.path,a.line)]})}return Q(t,r,`No ${e.noun} style hard-codes a value a token already has.`,o=>`${o} style${o===1?"":"s"} hard-code values.`)}function jo(e){let t={id:"unused",title:"Unused styles",description:"Styles defined in CSS that no component, page, or template references."},n=e.variants.filter(r=>r.element&&r.usage.status!=="unknown");if(n.length===0)return be(t,"No styles with a class name to look for.");let s=[];for(let r of n)r.usage.status==="unreferenced"?s.push({severity:"issue",message:`${r.title} (${r.selector}) is defined but no reference to it was found.`,styles:[r.title],refs:[Y(r.path,r.line)]}):r.usage.status==="dynamic"&&s.push({severity:"note",message:`${r.title} (${r.selector}) is built at runtime and nothing selects it by value.`,styles:[r.title],refs:[Y(r.path,r.line),...r.usage.files.slice(0,2)]});return s.sort((r,o)=>+(o.severity==="issue")-+(r.severity==="issue")),Q(t,s,`All ${n.length} styles are referenced.`,r=>`${r} style${r===1?"":"s"} unreferenced or unconfirmed.`)}function Do(e){let t={id:"duplicates",title:"Duplicate styles",description:"Different styles whose default declarations are identical."},n=new Map;for(let r of e.variants){if(!r.element)continue;let o=r.states.filter(a=>a.state==="default"&&a.context==="").flatMap(a=>a.declarations).map(a=>`${a.property}:${a.value.replace(/\s+/g," ").trim()}`);if(o.length<2)continue;let i=[...new Set(o)].sort().join(";");n.set(i,[...n.get(i)??[],r])}let s=[...n.values()].filter(r=>r.length>1).map(r=>({severity:"issue",message:`${r.map(o=>o.title).join(", ")} declare the same default styles (${r.map(o=>o.selector).join(", ")}).`,styles:r.map(o=>o.title),refs:r.map(o=>Y(o.path,o.line))}));return Q(t,s,"No two styles share the same default declarations.",r=>`${r} group${r===1?"":"s"} of identical styles.`)}function Oo(e){let t={id:"native",title:`Native <${e.element}> instead of the component`,description:`Files that render a raw <${e.element}> although the repository has a shared ${e.element} component.`};if(!e.hasComponent)return be(t,`No shared ${e.element} component was found, so native elements are expected.`);let n=e.nativeUses.map(s=>({severity:"issue",message:`${s.count} native <${e.element}> element${s.count===1?"":"s"} in ${s.path}.`,refs:[Y(s.path,s.line)]}));return Q(t,n,`Every <${e.element}> goes through the component.`,s=>`${s} file${s===1?"":"s"} bypass the component.`)}function To(e){let t={id:"undocumented",title:"Styles without written guidance",description:"Styles that no instruction file or doc names, so nothing written says how they should be used."},{guidance:n}=e;if(n.files.length===0)return{...t,status:"attention",summary:`Nothing in the repository mentions ${e.noun}.`,findings:[{severity:"note",message:`No instruction file or doc says how ${e.noun} should look or be built.`,refs:[]}]};if(n.undocumented.length===0)return Q(t,[],"Every style is named in written guidance.",()=>"");let s=e.variants.filter(r=>r.element&&n.undocumented.includes(r.title));return Q(t,[{severity:"note",message:`${n.undocumented.length} of ${n.documented.length+n.undocumented.length} styles are named in no guidance.`,styles:n.undocumented,refs:s.slice(0,6).map(r=>Y(r.path,r.line))}],"",r=>`${r} finding${r===1?"":"s"}.`)}function xs(e){return[$o(e),So(e),jo(e),Do(e),Ao(e),Lo(e),Oo(e),To(e)]}var No=/\.(erb|php|hbs|njk|liquid|twig|ejs|pug|cshtml|razor|jinja2?|j2)$/i,ys=/^<([A-Za-z][\w.-]*)\b((?:[^<>"'`{}]|"[^"]*"|'[^']*'|`[^`]*`|\{(?:[^{}]|\{[^{}]*\})*\})*)>/,Po=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]),Vo=new Set(["span","svg","i","img","em","strong","small","b","p","kbd","abbr","sup","sub","picture","use","path"]),Fo=new Set(["classNames","classnames","clsx","cn","cx"]),Bo=/^(?:ref|key|style|dangerouslySetInnerHTML)$/i;function vs(e,t){let n=1;for(let s=0;s<t&&s<e.length;s++)e[s]===`
|
|
29
|
-
`&&n++;return n}function
|
|
30
|
-
`)}function
|
|
31
|
-
`).slice(0,12),a=
|
|
32
|
-
`).length>12;return{source
|
|
33
|
-
\u2026`:""),startLine:o}}function
|
|
34
|
-
`),r=Math.max(0,n-1);return{source:$s(s.slice(r,r+12)),startLine:r+1}}function ks(e,t){return{kind:"other",...Wo(e,t)}}function et(e,t){let n=ys.exec(e.slice(t));if(!n)return null;let s=n[1],r=n[2]??"",o=t+n[0].length;if(/\/\s*$/.test(r)||Po.has(s.toLowerCase()))return{tag:s,attrs:r,openStart:t,openEnd:o,closeEnd:o,body:""};let a=1,l=o,c=Math.min(e.length,t+4e3);for(;l<c;){if(e[l]!=="<"){l++;continue}if(e.startsWith("</",l)){let f=/^<\/([A-Za-z][\w.-]*)\s*>/.exec(e.slice(l));if(f&&f[1].toLowerCase()===s.toLowerCase()){if(a--,a===0){let b=l+f[0].length;return{tag:s,attrs:r,openStart:t,openEnd:o,closeEnd:b,body:e.slice(o,l)}}l+=f?f[0].length:2;continue}l+=f?f[0].length:2;continue}let u=ys.exec(e.slice(l));if(u&&u[1].toLowerCase()===s.toLowerCase()&&!/\/\s*$/.test(u[2]??"")&&(a++,a>6))return"too-big";l+=u?u[0].length:1}return l>=c&&o+(c-t)>=4e3?"too-big":null}function Dt(e,t){let n=Math.max(0,t-8e3),s=Math.min(t,e.length-1);for(;s>=n;){let r=e.lastIndexOf("<",s);if(r<n)return null;if(e[r+1]==="/"||e[r+1]==="!"||e[r+1]==="?"){s=r-1;continue}let o=et(e,r);if(o==="too-big")return"too-big";if(o&&t>=o.openStart&&t<o.closeEnd)return o;s=r-1}return null}function Cs(e){return e.replace(/([a-z\d])([A-Z])/g,"$1-$2").replace(/_/g,"-").toLowerCase()}function ye(e){return e.split(/\s+/).filter(Boolean)}function se(e,t){let n=e[t];if(n!=='"'&&n!=="'"&&n!=="`")return null;let s="";for(let r=t+1;r<e.length;r++){let o=e[r];if(o==="\\"){s+=e[r+1]??"",r++;continue}if(n==="`"&&o==="$"&&e[r+1]==="{")return null;if(o===n)return{value:s,end:r+1};s+=o}return null}function Ss(e){let t=[],n="",s=0,r=null;for(let o=0;o<e.length;o++){let i=e[o];if(r){if(n+=i,i==="\\"){n+=e[o+1]??"",o++;continue}i===r&&(r=null);continue}if(i==='"'||i==="'"||i==="`"){r=i,n+=i;continue}if(i==="("||i==="["||i==="{")s++;else if(i===")"||i==="]"||i==="}")s=Math.max(0,s-1);else if(i===","&&s===0){n.trim()&&t.push(n.trim()),n="";continue}n+=i}return n.trim()&&t.push(n.trim()),t}function Ye(e=new Map,t=new Map){return{values:e,aliases:t,flags:new Set,strings:new Set,prefixes:new Map}}var jt=/^[A-Za-z_$][\w$]*$/;function Ot(e,t){let n=0,s=null;for(let r=0;r<e.length;r++){let o=e[r];if(s){o==="\\"?r++:o===s&&(s=null);continue}if(o==='"'||o==="'"||o==="`"){s=o;continue}if(o==="("||o==="["||o==="{")n++;else if(o===")"||o==="]"||o==="}")n--;else if(n===0&&e.startsWith(t,r))return r}return-1}function Tt(e){let t=e.trim();for(;t.startsWith("(")&&t.endsWith(")");){let n=0,s=!0;for(let r=0;r<t.length-1&&s;r++)t[r]==="("?n++:t[r]===")"&&n--,n===0&&(s=!1);if(!s)break;t=t.slice(1,-1).trim()}return t}function As(e,t,n){if(e==="true")return!0;if(e==="false"||e==="undefined"||e==="null")return!1;let s=t.aliases.get(e);return s!==void 0&&!t.values.has(e)?we(s,t,n+1):(t.flags.add(e),!!t.values.get(e))}function we(e,t,n=0){if(n>4)return null;let s=Tt(e);for(let c of["||","&&"]){let u=Ot(s,c);if(u<0)continue;let f=we(s.slice(0,u),t,n+1),b=we(s.slice(u+2),t,n+1);return f===null||b===null?null:c==="||"?f||b:f&&b}let r=/^(!\s*)?([A-Za-z_$][\w$]*)$/.exec(s);if(r){let c=As(r[2],t,n);return c===null?null:r[1]?!c:c}let o=/^([A-Za-z_$][\w$]*)\s*(===|==|!==|!=)\s*(["'])(.*?)\3$/.exec(s);if(!o)return null;let i=t.values.get(o[1]);typeof i=="string"&&t.strings.add(o[1]);let a=typeof i=="string"?i:"";return o[2]==="==="||o[2]==="=="?a===o[4]:a!==o[4]}function Rs(e){let t=0,n=null,s=-1;for(let r=0;r<e.length;r++){let o=e[r];if(n){o==="\\"?r++:o===n&&(n=null);continue}if(o==='"'||o==="'"||o==="`"){n=o;continue}if(o==="("||o==="["||o==="{")t++;else if(o===")"||o==="]"||o==="}")t--;else if(o==="?"&&t===0){s=r;break}}if(s<0)return null;t=0,n=null;for(let r=s+1;r<e.length;r++){let o=e[r];if(n){o==="\\"?r++:o===n&&(n=null);continue}if(o==='"'||o==="'"||o==="`"){n=o;continue}if(o==="("||o==="["||o==="{")t++;else if(o===")"||o==="]"||o==="}")t--;else if(o===":"&&t===0)return{condition:e.slice(0,s),yes:e.slice(s+1,r),no:e.slice(r+1)}}return null}function xe(e,t=Ye()){let n=Tt(e);if(!n)return{classes:[],dynamic:!1};let s=Rs(n);if(s){let c=we(s.condition,t);return c===null?{classes:[],dynamic:!0}:xe(c?s.yes:s.no,t)}let r=Ot(n,"&&");if(r>=0){let c=we(n.slice(0,r),t);return c===null?{classes:[],dynamic:!0}:c?xe(n.slice(r+2),t):{classes:[],dynamic:!1}}if(n.startsWith('"')&&n.endsWith('"')||n.startsWith("'")&&n.endsWith("'"))return{classes:ye(n.slice(1,-1)),dynamic:!1};if(n.startsWith("`")&&n.endsWith("`")){let c=n.slice(1,-1),u="",f=0;for(;f<c.length;){let b=c.indexOf("${",f);if(b<0){u+=c.slice(f);break}u+=c.slice(f,b);let x=c.indexOf("}",b+2);if(x<0)return{classes:[],dynamic:!0};let d=c.slice(b+2,x).trim();if(jt.test(d)){let y=t.values.get(d);if(typeof y!="string")return{classes:[],dynamic:!0};t.strings.add(d);let k=/[\w-]*$/.exec(u)?.[0];k&&t.prefixes.set(d,k),u+=y}else{let y=xe(d,t);if(y.dynamic)return{classes:[],dynamic:!0};u+=y.classes.join(" ")}f=x+1}return{classes:ye(u),dynamic:!1}}if(jt.test(n)&&t.values.has(n)){let c=t.values.get(n);return typeof c!="string"?{classes:[],dynamic:!1}:(t.strings.add(n),{classes:ye(c),dynamic:!1})}let o=/^(?:styles?|classes|css|cls)\.([A-Za-z_]\w*)$/.exec(n);if(o)return{classes:[Cs(o[1])],dynamic:!1};let i=/^(?:styles?|classes|css|cls)\[\s*["']([\w-]+)["']\s*\]$/.exec(n);if(i)return{classes:[i[1]],dynamic:!1};let a=/^(?:styles?|classes|css|cls)\[\s*(`[^`]*`)\s*\]$/.exec(n);if(a){let c=xe(a[1],t);return c.dynamic||c.classes.length!==1?{classes:[],dynamic:!0}:c}let l=/^([A-Za-z_][\w]*)\s*\(([\s\S]*)\)$/.exec(n);if(l&&Fo.has(l[1])){let c=[];for(let u of Ss(l[2])){let f=xe(u,t);if(f.dynamic)return{classes:[],dynamic:!0};c.push(...f.classes)}return{classes:c,dynamic:!1}}return{classes:[],dynamic:!0}}function tt(e){let t=[],n=!1,s=0;for(;s<e.length;){if(/\s/.test(e[s])){s++;continue}if(e[s]==="{"){let i=0,a=s;for(let l=s;l<e.length;l++)if(e[l]==="{")i++;else if(e[l]==="}"&&(i--,i===0)){s=l+1;break}s===a&&(s=e.length),/^\{\s*\.\.\./.test(e.slice(a))&&(n=!0);continue}let r=/^([A-Za-z_:][\w:.-]*)/.exec(e.slice(s));if(!r){s++;continue}for(s+=r[0].length;s<e.length&&/\s/.test(e[s]);)s++;if(e[s]!=="="){t.push({name:r[1]});continue}for(s++;s<e.length&&/\s/.test(e[s]);)s++;let o=se(e,s);if(o){t.push({name:r[1],value:o.value}),s=o.end;continue}if(e[s]==="{"){let i=0,a=s;for(let u=s;u<e.length;u++)if(e[u]==="{")i++;else if(e[u]==="}"&&(i--,i===0)){s=u+1;break}s===a&&(s=e.length);let l=e.slice(a+1,s-1).trim(),c=se(l,0);c&&c.end===l.length?t.push({name:r[1],value:c.value}):t.push({name:r[1],expr:l});continue}s++}return{list:t,spread:n}}function Nt(e,t){let n=tt(e).list.find(s=>s.name==="class"||s.name==="className");return n?n.value!==void 0?{classes:ye(n.value),dynamic:!1}:n.expr===void 0?{classes:[],dynamic:!0}:xe(n.expr,t):null}function _s(e,t){return/[<>]/.test(t)?!1:e==="href"||e==="src"||e==="action"?/^(?:https?:|mailto:|\/|#)/i.test(t):!0}function Go(e){return e==="class"||e==="className"?!1:!Bo.test(e)&&!/^on/i.test(e)}function Es(e){let t={};for(let n of tt(e).list){if(!Go(n.name)||n.expr!==void 0)continue;let s=n.value??"";_s(n.name,s)&&(t[n.name]=s)}return t}var Uo=/^(?:data-[\w-]+|aria-[\w-]+|disabled|hidden)$/,Ho=new Set(["disabled","hidden"]);function qe(e,t,n=0){if(n>4)return null;let s=Tt(e),r=se(s,0);if(r&&r.end===s.length)return r.value;let o=Rs(s);if(o){let l=we(o.condition,t);return l===null?null:qe(l?o.yes:o.no,t,n+1)}let i=Ot(s,"||");if(i>=0){let l=qe(s.slice(0,i),t,n+1);return l===null?null:l!==void 0?l:qe(s.slice(i+2),t,n+1)}if(s==="undefined"||s==="null"||s==="false")return;if(s==="true")return"true";if(!jt.test(s))return null;let a=t.values.get(s);if(typeof a=="string")return t.strings.add(s),a;if(typeof a=="boolean"||t.aliases.has(s)){let l=As(s,t,n);return l===null?null:l?"true":void 0}return t.values.has(s)?void 0:null}function Ko(e,t){let n={};for(let s of tt(e).list){if(s.expr===void 0||!Uo.test(s.name))continue;let r=qe(s.expr,t);if(r!=null){if(Ho.has(s.name)){r!=="false"&&(n[s.name]="");continue}_s(s.name,r)&&(n[s.name]=r)}}return n}function Jo(e,t){let n=/([A-Za-z_][\w-]*)\s*=\s*(?:"([^"]*)"|'([^']*)'|\{\s*["']([^"']*)["']\s*\})/g;for(let s of e.matchAll(n)){let r=s.index??0;if(t>=r&&t<r+s[0].length){let o=s[1];return o==="class"||o==="className"?{}:{prop:o,value:s[2]??s[3]??s[4]}}}return{}}function Qe(e,t=0){if(t>6)return"";let n="",s=0;for(;s<e.length;){if(e[s]==="{"){let i=0,a=s;for(let u=s;u<e.length;u++)if(e[u]==="{")i++;else if(e[u]==="}"&&(i--,i===0)){a=u+1;break}if(a===s)break;let l=e.slice(s+1,a-1).trim();/^[A-Za-z_$][\w$]*$/.exec(l)?.[0]&&(n+='<span class="__gs-slot">Text</span>'),s=a;continue}if(e[s]==="<"){if(e.startsWith("<!--",s)){let l=e.indexOf("-->",s);s=l===-1?e.length:l+3;continue}if(e.startsWith("</",s)){let l=/^<\/[A-Za-z][\w.-]*\s*>/.exec(e.slice(s));s+=l?l[0].length:1;continue}let i=et(e,s);if(!i||i==="too-big"){s++;continue}let a=i.tag.toLowerCase();if(/^[A-Z]/.test(i.tag))n+=Qe(i.body,t+1);else if(Vo.has(a)){let l=Nt(i.attrs),c=l&&!l.dynamic&&l.classes.length?` class="${ws(l.classes.join(" "))}"`:"",u=Qe(i.body,t+1);n+=`<${a}${c}>${u}</${a}>`}s=i.closeEnd;continue}let r=e.slice(s).search(/[<{}]/),o=r===-1?e.length:s+r;n+=ws(e.slice(s,o)),s=o}return n}function Zo(e){let t=Nt(e.attrs);return!t||t.dynamic||t.classes.length===0?null:{tag:e.tag.toLowerCase(),classes:t.classes,attrs:Es(e.attrs)}}function Ms(e,t){let n=[],s=t-1;for(;n.length<3&&s>=0;){let r=Dt(e,s);if(!r||r==="too-big"||/^[A-Z]/.test(r.tag))break;let o=Zo(r);if(!o)break;n.push(o),s=r.openStart-1}return n.reverse()}var Xo=8;function qo(e){let t=e.trim(),n=se(t,0);return n&&n.end===t.length?n.value:t==="true"?!0:t==="false"?!1:/^-?\d+(?:\.\d+)?$/.test(t)?t:null}function Yo(e,t){let n=0,s=-1;for(let i=t;i<e.length&&i<t+2e3;i++){let a=e[i];if(a==='"'||a==="'"||a==="`"){let l=se(e,i);if(!l)return null;i=l.end-1;continue}if(a==="{")n++;else if(a==="}"&&(n--,n===0)){s=i;break}}if(s<0)return null;let r=e.slice(s+1).trimStart()[0];if(r!==")"&&r!==":")return null;let o=new Map;for(let i of Ss(e.slice(t+1,s))){if(i.startsWith("..."))continue;let a=/^([A-Za-z_$][\w$]*)(?:\s*:\s*([A-Za-z_$][\w$]*))?(?:\s*=\s*([\s\S]+))?$/.exec(i);if(!a)continue;let l=a[2]??a[1];if(a[3]===void 0){o.set(l,void 0);continue}let c=qo(a[3]);c!==null&&o.set(l,c)}return{values:o,end:s}}function Qo(e,t){let n=new Set(t.attrs.match(/[A-Za-z_$][\w$]*/g)??[]),s=Math.max(0,t.openStart-8e3),o=[...e.slice(s,t.openStart).matchAll(/\(\s*\{/g)].reverse();for(let i of o){let a=s+(i.index??0)+i[0].length-1,l=Yo(e,a);if(!l||![...l.values.keys()].some(f=>n.has(f)))continue;let c=new Map,u=e.slice(l.end,t.openStart);for(let f of u.matchAll(/\bconst\s+([A-Za-z_$][\w$]*)\s*=\s*([^;\n]+);/g))n.has(f[1])&&c.set(f[1],f[2].trim());return Ye(l.values,c)}return Ye()}function ei(e,t){let n=new Map;for(let s of e.matchAll(/([\w-]+)\$\{\s*([A-Za-z_$][\w$]*)\s*\}/g)){let r=s[1],o=t.find(i=>i.startsWith(r)&&i.length>r.length);o&&n.set(s[2],o.slice(r.length))}return n}function ti(e,t,n,s){let r=zo(e,t.openStart,t.closeEnd);if(/^[A-Z]/.test(t.tag)){let b=Jo(e.slice(t.openStart,t.openEnd),n-t.openStart);return{kind:"component",...r,component:{tag:t.tag,...b}}}let o=Qo(e,t);for(let[b,x]of ei(t.attrs,s))o.values.set(b,x);let i={};for(let[b,x]of o.values)i[b]=x??null;let a={attrs:t.attrs,values:i,aliases:Object.fromEntries(o.aliases)},l=Ye(new Map(o.values),o.aliases),c=ni(a.attrs,l);if(!c)return{kind:"dynamic",...r};let u={tag:t.tag.toLowerCase(),...c,ancestors:Ms(e,t.openStart),bodyHtml:Qe(t.body)},f=[...[...l.strings].filter(b=>typeof o.values.get(b)=="string").map(b=>({name:b,kind:"text",...l.prefixes.has(b)?{prefix:l.prefixes.get(b)}:{}})),...[...l.flags].slice(0,Xo).map(b=>({name:b,kind:"flag"}))];return f.length===0?{kind:"markup",...r,element:u}:{kind:"markup",...r,element:u,params:f,redraw:a}}function ni(e,t){let n=Nt(e,t);return n?.dynamic?null:{classes:n?.classes??[],attrs:{...Es(e),...Ko(e,t)}}}function Pt(e,t,n,s){if(No.test(s))return ks(e,t);let r=Dt(e,t);return r==="too-big"||!r?ks(e,t):ti(e,r,t,n)}function si(e){let t={},n=new Set,{list:s,spread:r}=tt(e);for(let o of s)o.expr===void 0?t[o.name]=o.value??"true":o.expr==="true"||o.expr==="false"?t[o.name]=o.expr:n.add(o.name);return{literals:t,dynamic:n,spread:r}}function Is(e,t){let n=si(t),s=new Map,r=[],o=[],i=n.spread;for(let a of e.axes){if(a.opaque){i=!0;continue}if(!a.locked&&n.dynamic.has(a.prop)){i=!0;continue}let l=a.locked?a.defaultValue:n.literals[a.prop]??(n.spread?void 0:a.defaultValue);if(l===void 0)continue;if(s.set(a.prop,l),a.prefix){o.push(`${a.prefix}${l}`);continue}let c=a.values.find(u=>u.value===l);if(!c){i=!0;continue}for(let u of c.classes)u.startsWith("__gs-recipe-")&&r.push(u),o.push(u)}if(!i){for(let a of e.compounds)if(a.when.every(c=>s.get(c.prop)===c.value))for(let c of a.classes)c.startsWith("__gs-recipe-")&&r.push(c),o.push(c)}return e.classNameProp&&(n.dynamic.has("className")?i=!0:n.literals.className&&o.push(...ye(n.literals.className))),{draw:i?null:[...e.staticClasses,...o],selects:r}}function Vt(e){let t=[],n=/import\s*\{([^}]+)\}\s*from\s*["']([^"']+)["']/g;for(let s of e.matchAll(n)){let r=s[2];for(let o of s[1].split(",")){let i=o.trim().split(/\s+as\s+/),a=i[0]?.trim(),l=(i[1]??i[0])?.trim();a&&l&&t.push({local:l,imported:a,spec:r})}}return t}function ri(e,t,n,s,r){for(let o of Vt(t)){if(o.local!==n)continue;let i=r(e,o.spec),a=s.find(l=>l.path===i&&l.component===o.imported);if(a)return a}return s.find(o=>o.path===e&&o.component===n)}function Ls(e,t,n,s,r,o){if(e.kind!=="component"||!e.component||r.length===0)return e;let i=ri(s,t,e.component.tag,r,o);if(!i)return e;let a=Dt(t,n),l=e.component.tag;if(!a||a==="too-big"||a.tag!==l&&a.tag!==i.component)return e;let c=Is(i,a.attrs);return c.draw?{kind:"markup",source:e.source,startLine:e.startLine,component:e.component,element:{tag:i.rootTag,classes:c.draw,attrs:{},ancestors:Ms(t,a.openStart),bodyHtml:Qe(a.body)}}:e}function js(e,t,n,s){let r=[],o=new Set,i=(l,c)=>{let u=`${l}\0${c.path}`;o.has(u)||(o.add(u),r.push({local:l,binding:c}))};for(let l of Vt(t)){let c=s(e,l.spec),u=n.find(f=>f.path===c&&f.component===l.imported);u&&i(l.local,u)}for(let l of n)l.path===e&&i(l.component,l);let a=[];for(let{local:l,binding:c}of r){let u=0,f=`<${l}`;for(;u<t.length;){let b=t.indexOf(f,u);if(b<0)break;let x=t[b+f.length];if(x&&/[\w.]/.test(x)){u=b+f.length;continue}let d=et(t,b);if(!d||d==="too-big"){u=b+f.length;continue}let y=Is(c,d.attrs);y.selects.length&&a.push({offset:b,selects:y.selects}),u=Math.max(d.closeEnd,b+f.length)}}return a}function oi(e,t){let n=e.slice(t,t+700),s=n.indexOf("{");if(s<0)return{};let r=n.indexOf("}",s),o=n.slice(s,r<0?s+400:r+1),i={};for(let a of o.matchAll(/([A-Za-z_$][\w$]*)\s*=\s*(?:"([^"]*)"|'([^']*)')/g))i[a[1]]=a[2]??a[3]??"";return i}function ii(e){let t=/\bclassName\s*=\s*/.exec(e);if(!t)return null;let n=t.index+t[0].length,s=se(e,n);if(s)return s.value;if(e[n]!=="{")return null;let r=0;for(let o=n;o<e.length;o++)if(e[o]==="{")r++;else if(e[o]==="}"&&(r--,r===0))return e.slice(n+1,o);return null}function ai(e,t){let n=t+1;for(;n<e.length&&/\s/.test(e[n]);)n++;if(e[n]===")")return{rename:{},fixed:{},opaque:[]};if(e[n]!=="{")return null;let s={rename:{},fixed:{},opaque:[]};for(n++;n<e.length;){for(;n<e.length&&/[\s,]/.test(e[n]);)n++;if(e[n]==="}")return s;if(e.startsWith("...",n))return null;let r=/^[A-Za-z_$][\w$]*/.exec(e.slice(n));if(!r)return null;for(n+=r[0].length;n<e.length&&/\s/.test(e[n]);)n++;if(e[n]===","||e[n]==="}"){s.rename[r[0]]=r[0];continue}if(e[n]!==":")return null;for(n++;n<e.length&&/\s/.test(e[n]);)n++;let o=se(e,n);if(o){s.fixed[r[0]]=o.value,n=o.end;continue}let i=/^[A-Za-z_$][\w$]*/.exec(e.slice(n));if(i){s.rename[r[0]]=i[0],n+=i[0].length;continue}s.opaque.push(r[0]);let a=0;for(;n<e.length;){let l=e[n];if(l==='"'||l==="'"||l==="`"){let c=se(e,n);if(!c)return null;n=c.end;continue}if(l==="("||l==="["||l==="{")a++;else if(l===")"||l==="]"||l==="}"){if(a===0)break;a--}else if(l===","&&a===0)break;n++}}return null}function li(e,t,n,s){let r=[];for(let o of Vt(e)){let i=s(t,o.spec),a=n.find(l=>l.path===i&&l.name===o.imported);a&&r.push({local:o.local,recipe:a})}for(let o of n)o.path===t&&o.name&&r.push({local:o.name,recipe:o});return r}function ci(e){let t=[],n=/(?:styles?|classes|css|cls)\s*\.\s*([A-Za-z_]\w*)/g;for(let l of e.matchAll(n))t.push({at:l.index??0,kind:"static",text:Cs(l[1])});let s=/(?:styles?|classes|css|cls)\s*\[\s*["']([^"']+)["']\s*\]/g;for(let l of e.matchAll(s))t.push({at:l.index??0,kind:"static",text:l[1]});let r=/(?:styles?|classes|css|cls)\s*\[\s*`([^`$]*)\$\{\s*([A-Za-z_$][\w$]*)\s*\}`\s*\]/g;for(let l of e.matchAll(r))t.push({at:l.index??0,kind:"prefix",text:l[1],prop:l[2]});/[[{(]/.test(e)||t.push({at:0,kind:"static",text:e.trim()}),t.sort((l,c)=>l.at-c.at);let o=[],i=[];for(let l of t)l.kind==="prefix"&&l.prop?i.push({prop:l.prop,prefix:l.text}):o.push(...ye(l.text));let a=/(?:^|[(,\s])className\s*(?:[,)]|$)/.test(e);return{staticClasses:o,prefixes:i,classNameProp:a}}function ui(e,t,n,s,r){let o=l=>t.rename[l]??l,i=e.axes.map(l=>{let c=t.fixed[l.prop],u=o(l.prop);return{prop:u,values:c?l.values.filter(f=>f.value===c):l.values,defaultValue:c??n[u]??l.defaultValue,opaque:t.opaque.includes(l.prop),locked:!!c}}),a=e.compounds.map(l=>({classes:l.classes,when:l.when.map(c=>({prop:o(c.prop),value:t.fixed[c.prop]??c.value}))}));return{staticClasses:[...e.staticClasses,...s],axes:i,compounds:a,classNameProp:r}}function Ds(e,t,n){let s=[];for(let r of e){let o=li(r.source,r.path,t,n);for(let i of r.names){let a=new RegExp(`(?:function\\s+${i}\\b|(?:const|let|var)\\s+${i}\\b)`,"g"),l=[...r.source.matchAll(a)],c=null;for(let u of l){let f=u.index??0,x=r.source.slice(f+u[0].length).search(/\nexport\s/),d=r.source.slice(f,f+u[0].length+(x<0?8e3:x)),y=oi(r.source,f),k=0;for(;k<d.length;){if(d[k]!=="<"||d[k+1]==="/"||d[k+1]==="!"){k++;continue}let p=et(d,k);if(!p||p==="too-big"){k++;continue}if(k=p.openEnd,/^[A-Z]/.test(p.tag))continue;let m=ii(p.attrs);if(!m)continue;let g=ci(m),w=g.prefixes.length?2:g.staticClasses.length?1:0,$=null,v=o.find(C=>new RegExp(`(?:^|[^\\w$])${C.local}\\s*\\(`).test(m));if(v){let C=m.search(new RegExp(`(?:^|[^\\w$])${v.local}\\s*\\(`)),I=m.indexOf("(",C),M=I<0?null:ai(m,I);if(M){w=3,$=ui(v.recipe,M,y,g.staticClasses,g.classNameProp);for(let E of g.prefixes)$.axes.push({prop:E.prop,values:[],prefix:E.prefix,defaultValue:y[E.prop]})}}!$&&(g.prefixes.length||g.staticClasses.length)&&($={staticClasses:g.staticClasses,axes:g.prefixes.map(C=>({prop:C.prop,values:[],prefix:C.prefix,defaultValue:y[C.prop]})),compounds:[],classNameProp:g.classNameProp}),$&&(!c||w>c.score)&&(c={score:w,tag:p.tag.toLowerCase(),body:$})}}c&&s.push({component:i,path:r.path,rootTag:c.tag,...c.body})}}return s}var fi=/<([A-Za-z][\w.-]*)\b((?:[^<>"'`{}]|"[^"]*"|'[^']*'|`[^`]*`|\{(?:[^{}]|\{[^{}]*\})*\})*)>/g,pi=/\b(?:styles?|classes|css|cls)\s*(?:\.([A-Za-z_]\w*)|\[\s*["']([\w-]+)["']\s*\])/g,di=new Set(["span","svg","i","img","em","strong","small","b","p","kbd","abbr","sup","sub","picture","use","path"]),gi=new Set(["icon","glyph","svg"]),mi=new Set(["label","text","title","caption"]),hi=e=>e.replace(/([a-z\d])([A-Z])/g,"$1-$2").split(/[^a-z0-9]+/i).filter(Boolean).map(t=>t.toLowerCase());function Ts(e){let t=e.flatMap(hi);return t.some(n=>gi.has(n))?"icon":t.some(n=>mi.has(n))?"label":null}function bi(e){let t=e.replace(/\{\s*\/\*[\s\S]*?\*\/\s*\}/g," "),n=[];for(let s of t.matchAll(fi)){let r=s[1];if(!di.has(r.toLowerCase())||r!==r.toLowerCase())continue;let o=[...s[2].matchAll(pi)].map(a=>a[1]??a[2]),i=Ts(o);i&&n.push({index:s.index??0,role:i,tag:r.toLowerCase(),classes:o})}return n}function xi(e,t,n){if(!t.some(r=>r.property.toLowerCase()==="display"&&/^none\b/i.test(r.value.trim()))||n.size===0)return null;for(let r of V(e)){let o=J(r);if(!o||o.length<2)continue;let i=o[o.length-1];if(i.combinator!==" "&&i.combinator!==">")continue;let a=i.simples.filter(b=>b.kind==="class");if(a.length!==1||a[0].kind!=="class"||!n.has(a[0].name))continue;let l=o[o.length-2];if(l.simples.filter(b=>b.kind!=="class"&&b.kind!=="attr"&&b.kind!=="tag").length>0)continue;let u=l.simples.filter(b=>b.kind==="class"),f=l.simples.filter(b=>b.kind==="attr");if(u.length===1&&f.length===0&&u[0].kind==="class"&&!/^(?:is|has)-/.test(u[0].name))return{classes:[u[0].name],attrs:{}};if(u.length===0&&f.length===1&&f[0].kind==="attr"&&f[0].value)return{classes:[],attrs:{[f[0].name]:f[0].value}}}return null}var yi=["text","icon-start","icon-end","icon"],Os={text:"Text","icon-start":"Icon left","icon-end":"Icon right",icon:"Icon"};function wi(e,t){let n=null,s=null;for(let i of t)i.index<e.index?n=i:s||(s=i);if(!n&&!s)return null;let r=n?e.index-n.index:1/0;return(s?s.index-e.index:1/0)<=r?"start":"end"}function ke(e){return{role:e.role,tag:e.tag,classes:e.classes}}function Ns(e){let t=new Map,n=(s,r)=>{let o=t.get(s)??[];o.some(i=>i.path===r.path)||o.push(r),t.set(s,o)};for(let s of e){let r=s.sources.flatMap(bi),o=r.filter(x=>x.role==="label"),i=r.filter(x=>x.role==="icon"),a=o[0];a&&n("text",{path:s.sheet,slots:[ke(a)],classes:[],attrs:{}});let l=new Set(o.flatMap(x=>x.classes.filter(d=>Ts([d])==="label"))),c=null,u=null;for(let x of i){let d=wi(x,o),y=o.reduce((k,p)=>{let m=Math.abs(p.index-x.index);return!k||m<k.dist?{hit:p,dist:m}:k},null);d==="start"&&y&&!c&&(c={icon:x,label:y.hit}),d==="end"&&y&&!u&&(u={icon:x,label:y.hit})}c&&n("icon-start",{path:s.sheet,slots:[ke(c.icon),ke(c.label)],classes:[],attrs:{}}),u&&n("icon-end",{path:s.sheet,slots:[ke(u.label),ke(u.icon)],classes:[],attrs:{}});let f=null;for(let x of s.rules)if(f=xi(x.selector,x.declarations,l),f)break;let b=c?.icon??u?.icon??i[0]??null;f&&b&&n("icon",{path:s.sheet,slots:[ke(b)],classes:f.classes,attrs:f.attrs})}return[{id:"text",label:Os.text,sheets:t.get("text")??[]},...yi.filter(s=>s!=="text"&&t.has(s)).map(s=>({id:s,label:Os[s],sheets:t.get(s)??[]}))]}function ki(e,t){if(!e)return t;let n=V(e);return V(t).flatMap(s=>n.map(r=>s.includes("&")?s.replaceAll("&",r):`${r} ${s}`)).join(", ")}var vi=/^@(?:-\w+-)?(?:keyframes|font-face|property)\b/i;function pe(e){let t=e.replace(/\/\*[\s\S]*?\*\//g,i=>i.replace(/[^\n]/g," ")),n=[],s=[],r=0,o=1;for(let i=0;i<t.length;i++){let a=t[i];if(a===`
|
|
35
|
-
`&&o++,a==="{"){let l=
|
|
36
|
-
`),n=[],s=[],r=null,o=null,i=0;if(
|
|
37
|
-
`).trimEnd(),headings:r.headings}),r=null)};for(;i<t.length;i++){let l=t[i],c=i+1,u=/^\s*(```|~~~)/.exec(l)?.[1];if(o){r.lines.push(l),u===o&&(o=null,a(c));continue}if(u){a(c-1),o=u,r={start:c,lines:[l],headings:[...s]};continue}let f=/^(#{1,6})\s+(.+?)\s*#*\s*$/.exec(l);if(f){a(c-1),s=[...s.slice(0,f[1].length-1),f[2]];continue}if(l.trim()===""){a(c-1);continue}r??={start:c,lines:[],headings:[...s]},r.lines.push(l)}return a(t.length),n}function Ri(e,t){let n=e.map(ee).join("|"),s=e.map(r=>ee(r.charAt(0).toUpperCase()+r.slice(1))).join("|");return new RegExp(`${t.source}|\\b(?:${n})s?\\b|[a-z](?:${s})s?\\b|\\b(?:${n})[-_]|[-_](?:${n})\\b`,"i")}function _i(e,t){let n=t.map(ee).join("|"),s=new Map;for(let r of e){if(r.base||r.title==="Unnamed"||r.title.startsWith("In ")||!r.element)continue;let i=s.get(r.title)??{title:r.title,tests:[],heading:null},a=r.selector.slice(fe(r.selector));for(let l of a.matchAll(/\.((?:\\.|[\w-])+)/g)){let c=l[1].replace(/\\(.)/g,"$1");if(t.includes(c.toLowerCase()))continue;let u=/[-_]|[a-z][A-Z]/.test(c);i.tests.push(new RegExp(u?`(?<![\\w-])${ee(c)}(?![\\w-])`:`(?:\\.|["'\`])${ee(c)}(?![\\w-])`))}if(!r.title.includes(" + ")){let l=r.title.toLowerCase().split(/\s+/).map(ee).join("[\\s_-]+");i.tests.push(new RegExp(`\\b${l}[\\s_-]+(?:${n})s?\\b|\\b(?:${n})s?[_-]+${l}\\b`,"i")),r.axis&&/^[a-z]+$/i.test(r.title)&&i.tests.push(new RegExp(`\\b${ee(r.axis)}\\s*[=:]\\s*\\{?\\s*["'\`]${ee(r.title.toLowerCase())}["'\`]`,"i")),i.heading=r.title.toLowerCase()}s.set(r.title,i)}return[...s.values()]}function Ei(e,t){return e.toLowerCase().replace(new RegExp(`\\b(?:${t.map(ee).join("|")})s?\\b`,"g")," ").replace(/[^a-z0-9]+/g," ").trim()}function Mi(e){return e.length>Ps?`${e.slice(0,Ps).trimEnd()}\u2026`:e}function Vs(e,t,n,s){let r=Ri(n.classKeywords,n.prose),o=_i(s,n.classKeywords),i=new Set,a=[];for(let u of t){let f=e.get(u.path);if(f===void 0)continue;let b=[];for(let x of Ai(f)){if(!r.test(x.text)&&!x.headings.some(k=>r.test(k)))continue;let d=x.headings.length?Ei(x.headings[x.headings.length-1],n.classKeywords):"",y=o.filter(k=>k.tests.some(p=>p.test(x.text))||d!==""&&k.heading===d).map(k=>k.title);for(let k of y)i.add(k);b.push({path:u.path,line:x.start,endLine:x.end,headings:x.headings,text:Mi(x.text),rule:Si.test(x.text),styles:y})}b.length!==0&&a.push({path:u.path,kind:u.kind,passages:b.slice(0,Ci),total:b.length,rules:b.filter(x=>x.rule).length})}let l={instruction:0,documentation:1,record:2};a.sort((u,f)=>l[u.kind]-l[f.kind]||f.rules-u.rules||f.total-u.total||u.path.localeCompare(f.path));let c=new Map;for(let u of s)u.element&&!u.base&&u.title!=="Unnamed"&&!u.title.startsWith("In ")&&c.set(u.title,!0);return{files:a.slice(0,$i).map(({rules:u,...f})=>f),documented:[...i].sort(),undocumented:[...c.keys()].filter(u=>!i.has(u))}}var Ii=new Set(["display","position","inset","top","right","bottom","left","z-index","order","flex","flex-grow","flex-shrink","flex-basis","align-self","justify-self","align-items","justify-content","place-items","place-content","gap","text-align","min-width","max-width","overflow","white-space","cursor"]),Li=new Set(["page","index","layout","route","default"]);function ji(e){return Ii.has(e.property)||/^(margin|transition|grid-)/.test(e.property)?!0:(e.property==="width"||e.property==="height")&&/^(100%|auto)$/.test(e.value)}function Di(e){return e.states.flatMap(t=>t.declarations.filter(n=>!ji(n)).map(n=>`${t.state}|${t.context}|${n.property}:${n.value}`)).sort().join(";")}function Oi(e){return e.states.filter(t=>t.state==="default"&&t.context==="").flatMap(t=>t.declarations)}function Fs(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Ti(e){let t=e.via?/^bg-([\w-]+?)(?:\/(\d+))?$/.exec(e.via):null;if(t){let s=t[1].replace(/-/g," ");return Fs(t[2]?`${s} ${t[2]}%`:s)}let n=/var\(\s*--(?:color-)?([\w-]+)/.exec(e.value)?.[1];return Fs((n??e.value).replace(/-/g," "))}function Ni(e){let t=Oi(e),n=u=>t.findLast(f=>f.property===u),s=n("background-color")??n("background"),r=s!==void 0&&!/^(transparent|none|initial|inherit)\b/.test(s.value),o=n("border-width")?.value,i=o!==void 0&&!/^0(px)?$/.test(o)&&n("border-style")?.value!=="none",a=n("width")?.value,l=a!==void 0&&a===n("height")?.value&&!/^(auto|100%|fit-content)$/.test(a);return n("inset")?.value==="0"?"Overlay":i?l?"Outline icon":"Outline":r?`${Ti(s)} ${l?"icon":"fill"}`:l?"Icon":t.some(u=>u.property.startsWith("padding")||u.property==="border-radius"||u.property==="height"&&u.value!=="auto")?"Ghost":"Text"}function Pi(e){let t=e.split("/"),n=(t.pop()??e).replace(/\.[^.]+$/,""),s=t.pop();return Li.has(n)&&s?`${s}/${n}`:n}function Vi(e){let t=[...new Set(e.map(s=>Pi(s.path)))],n=t.slice(0,2).join(", ");return t.length>2?`${n} +${t.length-2}`:n}var Bs=(e,t)=>e.path.localeCompare(t.path)||e.line-t.line;function zs(e){let t=new Map;for(let r of e){let o=Ni(r.variant),i=t.get(o)??new Map,a=Di(r.variant),l=i.get(a)??{looks:[],sites:[]};l.looks.push(r.variant),l.sites.push(...r.sites),i.set(a,l),t.set(o,i)}let n=[],s=new Map;for(let[r,o]of t){let i=[...o.values()];for(let x of i)x.sites.sort(Bs);i.sort((x,d)=>d.sites.length-x.sites.length||Bs(x.sites[0],d.sites[0]));let[a,...l]=i,c=a.looks[0],u=l.map(x=>Vi(x.sites)),f=l.map((x,d)=>{let y=x.looks[0],p={title:u.filter(m=>m===u[d]).length>1?`${u[d]} \xB7 line ${x.sites[0].line}`:u[d],selector:y.selector,path:x.sites[0].path,line:x.sites[0].line,element:y.element,usage:y.usage,states:y.states,alike:!0};return s.set(p,x.sites),p}),b={...c,title:r,axis:null,base:!1,path:a.sites[0].path,line:a.sites[0].line,...f.length?{modifiers:f}:{}};s.set(b,a.sites),n.push(b)}return{variants:n,sites:s}}var Ws=new Set(["tone","size","variant","kind","type","style","theme","color","colour","appearance","intent","emphasis","shape","level"]),Fi=new Set(["is","has","js","c","component","comp","el","ui","the","root"]),Bi={xs:["extra","small"],sm:["small"],md:["medium"],lg:["large"],xl:["extra","large"],xxl:["extra","extra","large"]},zi=new Set(["cta","ui","ux","faq","cms","api","url","ios"]);function Bt(e){return e.replace(/\\(.)/g,"$1").replace(/([a-z\d])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").split(/[^A-Za-z0-9]+/).filter(Boolean).map(t=>t.toLowerCase())}function Wi(e){return new Set(e.flatMap(t=>[t,`${t}s`]))}function Ft(e){let t=e.map(n=>zi.has(n)?n.toUpperCase():n).join(" ");return t.charAt(0).toUpperCase()+t.slice(1)}function ve(e,t){let n=Bt(e).filter(r=>!t.has(r)&&!Fi.has(r)),s=null;return n.length>1&&Ws.has(n[0])&&(s=n[0],n=n.slice(1)),{words:n.flatMap(r=>Bi[r]??[r]),axis:s}}var Gs=/\.((?:\\.|[\w-])+)/g,Gi=/\[\s*([\w-]+)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\]\s]*))\s*\]/g;function Ui(e,t){let n=e.split("/"),s=(n.pop()??"").replace(/(\.module)?\.[a-z]+$/i,""),r=n.pop()??"";return Bt(s).some(a=>t.has(a))||Bt(r).some(a=>t.has(a))?ve(s,t).words:[]}function Hi(e,t){let n=[];for(let s of e.split(/[\s>+~]+/).filter(Boolean)){let r=[...s.matchAll(Gs)].map(o=>o[1]);if(r.length)for(let o of r)n.push(...ve(o,t).words);else{let o=/^[a-z][\w-]*/i.exec(s)?.[0]?.toLowerCase();o&&!["div","span","html","body"].includes(o)&&n.push(...ve(o,t).words)}}return n}function $e(e,t){let n=Wi(t),s=fe(e.selector),r=e.selector.slice(0,s),o=e.selector.slice(s),i=[...o.matchAll(Gs)].map(u=>ve(u[1],n));for(let u of o.matchAll(Gi)){let f=u[1].replace(/^data-/,"").toLowerCase();if(!Ws.has(f))continue;let b=u[2]??u[3]??u[4]??"",x=ve(b,n);i.push({words:x.words,axis:f})}let a=i.filter(u=>u.words.length>0);if(a.length>0)return{title:a.map(u=>Ft(u.words)).join(" + "),axis:a.length===1?a[0].axis:null};let l=Hi(r,n);if(l.length>0)return{title:`In ${l.join(" ")}`,axis:null};let c=Ui(e.path,n);if(c.length>0)return{title:Ft(c),axis:null};if(e.base){let u=Ki(e.path,n);return u.length>0?{title:`${Ft(u)} Base`,axis:null}:{title:"Base",axis:null}}return{title:"Unnamed",axis:null}}function Ki(e,t){let n=e.split("/").pop()??"";if(!/\.module\.[a-z]+$/i.test(n))return[];let s=n.replace(/\.module\.[a-z]+$/i,"");return ve(s,t).words}var Ji=60;function Te(e,t,n){let s=J(e);if(!s)return null;let r=s.length-1,o=s[r].simples;if(os(o)||_t(o,t))return null;if(Ke(o,t))return{compounds:s,at:r};for(let i=r-1;i>=0;i--){let a=s[i].simples;if(Ke(a,t)&&!_t(a,t))return{compounds:s,at:i}}return!n||r===0&&is(o)?null:{compounds:s,at:0}}function Us(e,t,n){return De([...e,{combinator:e.length?t.combinator:null,simples:n}])}function Hs(e,t){return e.kind!==t.kind?!1:e.kind==="attr"&&t.kind==="attr"?e.name===t.name&&e.op===t.op&&e.value===t.value:e.raw===t.raw}function Zi(e,t){return e.length>=t.length?!1:e.every(n=>t.some(s=>Hs(n,s)))}function Xi(e,t){if(e.length!==1)return!1;let n=e[0];return n.kind==="tag"?t.elements.includes(n.name):n.kind==="class"?t.classKeywords.some(s=>s.toLowerCase()===n.name.toLowerCase()):!1}function qi(e,t){for(let n of t.classes)e.classes.includes(n)||e.classes.push(n);Object.assign(e.attrs,t.attrs)}function Ks(e){let t=new Set(e.map(n=>Oe(n.property)).filter(n=>n!=="hint"));return t.size===0||t.size===1&&t.has("layout")?"placement":t.size===1&&t.has("paint")?"effect":"override"}function Yi(e){let t=e.filter(o=>o.context===""),n=t.length?t:e;if(n.some(o=>o.state==="default"))return null;let r=[...n.map(o=>new Set(o.state.split(" + "))).reduce((o,i)=>o?new Set([...o].filter(a=>i.has(a))):i,null)??[]].filter(o=>W(o)===He.length);return r.length===1?r[0]:null}function zt(e){return e.sort((t,n)=>+(t.context!=="")-+(n.context!=="")||W(t.state.split(" + ")[0])-W(n.state.split(" + ")[0])||t.state.localeCompare(n.state))}function Js(e,t,n,s,r={parts:new Set,controls:new Set}){let o=new Map,i=[];for(let p of t)if(p.declarations.length!==0)for(let m of V(p.selector)){let g=Te(m,n,s);if(!g)continue;let{compounds:w,at:$}=g,v=w[$],C=Je(v.simples);if(C.identity.length===0)continue;let I=w.slice(0,$),M=Us(I,v,C.identity),E=ue(C.states);if($<w.length-1){i.push({hostKey:M,part:{selector:De(w),path:e,line:p.line,state:E}});continue}if(ls(C.identity,p.declarations))continue;let A=o.get(M);if(!A){if(o.size>=Ji)continue;A={key:M,prefix:I,identity:C.identity,line:p.line,states:[],modifiers:[],contexts:[],parts:[],movedInto:null},o.set(M,A)}let L=A.states.find(O=>O.state===E&&O.context===p.context);L||(L={state:E,context:p.context,line:p.line,declarations:[]},C.states.length&&(L.marker={classes:[],attrs:{}}),A.states.push(L)),L.marker&&qi(L.marker,C.marker),L.declarations.push(...p.declarations)}for(let[p,m]of o){let g=m.states.flatMap(v=>v.declarations),w=m.states.every(v=>Xe(v.declarations)),$=g.every(v=>Oe(v.property)==="hint");(w||$)&&o.delete(p)}let a=new Map;for(let p of o.values()){let m=je(p.identity);a.set(m,[...a.get(m)??[],p])}for(let p of a.values()){let m=p.map(v=>Yi(v.states)),g=m[0];if(!g||m.some(v=>v!==g))continue;let w=p.flatMap(v=>v.states).find(v=>v.marker&&v.state.split(" + ").includes(g))?.marker;if(!w)continue;let $=[...w.classes.map(v=>({kind:"class",raw:`.${v}`,name:v})),...Object.entries(w.attrs).map(([v,C])=>({kind:"attr",raw:`[${v}="${C}"]`,name:v,op:"=",value:C}))];for(let v of p){let C=[...v.identity,...$],I={combinator:v.prefix.length?" ":null,simples:C},M=Us(v.prefix,I,C);for(let E of v.states){let A=E.state.split(" + ").filter(L=>L!==g);if(E.state=ue(A),A.length===0)delete E.marker;else if(E.marker){E.marker.classes=E.marker.classes.filter(L=>!w.classes.includes(L));for(let L of Object.keys(w.attrs))delete E.marker.attrs[L]}}o.delete(v.key),o.set(M,{...v,key:M,identity:C})}}let l=()=>[...o.values()].filter(p=>p.prefix.length===0),c=p=>p.states.filter(m=>m.state==="default").reduce((m,g)=>m+g.declarations.length,0),u=l().find(p=>Xi(p.identity,n))??(s?l().filter(p=>{let m=p.identity.length===1?p.identity[0]:null;return m?.kind==="class"&&r.controls.has(m.name)}).sort((p,m)=>c(m)-c(p)||p.line-m.line)[0]??null:null),f=u&&u.identity[0].kind==="class"?[u.identity[0].name]:[],b=(p,m,g)=>{m[g].push(p),p.movedInto=m,o.delete(p.key)},x=[...o.values()],d=p=>{let m=x.find(g=>g.key===p)??null;for(;m?.movedInto;)m=m.movedInto;return m};for(let p of l()){let m=p.identity.length===1?p.identity[0]:null;if(!(m?.kind!=="class"||!r.parts.has(m.name))&&(o.delete(p.key),u&&p!==u)){p.movedInto=u;for(let g of p.states)u.parts.push({selector:p.key,path:e,line:g.line,state:g.state})}}let y=l().filter(p=>p.identity.filter(m=>m.kind!=="tag"&&m.kind!=="universal").length>=2).sort((p,m)=>p.identity.length-m.identity.length);for(let p of y){let m=x.filter(w=>w!==p&&w!==u&&w.prefix.length===0&&Zi(w.identity,p.identity));if(m.length===0)continue;m.sort((w,$)=>$.identity.length-w.identity.length||c($)-c(w)||w.line-$.line);let g=d(m[0].key);g&&g!==p&&b(p,g,"modifiers")}for(let{hostKey:p,part:m}of i){let g=d(p)??(s?u:null);g&&o.has(g.key)&&g.parts.push(m)}let k=p=>{let m=p===u,g=Ze(p.key,f);return{...$e({selector:p.key,path:e,base:m},n.classKeywords),element:g,usage:{status:"unknown",files:[],fileCount:0},selector:p.key,path:e,line:p.line,base:m,states:zt(p.states),modifiers:p.modifiers.length?p.modifiers.map(w=>{let $=w.identity.filter(v=>!p.identity.some(C=>Hs(C,v)));return{title:$e({selector:$.map(v=>v.raw).join(""),path:e,base:!1},n.classKeywords).title,selector:w.key,path:e,line:w.line,element:Ze(w.key,f),usage:{status:"unknown",files:[],fileCount:0},states:zt(w.states)}}):void 0,contexts:p.contexts.length?p.contexts.map(w=>{let $=Ks(w.states.flatMap(v=>v.declarations));return{selector:w.key,path:e,line:w.line,role:$,element:$==="override"?Ze(w.key,f):null,states:zt(w.states)}}):void 0,parts:p.parts.length?p.parts:void 0}};return[...o.values()].map(k)}function Zs(e){let t=new Map;for(let i of e){let a=i.base?/^\.([\w-]+)$/.exec(i.selector):null;a&&t.set(i.path,[...t.get(i.path)??[],a[1]])}let n=i=>{let a=J(i.selector);if(!a)return null;let l=a[a.length-1].simples,c=t.get(i.path)??[],u=l.filter(f=>!(f.kind==="class"&&c.includes(f.name)));return{depth:a.length-1,subject:je(l),bareTag:!l.some(f=>f.kind==="class"||f.kind==="attr"||f.kind==="id"),bare:u.length&&u.length<l.length?je(u):null}},s=new Map(e.map(i=>[i,n(i)])),r=new Set,o=i=>{let a=s.get(i);if(!a||a.depth===0)return null;let l=e.filter(c=>{if(c===i||r.has(c))return!1;let u=s.get(c);return u!=null&&u.depth<a.depth&&(!a.bareTag||u.depth===0)&&(u.subject===a.subject||a.bare!==null&&u.subject===a.bare)});return l.sort((c,u)=>+(u.path===i.path)-+(c.path===i.path)||s.get(c).depth-s.get(u).depth),l[0]??null};for(let i of[...e].sort((a,l)=>(s.get(l)?.depth??0)-(s.get(a)?.depth??0))){let a=o(i);if(!a)continue;for(;r.has(a);)a=o(a)??a;let l=Ks(i.states.flatMap(c=>c.declarations));a.contexts=[...a.contexts??[],{selector:i.selector,path:i.path,line:i.line,role:l,element:l==="override"?i.element:null,states:i.states}],i.parts?.length&&(a.parts=[...a.parts??[],...i.parts]),i.modifiers?.length&&(a.modifiers=[...a.modifiers??[],...i.modifiers]),r.add(i)}return e.filter(i=>!r.has(i))}var Qi={slate:{50:"#f8fafc",100:"#f1f5f9",200:"#e2e8f0",300:"#cbd5e1",400:"#94a3b8",500:"#64748b",600:"#475569",700:"#334155",800:"#1e293b",900:"#0f172a",950:"#020617"},gray:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#1f2937",900:"#111827",950:"#030712"},zinc:{50:"#fafafa",100:"#f4f4f5",200:"#e4e4e7",300:"#d4d4d8",400:"#a1a1aa",500:"#71717a",600:"#52525b",700:"#3f3f46",800:"#27272a",900:"#18181b",950:"#09090b"},neutral:{50:"#fafafa",100:"#f5f5f5",200:"#e5e5e5",300:"#d4d4d4",400:"#a3a3a3",500:"#737373",600:"#525252",700:"#404040",800:"#262626",900:"#171717",950:"#0a0a0a"},stone:{50:"#fafaf9",100:"#f5f5f4",200:"#e7e5e4",300:"#d6d3d1",400:"#a8a29e",500:"#78716c",600:"#57534e",700:"#44403c",800:"#292524",900:"#1c1917",950:"#0c0a09"},red:{50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#ef4444",600:"#dc2626",700:"#b91c1c",800:"#991b1b",900:"#7f1d1d",950:"#450a0a"},orange:{50:"#fff7ed",100:"#ffedd5",200:"#fed7aa",300:"#fdba74",400:"#fb923c",500:"#f97316",600:"#ea580c",700:"#c2410c",800:"#9a3412",900:"#7c2d12",950:"#431407"},amber:{50:"#fffbeb",100:"#fef3c7",200:"#fde68a",300:"#fcd34d",400:"#fbbf24",500:"#f59e0b",600:"#d97706",700:"#b45309",800:"#92400e",900:"#78350f",950:"#451a03"},yellow:{50:"#fefce8",100:"#fef9c3",200:"#fef08a",300:"#fde047",400:"#facc15",500:"#eab308",600:"#ca8a04",700:"#a16207",800:"#854d0e",900:"#713f12",950:"#422006"},lime:{50:"#f7fee7",100:"#ecfccb",200:"#d9f99d",300:"#bef264",400:"#a3e635",500:"#84cc16",600:"#65a30d",700:"#4d7c0f",800:"#3f6212",900:"#365314",950:"#1a2e05"},green:{50:"#f0fdf4",100:"#dcfce7",200:"#bbf7d0",300:"#86efac",400:"#4ade80",500:"#22c55e",600:"#16a34a",700:"#15803d",800:"#166534",900:"#14532d",950:"#052e16"},emerald:{50:"#ecfdf5",100:"#d1fae5",200:"#a7f3d0",300:"#6ee7b7",400:"#34d399",500:"#10b981",600:"#059669",700:"#047857",800:"#065f46",900:"#064e3b",950:"#022c22"},teal:{50:"#f0fdfa",100:"#ccfbf1",200:"#99f6e4",300:"#5eead4",400:"#2dd4bf",500:"#14b8a6",600:"#0d9488",700:"#0f766e",800:"#115e59",900:"#134e4a",950:"#042f2e"},cyan:{50:"#ecfeff",100:"#cffafe",200:"#a5f3fc",300:"#67e8f9",400:"#22d3ee",500:"#06b6d4",600:"#0891b2",700:"#0e7490",800:"#155e75",900:"#164e63",950:"#083344"},sky:{50:"#f0f9ff",100:"#e0f2fe",200:"#bae6fd",300:"#7dd3fc",400:"#38bdf8",500:"#0ea5e9",600:"#0284c7",700:"#0369a1",800:"#075985",900:"#0c4a6e",950:"#082f49"},blue:{50:"#eff6ff",100:"#dbeafe",200:"#bfdbfe",300:"#93c5fd",400:"#60a5fa",500:"#3b82f6",600:"#2563eb",700:"#1d4ed8",800:"#1e40af",900:"#1e3a8a",950:"#172554"},indigo:{50:"#eef2ff",100:"#e0e7ff",200:"#c7d2fe",300:"#a5b4fc",400:"#818cf8",500:"#6366f1",600:"#4f46e5",700:"#4338ca",800:"#3730a3",900:"#312e81",950:"#1e1b4b"},violet:{50:"#f5f3ff",100:"#ede9fe",200:"#ddd6fe",300:"#c4b5fd",400:"#a78bfa",500:"#8b5cf6",600:"#7c3aed",700:"#6d28d9",800:"#5b21b6",900:"#4c1d95",950:"#2e1065"},purple:{50:"#faf5ff",100:"#f3e8ff",200:"#e9d5ff",300:"#d8b4fe",400:"#c084fc",500:"#a855f7",600:"#9333ea",700:"#7e22ce",800:"#6b21a8",900:"#581c87",950:"#3b0764"},fuchsia:{50:"#fdf4ff",100:"#fae8ff",200:"#f5d0fe",300:"#f0abfc",400:"#e879f9",500:"#d946ef",600:"#c026d3",700:"#a21caf",800:"#86198f",900:"#701a75",950:"#4a044e"},pink:{50:"#fdf2f8",100:"#fce7f3",200:"#fbcfe8",300:"#f9a8d4",400:"#f472b6",500:"#ec4899",600:"#db2777",700:"#be185d",800:"#9d174d",900:"#831843",950:"#500724"},rose:{50:"#fff1f2",100:"#ffe4e6",200:"#fecdd3",300:"#fda4af",400:"#fb7185",500:"#f43f5e",600:"#e11d48",700:"#be123c",800:"#9f1239",900:"#881337",950:"#4c0519"}};function Xs(e){let t=e.lastIndexOf("-");return t<=0?null:Qi[e.slice(0,t)]?.[e.slice(t+1)]??null}var R=(e,t)=>({property:e,value:t});function Kt(e){if(!e.startsWith("[")||!e.endsWith("]"))return null;let t=e.slice(1,-1).replace(/_/g," ").trim();return/^-?[\d.]+(?:px|rem|em|%|vh|vw)$/.test(t)||/^var\(\s*--[\w-]+\s*\)$/.test(t)?t.replace(/\s+/g,""):null}function Ht(e){let t=Kt(e);if(t)return t;if(e==="px")return"1px";if(!/^\d+(?:\.\d+)?$/.test(e))return null;let n=Number(e);if(n>96)return null;let s=Math.round(n*2);if(Math.abs(n*2-s)>1e-6)return null;if(s===0)return"0";let r=Math.floor(s/8),o=["",".125",".25",".375",".5",".625",".75",".875"][s%8];return r===0?`0${o}rem`:`${r}${o}rem`}function ea(e){let t=/^(\d+)\/(\d+)$/.exec(e);if(!t)return null;let n=Number(t[1])/Number(t[2])*100;return Number.isFinite(n)?`${Number(n.toFixed(4))}%`:null}function qs(e,t){return{full:"100%",screen:t==="w"?"100vw":"100vh",auto:"auto",fit:"fit-content",min:"min-content",max:"max-content"}[e]??ea(e)??Kt(e)??Ht(e)}var ta={xs:{size:"0.75rem",leading:"1rem"},sm:{size:"0.875rem",leading:"1.25rem"},base:{size:"1rem",leading:"1.5rem"},lg:{size:"1.125rem",leading:"1.75rem"},xl:{size:"1.25rem",leading:"1.75rem"},"2xl":{size:"1.5rem",leading:"2rem"},"3xl":{size:"1.875rem",leading:"2.25rem"},"4xl":{size:"2.25rem",leading:"2.5rem"},"5xl":{size:"3rem",leading:"1"},"6xl":{size:"3.75rem",leading:"1"}},na={thin:"100",extralight:"200",light:"300",normal:"400",medium:"500",semibold:"600",bold:"700",extrabold:"800",black:"900"},sa={none:"1",tight:"1.25",snug:"1.375",normal:"1.5",relaxed:"1.625",loose:"2"},ra={none:"0",sm:"0.125rem","":"0.25rem",md:"0.375rem",lg:"0.5rem",xl:"0.75rem","2xl":"1rem","3xl":"1.5rem",full:"9999px"},oa={sm:"0 1px 2px 0 rgb(0 0 0 / 0.05)","":"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",md:"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",lg:"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",xl:"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)","2xl":"0 25px 50px -12px rgb(0 0 0 / 0.25)",inner:"inset 0 2px 4px 0 rgb(0 0 0 / 0.05)",none:"none"},ia={"":"3px",0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"};function Wt(e,t){let n=null;if(e.startsWith("[")&&e.endsWith("]")){let r=e.slice(1,-1).replace(/_/g," ").trim();if(r.startsWith("--"))n=`var(${r})`;else if(/^var\(\s*--[\w-]+\s*\)$/.test(r))n=r.replace(/\s+/g,"");else if(/^#[0-9a-f]{3,8}$/i.test(r)||/^(?:rgb|hsl|oklch|oklab|color)\(/i.test(r))n=r;else return null}else e==="white"?n="#fff":e==="black"?n="#000":e==="transparent"?n="transparent":e==="current"?n="currentColor":e==="inherit"?n="inherit":n=Xs(e)??(/^[a-z][\w-]*$/i.test(e)?`var(--${e}, var(--color-${e}))`:null);if(!n)return null;if(!t)return n;if(!/^\d+(?:\.\d+)?$/.test(t))return null;let s=Number(t)<=1?Number(t)*100:Number(t);return s<0||s>100?null:s===100?n:`color-mix(in srgb, ${n} ${s}%, transparent)`}function aa(e){let t=0,n=-1;for(let s=0;s<e.length;s++){let r=e[s];r==="["?t++:r==="]"?t=Math.max(0,t-1):r==="/"&&t===0&&(n=s)}return n<0?{body:e,opacity:null}:{body:e.slice(0,n),opacity:e.slice(n+1)}}function Gt(){return R("box-shadow","0 0 0 var(--gs-ring-w, 3px) var(--gs-ring-c, currentColor)")}var la={flex:"flex","inline-flex":"inline-flex",block:"block","inline-block":"inline-block",inline:"inline",grid:"grid","inline-grid":"inline-grid",hidden:"none",contents:"contents"},Ut={start:"flex-start",end:"flex-end",center:"center",baseline:"baseline",stretch:"stretch",between:"space-between",around:"space-around",evenly:"space-evenly"};function Ys(e){let t=e.startsWith("-"),n=t?e.slice(1):e,{body:s,opacity:r}=aa(n),o=la[s];if(o&&!t&&!r)return[R("display",o)];let i=/^flex-(row|col|row-reverse|col-reverse)$/.exec(s);if(i&&!t&&!r){let A=i[1]==="col"?"column":i[1]==="col-reverse"?"column-reverse":i[1];return[R("flex-direction",A)]}if(s==="flex-wrap"&&!t)return[R("flex-wrap","wrap")];if(s==="flex-nowrap"&&!t)return[R("flex-wrap","nowrap")];if(s==="flex-1"&&!t)return[R("flex","1 1 0%")];if(s==="shrink-0"&&!t)return[R("flex-shrink","0")];if(s==="grow-0"&&!t)return[R("flex-grow","0")];if(s==="grow"&&!t)return[R("flex-grow","1")];let a=/^items-(start|end|center|baseline|stretch)$/.exec(s);if(a&&!t)return[R("align-items",Ut[a[1]])];let l=/^justify-(start|end|center|between|around|evenly)$/.exec(s);if(l&&!t)return[R("justify-content",Ut[l[1]])];let c=/^self-(start|end|center|stretch|auto)$/.exec(s);if(c&&!t)return[R("align-self",c[1]==="auto"?"auto":Ut[c[1]])];if(s==="whitespace-nowrap")return[R("white-space","nowrap")];if(s==="whitespace-normal")return[R("white-space","normal")];if(s==="truncate")return[R("overflow","hidden"),R("text-overflow","ellipsis"),R("white-space","nowrap")];if(s==="underline")return[R("text-decoration-line","underline")];if(s==="no-underline")return[R("text-decoration-line","none")];if(s==="line-through")return[R("text-decoration-line","line-through")];let u=/^(uppercase|lowercase|capitalize|normal-case)$/.exec(s);if(u)return[R("text-transform",u[1]==="normal-case"?"none":u[1])];let f=/^text-(left|center|right|justify|start|end)$/.exec(s);if(f&&!r)return[R("text-align",f[1])];let b=ta[s.replace(/^text-/,"")];if(s.startsWith("text-")&&b&&!r&&!t)return[R("font-size",b.size),R("line-height",b.leading)];let x=na[s.replace(/^font-/,"")];if(s.startsWith("font-")&&x&&!r)return[R("font-weight",x)];if(s.startsWith("leading-")&&!r){let A=s.slice(8),O=sa[A]??Ht(A);if(O)return[R("line-height",O)]}let d=/^cursor-(pointer|default|not-allowed|wait|text|move)$/.exec(s);if(d)return[R("cursor",d[1])];if(s==="pointer-events-none")return[R("pointer-events","none")];if(s==="pointer-events-auto")return[R("pointer-events","auto")];if(s==="select-none")return[R("user-select","none")];let y=/^opacity-(\d+)$/.exec(s);if(y&&!t)return[R("opacity",String(Number(y[1])/100))];if(s==="transition"||s==="transition-colors"||s==="transition-all")return[R("transition-property",s==="transition-colors"?"color, background-color, border-color, text-decoration-color, fill, stroke":s==="transition-all"?"all":"color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter"),R("transition-timing-function","cubic-bezier(0.4, 0, 0.2, 1)"),R("transition-duration","150ms")];let k=/^duration-(\d+)$/.exec(s);if(k)return[R("transition-duration",`${k[1]}ms`)];let p={linear:"linear",in:"cubic-bezier(0.4, 0, 1, 1)",out:"cubic-bezier(0, 0, 0.2, 1)","in-out":"cubic-bezier(0.4, 0, 0.2, 1)"};if(s.startsWith("ease-")&&p[s.slice(4)])return[R("transition-timing-function",p[s.slice(4)])];if(s==="outline-none")return[R("outline","2px solid transparent"),R("outline-offset","2px")];if(s==="outline")return[R("outline-style","solid")];let m=/^outline-(\d+)$/.exec(s);if(m)return[R("outline-width",`${m[1]}px`)];if(s==="shadow"||s.startsWith("shadow-")){let A=s==="shadow"?"":s.slice(7),L=oa[A];if(L)return[R("box-shadow",L)]}if(s==="ring"||/^ring(?:-(?:0|1|2|4|8))?$/.test(s)){let A=s==="ring"?"":s.slice(5),L=ia[A];if(L)return[R("--gs-ring-w",L),Gt()]}if(s.startsWith("ring-")&&r===null){let A=Wt(s.slice(5),null);if(A)return[R("--gs-ring-c",A),Gt()]}if(s.startsWith("ring-")&&r){let A=Wt(s.slice(5),r);if(A)return[R("--gs-ring-c",A),Gt()]}let g=s==="rounded"?"":s.startsWith("rounded-")?s.slice(8):null;if(g!==null&&!t){let A=/^(t|r|b|l|s|e|tl|tr|bl|br|ss|se)(?:-(.+))?$/.exec(g),L=A?A[2]??"":g,O=ra[L];if(!O)return null;if(!A)return[R("border-radius",O)];let K={t:["border-top-left-radius","border-top-right-radius"],r:["border-top-right-radius","border-bottom-right-radius"],b:["border-bottom-left-radius","border-bottom-right-radius"],l:["border-top-left-radius","border-bottom-left-radius"],s:["border-start-start-radius","border-end-start-radius"],e:["border-start-end-radius","border-end-end-radius"],tl:["border-top-left-radius"],tr:["border-top-right-radius"],bl:["border-bottom-left-radius"],br:["border-bottom-right-radius"],ss:["border-start-start-radius"],se:["border-start-end-radius"]}[A[1]];return K?K.map(Be=>R(Be,O)):null}if(/^border(?:-[trblxy])?$/.test(s)&&!r)return[R("border-width","1px"),R("border-style","solid")];let w=/^border-(\d+)$/.exec(s);if(w&&!r)return[R("border-width",`${w[1]}px`),R("border-style","solid")];let $=/^border-(solid|dashed|dotted|double|none|hidden)$/.exec(s);if($)return[R("border-style",$[1])];let v=/^(p|px|py|pt|pr|pb|pl|ps|pe|m|mx|my|mt|mr|mb|ml|ms|me|gap|gap-x|gap-y|w|h|min-w|min-h|max-w|max-h|size|inset|top|right|bottom|left)-(.+)$/.exec(s),C=v?.[1],I=v?.[2];if(C&&I&&!r){let A=C==="w"||C==="min-w"||C==="max-w"?qs(I,"w"):C==="h"||C==="min-h"||C==="max-h"?qs(I,"h"):Ht(I);if(!A)return null;let L=t?A==="0"?"0":`-${A}`:A,B={p:["padding"],px:["padding-inline"],py:["padding-block"],pt:["padding-top"],pr:["padding-right"],pb:["padding-bottom"],pl:["padding-left"],ps:["padding-inline-start"],pe:["padding-inline-end"],m:["margin"],mx:["margin-inline"],my:["margin-block"],mt:["margin-top"],mr:["margin-right"],mb:["margin-bottom"],ml:["margin-left"],ms:["margin-inline-start"],me:["margin-inline-end"],gap:["gap"],"gap-x":["column-gap"],"gap-y":["row-gap"],w:["width"],h:["height"],"min-w":["min-width"],"min-h":["min-height"],"max-w":["max-width"],"max-h":["max-height"],size:["width","height"],inset:["inset"],top:["top"],right:["right"],bottom:["bottom"],left:["left"]}[C];return B?B.map(K=>R(K,L)):null}let M={bg:"background-color",text:"color",border:"border-color",outline:"outline-color",decoration:"text-decoration-color",accent:"accent-color",caret:"caret-color",fill:"fill",stroke:"stroke"};for(let[A,L]of Object.entries(M))if(s===A||s.startsWith(`${A}-`)){let O=s===A?"":s.slice(A.length+1);if(!O||/^(?:gradient|clip|ellipsis|wrap|nowrap|balance|pretty|opacity)/.test(O))return null;if(A==="text"&&!t){let K=Kt(O);if(K)return[R("font-size",K)]}let B=Wt(O,r);return!B||t?null:[R(L,B)]}let E=/^\[([a-z-]+):(.+)\]$/i.exec(s);if(E&&!t&&!r){let A=E[1].toLowerCase(),L=E[2].replace(/_/g," ").trim();if(/^[a-z][\w-]*$/.test(A)&&L&&!/[<>]/.test(L))return[R(A,L)]}return null}var ca=48,ua={hover:"hover",focus:"focus","focus-visible":"focus","focus-within":"focus",active:"active",disabled:"disabled"},fa=new Set(["cn","clsx","classNames","classnames","cx","twMerge"]);function oe(e,t){let n=1;for(let s=0;s<t&&s<e.length;s++)e[s]===`
|
|
38
|
-
`&&n++;return n}function
|
|
39
|
-
`:a,o++;continue}if(n==="`"&&i==="$"&&
|
|
40
|
-
`:o,s++;continue}if(r==="$"&&
|
|
41
|
-
${
|
|
42
|
-
}`)){let s=
|
|
43
|
-
`);s!==-1&&s<
|
|
44
|
-
`,s+1);return n}var
|
|
45
|
-
`),s=0,r=[];for(let o=0;o<n.length;o++){let i=n[o];if(
|
|
46
|
-
`:""}${
|
|
47
|
-
`)}`.slice(0,
|
|
48
|
-
`)}var
|
|
26
|
+
`,changed:!0}}function us(t){return/(^|[\s/])(?:@gruum\/cli|gruum(?:\.m?js)?)\s+check\s+--staged\s*$/.test(t.trim())}function ps(t){let e=t.split(`
|
|
27
|
+
`),n=e.filter(o=>!us(o)),s=n.length!==e.length,r=n.join(`
|
|
28
|
+
`);return s&&/^(#!\/bin\/sh)?\s*$/.test(r)?{text:"",changed:s}:{text:r,changed:s}}var Oo="2025-06-18",qt="Check before you finish, fix to the spec when you can, ask for an exception with a reason when you cannot, and never edit Gruum's generated files to make a check pass.",Qt={gruum_button_spec:`The designer-published button spec for this repository: components, looks and how to select them, tokens, and written rules. Read it before writing or restyling a button. ${qt}`,gruum_check_buttons:`Check the working tree's buttons against the spec and list drift items with a one-line fix each. Run it before you stop. ${qt}`,gruum_request_exception:`Ask a designer to allow one drift item the spec has no button for. Send the drift id from gruum_check_buttons and a reason. ${qt}`,gruum_exception_status:`Pending, accepted, or rejected for this branch's exception requests. Pass an id to read one. ${qt}`};function fs(t){return[{name:"gruum_button_spec",description:Qt.gruum_button_spec,inputSchema:{type:"object",properties:{},additionalProperties:!1},run:()=>t.spec()},{name:"gruum_check_buttons",description:Qt.gruum_check_buttons,inputSchema:{type:"object",properties:{paths:{type:"array",items:{type:"string"},description:"Only report drift in these files (relative to the repository root). Omit to check everything."}},additionalProperties:!1},run:e=>{let n=Array.isArray(e.paths)?e.paths.filter(s=>typeof s=="string"):[];return t.check(n)}},{name:"gruum_request_exception",description:Qt.gruum_request_exception,inputSchema:{type:"object",properties:{driftId:{type:"string",description:"The drift item id from gruum_check_buttons."},reason:{type:"string",description:"Why the spec has no button for this job."}},required:["driftId","reason"],additionalProperties:!1},run:e=>t.request(typeof e.driftId=="string"?e.driftId:"",typeof e.reason=="string"?e.reason:"")},{name:"gruum_exception_status",description:Qt.gruum_exception_status,inputSchema:{type:"object",properties:{id:{type:"string",description:"One request id. Omit to list this branch."}},additionalProperties:!1},run:e=>t.status(typeof e.id=="string"?e.id:void 0)}]}function Nt(t,e){return{jsonrpc:"2.0",id:t,result:e}}function te(t,e,n){return{jsonrpc:"2.0",id:t,error:{code:e,message:n}}}async function ds(t,e,n){if(!t||typeof t!="object")return te(null,-32600,"Invalid request");let s=t,r=!("id"in s),o=s.id??null;if(typeof s.method!="string")return r?null:te(o,-32600,"Invalid request");let i=s.params??{};switch(s.method){case"initialize":{let a=i.protocolVersion;return Nt(o,{protocolVersion:typeof a=="string"?a:Oo,capabilities:{tools:{listChanged:!1}},serverInfo:n})}case"ping":return Nt(o,{});case"tools/list":return Nt(o,{tools:e.map(({name:a,description:l,inputSchema:c})=>({name:a,description:l,inputSchema:c}))});case"tools/call":{let a=e.find(c=>c.name===i.name);if(!a)return te(o,-32602,`Unknown tool: ${String(i.name)}`);let l=i.arguments&&typeof i.arguments=="object"?i.arguments:{};try{let c=await a.run(l);return Nt(o,{content:[{type:"text",text:c.text}],isError:c.isError??!1})}catch(c){return Nt(o,{content:[{type:"text",text:c instanceof Error?c.message:String(c)}],isError:!0})}}default:return r?null:te(o,-32601,`Method not found: ${s.method}`)}}var Lo=/(^|\/)(node_modules|\.git|\.next|dist|build|out|coverage|vendor|\.turbo|\.cache|__pycache__|target|\.venv|venv)\//,Po=/(^|\/)(package-lock\.json|pnpm-lock\.yaml|yarn\.lock|bun\.lockb|Cargo\.lock|poetry\.lock|composer\.lock|Gemfile\.lock)$/,To=/\.(png|jpe?g|gif|webp|avif|ico|icns|bmp|tiff?|svgz|woff2?|ttf|otf|eot|mp[34]|wav|ogg|webm|mov|zip|gz|tgz|bz2|7z|rar|jar|pdf|docx?|xlsx?|pptx?|exe|dll|so|dylib|wasm|bin|dat|sqlite|db|psd|ai|sketch|fig)$/i,No=/(^|\/)\.gruum\//;function Ve(t){return!Lo.test(`${t}/`)&&!No.test(`${t}/`)}function Be(t,e){return Po.test(t)||To.test(t)?!1:e<=3e5}function gs(t){let e=Math.min(t.length,8e3);for(let n=0;n<e;n++)if(t[n]===0)return!0;return!1}var Vo=/\.(css|scss|sass|less|styl|tsx?|jsx?|mjs|cjs|vue|svelte|astro|html?|mdx?|erb|php|hbs|njk|liquid|twig|ejs|pug|cshtml|razor|jinja2?|j2|json)$/i;function ms(t){return Vo.test(t)}function Fe(t){return t.replace(/\\/g,"/").replace(/^\.\/?/,"").replace(/^\/+|\/+$/g,"")}function ze(t,e){let n=Fe(e),s=t.replace(/\\/g,"/");return n?s.startsWith(`${n}/`)?s.slice(n.length+1):null:s}function hs(t,e,n){let s=new Map(t);for(let r of e){let o=ze(r.path,n);o===null||!Ve(o.split("/").slice(0,-1).join("/")||".")||(r.content===null?s.delete(o):Be(o,r.content.length)&&s.set(o,r.content))}return s}function ys(t){let e=t.split("\0").filter(Boolean),n=[];for(let s=0;s<e.length;s++){let r=e[s];if(/^[RC]/.test(r)){let i=e[++s],a=e[++s];r.startsWith("R")&&i&&n.push({path:i,deleted:!0}),a&&n.push({path:a,deleted:!1});continue}let o=e[++s];o&&n.push({path:o,deleted:r.startsWith("D")})}return n}function ee(t){let e=/^(?:git@|ssh:\/\/git@|https?:\/\/(?:[^@/]+@)?)github\.com[:/]([^/\s]+)\/([^/\s]+?)(?:\.git)?\/?$/i.exec(t.trim());return e?`${e[1]}/${e[2]}`:null}var bs=t=>t.replace(/\\(.)/g,"$1");function Bo(t){let e=t;for(;;){let n=/:(?:global|local)\(/i.exec(e);if(!n)break;let s=0,r=-1;for(let i=n.index+n[0].length-1;i<e.length;i++){let a=e[i];if(a==="(")s++;else if(a===")"&&--s===0){r=i;break}}if(r<0)break;let o=e.slice(n.index+n[0].length,r).trim();e=`${e.slice(0,n.index)}${o}${e.slice(r+1)}`}return e.replace(/:(?:global|local)(?=\s|$)/gi,"").trim()}var We=/\*|[a-z][\w-]*|\.((?:\\.|[\w-])+)|#((?:\\.|[\w-])+)|\[\s*([\w-]+)\s*(?:([~|^$*]?=)\s*(?:"([^"]*)"|'([^']*)'|([^\]\s]*)))?\s*[is]?\s*\]|::([\w-]+)|:([\w-]+)(\((?:[^()]|\([^()]*\))*\))?/giy;function ws(t){let e=[];We.lastIndex=0;let n=0;for(;n<t.length;){We.lastIndex=n;let s=We.exec(t);if(!s||s.index!==n)return null;let r=s[0];if(n+=r.length,r==="*")e.push({kind:"universal",raw:r});else if(s[1]!==void 0)e.push({kind:"class",raw:r,name:bs(s[1])});else if(s[2]!==void 0)e.push({kind:"id",raw:r,name:bs(s[2])});else if(s[3]!==void 0)e.push({kind:"attr",raw:r,name:s[3],op:s[4]??null,value:s[4]?s[5]??s[6]??s[7]??"":null});else if(s[8]!==void 0)e.push({kind:"pseudoElement",raw:r,name:s[8].toLowerCase()});else if(s[9]!==void 0){let o=s[9].toLowerCase();/^(?:before|after|first-line|first-letter)$/.test(o)?e.push({kind:"pseudoElement",raw:r,name:o}):e.push({kind:"pseudo",raw:r,name:o,args:s[10]?s[10].slice(1,-1).trim():null})}else if(e.length===0)e.push({kind:"tag",raw:r,name:r.toLowerCase()});else return null}return e.length?e:null}function X(t){let e=Bo(t),n=[],s=0,r=0,o=null,i=!0,a=l=>{let c=e.slice(r,l).trim();if(!c)return!0;let u=ws(c);return u?(n.push({combinator:i?null:o??" ",simples:u}),i=!1,o=null,!0):!1};for(let l=0;l<e.length;l++){let c=e[l];if(c==="("||c==="[")s++;else if(c===")"||c==="]")s=Math.max(0,s-1);else if(s===0&&(c===">"||c==="+"||c==="~")){if(!a(l)||o)return null;o=c,r=l+1}else if(s===0&&/\s/.test(c)){if(!a(l))return null;r=l+1}}return!a(e.length)||o?null:n.length?n:null}function Vt(t){return t.map(e=>e.raw).join("")}function Bt(t){return t.map((e,n)=>{let s=Vt(e.simples);return n===0?s:e.combinator===" "?` ${s}`:` ${e.combinator} ${s}`}).join("")}function z(t){let e=[],n=0,s=0;for(let r=0;r<t.length;r++){let o=t[r];o==="("||o==="["?n++:o===")"||o==="]"?n=Math.max(0,n-1):o===","&&n===0&&(e.push(t.slice(s,r).trim()),s=r+1)}return e.push(t.slice(s).trim()),e.filter(Boolean)}var vs=t=>t.replace(/([a-z\d])([A-Z])/g,"$1-$2").split(/[^a-z0-9]+/i).filter(Boolean).map(e=>e.toLowerCase());function xs(t,e){let n=t.toLowerCase();return e.some(s=>n.includes(s.toLowerCase()))}function Ue(t,e){let n=e.excludeClassKeywords;if(!n?.length)return!1;let s=new Set(n.flatMap(r=>[r.toLowerCase(),`${r.toLowerCase()}s`]));return t.some(r=>r.kind==="class"&&vs(r.name).some(o=>s.has(o)))}var Fo=new Set(["html","body"]),zo=new Set(["svg","path","use","img","picture","video","i","em","strong","b","small","kbd","sup","sub"]);function se(t,e){for(let n of t)switch(n.kind){case"tag":if(e.elements.includes(n.name))return!0;break;case"class":if(xs(n.name,e.classKeywords))return!0;break;case"attr":if(n.name==="role"&&n.value!==null&&e.roles.includes(n.value.toLowerCase())||n.name==="data-component"&&n.value!==null&&xs(n.value,e.classKeywords))return!0;break;case"pseudo":if((n.name==="is"||n.name==="where")&&n.args){let s=z(n.args).map(X);if(s.length>0&&s.every(r=>r!==null&&se(r[r.length-1].simples,e)))return!0}break;default:break}return!1}function $s(t){return t.some(n=>n.kind==="universal")?t.length===1:t.some(n=>n.kind==="tag"&&Fo.has(n.name))?!0:!t.some(n=>n.kind==="tag"||n.kind==="class"||n.kind==="attr"||n.kind==="id"||n.kind==="pseudo"&&(n.name==="is"||n.name==="where"))}function Cs(t){return t.some(e=>e.kind==="tag"&&zo.has(e.name))}var ne=["hover","focus","active","selected","current","loading","disabled"],Wo={hover:"hover",hovered:"hover",focus:"focus",focused:"focus","focus-visible":"focus","focus-within":"focus",active:"selected",pressed:"selected",selected:"selected",checked:"selected",on:"selected",current:"current",loading:"loading",busy:"loading",pending:"loading",disabled:"disabled"},Uo={hover:"hover",focus:"focus","focus-visible":"focus","focus-within":"focus",active:"active",checked:"selected",disabled:"disabled"},Go={disabled:"disabled","aria-disabled":"disabled","data-disabled":"disabled","aria-pressed":"selected","aria-selected":"selected","aria-expanded":"selected","aria-checked":"selected","data-active":"selected","data-selected":"selected","data-pressed":"selected","data-checked":"selected","data-highlighted":"selected","aria-current":"current","aria-busy":"loading","data-loading":"loading","data-busy":"loading","data-hover":"hover","data-hovered":"hover","data-focus":"focus","data-focused":"focus","data-focus-visible":"focus","data-open":"open","data-expanded":"open"},Ko=new Set(["active","selected","pressed","checked","loading","busy","disabled","open","current","hover","focus","show","expanded","collapsed"]),ks=t=>Wo[t.toLowerCase()]??t.toLowerCase(),rt={hover:"__gs-hover",focus:"__gs-focus",active:"__gs-active"};function Ss(t){if(t.kind==="pseudo"){let e=Uo[t.name];if(!e)return null;let n=rt[e];return{state:e,marker:n?{classes:[n],attrs:{}}:{classes:[],attrs:{[t.name==="checked"?"checked":"disabled"]:""}}}}if(t.kind==="attr"){if(t.name==="data-state"&&t.value!==null)return{state:ks(t.value),marker:{classes:[],attrs:{"data-state":t.value}}};let e=Go[t.name];if(!e||t.value!==null&&/^(?:false|off|0)$/i.test(t.value))return null;let n=t.value??(t.name.startsWith("aria-")?"true":"");return{state:e,marker:{classes:[],attrs:{[t.name]:n}}}}if(t.kind==="class"){let e=/^(?:is|has)-(.+)$/i.exec(t.name),n=e?e[1]:Ko.has(t.name.toLowerCase())?t.name:null;return n?{state:ks(n),marker:{classes:[t.name],attrs:{}}}:null}return null}function Ho(t){return t.kind!=="pseudo"||t.name!=="not"||!t.args?!1:z(t.args).every(e=>{let n=ws(e);return n!==null&&n.every(s=>Ss(s)!==null)})}function re(t){let e=[],n=new Map;for(let o of t){if(Ho(o))continue;let i=Ss(o);if(!i){e.push(o);continue}let a=n.get(i.state)??{classes:[],attrs:{}};for(let l of i.marker.classes)a.classes.includes(l)||a.classes.push(l);Object.assign(a.attrs,i.marker.attrs),n.set(i.state,a)}let s=[...n.keys()].sort((o,i)=>K(o)-K(i)||o.localeCompare(i)),r={classes:[],attrs:{}};for(let o of s){let i=n.get(o);r.classes.push(...i.classes),Object.assign(r.attrs,i.attrs)}return{identity:e,states:s,marker:r}}function K(t){if(t==="default")return-1;let e=ne.indexOf(t);return e===-1?ne.length:e}function ft(t){return t.length?t.join(" + "):"default"}function Ge(t){return t.replace(/:hover\b/g,`.${rt.hover}`).replace(/:focus(?:-visible|-within)?\b/g,`.${rt.focus}`).replace(/:active\b/g,`.${rt.active}`)}var Jo=new Set(["background","background-color","background-image","background-position","background-size","background-repeat","background-clip","background-origin","background-attachment","color","border-color","border-top-color","border-right-color","border-bottom-color","border-left-color","outline","outline-color","outline-offset","box-shadow","filter","backdrop-filter","opacity","fill","stroke","caret-color","accent-color","text-decoration-color","mix-blend-mode"]),Zo=new Set(["width","min-width","max-width","flex","flex-grow","flex-shrink","flex-basis","align-self","justify-self","order","margin","margin-top","margin-right","margin-bottom","margin-left","margin-inline","margin-block","margin-inline-start","margin-inline-end","margin-block-start","margin-block-end","position","inset","inset-inline","inset-block","top","right","bottom","left","z-index","float","clear","grid-column","grid-row","grid-area","place-self"]),Xo=new Set(["cursor","user-select","pointer-events","transition","transition-property","transition-duration","transition-timing-function","transition-delay","will-change","touch-action","-webkit-tap-highlight-color","appearance","-webkit-appearance","scroll-margin","scroll-margin-top"]);function Ft(t){let e=t.toLowerCase();return Jo.has(e)?"paint":Zo.has(e)?"layout":Xo.has(e)?"hint":"box"}var Yo={shadow:/^box-shadow$/,cursor:/^cursor$/,rounded:/^border(?:-[a-z]+)*-radius$/,radius:/^border(?:-[a-z]+)*-radius$/};function As(t,e){let n=t.filter(o=>o.kind==="class");if(n.length!==1||t.length!==1)return!1;let s=vs(n[0].name)[0],r=s?Yo[s]:void 0;return r?e.length>0&&e.every(o=>r.test(o.property.toLowerCase())):!1}var Sc={hover:{classes:[rt.hover],attrs:{}},focus:{classes:[rt.focus],attrs:{}},active:{classes:[rt.active],attrs:{}},selected:{classes:[],attrs:{"aria-pressed":"true"}},current:{classes:[],attrs:{"aria-current":"true"}},loading:{classes:[],attrs:{"aria-busy":"true"}},disabled:{classes:[],attrs:{disabled:""}}};var qo="data-gs-sheet";function _s(t){return`[${qo}="${t.replace(/["\\]/g,"")}"]`}function Rs(t){return/\.module\.[a-z]+$/i.test(t)}var Qo=new Set(["button","a","div","span","input","summary","label"]);function dt(t){let e=0,n=0;for(let s=0;s<t.length;s++){let r=t[s];r==="("||r==="["?e++:r===")"||r==="]"?e=Math.max(0,e-1):e===0&&/[\s>+~]/.test(r)&&(n=s+1)}return n}function ti(t){let e={tag:"",classes:[],attrs:{}};for(let n of t)switch(n.kind){case"pseudoElement":return null;case"tag":e.tag=n.name;break;case"class":e.classes.push(n.name);break;case"attr":e.attrs[n.name]=n.value??"";break;default:break}return e}function oe(t,e){let n=X(t);if(!n||n.some(c=>c.combinator==="+"||c.combinator==="~"))return null;let s=n.map(c=>ti(c.simples));if(s.some(c=>c===null))return null;let r=s,o=r[r.length-1],i=o.tag&&o.tag!=="*"?o.tag:"button";if(!Qo.has(i)||o.classes.length===0&&Object.keys(o.attrs).length===0&&!o.tag)return null;let a=[...new Set([...e,...o.classes])],l=r.slice(0,-1).filter(c=>c.tag||c.classes.length||Object.keys(c.attrs).length).map(c=>({...c,tag:c.tag&&c.tag!=="*"?c.tag:"div"}));return{tag:i,classes:a,attrs:o.attrs,ancestors:l}}function Ke(t,e){let n="";for(let s of t)s.property.toLowerCase()===e&&(n=s.value.replace(/!important\s*$/i,"").trim());return n}function ie(t){let e=Ke(t,"display");if(/^none\b/i.test(e))return"display: none";let n=Ke(t,"visibility");if(/^(hidden|collapse)\b/i.test(n))return`visibility: ${n.split(/\s+/)[0].toLowerCase()}`;let s=Ke(t,"opacity");return/^(0|0\.0+)$/.test(s)?"opacity: 0":null}function Es(t,e){return t===e||!Rs(t)&&!Rs(e)}function tt(t,e){if(/[<>]|@import|expression\(|javascript:|behavior\s*:/i.test(e))return!1;for(let n of e.matchAll(/url\(\s*(['"]?)([^'")]*)\1\s*\)/gi))if(!/^data:image\//i.test(n[2]))return!1;return/^-{0,2}[a-z][\w-]*$/i.test(t)}var ei=40,Y=(t,e)=>({path:t,line:e});function q(t,e,n,s){return{...t,status:e.length===0?"ok":"attention",summary:e.length===0?n:s(e.length),findings:e.slice(0,ei)}}function gt(t,e){return{...t,status:"na",summary:e,findings:[]}}var He=t=>t.state.split(" + ");function Os(t,e){if(!t.element||!e.element||t!==e&&!Es(t.path,e.path)||t.element.ancestors.length>0||t.element.tag!==e.element.tag)return!1;let n=new Set(e.element.classes);return t.element.classes.every(s=>n.has(s))?Object.entries(t.element.attrs).every(([s,r])=>e.element.attrs[s]===r):!1}function Ls(t,e){return e.filter(n=>Os(n,t)).flatMap(n=>n.states)}function ni(t,e,n){return Ls(t,e).some(s=>He(s).includes(n))||e.filter(s=>Os(s,t)).some(s=>(s.parts??[]).some(r=>r.state.split(" + ").includes(n)))}var si=[{state:"hover",severity:"issue"},{state:"focus",severity:"issue"},{state:"disabled",severity:"issue"},{state:"active",severity:"note"}];function ri(t){let e={id:"states",title:"Missing states",description:"Styles with no hover, focus, disabled, or active rule, counting rules they inherit from a shared base class."},n=t.variants.filter(r=>r.element&&r.element.ancestors.length===0);if(n.length===0)return gt(e,"No styles that can be drawn on their own.");let s=[];for(let{state:r,severity:o}of si){let i=n.filter(a=>!ni(a,t.variants,r));i.length!==0&&s.push({severity:o,message:i.length===n.length?`No style defines a ${r} state.`:`${i.length} of ${n.length} styles have no ${r} state.`,styles:i.length===n.length?void 0:i.map(a=>a.title),refs:i.slice(0,6).map(a=>Y(a.path,a.line))})}return q(e,s,"Every style has hover, focus, disabled, and active rules.",r=>`${r} state${r===1?"":"s"} missing on some styles.`)}var Is=new Set(["outline","outline-style","outline-width"]),js=/^(?:none|0|0px)(?:\s+(?:none|0|0px))*$/i,oi=/^(?:outline(?:-color|-width|-style)?|box-shadow|border(?:-[a-z]+)*|background(?:-color)?|text-decoration(?:-[a-z]+)?|color)$/;function ii(t){let e={id:"focus",title:"Focus indicator removed",description:"Styles that remove the outline and give keyboard focus nothing in its place."},n=t.variants.filter(r=>r.element&&r.element.ancestors.length===0);if(n.length===0)return gt(e,"No styles that can be drawn on their own.");let s=[];for(let r of n){let o=Ls(r,t.variants),i=o.filter(l=>{let c=He(l);return c.includes("default")||c.includes("focus")}).flatMap(l=>l.declarations.map(c=>({s:l,d:c}))).find(({d:l})=>Is.has(l.property)&&js.test(l.value.replace(/\s*!important/i,"")));!i||o.filter(l=>He(l).includes("focus")).some(l=>l.declarations.some(c=>oi.test(c.property)&&!(Is.has(c.property)&&js.test(c.value))&&!/^(?:none|0|0px)$/i.test(c.value)&&!(c.property==="box-shadow"&&/^none$/i.test(c.value))))||s.push({severity:"issue",message:`${r.title} removes the outline (${i.d.property}: ${i.d.value}) and no focus rule replaces it.`,styles:[r.title],refs:[Y(r.path,i.s.line)]})}return q(e,s,"No style removes the outline without a focus replacement.",r=>`${r} style${r===1?"":"s"} lose the focus indicator.`)}function ai(t){let e={id:"tokens",title:"Undefined tokens",description:`Custom properties the ${t.noun} styles read that no scanned stylesheet defines.`};if(t.tokens.length===0)return gt(e,`The ${t.noun} styles read no custom properties.`);let s=t.tokens.filter(r=>r.definedIn.length===0&&!r.name.startsWith("--tw-")).map(r=>{let o=t.variants.filter(i=>i.states.some(a=>a.declarations.some(l=>l.value.includes(`var(${r.name}`)||new RegExp(`var\\(\\s*${r.name}\\b`).test(l.value))));return{severity:"note",message:`${r.name} is read but never defined here. It may be set outside the scanned files (a framework, a theme provider).`,styles:o.slice(0,8).map(i=>i.title),refs:o.slice(0,3).map(i=>Y(i.path,i.line))}});return q(e,s,`All ${t.tokens.length} tokens read are defined.`,r=>`${r} token${r===1?"":"s"} with no definition.`)}var li=/var\((?:[^()]|\([^()]*\))*\)/g,Ms=/#[0-9a-f]{3,8}\b|\b(?:rgba?|hsla?)\([^)]*\)/gi,ci=/^(?:padding|margin|gap|row-gap|column-gap|height|min-height|max-height|border-radius|font-size|letter-spacing)(?:-[a-z]+)*$/,ui=/(?<![\w.-])(\d+(?:\.\d+)?)px\b/g;function Ds(t){let e=t.trim().toLowerCase().replace(/\s+/g,""),n=/^#([0-9a-f]{3})$/.exec(e);return n?`#${[...n[1]].map(s=>s+s).join("")}`:e}function Je(t,e,n=0){return n>6?t:t.replace(/var\(\s*(--[\w-]+)\s*(?:,\s*([^)]*))?\)/g,(s,r,o)=>{let i=e.get(r);return i!==void 0?Je(i,e,n+1):o!==void 0?Je(o.trim(),e,n+1):s})}var pi=[[/^(?:padding|margin|gap|row-gap|column-gap)/,/space|spacing|gap|pad|inset|gutter/i],[/height$/,/height|control|size/i],[/^border-radius/,/radius|round|corner/i],[/^font-size$/,/text|font|size|type/i],[/^letter-spacing$/,/tracking|letter|spacing/i]];function fi(t,e){if(!e)return null;let n=pi.find(([s])=>s.test(t))?.[1];return e.find(s=>!n||n.test(s))??null}function di(t){let e={id:"hardcoded",title:"Hard-coded values",description:`Raw colors, and pixel sizes that exactly match a token, written into ${t.noun} styles instead of using the token.`},n=new Map,s=new Map;for(let[o,i]of t.tokenValues){let a=Je(i,t.tokenValues).trim();if(new RegExp(`^(?:${Ms.source})$`,"i").test(a)){let l=Ds(a);n.set(l,[...n.get(l)??[],o])}else/^\d+(?:\.\d+)?px$/.test(a)&&s.set(a,[...s.get(a)??[],o])}if(n.size===0&&s.size===0)return gt(e,"No color or size tokens were found to compare against.");let r=[];for(let o of t.variants){let i=[],a=null;for(let c of o.states)for(let u of c.declarations){if(u.via)continue;let f=u.value.replace(li," ");for(let m of f.matchAll(Ms)){let y=n.get(Ds(m[0]));i.push(y?`${m[0]} in ${u.property} is the value of ${y[0]}`:`${m[0]} in ${u.property} is not a token`),a??=c}if(ci.test(u.property))for(let m of f.matchAll(ui)){let y=fi(u.property,s.get(`${m[1]}px`));!y||Number(m[1])<=1||(i.push(`${m[1]}px in ${u.property} is the value of ${y}`),a??=c)}}if(i.length===0||!a)continue;let l=[...new Set(i)];r.push({severity:"issue",message:`${o.title}: ${l.slice(0,4).join("; ")}${l.length>4?`; and ${l.length-4} more`:""}.`,styles:[o.title],refs:[Y(o.path,a.line)]})}return q(e,r,`No ${t.noun} style hard-codes a value a token already has.`,o=>`${o} style${o===1?"":"s"} hard-code values.`)}function gi(t){let e={id:"unused",title:"Unused styles",description:"Styles defined in CSS that no component, page, or template references."},n=t.variants.filter(r=>r.element&&r.usage.status!=="unknown");if(n.length===0)return gt(e,"No styles with a class name to look for.");let s=[];for(let r of n)r.usage.status==="unreferenced"?s.push({severity:"issue",message:`${r.title} (${r.selector}) is defined but no reference to it was found.`,styles:[r.title],refs:[Y(r.path,r.line)]}):r.usage.status==="dynamic"&&s.push({severity:"note",message:`${r.title} (${r.selector}) is built at runtime and nothing selects it by value.`,styles:[r.title],refs:[Y(r.path,r.line),...r.usage.files.slice(0,2)]});return s.sort((r,o)=>+(o.severity==="issue")-+(r.severity==="issue")),q(e,s,`All ${n.length} styles are referenced.`,r=>`${r} style${r===1?"":"s"} unreferenced or unconfirmed.`)}function mi(t){let e={id:"duplicates",title:"Duplicate styles",description:"Different styles whose default declarations are identical."},n=new Map;for(let r of t.variants){if(!r.element)continue;let o=r.states.filter(a=>a.state==="default"&&a.context==="").flatMap(a=>a.declarations).map(a=>`${a.property}:${a.value.replace(/\s+/g," ").trim()}`);if(o.length<2)continue;let i=[...new Set(o)].sort().join(";");n.set(i,[...n.get(i)??[],r])}let s=[...n.values()].filter(r=>r.length>1).map(r=>({severity:"issue",message:`${r.map(o=>o.title).join(", ")} declare the same default styles (${r.map(o=>o.selector).join(", ")}).`,styles:r.map(o=>o.title),refs:r.map(o=>Y(o.path,o.line))}));return q(e,s,"No two styles share the same default declarations.",r=>`${r} group${r===1?"":"s"} of identical styles.`)}function hi(t){let e={id:"native",title:`Native <${t.element}> instead of the component`,description:`Files that render a raw <${t.element}> although the repository has a shared ${t.element} component.`};if(!t.hasComponent)return gt(e,`No shared ${t.element} component was found, so native elements are expected.`);let n=t.nativeUses.map(s=>({severity:"issue",message:`${s.count} native <${t.element}> element${s.count===1?"":"s"} in ${s.path}.`,refs:[Y(s.path,s.line)]}));return q(e,n,`Every <${t.element}> goes through the component.`,s=>`${s} file${s===1?"":"s"} bypass the component.`)}function yi(t){let e={id:"props",title:"Prop values with no look",description:`Calls to a ${t.element} component with a literal prop value the component has no style for.`};if(!t.hasComponent)return gt(e,`No shared ${t.element} component was found.`);let n=(t.unknownProps??[]).map(s=>({severity:"issue",message:`<${s.component} ${s.prop}="${s.value}"> in ${s.path}: ${s.component} has no ${s.prop} "${s.value}" (it has ${s.known.join(", ")}).`,refs:[Y(s.path,s.line)]}));return q(e,n,"Every literal prop value picks a look the component has.",s=>`${s} call${s===1?"":"s"} ask for a look the component does not have.`)}function bi(t){let e={id:"undocumented",title:"Styles without written guidance",description:"Styles that no instruction file or doc names, so nothing written says how they should be used."},{guidance:n}=t;if(n.files.length===0)return{...e,status:"attention",summary:`Nothing in the repository mentions ${t.noun}.`,findings:[{severity:"note",message:`No instruction file or doc says how ${t.noun} should look or be built.`,refs:[]}]};if(n.undocumented.length===0)return q(e,[],"Every style is named in written guidance.",()=>"");let s=t.variants.filter(r=>r.element&&n.undocumented.includes(r.title));return q(e,[{severity:"note",message:`${n.undocumented.length} of ${n.documented.length+n.undocumented.length} styles are named in no guidance.`,styles:n.undocumented,refs:s.slice(0,6).map(r=>Y(r.path,r.line))}],"",r=>`${r} finding${r===1?"":"s"}.`)}function Ps(t){return[ri(t),ii(t),gi(t),mi(t),ai(t),di(t),hi(t),yi(t),bi(t)]}var xi=/\.(erb|php|hbs|njk|liquid|twig|ejs|pug|cshtml|razor|jinja2?|j2)$/i,Ts=/^<([A-Za-z][\w.-]*)\b((?:[^<>"'`{}]|"[^"]*"|'[^']*'|`[^`]*`|\{(?:[^{}]|\{[^{}]*\})*\})*)>/,ki=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]),wi=new Set(["span","svg","i","img","em","strong","small","b","p","kbd","abbr","sup","sub","picture","use","path"]),vi=new Set(["classNames","classnames","clsx","cn","cx"]),$i=/^(?:ref|key|style|dangerouslySetInnerHTML)$/i;function Bs(t,e){let n=1;for(let s=0;s<e&&s<t.length;s++)t[s]===`
|
|
29
|
+
`&&n++;return n}function Ns(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Fs(t){let e=t.filter(s=>s.trim()).map(s=>/^ */.exec(s)?.[0].length??0),n=e.length?Math.min(...e):0;return t.map(s=>{let r=s.slice(n);return r.length>200?`${r.slice(0,200)}\u2026`:r}).join(`
|
|
30
|
+
`)}function Ci(t,e,n){let s=Math.max(0,Math.min(e,t.length)),r=Math.max(s,Math.min(n,t.length)),o=Bs(t,s),i=t.slice(s,r).split(`
|
|
31
|
+
`).slice(0,12),a=t.slice(s,r).split(`
|
|
32
|
+
`).length>12;return{source:Fs(i)+(a?`
|
|
33
|
+
\u2026`:""),startLine:o}}function Si(t,e){let n=Bs(t,Math.max(0,e)),s=t.split(`
|
|
34
|
+
`),r=Math.max(0,n-1);return{source:Fs(s.slice(r,r+12)),startLine:r+1}}function Vs(t,e){return{kind:"other",...Si(t,e)}}function ue(t,e){let n=Ts.exec(t.slice(e));if(!n)return null;let s=n[1],r=n[2]??"",o=e+n[0].length;if(/\/\s*$/.test(r)||ki.has(s.toLowerCase()))return{tag:s,attrs:r,openStart:e,openEnd:o,closeEnd:o,body:""};let a=1,l=o,c=Math.min(t.length,e+4e3);for(;l<c;){if(t[l]!=="<"){l++;continue}if(t.startsWith("</",l)){let f=/^<\/([A-Za-z][\w.-]*)\s*>/.exec(t.slice(l));if(f&&f[1].toLowerCase()===s.toLowerCase()){if(a--,a===0){let m=l+f[0].length;return{tag:s,attrs:r,openStart:e,openEnd:o,closeEnd:m,body:t.slice(o,l)}}l+=f?f[0].length:2;continue}l+=f?f[0].length:2;continue}let u=Ts.exec(t.slice(l));if(u&&u[1].toLowerCase()===s.toLowerCase()&&!/\/\s*$/.test(u[2]??"")&&(a++,a>6))return"too-big";l+=u?u[0].length:1}return l>=c&&o+(c-e)>=4e3?"too-big":null}function Xe(t,e){let n=Math.max(0,e-8e3),s=Math.min(e,t.length-1);for(;s>=n;){let r=t.lastIndexOf("<",s);if(r<n)return null;if(t[r+1]==="/"||t[r+1]==="!"||t[r+1]==="?"){s=r-1;continue}let o=ue(t,r);if(o==="too-big")return"too-big";if(o&&e>=o.openStart&&e<o.closeEnd)return o;s=r-1}return null}function zs(t){return t.replace(/([a-z\d])([A-Z])/g,"$1-$2").replace(/_/g,"-").toLowerCase()}function At(t){return t.split(/\s+/).filter(Boolean)}function ot(t,e){let n=t[e];if(n!=='"'&&n!=="'"&&n!=="`")return null;let s="";for(let r=e+1;r<t.length;r++){let o=t[r];if(o==="\\"){s+=t[r+1]??"",r++;continue}if(n==="`"&&o==="$"&&t[r+1]==="{")return null;if(o===n)return{value:s,end:r+1};s+=o}return null}function Ws(t){let e=[],n="",s=0,r=null;for(let o=0;o<t.length;o++){let i=t[o];if(r){if(n+=i,i==="\\"){n+=t[o+1]??"",o++;continue}i===r&&(r=null);continue}if(i==='"'||i==="'"||i==="`"){r=i,n+=i;continue}if(i==="("||i==="["||i==="{")s++;else if(i===")"||i==="]"||i==="}")s=Math.max(0,s-1);else if(i===","&&s===0){n.trim()&&e.push(n.trim()),n="";continue}n+=i}return n.trim()&&e.push(n.trim()),e}function le(t=new Map,e=new Map){return{values:t,aliases:e,flags:new Set,strings:new Set,prefixes:new Map}}var Ze=/^[A-Za-z_$][\w$]*$/;function Ye(t,e){let n=0,s=null;for(let r=0;r<t.length;r++){let o=t[r];if(s){o==="\\"?r++:o===s&&(s=null);continue}if(o==='"'||o==="'"||o==="`"){s=o;continue}if(o==="("||o==="["||o==="{")n++;else if(o===")"||o==="]"||o==="}")n--;else if(n===0&&t.startsWith(e,r))return r}return-1}function qe(t){let e=t.trim();for(;e.startsWith("(")&&e.endsWith(")");){let n=0,s=!0;for(let r=0;r<e.length-1&&s;r++)e[r]==="("?n++:e[r]===")"&&n--,n===0&&(s=!1);if(!s)break;e=e.slice(1,-1).trim()}return e}function Us(t,e,n){if(t==="true")return!0;if(t==="false"||t==="undefined"||t==="null")return!1;let s=e.aliases.get(t);return s!==void 0&&!e.values.has(t)?Rt(s,e,n+1):(e.flags.add(t),!!e.values.get(t))}function Rt(t,e,n=0){if(n>4)return null;let s=qe(t);for(let c of["||","&&"]){let u=Ye(s,c);if(u<0)continue;let f=Rt(s.slice(0,u),e,n+1),m=Rt(s.slice(u+2),e,n+1);return f===null||m===null?null:c==="||"?f||m:f&&m}let r=/^(!\s*)?([A-Za-z_$][\w$]*)$/.exec(s);if(r){let c=Us(r[2],e,n);return c===null?null:r[1]?!c:c}let o=/^([A-Za-z_$][\w$]*)\s*(===|==|!==|!=)\s*(["'])(.*?)\3$/.exec(s);if(!o)return null;let i=e.values.get(o[1]);typeof i=="string"&&e.strings.add(o[1]);let a=typeof i=="string"?i:"";return o[2]==="==="||o[2]==="=="?a===o[4]:a!==o[4]}function Gs(t){let e=0,n=null,s=-1;for(let r=0;r<t.length;r++){let o=t[r];if(n){o==="\\"?r++:o===n&&(n=null);continue}if(o==='"'||o==="'"||o==="`"){n=o;continue}if(o==="("||o==="["||o==="{")e++;else if(o===")"||o==="]"||o==="}")e--;else if(o==="?"&&e===0){s=r;break}}if(s<0)return null;e=0,n=null;for(let r=s+1;r<t.length;r++){let o=t[r];if(n){o==="\\"?r++:o===n&&(n=null);continue}if(o==='"'||o==="'"||o==="`"){n=o;continue}if(o==="("||o==="["||o==="{")e++;else if(o===")"||o==="]"||o==="}")e--;else if(o===":"&&e===0)return{condition:t.slice(0,s),yes:t.slice(s+1,r),no:t.slice(r+1)}}return null}function St(t,e=le()){let n=qe(t);if(!n)return{classes:[],dynamic:!1};let s=Gs(n);if(s){let c=Rt(s.condition,e);return c===null?{classes:[],dynamic:!0}:St(c?s.yes:s.no,e)}let r=Ye(n,"&&");if(r>=0){let c=Rt(n.slice(0,r),e);return c===null?{classes:[],dynamic:!0}:c?St(n.slice(r+2),e):{classes:[],dynamic:!1}}if(n.startsWith('"')&&n.endsWith('"')||n.startsWith("'")&&n.endsWith("'"))return{classes:At(n.slice(1,-1)),dynamic:!1};if(n.startsWith("`")&&n.endsWith("`")){let c=n.slice(1,-1),u="",f=0;for(;f<c.length;){let m=c.indexOf("${",f);if(m<0){u+=c.slice(f);break}u+=c.slice(f,m);let y=c.indexOf("}",m+2);if(y<0)return{classes:[],dynamic:!0};let $=c.slice(m+2,y).trim();if(Ze.test($)){let C=e.values.get($);if(typeof C!="string")return{classes:[],dynamic:!0};e.strings.add($);let v=/[\w-]*$/.exec(u)?.[0];v&&e.prefixes.set($,v),u+=C}else{let C=St($,e);if(C.dynamic)return{classes:[],dynamic:!0};u+=C.classes.join(" ")}f=y+1}return{classes:At(u),dynamic:!1}}if(Ze.test(n)&&e.values.has(n)){let c=e.values.get(n);return typeof c!="string"?{classes:[],dynamic:!1}:(e.strings.add(n),{classes:At(c),dynamic:!1})}let o=/^(?:styles?|classes|css|cls)\.([A-Za-z_]\w*)$/.exec(n);if(o)return{classes:[zs(o[1])],dynamic:!1};let i=/^(?:styles?|classes|css|cls)\[\s*["']([\w-]+)["']\s*\]$/.exec(n);if(i)return{classes:[i[1]],dynamic:!1};let a=/^(?:styles?|classes|css|cls)\[\s*(`[^`]*`)\s*\]$/.exec(n);if(a){let c=St(a[1],e);return c.dynamic||c.classes.length!==1?{classes:[],dynamic:!0}:c}let l=/^([A-Za-z_][\w]*)\s*\(([\s\S]*)\)$/.exec(n);if(l&&vi.has(l[1])){let c=[];for(let u of Ws(l[2])){let f=St(u,e);if(f.dynamic)return{classes:[],dynamic:!0};c.push(...f.classes)}return{classes:c,dynamic:!1}}return{classes:[],dynamic:!0}}function pe(t){let e=[],n=!1,s=0;for(;s<t.length;){if(/\s/.test(t[s])){s++;continue}if(t[s]==="{"){let i=0,a=s;for(let l=s;l<t.length;l++)if(t[l]==="{")i++;else if(t[l]==="}"&&(i--,i===0)){s=l+1;break}s===a&&(s=t.length),/^\{\s*\.\.\./.test(t.slice(a))&&(n=!0);continue}let r=/^([A-Za-z_:][\w:.-]*)/.exec(t.slice(s));if(!r){s++;continue}for(s+=r[0].length;s<t.length&&/\s/.test(t[s]);)s++;if(t[s]!=="="){e.push({name:r[1]});continue}for(s++;s<t.length&&/\s/.test(t[s]);)s++;let o=ot(t,s);if(o){e.push({name:r[1],value:o.value}),s=o.end;continue}if(t[s]==="{"){let i=0,a=s;for(let u=s;u<t.length;u++)if(t[u]==="{")i++;else if(t[u]==="}"&&(i--,i===0)){s=u+1;break}s===a&&(s=t.length);let l=t.slice(a+1,s-1).trim(),c=ot(l,0);c&&c.end===l.length?e.push({name:r[1],value:c.value}):e.push({name:r[1],expr:l});continue}s++}return{list:e,spread:n}}function Qe(t,e){let n=pe(t).list.find(s=>s.name==="class"||s.name==="className");return n?n.value!==void 0?{classes:At(n.value),dynamic:!1}:n.expr===void 0?{classes:[],dynamic:!0}:St(n.expr,e):null}function Ks(t,e){return/[<>]/.test(e)?!1:t==="href"||t==="src"||t==="action"?/^(?:https?:|mailto:|\/|#)/i.test(e):!0}function Ai(t){return t==="class"||t==="className"?!1:!$i.test(t)&&!/^on/i.test(t)}function Hs(t){let e={};for(let n of pe(t).list){if(!Ai(n.name)||n.expr!==void 0)continue;let s=n.value??"";Ks(n.name,s)&&(e[n.name]=s)}return e}var Ri=/^(?:data-[\w-]+|aria-[\w-]+|disabled|hidden)$/,_i=new Set(["disabled","hidden"]);function ae(t,e,n=0){if(n>4)return null;let s=qe(t),r=ot(s,0);if(r&&r.end===s.length)return r.value;let o=Gs(s);if(o){let l=Rt(o.condition,e);return l===null?null:ae(l?o.yes:o.no,e,n+1)}let i=Ye(s,"||");if(i>=0){let l=ae(s.slice(0,i),e,n+1);return l===null?null:l!==void 0?l:ae(s.slice(i+2),e,n+1)}if(s==="undefined"||s==="null"||s==="false")return;if(s==="true")return"true";if(!Ze.test(s))return null;let a=e.values.get(s);if(typeof a=="string")return e.strings.add(s),a;if(typeof a=="boolean"||e.aliases.has(s)){let l=Us(s,e,n);return l===null?null:l?"true":void 0}return e.values.has(s)?void 0:null}function Ei(t,e){let n={};for(let s of pe(t).list){if(s.expr===void 0||!Ri.test(s.name))continue;let r=ae(s.expr,e);if(r!=null){if(_i.has(s.name)){r!=="false"&&(n[s.name]="");continue}Ks(s.name,r)&&(n[s.name]=r)}}return n}function Ii(t,e){let n=/([A-Za-z_][\w-]*)\s*=\s*(?:"([^"]*)"|'([^']*)'|\{\s*["']([^"']*)["']\s*\})/g;for(let s of t.matchAll(n)){let r=s.index??0;if(e>=r&&e<r+s[0].length){let o=s[1];return o==="class"||o==="className"?{}:{prop:o,value:s[2]??s[3]??s[4]}}}return{}}function ce(t,e=0){if(e>6)return"";let n="",s=0;for(;s<t.length;){if(t[s]==="{"){let i=0,a=s;for(let u=s;u<t.length;u++)if(t[u]==="{")i++;else if(t[u]==="}"&&(i--,i===0)){a=u+1;break}if(a===s)break;let l=t.slice(s+1,a-1).trim();/^[A-Za-z_$][\w$]*$/.exec(l)?.[0]&&(n+='<span class="__gs-slot">Text</span>'),s=a;continue}if(t[s]==="<"){if(t.startsWith("<!--",s)){let l=t.indexOf("-->",s);s=l===-1?t.length:l+3;continue}if(t.startsWith("</",s)){let l=/^<\/[A-Za-z][\w.-]*\s*>/.exec(t.slice(s));s+=l?l[0].length:1;continue}let i=ue(t,s);if(!i||i==="too-big"){s++;continue}let a=i.tag.toLowerCase();if(/^[A-Z]/.test(i.tag))n+=ce(i.body,e+1);else if(wi.has(a)){let l=Qe(i.attrs),c=l&&!l.dynamic&&l.classes.length?` class="${Ns(l.classes.join(" "))}"`:"",u=ce(i.body,e+1);n+=`<${a}${c}>${u}</${a}>`}s=i.closeEnd;continue}let r=t.slice(s).search(/[<{}]/),o=r===-1?t.length:s+r;n+=Ns(t.slice(s,o)),s=o}return n}function ji(t){let e=Qe(t.attrs);return!e||e.dynamic||e.classes.length===0?null:{tag:t.tag.toLowerCase(),classes:e.classes,attrs:Hs(t.attrs)}}function Js(t,e){let n=[],s=e-1;for(;n.length<3&&s>=0;){let r=Xe(t,s);if(!r||r==="too-big"||/^[A-Z]/.test(r.tag))break;let o=ji(r);if(!o)break;n.push(o),s=r.openStart-1}return n.reverse()}var Mi=8;function Di(t){let e=t.trim(),n=ot(e,0);return n&&n.end===e.length?n.value:e==="true"?!0:e==="false"?!1:/^-?\d+(?:\.\d+)?$/.test(e)?e:null}function Oi(t,e){let n=0,s=-1;for(let i=e;i<t.length&&i<e+2e3;i++){let a=t[i];if(a==='"'||a==="'"||a==="`"){let l=ot(t,i);if(!l)return null;i=l.end-1;continue}if(a==="{")n++;else if(a==="}"&&(n--,n===0)){s=i;break}}if(s<0)return null;let r=t.slice(s+1).trimStart()[0];if(r!==")"&&r!==":")return null;let o=new Map;for(let i of Ws(t.slice(e+1,s))){if(i.startsWith("..."))continue;let a=/^([A-Za-z_$][\w$]*)(?:\s*:\s*([A-Za-z_$][\w$]*))?(?:\s*=\s*([\s\S]+))?$/.exec(i);if(!a)continue;let l=a[2]??a[1];if(a[3]===void 0){o.set(l,void 0);continue}let c=Di(a[3]);c!==null&&o.set(l,c)}return{values:o,end:s}}function Li(t,e){let n=new Set(e.attrs.match(/[A-Za-z_$][\w$]*/g)??[]),s=Math.max(0,e.openStart-8e3),o=[...t.slice(s,e.openStart).matchAll(/\(\s*\{/g)].reverse();for(let i of o){let a=s+(i.index??0)+i[0].length-1,l=Oi(t,a);if(!l||![...l.values.keys()].some(f=>n.has(f)))continue;let c=new Map,u=t.slice(l.end,e.openStart);for(let f of u.matchAll(/\bconst\s+([A-Za-z_$][\w$]*)\s*=\s*([^;\n]+);/g))n.has(f[1])&&c.set(f[1],f[2].trim());return le(l.values,c)}return le()}function Pi(t,e){let n=new Map;for(let s of t.matchAll(/([\w-]+)\$\{\s*([A-Za-z_$][\w$]*)\s*\}/g)){let r=s[1],o=e.find(i=>i.startsWith(r)&&i.length>r.length);o&&n.set(s[2],o.slice(r.length))}return n}function Ti(t,e,n,s){let r=Ci(t,e.openStart,e.closeEnd);if(/^[A-Z]/.test(e.tag)){let m=Ii(t.slice(e.openStart,e.openEnd),n-e.openStart);return{kind:"component",...r,component:{tag:e.tag,...m}}}let o=Li(t,e);for(let[m,y]of Pi(e.attrs,s))o.values.set(m,y);let i={};for(let[m,y]of o.values)i[m]=y??null;let a={attrs:e.attrs,values:i,aliases:Object.fromEntries(o.aliases)},l=le(new Map(o.values),o.aliases),c=Ni(a.attrs,l);if(!c)return{kind:"dynamic",...r};let u={tag:e.tag.toLowerCase(),...c,ancestors:Js(t,e.openStart),bodyHtml:ce(e.body)},f=[...[...l.strings].filter(m=>typeof o.values.get(m)=="string").map(m=>({name:m,kind:"text",...l.prefixes.has(m)?{prefix:l.prefixes.get(m)}:{}})),...[...l.flags].slice(0,Mi).map(m=>({name:m,kind:"flag"}))];return f.length===0?{kind:"markup",...r,element:u}:{kind:"markup",...r,element:u,params:f,redraw:a}}function Ni(t,e){let n=Qe(t,e);return n?.dynamic?null:{classes:n?.classes??[],attrs:{...Hs(t),...Ei(t,e)}}}function tn(t,e,n,s){if(xi.test(s))return Vs(t,e);let r=Xe(t,e);return r==="too-big"||!r?Vs(t,e):Ti(t,r,e,n)}function Vi(t){let e={},n=new Set,{list:s,spread:r}=pe(t);for(let o of s)o.expr===void 0?e[o.name]=o.value??"true":o.expr==="true"||o.expr==="false"?e[o.name]=o.expr:n.add(o.name);return{literals:e,dynamic:n,spread:r}}function Zs(t,e){let n=Vi(e),s=new Map,r=[],o=[],i=[],a=n.spread;for(let l of t.axes){if(l.opaque){a=!0;continue}if(!l.locked&&n.dynamic.has(l.prop)){a=!0;continue}let c=l.locked?l.defaultValue:n.literals[l.prop]??(n.spread?void 0:l.defaultValue);if(c===void 0)continue;s.set(l.prop,c);let u=!l.locked&&n.literals[l.prop]===c;if(l.prefix){o.push(`${l.prefix}${c}`),u&&c!==l.defaultValue&&i.push({prop:l.prop,value:c,known:l.defaultValue?[l.defaultValue]:[],cls:`${l.prefix}${c}`});continue}let f=l.values.find(m=>m.value===c);if(!f){a=!0,u&&l.values.length>0&&i.push({prop:l.prop,value:c,known:l.values.map(m=>m.value)});continue}for(let m of f.classes)m.startsWith("__gs-recipe-")&&r.push(m),o.push(m)}if(!a){for(let l of t.compounds)if(l.when.every(u=>s.get(u.prop)===u.value))for(let u of l.classes)u.startsWith("__gs-recipe-")&&r.push(u),o.push(u)}return t.classNameProp&&(n.dynamic.has("className")?a=!0:n.literals.className&&o.push(...At(n.literals.className))),{draw:a?null:[...t.staticClasses,...o],selects:r,unknown:i}}function en(t){let e=[],n=/import\s*\{([^}]+)\}\s*from\s*["']([^"']+)["']/g;for(let s of t.matchAll(n)){let r=s[2];for(let o of s[1].split(",")){let i=o.trim().split(/\s+as\s+/),a=i[0]?.trim(),l=(i[1]??i[0])?.trim();a&&l&&e.push({local:l,imported:a,spec:r})}}return e}function Bi(t,e,n,s,r){for(let o of en(e)){if(o.local!==n)continue;let i=r(t,o.spec),a=s.find(l=>l.path===i&&l.component===o.imported);if(a)return a}return s.find(o=>o.path===t&&o.component===n)}function Xs(t,e,n,s,r,o){if(t.kind!=="component"||!t.component||r.length===0)return t;let i=Bi(s,e,t.component.tag,r,o);if(!i)return t;let a=Xe(e,n),l=t.component.tag;if(!a||a==="too-big"||a.tag!==l&&a.tag!==i.component)return t;let c=Zs(i,a.attrs);return c.draw?{kind:"markup",source:t.source,startLine:t.startLine,component:t.component,element:{tag:i.rootTag,classes:c.draw,attrs:{},ancestors:Js(e,a.openStart),bodyHtml:ce(a.body)}}:t}function fe(t,e,n,s){let r=[],o=new Set,i=(l,c)=>{let u=`${l}\0${c.path}`;o.has(u)||(o.add(u),r.push({local:l,binding:c}))};for(let l of en(e)){let c=s(t,l.spec),u=n.find(f=>f.path===c&&f.component===l.imported);u&&i(l.local,u)}for(let l of n)l.path===t&&i(l.component,l);let a=[];for(let{local:l,binding:c}of r){let u=0,f=`<${l}`;for(;u<e.length;){let m=e.indexOf(f,u);if(m<0)break;let y=e[m+f.length];if(y&&/[\w.]/.test(y)){u=m+f.length;continue}let $=ue(e,m);if(!$||$==="too-big"){u=m+f.length;continue}let C=Zs(c,$.attrs);(C.selects.length||C.unknown.length)&&a.push({offset:m,component:l,selects:C.selects,unknown:C.unknown}),u=Math.max($.closeEnd,m+f.length)}}return a}function Fi(t,e){let n=t.slice(e,e+700),s=n.indexOf("{");if(s<0)return{};let r=n.indexOf("}",s),o=n.slice(s,r<0?s+400:r+1),i={};for(let a of o.matchAll(/([A-Za-z_$][\w$]*)\s*=\s*(?:"([^"]*)"|'([^']*)')/g))i[a[1]]=a[2]??a[3]??"";return i}function zi(t){let e=/\bclassName\s*=\s*/.exec(t);if(!e)return null;let n=e.index+e[0].length,s=ot(t,n);if(s)return s.value;if(t[n]!=="{")return null;let r=0;for(let o=n;o<t.length;o++)if(t[o]==="{")r++;else if(t[o]==="}"&&(r--,r===0))return t.slice(n+1,o);return null}function Wi(t,e){let n=e+1;for(;n<t.length&&/\s/.test(t[n]);)n++;if(t[n]===")")return{rename:{},fixed:{},opaque:[]};if(t[n]!=="{")return null;let s={rename:{},fixed:{},opaque:[]};for(n++;n<t.length;){for(;n<t.length&&/[\s,]/.test(t[n]);)n++;if(t[n]==="}")return s;if(t.startsWith("...",n))return null;let r=/^[A-Za-z_$][\w$]*/.exec(t.slice(n));if(!r)return null;for(n+=r[0].length;n<t.length&&/\s/.test(t[n]);)n++;if(t[n]===","||t[n]==="}"){s.rename[r[0]]=r[0];continue}if(t[n]!==":")return null;for(n++;n<t.length&&/\s/.test(t[n]);)n++;let o=ot(t,n);if(o){s.fixed[r[0]]=o.value,n=o.end;continue}let i=/^[A-Za-z_$][\w$]*/.exec(t.slice(n));if(i){s.rename[r[0]]=i[0],n+=i[0].length;continue}s.opaque.push(r[0]);let a=0;for(;n<t.length;){let l=t[n];if(l==='"'||l==="'"||l==="`"){let c=ot(t,n);if(!c)return null;n=c.end;continue}if(l==="("||l==="["||l==="{")a++;else if(l===")"||l==="]"||l==="}"){if(a===0)break;a--}else if(l===","&&a===0)break;n++}}return null}function Ui(t,e,n,s){let r=[];for(let o of en(t)){let i=s(e,o.spec),a=n.find(l=>l.path===i&&l.name===o.imported);a&&r.push({local:o.local,recipe:a})}for(let o of n)o.path===e&&o.name&&r.push({local:o.name,recipe:o});return r}function Gi(t){let e=[],n=/(?:styles?|classes|css|cls)\s*\.\s*([A-Za-z_]\w*)/g;for(let c of t.matchAll(n))e.push({at:c.index??0,kind:"static",text:zs(c[1])});let s=/(?:styles?|classes|css|cls)\s*\[\s*["']([^"']+)["']\s*\]/g;for(let c of t.matchAll(s))e.push({at:c.index??0,kind:"static",text:c[1]});let r=/(?:styles?|classes|css|cls)\s*\[\s*`([^`$]*)\$\{\s*([A-Za-z_$][\w$]*)\s*\}`\s*\]/g;for(let c of t.matchAll(r))e.push({at:c.index??0,kind:"prefix",text:c[1],prop:c[2]});let o=/(?:styles?|classes|css|cls)\s*\[\s*["']([^"']+)["']\s*\+\s*([A-Za-z_$][\w$]*)\s*\]/g;for(let c of t.matchAll(o))e.push({at:c.index??0,kind:"prefix",text:c[1],prop:c[2]});/[[{(]/.test(t)||e.push({at:0,kind:"static",text:t.trim()}),e.sort((c,u)=>c.at-u.at);let i=[],a=[];for(let c of e)c.kind==="prefix"&&c.prop?a.push({prop:c.prop,prefix:c.text}):i.push(...At(c.text));let l=/(?:^|[(,\s])className\s*(?:[,)]|$)/.test(t);return{staticClasses:i,prefixes:a,classNameProp:l}}function Ki(t,e,n,s,r){let o=l=>e.rename[l]??l,i=t.axes.map(l=>{let c=e.fixed[l.prop],u=o(l.prop);return{prop:u,values:c?l.values.filter(f=>f.value===c):l.values,defaultValue:c??n[u]??l.defaultValue,opaque:e.opaque.includes(l.prop),locked:!!c}}),a=t.compounds.map(l=>({classes:l.classes,when:l.when.map(c=>({prop:o(c.prop),value:e.fixed[c.prop]??c.value}))}));return{staticClasses:[...t.staticClasses,...s],axes:i,compounds:a,classNameProp:r}}function Ys(t,e,n){let s=[];for(let r of t){let o=Ui(r.source,r.path,e,n);for(let i of r.names){let a=new RegExp(`(?:function\\s+${i}\\b|(?:const|let|var)\\s+${i}\\b)`,"g"),l=[...r.source.matchAll(a)],c=null;for(let u of l){let f=u.index??0,y=r.source.slice(f+u[0].length).search(/\nexport\s/),$=r.source.slice(f,f+u[0].length+(y<0?8e3:y)),C=Fi(r.source,f),v=0;for(;v<$.length;){if($[v]!=="<"||$[v+1]==="/"||$[v+1]==="!"){v++;continue}let g=ue($,v);if(!g||g==="too-big"){v++;continue}if(v=g.openEnd,/^[A-Z]/.test(g.tag))continue;let p=zi(g.attrs);if(!p)continue;let d=Gi(p),b=d.prefixes.length?2:d.staticClasses.length?1:0,k=null,x=o.find(w=>new RegExp(`(?:^|[^\\w$])${w.local}\\s*\\(`).test(p));if(x){let w=p.search(new RegExp(`(?:^|[^\\w$])${x.local}\\s*\\(`)),j=p.indexOf("(",w),I=j<0?null:Wi(p,j);if(I){b=3,k=Ki(x.recipe,I,C,d.staticClasses,d.classNameProp);for(let R of d.prefixes)k.axes.push({prop:R.prop,values:[],prefix:R.prefix,defaultValue:C[R.prop]})}}!k&&(d.prefixes.length||d.staticClasses.length)&&(k={staticClasses:d.staticClasses,axes:d.prefixes.map(w=>({prop:w.prop,values:[],prefix:w.prefix,defaultValue:C[w.prop]})),compounds:[],classNameProp:d.classNameProp}),k&&(!c||b>c.score)&&(c={score:b,tag:g.tag.toLowerCase(),body:k})}}c&&s.push({component:i,path:r.path,rootTag:c.tag,...c.body})}}return s}var Hi=/<([A-Za-z][\w.-]*)\b((?:[^<>"'`{}]|"[^"]*"|'[^']*'|`[^`]*`|\{(?:[^{}]|\{[^{}]*\})*\})*)>/g,Ji=/\b(?:styles?|classes|css|cls)\s*(?:\.([A-Za-z_]\w*)|\[\s*["']([\w-]+)["']\s*\])/g,Zi=new Set(["span","svg","i","img","em","strong","small","b","p","kbd","abbr","sup","sub","picture","use","path"]),Xi=new Set(["icon","glyph","svg"]),Yi=new Set(["label","text","title","caption"]),qi=t=>t.replace(/([a-z\d])([A-Z])/g,"$1-$2").split(/[^a-z0-9]+/i).filter(Boolean).map(e=>e.toLowerCase());function Qs(t){let e=t.flatMap(qi);return e.some(n=>Xi.has(n))?"icon":e.some(n=>Yi.has(n))?"label":null}function Qi(t){let e=t.replace(/\{\s*\/\*[\s\S]*?\*\/\s*\}/g," "),n=[];for(let s of e.matchAll(Hi)){let r=s[1];if(!Zi.has(r.toLowerCase())||r!==r.toLowerCase())continue;let o=[...s[2].matchAll(Ji)].map(a=>a[1]??a[2]),i=Qs(o);i&&n.push({index:s.index??0,role:i,tag:r.toLowerCase(),classes:o})}return n}function ta(t,e,n){if(!e.some(r=>r.property.toLowerCase()==="display"&&/^none\b/i.test(r.value.trim()))||n.size===0)return null;for(let r of z(t)){let o=X(r);if(!o||o.length<2)continue;let i=o[o.length-1];if(i.combinator!==" "&&i.combinator!==">")continue;let a=i.simples.filter(m=>m.kind==="class");if(a.length!==1||a[0].kind!=="class"||!n.has(a[0].name))continue;let l=o[o.length-2];if(l.simples.filter(m=>m.kind!=="class"&&m.kind!=="attr"&&m.kind!=="tag").length>0)continue;let u=l.simples.filter(m=>m.kind==="class"),f=l.simples.filter(m=>m.kind==="attr");if(u.length===1&&f.length===0&&u[0].kind==="class"&&!/^(?:is|has)-/.test(u[0].name))return{classes:[u[0].name],attrs:{}};if(u.length===0&&f.length===1&&f[0].kind==="attr"&&f[0].value)return{classes:[],attrs:{[f[0].name]:f[0].value}}}return null}var ea=["text","icon-start","icon-end","icon"],qs={text:"Text","icon-start":"Icon left","icon-end":"Icon right",icon:"Icon"};function na(t,e){let n=null,s=null;for(let i of e)i.index<t.index?n=i:s||(s=i);if(!n&&!s)return null;let r=n?t.index-n.index:1/0;return(s?s.index-t.index:1/0)<=r?"start":"end"}function _t(t){return{role:t.role,tag:t.tag,classes:t.classes}}function tr(t){let e=new Map,n=(s,r)=>{let o=e.get(s)??[];o.some(i=>i.path===r.path)||o.push(r),e.set(s,o)};for(let s of t){let r=s.sources.flatMap(Qi),o=r.filter(y=>y.role==="label"),i=r.filter(y=>y.role==="icon"),a=o[0];a&&n("text",{path:s.sheet,slots:[_t(a)],classes:[],attrs:{}});let l=new Set(o.flatMap(y=>y.classes.filter($=>Qs([$])==="label"))),c=null,u=null;for(let y of i){let $=na(y,o),C=o.reduce((v,g)=>{let p=Math.abs(g.index-y.index);return!v||p<v.dist?{hit:g,dist:p}:v},null);$==="start"&&C&&!c&&(c={icon:y,label:C.hit}),$==="end"&&C&&!u&&(u={icon:y,label:C.hit})}c&&n("icon-start",{path:s.sheet,slots:[_t(c.icon),_t(c.label)],classes:[],attrs:{}}),u&&n("icon-end",{path:s.sheet,slots:[_t(u.label),_t(u.icon)],classes:[],attrs:{}});let f=null;for(let y of s.rules)if(f=ta(y.selector,y.declarations,l),f)break;let m=c?.icon??u?.icon??i[0]??null;f&&m&&n("icon",{path:s.sheet,slots:[_t(m)],classes:f.classes,attrs:f.attrs})}return[{id:"text",label:qs.text,sheets:e.get("text")??[]},...ea.filter(s=>s!=="text"&&e.has(s)).map(s=>({id:s,label:qs[s],sheets:e.get(s)??[]}))]}function sa(t,e){if(!t)return e;let n=z(t);return z(e).flatMap(s=>n.map(r=>s.includes("&")?s.replaceAll("&",r):`${r} ${s}`)).join(", ")}var ra=/^@(?:-\w+-)?(?:keyframes|font-face|property)\b/i;function mt(t){let e=t.replace(/\/\*[\s\S]*?\*\//g,i=>i.replace(/[^\n]/g," ")),n=[],s=[],r=0,o=1;for(let i=0;i<e.length;i++){let a=e[i];if(a===`
|
|
35
|
+
`&&o++,a==="{"){let l=e.slice(r,i).trim(),c=s[s.length-1];c&&(c.own+=e.slice(c.segStart,r));let u=/^@theme\b/i.test(l),f=l.startsWith("@")&&!u,m=[...s].reverse().find(y=>!y.isAt)??null;s.push({selector:l,resolved:f?l:u?":root":sa(m?.resolved??null,l),isAt:f,skip:(c?.skip??!1)||f&&ra.test(l),start:i+1,line:o,own:"",segStart:i+1}),r=i+1}else if(a==="}"){let l=s.pop();if(l){l.own+=e.slice(l.segStart,i),!l.isAt&&!l.skip&&n.push({selector:l.resolved,body:e.slice(l.start,i),ownBody:l.own,line:l.line,context:s.filter(u=>u.isAt).map(u=>u.selector.replace(/\s+/g," ")).join(" \xB7 ")});let c=s[s.length-1];c&&(c.segStart=i+1)}r=i+1}else a===";"&&(r=i+1)}return n}function it(t){let e=[],n=0,s=0,r=o=>{let i=o.indexOf(":");if(i<=0)return;let a=o.slice(0,i).trim(),l=o.slice(i+1).replace(/\s+/g," ").trim();/^-{0,2}[a-z][\w-]*$/i.test(a)&&l&&a!=="composes"&&e.push({property:a,value:l})};for(let o=0;o<t.length;o++){let i=t[o];i==="("?n++:i===")"?n=Math.max(0,n-1):i===";"&&n===0&&(r(t.slice(s,o)),s=o+1)}return r(t.slice(s)),e}var oa=25,ia=12,er=700,aa=/\b(?:must(?: not)?|never|always|should(?: not|n't)?|do not|don't|avoid|prefer|forbidden|not allowed|no more than)\b/i,et=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function la(t){let e=t.split(`
|
|
36
|
+
`),n=[],s=[],r=null,o=null,i=0;if(e[0]?.trim()==="---"){let l=e.findIndex((c,u)=>u>0&&c.trim()==="---");l>0&&(i=l+1)}let a=l=>{r&&(n.push({start:r.start,end:l,text:r.lines.join(`
|
|
37
|
+
`).trimEnd(),headings:r.headings}),r=null)};for(;i<e.length;i++){let l=e[i],c=i+1,u=/^\s*(```|~~~)/.exec(l)?.[1];if(o){r.lines.push(l),u===o&&(o=null,a(c));continue}if(u){a(c-1),o=u,r={start:c,lines:[l],headings:[...s]};continue}let f=/^(#{1,6})\s+(.+?)\s*#*\s*$/.exec(l);if(f){a(c-1),s=[...s.slice(0,f[1].length-1),f[2]];continue}if(l.trim()===""){a(c-1);continue}r??={start:c,lines:[],headings:[...s]},r.lines.push(l)}return a(e.length),n}function ca(t,e){let n=t.map(et).join("|"),s=t.map(r=>et(r.charAt(0).toUpperCase()+r.slice(1))).join("|");return new RegExp(`${e.source}|\\b(?:${n})s?\\b|[a-z](?:${s})s?\\b|\\b(?:${n})[-_]|[-_](?:${n})\\b`,"i")}function ua(t,e){let n=e.map(et).join("|"),s=new Map;for(let r of t){if(r.base||r.title==="Unnamed"||r.title.startsWith("In ")||!r.element)continue;let i=s.get(r.title)??{title:r.title,tests:[],heading:null},a=r.selector.slice(dt(r.selector));for(let l of a.matchAll(/\.((?:\\.|[\w-])+)/g)){let c=l[1].replace(/\\(.)/g,"$1");if(e.includes(c.toLowerCase()))continue;let u=/[-_]|[a-z][A-Z]/.test(c);i.tests.push(new RegExp(u?`(?<![\\w-])${et(c)}(?![\\w-])`:`(?:\\.|["'\`])${et(c)}(?![\\w-])`))}if(!r.title.includes(" + ")){let l=r.title.toLowerCase().split(/\s+/).map(et).join("[\\s_-]+");i.tests.push(new RegExp(`\\b${l}[\\s_-]+(?:${n})s?\\b|\\b(?:${n})s?[_-]+${l}\\b`,"i")),r.axis&&/^[a-z]+$/i.test(r.title)&&i.tests.push(new RegExp(`\\b${et(r.axis)}\\s*[=:]\\s*\\{?\\s*["'\`]${et(r.title.toLowerCase())}["'\`]`,"i")),i.heading=r.title.toLowerCase()}s.set(r.title,i)}return[...s.values()]}function pa(t,e){return t.toLowerCase().replace(new RegExp(`\\b(?:${e.map(et).join("|")})s?\\b`,"g")," ").replace(/[^a-z0-9]+/g," ").trim()}function fa(t){return t.length>er?`${t.slice(0,er).trimEnd()}\u2026`:t}function nr(t,e,n,s){let r=ca(n.classKeywords,n.prose),o=ua(s,n.classKeywords),i=new Set,a=[];for(let u of e){let f=t.get(u.path);if(f===void 0)continue;let m=[];for(let y of la(f)){if(!r.test(y.text)&&!y.headings.some(v=>r.test(v)))continue;let $=y.headings.length?pa(y.headings[y.headings.length-1],n.classKeywords):"",C=o.filter(v=>v.tests.some(g=>g.test(y.text))||$!==""&&v.heading===$).map(v=>v.title);for(let v of C)i.add(v);m.push({path:u.path,line:y.start,endLine:y.end,headings:y.headings,text:fa(y.text),rule:aa.test(y.text),styles:C})}m.length!==0&&a.push({path:u.path,kind:u.kind,passages:m.slice(0,ia),total:m.length,rules:m.filter(y=>y.rule).length})}let l={instruction:0,documentation:1,record:2};a.sort((u,f)=>l[u.kind]-l[f.kind]||f.rules-u.rules||f.total-u.total||u.path.localeCompare(f.path));let c=new Map;for(let u of s)u.element&&!u.base&&u.title!=="Unnamed"&&!u.title.startsWith("In ")&&c.set(u.title,!0);return{files:a.slice(0,oa).map(({rules:u,...f})=>f),documented:[...i].sort(),undocumented:[...c.keys()].filter(u=>!i.has(u))}}var sr=new Set(["tone","size","variant","kind","type","style","theme","color","colour","appearance","intent","emphasis","shape","level"]),da=new Set(["is","has","js","c","component","comp","el","ui","the","root"]),ga={xs:["extra","small"],sm:["small"],md:["medium"],lg:["large"],xl:["extra","large"],xxl:["extra","extra","large"]},ma=new Set(["cta","ui","ux","faq","cms","api","url","ios"]);function sn(t){return t.replace(/\\(.)/g,"$1").replace(/([a-z\d])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").split(/[^A-Za-z0-9]+/).filter(Boolean).map(e=>e.toLowerCase())}function ha(t){return new Set(t.flatMap(e=>[e,`${e}s`]))}function nn(t){let e=t.map(n=>ma.has(n)?n.toUpperCase():n).join(" ");return e.charAt(0).toUpperCase()+e.slice(1)}function Et(t,e){let n=sn(t).filter(r=>!e.has(r)&&!da.has(r)),s=null;return n.length>1&&sr.has(n[0])&&(s=n[0],n=n.slice(1)),{words:n.flatMap(r=>ga[r]??[r]),axis:s}}var rr=/\.((?:\\.|[\w-])+)/g,ya=/\[\s*([\w-]+)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\]\s]*))\s*\]/g;function ba(t,e){let n=t.split("/"),s=(n.pop()??"").replace(/(\.module)?\.[a-z]+$/i,""),r=n.pop()??"";return sn(s).some(a=>e.has(a))||sn(r).some(a=>e.has(a))?Et(s,e).words:[]}function xa(t,e){let n=[];for(let s of t.split(/[\s>+~]+/).filter(Boolean)){let r=[...s.matchAll(rr)].map(o=>o[1]);if(r.length)for(let o of r)n.push(...Et(o,e).words);else{let o=/^[a-z][\w-]*/i.exec(s)?.[0]?.toLowerCase();o&&!["div","span","html","body"].includes(o)&&n.push(...Et(o,e).words)}}return n}function It(t,e){let n=ha(e),s=dt(t.selector),r=t.selector.slice(0,s),o=t.selector.slice(s),i=[...o.matchAll(rr)].map(u=>Et(u[1],n));for(let u of o.matchAll(ya)){let f=u[1].replace(/^data-/,"").toLowerCase();if(!sr.has(f))continue;let m=u[2]??u[3]??u[4]??"",y=Et(m,n);i.push({words:y.words,axis:f})}let a=i.filter(u=>u.words.length>0);if(a.length>0)return{title:a.map(u=>nn(u.words)).join(" + "),axis:a.length===1?a[0].axis:null};let l=xa(r,n);if(l.length>0)return{title:`In ${l.join(" ")}`,axis:null};let c=ba(t.path,n);if(c.length>0)return{title:nn(c),axis:null};if(t.base){let u=ka(t.path,n);return u.length>0?{title:`${nn(u)} Base`,axis:null}:{title:"Base",axis:null}}return{title:"Unnamed",axis:null}}function ka(t,e){let n=t.split("/").pop()??"";if(!/\.module\.[a-z]+$/i.test(n))return[];let s=n.replace(/\.module\.[a-z]+$/i,"");return Et(s,e).words}var wa=60;function zt(t,e,n){let s=X(t);if(!s)return null;let r=s.length-1,o=s[r].simples;if($s(o)||Ue(o,e))return null;if(se(o,e))return{compounds:s,at:r};for(let i=r-1;i>=0;i--){let a=s[i].simples;if(se(a,e)&&!Ue(a,e))return{compounds:s,at:i}}return!n||r===0&&Cs(o)?null:{compounds:s,at:0}}function or(t,e,n){return Bt([...t,{combinator:t.length?e.combinator:null,simples:n}])}function ir(t,e){return t.kind!==e.kind?!1:t.kind==="attr"&&e.kind==="attr"?t.name===e.name&&t.op===e.op&&t.value===e.value:t.raw===e.raw}function va(t,e){return t.length>=e.length?!1:t.every(n=>e.some(s=>ir(n,s)))}function $a(t,e){if(t.length!==1)return!1;let n=t[0];return n.kind==="tag"?e.elements.includes(n.name):n.kind==="class"?e.classKeywords.some(s=>s.toLowerCase()===n.name.toLowerCase()):!1}function Ca(t,e){for(let n of e.classes)t.classes.includes(n)||t.classes.push(n);Object.assign(t.attrs,e.attrs)}function ar(t){let e=new Set(t.map(n=>Ft(n.property)).filter(n=>n!=="hint"));return e.size===0||e.size===1&&e.has("layout")?"placement":e.size===1&&e.has("paint")?"effect":"override"}function Sa(t){let e=t.filter(o=>o.context===""),n=e.length?e:t;if(n.some(o=>o.state==="default"))return null;let r=[...n.map(o=>new Set(o.state.split(" + "))).reduce((o,i)=>o?new Set([...o].filter(a=>i.has(a))):i,null)??[]].filter(o=>K(o)===ne.length);return r.length===1?r[0]:null}function rn(t){return t.sort((e,n)=>+(e.context!=="")-+(n.context!=="")||K(e.state.split(" + ")[0])-K(n.state.split(" + ")[0])||e.state.localeCompare(n.state))}function lr(t,e,n,s,r={parts:new Set,controls:new Set}){let o=new Map,i=[];for(let g of e)if(g.declarations.length!==0)for(let p of z(g.selector)){let d=zt(p,n,s);if(!d)continue;let{compounds:b,at:k}=d,x=b[k],w=re(x.simples);if(w.identity.length===0)continue;let j=b.slice(0,k),I=or(j,x,w.identity),R=ft(w.states);if(k<b.length-1){i.push({hostKey:I,part:{selector:Bt(b),path:t,line:g.line,state:R}});continue}if(As(w.identity,g.declarations))continue;let A=o.get(I);if(!A){if(o.size>=wa)continue;A={key:I,prefix:j,identity:w.identity,line:g.line,states:[],modifiers:[],contexts:[],parts:[],movedInto:null},o.set(I,A)}let M=A.states.find(T=>T.state===R&&T.context===g.context);M||(M={state:R,context:g.context,line:g.line,declarations:[]},w.states.length&&(M.marker={classes:[],attrs:{}}),A.states.push(M)),M.marker&&Ca(M.marker,w.marker),M.declarations.push(...g.declarations)}for(let[g,p]of o){let d=p.states.flatMap(x=>x.declarations),b=p.states.every(x=>ie(x.declarations)),k=d.every(x=>Ft(x.property)==="hint");(b||k)&&o.delete(g)}let a=new Map;for(let g of o.values()){let p=Vt(g.identity);a.set(p,[...a.get(p)??[],g])}for(let g of a.values()){let p=g.map(x=>Sa(x.states)),d=p[0];if(!d||p.some(x=>x!==d))continue;let b=g.flatMap(x=>x.states).find(x=>x.marker&&x.state.split(" + ").includes(d))?.marker;if(!b)continue;let k=[...b.classes.map(x=>({kind:"class",raw:`.${x}`,name:x})),...Object.entries(b.attrs).map(([x,w])=>({kind:"attr",raw:`[${x}="${w}"]`,name:x,op:"=",value:w}))];for(let x of g){let w=[...x.identity,...k],j={combinator:x.prefix.length?" ":null,simples:w},I=or(x.prefix,j,w);for(let R of x.states){let A=R.state.split(" + ").filter(M=>M!==d);if(R.state=ft(A),A.length===0)delete R.marker;else if(R.marker){R.marker.classes=R.marker.classes.filter(M=>!b.classes.includes(M));for(let M of Object.keys(b.attrs))delete R.marker.attrs[M]}}o.delete(x.key),o.set(I,{...x,key:I,identity:w})}}let l=()=>[...o.values()].filter(g=>g.prefix.length===0),c=g=>g.states.filter(p=>p.state==="default").reduce((p,d)=>p+d.declarations.length,0),u=l().find(g=>$a(g.identity,n))??(s?l().filter(g=>{let p=g.identity.length===1?g.identity[0]:null;return p?.kind==="class"&&r.controls.has(p.name)}).sort((g,p)=>c(p)-c(g)||g.line-p.line)[0]??null:null),f=u&&u.identity[0].kind==="class"?[u.identity[0].name]:[],m=(g,p,d)=>{p[d].push(g),g.movedInto=p,o.delete(g.key)},y=[...o.values()],$=g=>{let p=y.find(d=>d.key===g)??null;for(;p?.movedInto;)p=p.movedInto;return p};for(let g of l()){let p=g.identity.length===1?g.identity[0]:null;if(!(p?.kind!=="class"||!r.parts.has(p.name))&&(o.delete(g.key),u&&g!==u)){g.movedInto=u;for(let d of g.states)u.parts.push({selector:g.key,path:t,line:d.line,state:d.state})}}let C=l().filter(g=>g.identity.filter(p=>p.kind!=="tag"&&p.kind!=="universal").length>=2).sort((g,p)=>g.identity.length-p.identity.length);for(let g of C){let p=y.filter(b=>b!==g&&b!==u&&b.prefix.length===0&&va(b.identity,g.identity));if(p.length===0)continue;p.sort((b,k)=>k.identity.length-b.identity.length||c(k)-c(b)||b.line-k.line);let d=$(p[0].key);d&&d!==g&&m(g,d,"modifiers")}for(let{hostKey:g,part:p}of i){let d=$(g)??(s?u:null);d&&o.has(d.key)&&d.parts.push(p)}let v=g=>{let p=g===u,d=oe(g.key,f);return{...It({selector:g.key,path:t,base:p},n.classKeywords),element:d,usage:{status:"unknown",files:[],fileCount:0},selector:g.key,path:t,line:g.line,base:p,states:rn(g.states),modifiers:g.modifiers.length?g.modifiers.map(b=>{let k=b.identity.filter(x=>!g.identity.some(w=>ir(w,x)));return{title:It({selector:k.map(x=>x.raw).join(""),path:t,base:!1},n.classKeywords).title,selector:b.key,path:t,line:b.line,element:oe(b.key,f),usage:{status:"unknown",files:[],fileCount:0},states:rn(b.states)}}):void 0,contexts:g.contexts.length?g.contexts.map(b=>{let k=ar(b.states.flatMap(x=>x.declarations));return{selector:b.key,path:t,line:b.line,role:k,element:k==="override"?oe(b.key,f):null,states:rn(b.states)}}):void 0,parts:g.parts.length?g.parts:void 0}};return[...o.values()].map(v)}function cr(t){let e=new Map;for(let i of t){let a=i.base?/^\.([\w-]+)$/.exec(i.selector):null;a&&e.set(i.path,[...e.get(i.path)??[],a[1]])}let n=i=>{let a=X(i.selector);if(!a)return null;let l=a[a.length-1].simples,c=e.get(i.path)??[],u=l.filter(f=>!(f.kind==="class"&&c.includes(f.name)));return{depth:a.length-1,subject:Vt(l),bareTag:!l.some(f=>f.kind==="class"||f.kind==="attr"||f.kind==="id"),bare:u.length&&u.length<l.length?Vt(u):null}},s=new Map(t.map(i=>[i,n(i)])),r=new Set,o=i=>{let a=s.get(i);if(!a||a.depth===0)return null;let l=t.filter(c=>{if(c===i||r.has(c))return!1;let u=s.get(c);return u!=null&&u.depth<a.depth&&(!a.bareTag||u.depth===0)&&(u.subject===a.subject||a.bare!==null&&u.subject===a.bare)});return l.sort((c,u)=>+(u.path===i.path)-+(c.path===i.path)||s.get(c).depth-s.get(u).depth),l[0]??null};for(let i of[...t].sort((a,l)=>(s.get(l)?.depth??0)-(s.get(a)?.depth??0))){let a=o(i);if(!a)continue;for(;r.has(a);)a=o(a)??a;let l=ar(i.states.flatMap(c=>c.declarations));a.contexts=[...a.contexts??[],{selector:i.selector,path:i.path,line:i.line,role:l,element:l==="override"?i.element:null,states:i.states}],i.parts?.length&&(a.parts=[...a.parts??[],...i.parts]),i.modifiers?.length&&(a.modifiers=[...a.modifiers??[],...i.modifiers]),r.add(i)}return t.filter(i=>!r.has(i))}var Aa={slate:{50:"#f8fafc",100:"#f1f5f9",200:"#e2e8f0",300:"#cbd5e1",400:"#94a3b8",500:"#64748b",600:"#475569",700:"#334155",800:"#1e293b",900:"#0f172a",950:"#020617"},gray:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#1f2937",900:"#111827",950:"#030712"},zinc:{50:"#fafafa",100:"#f4f4f5",200:"#e4e4e7",300:"#d4d4d8",400:"#a1a1aa",500:"#71717a",600:"#52525b",700:"#3f3f46",800:"#27272a",900:"#18181b",950:"#09090b"},neutral:{50:"#fafafa",100:"#f5f5f5",200:"#e5e5e5",300:"#d4d4d4",400:"#a3a3a3",500:"#737373",600:"#525252",700:"#404040",800:"#262626",900:"#171717",950:"#0a0a0a"},stone:{50:"#fafaf9",100:"#f5f5f4",200:"#e7e5e4",300:"#d6d3d1",400:"#a8a29e",500:"#78716c",600:"#57534e",700:"#44403c",800:"#292524",900:"#1c1917",950:"#0c0a09"},red:{50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#ef4444",600:"#dc2626",700:"#b91c1c",800:"#991b1b",900:"#7f1d1d",950:"#450a0a"},orange:{50:"#fff7ed",100:"#ffedd5",200:"#fed7aa",300:"#fdba74",400:"#fb923c",500:"#f97316",600:"#ea580c",700:"#c2410c",800:"#9a3412",900:"#7c2d12",950:"#431407"},amber:{50:"#fffbeb",100:"#fef3c7",200:"#fde68a",300:"#fcd34d",400:"#fbbf24",500:"#f59e0b",600:"#d97706",700:"#b45309",800:"#92400e",900:"#78350f",950:"#451a03"},yellow:{50:"#fefce8",100:"#fef9c3",200:"#fef08a",300:"#fde047",400:"#facc15",500:"#eab308",600:"#ca8a04",700:"#a16207",800:"#854d0e",900:"#713f12",950:"#422006"},lime:{50:"#f7fee7",100:"#ecfccb",200:"#d9f99d",300:"#bef264",400:"#a3e635",500:"#84cc16",600:"#65a30d",700:"#4d7c0f",800:"#3f6212",900:"#365314",950:"#1a2e05"},green:{50:"#f0fdf4",100:"#dcfce7",200:"#bbf7d0",300:"#86efac",400:"#4ade80",500:"#22c55e",600:"#16a34a",700:"#15803d",800:"#166534",900:"#14532d",950:"#052e16"},emerald:{50:"#ecfdf5",100:"#d1fae5",200:"#a7f3d0",300:"#6ee7b7",400:"#34d399",500:"#10b981",600:"#059669",700:"#047857",800:"#065f46",900:"#064e3b",950:"#022c22"},teal:{50:"#f0fdfa",100:"#ccfbf1",200:"#99f6e4",300:"#5eead4",400:"#2dd4bf",500:"#14b8a6",600:"#0d9488",700:"#0f766e",800:"#115e59",900:"#134e4a",950:"#042f2e"},cyan:{50:"#ecfeff",100:"#cffafe",200:"#a5f3fc",300:"#67e8f9",400:"#22d3ee",500:"#06b6d4",600:"#0891b2",700:"#0e7490",800:"#155e75",900:"#164e63",950:"#083344"},sky:{50:"#f0f9ff",100:"#e0f2fe",200:"#bae6fd",300:"#7dd3fc",400:"#38bdf8",500:"#0ea5e9",600:"#0284c7",700:"#0369a1",800:"#075985",900:"#0c4a6e",950:"#082f49"},blue:{50:"#eff6ff",100:"#dbeafe",200:"#bfdbfe",300:"#93c5fd",400:"#60a5fa",500:"#3b82f6",600:"#2563eb",700:"#1d4ed8",800:"#1e40af",900:"#1e3a8a",950:"#172554"},indigo:{50:"#eef2ff",100:"#e0e7ff",200:"#c7d2fe",300:"#a5b4fc",400:"#818cf8",500:"#6366f1",600:"#4f46e5",700:"#4338ca",800:"#3730a3",900:"#312e81",950:"#1e1b4b"},violet:{50:"#f5f3ff",100:"#ede9fe",200:"#ddd6fe",300:"#c4b5fd",400:"#a78bfa",500:"#8b5cf6",600:"#7c3aed",700:"#6d28d9",800:"#5b21b6",900:"#4c1d95",950:"#2e1065"},purple:{50:"#faf5ff",100:"#f3e8ff",200:"#e9d5ff",300:"#d8b4fe",400:"#c084fc",500:"#a855f7",600:"#9333ea",700:"#7e22ce",800:"#6b21a8",900:"#581c87",950:"#3b0764"},fuchsia:{50:"#fdf4ff",100:"#fae8ff",200:"#f5d0fe",300:"#f0abfc",400:"#e879f9",500:"#d946ef",600:"#c026d3",700:"#a21caf",800:"#86198f",900:"#701a75",950:"#4a044e"},pink:{50:"#fdf2f8",100:"#fce7f3",200:"#fbcfe8",300:"#f9a8d4",400:"#f472b6",500:"#ec4899",600:"#db2777",700:"#be185d",800:"#9d174d",900:"#831843",950:"#500724"},rose:{50:"#fff1f2",100:"#ffe4e6",200:"#fecdd3",300:"#fda4af",400:"#fb7185",500:"#f43f5e",600:"#e11d48",700:"#be123c",800:"#9f1239",900:"#881337",950:"#4c0519"}};function ur(t){let e=t.lastIndexOf("-");return e<=0?null:Aa[t.slice(0,e)]?.[t.slice(e+1)]??null}var E=(t,e)=>({property:t,value:e});function un(t){if(!t.startsWith("[")||!t.endsWith("]"))return null;let e=t.slice(1,-1).replace(/_/g," ").trim();return/^-?[\d.]+(?:px|rem|em|%|vh|vw)$/.test(e)||/^var\(\s*--[\w-]+\s*\)$/.test(e)?e.replace(/\s+/g,""):null}function cn(t){let e=un(t);if(e)return e;if(t==="px")return"1px";if(!/^\d+(?:\.\d+)?$/.test(t))return null;let n=Number(t);if(n>96)return null;let s=Math.round(n*2);if(Math.abs(n*2-s)>1e-6)return null;if(s===0)return"0";let r=Math.floor(s/8),o=["",".125",".25",".375",".5",".625",".75",".875"][s%8];return r===0?`0${o}rem`:`${r}${o}rem`}function Ra(t){let e=/^(\d+)\/(\d+)$/.exec(t);if(!e)return null;let n=Number(e[1])/Number(e[2])*100;return Number.isFinite(n)?`${Number(n.toFixed(4))}%`:null}function pr(t,e){return{full:"100%",screen:e==="w"?"100vw":"100vh",auto:"auto",fit:"fit-content",min:"min-content",max:"max-content"}[t]??Ra(t)??un(t)??cn(t)}var _a={xs:{size:"0.75rem",leading:"1rem"},sm:{size:"0.875rem",leading:"1.25rem"},base:{size:"1rem",leading:"1.5rem"},lg:{size:"1.125rem",leading:"1.75rem"},xl:{size:"1.25rem",leading:"1.75rem"},"2xl":{size:"1.5rem",leading:"2rem"},"3xl":{size:"1.875rem",leading:"2.25rem"},"4xl":{size:"2.25rem",leading:"2.5rem"},"5xl":{size:"3rem",leading:"1"},"6xl":{size:"3.75rem",leading:"1"}},Ea={thin:"100",extralight:"200",light:"300",normal:"400",medium:"500",semibold:"600",bold:"700",extrabold:"800",black:"900"},Ia={none:"1",tight:"1.25",snug:"1.375",normal:"1.5",relaxed:"1.625",loose:"2"},ja={none:"0",sm:"0.125rem","":"0.25rem",md:"0.375rem",lg:"0.5rem",xl:"0.75rem","2xl":"1rem","3xl":"1.5rem",full:"9999px"},Ma={sm:"0 1px 2px 0 rgb(0 0 0 / 0.05)","":"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",md:"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",lg:"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",xl:"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)","2xl":"0 25px 50px -12px rgb(0 0 0 / 0.25)",inner:"inset 0 2px 4px 0 rgb(0 0 0 / 0.05)",none:"none"},Da={"":"3px",0:"0px",1:"1px",2:"2px",4:"4px",8:"8px"};function on(t,e){let n=null;if(t.startsWith("[")&&t.endsWith("]")){let r=t.slice(1,-1).replace(/_/g," ").trim();if(r.startsWith("--"))n=`var(${r})`;else if(/^var\(\s*--[\w-]+\s*\)$/.test(r))n=r.replace(/\s+/g,"");else if(/^#[0-9a-f]{3,8}$/i.test(r)||/^(?:rgb|hsl|oklch|oklab|color)\(/i.test(r))n=r;else return null}else t==="white"?n="#fff":t==="black"?n="#000":t==="transparent"?n="transparent":t==="current"?n="currentColor":t==="inherit"?n="inherit":n=ur(t)??(/^[a-z][\w-]*$/i.test(t)?`var(--${t}, var(--color-${t}))`:null);if(!n)return null;if(!e)return n;if(!/^\d+(?:\.\d+)?$/.test(e))return null;let s=Number(e)<=1?Number(e)*100:Number(e);return s<0||s>100?null:s===100?n:`color-mix(in srgb, ${n} ${s}%, transparent)`}function Oa(t){let e=0,n=-1;for(let s=0;s<t.length;s++){let r=t[s];r==="["?e++:r==="]"?e=Math.max(0,e-1):r==="/"&&e===0&&(n=s)}return n<0?{body:t,opacity:null}:{body:t.slice(0,n),opacity:t.slice(n+1)}}function an(){return E("box-shadow","0 0 0 var(--gs-ring-w, 3px) var(--gs-ring-c, currentColor)")}var La={flex:"flex","inline-flex":"inline-flex",block:"block","inline-block":"inline-block",inline:"inline",grid:"grid","inline-grid":"inline-grid",hidden:"none",contents:"contents"},ln={start:"flex-start",end:"flex-end",center:"center",baseline:"baseline",stretch:"stretch",between:"space-between",around:"space-around",evenly:"space-evenly"};function fr(t){let e=t.startsWith("-"),n=e?t.slice(1):t,{body:s,opacity:r}=Oa(n),o=La[s];if(o&&!e&&!r)return[E("display",o)];let i=/^flex-(row|col|row-reverse|col-reverse)$/.exec(s);if(i&&!e&&!r){let A=i[1]==="col"?"column":i[1]==="col-reverse"?"column-reverse":i[1];return[E("flex-direction",A)]}if(s==="flex-wrap"&&!e)return[E("flex-wrap","wrap")];if(s==="flex-nowrap"&&!e)return[E("flex-wrap","nowrap")];if(s==="flex-1"&&!e)return[E("flex","1 1 0%")];if(s==="shrink-0"&&!e)return[E("flex-shrink","0")];if(s==="grow-0"&&!e)return[E("flex-grow","0")];if(s==="grow"&&!e)return[E("flex-grow","1")];let a=/^items-(start|end|center|baseline|stretch)$/.exec(s);if(a&&!e)return[E("align-items",ln[a[1]])];let l=/^justify-(start|end|center|between|around|evenly)$/.exec(s);if(l&&!e)return[E("justify-content",ln[l[1]])];let c=/^self-(start|end|center|stretch|auto)$/.exec(s);if(c&&!e)return[E("align-self",c[1]==="auto"?"auto":ln[c[1]])];if(s==="whitespace-nowrap")return[E("white-space","nowrap")];if(s==="whitespace-normal")return[E("white-space","normal")];if(s==="truncate")return[E("overflow","hidden"),E("text-overflow","ellipsis"),E("white-space","nowrap")];if(s==="underline")return[E("text-decoration-line","underline")];if(s==="no-underline")return[E("text-decoration-line","none")];if(s==="line-through")return[E("text-decoration-line","line-through")];let u=/^(uppercase|lowercase|capitalize|normal-case)$/.exec(s);if(u)return[E("text-transform",u[1]==="normal-case"?"none":u[1])];let f=/^text-(left|center|right|justify|start|end)$/.exec(s);if(f&&!r)return[E("text-align",f[1])];let m=_a[s.replace(/^text-/,"")];if(s.startsWith("text-")&&m&&!r&&!e)return[E("font-size",m.size),E("line-height",m.leading)];let y=Ea[s.replace(/^font-/,"")];if(s.startsWith("font-")&&y&&!r)return[E("font-weight",y)];if(s.startsWith("leading-")&&!r){let A=s.slice(8),T=Ia[A]??cn(A);if(T)return[E("line-height",T)]}let $=/^cursor-(pointer|default|not-allowed|wait|text|move)$/.exec(s);if($)return[E("cursor",$[1])];if(s==="pointer-events-none")return[E("pointer-events","none")];if(s==="pointer-events-auto")return[E("pointer-events","auto")];if(s==="select-none")return[E("user-select","none")];let C=/^opacity-(\d+)$/.exec(s);if(C&&!e)return[E("opacity",String(Number(C[1])/100))];if(s==="transition"||s==="transition-colors"||s==="transition-all")return[E("transition-property",s==="transition-colors"?"color, background-color, border-color, text-decoration-color, fill, stroke":s==="transition-all"?"all":"color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter"),E("transition-timing-function","cubic-bezier(0.4, 0, 0.2, 1)"),E("transition-duration","150ms")];let v=/^duration-(\d+)$/.exec(s);if(v)return[E("transition-duration",`${v[1]}ms`)];let g={linear:"linear",in:"cubic-bezier(0.4, 0, 1, 1)",out:"cubic-bezier(0, 0, 0.2, 1)","in-out":"cubic-bezier(0.4, 0, 0.2, 1)"};if(s.startsWith("ease-")&&g[s.slice(4)])return[E("transition-timing-function",g[s.slice(4)])];if(s==="outline-none")return[E("outline","2px solid transparent"),E("outline-offset","2px")];if(s==="outline")return[E("outline-style","solid")];let p=/^outline-(\d+)$/.exec(s);if(p)return[E("outline-width",`${p[1]}px`)];if(s==="shadow"||s.startsWith("shadow-")){let A=s==="shadow"?"":s.slice(7),M=Ma[A];if(M)return[E("box-shadow",M)]}if(s==="ring"||/^ring(?:-(?:0|1|2|4|8))?$/.test(s)){let A=s==="ring"?"":s.slice(5),M=Da[A];if(M)return[E("--gs-ring-w",M),an()]}if(s.startsWith("ring-")&&r===null){let A=on(s.slice(5),null);if(A)return[E("--gs-ring-c",A),an()]}if(s.startsWith("ring-")&&r){let A=on(s.slice(5),r);if(A)return[E("--gs-ring-c",A),an()]}let d=s==="rounded"?"":s.startsWith("rounded-")?s.slice(8):null;if(d!==null&&!e){let A=/^(t|r|b|l|s|e|tl|tr|bl|br|ss|se)(?:-(.+))?$/.exec(d),M=A?A[2]??"":d,T=ja[M];if(!T)return null;if(!A)return[E("border-radius",T)];let Z={t:["border-top-left-radius","border-top-right-radius"],r:["border-top-right-radius","border-bottom-right-radius"],b:["border-bottom-left-radius","border-bottom-right-radius"],l:["border-top-left-radius","border-bottom-left-radius"],s:["border-start-start-radius","border-end-start-radius"],e:["border-start-end-radius","border-end-end-radius"],tl:["border-top-left-radius"],tr:["border-top-right-radius"],bl:["border-bottom-left-radius"],br:["border-bottom-right-radius"],ss:["border-start-start-radius"],se:["border-start-end-radius"]}[A[1]];return Z?Z.map(Ht=>E(Ht,T)):null}if(/^border(?:-[trblxy])?$/.test(s)&&!r)return[E("border-width","1px"),E("border-style","solid")];let b=/^border-(\d+)$/.exec(s);if(b&&!r)return[E("border-width",`${b[1]}px`),E("border-style","solid")];let k=/^border-(solid|dashed|dotted|double|none|hidden)$/.exec(s);if(k)return[E("border-style",k[1])];let x=/^(p|px|py|pt|pr|pb|pl|ps|pe|m|mx|my|mt|mr|mb|ml|ms|me|gap|gap-x|gap-y|w|h|min-w|min-h|max-w|max-h|size|inset|top|right|bottom|left)-(.+)$/.exec(s),w=x?.[1],j=x?.[2];if(w&&j&&!r){let A=w==="w"||w==="min-w"||w==="max-w"?pr(j,"w"):w==="h"||w==="min-h"||w==="max-h"?pr(j,"h"):cn(j);if(!A)return null;let M=e?A==="0"?"0":`-${A}`:A,G={p:["padding"],px:["padding-inline"],py:["padding-block"],pt:["padding-top"],pr:["padding-right"],pb:["padding-bottom"],pl:["padding-left"],ps:["padding-inline-start"],pe:["padding-inline-end"],m:["margin"],mx:["margin-inline"],my:["margin-block"],mt:["margin-top"],mr:["margin-right"],mb:["margin-bottom"],ml:["margin-left"],ms:["margin-inline-start"],me:["margin-inline-end"],gap:["gap"],"gap-x":["column-gap"],"gap-y":["row-gap"],w:["width"],h:["height"],"min-w":["min-width"],"min-h":["min-height"],"max-w":["max-width"],"max-h":["max-height"],size:["width","height"],inset:["inset"],top:["top"],right:["right"],bottom:["bottom"],left:["left"]}[w];return G?G.map(Z=>E(Z,M)):null}let I={bg:"background-color",text:"color",border:"border-color",outline:"outline-color",decoration:"text-decoration-color",accent:"accent-color",caret:"caret-color",fill:"fill",stroke:"stroke"};for(let[A,M]of Object.entries(I))if(s===A||s.startsWith(`${A}-`)){let T=s===A?"":s.slice(A.length+1);if(!T||/^(?:gradient|clip|ellipsis|wrap|nowrap|balance|pretty|opacity)/.test(T))return null;if(A==="text"&&!e){let Z=un(T);if(Z)return[E("font-size",Z)]}let G=on(T,r);return!G||e?null:[E(M,G)]}let R=/^\[([a-z-]+):(.+)\]$/i.exec(s);if(R&&!e&&!r){let A=R[1].toLowerCase(),M=R[2].replace(/_/g," ").trim();if(/^[a-z][\w-]*$/.test(A)&&M&&!/[<>]/.test(M))return[E(A,M)]}return null}var Pa=48,Ta={hover:"hover",focus:"focus","focus-visible":"focus","focus-within":"focus",active:"active",disabled:"disabled"},Na=new Set(["cn","clsx","classNames","classnames","cx","twMerge"]);function at(t,e){let n=1;for(let s=0;s<e&&s<t.length;s++)t[s]===`
|
|
38
|
+
`&&n++;return n}function Va(t){let e=n=>n.replace(/[^\n]/g," ");return t.replace(/\/\*[\s\S]*?\*\//g,e).replace(/(^|\s)\/\/[^\n]*/g,(n,s)=>s+e(n.slice(s.length)))}function W(t,e){for(;e<t.length&&/\s/.test(t[e]);)e++;return e}function de(t,e){let n=t[e];if(n!=='"'&&n!=="'"&&n!=="`")return null;let s="",r=!1;for(let o=e+1;o<t.length;o++){let i=t[o];if(i==="\\"){let a=t[o+1];if(a===void 0)return null;s+=a==="n"?`
|
|
39
|
+
`:a,o++;continue}if(n==="`"&&i==="$"&&t[o+1]==="{"){r=!0;let a=1;for(o+=2;o<t.length&&a>0;o++)t[o]==="{"?a++:t[o]==="}"&&a--;o--;continue}if(i===n)return{v:r?null:s,end:o+1};s+=i}return null}function dn(t,e,n,s){let r=0;for(let o=e;o<t.length;o++){let i=t[o];if(i==='"'||i==="'"||i==="`"){let a=de(t,o);if(!a)return t.length;o=a.end-1;continue}if(i===n)r++;else if(i===s&&(r--,r===0))return o+1}return t.length}function Ba(t,e){let n=0;for(let s=e;s<t.length;s++){let r=t[s];if(r==='"'||r==="'"||r==="`"){let o=de(t,s);if(!o)return t.length;s=o.end-1;continue}if(r==="("||r==="["||r==="{")n++;else if(r===")"||r==="]"||r==="}"){if(n===0)return s;n--}else if(r===","&&n===0)return s}return t.length}function dr(t){if(t.t==="str")return t.v;if(t.t==="arr"){let e=[];for(let n of t.items){let s=dr(n);s&&e.push(s)}return e.join(" ")||null}return t.t==="obj"&&t.entries.filter(n=>n.value.t==="bool"&&n.value.v).map(n=>n.key).join(" ")||null}function Fa(t,e){let n=e+1,s=[];for(;n<t.length;){if(n=W(t,n),t[n]===")")return{v:s.join(" ").replace(/\s+/g," ").trim()||null,end:n+1};if(t[n]===","){n++;continue}let r=Q(t,n);if(!r)return null;let o=W(t,r.end);if(t[o]===","||t[o]===")"){let i=dr(r.val);i&&s.push(i),n=r.end;continue}n=Ba(t,n)}return null}function Q(t,e){if(e=W(t,e),e>=t.length)return null;let n=t[e];if(n==='"'||n==="'"||n==="`"){let r=de(t,e);return r?{val:{t:"str",v:r.v,at:e},end:r.end}:null}if(n==="["){let r=e+1,o=[];for(;r<t.length;){if(r=W(t,r),t[r]==="]")return{val:{t:"arr",items:o,at:e},end:r+1};if(t[r]===","){r++;continue}let i=Q(t,r);if(!i)return null;o.push(i.val),r=i.end}return null}if(n==="{"){let r=e+1,o=[];for(;r<t.length;){if(r=W(t,r),t[r]==="}")return{val:{t:"obj",entries:o,at:e},end:r+1};if(t[r]===","){r++;continue}if(t.slice(r,r+3)==="..."){let c=Q(t,r+3);if(!c)return null;r=c.end;continue}let i="",a=r;if(t[r]==='"'||t[r]==="'"||t[r]==="`"){let c=de(t,r);if(!c||c.v===null)return null;i=c.v,r=c.end}else if(/[\w$]/.test(t[r])){for(a=r;r<t.length&&/[\w$]/.test(t[r]);)r++;i=t.slice(a,r)}else return null;if(r=W(t,r),t[r]!==":"){t[r]==="("&&(r=dn(t,r,"(",")"));continue}let l=Q(t,r+1);if(!l)return null;o.push({key:i,at:a,value:l.val}),r=l.end}return null}let s=e;if(n==="."||n==="-"||/\d/.test(n)){let r=e+1;for(;r<t.length&&/[\d.]/.test(t[r]);)r++;let o=t.slice(e,r);if(/^-?\d+(?:\.\d+)?$/.test(o))return{val:{t:"num",v:Number(o),at:s},end:r};for(;r<t.length&&/[\w$.+-]/.test(t[r]);)r++;return{val:{t:"other",at:s},end:r}}if(/[\w$]/.test(n)){let r=e;for(;r<t.length&&/[\w$]/.test(t[r]);)r++;let o=t.slice(e,r),i=W(t,r);if(t[i]==="("){if(Na.has(o)){let a=Fa(t,i);return a?{val:{t:"str",v:a.v,at:s},end:a.end}:null}return{val:{t:"other",at:s},end:dn(t,i,"(",")")}}return o==="true"||o==="false"?{val:{t:"bool",v:o==="true",at:s},end:r}:{val:{t:"other",at:s},end:i}}return null}function ge(t){if(t.t==="str")return t.v;if(t.t==="arr"){let e=[];for(let n of t.items){if(n.t!=="str"||n.v===null)return null;e.push(n.v)}return e.join(" ")}return null}function gr(t){let e=[],n="",s=0;for(let r of t)r==="["?s++:r==="]"&&(s=Math.max(0,s-1)),/\s/.test(r)&&s===0?(n&&e.push(n),n=""):(!/\s/.test(r)||s>0)&&(n+=r);return n&&e.push(n),e}var pn={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"};function za(t,e,n,s){let r=Ta[t];if(r)return e.includes(r)||e.push(r),!0;if(t==="dark")return s.on=!0,!0;if(pn[t])return n.min.push(pn[t]),!0;let o=/^max-(sm|md|lg|xl|2xl)$/.exec(t);if(o)return n.below.push(pn[o[1]]),!0;let i=/^min-\[([\d.]+(?:px|rem|em))\]$/.exec(t);if(i)return n.min.push(i[1]),!0;let a=/^max-\[([\d.]+(?:px|rem|em))\]$/.exec(t);return a?(n.max.push(a[1]),!0):!1}function Wa(t,e){let n=[];for(let s of t.min)n.push(`(min-width: ${s})`);for(let s of t.max)n.push(`(max-width: ${s})`);for(let s of t.below)n.push(`not all and (min-width: ${s})`);return e&&n.push("(prefers-color-scheme: dark)"),n.length?`@media ${n.join(" and ")}`:""}function mr(t){let e=t.trim();if(!e)return null;let n=!1;e.startsWith("!")&&(n=!0,e=e.slice(1)),e.endsWith("!")&&(n=!0,e=e.slice(0,-1));let s=[],r="",o=0;for(let f of e)f==="["?o++:f==="]"&&(o=Math.max(0,o-1)),f===":"&&o===0?(s.push(r),r=""):r+=f;s.push(r);let i=s.pop()??"";if(!i)return null;let a=[],l={min:[],max:[],below:[]},c={on:!1};for(let f of s)if(!f||!za(f,a,l,c))return null;a.sort((f,m)=>K(f)-K(m));let u=/^[\w-]+$/.test(i)?i:null;return{token:t,state:ft(a),context:Wa(l,c.on),utility:i,important:n,stem:u}}function hr(t){let e=fr(t.utility);return e?e.map(n=>({property:n.property,value:t.important?`${n.value} !important`:n.value,via:t.token})):[]}function Ua(t){return t.some(e=>Ft(e.property)!=="hint")}function me(t){let e=[];for(let n of t.matchAll(/@apply\s+([^;{}]+)/g))for(let s of gr(n[1])){let r=mr(s);if(!r)continue;let o=hr(r).filter(i=>tt(i.property,i.value));o.length!==0&&e.push({state:r.state,context:r.context,declarations:o})}return e}function yr(t){return t==="default"?"":t.split(" + ").map(e=>e==="hover"?":hover":e==="focus"?":focus":e==="active"?":active":e==="disabled"?":disabled":"").join("")}function hn(t,e,n){let s=e.map(f=>`${f.property}:${f.value}`).join(";");if(!s)return[];let r=Ge(t),o=`${r}{${s}}`,i=n.split(" \xB7 ").map(f=>f.trim()).filter(f=>f&&!/^@layer\b/i.test(f));if(i.length===0)return[o];if(i.length!==1||!i[0].startsWith("@media"))return[];let a=i[0],l=[`${a}{${o}}`];if(!a.includes("prefers-color-scheme: dark"))return l;let c=a.replace(/^@media\s+/,"").split(/\s+and\s+/).filter(f=>!f.includes("prefers-color-scheme")).join(" and "),u=`html[data-theme="dark"] ${r}{${s}}`;return l.push(c?`@media ${c}{${u}}`:u),l}function Ga(t,e){let n=t.slice(Math.max(0,e-160),e);return/(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*(?:await\s+)?$/.exec(n)?.[1]??null}function Ka(t){if(t.t!=="obj")return{};let e=t.entries.find(s=>s.key==="defaultVariants")?.value;if(!e||e.t!=="obj")return{};let n={};for(let s of e.entries)s.value.t==="str"&&s.value.v?n[s.key]=s.value.v:s.value.t==="bool"&&(n[s.key]=s.value.v?"true":"false");return n}function Ha(t,e,n,s,r){let o=Q(t,e),i={slots:[],defaults:{}};if(!o)return i;let a=ge(o.val)??"",l=W(t,o.end);if(t[l]!==",")return a.trim()?{slots:[fn(a,at(t,e),r)],defaults:{}}:i;let c=Q(t,l+1);if(!c||c.val.t!=="obj")return a.trim()?{slots:[fn(a,at(t,e),r)],defaults:{}}:i;let u=c.val.entries.find(y=>y.key==="variants")?.value,f=[],m=new Map;if(a.trim()&&f.push(fn(a,at(t,e),r)),u&&u.t==="obj"){for(let y of u.entries)if(y.value.t==="obj")for(let $ of y.value.entries){let C=ge($.value);if(!C||!C.trim()||$.key==="false")continue;m.set(`${y.key}\0${$.key}`,C);let v=$.key==="true"?`.${y.key}`:`.${y.key}-${$.key}`,g=It({selector:v,path:s,base:!1},n.classKeywords);f.push({title:g.title,axis:$.key==="true"?y.key:g.axis??y.key,base:!1,classes:`${a} ${C}`.trim(),line:at(t,$.at),group:r,prop:y.key,value:$.key})}}return f.push(...Ja(c.val,a,m,n,s,t,r)),{slots:f,defaults:Ka(c.val)}}function br(t){if(t.t==="str"&&t.v)return[t.v];if(t.t==="bool")return[t.v?"true":"false"];if(t.t==="arr"){let e=[];for(let n of t.items){let s=br(n);if(!s||s.length!==1)return null;e.push(s[0])}return e.length?e:null}return null}function Ja(t,e,n,s,r,o,i){let a=t.entries.find(c=>c.key==="compoundVariants")?.value;if(!a||a.t!=="arr")return[];let l=[];for(let c of a.items){if(c.t!=="obj")continue;let u=[],f="",m=c.at,y=!1;for(let C of c.entries){if(C.key==="class"||C.key==="className"){f=ge(C.value)??"",m=C.at,C.value.t!=="str"&&C.value.t!=="arr"&&f===""&&(y=!0);continue}let v=br(C.value);if(!v){y=!0;break}u.push({axis:C.key,values:v})}if(y)continue;let $=[[]];for(let C of u){let v=[];for(let g of $){for(let p of C.values)if(v.push([...g,{axis:C.axis,value:p}]),v.length>=8)break;if(v.length>=8)break}$=v}for(let C of $){if(C.length<2&&!f.trim())continue;let v=[e],g=[];for(let b of C){let k=n.get(`${b.axis}\0${b.value}`);k&&v.push(k),g.push(b.value==="true"?b.axis:b.value)}f.trim()&&v.push(f);let p=v.join(" ").replace(/\s+/g," ").trim();if(!p)continue;let d=It({selector:`.${g.join("-")}`,path:r,base:!1},s.classKeywords);l.push({title:d.title,axis:d.axis,base:!1,classes:p,line:at(o,m),group:i,when:C.map(b=>({prop:b.axis,value:b.value}))})}}return l}function fn(t,e,n){return{title:"Base",axis:null,base:!0,classes:t,line:e,group:n}}function xr(t,e){return e.elements.includes(t.toLowerCase())?!0:e.identifier.test(t)}function Za(t){let e=t.match(/\bclassName\s*=\s*(?:"([^"]*)"|'([^']*)'|\{\s*"([^"]*)"\s*\}|\{\s*'([^']*)'\s*\})/);return e?.[1]??e?.[2]??e?.[3]??e?.[4]??null}var Xa=new Set(["opacity","z-index","font-weight","line-height","flex","flex-grow","flex-shrink","order","zoom"]);function Ya(t){return t.replace(/^[A-Z]/,e=>`-${e.toLowerCase()}`).replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function qa(t,e){return e.t==="str"?e.v:e.t==="num"?Xa.has(t)?String(e.v):`${e.v}px`:null}function he(t,e){if(t.t!=="obj")return[];let n=[],s=[];for(let o of t.entries){if(o.value.t==="obj"){let l=o.key.replace(/^&/,""),c=l===":hover"?"hover":l===":focus"||l===":focus-visible"?"focus":l===":active"?"active":l===":disabled"?"disabled":null;c&&s.push(...he(o.value,c));continue}let i=Ya(o.key),a=qa(i,o.value);!a||!tt(i,a)||n.push({property:i,value:a,via:"style"})}return[...n.length?[{state:e,context:"",declarations:n}]:[],...s]}function gn(t,e){if(t[e]!=="`")return null;let n="";for(let s=e+1;s<t.length;s++){let r=t[s];if(r==="\\"){let o=t[s+1];if(o===void 0)return null;n+=o==="n"?`
|
|
40
|
+
`:o,s++;continue}if(r==="$"&&t[s+1]==="{"){let o=1;for(s+=2;s<t.length&&o>0;s++)t[s]==="{"?o++:t[s]==="}"&&o--;s--,n+=" ";continue}if(r==="`")return{css:n,end:s+1};n+=r}return null}function Qa(t,e){if(t==="default")return e;if(e==="default")return t;let n=[...new Set([...t.split(" + "),...e.split(" + ")])];return n.sort((s,r)=>K(s)-K(r)||s.localeCompare(r)),ft(n)}function mn(t){let e=[];for(let n of mt(`.__gs {
|
|
41
|
+
${t}
|
|
42
|
+
}`)){let s=X(n.selector),r=s?.[s.length-1];if(!r)continue;let o=re(r.simples),i=ft(o.states),a=it(n.ownBody).filter(l=>tt(l.property,l.value));a.length&&e.push({state:i,context:n.context,declarations:a});for(let l of me(n.ownBody))e.push({state:Qa(i,l.state),context:[n.context,l.context].filter(Boolean).join(" \xB7 "),declarations:l.declarations})}return e}function tl(t){let e=t.match(/\bstyle\s*=\s*"([^"]*)"/);if(e){let i=it(e[1]).filter(a=>tt(a.property,a.value));return i.length?[{state:"default",context:"",declarations:i}]:[]}let n=t.search(/\bstyle\s*=\s*\{/);if(n<0)return[];let s=t.indexOf("{",n),r=W(t,s+1);t[r]==="{"&&(s=r);let o=Q(t,s);return o?he(o.val,"default"):[]}function el(t){let e=Za(t);if(e)return{classes:e,painted:[]};let n=t.search(/\bclassName\s*=\s*\{/);if(n<0)return{classes:"",painted:[]};let s=t.indexOf("{",n),r=W(t,s+1);if(t.startsWith("css",r)&&!/[\w$]/.test(t[r+3]??"")){let i=W(t,r+3);if(t[i]==="`"){let a=gn(t,i);return{classes:"",painted:a?mn(a.css):[]}}if(t[i]==="("){let a=Q(t,i+1);return{classes:"",painted:a?he(a.val,"default"):[]}}}let o=Q(t,r);return o?{classes:ge(o.val)??"",painted:[]}:{classes:"",painted:[]}}function nl(t,e){if(e.identifier.test(t))return!0;let n=t.replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(Boolean);return e.classKeywords.some(s=>n.includes(s.toLowerCase()))}function sl(t,e){let n=[],s=/(?:^|[^\w$])styled(?:\.([A-Za-z][\w]*)|\(\s*(?:["']([A-Za-z][\w]*)["']|([A-Za-z][\w]*))\s*\))/g;for(let o of t.matchAll(s)){let i=o[1]??o[2]??o[3]??"";if(!xr(i,e))continue;let a=W(t,(o.index??0)+o[0].length);t.startsWith(".attrs",a)&&(a=W(t,a+6),t[a]==="("&&(a=dn(t,a,"(",")")),a=W(t,a));let l=[];if(t[a]==="`"){let c=gn(t,a);c&&(l=mn(c.css))}else if(t[a]==="("){let c=Q(t,a+1);c&&(l=he(c.val,"default"))}l.length!==0&&n.push({title:"Styled",axis:null,base:!0,classes:"",line:at(t,o.index??0),painted:l})}let r=/(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*css\s*`/g;for(let o of t.matchAll(r)){let i=o[1]??"";if(!nl(i,e))continue;let a=t.indexOf("`",o.index??0),l=a<0?null:gn(t,a);if(!l)continue;let c=mn(l.css);c.length!==0&&n.push({title:"Css",axis:null,base:!0,classes:"",line:at(t,o.index??0),painted:c})}return n}function rl(t,e){if(e==="default")return`.${t}`;let n=`.${t}`;for(let s of e.split(" + "))s==="hover"?n+=":hover":s==="focus"?n+=":focus":s==="active"?n+=":active":s==="disabled"&&(n+=":disabled");return n}function ol(t,e,n,s,r){let o=gr(t.classes).map(mr).filter(d=>d!==null),i=o.filter(d=>d.stem===null||!s.has(d.stem)),a=(t.painted??[]).filter(d=>d.declarations.length>0);if(i.length===0&&a.length===0)return null;let l=new Map,c=(d,b,k)=>{if(k.length===0)return;let x=`${d}\0${b}`,w=l.get(x)??{state:d,context:b,declarations:[]};w.declarations.push(...k),l.set(x,w)},u=[r];for(let d of o){let b=hr(d).filter(k=>tt(k.property,k.value));c(d.state,d.context,b),d.state==="default"&&d.context===""&&d.stem&&u.push(d.stem)}for(let d of a)c(d.state,d.context,d.declarations);let f=[...l.values()].flatMap(d=>d.declarations);if(!Ua(f))return null;let m=l.get("default\0")?.declarations??[];if(ie(m))return null;let y=[...l.values()].map(d=>({state:d.state,context:d.context,line:t.line,declarations:d.declarations})).sort((d,b)=>d.state!==b.state?d.state==="default"?-1:b.state==="default"?1:K(d.state.split(" + ")[0])-K(b.state.split(" + ")[0])||d.state.localeCompare(b.state):d.context===""?-1:b.context===""?1:d.context.localeCompare(b.context)),$=[...new Set(o.map(d=>d.stem).filter(d=>d!==null))],C=$.length?$.map(d=>`.${d}`).join(""):n.elements[0]??"button",v=y.flatMap(d=>hn(rl(r,d.state),d.declarations,d.context)),g=n.elements[0]??"button";return{variant:{title:t.title,axis:t.axis,element:{tag:g,classes:u,attrs:{},ancestors:[]},usage:{status:"unknown",files:[],fileCount:0},selector:C,path:e,line:t.line,base:t.base,states:y},rules:v}}function kr(t,e,n,s,r){let o=Va(e),i=[],a=[],l=/(?:^|[^\w$])(cva|tv)\s*\(/g;for(let p of o.matchAll(l)){let d=(p.index??0)+Math.max(0,p[0].indexOf(p[1])),b=(p.index??0)+p[0].length,k=a.length,x=Ha(o,b,n,t,k);a.push({name:Ga(o,d),defaults:x.defaults}),i.push(...x.slots)}i.push(...sl(o,n));let c=/<([A-Za-z][\w.]*)\b([^>]*?)>/g;for(let p of o.matchAll(c)){let d=p[1];if(!xr(d,n))continue;let b=p[2]??"",k=el(b),x=[...k.painted,...tl(b)],w=k.classes.trim();if(!w&&x.length===0)continue;let j=p.index??0,I=at(o,j);i.push({title:w?"Base":k.painted.length?"Css":"Inline",axis:null,base:!0,classes:w,line:I,painted:x,...w&&x.length===0?{site:{path:t,line:I,offset:j}}:{}})}let u=[],f=[],m=new Map,y=[],$=new Map,C=new Map,v=r;for(let p=0;p<i.length;p++){let d=i[p];if(u.length+f.length>=Pa)break;let b=(d.painted??[]).map(I=>`${I.state}|${I.context}|${I.declarations.map(R=>`${R.property}:${R.value}`).join(";")}`).join("||"),k=`${d.classes.replace(/\s+/g," ").trim()}##${b}`,x=$.get(k);if(x){d.group!==void 0&&C.set(p,x),d.site&&m.get(x)?.sites.push(d.site);continue}v+=1;let w=`__gs-recipe-${v}`,j=ol(d,t,n,s,w);if(j){if($.set(k,w),d.group!==void 0&&C.set(p,w),d.site){let I={variant:j.variant,sites:[d.site]};m.set(w,I),f.push(I)}else u.push(j.variant);y.push(...j.rules)}}let g=[];for(let p=0;p<a.length;p++){let d=a[p],b={path:t,name:d.name,staticClasses:[],axes:[],compounds:[]},k=new Map;for(let x=0;x<i.length;x++){let w=i[x];if(w.group!==p)continue;let j=C.get(x);if(!j)continue;if(!w.prop&&!w.when){b.staticClasses.push(j);continue}if(w.when){b.compounds.push({when:w.when,classes:[j]});continue}let I=k.get(w.prop)??[];I.push({value:w.value,classes:[j]}),k.set(w.prop,I)}for(let[x,w]of k)b.axes.push({prop:x,values:w,...d.defaults[x]?{defaultValue:d.defaults[x]}:{}});(b.staticClasses.length||b.axes.length||b.compounds.length)&&g.push(b)}return{variants:u,inline:f,previewRules:y,nextId:v,recipes:g}}function wr(t,e){let s=(t.split("/").pop()??"").replace(/(\.module)?\.[^.]+$/i,"").toLowerCase().split(/[^a-z0-9]+/).filter(Boolean);return e.some(r=>{let o=r.toLowerCase();return s.includes(o)||s.includes(`${o}s`)})}var yn=6,il=/"([^"\\\n]{0,400})"|'([^'\\\n]{0,400})'|`([^`\\]{0,400})`/g,al=/\bclass(?:Name)?\s*=\s*(?:"([^"]*)"|'([^']*)')/g,ll=/\b(?:styles?|classes|css|cls|s)\.([A-Za-z_]\w*)/g,Wt=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function cl(t){let e=n=>n.replace(/[^\n]/g," ");return t.replace(/\/\*[\s\S]*?\*\//g,e).replace(/<!--[\s\S]*?-->/g,e).replace(/(^|\s)\/\/[^\n]*/g,(n,s)=>s+e(n.slice(s.length)))}function ul(t,e){let n=cl(e),s=new Map,r=new Map,o=(a,l,c)=>{let u=a.get(l);u?u.push(c):a.set(l,[c])},i=(a,l)=>{for(let c of a.matchAll(/[\w-]+/g))o(s,c[0],l)};for(let a of n.matchAll(il))i(a[1]??a[2]??a[3]??"",a.index);for(let a of n.matchAll(al))i(a[1]??a[2]??"",a.index);for(let a of n.matchAll(ll))o(r,a[1],a.index);return{path:t,text:n,original:e,words:s,ids:r}}function vr(t,e){let n=1;for(let s=t.indexOf(`
|
|
43
|
+
`);s!==-1&&s<e;)n++,s=t.indexOf(`
|
|
44
|
+
`,s+1);return n}var pl=t=>t.replace(/[-_]+(\w)/g,(e,n)=>n.toUpperCase()),fl=/\[\s*([\w-]+)\s*(?:=\s*(?:"([^"]*)"|'([^']*)'|([^\]\s]*)))?\s*\]/g,dl=new Set(["data-component","data-slot","role"]);function gl(t,e){return[...t.slice(dt(t)).matchAll(fl)].map(s=>({name:s[1],value:s[2]??s[3]??s[4]??null})).filter(s=>!dl.has(s.name)&&!(s.value!==null&&e.has(s.value.toLowerCase())))}function ml(t){return[...t.slice(dt(t)).matchAll(/\.((?:\\.|[\w-])+)/g)].map(n=>n[1].replace(/\\(.)/g,"$1"))}function bn(t,e,n,s,r=!1,o=[],i=()=>null){let a=null,l=()=>a??=e.map(g=>ul(g,t.get(g)??"")),c=new Map,u=g=>{let p=c.get(g);if(!p){let d=new RegExp(`["'\`]${Wt(g)}["'\`]\\s*\\+`);p=l().filter(b=>b.text.includes(`${g}\${`)||d.test(b.text)),c.set(g,p)}return p},f=(g,p,d)=>Xs(tn(g.original,p,d,g.path),g.original,p,g.path,o,i),m=(g,p)=>({files:g.slice(0,yn).map(({file:d,offset:b,example:k})=>({path:d.path,line:vr(d.text,b),...r?{example:k??f(d,b,p)}:{}})),fileCount:g.length}),y=(g,p)=>{let d=[],b=pl(g);for(let k of l()){let x=[...s.has(g)?[]:k.words.get(g)??[],...k.ids.get(b)??k.ids.get(g)??[]],w=x[0];if(w===void 0)continue;let j=w,I;if(r)for(let R of x){let A=f(k,R,p);if(A.kind!=="other"){j=R,I=A;break}}d.push({file:k,offset:j,example:I})}if(d.length)return{status:"used",...m(d,p)};for(let k=g.length-1;k>0;k--){if(g[k]!=="-"&&g[k]!=="_")continue;let x=g.slice(0,k+1),w=g.slice(k+1),j=u(x);if(j.length===0||!w)continue;let I=x.slice(0,-1),R=new RegExp(`\\b${Wt(I)}\\s*[=:]\\s*\\{?\\s*["'\`]${Wt(w)}["'\`]`),A=[];for(let M of l()){let T=R.exec(M.text);T&&A.push({file:M,offset:T.index})}return A.length?{status:"used",via:`via ${I} prop`,...m(A,p)}:{status:"dynamic",via:`built as ${x}\${\u2026}`,...m(j.map(M=>({file:M,offset:0})),p)}}return{status:"unreferenced",files:[],fileCount:0}},$=(g,p)=>{let d=Wt(g.name),b=g.value===null?new RegExp(`\\b${d}\\b`):new RegExp(`\\b${d}\\s*[=:]\\s*\\{?\\s*["'\`]${Wt(g.value)}["'\`]`),k=[];for(let j of l()){let I=b.exec(j.text);I&&k.push({file:j,offset:I.index})}if(k.length)return{status:"used",via:`via ${g.name} attribute`,...m(k,p)};let x=new RegExp(`\\b${d}\\s*=\\s*\\{(?!\\s*["'\`])`),w=[];for(let j of l()){let I=x.exec(j.text);I&&w.push({file:j,offset:I.index})}return w.length?{status:"dynamic",via:`${g.name} is set from a variable`,...m(w,p)}:{status:"unreferenced",files:[],fileCount:0}},C=new Map;if(r&&o.length>0)for(let g of l())for(let p of fe(g.path,g.text,o,i))for(let d of p.selects){let b=C.get(d)??[];b.push({file:g,offset:p.offset}),C.set(d,b)}let v={used:0,unknown:0,dynamic:1,unreferenced:2};for(let g of n){let p=ml(g.selector),d=gl(g.selector,s);if(p.length===0&&d.length===0){g.usage={status:"unknown",files:[],fileCount:0};continue}let b=[...p.map(R=>y(R,p)),...d.map(R=>$(R,p))];g.usage=b.reduce((R,A)=>v[A.status]>=v[R.status]?A:R);let k=g.element?.classes.find(R=>R.startsWith("__gs-recipe-")),x=k?C.get(k):void 0;if(!x||x.length===0)continue;let w=new Set(g.usage.files.map(R=>R.path)),j=g.usage.fileCount,I=[...g.usage.files];for(let R of x)w.has(R.file.path)||(w.add(R.file.path),j+=1,!(I.length>=yn)&&I.push({path:R.file.path,line:vr(R.file.text,R.offset),...r?{example:f(R.file,R.offset,[])}:{}}));g.usage={...g.usage,status:g.usage.status==="unknown"?"unknown":"used",files:I,fileCount:j}}}function $r(t,e,n){let s=[],r=new Set;for(let o of e)r.has(o.path)||(r.add(o.path),!(s.length>=yn)&&s.push({path:o.path,line:o.line,...n?{example:tn(t.get(o.path)??"",o.offset,[],o.path)}:{}}));return{status:"used",files:s,fileCount:r.size}}var hl={id:"button",label:"Buttons",identifier:/^[A-Z][A-Za-z0-9]*Button[A-Za-z0-9]*$|^Button[A-Za-z0-9]*$/,elements:["button"],roles:["button"],classKeywords:["btn","button"],excludeClassKeywords:["switch","switcher"],prose:/\bbuttons?\b/i},Er={button:hl},Ir=12,kn=200,ht=/\.(tsx?|jsx?|mjs|cjs|vue|svelte|astro)$/i,Cr=/\.(tsx?|jsx?|mjs|cjs|vue|svelte|astro|html?|mdx|erb|php|hbs|njk|liquid|twig|ejs|pug|cshtml|razor|jinja2?|j2)$/i,Ut=/\.(css|scss|sass|less|styl)$/i,Sr=/\.(mdx?|markdown|txt|rst|adoc)$/i,Ar=/(^|\/)(tokens?|design-tokens?|theme)[^/]*\.json$/i,J=/(^|\/)(__tests__|tests?|spec|e2e|cypress|playwright)(\/|$)|\.(test|spec)\.[a-z]+$/i,yl=/(^|\/)(plans?|results?|changelogs?|history|archive)(\/|\.|$)|(^|\/)CHANGELOG/i;function bl(t){return ye.test(t)&&!/(^|\/)README\.md$/i.test(t)?"instruction":yl.test(t)?"record":"documentation"}var ye=/(^|\/)(AGENTS|CLAUDE|CONTRIBUTING|README|GUIDELINES?)\.md$|(^|\/)(eslint|stylelint|\.eslintrc|\.stylelintrc)[^/]*$|(^|\/)\.cursor\/|(^|\/)\.claude\//i;function lt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function xl(t){return(t.split("/").pop()??"").replace(/(\.module)?\.[^.]+$/i,"")}function Rr(t,e){let n=xl(t).toLowerCase();return e.some(s=>{let r=s.toLowerCase();return n===r||n===`${r}s`})}function kl(t,e){let n=1;for(let s=0;s<e;s++)t.charCodeAt(s)===10&&n++;return n}function ct(t,e){let n=t.split(`
|
|
45
|
+
`),s=0,r=[];for(let o=0;o<n.length;o++){let i=n[o];if(e.lastIndex=0,!!e.test(i)&&(s++,r.length<Ir)){let a=i.trim();r.push({line:o+1,text:a.length>kn?`${a.slice(0,kn)}\u2026`:a})}}return{count:s,lines:r}}function jr(t){let e=t.lastIndexOf("/");return e<0?"":t.slice(0,e)}function Mr(t){let e=[];for(let n of t.split("/"))!n||n==="."||(n===".."?e.pop():e.push(n));return e.join("/")}var wl=["",".tsx",".ts",".jsx",".js",".mjs",".vue",".svelte",".css",".module.css",".scss","/index.tsx","/index.ts","/index.js"];function yt(t,e,n){let s;if(e.startsWith("."))s=Mr(`${jr(t)}/${e}`);else if(e.startsWith("@/"))s=e.slice(2);else if(e.startsWith("~/"))s=e.slice(2);else if(e.startsWith("/"))s=e.slice(1);else return null;for(let r of wl)if(n(s+r))return s+r;return null}var vl=/import\s+(?:[^'"]*?\s+from\s+)?['"]([^'"]+)['"]|require\(\s*['"]([^'"]+)['"]\s*\)|@import\s+(?:url\()?['"]([^'"]+)['"]/g;function xn(t){let e=[];for(let n of t.matchAll(vl)){let s=n[1]??n[2]??n[3];s&&e.push(s)}return e}var $l=/export\s+(?:default\s+)?(?:async\s+)?(?:function|const|let|class|var)\s+([A-Za-z_$][\w$]*)|export\s*\{([^}]*)\}/g;function _r(t){let e=new Set;for(let n of t.matchAll($l))if(n[1]&&e.add(n[1]),n[2])for(let s of n[2].split(",")){let r=s.trim().split(/\s+as\s+/).pop()?.trim();r&&e.add(r)}return[...e]}var wn=/var\(\s*(--[\w-]+)/g;function be(t){return t.split(" \xB7 ").every(e=>e===""||/^@layer\b/i.test(e))}function Dr(t){let e=[];for(let n of t.matchAll(/(?:^|[;{}])\s*composes\s*:\s*([^;]+)/g)){let s=n[1].trim(),r=/^(.*?)\s+from\s+(['"]?)([^'"]+)\2\s*$/.exec(s);r?e.push({names:r[1].split(/\s+/).filter(Boolean),from:r[3]}):e.push({names:s.split(/\s+/).filter(Boolean),from:null})}return e}function Cl(t,e,n){let s=e.startsWith(".")?Mr(`${jr(t)}/${e}`):e.startsWith("@/")?e.slice(2):e.startsWith("~/")||e.startsWith("/")?e.replace(/^~?\//,""):null;return s&&n(s)?s:yt(t,e.replace(/\.(?:module\.)?(?:css|scss|sass|less)$/i,""),n)}function Sl(t){let e=new Map;for(let[n,s]of t)if(Ut.test(n)){for(let r of mt(s))if(be(r.context))for(let o of z(r.selector)){let i=/^\.([\w-]+)$/.exec(o.trim())?.[1];if(!i)continue;let a=`${n}\0${i}`,l=e.get(a)??{decls:[],composes:[]};l.decls.push(...it(r.ownBody));for(let c of me(r.ownBody))c.state==="default"&&c.context===""&&l.decls.push(...c.declarations);l.composes.push(...Dr(r.ownBody)),e.set(a,l)}}return e}function Al(t,e,n,s){let r=[],o=new Set,i=(l,c,u)=>{if(u>4)return;let f=`${l}\0${c}`;if(o.has(f))return;o.add(f);let m=n.get(f);if(m){for(let y of m.composes)a(l,y,u+1);r.push(...m.decls)}},a=(l,c,u)=>{for(let f of c.names)if(c.from==="global")for(let m of n.keys()){let y=m.indexOf("\0"),$=m.slice(0,y);m.slice(y+1)!==f||/\.module\./i.test($)||i($,f,u)}else if(c.from){let m=Cl(l,c.from,s);m&&i(m,f,u)}else i(l,f,u)};for(let l of Dr(e))a(t,l,0);return r}function Rl(t,e){let n=yr(e);return n?z(t).map(s=>{let r=Math.max(s.lastIndexOf(" "),s.lastIndexOf(">"),s.lastIndexOf("+"),s.lastIndexOf("~"));return r<0?`${s}${n}`:`${s.slice(0,r+1)}${s.slice(r+1)}${n}`}).join(", "):t}var _l=/^(?::root|html|body|\*)$/i,El=25e4,Il=/<([A-Za-z][\w.-]*)\b((?:[^<>"'`{}]|"[^"]*"|'[^']*'|`[^`]*`|\{(?:[^{}]|\{[^{}]*\})*\})*)>/g,jl=/\b(?:styles?|classes|css|cls)\s*(?:\.([A-Za-z_]\w*)|\[\s*["']([\w-]+)["']\s*\])/g,Ml=new Set(["span","svg","i","img","em","strong","small","b","p","kbd","abbr","sup","sub","picture","use","path"]);function Dl(t){let e=new Set,n=new Set;for(let s of t.matchAll(Il)){let r=s[1],o=Ml.has(r.toLowerCase())&&r===r.toLowerCase()?e:n;for(let i of s[2].matchAll(jl))o.add(i[1]??i[2])}return{parts:new Set([...e].filter(s=>!n.has(s))),controls:n}}function Ol(t,e){let n=new Map;for(let s of e)if(Ut.test(s)){for(let r of mt(t.get(s)))if(be(r.context)&&z(r.selector).some(o=>_l.test(o)))for(let o of it(r.ownBody))o.property.startsWith("--")&&!n.has(o.property)&&n.set(o.property,o.value)}return n}function Ll(t,e){let n=new Set,s=[],r=a=>{for(let l of a.matchAll(wn))n.has(l[1])||(n.add(l[1]),s.push(l[1]))};for(let a of e)r(a);let o=[];for(let a=s.shift();a;a=s.shift()){let l=t.get(a);l===void 0||!tt(a,l)||(o.push(`${a}:${l}`),r(l))}return`${o.length?`:root{${o.join(";")}}
|
|
46
|
+
`:""}${e.join(`
|
|
47
|
+
`)}`.slice(0,El)}function Or(t,e){let n=[...t.keys()].sort(),s=h=>t.has(h),r=new Map,o=(h,S,_,D)=>{let L=`${S}:${h}`,V=r.get(L);if(V){V.note.includes(_)||(V.note+=`; ${_}`);return}r.set(L,{path:h,role:S,note:_,matches:D.count,lines:D.lines})},i=new Set,a=new Set;for(let h of n){if(!ht.test(h)||J.test(h))continue;let S=t.get(h),_=_r(S).filter(O=>e.identifier.test(O)),D=h.split("/").pop()??"",L=new RegExp(e.classKeywords.join("|"),"i").test(D);if(_.length===0&&!L)continue;for(let O of _)i.add(O);a.add(h);let V=_.length?new RegExp(`\\b(?:${_.map(lt).join("|")})\\b`,"g"):e.prose;o(h,"implements",_.length?`exports ${_.join(", ")}`:"named for the concept",ct(S,V))}let l=new Set,c=[],u=[],f=new Map,m=h=>Rr(h,e.classKeywords)||/\.module\.[a-z]+$/i.test(h)&&f.has(h),y=null,$=()=>y??=Sl(t),C=h=>{let S=m(h),_=[],D=0;for(let O of mt(t.get(h))){let B=z(O.selector).filter(P=>zt(P,e,S));if(B.length===0)continue;D+=1;for(let P of O.ownBody.matchAll(wn))l.add(P[1]);let F=me(O.ownBody),nt=[...Al(h,O.ownBody,$(),s),...it(O.ownBody),...F.filter(P=>P.state==="default"&&P.context==="").flatMap(P=>P.declarations)];for(let P of nt)for(let H of P.value.matchAll(wn))l.add(H[1]);_.push({block:O,parts:B,declarations:nt,previewContext:be(O.context)?"":null,listed:!0});for(let P of F){if(P.state==="default"&&P.context==="")continue;let H=Rl(B.join(", "),P.state),Ot=z(H).filter(ro=>zt(ro,e,S));if(Ot.length===0)continue;let so=[O.context,P.context].filter(Boolean).join(" \xB7 ");_.push({block:{...O,selector:H,context:so},parts:Ot,declarations:P.declarations,previewContext:be(O.context)?P.context:null,listed:!1})}}let L={parts:new Set,controls:new Set};for(let O of f.get(h)??[]){let B=Dl(t.get(O)??"");for(let F of B.parts)L.parts.add(F);for(let F of B.controls)L.controls.add(F)}c.push(...lr(h,_.map(({block:O,parts:B,declarations:F})=>({selector:B.join(", "),declarations:F,line:O.line,context:O.context})),e,S,L));let V=/\.module\.[a-z]+$/i.test(h)?`${_s(h)} `:"";for(let{parts:O,declarations:B,previewContext:F}of _){if(F===null)continue;let nt=O.flatMap(H=>{let Ot=zt(H,e,S);return Ot?[`${V}${Bt(Ot.compounds)}`]:[]}),P=B.filter(H=>tt(H.property,H.value));if(!(nt.length===0||P.length===0))for(let H of nt)u.push(...hn(H,P,F))}return{count:D,lines:_.filter(O=>O.listed).slice(0,Ir).map(({block:O})=>({line:O.line,text:O.selector.replace(/\s+/g," ").slice(0,kn)}))}},v=new Map;for(let h of a)for(let S of xn(t.get(h))){let _=yt(h,S,s);if(_&&Ut.test(_)){let D=v.get(_)??[];D.push(h.split("/").pop()??h),v.set(_,D),Rr(h,e.classKeywords)&&f.set(_,[...f.get(_)??[],h])}}for(let h of n){if(!Ut.test(h))continue;let S=C(h),_=v.get(h);if(S.count===0)continue;let D=[];_&&D.push(`imported by ${_.join(", ")}`),S.count>0&&D.push(`${S.count} matching rule${S.count===1?"":"s"}`),o(h,"styles",D.join("; "),S)}let g=new Set;for(let h of c)for(let S of h.selector.matchAll(/\.((?:\\.|[\w-])+)/g))g.add(S[1].replace(/\\(.)/g,"$1"));let p=new Set(a),d=new RegExp([...e.elements.map(h=>`<${lt(h)}\\b`),...e.roles.map(h=>`role=["']${lt(h)}["']`)].join("|"));for(let h of n)!ht.test(h)||J.test(h)||d.test(t.get(h)??"")&&p.add(h);for(let h of a)for(let S of xn(t.get(h))){let _=yt(h,S,s);!_||!ht.test(_)||J.test(_)||wr(_,e.classKeywords)&&p.add(_)}let b=0,k=[],x=[];for(let h of p){let S=kr(h,t.get(h)??"",e,g,b);b=S.nextId,k.push(...S.recipes),c.push(...S.variants),x.push(...S.inline),u.push(...S.previewRules)}let w=Pn(x);c.push(...w.variants);let j=Ys([...a].map(h=>({path:h,source:t.get(h)??"",names:_r(t.get(h)??"").filter(S=>e.identifier.test(S))})),k,(h,S)=>yt(h,S,s)),I=[];if(l.size>0){let h=new RegExp(`(?:^|[\\s{;])(${[...l].map(lt).join("|")})\\s*:`),S=new Map;for(let _ of n){if(!Ut.test(_)&&!Ar.test(_))continue;let D=t.get(_),L=ct(D,h);if(L.count!==0){for(let V of D.matchAll(new RegExp(h.source,"gm"))){let O=S.get(V[1])??[];O.includes(_)||O.push(_),S.set(V[1],O)}o(_,"tokens",`defines ${L.count} token${L.count===1?"":"s"} read by ${e.label.toLowerCase()} styles`,L)}}for(let _ of[...l].sort())I.push({name:_,definedIn:S.get(_)??[]})}for(let h of n){if(!Ar.test(h))continue;let S=ct(t.get(h),e.prose);S.count>0&&o(h,"tokens","token file mentions the concept",S)}let R=[...i],A=new RegExp([...R.length?[`<(?:${R.map(lt).join("|")})\\b`]:[],...e.elements.map(h=>`<${lt(h)}\\b`),...e.roles.map(h=>`role=["']${lt(h)}["']`)].join("|"));for(let h of n){if(!ht.test(h)||a.has(h))continue;let S=t.get(h),_=J.test(h),D=ct(S,A),L=xn(S).some(O=>{let B=yt(h,O,s);return B!=null&&a.has(B)});if(D.count===0&&!L)continue;let V=D.count>0?`${D.count} render${D.count===1?"":"s"}`:"imports a button component";o(h,_?"tests":"uses",V,D.count?D:ct(S,e.prose))}for(let h of n){if(!(Sr.test(h)||ye.test(h)))continue;let _=t.get(h),D=ct(_,e.prose);D.count!==0&&o(h,J.test(h)?"tests":"describes",ye.test(h)?"repo rules / instructions":"documentation",D)}for(let h of n){if(!J.test(h)||r.has(`tests:${h}`)||!ht.test(h))continue;let S=ct(t.get(h),e.prose);S.count>0&&o(h,"tests","mentions the concept",S)}let M=[...r.values()].sort((h,S)=>S.matches-h.matches||h.path.localeCompare(S.path)),T={implements:0,styles:0,tokens:0,uses:0,describes:0,tests:0};for(let h of M)T[h.role]++;let G=cr(c);bn(t,n.filter(h=>Cr.test(h)&&!J.test(h)),G,new Set(e.elements),!0,j,(h,S)=>yt(h,S,s)),bn(t,n.filter(h=>Cr.test(h)&&!J.test(h)),G.flatMap(h=>h.modifiers??[]),new Set(e.elements));for(let[h,S]of w.sites)h.usage=$r(t,S,!("alike"in h));let Z=Ol(t,n),Ht=[];if(i.size>0){let h=new RegExp(e.elements.map(S=>`<${lt(S)}\\b`).join("|"),"g");for(let S of n){if(!ht.test(S)||J.test(S)||a.has(S))continue;let _=t.get(S),D=(_.match(h)??[]).length;if(D===0)continue;let L=ct(_,new RegExp(h.source));Ht.push({path:S,line:L.lines[0]?.line??1,count:D})}}let jn=[],Mn=new Set;for(let h of n){if(!ht.test(h)||J.test(h))continue;let S=t.get(h),_=fe(h,S,j,(D,L)=>yt(D,L,s));for(let D of _)for(let L of D.unknown){let V=[...L.known].sort();if(L.cls!==void 0){if(g.has(L.cls))continue;let F=L.cls.slice(0,L.cls.length-L.value.length),nt=[...g].filter(P=>P.startsWith(F)&&P.length>F.length).map(P=>P.slice(F.length));if(nt.length===0)continue;V=[...new Set([...L.known,...nt])].sort()}if(V.length===0)continue;let O=kl(S,D.offset),B=`${h}\0${D.component}\0${L.prop}\0${L.value}`;Mn.has(B)||(Mn.add(B),jn.push({path:h,line:O,component:D.component,prop:L.prop,value:L.value,known:V}))}}let eo=n.filter(h=>(Sr.test(h)||ye.test(h))&&!J.test(h)).map(h=>({path:h,kind:bl(h)}));G.sort((h,S)=>Number(S.base)-Number(h.base)||h.path.localeCompare(S.path)||h.line-S.line);let Dn=nr(t,eo,e,G),no=tr([...f.entries()].map(([h,S])=>({sheet:h,sources:S.map(_=>t.get(_)??""),rules:mt(t.get(h)??"").map(_=>({selector:_.selector,declarations:it(_.ownBody)}))})));return{components:R.sort(),tokens:I,findings:M,variants:G,audit:Ps({variants:G,tokens:I,tokenValues:Z,hasComponent:i.size>0,nativeUses:Ht,unknownProps:jn,guidance:Dn,noun:e.label.toLowerCase(),element:e.elements[0]??e.id}),guidance:Dn,content:no,previewCss:Ll(Z,u),counts:T}}import{execFileSync as Tl}from"node:child_process";import{readdirSync as Nl,readFileSync as Vl,statSync as Bl}from"node:fs";import xe from"node:path";function bt(t,e){try{return Tl("git",e,{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"],maxBuffer:64*1024*1024})}catch{return null}}function vn(t,e=""){let s=bt(t,["rev-parse","--show-toplevel"])?.trim()||t;return{repoDir:s,root:Fe(e),stateDir:xe.join(s,".gruum")}}function Lr(t){let e=xe.join(t.repoDir,t.root),n=new Map,s=new TextDecoder("utf-8",{fatal:!1}),r=0,o=0,i=!1,a=(l,c)=>{if(i)return;let u;try{u=Nl(l).sort()}catch{return}for(let f of u){let m=c?`${c}/${f}`:f,y=xe.join(l,f),$;try{$=Bl(y)}catch{continue}if($.isDirectory()){Ve(m)&&a(y,m);continue}if(!$.isFile())continue;if(!Be(m,$.size)){o++;continue}let C=Vl(y);if(gs(C)){o++;continue}if(r+C.length>4e7){i=!0;return}r+=C.length,n.set(m,s.decode(C))}};return a(e,""),{files:n,truncated:i,skipped:o}}function Pr(t,e){let n=bt(t.repoDir,["diff","--cached","--name-status","-z"]);if(n===null)return e;let s=ys(n).map(({path:r,deleted:o})=>({path:r,content:o?null:bt(t.repoDir,["show",`:${r}`])}));return{...e,files:hs(e.files,s,t.root)}}function Tr(t){let e=bt(t.repoDir,["remote","get-url","origin"])?.trim()??"",n=ee(e)??xe.basename(t.repoDir),s=bt(t.repoDir,["rev-parse","HEAD"])?.trim()||"working-tree";return{fullName:n,ref:s,rootPath:t.root,htmlUrl:n.includes("/")?`https://github.com/${n}`:""}}function Nr(t){let e=bt(t.repoDir,["config","--get","core.hooksPath"])?.trim();return e||bt(t.repoDir,["rev-parse","--git-path","hooks"])?.trim()||null}function ke(t,e={}){let n=Er[e.concept??"button"],s=Lr(t);return e.staged&&(s=Pr(t,s)),{concept:n.id,label:n.label,...Or(s.files,n),repo:Tr(t),index:{files:s.files.size,truncated:s.truncated,skipped:s.skipped}}}function xt(t,e,n={}){let s=ke(t,{concept:e.concept,...n});return{result:s,baseline:e,items:Un(s,e)}}import{mkdirSync as Fl,readFileSync as zl,writeFileSync as Wl}from"node:fs";import jt from"node:path";function we(t){try{return zl(t,"utf8")}catch{return null}}function ve(t){let e=we(t);if(e===null)return null;try{return JSON.parse(e)}catch{return null}}function kt(t,e){Fl(jt.dirname(t),{recursive:!0}),Wl(t,e)}function wt(t,e){kt(t,`${JSON.stringify(e,null,2)}
|
|
48
|
+
`)}var Gt=t=>jt.join(t.stateDir,"baseline.json"),Vr=t=>jt.join(t.stateDir,"drift.json"),$n=t=>jt.join(t.stateDir,"exceptions.json"),Ul=t=>jt.join(t.stateDir,"config.json");function vt(t,e){return Zt(ve(e?jt.resolve(e):Gt(t)))}function $e(t){return Hn(ve(Vr(t)),new Date().toISOString())}function Cn(t,e){wt(Vr(t),e)}function Gl(t){if(!t||typeof t!="object")return{};let e={};for(let[n,s]of Object.entries(t))(s==="pending"||s==="accepted"||s==="rejected")&&(e[n]=s);return e}function Ce(t){return Gl(ve($n(t)))}function Sn(t){let e=ve(Ul(t)),n=Array.isArray(e?.denyGit)?e.denyGit.filter(r=>r==="commit"||r==="push"):Ct.denyGit,s=typeof e?.maxFollowups=="number"&&e.maxFollowups>=0?Math.floor(e.maxFollowups):Ct.maxFollowups;return{...typeof e?.root=="string"?{root:e.root}:{},hooks:{...Ct,denyGit:n,maxFollowups:s}}}import{chmodSync as Kl,mkdirSync as Hl,readFileSync as Fr,writeFileSync as Jl}from"node:fs";import{hostname as Zl,homedir as Xl}from"node:os";import An from"node:path";function Br(t,e){if(t.length===0)return null;if(t.length===1)return t[0];let n=e.replace(/^\/+|\/+$/g,""),s=t.filter(r=>r.rootPath===n);if(s.length===1)return s[0];if(!n){let r=t.filter(o=>o.rootPath==="");if(r.length===1)return r[0]}return null}import{spawnSync as Yl}from"node:child_process";var Mt="https://app.getgruum.com",zr=()=>An.join(Xl(),".config","gruum","credentials.json");function Wr(){let t=process.env.GRUUM_TOKEN?.trim();if(t)return{token:t,apiOrigin:process.env.GRUUM_API_ORIGIN?.trim()||Mt};try{let e=JSON.parse(Fr(zr(),"utf8"));return typeof e.token!="string"||!e.token?null:{token:e.token,apiOrigin:typeof e.apiOrigin=="string"&&e.apiOrigin?e.apiOrigin:Mt}}catch{return null}}function ql(t){let e=zr();Hl(An.dirname(e),{recursive:!0}),Jl(e,`${JSON.stringify(t,null,2)}
|
|
49
|
+
`,{mode:384}),Kl(e,384)}function Ur(t){return(t?.apiOrigin||Mt).replace(/\/$/,"")}async function $t(t,e,n={}){let s=new Headers(n.headers);return t&&s.set("Authorization",`Bearer ${t.token}`),n.body&&!s.has("Content-Type")&&s.set("Content-Type","application/json"),fetch(`${Ur(t)}${e}`,{...n,headers:s})}function Rn(t,e){let n=Yl("git",e,{cwd:t,encoding:"utf8"});return n.status!==0?null:n.stdout.trim()||null}function Ql(t){let e=Rn(t,["remote","get-url","origin"]);return e?ee(e):null}function Se(t){let e=Rn(t,["rev-parse","--abbrev-ref","HEAD"]);return e&&e!=="HEAD"?e:""}function Gr(t){return Rn(t,["rev-parse","HEAD"])}function Kr(t){return An.join(t.stateDir,"project.json")}function tc(t){try{let e=JSON.parse(Fr(Kr(t),"utf8"));return typeof e.id!="string"||typeof e.repo!="string"?null:{id:e.id,name:typeof e.name=="string"?e.name:e.repo,repo:e.repo,rootPath:typeof e.rootPath=="string"?e.rootPath:""}}catch{return null}}async function Hr(){let t=`Cursor on ${Zl()}`,e=await $t(null,"/api/cli/pair/start",{method:"POST",body:JSON.stringify({label:t})});if(!e.ok)return process.stderr.write(`gruum: couldn't start sign-in (${e.status}). Is Gruum running at ${Mt}?
|
|
50
|
+
`),1;let n=await e.json(),s=`${Mt}/extension/connect?code=${encodeURIComponent(n.userCode)}`;process.stdout.write(`Sign in to Gruum to connect this CLI.
|
|
51
|
+
|
|
52
|
+
Code: ${n.userCode}
|
|
53
|
+
${s}
|
|
54
|
+
|
|
55
|
+
Waiting for confirmation\u2026
|
|
56
|
+
`);let r=Date.now()+600*1e3;for(;Date.now()<r;){await new Promise(a=>setTimeout(a,2e3));let o=await $t(null,`/api/cli/pair/poll?pairingId=${encodeURIComponent(n.pairingId)}&verifier=${encodeURIComponent(n.verifier)}`);if(!o.ok)continue;let i=await o.json();if(i.status==="expired")return process.stderr.write(`gruum: that code expired. Run gruum login again.
|
|
57
|
+
`),1;if(i.status==="connected"&&i.token)return ql({token:i.token,apiOrigin:Mt}),process.stdout.write(`Signed in. This CLI can read specs for your projects.
|
|
58
|
+
`),0}return process.stderr.write(`gruum: sign-in timed out. Run gruum login again.
|
|
59
|
+
`),1}async function Jr(t,e){let n=Ql(t.repoDir);if(!n)return process.stderr.write(`gruum: this folder has no GitHub origin, so it can't be matched to a Gruum project.
|
|
60
|
+
`),null;let s=tc(t);if(s&&s.repo===n)return s;let r=await $t(e,`/api/v2/cli/projects?repo=${encodeURIComponent(n)}`);if(r.status===401)return process.stderr.write(`gruum: sign-in expired. Run gruum login again.
|
|
61
|
+
`),null;if(!r.ok)return null;let o=await r.json(),i=Array.isArray(o.projects)?o.projects:[];if(i.length===0)return process.stderr.write(`gruum: no Gruum project is connected to ${n}. Create a v2 project for that repository, then run gruum check again.
|
|
62
|
+
`),null;let a=Br(i,t.root);if(!a){let l=i.map(c=>` ${c.name} (${c.id})${c.rootPath?` #${c.rootPath}`:""}`).join(`
|
|
63
|
+
`);return process.stderr.write(`gruum: ${n} matches more than one project. Set "root" in .gruum/config.json to the folder alias, then run gruum check again.
|
|
64
|
+
${l}
|
|
65
|
+
`),null}return wt(Kr(t),a),a}async function Ae(t,e){if(e)return"local";let n=Wr();if(!n)return"local";try{let s=await Jr(t,n);if(!s)return"local";let r=Se(t.repoDir),o=await $t(n,`/api/v2/cli/projects/${encodeURIComponent(s.id)}/baseline?concept=button&branch=${encodeURIComponent(r)}`);if(o.status===404||!o.ok)return"local";let i=await o.json(),a=Zt(i.baseline);return a?(wt(Gt(t),a),wt($n(t),i.exceptions??{}),"remote"):"local"}catch{return process.stderr.write(`gruum: couldn't reach Gruum. Checking the spec cached in .gruum/baseline.json.
|
|
66
|
+
`),"local"}}async function _n(t){let e=Wr();if(!e)return null;let n=await Jr(t,e);return n?{credentials:e,project:n}:null}async function Zr(t,e,n,s){let r=await _n(t);if(!r)return;let o=Se(t.repoDir);if(o)try{let i=await $t(r.credentials,`/api/v2/cli/projects/${encodeURIComponent(r.project.id)}/drift`,{method:"POST",body:JSON.stringify({action:"observe",concept:"button",branch:o,commit:Gr(t.repoDir),baselineVersion:n,source:s,items:e})});i.ok||process.stderr.write(`gruum: couldn't report this check (${i.status}). The local result still stands.
|
|
67
|
+
`)}catch{process.stderr.write(`gruum: couldn't reach Gruum to report this check. The local result still stands.
|
|
68
|
+
`)}}async function Xr(t,e,n){let s=await _n(t);if(!s)return{ok:!1,text:"Sign in with gruum login before requesting an exception."};let r=Se(t.repoDir);if(!r)return{ok:!1,text:"This folder is not on a named git branch."};try{let o=await $t(s.credentials,`/api/v2/cli/projects/${encodeURIComponent(s.project.id)}/drift`,{method:"POST",body:JSON.stringify({action:"request",concept:"button",branch:r,commit:Gr(t.repoDir),reason:n,item:e})}),i=await o.json().catch(()=>({}));if(!o.ok)return{ok:!1,text:i.error||`Request failed (${o.status}).`};let a=i.reviewUrl?`${Ur(s.credentials)}${i.reviewUrl}`:"",l=i.created?`Exception request ${i.id} is pending review.`:`An exception for this change is already pending (${i.id}).`;return{ok:!0,text:a?`${l}
|
|
69
|
+
${a}`:l}}catch{return{ok:!1,text:"Couldn't reach Gruum to request an exception."}}}async function Yr(t,e){let n=await _n(t);if(!n)return{ok:!1,text:"Sign in with gruum login to see exception status."};let s=Se(t.repoDir);try{let r=await $t(n.credentials,`/api/v2/cli/projects/${encodeURIComponent(n.project.id)}/drift?concept=button&branch=${encodeURIComponent(s)}`);if(!r.ok)return{ok:!1,text:`Couldn't load exceptions (${r.status}).`};let o=await r.json(),i=Array.isArray(o.requests)?o.requests:[],a=e?i.filter(l=>l.id===e):i;return a.length===0?{ok:!0,text:e?`No exception request ${e} on ${s||"this branch"}.`:`No exception requests on ${s||"this branch"}.`}:{ok:!0,text:a.map(l=>`${l.id} ${l.status} ${l.title} (${l.branch})`).join(`
|
|
70
|
+
`)}}catch{return{ok:!1,text:"Couldn't reach Gruum to read exception status."}}}var In="0.1.2",qr=`gruum ${In}: keep buttons on the Gruum spec
|
|
49
71
|
|
|
50
72
|
Usage:
|
|
51
|
-
gruum
|
|
73
|
+
gruum login
|
|
74
|
+
Sign this computer in. Prints a code to confirm in the browser.
|
|
75
|
+
gruum check [--staged] [--files <path>...] [--json] [--baseline <file>] [--root <dir>] [--ci] [--strict] [--report]
|
|
52
76
|
Scan the working tree and list drift against the spec. Exits 1 on
|
|
53
|
-
block drift
|
|
77
|
+
block drift that has no pending or accepted exception. --staged checks
|
|
78
|
+
what is staged for commit. When you are signed in, refreshes the
|
|
79
|
+
published spec and this branch's exceptions first. --ci reports the
|
|
80
|
+
run (or set GRUUM_TOKEN) and prints pending exceptions without failing
|
|
81
|
+
on them. --strict also fails on pending exceptions. --report stores a
|
|
82
|
+
local run without the CI exit rules.
|
|
54
83
|
gruum spec [--baseline <file>]
|
|
55
84
|
Print the spec packet an agent reads before writing a button.
|
|
56
85
|
gruum baseline --write [--out <file>] [--root <dir>]
|
|
@@ -63,30 +92,32 @@ Usage:
|
|
|
63
92
|
gruum hook <after-file-edit|stop|before-shell>
|
|
64
93
|
Cursor hook entry points (read the event on stdin).
|
|
65
94
|
gruum mcp
|
|
66
|
-
Stdio MCP server
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
`):process.stdout.write(`${
|
|
70
|
-
`)
|
|
71
|
-
`),
|
|
72
|
-
`)
|
|
73
|
-
|
|
74
|
-
`),
|
|
75
|
-
|
|
76
|
-
`),
|
|
77
|
-
`)
|
|
78
|
-
|
|
95
|
+
Stdio MCP server: gruum_button_spec, gruum_check_buttons,
|
|
96
|
+
gruum_request_exception, and gruum_exception_status.
|
|
97
|
+
`,sc=new Set(["--baseline","--root","--out","--cli","--files"]);function rc(t){let e=[],n=new Map;for(let s=0;s<t.length;s++){let r=t[s];if(!r.startsWith("--")){e.push(r);continue}let o=r.indexOf("="),i=o===-1?r:r.slice(0,o),a=o===-1?void 0:r.slice(o+1),l=n.get(i)??[];if(a!==void 0)l.push(a);else if(i==="--files")for(;t[s+1]&&!t[s+1].startsWith("--");)l.push(t[++s]);else sc.has(i)&&t[s+1]!==void 0&&l.push(t[++s]);n.set(i,l)}return{positional:e,flags:n}}var U=(t,e)=>t.flags.has(e),ut=(t,e)=>t.flags.get(e)?.[0];function Dt(t,e=process.cwd()){let n=vn(e),s=ut(t,"--root")??Sn(n).root??"";return vn(e,s)}var Re="No spec found. Publish one from Gruum, or draft one locally with `gruum baseline --write`.";function to(t,e){let n=vt(t,ut(e,"--baseline"));return n||process.stderr.write(`gruum: ${Re}
|
|
98
|
+
`),n}function Kt(t,e,n){let s={...e,checkedAt:new Date().toISOString(),baselineVersion:n.baseline.version,items:n.items};return Cn(t,s),s}async function oc(t){let e=Dt(t);await Ae(e,U(t,"--baseline"));let n=to(e,t);if(!n)return 0;let s=xt(e,n,{staged:U(t,"--staged")});U(t,"--staged")||Kt(e,$e(e),s);let r=(t.flags.get("--files")??[]).map(l=>N.relative(N.join(e.repoDir,e.root),N.resolve(l)).split(N.sep).join("/")),o=Le(s.items,r),i=Ce(e);(U(t,"--ci")||U(t,"--report"))&&await Zr(e,o,n.version,U(t,"--ci")?"ci":"local"),U(t,"--json")?process.stdout.write(`${JSON.stringify({baselineVersion:n.version,items:o,exceptions:i},null,2)}
|
|
99
|
+
`):process.stdout.write(`${Gn(o,{baselineVersion:n.version,files:s.result.index.files,skipped:s.result.index.skipped},i)}
|
|
100
|
+
`);let a=Pt(o,i);if(U(t,"--strict")){let l=o.some(c=>c.severity==="block"&&i[c.id]==="pending");return a.length>0||l?1:0}if(U(t,"--ci")&&a.length===0){let l=o.filter(c=>i[c.id]==="pending");l.length>0&&process.stdout.write(`${l.length} pending exception${l.length===1?"":"s"}; this run does not fail on them.
|
|
101
|
+
`)}return a.length>0?1:0}async function ic(t){let e=Dt(t);await Ae(e,U(t,"--baseline"));let n=to(e,t);return n?(process.stdout.write(`${JSON.stringify(Oe(n),null,2)}
|
|
102
|
+
`),0):1}function ac(t){if(!U(t,"--write"))return process.stderr.write(`gruum: pass --write to draft a local spec from the working tree.
|
|
103
|
+
`),2;let e=Dt(t),n=ke(e),s=Wn(n,{version:0}),r=ut(t,"--out")?N.resolve(ut(t,"--out")):Gt(e);return wt(r,s),process.stdout.write(`Drafted a local spec (v0) from ${n.index.files} files: ${s.styles.length} styles, ${s.tokens.length} tokens, ${s.rules.length} rules, ${s.acceptedFindings.length} accepted findings.
|
|
104
|
+
Wrote ${N.relative(process.cwd(),r)||r}.
|
|
105
|
+
`),0}function Qr(t,e,n,s){if(!n.ok)return process.stderr.write(`gruum: ${n.error}
|
|
106
|
+
`),!1;if(!n.changed)return s.push(`unchanged ${e}`),!0;let r=N.join(t.repoDir,e);return n.text===""?(En(r,{force:!0}),s.push(`removed ${e}`)):(kt(r,n.text),s.push(`wrote ${e}`)),!0}function lc(t){if(t.positional[1]!=="cursor")return process.stderr.write(`gruum: usage: gruum init cursor [--remove] [--force] [--cli "<command>"]
|
|
107
|
+
`),2;let e=Dt(t),n=ut(t,"--cli")??Tt,s=U(t,"--remove"),r=v=>we(N.join(e.repoDir,v)),o=[],i=s?ts(r(".cursor/hooks.json")):Qn(r(".cursor/hooks.json"),n),a=s?ns(r(".cursor/mcp.json")):es(r(".cursor/mcp.json"),n);for(let v of[i,a])if(!v.ok)return process.stderr.write(`gruum: ${v.error}
|
|
108
|
+
`),1;Qr(e,".cursor/hooks.json",i,o),Qr(e,".cursor/mcp.json",a,o);let l=r(pt);if(s)l!==null&&is(l)&&(En(N.join(e.repoDir,pt)),o.push(`removed ${pt}`));else if(l===null||U(t,"--force")){let v=vt(e,ut(t,"--baseline")),g=rs(v?null:cc(e)),p=v?[...new Set(v.styles.map(d=>d.path))].sort():[];kt(N.join(e.repoDir,pt),os(p.length?p:g)),o.push(`wrote ${pt}`)}else o.push(`kept ${pt} (exists; --force replaces it)`);let c=s?ls(r(".gitignore")):as(r(".gitignore"));c.changed&&(kt(N.join(e.repoDir,".gitignore"),c.text),o.push("wrote .gitignore"));let u=_e(N.join(e.repoDir,".husky")),f=["lefthook.yml","lefthook.yaml",".lefthook.yml"].some(v=>_e(N.join(e.repoDir,v))),m=Nr(e),y=u?".husky/pre-commit":m?`${m}/pre-commit`:null,$=y?N.resolve(e.repoDir,y):null,C=$?we($):null;if(s){if($&&C!==null){let v=ps(C);v.changed&&v.text===""?(En($,{force:!0}),o.push(`removed ${y}`)):v.changed&&(kt($,v.text),o.push(`edited ${y}`))}}else{let v=cs({husky:u,lefthook:f,hookText:C,gitHooksDir:m},n);if(v.kind==="print")o.push(`pre-commit ${v.reason}:
|
|
109
|
+
${v.snippet}`);else if(v.changed&&$){if(kt($,v.text),v.kind==="git")try{ec($,493)}catch{}o.push(`wrote ${y}${v.kind==="git"?" (local only; not shared through git)":""}`)}else o.push(`unchanged ${y}`)}return process.stdout.write(`${o.join(`
|
|
79
110
|
`)}
|
|
80
111
|
`),s||process.stdout.write(`
|
|
81
112
|
Commit the .cursor/ files so teammates get the same guardrails. Tokens never go in the repository.
|
|
82
|
-
`),0}function
|
|
83
|
-
`),2;process.stdout.write(`${JSON.stringify(
|
|
84
|
-
`)}catch(r){process.stderr.write(`gruum hook ${
|
|
113
|
+
`),0}function cc(t){try{return ke(t)}catch{return null}}async function uc(){if(process.stdin.isTTY)return{};let t=[];for await(let e of process.stdin)t.push(e);try{let e=JSON.parse(Buffer.concat(t).toString("utf8")||"{}");return e&&typeof e=="object"?e:{}}catch{return{}}}function pc(t){let e=t.workspace_roots,n=Array.isArray(e)&&typeof e[0]=="string"&&_e(e[0])?e[0]:typeof t.cwd=="string"&&_e(t.cwd)?t.cwd:process.cwd();return Dt({positional:[],flags:new Map},n)}async function fc(t){let e=t.positional[1],n=await uc(),s=e==="before-shell"?{permission:"allow"}:{};try{let r=pc(n),o=Sn(r),i={...o.hooks,exceptions:!0},a=vt(r),l=$e(r),c=Ce(r),u=s;if(e==="after-file-edit"){let f=typeof n.file_path=="string"?n.file_path:"",m=ze(N.relative(r.repoDir,N.resolve(r.repoDir,f)).split(N.sep).join("/"),r.root);a&&m!==null&&ms(m)&&Kt(r,l,xt(r,a))}else if(e==="stop"){if(a){let f=Kt(r,l,xt(r,a)),m=Xn(f,n,i,c);Cn(r,m.ledger),u=m.output}}else if(e==="before-shell"){let f=typeof n.command=="string"?n.command:"",m=Te(f).some(y=>o.hooks.denyGit.includes(y));if(a&&m){let y=Kt(r,l,xt(r,a));u=Yn(y,n,i,c)}}else return process.stderr.write(`gruum: unknown hook ${String(e)}
|
|
114
|
+
`),2;process.stdout.write(`${JSON.stringify(u)}
|
|
115
|
+
`)}catch(r){process.stderr.write(`gruum hook ${e}: ${r instanceof Error?r.message:String(r)}
|
|
85
116
|
`),process.stdout.write(`${JSON.stringify(s)}
|
|
86
|
-
`)}return 0}async function
|
|
87
|
-
`);continue}let a=await
|
|
88
|
-
`)}return 0}async function
|
|
89
|
-
`),0;switch(n){case"check":return
|
|
117
|
+
`)}return 0}async function dc(t){let e=Dt(t),n=fs({spec:async()=>{let o=vt(e,ut(t,"--baseline"));return o?{text:JSON.stringify(Oe(o),null,2)}:{text:Re,isError:!0}},check:async o=>{let i=vt(e,ut(t,"--baseline"));if(!i)return{text:Re,isError:!0};let a=xt(e,i);Kt(e,$e(e),a);let l=Le(a.items,o);return{text:JSON.stringify({baselineVersion:i.version,blocking:Pt(l,Ce(e)).length,items:l},null,2)}},request:async(o,i)=>{await Ae(e,!1);let a=vt(e);if(!a)return{text:Re,isError:!0};let c=xt(e,a).items.find(f=>f.id===o);if(!c)return{text:`No drift item ${o}. Run gruum_check_buttons and use an id from that list.`,isError:!0};let u=await Xr(e,c,i);return{text:u.text,isError:!u.ok}},status:async o=>{let i=await Yr(e,o);return{text:i.text,isError:!i.ok}}}),s={name:"gruum",version:In},r=nc({input:process.stdin,crlfDelay:1/0});for await(let o of r){if(!o.trim())continue;let i;try{i=JSON.parse(o)}catch{process.stdout.write(`${JSON.stringify({jsonrpc:"2.0",id:null,error:{code:-32700,message:"Parse error"}})}
|
|
118
|
+
`);continue}let a=await ds(i,n,s);a&&process.stdout.write(`${JSON.stringify(a)}
|
|
119
|
+
`)}return 0}async function gc(t){let e=rc(t),n=e.positional[0];if(U(e,"--version"))return process.stdout.write(`${In}
|
|
120
|
+
`),0;switch(n){case"login":return Hr();case"check":return oc(e);case"spec":return ic(e);case"baseline":return ac(e);case"init":return lc(e);case"hook":return fc(e);case"mcp":return dc(e);case void 0:case"help":return process.stdout.write(qr),0;default:return process.stderr.write(`gruum: unknown command ${n}
|
|
90
121
|
|
|
91
|
-
${
|
|
122
|
+
${qr}`),2}}gc(process.argv.slice(2)).then(t=>{process.exitCode=t},t=>{process.stderr.write(`gruum: ${t instanceof Error?t.message:String(t)}
|
|
92
123
|
`),process.exitCode=1});
|