velloo 0.4.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/README.md +29 -7
  2. package/canvas/assets/index-BDBBHdHH.css +2 -0
  3. package/canvas/assets/index-QdsLJNY9.js +29 -0
  4. package/canvas/assets/{lucide-all-Bcm80WFX.js → lucide-all-R8DUyY-B.js} +1 -1
  5. package/canvas/index.html +2 -2
  6. package/chunk-0rdf6trc.js +2 -0
  7. package/{chunk-npsg7btt.js → chunk-0wafc9aw.js} +1 -1
  8. package/chunk-0wqxb8r9.js +3 -0
  9. package/{chunk-e6nhc3ay.js → chunk-10hap8kc.js} +1 -1
  10. package/chunk-18eqh3s1.js +2 -0
  11. package/chunk-19xyzep8.js +2 -0
  12. package/{chunk-7gtvstne.js → chunk-1h3gqy7w.js} +1 -1
  13. package/{chunk-vjrn10xr.js → chunk-33t0csxs.js} +2 -2
  14. package/{chunk-7xffbj5h.js → chunk-3ffs39e8.js} +1 -1
  15. package/chunk-42bj6r30.js +3 -0
  16. package/chunk-49w26e94.js +5 -0
  17. package/{chunk-7a45tn73.js → chunk-4pkw6d9n.js} +2 -2
  18. package/{chunk-ph94nrc8.js → chunk-4sjvdakg.js} +1 -1
  19. package/chunk-5f0xv80x.js +5 -0
  20. package/{chunk-2dm4x17z.js → chunk-5ma8zbty.js} +1 -1
  21. package/{chunk-t9ygewjx.js → chunk-5y9hem1j.js} +1 -1
  22. package/chunk-66qgm91k.js +708 -0
  23. package/{chunk-dj1pp4e3.js → chunk-675tr675.js} +1 -1
  24. package/{chunk-jwzhhhzn.js → chunk-6cgvzwec.js} +1 -1
  25. package/chunk-6k05kqnc.js +3 -0
  26. package/{chunk-py6sjyzk.js → chunk-6ytv1v2r.js} +1 -1
  27. package/{chunk-2h24va0j.js → chunk-75sc3adm.js} +1 -1
  28. package/chunk-7cexzg71.js +2 -0
  29. package/chunk-98rann8t.js +2 -0
  30. package/{chunk-b58pnj20.js → chunk-a16mz9zf.js} +1 -1
  31. package/{chunk-m1wp8cpt.js → chunk-afe25dpr.js} +1 -1
  32. package/{chunk-k3dpwjx4.js → chunk-ahm4zd56.js} +1 -1
  33. package/chunk-asvdqkdp.js +6 -0
  34. package/{chunk-rfrbnw8r.js → chunk-b3x80jc1.js} +1 -1
  35. package/{chunk-tr49kraa.js → chunk-cdqah1hy.js} +1 -1
  36. package/{chunk-r03aywsb.js → chunk-cqt1dpxd.js} +1 -1
  37. package/{chunk-xbhxzdat.js → chunk-d4r0myxr.js} +1 -1
  38. package/{chunk-km3z2czq.js → chunk-d9kx7v12.js} +1 -1
  39. package/{chunk-2y9nnzpr.js → chunk-df557bn4.js} +1 -1
  40. package/{chunk-6zr596r2.js → chunk-edgwx026.js} +1 -1
  41. package/chunk-emv1j50t.js +2 -0
  42. package/{chunk-jep31ffe.js → chunk-ewgdcgrk.js} +1 -1
  43. package/chunk-f45p6kcb.js +2 -0
  44. package/{chunk-b4jy4hcd.js → chunk-gn9wcc1b.js} +1 -1
  45. package/{chunk-cejmmx3r.js → chunk-hr3gbak5.js} +2 -2
  46. package/{chunk-91pajfnm.js → chunk-j7tzbt3d.js} +1 -1
  47. package/chunk-mm8wv3bg.js +3 -0
  48. package/chunk-nbbnb5e9.js +3 -0
  49. package/{chunk-a9mgvspm.js → chunk-ngbqd7kb.js} +32 -12
  50. package/chunk-nkqtnwzz.js +2 -0
  51. package/{chunk-2jbhv7vh.js → chunk-q3kf8243.js} +1 -1
  52. package/{chunk-8t5phg0s.js → chunk-qpv28z8d.js} +1 -1
  53. package/{chunk-hsrg23gd.js → chunk-rd65xm6r.js} +1 -1
  54. package/{chunk-aa3str7g.js → chunk-ryga3ny1.js} +1 -1
  55. package/{chunk-cvn689d5.js → chunk-sb5h27w9.js} +2 -2
  56. package/chunk-tw4kw4ps.js +22 -0
  57. package/chunk-v6c3h9ft.js +3 -0
  58. package/chunk-vgx47anc.js +3 -0
  59. package/chunk-vrvkvb0v.js +244 -0
  60. package/{chunk-db7mf114.js → chunk-vryadew3.js} +9 -7
  61. package/chunk-w6f40y2x.js +11 -0
  62. package/{chunk-0446t32z.js → chunk-we8hvy6e.js} +1 -1
  63. package/{chunk-ykdx12na.js → chunk-wkqrb2tz.js} +1 -1
  64. package/{chunk-r9ekd92e.js → chunk-xzkczmgg.js} +1 -1
  65. package/{chunk-yfttm20w.js → chunk-ycrddh47.js} +1 -1
  66. package/{chunk-j5axqyan.js → chunk-z78c1kf8.js} +1 -1
  67. package/cli.js +1 -1
  68. package/package.json +3 -1
  69. package/pkgs/provider-html/src/index.ts +68 -0
  70. package/pkgs/provider-html/src/registry.ts +121 -0
  71. package/pkgs/provider-html/src/version.ts +1 -0
  72. package/pkgs/provider-none/src/components-inline.tsx +12 -3
  73. package/pkgs/provider-none/src/components.tsx +11 -3
  74. package/pkgs/provider-none/src/manifest.ts +1 -0
  75. package/pkgs/schema/src/config.ts +33 -1
  76. package/pkgs/schema/src/css-declarations.ts +41 -0
  77. package/pkgs/schema/src/index.ts +3 -0
  78. package/pkgs/schema/src/theme.ts +40 -0
  79. package/plugins/claude/velloo/agents/velloo-design-reviewer.md +56 -13
  80. package/plugins/claude/velloo/agents/velloo-designer.md +4 -1
  81. package/skills/velloo-setup/SKILL.md +19 -55
  82. package/canvas/assets/index-B1OD0Yz5.css +0 -2
  83. package/canvas/assets/index-BWYFx2Rr.js +0 -29
  84. package/chunk-00t0bz7x.js +0 -244
  85. package/chunk-0zen7bzb.js +0 -3
  86. package/chunk-5ywkk7d6.js +0 -2
  87. package/chunk-b7famda5.js +0 -3
  88. package/chunk-f5g45xed.js +0 -2
  89. package/chunk-fjbzk4sw.js +0 -3
  90. package/chunk-hv52a6hf.js +0 -2
  91. package/chunk-mcymwefw.js +0 -5
  92. package/chunk-n0kx20s2.js +0 -2
  93. package/chunk-nwf2kn41.js +0 -26
  94. package/chunk-phz993p3.js +0 -2
  95. package/chunk-qan5dnjt.js +0 -688
  96. package/chunk-r5d0jsnd.js +0 -5
  97. package/chunk-shac6bat.js +0 -6
  98. package/chunk-t4zvcece.js +0 -10
  99. package/chunk-tarws372.js +0 -2
  100. package/chunk-yghypth2.js +0 -2
  101. package/chunk-zqtz23xk.js +0 -3
@@ -0,0 +1,29 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/lucide-all-R8DUyY-B.js","assets/rolldown-runtime-hePW80VL.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,n,t as r}from"./react-D0Ec-185.js";import{C as i,D as a,E as o,S as s,T as c,_ as l,a as u,b as d,c as f,d as p,f as m,g as h,h as g,i as _,l as v,m as y,n as b,o as x,p as S,r as C,s as w,t as T,u as E,v as D,w as O,x as k,y as A}from"./vendor-CKmQ-Zst.js";import{$ as ee,A as te,B as ne,C as re,D as ie,E as ae,F as oe,G as se,H as ce,I as le,J as ue,K as de,L as fe,M as pe,N as j,O as me,P as he,Q as ge,R as _e,S as ve,T as ye,U as be,V as xe,W as Se,X as Ce,Y as we,Z as Te,_ as Ee,_t as De,a as Oe,at as ke,b as Ae,c as je,ct as Me,d as Ne,dt as Pe,et as Fe,f as Ie,ft as Le,g as Re,gt as ze,h as Be,ht as Ve,i as He,it as Ue,j as We,k as Ge,l as Ke,lt as qe,m as Je,mt as Ye,n as Xe,nt as Ze,o as Qe,ot as $e,p as et,pt as tt,q as nt,r as rt,rt as it,s as at,st as ot,t as st,tt as ct,u as lt,ut,v as dt,vt as ft,w as pt,x as mt,y as ht,yt as gt,z as _t}from"./radix-gmpYzWRH.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var vt=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),yt=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),bt=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),xt=e=>{let t=bt(e);return t.charAt(0).toUpperCase()+t.slice(1)},St={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},Ct=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},M=e(t(),1),wt=(0,M.createContext)({});function Tt({children:e,size:t,color:n,strokeWidth:r,absoluteStrokeWidth:i,className:a}){let o=(0,M.useMemo)(()=>({size:t,color:n,strokeWidth:r,absoluteStrokeWidth:i,className:a}),[t,n,r,i,a]);return(0,M.createElement)(wt.Provider,{value:o},e)}var Et=()=>(0,M.useContext)(wt),Dt=(0,M.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=Et()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,M.createElement)(`svg`,{ref:c,...St,width:t??l??St.width,height:t??l??St.height,stroke:e??f,strokeWidth:m,className:vt(`lucide`,p,i),...!a&&!Ct(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,M.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),N=(e,t)=>{let n=(0,M.forwardRef)(({className:n,...r},i)=>(0,M.createElement)(Dt,{ref:i,iconNode:t,className:vt(`lucide-${yt(xt(e))}`,`lucide-${e}`,n),...r}));return n.displayName=xt(e),n},Ot=N(`archive-restore`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h2`,key:`tvwodi`}],[`path`,{d:`M20 8v11a2 2 0 0 1-2 2h-2`,key:`1gkqxj`}],[`path`,{d:`m9 15 3-3 3 3`,key:`1pd0qc`}],[`path`,{d:`M12 12v9`,key:`192myk`}]]),kt=N(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),At=N(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),jt=N(`arrow-left-right`,[[`path`,{d:`M8 3 4 7l4 4`,key:`9rb6wj`}],[`path`,{d:`M4 7h16`,key:`6tx8e3`}],[`path`,{d:`m16 21 4-4-4-4`,key:`siv7j2`}],[`path`,{d:`M20 17H4`,key:`h6l3hr`}]]),Mt=N(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),Nt=N(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),Pt=N(`blend`,[[`circle`,{cx:`15`,cy:`9`,r:`7`,key:`1i12rt`}],[`circle`,{cx:`9`,cy:`15`,r:`7`,key:`19bs8k`}]]),Ft=N(`blocks`,[[`path`,{d:`M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2`,key:`1ah6g2`}],[`rect`,{x:`14`,y:`2`,width:`8`,height:`8`,rx:`1`,key:`88lufb`}]]),It=N(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),Lt=N(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),Rt=N(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),zt=N(`bug`,[[`path`,{d:`M12 20v-9`,key:`1qisl0`}],[`path`,{d:`M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z`,key:`uouzyp`}],[`path`,{d:`M14.12 3.88 16 2`,key:`qol33r`}],[`path`,{d:`M21 21a4 4 0 0 0-3.81-4`,key:`1b0z45`}],[`path`,{d:`M21 5a4 4 0 0 1-3.55 3.97`,key:`5cxbf6`}],[`path`,{d:`M22 13h-4`,key:`1jl80f`}],[`path`,{d:`M3 21a4 4 0 0 1 3.81-4`,key:`1fjd4g`}],[`path`,{d:`M3 5a4 4 0 0 0 3.55 3.97`,key:`1d7oge`}],[`path`,{d:`M6 13H2`,key:`82j7cp`}],[`path`,{d:`m8 2 1.88 1.88`,key:`fmnt4t`}],[`path`,{d:`M9 7.13V6a3 3 0 1 1 6 0v1.13`,key:`1vgav8`}]]),Bt=N(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Vt=N(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Ht=N(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Ut=N(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Wt=N(`circle-arrow-up`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 12-4-4-4 4`,key:`177agl`}],[`path`,{d:`M12 16V8`,key:`1sbj14`}]]),Gt=N(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 9-5.5 5.5L8 12`,key:`xofnsj`}]]),Kt=N(`cloud-upload`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`m8 17 4-4 4 4`,key:`1quai1`}]]),qt=N(`cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]),Jt=N(`coins`,[[`path`,{d:`M13.744 17.736a6 6 0 1 1-7.48-7.48`,key:`bq4yh3`}],[`path`,{d:`M15 6h1v4`,key:`11y1tn`}],[`path`,{d:`m6.134 14.768.866-.5 2 3.464`,key:`17snzx`}],[`circle`,{cx:`16`,cy:`8`,r:`6`,key:`14bfc9`}]]),Yt=N(`component`,[[`path`,{d:`M15.536 11.293a1 1 0 0 0 0 1.414l2.376 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z`,key:`1uwlt4`}],[`path`,{d:`M2.297 11.293a1 1 0 0 0 0 1.414l2.377 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414L6.088 8.916a1 1 0 0 0-1.414 0z`,key:`10291m`}],[`path`,{d:`M8.916 17.912a1 1 0 0 0 0 1.415l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.415l-2.377-2.376a1 1 0 0 0-1.414 0z`,key:`1tqoq1`}],[`path`,{d:`M8.916 4.674a1 1 0 0 0 0 1.414l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z`,key:`1x6lto`}]]),Xt=N(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Zt=N(`crosshair`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`22`,x2:`18`,y1:`12`,y2:`12`,key:`l9bcsi`}],[`line`,{x1:`6`,x2:`2`,y1:`12`,y2:`12`,key:`13hhkx`}],[`line`,{x1:`12`,x2:`12`,y1:`6`,y2:`2`,key:`10w3f3`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`18`,key:`15g9kq`}]]),Qt=N(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),$t=N(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),en=N(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),tn=N(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),nn=N(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),rn=N(`file-stack`,[[`path`,{d:`M11 21a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-8a1 1 0 0 1 1-1`,key:`likhh7`}],[`path`,{d:`M16 16a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1`,key:`17ky3x`}],[`path`,{d:`M21 6a2 2 0 0 0-.586-1.414l-2-2A2 2 0 0 0 17 2h-3a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1z`,key:`1hyeo0`}]]),an=N(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),on=N(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),sn=N(`frame`,[[`line`,{x1:`22`,x2:`2`,y1:`6`,y2:`6`,key:`15w7dq`}],[`line`,{x1:`22`,x2:`2`,y1:`18`,y2:`18`,key:`1ip48p`}],[`line`,{x1:`6`,x2:`6`,y1:`2`,y2:`22`,key:`a2lnyx`}],[`line`,{x1:`18`,x2:`18`,y1:`2`,y2:`22`,key:`8vb6jd`}]]),cn=N(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),ln=N(`hand`,[[`path`,{d:`M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2`,key:`1fvzgz`}],[`path`,{d:`M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2`,key:`1kc0my`}],[`path`,{d:`M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8`,key:`10h0bg`}],[`path`,{d:`M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15`,key:`1s1gnw`}]]),un=N(`heading`,[[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`path`,{d:`M6 20V4`,key:`1w1bmo`}],[`path`,{d:`M18 20V4`,key:`o2hl4u`}]]),dn=N(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),fn=N(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),pn=N(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),mn=N(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),hn=N(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),gn=N(`library-big`,[[`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`}]]),_n=N(`library`,[[`path`,{d:`m16 6 4 14`,key:`ji33uf`}],[`path`,{d:`M12 6v14`,key:`1n7gus`}],[`path`,{d:`M8 8v12`,key:`1gg7y9`}],[`path`,{d:`M4 4v16`,key:`6qkkli`}]]),vn=N(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),yn=N(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),bn=N(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),xn=N(`lock-open`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 9.9-1`,key:`1mm8w8`}]]),Sn=N(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),Cn=N(`log-in`,[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]),wn=N(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),Tn=N(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),En=N(`map-pin`,[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]),Dn=N(`maximize-2`,[[`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`}]]),On=N(`message-circle`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}]]),kn=N(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),An=N(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),jn=N(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),Mn=N(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),Nn=N(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),Pn=N(`mouse-pointer-2`,[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]),Fn=N(`mouse-pointer-click`,[[`path`,{d:`M14 4.1 12 6`,key:`ita8i4`}],[`path`,{d:`m5.1 8-2.9-.8`,key:`1go3kf`}],[`path`,{d:`m6 12-1.9 2`,key:`mnht97`}],[`path`,{d:`M7.2 2.2 8 5.1`,key:`1cfko1`}],[`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`,key:`s0h3yz`}]]),In=N(`navigation`,[[`polygon`,{points:`3 11 22 2 13 21 11 13 3 11`,key:`1ltx0t`}]]),Ln=N(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),Rn=N(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),zn=N(`panel-bottom`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 15h18`,key:`5xshup`}]]),Bn=N(`panel-left-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]]),Vn=N(`panel-left-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]]),Hn=N(`panel-right-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m8 9 3 3-3 3`,key:`12hl5m`}]]),Un=N(`panel-right-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m10 15-3-3 3-3`,key:`1pgupc`}]]),Wn=N(`panel-top`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}]]),Gn=N(`panels-top-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M9 21V9`,key:`1oto5p`}]]),Kn=N(`pen-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),qn=N(`pencil-ruler`,[[`path`,{d:`M13 7 8.7 2.7a2.41 2.41 0 0 0-3.4 0L2.7 5.3a2.41 2.41 0 0 0 0 3.4L7 13`,key:`orapub`}],[`path`,{d:`m8 6 2-2`,key:`115y1s`}],[`path`,{d:`m18 16 2-2`,key:`ee94s4`}],[`path`,{d:`m17 11 4.3 4.3c.94.94.94 2.46 0 3.4l-2.6 2.6c-.94.94-2.46.94-3.4 0L11 17`,key:`cfq27r`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),Jn=N(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),Yn=N(`pilcrow`,[[`path`,{d:`M13 4v16`,key:`8vvj80`}],[`path`,{d:`M17 4v16`,key:`7dpous`}],[`path`,{d:`M19 4H9.5a4.5 4.5 0 0 0 0 9H13`,key:`sh4n9v`}]]),Xn=N(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Zn=N(`puzzle`,[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]),Qn=N(`quote`,[[`path`,{d:`M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`rib7q0`}],[`path`,{d:`M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`1ymkrd`}]]),$n=N(`redo-2`,[[`path`,{d:`m15 14 5-5-5-5`,key:`12vg1m`}],[`path`,{d:`M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13`,key:`6uklza`}]]),er=N(`reply`,[[`path`,{d:`M20 18v-2a4 4 0 0 0-4-4H4`,key:`5vmcpk`}],[`path`,{d:`m9 17-5-5 5-5`,key:`nvlc11`}]]),tr=N(`rotate-ccw`,[[`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`}]]),nr=N(`search-x`,[[`path`,{d:`m13.5 8.5-5 5`,key:`1cs55j`}],[`path`,{d:`m8.5 8.5 5 5`,key:`a8mexj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),rr=N(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),ir=N(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),ar=N(`shapes`,[[`path`,{d:`M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z`,key:`1bo67w`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}],[`circle`,{cx:`17.5`,cy:`17.5`,r:`3.5`,key:`w3z12y`}]]),or=N(`share-2`,[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]),sr=N(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),cr=N(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),lr=N(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),ur=N(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),dr=N(`square-dashed`,[[`path`,{d:`M5 3a2 2 0 0 0-2 2`,key:`y57alp`}],[`path`,{d:`M19 3a2 2 0 0 1 2 2`,key:`18rm91`}],[`path`,{d:`M21 19a2 2 0 0 1-2 2`,key:`1j7049`}],[`path`,{d:`M5 21a2 2 0 0 1-2-2`,key:`sbafld`}],[`path`,{d:`M9 3h1`,key:`1yesri`}],[`path`,{d:`M9 21h1`,key:`15o7lz`}],[`path`,{d:`M14 3h1`,key:`1ec4yj`}],[`path`,{d:`M14 21h1`,key:`v9vybs`}],[`path`,{d:`M3 9v1`,key:`1r0deq`}],[`path`,{d:`M21 9v1`,key:`mxsmne`}],[`path`,{d:`M3 14v1`,key:`vnatye`}],[`path`,{d:`M21 14v1`,key:`169vum`}]]),fr=N(`square-mouse-pointer`,[[`path`,{d:`M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z`,key:`xwnzip`}],[`path`,{d:`M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6`,key:`14rsvq`}]]),pr=N(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),mr=N(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),hr=N(`sticky-note`,[[`path`,{d:`M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z`,key:`1dfntj`}],[`path`,{d:`M15 3v5a1 1 0 0 0 1 1h5`,key:`6s6qgf`}]]),gr=N(`sun-moon`,[[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M14.837 16.385a6 6 0 1 1-7.223-7.222c.624-.147.97.66.715 1.248a4 4 0 0 0 5.26 5.259c.589-.255 1.396.09 1.248.715`,key:`xlf6rm`}],[`path`,{d:`M16 12a4 4 0 0 0-4-4`,key:`6vsxu`}],[`path`,{d:`m19 5-1.256 1.256`,key:`1yg6a6`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}]]),_r=N(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),vr=N(`table`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M3 15h18`,key:`5xshup`}]]),yr=N(`tablet`,[[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,ry:`2`,key:`76otgf`}],[`line`,{x1:`12`,x2:`12.01`,y1:`18`,y2:`18`,key:`1dp563`}]]),br=N(`text-cursor-input`,[[`path`,{d:`M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6`,key:`1528k5`}],[`path`,{d:`M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7`,key:`13ksps`}],[`path`,{d:`M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1`,key:`1n9rhb`}],[`path`,{d:`M6 4h1a2 2 0 0 1 2 2 2 2 0 0 1 2-2h1`,key:`1mj8rg`}],[`path`,{d:`M9 6v12`,key:`velyjx`}]]),xr=N(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),Sr=N(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Cr=N(`type`,[[`path`,{d:`M12 4v16`,key:`1654pz`}],[`path`,{d:`M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2`,key:`e0r10z`}],[`path`,{d:`M9 20h6`,key:`s66wpe`}]]),wr=N(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),Tr=N(`unlink`,[[`path`,{d:`m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71`,key:`yqzxt4`}],[`path`,{d:`m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71`,key:`4qinb0`}],[`line`,{x1:`8`,x2:`8`,y1:`2`,y2:`5`,key:`1041cp`}],[`line`,{x1:`2`,x2:`5`,y1:`8`,y2:`8`,key:`14m1p5`}],[`line`,{x1:`16`,x2:`16`,y1:`19`,y2:`22`,key:`rzdirn`}],[`line`,{x1:`19`,x2:`22`,y1:`16`,y2:`16`,key:`ox905f`}]]),Er=N(`user-plus`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`line`,{x1:`19`,x2:`19`,y1:`8`,y2:`14`,key:`1bvyxn`}],[`line`,{x1:`22`,x2:`16`,y1:`11`,y2:`11`,key:`1shjgl`}]]),Dr=N(`user-round`,[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]]),Or=N(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),kr=N(`video`,[[`path`,{d:`m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5`,key:`ftymec`}],[`rect`,{x:`2`,y:`6`,width:`14`,height:`12`,rx:`2`,key:`158x01`}]]),Ar=N(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),jr=N(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Mr=n(),Nr=!0;function Pr(e){Nr=e}function Fr(){if(!Nr)throw Error(`Disconnected from the velloo daemon — edits are paused until it reconnects.`)}var Ir=O([A({type:l(`screen-changed`),screenId:i().min(1)}),A({type:l(`board-changed`),boardId:i().min(1)}),A({type:l(`theme-changed`)}),A({type:l(`snippet-changed`),snippetId:i().min(1)}),A({type:l(`annotations-changed`),screenId:i().min(1)}),A({type:l(`notes-changed`),boardId:i().min(1)}),A({type:l(`comments-changed`),boardId:i().min(1),scope:p([`local`,`shared`])}),A({type:l(`config-changed`)}),A({type:l(`folder-reloaded`)}),A({type:l(`reload-error`),source:i(),message:i()}),A({type:l(`activity`)}).loose()]);function Lr(e){if(typeof e!=`string`)return null;let t;try{t=JSON.parse(e)}catch{return null}let n=Ir.safeParse(t);return n.success?n.data:null}var Rr=p([`public`,`private`]);A({appUrl:i().optional(),issuer:i().optional(),clientId:i().optional()}),A({ok:y().optional(),db:A({ok:y().optional()}).optional(),blob:A({ok:y().optional()}).optional()}),A({email:i(),name:i().optional(),tier:i().optional(),creditMicros:D().nullable().optional(),accountId:i().optional()});function zr(e){return e!==`free`}function Br(e){return e===void 0||e===`business`||e===`enterprise`}function Vr(e){return zr(e)}var Hr=A({slug:i(),url:i(),title:i(),teamId:i().nullable(),visibility:Rr,passwordProtected:y(),latestVersionId:i().nullable(),lastPublishedAt:i().nullable(),context:A({boardIds:S(i()),selectionFingerprint:i().nullable(),contextKnown:y(),repo:i().nullable(),branch:i().nullable()})});A({effectiveTeamId:i().nullable(),slots:S(Hr)});var Ur=A({type:p([`organization`,`team`,`account`]),id:i(),name:i().optional()});A({slug:i(),visibility:Rr.optional(),passwordProtected:y().optional(),audience:S(Ur).optional(),publicComments:y().optional()}),A({visibility:Rr,passwordProtected:y(),audience:S(Ur).optional(),publicComments:y().optional()}),A({files:D(),bytes:D(),url:i(),tier:i().optional(),history:A({retained:y(),versions:D(),pruned:D()}).optional()});var Wr=A({slug:i(),title:i().nullable(),url:i(),visibility:Rr,passwordProtected:y(),canManage:y(),mine:y(),ownerEmail:i().nullable().optional(),ownerName:i().nullable().optional(),teamName:i().nullable().optional(),audience:S(Ur).optional(),publicComments:y().optional(),guestCount:D().optional(),git:A({repo:i().optional(),branch:i().optional()}).nullable().optional(),published:y(),lastPublishedAt:i().nullable()});A({links:S(Wr).optional()});var Gr=A({id:i(),name:i(),isDefault:y().optional(),role:i().optional(),canPublish:y().optional(),canManage:y().optional()});A({teams:S(Gr)});var Kr=A({id:i(),name:i().nullable(),email:i().optional(),createdAt:i(),lastSeenAt:i().nullable(),linkExpiresAt:i().nullable().optional()});A({guests:S(Kr)}),A({guest:Kr,delivery:A({sent:y(),reason:i().optional()}),guestUrl:i().optional()}),A({guestUrl:i()}),A({device_code:i(),user_code:i(),verification_uri:i(),verification_uri_complete:i(),expires_in:D(),interval:D()}),A({access_token:i().optional(),error:i().optional(),error_description:i().optional()}),A({token:i(),email:i()});var qr=A({intent:i(),summary:i(),priceMicros:D(),output:p([`image`,`svg`]),aspects:S(i()),defaultAspect:i(),reference:p([`forbidden`,`optional`,`required`])});A({intents:S(qr),maxCount:D().optional()});var Jr=A({kind:p([`image`,`svg`]),dataUrl:i()});A({id:i(),intent:i().optional(),chargedMicros:D(),balanceMicros:D(),assets:S(Jr).min(1).optional(),kind:p([`image`,`svg`]).optional(),dataUrl:i().optional()}).transform((e,t)=>{let n=e.assets??(e.dataUrl&&e.kind?[{kind:e.kind,dataUrl:e.dataUrl}]:null);return n?{id:e.id,intent:e.intent??``,assets:n,chargedMicros:e.chargedMicros,balanceMicros:e.balanceMicros}:(t.addIssue({code:`custom`,message:`no assets in the generation reply`}),a)}),A({scheme:i(),publicKey:i()}),A({signatures:S(i())});var Yr={Unreachable:!0,HttpFailure:!0,LoggedOut:!0,ProtocolViolation:!0,UploadRaceLost:!0,InsecureCloudUrl:!0,InvalidRequest:!0};function Xr(e){return typeof e==`string`&&e in Yr}var Zr=i().regex(/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/,`ids are [A-Za-z0-9][A-Za-z0-9_-]{0,63}`),Qr=O([S(D().int().nonnegative()),i().regex(/^@[a-zA-Z][a-zA-Z0-9_-]*$/)]),$r=A({locator:Qr}),ei=O([A({x:D(),y:D()}),l(`auto`)]);A({id:Zr,target:$r,position:ei.default(`auto`),body:i(),collapsed:y().optional(),author:p([`user`,`agent`]),cloud:A({commentId:i().min(1),slug:i().min(1),author:i().optional()}).optional()});var ti=A({frameId:Zr,screenId:Zr,locator:Qr});A({id:Zr,x:D().optional(),y:D().optional(),width:D().positive(),body:i(),attachment:ti.optional()}).refine(e=>e.attachment!==void 0||e.x!==void 0&&e.y!==void 0,{message:`A note without an attachment needs x and y`,path:[`x`]});var ni=A({prompt:i(),intent:i(),aspect:i().optional(),width:D().int().positive().optional(),height:D().int().positive().optional(),generatedAt:i(),reference:S(i()).optional(),replaces:i().optional()});A({version:l(1),generated:k(i(),ni)});function ri(e){if(typeof e!=`string`||e.length===0)return null;let t=e.replace(/^\.?\//,``);if(!t.startsWith(`assets/`))return null;let n=t.split(/[?#]/)[0]??``;return n.length>7?n:null}var ii=p([`light`,`dark`]),ai=A({id:Zr,screen:i().min(1),x:D(),y:D(),w:D().int().positive(),h:D().int().positive(),label:i().optional(),group:i().optional(),scheme:ii.optional()});function oi(e,t){return e.scheme??t}var si=A({id:Zr,name:i().min(1),color:i().optional()});A({id:Zr,name:i().min(1),theme:i().min(1).optional(),archivedAt:i().datetime().optional(),group:i().min(1).optional(),frames:S(ai).default([]),groups:S(si).default([])});var ci=O([S(D().int().nonnegative()),i().regex(/^@[a-zA-Z][a-zA-Z0-9_-]*$/)]),li=A({x:D(),y:D(),w:D().nonnegative(),h:D().nonnegative()}),ui=A({ref:i().min(1).optional(),text:i().max(500).optional(),ancestorIds:S(i().min(1)).max(16).optional()}),di=g(`kind`,[A({kind:l(`node`),boardId:Zr,frameId:Zr,screenId:Zr,locator:ci,bounds:li,fingerprint:ui.optional()}),A({kind:l(`board`),boardId:Zr,x:D(),y:D()})]),fi=p([`owner`,`admin`,`member`,`reviewer`,`guest`]),pi=A({kind:p([`user`,`agent`,`reviewer`]),displayName:i().min(1).max(200).optional(),accountId:i().min(1).max(200).optional(),role:fi.optional(),publisher:y().optional()}),mi=A({id:o(),author:pi,body:i().trim().max(4e3),createdAt:E(),deletedAt:E().optional()}).refine(e=>e.deletedAt!==void 0||e.body.length>0,{message:`A comment needs something to say`,path:[`body`]}),hi=g(`kind`,[A({kind:l(`local`)}),A({kind:l(`published`),slug:i().min(1),versionId:i().min(1)})]);A({id:o(),scope:p([`local`,`shared`]),folderId:i().min(1),boardId:Zr,anchor:di.optional(),origin:hi,status:p([`open`,`resolved`]),messages:S(mi).min(1),createdAt:E(),updatedAt:E(),resolvedAt:E().optional()});var gi=p([`boolean`,`number`,`string`,`color`,`enum`,`icon`]),_i=A({name:i().min(1),type:i().min(1),optional:y(),defaultValue:i().optional(),control:gi,enumValues:S(O([i(),D()])).optional()}).superRefine((e,t)=>{e.control===`enum`&&(!e.enumValues||e.enumValues.length===0)&&t.addIssue({code:`custom`,path:[`enumValues`],message:`prop "${e.name}": control "enum" requires a non-empty \`enumValues\` array`})}),vi=A({importPath:i().min(1),category:p([`ui`,`typography`]).optional(),description:i().optional(),props:S(_i),origin:p([`agent`,`manual`]).optional(),render:p([`static`,`live`]).optional(),app:i().min(1).optional(),fit:p([`aspect-video`,`content`]).optional()}),yi=A({description:i().optional(),exclude:y().optional(),proxy:i().min(1).optional(),props:S(_i).optional(),states:k(i().min(1),k(i(),c())).optional()});A({components:k(i().min(1),yi)});var bi=A({enabled:y(),contactOk:y().optional()}),xi=80;function Si(e){return e.trim()===``?`a design name can't be empty`:e===e.trim()?e===`.`||e===`..`?`"${e}" can't be a design name`:/[/\\]/.test(e)?`a design name can't contain / or \\`:/\p{Cc}/u.test(e)?`a design name can't contain control characters`:[...e].length>xi?`a design name can't be longer than ${xi} characters`:null:`a design name can't start or end with spaces`}var Ci=i().superRefine((e,t)=>{let n=Si(e);n&&t.addIssue({code:`custom`,message:n})});A({$schema:i().optional(),designs:S(i().min(1)),defaultDesign:Ci.optional(),feedback:bi.optional()}).refine(e=>new Set(e.designs).size===e.designs.length,{message:`designs lists the same path twice`});var wi=A({name:i().min(1),w:D().int().positive(),h:D().int().positive()}),Ti=A({id:p([`shadcn-upstream`,`none`,`html`,`mui`,`antd`,`chakra`]),version:i().min(1),source:p([`binary`,`cache`,`in-repo`]),componentsPath:i().min(1)}),Ei=A({componentsAlias:i().min(1).optional(),componentsDir:i().min(1).optional()}),Di=i().min(1).refine(e=>!/^(?:[\\/~]|[A-Za-z]:)/.test(e)&&!e.split(/[\\/]/).includes(`..`),{message:"must be relative to the app root, with no absolute path or `..` segment"}),Oi=A({root:i().min(1),aliases:k(i().min(1),i().min(1)).optional(),preview:i().min(1).optional(),stylesheets:S(i().regex(/^(?:\/(?!\/)|https:\/\/)/)).optional(),components:A({include:S(i().min(1)).optional(),exclude:S(i().min(1)).optional()}).optional()});A({schemaVersion:l(4),toolVersion:i().min(1),name:Ci,folderId:i().regex(/^[A-Za-z0-9_-]{8,64}$/).optional(),libraries:k(i().min(1),Ti),defaultLibrary:i().min(1),extensions:k(i().min(1),vi).optional(),viewportPresets:S(wi).min(1),defaultScreen:i().min(1).optional(),defaultBoard:i().min(1).optional(),boardOrder:S(i().min(1)).optional(),boardGroups:S(si).optional(),codegen:Ei.optional(),styling:A({framework:p([`tailwind`,`none`])}).optional(),hostApp:Oi.optional(),designSystem:A({path:Di}).optional(),hostApps:k(i().min(1),Oi).optional(),feedback:bi.optional()}).refine(e=>e.defaultLibrary in e.libraries,{message:"`defaultLibrary` must name an entry in `libraries`."});var ki=/^[A-Za-z0-9_-]+$/;function Ai(e){return ki.test(e)}function ji(e){return e.replace(/\*\//g,``).replace(/[<>{};\\]/g,``).replace(/[\r\n]+/g,` `).trim()}function Mi(e){let t=e.trim();return t===``?t:/[-_\s]/.test(t)?t.split(/[-_\s]+/).filter(e=>e!==``).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``):t.charAt(0).toUpperCase()+t.slice(1)}function Ni(e){return typeof e.$ref==`string`}function Pi(e){return typeof e.$snippet==`string`}function Fi(e){return typeof e.$param==`string`}var Ii=i().min(1).max(64).regex(/^[a-zA-Z][a-zA-Z0-9_-]*$/,{message:`node id must match /^[a-zA-Z][a-zA-Z0-9_-]*$/`});function Li(e){return typeof e==`string`||typeof e==`number`?{$ref:`Box`,props:{as:`span`,children:e}}:e}var Ri=A({name:i().min(1),importPath:i().min(1)});function zi(e){return/^[\w@./~-]+$/.test(e)?e.startsWith(`/`)?`must not be an absolute path`:e.split(`/`).includes(`..`)?`must not climb out of the host app with ..`:null:`has characters an import specifier can't carry`}var Bi=A({importPath:i().min(1).superRefine((e,t)=>{let n=zi(e);n&&t.addIssue({code:`custom`,message:`importPath ${n}`})}),exportName:i().regex(/^[A-Za-z_$][\w$]*$/,{message:`exportName must be an identifier or "default"`}),member:i().regex(/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/,{message:`member must be a dotted identifier path like "List"`}).optional(),app:i().min(1).optional(),proxy:i().min(1).optional()}),Vi=h(()=>A({$ref:i().min(1),$id:Ii.optional(),props:k(i(),c()).optional(),children:S(O([i(),D(),Ki])).transform(e=>e.map(Li)).optional(),$emitAs:Ri.optional(),$repo:Bi.optional()}));function Hi(e){return Ni(e)&&e.$repo!==void 0}function Ui(e){let t=e.member?`.${e.member}`:``;return`repo:${encodeURIComponent(e.app??``)}:${e.importPath}#${e.exportName}${t}`}var Wi=A({$snippet:i().min(1),$id:Ii.optional(),$extraClassName:i().optional(),args:k(i(),c()).optional(),$overrides:k(i().regex(/^$|^\d+(\.\d+)*$|^@[a-zA-Z][a-zA-Z0-9_-]*$/,{message:`override key must be a dotted index path like "0.2", an "@id" reference with a literal leading @ (e.g. "@row-active" to target the body node whose $id is "row-active"), or "" for the body root`}),A({props:k(i(),c())})).optional()}),Gi=A({$param:i().min(1)}),Ki=c().transform((e,t)=>{if(typeof e!=`object`||!e||Array.isArray(e))return t.addIssue({code:`custom`,message:`node must be an object with one of "$ref" (component), "$snippet" (instance), or "$param" (param ref)`}),a;let n=e,r=typeof n.$ref==`string`?Vi:typeof n.$snippet==`string`?Wi:typeof n.$param==`string`?Gi:null;if(!r)return t.addIssue({code:`custom`,message:`node needs exactly one of "$ref" (component), "$snippet" (snippet instance), or "$param" (param ref, snippet bodies only)`}),a;let i=r.safeParse(e);if(!i.success){for(let e of i.error.issues)t.addIssue({...e});return a}return i.data}).describe(`{"$ref":"Button","$id?":"cta","props?":{...},"children?":[Node]}, or {"$snippet":"<id>","args?":{...}}. Guide: velloo://guide/components`).meta({type:`object`,additionalProperties:!0});function qi(e){if(!Fi(e))return e.$id}A({id:Zr,name:i().min(1),library:i().min(1).optional(),route:i().min(1).optional(),tree:Ki});var Ji=A({name:i().min(1),type:p([`string`,`number`,`boolean`,`node`,`icon`,`color`,`enum`]),default:c().optional(),optional:y().optional(),enum:S(i()).optional(),min:D().optional(),max:D().optional(),step:D().optional(),description:i().optional()}).superRefine((e,t)=>{if(e.type===`enum`){if(!e.enum||e.enum.length===0){t.addIssue({code:`custom`,path:[`enum`],message:`param "${e.name}": type "enum" requires a non-empty \`enum\` array`});return}e.default!==void 0&&!e.enum.includes(e.default)&&t.addIssue({code:`custom`,path:[`default`],message:`param "${e.name}": default ${JSON.stringify(e.default)} is not one of the declared enum values`});return}if(e.default===void 0||e.type===`node`)return;let n=e.type===`number`?`number`:e.type===`boolean`?`boolean`:`string`;typeof e.default!==n&&t.addIssue({code:`custom`,path:[`default`],message:`param "${e.name}": default ${JSON.stringify(e.default)} does not match declared type "${e.type}"`})});A({id:Zr,name:i().min(1),params:S(Ji),library:i().min(1).optional(),tree:Ki}),new Map(`a.circle.clipPath.defs.desc.ellipse.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feDropShadow.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.filter.g.image.line.linearGradient.marker.mask.path.pattern.polygon.polyline.radialGradient.rect.stop.style.svg.switch.symbol.text.textPath.title.tspan.use.view`.split(`.`).map(e=>[e.toLowerCase(),e]));var Yi=O([D(),i().min(1)]),Xi=h(()=>k(i(),O([i(),D(),Xi]))),Zi=O([i().min(1),A({DEFAULT:i().min(1),foreground:i().min(1).optional()})]),Qi=A({background:i().min(1),foreground:i().min(1),primary:Zi,secondary:Zi.optional(),muted:Zi.optional(),accent:Zi.optional(),destructive:Zi.optional(),card:Zi.optional(),popover:Zi.optional(),border:i().min(1).optional(),input:i().min(1).optional(),ring:i().min(1).optional()}),$i=k(i().regex(/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/),i().min(1)),ea=A({size:Yi.optional(),leading:D().positive().optional(),flow:Yi.optional(),fontBody:i().min(1).optional(),fontHeading:i().min(1).optional(),fontMono:i().min(1).optional()}),ta=A({fontFamily:k(i(),i().min(1)).optional(),googleFonts:S(i().min(1)).optional(),typesets:k(i().regex(/^[A-Za-z0-9_-]+$/),ea).optional()}).strict(),na=A({none:Yi.optional(),sm:Yi.optional(),md:Yi.optional(),lg:Yi.optional(),xl:Yi.optional(),"2xl":Yi.optional(),"3xl":Yi.optional(),full:Yi.optional()}).partial(),ra=A({center:y().optional(),padding:i().min(1).optional(),maxWidth:i().min(1).optional()});A({name:i().min(1),colors:Qi,colorsDark:Qi.partial().optional(),palette:$i.optional(),paletteDark:$i.optional(),typography:ta,spacing:Xi,radius:na,shadows:Xi.optional(),container:ra.optional(),keyframes:k(i(),k(i(),k(i(),i()))).optional(),animation:k(i(),i()).optional()});var ia={size:`1em`,leading:1.75,flow:`1.25em`},aa=`default`;function oa(e){return Ai(e)}var sa={h1:{size:2.5,leading:.63,tracking:`-0.025em`,weight:700,face:`heading`},h2:{size:2,leading:.66,tracking:`-0.025em`,weight:700,face:`heading`},h3:{size:1.5,leading:.71,tracking:`-0.02em`,weight:600,face:`heading`},h4:{size:1.25,leading:.74,tracking:`-0.02em`,weight:600,face:`heading`},h5:{size:1.125,leading:.8,tracking:`-0.015em`,weight:600,face:`heading`},h6:{size:1,leading:.8,tracking:`-0.01em`,weight:600,face:`heading`},body:{size:1,leading:1,tracking:`0em`,weight:400,face:`body`},lead:{size:1.25,leading:.91,tracking:`0em`,weight:400,face:`body`},small:{size:.875,leading:.57,tracking:`0em`,weight:500,face:`body`},caption:{size:.875,leading:.86,tracking:`0em`,weight:400,face:`body`}},ca=Object.keys(sa),la={1:`h1`,2:`h2`,3:`h3`,4:`h4`,5:`h5`,6:`h6`},ua={default:`body`,muted:`caption`,small:`small`,lead:`lead`},da={400:`font-normal`,500:`font-medium`,600:`font-semibold`,700:`font-bold`};Object.fromEntries(ca.map(e=>[e,`text-${e} leading-${e} tracking-${e} ${da[sa[e].weight]}`])),Object.fromEntries(ca.map(e=>[e,{fontSize:`var(--text-${e})`,lineHeight:`var(--leading-${e})`,letterSpacing:`var(--tracking-${e})`,fontWeight:sa[e].weight}]));function fa(e){let t=Number(e??1);return Number.isFinite(t)&&t>=1&&t<=6?Math.trunc(t):1}function pa(e){return Math.round(e*1e3)/1e3}function ma(e){return typeof e==`number`?`${e}px`:ji(e)}function ha(e,t){return!e||!Ai(e)?t:`var(--font-${e})`}function ga(e){return{...e,size:e?.size??ia.size,leading:e?.leading??ia.leading,flow:e?.flow??ia.flow}}function _a(e,t=` `,n=!1){let r=n?e??{}:ga(e),i=[],a=(e,n)=>i.push(`${t}--typeset-${e}: ${n};`);return r.size!==void 0&&a(`size`,ma(r.size)),r.leading!==void 0&&a(`leading`,String(pa(r.leading))),r.flow!==void 0&&a(`flow`,ma(r.flow)),(!n||r.fontBody!==void 0)&&a(`font-body`,ha(r.fontBody,`inherit`)),(!n||r.fontHeading!==void 0)&&a(`font-heading`,ha(r.fontHeading,`var(--typeset-font-body)`)),(!n||r.fontMono!==void 0)&&a(`font-mono`,ha(r.fontMono,`var(--font-mono, ui-monospace, monospace)`)),i}var va=16;function ya(e,t=va){if(typeof e==`number`)return e;let n=/^(-?[\d.]+)\s*(px|rem|em|%)?$/.exec(e.trim());if(!n)return t;let r=Number.parseFloat(n[1]);if(!Number.isFinite(r))return t;switch(n[2]){case`px`:case void 0:return r;case`%`:return r/100*t;default:return r*t}}function ba(e,t={}){let n=ga(e),r=t.rootPx??va,i=ya(n.size,r),a=t.fontFamily??{},o=n.fontHeading?a[n.fontHeading]:void 0,s=n.fontBody?a[n.fontBody]:void 0,c={};for(let e of ca){let t=sa[e],r=t.face===`heading`?o??s:s;c[e]={fontSize:pa(i*t.size),lineHeight:pa(n.leading*t.leading),letterSpacing:t.tracking,fontWeight:t.weight,...r?{fontFamily:r}:{}}}return c}A({w:D().int().positive(),h:D().int().positive()});var xa=S(D()),Sa=i().regex(/^@[a-zA-Z][a-zA-Z0-9_-]*$/,{message:`id locator must match /^@[a-zA-Z][a-zA-Z0-9_-]*$/`}),Ca=e=>d(e=>{if(typeof e==`string`){let t=e.trim();if(t.startsWith(`[`)||t.startsWith(`{`))try{return JSON.parse(t)}catch{}}return e},e),wa=e=>d(e=>typeof e==`object`&&e&&!Array.isArray(e)?[e]:e,e),Ta=Ca(O([xa,Sa])).describe(`Node address: an "@id" like "@hero-cta", or an index path from the root ([0,2,1])`),Ea=Ta.default([]),Da=i().describe(`Body node: "@id" (preferred — survives restructures), a dotted index path ("0.2"), or "" for the root`),Oa=k(i(),c()),ka=i().min(1),Aa=i().min(1),ja=i().min(1),Ma=i().min(1),Na=s({x:D().optional(),y:D().optional(),w:D().int().positive().optional(),h:D().int().positive().optional(),label:i().nullable().optional(),group:i().nullable().optional(),scheme:ii.nullable().optional()}),Pa=A({name:i().min(1),importPath:i().min(1)}).describe(`Mark the node a host-component facade: the canvas renders the subtree, emit_code emits <name /> from importPath instead.`),Fa=O([A({x:D(),y:D()}),l(`auto`)]),Ia={screenId:ka,parentPath:Ea,componentRef:i().min(1),id:Ii.optional(),props:Oa.optional(),children:Ca(O([S(Ki),i(),D()])).optional(),index:D().int().nonnegative().optional(),emitAs:Pa.optional(),repo:Bi.optional().describe(`Place an app component by identity (importPath + exportName [+ member]) when it isn't in list_components' repo catalog yet`)};s(Ia);var La=Ca(O([i(),Oa,m()])).describe(`Native style channel: a className string (Tailwind), an object of properties (sx / style), or null to clear`),Ra=A({path:Ta,propPatch:Oa.optional(),style:La.optional()}).refine(e=>e.propPatch!==void 0||e.style!==void 0,{message:`each patch needs propPatch, style, or both`}),za=i().max(64).optional().describe(`Opaque id of the drag this write belongs to; merges its undo steps into one`),Ba={screenId:ka,patches:Ca(wa(S(Ra).min(1))).describe(`One entry per node; length 1 for a single edit`),gesture:za};s(Ba);var Va={screenId:ka,path:Ea,classes:i(),gesture:za};s(Va),s({screenId:ka,path:Ta});var Ha={screenId:ka,fromPath:Ta,toParent:Ta,toIndex:D().int().nonnegative().optional()};s(Ha);var Ua={screenId:ka,path:Ta,id:Ii.nullable()};s(Ua);var Wa=i().trim().min(1).transform(e=>e.startsWith(`/`)?e:`/${e}`),Ga={name:i().min(1),id:i().min(1).optional(),fromScreenId:i().min(1).optional(),tree:Ki.optional(),route:Wa.optional()};s(Ga),s({screenId:ka}),s({screenId:ka,tree:Ki});var Ka={screenId:ka,patch:A({name:i().min(1).optional(),route:Wa.nullable().optional()})};s(Ka);var qa={name:i().min(1).max(80),id:i().min(1).optional(),group:i().min(1).optional()};s(qa);var Ja={boardId:Aa,patch:A({name:i().min(1).max(80).optional(),theme:i().min(1).nullable().optional(),archived:y().optional(),group:i().min(1).nullable().optional()})};s(Ja),s({boardId:Aa});var Ya={order:S(i().min(1))};s(Ya);var Xa={name:i().min(1),color:i().min(1).optional()};s(Xa);var Za={groupId:i().min(1),patch:A({name:i().min(1).optional(),color:i().min(1).nullable().optional()})};s(Za);var Qa={groupId:i().min(1)};s(Qa);var $a={order:S(i().min(1))};s($a);var eo={boardId:Aa,screenId:ka,x:D().optional(),y:D().optional(),w:D().int().positive(),h:D().int().positive(),label:i().optional(),group:i().optional(),id:i().min(1).optional()};s(eo);var to=d(e=>{if(typeof e!=`object`||!e||Array.isArray(e)||`patch`in e)return e;let{frameId:t,...n}=e;return Object.keys(n).length>0?{frameId:t,patch:n}:e},A({frameId:ja,patch:Na})),no={boardId:Aa,patches:Ca(wa(S(to).min(1))).describe(`One entry per frame; length 1 for a single edit`)};s(no),s({boardId:Aa,frameId:ja});var ro={boardId:Aa,frameId:ja,toBoardId:Aa,x:D().optional(),y:D().optional()};s(ro);var io={name:i().min(1),id:i().min(1).optional(),params:S(Ji).default([]),tree:Ki};s(io);var ao={snippetId:Ma,patch:A({name:i().min(1).optional(),params:S(Ji).optional(),tree:Ki.optional(),innerPatch:A({innerPath:Da,propPatch:Oa}).optional()})};s(ao),s({snippetId:Ma});var oo={screenId:ka,parentPath:Ea,snippetId:Ma,id:Ii.optional(),args:Oa.optional(),extraClassName:i().optional().describe(`One-off classes layered onto the snippet body's root, for this instance`),overrides:k(i(),A({props:Oa})).optional(),index:D().int().nonnegative().optional()};s(oo),s({screenId:ka,path:Ta,innerPath:Da,propPatch:Oa});var so={screenId:ka,path:Ta,argPatch:Oa.default({}),extraClassName:i().nullable().optional(),gesture:za};s(so);var co={screenId:ka,path:Ta,argPatch:Oa.optional(),extraClassName:i().nullable().optional(),innerPath:Da.optional(),propPatch:Oa.optional()};s(co);var lo={screenId:ka,target:A({locator:Ta}),body:i(),position:Fa.optional(),collapsed:y().optional()};s(lo);var uo={screenId:ka,annotationId:i().min(1),patch:A({body:i().optional(),position:Fa.optional(),collapsed:y().nullable().optional()})};s(uo);var fo={screenId:ka,annotationId:i().min(1)};s(fo);var po=A({frameId:ja,screenId:ka,locator:Ta}),mo={boardId:Aa,x:D().optional(),y:D().optional(),width:D().positive().optional(),body:i(),attachment:po.optional()};A(mo).refine(e=>e.attachment!==void 0||e.x!==void 0&&e.y!==void 0,{message:`A note without an attachment needs x and y`,path:[`x`]});var ho={boardId:Aa,noteId:i().min(1),patch:A({x:D().optional(),y:D().optional(),width:D().positive().optional(),body:i().optional()})};s(ho);var go={boardId:Aa,noteId:i().min(1)};s(go);var _o={presets:S(A({name:i().min(1),w:D().int().positive(),h:D().int().positive()}))};s(_o);var vo={defaultBoard:i().min(1).nullable().optional(),defaultScreen:i().min(1).nullable().optional()};s(vo);var yo={componentsAlias:i().nullable().optional()};s(yo);var bo={name:i()};s(bo);var xo={enabled:y().optional(),contactOk:y().optional()};s(xo);var So=e=>e.kind===`AssetInUse`||Xr(e.kind);function Co(e){return e instanceof Error&&e.payload?.kind===`LoggedOut`}var wo=e=>e.join(`, `);function To(e){if(So(e))return e.message;switch(e.kind){case`BadRequest`:return e.message;case`ScreenNotFound`:return`No screen "${e.screenId}".`;case`BoardNotFound`:return`No board "${e.boardId}".`;case`FrameNotFound`:return`No frame "${e.frameId}" on board "${e.boardId}".`;case`BoardGroupNotFound`:return`No board group "${e.groupId}".`;case`SnippetNotFound`:return`No snippet "${e.snippetId}".`;case`IdNotFound`:return`No node with id "${e.id}" on "${e.screenId}".`;case`AnnotationNotFound`:return`No annotation "${e.annotationId}" on "${e.screenId}".`;case`CanvasNoteNotFound`:return`No note "${e.noteId}".`;case`UnknownComponent`:return e.suggestions.length>0?`No component "${e.ref}". Did you mean ${wo(e.suggestions)}?`:`No component "${e.ref}".`;case`InvalidPath`:case`InvalidMove`:return e.reason;case`SnippetParamMismatch`:return`Snippet "${e.snippetId}": ${e.reason}`;case`SnippetCycle`:return`Snippet "${e.snippetId}" would contain itself (via ${wo(e.viaPath)}).`;case`InvalidExtensionProp`:return e.message;case`LastScreen`:return`A folder needs at least one screen.`;case`ScreenIdConflict`:return`A screen called "${e.screenId}" already exists.`;case`BoardIdConflict`:return`A board called "${e.boardId}" already exists.`;case`SnippetIdConflict`:return`A snippet called "${e.snippetId}" already exists.`;case`FrameIdConflict`:return`Board "${e.boardId}" already has a frame "${e.frameId}".`;case`ScreenIdExhausted`:case`BoardIdExhausted`:return`Ran out of unique ids based on "${e.base}".`;case`IdConflict`:return`"${e.screenId}" already has ${e.paths.length} nodes with id "${e.id}".`;case`AnnotationConflict`:return`That node already has an annotation.`;case`SnippetInUse`:return`Snippet "${e.snippetId}" is still used by ${wo([...e.screenIds,...e.snippetIds.map(e=>`snippet ${e}`)])} — remove those first.`;case`ExtensionIdConflict`:case`ExtensionNotFound`:case`ExtensionInUse`:return e.message;case`InvalidColor`:case`InvalidThemePath`:return e.reason;case`UnknownPreset`:return`No preset "${e.presetName}".`;case`BulkTokensInvalid`:return`${e.failed.length} token${e.failed.length===1?``:`s`} rejected: ${wo(e.failed.map(e=>`${e.path} (${e.reason})`))}. Nothing was saved.`;default:return`The change could not be applied.`}}function Eo(e){let t=To(e),n=`hint`in e&&typeof e.hint==`string`?e.hint:void 0;return n?`${t} ${n}`:t}async function Do(e){let t=await e.json().catch(()=>void 0);if(!t||typeof t!=`object`)return;let n=t.error;if(n&&typeof n==`object`&&typeof n.kind==`string`)return n}async function Oo(e,t){let n=await Do(e),r=Error(n?Eo(n):`${t}: ${e.status}`);return n&&(r.payload=n),r}async function ko(e,t,n){Fr();let r=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!r.ok)throw await Oo(r,n);return await r.json()}async function Ao(e,t,n){Fr();let r=await fetch(t,{method:e,...n===void 0?{}:{headers:{"Content-Type":`application/json`},body:JSON.stringify(n)}});if(!r.ok)throw await Oo(r,t);return await r.json()}function P(e,t){return ko(`/api/mutate/${e}`,t,`mutate/${e}`)}function jo(e,t){return ko(`/api/theme/${e}`,t,`theme/${e}`)}function Mo(e,t){return ko(e,t,e)}async function No(){let e=await fetch(`/api/assets/intents`);return e.ok?(await e.json()).intents??[]:[]}function Po(e){return Mo(`/api/assets/delete`,{assetPath:e})}async function Fo(){let e=await fetch(`/api/assets`);if(!e.ok)throw Error(`assets: ${e.status}`);return(await e.json()).generated}function Io(e){return Mo(`/api/assets/generate`,e)}function Lo(e){return e.loggedIn&&e.login.state===`idle`}function Ro(e,t){return t.loggedIn&&t.verified===!1&&e?.verified!==!1}var zo={loggedIn:!1,verified:null,login:{state:`idle`}},Bo={async status(){let e=await fetch(`/api/auth/status`);return e.ok?await e.json():zo},async login(){return Mo(`/api/auth/login`,{})},async cancelLogin(){await Mo(`/api/auth/login/cancel`,{})},async logout(){await Mo(`/api/auth/logout`,{})}};async function F(e,t){let n=await fetch(e);if(!n.ok)throw await Oo(n,t);return await n.json()}function Vo(){return F(`/api/design`,`fetchDesign`)}function Ho(e){return F(`/api/screen/${encodeURIComponent(e)}`,`fetchScreen(${e})`)}function Uo(e){return F(`/api/board/${encodeURIComponent(e)}`,`fetchBoard(${e})`)}function Wo(e){return F(`/api/snippets/${encodeURIComponent(e)}`,`fetchSnippet(${e})`)}async function Go(e){return(await F(`/api/annotations/${encodeURIComponent(e)}`,`fetchAnnotations(${e})`)).annotations.map(t=>({...t,screenId:e}))}async function Ko(e){return(await F(`/api/notes/${encodeURIComponent(e)}`,`fetchNotes(${e})`)).notes}function qo(){return F(`/api/components`,`fetchComponents`)}function Jo(e){return F(`/api/theme${e&&e!=="default"?`?name=${encodeURIComponent(e)}`:``}`,`fetchTheme`)}function Yo(){return F(`/api/theme/presets`,`fetchPresets`)}function Xo(e,t,n,r){let i=r?`&theme=${encodeURIComponent(r)}`:``;return`/api/render/${encodeURIComponent(e)}?w=${t}&h=${n}${i}`}var Zo=e=>e===`signed-out`||e===`expired`;function Qo(e){switch(e){case`signed-out`:return`Sign in to velloo cloud to write a cloud comment.`;case`expired`:return`Your velloo-cloud session has ended — sign in again to write a cloud comment.`;case`unpublished`:return`Publish this board to write a cloud comment on it.`;default:return`This canvas cannot write cloud comments.`}}var $o={async summary(){return(await F(`/api/comments/summary`,`fetchCommentSummary`)).boards},async list(e,t,n=`all`){return(await F(`/api/comments?${new URLSearchParams({boardId:e,status:t,scope:n})}`,`fetchComments`)).threads},cloudAvailability(e){return F(`/api/comments/cloud?${new URLSearchParams({boardId:e})}`,`fetchCloudComments`)},async create(e){return(await Ao(`POST`,`/api/comments`,e)).thread},async reply(e,t){return(await Ao(`POST`,`/api/comments/${encodeURIComponent(e)}/messages`,{body:t})).thread},async update(e,t){return(await Ao(`PATCH`,`/api/comments/${encodeURIComponent(e)}`,t)).thread},delete(e){return Ao(`DELETE`,`/api/comments/${encodeURIComponent(e)}`)},async deleteMessage(e,t){return(await Ao(`DELETE`,`/api/comments/${encodeURIComponent(e)}/messages/${encodeURIComponent(t)}`)).thread}};function es(){return F(`/api/config`,`fetchConfig`)}var ts={viewportPresets(e){return P(`update_viewport_presets`,{presets:e})},defaults(e){return P(`update_defaults`,e)},designName(e){return P(`update_design_name`,{name:e})},codegen(e){return P(`update_codegen`,e)},feedback(e){return P(`update_feedback`,e)}};async function ns(e){let t=new URLSearchParams({mode:e.mode});e.scale&&e.scale!==1&&t.set(`scale`,String(e.scale));let n=`/api/export/${e.kind}/${encodeURIComponent(e.id)}.${e.format}?${t}`,r=await fetch(n);if(!r.ok){let e=await r.json().catch(()=>({}));throw Error(e.error??`export failed (${r.status})`)}is(await r.blob(),rs(r.headers.get(`content-disposition`),`${e.id}.${e.format}`));let i=r.headers.get(`x-velloo-export-warnings`);if(!i)return[];try{return JSON.parse(decodeURIComponent(i))}catch{return[]}}function rs(e,t){return(e?/filename="([^"]+)"/.exec(e):null)?.[1]??t}function is(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,document.body.appendChild(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),1e4)}async function as(e){return(await Ao(`POST`,`/api/feedback`,e)).message}async function os(){let e=await fetch(`/api/undo`);if(!e.ok)throw Error(`fetchHistory: ${e.status}`);return await e.json()}async function ss(){Fr();let e=await fetch(`/api/undo`,{method:`POST`});if(!e.ok)throw Error(`undo: ${e.status}`);return await e.json()}async function cs(){Fr();let e=await fetch(`/api/undo/redo`,{method:`POST`});if(!e.ok)throw Error(`redo: ${e.status}`);return await e.json()}var I={addFrame(e){return P(`add_frame`,e)},updateFrame(e){let{boardId:t,frameId:n,patch:r}=e;return P(`update_frame`,{boardId:t,patches:[{frameId:n,patch:r}]})},removeFrame(e){return P(`remove_frame`,e)},moveFrame(e){return P(`move_frame`,e)},addBoard(e){return P(`add_board`,e)},updateBoard(e){return P(`update_board`,e)},removeBoard(e){return P(`remove_board`,e)},reorderBoards(e){return P(`reorder_boards`,e)},addBoardGroup(e){return P(`add_board_group`,e)},updateBoardGroup(e){return P(`update_board_group`,e)},removeBoardGroup(e){return P(`remove_board_group`,e)},reorderBoardGroups(e){return P(`reorder_board_groups`,e)},updateProps(e){let{screenId:t,path:n,propPatch:r,gesture:i}=e;return P(`update_props`,{screenId:t,patches:[{path:n,propPatch:r}],...i?{gesture:i}:{}})},applyClasses(e){return P(`apply_classes`,e)},setNodeId(e){return P(`set_node_id`,e)},removeNode(e){return P(`remove_node`,e)},updateSnippetArgs(e){return P(`update_snippet_args`,e)}},ls={add(e){return Mo(`/api/notes/add`,e)},update(e){return Mo(`/api/notes/update`,e)},remove(e){return Mo(`/api/notes/remove`,e)}},us=(e,t=``)=>`/api/publish/published/${encodeURIComponent(e)}/guests${t}`,ds={targets(){return F(`/api/publish/targets`,`publishTargets`)},status(){return F(`/api/publish/status`,`publishStatus`)},start(e){return Mo(`/api/publish`,e)},async reset(){await Mo(`/api/publish/reset`,{})},async published(){return(await F(`/api/publish/published`,`publishedBoards`)).boards},async unpublish(e){await Ao(`DELETE`,`/api/publish/published/${encodeURIComponent(e)}`)},guests:{async list(e){return(await F(us(e),`guests`)).guests},invite(e,t){return Mo(us(e),t)},resend(e,t){return Mo(us(e,`/${encodeURIComponent(t)}/resend`),{})},async link(e,t){return(await Mo(us(e,`/${encodeURIComponent(t)}/link`),{})).guestUrl},async remove(e,t){await Ao(`DELETE`,us(e,`/${encodeURIComponent(t)}`))}}};function fs(){return F(`/api/repo/components`,`fetchRepoComponents`)}async function ps(e){return e.length===0?[]:(await F(`/api/repo/status?ids=${e.map(encodeURIComponent).join(`,`)}`,`fetchRepoStatus`)).diagnostics}function ms(e,t={}){let n=new URLSearchParams;return n.set(`state`,String(t.state??0)),n.set(`w`,String(t.w??480)),n.set(`h`,String(t.h??200)),t.v!==void 0&&n.set(`v`,String(t.v)),t.dark&&n.set(`mode`,`dark`),`/api/render/repo/${encodeURIComponent(e)}?${n.toString()}`}function hs(e){let{importPath:t,exportName:n}=e.identity;return n==="default"?`import ${e.family} from "${t}";`:`import { ${n} } from "${t}";`}function gs(e){return F(`/api/search?q=${encodeURIComponent(e)}`,`fetchSearch`)}var _s=null;function vs(e){return _s=e,()=>{_s===e&&(_s=null)}}function ys(e={}){_s?.(e)}var bs={setToken(e,t,n){return jo(`set_token`,{path:t,value:n,theme:e})},setTypeset(e,t){return jo(`set_typeset`,{typesets:t,theme:e})},setFonts(e,t){return jo(`set_fonts`,{fonts:t,theme:e})},applyPreset(e,t){return jo(`apply_preset`,{presetName:t,theme:e})},addTheme(e,t){return jo(`add_theme`,{name:e,from:t})},deriveFromColor(e,t,n){return jo(`derive_palette_from_color`,{seedColor:t,name:n??(e==="default"?void 0:e)})}};function xs(e={}){return F(e.refresh?`/api/updates/status?refresh=1`:`/api/updates/status`,`fetchUpdateStatus`)}function Ss(){return Mo(`/api/updates`,{})}function L(e){let t=e.kind??`info`,n=e.ttl??(t===`error`?6e3:3500),r=e.title??e.message,i={description:e.title?e.message:void 0,duration:n,action:e.action},a;return a=t===`success`?v.success(r,i):t===`error`?v.error(r,i):v(r,i),String(a)}function Cs(e){e&&v.dismiss(e)}function R(e,t){return Co(e)?(ys(),``):L({kind:`error`,message:(e instanceof Error?e.message:typeof e==`string`?e:t)||t})}var ws=[];function Ts(e){return e.authStatus?.loggedIn?e.authStatus.account?.accountId:void 0}function Es(e,t){return e.filter(e=>e.latestVersionId!==null&&e.context.boardIds.includes(t)).sort((e,t)=>Ds(t.lastPublishedAt)-Ds(e.lastPublishedAt)).at(0)??null}var Ds=e=>{let t=e?Date.parse(e):NaN;return Number.isFinite(t)?t:-1/0},Os=3e4,ks=0,As=null,js=(e,t)=>({authStatus:null,signInPrompt:null,publishOpen:!1,publishScope:null,publishedBoardsOpen:!1,feedbackOpen:!1,guestsBoard:null,publishSlots:[],async refreshAuth(){let n=await Bo.status(),r=Ro(t().authStatus,n);e({authStatus:n}),r&&L({kind:`error`,title:`velloo-cloud session ended`,message:`Publishing and cloud comments need you to sign in again.`,ttl:1e4,action:{label:`Sign in`,onClick:()=>t().openSignIn({expired:!0})}})},openSignIn(t={}){e({signInPrompt:t})},closeSignIn(){e({signInPrompt:null})},setPublishOpen(n){t().settlePublish(!1),e({publishOpen:n,publishScope:null})},setPublishedBoardsOpen(t){e({publishedBoardsOpen:t})},setFeedbackOpen(t){e({feedbackOpen:t})},openGuests(t){e({guestsBoard:t})},refreshPublishSlots({force:n=!1}={}){return t().authStatus?.loggedIn?!n&&Date.now()-ks<Os?Promise.resolve():(As&&!n||(As=ds.targets().catch(()=>null).then(t=>{ks=Date.now(),As=null,e({publishSlots:t?.slots??[]})})),As):(ks=0,e({publishSlots:[]}),Promise.resolve())},publishBoard(n){t().settlePublish(!1),e({publishScope:{id:n.id,name:n.name},publishOpen:!0})},publishAndWait(t){return e({publishScope:{id:t.id,name:t.name},publishOpen:!0}),new Promise(e=>{ws.push(e)})},settlePublish(e){let n=ws;ws=[];for(let t of n)t(e);e&&n.length===0&&t().refreshCloudComments(),e&&t().refreshPublishSlots({force:!0})}}),Ms=200;function Ns(e){if(!e||typeof e!=`object`)return null;let t=e;return typeof t.id!=`number`||typeof t.ts!=`number`||typeof t.verb!=`string`||t.source!==`mcp`&&t.source!==`canvas`&&t.source!==`cli`||!t.target||typeof t.target!=`object`?null:e}var Ps=(e,t)=>({activityEvents:[],activityFeedOpen:!1,lastAgentActivityAt:null,activityFlash:{},frameGlow:{},boardPulse:{},recordActivity(n){if(e(e=>({activityEvents:e.activityEvents.length>=Ms?[...e.activityEvents.slice(-199),n]:[...e.activityEvents,n]})),n.source===`canvas`)return;let r=t(),i={...r.activityFlash},a={...r.frameGlow},o={...r.boardPulse},s=r.currentBoardId?r.boards[r.currentBoardId]:null,c=e=>{if(e.screenId&&e.path){let t=i[e.screenId];i[e.screenId]={nonce:(t?.nonce??0)+1,path:e.path.join(`.`)}}else if(e.screenId)for(let t of s?.frames??[])t.screen===e.screenId&&(a[t.id]=(a[t.id]??0)+1);if(e.frameId&&(a[e.frameId]=(a[e.frameId]??0)+1),e.themeName!==void 0||e.token!==void 0)for(let e of s?.frames??[])a[e.id]=(a[e.id]??0)+1;let t=new Set(e.boards??[]);if(e.boardId&&t.add(e.boardId),e.screenId)for(let n of Object.values(r.boards))n.frames.some(t=>t.screen===e.screenId)&&t.add(n.id);for(let e of t)e!==r.currentBoardId&&(o[e]=n.ts)};c(n.target);for(let e of n.ops??[])c(e.target);e({lastAgentActivityAt:Date.now(),activityFlash:i,frameGlow:a,boardPulse:o})},async backfillActivity(){try{let t=await fetch(`/api/activity`);if(!t.ok)return;let n=((await t.json()).events??[]).map(Ns).filter(e=>e!==null);e(e=>{let t=new Set(e.activityEvents.map(e=>e.id));return{activityEvents:[...n.filter(e=>!t.has(e.id)),...e.activityEvents].sort((e,t)=>e.id-t.id).slice(-200)}})}catch{}},setActivityFeedOpen(n){e({activityFeedOpen:n}),n&&t().backfillActivity()}});function Fs(e){let t=e().editingMarkupId;t&&(e().annotations.some(e=>e.id===t)||e().notes.some(e=>e.id===t)||e().setEditingMarkupId(null))}var Is=(e,t)=>({annotations:[],notes:[],markupVisible:!0,editingMarkupId:null,async refreshAnnotations(){let n=t().currentBoardId,r=n?t().boards[n]:null,i=r?[...new Set(r.frames.map(e=>e.screen))]:t().currentScreenId?[t().currentScreenId]:[];if(i.length===0){e({annotations:[]});return}try{e({annotations:(await Promise.all(i.map(e=>Go(e)))).flat()}),Fs(t)}catch{}},async refreshNotes(){let n=t().currentBoardId;if(n)try{e({notes:await Ko(n)}),Fs(t)}catch{}},async createNote(n){let r=t().currentBoardId;if(r){t().setCursorMode(`select`);try{let{note:i}=await ls.add({boardId:r,body:``,...n});e(e=>({notes:e.notes.some(e=>e.id===i.id)?e.notes:[...e.notes,i]})),t().setMarkupVisible(!0),t().setEditingMarkupId(i.id)}catch(e){R(e,`Could not add note`)}}},setMarkupVisible(n){n||t().setEditingMarkupId(null),e({markupVisible:n})},setEditingMarkupId(n){let r=t().editingMarkupId;r!==n&&(e({editingMarkupId:n}),n&&!r?t().zoomForMarkupEdit():!n&&r&&t().restoreViewAfterMarkupEdit())}}),Ls=.1,Rs=1.05;function zs(e){return e>0?1/Rs:Rs}function Bs(e,t=60){if(e.length===0)return null;let n=1/0,r=1/0,i=-1/0,a=-1/0;for(let o of e)o.x<n&&(n=o.x),o.y<r&&(r=o.y),o.x+o.w>i&&(i=o.x+o.w),o.y+o.h+t>a&&(a=o.y+o.h+t);return{minX:n,minY:r,maxX:i,maxY:a}}function Vs(e,t,n,r=80){let i=Bs(e);if(!i||t<50||n<50)return null;let a=Math.max(1,i.maxX-i.minX),o=Math.max(1,i.maxY-i.minY),s=(i.minX+i.maxX)/2,c=(i.minY+i.maxY)/2,l=(t-r*2)/a,u=(n-r*2)/o,d=Math.max(Ls,Math.min(1,Math.min(l,u)));return{zoom:d,pan:{x:Math.round(t/2-s*d),y:Math.round(n/2-c*d)}}}function Hs(e,t,n,r=120,i=1){if(t<50||n<50)return null;let a=(t-r*2)/Math.max(1,e.w),o=(n-r*2)/Math.max(1,e.h),s=Math.max(Ls,Math.min(i,a,o)),c=e.x+e.w/2,l=e.y+e.h/2;return{zoom:s,pan:{x:Math.round(t/2-c*s),y:Math.round(n/2-l*s)}}}function Us(e,t,n,r,i=48){if(n<50||r<50)return null;let a=Math.max(1,n-i*2-t.gap-t.w),o=Math.max(Ls,Math.min(1,a/Math.max(1,e.w),(r-i*2)/Math.max(1,e.h))),s=e.w*o+t.gap+t.w,c=Math.max(e.h*o,t.gap+t.h);return{zoom:o,pan:{x:Math.round((n-s)/2-e.x*o),y:Math.round((r-c)/2-e.y*o)}}}function Ws(e,t,n){let r=Math.max(0,e.w-n.w),i=Math.max(0,e.h-n.h);return{x:e.x+t.x+Math.max(0,Math.min(n.x,r)),y:e.y+t.y+Math.max(0,Math.min(n.y,i)),w:n.w,h:n.h}}function Gs(e,t,n,r=80,i=60){if(t<50||n<50)return null;let a=e.h+i,o=(t-r*2)/e.w,s=(n-r*2)/a,c=Math.max(Ls,Math.min(1,o,s)),l=e.x+e.w/2,u=e.y+a/2;return{zoom:c,pan:{x:Math.round(t/2-l*c),y:Math.round(n/2-u*c)}}}function Ks(e,t,n,r){let i=Math.max(Ls,Math.min(4,r.zoom*n));if(i===r.zoom)return r;let a=(e-r.pan.x)/r.zoom,o=(t-r.pan.y)/r.zoom;return{zoom:i,pan:{x:Math.round(e-a*i),y:Math.round(t-o*i)}}}function z(e){return e===``?[]:e.split(`.`).map(e=>Number(e))}function qs(e){return e.join(`.`)}function Js(e,t){return`$id`in e&&e.$id?`@${String(e.$id)}`:z(t)}var Ys=`velloo:lastBoard`,Xs=`velloo:boardView:`;function Zs(){if(typeof localStorage>`u`)return null;try{return localStorage.getItem(Ys)||null}catch{return null}}function Qs(e){if(!(typeof localStorage>`u`))try{localStorage.setItem(Ys,e)}catch{}}function $s(e){if(typeof localStorage>`u`)return null;try{let t=localStorage.getItem(Xs+e);if(!t)return null;let n=JSON.parse(t),r=typeof n.zoom==`number`&&Number.isFinite(n.zoom)?n.zoom:null,i=n.pan&&typeof n.pan.x==`number`&&Number.isFinite(n.pan.x)?n.pan.x:null,a=n.pan&&typeof n.pan.y==`number`&&Number.isFinite(n.pan.y)?n.pan.y:null;return r===null||i===null||a===null?null:{pan:{x:i,y:a},zoom:r}}catch{return null}}function ec(e,t){if(!(typeof localStorage>`u`))try{localStorage.setItem(Xs+e,JSON.stringify(t))}catch{}}function tc(){if(!(typeof localStorage>`u`))try{localStorage.removeItem(Ys);let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);n?.startsWith(Xs)&&e.push(n)}for(let t of e)localStorage.removeItem(t)}catch{}}var nc={min:240,max:560,default:320};function rc(e){return Math.min(nc.max,Math.max(nc.min,Math.round(e)))}var ic=`velloo:appTheme`;function ac(){if(typeof localStorage>`u`)return`system`;let e=localStorage.getItem(ic);return e===`light`||e===`dark`||e===`system`?e:`system`}var oc=`velloo:designMode`,sc=`velloo:rememberDesignMode`;function cc(e,t){if(typeof localStorage>`u`)return t;let n=localStorage.getItem(e);return n===null?t:n===`true`}function lc(){return typeof localStorage>`u`||!cc(sc,!0)?`light`:localStorage.getItem(oc)===`dark`?`dark`:`light`}var uc=`velloo:leftPanels`,dc=`velloo:panes`,fc=`velloo:paneWidths`,pc=`velloo:rememberPanels`,mc=480;function hc(e,t,n){return e-t-n>=mc}var gc=null;function _c(e,t,n){let r=e.panesExclusive&&!n;return r&&(gc=t===`left`?`right`:`left`),t===`left`?{leftPaneCollapsed:n,rightPaneCollapsed:r||e.rightPaneCollapsed}:{leftPaneCollapsed:r||e.leftPaneCollapsed,rightPaneCollapsed:n}}function vc(e,t){return _c(e,t,!1)}function yc(e,t){let n=Object.fromEntries(t.map(e=>[e,!1]));if(typeof localStorage>`u`||!cc(pc,!0))return n;try{let r=localStorage.getItem(e);if(!r)return n;let i=JSON.parse(r);for(let e of t)n[e]=i[e]===!0;return n}catch{return n}}function bc(e,t){typeof localStorage<`u`&&cc(pc,!0)&&localStorage.setItem(e,JSON.stringify(t))}function xc(e,t){bc(dc,{...yc(dc,[`left`,`right`]),[e]:t})}function Sc(){let e={left:nc.default,right:nc.default};if(typeof localStorage>`u`||!cc(pc,!0))return e;try{let t=localStorage.getItem(fc);if(!t)return e;let n=JSON.parse(t);return{left:typeof n.left==`number`?rc(n.left):e.left,right:typeof n.right==`number`?rc(n.right):e.right}}catch{return e}}function Cc(e,t){typeof localStorage<`u`&&cc(pc,!0)&&localStorage.setItem(fc,JSON.stringify({left:e,right:t}))}function wc(){let e=yc(uc,[`boards`,`tree`]),t=yc(dc,[`left`,`right`]),n=Sc();return{appTheme:ac(),designMode:lc(),rememberDesignMode:cc(sc,!0),rememberPanels:cc(pc,!0),boardsCollapsed:e.boards,treeCollapsed:e.tree,leftPaneCollapsed:t.left,rightPaneCollapsed:t.right,leftPaneWidth:n.left,rightPaneWidth:n.right}}var Tc=[ic,oc,sc,uc,dc,fc,pc],Ec=(e,t)=>({...wc(),panesExclusive:!1,settingsScope:null,searchOpen:!1,exportTarget:null,previewTarget:null,setAppTheme(t){e({appTheme:t}),typeof localStorage<`u`&&localStorage.setItem(ic,t)},setDesignMode(t){e({designMode:t}),typeof localStorage<`u`&&cc(sc,!0)&&localStorage.setItem(oc,t)},setRememberDesignMode(n){e({rememberDesignMode:n}),!(typeof localStorage>`u`)&&(localStorage.setItem(sc,String(n)),n?localStorage.setItem(oc,t().designMode):localStorage.removeItem(oc))},setRememberPanels(n){if(e({rememberPanels:n}),!(typeof localStorage>`u`)){if(localStorage.setItem(pc,String(n)),n){let e=t();bc(uc,{boards:e.boardsCollapsed,tree:e.treeCollapsed}),bc(dc,{left:e.leftPaneCollapsed,right:e.rightPaneCollapsed}),Cc(e.leftPaneWidth,e.rightPaneWidth)}else localStorage.removeItem(uc),localStorage.removeItem(dc),localStorage.removeItem(fc)}},setSettingsScope(t){e({settingsScope:t})},resetCanvasPrefs(){if(typeof localStorage<`u`)for(let e of Tc)localStorage.removeItem(e);tc();let n=t().panesExclusive;gc=n?`right`:null,e({appTheme:`system`,designMode:`light`,rememberDesignMode:!0,rememberPanels:!0,boardsCollapsed:!1,treeCollapsed:!1,leftPaneCollapsed:!1,rightPaneCollapsed:n,leftPaneWidth:nc.default,rightPaneWidth:nc.default})},toggleBoardsCollapsed(){e(e=>{let t=!e.boardsCollapsed;return bc(uc,{boards:t,tree:e.treeCollapsed}),{boardsCollapsed:t}})},setSearchOpen(t){e({searchOpen:t})},setExportTarget(t){e({exportTarget:t})},setPreviewTarget(t){e({previewTarget:t})},toggleTreeCollapsed(){e(e=>{let t=!e.treeCollapsed;return bc(uc,{boards:e.boardsCollapsed,tree:t}),{treeCollapsed:t}})},setLeftPaneCollapsed(t){xc(`left`,t),e(e=>_c(e,`left`,t))},setRightPaneCollapsed(t){xc(`right`,t),e(e=>_c(e,`right`,t))},setLeftPaneWidth(t){e(e=>{let n=rc(t);return Cc(n,e.rightPaneWidth),{leftPaneWidth:n}})},setRightPaneWidth(t){e(e=>{let n=rc(t);return Cc(e.leftPaneWidth,n),{rightPaneWidth:n}})},syncPaneLayout(n){let r=t(),i=!hc(n,r.leftPaneWidth,r.rightPaneWidth);if(i===r.panesExclusive)return;if(i){let t=!r.leftPaneCollapsed&&!r.rightPaneCollapsed;gc=t?`right`:null,e({panesExclusive:!0,...t&&{rightPaneCollapsed:!0}});return}let a=gc;gc=null;let o=a===`left`?r.rightPaneCollapsed:r.leftPaneCollapsed;if(!a||o){e({panesExclusive:!1});return}e(a===`left`?{panesExclusive:!1,leftPaneCollapsed:!1}:{panesExclusive:!1,rightPaneCollapsed:!1})}});function Dc(e,t){if(!t)return null;let n=e[t.screenId];if(!n)return null;let r=z(t.path),i=n.tree;for(let e of r){if(!i||!(`$ref`in i))return null;let t=i.children;if(!t||e<0||e>=t.length)return null;i=t[e]}return i??null}var Oc=(e,t)=>({selection:null,hover:null,reveal:null,selectionIntent:`inspect`,snippetFocus:null,selectionComputed:null,selectionAnchor:null,setSelectionComputed(n,r){t().selection?.path===n&&e({selectionComputed:r})},setSnippetFocus(n){t().snippetFocus!==n&&(e({snippetFocus:n,...t().selection?.screenId.startsWith(`snippet:`)===!0?{selection:null,hover:null}:{}}),n!==null&&(e({selection:null,hover:null}),Wo(n).then(e=>{t().snippetFocus===n&&(t().setSyntheticScreen(`snippet:${n}`,{id:`snippet:${n}`,name:e.name,tree:e.tree,...e.library?{library:e.library}:{}}),t().setSelection({screenId:`snippet:${n}`,path:``}))}).catch(()=>e({snippetFocus:null}))))},setSelection(n){t().reveal&&e({reveal:null});let r=t().selection;r===n||r!==null&&n!==null&&r.screenId===n.screenId&&r.path===n.path?n&&t().selectionIntent!==`inspect`&&e({selectionIntent:`inspect`}):e({selection:n,selectionIntent:`inspect`,selectionComputed:null,selectionAnchor:null}),n&&n.screenId!==t().currentScreenId&&!n.screenId.startsWith(`snippet:`)&&t().selectScreen(n.screenId)},revealSelection(n,r={}){let i=(t().reveal?.nonce??0)+1;t().setSelection(n),e({reveal:{...n,nonce:i},selectionIntent:r.preserveTab?`preserve-tab`:`inspect`})},setSelectionAnchor(n){let r=t().selectionAnchor;r===n||r!==null&&n!==null&&r.frameId===n.frameId&&r.instance===n.instance||e({selectionAnchor:n})},setHover(n){let r=t().hover;r!==n&&(r&&n&&r.screenId===n.screenId&&r.path===n.path||e({hover:n}))}});function kc(e,t){return{...e.commentStatus===`resolved`&&{commentStatus:`open`},...e.commentScope!==`all`&&e.commentScope!==t.scope&&{commentScope:`all`}}}function Ac(e,t){return Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((e,n)=>e===t[n]):e===t}function jc(e){let t=`$ref`in e?e.$ref:`$snippet`in e?e.$snippet:void 0,n=`props`in e?e.props?.children:void 0,r=typeof n==`string`?n.trim().replace(/\s+/g,` `).slice(0,500):void 0;if(t||r)return{...t&&{ref:t},...r&&{text:r}}}function Mc(e,t){return e.findIndex(e=>e.id===t.id)<0?[t,...e]:e.map(e=>e.id===t.id?t:e)}var Nc=null,Pc=!1,Fc=`This board wasn't published, so a cloud comment has nowhere to live yet. Publish it, or keep the comment local.`;async function Ic(e,t){let n=e().cloudComments;if(!n||n.available)return null;if(n.reason!==`unpublished`)return Qo(n.reason);let r=e().boards[t];return!r||!await e().publishAndWait({id:r.id,name:r.name})?Fc:(await e().refreshCloudComments(),e().cloudComments?.available?null:Fc)}var Lc=(e,t)=>({commentThreads:[],commentStatus:`open`,commentScope:`all`,cloudComments:void 0,activeCommentId:null,pendingCommentAnchor:null,boardCommentCounts:{},refreshCommentCounts(){return Nc?(Pc=!0,Nc):(Nc=(async()=>{do{Pc=!1;try{e({boardCommentCounts:await $o.summary()})}catch{}}while(Pc)})().finally(()=>{Nc=null}),Nc)},async refreshComments(){let n=t().currentBoardId;if(!n){e({commentThreads:[],activeCommentId:null});return}try{let r=await $o.list(n,t().commentStatus,t().commentScope);e(e=>{let t=r.some(t=>t.id===e.activeCommentId);return{commentThreads:r,activeCommentId:t?e.activeCommentId:null,...!t&&e.activeCommentId?{selection:null,reveal:null,rightTab:`comments`}:{}}})}catch(e){R(e,`Could not load comments`)}},async refreshCloudComments(){let n=t().currentBoardId;if(!n){e({cloudComments:{available:!1,reason:`unsupported`}});return}e({cloudComments:void 0});try{let r=await $o.cloudAvailability(n);t().currentBoardId===n&&e({cloudComments:r})}catch{e({cloudComments:{available:!1,reason:`unsupported`}})}},setCommentStatus(n){e({commentStatus:n}),t().refreshComments()},setCommentScope(n){e({commentScope:n}),t().refreshComments()},setActiveComment(n){if(n===null){e({activeCommentId:null,pendingCommentAnchor:null,selection:null,reveal:null,rightTab:`comments`});return}e(e=>({activeCommentId:n,pendingCommentAnchor:null,rightTab:`comments`,...vc(e,`right`),markupVisible:!0})),t().locateComment(n)},locateComment(e){let n=t().commentThreads.find(t=>t.id===e);if(!n?.anchor)return;let r=n.anchor;if(r.kind===`board`){t().flyToBoardRect({x:r.x-7,y:r.y-7,w:14,h:14});return}if(n.anchorState.status===`attached`){t().locateNode(r.screenId,n.anchorState.resolvedPath.join(`.`),{frameId:r.frameId,preserveTab:!0});return}let i=t().boards[n.boardId]?.frames.find(e=>e.id===r.frameId);if(!i)return;let a=t().frameInsets[i.id]??{x:0,y:0,chromeH:0};t().flyToBoardRect(Ws(i,a,r.bounds))},enterCommentMode(){t().commentOnSelection()||e({cursorMode:`comment`,hover:null,pendingCommentAnchor:null,activeCommentId:null,rightTab:`comments`,markupVisible:!0})},commentOnSelection(){let e=t(),n=e.selection,r=e.currentBoardId;if(!n||!r||n.screenId.startsWith(`snippet:`))return!1;let i=Dc(e.screens,n);if(!i)return!1;let a=(e.boards[r]?.frames??[]).find(t=>t.screen===n.screenId&&e.nodeRects[t.id]?.[n.path]),o=a?e.nodeRects[a.id]?.[n.path]:void 0;if(!a||!o)return!1;let s=Js(i,n.path),c=e.pendingCommentAnchor;if(c?.kind===`node`&&c.frameId===a.id&&Ac(c.locator,s))return!0;let l=jc(i);return t().beginComment({kind:`node`,boardId:r,frameId:a.id,screenId:n.screenId,locator:s,bounds:o,...l&&{fingerprint:l}}),!0},beginComment(t){e({pendingCommentAnchor:t,activeCommentId:null,cursorMode:`select`,rightTab:`comments`,markupVisible:!0})},clearPendingComment(){e({pendingCommentAnchor:null})},async createPendingComment(n,r=`local`){let i=t().currentBoardId,a=t().pendingCommentAnchor;if(!i||!a||!n.trim())return`There is nothing to post.`;if(r===`shared`){let e=await Ic(t,i);if(e)return e;if(t().pendingCommentAnchor!==a)return null}try{let o=await $o.create({boardId:i,body:n,anchor:a,scope:r}),s=kc(t(),o);return e(e=>({commentThreads:Mc(e.commentThreads,o),activeCommentId:o.id,pendingCommentAnchor:null,rightTab:`comments`,...vc(e,`right`),...s})),Object.keys(s).length>0&&t().refreshComments(),null}catch(e){return R(e,`Could not create comment`),`The daemon refused the comment. Its message has the details.`}},async createBoardComment(n,r=`local`){let i=t().currentBoardId;if(!i||!n.trim())return`There is nothing to post.`;if(r===`shared`){let e=await Ic(t,i);if(e)return e}try{let a=await $o.create({boardId:i,body:n,scope:r}),o=kc(t(),a);return e(e=>({commentThreads:Mc(e.commentThreads,a),activeCommentId:a.id,pendingCommentAnchor:null,rightTab:`comments`,...o})),Object.keys(o).length>0&&t().refreshComments(),null}catch(e){return R(e,`Could not create comment`),`The daemon refused the comment. Its message has the details.`}},async replyToComment(t,n){if(n.trim())try{let r=await $o.reply(t,n);e(e=>({commentThreads:Mc(e.commentThreads,r)}))}catch(e){R(e,`Could not reply`)}},async deleteCommentMessage(n,r){let i=t().commentThreads.find(e=>e.id===n);if(i?.scope===`local`&&i.messages.length===1){await t().deleteComment(n);return}try{let t=await $o.deleteMessage(n,r);e(e=>({commentThreads:Mc(e.commentThreads,t)}))}catch(e){R(e,`Could not delete comment`)}},async setCommentResolved(n,r){try{let i=await $o.update(n,{resolved:r});t().commentStatus===`all`||t().commentStatus===i.status?e(e=>({commentThreads:Mc(e.commentThreads,i)})):e(e=>({commentThreads:e.commentThreads.filter(e=>e.id!==n),activeCommentId:e.activeCommentId===n?null:e.activeCommentId,...e.activeCommentId===n?{selection:null,reveal:null,rightTab:`comments`}:{}}))}catch(e){R(e,r?`Could not resolve comment`:`Could not reopen comment`)}},async moveCommentToCloud(n){let r=t().commentThreads.find(e=>e.id===n);if(!r)return;let i=await Ic(t,r.boardId);if(i){L({kind:`error`,title:`The thread is still local`,message:i});return}try{let t=await $o.update(n,{scope:`shared`});e(e=>{let r=e.commentThreads.filter(e=>e.id!==n),i=e.commentScope!==`local`;return{commentThreads:i?Mc(r,t):r,activeCommentId:i?t.id:null,...i?{}:{selection:null,reveal:null,rightTab:`comments`}}})}catch(e){R(e,`Could not move the comment to the cloud`)}},async deleteComment(t){try{await $o.delete(t),e(e=>({commentThreads:e.commentThreads.filter(e=>e.id!==t),activeCommentId:e.activeCommentId===t?null:e.activeCommentId,...e.activeCommentId===t?{selection:null,reveal:null,rightTab:`comments`}:{}}))}catch(e){R(e,`Could not delete comment`)}}});function Rc(e){let t=e.currentBoardId;return(t?e.boards[t]?.theme:void 0)??`default`}var zc=(e,t)=>({design:null,folderConfig:null,screens:{},boards:{},currentBoardId:null,currentScreenId:null,screenVersion:0,screenVersions:{},renderErrors:{},components:null,componentsLoading:!1,generatedAssets:{},styleChannel:null,channelsByLibrary:{},theme:null,themeName:`default`,themeVersion:0,typesetDraft:null,fontDraft:null,presets:[],history:{undo:0,redo:0},wsConnected:!1,wsEverConnected:!1,bootError:null,async refreshHistory(){try{e({history:await os()})}catch{}},async loadDesign(n){let r;try{r=await Vo()}catch(t){e({bootError:t instanceof Error?t.message:String(t)});return}e({design:r,bootError:null}),t().refreshCommentCounts();let i=e=>e&&r.boards.some(t=>t.id===e)?e:null,a=i(n?.boardId)??t().currentBoardId??i(r.defaultBoard)??i(Zs())??r.boards[0]?.id??null;a&&await t().selectBoard(a);let o=n?.screenId&&r.screens.some(e=>e.id===n.screenId)?n.screenId:null;if(o&&o!==t().currentScreenId&&await t().selectScreen(o),!t().currentScreenId){let e=(r.defaultScreen&&r.screens.some(e=>e.id===r.defaultScreen)?r.defaultScreen:null)??r.screens[0]?.id??null;e&&await t().selectScreen(e)}await t().loadTheme(),await t().refreshHistory()},async refreshDesignSummary(){e({design:await Vo()})},async loadFolderConfig(){e({folderConfig:await es()})},async setBoardArchived(n,r){if(await I.updateBoard({boardId:n,patch:{archived:r}}),await t().refreshDesignSummary(),!r||t().currentBoardId!==n)return;let i=t().design?.boards[0]?.id??null;i?await t().selectBoard(i):(e({currentBoardId:null,currentScreenId:null,annotations:[],notes:[],commentThreads:[]}),t().setEditingMarkupId(null))},reorderBoardsLocal(t){e(e=>{if(!e.design)return e;let n=new Map(e.design.boards.map(e=>[e.id,e])),r=[];for(let e of t){let t=n.get(e);t&&(r.push(t),n.delete(e))}for(let t of e.design.boards)n.has(t.id)&&r.push(t);return{design:{...e.design,boards:r}}})},async loadComponents(){if(t().loadRepoCatalog(),!(t().components||t().componentsLoading)){e({componentsLoading:!0});try{let{manifest:t,styleChannel:n,channelsByLibrary:r}=await qo();e({components:t,styleChannel:n,channelsByLibrary:r})}finally{e({componentsLoading:!1})}}},async loadGeneratedAssets(){try{e({generatedAssets:await Fo()})}catch{e({generatedAssets:{}})}},async loadTheme(){let n=Rc(t()),[r,{presets:i}]=await Promise.all([Jo(n),Yo()]);e({theme:r,themeName:n,presets:i,themeVersion:t().themeVersion+1})},async refreshTheme(){let n=Rc(t());e({theme:await Jo(n),themeName:n,typesetDraft:null,fontDraft:null,themeVersion:t().themeVersion+1})},async syncThemeToBoard(){t().theme&&t().themeName!==Rc(t())&&await t().loadTheme()},setTypesetDraft(t){e({typesetDraft:t})},setFontDraft(t){e({fontDraft:t})},async loadScreen(t){try{let n=await Ho(t);return e(e=>({screens:{...e.screens,[t]:n},screenVersion:e.screenVersion+1,screenVersions:{...e.screenVersions,[t]:(e.screenVersions[t]??0)+1}})),n}catch{return null}},async loadBoard(n){try{let r=await Uo(n);e(e=>({boards:{...e.boards,[n]:r}}));let i=new Set;for(let e of r.frames)i.add(e.screen);for(let e of i)t().screens[e]||await t().loadScreen(e);return r}catch{return null}},async refreshBoard(n){try{let r=await Uo(n);e(e=>({boards:{...e.boards,[n]:r},design:e.design?{...e.design,boards:e.design.boards.map(e=>e.id===n?{...e,name:r.name,frameCount:r.frames.length,group:r.group??null}:e)}:e.design}));let i=t().design;i&&i.boards.some(e=>e.id===n)===!!r.archivedAt&&await t().refreshDesignSummary();for(let e of r.frames)t().screens[e.screen]||await t().loadScreen(e.screen);n===t().currentBoardId&&await t().syncThemeToBoard()}catch{try{let r=await Vo();e({design:r}),r.boards.some(e=>e.id===n)||await t().pruneBoard(n)}catch{}}},async pruneBoard(n){if(e(e=>{let{[n]:t,...r}=e.boards;return{boards:r,design:e.design?{...e.design,boards:e.design.boards.filter(e=>e.id!==n)}:e.design}}),t().currentBoardId!==n)return;let r=t().design?.boards[0]?.id??null;r?await t().selectBoard(r):(e({currentBoardId:null,currentScreenId:null,annotations:[],notes:[]}),t().setEditingMarkupId(null))},pruneScreens(t){if(t.length===0)return;let n=new Set(t);e(e=>({screens:Object.fromEntries(Object.entries(e.screens).filter(([e])=>!n.has(e))),design:e.design?{...e.design,screens:e.design.screens.filter(e=>!n.has(e.id))}:e.design,...e.currentScreenId&&n.has(e.currentScreenId)?{currentScreenId:null,annotations:[]}:{}}))},async selectBoard(n){let r=t().boards[n];if(!r){let e=await t().loadBoard(n);if(!e)return;r=e}e({currentBoardId:n,notes:[],commentThreads:[],activeCommentId:null}),Qs(n);let i=new Set(r.frames.map(e=>e.screen)),a=t().currentScreenId;if(r.frames.length===0)a&&(e({currentScreenId:null,annotations:[]}),t().setEditingMarkupId(null));else if(!a||!i.has(a)){let e=r.frames[0]?.screen;e&&await t().selectScreen(e)}else await t().refreshAnnotations();await t().refreshNotes(),await t().refreshComments(),await t().syncThemeToBoard()},async selectScreen(n){let r=t().screens[n];if(!r){let e=await t().loadScreen(n);if(!e)return;r=e}t().setEditingMarkupId(null),e({currentScreenId:n}),await t().refreshAnnotations()},async refreshScreen(n){try{let r=await Ho(n);e(e=>({screens:{...e.screens,[n]:r},screenVersion:e.screenVersion+1,screenVersions:{...e.screenVersions,[n]:(e.screenVersions[n]??0)+1}}));let i=t().currentBoardId,a=i?t().boards[i]:null;a?.frames.some(e=>e.screen===n)&&await t().refreshAnnotations(),a?.frames.some(e=>e.screen===n)&&await t().refreshComments()}catch{await t().loadDesign()}},reportRenderError(t,n){e(e=>e.renderErrors[t]===n?e:{renderErrors:{...e.renderErrors,[t]:n}})},setWsConnected(t){e(e=>({wsConnected:t,wsEverConnected:e.wsEverConnected||t}))},async resyncAfterReconnect(){try{await t().refreshDesignSummary(),await t().refreshTheme(),await t().refreshHistory();let e=t().currentBoardId;e&&await t().refreshBoard(e);for(let e of Object.keys(t().screens))e.startsWith(`snippet:`)||await t().refreshScreen(e);await t().refreshAnnotations(),await t().refreshNotes(),await t().refreshComments(),await t().refreshCommentCounts()}catch{}},async reloadAll(){let n=await Vo(),r=t().currentBoardId,i=t().currentScreenId;e({design:n,screens:{},boards:{},currentBoardId:r&&n.boards.some(e=>e.id===r)?r:null,currentScreenId:i&&n.screens.some(e=>e.id===i)?i:null,annotations:[],notes:[],commentThreads:[],activeCommentId:null}),t().setEditingMarkupId(null),await t().loadDesign()}}),Bc=e=>({rightTab:`node`,nodeState:`default`,browsingFaces:!1,setRightTab(t){e({rightTab:t})},setNodeState(t){e({nodeState:t})},setBrowsingFaces(t){e({browsingFaces:t})}}),Vc=(e,t)=>({view:`boards`,libraryItem:null,lastLibraryItem:null,editingSnippetId:null,preSnippetView:null,setView(n){let{libraryItem:r,lastLibraryItem:i}=t();e(n===`boards`?{view:n,libraryItem:null,lastLibraryItem:r}:n===`library`?{view:n,libraryItem:r??i}:{view:n}),(n===`library`||n===`snippet`)&&t().loadComponents()},openLibrary(n){e({view:`library`,libraryItem:n??null,lastLibraryItem:null}),t().loadComponents()},closeLibrary(){e(e=>({view:`boards`,libraryItem:null,lastLibraryItem:e.libraryItem}))},openSnippetEditor(n){let r=t().view;e({view:`snippet`,editingSnippetId:n,preSnippetView:r===`snippet`?t().preSnippetView:r,selection:null,hover:null,snippetFocus:null}),t().loadComponents()},closeSnippetEditor(){let n=t().preSnippetView??`boards`;e(e=>{let t={};for(let[n,r]of Object.entries(e.screens))n.startsWith(`snippet:`)||(t[n]=r);return{view:n,editingSnippetId:null,preSnippetView:null,selection:null,hover:null,screens:t}})},setSyntheticScreen(t,n){e(e=>{let r=e.screens[t];return r&&JSON.stringify(r)===JSON.stringify(n)?e:{screens:{...e.screens,[t]:n},screenVersion:e.screenVersion+1,screenVersions:{...e.screenVersions,[t]:(e.screenVersions[t]??0)+1}}})}}),Hc=(e,t)=>{let n=new Set,r=0;return{repoCatalog:null,repoCatalogLoading:!1,repoStatus:{},async loadRepoCatalog(){if(t().repoCatalog||t().repoCatalogLoading)return;e({repoCatalogLoading:!0});let n=r,i;try{i=await fs()}catch{i={entries:[],apps:[],warnings:[]}}n===r&&e({repoCatalog:i,repoCatalogLoading:!1})},async reloadRepoCatalog(){let i=t().repoCatalog!==null||t().repoCatalogLoading;r+=1,n.clear(),e({repoCatalog:null,repoCatalogLoading:!1,repoStatus:{}}),i&&await t().loadRepoCatalog()},async refreshRepoStatus(n){e(e=>{let t={...e.repoStatus};for(let e of n)delete t[e];return{repoStatus:t}}),await t().loadRepoStatus(n)},async loadRepoStatus(i){let a=t().repoStatus,o=[...new Set(i)].filter(e=>!(e in a)&&!n.has(e));if(o.length===0)return;for(let e of o)n.add(e);let s=r;try{let t=await ps(o);if(s!==r)return;let n=new Map(t.map(e=>[e.id,e]));e(e=>{let t={...e.repoStatus};for(let e of o)t[e]=n.get(e)??null;return{repoStatus:t}})}catch{}finally{if(s===r)for(let e of o)n.delete(e)}}}};function Uc(e,t){if(!e)return null;let n=Ui(t);return e.entries.find(e=>e.key===n)??null}var Wc=0;function Gc(){Wc+=1}var Kc=null,qc=450,Jc=280,Yc=48,Xc=e=>e<.5?4*e*e*e:1-(-2*e+2)**3/2;function Zc(e,t,n,r=qc,i){let a=++Wc,o=performance.now(),s=c=>{if(a!==Wc)return;let l=Math.min(1,(c-o)/r),u=Xc(l);e({canvasZoom:t.zoom+(n.zoom-t.zoom)*u,pan:{x:t.pan.x+(n.pan.x-t.pan.x)*u,y:t.pan.y+(n.pan.y-t.pan.y)*u}}),l<1?requestAnimationFrame(s):i?.()};requestAnimationFrame(s)}var Qc=()=>document.querySelector(`[data-velloo-board="true"]`),$c=320;function el(e,t){let n=Wc,r=performance.now()+$c,i=`${e.clientWidth}x${e.clientHeight}`,a=o=>{if(n!==Wc)return;let s=`${e.clientWidth}x${e.clientHeight}`;if(s===i||o>=r){t();return}i=s,requestAnimationFrame(a)};requestAnimationFrame(a)}var tl=(e,t)=>({canvasZoom:.75,cursorMode:`select`,pan:{x:0,y:0},nodeRects:{},snippetRects:{},frameInsets:{},rectProbe:null,setCanvasZoom(n){Gc(),t().editingMarkupId||(Kc=null),e({canvasZoom:Math.max(Ls,Math.min(4,n))})},setCursorMode(t){e({cursorMode:t,hover:null})},setPan(n){Gc(),t().editingMarkupId||(Kc=null),e({pan:n})},zoomAtViewportCenter(n){let r=Qc();if(!r){if(n.zoom!==void 0)e({canvasZoom:Math.max(Ls,Math.min(4,n.zoom))});else if(n.factor!==void 0){let r=t().canvasZoom*n.factor;e({canvasZoom:Math.max(Ls,Math.min(4,r))})}return}let i={zoom:t().canvasZoom,pan:t().pan},a=n.factor??(n.zoom!==void 0&&i.zoom>0?n.zoom/i.zoom:1),o=Ks(r.clientWidth/2,r.clientHeight/2,a,i);(o.zoom!==i.zoom||o.pan.x!==i.pan.x||o.pan.y!==i.pan.y)&&(Gc(),t().editingMarkupId||(Kc=null),e({canvasZoom:o.zoom,pan:o.pan}))},zoomForMarkupEdit(){let n={zoom:t().canvasZoom,pan:t().pan};if(Kc||=n,Math.abs(n.zoom-1)<.02)return;let r=Qc();if(!r){e({canvasZoom:1});return}Zc(e,n,{zoom:1,pan:Ks(r.clientWidth/2,r.clientHeight/2,1/n.zoom,n).pan},Jc)},zoomForCommentDraft(n,r){Kc||={zoom:t().canvasZoom,pan:t().pan};let i=Qc();i&&el(i,()=>{let a=Us(n,r,i.clientWidth,i.clientHeight,Yc);a&&Zc(e,{zoom:t().canvasZoom,pan:t().pan},a,Jc)})},restoreViewAfterMarkupEdit(){let n=Kc;if(!n)return;Gc();let r={zoom:t().canvasZoom,pan:t().pan};if(Math.abs(r.zoom-n.zoom)<.001&&r.pan.x===n.pan.x&&r.pan.y===n.pan.y){Kc=null;return}Zc(e,r,n,Jc,()=>{Kc=null})},centerOnFrame(n){let r=t(),i=(r.currentBoardId?r.boards[r.currentBoardId]:null)?.frames.find(e=>e.id===n),a=Qc();if(!i||!a)return;let o=Gs(i,a.clientWidth,a.clientHeight);o&&e({canvasZoom:o.zoom,pan:o.pan})},flyToFrame(n){let r=t(),i=(r.currentBoardId?r.boards[r.currentBoardId]:null)?.frames.find(e=>e.id===n),a=Qc();if(!i||!a)return;let o=Gs(i,a.clientWidth,a.clientHeight);o&&Zc(e,{zoom:r.canvasZoom,pan:r.pan},o)},flyToBoardRect(n){let r=Qc();if(!r)return;let i=t(),a=Hs(n,r.clientWidth,r.clientHeight);a&&Zc(e,{zoom:i.canvasZoom,pan:i.pan},a)},async locateNode(n,r,i={}){let a=t(),o=i.hostBoards??[],s=a.currentBoardId&&(a.boards[a.currentBoardId]?.frames.some(e=>e.screen===n)||o.includes(a.currentBoardId))?a.currentBoardId:Object.values(a.boards).find(e=>e.frames.some(e=>e.screen===n))?.id??o.find(e=>a.design?.boards.some(t=>t.id===e))??null;if(s&&s!==a.currentBoardId&&await a.selectBoard(s),t().revealSelection({screenId:n,path:r},i.preserveTab?{preserveTab:!0}:void 0),typeof document>`u`)return;let c=t().currentBoardId,l=c?t().boards[c]:null,u=i.frameId?l?.frames.find(e=>e.id===i.frameId&&e.screen===n):l?.frames.find(e=>e.screen===n);if(!u)return;e(e=>{let t=e.nodeRects[u.id],n=t?{...t}:void 0;return n&&delete n[r],{rectProbe:{frameId:u.id,path:r,nonce:(e.rectProbe?.nonce??0)+1},...n?{nodeRects:{...e.nodeRects,[u.id]:n}}:{}}});let d=await new Promise(e=>{let n=Date.now()+700,i=()=>{let a=t().nodeRects[u.id]?.[r];if(a&&a.w>0)return e(a);if(Date.now()>n)return e(null);setTimeout(i,60)};setTimeout(i,90)}),f=Qc();if(!f)return;let p={zoom:t().canvasZoom,pan:t().pan};if(d){let n=Hs(Ws(u,t().frameInsets[u.id]??{x:0,y:0,chromeH:0},d),f.clientWidth,f.clientHeight);n&&Zc(e,p,n);return}let m=Gs(u,f.clientWidth,f.clientHeight);m&&Zc(e,p,m)},setNodeRects(t,n){e(e=>{let r={},i={};for(let e of n){let t={x:e.x,y:e.y,w:e.w,h:e.h};if(!e.snippet){r[e.path]=t;continue}let n=i[e.path];n?n.push(t):i[e.path]=[t]}return{nodeRects:{...e.nodeRects,[t]:r},snippetRects:{...e.snippetRects,[t]:i}}})},clearNodeRects(t){e(e=>{if(!(t in e.nodeRects)&&!(t in e.snippetRects))return e;let{[t]:n,...r}=e.nodeRects,{[t]:i,...a}=e.snippetRects;return{nodeRects:r,snippetRects:a}})},setFrameInset(t,n){e(e=>{let r=e.frameInsets[t];if(n===null){if(!r)return e;let{[t]:n,...i}=e.frameInsets;return{frameInsets:i}}return r&&r.x===n.x&&r.y===n.y&&r.chromeH===n.chromeH?e:{frameInsets:{...e.frameInsets,[t]:n}}})}}),B=w()((...e)=>({...zc(...e),...Oc(...e),...tl(...e),...Ec(...e),...Bc(...e),...Vc(...e),...Hc(...e),...Is(...e),...Ps(...e),...js(...e),...Lc(...e)}));function nl(e){return e===`system`?typeof window>`u`?`light`:window.matchMedia?.(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:e}function rl(){let e=B(e=>e.appTheme);(0,M.useEffect)(()=>{let t=()=>{let t=nl(e);document.documentElement.classList.toggle(`dark`,t===`dark`)};if(t(),e!==`system`)return;let n=window.matchMedia?.(`(prefers-color-scheme: dark)`);if(!n)return;let r=()=>t();return n.addEventListener(`change`,r),()=>n.removeEventListener(`change`,r)},[e])}function il(e,t){let n=[e,t].filter(e=>!!e);return n.length>0?`${n.join(` · `)} - velloo`:`velloo`}function V(...e){return _(x(e))}var al=`w-auto`,H=r(),ol=u(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function U({className:e,variant:t=`default`,asChild:n=!1,...r}){let i=n?gt:`span`;return(0,H.jsx)(i,{"data-slot":`badge`,"data-variant":t,className:V(ol({variant:t}),e),...r})}var sl=u(`group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/80`,outline:`border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,xs:`h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,icon:`size-8`,"icon-xs":`size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg`,"icon-lg":`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function W({className:e,variant:t=`default`,size:n=`default`,asChild:r=!1,...i}){let a=r?gt:`button`;return(0,H.jsx)(a,{"data-slot":`button`,"data-variant":t,"data-size":n,className:V(sl({variant:t,size:n,className:e})),...i})}function cl({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`empty`,className:V(`flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-xl border-dashed p-6 text-center text-balance`,e),...t})}function ll({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`empty-header`,className:V(`flex max-w-sm flex-col items-center gap-2`,e),...t})}var ul=u(`mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{default:`bg-transparent`,icon:`flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-4`}},defaultVariants:{variant:`default`}});function dl({className:e,variant:t=`default`,...n}){return(0,H.jsx)(`div`,{"data-slot":`empty-icon`,"data-variant":t,className:V(ul({variant:t,className:e})),...n})}function fl({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`empty-title`,className:V(`cn-font-heading text-sm font-medium tracking-tight`,e),...t})}function pl({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`empty-description`,className:V(`text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,e),...t})}function ml({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`empty-content`,className:V(`flex w-full max-w-sm min-w-0 flex-col items-center gap-2.5 text-sm text-balance`,e),...t})}var hl=1e4;function gl(){let e=B(e=>e.lastAgentActivityAt),t=B(e=>e.activityFeedOpen),n=B(e=>e.setActivityFeedOpen),[,r]=(0,M.useState)(0);(0,M.useEffect)(()=>{if(e===null)return;let t=setInterval(()=>r(e=>e+1),1e3);return()=>clearInterval(t)},[e]);let i=e!==null&&Date.now()-e<hl;return(0,H.jsxs)(W,{variant:`ghost`,size:`sm`,onClick:()=>n(!t),title:i?`An agent is editing — click for the activity feed`:`Activity feed`,className:`gap-1.5`,"data-agent-active":i?`true`:`false`,children:[(0,H.jsxs)(`span`,{className:`relative flex h-2 w-2`,children:[i?(0,H.jsx)(`span`,{className:`absolute inline-flex h-full w-full rounded-full bg-primary opacity-75 animate-ping`}):null,(0,H.jsx)(`span`,{className:`relative inline-flex h-2 w-2 rounded-full ${i?`bg-primary`:`bg-muted-foreground/40`}`})]}),(0,H.jsx)(It,{size:14})]})}function _l(e){let t=Math.max(0,Math.round((Date.now()-e)/1e3));if(t<5)return`now`;if(t<60)return`${t}s ago`;let n=Math.round(t/60);if(n<60)return`${n}m ago`;let r=Math.round(n/60);return r<24?`${r}h ago`:`${Math.round(r/24)}d ago`}var vl=e=>e.replaceAll(`_`,` `);function yl(e){let t=B.getState().design,n=[];if(e.boardId){let r=t?.boards.find(t=>t.id===e.boardId);if(!r)return{crumbs:[e.boardId],navigate:null,deleted:!0};n.push(r.name)}if(e.screenId){let r=t?.screens.find(t=>t.id===e.screenId);if(!r)return{crumbs:[...n,e.screenId],navigate:null,deleted:!0};r.name,n.push(r.name)}e.path&&n.push(`node ${e.path.join(`.`)}`),e.snippetId&&n.push(`snippet ${e.snippetId}`),e.token&&n.push(e.token),e.themeName&&n.push(`theme ${e.themeName}`),e.extension&&n.push(`extension ${e.extension}`);let r=e.screenId,i=e.boardId;return!r&&!i?{crumbs:n,navigate:null,deleted:!1}:{crumbs:n,navigate:()=>{(async()=>{let n=B.getState();if(n.view!==`boards`&&n.setView(`boards`),r&&e.path){await B.getState().locateNode(r,e.path.join(`.`),{hostBoards:[...i?[i]:[],...e.boards??[]]});return}let a=e.boards??[],o=i??(r?n.currentBoardId&&(n.boards[n.currentBoardId]?.frames.some(e=>e.screen===r)||a.includes(n.currentBoardId))?n.currentBoardId:Object.values(n.boards).find(e=>e.frames.some(e=>e.screen===r))?.id??a.find(e=>t?.boards.some(t=>t.id===e))??null:null);if(o&&o!==n.currentBoardId&&await n.selectBoard(o),r&&await B.getState().selectScreen(r),!o)return;let s=B.getState().boards[o]?.frames.find(t=>e.frameId?t.id===e.frameId:r?t.screen===r:!1);s&&requestAnimationFrame(()=>B.getState().flyToFrame(s.id))})()},deleted:!1}}function bl({source:e}){return e===`mcp`?(0,H.jsx)(It,{size:12,className:`text-primary shrink-0`}):e===`canvas`?(0,H.jsx)(Pn,{size:12,className:`shrink-0 opacity-60`}):(0,H.jsx)(pr,{size:12,className:`shrink-0 opacity-60`})}function xl({entry:e}){let[t,n]=(0,M.useState)(!1),r=yl(e.target),i=(e.opCount??0)>1||(e.ops?.length??0)>1,a=(e.opCount??0)-(e.ops?.length??0);return(0,H.jsxs)(`li`,{className:`border-b border-border/60 last:border-b-0`,children:[(0,H.jsxs)(`div`,{className:`flex items-start gap-2 px-3 py-2`,children:[(0,H.jsx)(bl,{source:e.source}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`button`,{type:`button`,disabled:r.navigate===null,onClick:()=>r.navigate?.(),className:`block w-full text-left text-xs ${r.navigate?`hover:underline cursor-pointer`:`cursor-default`} ${r.deleted?`opacity-50`:``}`,children:[(0,H.jsx)(`span`,{className:`font-medium`,children:vl(e.verb)}),i?(0,H.jsxs)(U,{variant:`secondary`,className:`ml-1 px-1 py-0 text-[10px]`,children:[e.opCount??e.ops?.length,` ops`]}):null,r.deleted?(0,H.jsx)(U,{variant:`secondary`,className:`ml-1 px-1 py-0 text-[10px]`,children:`deleted`}):null,(0,H.jsx)(`span`,{className:`block truncate text-muted-foreground`,children:r.crumbs.join(` › `)||`—`})]}),(0,H.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-2 text-[10px] text-muted-foreground`,children:[(0,H.jsx)(`span`,{children:_l(e.ts)}),e.session?(0,H.jsxs)(U,{variant:`secondary`,className:`px-1 py-0`,title:`MCP session ${e.session}`,children:[`agent·`,e.session.slice(0,4)]}):null]})]}),i?(0,H.jsx)(`button`,{type:`button`,onClick:()=>n(e=>!e),className:`mt-0.5 shrink-0 text-muted-foreground hover:text-foreground`,title:t?`Collapse ops`:`Expand ops`,children:t?(0,H.jsx)(Vt,{size:12}):(0,H.jsx)(Ht,{size:12})}):null]}),t&&e.ops?(0,H.jsxs)(`ul`,{className:`mb-2 ml-8 mr-3 rounded bg-muted/40 px-2 py-1`,children:[e.ops.map((e,t)=>{let n=yl(e.target);return(0,H.jsx)(`li`,{className:`truncate py-0.5 text-[11px]`,children:(0,H.jsxs)(`button`,{type:`button`,disabled:n.navigate===null,onClick:()=>n.navigate?.(),className:n.navigate?`hover:underline`:`cursor-default opacity-60`,children:[vl(e.verb),(0,H.jsx)(`span`,{className:`ml-1 text-muted-foreground`,children:n.crumbs.join(` › `)})]})},t)}),a>0?(0,H.jsxs)(`li`,{className:`py-0.5 text-[11px] text-muted-foreground`,children:[`+`,a,` more`]}):null]}):null]})}function Sl(){let e=B(e=>e.activityFeedOpen),t=B(e=>e.setActivityFeedOpen),n=B(e=>e.activityEvents),[,r]=(0,M.useState)(0);if((0,M.useEffect)(()=>{if(!e)return;let t=setInterval(()=>r(e=>e+1),3e4);return()=>clearInterval(t)},[e]),!e)return null;let i=[...n].reverse();return(0,H.jsxs)(`aside`,{"data-activity-feed":`true`,className:`fixed right-3 top-14 bottom-10 z-40 flex w-72 flex-col overflow-hidden rounded-lg border bg-background/95 shadow-lg backdrop-blur`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between border-b px-3 py-2`,children:[(0,H.jsx)(`span`,{className:`text-xs font-semibold`,children:`Agent activity`}),(0,H.jsx)(W,{variant:`ghost`,size:`icon-xs`,onClick:()=>t(!1),title:`Close`,children:(0,H.jsx)(jr,{})})]}),i.length===0?(0,H.jsx)(cl,{className:`px-3 py-6`,children:(0,H.jsxs)(ll,{children:[(0,H.jsx)(dl,{variant:`icon`,children:(0,H.jsx)(It,{})}),(0,H.jsx)(fl,{className:`text-xs`,children:`No activity yet`}),(0,H.jsx)(pl,{className:`text-xs`,children:`Agent and canvas edits will appear here.`})]})}):(0,H.jsx)(`ul`,{className:`flex-1 overflow-y-auto`,children:i.map(e=>(0,H.jsx)(xl,{entry:e},e.id))})]})}function Cl({...e}){return(0,H.jsx)(Ue,{"data-slot":`dialog`,...e})}function wl({...e}){return(0,H.jsx)(qe,{"data-slot":`dialog-portal`,...e})}function Tl({className:e,...t}){return(0,H.jsx)(Me,{"data-slot":`dialog-overlay`,className:V(`fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function El({className:e,children:t,showCloseButton:n=!0,...r}){return(0,H.jsxs)(wl,{children:[(0,H.jsx)(Tl,{}),(0,H.jsxs)($e,{"data-slot":`dialog-content`,className:V(`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[t,n&&(0,H.jsx)(ke,{"data-slot":`dialog-close`,asChild:!0,children:(0,H.jsxs)(W,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`,children:[(0,H.jsx)(jr,{}),(0,H.jsx)(`span`,{className:`sr-only`,children:`Close`})]})})]})]})}function Dl({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`dialog-header`,className:V(`flex flex-col gap-2`,e),...t})}function Ol({className:e,showCloseButton:t=!1,children:n,...r}){return(0,H.jsxs)(`div`,{"data-slot":`dialog-footer`,className:V(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,H.jsx)(ke,{asChild:!0,children:(0,H.jsx)(W,{variant:`outline`,children:`Close`})})]})}function kl({className:e,...t}){return(0,H.jsx)(ut,{"data-slot":`dialog-title`,className:V(`cn-font-heading text-base leading-none font-medium`,e),...t})}function Al({className:e,...t}){return(0,H.jsx)(ot,{"data-slot":`dialog-description`,className:V(`text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function G({className:e,...t}){return(0,H.jsx)(oe,{"data-slot":`label`,className:V(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function K({...e}){return(0,H.jsx)(ht,{"data-slot":`select`,...e})}function q({...e}){return(0,H.jsx)(Ge,{"data-slot":`select-value`,...e})}function J({className:e,size:t=`default`,children:n,...r}){return(0,H.jsxs)(me,{"data-slot":`select-trigger`,"data-size":t,className:V(`flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,H.jsx)(mt,{asChild:!0,children:(0,H.jsx)(Vt,{className:`pointer-events-none size-4 text-muted-foreground`})})]})}function Y({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...i}){return(0,H.jsx)(ye,{children:(0,H.jsxs)(Ae,{"data-slot":`select-content`,"data-align-trigger":n===`item-aligned`,className:V(`cn-menu-target cn-menu-translucent relative z-50 max-h-(--radix-select-content-available-height) min-w-36 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...i,children:[(0,H.jsx)(jl,{}),(0,H.jsx)(te,{"data-position":n,className:V(`data-[position=popper]:h-(--radix-select-trigger-height) data-[position=popper]:w-full data-[position=popper]:min-w-(--radix-select-trigger-width)`,n===`popper`&&``),children:t}),(0,H.jsx)(Ml,{})]})})}function X({className:e,children:t,...n}){return(0,H.jsxs)(ve,{"data-slot":`select-item`,className:V(`relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,H.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`,children:(0,H.jsx)(re,{children:(0,H.jsx)(Bt,{className:`pointer-events-none`})})}),(0,H.jsx)(pt,{children:t})]})}function jl({className:e,...t}){return(0,H.jsx)(ie,{"data-slot":`select-scroll-up-button`,className:V(`z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,H.jsx)(Ut,{})})}function Ml({className:e,...t}){return(0,H.jsx)(ae,{"data-slot":`select-scroll-down-button`,className:V(`z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,H.jsx)(Vt,{})})}var Nl=[{name:`Mobile`,w:390,h:844},{name:`Tablet`,w:768,h:1024},{name:`Desktop`,w:1440,h:900}];function Pl({boardId:e,onClose:t}){let n=B(e=>e.design?.screens??[]),r=B(e=>{let t=e.design?.viewportPresets;return t&&t.length>0?t:Nl}),[i,a]=(0,M.useState)(``),[o,s]=(0,M.useState)(``);return(0,M.useEffect)(()=>{e!==null&&(a(n[0]?.id??``),s(r[r.length-1]?.name??``))},[e]),(0,H.jsx)(Cl,{open:e!==null,onOpenChange:e=>!e&&t(),children:(0,H.jsxs)(El,{className:`sm:max-w-sm`,children:[(0,H.jsxs)(Dl,{children:[(0,H.jsx)(kl,{children:`Add frame`}),(0,H.jsx)(Al,{children:`Place an existing screen on this board. The frame lands next to the current ones.`})]}),n.length===0?(0,H.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`No screens in this folder yet — ask your agent to design one first.`}):(0,H.jsxs)(`div`,{className:`grid gap-4`,children:[(0,H.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,H.jsx)(G,{htmlFor:`add-frame-screen`,className:`text-xs`,children:`Screen`}),(0,H.jsxs)(K,{value:i,onValueChange:a,children:[(0,H.jsx)(J,{id:`add-frame-screen`,className:`w-full`,children:(0,H.jsx)(q,{placeholder:`Pick a screen`})}),(0,H.jsx)(Y,{children:n.map(e=>(0,H.jsx)(X,{value:e.id,children:e.name},e.id))})]})]}),(0,H.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,H.jsx)(G,{htmlFor:`add-frame-size`,className:`text-xs`,children:`Size`}),(0,H.jsxs)(K,{value:o,onValueChange:s,children:[(0,H.jsx)(J,{id:`add-frame-size`,className:`w-full`,children:(0,H.jsx)(q,{placeholder:`Pick a size`})}),(0,H.jsx)(Y,{children:r.map(e=>(0,H.jsxs)(X,{value:e.name,children:[e.name,` — `,e.w,`×`,e.h]},e.name))})]})]})]}),(0,H.jsxs)(Ol,{children:[(0,H.jsx)(W,{type:`button`,variant:`outline`,onClick:t,children:`Cancel`}),(0,H.jsx)(W,{type:`button`,onClick:()=>{let n=r.find(e=>e.name===o)??r[0];e&&i&&n&&(t(),I.addFrame({boardId:e,screenId:i,w:n.w,h:n.h}).catch(e=>R(e,`Could not add frame`)))},disabled:!i||!o,children:`Add frame`})]})]})})}function Fl(e){return new Map([...e].sort((e,t)=>{let n=e.createdAt.localeCompare(t.createdAt);return n===0?e.id.localeCompare(t.id):n}).map((e,t)=>[e.id,t+1]))}var Il=`(14px / var(--canvas-zoom, 1))`,Ll=(e,t,n)=>`clamp(${t}px + ${Il}, ${e}px, ${n}px - ${Il})`;function Rl(e,t,n,r){let i=e.anchor;if(!i)return null;if(i.kind===`board`)return{left:`${i.x}px`,top:`${i.y}px`};let a=t.find(e=>e.id===i.frameId);if(!a)return null;let o=n[a.id]??{x:0,y:0},s=e.anchorState.status===`attached`?e.anchorState.resolvedPath.join(`.`):null,c=(s===null?void 0:r[a.id]?.[s])??i.bounds,l=a.x+o.x,u=a.y+o.y;return{left:Ll(l+c.x+c.w,l,l+a.w),top:Ll(u+c.y,u,u+a.h)}}function zl({threads:e,frames:t,insets:n,nodeRects:r,activeId:i,onOpen:a,showScope:o=!0}){let s=(0,M.useMemo)(()=>Fl(e),[e]);return(0,H.jsx)(`div`,{className:`pointer-events-none absolute inset-0`,"data-velloo-comment-pins":!0,children:e.map(e=>{let c=Rl(e,t,n,r);if(!c)return null;let l=e.anchorState.status===`stale`,u=i===e.id;return(0,H.jsx)(`button`,{type:`button`,"data-comment-thread":e.id,"data-anchor-state":e.anchorState.status,className:`pointer-events-auto absolute grid h-7 min-w-7 -translate-x-1/2 -translate-y-1/2 place-items-center rounded-full border px-1.5 text-[11px] font-semibold shadow-md transition-[scale] hover:scale-110 ${l?`border-destructive bg-destructive text-destructive-foreground`:u?`border-primary bg-primary text-primary-foreground ring-2 ring-primary/30`:`border-primary/40 bg-card text-foreground`}`,style:{...c,transform:`scale(calc(1 / var(--canvas-zoom, 1)))`},title:l?`Comment target changed`:`Open comment thread`,onPointerDown:e=>e.stopPropagation(),onClick:t=>{t.stopPropagation(),a(e.id)},children:(0,H.jsxs)(`span`,{className:`flex items-center gap-0.5`,children:[o&&e.scope===`shared`?(0,H.jsx)(qt,{size:10}):(0,H.jsx)(On,{size:10}),s.get(e.id)]})},e.id)})})}function Bl(){let e=B(e=>e.markupVisible),t=B(e=>e.commentThreads),n=B(e=>e.activeCommentId),r=B(e=>e.currentBoardId?e.boards[e.currentBoardId]:void 0),i=B(e=>e.nodeRects),a=B(e=>e.frameInsets),o=B(e=>e.setActiveComment);return!e||!r?null:(0,H.jsx)(zl,{threads:t,frames:r.frames,insets:a,nodeRects:i,activeId:n,onOpen:o})}var Vl=`#2563eb`,Hl=`#8b5cf6`,Ul=`__velloo_init`;function Wl(e){try{return(e?.contentDocument?.querySelector(`meta[name="velloo-render-error"]`))?.getAttribute(`content`)||null}catch{return null}}function Gl(e){let{frame:t,canvasDefault:n,boardTheme:r,screenRevision:i,themeVersion:a}=e,o=oi(t,n);return`${Xo(t.screen,t.w,t.h,r)}&mode=${o}&canvas=1&v=${i}.${a}`}function Kl(e){let{screenId:t,width:n,height:r,boardTheme:i,scheme:a,canvasDefault:o,screenRevision:s,themeVersion:c}=e,l=oi({scheme:a},o);return`${Xo(t,n,r,i)}&mode=${l}&v=${s}.${c}`}function ql({...e}){return(0,H.jsx)(Ze,{"data-slot":`alert-dialog`,...e})}function Jl({...e}){return(0,H.jsx)(ct,{"data-slot":`alert-dialog-portal`,...e})}function Yl({className:e,...t}){return(0,H.jsx)(Fe,{"data-slot":`alert-dialog-overlay`,className:V(`fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function Xl({className:e,size:t=`default`,...n}){return(0,H.jsxs)(Jl,{children:[(0,H.jsx)(Yl,{}),(0,H.jsx)(ge,{"data-slot":`alert-dialog-content`,"data-size":t,className:V(`group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...n})]})}function Zl({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:V(`grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,e),...t})}function Ql({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:V(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,e),...t})}function $l({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`alert-dialog-media`,className:V(`mb-2 inline-flex size-10 items-center justify-center rounded-md bg-muted sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-6`,e),...t})}function eu({className:e,...t}){return(0,H.jsx)(it,{"data-slot":`alert-dialog-title`,className:V(`cn-font-heading text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,e),...t})}function tu({className:e,...t}){return(0,H.jsx)(ee,{"data-slot":`alert-dialog-description`,className:V(`text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function nu({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,H.jsx)(W,{variant:t,size:n,asChild:!0,children:(0,H.jsx)(Ce,{"data-slot":`alert-dialog-action`,className:V(e),...r})})}function ru({className:e,variant:t=`outline`,size:n=`default`,...r}){return(0,H.jsx)(W,{variant:t,size:n,asChild:!0,children:(0,H.jsx)(Te,{"data-slot":`alert-dialog-cancel`,className:V(e),...r})})}function iu({open:e,title:t,description:n,confirmLabel:r,onConfirm:i,onCancel:a}){return(0,H.jsx)(ql,{open:e,onOpenChange:e=>{e||a()},children:(0,H.jsxs)(Xl,{children:[(0,H.jsxs)(Zl,{children:[(0,H.jsx)(eu,{children:t}),(0,H.jsx)(tu,{children:n})]}),(0,H.jsxs)(Ql,{children:[(0,H.jsx)(ru,{children:`Cancel`}),(0,H.jsx)(nu,{variant:`destructive`,onClick:i,children:r})]})]})})}function au(e){let t=B(e=>e.selection),n=B(e=>e.snippetFocus),r=B(e=>e.commentThreads),i=B(e=>e.notes),a=B(e=>e.annotations),o=t?.screenId===e.screen?t.path:null,s=(0,M.useMemo)(()=>{let t=ou({commentThreads:r,notes:i,annotations:a},e.id,e.screen);return o!==null&&!t.includes(o)&&t.push(o),t},[r,i,a,e.id,e.screen,o]),c=n!==null&&t?.screenId===`snippet:${n}`?t.path:null,l=(0,M.useMemo)(()=>c===null?[]:[c],[c]),u=(0,M.useRef)(s);u.current=s;let d=(0,M.useRef)(l);return d.current=l,{anchoredPaths:s,snippetPaths:l,anchoredPathsRef:u,snippetPathsRef:d}}function ou(e,t,n){let r=new Set;for(let n of e.commentThreads)n.anchor?.kind===`node`&&n.anchor.frameId===t&&n.anchorState.status===`attached`&&r.add(n.anchorState.resolvedPath.join(`.`));for(let n of e.notes)n.attachment?.frameId===t&&n.resolved&&r.add(n.resolved.join(`.`));for(let t of e.annotations)t.screenId===n&&t.resolved&&r.add(t.resolved.join(`.`));return[...r]}function su({...e}){return(0,H.jsx)(ne,{"data-slot":`dropdown-menu`,...e})}function cu({...e}){return(0,H.jsx)(se,{"data-slot":`dropdown-menu-trigger`,...e})}function lu({className:e,align:t=`start`,sideOffset:n=4,...r}){return(0,H.jsx)(_t,{children:(0,H.jsx)(le,{"data-slot":`dropdown-menu-content`,sideOffset:n,align:t,className:V(`cn-menu-target cn-menu-translucent z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:overflow-hidden data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r})})}function Z({className:e,inset:t,variant:n=`default`,...r}){return(0,H.jsx)(fe,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:V(`group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive`,e),...r})}function uu({className:e,inset:t,...n}){return(0,H.jsx)(_e,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:V(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,e),...n})}function du({className:e,...t}){return(0,H.jsx)(xe,{"data-slot":`dropdown-menu-separator`,className:V(`-mx-1 my-1 h-px bg-border`,e),...t})}function fu({...e}){return(0,H.jsx)(ce,{"data-slot":`dropdown-menu-sub`,...e})}function pu({className:e,inset:t,children:n,...r}){return(0,H.jsxs)(Se,{"data-slot":`dropdown-menu-sub-trigger`,"data-inset":t,className:V(`flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,H.jsx)(Ht,{className:`cn-rtl-flip ml-auto`})]})}function mu({className:e,...t}){return(0,H.jsx)(_t,{children:(0,H.jsx)(be,{"data-slot":`dropdown-menu-sub-content`,className:V(`cn-menu-target cn-menu-translucent z-50 min-w-[96px] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...t})})}function hu(e,t,n){let r=n??null;return[{value:null,label:`Follow canvas (${t})`,ariaLabel:`Follow canvas default for ${e} (currently ${t})`,current:r===null},{value:`light`,label:`Pin to light`,ariaLabel:`Pin ${e} to light mode`,current:r===`light`},{value:`dark`,label:`Pin to dark`,ariaLabel:`Pin ${e} to dark mode`,current:r===`dark`}]}function gu(e){return e===`light`?(0,H.jsx)(_r,{}):e===`dark`?(0,H.jsx)(Nn,{}):(0,H.jsx)(gr,{})}function _u({frameLabel:e,scheme:t,canvasDefault:n,onChange:r}){return(0,H.jsxs)(fu,{children:[(0,H.jsxs)(pu,{children:[gu(t??null),`Color scheme`]}),(0,H.jsx)(mu,{children:hu(e,n,t).map(e=>(0,H.jsxs)(Z,{"aria-label":e.ariaLabel,onSelect:()=>r(e.value),children:[gu(e.value),e.label,e.current?(0,H.jsx)(Bt,{className:`ml-auto`}):null]},e.label))})]})}var vu=120,yu=4096,bu=190;function xu(e){return Math.max(vu,Math.min(yu,Math.round(e)))}function Su({label:e,w:t,h:n,sharedCount:r,library:i,presets:a,scheme:o,canvasDefault:s,chromeWidth:c,onPointerDownGrip:l,onRemove:u,onExport:d,onResize:f,onPreview:p,onAddSibling:m,onSchemeChange:h,moveTargets:g,onMoveToBoard:_,onMoveToNewBoard:v}){let y=c<bu;return(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2 overflow-hidden text-xs text-muted-foreground`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1 min-w-0`,children:[(0,H.jsx)(`div`,{onPointerDown:l,className:`shrink-0 h-4 w-4 grid place-items-center rounded cursor-grab active:cursor-grabbing text-muted-foreground hover:text-foreground hover:bg-card`,title:`Drag to move`,role:`presentation`,children:(0,H.jsx)(cn,{size:12,strokeWidth:2})}),(0,H.jsx)(`span`,{className:`font-medium truncate`,title:e,children:e}),y?null:(0,H.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-0.5 opacity-60 tabular-nums`,children:[(0,H.jsx)(Cu,{value:t,ariaLabel:`frame width`,onCommit:e=>f({w:xu(e)})}),(0,H.jsx)(`span`,{className:`opacity-60`,children:`×`}),(0,H.jsx)(Cu,{value:n,ariaLabel:`frame height`,onCommit:e=>f({h:xu(e)})})]}),o&&!y?(0,H.jsx)(`span`,{className:`inline-flex shrink-0 items-center rounded px-1 py-0.5 text-[10px] bg-muted text-muted-foreground`,title:`Pinned to ${o} — this frame ignores the canvas default (${s}).`,role:`img`,"aria-label":`pinned to ${o}`,children:o===`dark`?(0,H.jsx)(Nn,{size:10,strokeWidth:2}):(0,H.jsx)(_r,{size:10,strokeWidth:2})}):null,i&&!y?(0,H.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-0.5 rounded px-1 py-0.5 text-[10px] bg-muted text-muted-foreground`,title:`This screen renders against library "${i}".`,children:[(0,H.jsx)(_n,{size:10,strokeWidth:2}),i]}):null,r>1&&!y?(0,H.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-0.5 rounded px-1 py-0.5 text-[10px] bg-primary/10 text-primary`,title:`${r} frames share this screen — edits sync across all of them.`,children:[(0,H.jsx)(vn,{size:10}),r]}):null]}),(0,H.jsx)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:(0,H.jsxs)(su,{children:[(0,H.jsx)(cu,{asChild:!0,children:(0,H.jsx)(`button`,{type:`button`,className:`opacity-0 group-hover:opacity-100 data-[state=open]:opacity-100 transition-opacity h-4 w-5 grid place-items-center rounded hover:bg-card text-muted-foreground hover:text-foreground`,title:`Frame actions`,children:(0,H.jsx)($t,{size:12})})}),(0,H.jsxs)(lu,{align:`end`,className:al,children:[(0,H.jsxs)(Z,{onSelect:p,children:[(0,H.jsx)(Dn,{}),`Full-screen preview`]}),(0,H.jsx)(_u,{frameLabel:e,scheme:o,canvasDefault:s,onChange:h}),(0,H.jsxs)(fu,{children:[(0,H.jsxs)(pu,{children:[(0,H.jsx)(Xn,{}),`New frame of this screen`]}),(0,H.jsxs)(mu,{children:[a.map(e=>(0,H.jsxs)(Z,{onSelect:()=>m({w:e.w,h:e.h}),children:[e.name,(0,H.jsxs)(`span`,{className:`ml-auto pl-3 text-xs text-muted-foreground tabular-nums`,children:[e.w,`×`,e.h]})]},e.name)),(0,H.jsxs)(Z,{onSelect:()=>m({w:t,h:n}),children:[(0,H.jsx)(Xt,{}),`Duplicate at current size`,(0,H.jsxs)(`span`,{className:`ml-auto pl-3 text-xs text-muted-foreground tabular-nums`,children:[t,`×`,n]})]})]})]}),(0,H.jsxs)(fu,{children:[(0,H.jsxs)(pu,{children:[(0,H.jsx)(an,{}),`Move to board`]}),(0,H.jsxs)(mu,{className:`max-h-[60vh] overflow-y-auto`,children:[g.map(e=>(0,H.jsxs)(Z,{onSelect:()=>_(e.id),children:[(0,H.jsx)(mn,{}),(0,H.jsx)(`span`,{className:`truncate`,children:e.name})]},e.id)),g.length>0?(0,H.jsx)(du,{}):null,(0,H.jsxs)(Z,{onSelect:v,children:[(0,H.jsx)(on,{}),`New board…`]})]})]}),(0,H.jsxs)(Z,{onSelect:d,children:[(0,H.jsx)(Qt,{}),`Export…`]}),(0,H.jsx)(du,{}),(0,H.jsxs)(Z,{variant:`destructive`,onSelect:u,children:[(0,H.jsx)(xr,{}),`Remove frame`]})]})]})})]})}function Cu({value:e,ariaLabel:t,onCommit:n}){let[r,i]=(0,M.useState)(String(e));return(0,M.useEffect)(()=>{i(String(e))},[e]),(0,H.jsx)(`input`,{type:`number`,value:r,min:vu,max:yu,step:1,"aria-label":t,onChange:e=>i(e.target.value),onBlur:()=>{let t=Number(r);if(!Number.isFinite(t)){i(String(e));return}t!==e&&n(t)},onKeyDown:t=>{t.key===`Enter`&&(t.preventDefault(),t.currentTarget.blur()),t.key===`Escape`&&(i(String(e)),t.currentTarget.blur())},onPointerDown:e=>e.stopPropagation(),className:`w-10 bg-transparent text-right tabular-nums outline-none hover:bg-card focus:bg-card rounded-sm px-0.5 [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`})}var wu=11;function Tu({frame:e,presets:t,onPick:n}){return(0,H.jsx)(`div`,{className:`flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity`,children:t.map(t=>{let r=t.w===e.w&&t.h===e.h;return(0,H.jsxs)(`button`,{type:`button`,onClick:()=>n(t),title:`${t.name}: ${t.w}×${t.h}`,className:`inline-flex items-center gap-1 rounded border px-1.5 py-0.5 text-[10px] `+(r?`border-primary bg-primary/10 text-primary`:`bg-card text-muted-foreground hover:text-foreground`),children:[Eu(t),t.name]},t.name)})})}function Eu(e){let t=e.name.toLowerCase();return t.includes(`mobile`)?(0,H.jsx)(lr,{size:wu}):t.includes(`tablet`)?(0,H.jsx)(yr,{size:wu}):(0,H.jsx)(Mn,{size:wu})}function Du(e,t,n,r){let i=B(e=>e.selection),a=B(e=>e.snippetFocus),o=B(e=>e.hover),s=B(e=>e.reveal),c=B(e=>e.nodeState),l=B(e=>e.screenVersion),u=B(e=>e.canvasZoom),d=B(e=>e.activityFlash[t.screen]),f=B(e=>e.rectProbe),p=B(e=>e.clearNodeRects);(0,M.useEffect)(()=>{let n=e.current;n&&(i?.screenId===t.screen?n.send({type:`applyHighlight`,path:i.path}):a!==null&&i?.screenId===`snippet:${a}`?n.send({type:`applyHighlight`,path:``,snippetPath:i.path}):n.send({type:`clearHighlight`}))},[e,i,a,t.screen]),(0,M.useEffect)(()=>{e.current?.send({type:`applySnippetFocus`,snippetId:a})},[e,a]),(0,M.useEffect)(()=>{let n=e.current;n&&s&&s.screenId===t.screen&&n.send({type:`applyHighlight`,path:s.path,scroll:!0})},[e,s,t.screen]),(0,M.useEffect)(()=>{let n=e.current;if(!n||!d||d.path===null)return;n.send({type:`applyHighlight`,path:d.path});let r=setTimeout(()=>{let e=B.getState().selection;e?.screenId===t.screen?n.send({type:`applyHighlight`,path:e.path}):n.send({type:`clearHighlight`})},1100);return()=>clearTimeout(r)},[e,d,t.screen]),(0,M.useEffect)(()=>{let i=e.current;i&&f&&f.frameId===t.id&&i.send({type:`requestRects`,paths:[...new Set([f.path,...n])],snippetPaths:r})},[e,f,t.id,n,r]),(0,M.useEffect)(()=>{let n=e.current;n&&(o?.screenId===t.screen?n.send({type:`applyHover`,path:o.path}):a!==null&&o?.screenId===`snippet:${a}`?n.send({type:`applyHover`,path:``,snippetPath:o.path}):n.send({type:`clearHover`}))},[e,o,a,t.screen]),(0,M.useEffect)(()=>{let n=e.current;if(!n)return;let r=i?.screenId===t.screen?i.path:null;n.send({type:`applyVelloState`,path:r,state:r?c:`default`})},[e,c,i,t.screen]),(0,M.useEffect)(()=>{let i=e.current;if(i){if(n.length===0&&r.length===0){p(t.id);return}i.send({type:`requestRects`,paths:n,snippetPaths:r})}},[e,n,r,t.id,l,p]),(0,M.useEffect)(()=>{e.current?.send({type:`setChromeScale`,scale:u})},[e,u]),(0,M.useEffect)(()=>{let n=e.current;n&&i?.screenId===t.screen&&n.send({type:`requestComputed`,path:i.path})},[e,i,t.screen,l])}function Ou(e,t){let n=(0,M.useRef)(null),r=(0,M.useRef)(null),[i,a]=(0,M.useState)(()=>({srcs:[e,null],front:0})),o=(0,M.useRef)(i);o.current=i;let s=i.front,[c,l]=(0,M.useState)(!1);return(0,M.useEffect)(()=>{a(t=>{let n=1-t.front;if(t.srcs[t.front]===e){if(t.srcs[n]===null)return t;let e=[...t.srcs];return e[n]=null,{...t,srcs:e}}if(t.srcs[n]===e)return t;let r=[...t.srcs];return r[n]=e,{...t,srcs:r}})},[e]),{srcs:i.srcs,front:s,painted:c,frontRef:s===0?n:r,slotRefs:[n,r],settleSlot:e=>{let i=o.current;if(l(!0),e===i.front)return!0;if(i.srcs[e]===null)return!1;let s=t.current,c=(e===0?n:r).current?.contentWindow;return s&&c&&c.scrollTo(s.x,s.y),a(e===0?{srcs:[i.srcs[0],null],front:0}:{srcs:[null,i.srcs[1]],front:1}),!1}}}var ku=[];function Au({boardId:e,frame:t,frameLabel:n,boardTheme:r}){let i=B(e=>e.design?.boards??ku),[a,o]=(0,M.useState)(!1),[s,c]=(0,M.useState)(null),l=(n,r)=>{I.updateFrame({boardId:e,frameId:t.id,patch:n}).catch(e=>R(e,r))},u=e=>{(e.w!==t.w||e.h!==t.h)&&l({w:e.w,h:e.h},`Could not resize frame`)},d=e=>l(e,`Could not resize frame`),f=e=>l({scheme:e},`Could not update frame color scheme`),p=()=>{o(!1),I.removeFrame({boardId:e,frameId:t.id}).catch(e=>R(e,`Could not remove frame`))},m=()=>{B.getState().setExportTarget({kind:`frame`,id:t.id,name:n})},h=()=>{B.getState().setPreviewTarget({screenId:t.screen,name:n,...r?{boardTheme:r}:{},...t.scheme?{scheme:t.scheme}:{},w:t.w})},g=n=>{I.addFrame({boardId:e,screenId:t.screen,w:n.w,h:n.h}).catch(e=>R(e,`Could not add frame`))},_=(0,M.useMemo)(()=>i.filter(t=>t.id!==e).map(e=>({id:e.id,name:e.name})),[i,e]),v=(e,t)=>{L({kind:`info`,message:`Moved "${n}" to "${t}"`,action:{label:`Open board`,onClick:()=>void B.getState().selectBoard(e)}})};return{onPickPreset:u,onResize:d,onSchemeChange:f,onExport:m,onPreview:h,onAddSibling:g,moveTargets:_,onMoveToBoard:n=>{let r=_.find(e=>e.id===n)?.name??n;I.moveFrame({boardId:e,frameId:t.id,toBoardId:n}).then(()=>v(n,r)).catch(e=>R(e,`Could not move frame`))},confirmRemove:a,requestRemove:()=>o(!0),cancelRemove:()=>o(!1),doRemove:p,newBoardName:s,setNewBoardName:c,submitNewBoard:async()=>{let n=s?.trim();if(n){c(null);try{let{boardId:r}=await I.addBoard({name:n});await I.moveFrame({boardId:e,frameId:t.id,toBoardId:r}),await B.getState().refreshDesignSummary(),v(r,n)}catch(e){R(e,`Could not move frame to a new board`)}}}}}var ju=150,Mu=20,Nu=class{iframe;handlers;port=null;buffered=[];ready=!1;destroyed=!1;retryTimer=null;attempts=0;constructor(e,t){this.iframe=e,this.handlers=t}attach(){this.destroyed||(this.cancelRetry(),this.port?.close(),this.port=null,this.ready=!1,this.attempts=0,this.sendInit())}sendInit(){if(this.destroyed||this.ready)return;let e=this.iframe.contentWindow;if(!e){this.scheduleRetry();return}this.attempts+=1,this.port?.close();let t=new MessageChannel;this.port=t.port1,this.port.onmessage=e=>this.handleMessage(e.data),e.postMessage({type:Ul,version:1},`*`,[t.port2]),this.scheduleRetry()}scheduleRetry(){this.destroyed||this.ready||this.attempts>=Mu||(this.retryTimer=setTimeout(()=>{this.retryTimer=null,!(this.ready||this.destroyed)&&this.sendInit()},ju))}cancelRetry(){this.retryTimer!==null&&(clearTimeout(this.retryTimer),this.retryTimer=null)}handleMessage(e){if(!e||typeof e!=`object`||typeof e.type!=`string`)return;let t=e;if(t.type===`ready`){t.version!==1&&console.error(`velloo: iframe protocol mismatch — canvas v1, iframe v${t.version??`<unversioned>`}. Reload the page.`),this.ready=!0,this.cancelRetry();for(let e of this.buffered)this.port?.postMessage(e);this.buffered=[],this.handlers.onReady?.();return}if(t.type===`select`)this.handlers.onSelect?.(t.path,t.snippetPath,t.instance);else if(t.type===`hover`)this.handlers.onHover?.(t.path,t.snippetPath);else if(t.type===`enter`)this.handlers.onEnter?.(t.path,t.snippetId);else if(t.type===`exit`)this.handlers.onExit?.();else if(t.type===`key`){let{type:e,...n}=t;this.handlers.onKey?.(n)}else t.type===`nodeRects`?this.handlers.onRects?.(t.rects):t.type===`nodeComputed`?this.handlers.onComputed?.(t.computed.path,t.computed.values):t.type===`parentZoom`?this.handlers.onParentZoom?.(t.deltaY,t.clientX,t.clientY):t.type===`parentPan`?this.handlers.onParentPan?.(t.deltaX,t.deltaY):t.type===`scrollPos`&&this.handlers.onScrollPos?.(t.x,t.y)}send(e){if(!this.ready||!this.port){this.buffered.push(e);return}this.port.postMessage(e)}destroy(){this.destroyed=!0,this.cancelRetry(),this.port?.close(),this.port=null,this.buffered=[],this.ready=!1}};function Pu({boardId:e,frame:t,iframeRef:n,hasScreen:r,savedScrollRef:i,anchoredPathsRef:a,snippetPathsRef:o}){let s=(0,M.useRef)(null),c=B(e=>e.setSelection),l=B(e=>e.setHover),u=B(e=>e.setNodeRects),d=B(e=>e.setSelectionComputed),f=B(e=>e.clearNodeRects);return(0,M.useEffect)(()=>{let r=n.current;if(!r)return;let p=new Nu(r,{onSelect(n,i,a){if(n===null){c(null);return}let o=B.getState();if(o.snippetFocus!==null){i===void 0?c(null):(c({screenId:`snippet:${o.snippetFocus}`,path:i}),B.getState().setSelectionAnchor({frameId:t.id,instance:a??0}));return}if(o.cursorMode===`note`){let e=Dc(o.screens,{screenId:t.screen,path:n});if(!e)return;o.createNote({attachment:{frameId:t.id,screenId:t.screen,locator:Js(e,n)}});return}if(o.cursorMode===`comment`){let i={screenId:t.screen,path:n},a=Dc(o.screens,i),s=Array.from(r.contentDocument?.querySelectorAll(`[data-node-path]`)??[]).find(e=>e.dataset.nodePath===n);if(!a||!s)return;let c=s.getBoundingClientRect(),l=Js(a,n),u=`$ref`in a?a.$ref:`$snippet`in a?a.$snippet:void 0,d=s.textContent?.trim().replace(/\s+/g,` `).slice(0,500);o.beginComment({kind:`node`,boardId:e,frameId:t.id,screenId:t.screen,locator:l,bounds:{x:c.x,y:c.y,w:c.width,h:c.height},...(u||d)&&{fingerprint:{...u&&{ref:u},...d&&{text:d}}}});return}c({screenId:t.screen,path:n})},onHover(e,n){let r=B.getState().snippetFocus;l(e===null?null:r===null?{screenId:t.screen,path:e}:n===void 0?null:{screenId:`snippet:${r}`,path:n})},onEnter(e,t){t!==void 0&&B.getState().setSnippetFocus(t)},onExit(){B.getState().setSnippetFocus(null)},onKey(e){window.dispatchEvent(new KeyboardEvent(`keydown`,e))},onRects(e){u(t.id,e)},onComputed(e,t){d(e,t)},onScrollPos(e,t){i.current={x:e,y:t};let n=a.current,r=o.current;(n.length>0||r.length>0)&&p.send({type:`requestRects`,paths:n,snippetPaths:r})},onReady(){let e=B.getState();if(e.snippetFocus!==null&&(p.send({type:`applySnippetFocus`,snippetId:e.snippetFocus}),e.selection?.screenId===`snippet:${e.snippetFocus}`&&p.send({type:`applyHighlight`,path:``,snippetPath:e.selection.path})),e.reveal?.screenId!==t.screen&&i.current&&p.send({type:`restoreScroll`,...i.current}),e.selection?.screenId===t.screen){let n=e.reveal?.screenId===t.screen&&e.reveal.path===e.selection.path;p.send({type:`applyHighlight`,path:e.selection.path,...n?{scroll:n}:{}})}e.hover?.screenId===t.screen&&p.send({type:`applyHover`,path:e.hover.path}),e.nodeState!=="default"&&e.selection?.screenId===t.screen&&p.send({type:`applyVelloState`,path:e.selection.path,state:e.nodeState});let n=a.current,r=o.current;(n.length>0||r.length>0)&&p.send({type:`requestRects`,paths:n,snippetPaths:r}),p.send({type:`setChromeScale`,scale:B.getState().canvasZoom}),e.selection?.screenId===t.screen&&p.send({type:`requestComputed`,path:e.selection.path})},onParentZoom(e,t,n){let i=B.getState(),a=zs(e),o=r.closest(`[data-velloo-board="true"]`);if(!o){i.zoomAtViewportCenter({factor:a});return}let s=r.getBoundingClientRect(),c=o.getBoundingClientRect(),l=r.clientWidth>0?s.width/r.clientWidth:i.canvasZoom,u=r.clientHeight>0?s.height/r.clientHeight:i.canvasZoom,d=Ks(s.left-c.left+t*l,s.top-c.top+n*u,a,{zoom:i.canvasZoom,pan:i.pan});d.zoom!==i.canvasZoom&&(i.setCanvasZoom(d.zoom),i.setPan(d.pan))},onParentPan(e,t){let n=B.getState();n.setPan({x:n.pan.x-e,y:n.pan.y-t})}});return s.current=p,r.contentDocument?.readyState===`complete`&&p.attach(),()=>{p.destroy(),s.current=null,f(t.id)}},[t.id,t.screen,e,r,n,i,a,o,c,l,u,d,f]),s}var Fu=(e,t)=>t.x<e.x+e.w&&t.x+t.w>e.x&&t.y<e.y+e.h&&t.y+t.h>e.y;function Iu(e,t,n,r){let i=n,a=r,o=t.filter(t=>!Fu(e,t));for(let t=0;t<=o.length;t++){let t=o.find(t=>Fu({x:e.x,y:e.y,w:i,h:a},t));if(!t)break;let n=t.x-e.x,r=t.y-e.y,s=n>=e.w,c=r>=e.h;if(s&&(!c||n*a>=i*r))i=n;else if(c)a=r;else break}return{w:i,h:a}}function Lu(e,t,n,r){let i=n.x,a=n.y;for(let n=0;n<=t.length;n++){let n=t.find(t=>Fu({x:i,y:a,w:e.w,h:e.h},t));if(!n)return{x:i,y:a};let r=[{dx:n.x-e.w-i,dy:0},{dx:n.x+n.w-i,dy:0},{dx:0,dy:n.y-e.h-a},{dx:0,dy:n.y+n.h-a}].reduce((e,t)=>Math.abs(t.dx)+Math.abs(t.dy)<Math.abs(e.dx)+Math.abs(e.dy)?t:e);i+=r.dx,a+=r.dy}return r}var Ru=44;function zu({boardId:e,frame:t,otherFrames:n}){let[r,i]=(0,M.useState)(null),[a,o]=(0,M.useState)(null),s=()=>{let e=B.getState().frameInsets,r=t=>e[t.id]?.chromeH??Ru;return{chromeH:r(t),neighbors:n.map(e=>({x:e.x,y:e.y,w:e.w,h:e.h+r(e)}))}};return{draftPos:a,draftSize:r,startDrag:n=>{if(n.button!==0)return;n.preventDefault(),n.stopPropagation();let r=n.currentTarget;r.setPointerCapture(n.pointerId);let i=t.x,a=t.y,c=n.clientX,l=n.clientY,u=B.getState().canvasZoom||1,{chromeH:d,neighbors:f}=s(),p={w:t.w,h:t.h+d},m=e=>{let t=(e.clientX-c)/u,n=(e.clientY-l)/u;return Lu(p,f,{x:Math.round(i+t),y:Math.round(a+n)},{x:i,y:a})},h=e=>o(m(e)),g=n=>{r.removeEventListener(`pointermove`,h),r.removeEventListener(`pointerup`,g),r.removeEventListener(`pointercancel`,g);let s=m(n);o(null),(s.x!==i||s.y!==a)&&I.updateFrame({boardId:e,frameId:t.id,patch:{x:s.x,y:s.y}}).catch(e=>R(e,`Could not move frame`))};r.addEventListener(`pointermove`,h),r.addEventListener(`pointerup`,g),r.addEventListener(`pointercancel`,g)},startResize:n=>r=>{r.preventDefault(),r.stopPropagation();let a=r.currentTarget;a.setPointerCapture(r.pointerId);let o=t.w,c=t.h,l=r.clientX,u=r.clientY,d=B.getState().canvasZoom||1,{chromeH:f,neighbors:p}=s(),m={x:t.x,y:t.y,w:t.w,h:t.h+f},h=e=>{let t=(e.clientX-l)/d,r=(e.clientY-u)/d,i=n===`s`?o:Math.max(120,Math.round(o+t)),a=n===`e`?c:Math.max(120,Math.round(c+r)),s=Iu(m,p,i,a+f);return{w:s.w,h:s.h-f}},g=e=>i(h(e)),_=n=>{a.removeEventListener(`pointermove`,g),a.removeEventListener(`pointerup`,_),a.removeEventListener(`pointercancel`,_);let r=h(n);i(null),(r.w!==o||r.h!==c)&&I.updateFrame({boardId:e,frameId:t.id,patch:{w:r.w,h:r.h}}).catch(e=>R(e,`Could not resize frame`))};a.addEventListener(`pointermove`,g),a.addEventListener(`pointerup`,_),a.addEventListener(`pointercancel`,_)}}}var Bu=[{family:`Inter`,category:`sans`,google:`ital,opsz,wght@0,14..32,100..900;1,14..32,100..900`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`],note:`The default for a reason — neutral, huge x-height, drawn for screens.`},{family:`Geist`,category:`sans`,google:`ital,wght@0,100..900;1,100..900`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`],note:`Tighter and more opinionated than Inter, with a mono twin.`},{family:`Manrope`,category:`sans`,google:`wght@200..800`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`,`display`],note:`Semi-rounded geometric; friendly without going soft.`},{family:`DM Sans`,category:`sans`,google:`ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`,`display`],note:`Low-contrast geometric that stays clean when set large.`},{family:`Plus Jakarta Sans`,category:`sans`,google:`ital,wght@0,200..800;1,200..800`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`,`display`],note:`Geometric bones, humanist warmth; strong at both ends.`},{family:`Work Sans`,category:`sans`,google:`ital,wght@0,100..900;1,100..900`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`],note:`Optimised for the middle sizes where most interface text lives.`},{family:`Public Sans`,category:`sans`,google:`ital,wght@0,100..900;1,100..900`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`],note:`Unopinionated on purpose — a neutral civic workhorse.`},{family:`Figtree`,category:`sans`,google:`ital,wght@0,300..900;1,300..900`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`,`display`],note:`Geometric with a little play in it; holds up small.`},{family:`Outfit`,category:`sans`,google:`wght@100..900`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`display`,`body`],note:`Purely geometric — strongest as a heading face.`},{family:`Sora`,category:`sans`,google:`wght@100..800`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`display`,`body`],note:`Angular and technical; a display sans that isn't generic.`},{family:`Lexend`,category:`sans`,google:`wght@100..900`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`],note:`Wide apertures, tuned for reading proficiency.`},{family:`Rubik`,category:`sans`,google:`ital,wght@0,300..900;1,300..900`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`,`display`],note:`Softened corners; warm and sturdy at any weight.`},{family:`Karla`,category:`sans`,google:`ital,wght@0,200..800;1,200..800`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`],note:`A grotesque with quirks — good foil for a serif display.`},{family:`Mulish`,category:`sans`,google:`ital,wght@0,200..1000;1,200..1000`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`],note:`Minimal and quiet enough to disappear behind the content.`},{family:`Nunito Sans`,category:`sans`,google:`ital,opsz,wght@0,6..12,200..1000;1,6..12,200..1000`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`],note:`Rounded terminals; an approachable product voice.`},{family:`Source Sans 3`,category:`sans`,google:`ital,wght@0,200..900;1,200..900`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`],note:`Adobe's interface workhorse; very legible small.`},{family:`IBM Plex Sans`,category:`sans`,google:`ital,wght@0,100..700;1,100..700`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`],note:`Engineered and faintly technical; pairs with Plex Mono.`},{family:`Barlow`,category:`sans`,google:`wght@400;500;600;700`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`],note:`Slightly condensed grotesque when you need the density.`},{family:`Archivo`,category:`sans`,google:`ital,wght@0,100..900;1,100..900`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`,`display`],note:`Built for high performance; enormous weight range.`},{family:`Epilogue`,category:`sans`,google:`ital,wght@0,100..900;1,100..900`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`display`,`body`],note:`Real personality once you get into the heavy weights.`},{family:`Onest`,category:`sans`,google:`wght@100..900`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`],note:`Contemporary neutral — a fresher take on the Inter brief.`},{family:`Instrument Sans`,category:`sans`,google:`ital,wght@0,400..700;1,400..700`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`],note:`Compact grotesque; sharp and very current.`},{family:`Schibsted Grotesk`,category:`sans`,google:`ital,wght@0,400..900;1,400..900`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`,`display`],note:`Editorial grotesque, drawn for a news publisher.`},{family:`Space Grotesk`,category:`sans`,google:`wght@300..700`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`display`,`body`],note:`Techy proportions; the default startup display face.`},{family:`Albert Sans`,category:`sans`,google:`ital,wght@0,100..900;1,100..900`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`,`display`],note:`Geometric revival with an elegant lowercase.`},{family:`Bricolage Grotesque`,category:`sans`,google:`opsz,wght@12..96,200..800`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`display`],note:`Deliberately awkward — excellent editorial headers.`},{family:`Hanken Grotesk`,category:`sans`,google:`ital,wght@0,100..900;1,100..900`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`],note:`Even-toned grotesque that never draws attention.`},{family:`Be Vietnam Pro`,category:`sans`,google:`wght@400;500;600;700`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`],note:`Crisp geometric with unusually good diacritics.`},{family:`Red Hat Display`,category:`sans`,google:`ital,wght@0,300..900;1,300..900`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`display`,`body`],note:`Open and geometric; corporate without being cold.`},{family:`Source Serif 4`,category:`serif`,google:`ital,opsz,wght@0,8..60,200..900;1,8..60,200..900`,fallback:`ui-serif, Georgia, serif`,roles:[`body`],note:`Screen-first serif; comfortable over long measures.`},{family:`Lora`,category:`serif`,google:`ital,wght@0,400..700;1,400..700`,fallback:`ui-serif, Georgia, serif`,roles:[`body`],note:`Brushed curves — the safe editorial body serif.`},{family:`Crimson Pro`,category:`serif`,google:`ital,wght@0,200..900;1,200..900`,fallback:`ui-serif, Georgia, serif`,roles:[`body`],note:`Old-style and book-like; low contrast survives screens.`},{family:`Newsreader`,category:`serif`,google:`ital,opsz,wght@0,6..72,200..800;1,6..72,200..800`,fallback:`ui-serif, Georgia, serif`,roles:[`body`,`display`],note:`Made for news, so it works as body and as headline.`},{family:`Literata`,category:`serif`,google:`ital,opsz,wght@0,7..72,200..900;1,7..72,200..900`,fallback:`ui-serif, Georgia, serif`,roles:[`body`],note:`Google's ebook serif; sturdy down to small sizes.`},{family:`Spectral`,category:`serif`,google:`wght@400;500;600;700`,fallback:`ui-serif, Georgia, serif`,roles:[`body`],note:`Screen-native serif with generous built-in spacing.`},{family:`EB Garamond`,category:`serif`,google:`ital,wght@0,400..800;1,400..800`,fallback:`ui-serif, Georgia, serif`,roles:[`body`],note:`Classic Garamond — give it size and leading to breathe.`},{family:`Libre Baskerville`,category:`serif`,google:`ital,wght@0,400..700;1,400..700`,fallback:`ui-serif, Georgia, serif`,roles:[`body`],note:`High contrast; set it larger than you think.`},{family:`Bitter`,category:`serif`,google:`ital,wght@0,100..900;1,100..900`,fallback:`ui-serif, Georgia, serif`,roles:[`body`],note:`Contemporary slab that stays strong at small sizes.`},{family:`Merriweather`,category:`serif`,google:`ital,opsz,wght@0,18..144,300..900;1,18..144,300..900`,fallback:`ui-serif, Georgia, serif`,roles:[`body`],note:`Dense and dark; built to be legible on screens.`},{family:`Petrona`,category:`serif`,google:`ital,wght@0,100..900;1,100..900`,fallback:`ui-serif, Georgia, serif`,roles:[`body`,`display`],note:`Quirky text serif with a surprisingly wide range.`},{family:`Faustina`,category:`serif`,google:`ital,wght@0,300..800;1,300..800`,fallback:`ui-serif, Georgia, serif`,roles:[`body`],note:`Compact serif that packs a lot of words per line.`},{family:`Frank Ruhl Libre`,category:`serif`,google:`wght@300..900`,fallback:`ui-serif, Georgia, serif`,roles:[`body`,`display`],note:`Hebrew-rooted serif with striking heavy weights.`},{family:`Vollkorn`,category:`serif`,google:`ital,wght@0,400..900;1,400..900`,fallback:`ui-serif, Georgia, serif`,roles:[`body`],note:`Warm and slightly rough — good for long-form.`},{family:`Zilla Slab`,category:`serif`,google:`wght@400;500;600;700`,fallback:`ui-serif, Georgia, serif`,roles:[`body`,`display`],note:`Mozilla's slab: technical but warm.`},{family:`Roboto Slab`,category:`serif`,google:`wght@100..900`,fallback:`ui-serif, Georgia, serif`,roles:[`body`,`display`],note:`Neutral slab; the least surprising choice.`},{family:`Alegreya`,category:`serif`,google:`ital,wght@0,400..900;1,400..900`,fallback:`ui-serif, Georgia, serif`,roles:[`body`],note:`Calligraphic origins, designed for literature.`},{family:`Instrument Serif`,category:`serif`,google:`wght@400`,fallback:`ui-serif, Georgia, serif`,roles:[`display`],note:`High-contrast display serif; everywhere right now.`},{family:`Fraunces`,category:`serif`,google:`opsz,wght@9..144,100..900`,fallback:`ui-serif, Georgia, serif`,roles:[`display`],note:`Wonky and optical-size aware; enormous personality.`},{family:`Playfair Display`,category:`serif`,google:`wght@400..900`,fallback:`ui-serif, Georgia, serif`,roles:[`display`],note:`High-contrast Didone — the classic luxury headline.`},{family:`DM Serif Display`,category:`serif`,google:`wght@400`,fallback:`ui-serif, Georgia, serif`,roles:[`display`],note:`Sharp Didone; the free Playfair alternative.`},{family:`Bodoni Moda`,category:`serif`,google:`opsz,wght@6..96,400..900`,fallback:`ui-serif, Georgia, serif`,roles:[`display`],note:`True Didone with optical sizes; fashion-editorial.`},{family:`Abril Fatface`,category:`display`,google:`wght@400`,fallback:`ui-serif, Georgia, serif`,roles:[`display`],note:`Heavy Didone built for one-word headlines.`},{family:`Unbounded`,category:`sans`,google:`wght@200..900`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`display`],note:`Geometric and loud; unmistakably brand-forward.`},{family:`Syne`,category:`sans`,google:`wght@400..800`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`display`],note:`Deliberately odd widths — art-gallery energy.`},{family:`Anton`,category:`sans`,google:`wght@400`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`display`],note:`Ultra-condensed poster weight, and only that.`},{family:`Bebas Neue`,category:`sans`,google:`wght@400`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`display`],note:`All-caps condensed; posters and scoreboards.`},{family:`Archivo Black`,category:`sans`,google:`wght@400`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`display`],note:`One very heavy weight that fills the line.`},{family:`Big Shoulders`,category:`display`,google:`opsz,wght@10..72,100..900`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`display`],note:`Tall condensed; wayfinding and data-dense headers.`},{family:`Cormorant Garamond`,category:`serif`,google:`wght@300..700`,fallback:`ui-serif, Georgia, serif`,roles:[`display`],note:`Delicate high contrast — set it big or lose it.`},{family:`Marcellus`,category:`serif`,google:`wght@400`,fallback:`ui-serif, Georgia, serif`,roles:[`display`],note:`Roman inscriptional capitals; quietly expensive.`},{family:`Prata`,category:`serif`,google:`wght@400`,fallback:`ui-serif, Georgia, serif`,roles:[`display`],note:`Didone with a single weight and a lot of poise.`},{family:`Gloock`,category:`serif`,google:`wght@400`,fallback:`ui-serif, Georgia, serif`,roles:[`display`],note:`Fat high-contrast serif; editorial and current.`},{family:`Yeseva One`,category:`display`,google:`wght@400`,fallback:`ui-serif, Georgia, serif`,roles:[`display`],note:`Curvy and decorative; strong at very large sizes.`},{family:`Chivo`,category:`sans`,google:`ital,wght@0,100..900;1,100..900`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`display`,`body`],note:`Grotesque with heavy weights made for headlines.`},{family:`Darker Grotesque`,category:`sans`,google:`wght@300..900`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`display`],note:`Tall, tight and slightly strange.`},{family:`Familjen Grotesk`,category:`sans`,google:`ital,wght@0,400..700;1,400..700`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`display`,`body`],note:`Swedish grotesque with a distinctive g.`},{family:`Caveat`,category:`handwriting`,google:`wght@400..700`,fallback:`ui-rounded, cursive`,roles:[`display`],note:`Handwritten — annotations and margin notes.`},{family:`JetBrains Mono`,category:`mono`,google:`wght@100..800`,fallback:`ui-monospace, SFMono-Regular, monospace`,roles:[`mono`],note:`Tall x-height, drawn for code; the safe default.`},{family:`IBM Plex Mono`,category:`mono`,google:`wght@400;500;600;700`,fallback:`ui-monospace, SFMono-Regular, monospace`,roles:[`mono`],note:`Pairs exactly with Plex Sans and Plex Serif.`},{family:`Space Mono`,category:`mono`,google:`wght@400;700`,fallback:`ui-monospace, SFMono-Regular, monospace`,roles:[`mono`,`display`],note:`Retro-technical and quirky; works as display mono.`},{family:`Fira Code`,category:`mono`,google:`wght@300..700`,fallback:`ui-monospace, SFMono-Regular, monospace`,roles:[`mono`],note:`Programming ligatures, if you want them.`},{family:`Source Code Pro`,category:`mono`,google:`wght@200..900`,fallback:`ui-monospace, SFMono-Regular, monospace`,roles:[`mono`],note:`Adobe's code face; wide and unambiguous.`},{family:`Roboto Mono`,category:`mono`,google:`wght@100..700`,fallback:`ui-monospace, SFMono-Regular, monospace`,roles:[`mono`],note:`The neutral default nobody objects to.`},{family:`DM Mono`,category:`mono`,google:`wght@400;500`,fallback:`ui-monospace, SFMono-Regular, monospace`,roles:[`mono`],note:`Low contrast and geometric; unusually pretty.`},{family:`Geist Mono`,category:`mono`,google:`wght@100..900`,fallback:`ui-monospace, SFMono-Regular, monospace`,roles:[`mono`],note:`Geist's twin — use them together.`},{family:`Martian Mono`,category:`mono`,google:`wght@100..800`,fallback:`ui-monospace, SFMono-Regular, monospace`,roles:[`mono`,`display`],note:`Wide and semi-condensed; a mono with presence.`},{family:`Azeret Mono`,category:`mono`,google:`wght@100..900`,fallback:`ui-monospace, SFMono-Regular, monospace`,roles:[`mono`],note:`Boxy and deliberate; good for figures and tables.`},{family:`Red Hat Mono`,category:`mono`,google:`wght@300..700`,fallback:`ui-monospace, SFMono-Regular, monospace`,roles:[`mono`],note:`Humanist mono that reads like prose.`},{family:`Inconsolata`,category:`mono`,google:`wght@200..900`,fallback:`ui-monospace, SFMono-Regular, monospace`,roles:[`mono`],note:`Narrow and efficient; fits more columns.`}];function Vu(e){return Bu.find(t=>t.family===e)}function Hu(e){return`"${e.family}", ${e.fallback}`}function Uu(e,t,n){let r=t.replace(/ /g,`+`);return`https://fonts.googleapis.com/css2?family=${e===!0?r:`${r}:${e}`}${n?`&text=${encodeURIComponent(n)}`:``}&display=swap`}function Wu(e){return Ai(e.role)?`:root {\n --font-${e.role}: ${ji(e.stack)};\n}`:``}function Gu(e){return e.google?Uu(e.google,e.family):null}function Ku(e){let t=e.name===aa;if(!t&&!oa(e.name))return``;let n=_a(e.typeset,` `,!t);return n.length===0?``:`${t?`:root, .typeset`:`.typeset-${e.name}`} {\n${n.join(`
3
+ `)}\n}`}function qu({slotRefs:e,front:t,screenRev:n,hasScreen:r,frontIsCurrent:i}){let a=B(e=>e.cursorMode),o=B(e=>e.typesetDraft),s=B(e=>e.fontDraft),[c,l]=e;(0,M.useEffect)(()=>{let e=e=>{let t=e?.contentDocument;if(!t?.head)return;let n=`__velloo-comment-cursor`,r=t.getElementById(n),i=a===`comment`?`cell`:a===`note`?`crosshair`:null;i?(r||(r=t.createElement(`style`),r.id=n,t.head.appendChild(r)),r.textContent=`*, *::before, *::after { cursor: ${i} !important; }`):r&&r.remove()};e(c.current),e(l.current)},[a,t,n,r]);let u=(0,M.useRef)(null);o||s?u.current={css:[o?Ku(o):``,s?Wu(s):``].filter(Boolean).join(`
4
+ `),fontUrl:s?Gu(s):null}:i&&(u.current=null);let d=u.current,f=d?.css??``,p=d?.fontUrl??null;(0,M.useEffect)(()=>{let e=e=>{let t=e?.contentDocument;t?.head&&(Ju(t,`__velloo-font-draft`,`link`,p,e=>{let t=e;t.rel=`stylesheet`,t.href=p}),Ju(t,`__velloo-theme-draft`,`style`,f||null,e=>{e.textContent=f}))};e(c.current),e(l.current)},[f,p,t,n,r])}function Ju(e,t,n,r,i){let a=e.getElementById(t);if(r===null){a?.remove();return}let o=a??e.createElement(n);a||(o.id=t,e.head.appendChild(o)),i(o)}var Yu=198,Xu=`
5
+ @keyframes velloo-loading-trace {
6
+ 0% { stroke-dashoffset: ${Yu}; }
7
+ 40% { stroke-dashoffset: 0; }
8
+ 60% { stroke-dashoffset: 0; }
9
+ 100% { stroke-dashoffset: -${Yu}; }
10
+ }
11
+ .velloo-loading-ring {
12
+ stroke-dasharray: ${Yu};
13
+ /* backwards: amber's delay would otherwise show it fully drawn for 180ms
14
+ before the trace starts, popping on every mount. */
15
+ animation: velloo-loading-trace 1.6s ease-in-out infinite backwards;
16
+ }
17
+ .velloo-loading-ring-amber { animation-delay: 0.18s; }
18
+ @media (prefers-reduced-motion: reduce) {
19
+ .velloo-loading-ring {
20
+ animation: none;
21
+ stroke-dasharray: none;
22
+ stroke-dashoffset: 0;
23
+ }
24
+ }
25
+ `;function Zu({size:e=22,className:t}){let n=`velloo-loading-weave-${(0,M.useId)().replace(/[^a-zA-Z0-9]/g,``)}`;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`style`,{href:`velloo-loading`,precedence:`default`,children:Xu}),(0,H.jsxs)(`svg`,{viewBox:`0 0 120 120`,width:e,height:e,className:t,fill:`none`,"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,H.jsx)(`defs`,{children:(0,H.jsx)(`clipPath`,{id:n,children:(0,H.jsx)(`rect`,{x:`52`,y:`30`,width:`38`,height:`35`})})}),(0,H.jsx)(`rect`,{className:`velloo-loading-ring`,x:`21`,y:`21`,width:`58`,height:`58`,rx:`20`,stroke:`#FF6F4D`,strokeWidth:`11`,strokeLinejoin:`round`,strokeLinecap:`round`}),(0,H.jsx)(`rect`,{className:`velloo-loading-ring velloo-loading-ring-amber`,x:`41`,y:`41`,width:`58`,height:`58`,rx:`20`,stroke:`#FFAB1F`,strokeWidth:`11`,strokeLinejoin:`round`,strokeLinecap:`round`}),(0,H.jsx)(`rect`,{className:`velloo-loading-ring`,x:`21`,y:`21`,width:`58`,height:`58`,rx:`20`,stroke:`#FF6F4D`,strokeWidth:`11`,strokeLinejoin:`round`,strokeLinecap:`round`,clipPath:`url(#${n})`})]})]})}function Qu({label:e,size:t,className:n}){return(0,H.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`flex items-center justify-center gap-2${n?` ${n}`:``}`,children:[(0,H.jsx)(Zu,{size:t}),e?(0,H.jsx)(`span`,{children:e}):(0,H.jsx)(`span`,{className:`sr-only`,children:`Loading`})]})}function Q({className:e,type:t,...n}){return(0,H.jsx)(`input`,{type:t,"data-slot":`input`,className:V(`h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...n})}function $u({open:e,title:t,placeholder:n,submitLabel:r,maxLength:i,value:a,onValueChange:o,onSubmit:s,onCancel:c}){return(0,H.jsx)(Cl,{open:e,onOpenChange:e=>{e||c()},children:(0,H.jsxs)(El,{className:`sm:max-w-sm`,children:[(0,H.jsx)(Dl,{children:(0,H.jsx)(kl,{children:t})}),(0,H.jsxs)(`form`,{className:`grid gap-4`,onSubmit:e=>{e.preventDefault(),s()},children:[(0,H.jsx)(Q,{autoFocus:!0,value:a,onChange:e=>o(e.target.value),onFocus:e=>e.currentTarget.select(),maxLength:i,placeholder:n,"aria-label":n}),(0,H.jsxs)(Ol,{children:[(0,H.jsx)(W,{type:`button`,variant:`outline`,onClick:c,children:`Cancel`}),(0,H.jsx)(W,{type:`submit`,disabled:a.trim().length===0,children:r})]})]})]})})}function ed({size:e=28,label:t,counterZoom:n=!1}){return(0,H.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`absolute inset-0 z-10 grid place-items-center rounded-md border bg-card text-xs text-muted-foreground pointer-events-none`,children:(0,H.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,style:n?{transform:`scale(calc(1 / var(--canvas-zoom, 1)))`}:void 0,children:[(0,H.jsx)(Zu,{size:e}),t?(0,H.jsx)(`span`,{children:t}):(0,H.jsx)(`span`,{className:`sr-only`,children:`Loading`})]})})}var td=(0,M.memo)(function({boardId:e,frame:t,frames:n,presets:r,sharedCount:i}){let a=(0,M.useMemo)(()=>n.filter(e=>e.id!==t.id),[n,t.id]),o=(0,M.useRef)(null),s=B(e=>e.screens[t.screen]),c=B(t=>t.boards[e]?.theme),l=B(e=>e.screenVersions[t.screen]??0),u=B(e=>e.themeVersion),d=B(e=>e.designMode),f=B(e=>e.cursorMode),p=B(e=>e.wsConnected),m=B(e=>e.canvasZoom),h=B(e=>e.setFrameInset),g=B(e=>e.reportRenderError),_=B(e=>e.frameGlow[t.id]),[v,y]=(0,M.useState)(!1),{draftPos:b,draftSize:x,startDrag:S,startResize:C}=zu({boardId:e,frame:t,otherFrames:a}),w=x?.w??t.w,T=x?.h??t.h,E=b?.x??t.x,D=b?.y??t.y,O=!!s,{anchoredPaths:k,snippetPaths:A,anchoredPathsRef:ee,snippetPathsRef:te}=au(t),ne=Gl({frame:t,canvasDefault:d,...c?{boardTheme:c}:{},screenRevision:l,themeVersion:u}),re=(0,M.useRef)(ne);p&&(re.current=ne);let ie=re.current,ae=(0,M.useRef)(null),{srcs:oe,front:se,painted:ce,frontRef:le,slotRefs:ue,settleSlot:de}=Ou(ie,ae);(0,M.useEffect)(()=>{let e=o.current;if(!e)return;let n=e.parentElement,r=()=>{h(t.id,{x:e.offsetLeft,y:e.offsetTop,chromeH:(n?.offsetHeight??e.offsetHeight)-e.offsetHeight})};r();let i=new ResizeObserver(r);return n&&i.observe(n),i.observe(e),()=>{i.disconnect(),h(t.id,null)}},[t.id,O,h]);let fe=Pu({boardId:e,frame:t,iframeRef:le,hasScreen:O,savedScrollRef:ae,anchoredPathsRef:ee,snippetPathsRef:te});Du(fe,t,k,A),qu({slotRefs:ue,front:se,screenRev:l,hasScreen:O,frontIsCurrent:oe[se]===ie}),(0,M.useEffect)(()=>{if(!_)return;y(!0);let e=setTimeout(()=>y(!1),1400);return()=>clearTimeout(e)},[_]);let pe=t.label??s?.name??t.screen,j=Au({boardId:e,frame:t,frameLabel:pe,boardTheme:c}),me=f===`hand`;return(0,H.jsxs)(`div`,{className:`absolute group`,style:{left:E,top:D},"data-frame-id":t.id,"data-group-id":t.group??``,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsx)(`div`,{style:{width:`calc(${w}px * var(--canvas-zoom, 1))`,transform:`scale(calc(1 / var(--canvas-zoom, 1)))`,transformOrigin:`bottom left`},children:(0,H.jsx)(Su,{label:pe,w,h:T,sharedCount:i,library:s?.library??null,presets:r,scheme:t.scheme,canvasDefault:d,chromeWidth:w*m,onPointerDownGrip:S,onRemove:j.requestRemove,onExport:j.onExport,onResize:j.onResize,onPreview:j.onPreview,onAddSibling:j.onAddSibling,onSchemeChange:j.onSchemeChange,moveTargets:j.moveTargets,onMoveToBoard:j.onMoveToBoard,onMoveToNewBoard:()=>j.setNewBoardName(pe)})}),s?(0,H.jsxs)(`div`,{ref:o,className:`relative`+(v?` rounded-md ring-2 ring-primary/70 shadow-[0_0_18px_2px] shadow-primary/25 transition-shadow duration-300`:``),style:{width:w,height:T},children:[[0,1].map(e=>oe[e]===null?null:(0,H.jsx)(`iframe`,{ref:ue[e],title:`${s.name} (${t.id})${e===se?``:` — loading`}`,src:oe[e],width:w,height:T,onLoad:()=>{g(t.screen,Wl(ue[e].current)),de(e)&&fe.current?.attach()},"aria-hidden":e!==se||void 0,className:`velloo-frame-iframe absolute inset-0 border rounded-md bg-white`+(e===se?``:` invisible`),style:{width:w,height:T,pointerEvents:e===se&&!me?`auto`:`none`}},e)),ce?null:(0,H.jsx)(ed,{counterZoom:!0}),(0,H.jsx)(`div`,{onPointerDown:C(`e`),className:`absolute top-0 right-0 h-full w-0.5 cursor-ew-resize opacity-0 group-hover:opacity-100 transition-opacity border-r border-dashed border-primary/40 hover:border-solid hover:border-r-2 hover:border-primary/70`,role:`presentation`}),(0,H.jsx)(`div`,{onPointerDown:C(`s`),className:`absolute bottom-0 left-0 w-full h-0.5 cursor-ns-resize opacity-0 group-hover:opacity-100 transition-opacity border-b border-dashed border-primary/40 hover:border-solid hover:border-b-2 hover:border-primary/70`,role:`presentation`}),(0,H.jsx)(`div`,{onPointerDown:C(`se`),className:`absolute bottom-0 right-0 h-2 w-2 cursor-nwse-resize opacity-0 group-hover:opacity-100 transition-opacity bg-primary/50 hover:bg-primary rounded-br`,role:`presentation`})]}):(0,H.jsx)(`div`,{style:{width:w,height:T},className:`border border-dashed border-muted-foreground/30 rounded-md grid place-items-center text-xs text-muted-foreground`,children:(0,H.jsx)(Qu,{size:28,label:t.screen,className:`flex-col`})}),(0,H.jsx)(`div`,{style:{width:`calc(${w}px * var(--canvas-zoom, 1))`,transform:`scale(calc(1 / var(--canvas-zoom, 1)))`,transformOrigin:`top left`},children:(0,H.jsx)(Tu,{frame:t,presets:r,onPick:j.onPickPreset})})]}),(0,H.jsx)(iu,{open:j.confirmRemove,title:`Remove frame`,description:`Remove this placement of "${pe}" from the board? The underlying screen stays — only this frame is removed. You can put it back with ⌘Z.`,confirmLabel:`Remove`,onConfirm:j.doRemove,onCancel:j.cancelRemove}),(0,H.jsx)($u,{open:j.newBoardName!==null,title:`Move to a new board`,placeholder:`Board name`,submitLabel:`Create and move`,maxLength:80,value:j.newBoardName??``,onValueChange:j.setNewBoardName,onSubmit:()=>void j.submitNewBoard(),onCancel:()=>j.setNewBoardName(null)})]})});function nd(){let e=B(e=>e.components);return(0,M.useMemo)(()=>{let t=e?.find(e=>e.id===`Icon`)?.props.find(e=>e.name===`name`);return Array.isArray(t?.enumValues)?t.enumValues:[]},[e])}function rd(){let e=B(e=>e.selection),t=B(e=>e.currentBoardId?e.boards[e.currentBoardId]:void 0),n=B(e=>e.nodeRects),r=B(e=>e.snippetRects),i=B(e=>e.snippetFocus),a=B(e=>e.selectionAnchor),o=B(e=>e.frameInsets);return(0,M.useMemo)(()=>{if(!e||!t)return[];let s=i!==null&&e.screenId===`snippet:${i}`,c=[];for(let i of t.frames){let t=s?r[i.id]?.[e.path]??[]:i.screen===e.screenId?[n[i.id]?.[e.path]]:[],l=o[i.id]??{x:0,y:0,chromeH:0},u={x:i.x+l.x,y:i.y+l.y,w:i.w,h:i.h};t.forEach((e,t)=>{e&&c.push({frameId:i.id,key:`${i.id}:${t}`,x:u.x+e.x,y:u.y+e.y,w:e.w,h:e.h,anchor:s?a?a.frameId===i.id&&a.instance===t:c.length===0:!0,clip:u})})}return c},[e,t,n,r,i,a,o])}var id=C(`oklch`),ad=C(`rgb`),od=C(`hsl`);function sd(e,t=3){if(e===void 0||Number.isNaN(e))return 0;let n=10**t;return Math.round(e*n)/n}function cd(e){let t=id(e);return`oklch(${sd(t.l)} ${sd(t.c)} ${sd(t.h)}${t.alpha!==void 0&&t.alpha<1?` / ${sd(t.alpha,3)}`:``})`}function ld(e){let t=od(e);return`hsl(${sd(t.h??0,1)} ${sd((t.s??0)*100,1)}% ${sd((t.l??0)*100,1)}%${t.alpha!==void 0&&t.alpha<1?` / ${sd(t.alpha,3)}`:``})`}function ud(e){if(!e)return null;let t=b(e);return t?dd(t):null}function dd(e){let t=ad(e);return{hex:T(t)??`#000000`,oklch:cd(e),hsl:ld(e)}}function fd(e){let t=b(e);return t?cd(t):null}var pd=e=>{if(!e)return null;let t=Number.parseFloat(e);return Number.isFinite(t)?Math.round(t*100)/100:null},md={100:`light`,200:`light`,300:`light`,400:`normal`,500:`medium`,600:`semibold`,700:`bold`,800:`bold`,900:`bold`},hd={0:`0`,1:`1`,2:`2`,4:`4`};function gd(e){return e===null?null:`${e}px`}function _d(e){let t=e?.split(`,`)[0]?.trim();return t?t.replace(/^["']|["']$/g,``):null}function vd(e){return!e||/^rgba?\([^)]*[,/]\s*0\s*\)$/.test(e.trim())?null:ud(e)?.hex??null}function yd(e){let[t]=e;return t==null?null:e.every(e=>e===t)?t:null}function bd(e){if(!e)return{};let t={},n=(e,n)=>{n!==null&&(t[e]=n)},r=pd(e.fontSize);n(`font`,_d(e.fontFamily)),n(`size`,r),n(`weight`,md[e.fontWeight??``]??null);let i=pd(e.lineHeight);n(`leading`,i!==null&&r?Math.round(i/r*100)/100:null),n(`tracking`,e.letterSpacing===`normal`?`normal`:gd(pd(e.letterSpacing))),n(`align`,(e.textAlign===`start`?`left`:e.textAlign===`end`?`right`:null)??e.textAlign??null),n(`color`,vd(e.color)),n(`bg`,vd(e.backgroundColor)),n(`borderColor`,vd(e.borderTopColor));let a=pd(e.borderTopWidth);return n(`borderWidth`,a===null?null:hd[a]??gd(a)),n(`rounded`,gd(pd(e.borderTopLeftRadius))),n(`padding`,yd([pd(e.paddingTop),pd(e.paddingRight),pd(e.paddingBottom),pd(e.paddingLeft)])),n(`margin`,yd([pd(e.marginTop),pd(e.marginRight),pd(e.marginBottom),pd(e.marginLeft)])),n(`gap`,e.columnGap===`normal`?0:pd(e.columnGap)),t}function xd(e){return e.filter(e=>e.tier===`bar`)}var Sd=new Set([`h1`,`h2`,`h3`,`h4`,`h5`,`h6`]),Cd=new Set([`p`,`span`,`small`,`strong`,`em`,`b`,`i`,`label`,`blockquote`,`figcaption`,`li`,`dt`,`dd`]),wd=new Set([`Box`,`Card`,`CardContent`,`CardHeader`,`CardFooter`,`Container`,`Stack`,`Layer`,`Placeholder`]);function Td(e){if(Pi(e))return`snippet`;if(!Ni(e))return`other`;let t=e.$ref;if(t===`Image`)return`image`;if(t===`Icon`)return`icon`;if(t===`Heading`)return`heading`;if(t===`Text`)return`text`;if(t===`Box`){let t=typeof e.props?.as==`string`?e.props.as:void 0;return t&&Sd.has(t)?`heading`:t&&Cd.has(t)||typeof e.props?.children==`string`?`text`:`box`}return wd.has(t)?`box`:`other`}var Ed=[{value:`full`,label:`Fill`},{value:`fit`,label:`Hug`},{value:`fixed`,label:`Fixed`}],Dd=[{value:`light`,label:`Light`},{value:`normal`,label:`Regular`},{value:`medium`,label:`Medium`},{value:`semibold`,label:`Semibold`},{value:`bold`,label:`Bold`}],Od=[{value:`none`,label:`Square`},{value:`sm`,label:`Small`},{value:`md`,label:`Medium`},{value:`lg`,label:`Large`},{value:`full`,label:`Round`}],kd=[{value:`left`,label:`Left`},{value:`center`,label:`Center`},{value:`right`,label:`Right`}],Ad=[{value:`0`,label:`None`},{value:`1`,label:`Hairline`},{value:`2`,label:`Medium`},{value:`4`,label:`Thick`}],jd=[{value:`tighter`,label:`Tighter`},{value:`tight`,label:`Tight`},{value:`normal`,label:`Normal`},{value:`wide`,label:`Wide`},{value:`wider`,label:`Wider`}];function Md(e,t){if(!t)return null;if(t.startsWith(`[`))return t.slice(1,-1);if(t.startsWith(`#`))return t;if(!e)return null;let n=t.split(`/`)[0]??t,r=e.colors,i=r[n];if(typeof i==`string`)return i;if(i&&typeof i==`object`)return i.DEFAULT??null;let a=/^(.*)-foreground$/.exec(n);if(a){let e=r[a[1]??``];if(e&&typeof e==`object`)return e.foreground??null}return e.palette?.[n]??null}function Nd(e){if(!e)return[];let t=[],n=(n,r)=>{let i=Md(e,n);t.push({value:n,label:r,...i===null?{}:{swatch:i}})};for(let[t,r]of Object.entries(e.colors))r!=null&&(n(t,Fd(t)),typeof r==`object`&&`foreground`in r&&r.foreground!==void 0&&n(`${t}-foreground`,`${Fd(t)} text`));return t}function Pd(e){let t=e?.typography?.fontFamily;return t?Object.keys(t).map(e=>({value:e,label:Fd(e)})):[]}function Fd(e){return e.charAt(0).toUpperCase()+e.slice(1).replace(/-/g,` `)}var Id=e=>({via:`style`,key:e}),Ld={id:`width`,label:`Width`,kind:`size`,slot:Id(`width`),tier:`pane`,width:132,choices:Ed},Rd={id:`height`,label:`Height`,kind:`size`,slot:Id(`height`),tier:`pane`,width:132,choices:Ed},zd={id:`rounded`,label:`Corners`,kind:`choice`,slot:Id(`rounded`),tier:`pane`,width:108,choices:Od},Bd=[{id:`borderWidth`,label:`Border`,kind:`choice`,slot:Id(`borderWidth`),tier:`bar`,width:100,choices:Ad},{id:`borderColor`,label:`Border color`,kind:`color`,slot:Id(`borderColor`),tier:`bar`,width:132}],Vd=[{id:`font`,label:`Font`,kind:`font`,slot:Id(`fontFamily`),tier:`bar`,width:112},{id:`size`,label:`Size`,kind:`number`,slot:Id(`fontSize`),tier:`bar`,width:84,min:8,max:200},{id:`weight`,label:`Weight`,kind:`choice`,slot:Id(`fontWeight`),tier:`bar`,width:112,choices:Dd},{id:`align`,label:`Align`,kind:`align`,slot:Id(`textAlign`),tier:`bar`,width:96,choices:kd},{id:`color`,label:`Color`,kind:`color`,slot:Id(`textColor`),tier:`bar`,width:132},{id:`leading`,label:`Line height`,kind:`ratio`,slot:Id(`leading`),tier:`pane`,width:96,min:.75,max:3,step:.05},{id:`tracking`,label:`Letter spacing`,kind:`choice`,slot:Id(`tracking`),tier:`pane`,width:108,choices:jd},{id:`bg`,label:`Background`,kind:`color`,slot:Id(`bg`),tier:`pane`,width:132},{...Ld},{...Rd},{id:`padding`,label:`Padding`,kind:`number`,slot:Id(`padding`),tier:`pane`,width:88,min:0,max:256},{...zd},...Bd.map(e=>({...e,tier:`pane`}))],Hd=[{id:`margin`,label:`Margin`,kind:`number`,slot:Id(`margin`),tier:`bar`,width:88,min:0,max:256},{id:`padding`,label:`Padding`,kind:`number`,slot:Id(`padding`),tier:`bar`,width:88,min:0,max:256},{id:`color`,label:`Text`,kind:`color`,slot:Id(`textColor`),tier:`bar`,width:132},{id:`bg`,label:`Background`,kind:`color`,slot:Id(`bg`),tier:`bar`,width:132},...Bd,{...Ld},{...Rd},{id:`gap`,label:`Gap`,kind:`number`,slot:Id(`gap`),tier:`pane`,width:88,min:0,max:256},{...zd},{id:`align`,label:`Align`,kind:`align`,slot:Id(`textAlign`),tier:`pane`,width:96,choices:kd}],Ud=[{id:`prompt`,label:`Prompt`,kind:`prompt`,slot:{via:`prop`,name:`src`},tier:`bar`,width:180},{...zd,tier:`bar`},{...Ld},{...Rd},...Bd.map(e=>({...e,tier:`pane`}))],Wd=[{id:`name`,label:`Icon`,kind:`icon`,slot:{via:`prop`,name:`name`},tier:`bar`,width:148},{id:`size`,label:`Size`,kind:`number`,slot:{via:`prop`,name:`size`},tier:`bar`,width:84,min:8,max:128},{id:`color`,label:`Color`,kind:`color`,slot:Id(`textColor`),tier:`bar`,width:132}],Gd=new Set([`className`,`style`,`sx`,`asChild`,`children`,`key`,`ref`]);function Kd(e){let t=[];for(let n of e?.props??[]){if(t.length>=2)break;Gd.has(n.name)||n.control===`enum`&&n.enumValues?.length&&t.push({id:`prop:${n.name}`,label:Fd(n.name),kind:`choice`,slot:{via:`prop`,name:n.name},tier:`bar`,width:124,choices:n.enumValues.map(e=>({value:String(e),label:Fd(String(e))}))})}return[...t,...Hd.map(e=>({...e,tier:`pane`}))]}var qd=4;function Jd(e){if(!e)return[];let t=[];for(let n of e.params??[]){let e=Yd(n);e&&t.push(t.length<qd?e:{...e,tier:`pane`})}return t}function Yd(e){let t={via:`arg`,name:e.name},n={id:`arg:${e.name}`,label:Fd(e.name),slot:t,tier:`bar`};switch(e.type){case`number`:return{...n,kind:`number`,width:88,...e.min===void 0?{}:{min:e.min},...e.max===void 0?{}:{max:e.max},...e.step===void 0?{}:{step:e.step}};case`boolean`:return{...n,kind:`toggle`,width:88};case`enum`:return{...n,kind:`choice`,width:124,choices:(e.enum??[]).map(e=>({value:e,label:Fd(e)}))};case`color`:return{...n,kind:`color`,width:132};case`icon`:return{...n,kind:`icon`,width:148};case`string`:return{...n,kind:`text`,width:144};case`node`:return null}}function Xd({node:e,descriptor:t,snippet:n}){let r=Td(e);switch(r){case`heading`:case`text`:return{role:r,controls:Vd};case`box`:return{role:r,controls:Hd};case`image`:return{role:r,controls:Ud};case`icon`:return{role:r,controls:Wd};case`snippet`:return{role:r,controls:Jd(n)};case`other`:return{role:r,controls:Kd(t)}}}function Zd(e){return!(`$ref`in e)||e.$ref!==`Heading`?null:la[fa(e.props?.level)]??null}var Qd=new Set([`xs`,`sm`,`base`,`lg`,`xl`,`2xl`,`3xl`,`4xl`,`5xl`,`6xl`,`7xl`,`8xl`,`9xl`,...ca]),$d=new Set([`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`]),ef=/^\[-?[\d.]+(px|rem|em|%|ch|vw|vh)?\]$/;function tf(e,t){if(e.startsWith(`leading-`))return`leading`;if(e.startsWith(`tracking-`))return`tracking`;if(e.startsWith(`text-`)){let t=e.slice(5);return Qd.has(t)||ef.test(t)?`size`:null}if(e.startsWith(`font-`)){let n=e.slice(5);return $d.has(n)?`weight`:t.has(n)||n===`sans`||n===`serif`||n===`mono`?`family`:null}return null}function nf(e){let t=e.props??{};if(e.$ref===`Heading`){let e=fa(t.level);return{role:la[e],via:t.level===void 0?`level 1 (default)`:`level ${e}`}}if(e.$ref===`Text`){let e=String(t.variant??`default`),n=e in ua?e:`default`;return{role:ua[n],via:t.variant===void 0?`variant default`:`variant ${n}`}}return null}function rf(e,t){let n=[e],r=e;for(let e of t){if(!r||!(`$ref`in r)||(r=r.children?.[e],!r))break;n.push(r)}return n.reverse()}function af(e,t){for(let n of rf(e,t)){if(!(`$ref`in n))continue;let e=typeof n.props?.className==`string`?n.props.className:``,t=e.split(/\s+/).find(e=>e.startsWith(`typeset-`));if(t)return{name:t.slice(8),via:`class`};if(n.$ref===`Prose`){let e=n.props?.preset;return{name:typeof e==`string`&&e?e:aa,via:`prose`}}if(e.split(/\s+/).includes(`typeset`))return{name:aa,via:`class`}}return null}function of(e,t,n,r){if(!Ni(r))return null;let i=nf(r);if(!i)return null;let a=e.typography.typesets??{},o=af(t,n),s=a.default??{},c=o&&o.name!=="default"?a[o.name]:void 0,l={...s,...c??{}},u=e.typography.fontFamily??{},d=ba(l,{fontFamily:u})[i.role],f=sa[i.role].face,p=f===`heading`?l.fontHeading??l.fontBody:l.fontBody,m=new Set(Object.keys(u)),h=typeof r.props?.className==`string`?r.props.className:``,g={},_=[];for(let e of h.split(/\s+/).filter(Boolean)){let t=e.lastIndexOf(`:`),n=tf(t===-1?e:e.slice(t+1),m);n&&(t===-1?g[n]??=e:_.push(e))}return{role:i.role,via:i.via,resolved:d,face:{slot:f,...p?{role:p}:{},...p&&u[p]?{stack:u[p]}:{}},overrides:g,responsive:_,region:o}}var sf={0:0,px:1,"0.5":2,1:4,"1.5":6,2:8,"2.5":10,3:12,"3.5":14,4:16,5:20,6:24,7:28,8:32,9:36,10:40,11:44,12:48,14:56,16:64,20:80,24:96,28:112,32:128,36:144,40:160,44:176,48:192,56:224,64:256},cf=Object.fromEntries(Object.entries(sf).map(([e,t])=>[t,e]));function lf(e){if(e===void 0)return null;let t=sf[e];if(t!==void 0)return t;let n=/^\[(-?\d*\.?\d+)px\]$/.exec(e);return n?Number(n[1]):null}function uf(e){return cf[e]??`[${e}px]`}var df=new Set([`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`grid`,`inline-grid`,`hidden`,`contents`,`table`,`flow-root`]),ff=new Set([`xs`,`sm`,`base`,`lg`,`xl`,`2xl`,`3xl`,`4xl`,`5xl`,`6xl`,`7xl`,`8xl`,`9xl`]),pf=new Set([`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`]),mf=new Set([`left`,`center`,`right`,`justify`,`start`,`end`]),hf=new Set([`0`,`2`,`4`,`8`]),gf=new Set([`x`,`y`,`t`,`r`,`b`,`l`,`s`,`e`,`solid`,`dashed`,`dotted`,`double`,`hidden`,`none`,`collapse`,`separate`,`spacing`]),_f=new Set([`cover`,`contain`,`auto`,`center`,`top`,`bottom`,`left`,`right`,`repeat`,`no-repeat`,`fixed`,`local`,`scroll`,`clip`,`origin`,`blend`,`gradient`,`none`]),vf={t:`top`,r:`right`,b:`bottom`,l:`left`};function yf(e,t,n){if(t===``)e.top=e.right=e.bottom=e.left=n;else if(t===`x`)e.left=e.right=n;else if(t===`y`)e.top=e.bottom=n;else{let r=vf[t];r&&(e[r]=n)}}function bf(e){return/^\[-?\d*\.?\d+(px|rem|em|%|vh|vw|ch|ex|pt)\]$/.test(e)}function xf(e){let t={padding:{},margin:{}},n=[],r=[];for(let i of e.split(/\s+/)){let e=i.trim();if(!e)continue;if(e.includes(`:`)||e.startsWith(`!`)){n.push(e);continue}if(df.has(e)){t.display=e===`hidden`?`none`:e;continue}if(e===`flex-row`||e===`flex-row-reverse`||e===`flex-col`||e===`flex-col-reverse`){t.flexDirection=e.slice(5);continue}if(e===`flex-wrap`||e===`flex-nowrap`||e===`flex-wrap-reverse`){t.flexWrap=e.slice(5);continue}let a=e.indexOf(`-`),o=a===-1?e:e.slice(0,a),s=a===-1?``:e.slice(a+1);if((o===`p`||o===`px`||o===`py`||o===`pt`||o===`pr`||o===`pb`||o===`pl`)&&s){r.push({box:`padding`,variant:o.slice(1),arg:s});continue}if((o===`m`||o===`mx`||o===`my`||o===`mt`||o===`mr`||o===`mb`||o===`ml`)&&s){r.push({box:`margin`,variant:o.slice(1),arg:s});continue}switch(o){case`justify`:t.justify=s;continue;case`items`:t.items=s;continue;case`gap`:if(s){t.gap=s;continue}break;case`w`:if(s){t.width=s;continue}break;case`h`:if(s){t.height=s;continue}break;case`leading`:t.leading=s;continue;case`tracking`:t.tracking=s;continue;case`font`:pf.has(s)?t.fontWeight=s:t.fontFamily=s;continue;case`text`:mf.has(s)?t.textAlign=s:ff.has(s)||bf(s)?t.fontSize=s:t.textColor=s;continue;case`bg`:if(_f.has(s.split(`-`)[0]??``))break;t.bg=s;continue;case`rounded`:if(s===``||!/^(t|r|b|l|tl|tr|br|bl|s|e|ss|se|ee|es)(-|$)/.test(s)){t.rounded=s;continue}break;case`border`:if(s===``){t.borderWidth=``;continue}if(hf.has(s)){t.borderWidth=s;continue}if(gf.has(s.split(`-`)[0]??``))break;t.borderColor=s;continue}n.push(e)}let i=e=>e===``?0:e===`x`||e===`y`?1:2;r.sort((e,t)=>i(e.variant)-i(t.variant));for(let e of r)yf(t[e.box],e.variant,e.arg);return{model:t,extra:n}}function Sf(e,t){let{top:n,right:r,bottom:i,left:a}=t;if(n===void 0&&r===void 0&&i===void 0&&a===void 0)return[];if(n!==void 0&&n===r&&r===i&&i===a)return[`${e}-${n}`];let o=[];return n!==void 0&&n===i?o.push(`${e}y-${n}`):(n!==void 0&&o.push(`${e}t-${n}`),i!==void 0&&o.push(`${e}b-${i}`)),a!==void 0&&a===r?o.push(`${e}x-${a}`):(a!==void 0&&o.push(`${e}l-${a}`),r!==void 0&&o.push(`${e}r-${r}`)),o}function Cf({model:e,extra:t}){let n=[];return e.display&&n.push(e.display===`none`?`hidden`:e.display),e.flexDirection&&n.push(`flex-${e.flexDirection}`),e.flexWrap&&n.push(`flex-${e.flexWrap}`),e.items&&n.push(`items-${e.items}`),e.justify&&n.push(`justify-${e.justify}`),e.gap&&n.push(`gap-${e.gap}`),n.push(...Sf(`p`,e.padding)),n.push(...Sf(`m`,e.margin)),e.width&&n.push(`w-${e.width}`),e.height&&n.push(`h-${e.height}`),e.fontFamily&&n.push(`font-${e.fontFamily}`),e.fontSize&&n.push(`text-${e.fontSize}`),e.fontWeight&&n.push(`font-${e.fontWeight}`),e.leading&&n.push(`leading-${e.leading}`),e.tracking&&n.push(`tracking-${e.tracking}`),e.textAlign&&n.push(`text-${e.textAlign}`),e.textColor&&n.push(`text-${e.textColor}`),e.bg&&n.push(`bg-${e.bg}`),e.rounded!==void 0&&n.push(e.rounded===``?`rounded`:`rounded-${e.rounded}`),e.borderWidth!==void 0&&n.push(e.borderWidth===``?`border`:`border-${e.borderWidth}`),e.borderColor&&n.push(`border-${e.borderColor}`),n.push(...t),n.join(` `)}var wf={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48,"6xl":60,"7xl":72,"8xl":96,"9xl":128},Tf=Object.fromEntries(Object.entries(wf).map(([e,t])=>[t,e]));function Ef(e){if(e===void 0)return null;let t=wf[e];if(t!==void 0)return t;let n=/^\[(\d*\.?\d+)px\]$/.exec(e);return n?Number(n[1]):null}function Df(e){return Tf[e]??`[${e}px]`}var Of={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2};function kf(e){if(e===void 0)return null;let t=Of[e];if(t!==void 0)return t;let n=/^\[(\d*\.?\d+)\]$/.exec(e);return n?Number(n[1]):null}function Af(e){for(let[t,n]of Object.entries(Of))if(Math.abs(n-e)<.001)return t;return`[${Number(e.toFixed(3))}]`}function jf(e){let{top:t,right:n,bottom:r,left:i}=e;return t===void 0||t!==n||t!==r||t!==i?null:t}function Mf(e){return e===void 0?{}:{top:e,right:e,bottom:e,left:e}}function Nf(e){return e===void 0?null:e===`full`||e===`screen`?`full`:e===`fit`||e===`auto`||e===`min`||e===`max`?`fit`:`fixed`}function Pf(e){if(e===void 0)return null;let t=/^\[(\d*\.?\d+)px\]$/.exec(e);return t?Number(t[1]):lf(e)}function Ff(e){return Pi(e)?e.$extraClassName??``:Ni(e)&&typeof e.props?.className==`string`?e.props.className:``}function If(e,t){switch(t){case`padding`:return lf(jf(e.padding)??void 0);case`margin`:return lf(jf(e.margin)??void 0);case`gap`:return lf(e.gap);case`fontSize`:return Ef(e.fontSize);case`leading`:return kf(e.leading);case`borderWidth`:return e.borderWidth===``?`1`:e.borderWidth??null;default:return e[t]??null}}function Lf(e,t,n){let r={...e,padding:{...e.padding},margin:{...e.margin}};if(n===null){switch(t){case`padding`:r.padding={};break;case`margin`:r.margin={};break;default:r[t]=void 0}return r}switch(t){case`padding`:r.padding=Mf(uf(Number(n)));break;case`margin`:r.margin=Mf(uf(Number(n)));break;case`gap`:r.gap=uf(Number(n));break;case`fontSize`:r.fontSize=Df(Number(n));break;case`leading`:r.leading=Af(Number(n));break;case`borderWidth`:r.borderWidth=String(n)===`1`?``:String(n);break;default:r[t]=String(n)}return r}var Rf=new Set([`fontFamily`,`fontSize`,`fontWeight`,`leading`,`tracking`,`textColor`,`bg`,`borderColor`,`rounded`]);function zf(e,t){let{node:n,themeValues:r,themeSource:i}=t,a=t.computed?.[e.id]??null;if(e.slot.via===`arg`){let t=Bf((Pi(n)?n.args:void 0)?.[e.slot.name]);return{value:t,origin:`plain`,authored:t!==null}}if(e.slot.via===`prop`){let t=Bf((Ni(n)?n.props:void 0)?.[e.slot.name]);return{value:t,origin:`plain`,authored:t!==null}}let o=e.slot.key,{model:s}=xf(Ff(n)),c=If(s,o),l=r?.[e.id]??null;return c===null?l===null?{value:null,origin:Rf.has(o)?`theme`:`plain`,authored:!1,computed:a}:{value:l,origin:`theme`,authored:!1,source:i}:l!==null&&l!==c?{value:c,origin:`changed`,authored:!0,themeValue:l,source:i}:{value:c,origin:l===null?`plain`:`theme`,authored:!0,...l!==null&&i!==void 0?{source:i}:{}}}function Bf(e){return e==null?null:typeof e==`string`||typeof e==`number`||typeof e==`boolean`?e:null}function Vf(e,t,n){let r=xf(e);return Cf({model:Lf(r.model,t,n),extra:r.extra})}var Hf=new Set([`span`,`a`,`em`,`strong`,`b`,`i`,`u`,`s`,`small`,`code`,`kbd`,`samp`,`var`,`abbr`,`cite`,`mark`,`q`,`sub`,`sup`,`time`,`label`]);function Uf(e,t){if(!Ni(t))return e;let n=typeof t.props?.as==`string`?t.props.as:void 0;if(n===void 0||!Hf.has(n))return e;let r=xf(e);return r.model.display!==void 0&&r.model.display!==`inline`?e:Cf({model:{...r.model,display:`block`},extra:r.extra})}var Wf={h1:`Heading 1`,h2:`Heading 2`,h3:`Heading 3`,h4:`Heading 4`,h5:`Heading 5`,h6:`Heading 6`,body:`Body`,lead:`Lead`,small:`Small`,caption:`Caption`},Gf={100:`thin`,200:`extralight`,300:`light`,400:`normal`,500:`medium`,600:`semibold`,700:`bold`,800:`extrabold`,900:`black`},Kf={values:{}},qf=[[`leading-`,`leading`],[`tracking-`,`tracking`],[`font-`,`weight`],[`text-`,`size`]];function Jf({theme:e,tree:t,path:n,node:r}){let i=Td(r);if(i!==`heading`&&i!==`text`||!e||!t)return Kf;let a=Xf(e,t,n,r);if(!a)return Kf;let{facts:o,inherited:s}=a,{resolved:c,face:l}=o,u=o.region?`${Wf[o.role]} · ${o.region.name}`:Wf[o.role],d=s?`${u}, inherited`:u,f={font:l.role??l.slot,size:Math.round(c.fontSize*100)/100,weight:Gf[c.fontWeight]??null,leading:Math.round(c.lineHeight*1e3)/1e3,tracking:c.letterSpacing};if(s){let{overrides:e}=o,t=Ef(Yf(e.size,`text-`));t!==null&&(f.size=t);let n=Yf(e.weight,`font-`);n!==void 0&&(f.weight=n);let r=Yf(e.family,`font-`);r!==void 0&&(f.font=r);let i=kf(Yf(e.leading,`leading-`));i!==null&&(f.leading=Math.round(i*1e3)/1e3)}let p={};for(let e of o.responsive){let t=e.slice(e.indexOf(`:`)+1),n=qf.find(([e])=>t.startsWith(e));n&&(p[n[1]]=`${e} also applies at wider frames`)}return{values:f,source:d,notes:p}}function Yf(e,t){return e?.startsWith(t)?e.slice(t.length):void 0}function Xf(e,t,n,r){let i=of(e,t,n,r);if(i)return{facts:i,inherited:!1};for(let r=n.length-1;r>=0;r--){let i=n.slice(0,r),a=Zf(t,i);if(!a)break;let o=of(e,t,i,a);if(o)return{facts:o,inherited:!0}}return null}function Zf(e,t){let n=e;for(let e of t){if(!n||!(`$ref`in n))return null;n=n.children?.[e]}return n??null}function Qf(e,t){let n=(0,M.useRef)(null),r=(0,M.useRef)(null),i=(0,M.useRef)(0),a=(0,M.useRef)(t);a.current=t,(0,M.useEffect)(()=>()=>{n.current&&clearTimeout(n.current)},[]);let o=(0,M.useCallback)(()=>{n.current=null;let e=r.current;r.current=null,e&&(i.current=Date.now(),a.current(e.value))},[]);return(0,M.useCallback)((t,a=!1)=>{if(r.current={value:t},!a){n.current&&clearTimeout(n.current),n.current=setTimeout(o,e);return}n.current||=setTimeout(o,Math.max(0,e-(Date.now()-i.current)))},[e,o])}var $f=200;function ep({selection:e,liveClasses:t,node:n}){let r=e?`${e.screenId}:${e.path}`:``,i=(0,M.useRef)(null),a=Qf($f,e=>{I.applyClasses({screenId:e.screenId,path:z(e.path),classes:e.classes,gesture:e.gesture}).catch(e=>R(e,`Could not update style`))}),o=Qf($f,e=>{I.updateProps({screenId:e.screenId,path:z(e.path),propPatch:e.patch,gesture:e.gesture}).catch(e=>R(e,`Could not update prop`))}),s=Qf($f,e=>{I.updateSnippetArgs({screenId:e.screenId,path:z(e.path),argPatch:e.patch,gesture:e.gesture}).catch(e=>R(e,`Could not update snippet`))});return(0,M.useCallback)((c,l,u={})=>{if(!e)return;let{screenId:d,path:f}=e,{gesture:p}=u,m=p!==void 0;if(c.slot.via===`prop`){o({screenId:d,path:f,patch:{[c.slot.name]:l},gesture:p},m);return}if(c.slot.via===`arg`){s({screenId:d,path:f,patch:{[c.slot.name]:l},gesture:p},m);return}let h=c.slot.key,g=[...(i.current?.key===r?i.current.slots:[]).filter(([e])=>e!==h),[h,typeof l==`boolean`?String(l):l]];i.current={key:r,slots:g};let _=t;for(let[e,t]of g)_=Vf(_,e,typeof t==`boolean`?String(t):t);h===`textAlign`&&l!==null&&n&&(_=Uf(_,n)),a({screenId:d,path:f,classes:_,gesture:p},m)},[e,r,t,n,a,o,s])}function tp(e){return t=>{t.key===`Enter`&&(t.metaKey||t.ctrlKey)&&(t.preventDefault(),e())}}function np({className:e,...t}){return(0,H.jsx)(`textarea`,{"data-slot":`textarea`,className:V(`flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...t})}var rp=[{id:`illustration`,label:`Illustration`,hint:`Spot art, empty states, editorial`},{id:`photo`,label:`Photo`,hint:`Realistic marketing, product, hero`},{id:`graphic`,label:`Graphic`,hint:`Layouts with legible text`},{id:`texture`,label:`Texture`,hint:`Backgrounds, gradients, patterns`},{id:`icon`,label:`Icon`,hint:`One pictogram, transparent`},{id:`vector`,label:`Vector (SVG)`,hint:`Illustrative logos and spot vectors`},{id:`mark`,label:`Mark (SVG)`,hint:`Flat geometric shapes — cheapest SVG`}],ip=[`1:1`,`4:3`,`3:4`,`16:9`,`9:16`,`3:2`,`2:3`];function ap(e,t){if(!e||!t)return;let n=e/t,r,i=1/0;for(let e of ip){let[t,a]=e.split(`:`).map(Number),o=Math.abs(n-t/a);o<i&&(i=o,r=e)}return r}var op={"1:1":`1/1`,"4:3":`4/3`,"3:4":`3/4`,"16:9":`16/9`},sp=Object.fromEntries(Object.entries(op).map(([e,t])=>[t,e]));function cp(e,t){return e?.aspect??sp[t??``]??ap(e?.width,e?.height)??`1:1`}function lp(e){return`$${(e/1e6).toFixed(2)}`}function up(e,t){let n=new Map,r=(e,t)=>{n.has(e)||n.set(e,new Set),n.has(t)||n.set(t,new Set),n.get(e)?.add(t),n.get(t)?.add(e)};for(let[t,n]of Object.entries(e))n.replaces&&r(t,n.replaces);let i=new Set([t]),a=[t];for(;a.length>0;){let e=a.shift();for(let t of n.get(e)??[])i.has(t)||(i.add(t),a.push(t))}return i.delete(t),[...i].sort((t,n)=>(e[n]?.generatedAt??``).localeCompare(e[t]?.generatedAt??``))}function dp(e){let t=Date.now()-new Date(e).getTime();if(!Number.isFinite(t)||t<0)return`just now`;let n=Math.round(t/6e4);if(n<1)return`just now`;if(n<60)return`${n}m ago`;let r=Math.round(n/60);return r<24?`${r}h ago`:`${Math.round(r/24)}d ago`}function fp({screenId:e,path:t,src:n,nodeAspect:r}){let i=B(e=>e.generatedAssets),a=B(e=>e.loadGeneratedAssets),o=ri(n),s=o?i[o]:void 0,[c,l]=(0,M.useState)(s?.prompt??``),[u,d]=(0,M.useState)(s?.intent??`illustration`),[f,p]=(0,M.useState)(()=>cp(s,r)),[m,h]=(0,M.useState)(!1),[g,_]=(0,M.useState)([]),[v,y]=(0,M.useState)(!1),b=(0,M.useRef)(o);(0,M.useEffect)(()=>{let e=o??``,t=e?i[e]:void 0;b.current===e?t&&c===``&&(l(t.prompt),d(t.intent),p(cp(t,r))):(b.current=e,l(t?.prompt??``),d(t?.intent??`illustration`),p(cp(t,r)),y(!1))},[o,i,c,r]),(0,M.useEffect)(()=>{let e=!0;return No().then(t=>e&&_(t)).catch(()=>void 0),()=>{e=!1}},[]);let x=e=>g.find(t=>t.intent===e)?.priceMicros,S=rp.filter(e=>g.length===0||x(e.id)!==void 0),C=rp.find(e=>e.id===u)?.label??u,w=u===`vector`||u===`mark`,T=async()=>{let n=c.trim();if(n&&!m){h(!0);try{let i=await Io({prompt:n,intent:u,...w?{}:{aspect:f},...o?{replaces:o}:{}}),s={src:i.url},c=!r||r in sp,l=op[ap(i.width,i.height)??``]??(w?void 0:op[f]);c&&l&&(s.aspect=l),b.current=i.assetPath,await I.updateProps({screenId:e,path:z(t),propPatch:s}),await a(),L({kind:`success`,title:`Image generated`,message:i.cost})}catch(e){R(e,`Could not generate the image`)}finally{h(!1)}}},E=async n=>{if(!m){h(!0);try{let a=i[n],o={src:`/${n}`},s=op[ap(a?.width,a?.height)??``];s&&(!r||r in sp)&&(o.aspect=s),b.current=n,l(a?.prompt??``),d(a?.intent??`illustration`),y(!1),await I.updateProps({screenId:e,path:z(t),propPatch:o})}catch(e){R(e,`Could not restore that version`)}finally{h(!1)}}},D=async e=>{if(!m){h(!0);try{await Po(e),await a(),L({kind:`success`,message:`Deleted ${e.replace(`assets/`,``)}.`})}catch(e){R(e,`Could not delete that image`)}finally{h(!1)}}};if(!o)return(0,H.jsxs)(`section`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(`div`,{className:`text-xs uppercase tracking-wider text-muted-foreground`,children:`Image`}),(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`This image isn't in the folder's `,(0,H.jsx)(`code`,{children:`assets/`}),` store, so it has no velloo provenance. Point `,(0,H.jsx)(`code`,{children:`src`}),` at an asset to generate a replacement.`]})]});let O=!s&&!v,k=up(i,o);return(0,H.jsxs)(`section`,{className:`flex flex-col gap-2`,"data-testid":`image-panel`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,H.jsx)(`div`,{className:`text-xs uppercase tracking-wider text-muted-foreground`,children:`Image`}),s?(0,H.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground`,"data-testid":`image-panel-badge`,children:`generated by velloo`}):(0,H.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground`,"data-testid":`image-panel-badge`,children:`not generated`})]}),O?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`velloo didn't generate this image, so there's no prompt to show.`}),(0,H.jsx)(W,{variant:`outline`,size:`sm`,className:`text-xs`,"data-testid":`image-panel-compose`,onClick:()=>y(!0),children:`Replace with a generated image`})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(G,{htmlFor:`image-prompt`,className:`text-xs font-medium text-muted-foreground`,children:`prompt`}),(0,H.jsx)(np,{id:`image-prompt`,"data-testid":`image-panel-prompt`,value:c,onChange:e=>l(e.target.value),rows:4,placeholder:`Describe subject, style, lighting and mood — these models reward detail.`,className:`min-h-0 text-xs`,onKeyDown:tp(()=>void T())}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex-1 flex flex-col gap-1.5`,children:[(0,H.jsx)(G,{htmlFor:`image-intent`,className:`text-xs font-medium text-muted-foreground`,children:`intent`}),(0,H.jsxs)(K,{value:u,onValueChange:d,children:[(0,H.jsx)(J,{id:`image-intent`,size:`sm`,className:`text-xs`,children:(0,H.jsx)(q,{children:C})}),(0,H.jsx)(Y,{children:S.map(e=>{let t=x(e.id);return(0,H.jsx)(X,{value:e.id,className:`[&>span:last-child]:flex-1`,children:(0,H.jsxs)(`span`,{className:`flex items-center justify-between gap-4`,children:[(0,H.jsx)(`span`,{children:e.label}),t===void 0?null:(0,H.jsx)(`span`,{className:`text-muted-foreground tabular-nums`,children:lp(t)})]})},e.id)})})]})]}),w?null:(0,H.jsxs)(`div`,{className:`w-24 flex flex-col gap-1.5`,children:[(0,H.jsx)(G,{htmlFor:`image-aspect`,className:`text-xs font-medium text-muted-foreground`,children:`aspect`}),(0,H.jsxs)(K,{value:f,onValueChange:p,children:[(0,H.jsx)(J,{id:`image-aspect`,size:`sm`,className:`text-xs`,children:(0,H.jsx)(q,{})}),(0,H.jsx)(Y,{children:ip.map(e=>(0,H.jsx)(X,{value:e,children:e},e))})]})]})]}),(0,H.jsx)(W,{size:`sm`,className:`text-xs`,"data-testid":`image-panel-generate`,disabled:m||c.trim().length===0,onClick:()=>void T(),children:m?`Generating…`:s?`Regenerate`:`Generate`}),(0,H.jsxs)(`p`,{className:`text-[10px] text-muted-foreground leading-relaxed`,children:[s?(0,H.jsxs)(H.Fragment,{children:[s.intent,` · ${dp(s.generatedAt)}`,s.width&&s.height?` · ${s.width}×${s.height}`:null,(0,H.jsx)(`br`,{})]}):null,`Charged against your velloo-cloud credits. Each run makes a new asset and repoints this node.`]})]}),k.length>0?(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5 pt-1`,"data-testid":`image-panel-history`,children:[(0,H.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground`,children:`Previous versions`}),k.map(e=>{let t=i[e];return(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,"data-testid":`image-panel-version`,"data-version":e,children:[(0,H.jsx)(`img`,{src:`/${e}`,alt:``,className:`size-8 shrink-0 rounded border object-cover`}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[10px] text-muted-foreground`,children:t?`${t.intent} · ${dp(t.generatedAt)}`:`original`}),(0,H.jsx)(W,{variant:`ghost`,size:`icon`,className:`size-6`,title:`Put this version back on the node`,"data-testid":`image-panel-restore`,disabled:m,onClick:()=>void E(e),children:(0,H.jsx)(tr,{className:`size-3`})}),(0,H.jsx)(W,{variant:`ghost`,size:`icon`,className:`size-6 text-muted-foreground hover:text-destructive`,title:`Delete this version for good`,"data-testid":`image-panel-delete`,disabled:m,onClick:()=>void D(e),children:(0,H.jsx)(xr,{className:`size-3`})})]},e)})]}):null]})}function pp({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return(0,H.jsx)(dt,{"data-slot":`separator`,decorative:n,orientation:t,className:V(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,e),...r})}function mp({delayDuration:e=0,...t}){return(0,H.jsx)(He,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function hp({...e}){return(0,H.jsx)(Oe,{"data-slot":`tooltip`,...e})}function gp({...e}){return(0,H.jsx)(Qe,{"data-slot":`tooltip-trigger`,...e})}function _p({className:e,sideOffset:t=0,children:n,...r}){return(0,H.jsx)(rt,{children:(0,H.jsxs)(Xe,{"data-slot":`tooltip-content`,sideOffset:t,className:V(`z-50 inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[n,(0,H.jsx)(st,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground`})]})})}var vp=C(`rgb`),yp=C(`hsv`);function bp({h:e,s:t,v:n}){return T(vp({mode:`hsv`,h:e,s:t,v:n}))??`#000000`}function xp(e){let t=b(e);if(!t)return null;let n=yp(t);return{h:n.h??0,s:n.s??0,v:n.v??0}}var Sp=160,Cp=Sp/2,wp=`conic-gradient(from 90deg, ${[0,60,120,180,240,300,360].map(e=>`hsl(${e} 100% 50%)`).join(`, `)})`;function Tp({value:e,onChange:t}){let n=(0,M.useRef)(null),r=(0,M.useCallback)((r,i)=>{let a=n.current?.getBoundingClientRect();if(!a)return;let o=r-(a.left+Cp),s=i-(a.top+Cp),c=(Math.atan2(s,o)*180/Math.PI+360)%360,l=Math.min(1,Math.hypot(o,s)/Cp);t({...e,h:c,s:l})},[t,e]),i=e.h*Math.PI/180,a=Cp+Math.cos(i)*e.s*Cp,o=Cp+Math.sin(i)*e.s*Cp,s=bp(e);return(0,H.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[(0,H.jsx)(`div`,{ref:n,role:`application`,"aria-label":`Hue and saturation`,className:`relative cursor-crosshair rounded-full border border-border/60`,style:{width:Sp,height:Sp,backgroundImage:`radial-gradient(circle at center, #fff 0%, rgba(255,255,255,0) 100%), ${wp}`},onPointerDown:e=>{e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),r(e.clientX,e.clientY)},onPointerMove:e=>{e.buttons!==0&&r(e.clientX,e.clientY)},children:(0,H.jsx)(`span`,{className:`pointer-events-none absolute size-3.5 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-white shadow-[0_0_0_1px_rgba(0,0,0,0.45)]`,style:{left:a,top:o,background:s}})}),(0,H.jsxs)(`label`,{className:`flex w-full items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`sr-only`,children:`Brightness`}),(0,H.jsx)(`input`,{type:`range`,min:0,max:1,step:.01,value:e.v,onChange:n=>t({...e,v:Number(n.target.value)}),className:`h-2 w-full cursor-pointer appearance-none rounded-full border border-border/60 [&::-webkit-slider-thumb]:size-3.5 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:border-2 [&::-webkit-slider-thumb]:border-white [&::-webkit-slider-thumb]:bg-transparent [&::-webkit-slider-thumb]:shadow-[0_0_0_1px_rgba(0,0,0,0.45)]`,style:{backgroundImage:`linear-gradient(to right, #000, ${bp({...e,v:1})})`}})]})]})}function Ep({hex:e,onChange:t}){let[n,r]=(0,M.useState)(e);return(0,M.useEffect)(()=>r(e),[e]),(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md border bg-background px-2`,children:[(0,H.jsx)(`span`,{className:`size-3.5 shrink-0 rounded-full border border-border/70`,style:{background:b(n)?n:e}}),(0,H.jsx)(`input`,{value:n,spellCheck:!1,"aria-label":`Hex`,className:`h-7 min-w-0 flex-1 bg-transparent font-mono text-xs uppercase outline-none`,onChange:n=>{let i=n.target.value;r(i);let a=b(i.startsWith(`#`)?i:`#${i}`);a&&t(T(vp(a))??e)}})]})}var Dp=`modulepreload`,Op=function(e){return`/`+e},kp={},Ap=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=Op(t,n),t=s(t),t in kp)return;kp[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:Dp,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},jp=null,Mp=null;function Np(e){let t=new Map;for(let[n,r]of Object.entries(e))typeof r==`object`&&r&&typeof r.displayName==`string`&&t.set(n,r);return t}function Pp(e,t){let n=t.trim();if(e&&n!==``)return e.get(n)??e.get(Mi(n))}function Fp(){return Mp??=Ap(()=>import(`./lucide-all-R8DUyY-B.js`).then(e=>(jp=Np(e),jp)),__vite__mapDeps([0,1])),Mp}function Ip(){let[e,t]=(0,M.useState)(jp);return(0,M.useEffect)(()=>{if(e)return;let n=!0;return Fp().then(e=>{n&&t(e)}),()=>{n=!1}},[e]),e}function Lp({...e}){return(0,H.jsx)(j,{"data-slot":`popover`,...e})}function Rp({...e}){return(0,H.jsx)(he,{"data-slot":`popover-trigger`,...e})}function zp({className:e,align:t=`center`,sideOffset:n=4,...r}){return(0,H.jsx)(pe,{children:(0,H.jsx)(We,{"data-slot":`popover-content`,align:t,sideOffset:n,className:V(`z-50 flex w-72 origin-(--radix-popover-content-transform-origin) flex-col gap-2.5 rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r})})}var Bp=80;function Vp({value:e,options:t,onChange:n}){let[r,i]=(0,M.useState)(!1),a=Pp(Ip(),e);return(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`div`,{className:`grid h-8 w-8 place-items-center rounded-md border bg-background text-foreground shrink-0`,children:a?(0,H.jsx)(a,{size:16,strokeWidth:2}):(0,H.jsx)(`span`,{className:`text-xs`,children:`?`})}),(0,H.jsxs)(Lp,{open:r,onOpenChange:i,children:[(0,H.jsx)(Rp,{asChild:!0,children:(0,H.jsx)(W,{variant:`outline`,size:`default`,className:`flex-1 justify-start font-normal`,children:e||(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`Pick an icon…`})})}),(0,H.jsx)(zp,{align:`end`,className:`w-72 p-0`,children:(0,H.jsx)(Hp,{value:e,options:t,onPick:e=>{n(e),i(!1)}})})]})]})}function Hp({value:e,options:t,onPick:n}){let[r,i]=(0,M.useState)(``),a=(0,M.useRef)(null),o=Ip();(0,M.useEffect)(()=>{let e=requestAnimationFrame(()=>a.current?.focus());return()=>cancelAnimationFrame(e)},[]);let s=(0,M.useMemo)(()=>{let e=r.trim().toLowerCase();return e?t.filter(t=>t.toLowerCase().includes(e)).slice(0,Bp):t.slice(0,Bp)},[t,r]);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Q,{ref:a,type:`text`,value:r,placeholder:`Search ${t.length} icons…`,onChange:e=>i(e.target.value),className:`rounded-b-none border-0 border-b shadow-none focus-visible:ring-0`}),(0,H.jsx)(`div`,{className:`grid max-h-64 grid-cols-8 gap-1 overflow-auto scroll-stable p-2`,children:s.length===0?(0,H.jsx)(`div`,{className:`col-span-8 px-2 py-4 text-center text-xs text-muted-foreground`,children:`No matches.`}):s.map(t=>{let r=Pp(o,t);return r?(0,H.jsx)(`button`,{type:`button`,title:t,onClick:()=>n(t),className:`grid h-7 w-7 place-items-center rounded-md transition-colors `+(t===e?`bg-primary text-primary-foreground`:`text-foreground hover:bg-muted`),children:(0,H.jsx)(r,{size:14,strokeWidth:2})},t):null})}),r&&s.length===Bp?(0,H.jsxs)(`div`,{className:`border-t px-3 py-1 text-[10px] text-muted-foreground`,children:[`Showing first `,Bp,`. Refine your search to see more.`]}):null]})}function Up({className:e,orientation:t=`horizontal`,...n}){return(0,H.jsx)(lt,{"data-slot":`tabs`,"data-orientation":t,className:V(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var Wp=u(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function Gp({className:e,variant:t=`default`,...n}){return(0,H.jsx)(Ke,{"data-slot":`tabs-list`,"data-variant":t,className:V(Wp({variant:t}),e),...n})}function Kp({className:e,...t}){return(0,H.jsx)(Ne,{"data-slot":`tabs-trigger`,className:V(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}var qp=u(`group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-transparent`,outline:`border border-input bg-transparent hover:bg-muted`},size:{default:`h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,sm:`h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`}},defaultVariants:{variant:`default`,size:`default`}}),Jp=M.createContext({size:`default`,variant:`default`,spacing:2,orientation:`horizontal`});function Yp({className:e,variant:t,size:n,spacing:r=2,orientation:i=`horizontal`,children:a,...o}){return(0,H.jsx)(at,{"data-slot":`toggle-group`,"data-variant":t,"data-size":n,"data-spacing":r,"data-orientation":i,style:{"--gap":r},className:V(`group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch`,e),...o,children:(0,H.jsx)(Jp.Provider,{value:{variant:t,size:n,spacing:r,orientation:i},children:a})})}function Xp({className:e,children:t,variant:n=`default`,size:r=`default`,...i}){let a=M.useContext(Jp);return(0,H.jsx)(je,{"data-slot":`toggle-group-item`,"data-variant":a.variant||n,"data-size":a.size||r,"data-spacing":a.spacing,className:V(`shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t`,qp({variant:a.variant||n,size:a.size||r}),e),...i,children:t})}var Zp=e=>e>0?{className:`shrink-0`,style:{width:e}}:{className:`min-w-0`};function Qp({label:e,origin:t,themeValue:n,source:r,width:i,note:a,onReset:o,children:s}){let c=t===`changed`,l=[c&&n!=null?`${r??`Theme`} sets ${n}`:t===`theme`&&r?`From ${r}`:null,a].filter(Boolean).join(` — `)||null,u=(0,H.jsx)(`span`,{className:`truncate ${c?`text-foreground font-medium`:`text-muted-foreground`}`,children:e}),d=Zp(i);return(0,H.jsxs)(`div`,{className:`flex flex-col gap-1 ${d.className}`,style:d.style,children:[(0,H.jsxs)(`div`,{className:`flex h-3.5 items-center gap-1 px-0.5 text-[10px] leading-none`,children:[c?(0,H.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-primary`}):null,a?(0,H.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`@`}):null,l?(0,H.jsxs)(hp,{children:[(0,H.jsx)(gp,{asChild:!0,children:u}),(0,H.jsx)(_p,{side:`top`,children:l})]}):u,c&&o?(0,H.jsx)(`button`,{type:`button`,"aria-label":`Reset ${e}`,title:l??`Reset ${e}`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,onClick:o,children:(0,H.jsx)(tr,{size:9})}):null]}),s]})}var $p=`h-7 w-full rounded-md border bg-background text-xs`,em=`—`;function tm({value:e,ghost:t,muted:n=!1,onChange:r,min:i,max:a,step:o=1,gear:s=3,suffix:c=`px`}){let[l,u]=(0,M.useState)(null),d=(0,M.useRef)(null),f=e=>{let t=e;return i!==void 0&&(t=Math.max(i,t)),a!==void 0&&(t=Math.min(a,t)),Math.round(t*1e3)/1e3},p=e=>{let t=Number.parseFloat(e);Number.isFinite(t)&&r(f(t)),u(null)},m=e??(typeof t==`number`?t:0);return(0,H.jsxs)(`div`,{className:`${$p} flex items-center overflow-hidden focus-within:ring-1 focus-within:ring-ring`,children:[(0,H.jsx)(`input`,{type:`text`,inputMode:`decimal`,value:l??(e===null?``:String(e)),placeholder:t==null?em:String(t),className:`min-w-0 flex-1 bg-transparent px-2 tabular-nums outline-none placeholder:text-muted-foreground/60 ${n?`text-muted-foreground`:``}`,onChange:e=>u(e.target.value),onBlur:e=>p(e.target.value),onKeyDown:e=>{if(e.key===`Enter`)p(e.target.value),e.target.blur();else if(e.key===`Escape`)u(null),e.target.blur();else if(e.key===`ArrowUp`||e.key===`ArrowDown`){e.preventDefault();let t=e.shiftKey?10:1,n=f(m+(e.key===`ArrowUp`?o:-o)*t);u(null),r(n)}}}),(0,H.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-label":`Drag to adjust`,className:`h-full shrink-0 cursor-ew-resize select-none border-l px-1.5 text-[9px] text-muted-foreground hover:bg-accent hover:text-foreground`,onPointerDown:e=>{e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),d.current={startX:e.clientX,startValue:m,gesture:`scrub-${e.pointerId}-${Date.now()}`}},onPointerMove:t=>{let n=d.current;if(!n)return;let i=Math.round((t.clientX-n.startX)/s);if(i===0)return;let a=f(n.startValue+i*o);a!==e&&r(a,{gesture:n.gesture})},onPointerUp:e=>{d.current=null,e.currentTarget.releasePointerCapture(e.pointerId)},children:c})]})}function nm({value:e,ghost:t,muted:n=!1,choices:r,onChange:i,placeholder:a}){return(0,H.jsxs)(K,{value:e??``,onValueChange:i,children:[(0,H.jsx)(J,{className:`${$p} min-h-0 px-2 [&>span]:truncate ${n||e===null?`text-muted-foreground`:``}`,children:(0,H.jsx)(q,{placeholder:t?rm(r,t):a??em})}),(0,H.jsx)(Y,{children:r.map(e=>(0,H.jsx)(X,{value:e.value,className:`text-xs`,children:e.label},e.value))})]})}function rm(e,t){return t?e.find(e=>e.value===t)?.label??t:em}function im({mode:e,px:t,measured:n,muted:r=!1,choices:i,onMode:a,onPx:o}){return(0,H.jsxs)(`div`,{className:`flex items-stretch gap-1`,children:[(0,H.jsx)(`div`,{className:`w-[70px] shrink-0`,children:(0,H.jsx)(nm,{value:e,muted:r,choices:i,onChange:a,placeholder:`Auto`})}),(0,H.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,H.jsx)(tm,{value:e===`fixed`?t:null,ghost:e===`fixed`?null:n??null,onChange:o,min:0,max:4096})})]})}function am({value:e,ghost:t,muted:n=!1,choices:r,onChange:i}){let a=e??t??null,o=n||e===null;return(0,H.jsx)(Yp,{type:`single`,value:a??``,onValueChange:e=>e&&i(e),className:`${$p} items-stretch p-0.5`,children:r.map(e=>(0,H.jsx)(Xp,{value:e.value,title:e.label,className:`h-auto min-w-0 flex-1 rounded-sm text-[10px] text-muted-foreground hover:bg-accent/50 `+(o?`data-[state=on]:bg-muted data-[state=on]:text-muted-foreground`:`data-[state=on]:bg-accent data-[state=on]:text-accent-foreground`),children:e.label.charAt(0)},e.value))})}var om=`#7c3aed`;function sm({value:e,ghost:t,muted:n=!1,choices:r,resolve:i,onChange:a}){let[o,s]=(0,M.useState)(!1),c=e??t??null,l=c?.startsWith(`[`)===!0,[u,d]=(0,M.useState)(`theme`),[f,p]=(0,M.useState)({h:265,s:.75,v:.9}),m=(0,M.useRef)(``);(0,M.useEffect)(()=>{if(!o)return;m.current=`color-${Date.now()}`,d(l?`custom`:`theme`);let e=xp(i(c)??om);e&&p(e)},[o,l,c,i]);let h=e=>{p(e),a(`[${bp(e)}]`,{gesture:m.current})};return(0,H.jsxs)(Lp,{open:o,onOpenChange:s,children:[(0,H.jsxs)(Rp,{className:`${$p} flex items-center gap-1.5 px-1.5 hover:bg-accent/50 ${n||e===null?`text-muted-foreground`:``}`,children:[(0,H.jsx)(lm,{css:i(c),unset:c===null}),(0,H.jsx)(`span`,{className:`truncate`,children:c?rm(r,c):em})]}),(0,H.jsxs)(zp,{align:`start`,className:`w-64 p-0`,children:[(0,H.jsx)(Up,{value:u,onValueChange:e=>d(e),children:(0,H.jsxs)(Gp,{className:`w-full rounded-none border-b bg-transparent p-1.5`,children:[(0,H.jsx)(Kp,{value:`theme`,className:`flex-1 text-xs capitalize`,children:`theme`}),(0,H.jsx)(Kp,{value:`custom`,className:`flex-1 text-xs capitalize`,children:`custom`})]})}),u===`theme`?(0,H.jsxs)(`div`,{className:`max-h-64 overflow-y-auto p-1`,children:[r.length===0?(0,H.jsx)(cl,{className:`p-3`,children:(0,H.jsx)(pl,{className:`text-xs`,children:`This theme declares no colours.`})}):null,r.map(e=>{let t=e.swatch??i(e.value);return(0,H.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-sm px-1.5 py-1 text-left text-xs hover:bg-accent/50 ${c===e.value?`bg-accent text-accent-foreground`:``}`,onClick:()=>{a(e.value),s(!1)},children:[(0,H.jsx)(lm,{css:t}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),(0,H.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-muted-foreground`,children:cm(t)})]},e.value)})]}):(0,H.jsxs)(`div`,{className:`flex flex-col gap-3 p-3`,children:[(0,H.jsx)(Tp,{value:f,onChange:h}),(0,H.jsx)(Ep,{hex:bp(f),onChange:e=>{let t=xp(e);t&&h(t)}})]})]})]})}function cm(e){return e?ud(e)?.hex.toUpperCase()??``:``}function lm({css:e,unset:t=!1}){return(0,H.jsx)(`span`,{className:`size-4 shrink-0 rounded-full border border-border/70`,style:e?{background:e}:t?void 0:{backgroundImage:`repeating-linear-gradient(45deg, var(--muted-foreground) 0 2px, transparent 2px 5px)`}})}function um({value:e,options:t,onChange:n}){let[r,i]=(0,M.useState)(!1),a=Pp(Ip(),e);return(0,H.jsxs)(Lp,{open:r,onOpenChange:i,children:[(0,H.jsxs)(Rp,{className:`${$p} flex items-center gap-1.5 px-1.5 hover:bg-accent/50 ${e?``:`text-muted-foreground`}`,children:[(0,H.jsx)(`span`,{className:`grid size-4 shrink-0 place-items-center`,children:a?(0,H.jsx)(a,{size:14,strokeWidth:2}):`—`}),(0,H.jsx)(`span`,{className:`truncate`,children:e?dm(e):`Pick an icon`})]}),(0,H.jsx)(zp,{align:`start`,className:`w-72 p-0`,children:(0,H.jsx)(Hp,{value:e,options:t,onPick:e=>{n(e),i(!1)}})})]})}function dm(e){let t=e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`);return t.charAt(0)+t.slice(1).toLowerCase()}function fm({value:e,onChange:t,placeholder:n}){let[r,i]=(0,M.useState)(null);return(0,H.jsx)(`input`,{type:`text`,value:r??e,placeholder:n,className:`${$p} px-2 outline-none focus:ring-1 focus:ring-ring`,onChange:e=>{i(e.target.value),t(e.target.value)},onBlur:()=>i(null)})}function pm({value:e,onChange:t}){return(0,H.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,className:`${$p} px-2 text-left ${e?``:`text-muted-foreground`}`,onClick:()=>t(!e),children:e?`On`:`Off`})}function mm({summary:e,onOpen:t}){return(0,H.jsx)(`button`,{type:`button`,className:`${$p} truncate px-2 text-left hover:bg-accent/50 ${e?``:`text-muted-foreground`}`,onClick:t,title:e??void 0,children:e??`Describe…`})}var hm=`__browse`,gm={heading:Cr,text:Kn,box:mr,image:dn,icon:ar,snippet:Yt,other:Yt};function _m(){let e=B(e=>e.selection),t=B(e=>e.cursorMode),n=B(e=>e.wsConnected),r=B(e=>e.screens),i=B(e=>e.theme),a=B(e=>e.styleChannel),o=B(e=>e.channelsByLibrary),s=B(e=>e.components),c=B(e=>e.design),l=B(e=>e.openSnippetEditor),u=B(e=>e.setBrowsingFaces),d=B(e=>e.setRightTab),f=B(e=>e.setRightPaneCollapsed),p=B(e=>e.setSnippetFocus),m=B(e=>e.snippetFocus),h=rd(),g=nd(),[_,v]=(0,M.useState)(!1),y=(0,M.useMemo)(()=>Dc(r,e),[r,e]),b=e?r[e.screenId]?.tree:void 0,x=(0,M.useMemo)(()=>!y||!s||!Ni(y)?null:s.find(e=>e.id===y.$ref)??null,[y,s]),S=(0,M.useMemo)(()=>!y||!Pi(y)?null:c?.snippets.find(e=>e.id===y.$snippet)??null,[y,c]),C=e?r[e.screenId]?.library:void 0,w=(C?o[C]:void 0)??a,T=w===null||w.kind===`tailwind-classname`,E=(0,M.useMemo)(()=>{if(!y)return null;let e=Xd({node:y,descriptor:x,snippet:S}),t=T?e.controls:e.controls.filter(e=>e.slot.via!==`style`);return{...e,controls:xd(t)}},[y,x,S,T]),D=(0,M.useMemo)(()=>!y||!e?{values:{}}:Jf({theme:i,tree:b,path:z(e.path),node:y}),[i,b,e,y]),O=B(e=>e.selectionComputed),k=(0,M.useMemo)(()=>bd(O),[O]),A=(0,M.useMemo)(()=>Nd(i),[i]),ee=(0,M.useCallback)(e=>Md(i,e),[i]),te=(0,M.useMemo)(()=>[...Pd(i),{value:hm,label:`Browse fonts…`}],[i]),ne=ep({selection:e,node:y,liveClasses:y?Ff(y):``}),re=(0,M.useCallback)((e,t,n)=>{if(t===hm){d(`node`),f(!1),u(!0);return}ne(e,t,n)},[ne,u,d,f]);if(t!==`select`)return null;if(m!==null&&(!e||!y||!E))return(0,H.jsx)(ym,{name:c?.snippets.find(e=>e.id===m)?.name??m,onDone:()=>p(null),children:(0,H.jsx)(`span`,{className:`self-center text-xs text-muted-foreground`,children:`Pick anything inside it — every instance changes together.`})});if(!e||!y||!E)return null;let ie=h[0]??null,ae=Pi(y)?y.$snippet:null,oe=gm[E.role],se=Zd(y),ce=Pi(y)?S?.name??y.$snippet:Ni(y)?y.$ref:`Param`,le=Ni(y)&&typeof y.props?.src==`string`?y.props.src:null,ue=e.screenId.startsWith(`snippet:`);return(0,H.jsxs)(mp,{delayDuration:300,children:[(0,H.jsxs)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-4 z-30 flex flex-col items-center gap-1.5 px-6`,children:[m===null?null:(0,H.jsx)(vm,{name:c?.snippets.find(e=>e.id===m)?.name??m,onDone:()=>p(null)}),(0,H.jsxs)(`div`,{className:`pointer-events-auto flex max-w-full items-stretch gap-2 rounded-xl border bg-card/95 p-2 shadow-xl backdrop-blur-sm ${E.role===`snippet`||ue?`border-violet-400/70`:``} ${n?``:`pointer-events-none opacity-50`}`,"data-velloo-hud":!0,children:[(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 self-center pr-1 pl-0.5`,children:[(0,H.jsx)(oe,{size:14,className:E.role===`snippet`?`text-violet-500`:`text-muted-foreground`}),(0,H.jsx)(`span`,{className:`max-w-[140px] truncate text-xs font-medium`,children:ce}),ue?(0,H.jsx)(U,{className:`bg-violet-500/15 px-1 py-0 text-[10px] text-violet-600 dark:text-violet-300`,children:`in snippet`}):null,se?(0,H.jsx)(U,{variant:`secondary`,className:`px-1 py-0 text-[10px]`,children:se}):null]}),(0,H.jsx)(pp,{orientation:`vertical`,className:`shrink-0 self-stretch`}),ae===null?null:(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 self-center`,children:[(0,H.jsx)(W,{size:`sm`,variant:`outline`,className:`h-7 text-xs`,onClick:()=>l(ae),children:`Edit snippet`}),(0,H.jsx)(W,{size:`sm`,variant:m===ae?`default`:`ghost`,className:`h-7 text-xs`,onClick:()=>p(m===ae?null:ae),title:`Edit this snippet in place — every instance updates together`,children:m===ae?`Done`:`Edit in place`}),E.controls.length>0?(0,H.jsx)(pp,{orientation:`vertical`,className:`self-stretch`}):null]}),(0,H.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2 overflow-x-auto`,children:[E.controls.map(e=>{let t=zf(e,{node:y,themeValues:D.values,themeSource:D.source,computed:k});return(0,H.jsx)(Qp,{label:e.label,origin:t.origin,themeValue:t.themeValue,source:t.source,width:e.width,note:D.notes?.[e.id],onReset:t.origin===`changed`?()=>re(e,null):void 0,children:(0,H.jsx)(bm,{spec:e,value:t,colors:A,resolveColor:ee,fonts:te,iconNames:g,measured:e.slot.via===`style`&&e.slot.key===`height`?ie?.h??null:ie?.w??null,onOpenPrompt:()=>v(!0),onChange:(t,n)=>re(e,t,n)})},e.id)}),E.controls.length===0?(0,H.jsx)(`button`,{type:`button`,className:`grid h-[42px] place-items-center px-3 text-xs text-muted-foreground underline-offset-2 hover:underline`,onClick:()=>{d(`node`),f(!1)},children:`Nothing to tune here — open the panel`}):null]})]})]}),(0,H.jsx)(Cl,{open:_,onOpenChange:v,children:(0,H.jsxs)(El,{className:`max-w-lg`,children:[(0,H.jsx)(Dl,{children:(0,H.jsx)(kl,{children:`Image`})}),le===null?null:(0,H.jsx)(fp,{screenId:e.screenId,path:e.path,src:le})]})})]})}function vm({name:e,onDone:t}){return(0,H.jsxs)(`div`,{className:`pointer-events-auto flex items-center gap-2 rounded-full border border-violet-400/70 bg-card/95 py-1 pr-1 pl-3 text-xs shadow-lg backdrop-blur-sm`,children:[(0,H.jsx)(Yt,{size:12,className:`text-violet-500`}),(0,H.jsxs)(`span`,{children:[`Editing `,(0,H.jsx)(`span`,{className:`font-medium`,children:e}),` — every instance updates together`]}),(0,H.jsx)(W,{size:`sm`,variant:`ghost`,className:`h-6 rounded-full px-2 text-xs`,onClick:t,children:`Done`})]})}function ym({name:e,onDone:t,children:n}){return(0,H.jsxs)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-4 z-30 flex flex-col items-center gap-1.5 px-6`,children:[(0,H.jsx)(vm,{name:e,onDone:t}),(0,H.jsx)(`div`,{className:`pointer-events-auto flex items-stretch gap-2 rounded-xl border border-violet-400/70 bg-card/95 px-3 py-2 shadow-xl backdrop-blur-sm`,"data-velloo-hud":!0,onPointerDown:e=>e.stopPropagation(),children:n})]})}function bm({spec:e,value:t,colors:n,resolveColor:r,fonts:i,iconNames:a,measured:o,onOpenPrompt:s,onChange:c}){let l=t.value===null?null:String(t.value),u=typeof t.value==`number`?t.value:null,d=t.themeValue??t.computed??null,f=d===null?null:String(d),p=!t.authored;switch(e.kind){case`number`:return(0,H.jsx)(tm,{value:u,ghost:d,muted:p,onChange:c,min:e.min,max:e.max,step:e.step??1});case`ratio`:return(0,H.jsx)(tm,{value:u,ghost:d,muted:p,onChange:c,min:e.min,max:e.max,step:e.step??.05,gear:8,suffix:`×`});case`size`:{let t=Nf(l??void 0);return(0,H.jsx)(im,{mode:t,px:Pf(l??void 0),measured:o===null?null:Math.round(o),muted:p,choices:e.choices??[],onMode:e=>c(e===`fixed`?`[${Math.round(o??100)}px]`:e),onPx:(e,t)=>c(`[${e}px]`,t)})}case`choice`:return(0,H.jsx)(nm,{value:l,ghost:f,muted:p,choices:e.choices??[],onChange:c});case`align`:return(0,H.jsx)(am,{value:l,ghost:f,muted:p,choices:e.choices??[],onChange:c});case`color`:return(0,H.jsx)(sm,{value:l,ghost:f,muted:p,choices:n,resolve:r,onChange:c});case`font`:return(0,H.jsx)(nm,{value:l,ghost:f,muted:p,choices:i,onChange:c});case`icon`:return(0,H.jsx)(um,{value:l??``,options:a,onChange:c});case`text`:return(0,H.jsx)(fm,{value:l??``,onChange:c});case`toggle`:return(0,H.jsx)(pm,{value:t.value===!0,onChange:c});case`prompt`:return(0,H.jsx)(mm,{summary:l,onOpen:s})}}var xm=[{id:`nw`,x:0,y:0,cursor:`nwse-resize`,sx:-1,sy:-1},{id:`n`,x:.5,y:0,cursor:`ns-resize`,sx:0,sy:-1},{id:`ne`,x:1,y:0,cursor:`nesw-resize`,sx:1,sy:-1},{id:`e`,x:1,y:.5,cursor:`ew-resize`,sx:1,sy:0},{id:`se`,x:1,y:1,cursor:`nwse-resize`,sx:1,sy:1},{id:`s`,x:.5,y:1,cursor:`ns-resize`,sx:0,sy:1},{id:`sw`,x:0,y:1,cursor:`nesw-resize`,sx:-1,sy:1},{id:`w`,x:0,y:.5,cursor:`ew-resize`,sx:-1,sy:0}],Sm=7,Cm=90;function wm(){let e=rd(),t=B(e=>e.selection),n=B(e=>e.screens),r=B(e=>e.canvasZoom),i=B(e=>e.cursorMode),a=B(e=>e.wsConnected),o=t?Dc(n,t):null,s=(0,M.useRef)(null),[c,l]=(0,M.useState)(null),u=(0,M.useRef)([]),d=Qf(Cm,e=>{I.applyClasses({screenId:e.screenId,path:z(e.path),classes:e.classes,gesture:e.gesture}).catch(e=>R(e,`Could not resize`))}),f=(0,M.useRef)(()=>{});if(f.current=(e,n,r)=>{if(!t||!o)return;let i=Ff(o);e.sx!==0&&(i=Vf(i,`width`,`[${Math.round(n)}px]`)),e.sy!==0&&(i=Vf(i,`height`,`[${Math.round(r)}px]`)),d({screenId:t.screenId,path:t.path,classes:i,gesture:e.gesture},!0)},(0,M.useEffect)(()=>{let e=e=>{let t=s.current;if(!t)return;let n=(e.clientX-t.startX)/t.zoom*t.sx,r=(e.clientY-t.startY)/t.zoom*t.sy,i={w:Math.max(8,t.startW+n),h:Math.max(8,t.startH+r)};l(i),f.current(t,i.w,i.h)},t=()=>{let e=s.current;e&&(s.current=null,l(t=>(t&&f.current(e,t.w,t.h),null)))};return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,t),window.addEventListener(`pointercancel`,t),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,t),window.removeEventListener(`pointercancel`,t)}},[]),!t||!o||i!==`select`||!a)return null;e.length>0&&s.current===null&&(u.current=e);let p=s.current!==null||c!==null?u.current:e;if(p.length===0)return null;let m=`$snippet`in o?Hl:Vl,h=1/r;return(0,H.jsx)(`div`,{className:`pointer-events-none absolute inset-0`,"data-velloo-selection-layer":!0,children:p.map(e=>{let t=c&&e.anchor?c.w:e.w,n=c&&e.anchor?c.h:e.h;return(0,H.jsx)(`div`,{className:`absolute overflow-hidden`,style:{left:e.clip.x,top:e.clip.y,width:e.clip.w,height:e.clip.h},children:(0,H.jsxs)(`div`,{className:`absolute`,style:{left:e.x-e.clip.x,top:e.y-e.clip.y,width:t,height:n},children:[(0,H.jsx)(`div`,{className:`absolute inset-0`,"data-velloo-selection-box":!0,style:{outline:`${2*h}px solid ${m}`,outlineOffset:-2*h}}),c&&e.anchor?(0,H.jsxs)(`div`,{className:`absolute left-1/2 whitespace-nowrap rounded px-1.5 py-0.5 text-white tabular-nums`,style:{top:n+6*h,fontSize:10*h,background:m,transform:`translateX(-50%)`},children:[Math.round(c.w),` × `,Math.round(c.h)]}):null,e.anchor?xm.map(i=>(0,H.jsx)(`button`,{type:`button`,"aria-label":`Resize ${i.id}`,className:`pointer-events-auto absolute rounded-none`,style:{left:i.x*t,top:i.y*n,width:Sm*h,height:Sm*h,marginLeft:-7/2*h,marginTop:-7/2*h,background:m,cursor:i.cursor},onPointerDown:t=>{t.preventDefault(),t.stopPropagation(),t.currentTarget.setPointerCapture(t.pointerId),s.current={startX:t.clientX,startY:t.clientY,startW:e.w,startH:e.h,sx:i.sx,sy:i.sy,zoom:r,gesture:`resize-${t.pointerId}-${Date.now()}`},l({w:e.w,h:e.h})}},i.id)):null]})},e.key)})})}var Tm={x:0,y:20},Em=60;function Dm(e,t,n,r){let i=e.map((e,i)=>{let a=e.resolved===null?null:e.resolved.join(`.`),o=a===null?null:r?.[a]??null;if(o&&e.position===`auto`){let r={x:t.x+n.x+o.x,y:t.y+n.y+o.y,w:o.w,h:o.h};return{annotation:e,nodeRect:r,card:{x:t.x+t.w+24,y:Math.max(t.y,r.y+r.h/2-Em/2)}}}return typeof e.position==`object`?{annotation:e,nodeRect:o?{x:t.x+n.x+o.x,y:t.y+n.y+o.y,w:o.w,h:o.h}:null,card:{x:e.position.x,y:e.position.y}}:{annotation:e,nodeRect:null,card:{x:t.x+t.w+24,y:t.y+24+i*76}}});i.sort((e,t)=>e.card.y-t.card.y);let a=-1/0;for(let e of i)e.card.y<a+8&&(e.card.y=a+8),a=e.card.y+Em;return i}function Om(e){let t=e.filter(e=>e.nodeRect!==null);if(t.length===0)return null;let n=1/0,r=1/0,i=-1/0,a=-1/0;for(let e of t){let t=e.nodeRect.x+e.nodeRect.w,o=e.nodeRect.y+e.nodeRect.h/2,s=e.card.x,c=e.card.y+Em/2;n=Math.min(n,t,s),r=Math.min(r,o,c),i=Math.max(i,t,s),a=Math.max(a,o,c)}n-=8,r-=8,i+=8,a+=8;let o=t.map(e=>{let t=e.nodeRect.x+e.nodeRect.w-n,i=e.nodeRect.y+e.nodeRect.h/2-r,a=e.card.x-n,o=e.card.y+Em/2-r,s=(t+a)/2,c=`M ${t} ${i} Q ${s} ${i} ${s} ${(i+o)/2} T ${a} ${o}`;return{id:e.annotation.id,path:c,dot:{x:t,y:i}}});return{box:{x:n,y:r,w:Math.max(1,i-n),h:Math.max(1,a-r)},lines:o}}function km(e,t,n,r){let i=[],a=new Map;for(let n of e){let e=n.attachment?.frameId;if(!e||!t.some(t=>t.id===e)){i.push({note:n,card:{x:n.x??0,y:n.y??0}});continue}let r=a.get(e)??[];r.push(n),a.set(e,r)}let o=[];for(let[e,i]of a){let a=t.find(t=>t.id===e);a&&o.push({frameId:e,placed:Dm(i.map(Am),a,r[e]??Tm,n[e])})}return{free:i,sections:o}}function Am(e){return{id:e.id,position:e.x!==void 0&&e.y!==void 0?{x:e.x,y:e.y}:`auto`,resolved:e.resolved??null,note:e}}function jm(e){return e.attachment!==void 0&&e.resolved===null}function Mm({body:e}){let t=Nm(e);return(0,H.jsx)(H.Fragment,{children:t.map((e,t)=>(0,H.jsx)(M.Fragment,{children:Pm(e,t)},t))})}function Nm(e){let t=[],n=e.split(`
26
+ `),r=[],i=()=>{let e=r.join(`
27
+ `).trim();e&&t.push({kind:`p`,text:e}),r=[]};for(let e of n)/^### /.test(e)?(i(),t.push({kind:`h3`,text:e.slice(4).trim()})):/^## /.test(e)?(i(),t.push({kind:`h2`,text:e.slice(3).trim()})):/^# /.test(e)?(i(),t.push({kind:`h1`,text:e.slice(2).trim()})):e.trim()===``?i():r.push(e);return i(),t}function Pm(e,t){let n=Fm(e.text);switch(e.kind){case`h1`:return(0,H.jsx)(`h1`,{className:`text-lg font-bold tracking-tight leading-tight`,children:n},t);case`h2`:return(0,H.jsx)(`h2`,{className:`text-base font-semibold tracking-tight leading-snug`,children:n},t);case`h3`:return(0,H.jsx)(`h3`,{className:`text-sm font-semibold uppercase tracking-wider leading-snug`,children:n},t);case`p`:return(0,H.jsx)(`p`,{className:`text-sm leading-snug`,children:n},t)}}function Fm(e){let t=e.split(`
28
+ `),n=[];for(let e=0;e<t.length;e++){let r=t[e]??``;n.push((0,H.jsx)(M.Fragment,{children:Im(r)},`l${e}`)),e<t.length-1&&n.push((0,H.jsx)(`br`,{},`br${e}`))}return n}function Im(e){let t=[],n=0,r=``,i=0,a=()=>{r&&=(t.push((0,H.jsx)(M.Fragment,{children:r},`t${i++}`)),``)};for(;n<e.length;){if(e[n]===`*`&&e[n+1]===`*`){let r=e.indexOf(`**`,n+2);if(r!==-1){a(),t.push((0,H.jsx)(`strong`,{className:`font-semibold`,children:e.slice(n+2,r)},`b${i++}`)),n=r+2;continue}}if(e[n]===`*`){let r=e.indexOf(`*`,n+1);if(r!==-1&&r>n+1){a(),t.push((0,H.jsx)(`em`,{className:`italic`,children:e.slice(n+1,r)},`i${i++}`)),n=r+1;continue}}r+=e[n],n++}return a(),t}function Lm(){let e=B(e=>e.notes),t=B(e=>e.markupVisible),n=B(e=>e.currentBoardId),r=B(e=>n?e.boards[n]:null),i=B(e=>e.nodeRects),a=B(e=>e.frameInsets);if(!t||e.length===0)return null;let{free:o,sections:s}=km(e,r?.frames??[],i,a);return(0,H.jsxs)(H.Fragment,{children:[o.map(({note:e,card:t})=>(0,H.jsx)(zm,{note:e,pos:t},e.id)),s.map(({frameId:e,placed:t})=>(0,H.jsxs)(M.Fragment,{children:[(0,H.jsx)(Rm,{placed:t}),t.map(e=>(0,H.jsx)(zm,{note:e.annotation.note,pos:e.card},e.annotation.id))]},e))]})}function Rm({placed:e}){let t=Om(e);if(!t)return null;let{box:n,lines:r}=t;return(0,H.jsxs)(`svg`,{className:`absolute pointer-events-none text-amber-500/70`,style:{left:n.x,top:n.y,width:n.w,height:n.h},width:n.w,height:n.h,"aria-hidden":`true`,children:[(0,H.jsx)(`title`,{children:`Note connectors`}),r.map(e=>(0,H.jsxs)(`g`,{children:[(0,H.jsx)(`path`,{d:e.path,fill:`none`,stroke:`currentColor`,strokeWidth:1,strokeDasharray:`3 3`}),(0,H.jsx)(`circle`,{cx:e.dot.x,cy:e.dot.y,r:3,fill:`currentColor`})]},e.id))]})}function zm({note:e,pos:t}){let n=B(e=>e.editingMarkupId),r=B(e=>e.setEditingMarkupId),i=B(e=>e.currentBoardId),a=n===e.id,[o,s]=(0,M.useState)(e.body),c=(0,M.useRef)(!1),l=(0,M.useRef)(null),u=(0,M.useRef)(null),d=jm(e);(0,M.useEffect)(()=>{s(e.body),c.current=!1},[e.body]);let f=async t=>{if(i)try{await ls.update({boardId:i,noteId:e.id,patch:t})}catch(e){R(e,`Could not update note`)}},p=e=>{if(a||e.button!==0)return;e.stopPropagation(),e.currentTarget.setPointerCapture(e.pointerId);let n=B.getState().canvasZoom||1;u.current={ox:t.x,oy:t.y,sx:e.clientX/n,sy:e.clientY/n}},m=e=>{let t=u.current;if(!t)return;let n=B.getState().canvasZoom||1,r=e.clientX/n-t.sx,i=e.clientY/n-t.sy;e.currentTarget.style.left=`${t.ox+r}px`,e.currentTarget.style.top=`${t.oy+i}px`},h=async e=>{let t=u.current;if(!t)return;e.currentTarget.releasePointerCapture(e.pointerId),u.current=null;let n=B.getState().canvasZoom||1,r=e.clientX/n-t.sx,i=e.clientY/n-t.sy;Math.abs(r)<1&&Math.abs(i)<1||await f({x:t.ox+r,y:t.oy+i})},g=async()=>{if(i){B.getState().editingMarkupId===e.id&&r(null);try{await ls.remove({boardId:i,noteId:e.id})}catch(e){R(e,`Could not remove note`)}}},_=async()=>{if(!c.current){if(c.current=!0,B.getState().editingMarkupId===e.id&&r(null),!o.trim()){await g();return}o!==e.body&&await f({body:o})}},v=()=>{c.current||(c.current=!0,s(e.body),r(null),e.body.trim()||g())};return(0,H.jsx)(`div`,{className:`absolute select-none rounded-md px-3 py-2 bg-amber-100 border shadow-sm group/note text-amber-950 dark:text-amber-950 `+(d?`border-dashed border-amber-400 opacity-70 `:`border-amber-300 `)+(a?`ring-2 ring-amber-500`:``),style:{left:t.x,top:t.y,width:e.width},"data-note-id":e.id,"data-note-attached":e.attachment?`true`:void 0,onPointerDown:p,onPointerMove:m,onPointerUp:h,onPointerCancel:h,onDoubleClick:t=>{t.stopPropagation(),c.current=!1,r(e.id)},onKeyDown:t=>{a||(t.key===`Delete`||t.key===`Backspace`?(t.preventDefault(),g()):t.key===`Enter`&&(c.current=!1,r(e.id)))},tabIndex:0,children:a?(0,H.jsx)(`textarea`,{autoFocus:!0,className:`w-full min-h-[3rem] bg-transparent text-sm leading-snug outline-none resize-none font-mono`,value:o,onChange:e=>s(e.target.value),onBlur:()=>{requestAnimationFrame(()=>{l.current&&document.activeElement===l.current||_()})},onKeyDown:e=>{e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),v()):e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),_())},ref:e=>{l.current=e,e&&(e.style.height=`auto`,e.style.height=`${e.scrollHeight}px`)},style:{height:`auto`}}):(0,H.jsxs)(`div`,{className:`text-sm leading-snug`,children:[e.body?(0,H.jsx)(Mm,{body:e.body}):(0,H.jsx)(`span`,{className:`opacity-50`,children:`(empty note — double-click to edit)`}),d?(0,H.jsx)(`div`,{className:`mt-1 text-[11px] uppercase tracking-wide opacity-60`,children:`target removed`}):null]})})}var Bm=`Local comments stay on this machine. Cloud comments live on the published board, where reviewers can see and answer them.`;function Vm({scope:e,onChange:t}){return(0,H.jsxs)(Yp,{type:`single`,size:`sm`,variant:`outline`,value:e,onValueChange:e=>e&&t(e),className:`w-full`,"aria-label":`Comment scope`,children:[(0,H.jsx)(Xp,{value:`all`,className:`text-[11px]`,children:`All`}),(0,H.jsxs)(Xp,{value:`local`,className:`text-[11px]`,children:[(0,H.jsx)(On,{}),` Local`]}),(0,H.jsxs)(Xp,{value:`shared`,className:`text-[11px]`,children:[(0,H.jsx)(qt,{}),` Cloud`]})]})}function Hm({scope:e,onChange:t,cloud:n,className:r=``}){let i=B(e=>e.openSignIn),a=n===void 0,o=n?.available===!1?n.reason:null,s=o===`unpublished`,c=!!o&&!s;return(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5 ${r}`,"data-comment-target-picker":!0,children:[(0,H.jsxs)(Yp,{type:`single`,size:`sm`,variant:`outline`,spacing:0,value:e,onValueChange:e=>e&&t(e),className:`w-full`,"aria-label":`Comment target`,children:[(0,H.jsxs)(Xp,{value:`local`,className:`flex-1 text-xs`,title:Bm,children:[(0,H.jsx)(On,{}),` Local`]}),(0,H.jsxs)(Xp,{value:`shared`,className:`flex-1 text-xs`,disabled:a||c,title:o&&!s?Qo(o):s?`This board has no published link yet — posting will publish it first.`:n?.available?`Post to the published board at ${n.url}`:`Checking this board's published link…`,children:[(0,H.jsx)(qt,{}),` Cloud`,s?(0,H.jsx)(Sr,{className:`text-amber-600 dark:text-amber-500`,"data-needs-publish":!0}):null]})]}),e===`shared`&&s?(0,H.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`This board isn't published yet. Posting opens the publish flow first.`}):null,o&&Zo(o)?(0,H.jsx)(W,{variant:`ghost`,size:`sm`,className:`self-start text-[11px]`,onClick:()=>i({action:`post comments to the published board`,expired:o===`expired`}),children:`Sign in to write cloud comments`}):null]})}var Um=u(`group/bubble relative flex w-fit max-w-[80%] min-w-0 flex-col gap-1 group-data-[align=end]/message:self-end data-[align=end]:self-end data-[variant=ghost]:max-w-full`,{variants:{variant:{default:`*:data-[slot=bubble-content]:bg-primary *:data-[slot=bubble-content]:text-primary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-primary/80`,secondary:`*:data-[slot=bubble-content]:bg-secondary *:data-[slot=bubble-content]:text-secondary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)]`,muted:`*:data-[slot=bubble-content]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--muted),var(--foreground)_5%)]`,tinted:`*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.93_calc(c*0.4)_h)] *:data-[slot=bubble-content]:text-foreground dark:*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.3_calc(c*0.4)_h)] [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.88_calc(c*0.5)_h)] dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.35_calc(c*0.5)_h)]`,outline:`*:data-[slot=bubble-content]:border-border *:data-[slot=bubble-content]:bg-background [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-input/30`,ghost:`border-none *:data-[slot=bubble-content]:rounded-none *:data-[slot=bubble-content]:bg-transparent *:data-[slot=bubble-content]:p-0 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted/50`,destructive:`*:data-[slot=bubble-content]:bg-destructive/10 *:data-[slot=bubble-content]:text-destructive dark:*:data-[slot=bubble-content]:bg-destructive/20 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/20 dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/30`}},defaultVariants:{variant:`default`}});function Wm({variant:e=`default`,align:t=`start`,className:n,...r}){return(0,H.jsx)(`div`,{"data-slot":`bubble`,"data-variant":e,"data-align":t,className:V(Um({variant:e}),n),...r})}function Gm({asChild:e=!1,className:t,...n}){let r=e?gt:`div`;return(0,H.jsx)(r,{"data-slot":`bubble-content`,className:V(`w-fit max-w-full min-w-0 overflow-hidden rounded-xl border border-transparent px-3 py-2 text-sm leading-relaxed wrap-break-word group-data-[align=end]/bubble:self-end [button]:text-left [button,a]:transition-colors [button,a]:outline-none [button,a]:focus-visible:border-ring [button,a]:focus-visible:ring-3 [button,a]:focus-visible:ring-ring/50`,t),...n})}u(`absolute z-10 flex w-fit shrink-0 items-center justify-center gap-1 rounded-full bg-muted px-1.5 py-0.5 text-sm ring-3 ring-card has-[button]:p-0`,{variants:{side:{top:`top-0 -translate-y-3/4`,bottom:`bottom-0 translate-y-3/4`},align:{start:`left-3`,end:`right-3`}},defaultVariants:{side:`bottom`,align:`end`}});function Km({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`input-group`,role:`group`,className:V(`group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5`,e),...t})}var qm=u(`flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4`,{variants:{align:{"inline-start":`order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]`,"inline-end":`order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]`,"block-start":`order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2`,"block-end":`order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2`}},defaultVariants:{align:`inline-start`}});function Jm({className:e,align:t=`inline-start`,...n}){return(0,H.jsx)(`div`,{role:`group`,"data-slot":`input-group-addon`,"data-align":t,className:V(qm({align:t}),e),onClick:e=>{e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()},...n})}var Ym=u(`flex items-center gap-2 text-sm shadow-none`,{variants:{size:{xs:`h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5`,sm:``,"icon-xs":`size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0`,"icon-sm":`size-8 p-0 has-[>svg]:p-0`}},defaultVariants:{size:`xs`}});function Xm({className:e,type:t=`button`,variant:n=`ghost`,size:r=`xs`,...i}){return(0,H.jsx)(W,{type:t,"data-size":r,variant:n,className:V(Ym({size:r}),e),...i})}function Zm({className:e,...t}){return(0,H.jsx)(Q,{"data-slot":`input-group-control`,className:V(`flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent`,e),...t})}function Qm({className:e,...t}){return(0,H.jsx)(np,{"data-slot":`input-group-control`,className:V(`flex-1 resize-none rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent`,e),...t})}function $m({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`message-group`,className:V(`flex min-w-0 flex-col gap-2`,e),...t})}function eh({className:e,align:t=`start`,...n}){return(0,H.jsx)(`div`,{"data-slot":`message`,"data-align":t,className:V(`group/message relative flex w-full min-w-0 gap-2 text-sm data-[align=end]:flex-row-reverse`,e),...n})}function th({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`message-content`,className:V(`flex w-full min-w-0 flex-col gap-2.5 wrap-break-word group-data-[align=end]/message:*:data-slot:self-end`,e),...t})}function nh({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`message-header`,className:V(`flex max-w-full min-w-0 items-center px-3 text-xs font-medium text-muted-foreground group-has-data-[variant=ghost]/message:px-0`,e),...t})}function rh({className:e,size:t=`default`,...n}){return(0,H.jsxs)(`div`,{className:V(`group/native-select relative w-fit has-[select:disabled]:opacity-50`,e),"data-slot":`native-select-wrapper`,"data-size":t,children:[(0,H.jsx)(`select`,{"data-slot":`native-select`,"data-size":t,className:`h-8 w-full min-w-0 appearance-none rounded-lg border border-input bg-transparent py-1 pr-8 pl-2.5 text-sm transition-colors outline-none select-none selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-[size=sm]:py-0.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,...n}),(0,H.jsx)(Vt,{className:`pointer-events-none absolute top-1/2 right-2.5 size-4 -translate-y-1/2 text-muted-foreground select-none`,"aria-hidden":`true`,"data-slot":`native-select-icon`})]})}function ih({className:e,...t}){return(0,H.jsx)(`option`,{"data-slot":`native-select-option`,className:V(`bg-[Canvas] text-[CanvasText]`,e),...t})}function ah(e,t){let n=Math.max(0,Math.round((t-new Date(e).getTime())/6e4));return n<1?`now`:n<60?`${n}m`:n<1440?`${Math.floor(n/60)}h`:`${Math.floor(n/1440)}d`}var oh=3e4;function sh({iso:e,className:t}){let[n,r]=(0,M.useState)(()=>Date.now());return(0,M.useEffect)(()=>{let e=setInterval(()=>r(Date.now()),oh);return()=>clearInterval(e)},[]),(0,H.jsx)(`time`,{dateTime:e,className:t,children:ah(e,n)})}var ch={user:`You`,agent:`Agent`,reviewer:`Reviewer`},lh={owner:`Admin`,admin:`Admin`,member:`Member`,reviewer:`Reviewer`,guest:`Guest`};function uh(e){return lh[e]}function dh(e){if(e.kind!==`agent`){if(e.publisher??(e.kind===`user`&&e.displayName!==void 0))return`publisher`;if(e.role===`guest`)return`guest`}}var fh={publisher:{label:`Publisher`,Icon:Kt},guest:{label:`Guest`,Icon:Dr}};function ph(e,t){return!t||!e.accountId?`unknown`:e.accountId===t?`mine`:`theirs`}function mh(e){return t=>{let{author:n}=t;if(n.kind===`agent`)return{align:`start`,variant:`muted`,name:ch.agent};let r={role:n.role?uh(n.role):void 0,marker:dh(n)},i=ph(n,e);return i===`mine`||i===`unknown`&&n.kind===`user`?{align:`end`,variant:`default`,name:ch.user,...r}:{align:`start`,variant:`outline`,...r}}}function hh(e){return t=>{let n=ph(t.author,e);return n===`unknown`?t.author.kind!==`reviewer`:n===`mine`}}var gh=mh(void 0),_h=hh(void 0),vh=`Comment deleted`;function yh({messages:e,onDelete:t,voice:n=gh,canDelete:r=_h}){return(0,H.jsx)($m,{className:`mt-2 gap-3`,children:e.map(e=>{let i=e.deletedAt!==void 0,a=t&&!i&&r(e),{align:o,variant:s,badge:c,name:l,role:u,marker:d}=n(e),f=d?fh[d]:void 0;return(0,H.jsx)(eh,{align:o,children:(0,H.jsxs)(th,{className:`gap-1`,children:[(0,H.jsxs)(nh,{className:`gap-1.5 px-3`,children:[(0,H.jsx)(`span`,{title:u,className:`truncate`,children:l??e.author.displayName??ch[e.author.kind]}),f?(0,H.jsx)(f.Icon,{size:11,role:`img`,"aria-label":f.label,className:`-ml-0.5 shrink-0 text-muted-foreground`,"data-author-marker":d,children:(0,H.jsx)(`title`,{children:f.label})}):null,c?(0,H.jsx)(U,{variant:`outline`,className:`px-1 py-0 text-[9px] uppercase`,children:c}):null,(0,H.jsx)(sh,{iso:e.createdAt,className:`ml-auto font-normal`}),a?(0,H.jsx)(`button`,{type:`button`,className:`-mr-1 rounded p-0.5 opacity-0 transition-opacity hover:text-destructive focus-visible:opacity-100 group-hover/message:opacity-100`,title:`Delete this comment`,"aria-label":`Delete this comment`,onClick:()=>t(e.id),children:(0,H.jsx)(xr,{size:11})}):null]}),i?(0,H.jsx)(Wm,{variant:`ghost`,children:(0,H.jsx)(Gm,{className:`text-xs italic text-muted-foreground`,children:vh})}):(0,H.jsx)(Wm,{variant:s,children:(0,H.jsx)(Gm,{className:`whitespace-pre-wrap`,children:e.body})})]})},e.id)})})}function bh(e){return e.messages.find(e=>!e.deletedAt)?.body??vh}function xh(e,t){return t.kind===`thread`?e.anchor?`The conversation and its pin go, for good.`:`The conversation goes, for good.`:e.scope===`shared`?`Anyone who has already read it will see that something was here, but not what it said.`:e.messages.length===1?`It's the only comment on this thread, so the thread goes with it.`:`It goes for good. The rest of the thread stays.`}function Sh(e){return e.anchor?e.anchor.kind===`node`?`Pinned comment`:`Board pin`:`Board-wide`}function Ch({thread:e,number:t,showScope:n}){let r=e.anchorState.status===`stale`?`border-destructive/40 bg-destructive/10 text-destructive group-hover/thread:bg-destructive group-hover/thread:text-destructive-foreground`:`border-primary/30 bg-primary/10 text-primary group-hover/thread:bg-primary group-hover/thread:text-primary-foreground`;return(0,H.jsxs)(`span`,{"aria-hidden":!0,className:`flex h-6 shrink-0 items-center gap-0.5 border px-1.5 text-[11px] font-semibold tabular-nums transition-colors ${e.anchor?`rounded-full ${r}`:`rounded-md border-dashed border-border bg-muted text-muted-foreground`}`,children:[e.anchor?n&&e.scope===`shared`?(0,H.jsx)(qt,{size:9}):(0,H.jsx)(On,{size:9}):null,t]})}function wh(){return(0,H.jsx)(`span`,{"aria-hidden":!0,className:`text-border`,children:`•`})}function Th({thread:e,number:t,onOpen:n,onLocate:r,onDelete:i,showScope:a=!0}){let o=e.scope===`shared`,s=e.anchorState.status===`stale`,c=e.messages.length-1,l=+!!e.anchor+ +!!i;return(0,H.jsxs)(`li`,{className:`group/thread relative rounded-lg border bg-card shadow-sm transition-colors hover:bg-accent/40 ${s?`border-destructive/30`:`hover:border-primary/40`} ${e.status===`resolved`?`opacity-75`:``}`,"data-comment-row":e.id,children:[(0,H.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-2 p-2.5 text-left ${l===2?`pr-14`:l===1?`pr-9`:``}`,onClick:n,children:[(0,H.jsx)(Ch,{thread:e,number:t,showScope:a}),(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`span`,{className:`line-clamp-2 text-sm leading-snug ${e.status===`resolved`?`text-muted-foreground`:``}`,children:bh(e)}),(0,H.jsxs)(`span`,{className:`mt-1.5 flex flex-wrap items-center gap-x-1.5 gap-y-1 text-[11px] text-muted-foreground`,children:[a?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[o?(0,H.jsx)(qt,{size:11}):(0,H.jsx)(On,{size:11}),o?`Cloud`:`Local`]}),(0,H.jsx)(wh,{})]}):null,(0,H.jsx)(`span`,{children:Sh(e)}),(0,H.jsx)(wh,{}),(0,H.jsx)(sh,{iso:e.updatedAt}),c>0?(0,H.jsxs)(U,{variant:`secondary`,className:`h-4 gap-0.5 px-1.5 text-[10px] tabular-nums`,children:[(0,H.jsx)(er,{}),c]}):null,s?(0,H.jsx)(U,{variant:`destructive`,className:`h-4 px-1.5 text-[10px]`,children:`Target changed`}):null,e.status===`resolved`?(0,H.jsxs)(U,{variant:`outline`,className:`h-4 gap-0.5 px-1.5 text-[10px]`,children:[(0,H.jsx)(Bt,{}),`Resolved`]}):null]})]})]}),l>0?(0,H.jsxs)(`div`,{className:`absolute right-1.5 top-1.5 flex items-center gap-0.5 opacity-0 transition-opacity focus-within:opacity-100 group-hover/thread:opacity-100`,children:[e.anchor?(0,H.jsx)(W,{variant:`ghost`,size:`icon-xs`,"aria-label":`Go to comment ${t}`,title:`Go to comment on canvas`,onClick:r,children:(0,H.jsx)(Zt,{})}):null,i?(0,H.jsx)(W,{variant:`ghost`,size:`icon-xs`,className:`text-muted-foreground hover:text-destructive`,"aria-label":`Delete thread ${t}`,title:`Delete this thread`,onClick:i,children:(0,H.jsx)(xr,{})}):null]}):null]})}function Eh({status:e,onStatusChange:t,count:n,onAdd:r,children:i}){return(0,H.jsxs)(`div`,{className:`space-y-2 border-b px-3 py-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsxs)(rh,{"aria-label":`Comment status`,size:`sm`,className:`w-auto text-xs`,value:e,onChange:e=>t(e.target.value),children:[(0,H.jsx)(ih,{value:`open`,children:`Open`}),(0,H.jsx)(ih,{value:`resolved`,children:`Resolved`}),(0,H.jsx)(ih,{value:`all`,children:`All`})]}),(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n}),(0,H.jsxs)(W,{variant:`outline`,size:`sm`,className:`ml-auto`,title:`Pin a new comment on the canvas`,onClick:r,children:[(0,H.jsx)(Xn,{}),` Add`]})]}),i]})}function Dh({status:e}){return(0,H.jsx)(cl,{className:`h-full`,children:(0,H.jsxs)(ll,{children:[(0,H.jsx)(dl,{variant:`icon`,children:(0,H.jsx)(On,{})}),(0,H.jsxs)(fl,{children:[`No `,e===`all`?``:`${e} `,`comments on this board.`]}),(0,H.jsx)(pl,{children:`Add a pin on the canvas or start a broad thread below.`})]})})}function Oh({children:e}){return(0,H.jsx)(`p`,{className:`mt-1.5 rounded-md border border-destructive/40 bg-destructive/10 px-2 py-1.5 text-[11px] text-destructive`,"data-comment-failure":!0,role:`alert`,children:e})}function kh({draft:e,onDraftChange:t,onSubmit:n,failure:r,busy:i=!1,target:a,help:o,className:s=``}){return(0,H.jsxs)(`div`,{className:`border-t p-3 ${s}`,"data-board-comment-composer":!0,children:[(0,H.jsxs)(Km,{children:[(0,H.jsx)(Qm,{"aria-label":`Start board-wide thread`,value:e,onChange:e=>t(e.target.value),placeholder:`Start a broad thread about this board…`,className:`min-h-16 text-sm`,onKeyDown:tp(n)}),(0,H.jsxs)(Jm,{align:`block-end`,className:`flex-wrap`,children:[a,(0,H.jsx)(Xm,{variant:`default`,className:`ml-auto`,disabled:i||!e.trim(),onClick:n,children:i?`Posting…`:r?`Try again`:`Start thread`})]})]}),r?(0,H.jsx)(Oh,{children:r}):null,(0,H.jsxs)(`p`,{className:`mt-1.5 text-[11px] text-muted-foreground`,children:[`Board-wide threads have no canvas pin.`,o?(0,H.jsxs)(H.Fragment,{children:[` `,o]}):null]})]})}function Ah({thread:e,showScope:t=!0,voice:n,canDelete:r,onBack:i,onRequestDelete:a,replyDraft:o,onReplyDraftChange:s,onReply:c,canReply:l=!0,replyFallback:u,busy:d=!1,onResolve:f,children:p}){let m=e.status===`open`;return(0,H.jsxs)(`div`,{className:`flex min-h-full flex-col p-3`,"data-active-comment":e.id,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,H.jsx)(W,{variant:`ghost`,size:`sm`,onClick:i,children:`← Threads`}),(0,H.jsxs)(`span`,{className:`ml-auto flex items-center gap-1 text-[11px] text-muted-foreground`,children:[t?(0,H.jsxs)(H.Fragment,{children:[e.scope===`shared`?(0,H.jsx)(qt,{size:11}):(0,H.jsx)(On,{size:11}),e.scope===`shared`?`Cloud`:`Local`]}):null,(0,H.jsx)(`span`,{children:e.anchorState.status===`stale`?`Target changed`:e.anchor?`Pinned`:`Board-wide`})]})]}),(0,H.jsx)(yh,{messages:e.messages,voice:n,canDelete:r,onDelete:t=>a({kind:`message`,threadId:e.id,id:t})}),m&&l?(0,H.jsxs)(Km,{className:`mt-3`,children:[(0,H.jsx)(Qm,{"aria-label":`Reply`,value:o,onChange:e=>s(e.target.value),placeholder:`Reply…`,className:`min-h-16 text-sm`,onKeyDown:tp(c)}),(0,H.jsx)(Jm,{align:`block-end`,children:(0,H.jsx)(Xm,{variant:`default`,className:`ml-auto`,disabled:d||!o.trim(),onClick:c,children:`Reply`})})]}):m?u:null,f||p?(0,H.jsxs)(`div`,{className:`mt-auto grid grid-cols-2 gap-2 pt-4`,children:[f?(0,H.jsx)(W,{variant:`outline`,size:`sm`,className:p?``:`col-span-2`,disabled:d,onClick:f,children:m?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Bt,{}),` Resolve`]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(tr,{}),` Reopen`]})}):null,p]}):null]})}function jh({thread:e,pending:t,onCancel:n,onConfirm:r}){return(0,H.jsx)(ql,{open:e!==null&&t!==null,onOpenChange:e=>{e||n()},children:(0,H.jsxs)(Xl,{"data-comment-delete-confirm":!0,children:[(0,H.jsxs)(Zl,{children:[(0,H.jsx)($l,{className:`text-destructive`,children:(0,H.jsx)(xr,{})}),(0,H.jsx)(eu,{children:t?.kind===`message`?`Delete comment`:`Delete thread`}),(0,H.jsx)(tu,{children:e&&t?xh(e,t):``})]}),(0,H.jsxs)(Ql,{children:[(0,H.jsx)(ru,{children:`Cancel`}),(0,H.jsx)(nu,{variant:`destructive`,onClick:r,children:`Delete`})]})]})})}var Mh=14;function Nh(e,t,n){if(e.kind===`board`)return{x:e.x,y:e.y,w:0,h:0};let r=t.find(t=>t.id===e.frameId);return r?Ws(r,n[r.id]??{x:0,y:0},e.bounds):null}function Ph({anchor:e,frames:t,insets:n,onCancel:r,onSubmit:i,target:a,blocked:o,onFrame:s}){let[c,l]=(0,M.useState)(``),[u,d]=(0,M.useState)(null),[f,p]=(0,M.useState)(!1),m=(0,M.useRef)(null),h=(0,M.useRef)(s);h.current=s,(0,M.useEffect)(()=>{l(``),d(null)},[e]);let g=Nh(e,t,n);if((0,M.useEffect)(()=>{let e=m.current;if(e&&g)return h.current?.(g,{w:e.offsetWidth,h:e.offsetHeight,gap:Mh})},[e]),!g)return null;let _=()=>{c.trim()&&!f&&(d(null),p(!0),i(c).then(d).finally(()=>p(!1)))};return(0,H.jsxs)(`div`,{ref:m,className:`absolute z-30 rounded-lg border bg-card p-3 shadow-xl ${a?`w-96`:`w-80`}`,style:{left:g.x+g.w,top:g.y,transform:`scale(calc(1 / var(--canvas-zoom, 1))) translate(${Mh}px, ${Mh}px)`,transformOrigin:`top left`},"data-inline-comment-composer":!0,onPointerDown:e=>e.stopPropagation(),children:[(0,H.jsxs)(`div`,{className:`mb-2 flex items-center gap-1.5 text-xs font-medium`,children:[(0,H.jsx)(En,{size:13}),e.kind===`node`?`Pinned comment`:`Pinned board location`,(0,H.jsx)(`button`,{type:`button`,className:`ml-auto text-muted-foreground hover:text-foreground`,"aria-label":`Cancel comment`,onClick:r,children:(0,H.jsx)(jr,{size:13})})]}),o??(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(np,{autoFocus:!0,"aria-label":`New pinned comment`,value:c,onChange:e=>l(e.target.value),placeholder:`What should change?`,className:`min-h-20 resize-none text-sm`,onKeyDown:e=>{if(e.key===`Escape`){e.preventDefault(),r();return}tp(_)(e)}}),u?(0,H.jsx)(Oh,{children:u}):null,(0,H.jsxs)(`div`,{className:`mt-2 flex items-end gap-2`,children:[a?(0,H.jsx)(`div`,{className:`min-w-0 flex-1`,children:a}):null,(0,H.jsx)(W,{size:`sm`,className:`ml-auto`,disabled:f||!c.trim(),onClick:_,children:f?`Posting…`:u?`Try again`:`Add comment`})]})]})]})}function Fh(){let e=B(e=>e.pendingCommentAnchor),t=B(e=>e.currentBoardId?e.boards[e.currentBoardId]:void 0),n=B(e=>e.frameInsets),r=B(e=>e.cloudComments),i=B(e=>e.clearPendingComment),a=B(e=>e.createPendingComment),o=B(e=>e.zoomForCommentDraft),s=B(e=>e.restoreViewAfterMarkupEdit),[c,l]=(0,M.useState)(`local`);return!e||!t?null:(0,H.jsx)(Ph,{anchor:e,frames:t.frames,insets:n,onCancel:i,onSubmit:e=>a(e,c),target:(0,H.jsx)(Hm,{scope:c,onChange:l,cloud:r}),onFrame:(e,t)=>(o(e,t),s)})}function Ih({board:e}){let t=B(e=>e.setCanvasZoom),n=B(e=>e.setPan),r=B(e=>e.cursorMode),[i,a]=(0,M.useState)(!1),o=(0,M.useRef)(null),s=(0,M.useRef)(null),c=(0,M.useMemo)(()=>{let t=800,n=600;for(let r of e.frames)r.x+r.w>t&&(t=r.x+r.w),r.y+r.h>n&&(n=r.y+r.h);return{w:t+600,h:n+400}},[e.frames]),l=(0,M.useMemo)(()=>{let t={};for(let n of e.frames)t[n.screen]=(t[n.screen]??0)+1;return t},[e.frames]),u=(0,M.useRef)(null);(0,M.useEffect)(()=>{let r=o.current;if(!r||u.current===e.id)return;let i=$s(e.id);if(i){t(i.zoom),n(i.pan),u.current=e.id;return}if(e.frames.length===0){u.current=e.id;return}let a=()=>{let i=Vs(e.frames,r.clientWidth,r.clientHeight);return i?(t(i.zoom),n(i.pan),u.current=e.id,!0):!1};if(a())return;let s=null,c=requestAnimationFrame(()=>{a()||(s=new ResizeObserver(()=>{a()&&s?.disconnect()}),s.observe(r))});return()=>{cancelAnimationFrame(c),s?.disconnect()}},[e.id,e.frames,t,n]),(0,M.useEffect)(()=>{let e=o.current;if(!e)return;let t=t=>{let n=B.getState();if(t.metaKey||t.ctrlKey){t.preventDefault();let r=e.getBoundingClientRect(),i=Ks(t.clientX-r.left,t.clientY-r.top,zs(t.deltaY),{zoom:n.canvasZoom,pan:n.pan});n.setCanvasZoom(i.zoom),n.setPan(i.pan);return}t.preventDefault(),n.setPan({x:n.pan.x-t.deltaX,y:n.pan.y-t.deltaY})};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[]);let d=(e,t)=>{let n=o.current;if(!n)return{x:0,y:0};let{canvasZoom:r,pan:i}=B.getState(),a=n.getBoundingClientRect();return{x:(e-a.left-i.x)/r,y:(t-a.top-i.y)/r}},f=t=>{if(t.button!==0)return;if(r===`hand`){t.preventDefault(),t.currentTarget.setPointerCapture(t.pointerId),s.current={startX:t.clientX,startY:t.clientY,startPan:{...B.getState().pan}},a(!0);return}let n=t.target===t.currentTarget||!!t.target.dataset?.vellooBoardWorld;if(r===`note`&&n){let e=d(t.clientX,t.clientY);t.preventDefault(),B.getState().createNote(e);return}if(r===`comment`&&n){let n=d(t.clientX,t.clientY);t.preventDefault(),B.getState().beginComment({kind:`board`,boardId:e.id,...n});return}n&&B.getState().setSelection(null)},p=e=>{let t=s.current;t&&n({x:t.startPan.x+(e.clientX-t.startX),y:t.startPan.y+(e.clientY-t.startY)})},m=e=>{if(s.current){try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}s.current=null,a(!1)}};return(0,M.useEffect)(()=>{let e=()=>{s.current=null,a(!1)};return window.addEventListener(`pointerup`,e),window.addEventListener(`pointercancel`,e),window.addEventListener(`blur`,e),()=>{window.removeEventListener(`pointerup`,e),window.removeEventListener(`pointercancel`,e),window.removeEventListener(`blur`,e)}},[]),(0,M.useEffect)(()=>{r!==`hand`&&(s.current=null,a(!1))},[r]),(0,H.jsxs)(`div`,{ref:o,"data-velloo-board":`true`,className:`flex-1 min-h-0 min-w-0 overflow-clip bg-muted/30 relative`,onPointerDown:f,onPointerMove:p,onPointerUp:m,onPointerCancel:m,style:{cursor:r===`hand`?i?`grabbing`:`grab`:r===`note`?`crosshair`:r===`comment`?`cell`:`default`},children:[(0,H.jsxs)(Lh,{boardId:e.id,restoredRef:u,w:c.w,h:c.h,children:[e.frames.map(t=>(0,H.jsx)(td,{boardId:e.id,frame:t,frames:e.frames,presets:Rh,sharedCount:l[t.screen]??1},t.id)),(0,H.jsx)(Lm,{}),(0,H.jsx)(Fh,{}),(0,H.jsx)(Bl,{}),(0,H.jsx)(wm,{})]}),(0,H.jsx)(_m,{})]})}function Lh({boardId:e,restoredRef:t,w:n,h:r,children:i}){let a=B(e=>e.canvasZoom),o=B(e=>e.pan);return(0,M.useEffect)(()=>{if(t.current!==e)return;let n=setTimeout(()=>ec(e,{pan:o,zoom:a}),150);return()=>clearTimeout(n)},[e,o,a,t]),(0,H.jsx)(`div`,{"data-velloo-board-world":`true`,className:`relative origin-top-left`,style:{width:n,height:r,transform:`translate(${o.x}px, ${o.y}px) scale(${a})`,"--canvas-zoom":a},children:i})}var Rh=[{name:`Mobile`,w:390,h:844},{name:`Tablet`,w:768,h:1024},{name:`Desktop`,w:1440,h:900}];function zh({title:e,hint:t,icon:n,action:r,size:i=`page`}){let a=i===`panel`;return(0,H.jsxs)(cl,{className:a?`flex-1 p-6`:`flex-1 p-12`,children:[(0,H.jsxs)(ll,{children:[n?(0,H.jsx)(dl,{variant:`icon`,children:(0,H.jsx)(n,{})}):null,(0,H.jsx)(fl,{className:a?`text-xs`:`text-base`,children:e}),t?(0,H.jsx)(pl,{className:a?`text-xs`:void 0,children:t}):null]}),r?(0,H.jsx)(ml,{children:r}):null]})}function Bh(e,t){return F(`/api/preflight?${new URLSearchParams({kind:e,id:t})}`,`preflightExportTarget`).then(e=>e.failures)}function Vh(e){return F(`/api/preflight?${new URLSearchParams(e.length>0?{boards:e.join(`,`)}:{})}`,`preflightBoards`).then(e=>e.failures)}function Hh(e){return e.componentId===null?`${e.screenName}: ${e.reason}`:`${e.screenName} — ${e.componentId}: ${e.reason}`}function Uh({failures:e,verb:t,onCancel:n,onConfirm:r}){let i=e?.length??0,a=new Set(e?.map(e=>e.screenId)).size;return(0,H.jsx)(ql,{open:e!==null,onOpenChange:e=>!e&&n(),children:(0,H.jsxs)(Xl,{children:[(0,H.jsxs)(Zl,{children:[(0,H.jsxs)(eu,{children:[i===1?`A component`:`${i} components`,` failed to render`]}),(0,H.jsxs)(tu,{children:[`On `,a===1?`1 screen`:`${a} screens`,`. Each one appears as a placeholder box in the output, not as the component — whoever opens it will see the error, not the design.`]})]}),(0,H.jsx)(`ul`,{className:`max-h-48 overflow-y-auto scroll-stable rounded-md border bg-muted/30 p-2 text-xs font-mono`,children:e?.map(e=>(0,H.jsx)(`li`,{className:`py-0.5`,children:Hh(e)},`${e.screenId}:${e.componentId}`))}),(0,H.jsxs)(Ql,{children:[(0,H.jsx)(ru,{children:`Cancel`}),(0,H.jsxs)(nu,{onClick:r,children:[t,` anyway`]})]})]})})}function Wh(){let e=B(e=>e.exportTarget),t=B(e=>e.setExportTarget),[n,r]=(0,M.useState)(`png`),[i,a]=(0,M.useState)(`light`),[o,s]=(0,M.useState)(`1`),[c,l]=(0,M.useState)(!1),[u,d]=(0,M.useState)(null);(0,M.useEffect)(()=>{e&&(r(`png`),a(`light`),s(`1`),l(!1),d(null))},[e]);let f=e?.kind===`frame`&&n===`png`,p=i===`compare`&&!f?`light`:i,m=async()=>{if(e)try{let r=await ns({kind:e.kind,id:e.id,format:n,mode:p,...n===`png`?{scale:Number(o)}:{}});for(let e of r)L({kind:`info`,message:e});t(null)}catch(e){R(e,`Export failed`),l(!1)}},h=async()=>{if(!e||c)return;l(!0);let t=await Bh(e.kind,e.id).catch(()=>[]);if(t.length>0){d(t);return}await m()};return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Uh,{failures:u,verb:`Export`,onCancel:()=>{d(null),l(!1)},onConfirm:()=>{d(null),m()}}),(0,H.jsx)(Cl,{open:e!==null,onOpenChange:e=>!e&&t(null),children:(0,H.jsxs)(El,{className:`sm:max-w-sm`,children:[(0,H.jsxs)(Dl,{children:[(0,H.jsxs)(kl,{children:[`Export `,e?.kind===`board`?`board`:`frame`]}),(0,H.jsx)(Al,{className:`truncate`,children:e?.name})]}),(0,H.jsxs)(`div`,{className:`grid gap-4`,children:[(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(G,{htmlFor:`export-format`,children:`Format`}),(0,H.jsxs)(K,{value:n,onValueChange:e=>{r(e),e!==`png`&&i===`compare`&&a(`light`)},children:[(0,H.jsx)(J,{id:`export-format`,children:(0,H.jsx)(q,{})}),(0,H.jsxs)(Y,{children:[(0,H.jsx)(X,{value:`png`,children:`PNG image`}),(0,H.jsx)(X,{value:`pdf`,children:e?.kind===`board`?`PDF deck (one frame per page)`:`PDF (single page)`}),(0,H.jsx)(X,{value:`html`,children:`Standalone HTML (self-contained)`})]})]})]}),(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(G,{htmlFor:`export-mode`,children:`Mode`}),(0,H.jsxs)(K,{value:p,onValueChange:e=>a(e),children:[(0,H.jsx)(J,{id:`export-mode`,children:(0,H.jsx)(q,{})}),(0,H.jsxs)(Y,{children:[(0,H.jsx)(X,{value:`light`,children:`Light`}),(0,H.jsx)(X,{value:`dark`,children:`Dark`}),f?(0,H.jsx)(X,{value:`compare`,children:`Compare (light | dark)`}):null]})]})]}),n===`png`?(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(G,{htmlFor:`export-scale`,children:`Scale`}),(0,H.jsxs)(K,{value:o,onValueChange:e=>s(e),children:[(0,H.jsx)(J,{id:`export-scale`,children:(0,H.jsx)(q,{})}),(0,H.jsxs)(Y,{children:[(0,H.jsx)(X,{value:`1`,children:`1× (CSS pixels)`}),(0,H.jsx)(X,{value:`2`,children:`2× (retina)`})]})]})]}):null]}),(0,H.jsxs)(Ol,{children:[(0,H.jsx)(W,{variant:`outline`,onClick:()=>t(null),disabled:c,children:`Cancel`}),(0,H.jsxs)(W,{onClick:()=>void h(),disabled:c,children:[(0,H.jsx)(Qt,{}),c?`Exporting…`:`Export`]})]})]})})]})}var Gh=u(`group/alert relative grid w-full gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-card text-card-foreground`,destructive:`bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current`}},defaultVariants:{variant:`default`}});function Kh({className:e,variant:t,...n}){return(0,H.jsx)(`div`,{"data-slot":`alert`,role:`alert`,className:V(Gh({variant:t}),e),...n})}function qh({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`alert-title`,className:V(`font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground`,e),...t})}function Jh({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`alert-description`,className:V(`text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4`,e),...t})}function Yh({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`alert-action`,className:V(`absolute top-2 right-2`,e),...t})}function Xh({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`field-group`,className:V(`group/field-group @container/field-group flex w-full flex-col gap-5 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,e),...t})}var Zh=u(`group/field flex w-full gap-2 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:`flex-col *:w-full [&>.sr-only]:w-auto`,horizontal:`flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`,responsive:`flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`}},defaultVariants:{orientation:`vertical`}});function Qh({className:e,orientation:t=`vertical`,...n}){return(0,H.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":t,className:V(Zh({orientation:t}),e),...n})}function $h({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`field-content`,className:V(`group/field-content flex flex-1 flex-col gap-0.5 leading-snug`,e),...t})}function eg({className:e,...t}){return(0,H.jsx)(G,{"data-slot":`field-label`,className:V(`group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border has-[>[data-slot=field]]:not-has-[:disabled,[data-disabled]]:hover:bg-muted/50 has-[>[data-slot=field]]:has-[:focus-visible]:border-ring has-[>[data-slot=field]]:has-[:focus-visible]:ring-3 has-[>[data-slot=field]]:has-[:focus-visible]:ring-ring/50 *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col`,e),...t})}function tg({className:e,...t}){return(0,H.jsx)(`p`,{"data-slot":`field-description`,className:V(`text-left text-sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5`,`last:mt-0 nth-last-2:-mt-1`,`[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,e),...t})}function ng({className:e,...t}){return(0,H.jsx)(bn,{"data-slot":`spinner`,role:`status`,"aria-label":`Loading`,className:V(`size-4 animate-spin`,e),...t})}function rg({className:e,size:t=`default`,...n}){return(0,H.jsx)(Ie,{"data-slot":`switch`,"data-size":t,className:V(`peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50`,e),...n,children:(0,H.jsx)(et,{"data-slot":`switch-thumb`,className:`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground`})})}var ig=6e3,ag={bug:`What happened, and what did you expect instead? Steps to reproduce help most.`,feedback:`What's working, what isn't, what you wish velloo did…`};function og(){let e=B(e=>e.feedbackOpen),t=B(e=>e.setFeedbackOpen),n=B(e=>e.authStatus),r=B(e=>e.openSignIn),i=B(e=>e.signInPrompt),a=(0,M.useRef)(!1),[o,s]=(0,M.useState)(`bug`),[c,l]=(0,M.useState)(``),[u,d]=(0,M.useState)(!0),[f,p]=(0,M.useState)(!1),m=(0,M.useId)(),h=(0,M.useId)();(0,M.useEffect)(()=>{e&&B.getState().refreshAuth()},[e]),(0,M.useEffect)(()=>{let{feedbackOpen:e,setFeedbackOpen:t}=B.getState();i&&e?(a.current=!0,t(!1)):!i&&a.current&&(a.current=!1,t(!0))},[i]);let g=!!n?.loggedIn&&n?.verified===!1,_=!!n?.loggedIn&&!g,v=n?.account?.email,y=c.trim(),b=_&&y.length>0&&!f,x=async()=>{if(b){p(!0);try{L({kind:`success`,message:await as({kind:o,body:y,anonymous:u})}),l(``),t(!1)}catch(e){R(e,o===`bug`?`Could not send the bug report`:`Could not send feedback`)}finally{p(!1)}}};return(0,H.jsx)(Cl,{open:e,onOpenChange:e=>!f&&t(e),children:(0,H.jsxs)(El,{className:`sm:max-w-md`,"data-testid":`feedback-dialog`,children:[(0,H.jsxs)(Dl,{children:[(0,H.jsx)(kl,{children:`Report a bug or send feedback`}),(0,H.jsx)(Al,{children:`Goes straight to the velloo team. Leave out anything confidential — nothing from your designs is attached.`})]}),_?null:(0,H.jsxs)(Kh,{"data-testid":`feedback-sign-in`,children:[(0,H.jsx)(Cn,{}),(0,H.jsx)(qh,{children:g?`Sign in again to send`:`Sign in to send`}),(0,H.jsxs)(Jh,{children:[(0,H.jsx)(`p`,{children:`Feedback needs a velloo cloud account — even anonymous feedback, which is vouched for by your sign-in without naming you.`}),(0,H.jsx)(W,{size:`sm`,variant:`outline`,className:`mt-2`,onClick:()=>r({action:`send your feedback`,...g&&{expired:!0}}),children:g?`Sign in again…`:`Sign in to velloo cloud…`})]})]}),(0,H.jsxs)(`form`,{className:`grid gap-4`,onSubmit:e=>{e.preventDefault(),x()},children:[(0,H.jsxs)(Xh,{className:`gap-4`,children:[(0,H.jsxs)(Yp,{type:`single`,variant:`outline`,size:`sm`,spacing:0,value:o,onValueChange:e=>e&&s(e),className:`w-full`,"aria-label":`What are you sending?`,children:[(0,H.jsxs)(Xp,{value:`bug`,className:`flex-1`,"data-testid":`feedback-kind-bug`,children:[(0,H.jsx)(zt,{}),` Bug`]}),(0,H.jsxs)(Xp,{value:`feedback`,className:`flex-1`,"data-testid":`feedback-kind-feedback`,children:[(0,H.jsx)(An,{}),` Feedback`]})]}),(0,H.jsxs)(Qh,{children:[(0,H.jsx)(eg,{htmlFor:m,className:`sr-only`,children:o===`bug`?`Describe the bug`:`Your feedback`}),(0,H.jsx)(np,{id:m,value:c,onChange:e=>l(e.target.value),maxLength:ig,placeholder:ag[o],className:`min-h-32`,autoFocus:!0}),(0,H.jsxs)(tg,{className:`text-right text-[11px] tabular-nums`,children:[c.length.toLocaleString(),` / `,ig.toLocaleString()]})]}),(0,H.jsxs)(Qh,{orientation:`horizontal`,children:[(0,H.jsxs)($h,{children:[(0,H.jsx)(eg,{htmlFor:h,children:`Send anonymously`}),(0,H.jsx)(tg,{"data-testid":`feedback-anonymous-help`,children:u?`Anonymous feedback can't be linked to your account, so we can't reply to it.`:`Sent from your account${v?` (${v})`:``}, so we can follow up with you.`})]}),(0,H.jsx)(rg,{id:h,checked:u,onCheckedChange:d,"data-testid":`feedback-anonymous`})]})]}),(0,H.jsxs)(Ol,{children:[(0,H.jsx)(W,{type:`button`,variant:`outline`,disabled:f,onClick:()=>t(!1),children:`Cancel`}),(0,H.jsxs)(W,{type:`submit`,disabled:!b,"data-testid":`feedback-send`,children:[f?(0,H.jsx)(ng,{}):null,f?`Sending…`:`Send`]})]})]})]})})}var sg=u(`group/item flex w-full flex-wrap items-center rounded-lg border text-sm transition-colors duration-100 outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 [a]:transition-colors [a]:hover:bg-muted`,{variants:{variant:{default:`border-transparent`,outline:`border-border`,muted:`border-transparent bg-muted/50`},size:{default:`gap-2.5 px-3 py-2.5`,sm:`gap-2.5 px-3 py-2.5`,xs:`gap-2 px-2.5 py-2 in-data-[slot=dropdown-menu-content]:p-0`}},defaultVariants:{variant:`default`,size:`default`}});function cg({className:e,variant:t=`default`,size:n=`default`,asChild:r=!1,...i}){let a=r?gt:`div`;return(0,H.jsx)(a,{"data-slot":`item`,"data-variant":t,"data-size":n,className:V(sg({variant:t,size:n,className:e})),...i})}u(`flex shrink-0 items-center justify-center gap-2 group-has-data-[slot=item-description]/item:translate-y-0.5 group-has-data-[slot=item-description]/item:self-start [&_svg]:pointer-events-none`,{variants:{variant:{default:`bg-transparent`,icon:`[&_svg:not([class*='size-'])]:size-4`,image:`size-10 overflow-hidden rounded-sm group-data-[size=sm]/item:size-8 group-data-[size=xs]/item:size-6 [&_img]:size-full [&_img]:object-cover`}},defaultVariants:{variant:`default`}});function lg({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`item-content`,className:V(`flex flex-1 flex-col gap-1 group-data-[size=xs]/item:gap-0 [&+[data-slot=item-content]]:flex-none`,e),...t})}function ug({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`item-title`,className:V(`line-clamp-1 flex w-fit items-center gap-2 text-sm leading-snug font-medium underline-offset-4`,e),...t})}function dg({className:e,...t}){return(0,H.jsx)(`p`,{"data-slot":`item-description`,className:V(`line-clamp-2 text-left text-sm leading-normal font-normal text-muted-foreground group-data-[size=xs]/item:text-xs [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,e),...t})}function fg({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`item-actions`,className:V(`flex items-center gap-2`,e),...t})}var pg=10;function mg(e){if(!e)return`date unknown`;let t=Date.parse(e);if(!Number.isFinite(t))return`date unknown`;let n=Math.floor((Date.now()-t)/864e5);return n<=0?`today`:n===1?`yesterday`:n<30?`${n} days ago`:new Date(t).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function hg(e){if(!e)return null;try{return new URL(`/boards`,e).href}catch{return null}}function gg(e){return e.passwordProtected?{icon:sr,text:`Password protected`}:e.visibility===`private`?{icon:Sn,text:e.onlyTeam?`Only ${e.onlyTeam}`:`Your organization`}:{icon:xn,text:`Anyone with the link`}}function _g(){let e=B(e=>e.publishedBoardsOpen),t=B(e=>e.setPublishedBoardsOpen),n=B(e=>e.openGuests),r=hg(B(e=>e.authStatus?.appUrl)),[i,a]=(0,M.useState)(null),[o,s]=(0,M.useState)(null),[c,l]=(0,M.useState)(!1);(0,M.useEffect)(()=>{if(!e)return;a(null);let n=!1;return(async()=>{try{let e=await ds.published();n||a(e)}catch(e){if(n)return;R(e,`Could not read your published boards`),t(!1)}})(),()=>{n=!0}},[e,t]);let u=async e=>{l(!0);try{await ds.unpublish(e.slug),a(t=>t?.filter(t=>t.slug!==e.slug)??null),B.getState().refreshPublishSlots({force:!0}),L({kind:`success`,message:`Unpublished ${e.title||e.slug} — the link no longer resolves.`}),s(null)}catch(e){R(e,`Could not unpublish that board`)}finally{l(!1)}},d=i?.slice(0,pg)??[];return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Cl,{open:e,onOpenChange:e=>!e&&t(!1),children:(0,H.jsxs)(El,{className:`sm:max-w-lg`,children:[(0,H.jsxs)(Dl,{children:[(0,H.jsx)(kl,{children:`Published boards`}),(0,H.jsx)(Al,{children:`Live links on velloo-cloud, newest first. Taking one down stops it resolving and frees the board slot it holds.`})]}),i===null?(0,H.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-sm text-muted-foreground`,children:[(0,H.jsx)(Zu,{size:16}),`Reading velloo-cloud…`]}):d.length===0?(0,H.jsx)(zh,{size:`panel`,icon:rn,title:`Nothing published yet`,hint:`Publish a board from its menu in the sidebar to get a share link.`}):(0,H.jsx)(`ul`,{className:`-mx-1 max-h-[22rem] overflow-y-auto px-1`,"data-testid":`published-boards-list`,children:d.map(e=>{let r=gg(e);return(0,H.jsx)(`li`,{children:(0,H.jsxs)(cg,{variant:`outline`,size:`sm`,className:`mb-1.5`,children:[(0,H.jsxs)(lg,{className:`min-w-0`,children:[(0,H.jsxs)(ug,{className:`max-w-full`,children:[(0,H.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`truncate text-inherit no-underline hover:underline`,children:e.title||e.slug}),(0,H.jsx)(en,{size:12,className:`shrink-0 text-muted-foreground`})]}),(0,H.jsxs)(dg,{className:`flex items-center gap-1.5 text-xs`,children:[(0,H.jsx)(r.icon,{size:11,className:`shrink-0`}),r.text,` · `,mg(e.lastPublishedAt),e.guestCount?` · ${e.guestCount} guest${e.guestCount===1?``:`s`}`:``]})]}),(0,H.jsxs)(fg,{children:[(0,H.jsx)(W,{variant:`ghost`,size:`icon-sm`,disabled:!e.canManage,title:e.canManage?`Guests…`:`Only the board's publisher and admins can invite guests`,"aria-label":`Guests on ${e.title||e.slug}`,onClick:()=>{t(!1),n({slug:e.slug,title:e.title||e.slug})},children:(0,H.jsx)(Or,{})}),(0,H.jsx)(W,{variant:`ghost`,size:`icon-sm`,disabled:!e.canManage,title:e.canManage?`Unpublish this board`:`A teammate published this — only they can take it down`,"aria-label":`Unpublish ${e.title||e.slug}`,onClick:()=>s(e),children:(0,H.jsx)(xr,{className:e.canManage?`text-destructive`:void 0})})]})]})},e.slug)})}),(0,H.jsxs)(Ol,{className:`sm:justify-between`,children:[r?(0,H.jsx)(W,{variant:`ghost`,size:`sm`,asChild:!0,children:(0,H.jsxs)(`a`,{href:r,target:`_blank`,rel:`noreferrer`,"data-testid":`published-boards-all`,children:[(0,H.jsx)(en,{}),i&&i.length>d.length?`See all ${i.length} on velloo-cloud`:`More details on velloo-cloud`]})}):(0,H.jsx)(`span`,{}),(0,H.jsx)(W,{variant:`outline`,onClick:()=>t(!1),children:`Close`})]})]})}),(0,H.jsx)(ql,{open:o!==null,onOpenChange:e=>!e&&s(null),children:(0,H.jsxs)(Xl,{children:[(0,H.jsxs)(Zl,{children:[(0,H.jsxs)(eu,{children:[`Unpublish “`,o?.title||o?.slug,`”?`]}),(0,H.jsx)(tu,{children:`The share link stops resolving for everyone who has it, along with any comments left on it. Your local boards and screens are untouched, and publishing again mints a new link.`})]}),(0,H.jsxs)(Ql,{children:[(0,H.jsx)(ru,{disabled:c,children:`Keep it`}),(0,H.jsx)(nu,{variant:`destructive`,disabled:c,onClick:e=>{e.preventDefault(),o&&u(o)},children:c?`Unpublishing…`:`Unpublish`})]})]})})]})}var vg=9e5,yg=`velloo:update-toasted`,bg=new Set;function xg(){for(let e of bg)e()}function Sg(e){return bg.add(e),()=>bg.delete(e)}var Cg={status:null,upgrading:!1};function wg(e){Cg={...Cg,...e},xg()}function Tg(){return(0,M.useSyncExternalStore)(Sg,()=>Cg)}async function Eg(e={}){try{wg({status:await xs(e)})}catch{}}function Dg(e){if(!e)return``;let t=/^(\S+)\s*\((?:.*·\s*)?(.+)\)$/.exec(e);return t?`${t[1]} · ${t[2]}`:e}function Og(e){if(e.available&&e.latest&&e.upgradable){try{if(localStorage.getItem(yg)===e.latest)return;localStorage.setItem(yg,e.latest)}catch{}L({kind:`info`,title:`Velloo ${Dg(e.latest)} is available`,message:`You're on ${Dg(e.current)}.`,ttl:1e4,action:{label:`Upgrade`,onClick:()=>void jg()}})}}var kg=!1;function Ag(){if(kg)return;kg=!0;let e=async e=>{await Eg(e?{refresh:!0}:{}),Cg.status&&Og(Cg.status)};(async()=>{await e(!1),await e(!0)})(),setInterval(()=>void e(!0),vg)}async function jg(){if(Cg.upgrading)return;wg({upgrading:!0});let e=L({kind:`info`,message:`Upgrading velloo…`,ttl:6e4});try{let e=await Ss();e.upgraded?L({kind:`success`,title:`Upgraded to ${e.to}`,message:"Quit the canvas and run `velloo upgrade` to finish — it migrates this folder.",ttl:15e3}):L({kind:`success`,message:`Velloo ${e.to} is already installed.`}),await Eg({refresh:!0})}catch(e){R(e,`Could not upgrade velloo.`)}finally{Cs(e),wg({upgrading:!1})}}function Mg({className:e,size:t=`default`,...n}){return(0,H.jsx)(ue,{"data-slot":`avatar`,"data-size":t,className:V(`group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten`,e),...n})}function Ng({className:e,...t}){return(0,H.jsx)(we,{"data-slot":`avatar-fallback`,className:V(`flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs`,e),...t})}var Pg={free:`Free`,team:`Team`,business:`Business`,enterprise:`Enterprise`};function Fg(e){return Pg[e]??e}function Ig(e){return`$${(e/1e6).toFixed(2)}`}function Lg(e){return e.name?.trim().split(/\s+/)[0]||(e.email.split(`@`)[0]??e.email)}function Rg(e){let t=e.name?.trim().split(/\s+/).filter(Boolean)??[];return t.length>=2?`${t[0]?.[0]??``}${t[t.length-1]?.[0]??``}`.toUpperCase():(t[0]??e.email).slice(0,2).toUpperCase()}function zg(e){if(!e)return null;try{return new URL(`/billing`,e).href}catch{return null}}function Bg(e){if(!e)return`velloo-cloud`;try{return new URL(e).host}catch{return e}}function Vg(){return(0,H.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`settings-update-dot`,className:`absolute -right-0.5 -top-0.5 size-2 rounded-full bg-primary ring-2 ring-background`})}function Hg(){let e=B(e=>e.authStatus),t=B(e=>e.openSignIn),n=B(e=>e.setSettingsScope),r=B(e=>e.setPublishedBoardsOpen),i=B(e=>e.setFeedbackOpen),{status:a,upgrading:o}=Tg(),s=!!(a?.available&&a.upgradable),c=()=>{B.getState().refreshAuth(),Eg()};(0,M.useEffect)(c,[]);let l=e?.loggedIn??!1,u=e?.account,d=l&&e?.verified===!1,f=u?.tier?`${Fg(u.tier)} plan`:null,p=u?.tier===`free`?zg(e?.appUrl):null;return(0,H.jsxs)(su,{onOpenChange:e=>e&&c(),children:[(0,H.jsx)(cu,{asChild:!0,children:l&&u?(0,H.jsxs)(W,{variant:`ghost`,size:`sm`,className:`relative max-w-[12rem] gap-2 pl-1 pr-2.5 text-xs`,title:`${u.email} — account & settings`,children:[(0,H.jsx)(Mg,{"aria-hidden":`true`,className:`size-6`,children:(0,H.jsx)(Ng,{className:`text-[10px] font-semibold `+(d?`bg-muted text-muted-foreground`:`bg-primary text-primary-foreground`),children:Rg(u)})}),(0,H.jsx)(`span`,{className:`truncate`,children:Lg(u)}),s?(0,H.jsx)(Vg,{}):null]}):(0,H.jsxs)(W,{variant:`outline`,size:`sm`,className:`relative max-w-[12rem] text-xs`,title:`Settings & account`,children:[(0,H.jsx)(ir,{}),(0,H.jsx)(`span`,{className:`truncate`,children:`Settings`}),s?(0,H.jsx)(Vg,{}):null]})}),(0,H.jsxs)(lu,{align:`end`,className:`w-64`,children:[(0,H.jsx)(uu,{className:`font-normal`,children:l?(0,H.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,H.jsxs)(`span`,{className:`text-[11px] text-muted-foreground`,children:[`Signed in to `,Bg(e?.cloudUrl)]}),(0,H.jsx)(`span`,{className:`truncate text-sm`,children:u?.name??u?.email??`Signed in`}),u?.name&&u.email?(0,H.jsx)(`span`,{className:`truncate text-[11px] text-muted-foreground`,children:u.email}):null,f?(0,H.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:f}):null]}):(0,H.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,H.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`Not signed in`}),(0,H.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`Sign in to publish boards and pull comments.`})]})}),d?(0,H.jsxs)(Kh,{variant:`destructive`,className:`mb-1 gap-1.5 border-0 bg-transparent px-2 py-0`,children:[(0,H.jsx)(Sr,{size:12,className:`mt-px shrink-0`}),(0,H.jsx)(Jh,{className:`text-[11px] text-destructive`,children:`This credential expired — sign in again.`})]}):null,l?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(du,{}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-2 py-1.5 text-xs`,"data-testid":`settings-credits`,children:[(0,H.jsxs)(`span`,{className:`flex items-center gap-2 text-muted-foreground`,children:[(0,H.jsx)(Jt,{size:14,className:`shrink-0`}),`Credits`]}),typeof u?.creditMicros==`number`?(0,H.jsx)(`span`,{className:`font-medium tabular-nums`,children:Ig(u.creditMicros)}):(0,H.jsx)(`span`,{className:`text-muted-foreground`,title:u?.creditMicros===null?`velloo-cloud couldn't read the balance just now.`:`This velloo-cloud doesn't report a credit balance.`,children:`—`})]}),p?(0,H.jsx)(Z,{asChild:!0,children:(0,H.jsxs)(`a`,{href:p,target:`_blank`,rel:`noreferrer`,className:`text-inherit no-underline`,"data-testid":`settings-upgrade`,children:[(0,H.jsx)(ur,{className:`text-primary`}),`Upgrade plan`,(0,H.jsx)(`span`,{className:`ml-auto text-[10px] text-muted-foreground`,children:`Free`})]})}):null]}):null,(0,H.jsx)(du,{}),(0,H.jsxs)(Z,{onSelect:()=>n(`design`),children:[(0,H.jsx)(cr,{}),`Settings…`]}),l?(0,H.jsxs)(Z,{"data-testid":`settings-published-boards`,onSelect:()=>r(!0),children:[(0,H.jsx)(rn,{}),`Published boards…`]}):null,l&&e?.appUrl?(0,H.jsx)(Z,{asChild:!0,children:(0,H.jsxs)(`a`,{href:e.appUrl,target:`_blank`,rel:`noreferrer`,className:`text-inherit no-underline`,"data-testid":`settings-open-cloud`,children:[(0,H.jsx)(en,{}),`Open Velloo Cloud`]})}):null,s?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(Z,{disabled:o,"data-testid":`settings-upgrade-velloo`,title:`You're on ${a?.current}`,onSelect:e=>{e.preventDefault(),jg()},children:[(0,H.jsx)(Wt,{className:`text-primary`}),o?`Updating velloo…`:`Update velloo`]}),(0,H.jsx)(`div`,{className:`truncate px-2 pb-1 pl-8 text-[11px] text-muted-foreground`,children:Dg(a?.latest)})]}):null,(0,H.jsxs)(Z,{"data-testid":`settings-feedback`,onSelect:()=>i(!0),title:l&&!d?void 0:`Sending feedback needs a velloo cloud account — you can sign in from the dialog.`,children:[(0,H.jsx)(zt,{}),`Send feedback…`]}),(0,H.jsx)(du,{}),l&&!d?(0,H.jsxs)(Z,{onSelect:async()=>{try{await Bo.logout(),await B.getState().refreshAuth(),L({kind:`success`,message:`Signed out of velloo-cloud.`})}catch(e){R(e,`Could not sign out.`)}},children:[(0,H.jsx)(wn,{}),`Log out`]}):(0,H.jsxs)(Z,{onSelect:()=>t(d?{expired:!0}:{}),children:[(0,H.jsx)(Cn,{}),d?`Sign in again…`:`Sign in to velloo-cloud…`]})]})]})}var Ug=e=>e.name||e.email||`this guest`;function Wg(){let e=B(e=>e.guestsBoard),t=B(e=>e.openGuests),n=B(e=>Vr(e.authStatus?.account?.tier)),r=B(e=>zg(e.authStatus?.appUrl)),[i,a]=(0,M.useState)(null),[o,s]=(0,M.useState)(``),[c,l]=(0,M.useState)(``),[u,d]=(0,M.useState)(!1),[f,p]=(0,M.useState)(null),[m,h]=(0,M.useState)(null),g=e?.slug??null;(0,M.useEffect)(()=>{if(!g)return;a(null),s(``),l(``),p(null),h(null);let e=!1;return ds.guests.list(g).then(t=>{e||a(t)}).catch(t=>{e||(R(t,`Could not read this board's guests`),a([]))}),()=>{e=!0}},[g]);let _=()=>t(null),v=e=>a(t=>[...(t??[]).filter(t=>t.id!==e.id),e]),y=(e,t)=>{if(v(e.guest),e.emailed||!e.guestUrl){L({kind:`success`,message:t}),p(null);return}p({who:Ug(e.guest),url:e.guestUrl,note:`Email isn't available here${e.reason?` (${e.reason})`:``}, so send this link yourself.`})},b=async e=>{if(e.preventDefault(),g&&o.trim()){d(!0);try{let e=await ds.guests.invite(g,{email:o.trim(),...c.trim()?{name:c.trim()}:{}});y(e,`Invited ${Ug(e.guest)} — they'll get an email with their link.`),s(``),l(``)}catch(e){R(e,`Could not invite that guest`)}finally{d(!1)}}},x=async e=>{if(g)try{let t=await ds.guests.resend(g,e.id);y(t,`Emailed ${Ug(e)} a new link — the one they had stops working.`)}catch(e){R(e,`Could not resend that guest's link`)}},S=async e=>{if(g)try{let t=await ds.guests.link(g,e.id);p({who:Ug(e),url:t,note:`The link they had before no longer works.`}),await Gg(t,`New guest link copied — the one they had before no longer works.`)}catch(e){R(e,`Could not make a new link for that guest`)}},C=async e=>{if(g){h(null);try{await ds.guests.remove(g,e.id),a(t=>t?.filter(t=>t.id!==e.id)??null),f?.who===Ug(e)&&p(null),L({kind:`success`,message:`${Ug(e)} can no longer open this board.`})}catch(e){R(e,`Could not remove that guest`)}}};return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Cl,{open:e!==null,onOpenChange:e=>!e&&_(),children:(0,H.jsxs)(El,{className:`sm:max-w-md`,children:[(0,H.jsxs)(Dl,{children:[(0,H.jsxs)(kl,{children:[`Guests on “`,e?.title,`”`]}),(0,H.jsx)(Al,{children:`People outside your organization who can open this board, and only this board, through a personal link. They don't need an account.`})]}),n?null:(0,H.jsxs)(Kh,{role:`note`,"data-testid":`guests-upsell`,children:[(0,H.jsx)(Sn,{}),(0,H.jsx)(qh,{children:`Invite guests`}),(0,H.jsx)(Jh,{className:`text-xs`,children:`Share a board with people outside your organization by email. Upgrade your plan to invite guests.`}),r&&(0,H.jsx)(Yh,{children:(0,H.jsx)(W,{size:`xs`,variant:`secondary`,asChild:!0,children:(0,H.jsx)(`a`,{href:r,target:`_blank`,rel:`noreferrer`,children:`Upgrade`})})})]}),(0,H.jsxs)(`form`,{className:`grid gap-2`,onSubmit:e=>void b(e),children:[(0,H.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto] gap-2 sm:grid-cols-[3fr_2fr]`,children:[(0,H.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,H.jsx)(G,{htmlFor:`guest-email`,children:`Email`}),(0,H.jsx)(Q,{id:`guest-email`,type:`email`,autoComplete:`off`,placeholder:`name@company.com`,value:o,disabled:!n||u,onChange:e=>s(e.target.value)})]}),(0,H.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,H.jsx)(G,{htmlFor:`guest-name`,children:`Name (optional)`}),(0,H.jsx)(Q,{id:`guest-name`,autoComplete:`off`,value:c,disabled:!n||u,onChange:e=>l(e.target.value)})]})]}),(0,H.jsxs)(W,{type:`submit`,size:`sm`,className:`justify-self-start`,disabled:!n||u||!o.trim(),children:[(0,H.jsx)(Er,{}),u?`Inviting…`:`Invite`]})]}),f?(0,H.jsxs)(`div`,{className:`grid gap-1.5 rounded-md border bg-muted/40 p-2`,"data-testid":`guest-handover`,children:[(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Link for `,f.who,`. `,f.note]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(Q,{readOnly:!0,value:f.url,className:`font-mono text-xs`}),(0,H.jsx)(W,{variant:`outline`,size:`icon-sm`,title:`Copy link`,"aria-label":`Copy guest link`,onClick:()=>void Gg(f.url,`Guest link copied.`),children:(0,H.jsx)(Xt,{})})]})]}):null,i===null?(0,H.jsxs)(`div`,{className:`flex items-center gap-2 py-4 text-sm text-muted-foreground`,children:[(0,H.jsx)(Zu,{size:16}),`Reading guests…`]}):i.length===0?(0,H.jsx)(zh,{size:`panel`,icon:Or,title:`No guests yet`,hint:`Invite someone by email and they'll get a link to this board.`}):(0,H.jsx)(`ul`,{className:`-mx-1 max-h-64 overflow-y-auto px-1`,"data-testid":`guests-list`,children:i.map(e=>(0,H.jsx)(`li`,{children:(0,H.jsxs)(cg,{variant:`outline`,size:`sm`,className:`mb-1.5`,children:[(0,H.jsxs)(lg,{className:`min-w-0`,children:[(0,H.jsx)(ug,{className:`max-w-full truncate`,children:Ug(e)}),(0,H.jsxs)(dg,{className:`truncate text-xs`,children:[e.name&&e.email?`${e.email} · `:``,e.lastSeenAt?`Last opened ${mg(e.lastSeenAt)}`:`Not opened yet`]})]}),(0,H.jsx)(fg,{children:(0,H.jsxs)(su,{children:[(0,H.jsx)(cu,{asChild:!0,children:(0,H.jsx)(W,{variant:`ghost`,size:`icon-sm`,"aria-label":`Actions for ${Ug(e)}`,children:(0,H.jsx)($t,{})})}),(0,H.jsxs)(lu,{align:`end`,children:[(0,H.jsxs)(Z,{disabled:!n,onSelect:()=>void S(e),title:`Makes a new link — the one they had stops working`,children:[(0,H.jsx)(vn,{}),`Copy a new link`]}),(0,H.jsxs)(Z,{disabled:!n,onSelect:()=>void x(e),title:`Emails a new link — the one they had stops working`,children:[(0,H.jsx)(Tn,{}),`Email a new link`]}),(0,H.jsx)(du,{}),(0,H.jsxs)(Z,{variant:`destructive`,onSelect:()=>h(e),children:[(0,H.jsx)(xr,{}),`Remove`]})]})]})})]})},e.id))}),(0,H.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`A new link, copied or emailed, replaces the one the guest had.`}),(0,H.jsx)(Ol,{children:(0,H.jsx)(W,{variant:`outline`,onClick:_,children:`Done`})})]})}),(0,H.jsx)(iu,{open:m!==null,title:`Remove ${m?Ug(m):`this guest`}?`,description:`Their link stops working right away. You can invite them again later.`,confirmLabel:`Remove`,onConfirm:()=>{m&&C(m)},onCancel:()=>h(null)})]})}async function Gg(e,t){try{await navigator.clipboard.writeText(e),L({kind:`success`,message:t})}catch{}}var Kg=[{id:`actions`,label:`Actions`},{id:`forms`,label:`Forms & Inputs`},{id:`display`,label:`Display`},{id:`feedback`,label:`Feedback`},{id:`navigation`,label:`Navigation`},{id:`overlays`,label:`Overlays`},{id:`layout`,label:`Layout`},{id:`typography`,label:`Typography`},{id:`visuals`,label:`Visuals`},{id:`chat`,label:`Chat & AI`}];function qg(e){return Kg.find(t=>t.id===e)?.label??`Components`}function Jg(e){return e.family===void 0||e.family===e.id}var Yg=`other`;function Xg(e){if(!e||e.length===0)return[];let t=new Map;for(let n of e){if(!Jg(n))continue;let e=n.group??Yg;t.set(e,[...t.get(e)??[],n.id])}let n=[...Kg.map(e=>e.id),Yg];return[...t.entries()].sort(([e],[t])=>n.indexOf(e)-n.indexOf(t)).map(([e,t])=>({id:e,label:qg(e===Yg?void 0:e),components:[...t].sort((e,t)=>e.localeCompare(t))}))}function Zg(e,t){let n=e?.find(e=>e.id===t);return n?qg(n.group):null}function Qg(e){return e.default===void 0?null:typeof e.default==`string`?`"${e.default}"`:typeof e.default==`number`||typeof e.default==`boolean`?String(e.default):`…`}function $g({className:e,...t}){return(0,H.jsx)(`nav`,{"aria-label":`breadcrumb`,"data-slot":`breadcrumb`,className:V(e),...t})}function e_({className:e,...t}){return(0,H.jsx)(`ol`,{"data-slot":`breadcrumb-list`,className:V(`flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground`,e),...t})}function t_({className:e,...t}){return(0,H.jsx)(`li`,{"data-slot":`breadcrumb-item`,className:V(`inline-flex items-center gap-1`,e),...t})}function n_({asChild:e,className:t,...n}){let r=e?gt:`a`;return(0,H.jsx)(r,{"data-slot":`breadcrumb-link`,className:V(`transition-colors hover:text-foreground`,t),...n})}function r_({className:e,...t}){return(0,H.jsx)(`span`,{"data-slot":`breadcrumb-page`,role:`link`,"aria-disabled":`true`,"aria-current":`page`,className:V(`font-normal text-foreground`,e),...t})}function i_({children:e,className:t,...n}){return(0,H.jsx)(`li`,{"data-slot":`breadcrumb-separator`,role:`presentation`,"aria-hidden":`true`,className:V(`[&>svg]:size-3.5`,t),...n,children:e??(0,H.jsx)(Ht,{className:`cn-rtl-flip`})})}function a_({category:e,name:t}){return(0,H.jsx)($g,{children:(0,H.jsxs)(e_,{className:`text-xs`,children:[(0,H.jsxs)(t_,{children:[(0,H.jsx)(gn,{size:12,strokeWidth:2}),(0,H.jsx)(n_,{href:`#`,children:`Library`})]}),(0,H.jsx)(i_,{}),(0,H.jsx)(t_,{children:(0,H.jsx)(`span`,{children:e})}),(0,H.jsx)(i_,{}),(0,H.jsx)(t_,{children:(0,H.jsx)(r_,{children:t})})]})})}function o_({onClick:e}){return(0,H.jsxs)(W,{variant:`ghost`,size:`sm`,onClick:e,className:`-ml-2 text-muted-foreground`,children:[(0,H.jsx)(Mt,{}),`Library`]})}var s_={exact:`border-emerald-500/40 text-emerald-700 dark:text-emerald-400`,adapted:`border-primary/40 text-primary`,unstyled:`border-amber-500/40 text-amber-700 dark:text-amber-400`,proxy:`border-amber-500/40 text-amber-700 dark:text-amber-400`,unavailable:`border-destructive/40 text-destructive`,fallback:`border-destructive/40 text-destructive`},c_={exact:`Renders the app's real component.`,adapted:`Renders through a canvas-safe adaptation.`,unstyled:`Renders without the app's styles.`,proxy:`A proxy snippet stands in for it.`,unavailable:`Can't render in the canvas — a labelled fallback stands in.`,fallback:`A fallback stands in for it.`};function l_({diagnostic:e,className:t}){if(!e)return null;let n=e.status;if(n===`exact`&&!e.observed)return null;let r=s_[n]??`text-muted-foreground`,i=c_[n]??n;return(0,H.jsx)(U,{variant:`outline`,"data-fidelity":n,className:`px-1.5 py-0 text-[10px] font-normal ${r} ${t??``}`,title:e.note?`${i} ${e.note}`:i,children:n})}function u_(e,t=!0){let n=B(e=>e.loadRepoStatus),r=t?e.join(`,`):``;(0,M.useEffect)(()=>{if(!r)return;let e=setTimeout(()=>void n(r.split(`,`)),250);return()=>clearTimeout(e)},[r,n])}function d_({...e}){return(0,H.jsx)(ft,{"data-slot":`collapsible`,...e})}function f_({...e}){return(0,H.jsx)(De,{"data-slot":`collapsible-trigger`,...e})}function p_({...e}){return(0,H.jsx)(ze,{"data-slot":`collapsible-content`,...e})}function m_({entry:e,diagnostic:t,previewLabel:n}){let[r,i]=(0,M.useState)(!1),a=g_(e,t,n);return(0,H.jsxs)(`div`,{className:`rounded-md border border-dashed px-4 py-3 flex flex-col gap-2`,children:[(0,H.jsxs)(`p`,{className:`text-sm`,children:[`Your agent can fix this: ask it to set up the design's`,` `,(0,H.jsx)(`span`,{className:`font-medium`,children:`preview entry`}),` — the file that gives the canvas the providers and styles your app's own entry gives its components.`]}),(0,H.jsxs)(d_,{open:r,onOpenChange:i,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(f_,{asChild:!0,children:(0,H.jsxs)(W,{size:`xs`,variant:`ghost`,className:`px-1.5 -ml-1.5`,children:[(0,H.jsx)(Ht,{className:`transition-transform ${r?`rotate-90`:``}`}),r?`Hide the prompt`:`See the prompt`]})}),(0,H.jsxs)(W,{size:`xs`,variant:`outline`,onClick:()=>void h_(a),children:[(0,H.jsx)(Xt,{}),`Copy prompt`]})]}),(0,H.jsx)(p_,{children:(0,H.jsx)(`pre`,{className:`mt-2 whitespace-pre-wrap rounded-md bg-muted/60 p-3 text-xs leading-relaxed font-mono`,children:a})})]})]})}async function h_(e){try{await navigator.clipboard.writeText(e),L({kind:`success`,message:`Prompt copied.`})}catch{L({kind:`info`,message:`Copy failed — select the prompt text instead.`})}}function g_(e,t,n){let r=[t.note,t.remedy].filter(Boolean).join(` `),i=(e.dataSources??[]).map(e=>e.name).join(`, `);return[`In Velloo, ${e.id} (from ${e.identity.importPath}) doesn't render on the canvas:`,`${t.status}${t.code?` (${t.code})`:``}. ${r}`.trim(),``,n?`The design's preview entry is currently: ${n}.`:`The design has no preview entry yet.`,``,...i?[`It reads its own data through ${i}, so the preview has to supply that too.`,``]:[],`Please run preview_status to see what the app's components need, then write the`,`preview entry with set_preview_entry: import the app's global stylesheet and wrap`,`children in the providers the app's own entry uses (theme, i18n, query client, …),`,`with fixtures instead of network calls. Re-run preview_status, and check`,`component_status for ${e.id} to confirm it renders.`].join(`
29
+ `)}function __({className:e,size:t=`default`,...n}){return(0,H.jsx)(`div`,{"data-slot":`card`,"data-size":t,className:V(`group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground ring-1 ring-foreground/10 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl`,e),...n})}function v_({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`card-footer`,className:V(`flex items-center rounded-b-xl border-t bg-muted/50 p-(--card-spacing)`,e),...t})}function y_({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full overflow-x-auto`,children:(0,H.jsx)(`table`,{"data-slot":`table`,className:V(`w-full caption-bottom text-sm`,e),...t})})}function b_({className:e,...t}){return(0,H.jsx)(`thead`,{"data-slot":`table-header`,className:V(`[&_tr]:border-b`,e),...t})}function x_({className:e,...t}){return(0,H.jsx)(`tbody`,{"data-slot":`table-body`,className:V(`[&_tr:last-child]:border-0`,e),...t})}function S_({className:e,...t}){return(0,H.jsx)(`tr`,{"data-slot":`table-row`,className:V(`border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted`,e),...t})}function C_({className:e,...t}){return(0,H.jsx)(`th`,{"data-slot":`table-head`,className:V(`h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0`,e),...t})}function w_({className:e,...t}){return(0,H.jsx)(`td`,{"data-slot":`table-cell`,className:V(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0`,e),...t})}var T_=`text-[10px] uppercase tracking-wider text-muted-foreground font-medium`;async function E_(e){try{await navigator.clipboard.writeText(e),L({kind:`success`,message:`Import copied.`})}catch{L({kind:`info`,message:e})}}function D_({id:e}){let t=B(e=>e.repoCatalog),n=B(e=>e.repoStatus),r=B(e=>e.themeVersion),i=B(e=>e.designMode===`dark`),a=B(e=>e.openLibrary),o=B(e=>e.refreshRepoStatus),s=t?.entries.find(t=>t.id===e)??null,c=(0,M.useMemo)(()=>s?(t?.entries??[]).filter(e=>e.id!==s.id&&e.identity.member!==void 0&&e.identity.importPath===s.identity.importPath&&e.identity.exportName===s.identity.exportName&&e.identity.app===s.identity.app):[],[t,s]);if(u_(s?[s.id]:[]),!t)return null;if(!s)return(0,H.jsxs)(`div`,{className:`flex-1 flex flex-col bg-background`,children:[(0,H.jsx)(`div`,{className:`px-8 pt-4`,children:(0,H.jsx)(o_,{onClick:()=>a(null)})}),(0,H.jsx)(zh,{icon:nr,title:`${e} isn't in the repo catalog`,hint:`The app may no longer use it, or discovery hasn't seen it yet.`})]});let l=n[s.id],u=s.source===`local`?`This app`:s.packageName??s.identity.importPath,d=hs(s),f=s.states.length>0?s.states:[null];return(0,H.jsx)(`div`,{className:`flex-1 overflow-auto bg-background`,"data-repo-detail":s.id,children:(0,H.jsxs)(`div`,{className:`mx-auto w-full max-w-5xl flex flex-col`,children:[(0,H.jsxs)(`header`,{className:`sticky top-0 z-10 bg-background/85 backdrop-blur-sm border-b px-8 pt-4 pb-5`,children:[(0,H.jsx)(o_,{onClick:()=>a(null)}),(0,H.jsx)(`div`,{className:`mt-3`,children:(0,H.jsx)(a_,{category:`Repo · ${u}`,name:s.id})}),(0,H.jsxs)(`div`,{className:`mt-2 flex items-baseline gap-2.5 flex-wrap`,children:[(0,H.jsx)(`h1`,{className:`text-3xl font-semibold tracking-tight`,children:s.id}),(0,H.jsx)(U,{variant:`outline`,className:`text-[10px] font-mono uppercase tracking-wider`,children:s.source===`local`?`app`:`package`}),s.recipe?(0,H.jsx)(U,{variant:`outline`,className:`text-[10px] font-mono`,children:s.recipe}):null,(0,H.jsx)(l_,{diagnostic:l})]}),s.description?(0,H.jsx)(`p`,{className:`mt-1.5 text-sm text-muted-foreground`,children:s.description}):null,s.dataSources&&s.dataSources.length>0?(0,H.jsxs)(`p`,{className:`mt-1.5 text-sm text-muted-foreground`,"data-repo-data-sources":!0,children:[`Reads its own data through`,` `,s.dataSources.map((e,t)=>(0,H.jsxs)(`span`,{children:[t>0?`, `:``,(0,H.jsx)(`span`,{className:`font-mono text-xs`,children:e.name}),e.from?(0,H.jsxs)(`span`,{className:`text-xs`,children:[` (`,e.from,`)`]}):null]},e.name)),`, so props alone won't fill it — a preview needs that data.`]}):null,s.qualifiedBecause?(0,H.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground italic`,children:[`Placed as `,(0,H.jsx)(`span`,{className:`font-mono`,children:s.id}),`: `,s.qualifiedBecause]}):null,(0,H.jsxs)(Km,{className:`mt-3 h-8 max-w-xl`,children:[(0,H.jsx)(Zm,{readOnly:!0,value:d,"aria-label":`Import`,className:`font-mono text-xs`,onFocus:e=>e.currentTarget.select()}),(0,H.jsx)(Jm,{align:`inline-end`,children:(0,H.jsx)(Xm,{size:`icon-xs`,"aria-label":`Copy import`,title:`Copy import`,onClick:()=>void E_(d),children:(0,H.jsx)(Xt,{})})})]})]}),l&&(l.note||l.remedy)?(0,H.jsxs)(`section`,{className:`px-8 pt-6 flex flex-col gap-2 text-sm`,children:[(0,H.jsx)(`div`,{className:T_,children:`Fidelity`}),l.note?(0,H.jsx)(`p`,{children:l.note}):null,l.remedy?(0,H.jsx)(`p`,{className:`text-muted-foreground`,children:l.remedy}):null,l.status!==`exact`&&l.status!==`adapted`?(0,H.jsx)(m_,{entry:s,diagnostic:l,previewLabel:t?.apps.find(e=>e.app===s.identity.app)?.preview.label}):null]}):null,(0,H.jsxs)(`section`,{className:`px-8 py-6 flex flex-col gap-3`,children:[(0,H.jsx)(`div`,{className:T_,children:`Preview`}),(0,H.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:f.map((e,t)=>(0,H.jsxs)(__,{className:`py-0 gap-0`,children:[(0,H.jsx)(`div`,{className:`p-3`,children:(0,H.jsx)(`iframe`,{src:ms(s.id,{state:t,w:480,h:200,v:r,dark:i}),title:`${s.id} ${e?.name??`preview`}`,loading:`lazy`,onLoad:()=>setTimeout(()=>void o([s.id]),1500),className:`block w-full h-[200px] border-0`})}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2 border-t px-3 py-1.5 text-xs`,children:[(0,H.jsx)(`span`,{className:`font-medium`,children:e?.name??`default`}),e?(0,H.jsxs)(`span`,{className:`text-muted-foreground truncate`,title:e.at,children:[e.source,e.at?` · ${e.at}`:``]}):null]})]},e?`${e.name}-${t}`:`default`))})]}),s.props.length>0?(0,H.jsxs)(`section`,{className:`px-8 pb-6 flex flex-col gap-3`,children:[(0,H.jsx)(`div`,{className:T_,children:`Props`}),(0,H.jsx)(O_,{props:s.props})]}):null,c.length>0||(s.parts?.length??0)>0?(0,H.jsxs)(`section`,{className:`px-8 pb-6 flex flex-col gap-3`,children:[(0,H.jsx)(`div`,{className:T_,children:`Parts`}),(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(c.length>0?c.map(e=>e.id):(s.parts??[]).map(e=>`${s.name}.${e}`)).map(e=>(0,H.jsx)(U,{variant:`outline`,className:`font-mono text-[11px]`,children:e},e))})]}):null,s.provenance.length>0?(0,H.jsxs)(`section`,{className:`px-8 pb-10 flex flex-col gap-3`,children:[(0,H.jsx)(`div`,{className:T_,children:`Used at`}),(0,H.jsx)(`ul`,{className:`flex flex-col gap-0.5 font-mono text-xs text-muted-foreground`,children:s.provenance.map(e=>(0,H.jsx)(`li`,{children:e},e))})]}):null]})})}function O_({props:e}){let t=e.filter(e=>!e.inherited),n=e.filter(e=>e.inherited),[r,i]=(0,M.useState)(!1);return(0,H.jsxs)(__,{className:`py-0`,children:[(0,H.jsxs)(y_,{children:[(0,H.jsx)(b_,{className:`sr-only`,children:(0,H.jsxs)(S_,{children:[(0,H.jsx)(C_,{children:`Prop`}),(0,H.jsx)(C_,{children:`Accepts`})]})}),(0,H.jsx)(x_,{children:t.map(e=>(0,H.jsx)(k_,{prop:e},e.name))})]}),n.length>0?(0,H.jsxs)(d_,{open:r,onOpenChange:i,children:[(0,H.jsxs)(f_,{className:`flex w-full items-center gap-1.5 border-t px-3 py-2 text-xs text-muted-foreground hover:text-foreground`,children:[(0,H.jsx)(Ht,{size:12,className:`transition-transform ${r?`rotate-90`:``}`}),n.length,` inherited prop`,n.length===1?``:`s`]}),(0,H.jsx)(p_,{children:(0,H.jsx)(y_,{children:(0,H.jsx)(x_,{children:n.map(e=>(0,H.jsx)(k_,{prop:e},e.name))})})})]}):null]})}function k_({prop:e}){return(0,H.jsxs)(S_,{"data-prop":e.name,children:[(0,H.jsxs)(w_,{className:`w-40 py-3 align-top`,children:[(0,H.jsx)(`div`,{className:`font-mono text-xs font-medium`,children:e.name}),(0,H.jsx)(`div`,{className:`mt-0.5 text-[10px] text-muted-foreground`,children:[e.optional?`optional`:`required`,e.slot?`slot`:null].filter(Boolean).join(` · `)})]}),(0,H.jsxs)(w_,{className:`py-3 whitespace-normal`,children:[(0,H.jsxs)(`div`,{className:`flex flex-row flex-wrap items-center gap-1`,children:[e.enumValues&&e.enumValues.length>0?e.enumValues.map(e=>(0,H.jsx)(U,{variant:`outline`,className:`font-mono text-[10px]`,children:String(e)},String(e))):(0,H.jsx)(U,{variant:`outline`,className:`font-mono text-[10px] text-muted-foreground max-w-full truncate`,title:e.type,children:e.type||e.control}),e.defaultValue?(0,H.jsxs)(`span`,{className:`ml-2 text-xs text-muted-foreground`,children:[`default: `,(0,H.jsx)(`span`,{className:`font-mono`,children:e.defaultValue})]}):null]}),e.description?(0,H.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:e.description}):null,!e.serializable&&e.constraint?(0,H.jsx)(`p`,{className:`mt-1 text-xs text-amber-700 dark:text-amber-400`,children:e.constraint}):null]})]})}function A_({item:e,snippets:t}){return e.kind===`snippet`?(0,H.jsx)(P_,{item:e,snippets:t}):e.kind===`repo`?(0,H.jsx)(D_,{id:e.id}):(0,H.jsx)(j_,{item:e})}function j_({item:e}){let t=B(e=>e.components),n=B(e=>e.themeVersion),r=B(e=>e.designMode),i=B(e=>e.openLibrary),a=(0,M.useMemo)(()=>t?t.find(t=>t.id===e.id)??null:null,[t,e.id]),o=Zg(t,e.id)??`Components`,s=r===`dark`?`&mode=dark`:``,c=a?.props.find(e=>e.name===`variant`&&e.enumValues),l=a?.props.find(e=>e.name===`size`&&e.enumValues),u=c?.enumValues??[],d=l?.enumValues??[],f=(t,r)=>{let i=r?.w??480,a=r?.h??180,o=t?`&props=${encodeURIComponent(JSON.stringify(t))}`:``;return`/api/render/component/${encodeURIComponent(e.id)}?w=${i}&h=${a}&v=${n}${o}${s}`};return(0,H.jsx)(`div`,{className:`flex-1 overflow-auto bg-background`,children:(0,H.jsxs)(`div`,{className:`mx-auto w-full max-w-5xl flex flex-col`,children:[(0,H.jsxs)(`header`,{className:`sticky top-0 z-10 bg-background/85 backdrop-blur-sm border-b px-8 pt-4 pb-5`,children:[(0,H.jsx)(o_,{onClick:()=>i(null)}),(0,H.jsx)(`div`,{className:`mt-3`,children:(0,H.jsx)(a_,{category:o,name:e.id})}),(0,H.jsxs)(`div`,{className:`mt-2 flex items-baseline gap-2.5 flex-wrap`,children:[(0,H.jsx)(`h1`,{className:`text-3xl font-semibold tracking-tight`,children:e.id}),a?(0,H.jsx)(U,{variant:`outline`,className:`text-[10px] font-mono uppercase tracking-wider`,children:a.source}):null,a?.designModeNotes?(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground italic`,children:a.designModeNotes}):null]})]}),(0,H.jsxs)(`section`,{className:`px-8 py-6 flex flex-col gap-3`,children:[(0,H.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground font-medium`,children:`Preview`}),(0,H.jsx)(__,{className:`py-0`,children:(0,H.jsx)(`div`,{className:`p-3`,children:(0,H.jsx)(`iframe`,{src:f(void 0,{w:720,h:220}),title:`${e.id} preview`,loading:`lazy`,className:`block w-full h-[220px] border-0`})})})]}),u.length>0||d.length>0?(0,H.jsxs)(`section`,{className:`px-8 pb-6 flex flex-col gap-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,H.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground font-medium`,children:`Variants`}),(0,H.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[u.length||1,` × `,d.length||1,` =`,` `,(u.length||1)*(d.length||1),` combinations`]})]}),(0,H.jsx)(M_,{componentId:e.id,variants:u,sizes:d,renderUrl:f})]}):null,a&&a.props.length>0?(0,H.jsxs)(`section`,{className:`px-8 pb-10 flex flex-col gap-3`,children:[(0,H.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground font-medium`,children:`Props`}),(0,H.jsx)(N_,{props:a.props})]}):null]})})}function M_({componentId:e,variants:t,sizes:n,renderUrl:r}){let i=t.length>0?t:[null],a=n.length>0?n:[null];return(0,H.jsx)(__,{className:`py-0`,children:(0,H.jsxs)(y_,{children:[(0,H.jsx)(b_,{className:`bg-muted/30`,children:(0,H.jsxs)(S_,{children:[(0,H.jsx)(C_,{className:`w-32 text-[10px] uppercase tracking-wider`,children:t.length>0?`variant`:``}),a.map((e,t)=>(0,H.jsx)(C_,{className:`text-center text-[10px] uppercase tracking-wider`,children:e??`preview`},e??`col-${t}`))]})}),(0,H.jsx)(x_,{children:i.map((t,n)=>(0,H.jsxs)(S_,{children:[(0,H.jsx)(w_,{className:`w-32 font-mono text-xs`,children:t??``}),a.map((i,a)=>{let o={};return t!==null&&(o.variant=t),i!==null&&(o.size=i),(0,H.jsx)(w_,{className:`p-3`,children:(0,H.jsx)(`iframe`,{src:r(o,{w:280,h:80}),title:`${e} ${t??``} ${i??``}`,loading:`lazy`,className:`w-full h-[80px] border-0`})},`${t??n}-${i??a}`)})]},t??`row-${n}`))})]})})}function N_({props:e}){return(0,H.jsx)(__,{className:`py-0`,children:(0,H.jsxs)(y_,{children:[(0,H.jsx)(b_,{className:`sr-only`,children:(0,H.jsxs)(S_,{children:[(0,H.jsx)(C_,{children:`Prop`}),(0,H.jsx)(C_,{children:`Accepts`})]})}),(0,H.jsx)(x_,{children:e.map(e=>(0,H.jsxs)(S_,{children:[(0,H.jsxs)(w_,{className:`w-32 py-3 align-top`,children:[(0,H.jsx)(`div`,{className:`font-mono text-xs font-medium`,children:e.name}),e.optional?(0,H.jsx)(`div`,{className:`mt-0.5 text-[10px] text-muted-foreground`,children:`optional`}):null]}),(0,H.jsxs)(w_,{className:`flex flex-row flex-wrap items-center gap-1 py-3`,children:[e.enumValues&&e.enumValues.length>0?e.enumValues.map(e=>(0,H.jsx)(U,{variant:`outline`,className:`font-mono text-[10px]`,children:String(e)},String(e))):(0,H.jsx)(U,{variant:`outline`,className:`font-mono text-[10px] text-muted-foreground`,children:e.control}),e.defaultValue?(0,H.jsxs)(`span`,{className:`ml-2 text-xs text-muted-foreground`,children:[`default: `,(0,H.jsx)(`span`,{className:`font-mono`,children:e.defaultValue})]}):null]})]},e.name))})]})})}function P_({item:e,snippets:t}){let n=B(e=>e.themeVersion),r=B(e=>e.designMode),i=B(e=>e.openLibrary),a=B(e=>e.openSnippetEditor),o=t.find(t=>t.id===e.id)??null,s=r===`dark`?`&mode=dark`:``;return(0,H.jsx)(`div`,{className:`flex-1 overflow-auto bg-background`,children:(0,H.jsxs)(`div`,{className:`mx-auto w-full max-w-5xl flex flex-col`,children:[(0,H.jsxs)(`header`,{className:`sticky top-0 z-10 bg-background/85 backdrop-blur-sm border-b px-8 pt-4 pb-5`,children:[(0,H.jsx)(o_,{onClick:()=>i(null)}),(0,H.jsx)(`div`,{className:`mt-3`,children:(0,H.jsx)(a_,{category:`Snippets`,name:o?.name??e.id})}),(0,H.jsxs)(`div`,{className:`mt-2 flex items-baseline gap-2.5 flex-wrap`,children:[(0,H.jsx)(`h1`,{className:`text-3xl font-semibold tracking-tight`,children:o?.name??e.id}),(0,H.jsx)(U,{variant:`outline`,className:`text-[10px] font-mono uppercase tracking-wider border-primary/40 text-primary`,children:`snippet`}),o?.unused?(0,H.jsx)(U,{variant:`outline`,className:`text-[10px] uppercase tracking-wider border-amber-500/40 text-amber-600 dark:text-amber-400`,title:`No screen reaches this snippet, directly or through another snippet — nothing renders it.`,children:`unused`}):null,(0,H.jsx)(`div`,{className:`ml-auto`,children:(0,H.jsxs)(W,{size:`sm`,onClick:()=>a(e.id),children:[(0,H.jsx)(Gn,{}),`Open in canvas`]})})]}),o?(0,H.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-x-2 gap-y-1 text-sm text-muted-foreground`,children:[(0,H.jsxs)(`span`,{children:[o.params.length,` parameter`,o.params.length===1?``:`s`]}),o.params.map(e=>(0,H.jsx)(F_,{param:e},e.name))]}):null]}),(0,H.jsxs)(`section`,{className:`px-8 py-6 flex flex-col gap-3`,children:[(0,H.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground font-medium`,children:`Preview`}),(0,H.jsx)(__,{className:`py-0`,children:(0,H.jsx)(`div`,{className:`p-3`,children:(0,H.jsx)(`iframe`,{src:`/api/render/snippet/${encodeURIComponent(e.id)}?w=720&h=260&v=${n}${s}`,title:`${e.id} preview`,loading:`lazy`,className:`block w-full h-[260px] border-0`})})})]}),o&&o.params.length>0?(0,H.jsxs)(`section`,{className:`px-8 pb-10 flex flex-col gap-3`,children:[(0,H.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground font-medium`,children:`Parameters`}),(0,H.jsx)(__,{className:`py-0`,children:(0,H.jsxs)(y_,{children:[(0,H.jsx)(b_,{className:`sr-only`,children:(0,H.jsxs)(S_,{children:[(0,H.jsx)(C_,{children:`Parameter`}),(0,H.jsx)(C_,{children:`Type`})]})}),(0,H.jsx)(x_,{children:o.params.map(e=>(0,H.jsxs)(S_,{children:[(0,H.jsxs)(w_,{className:`w-32 py-3 font-mono text-xs font-medium`,children:[`$`,e.name]}),(0,H.jsxs)(w_,{className:`flex flex-row flex-wrap items-center gap-1 py-3`,children:[(0,H.jsx)(U,{variant:`outline`,className:`font-mono text-[10px]`,children:e.type}),Qg(e)===null?(0,H.jsx)(`span`,{className:`ml-2 text-xs text-amber-600 dark:text-amber-400`,children:`required`}):(0,H.jsxs)(`span`,{className:`ml-2 text-xs text-muted-foreground`,children:[`default: `,(0,H.jsx)(`span`,{className:`font-mono`,children:Qg(e)})]})]})]},e.name))})]})})]}):null]})})}function F_({param:e}){let t=Qg(e);return(0,H.jsxs)(U,{variant:`outline`,className:`border-dashed font-mono text-[10px] text-muted-foreground`,title:`${e.type}${t===null?` · required`:``}`,children:[`$`,e.name,t===null?null:(0,H.jsxs)(`span`,{className:`opacity-70`,children:[` = `,t]})]})}function I_({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`skeleton`,className:V(`animate-pulse rounded-md bg-muted`,e),...t})}var L_=`\0all`,R_={Button:110,Badge:110,Heading:90,Text:80,Label:80,Input:100,Textarea:130,Switch:100,Checkbox:100,Slider:100,Progress:100,Skeleton:80,Separator:80,Divider:80,Toggle:100,Calendar:280,Icon:110,Placeholder:150,Avatar:110,Alert:140,Card:130,Tabs:110,Breadcrumb:80,Pagination:100,Accordion:150,RadioGroup:100,ToggleGroup:100,Select:100,Toaster:140,Gradient:130};function z_(e){return R_[e]??120}function B_({snippets:e}){let t=B(e=>e.components),n=B(e=>e.components===null&&e.componentsLoading),r=B(e=>e.openLibrary),i=B(e=>e.themeVersion),a=B(e=>e.designMode),[o,s]=(0,M.useState)(``),[c,l]=(0,M.useState)(null),u=(0,M.useMemo)(()=>Xg(t),[t]),d=(0,M.useMemo)(()=>{let t=[];for(let e of u)for(let n of e.components)t.push({ref:{kind:`component`,id:n},label:n,category:e.label,isSnippet:!1,previewHeight:z_(n)});for(let n of e)t.push({ref:{kind:`snippet`,id:n.id},label:n.name,category:`Snippets`,isSnippet:!0,...n.unused?{unused:!0}:{},previewHeight:150});return t},[u,e]),f=d.filter(e=>!e.isSnippet).length,p=d.filter(e=>e.isSnippet).length,m=o.trim().toLowerCase(),h=e=>!m||e.toLowerCase().includes(m),g=d.filter(e=>!(c&&e.category!==c||!h(e.label))),_=Array.from({length:3},()=>[]),v=Array.from({length:3},()=>0);for(let e of g){let t=0,n=v[0]??0;for(let e=1;e<3;e+=1){let r=v[e]??0;r<n&&(t=e,n=r)}_[t]?.push(e),v[t]=(v[t]??0)+e.previewHeight+60}let y=a===`dark`?`&mode=dark`:``;return(0,H.jsx)(`div`,{className:`flex-1 overflow-auto scroll-stable bg-background`,children:(0,H.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl flex flex-col`,children:[(0,H.jsxs)(`header`,{className:`px-8 pt-10 pb-5`,children:[(0,H.jsxs)(`div`,{className:`flex items-baseline gap-3`,children:[(0,H.jsx)(`h1`,{className:`text-3xl font-semibold tracking-tight`,children:`Library`}),(0,H.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[n?`loading components`:`${f} components`,` ·`,` `,p,` snippets`]})]}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground max-w-2xl`,children:`Everything you can drop onto a board. Click a tile to see variants and props.`})]}),(0,H.jsxs)(`div`,{className:`sticky top-0 z-20 bg-background/85 backdrop-blur-sm px-8 pt-3 pb-3`,children:[(0,H.jsx)(`div`,{className:`flex items-center gap-3 mb-3`,children:(0,H.jsxs)(Km,{className:`h-9 flex-1 max-w-md`,children:[(0,H.jsx)(Jm,{children:(0,H.jsx)(rr,{size:14,strokeWidth:2})}),(0,H.jsx)(Zm,{type:`text`,value:o,onChange:e=>s(e.target.value),placeholder:`Search components and snippets…`})]})}),(0,H.jsxs)(Yp,{type:`single`,value:c??L_,onValueChange:e=>{e&&l(e===L_?null:e)},"aria-label":`Component shelf`,className:`flex-wrap items-center justify-start gap-2`,children:[(0,H.jsx)(H_,{value:L_,label:`All ${d.length}`}),u.map(e=>{let t=d.filter(t=>t.category===e.label).length;return t===0?null:(0,H.jsx)(H_,{value:e.label,label:`${e.label} ${t}`},e.id)}),p>0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(pp,{orientation:`vertical`,className:`mx-1 h-5`}),(0,H.jsx)(H_,{value:`Snippets`,label:`Snippets ${p}`,accent:!0})]}):null]})]}),(0,H.jsxs)(`div`,{className:`px-8 pb-12 mt-5 flex flex-col gap-4`,children:[g.length>0?(0,H.jsx)(`div`,{className:`flex items-start gap-4`,children:_.map((e,t)=>{let n=`col-${t}`;return(0,H.jsx)(`div`,{className:`flex-1 flex flex-col gap-4 min-w-0`,children:e.map(e=>(0,H.jsx)(U_,{tile:e,previewMode:y,themeVersion:i,onClick:()=>r(e.ref)},`${e.ref.kind}:${e.ref.id}`))},n)})}):null,n?(0,H.jsx)(V_,{}):g.length===0?(0,H.jsx)(cl,{className:`py-16`,children:(0,H.jsxs)(ll,{children:[(0,H.jsx)(dl,{variant:`icon`,children:(0,H.jsx)(nr,{})}),(0,H.jsxs)(fl,{children:[`No matches for "`,o,`".`]}),(0,H.jsx)(pl,{children:`Try a shorter word, or clear the shelf filter above.`})]})}):null]})]})})}function V_(){return(0,H.jsx)(`div`,{className:`flex items-start gap-4`,"aria-hidden":`true`,children:[`left`,`middle`,`right`].map(e=>(0,H.jsxs)(`div`,{className:`flex-1 flex flex-col gap-4 min-w-0`,children:[(0,H.jsx)(I_,{className:`h-[160px] w-full`}),(0,H.jsx)(I_,{className:`h-[110px] w-full`}),(0,H.jsx)(I_,{className:`h-[140px] w-full`})]},e))})}function H_({value:e,label:t,accent:n}){return(0,H.jsx)(Xp,{value:e,className:`h-7 rounded-full px-3 text-xs whitespace-nowrap `+(n?`border-primary/40 bg-primary/5 text-primary hover:bg-primary/10 hover:text-primary data-[state=on]:bg-primary data-[state=on]:font-medium data-[state=on]:text-primary-foreground`:`bg-card text-muted-foreground data-[state=on]:bg-foreground data-[state=on]:font-medium data-[state=on]:text-background`),children:t})}function U_({tile:e,previewMode:t,themeVersion:n,onClick:r}){let i=e.isSnippet,a=e.ref.kind===`snippet`?`/api/render/snippet/${encodeURIComponent(e.ref.id)}?w=480&h=${e.previewHeight}&v=${n}${t}`:`/api/render/component/${encodeURIComponent(e.ref.id)}?w=480&h=${e.previewHeight}&v=${n}${t}`;return(0,H.jsx)(__,{className:`gap-0 py-0 transition-shadow `+(i?`ring-primary/25 hover:ring-primary/60`:`hover:ring-primary/40`),children:(0,H.jsxs)(`button`,{type:`button`,onClick:r,className:`block w-full text-left outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`,children:[(0,H.jsxs)(`div`,{className:`relative w-full overflow-hidden bg-background`,style:{height:e.previewHeight},children:[(0,H.jsx)(I_,{className:`absolute inset-0 rounded-none`}),(0,H.jsx)(`iframe`,{src:a,title:`${e.label} preview`,loading:`lazy`,className:`absolute inset-0 w-full h-full pointer-events-none border-0`})]}),(0,H.jsxs)(v_,{className:`flex items-center justify-between gap-2 border-t px-3 py-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,H.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full shrink-0 `+(i?`bg-primary`:`bg-muted-foreground`)}),(0,H.jsx)(`span`,{className:`text-xs font-medium truncate`,children:e.label})]}),(0,H.jsx)(U,{variant:i?`secondary`:`outline`,className:`px-1.5 py-0 text-[10px] uppercase tracking-wider `+(e.unused?`text-amber-600 dark:text-amber-400`:i?`text-primary`:`text-muted-foreground`),title:e.unused?`No screen reaches this snippet — nothing renders it.`:void 0,children:e.unused?`Unused`:i?`Snippet`:e.category})]})]})})}var W_=240,G_=4096,K_=[{name:`Mobile`,w:390,h:844},{name:`Tablet`,w:768,h:1024},{name:`Desktop`,w:1440,h:900}];function q_(e){return Math.max(W_,Math.min(G_,Math.round(e)))}function J_(){let e=B(e=>e.previewTarget),t=B(e=>e.setPreviewTarget),n=B(e=>e.designMode),r=B(e=>e.themeVersion),i=B(t=>e?t.screenVersions[e.screenId]??0:0),a=B(e=>{let t=e.design?.viewportPresets;return t&&t.length>0?t:K_}),[o,s]=(0,M.useState)(1200),[c,l]=(0,M.useState)(null),[u,d]=(0,M.useState)(900),[f,p]=(0,M.useState)(!1),m=(0,M.useRef)(null);(0,M.useEffect)(()=>{e&&(s(q_(e.w)),l(null),p(!1))},[e]),(0,M.useEffect)(()=>{if(!e)return;let t=m.current;if(!t)return;let n=()=>d(Math.max(200,Math.round(t.clientHeight)));n();let r=new ResizeObserver(n);return r.observe(t),()=>r.disconnect()},[e]);let h=e=>t=>{t.preventDefault();let n=t.currentTarget;n.setPointerCapture(t.pointerId);let r=t.clientX,i=c??o,a=t=>{let n=(t.clientX-r)*(e===`e`?2:-2);return q_(i+n)},u=e=>l(a(e)),d=e=>{n.removeEventListener(`pointermove`,u),n.removeEventListener(`pointerup`,d),n.removeEventListener(`pointercancel`,d),l(null),s(a(e))};n.addEventListener(`pointermove`,u),n.addEventListener(`pointerup`,d),n.addEventListener(`pointercancel`,d)};if(!e)return null;let g=c??o,_=Kl({screenId:e.screenId,width:o,height:u,...e.boardTheme?{boardTheme:e.boardTheme}:{},...e.scheme?{scheme:e.scheme}:{},canvasDefault:n,screenRevision:i,themeVersion:r});return(0,H.jsx)(Cl,{open:!0,onOpenChange:e=>!e&&t(null),children:(0,H.jsxs)(El,{className:`max-w-none sm:max-w-none w-[96vw] h-[94vh] flex flex-col gap-3 p-4 bg-card`,children:[(0,H.jsxs)(Dl,{className:`flex-row items-center gap-3 space-y-0 pr-10`,children:[(0,H.jsx)(kl,{className:`text-sm truncate`,children:e.name}),(0,H.jsx)(Al,{className:`sr-only`,children:`Full-screen preview with adjustable width`}),(0,H.jsxs)(`div`,{className:`ml-auto flex items-center gap-1.5`,children:[a.map(e=>(0,H.jsxs)(W,{variant:o===e.w&&c===null?`secondary`:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,onClick:()=>{l(null),s(q_(e.w))},children:[e.name,` `,(0,H.jsx)(`span`,{className:`text-muted-foreground tabular-nums`,children:e.w})]},e.name)),(0,H.jsx)(Y_,{value:g,onCommit:e=>s(q_(e))})]})]}),(0,H.jsx)(`div`,{className:`flex-1 min-h-0 overflow-auto rounded-lg border bg-muted px-4 py-5`,children:(0,H.jsxs)(`div`,{ref:m,className:`relative mx-auto h-full group/preview`,style:{width:g,minWidth:g},children:[(0,H.jsx)(`iframe`,{title:`Preview: ${e.name}`,src:_,onLoad:()=>p(!0),className:`h-full w-full border rounded-md bg-white`,style:{pointerEvents:c===null?`auto`:`none`}}),f?null:(0,H.jsx)(ed,{size:40}),(0,H.jsx)(`div`,{onPointerDown:h(`w`),className:`absolute top-0 left-0 h-full w-1.5 -translate-x-1 cursor-ew-resize rounded opacity-0 group-hover/preview:opacity-100 transition-opacity bg-primary/40 hover:bg-primary/70`,role:`presentation`}),(0,H.jsx)(`div`,{onPointerDown:h(`e`),className:`absolute top-0 right-0 h-full w-1.5 translate-x-1 cursor-ew-resize rounded opacity-0 group-hover/preview:opacity-100 transition-opacity bg-primary/40 hover:bg-primary/70`,role:`presentation`})]})})]})})}function Y_({value:e,onCommit:t}){let[n,r]=(0,M.useState)(String(e));return(0,M.useEffect)(()=>{r(String(e))},[e]),(0,H.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-muted-foreground tabular-nums`,children:[(0,H.jsx)(`input`,{type:`number`,value:n,min:W_,max:G_,"aria-label":`preview width`,onChange:e=>r(e.target.value),onBlur:()=>{let i=Number(n);if(!Number.isFinite(i)){r(String(e));return}i!==e&&t(i)},onKeyDown:t=>{t.key===`Enter`&&(t.preventDefault(),t.currentTarget.blur()),t.key===`Escape`&&(r(String(e)),t.currentTarget.blur())},className:`w-14 rounded-sm border bg-transparent px-1 py-0.5 text-right outline-none focus:bg-card [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`}),`px`]})}function X_({className:e,...t}){return(0,H.jsx)(de,{"data-slot":`checkbox`,className:V(`peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary`,e),...t,children:(0,H.jsx)(nt,{"data-slot":`checkbox-indicator`,className:`grid place-content-center text-current transition-none [&>svg]:size-3.5`,children:(0,H.jsx)(Bt,{})})})}var Z_={public:`Public — anyone with the link`,private:`Private — everyone in your organization`,team:e=>`Only ${e} — that team, plus your organization's owner and admins`};function Q_(e){let{boards:t,boardIds:n}=e;return(0,H.jsxs)(`div`,{className:`grid gap-4`,children:[(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(G,{htmlFor:`publish-title`,children:`Title`}),(0,H.jsx)(Q,{id:`publish-title`,value:e.title,onChange:t=>e.onTitleChange(t.target.value),placeholder:`Board title`})]}),t.length>0?(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(G,{children:`Boards`}),(0,H.jsx)(`div`,{className:`max-h-40 overflow-y-auto rounded-md border`,children:t.map(t=>(0,H.jsxs)(`div`,{className:`flex items-center gap-2 px-2.5 py-1.5 text-sm hover:bg-accent/50`,children:[(0,H.jsx)(X_,{id:`publish-board-${t.id}`,checked:n.includes(t.id),onCheckedChange:n=>e.onToggleBoard(t.id,n===!0)}),(0,H.jsx)(G,{htmlFor:`publish-board-${t.id}`,className:`flex-1 cursor-pointer truncate font-normal`,children:t.name}),(0,H.jsxs)(`span`,{className:`shrink-0 text-[11px] text-muted-foreground`,children:[t.frameCount,` frame`,t.frameCount===1?``:`s`]})]},t.id))})]}):(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`This folder has no boards, so every screen is published.`}),(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(G,{htmlFor:`publish-destination`,children:`Destination`}),(0,H.jsxs)(K,{value:e.destinationSlug,onValueChange:e.onDestinationChange,disabled:!!e.destinationError,children:[(0,H.jsx)(J,{id:`publish-destination`,children:(0,H.jsx)(q,{})}),(0,H.jsxs)(Y,{children:[e.matchingSlots.map(e=>(0,H.jsxs)(X,{value:e.slug,children:[`Update `,e.title||`Untitled design`]},e.slug)),(0,H.jsx)(X,{value:`new`,children:`Create a new link`})]})]}),e.destinationError?(0,H.jsx)(`p`,{className:`text-xs text-destructive`,children:e.destinationError}):e.selectedSlot?(0,H.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Matches this team, board selection, and source.`}):(0,H.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Creates a separate live URL and keeps existing review links unchanged.`})]}),e.protectedShares?(0,H.jsx)($_,{...e}):(0,H.jsx)(ev,{upgradeUrl:e.upgradeUrl}),e.publicComments?(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,H.jsxs)(`div`,{className:`grid gap-0.5`,children:[(0,H.jsx)(G,{htmlFor:`publish-public-comments`,children:`Let people outside your organization comment`}),(0,H.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:e.publicComments.keepsExisting?`They give their name to comment. Left alone, the link keeps its current setting.`:`They give their name to comment.`})]}),(0,H.jsx)(rg,{id:`publish-public-comments`,checked:e.publicComments.on,onCheckedChange:e.onPublicCommentsChange})]}):null,e.teams.length>1&&e.teamId?(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(G,{htmlFor:`publish-team`,children:`Team`}),(0,H.jsxs)(K,{value:e.teamId,onValueChange:e.onTeamChange,children:[(0,H.jsx)(J,{id:`publish-team`,children:(0,H.jsx)(q,{})}),(0,H.jsx)(Y,{children:e.teams.map(e=>(0,H.jsx)(X,{value:e.id,children:e.name},e.id))})]})]}):null]})}function $_({visibility:e,onVisibilityChange:t,teamOnlyName:n,password:r,onPasswordChange:i}){let[a,o]=(0,M.useState)(!1);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(G,{htmlFor:`publish-visibility`,children:`Visibility`}),(0,H.jsxs)(K,{value:e,onValueChange:e=>t(e===`private`||e===`team`?e:`public`),children:[(0,H.jsx)(J,{id:`publish-visibility`,children:(0,H.jsx)(q,{})}),(0,H.jsxs)(Y,{children:[(0,H.jsx)(X,{value:`public`,children:Z_.public}),(0,H.jsx)(X,{value:`private`,children:Z_.private}),n?(0,H.jsx)(X,{value:`team`,children:Z_.team(n)}):null]})]})]}),(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(G,{htmlFor:`publish-password`,children:`Password (optional)`}),(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(Q,{id:`publish-password`,className:`pr-10`,type:a?`text`:`password`,minLength:3,autoComplete:`new-password`,placeholder:`3+ characters`,value:r,onChange:e=>i(e.target.value)}),(0,H.jsx)(W,{type:`button`,variant:`ghost`,className:`absolute right-0 top-0 h-9 w-9 p-0`,onClick:()=>o(e=>!e),title:a?`Hide password`:`Show password`,"aria-label":a?`Hide password`:`Show password`,"aria-pressed":a,children:a?(0,H.jsx)(tn,{}):(0,H.jsx)(nn,{})})]}),(0,H.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Anyone with the password can view, signed in or not. Send it separately from the link.`})]})]})}function ev({upgradeUrl:e}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(G,{htmlFor:`publish-visibility`,children:`Visibility`}),(0,H.jsx)(Q,{id:`publish-visibility`,readOnly:!0,value:Z_.public,className:`bg-muted/40 text-muted-foreground`})]}),(0,H.jsxs)(Kh,{role:`note`,"data-testid":`protected-shares-upsell`,children:[(0,H.jsx)(Sn,{}),(0,H.jsx)(qh,{children:`Private and password-protected links`}),(0,H.jsx)(Jh,{className:`text-xs`,children:`Share only with your organization, or behind a password. Free accounts publish public links — upgrade your plan to unlock both.`}),e&&(0,H.jsx)(Yh,{children:(0,H.jsx)(W,{size:`xs`,variant:`secondary`,asChild:!0,children:(0,H.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,children:`Upgrade`})})})]})]})}function tv({run:e}){return(0,H.jsxs)(`div`,{className:`flex flex-col gap-3 py-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,H.jsx)(Zu,{size:16}),(0,H.jsx)(`span`,{children:e.message}),e.capture?(0,H.jsxs)(`span`,{className:`text-muted-foreground tabular-nums`,children:[e.capture.done,`/`,e.capture.total]}):null]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Capturing previews takes the longest. You can close this — the publish keeps going.`}),(0,H.jsx)(ov,{messages:e.warnings})]})}function nv({run:e,upgradeUrl:t,onInviteGuests:n}){let{result:r}=e;return(0,H.jsxs)(`div`,{className:`flex flex-col gap-3 py-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,H.jsx)(Gt,{size:15,className:`text-emerald-600 dark:text-emerald-500`}),(0,H.jsx)(`span`,{children:r.created?`Published.`:`Updated the existing link.`})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(Q,{readOnly:!0,value:r.shareUrl,className:`font-mono text-xs`}),(0,H.jsx)(W,{variant:`outline`,size:`icon-sm`,title:`Copy link`,onClick:()=>void iv(r.shareUrl),children:(0,H.jsx)(Xt,{})}),(0,H.jsx)(W,{variant:`outline`,size:`icon-sm`,title:`Open link`,asChild:!0,children:(0,H.jsx)(`a`,{href:r.shareUrl,target:`_blank`,rel:`noreferrer`,children:(0,H.jsx)(en,{})})})]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:av(r)}),n?(0,H.jsxs)(W,{variant:`outline`,size:`sm`,className:`self-start`,onClick:n,"data-testid":`publish-invite-guests`,children:[(0,H.jsx)(Er,{}),`Invite guests…`]}):null,(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[r.boards,` board`,r.boards===1?``:`s`,` · `,r.screens,` screen`,r.screens===1?``:`s`,` · `,r.files,` files · `,Math.round(r.bytes/1024),` `,`KB`,r.screenshots>0?` · ${r.screenshots} previews`:``]}),(0,H.jsx)(sv,{history:r.history,upgradeUrl:t}),(0,H.jsx)(ov,{messages:e.warnings})]})}function rv({run:e,upgradeUrl:t,onSeePublished:n,onSignIn:r}){return(0,H.jsxs)(`div`,{className:`flex flex-col gap-3 py-2`,children:[e.boardLimit?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(Kh,{role:`note`,"data-testid":`board-limit-notice`,children:[(0,H.jsx)(rn,{}),(0,H.jsxs)(qh,{children:[`All `,e.boardLimit.limit,` board slots on the `,Fg(e.boardLimit.tier),` plan are in use`]}),(0,H.jsx)(Jh,{className:`text-xs`,children:`Take one of your published boards down to free a slot, or upgrade for more. Re-publishing an existing link always works — the cap only counts new boards.`})]}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(W,{size:`sm`,onClick:n,children:`See published boards`}),t&&(0,H.jsx)(W,{size:`sm`,variant:`outline`,asChild:!0,children:(0,H.jsx)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,children:`Upgrade plan`})})]})]}):(0,H.jsxs)(`div`,{className:`flex items-start gap-2 text-sm text-destructive`,children:[(0,H.jsx)(Sr,{size:14,className:`mt-0.5 shrink-0`}),(0,H.jsx)(`span`,{children:e.message})]}),e.signInRequired?(0,H.jsx)(W,{onClick:r,className:`self-start`,children:`Sign in and try again…`}):null,(0,H.jsx)(ov,{messages:e.warnings})]})}async function iv(e){try{await navigator.clipboard.writeText(e),L({kind:`success`,message:`Share link copied.`})}catch{L({kind:`info`,message:e})}}function av(e){return e.onlyTeam?e.passwordProtected?`${e.onlyTeam}, your organization's owner and admins, or anyone with the password.`:`${e.onlyTeam}, plus your organization's owner and admins.`:e.visibility===`private`?e.passwordProtected?`Your organization, or anyone with the password.`:`Anyone signed in at your organization.`:e.passwordProtected?`Anyone with the link and the password.`:`Anyone with the link.`}function ov({messages:e}){return e.length===0?null:(0,H.jsx)(`ul`,{className:`flex flex-col gap-1 rounded-md border bg-muted/40 p-2 text-[11px] text-muted-foreground`,children:e.map(e=>(0,H.jsx)(`li`,{children:e},e))})}function sv({history:e,upgradeUrl:t}){return e?!e.retained&&e.pruned>0?(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Replaced the previous version — the free plan keeps only the latest.`,t&&(0,H.jsxs)(H.Fragment,{children:[` `,(0,H.jsx)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-4`,children:`Upgrade to keep history`}),`.`]})]}):e.retained&&e.versions>1?(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.versions,` versions kept — earlier publishes stay pinnable.`]}):null:null}function cv(e,t){let n=[];e.context.contextKnown||n.push(`board context is unknown`),e.teamId!==t.teamId&&n.push(`team differs`);let r=e=>[...new Set(e)].sort();return JSON.stringify(r(e.context.boardIds))!==JSON.stringify(r(t.boardIds))&&n.push(`board selection differs`),e.context.repo===t.repo?t.repo!==null&&(!e.context.branch||!t.branch?n.push(`branch is unavailable`):e.context.branch!==t.branch&&n.push(`branch differs`)):n.push(`repository differs`),n}function lv(e,t){return e.filter(e=>cv(e,t).length===0)}function uv(e,t){return lv(e,t).sort((e,t)=>dv(t.lastPublishedAt)-dv(e.lastPublishedAt))[0]??null}var dv=e=>{let t=e?Date.parse(e):NaN;return Number.isFinite(t)?t:-1/0},fv=700;function pv(){let e=B(e=>e.publishOpen),t=B(e=>e.setPublishOpen),n=B(e=>e.openSignIn),r=B(e=>e.setPublishedBoardsOpen),i=B(e=>e.openGuests),a=B(e=>e.settlePublish),o=B(e=>e.design),s=B(e=>e.publishScope),c=B(e=>zr(e.authStatus?.account?.tier)),l=B(e=>Br(e.authStatus?.account?.tier)),u=B(e=>Vr(e.authStatus?.account?.tier)),d=B(e=>zg(e.authStatus?.appUrl)),[f,p]=(0,M.useState)(null),[m,h]=(0,M.useState)({state:`idle`}),[g,_]=(0,M.useState)(``),[v,y]=(0,M.useState)([]),[b,x]=(0,M.useState)(`public`),[S,C]=(0,M.useState)(``),[w,T]=(0,M.useState)(null),[E,D]=(0,M.useState)(`new`),[O,k]=(0,M.useState)(!1),[A,ee]=(0,M.useState)(!1),[te,ne]=(0,M.useState)(!1),[re,ie]=(0,M.useState)(!1),[ae,oe]=(0,M.useState)(null),se=o?.boards??[],ce=(0,M.useCallback)(async e=>{ie(!0);try{h(await ds.start(e))}catch(e){R(e,`Could not start publishing`)}finally{ie(!1)}},[]);(0,M.useEffect)(()=>{if(!e)return;_(s?s.name:o?.designName?`${o.designName} designs`:``),y(s?[s.id]:[]),x(`public`),C(``),ee(!1),ne(!1),T(null),D(`new`),k(!1),ie(!1),oe(null);let t=!1;return(async()=>{let[e,n]=await Promise.all([ds.targets().catch(()=>({ready:!1,teams:[],slots:[]})),ds.status().catch(()=>({state:`idle`}))]);if(t)return;p(e),T(e.effectiveTeamId??(e.teams.find(e=>e.isDefault)??e.teams[0])?.id??null);let r=n;if(n.state===`done`||n.state===`error`){if(await ds.reset().catch(()=>void 0),t)return;r={state:`idle`}}h(r)})(),()=>{t=!0}},[e,o?.designName,s]),(0,M.useEffect)(()=>{m.state===`done`&&a(!0)},[m.state,a]),(0,M.useEffect)(()=>{if(!e||m.state!==`running`)return;let t=setInterval(()=>{ds.status().then(h).catch(()=>void 0)},fv);return()=>clearInterval(t)},[e,m.state]);let le=w??f?.effectiveTeamId??null,ue=(0,M.useMemo)(()=>({boardIds:v,teamId:le,repo:f?.provenance?.repo??null,branch:f?.provenance?.branch??null}),[v,le,f?.provenance]),de=(0,M.useMemo)(()=>{let e=uv(f?.slots??[],ue);return e?[e]:[]},[f?.slots,ue]),fe=de.find(e=>e.slug===E)??null,pe=de[0]?.slug??`new`;(0,M.useEffect)(()=>{O||D(pe)},[O,pe]),(0,M.useEffect)(()=>{E!==`new`&&!de.some(e=>e.slug===E)&&(k(!1),D(pe))},[E,de,pe]);let j=f?.teams??[],me=c&&l&&j.length>1?j.find(e=>e.id===w)?.name??null:null,he=c?b===`team`&&!me?`private`:b:`public`,ge=c?S:``,_e=he===`public`||ge.length>=3,ve=()=>{let e=fe?{mode:`update`,slug:fe.slug,expectedVersionId:fe.latestVersionId}:{mode:`new`},t=_e&&(!fe||te);return{boardIds:v,...g.trim()?{title:g.trim()}:{},visibility:he===`public`?`public`:`private`,...he===`team`?{teamOnly:!0}:{},...ge.length>=3?{password:ge}:{},...w?{teamId:w}:{},...t?{publicComments:A}:{},destination:e}},ye=async()=>{ie(!0);let e=await Vh(v).catch(()=>[]);if(e.length>0){ie(!1),oe(e);return}await ce(ve())},be=f===null?null:f.access??(f.ready?`ready`:`signed-out`),xe=be!==null&&be!==`ready`,Se=!xe&&m.state===`idle`?f?.blocked??null:null,Ce=be===`expired`,we=m.state===`unavailable`,Te=se.length>0&&v.length===0,Ee=e=>{t(!1),n({action:`publish these boards`,...e.expired?{expired:!0}:{}})};return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Uh,{failures:ae,verb:`Publish`,onCancel:()=>oe(null),onConfirm:()=>{oe(null),ce(ve())}}),(0,H.jsx)(Cl,{open:e,onOpenChange:e=>!e&&t(!1),children:(0,H.jsxs)(El,{className:`sm:max-w-md`,children:[(0,H.jsxs)(Dl,{children:[(0,H.jsx)(kl,{children:`Publish to velloo-cloud`}),(0,H.jsx)(Al,{children:s?`Share a rendered, commentable copy of “${s.name}” by link.`:`Share a rendered, commentable copy of these boards by link.`})]}),we?(0,H.jsx)(`p`,{className:`py-4 text-sm text-muted-foreground`,children:`This canvas isn't running through the velloo CLI, so it has no account to publish with.`}):xe?(0,H.jsxs)(`div`,{className:`flex flex-col gap-3 py-2`,children:[(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:Ce?`Your velloo-cloud session has ended. Sign in again to publish these boards.`:`Publishing needs a velloo-cloud account.`}),(0,H.jsx)(W,{onClick:()=>Ee({expired:Ce}),className:`self-start`,children:Ce?`Sign in again…`:`Sign in…`})]}):Se?(0,H.jsxs)(`p`,{className:`py-4 text-sm text-muted-foreground`,"data-testid":`publish-blocked`,children:[Se.charAt(0).toUpperCase()+Se.slice(1),`.`]}):m.state===`running`?(0,H.jsx)(tv,{run:m}):m.state===`done`?(0,H.jsx)(nv,{run:m,upgradeUrl:d,onInviteGuests:m.result.created&&u&&m.result.slug?()=>{t(!1),i({slug:m.result.slug,title:g.trim()||m.result.slug})}:null}):m.state===`error`?(0,H.jsx)(rv,{run:m,upgradeUrl:d,onSeePublished:()=>{t(!1),r(!0)},onSignIn:()=>Ee({expired:m.signInRequired===`expired`})}):(0,H.jsx)(Q_,{title:g,onTitleChange:_,boards:se,boardIds:v,onToggleBoard:(e,t)=>y(n=>t?[...new Set([...n,e])]:n.filter(t=>t!==e)),destinationSlug:E,onDestinationChange:e=>{k(!0),D(e)},matchingSlots:de,selectedSlot:fe,destinationError:f?.destinationError,protectedShares:c,visibility:he,onVisibilityChange:x,teamOnlyName:me,password:ge,onPasswordChange:C,upgradeUrl:d,teams:j,teamId:w,onTeamChange:T,publicComments:_e?{on:A,keepsExisting:!!fe&&!te}:null,onPublicCommentsChange:e=>{ne(!0),ee(e)}}),(0,H.jsxs)(Ol,{children:[(0,H.jsx)(W,{variant:`outline`,onClick:()=>t(!1),children:m.state===`done`?`Done`:`Close`}),m.state===`idle`&&!xe&&!we&&!Se?(0,H.jsxs)(W,{onClick:()=>void ye(),disabled:re||Te||!!f?.destinationError,children:[(0,H.jsx)(or,{}),re?`Starting…`:`Publish`]}):null,m.state===`error`?(0,H.jsx)(W,{onClick:()=>h({state:`idle`}),children:`Back`}):null]})]})})]})}var mv=`Moving a thread to the cloud republishes the conversation on the published board and removes the local copy. A board with no link yet is published first.`;function hv(){let e=B(e=>e.currentBoardId),t=B(e=>e.commentThreads),n=B(e=>e.commentStatus),r=B(e=>e.commentScope),i=B(e=>e.cloudComments),a=B(e=>e.activeCommentId),o=B(e=>e.refreshComments),s=B(e=>e.refreshCloudComments),c=B(e=>e.setCommentStatus),l=B(e=>e.setCommentScope),u=B(e=>e.setActiveComment),d=B(e=>e.locateComment),f=B(e=>e.createBoardComment),p=B(e=>e.replyToComment),m=B(e=>e.setCommentResolved),h=B(e=>e.moveCommentToCloud),g=B(e=>e.deleteComment),_=B(e=>e.deleteCommentMessage),v=B(e=>e.enterCommentMode),[y,b]=(0,M.useState)(``),[x,S]=(0,M.useState)(`local`),[C,w]=(0,M.useState)(null),[T,E]=(0,M.useState)(``),[D,O]=(0,M.useState)(null),k=t.find(e=>e.id===a)??null,A=(0,M.useMemo)(()=>Fl(t),[t]),ee=B(Ts),te=(0,M.useMemo)(()=>mh(ee),[ee]),ne=(0,M.useMemo)(()=>hh(ee),[ee]),re=D?t.find(e=>e.id===D.threadId)??null:null;return(0,M.useEffect)(()=>{e&&o()},[e,o]),(0,M.useEffect)(()=>{s()},[s]),(0,M.useEffect)(()=>{E(``)},[a]),(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-velloo-comments-panel":!0,children:[(0,H.jsx)(Eh,{status:n,onStatusChange:c,count:t.length,onAdd:v,children:(0,H.jsx)(Vm,{scope:r,onChange:l})}),(0,H.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:k?(0,H.jsx)(Ah,{thread:k,voice:te,canDelete:ne,onBack:()=>u(null),onRequestDelete:O,replyDraft:T,onReplyDraftChange:E,onReply:()=>void p(k.id,T).then(()=>E(``)),onResolve:()=>void m(k.id,k.status===`open`),children:k.scope===`local`?(0,H.jsx)(gv,{thread:k,cloud:i,onMoveToCloud:()=>void h(k.id),onRequestDelete:O}):null}):t.length>0?(0,H.jsx)(`ul`,{className:`space-y-1.5 p-2`,children:t.map(e=>(0,H.jsx)(Th,{thread:e,number:A.get(e.id)??0,onOpen:()=>u(e.id),onLocate:()=>d(e.id),onDelete:e.scope===`local`?()=>O({kind:`thread`,threadId:e.id}):void 0},e.id))}):(0,H.jsx)(Dh,{status:n})}),k?null:(0,H.jsx)(kh,{draft:y,onDraftChange:b,onSubmit:()=>{w(null),f(y,x).then(e=>{w(e),e||b(``)})},failure:C,target:(0,H.jsx)(Hm,{scope:x,onChange:S,cloud:i,className:`min-w-0 flex-1`}),help:Bm}),(0,H.jsx)(jh,{thread:re,pending:D,onCancel:()=>O(null),onConfirm:()=>{D&&(D.kind===`thread`?g(D.threadId):_(D.threadId,D.id),O(null))}})]})}function gv({thread:e,cloud:t,onMoveToCloud:n,onRequestDelete:r}){let i=t?.available===!1?t.reason:null,a=!!i&&i!==`unpublished`;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(W,{variant:`outline`,size:`sm`,disabled:t===void 0||a,title:a&&i?Qo(i):mv,onClick:n,children:[(0,H.jsx)(qt,{}),` Move to cloud`,i===`unpublished`?(0,H.jsx)(Sr,{className:`text-amber-600`}):null]}),(0,H.jsxs)(W,{variant:`ghost`,size:`sm`,className:`col-span-2 text-destructive`,onClick:()=>r({kind:`thread`,threadId:e.id}),children:[(0,H.jsx)(xr,{}),` Delete thread`]})]})}function _v(e,t){let n=(0,M.useRef)(null),r=(0,M.useRef)(t);return r.current=t,(0,M.useEffect)(()=>()=>{n.current&&clearTimeout(n.current)},[]),(0,M.useCallback)(t=>{n.current&&clearTimeout(n.current),n.current=setTimeout(()=>r.current(t),e)},[e])}function vv({initialValue:e,screenId:t,path:n,debounceMs:r}){let[i,a]=(0,M.useState)(e),o=(0,M.useRef)(null);(0,M.useEffect)(()=>()=>{o.current&&clearTimeout(o.current)},[]);let s=e=>{a(e),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{let r=e===``?null:e;I.updateProps({screenId:t,path:z(n),propPatch:{children:r}}).catch(e=>R(e,`Could not update text`))},r)};return(0,H.jsxs)(`section`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(G,{htmlFor:`prop-children`,className:`text-xs font-medium text-muted-foreground`,children:`text`}),(0,H.jsx)(np,{id:`prop-children`,value:i,onChange:e=>s(e.target.value),rows:2,className:`min-h-0`})]})}function yv({node:e,tree:t,path:n,theme:r,descriptor:i,snippet:a,classChannel:o,computed:s,measured:c,onChange:l}){let u=nd(),d=(0,M.useMemo)(()=>Nd(r),[r]),f=(0,M.useMemo)(()=>Pd(r),[r]),p=(0,M.useCallback)(e=>Md(r,e),[r]),m=(0,M.useMemo)(()=>Xd({node:e,descriptor:i,snippet:a}).controls.filter(e=>e.kind!==`prompt`&&(o||e.slot.via!==`style`)),[e,i,a,o]),h=(0,M.useMemo)(()=>Jf({theme:r,tree:t,path:z(n),node:e}),[r,t,n,e]);return m.length===0?null:(0,H.jsx)(mp,{delayDuration:300,children:(0,H.jsx)(`div`,{className:`grid grid-cols-2 gap-x-3 gap-y-2.5`,children:m.map(t=>{let n=zf(t,{node:e,themeValues:h.values,themeSource:h.source,computed:s}),r=t.kind===`color`||t.kind===`size`||t.kind===`prompt`;return(0,H.jsx)(`div`,{className:r?`col-span-2`:``,children:(0,H.jsx)(Qp,{label:t.label,origin:n.origin,themeValue:n.themeValue,source:n.source,width:0,note:h.notes?.[t.id],onReset:n.origin===`changed`?()=>l(t,null):void 0,children:(0,H.jsx)(bm,{spec:t,value:n,colors:d,resolveColor:p,fonts:f,iconNames:u,measured:t.slot.via===`style`&&t.slot.key===`height`?c?.h??null:c?.w??null,onOpenPrompt:()=>void 0,onChange:(e,n)=>l(t,e,n)})})},t.id)})})})}var bv=/^[a-zA-Z][a-zA-Z0-9_-]*$/;function xv({initialValue:e,screenId:t,path:n}){let[r,i]=(0,M.useState)(e),[a,o]=(0,M.useState)(null);return(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-xs`,children:[(0,H.jsxs)(`label`,{htmlFor:`velloo-node-id`,className:`flex items-center justify-between text-muted-foreground uppercase tracking-wider`,children:[(0,H.jsx)(`span`,{children:`Stable id`}),a?(0,H.jsx)(`span`,{className:`normal-case text-destructive`,children:a}):null]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,H.jsx)(`span`,{className:`text-muted-foreground font-mono`,children:`@`}),(0,H.jsx)(Q,{id:`velloo-node-id`,type:`text`,inputMode:`text`,autoComplete:`off`,spellCheck:!1,value:r,placeholder:`(none)`,onChange:e=>{i(e.target.value),o(null)},onBlur:()=>{let a=r.trim();if(a!==e){if(a!==``&&!bv.test(a)){o(`letters/digits/_/- only, leading letter`);return}o(null),I.setNodeId({screenId:t,path:z(n),id:a===``?null:a}).catch(t=>{R(t,`Could not set node id`),i(e)})}},onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),t.currentTarget.blur()):t.key===`Escape`&&(i(e),o(null),t.currentTarget.blur())},"aria-invalid":a!==null,className:`flex-1 font-mono`})]})]})}var Sv=`__velloo_unset__`;function Cv(e,t){return e===`node`?JSON.stringify(t??null):t==null?``:typeof t==`string`?t:typeof t==`number`||typeof t==`boolean`?String(t):JSON.stringify(t)}function wv(e){let{kind:t,id:n,compact:r}=e,[i,a]=(0,M.useState)(()=>Cv(t,e.initialValue)),[o,s]=(0,M.useState)(!!e.initialValue),c=t===`enum`&&!(e.enumValues&&e.enumValues.length>0)||t===`icon`&&!e.iconNames?`string`:t,l=r?`flex flex-col gap-1`:`flex flex-col gap-1.5`,u=(0,H.jsx)(G,{htmlFor:n,className:e.labelClassName??(r?`text-[10px]`:`text-xs`),children:e.label});if(c===`boolean`){let t=t=>{s(t),e.onCommit(t)};return(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,title:e.title,children:[u,(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(X_,{id:n,checked:o,onCheckedChange:e=>t(!!e)}),(0,H.jsx)(`span`,{className:r?`text-[11px] text-muted-foreground`:`text-xs text-muted-foreground`,children:String(o)})]})]})}if(c===`icon`)return(0,H.jsxs)(`div`,{className:l,title:e.title,children:[u,(0,H.jsx)(Vp,{value:i,options:e.iconNames??[],onChange:t=>{a(t),e.onCommit(t)}})]});if(c===`enum`){let t=e.enumValues??[],o=typeof t[0]==`number`;return(0,H.jsxs)(`div`,{className:l,title:e.title,children:[u,(0,H.jsxs)(K,{value:i===``?e.allowUnset?Sv:``:i,onValueChange:t=>{if(t===Sv){a(``),e.onCommit(void 0);return}a(t),e.onCommit(o?Number(t):t)},children:[(0,H.jsx)(J,{id:n,size:`sm`,className:r?`text-xs`:`text-sm`,children:(0,H.jsx)(q,{placeholder:e.placeholder??`(unset)`})}),(0,H.jsxs)(Y,{children:[e.allowUnset?(0,H.jsx)(X,{value:Sv,children:`(unset)`}):null,t.map(e=>(0,H.jsx)(X,{value:String(e),children:String(e)},String(e)))]})]})]})}if(c===`number`)return(0,H.jsxs)(`div`,{className:l,title:e.title,children:[u,(0,H.jsx)(Q,{id:n,type:`number`,value:i,min:e.min,max:e.max,step:e.step,placeholder:e.placeholder,onChange:t=>{if(a(t.target.value),t.target.value===``&&e.emptyAsUndefined){e.onCommit(void 0);return}let n=Number(t.target.value);Number.isFinite(n)&&e.onCommit(n)},className:r?`h-7 text-xs`:void 0})]});if(c===`color`){let t=t=>{a(t),e.onCommit(e.emptyAsUndefined&&t===``?void 0:t)};return(0,H.jsxs)(`div`,{className:l,title:e.title,children:[u,(0,H.jsxs)(`div`,{className:r?`flex items-center gap-1.5`:`flex items-center gap-2`,children:[(0,H.jsx)(`input`,{type:`color`,"aria-label":`${e.name} color picker`,value:i.startsWith(`#`)?i:`#000000`,onChange:e=>t(e.target.value),className:`h-7 w-9 shrink-0 cursor-pointer rounded-md border border-input bg-transparent`}),(0,H.jsx)(Q,{id:n,type:`text`,value:i,placeholder:e.placeholder,onChange:e=>t(e.target.value),className:r?`h-7 flex-1 font-mono text-xs`:`flex-1 font-mono`})]})]})}return c===`node`?(0,H.jsxs)(`div`,{className:l,title:e.title,children:[u,(0,H.jsx)(Q,{id:n,value:i,placeholder:e.placeholder??`{"$ref":"Text","props":{"children":"..."}}`,onChange:t=>{a(t.target.value);try{e.onCommit(JSON.parse(t.target.value))}catch{}},className:`h-7 font-mono text-[10px]`})]}):(0,H.jsxs)(`div`,{className:l,title:e.title,children:[u,(0,H.jsx)(Q,{id:n,type:`text`,value:i,placeholder:e.placeholder,onChange:t=>{a(t.target.value),e.onCommit(e.emptyAsUndefined&&t.target.value===``?void 0:t.target.value)},className:r?`h-7 text-xs`:void 0})]})}function Tv(e){switch(e.control){case`boolean`:case`number`:case`color`:return e.control;case`icon`:case`enum`:return e.enumValues?e.control:`string`;default:return`string`}}function Ev({descriptor:e,initialValue:t,onChange:n}){let r=Tv(e);return(0,H.jsx)(wv,{kind:r,id:`prop-${e.name}`,name:e.name,label:(0,H.jsxs)(H.Fragment,{children:[e.name,e.optional?null:(0,H.jsx)(`span`,{className:`text-destructive`,children:` *`})]}),labelClassName:`text-xs font-medium text-muted-foreground capitalize`,initialValue:t,onCommit:n,emptyAsUndefined:!0,allowUnset:e.optional,enumValues:e.enumValues,iconNames:r===`icon`?e.enumValues:void 0,placeholder:r===`color`?`oklch(... 0 0) or #rrggbb`:void 0})}function Dv({repo:e,entry:t}){let n=B(e=>e.repoCatalog),r=B(e=>t?e.repoStatus[t.id]:void 0),i=B(e=>e.openLibrary);u_(t?[t.id]:[]);let a=[e.exportName,e.member].filter(Boolean).join(`.`),o=t?n?.entries.find(e=>!e.identity.member&&e.identity.importPath===t.identity.importPath&&e.identity.exportName===t.identity.exportName&&e.identity.app===t.identity.app)?.id??t.id:null;return(0,H.jsxs)(`section`,{className:`flex flex-col gap-2 rounded-md border p-3`,"data-repo-block":``,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs uppercase tracking-wider text-muted-foreground`,children:[(0,H.jsx)(Lt,{size:12,strokeWidth:2}),(0,H.jsx)(`span`,{className:`flex-1`,children:`App component`}),(0,H.jsx)(l_,{diagnostic:r})]}),(0,H.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-xs`,children:[(0,H.jsx)(`dt`,{className:`text-muted-foreground`,children:`Import`}),(0,H.jsx)(`dd`,{className:`font-mono truncate`,title:e.importPath,children:e.importPath}),(0,H.jsx)(`dt`,{className:`text-muted-foreground`,children:`Export`}),(0,H.jsx)(`dd`,{className:`font-mono truncate`,children:a}),e.app?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{className:`text-muted-foreground`,children:`App`}),(0,H.jsx)(`dd`,{className:`font-mono truncate`,children:e.app})]}):null]}),r&&r.status!==`exact`&&r.note?(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r.note}):null,t?(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,"data-repo-styling":``,children:t.recipe?`Styled by ${t.recipe}'s theme — Velloo theme edits reach it through the recipe.`:`Styled by the app's own CSS.`}):n?(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,"data-repo-missing":``,children:`This import is not in the catalog — it still renders from the app, but Velloo has no props or previews for it.`}):null,o?(0,H.jsxs)(W,{variant:`ghost`,size:`xs`,className:`self-start -ml-2 text-muted-foreground`,onClick:()=>i({kind:`repo`,id:o}),children:[(0,H.jsx)(gn,{}),`Open in Library`]}):null]})}function Ov({props:e,values:t,hidden:n,fieldKey:r,onChange:i}){let[a,o]=(0,M.useState)(!1),s=e.filter(e=>e.serializable&&!e.slot&&!n.has(e.name)),c=s.filter(e=>!e.inherited),l=s.filter(e=>e.inherited);if(s.length===0)return null;let u=e=>(0,H.jsx)(Ev,{descriptor:e,initialValue:t?.[e.name],onChange:t=>i(e.name,t)},`${r}:${e.name}`);return(0,H.jsxs)(`section`,{className:`flex flex-col gap-3`,"data-repo-props":``,children:[(0,H.jsx)(`div`,{className:`text-xs uppercase tracking-wider text-muted-foreground`,children:`Props`}),c.map(u),l.length>0?(0,H.jsxs)(d_,{open:a,onOpenChange:o,children:[(0,H.jsxs)(f_,{className:`flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground`,children:[(0,H.jsx)(Ht,{size:12,className:`transition-transform ${a?`rotate-90`:``}`}),l.length,` inherited prop`,l.length===1?``:`s`]}),(0,H.jsx)(p_,{className:`mt-3 flex flex-col gap-3`,children:l.map(u)})]}):null]})}var kv=200;function Av({selection:e,node:t}){let n=B(e=>e.design)?.snippets.find(e=>e.id===t.$snippet),r=nd(),[i,a]=(0,M.useState)(null);(0,M.useEffect)(()=>{let e=!0;return Wo(t.$snippet).then(t=>{e&&a(t)}).catch(()=>void 0),()=>{e=!1}},[t.$snippet]);let o=i?.params??n?.params??[],s=_v(kv,e=>{I.updateSnippetArgs({screenId:e.screenId,path:z(e.path),argPatch:{[e.name]:e.value===void 0?null:e.value}}).catch(e=>R(e,`Could not update snippet arg`))}),c=(t,n)=>s({screenId:e.screenId,path:e.path,name:t,value:n});return(0,H.jsxs)(`div`,{className:`flex-1 flex flex-col overflow-hidden`,children:[(0,H.jsxs)(`header`,{className:`px-4 py-3 border-b`,children:[(0,H.jsxs)(`div`,{className:`font-semibold text-sm truncate`,children:[`@`,t.$snippet]}),(0,H.jsxs)(`div`,{className:`text-xs text-muted-foreground mt-0.5`,children:[e.screenId,` · `,e.path===``?`(root)`:e.path,` · snippet instance`]})]}),(0,H.jsxs)(`div`,{className:`flex-1 overflow-y-auto scroll-stable p-4 flex flex-col gap-4`,children:[n==null?(0,H.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Snippet "`,t.$snippet,`" is not in the registry — the instance is dangling.`]}):o.length===0?(0,H.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`This snippet takes no params.`}):(0,H.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,H.jsx)(`div`,{className:`text-xs uppercase tracking-wider text-muted-foreground`,children:`Args`}),o.map(n=>(0,H.jsx)(Nv,{param:n,initialValue:t.args?.[n.name],onChange:e=>c(n.name,e),lucideIconNames:r},`${e.screenId}:${e.path}:${n.name}`))]}),(0,H.jsx)(jv,{snippetId:t.$snippet,selection:e})]})]})}function jv({snippetId:e,selection:t}){let[n,r]=(0,M.useState)(null),i=B(e=>e.screenVersion),a=B(e=>e.selectScreen),o=B(e=>e.setSelection);if((0,M.useEffect)(()=>{let t=!0;return fetch(`/api/snippets/${encodeURIComponent(e)}/instances`).then(e=>e.ok?e.json():Promise.reject(Error(`${e.status}`))).then(e=>{t&&r(e.instances)}).catch(()=>{t&&r([])}),()=>{t=!1}},[e,i]),!n)return null;let s=n.filter(e=>e.hasOverride).length,c=e=>e.screenId===t.screenId&&e.path===t.path;return(0,H.jsxs)(`section`,{className:`flex flex-col gap-2 border-t pt-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsx)(`div`,{className:`text-xs uppercase tracking-wider text-muted-foreground`,children:`Instances`}),(0,H.jsxs)(`div`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:[n.length,` total · `,s,` with override`]})]}),n.length===0?(0,H.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:`Not used yet — instantiate from the Snippets panel to see this list populate.`}):(0,H.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:n.map(e=>{let t=e.screenId.startsWith(`snippet:`),n=t?e.screenId.slice(8):e.screenId,r=c(e);return(0,H.jsx)(`li`,{children:(0,H.jsxs)(`button`,{type:`button`,disabled:t||r,onClick:async()=>{t||r||(await a(e.screenId),o({screenId:e.screenId,path:e.path}))},title:r?`This is the instance you're currently editing.`:t?`Used inside snippet "${n}" — open via Snippets list.`:`Jump to ${e.screenId} · ${e.path===``?`(root)`:e.path}`,className:r?`flex w-full items-center justify-between gap-2 rounded-md border border-primary bg-primary/10 px-1.5 py-1 text-left text-[10px] cursor-default`:`flex w-full items-center justify-between gap-2 rounded-md border bg-background px-1.5 py-1 text-left text-[10px] hover:bg-muted disabled:opacity-60`,children:[(0,H.jsxs)(`span`,{className:r?`truncate text-primary font-medium`:`truncate text-foreground`,children:[r?`● `:t?`↳ snippet: `:``,n]}),(0,H.jsx)(`span`,{className:`shrink-0 font-mono text-muted-foreground`,children:e.path===``?`(root)`:e.path}),e.hasOverride?(0,H.jsx)(`span`,{className:`shrink-0 rounded bg-primary/10 px-1 text-primary`,children:`override`}):null]})},`${e.screenId}:${e.path}`)})})]})}function Mv(e){switch(e.type){case`boolean`:case`number`:case`icon`:case`color`:return e.type;case`enum`:return Array.isArray(e.enum)&&e.enum.length>0?`enum`:`string`;default:return`string`}}function Nv({param:e,initialValue:t,onChange:n,lucideIconNames:r}){let i=Mv(e);return(0,H.jsx)(wv,{kind:i,id:`snip-arg-${e.name}`,name:e.name,label:e.name,labelClassName:`text-xs`,title:e.description??void 0,initialValue:t,onCommit:n,enumValues:e.enum,iconNames:r,min:e.min,max:e.max,step:e.step??1,placeholder:i===`enum`?`(choose)`:void 0})}function Pv({selection:e,node:t}){let n=B(e=>e.design),r=B(t=>t.screens[e.screenId]),i=e.screenId.slice(8),a=n?.snippets.find(e=>e.id===i)?.params??[],o=a.filter(e=>e.type===`node`),s=a.filter(e=>e.type===`boolean`);return(0,H.jsxs)(`section`,{className:`flex flex-col gap-3 border-t pt-4`,children:[(0,H.jsx)(`div`,{className:`text-xs uppercase tracking-wider text-muted-foreground`,children:`Substitutions`}),(0,H.jsx)(Fv,{nodeParams:o.map(e=>e.name),onInsert:async t=>{if(!r)return;let n=structuredClone(r.tree),a=n;for(let t of z(e.path)){if(!a||!Ni(a))return;a=a.children?.[t]}if(a&&Ni(a)){a.children=[...a.children??[],{$param:t}];try{await P(`update_snippet`,{snippetId:i,patch:{tree:n}}),L({kind:`success`,message:`Inserted {$param: ${t}} slot`})}catch(e){R(e,`Could not insert param ref`)}}}}),(0,H.jsx)(Iv,{node:t,boolParams:s.map(e=>e.name),onWrap:async(n,r)=>{let i=t.props?.[n];try{await I.updateProps({screenId:e.screenId,path:z(e.path),propPatch:{[n]:{$if:r,then:i??``,else:``}}}),L({kind:`success`,message:`${n} now branches on {$if: ${r}}`})}catch(e){R(e,`Could not add if branch`)}}})]})}function Fv({nodeParams:e,onInsert:t}){return e.length===0?(0,H.jsxs)(`div`,{className:`text-[11px] text-muted-foreground leading-relaxed`,children:[(0,H.jsx)(`span`,{className:`font-medium text-foreground`,children:`+ param ref`}),` — this snippet has no`,` `,(0,H.jsx)(`code`,{className:`text-[10px] font-mono px-1 py-0.5 rounded bg-muted`,children:`node`}),` param to slot in. Ask your agent to declare one.`]}):(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(G,{className:`text-xs`,children:`+ param ref`}),(0,H.jsxs)(K,{value:``,onValueChange:t,children:[(0,H.jsx)(J,{size:`sm`,className:`text-xs`,"aria-label":`Insert a param-ref slot`,children:(0,H.jsx)(q,{placeholder:`Insert {$param} slot as child…`})}),(0,H.jsx)(Y,{children:e.map(e=>(0,H.jsx)(X,{value:e,children:`{$param: ${e}}`},e))})]})]})}function Iv({node:e,boolParams:t,onWrap:n}){let[r,i]=(0,M.useState)(``),[a,o]=(0,M.useState)(``);if(t.length===0)return(0,H.jsxs)(`div`,{className:`text-[11px] text-muted-foreground leading-relaxed`,children:[(0,H.jsx)(`span`,{className:`font-medium text-foreground`,children:`+ if branch`}),` — this snippet has no`,` `,(0,H.jsx)(`code`,{className:`text-[10px] font-mono px-1 py-0.5 rounded bg-muted`,children:`boolean`}),` param to branch on. Ask your agent to declare one.`]});let s=new Set([`className`]);(!e.children||e.children.length===0)&&s.add(`children`);for(let[t,n]of Object.entries(e.props??{}))t!==`asChild`&&(typeof n!=`object`||!n)&&s.add(t);return(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(G,{className:`text-xs`,children:`+ if branch`}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,H.jsxs)(K,{value:r,onValueChange:i,children:[(0,H.jsx)(J,{size:`sm`,className:`flex-1 text-xs`,"aria-label":`Prop to branch`,children:(0,H.jsx)(q,{placeholder:`prop`})}),(0,H.jsx)(Y,{children:[...s].map(e=>(0,H.jsx)(X,{value:e,children:e},e))})]}),(0,H.jsxs)(K,{value:a,onValueChange:o,children:[(0,H.jsx)(J,{size:`sm`,className:`flex-1 text-xs`,"aria-label":`Boolean param`,children:(0,H.jsx)(q,{placeholder:`$if param`})}),(0,H.jsx)(Y,{children:t.map(e=>(0,H.jsx)(X,{value:e,children:e},e))})]}),(0,H.jsx)(W,{size:`xs`,variant:`outline`,className:`h-7 text-xs shrink-0`,disabled:r===``||a===``,onClick:()=>{n(r,a),i(``),o(``)},children:`Wrap`})]}),(0,H.jsxs)(`div`,{className:`text-[10px] text-muted-foreground leading-relaxed`,children:[`Wraps the prop's current value in `,(0,H.jsx)(`code`,{className:`font-mono`,children:`{$if, then, else}`}),` — tune the branches in the prop field after.`]})]})}function Lv(e,t,n){switch(t){case`all`:e.top=e.right=e.bottom=e.left=n;break;case`x`:e.left=e.right=n;break;case`y`:e.top=e.bottom=n;break;default:e[t]=n}}function Rv(e){return e===`all`?0:e===`x`||e===`y`?1:2}function zv(e){let{top:t,right:n,bottom:r,left:i}=e,a={};return t===void 0&&n===void 0&&r===void 0&&i===void 0?a:t!==void 0&&t===n&&n===r&&r===i?(a.all=t,a):(t!==void 0&&t===r?a.y=t:(t!==void 0&&(a.top=t),r!==void 0&&(a.bottom=r)),i!==void 0&&i===n?a.x=i:(i!==void 0&&(a.left=i),n!==void 0&&(a.right=n)),a)}var Bv={padding:{box:`padding`,v:`all`},paddingTop:{box:`padding`,v:`top`},paddingRight:{box:`padding`,v:`right`},paddingBottom:{box:`padding`,v:`bottom`},paddingLeft:{box:`padding`,v:`left`},margin:{box:`margin`,v:`all`},marginTop:{box:`margin`,v:`top`},marginRight:{box:`margin`,v:`right`},marginBottom:{box:`margin`,v:`bottom`},marginLeft:{box:`margin`,v:`left`}},Vv=[`display`,`flexDirection`,`justifyContent`,`alignItems`,`gap`,`width`,`height`,`fontFamily`,`fontSize`,`fontWeight`,`lineHeight`,`letterSpacing`,`textAlign`,`color`,`backgroundColor`,`borderRadius`],Hv=new Set(Vv);function Uv(e){return Hv.has(e)}function Wv(e){return typeof e==`string`&&e.trim().includes(` `)}function Gv(e){if(typeof e==`number`)return e;if(typeof e==`string`){let t=/^(-?\d*\.?\d+)px$/.exec(e.trim());if(t)return Number(t[1])}return null}function Kv(e){let t={padding:{},margin:{}},n={},r=[];for(let[i,a]of Object.entries(e??{})){let e=Bv[i];if(e&&(typeof a==`number`||typeof a==`string`)&&!(e.v===`all`&&Wv(a))){r.push({box:e.box,v:e.v,val:a});continue}if(Uv(i)&&(typeof a==`number`||typeof a==`string`)){t[i]=a;continue}n[i]=a}r.sort((e,t)=>Rv(e.v)-Rv(t.v));for(let e of r)Lv(t[e.box],e.v,e.val);return{model:t,extra:n}}var qv={top:`Top`,right:`Right`,bottom:`Bottom`,left:`Left`};function Jv(e,t,n){let{top:r,right:i,bottom:a,left:o}=t;if(r!==void 0||i!==void 0||a!==void 0||o!==void 0){if(r!==void 0&&r===i&&i===a&&a===o){n[e]=r;return}for(let r of[`top`,`right`,`bottom`,`left`]){let i=t[r];i!==void 0&&(n[`${e}${qv[r]}`]=i)}}}function Yv({model:e,extra:t}){let n={};for(let t of Vv){let r=e[t];r!==void 0&&(n[t]=r)}return Jv(`padding`,e.padding,n),Jv(`margin`,e.margin,n),Object.assign(n,t),n}function Xv(e,t){let n=t===void 0?void 0:String(t),r=[[`—`,`—`],...e];return n!==void 0&&!e.some(([e])=>e===n)&&r.push([n,n]),r}function Zv({title:e,defaultOpen:t=!0,children:n}){let[r,i]=(0,M.useState)(t);return(0,H.jsxs)(`section`,{className:`border-b last:border-b-0`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>i(e=>!e),className:`w-full flex items-center justify-between px-3 py-2.5 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground hover:text-foreground`,children:[e,(0,H.jsx)(Vt,{className:`size-3 transition-transform ${r?``:`-rotate-90`}`})]}),r?(0,H.jsx)(`div`,{className:`px-3 pb-3 flex flex-col gap-2.5`,children:n}):null]})}function $({label:e,children:t}){return(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3 min-h-7`,children:[(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:e}),t]})}function Qv({value:e,onChange:t,options:n,className:r}){return(0,H.jsx)(Yp,{type:`single`,size:`sm`,value:e??``,onValueChange:e=>t(e||void 0),className:r,children:n.map(e=>(0,H.jsx)(Xp,{value:e.value,title:e.title??e.label??e.value,className:`h-7 min-w-7 px-2 text-[11px]`,children:e.icon??e.label??e.value},e.value))})}function $v({value:e,onChange:t,unit:n,units:r,onUnitChange:i,placeholder:a,className:o}){return(0,H.jsxs)(`div`,{className:`inline-flex items-center h-7 rounded-md border border-input bg-background overflow-hidden ${o??`w-20`}`,children:[(0,H.jsx)(`input`,{value:e,placeholder:a,spellCheck:!1,onChange:e=>t(e.target.value),className:`min-w-0 flex-1 bg-transparent px-2 text-xs tabular-nums outline-none`}),r&&i?(0,H.jsx)(`select`,{value:n??r[0],onChange:e=>i(e.target.value),className:`self-stretch border-l border-input bg-muted/50 px-1 text-[10px] text-muted-foreground outline-none`,children:r.map(e=>(0,H.jsx)(`option`,{value:e,children:e},e))}):n?(0,H.jsx)(`span`,{className:`self-stretch flex items-center border-l border-input px-1.5 text-[10px] text-muted-foreground`,children:n}):null]})}function ey({value:e,onChange:t,options:n,className:r,label:i}){return(0,H.jsx)(`select`,{value:e,"aria-label":i,onChange:e=>t(e.target.value),className:`h-7 rounded-md border border-input bg-background px-2 text-xs text-foreground outline-none ${r??`min-w-[7rem]`}`,children:n.map(([e,t])=>(0,H.jsx)(`option`,{value:e,children:t??e},e))})}function ty(e){let t=/^\[(.+)\]$/.exec(e)?.[1]??e;return/^#([0-9a-f]{3,8})$/i.test(t)||/^(rgb|hsl|oklch|var)\(/i.test(t)?t:null}function ny({value:e,onChange:t,placeholder:n}){let r=ty(e);return(0,H.jsxs)(`div`,{className:`inline-flex min-w-0 items-center gap-1.5 h-7 pl-1.5 pr-2 rounded-md border border-input bg-background`,children:[(0,H.jsx)(`span`,{className:`size-4 shrink-0 rounded-[3px] border border-border bg-[repeating-conic-gradient(#0000_0deg_90deg,#8884_90deg_180deg)]`,style:r?{background:r}:void 0}),(0,H.jsx)(`input`,{value:e,placeholder:n,spellCheck:!1,onChange:e=>t(e.target.value),className:`min-w-0 flex-1 bg-transparent text-xs outline-none`})]})}function ry({code:e}){return(0,H.jsx)(`pre`,{className:`rounded-md border bg-muted/50 p-2.5 font-mono text-[10.5px] leading-[1.6] text-muted-foreground whitespace-pre-wrap break-words`,children:e})}function iy({padding:e,margin:t,contentLabel:n,onPadding:r,onMargin:i}){let a=(e,t,n)=>(0,H.jsx)(`input`,{value:e,spellCheck:!1,onChange:e=>t(e.target.value),className:`w-9 rounded border border-transparent bg-transparent text-center text-[10px] tabular-nums text-foreground outline-none focus:border-ring hover:bg-background/60`},n);return(0,H.jsxs)(`div`,{className:`relative rounded-md border border-dashed bg-muted/40 px-2 pb-1 pt-4 text-muted-foreground`,children:[(0,H.jsx)(`span`,{className:`absolute left-2 top-1 text-[8px] font-medium uppercase tracking-wide text-muted-foreground/80`,children:`margin`}),(0,H.jsx)(`div`,{className:`flex justify-center`,children:a(t.top,e=>i(`top`,e),`mt`)}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[a(t.left,e=>i(`left`,e),`ml`),(0,H.jsxs)(`div`,{className:`relative flex-1 rounded border bg-accent/40 px-2 pb-1 pt-4`,children:[(0,H.jsx)(`span`,{className:`absolute left-1.5 top-0.5 text-[8px] font-medium uppercase tracking-wide text-muted-foreground/80`,children:`padding`}),(0,H.jsx)(`div`,{className:`flex justify-center`,children:a(e.top,e=>r(`top`,e),`pt`)}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[a(e.left,e=>r(`left`,e),`pl`),(0,H.jsx)(`div`,{className:`flex h-9 flex-1 items-center justify-center rounded border bg-background text-[10px] text-muted-foreground`,children:n}),a(e.right,e=>r(`right`,e),`pr`)]}),(0,H.jsx)(`div`,{className:`flex justify-center`,children:a(e.bottom,e=>r(`bottom`,e),`pb`)})]}),a(t.right,e=>i(`right`,e),`mr`)]}),(0,H.jsx)(`div`,{className:`flex justify-center`,children:a(t.bottom,e=>i(`bottom`,e),`mb`)})]})}function ay({placeholder:e,value:t,onChange:n,onSubmit:r}){return(0,H.jsx)(`input`,{value:t,placeholder:e,spellCheck:!1,onChange:e=>n(e.target.value),onKeyDown:e=>{e.key===`Enter`&&r()},className:`h-7 w-full rounded-md border border-dashed border-input bg-background px-2 text-[11px] text-foreground outline-none placeholder:text-muted-foreground focus:border-ring`})}var oy=[[`flex`],[`block`],[`grid`],[`inline-flex`],[`none`]],sy=[{value:`row`,icon:(0,H.jsx)(Nt,{className:`size-3.5`}),title:`row`},{value:`column`,icon:(0,H.jsx)(At,{className:`size-3.5`}),title:`column`}],cy=[[`flex-start`,`start`],[`center`],[`flex-end`,`end`],[`space-between`,`between`],[`space-around`,`around`]],ly=[[`flex-start`,`start`],[`center`],[`flex-end`,`end`],[`stretch`]],uy=[[`400`],[`500`],[`600`],[`700`],[`300`]],dy=[{value:`left`,label:`L`},{value:`center`,label:`C`},{value:`right`,label:`R`},{value:`justify`,label:`J`}],fy=[`px`,`rem`,`em`,`%`,`vh`,`vw`,`—`],py=e=>e===void 0?``:String(e);function my(e){if(e===void 0)return{num:``,unit:`px`};if(typeof e==`number`)return{num:String(e),unit:`px`};let t=/^(-?\d*\.?\d+)(px|rem|em|%|vh|vw)?$/.exec(e.trim());return t?{num:t[1]??``,unit:t[2]??`—`}:{num:e,unit:`—`}}function hy(e,t){let n=e.trim();if(!n)return;let r=/^-?\d*\.?\d+$/.test(n);return t===`px`?r?Number(n):`${n}px`:t===`—`?r?Number(n):n:`${n}${t}`}function gy(e){let t=e.trim();if(/^-?\d*\.?\d+$/.test(t))return Number(t);try{let e=JSON.parse(t);if(typeof e==`object`&&e)return e}catch{}return e}function _y({initialValue:e,prop:t,screenId:n,path:r,debounceMs:i}){let[a,o]=(0,M.useState)(()=>Kv(e)),[s,c]=(0,M.useState)(``),l=_v(i,e=>{let i=Yv(e);I.updateProps({screenId:n,path:z(r),propPatch:{[t]:Object.keys(i).length?i:null}}).catch(e=>R(e,`Could not update styles`))}),u=e=>{o(e),l(e)},d=a.model,f=e=>u({...a,model:{...d,...e}}),p=e=>{let t=e.trim();if(t)return/^-?\d+(\.\d+)?$/.test(t)?Number(t):t},m=(e,t,n)=>f({[e]:{...d[e],[t]:p(n)}}),h=e=>{let t=Gv(e);return t===null?py(e):String(t)},g=e=>({top:h(e.top),right:h(e.right),bottom:h(e.bottom),left:h(e.left)}),_=e=>{let{num:t,unit:n}=my(d[e]);return(0,H.jsx)($v,{value:t,unit:n,units:fy,onChange:t=>f({[e]:hy(t,n)}),onUnitChange:n=>f({[e]:hy(t,n)}),className:`w-28`})},v=Object.entries(Yv(a)),y=(e,t)=>u(Kv({...Yv(a),[e]:gy(t)})),b=e=>{let{[e]:t,...n}=Yv(a);u(Kv(n))};return(0,H.jsxs)(`div`,{className:`-mx-4 -mb-4 flex flex-col`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 border-b bg-primary/5 px-3 py-2`,children:[(0,H.jsx)(jt,{className:`size-3.5 text-primary`}),(0,H.jsx)(`span`,{className:`text-[11px] text-foreground`,children:`Controls ⇄ declarations — edit either side`})]}),(0,H.jsx)(Zv,{title:`Box model`,children:(0,H.jsx)(iy,{contentLabel:`content`,padding:g(d.padding),margin:g(d.margin),onPadding:(e,t)=>m(`padding`,e,t),onMargin:(e,t)=>m(`margin`,e,t)})}),(0,H.jsxs)(Zv,{title:`Layout`,children:[(0,H.jsx)($,{label:`display`,children:(0,H.jsx)(ey,{value:py(d.display)||`—`,onChange:e=>f({display:e===`—`?void 0:e}),options:Xv(oy,d.display)})}),(0,H.jsx)($,{label:`flexDirection`,children:(0,H.jsx)(Qv,{value:py(d.flexDirection)||void 0,onChange:e=>f({flexDirection:e}),options:sy})}),(0,H.jsx)($,{label:`justify`,children:(0,H.jsx)(ey,{value:py(d.justifyContent)||`—`,onChange:e=>f({justifyContent:e===`—`?void 0:e}),options:Xv(cy,d.justifyContent)})}),(0,H.jsx)($,{label:`alignItems`,children:(0,H.jsx)(ey,{value:py(d.alignItems)||`—`,onChange:e=>f({alignItems:e===`—`?void 0:e}),options:Xv(ly,d.alignItems)})}),(0,H.jsx)($,{label:`gap`,children:_(`gap`)})]}),(0,H.jsxs)(Zv,{title:`Typography`,children:[(0,H.jsx)($,{label:`fontSize`,children:_(`fontSize`)}),(0,H.jsx)($,{label:`lineHeight`,children:_(`lineHeight`)}),(0,H.jsx)($,{label:`fontWeight`,children:(0,H.jsx)(ey,{value:py(d.fontWeight)||`—`,onChange:e=>f({fontWeight:e===`—`?void 0:e}),options:Xv(uy,d.fontWeight),className:`min-w-[5rem]`})}),(0,H.jsx)($,{label:`textAlign`,children:(0,H.jsx)(Qv,{value:py(d.textAlign)||void 0,onChange:e=>f({textAlign:e}),options:dy})}),(0,H.jsx)($,{label:`color`,children:(0,H.jsx)(ny,{value:py(d.color),onChange:e=>f({color:e||void 0}),placeholder:`var(--foreground)`})})]}),(0,H.jsxs)(Zv,{title:`Appearance`,children:[(0,H.jsx)($,{label:`background`,children:(0,H.jsx)(ny,{value:py(d.backgroundColor),onChange:e=>f({backgroundColor:e||void 0}),placeholder:`var(--card)`})}),(0,H.jsx)($,{label:`radius`,children:_(`borderRadius`)})]}),(0,H.jsxs)(Zv,{title:`Declarations (raw, synced)`,children:[v.map(([e,t])=>(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`w-28 shrink-0 truncate font-mono text-[11px] text-muted-foreground`,children:e}),(0,H.jsx)(`input`,{value:typeof t==`string`?t:typeof t==`number`?String(t):JSON.stringify(t),spellCheck:!1,onChange:t=>y(e,t.target.value),className:`min-w-0 flex-1 h-6 rounded border border-input bg-background px-1.5 font-mono text-[11px] outline-none`}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>b(e),className:`text-muted-foreground hover:text-foreground`,"aria-label":`remove ${e}`,children:(0,H.jsx)(jr,{className:`size-3`})})]},e)),v.length===0?(0,H.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`no styles`}):null,(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,H.jsx)(Xn,{className:`size-3 text-muted-foreground`}),(0,H.jsx)($v,{value:s,onChange:c,className:`w-full`,placeholder:`property…`}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>{let e=s.trim();!e||e in Yv(a)||(u(Kv({...Yv(a),[e]:``})),c(``))},className:`text-[11px] text-muted-foreground hover:text-foreground`,children:`add`})]}),(0,H.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`A bare number is px (gap: 16); other units → a string ('0.875rem', '50vh'). Unitless props stay numbers (lineHeight: 1.5).`})]})]})}var vy={p:{box:`padding`,v:`all`},padding:{box:`padding`,v:`all`},px:{box:`padding`,v:`x`},py:{box:`padding`,v:`y`},pt:{box:`padding`,v:`top`},paddingTop:{box:`padding`,v:`top`},pr:{box:`padding`,v:`right`},paddingRight:{box:`padding`,v:`right`},pb:{box:`padding`,v:`bottom`},paddingBottom:{box:`padding`,v:`bottom`},pl:{box:`padding`,v:`left`},paddingLeft:{box:`padding`,v:`left`},m:{box:`margin`,v:`all`},margin:{box:`margin`,v:`all`},mx:{box:`margin`,v:`x`},my:{box:`margin`,v:`y`},mt:{box:`margin`,v:`top`},marginTop:{box:`margin`,v:`top`},mr:{box:`margin`,v:`right`},marginRight:{box:`margin`,v:`right`},mb:{box:`margin`,v:`bottom`},marginBottom:{box:`margin`,v:`bottom`},ml:{box:`margin`,v:`left`},marginLeft:{box:`margin`,v:`left`}},yy=[`display`,`flexDirection`,`justifyContent`,`alignItems`,`gap`,`width`,`height`,`fontSize`,`fontWeight`,`lineHeight`,`letterSpacing`,`textAlign`,`typography`,`color`,`bgcolor`,`boxShadow`,`borderRadius`,`fontFamily`],by=new Set(yy);function xy(e){return by.has(e)}var Sy=8;function Cy(e){if(typeof e==`number`)return e*Sy;if(typeof e==`string`){let t=/^(-?\d*\.?\d+)px$/.exec(e.trim());if(t)return Number(t[1])}return null}function wy(e){return e%Sy===0?e/Sy:`${e}px`}function Ty(e){let t={padding:{},margin:{}},n={},r=[];for(let[i,a]of Object.entries(e??{})){let e=vy[i];if(e&&(typeof a==`string`||typeof a==`number`)){r.push({box:e.box,v:e.v,val:a});continue}if(xy(i)&&(typeof a==`string`||typeof a==`number`)){t[i]=a;continue}n[i]=a}r.sort((e,t)=>Rv(e.v)-Rv(t.v));for(let e of r)Lv(t[e.box],e.v,e.val);return{model:t,extra:n}}function Ey(e,t,n){let r=zv(t),i={all:e,x:`${e}x`,y:`${e}y`,top:`${e}t`,right:`${e}r`,bottom:`${e}b`,left:`${e}l`};for(let[e,t]of Object.entries(r))t!==void 0&&(n[i[e]]=t)}function Dy({model:e,extra:t}){let n={};for(let t of yy){let r=e[t];r!==void 0&&(n[t]=r)}return Ey(`p`,e.padding,n),Ey(`m`,e.margin,n),Object.assign(n,t),n}var Oy=[[`flex`],[`block`],[`grid`],[`inline-flex`],[`none`]],ky=[{value:`row`,icon:(0,H.jsx)(Nt,{className:`size-3.5`}),title:`row`},{value:`column`,icon:(0,H.jsx)(At,{className:`size-3.5`}),title:`column`}],Ay=[[`flex-start`,`start`],[`center`],[`flex-end`,`end`],[`space-between`,`between`],[`space-around`,`around`],[`space-evenly`,`evenly`]],jy=[[`flex-start`,`start`],[`center`],[`flex-end`,`end`],[`stretch`],[`baseline`]],My=[[`normal`],[`medium`],[`semibold`],[`bold`],[`light`]],Ny=[{value:`left`,label:`L`},{value:`center`,label:`C`},{value:`right`,label:`R`},{value:`justify`,label:`J`}],Py=e=>e===void 0?``:String(e);function Fy(e){let t=e.trim();if(t)return/^-?\d+(\.\d+)?$/.test(t)?Number(t):t}function Iy(e){let t=Cy(e);return t===null?Py(e):String(t)}function Ly(e){let t=e.trim();if(t)return/^-?\d+(\.\d+)?$/.test(t)?wy(Number(t)):t}function Ry({initialValue:e,prop:t,screenId:n,path:r,debounceMs:i}){let[a,o]=(0,M.useState)(()=>Ty(e)),[s,c]=(0,M.useState)(``),l=_v(i,e=>{let i=Dy(e);I.updateProps({screenId:n,path:z(r),propPatch:{[t]:Object.keys(i).length?i:null}}).catch(e=>R(e,`Could not update styles`))}),u=e=>{o(e),l(e)},d=a.model,f=e=>u({...a,model:{...d,...e}}),p=(e,t,n)=>f({[e]:{...d[e],[t]:Ly(n)}}),m=e=>({top:Iy(e.top),right:Iy(e.right),bottom:Iy(e.bottom),left:Iy(e.left)}),h=Object.entries(a.extra),g=(e,t)=>{let n=t;try{n=JSON.parse(t)}catch{}u({...a,extra:{...a.extra,[e]:n}})},_=e=>{let{[e]:t,...n}=a.extra;u({...a,extra:n})},v=()=>{let e=s.trim();!e||e in a.extra||(u({...a,extra:{...a.extra,[e]:``}}),c(``))},y=JSON.stringify(Dy(a),null,2);return(0,H.jsxs)(`div`,{className:`-mx-4 -mb-4 flex flex-col`,children:[(0,H.jsxs)(Zv,{title:`Layout`,children:[(0,H.jsx)($,{label:`display`,children:(0,H.jsx)(ey,{value:Py(d.display)||`—`,onChange:e=>f({display:e===`—`?void 0:e}),options:Xv(Oy,d.display)})}),(0,H.jsx)($,{label:`flexDirection`,children:(0,H.jsx)(Qv,{value:Py(d.flexDirection)||void 0,onChange:e=>f({flexDirection:e}),options:ky})}),(0,H.jsx)($,{label:`justify`,children:(0,H.jsx)(ey,{value:Py(d.justifyContent)||`—`,onChange:e=>f({justifyContent:e===`—`?void 0:e}),options:Xv(Ay,d.justifyContent)})}),(0,H.jsx)($,{label:`alignItems`,children:(0,H.jsx)(ey,{value:Py(d.alignItems)||`—`,onChange:e=>f({alignItems:e===`—`?void 0:e}),options:Xv(jy,d.alignItems)})}),(0,H.jsx)($,{label:`gap`,children:(0,H.jsx)($v,{value:Iy(d.gap),onChange:e=>f({gap:Ly(e)}),unit:`px`})})]}),(0,H.jsxs)(Zv,{title:`Spacing · theme.spacing ×8`,children:[(0,H.jsx)(iy,{contentLabel:`content`,padding:m(d.padding),margin:m(d.margin),onPadding:(e,t)=>p(`padding`,e,t),onMargin:(e,t)=>p(`margin`,e,t)}),(0,H.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`number → theme.spacing(n): 2 = 16px; off-grid → a px string.`})]}),(0,H.jsxs)(Zv,{title:`Typography`,children:[(0,H.jsx)($,{label:`typography`,children:(0,H.jsx)(ey,{value:Py(d.typography)||`—`,onChange:e=>f({typography:e===`—`?void 0:e}),options:Xv([[`body1`],[`body2`],[`subtitle1`],[`subtitle2`],[`h6`],[`caption`]],d.typography),className:`min-w-[6rem]`})}),(0,H.jsx)($,{label:`fontSize`,children:(0,H.jsx)($v,{value:Py(d.fontSize),onChange:e=>f({fontSize:Fy(e)}),placeholder:`14`})}),(0,H.jsx)($,{label:`fontWeight`,children:(0,H.jsx)(ey,{value:Py(d.fontWeight)||`—`,onChange:e=>f({fontWeight:e===`—`?void 0:e}),options:Xv(My,d.fontWeight),className:`min-w-[6rem]`})}),(0,H.jsx)($,{label:`textAlign`,children:(0,H.jsx)(Qv,{value:Py(d.textAlign)||void 0,onChange:e=>f({textAlign:e}),options:Ny})}),(0,H.jsx)($,{label:`color`,children:(0,H.jsx)(ny,{value:Py(d.color),onChange:e=>f({color:e||void 0}),placeholder:`text.primary`})})]}),(0,H.jsxs)(Zv,{title:`Appearance`,children:[(0,H.jsx)($,{label:`bgcolor`,children:(0,H.jsx)(ny,{value:Py(d.bgcolor),onChange:e=>f({bgcolor:e||void 0}),placeholder:`background.paper`})}),(0,H.jsx)($,{label:`boxShadow`,children:(0,H.jsx)($v,{value:Py(d.boxShadow),onChange:e=>f({boxShadow:Fy(e)}),unit:`elev`})}),(0,H.jsx)($,{label:`borderRadius`,children:(0,H.jsx)($v,{value:Py(d.borderRadius),onChange:e=>f({borderRadius:Fy(e)})})})]}),(0,H.jsxs)(Zv,{title:`Additional sx (raw)`,children:[(0,H.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`props the controls don't cover — pseudo-selectors, transitions, one-offs`}),h.map(([e,t])=>(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`w-24 shrink-0 truncate font-mono text-[11px] text-muted-foreground`,children:e}),(0,H.jsx)(`input`,{defaultValue:typeof t==`string`?t:JSON.stringify(t),spellCheck:!1,onChange:t=>g(e,t.target.value),className:`min-w-0 flex-1 h-6 rounded border border-input bg-background px-1.5 font-mono text-[11px] outline-none`}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>_(e),className:`text-muted-foreground hover:text-foreground`,"aria-label":`remove ${e}`,children:(0,H.jsx)(jr,{className:`size-3`})})]},e)),(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,H.jsx)(Xn,{className:`size-3 text-muted-foreground`}),(0,H.jsx)(ay,{placeholder:`property…`,value:s,onChange:c,onSubmit:v})]})]}),(0,H.jsx)(Zv,{title:`sx (merged)`,defaultOpen:!1,children:(0,H.jsx)(ry,{code:y})})]})}var zy=new Set;function By(e,t,n=e){if(!t||zy.has(e))return;zy.add(e);let r=document.createElement(`link`);r.rel=`stylesheet`,r.href=Uu(t,e,n),document.head.appendChild(r)}var Vy=[{role:`display`,hint:`display`},{role:`serif`,hint:`body`},{role:`sans`,hint:`body`},{role:`mono`,hint:`mono`}],Hy=/^[a-z][a-z0-9-]*$/;function Uy(e){return/^\s*(?:"([^"]+)"|'([^']+)'|([^,]+))/.exec(e)?.slice(1).find(Boolean)?.trim()??e}var Wy=/^(-|ui-|system-ui$|sans-serif$|serif$|monospace$|cursive$)/;function Gy({theme:e,onBrowse:t}){let n=e.typography.fontFamily??{},r=Object.keys(n).sort(),[i,a]=(0,M.useState)(!1),[o,s]=(0,M.useState)(``),[c,l]=(0,M.useState)(null),u=B(e=>e.refreshTheme),d=B(e=>e.themeName);(0,M.useEffect)(()=>{for(let e of Object.values(n)){let t=Vu(Uy(e));t&&By(t.family,t.google)}},[n]);let f=e=>{bs.setFonts(d,[e]).catch(e=>{R(e,`Could not update the font role`),u()})},p=o.trim(),m=Hy.test(p)&&!r.includes(p),h=e=>{a(!1),t(e)};return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[r.length===0?(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No faces declared yet.`}):r.map(e=>{let r=n[e],i=Uy(r),a=Vu(i),o=Wy.test(i);return(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>t(e),title:r,className:`min-w-0 flex-1 flex items-baseline gap-2 rounded-md border border-input bg-background px-2 py-1.5 text-left hover:bg-accent/50 cursor-pointer`,children:[(0,H.jsx)(`span`,{className:`w-14 shrink-0 truncate font-mono text-[10px] text-muted-foreground`,children:e}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs `+(o?`text-muted-foreground`:`text-foreground`),style:a?{fontFamily:r}:void 0,children:o?`System default`:i})]}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>l(e),title:`Remove the ${e} face`,"aria-label":`Remove the ${e} face`,className:`size-6 shrink-0 grid place-items-center rounded-md text-muted-foreground/60 hover:text-destructive cursor-pointer`,children:(0,H.jsx)(xr,{size:11})})]},e)}),i?(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,H.jsx)(Q,{autoFocus:!0,value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&m&&h(p),e.key===`Escape`&&a(!1)},placeholder:`Role name`,spellCheck:!1,"aria-label":`New role name`,className:`h-7 flex-1 font-mono text-xs`}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>h(p),disabled:!m,"aria-label":`Choose a face`,className:`size-7 shrink-0 grid place-items-center rounded-md border border-input bg-background text-muted-foreground hover:text-foreground disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer`,children:(0,H.jsx)(Bt,{size:13})}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>a(!1),"aria-label":`Cancel`,className:`size-7 shrink-0 grid place-items-center rounded-md text-muted-foreground hover:text-foreground cursor-pointer`,children:(0,H.jsx)(jr,{size:13})})]}),(0,H.jsx)(`div`,{className:`flex flex-wrap items-center gap-1`,children:Vy.filter(e=>!r.includes(e.role)).map(e=>(0,H.jsx)(`button`,{type:`button`,onClick:()=>s(e.role),className:`rounded-full border px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground hover:text-foreground cursor-pointer`,children:e.role},e.role))}),(0,H.jsx)(`span`,{className:`text-[10px] text-muted-foreground/80`,children:p.length>0&&!m?r.includes(p)?`"${p}" is already declared`:`Lowercase letters, digits and dashes — it becomes a utility name`:`Becomes --font-${p||`role`} and the font-${p||`role`} class`})]}):(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{s(``),a(!0)},className:`flex items-center justify-center gap-1 rounded-md border border-dashed py-1.5 text-[11px] text-muted-foreground hover:text-foreground cursor-pointer`,children:[(0,H.jsx)(Xn,{size:12}),` Add a face`]})]}),(0,H.jsx)(ql,{open:c!==null,onOpenChange:e=>!e&&l(null),children:(0,H.jsxs)(Xl,{children:[(0,H.jsxs)(Zl,{children:[(0,H.jsx)(eu,{children:`Remove the "${c}" face`}),(0,H.jsx)(tu,{children:`Anything using the font-${c} class falls back to the inherited face. A typeset still pointing at this role will block the removal.`})]}),(0,H.jsxs)(Ql,{children:[(0,H.jsx)(ru,{children:`Cancel`}),(0,H.jsx)(nu,{variant:`destructive`,onClick:()=>{let e=c;l(null),e&&f({role:e,remove:!0})},children:`Remove`})]})]})})]})}function Ky(e,t){return{role:e,family:t.family,fallback:t.fallback,...t.google?{google:t.google}:{}}}async function qy(e,t,n){let r=e.typography.fontFamily??{},i=Object.entries(r).find(([,e])=>Uy(e)===n.family);if(i)return i[0];let a=Yy(Jy(n.family),r);return await bs.setFonts(t,[Ky(a,n)]),a}function Jy(e){let t=e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``);return/^[a-z]/.test(t)?t:`font-${t}`}function Yy(e,t){if(!(e in t))return e;let n=2;for(;`${e}-${n}`in t;)n++;return`${e}-${n}`}var Xy=[{id:`suited`,label:`Suited`},{id:`all`,label:`All`},{id:`sans`,label:`Sans`},{id:`serif`,label:`Serif`},{id:`mono`,label:`Mono`}];function Zy(e){return/^(mono|code)/.test(e)?`mono`:/(display|heading|title|wordmark|marquee|hero)/.test(e)?`display`:`body`}function Qy(e,t){let n=e.roles.indexOf(t);return n===-1?e.roles.length+1:n}function $y({role:e,current:t,onPick:n,onBack:r}){let[i,a]=(0,M.useState)(``),[o,s]=(0,M.useState)(`suited`),c=B(e=>e.setFontDraft),l=Zy(e);(0,M.useEffect)(()=>()=>c(null),[c]);let u=(0,M.useMemo)(()=>{let e=i.trim().toLowerCase(),t=[...Bu.filter(t=>e&&t.family.toLowerCase().includes(e)?!0:o===`suited`?t.roles.includes(l):o===`all`||t.category===o)].sort((e,t)=>Qy(e,l)-Qy(t,l));return e?t.filter(t=>`${t.family} ${t.note} ${t.category}`.toLowerCase().includes(e)):t},[i,o,l]),d=t=>{c({role:e,family:t.family,stack:Hu(t),...t.google?{google:t.google}:{}})};return(0,H.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-2 border-b p-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:r,"aria-label":`Back to theme`,className:`size-6 shrink-0 grid place-items-center rounded-md text-muted-foreground hover:text-foreground cursor-pointer`,children:(0,H.jsx)(Mt,{size:14})}),(0,H.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Face for `,(0,H.jsx)(`span`,{className:`font-mono text-foreground`,children:e})]})]}),(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(rr,{size:13,className:`pointer-events-none absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground/60`}),(0,H.jsx)(Q,{autoFocus:!0,value:i,onChange:e=>a(e.target.value),placeholder:`Search ${Bu.length} families`,spellCheck:!1,"aria-label":`Search families`,className:`h-7 pl-7 text-xs`})]}),(0,H.jsx)(`div`,{className:`flex items-center gap-0.5 rounded-md bg-muted p-0.5`,children:Xy.map(e=>(0,H.jsx)(`button`,{type:`button`,onClick:()=>s(e.id),"aria-pressed":o===e.id,className:`flex-1 h-6 rounded-[5px] text-[11px] cursor-pointer `+(o===e.id?`bg-background font-medium text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:e.label},e.id))})]}),(0,H.jsx)(`div`,{className:`flex-1 overflow-y-auto scroll-stable`,children:u.length===0?(0,H.jsxs)(`p`,{className:`p-4 text-xs text-muted-foreground`,children:[i.trim()?`No family here matches "${i.trim()}".`:`Nothing in this filter.`,o===`suited`?` Try All.`:``]}):u.map(e=>(0,H.jsx)(eb,{font:e,picked:e.family===t,onPreview:()=>d(e),onPick:()=>n(e)},e.family))})]})}function eb({font:e,picked:t,onPreview:n,onPick:r}){let i=(0,M.useRef)(null);return(0,M.useEffect)(()=>{let t=i.current;if(!t)return;let n=new IntersectionObserver(t=>{t.some(e=>e.isIntersecting)&&(By(e.family,e.google),n.disconnect())},{rootMargin:`200px`});return n.observe(t),()=>n.disconnect()},[e]),(0,H.jsxs)(`button`,{ref:i,type:`button`,onClick:r,onMouseEnter:n,onFocus:n,className:`flex w-full items-center gap-2 border-b px-3 py-2 text-left hover:bg-accent/50 focus-visible:bg-accent/50 outline-none cursor-pointer`,children:[(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`span`,{className:`block truncate text-[15px] leading-tight text-foreground`,style:{fontFamily:Hu(e)},children:e.family}),(0,H.jsx)(`span`,{className:`mt-0.5 block truncate text-[10px] text-muted-foreground/80`,children:e.note})]}),t?(0,H.jsx)(Bt,{size:13,className:`shrink-0 text-primary`}):null]})}function tb({theme:e,tree:t,path:n,node:r}){let i=of(e,t,n,r);if(!i)return null;let{resolved:a,overrides:o}=i;return(0,H.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(`div`,{className:`text-xs uppercase tracking-wider text-muted-foreground`,children:`Typeset`}),(0,H.jsxs)(`div`,{className:`rounded-md border bg-background`,children:[(0,H.jsxs)(`div`,{className:`flex items-baseline gap-2 border-b px-2.5 py-2`,children:[(0,H.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-[11px] font-semibold text-foreground`,children:i.role}),(0,H.jsxs)(`span`,{className:`truncate text-[10px] text-muted-foreground`,children:[`from `,i.via]})]}),(0,H.jsxs)(`div`,{className:`flex flex-col px-2.5 py-1.5`,children:[(0,H.jsx)(ob,{label:`Size`,value:`${a.fontSize}px`,override:o.size}),(0,H.jsx)(ob,{label:`Leading`,value:a.lineHeight.toFixed(2),override:o.leading}),(0,H.jsx)(ob,{label:`Tracking`,value:a.letterSpacing,override:o.tracking}),(0,H.jsx)(ob,{label:`Weight`,value:String(a.fontWeight),override:o.weight}),(0,H.jsx)(ob,{label:`Face`,value:rb(i),override:o.family,mono:i.face.role!==void 0})]})]}),nb(o)?(0,H.jsx)(`p`,{className:`text-[10px] leading-snug text-amber-600 dark:text-amber-500`,children:`Every rung property is overridden here, so this node ignores the theme's ladder — a rhythm change in the Theme tab won't move it.`}):null,(0,H.jsxs)(`p`,{className:`text-[10px] leading-snug text-muted-foreground`,children:[ab(i),` Change the rhythm or the faces in the Theme tab — it moves every node on this rung at once.`]}),i.responsive.length>0?(0,H.jsxs)(`p`,{className:`text-[10px] leading-snug text-muted-foreground/80`,children:[`Also `,(0,H.jsx)(`span`,{className:`font-mono text-foreground`,children:i.responsive.join(` `)}),` at wider breakpoints.`]}):null]})}function nb(e){return[`size`,`leading`,`tracking`,`weight`].every(t=>e[t])}function rb(e){let{slot:t,role:n,stack:r}=e.face;if(!n)return`inherited (${t})`;let i=r?ib(r):null;return i?`${n} → ${i}`:n}function ib(e){return/^\s*(?:"([^"]+)"|'([^']+)'|([^,]+))/.exec(e)?.slice(1).find(Boolean)?.trim()??e}function ab(e){let{region:t}=e;if(!t)return`Resolved against the default typeset — no typeset region wraps this node.`;let n=t.via===`prose`?`a Prose ancestor`:`a typeset class on an ancestor`;return`Resolved against the ${t.name==="default"?`default`:t.name} typeset, applied by ${n}.`}function ob({label:e,value:t,override:n,mono:r}){return(0,H.jsxs)(`div`,{className:`flex items-baseline gap-2 py-1`,children:[(0,H.jsx)(`span`,{className:`w-16 shrink-0 text-[10px] text-muted-foreground`,children:e}),(0,H.jsx)(`span`,{title:t,className:n?`min-w-0 max-w-[45%] truncate font-mono text-[11px] text-muted-foreground/60 line-through`:`min-w-0 flex-1 truncate text-[11px] text-foreground${r?` font-mono`:``}`,children:t}),n?(0,H.jsx)(`span`,{title:`${n} overrides the ${e.toLowerCase()} this rung would set`,className:`min-w-0 flex-1 truncate font-mono text-[11px] text-foreground`,children:n}):null]})}var sb=200,cb=new Set([`className`,`asChild`,`children`]);function lb(){let e=B(e=>e.selection),t=B(e=>e.selectionComputed),n=rd(),r=B(e=>e.components),i=B(e=>e.repoCatalog),a=B(e=>e.screens),o=B(e=>e.styleChannel),s=B(e=>e.channelsByLibrary),c=B(e=>e.theme),l=B(e=>e.themeName),u=B(e=>e.browsingFaces),d=B(e=>e.setBrowsingFaces),f=B(e=>e.loadComponents),p=B(e=>e.loadGeneratedAssets);(0,M.useEffect)(()=>{f()},[f]),(0,M.useEffect)(()=>{p()},[p]);let m=(0,M.useMemo)(()=>Dc(a,e),[a,e]),h=e?a[e.screenId]?.tree:void 0,g=(0,M.useMemo)(()=>!m||!r||!Ni(m)||Hi(m)?null:r.find(e=>e.id===m.$ref)??null,[m,r]),_=(0,M.useMemo)(()=>m&&Hi(m)?Uc(i,m.$repo):null,[m,i]),v=_v(sb,e=>{I.updateProps({screenId:e.screenId,path:z(e.path),propPatch:{[e.name]:e.value===void 0?null:e.value}}).catch(e=>R(e,`Could not update prop`))}),y=ep({selection:e,node:m,liveClasses:m?Ff(m):``}),b=bd(t),x=n[0]??null;if(!e)return(0,H.jsx)(zh,{size:`panel`,icon:Fn,title:`Nothing selected`,hint:`Click a node in the canvas to edit its props.`});if(!m)return(0,H.jsx)(zh,{size:`panel`,icon:Tr,title:`Selection is gone`,hint:`The selected node is no longer in the tree.`});if(Pi(m))return(0,H.jsx)(Av,{selection:e,node:m});if(!Ni(m))return(0,H.jsx)(zh,{size:`panel`,icon:Rt,title:`Not editable here`,hint:`$param placeholders are only addressable inside a snippet body — open the snippet to edit.`});let S=(t,n)=>v({screenId:e.screenId,path:e.path,name:t,value:n}),C=a[e.screenId]?.library,w=(C?s[C]:void 0)??o,T=Hi(m)?m.$repo:null,E=_?.styleProps??[],D=E.includes(`sx`)?`sx`:E.includes(`style`)?`style`:null,O=T?E.includes(`className`)&&w?.kind===`tailwind-classname`:w?.kind!==`sx`&&w?.kind!==`style`,k=T?D??`className`:w?.prop??`className`,A=T?D:w?.kind,ee=A===`sx`||A===`style`,te=new Set([...cb,k,...E,...Xd({node:m,descriptor:g}).controls.map(e=>e.slot.via===`prop`?e.slot.name:null).filter(e=>e!==null)]),ne=Zd(m),re=`${e.screenId}:${e.path}`,ie=typeof m.props?.children==`string`?m.props.children:``,ae=typeof m.props?.children==`string`||(T?(_?.acceptsChildren??!0)&&!m.children?.length:g===null),oe=typeof m.props?.src==`string`?m.props.src:null,se=`${re}:${oe??``}`;if(u&&c){let t=h?of(c,h,z(e.path),m):null,n=t?.overrides.family?.replace(/^font-/,``)??t?.face.role??t?.face.slot??`body`,r=c.typography.fontFamily?.[n];return(0,H.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,H.jsx)($y,{role:n,current:r?Uy(r):void 0,onBack:()=>d(!1),onPick:t=>{d(!1);let n=e;qy(c,l,t).then(e=>I.applyClasses({screenId:n.screenId,path:z(n.path),classes:Vf(typeof m.props?.className==`string`?m.props.className:``,`fontFamily`,e)})).catch(e=>R(e,`Could not set the face`))}})})}return(0,H.jsxs)(`div`,{className:`flex-1 flex flex-col overflow-hidden`,children:[(0,H.jsxs)(`header`,{className:`px-4 py-3 border-b`,children:[(0,H.jsxs)(`div`,{className:`font-semibold text-sm truncate`,children:[m.$ref,ne?(0,H.jsx)(`span`,{className:`ml-1.5 font-mono text-xs text-muted-foreground`,children:ne}):null]}),(0,H.jsxs)(`div`,{className:`text-xs text-muted-foreground mt-0.5`,children:[e.screenId,` · `,e.path===``?`(root)`:e.path]})]}),(0,H.jsx)(db,{},re),(0,H.jsxs)(`div`,{className:`flex-1 overflow-y-auto scroll-stable p-4 flex flex-col gap-4`,children:[T?(0,H.jsx)(Dv,{repo:T,entry:_}):null,(0,H.jsx)(xv,{initialValue:qi(m)??``,screenId:e.screenId,path:e.path},`${re}:id`),ae?(0,H.jsx)(vv,{initialValue:ie,screenId:e.screenId,path:e.path,debounceMs:sb},`${re}:children`):null,oe===null?null:(0,H.jsx)(fp,{screenId:e.screenId,path:e.path,src:oe,nodeAspect:typeof m.props?.aspect==`string`?m.props.aspect:void 0},`${re}:image`),T&&!O?null:(0,H.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,H.jsx)(`div`,{className:`text-xs uppercase tracking-wider text-muted-foreground`,children:`Style`}),(0,H.jsx)(yv,{node:m,tree:h,path:e.path,theme:c,descriptor:g,snippet:null,classChannel:O,computed:b,measured:x,onChange:y},`${re}:style`)]}),c&&h?(0,H.jsx)(tb,{theme:c,tree:h,path:z(e.path),node:m}):null,_?(0,H.jsx)(Ov,{props:_.props,values:m.props,hidden:te,fieldKey:se,onChange:S}):null,g&&g.props.filter(e=>!te.has(e.name)).length>0?(0,H.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,H.jsx)(`div`,{className:`text-xs uppercase tracking-wider text-muted-foreground`,children:`Props`}),g.props.filter(e=>!te.has(e.name)).map(e=>(0,H.jsx)(Ev,{descriptor:e,initialValue:m.props?.[e.name],onChange:t=>S(e.name,t)},`${se}:${e.name}`))]}):null,e.screenId.startsWith(`snippet:`)?(0,H.jsx)(Pv,{selection:e,node:m},`${re}:subs`):null,ee?(()=>{let t=m.props?.[k]&&typeof m.props[k]==`object`?m.props[k]:void 0,n=`${re}:${k}`,r={initialValue:t,prop:k,screenId:e.screenId,path:e.path,debounceMs:sb};return A===`sx`?(0,H.jsx)(Ry,{...r},n):(0,H.jsx)(_y,{...r},n)})():null]})]})}var ub=[`default`,`hover`,`focus`,`active`,`disabled`];function db(){let e=B(e=>e.nodeState),t=B(e=>e.setNodeState);return(0,M.useEffect)(()=>(t(`default`),()=>t(`default`)),[t]),(0,H.jsxs)(`div`,{className:`px-4 py-2 border-b flex items-center gap-2`,children:[(0,H.jsx)(G,{htmlFor:`node-state`,className:`text-xs uppercase tracking-wider text-muted-foreground`,children:`State`}),(0,H.jsxs)(K,{value:e,onValueChange:e=>t(e),children:[(0,H.jsx)(J,{id:`node-state`,size:`sm`,className:`flex-1 text-xs`,children:(0,H.jsx)(q,{})}),(0,H.jsx)(Y,{children:ub.map(e=>(0,H.jsx)(X,{value:e,children:e},e))})]})]})}function fb(e,t){return t?`${e} — ${t}`:e}function pb({side:e,expandLabel:t,hotkey:n,onExpand:r,actions:i=[]}){return(0,H.jsxs)(`div`,{className:`flex h-full w-full flex-col items-center gap-1 py-2`,children:[(0,H.jsx)(W,{variant:`ghost`,size:`icon-sm`,onClick:r,title:fb(t,n),"aria-label":t,"aria-expanded":!1,children:e===`left`?(0,H.jsx)(Vn,{}):(0,H.jsx)(Un,{})}),i.length>0?(0,H.jsx)(`div`,{className:`my-1 h-px w-4 shrink-0 bg-border`}):null,i.map(e=>(0,H.jsxs)(W,{variant:`ghost`,size:`icon-sm`,onClick:e.onClick,title:e.dot?`${e.label} — ${e.dot.title}`:e.label,"aria-label":e.label,className:`relative ${e.active?`bg-accent text-accent-foreground`:`text-muted-foreground`}`,children:[e.icon,e.dot?(0,H.jsx)(`span`,{"data-rail-dot":e.label,className:`absolute right-1 top-1 size-1.5 rounded-full bg-primary`}):null]},e.label))]})}function mb({side:e,label:t,hotkey:n,onCollapse:r}){return(0,H.jsx)(W,{variant:`ghost`,size:`icon-sm`,onClick:r,title:fb(t,n),"aria-label":t,"aria-expanded":!0,className:`shrink-0 text-muted-foreground`,children:e===`left`?(0,H.jsx)(Bn,{}):(0,H.jsx)(Hn,{})})}function hb({side:e,width:t,onCommit:n,paneRef:r}){let i=(0,M.useRef)(null),a=e=>{let t=r.current;t&&(t.style.width=`${e}px`)},o=e=>{e.button===0&&(e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),i.current={startX:e.clientX,startWidth:t,width:t},document.body.classList.add(`velloo-resizing`))},s=t=>{let n=i.current;if(!n)return;let r=e===`left`?t.clientX-n.startX:n.startX-t.clientX;n.width=rc(n.startWidth+r),a(n.width)},c=e=>{let t=i.current;t&&(i.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),document.body.classList.remove(`velloo-resizing`),n(t.width))},l=(e,r)=>{let i=r?48:16;n(rc(t+(e?-i:i)))},u=t=>{t.key===`ArrowLeft`?(t.preventDefault(),l(e===`left`,t.shiftKey)):t.key===`ArrowRight`?(t.preventDefault(),l(e===`right`,t.shiftKey)):(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),n(nc.default))},d=`Resize ${e===`left`?`sidebar`:`inspector`}`;return(0,H.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":d,"aria-valuenow":t,"aria-valuemin":nc.min,"aria-valuemax":nc.max,tabIndex:0,title:`${d} — double-click to reset`,onPointerDown:o,onPointerMove:s,onPointerUp:c,onPointerCancel:c,onDoubleClick:()=>{a(nc.default),n(nc.default)},onKeyDown:u,className:`group absolute inset-y-0 z-10 w-1.5 cursor-col-resize pointer-events-auto outline-none `+(e===`left`?`right-0`:`left-0`),children:(0,H.jsx)(`div`,{className:`h-full w-px bg-transparent transition-colors group-hover:bg-primary/60 group-focus-visible:bg-primary `+(e===`left`?`ml-auto`:`mr-auto`)})})}var gb=36,_b=200;function vb({side:e,collapsed:t,width:n,onResize:r,rail:i,contentDisabled:a=!1,children:o}){let s=yb(t),c=(0,M.useRef)(null);return(0,H.jsx)(`aside`,{ref:c,"data-pane":e,"data-collapsed":t,style:{width:t?gb:n},className:`relative h-full shrink-0 overflow-hidden bg-card `+(e===`left`?`border-r `:`border-l `)+(s?`transition-[width] duration-200 ease-out`:``),children:t&&!s?i:(0,H.jsxs)(H.Fragment,{children:[t?null:(0,H.jsx)(hb,{side:e,width:n,onCommit:r,paneRef:c}),(0,H.jsx)(`div`,{style:{width:t||s?n:`100%`},className:`absolute inset-y-0 flex flex-col ${e===`left`?`left-0`:`right-0`} `+(a?`opacity-50 pointer-events-none select-none`:``),"aria-disabled":a||void 0,children:o})]})})}function yb(e){let t=xb(),[n,r]=(0,M.useState)(e),[i,a]=(0,M.useState)(!1);return n!==e&&(r(e),a(!t)),(0,M.useEffect)(()=>{if(!i)return;let e=setTimeout(()=>a(!1),_b);return()=>clearTimeout(e)},[i]),i}var bb=`(prefers-reduced-motion: reduce)`;function xb(){let[e,t]=(0,M.useState)(()=>typeof matchMedia==`function`&&matchMedia(bb).matches);return(0,M.useEffect)(()=>{if(typeof matchMedia!=`function`)return;let e=matchMedia(bb),n=()=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}var Sb=250;function Cb({label:e,tokenPath:t,value:n}){let[r,i]=(0,M.useState)(n),[a,o]=(0,M.useState)(!1),s=(0,M.useRef)(null),c=B(e=>e.themeName);(0,M.useEffect)(()=>{i(n)},[n]),(0,M.useEffect)(()=>()=>{s.current&&clearTimeout(s.current)},[]);let l=e=>{i(e),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{let n=fd(e)??e;bs.setToken(c,t,n).catch(e=>R(e,`Could not set color token`))},Sb)};return(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsxs)(Lp,{open:a,onOpenChange:o,children:[(0,H.jsx)(Rp,{asChild:!0,children:(0,H.jsx)(`button`,{type:`button`,className:`h-7 w-7 rounded-md border shrink-0 cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background`,style:{background:r},title:`${t} — click to edit`,"aria-label":`Edit ${e}`})}),(0,H.jsx)(zp,{align:`start`,className:`w-72`,children:(0,H.jsx)(wb,{currentValue:r,onCommit:l})})]}),(0,H.jsxs)(`div`,{className:`flex-1 min-w-0 flex flex-col gap-1`,children:[(0,H.jsx)(G,{htmlFor:`token-${t}`,className:`text-xs text-muted-foreground truncate`,children:e}),(0,H.jsx)(Q,{id:`token-${t}`,type:`text`,value:r,onChange:e=>l(e.target.value),spellCheck:!1,className:`text-xs font-mono`})]})]})}function wb({currentValue:e,onCommit:t}){let n=ud(e)??{hex:`#000000`,oklch:`oklch(0 0 0)`,hsl:`hsl(0 0% 0%)`},[r,i]=(0,M.useState)(n.hex),[a,o]=(0,M.useState)(n.oklch),[s,c]=(0,M.useState)(n.hsl),[l,u]=(0,M.useState)(()=>xp(n.hex)??{h:0,s:0,v:0}),d=(e,n)=>{let r=ud(e);if(!r){n===`hex`&&i(e),n===`oklch`&&o(e),n===`hsl`&&c(e);return}if(i(r.hex),o(r.oklch),c(r.hsl),n!==`wheel`){let e=xp(r.hex);e&&u(e)}t(r.oklch)};return(0,H.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,H.jsx)(Tp,{value:l,onChange:e=>{u(e),d(bp(e),`wheel`)}}),(0,H.jsx)(Tb,{label:`HEX`,value:r,onChange:e=>d(e,`hex`)}),(0,H.jsx)(Tb,{label:`OKLCH`,value:a,onChange:e=>d(e,`oklch`)}),(0,H.jsx)(Tb,{label:`HSL`,value:s,onChange:e=>d(e,`hsl`)})]})}function Tb({label:e,value:t,onChange:n}){let r=`velloo-color-${e.toLowerCase()}`;return(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,H.jsx)(`label`,{htmlFor:r,className:`w-12 text-muted-foreground uppercase tracking-wider`,children:e}),(0,H.jsx)(Q,{id:r,type:`text`,value:t,onChange:e=>n(e.target.value),spellCheck:!1,className:`flex-1 font-mono text-xs`})]})}var Eb={AAA:`text-emerald-600 dark:text-emerald-400`,AA:`text-emerald-600 dark:text-emerald-400`,AAlarge:`text-amber-600 dark:text-amber-400`,Fail:`text-rose-600 dark:text-rose-400`},Db={AAA:`AAA`,AA:`AA`,AAlarge:`AA·lg`,Fail:`FAIL`};function Ob({bumpKey:e}){let[t,n]=(0,M.useState)(null),r=B(e=>e.themeName);if((0,M.useEffect)(()=>{let e=!0,t=r==="default"?``:`?name=${encodeURIComponent(r)}`;return fetch(`/api/theme/contrast${t}`).then(e=>e.ok?e.json():Promise.reject(Error(`${e.status}`))).then(t=>{e&&n(t.results)}).catch(()=>{e&&n([])}),()=>{e=!1}},[e,r]),!t)return null;if(t.length===0)return(0,H.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:`Contrast: no parseable pairs.`});let i=t.filter(e=>e.tier===`Fail`),a=`${t.length-i.length}/${t.length} pass WCAG AA`;return(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,H.jsx)(`span`,{className:`font-medium`,children:`Contrast`}),(0,H.jsx)(`span`,{className:`tabular-nums `+(i.length===0?`text-emerald-600 dark:text-emerald-400`:`text-rose-600 dark:text-rose-400`),children:a})]}),(0,H.jsx)(`ul`,{className:`flex flex-col gap-1`,children:t.map(e=>(0,H.jsxs)(`li`,{className:`flex items-center justify-between gap-2 rounded-md border bg-background px-1.5 py-1 text-[10px]`,children:[(0,H.jsx)(`span`,{className:`truncate text-muted-foreground`,children:e.label}),(0,H.jsxs)(`span`,{className:`shrink-0 tabular-nums ${Eb[e.tier]}`,children:[e.ratio.toFixed(2),`:1 `,Db[e.tier]]})]},e.label))})]})}function kb({presets:e,activeName:t}){let[n,r]=(0,M.useState)(null),i=B(e=>e.themeName);if((0,M.useEffect)(()=>{let e=!0;return fetch(`/api/theme/preset-summaries`).then(e=>e.ok?e.json():Promise.reject(Error(`${e.status}`))).then(t=>{e&&r(t.presets)}).catch(()=>{}),()=>{e=!1}},[]),e.length===0)return null;let a=e=>{bs.applyPreset(i,e).catch(e=>R(e,`Could not apply preset`))};return n?(0,H.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:n.map(e=>{let n=e.name===t;return(0,H.jsxs)(`button`,{type:`button`,onClick:()=>a(e.name),className:`group flex flex-col items-stretch gap-1.5 rounded-md border p-2 text-left transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background `+(n?`border-primary ring-2 ring-primary/30`:`border-border hover:border-primary/50`),title:`${e.name}${n?` — active`:``}`,children:[(0,H.jsxs)(`div`,{className:`flex h-9 w-full overflow-hidden rounded`,style:{backgroundColor:e.swatches.background},children:[(0,H.jsx)(`div`,{className:`flex-1`,style:{backgroundColor:e.swatches.primary}}),(0,H.jsx)(`div`,{className:`flex-1`,style:{backgroundColor:e.swatches.accent}}),(0,H.jsx)(`div`,{className:`flex-1`,style:{backgroundColor:e.swatches.background}})]}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsx)(`span`,{className:`text-xs font-medium`,children:e.name}),n?(0,H.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-primary`,children:`active`}):null]})]},e.name)})}):(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.map(e=>(0,H.jsx)(W,{variant:e===t?`default`:`outline`,size:`xs`,onClick:()=>a(e),className:`rounded-full`,children:e},e))})}var Ab=/^[a-z][a-z0-9-]*$/;function jb(){let e=B(e=>e.currentBoardId),t=B(e=>e.themeName),n=B(e=>e.folderConfig),r=B(e=>e.loadFolderConfig),[i,a]=(0,M.useState)(!1),[o,s]=(0,M.useState)(``);(0,M.useEffect)(()=>{r()},[r]);let c=n?.themes??[`default`],l=c.includes(t)?c:[...c,t],u=async n=>{if(e&&n!==t)try{await I.updateBoard({boardId:e,patch:{theme:n==="default"?null:n}})}catch(e){R(e,`Could not switch the theme`)}},d=o.trim(),f=Ab.test(d)&&d!=="default"&&!c.includes(d),p=async()=>{if(f){a(!1);try{await bs.addTheme(d,t),await r(),await u(d)}catch(e){R(e,`Could not create the theme`)}}};return(0,H.jsxs)(`div`,{className:`mb-3 flex flex-col gap-1.5 rounded-md border bg-muted/40 p-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,H.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground`,children:`Editing`}),(0,H.jsx)(ey,{value:t,onChange:e=>void u(e),options:l.map(e=>[e]),className:`ml-auto min-w-[8rem] font-mono`,label:`Theme being edited`}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>{s(``),a(e=>!e)},title:`New theme from this one`,"aria-label":`New theme from this one`,className:`size-7 shrink-0 grid place-items-center rounded-md border border-input bg-background text-muted-foreground hover:text-foreground cursor-pointer`,children:(0,H.jsx)(Xn,{size:13})})]}),i?(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,H.jsx)(Q,{autoFocus:!0,value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&p(),e.key===`Escape`&&a(!1)},placeholder:`new-theme-name`,spellCheck:!1,"aria-label":`New theme name`,className:`h-7 flex-1 font-mono text-xs`}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>void p(),disabled:!f,"aria-label":`Create theme`,className:`size-7 shrink-0 grid place-items-center rounded-md border border-input bg-background text-muted-foreground hover:text-foreground disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer`,children:(0,H.jsx)(Bt,{size:13})}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>a(!1),"aria-label":`Cancel`,className:`size-7 shrink-0 grid place-items-center rounded-md text-muted-foreground hover:text-foreground cursor-pointer`,children:(0,H.jsx)(jr,{size:13})})]}),(0,H.jsx)(`span`,{className:`text-[10px] leading-snug text-muted-foreground/80`,children:d.length>0&&!f?c.includes(d)||d==="default"?`"${d}" already exists`:`Lowercase letters, digits and dashes — it becomes the file name`:`Copies ${t} to theme/${d||`name`}.json and pins this board to it`})]}):(0,H.jsx)(`span`,{className:`text-[10px] leading-snug text-muted-foreground`,children:e?t==="default"?`The folder default — edits here reach every board that hasn't pinned its own.`:`Pinned by this board, so edits here leave every other board alone.`:`No board selected.`})]})}var Mb=[`h1`,`h3`,`body`,`caption`],Nb=26;function Pb({scale:e,rootPx:t}){let n=Math.max(...Mb.map(t=>e[t].fontSize)),r=Math.min(1,Nb/n);return(0,H.jsxs)(`div`,{className:`rounded-md border bg-background px-2.5 py-2`,children:[(0,H.jsxs)(`div`,{className:`mb-1 flex items-baseline gap-1.5`,children:[(0,H.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:`Resolved ladder`}),(0,H.jsx)(`span`,{className:`ml-auto font-mono text-[10px] text-muted-foreground/70`,children:`at ${t}px base`})]}),Mb.map((t,n)=>{let i=e[t];return(0,H.jsxs)(`div`,{className:`flex items-baseline gap-3 py-1.5${n===Mb.length-1?``:` border-b`}`,children:[(0,H.jsx)(`span`,{className:`w-12 shrink-0 font-mono text-[10px] text-muted-foreground`,children:t}),(0,H.jsx)(`span`,{className:`truncate text-foreground`,style:{fontSize:i.fontSize*r,lineHeight:1,letterSpacing:i.letterSpacing,fontWeight:i.fontWeight,...i.fontFamily?{fontFamily:i.fontFamily}:{}},children:`Aa`}),(0,H.jsx)(`span`,{className:`ml-auto shrink-0 font-mono text-[10px] tabular-nums text-muted-foreground/80`,children:`${i.fontSize} / ${i.lineHeight.toFixed(2)}`})]},t)})]})}function Fb({className:e,defaultValue:t,value:n,min:r=0,max:i=100,tone:a=`primary`,"aria-label":o,...s}){let c=a===`muted`,l=M.useMemo(()=>Array.isArray(n)?n:Array.isArray(t)?t:[r,i],[n,t,r,i]);return(0,H.jsxs)(Je,{"data-slot":`slider`,...t===void 0?{}:{defaultValue:t},...n===void 0?{}:{value:n},min:r,max:i,className:V(`relative flex w-full touch-none items-center select-none data-disabled:opacity-50 data-vertical:h-full data-vertical:min-h-40 data-vertical:w-auto data-vertical:flex-col`,e),...s,children:[(0,H.jsx)(Ee,{"data-slot":`slider-track`,className:`relative grow overflow-hidden rounded-full bg-muted data-horizontal:h-1 data-horizontal:w-full data-vertical:h-full data-vertical:w-1`,children:(0,H.jsx)(Be,{"data-slot":`slider-range`,className:V(`absolute select-none data-horizontal:h-full data-vertical:w-full`,c?`bg-muted-foreground/30`:`bg-primary`)})}),Array.from({length:l.length},(e,t)=>(0,H.jsx)(Re,{"data-slot":`slider-thumb`,"aria-label":o,className:V(c&&`border-muted-foreground/40 bg-muted`,`relative block size-3 shrink-0 rounded-full border border-ring bg-white ring-ring/50 transition-[color,box-shadow] select-none after:absolute after:-inset-2 hover:ring-3 focus-visible:ring-3 focus-visible:outline-hidden active:ring-3 disabled:pointer-events-none disabled:opacity-50`)},t))]})}function Ib({label:e,value:t,min:n,max:r,step:i,display:a,authored:o,onClear:s,hint:c,onPreview:l,onCommit:u}){return(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsxs)(`div`,{className:`flex items-baseline gap-1.5`,children:[(0,H.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 shrink-0 self-center rounded-full `+(o?`bg-primary`:`border border-muted-foreground/40`)}),(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e}),o?null:(0,H.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide text-muted-foreground/60`,children:`inherited`}),o&&s?(0,H.jsx)(`button`,{type:`button`,onClick:s,title:`Clear ${e} — inherit it from the default typeset again`,"aria-label":`Clear ${e}`,className:`ml-auto text-muted-foreground/60 hover:text-foreground cursor-pointer`,children:(0,H.jsx)(tr,{size:11})}):null,(0,H.jsx)(`span`,{className:(o&&s?``:`ml-auto `)+`font-mono text-xs tabular-nums `+(o?`text-foreground`:`text-muted-foreground/60`),children:a})]}),(0,H.jsx)(Fb,{"aria-label":e,tone:o?`primary`:`muted`,value:[t],min:n,max:r,step:i,onValueChange:([e])=>l(e),onValueCommit:([e])=>u(e)}),(0,H.jsx)(`span`,{className:`text-[10px] text-muted-foreground/80`,children:c})]})}function Lb({names:e,selected:t,onSelect:n,onAdd:r,onRename:i,onRemove:a}){let[o,s]=(0,M.useState)(null),[c,l]=(0,M.useState)(``),[u,d]=(0,M.useState)(!1),f=t===aa,p=()=>{l(``),s(`add`)},m=()=>{l(t),s(`rename`)},h=o===`rename`?e.filter(e=>e!==t):e,g=c.trim(),_=g.length>0&&oa(g)&&!h.includes(g),v=()=>{_&&(o===`add`?r(g):i(t,g),s(null))};return o?(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,H.jsx)(Q,{autoFocus:!0,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&v(),e.key===`Escape`&&s(null)},placeholder:o===`add`?`New preset name`:`Rename preset`,spellCheck:!1,className:`h-7 flex-1 text-xs font-mono`,"aria-label":o===`add`?`New preset name`:`Rename preset`}),(0,H.jsx)(`button`,{type:`button`,onClick:v,disabled:!_,"aria-label":`Confirm`,className:`size-7 shrink-0 grid place-items-center rounded-md border border-input bg-background text-muted-foreground hover:text-foreground disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer`,children:(0,H.jsx)(Bt,{size:13})}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>s(null),"aria-label":`Cancel`,className:`size-7 shrink-0 grid place-items-center rounded-md text-muted-foreground hover:text-foreground cursor-pointer`,children:(0,H.jsx)(jr,{size:13})})]}),(0,H.jsx)(`span`,{className:`text-[10px] text-muted-foreground/80`,children:g.length>0&&!_?h.includes(g)?`"${g}" already exists`:`Letters, digits, dash and underscore only — it becomes a class name`:`Becomes .typeset-${g||`name`}`})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,H.jsx)(`div`,{className:`flex-1 min-w-0 flex items-center gap-0.5 p-0.5 rounded-md bg-muted overflow-x-auto`,children:e.map(e=>(0,H.jsx)(`button`,{type:`button`,onClick:()=>n(e),"aria-pressed":e===t,className:`flex-1 min-w-14 h-6 px-2 grid place-items-center rounded-[5px] text-[11px] truncate cursor-pointer `+(e===t?`bg-background font-medium text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:e},e))}),(0,H.jsx)(`button`,{type:`button`,onClick:p,title:`New preset`,"aria-label":`New preset`,className:`size-7 shrink-0 grid place-items-center rounded-md border border-input bg-background text-muted-foreground hover:text-foreground cursor-pointer`,children:(0,H.jsx)(Xn,{size:13})})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,H.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground/80 truncate`,children:f?`:root — styles every screen`:`.typeset-${t}`}),f?null:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{type:`button`,onClick:m,title:`Rename ${t}`,"aria-label":`Rename ${t}`,className:`ml-auto text-muted-foreground/60 hover:text-foreground cursor-pointer`,children:(0,H.jsx)(Jn,{size:11})}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>d(!0),title:`Delete ${t}`,"aria-label":`Delete ${t}`,className:`text-muted-foreground/60 hover:text-destructive cursor-pointer`,children:(0,H.jsx)(xr,{size:11})})]})]})]}),(0,H.jsx)(ql,{open:u,onOpenChange:d,children:(0,H.jsxs)(Xl,{children:[(0,H.jsxs)(Zl,{children:[(0,H.jsx)(eu,{children:`Delete the "${t}" typeset`}),(0,H.jsx)(tu,{children:`Any region still carrying .typeset-${t} keeps the class but falls back to the default typeset's rhythm.`})]}),(0,H.jsxs)(Ql,{children:[(0,H.jsx)(ru,{children:`Cancel`}),(0,H.jsx)(nu,{variant:`destructive`,onClick:()=>{d(!1),a(t)},children:`Delete`})]})]})})]})}var Rb={min:12,max:24,step:.5},zb={min:1,max:2.2,step:.05},Bb={min:.4,max:2.5,step:.05},Vb=`__none`,Hb=[{field:`fontBody`,label:`Body`},{field:`fontHeading`,label:`Heading`},{field:`fontMono`,label:`Mono`}];function Ub(e){return[aa,...Object.keys(e).filter(e=>e!==aa).sort()]}function Wb({theme:e}){let t=e.typography.typesets??{},n=Ub(t),[r,i]=(0,M.useState)(aa),a=B(e=>e.setTypesetDraft),o=B(e=>e.typesetDraft),s=B(e=>e.refreshTheme),c=B(e=>e.themeName),l=n.includes(r)?r:aa;(0,M.useEffect)(()=>()=>a(null),[a]);let u=t[l]??{},d=o?.name===l?o.typeset:u,f=l===aa,p=t.default??{},m=ga(f?d:{...p,...d}),h=Object.keys(e.typography.fontFamily??{}).sort(),g=ya(m.size),_=ba(m,{fontFamily:e.typography.fontFamily??{}}),v=e=>{a({name:l,typeset:{...d,...e}})},y=(e,t)=>{bs.setTypeset(c,[e]).then(()=>t?.()).catch(e=>{R(e,`Could not update the typeset`),s()})},b=e=>y({name:l,...e});return(0,H.jsxs)(`div`,{className:`flex flex-col gap-3.5`,children:[(0,H.jsx)(Lb,{names:n,selected:l,onSelect:e=>{a(null),i(e)},onAdd:e=>y({name:e},()=>i(e)),onRename:(e,t)=>y({name:e,renameTo:t},()=>i(t)),onRemove:e=>y({name:e,remove:!0},()=>i(aa))}),(0,H.jsx)(Ib,{label:`Size`,value:g,...Rb,display:d.size===void 0?String(m.size):Kb(d.size),authored:d.size!==void 0,onClear:d.size===void 0?void 0:()=>b({size:null}),hint:d.size===void 0?`1em follows the container — drag to pin it`:`pinned; clear to follow the container again`,onPreview:e=>v({size:`${e}px`}),onCommit:e=>b({size:`${e}px`})}),(0,H.jsx)(Ib,{label:`Leading`,value:m.leading,...zb,display:m.leading.toFixed(2),authored:d.leading!==void 0,onClear:d.leading===void 0?void 0:()=>b({leading:null}),hint:`body line-height — the whole ladder scales with it`,onPreview:e=>v({leading:e}),onCommit:e=>b({leading:e})}),(0,H.jsx)(Ib,{label:`Flow`,value:ya(m.flow)/16,...Bb,display:Kb(m.flow),authored:d.flow!==void 0,onClear:d.flow===void 0?void 0:()=>b({flow:null}),hint:`space between blocks, and the air above a heading`,onPreview:e=>v({flow:`${qb(e)}em`}),onCommit:e=>b({flow:`${qb(e)}em`})}),(0,H.jsx)(pp,{}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[Hb.map(({field:e,label:t})=>(0,H.jsx)(Gb,{label:t,roles:h,value:d[e],inherited:f?void 0:p[e],onChange:t=>b({[e]:t})},e)),(0,H.jsx)(`p`,{className:`text-[10px] leading-relaxed text-muted-foreground/80`,children:`Roles, not stacks — they point at the fonts you declared, so swapping a face updates every typeset that names it.`})]}),(0,H.jsx)(pp,{}),(0,H.jsx)(Pb,{scale:_,rootPx:g})]})}function Gb({label:e,roles:t,value:n,inherited:r,onChange:i}){return(0,H.jsxs)(`label`,{className:`flex items-center gap-1.5`,children:[(0,H.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 shrink-0 rounded-full `+(n===void 0?`border border-muted-foreground/40`:`bg-primary`)}),(0,H.jsx)(`span`,{className:`w-14 shrink-0 text-xs text-muted-foreground`,children:e}),(0,H.jsx)(ey,{value:n??Vb,onChange:e=>i(e===Vb?null:e),options:[[Vb,r?`${r} (inherited)`:`—`],...t.map(e=>[e,e])],className:`flex-1 min-w-0`})]})}function Kb(e){return typeof e==`number`?`${e}px`:e}function qb(e){return Math.round(e*100)/100}function Jb({className:e,...t}){return(0,H.jsx)(Ye,{"data-slot":`accordion`,className:V(`flex w-full flex-col`,e),...t})}function Yb({className:e,...t}){return(0,H.jsx)(tt,{"data-slot":`accordion-item`,className:V(`not-last:border-b`,e),...t})}function Xb({className:e,children:t,...n}){return(0,H.jsx)(Le,{className:`flex`,children:(0,H.jsxs)(Ve,{"data-slot":`accordion-trigger`,className:V(`group/accordion-trigger relative flex flex-1 items-start justify-between rounded-lg border border-transparent py-2.5 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:after:border-ring disabled:pointer-events-none disabled:opacity-50 **:data-[slot=accordion-trigger-icon]:ml-auto **:data-[slot=accordion-trigger-icon]:size-4 **:data-[slot=accordion-trigger-icon]:text-muted-foreground`,e),...n,children:[t,(0,H.jsx)(Vt,{"data-slot":`accordion-trigger-icon`,className:`pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden`}),(0,H.jsx)(Ut,{"data-slot":`accordion-trigger-icon`,className:`pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline`})]})})}function Zb({className:e,children:t,...n}){return(0,H.jsx)(Pe,{"data-slot":`accordion-content`,className:`overflow-hidden text-sm data-open:animate-accordion-down data-closed:animate-accordion-up`,...n,children:(0,H.jsx)(`div`,{className:V(`h-(--radix-accordion-content-height) pt-0 pb-2.5 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4`,e),children:t})})}var Qb=[{key:`background`,label:`Background`,pair:!1},{key:`foreground`,label:`Foreground`,pair:!1},{key:`primary`,label:`Primary`,pair:!0},{key:`secondary`,label:`Secondary`,pair:!0},{key:`muted`,label:`Muted`,pair:!0},{key:`accent`,label:`Accent`,pair:!0},{key:`destructive`,label:`Destructive`,pair:!0},{key:`card`,label:`Card`,pair:!0},{key:`popover`,label:`Popover`,pair:!0},{key:`border`,label:`Border`,pair:!1},{key:`input`,label:`Input`,pair:!1},{key:`ring`,label:`Ring`,pair:!1}];function $b(e){return typeof e==`string`?e:e&&typeof e==`object`?e.DEFAULT:``}function ex(e){return e&&typeof e==`object`&&e.foreground?e.foreground:null}var tx=`velloo:theme-panel:sections`,nx=[`presets`,`generate`,`accessibility`];function rx(){if(typeof localStorage>`u`)return nx;let e=localStorage.getItem(tx);if(!e)return nx;try{let t=JSON.parse(e);if(Array.isArray(t))return t.filter(e=>typeof e==`string`)}catch{}return nx}function ix({theme:e,presets:t}){let[n,r]=(0,M.useState)(``),[i,a]=(0,M.useState)(null),[o,s]=(0,M.useState)(null),c=B(e=>e.themeVersion),l=B(e=>e.themeName),u=B(e=>e.refreshTheme),[d,f]=(0,M.useState)(()=>rx()),[p,m]=(0,M.useState)(null);(0,M.useEffect)(()=>{typeof localStorage>`u`||localStorage.setItem(tx,JSON.stringify(d))},[d]);let h=async()=>{if(n.trim()){a(`derive`),s(null);try{await bs.deriveFromColor(l,n.trim()),s(`palette derived from ${n.trim()}`)}catch(e){s(`derive failed: ${e.message}`)}finally{a(null)}}};if(p!==null){let t=e.typography.fontFamily?.[p];return(0,H.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,H.jsx)($y,{role:p,current:t?Uy(t):void 0,onBack:()=>m(null),onPick:e=>{m(null),bs.setFonts(l,[Ky(p,e)]).catch(e=>{R(e,`Could not set the face`),u()})}})})}return(0,H.jsxs)(`div`,{className:`flex-1 overflow-y-auto scroll-stable p-4`,children:[(0,H.jsx)(jb,{}),(0,H.jsxs)(Jb,{type:`multiple`,value:d,onValueChange:e=>f(e),className:`flex flex-col gap-1`,children:[(0,H.jsxs)(Yb,{value:`presets`,children:[(0,H.jsx)(Xb,{className:`text-xs uppercase tracking-wider text-muted-foreground hover:no-underline`,children:`Presets`}),(0,H.jsx)(Zb,{children:(0,H.jsx)(kb,{presets:t,activeName:e.name})})]}),(0,H.jsxs)(Yb,{value:`generate`,children:[(0,H.jsx)(Xb,{className:`text-xs uppercase tracking-wider text-muted-foreground hover:no-underline`,children:`Generate`}),(0,H.jsx)(Zb,{children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(G,{htmlFor:`theme-seed`,className:`text-xs text-muted-foreground`,children:`derive palette from color`}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(Q,{id:`theme-seed`,type:`text`,value:n,onChange:e=>r(e.target.value),placeholder:`#7c3aed or oklch(...)`,spellCheck:!1,className:`flex-1 text-xs font-mono`}),(0,H.jsx)(W,{variant:`outline`,size:`sm`,onClick:h,disabled:i!==null||!n.trim(),children:i===`derive`?`…`:`Apply`})]})]}),o?(0,H.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:o}):null]})})]}),(0,H.jsxs)(Yb,{value:`accessibility`,children:[(0,H.jsx)(Xb,{className:`text-xs uppercase tracking-wider text-muted-foreground hover:no-underline`,children:`Accessibility`}),(0,H.jsx)(Zb,{children:(0,H.jsx)(Ob,{bumpKey:c})})]}),(0,H.jsxs)(Yb,{value:`fonts`,children:[(0,H.jsx)(Xb,{className:`text-xs uppercase tracking-wider text-muted-foreground hover:no-underline`,children:`Fonts`}),(0,H.jsx)(Zb,{children:(0,H.jsx)(Gy,{theme:e,onBrowse:m})})]}),(0,H.jsxs)(Yb,{value:`typography`,children:[(0,H.jsx)(Xb,{className:`text-xs uppercase tracking-wider text-muted-foreground hover:no-underline`,children:`Typography`}),(0,H.jsx)(Zb,{children:(0,H.jsx)(Wb,{theme:e})})]}),(0,H.jsxs)(Yb,{value:`colors`,children:[(0,H.jsx)(Xb,{className:`text-xs uppercase tracking-wider text-muted-foreground hover:no-underline`,children:`Colors`}),(0,H.jsx)(Zb,{children:(0,H.jsx)(`div`,{className:`flex flex-col gap-3`,children:Qb.map(t=>{let n=e.colors[t.key],r=$b(n);if(!r)return null;let i=ex(n);return(0,H.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,H.jsx)(Cb,{label:t.label,tokenPath:t.pair&&typeof n==`object`?`colors.${t.key}.DEFAULT`:`colors.${t.key}`,value:r}),t.pair&&i?(0,H.jsx)(`div`,{className:`pl-9`,children:(0,H.jsx)(Cb,{label:`${t.label} fg`,tokenPath:`colors.${t.key}.foreground`,value:i})}):null]},t.key)})})})]})]})]})}function ax({screenId:e}){let t=B(e=>e.rightTab),n=B(e=>e.setRightTab),r=B(e=>e.selection),i=B(e=>e.selectionIntent),a=B(e=>e.pendingCommentAnchor),o=B(e=>e.activeCommentId),s=B(e=>e.theme),c=B(e=>e.presets),l=B(e=>e.cursorMode),u=B(e=>e.wsConnected),d=B(e=>e.rightPaneCollapsed),f=B(e=>e.setRightPaneCollapsed),p=B(e=>e.rightPaneWidth),m=B(e=>e.setRightPaneWidth);(0,M.useEffect)(()=>{r&&i===`inspect`&&!a&&!o&&l!==`comment`&&n(`node`)},[r,i,a,o,l,n]);let h=l===`hand`,g=e=>{n(e),f(!1)};return(0,H.jsxs)(vb,{side:`right`,collapsed:d,width:p,onResize:m,contentDisabled:!u,rail:(0,H.jsx)(pb,{side:`right`,expandLabel:`Expand inspector`,hotkey:`]`,onExpand:()=>f(!1),actions:[{icon:(0,H.jsx)(fr,{}),label:`Node`,active:t===`node`,onClick:()=>g(`node`)},{icon:(0,H.jsx)(kn,{}),label:`Comments`,active:t===`comments`,onClick:()=>g(`comments`)},{icon:(0,H.jsx)(Rn,{}),label:`Theme`,active:t===`theme`,onClick:()=>g(`theme`)}]}),children:[(0,H.jsxs)(`div`,{className:`border-b p-2 flex items-center gap-1`,children:[(0,H.jsx)(mb,{side:`right`,label:`Collapse inspector`,hotkey:`]`,onCollapse:()=>f(!0)}),(0,H.jsx)(Up,{value:t,onValueChange:e=>n(e),className:`min-w-0 flex-1`,children:(0,H.jsxs)(Gp,{className:`w-full h-8`,children:[(0,H.jsxs)(Kp,{value:`node`,className:`text-xs`,children:[(0,H.jsx)(fr,{}),`Node`]}),(0,H.jsxs)(Kp,{value:`theme`,className:`text-xs`,children:[(0,H.jsx)(Rn,{}),`Theme`]}),(0,H.jsxs)(Kp,{value:`comments`,className:`text-xs`,children:[(0,H.jsx)(kn,{}),`Comments`]})]})})]}),t===`comments`?(0,H.jsx)(hv,{}):t===`node`?h?(0,H.jsx)(ox,{children:`Hand tool active. Drag to pan; press V or Esc to return to select.`}):e?(0,H.jsx)(lb,{}):(0,H.jsx)(ox,{children:`No screen selected.`}):s?(0,H.jsx)(ix,{theme:s,presets:c}):(0,H.jsx)(ox,{children:(0,H.jsx)(Qu,{size:24,label:`Loading theme…`,className:`flex-col`})})]})}function ox({children:e}){return(0,H.jsx)(cl,{className:`flex-1 p-6`,children:(0,H.jsx)(pl,{className:`text-xs`,children:e})})}function sx({className:e,...t}){return(0,H.jsx)(`kbd`,{"data-slot":`kbd`,className:V(`pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-medium text-muted-foreground select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3`,e),...t})}function cx({className:e,...t}){return(0,H.jsx)(`kbd`,{"data-slot":`kbd-group`,className:V(`inline-flex items-center gap-1`,e),...t})}var lx=[`all`,`boards`,`screens`,`text`];function ux(){let e=B(e=>e.searchOpen),t=B(e=>e.setSearchOpen),[n,r]=(0,M.useState)(``),[i,a]=(0,M.useState)(null),[o,s]=(0,M.useState)(`all`),[c,l]=(0,M.useState)(0),u=(0,M.useRef)(0),d=(0,M.useRef)(null);(0,M.useEffect)(()=>{e&&(r(``),a(null),s(`all`),l(0))},[e]),(0,M.useEffect)(()=>{if(!e)return;let t=n.trim();if(t===``){a(null);return}let r=setTimeout(()=>{let e=++u.current;gs(t).then(t=>{e===u.current&&(a(t),l(0))}).catch(()=>{})},120);return()=>clearTimeout(r)},[n,e]);let f=(0,M.useMemo)(()=>i?{boards:o===`all`||o===`boards`?i.boards:[],screens:o===`all`||o===`screens`?i.screens:[],text:o===`all`||o===`text`?i.text:[]}:{boards:[],screens:[],text:[]},[i,o]),p=(0,M.useMemo)(()=>[...f.boards.map(e=>({kind:`board`,hit:e})),...f.screens.map(e=>({kind:`screen`,hit:e})),...f.text.map(e=>({kind:`text`,hit:e}))],[f]),m=Math.min(c,Math.max(0,p.length-1));(0,M.useEffect)(()=>{d.current?.querySelector(`[data-result-index="${m}"]`)?.scrollIntoView({block:`nearest`})},[m]);let h=async e=>{t(!1);let n=B.getState();if(n.view!==`boards`&&n.setView(`boards`),e.kind===`board`){await n.selectBoard(e.hit.id);return}let r=e.kind===`screen`?e.hit.id:e.hit.screenId,i=e.kind===`screen`?e.hit.boards:e.hit.board?[e.hit.board]:[],a=i.some(e=>e.id===n.currentBoardId)?n.currentBoardId:i[0]?.id??null;if(a&&a!==n.currentBoardId&&await n.selectBoard(a),e.kind===`screen`?await n.selectScreen(r):B.getState().revealSelection({screenId:r,path:qs(e.hit.path)}),!a)return;let o=B.getState().boards[a]?.frames.find(e=>e.screen===r);o&&requestAnimationFrame(()=>B.getState().centerOnFrame(o.id))},g=e=>{if(e.key===`ArrowDown`)e.preventDefault(),l(e=>Math.min(e+1,Math.max(0,p.length-1)));else if(e.key===`ArrowUp`)e.preventDefault(),l(e=>Math.max(e-1,0));else if(e.key===`Enter`){e.preventDefault();let t=p[m];t&&h(t)}else if(e.key===`Tab`){e.preventDefault();let t=e.shiftKey?lx.length-1:1;s(e=>lx[(lx.indexOf(e)+t)%lx.length]??`all`),l(0)}},_=i?.query??``,v=i?i.boards.length+i.screens.length+i.textTotal:0,y=i?{all:v,boards:i.boards.length,screens:i.screens.length,text:i.textTotal}:null,b=-1;return(0,H.jsx)(Cl,{open:e,onOpenChange:t,children:(0,H.jsxs)(El,{"aria-describedby":void 0,onKeyDown:g,className:`top-[16%] max-w-[680px] translate-y-0 gap-0 overflow-hidden p-0 [&>[data-slot=dialog-close]]:hidden`,children:[(0,H.jsx)(kl,{className:`sr-only`,children:`Search boards, screens, and text`}),(0,H.jsxs)(Km,{className:`h-[52px] rounded-none border-0 border-b shadow-none has-[[data-slot=input-group-control]:focus-visible]:ring-0`,children:[(0,H.jsx)(Jm,{children:(0,H.jsx)(rr,{size:17,className:`shrink-0 text-muted-foreground`})}),(0,H.jsx)(Zm,{autoFocus:!0,value:n,onChange:e=>r(e.target.value),placeholder:`Search boards, screens, and text…`,className:`text-[15px]`}),(0,H.jsx)(Jm,{align:`inline-end`,children:(0,H.jsx)(sx,{children:`esc`})})]}),y?(0,H.jsx)(Yp,{type:`single`,value:o,onValueChange:e=>{e&&(s(e),l(0))},"aria-label":`Result filter`,className:`justify-start gap-1.5 border-b px-3 py-2`,children:lx.map(e=>(0,H.jsxs)(Xp,{value:e,className:`rounded-full bg-muted px-2.5 text-[11px] capitalize data-[state=on]:bg-foreground data-[state=on]:font-medium data-[state=on]:text-background`,children:[e===`all`?`All`:e,` `,y[e]]},e))}):null,(0,H.jsx)(`div`,{ref:d,className:`max-h-[380px] overflow-y-auto scroll-stable pb-1.5`,children:i?p.length===0?(0,H.jsx)(cl,{className:`p-6`,children:(0,H.jsxs)(ll,{children:[(0,H.jsx)(dl,{variant:`icon`,children:(0,H.jsx)(nr,{})}),(0,H.jsxs)(fl,{children:[`No matches for “`,_,`”.`]})]})}):(0,H.jsxs)(H.Fragment,{children:[f.boards.length>0?(0,H.jsx)(dx,{children:`Boards`}):null,f.boards.map(e=>{b+=1;let t=b;return(0,H.jsxs)(fx,{index:t,active:t===m,onPick:()=>void h({kind:`board`,hit:e}),onHover:()=>l(t),children:[e.archived?(0,H.jsx)(kt,{size:16,className:`shrink-0 text-muted-foreground`,"aria-label":`Archived board`}):(0,H.jsx)(hn,{size:16,className:`shrink-0 text-muted-foreground`}),(0,H.jsx)(`span`,{className:`truncate text-[13.5px] ${e.archived?`text-muted-foreground`:``}`,children:(0,H.jsx)(px,{text:e.name,query:_})}),(0,H.jsxs)(`span`,{className:`ml-auto shrink-0 text-[11.5px] text-muted-foreground`,children:[e.archived?`Archived · `:``,e.frameCount,` frame`,e.frameCount===1?``:`s`]})]},e.id)}),f.screens.length>0?(0,H.jsx)(dx,{children:`Screens`}):null,f.screens.map(e=>{b+=1;let t=b;return(0,H.jsxs)(fx,{index:t,active:t===m,onPick:()=>void h({kind:`screen`,hit:e}),onHover:()=>l(t),children:[(0,H.jsx)(sn,{size:16,className:`shrink-0 text-muted-foreground`}),(0,H.jsx)(`span`,{className:`truncate text-[13.5px]`,children:(0,H.jsx)(px,{text:e.name,query:_})}),(0,H.jsx)(`span`,{className:`ml-auto shrink-0 text-[11.5px] text-muted-foreground`,children:e.boards.map(e=>e.name).join(` · `)||`Not on a board`})]},e.id)}),f.text.length>0?(0,H.jsx)(dx,{children:`Text matches`}):null,f.text.map(e=>{b+=1;let t=b;return(0,H.jsx)(fx,{index:t,active:t===m,onPick:()=>void h({kind:`text`,hit:e}),onHover:()=>l(t),tall:!0,children:(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`p`,{className:`truncate text-[13px]`,children:[`“`,e.excerpt.slice(0,e.matchStart),(0,H.jsx)(`mark`,{className:`rounded-[3px] bg-primary/15 px-0.5 font-medium text-primary`,children:e.excerpt.slice(e.matchStart,e.matchEnd)}),e.excerpt.slice(e.matchEnd),`”`]}),(0,H.jsxs)(`p`,{className:`truncate text-[11px] text-muted-foreground`,children:[e.board?`${e.board.name} › `:``,e.screenName,` › `,e.ref,e.nodeId?` @${e.nodeId}`:``,e.prop===`children`?``:` · ${e.prop}`]})]})},`${e.screenId}:${e.path.join(`.`)}`)}),i.textTotal>f.text.length&&(o===`all`||o===`text`)?(0,H.jsxs)(`p`,{className:`px-4 py-1.5 text-[11.5px] text-muted-foreground`,children:[i.textTotal-f.text.length,` more text match`,i.textTotal-f.text.length===1?``:`es`,` — keep typing to narrow.`]}):null]}):(0,H.jsx)(cl,{className:`p-6`,children:(0,H.jsxs)(ll,{children:[(0,H.jsx)(dl,{variant:`icon`,children:(0,H.jsx)(rr,{})}),(0,H.jsx)(pl,{children:`Type to search board names, screen names, and text inside screens.`})]})})}),(0,H.jsxs)(`div`,{className:`flex h-10 items-center gap-4 border-t px-4 text-[11px] text-muted-foreground`,children:[(0,H.jsx)(mx,{keys:`↑↓`,children:`navigate`}),(0,H.jsx)(mx,{keys:`↵`,children:`jump to match`}),(0,H.jsx)(mx,{keys:`tab`,children:`switch filter`}),i?(0,H.jsxs)(`span`,{className:`ml-auto`,children:[v,` match`,v===1?``:`es`]}):null]})]})})}function dx({children:e}){return(0,H.jsx)(`p`,{className:`px-4 pb-1 pt-2.5 text-[10.5px] font-semibold uppercase tracking-wider text-muted-foreground`,children:e})}function fx({index:e,active:t,tall:n,onPick:r,onHover:i,children:a}){return(0,H.jsx)(`button`,{type:`button`,"data-result-index":e,onClick:r,onMouseMove:i,className:V(`mx-1.5 flex w-[calc(100%-0.75rem)] items-center gap-3 rounded-md px-2.5 text-left`,n?`py-2`:`h-10`,t&&`bg-accent`),children:a})}function px({text:e,query:t}){let n=t?e.toLowerCase().indexOf(t.toLowerCase()):-1;return n===-1?(0,H.jsx)(H.Fragment,{children:e}):(0,H.jsxs)(H.Fragment,{children:[e.slice(0,n),(0,H.jsx)(`mark`,{className:`rounded-[3px] bg-primary/15 px-0.5 font-medium text-primary`,children:e.slice(n,n+t.length)}),e.slice(n+t.length)]})}function mx({keys:e,children:t}){return(0,H.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,H.jsx)(cx,{children:[...e].map(e=>(0,H.jsx)(sx,{children:e},e))}),t]})}function hx({children:e,className:t}){return(0,H.jsx)(`div`,{className:V(`text-[10.5px] font-semibold uppercase tracking-wider text-muted-foreground`,t),children:e})}function gx({children:e}){return(0,H.jsx)(`div`,{className:`mt-2 divide-y divide-border/70`,children:e})}function _x({label:e,description:t,htmlFor:n,children:r}){let i=`block text-[13px] font-medium text-foreground`;return(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-6 py-2.5`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[n?(0,H.jsx)(`label`,{htmlFor:n,className:i,children:e}):(0,H.jsx)(`div`,{className:i,children:e}),t?(0,H.jsx)(`p`,{className:`mt-0.5 text-[11.5px] leading-snug text-muted-foreground`,children:t}):null]}),(0,H.jsx)(`div`,{className:`flex shrink-0 items-center justify-end gap-3`,children:r})]})}function vx({label:e,stacked:t,children:n}){return(0,H.jsxs)(`div`,{className:V(`flex gap-2 text-[12px]`,t?`items-start`:`items-center`),children:[(0,H.jsx)(`span`,{className:`w-[68px] shrink-0 text-muted-foreground`,children:e}),(0,H.jsx)(`span`,{className:V(`flex min-w-0 text-foreground`,t?`flex-col items-start gap-1`:`items-center gap-1.5`),children:n})]})}var yx=`__default__`;function bx({cfg:e}){let t=B(e=>e.currentBoardId),n=B(e=>e.design),r=B(e=>e.boards),i=B(e=>e.loadBoard),a=B(e=>e.setBoardArchived),o=[...n?.boards??[],...n?.archivedBoards??[]],[s,c]=(0,M.useState)(t??o[0]?.id??``),l=o.find(e=>e.id===s)??null,u=r[s]??null,d=(0,M.useId)(),f=(0,M.useId)();if((0,M.useEffect)(()=>{s&&i(s).catch(()=>{})},[s,i]),!l)return(0,H.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`This folder has no boards yet.`});let p=l.archivedAt!=null,m=new Set((u?.frames??[]).map(e=>e.screen)).size;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border border-border bg-muted/40 px-3 py-2.5`,children:[(0,H.jsx)(hn,{className:`size-4 shrink-0 text-muted-foreground`}),(0,H.jsx)(`span`,{className:`text-[12px] text-muted-foreground`,children:`Editing`}),(0,H.jsxs)(K,{value:s,onValueChange:c,children:[(0,H.jsx)(J,{className:`ml-auto w-[300px] bg-background text-[13px]`,children:(0,H.jsx)(q,{})}),(0,H.jsxs)(Y,{children:[(n?.boards??[]).map(e=>(0,H.jsx)(X,{value:e.id,children:e.name},e.id)),(n?.archivedBoards??[]).map(e=>(0,H.jsxs)(X,{value:e.id,children:[e.name,` (archived)`]},e.id))]})]})]}),(0,H.jsx)(hx,{className:`mt-5`,children:`Identity`}),(0,H.jsxs)(gx,{children:[(0,H.jsx)(_x,{label:`Name`,description:`Shown in the sidebar, search, and published links.`,htmlFor:d,children:(0,H.jsx)(Sx,{id:d,value:l.name,onCommit:async e=>{if(e!==l.name)try{await I.updateBoard({boardId:s,patch:{name:e}})}catch(e){R(e,`Could not rename the board`)}}})}),(0,H.jsx)(_x,{label:`Board id`,description:`The filename on disk. Fixed once created — frames and links point at it.`,children:(0,H.jsxs)(`div`,{className:`flex w-[300px] items-center gap-2 rounded-md bg-muted px-2.5 py-1.5`,children:[(0,H.jsxs)(`span`,{className:`truncate font-mono text-[12px] text-muted-foreground`,children:[`boards/`,s,`.json`]}),(0,H.jsx)(Sn,{className:`ml-auto size-3 shrink-0 text-muted-foreground`})]})})]}),(0,H.jsx)(hx,{className:`mt-5`,children:`Theme`}),(0,H.jsx)(gx,{children:(0,H.jsx)(_x,{label:`Render this board with`,description:`Every frame here re-renders on change. Screens are untouched.`,htmlFor:f,children:(0,H.jsxs)(K,{value:u?.theme??yx,onValueChange:async e=>{try{await I.updateBoard({boardId:s,patch:{theme:e===yx?null:e}}),await i(s)}catch(e){R(e,`Could not change the board theme`)}},children:[(0,H.jsx)(J,{id:f,className:`w-[300px] text-[13px]`,children:(0,H.jsx)(q,{})}),(0,H.jsxs)(Y,{children:[(0,H.jsx)(X,{value:yx,children:`Folder default`}),e.themes.filter(e=>e!=="default").map(e=>(0,H.jsx)(X,{value:e,children:e},e))]})]})})}),(0,H.jsx)(hx,{className:`mt-5`,children:`Contents`}),(0,H.jsxs)(`div`,{className:`mt-2 grid grid-cols-3 gap-3`,children:[(0,H.jsx)(xx,{n:u?.frames.length??l.frameCount,label:`frames`}),(0,H.jsx)(xx,{n:m,label:m===1?`screen`:`screens`}),(0,H.jsx)(xx,{n:u?.groups.length??0,label:u?.groups.length===1?`group`:`groups`})]}),(0,H.jsxs)(`div`,{className:`mt-4 flex items-start gap-3 rounded-lg border border-border bg-muted/30 p-3`,children:[p?(0,H.jsx)(Ot,{className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}):(0,H.jsx)(kt,{className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`div`,{className:`text-[13px] font-medium text-foreground`,children:p?`This board is archived`:`Archive this board`}),(0,H.jsx)(`p`,{className:`mt-0.5 text-[11.5px] leading-snug text-muted-foreground`,children:p?`It stays out of the sidebar and out of publishes until you restore it.`:`Files it out of the sidebar and out of publishes. Nothing is deleted — the file stays and you can restore it any time.`})]}),(0,H.jsx)(W,{variant:`outline`,size:`sm`,className:`ml-auto h-8 shrink-0 text-[12.5px]`,onClick:()=>{a(s,!p).catch(e=>R(e,p?`Could not restore the board`:`Could not archive it`))},children:p?`Restore`:`Archive`})]})]})}function xx({n:e,label:t}){return(0,H.jsxs)(`div`,{className:`rounded-lg bg-muted/50 px-3 py-2`,children:[(0,H.jsx)(`div`,{className:`text-[18px] font-semibold leading-tight text-foreground`,children:e}),(0,H.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:t})]})}function Sx({id:e,value:t,onCommit:n}){let[r,i]=(0,M.useState)(t);return(0,M.useEffect)(()=>i(t),[t]),(0,H.jsx)(Q,{id:e,value:r,className:`h-8 w-[300px] text-[13px]`,onChange:e=>i(e.target.value),onBlur:()=>{let e=r.trim();e===``?i(t):n(e)},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&i(t)}})}function Cx(){let e=B(e=>e.appTheme),t=B(e=>e.setAppTheme),n=B(e=>e.designMode),r=B(e=>e.rememberDesignMode),i=B(e=>e.setRememberDesignMode),a=B(e=>e.rememberPanels),o=B(e=>e.setRememberPanels),s=B(e=>e.resetCanvasPrefs);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(hx,{children:`Appearance`}),(0,H.jsxs)(gx,{children:[(0,H.jsx)(_x,{label:`App theme`,description:`Velloo's own chrome — the toolbar, sidebar, and panels.`,children:(0,H.jsxs)(Yp,{type:`single`,variant:`outline`,size:`sm`,value:e,"aria-label":`App theme`,onValueChange:e=>e&&t(e),children:[(0,H.jsxs)(Xp,{value:`light`,className:`px-3 text-[12px]`,children:[(0,H.jsx)(_r,{className:`size-3.5`}),`Light`]}),(0,H.jsxs)(Xp,{value:`dark`,className:`px-3 text-[12px]`,children:[(0,H.jsx)(Nn,{className:`size-3.5`}),`Dark`]}),(0,H.jsxs)(Xp,{value:`system`,className:`px-3 text-[12px]`,children:[(0,H.jsx)(Mn,{className:`size-3.5`}),`System`]})]})}),(0,H.jsxs)(_x,{label:`Remember the design preset`,description:`Reopen the canvas in whichever preset you last used. Off means every reload starts light.`,children:[(0,H.jsxs)(`span`,{className:`flex items-center gap-1.5 rounded-md border border-border bg-muted/60 px-2 py-1 text-[11.5px] text-muted-foreground`,children:[n===`dark`?(0,H.jsx)(Nn,{className:`size-3.5`}):(0,H.jsx)(_r,{className:`size-3.5`}),`now: `,n]}),(0,H.jsx)(rg,{"aria-label":`Remember the design preset`,checked:r,onCheckedChange:i})]})]}),(0,H.jsx)(hx,{className:`mt-5`,children:`Layout`}),(0,H.jsx)(gx,{children:(0,H.jsx)(_x,{label:`Remember panel layout`,description:`Side pane widths and collapse, boards list, and screen tree stay as you left them.`,children:(0,H.jsx)(rg,{"aria-label":`Remember panel layout`,checked:a,onCheckedChange:o})})}),(0,H.jsxs)(`div`,{className:`mt-5 flex items-start gap-3 rounded-lg border border-border bg-muted/30 p-3`,children:[(0,H.jsx)(tr,{className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`div`,{className:`text-[13px] font-medium text-foreground`,children:`Reset canvas preferences`}),(0,H.jsx)(`p`,{className:`mt-0.5 text-[11.5px] leading-snug text-muted-foreground`,children:`Clears theme, panel, and last-viewed board memory for this browser. Your design is untouched.`})]}),(0,H.jsx)(W,{variant:`outline`,size:`sm`,className:`ml-auto h-8 shrink-0 text-[12.5px]`,onClick:()=>{s(),L({kind:`success`,message:`Canvas preferences reset.`})},children:`Reset`})]}),(0,H.jsxs)(`div`,{className:`mt-4 flex items-center gap-2 rounded-lg bg-muted/50 px-3 py-2`,children:[(0,H.jsx)(fn,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,H.jsx)(`span`,{className:`text-[11.5px] text-muted-foreground`,children:`Signing in and credits live in the account menu, top right.`})]})]})}var wx={"shadcn-upstream":`shadcn`,mui:`Material UI`,antd:`Ant Design`,chakra:`Chakra UI`,none:`No library`,html:`HTML + htmx`};function Tx(e){return wx[e]??e}function Ex(e){return/^\d{4}\./.test(e)?`snapshot ${e}`:`v${e}`}function Dx(e,t){switch(e){case`in-repo`:return{text:`your repo`,title:`Components render from your app. Velloo's bundled snapshot (${t}) covers only the files it can't compile.`};case`binary`:return{text:`bundled`,title:`Components ship inside the velloo binary.`};case`cache`:return{text:`cached`,title:`Components were downloaded into ~/.velloo.`};default:return{text:e}}}function Ox(e){return e.source!==`in-repo`}function kx(e,t){if(!t)return!0;let n=e.id.toLowerCase();return n!=="default"&&n!==e.providerId.toLowerCase()&&n!==Tx(e.providerId).toLowerCase()}function Ax(e){return[...e.libraries].sort((t,n)=>Number(n.id===e.defaultLibrary)-Number(t.id===e.defaultLibrary))}function jx(e){return new Set(e.map(e=>e.styleLabel)).size>1}function Mx(e){return e.libraries.find(t=>t.id===e.defaultLibrary)?.styleLabel??(e.styling===`none`?`Inline styles`:`Tailwind classes`)}var Nx=`__none__`;function Px(e){return e<600?lr:e<1100?yr:Mn}function Fx({cfg:e}){let t=B(e=>e.design?.boards??[]),n=B(e=>e.design?.screens??[]),r=B(e=>e.loadFolderConfig),i=(0,M.useId)(),a=(0,M.useId)(),o=(0,M.useId)(),s=(0,M.useId)(),c=(0,M.useId)(),l=async(e,t)=>{try{await t(),await r()}catch(t){R(t,e),await r().catch(()=>{})}};return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(hx,{children:`Design`}),(0,H.jsx)(gx,{children:(0,H.jsx)(_x,{label:`Name`,description:`What velloo commands, agents and the canvas call this design. Unique in this repo.`,htmlFor:i,children:(0,H.jsx)(zx,{id:i,value:e.designName,onCommit:e=>l(`Could not rename the design`,async()=>{await ts.designName(e),L({kind:`success`,message:`Renamed to "${e}"`})})})})}),(0,H.jsx)(hx,{className:`mt-5`,children:`Opens on`}),(0,H.jsxs)(gx,{children:[(0,H.jsx)(_x,{label:`Board`,description:`Pins every load to one board. Unset, the canvas reopens the board you were last on.`,htmlFor:a,children:(0,H.jsxs)(K,{value:e.defaultBoard??Nx,onValueChange:e=>l(`Could not set the default board`,()=>ts.defaults({defaultBoard:e===Nx?null:e})),children:[(0,H.jsx)(J,{id:a,className:`w-[252px] text-[13px]`,children:(0,H.jsx)(q,{})}),(0,H.jsxs)(Y,{children:[(0,H.jsx)(X,{value:Nx,children:`Where you left off`}),t.map(e=>(0,H.jsx)(X,{value:e.id,children:e.name},e.id))]})]})}),(0,H.jsx)(_x,{label:`Screen`,description:`Focused after load. Optional.`,htmlFor:o,children:(0,H.jsxs)(K,{value:e.defaultScreen??Nx,onValueChange:e=>l(`Could not set the default screen`,()=>ts.defaults({defaultScreen:e===Nx?null:e})),children:[(0,H.jsx)(J,{id:o,className:`w-[252px] text-[13px]`,children:(0,H.jsx)(q,{})}),(0,H.jsxs)(Y,{children:[(0,H.jsx)(X,{value:Nx,children:`No screen — fit the whole board`}),n.map(e=>(0,H.jsx)(X,{value:e.id,children:e.name},e.id))]})]})})]}),(0,H.jsxs)(`div`,{className:`mt-5 flex items-baseline gap-2`,children:[(0,H.jsx)(hx,{children:`Viewport presets`}),(0,H.jsx)(`span`,{className:`text-[11.5px] text-muted-foreground`,children:`— offered when you add a frame`})]}),(0,H.jsx)(Ux,{presets:e.viewportPresets,onCommit:l}),(0,H.jsx)(hx,{className:`mt-5`,children:`Code generation & feedback`}),(0,H.jsxs)(gx,{children:[(0,H.jsx)(_x,{label:`Components import alias`,description:`Prefix emit_code writes for library imports.`,htmlFor:s,children:(0,H.jsx)(Bx,{id:s,value:e.componentsAlias,onCommit:e=>l(`Could not save the import alias`,()=>ts.codegen({componentsAlias:e}))})}),(0,H.jsxs)(`div`,{className:`py-2.5`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-6`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`div`,{className:`text-[13px] font-medium text-foreground`,children:`Send product feedback`}),(0,H.jsx)(`p`,{className:`mt-0.5 text-[11.5px] leading-snug text-muted-foreground`,children:`Gives your agent the send_feedback tool. Off keeps velloo offline. Set once per repo — every design folder here shares this answer.`})]}),(0,H.jsx)(rg,{"aria-label":`Send product feedback`,checked:e.feedback.enabled,onCheckedChange:e=>l(`Could not change the feedback setting`,()=>ts.feedback({enabled:e}))})]}),(0,H.jsxs)(`label`,{htmlFor:c,className:`mt-2 flex items-start gap-2 border-l-2 border-border pl-3`,children:[(0,H.jsx)(X_,{id:c,className:`mt-0.5 size-3.5`,checked:e.feedback.contactOk,onCheckedChange:e=>l(`Could not change the contact setting`,()=>ts.feedback({contactOk:e===!0}))}),(0,H.jsxs)(`span`,{className:`min-w-0`,children:[(0,H.jsx)(`span`,{className:`block text-[12.5px] text-foreground`,children:`Velloo may contact me about what I send`}),(0,H.jsx)(`span`,{className:`block text-[11px] text-muted-foreground`,children:`Attaches your account email to each report. Unchecked, feedback goes in anonymously. Saved on this machine, not in the repo — nobody who clones it inherits your answer.`})]})]})]})]}),(0,H.jsx)(hx,{className:`mt-5`,children:`What init decided`}),(0,H.jsxs)(`div`,{className:`mt-2 grid grid-cols-2 items-start gap-x-8 gap-y-1.5 rounded-lg bg-muted/50 px-4 py-3`,children:[(0,H.jsx)(`div`,{className:`col-span-2 min-w-0`,children:(0,H.jsx)(Ix,{cfg:e})}),(0,H.jsx)(vx,{label:`Styling`,children:jx(e.libraries)?(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`per library`}):Mx(e)}),(0,H.jsxs)(vx,{label:`Format`,children:[`schema v`,e.schemaVersion,` · velloo `,e.toolVersion]}),(0,H.jsx)(`div`,{className:`col-span-2 min-w-0`,children:(0,H.jsx)(vx,{label:`Cloud id`,children:e.folderId?(0,H.jsx)(Rx,{id:e.folderId}):(0,H.jsx)(Lx,{})})})]})]})}function Ix({cfg:e}){if(e.libraries.length===0)return(0,H.jsx)(vx,{label:`Library`,children:e.defaultLibrary});let t=Ax(e),n=t.length>1,r=jx(t);return(0,H.jsx)(vx,{label:`Library`,stacked:n,children:t.map(t=>{let i=Dx(t.source,t.version),a=t.id===e.defaultLibrary;return(0,H.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[n&&kx(t,a)?(0,H.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:t.id}):null,(0,H.jsx)(`span`,{className:`truncate`,children:Tx(t.providerId)}),Ox(t)?(0,H.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:Ex(t.version)}):null,(0,H.jsx)(U,{variant:`secondary`,title:i.title,className:`h-4 shrink-0 px-1.5 text-[10px] font-normal`,children:i.text}),r&&t.styleLabel?(0,H.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:t.styleLabel}):null,n&&a?(0,H.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`· default`}):null]},t.id)})})}function Lx(){return(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`Not published yet`})}function Rx({id:e}){let[t,n]=(0,M.useState)(!1);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`truncate font-mono text-[11px]`,children:e}),(0,H.jsx)(`button`,{type:`button`,title:`Copy folder id`,className:`shrink-0 text-muted-foreground hover:text-foreground`,onClick:()=>{navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),1200)})},children:t?(0,H.jsx)(Bt,{className:`size-3`}):(0,H.jsx)(Xt,{className:`size-3`})})]})}function zx({id:e,value:t,onCommit:n}){let[r,i]=(0,M.useState)(t),a=(0,M.useRef)(t);return a.current=t,(0,M.useEffect)(()=>i(t),[t]),(0,H.jsx)(Q,{id:e,value:r,spellCheck:!1,className:`h-8 w-[252px] font-mono text-[12.5px]`,onChange:e=>i(e.target.value),onBlur:()=>{let e=r.trim();if(e===``||e===t){i(t);return}n(e).finally(()=>i(a.current))},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&i(t)}})}function Bx({id:e,value:t,onCommit:n}){let[r,i]=(0,M.useState)(t??``);return(0,M.useEffect)(()=>i(t??``),[t]),(0,H.jsx)(Q,{id:e,value:r,placeholder:`@/components/ui`,className:`h-8 w-[252px] font-mono text-[12.5px]`,onChange:e=>i(e.target.value),onBlur:()=>{let e=r.trim();e!==(t??``)&&n(e===``?null:e)},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&i(t??``)}})}var Vx=0,Hx=e=>({key:Vx++,preset:e});function Ux({presets:e,onCommit:t}){let[n,r]=(0,M.useState)(()=>e.map(Hx));(0,M.useEffect)(()=>r(e.map(Hx)),[e]);let i=n.map(e=>e.preset),a=e=>{r(e),t(`Could not save the viewport presets`,()=>ts.viewportPresets(e.map(e=>e.preset)))},o=(e,t)=>r(n.map(n=>n.key===e?{key:e,preset:{...n.preset,...t}}:n)),s=()=>{if(JSON.stringify(i)!==JSON.stringify(e)){if(i.some(e=>e.name.trim()===``||e.w<=0||e.h<=0)){L({kind:`error`,message:`A viewport preset needs a name and a positive width and height.`}),r(e.map(Hx));return}a(n)}};return(0,H.jsxs)(`div`,{className:`mt-2 overflow-hidden rounded-lg border border-border`,children:[n.map(({key:e,preset:t},r)=>{let i=Px(t.w);return(0,H.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-border px-3 py-1.5 last:border-b-0`,children:[(0,H.jsx)(i,{className:`size-4 shrink-0 text-muted-foreground`}),(0,H.jsx)(Q,{value:t.name,"aria-label":`Preset ${r+1} name`,className:`h-7 w-40 text-[13px]`,onChange:t=>o(e,{name:t.target.value}),onBlur:s,onKeyDown:e=>e.key===`Enter`&&e.currentTarget.blur()}),(0,H.jsxs)(`div`,{className:`ml-auto flex items-center gap-1.5`,children:[(0,H.jsx)(Gx,{label:`Preset ${r+1} width`,value:t.w,onChange:t=>o(e,{w:t}),onCommit:s}),(0,H.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`×`}),(0,H.jsx)(Gx,{label:`Preset ${r+1} height`,value:t.h,onChange:t=>o(e,{h:t}),onCommit:s})]}),(0,H.jsx)(`button`,{type:`button`,disabled:n.length<=1,title:n.length<=1?`At least one preset is required.`:`Remove ${t.name}`,className:`shrink-0 text-muted-foreground hover:text-destructive disabled:opacity-40 disabled:hover:text-muted-foreground`,onClick:()=>a(n.filter(t=>t.key!==e)),children:(0,H.jsx)(xr,{className:`size-3.5`})})]},e)}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3 border-t border-border px-3 py-1.5`,children:[(0,H.jsxs)(W,{variant:`ghost`,size:`sm`,className:`h-7 gap-1.5 px-2 text-[12.5px] text-muted-foreground`,onClick:()=>a([...n,Hx({name:Wx(i),w:1440,h:900})]),children:[(0,H.jsx)(Xn,{className:`size-3.5`}),`Add preset`]}),(0,H.jsx)(`span`,{className:`ml-auto text-[11px] text-muted-foreground`,children:`At least one preset is required.`})]})]})}function Wx(e){let t=new Set(e.map(e=>e.name.toLowerCase()));if(!t.has(`new preset`))return`New preset`;for(let e=2;;e++){let n=`New preset ${e}`;if(!t.has(n.toLowerCase()))return n}}function Gx({label:e,value:t,onChange:n,onCommit:r}){return(0,H.jsx)(Q,{"aria-label":e,inputMode:`numeric`,value:String(t),className:`h-7 w-[68px] text-center font-mono text-[12px]`,onChange:e=>{let t=Number.parseInt(e.target.value,10);n(Number.isFinite(t)&&t>0?t:0)},onBlur:r,onKeyDown:e=>e.key===`Enter`&&e.currentTarget.blur()})}var Kx=[{id:`design`,label:`Design`,icon:qn},{id:`board`,label:`Board`,icon:hn},{id:`canvas`,label:`Canvas`,icon:cr}],qx={design:{title:`Design`,description:`Saved to the design's config.json — visible to your agent, and committed with your repo when the design lives in it.`},board:{title:`Board`,description:`Applies to one board — its own file under boards/, committed with your repo.`},canvas:{title:`Canvas`,description:`How the editor behaves for you. Kept in this browser — never written to the folder, never shared.`}};function Jx(){let e=B(e=>e.settingsScope),t=B(e=>e.setSettingsScope),n=B(e=>e.folderConfig),r=B(e=>e.loadFolderConfig),i=B(e=>e.currentBoardId),a=B(e=>e.design?.boards.find(t=>t.id===e.currentBoardId)?.name??null);(0,M.useEffect)(()=>{e!==null&&r().catch(e=>R(e,`Could not load design settings`))},[e,r]);let o=e?qx[e]:qx.design;return(0,H.jsx)(Cl,{open:e!==null,onOpenChange:e=>!e&&t(null),children:(0,H.jsxs)(El,{className:V(`flex h-[min(800px,85vh)] w-[920px] max-w-[calc(100vw-2rem)] gap-0 overflow-hidden p-0`,`sm:max-w-[920px]`),children:[(0,H.jsxs)(`nav`,{className:`flex w-[216px] shrink-0 flex-col border-r border-border bg-muted/40 p-3`,children:[(0,H.jsx)(`div`,{className:`px-2 pb-2 pt-1 text-[10.5px] font-semibold uppercase tracking-wider text-muted-foreground`,children:`Settings`}),Kx.map(({id:n,label:r,icon:i})=>(0,H.jsxs)(`button`,{type:`button`,onClick:()=>t(n),className:V(`mt-0.5 flex items-center gap-2.5 rounded-md px-2.5 py-2 text-left text-[13px] first:mt-0`,e===n?`bg-background font-medium text-foreground shadow-sm ring-1 ring-border`:`text-muted-foreground hover:bg-accent/60`),children:[(0,H.jsx)(i,{className:`size-4 shrink-0`}),r,n===`board`&&a?(0,H.jsx)(`span`,{className:`ml-auto max-w-[86px] truncate text-[10.5px] font-normal text-muted-foreground`,children:a}):null]},n)),n?(0,H.jsxs)(`div`,{className:`mt-auto rounded-md border border-dashed border-border px-2.5 py-2`,children:[(0,H.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground`,children:`Design folder`}),(0,H.jsx)(`div`,{className:`mt-1 break-all font-mono text-[10.5px] leading-tight text-foreground/80`,title:n.root,children:n.root})]}):null]}),(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,H.jsxs)(Dl,{className:`gap-0 border-b border-border px-6 py-4 pr-12 text-left`,children:[(0,H.jsx)(kl,{className:`text-[15px] font-semibold leading-tight`,children:o.title}),(0,H.jsx)(Al,{className:`mt-1 text-[11.5px]`,children:o.description})]}),(0,H.jsx)(`div`,{className:`flex-1 overflow-y-auto px-6 pb-6 pt-4`,children:e===`canvas`?(0,H.jsx)(Cx,{}):n===null?(0,H.jsx)(Qu,{size:24,label:`Loading settings…`,className:`flex-col pt-12 text-[13px] text-muted-foreground`}):e===`board`?(0,H.jsx)(bx,{cfg:n},i??``):(0,H.jsx)(Fx,{cfg:n})}),(0,H.jsxs)(`div`,{className:`flex h-12 shrink-0 items-center gap-2 border-t border-border bg-muted/30 px-6`,children:[e===`canvas`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Mn,{className:`size-3.5 text-muted-foreground`}),(0,H.jsx)(`span`,{className:`text-[11.5px] text-muted-foreground`,children:`This browser only.`})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Bt,{className:`size-3.5 text-muted-foreground`}),(0,H.jsx)(`span`,{className:`text-[11.5px] text-muted-foreground`,children:`Changes save as you make them.`})]}),(0,H.jsx)(W,{size:`sm`,className:`ml-auto h-8 text-[13px]`,onClick:()=>t(null),children:`Done`})]})]})]})})}var Yx=200,Xx=`(prefers-reduced-motion: reduce)`;function Zx({open:e,className:t=``,"aria-disabled":n,children:r}){let i=(0,M.useRef)(null),a=(0,M.useRef)(null),[o,s]=(0,M.useState)(e),[c,l]=(0,M.useState)(e),[u,d]=(0,M.useState)(!1);if(c!==e){let t=!Qx();l(e),d(t),s(e||t)}return(0,M.useLayoutEffect)(()=>{let t=i.current;if(!t||(t.style.cssText=``,!u))return;let n=e?0:a.current??t.offsetHeight,r=e?t.offsetHeight:0;t.style.flex=`0 0 auto`,t.style.overflow=`hidden`,t.style.height=`${n}px`,t.offsetHeight,t.style.transition=`height ${Yx}ms ease-out`,t.style.height=`${r}px`},[u,e]),(0,M.useLayoutEffect)(()=>{!u&&e&&(a.current=i.current?.offsetHeight??null)}),(0,M.useEffect)(()=>{if(!u)return;let t=setTimeout(()=>{d(!1),e||s(!1)},Yx);return()=>clearTimeout(t)},[u,e]),o?(0,H.jsx)(`div`,{ref:i,className:t,"aria-disabled":n,children:r}):null}function Qx(){return typeof matchMedia==`function`&&matchMedia(Xx).matches}function $x(e,t){return`${e} open ${t===`shared`?`cloud`:`local`} comment${e===1?``:`s`}`}function eS({counts:e,active:t}){return!e||e.shared===0&&e.local===0?null:(0,H.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1`,children:[e.shared>0?(0,H.jsxs)(U,{"data-testid":`board-comments-shared`,variant:`secondary`,title:$x(e.shared,`shared`),className:V(`h-4 gap-0.5 bg-primary/10 px-1.5 text-[10px] text-primary tabular-nums`,t&&`bg-primary-foreground text-primary`),children:[(0,H.jsx)(qt,{"aria-hidden":`true`}),(0,H.jsx)(`span`,{"aria-hidden":`true`,children:e.shared}),(0,H.jsx)(`span`,{className:`sr-only`,children:$x(e.shared,`shared`)})]}):null,e.local>0?(0,H.jsxs)(U,{"data-testid":`board-comments-local`,variant:`outline`,title:$x(e.local,`local`),className:V(`h-4 gap-0.5 px-1.5 text-[10px] tabular-nums text-muted-foreground`,t&&`border-primary-foreground/50 text-primary-foreground`),children:[(0,H.jsx)(On,{"aria-hidden":`true`}),(0,H.jsx)(`span`,{"aria-hidden":`true`,children:e.local}),(0,H.jsx)(`span`,{className:`sr-only`,children:$x(e.local,`local`)})]}):null]})}var tS=`Disconnected — board switching resumes when the daemon is back.`;function nS(){let e=B(e=>e.selectBoard),t=B(e=>e.wsConnected);return(n,r)=>{if(!t&&!r){L({kind:`error`,message:tS});return}e(n)}}function rS({board:e,active:t,groups:n,drag:r,onRename:i,onAddFrame:a,onMoveToGroup:o,onNewGroup:s,onArchive:c,onDelete:l}){let u=B(e=>e.wsConnected),d=B(t=>!!t.boardPulse[e.id]),f=B(e=>e.publishSlots),p=B(t=>t.boardCommentCounts[e.id]),m=B(e=>e.refreshPublishSlots),h=nS(),g=Es(f,e.id);return(0,H.jsxs)(`li`,{draggable:r.draggable,onDragStart:r.onDragStart,onDragOver:r.onDragOver,onDragEnd:r.onDragEnd,className:`relative group/board rounded-md `+(r.draggable?`cursor-grab active:cursor-grabbing `:``)+(r.dragging?`opacity-50`:``),children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>h(e.id,t),title:!u&&!t?tS:void 0,className:`w-full text-left px-2 py-1.5 pr-8 rounded-md text-sm transition-colors `+(t?`bg-primary text-primary-foreground`:u?`hover:bg-muted text-foreground`:`text-muted-foreground cursor-not-allowed opacity-60`),children:[(0,H.jsxs)(`div`,{className:`font-medium truncate`,children:[e.name,!t&&d?(0,H.jsx)(`span`,{"data-board-pulse":e.id,title:`An agent edited this board recently`,className:`ml-1.5 inline-block h-1.5 w-1.5 rounded-full bg-primary align-middle`}):null]}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-xs ${t?`text-primary-foreground/80`:`text-muted-foreground`}`,children:[(0,H.jsxs)(`span`,{className:`truncate`,children:[e.frameCount,` frame`,e.frameCount===1?``:`s`]}),(0,H.jsx)(eS,{counts:p,active:t})]})]}),(0,H.jsxs)(su,{onOpenChange:e=>e&&void m(),children:[(0,H.jsx)(cu,{asChild:!0,children:(0,H.jsx)(W,{variant:`ghost`,size:`icon-xs`,title:`Board menu`,className:`absolute right-2 top-2 opacity-0 group-hover/board:opacity-100 data-[state=open]:opacity-100`,children:(0,H.jsx)($t,{})})}),(0,H.jsxs)(lu,{align:`end`,className:al,children:[(0,H.jsxs)(Z,{disabled:!u,onSelect:i,children:[(0,H.jsx)(Jn,{}),`Rename board`]}),(0,H.jsxs)(Z,{disabled:!u,onSelect:a,children:[(0,H.jsx)(sn,{}),`Add frame…`]}),(0,H.jsxs)(Z,{onSelect:()=>B.getState().publishBoard({id:e.id,name:e.name}),"data-testid":`board-publish`,children:[(0,H.jsx)(or,{}),`Publish…`]}),g?(0,H.jsx)(Z,{asChild:!0,children:(0,H.jsxs)(`a`,{href:g.url,target:`_blank`,rel:`noreferrer`,className:`text-inherit no-underline`,title:`Published ${mg(g.lastPublishedAt)}`,"data-testid":`board-latest-publish`,children:[(0,H.jsx)(en,{}),`See latest publish`]})}):null,(0,H.jsxs)(fu,{children:[(0,H.jsxs)(pu,{disabled:!u,children:[(0,H.jsx)(an,{}),`Move to group`]}),(0,H.jsxs)(mu,{children:[n.map(t=>(0,H.jsxs)(Z,{onSelect:()=>o(t.id),children:[(0,H.jsx)(`span`,{className:`size-2.5 rounded-[3px]`,style:{backgroundColor:t.color??`var(--muted-foreground)`}}),t.name,e.group===t.id?(0,H.jsx)(Bt,{className:`ml-auto`}):null]},t.id)),(0,H.jsxs)(Z,{onSelect:()=>o(null),children:[(0,H.jsx)(`span`,{className:`size-2.5 rounded-[3px] border border-dashed`}),`No group`,e.group?null:(0,H.jsx)(Bt,{className:`ml-auto`})]}),(0,H.jsxs)(Z,{onSelect:s,children:[(0,H.jsx)(on,{}),`New group…`]})]})]}),(0,H.jsxs)(Z,{onSelect:()=>B.getState().setExportTarget({kind:`board`,id:e.id,name:e.name}),children:[(0,H.jsx)(Qt,{}),`Export board…`]}),(0,H.jsxs)(Z,{disabled:!u,onSelect:c,children:[(0,H.jsx)(kt,{}),`Archive board`]}),(0,H.jsxs)(Z,{variant:`destructive`,disabled:!u,onSelect:l,children:[(0,H.jsx)(xr,{}),`Delete board`]})]})]})]})}function iS(e){let t=new Date(e);return Number.isNaN(t.getTime())?`archived`:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function aS({boards:e,currentBoardId:t,open:n,onToggle:r,onRestore:i,onDelete:a}){let o=B(e=>e.wsConnected),s=nS();return(0,H.jsxs)(`div`,{className:`shrink-0 border-t px-2 py-1.5`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:r,"aria-expanded":n,className:`flex w-full items-center gap-1.5 rounded-md px-2 py-1 text-[11px] uppercase tracking-wider text-muted-foreground transition-colors hover:text-foreground`,children:[(0,H.jsx)(Ht,{size:13,strokeWidth:2.5,className:`shrink-0 transition-transform duration-200 motion-reduce:transition-none `+(n?`rotate-90`:``)}),(0,H.jsx)(kt,{size:11,strokeWidth:2,className:`shrink-0`}),` Archived`,(0,H.jsxs)(`span`,{className:`normal-case opacity-60`,children:[`(`,e.length,`)`]})]}),(0,H.jsx)(Zx,{open:n,children:(0,H.jsx)(`ul`,{className:`mt-0.5 flex flex-col gap-0.5`,children:e.map(e=>{let n=e.id===t;return(0,H.jsxs)(`li`,{className:`relative group/board rounded-md`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>s(e.id,n),className:`w-full text-left px-2 py-1.5 pr-8 rounded-md text-sm transition-colors `+(n?`bg-primary text-primary-foreground`:`hover:bg-muted text-muted-foreground`),children:[(0,H.jsx)(`div`,{className:`truncate`,children:e.name}),(0,H.jsxs)(`div`,{className:`text-xs `+(n?`text-primary-foreground/80`:`text-muted-foreground/70`),children:[e.frameCount,` frame`,e.frameCount===1?``:`s`,e.archivedAt?` · ${iS(e.archivedAt)}`:``]})]}),(0,H.jsxs)(su,{children:[(0,H.jsx)(cu,{asChild:!0,children:(0,H.jsx)(W,{variant:`ghost`,size:`icon-xs`,title:`Board menu`,className:`absolute right-2 top-2 opacity-0 group-hover/board:opacity-100 data-[state=open]:opacity-100`,children:(0,H.jsx)($t,{})})}),(0,H.jsxs)(lu,{align:`end`,className:al,children:[(0,H.jsxs)(Z,{disabled:!o,onSelect:()=>i(e),children:[(0,H.jsx)(Ot,{}),`Restore board`]}),(0,H.jsxs)(Z,{variant:`destructive`,disabled:!o,onSelect:()=>a(e),children:[(0,H.jsx)(xr,{}),`Delete board`]})]})]})]},e.id)})})})]})}var oS=[{value:`#8b5cf6`,label:`Violet`},{value:`#0ea5e9`,label:`Sky`},{value:`#f59e0b`,label:`Amber`},{value:`#f43f5e`,label:`Rose`},{value:`#10b981`,label:`Emerald`},{value:`#6366f1`,label:`Indigo`},{value:`#ec4899`,label:`Pink`},{value:`#84cc16`,label:`Lime`}];function sS({group:e,count:t,collapsed:n,dropTarget:r,disabled:i,onToggle:a,onDragOver:o,onRename:s,onRecolor:c,onDelete:l}){return(0,H.jsxs)(`li`,{onDragOver:o,className:`group/gr relative flex items-center rounded-md pr-7 ${r?`bg-accent`:``}`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:a,"aria-expanded":!n,className:`flex min-w-0 flex-1 items-center gap-2 rounded-md px-1.5 py-1.5 text-left transition-colors hover:bg-muted`,children:[(0,H.jsx)(Ht,{size:13,strokeWidth:2.5,className:`shrink-0 text-muted-foreground transition-transform duration-200 motion-reduce:transition-none `+(n?``:`rotate-90`)}),(0,H.jsx)(`span`,{className:`size-2.5 shrink-0 rounded-[3px]`,style:{backgroundColor:e.color??`var(--muted-foreground)`}}),(0,H.jsx)(`span`,{className:`truncate text-xs font-semibold`,children:e.name}),(0,H.jsx)(`span`,{className:`ml-auto text-[10px] text-muted-foreground`,children:t})]}),(0,H.jsxs)(su,{children:[(0,H.jsx)(cu,{asChild:!0,children:(0,H.jsx)(W,{variant:`ghost`,size:`icon-xs`,title:`Group menu`,className:`absolute right-1 top-1.5 opacity-0 group-hover/gr:opacity-100 data-[state=open]:opacity-100`,children:(0,H.jsx)($t,{})})}),(0,H.jsxs)(lu,{align:`end`,className:al,children:[(0,H.jsxs)(Z,{disabled:i,onSelect:s,children:[(0,H.jsx)(Jn,{}),`Rename group`]}),(0,H.jsxs)(fu,{children:[(0,H.jsxs)(pu,{disabled:i,children:[(0,H.jsx)(Rn,{}),`Color`]}),(0,H.jsx)(mu,{children:oS.map(({value:t,label:n})=>(0,H.jsxs)(Z,{onSelect:()=>c(t),children:[(0,H.jsx)(`span`,{className:`size-3 rounded-[3px]`,style:{backgroundColor:t}}),n,e.color===t?(0,H.jsx)(Bt,{className:`ml-auto`}):null]},t))})]}),(0,H.jsxs)(Z,{variant:`destructive`,disabled:i,onSelect:l,children:[(0,H.jsx)(xr,{}),`Delete group`]})]})]})]})}var cS={Divider:jn,Gradient:Pt,Heading:un,Icon:ur,Image:dn,Layer:pn,Placeholder:dr,Prose:Yn,SVG:ar,Text:Cr},lS={a:vn,blockquote:Qn,button:fr,em:Cr,footer:zn,form:br,h1:un,h2:un,h3:un,h4:un,h5:un,h6:un,header:Wn,img:dn,input:br,label:Cr,li:yn,nav:In,ol:yn,p:Cr,small:Cr,span:Cr,strong:Cr,svg:ar,table:vr,textarea:br,ul:yn,video:kr};function uS(e,t){if(Fi(e))return{Icon:Rt,tone:`text-muted-foreground`};if(Pi(e))return{Icon:Ft,tone:`text-violet-500`,title:`@${e.$snippet} — a snippet instance.`};if(Hi(e)){let{importPath:t,exportName:n,member:r,app:i}=e.$repo,a=n==="default"?`default export`:n,o=r?`${a}.${r}`:a;return{Icon:Lt,tone:`text-primary`,title:`${e.$ref} — the app's own component: ${o} from ${t}${i?` (${i})`:``}.`}}let n=t?.get(e.$ref);if(t&&!n)return{Icon:Sr,tone:`text-destructive`,title:`${e.$ref} isn't in this screen's library — it renders as a fallback.`};if(n?.kind===`extension`)return{Icon:Zn,tone:`text-primary`,title:`${e.$ref} — a custom component registered with add_extension.`};if(n&&n.source!==`velloo`)return{Icon:Yt,tone:`text-primary`,title:`${e.$ref} — a real ${n.source} component from this project's library.`};let r=cS[e.$ref];if(r)return{Icon:r,tone:`text-muted-foreground`};let i=typeof e.props?.as==`string`?e.props.as:null;return{Icon:(i?lS[i]:void 0)??mr,tone:`text-muted-foreground`}}var dS=(e,t=28)=>e.length>t?`${e.slice(0,t-1)}…`:e,fS=200;function pS(e){if(Pi(e)){let t=Object.entries(e.args??{}),n=t.find(([,e])=>typeof e==`string`&&e.trim());return n?dS(n[1].trim()):t.length>0?`${t.length} args`:null}if(Fi(e))return null;let t=e.props;if(!t)return null;for(let e of[`children`,`label`,`placeholder`,`value`,`title`]){let n=t[e];if(typeof n==`string`&&n.trim())return dS(n.trim());if(typeof n==`number`)return String(n)}if(typeof t.className==`string`){let e=t.className.trim();if(e)return dS(`.${e.split(/\s+/)[0]}`)}return null}function mS(e){if(Pi(e))return`@${e.$snippet}`;if(Fi(e))return`\${${e.$param}}`;let t=Zd(e),n=typeof e.props?.as==`string`?e.props.as:null,r=n&&n!==`div`?`${e.$ref} ${n}`:e.$ref;return t?`${r} ${t}`:r}function hS(e){return Ni(e)?e.children:void 0}function gS(e){let[t,n]=(0,M.useState)(e),[r,i]=(0,M.useState)(e),[a,o]=(0,M.useState)(!1);return r!==e&&(i(e),o(!0),e&&n(!0)),(0,M.useEffect)(()=>{if(!a)return;let t=setTimeout(()=>{o(!1),e||n(!1)},fS);return()=>clearTimeout(t)},[a,e]),{mounted:t,animating:a}}function _S({icon:e,selected:t}){let n=`shrink-0 ${t?`text-primary-foreground`:e.tone}`;return e.title?(0,H.jsx)(`span`,{role:`img`,"aria-label":e.title,title:e.title,className:`inline-flex ${n}`,children:(0,H.jsx)(e.Icon,{size:13,strokeWidth:2,"aria-hidden":!0})}):(0,H.jsx)(e.Icon,{size:13,strokeWidth:2,className:n,"aria-hidden":!0})}var vS=`inline-flex size-4 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`;function yS({node:e,path:t,screenId:n,depth:r,expandedSet:i,setExpanded:a,byId:o}){let s=qs(t),c=B(e=>e.setSelection),l=B(e=>e.setHover),u=B(e=>e.openSnippetEditor),d=B(e=>e.setSnippetFocus),f=B(e=>e.selection?.screenId===n&&e.selection.path===s),p=B(e=>e.hover?.screenId===n&&e.hover.path===s),m=(0,M.useRef)(null);(0,M.useEffect)(()=>{f&&m.current?.scrollIntoView({block:`nearest`})},[f]);let h=hS(e),g=(h?.length??0)>0,_=g?i.has(s):!1,{mounted:v,animating:y}=gS(_),b=pS(e),x=Pi(e)?e.$snippet:null,S=uS(e,o),C=[`w-full flex items-center gap-1 px-2 py-1 rounded-sm text-sm cursor-default select-none text-left group/row`,f?`bg-primary text-primary-foreground`:p?`bg-muted`:`hover:bg-muted text-foreground`].join(` `),w=()=>c({screenId:n,path:s}),T=()=>{(async()=>{try{let{removedRef:e}=await I.removeNode({screenId:n,path:t}),r=B.getState();r.selection?.screenId===n&&(r.selection.path===s||r.selection.path.startsWith(`${s}.`))&&r.setSelection(null),r.setHover(null),r.refreshHistory(),L({kind:`info`,message:`Removed ${e}`,action:{label:`Undo`,onClick:()=>{ss().catch(e=>R(e,`Undo failed`)).finally(()=>void B.getState().refreshHistory())}}})}catch(e){R(e,`Could not remove node`)}})()};return(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{ref:m,className:C,style:{paddingLeft:`${.5+r*.875}rem`},children:[(0,H.jsx)(`button`,{type:`button`,onClick:()=>a(s,!_),className:`inline-flex size-5 shrink-0 items-center justify-center rounded transition-colors disabled:opacity-0 `+(f?`text-primary-foreground hover:bg-primary-foreground/20`:`text-muted-foreground hover:bg-foreground/10 hover:text-foreground`),"aria-label":_?`Collapse`:`Expand`,disabled:!g,children:(0,H.jsx)(Ht,{size:15,strokeWidth:2.5,"aria-hidden":!0,className:`transition-transform duration-200 motion-reduce:transition-none `+(_?`rotate-90`:``)})}),(0,H.jsxs)(`button`,{type:`button`,onClick:w,onDoubleClick:()=>{x&&d(x)},onMouseEnter:()=>l({screenId:n,path:s}),onMouseLeave:()=>l(null),onKeyDown:e=>{e.key===`ArrowRight`&&g&&!_?(e.preventDefault(),a(s,!0)):e.key===`ArrowLeft`&&g&&_?(e.preventDefault(),a(s,!1)):e.key===`Enter`&&x&&(e.preventDefault(),d(x))},className:`flex shrink-0 items-center gap-1.5 text-left text-inherit`,title:x?`Double-click or Enter to edit ${x} in place`:void 0,children:[(0,H.jsx)(_S,{icon:S,selected:f}),(0,H.jsx)(`span`,{className:`font-medium whitespace-nowrap`,children:mS(e)}),qi(e)?(0,H.jsxs)(U,{variant:`outline`,className:`shrink-0 px-1 py-0 font-mono text-[10px] leading-none `+(f?`border-primary-foreground/40 text-primary-foreground`:`text-muted-foreground`),title:`Stable anchor: @${qi(e)}`,children:[`@`,qi(e)]}):null,b?(0,H.jsx)(`span`,{className:`whitespace-nowrap text-xs opacity-70 `+(f?`text-primary-foreground`:`text-muted-foreground`),children:b}):null]}),(0,H.jsxs)(`div`,{className:`pointer-events-none sticky right-1 z-10 ml-auto flex shrink-0 items-center gap-px rounded-md border bg-popover px-px text-popover-foreground opacity-0 shadow-sm transition-opacity group-hover/row:pointer-events-auto group-hover/row:opacity-100 focus-within:pointer-events-auto focus-within:opacity-100`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),B.getState().locateNode(n,s)},className:vS,"aria-label":`Locate on canvas`,title:`Locate on canvas (centers and zooms to this node)`,"data-locate-node":s,children:(0,H.jsx)(Zt,{size:11,strokeWidth:2})}),x?(0,H.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),u(x)},className:vS,"aria-label":`Open ${x} in canvas`,title:`Open ${x} in canvas`,children:(0,H.jsx)(Gn,{size:11,strokeWidth:2})}):null,r===0?null:(0,H.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),T()},className:`${vS} hover:bg-destructive/10 hover:text-destructive`,"aria-label":`Delete node`,title:`Delete this node (undoable)`,"data-remove-node":s,children:(0,H.jsx)(xr,{size:11,strokeWidth:2})})]})]}),g?(0,H.jsx)(`div`,{className:`grid transition-[grid-template-rows] duration-200 ease-out motion-reduce:transition-none `+(_?`grid-rows-[1fr]`:`grid-rows-[0fr]`),children:(0,H.jsx)(`div`,{className:_&&!y?``:`overflow-hidden`,children:v?h?.map((e,c)=>{let l=`${s===``?``:`${s}.`}${c}`;return(0,H.jsx)(yS,{node:e,path:[...t,c],screenId:n,depth:r+1,expandedSet:i,setExpanded:a,byId:o},l)}):null})}):null]})}function bS(e){let t=new Set;for(let n=0;n<e.length;n++)t.add(qs(e.slice(0,n)));return t}function xS(e,t=[],n=new Set){n.add(qs(t));let r=hS(e);if(r)for(let e=0;e<r.length;e++){let i=r[e];i&&xS(i,[...t,e],n)}return n}function SS({screen:e}){let t=B(e=>e.selection),n=B(e=>e.components),r=B(e=>e.loadComponents);(0,M.useEffect)(()=>{r()},[r]);let i=(0,M.useMemo)(()=>n?new Map(n.map(e=>[e.id,e])):null,[n]),[a,o]=(0,M.useState)(()=>xS(e.tree)),s=(e,t)=>{o(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},c=(0,M.useMemo)(()=>{if(t?.screenId!==e.id)return a;let n=bS(z(t.path)),r=new Set(a);for(let e of n)r.add(e);return r},[a,t,e.id]);return(0,H.jsx)(`div`,{className:`flex w-max min-w-full flex-col py-1`,children:(0,H.jsx)(yS,{node:e.tree,path:[],screenId:e.id,depth:0,expandedSet:c,setExpanded:s,byId:i})})}function CS({screens:e,currentBoardId:t,currentScreenId:n}){let r=B(e=>e.selectScreen),i=B(e=>e.cursorMode),a=B(e=>e.treeCollapsed),o=B(e=>e.toggleTreeCollapsed),s=B(e=>n?e.screens[n]??null:null),c=B(e=>e.snippetFocus),l=B(e=>e.setSnippetFocus),u=B(e=>e.snippetFocus?e.screens[`snippet:${e.snippetFocus}`]??null:null),d=u??s,f=B(e=>d?e.renderErrors[d.id]??null:null),p=B(e=>t?e.boards[t]??null:null),m=(0,M.useMemo)(()=>{if(!p)return[];let t=new Map(e.map(e=>[e.id,e])),r=new Set,i=[];for(let e of p.frames){if(r.has(e.screen))continue;r.add(e.screen);let n=t.get(e.screen);n&&i.push(n)}if(n&&!r.has(n)){let e=t.get(n);e&&i.push(e)}return i},[p,e,n]);return(0,H.jsxs)(`section`,{className:a?`shrink-0`:`flex-1 flex flex-col min-h-0`,children:[(0,H.jsxs)(`div`,{className:`px-4 py-2 flex items-center gap-2 text-xs uppercase tracking-wider text-muted-foreground border-b`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:o,className:`shrink-0 hover:text-foreground transition-colors`,"aria-expanded":!a,title:a?`Expand tree`:`Collapse tree`,children:(0,H.jsx)(Ht,{size:13,strokeWidth:2.5,className:`transition-transform duration-200 motion-reduce:transition-none `+(a?``:`rotate-90`)})}),c===null?m.length>1?(0,H.jsxs)(K,{value:n??``,onValueChange:e=>{e&&r(e)},children:[(0,H.jsx)(J,{size:`sm`,className:`h-6 w-auto min-w-0 max-w-full overflow-hidden px-2 text-[10px] uppercase tracking-wider`,children:(0,H.jsx)(q,{className:`min-w-0 truncate`})}),(0,H.jsx)(Y,{children:m.map(e=>(0,H.jsx)(X,{value:e.id,children:e.name},e.id))})]}):(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:s?.name??`No screen`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>l(null),className:`inline-flex shrink-0 items-center gap-1 normal-case tracking-normal hover:text-foreground`,title:`Back to the screen (Esc)`,children:[(0,H.jsx)(Mt,{size:13,strokeWidth:2.5,"aria-hidden":!0}),`Back`]}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-violet-500`,children:u?.name??c})]})]}),(0,H.jsx)(Zx,{open:!a,className:`flex-1 overflow-auto scroll-stable py-1 `+(i===`hand`?`opacity-40 pointer-events-none select-none`:``),"aria-disabled":i===`hand`,children:d?(0,H.jsxs)(H.Fragment,{children:[f?(0,H.jsxs)(Kh,{variant:`destructive`,className:`mx-2 mb-1 w-auto`,children:[(0,H.jsx)(Sr,{}),(0,H.jsx)(qh,{className:`text-xs`,children:f}),(0,H.jsx)(Jh,{className:`text-xs`,children:`Nothing drew, so these rows have nothing to locate on the canvas. The frame says why.`})]}):null,(0,H.jsx)(SS,{screen:d},d.id)]}):(0,H.jsx)(cl,{className:`px-4 py-2`,children:(0,H.jsx)(pl,{className:`text-xs`,children:`Pick a screen above to see its tree.`})})})]})}function wS({boards:e,groups:t,enabled:n,onRefile:r}){let i=B(e=>e.reorderBoardsLocal),a=e.length>1&&n,[o,s]=(0,M.useState)(null),[c,l]=(0,M.useState)(null),[u,d]=(0,M.useState)(void 0),f=(0,M.useRef)(!1),p=(0,M.useMemo)(()=>{if(!c)return e;let t=new Map(e.map(e=>[e.id,e])),n=[];for(let e of c){let r=t.get(e);r&&n.push(r)}for(let t of e)c.includes(t.id)||n.push(t);return n},[c,e]),m=()=>{s(null),l(null),d(void 0)},h=(t,n)=>{f.current=!1,s(n),l(e.map(e=>e.id)),d(void 0),t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(`text/plain`,n),document.body.classList.add(`velloo-dragging`)},g=(t,n)=>{if(!o||(t.preventDefault(),t.dataTransfer.dropEffect=`move`,n===o))return;let r=e.find(e=>e.id===n);r&&d(r.group??null),l(t=>{let r=t??e.map(e=>e.id),i=r.indexOf(o),a=r.indexOf(n);if(i===-1||a===-1||i===a)return r;let s=[...r];return s.splice(i,1),s.splice(a,0,o),s})},_=()=>{document.body.classList.remove(`velloo-dragging`),!f.current&&m()};return{sections:(0,M.useMemo)(()=>{let e=e=>e.id===o&&u!==void 0?u:e.group??null,n=new Set(t.map(e=>e.id)),r=t.map(t=>({group:t,boards:p.filter(n=>e(n)===t.id)})),i=p.filter(t=>{let r=e(t);return r===null||!n.has(r)});return r.push({group:null,boards:i}),r},[t,p,o,u]),dragging:o!==null,dragGroup:u,rowDrag:e=>({draggable:a,dragging:o===e,onDragStart:t=>h(t,e),onDragOver:t=>g(t,e),onDragEnd:_}),onGroupDragOver:(e,t)=>{o&&(e.preventDefault(),e.dataTransfer.dropEffect=`move`,d(t))},onListDragOver:e=>{o&&(e.preventDefault(),e.dataTransfer.dropEffect=`move`)},onListDrop:t=>{if(!o)return;t.preventDefault(),f.current=!0;let n=c,a=u,s=e.find(e=>e.id===o);if(m(),s&&a!==void 0&&(s.group??null)!==a&&r(s.id,a),!n)return;let l=e.map(e=>e.id);n.length===l.length&&n.every((e,t)=>e===l[t])||(i(n),I.reorderBoards({order:n}).catch(e=>{R(e,`Could not reorder boards`),B.getState().refreshDesignSummary()}))}}}var TS=`velloo:collapsedBoardGroups`;function ES(){if(typeof localStorage>`u`)return[];try{let e=localStorage.getItem(TS),t=e?JSON.parse(e):[];return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function DS(){let[e,t]=(0,M.useState)(ES),[n,r]=(0,M.useState)(null),[i,a]=(0,M.useState)(``),[o,s]=(0,M.useState)(null);return{collapsed:e,toggle:e=>{t(t=>{let n=t.includes(e)?t.filter(t=>t!==e):[...t,e];return typeof localStorage<`u`&&localStorage.setItem(TS,JSON.stringify(n)),n})},dialog:n,name:i,setName:a,openDialog:e=>{e.mode===`create`?(a(`New group`),r({mode:`create`,...e.boardId?{boardId:e.boardId}:{}})):(a(e.group.name),r({mode:`rename`,groupId:e.group.id}))},closeDialog:()=>r(null),submitDialog:async()=>{let e=i.trim();if(!e||!n)return;let t=n;r(null);try{t.mode===`rename`?await I.updateBoardGroup({groupId:t.groupId,patch:{name:e}}):t.boardId?await I.updateBoard({boardId:t.boardId,patch:{group:e}}):await I.addBoardGroup({name:e}),await B.getState().refreshDesignSummary()}catch(e){R(e,t.mode===`rename`?`Could not rename group`:`Could not add group`)}},recolor:(e,t)=>{I.updateBoardGroup({groupId:e,patch:{color:t}}).then(()=>B.getState().refreshDesignSummary()).catch(e=>R(e,`Could not recolor group`))},pendingDelete:o,requestDelete:s,cancelDelete:()=>s(null),confirmDelete:()=>{if(!o)return;let{id:e,name:t}=o;s(null),(async()=>{try{let n=await I.removeBoardGroup({groupId:e});await B.getState().refreshDesignSummary();let r=n.ungroupedBoardIds.length;L({kind:`info`,message:r>0?`Deleted "${t}" — ${r} board${r===1?``:`s`} moved to Ungrouped`:`Deleted "${t}"`})}catch(e){R(e,`Could not delete group`)}})()}}}function OS(e,t){let n=[],r=t.removedScreenIds.length,i=t.removedSnippetIds.length;return r>0&&n.push(`${r} screen${r===1?``:`s`}`),i>0&&n.push(`${i} unused snippet${i===1?``:`s`}`),n.length===0?`Deleted "${e}"`:`Deleted "${e}" and ${n.join(` + `)}`}var kS=[],AS=[];function jS({boards:e,screens:t,currentBoardId:n,currentScreenId:r}){let i=B(e=>e.selectBoard),a=B(e=>e.wsConnected),o=B(e=>e.authStatus?.loggedIn??!1),s=B(e=>e.refreshPublishSlots),c=B(e=>e.boardsCollapsed),l=B(e=>e.treeCollapsed),u=B(e=>e.toggleBoardsCollapsed),d=B(e=>e.setBoardArchived),f=B(e=>e.design?.archivedBoards??kS),p=B(e=>e.design?.boardGroups??AS),m=DS(),[h,g]=(0,M.useState)(null),[_,v]=(0,M.useState)(null),[y,b]=(0,M.useState)(null),[x,S]=(0,M.useState)(``),C=(e,t)=>{I.updateBoard({boardId:e,patch:{group:t}}).then(()=>B.getState().refreshDesignSummary()).catch(e=>R(e,`Could not move board`))},w=()=>{S(`New board`),b({mode:`create`})},T=e=>{S(e.name),b({mode:`rename`,boardId:e.id})},E=async()=>{let e=x.trim();if(!e||!y)return;let t=y;if(b(null),t.mode===`create`)try{let t=await I.addBoard({name:e});i(t.boardId)}catch(e){R(e,`Could not create board`)}else try{await I.updateBoard({boardId:t.boardId,patch:{name:e}})}catch(e){R(e,`Could not rename board`)}},D=()=>{if(!h)return;let{id:e,name:t}=h;g(null),(async()=>{try{let n=await I.removeBoard({boardId:e});B.getState().pruneScreens(n.removedScreenIds),await B.getState().pruneBoard(e),L({kind:`info`,message:OS(t,n)})}catch(e){R(e,`Could not delete board`)}})()},[O,k]=(0,M.useState)(!1),A=f.some(e=>e.id===n);(0,M.useEffect)(()=>{A&&k(!0)},[A]),(0,M.useEffect)(()=>{o&&s()},[o,s]);let ee=(e,t)=>{(async()=>{try{await d(e.id,t),L({kind:`info`,message:t?`Archived "${e.name}"`:`Restored "${e.name}"`}),t&&k(!0)}catch(e){R(e,t?`Could not archive board`:`Could not restore board`)}})()},te=wS({boards:e,groups:p,enabled:a,onRefile:C}),ne=c?`shrink-0 border-b`:l?`flex-1 flex flex-col min-h-0 border-b`:`flex flex-col min-h-0 max-h-[50%] border-b`,re=e=>(0,H.jsx)(rS,{board:e,active:e.id===n,groups:p,drag:te.rowDrag(e.id),onRename:()=>T(e),onAddFrame:()=>v(e.id),onMoveToGroup:t=>C(e.id,t),onNewGroup:()=>m.openDialog({mode:`create`,boardId:e.id}),onArchive:()=>ee(e,!0),onDelete:()=>g({id:e.id,name:e.name})},e.id);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`section`,{className:ne,children:[(0,H.jsxs)(`div`,{className:`px-4 py-2 flex items-center justify-between gap-2 text-xs uppercase tracking-wider text-muted-foreground`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:u,className:`flex min-w-0 items-center gap-1.5 hover:text-foreground transition-colors`,"aria-expanded":!c,title:c?`Expand boards`:`Collapse boards`,children:[(0,H.jsx)(Ht,{size:13,strokeWidth:2.5,className:`shrink-0 transition-transform duration-200 motion-reduce:transition-none `+(c?``:`rotate-90`)}),(0,H.jsx)(mn,{size:11,strokeWidth:2,className:`shrink-0`}),` Boards`,c&&e.length>0?(0,H.jsxs)(`span`,{className:`normal-case opacity-60`,children:[`(`,e.length,`)`]}):null]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,H.jsx)(W,{variant:`ghost`,size:`icon-xs`,onClick:()=>m.openDialog({mode:`create`}),disabled:!a,title:a?`New group`:`Disconnected — edits are paused.`,children:(0,H.jsx)(on,{})}),(0,H.jsx)(W,{variant:`ghost`,size:`icon-xs`,onClick:w,disabled:!a,title:a?`New board`:`Disconnected — edits are paused.`,children:(0,H.jsx)(Xn,{})})]})]}),(0,H.jsxs)(Zx,{open:!c,className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[e.length===0?(0,H.jsx)(cl,{className:`gap-1 px-4 pb-2 pt-0`,children:(0,H.jsx)(pl,{className:`text-sm`,children:f.length>0?`No boards — everything's archived.`:`No boards yet.`})}):(0,H.jsx)(`ul`,{className:`flex flex-1 flex-col gap-0.5 overflow-auto scroll-stable px-2 pb-2 min-h-0`,onDragOver:te.onListDragOver,onDrop:te.onListDrop,children:te.sections.map(e=>{let t=e.group;return t?(0,H.jsxs)(`li`,{children:[(0,H.jsx)(sS,{group:t,count:e.boards.length,collapsed:m.collapsed.includes(t.id),dropTarget:te.dragGroup===t.id,disabled:!a,onToggle:()=>m.toggle(t.id),onDragOver:e=>te.onGroupDragOver(e,t.id),onRename:()=>m.openDialog({mode:`rename`,group:t}),onRecolor:e=>m.recolor(t.id,e),onDelete:()=>m.requestDelete(t)}),(0,H.jsx)(Zx,{open:!m.collapsed.includes(t.id),children:(0,H.jsx)(`ul`,{className:`ml-[15px] flex flex-col gap-0.5 border-l-2 pl-2`,style:{borderColor:t.color??`var(--border)`},children:e.boards.map(re)})})]},t.id):(0,H.jsxs)(M.Fragment,{children:[p.length>0&&e.boards.length>0?(0,H.jsxs)(`li`,{onDragOver:e=>te.onGroupDragOver(e,null),className:`mt-1 flex items-center gap-1.5 rounded-md px-1.5 py-1 text-[11px] uppercase tracking-wide text-muted-foreground `+(te.dragGroup===null&&te.dragging?`bg-accent`:``),children:[(0,H.jsx)(`span`,{className:`size-2.5 shrink-0 rounded-[3px] border border-dashed`}),`Ungrouped`,(0,H.jsx)(`span`,{className:`ml-auto normal-case opacity-70`,children:e.boards.length})]}):null,e.boards.map(re)]},`__ungrouped`)})}),f.length===0?null:(0,H.jsx)(aS,{boards:f,currentBoardId:n,open:O,onToggle:()=>k(e=>!e),onRestore:e=>ee(e,!1),onDelete:e=>g({id:e.id,name:e.name})})]})]}),(0,H.jsx)(CS,{screens:t,currentBoardId:n,currentScreenId:r}),(0,H.jsx)($u,{open:y!==null,title:y?.mode===`rename`?`Rename board`:`New board`,placeholder:`Board name`,submitLabel:y?.mode===`rename`?`Rename`:`Create`,maxLength:80,value:x,onValueChange:S,onSubmit:()=>void E(),onCancel:()=>b(null)}),(0,H.jsx)($u,{open:m.dialog!==null,title:m.dialog?.mode===`rename`?`Rename group`:`New group`,placeholder:`Group name`,submitLabel:m.dialog?.mode===`rename`?`Rename`:`Create`,maxLength:40,value:m.name,onValueChange:m.setName,onSubmit:()=>void m.submitDialog(),onCancel:m.closeDialog}),(0,H.jsx)(iu,{open:m.pendingDelete!==null,title:`Delete group`,description:m.pendingDelete?`Delete the group "${m.pendingDelete.name}"? Its boards aren't deleted — they move to Ungrouped.`:``,confirmLabel:`Delete group`,onConfirm:m.confirmDelete,onCancel:m.cancelDelete}),(0,H.jsx)(Pl,{boardId:_,onClose:()=>v(null)}),(0,H.jsx)(iu,{open:h!==null,title:`Delete board`,description:h?`Delete board "${h.name}"? Screens only this board places are deleted with it, along with any snippet nothing else reaches afterwards. Screens another board also places are kept.`:``,confirmLabel:`Delete`,onConfirm:D,onCancel:()=>g(null)})]})}function MS(e){let t=new Map;for(let n of e){let e=n.identity.app,r=n.packageName??n.identity.importPath,i=n.source===`local`?`local:${e??``}`:`package:${r}:${e??``}`,a=n.source===`local`?`This app`:r,o=t.get(i);o||(o={key:i,label:e?`${a} · ${e}`:a,roots:[],entries:[]},t.set(i,o)),o.entries.push(n),n.identity.member||o.roots.push(n)}for(let e of t.values()){let t=new Set(e.roots.map(e=>e.family));for(let n of e.entries)t.has(n.family)||(t.add(n.family),e.roots.push(n));e.roots.sort((e,t)=>e.id.localeCompare(t.id))}return[...t.values()].sort((e,t)=>+!e.key.startsWith(`local:`)-!t.key.startsWith(`local:`)||e.label.localeCompare(t.label))}function NS(e,t){if(!t)return e.roots;let n=new Set(e.entries.filter(e=>e.id.toLowerCase().includes(t)||e.name.toLowerCase().includes(t)).map(e=>e.family));return e.roots.filter(e=>n.has(e.family))}function PS({query:e}){let t=B(e=>e.repoCatalog),n=B(e=>e.loadRepoCatalog);(0,M.useEffect)(()=>{n()},[n]);let r=(0,M.useMemo)(()=>MS(t?.entries??[]),[t]);if(r.length===0)return null;let i=e.trim().toLowerCase(),a=r.map(e=>({source:e,roots:NS(e,i)})).filter(({roots:e})=>e.length>0);return a.length===0?null:(0,H.jsxs)(`div`,{"data-repo-shelves":``,children:[(0,H.jsxs)(`div`,{className:`px-4 pt-3 pb-1.5 flex items-center gap-1.5 text-[10px] uppercase tracking-wider font-semibold text-primary`,children:[(0,H.jsx)(Lt,{size:11,strokeWidth:2}),(0,H.jsx)(`span`,{className:`flex-1`,children:`Repo`})]}),a.map(({source:e,roots:t})=>(0,H.jsx)(FS,{label:e.label,roots:t,forceOpen:i.length>0,defaultOpen:e.key.startsWith(`local:`)||r.length===1},e.key)),(0,H.jsx)(pp,{className:`mx-2 my-3`})]})}function FS({label:e,roots:t,forceOpen:n,defaultOpen:r}){let[i,a]=(0,M.useState)(r),o=n||i,s=B(e=>e.libraryItem),c=B(e=>e.openLibrary),l=B(e=>e.repoStatus);return u_(t.map(e=>e.id),o),(0,H.jsxs)(d_,{open:o,onOpenChange:a,"data-repo-source":e,children:[(0,H.jsxs)(f_,{className:`w-full px-4 pt-2 pb-1 flex items-center gap-1.5 text-[10px] uppercase tracking-wider font-semibold text-muted-foreground hover:text-foreground`,children:[(0,H.jsx)(Ht,{size:11,strokeWidth:2,className:`shrink-0 transition-transform ${o?`rotate-90`:``}`}),(0,H.jsx)(`span`,{className:`flex-1 truncate text-left normal-case tracking-normal font-mono`,children:e}),(0,H.jsx)(U,{variant:`secondary`,className:`px-1.5 py-0 text-[10px] font-normal tabular-nums`,children:t.length})]}),(0,H.jsx)(p_,{children:(0,H.jsx)(`ul`,{className:`flex flex-col px-2 gap-0.5 pb-1`,children:t.map(e=>{let t=s?.kind===`repo`&&s.id===e.id;return(0,H.jsx)(`li`,{children:(0,H.jsxs)(`button`,{type:`button`,"data-repo-id":e.id,onClick:()=>c({kind:`repo`,id:e.id}),className:`w-full text-left px-2 py-1 rounded-md text-sm transition-colors flex items-center gap-2 `+(t?`bg-primary text-primary-foreground`:`hover:bg-muted`),children:[(0,H.jsx)(`span`,{className:`truncate flex-1`,children:e.id}),e.parts&&e.parts.length>0?(0,H.jsxs)(`span`,{className:`text-[10px] tabular-nums ${t?``:`text-muted-foreground`}`,title:e.parts.join(`, `),children:[`+`,e.parts.length]}):null,(0,H.jsx)(l_,{diagnostic:l[e.id]})]})},e.id)})})})]})}function IS({snippets:e}){let t=B(e=>e.components),n=B(e=>e.components===null&&e.componentsLoading),r=B(e=>e.libraryItem),i=B(e=>e.openLibrary),[a,o]=(0,M.useState)(``),{categories:s,extensions:c}=(0,M.useMemo)(()=>{if(!t)return{categories:[],extensions:[]};let e=[],n=[];for(let r of t)r.kind===`extension`?n.push({id:r.id,label:r.id}):e.push(r);return n.sort((e,t)=>e.id.localeCompare(t.id)),{categories:Xg(e),extensions:n}},[t]),l=a.trim().toLowerCase(),u=e=>!l||e.toLowerCase().includes(l),d=e.filter(e=>u(e.name)||u(e.id)),f=c.filter(e=>u(e.id));return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`section`,{className:`border-b p-2`,children:(0,H.jsxs)(Km,{className:`h-7`,children:[(0,H.jsx)(Jm,{children:(0,H.jsx)(rr,{size:12,strokeWidth:2})}),(0,H.jsx)(Zm,{type:`text`,value:a,onChange:e=>o(e.target.value),placeholder:`Search library…`})]})}),(0,H.jsxs)(`div`,{className:`flex-1 overflow-auto scroll-stable`,children:[(0,H.jsx)(RS,{icon:(0,H.jsx)(Yt,{size:11,strokeWidth:2}),label:`Snippets`,accent:!0}),e.length===0?(0,H.jsx)(cl,{className:`gap-2 p-4`,children:(0,H.jsxs)(ll,{className:`gap-1`,children:[(0,H.jsx)(dl,{variant:`icon`,className:`size-8`,children:(0,H.jsx)(Yt,{})}),(0,H.jsx)(fl,{className:`text-xs`,children:`No snippets yet.`}),(0,H.jsxs)(pl,{className:`text-xs`,children:[`Create one with `,(0,H.jsx)(sx,{children:`add_snippet`}),` in the MCP, or save a subtree from a screen.`]})]})}):d.length===0?(0,H.jsx)(zS,{query:a,noun:`snippet`}):(0,H.jsx)(`ul`,{className:`flex flex-col px-2 gap-0.5 pb-1`,children:d.map(e=>{let t=r?.kind===`snippet`&&r.id===e.id;return(0,H.jsx)(`li`,{children:(0,H.jsxs)(`button`,{type:`button`,onClick:()=>i({kind:`snippet`,id:e.id}),className:`w-full text-left px-2 py-1 rounded-md text-sm transition-colors flex items-center gap-2 `+(t?`bg-primary text-primary-foreground`:`hover:bg-muted`),children:[(0,H.jsx)(`span`,{className:`h-1 w-1 rounded-full shrink-0 `+(t?`bg-primary-foreground`:`bg-primary`)}),(0,H.jsx)(`span`,{className:`truncate`,children:e.name})]})},e.id)})}),c.length>0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(pp,{className:`mx-2 my-3`}),(0,H.jsx)(RS,{icon:(0,H.jsx)(Ln,{size:11,strokeWidth:2}),label:`Extensions`,count:f.length,accent:!0}),f.length===0?(0,H.jsx)(zS,{query:a,noun:`extension`}):(0,H.jsx)(`ul`,{className:`flex flex-col px-2 gap-0.5 pb-1`,children:f.map(e=>{let t=r?.kind===`component`&&r.id===e.id;return(0,H.jsx)(`li`,{children:(0,H.jsxs)(`button`,{type:`button`,onClick:()=>i({kind:`component`,id:e.id}),className:`w-full text-left px-2 py-1 rounded-md text-sm transition-colors flex items-center gap-2 ${t?`bg-primary text-primary-foreground`:`hover:bg-muted`}`,title:`Custom component registered via add_extension`,children:[(0,H.jsx)(`span`,{className:`h-1 w-1 rounded-full shrink-0 ${t?`bg-primary-foreground`:`bg-primary/60`}`}),(0,H.jsx)(`span`,{className:`truncate`,children:e.label})]})},e.id)})})]}):null,(0,H.jsx)(pp,{className:`mx-2 my-3`}),(0,H.jsx)(PS,{query:a}),n?(0,H.jsx)(LS,{}):null,s.map(e=>{let t=e.components.filter(u);return t.length===0?null:(0,H.jsxs)(`section`,{className:`pb-2`,children:[(0,H.jsx)(RS,{label:e.label,count:t.length}),(0,H.jsx)(`ul`,{className:`flex flex-col px-2 gap-0.5`,children:t.map(e=>{let t=r?.kind===`component`&&r.id===e;return(0,H.jsx)(`li`,{children:(0,H.jsx)(`button`,{type:`button`,onClick:()=>i({kind:`component`,id:e}),className:`w-full text-left px-2 py-1 rounded-md text-sm transition-colors `+(t?`bg-primary text-primary-foreground`:`hover:bg-muted`),children:e})},e)})})]},e.id)})]})]})}function LS(){return(0,H.jsx)(`div`,{className:`px-4 flex flex-col gap-2`,"aria-hidden":`true`,children:[`70%`,`45%`,`60%`,`38%`,`55%`,`48%`].map(e=>(0,H.jsx)(I_,{className:`h-3.5`,style:{width:e}},e))})}function RS({label:e,count:t,icon:n,accent:r}){return(0,H.jsxs)(`div`,{className:`px-4 pt-3 pb-1.5 flex items-center gap-1.5 text-[10px] uppercase tracking-wider font-semibold `+(r?`text-primary`:`text-muted-foreground`),children:[n,(0,H.jsx)(`span`,{className:`flex-1`,children:e}),t===void 0?null:(0,H.jsx)(U,{variant:`secondary`,className:`px-1.5 py-0 text-[10px] font-normal tabular-nums`,children:t})]})}function zS({query:e,noun:t}){return(0,H.jsx)(cl,{className:`p-3`,children:(0,H.jsxs)(pl,{className:`text-xs`,children:[`No `,t,` matches "`,e,`".`]})})}function BS({boards:e,screens:t,snippets:n,currentBoardId:r,currentScreenId:i}){let a=B(e=>e.view),o=B(e=>e.setView),s=B(e=>e.leftPaneCollapsed),c=B(e=>e.setLeftPaneCollapsed),l=B(e=>e.leftPaneWidth),u=B(e=>e.setLeftPaneWidth),d=B(e=>e.boardPulse),f=e=>{o(e),c(!1)};return(0,H.jsxs)(vb,{side:`left`,collapsed:s,width:l,onResize:u,rail:(0,H.jsx)(pb,{side:`left`,expandLabel:`Expand sidebar`,hotkey:`[`,onExpand:()=>c(!1),actions:[{icon:(0,H.jsx)(mn,{}),label:`Boards`,active:a===`boards`,dot:Object.keys(d).length>0?{title:`an agent edited another board`}:void 0,onClick:()=>f(`boards`)},{icon:(0,H.jsx)(gn,{}),label:`Library`,active:a===`library`,onClick:()=>f(`library`)}]}),children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1 p-2 border-b`,children:[(0,H.jsx)(Up,{value:a,onValueChange:e=>o(e),className:`min-w-0 flex-1`,children:(0,H.jsxs)(Gp,{className:`w-full h-8`,children:[(0,H.jsxs)(Kp,{value:`boards`,className:`text-xs`,children:[(0,H.jsx)(mn,{}),`Boards`]}),(0,H.jsxs)(Kp,{value:`library`,className:`text-xs`,children:[(0,H.jsx)(gn,{}),`Library`]})]})}),(0,H.jsx)(mb,{side:`left`,label:`Collapse sidebar`,hotkey:`[`,onCollapse:()=>c(!0)})]}),a===`boards`?(0,H.jsx)(jS,{boards:e,screens:t,currentBoardId:r,currentScreenId:i}):(0,H.jsx)(IS,{snippets:n})]})}var VS=1500;function HS(e){let t=e.action??`use velloo-cloud`;return e.expired?{title:`Sign in again to continue`,description:`Your velloo-cloud session has ended, so velloo can't ${t} until you sign back in.`}:e.action?{title:`Sign in to continue`,description:`Signing in to velloo-cloud lets velloo ${t}.`}:{title:`Sign in to velloo-cloud`,description:`Publishing boards and pulling share-link comments need an account.`}}function US(){let e=B(e=>e.signInPrompt),t=B(e=>e.closeSignIn),n=B(e=>e.refreshAuth),r=e!==null,i=(0,M.useRef)({});e&&(i.current=e);let a=HS(i.current),[o,s]=(0,M.useState)({state:`idle`}),[c,l]=(0,M.useState)(!1),u=(0,M.useRef)(null),d=(0,M.useCallback)(()=>{u.current?.();let e=!0,r,i=()=>{e=!1,r&&clearInterval(r)};u.current=i;let a=e=>{i(),n(),L({kind:`success`,message:e.account?.email?`Signed in as ${e.account.email}.`:`Signed in to velloo-cloud.`}),t()};(async()=>{l(!0);let t;try{t=await Bo.login()}catch(t){if(!e)return;l(!1),s({state:`error`,message:t instanceof Error?t.message:`Could not start sign-in.`});return}if(e){if(l(!1),s(t.login),Lo(t)){a(t);return}t.login.state===`pending`&&(r=setInterval(()=>{Bo.status().then(t=>{if(e){if(Lo(t)){a(t);return}s(t.login),t.login.state!==`pending`&&i()}})},VS))}})()},[n,t]);(0,M.useEffect)(()=>{if(!r){u.current?.(),u.current=null,s({state:`idle`}),l(!1);return}return d(),()=>{u.current?.(),u.current=null}},[r,d]);let f=()=>{t(),o.state===`pending`&&Bo.cancelLogin().catch(()=>void 0)};return(0,H.jsx)(Cl,{open:r,onOpenChange:e=>!e&&f(),children:(0,H.jsxs)(El,{className:`sm:max-w-md`,children:[(0,H.jsxs)(Dl,{children:[(0,H.jsx)(kl,{children:a.title}),(0,H.jsx)(Al,{children:a.description})]}),c||o.state===`idle`?(0,H.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-sm text-muted-foreground`,children:[(0,H.jsx)(ng,{className:`size-3.5`}),`Starting sign-in…`]}):null,o.state===`pending`?(0,H.jsxs)(`div`,{className:`flex flex-col gap-4 py-2`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col items-center gap-2 rounded-md border bg-muted/40 py-4`,children:[(0,H.jsx)(`span`,{className:`text-[11px] uppercase tracking-wide text-muted-foreground`,children:`Your code`}),(0,H.jsx)(`span`,{className:`font-mono text-2xl tracking-[0.2em] tabular-nums`,children:o.userCode})]}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`A browser tab should have opened. Enter the code there to finish signing in — this dialog closes itself once it lands.`}),(0,H.jsxs)(`a`,{href:o.verificationUrl,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1.5 text-sm underline underline-offset-4`,children:[(0,H.jsx)(en,{size:13}),`Open the sign-in page`]})]}):null,o.state===`error`?(0,H.jsxs)(`div`,{className:`flex items-start gap-2 py-2 text-sm text-destructive`,children:[(0,H.jsx)(Sr,{size:14,className:`mt-0.5 shrink-0`}),(0,H.jsx)(`span`,{children:o.message})]}):null,(0,H.jsxs)(Ol,{children:[(0,H.jsx)(W,{variant:`outline`,onClick:f,children:o.state===`pending`?`Cancel`:`Close`}),o.state===`error`?(0,H.jsx)(W,{onClick:d,children:`Try again`}):null]})]})})}function WS({snippet:e}){return(0,H.jsxs)(`section`,{className:`border-b flex flex-col gap-1 px-3 pt-3 pb-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,H.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground font-medium`,children:`Params`}),(0,H.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,title:`A param is a contract with every instance of this snippet across every screen. Changing one here could only ever change this side of it, so a removed param left each caller passing an arg that no longer resolved — breaking screens you weren't looking at. Ask your agent: update_snippet moves the declaration and the call sites in one pass.`,children:`read-only`})]}),e.params.length===0?(0,H.jsx)(`div`,{className:`text-[11px] text-muted-foreground mt-1`,children:`No params.`}):(0,H.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.params.map(e=>(0,H.jsx)(`li`,{className:`rounded-md border bg-background`,children:(0,H.jsx)(GS,{param:e})},e.name))})]})}function GS({param:e}){let t=Qg(e);return(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2 py-1`,children:[(0,H.jsxs)(`span`,{className:`font-mono text-[11px] truncate`,children:[`$`,e.name]}),(0,H.jsx)(U,{variant:`outline`,className:`text-[9px] font-mono shrink-0`,children:e.type}),t?(0,H.jsxs)(`span`,{className:`text-[10px] text-muted-foreground truncate`,children:[`= `,t]}):(0,H.jsx)(`span`,{className:`text-[10px] text-amber-600 dark:text-amber-400`,children:`required`}),e.description?(0,H.jsxs)(`span`,{className:`text-[10px] text-muted-foreground truncate`,title:e.description,children:[`· `,e.description]}):null]})}var KS={name:`Snippet`,w:480,h:360};function qS({snippetId:e,snippetMeta:t,presets:n}){let r=B(e=>e.closeSnippetEditor),i=B(e=>e.themeVersion),a=B(e=>e.designMode),o=B(t=>t.screenVersions[`snippet:${e}`]??0),s=B(e=>e.refreshDesignSummary),c=B(e=>e.setSelection),l=B(e=>e.setHover),u=B(e=>e.setNodeRects),d=B(e=>e.reportRenderError),f=B(e=>e.clearNodeRects),p=B(e=>e.selection),m=B(e=>e.hover),h=B(e=>e.nodeState),g=B(e=>e.setSyntheticScreen),_=B(e=>e.loadComponents),v=`snippet:${e}`,y=B(e=>e.screens[v]??null);(0,M.useEffect)(()=>{_()},[_]);let[b,x]=(0,M.useState)(null),[S,C]=(0,M.useState)(!0),[w,T]=(0,M.useState)(!1);(0,M.useEffect)(()=>{let t=!0;return C(!0),T(!1),Wo(e).then(e=>{t&&(x(e),C(!1),g(v,{id:v,name:e.name,tree:e.tree,...e.library?{library:e.library}:{}}))}).catch(()=>{t&&C(!1)}),()=>{t=!1}},[e,g,v]);let E=n.find(e=>e.name.toLowerCase().includes(`desktop`))??n[0]??KS,[D,O]=(0,M.useState)(E),k=a===`dark`?`&mode=dark`:``,A=`/api/render/snippet-body/${encodeURIComponent(e)}?w=${D.w}&h=${D.h}&v=${i}.${o}${k}`,ee=(0,M.useRef)(null),te=(0,M.useRef)(null),ne=(0,M.useRef)(null),re=`snippet-view-${e}`;(0,M.useEffect)(()=>{let e=ee.current;if(!e)return;let t=new Nu(e,{onSelect(e){c(e===null?null:{screenId:v,path:e})},onHover(e){l(e===null?null:{screenId:v,path:e})},onReady(){let e=B.getState();e.selection?.screenId===v&&t.send({type:`applyHighlight`,path:e.selection.path}),e.hover?.screenId===v&&t.send({type:`applyHover`,path:e.hover.path})},onRects(e){u(re,e)},onParentPan(e,t){let n=te.current;n&&(n.scrollLeft+=e,n.scrollTop+=t)}});ne.current=t;let n=()=>{d(v,Wl(e)),t.attach()};return e.addEventListener(`load`,n),e.contentDocument?.readyState===`complete`&&n(),()=>{e.removeEventListener(`load`,n),t.destroy(),ne.current=null,f(re)}},[S,v,re,c,l,u,f,d]),(0,M.useEffect)(()=>{let e=ne.current;e&&(p?.screenId===v?e.send({type:`applyHighlight`,path:p.path}):e.send({type:`clearHighlight`}))},[p,v]),(0,M.useEffect)(()=>{let e=ne.current;e&&(m?.screenId===v?e.send({type:`applyHover`,path:m.path}):e.send({type:`clearHover`}))},[m,v]),(0,M.useEffect)(()=>{let e=ne.current;if(!e)return;let t=p?.screenId===v?p.path:null;e.send({type:`applyVelloState`,path:t,state:t?h:`default`})},[h,p,v]);let ie=async t=>{try{await P(`update_snippet`,{snippetId:e,patch:{name:t}}),s()}catch(e){R(e,`Could not update snippet`)}};if(S)return(0,H.jsx)(`div`,{className:`flex-1 grid place-items-center text-sm text-muted-foreground`,children:(0,H.jsx)(Qu,{size:32,label:`Loading snippet…`,className:`flex-col`})});if(!b)return(0,H.jsxs)(`div`,{className:`flex-1 grid place-items-center text-sm text-muted-foreground gap-2`,children:[(0,H.jsxs)(`div`,{children:[`Snippet "`,e,`" not found.`]}),(0,H.jsxs)(W,{variant:`ghost`,size:`sm`,onClick:r,children:[(0,H.jsx)(Mt,{}),` Back`]})]});let ae=p?.screenId===v,oe={...b,name:t?.name??b.name,params:t?.params??b.params};return(0,H.jsxs)(`div`,{className:`flex-1 flex min-h-0`,children:[(0,H.jsxs)(`aside`,{className:`flex h-full w-72 shrink-0 flex-col border-r bg-card`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 border-b`,children:[(0,H.jsxs)(W,{variant:`ghost`,size:`xs`,onClick:r,className:`-ml-1`,children:[(0,H.jsx)(Mt,{size:12}),`Back`]}),(0,H.jsx)(U,{variant:`outline`,className:`ml-auto text-[10px] font-mono`,children:`snippet`})]}),(0,H.jsx)(YS,{snippet:oe,onPatchName:ie}),(0,H.jsx)(WS,{snippet:oe}),(0,H.jsxs)(`div`,{className:`border-t flex-1 overflow-y-auto scroll-stable`,children:[(0,H.jsx)(JS,{children:`Body`}),y?(0,H.jsx)(SS,{screen:y},y.id):(0,H.jsx)(`div`,{className:`px-4 py-3 text-xs text-muted-foreground`,children:`No body to display.`})]})]}),(0,H.jsxs)(`main`,{className:`flex-1 flex flex-col min-w-0 bg-background`,children:[(0,H.jsx)(XS,{presets:n,viewport:D,setViewport:O,snippet:oe}),(0,H.jsx)(`div`,{ref:te,className:`flex-1 overflow-auto scroll-stable bg-muted/30`,children:(0,H.jsx)(`div`,{className:`min-w-fit min-h-full flex items-center justify-center p-8`,children:(0,H.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[(0,H.jsxs)(`div`,{className:`relative rounded-md border bg-white shadow-sm overflow-hidden shrink-0`,style:{width:D.w,height:D.h},children:[(0,H.jsx)(`iframe`,{ref:ee,title:`${b.name} preview`,src:A,onLoad:()=>T(!0),className:`block border-0`,style:{width:D.w,height:D.h}}),w?null:(0,H.jsx)(ed,{})]}),(0,H.jsxs)(`div`,{className:`text-xs text-muted-foreground tabular-nums`,children:[D.w,` × `,D.h]})]})})})]}),(0,H.jsx)(`aside`,{className:`w-80 shrink-0 border-l bg-card flex flex-col overflow-hidden`,children:ae?(0,H.jsx)(lb,{}):(0,H.jsx)(cl,{className:`flex-1 p-6`,children:(0,H.jsxs)(ll,{children:[(0,H.jsx)(dl,{variant:`icon`,children:(0,H.jsx)(Fn,{})}),(0,H.jsx)(fl,{className:`text-xs`,children:`Nothing selected`}),(0,H.jsx)(pl,{className:`text-xs`,children:`Click a node in the snippet preview to edit.`})]})})})]})}function JS({children:e}){return(0,H.jsx)(`div`,{className:`px-3 pt-3 pb-1 text-[10px] uppercase tracking-wider text-muted-foreground font-medium`,children:e})}function YS({snippet:e,onPatchName:t}){let[n,r]=(0,M.useState)(!1),[i,a]=(0,M.useState)(e.name),o=(0,M.useRef)(null);(0,M.useEffect)(()=>{a(e.name)},[e.name]),(0,M.useEffect)(()=>{n&&o.current?.focus()},[n]);let s=()=>{let n=i.trim();r(!1),n&&n!==e.name?t(n):a(e.name)};return(0,H.jsxs)(`div`,{className:`px-3 py-2 border-b`,children:[n?(0,H.jsx)(Q,{ref:o,value:i,onChange:e=>a(e.target.value),onBlur:s,onKeyDown:t=>{t.key===`Enter`&&s(),t.key===`Escape`&&(r(!1),a(e.name))},className:`h-7`}):(0,H.jsxs)(`button`,{type:`button`,onClick:()=>r(!0),className:`w-full text-left font-semibold text-sm flex items-center gap-1.5 hover:text-primary group truncate`,title:`Rename snippet`,children:[(0,H.jsx)(ur,{size:11,className:`text-muted-foreground shrink-0`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`truncate`,children:e.name}),(0,H.jsx)(Jn,{size:10,className:`opacity-0 group-hover:opacity-50 transition-opacity shrink-0`})]}),(0,H.jsxs)(`div`,{className:`mt-0.5 text-[10px] font-mono text-muted-foreground truncate`,children:[`@`,e.id]})]})}function XS({snippet:e,presets:t,viewport:n,setViewport:r}){return(0,H.jsxs)(`header`,{className:`border-b bg-card/40 backdrop-blur-sm px-6 py-2.5 flex items-center gap-3`,children:[(0,H.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Preview · `,(0,H.jsx)(`span`,{className:`font-medium text-foreground`,children:e.name})]}),(0,H.jsx)(`div`,{className:`flex-1`}),(0,H.jsxs)(K,{value:n.name,onValueChange:e=>{let n=t.find(t=>t.name===e);n&&r(n)},children:[(0,H.jsx)(J,{size:`sm`,className:`text-xs w-44`,children:(0,H.jsx)(q,{})}),(0,H.jsx)(Y,{children:t.map(e=>(0,H.jsxs)(X,{value:e.name,children:[e.name,` · `,e.w,`×`,e.h]},e.name))})]})]})}function ZS({className:e,size:t=24}){return(0,H.jsxs)(`svg`,{viewBox:`0 0 120 120`,width:t,height:t,className:e,role:`img`,"aria-label":`Velloo`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,H.jsx)(`title`,{children:`Velloo`}),(0,H.jsx)(`defs`,{children:(0,H.jsx)(`clipPath`,{id:`velloo-weave`,children:(0,H.jsx)(`rect`,{x:`52`,y:`30`,width:`38`,height:`35`})})}),(0,H.jsx)(`rect`,{x:`21`,y:`21`,width:`58`,height:`58`,rx:`20`,stroke:`#FF6F4D`,strokeWidth:`11`,strokeLinejoin:`round`}),(0,H.jsx)(`rect`,{x:`41`,y:`41`,width:`58`,height:`58`,rx:`20`,stroke:`#FFAB1F`,strokeWidth:`11`,strokeLinejoin:`round`}),(0,H.jsx)(`rect`,{x:`21`,y:`21`,width:`58`,height:`58`,rx:`20`,stroke:`#FF6F4D`,strokeWidth:`11`,strokeLinejoin:`round`,clipPath:`url(#velloo-weave)`})]})}function QS({className:e,fontSize:t=26}){let n=Math.round(t*.57),r=Math.max(1,Math.round(t*.022)),i=Math.round(t*1.55);return(0,H.jsxs)(`span`,{className:e,style:{display:`inline-flex`,alignItems:`center`,gap:Math.round(i*.28)},children:[(0,H.jsx)(ZS,{size:i}),(0,H.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`baseline`,fontFamily:`"Poppins", ui-sans-serif, system-ui, sans-serif`,fontWeight:700,fontSize:t,letterSpacing:`-0.06em`,lineHeight:1},children:[`vell`,(0,H.jsx)(`span`,{style:{width:n,height:n,borderRadius:9999,background:`#FFAB1F`,marginLeft:r,display:`inline-block`}}),(0,H.jsx)(`span`,{style:{width:n,height:n,borderRadius:9999,background:`#FF6F4D`,marginLeft:r,display:`inline-block`}})]})]})}var $S=u(`group/button-group flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-lg [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1`,{variants:{orientation:{horizontal:`[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-lg!`,vertical:`flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-lg!`}},defaultVariants:{orientation:`horizontal`}});function eC({className:e,orientation:t,...n}){return(0,H.jsx)(`div`,{role:`group`,"data-slot":`button-group`,"data-orientation":t,className:V($S({orientation:t}),e),...n})}function tC({label:e,hotkey:t,children:n}){return(0,H.jsxs)(hp,{children:[(0,H.jsx)(gp,{asChild:!0,children:n}),(0,H.jsx)(_p,{children:(0,H.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[e,t?(0,H.jsx)(sx,{className:`border-border/40 bg-background/10 text-current opacity-80`,children:t}):null]})})]})}function nC(){let e=B(e=>e.design),t=B(e=>e.currentScreenId),n=B(e=>e.view),r=B(e=>e.libraryItem),i=B(e=>e.theme),a=B(e=>e.canvasZoom),o=B(e=>e.zoomAtViewportCenter),s=B(e=>e.cursorMode),c=B(e=>e.setCursorMode),l=B(e=>e.enterCommentMode),u=B(e=>e.history),d=B(e=>e.refreshHistory),f=B(e=>e.designMode),p=B(e=>e.setDesignMode),m=B(e=>e.setPublishOpen),h=e?.screens.find(e=>e.id===t),g=n===`library`?[`Library`,...r?[r.id]:[]]:h?[h.name]:[],_=[...e?.designName?[e.designName]:[],...g],v=f===`dark`,y=!!i?.colorsDark,b=()=>{if(!y){R("This theme has no dark palette. Add `colorsDark` in theme/default.json.",`Theme has no dark palette`);return}p(v?`light`:`dark`)},x=()=>{o({zoom:1})},S=()=>{ss().catch(e=>R(e,`Undo failed`)).finally(()=>d())},C=()=>{cs().catch(e=>R(e,`Redo failed`)).finally(()=>d())},w=[{value:`select`,icon:(0,H.jsx)(Pn,{size:14,strokeWidth:2}),label:`Select`,hotkey:`V`},{value:`hand`,icon:(0,H.jsx)(ln,{size:14,strokeWidth:2}),label:`Pan canvas`,hotkey:`H`},{value:`note`,icon:(0,H.jsx)(hr,{size:14,strokeWidth:2}),label:`Drop a free note`,hotkey:`T`},{value:`comment`,icon:(0,H.jsx)(kn,{size:14,strokeWidth:2}),label:`Comment on the design`,hotkey:`C`}];return(0,H.jsx)(mp,{delayDuration:200,children:(0,H.jsxs)(`header`,{className:`h-11 shrink-0 border-b bg-card flex items-center gap-3 px-4 text-sm`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,H.jsx)(QS,{fontSize:15}),_.length>0?(0,H.jsx)($g,{children:(0,H.jsx)(e_,{className:`gap-1.5 text-sm sm:gap-1.5`,children:_.map((e,t)=>(0,H.jsxs)(M.Fragment,{children:[(0,H.jsx)(i_,{className:`[&>svg]:size-3`}),(0,H.jsx)(t_,{children:t===_.length-1?(0,H.jsx)(r_,{className:`truncate`,children:e}):(0,H.jsx)(`span`,{className:`truncate`,children:e})})]},t))})}):null]}),(0,H.jsxs)(`div`,{className:`ml-auto flex items-center gap-1.5`,children:[(0,H.jsx)(gl,{}),(0,H.jsx)(rC,{}),(0,H.jsx)(pp,{orientation:`vertical`,className:`mx-1 h-5`}),(0,H.jsx)(Yp,{type:`single`,variant:`outline`,size:`sm`,spacing:0,value:s,onValueChange:e=>{e&&(e===`comment`?l():c(e))},children:w.map(e=>(0,H.jsx)(tC,{label:e.label,hotkey:e.hotkey,children:(0,H.jsx)(Xp,{value:e.value,"aria-label":e.label,"aria-pressed":s===e.value,"data-state":s===e.value?`on`:`off`,className:s===e.value?`bg-accent text-accent-foreground hover:bg-accent hover:text-accent-foreground`:void 0,children:e.icon})},e.value))}),(0,H.jsx)(iC,{}),(0,H.jsxs)(eC,{className:`ml-2`,children:[(0,H.jsx)(tC,{label:`Undo${u.undo>0?` — ${u.undo} step${u.undo===1?``:`s`}`:``}`,hotkey:`⌘Z`,children:(0,H.jsx)(W,{variant:`outline`,size:`icon-sm`,onClick:S,disabled:u.undo===0,children:(0,H.jsx)(wr,{})})}),(0,H.jsx)(tC,{label:`Redo${u.redo>0?` — ${u.redo} step${u.redo===1?``:`s`}`:``}`,hotkey:`⌘⇧Z`,children:(0,H.jsx)(W,{variant:`outline`,size:`icon-sm`,onClick:C,disabled:u.redo===0,children:(0,H.jsx)($n,{})})})]}),(0,H.jsx)(pp,{orientation:`vertical`,className:`mx-1 h-5`}),(0,H.jsxs)(eC,{children:[(0,H.jsx)(tC,{label:`Zoom out`,hotkey:`−`,children:(0,H.jsx)(W,{variant:`outline`,size:`icon-sm`,onClick:()=>o({factor:1/1.1}),children:(0,H.jsx)(jn,{})})}),(0,H.jsx)(tC,{label:`Reset zoom`,hotkey:`0`,children:(0,H.jsxs)(W,{variant:`outline`,size:`sm`,onClick:x,className:`min-w-[3rem] tabular-nums text-muted-foreground`,children:[Math.round(a*100),`%`]})}),(0,H.jsx)(tC,{label:`Zoom in`,hotkey:`+`,children:(0,H.jsx)(W,{variant:`outline`,size:`icon-sm`,onClick:()=>o({factor:1.1}),children:(0,H.jsx)(Xn,{})})})]}),(0,H.jsx)(pp,{orientation:`vertical`,className:`mx-1 h-5`}),(0,H.jsx)(tC,{label:v?`Set canvas default to light; pinned frames stay pinned`:`Set canvas default to dark; pinned frames stay pinned`,children:(0,H.jsxs)(W,{variant:`outline`,size:`sm`,onClick:b,children:[v?(0,H.jsx)(_r,{}):(0,H.jsx)(Nn,{}),(0,H.jsx)(`span`,{children:`Default`})]})}),(0,H.jsx)(tC,{label:`Publish boards as a share link`,children:(0,H.jsxs)(W,{variant:`outline`,size:`sm`,onClick:()=>m(!0),children:[(0,H.jsx)(or,{}),(0,H.jsx)(`span`,{children:`Publish`})]})}),(0,H.jsx)(Hg,{})]})]})})}function rC(){let e=B(e=>e.setSearchOpen);return(0,H.jsx)(tC,{label:`Search boards, screens & text`,hotkey:`⌘K`,children:(0,H.jsx)(W,{variant:`outline`,size:`icon-sm`,onClick:()=>e(!0),children:(0,H.jsx)(rr,{})})})}function iC(){let e=B(e=>e.markupVisible),t=B(e=>e.setMarkupVisible);return(0,H.jsx)(tC,{label:e?`Hide notes + comments`:`Show notes + comments`,children:(0,H.jsx)(W,{variant:`outline`,size:`icon-sm`,onClick:()=>t(!e),children:e?(0,H.jsx)(nn,{}):(0,H.jsx)(tn,{})})})}function aC(e){return e===`system`?typeof window>`u`?`light`:window.matchMedia?.(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:e}function oC(e){let t=aC(B(e=>e.appTheme));return(0,H.jsx)(f,{theme:t,className:`toaster group`,style:{"--normal-bg":`var(--popover)`,"--normal-text":`var(--popover-foreground)`,"--normal-border":`var(--border)`},...e})}function sC(){let e=new URLSearchParams(window.location.search),t=e.get(`view`),n=t===`library`?`library`:t===`snippet`?`snippet`:`boards`,r=e.get(`item`),i=null;if(n===`library`&&r){let[e,...t]=r.split(`:`);(e===`component`||e===`snippet`||e===`repo`)&&t.length>0&&(i={kind:e,id:t.join(`:`)})}let a=e.get(`board`),o=e.get(`screen`),s=e.get(`sel`),c=o&&s!==null?{screenId:o,path:s}:null,l=n===`snippet`?e.get(`snippet`):null;return{view:n,libraryItem:i,boardId:a,screenId:o,selection:c,snippetId:l}}function cC(e,t,n,r,i,a,o){let s=new URL(window.location.href);s.searchParams.delete(`view`),s.searchParams.delete(`item`),s.searchParams.delete(`board`),s.searchParams.delete(`screen`),s.searchParams.delete(`sel`),s.searchParams.delete(`snippet`),e===`snippet`&&a?(s.searchParams.set(`view`,`snippet`),s.searchParams.set(`snippet`,a)):e===`library`?(s.searchParams.set(`view`,`library`),t&&s.searchParams.set(`item`,`${t.kind}:${t.id}`)):(n&&s.searchParams.set(`board`,n),r&&s.searchParams.set(`screen`,r),i&&s.searchParams.set(`sel`,i.path)),o?window.history.pushState({},``,s.toString()):window.history.replaceState({},``,s.toString())}function lC(e){return e?`${e.kind}:${e.id}`:``}function uC(){let e=B(e=>e.view),t=B(e=>e.libraryItem),n=B(e=>e.currentBoardId),r=B(e=>e.currentScreenId),i=B(e=>e.selection),a=B(e=>e.editingSnippetId),o=(0,M.useRef)(void 0),s=(0,M.useRef)(void 0),c=(0,M.useRef)(void 0),l=(0,M.useRef)(!1);(0,M.useEffect)(()=>{if(l.current){l.current=!1,o.current=n,s.current=e,c.current=lC(t);return}let u=o.current,d=s.current,f=c.current,p=lC(t),m=e===`boards`&&!!(u&&n&&u!==n),h=d!==void 0&&d!==e,g=e===`library`&&f!==void 0&&f!==p;o.current=n,s.current=e,c.current=p,cC(e,t,n,r,i,a,m||h||g)},[e,t,n,r,i,a]),(0,M.useEffect)(()=>{let e=()=>{let e=sC(),t=B.getState();l.current=!0;let n=[];e.view===t.view?e.view===`library`?t.openLibrary(e.libraryItem):e.view===`snippet`&&e.snippetId&&t.openSnippetEditor(e.snippetId):e.view===`snippet`&&e.snippetId?t.openSnippetEditor(e.snippetId):e.view===`library`?t.openLibrary(e.libraryItem):t.editingSnippetId?t.closeSnippetEditor():t.closeLibrary(),e.view===`boards`&&(e.boardId&&e.boardId!==t.currentBoardId&&n.push(t.selectBoard(e.boardId)),e.screenId&&e.screenId!==t.currentScreenId&&n.push(t.selectScreen(e.screenId))),Promise.all(n).then(()=>{e.view===`boards`&&t.setSelection(e.selection)})};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[])}function dC(){let e=null,t=!1,n=250;function r(){if(t)return;let i=`${window.location.protocol===`https:`?`wss:`:`ws:`}//${window.location.host}/ws`;e=new WebSocket(i),e.onopen=()=>{n=250,Pr(!0);let e=B.getState(),t=e.wsEverConnected&&!e.wsConnected;e.setWsConnected(!0),e.design===null?e.bootError!==null&&e.loadDesign():t&&e.resyncAfterReconnect()},e.onmessage=e=>{let t=Lr(e.data);if(!t)return;if(t.type===`activity`){let e=Ns(t);e&&B.getState().recordActivity(e);return}let{currentScreenId:n,currentBoardId:r,refreshScreen:i,refreshBoard:a,refreshDesignSummary:o,refreshHistory:s,refreshTheme:c,refreshAnnotations:l,refreshNotes:u,refreshComments:d,screens:f,boards:p}=B.getState();if(s(),t.type===`screen-changed`)t.screenId in f?i(t.screenId):o();else if(t.type===`board-changed`)t.boardId in p?a(t.boardId):o();else if(t.type===`theme-changed`)c();else if(t.type===`snippet-changed`){o(),n&&i(n);let e=B.getState();(e.editingSnippetId===t.snippetId||e.snippetFocus===t.snippetId)&&(async()=>{try{let e=await Wo(t.snippetId);B.getState().setSyntheticScreen(`snippet:${t.snippetId}`,{id:`snippet:${t.snippetId}`,name:e.name,tree:e.tree,...e.library?{library:e.library}:{}})}catch{}})()}else if(t.type===`annotations-changed`){let e=r?p[r]:null;(e?.frames.some(e=>e.screen===t.screenId)||!e&&t.screenId===n)&&l()}else t.type===`notes-changed`?t.boardId===r&&u():t.type===`comments-changed`?(t.boardId===r&&d(),B.getState().refreshCommentCounts()):t.type===`config-changed`?(o(),B.getState().folderConfig&&B.getState().loadFolderConfig(),B.getState().reloadRepoCatalog()):t.type===`folder-reloaded`?(B.getState().reloadAll(),B.getState().reloadRepoCatalog()):t.type===`reload-error`&&L({kind:`error`,title:`File change not applied`,message:`${t.source}: ${t.message}`,ttl:8e3})},e.onclose=()=>{Pr(!1),B.getState().setWsConnected(!1),!t&&(setTimeout(r,n),n=Math.min(n*2,5e3))},e.onerror=()=>{e?.close()}}return r(),()=>{t=!0,e?.close()}}var fC=6e4;function pC(){(0,M.useEffect)(()=>{let e=vs(e=>B.getState().openSignIn(e)),t=()=>void B.getState().refreshAuth();t();let n=setInterval(t,fC),r=()=>{document.visibilityState===`visible`&&t()};return document.addEventListener(`visibilitychange`,r),()=>{e(),clearInterval(n),document.removeEventListener(`visibilitychange`,r)}},[])}function mC(){(0,M.useEffect)(()=>{let e=()=>B.getState().syncPaneLayout(window.innerWidth);return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[])}function hC(){let e=B(e=>e.design),t=B(e=>e.bootError),n=B(e=>e.view),r=B(e=>e.libraryItem),i=B(e=>e.editingSnippetId),a=B(e=>e.currentBoardId),o=B(e=>e.currentScreenId),s=B(e=>a?e.boards[a]??null:null),c=B(e=>e.loadDesign),l=B(e=>e.setSelection),u=(0,M.useRef)(!1),d=(0,M.useRef)(null),[f,p]=(0,M.useState)(null);return(0,M.useEffect)(()=>{if(u.current)return;u.current=!0;let e=sC();return e.view===`library`?B.getState().openLibrary(e.libraryItem):e.view===`snippet`&&e.snippetId&&B.getState().openSnippetEditor(e.snippetId),(async()=>{await c({boardId:e.boardId,screenId:e.screenId}),e.view===`boards`&&e.selection&&l(e.selection)})(),dC()},[c,l]),uC(),rl(),pC(),mC(),(0,M.useEffect)(Ag,[]),(0,M.useEffect)(()=>{document.title=il(e?.designName,s?.name)},[e?.designName,s?.name]),(0,M.useEffect)(()=>{let e=e=>{let t=e.target,n=t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable),r=e.metaKey||e.ctrlKey,i=B.getState();if(r&&(e.key===`k`||e.key===`K`))e.preventDefault(),i.setSearchOpen(!i.searchOpen);else if(r&&(e.key===`z`||e.key===`Z`)&&!e.shiftKey){if(n)return;e.preventDefault(),ss().catch(e=>R(e,`Undo failed`))}else if(r&&(e.key===`z`||e.key===`Z`)&&e.shiftKey){if(n)return;e.preventDefault(),cs().catch(e=>R(e,`Redo failed`))}else if(!r&&!n&&(e.key===`=`||e.key===`+`))e.preventDefault(),i.zoomAtViewportCenter({factor:1.1});else if(!r&&!n&&e.key===`-`)e.preventDefault(),i.zoomAtViewportCenter({factor:1/1.1});else if(!r&&!n&&e.key===`0`)e.preventDefault(),i.zoomAtViewportCenter({zoom:1});else if(!r&&!n&&e.key===`[`)e.preventDefault(),i.setLeftPaneCollapsed(!i.leftPaneCollapsed);else if(!r&&!n&&e.key===`]`)e.preventDefault(),i.setRightPaneCollapsed(!i.rightPaneCollapsed);else if(!r&&!n&&(e.key===`v`||e.key===`V`))i.setCursorMode(`select`);else if(!r&&!n&&(e.key===`h`||e.key===`H`))i.setCursorMode(`hand`);else if(!r&&!n&&(e.key===`t`||e.key===`T`))i.setCursorMode(`note`);else if(!r&&!n&&(e.key===`c`||e.key===`C`))i.enterCommentMode();else if(e.key===` `&&!n&&!d.current)e.preventDefault(),d.current=i.cursorMode,i.setCursorMode(`hand`);else if(e.key===`Escape`){if(i.snippetFocus){e.preventDefault(),i.setSnippetFocus(null);return}if(i.editingSnippetId){e.preventDefault(),i.closeSnippetEditor();return}i.setCursorMode(`select`),i.setEditingMarkupId(null)}},t=e=>{if(e.key===` `&&d.current){let e=d.current;d.current=null,B.getState().setCursorMode(e)}};return window.addEventListener(`keydown`,e),window.addEventListener(`keyup`,t),()=>{window.removeEventListener(`keydown`,e),window.removeEventListener(`keyup`,t)}},[]),(0,M.useEffect)(()=>{let e=[`hand`,`note`,`comment`],t=t=>{for(let n of e)document.body.classList.toggle(`velloo-${n}`,t===n)};t(B.getState().cursorMode);let n=B.subscribe((e,n)=>{e.cursorMode!==n.cursorMode&&t(e.cursorMode)});return()=>{n();for(let t of e)document.body.classList.remove(`velloo-${t}`)}},[]),e?(0,H.jsxs)(`div`,{className:`h-full flex flex-col`,children:[(0,H.jsx)(nC,{}),(0,H.jsx)(gC,{}),(0,H.jsxs)(`div`,{className:`flex-1 flex min-h-0`,children:[(0,H.jsx)(BS,{boards:e.boards,screens:e.screens,snippets:e.snippets,currentBoardId:a,currentScreenId:o}),(0,H.jsx)(`main`,{className:`flex-1 flex flex-col min-w-0`,children:n===`snippet`&&i?(0,H.jsx)(qS,{snippetId:i,snippetMeta:e.snippets.find(e=>e.id===i)??null,presets:e.viewportPresets}):n===`library`?r?(0,H.jsx)(A_,{item:r,snippets:e.snippets}):(0,H.jsx)(B_,{snippets:e.snippets}):s&&s.frames.length>0?(0,H.jsx)(Ih,{board:s}):s?(0,H.jsx)(zh,{title:`Board "${s.name}" is empty`,hint:`Ask your agent to design something here — it places screens on boards through the velloo MCP tools. Or place an existing screen yourself.`,action:e.screens.length>0?(0,H.jsxs)(W,{variant:`outline`,onClick:()=>p(s.id),children:[(0,H.jsx)(Xn,{}),`Add frame`]}):void 0}):(0,H.jsx)(zh,{title:e.boards.length===0?`No boards yet`:`No board selected`,hint:e.boards.length===0?`Create a board to start designing — or ask your agent over MCP to set up the folder.`:`Pick a board from the sidebar to see its frames.`,action:e.boards.length===0?(0,H.jsxs)(W,{variant:`outline`,onClick:()=>{(async()=>{try{let e=await I.addBoard({name:`Main`});await B.getState().selectBoard(e.boardId)}catch(e){R(e,`Could not create board`)}})()},children:[(0,H.jsx)(Xn,{}),`New board`]}):void 0})}),n===`boards`?(0,H.jsx)(ax,{screenId:o}):null]}),(0,H.jsx)(ux,{}),(0,H.jsx)(Wh,{}),(0,H.jsx)(J_,{}),(0,H.jsx)(Jx,{}),(0,H.jsx)(Pl,{boardId:f,onClose:()=>p(null)}),(0,H.jsx)(og,{}),(0,H.jsx)(US,{}),(0,H.jsx)(pv,{}),(0,H.jsx)(_g,{}),(0,H.jsx)(Wg,{}),(0,H.jsx)(Sl,{}),(0,H.jsx)(oC,{})]}):t?(0,H.jsx)(`div`,{className:`h-full grid place-items-center p-8`,children:(0,H.jsxs)(`div`,{className:`max-w-md text-center flex flex-col items-center gap-3`,children:[(0,H.jsx)(Ar,{className:`text-muted-foreground`,size:28}),(0,H.jsx)(`div`,{className:`text-base font-medium`,children:`Can't reach the velloo daemon`}),(0,H.jsxs)(`div`,{className:`text-sm text-muted-foreground`,children:[`The design server isn't answering (`,t,`). Start it with`,` `,(0,H.jsx)(`span`,{className:`font-mono`,children:`velloo run`}),` — the canvas reconnects automatically, or retry now.`]}),(0,H.jsx)(W,{variant:`outline`,onClick:()=>void B.getState().loadDesign(),children:`Retry`})]})}):(0,H.jsx)(`div`,{className:`h-full grid place-items-center`,children:(0,H.jsx)(Qu,{size:44})})}function gC(){let e=B(e=>e.wsConnected),t=B(e=>e.wsEverConnected);return e||!t?null:(0,H.jsxs)(`div`,{role:`status`,className:`shrink-0 flex items-center justify-center gap-2 px-4 py-1.5 text-xs font-medium bg-destructive text-destructive-foreground`,children:[(0,H.jsx)(Ar,{size:13}),`Disconnected from the velloo daemon — designs are view-only until it comes back. Reconnecting…`]})}var _C=document.getElementById(`root`);if(!_C)throw Error(`missing #root`);(0,Mr.createRoot)(_C).render((0,H.jsx)(M.StrictMode,{children:(0,H.jsx)(hC,{})}));export{Nn as $,Mt as $t,nr as A,tn as At,Kn as B,Gt as Bt,lr as C,ln as Ct,ar as D,an as Dt,or as E,on as Et,Zn as F,Xt as Ft,Vn as G,Bt as Gt,Wn as H,Ut as Ht,Xn as I,Yt as It,Rn as J,Lt as Jt,Bn as K,zt as Kt,Yn as L,Jt as Lt,er as M,$t as Mt,$n as N,Qt as Nt,ir as O,rn as Ot,Qn as P,Zt as Pt,Pn as Q,Nt as Qt,Jn as R,qt as Rt,ur as S,un as St,sr as T,sn as Tt,Un as U,Ht as Ut,Gn as V,Wt as Vt,Hn as W,Vt as Wt,In as X,Ft as Xt,Ln as Y,It as Yt,Fn as Z,Pt as Zt,hr as _,hn as _t,Dr as a,Dt as an,Dn as at,fr as b,fn as bt,wr as c,wn as ct,xr as d,xn as dt,jt as en,Mn as et,br as f,bn as ft,gr as g,gn as gt,_r as h,_n as ht,Or as i,N as in,On as it,tr as j,en as jt,rr as k,nn as kt,Cr as l,Cn as lt,vr as m,vn as mt,Ar as n,kt as nn,An as nt,Er as o,Tt as on,En as ot,yr as p,yn as pt,zn as q,Rt as qt,kr as r,Ot as rn,kn as rt,Tr as s,Et as sn,Tn as st,jr as t,At as tn,jn as tt,Sr as u,Sn as ut,mr as v,mn as vt,cr as w,cn as wt,dr as x,dn as xt,pr as y,pn as yt,qn as z,Kt as zt};