@lerret/cli 0.1.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 (38) hide show
  1. package/LICENSE +21 -0
  2. package/dist-studio/.bundle-stamp +34 -0
  3. package/dist-studio/assets/asset-runtime-MFjDKvQD.js +129 -0
  4. package/dist-studio/assets/cli-project-source-9dNA_gVa.js +1 -0
  5. package/dist-studio/assets/dev-harness-BH6a8T7l.js +18 -0
  6. package/dist-studio/assets/hosted-project-source-dVGq_8c6.js +135 -0
  7. package/dist-studio/assets/index-BNmJ8c2t.css +1 -0
  8. package/dist-studio/assets/index-EslqdOhg.js +10 -0
  9. package/dist-studio/assets/leaf-marker-command.png +0 -0
  10. package/dist-studio/assets/leaf-marker-comment-box.png +0 -0
  11. package/dist-studio/assets/leaf-marker-homescreen.png +0 -0
  12. package/dist-studio/assets/leafmarker-icon-dark-128.png +0 -0
  13. package/dist-studio/assets/leafmarker-logo-transparent.png +0 -0
  14. package/dist-studio/assets/leafmarker-logo.png +0 -0
  15. package/dist-studio/assets/lerret-logo.png +0 -0
  16. package/dist-studio/assets/lerret-wordmark.svg +3 -0
  17. package/dist-studio/assets/logo-angular.svg +1 -0
  18. package/dist-studio/assets/logo-claude.svg +7 -0
  19. package/dist-studio/assets/logo-codex.svg +1 -0
  20. package/dist-studio/assets/logo-cursor.svg +1 -0
  21. package/dist-studio/assets/logo-javascript.svg +1 -0
  22. package/dist-studio/assets/logo-react.svg +1 -0
  23. package/dist-studio/assets/logo-svelte.svg +1 -0
  24. package/dist-studio/assets/logo-vue.svg +1 -0
  25. package/dist-studio/assets/open-folder-D5OR7eLb.js +8 -0
  26. package/dist-studio/assets/project-studio-BjNaIuRb.js +795 -0
  27. package/dist-studio/assets/project-studio-CKuMOMsC.css +1 -0
  28. package/dist-studio/assets/superwhisper-logo.png +0 -0
  29. package/dist-studio/index.html +47 -0
  30. package/dist-studio/module-sw.js +275 -0
  31. package/package.json +51 -0
  32. package/src/dev.js +373 -0
  33. package/src/export.js +1386 -0
  34. package/src/fs/node-backend.js +631 -0
  35. package/src/lerret.js +143 -0
  36. package/src/resolve-project.js +178 -0
  37. package/src/vite-plugin-lerret-project.js +986 -0
  38. package/src/watcher.js +214 -0
@@ -0,0 +1,795 @@
1
+ import{i as e,n as t,o as n,r,s as i,t as a}from"./index-EslqdOhg.js";import{_ as o,a as s,c,d as l,g as u,i as d,l as f,m as p,n as m,o as h,p as g,r as _,s as v,t as y,u as b}from"./asset-runtime-MFjDKvQD.js";function x(e,t,n,r){let i;if(n){let r=t&&t.path||``,a=e.path;r&&a.startsWith(r)&&(a=a.slice(r.length)),a=a.replace(/^\/+/,``),i=n.replace(/\/+$/,``)+`/`+a}else i=e.path;return r!=null&&(i+=(i.includes(`?`)?`&`:`?`)+`t=`+encodeURIComponent(String(r))),i}async function S(e,t,n){let r=x(e,t,n.assetBaseUrl,n.reloadToken),i;try{i=await n.importModule(r)}catch(t){return[_(e,h(t,`evaluate`))]}let a=p(i);if(a.length===0)return[_(e,h(Error(`Asset "${e.fileName}" exports no React component. A component asset must \`export default\` a component, or export one or more component-valued named exports as variants.`),`evaluate`))];let o=g(i&&i.meta);return a.map(t=>s(e,t,o))}async function C(e,t,n){let r=x(e,t,n.assetBaseUrl,n.reloadToken),i=r+(r.includes(`?`)?`&raw`:`?raw`),a;try{a=await n.importModule(i)}catch(t){return[_(e,h(t,`load`))]}let o=a&&typeof a==`object`&&`default`in a?a.default:typeof a==`string`?a:``;return[d(e,typeof o==`string`?o:``)]}function w(e,t={}){let n=t.assetBaseUrl,r=t.importModule||(e=>a(()=>import(e),[],import.meta.url)),i=new Set,o=new Map,s=0,c=!1;function l(e){return o.get(e)}return{async loadAsset(t){if(c)return[_(t,h(Error(`asset runtime has been disposed`),`load`))];if(t==null||typeof t.path!=`string`)return[_(t||{kind:`asset`,name:`?`,fileName:`?`,path:`?`,assetKind:`component`,ext:``},h(Error(`loadAsset: expected an AssetNode with a path`),`load`))];let i=l(t.path);return t.assetKind===`markdown`?C(t,e,{assetBaseUrl:n,importModule:r,reloadToken:i}):S(t,e,{assetBaseUrl:n,importModule:r,reloadToken:i})},subscribe(e){return typeof e==`function`&&i.add(e),()=>i.delete(e)},notifyChange(e){if(!c&&!(typeof e!=`string`||e.length===0)){s+=1,o.set(e,s);for(let t of i)try{t(e)}catch(e){console.error(`[vite-runtime] subscribe listener threw:`,e)}}},dispose(){c=!0,i.clear(),o.clear()}}}var T=i(e(),1),E=i(r(),1),D=t();function O({open:e}){return(0,D.jsx)(`svg`,{width:`9`,height:`9`,viewBox:`0 0 11 11`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,"aria-hidden":`true`,style:{opacity:.55,transform:e?`rotate(180deg)`:`none`,transition:`transform 120ms ease`,flex:`none`},children:(0,D.jsx)(`path`,{d:`M2 4l3.5 3.5L9 4`})})}function k(){return(0,D.jsxs)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 12 12`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.4`,strokeLinejoin:`round`,"aria-hidden":`true`,style:{flex:`none`,opacity:.8},children:[(0,D.jsx)(`path`,{d:`M3.5 1.5h3L9 4v6.5h-5.5z`}),(0,D.jsx)(`path`,{d:`M2.5 3.5v6.5H8`})]})}function A({pages:e,current:t,onNavigate:n}){let r=Array.isArray(e)?e:[];return r.length===0?null:r.length===1?(0,D.jsx)(j,{label:r[0].label}):(0,D.jsx)(M,{pages:r,current:t,onNavigate:n})}function j({label:e}){return(0,D.jsxs)(`span`,{"data-tour":`dock-pages`,"data-page-picker":`static`,style:{display:`inline-flex`,alignItems:`center`,gap:7,padding:`8px 12px`,fontFamily:`inherit`,fontSize:13,fontWeight:600,color:`var(--lm-text-secondary, #3a3530)`,whiteSpace:`nowrap`},children:[(0,D.jsx)(`span`,{style:{display:`inline-flex`,color:`var(--lm-text-tertiary, #6e6960)`},children:(0,D.jsx)(k,{})}),(0,D.jsx)(`span`,{children:e})]})}function M({pages:e,current:t,onNavigate:n}){let[r,i]=T.useState(!1),[a,o]=T.useState(0),[s,c]=T.useState(null),l=T.useRef(null),u=T.useRef(null),d=T.useRef(null),f=Math.max(0,e.findIndex(e=>e.id===t)),p=e[f]||e[0],m=T.useCallback(()=>{if(!u.current)return;let e=u.current.getBoundingClientRect();c({left:e.left,bottom:window.innerHeight-e.top})},[]),h=T.useCallback(()=>{o(f),m(),i(!0)},[f,m]),g=T.useCallback((e=!0)=>{i(!1),e&&u.current&&u.current.focus()},[]),_=T.useCallback(r=>{let i=e[r];i&&i.id!==t&&n(i.id),g()},[e,t,n,g]);T.useEffect(()=>{if(!r)return;let e=e=>{let t=l.current&&l.current.contains(e.target),n=d.current&&d.current.contains(e.target);!t&&!n&&i(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[r]),T.useEffect(()=>{if(!r)return;let e=()=>m();return window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[r,m]),T.useEffect(()=>{r&&d.current&&d.current.focus()},[r]),T.useEffect(()=>{if(!r||!d.current)return;let e=d.current.querySelector(`[data-page-active="true"]`);e&&typeof e.scrollIntoView==`function`&&e.scrollIntoView({block:`nearest`})},[r,a]);let v=e=>{(e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`Enter`||e.key===` `)&&(e.preventDefault(),h())},y=T.useCallback(t=>{switch(t.key){case`ArrowDown`:t.preventDefault(),o(t=>(t+1)%e.length);break;case`ArrowUp`:t.preventDefault(),o(t=>(t-1+e.length)%e.length);break;case`Home`:t.preventDefault(),o(0);break;case`End`:t.preventDefault(),o(e.length-1);break;case`Enter`:case` `:t.preventDefault(),_(a);break;case`Escape`:t.preventDefault(),g();break;case`Tab`:g(!1);break;default:break}},[e.length,a,_,g]);T.useEffect(()=>{if(!r)return;let e=d.current;if(e)return e.addEventListener(`keydown`,y),()=>e.removeEventListener(`keydown`,y)},[r,y]);let b=e=>`lerret-page-picker-option-${e}`;return(0,D.jsxs)(`span`,{ref:l,"data-tour":`dock-pages`,"data-page-picker":`dropdown`,style:{position:`relative`,display:`inline-flex`},children:[(0,D.jsxs)(`button`,{ref:u,type:`button`,onClick:()=>r?g():h(),onKeyDown:v,"aria-haspopup":`listbox`,"aria-expanded":r,"aria-label":`Page: ${p.label}. Switch page`,title:`Switch page`,style:{display:`inline-flex`,alignItems:`center`,gap:7,padding:`8px 12px`,borderRadius:8,border:`none`,background:r?`rgba(0,0,0,0.06)`:`transparent`,color:`var(--lm-text-secondary, #3a3530)`,fontFamily:`inherit`,fontSize:13,fontWeight:600,cursor:`pointer`,transition:`background 120ms ease`,whiteSpace:`nowrap`,maxWidth:240},onMouseEnter:e=>{r||(e.currentTarget.style.background=`rgba(0,0,0,0.05)`)},onMouseLeave:e=>{r||(e.currentTarget.style.background=`transparent`)},children:[(0,D.jsx)(`span`,{style:{display:`inline-flex`,color:`var(--lm-text-tertiary, #6e6960)`},children:(0,D.jsx)(k,{})}),(0,D.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`},children:p.label}),(0,D.jsx)(O,{open:r})]}),r&&s&&E.createPortal((0,D.jsxs)(`ul`,{ref:d,id:`lerret-page-picker-listbox`,role:`listbox`,tabIndex:-1,"aria-label":`Pages`,"aria-activedescendant":b(a),style:{position:`fixed`,bottom:s.bottom+8,left:s.left,listStyle:`none`,margin:0,minWidth:200,maxWidth:300,maxHeight:280,overflowY:`auto`,background:`rgba(255,255,255,0.97)`,backdropFilter:`blur(16px) saturate(120%)`,WebkitBackdropFilter:`blur(16px) saturate(120%)`,border:`1px solid rgba(26,23,20,0.10)`,borderRadius:12,padding:6,boxShadow:`0 12px 32px rgba(15,23,42,0.18), 0 1px 3px rgba(15,23,42,0.06)`,zIndex:80,outline:`none`,fontFamily:`-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif`},children:[(0,D.jsx)(`li`,{"aria-hidden":`true`,style:{fontSize:9.5,fontWeight:600,letterSpacing:`0.14em`,textTransform:`uppercase`,color:`var(--lm-text-muted, #9a958c)`,padding:`6px 12px 6px`},children:`Pages`}),e.map((e,n)=>{let r=e.id===t,i=n===a;return(0,D.jsxs)(`li`,{id:b(n),role:`option`,"aria-selected":r,"data-page-active":i,onClick:()=>_(n),onMouseEnter:()=>o(n),style:{display:`flex`,alignItems:`center`,gap:8,padding:`8px 12px`,borderRadius:8,cursor:`pointer`,fontSize:13,fontWeight:r?600:500,color:`var(--lm-text-primary, #1a1714)`,background:i?`var(--lm-accent-light, rgba(184,91,51,0.10))`:`transparent`,boxShadow:i?`inset 0 0 0 1.5px var(--lm-accent, #B85B33)`:`none`},children:[(0,D.jsx)(`span`,{"aria-hidden":`true`,style:{width:12,display:`inline-flex`,justifyContent:`center`,color:`var(--lm-accent, #B85B33)`},children:r?(0,D.jsx)(`svg`,{width:`11`,height:`11`,viewBox:`0 0 11 11`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,D.jsx)(`path`,{d:`M2 5.8L4.4 8.2 9 2.8`})}):null}),(0,D.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.label})]},e.id)})]}),document.body)]})}var N=T.createContext(null);function P(){return T.useContext(N)}var F=T.createContext(null);function I(){return T.useContext(F)}var L=Uint8Array,R=Uint16Array,ee=Int32Array,te=new L([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),ne=new L([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),z=new L([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),B=function(e,t){for(var n=new R(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new ee(n[30]),r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return{b:n,r:i}},V=B(te,2),H=V.b,U=V.r;H[28]=258,U[258]=28;var W=B(ne,0);W.b;for(var re=W.r,ie=new R(32768),G=0;G<32768;++G){var K=(G&43690)>>1|(G&21845)<<1;K=(K&52428)>>2|(K&13107)<<2,K=(K&61680)>>4|(K&3855)<<4,ie[G]=((K&65280)>>8|(K&255)<<8)>>1}for(var ae=(function(e,t,n){for(var r=e.length,i=0,a=new R(t);i<r;++i)e[i]&&++a[e[i]-1];var o=new R(t);for(i=1;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var s;if(n){s=new R(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=o[e[i]-1]++<<u,f=d|(1<<u)-1;d<=f;++d)s[ie[d]>>c]=l}else for(s=new R(r),i=0;i<r;++i)e[i]&&(s[i]=ie[o[e[i]-1]++]>>15-e[i]);return s}),oe=new L(288),G=0;G<144;++G)oe[G]=8;for(var G=144;G<256;++G)oe[G]=9;for(var G=256;G<280;++G)oe[G]=7;for(var G=280;G<288;++G)oe[G]=8;for(var se=new L(32),G=0;G<32;++G)se[G]=5;var ce=ae(oe,9,0),le=ae(se,5,0),ue=function(e){return(e+7)/8|0},de=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new L(e.subarray(t,n))},fe=[`unexpected EOF`,`invalid block type`,`invalid length/literal`,`invalid distance`,`stream finished`,`no stream handler`,,`no callback`,`invalid UTF-8 data`,`extra field too long`,`date not in range 1980-2099`,`filename too long`,`stream finishing`,`invalid zip data`],pe=function(e,t,n){var r=Error(t||fe[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,pe),!n)throw r;return r},me=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},he=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8,e[r+2]|=n>>16},ge=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,a=n.slice();if(!i)return{t:Ce,l:0};if(i==1){var o=new L(n[0].s+1);return o[n[0].s]=1,{t:o,l:1}}n.sort(function(e,t){return e.f-t.f}),n.push({s:-1,f:25001});var s=n[0],c=n[1],l=0,u=1,d=2;for(n[0]={s:-1,f:s.f+c.f,l:s,r:c};u!=i-1;)s=n[n[l].f<n[d].f?l++:d++],c=n[l!=u&&n[l].f<n[d].f?l++:d++],n[u++]={s:-1,f:s.f+c.f,l:s,r:c};for(var f=a[0].s,r=1;r<i;++r)a[r].s>f&&(f=a[r].s);var p=new R(f+1),m=_e(n[u-1],p,0);if(m>t){var r=0,h=0,g=m-t,_=1<<g;for(a.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});r<i;++r){var v=a[r].s;if(p[v]>t)h+=_-(1<<m-p[v]),p[v]=t;else break}for(h>>=g;h>0;){var y=a[r].s;p[y]<t?h-=1<<t-p[y]++-1:++r}for(;r>=0&&h;--r){var b=a[r].s;p[b]==t&&(--p[b],++h)}m=t}return{t:new L(p),l:m}},_e=function(e,t,n){return e.s==-1?Math.max(_e(e.l,t,n+1),_e(e.r,t,n+1)):t[e.s]=n},ve=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new R(++t),r=0,i=e[0],a=1,o=function(e){n[r++]=e},s=1;s<=t;++s)if(e[s]==i&&s!=t)++a;else{if(!i&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(i),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(i);a=1,i=e[s]}return{c:n.subarray(0,r),n:t}},ye=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},be=function(e,t,n){var r=n.length,i=ue(t+2);e[i]=r&255,e[i+1]=r>>8,e[i+2]=e[i]^255,e[i+3]=e[i+1]^255;for(var a=0;a<r;++a)e[i+a+4]=n[a];return(i+4+r)*8},xe=function(e,t,n,r,i,a,o,s,c,l,u){me(t,u++,n),++i[256];for(var d=ge(i,15),f=d.t,p=d.l,m=ge(a,15),h=m.t,g=m.l,_=ve(f),v=_.c,y=_.n,b=ve(h),x=b.c,S=b.n,C=new R(19),w=0;w<v.length;++w)++C[v[w]&31];for(var w=0;w<x.length;++w)++C[x[w]&31];for(var T=ge(C,7),E=T.t,D=T.l,O=19;O>4&&!E[z[O-1]];--O);var k=l+5<<3,A=ye(i,oe)+ye(a,se)+o,j=ye(i,f)+ye(a,h)+o+14+3*O+ye(C,E)+2*C[16]+3*C[17]+7*C[18];if(c>=0&&k<=A&&k<=j)return be(t,u,e.subarray(c,c+l));var M,N,P,F;if(me(t,u,1+(j<A)),u+=2,j<A){M=ae(f,p,0),N=f,P=ae(h,g,0),F=h;var I=ae(E,D,0);me(t,u,y-257),me(t,u+5,S-1),me(t,u+10,O-4),u+=14;for(var w=0;w<O;++w)me(t,u+3*w,E[z[w]]);u+=3*O;for(var L=[v,x],ee=0;ee<2;++ee)for(var B=L[ee],w=0;w<B.length;++w){var V=B[w]&31;me(t,u,I[V]),u+=E[V],V>15&&(me(t,u,B[w]>>5&127),u+=B[w]>>12)}}else M=ce,N=oe,P=le,F=se;for(var w=0;w<s;++w){var H=r[w];if(H>255){var V=H>>18&31;he(t,u,M[V+257]),u+=N[V+257],V>7&&(me(t,u,H>>23&31),u+=te[V]);var U=H&31;he(t,u,P[U]),u+=F[U],U>3&&(he(t,u,H>>5&8191),u+=ne[U])}else he(t,u,M[H]),u+=N[H]}return he(t,u,M[256]),u+N[256]},Se=new ee([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ce=new L(0),we=function(e,t,n,r,i,a){var o=a.z||e.length,s=new L(r+o+5*(1+Math.ceil(o/7e3))+i),c=s.subarray(r,s.length-i),l=a.l,u=(a.r||0)&7;if(t){u&&(c[0]=a.r>>3);for(var d=Se[t-1],f=d>>13,p=d&8191,m=(1<<n)-1,h=a.p||new R(32768),g=a.h||new R(m+1),_=Math.ceil(n/3),v=2*_,y=function(t){return(e[t]^e[t+1]<<_^e[t+2]<<v)&m},b=new ee(25e3),x=new R(288),S=new R(32),C=0,w=0,T=a.i||0,E=0,D=a.w||0,O=0;T+2<o;++T){var k=y(T),A=T&32767,j=g[k];if(h[A]=j,g[k]=A,D<=T){var M=o-T;if((C>7e3||E>24576)&&(M>423||!l)){u=xe(e,c,0,b,x,S,w,E,O,T-O,u),E=C=w=0,O=T;for(var N=0;N<286;++N)x[N]=0;for(var N=0;N<30;++N)S[N]=0}var P=2,F=0,I=p,z=A-j&32767;if(M>2&&k==y(T-z))for(var B=Math.min(f,M)-1,V=Math.min(32767,T),H=Math.min(258,M);z<=V&&--I&&A!=j;){if(e[T+P]==e[T+P-z]){for(var W=0;W<H&&e[T+W]==e[T+W-z];++W);if(W>P){if(P=W,F=z,W>B)break;for(var ie=Math.min(z,W-2),G=0,N=0;N<ie;++N){var K=T-z+N&32767,ae=K-h[K]&32767;ae>G&&(G=ae,j=K)}}}A=j,j=h[A],z+=A-j&32767}if(F){b[E++]=268435456|U[P]<<18|re[F];var oe=U[P]&31,se=re[F]&31;w+=te[oe]+ne[se],++x[257+oe],++S[se],D=T+P,++C}else b[E++]=e[T],++x[e[T]]}}for(T=Math.max(T,D);T<o;++T)b[E++]=e[T],++x[e[T]];u=xe(e,c,l,b,x,S,w,E,O,T-O,u),l||(a.r=u&7|c[u/8|0]<<3,u-=7,a.h=g,a.p=h,a.i=T,a.w=D)}else{for(var T=a.w||0;T<o+l;T+=65535){var ce=T+65535;ce>=o&&(c[u/8|0]=l,ce=o),u=be(c,u+1,e.subarray(T,ce))}a.i=o}return de(s,0,r+ue(u)+i)},Te=(function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(n&1&&-306674912)^n>>>1;e[t]=n}return e})(),Ee=function(){var e=-1;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=Te[n&255^t[r]]^n>>>8;e=n},d:function(){return~e}}},De=function(e,t,n,r,i){if(!i&&(i={l:1},t.dictionary)){var a=t.dictionary.subarray(-32768),o=new L(a.length+e.length);o.set(a),o.set(e,a.length),e=o,i.w=a.length}return we(e,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,r,i)},Oe=function(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n},q=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function ke(e,t){return De(e,t||{},0,0)}var Ae=function(e,t,n,r){for(var i in e){var a=e[i],o=t+i,s=r;Array.isArray(a)&&(s=Oe(r,a[1]),a=a[0]),ArrayBuffer.isView(a)?n[o]=[a,s]:(n[o+=`/`]=[new L(0),s],Ae(a,o,n,r))}},je=typeof TextEncoder<`u`&&new TextEncoder,Me=typeof TextDecoder<`u`&&new TextDecoder;try{Me.decode(Ce,{stream:!0})}catch{}function Ne(e,t){if(t){for(var n=new L(e.length),r=0;r<e.length;++r)n[r]=e.charCodeAt(r);return n}if(je)return je.encode(e);for(var i=e.length,a=new L(e.length+(e.length>>1)),o=0,s=function(e){a[o++]=e},r=0;r<i;++r){if(o+5>a.length){var c=new L(o+8+(i-r<<1));c.set(a),a=c}var l=e.charCodeAt(r);l<128||t?s(l):l<2048?(s(192|l>>6),s(128|l&63)):l>55295&&l<57344?(l=65536+(l&1047552)|e.charCodeAt(++r)&1023,s(240|l>>18),s(128|l>>12&63),s(128|l>>6&63),s(128|l&63)):(s(224|l>>12),s(128|l>>6&63),s(128|l&63))}return de(a,0,o)}var Pe=function(e){var t=0;if(e)for(var n in e){var r=e[n].length;r>65535&&pe(9),t+=r+4}return t},Fe=function(e,t,n,r,i,a,o,s){var c=r.length,l=n.extra,u=s&&s.length,d=Pe(l);q(e,t,o==null?67324752:33639248),t+=4,o!=null&&(e[t++]=20,e[t++]=n.os),e[t]=20,t+=2,e[t++]=n.flag<<1|(a<0&&8),e[t++]=i&&8,e[t++]=n.compression&255,e[t++]=n.compression>>8;var f=new Date(n.mtime==null?Date.now():n.mtime),p=f.getFullYear()-1980;if((p<0||p>119)&&pe(10),q(e,t,p<<25|f.getMonth()+1<<21|f.getDate()<<16|f.getHours()<<11|f.getMinutes()<<5|f.getSeconds()>>1),t+=4,a!=-1&&(q(e,t,n.crc),q(e,t+4,a<0?-a-2:a),q(e,t+8,n.size)),q(e,t+12,c),q(e,t+14,d),t+=16,o!=null&&(q(e,t,u),q(e,t+6,n.attrs),q(e,t+10,o),t+=14),e.set(r,t),t+=c,d)for(var m in l){var h=l[m],g=h.length;q(e,t,+m),q(e,t+2,g),e.set(h,t+4),t+=4+g}return u&&(e.set(s,t),t+=u),t},Ie=function(e,t,n,r,i){q(e,t,101010256),q(e,t+8,n),q(e,t+10,n),q(e,t+12,r),q(e,t+16,i)};function Le(e,t){t||={};var n={},r=[];Ae(e,``,n,t);var i=0,a=0;for(var o in n){var s=n[o],c=s[0],l=s[1],u=l.level==0?0:8,d=Ne(o),f=d.length,p=l.comment,m=p&&Ne(p),h=m&&m.length,g=Pe(l.extra);f>65535&&pe(11);var _=u?ke(c,l):c,v=_.length,y=Ee();y.p(c),r.push(Oe(l,{size:c.length,crc:y.d(),c:_,f:d,m,u:f!=o.length||m&&p.length!=h,o:i,compression:u})),i+=30+f+g+v,a+=76+2*(f+g)+(h||0)+v}for(var b=new L(a+22),x=i,S=a-i,C=0;C<r.length;++C){var d=r[C];Fe(b,d.o,d,d.f,d.u,d.c.length);var w=30+d.f.length+Pe(d.extra);b.set(d.c,d.o+w),Fe(b,i,d,d.f,d.u,d.c.length,d.o,d.m),i+=16+w+(d.m?d.m.length:0)}return Ie(b,i,r.length,S,x),b}function Re(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;let n=document.implementation.createHTMLDocument(),r=n.createElement(`base`),i=n.createElement(`a`);return n.head.appendChild(r),n.body.appendChild(i),t&&(r.href=t),i.href=e,i.href}var ze=(()=>{let e=0,t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)})();function Be(e){let t=[];for(let n=0,r=e.length;n<r;n++)t.push(e[n]);return t}var Ve=null;function He(e={}){return Ve||(e.includeStyleProperties?(Ve=e.includeStyleProperties,Ve):(Ve=Be(window.getComputedStyle(document.documentElement)),Ve))}function Ue(e,t){let n=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return n?parseFloat(n.replace(`px`,``)):0}function We(e){let t=Ue(e,`border-left-width`),n=Ue(e,`border-right-width`);return e.clientWidth+t+n}function Ge(e){let t=Ue(e,`border-top-width`),n=Ue(e,`border-bottom-width`);return e.clientHeight+t+n}function Ke(e,t={}){return{width:t.width||We(e),height:t.height||Ge(e)}}function qe(){let e,t;try{t=process}catch{}let n=t&&t.env?t.env.devicePixelRatio:null;return n&&(e=parseInt(n,10),Number.isNaN(e)&&(e=1)),e||window.devicePixelRatio||1}var J=16384;function Je(e){(e.width>J||e.height>J)&&(e.width>J&&e.height>J?e.width>e.height?(e.height*=J/e.width,e.width=J):(e.width*=J/e.height,e.height=J):e.width>J?(e.height*=J/e.width,e.width=J):(e.width*=J/e.height,e.height=J))}function Ye(e,t={}){return e.toBlob?new Promise(n=>{e.toBlob(n,t.type?t.type:`image/png`,t.quality?t.quality:1)}):new Promise(n=>{let r=window.atob(e.toDataURL(t.type?t.type:void 0,t.quality?t.quality:void 0).split(`,`)[1]),i=r.length,a=new Uint8Array(i);for(let e=0;e<i;e+=1)a[e]=r.charCodeAt(e);n(new Blob([a],{type:t.type?t.type:`image/png`}))})}function Xe(e){return new Promise((t,n)=>{let r=new Image;r.onload=()=>{r.decode().then(()=>{requestAnimationFrame(()=>t(r))})},r.onerror=n,r.crossOrigin=`anonymous`,r.decoding=`async`,r.src=e})}async function Ze(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(e=>`data:image/svg+xml;charset=utf-8,${e}`)}async function Qe(e,t,n){let r=`http://www.w3.org/2000/svg`,i=document.createElementNS(r,`svg`),a=document.createElementNS(r,`foreignObject`);return i.setAttribute(`width`,`${t}`),i.setAttribute(`height`,`${n}`),i.setAttribute(`viewBox`,`0 0 ${t} ${n}`),a.setAttribute(`width`,`100%`),a.setAttribute(`height`,`100%`),a.setAttribute(`x`,`0`),a.setAttribute(`y`,`0`),a.setAttribute(`externalResourcesRequired`,`true`),i.appendChild(a),a.appendChild(e),Ze(i)}var Y=(e,t)=>{if(e instanceof t)return!0;let n=Object.getPrototypeOf(e);return n===null?!1:n.constructor.name===t.name||Y(n,t)};function $e(e){let t=e.getPropertyValue(`content`);return`${e.cssText} content: '${t.replace(/'|"/g,``)}';`}function et(e,t){return He(t).map(t=>`${t}: ${e.getPropertyValue(t)}${e.getPropertyPriority(t)?` !important`:``};`).join(` `)}function tt(e,t,n,r){let i=`.${e}:${t}`,a=n.cssText?$e(n):et(n,r);return document.createTextNode(`${i}{${a}}`)}function nt(e,t,n,r){let i=window.getComputedStyle(e,n),a=i.getPropertyValue(`content`);if(a===``||a===`none`)return;let o=ze();try{t.className=`${t.className} ${o}`}catch{return}let s=document.createElement(`style`);s.appendChild(tt(o,n,i,r)),t.appendChild(s)}function rt(e,t,n){nt(e,t,`:before`,n),nt(e,t,`:after`,n)}var it=`application/font-woff`,at=`image/jpeg`,ot={woff:it,woff2:it,ttf:`application/font-truetype`,eot:`application/vnd.ms-fontobject`,png:`image/png`,jpg:at,jpeg:at,gif:`image/gif`,tiff:`image/tiff`,svg:`image/svg+xml`,webp:`image/webp`};function st(e){let t=/\.([^./]*?)$/g.exec(e);return t?t[1]:``}function ct(e){return ot[st(e).toLowerCase()]||``}function lt(e){return e.split(/,/)[1]}function ut(e){return e.search(/^(data:)/)!==-1}function dt(e,t){return`data:${t};base64,${e}`}async function ft(e,t,n){let r=await fetch(e,t);if(r.status===404)throw Error(`Resource "${r.url}" not found`);let i=await r.blob();return new Promise((e,t)=>{let a=new FileReader;a.onerror=t,a.onloadend=()=>{try{e(n({res:r,result:a.result}))}catch(e){t(e)}},a.readAsDataURL(i)})}var pt={};function mt(e,t,n){let r=e.replace(/\?.*/,``);return n&&(r=e),/ttf|otf|eot|woff2?/i.test(r)&&(r=r.replace(/.*\//,``)),t?`[${t}]${r}`:r}async function ht(e,t,n){let r=mt(e,t,n.includeQueryParams);if(pt[r]!=null)return pt[r];n.cacheBust&&(e+=(/\?/.test(e)?`&`:`?`)+new Date().getTime());let i;try{i=dt(await ft(e,n.fetchRequestInit,({res:e,result:n})=>(t||=e.headers.get(`Content-Type`)||``,lt(n))),t)}catch(t){i=n.imagePlaceholder||``;let r=`Failed to fetch resource: ${e}`;t&&(r=typeof t==`string`?t:t.message),r&&console.warn(r)}return pt[r]=i,i}async function gt(e){let t=e.toDataURL();return t===`data:,`?e.cloneNode(!1):Xe(t)}async function _t(e,t){if(e.currentSrc){let t=document.createElement(`canvas`),n=t.getContext(`2d`);return t.width=e.clientWidth,t.height=e.clientHeight,n?.drawImage(e,0,0,t.width,t.height),Xe(t.toDataURL())}let n=e.poster;return Xe(await ht(n,ct(n),t))}async function vt(e,t){try{if(e?.contentDocument?.body)return await Ot(e.contentDocument.body,t,!0)}catch{}return e.cloneNode(!1)}async function yt(e,t){return Y(e,HTMLCanvasElement)?gt(e):Y(e,HTMLVideoElement)?_t(e,t):Y(e,HTMLIFrameElement)?vt(e,t):e.cloneNode(xt(e))}var bt=e=>e.tagName!=null&&e.tagName.toUpperCase()===`SLOT`,xt=e=>e.tagName!=null&&e.tagName.toUpperCase()===`SVG`;async function St(e,t,n){if(xt(t))return t;let r=[];return r=bt(e)&&e.assignedNodes?Be(e.assignedNodes()):Y(e,HTMLIFrameElement)&&e.contentDocument?.body?Be(e.contentDocument.body.childNodes):Be((e.shadowRoot??e).childNodes),r.length===0||Y(e,HTMLVideoElement)||await r.reduce((e,r)=>e.then(()=>Ot(r,n)).then(e=>{e&&t.appendChild(e)}),Promise.resolve()),t}function Ct(e,t,n){let r=t.style;if(!r)return;let i=window.getComputedStyle(e);i.cssText?(r.cssText=i.cssText,r.transformOrigin=i.transformOrigin):He(n).forEach(n=>{let a=i.getPropertyValue(n);n===`font-size`&&a.endsWith(`px`)&&(a=`${Math.floor(parseFloat(a.substring(0,a.length-2)))-.1}px`),Y(e,HTMLIFrameElement)&&n===`display`&&a===`inline`&&(a=`block`),n===`d`&&t.getAttribute(`d`)&&(a=`path(${t.getAttribute(`d`)})`),r.setProperty(n,a,i.getPropertyPriority(n))})}function wt(e,t){Y(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),Y(e,HTMLInputElement)&&t.setAttribute(`value`,e.value)}function Tt(e,t){if(Y(e,HTMLSelectElement)){let n=t,r=Array.from(n.children).find(t=>e.value===t.getAttribute(`value`));r&&r.setAttribute(`selected`,``)}}function Et(e,t,n){return Y(t,Element)&&(Ct(e,t,n),rt(e,t,n),wt(e,t),Tt(e,t)),t}async function Dt(e,t){let n=e.querySelectorAll?e.querySelectorAll(`use`):[];if(n.length===0)return e;let r={};for(let i=0;i<n.length;i++){let a=n[i].getAttribute(`xlink:href`);if(a){let n=e.querySelector(a),i=document.querySelector(a);!n&&i&&!r[a]&&(r[a]=await Ot(i,t,!0))}}let i=Object.values(r);if(i.length){let t=`http://www.w3.org/1999/xhtml`,n=document.createElementNS(t,`svg`);n.setAttribute(`xmlns`,t),n.style.position=`absolute`,n.style.width=`0`,n.style.height=`0`,n.style.overflow=`hidden`,n.style.display=`none`;let r=document.createElementNS(t,`defs`);n.appendChild(r);for(let e=0;e<i.length;e++)r.appendChild(i[e]);e.appendChild(n)}return e}async function Ot(e,t,n){return!n&&t.filter&&!t.filter(e)?null:Promise.resolve(e).then(e=>yt(e,t)).then(n=>St(e,n,t)).then(n=>Et(e,n,t)).then(e=>Dt(e,t))}var kt=/url\((['"]?)([^'"]+?)\1\)/g,At=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,jt=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function Mt(e){let t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,`\\$1`);return RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,`g`)}function Nt(e){let t=[];return e.replace(kt,(e,n,r)=>(t.push(r),e)),t.filter(e=>!ut(e))}async function Pt(e,t,n,r,i){try{let a=n?Re(t,n):t,o=ct(t),s;return s=i?dt(await i(a),o):await ht(a,o,r),e.replace(Mt(t),`$1${s}$3`)}catch{}return e}function Ft(e,{preferredFontFormat:t}){return t?e.replace(jt,e=>{for(;;){let[n,,r]=At.exec(e)||[];if(!r)return``;if(r===t)return`src: ${n};`}}):e}function It(e){return e.search(kt)!==-1}async function Lt(e,t,n){if(!It(e))return e;let r=Ft(e,n);return Nt(r).reduce((e,r)=>e.then(e=>Pt(e,r,t,n)),Promise.resolve(r))}async function Rt(e,t,n){let r=t.style?.getPropertyValue(e);if(r){let i=await Lt(r,null,n);return t.style.setProperty(e,i,t.style.getPropertyPriority(e)),!0}return!1}async function zt(e,t){await Rt(`background`,e,t)||await Rt(`background-image`,e,t),await Rt(`mask`,e,t)||await Rt(`-webkit-mask`,e,t)||await Rt(`mask-image`,e,t)||await Rt(`-webkit-mask-image`,e,t)}async function Bt(e,t){let n=Y(e,HTMLImageElement);if(!(n&&!ut(e.src))&&!(Y(e,SVGImageElement)&&!ut(e.href.baseVal)))return;let r=n?e.src:e.href.baseVal,i=await ht(r,ct(r),t);await new Promise((r,a)=>{e.onload=r,e.onerror=t.onImageErrorHandler?(...e)=>{try{r(t.onImageErrorHandler(...e))}catch(e){a(e)}}:a;let o=e;o.decode&&=r,o.loading===`lazy`&&(o.loading=`eager`),n?(e.srcset=``,e.src=i):e.href.baseVal=i})}async function Vt(e,t){let n=Be(e.childNodes).map(e=>Ht(e,t));await Promise.all(n).then(()=>e)}async function Ht(e,t){Y(e,Element)&&(await zt(e,t),await Bt(e,t),await Vt(e,t))}function Ut(e,t){let{style:n}=e;t.backgroundColor&&(n.backgroundColor=t.backgroundColor),t.width&&(n.width=`${t.width}px`),t.height&&(n.height=`${t.height}px`);let r=t.style;return r!=null&&Object.keys(r).forEach(e=>{n[e]=r[e]}),e}var Wt={};async function Gt(e){let t=Wt[e];return t??(t={url:e,cssText:await(await fetch(e)).text()},Wt[e]=t,t)}async function Kt(e,t){let n=e.cssText,r=/url\(["']?([^"')]+)["']?\)/g,i=(n.match(/url\([^)]+\)/g)||[]).map(async i=>{let a=i.replace(r,`$1`);return a.startsWith(`https://`)||(a=new URL(a,e.url).href),ft(a,t.fetchRequestInit,({result:e})=>(n=n.replace(i,`url(${e})`),[i,e]))});return Promise.all(i).then(()=>n)}function qt(e){if(e==null)return[];let t=[],n=e.replace(/(\/\*[\s\S]*?\*\/)/gi,``),r=RegExp(`((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})`,`gi`);for(;;){let e=r.exec(n);if(e===null)break;t.push(e[0])}n=n.replace(r,``);let i=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,a=RegExp(`((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})`,`gi`);for(;;){let e=i.exec(n);if(e===null){if(e=a.exec(n),e===null)break;i.lastIndex=a.lastIndex}else a.lastIndex=i.lastIndex;t.push(e[0])}return t}async function Jt(e,t){let n=[],r=[];return e.forEach(n=>{if(`cssRules`in n)try{Be(n.cssRules||[]).forEach((e,i)=>{if(e.type===CSSRule.IMPORT_RULE){let a=i+1,o=e.href,s=Gt(o).then(e=>Kt(e,t)).then(e=>qt(e).forEach(e=>{try{n.insertRule(e,e.startsWith(`@import`)?a+=1:n.cssRules.length)}catch(t){console.error(`Error inserting rule from remote css`,{rule:e,error:t})}})).catch(e=>{console.error(`Error loading remote css`,e.toString())});r.push(s)}})}catch(i){let a=e.find(e=>e.href==null)||document.styleSheets[0];n.href!=null&&r.push(Gt(n.href).then(e=>Kt(e,t)).then(e=>qt(e).forEach(e=>{a.insertRule(e,a.cssRules.length)})).catch(e=>{console.error(`Error loading remote stylesheet`,e)})),console.error(`Error inlining remote css file`,i)}}),Promise.all(r).then(()=>(e.forEach(e=>{if(`cssRules`in e)try{Be(e.cssRules||[]).forEach(e=>{n.push(e)})}catch(t){console.error(`Error while reading CSS rules from ${e.href}`,t)}}),n))}function Yt(e){return e.filter(e=>e.type===CSSRule.FONT_FACE_RULE).filter(e=>It(e.style.getPropertyValue(`src`)))}async function Xt(e,t){if(e.ownerDocument==null)throw Error(`Provided element is not within a Document`);return Yt(await Jt(Be(e.ownerDocument.styleSheets),t))}function Zt(e){return e.trim().replace(/["']/g,``)}function Qt(e){let t=new Set;function n(e){(e.style.fontFamily||getComputedStyle(e).fontFamily).split(`,`).forEach(e=>{t.add(Zt(e))}),Array.from(e.children).forEach(e=>{e instanceof HTMLElement&&n(e)})}return n(e),t}async function $t(e,t){let n=await Xt(e,t),r=Qt(e);return(await Promise.all(n.filter(e=>r.has(Zt(e.style.fontFamily))).map(e=>{let n=e.parentStyleSheet?e.parentStyleSheet.href:null;return Lt(e.cssText,n,t)}))).join(`
2
+ `)}async function en(e,t){let n=t.fontEmbedCSS==null?t.skipFonts?null:await $t(e,t):t.fontEmbedCSS;if(n){let t=document.createElement(`style`),r=document.createTextNode(n);t.appendChild(r),e.firstChild?e.insertBefore(t,e.firstChild):e.appendChild(t)}}var tn=n({getFontEmbedCSS:()=>ln,toBlob:()=>cn,toCanvas:()=>rn,toJpeg:()=>sn,toPixelData:()=>an,toPng:()=>on,toSvg:()=>nn});async function nn(e,t={}){let{width:n,height:r}=Ke(e,t),i=await Ot(e,t,!0);return await en(i,t),await Ht(i,t),Ut(i,t),await Qe(i,n,r)}async function rn(e,t={}){let{width:n,height:r}=Ke(e,t),i=await Xe(await nn(e,t)),a=document.createElement(`canvas`),o=a.getContext(`2d`),s=t.pixelRatio||qe(),c=t.canvasWidth||n,l=t.canvasHeight||r;return a.width=c*s,a.height=l*s,t.skipAutoScale||Je(a),a.style.width=`${c}`,a.style.height=`${l}`,t.backgroundColor&&(o.fillStyle=t.backgroundColor,o.fillRect(0,0,a.width,a.height)),o.drawImage(i,0,0,a.width,a.height),a}async function an(e,t={}){let{width:n,height:r}=Ke(e,t);return(await rn(e,t)).getContext(`2d`).getImageData(0,0,n,r).data}async function on(e,t={}){return(await rn(e,t)).toDataURL()}async function sn(e,t={}){return(await rn(e,t)).toDataURL(`image/jpeg`,t.quality||1)}async function cn(e,t={}){return await Ye(await rn(e,t))}async function ln(e,t={}){return $t(e,t)}var un={png:{mimeType:`image/png`,extension:`.png`},jpg:{mimeType:`image/jpeg`,extension:`.jpg`}},dn={jpeg:`jpg`},fn=Object.keys(un).sort().join(`, `);function pn(e){if(e==null||e===``)return{format:`png`,...un.png};let t=String(e).toLowerCase(),n=dn[t]??t;if(!un[n])throw Error(`captureArtboard: unsupported format "${e}". Supported formats: ${fn}.`);return{format:n,...un[n]}}function mn(e){let t=new Uint8Array(e),n=``,r=32768;for(let e=0;e<t.length;e+=r)n+=String.fromCharCode.apply(null,t.subarray(e,e+r));return btoa(n)}function hn(e){return e.split(`,`).map(e=>e.trim().replace(/^["']|["']$/g,``).trim()).filter(Boolean)}function gn(e){let t=new Set([`IMG`,`VIDEO`,`CANVAS`,`SVG`]),n=new Set,r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode(e){return t.has(e.tagName)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),i=e;for(;i;){let e=window.getComputedStyle(i).getPropertyValue(`font-family`);if(e)for(let t of hn(e))n.add(t);for(let e of[`::before`,`::after`])try{let t=window.getComputedStyle(i,e).getPropertyValue(`font-family`);if(t)for(let e of hn(t))n.add(e)}catch{}i=r.nextNode()}return n}function _n(){let e=new Set;for(let t of document.querySelectorAll(`link[rel="stylesheet"]`))t.href&&t.href.includes(`fonts.googleapis.com`)&&e.add(t.href);for(let t of document.querySelectorAll(`style`)){let n=(t.textContent||``).matchAll(/@import\s+url\(\s*["']?(https:\/\/fonts\.googleapis\.com\/[^"')]+)["']?\s*\)/g);for(let t of n)e.add(t[1])}return[...e]}async function vn(e){let t=await fetch(e,{mode:`cors`});if(!t.ok)throw Error(`Google Fonts CSS fetch failed: ${t.status}`);let n=await t.text(),r=[...new Set(Array.from(n.matchAll(/url\((https:\/\/fonts\.gstatic\.com\/[^)]+)\)/g)).map(e=>e[1]))],i=await Promise.all(r.map(async e=>{try{let t=await fetch(e,{mode:`cors`});return t.ok?[e,`data:font/woff2;base64,${mn(await t.arrayBuffer())}`]:[e,null]}catch{return[e,null]}}));for(let[e,t]of i)t&&(n=n.split(e).join(t));return n}function yn(e,t,n){let r=n===`truetype`?`font/ttf`:n===`opentype`?`font/otf`:`font/${n}`;return`@font-face {\n font-family: '${e.replace(/'/g,`\\'`)}' ;\n src: url('data:${r};base64,${t}') format('${n}');\n font-display: swap;\n}`}async function bn(e,t={}){let{format:n,quality:r=.92,pixelRatio:i=2,backgroundColor:a,fontResolver:o=null}=t,{format:s}=pn(n);if(typeof document<`u`&&document.fonts?.ready)try{await document.fonts.ready}catch{}let c=gn(e),l=[],u=[...c].sort(),d=[];if(o)for(let e of u){let t;try{t=await o(e)}catch(n){console.warn(`captureArtboard: fontResolver threw for "${e}":`,n),t=null}if(!t)continue;let{url:n,format:r}=t;try{let t=await fetch(n);if(!t.ok)throw Error(`HTTP ${t.status}`);let i=mn(await t.arrayBuffer());d.push({family:e,rule:yn(e,i,r||`woff2`)})}catch(t){console.warn(`captureArtboard: failed to embed custom font "${e}":`,t),l.push(e)}}let f=``,p=_n();for(let e of p)try{let t=await vn(e);f+=`
3
+ `+t}catch(t){console.warn(`captureArtboard: Google Fonts CSS fetch failed for ${e}:`,t)}let m=[d.sort((e,t)=>e.family.localeCompare(t.family)).map(e=>e.rule).join(`
4
+
5
+ `),f].filter(Boolean).join(`
6
+
7
+ `),h=e.offsetWidth||e.getBoundingClientRect().width,g=e.offsetHeight||e.getBoundingClientRect().height,_=a===void 0?s===`jpg`?`#ffffff`:void 0:a,v={width:h,height:g,canvasWidth:h,canvasHeight:g,pixelRatio:i,cacheBust:!0,skipAutoScale:!0,fontEmbedCSS:m||void 0,..._===void 0?{}:{backgroundColor:_},style:{transform:`none`,transformOrigin:`top left`,margin:`0`,width:h+`px`,height:g+`px`}},y;return y=s===`png`?await cn(e,v):xn(await sn(e,{...v,quality:r})),{blob:y,unembeddedFonts:l}}function xn(e){let[t,n]=e.split(`,`),r=t.match(/:(.*?);/)[1],i=atob(n),a=new Uint8Array(i.length);for(let e=0;e<i.length;e++)a[e]=i.charCodeAt(e);return new Blob([a],{type:r})}function Sn(e,t){let n=e.asset.name,r=e.variantName;return r?`${n}-${r}${t}`:`${n}${t}`}function Cn(e,t){return e.length>0?`${e.join(`/`)}/${t}`:t}async function wn(e,t){let n=Array(e.length),r=0;async function i(){for(;r<e.length;){let t=r++;n[t]=await e[t]()}}let a=[];for(let n=0;n<Math.min(t,e.length);n++)a.push(i());return await Promise.all(a),n}async function Tn(e){let t=await e.arrayBuffer();return new Uint8Array(t)}function En(e){let t=new Map;for(let n of e)t.set(n,(t.get(n)??0)+1);return t}async function Dn(e,t={}){let{format:n,flat:r=!1}=t,{extension:i}=pn(n);if(!e||e.length===0)return{blob:null,skipped:[],unembeddedFonts:[]};let a=[],o=[];for(let t of e)t.artboard.skipReason?o.push({artboard:t.artboard,reason:t.artboard.skipReason}):a.push(t);let s=a.map(e=>Sn(e.artboard,i)),c;if(r){let e=En(s);c=a.map((t,n)=>{let r=s[n];if(e.get(r)>1){let{locationSegments:e}=t.artboard,n=e.length>0?e.join(`-`):null;return n?`${n}-${r}`:r}return r})}else c=a.map((e,t)=>{let{locationSegments:n}=e.artboard;return Cn(n,s[t])});let l=[],u=await wn(a.map((e,t)=>async()=>{try{let r=await bn(e.element,{format:n});return{ok:!0,index:t,blob:r.blob,unembeddedFonts:r.unembeddedFonts}}catch(n){return{ok:!1,index:t,artboard:e.artboard,reason:n instanceof Error?n.message:String(n)}}}),4),d=[],f=new Set;for(let e of u){if(e.ok){let t=await Tn(e.blob);d.push({entryPath:c[e.index],bytes:t});for(let t of e.unembeddedFonts)f.add(t)}else o.push({artboard:e.artboard,reason:e.reason});l.push(e)}if(d.length===0)return{blob:null,skipped:o,unembeddedFonts:[...f]};let p={};for(let{entryPath:e,bytes:t}of d)p[e]=t;let m=Le(p);return{blob:new Blob([m],{type:`application/zip`}),skipped:o,unembeddedFonts:[...f]}}function On(e){return(e||`export`).toString().replace(/[\\/:*?"<>|\x00-\x1F]+/g,``).replace(/\s+/g,` `).trim().slice(0,120)||`export`}function kn(e,t){if(t.kind===`project`)return`${On(e.name||`project`)}.zip`;let n=t.path;if(!n)return`export.zip`;for(let t of e.pages||[]){if(t.path===n)return`${On(t.name)}.zip`;let e=An(t.groups||[],n);if(e!==null)return`${On(e)}.zip`}let r=n.split(`/`);return`${On(r[r.length-1]||`export`)}.zip`}function An(e,t){for(let n of e){if(n.path===t)return n.name;let e=An(n.groups||[],t);if(e!==null)return e}return null}function jn(e,t){return t.kind===`project`?null:t.path??null}function Mn(e){return typeof CSS<`u`&&typeof CSS.escape==`function`?CSS.escape(e):String(e).replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}function Nn(e){if(typeof document>`u`)return null;let t=e.path;return document.querySelector(`[data-asset-id="${Mn(t)}"]`)||document.querySelector(`[data-dc-slot="${Mn(t)}"]`)||null}async function Pn({project:e,scope:t,format:n=`png`,flat:r=!1,onProgress:i}){let a=kn(e,t),o;try{o=c(e,jn(e,t))}catch(e){return console.warn(`[lerret/bulk-export] collectArtboards failed:`,e),{blob:null,filename:a,skipped:[],unembeddedFonts:[]}}if(o.length===0)return{blob:null,filename:a,skipped:[],unembeddedFonts:[]};let s=[],l=[];for(let e of o){let t=Nn(e.asset);t?s.push({artboard:e,element:t}):l.push({artboard:e,reason:`DOM element not found for artboard "${e.asset.name}" (it may be on a different page)`})}let u=o.length;if(i?.(0,u,``),s.length===0)return i?.(u,u,`done`),{blob:null,filename:a,skipped:l,unembeddedFonts:[]};let d;try{d=await Dn(s,{format:n,flat:r})}catch(e){return console.warn(`[lerret/bulk-export] buildArchive failed:`,e),i?.(u,u,`done`),{blob:null,filename:a,skipped:l,unembeddedFonts:[]}}i?.(u,u,`done`);let f=[...l,...d.skipped||[]];return{blob:d.blob,filename:a,skipped:f,unembeddedFonts:d.unembeddedFonts||[]}}function Fn(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,r.click(),setTimeout(()=>URL.revokeObjectURL(n),1e4)}var In=[{target:`[data-tour="canvas"]`,title:`Welcome to your Lerret studio.`,body:`Your designs live as plain files — React components, Markdown docs, images — in a folder on your machine. Lerret reads that folder and renders it here as a live canvas.`},{target:`[data-tour="canvas"]`,title:`Folders become pages, files become artboards.`,body:`Each sub-folder inside your .lerret/ directory is a page. Nested folders inside a page become groups. Every .jsx/.tsx/.md file inside a group becomes an artboard on that page. No config required.`},{target:`[data-tour="dock-pages"]`,title:`Switch between pages here.`,body:`The page picker in the dock shows your current page. With more than one page, click or use arrow keys to switch. With a single page it shows a static label.`,singlePageBody:`Your project has one page — its name appears here as a static label. Add more sub-folders to your .lerret/ directory and they become additional pages.`},{target:`[data-tour="section"]`,title:`Each file is an artboard.`,body:`A .jsx or .tsx component file becomes a sized artboard rendered with its live data. A .md file becomes an auto-height document card. Both update in real time when you save the file.`},{target:`.lm-artboard-kebab`,title:`The ⋮ menu surfaces lifecycle actions.`,body:`Hover (or focus) an artboard to reveal its kebab menu. From there: edit data, edit meta, duplicate, rename, delete, export as PNG, or reveal the file in your editor.`},{target:`[data-tour="canvas"]`,title:`Component code lives in your editor — data lives here.`,body:`Edit .jsx/.tsx source in your code editor or AI tool; Lerret hot-reloads it automatically. For data (.data.json), config (config.json), meta (the meta export), and Markdown content, use the in-studio forms via the kebab menu — no file editing needed.`},{target:`[data-tour="dock-export"]`,title:`Export the whole project as a ZIP.`,body:`Click "Export ZIP" to download every artboard across all pages in one structured archive. Use the ↓ PNG / ↓ JPG buttons to export only the current canvas view. The kebab menu Export item targets a single artboard.`},{target:null,title:`You're all set.`,isDone:!0}],Ln=`lerret:walkthrough:completedAt`,Rn=`lerret:walkthrough:skippedAt`;function zn(){try{let e=localStorage.getItem(Ln),t=localStorage.getItem(Rn);return e===null&&t===null}catch{return!0}}function Bn(){try{localStorage.setItem(Ln,new Date().toISOString())}catch{}}function Vn(){try{localStorage.setItem(Rn,new Date().toISOString())}catch{}}function Hn(){let e=typeof window<`u`&&window.matchMedia?window.matchMedia(`(prefers-reduced-motion: reduce)`):null,[t,n]=T.useState(()=>e?e.matches:!1);return T.useEffect(()=>{if(!e)return;let t=e=>n(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),t}var Un=[`a[href]`,`button:not([disabled])`,`input:not([disabled])`,`textarea:not([disabled])`,`select:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`,`);function Wn(e){return e?Array.from(e.querySelectorAll(Un)).filter(e=>!e.closest(`[hidden]`)):[]}var Gn={border:`none`,background:`transparent`,color:`var(--lm-text-secondary, #3A3530)`,fontSize:13,fontWeight:500,padding:`7px 12px`,borderRadius:6,cursor:`pointer`,fontFamily:`inherit`},Kn={border:`none`,background:`var(--lm-accent, #B85B33)`,color:`var(--lm-surface, #FAF8F2)`,fontSize:13,fontWeight:600,padding:`8px 16px`,borderRadius:6,cursor:`pointer`,fontFamily:`inherit`};function qn({step:e,stepIdx:t,total:n,isFirst:r,isLast:i,captionPos:a,prefersReducedMotion:o,onBack:s,onNext:c,onSkip:l}){let u=T.useRef(null);T.useEffect(()=>{if(!u.current)return;let e=Wn(u.current);e.length>0&&e[0].focus()},[t]);let d=e=>{if(e.key!==`Tab`)return;let t=Wn(u.current);if(t.length===0)return;let n=t[0],r=t[t.length-1];e.shiftKey?document.activeElement===n&&(e.preventDefault(),r.focus()):document.activeElement===r&&(e.preventDefault(),n.focus())},f=document.querySelector(`[data-page-picker="static"]`)&&e.singlePageBody?e.singlePageBody:e.body;return(0,D.jsxs)(`div`,{ref:u,role:`dialog`,"aria-modal":`true`,"aria-label":`Walkthrough step ${t+1} of ${n}: ${e.title}`,tabIndex:-1,style:{position:`absolute`,...a,width:320,background:`var(--lm-surface, #FAF8F2)`,border:`1px solid rgba(26,23,20,0.10)`,borderRadius:12,padding:`18px 20px 16px`,boxShadow:`0 18px 48px rgba(15,23,42,0.30)`,color:`var(--lm-text-primary, #1A1714)`,pointerEvents:`auto`,transition:o?`none`:void 0,outline:`none`},onClick:e=>e.stopPropagation(),onKeyDown:d,children:[(0,D.jsxs)(`div`,{style:{fontSize:10,fontWeight:600,letterSpacing:`0.14em`,textTransform:`uppercase`,color:`var(--lm-accent-muted, #92421E)`,marginBottom:10},children:[`Step `,t+1,` of `,n]}),(0,D.jsx)(`div`,{style:{fontFamily:`"Instrument Serif", Georgia, serif`,fontSize:22,lineHeight:1.15,letterSpacing:`-0.01em`,color:`var(--lm-text-primary, #1A1714)`,marginBottom:8},children:e.title}),f&&(0,D.jsx)(`div`,{style:{fontSize:13.5,lineHeight:1.5,color:`var(--lm-text-secondary, #3A3530)`},children:f}),(0,D.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginTop:16},children:[(0,D.jsx)(`button`,{type:`button`,onClick:l,style:{...Gn,marginRight:`auto`},children:`Skip`}),!r&&(0,D.jsx)(`button`,{type:`button`,onClick:s,style:Gn,children:`← Back`}),(0,D.jsx)(`button`,{type:`button`,onClick:c,style:Kn,"data-testid":`walkthrough-next`,children:i?`Done`:`Next →`})]})]})}function Jn({stepIdx:e,total:t,onBack:n,onClose:r,prefersReducedMotion:i}){let a=T.useRef(null);return T.useEffect(()=>{if(!a.current)return;let e=Wn(a.current);e.length>0&&e[0].focus()},[]),(0,D.jsxs)(`div`,{ref:a,role:`dialog`,"aria-modal":`true`,"aria-label":`Walkthrough complete`,tabIndex:-1,style:{position:`absolute`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,width:420,background:`var(--lm-surface, #FAF8F2)`,border:`1px solid rgba(26,23,20,0.10)`,borderRadius:16,padding:`28px 28px 24px`,boxShadow:`0 30px 80px rgba(15,23,42,0.40)`,color:`var(--lm-text-primary, #1A1714)`,pointerEvents:`auto`,outline:`none`,transition:i?`none`:void 0},onClick:e=>e.stopPropagation(),onKeyDown:e=>{if(e.key!==`Tab`)return;let t=Wn(a.current);if(!t.length)return;let n=t[0],r=t[t.length-1];e.shiftKey?document.activeElement===n&&(e.preventDefault(),r.focus()):document.activeElement===r&&(e.preventDefault(),n.focus())},children:[(0,D.jsxs)(`div`,{style:{fontSize:10,fontWeight:600,letterSpacing:`0.14em`,textTransform:`uppercase`,color:`var(--lm-accent-muted, #92421E)`,marginBottom:14},children:[`Done · Step `,e+1,` of `,t]}),(0,D.jsx)(`div`,{style:{fontFamily:`"Instrument Serif", Georgia, serif`,fontSize:30,lineHeight:1.1,letterSpacing:`-0.02em`,color:`var(--lm-text-primary, #1A1714)`,marginBottom:14},children:`You’re all set.`}),(0,D.jsx)(`div`,{style:{fontSize:14,lineHeight:1.55,color:`var(--lm-text-secondary, #3A3530)`,marginBottom:22},children:`Edit files in your code editor or with an AI tool — Lerret renders changes in real time. For data, config, meta, and Markdown, use the kebab menu forms inside the studio. Export single artboards or the whole project as a ZIP from the dock.`}),(0,D.jsxs)(`div`,{style:{background:`rgba(184,91,51,0.07)`,border:`1px solid rgba(184,91,51,0.18)`,borderRadius:8,padding:`10px 14px`,fontSize:13,color:`var(--lm-text-secondary, #3A3530)`,marginBottom:22},children:[`Read the docs at`,` `,(0,D.jsx)(`a`,{href:`https://lerret.belikely.com/docs`,target:`_blank`,rel:`noopener noreferrer`,style:{color:`var(--lm-accent, #B85B33)`,fontWeight:600,textDecoration:`none`},children:`lerret.belikely.com/docs`})]}),(0,D.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,D.jsx)(`button`,{type:`button`,onClick:n,style:{...Gn,marginRight:`auto`},children:`← Back`}),(0,D.jsx)(`button`,{type:`button`,onClick:r,style:Kn,"data-testid":`walkthrough-done`,children:`Got it`})]})]})}function Yn({onClose:e}){let[t,n]=T.useState(0),[r,i]=T.useState(null),a=Hn(),o=T.useRef(typeof document<`u`?document.activeElement:null),s=In,c=s[t],l=s.length,u=t===l-1,d=t===0,f=()=>{let e=o.current;if(e&&typeof e.focus==`function`)try{e.focus()}catch{}},p=()=>{Vn(),f(),e()},m=()=>{Bn(),f(),e()},h=()=>{u?m():n(e=>e+1)};T.useEffect(()=>{if(!c.target){i(null);return}let e=()=>{let e=document.querySelector(c.target);if(!e){i(null);return}let t=e.getBoundingClientRect();i({top:t.top,left:t.left,width:t.width,height:t.height}),(t.top<0||t.bottom>window.innerHeight||t.left<0||t.right>window.innerWidth)&&e.scrollIntoView({behavior:a?`auto`:`smooth`,block:`center`,inline:`center`})};e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0);let t=setTimeout(e,300);return()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0),clearTimeout(t)}},[c.target,t,a]),T.useEffect(()=>{let e=e=>{if(e.key===`Escape`){p();return}e.key===`ArrowRight`&&(e.preventDefault(),u?m():n(e=>e+1)),e.key===`ArrowLeft`&&!d&&(e.preventDefault(),n(e=>e-1))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[u,d]);let g=(()=>{if(!r)return{top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`};let e=typeof window<`u`?window.innerWidth:1440,t=typeof window<`u`?window.innerHeight:900;if(r.top+r.height+16+200<t){let t=Math.max(16,Math.min(e-320-16,r.left+r.width/2-320/2));return{top:r.top+r.height+16,left:t}}if(r.top-200-16>0){let t=Math.max(16,Math.min(e-320-16,r.left+r.width/2-320/2));return{top:r.top-200-16,left:t}}return r.left+r.width+16+320<e?{top:Math.max(16,Math.min(t-200-16,r.top+r.height/2-200/2)),left:r.left+r.width+16}:{top:Math.max(16,Math.min(t-200-16,r.top+r.height/2-200/2)),left:Math.max(16,r.left-320-16)}})(),_=`rgba(24,20,16,0.55)`,v=e=>({...e,transition:a?`none`:void 0});return E.createPortal((0,D.jsxs)(`div`,{"data-testid":`walkthrough-overlay`,style:{position:`fixed`,inset:0,zIndex:200,pointerEvents:`none`,fontFamily:`-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif`},children:[r?(0,D.jsxs)(T.Fragment,{children:[(0,D.jsx)(`div`,{style:v({position:`absolute`,top:0,left:0,right:0,height:Math.max(0,r.top-6),background:_,pointerEvents:`auto`}),onClick:h}),(0,D.jsx)(`div`,{style:v({position:`absolute`,top:r.top+r.height+6,left:0,right:0,bottom:0,background:_,pointerEvents:`auto`}),onClick:h}),(0,D.jsx)(`div`,{style:v({position:`absolute`,top:r.top-6,left:0,width:Math.max(0,r.left-6),height:r.height+12,background:_,pointerEvents:`auto`}),onClick:h}),(0,D.jsx)(`div`,{style:v({position:`absolute`,top:r.top-6,left:r.left+r.width+6,right:0,height:r.height+12,background:_,pointerEvents:`auto`}),onClick:h}),(0,D.jsx)(`div`,{style:{position:`absolute`,top:r.top-6,left:r.left-6,width:r.width+12,height:r.height+12,border:`2px dashed var(--lm-accent, #B85B33)`,borderRadius:10,pointerEvents:`none`,boxShadow:`0 0 0 1px rgba(184,91,51,0.10), 0 0 24px rgba(184,91,51,0.32)`,transition:a?`none`:`top 120ms ease, left 120ms ease, width 120ms ease, height 120ms ease`}})]}):(0,D.jsx)(`div`,{style:{position:`absolute`,inset:0,background:_,pointerEvents:`auto`},onClick:h}),c.isDone?(0,D.jsx)(Jn,{stepIdx:t,total:l,onBack:()=>n(e=>e-1),onClose:m,prefersReducedMotion:a}):(0,D.jsx)(qn,{step:c,stepIdx:t,total:l,isFirst:d,isLast:u,captionPos:g,prefersReducedMotion:a,onBack:()=>n(e=>e-1),onNext:h,onSkip:p})]}),document.body)}function Xn({onAccept:e,onDecline:t}){let n=T.useRef(null);return T.useEffect(()=>{let e=e=>{e.key===`Escape`&&t()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[t]),T.useEffect(()=>{let e=n.current?.querySelector(`[data-testid="offer-yes"]`);e&&e.focus()},[]),(0,D.jsxs)(`div`,{ref:n,role:`dialog`,"aria-label":`Take the tour?`,"data-testid":`walkthrough-offer`,style:{position:`fixed`,bottom:80,left:`50%`,transform:`translateX(-50%)`,zIndex:100,background:`var(--lm-surface, rgba(255,255,255,0.95))`,backdropFilter:`blur(14px) saturate(120%)`,WebkitBackdropFilter:`blur(14px) saturate(120%)`,border:`1px solid rgba(26,23,20,0.12)`,borderRadius:12,padding:`12px 16px`,boxShadow:`0 8px 24px rgba(15,23,42,0.14)`,display:`flex`,alignItems:`center`,gap:12,fontFamily:`-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif`,whiteSpace:`nowrap`},children:[(0,D.jsx)(`span`,{style:{fontSize:13,color:`var(--lm-text-secondary, #3A3530)`},children:`First time here? Take the quick tour.`}),(0,D.jsx)(`button`,{type:`button`,"data-testid":`offer-yes`,onClick:e,style:Kn,children:`Yes, show me`}),(0,D.jsx)(`button`,{type:`button`,"data-testid":`offer-no`,onClick:t,style:Gn,children:`No thanks`})]})}function Zn(e){let t=()=>typeof location>`u`?e:location.hash.replace(/^#/,``)||e,[n,r]=T.useState(t);return T.useEffect(()=>{let e=()=>r(t());return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[]),[n,e=>{location.hash=`#`+e}]}function Qn({label:e}){return(0,D.jsxs)(`div`,{style:{width:`100vw`,height:`100vh`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexDirection:`column`,gap:14,background:`#f0eee9`,fontFamily:`-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif`,color:`#2a251f`},children:[(0,D.jsx)(`div`,{style:{fontSize:11,fontWeight:600,letterSpacing:`0.18em`,textTransform:`uppercase`,color:`#9a958c`},children:`Coming soon`}),(0,D.jsx)(`div`,{style:{fontSize:40,fontWeight:600,letterSpacing:-.8},children:e}),(0,D.jsx)(`div`,{style:{fontSize:14,color:`#6e6960`,maxWidth:`44ch`,textAlign:`center`,lineHeight:1.5},children:`This page hasn’t been built yet. Check back soon, or open an issue if you’d like to help shape it.`})]})}function $n(){return(0,D.jsx)(`div`,{style:{width:1,height:24,background:`rgba(60,50,40,0.14)`,alignSelf:`center`}})}function er({label:e,icon:t,onClick:n,active:r=!1,disabled:i=!1,badge:a,title:o}){return(0,D.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>!i&&n&&n(),title:o||e,style:{display:`inline-flex`,alignItems:`center`,gap:7,padding:`8px 12px`,borderRadius:8,border:`none`,background:r?`#2a251f`:`transparent`,color:r?`#fff`:i?`#9a958c`:`#3a3530`,fontFamily:`inherit`,fontSize:13,fontWeight:r?600:500,cursor:i?`not-allowed`:`pointer`,transition:`background .12s, color .12s`,whiteSpace:`nowrap`},onMouseEnter:e=>{!r&&!i&&(e.currentTarget.style.background=`rgba(0,0,0,0.05)`)},onMouseLeave:e=>{!r&&!i&&(e.currentTarget.style.background=`transparent`)},children:[t&&(0,D.jsx)(`span`,{style:{display:`inline-flex`,fontSize:12},children:t}),(0,D.jsx)(`span`,{children:e}),a&&(0,D.jsx)(`span`,{style:{fontSize:9,fontWeight:600,letterSpacing:`0.06em`,textTransform:`uppercase`,color:`#9a958c`,background:`rgba(60,50,40,0.08)`,padding:`3px 7px`,borderRadius:999,marginLeft:2},children:a})]})}function tr({onDownloadLogo:e}){return(0,D.jsxs)(`div`,{style:{position:`absolute`,bottom:`calc(100% + 8px)`,left:0,minWidth:220,background:`rgba(255,255,255,0.97)`,backdropFilter:`blur(16px) saturate(120%)`,WebkitBackdropFilter:`blur(16px) saturate(120%)`,border:`1px solid rgba(26,23,20,0.10)`,borderRadius:12,padding:6,boxShadow:`0 12px 32px rgba(15,23,42,0.18), 0 1px 3px rgba(15,23,42,0.06)`,display:`flex`,flexDirection:`column`,gap:2,zIndex:70,fontFamily:`-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif`},children:[(0,D.jsx)(`div`,{style:{fontSize:9.5,fontWeight:600,letterSpacing:`0.14em`,textTransform:`uppercase`,color:`#9a958c`,padding:`8px 14px 4px`},children:`Brand kit`}),((e,t,n)=>(0,D.jsxs)(`button`,{type:`button`,onClick:n,style:{display:`flex`,flexDirection:`column`,alignItems:`flex-start`,width:`100%`,textAlign:`left`,padding:`10px 14px`,border:`none`,borderRadius:8,background:`transparent`,cursor:`pointer`,fontFamily:`inherit`,transition:`background .12s`},onMouseEnter:e=>e.currentTarget.style.background=`rgba(0,0,0,0.05)`,onMouseLeave:e=>e.currentTarget.style.background=`transparent`,children:[(0,D.jsx)(`span`,{style:{fontSize:13,fontWeight:600,color:`#1A1714`},children:e}),t&&(0,D.jsx)(`span`,{style:{fontSize:11,color:`#6E6960`,marginTop:2},children:t})]}))(`Lerret logo`,`PNG · 256 × 256`,e)]})}function nr({pages:e,current:t,onNavigate:n,onHelp:r}){let i=P(),a=I(),[o,s]=T.useState(null),[c,l]=T.useState(null),[u,d]=T.useState(!1),[f,p]=T.useState(null),[m,h]=T.useState(null),[g,_]=T.useState(!1),v=T.useRef(null);T.useEffect(()=>{if(!g)return;let e=e=>{v.current&&!v.current.contains(e.target)&&_(!1)},t=e=>{e.key===`Escape`&&_(!1)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[g]);let y=async e=>{if(o||typeof window.dcDownloadSlots!=`function`)return;let t=Array.from(document.querySelectorAll(`[data-dc-slot]`));if(t.length){s(e),l({i:0,total:t.length});try{await window.dcDownloadSlots(t,e,e=>l(e))}finally{s(null),l(null)}}},b=T.useCallback(async(e=`png`,t=!1)=>{if(!a||u)return;d(!0),h(null),p(`0/…`);let n=await Pn({project:a,scope:{kind:`project`},format:e,flat:t,onProgress:(e,t)=>{p(e===t?null:`${e}/${t}…`)}});if(d(!1),p(null),!n.blob){h(`Nothing to export.`);return}Fn(n.blob,n.filename);let r=[];if(n.skipped.length>0){let e=n.skipped.map(e=>e.artboard?.asset?.name||`?`).join(`, `);r.push(`Skipped: ${e}`)}n.unembeddedFonts.length>0&&r.push(`Fonts not embedded: ${n.unembeddedFonts.join(`, `)}`),h(r.length>0?r.join(` · `):null)},[a,u]),x=e=>o===e&&c?`${c.i}/${c.total}…`:e.toUpperCase(),S=(e,t)=>{let n=document.createElement(`a`);n.href=e,n.download=t,n.click()};return(0,D.jsxs)(`div`,{"data-tour":`dock`,style:{position:`fixed`,bottom:18,left:`50%`,transform:`translateX(-50%)`,zIndex:60,background:`rgba(255,255,255,0.88)`,backdropFilter:`blur(16px) saturate(120%)`,WebkitBackdropFilter:`blur(16px) saturate(120%)`,borderRadius:999,padding:`6px 10px`,boxShadow:`0 4px 18px rgba(15,23,42,0.10), 0 1px 3px rgba(15,23,42,0.06)`,display:`flex`,alignItems:`center`,gap:4,fontFamily:`-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif`,maxWidth:`calc(100vw - 32px)`,overflow:`auto`},children:[(0,D.jsxs)(`span`,{ref:v,"data-tour":`dock-brand`,style:{position:`relative`,display:`inline-flex`},children:[(0,D.jsxs)(`button`,{type:`button`,onClick:()=>_(e=>!e),style:{display:`inline-flex`,alignItems:`center`,gap:8,padding:`6px 10px`,borderRadius:999,border:`none`,background:g?`rgba(0,0,0,0.06)`:`transparent`,color:`#1A1714`,cursor:`pointer`,fontFamily:`inherit`,transition:`background .12s`},onMouseEnter:e=>{g||(e.currentTarget.style.background=`rgba(0,0,0,0.05)`)},onMouseLeave:e=>{g||(e.currentTarget.style.background=`transparent`)},title:`Brand`,"aria-expanded":g,children:[(0,D.jsx)(`img`,{src:`/assets/lerret-logo.png`,alt:``,width:`22`,height:`22`,style:{display:`block`,borderRadius:4,objectFit:`cover`}}),(0,D.jsx)(`span`,{style:{fontFamily:`"Instrument Serif", Georgia, "Times New Roman", serif`,fontSize:19,lineHeight:1,letterSpacing:`-0.015em`},children:`Lerret`}),(0,D.jsx)(`svg`,{width:`9`,height:`9`,viewBox:`0 0 11 11`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,style:{opacity:.55,transform:g?`rotate(180deg)`:`none`,transition:`transform .15s`},children:(0,D.jsx)(`path`,{d:`M2 4l3.5 3.5L9 4`})})]}),g&&(0,D.jsx)(tr,{onDownloadLogo:()=>{S(`/assets/lerret-logo.png`,`lerret-logo.png`),_(!1)}})]}),(0,D.jsx)($n,{}),i?(0,D.jsx)(A,{pages:i.pages,current:i.current,onNavigate:i.onNavigate}):(0,D.jsx)(`span`,{"data-tour":`dock-pages`,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:Object.entries(e).filter(([,e])=>!e.hidden).map(([e,r])=>(0,D.jsx)(er,{label:r.label,active:e===t,disabled:!!r.comingSoon,badge:r.comingSoon?`Soon`:null,onClick:()=>n(e),title:r.comingSoon?`Coming soon`:r.label},e))}),(0,D.jsx)($n,{}),(0,D.jsxs)(`span`,{"data-tour":`dock-download`,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,D.jsx)(er,{label:x(`png`),icon:`↓`,active:o===`png`,disabled:!!o&&o!==`png`,onClick:()=>y(`png`),title:`Download every artboard as PNG`}),(0,D.jsx)(er,{label:x(`jpg`),icon:`↓`,active:o===`jpg`,disabled:!!o&&o!==`jpg`,onClick:()=>y(`jpg`),title:`Download every artboard as JPG`})]}),a&&(0,D.jsxs)(T.Fragment,{children:[(0,D.jsx)($n,{}),(0,D.jsxs)(`span`,{"data-tour":`dock-export`,style:{position:`relative`,display:`inline-flex`,flexDirection:`column`,alignItems:`center`},children:[(0,D.jsx)(er,{label:f===null?`Export ZIP`:f,icon:(0,D.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 12 12`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,D.jsx)(`path`,{d:`M6 1v7M3 5.5l3 3 3-3M2 10h8`})}),active:u,disabled:u,onClick:()=>b(`png`,!1),title:u?`Export in progress…`:`Export project as ZIP (PNG, structured)`}),m&&(0,D.jsxs)(`div`,{style:{position:`absolute`,bottom:`calc(100% + 6px)`,left:`50%`,transform:`translateX(-50%)`,whiteSpace:`nowrap`,background:`rgba(255,255,255,0.96)`,backdropFilter:`blur(10px)`,border:`1px solid rgba(26,23,20,0.10)`,borderRadius:8,padding:`6px 10px`,fontSize:11,color:`#6E6960`,boxShadow:`0 4px 12px rgba(15,23,42,0.10)`,maxWidth:320,lineHeight:1.4},children:[m,(0,D.jsx)(`button`,{type:`button`,onClick:()=>h(null),style:{marginLeft:6,background:`none`,border:`none`,cursor:`pointer`,color:`#9a958c`,fontSize:11,padding:0,fontFamily:`inherit`},title:`Dismiss`,children:`✕`})]})]})]}),(0,D.jsx)($n,{}),(0,D.jsx)(er,{label:`?`,onClick:()=>r&&r(),title:`Take a tour`})]})}function rr({pages:e,defaultPage:t}){let n=t||Object.keys(e)[0],[r,i]=Zn(n),[a,o]=T.useState(!1),[s,c]=T.useState(!1),l=e[r]?r:n,u=e[l];return T.useEffect(()=>{zn()&&c(!0)},[]),(0,D.jsxs)(T.Fragment,{children:[(0,D.jsx)(nr,{pages:e,current:l,onNavigate:i,onHelp:()=>o(!0)}),u.comingSoon?(0,D.jsx)(Qn,{label:u.label}):u.node,s&&!a&&(0,D.jsx)(Xn,{onAccept:()=>{c(!1),o(!0)},onDecline:()=>{c(!1),Vn()}}),a&&(0,D.jsx)(Yn,{onClose:()=>o(!1)})]})}function ir(e){return(e||`artboard`).toString().replace(/[\\/:*?"<>|\x00-\x1F]+/g,``).replace(/\s+/g,` `).trim().slice(0,120)||`artboard`}function ar(e,t,n){return`${ir(e||`artboard`)}-${!t||t===`default`?`default`:ir(t)}${n}`}function or(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,r.click(),setTimeout(()=>URL.revokeObjectURL(n),1e4)}async function sr(e,t={}){let{format:n,assetName:r,variantName:i,fontResolver:a=null,quality:o}=t,s;try{s=pn(n)}catch(e){return{ok:!1,filename:null,unembeddedFonts:[],error:e instanceof Error?e:Error(String(e))}}let{extension:c}=s,l=ar(r,i,c),u,d=[];try{let t=await bn(e,{format:n,fontResolver:a,...o===void 0?{}:{quality:o}});u=t.blob,d=t.unembeddedFonts||[]}catch(e){return{ok:!1,filename:l,unembeddedFonts:[],error:e instanceof Error?e:Error(String(e))}}return or(u,l),{ok:!0,filename:l,unembeddedFonts:d,error:null}}typeof window<`u`&&!window.htmlToImage&&(window.htmlToImage=tn);var X={bg:`#f0eee9`,grid:`rgba(0,0,0,0.06)`,label:`rgba(60,50,40,0.7)`,title:`rgba(40,30,20,0.85)`,subtitle:`rgba(60,50,40,0.6)`,postitBg:`#fef4a8`,postitText:`#5a4a2a`,font:`-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif`};if(typeof document<`u`&&!document.getElementById(`dc-styles`)){let e=document.createElement(`style`);e.id=`dc-styles`,e.textContent=[`.dc-editable{cursor:text;outline:none;white-space:nowrap;border-radius:3px;padding:0 2px;margin:0 -2px}`,`.dc-editable:focus{background:#fff;box-shadow:0 0 0 1.5px #c96442}`,`[data-dc-slot]{transition:transform .18s cubic-bezier(.2,.7,.3,1)}`,`[data-dc-slot].dc-dragging{transition:none;z-index:10;pointer-events:none}`,`[data-dc-slot].dc-dragging .dc-card{box-shadow:0 12px 40px rgba(0,0,0,.25),0 0 0 2px #c96442;transform:scale(1.02)}`,`.dc-card{transition:box-shadow .15s,transform .15s}`,`.dc-card *{scrollbar-width:none}`,`.dc-card *::-webkit-scrollbar{display:none}`,`.dc-labelrow{display:flex;align-items:center;gap:4px;height:24px}`,`.dc-grip{cursor:grab;display:flex;align-items:center;padding:5px 4px;border-radius:4px;transition:background .12s}`,`.dc-grip:hover{background:rgba(0,0,0,.08)}`,`.dc-grip:active{cursor:grabbing}`,`.dc-grip:focus-visible{outline:2px solid #c96442;outline-offset:1px}`,`.dc-labeltext{cursor:pointer;border-radius:4px;padding:3px 6px;display:flex;align-items:center;transition:background .12s}`,`.dc-labeltext:hover{background:rgba(0,0,0,.05)}`,`.dc-expand{position:absolute;bottom:100%;right:0;margin-bottom:5px;z-index:2;opacity:0;transition:opacity .12s,background .12s;`,` width:22px;height:22px;border-radius:5px;border:none;cursor:pointer;padding:0;`,` background:transparent;color:rgba(60,50,40,.7);display:flex;align-items:center;justify-content:center}`,`.dc-expand:hover{background:rgba(0,0,0,.06);color:#2a251f}`,`[data-dc-slot]:hover .dc-expand{opacity:1}`,`.dc-expand:focus-visible{opacity:1;outline:2px solid #c96442;outline-offset:1px}`,`.dc-dl{position:absolute;bottom:100%;margin-bottom:5px;z-index:2;opacity:0;transition:opacity .12s,background .12s;`,` height:22px;padding:0 8px;border-radius:5px;border:none;cursor:pointer;`,` background:rgba(255,255,255,.85);color:#2a251f;font:600 10px/1 var(--lm-font-mono,monospace);`,` letter-spacing:.06em;text-transform:uppercase;display:inline-flex;align-items:center;gap:4px;`,` box-shadow:0 1px 2px rgba(0,0,0,.06)}`,`.dc-dl:hover{background:#fff;color:#000}`,`.dc-dl[disabled]{opacity:.6;cursor:wait}`,`.dc-dl[data-dc-error-disabled]{cursor:not-allowed;opacity:.45;background:rgba(200,60,60,.08);color:#a83228}`,`[data-dc-slot]:hover .dc-dl{opacity:1}`,`.dc-dl-png{right:30px}`,`.dc-dl-jpg{right:74px}`,`.dc-dl:focus-visible{opacity:1;outline:2px solid #c96442;outline-offset:1px}`,`.dc-focus-overlay button:focus-visible{outline:2px solid rgba(255,255,255,.8);outline-offset:2px}`].join(`
8
+ `),document.head.appendChild(e)}var cr=T.createContext(null),lr=`https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300..700&family=JetBrains+Mono:wght@400;500;600&display=swap`;function ur(e){let t=new Uint8Array(e),n=``,r=32768;for(let e=0;e<t.length;e+=r)n+=String.fromCharCode.apply(null,t.subarray(e,e+r));return btoa(n)}async function dr(){let e=await fetch(lr,{mode:`cors`});if(!e.ok)throw Error(`font css fetch failed: `+e.status);let t=await e.text(),n=Array.from(new Set(Array.from(t.matchAll(/url\((https:\/\/fonts\.gstatic\.com\/[^)]+)\)/g)).map(e=>e[1]))),r=await Promise.all(n.map(async e=>{try{let t=await fetch(e,{mode:`cors`});return t.ok?[e,`data:font/woff2;base64,${ur(await t.arrayBuffer())}`]:[e,null]}catch{return[e,null]}}));for(let[e,n]of r)n&&(t=t.split(e).join(n));return t}var fr=null,pr=null;async function mr(){return fr===null?pr||(pr=(async()=>{let e=``;try{e=await dr()}catch(e){console.warn(`Google Fonts embed failed, falling back to htmlToImage scan`,e)}if(window.htmlToImage?.getFontEmbedCSS)try{let t=await window.htmlToImage.getFontEmbedCSS(document.body);t&&(e+=`
9
+ `+t)}catch{}return fr=e,e})(),pr):fr}function hr(e){return(e||`artboard`).toString().replace(/[\\/:*?"<>|\x00-\x1F]+/g,``).replace(/\s+/g,` `).trim().slice(0,120)||`artboard`}async function gr(e,{width:t,height:n,fmt:r}){if(!e||!window.htmlToImage)return null;if(document.fonts&&document.fonts.ready)try{await document.fonts.ready}catch{}let i={width:t,height:n,canvasWidth:t,canvasHeight:n,pixelRatio:2,cacheBust:!0,skipAutoScale:!0,fontEmbedCSS:await mr(),backgroundColor:r===`jpg`?`#ffffff`:void 0,style:{transform:`none`,transformOrigin:`top left`,margin:`0`,width:t+`px`,height:n+`px`}};return r===`png`?window.htmlToImage.toPng(e,i):window.htmlToImage.toJpeg(e,{...i,quality:.95})}function _r(e,t){let n=document.createElement(`a`);n.href=e,n.download=t,n.click()}var vr=`.design-canvas.state.json`,yr=`lerret-studio:state:`+(typeof location<`u`?location.pathname:`/`);function br({children:e,minScale:t,maxScale:n,style:r}){let[i,a]=T.useState({sections:{},focus:null}),[o,s]=T.useState(!1),c=T.useRef(!1),l=T.useRef(!1);T.useEffect(()=>{let e=!1;fetch(`./`+vr).then(e=>e.ok?e.json():null).then(t=>{if(e)return;let n=t&&t.sections?t:null;if(!n)try{let e=localStorage.getItem(yr);if(e){let t=JSON.parse(e);t&&t.sections&&(n=t)}}catch{}n&&(l.current=!0,a(e=>({...e,sections:n.sections})))}).catch(()=>{}).finally(()=>{c.current=!0,e||s(!0)});let t=setTimeout(()=>{e||s(!0)},150);return()=>{e=!0,clearTimeout(t)}},[]),T.useEffect(()=>{if(!c.current)return;if(l.current){l.current=!1;return}let e=setTimeout(()=>{let e=JSON.stringify({sections:i.sections});try{localStorage.setItem(yr,e)}catch{}window.omelette?.writeFile(vr,e).catch(()=>{})},250);return()=>clearTimeout(e)},[i.sections]);let u={},d={},f=[];T.Children.forEach(e,e=>{if(!e||e.type!==Tr)return;let t=e.props.id??e.props.title;if(!t)return;f.push(t);let n=i.sections[t]||{},r=[];T.Children.forEach(e.props.children,e=>{if(!e||e.type!==Z)return;let n=e.props.id??e.props.label;n&&(u[`${t}/${n}`]={sectionId:t,artboard:e},r.push(n))});let a=(n.order||[]).filter(e=>r.includes(e));d[t]={title:n.title??e.props.title,subtitle:e.props.subtitle,slotIds:[...a,...r.filter(e=>!a.includes(e))]}});let p=T.useMemo(()=>({state:i,section:e=>i.sections[e]||{},patchSection:(e,t)=>a(n=>({...n,sections:{...n.sections,[e]:{...n.sections[e],...typeof t==`function`?t(n.sections[e]||{}):t}}})),setFocus:e=>a(t=>({...t,focus:e}))}),[i]);return T.useEffect(()=>{let e=e=>{e.key===`Escape`&&p.setFocus(null)},t=e=>{let t=document.activeElement;t&&t.isContentEditable&&!t.contains(e.target)&&t.blur()};return document.addEventListener(`keydown`,e),document.addEventListener(`pointerdown`,t,!0),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`pointerdown`,t,!0)}},[p]),(0,D.jsxs)(cr.Provider,{value:p,children:[(0,D.jsx)(wr,{minScale:t,maxScale:n,style:r,children:o&&e}),i.focus&&u[i.focus]&&(0,D.jsx)(kr,{entry:u[i.focus],sectionMeta:d,sectionOrder:f})]})}typeof window<`u`&&(window.dcDownloadSlots=xr);async function xr(e,t,n){if(e.length){await mr();for(let r=0;r<e.length;r++){n?.({i:r+1,total:e.length});let i=e[r],a=i.querySelector(`.dc-card`);if(!a)continue;let o=parseInt(i.dataset.dcW,10)||a.offsetWidth,s=parseInt(i.dataset.dcH,10)||a.offsetHeight,c=i.dataset.dcLabel||i.dataset.dcSlot||`artboard-${r+1}`,l=i.dataset.dcSectionTitle||``,u=hr(c),d=l?hr(l):``,f=d?`${d}--${u}`:u;try{let e=await gr(a,{width:o,height:s,fmt:t});e&&_r(e,`${f}.${t===`jpg`?`jpg`:`png`}`)}catch(e){console.error(`capture failed for`,c,e)}await new Promise(e=>setTimeout(e,250))}}}function Sr({sectionId:e}){let[t,n]=T.useState(null),[r,i]=T.useState(null),a=async r=>{if(t)return;let a=Array.from(document.querySelectorAll(`[data-dc-section="${e}"] [data-dc-slot]`));if(a.length){n(r),i({i:0,total:a.length});try{await xr(a,r,e=>i(e))}finally{n(null),i(null)}}},o=e=>t===e&&r?`${r.i}/${r.total}…`:e.toUpperCase();return(0,D.jsxs)(`div`,{style:{display:`inline-flex`,gap:6,alignSelf:`flex-start`},children:[(0,D.jsxs)(`button`,{onClick:()=>a(`png`),disabled:!!t,style:Cr(t===`png`),title:`Download every artboard in this group as PNG`,children:[`↓ `,o(`png`)]}),(0,D.jsxs)(`button`,{onClick:()=>a(`jpg`),disabled:!!t,style:Cr(t===`jpg`),title:`Download every artboard in this group as JPG`,children:[`↓ `,o(`jpg`)]})]})}function Cr(e){return{height:28,padding:`0 12px`,borderRadius:6,border:`1px solid rgba(60,50,40,0.16)`,background:e?`#2a251f`:`rgba(255,255,255,0.6)`,color:e?`#fff`:`#3a3530`,font:`600 11px/1 -apple-system, BlinkMacSystemFont, sans-serif`,letterSpacing:`0.04em`,textTransform:`uppercase`,cursor:e?`wait`:`pointer`,display:`inline-flex`,alignItems:`center`,gap:4,transition:`background .12s, border-color .12s`}}function wr({children:e,minScale:t=.1,maxScale:n=8,style:r={}}){let i=T.useRef(null),a=T.useRef(null),o=T.useRef({x:0,y:0,scale:1}),s=T.useCallback(()=>{let{x:e,y:t,scale:n}=o.current,r=a.current;r&&(r.style.transform=`translate3d(${e}px, ${t}px, 0) scale(${n})`)},[]);T.useEffect(()=>{let e=i.current;if(!e)return;let r=(r,i,a)=>{let c=e.getBoundingClientRect(),l=r-c.left,u=i-c.top,d=o.current,f=Math.min(n,Math.max(t,d.scale*a)),p=f/d.scale;d.x=l-(l-d.x)*p,d.y=u-(u-d.y)*p,d.scale=f,s()},a=e=>{e.preventDefault(),!l&&(e.ctrlKey||e.metaKey?r(e.clientX,e.clientY,Math.exp(-e.deltaY*.01)):e.shiftKey&&e.deltaX===0?(o.current.x-=e.deltaY,s()):(o.current.x-=e.deltaX,o.current.y-=e.deltaY,s()))},c=1,l=!1,u=e=>{e.preventDefault(),l=!0,c=o.current.scale},d=e=>{e.preventDefault(),r(e.clientX,e.clientY,c*e.scale/o.current.scale)},f=e=>{e.preventDefault(),l=!1},p=null,m=t=>{let n=!t.target.closest(`[data-dc-slot], .dc-editable`);(t.button===1||t.button===0&&n)&&(t.preventDefault(),e.setPointerCapture(t.pointerId),p={id:t.pointerId,lx:t.clientX,ly:t.clientY},e.style.cursor=`grabbing`)},h=e=>{!p||e.pointerId!==p.id||(o.current.x+=e.clientX-p.lx,o.current.y+=e.clientY-p.ly,p.lx=e.clientX,p.ly=e.clientY,s())},g=t=>{!p||t.pointerId!==p.id||(e.releasePointerCapture(t.pointerId),p=null,e.style.cursor=``)};return e.addEventListener(`wheel`,a,{passive:!1}),e.addEventListener(`gesturestart`,u,{passive:!1}),e.addEventListener(`gesturechange`,d,{passive:!1}),e.addEventListener(`gestureend`,f,{passive:!1}),e.addEventListener(`pointerdown`,m),e.addEventListener(`pointermove`,h),e.addEventListener(`pointerup`,g),e.addEventListener(`pointercancel`,g),()=>{e.removeEventListener(`wheel`,a),e.removeEventListener(`gesturestart`,u),e.removeEventListener(`gesturechange`,d),e.removeEventListener(`gestureend`,f),e.removeEventListener(`pointerdown`,m),e.removeEventListener(`pointermove`,h),e.removeEventListener(`pointerup`,g),e.removeEventListener(`pointercancel`,g)}},[s,t,n]);let c=`url("data:image/svg+xml,%3Csvg width='120' height='120' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M120 0H0v120' fill='none' stroke='${encodeURIComponent(X.grid)}' stroke-width='1'/%3E%3C/svg%3E")`;return(0,D.jsx)(`div`,{ref:i,className:`design-canvas`,"data-tour":`canvas`,style:{height:`100vh`,width:`100vw`,background:X.bg,overflow:`hidden`,overscrollBehavior:`none`,touchAction:`none`,position:`relative`,fontFamily:X.font,boxSizing:`border-box`,...r},children:(0,D.jsxs)(`div`,{ref:a,style:{position:`absolute`,top:0,left:0,transformOrigin:`0 0`,willChange:`transform`,width:`max-content`,minWidth:`100%`,minHeight:`100%`,padding:`60px 0 80px`},children:[(0,D.jsx)(`div`,{style:{position:`absolute`,inset:-6e3,backgroundImage:c,backgroundSize:`120px 120px`,pointerEvents:`none`,zIndex:-1}}),e]})})}function Tr({id:e,title:t,subtitle:n,children:r,gap:i=48,depth:a=0,kicker:o,sectionStyle:s}){let c=T.useContext(cr),l=e??t,u=T.Children.toArray(r),d=u.filter(e=>e&&e.type===Z),f=u.filter(e=>!(e&&e.type===Z)),p=d.map(e=>e.props.id??e.props.label),m=c&&l&&c.section(l)||{},h=T.useMemo(()=>{let e=(m.order||[]).filter(e=>p.includes(e));return[...e,...p.filter(t=>!e.includes(t))]},[m.order,p.join(`|`)]),g=Object.fromEntries(d.map(e=>[e.props.id??e.props.label,e])),_=a>0,v=Math.min(a,4)*40,y=Math.max(.05,.14-a*.03),b=Math.max(.05,.18-a*.05),x=Math.max(19,28-a*4);return(0,D.jsxs)(`div`,{"data-dc-section":l,"data-dc-section-depth":a,"data-tour":`section`,style:{margin:`0 60px 80px ${60+v}px`,position:`relative`,width:`max-content`,...s},children:[_&&(0,D.jsx)(`div`,{"aria-hidden":`true`,style:{position:`absolute`,left:-16,top:6,bottom:6,width:3,borderRadius:999,background:`var(--lm-accent-border, rgba(184,91,51,0.20))`}}),(0,D.jsxs)(`div`,{style:{border:`1px ${_?`dashed`:`solid`} rgba(60,50,40,${y})`,borderRadius:16,padding:_?`20px 28px 28px`:`24px 32px 32px`,background:`rgba(255,255,255,${b})`},children:[(0,D.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,justifyContent:`space-between`,gap:24,marginBottom:56},children:[(0,D.jsxs)(`div`,{children:[_&&o&&(0,D.jsxs)(`div`,{style:{fontSize:10,fontWeight:600,letterSpacing:`0.12em`,textTransform:`uppercase`,color:`var(--lm-accent, #B85B33)`,marginBottom:6,display:`flex`,alignItems:`center`,gap:5},children:[(0,D.jsx)(`svg`,{width:`9`,height:`9`,viewBox:`0 0 9 9`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,D.jsx)(`path`,{d:`M1 1v4.5a2 2 0 002 2H8M5.5 5L8 7.5 5.5 10`})}),`in `,o]}),(0,D.jsx)(Dr,{tag:`div`,value:m.title??t,onChange:e=>c&&l&&c.patchSection(l,{title:e}),style:{fontSize:x,fontWeight:600,color:X.title,letterSpacing:-.4,marginBottom:6,display:`inline-block`}}),n&&(0,D.jsx)(`div`,{style:{fontSize:16,color:X.subtitle},children:n})]}),(0,D.jsx)(Sr,{sectionId:l})]}),(0,D.jsx)(`div`,{style:{display:`flex`,gap:i,paddingTop:36,alignItems:`flex-start`,width:`max-content`},children:h.map(e=>(0,D.jsx)(Er,{sectionId:l,sectionTitle:m.title??t,artboard:g[e],order:h,label:(m.labels||{})[e]??g[e].props.label,onRename:t=>c&&c.patchSection(l,n=>({labels:{...n.labels,[e]:t}})),onReorder:e=>c&&c.patchSection(l,{order:e}),onFocus:()=>c&&c.setFocus(`${l}/${e}`)},e))})]}),f]})}function Z(){return null}function Er({sectionId:e,sectionTitle:t,artboard:n,label:r,order:i,onRename:a,onReorder:o,onFocus:s}){let{id:c,label:l,width:u=260,height:d=480,children:f,style:p={},assetName:m,variantName:h,isError:g}=n.props,_=c??l,v=T.useRef(null),y=T.useRef(null),[b,x]=T.useState(null),[S,C]=T.useState(null),[w,E]=T.useState(null);T.useEffect(()=>{if(!S)return;let e=setTimeout(()=>C(null),4e3);return()=>clearTimeout(e)},[S]),T.useEffect(()=>{if(!w)return;let e=setTimeout(()=>E(null),6e3);return()=>clearTimeout(e)},[w]);let O=async e=>{if(!(!y.current||b)&&!g){x(e),C(null);try{let t=await sr(y.current,{format:e,assetName:m,variantName:h});t.ok?t.unembeddedFonts&&t.unembeddedFonts.length>0&&E(t.unembeddedFonts):C(e)}catch(t){console.error(`Download failed`,t),C(e)}finally{x(null)}}};return(0,D.jsxs)(`div`,{ref:v,"data-dc-slot":_,"data-dc-label":r||l||_,"data-dc-section-title":t||``,"data-dc-w":u,"data-dc-h":d,style:{position:`relative`,flexShrink:0},children:[(0,D.jsxs)(`div`,{className:`dc-labelrow`,style:{position:`absolute`,bottom:`100%`,left:-4,marginBottom:4,color:X.label},children:[(0,D.jsx)(`button`,{className:`dc-grip`,onPointerDown:t=>{t.preventDefault(),t.stopPropagation();let n=v.current,r=n.getBoundingClientRect().width/n.offsetWidth||1,a=Array.from(document.querySelectorAll(`[data-dc-section="${e}"] [data-dc-slot]`)).map(e=>({el:e,id:e.dataset.dcSlot,x:e.getBoundingClientRect().left})),s=a.map(e=>e.x),c=i.indexOf(_),l=t.clientX,u=i.slice();n.classList.add(`dc-dragging`);let d=()=>{for(let e of a){if(e.id===_)continue;let t=u.indexOf(e.id);e.el.style.transform=`translateX(${(s[t]-e.x)/r}px)`}},f=e=>{let t=e.clientX-l;n.style.transform=`translateX(${t/r}px)`;let o=a[c].x+t,f=0,p=1/0;for(let e=0;e<s.length;e++){let t=Math.abs(s[e]-o);t<p&&(p=t,f=e)}u.indexOf(_)!==f&&(u=i.filter(e=>e!==_),u.splice(f,0,_),d())},p=()=>{document.removeEventListener(`pointermove`,f),document.removeEventListener(`pointerup`,p);let e=u.indexOf(_);n.classList.remove(`dc-dragging`),n.style.transform=`translateX(${(s[e]-a[c].x)/r}px)`,setTimeout(()=>{for(let e of a)e.el.style.transition=`none`,e.el.style.transform=``;u.join(`|`)!==i.join(`|`)&&o(u),requestAnimationFrame(()=>requestAnimationFrame(()=>{for(let e of a)e.el.style.transition=``}))},180)};document.addEventListener(`pointermove`,f),document.addEventListener(`pointerup`,p)},onKeyDown:e=>{if(e.key===`ArrowLeft`||e.key===`ArrowRight`){e.preventDefault();let t=i.indexOf(_),n=i.slice(),r=e.key===`ArrowLeft`?-1:1,a=Math.max(0,Math.min(n.length-1,t+r));a!==t&&(n.splice(t,1),n.splice(a,0,_),o(n))}},title:`Drag to reorder; ←/→ to move`,"aria-label":`Reorder ${r||_}; use arrow keys to move left or right`,style:{border:`none`,background:`transparent`,padding:0,margin:0,lineHeight:0},children:(0,D.jsxs)(`svg`,{width:`9`,height:`13`,viewBox:`0 0 9 13`,fill:`currentColor`,children:[(0,D.jsx)(`circle`,{cx:`2`,cy:`2`,r:`1.1`}),(0,D.jsx)(`circle`,{cx:`7`,cy:`2`,r:`1.1`}),(0,D.jsx)(`circle`,{cx:`2`,cy:`6.5`,r:`1.1`}),(0,D.jsx)(`circle`,{cx:`7`,cy:`6.5`,r:`1.1`}),(0,D.jsx)(`circle`,{cx:`2`,cy:`11`,r:`1.1`}),(0,D.jsx)(`circle`,{cx:`7`,cy:`11`,r:`1.1`})]})}),(0,D.jsx)(`div`,{className:`dc-labeltext`,onClick:s,title:`Click to focus`,children:(0,D.jsx)(Dr,{value:r,onChange:a,onClick:e=>e.stopPropagation(),style:{fontSize:15,fontWeight:500,color:X.label,lineHeight:1}})})]}),(0,D.jsx)(`button`,{className:`dc-expand`,onClick:s,onPointerDown:e=>e.stopPropagation(),title:`Open in focus view`,"aria-label":`Open ${r||_} in focus view`,children:(0,D.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 12 12`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,children:(0,D.jsx)(`path`,{d:`M7 1h4v4M5 11H1V7M11 1L7.5 4.5M1 11l3.5-3.5`})})}),(0,D.jsx)(`button`,{className:`dc-dl dc-dl-png`,onClick:()=>O(`png`),onPointerDown:e=>e.stopPropagation(),disabled:!!b||g,"data-dc-error-disabled":g?`true`:void 0,title:g?`Can't export — this artboard has an error`:S===`png`?`Capture failed — try again`:`Download as PNG`,"aria-label":g?`Can't export — this artboard has an error`:`Download as PNG`,children:b===`png`?`…`:`PNG`}),(0,D.jsx)(`button`,{className:`dc-dl dc-dl-jpg`,onClick:()=>O(`jpg`),onPointerDown:e=>e.stopPropagation(),disabled:!!b||g,"data-dc-error-disabled":g?`true`:void 0,title:g?`Can't export — this artboard has an error`:S===`jpg`?`Capture failed — try again`:`Download as JPG`,"aria-label":g?`Can't export — this artboard has an error`:`Download as JPG`,children:b===`jpg`?`…`:`JPG`}),(0,D.jsx)(`div`,{ref:y,className:`dc-card`,style:{borderRadius:2,boxShadow:`0 1px 3px rgba(0,0,0,.08),0 4px 16px rgba(0,0,0,.06)`,overflow:`hidden`,width:u,height:d,background:`#fff`,...p},children:f||(0,D.jsx)(`div`,{style:{height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`#bbb`,fontSize:13,fontFamily:X.font},children:_})}),S&&(0,D.jsx)(`div`,{role:`alert`,"aria-live":`polite`,style:{position:`absolute`,bottom:8,left:8,right:8,background:`rgba(168,50,40,.88)`,color:`#fff`,borderRadius:5,padding:`6px 10px`,font:`500 11px/1.4 `+X.font,pointerEvents:`none`,zIndex:5},children:`Export failed. Check the console for details.`}),w&&w.length>0&&(0,D.jsxs)(`div`,{role:`status`,"aria-live":`polite`,style:{position:`absolute`,bottom:S?48:8,left:8,right:8,background:`rgba(40,35,25,.82)`,color:`rgba(255,235,180,.95)`,borderRadius:5,padding:`6px 10px`,font:`500 11px/1.4 `+X.font,pointerEvents:`none`,zIndex:5},children:[`Fonts not embedded: `,w.join(`, `)]})]})}function Dr({value:e,onChange:t,style:n,tag:r=`span`,onClick:i}){return(0,D.jsx)(r,{className:`dc-editable`,contentEditable:!0,suppressContentEditableWarning:!0,onClick:i,onPointerDown:e=>e.stopPropagation(),onBlur:e=>t&&t(e.currentTarget.textContent),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),e.currentTarget.blur())},style:n,children:e})}var Or=`a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])`;function kr({entry:e,sectionMeta:t,sectionOrder:n}){let r=T.useContext(cr),{sectionId:i,artboard:a}=e,o=r.section(i),s=t[i],c=s.slotIds,l=a.props.id??a.props.label,u=c.indexOf(l),d=n.indexOf(i),f=T.useRef(null),p=T.useRef(null),m=e=>{let t=c[(u+e+c.length)%c.length];t&&r.setFocus(`${i}/${t}`)},h=e=>{let i=n[(d+e+n.length)%n.length],a=t[i]&&t[i].slotIds[0];a&&r.setFocus(`${i}/${a}`)};T.useEffect(()=>{let e=document.activeElement,t=requestAnimationFrame(()=>{p.current&&p.current.focus()});return()=>{cancelAnimationFrame(t),e&&typeof e.focus==`function`&&e.focus()}},[]),T.useEffect(()=>{let e=e=>{if(e.key===`ArrowLeft`&&(e.preventDefault(),m(-1)),e.key===`ArrowRight`&&(e.preventDefault(),m(1)),e.key===`ArrowUp`&&(e.preventDefault(),h(-1)),e.key===`ArrowDown`&&(e.preventDefault(),h(1)),e.key===`Tab`){let t=f.current;if(!t)return;let n=Array.from(t.querySelectorAll(Or)).filter(e=>!e.closest(`[inert]`)&&e.offsetParent!==null);if(n.length===0){e.preventDefault();return}let r=document.activeElement,i=n.indexOf(r);e.shiftKey?(e.preventDefault(),(i<=0?n[n.length-1]:n[i-1]).focus()):(e.preventDefault(),(i>=n.length-1?n[0]:n[i+1]).focus())}};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)});let{width:g=260,height:_=480,children:v}=a.props,[y,b]=T.useState({w:window.innerWidth,h:window.innerHeight});T.useEffect(()=>{let e=()=>b({w:window.innerWidth,h:window.innerHeight});return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let x=Math.max(.1,Math.min((y.w-200)/g,(y.h-260)/_,2)),[S,C]=T.useState(!1),w=({dir:e,onClick:t,label:n})=>(0,D.jsx)(`button`,{onClick:e=>{e.stopPropagation(),t()},"aria-label":n,style:{position:`absolute`,top:`50%`,[e]:28,transform:`translateY(-50%)`,border:`none`,background:`rgba(255,255,255,.08)`,color:`rgba(255,255,255,.9)`,width:44,height:44,borderRadius:22,fontSize:18,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,transition:`background .15s`},onMouseEnter:e=>e.currentTarget.style.background=`rgba(255,255,255,.18)`,onMouseLeave:e=>e.currentTarget.style.background=`rgba(255,255,255,.08)`,children:(0,D.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 18 18`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:(0,D.jsx)(`path`,{d:e===`left`?`M11 3L5 9l6 6`:`M7 3l6 6-6 6`})})});return E.createPortal((0,D.jsxs)(`div`,{ref:f,role:`dialog`,"aria-modal":`true`,"aria-label":`Focus view: ${(o.labels||{})[l]??a.props.label}`,className:`dc-focus-overlay`,onClick:()=>r.setFocus(null),onWheel:e=>e.preventDefault(),style:{position:`fixed`,inset:0,zIndex:100,background:`rgba(24,20,16,.6)`,backdropFilter:`blur(14px)`,fontFamily:X.font,color:`#fff`},children:[(0,D.jsxs)(`div`,{onClick:e=>e.stopPropagation(),style:{position:`absolute`,top:0,left:0,right:0,height:72,display:`flex`,alignItems:`flex-start`,padding:`16px 20px 0`,gap:16},children:[(0,D.jsxs)(`div`,{style:{position:`relative`},children:[(0,D.jsxs)(`button`,{onClick:()=>C(e=>!e),"aria-haspopup":`listbox`,"aria-expanded":S,style:{border:`none`,background:`transparent`,color:`#fff`,cursor:`pointer`,padding:`6px 8px`,borderRadius:6,textAlign:`left`,fontFamily:`inherit`},children:[(0,D.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,D.jsx)(`span`,{style:{fontSize:18,fontWeight:600,letterSpacing:-.3},children:s.title}),(0,D.jsx)(`svg`,{width:`11`,height:`11`,viewBox:`0 0 11 11`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,style:{opacity:.7},children:(0,D.jsx)(`path`,{d:`M2 4l3.5 3.5L9 4`})})]}),s.subtitle&&(0,D.jsx)(`span`,{style:{display:`block`,fontSize:13,opacity:.6,fontWeight:400,marginTop:2},children:s.subtitle})]}),S&&(0,D.jsx)(`div`,{role:`listbox`,style:{position:`absolute`,top:`100%`,left:0,marginTop:4,background:`#2a251f`,borderRadius:8,boxShadow:`0 8px 32px rgba(0,0,0,.4)`,padding:4,minWidth:200,zIndex:10},children:n.map(e=>(0,D.jsx)(`button`,{role:`option`,"aria-selected":e===i,onClick:()=>{C(!1);let n=t[e].slotIds[0];n&&r.setFocus(`${e}/${n}`)},style:{display:`block`,width:`100%`,textAlign:`left`,border:`none`,cursor:`pointer`,background:e===i?`rgba(255,255,255,.1)`:`transparent`,color:`#fff`,padding:`8px 12px`,borderRadius:5,fontSize:14,fontWeight:e===i?600:400,fontFamily:`inherit`},children:t[e].title},e))})]}),(0,D.jsx)(`div`,{style:{flex:1}}),(0,D.jsx)(`button`,{ref:p,onClick:()=>r.setFocus(null),"aria-label":`Close focus view`,onMouseEnter:e=>e.currentTarget.style.background=`rgba(255,255,255,.12)`,onMouseLeave:e=>e.currentTarget.style.background=`transparent`,style:{border:`none`,background:`transparent`,color:`rgba(255,255,255,.7)`,width:32,height:32,borderRadius:16,fontSize:20,cursor:`pointer`,lineHeight:1,transition:`background .12s`},children:`×`})]}),(0,D.jsxs)(`div`,{style:{position:`absolute`,top:64,bottom:56,left:100,right:100,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:16},children:[(0,D.jsx)(`div`,{onClick:e=>e.stopPropagation(),style:{width:g*x,height:_*x,position:`relative`},children:(0,D.jsx)(`div`,{style:{width:g,height:_,transform:`scale(${x})`,transformOrigin:`top left`,background:`#fff`,borderRadius:2,overflow:`hidden`,boxShadow:`0 20px 80px rgba(0,0,0,.4)`},children:v||(0,D.jsx)(`div`,{style:{height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`#bbb`},children:l})})}),(0,D.jsxs)(`div`,{onClick:e=>e.stopPropagation(),style:{fontSize:14,fontWeight:500,opacity:.85,textAlign:`center`},children:[(o.labels||{})[l]??a.props.label,(0,D.jsxs)(`span`,{style:{opacity:.5,marginLeft:10,fontVariantNumeric:`tabular-nums`},children:[u+1,` / `,c.length]})]})]}),(0,D.jsx)(w,{dir:`left`,onClick:()=>m(-1),label:`Previous artboard`}),(0,D.jsx)(w,{dir:`right`,onClick:()=>m(1),label:`Next artboard`}),(0,D.jsx)(`div`,{onClick:e=>e.stopPropagation(),style:{position:`absolute`,bottom:20,left:`50%`,transform:`translateX(-50%)`,display:`flex`,gap:8},children:c.map((e,t)=>(0,D.jsx)(`button`,{onClick:()=>r.setFocus(`${i}/${e}`),"aria-label":`Go to artboard ${t+1} of ${c.length}`,"aria-current":t===u?`true`:void 0,style:{border:`none`,padding:0,cursor:`pointer`,width:6,height:6,borderRadius:3,background:t===u?`#fff`:`rgba(255,255,255,.3)`}},e))})]}),document.body)}function Q({size:e=28,withWordmark:t=!0,dark:n=!1}){let r=n?`#ECE7DC`:`#1A1714`;return(0,D.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:Math.round(e*.32),color:r,fontFamily:`var(--lm-font-display, "Instrument Serif", Georgia, serif)`},children:[(0,D.jsx)(`img`,{src:`/assets/lerret-logo.png`,alt:``,width:e,height:e,style:{display:`block`,width:e,height:e,borderRadius:Math.max(3,Math.round(e*.14)),objectFit:`cover`}}),t&&(0,D.jsx)(`span`,{style:{fontSize:Math.round(e*1),lineHeight:1,letterSpacing:`-0.015em`,color:`inherit`},children:`Lerret`})]})}function $({width:e=720,height:t=440,fileName:n=`launch-post.lerret`,folder:r=`~/Assets/social`,artboardLabel:i=`instagram · 1080 × 1350 · 4:5`,artboardW:a=200,artboardH:o=250}){let s=Math.round(e*.25),c=Math.round(e*.26),l=(e=!1,t)=>(0,D.jsx)(`div`,{style:{width:26,height:26,display:`grid`,placeItems:`center`,borderRadius:4,background:e?`#E8E2D4`:`transparent`,color:e?`#1A1714`:`#6E6960`,fontSize:13,fontWeight:600,fontFamily:`var(--lm-font-mono)`},children:t}),u=(e,t=0,n=!1,r=`▢`)=>(0,D.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,padding:`4px 8px`,paddingLeft:8+t*12,borderRadius:4,background:n?`#E8C9B8`:`transparent`,color:n?`#92421E`:`#3A3530`,fontSize:10.5,fontFamily:`var(--lm-font-sans)`},children:[(0,D.jsx)(`span`,{style:{color:n?`#92421E`:`#6E6960`,fontSize:9},children:r}),(0,D.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e})]}),d=(e,t,n=!0)=>(0,D.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,padding:`2px 0`,fontSize:9.5},children:[(0,D.jsx)(`span`,{style:{color:`#6E6960`,textTransform:`uppercase`,letterSpacing:`0.08em`,fontFamily:`var(--lm-font-sans)`},children:e}),(0,D.jsx)(`span`,{style:{color:`#1A1714`,fontFamily:n?`var(--lm-font-mono)`:`var(--lm-font-sans)`},children:t})]});return(0,D.jsxs)(`div`,{style:{width:e,height:t,background:`#FAF8F2`,border:`1px solid #C7C0AF`,borderRadius:6,overflow:`hidden`,boxShadow:`0 18px 40px -28px rgba(26,23,20,0.30), 0 1px 0 rgba(26,23,20,0.04)`,display:`grid`,gridTemplateRows:`32px 1fr`,fontFamily:`var(--lm-font-sans)`},children:[(0,D.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,padding:`0 10px`,borderBottom:`1px solid #DDD7CA`,background:`#FAF8F2`},children:[(0,D.jsx)(`img`,{src:`/assets/lerret-logo.png`,alt:``,style:{width:16,height:16,borderRadius:3,display:`block`}}),(0,D.jsx)(`span`,{style:{fontSize:11,color:`#1A1714`,fontWeight:500},children:n.replace(/\.lerret$/,``)}),(0,D.jsx)(`span`,{style:{fontSize:10,color:`#6E6960`,fontFamily:`var(--lm-font-mono)`},children:`.lerret`}),(0,D.jsxs)(`span`,{style:{fontSize:10,color:`#B8B3A8`,fontFamily:`var(--lm-font-mono)`,marginLeft:4},children:[`· saved · `,r]}),(0,D.jsx)(`div`,{style:{flex:1}}),(0,D.jsx)(`span`,{style:{fontSize:10,color:`#3A3530`,fontFamily:`var(--lm-font-mono)`},children:`100%`}),(0,D.jsx)(`span`,{style:{fontSize:9,fontWeight:600,padding:`4px 8px`,borderRadius:3,background:`#E8E2D4`,color:`#1A1714`,textTransform:`uppercase`,letterSpacing:`0.06em`},children:`↓ Export`})]}),(0,D.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`40px ${s}px 1fr ${c}px`,minHeight:0},children:[(0,D.jsxs)(`div`,{style:{borderRight:`1px solid #DDD7CA`,background:`#FAF8F2`,padding:`8px 0`,display:`flex`,flexDirection:`column`,alignItems:`center`,gap:2},children:[l(!0,`↗`),l(!1,`▢`),l(!1,`○`),l(!1,`✎`),l(!1,`T`),l(!1,`◢`)]}),(0,D.jsxs)(`div`,{style:{borderRight:`1px solid #DDD7CA`,background:`#FAF8F2`,display:`flex`,flexDirection:`column`,minHeight:0},children:[(0,D.jsxs)(`div`,{style:{padding:`8px 10px 4px`,display:`flex`,justifyContent:`space-between`,alignItems:`center`,fontSize:9,color:`#6E6960`,textTransform:`uppercase`,letterSpacing:`0.10em`},children:[(0,D.jsx)(`span`,{children:`Layers`}),(0,D.jsx)(`span`,{style:{fontFamily:`var(--lm-font-mono)`},children:`+`})]}),(0,D.jsxs)(`div`,{style:{padding:`2px 6px`,overflow:`hidden`,flex:1},children:[u(`launch-post`,0,!0,`▢`),u(`Background`,1,!1,`○`),u(`Photo`,1,!1,`▣`),u(`Title`,1,!1,`T`),u(`Date`,1,!1,`T`),u(`@handle`,1,!1,`T`)]})]}),(0,D.jsxs)(`div`,{style:{background:`#E8E2D4`,position:`relative`,display:`grid`,placeItems:`center`,overflow:`hidden`},children:[(0,D.jsx)(`div`,{style:{position:`absolute`,inset:0,backgroundImage:`radial-gradient(rgba(26,23,20,0.06) 1px, transparent 1px)`,backgroundSize:`10px 10px`,opacity:.55}}),(0,D.jsx)(`div`,{style:{position:`absolute`,top:8,left:12,fontFamily:`var(--lm-font-mono)`,fontSize:9,color:`#92421E`},children:i}),(0,D.jsxs)(`div`,{style:{width:a,height:o,background:`#FAF8F2`,border:`1.5px solid #B85B33`,position:`relative`,boxShadow:`0 18px 36px -18px rgba(26,23,20,0.35)`,display:`flex`,flexDirection:`column`,padding:16},children:[[{top:-3,left:-3},{top:-3,right:-3},{bottom:-3,left:-3},{bottom:-3,right:-3}].map((e,t)=>(0,D.jsx)(`div`,{style:{position:`absolute`,width:5,height:5,background:`#FAF8F2`,border:`1.5px solid #B85B33`,...e}},t)),(0,D.jsx)(`div`,{style:{fontFamily:`var(--lm-font-sans)`,fontSize:6,letterSpacing:`0.18em`,textTransform:`uppercase`,color:`#6E6960`,marginBottom:8},children:`Lerret · Release Note`}),(0,D.jsx)(`div`,{style:{fontFamily:`var(--lm-font-display)`,fontSize:22,lineHeight:.98,letterSpacing:`-0.02em`,color:`#1A1714`},children:`v0.4 is out.`}),(0,D.jsx)(`div`,{style:{fontFamily:`var(--lm-font-display)`,fontSize:22,lineHeight:.98,letterSpacing:`-0.02em`,color:`#3A3530`,fontStyle:`italic`},children:`Now on macOS.`}),(0,D.jsx)(`div`,{style:{flex:1}}),(0,D.jsx)(`div`,{style:{fontFamily:`var(--lm-font-mono)`,fontSize:6.5,color:`#6E6960`,lineHeight:1.4},children:`@lerret.dev · oslo · mit`})]})]}),(0,D.jsxs)(`div`,{style:{borderLeft:`1px solid #DDD7CA`,background:`#FAF8F2`,padding:`10px 12px`,display:`flex`,flexDirection:`column`,gap:2,minHeight:0,overflow:`hidden`},children:[(0,D.jsx)(`div`,{style:{fontSize:9,color:`#6E6960`,textTransform:`uppercase`,letterSpacing:`0.10em`,marginBottom:4},children:`Frame`}),d(`W`,`1080`),d(`H`,`1350`),(0,D.jsx)(`div`,{style:{height:1,background:`#DDD7CA`,margin:`8px 0`}}),(0,D.jsx)(`div`,{style:{fontSize:9,color:`#6E6960`,textTransform:`uppercase`,letterSpacing:`0.10em`,marginBottom:4},children:`Export`}),d(`Format`,`PNG`),d(`Scale`,`2×`),d(`Output`,`2160 × 2700`),(0,D.jsx)(`div`,{style:{marginTop:8,padding:`6px 8px`,background:`#B85B33`,color:`#FAF8F2`,borderRadius:3,textAlign:`center`,fontSize:10,fontWeight:600,fontFamily:`var(--lm-font-sans)`},children:`↓ Export PNG`})]})]})]})}function Ar({width:e=380,folder:t=`~/Assets`,rows:n,height:r}){let i=n||[{kind:`folder`,name:`social/`,meta:`12 files`},{kind:`lerret`,name:`launch-post.lerret`,meta:`2.4 KB`,indent:1,accent:!0},{kind:`image`,name:`launch-post@2x.png`,meta:`412 KB`,indent:1},{kind:`image`,name:`launch-post.jpg`,meta:`186 KB`,indent:1},{kind:`folder`,name:`thumbnails/`,meta:`8 files`},{kind:`folder`,name:`banners/`,meta:`3 files`},{kind:`folder`,name:`og/`,meta:`2 files`}],a={folder:`📁`,lerret:`◆`,image:`◫`};return(0,D.jsxs)(`div`,{style:{width:e,height:r,background:`#FAF8F2`,border:`1px solid #C7C0AF`,borderRadius:8,overflow:`hidden`,boxShadow:`0 18px 40px -28px rgba(26,23,20,0.30), 0 1px 0 rgba(26,23,20,0.04)`,fontFamily:`var(--lm-font-mono)`},children:[(0,D.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`10px 14px`,borderBottom:`1px solid #DDD7CA`,fontSize:12,color:`#1A1714`,background:`#F2EEE6`},children:[(0,D.jsx)(`span`,{style:{fontSize:13},children:`📁`}),(0,D.jsx)(`span`,{style:{fontWeight:500},children:t}),(0,D.jsx)(`div`,{style:{flex:1}}),(0,D.jsxs)(`span`,{style:{fontSize:10,color:`#6E6960`},children:[i.length,` items`]})]}),(0,D.jsx)(`div`,{style:{padding:`6px 4px`},children:i.map((e,t)=>(0,D.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`5px 10px`,paddingLeft:10+(e.indent||0)*14,color:e.accent?`#92421E`:e.kind===`folder`?`#1A1714`:`#3A3530`,fontSize:12},children:[(0,D.jsx)(`span`,{style:{fontSize:12,color:e.accent?`#92421E`:`#6E6960`},children:a[e.kind]||`·`}),(0,D.jsx)(`span`,{style:{flex:1,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.name}),(0,D.jsx)(`span`,{style:{fontSize:10.5,color:`#6E6960`},children:e.meta})]},t))})]})}function jr({cmd:e,hint:t,dark:n=!1,scale:r=1}){let i=n?`#ECE7DC`:`#1A1714`,a=n?`#A39E94`:`#6E6960`;return(0,D.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:8,padding:`6px 10px`,background:n?`#2A2723`:`#FAF8F2`,border:`1px solid ${n?`#3A3530`:`#DDD7CA`}`,borderRadius:6,fontFamily:`var(--lm-font-mono)`,fontSize:Math.round(13*r),transform:`scale(1)`},children:[(0,D.jsx)(`span`,{style:{color:`#B85B33`,fontWeight:600},children:`$`}),(0,D.jsx)(`code`,{style:{color:i,fontFamily:`inherit`},children:e}),t&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`span`,{style:{color:a},children:`·`}),(0,D.jsx)(`span`,{style:{color:a,fontFamily:`var(--lm-font-sans)`,fontSize:Math.round(12*r)},children:t})]})]})}function Mr(){return(0,D.jsxs)(`div`,{className:`lm-art`,style:{width:1270,height:760,padding:0,background:`linear-gradient(135deg, #FAF8F2 0%, #F2EEE6 50%, #E8E2D4 100%)`},children:[(0,D.jsxs)(`div`,{style:{position:`absolute`,top:80,left:80,width:560,zIndex:2},children:[(0,D.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:14,flexWrap:`wrap`},children:[(0,D.jsx)(Q,{size:32}),(0,D.jsx)(`span`,{className:`lm-mark-eyebrow`,style:{display:`inline-flex`,alignItems:`center`,lineHeight:1},children:`Open source · MIT · v0.4`})]}),(0,D.jsxs)(`h1`,{className:`lm-display`,style:{marginTop:28},children:[`Make image assets.`,(0,D.jsx)(`br`,{}),(0,D.jsx)(`em`,{children:`Keep the files.`})]}),(0,D.jsx)(`p`,{className:`lm-sub`,style:{marginTop:22},children:`An open-source canvas for the things you post — social graphics, thumbnails, banners, headers. Designed locally, exported to the folder you chose.`}),(0,D.jsx)(`div`,{style:{marginTop:28},children:(0,D.jsx)(jr,{cmd:`git clone github.com/belikely-united/lerret`,hint:`clone, build, run — that's the install`})})]}),(0,D.jsx)(`div`,{style:{position:`absolute`,top:110,right:-60,transform:`rotate(-2deg)`},children:(0,D.jsx)($,{width:680,height:420})}),(0,D.jsx)(`div`,{style:{position:`absolute`,bottom:36,left:80,display:`flex`,alignItems:`center`,gap:10,color:`#6E6960`,fontSize:12,fontWeight:500},children:[`Local-first`,`MIT-licensed`,`Plain JSON files`,`Keyboard-first`].map(e=>(0,D.jsx)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:6,padding:`6px 12px`,background:`#FAF8F2`,borderRadius:999,color:`#1A1714`,fontWeight:500,fontSize:12},children:e},e))})]})}function Nr(){return(0,D.jsxs)(`div`,{className:`lm-art`,style:{width:1270,height:760,background:`linear-gradient(135deg, #FAF8F2 0%, #F2EEE6 50%, #E8E2D4 100%)`},children:[(0,D.jsxs)(`div`,{style:{position:`absolute`,top:60,left:80,right:80},children:[(0,D.jsx)(`span`,{className:`lm-mark-eyebrow`,children:`Step 1 — Pick a folder`}),(0,D.jsxs)(`h2`,{className:`lm-display`,style:{fontSize:56,marginTop:18},children:[`Your work lives `,(0,D.jsx)(`em`,{children:`where you can see it.`})]}),(0,D.jsx)(`p`,{className:`lm-sub`,style:{marginTop:14,fontSize:17,maxWidth:720},children:`Pick a folder on your machine. Lerret remembers it. Every project, every revision, every export — saved as plain files in that folder. No cloud, no account, no proprietary format.`})]}),(0,D.jsxs)(`div`,{style:{position:`absolute`,top:290,left:80,right:80,display:`flex`,gap:28,alignItems:`flex-start`},children:[(0,D.jsxs)(`div`,{style:{flex:`0 0 380px`},children:[(0,D.jsx)(Ar,{width:380}),(0,D.jsx)(`div`,{style:{marginTop:12,fontSize:12,color:`#6E6960`,fontFamily:`var(--lm-font-mono)`},children:`~/Assets — yours, on disk`})]}),(0,D.jsx)(`div`,{style:{flex:1,paddingTop:20,transform:`rotate(-1.5deg)`},children:(0,D.jsx)($,{width:620,height:380})})]}),(0,D.jsxs)(`svg`,{style:{position:`absolute`,top:410,left:460,width:80,height:30},viewBox:`0 0 80 30`,fill:`none`,children:[(0,D.jsx)(`path`,{d:`M0 15 L70 15`,stroke:`#B85B33`,strokeWidth:`1.5`,strokeDasharray:`4 4`}),(0,D.jsx)(`path`,{d:`M64 8 L74 15 L64 22`,stroke:`#B85B33`,strokeWidth:`1.5`,fill:`none`,strokeLinecap:`round`})]})]})}function Pr(){return(0,D.jsxs)(`div`,{className:`lm-art lm-art--dark lm-art--blob`,style:{width:1270,height:760,background:`#1F1D1A`},children:[(0,D.jsx)(`div`,{className:`lm-dotgrid--dark`,style:{position:`absolute`,inset:0,opacity:.4}}),(0,D.jsxs)(`div`,{style:{position:`absolute`,top:70,left:80,right:80,zIndex:2},children:[(0,D.jsx)(`span`,{className:`lm-mark-eyebrow lm-mark-eyebrow--ondark`,children:`Step 2 — Design on the canvas`}),(0,D.jsxs)(`h2`,{className:`lm-display lm-display--dark`,style:{fontSize:56,marginTop:18},children:[`A small kit. `,(0,D.jsx)(`em`,{children:`The right defaults.`})]}),(0,D.jsx)(`p`,{className:`lm-sub lm-sub--dark`,style:{marginTop:14,maxWidth:600,fontSize:17},children:`Preset frames sized for the places you post. Type, image, shape, and a few honest blend modes. Every tool a single keystroke. Make the thing, then make it again next week.`})]}),(0,D.jsx)(`div`,{style:{position:`absolute`,top:260,left:130,zIndex:2},children:(0,D.jsx)($,{width:780,height:460})}),(0,D.jsx)(`div`,{style:{position:`absolute`,top:290,right:80,width:240,display:`flex`,flexDirection:`column`,gap:14,zIndex:2},children:[{k:`T`,l:`Text`},{k:`I`,l:`Image`},{k:`S`,l:`Shape`},{k:`F`,l:`Frame`},{k:`⌘E`,l:`Export`},{k:`⌘N`,l:`New asset`}].map(e=>(0,D.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,padding:`10px 14px`,background:`rgba(236,231,220,0.04)`,border:`1px solid rgba(236,231,220,0.10)`,borderRadius:8},children:[(0,D.jsx)(`span`,{className:`lm-bigkbd lm-bigkbd--dark`,children:e.k}),(0,D.jsx)(`span`,{style:{color:`#C4BFB4`,fontSize:14,fontWeight:500},children:e.l})]},e.k))}),(0,D.jsx)(`div`,{style:{position:`absolute`,bottom:36,left:80,zIndex:2},children:(0,D.jsx)(Q,{size:26,dark:!0})})]})}function Fr(){return(0,D.jsxs)(`div`,{className:`lm-art`,style:{width:1270,height:760,background:`linear-gradient(135deg, #FAF8F2 0%, #F2EEE6 50%, #E8E2D4 100%)`},children:[(0,D.jsxs)(`div`,{style:{position:`absolute`,top:60,left:80,right:80},children:[(0,D.jsx)(`span`,{className:`lm-mark-eyebrow`,children:`The .lerret file`}),(0,D.jsxs)(`h2`,{className:`lm-display`,style:{fontSize:52,marginTop:18},children:[`Plain JSON. `,(0,D.jsx)(`em`,{children:`Diff it. Merge it.`})]}),(0,D.jsx)(`p`,{className:`lm-sub`,style:{marginTop:14,maxWidth:700,fontSize:16},children:`A canvas is a list of layers, each with coordinates and properties. Read it in any editor. Version it in git. Generate it from a script. There is no proprietary format to outlive the company that made it.`})]}),(0,D.jsx)(`div`,{style:{position:`absolute`,top:270,left:80,width:700},children:(0,D.jsxs)(`div`,{className:`lm-codeblock`,children:[(0,D.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,marginBottom:14,paddingBottom:12,borderBottom:`1px solid #2A2723`},children:[(0,D.jsx)(`span`,{style:{width:9,height:9,borderRadius:`50%`,background:`#3A3530`}}),(0,D.jsx)(`span`,{style:{width:9,height:9,borderRadius:`50%`,background:`#3A3530`}}),(0,D.jsx)(`span`,{style:{width:9,height:9,borderRadius:`50%`,background:`#3A3530`}}),(0,D.jsx)(`span`,{style:{marginLeft:8,fontSize:11.5,color:`#A39E94`,fontWeight:500},children:`launch-post.lerret`}),(0,D.jsx)(`span`,{style:{marginLeft:`auto`,fontSize:11,color:`#6E6960`},children:`JSON · 2.4 KB`})]}),(0,D.jsxs)(`div`,{style:{fontSize:13,lineHeight:1.7},children:[(0,D.jsx)(`div`,{children:`{`}),(0,D.jsxs)(`div`,{children:[`\xA0\xA0`,(0,D.jsx)(`span`,{style:{color:`#C8D1D3`},children:`"format"`}),`: `,(0,D.jsx)(`span`,{style:{color:`#E8C9B8`},children:`"lerret/v0.4"`}),`,`]}),(0,D.jsxs)(`div`,{children:[`\xA0\xA0`,(0,D.jsx)(`span`,{style:{color:`#C8D1D3`},children:`"frame"`}),`: `,`{`]}),(0,D.jsxs)(`div`,{children:[`\xA0\xA0\xA0\xA0`,(0,D.jsx)(`span`,{style:{color:`#C8D1D3`},children:`"name"`}),`: `,(0,D.jsx)(`span`,{style:{color:`#E8C9B8`},children:`"launch-post"`}),`,`]}),(0,D.jsxs)(`div`,{children:[`\xA0\xA0\xA0\xA0`,(0,D.jsx)(`span`,{style:{color:`#C8D1D3`},children:`"w"`}),`: `,(0,D.jsx)(`span`,{style:{color:`#D8C99B`},children:`1080`}),`, `,(0,D.jsx)(`span`,{style:{color:`#C8D1D3`},children:`"h"`}),`: `,(0,D.jsx)(`span`,{style:{color:`#D8C99B`},children:`1350`}),`,`]}),(0,D.jsxs)(`div`,{children:[`\xA0\xA0\xA0\xA0`,(0,D.jsx)(`span`,{style:{color:`#C8D1D3`},children:`"preset"`}),`: `,(0,D.jsx)(`span`,{style:{color:`#E8C9B8`},children:`"instagram-4x5"`})]}),(0,D.jsxs)(`div`,{children:[`\xA0\xA0`,`}`,`,`]}),(0,D.jsxs)(`div`,{children:[`\xA0\xA0`,(0,D.jsx)(`span`,{style:{color:`#C8D1D3`},children:`"layers"`}),`: [`]}),(0,D.jsxs)(`div`,{children:[`\xA0\xA0\xA0\xA0`,`{ `,(0,D.jsx)(`span`,{style:{color:`#C8D1D3`},children:`"type"`}),`: `,(0,D.jsx)(`span`,{style:{color:`#E8C9B8`},children:`"text"`}),`, `,(0,D.jsx)(`span`,{style:{color:`#C8D1D3`},children:`"text"`}),`: `,(0,D.jsx)(`span`,{style:{color:`#E8C9B8`},children:`"v0.4 is out."`}),` `,`},`]}),(0,D.jsxs)(`div`,{children:[`\xA0\xA0\xA0\xA0`,`{ `,(0,D.jsx)(`span`,{style:{color:`#C8D1D3`},children:`"type"`}),`: `,(0,D.jsx)(`span`,{style:{color:`#E8C9B8`},children:`"image"`}),`, `,(0,D.jsx)(`span`,{style:{color:`#C8D1D3`},children:`"src"`}),`: `,(0,D.jsx)(`span`,{style:{color:`#E8C9B8`},children:`"./photo.jpg"`}),` `,`}`]}),(0,D.jsx)(`div`,{children:`\xA0\xA0],`}),(0,D.jsxs)(`div`,{children:[`\xA0\xA0`,(0,D.jsx)(`span`,{style:{color:`#C8D1D3`},children:`"export"`}),`: `,`{ `,(0,D.jsx)(`span`,{style:{color:`#C8D1D3`},children:`"format"`}),`: `,(0,D.jsx)(`span`,{style:{color:`#E8C9B8`},children:`"png"`}),`, `,(0,D.jsx)(`span`,{style:{color:`#C8D1D3`},children:`"scale"`}),`: `,(0,D.jsx)(`span`,{style:{color:`#D8C99B`},children:`2`}),` `,`}`]}),(0,D.jsx)(`div`,{children:`}`})]})]})}),(0,D.jsx)(`div`,{style:{position:`absolute`,top:290,right:80,width:360},children:[{h:`Readable`,b:`By humans, by grep, by any text editor.`},{h:`Diffable`,b:`Open a PR on a design change. Review it line-by-line.`},{h:`Scriptable`,b:`Generate variants from a list. The format is just JSON.`}].map((e,t)=>(0,D.jsxs)(`div`,{style:{marginBottom:26},children:[(0,D.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,gap:10},children:[(0,D.jsxs)(`span`,{style:{fontFamily:`var(--lm-font-mono)`,fontSize:11,color:`#6E6960`},children:[`0`,t+1]}),(0,D.jsx)(`span`,{style:{fontFamily:`var(--lm-font-display)`,fontSize:24,color:`#1A1714`,letterSpacing:`-0.02em`},children:e.h})]}),(0,D.jsx)(`p`,{style:{margin:`8px 0 0 26px`,fontSize:14,lineHeight:1.5,color:`#3A3530`},children:e.b})]},t))})]})}function Ir(){return(0,D.jsxs)(`div`,{className:`lm-art`,style:{width:1270,height:760,background:`linear-gradient(135deg, #FAF8F2 0%, #F2EEE6 50%, #E8E2D4 100%)`},children:[(0,D.jsxs)(`div`,{style:{position:`absolute`,top:60,left:80,right:80},children:[(0,D.jsx)(`span`,{className:`lm-mark-eyebrow`,children:`The loop`}),(0,D.jsxs)(`h2`,{className:`lm-display`,style:{fontSize:56,marginTop:18},children:[`Design, export, post. `,(0,D.jsx)(`em`,{children:`Then do it again.`})]})]}),(0,D.jsx)(`div`,{style:{position:`absolute`,top:240,left:80,right:80,display:`grid`,gridTemplateColumns:`1fr 1fr 1fr`,gap:24,alignItems:`stretch`},children:[{label:`Design`,note:`on the canvas`,mock:(0,D.jsx)($,{width:340,height:220,artboardW:120,artboardH:150})},{label:`Export`,note:`into your folder`,mock:(0,D.jsx)(Ar,{width:340,height:220,rows:[{kind:`folder`,name:`social/`,meta:`12 files`},{kind:`lerret`,name:`launch-post.lerret`,meta:`2.4 KB`,indent:1,accent:!0},{kind:`image`,name:`launch-post@2x.png`,meta:`412 KB`,indent:1},{kind:`image`,name:`launch-post.jpg`,meta:`186 KB`,indent:1}]})},{label:`Post`,note:`wherever you post`,mock:(0,D.jsx)(`div`,{style:{width:340,height:220,display:`grid`,gridTemplateColumns:`1fr 1fr`,gridTemplateRows:`1fr 1fr`,gap:8},children:[`IG`,`X`,`LinkedIn`,`Substack`].map((e,t)=>(0,D.jsx)(`div`,{style:{background:`#FAF8F2`,border:`1px solid #DDD7CA`,borderRadius:6,display:`flex`,alignItems:`center`,justifyContent:`center`,fontFamily:`var(--lm-font-display)`,fontSize:28,color:t===0?`#92421E`:`#1A1714`,fontStyle:t===0?`italic`:`normal`,boxShadow:t===0?`0 8px 20px -10px rgba(184,91,51,0.4)`:`none`},children:e},e))})}].map((e,t)=>(0,D.jsxs)(`div`,{children:[(0,D.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,gap:12,marginBottom:14},children:[(0,D.jsxs)(`span`,{style:{fontFamily:`var(--lm-font-mono)`,fontSize:12,color:`#6E6960`},children:[`0`,t+1]}),(0,D.jsx)(`span`,{style:{fontFamily:`var(--lm-font-display)`,fontSize:32,color:`#1A1714`,letterSpacing:`-0.02em`},children:e.label})]}),e.mock,(0,D.jsx)(`div`,{style:{marginTop:10,fontSize:14,color:`#3A3530`},children:e.note})]},e.label))}),(0,D.jsxs)(`div`,{style:{position:`absolute`,bottom:36,left:80,fontSize:13,color:`#6E6960`,display:`flex`,alignItems:`center`,gap:12},children:[(0,D.jsx)(Q,{size:20}),(0,D.jsx)(`span`,{style:{marginLeft:8},children:`The shortcuts assume you will do this again tomorrow, and the day after.`})]})]})}function Lr(){return(0,D.jsxs)(`div`,{className:`lm-art`,style:{width:1270,height:760,background:`linear-gradient(135deg, #FAF8F2 0%, #F2EEE6 50%, #E8E2D4 100%)`},children:[(0,D.jsxs)(`div`,{style:{position:`absolute`,top:80,left:80,right:80},children:[(0,D.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:14,flexWrap:`wrap`},children:[(0,D.jsx)(Q,{size:28}),(0,D.jsx)(`span`,{className:`lm-mark-eyebrow`,children:`Templates that fork`})]}),(0,D.jsxs)(`h2`,{className:`lm-display`,style:{fontSize:56,marginTop:28,maxWidth:880},children:[`Save one as another. `,(0,D.jsx)(`em`,{children:`Build a series from a single master.`})]}),(0,D.jsx)(`p`,{className:`lm-sub`,style:{marginTop:18,maxWidth:720,fontSize:17},children:`Every artboard is forkable. Duplicate a launch post, swap the headline, ship the next one. No global library to babysit — your templates are folders on disk.`})]}),(0,D.jsx)(`div`,{style:{position:`absolute`,top:380,left:80,right:80,display:`grid`,gridTemplateColumns:`repeat(4, 1fr)`,gap:16},children:[{title:`Launch post`,dim:`1080 × 1350`,accent:!0},{title:`Story`,dim:`1080 × 1920`},{title:`OG card`,dim:`1200 × 630`},{title:`Banner`,dim:`1500 × 500`},{title:`Thumbnail`,dim:`1280 × 720`},{title:`Profile`,dim:`400 × 400`},{title:`Poster`,dim:`2400 × 3000`},{title:`Blank`,dim:`any size`}].map(e=>(0,D.jsxs)(`div`,{style:{padding:`16px 18px`,background:e.accent?`#E8C9B8`:`#FAF8F2`,border:e.accent?`1.5px solid #B85B33`:`1px solid #DDD7CA`,borderRadius:8,display:`flex`,flexDirection:`column`,gap:6,minHeight:100},children:[(0,D.jsx)(`div`,{style:{fontFamily:`var(--lm-font-display)`,fontSize:22,color:e.accent?`#92421E`:`#1A1714`,letterSpacing:`-0.015em`},children:e.title}),(0,D.jsx)(`div`,{style:{flex:1}}),(0,D.jsx)(`div`,{style:{fontFamily:`var(--lm-font-mono)`,fontSize:11,color:`#6E6960`},children:e.dim})]},e.title))})]})}function Rr(){return(0,D.jsxs)(`div`,{className:`lm-art`,style:{width:1080,height:1350,background:`linear-gradient(135deg, #FAF8F2 0%, #F2EEE6 50%, #E8E2D4 100%)`},children:[(0,D.jsx)(`div`,{style:{position:`absolute`,top:72,left:72},children:(0,D.jsx)(Q,{size:36})}),(0,D.jsx)(`span`,{className:`lm-mark-eyebrow`,style:{position:`absolute`,top:152,left:72},children:`Launching today on Product Hunt`}),(0,D.jsxs)(`h1`,{className:`lm-display`,style:{position:`absolute`,top:200,left:72,right:72,fontSize:88,lineHeight:.96,margin:0},children:[`Make image assets.`,(0,D.jsx)(`br`,{}),(0,D.jsx)(`em`,{children:`Keep the files.`})]}),(0,D.jsx)(`div`,{style:{position:`absolute`,top:480,left:`50%`,transform:`translateX(-50%) rotate(-2deg)`},children:(0,D.jsx)($,{width:760,height:460,artboardW:210,artboardH:260})}),(0,D.jsx)(`p`,{className:`lm-sub`,style:{position:`absolute`,bottom:200,left:72,right:72,fontSize:22,lineHeight:1.45,maxWidth:880,margin:0},children:`An open-source canvas tool for the things you post. Pick a folder. Design on the canvas. Export as plain image files. No cloud, no proprietary format, no account.`}),(0,D.jsxs)(`div`,{style:{position:`absolute`,bottom:80,left:72,right:72,display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,D.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10,flexWrap:`wrap`},children:[`Local-first`,`MIT`,`Plain JSON`,`Keyboard-first`].map(e=>(0,D.jsx)(`span`,{style:{display:`inline-flex`,alignItems:`center`,padding:`8px 14px`,background:`#FAF8F2`,borderRadius:999,color:`#1A1714`,fontWeight:500,fontSize:14},children:e},e))}),(0,D.jsx)(`span`,{style:{color:`#3A3530`,fontWeight:600,fontFamily:`var(--lm-font-mono)`,fontSize:14},children:`github.com/belikely-united/lerret`})]})]})}function zr(){return(0,D.jsxs)(`div`,{className:`lm-art lm-art--dark lm-art--blob`,style:{width:1080,height:1080,background:`#1F1D1A`},children:[(0,D.jsx)(`div`,{className:`lm-dotgrid--dark`,style:{position:`absolute`,inset:0,opacity:.5}}),(0,D.jsx)(`div`,{style:{position:`absolute`,top:80,left:80},children:(0,D.jsx)(Q,{size:36,dark:!0})}),(0,D.jsx)(`span`,{className:`lm-mark-eyebrow lm-mark-eyebrow--ondark`,style:{position:`absolute`,top:220,left:80},children:`Open source · v0.4`}),(0,D.jsxs)(`h1`,{className:`lm-display lm-display--dark`,style:{position:`absolute`,top:280,left:80,right:80,fontSize:104,lineHeight:.95},children:[`Make image assets.`,(0,D.jsx)(`br`,{}),(0,D.jsx)(`em`,{children:`Keep the files.`})]}),(0,D.jsx)(`p`,{className:`lm-sub lm-sub--dark`,style:{position:`absolute`,top:700,left:80,right:80,fontSize:24,maxWidth:800},children:`A canvas in the folder you chose. Plain JSON. Forkable. Built for the post loop.`}),(0,D.jsxs)(`div`,{style:{position:`absolute`,bottom:80,left:80,right:80,display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,D.jsx)(`div`,{style:{display:`flex`,gap:12},children:[`Local-first`,`MIT`,`Plain JSON`].map(e=>(0,D.jsx)(`span`,{style:{display:`inline-flex`,alignItems:`center`,padding:`8px 16px`,background:`rgba(236,231,220,0.06)`,borderRadius:999,color:`#ECE7DC`,fontWeight:500,fontSize:15},children:e},e))}),(0,D.jsx)(`span`,{style:{color:`#A39E94`,fontFamily:`var(--lm-font-mono)`,fontSize:14},children:`github.com/belikely-united/lerret`})]})]})}function Br(){return(0,D.jsxs)(`div`,{className:`lm-art`,style:{width:1080,height:1080,background:`linear-gradient(135deg, #FAF8F2 0%, #F2EEE6 50%, #E8E2D4 100%)`},children:[(0,D.jsx)(`div`,{style:{position:`absolute`,top:80,left:80},children:(0,D.jsx)(Q,{size:32})}),(0,D.jsxs)(`div`,{style:{position:`absolute`,top:220,left:80,right:80},children:[(0,D.jsx)(`span`,{className:`lm-mark-eyebrow`,children:`Keyboard-first`}),(0,D.jsxs)(`h1`,{className:`lm-display`,style:{fontSize:88,lineHeight:.96,marginTop:22},children:[`One key.`,(0,D.jsx)(`br`,{}),`One export.`,(0,D.jsx)(`br`,{}),(0,D.jsx)(`em`,{children:`Done.`})]})]}),(0,D.jsxs)(`div`,{style:{position:`absolute`,bottom:100,left:80,display:`flex`,alignItems:`flex-end`,gap:36},children:[(0,D.jsx)(`div`,{style:{width:300,height:300,background:`#FAF8F2`,border:`1.5px solid #DDD7CA`,borderBottom:`10px solid #C7C0AF`,borderRadius:28,display:`flex`,alignItems:`center`,justifyContent:`center`,fontFamily:`var(--lm-font-mono)`,fontSize:130,fontWeight:600,color:`#1A1714`,boxShadow:`0 24px 60px rgba(26,23,20,0.10)`,letterSpacing:`-0.05em`},children:`⌘E`}),(0,D.jsxs)(`div`,{style:{paddingBottom:36,maxWidth:480},children:[(0,D.jsx)(`div`,{style:{font:`600 14px/1 var(--lm-font-sans)`,color:`#6E6960`,textTransform:`uppercase`,letterSpacing:`0.14em`},children:`Press`}),(0,D.jsxs)(`div`,{style:{font:`400 36px/1.1 var(--lm-font-display)`,color:`#1A1714`,marginTop:16,letterSpacing:`-0.02em`},children:[`and the file lands`,(0,D.jsx)(`br`,{}),`in the folder you chose.`]}),(0,D.jsx)(`div`,{style:{marginTop:26,font:`500 14px/1 var(--lm-font-mono)`,color:`#92421E`},children:`PNG · JPG · SVG · WebP · PDF`})]})]})]})}function Vr(){return(0,D.jsxs)(`div`,{className:`lm-art`,style:{width:1200,height:675,background:`linear-gradient(135deg, #FAF8F2 0%, #F2EEE6 50%, #E8E2D4 100%)`},children:[(0,D.jsx)(`div`,{style:{position:`absolute`,top:40,left:56},children:(0,D.jsx)(Q,{size:28})}),(0,D.jsxs)(`h1`,{className:`lm-display`,style:{position:`absolute`,top:116,left:56,fontSize:60,lineHeight:1.04,margin:0,maxWidth:660},children:[`I just wanted my `,(0,D.jsx)(`em`,{children:`files back.`})]}),(0,D.jsx)(`p`,{className:`lm-sub`,style:{position:`absolute`,top:340,left:56,right:460,fontSize:18,lineHeight:1.55,margin:0},children:`Built an open-source canvas for making image assets that saves to a folder you choose. Plain JSON, MIT licensed, no account, no cloud. The export button writes a file. That’s it.`}),(0,D.jsx)(`div`,{style:{position:`absolute`,top:50,right:60,transform:`rotate(-3deg)`},children:(0,D.jsx)($,{width:420,height:280,artboardW:120,artboardH:150})}),(0,D.jsxs)(`div`,{style:{position:`absolute`,bottom:40,left:56,right:56,display:`flex`,justifyContent:`space-between`,alignItems:`center`,color:`#6E6960`,font:`500 13px/1 var(--lm-font-sans)`},children:[(0,D.jsx)(`span`,{children:"Local-first · MIT · `.lerret` is plain JSON"}),(0,D.jsx)(`span`,{style:{color:`#1A1714`,fontWeight:600},children:`github.com/belikely-united/lerret`})]})]})}function Hr(){return(0,D.jsxs)(`div`,{className:`lm-art`,style:{width:1200,height:630,background:`linear-gradient(135deg, #FAF8F2 0%, #F2EEE6 50%, #E8E2D4 100%)`},children:[(0,D.jsx)(`div`,{style:{position:`absolute`,top:56,left:72},children:(0,D.jsx)(Q,{size:56})}),(0,D.jsxs)(`div`,{style:{position:`absolute`,top:200,left:72,width:600},children:[(0,D.jsxs)(`h1`,{className:`lm-display`,style:{margin:0,fontSize:80,lineHeight:.98},children:[`Make image assets.`,(0,D.jsx)(`br`,{}),(0,D.jsx)(`em`,{children:`Keep the files.`})]}),(0,D.jsx)(`p`,{className:`lm-sub`,style:{marginTop:24,fontSize:20,lineHeight:1.4,maxWidth:560},children:`An open-source canvas. Local-first. MIT. Plain JSON files in the folder you chose.`})]}),(0,D.jsx)(`div`,{style:{position:`absolute`,top:100,right:56,transform:`rotate(-2deg)`},children:(0,D.jsx)($,{width:460,height:290,artboardW:130,artboardH:165})})]})}function Ur(){return(0,D.jsx)(`div`,{className:`lm-art`,style:{width:240,height:240,background:`#1F1D1A`,borderRadius:`50%`,border:`1px solid rgba(26,23,20,0.10)`,display:`flex`,alignItems:`center`,justifyContent:`center`,overflow:`hidden`},children:(0,D.jsx)(`img`,{src:`/assets/lerret-logo.png`,alt:`Lerret`,style:{width:144,height:144,borderRadius:28,objectFit:`cover`}})})}function Wr(){return(0,D.jsxs)(`div`,{className:`lm-art`,style:{width:1600,height:900,background:`linear-gradient(135deg, #FAF8F2 0%, #F2EEE6 50%, #E8E2D4 100%)`},children:[(0,D.jsx)(`div`,{style:{position:`absolute`,top:80,left:100},children:(0,D.jsx)(Q,{size:68})}),(0,D.jsxs)(`div`,{style:{position:`absolute`,top:220,left:100,width:880},children:[(0,D.jsxs)(`h1`,{className:`lm-display`,style:{margin:0,fontSize:104,lineHeight:.96},children:[`Make image assets.`,(0,D.jsx)(`br`,{}),(0,D.jsx)(`em`,{children:`Keep the files.`})]}),(0,D.jsx)(`p`,{className:`lm-sub`,style:{marginTop:32,fontSize:26,lineHeight:1.4,maxWidth:760},children:`An open-source canvas for the things you post. Local-first. MIT-licensed. Plain JSON.`}),(0,D.jsx)(`div`,{style:{marginTop:36},children:(0,D.jsx)(jr,{cmd:`git clone github.com/belikely-united/lerret`,hint:`clone, build, run`,scale:1.15})})]}),(0,D.jsx)(`div`,{style:{position:`absolute`,bottom:64,left:100,display:`flex`,gap:12,fontSize:14,color:`#3A3530`},children:[`Local-first`,`MIT-licensed`,`Plain JSON files`,`Keyboard-first`].map(e=>(0,D.jsx)(`span`,{style:{display:`inline-flex`,alignItems:`center`,padding:`10px 18px`,background:`#FAF8F2`,borderRadius:999,color:`#1A1714`,fontWeight:500,fontSize:16},children:e},e))}),(0,D.jsx)(`div`,{style:{position:`absolute`,top:130,right:110,transform:`rotate(-2deg)`},children:(0,D.jsx)($,{width:620,height:400,artboardW:170,artboardH:210})})]})}function Gr(){return(0,D.jsxs)(`div`,{className:`lm-art`,style:{width:440,height:280,background:`linear-gradient(135deg, #FAF8F2 0%, #F2EEE6 50%, #E8E2D4 100%)`},children:[(0,D.jsx)(`div`,{style:{position:`absolute`,top:28,left:32},children:(0,D.jsx)(Q,{size:26})}),(0,D.jsx)(`div`,{style:{position:`absolute`,top:84,left:32,width:240},children:(0,D.jsxs)(`h1`,{className:`lm-display`,style:{margin:0,fontSize:32,lineHeight:.98},children:[`Make image`,(0,D.jsx)(`br`,{}),`assets.`,(0,D.jsx)(`br`,{}),(0,D.jsx)(`em`,{children:`Keep the files.`})]})}),(0,D.jsx)(`div`,{style:{position:`absolute`,top:26,right:-10,transform:`rotate(-2deg)`},children:(0,D.jsx)($,{width:188,height:140,artboardW:56,artboardH:70})})]})}function Kr(){return(0,D.jsxs)(`div`,{className:`lm-art`,style:{width:920,height:680,background:`linear-gradient(135deg, #FAF8F2 0%, #F2EEE6 50%, #E8E2D4 100%)`},children:[(0,D.jsx)(`div`,{style:{position:`absolute`,top:56,left:56},children:(0,D.jsx)(Q,{size:42})}),(0,D.jsxs)(`div`,{style:{position:`absolute`,top:200,left:56,width:480},children:[(0,D.jsxs)(`h1`,{className:`lm-display`,style:{margin:0,fontSize:60,lineHeight:.98},children:[`Make image assets.`,(0,D.jsx)(`br`,{}),(0,D.jsx)(`em`,{children:`Keep the files.`})]}),(0,D.jsx)(`p`,{className:`lm-sub`,style:{marginTop:22,fontSize:17,lineHeight:1.45,maxWidth:440},children:`An open-source canvas. Pick a folder. Design. Export as plain image files. No cloud, no proprietary format.`})]}),(0,D.jsx)(`div`,{style:{position:`absolute`,bottom:48,left:56,display:`flex`,gap:8,flexWrap:`wrap`},children:[`Local-first`,`MIT`,`Plain JSON`,`Keyboard-first`].map(e=>(0,D.jsx)(`span`,{style:{display:`inline-flex`,alignItems:`center`,padding:`8px 14px`,background:`#FAF8F2`,borderRadius:999,color:`#1A1714`,fontWeight:500,fontSize:13},children:e},e))}),(0,D.jsx)(`div`,{style:{position:`absolute`,top:80,right:50,transform:`rotate(-2deg)`},children:(0,D.jsx)($,{width:350,height:240,artboardW:100,artboardH:125})})]})}function qr(){return(0,D.jsxs)(`div`,{className:`lm-art`,style:{width:1400,height:560,background:`linear-gradient(135deg, #FAF8F2 0%, #F2EEE6 50%, #E8E2D4 100%)`},children:[(0,D.jsx)(`div`,{style:{position:`absolute`,top:56,left:80},children:(0,D.jsx)(Q,{size:50})}),(0,D.jsxs)(`div`,{style:{position:`absolute`,top:180,left:80,width:720},children:[(0,D.jsxs)(`h1`,{className:`lm-display`,style:{margin:0,fontSize:80,lineHeight:.98},children:[`Make image assets.`,(0,D.jsx)(`br`,{}),(0,D.jsx)(`em`,{children:`Keep the files.`})]}),(0,D.jsx)(`p`,{className:`lm-sub`,style:{marginTop:24,fontSize:22,lineHeight:1.4,maxWidth:660},children:`An open-source canvas for the things you post. Plain files in the folder you chose.`})]}),(0,D.jsx)(`div`,{style:{position:`absolute`,bottom:60,left:80},children:(0,D.jsx)(jr,{cmd:`git clone github.com/belikely-united/lerret`,hint:`clone, build, run`,scale:1.1})}),(0,D.jsx)(`div`,{style:{position:`absolute`,top:80,right:60,transform:`rotate(-2deg)`},children:(0,D.jsx)($,{width:460,height:310,artboardW:130,artboardH:165})})]})}function Jr({caption:e,captionStrong:t,kbd:n,code:r,children:i}){return(0,D.jsxs)(`div`,{className:`lm-art`,style:{width:1280,height:800,background:`linear-gradient(135deg, #FAF8F2 0%, #F2EEE6 50%, #E8E2D4 100%)`},children:[(0,D.jsxs)(`div`,{style:{position:`absolute`,top:36,left:48,display:`flex`,alignItems:`center`,gap:10,color:`#3A3530`,font:`600 13px/1 var(--lm-font-sans)`},children:[(0,D.jsx)(Q,{size:22}),(0,D.jsx)(`span`,{style:{marginLeft:4,color:`#6E6960`},children:`· open-source canvas`})]}),(0,D.jsxs)(`div`,{style:{position:`absolute`,top:84,left:48,right:48,bottom:48},children:[i,(0,D.jsxs)(`div`,{style:{position:`absolute`,left:28,bottom:28,display:`inline-flex`,alignItems:`center`,gap:12,padding:`10px 16px`,background:`rgba(250,248,242,0.95)`,border:`1px solid rgba(26,23,20,0.06)`,borderRadius:12,boxShadow:`0 8px 24px rgba(26,23,20,0.10)`,maxWidth:`calc(100% - 56px)`},children:[n?(0,D.jsx)(`span`,{style:{font:`600 12px/1 var(--lm-font-mono)`,color:`#92421E`,flexShrink:0},children:n}):null,(0,D.jsxs)(`span`,{style:{font:`500 13px/1.45 var(--lm-font-sans)`,color:`#1A1714`},children:[t?(0,D.jsxs)(`b`,{style:{fontWeight:600},children:[t,` `]}):null,e,r?(0,D.jsxs)(D.Fragment,{children:[` `,(0,D.jsx)(`code`,{style:{font:`600 12px/1 var(--lm-font-mono)`,color:`#1A1714`,background:`#E8E2D4`,padding:`2px 6px`,borderRadius:4},children:r})]}):null]})]})]})]})}function Yr(){return(0,D.jsx)(Jr,{kbd:`Step 1`,captionStrong:`Pick a folder.`,caption:`Lerret remembers it. Every project, every revision saves there.`,children:(0,D.jsxs)(`div`,{style:{position:`absolute`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:56},children:[(0,D.jsx)(Ar,{width:420}),(0,D.jsx)(`div`,{style:{font:`300 36px/1 var(--lm-font-sans)`,color:`#92421E`},children:`→`}),(0,D.jsx)($,{width:520,height:340,artboardW:150,artboardH:185})]})})}function Xr(){return(0,D.jsx)(Jr,{kbd:`Step 2`,captionStrong:`Design on the canvas.`,caption:`Preset frames sized for the places you post. Type, image, shape — every tool a single keystroke.`,children:(0,D.jsx)(`div`,{style:{position:`absolute`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,D.jsx)($,{width:920,height:560,artboardW:260,artboardH:325})})})}function Zr(){return(0,D.jsx)(Jr,{kbd:`Step 3`,captionStrong:`Export.`,caption:`PNG, JPG, SVG, WebP, PDF. The file lands in the folder you chose. No cloud round-trip.`,children:(0,D.jsxs)(`div`,{style:{position:`absolute`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:60},children:[(0,D.jsx)($,{width:500,height:340,artboardW:150,artboardH:185}),(0,D.jsx)(`div`,{style:{font:`300 36px/1 var(--lm-font-sans)`,color:`#92421E`},children:`→`}),(0,D.jsx)(Ar,{width:400,rows:[{kind:`folder`,name:`social/`,meta:`12 files`},{kind:`lerret`,name:`launch-post.lerret`,meta:`2.4 KB`,indent:1,accent:!0},{kind:`image`,name:`launch-post@2x.png`,meta:`412 KB`,indent:1,accent:!0},{kind:`image`,name:`launch-post.jpg`,meta:`186 KB`,indent:1},{kind:`image`,name:`launch-post.svg`,meta:`84 KB`,indent:1}]})]})})}function Qr(){return(0,D.jsx)(Jr,{caption:`The`,code:`.lerret`,captionStrong:``,children:(0,D.jsx)(`div`,{style:{position:`absolute`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,D.jsxs)(`div`,{style:{width:760,background:`#15130F`,borderRadius:14,overflow:`hidden`,boxShadow:`0 28px 72px rgba(26,23,20,0.32)`},children:[(0,D.jsxs)(`div`,{style:{padding:`12px 16px`,borderBottom:`1px solid #2A2723`,display:`flex`,alignItems:`center`,gap:10},children:[(0,D.jsx)(`span`,{style:{width:10,height:10,borderRadius:`50%`,background:`#3A3530`}}),(0,D.jsx)(`span`,{style:{width:10,height:10,borderRadius:`50%`,background:`#3A3530`}}),(0,D.jsx)(`span`,{style:{width:10,height:10,borderRadius:`50%`,background:`#3A3530`}}),(0,D.jsx)(`span`,{style:{marginLeft:10,font:`500 12px/1 var(--lm-font-mono)`,color:`#A39E94`},children:`launch-post.lerret`}),(0,D.jsx)(`span`,{style:{marginLeft:`auto`,font:`500 11px/1 var(--lm-font-mono)`,color:`#6E6960`},children:`JSON · 2.4 KB`})]}),(0,D.jsxs)(`div`,{style:{padding:`26px 30px`,font:`500 15px/1.75 var(--lm-font-mono)`,color:`#ECE7DC`},children:[(0,D.jsx)(`div`,{children:`{`}),(0,D.jsxs)(`div`,{children:[`\xA0\xA0`,(0,D.jsx)(`span`,{style:{color:`#C8D1D3`},children:`"format"`}),`: `,(0,D.jsx)(`span`,{style:{color:`#E8C9B8`},children:`"lerret/v0.4"`}),`,`]}),(0,D.jsxs)(`div`,{children:[`\xA0\xA0`,(0,D.jsx)(`span`,{style:{color:`#C8D1D3`},children:`"frame"`}),`: `,`{`]}),(0,D.jsxs)(`div`,{children:[`\xA0\xA0\xA0\xA0`,(0,D.jsx)(`span`,{style:{color:`#C8D1D3`},children:`"name"`}),`: `,(0,D.jsx)(`span`,{style:{color:`#E8C9B8`},children:`"launch-post"`}),`,`]}),(0,D.jsxs)(`div`,{children:[`\xA0\xA0\xA0\xA0`,(0,D.jsx)(`span`,{style:{color:`#C8D1D3`},children:`"w"`}),`: `,(0,D.jsx)(`span`,{style:{color:`#D8C99B`},children:`1080`}),`, `,(0,D.jsx)(`span`,{style:{color:`#C8D1D3`},children:`"h"`}),`: `,(0,D.jsx)(`span`,{style:{color:`#D8C99B`},children:`1350`}),`,`]}),(0,D.jsxs)(`div`,{children:[`\xA0\xA0\xA0\xA0`,(0,D.jsx)(`span`,{style:{color:`#C8D1D3`},children:`"preset"`}),`: `,(0,D.jsx)(`span`,{style:{color:`#E8C9B8`},children:`"instagram-4x5"`})]}),(0,D.jsxs)(`div`,{children:[`\xA0\xA0`,`}`,`,`]}),(0,D.jsxs)(`div`,{children:[`\xA0\xA0`,(0,D.jsx)(`span`,{style:{color:`#C8D1D3`},children:`"layers"`}),`: [`]}),(0,D.jsxs)(`div`,{children:[`\xA0\xA0\xA0\xA0`,`{ `,(0,D.jsx)(`span`,{style:{color:`#C8D1D3`},children:`"type"`}),`: `,(0,D.jsx)(`span`,{style:{color:`#E8C9B8`},children:`"text"`}),`, `,(0,D.jsx)(`span`,{style:{color:`#C8D1D3`},children:`"text"`}),`: `,(0,D.jsx)(`span`,{style:{color:`#E8C9B8`},children:`"v0.4 is out."`}),` `,`},`]}),(0,D.jsxs)(`div`,{children:[`\xA0\xA0\xA0\xA0`,`{ `,(0,D.jsx)(`span`,{style:{color:`#C8D1D3`},children:`"type"`}),`: `,(0,D.jsx)(`span`,{style:{color:`#E8C9B8`},children:`"image"`}),`, `,(0,D.jsx)(`span`,{style:{color:`#C8D1D3`},children:`"src"`}),`: `,(0,D.jsx)(`span`,{style:{color:`#E8C9B8`},children:`"./photo.jpg"`}),` `,`}`]}),(0,D.jsx)(`div`,{children:`\xA0\xA0]`}),(0,D.jsx)(`div`,{children:`}`})]})]})})})}function $r(){return(0,D.jsx)(Jr,{caption:`Preset frames sized for the places you post — Instagram, X, LinkedIn, blogs, OG cards, YouTube thumbnails.`,children:(0,D.jsx)(`div`,{style:{position:`absolute`,inset:0,display:`grid`,gridTemplateColumns:`repeat(4, 1fr)`,gap:16,padding:`20px 0 80px`,alignContent:`center`},children:[{l:`Square`,dim:`1080 × 1080`,accent:!0},{l:`Portrait`,dim:`1080 × 1350`},{l:`Story`,dim:`1080 × 1920`},{l:`OG card`,dim:`1200 × 630`},{l:`Thumbnail`,dim:`1280 × 720`},{l:`Banner`,dim:`1500 × 500`},{l:`Blog`,dim:`2400 × 1260`},{l:`Profile`,dim:`400 × 400`}].map(e=>(0,D.jsxs)(`div`,{style:{padding:`20px 22px`,background:e.accent?`#E8C9B8`:`#FAF8F2`,border:e.accent?`1.5px solid #B85B33`:`1px solid #DDD7CA`,borderRadius:8,display:`flex`,flexDirection:`column`,justifyContent:`space-between`,minHeight:110},children:[(0,D.jsx)(`div`,{style:{fontFamily:`var(--lm-font-display)`,fontSize:24,color:e.accent?`#92421E`:`#1A1714`,letterSpacing:`-0.015em`},children:e.l}),(0,D.jsx)(`div`,{style:{fontFamily:`var(--lm-font-mono)`,fontSize:12,color:`#6E6960`},children:e.dim})]},e.l))})})}function ei(){return(0,D.jsx)(Jr,{caption:`Save one as another. Build a series from a single master. Fork the templates — yours after that.`,children:(0,D.jsx)(`div`,{style:{position:`absolute`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:24},children:[`Launch v0.3`,`Launch v0.4`,`Hiring post`,`Blog header`].map((e,t)=>(0,D.jsxs)(`div`,{style:{width:200,height:250,background:t===1?`#E8C9B8`:`#FAF8F2`,border:t===1?`1.5px solid #B85B33`:`1px solid #DDD7CA`,borderRadius:6,position:`relative`,transform:`rotate(${t===1?0:(t-1.5)*2}deg)`,boxShadow:t===1?`0 18px 40px -20px rgba(184,91,51,0.4)`:`0 12px 30px -18px rgba(26,23,20,0.30)`,display:`flex`,flexDirection:`column`,padding:18},children:[(0,D.jsx)(`div`,{style:{fontFamily:`var(--lm-font-sans)`,fontSize:7,letterSpacing:`0.18em`,textTransform:`uppercase`,color:`#6E6960`},children:`Lerret · Template`}),(0,D.jsx)(`div`,{style:{fontFamily:`var(--lm-font-display)`,fontSize:22,color:t===1?`#92421E`:`#1A1714`,marginTop:14,lineHeight:1.05},children:e}),(0,D.jsx)(`div`,{style:{flex:1}}),(0,D.jsx)(`div`,{style:{fontFamily:`var(--lm-font-mono)`,fontSize:10,color:`#6E6960`},children:`1080 × 1350 · 4:5`})]},e))})})}function ti(){return(0,D.jsxs)(`div`,{className:`lm-art`,style:{width:1280,height:720,background:`linear-gradient(135deg, #FAF8F2 0%, #F2EEE6 50%, #E8E2D4 100%)`},children:[(0,D.jsxs)(`div`,{style:{position:`absolute`,top:56,left:64,display:`flex`,alignItems:`center`,gap:14},children:[(0,D.jsx)(Q,{size:44}),(0,D.jsx)(`span`,{style:{marginLeft:4,font:`600 12px/1 var(--lm-font-mono)`,letterSpacing:`0.18em`,textTransform:`uppercase`,color:`#6E6960`},children:`Demo`})]}),(0,D.jsxs)(`div`,{style:{position:`absolute`,top:180,left:64,width:760},children:[(0,D.jsxs)(`h1`,{className:`lm-display`,style:{margin:0,fontSize:110,lineHeight:.94},children:[`Make image assets.`,(0,D.jsx)(`br`,{}),(0,D.jsx)(`em`,{children:`Keep the files.`})]}),(0,D.jsx)(`p`,{className:`lm-sub`,style:{marginTop:28,fontSize:22,lineHeight:1.4,maxWidth:660,fontWeight:500},children:`A 60-second tour of the canvas, the folder, and the export button.`})]}),(0,D.jsx)(`div`,{style:{position:`absolute`,bottom:56,left:64,display:`flex`,alignItems:`center`,gap:12},children:[`Local-first`,`MIT`,`Plain JSON`].map(e=>(0,D.jsx)(`span`,{style:{display:`inline-flex`,alignItems:`center`,padding:`8px 14px`,background:`#FAF8F2`,borderRadius:999,color:`#1A1714`,fontWeight:500,border:`1px solid rgba(26,23,20,0.08)`,fontSize:14},children:e},e))}),(0,D.jsx)(`div`,{style:{position:`absolute`,top:90,right:70,transform:`rotate(-3deg)`},children:(0,D.jsx)($,{width:420,height:280,artboardW:120,artboardH:150})}),(0,D.jsx)(`div`,{style:{position:`absolute`,bottom:56,right:64,padding:`10px 18px`,background:`#1A1714`,color:`#FAF8F2`,borderRadius:999,font:`600 16px/1 var(--lm-font-mono)`,letterSpacing:`0.04em`,boxShadow:`0 12px 32px rgba(26,23,20,0.25)`},children:`▶ Watch the demo`})]})}function ni(){return(0,D.jsxs)(`div`,{className:`lm-art lm-art--dark lm-art--blob`,style:{width:1280,height:720,background:`#1F1D1A`},children:[(0,D.jsx)(`div`,{style:{position:`absolute`,top:48,left:56},children:(0,D.jsx)(Q,{size:36,dark:!0})}),(0,D.jsx)(`div`,{style:{position:`absolute`,top:130,left:56},children:(0,D.jsx)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:8,padding:`6px 12px`,background:`rgba(184,91,51,0.18)`,color:`#E8C9B8`,borderRadius:999,font:`600 12px/1 var(--lm-font-mono)`,letterSpacing:`0.16em`,textTransform:`uppercase`},children:`Live demo`})}),(0,D.jsx)(`div`,{style:{position:`absolute`,top:178,left:56,width:760},children:(0,D.jsxs)(`h1`,{className:`lm-display lm-display--dark`,style:{margin:0,fontSize:96,lineHeight:.96},children:[`From `,(0,D.jsx)(`em`,{children:`blank`}),(0,D.jsx)(`br`,{}),`to launch post`,(0,D.jsx)(`br`,{}),`in 90 seconds.`]})}),(0,D.jsxs)(`div`,{style:{position:`absolute`,bottom:56,left:56,display:`inline-flex`,alignItems:`center`,gap:14,padding:`12px 18px`,background:`#15130F`,border:`1px solid #2A2723`,borderRadius:12,boxShadow:`0 18px 48px rgba(0,0,0,0.5)`},children:[(0,D.jsx)(`span`,{style:{font:`600 18px/1 var(--lm-font-mono)`,color:`#D08259`},children:`$`}),(0,D.jsx)(`span`,{style:{font:`600 18px/1 var(--lm-font-mono)`,color:`#ECE7DC`},children:`git clone lerret`}),(0,D.jsx)(`span`,{style:{marginLeft:6,font:`600 13px/1 var(--lm-font-sans)`,color:`#B0C99A`},children:`✓ ready`})]}),(0,D.jsx)(`div`,{style:{position:`absolute`,top:70,right:36,transform:`rotate(-4deg)`},children:(0,D.jsx)($,{width:460,height:310,artboardW:130,artboardH:165})}),(0,D.jsxs)(`div`,{style:{position:`absolute`,bottom:56,right:56,display:`inline-flex`,alignItems:`center`,gap:12,padding:`12px 22px`,background:`#FAF8F2`,color:`#1A1714`,borderRadius:999,font:`600 16px/1 var(--lm-font-sans)`,letterSpacing:`0.02em`,boxShadow:`0 14px 36px rgba(0,0,0,0.40)`},children:[(0,D.jsx)(`span`,{style:{display:`inline-block`,width:0,height:0,borderLeft:`11px solid #1A1714`,borderTop:`7px solid transparent`,borderBottom:`7px solid transparent`}}),`Watch it ship`]})]})}function ri(){return(0,D.jsxs)(`div`,{className:`lm-art lm-art--dark lm-art--blob`,style:{width:1280,height:720,background:`#1F1D1A`},children:[(0,D.jsx)(`div`,{style:{position:`absolute`,top:48,left:56},children:(0,D.jsx)(Q,{size:36,dark:!0})}),(0,D.jsxs)(`div`,{style:{position:`absolute`,top:124,left:56,width:620},children:[(0,D.jsx)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:8,padding:`6px 12px`,background:`rgba(184,91,51,0.18)`,color:`#E8C9B8`,borderRadius:999,font:`600 12px/1 var(--lm-font-mono)`,letterSpacing:`0.16em`,textTransform:`uppercase`},children:`The .lerret file`}),(0,D.jsxs)(`h1`,{className:`lm-display lm-display--dark`,style:{margin:`24px 0 0`,fontSize:100,lineHeight:.94},children:[`Plain JSON.`,(0,D.jsx)(`br`,{}),(0,D.jsx)(`em`,{children:`Diff it.`}),(0,D.jsx)(`br`,{}),`Merge it.`]})]}),(0,D.jsx)(`div`,{style:{position:`absolute`,top:90,right:40,width:530,transform:`rotate(-3deg)`},children:(0,D.jsxs)(`div`,{style:{background:`#15130F`,border:`1px solid #2A2723`,borderRadius:14,overflow:`hidden`,boxShadow:`0 30px 80px rgba(0,0,0,0.6)`},children:[(0,D.jsxs)(`div`,{style:{padding:`10px 14px`,borderBottom:`1px solid #2A2723`,display:`flex`,alignItems:`center`,gap:10},children:[(0,D.jsx)(`span`,{style:{width:9,height:9,borderRadius:`50%`,background:`#3A3530`}}),(0,D.jsx)(`span`,{style:{width:9,height:9,borderRadius:`50%`,background:`#3A3530`}}),(0,D.jsx)(`span`,{style:{width:9,height:9,borderRadius:`50%`,background:`#3A3530`}}),(0,D.jsx)(`span`,{style:{marginLeft:8,font:`500 11px/1 var(--lm-font-mono)`,color:`#A39E94`},children:`launch-post.lerret`})]}),(0,D.jsxs)(`div`,{style:{padding:`20px 22px`,font:`500 14px/1.7 var(--lm-font-mono)`,color:`#ECE7DC`},children:[(0,D.jsx)(`div`,{children:`{`}),(0,D.jsxs)(`div`,{children:[`\xA0\xA0`,(0,D.jsx)(`span`,{style:{color:`#C8D1D3`},children:`"format"`}),`: `,(0,D.jsx)(`span`,{style:{color:`#E8C9B8`},children:`"lerret/v0.4"`}),`,`]}),(0,D.jsxs)(`div`,{children:[`\xA0\xA0`,(0,D.jsx)(`span`,{style:{color:`#C8D1D3`},children:`"frame"`}),`: `,`{ `,(0,D.jsx)(`span`,{style:{color:`#C8D1D3`},children:`"w"`}),`: `,(0,D.jsx)(`span`,{style:{color:`#D8C99B`},children:`1080`}),`, `,(0,D.jsx)(`span`,{style:{color:`#C8D1D3`},children:`"h"`}),`: `,(0,D.jsx)(`span`,{style:{color:`#D8C99B`},children:`1350`}),` `,`},`]}),(0,D.jsxs)(`div`,{children:[`\xA0\xA0`,(0,D.jsx)(`span`,{style:{color:`#C8D1D3`},children:`"layers"`}),`: [`]}),(0,D.jsxs)(`div`,{children:[`\xA0\xA0\xA0\xA0`,`{ `,(0,D.jsx)(`span`,{style:{color:`#C8D1D3`},children:`"text"`}),`: `,(0,D.jsx)(`span`,{style:{color:`#E8C9B8`},children:`"v0.4 is out."`}),` `,`},`]}),(0,D.jsxs)(`div`,{children:[`\xA0\xA0\xA0\xA0`,`{ `,(0,D.jsx)(`span`,{style:{color:`#C8D1D3`},children:`"image"`}),`: `,(0,D.jsx)(`span`,{style:{color:`#E8C9B8`},children:`"./photo.jpg"`}),` `,`}`]}),(0,D.jsx)(`div`,{children:`\xA0\xA0]`}),(0,D.jsx)(`div`,{children:`}`})]})]})}),(0,D.jsx)(`div`,{style:{position:`absolute`,bottom:50,left:56,display:`flex`,alignItems:`center`,gap:14},children:[`readable`,`diffable`,`scriptable`].map(e=>(0,D.jsx)(`span`,{style:{display:`inline-flex`,alignItems:`center`,padding:`10px 18px`,background:`rgba(236,231,220,0.06)`,color:`#ECE7DC`,borderRadius:999,font:`500 16px/1 var(--lm-font-sans)`},children:e},e))}),(0,D.jsxs)(`div`,{style:{position:`absolute`,bottom:60,right:56,display:`inline-flex`,alignItems:`center`,gap:12,padding:`12px 22px`,background:`#FAF8F2`,color:`#1A1714`,borderRadius:999,font:`600 16px/1 var(--lm-font-sans)`,letterSpacing:`0.02em`,boxShadow:`0 14px 36px rgba(0,0,0,0.40)`},children:[(0,D.jsx)(`span`,{style:{display:`inline-block`,width:0,height:0,borderLeft:`11px solid #1A1714`,borderTop:`7px solid transparent`,borderBottom:`7px solid transparent`}}),`Watch the file`]})]})}var ii=(0,D.jsxs)(br,{title:`Lerret — Launch Assets`,subtitle:`Ordered by launch priority. Top sections drive installs; bottom sections are optional variety.`,children:[(0,D.jsxs)(Tr,{id:`ph-gallery`,title:`Product Hunt — Gallery (1270×760) · MUST-HAVE — first thing seen on PH`,children:[(0,D.jsx)(Z,{id:`ph-hero`,label:`01 · Hero — tagline + canvas mock`,width:1270,height:760,children:(0,D.jsx)(Mr,{})}),(0,D.jsx)(Z,{id:`ph-annotated`,label:`02 · Step 1 — pick a folder`,width:1270,height:760,children:(0,D.jsx)(Nr,{})}),(0,D.jsx)(Z,{id:`ph-workflow`,label:`03 · Step 2 — design on the canvas`,width:1270,height:760,children:(0,D.jsx)(Pr,{})}),(0,D.jsx)(Z,{id:`ph-snip`,label:`04 · The .lerret file (plain JSON)`,width:1270,height:760,children:(0,D.jsx)(Fr,{})}),(0,D.jsx)(Z,{id:`ph-threeup`,label:`05 · The loop — design / export / post`,width:1270,height:760,children:(0,D.jsx)(Ir,{})}),(0,D.jsx)(Z,{id:`ph-brownfield`,label:`06 · Templates that fork`,width:1270,height:760,children:(0,D.jsx)(Lr,{})})]}),(0,D.jsx)(Tr,{id:`thumb`,title:`Product Hunt thumbnail (240×240) · REQUIRED — PH listing field`,children:(0,D.jsx)(Z,{id:`ph-thumb`,label:`PH thumbnail / app icon`,width:240,height:240,style:{background:`transparent`,boxShadow:`none`},children:(0,D.jsx)(Ur,{})})}),(0,D.jsxs)(Tr,{id:`chrome`,title:`App showcase — promo tiles + 1280×800 screenshots · Marketplace listing or website hero`,children:[(0,D.jsx)(Z,{id:`cws-promo-small`,label:`Promo tile — small (440×280)`,width:440,height:280,children:(0,D.jsx)(Gr,{})}),(0,D.jsx)(Z,{id:`cws-promo-large`,label:`Promo tile — large (920×680)`,width:920,height:680,children:(0,D.jsx)(Kr,{})}),(0,D.jsx)(Z,{id:`cws-promo-marquee`,label:`Promo tile — marquee (1400×560)`,width:1400,height:560,children:(0,D.jsx)(qr,{})}),(0,D.jsx)(Z,{id:`cws-screenshot-1`,label:`Screenshot 1 — Pick a folder (1280×800)`,width:1280,height:800,children:(0,D.jsx)(Yr,{})}),(0,D.jsx)(Z,{id:`cws-screenshot-2`,label:`Screenshot 2 — Design on the canvas (1280×800)`,width:1280,height:800,children:(0,D.jsx)(Xr,{})}),(0,D.jsx)(Z,{id:`cws-screenshot-3`,label:`Screenshot 3 — Export to your folder (1280×800)`,width:1280,height:800,children:(0,D.jsx)(Zr,{})}),(0,D.jsx)(Z,{id:`cws-screenshot-4`,label:`Screenshot 4 — Plain JSON file (1280×800)`,width:1280,height:800,children:(0,D.jsx)(Qr,{})}),(0,D.jsx)(Z,{id:`cws-screenshot-5`,label:`Screenshot 5 — Preset frames (1280×800)`,width:1280,height:800,children:(0,D.jsx)($r,{})}),(0,D.jsx)(Z,{id:`cws-screenshot-snip`,label:`Screenshot 6 — Templates that fork (alt)`,width:1280,height:800,children:(0,D.jsx)(ei,{})})]}),(0,D.jsxs)(Tr,{id:`linkedin`,title:`LinkedIn portrait (1080×1350) + Open Graph (1200×630) · SHOULD-HAVE — URL share previews`,children:[(0,D.jsx)(Z,{id:`li-launch`,label:`LinkedIn — portrait (1080×1350)`,width:1080,height:1350,children:(0,D.jsx)(Rr,{})}),(0,D.jsx)(Z,{id:`og`,label:`Open Graph / og:image (1200×630)`,width:1200,height:630,children:(0,D.jsx)(Hr,{})})]}),(0,D.jsx)(Tr,{id:`wide`,title:`Twitter / X (1600×900) · SHOULD-HAVE — for the launch tweet`,children:(0,D.jsx)(Z,{id:`tw`,label:`Twitter — light hero`,width:1600,height:900,children:(0,D.jsx)(Wr,{})})}),(0,D.jsx)(Tr,{id:`reddit`,title:`Reddit (1200×675) · SHOULD-HAVE — for r/SideProject and dev/design subs`,children:(0,D.jsx)(Z,{id:`reddit-post`,label:`Reddit — casual hero`,width:1200,height:675,children:(0,D.jsx)(Vr,{})})}),(0,D.jsxs)(Tr,{id:`youtube`,title:`YouTube thumbnail (1280×720) · SHOULD-HAVE — pick one for the demo video`,children:[(0,D.jsx)(Z,{id:`yt-thumb-a`,label:`YT Thumbnail A — light typographic (60s tour)`,width:1280,height:720,children:(0,D.jsx)(ti,{})}),(0,D.jsx)(Z,{id:`yt-thumb-b`,label:`YT Thumbnail B — dark, blank → launch in 90s`,width:1280,height:720,children:(0,D.jsx)(ni,{})}),(0,D.jsx)(Z,{id:`yt-thumb-c`,label:`YT Thumbnail C — plain JSON / design as code`,width:1280,height:720,children:(0,D.jsx)(ri,{})})]}),(0,D.jsxs)(Tr,{id:`square`,title:`Square posts (1080×1080) · OPTIONAL — Instagram + ad variety`,children:[(0,D.jsx)(Z,{id:`sq-tagline`,label:`Square — dark tagline`,width:1080,height:1080,children:(0,D.jsx)(zr,{})}),(0,D.jsx)(Z,{id:`sq-keyboard`,label:`Square — keyboard hero (⌘E)`,width:1080,height:1080,children:(0,D.jsx)(Br,{})})]})]});function ai({size:e=13}){return(0,D.jsxs)(`svg`,{"aria-hidden":`true`,focusable:`false`,width:e,height:e,viewBox:`0 0 16 16`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,style:{flexShrink:0},children:[(0,D.jsx)(`circle`,{cx:`8`,cy:`8`,r:`7.25`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,D.jsx)(`line`,{x1:`8`,y1:`4.5`,x2:`8`,y2:`9`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`}),(0,D.jsx)(`circle`,{cx:`8`,cy:`11.5`,r:`0.875`,fill:`currentColor`})]})}var oi={load:`Load error`,evaluate:`Module error`,render:`Render error`};function si({error:e,filePath:t}){let n=e?.phase??`render`,r=e?.message??`Unknown error`,i=oi[n]??`Error`;return(0,D.jsxs)(`div`,{"data-asset-error":!0,"data-error-phase":n,role:`alert`,"aria-label":`Asset error: ${r}`,style:{width:`100%`,height:`100%`,boxSizing:`border-box`,padding:`var(--lm-space-4, 16px)`,background:`var(--lm-error-light)`,border:`1px solid var(--lm-error-border)`,borderRadius:`var(--lm-radius-sm, 6px)`,display:`flex`,flexDirection:`column`,gap:`var(--lm-space-2, 8px)`,overflow:`hidden`},children:[(0,D.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`var(--lm-space-1, 4px)`,color:`var(--lm-error)`},children:[(0,D.jsx)(ai,{size:13}),(0,D.jsxs)(`span`,{style:{fontFamily:`var(--lm-font-sans)`,fontSize:`var(--lm-size-hint, 10px)`,fontWeight:`var(--lm-weight-semibold, 600)`,letterSpacing:`var(--lm-tracking-caps, 0.5px)`,textTransform:`uppercase`,lineHeight:1},children:[`Error · `,i]})]}),(0,D.jsx)(`p`,{style:{margin:0,fontFamily:`var(--lm-font-mono)`,fontSize:`var(--lm-size-body-sm, 12px)`,lineHeight:`var(--lm-lh-body, 1.45)`,color:`var(--lm-error)`,wordBreak:`break-word`,display:`-webkit-box`,WebkitLineClamp:4,WebkitBoxOrient:`vertical`,overflow:`hidden`},children:r}),t&&(0,D.jsx)(`p`,{style:{margin:0,fontFamily:`var(--lm-font-mono)`,fontSize:`var(--lm-size-hint, 10px)`,lineHeight:`var(--lm-lh-body, 1.45)`,color:`var(--lm-error)`,opacity:.7,wordBreak:`break-all`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},title:t,children:t})]})}var ci=520;function li(){if(typeof window>`u`||typeof window.matchMedia!=`function`)return!1;try{return window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}catch{return!1}}function ui({cueKey:e}){let[t,n]=T.useState(`idle`),r=T.useMemo(li,[e]);return T.useEffect(()=>{if(e==null){n(`idle`);return}n(`show`);let t=setTimeout(()=>n(`fade`),r?ci:Math.max(80,ci-240)),i=setTimeout(()=>n(`idle`),ci);return()=>{clearTimeout(t),clearTimeout(i)}},[e,r]),t===`idle`?null:(0,D.jsx)(`div`,{"data-lm-rerender-cue":!0,"aria-hidden":`true`,style:{position:`absolute`,inset:-3,borderRadius:`var(--lm-radius-md, 6px)`,pointerEvents:`none`,opacity:+(t===`show`),transition:r?`none`:`opacity ${ci-240}ms ease-out, box-shadow ${ci-240}ms ease-out`,boxShadow:t===`show`?`0 0 0 1.5px var(--lm-accent, #B85B33), 0 0 12px 1px var(--lm-accent-border, rgba(184,91,51,0.35))`:`0 0 0 1.5px transparent, 0 0 0 0 transparent`}})}var di=T.createContext(()=>({}));di.displayName=`CascadeContext`;function fi({cascadeEntries:e,children:t}){let n=T.useMemo(()=>!Array.isArray(e)||e.length===0?null:new Map(e),[e]),r=T.useCallback(e=>{if(!n)return{};let t=n.get(e);return t&&typeof t==`object`&&!Array.isArray(t)?t:{}},[n]);return(0,D.jsx)(di.Provider,{value:r,children:t})}function pi(){return T.useContext(di)}var mi=200,hi=/^[A-Za-z_][A-Za-z0-9_-]*$/;function gi(e,t=`<unknown>`){if(!e||typeof e!=`object`||Array.isArray(e))return null;let n={},r=!1;for(let[i,a]of Object.entries(e)){if(typeof i!=`string`||i.length===0){console.warn(`[lerret/vars] Skipping empty vars key at "${t}" — CSS custom property names require a non-empty identifier segment.`);continue}if(i.length>mi){console.warn(`[lerret/vars] Skipping vars key "${i}" at "${t}" — key exceeds the ${mi}-character limit for a CSS custom property identifier.`);continue}if(!hi.test(i)){console.warn(`[lerret/vars] Skipping vars key "${i}" at "${t}" — "${i}" is not a valid CSS custom property identifier segment. Keys must start with a letter or underscore and contain only letters, digits, underscores, and hyphens (e.g. "brandColor", "max_width", "color-accent").`);continue}n[`--${i}`]=String(a),r=!0}return r?n:null}function _i(e){if(typeof e!=`string`)return``;let t=e.lastIndexOf(`/`);return t<0?``:e.slice(0,t)}function vi({folderPath:e,style:t,children:n}){let r=pi(),i=gi((e?r(e):{}).vars,e);return(0,D.jsx)(`div`,{style:i?{...i,...t}:t,children:n})}if(typeof document<`u`&&!document.getElementById(`validation-badge-styles`)){let e=document.createElement(`style`);e.id=`validation-badge-styles`,e.textContent=`/* Validation badge */
10
+
11
+ /* Wrapper button: positioned absolutely at the top-left of the artboard host. */
12
+ .lm-validation-badge {
13
+ position: absolute;
14
+ top: 6px;
15
+ left: 6px;
16
+ z-index: 10;
17
+ display: inline-flex;
18
+ align-items: center;
19
+ gap: 4px;
20
+ padding: 2px 8px;
21
+ height: 22px;
22
+ font-family: var(--lm-font-sans, ui-sans-serif, system-ui, sans-serif);
23
+ font-size: 11px;
24
+ font-weight: var(--lm-weight-semibold, 600);
25
+ letter-spacing: 0.04em;
26
+ line-height: 1;
27
+ /* Warning-amber (calm, never error-red) */
28
+ color: var(--lm-warning, #B07B1F);
29
+ background: var(--lm-warning-light, rgba(176, 123, 31, 0.10));
30
+ border: 1px solid var(--lm-warning-border, rgba(176, 123, 31, 0.20));
31
+ border-radius: var(--lm-radius-sm, 6px);
32
+ box-shadow: var(--lm-shadow-xs, 0 1px 2px rgba(26, 23, 20, 0.05));
33
+ cursor: pointer;
34
+ user-select: none;
35
+ outline: none;
36
+ transition:
37
+ background var(--lm-duration-fast, 120ms) var(--lm-ease, ease),
38
+ box-shadow var(--lm-duration-fast, 120ms) var(--lm-ease, ease);
39
+ }
40
+
41
+ .lm-validation-badge:hover {
42
+ background: var(--lm-warning-hover, rgba(176, 123, 31, 0.16));
43
+ box-shadow: var(--lm-shadow-sm, 0 1px 3px rgba(26, 23, 20, 0.10));
44
+ }
45
+
46
+ /* NFR14: keyboard focus ring — uses the shared accent-border focus token */
47
+ .lm-validation-badge:focus-visible {
48
+ box-shadow: var(--lm-focus-ring, 0 0 0 2px rgba(184, 91, 51, 0.20));
49
+ }
50
+
51
+ /* Tooltip (shown on hover and focus via HTML title attribute — native, no JS) */
52
+ /* Rendered by the browser's native tooltip; we just set the title attribute. */
53
+
54
+ /* Reduced motion */
55
+ @media (prefers-reduced-motion: reduce) {
56
+ .lm-validation-badge { transition: none !important; }
57
+ }`,document.head.appendChild(e)}function yi(){return(0,D.jsxs)(`svg`,{"aria-hidden":`true`,focusable:`false`,width:`12`,height:`12`,viewBox:`0 0 12 12`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,style:{flexShrink:0},children:[(0,D.jsx)(`path`,{d:`M5.134 1.5C5.52 0.833 6.48 0.833 6.866 1.5L11.196 9C11.582 9.667 11.102 10.5 10.33 10.5H1.67C0.898 10.5 0.418 9.667 0.804 9L5.134 1.5Z`,fill:`currentColor`,opacity:`0.15`}),(0,D.jsx)(`path`,{d:`M5.134 1.5C5.52 0.833 6.48 0.833 6.866 1.5L11.196 9C11.582 9.667 11.102 10.5 10.33 10.5H1.67C0.898 10.5 0.418 9.667 0.804 9L5.134 1.5Z`,stroke:`currentColor`,strokeWidth:`1`,fill:`none`}),(0,D.jsx)(`line`,{x1:`6`,y1:`4.5`,x2:`6`,y2:`7.5`,stroke:`currentColor`,strokeWidth:`1.2`,strokeLinecap:`round`}),(0,D.jsx)(`circle`,{cx:`6`,cy:`9`,r:`0.6`,fill:`currentColor`})]})}function bi({failedFields:e,propsSchema:t,onClick:n}){if(!t||!Array.isArray(e)||e.length===0)return null;let r=e.length,i=e[0].prop,a=r===1?`1 prop needs attention — click to fix "${i}"`:`${r} props need attention — click to fix`,o=r===1?`Validation`:`${r} issues`;return(0,D.jsxs)(`button`,{type:`button`,className:`lm-validation-badge`,onClick:e=>{e.stopPropagation(),n()},onPointerDown:e=>e.stopPropagation(),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),n())},title:a,"aria-label":a,"data-testid":`lm-validation-badge`,children:[(0,D.jsx)(yi,{}),(0,D.jsx)(`span`,{children:o})]})}function xi(e){let t=[];return e.forEach((e,n)=>{e.kind!==`separator`&&!e.disabled&&t.push(n)}),t}function Si(e,t,n){if(e.length===0)return-1;let r=e.indexOf(t);return r===-1?n>0?e[0]:e[e.length-1]:e[(r+n+e.length)%e.length]}function Ci({id:e,label:t,disabled:n=!1,reason:r,icon:i,active:a,onSelect:o,onMouseEnter:s,itemIndex:c,itemId:l}){return(0,D.jsxs)(`li`,{id:l,role:`menuitem`,"aria-disabled":n?`true`:void 0,"data-active":a?`true`:`false`,className:`lm-menu-item`,title:n&&r?r:void 0,tabIndex:-1,onClick:()=>{!n&&o&&o()},onMouseEnter:()=>!n&&s&&s(c),children:[i&&(0,D.jsx)(`span`,{className:`lm-menu-item-icon`,"aria-hidden":`true`,children:i}),(0,D.jsx)(`span`,{className:`lm-menu-item-label`,children:t}),n&&r&&(0,D.jsx)(`span`,{className:`lm-menu-item-reason`,"aria-hidden":`true`,children:r})]})}function wi(){return(0,D.jsx)(`li`,{role:`separator`,className:`lm-menu-separator`})}function Ti({items:e,coords:t,align:n,menuRef:r,activeIdx:i,onItemSelect:a,onMouseEnterItem:o,idPrefix:s}){let c=T.useMemo(()=>{if(!t)return{top:0,left:0};let{top:e,bottom:r,left:i,right:a}=t;switch(n){case`top-start`:return{bottom:window.innerHeight-e+8,left:i};case`top-end`:return{bottom:window.innerHeight-e+8,right:window.innerWidth-a};case`bottom-end`:return{top:r+8,right:window.innerWidth-a};default:return{top:r+8,left:i}}},[t,n]),l=e=>`${s}-item-${e}`,u=i>=0?l(i):void 0;return E.createPortal((0,D.jsx)(`ul`,{ref:r,role:`menu`,tabIndex:-1,className:`lm-menu-popover`,"aria-activedescendant":u,style:{...c,position:`fixed`},children:e.map((e,t)=>e.kind===`separator`?(0,D.jsx)(wi,{},e.id??`sep-${t}`):(0,D.jsx)(Ci,{id:e.id,label:e.label,disabled:!!e.disabled,reason:e.reason,icon:e.icon,active:t===i,onSelect:()=>a(e),onMouseEnter:o,itemIndex:t,itemId:l(t)},e.id))}),document.body)}function Ei({trigger:e,renderTrigger:t,items:n=[],align:r=`bottom-start`,open:i,onOpen:a,onClose:o}){let s=i!==void 0,[c,l]=T.useState(!1),u=s?i:c,[d,f]=T.useState(-1),[p,m]=T.useState(null),h=T.useRef(null),g=T.useRef(null),_=T.useId().replace(/:/g,``),v=T.useCallback(()=>{if(!h.current)return null;let e=h.current.getBoundingClientRect();return{top:e.top,bottom:e.bottom,left:e.left,right:e.right,width:e.width,height:e.height}},[]),y=T.useCallback(()=>{m(v()),f(-1),s||l(!0),a&&a()},[s,v,a]),b=T.useCallback((e=!0)=>{s||l(!1),o&&o(),f(-1),e&&h.current&&h.current.focus()},[s,o]),x=T.useCallback(()=>{u?b():y()},[u,y,b]);T.useEffect(()=>{u&&g.current&&g.current.focus()},[u]),T.useEffect(()=>{if(!u||!g.current||d<0)return;let e=g.current.querySelector(`[data-active="true"]`);e&&typeof e.scrollIntoView==`function`&&e.scrollIntoView({block:`nearest`})},[u,d]),T.useEffect(()=>{if(!u)return;let e=e=>{let t=h.current&&h.current.contains(e.target),n=g.current&&g.current.contains(e.target);!t&&!n&&b(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[u,b]),T.useEffect(()=>{if(!u)return;let e=()=>m(v());return window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[u,v]);let S=T.useCallback(e=>{(e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`Enter`||e.key===` `)&&(e.preventDefault(),u||y())},[u,y]),C=T.useMemo(()=>xi(n),[n]),w=T.useCallback(e=>{switch(e.key){case`ArrowDown`:e.preventDefault(),f(e=>Si(C,e,1));break;case`ArrowUp`:e.preventDefault(),f(e=>Si(C,e,-1));break;case`Home`:e.preventDefault(),f(C[0]??-1);break;case`End`:e.preventDefault(),f(C[C.length-1]??-1);break;case`Enter`:case` `:{if(e.preventDefault(),d<0)break;let t=n[d];t&&t.kind!==`separator`&&!t.disabled&&(t.onSelect&&t.onSelect(),b());break}case`Escape`:e.preventDefault(),b();break;case`Tab`:b(!1);break;default:break}},[C,d,n,b]);T.useEffect(()=>{if(!u)return;let e=g.current;if(e)return e.addEventListener(`keydown`,w),()=>e.removeEventListener(`keydown`,w)},[u,w]);let E=T.useCallback(e=>{e.disabled||(e.onSelect&&e.onSelect(),b())},[b]),O=T.useCallback(e=>{f(e)},[]),k=T.useCallback(()=>({ref:h,"aria-haspopup":`menu`,"aria-expanded":u,onClick:x,onKeyDown:S}),[u,x,S]),A;return e?A=T.cloneElement(e,{ref:h,"aria-haspopup":`menu`,"aria-expanded":u,onClick:t=>{e.props.onClick&&e.props.onClick(t),x()},onKeyDown:t=>{e.props.onKeyDown&&e.props.onKeyDown(t),S(t)}}):t&&(A=t({open:u,getTriggerProps:k})),(0,D.jsxs)(D.Fragment,{children:[A,u&&p&&(0,D.jsx)(Ti,{items:n,coords:p,align:r,menuRef:g,activeIdx:d,onItemSelect:E,onMouseEnterItem:O,idPrefix:_})]})}if(typeof document<`u`&&!document.getElementById(`lm-kebab-trigger-styles`)){let e=document.createElement(`style`);e.id=`lm-kebab-trigger-styles`,e.textContent=`.lm-kebab-trigger {
58
+ /* Ghost-tier: transparent at rest, hover-fill */
59
+ display: inline-flex;
60
+ align-items: center;
61
+ justify-content: center;
62
+ width: 22px;
63
+ height: 22px;
64
+ padding: 0;
65
+ border: none;
66
+ border-radius: var(--lm-radius-sm, 5px);
67
+ background: transparent;
68
+ color: var(--lm-text-secondary, #3A3530);
69
+ cursor: pointer;
70
+ outline: none;
71
+ transition:
72
+ background var(--lm-duration-fast, 120ms) var(--lm-ease, ease-out),
73
+ color var(--lm-duration-fast, 120ms) var(--lm-ease, ease-out),
74
+ opacity var(--lm-duration-fast, 120ms) var(--lm-ease, ease-out);
75
+ }
76
+ .lm-kebab-trigger:hover,
77
+ .lm-kebab-trigger[aria-expanded="true"] {
78
+ background: var(--lm-bg-tertiary, #E8E2D4);
79
+ color: var(--lm-text-primary, #1A1714);
80
+ }
81
+ .lm-kebab-trigger:focus-visible {
82
+ box-shadow: var(--lm-focus-ring, 0 0 0 2px rgba(184, 91, 51, 0.20));
83
+ opacity: 1;
84
+ }
85
+ .lm-kebab-trigger svg {
86
+ display: block;
87
+ }
88
+ @media (prefers-reduced-motion: reduce) {
89
+ .lm-kebab-trigger { transition: none !important; }
90
+ }`,document.head.appendChild(e)}function Di({open:e,getTriggerProps:t,"aria-label":n,className:r,style:i,title:a=`Actions`,...o}){let s=t();return(0,D.jsx)(`button`,{type:`button`,className:`lm-kebab-trigger${r?` ${r}`:``}`,style:i,title:a,"aria-label":n||a,"data-open":e?`true`:`false`,onPointerDown:e=>{e.stopPropagation()},...s,...o,children:(0,D.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 14 14`,fill:`currentColor`,"aria-hidden":`true`,children:[(0,D.jsx)(`circle`,{cx:`7`,cy:`2.5`,r:`1.35`}),(0,D.jsx)(`circle`,{cx:`7`,cy:`7`,r:`1.35`}),(0,D.jsx)(`circle`,{cx:`7`,cy:`11.5`,r:`1.35`})]})})}var Oi=!1,ki=`a[href]:not([disabled]),button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])`;function Ai(){return typeof window>`u`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}if(typeof document<`u`&&!document.getElementById(`editor-sheet-styles`)){let e=document.createElement(`style`);e.id=`editor-sheet-styles`,e.textContent=`/* Backdrop */
91
+ .es-backdrop {
92
+ position: fixed;
93
+ inset: 0;
94
+ z-index: 200;
95
+ background: rgba(26, 23, 20, 0.55);
96
+ backdrop-filter: blur(6px);
97
+ display: flex;
98
+ align-items: center;
99
+ justify-content: center;
100
+ animation: es-backdrop-in var(--lm-duration-base, 220ms) var(--lm-ease, cubic-bezier(0.2, 0.7, 0.2, 1)) both;
101
+ }
102
+ .es-backdrop[data-closing] {
103
+ animation: es-backdrop-out var(--lm-duration-fast, 120ms) var(--lm-ease, cubic-bezier(0.2, 0.7, 0.2, 1)) both;
104
+ }
105
+
106
+ /* Dialog panel */
107
+ .es-dialog {
108
+ position: relative;
109
+ background: var(--lm-bg-primary, #FAF8F2);
110
+ border: 1px solid var(--lm-border, #DDD7CA);
111
+ border-radius: var(--lm-radius-xl, 14px);
112
+ box-shadow: var(--lm-shadow-popup, 0 18px 48px rgba(26, 23, 20, 0.22));
113
+ width: min(640px, calc(100vw - var(--lm-space-8, 32px) * 2));
114
+ max-height: calc(100vh - var(--lm-space-8, 32px) * 2);
115
+ display: flex;
116
+ flex-direction: column;
117
+ overflow: hidden;
118
+ animation: es-panel-in var(--lm-duration-base, 220ms) var(--lm-ease, cubic-bezier(0.2, 0.7, 0.2, 1)) both;
119
+ }
120
+ .es-dialog[data-closing] {
121
+ animation: es-panel-out var(--lm-duration-fast, 120ms) var(--lm-ease, cubic-bezier(0.2, 0.7, 0.2, 1)) both;
122
+ }
123
+
124
+ /* Header */
125
+ .es-header {
126
+ display: flex;
127
+ align-items: center;
128
+ gap: var(--lm-space-3, 12px);
129
+ padding: var(--lm-space-5, 20px) var(--lm-space-6, 24px) var(--lm-space-4, 16px);
130
+ border-bottom: 1px solid var(--lm-border-light, #E8E2D4);
131
+ flex-shrink: 0;
132
+ }
133
+ .es-title {
134
+ flex: 1;
135
+ font: var(--lm-weight-semibold, 600) var(--lm-size-h3, 16px)/var(--lm-lh-tight, 1.2) var(--lm-font-sans, -apple-system, BlinkMacSystemFont, sans-serif);
136
+ color: var(--lm-text-primary, #1A1714);
137
+ margin: 0;
138
+ display: flex;
139
+ align-items: center;
140
+ gap: var(--lm-space-2, 8px);
141
+ }
142
+ /* Dirty indicator dot */
143
+ .es-dirty-dot {
144
+ width: 6px;
145
+ height: 6px;
146
+ border-radius: var(--lm-radius-pill, 999px);
147
+ background: var(--lm-accent, #B85B33);
148
+ flex-shrink: 0;
149
+ }
150
+ /* Close button */
151
+ .es-close {
152
+ display: flex;
153
+ align-items: center;
154
+ justify-content: center;
155
+ width: 28px;
156
+ height: 28px;
157
+ border: none;
158
+ border-radius: var(--lm-radius-sm, 6px);
159
+ background: transparent;
160
+ color: var(--lm-text-tertiary, #6E6960);
161
+ cursor: pointer;
162
+ transition: background var(--lm-duration-fast, 120ms), color var(--lm-duration-fast, 120ms);
163
+ flex-shrink: 0;
164
+ }
165
+ .es-close:hover {
166
+ background: var(--lm-bg-tertiary, #E8E2D4);
167
+ color: var(--lm-text-primary, #1A1714);
168
+ }
169
+ .es-close:focus-visible {
170
+ box-shadow: var(--lm-focus-ring, 0 0 0 2px rgba(184, 91, 51, 0.20));
171
+ }
172
+
173
+ /* Body */
174
+ .es-body {
175
+ flex: 1;
176
+ overflow-y: auto;
177
+ padding: var(--lm-space-6, 24px);
178
+ scrollbar-width: thin;
179
+ scrollbar-color: var(--lm-border, #DDD7CA) transparent;
180
+ }
181
+
182
+ /* Footer */
183
+ .es-footer {
184
+ border-top: 1px solid var(--lm-border-light, #E8E2D4);
185
+ padding: var(--lm-space-4, 16px) var(--lm-space-6, 24px);
186
+ flex-shrink: 0;
187
+ display: flex;
188
+ align-items: center;
189
+ justify-content: flex-end;
190
+ gap: var(--lm-space-3, 12px);
191
+ }
192
+
193
+ /* Keyframes */
194
+ @keyframes es-backdrop-in { from { opacity: 0 } to { opacity: 1 } }
195
+ @keyframes es-backdrop-out { from { opacity: 1 } to { opacity: 0 } }
196
+ @keyframes es-panel-in {
197
+ from { opacity: 0; transform: translateY(8px) scale(0.97) }
198
+ to { opacity: 1; transform: translateY(0) scale(1) }
199
+ }
200
+ @keyframes es-panel-out {
201
+ from { opacity: 1; transform: translateY(0) scale(1) }
202
+ to { opacity: 0; transform: translateY(6px) scale(0.97) }
203
+ }
204
+
205
+ /* Reduced-motion overrides — collapse all animations to instant */
206
+ @media (prefers-reduced-motion: reduce) {
207
+ .es-backdrop, .es-backdrop[data-closing],
208
+ .es-dialog, .es-dialog[data-closing] {
209
+ animation: none !important;
210
+ }
211
+ }`,document.head.appendChild(e)}function ji({open:e,onClose:t,title:n,dirty:r=!1,children:i,footer:a}){let[o,s]=T.useState(!1),[c,l]=T.useState(!1),u=T.useRef(!1),d=T.useRef(null),f=T.useRef(null),p=T.useRef(null),m=T.useId();T.useEffect(()=>{if(e&&!(Oi&&!u.current))return Oi=!0,u.current=!0,l(!0),()=>{u.current&&(Oi=!1,u.current=!1,l(!1))}},[e]),T.useEffect(()=>{if(!e||!u.current)return;p.current=document.activeElement,s(!1);let t=requestAnimationFrame(()=>{f.current&&f.current.focus()});return()=>{cancelAnimationFrame(t);let e=p.current;e&&typeof e.focus==`function`&&requestAnimationFrame(()=>e.focus())}},[e]);let h=T.useCallback(()=>{if(!o){if(Ai()){t?.();return}s(!0)}},[o,t]),g=T.useCallback(e=>{e.target===d.current&&o&&t?.()},[o,t]);if(T.useEffect(()=>{if(!e||!u.current)return;let t=e=>{if(e.key===`Escape`){e.preventDefault(),h();return}if(e.key===`Tab`){let t=d.current;if(!t)return;let n=Array.from(t.querySelectorAll(ki)).filter(e=>!e.closest(`[inert]`));if(n.length===0){e.preventDefault();return}let r=document.activeElement,i=n.indexOf(r);e.shiftKey?(e.preventDefault(),(i<=0?n[n.length-1]:n[i-1]).focus()):(e.preventDefault(),(i>=n.length-1?n[0]:n[i+1]).focus())}};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[e,h]),!e||!c)return null;let _=o?``:void 0;return(0,E.createPortal)((0,D.jsx)(`div`,{className:`es-backdrop`,"data-closing":_,onClick:h,onWheel:e=>e.preventDefault(),children:(0,D.jsxs)(`div`,{ref:d,role:`dialog`,"aria-modal":`true`,"aria-labelledby":m,"data-closing":_,className:`es-dialog`,onClick:e=>e.stopPropagation(),onAnimationEnd:g,children:[(0,D.jsxs)(`div`,{className:`es-header`,children:[(0,D.jsxs)(`h2`,{id:m,className:`es-title`,children:[n,r&&(0,D.jsx)(`span`,{className:`es-dirty-dot`,"aria-label":`unsaved changes`,title:`Unsaved changes`})]}),(0,D.jsx)(`button`,{ref:f,className:`es-close`,onClick:h,"aria-label":`Close editor`,type:`button`,children:(0,D.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 14 14`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,"aria-hidden":`true`,children:(0,D.jsx)(`path`,{d:`M2 2l10 10M12 2L2 12`})})})]}),(0,D.jsx)(`div`,{className:`es-body`,children:i}),a&&(0,D.jsx)(`div`,{className:`es-footer`,children:a})]})}),document.body)}if(typeof document<`u`&&!document.getElementById(`variant-tabs-styles`)){let e=document.createElement(`style`);e.id=`variant-tabs-styles`,e.textContent=`.lm-variant-tabs {
212
+ display: flex;
213
+ flex-direction: row;
214
+ align-items: stretch;
215
+ gap: 0;
216
+ border-bottom: 1px solid var(--lm-border, #DDD7CA);
217
+ margin-bottom: var(--lm-space-4, 16px);
218
+ /* Horizontal scroll for very many variants. */
219
+ overflow-x: auto;
220
+ }
221
+ .lm-variant-tab {
222
+ display: inline-flex;
223
+ align-items: center;
224
+ gap: var(--lm-space-1, 4px);
225
+ padding: var(--lm-space-2, 8px) var(--lm-space-3, 12px);
226
+ font: var(--lm-weight-regular, 400) var(--lm-size-body, 13px)/var(--lm-lh-body, 1.45) var(--lm-font-sans, ui-sans-serif);
227
+ color: var(--lm-text-secondary, #3A3530);
228
+ background: none;
229
+ border: none;
230
+ border-bottom: 2px solid transparent;
231
+ cursor: pointer;
232
+ white-space: nowrap;
233
+ transition:
234
+ color var(--lm-duration-fast, 120ms) var(--lm-ease, ease),
235
+ border-color var(--lm-duration-fast, 120ms) var(--lm-ease, ease);
236
+ outline: none;
237
+ /* Seat the border BELOW the list border, aligned flush. */
238
+ margin-bottom: -1px;
239
+ position: relative;
240
+ }
241
+ .lm-variant-tab:focus-visible {
242
+ box-shadow: var(--lm-focus-ring, 0 0 0 2px rgba(184, 91, 51, 0.20));
243
+ border-radius: var(--lm-radius-sm, 4px) var(--lm-radius-sm, 4px) 0 0;
244
+ }
245
+ .lm-variant-tab[aria-selected="true"] {
246
+ font-weight: var(--lm-weight-medium, 600);
247
+ color: var(--lm-text-primary, #1A1714);
248
+ border-bottom-color: var(--lm-accent, #B85B33);
249
+ }
250
+ .lm-variant-tab__dot {
251
+ width: 6px;
252
+ height: 6px;
253
+ border-radius: var(--lm-radius-pill, 999px);
254
+ background: var(--lm-accent, #B85B33);
255
+ flex-shrink: 0;
256
+ /* Only visible on the active tab (icon/text + dot, not color alone). */
257
+ visibility: hidden;
258
+ }
259
+ .lm-variant-tab[aria-selected="true"] .lm-variant-tab__dot {
260
+ visibility: visible;
261
+ }
262
+
263
+ @media (prefers-reduced-motion: reduce) {
264
+ .lm-variant-tab { transition: none !important; }
265
+ }`,document.head.appendChild(e)}function Mi({variants:e,activeVariant:t,onChange:n}){let r=T.useRef([]),i=T.useCallback((t,i)=>{if(t.key===`ArrowRight`){t.preventDefault();let a=(i+1)%e.length;n(e[a]),setTimeout(()=>{r.current[a]?.focus()},0)}else if(t.key===`ArrowLeft`){t.preventDefault();let a=(i-1+e.length)%e.length;n(e[a]),setTimeout(()=>{r.current[a]?.focus()},0)}},[e,n]);return(0,D.jsx)(`div`,{role:`tablist`,"aria-label":`Variants`,className:`lm-variant-tabs`,"data-testid":`lm-variant-tabs`,children:e.map((e,a)=>{let o=e===t;return(0,D.jsxs)(`button`,{role:`tab`,"aria-selected":o,tabIndex:o?0:-1,className:`lm-variant-tab`,"data-testid":`lm-variant-tab-${e}`,ref:e=>{r.current[a]=e},onClick:()=>n(e),onKeyDown:e=>i(e,a),children:[(0,D.jsx)(`span`,{className:`lm-variant-tab__dot`,"aria-hidden":`true`}),e]},e)})})}function Ni(e,t){if(!t||typeof t!=`object`)return{valid:!0,message:null};let n=e==null||e===``;if(t.required&&n)return{valid:!1,message:`This field is required.`};if(n)return{valid:!0,message:null};switch(t.type){case`string`:return typeof e==`string`?{valid:!0,message:null}:{valid:!1,message:`Expected a text value, got ${typeof e}.`};case`number`:return typeof e!=`number`||!Number.isFinite(e)?{valid:!1,message:`Expected a valid number.`}:t.min!==void 0&&e<t.min?{valid:!1,message:`Value must be at least ${t.min}.`}:t.max!==void 0&&e>t.max?{valid:!1,message:`Value must be at most ${t.max}.`}:{valid:!0,message:null};case`boolean`:return typeof e==`boolean`?{valid:!0,message:null}:{valid:!1,message:`Expected a boolean (on/off) value.`};case`select`:{let n=Array.isArray(t.options)?t.options:[];return n.includes(e)?{valid:!0,message:null}:{valid:!1,message:n.length?`Expected one of: ${n.join(`, `)}.`:`No options defined for this field.`}}case`array`:return Array.isArray(e)?{valid:!0,message:null}:{valid:!1,message:`Expected a list of values.`};case`object`:return typeof e!=`object`||!e||Array.isArray(e)?{valid:!1,message:`Expected a set of named fields.`}:{valid:!0,message:null};default:return{valid:!0,message:null}}}function Pi(){return(0,D.jsxs)(`svg`,{className:`lm-field__invalid-icon`,"aria-hidden":`true`,focusable:`false`,viewBox:`0 0 16 16`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,D.jsx)(`circle`,{cx:`8`,cy:`8`,r:`7.25`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,D.jsx)(`line`,{x1:`8`,y1:`4.5`,x2:`8`,y2:`9`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`}),(0,D.jsx)(`circle`,{cx:`8`,cy:`11.5`,r:`0.875`,fill:`currentColor`})]})}function Fi({fieldKey:e,inputId:t,required:n,description:r,invalid:i,invalidMessage:a,children:o}){return(0,D.jsxs)(`div`,{className:`lm-field`,"data-field-key":e,children:[(0,D.jsxs)(`div`,{className:`lm-field__label-row`,children:[(0,D.jsx)(`label`,{className:`lm-field__label`,htmlFor:t,children:e?e.replace(/([A-Z])/g,` $1`).replace(/_/g,` `).trim():``}),n&&(0,D.jsx)(`span`,{className:`lm-field__required`,"aria-label":`required`,title:`This field is required`,children:`*`})]}),o,r&&(0,D.jsx)(`p`,{className:`lm-field__description`,children:r}),i&&a&&(0,D.jsxs)(`div`,{className:`lm-field__invalid-msg`,role:`alert`,"aria-live":`polite`,"data-invalid-message":!0,children:[(0,D.jsx)(Pi,{}),(0,D.jsxs)(`span`,{children:[`Invalid: `,a]})]})]})}var Ii=300;function Li({fieldKey:e,schema:t,value:n,onChange:r,onCommit:i,disabled:a}){let o=(0,T.useId)(),[s,c]=(0,T.useState)(n??``),l=(0,T.useRef)(null);(0,T.useEffect)(()=>{c(n??``)},[n]);let u=Ni(s===``?void 0:s,t),d=!u.valid,f=(0,T.useCallback)(()=>{l.current!==null&&(clearTimeout(l.current),l.current=null)},[]),p=(0,T.useCallback)(e=>{let t=e.target.value;c(t),f(),l.current=setTimeout(()=>{r?.(t)},Ii)},[r,f]),m=(0,T.useCallback)(e=>{f();let t=e.target.value;r?.(t),i?.(t)},[r,i,f]),h=t?.default!==void 0&&t.default!==null?String(t.default):void 0;return(0,D.jsx)(Fi,{fieldKey:e,inputId:o,required:t?.required,description:t?.description,invalid:d,invalidMessage:u.message,children:(0,D.jsx)(`input`,{id:o,type:`text`,className:[`lm-input`,d?`lm-input--invalid`:``].filter(Boolean).join(` `),value:s,onChange:p,onBlur:m,disabled:a,placeholder:h,"aria-invalid":d?`true`:void 0,"aria-required":t?.required?`true`:void 0,"data-control-type":`text`})})}var Ri=300;function zi({fieldKey:e,schema:t,value:n,onChange:r,onCommit:i,disabled:a}){let o=(0,T.useId)(),[s,c]=(0,T.useState)(n==null?``:String(n)),l=(0,T.useRef)(null);(0,T.useEffect)(()=>{c(n==null?``:String(n))},[n]);let u=e=>{let t=parseFloat(e);return Number.isFinite(t)?t:void 0},d=Ni(u(s),t),f=!d.valid,p=(0,T.useCallback)(()=>{l.current!==null&&(clearTimeout(l.current),l.current=null)},[]),m=(0,T.useCallback)(e=>{let t=e.target.value;c(t),p(),l.current=setTimeout(()=>{let e=u(t);e!==void 0&&r?.(e)},Ri)},[r,p]),h=(0,T.useCallback)(e=>{p();let t=e.target.value,n=u(t);n!==void 0&&(r?.(n),i?.(n))},[r,i,p]),g=t?.default!==void 0&&t.default!==null?String(t.default):void 0;return(0,D.jsx)(Fi,{fieldKey:e,inputId:o,required:t?.required,description:t?.description,invalid:f,invalidMessage:d.message,children:(0,D.jsx)(`input`,{id:o,type:`number`,className:[`lm-input`,f?`lm-input--invalid`:``].filter(Boolean).join(` `),value:s,onChange:m,onBlur:h,disabled:a,placeholder:g,min:t?.min,max:t?.max,"aria-invalid":f?`true`:void 0,"aria-required":t?.required?`true`:void 0,"data-control-type":`number`})})}function Bi({fieldKey:e,schema:t,value:n,onChange:r,onCommit:i,disabled:a}){let o=(0,T.useId)(),s=typeof t?.default==`boolean`?t.default:!1,c=n==null?s:!!n,l=Ni(n??void 0,t),u=!l.valid,d=()=>{if(a)return;let e=!c;r?.(e),i?.(e)},f=e=>{(e.key===` `||e.key===`Enter`)&&(e.preventDefault(),d())},p=[`lm-toggle__track`,c?`lm-toggle__track--on`:``,u?`lm-toggle__track--invalid`:``,a?`lm-toggle__track--disabled`:``].filter(Boolean).join(` `);return(0,D.jsx)(Fi,{fieldKey:e,inputId:o,required:t?.required,description:t?.description,invalid:u,invalidMessage:l.message,children:(0,D.jsxs)(`div`,{className:`lm-toggle`,children:[(0,D.jsx)(`button`,{id:o,role:`switch`,"aria-checked":c,"aria-required":t?.required?`true`:void 0,"aria-invalid":u?`true`:void 0,"aria-label":e,className:p,onClick:d,onKeyDown:f,disabled:a,type:`button`,"data-control-type":`boolean`,children:(0,D.jsx)(`span`,{className:`lm-toggle__thumb`,"aria-hidden":`true`})}),(0,D.jsx)(`span`,{className:`lm-toggle__label`,"aria-hidden":`true`,children:c?`On`:`Off`})]})})}function Vi({fieldKey:e,schema:t,value:n,onChange:r,onCommit:i,disabled:a}){let o=(0,T.useId)(),s=Array.isArray(t?.options)?t.options:[],c=Ni(n??void 0,t),l=!c.valid,u=e=>{let t=e.target.value;r?.(t),i?.(t)},d=n!=null&&n!==``,f=typeof t?.default==`string`?t.default:``;return(0,D.jsx)(Fi,{fieldKey:e,inputId:o,required:t?.required,description:t?.description,invalid:l,invalidMessage:c.message,children:(0,D.jsxs)(`select`,{id:o,className:[`lm-input`,`lm-select`,l?`lm-input--invalid`:``].filter(Boolean).join(` `),value:d?n:``,onChange:u,onBlur:u,disabled:a,"aria-invalid":l?`true`:void 0,"aria-required":t?.required?`true`:void 0,"data-control-type":`select`,children:[!d&&(0,D.jsx)(`option`,{value:``,disabled:t?.required,children:f===``?`Select…`:f}),s.map(e=>(0,D.jsx)(`option`,{value:e,children:e},e))]})})}function Hi({fieldKey:e,schema:t,value:n,onChange:r,onCommit:i,disabled:a}){let o=Array.isArray(n)?n:[],s=t?.itemSchema??{type:`string`},c=Ni(n??void 0,t),l=!c.valid,u=(0,T.useCallback)(e=>{r?.(e),i?.(e)},[r,i]),d=(0,T.useCallback)((e,t)=>{let n=o.slice();n[e]=t,u(n)},[o,u]),f=(0,T.useCallback)(()=>{let e=s?.default===void 0?s?.type===`boolean`?!1:s?.type===`number`?0:``:s.default;u([...o,e])},[o,s,u]),p=(0,T.useCallback)(e=>{u(o.filter((t,n)=>n!==e))},[o,u]),m=(0,T.useCallback)(e=>{if(e===0)return;let t=o.slice();[t[e-1],t[e]]=[t[e],t[e-1]],u(t)},[o,u]),h=(0,T.useCallback)(e=>{if(e===o.length-1)return;let t=o.slice();[t[e],t[e+1]]=[t[e+1],t[e]],u(t)},[o,u]);return(0,D.jsx)(Fi,{fieldKey:e,required:t?.required,description:t?.description,invalid:l,invalidMessage:c.message,children:(0,D.jsxs)(`div`,{className:`lm-array`,"data-control-type":`array`,children:[(0,D.jsx)(`div`,{className:`lm-array__items`,role:`list`,children:o.map((t,n)=>(0,D.jsxs)(`div`,{className:`lm-array__item`,role:`listitem`,"data-array-index":n,children:[(0,D.jsx)(`div`,{className:`lm-array__item-field`,children:(0,D.jsx)(Wi,{fieldKey:`${e}[${n}]`,schema:s,value:t,onChange:e=>d(n,e),onCommit:e=>d(n,e),disabled:a})}),(0,D.jsxs)(`div`,{className:`lm-array__item-actions`,children:[(0,D.jsx)(`button`,{type:`button`,className:`lm-icon-btn`,onClick:()=>m(n),disabled:a||n===0,"aria-label":`Move item ${n+1} up`,title:`Move up`,"data-array-move-up":n,children:`↑`}),(0,D.jsx)(`button`,{type:`button`,className:`lm-icon-btn`,onClick:()=>h(n),disabled:a||n===o.length-1,"aria-label":`Move item ${n+1} down`,title:`Move down`,"data-array-move-down":n,children:`↓`}),(0,D.jsx)(`button`,{type:`button`,className:`lm-icon-btn lm-icon-btn--danger`,onClick:()=>p(n),disabled:a,"aria-label":`Remove item ${n+1}`,title:`Remove`,"data-array-remove":n,children:`×`})]})]},n))}),(0,D.jsx)(`button`,{type:`button`,className:`lm-array__add`,onClick:f,disabled:a,"aria-label":`Add item to ${e}`,"data-array-add":!0,children:`+ Add item`})]})})}function Ui({fieldKey:e,schema:t,value:n,onChange:r,onCommit:i,disabled:a}){let o=typeof n==`object`&&n&&!Array.isArray(n)?n:{},s=Ni(n??void 0,t),c=!s.valid,l=t?.properties??{},u=Object.keys(l).length>0?Object.keys(l):Object.keys(o),d=(e,t)=>{let n={...o,[e]:t};r?.(n),i?.(n)};return(0,D.jsx)(Fi,{fieldKey:e,required:t?.required,description:t?.description,invalid:c,invalidMessage:s.message,children:(0,D.jsxs)(`div`,{className:`lm-object`,"data-control-type":`object`,children:[u.map(e=>(0,D.jsx)(Wi,{fieldKey:e,schema:l[e]??{type:`string`},value:Object.prototype.hasOwnProperty.call(o,e)?o[e]:void 0,onChange:t=>d(e,t),onCommit:t=>d(e,t),disabled:a},e)),u.length===0&&(0,D.jsx)(`p`,{style:{margin:0,fontFamily:`var(--lm-font-sans)`,fontSize:`var(--lm-size-body-sm, 12px)`,color:`var(--lm-text-muted, #B8B3A8)`},children:`No properties defined.`})]})})}function Wi({fieldKey:e,schema:t,value:n,onChange:r,onCommit:i,disabled:a}){let o=t?.type??`string`,s={fieldKey:e,schema:t,value:n,onChange:r,onCommit:i,disabled:a};switch(o){case`string`:return(0,D.jsx)(Li,{...s});case`number`:return(0,D.jsx)(zi,{...s});case`boolean`:return(0,D.jsx)(Bi,{...s});case`select`:return(0,D.jsx)(Vi,{...s});case`array`:return(0,D.jsx)(Hi,{...s});case`object`:return(0,D.jsx)(Ui,{...s});default:return(0,D.jsx)(Li,{...s,schema:{...t,type:`string`}})}}var Gi=`/__lerret/write`,Ki=`/__lerret/rename`,qi=`/__lerret/duplicate`,Ji=`/__lerret/delete`,Yi=`/__lerret/reveal`;function Xi(){return typeof globalThis<`u`&&globalThis.__LERRET_CLI_MODE__===!0}async function Zi(e,t,n={}){if(typeof e!=`string`||e.length===0)return{ok:!1,error:`writeProjectFile: path must be a non-empty string`};if(typeof t!=`string`)return{ok:!1,error:`writeProjectFile: content must be a string`};if(!Xi())return{ok:!1,error:"writes are disabled in standalone mode (run `lerret dev` to enable)"};let r=n.fetch||(typeof globalThis<`u`?globalThis.fetch:void 0);if(typeof r!=`function`)return{ok:!1,error:`no fetch implementation available`};let i;try{i=await r(Gi,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e,content:t})})}catch(e){return{ok:!1,error:`network error: ${e instanceof Error?e.message:String(e)}`}}let a;try{a=await i.json()}catch{return{ok:!1,error:`server returned non-JSON response (status ${i.status})`}}return a&&a.ok===!0?{ok:!0}:{ok:!1,error:a&&typeof a.error==`string`&&a.error||`write failed (status ${i.status})`}}async function Qi(e,t,n={}){if(!Xi())return{ok:!1,error:"lifecycle actions are disabled in standalone mode (run `lerret dev` to enable)"};let r=n.fetch||(typeof globalThis<`u`?globalThis.fetch:void 0);if(typeof r!=`function`)return{ok:!1,error:`no fetch implementation available`};let i;try{i=await r(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)})}catch(e){return{ok:!1,error:`network error: ${e instanceof Error?e.message:String(e)}`}}let a;try{a=await i.json()}catch{return{ok:!1,error:`server returned non-JSON response (status ${i.status})`}}return a&&a.ok===!0?a:{ok:!1,error:a&&typeof a.error==`string`&&a.error||`request failed (status ${i.status})`}}async function $i(e,t,n={}){if(typeof e!=`string`||e.length===0)return{ok:!1,error:`renameProjectFile: from must be a non-empty string`};if(typeof t!=`string`||t.length===0)return{ok:!1,error:`renameProjectFile: to must be a non-empty string`};let r=await Qi(Ki,{from:e,to:t},n);return r.ok?{ok:!0}:{ok:!1,error:r.error}}async function ea(e,t={}){if(typeof e!=`string`||e.length===0)return{ok:!1,error:`duplicateProjectFile: path must be a non-empty string`};let n=await Qi(qi,{path:e},t);return n.ok?{ok:!0,path:typeof n.path==`string`?n.path:void 0}:{ok:!1,error:n.error}}async function ta(e,t={}){if(typeof e!=`string`||e.length===0)return{ok:!1,error:`deleteProjectFile: path must be a non-empty string`};let n=await Qi(Ji,{path:e},t);return n.ok?{ok:!0}:{ok:!1,error:n.error}}async function na(e,t,n={}){if(typeof e!=`string`||e.length===0)return{ok:!1,error:`revealProjectFile: path must be a non-empty string`};if(t!==`editor`&&t!==`finder`)return{ok:!1,error:`revealProjectFile: target must be "editor" or "finder"`};let r=await Qi(Yi,{path:e,target:t},n);return r.ok?{ok:!0}:{ok:!1,error:r.error}}function ra(){return Xi()}async function ia(e){if(typeof globalThis>`u`||typeof globalThis.fetch!=`function`)return{ok:!1,value:{},error:`no fetch implementation available`};let t=e.indexOf(`/.lerret/`),n=t===-1?e.replace(/^\/+/,``):e.slice(t+9),r=[`/@lerret-project/${n}`,`/@fixture-lerret/${n}`];for(let e of r)try{let t=await globalThis.fetch(e,{method:`GET`,cache:`no-store`});if(t.status===404||!t.ok)continue;let n=t.headers.get(`content-type`)||``;if(!n.includes(`json`)&&!n.includes(`text/plain`))continue;let r=await t.text();try{return{ok:!0,value:JSON.parse(r)}}catch(e){return{ok:!1,value:{},error:e instanceof Error?e.message:String(e)}}}catch{}return{ok:!0,value:{},missing:!0}}if(typeof document<`u`&&!document.getElementById(`data-editor-styles`)){let e=document.createElement(`style`);e.id=`data-editor-styles`,e.textContent=`.lm-data-editor {
266
+ display: flex;
267
+ flex-direction: column;
268
+ gap: var(--lm-space-4, 16px);
269
+ }
270
+ .lm-data-editor__empty {
271
+ font: var(--lm-weight-regular, 400) var(--lm-size-body, 13px)/var(--lm-lh-body, 1.45) var(--lm-font-sans);
272
+ color: var(--lm-text-tertiary, #6E6960);
273
+ padding: var(--lm-space-3, 12px) 0;
274
+ }
275
+ .lm-data-editor__path {
276
+ font-family: var(--lm-font-mono, ui-monospace, SFMono-Regular, monospace);
277
+ font-size: var(--lm-size-hint, 10px);
278
+ color: var(--lm-text-muted, #B8B3A8);
279
+ margin: 0;
280
+ letter-spacing: 0.04em;
281
+ }
282
+ .lm-data-editor__field {
283
+ /* FormControl already renders its own .lm-field wrapper */
284
+ }
285
+ .lm-data-editor__json {
286
+ width: 100%;
287
+ min-height: 280px;
288
+ box-sizing: border-box;
289
+ padding: var(--lm-space-2, 8px) var(--lm-space-3, 12px);
290
+ font-family: var(--lm-font-mono, ui-monospace, SFMono-Regular, monospace);
291
+ font-size: var(--lm-size-body, 13px);
292
+ line-height: var(--lm-lh-body, 1.45);
293
+ color: var(--lm-text-primary, #1A1714);
294
+ background: var(--lm-bg-primary, #FAF8F2);
295
+ border: 1px solid var(--lm-border, #DDD7CA);
296
+ border-radius: var(--lm-radius-sm, 6px);
297
+ outline: none;
298
+ resize: vertical;
299
+ transition: border-color var(--lm-duration-fast, 120ms) var(--lm-ease);
300
+ }
301
+ .lm-data-editor__json:focus {
302
+ border-color: var(--lm-accent, #B85B33);
303
+ box-shadow: var(--lm-focus-ring);
304
+ }
305
+ .lm-data-editor__json--invalid { border-color: var(--lm-error, #A8412B); }
306
+ .lm-data-editor__json-error {
307
+ display: flex;
308
+ align-items: flex-start;
309
+ gap: var(--lm-space-1, 4px);
310
+ font-size: var(--lm-size-body-sm, 12px);
311
+ color: var(--lm-error, #A8412B);
312
+ line-height: var(--lm-lh-body, 1.45);
313
+ margin: 0;
314
+ }
315
+ .lm-data-editor__saved {
316
+ display: inline-flex;
317
+ align-items: center;
318
+ gap: var(--lm-space-1, 4px);
319
+ font-size: var(--lm-size-body-sm, 12px);
320
+ color: var(--lm-text-tertiary, #6E6960);
321
+ opacity: 0;
322
+ transition: opacity var(--lm-duration-base, 220ms) var(--lm-ease);
323
+ }
324
+ .lm-data-editor__saved[data-visible] { opacity: 1; }
325
+ .lm-data-editor__saved-dot {
326
+ width: 6px;
327
+ height: 6px;
328
+ border-radius: var(--lm-radius-pill, 999px);
329
+ background: var(--lm-success, #4A6B3F);
330
+ }
331
+ .lm-data-editor__error-banner {
332
+ display: flex;
333
+ align-items: flex-start;
334
+ gap: var(--lm-space-2, 8px);
335
+ padding: var(--lm-space-2, 8px) var(--lm-space-3, 12px);
336
+ background: var(--lm-bg-tertiary, #E8E2D4);
337
+ border: 1px solid var(--lm-border, #DDD7CA);
338
+ border-radius: var(--lm-radius-sm, 6px);
339
+ font-size: var(--lm-size-body-sm, 12px);
340
+ color: var(--lm-text-primary, #1A1714);
341
+ }
342
+ .lm-data-editor__create {
343
+ display: flex;
344
+ flex-direction: column;
345
+ gap: var(--lm-space-3, 12px);
346
+ padding: var(--lm-space-4, 16px) 0;
347
+ }
348
+ .lm-data-editor__create-msg {
349
+ font: var(--lm-weight-regular, 400) var(--lm-size-body, 13px)/var(--lm-lh-body, 1.45) var(--lm-font-sans, ui-sans-serif);
350
+ color: var(--lm-text-secondary, #3A3530);
351
+ margin: 0;
352
+ }
353
+ .lm-data-editor__create-path {
354
+ font-family: var(--lm-font-mono, ui-monospace, SFMono-Regular, monospace);
355
+ font-size: var(--lm-size-hint, 10px);
356
+ color: var(--lm-text-muted, #B8B3A8);
357
+ letter-spacing: 0.04em;
358
+ }
359
+ .lm-data-editor__create-btn {
360
+ display: inline-flex;
361
+ align-items: center;
362
+ gap: var(--lm-space-1, 4px);
363
+ padding: var(--lm-space-2, 8px) var(--lm-space-3, 12px);
364
+ font: var(--lm-weight-medium, 600) var(--lm-size-body, 13px)/var(--lm-lh-body, 1.45) var(--lm-font-sans, ui-sans-serif);
365
+ color: var(--lm-bg-primary, #FAF8F2);
366
+ background: var(--lm-accent, #B85B33);
367
+ border: none;
368
+ border-radius: var(--lm-radius-sm, 6px);
369
+ cursor: pointer;
370
+ align-self: flex-start;
371
+ outline: none;
372
+ transition: opacity var(--lm-duration-fast, 120ms) var(--lm-ease, ease);
373
+ }
374
+ .lm-data-editor__create-btn:focus-visible {
375
+ box-shadow: var(--lm-focus-ring, 0 0 0 2px rgba(184, 91, 51, 0.20));
376
+ }
377
+ .lm-data-editor__create-btn:disabled {
378
+ opacity: 0.5;
379
+ cursor: not-allowed;
380
+ }
381
+ .lm-data-editor__create-error {
382
+ font-size: var(--lm-size-body-sm, 12px);
383
+ color: var(--lm-error, #A8412B);
384
+ margin: 0;
385
+ }
386
+
387
+ @media (prefers-reduced-motion: reduce) {
388
+ .lm-data-editor__saved { transition: none !important; }
389
+ .lm-data-editor__create-btn { transition: none !important; }
390
+ }`,document.head.appendChild(e)}function aa(e){let t=e.path.lastIndexOf(`/`);return`${t===-1?``:e.path.slice(0,t+1)}${e.name}.data.json`}function oa(e,t){let n=Array.isArray(t)&&t.length>0?t:[`default`],r=n.includes(`default`)?`default`:n[0];if(!e||e.source===`absent`)return{value:{},mode:`absent`,primaryName:r};let i=l(e,n).get(r);return!i||i.source===`absent`?{value:{},mode:`absent`,primaryName:r}:{value:i.value&&typeof i.value==`object`&&!Array.isArray(i.value)?i.value:{},mode:i.source,primaryName:r}}function sa(e,t){let{mode:n,primaryName:r,fieldKey:i,fieldValue:a}=t,o=e&&typeof e==`object`&&!Array.isArray(e)?e:{};if(n===`keyed`){let e=o[r]&&typeof o[r]==`object`&&!Array.isArray(o[r])?o[r]:{};return{...o,[r]:{...e,[i]:a}}}return{...o,[i]:a}}function ca(e,t){let{currentMode:n,variantName:r,migrateFrom:i,allVariants:a,fieldKey:o,fieldValue:s}=t,c=e&&typeof e==`object`&&!Array.isArray(e)?e:{};if(n===`keyed`){let e=c[r]&&typeof c[r]==`object`&&!Array.isArray(c[r])?c[r]:{};return{next:{...c,[r]:{...e,[o]:s}},didMigrate:!1}}let l=n===`shared`?{...c}:{},u={};for(let e of a)e===r?u[e]={[o]:s}:e===i?u[e]={...l}:u[e]={};return{next:u,didMigrate:!0}}function la(e){if(!e||typeof e!=`object`)return{};let t={};for(let[n,r]of Object.entries(e))r&&typeof r==`object`&&Object.prototype.hasOwnProperty.call(r,`default`)&&(t[n]=r.default);return t}function ua(e,t){let n=la(t),r=Array.isArray(e)&&e.length>0?e:[`default`];if(r.length===1)return{...n};let i={};for(let e of r)i[e]={...n};return i}function da(e,t,n){let r=l(e&&typeof e==`object`&&!Array.isArray(e)?{source:`json`,value:e}:{source:`absent`},n).get(t);return!r||r.source===`absent`?{formValues:{},mode:`absent`}:{formValues:{...r.value&&typeof r.value==`object`&&!Array.isArray(r.value)?r.value:{}},mode:r.source}}function fa({open:e,onClose:t,entry:n,assetData:r,writer:i,reader:a,initialFocusField:s,initialActiveVariant:c}){let l=i||Zi,u=a||ia,d=n?.asset,f=n?.meta||{},p=f&&typeof f.propsSchema==`object`?f.propsSchema:null,m=n?.variantNames,h=n?.variantName,g=T.useMemo(()=>Array.isArray(m)&&m.length>0?m:h?[h]:[`default`],[m,h]),_=g.length>1,v=g.includes(`default`)?`default`:g[0],y=d?aa(d):null,b=T.useMemo(()=>c&&g.includes(c)?c:v,[c,g,v]),[x,S]=T.useState(b),[C,w]=T.useState(!1),[E,O]=T.useState(!1),[k,A]=T.useState(null),[j,M]=T.useState(()=>r&&r.source!==`absent`?r.value:{}),[N,P]=T.useState(()=>!r||r.source===`absent`?`absent`:oa(r,g).mode),[F,I]=T.useState(()=>({...oa(r,g).value})),[L,R]=T.useState(!1),[ee,te]=T.useState(null),ne=T.useRef(0),[z,B]=T.useState(()=>o(r&&r.source!==`absent`?r.value:{})),[V,H]=T.useState(null),U=T.useRef(null),W=T.useCallback(()=>{ne.current+=1;let e=ne.current;R(!0),setTimeout(()=>{ne.current===e&&R(!1)},1500)},[]);T.useEffect(()=>{S(c&&g.includes(c)?c:v),w(!1),A(null),M(r&&r.source!==`absent`?r.value:{});let e=oa(r,g);P(e.mode),I({...e.value})},[n?.id,n?.variantName]);let re=T.useRef(!1);T.useEffect(()=>{let t=e&&!re.current;re.current=e,t&&c&&g.includes(c)&&S(c)},[e,c,g]);let ie=T.useRef(!1);T.useEffect(()=>{if(!e){ie.current=!1;return}if(!s||ie.current)return;let t=setTimeout(()=>{let e=typeof CSS<`u`&&typeof CSS.escape==`function`?CSS.escape(s):s.replace(/[^\w-]/g,`\\$&`),t=[`[data-field-key="${e}"] input`,`[data-field-key="${e}"] select`,`[data-field-key="${e}"] textarea`,`[data-field-key="${e}"]`,`[name="${e}"]`,`#field-${e}`].join(`, `),n=document.querySelector(t);n&&(n.scrollIntoView({block:`center`,behavior:`smooth`}),typeof n.focus==`function`&&n.focus(),ie.current=!0)},80);return()=>clearTimeout(t)},[e,s]),T.useEffect(()=>{if(!e||!y)return;let t=!1;return(async()=>{let e=await u(y);if(t)return;if(!e.ok){te(e.error||`failed to read data file`);return}if(e.missing){w(!0),M({}),P(`absent`),I({}),B(o({}));return}let n=e.value;w(!1),M(n);let{formValues:r,mode:i}=da(n,x,g);P(i),I(r),B(o(n))})(),()=>{t=!0}},[e,y]),T.useEffect(()=>{p||(B(o(r&&r.source!==`absent`?r.value:{})),H(null))},[n?.id]);let G=T.useCallback(e=>{S(e);let{formValues:t,mode:n}=da(j,e,g);P(n),I(t)},[j,g]),K=T.useCallback(async(e,t)=>{if(!y){te(`cannot determine data file path`);return}I(n=>({...n,[e]:t}));let n,r=!1;if(_){let i=ca(j,{currentMode:N,variantName:x,migrateFrom:v,allVariants:g,fieldKey:e,fieldValue:t});n=i.next,r=i.didMigrate}else{let r=oa({source:`json`,value:j},g);n=sa(j,{mode:r.mode,primaryName:r.primaryName,fieldKey:e,fieldValue:t})}let i=await l(y,o(n));if(!i.ok){te(i.error||`write failed`);return}te(null),M(n),r&&P(`keyed`),W()},[y,j,N,x,v,g,_,l,W]),ae=T.useCallback(e=>{let t=e.target.value;B(t),U.current&&clearTimeout(U.current),U.current=setTimeout(async()=>{if(!y){H(`cannot determine data file path`);return}let e;try{e=JSON.parse(t)}catch(e){H(e instanceof Error?e.message:String(e));return}H(null);let n=await l(y,o(e));if(!n.ok){te(n.error||`write failed`);return}te(null),M(e),W()},500)},[y,l,W]),oe=T.useCallback(async()=>{if(!y)return;O(!0),A(null);let e=ua(g,p),t=await l(y,o(e));if(O(!1),!t.ok){A(t.error||`create failed`);return}w(!1),M(e),P(_?`keyed`:`shared`);let{formValues:n}=da(e,x,g);I(n),B(o(e)),W()},[y,g,p,l,_,x,W]);return T.useEffect(()=>()=>{U.current&&clearTimeout(U.current)},[]),(0,D.jsx)(ji,{open:e,onClose:t,title:`Data · ${n?.label||d?.name||`asset`}`,dirty:!1,footer:(0,D.jsxs)(D.Fragment,{children:[ee&&(0,D.jsx)(`div`,{className:`lm-data-editor__error-banner`,role:`alert`,"aria-live":`polite`,children:(0,D.jsxs)(`span`,{children:[`Write failed: `,ee]})}),(0,D.jsxs)(`span`,{className:`lm-data-editor__saved`,"data-visible":L?``:void 0,"aria-live":`polite`,children:[(0,D.jsx)(`span`,{className:`lm-data-editor__saved-dot`,"aria-hidden":`true`}),`Saved`]})]}),children:(0,D.jsxs)(`div`,{className:`lm-data-editor`,"data-testid":`lm-data-editor`,children:[y&&(0,D.jsx)(`p`,{className:`lm-data-editor__path`,"data-testid":`lm-data-editor-path`,children:y}),_&&!C&&(0,D.jsx)(Mi,{variants:g,activeVariant:x,onChange:G}),C?(0,D.jsx)(pa,{dataPath:y,creating:E,createError:k,onActivate:oe}):p?(0,D.jsx)(ma,{propsSchema:p,values:F,onCommitField:K}):(0,D.jsx)(ha,{value:z,onChange:ae,parseError:V})]})})}function pa({dataPath:e,creating:t,createError:n,onActivate:r}){return(0,D.jsxs)(`div`,{className:`lm-data-editor__create`,"data-testid":`lm-data-editor-create`,children:[(0,D.jsxs)(`p`,{className:`lm-data-editor__create-msg`,children:[`No data file exists for this asset yet.`,e&&(0,D.jsxs)(D.Fragment,{children:[` `,`The file will be created at`,` `,(0,D.jsx)(`span`,{className:`lm-data-editor__create-path`,children:e}),`.`]})]}),(0,D.jsx)(`button`,{type:`button`,className:`lm-data-editor__create-btn`,disabled:t,onClick:r,"data-testid":`lm-data-editor-create-btn`,children:t?`Creating…`:`Create data file`}),n&&(0,D.jsxs)(`p`,{className:`lm-data-editor__create-error`,role:`alert`,"aria-live":`polite`,"data-testid":`lm-data-editor-create-error`,children:[`Could not create`,` `,e&&(0,D.jsx)(`span`,{className:`lm-data-editor__create-path`,children:e}),`: `,n]})]})}function ma({propsSchema:e,values:t,onCommitField:n}){return(0,D.jsx)(D.Fragment,{children:Object.keys(e).map(r=>{let i=e[r];return(0,D.jsx)(`div`,{className:`lm-data-editor__field`,children:(0,D.jsx)(Wi,{fieldKey:r,schema:i&&typeof i==`object`?i:{type:`string`},value:t[r],onCommit:e=>n(r,e)})},r)})})}function ha({value:e,onChange:t,parseError:n}){let r=!!n;return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`textarea`,{className:`lm-data-editor__json`+(r?` lm-data-editor__json--invalid`:``),value:e,onChange:t,spellCheck:!1,autoCorrect:`off`,autoCapitalize:`off`,"aria-invalid":r?`true`:void 0,"aria-label":`Raw JSON editor`,"data-testid":`lm-data-editor-raw-json`}),r&&(0,D.jsx)(`p`,{className:`lm-data-editor__json-error`,role:`alert`,"aria-live":`polite`,children:(0,D.jsxs)(`span`,{children:[`Invalid JSON: `,n]})})]})}var ga=[`dimensions`,`label`,`tags`,`propsSchema`];function _a(e,t){let n=0,r=t,i=e.length;for(;r<i;){let t=e[r];if(t===`"`||t===`'`||t==="`"){let n=t;for(r+=1;r<i;){let t=e[r];if(t===`\\`){r+=2;continue}if(n==="`"&&t===`$`&&e[r+1]===`{`){let t=_a(e,r+1);if(t===-1)return-1;r=t+1;continue}if(t===n){r+=1;break}r+=1}continue}if(t===`/`&&e[r+1]===`/`){let t=e.indexOf(`
391
+ `,r+2);r=t===-1?i:t;continue}if(t===`/`&&e[r+1]===`*`){let t=e.indexOf(`*/`,r+2);if(t===-1)return-1;r=t+2;continue}if(t===`{`)n+=1;else if(t===`}`&&(--n,n===0))return r;r+=1}return-1}function va(e,t,n,r){let i=t;for(;i<n;){for(;i<n&&/\s/.test(e[i]);)i+=1;if(i>=n)return null;if(e[i]===`/`&&e[i+1]===`/`){let t=e.indexOf(`
392
+ `,i+2);i=t===-1?n:t+1;continue}if(e[i]===`/`&&e[i+1]===`*`){let t=e.indexOf(`*/`,i+2);if(t===-1)return null;i=t+2;continue}let t;if(e[i]===`"`||e[i]===`'`){let n=e[i],r=e.indexOf(n,i+1);if(r===-1)return null;t=e.slice(i+1,r),i=r+1}else{let n=/[A-Za-z_$][A-Za-z0-9_$]*/.exec(e.slice(i));if(!n||n.index!==0)return null;t=n[0],i+=t.length}for(;i<n&&/\s/.test(e[i]);)i+=1;if(e[i]!==`:`)return null;for(i+=1;i<n&&/\s/.test(e[i]);)i+=1;let a=i;for(;i<n;){let t=e[i];if(t===`"`||t===`'`||t==="`"){let r=t;for(i+=1;i<n;){let t=e[i];if(t===`\\`){i+=2;continue}if(r==="`"&&t===`$`&&e[i+1]===`{`){let t=_a(e,i+1);if(t===-1)return null;i=t+1;continue}if(t===r){i+=1;break}i+=1}continue}if(t===`/`&&e[i+1]===`/`){let t=e.indexOf(`
393
+ `,i+2);i=t===-1?n:t;continue}if(t===`/`&&e[i+1]===`*`){let t=e.indexOf(`*/`,i+2);if(t===-1)return null;i=t+2;continue}if(t===`{`||t===`[`||t===`(`){let n=t===`{`?_a(e,i):ya(e,i,t);if(n===-1)return null;i=n+1;continue}if(t===`,`)break;i+=1}let o=i;for(;o>a&&/\s/.test(e[o-1]);)--o;if(t===r)return{start:a,end:o};e[i]===`,`&&(i+=1)}return null}function ya(e,t,n){let r=n===`[`?`]`:`)`,i=0,a=t,o=e.length;for(;a<o;){let t=e[a];if(t===`"`||t===`'`||t==="`"){let n=t;for(a+=1;a<o;){let t=e[a];if(t===`\\`){a+=2;continue}if(n==="`"&&t===`$`&&e[a+1]===`{`){let t=_a(e,a+1);if(t===-1)return-1;a=t+1;continue}if(t===n){a+=1;break}a+=1}continue}if(t===`/`&&e[a+1]===`/`){let t=e.indexOf(`
394
+ `,a+2);a=t===-1?o:t;continue}if(t===`/`&&e[a+1]===`*`){let t=e.indexOf(`*/`,a+2);if(t===-1)return-1;a=t+2;continue}if(t===`{`){let t=_a(e,a);if(t===-1)return-1;a=t+1;continue}if(t===n)i+=1;else if(t===r&&(--i,i===0))return a;a+=1}return-1}function ba(e){let t=/^[ \t]*export\s+(const|let|var)\s+meta\s*=\s*\{/m.exec(e);if(!t)return null;let n=t[1],r=t.index,i=t.index+t[0].length-1,a=_a(e,i);if(a===-1)return null;let o=a+1,s=o;for(;s<e.length&&(e[s]===` `||e[s]===` `);)s+=1;return e[s]===`;`&&(o=s+1),{keyword:n,declStart:r,declEnd:o,braceOpen:i,braceClose:a}}function xa(e){return JSON.stringify(e)}function Sa(e){return e.length===0?`[]`:`[${e.map(xa).join(`, `)}]`}function Ca(e){if(!e||typeof e!=`object`)return`{}`;let t=e.width,n=e.height,r=[];return typeof t==`number`&&Number.isFinite(t)&&t>0&&r.push(`width: ${t}`),typeof n==`number`&&Number.isFinite(n)&&n>0&&r.push(`height: ${n}`),r.length===0?`{}`:`{ ${r.join(`, `)} }`}function wa(e,t){let n=` `.repeat(t);return e.split(`
395
+ `).map((e,t)=>t===0?e:e.length>0?n+e:e).join(`
396
+ `)}function Ta(e,t){if(typeof e!=`string`)return{ok:!1,reason:`source must be a string`};if(!t||typeof t!=`object`||Array.isArray(t))return{ok:!1,reason:`nextMeta must be an object`};let n=ba(e);if(!n)return{ok:!1,reason:"no `export const meta = { ... }` declaration found, or the value is not an object literal"};let r=n.braceOpen+1,i=n.braceClose,a=va(e,r,i,`propsSchema`),o=null;a&&(o=e.slice(a.start,a.end));let s=[`{`];for(let e of ga){if(e===`propsSchema`){if(o!==null){let e=wa(o,2);s.push(` propsSchema: ${e},`)}continue}if(e===`dimensions`){Object.prototype.hasOwnProperty.call(t,`dimensions`)&&s.push(` dimensions: ${Ca(t.dimensions)},`);continue}if(e===`label`){let e=t.label;typeof e==`string`&&e.trim().length>0&&s.push(` label: ${xa(e.trim())},`);continue}if(e===`tags`){let e=Array.isArray(t.tags)?t.tags.filter(e=>typeof e==`string`&&e.trim().length>0).map(e=>e.trim()):null;e&&e.length>0&&s.push(` tags: ${Sa(e)},`);continue}}s.push(`}`);let c=`export ${n.keyword} meta = ${s.join(`
397
+ `)};`;return{ok:!0,source:e.slice(0,n.declStart)+c+e.slice(n.declEnd)}}async function Ea(e){if(typeof globalThis>`u`||typeof globalThis.fetch!=`function`)return{ok:!1,error:`no fetch implementation available`};let t=e.indexOf(`/.lerret/`),n=t===-1?e.replace(/^\/+/,``):e.slice(t+9),r=[`/@lerret-project/${n}?raw`,`/@fixture-lerret/${n}?raw`];for(let e of r)try{let t=await globalThis.fetch(e,{method:`GET`,cache:`no-store`});if(t.status===404||!t.ok)continue;let n=await t.text(),r=/^export default (?<json>"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|`(?:[^`\\]|\\.)*`)/m.exec(n);if(r)try{let e=r.groups.json;return e.startsWith(`"`)?{ok:!0,source:JSON.parse(e)}:{ok:!0,source:e.slice(1,-1).replace(/\\(.)/g,(e,t)=>t===`n`?`
398
+ `:t===`t`?` `:t===`r`?`\r`:t)}}catch{}return{ok:!0,source:n}}catch{}return{ok:!1,error:`could not fetch asset source`}}if(typeof document<`u`&&!document.getElementById(`meta-editor-styles`)){let e=document.createElement(`style`);e.id=`meta-editor-styles`,e.textContent=`.lm-meta-editor {
399
+ display: flex;
400
+ flex-direction: column;
401
+ gap: var(--lm-space-4, 16px);
402
+ }
403
+ .lm-meta-editor__path {
404
+ font-family: var(--lm-font-mono, ui-monospace, SFMono-Regular, monospace);
405
+ font-size: var(--lm-size-hint, 10px);
406
+ color: var(--lm-text-muted, #B8B3A8);
407
+ margin: 0;
408
+ letter-spacing: 0.04em;
409
+ }
410
+ .lm-meta-editor__dim-row {
411
+ display: grid;
412
+ grid-template-columns: 1fr 1fr;
413
+ gap: var(--lm-space-3, 12px);
414
+ }
415
+ .lm-meta-editor__saved {
416
+ display: inline-flex;
417
+ align-items: center;
418
+ gap: var(--lm-space-1, 4px);
419
+ font-size: var(--lm-size-body-sm, 12px);
420
+ color: var(--lm-text-tertiary, #6E6960);
421
+ opacity: 0;
422
+ transition: opacity var(--lm-duration-base, 220ms) var(--lm-ease);
423
+ }
424
+ .lm-meta-editor__saved[data-visible] { opacity: 1; }
425
+ .lm-meta-editor__saved-dot {
426
+ width: 6px;
427
+ height: 6px;
428
+ border-radius: var(--lm-radius-pill, 999px);
429
+ background: var(--lm-success, #4A6B3F);
430
+ }
431
+ .lm-meta-editor__error-banner {
432
+ display: flex;
433
+ align-items: flex-start;
434
+ gap: var(--lm-space-2, 8px);
435
+ padding: var(--lm-space-2, 8px) var(--lm-space-3, 12px);
436
+ background: var(--lm-bg-tertiary, #E8E2D4);
437
+ border: 1px solid var(--lm-border, #DDD7CA);
438
+ border-radius: var(--lm-radius-sm, 6px);
439
+ font-size: var(--lm-size-body-sm, 12px);
440
+ color: var(--lm-text-primary, #1A1714);
441
+ line-height: var(--lm-lh-body, 1.45);
442
+ word-break: break-all;
443
+ }
444
+ /* Calm guidance panel for the rewriter-failure path (NFR8). */
445
+ .lm-meta-editor__guidance {
446
+ display: flex;
447
+ flex-direction: column;
448
+ gap: var(--lm-space-2, 8px);
449
+ padding: var(--lm-space-3, 12px) var(--lm-space-4, 16px);
450
+ background: var(--lm-bg-secondary, #F2EEE6);
451
+ border: 1px dashed var(--lm-border, #DDD7CA);
452
+ border-radius: var(--lm-radius-sm, 6px);
453
+ }
454
+ .lm-meta-editor__guidance-title {
455
+ font: var(--lm-weight-semibold, 600) var(--lm-size-body, 13px)/var(--lm-lh-body, 1.45) var(--lm-font-sans);
456
+ color: var(--lm-text-primary, #1A1714);
457
+ margin: 0;
458
+ }
459
+ .lm-meta-editor__guidance-body {
460
+ font-size: var(--lm-size-body-sm, 12px);
461
+ color: var(--lm-text-secondary, #3A3530);
462
+ line-height: var(--lm-lh-body, 1.45);
463
+ margin: 0;
464
+ }
465
+ .lm-meta-editor__guidance-path {
466
+ font-family: var(--lm-font-mono, ui-monospace, SFMono-Regular, monospace);
467
+ font-size: var(--lm-size-hint, 10px);
468
+ color: var(--lm-text-muted, #B8B3A8);
469
+ letter-spacing: 0.04em;
470
+ word-break: break-all;
471
+ }
472
+
473
+ @media (prefers-reduced-motion: reduce) {
474
+ .lm-meta-editor__saved { transition: none !important; }
475
+ }`,document.head.appendChild(e)}var Da={type:`number`,min:1},Oa={type:`string`,description:`Human-readable label shown above the artboard`},ka={type:`array`,description:`Tags for grouping / filtering (each is a short string)`,itemSchema:{type:`string`}};function Aa({open:e,onClose:t,entry:n,writer:r,reader:i}){let a=r||Zi,o=i||Ea,s=n?.asset,c=n?.meta||{},l=s?.path||null,u=T.useMemo(()=>{let e=c.dimensions||{};return{width:typeof e.width==`number`?e.width:void 0,height:typeof e.height==`number`?e.height:void 0}},[n?.id]),d=typeof c.label==`string`?c.label:``,f=Array.isArray(c.tags)?c.tags:[],[p,m]=T.useState(u.width),[h,g]=T.useState(u.height),[_,v]=T.useState(d),[y,b]=T.useState(f);T.useEffect(()=>{m(u.width),g(u.height),v(d),b(f)},[n?.id]);let[x,S]=T.useState(!1),[C,w]=T.useState(null),[E,O]=T.useState(null),k=T.useRef(0),A=T.useCallback(()=>{k.current+=1;let e=k.current;S(!0),setTimeout(()=>{k.current===e&&S(!1)},1500)},[]),j=T.useCallback(async e=>{if(!l){w(`cannot determine asset path`);return}if(E)return;let t={dimensions:{width:`width`in e?e.width:p,height:`height`in e?e.height:h},label:`label`in e?e.label:_,tags:`tags`in e?e.tags:y},n=await o(l);if(!n.ok||typeof n.source!=`string`){w(n.error||`failed to read asset source`);return}let r=Ta(n.source,t);if(!r.ok){O(r.reason);return}let i=await a(l,r.source);if(!i.ok){w(i.error||`write failed`);return}w(null),A()},[l,o,a,p,h,_,y,E,A]),M=T.useCallback(e=>{let t=typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0;m(t),j({width:t})},[j]),N=T.useCallback(e=>{let t=typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0;g(t),j({height:t})},[j]),P=T.useCallback(e=>{let t=typeof e==`string`?e:``;v(t),j({label:t})},[j]),F=T.useCallback(e=>{let t=Array.isArray(e)?e.map(e=>typeof e==`string`?e:``):[];b(t),j({tags:t})},[j]);return T.useEffect(()=>{if(!e||!l)return;let t=!1;return O(null),w(null),(async()=>{let e=await o(l);if(t)return;if(!e.ok||typeof e.source!=`string`){w(e.error||`failed to read asset source`);return}let n=Ta(e.source,{dimensions:{width:u.width,height:u.height},label:d,tags:f});n.ok||O(n.reason)})(),()=>{t=!0}},[e,l]),(0,D.jsx)(ji,{open:e,onClose:t,title:`Meta · ${n?.label||s?.name||`asset`}`,dirty:!1,footer:(0,D.jsxs)(D.Fragment,{children:[C&&(0,D.jsx)(`div`,{className:`lm-meta-editor__error-banner`,role:`alert`,"aria-live":`polite`,children:(0,D.jsxs)(`span`,{children:[`Write failed: `,C]})}),(0,D.jsxs)(`span`,{className:`lm-meta-editor__saved`,"data-visible":x?``:void 0,"aria-live":`polite`,children:[(0,D.jsx)(`span`,{className:`lm-meta-editor__saved-dot`,"aria-hidden":`true`}),`Saved`]})]}),children:(0,D.jsxs)(`div`,{className:`lm-meta-editor`,"data-testid":`lm-meta-editor`,children:[l&&(0,D.jsx)(`p`,{className:`lm-meta-editor__path`,"data-testid":`lm-meta-editor-path`,children:l}),E&&(0,D.jsxs)(`div`,{className:`lm-meta-editor__guidance`,role:`status`,"aria-live":`polite`,"data-testid":`lm-meta-editor-guidance`,children:[(0,D.jsxs)(`p`,{className:`lm-meta-editor__guidance-title`,children:[`Cannot edit `,(0,D.jsx)(`code`,{children:`meta`}),` here — open the file in your editor`]}),(0,D.jsxs)(`p`,{className:`lm-meta-editor__guidance-body`,children:[`The `,(0,D.jsx)(`code`,{children:`meta`}),` export in this file uses a shape the in-studio form can't safely modify (`,E,`). Edit the file directly to change its `,(0,D.jsx)(`code`,{children:`dimensions`}),`, `,(0,D.jsx)(`code`,{children:`label`}),`, or `,(0,D.jsx)(`code`,{children:`tags`}),`; the canvas will pick up the change automatically.`]}),l&&(0,D.jsx)(`code`,{className:`lm-meta-editor__guidance-path`,children:l})]}),(0,D.jsxs)(`div`,{className:`lm-meta-editor__dim-row`,children:[(0,D.jsx)(Wi,{fieldKey:`width`,schema:Da,value:p,onCommit:M,disabled:!!E}),(0,D.jsx)(Wi,{fieldKey:`height`,schema:Da,value:h,onCommit:N,disabled:!!E})]}),(0,D.jsx)(Wi,{fieldKey:`label`,schema:Oa,value:_,onCommit:P,disabled:!!E}),(0,D.jsx)(Wi,{fieldKey:`tags`,schema:ka,value:y,onCommit:F,disabled:!!E})]})})}var ja=400;function Ma(){return typeof window>`u`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}if(typeof document<`u`&&!document.getElementById(`markdown-editor-styles`)){let e=document.createElement(`style`);e.id=`markdown-editor-styles`,e.textContent=`.lm-md-editor {
476
+ display: flex;
477
+ gap: var(--lm-space-4, 16px);
478
+ min-height: 360px;
479
+ /* Fill the EditorSheet body but never overflow it. */
480
+ overflow: hidden;
481
+ }
482
+
483
+ /* ── Left pane: raw textarea ─────────────────────────────────────── */
484
+ .lm-md-editor__input-pane {
485
+ flex: 1;
486
+ display: flex;
487
+ flex-direction: column;
488
+ gap: var(--lm-space-2, 8px);
489
+ min-width: 0;
490
+ }
491
+ .lm-md-editor__pane-label {
492
+ font: var(--lm-weight-semibold, 600) var(--lm-size-hint, 10px)/1 var(--lm-font-sans, sans-serif);
493
+ letter-spacing: var(--lm-tracking-caps, 0.5px);
494
+ text-transform: uppercase;
495
+ color: var(--lm-text-tertiary, #6E6960);
496
+ user-select: none;
497
+ }
498
+ .lm-md-editor__textarea {
499
+ flex: 1;
500
+ width: 100%;
501
+ min-height: 320px;
502
+ box-sizing: border-box;
503
+ padding: var(--lm-space-3, 12px);
504
+ font-family: var(--lm-font-mono, ui-monospace, SFMono-Regular, "Cascadia Code", monospace);
505
+ font-size: var(--lm-size-body, 13px);
506
+ line-height: var(--lm-lh-body, 1.45);
507
+ color: var(--lm-text-primary, #1A1714);
508
+ background: var(--lm-bg-primary, #FAF8F2);
509
+ border: 1px solid var(--lm-border, #DDD7CA);
510
+ border-radius: var(--lm-radius-sm, 6px);
511
+ outline: none;
512
+ resize: vertical;
513
+ transition: border-color var(--lm-duration-fast, 120ms) var(--lm-ease);
514
+ }
515
+ .lm-md-editor__textarea:focus {
516
+ border-color: var(--lm-accent, #B85B33);
517
+ box-shadow: var(--lm-focus-ring);
518
+ }
519
+
520
+ /* ── Right pane: live preview ─────────────────────────────────────── */
521
+ .lm-md-editor__preview-pane {
522
+ flex: 1;
523
+ display: flex;
524
+ flex-direction: column;
525
+ gap: var(--lm-space-2, 8px);
526
+ min-width: 0;
527
+ overflow: hidden;
528
+ }
529
+ .lm-md-editor__preview-scroll {
530
+ flex: 1;
531
+ overflow-y: auto;
532
+ overflow-x: hidden;
533
+ background: var(--lm-bg-secondary, #F2EEE6);
534
+ border: 1px solid var(--lm-border, #DDD7CA);
535
+ border-radius: var(--lm-radius-sm, 6px);
536
+ padding: var(--lm-space-3, 12px) var(--lm-space-4, 16px);
537
+ scrollbar-width: thin;
538
+ scrollbar-color: var(--lm-border, #DDD7CA) transparent;
539
+
540
+ /* Preview transitions: fade when motion is allowed, instant otherwise. */
541
+ transition: opacity var(--lm-duration-fast, 120ms) var(--lm-ease);
542
+ }
543
+ .lm-md-editor__preview-scroll[data-reduced-motion] {
544
+ transition: none !important;
545
+ }
546
+
547
+ /* ── Path / file metadata row ───────────────────────────────────────── */
548
+ .lm-md-editor__path {
549
+ font-family: var(--lm-font-mono, ui-monospace, SFMono-Regular, monospace);
550
+ font-size: var(--lm-size-hint, 10px);
551
+ color: var(--lm-text-muted, #B8B3A8);
552
+ letter-spacing: 0.04em;
553
+ margin: 0 0 var(--lm-space-2, 8px);
554
+ word-break: break-all;
555
+ }
556
+
557
+ /* ── Footer: error banner + saved indicator ──────────────────────── */
558
+ .lm-md-editor__error-banner {
559
+ display: flex;
560
+ align-items: flex-start;
561
+ gap: var(--lm-space-2, 8px);
562
+ padding: var(--lm-space-2, 8px) var(--lm-space-3, 12px);
563
+ background: var(--lm-bg-tertiary, #E8E2D4);
564
+ border: 1px solid var(--lm-border, #DDD7CA);
565
+ border-radius: var(--lm-radius-sm, 6px);
566
+ font-size: var(--lm-size-body-sm, 12px);
567
+ color: var(--lm-text-primary, #1A1714);
568
+ line-height: var(--lm-lh-body, 1.45);
569
+ }
570
+ .lm-md-editor__saved {
571
+ display: inline-flex;
572
+ align-items: center;
573
+ gap: var(--lm-space-1, 4px);
574
+ font-size: var(--lm-size-body-sm, 12px);
575
+ color: var(--lm-text-tertiary, #6E6960);
576
+ opacity: 0;
577
+ transition: opacity var(--lm-duration-base, 220ms) var(--lm-ease);
578
+ }
579
+ .lm-md-editor__saved[data-visible] { opacity: 1; }
580
+ .lm-md-editor__saved-dot {
581
+ width: 6px;
582
+ height: 6px;
583
+ border-radius: var(--lm-radius-pill, 999px);
584
+ background: var(--lm-success, #4A6B3F);
585
+ }
586
+
587
+ /* Reduced-motion overrides */
588
+ @media (prefers-reduced-motion: reduce) {
589
+ .lm-md-editor__textarea { transition: none !important; }
590
+ .lm-md-editor__preview-scroll { transition: none !important; }
591
+ .lm-md-editor__saved { transition: none !important; }
592
+ }`,document.head.appendChild(e)}function Na({open:e,onClose:t,entry:n,initialText:r,writer:i,onTextChange:a}){let o=i||Zi,s=n?.asset,c=s?.path||null,l=n?.label||s?.name||`Markdown`,u=typeof r==`string`?r:typeof n?.text==`string`?n.text:``,[d,f]=T.useState(u),[p,m]=T.useState(!1),[h,g]=T.useState(null),[_]=T.useState(()=>Ma()),y=T.useRef(null),b=T.useRef(0),x=T.useRef(d);T.useEffect(()=>{let e=typeof r==`string`?r:typeof n?.text==`string`?n.text:``;f(e),x.current=e,g(null),m(!1)},[n?.asset?.path]),T.useEffect(()=>()=>{y.current&&clearTimeout(y.current)},[]);let S=T.useCallback(async e=>{if(!c){g(`cannot determine file path for this markdown asset`);return}let t=await o(c,e);if(!t.ok){g(t.error||`write failed`);return}g(null),b.current+=1;let n=b.current;m(!0),setTimeout(()=>{b.current===n&&m(!1)},1500)},[c,o]),C=T.useCallback(e=>{let t=e.target.value;f(t),x.current=t,a?.(t),y.current&&clearTimeout(y.current),y.current=setTimeout(()=>{S(t)},ja)},[S,a]),w=T.useCallback(()=>{y.current&&=(clearTimeout(y.current),null),S(x.current)},[S]);return(0,D.jsx)(ji,{open:e,onClose:t,title:`Markdown · ${l}`,dirty:!1,footer:(0,D.jsxs)(D.Fragment,{children:[h&&(0,D.jsx)(`div`,{className:`lm-md-editor__error-banner`,role:`alert`,"aria-live":`polite`,"data-testid":`lm-md-editor-error`,children:(0,D.jsxs)(`span`,{children:[`Write failed: `,h,c&&(0,D.jsxs)(D.Fragment,{children:[` — `,(0,D.jsx)(`code`,{children:c})]})]})}),(0,D.jsxs)(`span`,{className:`lm-md-editor__saved`,"data-visible":p?``:void 0,"aria-live":`polite`,"data-testid":`lm-md-editor-saved`,children:[(0,D.jsx)(`span`,{className:`lm-md-editor__saved-dot`,"aria-hidden":`true`}),`Saved`]})]}),children:(0,D.jsxs)(`div`,{className:`lm-md-editor`,"data-testid":`lm-md-editor`,children:[c&&(0,D.jsx)(`p`,{className:`lm-md-editor__path`,style:{gridColumn:`1 / -1`},children:c}),(0,D.jsxs)(`div`,{className:`lm-md-editor__input-pane`,children:[(0,D.jsx)(`span`,{className:`lm-md-editor__pane-label`,"aria-hidden":`true`,children:`Markdown source`}),(0,D.jsx)(`textarea`,{className:`lm-md-editor__textarea`,value:d,onChange:C,onBlur:w,"aria-label":`Markdown source editor`,"data-testid":`lm-md-editor-textarea`,spellCheck:!1,autoCorrect:`off`,autoCapitalize:`off`})]}),(0,D.jsxs)(`div`,{className:`lm-md-editor__preview-pane`,children:[(0,D.jsx)(`span`,{className:`lm-md-editor__pane-label`,"aria-hidden":`true`,children:`Preview`}),(0,D.jsx)(`div`,{className:`lm-md-editor__preview-scroll lm-md-doc`,"data-testid":`lm-md-editor-preview`,"data-reduced-motion":_?``:void 0,"aria-label":`Markdown preview`,"aria-live":`off`,children:d.trim().length===0?(0,D.jsx)(`span`,{style:{color:`var(--lm-text-muted, #B8B3A8)`,fontSize:`var(--lm-size-body-sm, 12px)`,fontStyle:`italic`},children:`Empty document`}):(0,D.jsx)(v,{children:d})})]})]})})}var Pa=[`presentation`,`vars`,`liveRefresh`,`colors`,`fonts`];if(typeof document<`u`&&!document.getElementById(`config-editor-styles`)){let e=document.createElement(`style`);e.id=`config-editor-styles`,e.textContent=`.lm-config-editor {
593
+ display: flex;
594
+ flex-direction: column;
595
+ gap: var(--lm-space-4, 16px);
596
+ }
597
+ .lm-config-editor__cascade-note {
598
+ font: var(--lm-weight-regular, 400) var(--lm-size-hint, 10px)/var(--lm-lh-body, 1.45) var(--lm-font-sans);
599
+ color: var(--lm-text-muted, #B8B3A8);
600
+ letter-spacing: 0.04em;
601
+ margin: 0;
602
+ padding: 0 0 var(--lm-space-1, 4px);
603
+ border-bottom: 1px solid var(--lm-border-light, #E8E2D4);
604
+ }
605
+ .lm-config-editor__path {
606
+ font-family: var(--lm-font-mono, ui-monospace, SFMono-Regular, monospace);
607
+ font-size: var(--lm-size-hint, 10px);
608
+ color: var(--lm-text-muted, #B8B3A8);
609
+ margin: 0;
610
+ letter-spacing: 0.04em;
611
+ }
612
+ /* No-config-yet create prompt */
613
+ .lm-config-editor__create {
614
+ display: flex;
615
+ flex-direction: column;
616
+ gap: var(--lm-space-3, 12px);
617
+ padding: var(--lm-space-4, 16px);
618
+ background: var(--lm-bg-secondary, #F2EEE6);
619
+ border: 1px dashed var(--lm-border, #DDD7CA);
620
+ border-radius: var(--lm-radius-sm, 6px);
621
+ }
622
+ .lm-config-editor__create-msg {
623
+ font-size: var(--lm-size-body, 13px);
624
+ color: var(--lm-text-secondary, #3A3530);
625
+ margin: 0;
626
+ line-height: var(--lm-lh-body, 1.45);
627
+ }
628
+ .lm-config-editor__create-path {
629
+ font-family: var(--lm-font-mono, ui-monospace, SFMono-Regular, monospace);
630
+ font-size: var(--lm-size-hint, 10px);
631
+ color: var(--lm-text-muted, #B8B3A8);
632
+ letter-spacing: 0.04em;
633
+ word-break: break-all;
634
+ }
635
+ .lm-config-editor__create-btn {
636
+ align-self: flex-start;
637
+ padding: var(--lm-space-2, 8px) var(--lm-space-4, 16px);
638
+ font-family: var(--lm-font-sans);
639
+ font-size: var(--lm-size-body-sm, 12px);
640
+ font-weight: var(--lm-weight-semibold, 600);
641
+ letter-spacing: 0.04em;
642
+ color: var(--lm-text-primary, #1A1714);
643
+ background: var(--lm-bg-primary, #FAF8F2);
644
+ border: 1px solid var(--lm-border, #DDD7CA);
645
+ border-radius: var(--lm-radius-sm, 6px);
646
+ cursor: pointer;
647
+ transition: background var(--lm-duration-fast, 120ms);
648
+ }
649
+ .lm-config-editor__create-btn:hover {
650
+ background: var(--lm-bg-tertiary, #E8E2D4);
651
+ }
652
+ .lm-config-editor__create-btn:focus-visible {
653
+ box-shadow: var(--lm-focus-ring, 0 0 0 2px rgba(184, 91, 51, 0.20));
654
+ }
655
+ .lm-config-editor__create-btn:disabled {
656
+ opacity: 0.6;
657
+ cursor: wait;
658
+ }
659
+ /* Raw JSON toggle */
660
+ .lm-config-editor__raw-toggle {
661
+ display: inline-flex;
662
+ align-items: center;
663
+ gap: var(--lm-space-1, 4px);
664
+ font-family: var(--lm-font-sans);
665
+ font-size: var(--lm-size-body-sm, 12px);
666
+ color: var(--lm-text-tertiary, #6E6960);
667
+ background: none;
668
+ border: none;
669
+ cursor: pointer;
670
+ padding: 0;
671
+ text-decoration: underline;
672
+ text-underline-offset: 2px;
673
+ }
674
+ .lm-config-editor__raw-toggle:focus-visible {
675
+ box-shadow: var(--lm-focus-ring, 0 0 0 2px rgba(184, 91, 51, 0.20));
676
+ border-radius: 2px;
677
+ }
678
+ .lm-config-editor__raw-toggle:hover {
679
+ color: var(--lm-text-primary, #1A1714);
680
+ }
681
+ /* Raw JSON textarea */
682
+ .lm-config-editor__json {
683
+ width: 100%;
684
+ min-height: 200px;
685
+ box-sizing: border-box;
686
+ padding: var(--lm-space-2, 8px) var(--lm-space-3, 12px);
687
+ font-family: var(--lm-font-mono, ui-monospace, SFMono-Regular, monospace);
688
+ font-size: var(--lm-size-body, 13px);
689
+ line-height: var(--lm-lh-body, 1.45);
690
+ color: var(--lm-text-primary, #1A1714);
691
+ background: var(--lm-bg-primary, #FAF8F2);
692
+ border: 1px solid var(--lm-border, #DDD7CA);
693
+ border-radius: var(--lm-radius-sm, 6px);
694
+ outline: none;
695
+ resize: vertical;
696
+ transition: border-color var(--lm-duration-fast, 120ms) var(--lm-ease);
697
+ }
698
+ .lm-config-editor__json:focus {
699
+ border-color: var(--lm-accent, #B85B33);
700
+ box-shadow: var(--lm-focus-ring);
701
+ }
702
+ .lm-config-editor__json--invalid {
703
+ border-color: var(--lm-error, #A8412B);
704
+ }
705
+ .lm-config-editor__json-error {
706
+ display: flex;
707
+ align-items: flex-start;
708
+ gap: var(--lm-space-1, 4px);
709
+ font-size: var(--lm-size-body-sm, 12px);
710
+ color: var(--lm-error, #A8412B);
711
+ line-height: var(--lm-lh-body, 1.45);
712
+ margin: 0;
713
+ }
714
+ /* Saved indicator */
715
+ .lm-config-editor__saved {
716
+ display: inline-flex;
717
+ align-items: center;
718
+ gap: var(--lm-space-1, 4px);
719
+ font-size: var(--lm-size-body-sm, 12px);
720
+ color: var(--lm-text-tertiary, #6E6960);
721
+ opacity: 0;
722
+ transition: opacity var(--lm-duration-base, 220ms) var(--lm-ease);
723
+ }
724
+ .lm-config-editor__saved[data-visible] { opacity: 1; }
725
+ .lm-config-editor__saved-dot {
726
+ width: 6px;
727
+ height: 6px;
728
+ border-radius: var(--lm-radius-pill, 999px);
729
+ background: var(--lm-success, #4A6B3F);
730
+ }
731
+ /* Error banner */
732
+ .lm-config-editor__error-banner {
733
+ display: flex;
734
+ align-items: flex-start;
735
+ gap: var(--lm-space-2, 8px);
736
+ padding: var(--lm-space-2, 8px) var(--lm-space-3, 12px);
737
+ background: var(--lm-bg-tertiary, #E8E2D4);
738
+ border: 1px solid var(--lm-border, #DDD7CA);
739
+ border-radius: var(--lm-radius-sm, 6px);
740
+ font-size: var(--lm-size-body-sm, 12px);
741
+ color: var(--lm-text-primary, #1A1714);
742
+ line-height: var(--lm-lh-body, 1.45);
743
+ word-break: break-all;
744
+ }
745
+
746
+ @media (prefers-reduced-motion: reduce) {
747
+ .lm-config-editor__saved { transition: none !important; }
748
+ .lm-config-editor__json { transition: none !important; }
749
+ }`,document.head.appendChild(e)}async function Fa(e){if(typeof globalThis>`u`||typeof globalThis.fetch!=`function`)return{ok:!1,value:{},error:`no fetch implementation available`};let t=e.indexOf(`/.lerret/`),n=t===-1?e.replace(/^\/+/,``):e.slice(t+9),r=[`/@lerret-project/${n}`,`/@fixture-lerret/${n}`];for(let e of r)try{let t=await globalThis.fetch(e,{method:`GET`,cache:`no-store`});if(t.status===404||!t.ok)continue;let n=t.headers.get(`content-type`)||``;if(!n.includes(`json`)&&!n.includes(`text/plain`))continue;let r=await t.text();try{let e=JSON.parse(r);return{ok:!0,value:e&&typeof e==`object`&&!Array.isArray(e)?e:{}}}catch(e){return{ok:!1,value:{},error:e instanceof Error?e.message:String(e)}}}catch{}return{ok:!0,value:{},missing:!0}}function Ia(e){return`${e.replace(/\/+$/,``)}/config.json`}function La(e){return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(([e])=>!Pa.includes(e)))}function Ra(e,t){let n={};for(let t of Pa)Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==void 0&&(n[t]=e[t]);for(let[e,r]of Object.entries(t))n[e]=r;return n}var za={presentation:{type:`object`,description:`Canvas presentation for this folder`,properties:{background:{type:`string`,description:`CSS color string for this section's background (e.g. #f0e8d8, rgba(241,237,229,0.85))`}}},vars:{type:`object`,description:`Cascade-inherited template variables (key → string/number)`},liveRefresh:{type:`object`,description:`Live-refresh intervals per asset (asset-name → ms)`},colors:{type:`object`,description:`Color tokens for this folder`},fonts:{type:`object`,description:`Font tokens for this folder`}};function Ba({open:e,onClose:t,folderPath:n,folderName:r,writer:i,reader:a}){let s=i||Zi,c=a||Fa,l=r||(n?n.replace(/\/+$/,``).split(`/`).pop():`folder`)||`folder`,u=n?Ia(n):null,[d,f]=T.useState(null),[p,m]=T.useState(()=>({})),[h,g]=T.useState(()=>({})),[_,v]=T.useState(()=>({})),[y,b]=T.useState(!1),[x,S]=T.useState(``),[C,w]=T.useState(null),E=T.useRef(null),[O,k]=T.useState(!1),[A,j]=T.useState(null),M=T.useRef(0),[N,P]=T.useState(!1);T.useEffect(()=>{if(!e||!u)return;let t=!1;return(async()=>{f(null),j(null);let e=await c(u);if(t)return;if(!e.ok){j(e.error||`failed to read config.json`),f(!1);return}if(e.missing){f(!1),m({}),g({}),v({}),S(o({}));return}f(!0);let n=e.value;m(n);let r={};for(let e of Pa)Object.prototype.hasOwnProperty.call(n,e)&&(r[e]=n[e]);g(r);let i=La(n);v(i),S(o(i)),w(null)})(),()=>{t=!0}},[e,u]),T.useEffect(()=>()=>{E.current&&clearTimeout(E.current)},[]);let F=T.useCallback(()=>{M.current+=1;let e=M.current;k(!0),setTimeout(()=>{M.current===e&&k(!1)},1500)},[]),I=T.useCallback(async e=>{if(!u)return j(`cannot determine config.json path`),!1;let t=await s(u,o(e));return t.ok?(j(null),m(e),f(!0),F(),!0):(j(t.error||`write failed`),!1)},[u,s,F]),L=T.useCallback(async(e,t)=>{let n={...h,[e]:t};g(n),await I(Ra(n,_))},[h,_,I]),R=T.useCallback(e=>{let t=e.target.value;S(t),E.current&&clearTimeout(E.current),E.current=setTimeout(async()=>{let e;try{e=JSON.parse(t)}catch(e){w(e instanceof Error?e.message:String(e));return}if(typeof e!=`object`||!e||Array.isArray(e)){w(`JSON must be an object`);return}w(null);let n=Object.fromEntries(Object.entries(e).filter(([e])=>!Pa.includes(e)));v(n),await I(Ra(h,n))},500)},[h,I]),ee=T.useCallback(async()=>{P(!0),await I({})&&(f(!0),g({}),v({}),S(o({}))),P(!1)},[I]);return(0,D.jsx)(ji,{open:e,onClose:t,title:`Config · ${l}`,dirty:!1,footer:(0,D.jsxs)(D.Fragment,{children:[A&&(0,D.jsx)(`div`,{className:`lm-config-editor__error-banner`,role:`alert`,"aria-live":`polite`,children:(0,D.jsx)(`span`,{children:d===!1?`Could not write ${u??`config.json`}: ${A}`:`Write failed: ${A}`})}),(0,D.jsxs)(`span`,{className:`lm-config-editor__saved`,"data-visible":O?``:void 0,"aria-live":`polite`,children:[(0,D.jsx)(`span`,{className:`lm-config-editor__saved-dot`,"aria-hidden":`true`}),`Saved`]})]}),children:(0,D.jsxs)(`div`,{className:`lm-config-editor`,"data-testid":`lm-config-editor`,children:[u&&(0,D.jsx)(`p`,{className:`lm-config-editor__path`,"data-testid":`lm-config-editor-path`,children:u}),(0,D.jsx)(`p`,{className:`lm-config-editor__cascade-note`,children:`Editing this folder's config.json — values may be inherited from a parent folder`}),d===null&&(0,D.jsx)(`p`,{style:{fontSize:`var(--lm-size-body, 13px)`,color:`var(--lm-text-muted, #B8B3A8)`},children:`Loading…`}),d===!1&&(0,D.jsxs)(`div`,{className:`lm-config-editor__create`,"data-testid":`lm-config-editor-create`,children:[(0,D.jsxs)(`p`,{className:`lm-config-editor__create-msg`,children:[`This folder does not have a `,(0,D.jsx)(`code`,{children:`config.json`}),` yet.`]}),(0,D.jsx)(`code`,{className:`lm-config-editor__create-path`,children:u}),(0,D.jsx)(`button`,{type:`button`,className:`lm-config-editor__create-btn`,onClick:ee,disabled:N,"data-testid":`lm-config-editor-create-btn`,children:N?`Creating…`:`Create config.json`})]}),d===!0&&(0,D.jsx)(Va,{formValues:h,onCommitField:L,fileValue:p}),d===!0&&(0,D.jsxs)(`div`,{children:[(0,D.jsxs)(`button`,{type:`button`,className:`lm-config-editor__raw-toggle`,onClick:()=>b(e=>!e),"aria-expanded":y,"data-testid":`lm-config-editor-raw-toggle`,children:[y?`Hide raw JSON`:`Show raw JSON`,Object.keys(_).length>0&&` (${Object.keys(_).length} extra key${Object.keys(_).length===1?``:`s`})`]}),y&&(0,D.jsxs)(`div`,{style:{marginTop:`var(--lm-space-2, 8px)`},children:[(0,D.jsx)(`p`,{style:{fontSize:`var(--lm-size-hint, 10px)`,color:`var(--lm-text-muted, #B8B3A8)`,margin:`0 0 6px`,letterSpacing:`0.04em`},children:`Unknown / free-form keys (will be preserved on save)`}),(0,D.jsx)(`textarea`,{className:`lm-config-editor__json`+(C?` lm-config-editor__json--invalid`:``),value:x,onChange:R,spellCheck:!1,autoCorrect:`off`,autoCapitalize:`off`,"aria-invalid":C?`true`:void 0,"aria-label":`Raw JSON for unknown config keys`,"data-testid":`lm-config-editor-raw-json`}),C&&(0,D.jsx)(`p`,{className:`lm-config-editor__json-error`,role:`alert`,"aria-live":`polite`,children:(0,D.jsxs)(`span`,{children:[`Invalid JSON: `,C]})})]})]})]})})}function Va({formValues:e,onCommitField:t,fileValue:n}){let r=new Set([`presentation`,`vars`,`liveRefresh`]);return(0,D.jsx)(D.Fragment,{children:Pa.map(i=>{let a=za[i],o=Object.prototype.hasOwnProperty.call(n,i);if(!r.has(i)&&!o)return null;let s=Object.prototype.hasOwnProperty.call(e,i)?e[i]:o?n[i]:void 0;return(0,D.jsx)(`div`,{"data-testid":`lm-config-editor-field-${i}`,children:(0,D.jsx)(Wi,{fieldKey:i,schema:a,value:s,onCommit:e=>t(i,e)})},i)})})}if(typeof document<`u`&&!document.getElementById(`lm-entity-kebab-styles`)){let e=document.createElement(`style`);e.id=`lm-entity-kebab-styles`,e.textContent=`.lm-kebab-confirm-row {
750
+ font: var(--lm-weight-medium, 600) var(--lm-size-body-sm, 12px)/1.3 var(--lm-font-sans, sans-serif);
751
+ color: var(--lm-error, #A8412B);
752
+ }
753
+ .lm-kebab-item-destructive { color: var(--lm-error, #A8412B); }
754
+ .lm-kebab-item-destructive:hover { background: var(--lm-error-light, rgba(168, 65, 43, 0.10)) !important; }`,document.head.appendChild(e)}var Ha=`Available in the local CLI`,Ua=`Available in the local CLI`;function Wa(e){return[{kind:`item`,id:`edit-data`,label:`Edit data`,onSelect:e.onEditData},{kind:`item`,id:`edit-meta`,label:`Edit meta`,onSelect:e.onEditMeta},{kind:`separator`,id:`sep-1`},{kind:`item`,id:`duplicate`,label:`Duplicate`,onSelect:e.onDuplicate},{kind:`item`,id:`rename`,label:`Rename`,onSelect:e.onRename},{kind:`item`,id:`delete`,label:`Delete…`,onSelect:e.onDelete},{kind:`separator`,id:`sep-2`},{kind:`item`,id:`export`,label:`Export`,onSelect:e.onExport},{kind:`item`,id:`reveal-editor`,label:`Reveal in editor`,disabled:!e.cliMode,reason:e.cliMode?void 0:Ha,onSelect:e.onRevealEditor},{kind:`item`,id:`reveal-finder`,label:`Reveal in file manager`,disabled:!e.cliMode,reason:e.cliMode?void 0:Ua,onSelect:e.onRevealFinder}]}function Ga(e){return[{kind:`item`,id:`edit`,label:`Edit`,onSelect:e.onEdit},{kind:`separator`,id:`sep-1`},{kind:`item`,id:`duplicate`,label:`Duplicate`,onSelect:e.onDuplicate},{kind:`item`,id:`rename`,label:`Rename`,onSelect:e.onRename},{kind:`item`,id:`delete`,label:`Delete…`,onSelect:e.onDelete},{kind:`separator`,id:`sep-2`},{kind:`item`,id:`export`,label:`Export`,onSelect:e.onExport},{kind:`item`,id:`reveal-editor`,label:`Reveal in editor`,disabled:!e.cliMode,reason:e.cliMode?void 0:Ha,onSelect:e.onRevealEditor},{kind:`item`,id:`reveal-finder`,label:`Reveal in file manager`,disabled:!e.cliMode,reason:e.cliMode?void 0:Ua,onSelect:e.onRevealFinder}]}function Ka(e){return[{kind:`item`,id:`edit-config`,label:`Edit config`,onSelect:e.onEditConfig},{kind:`separator`,id:`sep-1`},{kind:`item`,id:`rename`,label:`Rename`,onSelect:e.onRename},{kind:`item`,id:`delete`,label:`Delete…`,onSelect:e.onDelete},{kind:`separator`,id:`sep-2`},{kind:`item`,id:`export`,label:`Export`,onSelect:e.onExport},{kind:`item`,id:`reveal-editor`,label:`Reveal in editor`,disabled:!e.cliMode,reason:e.cliMode?void 0:Ha,onSelect:e.onRevealEditor},{kind:`item`,id:`reveal-finder`,label:`Reveal in file manager`,disabled:!e.cliMode,reason:e.cliMode?void 0:Ua,onSelect:e.onRevealFinder}]}function qa(e,{confirming:t,onConfirmDelete:n,onCancelDelete:r}){if(!t)return e;let i=[];for(let t of e)t.kind===`item`&&t.id===`delete`?(i.push({kind:`item`,id:`delete-confirm`,label:`Confirm delete`,onSelect:n}),i.push({kind:`item`,id:`delete-cancel`,label:`Cancel`,onSelect:r})):i.push(t);return i}async function Ja(e,t){if(!e)return;let n=await na(e,t);n.ok||console.warn(`[lerret] reveal ${t} failed:`,n.error)}async function Ya(e){let t=await ea(e);return t.ok||console.warn(`[lerret] duplicate failed:`,t.error),t}async function Xa(e){let t=await ta(e);return t.ok||console.warn(`[lerret] delete failed:`,t.error),t}function Za({items:e,ariaLabel:t,testId:n,style:r,className:i,align:a=`bottom-end`}){return(0,D.jsx)(Ei,{items:e,align:a,renderTrigger:({open:e,getTriggerProps:a})=>(0,D.jsx)(Di,{open:e,getTriggerProps:a,"aria-label":t,className:i,style:r,"data-testid":n})})}function Qa({dataOpen:e,onCloseData:t,metaOpen:n,onCloseMeta:r,entry:i,initialFocusField:a,initialActiveVariant:o}){return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(fa,{open:e,onClose:t,entry:i,initialFocusField:a,initialActiveVariant:o}),(0,D.jsx)(Aa,{open:n,onClose:r,entry:i})]})}function $a({open:e,onClose:t,entry:n}){return(0,D.jsx)(Na,{open:e,onClose:t,entry:n,initialText:typeof n?.text==`string`?n.text:``})}function eo({open:e,onClose:t,folderPath:n,folderName:r}){return(0,D.jsx)(Ba,{open:e,onClose:t,folderPath:n,folderName:r})}function to(e){return typeof e==`string`?e.trim().replace(/\s+/g,` `):``}function no(e){let t=e.lastIndexOf(`/`),n=t===-1?``:e.slice(0,t+1),r=t===-1?e:e.slice(t+1),i=r.lastIndexOf(`.`),a=i>0;return{dir:n,stem:a?r.slice(0,i):r,ext:a?r.slice(i):``}}function ro(e){let t=e.replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n===-1?{parentDir:``,name:t}:{parentDir:t.slice(0,n+1),name:t.slice(n+1)}}function io(e,t){let n=to(t);if(!n)return null;let{dir:r,stem:i,ext:a}=no(e);return n===i?null:`${r}${n}${a}`}function ao(e,t){let n=to(t);if(!n)return null;let{parentDir:r,name:i}=ro(e);return n===i?null:`${r}${n}`}function oo(e,{fromPath:t,kind:n}){if(!e||!t)return()=>{};let r=!0,i=null,a=async e=>{if(!r)return;r=!1;let i=n===`folder`?ao(t,e):io(t,e);if(!i)return;let a=await $i(t,i);a.ok||console.warn(`[lerret] rename failed:`,a.error)},o=()=>{r&&(a(i===null?e.textContent||``:i),c())},s=t=>{t.key===`Enter`?i=e.textContent||``:t.key===`Escape`&&(r=!1,c())};function c(){e.removeEventListener(`blur`,o),e.removeEventListener(`keydown`,s)}return e.addEventListener(`blur`,o),e.addEventListener(`keydown`,s),c}if(typeof document<`u`&&!document.getElementById(`lm-artboard-kebab-styles`)){let e=document.createElement(`style`);e.id=`lm-artboard-kebab-styles`,e.textContent=`.lm-artboard-kebab-host {
755
+ position: relative;
756
+ width: 100%;
757
+ height: 100%;
758
+ }
759
+ .lm-artboard-kebab {
760
+ position: absolute;
761
+ top: 6px;
762
+ right: 6px;
763
+ z-index: 5;
764
+ opacity: 0;
765
+ }
766
+ .lm-artboard-kebab-host:hover .lm-artboard-kebab,
767
+ .lm-artboard-kebab-host:focus-within .lm-artboard-kebab,
768
+ .lm-artboard-kebab[data-open="true"],
769
+ .lm-artboard-kebab:focus-visible {
770
+ opacity: 1;
771
+ }
772
+ @media (prefers-reduced-motion: reduce) {
773
+ .lm-artboard-kebab { transition: none !important; }
774
+ }`,document.head.appendChild(e)}async function so(e){if(typeof document>`u`)return;let t=document.querySelector(`[data-dc-slot="${co(e)}"]`);if(!t){console.warn(`[lerret] export: no slot for`,e);return}if(typeof window>`u`||typeof window.dcDownloadSlots!=`function`){console.warn(`[lerret] export: window.dcDownloadSlots unavailable`);return}await window.dcDownloadSlots([t],`png`)}function co(e){return typeof CSS<`u`&&typeof CSS.escape==`function`?CSS.escape(e):String(e).replace(/[^\w-]/g,`\\$&`)}async function lo(e){if(typeof globalThis>`u`||typeof globalThis.fetch!=`function`)return{};let t=e.indexOf(`/.lerret/`),n=t===-1?e.replace(/^\/+/,``):e.slice(t+9),r=`?t=${Date.now()}`;for(let t of[`/@lerret-project`,`/@fixture-lerret`])try{let i=await globalThis.fetch(`${t}/${n}${r}`,{cache:`no-store`});if(i.status===404||!i.ok)continue;let a=i.headers.get(`content-type`)||``;if(!a.includes(`json`)&&!a.includes(`text/plain`))continue;let o=await i.text();try{return JSON.parse(o)}catch(t){return console.warn(`[lerret] failed to parse data file`,e,t),{}}}catch{}return{}}function uo(e,t){let n=e?.variantName||`default`,r=e?.meta?.propsSchema,i=l(t&&typeof t==`object`?{source:`json`,value:t}:{source:`absent`},[n]).get(n);return b({data:i&&i.source!==`absent`?i.value:void 0,propsSchema:r})}function fo({entry:e,renderComponent:t,children:n}){let[r,i]=T.useState(!1),[a,o]=T.useState(!1),[s,c]=T.useState(!1),[l,u]=T.useState(void 0),[d,p]=T.useState(void 0),[m,h]=T.useState(null),g=T.useMemo(()=>{let t=e?.asset;if(!t||typeof t.path!=`string`)return null;let n=t.path.lastIndexOf(`/`);return`${n===-1?``:t.path.slice(0,n+1)}${t.name}.data.json`},[e]);T.useEffect(()=>{if(!g)return;let e=!1;return(async()=>{let t=await lo(g);e||h(t)})(),()=>{e=!0}},[g,e?.id,e?.Component]);let _=T.useMemo(()=>uo(e,m),[e,m]),v=e?.meta?.propsSchema||null,y=T.useMemo(()=>f(_,v??{}),[_,v]),b=T.useCallback(()=>{u(y.length>0?y[0].prop:void 0),p(e?.variantName||void 0),i(!0)},[y,e?.variantName]),x=T.useCallback(()=>{if(typeof document>`u`)return;let t=e?.id,n=e?.asset?.path;if(!t||!n)return;let r=document.querySelector(`[data-dc-slot="${co(t)}"]`);if(!r)return;let i=r.querySelector(`.dc-labeltext .dc-editable`);if(!i||typeof i.focus!=`function`)return;i.focus();let a=document.createRange();a.selectNodeContents(i);let o=window.getSelection();o.removeAllRanges(),o.addRange(a),oo(i,{fromPath:n,kind:`file`})},[e]),S=T.useCallback(async()=>{let t=e?.asset?.path;t&&await Ya(t)},[e]),C=T.useCallback(()=>{c(!0)},[]),w=T.useCallback(()=>c(!1),[]),E=T.useCallback(async()=>{c(!1);let t=e?.asset?.path;t&&await Xa(t)},[e]),O=T.useCallback(()=>{e?.id&&so(e.id)},[e]),k=T.useCallback(()=>{e?.asset?.path&&Ja(e.asset.path,`editor`)},[e]),A=T.useCallback(()=>{e?.asset?.path&&Ja(e.asset.path,`finder`)},[e]),j=ra(),M=T.useMemo(()=>Wa({onEditData:()=>{u(void 0),p(void 0),i(!0)},onEditMeta:()=>o(!0),onDuplicate:S,onRename:x,onDelete:C,onExport:O,onRevealEditor:k,onRevealFinder:A,cliMode:j}),[S,x,C,O,k,A,j]),N=T.useMemo(()=>qa(M,{confirming:s,onConfirmDelete:E,onCancelDelete:w}),[M,s,E,w]),P=`Actions for ${e?.label||e?.asset?.name||`this asset`}`;return(0,D.jsxs)(`div`,{className:`lm-artboard-kebab-host`,children:[t(_),n,(0,D.jsx)(bi,{failedFields:y,propsSchema:v,onClick:b}),(0,D.jsx)(`div`,{className:`lm-artboard-kebab`,"data-testid":`lm-artboard-kebab`,children:(0,D.jsx)(Za,{items:N,ariaLabel:P,align:`bottom-end`})}),(0,D.jsx)(Qa,{dataOpen:r,onCloseData:()=>i(!1),metaOpen:a,onCloseMeta:()=>o(!1),entry:e,initialFocusField:l,initialActiveVariant:d})]})}function po({entry:e,children:t}){let[n,r]=T.useState(!1),[i,a]=T.useState(!1),o=T.useCallback(()=>{if(typeof document>`u`)return;let t=e?.id,n=e?.asset?.path;if(!t||!n)return;let r=document.querySelector(`[data-dc-slot="${co(t)}"]`);if(!r)return;let i=r.querySelector(`.dc-labeltext .dc-editable`);if(!i||typeof i.focus!=`function`)return;i.focus();let a=document.createRange();a.selectNodeContents(i);let o=window.getSelection();o.removeAllRanges(),o.addRange(a),oo(i,{fromPath:n,kind:`file`})},[e]),s=T.useCallback(async()=>{let t=e?.asset?.path;t&&await Ya(t)},[e]),c=T.useCallback(()=>a(!0),[]),l=T.useCallback(()=>a(!1),[]),u=T.useCallback(async()=>{a(!1);let t=e?.asset?.path;t&&await Xa(t)},[e]),d=T.useCallback(()=>{e?.id&&so(e.id)},[e]),f=T.useCallback(()=>{e?.asset?.path&&Ja(e.asset.path,`editor`)},[e]),p=T.useCallback(()=>{e?.asset?.path&&Ja(e.asset.path,`finder`)},[e]),m=ra(),h=T.useMemo(()=>Ga({onEdit:()=>r(!0),onDuplicate:s,onRename:o,onDelete:c,onExport:d,onRevealEditor:f,onRevealFinder:p,cliMode:m}),[s,o,c,d,f,p,m]);return(0,D.jsxs)(`div`,{className:`lm-artboard-kebab-host`,children:[t,(0,D.jsx)(`div`,{className:`lm-artboard-kebab`,"data-testid":`lm-artboard-kebab`,children:(0,D.jsx)(Za,{items:T.useMemo(()=>qa(h,{confirming:i,onConfirmDelete:u,onCancelDelete:l}),[h,i,u,l]),ariaLabel:`Actions for ${e?.label||e?.asset?.name||`this markdown asset`}`,align:`bottom-end`})}),(0,D.jsx)($a,{open:n,onClose:()=>r(!1),entry:e})]})}function mo(e){let t=e&&e.dimensions||{};return{width:typeof t.width==`number`&&t.width>0?t.width:260,height:typeof t.height==`number`&&t.height>0?t.height:200}}function ho(e,t={}){let n=e.assetKind===`markdown`,{width:r,height:i}=mo(e),a=e.asset?.path??null,o=t.cueKey,s=_i(a??``),c=e.asset?.name??null;if(e.status===m.ERROR)return(0,D.jsx)(Z,{id:e.id,label:`${e.label} (error)`,width:n?380:r,height:n?120:i,isError:!0,assetName:c,children:(0,D.jsxs)(`div`,{style:{position:`relative`,width:`100%`,height:`100%`},children:[(0,D.jsx)(si,{error:e.error,filePath:a}),(0,D.jsx)(ui,{cueKey:o})]})},e.id);let l=e.Component,u=o==null?e.id:`${e.id}::${String(o)}`;return n?(0,D.jsx)(Z,{id:e.id,label:e.label,width:380,height:`auto`,assetName:c,variantName:e.variantName,style:{height:`auto`,overflow:`visible`,background:`transparent`,boxShadow:`none`,borderRadius:0},children:(0,D.jsx)(vi,{folderPath:s,style:{position:`relative`},children:(0,D.jsxs)(po,{entry:e,children:[(0,D.jsx)(y,{resetKey:u,fallback:(0,D.jsx)(si,{error:{phase:`render`,message:`${e.label} threw while rendering`},filePath:a}),children:(0,D.jsx)(l,{})}),(0,D.jsx)(ui,{cueKey:o})]})})},e.id):(0,D.jsx)(Z,{id:e.id,label:e.label,width:r,height:i,assetName:c,variantName:e.variantName,children:(0,D.jsx)(vi,{folderPath:s,style:{position:`relative`,width:`100%`,height:`100%`},children:(0,D.jsx)(fo,{entry:e,renderComponent:t=>(0,D.jsx)(y,{resetKey:u,fallback:(0,D.jsx)(si,{error:{phase:`render`,message:`${e.label} threw while rendering`},filePath:a}),children:(0,D.jsx)(l,{...t})}),children:(0,D.jsx)(ui,{cueKey:o})})})},e.id)}var go=16;function _o(e,t){for(let n of e.assets||[])n&&n.assetKind===`component`&&t.set(n.name,n);for(let n of e.groups||[])_o(n,t)}function vo(e,t){let n=new Map,r=new Map;_o(e,r);function i(e){let a=t(e.path),o=a&&a.liveRefresh;if(o&&typeof o==`object`&&!Array.isArray(o))for(let[t,i]of Object.entries(o)){if(typeof i!=`number`||!isFinite(i)||i<go){console.warn(`[lerret/live-refresh] Ignoring liveRefresh entry "${t}" in "${e.path}": interval ${JSON.stringify(i)} is not a positive number ≥ ${go} ms.`);continue}let a=r.get(t);if(!a){console.warn(`[lerret/live-refresh] Ignoring liveRefresh entry "${t}" in "${e.path}": no component asset named "${t}" found on the current page.`);continue}n.set(a.path,i)}for(let t of e.groups||[])i(t)}return i(e),n}function yo(e,t,n){let r=(0,T.useRef)(new Map);(0,T.useEffect)(()=>{let i=r.current;if(!e||!n||typeof n.notifyChange!=`function`){for(let e of i.values())clearInterval(e);i.clear();return}let a=vo(e,t);for(let[e,t]of i.entries())a.has(e)||(clearInterval(t),i.delete(e));for(let[e,t]of a.entries()){i.has(e)&&clearInterval(i.get(e));let r=setInterval(()=>{n.notifyChange(e)},t);i.set(e,r)}return()=>{for(let e of i.values())clearInterval(e);i.clear()}},[e,t,n])}if(typeof document<`u`&&!document.getElementById(`lm-section-kebab-styles`)){let e=document.createElement(`style`);e.id=`lm-section-kebab-styles`,e.textContent=`.lm-section-kebab-host {
775
+ position: relative;
776
+ }
777
+ .lm-section-kebab {
778
+ position: absolute;
779
+ top: 18px;
780
+ left: 18px;
781
+ z-index: 10;
782
+ opacity: 0;
783
+ transition: opacity var(--lm-duration-fast, 120ms) var(--lm-ease, ease-out);
784
+ }
785
+ .lm-section-kebab-host:hover .lm-section-kebab,
786
+ .lm-section-kebab-host:focus-within .lm-section-kebab,
787
+ .lm-section-kebab[data-open="true"],
788
+ .lm-section-kebab:focus-visible {
789
+ opacity: 1;
790
+ }
791
+ @media (prefers-reduced-motion: reduce) {
792
+ .lm-section-kebab { transition: none !important; }
793
+ }`,document.head.appendChild(e)}function bo(e){return typeof CSS<`u`&&typeof CSS.escape==`function`?CSS.escape(e):String(e).replace(/[^\w-]/g,`\\$&`)}function xo({format:e,flat:t,onFormatChange:n,onFlatChange:r,progress:i,notice:a,onExport:o,onClose:s}){let c=T.useRef(null);T.useEffect(()=>{let e=e=>{e.key===`Escape`&&s()},t=e=>{c.current&&!c.current.contains(e.target)&&s()};return document.addEventListener(`keydown`,e),document.addEventListener(`pointerdown`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`pointerdown`,t)}},[s]);let l=i!==null;return(0,D.jsxs)(`div`,{ref:c,"data-testid":`lm-section-export-popover`,style:{position:`absolute`,top:0,left:32,zIndex:50,background:`rgba(255,255,255,0.97)`,backdropFilter:`blur(12px) saturate(120%)`,WebkitBackdropFilter:`blur(12px) saturate(120%)`,border:`1px solid rgba(26,23,20,0.10)`,borderRadius:10,padding:`10px 12px`,boxShadow:`0 8px 24px rgba(15,23,42,0.14), 0 1px 3px rgba(15,23,42,0.06)`,minWidth:180,fontFamily:`-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif`,fontSize:12,color:`#1A1714`},children:[(0,D.jsx)(`div`,{style:{display:`flex`,gap:4,marginBottom:6},children:[`png`,`jpg`].map(t=>(0,D.jsx)(`button`,{type:`button`,onClick:()=>n(t),style:{flex:1,padding:`4px 0`,borderRadius:6,border:`1px solid`,borderColor:e===t?`#B85B33`:`rgba(26,23,20,0.14)`,background:e===t?`#B85B33`:`transparent`,color:e===t?`#FAF8F2`:`#3A3530`,fontFamily:`inherit`,fontSize:11,fontWeight:600,cursor:`pointer`,letterSpacing:`0.04em`,textTransform:`uppercase`},children:t},t))}),(0,D.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:6,marginBottom:8,cursor:`pointer`},children:[(0,D.jsx)(`input`,{type:`checkbox`,checked:t,onChange:e=>r(e.target.checked),style:{margin:0}}),(0,D.jsx)(`span`,{style:{fontSize:11,color:`#6E6960`},children:`Flat (no folders)`})]}),(0,D.jsx)(`button`,{type:`button`,onClick:o,disabled:l,style:{width:`100%`,padding:`6px 10px`,borderRadius:7,border:`none`,background:l?`rgba(184,91,51,0.35)`:`#B85B33`,color:`#FAF8F2`,fontFamily:`inherit`,fontSize:12,fontWeight:600,cursor:l?`default`:`pointer`,transition:`background .12s`},children:i===null?`Export ZIP`:i}),a&&(0,D.jsx)(`div`,{style:{marginTop:6,fontSize:11,color:`#6E6960`,lineHeight:1.4,maxWidth:220},children:a})]})}function So({sectionId:e,sectionTitle:t,sectionKind:n=`page`,project:r,children:i}){let[a,o]=T.useState(!1),[s,c]=T.useState(!1),[l,u]=T.useState(!1),[d,f]=T.useState(`png`),[p,m]=T.useState(!1),[h,g]=T.useState(null),[_,v]=T.useState(null),y=T.useCallback(()=>{if(typeof document>`u`||!e)return;let t=document.querySelector(`[data-dc-section="${bo(e)}"]`);if(!t)return;let n=t.querySelector(`.dc-editable`);if(!n||typeof n.focus!=`function`)return;n.focus();let r=document.createRange();r.selectNodeContents(n);let i=window.getSelection();i.removeAllRanges(),i.addRange(r),oo(n,{fromPath:e,kind:`folder`})},[e]),b=T.useCallback(()=>c(!0),[]),x=T.useCallback(()=>c(!1),[]),S=T.useCallback(async()=>{c(!1),e&&await Xa(e)},[e]),C=T.useCallback(()=>{v(null),u(e=>!e)},[]),w=T.useCallback(async()=>{if(!r||!e||h!==null)return;v(null);let t=await Pn({project:r,scope:{kind:n,path:e},format:d,flat:p,onProgress:(e,t)=>{g(e===t?null:`${e}/${t}…`)}});if(g(null),!t.blob){v(`Nothing to export${t.skipped.length>0?` (${t.skipped.length} skipped)`:``}.`);return}Fn(t.blob,t.filename);let i=[];if(t.skipped.length>0){let e=t.skipped.map(e=>e.artboard?.asset?.name||`?`).join(`, `);i.push(`Skipped: ${e}`)}t.unembeddedFonts.length>0&&i.push(`Fonts not embedded: ${t.unembeddedFonts.join(`, `)}`),v(i.length>0?i.join(` · `):null),i.length===0&&u(!1)},[r,e,n,d,p,h]),E=T.useCallback(()=>{e&&Ja(e,`editor`)},[e]),O=T.useCallback(()=>{e&&Ja(e,`finder`)},[e]),k=ra(),A=T.useMemo(()=>Ka({onEditConfig:()=>o(!0),onRename:y,onDelete:b,onExport:C,onRevealEditor:E,onRevealFinder:O,cliMode:k}),[y,b,C,E,O,k]);return(0,D.jsxs)(`div`,{className:`lm-section-kebab-host`,children:[(0,D.jsxs)(`div`,{className:`lm-section-kebab`,"data-testid":`lm-section-kebab`,children:[(0,D.jsx)(Za,{items:T.useMemo(()=>qa(A,{confirming:s,onConfirmDelete:S,onCancelDelete:x}),[A,s,S,x]),ariaLabel:`Actions for ${t||`this section`}`,align:`bottom-start`}),l&&(0,D.jsx)(xo,{format:d,flat:p,onFormatChange:f,onFlatChange:m,progress:h,notice:_,onExport:w,onClose:()=>u(!1)})]}),i,(0,D.jsx)(eo,{open:a,onClose:()=>o(!1),folderPath:e,folderName:t})]})}function Co(e){if(typeof e!=`string`||e.trim()===``)return!1;if(typeof document<`u`){let t=document.createElement(`div`);return t.style.color=e,t.style.color!==``}return!/[{};]/.test(e)}function wo(e,t){let n=e&&e.presentation;if(!n||typeof n!=`object`||Array.isArray(n))return null;let r=n.background;return r==null?null:Co(r)?r:(console.warn(`[lerret/canvas] Skipping malformed presentation.background at "${t}": "${String(r)}" is not a usable CSS color string. Falling back to the default surface.`),null)}function To(e){let t=[];function n(e,r,i){let a=(e.assets||[]).filter(e=>e.kind===u.ASSET&&(e.assetKind===`component`||e.assetKind===`markdown`));if(a.length>0){let n=[...a.filter(e=>e.assetKind===`component`),...a.filter(e=>e.assetKind===`markdown`)];t.push({id:e.path,title:e.name,depth:r,kicker:r>=1?i:null,assets:n})}for(let t of e.groups||[])n(t,r+1,e.name)}return n(e,0,null),t}function Eo(e,t){let n=e&&e.pages||[];if(n.length===0)return null;if(t){let e=n.find(e=>e.path===t);if(e)return e}return n[0]}function Do({project:e,runtime:t,pageId:n}){let r=pi(),[i,a]=T.useState(null),o=T.useMemo(()=>Eo(e,n),[e,n]);yo(o,r,t);let s=T.useRef(new Map);if(T.useEffect(()=>{if(!o)return;let e=!1;return(async()=>{let n=To(o),r=await Promise.all(n.map(async e=>({id:e.id,title:e.title,depth:e.depth,kicker:e.kicker,entries:(await Promise.all(e.assets.map(e=>t.loadAsset(e)))).flat()})));e||(s.current=new Map,a({pagePath:o.path,sections:r,cueKeys:{}}))})(),()=>{e=!0}},[o,t]),T.useEffect(()=>{if(!(!t||typeof t.subscribe!=`function`))return t.subscribe(e=>{a(n=>{if(!n)return n;let r=[];for(let t of n.sections)for(let n of t.entries)n.asset&&n.asset.path===e&&r.push({section:t,entry:n});return r.length===0||(async()=>{let e=new Map;await Promise.all(r.map(async({section:n,entry:r})=>{let i=await t.loadAsset(r.asset),a=e.get(n.id)||new Map;a.set(r.asset.path,i),e.set(n.id,a)})),a(t=>{if(!t)return t;let n={...t.cueKeys},r=Oo(s.current),i=t.sections.map(t=>{let i=e.get(t.id);if(!i)return t;let a=[],o=new Set;for(let e of t.entries)if(e.asset&&i.has(e.asset.path)){if(o.has(e.asset.path))continue;o.add(e.asset.path);for(let t of i.get(e.asset.path))a.push(t),n[t.id]=r}else a.push(e);return{...t,entries:a}});return{...t,sections:i,cueKeys:n}})})(),n})})},[t]),!o)return(0,D.jsx)(ko,{title:`No pages`,body:`This project has no pages yet. Add a folder under .lerret/ to create one.`});let c=i&&i.pagePath===o.path?i.sections:null;if(c===null)return(0,D.jsx)(ko,{title:null,body:`Loading ${o.name}…`});if(c.length===0)return(0,D.jsx)(ko,{title:o.name,body:`This page has no assets yet. Drop a .jsx, .tsx, or .md file into it.`});let l=i&&i.cueKeys||{};return(0,D.jsx)(br,{children:c.map(t=>{let n=wo(r(t.id),t.id),i=n?{backgroundColor:n}:void 0,a=o&&o.path===t.id?`page`:`group`;return(0,D.jsx)(So,{sectionId:t.id,sectionTitle:t.title,sectionKind:a,project:e,children:(0,D.jsx)(Tr,{id:t.id,title:t.title,depth:t.depth,kicker:t.kicker,subtitle:`${t.entries.length} asset${t.entries.length===1?``:`s`}`,sectionStyle:i,children:t.entries.map(e=>ho(e,{cueKey:l[e.id]}))})},t.id)})},o.path)}function Oo(e){let t=0;for(let n of e.values())typeof n==`number`&&n>t&&(t=n);let n=t+1;return e.set(`__last__`,n),n}function ko({title:e,body:t}){return(0,D.jsxs)(`div`,{style:{width:`100vw`,height:`100vh`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:12,background:`var(--lm-bg-tertiary, #f0eee9)`,fontFamily:`var(--lm-font-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif)`,color:`var(--lm-text-secondary, #3a3530)`,textAlign:`center`,padding:24,boxSizing:`border-box`},children:[e&&(0,D.jsx)(`div`,{style:{fontSize:32,fontWeight:600,letterSpacing:-.6,color:`var(--lm-text-primary, #1a1714)`},children:e}),(0,D.jsx)(`div`,{style:{fontSize:14,color:`var(--lm-text-tertiary, #6e6960)`,maxWidth:`44ch`,lineHeight:1.5},children:t})]})}function Ao(e,t,n){if(!n)return e.path;let r=t&&t.path||``,i=e.path;return r&&i.startsWith(r)&&(i=i.slice(r.length)),i=i.replace(/^\/+/,``),n.replace(/\/+$/,``)+`/`+i}function jo(e){return String(e).replace(/[\\']/g,`\\$&`)}function Mo(e,t){return`@font-face {\n font-family: '${jo(e.family)}';\n src: url('${jo(t)}') format('${jo(e.format)}');\n font-display: swap;\n}`}function No(e,t){let n=e&&e.fonts||[];return n.length===0?``:n.map(e=>Mo(e,t(e))).join(`
794
+
795
+ `)}var Po=`lerret-font-registry`;function Fo(e,t={}){let n=t.assetBaseUrl,r=t.doc||(typeof document<`u`?document:void 0),i=No(e,t=>Ao(t,e,n));if(r===void 0)return{css:i,dispose(){}};let a=r.getElementById(Po);return i===``?(a&&a.parentNode&&a.parentNode.removeChild(a),{css:i,dispose(){}}):(a||(a=r.createElement(`style`),a.id=Po,a.setAttribute(`data-lerret`,`font-registry`),(r.head||r.documentElement).appendChild(a)),a.textContent=i,{css:i,dispose(){let e=r.getElementById(Po);e&&e.parentNode&&e.parentNode.removeChild(e)}})}var Io=`project`;function Lo({project:e,runtime:t,assetBaseUrl:n}){let r=T.useMemo(()=>e&&e.pages||[],[e]);T.useEffect(()=>{let t=Fo(e,{assetBaseUrl:n});return()=>t.dispose()},[e,n]);let[i,a]=Zn(Io),o=Eo(e,i),s=o?o.path:null,c=i===`storyboard`,l=T.useMemo(()=>r.length===0||c?null:{pages:r.map(e=>({id:e.path,label:e.name})),current:s,onNavigate:e=>a(e)},[r,s,a,c]),u={[Io]:{label:e?e.name:`Project`,node:(0,D.jsx)(Do,{project:e,runtime:t,pageId:s})},storyboard:{label:`Storyboard`,node:ii}};return(0,D.jsx)(F.Provider,{value:e,children:(0,D.jsx)(N.Provider,{value:l,children:(0,D.jsx)(rr,{pages:u,defaultPage:Io})})})}export{fi as n,w as r,Lo as t};