youiyoux 0.1.13 → 0.1.15

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.
Files changed (77) hide show
  1. package/dist/chunks/{chunk-ZWVWENSB.js → chunk-A2IZOTJG.js} +1 -1
  2. package/dist/chunks/{chunk-5I2VHSEN.js → chunk-ALQVHSF2.js} +1 -1
  3. package/dist/chunks/{chunk-DX2NKY2M.js → chunk-CZJFEND6.js} +4 -4
  4. package/dist/chunks/{chunk-ZOQW6LNH.js → chunk-DAGYR4NV.js} +450 -30
  5. package/dist/chunks/{chunk-N5Z5A637.js → chunk-FTL53MU3.js} +2 -2
  6. package/dist/chunks/{chunk-PCLXMWZ2.js → chunk-HII2I2PI.js} +3 -3
  7. package/dist/chunks/{chunk-XOXF2ILO.js → chunk-HIXGUALJ.js} +1 -1
  8. package/dist/chunks/{chunk-PWGZRP3C.js → chunk-MIUG2Z43.js} +180 -8
  9. package/dist/chunks/chunk-QEUZDGIF.js +110 -0
  10. package/dist/chunks/{chunk-NF4OJYKC.js → chunk-S7UN5KQK.js} +1 -1
  11. package/dist/chunks/{chunk-EV62TUDV.js → chunk-T4EHV4XY.js} +230 -288
  12. package/dist/chunks/ingest-R2TM3QBM.js +52 -0
  13. package/dist/chunks/{src-IKDQ2BZO.js → src-4BOFDAZD.js} +1 -1
  14. package/dist/chunks/{src-4QOHR5GC.js → src-6JO73FOS.js} +3 -3
  15. package/dist/chunks/{src-PBM76LFQ.js → src-7SHBAJEO.js} +2 -2
  16. package/dist/chunks/{src-R7JGKOYI.js → src-CCGTRT5J.js} +18 -4
  17. package/dist/chunks/{src-E6ZPFKPR.js → src-IMWXYWQK.js} +23 -3
  18. package/dist/chunks/{src-624TVB6T.js → src-LUPO3O76.js} +2 -2
  19. package/dist/chunks/{src-HVYMF4S2.js → src-OHHZY3TA.js} +7 -7
  20. package/dist/chunks/{src-YC64NNQ3.js → src-WMGLZKYK.js} +2 -2
  21. package/dist/hub/assets/{CandidatePanel-DfntneYT.js → CandidatePanel-BbE2xCN2.js} +1 -1
  22. package/dist/hub/assets/CatalogScreen-CBlaW1-N.js +1 -0
  23. package/dist/hub/assets/ChangesScreen-WaA9Y7zq.js +1 -0
  24. package/dist/hub/assets/{CheatSheet-B1dXTYTW.js → CheatSheet-CGfTS7zw.js} +1 -1
  25. package/dist/hub/assets/{CommandPalette-LBZHJ659.js → CommandPalette-D4WigyuD.js} +1 -1
  26. package/dist/hub/assets/{DiscoverScreen-Yd3gVUG4.js → DiscoverScreen-CVtcQCM4.js} +2 -2
  27. package/dist/hub/assets/DraftEditor-Mp1bT8-o.js +5 -0
  28. package/dist/hub/assets/{GapsScreen-DPYGlNnA.js → GapsScreen-DzB0TfH3.js} +1 -1
  29. package/dist/hub/assets/{HomeScreen-BCPPk7mz.js → HomeScreen-BVxjYDtc.js} +1 -1
  30. package/dist/hub/assets/InventoryScreen-D33_YchG.js +1 -0
  31. package/dist/hub/assets/{LibraryScreen-BVXhOVPU.js → LibraryScreen-B8lAJBGW.js} +1 -1
  32. package/dist/hub/assets/{Opened-CJyMbxqV.js → Opened-DgNa-hGA.js} +1 -1
  33. package/dist/hub/assets/{OrgApp-Dxs_7CxZ.js → OrgApp-Q8YNFE-z.js} +1 -1
  34. package/dist/hub/assets/{Preview-DWFP0BIe.js → Preview-yu3LaZKL.js} +1 -1
  35. package/dist/hub/assets/{RuleDetail-C2fTlLJL.js → RuleDetail-BqVdc20s.js} +1 -1
  36. package/dist/hub/assets/{RulesScreen-BABeAGJg.js → RulesScreen-mb3OUlOB.js} +1 -1
  37. package/dist/hub/assets/{ScreenImage-CyhKm_nj.js → ScreenImage-DUMSgBJL.js} +1 -1
  38. package/dist/hub/assets/{ScreensScreen-8Ih8byGy.js → ScreensScreen-DjN5mwSP.js} +1 -1
  39. package/dist/hub/assets/{SearchField-hF-6-YDM.js → SearchField-ByftoJws.js} +1 -1
  40. package/dist/hub/assets/{Segmented-Dzi1x49S.js → Segmented-CTMaLPgh.js} +1 -1
  41. package/dist/hub/assets/{ServiceDown-S4ya0Cob.js → ServiceDown-BghtjpTn.js} +1 -1
  42. package/dist/hub/assets/{SpecimenCapture-e_pgT4Sp.js → SpecimenCapture-CglZ4bn-.js} +1 -1
  43. package/dist/hub/assets/{Specimens-D_9hjlJH.js → Specimens-D5ehj5-O.js} +2 -2
  44. package/dist/hub/assets/{StackScreen-J2FQilLW.js → StackScreen-w5hCLj_R.js} +1 -1
  45. package/dist/hub/assets/{StubScreens-DAkMph3i.js → StubScreens-DfF4aAbp.js} +1 -1
  46. package/dist/hub/assets/{StyleScreen-C5WytSZU.js → StyleScreen-DKkerxmC.js} +1 -1
  47. package/dist/hub/assets/{Tabs-DU-fFRDV.js → Tabs-B1IFs-wv.js} +1 -1
  48. package/dist/hub/assets/TokenDetail-BPTZ9o6J.js +1 -0
  49. package/dist/hub/assets/TokensScreen-CKnQuVaT.js +1 -0
  50. package/dist/hub/assets/{WorkspaceScreen-CzZ16fPZ.js → WorkspaceScreen-DwjGW6eY.js} +1 -1
  51. package/dist/hub/assets/{client-Bdgr12LP.js → client-uMxZXiDl.js} +1 -1
  52. package/dist/hub/assets/{discover-va2KFuK_.js → discover-Yfb0eB14.js} +1 -1
  53. package/dist/hub/assets/{dist-CC_p8DIj.js → dist-BvRlRM3Z.js} +1 -1
  54. package/dist/hub/assets/{dist-C8tf4g8c.js → dist-CL3qgCbi.js} +1 -1
  55. package/dist/hub/assets/{dist-YTWqg5sS.js → dist-tjVfXRHc.js} +1 -1
  56. package/dist/hub/assets/{family-tiles-qaK1-_c8.js → family-tiles-dZqjsxro.js} +1 -1
  57. package/dist/hub/assets/link-2-dzvhLwTC.js +1 -0
  58. package/dist/hub/assets/main-DNLr0KzQ.css +2 -0
  59. package/dist/hub/assets/main-Djqho539.js +2 -0
  60. package/dist/hub/assets/{try-live-Iys3nCBG.js → try-live-Dxsjf62v.js} +1 -1
  61. package/dist/hub/assets/{workflow-C53UBmRZ.js → workflow-Bv814-L8.js} +1 -1
  62. package/dist/hub/index.html +2 -2
  63. package/dist/hub-previews.js +6 -6
  64. package/dist/hub-server.js +3 -3
  65. package/dist/hub-snapshot.js +1 -1
  66. package/dist/schema/youi.library.schema.json +3 -1
  67. package/dist/youi.js +8 -7
  68. package/dist/youiyoux.js +8 -7
  69. package/package.json +4 -4
  70. package/dist/hub/assets/CatalogScreen-kpFYZqX3.js +0 -1
  71. package/dist/hub/assets/ChangesScreen-Chu-Ui1B.js +0 -1
  72. package/dist/hub/assets/DraftEditor-QH9Sa_Uc.js +0 -5
  73. package/dist/hub/assets/InventoryScreen-SleB733C.js +0 -1
  74. package/dist/hub/assets/TokenDetail-CDY1xxb9.js +0 -1
  75. package/dist/hub/assets/TokensScreen-Sx4aICWk.js +0 -1
  76. package/dist/hub/assets/main-cvOFSjox.js +0 -2
  77. package/dist/hub/assets/main-pNY4iNRo.css +0 -2
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/try-live-Iys3nCBG.js","assets/react-DB-4Zxce.js","assets/jsx-runtime-D6zNwnaE.js"])))=>i.map(i=>d[i]);
2
- import{i as e,t}from"./react-DB-4Zxce.js";import{n,t as r}from"./jsx-runtime-D6zNwnaE.js";import{t as i}from"./x-MLbFVa4v.js";import{t as a}from"./clsx-DB0hHKMi.js";import{st as o}from"./main-cvOFSjox.js";import{n as s,r as c,t as l}from"./inventory-BI8QBdar.js";import{t as u}from"./esm-NPpg23M8.js";import{a as d,i as f,n as p,o as m,r as h,s as g,t as _}from"./dist-C8tf4g8c.js";var v=e(t(),1),y={type:null,lib:null,project:null,near:!1,q:``};function b(e,t){let n=new URLSearchParams(e.startsWith(`?`)?e.slice(1):e),r=n.get(`type`),i=n.get(`project`);return{type:r&&l.includes(r)?r:null,lib:n.get(`lib`)||null,project:i&&t.projects.some(e=>e.id===i)?i:null,near:n.get(`near`)===`1`,q:(n.get(`q`)??``).trim()}}function x(e){let t=new URLSearchParams;e.type&&t.set(`type`,e.type),e.lib&&t.set(`lib`,e.lib),e.project&&t.set(`project`,e.project),e.near&&t.set(`near`,`1`),e.q.trim()&&t.set(`q`,e.q.trim());let n=t.toString();return n?`?${n}`:``}function S(e){return[e.type,e.lib,e.project,e.near||null,e.q||null].filter(e=>e!==null).length}function C(e,t){return e.roles.filter(e=>!t.type||e.role===t.type).flatMap(e=>Object.entries(e.chunks).filter(([e])=>!t.project||e===t.project).map(([,e])=>e))}var w={id:`plain`,label:`Plain elements`,short:`plain`},T=`radix`,E=new Set([`@radix-ui/react-slot`,`@radix-ui/react-compose-refs`,`@radix-ui/react-primitive`]),D={button:`button`,"link-as-button":`button`,input:`input`,card:`card`,badge:`badge`,dialog:`dialog`,tabs:`tabs`},O=e=>e.slice(e.lastIndexOf(`/`)+1),k=e=>e.toLowerCase().replace(/\.[a-z]+$/,``).replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``),ee=class{kits;shadcnName;radixName;radixFiles=new Map;detectRadix;constructor(e,t=null){this.kits=new Map((e?.kits??[]).map(e=>[e.id,e]));let n=e=>t?.libraries.find(t=>t.id===e)?.name;this.shadcnName=n(`shadcn`)??`shadcn-style`,this.radixName=n(`radix`)??`Radix`;for(let t of e?.primitives??[]){if(!t.package.startsWith(`@radix-ui/`)||E.has(t.package))continue;let e=this.radixFiles.get(t.project)??new Set;for(let n of t.sites)e.add(n.file);this.radixFiles.set(t.project,e)}this.detectRadix=new Set((t?.elements??[]).filter(e=>e.library===T||e.also.includes(T)).map(e=>e.type))}primary(e){if(e===null)return w;let t=this.kits.get(e),n=t?.path??e.slice(e.indexOf(`:`)+1);if(!(t?t.kind===`class-kit`:/\.(?:s?css|less)$/.test(n)))return{id:`shadcn`,label:this.shadcnName,short:this.shadcnName};let r=t?.prefix?.replace(/-$/,``);return r?{id:`css-${k(r)}`,label:`.${r}-* CSS kit`,short:`CSS kit`}:{id:`css-${k(O(n))}`,label:`${O(n)} CSS kit`,short:`CSS kit`}}of(e,t,n){let r=this.primary(e.kit);return this.isRadix(e,t,n,r)?[r,this.radix()]:[r]}radix(){return{id:T,label:this.radixName,short:this.radixName}}isRadix(e,t,n,r){if(e.kit===null||r.id!==`shadcn`)return!1;let i=this.kits.get(e.kit)?.members.find(t=>t.name===e.tag);if(i&&this.radixFiles.get(t)?.has(i.file))return!0;let a=D[n];return a!==void 0&&this.detectRadix.has(a)}},te=(e,t)=>l.indexOf(e.role)-l.indexOf(t.role)||Number(e.id.split(`-`).at(-1))-Number(t.id.split(`-`).at(-1));function ne(e,t){let n=new Map,r=new Map,i=new Map;for(let a of e){for(let e of a.families)n.set(e.id,e);for(let e of a.looks){if(e.family===null)continue;let n=r.get(e.family)??[];n.push({...e,project:a.project}),r.set(e.family,n);let o=i.get(e.family)??new Map;t.of(e,a.project,a.role).forEach((e,t)=>{let n=o.get(e.id)??{group:e,looks:0,primary:!1};n.looks++,n.primary||=t===0,o.set(e.id,n)}),i.set(e.family,o)}}let a=[...n.values()].sort(te).map(e=>{let n=[...i.get(e.id)?.values()??[]],a=(e.sides.length>0?e.sides.map(e=>e.kit):[null]).map(e=>t.primary(e));return{family:e,primary:n.filter(e=>e.primary).sort((e,t)=>t.looks-e.looks)[0]?.group??a[0],libs:re(n.length>0?n.map(e=>e.group):a),looks:r.get(e.id)??[],uses:e.looks,projects:e.projects.length,stories:e.stories??0,authored:e.authored===!0}}),o=ae(a.map(e=>({id:e.family.id,family:e.family,kit:e.primary})));return a.map(e=>({...e,name:o.get(e.family.id)}))}function re(e){let t=new Map;for(let n of e)t.has(n.id)||t.set(n.id,n);return[...t.values()]}var ie=e=>e===null?null:`${e}px`;function ae(e){let t=[({family:{shape:e}})=>e.paddingX===null&&e.paddingY===null?null:`padding ${e.paddingY??`?`}/${e.paddingX??`?`}`,({family:{shape:e}})=>e.fontSize===null?null:`${ie(e.fontSize)} text`,({family:{shape:e}})=>e.fontWeight===null?null:`weight ${e.fontWeight}`,({kit:e})=>e.label===e.short?null:e.label,({family:e})=>e.projects.join(` + `)],n=new Map(e.map(e=>[e.id,`${c(e.family)} · ${e.kit.short}`])),r=()=>{let t=new Map;for(let r of e)o(t,n.get(r.id),r);return[...t.values()].filter(e=>e.length>1)};for(let e of r()){let r=t.find(t=>new Set(e.map(t)).size>1);for(let t of e){let e=r?.(t);n.set(t.id,e?`${n.get(t.id)} · ${e}`:n.get(t.id))}}for(let e of r())for(let t of e)n.set(t.id,`${n.get(t.id)} · ${t.id}`);return n}function oe(e,t){if(t.type&&e.family.role!==t.type||t.project&&!e.family.projects.includes(t.project)||t.lib&&!e.libs.some(e=>e.id===t.lib)||t.near&&!e.family.nearDuplicate)return!1;let n=t.q.trim().toLowerCase();if(n){let t=[...e.looks.map(e=>`${e.project}:${e.file}`),...e.family.examples.map(e=>`${e.project}:${e.file}`)];if(![e.name,e.family.id,...t].some(e=>e.toLowerCase().includes(n)))return!1}return!0}function se(e,t){return e.filter(e=>oe(e,t))}var ce=e=>e.lib!==null||e.near||e.q.trim()!==``;function le(e,t,n,r,i){let a=t=>C(e,t).every(r),o=e=>se(t,e).length,c=(t,n)=>e.roles.filter(e=>!t||e.role===t).reduce((e,t)=>e+(n?t.cells[n]?.families??0:t.families),0),l=e=>ce(n)?a(e)?o(e):null:c(e.type,e.project),u=e.roles.map(e=>({value:e.role,label:s[e.role],count:l({...n,type:e.role})})),d=e.projects.map(e=>({value:e.id,label:e.id,count:l({...n,project:e.id})})),f=a(n),p=new Map;for(let e of t)for(let t of e.libs)p.has(t.id)||p.set(t.id,t);return n.lib&&!p.has(n.lib)&&p.set(n.lib,n.lib===T?i.radix():{id:n.lib,label:n.lib,short:n.lib}),{types:u,projects:d,libs:[...p.values()].sort(de).map(e=>({value:e.id,label:e.label,count:f?o({...n,lib:e.id}):null})),near:f?o({...n,near:!0}):null,all:{type:l({...n,type:null}),project:l({...n,project:null}),lib:f?o({...n,lib:null}):null}}}var ue=[`shadcn`,T];function de(e,t){let n=e=>ue.includes(e.id)?ue.indexOf(e.id):e.id===w.id?99:2;return n(e)-n(t)||e.label.localeCompare(t.label)}function fe(e){let t=new Map;for(let n of e){let e=t.get(n.primary.id)??{group:n.primary,families:[]};e.families.push(n),t.set(n.primary.id,e)}return[...t.values()].sort((e,t)=>de(e.group,t.group))}var pe=[[`height`,`height`],[`paddingX`,`padding`],[`paddingY`,`padding`],[`radius`,`radius`],[`fontSize`,`fontSize`],[`fontWeight`,`fontWeight`]];function me(e,t,n){return pe.every(([r,i])=>{let a=e[r],o=t[r];return a===null||o===null||Math.abs(a-o)<=n[i]})}function he(e,t){let n=[];for(let r of[...e].sort((e,t)=>t.uses-e.uses)){let e=n.find(e=>e[0].family.role===r.family.role&&e.every(e=>me(e.family.shape,r.family.shape,t)));e?e.push(r):n.push([r])}return{families:e.length,estimate:n.length,folds:n.filter(e=>e.length>1).map(e=>e.map(e=>e.family.id))}}function ge(e,t=3){return e.filter(e=>e.family.nearDuplicate).sort((e,t)=>t.uses-e.uses||t.family.sides.length-e.family.sides.length).slice(0,t)}function _e(e){let t=[...e.sides].sort((e,t)=>t.looks-e.looks);return t.length>=2?[t[0],t[1]]:null}function ve(e,t,n){let r=t.filter(t=>t.project===e.project&&t.kit===e.kit),i=new Map;for(let e of r){let t=JSON.stringify(e.shape),n=i.get(t)??{shape:e.shape,n:0};n.n++,i.set(t,n)}return[...i.values()].sort((e,t)=>t.n-e.n)[0]?.shape??n}var A=(e,t=`px`)=>e===null?`?`:e===9999&&t===`px`?`pill`:`${e}${t}`;function ye(e,t){let n=e=>`${A(e.paddingY)} ${A(e.paddingX)}`;return[[`Height`,A(e.shape.height),A(t.shape.height)],[`Padding`,n(e.shape),n(t.shape)],[`Radius`,A(e.shape.radius),A(t.shape.radius)],[`Font size`,A(e.shape.fontSize),A(t.shape.fontSize)],[`Weight`,A(e.shape.fontWeight,``),A(t.shape.fontWeight,``)],[`Uses`,String(e.uses),String(t.uses)],[`Projects`,e.projects.join(`, `),t.projects.join(`, `)]].map(([e,t,n])=>({label:e,a:t,b:n,differs:t!==n}))}function be(e){let t=`${e.stories} ${e.stories===1?`story`:`stories`}`;return e.authored?`Only in Storybook · ${t}`:`${e.uses} ${e.uses===1?`use`:`uses`} · ${e.projects} ${e.projects===1?`project`:`projects`}${e.stories>0?` · ${t}`:``}`}function xe(e){let t=new Map;for(let n of[...e.family.examples,...e.family.sides.flatMap(e=>e.examples)])t.has(`${n.project}:${n.file}`)||t.set(`${n.project}:${n.file}`,n.routes);return e.looks.filter(e=>!e.story).sort((e,t)=>e.project.localeCompare(t.project)||e.file.localeCompare(t.file)||e.line-t.line||e.column-t.column).map(e=>({key:e.id,project:e.project,place:`${e.file}:${e.line}`,routes:t.get(`${e.project}:${e.file}`)??[]}))}function Se(e){return e.looks.filter(e=>e.story).sort((e,t)=>e.project.localeCompare(t.project)||e.file.localeCompare(t.file)||e.line-t.line).map(e=>({key:e.id,project:e.project,story:`${e.story.title} / ${e.story.name}`,place:`${e.file}:${e.line}`}))}var Ce=.11,we=1/3;function Te({distance:e,height:t,velocity:n}){return e<=0?!1:n>Ce||e>t*we}function Ee(e,t,n){return n<=0?50:Math.round(Math.min(100,Math.max(0,(e-t)/n*100))*10)/10}function De(e){return`inset(0 0 0 ${e}%)`}var j=r(),M=`(min-width: 768px)`;function N(){return(0,v.useSyncExternalStore)(e=>{if(typeof matchMedia!=`function`)return()=>{};let t=matchMedia(M);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)},()=>typeof matchMedia!=`function`||matchMedia(M).matches)}var Oe=80;function ke({open:e,onOpenChange:t,variant:n,title:r,description:o,children:s,footer:c,testId:l}){let u=(0,v.useRef)(null),y=(0,v.useRef)(null),[b,x]=(0,v.useState)(0),[S,C]=(0,v.useState)(!1),w=n===`sheet`,T=(0,v.useRef)(null);(0,v.useLayoutEffect)(()=>{e&&document.activeElement instanceof HTMLElement&&document.activeElement!==document.body&&(T.current=document.activeElement)},[e]);let E=e=>{!w||e.pointerType===`mouse`&&e.button!==0||e.target.closest(`button, a, input`)||(e.currentTarget.setPointerCapture?.(e.pointerId),y.current={id:e.pointerId,startY:e.clientY,samples:[{y:e.clientY,t:e.timeStamp}]},C(!1))},D=e=>{let t=y.current;t&&t.id===e.pointerId&&(t.samples=[...t.samples.filter(t=>e.timeStamp-t.t<=Oe),{y:e.clientY,t:e.timeStamp}],x(Math.max(0,e.clientY-t.startY)))},O=e=>{let n=y.current;if(!n||n.id!==e.pointerId)return;y.current=null;let r=n.samples[0],i=e.timeStamp-r.t,a=i>0?(e.clientY-r.y)/i:0;Te({distance:Math.max(0,e.clientY-n.startY),height:u.current?.offsetHeight??0,velocity:a})?t(!1):(C(!0),x(0))};return(0,j.jsx)(_,{open:e,onOpenChange:e=>(x(0),t(e)),children:(0,j.jsxs)(m,{children:[(0,j.jsx)(d,{className:`inv-scrim fixed inset-0 z-50 bg-scrim`}),(0,j.jsxs)(h,{ref:u,"data-variant":n,"data-testid":l,className:a(`inv-drawer fixed z-50 flex flex-col border-line bg-surface shadow-popover outline-none`,w?`inset-x-0 bottom-0 max-h-[88dvh] rounded-t-xl border-t`:`inset-y-0 right-0 w-[min(560px,100vw)] border-l`,S&&`inv-settle`),style:b>0||S?{transform:`translate3d(0, ${b}px, 0)`}:void 0,onTransitionEnd:()=>C(!1),onCloseAutoFocus:e=>{let t=T.current;T.current=null,t?.isConnected&&(e.preventDefault(),t.focus())},children:[(0,j.jsxs)(`div`,{className:a(`shrink-0 border-b border-line`,w&&`touch-none select-none`),onPointerDown:E,onPointerMove:D,onPointerUp:O,onPointerCancel:O,"data-testid":w?`sheet-handle`:void 0,children:[w&&(0,j.jsx)(`div`,{"aria-hidden":!0,className:`mx-auto mt-2 h-1 w-9 rounded-full bg-line-strong`}),(0,j.jsxs)(`header`,{className:`flex min-h-12 items-start gap-3 px-5 py-3`,children:[(0,j.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,j.jsx)(g,{className:`text-heading text-ink`,children:r}),o?(0,j.jsx)(f,{className:`text-small text-muted`,children:o}):(0,j.jsx)(f,{className:`sr-only`,children:`Details`})]}),(0,j.jsx)(p,{"aria-label":`Close`,className:`inv-press grid size-7 shrink-0 place-items-center rounded-md text-muted max-md:-my-2 max-md:-mr-2 max-md:size-11`,children:(0,j.jsx)(i,{className:`size-4`})})]})]}),(0,j.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:s}),c&&(0,j.jsx)(`div`,{className:`shrink-0 border-t border-line px-5 py-3`,children:c})]})]})})}var Ae=1280,P=88,je=150,F=10,I=136,Me=128,Ne=48,L=3.5,R=(0,v.createContext)(null);function z(e,t=`600px`,n=`1800px`){let r=(0,v.useContext)(R),[i,a]=(0,v.useState)(()=>typeof IntersectionObserver>`u`);return(0,v.useEffect)(()=>{let i=e.current;if(!i||typeof IntersectionObserver>`u`)return;let o=new IntersectionObserver(e=>e.some(e=>e.isIntersecting)&&a(!0),{root:r,rootMargin:t}),s=new IntersectionObserver(e=>e.every(e=>!e.isIntersecting)&&a(!1),{root:r,rootMargin:n});return o.observe(i),s.observe(i),()=>{o.disconnect(),s.disconnect()}},[e,r,t,n]),i}function B(e){let t=(0,v.useContext)(R),[n,r]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{let n=e.current;if(!n||typeof IntersectionObserver>`u`)return;let i=new IntersectionObserver(e=>r(e.some(e=>e.isIntersecting)),{root:t,rootMargin:`0px`});return i.observe(n),()=>i.disconnect()},[e,t]),n}var V=new class{limit;active=new Set;waiting=[];constructor(e=6){this.limit=e}get rendering(){return this.active.size}request(e,t){this.active.has(e)||this.waiting.some(t=>t.id===e)||(this.active.size<this.limit?(this.active.add(e),t()):this.waiting.push({id:e,grant:t}))}release(e){for(this.active.delete(e),this.waiting=this.waiting.filter(t=>t.id!==e);this.active.size<this.limit&&this.waiting.length>0;){let e=this.waiting.shift();this.active.add(e.id),e.grant()}}};function Pe(e){let[t,n]=(0,v.useState)(`waiting`),r=(0,v.useRef)(null);(0,v.useEffect)(()=>{if(!e)return;let t={};return r.current=t,V.request(t,()=>{r.current===t&&n(e=>e===`waiting`?`rendering`:e)}),()=>{r.current===t&&(r.current=null),V.release(t),n(`waiting`)}},[e]);let i=(0,v.useCallback)(()=>{let e=r.current;e!==null&&(V.release(e),n(e=>e===`rendering`?`done`:e))},[]);return{granted:e&&t!==`waiting`,rendering:e&&t===`rendering`,done:i}}var H=new class{limit;entries=new Map;clock=0;constructor(e=48){this.limit=e}get mounted(){return[...this.entries.values()].filter(e=>e.mounted).length}join(e,t,n){this.entries.set(e,{visible:t,touched:++this.clock,mounted:!1,set:n}),this.settle()}see(e,t){let n=this.entries.get(e);n&&n.visible!==t&&(n.visible=t,t&&(n.touched=++this.clock),this.settle())}leave(e){this.entries.delete(e)&&this.settle()}settle(){let e=[...this.entries.values()].sort((e,t)=>Number(t.visible)-Number(e.visible)||Number(t.mounted)-Number(e.mounted)||e.touched-t.touched),t=new Set(e.slice(0,this.limit));for(let n of e)n.mounted&&!t.has(n)&&(n.mounted=!1,n.set(!1));for(let e of t)e.mounted||(e.mounted=!0,e.set(!0))}};function U(e,t){let[n,r]=(0,v.useState)(!1),i=(0,v.useRef)(null);return(0,v.useEffect)(()=>{if(!e)return;let t={};return i.current=t,H.join(t,!1,e=>{i.current===t&&r(e)}),()=>{i.current===t&&(i.current=null),H.leave(t),r(!1)}},[e]),(0,v.useEffect)(()=>{i.current&&H.see(i.current,t)},[t,e]),e&&n}var W=e=>e.specimen!==null&&e.css!==null,G=e=>`Storybook · ${e.title} / ${e.name}`;function Fe(e){try{let t=new URL(e,typeof document>`u`?void 0:document.baseURI);return t.protocol===`http:`||t.protocol===`https:`?t.origin:t.protocol}catch{return`'self'`}}function Ie(e){let t=Fe(e);return`default-src 'none'; script-src ${t}; style-src ${t} 'unsafe-inline'; font-src ${t} data:; img-src data:; connect-src 'none'; form-action 'none'; base-uri 'none'`}function K(e,t){let n=e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`);return`<!doctype html><html lang="en"${t===`dark`?` class="dark"`:``} data-theme="${t}" style="color-scheme:${t}"><head><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="${Ie(e).replace(/"/g,`&quot;`)}"><link rel="stylesheet" href="${n}">`}function Le(e,t,n){return`${K(t,n)}</head><body><div id="youi-specimen" style="display:inline-block;margin:32px">${e}</div></body></html>`}var q=[{id:`default`,label:`Default`,className:null},{id:`hover`,label:`Hover`,className:`youi-state-hover`},{id:`focus`,label:`Focus`,className:`youi-state-focus`},{id:`pressed`,label:`Pressed`,className:`youi-state-active`},{id:`disabled`,label:`Disabled`,className:`youi-state-disabled`}],Re=`button, input, select, textarea, fieldset, optgroup, option`,ze=`${Re}, a, [role], [tabindex]`;function Be(e){if(typeof document>`u`)return e;let t=document.createElement(`template`);t.innerHTML=e;let n=t.content;for(let e of[...n.children,...n.querySelectorAll(ze)])e.matches(Re)&&e.setAttribute(`disabled`,``),e.setAttribute(`aria-disabled`,`true`),e.setAttribute(`data-disabled`,``);return t.innerHTML}function Ve(e,t,n){let r=q.map(t=>`<div class="youi-state-cell${t.className?` ${t.className}`:``}" data-youi-state="${t.id}" style="display:flex;align-items:center;justify-content:center;padding:16px;contain:layout">${t.id===`disabled`?Be(e):e}</div>`).join(``);return`${K(t,n)}</head><body><div id="youi-specimen" style="display:inline-grid;grid-auto-flow:column;grid-auto-columns:1fr;align-items:center;margin:32px">${r}</div></body></html>`}function He(e,t=!1){let n=e.getElementById(`youi-specimen`);if(!n)return null;if(t){let e=n.getBoundingClientRect();return e.width>0&&e.height>0?{x:e.left,y:e.top,width:e.width,height:e.height}:null}let r=1/0,i=1/0,a=-1/0,o=-1/0;for(let e of[n,...n.querySelectorAll(`*`)]){let t=e.getBoundingClientRect();t.width!==0&&t.height!==0&&(r=Math.min(r,t.left),i=Math.min(i,t.top),a=Math.max(a,t.right),o=Math.max(o,t.bottom))}return Number.isFinite(r)?{x:r,y:i,width:a-r,height:o-i}:null}var J=(e,t,n)=>Math.min(1,(t-20)/e.width,(n-20)/e.height);function Ue(e,t,n){let r=t||I,i=J(e,r,n),a=r/2-(e.x+e.width/2)*i,o=n/2-(e.y+e.height/2)*i;return`translate(${a.toFixed(1)}px, ${o.toFixed(1)}px) scale(${i.toFixed(4)})`}function We({srcDoc:e,scheme:t,near:n,height:r,onBlank:i,strip:o,onBackground:s}){let c=(0,v.useRef)(null),l=(0,v.useRef)(null),u=Pe(n),[d,f]=(0,v.useState)(null),[p,m]=(0,v.useState)(void 0);(0,v.useLayoutEffect)(()=>f(null),[e]);let h=()=>{let e=l.current?.contentDocument,t=c.current,n=e?He(e,o!==void 0):null;if(!t||!n){f(`translate(${F}px, ${F}px)`),u.done(),e&&!n&&e.documentElement.getBoundingClientRect().width>0&&i?.();return}let a=e.defaultView,d=[e.body,e.documentElement].map(e=>a?.getComputedStyle(e).backgroundColor).find(e=>e&&e!==`transparent`&&e!==`rgba(0, 0, 0, 0)`);m(d),s?.(d);let p=t.clientWidth||I;f(Ue(n,p,r));let h=J(n,p,r);o?.({x:p/2-n.width/2*h,width:n.width*h}),u.done()};return(0,j.jsx)(`div`,{ref:c,className:`absolute inset-0`,style:{background:p},children:u.granted&&(0,j.jsx)(`iframe`,{ref:l,title:`Specimen`,"aria-hidden":!0,tabIndex:-1,sandbox:`allow-same-origin`,srcDoc:e,onLoad:()=>{let e=l.current?.contentDocument?.fonts;e?e.ready.then(h,h):h()},"data-rendering":u.rendering||void 0,"data-placed":d!==null||void 0,className:a(`pointer-events-none absolute left-0 top-0 origin-top-left border-0 bg-transparent`,d===null&&`opacity-0`),style:{width:1280,height:480,transform:d??void 0,colorScheme:t}})})}function Y({shape:e,caption:t=`shape only`,tileHeight:n=P}){let r=e.height??(e.fontSize===null?32:Math.round(e.fontSize*1.5+2*(e.paddingY??0))),i=Math.min(1,(n-20-14)/r);return(0,j.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-1`,"data-testid":`shape-box`,children:[(0,j.jsx)(`span`,{className:`inline-flex items-center border border-dashed border-line-strong text-faint`,style:{height:r*i,paddingInline:(e.paddingX??12)*i,borderRadius:Math.min(e.radius??0,9999),fontSize:(e.fontSize??14)*i,fontWeight:e.fontWeight??void 0},children:`Aa`}),(0,j.jsx)(`span`,{className:`text-caption text-faint`,children:t})]})}var Ge=(0,v.lazy)(()=>n(()=>import(`./try-live-Iys3nCBG.js`).then(e=>e.r).then(e=>({default:e.LiveFrame})),__vite__mapDeps([0,1,2]))),X=null;function Ke(e,t){let n=X;X={id:e,end:t},n&&n.id!==e&&n.end()}function qe(e){X?.id===e&&(X=null)}function Je(e,t){let[n,r]=(0,v.useState)({status:`static`,failure:null}),i=(0,v.useRef)({}),a=(0,v.useRef)(null),o=n.status!==`static`,s=(0,v.useCallback)((e=null)=>{qe(i.current),r({status:`static`,failure:e})},[]),c=()=>{Ke(i.current,()=>r({status:`static`,failure:null})),r({status:`loading`})},l=(0,v.useCallback)(()=>r(e=>e.status===`loading`?{status:`live`}:e),[]);return(0,v.useEffect)(()=>{o&&!e&&s()},[o,e,s]),(0,v.useEffect)(()=>{if(!o)return;let e=e=>{if(e.key!==`Escape`)return;let n=t.current?.contains(e.target)??!1;n&&(e.stopPropagation(),e.preventDefault()),s(),n&&a.current?.focus()};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[o,s,t]),(0,v.useEffect)(()=>()=>qe(i.current),[]),{state:n,start:c,ready:l,end:s,button:a}}function Z({tile:e,scheme:t,size:n=`small`,as:r=`li`,caption:i=!0,onBlank:a,tryIt:o=!1,backdrop:s}){let c=(0,v.useRef)(null),l=z(c),u=B(c),d=W(e),f=U(d&&l,u),p=n===`stage`?je:n===`large`?136:P,m=o&&d&&e.specimen.kind===`component`&&(!!e.specimenId||!!e.script),{state:h,start:g,ready:_,end:y,button:b}=Je(l,c),[x,S]=(0,v.useState)(void 0),C=d?f?(0,j.jsx)(We,{srcDoc:Le(e.specimen.html,e.css,t),scheme:t,near:l,height:p,onBlank:a,onBackground:m?S:void 0}):l?(0,j.jsx)(Y,{shape:e.shape,caption:`waiting`,tileHeight:p}):null:(0,j.jsx)(Y,{shape:e.shape,tileHeight:p}),w=e.story?`${e.project} ${G(e.story)}`:`${e.project} ${e.place}`;return(0,j.jsxs)(r,{ref:c,className:`min-w-0 space-y-1`,"data-tile":e.key,"data-story":e.story?.id,"data-kind":d?e.specimen.kind:`shape`,"data-frame":d&&l?f?`mounted`:`waiting`:void 0,"data-live":h.status===`static`?void 0:h.status,children:[(0,j.jsxs)(`div`,{className:`relative`,children:[(0,j.jsx)(`div`,{className:`relative overflow-hidden rounded-md border border-line bg-sunken`,style:{height:p,background:s},children:m&&h.status!==`static`?(0,j.jsx)(v.Suspense,{fallback:C,children:(0,j.jsx)(Ge,{project:e.project,specimen:e.specimenId??``,script:e.script??null,html:e.specimen.html,css:e.css,scheme:t,height:p,background:x,fallback:C,onReady:_,onEnd:()=>(y(),b.current?.focus()),onFail:e=>y(e)})}):C}),m&&(0,j.jsx)(`div`,{className:`flex justify-end max-md:pt-1`,"data-try-bar":``,children:(0,j.jsx)(`button`,{ref:b,type:`button`,onClick:()=>h.status===`static`?g():(y(),b.current?.focus()),"aria-label":h.status===`static`?`Try ${w} live`:`Done trying ${w}`,"aria-busy":h.status===`loading`||void 0,className:`z-10 inline-flex h-6 items-center rounded-sm border border-line bg-surface/90 px-2 text-caption font-medium text-ink-2 shadow-raise outline-none hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-focus focus-visible:outline-solid max-md:h-11 max-md:px-3 md:absolute md:top-1 md:right-1`,"data-try":h.status===`static`?`start`:`done`,children:h.status===`static`?`Try it`:`Done`})})]}),h.status===`static`&&h.failure&&(0,j.jsx)(`p`,{role:`status`,className:`text-caption text-danger`,"data-try-failure":``,children:h.failure}),i&&(e.story?(0,j.jsx)($,{story:e.story,place:e.place}):(0,j.jsxs)(`p`,{className:`flex min-w-0 items-baseline gap-1.5 text-caption text-muted`,children:[(0,j.jsx)(`span`,{className:`shrink-0 font-medium text-ink-2`,children:e.project}),e.count>1&&(0,j.jsxs)(`span`,{className:`shrink-0 tabular`,children:[`×`,e.count]}),(0,j.jsx)(`span`,{className:`truncate font-mono`,title:e.place,children:e.place})]}))]})}function Ye({tiles:e,...t}){let[n,r]=(0,v.useState)(()=>new Set),i=e=>`${e.css}\n${e.specimen?.html}`,a=e.findIndex((t,r)=>r===e.length-1||!n.has(i(t))),o=e[a];if(!o)return null;let s=a===e.length-1;return(0,j.jsx)(Z,{...t,tile:o,onBlank:s?void 0:()=>r(e=>new Set(e).add(i(o)))},a)}var Q=112;function Xe({tile:e,scheme:t,label:n}){let r=(0,v.useRef)(null),i=z(r),o=B(r),s=W(e),c=U(s&&i,o),[l,u]=(0,v.useState)(null),d=s&&c?Ve(e.specimen.html,e.css,t):null;return(0,v.useLayoutEffect)(()=>u(null),[d]),(0,j.jsxs)(`div`,{ref:r,role:`group`,"aria-label":`${n}, in each state`,className:`min-w-0 space-y-1`,"data-strip":e.key,"data-frame":s&&i?c?`mounted`:`waiting`:void 0,children:[(0,j.jsx)(`div`,{className:`relative overflow-hidden rounded-md border border-line bg-sunken`,style:{height:Q},children:s?d?(0,j.jsx)(We,{srcDoc:d,scheme:t,near:i,height:Q,strip:u}):i?(0,j.jsx)(Y,{shape:e.shape,caption:`waiting`,tileHeight:Q}):null:(0,j.jsx)(Y,{shape:e.shape,caption:`no specimen: no states to show`,tileHeight:Q})}),s&&(0,j.jsx)(`ol`,{"aria-label":`States`,className:a(`relative h-4 text-caption text-muted`,!l&&`grid grid-cols-5 text-center`),children:q.map((e,t)=>(0,j.jsx)(`li`,{"data-state":e.id,className:a(l&&`absolute top-0 -translate-x-1/2 whitespace-nowrap`),style:l?{left:l.x+(t+.5)*l.width/q.length}:void 0,children:e.label},e.id))})]})}function $({story:e,place:t}){return(0,j.jsxs)(`p`,{className:`flex min-w-0 items-baseline gap-1.5 text-caption text-muted`,title:t,"aria-label":G(e),children:[(0,j.jsx)(`span`,{className:`shrink-0 font-medium text-accent`,children:`Storybook`}),(0,j.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-faint`,children:`·`}),(0,j.jsxs)(`span`,{className:`line-clamp-2 min-w-0 break-words`,children:[e.title,` / `,e.name]})]})}function Ze({tiles:e,scheme:t,tryIt:n=!1}){return e.length>100?(0,j.jsx)(Qe,{tiles:e,scheme:t,tryIt:n}):(0,j.jsx)(`ul`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(${I}px, 1fr))`},"aria-label":`Specimens`,children:e.map(e=>(0,j.jsx)(Z,{tile:e,scheme:t,tryIt:n},e.key))})}function Qe({tiles:e,scheme:t,tryIt:n}){let r=(0,v.useRef)(null),[i,a]=(0,v.useState)(0);(0,v.useLayoutEffect)(()=>{let e=r.current;if(!e||(a(e.clientWidth),typeof ResizeObserver>`u`))return;let t=new ResizeObserver(()=>a(e.clientWidth));return t.observe(e),()=>t.disconnect()},[]);let o=Math.max(1,Math.floor((i||544)/I)),s=Math.ceil(e.length/o),c=N(),l=Me+(n&&!c?Ne:0),d=u({count:s,getScrollElement:()=>r.current,estimateSize:()=>l,overscan:2,initialRect:{width:o*I,height:l*L}});return(0,v.useLayoutEffect)(()=>d.measure(),[d,l]),(0,j.jsx)(R.Provider,{value:r.current,children:(0,j.jsx)(`div`,{ref:r,className:`overflow-y-auto rounded-md border border-line p-2`,style:{height:l*L},"data-testid":`virtual-tiles`,children:(0,j.jsx)(`div`,{className:`relative`,style:{height:d.getTotalSize()},children:d.getVirtualItems().map(r=>(0,j.jsx)(`ul`,{className:`absolute inset-x-0 grid gap-2`,style:{top:r.start,height:l,gridTemplateColumns:`repeat(${o}, minmax(0, 1fr))`},"aria-label":`Specimens, row ${r.index+1} of ${s}`,children:e.slice(r.index*o,(r.index+1)*o).map(e=>(0,j.jsx)(Z,{tile:e,scheme:t,tryIt:n},e.key))},r.key))})})})}export{Ee as A,le as C,C as D,fe as E,ge as M,xe as N,b as O,be as P,ne as S,x as T,S as _,Xe as a,_e as b,K as c,G as d,z as f,y as g,ee as h,Z as i,Se as j,ve as k,Ue as l,N as m,Ye as n,$ as o,ke as p,R as r,Ze as s,Ae as t,W as u,ye as v,se as w,he as x,De as y};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/try-live-Dxsjf62v.js","assets/react-DB-4Zxce.js","assets/jsx-runtime-D6zNwnaE.js"])))=>i.map(i=>d[i]);
2
+ import{i as e,t}from"./react-DB-4Zxce.js";import{n,t as r}from"./jsx-runtime-D6zNwnaE.js";import{t as i}from"./x-MLbFVa4v.js";import{t as a}from"./clsx-DB0hHKMi.js";import{st as o}from"./main-Djqho539.js";import{n as s,r as c,t as l}from"./inventory-BI8QBdar.js";import{t as u}from"./esm-NPpg23M8.js";import{a as d,i as f,n as p,o as m,r as h,s as g,t as _}from"./dist-CL3qgCbi.js";var v=e(t(),1),y={type:null,lib:null,project:null,near:!1,q:``};function b(e,t){let n=new URLSearchParams(e.startsWith(`?`)?e.slice(1):e),r=n.get(`type`),i=n.get(`project`);return{type:r&&l.includes(r)?r:null,lib:n.get(`lib`)||null,project:i&&t.projects.some(e=>e.id===i)?i:null,near:n.get(`near`)===`1`,q:(n.get(`q`)??``).trim()}}function x(e){let t=new URLSearchParams;e.type&&t.set(`type`,e.type),e.lib&&t.set(`lib`,e.lib),e.project&&t.set(`project`,e.project),e.near&&t.set(`near`,`1`),e.q.trim()&&t.set(`q`,e.q.trim());let n=t.toString();return n?`?${n}`:``}function S(e){return[e.type,e.lib,e.project,e.near||null,e.q||null].filter(e=>e!==null).length}function C(e,t){return e.roles.filter(e=>!t.type||e.role===t.type).flatMap(e=>Object.entries(e.chunks).filter(([e])=>!t.project||e===t.project).map(([,e])=>e))}var w={id:`plain`,label:`Plain elements`,short:`plain`},T=`radix`,E=new Set([`@radix-ui/react-slot`,`@radix-ui/react-compose-refs`,`@radix-ui/react-primitive`]),D={button:`button`,"link-as-button":`button`,input:`input`,card:`card`,badge:`badge`,dialog:`dialog`,tabs:`tabs`},O=e=>e.slice(e.lastIndexOf(`/`)+1),k=e=>e.toLowerCase().replace(/\.[a-z]+$/,``).replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``),ee=class{kits;shadcnName;radixName;radixFiles=new Map;detectRadix;constructor(e,t=null){this.kits=new Map((e?.kits??[]).map(e=>[e.id,e]));let n=e=>t?.libraries.find(t=>t.id===e)?.name;this.shadcnName=n(`shadcn`)??`shadcn-style`,this.radixName=n(`radix`)??`Radix`;for(let t of e?.primitives??[]){if(!t.package.startsWith(`@radix-ui/`)||E.has(t.package))continue;let e=this.radixFiles.get(t.project)??new Set;for(let n of t.sites)e.add(n.file);this.radixFiles.set(t.project,e)}this.detectRadix=new Set((t?.elements??[]).filter(e=>e.library===T||e.also.includes(T)).map(e=>e.type))}primary(e){if(e===null)return w;let t=this.kits.get(e),n=t?.path??e.slice(e.indexOf(`:`)+1);if(!(t?t.kind===`class-kit`:/\.(?:s?css|less)$/.test(n)))return{id:`shadcn`,label:this.shadcnName,short:this.shadcnName};let r=t?.prefix?.replace(/-$/,``);return r?{id:`css-${k(r)}`,label:`.${r}-* CSS kit`,short:`CSS kit`}:{id:`css-${k(O(n))}`,label:`${O(n)} CSS kit`,short:`CSS kit`}}of(e,t,n){let r=this.primary(e.kit);return this.isRadix(e,t,n,r)?[r,this.radix()]:[r]}radix(){return{id:T,label:this.radixName,short:this.radixName}}isRadix(e,t,n,r){if(e.kit===null||r.id!==`shadcn`)return!1;let i=this.kits.get(e.kit)?.members.find(t=>t.name===e.tag);if(i&&this.radixFiles.get(t)?.has(i.file))return!0;let a=D[n];return a!==void 0&&this.detectRadix.has(a)}},te=(e,t)=>l.indexOf(e.role)-l.indexOf(t.role)||Number(e.id.split(`-`).at(-1))-Number(t.id.split(`-`).at(-1));function ne(e,t){let n=new Map,r=new Map,i=new Map;for(let a of e){for(let e of a.families)n.set(e.id,e);for(let e of a.looks){if(e.family===null)continue;let n=r.get(e.family)??[];n.push({...e,project:a.project}),r.set(e.family,n);let o=i.get(e.family)??new Map;t.of(e,a.project,a.role).forEach((e,t)=>{let n=o.get(e.id)??{group:e,looks:0,primary:!1};n.looks++,n.primary||=t===0,o.set(e.id,n)}),i.set(e.family,o)}}let a=[...n.values()].sort(te).map(e=>{let n=[...i.get(e.id)?.values()??[]],a=(e.sides.length>0?e.sides.map(e=>e.kit):[null]).map(e=>t.primary(e));return{family:e,primary:n.filter(e=>e.primary).sort((e,t)=>t.looks-e.looks)[0]?.group??a[0],libs:re(n.length>0?n.map(e=>e.group):a),looks:r.get(e.id)??[],uses:e.looks,projects:e.projects.length,stories:e.stories??0,authored:e.authored===!0}}),o=ae(a.map(e=>({id:e.family.id,family:e.family,kit:e.primary})));return a.map(e=>({...e,name:o.get(e.family.id)}))}function re(e){let t=new Map;for(let n of e)t.has(n.id)||t.set(n.id,n);return[...t.values()]}var ie=e=>e===null?null:`${e}px`;function ae(e){let t=[({family:{shape:e}})=>e.paddingX===null&&e.paddingY===null?null:`padding ${e.paddingY??`?`}/${e.paddingX??`?`}`,({family:{shape:e}})=>e.fontSize===null?null:`${ie(e.fontSize)} text`,({family:{shape:e}})=>e.fontWeight===null?null:`weight ${e.fontWeight}`,({kit:e})=>e.label===e.short?null:e.label,({family:e})=>e.projects.join(` + `)],n=new Map(e.map(e=>[e.id,`${c(e.family)} · ${e.kit.short}`])),r=()=>{let t=new Map;for(let r of e)o(t,n.get(r.id),r);return[...t.values()].filter(e=>e.length>1)};for(let e of r()){let r=t.find(t=>new Set(e.map(t)).size>1);for(let t of e){let e=r?.(t);n.set(t.id,e?`${n.get(t.id)} · ${e}`:n.get(t.id))}}for(let e of r())for(let t of e)n.set(t.id,`${n.get(t.id)} · ${t.id}`);return n}function oe(e,t){if(t.type&&e.family.role!==t.type||t.project&&!e.family.projects.includes(t.project)||t.lib&&!e.libs.some(e=>e.id===t.lib)||t.near&&!e.family.nearDuplicate)return!1;let n=t.q.trim().toLowerCase();if(n){let t=[...e.looks.map(e=>`${e.project}:${e.file}`),...e.family.examples.map(e=>`${e.project}:${e.file}`)];if(![e.name,e.family.id,...t].some(e=>e.toLowerCase().includes(n)))return!1}return!0}function se(e,t){return e.filter(e=>oe(e,t))}var ce=e=>e.lib!==null||e.near||e.q.trim()!==``;function le(e,t,n,r,i){let a=t=>C(e,t).every(r),o=e=>se(t,e).length,c=(t,n)=>e.roles.filter(e=>!t||e.role===t).reduce((e,t)=>e+(n?t.cells[n]?.families??0:t.families),0),l=e=>ce(n)?a(e)?o(e):null:c(e.type,e.project),u=e.roles.map(e=>({value:e.role,label:s[e.role],count:l({...n,type:e.role})})),d=e.projects.map(e=>({value:e.id,label:e.id,count:l({...n,project:e.id})})),f=a(n),p=new Map;for(let e of t)for(let t of e.libs)p.has(t.id)||p.set(t.id,t);return n.lib&&!p.has(n.lib)&&p.set(n.lib,n.lib===T?i.radix():{id:n.lib,label:n.lib,short:n.lib}),{types:u,projects:d,libs:[...p.values()].sort(de).map(e=>({value:e.id,label:e.label,count:f?o({...n,lib:e.id}):null})),near:f?o({...n,near:!0}):null,all:{type:l({...n,type:null}),project:l({...n,project:null}),lib:f?o({...n,lib:null}):null}}}var ue=[`shadcn`,T];function de(e,t){let n=e=>ue.includes(e.id)?ue.indexOf(e.id):e.id===w.id?99:2;return n(e)-n(t)||e.label.localeCompare(t.label)}function fe(e){let t=new Map;for(let n of e){let e=t.get(n.primary.id)??{group:n.primary,families:[]};e.families.push(n),t.set(n.primary.id,e)}return[...t.values()].sort((e,t)=>de(e.group,t.group))}var pe=[[`height`,`height`],[`paddingX`,`padding`],[`paddingY`,`padding`],[`radius`,`radius`],[`fontSize`,`fontSize`],[`fontWeight`,`fontWeight`]];function me(e,t,n){return pe.every(([r,i])=>{let a=e[r],o=t[r];return a===null||o===null||Math.abs(a-o)<=n[i]})}function he(e,t){let n=[];for(let r of[...e].sort((e,t)=>t.uses-e.uses)){let e=n.find(e=>e[0].family.role===r.family.role&&e.every(e=>me(e.family.shape,r.family.shape,t)));e?e.push(r):n.push([r])}return{families:e.length,estimate:n.length,folds:n.filter(e=>e.length>1).map(e=>e.map(e=>e.family.id))}}function ge(e,t=3){return e.filter(e=>e.family.nearDuplicate).sort((e,t)=>t.uses-e.uses||t.family.sides.length-e.family.sides.length).slice(0,t)}function _e(e){let t=[...e.sides].sort((e,t)=>t.looks-e.looks);return t.length>=2?[t[0],t[1]]:null}function ve(e,t,n){let r=t.filter(t=>t.project===e.project&&t.kit===e.kit),i=new Map;for(let e of r){let t=JSON.stringify(e.shape),n=i.get(t)??{shape:e.shape,n:0};n.n++,i.set(t,n)}return[...i.values()].sort((e,t)=>t.n-e.n)[0]?.shape??n}var A=(e,t=`px`)=>e===null?`?`:e===9999&&t===`px`?`pill`:`${e}${t}`;function ye(e,t){let n=e=>`${A(e.paddingY)} ${A(e.paddingX)}`;return[[`Height`,A(e.shape.height),A(t.shape.height)],[`Padding`,n(e.shape),n(t.shape)],[`Radius`,A(e.shape.radius),A(t.shape.radius)],[`Font size`,A(e.shape.fontSize),A(t.shape.fontSize)],[`Weight`,A(e.shape.fontWeight,``),A(t.shape.fontWeight,``)],[`Uses`,String(e.uses),String(t.uses)],[`Projects`,e.projects.join(`, `),t.projects.join(`, `)]].map(([e,t,n])=>({label:e,a:t,b:n,differs:t!==n}))}function be(e){let t=`${e.stories} ${e.stories===1?`story`:`stories`}`;return e.authored?`Only in Storybook · ${t}`:`${e.uses} ${e.uses===1?`use`:`uses`} · ${e.projects} ${e.projects===1?`project`:`projects`}${e.stories>0?` · ${t}`:``}`}function xe(e){let t=new Map;for(let n of[...e.family.examples,...e.family.sides.flatMap(e=>e.examples)])t.has(`${n.project}:${n.file}`)||t.set(`${n.project}:${n.file}`,n.routes);return e.looks.filter(e=>!e.story).sort((e,t)=>e.project.localeCompare(t.project)||e.file.localeCompare(t.file)||e.line-t.line||e.column-t.column).map(e=>({key:e.id,project:e.project,place:`${e.file}:${e.line}`,routes:t.get(`${e.project}:${e.file}`)??[]}))}function Se(e){return e.looks.filter(e=>e.story).sort((e,t)=>e.project.localeCompare(t.project)||e.file.localeCompare(t.file)||e.line-t.line).map(e=>({key:e.id,project:e.project,story:`${e.story.title} / ${e.story.name}`,place:`${e.file}:${e.line}`}))}var Ce=.11,we=1/3;function Te({distance:e,height:t,velocity:n}){return e<=0?!1:n>Ce||e>t*we}function Ee(e,t,n){return n<=0?50:Math.round(Math.min(100,Math.max(0,(e-t)/n*100))*10)/10}function De(e){return`inset(0 0 0 ${e}%)`}var j=r(),M=`(min-width: 768px)`;function N(){return(0,v.useSyncExternalStore)(e=>{if(typeof matchMedia!=`function`)return()=>{};let t=matchMedia(M);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)},()=>typeof matchMedia!=`function`||matchMedia(M).matches)}var Oe=80;function ke({open:e,onOpenChange:t,variant:n,title:r,description:o,children:s,footer:c,testId:l}){let u=(0,v.useRef)(null),y=(0,v.useRef)(null),[b,x]=(0,v.useState)(0),[S,C]=(0,v.useState)(!1),w=n===`sheet`,T=(0,v.useRef)(null);(0,v.useLayoutEffect)(()=>{e&&document.activeElement instanceof HTMLElement&&document.activeElement!==document.body&&(T.current=document.activeElement)},[e]);let E=e=>{!w||e.pointerType===`mouse`&&e.button!==0||e.target.closest(`button, a, input`)||(e.currentTarget.setPointerCapture?.(e.pointerId),y.current={id:e.pointerId,startY:e.clientY,samples:[{y:e.clientY,t:e.timeStamp}]},C(!1))},D=e=>{let t=y.current;t&&t.id===e.pointerId&&(t.samples=[...t.samples.filter(t=>e.timeStamp-t.t<=Oe),{y:e.clientY,t:e.timeStamp}],x(Math.max(0,e.clientY-t.startY)))},O=e=>{let n=y.current;if(!n||n.id!==e.pointerId)return;y.current=null;let r=n.samples[0],i=e.timeStamp-r.t,a=i>0?(e.clientY-r.y)/i:0;Te({distance:Math.max(0,e.clientY-n.startY),height:u.current?.offsetHeight??0,velocity:a})?t(!1):(C(!0),x(0))};return(0,j.jsx)(_,{open:e,onOpenChange:e=>(x(0),t(e)),children:(0,j.jsxs)(m,{children:[(0,j.jsx)(d,{className:`inv-scrim fixed inset-0 z-50 bg-scrim`}),(0,j.jsxs)(h,{ref:u,"data-variant":n,"data-testid":l,className:a(`inv-drawer fixed z-50 flex flex-col border-line bg-surface shadow-popover outline-none`,w?`inset-x-0 bottom-0 max-h-[88dvh] rounded-t-xl border-t`:`inset-y-0 right-0 w-[min(560px,100vw)] border-l`,S&&`inv-settle`),style:b>0||S?{transform:`translate3d(0, ${b}px, 0)`}:void 0,onTransitionEnd:()=>C(!1),onCloseAutoFocus:e=>{let t=T.current;T.current=null,t?.isConnected&&(e.preventDefault(),t.focus())},children:[(0,j.jsxs)(`div`,{className:a(`shrink-0 border-b border-line`,w&&`touch-none select-none`),onPointerDown:E,onPointerMove:D,onPointerUp:O,onPointerCancel:O,"data-testid":w?`sheet-handle`:void 0,children:[w&&(0,j.jsx)(`div`,{"aria-hidden":!0,className:`mx-auto mt-2 h-1 w-9 rounded-full bg-line-strong`}),(0,j.jsxs)(`header`,{className:`flex min-h-12 items-start gap-3 px-5 py-3`,children:[(0,j.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,j.jsx)(g,{className:`text-heading text-ink`,children:r}),o?(0,j.jsx)(f,{className:`text-small text-muted`,children:o}):(0,j.jsx)(f,{className:`sr-only`,children:`Details`})]}),(0,j.jsx)(p,{"aria-label":`Close`,className:`inv-press grid size-7 shrink-0 place-items-center rounded-md text-muted max-md:-my-2 max-md:-mr-2 max-md:size-11`,children:(0,j.jsx)(i,{className:`size-4`})})]})]}),(0,j.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:s}),c&&(0,j.jsx)(`div`,{className:`shrink-0 border-t border-line px-5 py-3`,children:c})]})]})})}var Ae=1280,P=88,je=150,F=10,I=136,Me=128,Ne=48,L=3.5,R=(0,v.createContext)(null);function z(e,t=`600px`,n=`1800px`){let r=(0,v.useContext)(R),[i,a]=(0,v.useState)(()=>typeof IntersectionObserver>`u`);return(0,v.useEffect)(()=>{let i=e.current;if(!i||typeof IntersectionObserver>`u`)return;let o=new IntersectionObserver(e=>e.some(e=>e.isIntersecting)&&a(!0),{root:r,rootMargin:t}),s=new IntersectionObserver(e=>e.every(e=>!e.isIntersecting)&&a(!1),{root:r,rootMargin:n});return o.observe(i),s.observe(i),()=>{o.disconnect(),s.disconnect()}},[e,r,t,n]),i}function B(e){let t=(0,v.useContext)(R),[n,r]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{let n=e.current;if(!n||typeof IntersectionObserver>`u`)return;let i=new IntersectionObserver(e=>r(e.some(e=>e.isIntersecting)),{root:t,rootMargin:`0px`});return i.observe(n),()=>i.disconnect()},[e,t]),n}var V=new class{limit;active=new Set;waiting=[];constructor(e=6){this.limit=e}get rendering(){return this.active.size}request(e,t){this.active.has(e)||this.waiting.some(t=>t.id===e)||(this.active.size<this.limit?(this.active.add(e),t()):this.waiting.push({id:e,grant:t}))}release(e){for(this.active.delete(e),this.waiting=this.waiting.filter(t=>t.id!==e);this.active.size<this.limit&&this.waiting.length>0;){let e=this.waiting.shift();this.active.add(e.id),e.grant()}}};function Pe(e){let[t,n]=(0,v.useState)(`waiting`),r=(0,v.useRef)(null);(0,v.useEffect)(()=>{if(!e)return;let t={};return r.current=t,V.request(t,()=>{r.current===t&&n(e=>e===`waiting`?`rendering`:e)}),()=>{r.current===t&&(r.current=null),V.release(t),n(`waiting`)}},[e]);let i=(0,v.useCallback)(()=>{let e=r.current;e!==null&&(V.release(e),n(e=>e===`rendering`?`done`:e))},[]);return{granted:e&&t!==`waiting`,rendering:e&&t===`rendering`,done:i}}var H=new class{limit;entries=new Map;clock=0;constructor(e=48){this.limit=e}get mounted(){return[...this.entries.values()].filter(e=>e.mounted).length}join(e,t,n){this.entries.set(e,{visible:t,touched:++this.clock,mounted:!1,set:n}),this.settle()}see(e,t){let n=this.entries.get(e);n&&n.visible!==t&&(n.visible=t,t&&(n.touched=++this.clock),this.settle())}leave(e){this.entries.delete(e)&&this.settle()}settle(){let e=[...this.entries.values()].sort((e,t)=>Number(t.visible)-Number(e.visible)||Number(t.mounted)-Number(e.mounted)||e.touched-t.touched),t=new Set(e.slice(0,this.limit));for(let n of e)n.mounted&&!t.has(n)&&(n.mounted=!1,n.set(!1));for(let e of t)e.mounted||(e.mounted=!0,e.set(!0))}};function U(e,t){let[n,r]=(0,v.useState)(!1),i=(0,v.useRef)(null);return(0,v.useEffect)(()=>{if(!e)return;let t={};return i.current=t,H.join(t,!1,e=>{i.current===t&&r(e)}),()=>{i.current===t&&(i.current=null),H.leave(t),r(!1)}},[e]),(0,v.useEffect)(()=>{i.current&&H.see(i.current,t)},[t,e]),e&&n}var W=e=>e.specimen!==null&&e.css!==null,G=e=>`Storybook · ${e.title} / ${e.name}`;function Fe(e){try{let t=new URL(e,typeof document>`u`?void 0:document.baseURI);return t.protocol===`http:`||t.protocol===`https:`?t.origin:t.protocol}catch{return`'self'`}}function Ie(e){let t=Fe(e);return`default-src 'none'; script-src ${t}; style-src ${t} 'unsafe-inline'; font-src ${t} data:; img-src data:; connect-src 'none'; form-action 'none'; base-uri 'none'`}function K(e,t){let n=e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`);return`<!doctype html><html lang="en"${t===`dark`?` class="dark"`:``} data-theme="${t}" style="color-scheme:${t}"><head><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="${Ie(e).replace(/"/g,`&quot;`)}"><link rel="stylesheet" href="${n}">`}function Le(e,t,n){return`${K(t,n)}</head><body><div id="youi-specimen" style="display:inline-block;margin:32px">${e}</div></body></html>`}var q=[{id:`default`,label:`Default`,className:null},{id:`hover`,label:`Hover`,className:`youi-state-hover`},{id:`focus`,label:`Focus`,className:`youi-state-focus`},{id:`pressed`,label:`Pressed`,className:`youi-state-active`},{id:`disabled`,label:`Disabled`,className:`youi-state-disabled`}],Re=`button, input, select, textarea, fieldset, optgroup, option`,ze=`${Re}, a, [role], [tabindex]`;function Be(e){if(typeof document>`u`)return e;let t=document.createElement(`template`);t.innerHTML=e;let n=t.content;for(let e of[...n.children,...n.querySelectorAll(ze)])e.matches(Re)&&e.setAttribute(`disabled`,``),e.setAttribute(`aria-disabled`,`true`),e.setAttribute(`data-disabled`,``);return t.innerHTML}function Ve(e,t,n){let r=q.map(t=>`<div class="youi-state-cell${t.className?` ${t.className}`:``}" data-youi-state="${t.id}" style="display:flex;align-items:center;justify-content:center;padding:16px;contain:layout">${t.id===`disabled`?Be(e):e}</div>`).join(``);return`${K(t,n)}</head><body><div id="youi-specimen" style="display:inline-grid;grid-auto-flow:column;grid-auto-columns:1fr;align-items:center;margin:32px">${r}</div></body></html>`}function He(e,t=!1){let n=e.getElementById(`youi-specimen`);if(!n)return null;if(t){let e=n.getBoundingClientRect();return e.width>0&&e.height>0?{x:e.left,y:e.top,width:e.width,height:e.height}:null}let r=1/0,i=1/0,a=-1/0,o=-1/0;for(let e of[n,...n.querySelectorAll(`*`)]){let t=e.getBoundingClientRect();t.width!==0&&t.height!==0&&(r=Math.min(r,t.left),i=Math.min(i,t.top),a=Math.max(a,t.right),o=Math.max(o,t.bottom))}return Number.isFinite(r)?{x:r,y:i,width:a-r,height:o-i}:null}var J=(e,t,n)=>Math.min(1,(t-20)/e.width,(n-20)/e.height);function Ue(e,t,n){let r=t||I,i=J(e,r,n),a=r/2-(e.x+e.width/2)*i,o=n/2-(e.y+e.height/2)*i;return`translate(${a.toFixed(1)}px, ${o.toFixed(1)}px) scale(${i.toFixed(4)})`}function We({srcDoc:e,scheme:t,near:n,height:r,onBlank:i,strip:o,onBackground:s}){let c=(0,v.useRef)(null),l=(0,v.useRef)(null),u=Pe(n),[d,f]=(0,v.useState)(null),[p,m]=(0,v.useState)(void 0);(0,v.useLayoutEffect)(()=>f(null),[e]);let h=()=>{let e=l.current?.contentDocument,t=c.current,n=e?He(e,o!==void 0):null;if(!t||!n){f(`translate(${F}px, ${F}px)`),u.done(),e&&!n&&e.documentElement.getBoundingClientRect().width>0&&i?.();return}let a=e.defaultView,d=[e.body,e.documentElement].map(e=>a?.getComputedStyle(e).backgroundColor).find(e=>e&&e!==`transparent`&&e!==`rgba(0, 0, 0, 0)`);m(d),s?.(d);let p=t.clientWidth||I;f(Ue(n,p,r));let h=J(n,p,r);o?.({x:p/2-n.width/2*h,width:n.width*h}),u.done()};return(0,j.jsx)(`div`,{ref:c,className:`absolute inset-0`,style:{background:p},children:u.granted&&(0,j.jsx)(`iframe`,{ref:l,title:`Specimen`,"aria-hidden":!0,tabIndex:-1,sandbox:`allow-same-origin`,srcDoc:e,onLoad:()=>{let e=l.current?.contentDocument?.fonts;e?e.ready.then(h,h):h()},"data-rendering":u.rendering||void 0,"data-placed":d!==null||void 0,className:a(`pointer-events-none absolute left-0 top-0 origin-top-left border-0 bg-transparent`,d===null&&`opacity-0`),style:{width:1280,height:480,transform:d??void 0,colorScheme:t}})})}function Y({shape:e,caption:t=`shape only`,tileHeight:n=P}){let r=e.height??(e.fontSize===null?32:Math.round(e.fontSize*1.5+2*(e.paddingY??0))),i=Math.min(1,(n-20-14)/r);return(0,j.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-1`,"data-testid":`shape-box`,children:[(0,j.jsx)(`span`,{className:`inline-flex items-center border border-dashed border-line-strong text-faint`,style:{height:r*i,paddingInline:(e.paddingX??12)*i,borderRadius:Math.min(e.radius??0,9999),fontSize:(e.fontSize??14)*i,fontWeight:e.fontWeight??void 0},children:`Aa`}),(0,j.jsx)(`span`,{className:`text-caption text-faint`,children:t})]})}var Ge=(0,v.lazy)(()=>n(()=>import(`./try-live-Dxsjf62v.js`).then(e=>e.r).then(e=>({default:e.LiveFrame})),__vite__mapDeps([0,1,2]))),X=null;function Ke(e,t){let n=X;X={id:e,end:t},n&&n.id!==e&&n.end()}function qe(e){X?.id===e&&(X=null)}function Je(e,t){let[n,r]=(0,v.useState)({status:`static`,failure:null}),i=(0,v.useRef)({}),a=(0,v.useRef)(null),o=n.status!==`static`,s=(0,v.useCallback)((e=null)=>{qe(i.current),r({status:`static`,failure:e})},[]),c=()=>{Ke(i.current,()=>r({status:`static`,failure:null})),r({status:`loading`})},l=(0,v.useCallback)(()=>r(e=>e.status===`loading`?{status:`live`}:e),[]);return(0,v.useEffect)(()=>{o&&!e&&s()},[o,e,s]),(0,v.useEffect)(()=>{if(!o)return;let e=e=>{if(e.key!==`Escape`)return;let n=t.current?.contains(e.target)??!1;n&&(e.stopPropagation(),e.preventDefault()),s(),n&&a.current?.focus()};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[o,s,t]),(0,v.useEffect)(()=>()=>qe(i.current),[]),{state:n,start:c,ready:l,end:s,button:a}}function Z({tile:e,scheme:t,size:n=`small`,as:r=`li`,caption:i=!0,onBlank:a,tryIt:o=!1,backdrop:s}){let c=(0,v.useRef)(null),l=z(c),u=B(c),d=W(e),f=U(d&&l,u),p=n===`stage`?je:n===`large`?136:P,m=o&&d&&e.specimen.kind===`component`&&(!!e.specimenId||!!e.script),{state:h,start:g,ready:_,end:y,button:b}=Je(l,c),[x,S]=(0,v.useState)(void 0),C=d?f?(0,j.jsx)(We,{srcDoc:Le(e.specimen.html,e.css,t),scheme:t,near:l,height:p,onBlank:a,onBackground:m?S:void 0}):l?(0,j.jsx)(Y,{shape:e.shape,caption:`waiting`,tileHeight:p}):null:(0,j.jsx)(Y,{shape:e.shape,tileHeight:p}),w=e.story?`${e.project} ${G(e.story)}`:`${e.project} ${e.place}`;return(0,j.jsxs)(r,{ref:c,className:`min-w-0 space-y-1`,"data-tile":e.key,"data-story":e.story?.id,"data-kind":d?e.specimen.kind:`shape`,"data-frame":d&&l?f?`mounted`:`waiting`:void 0,"data-live":h.status===`static`?void 0:h.status,children:[(0,j.jsxs)(`div`,{className:`relative`,children:[(0,j.jsx)(`div`,{className:`relative overflow-hidden rounded-md border border-line bg-sunken`,style:{height:p,background:s},children:m&&h.status!==`static`?(0,j.jsx)(v.Suspense,{fallback:C,children:(0,j.jsx)(Ge,{project:e.project,specimen:e.specimenId??``,script:e.script??null,html:e.specimen.html,css:e.css,scheme:t,height:p,background:x,fallback:C,onReady:_,onEnd:()=>(y(),b.current?.focus()),onFail:e=>y(e)})}):C}),m&&(0,j.jsx)(`div`,{className:`flex justify-end max-md:pt-1`,"data-try-bar":``,children:(0,j.jsx)(`button`,{ref:b,type:`button`,onClick:()=>h.status===`static`?g():(y(),b.current?.focus()),"aria-label":h.status===`static`?`Try ${w} live`:`Done trying ${w}`,"aria-busy":h.status===`loading`||void 0,className:`z-10 inline-flex h-6 items-center rounded-sm border border-line bg-surface/90 px-2 text-caption font-medium text-ink-2 shadow-raise outline-none hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-focus focus-visible:outline-solid max-md:h-11 max-md:px-3 md:absolute md:top-1 md:right-1`,"data-try":h.status===`static`?`start`:`done`,children:h.status===`static`?`Try it`:`Done`})})]}),h.status===`static`&&h.failure&&(0,j.jsx)(`p`,{role:`status`,className:`text-caption text-danger`,"data-try-failure":``,children:h.failure}),i&&(e.story?(0,j.jsx)($,{story:e.story,place:e.place}):(0,j.jsxs)(`p`,{className:`flex min-w-0 items-baseline gap-1.5 text-caption text-muted`,children:[(0,j.jsx)(`span`,{className:`shrink-0 font-medium text-ink-2`,children:e.project}),e.count>1&&(0,j.jsxs)(`span`,{className:`shrink-0 tabular`,children:[`×`,e.count]}),(0,j.jsx)(`span`,{className:`truncate font-mono`,title:e.place,children:e.place})]}))]})}function Ye({tiles:e,...t}){let[n,r]=(0,v.useState)(()=>new Set),i=e=>`${e.css}\n${e.specimen?.html}`,a=e.findIndex((t,r)=>r===e.length-1||!n.has(i(t))),o=e[a];if(!o)return null;let s=a===e.length-1;return(0,j.jsx)(Z,{...t,tile:o,onBlank:s?void 0:()=>r(e=>new Set(e).add(i(o)))},a)}var Q=112;function Xe({tile:e,scheme:t,label:n}){let r=(0,v.useRef)(null),i=z(r),o=B(r),s=W(e),c=U(s&&i,o),[l,u]=(0,v.useState)(null),d=s&&c?Ve(e.specimen.html,e.css,t):null;return(0,v.useLayoutEffect)(()=>u(null),[d]),(0,j.jsxs)(`div`,{ref:r,role:`group`,"aria-label":`${n}, in each state`,className:`min-w-0 space-y-1`,"data-strip":e.key,"data-frame":s&&i?c?`mounted`:`waiting`:void 0,children:[(0,j.jsx)(`div`,{className:`relative overflow-hidden rounded-md border border-line bg-sunken`,style:{height:Q},children:s?d?(0,j.jsx)(We,{srcDoc:d,scheme:t,near:i,height:Q,strip:u}):i?(0,j.jsx)(Y,{shape:e.shape,caption:`waiting`,tileHeight:Q}):null:(0,j.jsx)(Y,{shape:e.shape,caption:`no specimen: no states to show`,tileHeight:Q})}),s&&(0,j.jsx)(`ol`,{"aria-label":`States`,className:a(`relative h-4 text-caption text-muted`,!l&&`grid grid-cols-5 text-center`),children:q.map((e,t)=>(0,j.jsx)(`li`,{"data-state":e.id,className:a(l&&`absolute top-0 -translate-x-1/2 whitespace-nowrap`),style:l?{left:l.x+(t+.5)*l.width/q.length}:void 0,children:e.label},e.id))})]})}function $({story:e,place:t}){return(0,j.jsxs)(`p`,{className:`flex min-w-0 items-baseline gap-1.5 text-caption text-muted`,title:t,"aria-label":G(e),children:[(0,j.jsx)(`span`,{className:`shrink-0 font-medium text-accent`,children:`Storybook`}),(0,j.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-faint`,children:`·`}),(0,j.jsxs)(`span`,{className:`line-clamp-2 min-w-0 break-words`,children:[e.title,` / `,e.name]})]})}function Ze({tiles:e,scheme:t,tryIt:n=!1}){return e.length>100?(0,j.jsx)(Qe,{tiles:e,scheme:t,tryIt:n}):(0,j.jsx)(`ul`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(${I}px, 1fr))`},"aria-label":`Specimens`,children:e.map(e=>(0,j.jsx)(Z,{tile:e,scheme:t,tryIt:n},e.key))})}function Qe({tiles:e,scheme:t,tryIt:n}){let r=(0,v.useRef)(null),[i,a]=(0,v.useState)(0);(0,v.useLayoutEffect)(()=>{let e=r.current;if(!e||(a(e.clientWidth),typeof ResizeObserver>`u`))return;let t=new ResizeObserver(()=>a(e.clientWidth));return t.observe(e),()=>t.disconnect()},[]);let o=Math.max(1,Math.floor((i||544)/I)),s=Math.ceil(e.length/o),c=N(),l=Me+(n&&!c?Ne:0),d=u({count:s,getScrollElement:()=>r.current,estimateSize:()=>l,overscan:2,initialRect:{width:o*I,height:l*L}});return(0,v.useLayoutEffect)(()=>d.measure(),[d,l]),(0,j.jsx)(R.Provider,{value:r.current,children:(0,j.jsx)(`div`,{ref:r,className:`overflow-y-auto rounded-md border border-line p-2`,style:{height:l*L},"data-testid":`virtual-tiles`,children:(0,j.jsx)(`div`,{className:`relative`,style:{height:d.getTotalSize()},children:d.getVirtualItems().map(r=>(0,j.jsx)(`ul`,{className:`absolute inset-x-0 grid gap-2`,style:{top:r.start,height:l,gridTemplateColumns:`repeat(${o}, minmax(0, 1fr))`},"aria-label":`Specimens, row ${r.index+1} of ${s}`,children:e.slice(r.index*o,(r.index+1)*o).map(e=>(0,j.jsx)(Z,{tile:e,scheme:t,tryIt:n},e.key))},r.key))})})})}export{Ee as A,le as C,C as D,fe as E,ge as M,xe as N,b as O,be as P,ne as S,x as T,S as _,Xe as a,_e as b,K as c,G as d,z as f,y as g,ee as h,Z as i,Se as j,ve as k,Ue as l,N as m,Ye as n,$ as o,ke as p,R as r,Ze as s,Ae as t,W as u,ye as v,se as w,he as x,De as y};
@@ -1 +1 @@
1
- import{i as e,t}from"./react-DB-4Zxce.js";import{t as n}from"./jsx-runtime-D6zNwnaE.js";import{t as r}from"./createLucideIcon-CGDJWtKO.js";import{t as i}from"./download-BQI-Si9R.js";import{t as a}from"./layers-DfzdK_wG.js";import{t as o}from"./x-MLbFVa4v.js";import{t as s}from"./clsx-DB0hHKMi.js";import{P as c,ct as l,i as u,n as d,o as f,s as p,z as m}from"./main-cvOFSjox.js";import{t as h}from"./Badge-CUJUit4d.js";import{n as g,r as _}from"./Section-BTnvUq_W.js";import{t as v}from"./CodeBlock-CsiGFgvI.js";import{a as y,i as b,n as x,o as S,r as C,s as w,t as T}from"./dist-C8tf4g8c.js";var E={name:`file-search`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`11.5`,cy:`14.5`,r:`2.5`,key:`1bq0ko`}],[`path`,{d:`M13.3 16.3 15 18`,key:`2quom7`}]]};E.node;var D=r(E),O={name:`info`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]};O.node;var k=r(O),A={name:`library-big`,size:24,node:[[`rect`,{width:`8`,height:`18`,x:`3`,y:`3`,rx:`1`,key:`oynpb5`}],[`path`,{d:`M7 3v18`,key:`bbkbws`}],[`path`,{d:`M20.4 18.9c.2.5-.1 1.1-.6 1.3l-1.9.7c-.5.2-1.1-.1-1.3-.6L11.1 5.1c-.2-.5.1-1.1.6-1.3l1.9-.7c.5-.2 1.1.1 1.3.6Z`,key:`1qboyk`}]]};A.node;var j=r(A);function M(e){let t=e.toLowerCase().replace(/^www\./,``).replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``);return t?/^[a-z]/.test(t)?t:`site-${t}`:`site`}function N(e){return e.toLowerCase().replace(/[^a-z0-9.]+/g,`-`).replace(/^-+|-+$/g,``)||`item`}var P=e=>e.charAt(0).toUpperCase()+e.slice(1);function F(e,t,n=new Date().toISOString()){let r=e.target.name,i=e.libraries.find(e=>e.id===t.library)??{id:t.library,name:t.library},a=t.page??e.pages.find(e=>e.status===`ok`)?.url??(e.target.kind===`site`?e.target.inputs[0]:void 0),o=`Seen on ${r}, likely ${i.name}`;return{schema:`youi.library/v1`,id:`lib:${M(r)}/component/${N(`${i.id}-${t.type}`)}`,name:`${i.name} ${P(t.type)}`,kind:`component`,stage:`library`,summary:o.length>200?`${o.slice(0,199)}…`:o,source:{name:r,...a&&/^https?:\/\//.test(a)?{url:a}:{},ingestedAt:n},categories:[t.type,`detected:${t.confidence}`],swapsWith:[]}}var I=e(t(),1),L=n(),R={high:`success`,medium:`warning`,low:`neutral`};function z({confidence:e}){return(0,L.jsxs)(h,{tone:R[e],children:[e[0].toUpperCase()+e.slice(1),` confidence`]})}var B={package:`package.json`,lockfile:`lockfile`,"components-json":`components.json`,import:`import`,"data-slot":`data-slot`,"class-prefix":`class`,"css-var":`CSS variable`,"id-prefix":`id`,"style-tag":`style tag`,"radix-colors":`Radix Colors`,tailwind:`Tailwind`};function V({evidence:e}){return(0,L.jsx)(`ul`,{className:`space-y-1.5`,children:e.map(e=>(0,L.jsxs)(`li`,{className:`grid grid-cols-[104px_minmax(0,1fr)] gap-x-3 text-small max-sm:grid-cols-1`,children:[(0,L.jsxs)(`span`,{className:s(`font-mono text-mono-sm`,e.strength===`support`?`text-muted`:`text-ink-2`),children:[B[e.kind],e.strength===`support`&&(0,L.jsx)(`span`,{className:`sr-only`,children:` (supporting only)`})]}),(0,L.jsxs)(`span`,{className:`min-w-0 space-y-0.5`,children:[(0,L.jsxs)(`span`,{className:s(`block`,e.strength===`support`?`text-muted`:`text-ink`),children:[e.detail,e.count>1&&(0,L.jsxs)(`span`,{className:`tabular text-muted`,children:[` ×`,e.count]}),e.strength===`support`&&(0,L.jsx)(`span`,{className:`text-muted`,children:` · supports, never decides`})]}),e.samples.length>0&&(0,L.jsx)(`span`,{className:`block truncate font-mono text-mono-sm text-muted`,children:e.samples.join(` `)}),e.where.length>0&&(0,L.jsxs)(`span`,{className:`block truncate font-mono text-mono-sm text-muted`,children:[e.where.slice(0,3).join(` `),e.where.length>3?` +${e.where.length-3}`:``]})]})]},`${e.kind}:${e.detail}`))})}function H({library:e,report:t}){let n=t.elements.filter(t=>t.library===e.id).map(e=>e.type);return(0,L.jsxs)(`article`,{"aria-label":e.name,className:`space-y-3 rounded-lg border border-line p-4`,children:[(0,L.jsxs)(`header`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(`h3`,{className:`text-heading`,children:e.name}),(0,L.jsx)(z,{confidence:e.confidence}),(0,L.jsxs)(`span`,{className:`tabular text-small text-muted`,children:[`score `,e.score.toFixed(2)]}),t.target.kind===`site`&&e.pages.length>0&&(0,L.jsxs)(`span`,{className:`ml-auto text-small text-muted max-sm:ml-0 max-sm:w-full`,children:[`seen on `,e.pages.length,` of `,t.pages.length,` pages`]})]}),(0,L.jsx)(V,{evidence:e.evidence}),n.length>0&&(0,L.jsxs)(`p`,{className:`text-small text-muted`,children:[`Elements: `,n.join(`, `)]})]})}function U(e,t){let n=URL.createObjectURL(new Blob([t],{type:`application/json`})),r=document.createElement(`a`);r.href=n,r.download=e,r.click(),setTimeout(()=>URL.revokeObjectURL(n),0)}function W({report:e,element:t,onClose:n}){let[r]=(0,I.useState)(()=>F(e,t)),a=`${JSON.stringify(r,null,2)}\n`,[s,c]=r.id.slice(4).split(`/component/`),l=`library/${s}/${c}.library.json`;return(0,L.jsx)(T,{open:!0,onOpenChange:e=>!e&&n(),children:(0,L.jsxs)(S,{children:[(0,L.jsx)(y,{className:`fixed inset-0 z-50 bg-scrim animate-fade`}),(0,L.jsxs)(C,{className:`fixed inset-x-0 top-[10vh] z-50 mx-auto w-[min(560px,calc(100vw-24px))] rounded-xl border border-line bg-surface shadow-popover outline-none animate-pop`,children:[(0,L.jsxs)(`header`,{className:`flex h-12 items-center border-b border-line px-5`,children:[(0,L.jsx)(w,{className:`text-heading`,children:`Draft Library item`}),(0,L.jsx)(x,{"aria-label":`Close`,className:`ml-auto grid size-7 place-items-center rounded-md text-muted hover:bg-raised hover:text-ink`,children:(0,L.jsx)(o,{className:`size-4`})})]}),(0,L.jsxs)(`div`,{className:`space-y-4 p-5`,children:[(0,L.jsxs)(b,{className:`text-small text-ink-2`,children:[r.summary,`. A draft only: nothing is written. Save it as `,(0,L.jsx)(`span`,{className:`font-mono text-mono-sm text-ink`,children:l}),` in the design repo; it lands in the Library, never the System, until a person adopts it.`]}),(0,L.jsx)(v,{code:a,title:l,maxHeight:`sm`}),(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsxs)(p,{variant:`primary`,onClick:()=>U(`${c}.library.json`,a),children:[(0,L.jsx)(i,{}),` Download`]}),(0,L.jsx)(x,{asChild:!0,children:(0,L.jsx)(p,{children:`Close`})})]})]})]})]})})}function G({element:e,report:t,onDraft:n}){let r=t.libraries.find(t=>t.id===e.library),i=`${r?.name??e.library} ${e.type}`;return(0,L.jsxs)(`article`,{"aria-label":i,className:`flex flex-col overflow-hidden rounded-lg border border-line`,children:[(0,L.jsx)(`div`,{className:`grid h-36 place-items-center border-b border-line bg-sunken p-3`,children:e.screenshot?(0,L.jsx)(`img`,{src:l(e.screenshot),alt:`Screenshot: ${i}`,loading:`lazy`,className:`max-h-full max-w-full rounded-xs object-contain shadow-raise`}):(0,L.jsx)(`span`,{className:`text-small text-muted`,children:t.target.kind===`repo`?`Found in the code: no screenshot`:`No screenshot taken`})}),(0,L.jsxs)(`div`,{className:`flex flex-1 flex-col gap-2 p-3`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,L.jsx)(`h3`,{className:`text-heading capitalize`,children:e.type}),(0,L.jsx)(`span`,{className:`text-small text-ink-2`,children:r?.name??e.library}),(0,L.jsx)(z,{confidence:e.confidence})]}),(0,L.jsxs)(`p`,{className:`truncate font-mono text-mono-sm text-muted`,title:e.evidence[0]?.detail,children:[e.evidence[0]?.detail,` `,e.count>1&&`×${e.count}`]}),e.also.length>0&&(0,L.jsxs)(`p`,{className:`text-caption text-muted`,children:[`Also matched: `,e.also.map(e=>t.libraries.find(t=>t.id===e)?.name??e).join(`, `)]}),(0,L.jsx)(`div`,{className:`mt-auto pt-1`,children:(0,L.jsxs)(p,{size:`sm`,onClick:n,children:[(0,L.jsx)(j,{}),` Add to Library`]})})]})]})}function K({report:e}){return(0,L.jsxs)(`section`,{"aria-label":`Coverage`,className:`flex items-start gap-3 rounded-lg border border-dashed border-line-strong p-4`,children:[(0,L.jsx)(k,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 text-muted`}),(0,L.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,L.jsx)(`p`,{className:`text-small text-ink-2`,children:e.coverage}),e.pages.length>0&&(0,L.jsx)(`ul`,{className:`space-y-0.5`,children:e.pages.map(e=>(0,L.jsxs)(`li`,{className:`flex items-center gap-2 text-small`,children:[(0,L.jsx)(h,{tone:e.status===`ok`?`neutral`:`danger`,children:e.status===`ok`?`Crawled`:`Failed`}),(0,L.jsx)(`span`,{className:`min-w-0 truncate font-mono text-mono-sm text-ink-2`,children:e.url}),e.exposed>0&&(0,L.jsxs)(`span`,{className:`text-muted`,children:[e.exposed,` opened`]}),e.error&&(0,L.jsx)(`span`,{className:`text-danger`,children:e.error})]},e.url))})]})]})}function q({report:e}){let[t,n]=(0,I.useState)(null);return(0,L.jsxs)(`div`,{className:`mx-auto w-full max-w-5xl min-w-0 space-y-8 px-8 py-8 animate-enter max-sm:px-4`,children:[(0,L.jsxs)(`div`,{className:`space-y-1`,children:[(0,L.jsxs)(`p`,{className:`text-small text-muted`,children:[e.target.kind===`site`?`Website`:`Repo`,` · detected `,new Date(e.generatedAt).toLocaleString(),` · `,e.detector]}),(0,L.jsx)(`h2`,{className:`text-title`,children:e.target.name})]}),(0,L.jsx)(K,{report:e}),(0,L.jsx)(g,{title:`Libraries`,count:e.libraries.length,children:e.libraries.length===0?(0,L.jsx)(`p`,{className:`text-small text-muted`,children:`No UI library found on what was crawled.`}):(0,L.jsx)(`div`,{className:`space-y-3`,children:e.libraries.map(t=>(0,L.jsx)(H,{library:t,report:e},t.id))})}),(0,L.jsx)(g,{title:`Elements`,count:e.elements.length,children:e.elements.length===0?(0,L.jsx)(`p`,{className:`text-small text-muted`,children:`No element types matched.`}):(0,L.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:e.elements.map(t=>(0,L.jsx)(G,{element:t,report:e,onDraft:()=>n(t)},t.type))})}),e.unused.length>0&&(0,L.jsx)(g,{title:`Declared, never imported`,count:e.unused.length,aside:(0,L.jsx)(`span`,{className:`text-small text-muted`,children:`Not counted in any verdict`}),children:(0,L.jsx)(_,{head:[`Package`,`Declared`,`In`,`Library`],children:e.unused.map(e=>(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`td`,{className:`font-mono text-mono-sm text-ink`,children:e.package}),(0,L.jsx)(`td`,{className:`font-mono text-mono-sm text-muted`,children:e.version}),(0,L.jsx)(`td`,{className:`font-mono text-mono-sm text-muted`,children:e.declaredIn}),(0,L.jsx)(`td`,{className:`text-small text-ink-2`,children:e.library??``})]},e.package))})}),e.fonts.length>0&&(0,L.jsx)(g,{title:`Fonts`,count:e.fonts.length,children:(0,L.jsx)(`p`,{className:`text-small text-ink-2`,children:e.fonts.map(e=>`${e.family}${e.usedBy.length?` (${e.usedBy.slice(0,3).join(`, `)})`:``}`).join(` · `)})}),e.notes.length>0&&(0,L.jsx)(g,{title:`Not counted`,children:(0,L.jsx)(`ul`,{className:`list-disc space-y-1 pl-5 text-small text-muted`,children:e.notes.map(e=>(0,L.jsx)(`li`,{children:e},e))})}),t&&(0,L.jsx)(W,{report:e,element:t,onClose:()=>n(null)})]})}function J(){return(0,L.jsx)(f,{icon:D,title:`No stack detected yet`,children:(0,L.jsxs)(`p`,{children:[`Run `,(0,L.jsx)(`span`,{className:`font-mono text-mono-sm text-ink`,children:`youiyoux detect <repo-path|url…>`}),` to find which UI libraries a repo or website uses, then open the hub with`,` `,(0,L.jsx)(`span`,{className:`font-mono text-mono-sm text-ink`,children:`youiyoux ui --detect .youi/detect/detect.json`}),`.`]})})}function Y(){let e=m(),t=e.status===`ready`?e.value:null;return(0,L.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,L.jsx)(d,{title:`Stack`,count:t?.libraries.length,children:(0,L.jsxs)(h,{tone:`outline`,children:[(0,L.jsx)(a,{}),` Detected, not adopted`]})}),(0,L.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-y-auto`,children:e.status===`ready`?t?(0,L.jsx)(q,{report:t}):(0,L.jsx)(J,{}):(0,L.jsx)(u,{state:e,onRetry:c,what:`the detect report`})})]})}export{z as ConfidenceBadge,W as DraftDialog,J as StackEmpty,q as StackReport,Y as StackScreen};
1
+ import{i as e,t}from"./react-DB-4Zxce.js";import{t as n}from"./jsx-runtime-D6zNwnaE.js";import{t as r}from"./createLucideIcon-CGDJWtKO.js";import{t as i}from"./download-BQI-Si9R.js";import{t as a}from"./layers-DfzdK_wG.js";import{t as o}from"./x-MLbFVa4v.js";import{t as s}from"./clsx-DB0hHKMi.js";import{P as c,ct as l,i as u,n as d,o as f,s as p,z as m}from"./main-Djqho539.js";import{t as h}from"./Badge-CUJUit4d.js";import{n as g,r as _}from"./Section-BTnvUq_W.js";import{t as v}from"./CodeBlock-CsiGFgvI.js";import{a as y,i as b,n as x,o as S,r as C,s as w,t as T}from"./dist-CL3qgCbi.js";var E={name:`file-search`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`11.5`,cy:`14.5`,r:`2.5`,key:`1bq0ko`}],[`path`,{d:`M13.3 16.3 15 18`,key:`2quom7`}]]};E.node;var D=r(E),O={name:`info`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]};O.node;var k=r(O),A={name:`library-big`,size:24,node:[[`rect`,{width:`8`,height:`18`,x:`3`,y:`3`,rx:`1`,key:`oynpb5`}],[`path`,{d:`M7 3v18`,key:`bbkbws`}],[`path`,{d:`M20.4 18.9c.2.5-.1 1.1-.6 1.3l-1.9.7c-.5.2-1.1-.1-1.3-.6L11.1 5.1c-.2-.5.1-1.1.6-1.3l1.9-.7c.5-.2 1.1.1 1.3.6Z`,key:`1qboyk`}]]};A.node;var j=r(A);function M(e){let t=e.toLowerCase().replace(/^www\./,``).replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``);return t?/^[a-z]/.test(t)?t:`site-${t}`:`site`}function N(e){return e.toLowerCase().replace(/[^a-z0-9.]+/g,`-`).replace(/^-+|-+$/g,``)||`item`}var P=e=>e.charAt(0).toUpperCase()+e.slice(1);function F(e,t,n=new Date().toISOString()){let r=e.target.name,i=e.libraries.find(e=>e.id===t.library)??{id:t.library,name:t.library},a=t.page??e.pages.find(e=>e.status===`ok`)?.url??(e.target.kind===`site`?e.target.inputs[0]:void 0),o=`Seen on ${r}, likely ${i.name}`;return{schema:`youi.library/v1`,id:`lib:${M(r)}/component/${N(`${i.id}-${t.type}`)}`,name:`${i.name} ${P(t.type)}`,kind:`component`,stage:`library`,summary:o.length>200?`${o.slice(0,199)}…`:o,source:{name:r,...a&&/^https?:\/\//.test(a)?{url:a}:{},ingestedAt:n},categories:[t.type,`detected:${t.confidence}`],swapsWith:[]}}var I=e(t(),1),L=n(),R={high:`success`,medium:`warning`,low:`neutral`};function z({confidence:e}){return(0,L.jsxs)(h,{tone:R[e],children:[e[0].toUpperCase()+e.slice(1),` confidence`]})}var B={package:`package.json`,lockfile:`lockfile`,"components-json":`components.json`,import:`import`,"data-slot":`data-slot`,"class-prefix":`class`,"css-var":`CSS variable`,"id-prefix":`id`,"style-tag":`style tag`,"radix-colors":`Radix Colors`,tailwind:`Tailwind`};function V({evidence:e}){return(0,L.jsx)(`ul`,{className:`space-y-1.5`,children:e.map(e=>(0,L.jsxs)(`li`,{className:`grid grid-cols-[104px_minmax(0,1fr)] gap-x-3 text-small max-sm:grid-cols-1`,children:[(0,L.jsxs)(`span`,{className:s(`font-mono text-mono-sm`,e.strength===`support`?`text-muted`:`text-ink-2`),children:[B[e.kind],e.strength===`support`&&(0,L.jsx)(`span`,{className:`sr-only`,children:` (supporting only)`})]}),(0,L.jsxs)(`span`,{className:`min-w-0 space-y-0.5`,children:[(0,L.jsxs)(`span`,{className:s(`block`,e.strength===`support`?`text-muted`:`text-ink`),children:[e.detail,e.count>1&&(0,L.jsxs)(`span`,{className:`tabular text-muted`,children:[` ×`,e.count]}),e.strength===`support`&&(0,L.jsx)(`span`,{className:`text-muted`,children:` · supports, never decides`})]}),e.samples.length>0&&(0,L.jsx)(`span`,{className:`block truncate font-mono text-mono-sm text-muted`,children:e.samples.join(` `)}),e.where.length>0&&(0,L.jsxs)(`span`,{className:`block truncate font-mono text-mono-sm text-muted`,children:[e.where.slice(0,3).join(` `),e.where.length>3?` +${e.where.length-3}`:``]})]})]},`${e.kind}:${e.detail}`))})}function H({library:e,report:t}){let n=t.elements.filter(t=>t.library===e.id).map(e=>e.type);return(0,L.jsxs)(`article`,{"aria-label":e.name,className:`space-y-3 rounded-lg border border-line p-4`,children:[(0,L.jsxs)(`header`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(`h3`,{className:`text-heading`,children:e.name}),(0,L.jsx)(z,{confidence:e.confidence}),(0,L.jsxs)(`span`,{className:`tabular text-small text-muted`,children:[`score `,e.score.toFixed(2)]}),t.target.kind===`site`&&e.pages.length>0&&(0,L.jsxs)(`span`,{className:`ml-auto text-small text-muted max-sm:ml-0 max-sm:w-full`,children:[`seen on `,e.pages.length,` of `,t.pages.length,` pages`]})]}),(0,L.jsx)(V,{evidence:e.evidence}),n.length>0&&(0,L.jsxs)(`p`,{className:`text-small text-muted`,children:[`Elements: `,n.join(`, `)]})]})}function U(e,t){let n=URL.createObjectURL(new Blob([t],{type:`application/json`})),r=document.createElement(`a`);r.href=n,r.download=e,r.click(),setTimeout(()=>URL.revokeObjectURL(n),0)}function W({report:e,element:t,onClose:n}){let[r]=(0,I.useState)(()=>F(e,t)),a=`${JSON.stringify(r,null,2)}\n`,[s,c]=r.id.slice(4).split(`/component/`),l=`library/${s}/${c}.library.json`;return(0,L.jsx)(T,{open:!0,onOpenChange:e=>!e&&n(),children:(0,L.jsxs)(S,{children:[(0,L.jsx)(y,{className:`fixed inset-0 z-50 bg-scrim animate-fade`}),(0,L.jsxs)(C,{className:`fixed inset-x-0 top-[10vh] z-50 mx-auto w-[min(560px,calc(100vw-24px))] rounded-xl border border-line bg-surface shadow-popover outline-none animate-pop`,children:[(0,L.jsxs)(`header`,{className:`flex h-12 items-center border-b border-line px-5`,children:[(0,L.jsx)(w,{className:`text-heading`,children:`Draft Library item`}),(0,L.jsx)(x,{"aria-label":`Close`,className:`ml-auto grid size-7 place-items-center rounded-md text-muted hover:bg-raised hover:text-ink`,children:(0,L.jsx)(o,{className:`size-4`})})]}),(0,L.jsxs)(`div`,{className:`space-y-4 p-5`,children:[(0,L.jsxs)(b,{className:`text-small text-ink-2`,children:[r.summary,`. A draft only: nothing is written. Save it as `,(0,L.jsx)(`span`,{className:`font-mono text-mono-sm text-ink`,children:l}),` in the design repo; it lands in the Library, never the System, until a person adopts it.`]}),(0,L.jsx)(v,{code:a,title:l,maxHeight:`sm`}),(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsxs)(p,{variant:`primary`,onClick:()=>U(`${c}.library.json`,a),children:[(0,L.jsx)(i,{}),` Download`]}),(0,L.jsx)(x,{asChild:!0,children:(0,L.jsx)(p,{children:`Close`})})]})]})]})]})})}function G({element:e,report:t,onDraft:n}){let r=t.libraries.find(t=>t.id===e.library),i=`${r?.name??e.library} ${e.type}`;return(0,L.jsxs)(`article`,{"aria-label":i,className:`flex flex-col overflow-hidden rounded-lg border border-line`,children:[(0,L.jsx)(`div`,{className:`grid h-36 place-items-center border-b border-line bg-sunken p-3`,children:e.screenshot?(0,L.jsx)(`img`,{src:l(e.screenshot),alt:`Screenshot: ${i}`,loading:`lazy`,className:`max-h-full max-w-full rounded-xs object-contain shadow-raise`}):(0,L.jsx)(`span`,{className:`text-small text-muted`,children:t.target.kind===`repo`?`Found in the code: no screenshot`:`No screenshot taken`})}),(0,L.jsxs)(`div`,{className:`flex flex-1 flex-col gap-2 p-3`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,L.jsx)(`h3`,{className:`text-heading capitalize`,children:e.type}),(0,L.jsx)(`span`,{className:`text-small text-ink-2`,children:r?.name??e.library}),(0,L.jsx)(z,{confidence:e.confidence})]}),(0,L.jsxs)(`p`,{className:`truncate font-mono text-mono-sm text-muted`,title:e.evidence[0]?.detail,children:[e.evidence[0]?.detail,` `,e.count>1&&`×${e.count}`]}),e.also.length>0&&(0,L.jsxs)(`p`,{className:`text-caption text-muted`,children:[`Also matched: `,e.also.map(e=>t.libraries.find(t=>t.id===e)?.name??e).join(`, `)]}),(0,L.jsx)(`div`,{className:`mt-auto pt-1`,children:(0,L.jsxs)(p,{size:`sm`,onClick:n,children:[(0,L.jsx)(j,{}),` Add to Library`]})})]})]})}function K({report:e}){return(0,L.jsxs)(`section`,{"aria-label":`Coverage`,className:`flex items-start gap-3 rounded-lg border border-dashed border-line-strong p-4`,children:[(0,L.jsx)(k,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 text-muted`}),(0,L.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,L.jsx)(`p`,{className:`text-small text-ink-2`,children:e.coverage}),e.pages.length>0&&(0,L.jsx)(`ul`,{className:`space-y-0.5`,children:e.pages.map(e=>(0,L.jsxs)(`li`,{className:`flex items-center gap-2 text-small`,children:[(0,L.jsx)(h,{tone:e.status===`ok`?`neutral`:`danger`,children:e.status===`ok`?`Crawled`:`Failed`}),(0,L.jsx)(`span`,{className:`min-w-0 truncate font-mono text-mono-sm text-ink-2`,children:e.url}),e.exposed>0&&(0,L.jsxs)(`span`,{className:`text-muted`,children:[e.exposed,` opened`]}),e.error&&(0,L.jsx)(`span`,{className:`text-danger`,children:e.error})]},e.url))})]})]})}function q({report:e}){let[t,n]=(0,I.useState)(null);return(0,L.jsxs)(`div`,{className:`mx-auto w-full max-w-5xl min-w-0 space-y-8 px-8 py-8 animate-enter max-sm:px-4`,children:[(0,L.jsxs)(`div`,{className:`space-y-1`,children:[(0,L.jsxs)(`p`,{className:`text-small text-muted`,children:[e.target.kind===`site`?`Website`:`Repo`,` · detected `,new Date(e.generatedAt).toLocaleString(),` · `,e.detector]}),(0,L.jsx)(`h2`,{className:`text-title`,children:e.target.name})]}),(0,L.jsx)(K,{report:e}),(0,L.jsx)(g,{title:`Libraries`,count:e.libraries.length,children:e.libraries.length===0?(0,L.jsx)(`p`,{className:`text-small text-muted`,children:`No UI library found on what was crawled.`}):(0,L.jsx)(`div`,{className:`space-y-3`,children:e.libraries.map(t=>(0,L.jsx)(H,{library:t,report:e},t.id))})}),(0,L.jsx)(g,{title:`Elements`,count:e.elements.length,children:e.elements.length===0?(0,L.jsx)(`p`,{className:`text-small text-muted`,children:`No element types matched.`}):(0,L.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:e.elements.map(t=>(0,L.jsx)(G,{element:t,report:e,onDraft:()=>n(t)},t.type))})}),e.unused.length>0&&(0,L.jsx)(g,{title:`Declared, never imported`,count:e.unused.length,aside:(0,L.jsx)(`span`,{className:`text-small text-muted`,children:`Not counted in any verdict`}),children:(0,L.jsx)(_,{head:[`Package`,`Declared`,`In`,`Library`],children:e.unused.map(e=>(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`td`,{className:`font-mono text-mono-sm text-ink`,children:e.package}),(0,L.jsx)(`td`,{className:`font-mono text-mono-sm text-muted`,children:e.version}),(0,L.jsx)(`td`,{className:`font-mono text-mono-sm text-muted`,children:e.declaredIn}),(0,L.jsx)(`td`,{className:`text-small text-ink-2`,children:e.library??``})]},e.package))})}),e.fonts.length>0&&(0,L.jsx)(g,{title:`Fonts`,count:e.fonts.length,children:(0,L.jsx)(`p`,{className:`text-small text-ink-2`,children:e.fonts.map(e=>`${e.family}${e.usedBy.length?` (${e.usedBy.slice(0,3).join(`, `)})`:``}`).join(` · `)})}),e.notes.length>0&&(0,L.jsx)(g,{title:`Not counted`,children:(0,L.jsx)(`ul`,{className:`list-disc space-y-1 pl-5 text-small text-muted`,children:e.notes.map(e=>(0,L.jsx)(`li`,{children:e},e))})}),t&&(0,L.jsx)(W,{report:e,element:t,onClose:()=>n(null)})]})}function J(){return(0,L.jsx)(f,{icon:D,title:`No stack detected yet`,children:(0,L.jsxs)(`p`,{children:[`Run `,(0,L.jsx)(`span`,{className:`font-mono text-mono-sm text-ink`,children:`youiyoux detect <repo-path|url…>`}),` to find which UI libraries a repo or website uses, then open the hub with`,` `,(0,L.jsx)(`span`,{className:`font-mono text-mono-sm text-ink`,children:`youiyoux ui --detect .youi/detect/detect.json`}),`.`]})})}function Y(){let e=m(),t=e.status===`ready`?e.value:null;return(0,L.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,L.jsx)(d,{title:`Stack`,count:t?.libraries.length,children:(0,L.jsxs)(h,{tone:`outline`,children:[(0,L.jsx)(a,{}),` Detected, not adopted`]})}),(0,L.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-y-auto`,children:e.status===`ready`?t?(0,L.jsx)(q,{report:t}):(0,L.jsx)(J,{}):(0,L.jsx)(u,{state:e,onRetry:c,what:`the detect report`})})]})}export{z as ConfidenceBadge,W as DraftDialog,J as StackEmpty,q as StackReport,Y as StackScreen};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-D6zNwnaE.js";import{t}from"./createLucideIcon-CGDJWtKO.js";import{t as n}from"./compass-BkKOZPYe.js";import{t as r}from"./layers-DfzdK_wG.js";import{t as i}from"./monitor-X_lELkcU.js";import{T as a,dt as o,n as s,o as c,s as l}from"./main-cvOFSjox.js";import{t as u}from"./Badge-CUJUit4d.js";var d={name:`clipboard-check`,size:24,node:[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`m9 14 2 2 4-4`,key:`df797q`}]]};d.node;var f=t(d),p={name:`key-round`,size:24,node:[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]};p.node;var m=t(p),h={name:`replace`,size:24,node:[[`path`,{d:`M14 4a1 1 0 0 1 1-1`,key:`dhj8ez`}],[`path`,{d:`M15 10a1 1 0 0 1-1-1`,key:`1mnyi5`}],[`path`,{d:`M21 4a1 1 0 0 0-1-1`,key:`sfs9ap`}],[`path`,{d:`M21 9a1 1 0 0 1-1 1`,key:`mp6qeo`}],[`path`,{d:`m3 7 3 3 3-3`,key:`x25e72`}],[`path`,{d:`M6 10V5a2 2 0 0 1 2-2h2`,key:`15xut4`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}]]};h.node;var g=t(h),_=e();function v({title:e,icon:t,intro:n,stages:r}){return(0,_.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,_.jsx)(s,{title:e,children:(0,_.jsx)(u,{tone:`outline`,children:`Next`})}),(0,_.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,_.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-8 px-8 py-12 animate-enter`,children:[(0,_.jsxs)(`div`,{className:`space-y-3`,children:[(0,_.jsx)(`span`,{className:`grid size-9 place-items-center rounded-lg border border-line bg-raised text-muted`,children:(0,_.jsx)(t,{className:`size-4`})}),(0,_.jsx)(`p`,{className:`max-w-xl text-reading text-ink-2`,children:n})]}),(0,_.jsx)(`ol`,{className:`grid gap-3 md:grid-cols-3`,children:r.map((e,t)=>(0,_.jsxs)(`li`,{className:`space-y-2 rounded-lg border border-line p-4`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2 text-small text-muted`,children:[(0,_.jsx)(e.icon,{className:`size-3.5`}),` Step `,t+1]}),(0,_.jsx)(`h3`,{className:`text-heading`,children:e.title}),(0,_.jsx)(`p`,{className:`text-small text-muted`,children:e.body})]},e.title))})]})})]})}function y(){return(0,_.jsx)(v,{title:`Sources`,icon:a,intro:`Sources feed the Library: other design systems, UI kits and references. None are connected yet; each one will add its elements to the Library, where they are browsed and proposed but never built with.`,stages:[{icon:a,title:`Connect`,body:`Point at a source; its elements are ingested with where they came from and when.`},{icon:r,title:`Categorize`,body:`Each element is filed by category and linked to the System elements it could replace.`},{icon:g,title:`Propose a swap`,body:`Request adoption; a person approves it into the System before anything is built with it.`}]})}function b(){return(0,_.jsx)(v,{title:`Access`,icon:m,intro:`This hub runs locally with no accounts yet. Access arrives with the server: who can read or edit each system, who approves changes, and what agents may do.`,stages:[{icon:m,title:`Roles`,body:`Viewer or editor per system or element, with approver as a separate grant. Agents can propose but never approve.`},{icon:f,title:`Audit`,body:`Every grant, approval and rollout recorded, with “view as this person” to check what someone sees.`},{icon:i,title:`Projects`,body:"Per-project tokens for `youiyoux sync`, scoped to the systems that project uses."}]})}function x(){return(0,_.jsx)(c,{icon:n,title:`Nothing here`,actions:(0,_.jsx)(l,{asChild:!0,children:(0,_.jsx)(o,{href:`/`,children:`Go home`})}),children:`This address isn't a page in YouIyouX. Press ⌘K to jump to an element or screen.`})}export{b as AccessScreen,x as NotFoundScreen,y as SourcesScreen};
1
+ import{t as e}from"./jsx-runtime-D6zNwnaE.js";import{t}from"./createLucideIcon-CGDJWtKO.js";import{t as n}from"./compass-BkKOZPYe.js";import{t as r}from"./layers-DfzdK_wG.js";import{t as i}from"./monitor-X_lELkcU.js";import{T as a,dt as o,n as s,o as c,s as l}from"./main-Djqho539.js";import{t as u}from"./Badge-CUJUit4d.js";var d={name:`clipboard-check`,size:24,node:[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`m9 14 2 2 4-4`,key:`df797q`}]]};d.node;var f=t(d),p={name:`key-round`,size:24,node:[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]};p.node;var m=t(p),h={name:`replace`,size:24,node:[[`path`,{d:`M14 4a1 1 0 0 1 1-1`,key:`dhj8ez`}],[`path`,{d:`M15 10a1 1 0 0 1-1-1`,key:`1mnyi5`}],[`path`,{d:`M21 4a1 1 0 0 0-1-1`,key:`sfs9ap`}],[`path`,{d:`M21 9a1 1 0 0 1-1 1`,key:`mp6qeo`}],[`path`,{d:`m3 7 3 3 3-3`,key:`x25e72`}],[`path`,{d:`M6 10V5a2 2 0 0 1 2-2h2`,key:`15xut4`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}]]};h.node;var g=t(h),_=e();function v({title:e,icon:t,intro:n,stages:r}){return(0,_.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,_.jsx)(s,{title:e,children:(0,_.jsx)(u,{tone:`outline`,children:`Next`})}),(0,_.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,_.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-8 px-8 py-12 animate-enter`,children:[(0,_.jsxs)(`div`,{className:`space-y-3`,children:[(0,_.jsx)(`span`,{className:`grid size-9 place-items-center rounded-lg border border-line bg-raised text-muted`,children:(0,_.jsx)(t,{className:`size-4`})}),(0,_.jsx)(`p`,{className:`max-w-xl text-reading text-ink-2`,children:n})]}),(0,_.jsx)(`ol`,{className:`grid gap-3 md:grid-cols-3`,children:r.map((e,t)=>(0,_.jsxs)(`li`,{className:`space-y-2 rounded-lg border border-line p-4`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2 text-small text-muted`,children:[(0,_.jsx)(e.icon,{className:`size-3.5`}),` Step `,t+1]}),(0,_.jsx)(`h3`,{className:`text-heading`,children:e.title}),(0,_.jsx)(`p`,{className:`text-small text-muted`,children:e.body})]},e.title))})]})})]})}function y(){return(0,_.jsx)(v,{title:`Sources`,icon:a,intro:`Sources feed the Library: other design systems, UI kits and references. None are connected yet; each one will add its elements to the Library, where they are browsed and proposed but never built with.`,stages:[{icon:a,title:`Connect`,body:`Point at a source; its elements are ingested with where they came from and when.`},{icon:r,title:`Categorize`,body:`Each element is filed by category and linked to the System elements it could replace.`},{icon:g,title:`Propose a swap`,body:`Request adoption; a person approves it into the System before anything is built with it.`}]})}function b(){return(0,_.jsx)(v,{title:`Access`,icon:m,intro:`This hub runs locally with no accounts yet. Access arrives with the server: who can read or edit each system, who approves changes, and what agents may do.`,stages:[{icon:m,title:`Roles`,body:`Viewer or editor per system or element, with approver as a separate grant. Agents can propose but never approve.`},{icon:f,title:`Audit`,body:`Every grant, approval and rollout recorded, with “view as this person” to check what someone sees.`},{icon:i,title:`Projects`,body:"Per-project tokens for `youiyoux sync`, scoped to the systems that project uses."}]})}function x(){return(0,_.jsx)(c,{icon:n,title:`Nothing here`,actions:(0,_.jsx)(l,{asChild:!0,children:(0,_.jsx)(o,{href:`/`,children:`Go home`})}),children:`This address isn't a page in YouIyouX. Press ⌘K to jump to an element or screen.`})}export{b as AccessScreen,x as NotFoundScreen,y as SourcesScreen};
@@ -1 +1 @@
1
- import{i as e,t}from"./react-DB-4Zxce.js";import{t as n}from"./jsx-runtime-D6zNwnaE.js";import{t as r}from"./createLucideIcon-CGDJWtKO.js";import{t as i}from"./arrow-right-DcbNDzqs.js";import{t as a}from"./chevron-down-CzN07vMi.js";import{t as o}from"./circle-check-DkwBMT62.js";import{t as s}from"./minus-BDifFhOo.js";import{t as c}from"./mouse-pointer-click-CVJ6hWg8.js";import{t as l}from"./paintbrush-DOkEgSTO.js";import{i as u,r as d}from"./ServiceDown-S4ya0Cob.js";import{c as f,i as p,n as m,o as h,s as g}from"./contrast-B-uhyF_b.js";import{t as _}from"./triangle-alert-Dkdi9eDR.js";import{t as v}from"./clsx-DB0hHKMi.js";import{E as y,H as b,L as ee,T as te,dt as ne,f as re,i as x,mt as ie,n as ae,o as S,pt as oe,r as se,s as C}from"./main-cvOFSjox.js";import{t as w}from"./protocol-caP6umNL.js";import{a as T,n as ce}from"./workflow-C53UBmRZ.js";import{n as le,t as E}from"./Badge-CUJUit4d.js";import{o as ue,t as D}from"./Field-LwrJXoOs.js";import{t as O}from"./Swatch-KDz4qxdM.js";import{i as k,n as A,t as j}from"./color-C6bxX90C.js";import{t as M}from"./Segmented-Dzi1x49S.js";import{t as de}from"./SearchField-hF-6-YDM.js";import{a as N,c as fe,i as pe,l as P,n as F,o as I,r as me,s as he,t as ge,u as L}from"./values-cLekxBZj.js";var R={name:`chevron-up`,size:24,node:[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]};R.node;var z=r(R),B={name:`maximize-2`,size:24,node:[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]};B.node;var _e=r(B),ve={name:`minimize-2`,size:24,node:[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]};ve.node;var V=r(ve),H={name:`play`,size:24,node:[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]};H.node;var ye=r(H),be={name:`rotate-ccw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]};be.node;var xe=r(be),U=e(t(),1),W=n();function Se({warnings:e}){let t=e.filter(e=>e.isNew).length;return(0,W.jsxs)(`section`,{"aria-labelledby":`contrast-heading`,className:`space-y-2`,children:[(0,W.jsxs)(`header`,{className:`flex items-center gap-2`,children:[e.length>0?(0,W.jsx)(_,{"aria-hidden":!0,className:`size-4 text-warning`}):(0,W.jsx)(o,{"aria-hidden":!0,className:`size-4 text-success`}),(0,W.jsx)(`h3`,{id:`contrast-heading`,className:`text-heading`,children:`Contrast`}),(0,W.jsx)(`span`,{className:`text-small text-muted`,role:`status`,children:e.length===0?`every checked pair meets WCAG AA`:`${e.length} pair(s) below WCAG AA${t?`, ${t} from these edits`:``}`})]}),e.length>0&&(0,W.jsx)(`ul`,{className:`max-h-64 divide-y divide-line overflow-y-auto rounded-md border border-line`,children:e.map(e=>(0,W.jsxs)(`li`,{className:`flex items-center gap-2.5 px-3 py-2`,children:[(0,W.jsx)(`span`,{"aria-hidden":!0,className:`edge grid size-7 shrink-0 place-items-center rounded-sm text-small font-semibold`,style:{background:e.background,color:e.foreground},children:`Aa`}),(0,W.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`span`,{className:`block truncate text-small text-ink`,children:e.pair.label}),(0,W.jsxs)(`span`,{className:`block text-caption text-muted`,children:[(0,W.jsx)(`span`,{className:`capitalize`,children:e.scheme}),` · needs `,e.required,`:1 `,e.pair.kind===`ui`?`(UI part)`:e.pair.kind===`large`?`(large text)`:`(text)`,e.unreadable&&(0,W.jsx)(`span`,{className:`block truncate text-danger`,children:e.unreadable})]})]}),(0,W.jsx)(`span`,{className:`tabular font-mono text-mono-sm text-ink`,children:e.ratio?.toFixed(2)??`?`}),e.grade?(0,W.jsx)(E,{tone:le[e.grade],children:e.grade}):(0,W.jsx)(E,{tone:`danger`,children:`Unreadable`}),e.isNew&&(0,W.jsx)(E,{tone:`danger`,children:`New`})]},`${e.pair.key}|${e.scheme}`))})]})}var G=D.replace(`w-full `,``);function K({label:e,htmlFor:t,children:n,hint:r}){return(0,W.jsxs)(`div`,{className:`grid grid-cols-[6.5rem_minmax(0,1fr)] items-center gap-x-3 gap-y-1 max-sm:grid-cols-1`,children:[(0,W.jsx)(`label`,{htmlFor:t,className:`text-small text-muted`,children:e}),(0,W.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1.5`,children:n}),r&&(0,W.jsx)(`p`,{className:`col-start-2 text-caption text-muted max-sm:col-start-1`,children:r})]})}var Ce=(e,t)=>{let n=Math.max(0,-Math.floor(Math.log10(t)));return Number(e.toFixed(Math.min(n+1,4)))};function q({label:e,value:t,onChange:n,step:r=1,min:i,max:a,unit:o,className:s,disabled:c,id:l}){let[u,d]=(0,U.useState)(String(t)),f=(0,U.useRef)(t),p=(0,U.useRef)(!1);(0,U.useEffect)(()=>{(!p.current||Number(u)!==t)&&d(String(t))},[t]);let m=e=>Math.min(a??1/0,Math.max(i??-1/0,e)),h=e=>{let t=m(Ce(e,r));d(String(t)),n(t)};return(0,W.jsxs)(`span`,{className:v(`relative inline-flex items-center`,s),children:[(0,W.jsx)(`input`,{id:l,type:`text`,inputMode:`decimal`,"aria-label":e,disabled:c,value:u,spellCheck:!1,autoComplete:`off`,onFocus:()=>{p.current=!0,f.current=t},onBlur:()=>{p.current=!1,d(String(t))},onChange:e=>{d(e.target.value);let t=Number(e.target.value);e.target.value.trim()!==``&&Number.isFinite(t)&&t===m(t)&&n(t)},onKeyDown:e=>{e.key===`ArrowUp`||e.key===`ArrowDown`?(e.preventDefault(),h((Number.isFinite(Number(u))?Number(u):t)+(e.key===`ArrowUp`?1:-1)*r*(e.shiftKey?10:1))):e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),h(f.current))},className:v(G,`h-7 w-[5.5rem] tabular`,o&&`pr-8`)}),o&&(0,W.jsx)(`span`,{className:`pointer-events-none absolute right-2 text-caption text-muted`,children:o})]})}function we({label:e,value:t,onChange:n,disabled:r}){let i=j(t),[a,o]=(0,U.useState)(i),s=(0,U.useRef)(t),[c,l]=(0,U.useState)(!1),u=(0,U.useId)();(0,U.useEffect)(()=>{o(i),l(!1)},[i]);let d=e=>t.alpha!==void 0&&e.alpha===void 0?{colorSpace:e.colorSpace,components:e.components,alpha:t.alpha,...e.hex?{hex:e.hex}:{}}:e;return(0,W.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1.5`,children:[(0,W.jsxs)(`label`,{className:`relative grid size-7 shrink-0 cursor-pointer place-items-center rounded-md border border-line has-focus-visible:outline-2 has-focus-visible:outline-offset-2 has-focus-visible:outline-focus`,children:[(0,W.jsx)(O,{color:i,size:`sm`}),(0,W.jsx)(`input`,{type:`color`,"aria-label":`${e}: pick`,disabled:r,value:k(t),onChange:e=>{let t=A(e.target.value);t&&n(d(t))},className:`absolute inset-0 size-full cursor-pointer opacity-0`})]}),(0,W.jsx)(`input`,{id:u,type:`text`,"aria-label":e,"aria-invalid":c||void 0,disabled:r,value:a,spellCheck:!1,autoComplete:`off`,onFocus:()=>s.current=t,onChange:e=>{o(e.target.value);let t=A(e.target.value);l(t===null),t&&n(t)},onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),n(s.current),o(j(s.current)),l(!1))},onBlur:()=>{o(i),l(!1)},className:v(G,`h-7 w-[11rem] font-mono text-mono-sm max-sm:w-[9.5rem]`,c&&`border-danger`)})]})}function Te({label:e,value:t,options:n,onChange:r,disabled:i}){return(0,W.jsxs)(`select`,{"aria-label":e,disabled:i,value:t??``,onChange:e=>r(e.target.value||null),className:v(G,`h-7 w-auto max-w-[14rem] pr-7 text-small`),children:[(0,W.jsx)(`option`,{value:``,children:`Own value`}),n.map(e=>(0,W.jsxs)(`option`,{value:e,children:[`Alias of `,e]},e))]})}function Ee({label:e,value:t,options:n,onChange:r,disabled:i}){return(0,W.jsx)(`select`,{"aria-label":e,disabled:i,value:String(t),onChange:e=>r(n.find(t=>String(t)===e.target.value)??t),className:v(G,`h-7 w-auto pr-7`),children:n.map(e=>(0,W.jsx)(`option`,{value:String(e),children:String(e)},String(e)))})}function De({label:e,onClick:t}){return(0,W.jsx)(`button`,{type:`button`,"aria-label":e,title:e,onClick:t,className:`grid size-6 place-items-center rounded-sm text-muted hover:bg-raised hover:text-ink`,children:(0,W.jsx)(xe,{className:`size-3.5`})})}function Oe({points:e,label:t,className:n}){let r=Math.min(0,...e),i=Math.max(1,...e),a=e=>58-(e-r)/(i-r||1)*52,o=e.map((t,n)=>`${n===0?`M`:`L`}${(n/(e.length-1)*120).toFixed(1)},${a(t).toFixed(1)}`).join(` `);return(0,W.jsxs)(`svg`,{role:`img`,"aria-label":t,viewBox:`0 0 120 64`,className:v(`h-16 w-30 shrink-0 rounded-md border border-line bg-sunken`,n),children:[(0,W.jsx)(`line`,{x1:`0`,x2:120,y1:a(1),y2:a(1),className:`stroke-line-strong`,strokeDasharray:`2 3`}),(0,W.jsx)(`line`,{x1:`0`,x2:120,y1:a(0),y2:a(0),className:`stroke-line`}),(0,W.jsx)(`path`,{d:o,fill:`none`,className:`stroke-accent`,strokeWidth:`1.75`,strokeLinejoin:`round`})]})}function ke([e,t,n,r],i=48){let a=(e,t,n)=>3*t*e*(1-e)**2+3*n*e*e*(1-e)+e**3;return Array.from({length:i+1},(o,s)=>{let c=s/i,l=0,u=1;for(let t=0;t<30;t++){let t=(l+u)/2;a(t,e,n)<c?l=t:u=t}return a((l+u)/2,t,r)})}var Ae=`/`,je=200,Me=4e3,Ne=[{value:`rest`,label:`Rest`},{value:`hover`,label:`Hover`},{value:`active`,label:`Active`},{value:`focus`,label:`Focus`},{value:`disabled`,label:`Disabled`}];function Pe({screen:e,scheme:t,vars:n,pinned:r,tokens:i,replay:a,focus:o=null,className:s}){let c=(0,U.useRef)(null),[l,u]=(0,U.useState)(je),d=(0,U.useRef)({vars:n,pinned:r,tokens:i,focus:o});d.current={vars:n,pinned:r,tokens:i,focus:o};let f=e=>c.current?.contentWindow?.postMessage(e,location.origin);return(0,U.useEffect)(()=>{let e=e=>{if(e.origin!==location.origin||e.source!==c.current?.contentWindow)return;let t=e.data;t.type===`yx-preview-size`&&typeof t.height==`number`&&u(Math.min(Me,Math.max(je,Math.ceil(t.height)))),t.type===`yx-preview-ready`&&(f({type:`yx-preview-tokens`,tokens:d.current.tokens}),f({type:`yx-preview-vars`,vars:d.current.vars}),f({type:`yx-preview-state`,state:d.current.pinned}),f({type:`yx-preview-focus`,focus:d.current.focus}))};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[]),(0,U.useEffect)(()=>f({type:`yx-preview-vars`,vars:n}),[n]),(0,U.useEffect)(()=>f({type:`yx-preview-state`,state:r}),[r]),(0,U.useEffect)(()=>f({type:`yx-preview-tokens`,tokens:i}),[i]),(0,U.useEffect)(()=>f({type:`yx-preview-focus`,focus:o}),[o]),(0,U.useEffect)(()=>{a>0&&f({type:`yx-preview-replay`})},[a]),(0,W.jsxs)(`figure`,{className:v(`min-w-0 overflow-hidden rounded-lg border border-line`,s),children:[(0,W.jsx)(`figcaption`,{className:`flex h-7 items-center border-b border-line bg-sunken px-3 text-caption text-muted capitalize`,children:t}),(0,W.jsx)(`iframe`,{ref:c,src:`${Ae}preview.html?screen=${e}&scheme=${t}`,title:`Live preview, ${t}`,className:`block w-full border-0`,style:{height:l}})]})}function Fe({vars:e,tokens:t,pinned:n,onPinned:r,screen:i,onScreen:a}){let[o,s]=(0,U.useState)(`light`),[c,l]=(0,U.useState)(0);return(0,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(M,{label:`Preview screen`,value:i,onChange:a,options:w,wrap:!0}),(0,W.jsx)(M,{label:`Pin a state`,value:n??`rest`,onChange:e=>r(e===`rest`?null:e),options:Ne,wrap:!0}),i===`motion`&&(0,W.jsxs)(C,{size:`sm`,onClick:()=>l(e=>e+1),children:[(0,W.jsx)(ye,{}),` Play`]}),(0,W.jsx)(M,{label:`Scheme`,value:o,onChange:s,options:[{value:`light`,label:`Light`},{value:`dark`,label:`Dark`}],className:`md:hidden`})]}),(0,W.jsx)(`div`,{className:`grid gap-3 xl:grid-cols-2`,children:[`light`,`dark`].map(r=>(0,W.jsx)(Pe,{screen:i,scheme:r,vars:e,pinned:n,tokens:t,replay:c,className:v(r!==o&&`max-md:hidden`)},`${i}:${r}`))})]})}function Ie(){let[e,t]=(0,U.useState)(!1),n=(0,U.useRef)(null);return[(0,U.useCallback)(e=>{n.current?.disconnect(),e&&(n.current=new ResizeObserver(()=>t(e.scrollHeight>e.clientHeight+1)),n.current.observe(e),e.firstElementChild&&n.current.observe(e.firstElementChild))},[]),e]}function Le({vars:e,tokens:t,pinned:n,onPinned:r,screen:i,onScreen:o,focus:s}){let[c,l]=(0,U.useState)(!0),[u,d]=(0,U.useState)(!1),[f,p]=(0,U.useState)(0),m=(0,U.useId)(),[h,g]=Ie(),_=(0,U.useRef)(null),y=(0,U.useCallback)(e=>{_.current=e,h(e)},[h]),b=s?[...w,{value:`token`,label:`Edited`}]:w;return(0,U.useEffect)(()=>{_.current&&(_.current.scrollTop=0)},[i,s?.path]),(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,W.jsx)(`select`,{"aria-label":`Preview screen`,value:i,onChange:e=>o(e.target.value),className:v(G,`h-8 min-w-0 flex-1 pr-7`),children:b.map(e=>(0,W.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,W.jsx)(`select`,{"aria-label":`Pin a state`,value:n??`rest`,onChange:e=>r(e.target.value===`rest`?null:e.target.value),className:v(G,`h-8 w-[6.5rem] shrink-0 pr-7`),children:Ne.map(e=>(0,W.jsx)(`option`,{value:e.value,children:e.label},e.value))}),i===`motion`&&(0,W.jsx)(C,{size:`icon`,"aria-label":`Play the motion`,title:`Play the motion`,onClick:()=>p(e=>e+1),children:(0,W.jsx)(ye,{})}),c&&(g||u)&&(0,W.jsx)(C,{size:`icon`,variant:`ghost`,className:`shrink-0`,"aria-pressed":u,"aria-controls":m,"aria-label":`Taller preview`,title:u?`Shorter preview`:`Taller preview`,onClick:()=>d(e=>!e),children:u?(0,W.jsx)(V,{}):(0,W.jsx)(_e,{})}),(0,W.jsx)(C,{size:`icon`,variant:`ghost`,className:`shrink-0`,"aria-expanded":c,"aria-controls":m,"aria-label":c?`Fold the preview`:`Show the preview`,title:c?`Fold the preview`:`Show the preview`,onClick:()=>l(e=>!e),children:c?(0,W.jsx)(z,{}):(0,W.jsx)(a,{})})]}),(0,W.jsx)(`div`,{id:m,hidden:!c,ref:y,tabIndex:g?0:void 0,role:g?`region`:void 0,"aria-label":g?`Preview, scrolls with the arrow keys`:void 0,className:v(`overflow-y-auto overscroll-contain rounded-lg outline-none focus-visible:ring-2 focus-visible:ring-focus`,u?`max-h-[60dvh]`:`max-h-[24vh]`),children:(0,W.jsx)(`div`,{inert:!0,className:`grid grid-cols-2 gap-2`,children:[`light`,`dark`].map(r=>(0,W.jsx)(Pe,{screen:i,scheme:r,vars:e,pinned:n,tokens:t,replay:f,focus:s},`${i}:${r}`))})})]})}var Re=[{value:`color`,label:`Colour`},{value:`type`,label:`Type`},{value:`space`,label:`Spacing`},{value:`radius`,label:`Radius`},{value:`border`,label:`Border`},{value:`shadow`,label:`Shadow`},{value:`motion`,label:`Motion`},{value:`focus`,label:`Focus`},{value:`other`,label:`Other`}],ze=[`hover`,`active`,`focus`,`disabled`];function J(e){switch(e.type){case`color`:return`color`;case`typography`:case`fontFamily`:case`fontWeight`:return`type`;case`dimension`:return/(?:^|\.)(?:radius|radii|rounded|corner)/.test(e.path)?`radius`:/(?:^|\.)(?:border|stroke|line-width|outline)/.test(e.path)?`border`:`space`;case`border`:case`strokeStyle`:return`border`;case`shadow`:return`shadow`;case`duration`:case`cubicBezier`:case`transition`:case`spring`:return`motion`;case`focusRing`:return`focus`;default:return`other`}}function Be(e,t,n,r){return{system:e,prefix:t,tokens:n,byPath:new Map(n.map(e=>[e.path,e])),contracts:r}}var Ve=e=>e.source!==void 0;function Y(e,t){return e.tokens.find(e=>e.path===t)}function X(e,t){let n=e.source??{light:e.light,dark:e.dark};return t===`light`||!e.darkOwn?n.light:n.dark}function Z(e,t,n,r){let i=e.byPath.get(n);if(!i)return;let a=Y(t,n),o=a?.light===void 0?X(i,`light`):a.light;return r===`light`||a?.dark===null?o:a?.dark===void 0?i.darkOwn?X(i,`dark`):o:a.dark}function He(e,t){return t?.dark===null?!1:t?.dark!==void 0||e.darkOwn===!0}function Ue(e,t,n,r){return I(Z(e,t,n,r),n=>Z(e,t,n,r))}function We(e,t,n,r){let i=e.byPath.get(n);if(!i)return``;try{return pe(i.type,Ue(e,t,n,r))}catch{return``}}function Ge(e,t,n,r){return N(e,`${t.split(`/`).at(-1)}-${n}-${r.replace(/\./g,`-`)}`)}function Ke(e,t){let n=(t,n=``)=>`var(${e.byPath.get(t)?.cssVar??N(e.prefix,t.replace(/\./g,`-`))}${n})`,r={light:{},dark:{}};for(let i of t.tokens){let a=e.byPath.get(i.path);if(a)for(let o of[`light`,`dark`]){let s=Z(e,t,i.path,o);if(!L(s,X(a,o)))try{for(let[e,t]of fe(a.type,s,n))r[o][`${a.cssVar}${e}`]=t}catch{}}}for(let i of t.states){let t=i.token.split(`/token/`)[1]??``,a=e.byPath.get(t);if(a)for(let o of P(a.type)){let a=`${Ge(e.prefix,i.component,i.state,i.role)}${o}`;r.light[a]=r.dark[a]=n(t,o)}}return r}function qe(e,t){let n=(n,r)=>{let i=e.byPath.get(n);return t?We(e,t,n,r):i[r]},r=e.tokens.filter(e=>e.type===`color`).map(e=>({path:e.path,type:`color`,light:n(e.path,`light`),dark:n(e.path,`dark`)})),i=(n,r)=>t?Ue(e,t,n,r):I(X(e.byPath.get(n),r),t=>e.byPath.get(t)?X(e.byPath.get(t),r):void 0),a=new Map;for(let t of e.tokens.filter(e=>e.type===`focusRing`)){let e=e=>{try{return pe(`color`,i(t.path,e).color)}catch{return``}};r.push({path:`${t.path}.color`,type:`color`,light:e(`light`),dark:e(`dark`)}),a.set(t.path,{color:`${t.path}.color`,offset:h(i(t.path,`light`))})}let o=e.tokens.filter(e=>e.type===`typography`).map(e=>m(e.path,i(e.path,`light`))),s=e=>e.split(`/token/`)[1]??e;return{tokens:r,rings:a,typography:o,contracts:e.contracts.map(e=>{let n={};for(let[t,r]of Object.entries(e.states??{}))n[t]=Object.fromEntries(Object.entries(r??{}).map(([e,t])=>[e,s(t)]));for(let r of t?.states??[])r.component===e.id&&(n[r.state]={...n[r.state],[r.role]:s(r.token)});return{id:e.id,name:e.name,tokens:Object.fromEntries(Object.entries(e.tokens).map(([e,t])=>[e,s(t)])),states:n}})}}function Je(e,t){let n=e=>p(g(e.tokens,e.contracts,{focusRings:e.rings,typography:e.typography}),e.tokens),r=new Map(n(qe(e,null)).map(e=>[`${e.pair.key}|${e.scheme}`,e]));return n(qe(e,t)).filter(e=>!e.passes).map(e=>({...e,isNew:r.get(`${e.pair.key}|${e.scheme}`)?.passes!==!1})).sort((e,t)=>Number(t.isNew)-Number(e.isNew)||(e.ratio??0)-(t.ratio??0))}var Ye={title:``,tokens:[],states:[]};function Xe(e,t,n){let r=e.tokens.filter(e=>e.path!==t),i=Object.fromEntries(Object.entries(n).filter(([e,t])=>e!==`path`&&t!==void 0)),a=Object.keys(i).length===0?r:[...r,{path:t,...i}].sort((e,t)=>e.path.localeCompare(t.path));return{...e,tokens:a}}function Ze(e,t,n){switch(n.type){case`token`:{let r=e.byPath.get(n.path);if(!r)return t;let i=Y(t,n.path)??{path:n.path};if(n.scheme===`light`)return Xe(t,n.path,{...i,light:L(n.value,X(r,`light`))?void 0:n.value});let a=!r.darkOwn&&L(n.value,Z(e,t,n.path,`light`)),o=r.darkOwn&&L(n.value,X(r,`dark`));return Xe(t,n.path,{...i,dark:a||o?void 0:n.value})}case`reset-token`:return{...t,tokens:t.tokens.filter(e=>e.path!==n.path)};case`dark-own`:{let r=Y(t,n.path)??{path:n.path};return Xe(t,n.path,{...r,dark:Z(e,t,n.path,`dark`)})}case`dark-follows`:{let r=e.byPath.get(n.path),i=Y(t,n.path)??{path:n.path};return Xe(t,n.path,{...i,dark:r?.darkOwn?null:void 0})}case`state`:{let r=t.states.filter(e=>e.component!==n.component||e.state!==n.state||e.role!==n.role),i=e.contracts.find(e=>e.id===n.component)?.states?.[n.state]?.[n.role]===n.token?r:[...r,{component:n.component,state:n.state,role:n.role,token:n.token}];return{...t,states:i}}case`reset-state`:return{...t,states:t.states.filter(e=>e.component!==n.component||e.state!==n.state||e.role!==n.role)};case`title`:return{...t,title:n.title};case`replace`:return n.content}}var Q=e=>e.tokens.length+e.states.length,Qe=e=>F(e),$e={hover:`Hover`,active:`Pressed`,focus:`Keyboard focus`,disabled:`Disabled`};function et({model:e,content:t,dispatch:n,onPin:r,pinned:i}){let a=e.contracts.filter(e=>e.states&&Object.keys(e.states).length>0);if(a.length===0)return(0,W.jsxs)(S,{icon:c,title:`No component declares states`,children:[`Add `,(0,W.jsx)(`code`,{className:`font-mono text-mono-sm`,children:`states`}),` to a contract (hover, active, focus, disabled → role → token) and the token build gives its implementation one variable per binding to read.`]});let o=e=>e.split(`/token/`)[1]??e;return(0,W.jsx)(`div`,{className:`space-y-4`,children:a.map(a=>(0,W.jsxs)(`section`,{className:`space-y-3 rounded-lg border border-line p-3`,"aria-label":`${a.name} states`,children:[(0,W.jsx)(`h3`,{className:`text-heading`,children:a.name}),ze.filter(e=>a.states?.[e]).map(s=>(0,W.jsxs)(`fieldset`,{onFocus:()=>r(s),className:v(`space-y-1.5 rounded-md p-2`,i===s?`bg-raised`:``),children:[(0,W.jsxs)(`legend`,{className:`flex items-center gap-2 text-small font-medium text-ink-2`,children:[$e[s],i===s&&(0,W.jsx)(E,{tone:`accent`,children:`Pinned in preview`})]}),Object.entries(a.states[s]).map(([r,i])=>{let c=t.states.find(e=>e.component===a.id&&e.state===s&&e.role===r),l=c?.token??i,u=e.byPath.get(o(i))?.type,d=e.tokens.filter(e=>e.type===u),f=`${a.name} ${s} ${r}`;return(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(`code`,{className:`w-24 shrink-0 font-mono text-mono-sm text-muted`,children:r}),(0,W.jsx)(`select`,{"aria-label":f,value:l,onChange:e=>n({type:`state`,component:a.id,state:s,role:r,token:e.target.value}),className:v(G,`h-7 min-w-0 flex-1 pr-7 font-mono text-mono-sm`),children:d.map(e=>(0,W.jsx)(`option`,{value:e.id,children:e.path},e.id))}),c&&(0,W.jsx)(De,{label:`Reset ${f}`,onClick:()=>n({type:`reset-state`,component:a.id,state:s,role:r})})]},r)})]},s))]},a.id))})}var tt=(0,U.createContext)(()=>``),nt=new Set([`color`,`shadow`,`border`,`focusRing`,`gradient`]),rt=[100,200,300,400,500,600,700,800,900],it=[`solid`,`dashed`,`dotted`,`double`],at=[[`ease`,[.25,.1,.25,1]],[`ease-in`,[.42,0,1,1]],[`ease-out`,[0,0,.58,1]],[`ease-in-out`,[.42,0,.58,1]]],ot=(e,t,n)=>e.tokens.filter(e=>e.type===t&&e.path!==n&&e.source).map(e=>e.path);function $({model:e,type:t,value:n,onChange:r,label:i,self:a,compact:o}){let s=Qe(n),c=ot(e,t,a),l=s?e.byPath.get(s):void 0,u=(0,U.useContext)(tt),d=()=>I(n,t=>e.byPath.get(t)?.source?.light);return(0,W.jsxs)(`span`,{className:`inline-flex min-w-0 flex-wrap items-center gap-1.5`,children:[(c.length>0||s)&&(0,W.jsx)(Te,{label:`${i}: own value or alias`,value:s,options:c,onChange:e=>r(e?`{${e}}`:d())}),s?(0,W.jsx)(`span`,{className:`truncate font-mono text-mono-sm text-muted`,children:l?u(l.path)||l.light:`unknown token`}):(0,W.jsx)(ct,{model:e,type:t,value:n,onChange:r,label:i,compact:o,...a?{self:a}:{}})]})}function st({label:e,value:t,onChange:n,step:r=1,units:i=[`px`,`rem`]}){return(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,W.jsx)(q,{label:e,value:t.value,step:t.unit===`rem`||t.unit===`s`?r/10:r,onChange:e=>n({...t,value:e})}),(0,W.jsx)(Ee,{label:`${e} unit`,value:t.unit,options:i,onChange:e=>n({...t,unit:e})})]})}function ct({model:e,type:t,value:n,onChange:r,label:i,compact:a}){switch(t){case`color`:return typeof n==`object`&&n?(0,W.jsx)(we,{label:i,value:n,onChange:r}):(0,W.jsx)(ut,{value:n});case`dimension`:return(0,W.jsx)(st,{label:i,value:n,onChange:r});case`duration`:return(0,W.jsx)(st,{label:i,value:n,onChange:r,step:10,units:[`ms`,`s`]});case`number`:{let e=n;return(0,W.jsx)(q,{label:i,value:e,step:Math.abs(e)<=1?.05:1,onChange:r})}case`fontWeight`:return(0,W.jsx)(Ee,{label:i,value:n,options:rt.includes(n)?rt:[...rt,n],onChange:r});case`fontFamily`:return(0,W.jsx)(lt,{label:i,value:Array.isArray(n)?n:[String(n)],onChange:r});case`strokeStyle`:return typeof n==`string`?(0,W.jsx)(Ee,{label:i,value:n,options:it.includes(n)?it:[...it,n],onChange:r}):(0,W.jsx)(ut,{value:n});case`cubicBezier`:return(0,W.jsx)(pt,{label:i,value:n,onChange:r});case`spring`:return(0,W.jsx)(mt,{label:i,value:n,onChange:r});case`typography`:case`border`:case`transition`:case`focusRing`:return(0,W.jsx)(ft,{model:e,type:t,value:n,onChange:r,label:i,compact:a});case`shadow`:return(0,W.jsx)(ht,{model:e,value:n,onChange:r,label:i});default:return(0,W.jsx)(ut,{value:n})}}function lt({label:e,value:t,onChange:n}){let r=t.join(`, `),[i,a]=(0,U.useState)(r),[o,s]=(0,U.useState)(!1),c=(0,U.useRef)(!1),l=(0,U.useId)();return(0,U.useEffect)(()=>{c.current||a(r)},[r]),(0,W.jsxs)(`span`,{className:`inline-flex max-w-full flex-col gap-1`,children:[(0,W.jsx)(`input`,{"aria-label":e,"aria-invalid":o||void 0,"aria-describedby":o?l:void 0,value:i,spellCheck:!1,onFocus:()=>c.current=!0,onBlur:()=>{c.current=!1,a(r),s(!1)},onChange:e=>{a(e.target.value);let t=e.target.value.split(`,`).map(e=>e.trim()).filter(Boolean),r=t.length>0&&t.every(e=>ge.test(e));s(!r&&e.target.value.trim()!==``),r&&n(t)},className:v(G,`h-7 w-[16rem] max-w-full`,o&&`border-danger`)}),o&&(0,W.jsx)(`span`,{id:l,className:`text-caption text-danger`,children:`Letters, digits, spaces and hyphens only; separate families with commas.`})]})}function ut({value:e}){return(0,W.jsx)(`code`,{className:`truncate font-mono text-mono-sm text-muted`,children:JSON.stringify(e)})}var dt={typography:[[`fontFamily`,`fontFamily`,`Family`],[`fontSize`,`dimension`,`Size`],[`fontWeight`,`fontWeight`,`Weight`],[`lineHeight`,`number`,`Line height`],[`letterSpacing`,`dimension`,`Tracking`]],border:[[`color`,`color`,`Colour`],[`width`,`dimension`,`Width`],[`style`,`strokeStyle`,`Style`]],transition:[[`duration`,`duration`,`Duration`],[`delay`,`duration`,`Delay`],[`timingFunction`,`cubicBezier`,`Easing`]],focusRing:[[`color`,`color`,`Colour`],[`width`,`dimension`,`Width`],[`offset`,`dimension`,`Offset`],[`style`,`strokeStyle`,`Style`]]};function ft({model:e,type:t,value:n,onChange:r,label:i}){return(0,W.jsx)(`div`,{className:`grid w-full gap-1.5`,children:(dt[t]??[]).map(([t,a,o])=>{let s=n[t],c=t===`lineHeight`&&typeof s==`object`&&s?`dimension`:a;return s===void 0?t===`letterSpacing`?(0,W.jsx)(K,{label:o,children:(0,W.jsxs)(C,{size:`sm`,variant:`ghost`,onClick:()=>r({...n,letterSpacing:{value:0,unit:`px`}}),children:[(0,W.jsx)(u,{}),` Add tracking`]})},t):null:(0,W.jsx)(K,{label:o,children:(0,W.jsx)($,{model:e,type:c,value:s,label:`${i} ${o.toLowerCase()}`,onChange:e=>r({...n,[t]:e}),compact:!0})},t)})})}function pt({label:e,value:t,onChange:n}){let r=[`x1`,`y1`,`x2`,`y2`],i=at.find(([,e])=>e.every((e,n)=>e===t[n]))?.[0]??`custom`;return(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(Oe,{points:ke(t),label:`${e}: cubic-bezier(${t.join(`, `)})`}),(0,W.jsx)(`div`,{className:`grid grid-cols-2 gap-x-2 gap-y-1`,children:t.map((i,a)=>(0,W.jsxs)(`label`,{className:`inline-flex items-center gap-1`,children:[(0,W.jsx)(`span`,{"aria-hidden":!0,className:`w-4 font-mono text-mono-sm text-muted`,children:r[a]}),(0,W.jsx)(q,{label:`${e} ${r[a]}`,value:i,step:.01,...a%2==0?{min:0,max:1}:{},onChange:e=>n(t.map((t,n)=>n===a?e:t))})]},r[a]))}),(0,W.jsx)(Ee,{label:`${e} preset`,value:i,options:[`custom`,...at.map(([e])=>e)],onChange:e=>{let t=at.find(([t])=>t===e)?.[1];t&&n([...t])}})]})}function mt({label:e,value:t,onChange:n}){let r=he(t),i=me(t),a=e=>r=>n({...t,[e]:r});return(0,W.jsxs)(`div`,{className:`grid w-full gap-1.5`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,W.jsx)(Oe,{points:r.points,label:`${e}: settle curve, ${r.durationMs} ms`}),(0,W.jsxs)(`p`,{className:`text-small text-muted`,children:[r.settles?(0,W.jsxs)(W.Fragment,{children:[`Settles in `,(0,W.jsxs)(`span`,{className:`tabular text-ink`,children:[r.durationMs,` ms`]})]}):(0,W.jsx)(`span`,{className:`text-warning`,children:`Never settles: add damping`}),(0,W.jsx)(`br`,{}),t.damping<i?`Overshoots (critical damping ≈ ${i.toFixed(1)})`:`No overshoot`]})]}),(0,W.jsx)(K,{label:`Stiffness`,children:(0,W.jsx)(q,{label:`${e} stiffness`,value:t.stiffness,step:10,min:1,onChange:a(`stiffness`)})}),(0,W.jsx)(K,{label:`Damping`,children:(0,W.jsx)(q,{label:`${e} damping`,value:t.damping,step:1,min:0,onChange:a(`damping`)})}),(0,W.jsx)(K,{label:`Mass`,children:(0,W.jsx)(q,{label:`${e} mass`,value:t.mass,step:.1,min:.1,onChange:a(`mass`)})}),(0,W.jsx)(K,{label:`Velocity`,children:(0,W.jsx)(q,{label:`${e} velocity`,value:t.velocity??0,step:.1,onChange:e=>n(e===0?{stiffness:t.stiffness,damping:t.damping,mass:t.mass}:{...t,velocity:e})})})]})}function ht({model:e,value:t,onChange:n,label:r}){let i=Array.isArray(t)?t:[t],a=(e,t)=>n(i.map((n,r)=>r===e?t:n));return(0,W.jsxs)(`div`,{className:`grid w-full gap-2`,children:[i.map((t,o)=>(0,W.jsxs)(`fieldset`,{className:`grid gap-1.5 rounded-md border border-line p-2`,children:[(0,W.jsxs)(`legend`,{className:`px-1 text-caption text-muted`,children:[`Layer `,o+1]}),(0,W.jsx)(K,{label:`Colour`,children:(0,W.jsx)($,{model:e,type:`color`,value:t.color,label:`${r} layer ${o+1} colour`,onChange:e=>a(o,{...t,color:e}),compact:!0})}),(0,W.jsxs)(K,{label:`x, y`,children:[(0,W.jsx)($,{model:e,type:`dimension`,value:t.offsetX,label:`${r} layer ${o+1} x`,onChange:e=>a(o,{...t,offsetX:e}),compact:!0}),(0,W.jsx)($,{model:e,type:`dimension`,value:t.offsetY,label:`${r} layer ${o+1} y`,onChange:e=>a(o,{...t,offsetY:e}),compact:!0})]}),(0,W.jsxs)(K,{label:`Blur, spread`,children:[(0,W.jsx)($,{model:e,type:`dimension`,value:t.blur,label:`${r} layer ${o+1} blur`,onChange:e=>a(o,{...t,blur:e}),compact:!0}),(0,W.jsx)($,{model:e,type:`dimension`,value:t.spread,label:`${r} layer ${o+1} spread`,onChange:e=>a(o,{...t,spread:e}),compact:!0})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,W.jsxs)(`label`,{className:`inline-flex items-center gap-2 text-small text-ink-2`,children:[(0,W.jsx)(`input`,{type:`checkbox`,className:`size-3.5 accent-accent`,checked:t.inset===!0,onChange:e=>a(o,e.target.checked?{...t,inset:!0}:(({inset:e,...t})=>t)(t))}),` Inset`]}),i.length>1&&(0,W.jsxs)(C,{size:`sm`,variant:`ghost`,className:`ml-auto`,onClick:()=>n(i.filter((e,t)=>t!==o)),children:[(0,W.jsx)(s,{}),` Remove layer`]})]})]},o)),(0,W.jsxs)(C,{size:`sm`,variant:`ghost`,className:`justify-self-start`,onClick:()=>n([...i,{...i.at(-1)}]),children:[(0,W.jsx)(u,{}),` Add layer`]})]})}function gt({warnings:e}){return e.length===0?null:(0,W.jsx)(`ul`,{className:`space-y-1 rounded-md bg-warning-soft px-2.5 py-1.5`,children:e.map(e=>(0,W.jsxs)(`li`,{className:`flex items-start gap-1.5 text-small text-ink-2`,children:[(0,W.jsx)(_,{"aria-hidden":!0,className:`mt-0.5 size-3.5 shrink-0 text-warning`}),(0,W.jsxs)(`span`,{children:[e.pair.label,` (`,e.scheme,`): `,e.ratio===null?(0,W.jsx)(`span`,{className:`font-medium`,children:e.unreadable}):(0,W.jsxs)(`span`,{className:`tabular font-medium`,children:[e.ratio.toFixed(2),`:1`]}),`, needs `,e.required,`:1`,e.isNew?``:` (already below before these edits)`]})]},`${e.pair.key}|${e.scheme}`))})}function _t({model:e,token:t,content:n,dispatch:r,warnings:i}){let a=Y(n,t.path),o=He(t,a),s=(0,U.useId)(),c=i=>(0,W.jsx)(tt.Provider,{value:t=>We(e,n,t,i),children:(0,W.jsx)($,{model:e,type:t.type,value:Z(e,n,t.path,i),label:`${t.path} ${i}`,self:t.path,onChange:e=>r({type:`token`,path:t.path,scheme:i,value:e})})});return(0,W.jsxs)(`section`,{"aria-labelledby":s,"data-token":t.path,className:v(`space-y-2.5 rounded-lg border p-3`,a?`border-accent/40 bg-accent-soft/30`:`border-line`),children:[(0,W.jsxs)(`header`,{className:`flex min-w-0 items-center gap-2`,children:[(0,W.jsx)(`h3`,{id:s,className:`min-w-0 truncate font-mono text-mono text-ink`,children:t.path}),(0,W.jsx)(E,{tone:`outline`,children:t.type}),a&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(E,{tone:`accent`,children:`Edited`}),(0,W.jsx)(`span`,{className:`ml-auto`,children:(0,W.jsx)(De,{label:`Reset ${t.path}`,onClick:()=>r({type:`reset-token`,path:t.path})})})]})]}),t.description&&(0,W.jsx)(`p`,{className:`text-small text-muted`,children:t.description}),(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsx)(vt,{label:o?`Light`:nt.has(t.type)?`Light & dark`:`Value`,children:c(`light`)}),o?(0,W.jsx)(vt,{label:`Dark`,action:(0,W.jsx)(C,{size:`sm`,variant:`ghost`,onClick:()=>r({type:`dark-follows`,path:t.path}),children:`Follow light`}),children:c(`dark`)}):nt.has(t.type)&&(0,W.jsxs)(C,{size:`sm`,variant:`ghost`,onClick:()=>r({type:`dark-own`,path:t.path}),children:[(0,W.jsx)(y,{}),` Different in dark`]})]}),(0,W.jsx)(gt,{warnings:i})]})}function vt({label:e,action:t,children:n}){return(0,W.jsxs)(`div`,{className:`space-y-1`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`text-caption text-muted`,children:e}),t&&(0,W.jsx)(`span`,{className:`ml-auto`,children:t})]}),(0,W.jsx)(`div`,{className:`min-w-0`,children:n})]})}var yt=new Set([`color`,`dimension`,`border`,`shadow`,`typography`,`focusRing`]),bt=/(?:^|\.)(?:paper|ground|raised|surface|canvas|background|card|sunken)$/,xt=/(?:^|[.-])(?:ink|text|foreground|fg|muted|subtle|faint)(?:-\d)?$/,St=/(?:^|\.)(?:ink|text|foreground|fg)$/,Ct=/(?:^|[.-])(?:line|border|divider|stroke|outline|separator)s?$/,wt=12,Tt={text:`text`,surface:`surface`,border:`border`,ring:`focus ring`,shadow:`shadow`,radius:`corners`,space:`gap and padding`,type:`text`};function Et(e,t){let n=t.split(`.`)[0].toLowerCase();switch(e){case`color`:return/^(?:bg|background|surface|fill|paper|canvas)$/.test(n)?`surface`:/^(?:fg|text|foreground|color|ink|label|icon)$/.test(n)?`text`:/^(?:border|outline|stroke|divider|line)$/.test(n)?`border`:n===`ring`?`ring`:`surface`;case`dimension`:return/radius|rounded|corner/.test(n)?`radius`:/border|stroke|outline/.test(n)?`border`:`space`;case`border`:return`border`;case`shadow`:return`shadow`;case`typography`:return`type`;case`focusRing`:return`ring`;default:return null}}var Dt={border:`border`,focusRing:`ring`,shadow:`shadow`,typography:`type`};function Ot(e,t){return e===`color`?xt.test(t)?`text`:bt.test(t)?`surface`:Ct.test(t)?`border`:null:e===`dimension`?J({type:e,path:t})===`radius`?`radius`:J({type:e,path:t})===`border`?`border`:`space`:Et(e,``)}function kt(e){let t=Qe(e);return t?[t]:Array.isArray(e)?e.flatMap(kt):typeof e==`object`&&e?Object.values(e).flatMap(kt):[]}var At=e=>e.split(`/`).at(-1)??e,jt=e=>e.split(`/token/`)[1]??e;function Mt(e,t,n){let r=e.byPath.get(n);if(!r||!yt.has(r.type))return null;let i=t=>e.byPath.get(t)?.cssVar,a=[],o=new Set,s=e=>{let t=`${e.kind}|${e.cssVar}|${e.on??``}|${e.label}`;o.has(t)||a.length>=wt||(o.add(t),a.push(e))},c=(n,o,u)=>{let d=i(n),f=o?` (via ${o})`:``;for(let t of e.contracts){let i=[[``,t.tokens],...Object.entries(t.states??{}).map(([e,t])=>[`${e} `,t??{}])];for(let[a,o]of i)for(let[i,c]of Object.entries(o)){if(jt(c)!==n)continue;let l=Et(r.type,i);if(!l)continue;let u=i.includes(`.`)?i.slice(i.indexOf(`.`)):``,p=n=>{for(let r of n.flatMap(e=>[`${e}${u}`,e])){let n=o[r]??t.tokens[r],i=n?e.byPath.get(jt(n)):void 0;if(i?.type===`color`)return i.cssVar}},m=l===`text`?p([`bg`,`background`,`surface`]):void 0,h=l===`surface`?p([`fg`,`text`,`foreground`,`color`]):void 0;s({kind:l,type:r.type,label:`${t.name} ${a}${i}${f}`,cssVar:d,...m?{on:m}:{},...h?{fg:h}:{},demo:At(t.id)})}}for(let i of e.tokens)if(!u.has(i.path)&&[`light`,`dark`].some(r=>kt(Z(e,t,i.path,r)).includes(n))){if(i.type===r.type){u.add(i.path);let e=a.length;c(i.path,i.path,u),a.length===e&&l(i.path,i.path)}else Dt[i.type]&&s({kind:Dt[i.type],type:i.type,label:`${i.path}${f}`,cssVar:i.cssVar})}},l=(t,n)=>{let a=i(t),o=n?` (via ${n})`:``,c=Ot(r.type,t);if(r.type!==`color`){c&&s({kind:c,type:r.type,label:`${Tt[c]}${o}`,cssVar:a});return}if(c===`border`)return s({kind:c,type:`color`,label:`border${o}`,cssVar:a});let l=e.tokens.filter(e=>e.type===`color`&&e.path!==t);if(c!==`surface`){let e=l.filter(e=>bt.test(e.path));for(let t of e)s({kind:`text`,type:`color`,label:`on ${t.path}${o}`,cssVar:a,on:t.cssVar});e.length===0&&s({kind:`text`,type:`color`,label:`text${o}`,cssVar:a})}if(c!==`text`){let e=l.find(e=>St.test(e.path));s({kind:`surface`,type:`color`,label:`surface${o}`,cssVar:a,...e?{fg:e.cssVar}:{}})}};c(n,null,new Set([n]));let u=a.length>0;return u||l(n,null),{path:n,type:r.type,cssVar:r.cssVar,uses:a,byName:!u}}var Nt={color:`components`,type:`type`,space:`scale`,radius:`scale`,border:`scale`,shadow:`scale`,motion:`motion`,focus:`focus`,other:`components`,states:`components`},Pt=`(min-width: 64rem)`;function Ft(){return(0,U.useSyncExternalStore)(e=>{let t=matchMedia(Pt);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)},()=>matchMedia(Pt).matches,()=>!0)}function It(){let[e,t]=(0,U.useState)(0),n=(0,U.useRef)(null);return[(0,U.useCallback)(e=>{n.current?.disconnect(),e&&(n.current=new ResizeObserver(()=>t(e.getBoundingClientRect().height)),n.current.observe(e))},[]),e]}var Lt=(e,t)=>`yx-style:${e}:${t??`new`}`;function Rt(e){try{let t=sessionStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}}function zt(){let e=b(),t=ie(),n=/^draft\/(d-[0-9a-f]{10})$/.exec(t[`*`]??``)?.[1]??null;return e.status===`ready`?(0,W.jsx)(Bt,{model:e.value,draftId:n},n??`new`):(0,W.jsx)(x,{state:e,onRetry:ee,what:`the system's tokens`})}function Bt({model:e,draftId:t}){let[n,r]=(0,U.useState)(null),[i,a]=(0,U.useState)(null);return(0,U.useEffect)(()=>{t&&T.draft(t).then(e=>e.kind===`style`?r(e):a(ce(Error(`${t} is a rule draft: open it from Rules.`))),e=>a(ce(e)))},[t]),t&&i?(0,W.jsx)(S,{icon:te,title:`This draft could not be opened`,actions:(0,W.jsx)(C,{asChild:!0,children:(0,W.jsx)(ne,{href:`/style`,children:`Start new edits`})}),children:i.message}):t&&!n?(0,W.jsx)(se,{}):(0,W.jsx)(Vt,{model:e,initialDraft:n})}function Vt({model:e,initialDraft:t}){let[,n]=oe(),{system:r}=e.catalog,a=(0,U.useMemo)(()=>Be(r.id,r.cssPrefix,[...e.tokens.values()],e.catalog.components.map(e=>e.contract)),[e,r]),[o,s]=(0,U.useState)(t),c=Lt(r.id,o?.id??null),[u,p]=(0,U.useReducer)((e,t)=>Ze(a,e,t),void 0,()=>Rt(c)??t?.content??Ye),[m,h]=(0,U.useState)(`color`),[g,_]=(0,U.useState)(`components`),y=Ft(),[b,ee]=(0,U.useState)(null),x=(0,U.useCallback)(e=>{p(e),`path`in e&&(ee(e.path),!y&&yt.has(a.byPath.get(e.path)?.type??``)&&_(`token`))},[y,a]),[ie,se]=It(),[w,le]=(0,U.useState)(``),[D,O]=(0,U.useState)(null),[k,A]=(0,U.useState)(!1),[j,N]=(0,U.useState)(null),[fe,pe]=(0,U.useState)(!1);(0,U.useEffect)(()=>{T.info().then(()=>pe(!1),e=>pe(ce(e).offline))},[]),(0,U.useEffect)(()=>{try{o&&L(u,o.content)?sessionStorage.removeItem(c):sessionStorage.setItem(c,JSON.stringify(u))}catch{}},[u,o,c]);let P=!o||o.status===`draft`||o.status===`previewed`||o.status===`approved`,F=o?!L(u,o.content):Q(u)>0,I=(0,U.useMemo)(()=>Ke(a,u),[a,u]),me=(0,U.useMemo)(()=>Je(a,u),[a,u]),he=(0,U.useMemo)(()=>b?Mt(a,u,b):null,[a,u,b]),ge=(0,U.useMemo)(()=>a.tokens.map(e=>({path:e.path,type:e.type,cssVar:e.cssVar})),[a]),R=a.tokens.filter(Ve),z=(0,U.useCallback)(async()=>{if(P&&!k){A(!0),N(null);try{let e=o?await T.save(o.id,o.revision,u):await T.createStyle(u);if(e.kind!==`style`)throw Error(`the service returned a rule draft`);try{sessionStorage.removeItem(Lt(r.id,null))}catch{}s(e),o||n(`/style/draft/${e.id}`,{replace:!0})}catch(e){N(ce(e))}finally{A(!1)}}},[P,k,o,u,r.id,n]);(0,U.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`s`&&(e.preventDefault(),F&&z())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[F,z]);let B=(0,U.useMemo)(()=>{let e=new Map;for(let t of R)e.set(J(t),(e.get(J(t))??0)+1);return e},[R]),_e=a.contracts.filter(e=>e.states&&Object.keys(e.states).length>0).length,ve=[...Re.filter(e=>(B.get(e.value)??0)>0).map(e=>({value:e.value,label:e.label,count:B.get(e.value)??0})),{value:`states`,label:`States`,count:_e}],V=w.trim().toLowerCase(),H=R.filter(e=>J(e)===m&&(!V||e.path.toLowerCase().includes(V)||(e.description??``).toLowerCase().includes(V))),ye=e=>me.filter(t=>t.pair.foreground===e||t.pair.background===e||t.pair.foreground===`${e}.color`);return R.length===0?(0,W.jsxs)(S,{icon:l,title:`This snapshot cannot be edited yet`,children:[`It was built before the style editor. Run `,(0,W.jsx)(`code`,{className:`font-mono text-mono-sm`,children:`pnpm data`}),` (or `,(0,W.jsx)(`code`,{className:`font-mono text-mono-sm`,children:`youiyoux ui`}),`) again.`]}):(0,W.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,W.jsxs)(ae,{title:`Style`,count:Q(u),children:[o&&(0,W.jsx)(C,{size:`sm`,variant:`ghost`,asChild:!0,children:(0,W.jsxs)(ne,{href:`/changes/${o.id}`,children:[`Review `,(0,W.jsx)(i,{})]})}),Q(u)>0&&P&&(0,W.jsx)(C,{size:`icon-sm`,variant:`ghost`,"aria-label":`Undo every unsaved edit`,title:`Undo every unsaved edit`,disabled:!F,onClick:()=>x({type:`replace`,content:o?.content??Ye}),children:(0,W.jsx)(xe,{})}),P&&(0,W.jsx)(C,{size:`sm`,variant:F?`primary`:`outline`,disabled:!F||k||fe,onClick:()=>void z(),children:k?`Saving…`:o?`Save draft`:`Save as draft`})]}),fe&&(0,W.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-2 border-b border-line bg-warning-soft px-4 py-2 text-small text-ink-2`,children:[(0,W.jsx)(te,{"aria-hidden":!0,className:`size-4 shrink-0 text-warning`}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Editing and the live preview work here; saving a draft needs the local workflow service.`}),(0,W.jsx)(d,{})]}),j&&(0,W.jsxs)(`div`,{role:`alert`,className:`border-b border-line bg-danger-soft px-4 py-2 text-small text-ink-2`,children:[(0,W.jsx)(`p`,{className:`font-medium`,children:j.message}),j.problems.map(e=>(0,W.jsx)(`p`,{children:e},e))]}),o&&!P&&(0,W.jsxs)(`div`,{role:`status`,className:`border-b border-line bg-raised px-4 py-2 text-small text-ink-2`,children:[`This draft is `,o.status.replace(`-`,` `),`: it can no longer change. `,(0,W.jsx)(ne,{href:`/style`,className:`font-medium text-accent hover:underline`,children:`Start new edits`})]}),(0,W.jsxs)(`div`,{className:`min-h-0 flex-1 max-lg:flex max-lg:flex-col max-lg:overflow-y-auto lg:grid lg:grid-cols-[minmax(22rem,30rem)_minmax(0,1fr)]`,style:y?void 0:{scrollPaddingTop:se+8},children:[!y&&(0,W.jsx)(`section`,{ref:ie,"aria-label":`Live preview`,className:`sticky top-0 z-10 shrink-0 border-b border-line bg-canvas px-4 py-2 shadow-raise`,children:(0,W.jsx)(Le,{vars:I,tokens:ge,pinned:D,onPinned:O,screen:g,onScreen:_,focus:he})}),(0,W.jsxs)(`section`,{"aria-label":`Edit tokens and states`,className:`min-w-0 space-y-4 p-4 lg:overflow-y-auto lg:border-r lg:border-line`,children:[(0,W.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,W.jsx)(`label`,{htmlFor:`style-title`,className:`block text-small font-medium text-ink-2`,children:`Change`}),(0,W.jsx)(ue,{id:`style-title`,value:u.title,placeholder:`Name this change (Warmer brand, Rounder controls…)`,disabled:!P,onChange:e=>x({type:`title`,title:e.target.value})}),(0,W.jsxs)(`p`,{className:`flex flex-wrap items-center gap-1.5 text-small text-muted`,children:[o?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(E,{tone:`outline`,children:o.id}),` revision `,o.revision,F?` · unsaved edits`:` · saved`]}):`${Q(u)} unsaved edit(s), kept in this tab`,F&&P&&(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[`· save `,(0,W.jsx)(re,{keys:[`⌘`,`S`]})]})]})]}),(0,W.jsx)(Se,{warnings:me}),(0,W.jsx)(M,{label:`Token group`,value:m,onChange:e=>{h(e),le(``),_(Nt[e])},options:ve,wrap:!0}),m===`states`?(0,W.jsx)(et,{model:a,content:u,dispatch:P?x:()=>void 0,onPin:O,pinned:D}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(de,{value:w,onChange:le,label:`Filter tokens`,placeholder:`Filter by path or description…`}),H.length===0?(0,W.jsxs)(S,{icon:f,title:`No tokens match`,children:[`Nothing in `,Re.find(e=>e.value===m)?.label.toLowerCase(),` matches “`,w.trim(),`”.`]}):(0,W.jsxs)(`fieldset`,{disabled:!P,className:v(`space-y-3`,!P&&`opacity-70`),children:[(0,W.jsxs)(`legend`,{className:`sr-only`,children:[Re.find(e=>e.value===m)?.label,` tokens`]}),H.map(e=>(0,W.jsx)(_t,{model:a,token:e,content:u,dispatch:x,warnings:ye(e.path)},e.path))]})]})]}),y&&(0,W.jsx)(`section`,{"aria-label":`Live preview`,className:`min-w-0 p-4 lg:overflow-y-auto`,children:(0,W.jsx)(Fe,{vars:I,tokens:ge,pinned:D,onPinned:O,screen:g===`token`?Nt[m]:g,onScreen:_})})]})]})}export{zt as StyleScreen};
1
+ import{i as e,t}from"./react-DB-4Zxce.js";import{t as n}from"./jsx-runtime-D6zNwnaE.js";import{t as r}from"./createLucideIcon-CGDJWtKO.js";import{t as i}from"./arrow-right-DcbNDzqs.js";import{t as a}from"./chevron-down-CzN07vMi.js";import{t as o}from"./circle-check-DkwBMT62.js";import{t as s}from"./minus-BDifFhOo.js";import{t as c}from"./mouse-pointer-click-CVJ6hWg8.js";import{t as l}from"./paintbrush-DOkEgSTO.js";import{i as u,r as d}from"./ServiceDown-BghtjpTn.js";import{c as f,i as p,n as m,o as h,s as g}from"./contrast-B-uhyF_b.js";import{t as _}from"./triangle-alert-Dkdi9eDR.js";import{t as v}from"./clsx-DB0hHKMi.js";import{E as y,H as b,L as ee,T as te,dt as ne,f as re,i as x,mt as ie,n as ae,o as S,pt as oe,r as se,s as C}from"./main-Djqho539.js";import{t as w}from"./protocol-caP6umNL.js";import{a as T,n as ce}from"./workflow-Bv814-L8.js";import{n as le,t as E}from"./Badge-CUJUit4d.js";import{o as ue,t as D}from"./Field-LwrJXoOs.js";import{t as O}from"./Swatch-KDz4qxdM.js";import{i as k,n as A,t as j}from"./color-C6bxX90C.js";import{t as M}from"./Segmented-CTMaLPgh.js";import{t as de}from"./SearchField-ByftoJws.js";import{a as N,c as fe,i as pe,l as P,n as F,o as I,r as me,s as he,t as ge,u as L}from"./values-cLekxBZj.js";var R={name:`chevron-up`,size:24,node:[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]};R.node;var z=r(R),B={name:`maximize-2`,size:24,node:[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]};B.node;var _e=r(B),ve={name:`minimize-2`,size:24,node:[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]};ve.node;var V=r(ve),H={name:`play`,size:24,node:[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]};H.node;var ye=r(H),be={name:`rotate-ccw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]};be.node;var xe=r(be),U=e(t(),1),W=n();function Se({warnings:e}){let t=e.filter(e=>e.isNew).length;return(0,W.jsxs)(`section`,{"aria-labelledby":`contrast-heading`,className:`space-y-2`,children:[(0,W.jsxs)(`header`,{className:`flex items-center gap-2`,children:[e.length>0?(0,W.jsx)(_,{"aria-hidden":!0,className:`size-4 text-warning`}):(0,W.jsx)(o,{"aria-hidden":!0,className:`size-4 text-success`}),(0,W.jsx)(`h3`,{id:`contrast-heading`,className:`text-heading`,children:`Contrast`}),(0,W.jsx)(`span`,{className:`text-small text-muted`,role:`status`,children:e.length===0?`every checked pair meets WCAG AA`:`${e.length} pair(s) below WCAG AA${t?`, ${t} from these edits`:``}`})]}),e.length>0&&(0,W.jsx)(`ul`,{className:`max-h-64 divide-y divide-line overflow-y-auto rounded-md border border-line`,children:e.map(e=>(0,W.jsxs)(`li`,{className:`flex items-center gap-2.5 px-3 py-2`,children:[(0,W.jsx)(`span`,{"aria-hidden":!0,className:`edge grid size-7 shrink-0 place-items-center rounded-sm text-small font-semibold`,style:{background:e.background,color:e.foreground},children:`Aa`}),(0,W.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`span`,{className:`block truncate text-small text-ink`,children:e.pair.label}),(0,W.jsxs)(`span`,{className:`block text-caption text-muted`,children:[(0,W.jsx)(`span`,{className:`capitalize`,children:e.scheme}),` · needs `,e.required,`:1 `,e.pair.kind===`ui`?`(UI part)`:e.pair.kind===`large`?`(large text)`:`(text)`,e.unreadable&&(0,W.jsx)(`span`,{className:`block truncate text-danger`,children:e.unreadable})]})]}),(0,W.jsx)(`span`,{className:`tabular font-mono text-mono-sm text-ink`,children:e.ratio?.toFixed(2)??`?`}),e.grade?(0,W.jsx)(E,{tone:le[e.grade],children:e.grade}):(0,W.jsx)(E,{tone:`danger`,children:`Unreadable`}),e.isNew&&(0,W.jsx)(E,{tone:`danger`,children:`New`})]},`${e.pair.key}|${e.scheme}`))})]})}var G=D.replace(`w-full `,``);function K({label:e,htmlFor:t,children:n,hint:r}){return(0,W.jsxs)(`div`,{className:`grid grid-cols-[6.5rem_minmax(0,1fr)] items-center gap-x-3 gap-y-1 max-sm:grid-cols-1`,children:[(0,W.jsx)(`label`,{htmlFor:t,className:`text-small text-muted`,children:e}),(0,W.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1.5`,children:n}),r&&(0,W.jsx)(`p`,{className:`col-start-2 text-caption text-muted max-sm:col-start-1`,children:r})]})}var Ce=(e,t)=>{let n=Math.max(0,-Math.floor(Math.log10(t)));return Number(e.toFixed(Math.min(n+1,4)))};function q({label:e,value:t,onChange:n,step:r=1,min:i,max:a,unit:o,className:s,disabled:c,id:l}){let[u,d]=(0,U.useState)(String(t)),f=(0,U.useRef)(t),p=(0,U.useRef)(!1);(0,U.useEffect)(()=>{(!p.current||Number(u)!==t)&&d(String(t))},[t]);let m=e=>Math.min(a??1/0,Math.max(i??-1/0,e)),h=e=>{let t=m(Ce(e,r));d(String(t)),n(t)};return(0,W.jsxs)(`span`,{className:v(`relative inline-flex items-center`,s),children:[(0,W.jsx)(`input`,{id:l,type:`text`,inputMode:`decimal`,"aria-label":e,disabled:c,value:u,spellCheck:!1,autoComplete:`off`,onFocus:()=>{p.current=!0,f.current=t},onBlur:()=>{p.current=!1,d(String(t))},onChange:e=>{d(e.target.value);let t=Number(e.target.value);e.target.value.trim()!==``&&Number.isFinite(t)&&t===m(t)&&n(t)},onKeyDown:e=>{e.key===`ArrowUp`||e.key===`ArrowDown`?(e.preventDefault(),h((Number.isFinite(Number(u))?Number(u):t)+(e.key===`ArrowUp`?1:-1)*r*(e.shiftKey?10:1))):e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),h(f.current))},className:v(G,`h-7 w-[5.5rem] tabular`,o&&`pr-8`)}),o&&(0,W.jsx)(`span`,{className:`pointer-events-none absolute right-2 text-caption text-muted`,children:o})]})}function we({label:e,value:t,onChange:n,disabled:r}){let i=j(t),[a,o]=(0,U.useState)(i),s=(0,U.useRef)(t),[c,l]=(0,U.useState)(!1),u=(0,U.useId)();(0,U.useEffect)(()=>{o(i),l(!1)},[i]);let d=e=>t.alpha!==void 0&&e.alpha===void 0?{colorSpace:e.colorSpace,components:e.components,alpha:t.alpha,...e.hex?{hex:e.hex}:{}}:e;return(0,W.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1.5`,children:[(0,W.jsxs)(`label`,{className:`relative grid size-7 shrink-0 cursor-pointer place-items-center rounded-md border border-line has-focus-visible:outline-2 has-focus-visible:outline-offset-2 has-focus-visible:outline-focus`,children:[(0,W.jsx)(O,{color:i,size:`sm`}),(0,W.jsx)(`input`,{type:`color`,"aria-label":`${e}: pick`,disabled:r,value:k(t),onChange:e=>{let t=A(e.target.value);t&&n(d(t))},className:`absolute inset-0 size-full cursor-pointer opacity-0`})]}),(0,W.jsx)(`input`,{id:u,type:`text`,"aria-label":e,"aria-invalid":c||void 0,disabled:r,value:a,spellCheck:!1,autoComplete:`off`,onFocus:()=>s.current=t,onChange:e=>{o(e.target.value);let t=A(e.target.value);l(t===null),t&&n(t)},onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),n(s.current),o(j(s.current)),l(!1))},onBlur:()=>{o(i),l(!1)},className:v(G,`h-7 w-[11rem] font-mono text-mono-sm max-sm:w-[9.5rem]`,c&&`border-danger`)})]})}function Te({label:e,value:t,options:n,onChange:r,disabled:i}){return(0,W.jsxs)(`select`,{"aria-label":e,disabled:i,value:t??``,onChange:e=>r(e.target.value||null),className:v(G,`h-7 w-auto max-w-[14rem] pr-7 text-small`),children:[(0,W.jsx)(`option`,{value:``,children:`Own value`}),n.map(e=>(0,W.jsxs)(`option`,{value:e,children:[`Alias of `,e]},e))]})}function Ee({label:e,value:t,options:n,onChange:r,disabled:i}){return(0,W.jsx)(`select`,{"aria-label":e,disabled:i,value:String(t),onChange:e=>r(n.find(t=>String(t)===e.target.value)??t),className:v(G,`h-7 w-auto pr-7`),children:n.map(e=>(0,W.jsx)(`option`,{value:String(e),children:String(e)},String(e)))})}function De({label:e,onClick:t}){return(0,W.jsx)(`button`,{type:`button`,"aria-label":e,title:e,onClick:t,className:`grid size-6 place-items-center rounded-sm text-muted hover:bg-raised hover:text-ink`,children:(0,W.jsx)(xe,{className:`size-3.5`})})}function Oe({points:e,label:t,className:n}){let r=Math.min(0,...e),i=Math.max(1,...e),a=e=>58-(e-r)/(i-r||1)*52,o=e.map((t,n)=>`${n===0?`M`:`L`}${(n/(e.length-1)*120).toFixed(1)},${a(t).toFixed(1)}`).join(` `);return(0,W.jsxs)(`svg`,{role:`img`,"aria-label":t,viewBox:`0 0 120 64`,className:v(`h-16 w-30 shrink-0 rounded-md border border-line bg-sunken`,n),children:[(0,W.jsx)(`line`,{x1:`0`,x2:120,y1:a(1),y2:a(1),className:`stroke-line-strong`,strokeDasharray:`2 3`}),(0,W.jsx)(`line`,{x1:`0`,x2:120,y1:a(0),y2:a(0),className:`stroke-line`}),(0,W.jsx)(`path`,{d:o,fill:`none`,className:`stroke-accent`,strokeWidth:`1.75`,strokeLinejoin:`round`})]})}function ke([e,t,n,r],i=48){let a=(e,t,n)=>3*t*e*(1-e)**2+3*n*e*e*(1-e)+e**3;return Array.from({length:i+1},(o,s)=>{let c=s/i,l=0,u=1;for(let t=0;t<30;t++){let t=(l+u)/2;a(t,e,n)<c?l=t:u=t}return a((l+u)/2,t,r)})}var Ae=`/`,je=200,Me=4e3,Ne=[{value:`rest`,label:`Rest`},{value:`hover`,label:`Hover`},{value:`active`,label:`Active`},{value:`focus`,label:`Focus`},{value:`disabled`,label:`Disabled`}];function Pe({screen:e,scheme:t,vars:n,pinned:r,tokens:i,replay:a,focus:o=null,className:s}){let c=(0,U.useRef)(null),[l,u]=(0,U.useState)(je),d=(0,U.useRef)({vars:n,pinned:r,tokens:i,focus:o});d.current={vars:n,pinned:r,tokens:i,focus:o};let f=e=>c.current?.contentWindow?.postMessage(e,location.origin);return(0,U.useEffect)(()=>{let e=e=>{if(e.origin!==location.origin||e.source!==c.current?.contentWindow)return;let t=e.data;t.type===`yx-preview-size`&&typeof t.height==`number`&&u(Math.min(Me,Math.max(je,Math.ceil(t.height)))),t.type===`yx-preview-ready`&&(f({type:`yx-preview-tokens`,tokens:d.current.tokens}),f({type:`yx-preview-vars`,vars:d.current.vars}),f({type:`yx-preview-state`,state:d.current.pinned}),f({type:`yx-preview-focus`,focus:d.current.focus}))};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[]),(0,U.useEffect)(()=>f({type:`yx-preview-vars`,vars:n}),[n]),(0,U.useEffect)(()=>f({type:`yx-preview-state`,state:r}),[r]),(0,U.useEffect)(()=>f({type:`yx-preview-tokens`,tokens:i}),[i]),(0,U.useEffect)(()=>f({type:`yx-preview-focus`,focus:o}),[o]),(0,U.useEffect)(()=>{a>0&&f({type:`yx-preview-replay`})},[a]),(0,W.jsxs)(`figure`,{className:v(`min-w-0 overflow-hidden rounded-lg border border-line`,s),children:[(0,W.jsx)(`figcaption`,{className:`flex h-7 items-center border-b border-line bg-sunken px-3 text-caption text-muted capitalize`,children:t}),(0,W.jsx)(`iframe`,{ref:c,src:`${Ae}preview.html?screen=${e}&scheme=${t}`,title:`Live preview, ${t}`,className:`block w-full border-0`,style:{height:l}})]})}function Fe({vars:e,tokens:t,pinned:n,onPinned:r,screen:i,onScreen:a}){let[o,s]=(0,U.useState)(`light`),[c,l]=(0,U.useState)(0);return(0,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(M,{label:`Preview screen`,value:i,onChange:a,options:w,wrap:!0}),(0,W.jsx)(M,{label:`Pin a state`,value:n??`rest`,onChange:e=>r(e===`rest`?null:e),options:Ne,wrap:!0}),i===`motion`&&(0,W.jsxs)(C,{size:`sm`,onClick:()=>l(e=>e+1),children:[(0,W.jsx)(ye,{}),` Play`]}),(0,W.jsx)(M,{label:`Scheme`,value:o,onChange:s,options:[{value:`light`,label:`Light`},{value:`dark`,label:`Dark`}],className:`md:hidden`})]}),(0,W.jsx)(`div`,{className:`grid gap-3 xl:grid-cols-2`,children:[`light`,`dark`].map(r=>(0,W.jsx)(Pe,{screen:i,scheme:r,vars:e,pinned:n,tokens:t,replay:c,className:v(r!==o&&`max-md:hidden`)},`${i}:${r}`))})]})}function Ie(){let[e,t]=(0,U.useState)(!1),n=(0,U.useRef)(null);return[(0,U.useCallback)(e=>{n.current?.disconnect(),e&&(n.current=new ResizeObserver(()=>t(e.scrollHeight>e.clientHeight+1)),n.current.observe(e),e.firstElementChild&&n.current.observe(e.firstElementChild))},[]),e]}function Le({vars:e,tokens:t,pinned:n,onPinned:r,screen:i,onScreen:o,focus:s}){let[c,l]=(0,U.useState)(!0),[u,d]=(0,U.useState)(!1),[f,p]=(0,U.useState)(0),m=(0,U.useId)(),[h,g]=Ie(),_=(0,U.useRef)(null),y=(0,U.useCallback)(e=>{_.current=e,h(e)},[h]),b=s?[...w,{value:`token`,label:`Edited`}]:w;return(0,U.useEffect)(()=>{_.current&&(_.current.scrollTop=0)},[i,s?.path]),(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,W.jsx)(`select`,{"aria-label":`Preview screen`,value:i,onChange:e=>o(e.target.value),className:v(G,`h-8 min-w-0 flex-1 pr-7`),children:b.map(e=>(0,W.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,W.jsx)(`select`,{"aria-label":`Pin a state`,value:n??`rest`,onChange:e=>r(e.target.value===`rest`?null:e.target.value),className:v(G,`h-8 w-[6.5rem] shrink-0 pr-7`),children:Ne.map(e=>(0,W.jsx)(`option`,{value:e.value,children:e.label},e.value))}),i===`motion`&&(0,W.jsx)(C,{size:`icon`,"aria-label":`Play the motion`,title:`Play the motion`,onClick:()=>p(e=>e+1),children:(0,W.jsx)(ye,{})}),c&&(g||u)&&(0,W.jsx)(C,{size:`icon`,variant:`ghost`,className:`shrink-0`,"aria-pressed":u,"aria-controls":m,"aria-label":`Taller preview`,title:u?`Shorter preview`:`Taller preview`,onClick:()=>d(e=>!e),children:u?(0,W.jsx)(V,{}):(0,W.jsx)(_e,{})}),(0,W.jsx)(C,{size:`icon`,variant:`ghost`,className:`shrink-0`,"aria-expanded":c,"aria-controls":m,"aria-label":c?`Fold the preview`:`Show the preview`,title:c?`Fold the preview`:`Show the preview`,onClick:()=>l(e=>!e),children:c?(0,W.jsx)(z,{}):(0,W.jsx)(a,{})})]}),(0,W.jsx)(`div`,{id:m,hidden:!c,ref:y,tabIndex:g?0:void 0,role:g?`region`:void 0,"aria-label":g?`Preview, scrolls with the arrow keys`:void 0,className:v(`overflow-y-auto overscroll-contain rounded-lg outline-none focus-visible:ring-2 focus-visible:ring-focus`,u?`max-h-[60dvh]`:`max-h-[24vh]`),children:(0,W.jsx)(`div`,{inert:!0,className:`grid grid-cols-2 gap-2`,children:[`light`,`dark`].map(r=>(0,W.jsx)(Pe,{screen:i,scheme:r,vars:e,pinned:n,tokens:t,replay:f,focus:s},`${i}:${r}`))})})]})}var Re=[{value:`color`,label:`Colour`},{value:`type`,label:`Type`},{value:`space`,label:`Spacing`},{value:`radius`,label:`Radius`},{value:`border`,label:`Border`},{value:`shadow`,label:`Shadow`},{value:`motion`,label:`Motion`},{value:`focus`,label:`Focus`},{value:`other`,label:`Other`}],ze=[`hover`,`active`,`focus`,`disabled`];function J(e){switch(e.type){case`color`:return`color`;case`typography`:case`fontFamily`:case`fontWeight`:return`type`;case`dimension`:return/(?:^|\.)(?:radius|radii|rounded|corner)/.test(e.path)?`radius`:/(?:^|\.)(?:border|stroke|line-width|outline)/.test(e.path)?`border`:`space`;case`border`:case`strokeStyle`:return`border`;case`shadow`:return`shadow`;case`duration`:case`cubicBezier`:case`transition`:case`spring`:return`motion`;case`focusRing`:return`focus`;default:return`other`}}function Be(e,t,n,r){return{system:e,prefix:t,tokens:n,byPath:new Map(n.map(e=>[e.path,e])),contracts:r}}var Ve=e=>e.source!==void 0;function Y(e,t){return e.tokens.find(e=>e.path===t)}function X(e,t){let n=e.source??{light:e.light,dark:e.dark};return t===`light`||!e.darkOwn?n.light:n.dark}function Z(e,t,n,r){let i=e.byPath.get(n);if(!i)return;let a=Y(t,n),o=a?.light===void 0?X(i,`light`):a.light;return r===`light`||a?.dark===null?o:a?.dark===void 0?i.darkOwn?X(i,`dark`):o:a.dark}function He(e,t){return t?.dark===null?!1:t?.dark!==void 0||e.darkOwn===!0}function Ue(e,t,n,r){return I(Z(e,t,n,r),n=>Z(e,t,n,r))}function We(e,t,n,r){let i=e.byPath.get(n);if(!i)return``;try{return pe(i.type,Ue(e,t,n,r))}catch{return``}}function Ge(e,t,n,r){return N(e,`${t.split(`/`).at(-1)}-${n}-${r.replace(/\./g,`-`)}`)}function Ke(e,t){let n=(t,n=``)=>`var(${e.byPath.get(t)?.cssVar??N(e.prefix,t.replace(/\./g,`-`))}${n})`,r={light:{},dark:{}};for(let i of t.tokens){let a=e.byPath.get(i.path);if(a)for(let o of[`light`,`dark`]){let s=Z(e,t,i.path,o);if(!L(s,X(a,o)))try{for(let[e,t]of fe(a.type,s,n))r[o][`${a.cssVar}${e}`]=t}catch{}}}for(let i of t.states){let t=i.token.split(`/token/`)[1]??``,a=e.byPath.get(t);if(a)for(let o of P(a.type)){let a=`${Ge(e.prefix,i.component,i.state,i.role)}${o}`;r.light[a]=r.dark[a]=n(t,o)}}return r}function qe(e,t){let n=(n,r)=>{let i=e.byPath.get(n);return t?We(e,t,n,r):i[r]},r=e.tokens.filter(e=>e.type===`color`).map(e=>({path:e.path,type:`color`,light:n(e.path,`light`),dark:n(e.path,`dark`)})),i=(n,r)=>t?Ue(e,t,n,r):I(X(e.byPath.get(n),r),t=>e.byPath.get(t)?X(e.byPath.get(t),r):void 0),a=new Map;for(let t of e.tokens.filter(e=>e.type===`focusRing`)){let e=e=>{try{return pe(`color`,i(t.path,e).color)}catch{return``}};r.push({path:`${t.path}.color`,type:`color`,light:e(`light`),dark:e(`dark`)}),a.set(t.path,{color:`${t.path}.color`,offset:h(i(t.path,`light`))})}let o=e.tokens.filter(e=>e.type===`typography`).map(e=>m(e.path,i(e.path,`light`))),s=e=>e.split(`/token/`)[1]??e;return{tokens:r,rings:a,typography:o,contracts:e.contracts.map(e=>{let n={};for(let[t,r]of Object.entries(e.states??{}))n[t]=Object.fromEntries(Object.entries(r??{}).map(([e,t])=>[e,s(t)]));for(let r of t?.states??[])r.component===e.id&&(n[r.state]={...n[r.state],[r.role]:s(r.token)});return{id:e.id,name:e.name,tokens:Object.fromEntries(Object.entries(e.tokens).map(([e,t])=>[e,s(t)])),states:n}})}}function Je(e,t){let n=e=>p(g(e.tokens,e.contracts,{focusRings:e.rings,typography:e.typography}),e.tokens),r=new Map(n(qe(e,null)).map(e=>[`${e.pair.key}|${e.scheme}`,e]));return n(qe(e,t)).filter(e=>!e.passes).map(e=>({...e,isNew:r.get(`${e.pair.key}|${e.scheme}`)?.passes!==!1})).sort((e,t)=>Number(t.isNew)-Number(e.isNew)||(e.ratio??0)-(t.ratio??0))}var Ye={title:``,tokens:[],states:[]};function Xe(e,t,n){let r=e.tokens.filter(e=>e.path!==t),i=Object.fromEntries(Object.entries(n).filter(([e,t])=>e!==`path`&&t!==void 0)),a=Object.keys(i).length===0?r:[...r,{path:t,...i}].sort((e,t)=>e.path.localeCompare(t.path));return{...e,tokens:a}}function Ze(e,t,n){switch(n.type){case`token`:{let r=e.byPath.get(n.path);if(!r)return t;let i=Y(t,n.path)??{path:n.path};if(n.scheme===`light`)return Xe(t,n.path,{...i,light:L(n.value,X(r,`light`))?void 0:n.value});let a=!r.darkOwn&&L(n.value,Z(e,t,n.path,`light`)),o=r.darkOwn&&L(n.value,X(r,`dark`));return Xe(t,n.path,{...i,dark:a||o?void 0:n.value})}case`reset-token`:return{...t,tokens:t.tokens.filter(e=>e.path!==n.path)};case`dark-own`:{let r=Y(t,n.path)??{path:n.path};return Xe(t,n.path,{...r,dark:Z(e,t,n.path,`dark`)})}case`dark-follows`:{let r=e.byPath.get(n.path),i=Y(t,n.path)??{path:n.path};return Xe(t,n.path,{...i,dark:r?.darkOwn?null:void 0})}case`state`:{let r=t.states.filter(e=>e.component!==n.component||e.state!==n.state||e.role!==n.role),i=e.contracts.find(e=>e.id===n.component)?.states?.[n.state]?.[n.role]===n.token?r:[...r,{component:n.component,state:n.state,role:n.role,token:n.token}];return{...t,states:i}}case`reset-state`:return{...t,states:t.states.filter(e=>e.component!==n.component||e.state!==n.state||e.role!==n.role)};case`title`:return{...t,title:n.title};case`replace`:return n.content}}var Q=e=>e.tokens.length+e.states.length,Qe=e=>F(e),$e={hover:`Hover`,active:`Pressed`,focus:`Keyboard focus`,disabled:`Disabled`};function et({model:e,content:t,dispatch:n,onPin:r,pinned:i}){let a=e.contracts.filter(e=>e.states&&Object.keys(e.states).length>0);if(a.length===0)return(0,W.jsxs)(S,{icon:c,title:`No component declares states`,children:[`Add `,(0,W.jsx)(`code`,{className:`font-mono text-mono-sm`,children:`states`}),` to a contract (hover, active, focus, disabled → role → token) and the token build gives its implementation one variable per binding to read.`]});let o=e=>e.split(`/token/`)[1]??e;return(0,W.jsx)(`div`,{className:`space-y-4`,children:a.map(a=>(0,W.jsxs)(`section`,{className:`space-y-3 rounded-lg border border-line p-3`,"aria-label":`${a.name} states`,children:[(0,W.jsx)(`h3`,{className:`text-heading`,children:a.name}),ze.filter(e=>a.states?.[e]).map(s=>(0,W.jsxs)(`fieldset`,{onFocus:()=>r(s),className:v(`space-y-1.5 rounded-md p-2`,i===s?`bg-raised`:``),children:[(0,W.jsxs)(`legend`,{className:`flex items-center gap-2 text-small font-medium text-ink-2`,children:[$e[s],i===s&&(0,W.jsx)(E,{tone:`accent`,children:`Pinned in preview`})]}),Object.entries(a.states[s]).map(([r,i])=>{let c=t.states.find(e=>e.component===a.id&&e.state===s&&e.role===r),l=c?.token??i,u=e.byPath.get(o(i))?.type,d=e.tokens.filter(e=>e.type===u),f=`${a.name} ${s} ${r}`;return(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(`code`,{className:`w-24 shrink-0 font-mono text-mono-sm text-muted`,children:r}),(0,W.jsx)(`select`,{"aria-label":f,value:l,onChange:e=>n({type:`state`,component:a.id,state:s,role:r,token:e.target.value}),className:v(G,`h-7 min-w-0 flex-1 pr-7 font-mono text-mono-sm`),children:d.map(e=>(0,W.jsx)(`option`,{value:e.id,children:e.path},e.id))}),c&&(0,W.jsx)(De,{label:`Reset ${f}`,onClick:()=>n({type:`reset-state`,component:a.id,state:s,role:r})})]},r)})]},s))]},a.id))})}var tt=(0,U.createContext)(()=>``),nt=new Set([`color`,`shadow`,`border`,`focusRing`,`gradient`]),rt=[100,200,300,400,500,600,700,800,900],it=[`solid`,`dashed`,`dotted`,`double`],at=[[`ease`,[.25,.1,.25,1]],[`ease-in`,[.42,0,1,1]],[`ease-out`,[0,0,.58,1]],[`ease-in-out`,[.42,0,.58,1]]],ot=(e,t,n)=>e.tokens.filter(e=>e.type===t&&e.path!==n&&e.source).map(e=>e.path);function $({model:e,type:t,value:n,onChange:r,label:i,self:a,compact:o}){let s=Qe(n),c=ot(e,t,a),l=s?e.byPath.get(s):void 0,u=(0,U.useContext)(tt),d=()=>I(n,t=>e.byPath.get(t)?.source?.light);return(0,W.jsxs)(`span`,{className:`inline-flex min-w-0 flex-wrap items-center gap-1.5`,children:[(c.length>0||s)&&(0,W.jsx)(Te,{label:`${i}: own value or alias`,value:s,options:c,onChange:e=>r(e?`{${e}}`:d())}),s?(0,W.jsx)(`span`,{className:`truncate font-mono text-mono-sm text-muted`,children:l?u(l.path)||l.light:`unknown token`}):(0,W.jsx)(ct,{model:e,type:t,value:n,onChange:r,label:i,compact:o,...a?{self:a}:{}})]})}function st({label:e,value:t,onChange:n,step:r=1,units:i=[`px`,`rem`]}){return(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,W.jsx)(q,{label:e,value:t.value,step:t.unit===`rem`||t.unit===`s`?r/10:r,onChange:e=>n({...t,value:e})}),(0,W.jsx)(Ee,{label:`${e} unit`,value:t.unit,options:i,onChange:e=>n({...t,unit:e})})]})}function ct({model:e,type:t,value:n,onChange:r,label:i,compact:a}){switch(t){case`color`:return typeof n==`object`&&n?(0,W.jsx)(we,{label:i,value:n,onChange:r}):(0,W.jsx)(ut,{value:n});case`dimension`:return(0,W.jsx)(st,{label:i,value:n,onChange:r});case`duration`:return(0,W.jsx)(st,{label:i,value:n,onChange:r,step:10,units:[`ms`,`s`]});case`number`:{let e=n;return(0,W.jsx)(q,{label:i,value:e,step:Math.abs(e)<=1?.05:1,onChange:r})}case`fontWeight`:return(0,W.jsx)(Ee,{label:i,value:n,options:rt.includes(n)?rt:[...rt,n],onChange:r});case`fontFamily`:return(0,W.jsx)(lt,{label:i,value:Array.isArray(n)?n:[String(n)],onChange:r});case`strokeStyle`:return typeof n==`string`?(0,W.jsx)(Ee,{label:i,value:n,options:it.includes(n)?it:[...it,n],onChange:r}):(0,W.jsx)(ut,{value:n});case`cubicBezier`:return(0,W.jsx)(pt,{label:i,value:n,onChange:r});case`spring`:return(0,W.jsx)(mt,{label:i,value:n,onChange:r});case`typography`:case`border`:case`transition`:case`focusRing`:return(0,W.jsx)(ft,{model:e,type:t,value:n,onChange:r,label:i,compact:a});case`shadow`:return(0,W.jsx)(ht,{model:e,value:n,onChange:r,label:i});default:return(0,W.jsx)(ut,{value:n})}}function lt({label:e,value:t,onChange:n}){let r=t.join(`, `),[i,a]=(0,U.useState)(r),[o,s]=(0,U.useState)(!1),c=(0,U.useRef)(!1),l=(0,U.useId)();return(0,U.useEffect)(()=>{c.current||a(r)},[r]),(0,W.jsxs)(`span`,{className:`inline-flex max-w-full flex-col gap-1`,children:[(0,W.jsx)(`input`,{"aria-label":e,"aria-invalid":o||void 0,"aria-describedby":o?l:void 0,value:i,spellCheck:!1,onFocus:()=>c.current=!0,onBlur:()=>{c.current=!1,a(r),s(!1)},onChange:e=>{a(e.target.value);let t=e.target.value.split(`,`).map(e=>e.trim()).filter(Boolean),r=t.length>0&&t.every(e=>ge.test(e));s(!r&&e.target.value.trim()!==``),r&&n(t)},className:v(G,`h-7 w-[16rem] max-w-full`,o&&`border-danger`)}),o&&(0,W.jsx)(`span`,{id:l,className:`text-caption text-danger`,children:`Letters, digits, spaces and hyphens only; separate families with commas.`})]})}function ut({value:e}){return(0,W.jsx)(`code`,{className:`truncate font-mono text-mono-sm text-muted`,children:JSON.stringify(e)})}var dt={typography:[[`fontFamily`,`fontFamily`,`Family`],[`fontSize`,`dimension`,`Size`],[`fontWeight`,`fontWeight`,`Weight`],[`lineHeight`,`number`,`Line height`],[`letterSpacing`,`dimension`,`Tracking`]],border:[[`color`,`color`,`Colour`],[`width`,`dimension`,`Width`],[`style`,`strokeStyle`,`Style`]],transition:[[`duration`,`duration`,`Duration`],[`delay`,`duration`,`Delay`],[`timingFunction`,`cubicBezier`,`Easing`]],focusRing:[[`color`,`color`,`Colour`],[`width`,`dimension`,`Width`],[`offset`,`dimension`,`Offset`],[`style`,`strokeStyle`,`Style`]]};function ft({model:e,type:t,value:n,onChange:r,label:i}){return(0,W.jsx)(`div`,{className:`grid w-full gap-1.5`,children:(dt[t]??[]).map(([t,a,o])=>{let s=n[t],c=t===`lineHeight`&&typeof s==`object`&&s?`dimension`:a;return s===void 0?t===`letterSpacing`?(0,W.jsx)(K,{label:o,children:(0,W.jsxs)(C,{size:`sm`,variant:`ghost`,onClick:()=>r({...n,letterSpacing:{value:0,unit:`px`}}),children:[(0,W.jsx)(u,{}),` Add tracking`]})},t):null:(0,W.jsx)(K,{label:o,children:(0,W.jsx)($,{model:e,type:c,value:s,label:`${i} ${o.toLowerCase()}`,onChange:e=>r({...n,[t]:e}),compact:!0})},t)})})}function pt({label:e,value:t,onChange:n}){let r=[`x1`,`y1`,`x2`,`y2`],i=at.find(([,e])=>e.every((e,n)=>e===t[n]))?.[0]??`custom`;return(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(Oe,{points:ke(t),label:`${e}: cubic-bezier(${t.join(`, `)})`}),(0,W.jsx)(`div`,{className:`grid grid-cols-2 gap-x-2 gap-y-1`,children:t.map((i,a)=>(0,W.jsxs)(`label`,{className:`inline-flex items-center gap-1`,children:[(0,W.jsx)(`span`,{"aria-hidden":!0,className:`w-4 font-mono text-mono-sm text-muted`,children:r[a]}),(0,W.jsx)(q,{label:`${e} ${r[a]}`,value:i,step:.01,...a%2==0?{min:0,max:1}:{},onChange:e=>n(t.map((t,n)=>n===a?e:t))})]},r[a]))}),(0,W.jsx)(Ee,{label:`${e} preset`,value:i,options:[`custom`,...at.map(([e])=>e)],onChange:e=>{let t=at.find(([t])=>t===e)?.[1];t&&n([...t])}})]})}function mt({label:e,value:t,onChange:n}){let r=he(t),i=me(t),a=e=>r=>n({...t,[e]:r});return(0,W.jsxs)(`div`,{className:`grid w-full gap-1.5`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,W.jsx)(Oe,{points:r.points,label:`${e}: settle curve, ${r.durationMs} ms`}),(0,W.jsxs)(`p`,{className:`text-small text-muted`,children:[r.settles?(0,W.jsxs)(W.Fragment,{children:[`Settles in `,(0,W.jsxs)(`span`,{className:`tabular text-ink`,children:[r.durationMs,` ms`]})]}):(0,W.jsx)(`span`,{className:`text-warning`,children:`Never settles: add damping`}),(0,W.jsx)(`br`,{}),t.damping<i?`Overshoots (critical damping ≈ ${i.toFixed(1)})`:`No overshoot`]})]}),(0,W.jsx)(K,{label:`Stiffness`,children:(0,W.jsx)(q,{label:`${e} stiffness`,value:t.stiffness,step:10,min:1,onChange:a(`stiffness`)})}),(0,W.jsx)(K,{label:`Damping`,children:(0,W.jsx)(q,{label:`${e} damping`,value:t.damping,step:1,min:0,onChange:a(`damping`)})}),(0,W.jsx)(K,{label:`Mass`,children:(0,W.jsx)(q,{label:`${e} mass`,value:t.mass,step:.1,min:.1,onChange:a(`mass`)})}),(0,W.jsx)(K,{label:`Velocity`,children:(0,W.jsx)(q,{label:`${e} velocity`,value:t.velocity??0,step:.1,onChange:e=>n(e===0?{stiffness:t.stiffness,damping:t.damping,mass:t.mass}:{...t,velocity:e})})})]})}function ht({model:e,value:t,onChange:n,label:r}){let i=Array.isArray(t)?t:[t],a=(e,t)=>n(i.map((n,r)=>r===e?t:n));return(0,W.jsxs)(`div`,{className:`grid w-full gap-2`,children:[i.map((t,o)=>(0,W.jsxs)(`fieldset`,{className:`grid gap-1.5 rounded-md border border-line p-2`,children:[(0,W.jsxs)(`legend`,{className:`px-1 text-caption text-muted`,children:[`Layer `,o+1]}),(0,W.jsx)(K,{label:`Colour`,children:(0,W.jsx)($,{model:e,type:`color`,value:t.color,label:`${r} layer ${o+1} colour`,onChange:e=>a(o,{...t,color:e}),compact:!0})}),(0,W.jsxs)(K,{label:`x, y`,children:[(0,W.jsx)($,{model:e,type:`dimension`,value:t.offsetX,label:`${r} layer ${o+1} x`,onChange:e=>a(o,{...t,offsetX:e}),compact:!0}),(0,W.jsx)($,{model:e,type:`dimension`,value:t.offsetY,label:`${r} layer ${o+1} y`,onChange:e=>a(o,{...t,offsetY:e}),compact:!0})]}),(0,W.jsxs)(K,{label:`Blur, spread`,children:[(0,W.jsx)($,{model:e,type:`dimension`,value:t.blur,label:`${r} layer ${o+1} blur`,onChange:e=>a(o,{...t,blur:e}),compact:!0}),(0,W.jsx)($,{model:e,type:`dimension`,value:t.spread,label:`${r} layer ${o+1} spread`,onChange:e=>a(o,{...t,spread:e}),compact:!0})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,W.jsxs)(`label`,{className:`inline-flex items-center gap-2 text-small text-ink-2`,children:[(0,W.jsx)(`input`,{type:`checkbox`,className:`size-3.5 accent-accent`,checked:t.inset===!0,onChange:e=>a(o,e.target.checked?{...t,inset:!0}:(({inset:e,...t})=>t)(t))}),` Inset`]}),i.length>1&&(0,W.jsxs)(C,{size:`sm`,variant:`ghost`,className:`ml-auto`,onClick:()=>n(i.filter((e,t)=>t!==o)),children:[(0,W.jsx)(s,{}),` Remove layer`]})]})]},o)),(0,W.jsxs)(C,{size:`sm`,variant:`ghost`,className:`justify-self-start`,onClick:()=>n([...i,{...i.at(-1)}]),children:[(0,W.jsx)(u,{}),` Add layer`]})]})}function gt({warnings:e}){return e.length===0?null:(0,W.jsx)(`ul`,{className:`space-y-1 rounded-md bg-warning-soft px-2.5 py-1.5`,children:e.map(e=>(0,W.jsxs)(`li`,{className:`flex items-start gap-1.5 text-small text-ink-2`,children:[(0,W.jsx)(_,{"aria-hidden":!0,className:`mt-0.5 size-3.5 shrink-0 text-warning`}),(0,W.jsxs)(`span`,{children:[e.pair.label,` (`,e.scheme,`): `,e.ratio===null?(0,W.jsx)(`span`,{className:`font-medium`,children:e.unreadable}):(0,W.jsxs)(`span`,{className:`tabular font-medium`,children:[e.ratio.toFixed(2),`:1`]}),`, needs `,e.required,`:1`,e.isNew?``:` (already below before these edits)`]})]},`${e.pair.key}|${e.scheme}`))})}function _t({model:e,token:t,content:n,dispatch:r,warnings:i}){let a=Y(n,t.path),o=He(t,a),s=(0,U.useId)(),c=i=>(0,W.jsx)(tt.Provider,{value:t=>We(e,n,t,i),children:(0,W.jsx)($,{model:e,type:t.type,value:Z(e,n,t.path,i),label:`${t.path} ${i}`,self:t.path,onChange:e=>r({type:`token`,path:t.path,scheme:i,value:e})})});return(0,W.jsxs)(`section`,{"aria-labelledby":s,"data-token":t.path,className:v(`space-y-2.5 rounded-lg border p-3`,a?`border-accent/40 bg-accent-soft/30`:`border-line`),children:[(0,W.jsxs)(`header`,{className:`flex min-w-0 items-center gap-2`,children:[(0,W.jsx)(`h3`,{id:s,className:`min-w-0 truncate font-mono text-mono text-ink`,children:t.path}),(0,W.jsx)(E,{tone:`outline`,children:t.type}),a&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(E,{tone:`accent`,children:`Edited`}),(0,W.jsx)(`span`,{className:`ml-auto`,children:(0,W.jsx)(De,{label:`Reset ${t.path}`,onClick:()=>r({type:`reset-token`,path:t.path})})})]})]}),t.description&&(0,W.jsx)(`p`,{className:`text-small text-muted`,children:t.description}),(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsx)(vt,{label:o?`Light`:nt.has(t.type)?`Light & dark`:`Value`,children:c(`light`)}),o?(0,W.jsx)(vt,{label:`Dark`,action:(0,W.jsx)(C,{size:`sm`,variant:`ghost`,onClick:()=>r({type:`dark-follows`,path:t.path}),children:`Follow light`}),children:c(`dark`)}):nt.has(t.type)&&(0,W.jsxs)(C,{size:`sm`,variant:`ghost`,onClick:()=>r({type:`dark-own`,path:t.path}),children:[(0,W.jsx)(y,{}),` Different in dark`]})]}),(0,W.jsx)(gt,{warnings:i})]})}function vt({label:e,action:t,children:n}){return(0,W.jsxs)(`div`,{className:`space-y-1`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`text-caption text-muted`,children:e}),t&&(0,W.jsx)(`span`,{className:`ml-auto`,children:t})]}),(0,W.jsx)(`div`,{className:`min-w-0`,children:n})]})}var yt=new Set([`color`,`dimension`,`border`,`shadow`,`typography`,`focusRing`]),bt=/(?:^|\.)(?:paper|ground|raised|surface|canvas|background|card|sunken)$/,xt=/(?:^|[.-])(?:ink|text|foreground|fg|muted|subtle|faint)(?:-\d)?$/,St=/(?:^|\.)(?:ink|text|foreground|fg)$/,Ct=/(?:^|[.-])(?:line|border|divider|stroke|outline|separator)s?$/,wt=12,Tt={text:`text`,surface:`surface`,border:`border`,ring:`focus ring`,shadow:`shadow`,radius:`corners`,space:`gap and padding`,type:`text`};function Et(e,t){let n=t.split(`.`)[0].toLowerCase();switch(e){case`color`:return/^(?:bg|background|surface|fill|paper|canvas)$/.test(n)?`surface`:/^(?:fg|text|foreground|color|ink|label|icon)$/.test(n)?`text`:/^(?:border|outline|stroke|divider|line)$/.test(n)?`border`:n===`ring`?`ring`:`surface`;case`dimension`:return/radius|rounded|corner/.test(n)?`radius`:/border|stroke|outline/.test(n)?`border`:`space`;case`border`:return`border`;case`shadow`:return`shadow`;case`typography`:return`type`;case`focusRing`:return`ring`;default:return null}}var Dt={border:`border`,focusRing:`ring`,shadow:`shadow`,typography:`type`};function Ot(e,t){return e===`color`?xt.test(t)?`text`:bt.test(t)?`surface`:Ct.test(t)?`border`:null:e===`dimension`?J({type:e,path:t})===`radius`?`radius`:J({type:e,path:t})===`border`?`border`:`space`:Et(e,``)}function kt(e){let t=Qe(e);return t?[t]:Array.isArray(e)?e.flatMap(kt):typeof e==`object`&&e?Object.values(e).flatMap(kt):[]}var At=e=>e.split(`/`).at(-1)??e,jt=e=>e.split(`/token/`)[1]??e;function Mt(e,t,n){let r=e.byPath.get(n);if(!r||!yt.has(r.type))return null;let i=t=>e.byPath.get(t)?.cssVar,a=[],o=new Set,s=e=>{let t=`${e.kind}|${e.cssVar}|${e.on??``}|${e.label}`;o.has(t)||a.length>=wt||(o.add(t),a.push(e))},c=(n,o,u)=>{let d=i(n),f=o?` (via ${o})`:``;for(let t of e.contracts){let i=[[``,t.tokens],...Object.entries(t.states??{}).map(([e,t])=>[`${e} `,t??{}])];for(let[a,o]of i)for(let[i,c]of Object.entries(o)){if(jt(c)!==n)continue;let l=Et(r.type,i);if(!l)continue;let u=i.includes(`.`)?i.slice(i.indexOf(`.`)):``,p=n=>{for(let r of n.flatMap(e=>[`${e}${u}`,e])){let n=o[r]??t.tokens[r],i=n?e.byPath.get(jt(n)):void 0;if(i?.type===`color`)return i.cssVar}},m=l===`text`?p([`bg`,`background`,`surface`]):void 0,h=l===`surface`?p([`fg`,`text`,`foreground`,`color`]):void 0;s({kind:l,type:r.type,label:`${t.name} ${a}${i}${f}`,cssVar:d,...m?{on:m}:{},...h?{fg:h}:{},demo:At(t.id)})}}for(let i of e.tokens)if(!u.has(i.path)&&[`light`,`dark`].some(r=>kt(Z(e,t,i.path,r)).includes(n))){if(i.type===r.type){u.add(i.path);let e=a.length;c(i.path,i.path,u),a.length===e&&l(i.path,i.path)}else Dt[i.type]&&s({kind:Dt[i.type],type:i.type,label:`${i.path}${f}`,cssVar:i.cssVar})}},l=(t,n)=>{let a=i(t),o=n?` (via ${n})`:``,c=Ot(r.type,t);if(r.type!==`color`){c&&s({kind:c,type:r.type,label:`${Tt[c]}${o}`,cssVar:a});return}if(c===`border`)return s({kind:c,type:`color`,label:`border${o}`,cssVar:a});let l=e.tokens.filter(e=>e.type===`color`&&e.path!==t);if(c!==`surface`){let e=l.filter(e=>bt.test(e.path));for(let t of e)s({kind:`text`,type:`color`,label:`on ${t.path}${o}`,cssVar:a,on:t.cssVar});e.length===0&&s({kind:`text`,type:`color`,label:`text${o}`,cssVar:a})}if(c!==`text`){let e=l.find(e=>St.test(e.path));s({kind:`surface`,type:`color`,label:`surface${o}`,cssVar:a,...e?{fg:e.cssVar}:{}})}};c(n,null,new Set([n]));let u=a.length>0;return u||l(n,null),{path:n,type:r.type,cssVar:r.cssVar,uses:a,byName:!u}}var Nt={color:`components`,type:`type`,space:`scale`,radius:`scale`,border:`scale`,shadow:`scale`,motion:`motion`,focus:`focus`,other:`components`,states:`components`},Pt=`(min-width: 64rem)`;function Ft(){return(0,U.useSyncExternalStore)(e=>{let t=matchMedia(Pt);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)},()=>matchMedia(Pt).matches,()=>!0)}function It(){let[e,t]=(0,U.useState)(0),n=(0,U.useRef)(null);return[(0,U.useCallback)(e=>{n.current?.disconnect(),e&&(n.current=new ResizeObserver(()=>t(e.getBoundingClientRect().height)),n.current.observe(e))},[]),e]}var Lt=(e,t)=>`yx-style:${e}:${t??`new`}`;function Rt(e){try{let t=sessionStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}}function zt(){let e=b(),t=ie(),n=/^draft\/(d-[0-9a-f]{10})$/.exec(t[`*`]??``)?.[1]??null;return e.status===`ready`?(0,W.jsx)(Bt,{model:e.value,draftId:n},n??`new`):(0,W.jsx)(x,{state:e,onRetry:ee,what:`the system's tokens`})}function Bt({model:e,draftId:t}){let[n,r]=(0,U.useState)(null),[i,a]=(0,U.useState)(null);return(0,U.useEffect)(()=>{t&&T.draft(t).then(e=>e.kind===`style`?r(e):a(ce(Error(`${t} is a rule draft: open it from Rules.`))),e=>a(ce(e)))},[t]),t&&i?(0,W.jsx)(S,{icon:te,title:`This draft could not be opened`,actions:(0,W.jsx)(C,{asChild:!0,children:(0,W.jsx)(ne,{href:`/style`,children:`Start new edits`})}),children:i.message}):t&&!n?(0,W.jsx)(se,{}):(0,W.jsx)(Vt,{model:e,initialDraft:n})}function Vt({model:e,initialDraft:t}){let[,n]=oe(),{system:r}=e.catalog,a=(0,U.useMemo)(()=>Be(r.id,r.cssPrefix,[...e.tokens.values()],e.catalog.components.map(e=>e.contract)),[e,r]),[o,s]=(0,U.useState)(t),c=Lt(r.id,o?.id??null),[u,p]=(0,U.useReducer)((e,t)=>Ze(a,e,t),void 0,()=>Rt(c)??t?.content??Ye),[m,h]=(0,U.useState)(`color`),[g,_]=(0,U.useState)(`components`),y=Ft(),[b,ee]=(0,U.useState)(null),x=(0,U.useCallback)(e=>{p(e),`path`in e&&(ee(e.path),!y&&yt.has(a.byPath.get(e.path)?.type??``)&&_(`token`))},[y,a]),[ie,se]=It(),[w,le]=(0,U.useState)(``),[D,O]=(0,U.useState)(null),[k,A]=(0,U.useState)(!1),[j,N]=(0,U.useState)(null),[fe,pe]=(0,U.useState)(!1);(0,U.useEffect)(()=>{T.info().then(()=>pe(!1),e=>pe(ce(e).offline))},[]),(0,U.useEffect)(()=>{try{o&&L(u,o.content)?sessionStorage.removeItem(c):sessionStorage.setItem(c,JSON.stringify(u))}catch{}},[u,o,c]);let P=!o||o.status===`draft`||o.status===`previewed`||o.status===`approved`,F=o?!L(u,o.content):Q(u)>0,I=(0,U.useMemo)(()=>Ke(a,u),[a,u]),me=(0,U.useMemo)(()=>Je(a,u),[a,u]),he=(0,U.useMemo)(()=>b?Mt(a,u,b):null,[a,u,b]),ge=(0,U.useMemo)(()=>a.tokens.map(e=>({path:e.path,type:e.type,cssVar:e.cssVar})),[a]),R=a.tokens.filter(Ve),z=(0,U.useCallback)(async()=>{if(P&&!k){A(!0),N(null);try{let e=o?await T.save(o.id,o.revision,u):await T.createStyle(u);if(e.kind!==`style`)throw Error(`the service returned a rule draft`);try{sessionStorage.removeItem(Lt(r.id,null))}catch{}s(e),o||n(`/style/draft/${e.id}`,{replace:!0})}catch(e){N(ce(e))}finally{A(!1)}}},[P,k,o,u,r.id,n]);(0,U.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`s`&&(e.preventDefault(),F&&z())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[F,z]);let B=(0,U.useMemo)(()=>{let e=new Map;for(let t of R)e.set(J(t),(e.get(J(t))??0)+1);return e},[R]),_e=a.contracts.filter(e=>e.states&&Object.keys(e.states).length>0).length,ve=[...Re.filter(e=>(B.get(e.value)??0)>0).map(e=>({value:e.value,label:e.label,count:B.get(e.value)??0})),{value:`states`,label:`States`,count:_e}],V=w.trim().toLowerCase(),H=R.filter(e=>J(e)===m&&(!V||e.path.toLowerCase().includes(V)||(e.description??``).toLowerCase().includes(V))),ye=e=>me.filter(t=>t.pair.foreground===e||t.pair.background===e||t.pair.foreground===`${e}.color`);return R.length===0?(0,W.jsxs)(S,{icon:l,title:`This snapshot cannot be edited yet`,children:[`It was built before the style editor. Run `,(0,W.jsx)(`code`,{className:`font-mono text-mono-sm`,children:`pnpm data`}),` (or `,(0,W.jsx)(`code`,{className:`font-mono text-mono-sm`,children:`youiyoux ui`}),`) again.`]}):(0,W.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,W.jsxs)(ae,{title:`Style`,count:Q(u),children:[o&&(0,W.jsx)(C,{size:`sm`,variant:`ghost`,asChild:!0,children:(0,W.jsxs)(ne,{href:`/changes/${o.id}`,children:[`Review `,(0,W.jsx)(i,{})]})}),Q(u)>0&&P&&(0,W.jsx)(C,{size:`icon-sm`,variant:`ghost`,"aria-label":`Undo every unsaved edit`,title:`Undo every unsaved edit`,disabled:!F,onClick:()=>x({type:`replace`,content:o?.content??Ye}),children:(0,W.jsx)(xe,{})}),P&&(0,W.jsx)(C,{size:`sm`,variant:F?`primary`:`outline`,disabled:!F||k||fe,onClick:()=>void z(),children:k?`Saving…`:o?`Save draft`:`Save as draft`})]}),fe&&(0,W.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-2 border-b border-line bg-warning-soft px-4 py-2 text-small text-ink-2`,children:[(0,W.jsx)(te,{"aria-hidden":!0,className:`size-4 shrink-0 text-warning`}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Editing and the live preview work here; saving a draft needs the local workflow service.`}),(0,W.jsx)(d,{})]}),j&&(0,W.jsxs)(`div`,{role:`alert`,className:`border-b border-line bg-danger-soft px-4 py-2 text-small text-ink-2`,children:[(0,W.jsx)(`p`,{className:`font-medium`,children:j.message}),j.problems.map(e=>(0,W.jsx)(`p`,{children:e},e))]}),o&&!P&&(0,W.jsxs)(`div`,{role:`status`,className:`border-b border-line bg-raised px-4 py-2 text-small text-ink-2`,children:[`This draft is `,o.status.replace(`-`,` `),`: it can no longer change. `,(0,W.jsx)(ne,{href:`/style`,className:`font-medium text-accent hover:underline`,children:`Start new edits`})]}),(0,W.jsxs)(`div`,{className:`min-h-0 flex-1 max-lg:flex max-lg:flex-col max-lg:overflow-y-auto lg:grid lg:grid-cols-[minmax(22rem,30rem)_minmax(0,1fr)]`,style:y?void 0:{scrollPaddingTop:se+8},children:[!y&&(0,W.jsx)(`section`,{ref:ie,"aria-label":`Live preview`,className:`sticky top-0 z-10 shrink-0 border-b border-line bg-canvas px-4 py-2 shadow-raise`,children:(0,W.jsx)(Le,{vars:I,tokens:ge,pinned:D,onPinned:O,screen:g,onScreen:_,focus:he})}),(0,W.jsxs)(`section`,{"aria-label":`Edit tokens and states`,className:`min-w-0 space-y-4 p-4 lg:overflow-y-auto lg:border-r lg:border-line`,children:[(0,W.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,W.jsx)(`label`,{htmlFor:`style-title`,className:`block text-small font-medium text-ink-2`,children:`Change`}),(0,W.jsx)(ue,{id:`style-title`,value:u.title,placeholder:`Name this change (Warmer brand, Rounder controls…)`,disabled:!P,onChange:e=>x({type:`title`,title:e.target.value})}),(0,W.jsxs)(`p`,{className:`flex flex-wrap items-center gap-1.5 text-small text-muted`,children:[o?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(E,{tone:`outline`,children:o.id}),` revision `,o.revision,F?` · unsaved edits`:` · saved`]}):`${Q(u)} unsaved edit(s), kept in this tab`,F&&P&&(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[`· save `,(0,W.jsx)(re,{keys:[`⌘`,`S`]})]})]})]}),(0,W.jsx)(Se,{warnings:me}),(0,W.jsx)(M,{label:`Token group`,value:m,onChange:e=>{h(e),le(``),_(Nt[e])},options:ve,wrap:!0}),m===`states`?(0,W.jsx)(et,{model:a,content:u,dispatch:P?x:()=>void 0,onPin:O,pinned:D}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(de,{value:w,onChange:le,label:`Filter tokens`,placeholder:`Filter by path or description…`}),H.length===0?(0,W.jsxs)(S,{icon:f,title:`No tokens match`,children:[`Nothing in `,Re.find(e=>e.value===m)?.label.toLowerCase(),` matches “`,w.trim(),`”.`]}):(0,W.jsxs)(`fieldset`,{disabled:!P,className:v(`space-y-3`,!P&&`opacity-70`),children:[(0,W.jsxs)(`legend`,{className:`sr-only`,children:[Re.find(e=>e.value===m)?.label,` tokens`]}),H.map(e=>(0,W.jsx)(_t,{model:a,token:e,content:u,dispatch:x,warnings:ye(e.path)},e.path))]})]})]}),y&&(0,W.jsx)(`section`,{"aria-label":`Live preview`,className:`min-w-0 p-4 lg:overflow-y-auto`,children:(0,W.jsx)(Fe,{vars:I,tokens:ge,pinned:D,onPinned:O,screen:g===`token`?Nt[m]:g,onScreen:_})})]})]})}export{zt as StyleScreen};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-D6zNwnaE.js";import{t}from"./clsx-DB0hHKMi.js";import{i as n,n as r,r as i,t as a}from"./dist-YTWqg5sS.js";var o=e(),s=i,c=a;function l({className:e,...n}){return(0,o.jsx)(r,{className:t(`flex h-10 shrink-0 items-stretch gap-5 overflow-x-auto border-b border-line px-6`,e),...n})}function u({className:e,count:r,children:i,...a}){return(0,o.jsxs)(n,{className:t(`relative inline-flex shrink-0 items-center gap-1.5 text-body font-medium whitespace-nowrap text-muted transition-colors duration-100 outline-none hover:text-ink focus-visible:text-ink data-[state=active]:text-ink`,`after:absolute after:inset-x-0 after:-bottom-px after:h-0.5 after:rounded-full after:bg-transparent after:transition-colors data-[state=active]:after:bg-ink focus-visible:after:bg-focus`,e),...a,children:[i,r!==void 0&&(0,o.jsx)(`span`,{className:`tabular text-caption text-faint`,children:r})]})}export{u as i,c as n,l as r,s as t};
1
+ import{t as e}from"./jsx-runtime-D6zNwnaE.js";import{t}from"./clsx-DB0hHKMi.js";import{i as n,n as r,r as i,t as a}from"./dist-tjVfXRHc.js";var o=e(),s=i,c=a;function l({className:e,...n}){return(0,o.jsx)(r,{className:t(`flex h-10 shrink-0 items-stretch gap-5 overflow-x-auto border-b border-line px-6`,e),...n})}function u({className:e,count:r,children:i,...a}){return(0,o.jsxs)(n,{className:t(`relative inline-flex shrink-0 items-center gap-1.5 text-body font-medium whitespace-nowrap text-muted transition-colors duration-100 outline-none hover:text-ink focus-visible:text-ink data-[state=active]:text-ink`,`after:absolute after:inset-x-0 after:-bottom-px after:h-0.5 after:rounded-full after:bg-transparent after:transition-colors data-[state=active]:after:bg-ink focus-visible:after:bg-focus`,e),...a,children:[i,r!==void 0&&(0,o.jsx)(`span`,{className:`tabular text-caption text-faint`,children:r})]})}export{u as i,c as n,l as r,s as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./jsx-runtime-D6zNwnaE.js";import{t}from"./arrow-right-DcbNDzqs.js";import{t as n}from"./KindIcon-BJ6bz-ny.js";import{t as r}from"./CopyButton-DE8drl4P.js";import{t as i}from"./link-2-dzvhLwTC.js";import{a,r as o,t as s}from"./contrast-B-uhyF_b.js";import{t as c}from"./clsx-DB0hHKMi.js";import{dt as l,it as u,m as d,ot as f,tt as p}from"./main-Djqho539.js";import{n as m,t as h}from"./Badge-CUJUit4d.js";import{n as g,r as _}from"./Section-BTnvUq_W.js";import{n as v,t as y}from"./TokenValue-CsPRc2ai.js";var b=e(),x=[`light`,`dark`];function S(e,t){let n=[...e.tokens.values()].map(e=>({path:e.path,type:e.type,light:e.light,dark:e.dark}));return a(n,t.path).map(t=>({label:t.label,foreground:e.tokenByPath.get(t.foreground),background:e.tokenByPath.get(t.background)}))}function C({fg:e,bg:t}){let n=s(e,t);if(n===null)return(0,b.jsx)(`span`,{className:`text-muted`,children:`–`});let r=o(n);return(0,b.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`flex items-center gap-1`,"aria-hidden":!0,children:(0,b.jsx)(`span`,{className:`edge grid size-6 place-items-center rounded-xs text-caption font-semibold`,style:{background:t,color:e},children:`Aa`})}),(0,b.jsx)(`span`,{className:`tabular w-12 font-mono text-mono-sm text-ink`,children:n.toFixed(2)}),(0,b.jsx)(h,{tone:m[r],children:r})]})}function w({model:e,token:t,scheme:n}){return(0,b.jsxs)(`div`,{className:`overflow-hidden rounded-lg border border-line`,children:[(0,b.jsx)(`div`,{className:c(`border-b border-line`,t.type!==`typography`&&`h-32`),children:(0,b.jsx)(y,{token:t,scheme:n,stage:v(e,n),className:t.type===`typography`?`min-h-32`:void 0})}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5 pr-1.5 pl-3`,children:[(0,b.jsx)(`span`,{className:`w-10 text-small text-muted capitalize`,children:n}),(0,b.jsx)(`code`,{className:`min-w-0 flex-1 truncate font-mono text-mono text-ink`,title:t[n],children:t[n]}),(0,b.jsx)(r,{value:t[n],label:`Copy ${n} value`})]})]})}function T({model:e,token:n}){return(0,b.jsx)(`ol`,{className:`flex flex-wrap items-center gap-1.5`,children:n.aliasChain.map((r,i)=>{let a=e.tokens.get(r),o=i===n.aliasChain.length-1;return(0,b.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[i>0&&(0,b.jsx)(t,{"aria-hidden":!0,className:`size-3.5 text-faint`}),i===0?(0,b.jsx)(`span`,{className:`rounded-sm border border-line bg-raised px-2 py-0.5 font-mono text-mono text-ink`,children:n.path}):(0,b.jsx)(l,{href:a?f(a.path):`#`,className:`rounded-sm border border-line px-2 py-0.5 font-mono text-mono text-accent hover:bg-raised`,children:u(r)}),o&&i>0&&(0,b.jsx)(`span`,{className:`text-small text-muted`,children:`holds the value`})]},r)})})}function E({model:e,token:t}){let a=e.byId.get(t.id),{scheme:o}=d(),s=e.tokenConsumers.get(t.id)??[],c=[...e.tokens.values()].filter(e=>e.aliasChain.indexOf(t.id)>0),u=S(e,t),m=t.aliasChain.length>1;return(0,b.jsxs)(`article`,{className:`min-h-0 flex-1 overflow-y-auto animate-enter`,children:[(0,b.jsxs)(`header`,{className:`border-b border-line px-6 pt-5 pb-5`,children:[(0,b.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,b.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-lg border border-line bg-raised`,children:a&&(0,b.jsx)(n,{element:a,scheme:o,className:`size-4`})}),(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(`h2`,{"data-detail-heading":!0,tabIndex:-1,className:`truncate font-mono text-title outline-none`,children:t.path}),(0,b.jsx)(h,{tone:`outline`,children:t.type}),m&&(0,b.jsxs)(h,{tone:`neutral`,children:[(0,b.jsx)(i,{}),` alias`]})]}),(0,b.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-3 font-mono text-mono-sm text-muted`,children:[(0,b.jsxs)(`span`,{className:`flex items-center gap-0.5`,children:[t.cssVar,(0,b.jsx)(r,{value:`var(${t.cssVar})`,label:`Copy CSS variable`})]}),(0,b.jsxs)(`span`,{className:`flex min-w-0 items-center gap-0.5`,children:[(0,b.jsx)(`span`,{className:`truncate`,children:t.id}),(0,b.jsx)(r,{value:t.id,label:`Copy element id`})]})]})]})]}),t.description&&(0,b.jsx)(`p`,{className:`mt-3 max-w-2xl text-reading text-ink-2`,children:t.description})]}),(0,b.jsxs)(`div`,{className:`space-y-8 p-6`,children:[(0,b.jsx)(g,{title:`Values`,children:(0,b.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:x.map(n=>(0,b.jsx)(w,{model:e,token:t,scheme:n},n))})}),m&&(0,b.jsx)(g,{title:`Alias chain`,children:(0,b.jsx)(T,{model:e,token:t})}),u.length>0&&(0,b.jsx)(g,{title:`Contrast`,aside:(0,b.jsx)(`span`,{className:`text-small text-muted`,children:`WCAG 2: 4.5 for body text, 3 for large text and UI parts`}),children:(0,b.jsx)(_,{head:[`Pair`,`Light`,`Dark`],children:u.map(e=>(0,b.jsxs)(`tr`,{children:[(0,b.jsx)(`td`,{className:`text-body whitespace-nowrap text-ink-2`,children:e.label}),x.map(t=>(0,b.jsx)(`td`,{children:(0,b.jsx)(C,{fg:e.foreground[t],bg:e.background[t]})},t))]},e.label))})}),(0,b.jsxs)(g,{title:`Declared consumers`,count:s.length+c.length,children:[(0,b.jsxs)(`p`,{className:`mb-2 text-small text-muted`,children:[`Contract bindings and aliases only. Code that uses the CSS variable or its Tailwind utilities directly is not counted here: `,(0,b.jsxs)(`code`,{className:`font-mono text-mono-sm`,children:[`youiyoux plan --token `,t.path]}),` finds those uses in a project.`]}),s.length+c.length===0?(0,b.jsx)(`p`,{className:`text-body text-muted`,children:`No component contract binds this token, and no token aliases it.`}):(0,b.jsxs)(`ul`,{className:`divide-y divide-line rounded-md border border-line`,children:[s.map(({component:t,role:n})=>(0,b.jsxs)(`li`,{className:`flex h-9 items-center gap-3 px-3`,children:[(0,b.jsx)(l,{href:p(t,`contract`),className:`font-medium text-ink hover:underline`,children:e.byId.get(t)?.name??t}),(0,b.jsx)(`span`,{className:`font-mono text-mono-sm text-muted`,children:n})]},`${t}:${n}`)),c.map(e=>(0,b.jsxs)(`li`,{className:`flex h-9 items-center gap-3 px-3`,children:[(0,b.jsx)(l,{href:f(e.path),className:`font-mono text-mono text-ink hover:underline`,children:e.path}),(0,b.jsx)(`span`,{className:`text-small text-muted`,children:`aliases this token`})]},e.id))]})]})]})]})}export{E as t};
@@ -0,0 +1 @@
1
+ import{i as e,t}from"./react-DB-4Zxce.js";import{t as n}from"./jsx-runtime-D6zNwnaE.js";import{t as r}from"./KindIcon-BJ6bz-ny.js";import{c as i}from"./contrast-B-uhyF_b.js";import{t as a}from"./clsx-DB0hHKMi.js";import{H as o,L as s,a as c,dt as l,g as u,i as d,j as f,k as p,m,mt as h,n as g,o as _,ot as v,pt as y}from"./main-Djqho539.js";import{t as b}from"./Swatch-KDz4qxdM.js";import{t as x}from"./TokenDetail-BPTZ9o6J.js";import{t as S}from"./Segmented-CTMaLPgh.js";import{t as C}from"./esm-NPpg23M8.js";import{t as w}from"./SearchField-ByftoJws.js";var T=e(t(),1),E=n(),D=32,O=30;function k(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>[e.path,e.cssVar,e.light,e.dark,e.description??``].some(e=>e.toLowerCase().includes(n))):[...e]}function A(e){let t=new Map;for(let n of e)t.set(n.group,(t.get(n.group)??0)+1);let n=[];return e.forEach((r,i)=>{(i===0||e[i-1].group!==r.group)&&n.push({type:`header`,group:r.group,count:t.get(r.group)??0}),n.push({type:`item`,token:r,index:i})}),n}function j(){let e=o();return e.status===`ready`?(0,E.jsx)(M,{model:e.value}):(0,E.jsx)(d,{state:e,onRetry:s,what:`the tokens`})}function M({model:e}){let t=h(),[,n]=y(),{scheme:o}=m(),[s,d]=(0,T.useState)(o),[j,M]=(0,T.useState)(``),P=t[`*`]?e.tokenByPath.get(t[`*`])??null:null,F=(0,T.useMemo)(()=>[...e.tokens.values()],[e]),I=(0,T.useMemo)(()=>{let e=performance.now(),t=k(F,j);return j.trim()&&f(`search`,performance.now()-e),t},[F,j]),L=(0,T.useMemo)(()=>A(I),[I]),R=(0,T.useCallback)(e=>{let t=L[e];return t?t.type===`header`?`h:${t.group}`:t.token.id:e},[L]),z=(0,T.useRef)(null),B=C({count:L.length,getScrollElement:()=>z.current,estimateSize:e=>L[e]?.type===`header`?O:D,getItemKey:R,overscan:12}),V=P?I.findIndex(e=>e.id===P.id):-1;u({count:I.length,index:V,onMove:e=>{let t=I[e];t&&(p(v(t.path)),n(v(t.path),{replace:!0}))},onOpen:()=>document.querySelector(`[data-detail-heading]`)?.focus()}),(0,T.useEffect)(()=>{let e=L.findIndex(e=>e.type===`item`&&e.token.id===P?.id);e>=0&&B.scrollToIndex(e,{align:`auto`})},[L,P,B]);let H=(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(g,{title:`Tokens`,count:F.length,children:(0,E.jsx)(S,{label:`Show values for`,value:s,onChange:d,options:[{value:`light`,label:`Light`},{value:`dark`,label:`Dark`}]})}),(0,E.jsx)(`div`,{className:`border-b border-line p-3`,children:(0,E.jsx)(w,{value:j,onChange:M,label:`Search tokens`,placeholder:`Search path, variable or value (#171717)…`})}),I.length===0?(0,E.jsxs)(_,{icon:i,title:`No tokens match`,children:[`Nothing matches “`,j.trim(),`”.`]}):(0,E.jsx)(`div`,{ref:z,"data-list-pane":!0,className:`min-h-0 flex-1 overflow-y-auto py-1.5`,children:(0,E.jsx)(`div`,{role:`list`,"aria-label":`Tokens`,className:`relative w-full`,style:{height:B.getTotalSize()},children:B.getVirtualItems().map(t=>{let n=L[t.index],i={height:t.size,transform:`translateY(${t.start}px)`};if(n.type===`header`)return(0,E.jsxs)(`div`,{role:`presentation`,className:`absolute inset-x-0 top-0 flex items-end gap-2 px-4.5 pb-1 text-caption text-muted capitalize`,style:i,children:[n.group,(0,E.jsx)(`span`,{className:`tabular text-faint`,children:n.count})]},t.key);let{token:o}=n,c=o.id===P?.id,u=e.byId.get(o.id);return(0,E.jsx)(`div`,{role:`listitem`,className:`absolute inset-x-0 top-0 px-1.5`,style:i,children:(0,E.jsxs)(l,{href:v(o.path),"aria-current":c?`true`:void 0,className:a(`flex h-full items-center gap-2.5 rounded-md px-3 transition-colors duration-75`,c?`bg-accent-soft text-ink`:`text-ink-2 hover:bg-raised hover:text-ink`),children:[o.type===`color`?(0,E.jsx)(b,{color:o[s],size:`xs`,className:`m-0.5`}):u&&(0,E.jsx)(r,{element:u,scheme:s}),(0,E.jsx)(`span`,{className:a(`shrink-0 font-mono text-mono`,c&&`font-medium`),children:o.path.slice(o.group.length+1)}),(0,E.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-right font-mono text-mono-sm text-faint`,children:o[s]})]})},t.key)})})})]});return(0,E.jsx)(c,{listLabel:`Tokens`,backHref:`/tokens`,hasDetail:P!==null,list:H,detail:P?(0,E.jsx)(x,{model:e,token:P},P.id):(0,E.jsx)(N,{model:e})})}function N({model:e}){let t=[...e.tokens.values()].filter(e=>e.type===`color`),{system:n}=e.catalog;return(0,E.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-6 animate-enter`,children:[(0,E.jsxs)(`header`,{className:`mb-5 space-y-1`,children:[(0,E.jsxs)(`h2`,{className:`text-title`,children:[n.name,` palette`]}),(0,E.jsxs)(`p`,{className:`text-small text-muted`,children:[t.length,` colours, each with a light and a dark value. Pick one for its alias chain, contrast and consumers.`]})]}),(0,E.jsx)(`ul`,{className:`grid grid-cols-[repeat(auto-fill,minmax(132px,1fr))] gap-3`,children:t.map(e=>(0,E.jsx)(`li`,{children:(0,E.jsxs)(l,{href:v(e.path),className:`group block overflow-hidden rounded-lg border border-line transition-shadow duration-100 hover:shadow-popover`,children:[(0,E.jsxs)(`div`,{className:`checker grid h-16 grid-cols-2`,children:[(0,E.jsx)(`span`,{style:{background:e.light}}),(0,E.jsx)(`span`,{style:{background:e.dark}})]}),(0,E.jsxs)(`div`,{className:`border-t border-line px-2.5 py-2`,children:[(0,E.jsx)(`div`,{className:`truncate font-mono text-mono-sm text-ink`,children:e.path.slice(6)}),(0,E.jsxs)(`div`,{className:`truncate font-mono text-caption text-faint`,children:[e.light,` · `,e.dark]})]})]})},e.id))})]})}export{j as TokensScreen,k as filterTokens};
@@ -1 +1 @@
1
- import{i as e,t}from"./react-DB-4Zxce.js";import{t as n}from"./jsx-runtime-D6zNwnaE.js";import{t as r}from"./createLucideIcon-CGDJWtKO.js";import{t as i}from"./folder-tree-YghfTmlZ.js";import{n as a,o,r as s,s as c}from"./main-cvOFSjox.js";import{n as l}from"./plural-BbGQPQKA.js";import{o as u,t as d}from"./workflow-C53UBmRZ.js";import{t as f}from"./Badge-CUJUit4d.js";var p={name:`refresh-cw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]};p.node;var m=r(p),h=e(t(),1),g=n(),_={current:{label:()=>`Up to date`,tone:`success`},behind:{label:e=>`Behind: ${l(e.sync.changes.length,`file`)}`,tone:`warning`},conflict:{label:()=>`Conflict`,tone:`danger`},never:{label:()=>`Never synced`,tone:`warning`}},v=e=>`error`in e,y=`font-mono text-mono-sm`;function b({next:e}){let t=e.indexOf(`: `),[n,r]=e.startsWith(`youiyoux `)&&t>0?[e.slice(0,t),e.slice(t+2)]:[null,e];return(0,g.jsxs)(`p`,{className:`text-small text-muted`,children:[`Next: `,n&&(0,g.jsx)(`span`,{className:`${y} text-ink`,children:n}),n?`: ${r}`:(0,g.jsx)(`span`,{className:`text-ink-2`,children:r})]})}function x({status:e}){let{check:t,components:n,requests:r,drift:i}=e,a=_[e.sync.state];return(0,g.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1.5 text-small text-ink-2`,children:[(0,g.jsxs)(`span`,{children:[e.system.name,` v`,e.system.version,` `,(0,g.jsxs)(`span`,{className:`text-muted`,children:[`· `,e.system.source,e.system.linked?`, linked`:``]})]}),(0,g.jsx)(f,{tone:a.tone,children:a.label(e)}),i.length>0&&(0,g.jsxs)(f,{tone:i.some(e=>e.severity===`error`)?`danger`:`warning`,children:[l(i.length,`file`),` drifting`]}),(0,g.jsxs)(`span`,{className:`tabular`,children:[(0,g.jsx)(`span`,{className:t.errors>0?`text-danger`:void 0,children:l(t.errors,`error`)}),` · `,l(t.warnings,`warning`),t.baseline&&(0,g.jsx)(`span`,{className:`text-muted`,children:` beyond the baseline`}),t.incomplete&&(0,g.jsx)(f,{tone:`warning`,className:`ml-2`,children:`Incomplete`})]}),(0,g.jsxs)(`span`,{className:`tabular`,children:[n.used,` of `,l(n.system,`component`),` used`]}),r.open>0&&(0,g.jsx)(`span`,{className:`tabular`,children:l(r.open,`open request`)})]})}function S({entry:e,index:t,current:n,opening:r,onOpen:i}){let a=v(e);return(0,g.jsxs)(`li`,{className:`space-y-2 px-4 py-3`,"data-product":e.root,"aria-current":t===n?`true`:void 0,children:[(0,g.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,g.jsx)(`span`,{className:`text-body font-medium text-ink`,children:a?e.root:e.id}),!a&&e.root!==e.id&&(0,g.jsx)(`span`,{className:`${y} text-muted`,children:e.root}),(0,g.jsx)(`span`,{className:`ml-auto max-sm:ml-0`,children:t===n?(0,g.jsx)(f,{tone:`accent`,children:`Showing`}):a?(0,g.jsx)(f,{tone:`danger`,children:`Cannot be read`}):(0,g.jsx)(c,{size:`sm`,onClick:()=>i(t),disabled:r!==null,children:r===t?`Opening…`:`Open`})})]}),a?(0,g.jsx)(`p`,{className:`text-small text-ink-2`,children:e.error}):(0,g.jsx)(x,{status:e}),(0,g.jsx)(b,{next:e.next})]})}function C(){return(0,g.jsx)(o,{icon:i,title:`No workspace here`,children:(0,g.jsxs)(`p`,{children:[`A workspace lists the products you manage together. Write a `,(0,g.jsx)(`span`,{className:`${y} text-ink`,children:`youi.workspace.json`}),` naming their folders, then run `,(0,g.jsx)(`span`,{className:`${y} text-ink`,children:`youiyoux ui`}),` beside it: this page shows where each one stands and opens any of them here. `,(0,g.jsx)(`span`,{className:`${y} text-ink`,children:`youiyoux status`}),` shows the same in the terminal.`]})})}function w(){let[e,t]=(0,h.useState)({state:`loading`}),[n,r]=(0,h.useState)(null),[i,o]=(0,h.useState)(null),l=e=>e.then(e=>t({state:`ready`,view:e}),e=>{e instanceof d&&(e.offline||e.status===404||e.status===502)?t({state:`offline`}):o(e instanceof Error?e.message:String(e))});(0,h.useEffect)(()=>{l(u.get())},[]);let f=e=>{r(e),o(null),l(u.open(e)).finally(()=>r(null))},p=e.state===`ready`?e.view:null;return(0,g.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,g.jsx)(a,{title:`Workspace`,count:p?.report.projects.length,children:p&&(0,g.jsxs)(c,{size:`sm`,variant:`ghost`,onClick:()=>void l(u.refresh()),disabled:n!==null,children:[(0,g.jsx)(m,{}),` Read again`]})}),(0,g.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-y-auto`,children:e.state===`loading`?(0,g.jsx)(s,{}):e.state===`offline`?(0,g.jsx)(C,{}):e.state===`failed`?(0,g.jsx)(`p`,{className:`px-8 py-8 text-small text-danger`,children:e.message}):(0,g.jsxs)(`div`,{className:`mx-auto w-full max-w-5xl min-w-0 space-y-4 px-8 py-8 animate-enter max-sm:px-4`,children:[(0,g.jsxs)(`p`,{className:`max-w-2xl text-small text-ink-2`,children:[`Where each product stands with its System, as `,(0,g.jsx)(`span`,{className:`${y} text-ink`,children:`youiyoux status`}),` reads it`,e.view.report.workspace?(0,g.jsxs)(g.Fragment,{children:[` from `,(0,g.jsx)(`span`,{className:`${y} text-ink`,children:e.view.report.workspace})]}):null,`. Open one to see its usage, screens and inventory here.`]}),i&&(0,g.jsx)(`p`,{role:`alert`,className:`rounded-md border border-line px-3 py-2 text-small text-ink-2`,children:i}),(0,g.jsx)(`ul`,{className:`divide-y divide-line rounded-lg border border-line`,"aria-label":`Products`,children:e.view.report.projects.map((t,r)=>(0,g.jsx)(S,{entry:t,index:r,current:e.view.current,opening:n,onOpen:f},t.root))})]})})]})}export{x as Facts,b as Next,C as WorkspaceEmpty,w as WorkspaceScreen,m as t};
1
+ import{i as e,t}from"./react-DB-4Zxce.js";import{t as n}from"./jsx-runtime-D6zNwnaE.js";import{t as r}from"./createLucideIcon-CGDJWtKO.js";import{t as i}from"./folder-tree-YghfTmlZ.js";import{n as a,o,r as s,s as c}from"./main-Djqho539.js";import{n as l}from"./plural-BbGQPQKA.js";import{o as u,t as d}from"./workflow-Bv814-L8.js";import{t as f}from"./Badge-CUJUit4d.js";var p={name:`refresh-cw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]};p.node;var m=r(p),h=e(t(),1),g=n(),_={current:{label:()=>`Up to date`,tone:`success`},behind:{label:e=>`Behind: ${l(e.sync.changes.length,`file`)}`,tone:`warning`},conflict:{label:()=>`Conflict`,tone:`danger`},never:{label:()=>`Never synced`,tone:`warning`}},v=e=>`error`in e,y=`font-mono text-mono-sm`;function b({next:e}){let t=e.indexOf(`: `),[n,r]=e.startsWith(`youiyoux `)&&t>0?[e.slice(0,t),e.slice(t+2)]:[null,e];return(0,g.jsxs)(`p`,{className:`text-small text-muted`,children:[`Next: `,n&&(0,g.jsx)(`span`,{className:`${y} text-ink`,children:n}),n?`: ${r}`:(0,g.jsx)(`span`,{className:`text-ink-2`,children:r})]})}function x({status:e}){let{check:t,components:n,requests:r,drift:i}=e,a=_[e.sync.state];return(0,g.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1.5 text-small text-ink-2`,children:[(0,g.jsxs)(`span`,{children:[e.system.name,` v`,e.system.version,` `,(0,g.jsxs)(`span`,{className:`text-muted`,children:[`· `,e.system.source,e.system.linked?`, linked`:``]})]}),(0,g.jsx)(f,{tone:a.tone,children:a.label(e)}),i.length>0&&(0,g.jsxs)(f,{tone:i.some(e=>e.severity===`error`)?`danger`:`warning`,children:[l(i.length,`file`),` drifting`]}),(0,g.jsxs)(`span`,{className:`tabular`,children:[(0,g.jsx)(`span`,{className:t.errors>0?`text-danger`:void 0,children:l(t.errors,`error`)}),` · `,l(t.warnings,`warning`),t.baseline&&(0,g.jsx)(`span`,{className:`text-muted`,children:` beyond the baseline`}),t.incomplete&&(0,g.jsx)(f,{tone:`warning`,className:`ml-2`,children:`Incomplete`})]}),(0,g.jsxs)(`span`,{className:`tabular`,children:[n.used,` of `,l(n.system,`component`),` used`]}),r.open>0&&(0,g.jsx)(`span`,{className:`tabular`,children:l(r.open,`open request`)})]})}function S({entry:e,index:t,current:n,opening:r,onOpen:i}){let a=v(e);return(0,g.jsxs)(`li`,{className:`space-y-2 px-4 py-3`,"data-product":e.root,"aria-current":t===n?`true`:void 0,children:[(0,g.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,g.jsx)(`span`,{className:`text-body font-medium text-ink`,children:a?e.root:e.id}),!a&&e.root!==e.id&&(0,g.jsx)(`span`,{className:`${y} text-muted`,children:e.root}),(0,g.jsx)(`span`,{className:`ml-auto max-sm:ml-0`,children:t===n?(0,g.jsx)(f,{tone:`accent`,children:`Showing`}):a?(0,g.jsx)(f,{tone:`danger`,children:`Cannot be read`}):(0,g.jsx)(c,{size:`sm`,onClick:()=>i(t),disabled:r!==null,children:r===t?`Opening…`:`Open`})})]}),a?(0,g.jsx)(`p`,{className:`text-small text-ink-2`,children:e.error}):(0,g.jsx)(x,{status:e}),(0,g.jsx)(b,{next:e.next})]})}function C(){return(0,g.jsx)(o,{icon:i,title:`No workspace here`,children:(0,g.jsxs)(`p`,{children:[`A workspace lists the products you manage together. Write a `,(0,g.jsx)(`span`,{className:`${y} text-ink`,children:`youi.workspace.json`}),` naming their folders, then run `,(0,g.jsx)(`span`,{className:`${y} text-ink`,children:`youiyoux ui`}),` beside it: this page shows where each one stands and opens any of them here. `,(0,g.jsx)(`span`,{className:`${y} text-ink`,children:`youiyoux status`}),` shows the same in the terminal.`]})})}function w(){let[e,t]=(0,h.useState)({state:`loading`}),[n,r]=(0,h.useState)(null),[i,o]=(0,h.useState)(null),l=e=>e.then(e=>t({state:`ready`,view:e}),e=>{e instanceof d&&(e.offline||e.status===404||e.status===502)?t({state:`offline`}):o(e instanceof Error?e.message:String(e))});(0,h.useEffect)(()=>{l(u.get())},[]);let f=e=>{r(e),o(null),l(u.open(e)).finally(()=>r(null))},p=e.state===`ready`?e.view:null;return(0,g.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,g.jsx)(a,{title:`Workspace`,count:p?.report.projects.length,children:p&&(0,g.jsxs)(c,{size:`sm`,variant:`ghost`,onClick:()=>void l(u.refresh()),disabled:n!==null,children:[(0,g.jsx)(m,{}),` Read again`]})}),(0,g.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-y-auto`,children:e.state===`loading`?(0,g.jsx)(s,{}):e.state===`offline`?(0,g.jsx)(C,{}):e.state===`failed`?(0,g.jsx)(`p`,{className:`px-8 py-8 text-small text-danger`,children:e.message}):(0,g.jsxs)(`div`,{className:`mx-auto w-full max-w-5xl min-w-0 space-y-4 px-8 py-8 animate-enter max-sm:px-4`,children:[(0,g.jsxs)(`p`,{className:`max-w-2xl text-small text-ink-2`,children:[`Where each product stands with its System, as `,(0,g.jsx)(`span`,{className:`${y} text-ink`,children:`youiyoux status`}),` reads it`,e.view.report.workspace?(0,g.jsxs)(g.Fragment,{children:[` from `,(0,g.jsx)(`span`,{className:`${y} text-ink`,children:e.view.report.workspace})]}):null,`. Open one to see its usage, screens and inventory here.`]}),i&&(0,g.jsx)(`p`,{role:`alert`,className:`rounded-md border border-line px-3 py-2 text-small text-ink-2`,children:i}),(0,g.jsx)(`ul`,{className:`divide-y divide-line rounded-lg border border-line`,"aria-label":`Products`,children:e.view.report.projects.map((t,r)=>(0,g.jsx)(S,{entry:t,index:r,current:e.view.current,opening:n,onOpen:f},t.root))})]})})]})}export{x as Facts,b as Next,C as WorkspaceEmpty,w as WorkspaceScreen,m as t};
@@ -1 +1 @@
1
- import{i as e,t}from"./react-DB-4Zxce.js";import{n}from"./jsx-runtime-D6zNwnaE.js";import{j as r}from"./main-cvOFSjox.js";var i=e(t(),1),a=e=>e.filter(Boolean).join(` `);function o({contract:e}){return a([...Object.entries(e.props).flatMap(([e,t])=>[e,...t.type===`enum`?t.values:[]]),...e.source.also,...e.aliases,e.a11y.role,e.passthrough,...e.guidance.do,...e.guidance.dont,...e.platforms,e.status])}function s(e){return a([e.type,e.group,e.light,e.dark,...e.aliasChain.slice(1).map(e=>e.split(`/`).pop())])}function c(e){return a([e.rationale,e.agent,e.severity,e.check.engine,`id`in e.check?e.check.id:void 0])}function l(e){return e.elements.map(t=>{let n=e.components.get(t.id),r=e.tokens.get(t.id),i=e.rules.get(t.id),a=n?o(n):r?s(r):i?c(i):``;return{id:t.id,kind:t.kind,name:t.name,key:t.key,summary:t.summary,text:a}})}function u(e){let t=n(()=>import(`./engine-CMmt9yEz.js`).then(t=>({m:t,index:t.createIndex(e)})),[]);return{async query(e){let n=performance.now(),{m:r,index:i}=await t;return{ids:r.searchIndex(i,e),totalMs:performance.now()-n}}}}function d(e){let t;try{t=new Worker(new URL(`/assets/worker-Bh-wSp42.js`,``+import.meta.url),{type:`module`,name:`youiyoux-search`})}catch{return u(e)}let n=null,r=0,i=new Map;return t.onmessage=({data:e})=>{let t=i.get(e.id);t&&(i.delete(e.id),t.resolve({ids:e.ids,totalMs:performance.now()-t.started}))},t.onerror=()=>{n??=u(e);for(let[e,t]of i)i.delete(e),n.query(t.query).then(t.resolve)},t.postMessage({type:`index`,docs:e}),{query(e){if(n)return n.query(e);let a=r++;return new Promise(n=>{i.set(a,{query:e,started:performance.now(),resolve:n}),t.postMessage({type:`query`,id:a,query:e})})}}}var f=new WeakMap;function p(e){let t=f.get(e);return t||(t=typeof Worker>`u`?u(l(e)):d(l(e)),f.set(e,t)),t}function m(e,t){let[n,a]=(0,i.useState)({ids:null,totalMs:null}),o=t.trim();return(0,i.useEffect)(()=>{if(!o||!e){a({ids:null,totalMs:null});return}let t=!0;return p(e).query(o).then(e=>{r(`search`,e.totalMs),t&&a({ids:e.ids,totalMs:e.totalMs})}),()=>{t=!1}},[e,o]),o&&e?n:{ids:null,totalMs:null}}export{p as searchClient,m as useSearch};
1
+ import{i as e,t}from"./react-DB-4Zxce.js";import{n}from"./jsx-runtime-D6zNwnaE.js";import{j as r}from"./main-Djqho539.js";var i=e(t(),1),a=e=>e.filter(Boolean).join(` `);function o({contract:e}){return a([...Object.entries(e.props).flatMap(([e,t])=>[e,...t.type===`enum`?t.values:[]]),...e.source.also,...e.aliases,e.a11y.role,e.passthrough,...e.guidance.do,...e.guidance.dont,...e.platforms,e.status])}function s(e){return a([e.type,e.group,e.light,e.dark,...e.aliasChain.slice(1).map(e=>e.split(`/`).pop())])}function c(e){return a([e.rationale,e.agent,e.severity,e.check.engine,`id`in e.check?e.check.id:void 0])}function l(e){return e.elements.map(t=>{let n=e.components.get(t.id),r=e.tokens.get(t.id),i=e.rules.get(t.id),a=n?o(n):r?s(r):i?c(i):``;return{id:t.id,kind:t.kind,name:t.name,key:t.key,summary:t.summary,text:a}})}function u(e){let t=n(()=>import(`./engine-CMmt9yEz.js`).then(t=>({m:t,index:t.createIndex(e)})),[]);return{async query(e){let n=performance.now(),{m:r,index:i}=await t;return{ids:r.searchIndex(i,e),totalMs:performance.now()-n}}}}function d(e){let t;try{t=new Worker(new URL(`/assets/worker-Bh-wSp42.js`,``+import.meta.url),{type:`module`,name:`youiyoux-search`})}catch{return u(e)}let n=null,r=0,i=new Map;return t.onmessage=({data:e})=>{let t=i.get(e.id);t&&(i.delete(e.id),t.resolve({ids:e.ids,totalMs:performance.now()-t.started}))},t.onerror=()=>{n??=u(e);for(let[e,t]of i)i.delete(e),n.query(t.query).then(t.resolve)},t.postMessage({type:`index`,docs:e}),{query(e){if(n)return n.query(e);let a=r++;return new Promise(n=>{i.set(a,{query:e,started:performance.now(),resolve:n}),t.postMessage({type:`query`,id:a,query:e})})}}}var f=new WeakMap;function p(e){let t=f.get(e);return t||(t=typeof Worker>`u`?u(l(e)):d(l(e)),f.set(e,t)),t}function m(e,t){let[n,a]=(0,i.useState)({ids:null,totalMs:null}),o=t.trim();return(0,i.useEffect)(()=>{if(!o||!e){a({ids:null,totalMs:null});return}let t=!0;return p(e).query(o).then(e=>{r(`search`,e.totalMs),t&&a({ids:e.ids,totalMs:e.totalMs})}),()=>{t=!1}},[e,o]),o&&e?n:{ids:null,totalMs:null}}export{p as searchClient,m as useSearch};
@@ -1 +1 @@
1
- import{N as e,lt as t}from"./main-cvOFSjox.js";var n={q:``,role:null,source:null,licence:null,style:null,family:null,open:null,view:null,offset:0},r={"link-as-button":`button`},i=e=>r[e]??e;function a(e){let t=new URLSearchParams(e),n=(e,n)=>{let r=t.get(e)?.trim().slice(0,200)||null;return r===null||n&&!n.includes(r)?null:r},r=Number(t.get(`offset`)??0);return{q:(t.get(`q`)??``).slice(0,200),role:n(`role`),source:n(`source`),licence:n(`licence`,[`known`,`unknown`]),style:n(`style`,[`headless`,`styled`]),family:n(`family`),open:n(`open`),view:n(`view`,[`gallery`,`list`]),offset:Number.isSafeInteger(r)&&r>0?r:0}}function o(e){let t=new URLSearchParams;e.q.trim()&&t.set(`q`,e.q);for(let n of[`role`,`source`,`licence`,`style`,`family`,`open`,`view`])e[n]&&t.set(n,e[n]);e.offset>0&&t.set(`offset`,String(e.offset));let n=t.toString();return n?`?${n}`:``}function s(e){let t=(e,t)=>`${e>=10?Math.round(e):Math.round(e*10)/10}${t}`;return e>=1e6?t(e/1e6,`M`):e>=1e3?t(e/1e3,`k`):String(e)}function c(e){let t=e.signals,n=[];return t.weeklyDownloads==null?t.via&&n.push(`${s(t.via.weeklyDownloads)}/wk via ${t.via.package}`):n.push(`${s(t.weeklyDownloads)}/wk`),t.stars!=null&&n.push(`★ ${s(t.stars)}`),t.archived&&n.push(`archived`),n}var l=e=>e.source.kind===`npm`?`npm`:e.source.ref?.includes(`/`)?e.source.ref.slice(0,e.source.ref.indexOf(`/`)):e.source.name,u=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,` `).trim().split(` `).filter(e=>e.length>1),d=e=>{let t={};for(let n of e)t[n]=(t[n]??0)+1;return Object.fromEntries(Object.entries(t).sort(([e,t],[n,r])=>r-t||e.localeCompare(n)))};function f(e,t,n=20){let r=u(t.q),a=[];e.entries.forEach((e,n)=>{if(t.role&&!e.roles.includes(t.role)&&!e.roles.includes(i(t.role))||t.source&&e.registry!==t.source||t.licence&&e.license===`unknown`!=(t.licence===`unknown`)||t.style&&e.style!==t.style)return;if(r.length===0)return void a.push({listing:e,score:0,order:n});let o=` ${u(e.text).join(` `)} `,s=` ${u(`${e.name} ${e.title??``}`).join(` `)} `,c=0;for(let e of r)s.includes(` ${e} `)?c+=3:o.includes(` ${e} `)?c+=1:o.includes(` ${e}`)&&(c+=.5);c>0&&a.push({listing:e,score:c,order:n})}),a.sort((e,t)=>t.score-e.score||e.order-t.order);let o=a.map(e=>e.listing);return{hits:o.slice(t.offset,t.offset+n).map(({registry:e,roles:t,style:n,text:r,...i})=>i),matched:o.length,offset:t.offset,facets:{role:d(o.flatMap(e=>e.roles)),source:d(o.map(e=>e.registry)),licence:d(o.map(e=>e.license)),style:d(o.map(e=>e.style))},from:`snapshot`,capped:e.capped}}var p=class extends Error{name=`NoListings`},m=null,h=!1;function g(e){let t=new URLSearchParams({kind:`discover`,limit:`20`});return e.q.trim()&&t.set(`q`,e.q.trim()),e.role&&t.set(`role`,i(e.role)),e.source&&t.set(`source`,e.source),e.licence&&t.set(`licence`,e.licence),e.style&&t.set(`style`,e.style),e.offset&&t.set(`offset`,String(e.offset)),`/__youi/query?${t}`}async function _(n,r={}){if(!h){let e=null;try{e=await fetch(g(n),{cache:`no-store`,...r.signal?{signal:r.signal}:{}})}catch(t){if(t.name===`AbortError`)throw t;e=null}let t=e&&(e.headers.get(`content-type`)??``).includes(`application/json`)?await e.json().catch(()=>null):null;if(e?.ok&&t?.hits)return{hits:t.hits,matched:t.matched??t.total??t.hits.length,offset:n.offset,facets:t.facets??{role:{},source:{},licence:{},style:{}},from:`index`};if(e&&t?.error&&e.status!==404)throw new p(t.error);(!e||!t)&&(h=!0)}m??=e().then(e=>e?t(e):null);let i=await m.catch(()=>null);if(!i)throw new p(`No Discover listings here: run youiyoux discover sync, then open the hub with youiyoux ui (its own server reads the local index).`);return f(i,n)}export{_ as a,o as i,i as n,c as o,a as r,l as s,n as t};
1
+ import{N as e,lt as t}from"./main-Djqho539.js";var n={q:``,role:null,source:null,licence:null,style:null,family:null,open:null,view:null,offset:0},r={"link-as-button":`button`},i=e=>r[e]??e;function a(e){let t=new URLSearchParams(e),n=(e,n)=>{let r=t.get(e)?.trim().slice(0,200)||null;return r===null||n&&!n.includes(r)?null:r},r=Number(t.get(`offset`)??0);return{q:(t.get(`q`)??``).slice(0,200),role:n(`role`),source:n(`source`),licence:n(`licence`,[`known`,`unknown`]),style:n(`style`,[`headless`,`styled`]),family:n(`family`),open:n(`open`),view:n(`view`,[`gallery`,`list`]),offset:Number.isSafeInteger(r)&&r>0?r:0}}function o(e){let t=new URLSearchParams;e.q.trim()&&t.set(`q`,e.q);for(let n of[`role`,`source`,`licence`,`style`,`family`,`open`,`view`])e[n]&&t.set(n,e[n]);e.offset>0&&t.set(`offset`,String(e.offset));let n=t.toString();return n?`?${n}`:``}function s(e){let t=(e,t)=>`${e>=10?Math.round(e):Math.round(e*10)/10}${t}`;return e>=1e6?t(e/1e6,`M`):e>=1e3?t(e/1e3,`k`):String(e)}function c(e){let t=e.signals,n=[];return t.weeklyDownloads==null?t.via&&n.push(`${s(t.via.weeklyDownloads)}/wk via ${t.via.package}`):n.push(`${s(t.weeklyDownloads)}/wk`),t.stars!=null&&n.push(`★ ${s(t.stars)}`),t.archived&&n.push(`archived`),n}var l=e=>e.source.kind===`npm`?`npm`:e.source.ref?.includes(`/`)?e.source.ref.slice(0,e.source.ref.indexOf(`/`)):e.source.name,u=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,` `).trim().split(` `).filter(e=>e.length>1),d=e=>{let t={};for(let n of e)t[n]=(t[n]??0)+1;return Object.fromEntries(Object.entries(t).sort(([e,t],[n,r])=>r-t||e.localeCompare(n)))};function f(e,t,n=20){let r=u(t.q),a=[];e.entries.forEach((e,n)=>{if(t.role&&!e.roles.includes(t.role)&&!e.roles.includes(i(t.role))||t.source&&e.registry!==t.source||t.licence&&e.license===`unknown`!=(t.licence===`unknown`)||t.style&&e.style!==t.style)return;if(r.length===0)return void a.push({listing:e,score:0,order:n});let o=` ${u(e.text).join(` `)} `,s=` ${u(`${e.name} ${e.title??``}`).join(` `)} `,c=0;for(let e of r)s.includes(` ${e} `)?c+=3:o.includes(` ${e} `)?c+=1:o.includes(` ${e}`)&&(c+=.5);c>0&&a.push({listing:e,score:c,order:n})}),a.sort((e,t)=>t.score-e.score||e.order-t.order);let o=a.map(e=>e.listing);return{hits:o.slice(t.offset,t.offset+n).map(({registry:e,roles:t,style:n,text:r,...i})=>i),matched:o.length,offset:t.offset,facets:{role:d(o.flatMap(e=>e.roles)),source:d(o.map(e=>e.registry)),licence:d(o.map(e=>e.license)),style:d(o.map(e=>e.style))},from:`snapshot`,capped:e.capped}}var p=class extends Error{name=`NoListings`},m=null,h=!1;function g(e){let t=new URLSearchParams({kind:`discover`,limit:`20`});return e.q.trim()&&t.set(`q`,e.q.trim()),e.role&&t.set(`role`,i(e.role)),e.source&&t.set(`source`,e.source),e.licence&&t.set(`licence`,e.licence),e.style&&t.set(`style`,e.style),e.offset&&t.set(`offset`,String(e.offset)),`/__youi/query?${t}`}async function _(n,r={}){if(!h){let e=null;try{e=await fetch(g(n),{cache:`no-store`,...r.signal?{signal:r.signal}:{}})}catch(t){if(t.name===`AbortError`)throw t;e=null}let t=e&&(e.headers.get(`content-type`)??``).includes(`application/json`)?await e.json().catch(()=>null):null;if(e?.ok&&t?.hits)return{hits:t.hits,matched:t.matched??t.total??t.hits.length,offset:n.offset,facets:t.facets??{role:{},source:{},licence:{},style:{}},from:`index`};if(e&&t?.error&&e.status!==404)throw new p(t.error);(!e||!t)&&(h=!0)}m??=e().then(e=>e?t(e):null);let i=await m.catch(()=>null);if(!i)throw new p(`No Discover listings here: run youiyoux discover sync, then open the hub with youiyoux ui (its own server reads the local index).`);return f(i,n)}export{_ as a,o as i,i as n,c as o,a as r,l as s,n as t};
@@ -1 +1 @@
1
- import{i as e,t}from"./react-DB-4Zxce.js";import{i as n,t as r}from"./jsx-runtime-D6zNwnaE.js";import{c as i}from"./main-cvOFSjox.js";var a=Object.defineProperty,o=(e,t)=>a(e,`name`,{value:t,configurable:!0}),s=!!(typeof window<`u`&&window.document&&window.document.createElement);function c(e,t,{checkForDefaultPrevented:n=!0}={}){return o(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},`handleEvent`)}o(c,`composeEventHandlers`);function l(e){if(!s)throw Error(`Cannot access window outside of the DOM`);return e?.ownerDocument?.defaultView??window}o(l,`getOwnerWindow`);function u(e){if(!s)throw Error(`Cannot access document outside of the DOM`);return e?.ownerDocument??document}o(u,`getOwnerDocument`);function d(e,t=!1){let{activeElement:n}=u(e);if(!n?.nodeName)return null;if(f(n)&&n.contentDocument)return d(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=u(n).getElementById(e);if(t)return t}}return n}o(d,`getActiveElement`);function f(e){return e.tagName===`IFRAME`}o(f,`isFrame`);var p=e(t(),1),m=r(),h=Object.defineProperty,g=(e,t)=>h(e,`name`,{value:t,configurable:!0});function _(e,t){let n=p.createContext(t);n.displayName=e+`Context`;let r=g(e=>{let{children:t,...r}=e,i=p.useMemo(()=>r,Object.values(r));return(0,m.jsx)(n.Provider,{value:i,children:t})},`Provider`);r.displayName=e+`Provider`;function i(r,i={}){let{optional:a=!1}=i,o=p.useContext(n);if(o)return o;if(t!==void 0)return t;if(!a)throw Error(`\`${r}\` must be used within \`${e}\``)}return g(i,`useContext`),[r,i]}g(_,`createContext`);function v(e,t=[]){let n=[];function r(t,r){let i=p.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=g(t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=p.useMemo(()=>o,Object.values(o));return(0,m.jsx)(s.Provider,{value:c,children:r})},`Provider`);o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,u=p.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return g(s,`useContext`),[o,s]}g(r,`createContext`);let i=g(()=>{let t=n.map(e=>p.createContext(e));return g(function(n){let r=n?.[e]||t;return p.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])},`useScope`)},`createScope`);return i.scopeName=e,[r,y(i,...t)]}g(v,`createContextScope`);function y(...e){let t=e[0];if(e.length===1)return t;let n=g(()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return g(function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])},`useComposedScopes`)},`createScope`);return n.scopeName=t.scopeName,n}g(y,`composeContextScopes`);var b=globalThis?.document?p.useLayoutEffect:()=>{},x=Object.defineProperty,ee=(e,t)=>x(e,`name`,{value:t,configurable:!0}),te=p.useId||(()=>void 0),S=0;function C(e){let[t,n]=p.useState(te());return b(()=>{e||n(e=>e??String(S++))},[e]),e||(t?`radix-${t}`:``)}ee(C,`useId`);var w=e(n(),1),T=Object.defineProperty,E=(e,t)=>T(e,`name`,{value:t,configurable:!0}),D=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=i(`Primitive.${t}`),r=p.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,m.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function O(e,t){e&&w.flushSync(()=>e.dispatchEvent(t))}E(O,`dispatchDiscreteCustomEvent`);var k=Object.defineProperty,A=(e,t)=>k(e,`name`,{value:t,configurable:!0});function j(e){let t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>((...e)=>t.current?.(...e)),[])}A(j,`useCallbackRef`);var M=Object.defineProperty,N=(e,t)=>M(e,`name`,{value:t,configurable:!0}),P=p.useEffectEvent,F=p.useInsertionEffect;function I(e){if(typeof P==`function`)return P(e);let t=p.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof F==`function`?F(()=>{t.current=e}):b(()=>{t.current=e}),p.useMemo(()=>((...e)=>t.current?.(...e)),[])}N(I,`useEffectEvent`);var L=Object.defineProperty,R=(e,t)=>L(e,`name`,{value:t,configurable:!0}),z=p.useInsertionEffect||b;function B({prop:e,defaultProp:t,onChange:n=R(()=>{},`onChange`),caller:r}){let[i,a,o]=V({defaultProp:t,onChange:n}),s=e!==void 0;return[s?e:i,p.useCallback(t=>{if(s){let n=H(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}R(B,`useControllableState`);function V({defaultProp:e,onChange:t}){let[n,r]=p.useState(e),i=p.useRef(n),a=p.useRef(t);return z(()=>{a.current=t},[t]),p.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}R(V,`useUncontrolledState`);function H(e){return typeof e==`function`}R(H,`isFunction`);var U=Symbol(`RADIX:SYNC_STATE`);function W(e,t,n,r){let{prop:i,defaultProp:a,onChange:o,caller:s}=t,c=i!==void 0,l=I(o),u=[{...n,state:a}];r&&u.push(r);let[d,f]=p.useReducer((t,n)=>{if(n.type===U)return{...t,state:n.state};let r=e(t,n);return c&&!Object.is(r.state,t.state)&&l(r.state),r},...u),m=d.state,h=p.useRef(m);p.useEffect(()=>{h.current!==m&&(h.current=m,c||l(m))},[m,h,c]);let g=p.useMemo(()=>i===void 0?d:{...d,state:i},[d,i]);return p.useEffect(()=>{c&&!Object.is(i,d.state)&&f({type:U,state:i})},[i,d.state,c]),[g,f]}R(W,`useControllableStateReducer`);var G=Object.defineProperty,K=(e,t)=>G(e,`name`,{value:t,configurable:!0});function q(e,t){return p.useReducer((e,n)=>t[e][n]??e,e)}K(q,`useStateMachine`);var J=K(e=>{let{present:t,children:n}=e,r=Y(t),i=typeof n==`function`?n({present:r.isPresent}):p.Children.only(n),a=Z(r.ref,$(i));return typeof n==`function`||r.isPresent?p.cloneElement(i,{ref:a}):null},`Presence`);function Y(e){let[t,n]=p.useState(),r=p.useRef(null),i=p.useRef(e),a=p.useRef(`none`),o=p.useRef(void 0),[s,c]=q(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return p.useEffect(()=>{s===`mounted`?(a.current=o.current??Q(r.current),o.current=void 0):a.current=`none`},[s]),b(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=Q(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),b(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=K(a=>{let o=Q(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},`handleAnimationEnd`),s=K(e=>{e.target===t&&(a.current=Q(r.current))},`handleAnimationStart`);return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:p.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=Q(t)}else r.current=null;n(e)},[])}}K(Y,`usePresence`);function X(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}K(X,`setRef`);function Z(...e){let t=p.useRef(e);return t.current=e,p.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=X(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():X(n[e],null)}}},[])}K(Z,`useStableComposedRefs`);function Q(e){return e?.animationName||`none`}K(Q,`getAnimationName`);function $(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}K($,`getElementRef`);export{O as a,v as c,D as i,c as l,B as n,C as o,j as r,b as s,J as t};
1
+ import{i as e,t}from"./react-DB-4Zxce.js";import{i as n,t as r}from"./jsx-runtime-D6zNwnaE.js";import{c as i}from"./main-Djqho539.js";var a=Object.defineProperty,o=(e,t)=>a(e,`name`,{value:t,configurable:!0}),s=!!(typeof window<`u`&&window.document&&window.document.createElement);function c(e,t,{checkForDefaultPrevented:n=!0}={}){return o(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},`handleEvent`)}o(c,`composeEventHandlers`);function l(e){if(!s)throw Error(`Cannot access window outside of the DOM`);return e?.ownerDocument?.defaultView??window}o(l,`getOwnerWindow`);function u(e){if(!s)throw Error(`Cannot access document outside of the DOM`);return e?.ownerDocument??document}o(u,`getOwnerDocument`);function d(e,t=!1){let{activeElement:n}=u(e);if(!n?.nodeName)return null;if(f(n)&&n.contentDocument)return d(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=u(n).getElementById(e);if(t)return t}}return n}o(d,`getActiveElement`);function f(e){return e.tagName===`IFRAME`}o(f,`isFrame`);var p=e(t(),1),m=r(),h=Object.defineProperty,g=(e,t)=>h(e,`name`,{value:t,configurable:!0});function _(e,t){let n=p.createContext(t);n.displayName=e+`Context`;let r=g(e=>{let{children:t,...r}=e,i=p.useMemo(()=>r,Object.values(r));return(0,m.jsx)(n.Provider,{value:i,children:t})},`Provider`);r.displayName=e+`Provider`;function i(r,i={}){let{optional:a=!1}=i,o=p.useContext(n);if(o)return o;if(t!==void 0)return t;if(!a)throw Error(`\`${r}\` must be used within \`${e}\``)}return g(i,`useContext`),[r,i]}g(_,`createContext`);function v(e,t=[]){let n=[];function r(t,r){let i=p.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=g(t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=p.useMemo(()=>o,Object.values(o));return(0,m.jsx)(s.Provider,{value:c,children:r})},`Provider`);o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,u=p.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return g(s,`useContext`),[o,s]}g(r,`createContext`);let i=g(()=>{let t=n.map(e=>p.createContext(e));return g(function(n){let r=n?.[e]||t;return p.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])},`useScope`)},`createScope`);return i.scopeName=e,[r,y(i,...t)]}g(v,`createContextScope`);function y(...e){let t=e[0];if(e.length===1)return t;let n=g(()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return g(function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])},`useComposedScopes`)},`createScope`);return n.scopeName=t.scopeName,n}g(y,`composeContextScopes`);var b=globalThis?.document?p.useLayoutEffect:()=>{},x=Object.defineProperty,ee=(e,t)=>x(e,`name`,{value:t,configurable:!0}),te=p.useId||(()=>void 0),S=0;function C(e){let[t,n]=p.useState(te());return b(()=>{e||n(e=>e??String(S++))},[e]),e||(t?`radix-${t}`:``)}ee(C,`useId`);var w=e(n(),1),T=Object.defineProperty,E=(e,t)=>T(e,`name`,{value:t,configurable:!0}),D=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=i(`Primitive.${t}`),r=p.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,m.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function O(e,t){e&&w.flushSync(()=>e.dispatchEvent(t))}E(O,`dispatchDiscreteCustomEvent`);var k=Object.defineProperty,A=(e,t)=>k(e,`name`,{value:t,configurable:!0});function j(e){let t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>((...e)=>t.current?.(...e)),[])}A(j,`useCallbackRef`);var M=Object.defineProperty,N=(e,t)=>M(e,`name`,{value:t,configurable:!0}),P=p.useEffectEvent,F=p.useInsertionEffect;function I(e){if(typeof P==`function`)return P(e);let t=p.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof F==`function`?F(()=>{t.current=e}):b(()=>{t.current=e}),p.useMemo(()=>((...e)=>t.current?.(...e)),[])}N(I,`useEffectEvent`);var L=Object.defineProperty,R=(e,t)=>L(e,`name`,{value:t,configurable:!0}),z=p.useInsertionEffect||b;function B({prop:e,defaultProp:t,onChange:n=R(()=>{},`onChange`),caller:r}){let[i,a,o]=V({defaultProp:t,onChange:n}),s=e!==void 0;return[s?e:i,p.useCallback(t=>{if(s){let n=H(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}R(B,`useControllableState`);function V({defaultProp:e,onChange:t}){let[n,r]=p.useState(e),i=p.useRef(n),a=p.useRef(t);return z(()=>{a.current=t},[t]),p.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}R(V,`useUncontrolledState`);function H(e){return typeof e==`function`}R(H,`isFunction`);var U=Symbol(`RADIX:SYNC_STATE`);function W(e,t,n,r){let{prop:i,defaultProp:a,onChange:o,caller:s}=t,c=i!==void 0,l=I(o),u=[{...n,state:a}];r&&u.push(r);let[d,f]=p.useReducer((t,n)=>{if(n.type===U)return{...t,state:n.state};let r=e(t,n);return c&&!Object.is(r.state,t.state)&&l(r.state),r},...u),m=d.state,h=p.useRef(m);p.useEffect(()=>{h.current!==m&&(h.current=m,c||l(m))},[m,h,c]);let g=p.useMemo(()=>i===void 0?d:{...d,state:i},[d,i]);return p.useEffect(()=>{c&&!Object.is(i,d.state)&&f({type:U,state:i})},[i,d.state,c]),[g,f]}R(W,`useControllableStateReducer`);var G=Object.defineProperty,K=(e,t)=>G(e,`name`,{value:t,configurable:!0});function q(e,t){return p.useReducer((e,n)=>t[e][n]??e,e)}K(q,`useStateMachine`);var J=K(e=>{let{present:t,children:n}=e,r=Y(t),i=typeof n==`function`?n({present:r.isPresent}):p.Children.only(n),a=Z(r.ref,$(i));return typeof n==`function`||r.isPresent?p.cloneElement(i,{ref:a}):null},`Presence`);function Y(e){let[t,n]=p.useState(),r=p.useRef(null),i=p.useRef(e),a=p.useRef(`none`),o=p.useRef(void 0),[s,c]=q(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return p.useEffect(()=>{s===`mounted`?(a.current=o.current??Q(r.current),o.current=void 0):a.current=`none`},[s]),b(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=Q(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),b(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=K(a=>{let o=Q(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},`handleAnimationEnd`),s=K(e=>{e.target===t&&(a.current=Q(r.current))},`handleAnimationStart`);return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:p.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=Q(t)}else r.current=null;n(e)},[])}}K(Y,`usePresence`);function X(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}K(X,`setRef`);function Z(...e){let t=p.useRef(e);return t.current=e,p.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=X(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():X(n[e],null)}}},[])}K(Z,`useStableComposedRefs`);function Q(e){return e?.animationName||`none`}K(Q,`getAnimationName`);function $(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}K($,`getElementRef`);export{O as a,v as c,D as i,c as l,B as n,C as o,j as r,b as s,J as t};